@open-mercato/cezar 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/agent-config/catalog.d.ts +4 -0
- package/dist/agent-config/catalog.js +85 -3
- package/dist/agent-config/catalog.js.map +1 -1
- package/dist/agent-config/model-settings/copilot.d.ts +15 -0
- package/dist/agent-config/model-settings/copilot.js +25 -0
- package/dist/agent-config/model-settings/copilot.js.map +1 -0
- package/dist/agent-config/model-settings/junie.d.ts +12 -0
- package/dist/agent-config/model-settings/junie.js +18 -0
- package/dist/agent-config/model-settings/junie.js.map +1 -0
- package/dist/agent-config/models.js +4 -0
- package/dist/agent-config/models.js.map +1 -1
- package/dist/automations/prompts.d.ts +2 -2
- package/dist/automations/prompts.js +1 -1
- package/dist/automations/types.d.ts +12 -0
- package/dist/config.d.ts +4 -0
- package/dist/config.js +2 -0
- package/dist/config.js.map +1 -1
- package/dist/contract/agent-config.d.ts +4 -0
- package/dist/contract/agent-profiles.d.ts +30 -0
- package/dist/contract/automations.d.ts +32 -0
- package/dist/contract/dashboard-insights.d.ts +186 -0
- package/dist/contract/dashboard.d.ts +88 -0
- package/dist/contract/dispatch.d.ts +6 -0
- package/dist/contract/health.d.ts +8 -0
- package/dist/contract/index.d.ts +2 -0
- package/dist/contract/index.js +249 -72
- package/dist/contract/runs.d.ts +144 -0
- package/dist/contract/self-update.d.ts +111 -2
- package/dist/contract/skills.d.ts +19 -0
- package/dist/contract/star-count.d.ts +18 -0
- package/dist/contract/workflows.d.ts +12 -0
- package/dist/contract/workspace.d.ts +42 -2
- package/dist/core/acp-client.d.ts +99 -0
- package/dist/core/acp-client.js +198 -0
- package/dist/core/acp-client.js.map +1 -0
- package/dist/core/acp-ui-mapper.d.ts +95 -0
- package/dist/core/acp-ui-mapper.js +444 -0
- package/dist/core/acp-ui-mapper.js.map +1 -0
- package/dist/core/agent-env.js +10 -0
- package/dist/core/agent-env.js.map +1 -1
- package/dist/core/agent-profiles.d.ts +10 -0
- package/dist/core/agent-profiles.js +16 -0
- package/dist/core/agent-profiles.js.map +1 -1
- package/dist/core/agent-runner.d.ts +5 -3
- package/dist/core/agent-runner.js +5 -3
- package/dist/core/agent-runner.js.map +1 -1
- package/dist/core/backend-detect.d.ts +3 -3
- package/dist/core/backend-detect.js +61 -2
- package/dist/core/backend-detect.js.map +1 -1
- package/dist/core/claude-cli-runner.d.ts +5 -2
- package/dist/core/claude-cli-runner.js +11 -6
- package/dist/core/claude-cli-runner.js.map +1 -1
- package/dist/core/claude-ui-mapper.d.ts +14 -0
- package/dist/core/claude-ui-mapper.js +102 -11
- package/dist/core/claude-ui-mapper.js.map +1 -1
- package/dist/core/codex-app-server-transport.js +8 -4
- package/dist/core/codex-app-server-transport.js.map +1 -1
- package/dist/core/copilot-acp-runner.d.ts +60 -0
- package/dist/core/copilot-acp-runner.js +528 -0
- package/dist/core/copilot-acp-runner.js.map +1 -0
- package/dist/core/copilot-ui-mapper.d.ts +47 -0
- package/dist/core/copilot-ui-mapper.js +111 -0
- package/dist/core/copilot-ui-mapper.js.map +1 -0
- package/dist/core/cursor-agent-runner.js +4 -4
- package/dist/core/cursor-agent-runner.js.map +1 -1
- package/dist/core/disclaim-spawn.d.ts +9 -0
- package/dist/core/disclaim-spawn.js +53 -0
- package/dist/core/disclaim-spawn.js.map +1 -0
- package/dist/core/junie-acp-transport.d.ts +58 -0
- package/dist/core/junie-acp-transport.js +179 -0
- package/dist/core/junie-acp-transport.js.map +1 -0
- package/dist/core/junie-auth-probe.d.ts +12 -0
- package/dist/core/junie-auth-probe.js +30 -0
- package/dist/core/junie-auth-probe.js.map +1 -0
- package/dist/core/junie-model-catalog.d.ts +10 -0
- package/dist/core/junie-model-catalog.js +104 -0
- package/dist/core/junie-model-catalog.js.map +1 -0
- package/dist/core/junie-runner.d.ts +45 -0
- package/dist/core/junie-runner.js +533 -0
- package/dist/core/junie-runner.js.map +1 -0
- package/dist/core/junie-ui-mapper.d.ts +132 -0
- package/dist/core/junie-ui-mapper.js +459 -0
- package/dist/core/junie-ui-mapper.js.map +1 -0
- package/dist/core/model-identity.js +17 -0
- package/dist/core/model-identity.js.map +1 -1
- package/dist/core/model-presets.js +10 -0
- package/dist/core/model-presets.js.map +1 -1
- package/dist/core/opencode-server-runner.js +4 -4
- package/dist/core/opencode-server-runner.js.map +1 -1
- package/dist/core/pi-runner.js +4 -4
- package/dist/core/pi-runner.js.map +1 -1
- package/dist/core/provider-auth.d.ts +16 -2
- package/dist/core/provider-auth.js +113 -7
- package/dist/core/provider-auth.js.map +1 -1
- package/dist/core/runner-factory.js +6 -0
- package/dist/core/runner-factory.js.map +1 -1
- package/dist/core/runner-model-catalog.js +12 -8
- package/dist/core/runner-model-catalog.js.map +1 -1
- package/dist/core/tool-display.js +6 -1
- package/dist/core/tool-display.js.map +1 -1
- package/dist/core/ui-events.d.ts +6 -2
- package/dist/git-diff-base.js +23 -2
- package/dist/git-diff-base.js.map +1 -1
- package/dist/git-worktree.d.ts +21 -2
- package/dist/git-worktree.js +68 -5
- package/dist/git-worktree.js.map +1 -1
- package/dist/index.js +14 -4
- package/dist/index.js.map +1 -1
- package/dist/paths.js +2 -0
- package/dist/paths.js.map +1 -1
- package/dist/runs/event-history.js +3 -0
- package/dist/runs/event-history.js.map +1 -1
- package/dist/runs/store.d.ts +42 -3
- package/dist/runs/store.js +112 -6
- package/dist/runs/store.js.map +1 -1
- package/dist/self-update/checkouts.d.ts +53 -0
- package/dist/self-update/checkouts.js +268 -0
- package/dist/self-update/checkouts.js.map +1 -0
- package/dist/self-update/cli.d.ts +5 -3
- package/dist/self-update/cli.js +75 -8
- package/dist/self-update/cli.js.map +1 -1
- package/dist/self-update/layout.d.ts +33 -1
- package/dist/self-update/layout.js +102 -3
- package/dist/self-update/layout.js.map +1 -1
- package/dist/self-update/pulls.d.ts +40 -0
- package/dist/self-update/pulls.js +127 -0
- package/dist/self-update/pulls.js.map +1 -0
- package/dist/self-update/service.d.ts +26 -3
- package/dist/self-update/service.js +85 -9
- package/dist/self-update/service.js.map +1 -1
- package/dist/server/dashboard.d.ts +107 -0
- package/dist/server/dashboard.js +2 -1
- package/dist/server/dashboard.js.map +1 -1
- package/dist/server/forge/github.js +4 -1
- package/dist/server/forge/github.js.map +1 -1
- package/dist/server/fs-browse.d.ts +3 -1
- package/dist/server/fs-browse.js +27 -5
- package/dist/server/fs-browse.js.map +1 -1
- package/dist/server/open-in-app.js +2 -0
- package/dist/server/open-in-app.js.map +1 -1
- package/dist/server/provider-action-gate.js +5 -1
- package/dist/server/provider-action-gate.js.map +1 -1
- package/dist/server/server.d.ts +880 -511
- package/dist/server/server.js +40 -5
- package/dist/server/server.js.map +1 -1
- package/dist/server/star-count.d.ts +67 -0
- package/dist/server/star-count.js +186 -0
- package/dist/server/star-count.js.map +1 -0
- package/dist/skills-banner.d.ts +19 -0
- package/dist/skills-banner.js +24 -0
- package/dist/skills-banner.js.map +1 -1
- package/dist/workflows/run.d.ts +0 -2
- package/dist/workflows/run.js +45 -29
- package/dist/workflows/run.js.map +1 -1
- package/dist/workflows/types.d.ts +6 -0
- package/dist/workspace/agent-accounts.d.ts +9 -1
- package/dist/workspace/agent-accounts.js +2 -0
- package/dist/workspace/agent-accounts.js.map +1 -1
- package/dist/workspace/agent-profiles.d.ts +2 -2
- package/dist/workspace/agent-profiles.js +25 -6
- package/dist/workspace/agent-profiles.js.map +1 -1
- package/dist/workspace/config.d.ts +9 -1
- package/dist/workspace/config.js +10 -3
- package/dist/workspace/config.js.map +1 -1
- package/dist/workspace/dashboard-insights.d.ts +42 -0
- package/dist/workspace/dashboard-insights.js +220 -0
- package/dist/workspace/dashboard-insights.js.map +1 -0
- package/dist/workspace/dashboard.d.ts +71 -1
- package/dist/workspace/dashboard.js +14 -1
- package/dist/workspace/dashboard.js.map +1 -1
- package/dist/workspace/semaphore.d.ts +3 -0
- package/dist/workspace/semaphore.js +8 -1
- package/dist/workspace/semaphore.js.map +1 -1
- package/package.json +3 -3
- package/scripts/mock-claude.mjs +34 -1
- package/scripts/mock-copilot-acp.mjs +190 -0
- package/scripts/mock-junie-acp.mjs +208 -0
- package/web/dist/assets/agent-task-pickers-BeQi-UTm.js +1 -0
- package/web/dist/assets/alert-dialog-CnRAuqwb.js +1 -0
- package/web/dist/assets/arrow-down-Da0kNRNH.js +1 -0
- package/web/dist/assets/arrow-left-BIZHhBIP.js +1 -0
- package/web/dist/assets/automation-format-CfPmkcsg.js +1 -0
- package/web/dist/assets/automations-route-AMJbFP53.js +1 -0
- package/web/dist/assets/centered-state-3r2Kaar_.js +1 -0
- package/web/dist/assets/chevron-left-DLAUPC66.js +1 -0
- package/web/dist/assets/chevron-right-KVZcXiPL.js +1 -0
- package/web/dist/assets/{circle-x-C9UoMP1V.js → circle-x-C0Jm5Ppb.js} +1 -1
- package/web/dist/assets/collapsible-DG_SIWqU.js +1 -0
- package/web/dist/assets/command-Dfln3D4A.js +1 -0
- package/web/dist/assets/{commit-list-BSfPsVsu.js → commit-list-_RA72yB_.js} +1 -1
- package/web/dist/assets/compare-variants-D6Ji6od4.js +1 -0
- package/web/dist/assets/dashboard-B3-tPimG.js +44 -0
- package/web/dist/assets/dialog-CiDREdUK.js +1 -0
- package/web/dist/assets/{diff-I0xowULh.js → diff-CxdyRumG.js} +2 -2
- package/web/dist/assets/diff-controls-DqJMMV4z.js +1 -0
- package/web/dist/assets/{diff-stat-yKn7joEr.js → diff-stat-Hupj4hxh.js} +1 -1
- package/web/dist/assets/{diff-view-DjvMeW1M.js → diff-view-BBYT5k6c.js} +1 -1
- package/web/dist/assets/dist-BqMwqJFX.js +1 -0
- package/web/dist/assets/dist-DpiX6WjA.js +1 -0
- package/web/dist/assets/{download-BcgZ2yk4.js → download-BR7EN9gW.js} +1 -1
- package/web/dist/assets/dropdown-menu-Ci4HFML0.js +1 -0
- package/web/dist/assets/editable-title-DDtUgRKZ.js +1 -0
- package/web/dist/assets/{ellipsis-vertical-g4O4NlLV.js → ellipsis-vertical-DBklom4U.js} +1 -1
- package/web/dist/assets/facet-filter-CfI4QvOd.js +1 -0
- package/web/dist/assets/{file-wXNeZwi7.js → file-CZb7cKNH.js} +1 -1
- package/web/dist/assets/{file-text-DV1gE2L6.js → file-text-Dm6CrEGW.js} +1 -1
- package/web/dist/assets/{folder-wjVId5un.js → folder-zQj-FYOo.js} +1 -1
- package/web/dist/assets/{git-pull-request-BBEDdTLK.js → git-pull-request-AhwzJc7s.js} +1 -1
- package/web/dist/assets/git-toolbar-j7gKkhGL.js +1 -0
- package/web/dist/assets/github-De-DFy8s.js +1 -0
- package/web/dist/assets/{image-preview-u1f-wzxC.js → image-preview-Dd3NVB7N.js} +1 -1
- package/web/dist/assets/index-HS1hr5Sz.js +12 -0
- package/web/dist/assets/index-YwgrLyBj.css +2 -0
- package/web/dist/assets/loader-circle-sk4vKJKp.js +1 -0
- package/web/dist/assets/{markdown-Bnm47qUl.js → markdown-DjNR-1p8.js} +2 -2
- package/web/dist/assets/new-task-form-vLs2G1_z.js +1 -0
- package/web/dist/assets/picker-pill-VW-M1ZiV.js +1 -0
- package/web/dist/assets/{pill-7dm3vWF7.js → pill-CPl6sysj.js} +1 -1
- package/web/dist/assets/popover-CNGONAql.js +1 -0
- package/web/dist/assets/project-router-dCZQu1wQ.js +1 -0
- package/web/dist/assets/{prompt-templates-BMZ5q5H_.js → prompt-templates-jNjVTAws.js} +1 -1
- package/web/dist/assets/{refresh-cw-C69euZ2H.js → refresh-cw-BfkEydKA.js} +1 -1
- package/web/dist/assets/repo-git-BZWZ6_pR.js +1 -0
- package/web/dist/assets/{run-diff-CoNVGn23.js → run-diff-u_roDsAJ.js} +2 -2
- package/web/dist/assets/run-header-Br1yJR0m.js +1 -0
- package/web/dist/assets/{search-x-BNLFOxI6.js → search-x-CT0NTqK1.js} +1 -1
- package/web/dist/assets/segmented-IDD4ucht.js +1 -0
- package/web/dist/assets/skills-Dsi5YdLG.js +1 -0
- package/web/dist/assets/{sparkles-ChorK-gZ.js → sparkles-CvOeAoyJ.js} +1 -1
- package/web/dist/assets/{square-terminal-C7KCPznz.js → square-terminal-eSs8YYZe.js} +1 -1
- package/web/dist/assets/{tab-link-E5O2Cesc.js → tab-link-CPF6ORha.js} +1 -1
- package/web/dist/assets/task-changes-DIT9Y1rh.js +1 -0
- package/web/dist/assets/task-commits-B4VvdiHH.js +1 -0
- package/web/dist/assets/task-files-BMm9C0DW.js +2 -0
- package/web/dist/assets/task-thread-RXabJAt0.js +9 -0
- package/web/dist/assets/{textarea-DLAfWPb0.js → textarea-DtBqPhIs.js} +1 -1
- package/web/dist/assets/thread-loading-Dnxb6Ar-.js +1 -0
- package/web/dist/assets/toaster-CfRVb8vH.js +43 -0
- package/web/dist/assets/token-metrics-DldVlr6m.js +1 -0
- package/web/dist/assets/tooltip-_O50N3pt.js +1 -0
- package/web/dist/assets/tracker-J0fdcH1G.js +4 -0
- package/web/dist/assets/{trash-2-_vwSMdPG.js → trash-2-CUH7GOVh.js} +1 -1
- package/web/dist/assets/{triangle-alert-fBRUkB46.js → triangle-alert-D5K_zyD3.js} +1 -1
- package/web/dist/assets/{upload-B4OIpdyq.js → upload-D7_n-9cl.js} +1 -1
- package/web/dist/assets/{use-now-sqAvRMna.js → use-now-3lElDuTi.js} +1 -1
- package/web/dist/assets/utils-BXvEm7Ve.js +64 -0
- package/web/dist/assets/workflows-D-dx9c_0.js +7 -0
- package/web/dist/assets/x-kLybIvX4.js +1 -0
- package/web/dist/assets/{zoomable-image-X81SApIg.js → zoomable-image-CnyQ9wyw.js} +1 -1
- package/web/dist/index.html +38 -36
- package/web/dist/assets/agent-task-pickers-DQ1qvgrD.js +0 -1
- package/web/dist/assets/alert-dialog-B_2uU4Bg.js +0 -1
- package/web/dist/assets/arrow-down-DieVZxSE.js +0 -1
- package/web/dist/assets/arrow-left-C8M0efjn.js +0 -1
- package/web/dist/assets/automation-format-CzinzpHK.js +0 -1
- package/web/dist/assets/automations-route-DYHUjV9R.js +0 -1
- package/web/dist/assets/centered-state-DJLgwvA4.js +0 -43
- package/web/dist/assets/chevron-left-BhXrOEE3.js +0 -1
- package/web/dist/assets/chevron-right-B3Ta8VKK.js +0 -1
- package/web/dist/assets/collapsible-BcKvItwg.js +0 -1
- package/web/dist/assets/command-BvGGv2_u.js +0 -1
- package/web/dist/assets/compare-variants-DBvMYMs3.js +0 -1
- package/web/dist/assets/dashboard-CGaFh4RV.js +0 -44
- package/web/dist/assets/dialog-B6NgKh0-.js +0 -1
- package/web/dist/assets/diff-controls-DskkZqmD.js +0 -1
- package/web/dist/assets/dist-BvXEdcbG.js +0 -1
- package/web/dist/assets/dist-CTksUkKh.js +0 -1
- package/web/dist/assets/dropdown-menu-B7HeKCfN.js +0 -1
- package/web/dist/assets/editable-title-BHbHmSIK.js +0 -1
- package/web/dist/assets/facet-filter-DZ3wfvN9.js +0 -1
- package/web/dist/assets/git-toolbar-EZuX4Cuz.js +0 -1
- package/web/dist/assets/github-zcLRxv77.js +0 -1
- package/web/dist/assets/index-BrZhA4_u.css +0 -2
- package/web/dist/assets/index-CSNFuBvj.js +0 -12
- package/web/dist/assets/loader-circle-Cwgo6onL.js +0 -1
- package/web/dist/assets/new-task-form-CQODCzBP.js +0 -1
- package/web/dist/assets/picker-pill-DNB9ETjS.js +0 -1
- package/web/dist/assets/popover-BRq6QnwI.js +0 -1
- package/web/dist/assets/project-router-I8Pbsrxy.js +0 -1
- package/web/dist/assets/repo-git-G436Abni.js +0 -1
- package/web/dist/assets/run-header-CxdaA86t.js +0 -1
- package/web/dist/assets/skills-C_kBDesq.js +0 -1
- package/web/dist/assets/task-changes-Bhw4Ysvg.js +0 -1
- package/web/dist/assets/task-commits-DBuGXuGm.js +0 -1
- package/web/dist/assets/task-files-CYDbeffM.js +0 -2
- package/web/dist/assets/task-thread-RuxHMJgN.js +0 -9
- package/web/dist/assets/thread-loading-BAuVAbcA.js +0 -1
- package/web/dist/assets/token-metrics-rVl4kXe_.js +0 -1
- package/web/dist/assets/tooltip-Bdl8mQG8.js +0 -1
- package/web/dist/assets/tracker-DJ8JW59-.js +0 -4
- package/web/dist/assets/utils-DoBmOlX3.js +0 -64
- package/web/dist/assets/workflows-C54D7mlm.js +0 -7
- package/web/dist/assets/x-HXr9KZBr.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$r as r,Ai as i,Di as a,Kn as o,Oi as s,Qn as c,et as l,i as u,ri as d,rr as f,ur as p}from"./centered-state-DJLgwvA4.js";import{C as m,O as h,S as g,c as _,k as v,r as y,t as b,w as x}from"./utils-DoBmOlX3.js";import{u as S}from"./facet-filter-DZ3wfvN9.js";import{s as C}from"./project-router-I8Pbsrxy.js";var w=y(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),T=e(t(),1),E=n();function D({className:e,flush:t=!1,...n}){return(0,E.jsx)(`div`,{"data-slot":`card`,"data-flush":t?`true`:void 0,className:b(`flex flex-col rounded-lg border bg-card text-card-foreground shadow-xs`,t?`gap-0 overflow-hidden py-0`:`gap-6 py-6`,e),...n})}var O=e=>`"${e.replace(/(["\\$`!])/g,`\\$1`)}"`;function k(e){return e%3600==0?`${e/3600}h`:e%60==0?`${e/60}m`:`${e}s`}function A(e){if(e.kind===`tracker`)return!1;if(e.kind===`schedule`)return!!e.schedule;if(!e.events?.length)return!1;let t=e.filters??{};return!([`assignees`,`allLabels`,`excludeLabels`,`changedLabels`].some(e=>(t[e]?.length??0)>0)||t.lookbackDays!==void 0&&t.lookbackDays!==7||t.maxRecords!==void 0&&t.maxRecords!==25)}function j(e){let t=[`cez automation add`,`--name ${O(e.name||`untitled`)}`];if(e.kind===`schedule`&&e.schedule)t.push(`--cron ${O(m(e.schedule))}`);else{t.push(`--on ${(e.events??[]).join(`,`)}`),t.push(`--every ${k(e.intervalSeconds??300)}`);for(let n of e.filters?.anyLabels??[])t.push(`--label ${O(n)}`);for(let n of e.filters?.authors??[])t.push(`--author ${O(n)}`)}let{task:n}=e;return n.workflow&&t.push(`--workflow ${O(n.workflow)}`),n.runner&&t.push(`--runner ${O(n.runner)}`),n.model&&t.push(`--model ${O(n.model)}`),n.autonomous===!1?t.push(`--no-autonomous`):n.autonomous&&t.push(`--autonomous`),n.dispatch&&(t.push(`--dispatch`),n.dispatch.maxSubtasks!==void 0&&t.push(`--max-subtasks ${n.dispatch.maxSubtasks}`),n.dispatch.reviewChild&&t.push(`--review-child`)),e.enable&&t.push(`--enable`),t.push(`--prompt ${O(n.prompt||`…`)}`),t.join(` `)}function M(e){let t={name:e.name||`untitled`,kind:e.kind,...e.kind===`schedule`?{schedule:e.schedule}:e.kind===`tracker`?{trackerTrigger:e.trackerTrigger,intervalSeconds:e.intervalSeconds??1800,filters:{lookbackDays:7,maxRecords:25,...e.filters}}:{events:e.events,intervalSeconds:e.intervalSeconds??300,filters:{lookbackDays:7,maxRecords:25,...e.filters}},task:e.task,...e.enable?{enable:!0}:{}};return`cez automation create --json '${JSON.stringify(t).replace(/'/g,`'\\''`)}'`}function N(e){return A(e)?j(e):M(e)}var P=()=>[_(),`automations`];function F(){let e=l(),t=e.data!==void 0;return{known:t,off:t&&e.data?.capabilities?.automations!==!0}}function I(e){let t=i(),n=C(),r=s({queryKey:P(),queryFn:({signal:e})=>p({signal:e}),enabled:e});return(0,T.useEffect)(()=>S((e,r)=>{if(e!==`automation-change`)return;let i=r;typeof i.project==`string`&&(n===null||i.project===n)&&t.invalidateQueries({queryKey:P()})}),[n,t]),r}function L(e){let t=i(),n=()=>t.invalidateQueries({queryKey:P()}),s=e=>u(e instanceof Error?e.message:String(e),{tone:`danger`}),l=a({mutationFn:async e=>{e.kind===`schedule`?(await r(e.id),u(`Started "${e.name}" — the task is queued.`)):(await o(e.id,`execute`),u(`Checking events for "${e.name}" now.`))},onSuccess:()=>void n(),onError:s}),p=a({mutationFn:async e=>{await o(e.id,`preview`),u(`Preview queued for "${e.name}" — no tasks will launch. See the execution log for results.`)},onSuccess:()=>void n(),onError:s}),m=a({mutationFn:e=>d(e.id,!e.enabled),onSuccess:()=>void n(),onError:s}),h=a({mutationFn:e=>c({name:`${e.name} (copy)`,...e.description?{description:e.description}:{},kind:e.kind,...e.kind===`schedule`?{schedule:e.schedule}:e.kind===`tracker`?{trackerTrigger:e.trackerTrigger,intervalSeconds:e.intervalSeconds,filters:e.filters}:{events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters},task:e.task}),onSuccess:e=>{u(`Duplicated as "${e.automation.name}", paused.`),n()},onError:s}),g=a({mutationFn:e=>f(e.id),onSuccess:()=>void n(),onError:s});return{preview:e=>p.mutateAsync(e).then(()=>void 0,()=>void 0),runNow:e=>l.mutateAsync(e).then(()=>void 0,()=>void 0),toggleEnabled:e=>m.mutateAsync(e).then(()=>void 0,()=>void 0),duplicate:e=>h.mutateAsync(e).then(()=>void 0,()=>void 0),remove:e=>g.mutateAsync(e).then(()=>void 0,()=>void 0),copyCli:async e=>{await R(N({name:e.name,kind:e.kind,trackerTrigger:e.trackerTrigger,schedule:e.schedule,events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters,task:e.task}))},busy:p.isPending||l.isPending||m.isPending||h.isPending||g.isPending}}async function R(e){try{await navigator.clipboard.writeText(e),u(`Copied to the clipboard.`)}catch{u(`Copy failed — select the text to copy it.`,{tone:`danger`})}}function z(e){return g[((e-1)%7+7)%7]??``}function B(e,t){let n=v(typeof e==`number`?e:Date.parse(e),t);return n?`${z(n.weekday)} ${x(n.hour,n.minute)}`:``}function V(e,t){let n=v(typeof e==`number`?e:Date.parse(e),t);return n?x(n.hour,n.minute):``}function H(e,t,n=Date.now()){let r=Date.parse(e),i=v(r,t);if(!i)return``;if(n-r<6*864e5)return`${z(i.weekday)} ${x(i.hour,i.minute)}`;let a=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`][i.month-1];return`${i.day} ${a} ${x(i.hour,i.minute)}`}function U(e,t=Date.now()){let n=Math.max(0,Math.round((e-t)/6e4));return n<60?`in ${n}m`:n<1440?`in ${Math.round(n/60)}h`:`in ${Math.round(n/1440)}d`}function W(e){let t=Math.round(e/60),n=Math.floor(t/60);return n>0?`${n}h ${String(t%60).padStart(2,`0`)}m`:`${t}m`}function G(e){return e>=10?`$${e.toFixed(1)}`:`$${e.toFixed(2)}`}function K(e){switch(e){case`done`:return`success`;case`running`:case`queued`:case`waiting`:return`pending`;case`failed`:case`cancelled`:return`danger`;case`review`:return`violet`}}function q(e){switch(e){case`review`:return`needs review`;case`waiting`:return`needs you`;default:return e}}function J(e){if(e.kind===`schedule`&&e.schedule)return h(e.schedule);if(e.kind===`tracker`){let t=e.trackerTrigger,n=t?.association.kind===`jira`?`Jira`:t?.association.kind===`linear`?`Linear`:`Tracker`;return t?`${n} · ${t.events.join(`, `)}${t.targetStatusIds?.length?` → ${t.targetStatusIds.join(`, `)}`:``}${t.changedLabelIds?.length?` · labels ${t.changedLabelIds.join(`, `)}`:``} · every ${Math.round((e.intervalSeconds??1800)/60)} min`:`${n} · select an event to complete setup`}let t=(e.events??[]).join(`, `),n=Math.round((e.intervalSeconds??300)/60);return`on ${t||`github`} · every ${n} min`}function Y(e){switch(e){case`launched`:case`manual`:case`catch-up`:return`success`;case`failed`:case`error`:case`rate-limited`:return`danger`;default:return`neutral`}}export{N as _,U as a,K as c,G as d,P as f,I as g,F as h,H as i,V as l,L as m,z as n,Y as o,R as p,B as r,q as s,W as t,J as u,D as v,w as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ai as r,Di as i,Ei as a,Kt as o,Oi as s,Qn as c,Qr as l,Rn as u,Sr as d,Ti as f,Tt as p,a as m,ci as h,cr as g,en as _,et as v,i as ee,lr as y,rn as te,t as b,wi as x,wr as S}from"./centered-state-DJLgwvA4.js";import{A as C,C as ne,D as re,E as ie,S as ae,T as oe,c as w,k as T,r as E,t as D,w as O,x as se}from"./utils-DoBmOlX3.js";import{i as ce,u as k}from"./facet-filter-DZ3wfvN9.js";import{a as le,i as ue,n as de,o as fe,s as pe,t as me}from"./use-now-sqAvRMna.js";import{E as he}from"./editable-title-BHbHmSIK.js";import{t as ge}from"./arrow-left-C8M0efjn.js";import{d as A}from"./tooltip-Bdl8mQG8.js";import{_ as _e,a as ve,c as j,d as ye,f as be,g as xe,h as Se,i as Ce,l as we,m as Te,n as Ee,o as De,p as Oe,r as ke,s as Ae,t as je,u as Me,v as M,y as Ne}from"./automation-format-CzinzpHK.js";import{t as Pe}from"./chevron-left-BhXrOEE3.js";import{s as Fe}from"./popover-BRq6QnwI.js";import{t as Ie}from"./chevron-right-B3Ta8VKK.js";import{c as Le,n as Re,r as N,s as ze,t as Be}from"./dropdown-menu-B7HeKCfN.js";import{n as Ve,t as He}from"./trash-2-_vwSMdPG.js";import{c as Ue,r as P,t as We}from"./picker-pill-DNB9ETjS.js";import{t as Ge}from"./file-text-DV1gE2L6.js";import{f as Ke,m as qe,p as Je}from"./new-task-form-CQODCzBP.js";import{n as Ye,r as Xe,t as Ze}from"./collapsible-BcKvItwg.js";import{a as Qe,c as $e,i as et,n as tt,o as nt,r as rt,s as it,t as at}from"./alert-dialog-B_2uU4Bg.js";import{c as F,s as ot,t as I}from"./project-router-I8Pbsrxy.js";import{i as L}from"./token-metrics-rVl4kXe_.js";import{n as st}from"./format-DHK74MwW.js";import{s as ct}from"./skills-9oR_oHse.js";import{t as R}from"./pill-7dm3vWF7.js";import{t as lt}from"./textarea-DLAfWPb0.js";import{i as ut,o as dt,r as ft}from"./prompt-templates-BMZ5q5H_.js";import{B as z,S as B,V,Z as pt,b as H,d as mt,p as ht,q as gt,s as _t,t as vt,v as U,x as W,y as G,z as yt}from"./index-CSNFuBvj.js";var bt=E(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),xt=E(`git-fork`,[[`circle`,{cx:`12`,cy:`18`,r:`3`,key:`1mpf1b`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`path`,{d:`M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9`,key:`1uq4wg`}],[`path`,{d:`M12 12v3`,key:`158kv8`}]]),St=E(`layout-template`,[[`rect`,{width:`18`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`f1a2em`}],[`rect`,{width:`9`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`jqznyg`}],[`rect`,{width:`5`,height:`7`,x:`16`,y:`14`,rx:`1`,key:`q5h2i8`}]]),Ct=E(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),wt=E(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Tt=E(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Et=E(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),Dt=E(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),Ot=E(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),K=e(t(),1),q=n();function kt({association:e,selected:t,onSelect:n,onRemove:r}){let i=a({queryKey:[`tracker`,w(),`label-suggestions`,e],initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>S({association:e,state:`all`,limit:50,cursor:t},{signal:n}),getNextPageParam:e=>e.available&&e.truncated?e.nextCursor:void 0,retry:!1,staleTime:6e4}),o=i.data?.pages??[],s=o.at(-1),c=o.find(e=>!e.available),l=i.isError||!!c,u=[...new Set([...t,...l?[]:o.flatMap(e=>e.available?e.items.flatMap(e=>e.labels):[])])].filter(e=>t.includes(e)||e.length>0&&e.length<=200).sort((e,t)=>e.localeCompare(t));return(0,q.jsxs)(`div`,{className:`flex flex-col gap-2`,"aria-label":`Project label suggestions`,children:[(0,q.jsx)(`span`,{className:`font-medium`,children:`Required labels`}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`All selected labels must match. Leave unselected to allow any label.`}),(0,q.jsx)(`div`,{role:`group`,"aria-label":`Required labels`,className:`flex flex-wrap gap-1.5`,children:u.map(e=>(0,q.jsx)(P,{active:t.includes(e),"aria-pressed":t.includes(e),disabled:!t.includes(e)&&t.length>=100,onClick:()=>t.includes(e)?r(e):n(e),children:e},e))}),i.isFetching?(0,q.jsx)(`p`,{role:`status`,children:`Loading labels…`}):null,l?(0,q.jsxs)(`div`,{role:`alert`,children:[(0,q.jsx)(`p`,{children:`Could not load labels. Your selection is preserved.`}),(0,q.jsx)(m,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void i.refetch(),children:`Retry label suggestions`})]}):(0,q.jsxs)(q.Fragment,{children:[!i.isPending&&!i.isFetching&&u.length===0?(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No labels found in the loaded tasks.`}):null,i.hasNextPage?(0,q.jsx)(m,{type:`button`,variant:`outline`,size:`sm`,disabled:i.isFetching,onClick:()=>void i.fetchNextPage(),children:`Load labels from more tasks`}):null,!i.hasNextPage&&s?.available&&s.truncated?(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`The provider returned a limited task list.`}):null]})]})}var At=[`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`,`pull_request.reviewed`,`pull_request.review_requested`,`pull_request.rereview_requested`];function jt(e){return[{id:`task`,name:e,skill:e,prompt:`{{task}}`}]}function Mt(e){let[t,...n]=e??[];return t&&n.length===0&&t.skill&&t.prompt===`{{task}}`?t.skill:null}function Nt(e){return e.skill?{source:`skill`,ref:e.skill}:e.workflow&&e.workflow!==`quick-task`?{source:`workflow`,ref:e.workflow}:null}function Pt(e){return e?.source===`skill`?{skill:e.ref,workflow:Ke,customSteps:null}:{skill:null,workflow:e?.ref??`quick-task`,customSteps:null}}var Ft=[2,5,10,15,30,60],It=[1,2,4,6,8],Lt={authors:``,assignees:``,anyLabels:``,allLabels:``,excludeLabels:``,changedLabels:``,reviewers:``,lookbackDays:7,maxRecords:25},Rt={type:`daily`,hour:4,minute:0};function zt(){return{name:``,kind:`schedule`,schedule:{...Rt},events:[`issue.opened`],intervalSeconds:300,filters:{...Lt},prompt:``,workflow:Ke,skill:null,customSteps:null,runner:null,account:null,model:null,autonomous:!0,dispatch:!1,maxSubtasks:4,reviewChild:!0,enabled:!1}}var J=e=>(e??[]).join(`, `);function Bt(e){return e.split(`,`).map(e=>e.trim()).filter(e=>e.length>0)}function Vt(e){let t=zt(),{task:n,filters:r}=e,i=Mt(n.steps);return{...t,name:e.name,kind:e.kind,trackerTrigger:e.trackerTrigger,schedule:e.schedule?{...e.schedule}:t.schedule,events:e.events?.length?[...e.events]:t.events,intervalSeconds:e.intervalSeconds??t.intervalSeconds,filters:r?{authors:J(r.authors),assignees:J(r.assignees),anyLabels:J(r.anyLabels),allLabels:J(r.allLabels),excludeLabels:J(r.excludeLabels),changedLabels:J(r.changedLabels),reviewers:J(r.reviewers),lookbackDays:r.lookbackDays,maxRecords:r.maxRecords}:t.filters,prompt:n.prompt,workflow:n.workflow??t.workflow,skill:i,customSteps:n.steps&&!i?n.steps:null,runner:n.runner??null,account:n.agentProfile??null,model:n.model??null,autonomous:n.autonomous??!1,dispatch:n.dispatch!==void 0,maxSubtasks:n.dispatch?.maxSubtasks??t.maxSubtasks,reviewChild:n.dispatch?.reviewChild??t.reviewChild,enabled:e.enabled}}function Ht(e){return{name:e.name,kind:e.kind,...e.schedule?{schedule:e.schedule}:{},...e.events?{events:e.events}:{},...e.intervalSeconds===void 0?{}:{intervalSeconds:e.intervalSeconds},prompt:e.task.prompt,...e.task.workflow?{workflow:e.task.workflow}:{},...e.task.runner?{runner:e.task.runner}:{},...e.task.model===void 0?{}:{model:e.task.model},...e.task.autonomous===void 0?{}:{autonomous:e.task.autonomous},...e.task.dispatch?{dispatch:e.task.dispatch}:{}}}var Ut=e=>e===`claude`||e===`codex`||e===`opencode`||e===`pi`;function Wt(e,t){return{...e,name:t.name,kind:t.kind,schedule:t.schedule?{...t.schedule}:e.schedule,events:t.events?.length?[...t.events]:e.events,intervalSeconds:t.intervalSeconds??e.intervalSeconds,prompt:t.prompt,...t.workflow?Pt({source:`workflow`,ref:t.workflow}):{},runner:t.runner!==void 0&&Ut(t.runner)?t.runner:e.runner,account:t.runner!==void 0&&Ut(t.runner)?null:e.account,model:t.model??e.model,autonomous:t.autonomous??e.autonomous,dispatch:t.dispatch!==void 0,maxSubtasks:t.dispatch?.maxSubtasks??e.maxSubtasks,reviewChild:t.dispatch?.reviewChild??e.reviewChild}}function Gt(e){let t=ie(e);switch(t.type){case`hours`:return{type:`hours`,every:t.every};case`weekly`:return{type:`weekly`,hour:t.hour,minute:t.minute,day:t.day};default:return{type:t.type,hour:t.hour,minute:t.minute}}}function Kt(e){let t={prompt:e.prompt,...e.skill?{steps:jt(e.skill)}:e.customSteps?{steps:e.customSteps}:e.workflow?{workflow:e.workflow}:{},...e.runner?{runner:e.runner}:{},...e.account?{agentProfile:e.account}:{},...e.model?{model:e.model}:{},autonomous:e.autonomous,...e.dispatch?{dispatch:{maxSubtasks:e.maxSubtasks,reviewChild:e.reviewChild}}:{}};if(e.kind===`schedule`)return{name:e.name.trim(),kind:`schedule`,schedule:Gt(e.schedule),task:t};if(e.kind===`tracker`)return{name:e.name.trim(),kind:`tracker`,trackerTrigger:e.trackerTrigger,intervalSeconds:e.intervalSeconds,filters:{lookbackDays:Y(e.filters.lookbackDays,1,90),maxRecords:Y(e.filters.maxRecords,1,100)},task:t};let n=e.filters,r=(e,t)=>{let n=Bt(e);return n.length>0?{[t]:n}:{}};return{name:e.name.trim(),kind:`github`,events:[...e.events],intervalSeconds:e.intervalSeconds,filters:{...r(n.authors,`authors`),...r(n.assignees,`assignees`),...r(n.anyLabels,`anyLabels`),...r(n.allLabels,`allLabels`),...r(n.excludeLabels,`excludeLabels`),...r(n.changedLabels,`changedLabels`),...r(n.reviewers,`reviewers`),lookbackDays:Y(n.lookbackDays,1,90),maxRecords:Y(n.maxRecords,1,100)},task:t}}function Y(e,t,n){return Number.isFinite(e)?Math.min(n,Math.max(t,Math.round(e))):t}function qt(e){let t=Kt(e);return{name:t.name,kind:e.kind,...t.trackerTrigger?{trackerTrigger:t.trackerTrigger}:{},...t.schedule?{schedule:t.schedule}:{},...t.events?{events:t.events}:{},...t.intervalSeconds===void 0?{}:{intervalSeconds:t.intervalSeconds},...t.filters?{filters:t.filters}:{},task:t.task,...e.enabled?{enable:!0}:{}}}function Jt(e){return e.includes(`issue.labeled`)||e.includes(`issue.unlabeled`)}var Yt=e=>[1,2,3,4,6,8,12].includes(e);function Xt({trigger:e,intervalSeconds:t,onChange:n,onValid:r}){let[i,o]=(0,K.useState)(``),s=w(),c=a({queryKey:[`tracker`,s,`automation-options`,``],initialPageParam:void 0,queryFn:({signal:e,pageParam:t})=>d({...t?{cursor:t}:{}},{signal:e}),getNextPageParam:e=>e.available?e.nextCursor:void 0,retry:!1}),l=a({queryKey:[`tracker`,s,`automation-options`,i],enabled:!!i&&c.data?.pages[0]?.available===!0,initialPageParam:void 0,queryFn:({signal:e,pageParam:t})=>d({...i?{search:i}:{},...t?{cursor:t}:{}},{signal:e}),getNextPageParam:e=>e.available?e.nextCursor:void 0,retry:!1}),u=i?l:c,f=c.data?.pages[0],p=f?.available?f:void 0,h=!!p&&!!e&&JSON.stringify(p.association)===JSON.stringify(e.association),g=h&&!!e?.events.length&&e.events.every(e=>p?.events.includes(e))&&(e.requiredLabels?.length??0)<=100&&(e.requiredLabels??[]).every(e=>e.length>0&&e.length<=200)&&(!e.events.includes(`issue.status_changed`)||!!e.targetStatusIds?.length)&&(!(e.events.includes(`issue.labeled`)||e.events.includes(`issue.unlabeled`))||!!e.changedLabelIds?.length);(0,K.useEffect)(()=>(r(g),()=>r(!1)),[g,r]);let _=u.data?.pages.flatMap(e=>e.available?[e]:[])??[],v=[...new Map(_.flatMap(e=>e.statuses).map(e=>[e.id,e])).values()],ee=new Map((c.data?.pages.flatMap(e=>e.available?e.statuses:[])??[]).map(e=>[e.id,e.name])),y=(e?.targetStatusIds??[]).filter(e=>!v.some(t=>t.id===e)),te=[...new Map(_.flatMap(e=>e.labels).map(e=>[e.id,e])).values()],b=e?.events.includes(`issue.status_changed`),x=e?.events.some(e=>e===`issue.labeled`||e===`issue.unlabeled`),S=b&&x?`Search tracker statuses and labels`:x?`Search tracker labels`:`Search tracker statuses`;return(0,q.jsxs)(`div`,{"data-slot":`editor-tracker`,className:`flex flex-col gap-3 text-sm`,children:[c.isPending?(0,q.jsx)(`p`,{children:`Loading tracker events…`}):null,c.isError||f&&!f.available?(0,q.jsxs)(`div`,{role:`alert`,children:[(0,q.jsxs)(`p`,{children:[f&&!f.available?f.reason:`Could not load tracker events.`,` Check the project’s Issue tracker settings.`]}),(0,q.jsx)(m,{variant:`outline`,size:`sm`,onClick:()=>void c.refetch(),children:`Retry`})]}):null,p?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`p`,{children:[p.association.kind===`jira`?`Jira`:`Linear`,` · `,p.association.externalName]}),e&&!h?(0,q.jsx)(`p`,{role:`alert`,children:`The tracker connection changed. Select an event again before saving.`}):null,e?null:(0,q.jsx)(`p`,{children:`Select an event to complete this automation.`}),(0,q.jsx)(`div`,{role:`group`,"aria-label":`Tracker events`,className:`flex flex-wrap gap-1.5`,children:p.events.map(t=>(0,q.jsx)(P,{active:h&&e?.events.includes(t),"aria-pressed":h&&e?.events.includes(t),onClick:()=>{let r=h?e.events:[],i=r.includes(t)?r.filter(e=>e!==t):[...r,t],a={...h?e:{},association:p.association,events:i};t===`issue.status_changed`&&!i.includes(t)&&delete a.targetStatusIds,n({trackerTrigger:a,...h?{}:{enabled:!1}})},children:t},t))}),h&&e?(0,q.jsx)(kt,{association:p.association,selected:e.requiredLabels??[],onRemove:t=>n({trackerTrigger:{...e,requiredLabels:(e.requiredLabels??[]).filter(e=>e!==t)}}),onSelect:t=>n({trackerTrigger:{...e,requiredLabels:[...new Set([...e.requiredLabels??[],t])]}})},JSON.stringify(p.association)):null,(0,q.jsxs)(`details`,{className:`text-xs text-muted-foreground`,children:[(0,q.jsx)(`summary`,{className:`cursor-pointer`,children:`Integration details`}),(0,q.jsxs)(`div`,{className:`mt-2 flex flex-col gap-2`,children:[(0,q.jsx)(`p`,{children:`Label choices come from loaded tasks in this project, including closed tasks. Saved selections remain available.`}),p.limitations.map(e=>(0,q.jsx)(`p`,{children:e},e))]})]}),e?.events.some(e=>e!==`issue.opened`)?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(V,{"aria-label":S,placeholder:S,value:i,onChange:e=>o(e.target.value)}),u.isFetching?(0,q.jsx)(`p`,{role:`status`,children:`Searching…`}):null,u.isError||u.data?.pages[0]&&!u.data.pages[0].available?(0,q.jsxs)(`div`,{role:`alert`,children:[`Could not load search results. `,(0,q.jsx)(m,{variant:`outline`,size:`sm`,onClick:()=>void u.refetch(),children:`Retry search`})]}):null,!u.isFetching&&u.data?.pages[0]?.available&&b&&v.length===0?(0,q.jsx)(`p`,{children:`No matching statuses.`}):null,!u.isFetching&&u.data?.pages[0]?.available&&x&&te.length===0?(0,q.jsx)(`p`,{children:`No matching labels.`}):null,e.events.includes(`issue.status_changed`)?(0,q.jsxs)(`div`,{role:`group`,"aria-label":`Target statuses`,className:`flex flex-wrap gap-1.5`,children:[v.map(t=>(0,q.jsx)(P,{active:e.targetStatusIds?.includes(t.id),"aria-pressed":e.targetStatusIds?.includes(t.id),onClick:()=>{let r=e.targetStatusIds??[];n({trackerTrigger:{...e,targetStatusIds:r.includes(t.id)?r.filter(e=>e!==t.id):[...r,t.id]}})},children:t.name},t.id)),y.map(t=>(0,q.jsxs)(P,{active:!0,"aria-pressed":!0,onClick:()=>{n({trackerTrigger:{...e,targetStatusIds:(e.targetStatusIds??[]).filter(e=>e!==t)}})},children:[ee.get(t)??t,` (not in current results)`]},t))]}):null,e.events.some(e=>e===`issue.labeled`||e===`issue.unlabeled`)?(0,q.jsx)(`div`,{role:`group`,"aria-label":`Changed labels`,className:`flex flex-wrap gap-1.5`,children:te.map(t=>(0,q.jsx)(P,{active:e.changedLabelIds?.includes(t.id),"aria-pressed":e.changedLabelIds?.includes(t.id),onClick:()=>{let r=e.changedLabelIds??[];n({trackerTrigger:{...e,changedLabelIds:r.includes(t.id)?r.filter(e=>e!==t.id):[...r,t.id]}})},children:t.name},t.id))}):null,u.hasNextPage?(0,q.jsx)(m,{variant:`outline`,size:`sm`,disabled:u.isFetchingNextPage,onClick:()=>void u.fetchNextPage(),children:`Load more`}):null]}):null]}):null,(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[`Check every`,(0,q.jsxs)(U,{value:String(t/60),onValueChange:e=>n({intervalSeconds:Number(e)*60}),children:[(0,q.jsx)(W,{"aria-label":`Tracker poll interval`,className:`w-28`,children:(0,q.jsx)(B,{})}),(0,q.jsx)(G,{children:Ft.map(e=>(0,q.jsxs)(H,{value:String(e),children:[e,` min`]},e))})]})]}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Only events after enabling are eligible. Existing backlog is not launched. The workflow agent receives this project’s tracker credentials to carry out your instructions; status updates are not guaranteed by the scheduler.`})]})}function Zt({definition:e}){let t=(0,K.useMemo)(()=>_e(e),[e]);return(0,q.jsxs)(M,{flush:!0,"data-slot":`copy-as-cli`,className:`px-3.5 py-3`,children:[(0,q.jsxs)(`div`,{className:`mb-2 flex items-center`,children:[(0,q.jsx)(`span`,{className:`text-[11px] font-semibold tracking-[.05em] uppercase text-soft-foreground`,children:`Copy as CLI`}),(0,q.jsxs)(m,{variant:`ghost`,size:`sm`,className:`ml-auto h-6`,onClick:()=>void Oe(t),children:[(0,q.jsx)(Ve,{"aria-hidden":`true`,className:`size-3`}),`Copy`]})]}),(0,q.jsx)(`pre`,{className:`m-0 rounded-lg border border-border bg-card-2 px-2.5 py-2 font-mono text-[11.5px] leading-[1.6] break-words whitespace-pre-wrap text-muted-foreground`,children:t}),(0,q.jsxs)(`p`,{className:`mt-2 mb-0 text-[11.5px] leading-[1.5] text-soft-foreground`,children:[`The same definition the cockpit saves — `,(0,q.jsx)(`code`,{className:`text-[11px]`,children:`cez automation schema`}),` prints its shape.`]})]})}function Qt({available:e,enabled:t,maxSubtasks:n,reviewChild:r,onChange:i}){if(!e)return null;let a=It.includes(n)?It:[...It,n].sort((e,t)=>e-t);return(0,q.jsxs)(`div`,{"data-slot":`editor-dispatch`,"data-enabled":t?`true`:void 0,title:`Let this run start its own subtasks with cez task create — each in a worktree forked off its branch, reporting back into the parent session.`,className:`flex flex-wrap items-center gap-2.5 border-t border-border pt-3 text-[13px] text-muted-foreground`,children:[(0,q.jsxs)(z,{className:`text-[13px] font-medium text-foreground`,children:[(0,q.jsx)(xt,{"aria-hidden":`true`,className:D(`size-3.5`,t?`text-violet`:`text-soft-foreground`)}),`Dispatch`,(0,q.jsx)(mt,{"aria-label":`Dispatch`,checked:t,onCheckedChange:e=>i({dispatch:e})})]}),t?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`text-soft-foreground`,children:`·`}),(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`up to`,(0,q.jsxs)(U,{value:String(n),onValueChange:e=>i({maxSubtasks:Number(e)}),children:[(0,q.jsx)(W,{size:`sm`,"aria-label":`Max subtasks`,className:`h-7 px-2 text-[12.5px]`,children:(0,q.jsx)(B,{})}),(0,q.jsx)(G,{children:a.map(e=>(0,q.jsx)(H,{value:String(e),children:e},e))})]}),`subtasks`]}),(0,q.jsx)(`span`,{className:`text-soft-foreground`,children:`·`}),(0,q.jsxs)(z,{className:`text-[13px] font-normal text-muted-foreground`,children:[(0,q.jsx)(mt,{size:`sm`,"aria-label":`Review child`,checked:r,onCheckedChange:e=>i({reviewChild:e})}),`review child`]}),(0,q.jsxs)(`span`,{"data-slot":`editor-dispatch-hint`,className:`ml-auto text-[11.5px] whitespace-nowrap text-soft-foreground`,children:[`≤ `,n+1,` agents`]})]}):null]})}function $t({events:e,intervalSeconds:t,filters:n,onChange:r}){let[i,a]=(0,K.useState)([`authors`,`assignees`,`anyLabels`,`allLabels`,`excludeLabels`,`changedLabels`,`reviewers`].some(e=>n[e].trim().length>0)||n.lookbackDays!==7||n.maxRecords!==25),o=(e,t)=>r({filters:{...n,[e]:t}}),s=t=>{let n=e.includes(t)?e.filter(e=>e!==t):[...e,t];r({events:At.filter(e=>n.includes(e))})},c=Jt(e),l=c&&n.changedLabels.trim().length===0;return(0,q.jsxs)(`div`,{"data-slot":`editor-github`,className:`flex flex-col gap-3.5`,children:[(0,q.jsx)(`div`,{role:`group`,"aria-label":`GitHub events`,className:`flex flex-wrap gap-1.5`,children:At.map(t=>(0,q.jsx)(P,{active:e.includes(t),"aria-pressed":e.includes(t),className:`font-mono`,onClick:()=>s(t),children:t},t))}),(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-[13px] text-muted-foreground`,children:[`poll every`,(0,q.jsxs)(U,{value:String(Math.round(t/60)),onValueChange:e=>r({intervalSeconds:Number(e)*60}),children:[(0,q.jsx)(W,{size:`sm`,"aria-label":`Poll interval`,className:`text-[13px]`,children:(0,q.jsx)(B,{})}),(0,q.jsx)(G,{children:Ft.map(e=>(0,q.jsxs)(H,{value:String(e),children:[e,` min`]},e))})]}),(0,q.jsxs)(`span`,{children:[`· last `,n.lookbackDays,` days · maximum `,n.maxRecords,` records`]})]}),(0,q.jsxs)(Ze,{open:i,onOpenChange:a,children:[(0,q.jsx)(Xe,{asChild:!0,children:(0,q.jsxs)(`button`,{type:`button`,className:`inline-flex h-6 items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground`,children:[(0,q.jsx)(Fe,{"aria-hidden":`true`,className:D(`size-3 transition-transform`,i?``:`-rotate-90`)}),`Filters`,l?(0,q.jsx)(`span`,{className:`text-danger`,children:`· changed labels required`}):null]})}),(0,q.jsx)(Ye,{children:(0,q.jsxs)(`div`,{"data-slot":`editor-github-filters`,className:`grid grid-cols-1 gap-3 pt-2 sm:grid-cols-2`,children:[(0,q.jsx)(X,{id:`filter-authors`,label:`Authors`,value:n.authors,onChange:e=>o(`authors`,e)}),(0,q.jsx)(X,{id:`filter-assignees`,label:`Assignees`,value:n.assignees,onChange:e=>o(`assignees`,e)}),(0,q.jsx)(X,{id:`filter-any-labels`,label:`Any of labels`,value:n.anyLabels,onChange:e=>o(`anyLabels`,e)}),(0,q.jsx)(X,{id:`filter-all-labels`,label:`All of labels`,value:n.allLabels,onChange:e=>o(`allLabels`,e)}),(0,q.jsx)(X,{id:`filter-exclude-labels`,label:`Exclude labels`,value:n.excludeLabels,onChange:e=>o(`excludeLabels`,e)}),(0,q.jsx)(X,{id:`filter-changed-labels`,label:c?`Changed labels (required)`:`Changed labels`,value:n.changedLabels,invalid:l,onChange:e=>o(`changedLabels`,e)}),(0,q.jsx)(X,{id:`filter-reviewers`,label:`Reviewers`,value:n.reviewers,onChange:e=>o(`reviewers`,e)}),(0,q.jsx)(en,{id:`filter-lookback`,label:`Lookback days (1–90)`,value:n.lookbackDays,min:1,max:90,onChange:e=>o(`lookbackDays`,e)}),(0,q.jsx)(en,{id:`filter-max-records`,label:`Max records (1–100)`,value:n.maxRecords,min:1,max:100,onChange:e=>o(`maxRecords`,e)})]})})]})]})}function X({id:e,label:t,value:n,invalid:r=!1,onChange:i}){return(0,q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,q.jsx)(z,{htmlFor:e,className:`text-xs text-muted-foreground`,children:t}),(0,q.jsx)(V,{id:e,value:n,placeholder:`comma-separated`,"aria-invalid":r||void 0,onChange:e=>i(e.target.value),className:`h-8 text-[13px]`})]})}function en({id:e,label:t,value:n,min:r,max:i,onChange:a}){return(0,q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,q.jsx)(z,{htmlFor:e,className:`text-xs text-muted-foreground`,children:t}),(0,q.jsx)(V,{id:e,type:`number`,min:r,max:i,value:n,onChange:e=>a(Y(Number(e.target.value),r,i)),className:`h-8 w-28 font-mono text-[13px] tabular-nums`})]})}function tn({source:e,sourcesReady:t,skills:n,skillUsage:r,workflows:i,onSource:a,pick:o,onPick:s,baseBranch:c,autonomous:l,onAutonomous:u}){return(0,q.jsxs)(`div`,{"data-slot":`editor-run-as`,className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(_t,{source:e,ready:t,skills:n,skillUsage:r,workflows:i,onPick:a}),(0,q.jsx)(ht,{pick:o,onChange:s,accounts:!0}),(0,q.jsx)(We,{slot:`editor-base-pill`,ariaLabel:`Base branch`,readOnly:!0,hint:`Every run branches off the project's base branch.`,label:(0,q.jsxs)(`span`,{className:`font-mono text-[11.5px]`,children:[`base: `,c??`…`]}),value:c??``,options:[],onPick:()=>void 0}),(0,q.jsx)(`span`,{className:`flex-1`}),(0,q.jsxs)(z,{className:`text-[13px] font-medium`,children:[`Autonomous`,(0,q.jsx)(mt,{"aria-label":`Autonomous`,checked:l,onCheckedChange:u})]})]})}function nn({className:e,...t}){return(0,q.jsx)(`span`,{"data-slot":`branch-chip`,className:D(`inline-block rounded-md bg-muted px-1.5 py-0.5 font-mono text-[11.5px] leading-[1.3] font-medium whitespace-nowrap text-muted-foreground`,e),...t})}var rn=[[`daily`,`Every day`],[`weekdays`,`Weekdays`],[`weekly`,`Weekly`],[`hours`,`Every N hours`]],an=e=>String(e).padStart(2,`0`);function on({schedule:e,timeZone:t,onChange:n}){let r=ie(e),i=e=>n({...r,...e});return(0,q.jsxs)(`div`,{"data-slot":`editor-schedule`,className:`flex flex-col gap-3.5`,children:[(0,q.jsx)(`div`,{role:`group`,"aria-label":`Schedule type`,className:`flex flex-wrap gap-1.5`,children:rn.map(([e,t])=>(0,q.jsx)(P,{active:r.type===e,"aria-pressed":r.type===e,onClick:()=>i({type:e}),children:t},e))}),r.type===`weekly`?(0,q.jsx)(`div`,{role:`group`,"aria-label":`Weekday`,className:`flex flex-wrap gap-1.5`,children:ae.map((e,t)=>(0,q.jsx)(P,{active:r.day===t+1,"aria-pressed":r.day===t+1,className:`px-[9px]`,onClick:()=>i({day:t+1}),children:e},e))}):null,r.type===`hours`?(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px] text-muted-foreground`,children:[`every`,(0,q.jsxs)(U,{value:String(r.every),onValueChange:e=>{let t=Number(e);Yt(t)&&i({every:t})},children:[(0,q.jsx)(W,{size:`sm`,"aria-label":`Every N hours`,className:`text-[13px]`,children:(0,q.jsx)(B,{})}),(0,q.jsx)(G,{children:se.map(e=>(0,q.jsxs)(H,{value:String(e),children:[e,` h`]},e))})]}),`starting at 00:00`]}):(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px] text-muted-foreground`,children:[`at`,(0,q.jsx)(V,{"aria-label":`Hour`,inputMode:`numeric`,value:an(r.hour),onChange:e=>i({hour:Math.min(23,Math.max(0,Number(e.target.value)||0))}),className:`w-14 text-center font-mono`}),`:`,(0,q.jsx)(V,{"aria-label":`Minute`,inputMode:`numeric`,value:an(r.minute),onChange:e=>i({minute:Math.min(59,Math.max(0,Number(e.target.value)||0))}),className:`w-14 text-center font-mono`}),(0,q.jsx)(`span`,{className:`font-mono text-xs`,children:t})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2.5 font-mono text-xs text-soft-foreground`,children:[(0,q.jsx)(`span`,{children:`cron`}),(0,q.jsx)(nn,{"data-slot":`editor-cron`,children:ne(r)})]})]})}function sn({lastRun:e,onRunNow:t,onLog:n,busy:r=!1,now:i}){return(0,q.jsxs)(M,{flush:!0,"data-slot":`last-run-card`,className:`px-3.5 py-3`,children:[(0,q.jsx)(`div`,{className:`mb-2 text-[11px] font-semibold tracking-[.05em] uppercase text-soft-foreground`,children:`Last run`}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,q.jsx)(L,{tone:j(e.status)}),Ae(e.status),(0,q.jsx)(`span`,{className:`text-[11.5px] text-soft-foreground`,children:st(e.ts,i)}),null]}),(0,q.jsxs)(`div`,{className:`mt-2.5 flex gap-1.5`,children:[(0,q.jsxs)(m,{variant:`outline`,size:`sm`,disabled:r,onClick:t,children:[(0,q.jsx)(qe,{"aria-hidden":`true`,className:`size-3`}),`Run now`]}),n?(0,q.jsxs)(m,{variant:`ghost`,size:`sm`,onClick:n,children:[(0,q.jsx)(Et,{"aria-hidden":`true`,className:`size-3`}),`View log`]}):null]})]})}var cn=864e5;function ln({kind:e,schedule:t,intervalSeconds:n,timeZone:r,now:i}){let[a,o]=(0,K.useState)(()=>Date.now());(0,K.useEffect)(()=>{if(i!==void 0)return;let e=setInterval(()=>o(Date.now()),6e4);return()=>clearInterval(e)},[i]);let s=i??a,c=(0,K.useMemo)(()=>e===`schedule`?re(t,s,s+9*cn,r,5):[],[e,t,s,r]);return(0,q.jsxs)(M,{flush:!0,"data-slot":`next-runs-preview`,className:`pt-3 pb-2`,children:[(0,q.jsx)(`div`,{className:`px-3.5 pb-2 text-[11px] font-semibold tracking-[.05em] uppercase text-soft-foreground`,children:e===`schedule`?`Next 5 runs`:`How it polls`}),e===`schedule`?c.length===0?(0,q.jsx)(`p`,{className:`m-0 px-3.5 pb-1.5 text-[12.5px] leading-[1.5] text-muted-foreground`,children:`Nothing in the next nine days.`}):c.map(e=>(0,q.jsxs)(`div`,{"data-slot":`next-run`,className:`flex gap-2.5 px-3.5 py-[5px] text-[13px]`,children:[(0,q.jsx)(`span`,{className:`w-[82px] shrink-0 font-mono text-xs font-medium whitespace-nowrap text-foreground tabular-nums`,children:ke(e,r)}),(0,q.jsx)(`span`,{className:`text-[11.5px] whitespace-nowrap text-soft-foreground`,children:ve(e,s)})]},e)):(0,q.jsx)(`p`,{className:`m-0 px-3.5 pb-1.5 text-[12.5px] leading-[1.5] text-muted-foreground`,children:e===`tracker`?(0,q.jsxs)(q.Fragment,{children:[`Checks the project tracker every `,Math.round(n/60),` min while cezar is open. No webhook or public URL required.`]}):(0,q.jsxs)(q.Fragment,{children:[`Checks GitHub every `,Math.round(n/60),` min while cezar is open, through your `,(0,q.jsx)(`code`,{className:`text-xs`,children:`gh`}),`. No webhook or public URL required.`]})})]})}var un=[{name:`Nightly dependency bump`,when:`Every day at 04:00`,kind:`schedule`,schedule:{type:`daily`,hour:4,minute:0},prompt:`Run npm outdated, bump patch and minor versions, run the test suite, open a draft PR if anything changed.`},{name:`Triage new issues`,when:`On issue.opened · every 5 min`,kind:`github`,events:[`issue.opened`],intervalSeconds:300,prompt:`Read {{github.url}}. Label it, add a repro or a clarification request. Never close it.`},{name:`Weekly changelog draft`,when:`Fridays at 16:00`,kind:`schedule`,schedule:{type:`weekly`,day:5,hour:16,minute:0},prompt:`Collect merged PRs since last week, write CHANGELOG entries, open a draft PR.`},{name:`Stale PR nudge`,when:`Every 6 hours`,kind:`schedule`,schedule:{type:`hours`,every:6},prompt:`Comment on PRs idle for 48h with what is blocking them.`},{name:`Flaky test hunt`,when:`Tuesdays at 02:00`,kind:`schedule`,schedule:{type:`weekly`,day:2,hour:2,minute:0},prompt:`Run the suite 5×, quarantine intermittent tests, open an issue per test.`,dispatch:{maxSubtasks:8,reviewChild:!0}},{name:`Security advisories`,when:`Every day at 06:00`,kind:`schedule`,schedule:{type:`daily`,hour:6,minute:0},prompt:`Run npm audit; for each high/critical advisory open a task with the upgrade path.`}],dn=e=>[w(),`automation-templates`,e??``];function fn({onPick:e}){let[t,n]=(0,K.useState)(`builtin`),r=ot(),i=s({queryKey:dn(r),queryFn:({signal:e})=>y(r,{signal:e}),enabled:t===`mine`}),a=t===`builtin`?un.map(e=>({...e,key:e.name})):(i.data?.templates??[]).map(e=>({...Ht(e),key:`${e.project.id}:${e.id}`,when:Me(e),project:e.project.name}));return(0,q.jsxs)(M,{flush:!0,"data-slot":`template-palette`,className:`pb-3`,children:[(0,q.jsxs)(`div`,{className:`flex items-end gap-3 border-b border-border px-4 pt-2.5`,children:[(0,q.jsxs)(`div`,{role:`tablist`,"aria-label":`Template source`,className:`flex shrink-0`,children:[(0,q.jsx)(pn,{active:t===`builtin`,onClick:()=>n(`builtin`),children:`Built-in`}),(0,q.jsx)(pn,{active:t===`mine`,onClick:()=>n(`mine`),children:`From your other projects`})]}),(0,q.jsx)(`span`,{className:`ml-auto min-w-0 overflow-hidden pb-2 text-xs text-ellipsis whitespace-nowrap text-soft-foreground`,children:t===`builtin`?`Ship with cezar`:`Registered in ~/.cezar/config.json`})]}),t===`mine`&&i.isPending?(0,q.jsx)(`p`,{className:`px-4 pt-3 text-xs text-soft-foreground`,children:`Loading…`}):t===`mine`&&i.isError?(0,q.jsx)(`p`,{role:`alert`,className:`px-4 pt-3 text-xs text-danger`,children:i.error.message}):a.length===0?(0,q.jsx)(`p`,{className:`px-4 pt-3 text-xs text-soft-foreground`,children:`No automations in your other projects yet.`}):(0,q.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(240px,1fr))] gap-2.5 px-4 pt-3`,children:a.map(t=>(0,q.jsxs)(`div`,{"data-slot":`template-card`,className:`flex flex-col gap-1.5 rounded-[10px] border border-border bg-card-2 px-3 py-2.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px] font-semibold`,children:[t.kind===`github`?(0,q.jsx)(yt,{"aria-hidden":`true`,className:`size-[13px] shrink-0 text-soft-foreground`}):(0,q.jsx)(pt,{"aria-hidden":`true`,className:`size-[13px] shrink-0 text-soft-foreground`}),(0,q.jsx)(`span`,{className:`min-w-0 overflow-hidden text-ellipsis whitespace-nowrap`,children:t.name}),t.project?(0,q.jsx)(nn,{className:`ml-auto`,children:t.project}):null]}),(0,q.jsx)(`div`,{className:`font-mono text-[11.5px] text-muted-foreground`,children:t.when}),(0,q.jsx)(`div`,{className:`line-clamp-2 text-xs leading-[1.45] text-soft-foreground`,children:t.prompt}),(0,q.jsx)(m,{variant:`outline`,size:`sm`,className:`mt-0.5 self-start`,"aria-label":`Use this: ${t.name}`,onClick:()=>e(t),children:`Use this`})]},t.key))})]})}function pn({active:e,onClick:t,children:n}){return(0,q.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e,onClick:t,className:D(`-mb-px flex h-8 items-center rounded-t-md border-b-2 px-3 text-[13px] font-medium`,e?`border-foreground font-semibold text-foreground`:`border-transparent text-muted-foreground hover:bg-muted hover:text-foreground`),children:n})}function mn(e){let t=e.toLowerCase();return/\b(events?|filters?|schedule|interval|changedlabels|changed labels|lookback|maxrecords)\b/.test(t)?`when`:/\b(prompt|workflow|runner|model|dispatch)\b/.test(t)?`what`:`top`}var hn={tracker:`Implement {{tracker.key}} and prepare a pull request.`,schedule:`Describe the task the agent should do each time. Placeholders: {{date}}, {{project}}`,github:`Describe the task the agent should do for each match. Placeholders: {{github.url}}, {{github.title}}, {{github.number}}, {{github.labels}}`};function gn({data:e,automation:t,actions:n,onBack:i,onSaved:a,onLog:s}){let l=r(),d=F(),f=v(),g=_(),ee=te(),y=o(),b=p(),[x,S]=(0,K.useState)(()=>t?Vt(t):zt()),[C,ne]=(0,K.useState)(!t),[re,ie]=(0,K.useState)(!1),[ae,oe]=(0,K.useState)(!1),[w,T]=(0,K.useState)(null),[E,D]=(0,K.useState)(!1),O=(0,K.useRef)(null),se=t?.revision,ce=(0,K.useRef)(se);(0,K.useEffect)(()=>{!t||se===ce.current||(ce.current=se,S(Vt(t)),D(!1),T(null))},[t,se]);let k=e=>S(t=>({...t,...e})),le=e?.timeZone??`UTC`,ue=e?.available!==!1,de=f.data?.capabilities.dispatch===!0,fe=(0,K.useMemo)(()=>ft(dt(g.data?.promptTemplates),f.data?.capabilities),[g.data?.promptTemplates,f.data?.capabilities]),pe=ee.data?.workflows??[],me=pe.map(e=>e.name),he=y.data,A=g.data?.skillUsage,_e=(0,K.useMemo)(()=>ct(he??[],A),[he,A]),ve=y.data!==void 0&&ee.data!==void 0&&!g.isPending,j=b.data?.baseBranch??b.data?.info?.branch??void 0,ye=(0,K.useMemo)(()=>qt(x),[x]),xe=x.name.trim().length>0&&x.prompt.trim().length>0&&!ae&&(x.kind!==`tracker`||re),Se=e=>{let t=O.current,n=t?.selectionStart??x.prompt.length,r=ut(x.prompt,n,e);k({prompt:r.text}),requestAnimationFrame(()=>{t&&(t.focus(),t.setSelectionRange(r.caret,r.caret))})},Ce=async()=>{oe(!0),T(null),D(!1);try{let e=Kt(x);t?await h(t.id,{...e,enabled:x.enabled,expectedRevision:t.revision}):await c({...e,enable:x.enabled}),await l.invalidateQueries({queryKey:be()}),a()}catch(e){if(t&&e instanceof u&&e.status===409)D(!0);else{let t=e instanceof Error?e.message:String(e);T({message:t,section:e instanceof u&&e.status===400?mn(t):`top`})}}finally{oe(!1)}},we=()=>void l.invalidateQueries({queryKey:be()}),Te=t?`Save changes`:x.enabled?`Save and enable`:`Save paused`;return(0,q.jsxs)(`div`,{"data-route":`automations`,"data-slot":`automation-editor`,className:`flex min-h-full flex-col`,children:[(0,q.jsxs)(`header`,{className:`sticky top-0 z-10 flex min-h-14 shrink-0 flex-wrap items-center gap-3 border-b border-border bg-background px-5 max-md:py-2 md:h-14 md:flex-nowrap`,children:[(0,q.jsx)(m,{variant:`ghost`,size:`icon-sm`,"aria-label":`Back`,onClick:i,children:(0,q.jsx)(ge,{"aria-hidden":`true`,className:`size-[15px]`})}),(0,q.jsx)(`h1`,{className:`truncate text-base font-semibold`,children:t?`Edit automation`:`New automation`}),t?(0,q.jsx)(R,{dot:t.enabled?`success`:`neutral`,children:t.enabled?`enabled`:`paused`}):null,(0,q.jsx)(`span`,{className:`flex-1`}),t?null:(0,q.jsxs)(m,{variant:`ghost`,size:`sm`,"aria-expanded":C,"aria-label":C?`Hide templates`:`Start from a template`,onClick:()=>ne(e=>!e),children:[(0,q.jsx)(St,{"aria-hidden":`true`,className:`size-3.5`}),(0,q.jsx)(`span`,{className:`max-md:hidden`,children:C?`Hide templates`:`Start from a template`})]}),(0,q.jsx)(m,{variant:`outline`,onClick:i,children:`Cancel`}),(0,q.jsx)(m,{disabled:!xe,onClick:()=>void Ce(),children:Te})]}),(0,q.jsx)(`div`,{className:`flex justify-center p-5`,children:(0,q.jsxs)(`div`,{className:`grid w-full max-w-[1080px] grid-cols-1 items-start gap-4 lg:grid-cols-[minmax(0,1fr)_320px]`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[E?(0,q.jsxs)(`div`,{role:`alert`,"data-slot":`editor-conflict`,className:`flex flex-wrap items-center gap-3 rounded-lg border border-danger/40 bg-danger/10 px-3.5 py-2.5 text-[13px] text-foreground`,children:[`Edited elsewhere — reload to see the latest version`,(0,q.jsx)(m,{variant:`outline`,size:`sm`,className:`ml-auto`,onClick:we,children:`Reload`})]}):null,w?.section===`top`?(0,q.jsx)(vn,{children:w.message}):null,C&&!t?(0,q.jsx)(fn,{onPick:e=>{let t=e.workflow&&me.includes(e.workflow)?e.workflow:void 0;S(n=>Wt(n,{...e,workflow:t})),ne(!1)}}):null,(0,q.jsx)(_n,{title:`Name`,children:(0,q.jsx)(V,{"aria-label":`Name`,placeholder:`Nightly dependency bump`,value:x.name,onChange:e=>k({name:e.target.value}),className:`max-w-[420px] text-[15px] md:text-[15px]`})}),(0,q.jsxs)(_n,{title:`When`,children:[(0,q.jsx)(yn,{value:x.kind,editing:!!t,githubAvailable:ue,githubReason:e?.reason,onChange:e=>k({kind:e,...e===`tracker`?{intervalSeconds:1800,enabled:!1}:{}})}),x.kind===`schedule`?(0,q.jsx)(on,{schedule:x.schedule,timeZone:le,onChange:e=>k({schedule:e})}):x.kind===`tracker`?(0,q.jsx)(Xt,{trigger:x.trackerTrigger,intervalSeconds:x.intervalSeconds,onChange:k,onValid:ie}):(0,q.jsx)($t,{events:x.events,intervalSeconds:x.intervalSeconds,filters:x.filters,onChange:e=>k(e)}),w?.section===`when`?(0,q.jsx)(vn,{children:w.message}):null]}),(0,q.jsxs)(_n,{title:`What to run`,children:[(0,q.jsxs)(`div`,{"data-slot":`editor-prompt-templates`,className:`flex flex-wrap items-center gap-1.5 text-xs text-soft-foreground`,children:[(0,q.jsx)(Ge,{"aria-hidden":`true`,className:`size-3`}),`Prompt templates`,fe.map(e=>(0,q.jsx)(P,{className:`h-6 text-[11.5px]`,title:e.text,onClick:()=>Se(e.text),children:e.label},e.id)),(0,q.jsx)(P,{dashed:!0,className:`h-6 text-[11.5px]`,icon:(0,q.jsx)(Dt,{"aria-hidden":`true`,className:`size-3`}),onClick:()=>d(vt(`project`,`prompt-templates`)),children:`Manage…`})]}),(0,q.jsx)(lt,{ref:O,"aria-label":`Prompt`,rows:5,placeholder:hn[x.kind],value:x.prompt,onChange:e=>k({prompt:e.target.value}),className:`min-h-[104px] text-sm leading-[1.55] md:text-sm`}),(0,q.jsx)(tn,{source:Nt(x),sourcesReady:ve,skills:_e,skillUsage:A,workflows:pe,onSource:e=>k(Pt(e)),pick:{runner:x.runner,model:x.model,account:x.account},onPick:e=>k({runner:e.runner,model:e.model,account:e.account}),baseBranch:j,autonomous:x.autonomous,onAutonomous:e=>k({autonomous:e})}),(0,q.jsx)(`p`,{className:`m-0 text-xs leading-[1.5] text-soft-foreground`,children:`Each run is an ordinary cezar task in its own worktree — it queues behind the parallel cap like anything else and never auto-merges.`}),(0,q.jsx)(Qt,{available:de,enabled:x.dispatch,maxSubtasks:x.maxSubtasks,reviewChild:x.reviewChild,onChange:e=>k(e)}),w?.section===`what`?(0,q.jsx)(vn,{children:w.message}):null]}),(0,q.jsx)(_n,{title:`Enable`,children:(0,q.jsxs)(z,{className:`text-[13px] font-medium`,children:[(0,q.jsx)(mt,{"aria-label":`Enabled`,checked:x.enabled,onCheckedChange:e=>k({enabled:e})}),`Enabled`,x.kind===`schedule`?null:(0,q.jsx)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:`— from a current-time baseline; existing matches will not launch`})]})})]}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-3 lg:sticky lg:top-[76px]`,children:[(0,q.jsx)(ln,{kind:x.kind,schedule:x.schedule,intervalSeconds:x.intervalSeconds,timeZone:le}),(0,q.jsx)(Zt,{definition:ye}),t&&t.kind!==`schedule`&&n?(0,q.jsx)(m,{variant:`outline`,disabled:n.busy,onClick:()=>void n.preview(t),children:`Preview saved matches`}):null,t?.lastRun?(0,q.jsx)(sn,{lastRun:t.lastRun,busy:n?.busy,onRunNow:()=>void n?.runNow(t),onLog:s}):null]})]})})]})}function _n({title:e,children:t}){return(0,q.jsxs)(M,{"data-slot":`editor-section`,className:`gap-0 px-6 py-0`,children:[(0,q.jsx)(`div`,{className:`pt-4 pb-1 text-sm font-semibold`,children:e}),(0,q.jsx)(`div`,{className:`flex flex-col gap-3.5 pt-2.5 pb-5`,children:t})]})}function vn({children:e}){return(0,q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-md border border-danger/40 bg-danger/10 px-3 py-2 text-[12.5px] text-danger`,children:e})}function yn({value:e,editing:t,githubAvailable:n,githubReason:r,onChange:i}){let a=`Change the kind by creating a new automation`;return(0,q.jsx)(`div`,{"data-slot":`editor-kind`,role:`group`,"aria-label":`Trigger`,className:`inline-flex flex-wrap gap-0.5 self-start rounded-md bg-muted p-[3px]`,children:[{value:`schedule`,label:`On a schedule`,disabled:t&&e!==`schedule`,...t&&e!==`schedule`?{title:a}:{}},{value:`github`,label:`When GitHub changes`,disabled:!n||t&&e!==`github`,...n?t&&e!==`github`?{title:a}:{}:{title:r??`GitHub is unavailable`}},{value:`tracker`,label:`When Jira / Linear changes`,disabled:t&&e!==`tracker`,...t&&e!==`tracker`?{title:a}:{}}].map(t=>(0,q.jsx)(`button`,{type:`button`,"data-value":t.value,"aria-pressed":t.value===e,disabled:t.disabled,title:t.title,onClick:()=>{t.value!==e&&i(t.value)},className:D(`flex h-7 items-center justify-center gap-1.5 rounded-[7px] px-3 text-[12.5px] font-medium whitespace-nowrap text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50`,t.value===e&&`bg-card font-semibold text-foreground shadow-xs`),children:t.label},t.value))})}function bn({automationId:e,automation:t,timeZone:n,onBack:a}){let o=F(),c=r(),u=w(),d=(0,K.useMemo)(()=>[u,`automation-log`,e],[u,e]),f=s({queryKey:d,queryFn:({signal:t})=>g(e,{signal:t})}),[p,h]=(0,K.useState)(`all`),[_,v]=(0,K.useState)(`all`);(0,K.useEffect)(()=>k((t,n)=>{t===`automation-change`&&n.automationId===e&&c.invalidateQueries({queryKey:d})}),[e,c,d]);let y=i({mutationFn:e=>l(e),onSuccess:()=>c.invalidateQueries({queryKey:d}),onError:e=>ee(e instanceof Error?e.message:String(e),{tone:`danger`})}),te=n??`UTC`,b=f.data?.records.filter(e=>(p===`all`||e.result===p)&&(_===`all`||e.event===_));return(0,q.jsxs)(`div`,{"data-route":`automations`,"data-slot":`automation-log`,className:`flex min-h-full flex-col`,children:[(0,q.jsxs)(`header`,{className:`sticky top-0 z-10 flex h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5`,children:[(0,q.jsx)(m,{variant:`ghost`,size:`icon-sm`,"aria-label":`Back`,onClick:a,children:(0,q.jsx)(ge,{className:`size-[15px]`})}),(0,q.jsx)(`h1`,{className:`m-0 text-base font-semibold`,children:t?t.name:`Automation`}),(0,q.jsx)(`span`,{className:`text-[13px] text-muted-foreground`,children:`· execution log`}),(0,q.jsxs)(`div`,{className:`flex flex-1 items-center justify-end gap-2`,children:[(0,q.jsxs)(U,{value:p,onValueChange:e=>h(e),children:[(0,q.jsx)(W,{size:`sm`,"aria-label":`Filter by result`,className:`text-[12.5px]`,children:(0,q.jsx)(B,{placeholder:`All results`})}),(0,q.jsxs)(G,{children:[(0,q.jsx)(H,{value:`all`,children:`All results`}),xn.map(e=>(0,q.jsx)(H,{value:e,children:e},e))]})]}),(0,q.jsxs)(U,{value:_,onValueChange:e=>v(e),children:[(0,q.jsx)(W,{size:`sm`,"aria-label":`Filter by event`,className:`text-[12.5px]`,children:(0,q.jsx)(B,{placeholder:`All events`})}),(0,q.jsxs)(G,{children:[(0,q.jsx)(H,{value:`all`,children:`All events`}),Sn.map(e=>(0,q.jsx)(H,{value:e,children:e},e))]})]})]}),(0,q.jsxs)(m,{variant:`outline`,size:`sm`,onClick:()=>o(`/automations/${encodeURIComponent(e)}`),children:[(0,q.jsx)(he,{className:`size-[13px]`}),`Edit`]})]}),(0,q.jsx)(`div`,{className:`flex justify-center p-5`,children:f.isError?(0,q.jsx)(`div`,{className:`w-full max-w-[820px]`,children:(0,q.jsx)($,{text:f.error instanceof Error?f.error.message:String(f.error)})}):b===void 0?(0,q.jsx)(`div`,{className:`w-full max-w-[820px]`,children:(0,q.jsx)($,{text:`Loading execution log…`})}):b.length===0?(0,q.jsx)(`div`,{className:`w-full max-w-[820px]`,children:(0,q.jsx)($,{text:`No checks have run yet.`})}):(0,q.jsx)(M,{flush:!0,className:`w-full max-w-[820px]`,children:b.map((e,t)=>(0,q.jsx)(wn,{record:e,run:e.runId===void 0?void 0:f.data?.runs[e.runId],last:t===b.length-1,timeZone:te,retrying:y.isPending&&y.variables===e.receiptId,onRetry:e=>y.mutate(e)},e.seq))})})]})}var xn=[`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`manual`,`catch-up`,`skipped`,`failed`],Sn=[`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`,`pull_request.reviewed`,`pull_request.review_requested`,`pull_request.rereview_requested`];function Cn(e){return e.result===`failed`&&e.runId===void 0?e.receiptId:void 0}function wn({record:e,run:t,last:n,timeZone:r,retrying:i,onRetry:a}){let o=De(e.result),s=t?.children??[],c=Cn(e);return(0,q.jsxs)(`div`,{"data-slot":`log-row`,"data-result":e.result,className:`grid grid-cols-[90px_110px_1fr_auto] items-center gap-x-3 gap-y-2 px-4 py-3 text-[13px] ${n?``:`border-b border-border`}`,children:[(0,q.jsx)(`span`,{className:`font-mono text-xs font-medium text-muted-foreground tabular-nums`,children:Ce(e.ts,r)}),(0,q.jsx)(R,{dot:o,className:`w-fit`,children:e.result}),(0,q.jsx)(`span`,{className:`overflow-hidden text-ellipsis whitespace-nowrap ${o===`danger`?`text-danger`:`text-muted-foreground`}`,title:e.reason,children:e.reason??``}),null,e.runId===void 0?c===void 0?(0,q.jsx)(`span`,{}):(0,q.jsxs)(m,{variant:`ghost`,size:`sm`,disabled:i,onClick:()=>a(c),children:[(0,q.jsx)(Tt,{className:`size-3`}),`Retry task`]}):(0,q.jsx)(m,{variant:`ghost`,size:`sm`,asChild:!0,children:(0,q.jsxs)(I,{to:`/tasks/${encodeURIComponent(e.runId)}`,children:[`Open task`,(0,q.jsx)(A,{className:`size-3`})]})}),s.length>0?(0,q.jsx)(`div`,{className:`col-span-full flex flex-col gap-1 pl-3.5`,children:s.map(e=>(0,q.jsxs)(`div`,{"data-slot":`log-child`,className:`grid grid-cols-[14px_70px_1fr_auto] items-center gap-2.5 text-[12.5px]`,children:[(0,q.jsx)(`span`,{className:`font-mono text-[11px] text-soft-foreground`,children:`└`}),(0,q.jsx)(`span`,{className:`w-fit rounded-full bg-muted px-1.5 py-px text-[10.5px] font-medium text-muted-foreground`,children:e.kind??`implement`}),(0,q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(L,{tone:j(e.status)}),(0,q.jsx)(`span`,{className:`overflow-hidden text-ellipsis whitespace-nowrap`,children:e.title})]}),null,(0,q.jsx)(m,{variant:`ghost`,size:`sm`,className:`h-6`,asChild:!0,children:(0,q.jsxs)(I,{to:`/tasks/${encodeURIComponent(e.runId)}`,children:[`Open`,(0,q.jsx)(A,{className:`size-[11px]`})]})})]},e.runId))}):null]})}function Tn({automation:e,actions:t}){let n=F(),[r,i]=(0,K.useState)(!1),a=e=>e.stopPropagation(),o=`/automations/${encodeURIComponent(e.id)}`;return(0,q.jsxs)(`span`,{"data-slot":`row-actions`,className:`inline-flex gap-0.5`,onClick:a,children:[e.kind===`schedule`?null:(0,q.jsx)(m,{variant:`ghost`,size:`icon-sm`,title:`Preview matches`,"aria-label":`Preview matches`,disabled:t.busy,onClick:()=>void t.preview(e),children:(0,q.jsx)(Ue,{className:`size-[13px]`})}),(0,q.jsx)(m,{variant:`ghost`,size:`icon-sm`,title:`Run now`,"aria-label":`Run now`,disabled:t.busy,onClick:()=>void t.runNow(e),children:(0,q.jsx)(qe,{className:`size-[13px]`})}),(0,q.jsx)(m,{variant:`ghost`,size:`icon-sm`,title:e.enabled?`Pause`:`Enable`,"aria-label":e.enabled?`Pause`:`Enable`,disabled:t.busy,onClick:()=>void t.toggleEnabled(e),children:e.enabled?(0,q.jsx)(Ct,{className:`size-[13px]`}):(0,q.jsx)(wt,{className:`size-[13px]`})}),(0,q.jsxs)(Be,{children:[(0,q.jsx)(Le,{asChild:!0,children:(0,q.jsx)(m,{variant:`ghost`,size:`icon-sm`,"aria-label":`More`,children:(0,q.jsx)(bt,{className:`size-3.5`})})}),(0,q.jsxs)(Re,{align:`end`,className:`w-[200px]`,onClick:a,children:[(0,q.jsxs)(N,{onSelect:()=>n(o),children:[(0,q.jsx)(he,{}),`Edit`]}),(0,q.jsxs)(N,{onSelect:()=>n(`${o}/log`),children:[(0,q.jsx)(Et,{}),`View log`]}),(0,q.jsxs)(N,{onSelect:()=>void t.duplicate(e),children:[(0,q.jsx)(Ve,{}),`Duplicate`]}),(0,q.jsxs)(N,{onSelect:()=>void t.copyCli(e),children:[(0,q.jsx)(Ot,{}),`Copy as CLI`]}),(0,q.jsx)(ze,{}),(0,q.jsxs)(N,{variant:`destructive`,onSelect:()=>i(!0),children:[(0,q.jsx)(He,{}),`Delete`]})]})]}),(0,q.jsx)(at,{open:r,onOpenChange:i,children:(0,q.jsxs)(et,{onClick:a,children:[(0,q.jsxs)(it,{children:[(0,q.jsxs)($e,{children:[`Delete “`,e.name,`”?`]}),(0,q.jsx)(Qe,{children:`The automation is removed for good. Tasks it already launched and its execution log stay.`})]}),(0,q.jsxs)(nt,{children:[(0,q.jsx)(rt,{children:`Cancel`}),(0,q.jsx)(tt,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>void t.remove(e),children:`Delete`})]})]})})]})}var Z=`h-[38px] border-b border-border px-[10px] text-left text-[11px] leading-none font-semibold tracking-[.05em] whitespace-nowrap text-soft-foreground uppercase`,Q=`h-12 border-b border-border px-[10px] text-[13px] leading-none whitespace-nowrap`,En=`cz-auto-wide max-[1280px]:hidden`,Dn=(0,q.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`});function On({data:e,actions:t,now:n=Date.now()}){return(0,q.jsx)(M,{flush:!0,"data-slot":`automations-table`,className:`min-w-0 overflow-x-auto`,children:(0,q.jsxs)(`table`,{className:`w-full border-collapse [&_tbody_tr:last-child>td]:border-b-0`,children:[(0,q.jsx)(`thead`,{children:(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`th`,{className:D(Z,`pl-4`),children:`State`}),(0,q.jsx)(`th`,{className:Z,children:`Automation`}),(0,q.jsx)(`th`,{className:Z,children:`Trigger`}),(0,q.jsx)(`th`,{className:D(Z,En),children:`Runs as`}),(0,q.jsx)(`th`,{className:Z,children:`Next run`}),(0,q.jsx)(`th`,{className:Z,children:`Last run`}),(0,q.jsx)(`th`,{className:D(Z,En,`text-right`),children:`Runs 7d`}),null,(0,q.jsx)(`th`,{className:D(Z,`pr-4`)})]})}),(0,q.jsx)(`tbody`,{children:e.automations.map(r=>(0,q.jsx)(kn,{automation:r,actions:t,timeZone:e.timeZone,available:e.available,showCost:!1,now:n},r.id))})]})})}function kn({automation:e,actions:t,timeZone:n,available:r,showCost:i,now:a}){let o=F(),s=e.kind===`github`,c=s&&!r,l=e.task.dispatch,u=Me(e),d=[e.task.workflow,e.task.runner].filter(Boolean);return(0,q.jsxs)(`tr`,{"data-slot":`automation-row`,"data-automation":e.id,"data-enabled":e.enabled?`true`:`false`,className:D(`cursor-pointer hover:bg-muted`,!e.enabled&&`opacity-60`),onClick:()=>o(`/automations/${encodeURIComponent(e.id)}`),children:[(0,q.jsx)(`td`,{className:D(Q,`pl-4`),children:c?(0,q.jsx)(R,{dot:`neutral`,children:`paused by capability`}):(0,q.jsx)(R,{dot:e.enabled?`success`:`neutral`,pulse:e.enabled&&s,children:e.enabled?`enabled`:`paused`})}),(0,q.jsx)(`td`,{className:D(Q,`max-w-0 min-w-[200px]`),children:(0,q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[s?(0,q.jsx)(yt,{className:`size-3.5 shrink-0 text-soft-foreground`}):e.kind===`tracker`?(0,q.jsx)(Je,{className:`size-3.5 shrink-0 text-soft-foreground`}):(0,q.jsx)(pt,{className:`size-3.5 shrink-0 text-soft-foreground`}),(0,q.jsx)(`span`,{className:`overflow-hidden text-[13px] font-medium text-ellipsis whitespace-nowrap`,children:e.name}),l?(0,q.jsxs)(`span`,{"data-slot":`dispatch-badge`,title:`dispatch · up to ${l.maxSubtasks??1} subtasks`,className:`inline-flex shrink-0 items-center gap-[3px] rounded-full bg-muted px-1.5 py-px text-[10.5px] font-medium text-muted-foreground`,children:[(0,q.jsx)(xt,{className:`size-2.5`}),`×`,l.maxSubtasks??1]}):null]})}),(0,q.jsx)(`td`,{className:D(Q,`max-w-[260px] overflow-hidden font-mono text-xs text-ellipsis text-muted-foreground`),title:u,children:u}),(0,q.jsx)(`td`,{className:D(Q,En,`text-xs text-muted-foreground`),children:d.length?(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[d.map((e,t)=>(0,q.jsxs)(`span`,{className:`contents`,children:[t>0?(0,q.jsx)(`span`,{className:`text-soft-foreground`,children:`·`}):null,e]},e)),e.task.autonomous?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`text-soft-foreground`,children:`·`}),(0,q.jsx)(`span`,{title:`autonomous`,"data-slot":`autonomous-mark`,className:`inline-flex`,children:(0,q.jsx)(Je,{"aria-hidden":`true`,className:`size-[11px] text-soft-foreground`})})]}):null]}):Dn}),(0,q.jsx)(`td`,{"data-slot":`next-run`,className:D(Q,`font-mono text-xs tabular-nums`,e.enabled?`text-foreground`:`text-soft-foreground`),children:An(e,n,a)}),(0,q.jsx)(`td`,{className:Q,children:e.lastRun?(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,q.jsx)(L,{tone:j(e.lastRun.status)}),(0,q.jsx)(`span`,{className:`text-[12.5px] text-muted-foreground`,children:Ae(e.lastRun.status)}),(0,q.jsx)(`span`,{className:`text-[11.5px] text-soft-foreground`,children:st(e.lastRun.ts,a)}),(0,q.jsxs)(I,{to:`/tasks/${encodeURIComponent(e.lastRun.runId)}`,"data-slot":`task-link`,onClick:e=>e.stopPropagation(),className:`inline-flex items-center gap-0.5 rounded-full border border-violet/40 px-1.5 py-px font-mono text-[10.5px] font-semibold text-violet`,children:[`task`,(0,q.jsx)(A,{className:`size-[9px]`})]})]}):Dn}),(0,q.jsx)(`td`,{className:D(Q,En,`text-right font-mono text-xs text-muted-foreground tabular-nums`),children:e.runs7d}),i?(0,q.jsx)(`td`,{className:D(Q,En,`text-right font-mono text-xs text-muted-foreground tabular-nums`),children:e.costUsd7d===void 0?Dn:ye(e.costUsd7d)}):null,(0,q.jsx)(`td`,{className:D(Q,`pr-3 text-right`),children:(0,q.jsx)(Tn,{automation:e,actions:t})})]})}function An(e,t,n){if(!e.enabled)return`—`;if(e.kind!==`schedule`)return`continuous`;if(e.nextRunAt)return ke(e.nextRunAt,t)||`—`;let r=e.schedule?oe(e.schedule,n,t):null;return r===null?`—`:ke(r,t)||`—`}function jn(e){return e.hour*60+e.minute}function Mn(e,t,n=0){let r=T(e,t);if(!r)return null;let i=new Date(Date.UTC(r.year,r.month-1,r.day+n));return C(i.getUTCFullYear(),i.getUTCMonth()+1,i.getUTCDate(),0,0,t)}function Nn(e,t,n,r){let i=[];for(let a of e)if(!(a.kind!==`schedule`||!a.schedule))for(let e of re(a.schedule,t,n,r)){let t=T(e,r);t&&i.push({automation:a,at:e,parts:t})}return i.sort((e,t)=>e.at-t.at)}function Pn(e){let t=new Map;return e.map(e=>{let n=jn(e.parts),r=t.get(n)??0;return t.set(n,r+1),{occurrence:e,stack:r}})}function Fn({automation:e,minute:t,stack:n=0,wide:r=!1}){let i=F(),a=O(Math.floor(t/60),t%60),o=[e.task.workflow,e.task.runner].filter(Boolean).join(` · `);return(0,q.jsxs)(`button`,{type:`button`,"data-slot":`event-block`,"data-automation":e.id,"data-enabled":e.enabled?`true`:`false`,title:`${e.name} · ${a}`,onClick:()=>i(`/automations/${encodeURIComponent(e.id)}`),className:D(`absolute right-[3px] left-[3px] flex cursor-pointer overflow-hidden rounded-[6px] border border-border bg-card text-left text-[11.5px] leading-[1.3] font-medium text-foreground shadow-xs`,r?`h-12 flex-col items-start gap-[3px] px-2 py-[5px]`:`h-6 flex-row items-center gap-1.5 px-1.5`,!e.enabled&&`opacity-50`),style:{top:t/60*34+1+26*n},children:[(0,q.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1.5`,children:[(0,q.jsx)(L,{tone:e.task.runner===`codex`?`violet`:`success`}),(0,q.jsx)(`span`,{className:`overflow-hidden text-ellipsis whitespace-nowrap`,children:e.name})]}),r?(0,q.jsxs)(`span`,{className:`max-w-full overflow-hidden font-mono text-[10.5px] leading-[1.3] font-normal text-ellipsis whitespace-nowrap text-muted-foreground`,children:[a,o?` · ${o}`:``]}):null]})}function In(){return(0,q.jsx)(`div`,{"data-slot":`hour-gutter`,className:`w-12 shrink-0`,children:Array.from({length:24},(e,t)=>(0,q.jsx)(`div`,{className:`-translate-y-[6px] pr-2 text-right font-mono text-[10.5px] text-soft-foreground`,style:{height:34},children:t?O(t):``},t))})}function Ln({minute:e}){return(0,q.jsx)(`div`,{"aria-hidden":`true`,"data-slot":`now-line`,className:`absolute inset-x-0 z-[2] h-[2px] bg-primary`,style:{top:e/60*34},children:(0,q.jsx)(`span`,{className:`absolute -top-[3px] -left-[3px] size-[8px] rounded-full bg-primary`})})}function Rn(){return(0,q.jsx)(q.Fragment,{children:Array.from({length:24},(e,t)=>(0,q.jsx)(`div`,{"aria-hidden":`true`,className:`absolute inset-x-0 h-px bg-border`,style:{top:t*34}},t))})}function zn({automations:e}){let t=e.filter(e=>e.kind===`github`&&e.enabled);return t.length?(0,q.jsxs)(`div`,{"data-slot":`poll-band`,className:`grid grid-cols-[48px_minmax(0,1fr)] border-b border-border`,children:[(0,q.jsx)(`div`,{className:`py-2 pr-2 text-right font-mono text-[10.5px] text-soft-foreground`,children:`poll`}),(0,q.jsx)(`div`,{className:`flex flex-col gap-1 border-l border-border px-2 py-1.5`,children:t.map(e=>(0,q.jsxs)(`div`,{"data-slot":`poll-row`,className:`flex h-[22px] min-w-0 items-center gap-2 overflow-hidden rounded-[6px] border border-violet/25 bg-violet/8 px-2 text-[11.5px] font-medium`,children:[(0,q.jsx)(yt,{className:`size-3 shrink-0 text-violet`}),(0,q.jsx)(`span`,{className:`overflow-hidden text-ellipsis whitespace-nowrap`,children:e.name}),(0,q.jsx)(`span`,{className:`overflow-hidden font-mono text-[10.5px] font-normal text-ellipsis whitespace-nowrap text-muted-foreground`,children:Me(e)}),(0,q.jsxs)(`span`,{className:`ml-auto shrink-0 font-mono text-[10.5px] font-normal whitespace-nowrap text-soft-foreground`,children:[e.runs7d,` runs`]})]},e.id))})]}):null}var Bn=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function Vn({data:e}){let t=me(6e4),n=F(),[r,i]=(0,K.useState)(0),a=e.timeZone,o=Mn(t,a,r),s=Mn(t,a,r+1),c=o===null?null:T(o,a),l=T(t,a);if(o===null||s===null||!c||!l)return(0,q.jsx)(`div`,{"data-slot":`day-view`,className:`p-5`,children:(0,q.jsxs)(`p`,{className:`rounded-xl border border-dashed p-8 text-center text-sm text-muted-foreground`,children:[`Cannot draw the day: unknown time zone “`,a,`”.`]})});let u=r===0,d=Pn(Nn(e.automations,o,s,a)),f=e.automations.filter(e=>e.kind===`github`&&e.enabled),p=`${Ee(c.weekday)} ${c.day} ${Bn[c.month-1]??``}`;return(0,q.jsxs)(`div`,{"data-slot":`day-view`,className:`grid grid-cols-[minmax(0,1fr)_320px] items-start gap-4 p-5 max-md:grid-cols-1`,children:[(0,q.jsxs)(M,{flush:!0,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3.5 py-2.5`,children:[(0,q.jsx)(m,{variant:`ghost`,size:`icon-sm`,"aria-label":`Previous day`,onClick:()=>i(e=>e-1),children:(0,q.jsx)(Pe,{className:`size-3.5`})}),(0,q.jsx)(m,{variant:`ghost`,size:`icon-sm`,"aria-label":`Next day`,onClick:()=>i(e=>e+1),children:(0,q.jsx)(Ie,{className:`size-3.5`})}),(0,q.jsx)(`span`,{"data-slot":`day-title`,className:`text-sm font-semibold whitespace-nowrap`,children:p}),u?(0,q.jsx)(R,{dot:`success`,children:`today`}):null,(0,q.jsxs)(`span`,{className:`ml-auto text-xs whitespace-nowrap text-muted-foreground`,children:[d.length,` scheduled runs`,f.length?` · ${f.length} GitHub poll${f.length===1?``:`s`}`:``]})]}),(0,q.jsx)(zn,{automations:e.automations}),(0,q.jsxs)(`div`,{className:`flex max-h-[600px] overflow-y-auto`,children:[(0,q.jsx)(In,{}),(0,q.jsxs)(`div`,{"data-slot":`day-column`,"data-today":u?`true`:void 0,className:`relative flex-1 border-l border-border`,style:{height:816},children:[(0,q.jsx)(Rn,{}),u?(0,q.jsx)(Ln,{minute:jn(l)}):null,d.map(({occurrence:e,stack:t})=>(0,q.jsx)(Fn,{automation:e.automation,minute:jn(e.parts),stack:t,wide:!0},`${e.automation.id}-${e.at}`))]})]})]}),(0,q.jsxs)(M,{flush:!0,"data-slot":`agenda`,className:`py-3`,children:[(0,q.jsx)(`div`,{className:`px-3.5 pb-2 text-[11px] font-semibold tracking-[.05em] text-soft-foreground uppercase`,children:`Agenda`}),f.map(e=>(0,q.jsxs)(`button`,{type:`button`,"data-slot":`agenda-poll`,onClick:()=>n(`/automations/${encodeURIComponent(e.id)}`),className:`grid w-full cursor-pointer grid-cols-[48px_1fr] gap-2.5 px-3.5 py-2 text-left hover:bg-muted`,children:[(0,q.jsx)(`span`,{className:`font-mono text-[10.5px] font-medium text-soft-foreground`,children:`poll`}),(0,q.jsxs)(`span`,{className:`min-w-0`,children:[(0,q.jsxs)(`span`,{className:`flex items-center gap-2 text-[13px] font-medium`,children:[(0,q.jsx)(yt,{className:`size-3 shrink-0 text-violet`}),(0,q.jsx)(`span`,{className:`overflow-hidden text-ellipsis whitespace-nowrap`,children:e.name})]}),(0,q.jsxs)(`span`,{className:`mt-0.5 block overflow-hidden font-mono text-[11.5px] leading-[1.4] text-ellipsis whitespace-nowrap text-soft-foreground`,children:[Me(e),` · continuous`]})]})]},e.id)),d.map(({occurrence:e})=>{let r=e.at<t,{automation:i}=e;return(0,q.jsxs)(`button`,{type:`button`,"data-slot":`agenda-row`,"data-past":r?`true`:`false`,onClick:()=>n(`/automations/${encodeURIComponent(i.id)}`),className:`grid w-full cursor-pointer grid-cols-[48px_1fr] gap-2.5 px-3.5 py-2 text-left hover:bg-muted`,children:[(0,q.jsx)(`span`,{className:D(`font-mono text-xs font-medium tabular-nums`,r?`text-soft-foreground`:`text-foreground`),children:O(e.parts.hour,e.parts.minute)}),(0,q.jsxs)(`span`,{className:`min-w-0`,children:[(0,q.jsxs)(`span`,{className:D(`flex items-center gap-2 text-[13px] font-medium`,r&&`text-muted-foreground`),children:[(0,q.jsx)(L,{tone:r&&i.lastRun?j(i.lastRun.status):`neutral`}),(0,q.jsx)(`span`,{className:`overflow-hidden text-ellipsis whitespace-nowrap`,children:i.name})]}),(0,q.jsx)(`span`,{className:`mt-0.5 block overflow-hidden text-[11.5px] leading-[1.4] text-ellipsis whitespace-nowrap text-soft-foreground`,children:i.task.prompt})]})]},`${i.id}-${e.at}`)}),d.length===0?(0,q.jsx)(`p`,{className:`px-3.5 py-2 text-[12.5px] text-soft-foreground`,children:f.length?`Nothing scheduled — the GitHub polls above still run.`:`Nothing scheduled.`}):null]})]})}function Hn(e,t,n,r=12){let i=[];for(let a of e)if(!(!a.enabled||a.kind!==`schedule`||!a.schedule))for(let e of re(a.schedule,t,t+14*864e5,n,r))i.push({automation:a,at:e});return i.sort((e,t)=>e.at-t.at).slice(0,r)}function Un({open:e,onOpenChange:t,upcoming:n,pollCount:r,timeZone:i,now:a}){let o=F(),s=T(a,i);return(0,q.jsx)(de,{open:e,onOpenChange:t,children:(0,q.jsxs)(ue,{side:`right`,"data-slot":`next-runs-rail`,"aria-describedby":void 0,className:`w-[360px] gap-0 sm:max-w-[360px]`,children:[(0,q.jsxs)(fe,{className:`px-4 pt-4 pb-2`,children:[(0,q.jsxs)(pe,{className:`inline-flex items-center gap-2 text-sm`,children:[(0,q.jsx)(Ne,{className:`size-4`}),`Next runs`]}),(0,q.jsx)(le,{className:`sr-only`,children:`Upcoming scheduled runs, soonest first.`})]}),(0,q.jsxs)(`div`,{className:`overflow-y-auto`,children:[n.map((e,n)=>{let r=T(e.at,i),c=r!==null&&s!==null&&r.year===s.year&&r.month===s.month&&r.day===s.day,l=r?`${c?``:`${Ee(r.weekday)} `}${O(r.hour,r.minute)}`:``;return(0,q.jsxs)(`button`,{type:`button`,"data-slot":`next-run-row`,"data-automation":e.automation.id,onClick:()=>{t(!1),o(`/automations/${encodeURIComponent(e.automation.id)}`)},className:`grid w-full cursor-pointer grid-cols-[76px_1fr_auto] items-center gap-2 px-4 py-2 text-left text-[13px] hover:bg-muted`,children:[(0,q.jsx)(`span`,{className:`font-mono text-xs font-medium whitespace-nowrap text-muted-foreground tabular-nums`,children:l}),(0,q.jsx)(`span`,{className:`overflow-hidden text-[13px] font-medium text-ellipsis whitespace-nowrap`,children:e.automation.name}),(0,q.jsx)(`span`,{className:`text-[11px] whitespace-nowrap text-soft-foreground`,children:ve(e.at,a)})]},`${e.automation.id}-${n}`)}),n.length===0?(0,q.jsx)(`p`,{className:`px-4 py-2 text-[12.5px] text-soft-foreground`,children:`No scheduled runs in the next two weeks.`}):null,(0,q.jsxs)(`div`,{"data-slot":`next-runs-footer`,className:`mt-1.5 flex items-center gap-2 border-t border-border px-3.5 pt-2.5 pb-1 text-xs text-muted-foreground`,children:[(0,q.jsx)(L,{tone:`pending`,pulse:!0}),r,` GitHub polls running continuously`]})]})]})})}function Wn({stats:e,pollCount:t,upcoming:n,timeZone:r,railOpen:i,onOpenRail:a}){let o=n[0];return(0,q.jsxs)(`div`,{"data-slot":`stats-strip`,className:`flex flex-wrap items-center gap-4 text-[12.5px] text-muted-foreground`,children:[(0,q.jsx)(`span`,{className:`text-[11px] font-semibold tracking-[.05em] text-soft-foreground uppercase`,children:`This week`}),(0,q.jsx)(Gn,{label:`runs`,value:String(e.runs)}),null,(0,q.jsx)(Gn,{label:`failed`,value:String(e.failed),danger:e.failed>0}),(0,q.jsx)(Gn,{label:`agent time`,value:je(e.agentSeconds)}),(0,q.jsxs)(`span`,{"data-slot":`stats-polls`,className:`inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap`,children:[(0,q.jsx)(L,{tone:`pending`,pulse:!0}),t,` GitHub polls continuous`]}),(0,q.jsx)(`span`,{className:`flex-1`}),(0,q.jsxs)(`span`,{"data-slot":`stats-next`,className:`inline-flex min-w-0 shrink-0 items-center gap-1.5 whitespace-nowrap`,children:[(0,q.jsx)(pt,{className:`size-[13px] text-soft-foreground`}),`next`,` `,(0,q.jsx)(`b`,{className:`font-mono text-[12.5px] font-medium text-foreground`,children:o?we(o.at,r):`—`}),` `,(0,q.jsx)(`span`,{className:`max-w-[180px] overflow-hidden text-ellipsis`,children:o?.automation.name??``})]}),(0,q.jsxs)(m,{variant:`outline`,size:`sm`,"aria-expanded":i,className:`shrink-0`,onClick:a,children:[(0,q.jsx)(Ne,{className:`size-3.5`}),`Next runs`,(0,q.jsx)(`span`,{className:`font-mono text-[11px] font-medium text-muted-foreground`,children:n.length})]})]})}function Gn({label:e,value:t,danger:n=!1}){return(0,q.jsxs)(`span`,{"data-slot":`stat`,"data-label":e,className:`inline-flex shrink-0 items-baseline gap-[5px] whitespace-nowrap`,children:[(0,q.jsx)(`b`,{className:D(`font-mono text-sm font-semibold tabular-nums`,n?`text-danger`:`text-foreground`),children:t}),e]})}var Kn=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`];function qn({data:e}){let t=me(6e4),n=e.timeZone,r=T(t,n),i=r?Array.from({length:8},(e,i)=>Mn(t,n,i-(r.weekday-1))):[],a=i[0],o=i[7];if(!r||a==null||o==null)return(0,q.jsx)(`div`,{"data-slot":`week-view`,className:`p-5`,children:(0,q.jsxs)(`p`,{className:`rounded-xl border border-dashed p-8 text-center text-sm text-muted-foreground`,children:[`Cannot draw the week: unknown time zone “`,n,`”.`]})});let s=r.weekday-1,c=Nn(e.automations,a,o,n),l=Kn.map((e,t)=>{let r=i[t];return{label:e,dayOfMonth:r==null?null:T(r,n)?.day??null,isToday:t===s,blocks:Pn(c.filter(e=>e.parts.weekday-1===t))}});return(0,q.jsx)(`div`,{"data-slot":`week-view`,className:`p-5`,children:(0,q.jsxs)(M,{flush:!0,children:[(0,q.jsxs)(`div`,{className:`grid grid-cols-[48px_repeat(7,minmax(0,1fr))] border-b border-border`,children:[(0,q.jsx)(`div`,{}),l.map(e=>(0,q.jsxs)(`div`,{"data-slot":`week-day-header`,"data-today":e.isToday?`true`:void 0,className:D(`flex items-center gap-2 border-l border-border px-2 py-2.5 text-[11px] font-semibold tracking-[.05em] uppercase`,e.isToday?`text-foreground`:`text-soft-foreground`),children:[e.label,(0,q.jsx)(`span`,{className:D(`rounded-full px-[7px] py-px text-[13px] font-medium tracking-normal normal-case`,e.isToday?`bg-primary text-primary-foreground`:`text-muted-foreground`),children:e.dayOfMonth??``})]},e.label))]}),(0,q.jsx)(zn,{automations:e.automations}),(0,q.jsxs)(`div`,{className:`flex max-h-[560px] overflow-y-auto`,children:[(0,q.jsx)(In,{}),l.map(e=>(0,q.jsxs)(`div`,{"data-slot":`week-column`,"data-today":e.isToday?`true`:void 0,className:D(`relative min-w-0 flex-1 border-l border-border`,e.isToday&&`bg-muted/35`),style:{height:816},children:[(0,q.jsx)(Rn,{}),e.isToday?(0,q.jsx)(Ln,{minute:jn(r)}):null,e.blocks.map(({occurrence:e,stack:t})=>(0,q.jsx)(Fn,{automation:e.automation,minute:jn(e.parts),stack:t},`${e.automation.id}-${e.at}`))]},e.label))]})]})})}function Jn(e){return[{value:`list`,label:`List`,...e===void 0?{}:{count:e}},{value:`week`,label:`Week`},{value:`day`,label:`Day`}]}function Yn({data:e,error:t,actions:n,view:r,onViewChange:i}){let[a,o]=(0,K.useState)(!1),s=Date.now(),c=e?Hn(e.automations,s,e.timeZone,12):[],l=e?e.automations.filter(e=>e.kind===`github`&&e.enabled).length:0;return(0,q.jsxs)(`div`,{"data-route":`automations`,className:`flex min-h-full flex-col`,children:[(0,q.jsxs)(`header`,{className:`sticky top-0 z-10 flex h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5`,children:[(0,q.jsx)(`h1`,{className:`text-base font-semibold`,children:`Automations`}),(0,q.jsx)(ce,{slot:`automations-view`,label:`View`,value:r,options:Jn(e?.automations.length),onChange:i}),(0,q.jsx)(`div`,{className:`flex-1`}),e?(0,q.jsxs)(`span`,{"data-slot":`automations-status`,className:`inline-flex min-w-0 items-center gap-2 overflow-hidden text-[12.5px] text-ellipsis whitespace-nowrap text-muted-foreground max-[1280px]:hidden`,children:[(0,q.jsx)(L,{tone:e.scheduler.state===`scheduled`?`success`:`neutral`}),e.scheduler.state===`scheduled`?`Scheduler running`:`Scheduler idle`,(0,q.jsx)(`span`,{className:`text-soft-foreground`,children:`·`}),e.available?`GitHub available`:`GitHub unavailable${e.reason?` · ${e.reason}`:``}`,(0,q.jsx)(`span`,{className:`text-soft-foreground`,children:`·`}),(0,q.jsx)(`span`,{className:`font-mono text-xs`,children:e.timeZone})]}):null,(0,q.jsx)(m,{asChild:!0,className:`shrink-0`,children:(0,q.jsxs)(I,{to:`/automations/new`,children:[(0,q.jsx)(gt,{className:`size-[15px]`}),`New automation`]})})]}),t===void 0?e?e.automations.length===0?(0,q.jsx)(b,{icon:(0,q.jsx)(Je,{}),tone:`neutral`,title:`No automations yet`,subtitle:`Create one paused, preview it, then enable it.`,heading:`h2`,actions:(0,q.jsx)(m,{asChild:!0,children:(0,q.jsxs)(I,{to:`/automations/new`,children:[(0,q.jsx)(gt,{className:`size-[15px]`}),`New automation`]})})}):r===`week`?(0,q.jsx)(qn,{data:e}):r===`day`?(0,q.jsx)(Vn,{data:e}):(0,q.jsxs)(`div`,{"data-slot":`automations-list`,className:`flex flex-col gap-3 p-5`,children:[(0,q.jsx)(Wn,{stats:e.stats,pollCount:l,upcoming:c,timeZone:e.timeZone,railOpen:a,onOpenRail:()=>o(!0)}),(0,q.jsx)(On,{data:e,actions:n,now:s}),(0,q.jsx)(Un,{open:a,onOpenChange:o,upcoming:c,pollCount:l,timeZone:e.timeZone,now:s})]}):(0,q.jsx)(`div`,{className:`p-5`,children:(0,q.jsx)($,{text:`Loading automations…`})}):(0,q.jsx)(`div`,{className:`p-5`,children:(0,q.jsx)($,{text:t})})]})}function Xn({mode:e=`list`}){let{automationId:t}=x(),n=F(),r=Se(),i=xe(r.known&&!r.off),a=Te(i.data),[o,s]=f(),c=Zn(o.get(`view`));if(!r.known)return(0,q.jsx)(`div`,{"data-route":`automations`,className:`flex min-h-full flex-col p-3 md:p-5`,children:(0,q.jsx)($,{text:`Loading automations…`})});if(r.off)return(0,q.jsx)(`div`,{"data-route":`automations`,className:`flex min-h-full flex-col p-3 md:p-5`,children:(0,q.jsx)(b,{icon:(0,q.jsx)(Je,{}),tone:`neutral`,title:`Automations are off`,subtitle:`This cockpit was started with CEZ_AUTOMATIONS=0. Unset it and restart cezar to turn automations on.`,heading:`h2`})});let l=()=>n(`/automations`);if(e===`new`)return(0,q.jsx)(gn,{data:i.data,onBack:l,onSaved:l});if(e===`edit`){let e=i.data?.automations.find(e=>e.id===t);return i.data&&!e?(0,q.jsx)(`div`,{"data-route":`automations`,className:`p-5`,children:(0,q.jsx)($,{text:`Automation not found.`})}):e?(0,q.jsx)(gn,{data:i.data,automation:e,actions:a,onBack:l,onSaved:l,onLog:()=>n(`/automations/${encodeURIComponent(e.id)}/log`)}):(0,q.jsx)(`div`,{"data-route":`automations`,className:`p-5`,children:(0,q.jsx)($,{text:`Loading automation…`})})}if(e===`log`){let e=i.data?.automations.find(e=>e.id===t);return t?(0,q.jsx)(bn,{automationId:t,automation:e,timeZone:i.data?.timeZone,onBack:l}):(0,q.jsx)(`div`,{"data-route":`automations`,className:`p-5`,children:(0,q.jsx)($,{text:`Automation not found.`})})}return(0,q.jsx)(Yn,{data:i.data,error:i.error?String(i.error instanceof Error?i.error.message:i.error):void 0,actions:a,view:c,onViewChange:e=>s(t=>{let n=new URLSearchParams(t);return e===`list`?n.delete(`view`):n.set(`view`,e),n},{replace:!0})})}function Zn(e){return e===`week`||e===`day`?e:`list`}function $({text:e}){return(0,q.jsx)(`div`,{className:`rounded-xl border border-dashed p-8 text-center text-sm text-muted-foreground`,children:e})}export{Xn as AutomationsRoute};
|