@xopcai/xopc 0.0.112 → 0.0.113

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 (102) hide show
  1. package/dist/browser-ext/icons/icon-128.png +0 -0
  2. package/dist/browser-ext/icons/icon-16.png +0 -0
  3. package/dist/browser-ext/icons/icon-32.png +0 -0
  4. package/dist/browser-ext/icons/icon-48.png +0 -0
  5. package/dist/browser-ext/manifest.json +1 -1
  6. package/dist/extensions/telegram/xopc.extension.json +1 -1
  7. package/dist/extensions/weixin/src/delivery-to.d.ts +3 -3
  8. package/dist/extensions/weixin/src/delivery-to.js.map +1 -1
  9. package/dist/gateway/static/root/apple-touch-icon.png +0 -0
  10. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-EhRp-ZMa.js → agent-avatar-dicebear-CBlklyNr.js} +1 -1
  11. package/dist/gateway/static/root/assets/{agent-browser-settings-page-H4foVCiS.js → agent-browser-settings-page-rGbKc2Hh.js} +1 -1
  12. package/dist/gateway/static/root/assets/{agent-defaults-tabbed-page-DDNw2oNU.js → agent-defaults-tabbed-page-CtwVbjOA.js} +1 -1
  13. package/dist/gateway/static/root/assets/{agents-E_X2kzS1.js → agents-CCBmGcwc.js} +3 -3
  14. package/dist/gateway/static/root/assets/{app-management-settings-panel-BIy7KEsM.js → app-management-settings-panel-28E_WfMe.js} +1 -1
  15. package/dist/gateway/static/root/assets/{appearance-settings-DGQG8NwA.js → appearance-settings-Do1z0XgJ.js} +1 -1
  16. package/dist/gateway/static/root/assets/{apps-page-BZLvInLr.js → apps-page-xwCsJS15.js} +1 -1
  17. package/dist/gateway/static/root/assets/{archive-plugin-uuQPupqx.js → archive-plugin-BAFlsov_.js} +1 -1
  18. package/dist/gateway/static/root/assets/{attachment-load-DBkv0cAv.js → attachment-load-V3qGPC3x.js} +1 -1
  19. package/dist/gateway/static/root/assets/{binary-plugins-DxxN_VAR.js → binary-plugins-DT8NvA6W.js} +1 -1
  20. package/dist/gateway/static/root/assets/{block-editor-CwnUlRmO.js → block-editor-CdLMEcHd.js} +1 -1
  21. package/dist/gateway/static/root/assets/{channels-settings-BHvUKlzw.js → channels-settings-C044DcYk.js} +1 -1
  22. package/dist/gateway/static/root/assets/{config-api-BD-NcD5d.js → config-api-Bf5mjpu7.js} +1 -1
  23. package/dist/gateway/static/root/assets/{connectors-settings-VBzXcEXL.js → connectors-settings-8VEWUOTj.js} +1 -1
  24. package/dist/gateway/static/root/assets/{cron-api-C5DoipZA.js → cron-api--pAB_rps.js} +1 -1
  25. package/dist/gateway/static/root/assets/cron-page-DqmNGNOy.js +3 -0
  26. package/dist/gateway/static/root/assets/{dreaming-settings-DSVhXTPq.js → dreaming-settings-6UZE1FSK.js} +1 -1
  27. package/dist/gateway/static/root/assets/{extension-debug-page-BDHA9o_e.js → extension-debug-page-BGhE7msg.js} +1 -1
  28. package/dist/gateway/static/root/assets/{extension-page-DmDLVSPE.js → extension-page-CvpI45WG.js} +1 -1
  29. package/dist/gateway/static/root/assets/{extension-settings-page-1124aHw_.js → extension-settings-page-DAmR5FUe.js} +1 -1
  30. package/dist/gateway/static/root/assets/{fetch-DOe56Wmy.js → fetch-NZmjSXLl.js} +1 -1
  31. package/dist/gateway/static/root/assets/{format-interval-label-tsMSvBSR.js → format-interval-label-qhth3BMV.js} +1 -1
  32. package/dist/gateway/static/root/assets/{gateway-config-api-CsD4FC9D.js → gateway-config-api-CaXBt-9R.js} +1 -1
  33. package/dist/gateway/static/root/assets/{gateway-settings-HQ8FBhY2.js → gateway-settings-DphpbLBc.js} +1 -1
  34. package/dist/gateway/static/root/assets/{gateway-startup-retry-C1zg7pH3.js → gateway-startup-retry-Be1omjh3.js} +1 -1
  35. package/dist/gateway/static/root/assets/{goal-detail-page-BG3Onph0.js → goal-detail-page-bv0VRDaf.js} +1 -1
  36. package/dist/gateway/static/root/assets/goals-page-1Ywnt4Cb.js +2 -0
  37. package/dist/gateway/static/root/assets/{goals-settings-B5nI6lgz.js → goals-settings-ceEBjnfc.js} +1 -1
  38. package/dist/gateway/static/root/assets/{heartbeat-config-api-CIv42nJD.js → heartbeat-config-api-BzO6G4fD.js} +1 -1
  39. package/dist/gateway/static/root/assets/{heartbeat-settings-DFcVuJ3M.js → heartbeat-settings-DCST9-du.js} +1 -1
  40. package/dist/gateway/static/root/assets/{index-BTmbp2AU.js → index-Cxm6xsps.js} +59 -58
  41. package/dist/gateway/static/root/assets/{index-5A_ZaABy.css → index-b_R4tKqt.css} +1 -1
  42. package/dist/gateway/static/root/assets/{interval-presets-DGP3S7OB.js → interval-presets-DJmshV8n.js} +1 -1
  43. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-fETaDYQP.js → keyboard-shortcuts-settings-9AUUlQ5Q.js} +1 -1
  44. package/dist/gateway/static/root/assets/{logs-page-B1-b27lK.js → logs-page-B_wrxhee.js} +1 -1
  45. package/dist/gateway/static/root/assets/{markdown-split-CgeBJMOD.js → markdown-split-CYYELqAr.js} +1 -1
  46. package/dist/gateway/static/root/assets/{media-plugins-C30GzlV2.js → media-plugins-BEcMR2M8.js} +1 -1
  47. package/dist/gateway/static/root/assets/messages-CkT-lcgP.js +3 -0
  48. package/dist/gateway/static/root/assets/{models-hub-panel-DPcTS1-u.js → models-hub-panel-D0JDSbNu.js} +1 -1
  49. package/dist/gateway/static/root/assets/{note-detail-page-xeGb4owe.js → note-detail-page-DpFV-EO6.js} +2 -2
  50. package/dist/gateway/static/root/assets/{note-image-lightbox-t1g0qZYh.js → note-image-lightbox-DNAoPcmm.js} +1 -1
  51. package/dist/gateway/static/root/assets/{notes-page-C_TdnKBe.js → notes-page-CdkjTch8.js} +1 -1
  52. package/dist/gateway/static/root/assets/{preview-open-alternatives-DeWp9x5g.js → preview-open-alternatives-BPLz0AIv.js} +1 -1
  53. package/dist/gateway/static/root/assets/{remote-access-hub-BtkPmJIN.js → remote-access-hub-DSYVAi96.js} +1 -1
  54. package/dist/gateway/static/root/assets/{save-bar-controls-BOaAOJI3.js → save-bar-controls-CrWwWRVK.js} +1 -1
  55. package/dist/gateway/static/root/assets/{schedule-field-BLWLKqgw.js → schedule-field-CF2sadvN.js} +1 -1
  56. package/dist/gateway/static/root/assets/{schema-form-plqRFYT8.js → schema-form-Di5cKjYE.js} +1 -1
  57. package/dist/gateway/static/root/assets/{sessions-page-DOUjxzJm.js → sessions-page-CenkcVjF.js} +1 -1
  58. package/dist/gateway/static/root/assets/settings-advanced-gate-D9sva86V.js +1 -0
  59. package/dist/gateway/static/root/assets/{settings-collapsible-section-BP5zRrDI.js → settings-collapsible-section-Chh282jW.js} +1 -1
  60. package/dist/gateway/static/root/assets/{settings-form-section-Bv8MZplG.js → settings-form-section-Dq-83cQd.js} +1 -1
  61. package/dist/gateway/static/root/assets/{settings-page-DmDfE1ww.js → settings-page-DL35U0x0.js} +1 -1
  62. package/dist/gateway/static/root/assets/{setup-status-panel-BEFwNcIZ.js → setup-status-panel-Ctwbp9Er.js} +1 -1
  63. package/dist/gateway/static/root/assets/{share-preview-page-4OX1YCgp.js → share-preview-page-0FXYnSUA.js} +1 -1
  64. package/dist/gateway/static/root/assets/{shares-settings-CbKmJZot.js → shares-settings-DIM3JNsr.js} +1 -1
  65. package/dist/gateway/static/root/assets/skill-reload-api-DAlNaNzL.js +1 -0
  66. package/dist/gateway/static/root/assets/skills-page-CLrHVzAt.js +2 -0
  67. package/dist/gateway/static/root/assets/{system-settings-panel-CGy4f_s2.js → system-settings-panel-W1pTcojB.js} +1 -1
  68. package/dist/gateway/static/root/assets/use-agent-defaults-form-BVRvkK7m.js +1 -0
  69. package/dist/gateway/static/root/assets/{use-channel-catalog-CjGHnDvN.js → use-channel-catalog-CgJibfMM.js} +1 -1
  70. package/dist/gateway/static/root/assets/{use-settings-tab-guard-BMMFa0oA.js → use-settings-tab-guard-Bw_qkRQE.js} +1 -1
  71. package/dist/gateway/static/root/assets/{voice-api-key-field-DnRbhMNq.js → voice-api-key-field-vYAO71Gn.js} +1 -1
  72. package/dist/gateway/static/root/assets/{voice-player-store-D5vzWwls.js → voice-player-store-C7lziaAx.js} +1 -1
  73. package/dist/gateway/static/root/assets/{workflow-page.utils-tjGpRVnw.js → workflow-page.utils-sgHjOXOm.js} +1 -1
  74. package/dist/gateway/static/root/assets/{workflows-page-DqqHKGj2.js → workflows-page-DYyOTmFx.js} +1 -1
  75. package/dist/gateway/static/root/favicon-16x16.png +0 -0
  76. package/dist/gateway/static/root/favicon-32x32.png +0 -0
  77. package/dist/gateway/static/root/favicon-icon.svg +1 -0
  78. package/dist/gateway/static/root/favicon.ico +0 -0
  79. package/dist/gateway/static/root/favicon.png +0 -0
  80. package/dist/gateway/static/root/favicon.svg +24 -17
  81. package/dist/gateway/static/root/index.html +5 -5
  82. package/dist/gateway/static/root/logo-dark.svg +23 -15
  83. package/dist/gateway/static/root/logo.svg +23 -16
  84. package/dist/package.js +1 -1
  85. package/dist/src/agent/service/process-direct-streaming.js +9 -4
  86. package/dist/src/agent/service/process-direct-streaming.js.map +1 -1
  87. package/dist/src/ai-assist/text-assist.d.ts +3 -0
  88. package/dist/src/ai-assist/text-assist.js +25 -7
  89. package/dist/src/ai-assist/text-assist.js.map +1 -1
  90. package/dist/src/channels/plugins/types.adapters.d.ts +2 -2
  91. package/dist/src/cron/executor.js.map +1 -1
  92. package/dist/src/cron/types.d.ts +2 -2
  93. package/dist/src/session/store-reader.d.ts +5 -0
  94. package/dist/src/session/store-reader.js +1 -0
  95. package/package.json +1 -1
  96. package/dist/gateway/static/root/assets/cron-page-BLTpdm34.js +0 -3
  97. package/dist/gateway/static/root/assets/goals-page-DgeKn8zL.js +0 -2
  98. package/dist/gateway/static/root/assets/messages-BUUfPaZ9.js +0 -3
  99. package/dist/gateway/static/root/assets/settings-advanced-gate-qK_bnTrw.js +0 -1
  100. package/dist/gateway/static/root/assets/skill-reload-api-YdtnUHtK.js +0 -1
  101. package/dist/gateway/static/root/assets/skills-page-DwW1IzQ0.js +0 -2
  102. package/dist/gateway/static/root/assets/use-agent-defaults-form-BMuMvzl_.js +0 -1
@@ -1,3 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-JdwAhgNB.js";import{t as a}from"./messages-BUUfPaZ9.js";import{t as o}from"./locale-store-DjbfSsfA.js";import{i as s}from"./theme-store-CD2wtgZV.js";import{c,i as l,n as u,t as d}from"./fetch-DOe56Wmy.js";import{r as f}from"./toast-z0toXu32.js";import{i as p}from"./vendor-swr-BIWyz7Rc.js";import{$r as m,B as h,Bo as g,Cr as _,Di as v,Ds as y,Ea as b,Fo as x,Ft as S,H as C,Ha as w,Hi as T,Jr as E,Kr as D,L as O,Oa as k,Oi as A,Oo as j,Qr as M,Ss as N,Ti as P,U as F,V as I,Xr as L,Yr as R,Zr as z,_i as B,_r as V,as as H,ba as U,bo as W,br as G,ii as ee,is as te,ji as ne,jo as re,k as ie,ki as K,o as q,oi as ae,pa as oe,qa as J,qr as se,ra as ce,ro as le,rs as Y,ta as ue,ts as X,ua as de,uo as fe,vr as pe,wi as me,wr as he,xi as ge,yr as _e,zn as ve}from"./index-BTmbp2AU.js";import{t as ye}from"./markdown-editor-AssmZFx4.js";import{t as be}from"./settings-advanced-gate-qK_bnTrw.js";import{n as xe,t as Se}from"./settings-form-section-Bv8MZplG.js";import{C as Ce,S as we,T as Te,_ as Ee,a as De,b as Oe,c as ke,d as Ae,f as je,g as Me,h as Ne,i as Pe,l as Fe,m as Ie,n as Le,o as Re,p as ze,r as Be,s as Ve,t as He,u as Ue,v as We,w as Ge,x as Ke,y as qe}from"./cron-api-C5DoipZA.js";import{t as Je}from"./cron-dreaming-jobs-nCMWCf0p.js";import{r as Ye}from"./interval-presets-DGP3S7OB.js";import{t as Xe}from"./format-interval-label-tsMSvBSR.js";import{t as Ze}from"./heartbeat-config-api-CIv42nJD.js";import{h as Qe,m as $e,t as et}from"./workflow-page.utils-tjGpRVnw.js";import{i as tt,n as nt,o as rt,r as it,t as at}from"./dist-By6Rh2ee.js";var Z=e(t(),1),Q=n(),$=r();function ot(e){let t=(0,Q.c)(25),{open:n,onOpenChange:r,action:i,c:a,onDismiss:o,onConfirm:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(L,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim`}),t[0]=c):c=t[0];let l=i===`delete`?a.delete:a.runNow,u;t[1]===l?u=t[2]:(u=(0,$.jsx)(m,{className:`text-base font-semibold text-fg`,children:l}),t[1]=l,t[2]=u);let d=i===`delete`?a.confirmDelete:a.confirmRun,f;t[3]===d?f=t[4]:(f=(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:d}),t[3]=d,t[4]=f);let p;t[5]!==a.cancel||t[6]!==o?(p=(0,$.jsx)(K,{type:`button`,variant:`secondary`,onClick:o,children:a.cancel}),t[5]=a.cancel,t[6]=o,t[7]=p):p=t[7];let h=i===`delete`?`bg-red-600 hover:bg-red-700`:void 0,g;t[8]===s?g=t[9]:(g=()=>void s(),t[8]=s,t[9]=g);let _=i===`delete`?a.delete:a.runNow,v;t[10]!==h||t[11]!==g||t[12]!==_?(v=(0,$.jsx)(K,{type:`button`,variant:`primary`,className:h,onClick:g,children:_}),t[10]=h,t[11]=g,t[12]=_,t[13]=v):v=t[13];let y;t[14]!==v||t[15]!==p?(y=(0,$.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[p,v]}),t[14]=v,t[15]=p,t[16]=y):y=t[16];let b;t[17]!==y||t[18]!==u||t[19]!==f?(b=(0,$.jsxs)(z,{children:[c,(0,$.jsx)(`div`,{className:`fixed inset-0 z-[70] flex items-center justify-center p-4 pointer-events-none`,children:(0,$.jsxs)(E,{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:[u,f,y]})})]}),t[17]=y,t[18]=u,t[19]=f,t[20]=b):b=t[20];let x;return t[21]!==r||t[22]!==n||t[23]!==b?(x=(0,$.jsx)(M,{open:n,onOpenChange:r,children:b}),t[21]=r,t[22]=n,t[23]=b,t[24]=x):x=t[24],x}var st={enabled:!0,maxConcurrentJobs:5,historyRetentionDays:7,enableMetrics:!0};function ct(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function lt(e){let t=ct(e)?e:{},n=ct(t.cron)?t.cron:{};return{enabled:n.enabled!==!1,maxConcurrentJobs:typeof n.maxConcurrentJobs==`number`&&Number.isFinite(n.maxConcurrentJobs)?Math.max(1,Math.min(100,Math.floor(n.maxConcurrentJobs))):st.maxConcurrentJobs,historyRetentionDays:typeof n.historyRetentionDays==`number`&&Number.isFinite(n.historyRetentionDays)?Math.max(1,Math.min(365,Math.floor(n.historyRetentionDays))):st.historyRetentionDays,enableMetrics:n.enableMetrics!==!1}}async function ut(e){await u(l(`/api/config`),{method:`PATCH`,body:JSON.stringify({cron:e})}),_e()}function dt(){return i(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,A,`dark:border-edge`)}function ft(){return{form:null,baseline:null,saving:!1,error:null,saveOk:!1,dirty:!1}}function pt(e,t){switch(t.type){case`sync`:return{...e,form:structuredClone(t.parsed),baseline:structuredClone(t.parsed),saveOk:!1,dirty:!1};case`patch`:return e.form?{...e,form:{...e.form,...t.patch},dirty:!0,saveOk:!1}:e;case`discard`:return e.baseline?{...e,form:structuredClone(e.baseline),dirty:!1}:e;case`saveStart`:return{...e,saving:!0,error:null};case`saveSuccess`:return e.form?{...e,saving:!1,baseline:structuredClone(e.form),dirty:!1,saveOk:!0}:{...e,saving:!1};case`saveError`:return{...e,saving:!1,error:t.error};case`clearSaveOk`:return{...e,saveOk:!1}}}function mt({hasToken:e}){let t=a(o(e=>e.language)).cron.globals,{data:n,isLoading:r}=G(e),i=(0,Z.useMemo)(()=>n?.payload?.config===void 0?null:structuredClone(lt(n.payload.config)),[n]),[s,c]=(0,Z.useReducer)(pt,void 0,ft),l=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{!e||i===null||s.dirty||l.current===i||(l.current=i,c({type:`sync`,parsed:i}))},[e,i,s.dirty]);let u=(0,Z.useMemo)(()=>!!(s.form&&s.baseline&&JSON.stringify(s.form)!==JSON.stringify(s.baseline)),[s.form,s.baseline]),d=(0,Z.useCallback)(e=>{c({type:`patch`,patch:e})},[]),p=(0,Z.useCallback)(async()=>{if(!(!s.form||s.saving)){c({type:`saveStart`});try{await ut(s.form),c({type:`saveSuccess`}),f({type:`success`,title:t.saved})}catch(e){c({type:`saveError`,error:e instanceof Error?e.message:t.saveError})}}},[t.saveError,s.form,s.saving]);return!e||!s.form?r?(0,$.jsx)(Se,{children:(0,$.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,$.jsx)(J,{className:`size-4 animate-spin`}),t.loading]})}):null:(0,$.jsxs)(Se,{children:[(0,$.jsx)(xe,{icon:g,title:t.title,subtitle:t.hint}),(0,$.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-end gap-2`,children:[(0,$.jsx)(K,{type:`button`,variant:`secondary`,disabled:!u||s.saving,onClick:()=>c({type:`discard`}),children:t.discard}),(0,$.jsx)(K,{type:`button`,variant:`primary`,disabled:!u||s.saving,onClick:()=>void p(),children:s.saving?t.saving:t.save})]}),s.error?(0,$.jsx)(`p`,{className:`mb-3 text-sm text-red-600 dark:text-red-400`,children:s.error}):null,(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg sm:col-span-2`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:s.form.enabled,onChange:e=>d({enabled:e.target.checked})}),t.enabled]}),(0,$.jsxs)(be,{children:[(0,$.jsx)(ht,{label:t.maxConcurrent,value:s.form.maxConcurrentJobs,min:1,max:100,disabled:!s.form.enabled,onChange:e=>d({maxConcurrentJobs:e})}),(0,$.jsx)(ht,{label:t.retentionDays,value:s.form.historyRetentionDays,min:1,max:365,disabled:!s.form.enabled,onChange:e=>d({historyRetentionDays:e})}),(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:s.form.enableMetrics,disabled:!s.form.enabled,onChange:e=>d({enableMetrics:e.target.checked})}),t.metrics]})]})]})]})}function ht(e){let t=(0,Q.c)(13),{label:n,value:r,min:a,max:o,disabled:s,text:c,onChange:l,onTextChange:u}=e,d;t[0]===n?d=t[1]:(d=(0,$.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=d);let f;t[2]!==s||t[3]!==o||t[4]!==a||t[5]!==l||t[6]!==u||t[7]!==c||t[8]!==r?(f=c?(0,$.jsx)(`input`,{className:i(dt(),`font-mono text-xs`),value:String(r),disabled:s,onChange:e=>u?.(e.target.value)}):(0,$.jsx)(`input`,{type:`number`,min:a,max:o,disabled:s,className:i(dt(),`max-w-xs font-mono text-xs`),value:typeof r==`number`?r:0,onChange:e=>{let t=Number(e.target.value);Number.isFinite(t)&&l&&a!==void 0&&o!==void 0&&l(Math.max(a,Math.min(o,Math.floor(t))))}}),t[2]=s,t[3]=o,t[4]=a,t[5]=l,t[6]=u,t[7]=c,t[8]=r,t[9]=f):f=t[9];let p;return t[10]!==d||t[11]!==f?(p=(0,$.jsxs)(`div`,{children:[d,f]}),t[10]=d,t[11]=f,t[12]=p):p=t[12],p}var gt=`*/5 * * * *`;function _t(e){let t=new Date(e);return t.setHours(0,0,0,0),t}function vt(e){let t=_t(e),n=t.getDay(),r=n===0?-6:1-n;return t.setDate(t.getDate()+r),t}function yt(e){return new Date(e.getFullYear(),e.getMonth(),1,0,0,0,0)}function bt(e){let t=e?.trim();t&&window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{sessionKey:t},bubbles:!0}))}function xt(e){let t=e?.trim();t&&(window.location.hash=`/workflows?run=${encodeURIComponent(t)}`)}function St(e){return i(`w-full rounded-md border border-edge bg-surface-base px-3 py-2 text-sm text-fg placeholder:text-fg-disabled`,me,e&&`cursor-not-allowed opacity-60`)}function Ct(){return i(v,P)}var wt=i(v,`w-full text-xs sm:w-auto sm:min-w-[11rem] sm:max-w-[17rem] sm:shrink-0`),Tt=i(v,`w-auto min-w-[9rem] max-w-[14rem] shrink-0 text-xs`);function Et(e){return e===`settings`?`settings`:e===`system`||e===`systemTasks`?`systemTasks`:e===`history`?`history`:`myTasks`}function Dt(e){return e===`myTasks`?null:e===`systemTasks`?`system`:e===`history`?`history`:`settings`}var Ot=34,kt=62,At=46;function jt(e){return Math.max(Ot,Math.min(kt,e))}function Mt(e){switch(e){case`success`:return`bg-emerald-500/15 text-emerald-800 dark:text-emerald-300`;case`failed`:return`bg-red-500/15 text-red-800 dark:text-red-300`;case`running`:return`bg-accent/15 text-accent`;case`cancelled`:return`bg-surface-hover text-fg-muted`;default:return`bg-surface-hover text-fg-muted`}}function Nt(e,t){return e.payload.kind===`workflowRun`?t.taskKindWorkflowRun:e.payload.kind===`agentTurn`?t.taskKindMessage:t.modeDirectOption}function Pt(e){return e.length===0?null:e.find(e=>e.status===`failed`)?.id??e[0]?.id??null}function Ft(e){let t=(0,Q.c)(56),{row:n,expanded:r,onToggle:a,c:o,statusLabels:s}=e,c=n.error||n.summary||n.output||``,l;t[0]===c?l=t[1]:(l=c.trim(),t[0]=c,t[1]=l);let u=l,d=u.length>0,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(`div`,{className:`mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-lg bg-surface-hover`,children:(0,$.jsx)(g,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0})}),t[2]=f):f=t[2];let p=n.startedAt,m;t[3]===n.startedAt?m=t[4]:(m=Ce(n.startedAt),t[3]=n.startedAt,t[4]=m);let h;t[5]!==n.startedAt||t[6]!==m?(h=(0,$.jsx)(`time`,{className:`text-sm font-medium text-fg`,dateTime:p,children:m}),t[5]=n.startedAt,t[6]=m,t[7]=h):h=t[7];let _;t[8]===n.status?_=t[9]:(_=i(`inline-flex rounded-md px-2 py-0.5 text-xs font-medium`,Mt(n.status)),t[8]=n.status,t[9]=_);let v;t[10]!==n.status||t[11]!==s?(v=Ee(n.status,s),t[10]=n.status,t[11]=s,t[12]=v):v=t[12];let y;t[13]!==_||t[14]!==v?(y=(0,$.jsx)(`span`,{className:_,children:v}),t[13]=_,t[14]=v,t[15]=y):y=t[15];let b;t[16]===n.duration?b=t[17]:(b=qe(n.duration),t[16]=n.duration,t[17]=b);let x;t[18]===b?x=t[19]:(x=(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:b}),t[18]=b,t[19]=x);let S;t[20]!==x||t[21]!==h||t[22]!==y?(S=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[h,y,x]}),t[20]=x,t[21]=h,t[22]=y,t[23]=S):S=t[23];let C;t[24]!==u||t[25]!==r||t[26]!==d?(C=!r&&d?(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:u}):null,t[24]=u,t[25]=r,t[26]=d,t[27]=C):C=t[27];let T;t[28]!==u||t[29]!==r||t[30]!==d?(T=r&&d?(0,$.jsx)(`pre`,{className:`mt-2 max-h-40 overflow-y-auto whitespace-pre-wrap break-words rounded-lg border border-edge-subtle bg-surface-panel/80 p-2.5 font-mono text-xs leading-relaxed text-fg-muted`,children:u}):null,t[28]=u,t[29]=r,t[30]=d,t[31]=T):T=t[31];let E;t[32]!==S||t[33]!==C||t[34]!==T?(E=(0,$.jsxs)(`div`,{className:`flex items-start gap-3 px-3 py-3`,children:[f,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[S,C,T]})]}),t[32]=S,t[33]=C,t[34]=T,t[35]=E):E=t[35];let D;t[36]!==o||t[37]!==r||t[38]!==d||t[39]!==a?(D=d?(0,$.jsxs)(K,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:a,children:[(0,$.jsx)(Y,{className:i(`size-3.5 transition-transform`,r&&`rotate-180`),strokeWidth:1.75,"aria-hidden":!0}),r?o.detailCollapseRun:o.detailExpandRun]}):null,t[36]=o,t[37]=r,t[38]=d,t[39]=a,t[40]=D):D=t[40];let O;t[41]!==o||t[42]!==n.workflowRunId?(O=n.workflowRunId?.trim()?(0,$.jsxs)(K,{type:`button`,variant:`secondary`,className:`h-8 gap-1.5 px-2.5 text-xs`,title:o.openWorkflowTitle,onClick:()=>xt(n.workflowRunId),children:[(0,$.jsx)(W,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),o.openWorkflow]}):null,t[41]=o,t[42]=n.workflowRunId,t[43]=O):O=t[43];let k;t[44]!==o||t[45]!==n.sessionKey?(k=n.sessionKey?.trim()?(0,$.jsxs)(K,{type:`button`,variant:`secondary`,className:`h-8 gap-1.5 px-2.5 text-xs`,title:o.openChatTitle,onClick:()=>bt(n.sessionKey),children:[(0,$.jsx)(w,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),o.openChat]}):null,t[44]=o,t[45]=n.sessionKey,t[46]=k):k=t[46];let A;t[47]!==O||t[48]!==k?(A=(0,$.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[O,k]}),t[47]=O,t[48]=k,t[49]=A):A=t[49];let j;t[50]!==D||t[51]!==A?(j=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-t border-edge-subtle px-3 py-2 dark:border-edge-subtle`,children:[D,A]}),t[50]=D,t[51]=A,t[52]=j):j=t[52];let M;return t[53]!==E||t[54]!==j?(M=(0,$.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-base dark:border-edge-subtle`,children:[E,j]}),t[53]=E,t[54]=j,t[55]=M):M=t[55],M}function It(e){let t=(0,Q.c)(13),{icon:n,label:r,value:a,valueClassName:o}=e,s;t[0]===n?s=t[1]:(s=(0,$.jsx)(n,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=n,t[1]=s);let c;t[2]!==r||t[3]!==s?(c=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:[s,r]}),t[2]=r,t[3]=s,t[4]=c):c=t[4];let l;t[5]===o?l=t[6]:(l=i(`mt-1 truncate text-sm font-medium text-fg`,o),t[5]=o,t[6]=l);let u;t[7]!==l||t[8]!==a?(u=(0,$.jsx)(`p`,{className:l,children:a}),t[7]=l,t[8]=a,t[9]=u):u=t[9];let d;return t[10]!==c||t[11]!==u?(d=(0,$.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-edge-subtle bg-surface-base/80 px-3 py-2.5 dark:border-edge-subtle`,children:[c,u]}),t[10]=c,t[11]=u,t[12]=d):d=t[12],d}function Lt({open:e,onDismiss:t,detailJob:n,detailLoading:r,actionNotice:a,detailHistory:o,c:s,localeTag:c,scheduleBadgeLabels:l,chatWorkingDirNotSet:u,statusLabels:d,onEdit:f,onRunNow:p,onToggle:h,onDelete:_}){let[v,y]=(0,Z.useState)(null),[b,S]=(0,Z.useState)(!1),[C,D]=(0,Z.useState)(At),[O,A]=(0,Z.useState)(!1),j=(0,Z.useRef)(null),N=(0,Z.useMemo)(()=>{let e=0,t=0;for(let n of o)n.status===`success`&&(e+=1),n.status===`failed`&&(t+=1);return{success:e,failed:t}},[o]),P=o[0]??null;(0,Z.useEffect)(()=>{if(!e){y(null),S(!1);return}y(Pt(o))},[e,n?.id,o]);let F=(0,Z.useCallback)(async()=>{n?.schedule&&await B(Ge(n.schedule))&&(S(!0),window.setTimeout(()=>S(!1),1500))},[n?.schedule]),I=n?we(n,c,l):`—`,R=(0,Z.useCallback)(e=>{e.preventDefault();let t=j.current;if(!t)return;let n=t.getBoundingClientRect(),r=e.currentTarget,i=e.pointerId;r.setPointerCapture(i),A(!0);let a=e=>{D(jt((e-n.left)/n.width*100))};a(e.clientX);let o=e=>{a(e.clientX)},s=()=>{try{r.releasePointerCapture(i)}catch{}A(!1),window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,s)};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s),window.addEventListener(`pointercancel`,s)},[]),V=(0,Z.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),D(e=>jt(e-4))):e.key===`ArrowRight`?(e.preventDefault(),D(e=>jt(e+4))):e.key===`Home`?(e.preventDefault(),D(Ot)):e.key===`End`&&(e.preventDefault(),D(kt))},[]);return(0,$.jsx)(M,{open:e,onOpenChange:e=>{e||t()},children:(0,$.jsxs)(z,{children:[(0,$.jsx)(L,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim backdrop-blur-[1px]`}),(0,$.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center p-4 pointer-events-none`,children:(0,$.jsxs)(E,{className:i(`xopc-dialog-content-pane pointer-events-auto relative flex h-[min(86vh,46rem)] w-full max-w-6xl flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,`dark:border-edge`),"aria-describedby":void 0,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(m,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n?.name?.trim()||n?.id||`—`}),n?(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:I}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[n?(0,$.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":n.enabled,"aria-label":n.enabled?s.enabled:s.disabled,className:i(`inline-flex h-6 w-10 shrink-0 items-center rounded-full border border-edge p-0.5 transition-colors`,n.enabled?`justify-end bg-accent`:`justify-start bg-surface-hover`),onClick:()=>h(n,!n.enabled),children:(0,$.jsx)(`span`,{className:`size-4 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`})}):null,(0,$.jsx)(se,{asChild:!0,children:(0,$.jsx)(K,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":s.close,children:(0,$.jsx)(ne,{className:`size-5`,strokeWidth:1.75})})})]})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4 lg:overflow-hidden`,children:r?(0,$.jsx)(`div`,{className:`flex justify-center py-16`,children:(0,$.jsx)(J,{className:`size-8 animate-spin text-accent`,strokeWidth:1.75})}):n?(0,$.jsxs)(`div`,{className:`flex min-h-full flex-col gap-4 lg:h-full lg:min-h-0`,children:[a?(0,$.jsx)(`div`,{className:i(`rounded-xl border px-3 py-2 text-sm`,a.kind===`error`?`border-amber-200 bg-amber-50 text-amber-900 dark:border-amber-900/50 dark:bg-amber-950/40 dark:text-amber-100`:`border-accent/25 bg-accent/5 text-fg dark:border-accent/30 dark:bg-accent/10`),role:`alert`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsx)(`p`,{children:a.message}),a.sessionKey?(0,$.jsxs)(K,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 gap-1.5 px-2.5 text-xs`,onClick:()=>bt(a.sessionKey),children:[(0,$.jsx)(w,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),s.openChat]}):null]})}):null,(0,$.jsxs)(`div`,{ref:j,className:`grid min-h-0 grid-cols-1 gap-4 lg:flex-1 lg:[grid-template-columns:minmax(0,var(--cron-detail-config-pane))_0.75rem_minmax(23rem,1fr)] lg:gap-0`,style:{"--cron-detail-config-pane":`${C}%`},children:[(0,$.jsx)(`div`,{className:`rounded-2xl border border-edge bg-surface-base/35 p-4 lg:min-h-0 lg:overflow-y-auto`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:s.scheduleLabel}),(0,$.jsxs)(`div`,{className:`mt-2 rounded-xl border border-edge-subtle bg-surface-base/80 px-3 py-3 dark:border-edge-subtle`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,$.jsx)(`p`,{className:`min-w-0 flex-1 text-sm font-medium leading-relaxed text-fg`,children:I}),(0,$.jsx)(K,{type:`button`,variant:`secondary`,className:`size-8 shrink-0 p-0`,title:s.detailCopySchedule,"aria-label":s.detailCopySchedule,onClick:()=>void F(),children:b?(0,$.jsx)(te,{className:`size-3.5 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75}):(0,$.jsx)(x,{className:`size-3.5`,strokeWidth:1.75})})]}),(0,$.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[(0,$.jsxs)(`span`,{className:`font-medium text-fg-subtle`,children:[s.detailCronTechnical,`: `]}),(0,$.jsx)(`code`,{className:`font-mono`,children:Ge(n.schedule)})]})]})]}),(0,$.jsxs)(`section`,{"aria-label":s.statsRegion,children:[(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,$.jsx)(It,{icon:H,label:s.nextRun,value:n.nextRunAtMs?Oe(new Date(n.nextRunAtMs).toISOString(),s.timeLabels):`—`}),(0,$.jsx)(It,{icon:g,label:s.detailLastRun,value:P?Ee(P.status,d):s.detailNoRecentRuns,valueClassName:P?.status===`failed`?`text-red-700 dark:text-red-300`:P?.status===`success`?`text-emerald-800 dark:text-emerald-300`:void 0})]}),o.length>0?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:s.detailRunCount.replace(`{{success}}`,String(N.success)).replace(`{{failed}}`,String(N.failed))}):null]}),(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:s.detailWhatItDoes}),(0,$.jsxs)(`div`,{className:`mt-2 rounded-xl border border-edge-subtle bg-surface-base/80 p-3 dark:border-edge-subtle`,children:[(0,$.jsx)(`div`,{className:`mb-2 inline-flex rounded-md bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:Nt(n,s)}),(0,$.jsx)(`div`,{className:`min-w-0 break-words text-fg [&_.markdown-body]:text-sm [&_.markdown-body]:leading-relaxed`,children:(0,$.jsx)(ve,{content:Pe(n),compact:!0,className:`text-sm`})})]})]}),(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(de,{className:`size-4 shrink-0 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:s.detailRunSettings})]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:s.detailRunSettingsHint}),(0,$.jsxs)(`dl`,{className:`mt-3 grid gap-3 rounded-xl border border-edge-subtle bg-surface-base/80 px-3 py-3 text-sm dark:border-edge-subtle`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:s.mode}),(0,$.jsx)(`dd`,{className:`mt-1 text-fg`,children:n.sessionTarget===`isolated`?s.modeAgentOption:s.modeDirectOption})]}),n.sessionTarget===`isolated`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:s.agentProfile}),(0,$.jsx)(`dd`,{className:`mt-1 font-mono text-sm text-fg`,children:n.agentId?.trim()?n.agentId.trim():s.agentProfileDefault})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:s.workingDirectoryLabel}),(0,$.jsx)(`dd`,{className:`mt-1 break-all font-mono text-xs text-fg`,children:n.workingDirectory?.trim()?n.workingDirectory.trim():u})]})]}):null,n.delivery?.channel===`local`||n.sessionTarget===`isolated`&&!n.delivery?.to?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:s.deliveryTarget}),(0,$.jsx)(`dd`,{className:`mt-1 text-fg`,children:n.delivery?.channel===`local`?s.deliveryTargetLocalChannel:s.deliveryLocalOnly})]}):n.delivery?.to?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:s.deliveryTarget}),(0,$.jsxs)(`dd`,{className:`mt-1 break-words text-fg`,children:[(0,$.jsx)(`code`,{className:`text-xs`,children:n.delivery?.channel??``}),` → `,We(n,s.channelLocal)]})]}):null,n.model?.trim()?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:s.model}),(0,$.jsx)(`dd`,{className:`mt-1 font-mono text-sm text-fg`,children:n.model.trim()})]}):null]})]})]})}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":s.detailResizeColumns,"aria-valuemin":Ot,"aria-valuemax":kt,"aria-valuenow":Math.round(C),tabIndex:0,onPointerDown:R,onKeyDown:V,className:i(`group hidden h-full cursor-col-resize touch-none select-none items-stretch justify-center rounded-lg outline-none lg:flex`,`focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`),children:(0,$.jsx)(`span`,{className:i(`h-full w-px bg-edge-subtle transition-colors duration-150`,`group-hover:bg-edge`,O&&`bg-edge`)})}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base/35 p-4 lg:min-h-0 lg:overflow-y-auto`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:s.detailRunHistory}),o.length>0?(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:o.length}):null]}),o.length===0?(0,$.jsxs)(`div`,{className:`mt-2 rounded-xl border border-dashed border-edge-subtle px-4 py-8 text-center dark:border-edge-subtle`,children:[(0,$.jsx)(g,{className:`mx-auto size-8 text-fg-disabled`,strokeWidth:1.25,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:s.noRunsYet})]}):(0,$.jsx)(`ul`,{className:`mt-2 space-y-2`,children:o.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsx)(Ft,{row:e,expanded:v===e.id,onToggle:()=>y(t=>t===e.id?null:e.id),c:s,statusLabels:d})},e.id))})]})]})]}):null}),n&&!r?(0,$.jsx)(`div`,{className:`shrink-0 border-t border-edge px-4 py-3`,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(K,{type:`button`,className:`gap-1.5`,onClick:()=>p(n),children:[(0,$.jsx)(k,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),s.runNow]}),(0,$.jsx)(K,{type:`button`,variant:`secondary`,onClick:()=>f(n),children:s.edit}),(0,$.jsxs)(K,{type:`button`,variant:`secondary`,className:`ml-auto text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`,onClick:()=>_(n),children:[(0,$.jsx)(T,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),s.delete]})]})}):null]})})]})})}function Rt(e){if(!e.trim())return null;try{return JSON.parse(e)}catch{return null}}function zt(e){return typeof e.message==`string`&&e.message.trim()?e.message:typeof e.error==`string`&&e.error.trim()?e.error:e.error&&typeof e.error==`object`&&typeof e.error.message==`string`?e.error.message:`AI suggestion failed`}function Bt(e,t){let n=Rt(e.split(`
2
- `).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trimStart()).join(`
3
- `));if(!n)return null;if(n.type===`text_delta`&&typeof n.delta==`string`)return t?.(n.delta),null;if(n.type===`done`&&typeof n.text==`string`)return n.text;if(n.type===`error`)throw Error(zt(n));return null}async function Vt(e,t={}){let n=await d(l(`/api/ai/text-assist`),{method:`POST`,headers:{Accept:`text/event-stream`},body:JSON.stringify(e)});if(!n.ok){let e=await n.json().catch(()=>({})),t=typeof e.error==`string`?e.error:e.error?.message;throw Error(t||`AI suggestion failed (${n.status})`)}if(!n.body){let e=await n.json().catch(()=>null);if(e?.text)return e;throw Error(`AI suggestion stream is empty`)}let r=n.body.getReader(),i=new TextDecoder,a=``,o=``;for(;;){let{done:e,value:n}=await r.read();if(n){a+=i.decode(n,{stream:!e});let r=a.split(/\r?\n\r?\n/);a=r.pop()??``;for(let e of r){let n=Bt(e,e=>{o+=e,t.onDelta?.(e)});n!==null&&(o=n)}}if(e)break}if(a.trim()){let e=Bt(a,e=>{o+=e,t.onDelta?.(e)});e!==null&&(o=e)}let s=o.trim();if(!s)throw Error(`AI returned an empty suggestion`);return{text:s}}function Ht(){let[e,t]=(0,Z.useState)(``),[n,r]=(0,Z.useState)(!1),[i,a]=(0,Z.useState)(null);return{suggestion:e,loading:n,error:i,generate:(0,Z.useCallback)(async e=>{r(!0),a(null),t(``);try{let n=await Vt(e,{onDelta:e=>{t(t=>t+e)}});return t(n.text),n.text}catch(e){return a(e instanceof Error?e.message:`AI suggestion failed`),null}finally{r(!1)}},[]),reset:(0,Z.useCallback)(()=>{t(``),a(null),r(!1)},[])}}function Ut(e){return e.startsWith(`zh`)?{title:`AI 优化文案`,buttonTitle:`优化文案`,current:`当前内容`,suggestion:`AI 建议`,loading:`正在生成建议...`,empty:`暂无内容`,replace:`替换`,append:`追加`,cancel:`取消`,close:`关闭`}:{title:`AI text assist`,buttonTitle:`Improve text`,current:`Current`,suggestion:`Suggestion`,loading:`Generating suggestion...`,empty:`No content`,replace:`Replace`,append:`Append`,cancel:`Cancel`,close:`Close`}}function Wt(e){let t=(0,Q.c)(101),{value:n,onApply:r,fieldId:a,fieldLabel:o,scenario:s,format:c,intent:l,locale:u,context:d,disabled:f,className:p,showLabel:h}=e,g=s===void 0?`generic.text`:s,_=c===void 0?`plain`:c,v=l===void 0?`improve`:l,y=h===void 0?!0:h,[b,x]=(0,Z.useState)(!1),{suggestion:S,loading:C,error:w,generate:T,reset:D}=Ht(),O;t[0]===u?O=t[1]:(O=Ut(u),t[0]=u,t[1]=O);let k=O,A;t[2]!==d||t[3]!==a||t[4]!==o||t[5]!==_||t[6]!==T||t[7]!==v||t[8]!==u||t[9]!==g||t[10]!==n?(A=async()=>{x(!0),await T({intent:v,scenario:g,input:n,locale:u,field:{id:a,label:o,format:_},context:d})},t[2]=d,t[3]=a,t[4]=o,t[5]=_,t[6]=T,t[7]=v,t[8]=u,t[9]=g,t[10]=n,t[11]=A):A=t[11];let j=A,N;t[12]===D?N=t[13]:(N=()=>{x(!1),D()},t[12]=D,t[13]=N);let P=N,F;t[14]!==P||t[15]!==r||t[16]!==S?(F=()=>{S.trim()&&(r(S),P())},t[14]=P,t[15]=r,t[16]=S,t[17]=F):F=t[17];let I=F,R;t[18]!==P||t[19]!==r||t[20]!==S||t[21]!==n?(R=()=>{if(!S.trim())return;let e=n.trimEnd();r(e?`${e}\n\n${S}`:S),P()},t[18]=P,t[19]=r,t[20]=S,t[21]=n,t[22]=R):R=t[22];let B=R,V=!y&&`size-7 p-0`,H;t[23]!==p||t[24]!==V?(H=i(`h-7 gap-1 px-2 text-xs`,V,p),t[23]=p,t[24]=V,t[25]=H):H=t[25];let U=f||C,W;t[26]===j?W=t[27]:(W=()=>void j(),t[26]=j,t[27]=W);let G;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,$.jsx)(ce,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[28]=G):G=t[28];let ee=y?k.buttonTitle:null,te;t[29]!==k.buttonTitle||t[30]!==H||t[31]!==U||t[32]!==W||t[33]!==ee?(te=(0,$.jsxs)(K,{type:`button`,variant:`ghost`,className:H,title:k.buttonTitle,"aria-label":k.buttonTitle,disabled:U,onClick:W,children:[G,ee]}),t[29]=k.buttonTitle,t[30]=H,t[31]=U,t[32]=W,t[33]=ee,t[34]=te):te=t[34];let re;t[35]===P?re=t[36]:(re=e=>e?x(!0):P(),t[35]=P,t[36]=re);let ie;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsx)(L,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim`}),t[37]=ie):ie=t[37];let q;t[38]===k.title?q=t[39]:(q=(0,$.jsx)(m,{className:`text-base font-semibold text-fg`,children:k.title}),t[38]=k.title,t[39]=q);let ae;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsx)(ne,{className:`size-5`,strokeWidth:1.75}),t[40]=ae):ae=t[40];let oe;t[41]===k.close?oe=t[42]:(oe=(0,$.jsx)(se,{asChild:!0,children:(0,$.jsx)(K,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":k.close,children:ae})}),t[41]=k.close,t[42]=oe);let J;t[43]!==q||t[44]!==oe?(J=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[q,oe]}),t[43]=q,t[44]=oe,t[45]=J):J=t[45];let le;t[46]===k.current?le=t[47]:(le=(0,$.jsx)(`div`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:k.current}),t[46]=k.current,t[47]=le);let Y;t[48]!==k.empty||t[49]!==n?(Y=n.trim()||k.empty,t[48]=k.empty,t[49]=n,t[50]=Y):Y=t[50];let ue;t[51]===Y?ue=t[52]:(ue=(0,$.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:Y}),t[51]=Y,t[52]=ue);let X;t[53]!==le||t[54]!==ue?(X=(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[le,ue]}),t[53]=le,t[54]=ue,t[55]=X):X=t[55];let de;t[56]===k.suggestion?de=t[57]:(de=(0,$.jsx)(`div`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:k.suggestion}),t[56]=k.suggestion,t[57]=de);let fe=(C||w)&&`text-fg-muted`,pe;t[58]===fe?pe=t[59]:(pe=i(`min-h-0 flex-1 overflow-auto whitespace-pre-wrap rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,fe),t[58]=fe,t[59]=pe);let me=C?k.loading:w??S,he;t[60]!==pe||t[61]!==me?(he=(0,$.jsx)(`pre`,{className:pe,children:me}),t[60]=pe,t[61]=me,t[62]=he):he=t[62];let ge;t[63]!==de||t[64]!==he?(ge=(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[de,he]}),t[63]=de,t[64]=he,t[65]=ge):ge=t[65];let _e;t[66]!==X||t[67]!==ge?(_e=(0,$.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-1 gap-3 overflow-hidden p-4 md:grid-cols-2`,children:[X,ge]}),t[66]=X,t[67]=ge,t[68]=_e):_e=t[68];let ve;t[69]!==P||t[70]!==k.cancel?(ve=(0,$.jsx)(K,{type:`button`,variant:`secondary`,onClick:P,children:k.cancel}),t[69]=P,t[70]=k.cancel,t[71]=ve):ve=t[71];let ye;t[72]!==C||t[73]!==S?(ye=C||!S.trim(),t[72]=C,t[73]=S,t[74]=ye):ye=t[74];let be;t[75]!==B||t[76]!==k.append||t[77]!==ye?(be=(0,$.jsx)(K,{type:`button`,variant:`secondary`,disabled:ye,onClick:B,children:k.append}),t[75]=B,t[76]=k.append,t[77]=ye,t[78]=be):be=t[78];let xe;t[79]!==C||t[80]!==S?(xe=C||!S.trim(),t[79]=C,t[80]=S,t[81]=xe):xe=t[81];let Se;t[82]!==I||t[83]!==k.replace||t[84]!==xe?(Se=(0,$.jsx)(K,{type:`button`,variant:`primary`,disabled:xe,onClick:I,children:k.replace}),t[82]=I,t[83]=k.replace,t[84]=xe,t[85]=Se):Se=t[85];let Ce;t[86]!==ve||t[87]!==be||t[88]!==Se?(Ce=(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-4 py-3`,children:[ve,be,Se]}),t[86]=ve,t[87]=be,t[88]=Se,t[89]=Ce):Ce=t[89];let we;t[90]!==J||t[91]!==_e||t[92]!==Ce?(we=(0,$.jsxs)(z,{children:[ie,(0,$.jsx)(`div`,{className:`fixed inset-0 z-[80] flex items-center justify-center p-4 pointer-events-none`,children:(0,$.jsxs)(E,{className:`xopc-dialog-content-pane pointer-events-auto flex h-[min(78vh,38rem)] w-full max-w-4xl flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,onOpenAutoFocus:Gt,children:[J,_e,Ce]})})]}),t[90]=J,t[91]=_e,t[92]=Ce,t[93]=we):we=t[93];let Te;t[94]!==b||t[95]!==re||t[96]!==we?(Te=(0,$.jsx)(M,{open:b,onOpenChange:re,children:we}),t[94]=b,t[95]=re,t[96]=we,t[97]=Te):Te=t[97];let Ee;return t[98]!==te||t[99]!==Te?(Ee=(0,$.jsxs)($.Fragment,{children:[te,Te]}),t[98]=te,t[99]=Te,t[100]=Ee):Ee=t[100],Ee}function Gt(e){return e.preventDefault()}function Kt(e){let t=(0,Q.c)(31),{value:n,onChange:r,disabled:i,wd:a,placeholder:o,title:s,maxWidthClass:c,clearLabel:l,onClear:u}=e,d;t[0]!==r||t[1]!==n?(d={initialPath:n,onPicked:r},t[0]=r,t[1]=n,t[2]=d):d=t[2];let f=I(d),p;t[3]===n?p=t[4]:(p=n.trim(),t[3]=n,t[4]=p);let m=p,h=s??(m?`${m}\n${a.chooseFolder}`:`${o??a.notSet}\n${a.selectWorkingDirectory}`),g=i||f.picking,_=o??a.notSet,v;t[5]!==c||t[6]!==f.pick||t[7]!==h||t[8]!==g||t[9]!==_||t[10]!==n?(v=(0,$.jsx)(C,{value:n,onPick:f.pick,disabled:g,placeholder:_,title:h,maxWidthClass:c}),t[5]=c,t[6]=f.pick,t[7]=h,t[8]=g,t[9]=_,t[10]=n,t[11]=v):v=t[11];let y;t[12]!==l||t[13]!==i||t[14]!==u||t[15]!==f.picking||t[16]!==m?(y=l&&m&&u?(0,$.jsx)(`button`,{type:`button`,disabled:i||f.picking,className:`text-xs font-medium text-accent hover:underline disabled:opacity-50`,onClick:u,children:l}):null,t[12]=l,t[13]=i,t[14]=u,t[15]=f.picking,t[16]=m,t[17]=y):y=t[17];let b;t[18]!==v||t[19]!==y?(b=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[v,y]}),t[18]=v,t[19]=y,t[20]=b):b=t[20];let x;t[21]!==f.confirmPick||t[22]!==f.hasNativePicker||t[23]!==f.modalOpen||t[24]!==f.setModalOpen||t[25]!==m||t[26]!==a?(x=f.hasNativePicker?null:(0,$.jsx)(O,{open:f.modalOpen,onOpenChange:f.setModalOpen,initialAbsolutePath:m||void 0,onConfirm:f.confirmPick,wd:a}),t[21]=f.confirmPick,t[22]=f.hasNativePicker,t[23]=f.modalOpen,t[24]=f.setModalOpen,t[25]=m,t[26]=a,t[27]=x):x=t[27];let S;return t[28]!==b||t[29]!==x?(S=(0,$.jsxs)($.Fragment,{children:[b,x]}),t[28]=b,t[29]=x,t[30]=S):S=t[30],S}function qt(e,t){return e[t]??t}function Jt(e,t){let n=q[e]??[];if(n.length===0)return{};let r=t&&typeof t==`object`&&!Array.isArray(t)?t:{},i={};for(let e of n){let t=r[e.key];t!=null&&(i[e.key]=String(t))}return i}function Yt(e,t){return(q[e]??[]).every(e=>!e.required||!!t[e.key]?.trim())}function Xt(e){let t=(0,Q.c)(12),{examples:n,labels:r,onSelect:i}=e;if(n.length===0)return null;let a;t[0]===r.examplePrompts?a=t[1]:(a=(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.examplePrompts}),t[0]=r.examplePrompts,t[1]=a);let o;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>(0,$.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded-lg border border-edge bg-surface-base/50 px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover`,children:e.text},`${e.field}:${e.text}`),t[5]=i,t[6]=e),o=n.map(e),t[2]=n,t[3]=i,t[4]=o}else o=t[4];let s;t[7]===o?s=t[8]:(s=(0,$.jsx)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:o}),t[7]=o,t[8]=s);let c;return t[9]!==a||t[10]!==s?(c=(0,$.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function Zt(e){let t=(0,Q.c)(34),{workflowName:n,language:r,argValues:o,onArgValuesChange:s,goal:c,onGoalChange:l,examplePrompts:u,showGoal:d,inputClassName:f,aiAssist:p}=e,m;t[0]===u?m=t[1]:(m=u===void 0?[]:u,t[0]=u,t[1]=m);let h=m,g=d===void 0?!0:d,_,v,y,b,x,S,C;if(t[2]!==p||t[3]!==o||t[4]!==h||t[5]!==c||t[6]!==f||t[7]!==r||t[8]!==s||t[9]!==l||t[10]!==g||t[11]!==n){y=a(r).workflows;let e=q[n]??[];v=e.length>0;let u=i(`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,f),d;t[19]!==o||t[20]!==s||t[21]!==l?(d=e=>{$e(e,l,e=>{s(e(o))})},t[19]=o,t[20]=s,t[21]=l,t[22]=d):d=t[22],_=d,b=`flex flex-col gap-3`,x=e.map(e=>{let t=qt(y.args,e.labelKey),a=qt(y.args,e.placeholderKey),c=o[e.key]??``;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-xs font-medium text-fg-muted`,children:[t,e.required?` *`:``]}),e.multiline&&p?(0,$.jsx)(Wt,{value:c,onApply:t=>s({...o,[e.key]:t}),fieldId:`workflow.arg.${e.key}`,fieldLabel:t,scenario:`workflow.arg`,locale:r,context:{...p.context,workflowName:n,workflowArgs:o,fieldKey:e.key},disabled:p.disabled,showLabel:!1}):null]}),e.multiline?(0,$.jsx)(`textarea`,{value:c,onChange:t=>s({...o,[e.key]:t.target.value}),placeholder:a,className:i(u,`min-h-20 resize-y`)}):(0,$.jsx)(`input`,{value:c,onChange:t=>s({...o,[e.key]:t.target.value}),placeholder:a,className:u})]},e.key)}),S=v&&h.length>0?(0,$.jsx)(Xt,{examples:h,labels:y,onSelect:_}):null,C=g?(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:y.goalLabel}),p?(0,$.jsx)(Wt,{value:c,onApply:l,fieldId:`workflow.goal`,fieldLabel:y.goalLabel,scenario:`cron.workflowGoal`,locale:r,context:{...p.context,workflowName:n,workflowArgs:o},disabled:p.disabled,showLabel:!1}):null]}),(0,$.jsx)(`textarea`,{value:c,onChange:e=>l(e.target.value),placeholder:y.goalPlaceholder,className:i(u,`min-h-20 resize-y`)})]}):null,t[2]=p,t[3]=o,t[4]=h,t[5]=c,t[6]=f,t[7]=r,t[8]=s,t[9]=l,t[10]=g,t[11]=n,t[12]=_,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C}else _=t[12],v=t[13],y=t[14],b=t[15],x=t[16],S=t[17],C=t[18];let w;t[23]!==_||t[24]!==h||t[25]!==v||t[26]!==y?(w=!v&&h.length>0?(0,$.jsx)(Xt,{examples:h,labels:y,onSelect:_}):null,t[23]=_,t[24]=h,t[25]=v,t[26]=y,t[27]=w):w=t[27];let T;return t[28]!==b||t[29]!==x||t[30]!==S||t[31]!==C||t[32]!==w?(T=(0,$.jsxs)(`div`,{className:b,children:[x,S,C,w]}),t[28]=b,t[29]=x,t[30]=S,t[31]=C,t[32]=w,t[33]=T):T=t[33],T}var Qt=42,$t=68,en=56;function tn(e){return Math.max(Qt,Math.min($t,e))}function nn(e){let t=(0,Q.c)(10),{title:n,children:r,className:a}=e,o;t[0]===a?o=t[1]:(o=i(`rounded-2xl border border-edge bg-surface-base/35 p-4`,a),t[0]=a,t[1]=o);let s;t[2]===n?s=t[3]:(s=n?(0,$.jsx)(`h3`,{className:`mb-3 text-sm font-semibold text-fg`,children:n}):null,t[2]=n,t[3]=s);let c;t[4]===r?c=t[5]:(c=(0,$.jsx)(`div`,{className:`flex flex-col gap-3`,children:r}),t[4]=r,t[5]=c);let l;return t[6]!==o||t[7]!==s||t[8]!==c?(l=(0,$.jsxs)(`section`,{className:o,children:[s,c]}),t[6]=o,t[7]=s,t[8]=c,t[9]=l):l=t[9],l}function rn(e){let t=(0,Q.c)(301),{open:n,onRequestClose:r,c:a,chatM:s,agentsMessages:c,isDark:l,channels:u,sessionChatIds:d,cronAgentSelectOptions:f,defaultModelResolver:p,formMode:h,formJobId:g,formName:_,onFormNameChange:v,formSchedule:y,onFormScheduleChange:b,formSubmitting:x,formTaskKind:C,onFormTaskKindChange:w,workflowDefinitions:T,workflowDefinitionsLoading:D,formWorkflowDefinitionId:O,onFormWorkflowDefinitionIdChange:k,formWorkflowGoal:A,onFormWorkflowGoalChange:N,formWorkflowArgValues:P,onFormWorkflowArgValuesChange:I,formSessionTarget:R,onFormSessionTargetChange:B,formAgentLocalOnly:V,onFormAgentLocalOnlyChange:H,formModel:W,onFormModelUserChange:G,formAgentId:ee,onFormAgentIdChange:te,formWorkingDirectory:re,onFormWorkingDirectoryChange:ie,formChannel:q,onFormChannelChange:ae,formChatId:oe,onFormChatIdChange:J,formMessage:ce,onFormMessageChange:le,formMessageMdMode:Y,onSetMessageMdMode:X,messageEditorNonce:de,needsDeliveryChat:fe,showChannelPicker:pe,canSubmit:me,onSubmit:he,onRefreshRecipients:ge}=e,_e=o(un),[be,xe]=(0,Z.useState)(en),[Se,Ce]=(0,Z.useState)(!1),[we,Te]=(0,Z.useState)(0),Ee=(0,Z.useRef)(null),De,Oe;if(t[0]!==O||t[1]!==_e||t[2]!==T){let e;t[5]===O?e=t[6]:(e=e=>e.id===O.trim(),t[5]=O,t[6]=e),De=T.find(e),Oe=De?Qe(De,_e):null,t[0]=O,t[1]=_e,t[2]=T,t[3]=De,t[4]=Oe}else De=t[3],Oe=t[4];let ke=Oe,Ae;t[7]!==y.everyMs||t[8]!==y.kind?(Ae=y.kind===`every`?Math.max(1,Math.round(y.everyMs/6e4)):60,t[7]=y.everyMs,t[8]=y.kind,t[9]=Ae):Ae=t[9];let je=Ae,Me;t[10]!==y.at||t[11]!==y.kind?(Me=y.kind===`at`&&y.at?new Date(y.at).toISOString().slice(0,16):``,t[10]=y.at,t[11]=y.kind,t[12]=Me):Me=t[12];let Ne=Me,Pe;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=e=>{e.preventDefault();let t=Ee.current;if(!t)return;let n=t.getBoundingClientRect(),r=e.currentTarget,i=e.pointerId;r.setPointerCapture(i),Ce(!0);let a=e=>{xe(tn((e-n.left)/n.width*100))};a(e.clientX);let o=e=>{a(e.clientX)},s=()=>{try{r.releasePointerCapture(i)}catch{}Ce(!1),window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,s)};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s),window.addEventListener(`pointercancel`,s)},t[13]=Pe):Pe=t[13];let Fe=Pe,Ie;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=e=>{e.key===`ArrowLeft`?(e.preventDefault(),xe(ln)):e.key===`ArrowRight`?(e.preventDefault(),xe(cn)):e.key===`Home`?(e.preventDefault(),xe(Qt)):e.key===`End`&&(e.preventDefault(),xe($t))},t[14]=Ie):Ie=t[14];let Le=Ie,Re;t[15]===a.agentProfile?Re=t[16]:(Re=(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.agentProfile}),t[15]=a.agentProfile,t[16]=Re);let ze;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(ze=Ct(),t[17]=ze):ze=t[17];let Be;t[18]===te?Be=t[19]:(Be=e=>te(e.target.value),t[18]=te,t[19]=Be);let Ve;t[20]===a.agentProfileDefault?Ve=t[21]:(Ve=(0,$.jsx)(`option`,{value:``,children:a.agentProfileDefault}),t[20]=a.agentProfileDefault,t[21]=Ve);let He;if(t[22]!==c||t[23]!==f){let e;t[25]===c?e=t[26]:(e=e=>(0,$.jsx)(`option`,{value:e.id,children:`${e.id} - ${S(e,c)}`},e.id),t[25]=c,t[26]=e),He=f.map(e),t[22]=c,t[23]=f,t[24]=He}else He=t[24];let Ue;t[27]!==ee||t[28]!==x||t[29]!==Be||t[30]!==Ve||t[31]!==He?(Ue=(0,$.jsxs)(`select`,{className:ze,value:ee,disabled:x,onChange:Be,children:[Ve,He]}),t[27]=ee,t[28]=x,t[29]=Be,t[30]=Ve,t[31]=He,t[32]=Ue):Ue=t[32];let We;t[33]===a.agentProfileHint?We=t[34]:(We=(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.agentProfileHint}),t[33]=a.agentProfileHint,t[34]=We);let qe;t[35]!==Ue||t[36]!==We||t[37]!==Re?(qe=(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[Re,Ue,We]}),t[35]=Ue,t[36]=We,t[37]=Re,t[38]=qe):qe=t[38];let Je=qe,Xe;t[39]!==a.channel||t[40]!==a.channelLocal||t[41]!==a.enterManuallyOrSelect||t[42]!==a.lastActiveLabels||t[43]!==a.noRecentChats||t[44]!==a.noRecentChatsOption||t[45]!==a.recipient||t[46]!==a.recipientPlaceholder||t[47]!==a.refreshList||t[48]!==a.refreshRecipientHint||t[49]!==a.selectRecipient||t[50]!==a.workflowDeliveryHint||t[51]!==u||t[52]!==q||t[53]!==oe||t[54]!==C||t[55]!==fe||t[56]!==ae||t[57]!==J||t[58]!==ge||t[59]!==d||t[60]!==pe?(Xe=pe?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.channel}),(0,$.jsxs)(`select`,{className:Ct(),value:q,onChange:e=>ae(e.target.value),children:[(0,$.jsx)(`option`,{value:`local`,children:a.channelLocal}),u.map(sn)]})]}),fe?(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.recipient}),(0,$.jsxs)(K,{type:`button`,variant:`ghost`,className:`h-7 gap-1 px-2 text-xs`,title:a.refreshRecipientHint,onClick:()=>void ge(),children:[(0,$.jsx)(U,{className:`size-3.5`,strokeWidth:1.75}),a.refreshList]})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch sm:gap-2`,children:[(0,$.jsx)(`input`,{type:`text`,className:i(St(),`min-w-0 w-full sm:flex-1`),value:oe,onChange:e=>J(e.target.value),placeholder:a.recipientPlaceholder}),(0,$.jsxs)(`select`,{className:wt,value:oe,onChange:e=>{let t=e.target.value;t&&J(t)},children:[(0,$.jsx)(`option`,{value:``,children:a.selectRecipient}),d.length>0?d.map(e=>(0,$.jsx)(`option`,{value:e.chatId,children:Ke(e,a.lastActiveLabels)},`${e.channel}-${e.chatId}`)):(0,$.jsx)(`option`,{value:``,disabled:!0,children:a.noRecentChatsOption})]})]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:C===`workflowRun`?a.workflowDeliveryHint:d.length>0?a.enterManuallyOrSelect:a.noRecentChats})]}):null]}):null,t[39]=a.channel,t[40]=a.channelLocal,t[41]=a.enterManuallyOrSelect,t[42]=a.lastActiveLabels,t[43]=a.noRecentChats,t[44]=a.noRecentChatsOption,t[45]=a.recipient,t[46]=a.recipientPlaceholder,t[47]=a.refreshList,t[48]=a.refreshRecipientHint,t[49]=a.selectRecipient,t[50]=a.workflowDeliveryHint,t[51]=u,t[52]=q,t[53]=oe,t[54]=C,t[55]=fe,t[56]=ae,t[57]=J,t[58]=ge,t[59]=d,t[60]=pe,t[61]=Xe):Xe=t[61];let Ze=Xe,$e;t[62]===a.schedule?$e=t[63]:($e=(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.schedule}),t[62]=a.schedule,t[63]=$e);let et;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(et=Ct(),t[64]=et):et=t[64];let tt;t[65]===b?tt=t[66]:(tt=e=>{let t=e.target.value;b(t===`cron`?{kind:`cron`,expr:`*/5 * * * *`}:t===`at`?{kind:`at`,at:new Date(Date.now()+36e5).toISOString()}:{kind:`every`,everyMs:36e5})},t[65]=b,t[66]=tt);let nt,rt,it;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(nt=(0,$.jsx)(`option`,{value:`cron`,children:`Cron`}),rt=(0,$.jsx)(`option`,{value:`at`,children:`One-time`}),it=(0,$.jsx)(`option`,{value:`every`,children:`Interval`}),t[67]=nt,t[68]=rt,t[69]=it):(nt=t[67],rt=t[68],it=t[69]);let at;t[70]!==y.kind||t[71]!==x||t[72]!==tt?(at=(0,$.jsxs)(`select`,{className:et,value:y.kind,disabled:x,onChange:tt,children:[nt,rt,it]}),t[70]=y.kind,t[71]=x,t[72]=tt,t[73]=at):at=t[73];let ot;t[74]!==$e||t[75]!==at?(ot=(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[$e,at]}),t[74]=$e,t[75]=at,t[76]=ot):ot=t[76];let st;t[77]!==Ne||t[78]!==a.nextRun||t[79]!==a.scheduleBadge||t[80]!==a.schedulePicker||t[81]!==y||t[82]!==x||t[83]!==je||t[84]!==b?(st=y.kind===`cron`?(0,$.jsx)(Ye,{value:y.expr,onChange:e=>b({...y,expr:e}),disabled:x,labels:a.schedulePicker}):y.kind===`at`?(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.nextRun}),(0,$.jsx)(`input`,{type:`datetime-local`,className:St(x),value:Ne,disabled:x,onChange:e=>{let t=new Date(e.target.value).getTime();b({kind:`at`,at:Number.isFinite(t)?new Date(t).toISOString():``})}})]}):(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.scheduleBadge.everyNMinutes.replace(`{{n}}`,``)}),(0,$.jsx)(`input`,{type:`number`,min:1,step:1,className:St(x),value:je,disabled:x,onChange:e=>{let t=Number.parseInt(e.target.value,10);b({kind:`every`,everyMs:Math.max(1,Number.isFinite(t)?t:1)*6e4})}})]}),t[77]=Ne,t[78]=a.nextRun,t[79]=a.scheduleBadge,t[80]=a.schedulePicker,t[81]=y,t[82]=x,t[83]=je,t[84]=b,t[85]=st):st=t[85];let ct;t[86]!==ot||t[87]!==st?(ct=(0,$.jsxs)($.Fragment,{children:[ot,st]}),t[86]=ot,t[87]=st,t[88]=ct):ct=t[88];let lt=ct,ut;t[89]===a.message?ut=t[90]:(ut=(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.message}),t[89]=a.message,t[90]=ut);let dt;t[91]!==le||t[92]!==X?(dt=e=>{le(e),Te(on),X(`edit`)},t[91]=le,t[92]=X,t[93]=dt):dt=t[93];let ft=a.message,pt;t[94]===y?pt=t[95]:(pt=Ge(y),t[94]=y,t[95]=pt);let mt;t[96]!==q||t[97]!==_||t[98]!==R||t[99]!==C||t[100]!==pt?(mt={page:`cron`,taskKind:C,cronName:_,scheduleSummary:pt,sessionTarget:R,deliveryChannel:q},t[96]=q,t[97]=_,t[98]=R,t[99]=C,t[100]=pt,t[101]=mt):mt=t[101];let ht;t[102]!==a.message||t[103]!==ce||t[104]!==x||t[105]!==_e||t[106]!==dt||t[107]!==mt?(ht=(0,$.jsx)(Wt,{value:ce,onApply:dt,fieldId:`cron.message`,fieldLabel:ft,scenario:`cron.message`,format:`markdown`,locale:_e,context:mt,disabled:x}),t[102]=a.message,t[103]=ce,t[104]=x,t[105]=_e,t[106]=dt,t[107]=mt,t[108]=ht):ht=t[108];let gt=Y===`edit`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`,_t;t[109]===gt?_t=t[110]:(_t=i(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,gt),t[109]=gt,t[110]=_t);let vt;t[111]===X?vt=t[112]:(vt=()=>X(`edit`),t[111]=X,t[112]=vt);let yt;t[113]===Symbol.for(`react.memo_cache_sentinel`)?(yt=(0,$.jsx)(ue,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[113]=yt):yt=t[113];let bt;t[114]!==a.messageEdit||t[115]!==_t||t[116]!==vt?(bt=(0,$.jsxs)(`button`,{type:`button`,className:_t,onClick:vt,children:[yt,a.messageEdit]}),t[114]=a.messageEdit,t[115]=_t,t[116]=vt,t[117]=bt):bt=t[117];let xt=Y===`preview`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`,Tt;t[118]===xt?Tt=t[119]:(Tt=i(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,xt),t[118]=xt,t[119]=Tt);let Et;t[120]===X?Et=t[121]:(Et=()=>X(`preview`),t[120]=X,t[121]=Et);let Dt;t[122]===Symbol.for(`react.memo_cache_sentinel`)?(Dt=(0,$.jsx)(j,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[122]=Dt):Dt=t[122];let Ot;t[123]!==a.messagePreview||t[124]!==Tt||t[125]!==Et?(Ot=(0,$.jsxs)(`button`,{type:`button`,className:Tt,onClick:Et,children:[Dt,a.messagePreview]}),t[123]=a.messagePreview,t[124]=Tt,t[125]=Et,t[126]=Ot):Ot=t[126];let kt;t[127]!==bt||t[128]!==Ot?(kt=(0,$.jsxs)(`div`,{className:`inline-flex rounded-lg border border-edge bg-surface-base p-0.5 dark:border-edge`,children:[bt,Ot]}),t[127]=bt,t[128]=Ot,t[129]=kt):kt=t[129];let At;t[130]!==ht||t[131]!==kt?(At=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[ht,kt]}),t[130]=ht,t[131]=kt,t[132]=At):At=t[132];let jt;t[133]!==ut||t[134]!==At?(jt=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[ut,At]}),t[133]=ut,t[134]=At,t[135]=jt):jt=t[135];let Mt=x&&`pointer-events-none opacity-60`,Nt;t[136]===Mt?Nt=t[137]:(Nt=i(`overflow-hidden rounded-md border border-edge bg-surface-base dark:border-edge`,Mt),t[136]=Mt,t[137]=Nt);let Pt;t[138]!==we||t[139]!==a.messagePlaceholder||t[140]!==g||t[141]!==ce||t[142]!==Y||t[143]!==l||t[144]!==de||t[145]!==le?(Pt=Y===`edit`?(0,$.jsx)(ye,{initialContent:ce,onChange:le,isDark:l,className:`h-[min(22rem,44vh)] min-h-[16rem]`},`cron-msg-${g??`new`}-${de}-${we}`):(0,$.jsx)(`div`,{className:`h-[min(22rem,44vh)] min-h-[16rem] max-h-[min(26rem,52vh)] overflow-y-auto px-3 py-2`,children:ce.trim()?(0,$.jsx)(ve,{content:ce,compact:!0,className:`text-sm`}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a.messagePlaceholder})}),t[138]=we,t[139]=a.messagePlaceholder,t[140]=g,t[141]=ce,t[142]=Y,t[143]=l,t[144]=de,t[145]=le,t[146]=Pt):Pt=t[146];let Ft;t[147]!==Nt||t[148]!==Pt?(Ft=(0,$.jsx)(`div`,{className:Nt,children:Pt}),t[147]=Nt,t[148]=Pt,t[149]=Ft):Ft=t[149];let It;t[150]===a.messageMarkdownHint?It=t[151]:(It=(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.messageMarkdownHint}),t[150]=a.messageMarkdownHint,t[151]=It);let Lt;t[152]!==jt||t[153]!==Ft||t[154]!==It?(Lt=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[jt,Ft,It]}),t[152]=jt,t[153]=Ft,t[154]=It,t[155]=Lt):Lt=t[155];let Rt=Lt,zt;t[156]===r?zt=t[157]:(zt=e=>!e&&r(),t[156]=r,t[157]=zt);let Bt;t[158]===Symbol.for(`react.memo_cache_sentinel`)?(Bt=(0,$.jsx)(L,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[158]=Bt):Bt=t[158];let Vt=h===`edit`?a.editJob:a.addJob,Ht;t[159]===Vt?Ht=t[160]:(Ht=(0,$.jsx)(m,{className:`text-base font-semibold text-fg`,children:Vt}),t[159]=Vt,t[160]=Ht);let Ut;t[161]===Symbol.for(`react.memo_cache_sentinel`)?(Ut=(0,$.jsx)(ne,{className:`size-5`,strokeWidth:1.75}),t[161]=Ut):Ut=t[161];let Gt;t[162]===a.close?Gt=t[163]:(Gt=(0,$.jsx)(se,{asChild:!0,children:(0,$.jsx)(K,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":a.close,children:Ut})}),t[162]=a.close,t[163]=Gt);let qt;t[164]!==Ht||t[165]!==Gt?(qt=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[Ht,Gt]}),t[164]=Ht,t[165]=Gt,t[166]=qt):qt=t[166];let Jt=!Se&&`lg:transition-[grid-template-columns] lg:duration-200 lg:ease-out`,Yt;t[167]===Jt?Yt=t[168]:(Yt=i(`grid min-h-full grid-cols-1 gap-4 lg:h-full lg:min-h-0 lg:[grid-template-columns:minmax(0,var(--cron-form-primary-pane))_0.75rem_minmax(22rem,1fr)] lg:gap-0`,Jt),t[167]=Jt,t[168]=Yt);let Xt=`${be}%`,rn;t[169]===Xt?rn=t[170]:(rn={"--cron-form-primary-pane":Xt},t[169]=Xt,t[170]=rn);let dn=rn,fn;t[171]===a.name?fn=t[172]:(fn=(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.name}),t[171]=a.name,t[172]=fn);let pn;t[173]===Symbol.for(`react.memo_cache_sentinel`)?(pn=St(),t[173]=pn):pn=t[173];let mn;t[174]===v?mn=t[175]:(mn=e=>v(e.target.value),t[174]=v,t[175]=mn);let hn;t[176]!==a.namePlaceholder||t[177]!==_||t[178]!==mn?(hn=(0,$.jsx)(`input`,{type:`text`,className:pn,value:_,onChange:mn,placeholder:a.namePlaceholder}),t[176]=a.namePlaceholder,t[177]=_,t[178]=mn,t[179]=hn):hn=t[179];let gn;t[180]!==fn||t[181]!==hn?(gn=(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[fn,hn]}),t[180]=fn,t[181]=hn,t[182]=gn):gn=t[182];let _n;t[183]===a.taskKind?_n=t[184]:(_n=(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.taskKind}),t[183]=a.taskKind,t[184]=_n);let vn;t[185]===Symbol.for(`react.memo_cache_sentinel`)?(vn=Ct(),t[185]=vn):vn=t[185];let yn;t[186]===w?yn=t[187]:(yn=e=>w(e.target.value),t[186]=w,t[187]=yn);let bn;t[188]===a.taskKindMessage?bn=t[189]:(bn=(0,$.jsx)(`option`,{value:`message`,children:a.taskKindMessage}),t[188]=a.taskKindMessage,t[189]=bn);let xn;t[190]===a.taskKindWorkflowRun?xn=t[191]:(xn=(0,$.jsx)(`option`,{value:`workflowRun`,children:a.taskKindWorkflowRun}),t[190]=a.taskKindWorkflowRun,t[191]=xn);let Sn;t[192]!==x||t[193]!==C||t[194]!==yn||t[195]!==bn||t[196]!==xn?(Sn=(0,$.jsxs)(`select`,{className:vn,value:C,disabled:x,onChange:yn,children:[bn,xn]}),t[192]=x,t[193]=C,t[194]=yn,t[195]=bn,t[196]=xn,t[197]=Sn):Sn=t[197];let Cn;t[198]!==_n||t[199]!==Sn?(Cn=(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[_n,Sn]}),t[198]=_n,t[199]=Sn,t[200]=Cn):Cn=t[200];let wn;t[201]!==lt||t[202]!==gn||t[203]!==Cn?(wn=(0,$.jsxs)(nn,{children:[gn,lt,Cn]}),t[201]=lt,t[202]=gn,t[203]=Cn,t[204]=wn):wn=t[204];let Tn;t[205]!==a.message||t[206]!==a.workflowDefinition||t[207]!==a.workflowDefinitionCustom||t[208]!==a.workflowDefinitionMissing||t[209]!==a.workflowDefinitionPlaceholder||t[210]!==a.workflowDefinitionsEmpty||t[211]!==a.workflowDefinitionsLoading||t[212]!==_||t[213]!==y||t[214]!==x||t[215]!==C||t[216]!==P||t[217]!==O||t[218]!==A||t[219]!==_e||t[220]!==Rt||t[221]!==I||t[222]!==k||t[223]!==N||t[224]!==De||t[225]!==ke||t[226]!==T||t[227]!==D?(Tn=C===`workflowRun`?(0,$.jsxs)(nn,{title:a.workflowDefinition,children:[(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.workflowDefinition}),(0,$.jsxs)(`select`,{className:Ct(),value:O,disabled:x||D,onChange:e=>k(e.target.value),children:[(0,$.jsx)(`option`,{value:``,children:D?a.workflowDefinitionsLoading:a.workflowDefinitionPlaceholder}),O.trim()&&!T.some(e=>e.id===O.trim())?(0,$.jsx)(`option`,{value:O,children:O}):null,T.map(e=>(0,$.jsxs)(`option`,{value:e.id,children:[e.title,e.metadata.source===`user`?` (${a.workflowDefinitionCustom})`:``]},e.id))]}),!D&&T.length===0?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.workflowDefinitionsEmpty}):null,ke?(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:ke.description}):O.trim()&&!De?(0,$.jsx)(`p`,{className:`text-xs text-amber-700 dark:text-amber-300`,children:a.workflowDefinitionMissing}):null]}),O.trim()?(0,$.jsx)(Zt,{workflowName:O.trim(),language:_e,argValues:P,onArgValuesChange:I,goal:A,onGoalChange:N,examplePrompts:ke?.examplePrompts??[],inputClassName:St(),aiAssist:{disabled:x,context:{page:`cron`,taskKind:C,cronName:_,scheduleSummary:Ge(y),workflowDefinitionId:O.trim(),workflowDescription:ke?.description??``}}}):null]}):(0,$.jsx)(nn,{title:a.message,children:Rt}),t[205]=a.message,t[206]=a.workflowDefinition,t[207]=a.workflowDefinitionCustom,t[208]=a.workflowDefinitionMissing,t[209]=a.workflowDefinitionPlaceholder,t[210]=a.workflowDefinitionsEmpty,t[211]=a.workflowDefinitionsLoading,t[212]=_,t[213]=y,t[214]=x,t[215]=C,t[216]=P,t[217]=O,t[218]=A,t[219]=_e,t[220]=Rt,t[221]=I,t[222]=k,t[223]=N,t[224]=De,t[225]=ke,t[226]=T,t[227]=D,t[228]=Tn):Tn=t[228];let En;t[229]!==wn||t[230]!==Tn?(En=(0,$.jsx)(`div`,{className:`lg:min-h-0 lg:overflow-y-auto`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[wn,Tn]})}),t[229]=wn,t[230]=Tn,t[231]=En):En=t[231];let Dn=a.detailResizeColumns,On;t[232]===be?On=t[233]:(On=Math.round(be),t[232]=be,t[233]=On);let kn;t[234]===Symbol.for(`react.memo_cache_sentinel`)?(kn=i(`group hidden h-full cursor-col-resize touch-none select-none items-stretch justify-center rounded-lg outline-none lg:flex`,`focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`),t[234]=kn):kn=t[234];let An=Se&&`bg-edge`,jn;t[235]===An?jn=t[236]:(jn=i(`h-full w-px bg-edge-subtle transition-colors duration-150`,`group-hover:bg-edge`,An),t[235]=An,t[236]=jn);let Mn;t[237]===jn?Mn=t[238]:(Mn=(0,$.jsx)(`span`,{className:jn}),t[237]=jn,t[238]=Mn);let Nn;t[239]!==a.detailResizeColumns||t[240]!==On||t[241]!==Mn?(Nn=(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":Dn,"aria-valuemin":Qt,"aria-valuemax":$t,"aria-valuenow":On,tabIndex:0,onPointerDown:Fe,onKeyDown:Le,className:kn,children:Mn}),t[239]=a.detailResizeColumns,t[240]=On,t[241]=Mn,t[242]=Nn):Nn=t[242];let Pn;t[243]!==Je||t[244]!==a.agentLocalOnly||t[245]!==a.agentLocalOnlyHint||t[246]!==a.detailRunSettings||t[247]!==a.mode||t[248]!==a.modeAgent||t[249]!==a.modeAgentOption||t[250]!==a.modeDirect||t[251]!==a.modeDirectOption||t[252]!==a.model||t[253]!==a.workflowLocalOnly||t[254]!==a.workflowLocalOnlyHint||t[255]!==a.workingDirectoryHint||t[256]!==a.workingDirectoryLabel||t[257]!==a.workingDirectoryReset||t[258]!==s||t[259]!==p||t[260]!==V||t[261]!==W||t[262]!==R||t[263]!==x||t[264]!==C||t[265]!==re||t[266]!==H||t[267]!==G||t[268]!==B||t[269]!==ie?(Pn=C===`message`?(0,$.jsxs)(nn,{title:a.detailRunSettings,children:[(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.mode}),(0,$.jsxs)(`select`,{className:Ct(),value:R,onChange:e=>{let t=e.target.value;B(t,p,W.trim())},children:[(0,$.jsx)(`option`,{value:`main`,children:a.modeDirectOption}),(0,$.jsx)(`option`,{value:`isolated`,children:a.modeAgentOption})]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:R===`main`?a.modeDirect:a.modeAgent})]}),R===`isolated`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.model}),(0,$.jsx)(F,{value:W,placeholder:s.modelPlaceholder,searchPlaceholder:s.modelSearchPlaceholder,noMatches:s.modelNoMatches,className:`w-full max-w-none min-w-0`,popoverContentClassName:`z-[70]`,onChange:G})]}),Je,(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:a.workingDirectoryLabel}),(0,$.jsx)(Kt,{value:re,onChange:ie,disabled:x,wd:s.workingDirectory,placeholder:s.workingDirectory.notSet,maxWidthClass:`max-w-[min(18rem,52vw)]`,clearLabel:a.workingDirectoryReset,onClear:()=>ie(``)}),(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.workingDirectoryHint})]}),(0,$.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,$.jsx)(`input`,{type:`checkbox`,className:i(`ui-checkbox`,`mt-0.5`),checked:V,onChange:e=>H(e.target.checked),"aria-label":a.agentLocalOnly}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:a.agentLocalOnly}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a.agentLocalOnlyHint})]})]})]}):null]}):(0,$.jsxs)(nn,{title:a.detailRunSettings,children:[Je,(0,$.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,$.jsx)(`input`,{type:`checkbox`,className:i(`ui-checkbox`,`mt-0.5`),checked:V,onChange:e=>H(e.target.checked),"aria-label":a.workflowLocalOnly}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:a.workflowLocalOnly}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a.workflowLocalOnlyHint})]})]})]}),t[243]=Je,t[244]=a.agentLocalOnly,t[245]=a.agentLocalOnlyHint,t[246]=a.detailRunSettings,t[247]=a.mode,t[248]=a.modeAgent,t[249]=a.modeAgentOption,t[250]=a.modeDirect,t[251]=a.modeDirectOption,t[252]=a.model,t[253]=a.workflowLocalOnly,t[254]=a.workflowLocalOnlyHint,t[255]=a.workingDirectoryHint,t[256]=a.workingDirectoryLabel,t[257]=a.workingDirectoryReset,t[258]=s,t[259]=p,t[260]=V,t[261]=W,t[262]=R,t[263]=x,t[264]=C,t[265]=re,t[266]=H,t[267]=G,t[268]=B,t[269]=ie,t[270]=Pn):Pn=t[270];let Fn;t[271]!==a.deliveryTarget||t[272]!==Ze?(Fn=Ze?(0,$.jsx)(nn,{title:a.deliveryTarget,children:Ze}):null,t[271]=a.deliveryTarget,t[272]=Ze,t[273]=Fn):Fn=t[273];let In;t[274]!==Pn||t[275]!==Fn?(In=(0,$.jsx)(`aside`,{className:`lg:min-h-0 lg:overflow-y-auto`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[Pn,Fn]})}),t[274]=Pn,t[275]=Fn,t[276]=In):In=t[276];let Ln;t[277]!==Yt||t[278]!==dn||t[279]!==En||t[280]!==Nn||t[281]!==In?(Ln=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4 lg:overflow-hidden`,children:(0,$.jsxs)(`div`,{ref:Ee,className:Yt,style:dn,children:[En,Nn,In]})}),t[277]=Yt,t[278]=dn,t[279]=En,t[280]=Nn,t[281]=In,t[282]=Ln):Ln=t[282];let Rn;t[283]!==a.cancel||t[284]!==r?(Rn=(0,$.jsx)(K,{type:`button`,variant:`secondary`,onClick:r,children:a.cancel}),t[283]=a.cancel,t[284]=r,t[285]=Rn):Rn=t[285];let zn=x||!me,Bn=x?a.loading:h===`edit`?a.save:a.create,Vn;t[286]!==he||t[287]!==zn||t[288]!==Bn?(Vn=(0,$.jsx)(K,{type:`button`,variant:`primary`,disabled:zn,onClick:he,children:Bn}),t[286]=he,t[287]=zn,t[288]=Bn,t[289]=Vn):Vn=t[289];let Hn;t[290]!==Rn||t[291]!==Vn?(Hn=(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-4 py-3`,children:[Rn,Vn]}),t[290]=Rn,t[291]=Vn,t[292]=Hn):Hn=t[292];let Un;t[293]!==qt||t[294]!==Ln||t[295]!==Hn?(Un=(0,$.jsxs)(z,{children:[Bt,(0,$.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center p-4 pointer-events-none`,children:(0,$.jsxs)(E,{className:`xopc-dialog-content-pane pointer-events-auto relative flex h-[min(86vh,46rem)] w-full max-w-6xl flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none dark:border-edge`,onOpenAutoFocus:an,children:[qt,Ln,Hn]})})]}),t[293]=qt,t[294]=Ln,t[295]=Hn,t[296]=Un):Un=t[296];let Wn;return t[297]!==n||t[298]!==zt||t[299]!==Un?(Wn=(0,$.jsx)(M,{open:n,onOpenChange:zt,children:Un}),t[297]=n,t[298]=zt,t[299]=Un,t[300]=Wn):Wn=t[300],Wn}function an(e){return e.preventDefault()}function on(e){return e+1}function sn(e){return(0,$.jsxs)(`option`,{value:e.name,disabled:!e.enabled,children:[e.name,` `,e.enabled?``:`(disabled)`]},e.name)}function cn(e){return tn(e+4)}function ln(e){return tn(e-4)}function un(e){return e.language}function dn(e){let t=(0,Q.c)(76),{c:n,mainTab:r,onMainTabChange:a,jobSort:o,onJobSortChange:s,historyRange:c,onHistoryRangeChange:l,historyJobFilter:u,onHistoryJobFilterChange:d,historyStatusFilter:f,onHistoryStatusFilterChange:p,jobs:m}=e,h=n.title,g=r===`myTasks`,v=r===`myTasks`?`text-fg`:`text-fg-muted hover:text-fg`,y;t[0]===v?y=t[1]:(y=i(`rounded-md px-3 py-2 text-sm font-medium transition-colors`,v),t[0]=v,t[1]=y);let b;t[2]===a?b=t[3]:(b=()=>a(`myTasks`),t[2]=a,t[3]=b);let x;t[4]!==n.tabMyTasks||t[5]!==g||t[6]!==y||t[7]!==b?(x=(0,$.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":g,className:y,onClick:b,children:n.tabMyTasks}),t[4]=n.tabMyTasks,t[5]=g,t[6]=y,t[7]=b,t[8]=x):x=t[8];let S=r===`systemTasks`,C=r===`systemTasks`?`text-fg`:`text-fg-muted hover:text-fg`,w;t[9]===C?w=t[10]:(w=i(`rounded-md px-3 py-2 text-sm font-medium transition-colors`,C),t[9]=C,t[10]=w);let T;t[11]===a?T=t[12]:(T=()=>a(`systemTasks`),t[11]=a,t[12]=T);let E;t[13]!==n.tabSystemTasks||t[14]!==T||t[15]!==S||t[16]!==w?(E=(0,$.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":S,className:w,onClick:T,children:n.tabSystemTasks}),t[13]=n.tabSystemTasks,t[14]=T,t[15]=S,t[16]=w,t[17]=E):E=t[17];let D=r===`history`,O=r===`history`?`text-fg`:`text-fg-muted hover:text-fg`,k;t[18]===O?k=t[19]:(k=i(`rounded-md px-3 py-2 text-sm font-medium transition-colors`,O),t[18]=O,t[19]=k);let A;t[20]===a?A=t[21]:(A=()=>a(`history`),t[20]=a,t[21]=A);let j;t[22]!==n.tabRunHistory||t[23]!==D||t[24]!==k||t[25]!==A?(j=(0,$.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":D,className:k,onClick:A,children:n.tabRunHistory}),t[22]=n.tabRunHistory,t[23]=D,t[24]=k,t[25]=A,t[26]=j):j=t[26];let M=r===`settings`,N=r===`settings`?`text-fg`:`text-fg-muted hover:text-fg`,P;t[27]===N?P=t[28]:(P=i(`rounded-md px-3 py-2 text-sm font-medium transition-colors`,N),t[27]=N,t[28]=P);let F;t[29]===a?F=t[30]:(F=()=>a(`settings`),t[29]=a,t[30]=F);let I;t[31]!==n.globals.title||t[32]!==M||t[33]!==P||t[34]!==F?(I=(0,$.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":M,className:P,onClick:F,children:n.globals.title}),t[31]=n.globals.title,t[32]=M,t[33]=P,t[34]=F,t[35]=I):I=t[35];let L;t[36]!==n.title||t[37]!==E||t[38]!==j||t[39]!==I||t[40]!==x?(L=(0,$.jsxs)(`div`,{className:`flex gap-1`,role:`tablist`,"aria-label":h,children:[x,E,j,I]}),t[36]=n.title,t[37]=E,t[38]=j,t[39]=I,t[40]=x,t[41]=L):L=t[41];let R=r===`history`?`flex-nowrap overflow-x-auto pb-0.5 sm:justify-end`:`flex-wrap sm:justify-end`,z;t[42]===R?z=t[43]:(z=i(`flex min-w-0 items-center gap-2`,R),t[42]=R,t[43]=z);let B;t[44]!==n.sortCreatedAsc||t[45]!==n.sortCreatedDesc||t[46]!==o||t[47]!==r||t[48]!==s?(B=r===`myTasks`||r===`systemTasks`?(0,$.jsxs)(`select`,{className:Tt,value:o,onChange:e=>s(e.target.value),"aria-label":n.sortCreatedDesc,children:[(0,$.jsx)(`option`,{value:`created_desc`,children:n.sortCreatedDesc}),(0,$.jsx)(`option`,{value:`created_asc`,children:n.sortCreatedAsc})]}):null,t[44]=n.sortCreatedAsc,t[45]=n.sortCreatedDesc,t[46]=o,t[47]=r,t[48]=s,t[49]=B):B=t[49];let V;t[50]!==n.execStatusCancelled||t[51]!==n.execStatusFailed||t[52]!==n.execStatusRunning||t[53]!==n.execStatusSuccess||t[54]!==n.filterAllStatuses||t[55]!==n.filterAllTasks||t[56]!==n.historyRangeDay||t[57]!==n.historyRangeMonth||t[58]!==n.historyRangeWeek||t[59]!==n.runHistoryTitle||t[60]!==u||t[61]!==c||t[62]!==f||t[63]!==m||t[64]!==r||t[65]!==d||t[66]!==l||t[67]!==p?(V=r===`history`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:i(he,`shrink-0`),role:`group`,"aria-label":n.runHistoryTitle,children:[`day`,`week`,`month`].map(e=>(0,$.jsx)(`button`,{type:`button`,className:i(_,`px-2.5 py-1`,c===e&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,c===e&&`text-fg`),onClick:()=>l(e),children:e===`day`?n.historyRangeDay:e===`week`?n.historyRangeWeek:n.historyRangeMonth},e))}),(0,$.jsxs)(`select`,{className:Tt,value:u,onChange:e=>d(e.target.value),"aria-label":n.filterAllTasks,children:[(0,$.jsx)(`option`,{value:``,children:n.filterAllTasks}),m.map(fn)]}),(0,$.jsxs)(`select`,{className:Tt,value:f,onChange:e=>p(e.target.value),"aria-label":n.filterAllStatuses,children:[(0,$.jsx)(`option`,{value:``,children:n.filterAllStatuses}),(0,$.jsx)(`option`,{value:`success`,children:n.execStatusSuccess}),(0,$.jsx)(`option`,{value:`failed`,children:n.execStatusFailed}),(0,$.jsx)(`option`,{value:`cancelled`,children:n.execStatusCancelled}),(0,$.jsx)(`option`,{value:`running`,children:n.execStatusRunning})]})]}):null,t[50]=n.execStatusCancelled,t[51]=n.execStatusFailed,t[52]=n.execStatusRunning,t[53]=n.execStatusSuccess,t[54]=n.filterAllStatuses,t[55]=n.filterAllTasks,t[56]=n.historyRangeDay,t[57]=n.historyRangeMonth,t[58]=n.historyRangeWeek,t[59]=n.runHistoryTitle,t[60]=u,t[61]=c,t[62]=f,t[63]=m,t[64]=r,t[65]=d,t[66]=l,t[67]=p,t[68]=V):V=t[68];let H;t[69]!==z||t[70]!==B||t[71]!==V?(H=(0,$.jsxs)(`div`,{className:z,children:[B,V]}),t[69]=z,t[70]=B,t[71]=V,t[72]=H):H=t[72];let U;return t[73]!==L||t[74]!==H?(U=(0,$.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:[L,H]}),t[73]=L,t[74]=H,t[75]=U):U=t[75],U}function fn(e){return(0,$.jsx)(`option`,{value:e.id,children:e.name||e.id},e.id)}function pn(e){let t=(0,Q.c)(23),{c:n,loading:r,runHistoryLoading:a,onRefresh:o,onOpenTemplatePicker:s,onAddJob:c}=e,l=r||a,u=n.refresh,d=n.refresh,f;t[0]===o?f=t[1]:(f=()=>void o(),t[0]=o,t[1]=f);let p=l&&`animate-spin`,m;t[2]===p?m=t[3]:(m=i(`size-4`,p),t[2]=p,t[3]=m);let h;t[4]===m?h=t[5]:(h=(0,$.jsx)(U,{className:m,strokeWidth:1.75}),t[4]=m,t[5]=h);let g;t[6]!==l||t[7]!==n.refresh||t[8]!==f||t[9]!==h?(g=(0,$.jsx)(K,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,disabled:l,title:u,"aria-label":d,onClick:f,children:h}),t[6]=l,t[7]=n.refresh,t[8]=f,t[9]=h,t[10]=g):g=t[10];let _;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(le,{className:`size-4`,strokeWidth:1.75}),t[11]=_):_=t[11];let v;t[12]!==n.fromTemplate||t[13]!==s?(v=(0,$.jsxs)(K,{type:`button`,variant:`secondary`,className:`gap-2`,onClick:s,children:[_,n.fromTemplate]}),t[12]=n.fromTemplate,t[13]=s,t[14]=v):v=t[14];let y;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(b,{className:`size-4`,strokeWidth:1.75}),t[15]=y):y=t[15];let x;t[16]!==n.addJob||t[17]!==c?(x=(0,$.jsxs)(K,{type:`button`,variant:`primary`,className:`gap-2`,onClick:c,children:[y,n.addJob]}),t[16]=n.addJob,t[17]=c,t[18]=x):x=t[18];let S;return t[19]!==x||t[20]!==g||t[21]!==v?(S=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[g,v,x]}),t[19]=x,t[20]=g,t[21]=v,t[22]=S):S=t[22],S}function mn(e){let t=(0,Q.c)(46),{c:n,runHistoryLoading:r,runHistory:a,filteredRunHistory:o,jobs:s,onRefreshHistory:c,onOpenJobDetail:l,statusLabels:u}=e,d;t[0]===n.tabRunHistory?d=t[1]:(d=(0,$.jsx)(`h2`,{id:`cron-history-panel`,className:`sr-only`,children:n.tabRunHistory}),t[0]=n.tabRunHistory,t[1]=d);let f;t[2]===n.runHistoryHint?f=t[3]:(f=(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.runHistoryHint}),t[2]=n.runHistoryHint,t[3]=f);let p;t[4]!==d||t[5]!==f?(p=(0,$.jsxs)(`div`,{children:[d,f]}),t[4]=d,t[5]=f,t[6]=p):p=t[6];let m=n.refresh,h=n.refresh,_;t[7]===c?_=t[8]:(_=()=>void c(),t[7]=c,t[8]=_);let v=r&&`animate-spin`,y;t[9]===v?y=t[10]:(y=i(`size-4`,v),t[9]=v,t[10]=y);let b;t[11]===y?b=t[12]:(b=(0,$.jsx)(U,{className:y,strokeWidth:1.75}),t[11]=y,t[12]=b);let x;t[13]!==n.refresh||t[14]!==r||t[15]!==_||t[16]!==b?(x=(0,$.jsx)(K,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,disabled:r,title:m,"aria-label":h,onClick:_,children:b}),t[13]=n.refresh,t[14]=r,t[15]=_,t[16]=b,t[17]=x):x=t[17];let S;t[18]!==x||t[19]!==p?(S=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[p,x]}),t[18]=x,t[19]=p,t[20]=S):S=t[20];let C;t[21]!==n.colChat||t[22]!==n.colDetail||t[23]!==n.colDuration||t[24]!==n.colJob||t[25]!==n.colStarted||t[26]!==n.colWorkflow||t[27]!==n.emptyHistoryHint||t[28]!==n.emptyHistoryTitle||t[29]!==n.noRunsYet||t[30]!==n.openChat||t[31]!==n.openChatTitle||t[32]!==n.openWorkflow||t[33]!==n.openWorkflowTitle||t[34]!==n.runHistoryHint||t[35]!==n.status||t[36]!==o||t[37]!==s||t[38]!==l||t[39]!==a||t[40]!==r||t[41]!==u?(C=r&&a.length===0?(0,$.jsx)(`div`,{className:`flex justify-center py-16`,children:(0,$.jsx)(J,{className:`size-8 animate-spin text-accent`,strokeWidth:1.75})}):o.length===0?(0,$.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,$.jsx)(g,{className:`mb-4 size-14 text-fg-disabled`,strokeWidth:1.1,"aria-hidden":!0}),(0,$.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:a.length===0?n.emptyHistoryTitle:n.noRunsYet}),(0,$.jsx)(`p`,{className:`mt-2 max-w-sm text-sm text-fg-muted`,children:a.length===0?n.emptyHistoryHint:n.runHistoryHint})]}):(0,$.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-edge-subtle bg-surface-base dark:border-edge-subtle`,children:(0,$.jsxs)(`table`,{className:`w-full min-w-[700px] border-collapse text-left text-sm`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{className:`border-b border-edge text-xs font-medium text-fg-muted`,children:[(0,$.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colStarted}),(0,$.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colJob}),(0,$.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.status}),(0,$.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colDuration}),(0,$.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colDetail}),(0,$.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colWorkflow}),(0,$.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colChat})]})}),(0,$.jsx)(`tbody`,{children:o.map(e=>(0,$.jsxs)(`tr`,{className:`border-b border-edge/60 last:border-0`,children:[(0,$.jsx)(`td`,{className:`whitespace-nowrap px-3 py-2.5 text-fg`,children:(0,$.jsx)(`time`,{dateTime:e.startedAt,children:Ce(e.startedAt)})}),(0,$.jsx)(`td`,{className:`max-w-[10rem] truncate px-3 py-2.5`,children:s.some(t=>t.id===e.jobId)?(0,$.jsx)(`button`,{type:`button`,className:`text-left text-accent hover:underline`,onClick:()=>{let t=s.find(t=>t.id===e.jobId);t&&l(t)},children:e.jobName||e.jobId}):(0,$.jsx)(`span`,{className:`text-fg-muted`,children:e.jobName||e.jobId})}),(0,$.jsx)(`td`,{className:`px-3 py-2.5`,children:(0,$.jsx)(`span`,{className:i(`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:Ee(e.status,u)})}),(0,$.jsx)(`td`,{className:`whitespace-nowrap px-3 py-2.5 text-fg-muted`,children:qe(e.duration)}),(0,$.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,$.jsx)(`td`,{className:`whitespace-nowrap px-3 py-2.5`,children:e.workflowRunId?.trim()?(0,$.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent hover:underline`,title:n.openWorkflowTitle,"aria-label":n.openWorkflowTitle,onClick:()=>xt(e.workflowRunId),children:n.openWorkflow}):(0,$.jsx)(`span`,{className:`text-fg-disabled`,children:`—`})}),(0,$.jsx)(`td`,{className:`whitespace-nowrap px-3 py-2.5`,children:e.sessionKey?.trim()?(0,$.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent hover:underline`,title:n.openChatTitle,"aria-label":n.openChatTitle,onClick:()=>bt(e.sessionKey),children:n.openChat}):(0,$.jsx)(`span`,{className:`text-fg-disabled`,children:`—`})})]},e.id))})]})}),t[21]=n.colChat,t[22]=n.colDetail,t[23]=n.colDuration,t[24]=n.colJob,t[25]=n.colStarted,t[26]=n.colWorkflow,t[27]=n.emptyHistoryHint,t[28]=n.emptyHistoryTitle,t[29]=n.noRunsYet,t[30]=n.openChat,t[31]=n.openChatTitle,t[32]=n.openWorkflow,t[33]=n.openWorkflowTitle,t[34]=n.runHistoryHint,t[35]=n.status,t[36]=o,t[37]=s,t[38]=l,t[39]=a,t[40]=r,t[41]=u,t[42]=C):C=t[42];let w;return t[43]!==S||t[44]!==C?(w=(0,$.jsxs)(`section`,{"aria-labelledby":`cron-history-panel`,className:`flex flex-col gap-3`,children:[S,C]}),t[43]=S,t[44]=C,t[45]=w):w=t[45],w}function hn(e){let t=(0,Q.c)(77),{job:n,c:r,localeTag:a,scheduleBadgeLabels:o,absorbCardClickJobIdRef:s,scheduleAbsorbNextMenuCardClick:c,onOpenDetail:l,onToggle:u,onEdit:d,onRunNow:f,onDelete:p}=e,m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=i(`flex h-full min-h-0 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`),t[0]=m):m=t[0];let h,_;t[1]!==s||t[2]!==n||t[3]!==l?(h=()=>{if(s.current===n.id){s.current=null;return}l(n)},_=e=>{if(e.key===`Enter`||e.key===` `){if(e.preventDefault(),s.current===n.id){s.current=null;return}l(n)}},t[1]=s,t[2]=n,t[3]=l,t[4]=h,t[5]=_):(h=t[4],_=t[5]);let v=n.enabled,y=n.enabled?`justify-end bg-accent`:`justify-start bg-surface-hover`,b;t[6]===y?b=t[7]:(b=i(`inline-flex h-6 w-10 shrink-0 items-center rounded-full border border-edge p-0.5 transition-colors`,y),t[6]=y,t[7]=b);let x;t[8]!==n||t[9]!==u?(x=e=>{e.stopPropagation(),u(n,!n.enabled)},t[8]=n,t[9]=u,t[10]=x):x=t[10];let S;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(`span`,{className:`size-4 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`}),t[11]=S):S=t[11];let C;t[12]!==n.enabled||t[13]!==b||t[14]!==x?(C=(0,$.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":v,className:b,onClick:x,children:S}),t[12]=n.enabled,t[13]=b,t[14]=x,t[15]=C):C=t[15];let w;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(re,{className:`size-4`,strokeWidth:1.75}),t[16]=w):w=t[16];let T;t[17]===r.jobCardMenuAria?T=t[18]:(T=(0,$.jsx)(rt,{asChild:!0,children:(0,$.jsx)(K,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":r.jobCardMenuAria,onClick:_n,children:w})}),t[17]=r.jobCardMenuAria,t[18]=T);let E;t[19]!==n||t[20]!==d||t[21]!==c?(E=()=>{c(n.id),d(n)},t[19]=n,t[20]=d,t[21]=c,t[22]=E):E=t[22];let D;t[23]!==r.edit||t[24]!==E?(D=(0,$.jsx)(nt,{className:`cursor-pointer select-none rounded-lg px-2 py-1.5 text-sm text-fg outline-none data-highlighted:bg-surface-hover`,onSelect:E,children:r.edit}),t[23]=r.edit,t[24]=E,t[25]=D):D=t[25];let O;t[26]!==n||t[27]!==f||t[28]!==c?(O=()=>{c(n.id),f(n)},t[26]=n,t[27]=f,t[28]=c,t[29]=O):O=t[29];let k;t[30]!==r.runNow||t[31]!==O?(k=(0,$.jsx)(nt,{className:`cursor-pointer select-none rounded-lg px-2 py-1.5 text-sm text-fg outline-none data-highlighted:bg-surface-hover`,onSelect:O,children:r.runNow}),t[30]=r.runNow,t[31]=O,t[32]=k):k=t[32];let A;t[33]!==n||t[34]!==p||t[35]!==c?(A=()=>{c(n.id),p(n)},t[33]=n,t[34]=p,t[35]=c,t[36]=A):A=t[36];let j;t[37]!==r.delete||t[38]!==A?(j=(0,$.jsx)(nt,{className:`cursor-pointer select-none rounded-lg px-2 py-1.5 text-sm text-red-600 outline-none data-highlighted:bg-red-500/10 dark:text-red-400`,onSelect:A,children:r.delete}),t[37]=r.delete,t[38]=A,t[39]=j):j=t[39];let M;t[40]!==D||t[41]!==k||t[42]!==j?(M=(0,$.jsx)(it,{children:(0,$.jsxs)(at,{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:gn,children:[D,k,j]})}),t[40]=D,t[41]=k,t[42]=j,t[43]=M):M=t[43];let N;t[44]!==T||t[45]!==M?(N=(0,$.jsxs)(tt,{children:[T,M]}),t[44]=T,t[45]=M,t[46]=N):N=t[46];let P;t[47]!==N||t[48]!==C?(P=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2 px-4 pt-3`,children:[C,N]}),t[47]=N,t[48]=C,t[49]=P):P=t[49];let F=n.name||n.id,I;t[50]===F?I=t[51]:(I=(0,$.jsx)(`h3`,{className:`line-clamp-2 font-semibold text-fg`,children:F}),t[50]=F,t[51]=I);let L;t[52]===n?L=t[53]:(L=Pe(n),t[52]=n,t[53]=L);let R;t[54]===n?R=t[55]:(R=Pe(n),t[54]=n,t[55]=R);let z;t[56]===R?z=t[57]:(z=(0,$.jsx)(ve,{content:R,compact:!0}),t[56]=R,t[57]=z);let B;t[58]!==L||t[59]!==z?(B=(0,$.jsx)(`div`,{className:`max-h-[4.5rem] overflow-hidden text-sm text-fg-muted [&_.markdown-body]:text-sm [&_.markdown-body]:leading-snug`,title:L,children:z}),t[58]=L,t[59]=z,t[60]=B):B=t[60];let V;t[61]!==I||t[62]!==B?(V=(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col gap-2 px-4 pb-3 pt-2`,children:[I,B]}),t[61]=I,t[62]=B,t[63]=V):V=t[63];let H;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(g,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[64]=H):H=t[64];let U;t[65]!==n||t[66]!==a||t[67]!==o?(U=we(n,a,o),t[65]=n,t[66]=a,t[67]=o,t[68]=U):U=t[68];let W;t[69]===U?W=t[70]:(W=(0,$.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:[H,(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:U})]}),t[69]=U,t[70]=W);let G;return t[71]!==h||t[72]!==P||t[73]!==V||t[74]!==_||t[75]!==W?(G=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,className:m,onClick:h,onKeyDown:_,children:[P,V,W]}),t[71]=h,t[72]=P,t[73]=V,t[74]=_,t[75]=W,t[76]=G):G=t[76],G}function gn(e){return e.preventDefault()}function _n(e){return e.stopPropagation()}function vn(e){let t=(0,Q.c)(134),{c:n,language:r,localeTag:o,scheduleBadgeLabels:s,loading:c,sortedSystemJobs:l,heartbeat:u,keepAwake:d,wakeSupported:f,onWakeUnsupportedClick:p,onKeepAwakeToggle:m,absorbCardClickJobIdRef:h,scheduleAbsorbNextMenuCardClick:g,onOpenDetail:_,onToggle:v,onEdit:y,onRunNow:b,onDelete:x}=e,S,C,w,T,E,D,O,k,A,j,M,P;if(t[0]!==n.disabled||t[1]!==n.enabled||t[2]!==n.keepAwake||t[3]!==n.systemHeartbeatEvery||t[4]!==n.systemHeartbeatHint||t[5]!==n.systemHeartbeatInterval||t[6]!==n.systemHeartbeatSettingsLink||t[7]!==n.systemHeartbeatStatus||t[8]!==n.systemHeartbeatTitle||t[9]!==n.systemTasksIntro||t[10]!==n.tabSystemTasks||t[11]!==n.wakeBanner||t[12]!==n.wakeLockUnavailable||t[13]!==u.enabled||t[14]!==u.intervalMs||t[15]!==d||t[16]!==r||t[17]!==o||t[18]!==m||t[19]!==p||t[20]!==f){let e=Xe(u.intervalMs,o,a(r).heartbeatSettings.intervalPresets);M=`cron-system-tasks-panel`,P=`flex flex-col gap-4`,t[33]===n.tabSystemTasks?C=t[34]:(C=(0,$.jsx)(`h2`,{id:`cron-system-tasks-panel`,className:`sr-only`,children:n.tabSystemTasks}),t[33]=n.tabSystemTasks,t[34]=C),t[35]===n.systemTasksIntro?w=t[36]:(w=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.systemTasksIntro}),t[35]=n.systemTasksIntro,t[36]=w);let s;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(fe,{className:`mt-0.5 size-4 shrink-0 text-accent`,strokeWidth:1.75,"aria-hidden":!0}),t[37]=s):s=t[37];let c;t[38]===n.wakeBanner?c=t[39]:(c=(0,$.jsxs)(`div`,{className:`flex gap-3 text-sm text-fg`,children:[s,(0,$.jsx)(`p`,{className:`text-pretty text-fg-muted`,children:n.wakeBanner})]}),t[38]=n.wakeBanner,t[39]=c);let l;t[40]===n.keepAwake?l=t[41]:(l=(0,$.jsx)(`span`,{className:`text-sm text-fg`,children:n.keepAwake}),t[40]=n.keepAwake,t[41]=l);let h=!f,g=f?void 0:n.wakeLockUnavailable,_=d?`justify-end bg-accent`:`justify-start bg-surface-hover`,v=!f&&`cursor-not-allowed opacity-50`,y;t[42]!==_||t[43]!==v?(y=i(`inline-flex h-6 w-10 shrink-0 items-center rounded-full border border-edge p-0.5 transition-colors`,_,v),t[42]=_,t[43]=v,t[44]=y):y=t[44];let b;t[45]!==m||t[46]!==p||t[47]!==f?(b=()=>{f?m():p()},t[45]=m,t[46]=p,t[47]=f,t[48]=b):b=t[48];let x;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(`span`,{className:`size-4 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`}),t[49]=x):x=t[49];let F;t[50]!==d||t[51]!==h||t[52]!==g||t[53]!==y||t[54]!==b?(F=(0,$.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":d,disabled:h,title:g,className:y,onClick:b,children:x}),t[50]=d,t[51]=h,t[52]=g,t[53]=y,t[54]=b,t[55]=F):F=t[55];let I;t[56]!==l||t[57]!==F?(I=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:pl-4`,children:[l,F]}),t[56]=l,t[57]=F,t[58]=I):I=t[58],t[59]!==c||t[60]!==I?(T=(0,$.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:[c,I]}),t[59]=c,t[60]=I,t[61]=T):T=t[61],A=`rounded-xl border border-edge bg-surface-base p-4 dark:bg-surface-hover/20`;let L;t[62]===n.systemHeartbeatTitle?L=t[63]:(L=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.systemHeartbeatTitle}),t[62]=n.systemHeartbeatTitle,t[63]=L);let R;t[64]===n.systemHeartbeatHint?R=t[65]:(R=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.systemHeartbeatHint}),t[64]=n.systemHeartbeatHint,t[65]=R);let z;t[66]!==L||t[67]!==R?(z=(0,$.jsxs)(`div`,{children:[L,R]}),t[66]=L,t[67]=R,t[68]=z):z=t[68];let B;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(X,{className:`size-3.5 opacity-70`,"aria-hidden":!0}),t[69]=B):B=t[69];let V;t[70]===n.systemHeartbeatSettingsLink?V=t[71]:(V=(0,$.jsx)(K,{type:`button`,variant:`ghost`,className:`shrink-0 gap-1 self-start px-2 py-1.5 text-xs`,asChild:!0,children:(0,$.jsxs)(N,{to:`/settings/heartbeat`,children:[n.systemHeartbeatSettingsLink,B]})}),t[70]=n.systemHeartbeatSettingsLink,t[71]=V),t[72]!==z||t[73]!==V?(j=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1 sm:flex-row sm:items-start sm:justify-between`,children:[z,V]}),t[72]=z,t[73]=V,t[74]=j):j=t[74],O=`mt-3 grid gap-2 text-sm sm:grid-cols-2`;let H;t[75]===n.systemHeartbeatStatus?H=t[76]:(H=(0,$.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.systemHeartbeatStatus}),t[75]=n.systemHeartbeatStatus,t[76]=H);let U=u.enabled?n.enabled:n.disabled,W;t[77]===U?W=t[78]:(W=(0,$.jsx)(`dd`,{className:`text-fg`,children:U}),t[77]=U,t[78]=W),t[79]!==H||t[80]!==W?(k=(0,$.jsxs)(`div`,{children:[H,W]}),t[79]=H,t[80]=W,t[81]=k):k=t[81],t[82]===n.systemHeartbeatInterval?D=t[83]:(D=(0,$.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.systemHeartbeatInterval}),t[82]=n.systemHeartbeatInterval,t[83]=D),S=`text-fg`;let G;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(G=/\{\{value\}\}/g,t[84]=G):G=t[84],E=n.systemHeartbeatEvery.replace(G,e),t[0]=n.disabled,t[1]=n.enabled,t[2]=n.keepAwake,t[3]=n.systemHeartbeatEvery,t[4]=n.systemHeartbeatHint,t[5]=n.systemHeartbeatInterval,t[6]=n.systemHeartbeatSettingsLink,t[7]=n.systemHeartbeatStatus,t[8]=n.systemHeartbeatTitle,t[9]=n.systemTasksIntro,t[10]=n.tabSystemTasks,t[11]=n.wakeBanner,t[12]=n.wakeLockUnavailable,t[13]=u.enabled,t[14]=u.intervalMs,t[15]=d,t[16]=r,t[17]=o,t[18]=m,t[19]=p,t[20]=f,t[21]=S,t[22]=C,t[23]=w,t[24]=T,t[25]=E,t[26]=D,t[27]=O,t[28]=k,t[29]=A,t[30]=j,t[31]=M,t[32]=P}else S=t[21],C=t[22],w=t[23],T=t[24],E=t[25],D=t[26],O=t[27],k=t[28],A=t[29],j=t[30],M=t[31],P=t[32];let F;t[85]!==S||t[86]!==E?(F=(0,$.jsx)(`dd`,{className:S,children:E}),t[85]=S,t[86]=E,t[87]=F):F=t[87];let I;t[88]!==F||t[89]!==D?(I=(0,$.jsxs)(`div`,{children:[D,F]}),t[88]=F,t[89]=D,t[90]=I):I=t[90];let L;t[91]!==I||t[92]!==O||t[93]!==k?(L=(0,$.jsxs)(`dl`,{className:O,children:[k,I]}),t[91]=I,t[92]=O,t[93]=k,t[94]=L):L=t[94];let R;t[95]!==L||t[96]!==A||t[97]!==j?(R=(0,$.jsxs)(`div`,{className:A,children:[j,L]}),t[95]=L,t[96]=A,t[97]=j,t[98]=R):R=t[98];let z;t[99]===n.systemDreamingTitle?z=t[100]:(z=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.systemDreamingTitle}),t[99]=n.systemDreamingTitle,t[100]=z);let B;t[101]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(X,{className:`size-3.5 opacity-70`,"aria-hidden":!0}),t[101]=B):B=t[101];let V;t[102]===n.systemDreamingSettingsLink?V=t[103]:(V=(0,$.jsx)(K,{type:`button`,variant:`ghost`,className:`shrink-0 gap-1 self-start px-2 py-1.5 text-xs`,asChild:!0,children:(0,$.jsxs)(N,{to:`/settings/dreams`,children:[n.systemDreamingSettingsLink,B]})}),t[102]=n.systemDreamingSettingsLink,t[103]=V);let H;t[104]!==z||t[105]!==V?(H=(0,$.jsxs)(`div`,{className:`mb-2 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between`,children:[z,V]}),t[104]=z,t[105]=V,t[106]=H):H=t[106];let U;t[107]===n.systemDreamingHint?U=t[108]:(U=(0,$.jsx)(`p`,{className:`mb-3 text-xs text-fg-muted`,children:n.systemDreamingHint}),t[107]=n.systemDreamingHint,t[108]=U);let W;t[109]!==h||t[110]!==n||t[111]!==c||t[112]!==o||t[113]!==x||t[114]!==y||t[115]!==_||t[116]!==b||t[117]!==v||t[118]!==g||t[119]!==s||t[120]!==l?(W=c&&l.length===0?(0,$.jsx)(`div`,{className:`flex justify-center py-12`,"aria-busy":`true`,children:(0,$.jsx)(J,{className:`size-8 animate-spin text-accent`,strokeWidth:1.75})}):l.length===0?(0,$.jsx)(`p`,{className:`rounded-lg border border-edge-subtle bg-surface-hover/30 px-3 py-4 text-sm text-fg-muted dark:border-edge-subtle`,children:n.systemDreamingEmpty}):(0,$.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-[repeat(auto-fill,minmax(280px,1fr))]`,children:l.map(e=>(0,$.jsx)(hn,{job:e,c:n,localeTag:o,scheduleBadgeLabels:s,absorbCardClickJobIdRef:h,scheduleAbsorbNextMenuCardClick:g,onOpenDetail:_,onToggle:v,onEdit:y,onRunNow:b,onDelete:x},e.id))}),t[109]=h,t[110]=n,t[111]=c,t[112]=o,t[113]=x,t[114]=y,t[115]=_,t[116]=b,t[117]=v,t[118]=g,t[119]=s,t[120]=l,t[121]=W):W=t[121];let G;t[122]!==H||t[123]!==U||t[124]!==W?(G=(0,$.jsxs)(`div`,{children:[H,U,W]}),t[122]=H,t[123]=U,t[124]=W,t[125]=G):G=t[125];let ee;return t[126]!==C||t[127]!==w||t[128]!==T||t[129]!==R||t[130]!==G||t[131]!==M||t[132]!==P?(ee=(0,$.jsxs)(`section`,{"aria-labelledby":M,className:P,children:[C,w,T,R,G]}),t[126]=C,t[127]=w,t[128]=T,t[129]=R,t[130]=G,t[131]=M,t[132]=P,t[133]=ee):ee=t[133],ee}function yn(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 bn=[`daily`,`monitoring`,`reports`,`automation`],xn=[{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:`meeting_prep`,category:`daily`,defaultSchedule:`0 9 * * 1-5`,defaultSessionTarget:`isolated`,taskKind:`workflowRun`,workflowDefinitionId:`meeting_prep`},{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`,taskKind:`workflowRun`,workflowDefinitionId:`inbox_triage`},{templateId:`competitor_watch`,category:`monitoring`,defaultSchedule:`0 9 * * 1`,defaultSessionTarget:`isolated`,taskKind:`workflowRun`,workflowDefinitionId:`competitor_scan`},{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`,taskKind:`workflowRun`,workflowDefinitionId:`weekly_review`},{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:`content_repurpose`,category:`reports`,defaultSchedule:`0 11 * * 4`,defaultSessionTarget:`isolated`,taskKind:`workflowRun`,workflowDefinitionId:`content_repurpose`},{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:`client_proposal`,category:`automation`,defaultSchedule:`0 10 * * 2`,defaultSessionTarget:`isolated`,taskKind:`workflowRun`,workflowDefinitionId:`client_proposal`},{templateId:`offer_design`,category:`automation`,defaultSchedule:`0 14 1 * *`,defaultSessionTarget:`isolated`,taskKind:`workflowRun`,workflowDefinitionId:`offer_design`},{templateId:`decision_compare`,category:`automation`,defaultSchedule:`0 15 * * 3`,defaultSessionTarget:`isolated`,taskKind:`workflowRun`,workflowDefinitionId:`decision_compare`},{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 Sn(e){return xn.find(t=>t.templateId===e)}function Cn(e,t,n){let r=t.trim().toLowerCase();return xn.filter(t=>{if(n!==`all`&&t.category!==n)return!1;if(!r)return!0;let i=yn(e,t.templateId);return[t.templateId,i?.title,i?.description,e.templateCategories[t.category]].filter(Boolean).join(` `).toLowerCase().includes(r)})}function wn(e){let t=new Map;for(let n of e){let e=t.get(n.category)??[];e.push(n),t.set(n.category,e)}return bn.flatMap(e=>{let n=t.get(e);return n?.length?[{category:e,items:n}]:[]})}function Tn(e){let t=(0,Q.c)(23),{template:n,cron:r,localeTag:a,scheduleBadgeLabels:o,onSelectTemplate:s}=e,c;t[0]!==r||t[1]!==n.templateId?(c=yn(r,n.templateId),t[0]=r,t[1]=n.templateId,t[2]=c):c=t[2];let l=c;if(!l)return null;let u;t[3]!==a||t[4]!==o||t[5]!==n.defaultSchedule?(u=we({schedule:Be(n.defaultSchedule),nextRunAtMs:void 0},a,o),t[3]=a,t[4]=o,t[5]=n.defaultSchedule,t[6]=u):u=t[6];let d=u,f;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=i(`flex h-full 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`,ge.focusRingPanel),t[7]=f):f=t[7];let p;t[8]!==s||t[9]!==n.templateId?(p=()=>s(n.templateId),t[8]=s,t[9]=n.templateId,t[10]=p):p=t[10];let m=`${r.templateCategories[n.category]} — ${l.title}`,h;t[11]===l.title?h=t[12]:(h=(0,$.jsx)(`span`,{className:`font-semibold text-fg`,children:l.title}),t[11]=l.title,t[12]=h);let g;t[13]===l.description?g=t[14]:(g=(0,$.jsx)(`span`,{className:`line-clamp-2 text-sm text-fg-muted`,children:l.description}),t[13]=l.description,t[14]=g);let _;t[15]===d?_=t[16]:(_=(0,$.jsx)(`span`,{className:`mt-auto flex items-center gap-1 pt-1 text-xs text-fg-muted`,children:(0,$.jsx)(`span`,{className:`tabular-nums`,children:d})}),t[15]=d,t[16]=_);let v;return t[17]!==p||t[18]!==m||t[19]!==h||t[20]!==g||t[21]!==_?(v=(0,$.jsxs)(`button`,{type:`button`,className:f,onClick:p,"aria-label":m,children:[h,g,_]}),t[17]=p,t[18]=m,t[19]=h,t[20]=g,t[21]=_,t[22]=v):v=t[22],v}function En(e){let t=(0,Q.c)(49),{cron:n,localeTag:r,scheduleBadgeLabels:a,categoryFilter:o,onCategoryFilterChange:s,onSelectTemplate:c,variant:l}=e,u=l===void 0?`embedded`:l,[d,f]=(0,Z.useState)(``),p;t[0]!==o||t[1]!==n||t[2]!==d?(p=Cn(n,d,o),t[0]=o,t[1]=n,t[2]=d,t[3]=p):p=t[3];let m=p,h;t[4]===m?h=t[5]:(h=wn(m),t[4]=m,t[5]=h);let g=h,_;t[6]!==o||t[7]!==d?(_=o===`all`&&!d.trim(),t[6]=o,t[7]=d,t[8]=_):_=t[8];let v=_,y;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(oe,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),t[9]=y):y=t[9];let b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>f(e.target.value),t[10]=b):b=t[10];let x=n.templateSearchPlaceholder,S;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(S=i(`h-10 w-full rounded-xl border border-edge bg-surface-base py-2 pl-10 pr-3 text-sm text-fg`,`placeholder:text-fg-subtle`,ge.focusRingPanel),t[11]=S):S=t[11];let C;t[12]!==n.templateSearchPlaceholder||t[13]!==d?(C=(0,$.jsxs)(`div`,{className:`relative`,children:[y,(0,$.jsx)(`input`,{value:d,onChange:b,placeholder:x,className:S})]}),t[12]=n.templateSearchPlaceholder,t[13]=d,t[14]=C):C=t[14];let w=n.fromTemplate,T=o===`all`?`secondary`:`ghost`,E;t[15]===s?E=t[16]:(E=()=>s(`all`),t[15]=s,t[16]=E);let D;t[17]!==n.templateFilterAll||t[18]!==T||t[19]!==E?(D=(0,$.jsx)(K,{type:`button`,variant:T,className:`h-8 rounded-full px-3 py-1.5 text-xs`,onClick:E,children:n.templateFilterAll}),t[17]=n.templateFilterAll,t[18]=T,t[19]=E,t[20]=D):D=t[20];let O;t[21]!==o||t[22]!==n.templateCategories||t[23]!==s?(O=bn.map(e=>(0,$.jsx)(K,{type:`button`,variant:o===e?`secondary`:`ghost`,className:`h-8 rounded-full px-3 py-1.5 text-xs`,onClick:()=>s(e),children:n.templateCategories[e]},e)),t[21]=o,t[22]=n.templateCategories,t[23]=s,t[24]=O):O=t[24];let k;t[25]!==n.fromTemplate||t[26]!==D||t[27]!==O?(k=(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":w,children:[D,O]}),t[25]=n.fromTemplate,t[26]=D,t[27]=O,t[28]=k):k=t[28];let A;t[29]!==k||t[30]!==C?(A=(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-4`,children:[C,k]}),t[29]=k,t[30]=C,t[31]=A):A=t[31];let j=A,M;t[32]!==n||t[33]!==m||t[34]!==g||t[35]!==r||t[36]!==c||t[37]!==a||t[38]!==v||t[39]!==u?(M=m.length===0?(0,$.jsx)(`div`,{className:i(`text-center text-sm text-fg-muted`,u===`dialog`&&`flex h-full flex-col items-center justify-center px-4 py-12`),children:n.templatesEmptyHint}):v?(0,$.jsx)(`div`,{className:`flex flex-col gap-6 pb-1`,children:g.map(e=>(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h3`,{className:`mb-3 text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n.templateCategories[e.category]}),(0,$.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:e.items.map(e=>(0,$.jsx)(Tn,{template:e,cron:n,localeTag:r,scheduleBadgeLabels:a,onSelectTemplate:c},e.templateId))})]},e.category))}):(0,$.jsx)(`div`,{className:`grid grid-cols-1 gap-3 pb-1 sm:grid-cols-2 xl:grid-cols-3`,children:m.map(e=>(0,$.jsx)(Tn,{template:e,cron:n,localeTag:r,scheduleBadgeLabels:a,onSelectTemplate:c},e.templateId))}),t[32]=n,t[33]=m,t[34]=g,t[35]=r,t[36]=c,t[37]=a,t[38]=v,t[39]=u,t[40]=M):M=t[40];let N=M;if(u===`dialog`){let e;t[41]===N?e=t[42]:(e=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:N}),t[41]=N,t[42]=e);let n;return t[43]!==j||t[44]!==e?(n=(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4`,children:[j,e]}),t[43]=j,t[44]=e,t[45]=n):n=t[45],n}let P;return t[46]!==j||t[47]!==N?(P=(0,$.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[j,N]}),t[46]=j,t[47]=N,t[48]=P):P=t[48],P}function Dn(e){let t=(0,Q.c)(49),{c:n,localeTag:r,scheduleBadgeLabels:a,loading:o,jobsCount:s,sortedJobs:c,templateCategoryFilter:l,onTemplateCategoryFilterChange:u,onSelectTemplate:d,keepAwake:f,wakeSupported:p,onWakeUnsupportedClick:m,onKeepAwakeToggle:h,absorbCardClickJobIdRef:g,scheduleAbsorbNextMenuCardClick:_,onOpenDetail:v,onToggle:y,onEdit:b,onAddJob:x,onRunNow:S,onDelete:C}=e,w;t[0]===n.tabMyTasks?w=t[1]:(w=(0,$.jsx)(`h2`,{id:`cron-tasks-panel`,className:`sr-only`,children:n.tabMyTasks}),t[0]=n.tabMyTasks,t[1]=w);let T;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(fe,{className:`mt-0.5 size-4 shrink-0 text-accent`,strokeWidth:1.75,"aria-hidden":!0}),t[2]=T):T=t[2];let E;t[3]===n.wakeBanner?E=t[4]:(E=(0,$.jsxs)(`div`,{className:`flex gap-3 text-sm text-fg`,children:[T,(0,$.jsx)(`p`,{className:`text-pretty text-fg-muted`,children:n.wakeBanner})]}),t[3]=n.wakeBanner,t[4]=E);let D;t[5]===n.keepAwake?D=t[6]:(D=(0,$.jsx)(`span`,{className:`text-sm text-fg`,children:n.keepAwake}),t[5]=n.keepAwake,t[6]=D);let O=!p,k=p?void 0:n.wakeLockUnavailable,A=f?`justify-end bg-accent`:`justify-start bg-surface-hover`,j=!p&&`cursor-not-allowed opacity-50`,M;t[7]!==A||t[8]!==j?(M=i(`inline-flex h-6 w-10 shrink-0 items-center rounded-full border border-edge p-0.5 transition-colors`,A,j),t[7]=A,t[8]=j,t[9]=M):M=t[9];let N;t[10]!==h||t[11]!==m||t[12]!==p?(N=()=>{p?h():m()},t[10]=h,t[11]=m,t[12]=p,t[13]=N):N=t[13];let P;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(`span`,{className:`size-4 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`}),t[14]=P):P=t[14];let F;t[15]!==f||t[16]!==N||t[17]!==O||t[18]!==k||t[19]!==M?(F=(0,$.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":f,disabled:O,title:k,className:M,onClick:N,children:P}),t[15]=f,t[16]=N,t[17]=O,t[18]=k,t[19]=M,t[20]=F):F=t[20];let I;t[21]!==F||t[22]!==D?(I=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:pl-4`,children:[D,F]}),t[21]=F,t[22]=D,t[23]=I):I=t[23];let L;t[24]!==I||t[25]!==E?(L=(0,$.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:[E,I]}),t[24]=I,t[25]=E,t[26]=L):L=t[26];let R;t[27]!==g||t[28]!==n||t[29]!==s||t[30]!==o||t[31]!==r||t[32]!==x||t[33]!==C||t[34]!==b||t[35]!==v||t[36]!==S||t[37]!==d||t[38]!==u||t[39]!==y||t[40]!==_||t[41]!==a||t[42]!==c||t[43]!==l?(R=o&&s===0?(0,$.jsx)(`div`,{className:`flex justify-center py-16`,"aria-busy":`true`,children:(0,$.jsx)(J,{className:`size-8 animate-spin text-accent`,strokeWidth:1.75})}):s===0?(0,$.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,$.jsx)(`div`,{className:`w-full max-w-6xl`,children:(0,$.jsx)(En,{cron:n,localeTag:r,scheduleBadgeLabels:a,categoryFilter:l,onCategoryFilterChange:u,onSelectTemplate:d})}),(0,$.jsx)(`div`,{className:`flex justify-center`,children:(0,$.jsx)(K,{type:`button`,variant:`primary`,onClick:x,children:n.emptyStateCta})})]}):(0,$.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-[repeat(auto-fill,minmax(280px,1fr))]`,children:c.map(e=>(0,$.jsx)(hn,{job:e,c:n,localeTag:r,scheduleBadgeLabels:a,absorbCardClickJobIdRef:g,scheduleAbsorbNextMenuCardClick:_,onOpenDetail:e=>void v(e),onToggle:(e,t)=>void y(e,t),onEdit:b,onRunNow:S,onDelete:C},e.id))}),t[27]=g,t[28]=n,t[29]=s,t[30]=o,t[31]=r,t[32]=x,t[33]=C,t[34]=b,t[35]=v,t[36]=S,t[37]=d,t[38]=u,t[39]=y,t[40]=_,t[41]=a,t[42]=c,t[43]=l,t[44]=R):R=t[44];let z;return t[45]!==w||t[46]!==L||t[47]!==R?(z=(0,$.jsxs)(`section`,{"aria-labelledby":`cron-tasks-panel`,className:`flex flex-col gap-4`,children:[w,L,R]}),t[45]=w,t[46]=L,t[47]=R,t[48]=z):z=t[48],z}function On(e){let t=(0,Q.c)(29),{open:n,onOpenChange:r,c:a,localeTag:o,scheduleBadgeLabels:s,categoryFilter:c,onCategoryFilterChange:l,onSelectTemplate:u}=e,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(L,{className:`xopc-dialog-overlay fixed inset-0 z-[62] bg-scrim`}),t[0]=d):d=t[0];let f;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(f=i(`xopc-dialog-content-pane pointer-events-auto relative flex h-[min(90vh,840px)] w-full max-w-5xl flex-col`,`rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none dark:border-edge`,ge.focusRingPanel),t[1]=f):f=t[1];let p;t[2]===a.fromTemplate?p=t[3]:(p=(0,$.jsx)(m,{className:`text-lg font-semibold text-fg`,children:a.fromTemplate}),t[2]=a.fromTemplate,t[3]=p);let h;t[4]===a.templatePickerHint?h=t[5]:(h=(0,$.jsx)(R,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:a.templatePickerHint}),t[4]=a.templatePickerHint,t[5]=h);let g;t[6]!==p||t[7]!==h?(g=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[p,h]}),t[6]=p,t[7]=h,t[8]=g):g=t[8];let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(ne,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[9]=_):_=t[9];let v;t[10]===a.close?v=t[11]:(v=(0,$.jsx)(se,{asChild:!0,children:(0,$.jsx)(K,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":a.close,children:_})}),t[10]=a.close,t[11]=v);let y;t[12]!==g||t[13]!==v?(y=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge-subtle px-6 py-5`,children:[g,v]}),t[12]=g,t[13]=v,t[14]=y):y=t[14];let b;t[15]!==a||t[16]!==c||t[17]!==o||t[18]!==l||t[19]!==u||t[20]!==s?(b=(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col px-6 py-5`,children:(0,$.jsx)(En,{variant:`dialog`,cron:a,localeTag:o,scheduleBadgeLabels:s,categoryFilter:c,onCategoryFilterChange:l,onSelectTemplate:u})}),t[15]=a,t[16]=c,t[17]=o,t[18]=l,t[19]=u,t[20]=s,t[21]=b):b=t[21];let x;t[22]!==y||t[23]!==b?(x=(0,$.jsxs)(z,{children:[d,(0,$.jsx)(`div`,{className:`fixed inset-0 z-[62] flex items-center justify-center p-4 pointer-events-none`,children:(0,$.jsxs)(E,{className:f,onOpenAutoFocus:kn,children:[y,b]})})]}),t[22]=y,t[23]=b,t[24]=x):x=t[24];let S;return t[25]!==r||t[26]!==n||t[27]!==x?(S=(0,$.jsx)(M,{open:n,onOpenChange:r,children:x}),t[25]=r,t[26]=n,t[27]=x,t[28]=S):S=t[28],S}function kn(e){return e.preventDefault()}function An(){return{formOpen:!1,formMode:`add`,formJobId:null,formName:``,formSchedule:Be(gt),formChannel:`local`,formChatId:``,formMessage:``,formMessageMdMode:`edit`,formTaskKind:`message`,formWorkflowDefinitionId:``,formWorkflowGoal:``,formWorkflowArgValues:{},messageEditorNonce:0,formSessionTarget:`main`,formAgentId:``,formAgentLocalOnly:!1,formWorkingDirectory:``,formModel:``,formSubmitting:!1}}function jn(e,t){switch(t.type){case`patch`:return{...e,...t.patch};case`replace`:return t.state;case`setMessageMdMode`:return{...e,formMessageMdMode:t.mode,messageEditorNonce:t.mode===`edit`?e.messageEditorNonce+1:e.messageEditorNonce}}}function Mn(e,t){let n=An();if(n.formOpen=!0,n.formMode=e?`edit`:`add`,n.formJobId=e?.id??null,!e)return n.formModel=t(),n;if(n.formName=e.name||``,n.formSchedule=e.schedule,n.formMessage=Pe(e)??``,e.payload.kind===`workflowRun`){n.formTaskKind=`workflowRun`,n.formWorkflowDefinitionId=e.payload.definitionId,n.formWorkflowGoal=e.payload.goal||``,n.formWorkflowArgValues=Jt(e.payload.definitionId,e.payload.inputEnvelope?.payload??e.payload.input??{});let t=e.payload.agentId?.trim().toLowerCase();t&&(n.formAgentId=t)}n.formSessionTarget=e.sessionTarget===`isolated`?`isolated`:`main`,n.formAgentId=(e.sessionTarget||`main`)===`isolated`&&e.agentId?.trim()?e.agentId.trim().toLowerCase():``,n.formWorkingDirectory=(e.sessionTarget||`main`)===`isolated`&&e.workingDirectory?.trim()?e.workingDirectory.trim():``;let r=e.payload?.kind===`agentTurn`&&e.payload.model?.trim()?e.payload.model.trim():``;n.formModel=e.model?.trim()||r||t();let i=e.delivery?.channel===`local`;return n.formAgentLocalOnly=(e.sessionTarget||`main`)===`isolated`&&!i&&(!e.delivery?.to||e.delivery.mode===`none`),i?(n.formChannel=`local`,n.formChatId=``):e.delivery&&e.delivery.mode!==`none`&&e.delivery.to?(n.formChannel=e.delivery.channel||`telegram`,n.formChatId=e.delivery.to||``):(n.formChannel=`telegram`,n.formChatId=``),n.formMessageMdMode=`edit`,n.messageEditorNonce=1,n}function Nn(e){let{m:t,defaultModelForForm:n,channels:r,chatAgents:i}=e,[a,o]=(0,Z.useReducer)(jn,void 0,An),s=(0,Z.useRef)(!1),c=(0,Z.useMemo)(()=>new Set([`local`,...r.map(e=>e.name)]),[r]);if(a.formOpen&&a.formMode===`add`&&!c.has(a.formChannel)&&o({type:`patch`,patch:{formChannel:`local`}}),a.formOpen&&a.formMode===`add`&&!s.current){let e=n();e&&e!==a.formModel&&o({type:`patch`,patch:{formModel:e}})}let l=D(()=>Ae(a.formChannel),[a.formChannel],{enabled:a.formOpen&&a.formChannel!==`local`,initial:[],errorData:[]}),u=a.formChannel===`local`?[]:l.data,d=(0,Z.useMemo)(()=>{let e=new Set(i.map(e=>e.id)),t=[...i],n=a.formAgentId.trim().toLowerCase();return n&&!e.has(n)&&t.push({id:n}),t},[i,a.formAgentId]),f=a.formChannel!==`local`&&(a.formTaskKind===`message`&&(a.formSessionTarget===`main`||a.formSessionTarget===`isolated`&&!a.formAgentLocalOnly)||a.formTaskKind===`workflowRun`&&!a.formAgentLocalOnly),p=a.formTaskKind===`workflowRun`?!a.formAgentLocalOnly:a.formTaskKind===`message`&&(a.formSessionTarget===`main`||a.formSessionTarget===`isolated`&&!a.formAgentLocalOnly),m=a.formTaskKind===`workflowRun`?!!a.formWorkflowDefinitionId.trim()&&Yt(a.formWorkflowDefinitionId.trim(),a.formWorkflowArgValues):!!a.formMessage.trim(),h=a.formSchedule.kind===`cron`?!!a.formSchedule.expr.trim():a.formSchedule.kind===`at`?!!a.formSchedule.at.trim():Number.isFinite(a.formSchedule.everyMs)&&a.formSchedule.everyMs>0,g=!!a.formName.trim()&&h&&m&&(!f||!!a.formChatId.trim()),_=(0,Z.useCallback)(e=>{s.current=!1,o({type:`replace`,state:Mn(e,n)})},[n]),v=(0,Z.useCallback)(e=>{o({type:`setMessageMdMode`,mode:e})},[]),y=(0,Z.useCallback)(e=>{let r=Sn(e),i=r?yn(t.cron,e):void 0;if(!r||!i)return!1;let a=r.taskKind===`workflowRun`&&!!r.workflowDefinitionId;return s.current=!1,o({type:`replace`,state:{...An(),formOpen:!0,formMode:`add`,formName:i.title,formSchedule:Be(r.defaultSchedule),formMessage:a?``:i.prompt,formTaskKind:a?`workflowRun`:`message`,formWorkflowDefinitionId:a?r.workflowDefinitionId:``,formWorkflowGoal:a?i.description:``,formSessionTarget:r.defaultSessionTarget,formModel:n(),formAgentLocalOnly:a,messageEditorNonce:1}}),!0},[n,t.cron]),b=(0,Z.useCallback)(()=>{s.current=!1,o({type:`replace`,state:An()})},[]),x=(0,Z.useCallback)((e,t,n)=>{let r={formSessionTarget:e};e===`main`?(r.formAgentLocalOnly=!1,r.formAgentId=``,r.formWorkingDirectory=``):e===`isolated`&&!n&&(r.formModel=t()),o({type:`patch`,patch:r})},[]),S=(0,Z.useCallback)(e=>{o({type:`patch`,patch:{formChannel:e,formChatId:``,...e===`local`?{formAgentLocalOnly:!1}:{}}})},[]),C=(0,Z.useCallback)(e=>{s.current=!0,o({type:`patch`,patch:{formModel:e}})},[]),w=(0,Z.useCallback)(()=>{Ae(a.formChannel).then(l.setData)},[a.formChannel,l.setData]),T=(0,Z.useCallback)(e=>{o({type:`patch`,patch:e})},[]);return{formOpen:a.formOpen,formMode:a.formMode,formJobId:a.formJobId,formName:a.formName,formSchedule:a.formSchedule,formChannel:a.formChannel,formChatId:a.formChatId,formMessage:a.formMessage,formMessageMdMode:a.formMessageMdMode,formTaskKind:a.formTaskKind,formWorkflowDefinitionId:a.formWorkflowDefinitionId,formWorkflowGoal:a.formWorkflowGoal,formWorkflowArgValues:a.formWorkflowArgValues,messageEditorNonce:a.messageEditorNonce,formSessionTarget:a.formSessionTarget,formAgentId:a.formAgentId,formAgentLocalOnly:a.formAgentLocalOnly,formWorkingDirectory:a.formWorkingDirectory,formModel:a.formModel,formSubmitting:a.formSubmitting,sessionChatIds:u,setFormName:e=>T({formName:e}),setFormSchedule:e=>T({formSchedule:e}),setFormChatId:e=>T({formChatId:e}),setFormMessage:e=>T({formMessage:e}),setFormTaskKind:e=>T(e===`workflowRun`?{formTaskKind:e,formSessionTarget:`isolated`,formAgentLocalOnly:!1}:{formTaskKind:e}),setFormWorkflowDefinitionId:e=>T({formWorkflowDefinitionId:e,formWorkflowArgValues:{}}),setFormWorkflowGoal:e=>T({formWorkflowGoal:e}),setFormWorkflowArgValues:e=>T({formWorkflowArgValues:e}),setFormAgentId:e=>T({formAgentId:e}),setFormAgentLocalOnly:e=>T({formAgentLocalOnly:e}),setFormWorkingDirectory:e=>T({formWorkingDirectory:e}),setFormSubmitting:e=>T({formSubmitting:e}),canSubmit:g,needsDeliveryChat:f,showChannelPicker:p,cronAgentSelectOptions:d,openForm:_,closeForm:b,applyCronTemplate:y,setMessageMdMode:v,handleFormSessionTargetChange:x,handleFormChannelChange:S,handleFormModelUserChange:C,refreshRecipientsList:w}}function Pn(e){let{onUnavailable:t}=e,[n,r]=(0,Z.useState)(!1),i=(0,Z.useRef)(null),a=(0,Z.useRef)(`none`),o=(0,Z.useRef)(n),s=typeof navigator<`u`&&`wakeLock`in navigator,c=s||ae(),l=(0,Z.useCallback)(async()=>{if(a.current===`electron`){try{await window.electronAPI?.cron?.setDisplaySleepPrevented?.(!1)}catch{}a.current=`none`;return}try{await i.current?.release()}catch{}i.current=null,a.current=`none`},[]),u=(0,Z.useCallback)(async()=>{let e=typeof window<`u`?window.electronAPI?.cron?.setDisplaySleepPrevented:void 0;if(e)try{await e(!0),a.current=`electron`;return}catch{t(),r(!1);return}if(s)try{let e=await navigator.wakeLock.request(`screen`);i.current=e,a.current=`navigator`,e.addEventListener(`release`,()=>{i.current=null,a.current=`none`})}catch{t(),r(!1)}},[t,s]);return o.current=n,(0,Z.useEffect)(()=>{if(!n){l();return}u();let e=()=>{document.visibilityState===`visible`&&o.current&&u()};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e),l()}},[n,u,l]),{keepAwake:n,setKeepAwake:r,featureAvailable:c}}function Fn(e){let{hasToken:t,failMessages:n,isHistoryTab:r}=e,[i,a]=(0,Z.useState)([]),[o,s]=(0,Z.useState)([]),[c,l]=(0,Z.useState)([]),[u,d]=(0,Z.useState)(``),[f,p]=(0,Z.useState)([]),[m,h]=(0,Z.useState)(null),[g,_]=(0,Z.useState)([]),[v,y]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(!1),[S,C]=(0,Z.useState)(null),w=(0,Z.useCallback)(async()=>{x(!0),C(null);try{a(await je())}catch(e){C(e instanceof Error?e.message:n.failedToLoadJobs)}finally{x(!1)}},[n.failedToLoadJobs]),T=(0,Z.useCallback)(async()=>{try{let[e,t,n,r,i]=await Promise.all([Re(),Ue(),Ve(),pe(),V().catch(()=>null)]);s(e),l(t),d(n.model||``),h(r.payload?.config??null),i&&p(i.items)}catch{}},[]),E=(0,Z.useCallback)(async()=>{y(!0);try{_(await De(400))}catch{}finally{y(!1)}},[]);return(0,Z.useEffect)(()=>{t&&(w(),T())},[t,w,T]),(0,Z.useEffect)(()=>{if(!t)return;let e=()=>{pe().then(e=>{h(e.payload?.config??null)})};return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[t]),(0,Z.useEffect)(()=>{!t||!r||E()},[t,r,E]),{jobs:i,channels:o,availableModels:c,defaultModel:u,chatAgents:f,gatewayConfigRaw:m,runHistory:g,runHistoryLoading:v,loading:b,error:S,setError:C,userCronJobs:(0,Z.useMemo)(()=>i.filter(e=>!Je(e)),[i]),systemCronJobs:(0,Z.useMemo)(()=>i.filter(e=>Je(e)),[i]),heartbeatFromConfig:(0,Z.useMemo)(()=>Ze(m),[m]),loadJobs:w,loadAux:T,loadRunHistoryOnly:E,refreshAll:(0,Z.useCallback)(()=>{w(),T(),E()},[w,T,E])}}function In(e,t){let n=[...e];return n.sort((e,n)=>{let r=e.createdAtMs,i=n.createdAtMs;return t===`created_desc`?i-r:r-i}),n}function Ln(e,t,n,r){let i=new Date,a=t===`day`?_t(i):t===`week`?vt(i):yt(i);return e.filter(e=>!(new Date(e.startedAt)<a||n&&e.jobId!==n||r&&e.status!==r))}var Rn={mainTab:`myTasks`,jobSort:`created_desc`,historyRange:`day`,historyJobFilter:``,historyStatusFilter:``,detailOpen:!1,detailJob:null,detailHistory:[],detailLoading:!1,detailActionNotice:null,confirmOpen:!1,templatePickerOpen:!1,templateCategoryFilter:`all`};function zn(){let e=o(e=>e.language),t=a(e),n=t.cron,r=t.chat,i=c(e=>e.token),l=!!i,u=s(e=>e.resolved)===`dark`,d=e===`zh`?`zh-CN`:`en-US`,[f,m]=y(),[g,_]=(0,Z.useReducer)(h,f,e=>({...Rn,mainTab:Et(e.get(`tab`))})),{mainTab:v,jobSort:b,historyRange:x,historyJobFilter:S,historyStatusFilter:C,detailOpen:w,detailJob:T,detailHistory:E,detailLoading:D,detailActionNotice:O,confirmOpen:k,templatePickerOpen:A,templateCategoryFilter:j}=g,M=Et(f.get(`tab`));(0,Z.useEffect)(()=>{M!==v&&_({type:`patch`,patch:{mainTab:M}})},[M,v]);let N=(0,Z.useCallback)(e=>{_({type:`patch`,patch:{mainTab:e}}),m(t=>{let n=new URLSearchParams(t),r=Dt(e);return r?n.set(`tab`,r):n.delete(`tab`),n},{replace:!0})},[m]),P=Fn({hasToken:l,failMessages:{failedToLoadJobs:n.failedToLoadJobs},isHistoryTab:v===`history`}),{setError:F}=P,I=Pn({onUnavailable:()=>F(n.wakeLockUnavailable)}),L=(0,Z.useCallback)(()=>P.defaultModel||(P.availableModels.length>0?P.availableModels[0].id:``),[P.defaultModel,P.availableModels]),R=Nn({m:t,defaultModelForForm:L,channels:P.channels,chatAgents:P.chatAgents}),z=p(l&&R.formOpen?[`workflow-definitions-cron`,i]:null,ie,{revalidateOnFocus:!1}),B=z.data??[],V=(0,Z.useRef)(null),H=(0,Z.useRef)(null),U=(0,Z.useCallback)((e,t)=>{V.current=e,H.current=t,_({type:`patch`,patch:{confirmOpen:!0}})},[]),W=(0,Z.useCallback)(()=>{_({type:`patch`,patch:{confirmOpen:!1}}),H.current=null,V.current=null},[]),G=(0,Z.useRef)(null),ee=(0,Z.useCallback)(e=>{G.current=e,window.setTimeout(()=>{G.current===e&&(G.current=null)},400)},[]),te=(0,Z.useCallback)(e=>{R.applyCronTemplate(e)&&_({type:`patch`,patch:{templatePickerOpen:!1}})},[R]),ne=async()=>{if(!R.formName.trim()){F(n.nameRequired);return}if(R.formSchedule.kind===`cron`&&!R.formSchedule.expr.trim()||R.formSchedule.kind===`at`&&!R.formSchedule.at.trim()||R.formSchedule.kind===`every`&&(!Number.isFinite(R.formSchedule.everyMs)||R.formSchedule.everyMs<=0)){F(n.scheduleRequired);return}if(R.formTaskKind===`message`&&!R.formMessage.trim()){F(n.scheduleRequired);return}if(R.formTaskKind===`workflowRun`&&!R.formWorkflowDefinitionId.trim()){F(n.workflowDefinitionRequired);return}if(R.formTaskKind===`workflowRun`&&!Yt(R.formWorkflowDefinitionId.trim(),R.formWorkflowArgValues)){F(n.workflowArgsRequired);return}if(R.needsDeliveryChat&&!R.formChatId.trim()){F(n.chatIdRequired);return}R.setFormSubmitting(!0),F(null);try{let e=R.formMessage.trim(),t=R.formModel.trim(),n=R.formAgentId.trim().toLowerCase(),r=R.formWorkingDirectory.trim(),i=R.formTaskKind===`workflowRun`,a=R.formTaskKind===`message`&&R.formSessionTarget===`isolated`,o=i?`isolated`:R.formSessionTarget,s;s=i?R.formAgentLocalOnly?{mode:`none`}:R.formChannel===`local`?{mode:`announce`,channel:`local`}:{mode:`announce`,channel:R.formChannel,to:R.formChatId.trim()}:R.formSessionTarget===`isolated`&&R.formAgentLocalOnly?{mode:`none`}:R.formChannel===`local`?{mode:`announce`,channel:`local`}:{mode:`announce`,channel:R.formChannel,to:R.formChatId.trim()};let c;if(i){let e=R.formWorkflowDefinitionId.trim(),t=et(R.formWorkflowArgValues);c={kind:`workflowRun`,definitionId:e,...t===void 0?{}:{inputEnvelope:{payload:t}},...R.formWorkflowGoal.trim()?{goal:R.formWorkflowGoal.trim()}:{},...n?{agentId:n}:{}}}else c=a?{kind:`agentTurn`,message:e,...t?{model:t}:{}}:{kind:`systemEvent`,text:e};let l=o===`main`?null:n||null,u={name:R.formName.trim(),schedule:R.formSchedule,sessionTarget:o,delivery:s,payload:c,...R.formMode===`edit`?{...l?{agentId:l}:{},...a&&r?{workingDirectory:r}:{}}:{...o===`isolated`&&n?{agentId:n}:{},...a&&r?{workingDirectory:r}:{}}};if(R.formMode===`edit`&&R.formJobId)await Me(R.formJobId,u);else{let{schedule:e,agentId:t,workingDirectory:n,...r}=u;await Le(e,{...r,...t==null?{}:{agentId:t},...n?{workingDirectory:n}:{}})}R.closeForm(),await P.loadJobs()}catch(e){F(e instanceof Error?e.message:R.formMode===`edit`?n.failedToUpdateJob:n.failedToCreateJob)}finally{R.setFormSubmitting(!1)}},re=async e=>{_({type:`patch`,patch:{detailOpen:!0,detailJob:e,detailLoading:!0,detailHistory:[],detailActionNotice:null}});try{let t=await Fe(e.id);t&&_({type:`patch`,patch:{detailJob:t,detailHistory:await ke(e.id,20)}})}catch{}finally{_({type:`patch`,patch:{detailLoading:!1}})}},K=(0,Z.useCallback)(()=>{_({type:`patch`,patch:{detailOpen:!1,detailJob:null,detailActionNotice:null}})},[]),q=(0,Z.useCallback)(()=>{_({type:`patch`,patch:{templateCategoryFilter:`all`,templatePickerOpen:!0}})},[]),ae=async(e,t)=>{try{await Ne(e.id,t),T?.id===e.id&&_({type:`patch`,patch:{detailJob:{...T,enabled:t}}}),await Promise.all([P.loadJobs(),P.loadAux()])}catch(e){F(e instanceof Error?e.message:n.failedToToggleJob)}},oe=async()=>{let e=H.current,t=V.current;if(!(!e||!t)){W();try{if(t===`run`){let t=await Ie(e);T?.id===e&&_({type:`patch`,patch:{detailJob:t.job??await Fe(e),detailHistory:t.history??await ke(e,20),detailActionNotice:{kind:`info`,message:n.runStarted}}})}else await ze(e),T?.id===e&&_({type:`patch`,patch:{detailOpen:!1,detailJob:null}});await Promise.all([P.loadJobs(),P.loadAux(),P.loadRunHistoryOnly()])}catch(r){let i=r instanceof Error?r.message:n.actionFailed;if(t===`run`&&T?.id===e){let t=await Fe(e).catch(()=>null),a=await ke(e,20).catch(()=>E),o=r instanceof He&&r.code===`job_already_running`?r.runningSessionKey||t?.state?.runningSessionKey||a.find(e=>e.status===`running`)?.sessionKey:t?.state?.runningSessionKey||a.find(e=>e.status===`running`)?.sessionKey;_({type:`patch`,patch:{...t?{detailJob:t}:{},detailHistory:a,detailActionNotice:{kind:`error`,message:i.includes(`already running`)?n.jobAlreadyRunning:i,...o?{sessionKey:o}:{}}}})}else F(i)}}};(0,Z.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(R.formOpen?R.closeForm():w&&_({type:`patch`,patch:{detailOpen:!1,detailJob:null}}))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[R,w]);let J=(0,Z.useMemo)(()=>({running:n.execStatusRunning,success:n.execStatusSuccess,failed:n.execStatusFailed,cancelled:n.execStatusCancelled}),[n.execStatusCancelled,n.execStatusFailed,n.execStatusRunning,n.execStatusSuccess]),se=(0,Z.useMemo)(()=>In(P.userCronJobs,b),[P.userCronJobs,b]),ce=(0,Z.useMemo)(()=>In(P.systemCronJobs,b),[P.systemCronJobs,b]),le=(0,Z.useMemo)(()=>Ln(P.runHistory,x,S,C),[P.runHistory,x,S,C]),Y=n.scheduleBadge;return l?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Bn,{hasToken:l,c:n,loading:P.loading,runHistoryLoading:P.runHistoryLoading,onRefresh:P.refreshAll,onOpenTemplatePicker:q,onAddJob:()=>R.openForm()}),(0,$.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,$.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-6 px-4 py-6 sm:px-8`,children:[P.error?(0,$.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:P.error}):null,(0,$.jsx)(dn,{c:n,mainTab:v,onMainTabChange:N,jobSort:b,onJobSortChange:e=>_({type:`patch`,patch:{jobSort:e}}),historyRange:x,onHistoryRangeChange:e=>_({type:`patch`,patch:{historyRange:e}}),historyJobFilter:S,onHistoryJobFilterChange:e=>_({type:`patch`,patch:{historyJobFilter:e}}),historyStatusFilter:C,onHistoryStatusFilterChange:e=>_({type:`patch`,patch:{historyStatusFilter:e}}),jobs:P.jobs}),v===`myTasks`?(0,$.jsx)(Dn,{c:n,localeTag:d,scheduleBadgeLabels:Y,loading:P.loading,jobsCount:P.userCronJobs.length,sortedJobs:se,templateCategoryFilter:j,onTemplateCategoryFilterChange:e=>_({type:`patch`,patch:{templateCategoryFilter:e}}),onSelectTemplate:te,keepAwake:I.keepAwake,wakeSupported:I.featureAvailable,onWakeUnsupportedClick:()=>F(n.wakeLockUnavailable),onKeepAwakeToggle:()=>I.setKeepAwake(e=>!e),absorbCardClickJobIdRef:G,scheduleAbsorbNextMenuCardClick:ee,onOpenDetail:e=>void re(e),onToggle:(e,t)=>void ae(e,t),onEdit:e=>R.openForm(e),onAddJob:()=>R.openForm(),onRunNow:e=>U(`run`,e.id),onDelete:e=>U(`delete`,e.id)}):v===`systemTasks`?(0,$.jsx)(vn,{c:n,language:e,localeTag:d,scheduleBadgeLabels:Y,loading:P.loading,sortedSystemJobs:ce,heartbeat:P.heartbeatFromConfig,keepAwake:I.keepAwake,wakeSupported:I.featureAvailable,onWakeUnsupportedClick:()=>F(n.wakeLockUnavailable),onKeepAwakeToggle:()=>I.setKeepAwake(e=>!e),absorbCardClickJobIdRef:G,scheduleAbsorbNextMenuCardClick:ee,onOpenDetail:e=>void re(e),onToggle:(e,t)=>void ae(e,t),onEdit:e=>R.openForm(e),onRunNow:e=>U(`run`,e.id),onDelete:e=>U(`delete`,e.id)}):v===`history`?(0,$.jsx)(mn,{c:n,runHistoryLoading:P.runHistoryLoading,runHistory:P.runHistory,filteredRunHistory:le,jobs:P.jobs,onRefreshHistory:()=>void P.loadRunHistoryOnly(),onOpenJobDetail:e=>void re(e),statusLabels:J}):(0,$.jsx)(mt,{hasToken:l})]}),(0,$.jsx)(rn,{open:R.formOpen,onRequestClose:R.closeForm,c:n,chatM:r,agentsMessages:t.agentsSettings,isDark:u,channels:P.channels,sessionChatIds:R.sessionChatIds,cronAgentSelectOptions:R.cronAgentSelectOptions,defaultModelResolver:L,formMode:R.formMode,formJobId:R.formJobId,formName:R.formName,onFormNameChange:R.setFormName,formSchedule:R.formSchedule,onFormScheduleChange:R.setFormSchedule,formSubmitting:R.formSubmitting,formTaskKind:R.formTaskKind,onFormTaskKindChange:R.setFormTaskKind,workflowDefinitions:B,workflowDefinitionsLoading:z.isLoading,formWorkflowDefinitionId:R.formWorkflowDefinitionId,onFormWorkflowDefinitionIdChange:R.setFormWorkflowDefinitionId,formWorkflowGoal:R.formWorkflowGoal,onFormWorkflowGoalChange:R.setFormWorkflowGoal,formWorkflowArgValues:R.formWorkflowArgValues,onFormWorkflowArgValuesChange:R.setFormWorkflowArgValues,formSessionTarget:R.formSessionTarget,onFormSessionTargetChange:R.handleFormSessionTargetChange,formAgentLocalOnly:R.formAgentLocalOnly,onFormAgentLocalOnlyChange:R.setFormAgentLocalOnly,formModel:R.formModel,onFormModelUserChange:R.handleFormModelUserChange,formAgentId:R.formAgentId,onFormAgentIdChange:R.setFormAgentId,formWorkingDirectory:R.formWorkingDirectory,onFormWorkingDirectoryChange:R.setFormWorkingDirectory,formChannel:R.formChannel,onFormChannelChange:R.handleFormChannelChange,formChatId:R.formChatId,onFormChatIdChange:R.setFormChatId,formMessage:R.formMessage,onFormMessageChange:R.setFormMessage,formMessageMdMode:R.formMessageMdMode,onSetMessageMdMode:R.setMessageMdMode,messageEditorNonce:R.messageEditorNonce,needsDeliveryChat:R.needsDeliveryChat,showChannelPicker:R.showChannelPicker,canSubmit:R.canSubmit,onSubmit:()=>void ne(),onRefreshRecipients:R.refreshRecipientsList}),(0,$.jsx)(On,{open:A,onOpenChange:e=>{_({type:`patch`,patch:{templatePickerOpen:e,...e?{templateCategoryFilter:`all`}:{}}})},c:n,localeTag:d,scheduleBadgeLabels:Y,categoryFilter:j,onCategoryFilterChange:e=>_({type:`patch`,patch:{templateCategoryFilter:e}}),onSelectTemplate:te}),(0,$.jsx)(Lt,{open:w,onDismiss:K,detailJob:T,detailLoading:D,actionNotice:O,detailHistory:E,c:n,localeTag:d,scheduleBadgeLabels:Y,chatWorkingDirNotSet:r.workingDirectory.notSet,statusLabels:J,onEdit:e=>{R.openForm(e),window.requestAnimationFrame(()=>K())},onRunNow:e=>U(`run`,e.id),onToggle:(e,t)=>void ae(e,t),onDelete:e=>U(`delete`,e.id)}),(0,$.jsx)(ot,{open:k,onOpenChange:e=>_({type:`patch`,patch:{confirmOpen:e}}),action:V.current,c:n,onDismiss:W,onConfirm:oe})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Bn,{hasToken:l,c:n,loading:P.loading,runHistoryLoading:P.runHistoryLoading,onRefresh:P.refreshAll,onOpenTemplatePicker:q,onAddJob:()=>R.openForm()}),(0,$.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})]})}function Bn(e){let t=(0,Q.c)(14),{hasToken:n,c:r,loading:i,runHistoryLoading:a,onRefresh:o,onOpenTemplatePicker:s,onAddJob:c}=e,l=ee(Hn),u=ee(Vn),d;t[0]!==r||t[1]!==i||t[2]!==c||t[3]!==s||t[4]!==o||t[5]!==a?(d=(0,$.jsx)(pn,{c:r,loading:i,runHistoryLoading:a,onRefresh:o,onOpenTemplatePicker:s,onAddJob:c}),t[0]=r,t[1]=i,t[2]=c,t[3]=s,t[4]=o,t[5]=a,t[6]=d):d=t[6];let f=d,p,m;return t[7]!==r.title||t[8]!==u||t[9]!==f||t[10]!==n||t[11]!==l?(p=()=>n?(l({startExtra:null,main:(0,$.jsx)(`div`,{className:`min-w-0`,children:(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:r.title})}),end:f}),()=>u()):(u(),()=>u()),m=[r.title,u,f,n,l],t[7]=r.title,t[8]=u,t[9]=f,t[10]=n,t[11]=l,t[12]=p,t[13]=m):(p=t[12],m=t[13]),(0,Z.useLayoutEffect)(p,m),null}function Vn(e){return e.clearPageHeader}function Hn(e){return e.setPageHeader}export{zn as CronPage};
@@ -1,2 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-JdwAhgNB.js";import{t as a}from"./messages-BUUfPaZ9.js";import{t as o}from"./locale-store-DjbfSsfA.js";import{i as s,n as c}from"./fetch-DOe56Wmy.js";import{$a as l,$r as u,Ea as d,Hi as f,Jr as p,Qr as m,Ss as h,Ts as g,Vo as _,Xo as v,Xr as y,Yo as b,Yr as ee,Zo as x,Zr as te,ba as S,ii as C,ji as ne,ki as w,ko as T,pa as E,ra as D,rs as O,ua as k,vs as A,xi as j,ya as M,ys as N}from"./index-BTmbp2AU.js";var P=n(),F=e(t(),1),I=r(),L=[`active`,`paused`,`blocked`,`needs_input`,`done`,`archived`],R=[`active`,`paused`,`attention`,`done`,`archived`],z=`application/x-xopc-goal-id`;function re(e){let t=e.checklist.length;return{done:e.checklist.filter(e=>e.status===`completed`||e.status===`impossible`).length,total:t}}function ie(e,t){return Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{{${t}}}`,String(n)),e)}function B(e,t){return new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en-US`,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(e))}function ae(e,t){return t.statuses[e]??e}function V(e){return e.status===`blocked`||e.status===`needs_input`?`attention`:e.status}function oe(e){return e===`active`?`bg-accent-soft text-accent-fg`:e===`paused`?`bg-surface-hover text-fg-muted`:e===`done`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`archived`?`bg-surface-muted text-fg-subtle`:`bg-amber-500/10 text-amber-700 dark:text-amber-300`}function H(e){return e===`completed`?`✓`:e===`impossible`?`!`:`○`}function U(e){return e.nextRunAt??e.finishedAt??e.startedAt??e.enqueuedAt}function W(e){return e.status===`running`?6:e.status===`retry_waiting`?5:e.status===`queued`?4:e.status===`failed`?3:e.status===`succeeded`?2:1}function G(e){let t=new Map;for(let n of e){let e=t.get(n.goalId);(!e||W(n)>W(e)||W(n)===W(e)&&U(n)>U(e))&&t.set(n.goalId,n)}return t}function se(e){return e===`running`?`bg-accent-soft text-accent-fg`:e===`retry_waiting`||e===`failed`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`succeeded`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-surface-hover text-fg-muted`}function ce(e,t){let n=t.trim().toLowerCase();return n?[e.title,e.description,e.nextAction,e.blockedReason,e.latestRun?.reason,...e.checklist.map(e=>e.text)].filter(Boolean).join(`
2
- `).toLowerCase().includes(n):!0}async function K(){return(await c(s(`/api/goals?${new URLSearchParams({status:L.join(`,`),limit:`500`}).toString()}`))).goals}async function q(){return(await c(s(`/api/goals/queue`))).queue??[]}async function J(e){return(await c(s(`/api/goals`),{method:`POST`,body:JSON.stringify({...e,source:`api`})})).goal}async function le(e,t){await c(s(`/api/goals/${encodeURIComponent(e)}/checklist`),{method:`POST`,body:JSON.stringify({text:t})})}async function Y(e,t){await c(s(`/api/goals/${encodeURIComponent(e)}/${t}`),{method:`POST`,body:JSON.stringify({})})}async function X(e){return(await c(s(`/api/goals/${encodeURIComponent(e)}/continue`),{method:`POST`,body:JSON.stringify({})})).sessionKey}function ue(e){return e.status===`active`?`continue`:e.status===`paused`||e.status===`blocked`||e.status===`needs_input`?`resume`:e.status===`done`?`reopen`:e.status===`archived`?`unarchive`:null}function de(e){return e.status===`active`?[`pause`,`complete`,`archive`]:e.status===`paused`||e.status===`blocked`||e.status===`needs_input`||e.status===`done`?[`archive`]:[]}function Z(e,t){return t.actions[e]}function Q(e){return e===`pause`?v:e===`archive`?A:e===`unarchive`?N:e===`reopen`?M:e===`complete`?x:b}function $(e,t){return V(e)===t?null:t===`active`?e.status===`done`?`reopen`:e.status===`archived`?`unarchive`:`resume`:t===`paused`?e.status===`archived`?`unarchive`:`pause`:t===`done`?`complete`:t===`archived`?`archive`:null}function fe(e){let t=(0,P.c)(107),{goal:n,queueItem:r,t:a,language:o,selected:s,dragging:c,onOpen:l,onDragStart:u,onDragEnd:d}=e,f,p,m,h,g,_,v,y,b,ee,x,te,S,C,ne,w,T;if(t[0]!==c||t[1]!==n||t[2]!==o||t[3]!==d||t[4]!==u||t[5]!==l||t[6]!==r||t[7]!==s||t[8]!==a){let e=re(n),E=n.latestRun?.finishedAt??n.updatedAt;_=!0,t[26]!==n.id||t[27]!==u?(v=e=>u(n.id,e),t[26]=n.id,t[27]=u,t[28]=v):v=t[28],y=d;let D=s?`border-accent/70 ring-1 ring-accent/30`:`border-edge`,O=c?`opacity-50`:`hover:border-edge-strong hover:bg-surface-hover/50`;t[29]!==D||t[30]!==O?(b=i(`group relative overflow-hidden rounded-xl border bg-surface-panel p-3.5 transition-colors`,D,O),t[29]=D,t[30]=O,t[31]=b):b=t[31],x=`button`,t[32]!==n||t[33]!==l?(te=()=>l(n),t[32]=n,t[33]=l,t[34]=te):te=t[34],S=`${a.openDetails}: ${n.title}`,C=s?`true`:void 0,t[35]===Symbol.for(`react.memo_cache_sentinel`)?(ne=i(`w-full text-left`,j.focusRingPanel),t[35]=ne):ne=t[35];let k;t[36]===n.title?k=t[37]:(k=(0,I.jsx)(`div`,{className:`line-clamp-2 text-sm font-semibold leading-5 text-fg`,children:n.title}),t[36]=n.title,t[37]=k);let A;t[38]===n.agentId?A=t[39]:(A=(0,I.jsx)(`div`,{className:`mt-1 truncate text-[11px] font-medium text-fg-muted`,children:n.agentId}),t[38]=n.agentId,t[39]=A);let M;t[40]!==k||t[41]!==A?(M=(0,I.jsxs)(`div`,{className:`min-w-0`,children:[k,A]}),t[40]=k,t[41]=A,t[42]=M):M=t[42];let N;t[43]===n.status?N=t[44]:(N=i(`shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold shadow-sm`,oe(n.status)),t[43]=n.status,t[44]=N);let P;t[45]!==n.status||t[46]!==a?(P=ae(n.status,a),t[45]=n.status,t[46]=a,t[47]=P):P=t[47];let F;t[48]!==N||t[49]!==P?(F=(0,I.jsx)(`span`,{className:N,children:P}),t[48]=N,t[49]=P,t[50]=F):F=t[50],t[51]!==M||t[52]!==F?(w=(0,I.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[M,F]}),t[51]=M,t[52]=F,t[53]=w):w=t[53];let L;t[54]!==o||t[55]!==E?(L=B(E,o),t[54]=o,t[55]=E,t[56]=L):L=t[56];let R;t[57]===L?R=t[58]:(R=(0,I.jsx)(`span`,{children:L}),t[57]=L,t[58]=R);let z;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,I.jsx)(`span`,{"aria-hidden":!0,children:`·`}),t[59]=z):z=t[59];let V;t[60]!==n.maxTurns||t[61]!==n.turnsUsed||t[62]!==a.turns?(V=ie(a.turns,{used:n.turnsUsed,max:n.maxTurns}),t[60]=n.maxTurns,t[61]=n.turnsUsed,t[62]=a.turns,t[63]=V):V=t[63];let H;t[64]===V?H=t[65]:(H=(0,I.jsx)(`span`,{children:V}),t[64]=V,t[65]=H);let U=e.total?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,I.jsx)(`span`,{children:ie(a.checklistProgress,{done:e.done,total:e.total})})]}):null;t[66]!==R||t[67]!==H||t[68]!==U?(T=(0,I.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-[11px] text-fg-subtle`,children:[R,z,H,U]}),t[66]=R,t[67]=H,t[68]=U,t[69]=T):T=t[69],t[70]!==r||t[71]!==a?(p=r?(0,I.jsx)(`div`,{className:`mt-2.5`,children:(0,I.jsx)(`span`,{className:i(`rounded-full px-2 py-0.5 text-[11px] font-semibold`,se(r.status)),children:ae(r.status,a)})}):null,t[70]=r,t[71]=a,t[72]=p):p=t[72],t[73]===n.blockedReason?m=t[74]:(m=n.blockedReason?(0,I.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs text-amber-700 dark:text-amber-300`,children:n.blockedReason}):null,t[73]=n.blockedReason,t[74]=m),t[75]===n.nextAction?h=t[76]:(h=n.nextAction?(0,I.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs text-fg-muted`,children:n.nextAction}):null,t[75]=n.nextAction,t[76]=h),t[77]!==n.blockedReason||t[78]!==n.latestRun||t[79]!==n.nextAction?(g=!n.blockedReason&&!n.nextAction&&n.latestRun?.reason?(0,I.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs text-fg-muted`,children:n.latestRun.reason}):null,t[77]=n.blockedReason,t[78]=n.latestRun,t[79]=n.nextAction,t[80]=g):g=t[80],f=`mt-3 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,ee=n.checklist.length?(0,I.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 font-medium text-fg-muted`,children:ie(a.checklistProgress,{done:e.done,total:e.total})}):null,t[0]=c,t[1]=n,t[2]=o,t[3]=d,t[4]=u,t[5]=l,t[6]=r,t[7]=s,t[8]=a,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g,t[14]=_,t[15]=v,t[16]=y,t[17]=b,t[18]=ee,t[19]=x,t[20]=te,t[21]=S,t[22]=C,t[23]=ne,t[24]=w,t[25]=T}else f=t[9],p=t[10],m=t[11],h=t[12],g=t[13],_=t[14],v=t[15],y=t[16],b=t[17],ee=t[18],x=t[19],te=t[20],S=t[21],C=t[22],ne=t[23],w=t[24],T=t[25];let E;t[81]!==s||t[82]!==a.openDetails?(E=s?(0,I.jsx)(`span`,{className:`font-medium text-accent-fg`,children:a.openDetails}):null,t[81]=s,t[82]=a.openDetails,t[83]=E):E=t[83];let D;t[84]!==f||t[85]!==E||t[86]!==ee?(D=(0,I.jsxs)(`div`,{className:f,children:[ee,E]}),t[84]=f,t[85]=E,t[86]=ee,t[87]=D):D=t[87];let O;t[88]!==p||t[89]!==m||t[90]!==h||t[91]!==g||t[92]!==D||t[93]!==x||t[94]!==te||t[95]!==S||t[96]!==C||t[97]!==ne||t[98]!==w||t[99]!==T?(O=(0,I.jsxs)(`button`,{type:x,onClick:te,"aria-label":S,"aria-current":C,className:ne,children:[w,T,p,m,h,g,D]}),t[88]=p,t[89]=m,t[90]=h,t[91]=g,t[92]=D,t[93]=x,t[94]=te,t[95]=S,t[96]=C,t[97]=ne,t[98]=w,t[99]=T,t[100]=O):O=t[100];let k;return t[101]!==_||t[102]!==v||t[103]!==y||t[104]!==b||t[105]!==O?(k=(0,I.jsx)(`article`,{draggable:_,onDragStart:v,onDragEnd:y,className:b,children:O}),t[101]=_,t[102]=v,t[103]=y,t[104]=b,t[105]=O,t[106]=k):k=t[106],k}function pe(e){let t=(0,P.c)(17),{goalId:n,action:r,t:i,busy:a,variant:o,onAction:s}=e,c;t[0]===r?c=t[1]:(c=Q(r),t[0]=r,t[1]=c);let l=c,u=a!=null,d;t[2]!==r||t[3]!==n||t[4]!==s?(d=()=>s(n,r),t[2]=r,t[3]=n,t[4]=s,t[5]=d):d=t[5];let f;t[6]===l?f=t[7]:(f=(0,I.jsx)(l,{className:`size-4`,"aria-hidden":!0}),t[6]=l,t[7]=f);let p;t[8]!==r||t[9]!==i?(p=Z(r,i),t[8]=r,t[9]=i,t[10]=p):p=t[10];let m;return t[11]!==u||t[12]!==d||t[13]!==f||t[14]!==p||t[15]!==o?(m=(0,I.jsxs)(w,{type:`button`,variant:o,className:`h-9 rounded-lg px-3 text-sm`,disabled:u,onClick:d,children:[f,p]}),t[11]=u,t[12]=d,t[13]=f,t[14]=p,t[15]=o,t[16]=m):m=t[16],m}function me(){return{title:``,description:``,checklist:[``,``,``],priority:`normal`,deadline:``,maxTurns:`10`,agentId:``,judgeModelRef:``}}function he(e,t){let n=e.title.trim()||t.createDialog.goalFallback;return t.createDialog.aiChecklistTemplates.map(e=>ie(e,{goal:n}))}function ge(e){let t=new Set,n=[];for(let r of e){let e=r.trim();!e||t.has(e.toLowerCase())||(t.add(e.toLowerCase()),n.push(e))}return n}function _e(e){let t=(0,P.c)(143),{open:n,t:r,busy:a,onClose:o,onCreate:s}=e,[c,l]=(0,F.useState)(ye),[h,g]=(0,F.useState)(!1),[_,v]=(0,F.useState)(null),b,x;t[0]===n?(b=t[1],x=t[2]):(b=()=>{n||(l(me()),g(!1),v(null))},x=[n],t[0]=n,t[1]=b,t[2]=x),(0,F.useEffect)(b,x);let S;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>l(t=>({...t,...e})),t[3]=S):S=t[3];let C=S,T;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(T=(e,t)=>{l(n=>({...n,checklist:n.checklist.map((n,r)=>r===e?t:n)}))},t[4]=T):T=t[4];let E=T,A;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{l(t=>({...t,checklist:t.checklist.filter((t,n)=>n!==e)}))},t[5]=A):A=t[5];let j=A,M;t[6]!==c||t[7]!==o||t[8]!==s||t[9]!==r.createDialog.titleRequired||t[10]!==r.errors?(M=async()=>{if(v(null),!c.title.trim()){v(r.createDialog.titleRequired);return}try{await s({...c,checklist:ge(c.checklist)}),o()}catch(e){let t=e;v(t instanceof Error?t.message:r.errors.create)}},t[6]=c,t[7]=o,t[8]=s,t[9]=r.createDialog.titleRequired,t[10]=r.errors,t[11]=M):M=t[11];let N=M,L;t[12]===o?L=t[13]:(L=e=>!e&&o(),t[12]=o,t[13]=L);let R;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,I.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),t[14]=R):R=t[14];let z;t[15]===r.createDialog.title?z=t[16]:(z=(0,I.jsx)(u,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:r.createDialog.title}),t[15]=r.createDialog.title,t[16]=z);let re;t[17]===r.createDialog.description?re=t[18]:(re=(0,I.jsx)(ee,{className:`mt-1 truncate text-sm text-fg-muted`,children:r.createDialog.description}),t[17]=r.createDialog.description,t[18]=re);let B;t[19]!==re||t[20]!==z?(B=(0,I.jsxs)(`div`,{className:`min-w-0`,children:[z,re]}),t[19]=re,t[20]=z,t[21]=B):B=t[21];let ae;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,I.jsx)(ne,{className:`size-5`,"aria-hidden":!0}),t[22]=ae):ae=t[22];let V;t[23]!==o||t[24]!==r.closeDetails?(V=(0,I.jsx)(w,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":r.closeDetails,onClick:o,children:ae}),t[23]=o,t[24]=r.closeDetails,t[25]=V):V=t[25];let oe;t[26]!==B||t[27]!==V?(oe=(0,I.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-5 py-4`,children:[B,V]}),t[26]=B,t[27]=V,t[28]=oe):oe=t[28];let H;t[29]===r.createDialog.goalTitle?H=t[30]:(H=(0,I.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:r.createDialog.goalTitle}),t[29]=r.createDialog.goalTitle,t[30]=H);let U;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>C({title:e.target.value}),t[31]=U):U=t[31];let W;t[32]!==c.title||t[33]!==r.newGoalPlaceholder?(W=(0,I.jsx)(`input`,{value:c.title,onChange:U,placeholder:r.newGoalPlaceholder,className:`rounded-lg border border-edge bg-surface-muted px-3 py-2 text-sm text-fg placeholder:text-fg-muted focus-visible:border-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`,autoFocus:!0}),t[32]=c.title,t[33]=r.newGoalPlaceholder,t[34]=W):W=t[34];let G;t[35]!==H||t[36]!==W?(G=(0,I.jsxs)(`label`,{className:`grid gap-1.5`,children:[H,W]}),t[35]=H,t[36]=W,t[37]=G):G=t[37];let se;t[38]===r.createDialog.goalDescription?se=t[39]:(se=(0,I.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:r.createDialog.goalDescription}),t[38]=r.createDialog.goalDescription,t[39]=se);let ce;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(ce=e=>C({description:e.target.value}),t[40]=ce):ce=t[40];let K;t[41]!==c.description||t[42]!==r.createDialog.descriptionPlaceholder?(K=(0,I.jsx)(`textarea`,{value:c.description,onChange:ce,placeholder:r.createDialog.descriptionPlaceholder,rows:4,className:`resize-none rounded-lg border border-edge bg-surface-muted px-3 py-2 text-sm text-fg placeholder:text-fg-muted focus-visible:border-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`}),t[41]=c.description,t[42]=r.createDialog.descriptionPlaceholder,t[43]=K):K=t[43];let q;t[44]!==se||t[45]!==K?(q=(0,I.jsxs)(`label`,{className:`grid gap-1.5`,children:[se,K]}),t[44]=se,t[45]=K,t[46]=q):q=t[46];let J;t[47]===r.createDialog.criteriaTitle?J=t[48]:(J=(0,I.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.createDialog.criteriaTitle}),t[47]=r.createDialog.criteriaTitle,t[48]=J);let le;t[49]===r.createDialog.criteriaHint?le=t[50]:(le=(0,I.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:r.createDialog.criteriaHint}),t[49]=r.createDialog.criteriaHint,t[50]=le);let Y;t[51]!==J||t[52]!==le?(Y=(0,I.jsxs)(`div`,{children:[J,le]}),t[51]=J,t[52]=le,t[53]=Y):Y=t[53];let X;t[54]!==c||t[55]!==r?(X=()=>C({checklist:he(c,r)}),t[54]=c,t[55]=r,t[56]=X):X=t[56];let ue;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,I.jsx)(D,{className:`size-3.5`,"aria-hidden":!0}),t[57]=ue):ue=t[57];let de;t[58]!==r.createDialog.aiDraft||t[59]!==X?(de=(0,I.jsxs)(w,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:X,children:[ue,r.createDialog.aiDraft]}),t[58]=r.createDialog.aiDraft,t[59]=X,t[60]=de):de=t[60];let Z;t[61]!==Y||t[62]!==de?(Z=(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[Y,de]}),t[61]=Y,t[62]=de,t[63]=Z):Z=t[63];let Q;if(t[64]!==c.checklist||t[65]!==r.createDialog.criteriaPlaceholder||t[66]!==r.createDialog.removeCriteria){let e;t[68]!==r.createDialog.criteriaPlaceholder||t[69]!==r.createDialog.removeCriteria?(e=(e,t)=>(0,I.jsxs)(`div`,{className:`flex gap-2`,children:[(0,I.jsx)(`input`,{value:e,onChange:e=>E(t,e.target.value),placeholder:ie(r.createDialog.criteriaPlaceholder,{index:t+1}),className:`min-w-0 flex-1 rounded-lg border border-edge bg-surface-muted px-3 py-2 text-sm text-fg placeholder:text-fg-muted focus-visible:border-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`}),(0,I.jsx)(w,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 rounded-lg p-0`,"aria-label":r.createDialog.removeCriteria,onClick:()=>j(t),children:(0,I.jsx)(f,{className:`size-4`,"aria-hidden":!0})})]},t),t[68]=r.createDialog.criteriaPlaceholder,t[69]=r.createDialog.removeCriteria,t[70]=e):e=t[70],Q=c.checklist.map(e),t[64]=c.checklist,t[65]=r.createDialog.criteriaPlaceholder,t[66]=r.createDialog.removeCriteria,t[67]=Q}else Q=t[67];let $;t[71]===c.checklist?$=t[72]:($=()=>C({checklist:[...c.checklist,``]}),t[71]=c.checklist,t[72]=$);let fe;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,I.jsx)(d,{className:`size-3.5`,"aria-hidden":!0}),t[73]=fe):fe=t[73];let pe;t[74]!==r.createDialog.addCriteria||t[75]!==$?(pe=(0,I.jsxs)(w,{type:`button`,variant:`ghost`,className:`h-8 justify-start rounded-lg text-xs`,onClick:$,children:[fe,r.createDialog.addCriteria]}),t[74]=r.createDialog.addCriteria,t[75]=$,t[76]=pe):pe=t[76];let _e;t[77]!==Q||t[78]!==pe?(_e=(0,I.jsxs)(`div`,{className:`mt-3 grid gap-2`,children:[Q,pe]}),t[77]=Q,t[78]=pe,t[79]=_e):_e=t[79];let be;t[80]!==Z||t[81]!==_e?(be=(0,I.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base/60 p-4`,children:[Z,_e]}),t[80]=Z,t[81]=_e,t[82]=be):be=t[82];let xe;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(xe=()=>g(ve),t[83]=xe):xe=t[83];let Se;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,I.jsx)(k,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),t[84]=Se):Se=t[84];let Ce;t[85]===r.createDialog.advanced?Ce=t[86]:(Ce=(0,I.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[Se,r.createDialog.advanced]}),t[85]=r.createDialog.advanced,t[86]=Ce);let we=h&&`rotate-180`,Te;t[87]===we?Te=t[88]:(Te=i(`size-4 text-fg-muted transition-transform`,we),t[87]=we,t[88]=Te);let Ee;t[89]===Te?Ee=t[90]:(Ee=(0,I.jsx)(O,{className:Te,"aria-hidden":!0}),t[89]=Te,t[90]=Ee);let De;t[91]!==Ce||t[92]!==Ee?(De=(0,I.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between gap-3 px-4 py-3 text-left`,onClick:xe,children:[Ce,Ee]}),t[91]=Ce,t[92]=Ee,t[93]=De):De=t[93];let Oe;t[94]!==h||t[95]!==c.agentId||t[96]!==c.deadline||t[97]!==c.judgeModelRef||t[98]!==c.maxTurns||t[99]!==c.priority||t[100]!==r.createDialog.agentId||t[101]!==r.createDialog.deadline||t[102]!==r.createDialog.judgeModel||t[103]!==r.createDialog.judgeModelPlaceholder||t[104]!==r.createDialog.maxTurns||t[105]!==r.createDialog.priority||t[106]!==r.priorities?(Oe=h?(0,I.jsxs)(`div`,{className:`grid gap-3 border-t border-edge-subtle p-4 sm:grid-cols-2`,children:[(0,I.jsxs)(`label`,{className:`grid gap-1.5`,children:[(0,I.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:r.createDialog.priority}),(0,I.jsxs)(`select`,{value:c.priority,onChange:e=>C({priority:e.target.value}),className:`rounded-lg border border-edge bg-surface-muted px-3 py-2 text-sm text-fg focus-visible:border-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`,children:[(0,I.jsx)(`option`,{value:`normal`,children:r.priorities.normal}),(0,I.jsx)(`option`,{value:`high`,children:r.priorities.high}),(0,I.jsx)(`option`,{value:`low`,children:r.priorities.low})]})]}),(0,I.jsxs)(`label`,{className:`grid gap-1.5`,children:[(0,I.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:r.createDialog.deadline}),(0,I.jsx)(`input`,{type:`date`,value:c.deadline,onChange:e=>C({deadline:e.target.value}),className:`rounded-lg border border-edge bg-surface-muted px-3 py-2 text-sm text-fg focus-visible:border-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`})]}),(0,I.jsxs)(`label`,{className:`grid gap-1.5`,children:[(0,I.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:r.createDialog.maxTurns}),(0,I.jsx)(`input`,{type:`number`,min:1,max:500,value:c.maxTurns,onChange:e=>C({maxTurns:e.target.value}),className:`rounded-lg border border-edge bg-surface-muted px-3 py-2 text-sm text-fg focus-visible:border-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`})]}),(0,I.jsxs)(`label`,{className:`grid gap-1.5`,children:[(0,I.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:r.createDialog.agentId}),(0,I.jsx)(`input`,{value:c.agentId,onChange:e=>C({agentId:e.target.value}),placeholder:`main`,className:`rounded-lg border border-edge bg-surface-muted px-3 py-2 text-sm text-fg placeholder:text-fg-muted focus-visible:border-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`})]}),(0,I.jsxs)(`label`,{className:`grid gap-1.5 sm:col-span-2`,children:[(0,I.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:r.createDialog.judgeModel}),(0,I.jsx)(`input`,{value:c.judgeModelRef,onChange:e=>C({judgeModelRef:e.target.value}),placeholder:r.createDialog.judgeModelPlaceholder,className:`rounded-lg border border-edge bg-surface-muted px-3 py-2 text-sm text-fg placeholder:text-fg-muted focus-visible:border-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`})]})]}):null,t[94]=h,t[95]=c.agentId,t[96]=c.deadline,t[97]=c.judgeModelRef,t[98]=c.maxTurns,t[99]=c.priority,t[100]=r.createDialog.agentId,t[101]=r.createDialog.deadline,t[102]=r.createDialog.judgeModel,t[103]=r.createDialog.judgeModelPlaceholder,t[104]=r.createDialog.maxTurns,t[105]=r.createDialog.priority,t[106]=r.priorities,t[107]=Oe):Oe=t[107];let ke;t[108]!==De||t[109]!==Oe?(ke=(0,I.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base/60`,children:[De,Oe]}),t[108]=De,t[109]=Oe,t[110]=ke):ke=t[110];let Ae;t[111]===_?Ae=t[112]:(Ae=_?(0,I.jsx)(`p`,{className:`rounded-lg border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:_}):null,t[111]=_,t[112]=Ae);let je;t[113]!==G||t[114]!==q||t[115]!==be||t[116]!==ke||t[117]!==Ae?(je=(0,I.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,I.jsxs)(`div`,{className:`grid gap-4`,children:[G,q,be,ke,Ae]})}),t[113]=G,t[114]=q,t[115]=be,t[116]=ke,t[117]=Ae,t[118]=je):je=t[118];let Me;t[119]!==o||t[120]!==r.createDialog.cancel?(Me=(0,I.jsx)(w,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:o,children:r.createDialog.cancel}),t[119]=o,t[120]=r.createDialog.cancel,t[121]=Me):Me=t[121];let Ne;t[122]!==a||t[123]!==c.title?(Ne=a||!c.title.trim(),t[122]=a,t[123]=c.title,t[124]=Ne):Ne=t[124];let Pe;t[125]===N?Pe=t[126]:(Pe=()=>void N(),t[125]=N,t[126]=Pe);let Fe;t[127]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=(0,I.jsx)(d,{className:`size-4`,"aria-hidden":!0}),t[127]=Fe):Fe=t[127];let Ie;t[128]!==r.createDialog.create||t[129]!==Ne||t[130]!==Pe?(Ie=(0,I.jsxs)(w,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:Ne,onClick:Pe,children:[Fe,r.createDialog.create]}),t[128]=r.createDialog.create,t[129]=Ne,t[130]=Pe,t[131]=Ie):Ie=t[131];let Le;t[132]!==Me||t[133]!==Ie?(Le=(0,I.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-edge px-5 py-4`,children:[Me,Ie]}),t[132]=Me,t[133]=Ie,t[134]=Le):Le=t[134];let Re;t[135]!==oe||t[136]!==je||t[137]!==Le?(Re=(0,I.jsxs)(te,{children:[R,(0,I.jsxs)(p,{className:`fixed left-1/2 top-1/2 z-66 flex h-[min(92vh,46rem)] w-[min(100%-2rem,44rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:[oe,je,Le]})]}),t[135]=oe,t[136]=je,t[137]=Le,t[138]=Re):Re=t[138];let ze;return t[139]!==n||t[140]!==Re||t[141]!==L?(ze=(0,I.jsx)(m,{open:n,onOpenChange:L,children:Re}),t[139]=n,t[140]=Re,t[141]=L,t[142]=ze):ze=t[142],ze}function ve(e){return!e}function ye(){return me()}function be(e){let t=(0,P.c)(135),{goal:n,queueItem:r,t:a,language:o,busy:s,onClose:c,onAction:d}=e;if(!n)return null;let f,g,_,v,b,x,S,C,E,D,O,k,A,j;if(t[0]!==s||t[1]!==n||t[2]!==d||t[3]!==c||t[4]!==a){let e=re(n),r;t[19]===n?r=t[20]:(r=ue(n),t[19]=n,t[20]=r);let o=r,l=de(n);_=m,b=!0,t[21]===c?x=t[22]:(x=e=>!e&&c(),t[21]=c,t[22]=x),g=te,t[23]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,I.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),t[23]=j):j=t[23],f=p,k=`fixed left-1/2 top-1/2 z-66 flex h-[min(90vh,48rem)] w-[min(100%-2rem,56rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`;let h;t[24]===n.title?h=t[25]:(h=(0,I.jsx)(u,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),t[24]=n.title,t[25]=h);let T;t[26]!==n.status||t[27]!==a?(T=ae(n.status,a),t[26]=n.status,t[27]=a,t[28]=T):T=t[28];let M;t[29]!==n.maxTurns||t[30]!==n.turnsUsed||t[31]!==a.turns?(M=ie(a.turns,{used:n.turnsUsed,max:n.maxTurns}),t[29]=n.maxTurns,t[30]=n.turnsUsed,t[31]=a.turns,t[32]=M):M=t[32];let N;t[33]!==T||t[34]!==M?(N=(0,I.jsxs)(ee,{className:`mt-1 truncate text-xs text-fg-muted`,children:[T,` · `,M]}),t[33]=T,t[34]=M,t[35]=N):N=t[35];let P;t[36]!==h||t[37]!==N?(P=(0,I.jsxs)(`div`,{className:`min-w-0`,children:[h,N]}),t[36]=h,t[37]=N,t[38]=P):P=t[38];let F;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,I.jsx)(ne,{className:`size-5`,"aria-hidden":!0}),t[39]=F):F=t[39];let L;t[40]!==c||t[41]!==a.closeDetails?(L=(0,I.jsx)(w,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":a.closeDetails,onClick:c,children:F}),t[40]=c,t[41]=a.closeDetails,t[42]=L):L=t[42],t[43]!==P||t[44]!==L?(A=(0,I.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-5 py-4`,children:[P,L]}),t[43]=P,t[44]=L,t[45]=A):A=t[45],O=`min-h-0 flex-1 overflow-y-auto p-5`,E=`flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between`;let R;t[46]===n.status?R=t[47]:(R=i(`rounded-full px-2 py-0.5 text-xs font-medium`,oe(n.status)),t[46]=n.status,t[47]=R);let z;t[48]!==n.status||t[49]!==a?(z=ae(n.status,a),t[48]=n.status,t[49]=a,t[50]=z):z=t[50];let B;t[51]!==R||t[52]!==z?(B=(0,I.jsx)(`span`,{className:R,children:z}),t[51]=R,t[52]=z,t[53]=B):B=t[53];let V;t[54]===n.agentId?V=t[55]:(V=(0,I.jsx)(`span`,{className:`text-xs text-fg-muted`,children:n.agentId}),t[54]=n.agentId,t[55]=V);let H=ie(a.checklistProgress,{done:e.done,total:e.total}),U;t[56]===H?U=t[57]:(U=(0,I.jsx)(`span`,{className:`text-xs text-fg-muted`,children:H}),t[56]=H,t[57]=U);let W;t[58]!==B||t[59]!==V||t[60]!==U?(W=(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[B,V,U]}),t[58]=B,t[59]=V,t[60]=U,t[61]=W):W=t[61];let G;t[62]===n.description?G=t[63]:(G=n.description?(0,I.jsx)(`p`,{className:`mt-3 whitespace-pre-wrap break-words text-sm leading-6 text-fg-muted`,children:n.description}):null,t[62]=n.description,t[63]=G),t[64]!==W||t[65]!==G?(D=(0,I.jsxs)(`div`,{className:`min-w-0`,children:[W,G]}),t[64]=W,t[65]=G,t[66]=D):D=t[66],v=`flex flex-wrap gap-2`,t[67]!==s||t[68]!==n.id||t[69]!==d||t[70]!==o||t[71]!==a?(S=o?(0,I.jsx)(pe,{goalId:n.id,action:o,t:a,busy:s,variant:o===`continue`?`primary`:`secondary`,onAction:d}):null,t[67]=s,t[68]=n.id,t[69]=d,t[70]=o,t[71]=a,t[72]=S):S=t[72];let se;t[73]!==s||t[74]!==n.id||t[75]!==d||t[76]!==a?(se=e=>(0,I.jsx)(pe,{goalId:n.id,action:e,t:a,busy:s,variant:e===`archive`?`ghost`:`secondary`,onAction:d},e),t[73]=s,t[74]=n.id,t[75]=d,t[76]=a,t[77]=se):se=t[77],C=l.map(se),t[0]=s,t[1]=n,t[2]=d,t[3]=c,t[4]=a,t[5]=f,t[6]=g,t[7]=_,t[8]=v,t[9]=b,t[10]=x,t[11]=S,t[12]=C,t[13]=E,t[14]=D,t[15]=O,t[16]=k,t[17]=A,t[18]=j}else f=t[5],g=t[6],_=t[7],v=t[8],b=t[9],x=t[10],S=t[11],C=t[12],E=t[13],D=t[14],O=t[15],k=t[16],A=t[17],j=t[18];let M=`/goals/${encodeURIComponent(n.id)}`,N;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,I.jsx)(T,{className:`size-4`,"aria-hidden":!0}),t[78]=N):N=t[78];let F;t[79]!==a.fullDetails||t[80]!==M?(F=(0,I.jsx)(w,{asChild:!0,type:`button`,variant:`secondary`,className:`h-9 rounded-lg`,children:(0,I.jsxs)(h,{to:M,children:[N,a.fullDetails]})}),t[79]=a.fullDetails,t[80]=M,t[81]=F):F=t[81];let L;t[82]!==v||t[83]!==F||t[84]!==S||t[85]!==C?(L=(0,I.jsxs)(`div`,{className:v,children:[S,C,F]}),t[82]=v,t[83]=F,t[84]=S,t[85]=C,t[86]=L):L=t[86];let R;t[87]!==L||t[88]!==E||t[89]!==D?(R=(0,I.jsxs)(`div`,{className:E,children:[D,L]}),t[87]=L,t[88]=E,t[89]=D,t[90]=R):R=t[90];let z;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,I.jsx)(`div`,{className:`rounded-xl bg-accent-soft p-2 text-accent-fg`,children:(0,I.jsx)(l,{className:`size-4`,"aria-hidden":!0})}),t[91]=z):z=t[91];let V=n.blockedReason?a.currentBlocker:a.nextAction,H;t[92]===V?H=t[93]:(H=(0,I.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:V}),t[92]=V,t[93]=H);let W=n.blockedReason?`text-amber-700 dark:text-amber-300`:`text-fg-muted`,G;t[94]===W?G=t[95]:(G=i(`mt-1 text-sm leading-6`,W),t[94]=W,t[95]=G);let ce=n.blockedReason||n.nextAction||a.noNextAction,K;t[96]!==G||t[97]!==ce?(K=(0,I.jsx)(`p`,{className:G,children:ce}),t[96]=G,t[97]=ce,t[98]=K):K=t[98];let q;t[99]!==H||t[100]!==K?(q=(0,I.jsx)(`div`,{className:`mt-5 rounded-2xl border border-edge-subtle bg-surface-base/60 p-4`,children:(0,I.jsxs)(`div`,{className:`flex items-start gap-3`,children:[z,(0,I.jsxs)(`div`,{className:`min-w-0`,children:[H,K]})]})}),t[99]=H,t[100]=K,t[101]=q):q=t[101];let J;t[102]!==o||t[103]!==r||t[104]!==a?(J=r?(0,I.jsxs)(`div`,{className:`mt-4 rounded-2xl border border-edge-subtle bg-surface-base/60 p-4`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,I.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.executionQueue}),(0,I.jsx)(`span`,{className:i(`rounded-full px-2 py-0.5 text-xs font-semibold`,se(r.status)),children:ae(r.status,a)})]}),(0,I.jsxs)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:[ie(a.attempt,{attempts:r.attempts,max:r.maxRetries+1}),` · `,B(U(r),o)]}),r.error?(0,I.jsx)(`p`,{className:`mt-2 text-sm text-amber-700 dark:text-amber-300`,children:r.error}):null,r.message?(0,I.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:r.message}):null]}):null,t[102]=o,t[103]=r,t[104]=a,t[105]=J):J=t[105];let le;t[106]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,I.jsx)(l,{className:`size-4 text-accent`,"aria-hidden":!0}),t[106]=le):le=t[106];let Y;t[107]===a.checklist?Y=t[108]:(Y=(0,I.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[le,a.checklist]}),t[107]=a.checklist,t[108]=Y);let X;t[109]!==n.checklist||t[110]!==a.noChecklist?(X=n.checklist.length?(0,I.jsx)(`ul`,{className:`mt-3 grid gap-2 text-sm text-fg-muted`,children:n.checklist.map(xe)}):(0,I.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:a.noChecklist}),t[109]=n.checklist,t[110]=a.noChecklist,t[111]=X):X=t[111];let Z;t[112]!==Y||t[113]!==X?(Z=(0,I.jsxs)(`div`,{className:`mt-4 rounded-2xl border border-edge-subtle bg-surface-base/60 p-4`,children:[Y,X]}),t[112]=Y,t[113]=X,t[114]=Z):Z=t[114];let Q;t[115]!==R||t[116]!==q||t[117]!==J||t[118]!==Z||t[119]!==O?(Q=(0,I.jsxs)(`section`,{className:O,children:[R,q,J,Z]}),t[115]=R,t[116]=q,t[117]=J,t[118]=Z,t[119]=O,t[120]=Q):Q=t[120];let $;t[121]!==f||t[122]!==Q||t[123]!==k||t[124]!==A?($=(0,I.jsxs)(f,{className:k,children:[A,Q]}),t[121]=f,t[122]=Q,t[123]=k,t[124]=A,t[125]=$):$=t[125];let fe;t[126]!==g||t[127]!==$||t[128]!==j?(fe=(0,I.jsxs)(g,{children:[j,$]}),t[126]=g,t[127]=$,t[128]=j,t[129]=fe):fe=t[129];let me;return t[130]!==_||t[131]!==b||t[132]!==x||t[133]!==fe?(me=(0,I.jsx)(_,{open:b,onOpenChange:x,children:fe}),t[130]=_,t[131]=b,t[132]=x,t[133]=fe,t[134]=me):me=t[134],me}function xe(e){return(0,I.jsxs)(`li`,{className:`flex gap-2`,children:[(0,I.jsx)(`span`,{className:`w-5 shrink-0 text-center`,children:H(e.status)}),(0,I.jsx)(`span`,{className:`break-words`,children:e.text})]},e.id)}function Se(){let e=g(),t=o(e=>e.language),n=a(t).goalsPage,r=C(e=>e.setPageHeader),s=C(e=>e.clearPageHeader),[c,l]=(0,F.useState)([]),[u,f]=(0,F.useState)([]),[p,m]=(0,F.useState)(``),[h,v]=(0,F.useState)(!0),[y,b]=(0,F.useState)(null),[ee,x]=(0,F.useState)(null),[te,ne]=(0,F.useState)(!1),[T,D]=(0,F.useState)(null),[O,k]=(0,F.useState)(null),[A,j]=(0,F.useState)(null),M=(0,F.useCallback)(async()=>{v(!0),x(null);try{let[e,t]=await Promise.all([K(),q()]);l(e),f(t)}catch(e){x(e instanceof Error?e.message:n.errors.load)}finally{v(!1)}},[n.errors.load]);(0,F.useEffect)(()=>{M()},[M]),(0,F.useEffect)(()=>{let e=()=>{q().then(f).catch(()=>{})};return window.addEventListener(`goal-queue-updated`,e),()=>window.removeEventListener(`goal-queue-updated`,e)},[]);let N=(0,F.useMemo)(()=>G(u),[u]),P=(0,F.useMemo)(()=>c.filter(e=>ce(e,p)),[c,p]),L=(0,F.useMemo)(()=>{let e=new Map(R.map(e=>[e,[]]));for(let t of P)e.get(V(t))?.push(t);return e},[P]),re=(0,F.useMemo)(()=>c.find(e=>e.id===T)??null,[c,T]),B=(0,F.useMemo)(()=>({open:c.filter(e=>e.status===`active`||e.status===`paused`||e.status===`blocked`||e.status===`needs_input`).length,attention:c.filter(e=>e.status===`blocked`||e.status===`needs_input`).length,running:u.filter(e=>e.status===`running`).length,queued:u.filter(e=>e.status===`queued`||e.status===`retry_waiting`).length}),[c,u]),ae=(0,F.useMemo)(()=>[{key:`running`,count:B.running},{key:`queued`,count:B.queued},{key:`failed`,count:u.filter(e=>e.status===`failed`).length}],[B.queued,B.running,u]),oe=async(t,r)=>{b(`${t}:${r}`),x(null);try{if(r===`continue`){let n=await X(t);if(n){e(`/chat/${encodeURIComponent(n)}`);return}}else await Y(t,r);await M()}catch(e){x(e instanceof Error?e.message:n.errors.action)}finally{b(null)}},H=async(e,t)=>{let n=c.find(t=>t.id===e),r=n?$(n,t):null;j(null),k(null),!(!n||!r)&&await oe(n.id,r)},U=(0,F.useCallback)(async e=>{let t=Number.parseInt(e.maxTurns,10),r=e.deadline?new Date(`${e.deadline}T23:59:59`).getTime():void 0;b(`create`),x(null);try{let n=await J({title:e.title.trim(),description:e.description.trim()||void 0,priority:e.priority,deadlineAt:Number.isFinite(r)?r:void 0,maxTurns:Number.isFinite(t)?t:void 0,agentId:e.agentId.trim()||void 0,judgeModelRef:e.judgeModelRef.trim()||void 0});for(let t of ge(e.checklist))await le(n.id,t);await M(),D(n.id)}catch(e){throw x(e instanceof Error?e.message:n.errors.create),e}finally{b(null)}},[M,n.errors.create]),W=(0,F.useMemo)(()=>(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`label`,{className:`relative min-w-0`,children:[(0,I.jsx)(E,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,I.jsx)(`input`,{value:p,onChange:e=>m(e.target.value),"aria-label":n.searchPlaceholder,autoComplete:`off`,placeholder:n.searchPlaceholder,className:`h-9 w-36 rounded-lg border border-edge bg-surface-muted py-2 pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted focus-visible:border-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent sm:w-56 lg:w-72`})]}),(0,I.jsx)(w,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,disabled:h,title:n.refresh,"aria-label":n.refresh,onClick:()=>void M(),children:(0,I.jsx)(S,{className:i(`size-4`,h&&`animate-spin`),strokeWidth:1.75,"aria-hidden":!0})}),(0,I.jsxs)(w,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,disabled:y===`create`,onClick:()=>ne(!0),children:[(0,I.jsx)(d,{className:`size-4`,"aria-hidden":!0}),n.create]})]}),[y,h,p,M,n.create,n.refresh,n.searchPlaceholder]);return(0,F.useLayoutEffect)(()=>(r({startExtra:null,main:(0,I.jsxs)(`div`,{className:`min-w-0`,children:[(0,I.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),(0,I.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:ie(n.summary,{open:B.open,attention:B.attention,shown:P.length})})]}),end:W}),()=>s()),[s,B.attention,B.open,W,r,n.summary,n.title,P.length]),(0,I.jsxs)(`main`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-surface-base`,children:[(0,I.jsxs)(`div`,{className:`flex min-h-0 w-full flex-1 flex-col gap-4 px-4 py-5 sm:px-6 2xl:px-8`,children:[(0,I.jsxs)(`section`,{className:`flex flex-wrap items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,I.jsxs)(`div`,{className:`mr-1 flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,I.jsx)(_,{className:`size-4 text-accent`,"aria-hidden":!0}),n.executionQueue]}),ae.map(e=>(0,I.jsx)(`span`,{className:`rounded-full border border-edge bg-surface-muted px-2 py-0.5 text-xs text-fg-muted`,children:ie(n.queueSummary[e.key],{count:e.count})},e.key))]}),ee?(0,I.jsx)(`p`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:ee}):null,h?(0,I.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.loading}):null,(0,I.jsx)(`section`,{className:`-mx-1 min-h-0 flex-1 overflow-x-auto px-1 pb-3`,"aria-label":n.boardLabel,children:(0,I.jsx)(`div`,{className:`flex h-full min-w-max snap-x snap-mandatory gap-3`,children:R.map(e=>{let r=L.get(e)??[];return(0,I.jsxs)(`section`,{className:i(`flex h-full w-80 shrink-0 snap-center flex-col overflow-hidden rounded-2xl border bg-surface-panel/40`,A===e?`border-accent ring-1 ring-accent/30`:`border-edge`),"aria-label":n.lanes[e].title,onDragOver:t=>{t.preventDefault(),t.dataTransfer.dropEffect=`move`,j(e)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||j(null)},onDrop:t=>{t.preventDefault();let n=t.dataTransfer.getData(z)||O;n&&H(n,e)},children:[(0,I.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-2 rounded-t-2xl border-b border-edge-subtle bg-surface-panel/90 px-3.5 py-3 backdrop-blur`,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,I.jsx)(`span`,{className:`size-2 rounded-full bg-accent`,"aria-hidden":!0}),(0,I.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.lanes[e].title})]}),(0,I.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2.5 py-1 text-xs font-semibold tabular-nums text-fg-muted`,children:r.length})]}),(0,I.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto p-2.5`,children:[r.map(e=>(0,I.jsx)(fe,{goal:e,queueItem:N.get(e.id),t:n,language:t,selected:e.id===T,dragging:e.id===O,onOpen:e=>D(e.id),onDragStart:(e,t)=>{t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(z,e),k(e)},onDragEnd:()=>{k(null),j(null)}},e.id)),!h&&r.length===0?(0,I.jsx)(`div`,{className:`flex min-h-32 items-center justify-center rounded-xl border border-dashed border-edge bg-surface-panel/40 px-4 py-6 text-center text-xs text-fg-subtle`,children:n.lanes[e].empty}):null]})]},e)})})})]}),(0,I.jsx)(_e,{open:te,t:n,busy:y===`create`,onClose:()=>ne(!1),onCreate:U}),(0,I.jsx)(be,{goal:re,queueItem:re?N.get(re.id):void 0,t:n,language:t,busy:y,onClose:()=>D(null),onAction:(e,t)=>void oe(e,t)})]})}export{Se as GoalsPage};