@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,44 +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,Er as i,Gn as a,Oi as o,Rn as s,Si as c,Sn as l,Ti as u,Wr as d,a as f,an as p,et as m,hi as h,pt as g,si as _,sn as v,t as y}from"./centered-state-DJLgwvA4.js";import{N as b,_ as x,b as S,g as C,h as w,m as T,p as E,r as D,v as O}from"./utils-DoBmOlX3.js";import{a as ee,c as k,f as te,g as A,h as j,m as M,n as N,o as ne,p as re,s as ie,u as P}from"./facet-filter-DZ3wfvN9.js";import{a as ae,i as oe,n as se,o as ce,s as le,t as ue}from"./use-now-sqAvRMna.js";import{a as de,d as fe,i as pe,n as me,r as he,t as ge}from"./tooltip-Bdl8mQG8.js";import{a as _e,h as ve,r as ye,v as F,y as be}from"./automation-format-CzinzpHK.js";import{i as xe,r as Se,s as Ce,t as we}from"./popover-BRq6QnwI.js";import{t as Te}from"./chevron-right-B3Ta8VKK.js";import{t as Ee}from"./download-BcgZ2yk4.js";import{i as De,n as Oe,t as ke}from"./token-metrics-rVl4kXe_.js";import{n as I}from"./format-DHK74MwW.js";import{C as Ae,D as je,E as Me,I as Ne,J as Pe,L as Fe,M as Ie,N as Le,T as Re,j as ze,k as Be,w as Ve}from"./index-CSNFuBvj.js";var He=D(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),Ue=D(`arrow-down-left`,[[`path`,{d:`M17 7 7 17`,key:`15tmo1`}],[`path`,{d:`M17 17H7V7`,key:`1org7z`}]]),We=D(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Ge=D(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Ke=D(`table-2`,[[`path`,{d:`M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18`,key:`gugj83`}]]),L=e(t(),1);function qe(e){let t=Date.parse(e.nextRunAt??``),n=Date.parse(e.state?.backoffUntil??``);return Number.isFinite(t)?Math.max(t,Number.isFinite(n)?n:t):null}function Je(e){return e.flatMap(e=>(e.data?.automations??[]).filter(e=>e.enabled).map(t=>({project:e,automation:t,at:qe(t)}))).sort((e,t)=>(e.at??1/0)-(t.at??1/0)||e.project.id.localeCompare(t.project.id)||e.automation.id.localeCompare(t.automation.id))}function Ye(e){let t=g(),n=r(),i=t.data?.projects??[],s=t.data?.bootProject,c=s&&!i.some(e=>e.id===s)?[...i,{id:s,name:s,status:`ok`}]:i,l=o({queryKey:[...v.dashboard,`automations`,c.map(e=>[e.id,e.name,e.status])],enabled:e&&!!t.data,queryFn:async({signal:e})=>{let t=0,n=[];return await Promise.all([0,1].map(async()=>{for(;t<c.length&&!e.aborted;){let r=c[t++];if(r.status===`missing`){n.push({...r,error:`Project folder unavailable`});continue}try{let t=S.parse(await _(await a.api.v1.workspace.dashboard.automations.$get({query:{projectId:r.id}},{init:{signal:e}}),`/workspace/dashboard/automations`));n.push({id:r.id,name:r.name,data:t})}catch{n.push({id:r.id,name:r.name,error:`Could not load automations`})}}})),n}});return(0,L.useEffect)(()=>{if(e)return P(e=>{e===`automation-change`&&n.invalidateQueries({queryKey:[...v.dashboard,`automations`]})})},[n,e]),{...l,registry:t,retry:()=>{t.refetch(),l.refetch()}}}var R=n();function z({rows:e}){return(0,R.jsx)(`span`,{hidden:!0,"data-dashboard-export":JSON.stringify(e)})}var Xe=`text-sm font-semibold`,Ze=`relative min-w-0 overflow-hidden rounded-xl border bg-gradient-to-br to-transparent p-4 sm:p-5`;function Qe({label:e,value:t,icon:n,children:r}){return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`span`,{className:`flex w-full items-center justify-between gap-2`,children:[(0,R.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:e}),(0,R.jsx)(`span`,{className:`rounded-lg bg-background/70 p-2`,"aria-hidden":`true`,children:n})]}),(0,R.jsx)(`span`,{className:`mt-3 block text-3xl font-semibold tracking-tight tabular-nums`,children:t}),(0,R.jsx)(`span`,{className:`mt-4 block text-xs text-muted-foreground`,children:r})]})}function $e({at:e}){return(0,R.jsxs)(`time`,{dateTime:e,title:new Date(e).toLocaleString(),children:[`Updated `,I(e),` ago`]})}function et(){let e=ve(),t=Ye(e.known&&!e.off),n=ue(3e4),[r,i]=(0,L.useState)(!1),a=Je(t.data??[]),o=r?a:a.slice(0,3),s=t.data?.filter(e=>e.error)??[],c=!e.known||!t.registry.isError&&(t.registry.isPending||t.isPending),l=t.isError||t.registry.isError||s.length>0;return(0,R.jsxs)(F,{"data-export-context":`Enabled automations · showing ${o.length} of ${a.length} loaded · ${l?`partial coverage`:`available projects`}`,className:`min-w-0 gap-0 py-0`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b px-4 py-3`,children:[(0,R.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold`,children:[(0,R.jsx)(be,{className:`size-4 text-muted-foreground`}),`Automations`]}),!e.off&&t.data&&(0,R.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[a.length,` enabled`,l?` · partial`:``]})]}),!e.off&&t.data&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(z,{rows:[{section:`automations`,metric:`enabled`,value:a.length,unit:`automations`,note:l?`Partial project coverage`:`Loaded projects`}]}),t.dataUpdatedAt>0&&(0,R.jsx)(`p`,{className:`px-4 pt-3 text-xs text-muted-foreground`,children:(0,R.jsx)($e,{at:new Date(t.dataUpdatedAt).toISOString()})})]}),e.off?(0,R.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:`Automations are disabled in this workspace.`}):(0,R.jsxs)(R.Fragment,{children:[c&&(0,R.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:`Loading automations…`}),l&&(0,R.jsxs)(`div`,{role:`alert`,className:`p-4 text-sm`,children:[(0,R.jsx)(`p`,{children:`Some automation data could not be refreshed. Available results are shown.`}),s.map(e=>(0,R.jsxs)(`p`,{children:[e.name,`: `,e.error]},e.id)),(0,R.jsx)(f,{variant:`ghost`,onClick:t.retry,children:`Retry automations`})]}),!c&&!l&&a.length===0&&(0,R.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:`No enabled automations. Enable one in a project's Automations page.`}),o.map(({project:e,automation:t,at:r})=>{let i=(t.state?.consecutiveFailures??0)>0?`Recent checks failed`:void 0,a=r===null?`Next time not available`:r<=n?`Due — awaiting scheduler`:_e(r,n),o=t.kind===`schedule`?`Next run`:`Next check`;return(0,R.jsxs)(`div`,{"data-export-row":!0,className:`border-b px-4 py-3 last:border-0`,children:[(0,R.jsx)(h,{className:`block min-h-11 text-sm font-medium hover:underline`,to:`/p/${encodeURIComponent(e.id)}/automations/${encodeURIComponent(t.id)}`,children:t.name}),(0,R.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.name,` · `,o,`: `,a]}),r!==null&&(0,R.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:(0,R.jsxs)(`time`,{dateTime:new Date(r).toISOString(),children:[ye(r,e.data.timeZone),` · `,e.data.timeZone]})}),t.kind!==`schedule`&&(0,R.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Checks for matching events; a task may not be started.`}),i&&(0,R.jsx)(`p`,{className:`mt-1 text-xs text-warning`,children:i}),(0,R.jsx)(z,{rows:[{section:`automation`,entity:`${e.id}:${t.id}`,metric:`name`,value:t.name},{section:`automation`,entity:`${e.id}:${t.id}`,metric:t.kind===`schedule`?`nextRunAt`:`nextCheckAt`,value:r===null?null:new Date(r).toISOString(),note:[a,i].filter(Boolean).join(` · `)}]})]},`${e.id}:${t.id}`)}),a.length>3&&(0,R.jsx)(f,{variant:`ghost`,className:`m-2 min-h-11`,onClick:()=>i(!r),children:r?`Show fewer`:`Show all ${a.length} enabled`}),!c&&(0,R.jsxs)(`details`,{className:`border-t px-4 py-2 text-xs text-muted-foreground`,children:[(0,R.jsx)(`summary`,{className:`min-h-11 cursor-pointer py-3`,"data-export-heading":`Project automations`,children:`Manage automations by project`}),t.data?.map(e=>(0,R.jsx)(h,{className:`block min-h-11 py-3 hover:underline`,to:`/p/${encodeURIComponent(e.id)}/automations`,children:e.name},e.id))]})]})]})}function tt(e,t,n){let r=new Set,i=new Map(e.map((e,t)=>[n(e),{r:e,i:t}]));return t.forEach((e,t)=>{let a=i.get(n(e));(!a||a.i!==t||JSON.stringify(a.r)!==JSON.stringify(e))&&r.add(n(e)),i.delete(n(e))}),i.forEach((e,t)=>r.add(t)),r}function nt(e,t,n){let r=new Map(t.map(e=>[n(e),e]));return e.map(e=>({row:r.get(n(e))??e,removed:!r.has(n(e))}))}var rt=(0,L.createContext)(``),it=(0,L.createContext)(!0),B=new Map;function at(e,t,n=``,r=0,i){let a=(0,L.useContext)(rt),o=`${a}:${n}`,[s,c]=(0,L.useState)(()=>B.get(o)),[l,u]=(0,L.useState)(o),d=(0,L.useRef)(r),f=(0,L.useRef)(!1);l!==o&&(u(o),c(B.get(o)),d.current=r,f.current=!1),d.current!==r&&(d.current=r,f.current=!0),(0,L.useEffect)(()=>{e&&(!s||f.current)&&(c(e),f.current=!1)},[s,e]);let p=(0,L.useMemo)(()=>({current:s}),[o]);p.current=s,(0,L.useEffect)(()=>()=>{!a||!p.current||(B.delete(o),B.set(o,p.current),B.size>60&&B.delete(B.keys().next().value))},[a,o,p]);let m=s??e??[],h=new Set((e??m).map(t)),g=i?m.filter(e=>h.has(t(e))||i(e)):m;return{rows:nt(g,e??m,t),updates:e?tt(g,e,t).size:0,show:()=>c(e)}}var V=new Map;function ot(e){return V.get(e)}function st(e,t){V.delete(e),V.set(e,t),V.size>20&&V.delete(V.keys().next().value)}var H=new Map;function ct(e,t){return H.get(e)?.[t]}function lt(e,t,n){let r=H.get(e)??{};r[t]=n,H.delete(e),H.set(e,r),H.size>20&&H.delete(H.keys().next().value)}var ut=0,dt=()=>++ut,U=new Map;function W(e,t){let n=(0,L.useContext)(rt),r=()=>{let r=n?U.get(n):void 0;return r?.has(e)?r.get(e):typeof t==`function`?t():t},[i,a]=(0,L.useState)(r),o=`${n}:${e}`,[s,c]=(0,L.useState)(o);o!==s&&(c(o),a(()=>r()));let l=(0,L.useMemo)(()=>({value:i}),[n,e]);return l.value=i,(0,L.useEffect)(()=>()=>{if(!n)return;let t=U.get(n)??new Map;t.set(e,l.value),t.size>80&&t.delete(t.keys().next().value),U.delete(n),U.set(n,t),U.size>20&&U.delete(U.keys().next().value)},[n,e,l]),[i,a]}var ft=`a[href], button, select, input, [tabindex]`;function pt(e){let[t]=W(`${e}:position`,()=>({scroll:0})),n=(0,L.useCallback)(e=>{let n=[...e.querySelectorAll(ft)],r=t.href?n.find(e=>e.getAttribute(`href`)===t.href):t.index===void 0?void 0:n[t.index];return r&&r.getAttribute(`aria-disabled`)!==`true`&&r.focus({preventScroll:!0}),e.scrollTop=t.scroll,!!r&&r.getAttribute(`aria-disabled`)!==`true`},[t]),r=(0,L.useMemo)(()=>({restore:()=>!1}),[t]);return{ref:(0,L.useCallback)(e=>{if(!e)return;let i=t.href!==void 0||t.index!==void 0,a=()=>{if(!i)return!1;let r=n(e);return r?(i=!1,o.disconnect()):e.querySelector(`[data-sheet-loading="false"]`)&&(i=!1,o.disconnect(),e.querySelector(`button:not([disabled]), select, [tabindex="0"]`)?.focus({preventScroll:!0}),e.scrollTop=t.scroll),r};r.restore=a;let o=new MutationObserver(a);i&&o.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-sheet-loading`]});let s=()=>{i=!1,o.disconnect()},c=()=>{i||(t.scroll=e.scrollTop)},l=n=>{i||!(n.target instanceof HTMLElement)||(t.href=n.target.getAttribute(`href`)??void 0,t.index=[...e.querySelectorAll(ft)].indexOf(n.target))};return e.addEventListener(`pointerdown`,s),e.addEventListener(`keydown`,s),e.addEventListener(`wheel`,s,{passive:!0}),e.addEventListener(`scroll`,c),e.addEventListener(`focusin`,l),()=>{o.disconnect(),e.removeEventListener(`pointerdown`,s),e.removeEventListener(`keydown`,s),e.removeEventListener(`wheel`,s),e.removeEventListener(`scroll`,c),e.removeEventListener(`focusin`,l)}},[t,n,r]),onOpenAutoFocus:e=>{(t.href!==void 0||t.index!==void 0)&&(e.preventDefault(),r.restore())}}}function mt(e,t){let n=(0,L.useRef)(null),[r,i]=W(`${e}:trigger`,null);return{capture:()=>{let e=document.activeElement;n.current=e instanceof HTMLElement&&e!==document.body?e:null,i(n.current?{label:n.current.getAttribute(`aria-label`),text:n.current.textContent}:null)},restore:()=>{((n.current?.isConnected?n.current:r?[...document.querySelectorAll(`button`)].find(e=>!e.closest(`[role="dialog"]`)&&!e.hasAttribute(`disabled`)&&(r.label?e.getAttribute(`aria-label`)===r.label:e.textContent===r.text)):void 0)??document.querySelector(t))?.focus({preventScroll:!0})}}}function ht(e,t=!1){return e==null?`Unavailable`:t?`$${e.toFixed(e===0||e>=1?2:Math.min(20,Math.max(4,Math.ceil(-Math.log10(e))+1)))}`:e.toLocaleString(`en-US`)}function G(e){return e===null?`Unavailable`:e<1?`${Math.round(e*60)}m`:e<48?`${e.toFixed(1)}h`:`${(e/24).toFixed(1)}d`}function gt(e,t=!0){return o({queryKey:[...v.dashboard,`overview`,e],enabled:t,staleTime:5e3,refetchInterval:t&&!e.snapshotId?15e3:!1,refetchIntervalInBackground:!1,retry:!1,queryFn:async({signal:t})=>E.parse(await _(await a.api.v1.workspace.dashboard.overview.$get({query:{period:e.period??`7d`,group:e.group??`completed`,tzOffsetMinutes:String(e.tzOffsetMinutes??new Date().getTimezoneOffset()),...e.snapshotId?{snapshotId:e.snapshotId}:{},...e.projectId?{projectId:e.projectId}:{},offset:String(e.offset??0),limit:`20`}},{init:{signal:t}}),`/workspace/dashboard/overview`))})}var K=e=>`${e.projectId}:${e.id}`;function _t({row:e,removed:t=!1,queue:n=!1,checking:r=!1,checkFailed:i=!1}){let a=(0,L.useContext)(it)&&!r&&!i,o=A(e);t=t||o===null||n&&o?.archived===!0,o&&(e={...e,status:o.status});let s=Oe(e),c=n&&![`waiting`,`review`].includes(e.status),u=t||c||!a;return(0,R.jsxs)(`div`,{"data-dashboard-row":K(e),className:`min-w-0 border-b px-4 py-3 last:border-0`,children:[(0,R.jsx)(z,{rows:[{section:`task`,entity:K(e),metric:`title`,value:e.titleSummary||e.title},{section:`task`,entity:K(e),metric:`status`,value:u?`Not currently actionable`:e.status},{section:`task`,entity:K(e),metric:`createdAt`,value:e.createdAt}]}),(0,R.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,R.jsx)(De,{tone:s.tone,className:`mt-2`}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(h,{tabIndex:u?-1:void 0,"aria-disabled":u||void 0,onClick:e=>{u&&e.preventDefault()},to:`/p/${encodeURIComponent(e.projectId)}/tasks/${encodeURIComponent(e.id)}`,className:`block min-h-11 break-words text-sm font-medium leading-relaxed hover:underline`,children:e.titleSummary||e.title}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground`,children:[(0,R.jsx)(`span`,{children:e.projectId}),(0,R.jsx)(`span`,{children:i?`Could not check current state`:a?t?n&&o!==null?`No longer needs you`:`Task removed`:c?`No longer needs you`:s.label:`Checking current state…`}),(0,R.jsx)(`span`,{children:I(e.createdAt)}),e.dispatch&&(0,R.jsx)(`span`,{children:`Subtask`}),!u&&l(e).map(t=>(0,R.jsx)(de,{reference:t,taskTitle:e.title,projectId:e.projectId,className:`min-h-11`},`${t.kind}:${t.number}`))]})]})]})]})}function q({coverage:e,count:t,retry:n}){let r=e.projects.filter(e=>e.state!==`complete`);return r.length?(0,R.jsxs)(`div`,{className:`rounded-md border border-pending/40 bg-muted/40 p-3 text-sm`,role:`status`,children:[(0,R.jsxs)(`p`,{children:[t===void 0?``:`${t} tasks need you in the available data. Complete coverage: ${e.projects.length-r.length} of ${e.projects.length} projects. `,r.length===1?r[0].state===`unavailable`?`One project is unavailable.`:`One project has incomplete coverage.`:`${r.length} projects have incomplete coverage.`]}),(0,R.jsxs)(`details`,{className:`mt-2`,children:[(0,R.jsxs)(`summary`,{className:`min-h-11 cursor-pointer py-2`,children:[`View unavailable `,r.length===1?`project`:`projects`]}),r.map(e=>(0,R.jsxs)(`p`,{children:[e.projectId,`: `,e.reason??e.state,e.omittedRuns>0?` · ${e.omittedRuns} omitted tasks`:``]},e.projectId))]}),(0,R.jsx)(f,{variant:`outline`,onClick:n,className:`min-h-11`,children:`Retry`})]}):null}function vt(e,t,n){let r=c(),i=r.state?.dashboardEntry??r.key,[a,o]=u(),s=a.get(e);return[s!==null&&t.includes(s)?s:n,t=>o(n=>{let r=new URLSearchParams(n);return r.set(e,t),r},{replace:!0,state:{...r.state,dashboardEntry:i}})]}var yt={running:`Running now`,"needs-you":`Needs you`,completed:`Completed`,failed:`Failed outcomes`},bt={"needs-you":`from-violet/10`,running:`from-info/10`,completed:`from-success/10`,failed:`from-danger/10`},xt={"needs-you":Ge,running:He,completed:k,failed:We};function St({active:e,children:t,onCurrent:n}){let[r,i]=vt(`period`,[`7d`,`30d`],`7d`),a=mt(`outcome`,`[data-outcome-trigger]`),o=g().data?.projects,s=e=>o?.find(t=>t.id===e)?.name??e,c=gt({period:r},e),[l,u]=W(`outcome:selection`,null),d=pt(`outcome:${l?.identity??`closed`}`),p=re();if((0,L.useEffect)(()=>{e||u(null)},[e]),!e)return t({});let m=c.data,_=(e,t)=>{a.capture(),m&&u({identity:dt(),snapshot:m,group:e,projectId:t})},v=m?.coverage.projects.every(e=>e.state===`complete`);return(0,R.jsxs)(R.Fragment,{children:[t({overview:(0,R.jsxs)(F,{className:`gap-0 py-0`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b p-4`,children:[(0,R.jsx)(`h2`,{className:Xe,children:`Workspace overview`}),(0,R.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[`Outcomes period`,(0,R.jsxs)(`select`,{value:r,onChange:e=>{i(e.target.value===`30d`?`30d`:`7d`),u(null)},className:`min-h-11 rounded-md border bg-background px-3`,children:[(0,R.jsx)(`option`,{value:`7d`,children:`Last 7 days`}),(0,R.jsx)(`option`,{value:`30d`,children:`Last 30 days`})]})]})]}),(0,R.jsxs)(`div`,{className:`space-y-3 p-4`,children:[c.isPending&&(0,R.jsx)(`p`,{role:`status`,children:`Loading overview…`}),c.isError&&(0,R.jsxs)(`p`,{role:`alert`,children:[m?`Showing previous results. `:``,`Could not refresh overview.`,` `,(0,R.jsx)(f,{variant:`outline`,onClick:()=>void c.refetch(),children:`Retry overview`})]}),m&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`p`,{className:`text-sm`,children:[m.metrics.needsYou?`${m.metrics.needsYou} tasks require your input or review.`:v&&p.connected&&!c.isError?`No tasks currently require your input or review.`:`No waiting tasks found in the available data.`,` `,m.metrics.failed,` failed `,m.metrics.failed===1?`outcome`:`outcomes`,` `,`in this period. Includes subtasks; completed does not mean accepted or deployed.`]}),(0,R.jsx)(q,{coverage:m.coverage,retry:()=>void c.refetch()}),(0,R.jsx)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:[`needs-you`,`running`,`completed`,`failed`].map(e=>{let t=m.metrics[e===`needs-you`?`needsYou`:e],i=xt[e];return(0,R.jsxs)(f,{"data-outcome-trigger":!0,"data-export-keep":!0,variant:`outline`,className:`relative min-w-0 overflow-hidden rounded-xl border bg-gradient-to-br to-transparent p-4 sm:p-5 h-auto min-h-24 flex-col items-start gap-0 whitespace-normal text-left ${e===`failed`&&t===0?`from-muted/40`:bt[e]}`,onClick:t=>{n&&(e===`running`||e===`needs-you`)?n(e,t.currentTarget):_(e)},"aria-label":`${yt[e]}: ${t}`,children:[(0,R.jsx)(Qe,{label:yt[e],value:t,icon:(0,R.jsx)(i,{className:`size-4`}),children:e===`running`||e===`needs-you`?`Current state`:`Last ${r===`7d`?7:30} calendar days`}),(0,R.jsxs)(`span`,{"data-export-exclude":!0,className:`mt-3 flex items-center gap-1 text-xs font-medium`,children:[`View tasks `,(0,R.jsx)(Te,{className:`size-3`,"aria-hidden":`true`})]})]},e)})}),(0,R.jsxs)(`p`,{className:`text-sm`,children:[`Median cycle time `,(0,R.jsx)(`strong`,{children:G(m.metrics.medianCycleHours)}),` ·`,` `,m.metrics.timedTasks,`/`,m.metrics.completed,` completed tasks have valid timings.`,` `,(0,R.jsx)(f,{variant:`ghost`,onClick:()=>_(`completed`),children:`Inspect completed tasks`})]}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,R.jsxs)(`time`,{dateTime:m.asOf,title:new Date(m.asOf).toLocaleString(),children:[`Updated `,I(m.asOf),` ago`]})}),(0,R.jsxs)(`details`,{className:`text-xs text-muted-foreground`,children:[(0,R.jsx)(`summary`,{"data-export-heading":`Metric definitions`,className:`cursor-pointer py-2`,children:`How these metrics work`}),(0,R.jsx)(`p`,{children:`Outcomes use finish dates, including archived tasks. Scheduled retries are excluded from failed outcomes. Period includes today at your current fixed UTC offset.`})]}),(0,R.jsx)(z,{rows:Object.entries(m.metrics).map(([e,t])=>({section:`overview`,metric:e,value:t,unit:e===`medianCycleHours`?`hours`:`tasks`,asOf:m.asOf,note:e===`running`||e===`needsYou`?`Current non-archived state`:`Finished since ${m.windowStart}`}))})]})]})]}),portfolio:m&&(0,R.jsx)(`div`,{children:(0,R.jsxs)(F,{className:`gap-3 p-4`,"data-export-context":`Outcomes: Last ${r===`7d`?7:30} calendar days; workload: current state`,children:[(0,R.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Projects`}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Current workload and outcomes for the selected period. Sorted by tasks needing you, then running tasks. Counts include subtasks.`}),(0,R.jsxs)(`div`,{className:`overflow-x-auto`,role:`region`,"aria-label":`Project outcomes`,tabIndex:0,children:[(0,R.jsxs)(`table`,{className:`w-full text-left text-sm`,children:[(0,R.jsx)(`thead`,{children:(0,R.jsx)(`tr`,{children:[`Project`,`Needs you`,`Running`,`Completed`,`Failed`,`Median cycle`].map(e=>(0,R.jsx)(`th`,{className:`whitespace-nowrap px-3 py-2 font-medium ${e===`Project`?``:`text-right`}`,children:e},e))})}),(0,R.jsx)(`tbody`,{children:m.projects.map(e=>{let t=m.coverage.projects.find(t=>t.projectId===e.projectId);return(0,R.jsxs)(`tr`,{className:`border-t`,children:[(0,R.jsxs)(`td`,{className:`px-3 py-2`,children:[(0,R.jsx)(h,{className:`font-medium hover:underline`,to:`/p/${encodeURIComponent(e.projectId)}/tasks`,children:s(e.projectId)}),t?.state!==`complete`&&(0,R.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:`Incomplete data`})]}),[`needs-you`,`running`,`completed`,`failed`].map(n=>(0,R.jsx)(`td`,{className:`px-3 py-1 text-right`,children:(0,R.jsx)(f,{"data-export-keep":!0,variant:`ghost`,className:`min-h-11 tabular-nums`,"aria-label":`${s(e.projectId)}: ${yt[n]}: ${t?.state===`unavailable`?`Unavailable`:e[n===`needs-you`?`needsYou`:n]}`,disabled:t?.state===`unavailable`,onClick:()=>_(n,e.projectId),children:t?.state===`unavailable`?`Unavailable`:e[n===`needs-you`?`needsYou`:n]})},n)),(0,R.jsxs)(`td`,{className:`px-3 py-2 text-right tabular-nums`,children:[G(e.medianCycleHours),(0,R.jsxs)(`span`,{className:`block text-xs text-muted-foreground`,children:[e.timedTasks,`/`,e.completed,` timed`]})]})]},e.projectId)})})]}),!m.projects.length&&(0,R.jsx)(`p`,{className:`py-4`,children:`No projects to compare yet.`})]}),(0,R.jsx)(z,{rows:m.projects.flatMap(({projectId:e,...t})=>Object.entries(t).map(([t,n])=>({section:`portfolio`,entity:e,metric:t,value:m.coverage.projects.find(t=>t.projectId===e)?.state===`unavailable`?null:n,unit:t===`medianCycleHours`?`hours`:`tasks`,asOf:m.asOf,note:`Outcomes since ${m.windowStart}; running and needsYou are current state`})))})]})})}),(0,R.jsx)(se,{open:!!l,onOpenChange:e=>{e||u(null)},children:(0,R.jsxs)(oe,{...d,className:`w-full overflow-y-auto sm:max-w-xl`,onCloseAutoFocus:e=>{e.preventDefault(),a.restore()},children:[(0,R.jsxs)(ce,{children:[(0,R.jsxs)(le,{children:[l?yt[l.group]:`Tasks`,l?.projectId?` · ${l.projectId}`:``]}),(0,R.jsx)(ae,{children:`Tasks behind the selected metric. Includes subtasks. Snapshot keeps counts and rows consistent.`})]}),l&&(0,R.jsx)(Ct,{selection:l,projectName:s,refresh:()=>{u(null),c.refetch()}},l.identity)]})})]})}function Ct({selection:e,refresh:t,projectName:n}){let[r,i]=W(`outcome:${e.identity}:offset`,0),a=gt({period:e.snapshot.period,snapshotId:e.snapshot.snapshotId,group:e.group,projectId:e.projectId,offset:r}),o=(0,L.useRef)(null),s=(0,L.useRef)(null);(0,L.useEffect)(()=>{a.data&&s.current===r&&(o.current?.focus(),s.current=null)},[a.data,r]);let c=e=>{s.current=e,i(e)};return(0,R.jsxs)(`div`,{className:`space-y-3 p-4`,"data-sheet-loading":a.isFetching,children:[a.isPending&&(0,R.jsx)(`p`,{children:`Loading tasks…`}),a.isError&&(0,R.jsxs)(`p`,{role:`alert`,children:[`This snapshot may have expired or become unavailable.`,` `,(0,R.jsx)(f,{onClick:t,children:`Refresh overview`})]}),a.data&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`p`,{ref:o,tabIndex:-1,className:`text-xs text-muted-foreground`,children:[a.data.page.total,` tasks · Snapshot from`,` `,(0,R.jsxs)(`time`,{dateTime:a.data.asOf,title:new Date(a.data.asOf).toLocaleString(),children:[I(a.data.asOf),` ago`]})]}),a.data.page.rows.map(t=>(0,R.jsx)(wt,{row:t,group:e.group,projectName:n},`${t.projectId}:${t.id}`)),!a.data.page.rows.length&&(0,R.jsx)(`p`,{children:`No tasks in this group.`})]}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(f,{variant:`outline`,disabled:!r||a.isFetching,onClick:()=>c(Math.max(0,r-20)),children:`Previous`}),(0,R.jsx)(f,{variant:`outline`,disabled:!a.data||a.data.page.nextOffset===null||a.isFetching,onClick:()=>c(a.data.page.nextOffset),children:`Next`})]})]})}function wt({row:e,group:t,projectName:n}){let r=A(e),i=t===`running`||t===`needs-you`;i&&r&&(e={...e,...r});let a=r===null,o=i&&(e.archived||(t===`running`?e.status!==`running`:![`waiting`,`review`].includes(e.status))),s=a||o,c=Oe(e),l=i&&a?`Task removed`:o?t===`running`?`No longer running`:`No longer needs you`:c.label;return(0,R.jsxs)(`div`,{className:`border-b py-3`,children:[(0,R.jsx)(h,{"aria-disabled":s||void 0,tabIndex:s?-1:void 0,onClick:e=>{s&&e.preventDefault()},className:`block min-h-11 font-medium hover:underline`,to:`/p/${encodeURIComponent(e.projectId)}/tasks/${encodeURIComponent(e.id)}`,children:e.titleSummary||e.title}),(0,R.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[(0,R.jsx)(De,{tone:c.tone}),` `,n(e.projectId),` ·`,` `,l,` · `,e.archived?`Archived · `:``,(0,R.jsxs)(`time`,{dateTime:e.finishedAt??e.createdAt,title:new Date(e.finishedAt??e.createdAt).toLocaleString(),children:[e.finishedAt?`Finished`:`Created`,` `,I(e.finishedAt??e.createdAt),` ago`]})]})]})}var J={snapshot:[...v.dashboard,`snapshot`],feed:e=>[...v.dashboard,`feed`,e],telemetry:[...v.dashboard,`telemetry`]},Y=new Map;async function Tt(e){let t=M(),n=C.parse(await _(await a.api.v1.workspace.dashboard.$get({},{init:{signal:e}}),`/workspace/dashboard`));return Y.has(n.snapshotId)||Y.set(n.snapshotId,t),Y.size>60&&Y.delete(Y.keys().next().value),j(t,[...n.questions.rows,...n.reviews.rows]),n}async function Et(e,t,n=0,r=20,i){let o=x.parse(await _(await a.api.v1.workspace.dashboard.tasks.$get({query:{snapshotId:e,group:t,offset:String(n),limit:String(r)}},{init:{signal:i}}),`/workspace/dashboard/tasks`)),s=Y.get(e);return s!==void 0&&j(s,o.page.rows),o}function Dt(e){return o({queryKey:J.snapshot,queryFn:({signal:e})=>Tt(e),enabled:e,staleTime:5e3,refetchOnMount:`always`,refetchInterval:e?15e3:!1,refetchIntervalInBackground:!1,retry:!1})}function Ot(e){return o({queryKey:J.telemetry,enabled:e,staleTime:0,queryFn:async({signal:e})=>{let t=O.parse(await _(await a.api.v1.workspace.dashboard.telemetry.$get({},{init:{signal:e}}),`/workspace/dashboard/telemetry`));return te.seed(t.samples,t.asOf),t}})}function kt(e,t){let n=o({queryKey:J.feed(e),queryFn:async({signal:t})=>{let n=M(),r=w.parse(await _(await a.api.v1.workspace.dashboard.feed.$get({query:{filter:e}},{init:{signal:t}}),`/workspace/dashboard/feed`));return j(n,r.rows.flatMap(e=>e.kind===`task-result`?[e.run]:[])),r},enabled:t,staleTime:15e3,refetchInterval:t&&e!==`github`?15e3:!1,retry:!1}),r=(0,L.useRef)(!1);return(0,L.useEffect)(()=>{r.current=!1},[e,t]),(0,L.useEffect)(()=>{if(!t||r.current||!n.data?.sources.some(e=>e.reason===`Still loading GitHub`))return;let e=setTimeout(()=>{document.visibilityState!==`hidden`&&(r.current=!0,n.refetch())},5e3);return()=>clearTimeout(e)},[t,n.data,n.refetch]),n}function At(e,t){let n=kt(`tasks`,t&&e!==`github`),r=kt(`github`,t&&e!==`tasks`),i=(0,L.useMemo)(()=>{if(e===`tasks`)return n.data;if(e===`github`)return r.data;let t=n.data,i=r.data;if(!t&&!i)return;let a=t??i,o=new Date(Math.max(Date.parse(t?.asOf??a.asOf),Date.parse(i?.asOf??a.asOf))).toISOString(),s=new Date(Date.parse(o)-10080*60*1e3).toISOString(),c=[...t?.rows??[],...i?.rows??[]].filter(e=>Date.parse(e.at)>=Date.parse(s)&&Date.parse(e.at)<=Date.parse(o)).sort((e,t)=>jt(e,t)),l=new Set(c.slice(60).map(e=>e.kind===`task-result`?`tasks:${e.run.projectId}`:e.key.slice(0,e.key.lastIndexOf(`:`)))),u=[...t?.sources??[],...i?.sources??[]].map(e=>l.has(e.key)?{...e,truncated:!0}:e);return{...a,asOf:o,windowStart:s,filter:`all`,rows:c.slice(0,60),sources:u,coverage:t?.coverage??a.coverage,truncated:c.length>60||!!t?.truncated||!!i?.truncated}},[e,n.data,r.data]),a=e===`github`?r:n;return{...a,data:i,githubError:r.isError,githubFetching:r.isFetching,retryTasks:()=>n.refetch(),retryFailed:()=>e===`github`?r.refetch():e===`tasks`?n.refetch():Promise.all([...n.isError?[n.refetch()]:[],...r.isError?[r.refetch()]:[]]),isPending:!i&&a.isPending,isError:a.isError||e===`all`&&r.isError,isFetching:a.isFetching||e===`all`&&r.isFetching,refetch:()=>e===`tasks`?n.refetch():r.refetch()}}function jt(e,t){return Date.parse(t.at)-Date.parse(e.at)||e.key.localeCompare(t.key)}var Mt=[...v.dashboard,`costs`];function Nt(){let e=0,t=0,n,r=new Set;return{subscribe:e=>(r.add(e),()=>{r.delete(e)}),getSnapshot:()=>n,async read(i,a){let o=++e,s=await Lt(i,a);return!a?.aborted&&o>t&&(t=o,(n?.cost!==s.visibility.cost||n?.tokens!==s.visibility.tokens)&&(n=s.visibility,r.forEach(e=>e()))),s}}}var Pt=new WeakMap;function Ft(e){let t=Pt.get(e);return t||(t=Nt(),Pt.set(e,t)),t}function It(){let e=Ft(r());return(0,L.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot)}var X=new Map;async function Lt(e,t){let n=M(),r=T.parse(await _(await a.api.v1.workspace.dashboard.costs.$get({query:{...e,offset:String(e.offset??0),limit:`20`}},{init:{signal:t}}),`/workspace/dashboard/costs`));!e.snapshotId&&!X.has(r.snapshotId)&&X.set(r.snapshotId,n),X.size>60&&X.delete(X.keys().next().value);let i=X.get(r.snapshotId);return i!==void 0&&j(i,r.tasks.rows),r}function Rt(e,t,n){let i=Ft(r());return o({queryKey:[...Mt,e,t,n],queryFn:({signal:n})=>i.read({period:e,sort:t,tzOffsetMinutes:new Date().getTimezoneOffset()},n),staleTime:5e3,refetchOnMount:`always`,refetchInterval:15e3,refetchIntervalInBackground:!1,retry:!1})}function zt(e,t,n,i){let a=Ft(r());return o({queryKey:[...Mt,`tasks`,e.snapshotId,t,n,i,e.visibility],retry:!1,queryFn:async({signal:r})=>{let o=e.tzOffsetMinutes??new Date().getTimezoneOffset(),c=async s=>{let c=await a.read({period:e.period,sort:n,snapshotId:s,projectId:t,tzOffsetMinutes:o},r),l=[...c.tasks.rows];for(;c.tasks.nextOffset!==null&&l.length<i;)c=await a.read({period:e.period,sort:n,snapshotId:c.snapshotId,projectId:t,offset:c.tasks.nextOffset},r),l.push(...c.tasks.rows);return{...c,tasks:{...c.tasks,rows:l}}};try{return await c(e.snapshotId)}catch(e){if(e instanceof s&&e.status===409)return c();throw e}}})}var Bt={cost:{text:`text-primary`,fill:`bg-primary`,tint:`from-primary/10`,icon:ie},input:{text:`text-violet`,fill:`bg-violet`,tint:`from-violet/10`,icon:Ue},output:{text:`text-info`,fill:`bg-info`,tint:`from-info/10`,icon:fe}};function Vt({metric:e,label:t,value:n,reported:r,total:i}){let a=Bt[e],o=a.icon,s=i?Math.min(100,r/i*100):0;return(0,R.jsxs)(`div`,{className:`${Ze} ${a.tint}`,children:[(0,R.jsxs)(Qe,{label:t,value:n,icon:(0,R.jsx)(o,{className:`size-4 ${a.text}`}),children:[r,` of `,i,` tasks report this metric`]}),(0,R.jsx)(`div`,{className:`mt-2 h-1.5 overflow-hidden rounded-full bg-muted`,"aria-hidden":`true`,children:(0,R.jsx)(`div`,{className:`h-full rounded-full ${a.fill} transition-[width] duration-300 motion-reduce:transition-none`,style:{width:`${s}%`}})})]})}function Ht({projects:e,currentProjects:t,metric:n,field:r,label:i,format:a,onSelect:o}){let s=e.reduce((e,t)=>Math.max(e,t[r]?.value??0),0),c=Bt[n];return(0,R.jsxs)(he,{delayDuration:150,children:[(0,R.jsxs)(`div`,{className:`space-y-1 rounded-xl border p-2`,"aria-label":`Projects ranked by ${i}`,children:[e.length===0&&(0,R.jsx)(`p`,{className:`px-3 py-4 text-muted-foreground`,children:`No projects to compare in this cohort.`}),e.slice(0,5).map((e,n)=>{let l=e[r],u=l?.value,d=u==null||s===0?0:u/s*100,f=u!=null;return(0,R.jsxs)(ge,{children:[(0,R.jsx)(pe,{asChild:!0,children:(0,R.jsxs)(`button`,{"data-export-row":!0,"data-export-keep":!0,className:`group w-full rounded-lg px-3 py-3 text-left transition-colors hover:bg-muted/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50 motion-reduce:transition-none`,disabled:!t.some(t=>t.projectId===e.projectId),onClick:()=>o(e.projectId),children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(`span`,{className:`w-4 shrink-0 text-xs tabular-nums text-muted-foreground`,"aria-hidden":`true`,children:n+1}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1 break-words font-medium`,children:e.projectId}),(0,R.jsx)(`span`,{className:`shrink-0 font-semibold tabular-nums`,children:a(u)}),(0,R.jsx)(Te,{"data-export-exclude":!0,className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":`true`})]}),(0,R.jsx)(`div`,{className:`mt-2 ml-7 h-2 overflow-hidden rounded-full bg-muted`,"aria-hidden":`true`,children:(0,R.jsx)(`div`,{"data-project-bar":e.projectId,className:`h-full rounded-full ${c.fill} transition-[width] duration-300 motion-reduce:transition-none`,style:{width:`${d}%`}})}),(0,R.jsxs)(`p`,{className:`mt-1.5 ml-7 text-xs text-muted-foreground`,children:[l?.reportedTasks??0,` of `,e.tasks,` tasks report this metric`,f?``:` · No measured value`]})]})}),(0,R.jsxs)(me,{className:`max-w-64`,children:[(0,R.jsxs)(`p`,{className:`font-medium`,children:[e.projectId,` · `,i,`: `,a(u)]}),(0,R.jsxs)(`p`,{children:[l?.reportedTasks??0,` of `,e.tasks,` tasks report this metric.`]}),(0,R.jsx)(`p`,{children:`Open project tasks`})]})]},e.projectId)})]}),e.length>0&&(0,R.jsxs)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:[e.length>5?`Top 5 of ${e.length} projects. `:``,`Bar lengths compare reported values; the largest is the reference.`]})]})}var Z={cost:`costUsd`,input:`inputTokens`,output:`outputTokens`},Ut={cost:`Reported USD`,input:`Input tokens`,output:`Output tokens`};function Wt(e,t){return JSON.stringify([e.totals,e.projects,e.tasks,e.visibility,e.coverage,e.invalidDateTasks])!==JSON.stringify([t.totals,t.projects,t.tasks,t.visibility,t.coverage,t.invalidDateTasks])}var Gt=(e,t)=>ht(e,t===`cost`);function Q(e){return[...e.cost?[`cost`]:[],...e.tokens?[`input`,`output`]:[]]}function Kt({value:e,onChange:t,visibility:n}){return(0,R.jsxs)(`label`,{className:`flex min-h-11 items-center gap-2 text-sm`,children:[`Sort by`,(0,R.jsx)(`select`,{className:`min-h-11 rounded-md border bg-background px-3 text-sm`,value:e,onChange:e=>t(e.target.value),children:Q(n).map(e=>(0,R.jsx)(`option`,{value:e,children:Ut[e]},e))})]})}function qt(){return(0,R.jsx)(Jt,{visibility:ke(m().data)})}function Jt({visibility:e}){return(0,R.jsxs)(F,{className:`gap-0 py-0`,children:[(0,R.jsx)(`div`,{className:`border-b px-4 py-3`,children:(0,R.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Usage & cost`})}),!e.cost&&!e.tokens?(0,R.jsx)(`p`,{className:`p-4 text-sm`,children:`Usage metrics are hidden by workspace settings`}):(0,R.jsx)(Yt,{visibility:e},`${e.cost}:${e.tokens}`)]})}function Yt({visibility:e}){let[t,n]=vt(`usagePeriod`,[`all`,`7d`,`30d`],`all`),[r,i]=vt(`usageSort`,Q(e),e.cost?`cost`:`input`);return(0,R.jsx)(Xt,{period:t,setPeriod:n,sort:r,setSort:i,visibility:e})}function Xt({period:e,setPeriod:t,sort:n,setSort:r,visibility:i}){let a=Rt(e,n,`${i.cost}:${i.tokens}`),[o,s]=W(`usage:accepted`,void 0),c=o??a.data,l=a.data??c,[u,d]=W(`usage:panel`,null),[p,m]=(0,L.useState)(e);p!==e&&(m(e),s(void 0),d(null));let h=pt(`usage:${u?.identity??`closed`}`),g=mt(`usage`,`[data-usage-trigger]`),_=e=>{g.capture(),c&&d({identity:dt(),projectId:e,snapshot:c,latestId:l?.snapshotId??c.snapshotId})},v=It()??i,y={cost:i.cost&&v.cost,tokens:i.tokens&&v.tokens},b=Q(y).includes(n)?n:Q(y)[0]??`cost`,x=[...c?.projects??[]].sort((e,t)=>{let n=e[Z[b]]?.value,r=t[Z[b]]?.value;return(n==null?r==null?0:1:r==null?-1:r-n)||e.projectId.localeCompare(t.projectId)});!o&&a.data&&s(a.data);let S=c&&l&&Wt(c,l),C=c?.coverage.projects.some(e=>e.state!==`complete`),w=l?.coverage.projects.some(e=>e.state!==`complete`),T=JSON.stringify(c?.coverage)!==JSON.stringify(l?.coverage),E=c?.totals.tasks===0&&!C&&!w;return(0,R.jsxs)(`div`,{className:`space-y-4 p-4 text-sm`,children:[c&&(0,R.jsx)(z,{rows:E?[]:[...Q(y).map(e=>({section:`totals`,metric:Z[e],value:c.totals[Z[e]]?.value??null,unit:e===`cost`?`USD`:`tokens`,reportedTasks:c.totals[Z[e]]?.reportedTasks??0,totalTasks:c.totals.tasks,asOf:c.asOf})),...(y.cost||y.tokens?x.slice(0,5):[]).map(e=>({section:`project`,entity:e.projectId,metric:Z[b],value:e[Z[b]]?.value??null,unit:b===`cost`?`USD`:`tokens`,reportedTasks:e[Z[b]]?.reportedTasks??0,totalTasks:e.tasks,asOf:c.asOf}))]}),c&&(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,R.jsx)($e,{at:c.asOf})}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`font-medium`,children:`Lifetime totals of retained tasks`}),(0,R.jsxs)(`details`,{className:`mt-1 text-xs text-muted-foreground`,children:[(0,R.jsx)(`summary`,{"data-export-heading":`Metric definitions`,className:`min-h-11 cursor-pointer py-3`,children:`How these metrics work`}),(0,R.jsxs)(`p`,{children:[`Includes archived tasks and subtasks.`,` `,y.cost&&`Reported USD is not an invoice. `,`Missing reports are excluded, not treated as zero. Calendar days use your current UTC offset, including today.`]})]})]}),(0,R.jsxs)(`label`,{className:`flex min-h-11 items-center gap-2`,children:[`Tasks created`,(0,R.jsxs)(`select`,{className:`min-h-11 rounded-md border bg-background px-3 text-sm`,value:e,onChange:e=>t(e.target.value),children:[(0,R.jsx)(`option`,{value:`all`,children:`All time`}),(0,R.jsx)(`option`,{value:`7d`,children:`Last 7 days`}),(0,R.jsx)(`option`,{value:`30d`,children:`Last 30 days`})]})]})]}),e!==`all`&&(0,R.jsx)(`p`,{className:`text-muted-foreground`,children:`Lifetime usage of tasks created in this period — not spending during the period.`}),a.isPending&&(0,R.jsx)(`p`,{children:`Loading usage…`}),a.isError&&(0,R.jsxs)(`p`,{role:`alert`,children:[c?`Showing stale usage. Could not refresh.`:`Could not load usage.`,` `,(0,R.jsx)(f,{className:`min-h-11`,onClick:()=>void a.refetch(),children:`Retry`})]}),S&&(0,R.jsx)(`p`,{role:`status`,children:`Newer usage data is available; displayed values use the previous snapshot.`}),S&&(0,R.jsx)(f,{className:`min-h-11`,variant:`outline`,onClick:()=>s(l),children:`Updates available — Show`}),c&&C&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`p`,{className:`text-muted-foreground`,children:`Coverage of displayed usage:`}),(0,R.jsx)(q,{coverage:c.coverage,retry:()=>void a.refetch()})]}),l&&w&&T&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`p`,{className:`text-muted-foreground`,children:`Current source availability:`}),(0,R.jsx)(q,{coverage:l.coverage,retry:()=>void a.refetch()})]}),c&&(0,R.jsxs)(R.Fragment,{children:[!E&&(0,R.jsx)(`div`,{className:`report-cost-metrics grid gap-3 sm:grid-cols-[repeat(auto-fit,minmax(220px,1fr))]`,children:Q(y).map(e=>(0,R.jsx)(Vt,{metric:e,label:Ut[e],value:Gt(c.totals[Z[e]]?.value,e),reported:c.totals[Z[e]]?.reportedTasks??0,total:c.totals.tasks},e))}),!y.cost&&!y.tokens&&(0,R.jsx)(`p`,{children:`Usage metrics are hidden by workspace settings`}),c.totals.tasks===0?(0,R.jsx)(`p`,{children:C||w?`No retained tasks could be read from available sources.`:`No retained tasks in this cohort.`}):Q(y).every(e=>!c.totals[Z[e]]?.reportedTasks)&&(0,R.jsx)(`p`,{children:`No reports for the visible metrics in this cohort.`}),E&&(0,R.jsx)(`p`,{className:`text-muted-foreground`,children:`Usage appears when tasks report cost or tokens.`}),(0,R.jsxs)(`p`,{className:`text-muted-foreground`,children:[`Deleted tasks are excluded from retained history.`,c.invalidDateTasks?` ${c.invalidDateTasks} tasks have missing or invalid creation dates${e===`all`?`; included in All time`:`; excluded from this period`}.`:``]}),!E&&(y.cost||y.tokens)&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`font-medium`,children:`Top projects`}),(0,R.jsx)(`p`,{className:`text-muted-foreground`,children:`Ranking uses reported metrics only.`})]}),(0,R.jsx)(Kt,{value:b,onChange:r,visibility:y})]}),(0,R.jsx)(Ht,{projects:x,metric:b,label:Ut[b],field:Z[b],format:e=>Gt(e,b),currentProjects:l?.projects??[],onSelect:_}),(0,R.jsx)(f,{"data-usage-trigger":!0,className:`min-h-11`,variant:`outline`,onClick:()=>_(``),children:`View tasks`})]})]}),(0,R.jsx)(se,{open:u!==null&&(y.cost||y.tokens),onOpenChange:e=>{e||d(null)},children:(0,R.jsxs)(oe,{...h,className:`w-full overflow-y-auto sm:max-w-xl`,onCloseAutoFocus:e=>{e.preventDefault(),g.restore()},children:[(0,R.jsxs)(ce,{children:[(0,R.jsx)(le,{children:u?.projectId?`${u.projectId} tasks`:`All tasks`}),(0,R.jsx)(ae,{children:`Lifetime usage of retained tasks. Missing reports are unavailable.`})]}),u!==null&&(0,R.jsx)(Zt,{identity:`usage:${u.identity}`,snapshot:l&&l.snapshotId!==u.latestId?l:u.snapshot,projectId:u.projectId||void 0,visibility:y},u.identity)]})})]})}function Zt({identity:e,snapshot:t,projectId:n,visibility:r}){let[i,a]=W(`${e}:sort`,t.sort);return(0,R.jsx)(Qt,{identity:e,snapshot:t,projectId:n,visibility:r,sort:Q(r).includes(i)?i:Q(r)[0]??`cost`,setSort:a})}function Qt({identity:e,snapshot:t,projectId:n,visibility:r,sort:i,setSort:a}){let[o,s]=W(`${e}:count`,20),[c,l]=W(`${e}:paging`,void 0),[u,d]=(0,L.useState)(t.snapshotId);u!==t.snapshotId&&(d(t.snapshotId),l(void 0));let p=zt(c??t,n,i,o),m=It()??r,h={cost:r.cost&&m.cost,tokens:r.tokens&&m.tokens},g=Q(h).includes(i)?i:Q(h)[0]??`cost`,[_,v]=W(`${e}:accepted`,void 0),[y,b]=W(`${e}:acceptedCount`,o),[x,S]=W(`${e}:acceptedSort`,i),[C,w]=(0,L.useState)(i);C!==i&&(w(i),s(20),l(_??c??t)),p.data&&(!_||(y!==o||x!==i)&&_.snapshotId===p.data.snapshotId)&&(v(p.data),b(o),S(i));let T=_??p.data,E=p.data&&T&&Wt(p.data,T),D=T?.coverage.projects.some(e=>e.state!==`complete`),O=p.data?.coverage.projects.some(e=>e.state!==`complete`),ee=JSON.stringify(T?.coverage)!==JSON.stringify(p.data?.coverage),k=!n||t.projects.some(e=>e.projectId===n);return(0,R.jsxs)(`div`,{className:`space-y-3 p-4 text-sm`,"data-sheet-loading":p.isFetching,children:[(0,R.jsx)(Kt,{value:g,onChange:a,visibility:h}),p.isPending&&(0,R.jsx)(`p`,{children:`Loading tasks…`}),p.isError&&(0,R.jsxs)(`p`,{role:`alert`,children:[`Could not refresh tasks. `,T?`Showing stale usage.`:``,` `,(0,R.jsx)(f,{className:`min-h-11`,onClick:()=>void p.refetch(),children:`Retry`})]}),E&&(0,R.jsx)(f,{className:`min-h-11`,onClick:()=>{v(p.data),b(o),S(i)},children:`Updates available — Show`}),T&&D&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`p`,{className:`text-muted-foreground`,children:`Coverage of displayed tasks:`}),(0,R.jsx)(q,{coverage:T.coverage,retry:()=>void p.refetch()})]}),p.data&&O&&ee&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`p`,{className:`text-muted-foreground`,children:`Current source availability:`}),(0,R.jsx)(q,{coverage:p.data.coverage,retry:()=>void p.refetch()})]}),T&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`p`,{children:[T.tasks.rows.length,` of `,T.tasks.total,` retained tasks`]}),T.tasks.total===0&&(0,R.jsx)(`p`,{children:T.coverage.projects.some(e=>e.state!==`complete`)?`No tasks could be read from available sources.`:`No retained tasks in this cohort.`}),T.tasks.rows.map(e=>(0,R.jsx)($t,{row:e,visibility:h,disabled:!k||!p.data||!!(E&&!p.data?.tasks.rows.some(t=>t.id===e.id&&t.projectId===e.projectId))},`${e.projectId}:${e.id}`)),T.tasks.nextOffset!==null&&(0,R.jsx)(f,{className:`min-h-11`,disabled:p.isFetching,onClick:()=>{l(T),s(e=>e+20)},children:`Show 20 more tasks`})]})]})}function $t({row:e,visibility:t,disabled:n}){let r=A(e);n||=r===null;let i=Oe({status:r?.status??e.status});return(0,R.jsxs)(`div`,{className:`border-b py-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(De,{tone:i.tone,pulse:i.pulse}),(0,R.jsx)(h,{className:`flex min-h-11 items-center break-words font-medium hover:underline`,to:`/p/${encodeURIComponent(e.projectId)}/tasks/${encodeURIComponent(e.id)}`,"aria-disabled":n||void 0,tabIndex:n?-1:void 0,onClick:e=>{n&&e.preventDefault()},children:e.title})]}),(0,R.jsxs)(`p`,{className:`text-muted-foreground`,children:[e.projectId,` · `,n?`Checking current state…`:r?.status??e.status,e.archived?` · Archived`:``,e.subtask?` · Subtask`:``]}),(0,R.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-x-4 gap-y-1 tabular-nums`,children:Q(t).map(t=>(0,R.jsxs)(`span`,{children:[Ut[t],`: `,Gt(e[Z[t]],t)]},t))})]})}var en={cost:`costUsd`,input:`inputTokens`,output:`outputTokens`},tn={cost:`Reported USD`,input:`Input tokens`,output:`Output tokens`};function nn(e){return[...e.cost?[`cost`]:[],...e.tokens?[`input`,`output`]:[]]}var rn=(e,t)=>ht(e,t===`cost`);function an(e){return new Date(`${e}T00:00:00`).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function on({series:e,height:t,accent:n,renderTooltip:r,describe:i}){let a=Math.max(1,...e.map(t));return(0,R.jsxs)(he,{delayDuration:150,children:[(0,R.jsx)(`div`,{className:`flex h-20 items-end gap-0.5`,role:`group`,"aria-label":`Daily trend`,children:e.map(e=>{let o=t(e),s=Math.max(o>0?4:0,o/a*100);return(0,R.jsxs)(ge,{children:[(0,R.jsx)(pe,{asChild:!0,children:(0,R.jsx)(`button`,{"data-export-keep":!0,"aria-label":i(e),type:`button`,className:`min-w-0 flex-1 rounded-t-sm transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,style:{height:`100%`,display:`flex`,alignItems:`end`},children:(0,R.jsx)(`span`,{style:{height:`${s}%`},className:`block w-full rounded-t-sm ${n}`})})}),(0,R.jsx)(me,{children:r(e)})]},e.date)})}),(0,R.jsxs)(`div`,{className:`mt-1 flex justify-between text-xs text-muted-foreground`,children:[(0,R.jsx)(`span`,{children:an(e[0].date)}),(0,R.jsx)(`span`,{children:an(e.at(-1).date)})]})]})}function sn({metrics:e,series:t}){return(0,R.jsxs)(`table`,{className:`w-full text-left text-xs`,children:[(0,R.jsx)(`thead`,{children:(0,R.jsxs)(`tr`,{className:`border-b`,children:[(0,R.jsx)(`th`,{className:`py-1 pr-2 font-medium`,children:`Date`}),e.map(e=>(0,R.jsx)(`th`,{className:`py-1 pr-2 text-right font-medium`,children:tn[e]},e)),(0,R.jsx)(`th`,{className:`py-1 pr-2 text-right font-medium`,children:`Completed`}),(0,R.jsx)(`th`,{className:`py-1 text-right font-medium`,children:`Avg cycle`})]})}),(0,R.jsx)(`tbody`,{children:t.map(t=>(0,R.jsxs)(`tr`,{className:`border-b last:border-0`,children:[(0,R.jsx)(`td`,{className:`py-1 pr-2`,children:an(t.date)}),e.map(e=>(0,R.jsx)(`td`,{className:`py-1 pr-2 text-right tabular-nums`,children:rn(t[en[e]]?.value,e)},e)),(0,R.jsx)(`td`,{className:`py-1 pr-2 text-right tabular-nums`,children:t.completed}),(0,R.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.avgCycleHours===null?`—`:G(t.avgCycleHours)})]},t.date))})]})}function cn({metric:e,series:t}){let n=Bt[e],r=en[e],i=t.reduce((e,t)=>e+(t[r]?.reportedTasks??0),0);return(0,R.jsxs)(`div`,{className:`rounded-xl border p-3`,children:[(0,R.jsx)(`p`,{className:`text-xs font-medium ${n.text}`,children:tn[e]}),(0,R.jsx)(`div`,{className:`mt-2`,children:(0,R.jsx)(on,{series:t,describe:t=>`${t.date}, ${tn[e]}: ${rn(t[r]?.value,e)}, ${t[r]?.reportedTasks??0} of ${t.tasks} tasks reported`,height:e=>e[r]?.value??0,accent:n.fill,renderTooltip:t=>(0,R.jsxs)(`p`,{children:[an(t.date),` · `,rn(t[r]?.value,e),` ·`,` `,t[r]?.reportedTasks??0,`/`,t.tasks,` tasks reported`]})})}),i===0&&(0,R.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`No reports in this period.`})]})}function ln({series:e}){let t=e.reduce((e,t)=>e+t.completed,0),n=e.reduce((e,t)=>e+(t.avgCycleHours??0)*(t.cycleReportedTasks??t.completed),0),r=e.reduce((e,t)=>e+(t.cycleReportedTasks??t.completed),0),i=r?n/r:null;return(0,R.jsxs)(`div`,{className:`rounded-xl border p-3`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-2`,children:[(0,R.jsx)(`p`,{className:`text-xs font-medium text-success`,children:`Completed tasks`}),(0,R.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[t,` done · avg cycle`,` `,i===null?`unavailable`:G(i)]})]}),(0,R.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[r,`/`,t,` completed tasks have valid cycle times.`]}),(0,R.jsx)(`div`,{className:`mt-2`,children:(0,R.jsx)(on,{series:e,describe:e=>`${e.date}: ${e.completed} completed tasks, average cycle ${e.avgCycleHours==null?`Unavailable`:G(e.avgCycleHours)}`,height:e=>e.completed,accent:`bg-success`,renderTooltip:e=>(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`p`,{children:[an(e.date),` · `,e.completed,` completed`]}),(0,R.jsxs)(`p`,{children:[`Avg cycle`,` `,e.avgCycleHours===null?`unavailable`:G(e.avgCycleHours),` · Median`,` `,e.medianCycleHours===null?`unavailable`:G(e.medianCycleHours)]})]})})}),t===0&&(0,R.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`No tasks finished in this period.`})]})}function un(){return(0,R.jsx)(dn,{visibility:ke(m().data)})}function dn({visibility:e}){let[t,n]=vt(`trendPeriod`,[`7d`,`30d`],`7d`),r=Rt(t,e.cost?`cost`:`input`,`${e.cost}:${e.tokens}`),i=r.data,a=i&&i.totals.tasks===0&&i.coverage.projects.every(e=>e.state===`complete`)&&i.series.every(e=>e.tasks===0&&e.completed===0),o=nn({cost:e.cost&&i?.visibility.cost!==!1,tokens:e.tokens&&i?.visibility.tokens!==!1});return(0,R.jsxs)(F,{className:`gap-0 py-0`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b px-4 py-3`,children:[(0,R.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Trends`}),(0,R.jsxs)(`label`,{className:`flex min-h-11 items-center gap-2 text-xs`,children:[`Period`,(0,R.jsxs)(`select`,{className:`min-h-11 rounded-md border bg-background px-2 text-xs`,value:t,onChange:e=>n(e.target.value),children:[(0,R.jsx)(`option`,{value:`7d`,children:`Last 7 days`}),(0,R.jsx)(`option`,{value:`30d`,children:`Last 30 days`})]})]})]}),(0,R.jsxs)(`div`,{className:`space-y-4 p-4 text-sm`,children:[i&&(0,R.jsx)(z,{rows:a?[]:i.series.flatMap(e=>[...o.map(t=>({section:`daily-creation-cohort`,entity:e.date,metric:en[t],value:e[en[t]]?.value??null,unit:t===`cost`?`USD`:`tokens`,reportedTasks:e[en[t]]?.reportedTasks??0,totalTasks:e.tasks,asOf:i.asOf,note:`Lifetime usage grouped by task creation date; not daily spend`})),{section:`daily-completions`,entity:e.date,metric:`completed`,value:e.completed,unit:`tasks`,asOf:i.asOf},{section:`daily-completions`,entity:e.date,metric:`avgCycleHours`,value:e.avgCycleHours,reportedTasks:e.cycleReportedTasks??e.completed,totalTasks:e.completed,unit:`hours`,asOf:i.asOf},{section:`daily-completions`,entity:e.date,metric:`medianCycleHours`,value:e.medianCycleHours,unit:`hours`,asOf:i.asOf}])}),(0,R.jsxs)(`details`,{className:`text-xs text-muted-foreground`,children:[(0,R.jsx)(`summary`,{"data-export-heading":`Metric definitions`,className:`cursor-pointer py-2`,children:`How these metrics work`}),(0,R.jsx)(`p`,{children:`Usage is grouped by creation date, not spending date. Completed tasks are grouped by finish date. Calendar days use your current UTC offset (fixed across the period), including today.`})]}),r.isPending&&(0,R.jsx)(`p`,{children:`Loading trends…`}),r.isError&&(0,R.jsxs)(`p`,{role:`alert`,children:[i?`Showing stale trends. Could not refresh.`:`Could not load trends.`,` `,(0,R.jsx)(f,{className:`min-h-11`,onClick:()=>void r.refetch(),children:`Retry`})]}),i&&(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,R.jsx)($e,{at:i.asOf})}),i&&(0,R.jsx)(q,{coverage:i.coverage,retry:()=>void r.refetch()}),i&&a&&(0,R.jsx)(`p`,{className:`text-muted-foreground`,children:`No retained tasks in this period yet.`}),i&&!a&&i.series.length>0&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`space-y-4`,children:[o.length>0&&(0,R.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-[repeat(auto-fit,minmax(200px,1fr))]`,children:o.map(e=>(0,R.jsx)(cn,{metric:e,series:i.series},e))}),(0,R.jsx)(ln,{series:i.series})]}),(0,R.jsxs)(`details`,{className:`group rounded-lg border bg-muted/20 print:block`,children:[(0,R.jsxs)(`summary`,{"data-export-heading":`Daily data`,className:`flex min-h-11 cursor-pointer list-none items-center gap-2 px-3 text-xs font-medium text-muted-foreground hover:text-foreground [&::-webkit-details-marker]:hidden`,children:[(0,R.jsx)(Ke,{className:`size-4`,"aria-hidden":`true`}),` View data table`,(0,R.jsx)(Ce,{className:`ml-auto size-4 transition-transform group-open:rotate-180`,"aria-hidden":`true`})]}),(0,R.jsx)(`div`,{className:`max-h-80 overflow-auto border-t p-3 print:max-h-none print:overflow-visible`,role:`region`,"aria-label":`Daily trend values`,tabIndex:0,children:(0,R.jsx)(sn,{metrics:o,series:i.series})})]})]})]})]})}function fn(e,t,n,i=!0){let a=r();return o({queryKey:[...J.snapshot,e?.snapshotId,t,n],enabled:i&&!!e,retry:!1,queryFn:async({signal:r})=>{if(!e)throw Error(`Dashboard not loaded`);let i=[];try{for(let a=0;a<n;){let o=await Et(e.snapshotId,t,a,Math.min(20,n-a),r);if(i.push(...o.page.rows),o.page.nextOffset===null)break;a=o.page.nextOffset}return i}catch(e){if(e instanceof s&&e.status===409){let e=await Tt(r);a.setQueryData(J.snapshot,e)}throw e}}})}function pn(e,t,n,i){let a=r(),c=t===`questions`||t===`reviews`?`needs-you`:t,l=c===`needs-you`?0:n,u=i.map(e=>`${e.projectId}:${e.id}`).sort();return o({queryKey:[...J.snapshot,e.snapshotId,t,`displaced`,...u],enabled:u.length>0,retry:!1,queryFn:async({signal:t})=>{let n=new Set(u),r=new Map;try{for(let i=l;i!==null&&n.size;){let a=await Et(e.snapshotId,c,i,20,t);for(let e of a.page.rows){let t=`${e.projectId}:${e.id}`;n.delete(t)&&r.set(t,e)}i=a.page.nextOffset}return r}catch(e){throw e instanceof s&&e.status===409&&a.setQueryData(J.snapshot,await Tt(t)),e}}})}function mn({snapshot:e,questions:t,reviews:n,more:r,healthy:i=!0}){let a=re();return(0,R.jsxs)(F,{className:`min-w-0 gap-0 overflow-hidden py-0`,children:[(0,R.jsxs)(`div`,{className:`border-b p-4`,children:[(0,R.jsxs)(`h2`,{id:`dashboard-needs-you`,tabIndex:-1,className:`text-sm font-semibold`,children:[`Needs you · `,e.counts.questions+e.counts.reviews]}),(0,R.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[e.counts.questions,` questions · `,e.counts.reviews,` reviews`]})]}),i&&a.connected&&e.counts.questions+e.counts.reviews===0&&e.coverage.projects.every(e=>e.state===`complete`)?(0,R.jsx)(`p`,{className:`p-6 text-sm`,children:`All caught up — no tasks need your input`}):null,(0,R.jsx)(hn,{snapshot:e,group:`questions`,count:t,more:r}),(0,R.jsx)(hn,{snapshot:e,group:`reviews`,count:n,more:r})]})}function hn({snapshot:e,group:t,count:n,more:r}){let i=e[t],a=Math.max(n,i.rows.length),o=fn(e,t,a,a>i.rows.length),s=a>i.rows.length?o.data:i.rows,c=at(s,K,t,n),l=pn(e,t,a,c.rows.filter(e=>e.removed).map(e=>e.row)),u=(0,L.useRef)(null);return!i.total&&!c.rows.length?null:(0,R.jsxs)(`section`,{children:[(0,R.jsxs)(`h3`,{ref:u,tabIndex:-1,className:`bg-muted/30 px-4 py-3 text-xs font-semibold uppercase tracking-wide`,children:[t===`questions`?`Questions`:`Reviews`,` · `,i.total]}),c.updates>0&&(0,R.jsxs)(f,{variant:`ghost`,className:`m-2 min-h-11`,onClick:()=>{c.show(),u.current?.focus()},children:[c.updates,` updates — Show`]}),c.rows.map(({row:e,removed:t})=>(0,R.jsx)(_t,{row:l.data?.get(K(e))??e,removed:t&&!!l.data&&!l.data.has(K(e)),checking:s===void 0||t&&!l.data,checkFailed:s===void 0&&o.isError||t&&!l.data&&l.isError,queue:!0},K(e))),(o.isError||l.isError)&&(0,R.jsxs)(`p`,{role:`alert`,className:`p-4 text-sm`,children:[`Could not check current task state.`,` `,(0,R.jsx)(f,{variant:`ghost`,className:`min-h-11`,onClick:()=>{o.refetch(),l.refetch()},children:`Retry`})]}),a<i.total&&(0,R.jsxs)(f,{variant:`ghost`,className:`m-2 min-h-11`,disabled:o.isFetching,onClick:()=>r(t,a+Math.min(20,i.total-a)),children:[`Show `,Math.min(20,i.total-a),` more `,t]})]})}function gn(e){if(!e.startsWith(`github:`))return e===`tasks`?`Task results`:e;let t=e.slice(7).split(`:`),n=t.pop()===`pr`?`Pull requests`:`Issues`;return`${t.join(`:`).replace(/^project:/,`Project `).replace(/^github.com\//,``)} · ${n}`}var _n=e=>e.key;function vn({filter:e,setFilter:t,count:n,more:r}){let i=At(e,!0),a=at(i.data?.rows,_n,`feed:${e}`,0,e=>e.kind===`task-result`),o=a.rows,s=a.updates,c=(0,L.useContext)(rt),l=(0,L.useRef)(null),u=`feed:${e}`,d=(0,L.useMemo)(()=>({scroll:ct(c,u)?.scroll??0,done:!1}),[c,u]);(0,L.useLayoutEffect)(()=>{!l.current||d.done||(l.current.scrollTop=d.scroll,d.done=Math.abs(l.current.scrollTop-d.scroll)<1||!!i.data&&!i.isPending&&!i.isFetching)},[d,o.length,n,i.data,i.isPending,i.isFetching]);let p=(0,L.useRef)(null),m=i.data?.sources.filter(e=>e.key.startsWith(`github:`))??[],h=m.flatMap(e=>e.fetchedAt?[e.fetchedAt]:[]).sort()[0],g=i.githubError,_=m.filter(e=>e.reason===`No GitHub remote`),v=m.some(e=>e.reason===`Still loading GitHub`),y=m.length>0&&_.length===m.length&&!g,b=m.filter(e=>e.state!==`ready`&&e.reason!==`No GitHub remote`&&e.reason!==`Still loading GitHub`),x=y&&e===`all`;return(0,R.jsxs)(F,{"data-export-context":`Results source: ${e}; Last 7 days; loaded ${Math.min(n,o.length)} rows`,className:`min-w-0 gap-0 overflow-hidden py-0`,children:[(0,R.jsxs)(`div`,{className:`space-y-2 border-b px-4 py-3`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,R.jsx)(`h2`,{ref:p,tabIndex:-1,className:`text-sm font-semibold`,children:x?`Recent results`:`Recent results & GitHub`}),(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Last 7 days`})]}),!x&&(0,R.jsx)(N,{slot:`dashboard-feed`,label:`Results source`,value:e,options:[{value:`all`,label:`All`},{value:`tasks`,label:`Tasks`},{value:`github`,label:`GitHub`}],onChange:t}),x&&(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Task results · No GitHub repositories configured`}),e!==`tasks`&&!x&&(0,R.jsxs)(`details`,{className:`text-xs text-muted-foreground`,open:b.length||g?!0:void 0,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer py-2`,children:b.length||g?`GitHub needs attention`:v?`Checking GitHub…`:y?`GitHub not configured`:h?`GitHub checked ${I(h)} ago`:`GitHub source`}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3`,children:[(0,R.jsx)(`p`,{children:b.length||g?h?`Could not refresh GitHub. Showing results from ${new Date(h).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}.`:`Could not load one or more GitHub sources.`:v?`Checking repository sources. Available results remain visible.`:y?`No GitHub repositories configured. Select Tasks to see task results.`:h?`GitHub checked ${I(h)} ago`:`GitHub snapshot`}),!y&&(0,R.jsx)(f,{variant:`ghost`,className:`min-h-11 px-0`,disabled:i.githubFetching,onClick:()=>{i.refetch()},children:i.githubFetching?`Refreshing…`:b.length||g?`Retry GitHub`:`Refresh GitHub`})]})]})]}),(0,R.jsxs)(`div`,{role:`region`,"aria-label":`Recent results list`,ref:l,onWheel:()=>{d.done=!0},onTouchStart:()=>{d.done=!0},onKeyDown:()=>{d.done=!0},onScroll:e=>{c&&d.done&<(c,u,{count:n,scroll:e.currentTarget.scrollTop})},tabIndex:0,className:`max-h-80 overflow-y-auto overscroll-contain focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,children:[i.isError&&(0,R.jsxs)(`p`,{role:`alert`,className:`p-4 text-sm`,children:[`Could not load results.`,` `,(0,R.jsx)(f,{className:`min-h-11`,onClick:()=>{i.retryFailed()},children:`Retry`})]}),i.isPending&&(0,R.jsx)(`p`,{className:`p-4 text-sm`,children:`Loading results…`}),s>0&&(0,R.jsxs)(f,{variant:`ghost`,className:`m-2 min-h-11`,onClick:()=>{a.show(),p.current?.focus()},children:[s,` updates — Show`]}),o.slice(0,n).map(({row:e,removed:t})=>e.kind===`task-result`?(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`p`,{className:`px-4 pt-3 text-xs text-muted-foreground`,children:t?`Outside current results`:`Latest result: ${e.run.status===`failed`?`Failed`:`Completed`}`}),(0,R.jsx)(_t,{row:e.run})]},e.key):(0,R.jsxs)(`div`,{className:`border-b p-4`,children:[(0,R.jsx)(z,{rows:[{section:`github`,entity:`${e.repo}#${e.number}`,metric:e.itemKind,value:e.title,asOf:e.at,note:e.url}]}),(0,R.jsx)(`a`,{className:`block min-h-11 break-words text-sm font-medium hover:underline`,href:e.url,target:`_blank`,rel:`noreferrer`,children:e.title}),(0,R.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.repo,` · `,e.itemKind===`pr`?`PR`:`Issue`,` #`,e.number,` created ·`,` `,I(e.at)]})]},e.key)),i.data&&!i.data.rows.length&&!o.length&&!i.isFetching&&!i.isError&&!b.length&&!v&&i.data.coverage.projects.every(e=>e.state===`complete`)&&(0,R.jsx)(`p`,{className:`p-6 text-sm`,children:`No results in the last 7 days`}),n<o.length&&(0,R.jsxs)(f,{variant:`ghost`,className:`m-2 min-h-11`,onClick:r,children:[`Show `,Math.min(20,o.length-n),` more results`]}),i.data?.truncated&&(0,R.jsx)(`p`,{className:`p-4 text-xs`,children:`Showing the latest 60 results`}),i.data&&(0,R.jsx)(q,{coverage:i.data.coverage,retry:()=>{i.retryTasks()}}),!x&&i.data?.sources.some(e=>e.state!==`ready`||e.truncated)&&(0,R.jsxs)(`details`,{className:`p-4 text-xs`,children:[(0,R.jsx)(`summary`,{className:`min-h-11 cursor-pointer py-2`,children:`Source details`}),i.data.sources.map(e=>(0,R.jsxs)(`p`,{className:`break-words py-1`,children:[gn(e.key),`:`,` `,e.reason===`No GitHub remote`?`Not configured`:e.reason===`Still loading GitHub`?`Checking…`:e.reason??(e.state===`ready`?`Up to date`:e.state),e.truncated?` · capped`:``,e.fetchedAt?` · checked ${I(e.fetchedAt)}`:``]},e.key))]})]})]})}var $=e=>e.replace(/[&<>"']/g,e=>({"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`})[e]),yn=`Visible modules and loaded rows only. Filters and report availability apply. Retained task usage is not an invoice or a complete history.`,bn=`Confidential — internal distribution only`,xn={costUsd:{label:`Reported cost`,usd:!0},inputTokens:{label:`Input tokens`},outputTokens:{label:`Output tokens`},needsYou:{label:`Needs you`},running:{label:`Running now`},completed:{label:`Completed in period`},failed:{label:`Failed outcomes in period`},medianCycleHours:{label:`Median cycle (hours)`}};function Sn(e,t){return e==null?`Unavailable`:typeof e==`string`?e:ht(e,t)}function Cn(e){let t=new Set,n=[];for(let r of e.modules)for(let e of r.rows){if(e.section!==`totals`&&e.section!==`fleet`&&e.section!==`overview`)continue;let i=xn[e.metric];!i||t.has(e.metric)||(t.add(e.metric),n.push({label:i.label,value:Sn(e.value,i.usd),note:[e.metric===`needsYou`||e.metric===`running`?e.note||`Current non-archived state`:r.filters,e.asOf?`Data as of ${e.asOf}`:``,e.reportedTasks==null?``:`${e.reportedTasks} of ${e.totalTasks} tasks reported`].filter(Boolean).join(` · `)}))}return n}function wn(e){let t=e.cloneNode(!0);t.querySelectorAll(`script,style,link,img,iframe,object,embed,input,[hidden],[data-dashboard-export],[data-export-exclude]`).forEach(e=>e.remove()),t.querySelectorAll(`select`).forEach((t,n)=>{let r=e.querySelectorAll(`select`)[n];t.replaceWith(document.createTextNode(`: `+(r?.selectedOptions[0]?.textContent??``)))}),t.querySelectorAll(`[data-export-row],[data-dashboard-row]`).forEach(e=>e.classList.add(`report-row`)),t.querySelectorAll(`summary`).forEach(e=>{let t=document.createElement(`h3`);t.textContent=e.getAttribute(`data-export-heading`)||e.textContent,e.replaceWith(t)}),t.querySelectorAll(`button`).forEach(e=>{if(e.hasAttribute(`data-export-keep`)){let t=document.createElement(`div`);for(let n of[...e.attributes])[`class`,`style`,`title`].includes(n.name)&&t.setAttribute(n.name,n.value);t.append(...e.childNodes),e.replaceWith(t)}else e.remove()}),t.querySelectorAll(`details`).forEach(e=>{let t=document.createElement(`div`);t.className=e.className,t.append(...e.childNodes),e.replaceWith(t)});for(let e of[t,...t.querySelectorAll(`*`)])for(let t of[...e.attributes])(t.name.startsWith(`on`)||[`href`,`src`,`srcset`,`action`,`formaction`,`tabindex`].includes(t.name)||t.name.startsWith(`data-`))&&e.removeAttribute(t.name);return t.removeAttribute(`style`),t.innerHTML}function Tn(e,t,n,r){return{generatedAt:t,source:n,title:r||void 0,notices:[...e.querySelectorAll(`[role=alert],[role=status]`)].filter(e=>!e.closest(`[data-dashboard-module]`)).map(e=>e.textContent?.trim()??``).filter(Boolean),modules:[...e.querySelectorAll(`[data-dashboard-module]`)].map(e=>{let t=[...e.querySelectorAll(`select`)].map(e=>`${e.closest(`label`)?.childNodes[0]?.textContent?.trim()??`Filter`}: ${e.selectedOptions[0]?.textContent}`).concat([...e.querySelectorAll(`[data-export-context]`)].map(e=>e.dataset.exportContext)).join(`; `),n=[...new Set([...e.querySelectorAll(`p,[role="alert"],[role="status"]`)].filter(e=>!e.closest(`table,[data-export-exclude]`)&&!e.querySelector(`p,[role="alert"],[role="status"]`)).map(e=>{let t=e.cloneNode(!0);return t.querySelectorAll(`table,button,select,summary,[data-export-exclude]`).forEach(e=>e.remove()),t.textContent?.trim()}).filter(Boolean))].join(` | `);return{id:e.dataset.dashboardModule,title:e.querySelector(`h2`)?.textContent??e.dataset.dashboardModule,filters:t,notes:n,html:wn(e),rows:[...e.querySelectorAll(`[data-dashboard-export]`)].flatMap(e=>JSON.parse(e.dataset.dashboardExport))}})}}function En(e){let t=e==null?``:String(e);return typeof e==`string`&&/^[\s\uFEFF]*[=+@\-]/.test(t)&&(t=`'${t}`),`"${t.replaceAll(`"`,`""`)}"`}function Dn(e){let t=[[`generated_at`,`source`,`module`,`filters`,`section`,`entity`,`metric`,`value`,`unit`,`availability`,`reported_tasks`,`total_tasks`,`as_of`,`notes`]];for(let n of e.modules){t.push([e.generatedAt,e.source,n.title,n.filters,`context`,``,`scope`,yn,``,``,``,``,``,[...e.title?[`Report title: ${e.title}`]:[],...e.notices,n.notes].join(` | `)]);for(let r of n.rows)t.push([e.generatedAt,e.source,n.title,n.filters,r.section,r.entity,r.metric,r.value,r.unit,r.value===null?`unavailable`:typeof r.value==`number`?`measured`:`reported`,r.reportedTasks,r.totalTasks,r.asOf,r.note])}return``+t.map(e=>e.map(En).join(`,`)).join(`\r
|
|
2
|
-
`)+`\r
|
|
3
|
-
`}function On(e,t){let n=Cn(e);return`<!doctype html><html class="light"><head><meta charset="utf-8"><title>${$(e.title||`Dashboard`)} ${$(e.generatedAt.slice(0,10))}</title>${t.join(``)}<style>
|
|
4
|
-
@page {
|
|
5
|
-
size:A4; margin:14mm 14mm 18mm;
|
|
6
|
-
@bottom-left { content:"${bn}"; font-family:system-ui,sans-serif; font-size:9px; color:var(--muted-foreground); }
|
|
7
|
-
@bottom-right { content:"Page " counter(page) " of " counter(pages); font-family:system-ui,sans-serif; font-size:9px; color:var(--muted-foreground); }
|
|
8
|
-
}
|
|
9
|
-
html,body { height:auto!important; overflow:visible!important; background:var(--background)!important; color:var(--foreground)!important; }
|
|
10
|
-
* { -webkit-print-color-adjust:exact; print-color-adjust:exact; }
|
|
11
|
-
body { margin:0; font:12px/1.5 system-ui,sans-serif; }
|
|
12
|
-
.report-heading { border-bottom:2px solid var(--violet); padding-bottom:16px; margin-bottom:20px; }
|
|
13
|
-
.report-heading h1 { font-size:26px; margin:0 0 8px; }
|
|
14
|
-
.report-heading p { margin:4px 0; color:var(--muted-foreground); }
|
|
15
|
-
.report-confidential { display:inline-block; margin:6px 0; padding:2px 8px; border:1px solid var(--destructive); border-radius:4px; color:var(--destructive); font-size:11px; font-weight:600; letter-spacing:.03em; text-transform:uppercase; }
|
|
16
|
-
.report-summary { margin:0 0 24px; }
|
|
17
|
-
.report-summary h2 { font-size:12px; margin:0 0 10px; text-transform:uppercase; letter-spacing:.04em; color:var(--muted-foreground); }
|
|
18
|
-
.summary-grid { display:flex; flex-wrap:wrap; gap:12px; }
|
|
19
|
-
.summary-tile { flex:1 1 140px; border:1px solid var(--border); border-radius:8px; padding:12px 14px; break-inside:avoid; }
|
|
20
|
-
.summary-value { display:block; font-size:22px; font-weight:600; }
|
|
21
|
-
.summary-label { display:block; font-size:11px; color:var(--muted-foreground); margin-top:2px; }
|
|
22
|
-
.summary-note { display:block; font-size:10px; color:var(--soft-foreground); margin-top:4px; }
|
|
23
|
-
.report-module { margin:0 0 20px; break-before:auto; }
|
|
24
|
-
.report-module h2,.report-module h3 { break-after:avoid; }
|
|
25
|
-
.report-module-usage, .report-module-fleet { break-inside:avoid; }
|
|
26
|
-
.report-module-usage label { min-height:0!important; }
|
|
27
|
-
.report-module-usage .space-y-4 > :not(:last-child) { margin-block-end:8px!important; }
|
|
28
|
-
.report-module-usage .report-row { padding-top:5px!important; padding-bottom:5px!important; }
|
|
29
|
-
.report-cost-metrics { grid-template-columns:repeat(3,minmax(0,1fr))!important; }
|
|
30
|
-
.report-cost-metrics > div { padding:12px!important; break-inside:avoid; }
|
|
31
|
-
.report-cost-metrics .text-3xl { font-size:22px!important; }
|
|
32
|
-
.report-module > :first-child, .report-module header, .report-context { break-after:avoid; }
|
|
33
|
-
.report-module .report-row, .report-module tr { break-inside:avoid; }
|
|
34
|
-
.report-module thead { display:table-header-group; }
|
|
35
|
-
.report-module .report-row { padding-top:8px!important; padding-bottom:8px!important; }
|
|
36
|
-
.report-module a { min-height:0!important; }
|
|
37
|
-
.report-module > div { padding-top:12px!important; padding-bottom:12px!important; }
|
|
38
|
-
.report-module * { overflow:visible !important; max-height: none !important; animation:none!important; transition:none!important; box-shadow:none!important; }
|
|
39
|
-
.report-module a { color:inherit; text-decoration:none; }
|
|
40
|
-
.report-module svg { max-width:24px; }
|
|
41
|
-
.report-module [role=region] > div, .report-module [role=region] > p { break-inside:avoid; }
|
|
42
|
-
.report-module .sr-only { display:none!important; }
|
|
43
|
-
.report-context { font-size:11px; color:var(--muted-foreground); margin:0 0 8px; }
|
|
44
|
-
</style></head><body><header class="report-heading"><h1>${$(e.title||`Dashboard report`)}</h1><p>${$(e.generatedAt)} · ${$(e.source)}</p><span class="report-confidential">${bn}</span><p>${$(yn)}</p>${e.notices.map(e=>`<p>${$(e)}</p>`).join(``)}</header>${n.length?`<section class="report-summary"><h2>Executive summary</h2><div class="summary-grid">${n.map(e=>`<div class="summary-tile"><span class="summary-value">${$(e.value)}</span><span class="summary-label">${$(e.label)}</span>${e.note?`<span class="summary-note">${$(e.note)}</span>`:``}</div>`).join(``)}</div></section>`:``}${e.modules.map(e=>`<section class="report-module${e.id===`usage`?` report-module-usage`:e.id===`fleet`?` report-module-fleet`:``}"><p class="report-context">${$(e.filters)}</p>${e.html}</section>`).join(``)}</body></html>`}function kn({dashboard:e}){let[t,n]=(0,L.useState)(!1),[r,i]=(0,L.useState)(``),[a,o]=(0,L.useState)(!1),[s,c]=(0,L.useState)(``),l=t=>{i(``);try{if(!e.current)return;let r=Tn(e.current,new Date().toISOString(),location.origin,s.trim());if(!r.modules.length){i(`Show at least one dashboard module before exporting.`);return}if(t===`csv`){let e=URL.createObjectURL(new Blob([Dn(r)],{type:`text/csv;charset=utf-8`})),t=document.createElement(`a`);t.href=e,t.download=`dashboard-${r.generatedAt.replaceAll(`:`,`-`)}.csv`,document.body.append(t),t.click(),t.remove(),setTimeout(()=>URL.revokeObjectURL(e),1e3),n(!1)}else{o(!0);let e=[...document.querySelectorAll(`link[rel="stylesheet"],style`)].flatMap(e=>{if(e.tagName===`STYLE`)return[e.outerHTML];let t=e.href;if(new URL(t).origin!==location.origin)return[];let n=document.createElement(`link`);return n.rel=`stylesheet`,n.href=t,[n.outerHTML]}),t=document.createElement(`iframe`);t.title=`Dashboard PDF report`,t.style.cssText=`position:fixed;width:1000px;height:1px;bottom:0;left:0;border:0;opacity:0;pointer-events:none`;let a,s=()=>{clearTimeout(a),t.remove(),o(!1)};t.onload=async()=>{try{let e=t.contentWindow;await e.document.fonts.ready,e.addEventListener(`afterprint`,s,{once:!0}),e.focus(),e.print(),n(!1),o(!1)}catch{s(),i(`Could not open the print dialog. Please try again.`)}},a=setTimeout(s,12e4),t.srcdoc=On(r,e),document.body.append(t)}}catch{o(!1),i(`Could not prepare the export. Please try again.`)}};return(0,R.jsxs)(we,{open:t,onOpenChange:n,children:[(0,R.jsx)(xe,{asChild:!0,children:(0,R.jsxs)(f,{variant:`outline`,className:`min-h-11`,disabled:a,children:[(0,R.jsx)(Ee,{className:`size-4`}),a?`Preparing report…`:`Export`]})}),(0,R.jsxs)(Se,{align:`end`,className:`max-w-[calc(100vw-2rem)] space-y-3`,children:[(0,R.jsx)(`p`,{className:`text-sm font-medium`,children:`Export current dashboard`}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Visible modules, current filters and loaded rows. Hidden metrics are excluded.`}),(0,R.jsxs)(`label`,{className:`block space-y-1 text-xs text-muted-foreground`,children:[`Report title (optional)`,(0,R.jsx)(`input`,{className:`min-h-11 w-full rounded-md border bg-background px-3 text-sm text-foreground`,placeholder:`e.g. Fleet review for leadership`,value:s,onChange:e=>c(e.target.value)})]}),(0,R.jsx)(f,{className:`min-h-11 w-full`,onClick:()=>l(`pdf`),children:`PDF report…`}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Choose Save as PDF in the print dialog.`}),(0,R.jsx)(f,{variant:`outline`,className:`min-h-11 w-full`,onClick:()=>l(`csv`),children:`Download CSV`}),r&&(0,R.jsx)(`p`,{role:`alert`,className:`text-sm`,children:r})]})]})}var An={overview:`Workspace overview`,portfolio:`Projects`,automations:`Automations`,fleet:`Queue & scheduling`,needsYou:`Needs you`,recent:`Recent results & GitHub`,usage:`Usage & cost`,trends:`Trends`};function jn({id:e,children:t,wide:n}){let{attributes:r,listeners:i,setNodeRef:a,setActivatorNodeRef:o,transform:s,isDragging:c}=je({id:e});return(0,R.jsxs)(`section`,{ref:a,"data-dashboard-module":e,className:`min-w-0 ${n?`lg:col-span-2`:``} ${c?`relative z-20 opacity-80`:``}`,style:{transform:s?`translate3d(${s.x}px, ${s.y}px, 0)`:void 0},children:[(0,R.jsx)(`div`,{className:`flex justify-end`,children:(0,R.jsx)(f,{ref:o,variant:`ghost`,className:`min-h-11 min-w-11 cursor-grab touch-none active:cursor-grabbing`,...r,...i,"aria-label":`Move ${An[e]}`,children:(0,R.jsx)(Pe,{className:`size-4 text-muted-foreground`,"aria-hidden":`true`})})}),t]})}function Mn({order:e,modules:t,onOrder:n}){let r=Fe(Ne(Ie,{activationConstraint:{distance:8}}),Ne(ze,{coordinateGetter:Me})),i=e.filter(e=>t[e]),a=new Set([`overview`,`portfolio`,`usage`,`trends`]),o;for(let e of i)a.has(e)?(o&&a.add(o),o=void 0):o=o?void 0:e;o&&a.add(o);let s=e=>`${An[e]}, position ${i.indexOf(e)+1} of ${i.length}`;return(0,R.jsx)(Be,{sensors:r,collisionDetection:Le,accessibility:{announcements:{onDragStart:({active:e})=>`Picked up ${s(e.id)}.`,onDragOver:({active:e,over:t})=>t?`${An[e.id]} moved to position ${i.indexOf(t.id)+1} of ${i.length}.`:void 0,onDragEnd:({active:e,over:t})=>t?`${An[e.id]} dropped at position ${i.indexOf(t.id)+1} of ${i.length}.`:`Order unchanged. ${s(e.id)}.`,onDragCancel:({active:e})=>`Reordering cancelled. ${s(e.id)}.`},screenReaderInstructions:{draggable:`Press Space to pick up a module, use arrow keys to move, Space to drop, or Escape to cancel.`}},onDragEnd:({active:t,over:r})=>{!r||t.id===r.id||n(Ve(e,e.indexOf(t.id),e.indexOf(r.id)))},children:(0,R.jsx)(Ae,{items:i,strategy:Re,children:(0,R.jsx)(`div`,{className:`grid items-start gap-x-5 gap-y-2 lg:grid-cols-2`,children:i.map(e=>(0,R.jsx)(jn,{id:e,wide:a.has(e),children:t[e]},e))})})})}var Nn=[`overview`,`needsYou`,`recent`,`fleet`,`automations`,`portfolio`,`usage`,`trends`],Pn=e=>Nn.includes(e);function Fn(e=[]){let t=e.filter(Pn);return(e=>t.length===e.length&&t.every((t,n)=>t===e[n]))(Nn.filter(e=>e!==`automations`))?[...Nn]:[...new Set([...t.includes(`overview`)?[]:[`overview`],...t,...Nn])]}function In(e=[],t){let n=0;return[...e.map(e=>Pn(e)?t[n++]:e),...t.slice(n)]}function Ln(){let e=p(),t=r(),[n,a]=(0,L.useState)(),[o,s]=(0,L.useState)(!1),c=(0,L.useRef)(void 0),l=(0,L.useRef)(!1),u=b.parse(e.data?.dashboard??{}),f=(0,L.useRef)(u);f.current=u;let m=n?.tiles??{automations:u.tiles?.automations??!0,fleet:u.tiles?.fleet??!0,needsYou:u.tiles?.needsYou??!0,recent:u.tiles?.recent??!0,usage:u.tiles?.usage??!0,trends:u.tiles?.trends??!0},h=Fn(n?.order??u.order),g=(0,L.useRef)({tiles:m,order:h});g.current=n??{tiles:m,order:h};let _=e=>{let t={...g.current,...e};g.current=t,a(t),c.current=t},y=async()=>{if(!(l.current||!c.current)){for(l.current=!0;c.current;){let n=c.current;c.current=void 0;try{e.data||(f.current=b.parse((await i()).dashboard??{}));let r=await d({dashboard:{...f.current,order:In(f.current.order,n.order),tiles:{...f.current?.tiles,...n.tiles}}});t.setQueryData(v.uiState,r),f.current=b.parse(r.dashboard??{}),s(!1),a(e=>e===n?void 0:e)}catch{s(!0),c.current||=n;break}}l.current=!1}},x=(0,L.useRef)(y);return x.current=y,(0,L.useEffect)(()=>()=>{x.current()},[]),(0,L.useEffect)(()=>{if(!n)return;let e=setTimeout(()=>{y()},250);return()=>clearTimeout(e)},[n]),{tiles:m,order:h,setOrder:e=>_({order:Fn(e)}),failed:o,ready:e.data!==void 0||e.isError,setTiles(e){_({tiles:e})},retry:()=>{y()}}}function Rn(e,t){let n=Nn.filter(e=>t.includes(e)),r=0;return e.map(e=>t.includes(e)?n[r++]:e)}function zn(){let e=c(),t=e.state?.dashboardEntry??e.key;return(0,R.jsx)(Bn,{entryKey:t},t)}function Bn({entryKey:e}){let t=c(),[n,r]=u(),i=(0,L.useRef)(ot(e)).current,[a,o]=(0,L.useState)(i?.questions??0),[s,l]=(0,L.useState)(i?.reviews??0),[d,p]=(0,L.useState)(i?.feed??6),m=(0,L.useRef)(null),g=(0,L.useRef)(null),[_,v]=(0,L.useState)(!1),b=Ln(),[x,S]=(0,L.useState)(!1),C=n.get(`view`)===`costs`?`costs`:`overview`,w=C===`costs`?[`usage`,`trends`]:[`fleet`,`needsYou`,`recent`,`automations`],T=C===`costs`?[...w]:[`overview`,`portfolio`,...w],E=Rn(b.order,T),D=()=>b.setTiles({...b.tiles,...Object.fromEntries(w.map(e=>[e,!0]))}),O=b.tiles,k={...O,automations:C===`overview`&&O.automations,fleet:C===`overview`&&O.fleet,needsYou:C!==`costs`&&O.needsYou,recent:C!==`costs`&&O.recent,usage:C===`costs`&&O.usage,trends:C===`costs`&&O.trends},te=n.get(`feed`)===`tasks`?`tasks`:n.get(`feed`)===`github`?`github`:`all`,A=n.get(`panel`),j=A&&[`running`,`queued`,`scheduled`,`needs-you`].includes(A)?A:null,M=k.fleet||k.needsYou||k.recent&&te!==`github`||!!j,N=Dt(b.ready&&M),ie=re();Ot(b.ready&&k.fleet&&x);let P=(0,L.useRef)({questions:a,reviews:s,feed:d,scroll:i?.scroll??0,focus:i?.focus});P.current={...P.current,questions:a,reviews:s,feed:d},(0,L.useEffect)(()=>{let t=m.current?.closest(`main`)??m.current,n=()=>{P.current.scroll=t?.scrollTop??0},r=()=>{P.current.focus=document.activeElement?.closest(`[data-dashboard-row]`)?.getAttribute(`data-dashboard-row`)??void 0};return t?.addEventListener(`scroll`,n),document.addEventListener(`focusin`,r),()=>{st(e,P.current),t?.removeEventListener(`scroll`,n),document.removeEventListener(`focusin`,r)}},[e]);let ue=(0,L.useRef)(!1),de=b.ready&&(!M||!!N.data&&!N.isFetching);(0,L.useEffect)(()=>{if(!i||ue.current||!de)return;let e=!1,t=()=>{if(e)return!0;let t=m.current?.closest(`main`)??m.current;t&&(t.scrollTop=i.scroll);let n=!!t&&Math.abs(t.scrollTop-i.scroll)<1;if(!i.focus)return n;let r=document.querySelector(`[data-dashboard-row="${CSS.escape(i.focus)}"] a`);return r?(r.focus({preventScroll:!0}),n):(document.getElementById(`dashboard-needs-you`)?.focus({preventScroll:!0}),!1)},n=()=>{t()&&o()},r=new MutationObserver(n),a=typeof ResizeObserver>`u`?null:new ResizeObserver(n),o=()=>{e=!0,ue.current=!0,r.disconnect(),a?.disconnect()},s=requestAnimationFrame(()=>{n(),e||(r.observe(document.body,{childList:!0,subtree:!0}),m.current&&a?.observe(m.current))}),c=setTimeout(o,5e3),l=[`pointerdown`,`keydown`,`wheel`,`touchstart`];for(let e of l)document.addEventListener(e,o,{once:!0});return()=>{cancelAnimationFrame(s),clearTimeout(c),e=!0,r.disconnect(),a?.disconnect();for(let e of l)document.removeEventListener(e,o)}},[i,de]);let fe=i=>{let a=new URLSearchParams(n);i?a.set(`panel`,i):a.delete(`panel`),r(a,{replace:!0,state:{...t.state,dashboardEntry:e}})},pe=(e,t)=>{g.current=t,fe(e)},me=N.data?N.data.counts.questions+N.data.counts.reviews:0;return(0,R.jsx)(rt.Provider,{value:e,children:(0,R.jsx)(it.Provider,{value:!i||!N.isFetching&&!N.isError,children:(0,R.jsxs)(`div`,{ref:m,"data-route":`dashboard`,className:`mx-auto w-full max-w-[1440px] space-y-5 p-4 md:p-6`,children:[(0,R.jsxs)(`header`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h1`,{className:`text-xl font-semibold`,children:`Dashboard`}),(0,R.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Across your workspace · Includes subtasks`})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,R.jsx)(kn,{dashboard:m}),(0,R.jsxs)(we,{open:_,onOpenChange:v,children:[(0,R.jsx)(xe,{asChild:!0,children:(0,R.jsxs)(f,{variant:`outline`,className:`min-h-11`,children:[(0,R.jsx)(ee,{className:`size-4`}),`Customize`]})}),(0,R.jsxs)(Se,{align:`end`,className:`max-h-[min(32rem,80dvh)] max-w-[calc(100vw-2rem)] overflow-y-auto`,children:[(0,R.jsx)(`p`,{className:`mb-3 text-sm font-medium`,children:`Optional modules in this view`}),w.map(e=>(0,R.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:O[e],disabled:!b.ready,onChange:t=>b.setTiles({...O,[e]:t.target.checked})}),{automations:`Automations`,fleet:`Queue & scheduling`,needsYou:`Needs you`,recent:`Recent results & GitHub`,usage:`Usage & cost`,trends:`Trends`}[e]]},e)),(0,R.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`Drag a module by its handle. With keyboard: Space, arrow keys, Space. Escape cancels.`}),b.order.some((e,t)=>e!==E[t])&&(0,R.jsxs)(f,{variant:`ghost`,className:`min-h-11`,onClick:()=>b.setOrder(E),children:[`Reset `,C===`overview`?`Overview`:`Usage & cost`,` order`]}),(0,R.jsx)(`p`,{className:`my-3 text-xs text-muted-foreground`,children:`Shared across browsers using this workspace`}),w.some(e=>!O[e])&&(0,R.jsxs)(f,{variant:`outline`,className:`min-h-11`,disabled:!b.ready,onClick:()=>{D(),v(!1)},children:[`Show all in `,C===`overview`?`Overview`:`Usage & cost`]})]})]})]})]}),(0,R.jsx)(`nav`,{"aria-label":`Dashboard views`,className:`flex flex-wrap gap-2 border-b pb-3`,children:[[`overview`,`Overview`],[`costs`,`Usage & cost`]].map(([r,i])=>{let a=new URLSearchParams(n);return a.set(`view`,r),a.delete(`panel`),(0,R.jsx)(f,{asChild:!0,variant:C===r?`outline`:`ghost`,className:`min-h-11`,children:(0,R.jsx)(h,{"aria-current":C===r?`page`:void 0,to:`?${a}`,replace:C===r,state:{...t.state,dashboardEntry:C===r?e:void 0},children:i})},r)})}),b.failed&&(0,R.jsxs)(`p`,{role:`alert`,className:`text-sm`,children:[`Layout changed for this session, but could not be saved.`,` `,(0,R.jsx)(f,{variant:`ghost`,className:`min-h-11`,onClick:b.retry,children:`Retry saving`})]}),M&&!ie.connected&&N.data&&(0,R.jsxs)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:[`Tasks disconnected · Last updated `,I(N.data.asOf),` ago`]}),M&&N.isError&&(0,R.jsxs)(`p`,{role:`alert`,className:`rounded-md border p-4 text-sm`,children:[`Could not refresh dashboard.`,` `,N.data?`Showing the last available task state.`:``,` `,(0,R.jsx)(f,{className:`min-h-11`,onClick:()=>{N.refetch()},children:`Retry`})]}),C!==`overview`&&!Object.values(k).some(Boolean)?(0,R.jsx)(y,{icon:(0,R.jsx)(ne,{}),title:`All modules in this view are hidden`,actions:(0,R.jsx)(f,{className:`min-h-11`,onClick:()=>D(),children:`Show all in Usage & cost`})}):null,N.isPending&&(k.fleet||k.needsYou)&&(0,R.jsx)(`p`,{className:`text-sm`,children:`Loading dashboard…`}),M&&N.data&&(0,R.jsx)(q,{coverage:N.data.coverage,count:me,retry:()=>void N.refetch()}),(0,R.jsx)(St,{active:C===`overview`,onCurrent:pe,children:i=>b.ready&&(0,R.jsx)(Mn,{order:b.order,onOrder:b.setOrder,modules:{...i,automations:k.automations?(0,R.jsx)(et,{}):null,fleet:k.fleet&&N.data?(0,R.jsxs)(F,{className:`gap-0 py-0`,children:[(0,R.jsx)(z,{rows:Object.entries({queued:N.data.counts.queued,scheduled:N.data.counts.scheduled,monitoring:N.data.counts.monitoring}).map(([e,t])=>({section:`fleet`,metric:e,value:t,unit:`tasks`,asOf:N.data.asOf}))}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b px-4 py-3`,children:[(0,R.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Queue & scheduling`}),(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:ie.connected?`Tasks connected`:`Tasks disconnected`})]}),(0,R.jsx)(`div`,{className:`grid grid-cols-2 divide-x`,children:[[`queued`,`Queued`,N.data.counts.queued],[`scheduled`,`Scheduled`,N.data.counts.scheduled]].map(([e,t,n])=>(0,R.jsxs)(`button`,{"data-export-keep":!0,"aria-label":`${t}: ${n}`,className:`min-h-24 p-4 text-left hover:bg-muted/50 focus-visible:outline-ring`,onClick:t=>pe(e,t.currentTarget),children:[(0,R.jsx)(`span`,{className:`block text-2xl font-semibold tabular-nums`,children:n}),(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t})]},e))}),(0,R.jsxs)(`details`,{open:x,onToggle:e=>S(e.currentTarget.open),className:`border-t px-4 py-3 text-xs text-muted-foreground`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer py-2`,children:`Technical details`}),(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-x-5 gap-y-2`,children:[(0,R.jsxs)(`span`,{children:[N.data.counts.monitoring,` monitoring (included in Running)`]}),(0,R.jsx)(`span`,{children:`Agent processes`}),x&&(0,R.jsx)(Vn,{running:N.data.counts.running})]})]})]}):null,needsYou:k.needsYou&&N.data?(0,R.jsx)(mn,{healthy:!N.isError,snapshot:N.data,questions:a,reviews:s,more:(e,t)=>e===`questions`?o(t):l(t)}):null,recent:k.recent?(0,R.jsx)(vn,{filter:te,setFilter:i=>{let a=new URLSearchParams(n);a.set(`feed`,i||`all`),r(a,{replace:!0,state:{...t.state,dashboardEntry:e}}),p(6)},count:d,more:()=>p(e=>Math.min(60,e+20))}):null,usage:k.usage?(0,R.jsx)(qt,{}):null,trends:k.trends?(0,R.jsx)(un,{}):null}})}),(0,R.jsx)(se,{open:!!j,onOpenChange:e=>{e||fe(null)},children:(0,R.jsxs)(oe,{className:`w-full overflow-y-auto sm:max-w-lg`,onCloseAutoFocus:e=>{e.preventDefault(),g.current?.focus()},children:[(0,R.jsxs)(ce,{children:[(0,R.jsxs)(le,{children:[j===`needs-you`?`Needs you`:j?j[0].toUpperCase()+j.slice(1):`Tasks`,N.data&&j?` · ${j===`needs-you`?me:N.data.counts[j]}`:``]}),(0,R.jsx)(ae,{children:`Includes subtasks. Open a task to continue in its project.`})]}),!N.data&&N.isPending&&(0,R.jsx)(`p`,{className:`p-4`,role:`status`,children:`Loading tasks…`}),!N.data&&N.isError&&(0,R.jsxs)(`p`,{className:`p-4`,role:`alert`,children:[`Could not load tasks.`,` `,(0,R.jsx)(f,{className:`min-h-11`,onClick:()=>{N.refetch()},children:`Retry`})]}),j&&N.data&&(0,R.jsx)(Hn,{snapshot:N.data,group:j},j)]})})]})})})}function Vn({running:e}){let{connected:t,samples:n}=re(),r=t?n:[],i=r.filter(e=>e.cpuPct!==null);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(z,{rows:[{section:`telemetry`,metric:`cpuPct`,value:i.length?i.reduce((e,t)=>e+(t.cpuPct??0),0):null,unit:`%`,reportedTasks:i.length,totalTasks:e,note:`Sum of sampled processes; may exceed 100%`},{section:`telemetry`,metric:`rssBytes`,value:r.length?r.reduce((e,t)=>e+t.rssBytes,0):null,unit:`bytes`,reportedTasks:r.length,totalTasks:e}]}),(0,R.jsxs)(`span`,{children:[`CPU`,` `,i.length?`${Math.round(i.reduce((e,t)=>e+(t.cpuPct??0),0))}%`:`unavailable`,` `,`· `,i.length,`/`,e,` measured`]}),(0,R.jsxs)(`span`,{children:[`RSS`,` `,r.length?`${(r.reduce((e,t)=>e+t.rssBytes,0)/1024**3).toFixed(1)} GiB`:`unavailable`,` `,`· `,r.length,`/`,e,` measured`]}),(0,R.jsx)(`span`,{children:`RSS sums process resident memory; CPU may exceed 100%.`})]})}function Hn({snapshot:e,group:t}){let n=(0,L.useContext)(rt),r=(0,L.useRef)(ct(n,t)).current,[i,a]=(0,L.useState)(r?.count??20),o=(0,L.useRef)(null),s=(0,L.useRef)({count:i,scroll:r?.scroll??0});s.current.count=i,(0,L.useEffect)(()=>{let e=o.current?.closest(`[data-slot="sheet-content"]`),r=()=>{s.current.scroll=e?.scrollTop??0};return e?.addEventListener(`scroll`,r),()=>{lt(n,t,s.current),e?.removeEventListener(`scroll`,r)}},[n,t]);let c=fn(e,t,i),l=at(c.data,K,`panel:${t}`,i),u=pn(e,t,i,l.rows.filter(e=>e.removed).map(e=>e.row)),d=(0,L.useRef)(null),p=(0,L.useRef)(!1);(0,L.useEffect)(()=>{if(!c.data||!r||p.current)return;p.current=!0;let e=o.current?.closest(`[data-slot="sheet-content"]`);e&&(e.scrollTop=r.scroll)},[c.data,r]);let m=t===`needs-you`?e.counts.questions+e.counts.reviews:e.counts[t];return(0,R.jsxs)(`div`,{ref:o,children:[(0,R.jsx)(`h3`,{ref:d,tabIndex:-1,className:`sr-only`,children:`Tasks`}),c.isPending&&(0,R.jsx)(`p`,{className:`p-4`,children:`Loading tasks…`}),(c.isError||u.isError)&&(0,R.jsxs)(`p`,{className:`p-4`,role:`alert`,children:[`Could not check current task state.`,` `,(0,R.jsx)(f,{className:`min-h-11`,onClick:()=>{c.refetch(),u.refetch()},children:`Retry`})]}),l.updates>0&&(0,R.jsxs)(f,{className:`m-4 min-h-11`,onClick:()=>{l.show(),d.current?.focus()},children:[l.updates,` updates — Show`]}),l.rows.map(({row:e,removed:n})=>(0,R.jsx)(_t,{row:u.data?.get(K(e))??e,removed:n&&!!u.data&&!u.data.has(K(e)),checking:!c.data||n&&!u.data,checkFailed:!c.data&&c.isError||n&&!u.data&&u.isError,queue:t===`needs-you`},K(e))),i<m&&(0,R.jsxs)(f,{className:`m-4 min-h-11`,disabled:c.isFetching,onClick:()=>a(e=>e+20),children:[`Show `,Math.min(20,m-i),` more tasks`]})]})}export{zn as DashboardRoute};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./rolldown-runtime-QTnfLwEv.js";import{i as e,t}from"./react-runtime-CCIEwYL0.js";import{a as n}from"./centered-state-DJLgwvA4.js";import{t as r}from"./utils-DoBmOlX3.js";import{t as i}from"./x-HXr9KZBr.js";import{a,i as o,n as s,o as c,r as l,s as u,t as d}from"./dist-BvXEdcbG.js";e();var f=t();function p({...e}){return(0,f.jsx)(d,{"data-slot":`dialog`,...e})}function m({...e}){return(0,f.jsx)(c,{"data-slot":`dialog-portal`,...e})}function h({...e}){return(0,f.jsx)(s,{"data-slot":`dialog-close`,...e})}function g({className:e,...t}){return(0,f.jsx)(a,{"data-slot":`dialog-overlay`,className:r(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function _({className:e,children:t,showCloseButton:n=!0,...a}){return(0,f.jsxs)(m,{"data-slot":`dialog-portal`,children:[(0,f.jsx)(g,{}),(0,f.jsxs)(l,{"data-slot":`dialog-content`,className:r(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-card p-6 shadow-modal duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg`,e),...a,children:[t,n&&(0,f.jsxs)(s,{"data-slot":`dialog-close`,className:`absolute top-4 right-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,f.jsx)(i,{}),(0,f.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function v({className:e,...t}){return(0,f.jsx)(`div`,{"data-slot":`dialog-header`,className:r(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function y({className:e,showCloseButton:t=!1,children:i,...a}){return(0,f.jsxs)(`div`,{"data-slot":`dialog-footer`,className:r(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...a,children:[i,t&&(0,f.jsx)(s,{asChild:!0,children:(0,f.jsx)(n,{variant:`outline`,children:`Close`})})]})}function b({className:e,...t}){return(0,f.jsx)(u,{"data-slot":`dialog-title`,className:r(`text-lg leading-none font-semibold`,e),...t})}function x({className:e,...t}){return(0,f.jsx)(o,{"data-slot":`dialog-description`,className:r(`text-sm text-muted-foreground`,e),...t})}export{y as a,x as i,h as n,v as o,_ as r,b as s,p as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./react-runtime-CCIEwYL0.js";import{a as t}from"./centered-state-DJLgwvA4.js";import{r as n,t as r}from"./utils-DoBmOlX3.js";import{Y as i}from"./index-CSNFuBvj.js";var a=n(`git-commit-horizontal`,[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]]),o=n(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),s=e();function c({mode:e,wrap:n,onModeChange:i,onWrapChange:a}){return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(`span`,{"data-slot":`diff-mode-toggle`,role:`group`,"aria-label":`Diff layout`,className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,s.jsx)(l,{current:e,value:`unified`,onModeChange:i}),(0,s.jsx)(l,{current:e,value:`split`,onModeChange:i})]}),(0,s.jsx)(t,{variant:`ghost`,size:`icon-sm`,"data-slot":`wrap-toggle`,"aria-pressed":n,"aria-label":`Wrap long lines`,title:`Wrap long lines`,className:r(n&&`bg-muted text-foreground`),onClick:()=>a(!n),children:(0,s.jsx)(o,{"aria-hidden":`true`})})]})}function l({current:e,value:t,onModeChange:n}){let i=e===t;return(0,s.jsx)(`button`,{type:`button`,"data-mode":t,"aria-pressed":i,onClick:()=>n(t),className:r(`rounded-[5px] px-2 py-0.5 text-[11px] font-medium capitalize`,i?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:t})}function u({branch:e}){return(0,s.jsxs)(`span`,{"data-slot":`branch-chip`,className:`flex min-w-0 items-center gap-1 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-[11px] font-medium`,children:[(0,s.jsx)(i,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,s.jsx)(`span`,{className:`truncate`,children:e})]})}export{c as n,a as r,u as t};
|
|
@@ -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{D as r,_ as i,b as a,c as o,d as s,f as c,g as l,h as u,l as d,p as f,s as p,u as m,w as h,x as g,y as _}from"./centered-state-DJLgwvA4.js";var v=e(t(),1),y=n(),b=`Dialog`,[x,S]=a(b),[C,w]=x(b),T=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=v.useRef(null),l=v.useRef(null),[d,f]=i({prop:r,defaultProp:a??!1,onChange:o,caller:b});return(0,y.jsx)(C,{scope:t,triggerRef:c,contentRef:l,contentId:u(),titleId:u(),descriptionId:u(),open:d,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(e=>!e),[f]),modal:s,children:n})};T.displayName=b;var E=`DialogTrigger`,D=v.forwardRef((e,t)=>{let{__scopeDialog:n,...i}=e,a=w(E,n),o=r(t,a.triggerRef);return(0,y.jsx)(g.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":q(a.open),...i,ref:o,onClick:_(e.onClick,a.onOpenToggle)})});D.displayName=E;var O=`DialogPortal`,[k,A]=x(O,{forceMount:void 0}),j=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=w(O,t);return(0,y.jsx)(k,{scope:t,forceMount:n,children:v.Children.map(r,e=>(0,y.jsx)(l,{present:n||a.open,children:(0,y.jsx)(m,{asChild:!0,container:i,children:e})}))})};j.displayName=O;var M=`DialogOverlay`,N=v.forwardRef((e,t)=>{let n=A(M,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=w(M,e.__scopeDialog);return a.modal?(0,y.jsx)(l,{present:r||a.open,children:(0,y.jsx)(F,{...i,ref:t})}):null});N.displayName=M;var P=h(`DialogOverlay.RemoveScroll`),F=v.forwardRef((e,t)=>{let{__scopeDialog:n,...i}=e,a=w(M,n),s=r(t,f());return(0,y.jsx)(o,{as:P,allowPinchZoom:!0,shards:[a.contentRef],children:(0,y.jsx)(g.div,{"data-state":q(a.open),...i,ref:s,style:{pointerEvents:`auto`,...i.style}})})}),I=`DialogContent`,L=v.forwardRef((e,t)=>{let n=A(I,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=w(I,e.__scopeDialog);return(0,y.jsx)(l,{present:r||a.open,children:a.modal?(0,y.jsx)(R,{...i,ref:t}):(0,y.jsx)(z,{...i,ref:t})})});L.displayName=I;var R=v.forwardRef((e,t)=>{let n=w(I,e.__scopeDialog),i=v.useRef(null),a=r(t,n.contentRef,i);return v.useEffect(()=>{let e=i.current;if(e)return p(e)},[]),(0,y.jsx)(B,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:_(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:_(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:_(e.onFocusOutside,e=>e.preventDefault())})}),z=v.forwardRef((e,t)=>{let n=w(I,e.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return(0,y.jsx)(B,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),B=v.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,l=w(I,n);return d(),(0,y.jsx)(y.Fragment,{children:(0,y.jsx)(s,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,y.jsx)(c,{role:`dialog`,id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":q(l.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>l.onOpenChange(!1)})})})}),V=`DialogTitle`,H=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(V,n);return(0,y.jsx)(g.h2,{id:i.titleId,...r,ref:t})});H.displayName=V;var U=`DialogDescription`,W=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(U,n);return(0,y.jsx)(g.p,{id:i.descriptionId,...r,ref:t})});W.displayName=U;var G=`DialogClose`,K=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(G,n);return(0,y.jsx)(g.button,{type:`button`,...r,ref:t,onClick:_(e.onClick,()=>i.onOpenChange(!1))})});K.displayName=G;function q(e){return e?`open`:`closed`}export{N as a,D as c,W as i,S as l,K as n,j as o,L as r,H as s,T as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{D as i,b as a,m as o,v as s,x as c}from"./centered-state-DJLgwvA4.js";var l=e(n(),1),u=r(),d=e(t(),1);function f(e){let[t,n]=d.useState(void 0);return s(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var p=[`top`,`right`,`bottom`,`left`],m=Math.min,h=Math.max,g=Math.round,_=Math.floor,v=e=>({x:e,y:e}),y={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function b(e,t,n){return h(e,m(t,n))}function x(e,t){return typeof e==`function`?e(t):e}function S(e){return e.split(`-`)[0]}function C(e){return e.split(`-`)[1]}function w(e){return e===`x`?`y`:`x`}function T(e){return e===`y`?`height`:`width`}function E(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function D(e){return w(E(e))}function O(e,t,n){n===void 0&&(n=!1);let r=C(e),i=D(e),a=T(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=L(o)),[o,L(o)]}function k(e){let t=L(e);return[A(e),t,A(t)]}function A(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var j=[`left`,`right`],M=[`right`,`left`],N=[`top`,`bottom`],P=[`bottom`,`top`];function F(e,t,n){switch(e){case`top`:case`bottom`:return n?t?M:j:t?j:M;case`left`:case`right`:return t?N:P;default:return[]}}function I(e,t,n,r){let i=C(e),a=F(S(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(A)))),a}function L(e){let t=S(e);return y[t]+e.slice(t.length)}function R(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function z(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:R(e)}function B(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function V(e,t,n){let{reference:r,floating:i}=e,a=E(t),o=D(t),s=T(o),c=S(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=C(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function ee(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=x(t,e),p=z(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=B(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=B(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var te=50,ne=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:ee},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=V(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<te&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=V(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},re=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=x(e,t)||{};if(l==null)return{};let d=z(u),f={x:n,y:r},p=D(i),h=T(p),g=await o.getDimensions(l),_=p===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,S=_?`clientHeight`:`clientWidth`,w=a.reference[h]+a.reference[p]-f[p]-a.floating[h],E=f[p]-a.reference[p],O=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),k=O?O[S]:0;(!k||!await(o.isElement==null?void 0:o.isElement(O)))&&(k=s.floating[S]||a.floating[h]);let A=w/2-E/2,j=k/2-g[h]/2-1,M=m(d[v],j),N=m(d[y],j),P=k-g[h]-N,F=k/2-g[h]/2+A,I=b(M,F,P),L=!c.arrow&&C(i)!=null&&F!==I&&a.reference[h]/2-(F<M?M:N)-g[h]/2<0,R=L?F<M?F-M:F-P:0;return{[p]:f[p]+R,data:{[p]:I,centerOffset:F-I-R,...L&&{alignmentOffset:R}},reset:L}}}),ie=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=x(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=S(r),_=E(o),v=S(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[L(o)]:k(o)),C=p!==`none`;!d&&C&&b.push(...I(o,m,p,y));let w=[o,...b],T=await s.detectOverflow(t,h),D=[],A=i.flip?.overflows||[];if(l&&D.push(T[g]),u){let e=O(r,a,y);D.push(T[e[0]],T[e[1]])}if(A=[...A,{placement:r,overflows:D}],!D.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=w[e];if(t&&(!(u===`alignment`&&_!==E(t))||A.every(e=>E(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:A},reset:{placement:t}};let n=A.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=A.filter(e=>{if(C){let t=E(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function ae(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function oe(e){return p.some(t=>e[t]>=0)}var se=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=x(e,t);switch(i){case`referenceHidden`:{let e=ae(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:oe(e)}}}case`escaped`:{let e=ae(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:oe(e)}}}default:return{}}}}},ce=new Set([`left`,`top`]);async function le(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=S(n),s=C(n),c=E(n)===`y`,l=ce.has(o)?-1:1,u=a&&c?-1:1,d=x(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var ue=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await le(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},de=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=x(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=E(i),p=w(f),m=u[p],h=u[f],g=(e,t)=>b(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},fe=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=x(e,t),u={x:n,y:r},d=E(i),f=w(d),p=u[f],m=u[d],h=x(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=ce.has(S(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},pe=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=x(e,t),c=await i.detectOverflow(t,s),l=S(n),u=C(n),d=E(n)===`y`,{width:f,height:p}=r.floating,g,_;l===`top`||l===`bottom`?(g=l,_=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(_=l,g=u===`end`?`top`:`bottom`);let v=p-c.top-c.bottom,y=f-c.left-c.right,b=m(p-c[g],v),w=m(f-c[_],y),T=t.middlewareData.shift,D=!T,O=b,k=w;T!=null&&T.enabled.x&&(k=y),T!=null&&T.enabled.y&&(O=v),D&&!u&&(d?k=f-2*h(c.left,c.right):O=p-2*h(c.top,c.bottom)),await o({...t,availableWidth:k,availableHeight:O});let A=await i.getDimensions(a.floating);return f!==A.width||p!==A.height?{reset:{rects:!0}}:{}}}};function me(){return typeof window<`u`}function H(e){return he(e)?(e.nodeName||``).toLowerCase():`#document`}function U(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function W(e){return((he(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function he(e){return me()?e instanceof Node||e instanceof U(e).Node:!1}function G(e){return me()?e instanceof Element||e instanceof U(e).Element:!1}function K(e){return me()?e instanceof HTMLElement||e instanceof U(e).HTMLElement:!1}function ge(e){return!me()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof U(e).ShadowRoot}function _e(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Y(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function ve(e){return/^(table|td|th)$/.test(H(e))}function ye(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var be=/transform|translate|scale|rotate|perspective|filter/,xe=/paint|layout|strict|content/,q=e=>!!e&&e!==`none`,Se;function Ce(e){let t=G(e)?Y(e):e;return q(t.transform)||q(t.translate)||q(t.scale)||q(t.rotate)||q(t.perspective)||!Te()&&(q(t.backdropFilter)||q(t.filter))||be.test(t.willChange||``)||xe.test(t.contain||``)}function we(e){let t=X(e);for(;K(t)&&!J(t);){if(Ce(t))return t;if(ye(t))return null;t=X(t)}return null}function Te(){return Se??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Se}function J(e){return/^(html|body|#document)$/.test(H(e))}function Y(e){return U(e).getComputedStyle(e)}function Ee(e){return G(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function X(e){if(H(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||ge(e)&&e.host||W(e);return ge(t)?t.host:t}function De(e){let t=X(e);return J(t)?(e.ownerDocument||e).body:K(t)&&_e(t)?t:De(t)}function Z(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=De(e),i=r===e.ownerDocument?.body,a=U(r);if(i){let e=Oe(a);return t.concat(a,a.visualViewport||[],_e(r)?r:[],e&&n?Z(e):[])}else return t.concat(r,Z(r,[],n))}function Oe(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ke(e){let t=Y(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=K(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=g(n)!==a||g(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Ae(e){return G(e)?e:e.contextElement}function Q(e){let t=Ae(e);if(!K(t))return v(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=ke(t),o=(a?g(n.width):n.width)/r,s=(a?g(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var je=v(0);function Me(e){let t=U(e);return!Te()||!t.visualViewport?je:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ne(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===U(e)}function $(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Ae(e),o=v(1);t&&(r?G(r)&&(o=Q(r)):o=Q(e));let s=Ne(a,n,r)?Me(a):v(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=U(a),t=G(r)?U(r):r,n=e,i=Oe(n);for(;i&&t!==n;){let e=Q(i),t=i.getBoundingClientRect(),r=Y(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=U(i),i=Oe(n)}}return B({width:u,height:d,x:c,y:l})}function Pe(e,t){let n=Ee(e).scrollLeft;return t?t.left+n:$(W(e)).left+n}function Fe(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Pe(e,n),y:n.top+t.scrollTop}}function Ie(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=W(r),s=t?ye(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=v(1),u=v(0),d=K(r);if((d||!a)&&((H(r)!==`body`||_e(o))&&(c=Ee(r)),d)){let e=$(r);l=Q(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Fe(o,c):v(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Le(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Re(e){let t=Ee(e),n=e.ownerDocument.body,r=h(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=h(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Pe(e),o=-t.scrollTop;return Y(n).direction===`rtl`&&(a+=h(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var ze=25;function Be(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=U(e),a=W(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Te()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Pe(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=ze&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Ve(e,t){let n=$(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Q(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function He(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Be(e,n,t);else if(t===`document`)r=Re(W(e));else if(G(t))r=Ve(t,n);else{let n=Me(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return B(r)}function Ue(e,t){let n=t.get(e);if(n)return n;let r=Z(e,[],!1).filter(e=>G(e)&&H(e)!==`body`),i=null,a=Y(e).position===`fixed`,o=a?X(e):e;for(;G(o)&&!J(o);){let e=Y(o),t=Ce(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=X(o)}return t.set(e,r),r}function We(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ye(t)?[]:Ue(t,this._c):[].concat(n),r],o=He(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=He(t,a[e],i);s=h(n.top,s),c=m(n.right,c),l=m(n.bottom,l),u=h(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Ge(e){let{width:t,height:n}=ke(e);return{width:t,height:n}}function Ke(e,t,n){let r=K(t),i=W(t),a=n===`fixed`,o=$(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=v(0);if((r||!a)&&((H(t)!==`body`||_e(i))&&(s=Ee(t)),r)){let e=$(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Pe(i));let l=i&&!r&&!a?Fe(i,s):v(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function qe(e){return Y(e).position===`static`}function Je(e,t){if(!K(e)||Y(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return W(e)===n&&(n=n.ownerDocument.body),n}function Ye(e,t){let n=U(e);if(ye(e))return n;if(!K(e)){let t=X(e);for(;t&&!J(t);){if(G(t)&&!qe(t))return t;t=X(t)}return n}let r=Je(e,t);for(;r&&ve(r)&&qe(r);)r=Je(r,t);return r&&J(r)&&qe(r)&&!Ce(r)?n:r||we(e)||n}var Xe=async function(e){let t=this.getOffsetParent||Ye,n=this.getDimensions,r=await n(e.floating);return{reference:Ke(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ze(e){return Y(e).direction===`rtl`}var Qe={convertOffsetParentRelativeRectToViewportRelativeRect:Ie,getDocumentElement:W,getClippingRect:We,getOffsetParent:Ye,getElementRects:Xe,getClientRects:Le,getDimensions:Ge,getScale:Q,isElement:G,isRTL:Ze};function $e(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function et(e,t,n){let r=null,i,a=W(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let g=_(d),v=_(a.clientWidth-(u+f)),y=_(a.clientHeight-(d+p)),b=_(u),x={rootMargin:-g+`px `+-v+`px `+-y+`px `+-b+`px`,threshold:h(0,m(1,c))||1},S=!0;function C(t){let n=t[0].intersectionRatio;if(!$e(l,e.getBoundingClientRect()))return s();if(n!==c){if(!S)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}S=!1}try{r=new IntersectionObserver(C,{...x,root:a.ownerDocument})}catch{r=new IntersectionObserver(C,x)}r.observe(e)}let c=U(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function tt(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Ae(e),u=i||a?[...l?Z(l):[],...t?Z(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?et(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?$(e):null;c&&g();function g(){let t=$(e);h&&!$e(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var nt=ue,rt=de,it=ie,at=pe,ot=se,st=re,ct=fe,lt=(e,t,n)=>{let r=new Map,i=n??{},a={...Qe,...i.platform,_c:r};return ne(e,t,{...i,platform:a})},ut=typeof document<`u`?d.useLayoutEffect:function(){};function dt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!dt(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!dt(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function ft(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function pt(e,t){let n=ft(e);return Math.round(t*n)/n}function mt(e){let t=d.useRef(e);return ut(()=>{t.current=e}),t}function ht(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:u}=e,[f,p]=d.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,h]=d.useState(r);dt(m,r)||h(r);let[g,_]=d.useState(null),[v,y]=d.useState(null),b=d.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=d.useCallback(e=>{e!==T.current&&(T.current=e,y(e))},[]),S=a||g,C=o||v,w=d.useRef(null),T=d.useRef(null),E=d.useRef(f),D=c!=null,O=mt(c),k=mt(i),A=mt(u),j=d.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:m};k.current&&(e.platform=k.current),lt(w.current,T.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!dt(E.current,t)&&(E.current=t,l.flushSync(()=>{p(t)}))})},[m,t,n,k,A]);ut(()=>{u===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[u]);let M=d.useRef(!1);ut(()=>(M.current=!0,()=>{M.current=!1}),[]),ut(()=>{if(S&&(w.current=S),C&&(T.current=C),S&&C){if(O.current)return O.current(S,C,j);j()}},[S,C,j,O,D]);let N=d.useMemo(()=>({reference:w,floating:T,setReference:b,setFloating:x}),[b,x]),P=d.useMemo(()=>({reference:S,floating:C}),[S,C]),F=d.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=pt(P.floating,f.x),r=pt(P.floating,f.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...ft(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,P.floating,f.x,f.y]);return d.useMemo(()=>({...f,update:j,refs:N,elements:P,floatingStyles:F}),[f,j,N,P,F])}var gt=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:st({element:r.current,padding:i}).fn(n):r?st({element:r,padding:i}).fn(n):{}}}},_t=(e,t)=>{let n=nt(e);return{name:n.name,fn:n.fn,options:[e,t]}},vt=(e,t)=>{let n=rt(e);return{name:n.name,fn:n.fn,options:[e,t]}},yt=(e,t)=>({fn:ct(e).fn,options:[e,t]}),bt=(e,t)=>{let n=it(e);return{name:n.name,fn:n.fn,options:[e,t]}},xt=(e,t)=>{let n=at(e);return{name:n.name,fn:n.fn,options:[e,t]}},St=(e,t)=>{let n=ot(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ct=(e,t)=>{let n=gt(e);return{name:n.name,fn:n.fn,options:[e,t]}},wt=`Arrow`,Tt=d.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,u.jsx)(c.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,u.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Tt.displayName=wt;var Et=Tt,Dt=`Popper`,[Ot,kt]=a(Dt),[At,jt]=Ot(Dt),Mt=e=>{let{__scopePopper:t,children:n}=e,[r,i]=d.useState(null),[a,o]=d.useState(void 0);return(0,u.jsx)(At,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};Mt.displayName=Dt;var Nt=`PopperAnchor`,Pt=d.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...a}=e,o=jt(Nt,n),s=d.useRef(null),l=o.onAnchorChange,f=i(t,d.useCallback(e=>{s.current=e,e&&l(e)},[l])),p=d.useRef(null);d.useEffect(()=>{if(!r)return;let e=p.current;p.current=r.current,e!==p.current&&l(p.current)});let m=o.placementState&&Wt(o.placementState),h=m?.[0],g=m?.[1];return r?null:(0,u.jsx)(c.div,{"data-radix-popper-side":h,"data-radix-popper-align":g,...a,ref:f})});Pt.displayName=Nt;var Ft=`PopperContent`,[It,Lt]=Ot(Ft),Rt=d.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:a=0,align:l=`center`,alignOffset:p=0,arrowPadding:m=0,avoidCollisions:h=!0,collisionBoundary:g=[],collisionPadding:_=0,sticky:v=`partial`,hideWhenDetached:y=!1,updatePositionStrategy:b=`optimized`,onPlaced:x,...S}=e,C=jt(Ft,n),[w,T]=d.useState(null),E=i(t,T),[D,O]=d.useState(null),k=f(D),A=k?.width??0,j=k?.height??0,M=r+(l===`center`?``:`-`+l),N=typeof _==`number`?_:{top:0,right:0,bottom:0,left:0,..._},P=Array.isArray(g)?g:[g],F=P.length>0,I={padding:N,boundary:P.filter(Ht),altBoundary:F},{refs:L,floatingStyles:R,placement:z,isPositioned:B,middlewareData:V}=ht({strategy:`fixed`,placement:M,whileElementsMounted:(...e)=>tt(...e,{animationFrame:b===`always`}),elements:{reference:C.anchor},middleware:[_t({mainAxis:a+j,alignmentAxis:p}),h&&vt({mainAxis:!0,crossAxis:!1,limiter:v===`partial`?yt():void 0,...I}),h&&bt({...I}),xt({...I,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),D&&Ct({element:D,padding:m}),Ut({arrowWidth:A,arrowHeight:j}),y&&St({strategy:`referenceHidden`,...I,boundary:F?I.boundary:void 0})]}),ee=C.setPlacementState;s(()=>(ee(z),()=>{ee(void 0)}),[z,ee]);let[te,ne]=Wt(z),re=o(x);s(()=>{B&&re?.()},[B,re]);let ie=V.arrow?.x,ae=V.arrow?.y,oe=V.arrow?.centerOffset!==0,[se,ce]=d.useState();return s(()=>{w&&ce(window.getComputedStyle(w).zIndex)},[w]),(0,u.jsx)(`div`,{ref:L.setFloating,"data-radix-popper-content-wrapper":``,style:{...R,transform:B?R.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:se,"--radix-popper-transform-origin":[V.transformOrigin?.x,V.transformOrigin?.y].join(` `),...V.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,u.jsx)(It,{scope:n,placedSide:te,placedAlign:ne,onArrowChange:O,arrowX:ie,arrowY:ae,shouldHideArrow:oe,children:(0,u.jsx)(c.div,{"data-side":te,"data-align":ne,...S,ref:E,style:{...S.style,animation:B?void 0:`none`}})})})});Rt.displayName=Ft;var zt=`PopperArrow`,Bt={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Vt=d.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Lt(zt,n),a=Bt[i.placedSide];return(0,u.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,u.jsx)(Et,{...r,ref:t,style:{...r.style,display:`block`}})})});Vt.displayName=zt;function Ht(e){return e!==null}var Ut=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Wt(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function Wt(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Gt=Mt,Kt=Pt,qt=Rt,Jt=Vt;export{kt as a,Gt as i,Jt as n,f as o,qt as r,Kt as t};
|
|
@@ -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{D as r,S as i,_ as a,b as o,c as s,d as c,f as l,g as u,h as d,l as f,m as p,s as m,u as h,v as g,w as _,x as v,y}from"./centered-state-DJLgwvA4.js";import{r as b,t as x}from"./utils-DoBmOlX3.js";import{a as S,i as C,n as w,r as ee,t as T}from"./dist-CTksUkKh.js";var E=b(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),D=b(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),O=e(t(),1),k=n();function A(e){let t=e+`CollectionProvider`,[n,i]=o(t),[a,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),c=e=>{let{scope:t,children:n}=e,r=O.useRef(null),i=O.useRef(new Map).current;return(0,k.jsx)(a,{scope:t,itemMap:i,collectionRef:r,children:n})};c.displayName=t;let l=e+`CollectionSlot`,u=_(l),d=O.forwardRef((e,t)=>{let{scope:n,children:i}=e,a=r(t,s(l,n).collectionRef);return(0,k.jsx)(u,{ref:a,children:i})});d.displayName=l;let f=e+`CollectionItemSlot`,p=`data-radix-collection-item`,m=_(f),h=O.forwardRef((e,t)=>{let{scope:n,children:i,...a}=e,o=O.useRef(null),c=r(t,o),l=s(f,n);return O.useEffect(()=>(l.itemMap.set(o,{ref:o,...a}),()=>void l.itemMap.delete(o))),(0,k.jsx)(m,{[p]:``,ref:c,children:i})});h.displayName=f;function g(t){let n=s(e+`CollectionConsumer`,t);return O.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${p}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:c,Slot:d,ItemSlot:h},g,i]}var j=O.createContext(void 0);function M(e){let t=O.useContext(j);return e||t||`ltr`}var N=!1;function P(){let[e,t]=O.useState(N);return O.useEffect(()=>{N||(N=!0,t(!0))},[]),e}var te=O.useSyncExternalStore;function F(){return()=>{}}function ne(){return te(F,()=>!0,()=>!1)}var I=typeof te==`function`?ne:P,L=`rovingFocusGroup.onEntryFocus`,re={bubbles:!1,cancelable:!0},R=`RovingFocusGroup`,[z,ie,ae]=A(R),[oe,se]=o(R,[ae]),[ce,le]=oe(R),ue=O.forwardRef((e,t)=>(0,k.jsx)(z.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,k.jsx)(z.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,k.jsx)(de,{...e,ref:t})})}));ue.displayName=R;var de=O.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:i,loop:o=!1,dir:s,currentTabStopId:c,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:u,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...m}=e,h=O.useRef(null),g=r(t,h),_=M(s),[b,x]=a({prop:c,defaultProp:l??null,onChange:u,caller:R}),[S,C]=O.useState(!1),w=p(d),ee=ie(n),T=O.useRef(!1),[E,D]=O.useState(0);return O.useEffect(()=>{let e=h.current;if(e)return e.addEventListener(L,w),()=>e.removeEventListener(L,w)},[w]),(0,k.jsx)(ce,{scope:n,orientation:i,dir:_,loop:o,currentTabStopId:b,onItemFocus:O.useCallback(e=>x(e),[x]),onItemShiftTab:O.useCallback(()=>C(!0),[]),onFocusableItemAdd:O.useCallback(()=>D(e=>e+1),[]),onFocusableItemRemove:O.useCallback(()=>D(e=>e-1),[]),children:(0,k.jsx)(v.div,{tabIndex:S||E===0?-1:0,"data-orientation":i,...m,ref:g,style:{outline:`none`,...e.style},onMouseDown:y(e.onMouseDown,()=>{T.current=!0}),onFocus:y(e.onFocus,e=>{let t=!T.current;if(e.target===e.currentTarget&&t&&!S){let t=new CustomEvent(L,re);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=ee().filter(e=>e.focusable);_e([e.find(e=>e.active),e.find(e=>e.id===b),...e].filter(Boolean).map(e=>e.ref.current),f)}}T.current=!1}),onBlur:y(e.onBlur,()=>C(!1))})})}),fe=`RovingFocusGroupItem`,pe=O.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=d(),l=a||c,u=le(fe,n),f=u.currentTabStopId===l,p=ie(n),{onFocusableItemAdd:m,onFocusableItemRemove:h,currentTabStopId:_}=u,b=I();return g(()=>{if(!(!b||!r))return m(),()=>h()},[b,r,m,h]),O.useEffect(()=>{if(!(b||!r))return m(),()=>h()},[b,r,m,h]),(0,k.jsx)(z.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,k.jsx)(v.span,{tabIndex:f?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:y(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:y(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:y(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=ge(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=p().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?ve(n,r+1):n.slice(r+1)}setTimeout(()=>_e(n))}}),children:typeof o==`function`?o({isCurrentTabStop:f,hasTabStop:_!=null}):o})})});pe.displayName=fe;var me={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function he(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function ge(e,t,n){let r=he(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return me[r]}function _e(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function ve(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var ye=ue,be=pe,xe=[`Enter`,` `],Se=[`ArrowDown`,`PageUp`,`Home`],Ce=[`ArrowUp`,`PageDown`,`End`],we=[...Se,...Ce],Te={ltr:[...xe,`ArrowRight`],rtl:[...xe,`ArrowLeft`]},Ee={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},B=`Menu`,[V,De,Oe]=A(B),[H,ke]=o(B,[Oe,S,se]),U=S(),Ae=se(),[je,W]=H(B),[Me,G]=H(B),Ne=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=U(t),[c,l]=O.useState(null),u=O.useRef(!1),d=p(a),f=M(i);return O.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),O.useEffect(()=>{if(!n)return;let e=()=>d(!1);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,k.jsx)(C,{...s,children:(0,k.jsx)(je,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,k.jsx)(Me,{scope:t,onClose:O.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};Ne.displayName=B;var Pe=`MenuAnchor`,Fe=O.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=U(n);return(0,k.jsx)(T,{...i,...r,ref:t})});Fe.displayName=Pe;var Ie=`MenuPortal`,[Le,Re]=H(Ie,{forceMount:void 0}),ze=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=W(Ie,t);return(0,k.jsx)(Le,{scope:t,forceMount:n,children:(0,k.jsx)(u,{present:n||a.open,children:(0,k.jsx)(h,{asChild:!0,container:i,children:r})})})};ze.displayName=Ie;var K=`MenuContent`,[Be,Ve]=H(K),He=O.forwardRef((e,t)=>{let n=Re(K,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=W(K,e.__scopeMenu),o=G(K,e.__scopeMenu);return(0,k.jsx)(V.Provider,{scope:e.__scopeMenu,children:(0,k.jsx)(u,{present:r||a.open,children:(0,k.jsx)(V.Slot,{scope:e.__scopeMenu,children:o.modal?(0,k.jsx)(Ue,{...i,ref:t}):(0,k.jsx)(We,{...i,ref:t})})})})}),Ue=O.forwardRef((e,t)=>{let n=W(K,e.__scopeMenu),i=O.useRef(null),a=r(t,i);return O.useEffect(()=>{let e=i.current;if(e)return m(e)},[]),(0,k.jsx)(Ke,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:y(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),We=O.forwardRef((e,t)=>{let n=W(K,e.__scopeMenu);return(0,k.jsx)(Ke,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Ge=_(`MenuContent.ScrollLock`),Ke=O.forwardRef((e,t)=>{let{__scopeMenu:n,loop:i=!1,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:u,disableOutsidePointerEvents:d,onEntryFocus:p,onEscapeKeyDown:m,onPointerDownOutside:h,onFocusOutside:g,onInteractOutside:_,onDismiss:v,disableOutsideScroll:b,...x}=e,S=W(K,n),C=G(K,n),w=U(n),T=Ae(n),E=De(n),[D,A]=O.useState(null),j=O.useRef(null),M=r(t,j,S.onContentChange),N=O.useRef(0),P=O.useRef(``),te=O.useRef(0),F=O.useRef(null),ne=O.useRef(`right`),I=O.useRef(0),L=b?s:O.Fragment,re=b?{as:Ge,allowPinchZoom:!0}:void 0,R=e=>{let t=P.current+e,n=E().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=Et(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){P.current=t,window.clearTimeout(N.current),t!==``&&(N.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};O.useEffect(()=>()=>window.clearTimeout(N.current),[]),f();let z=O.useCallback(e=>ne.current===F.current?.side&&Ot(e,F.current?.area),[]);return(0,k.jsx)(Be,{scope:n,searchRef:P,onItemEnter:O.useCallback(e=>{z(e)&&e.preventDefault()},[z]),onItemLeave:O.useCallback(e=>{z(e)||(j.current?.focus(),A(null))},[z]),onTriggerLeave:O.useCallback(e=>{z(e)&&e.preventDefault()},[z]),pointerGraceTimerRef:te,onPointerGraceIntentChange:O.useCallback(e=>{F.current=e},[]),children:(0,k.jsx)(L,{...re,children:(0,k.jsx)(c,{asChild:!0,trapped:a,onMountAutoFocus:y(o,e=>{e.preventDefault(),j.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:(0,k.jsx)(l,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:m,onPointerDownOutside:h,onFocusOutside:g,onInteractOutside:_,onDismiss:v,children:(0,k.jsx)(ye,{asChild:!0,...T,dir:C.dir,orientation:`vertical`,loop:i,currentTabStopId:D,onCurrentTabStopIdChange:A,onEntryFocus:y(p,e=>{C.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,k.jsx)(ee,{role:`menu`,"aria-orientation":`vertical`,"data-state":St(S.open),"data-radix-menu-content":``,dir:C.dir,...w,...x,ref:M,style:{outline:`none`,...x.style},onKeyDown:y(x.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&R(e.key));let i=j.current;if(e.target!==i||!we.includes(e.key))return;e.preventDefault();let a=E().filter(e=>!e.disabled).map(e=>e.ref.current);Ce.includes(e.key)&&a.reverse(),wt(a)}),onBlur:y(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(N.current),P.current=``)}),onPointerMove:y(e.onPointerMove,Z(e=>{let t=e.target,n=I.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>I.current?`right`:`left`;ne.current=t,I.current=e.clientX}}))})})})})})})});He.displayName=K;var qe=`MenuGroup`,Je=O.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,k.jsx)(v.div,{role:`group`,...r,ref:t})});Je.displayName=qe;var Ye=`MenuLabel`,Xe=O.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,k.jsx)(v.div,{...r,ref:t})});Xe.displayName=Ye;var q=`MenuItem`,Ze=`menu.itemSelect`,J=O.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:a,...o}=e,s=O.useRef(null),c=G(q,e.__scopeMenu),l=Ve(q,e.__scopeMenu),u=r(t,s),d=O.useRef(!1),f=()=>{let e=s.current;if(!n&&e){let t=new CustomEvent(Ze,{bubbles:!0,cancelable:!0});e.addEventListener(Ze,e=>a?.(e),{once:!0}),i(e,t),t.defaultPrevented?d.current=!1:c.onClose()}};return(0,k.jsx)(Qe,{...o,ref:u,disabled:n,onClick:y(e.onClick,f),onPointerDown:t=>{e.onPointerDown?.(t),d.current=!0},onPointerUp:y(e.onPointerUp,e=>{d.current||e.currentTarget?.click()}),onKeyDown:y(e.onKeyDown,e=>{n||e.target!==e.currentTarget||l.searchRef.current!==``&&e.key===` `||xe.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});J.displayName=q;var Qe=O.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:i=!1,textValue:a,...o}=e,s=Ve(q,n),c=Ae(n),l=O.useRef(null),u=r(t,l),[d,f]=O.useState(!1),[p,m]=O.useState(``);return O.useEffect(()=>{let e=l.current;e&&m((e.textContent??``).trim())},[o.children]),(0,k.jsx)(V.ItemSlot,{scope:n,disabled:i,textValue:a??p,children:(0,k.jsx)(be,{asChild:!0,...c,focusable:!i,children:(0,k.jsx)(v.div,{role:`menuitem`,"data-highlighted":d?``:void 0,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,...o,ref:u,onPointerMove:y(e.onPointerMove,Z(e=>{i?s.onItemLeave(e):(s.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:y(e.onPointerLeave,Z(e=>s.onItemLeave(e))),onFocus:y(e.onFocus,()=>f(!0)),onBlur:y(e.onBlur,()=>f(!1))})})})}),$e=`MenuCheckboxItem`,et=O.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,k.jsx)(ct,{scope:e.__scopeMenu,checked:n,children:(0,k.jsx)(J,{role:`menuitemcheckbox`,"aria-checked":X(n)?`mixed`:n,...i,ref:t,"data-state":Ct(n),onSelect:y(i.onSelect,()=>r?.(X(n)?!0:!n),{checkForDefaultPrevented:!1})})})});et.displayName=$e;var tt=`MenuRadioGroup`,[nt,rt]=H(tt,{value:void 0,onValueChange:()=>{}}),it=O.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=p(r);return(0,k.jsx)(nt,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,k.jsx)(Je,{...i,ref:t})})});it.displayName=tt;var at=`MenuRadioItem`,ot=O.forwardRef((e,t)=>{let{value:n,...r}=e,i=rt(at,e.__scopeMenu),a=n===i.value;return(0,k.jsx)(ct,{scope:e.__scopeMenu,checked:a,children:(0,k.jsx)(J,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":Ct(a),onSelect:y(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});ot.displayName=at;var st=`MenuItemIndicator`,[ct,lt]=H(st,{checked:!1}),ut=O.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=lt(st,n);return(0,k.jsx)(u,{present:r||X(a.checked)||a.checked===!0,children:(0,k.jsx)(v.span,{...i,ref:t,"data-state":Ct(a.checked)})})});ut.displayName=st;var dt=`MenuSeparator`,ft=O.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,k.jsx)(v.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});ft.displayName=dt;var pt=`MenuArrow`,mt=O.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=U(n);return(0,k.jsx)(w,{...i,...r,ref:t})});mt.displayName=pt;var ht=`MenuSub`,[gt,_t]=H(ht),vt=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=W(ht,t),o=U(t),[s,c]=O.useState(null),[l,u]=O.useState(null),f=p(i);return O.useEffect(()=>(a.open===!1&&f(!1),()=>f(!1)),[a.open,f]),(0,k.jsx)(C,{...o,children:(0,k.jsx)(je,{scope:t,open:r,onOpenChange:f,content:l,onContentChange:u,children:(0,k.jsx)(gt,{scope:t,contentId:d(),triggerId:d(),trigger:s,onTriggerChange:c,children:n})})})};vt.displayName=ht;var Y=`MenuSubTrigger`,yt=O.forwardRef((e,t)=>{let n=W(Y,e.__scopeMenu),i=G(Y,e.__scopeMenu),a=_t(Y,e.__scopeMenu),o=Ve(Y,e.__scopeMenu),s=O.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:l}=o,u={__scopeMenu:e.__scopeMenu},d=O.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);O.useEffect(()=>d,[d]),O.useEffect(()=>{let e=c.current;return()=>{window.clearTimeout(e),l(null)}},[c,l]);let f=r(t,a.onTriggerChange);return(0,k.jsx)(Fe,{asChild:!0,...u,children:(0,k.jsx)(Qe,{id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":n.open?a.contentId:void 0,"data-state":St(n.open),...e,ref:f,onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:y(e.onPointerMove,Z(t=>{o.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(o.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:y(e.onPointerLeave,Z(e=>{d();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,a=i?-5:5,s=t[i?`left`:`right`],l=t[i?`right`:`left`];o.onPointerGraceIntentChange({area:[{x:e.clientX+a,y:e.clientY},{x:s,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:s,y:t.bottom}],side:r}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(e),e.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:y(e.onKeyDown,t=>{e.disabled||t.target!==t.currentTarget||o.searchRef.current!==``&&t.key===` `||Te[i.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});yt.displayName=Y;var bt=`MenuSubContent`,xt=O.forwardRef((e,t)=>{let n=Re(K,e.__scopeMenu),{forceMount:i=n.forceMount,align:a=`start`,...o}=e,s=W(K,e.__scopeMenu),c=G(K,e.__scopeMenu),l=_t(bt,e.__scopeMenu),d=O.useRef(null),f=r(t,d);return(0,k.jsx)(V.Provider,{scope:e.__scopeMenu,children:(0,k.jsx)(u,{present:i||s.open,children:(0,k.jsx)(V.Slot,{scope:e.__scopeMenu,children:(0,k.jsx)(Ke,{id:l.contentId,"aria-labelledby":l.triggerId,...o,ref:f,align:a,side:c.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{c.isUsingKeyboardRef.current&&d.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:y(e.onFocusOutside,e=>{e.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:y(e.onEscapeKeyDown,e=>{c.onClose(),e.preventDefault()}),onKeyDown:y(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Ee[c.dir].includes(e.key);t&&n&&(s.onOpenChange(!1),l.trigger?.focus(),e.preventDefault())})})})})})});xt.displayName=bt;function St(e){return e?`open`:`closed`}function X(e){return e===`indeterminate`}function Ct(e){return X(e)?`indeterminate`:e?`checked`:`unchecked`}function wt(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Tt(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Et(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Tt(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Dt(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Ot(e,t){return t?Dt({x:e.clientX,y:e.clientY},t):!1}function Z(e){return t=>t.pointerType===`mouse`?e(t):void 0}var kt=Ne,At=Fe,jt=ze,Mt=He,Nt=Je,Pt=Xe,Ft=J,It=et,Lt=it,Rt=ot,zt=ut,Bt=ft,Vt=mt,Ht=yt,Ut=xt,Q=`DropdownMenu`,[Wt,Gt]=o(Q,[ke]),$=ke(),[Kt,qt]=Wt(Q),Jt=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:o,onOpenChange:s,modal:c=!0}=e,l=$(t),u=O.useRef(null),[f,p]=a({prop:i,defaultProp:o??!1,onChange:s,caller:Q});return(0,k.jsx)(Kt,{scope:t,triggerId:d(),triggerRef:u,contentId:d(),open:f,onOpenChange:p,onOpenToggle:O.useCallback(()=>p(e=>!e),[p]),modal:c,children:(0,k.jsx)(kt,{...l,open:f,onOpenChange:p,dir:r,modal:c,children:n})})};Jt.displayName=Q;var Yt=`DropdownMenuTrigger`,Xt=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:i=!1,...a}=e,o=qt(Yt,n),s=$(n),c=r(t,o.triggerRef);return(0,k.jsx)(At,{asChild:!0,...s,children:(0,k.jsx)(v.button,{type:`button`,id:o.triggerId,"aria-haspopup":`menu`,"aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?`open`:`closed`,"data-disabled":i?``:void 0,disabled:i,...a,ref:c,onPointerDown:y(e.onPointerDown,e=>{!i&&e.button===0&&e.ctrlKey===!1&&(o.onOpenToggle(),o.open||e.preventDefault())}),onKeyDown:y(e.onKeyDown,e=>{i||([`Enter`,` `].includes(e.key)&&o.onOpenToggle(),e.key===`ArrowDown`&&o.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Xt.displayName=Yt;var Zt=`DropdownMenuPortal`,Qt=e=>{let{__scopeDropdownMenu:t,...n}=e,r=$(t);return(0,k.jsx)(jt,{...r,...n})};Qt.displayName=Zt;var $t=`DropdownMenuContent`,en=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=qt($t,n),a=$(n),o=O.useRef(!1);return(0,k.jsx)(Mt,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:y(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:y(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});en.displayName=$t;var tn=`DropdownMenuGroup`,nn=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,k.jsx)(Nt,{...i,...r,ref:t})});nn.displayName=tn;var rn=`DropdownMenuLabel`,an=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,k.jsx)(Pt,{...i,...r,ref:t})});an.displayName=rn;var on=`DropdownMenuItem`,sn=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,k.jsx)(Ft,{...i,...r,ref:t})});sn.displayName=on;var cn=`DropdownMenuCheckboxItem`,ln=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,k.jsx)(It,{...i,...r,ref:t})});ln.displayName=cn;var un=`DropdownMenuRadioGroup`,dn=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,k.jsx)(Lt,{...i,...r,ref:t})});dn.displayName=un;var fn=`DropdownMenuRadioItem`,pn=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,k.jsx)(Rt,{...i,...r,ref:t})});pn.displayName=fn;var mn=`DropdownMenuItemIndicator`,hn=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,k.jsx)(zt,{...i,...r,ref:t})});hn.displayName=mn;var gn=`DropdownMenuSeparator`,_n=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,k.jsx)(Bt,{...i,...r,ref:t})});_n.displayName=gn;var vn=`DropdownMenuArrow`,yn=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,k.jsx)(Vt,{...i,...r,ref:t})});yn.displayName=vn;var bn=`DropdownMenuSubTrigger`,xn=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,k.jsx)(Ht,{...i,...r,ref:t})});xn.displayName=bn;var Sn=`DropdownMenuSubContent`,Cn=O.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,k.jsx)(Ut,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Cn.displayName=Sn;var wn=Jt,Tn=Xt,En=Qt,Dn=en,On=an,kn=sn,An=dn,jn=pn,Mn=hn,Nn=_n;function Pn({...e}){return(0,k.jsx)(wn,{"data-slot":`dropdown-menu`,...e})}function Fn({...e}){return(0,k.jsx)(Tn,{"data-slot":`dropdown-menu-trigger`,...e})}function In({className:e,sideOffset:t=4,...n}){return(0,k.jsx)(En,{children:(0,k.jsx)(Dn,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:x(`z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...n})})}function Ln({className:e,inset:t,variant:n=`default`,...r}){return(0,k.jsx)(kn,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:x(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!`,e),...r})}function Rn({...e}){return(0,k.jsx)(An,{"data-slot":`dropdown-menu-radio-group`,...e})}function zn({className:e,children:t,...n}){return(0,k.jsxs)(jn,{"data-slot":`dropdown-menu-radio-item`,className:x(`relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...n,children:[(0,k.jsx)(`span`,{className:`pointer-events-none absolute left-2 flex size-3.5 items-center justify-center`,children:(0,k.jsx)(Mn,{children:(0,k.jsx)(E,{className:`size-2 fill-current`})})}),t]})}function Bn({className:e,inset:t,...n}){return(0,k.jsx)(On,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:x(`px-2 py-1.5 text-sm font-medium data-[inset]:pl-8`,e),...n})}function Vn({className:e,...t}){return(0,k.jsx)(Nn,{"data-slot":`dropdown-menu-separator`,className:x(`-mx-1 my-1 h-px bg-border`,e),...t})}export{Rn as a,Fn as c,se as d,M as f,E as h,Bn as i,be as l,D as m,In as n,zn as o,A as p,Ln as r,Vn as s,Pn as t,ye as u};
|
|
@@ -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{Rn as r,W as i,Wt as a,a as o,dt as s,fi as c,i as l,jn as u,mt as d}from"./centered-state-DJLgwvA4.js";import{G as f,H as p,V as m,W as h,r as g,t as _}from"./utils-DoBmOlX3.js";import{a as v,o as ee}from"./tooltip-Bdl8mQG8.js";import{c as te,m as y,n as ne,r as b,s as x,t as S}from"./dropdown-menu-B7HeKCfN.js";import{t as re}from"./folder-wjVId5un.js";import{p as ie}from"./new-task-form-CQODCzBP.js";import{t as ae}from"./sparkles-ChorK-gZ.js";import{t as oe}from"./square-terminal-C7KCPznz.js";var se=g(`archive-restore`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]]),ce=g(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),C=g(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),le=g(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),ue=g(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),de=g(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),w=g(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),fe=g(`diamond`,[[`path`,{d:`M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z`,key:`1f1r0c`}]]),pe=g(`feather`,[[`path`,{d:`M12.67 19a2 2 0 0 0 1.416-.588l6.154-6.172a6 6 0 0 0-8.49-8.49L5.586 9.914A2 2 0 0 0 5 11.328V18a1 1 0 0 0 1 1z`,key:`18jl4k`}],[`path`,{d:`M16 8 2 22`,key:`vp34q`}],[`path`,{d:`M17.5 15H9`,key:`1oz8nu`}]]),me=g(`gem`,[[`path`,{d:`M10.5 3 8 9l4 13 4-13-2.5-6`,key:`b3dvk1`}],[`path`,{d:`M17 3a2 2 0 0 1 1.6.8l3 4a2 2 0 0 1 .013 2.382l-7.99 10.986a2 2 0 0 1-3.247 0l-7.99-10.986A2 2 0 0 1 2.4 7.8l2.998-3.997A2 2 0 0 1 7 3z`,key:`7w4byz`}],[`path`,{d:`M2 9h20`,key:`16fsjt`}]]),T=g(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),he=g(`hammer`,[[`path`,{d:`m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9`,key:`1hayfq`}],[`path`,{d:`m18 15 4-4`,key:`16gjal`}],[`path`,{d:`m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5`,key:`15ts47`}]]),ge=g(`hexagon`,[[`path`,{d:`M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`,key:`yt0hxn`}]]),_e=g(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),E=g(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),D=g(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),O=g(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),k=g(`shapes`,[[`path`,{d:`M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z`,key:`1bo67w`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}],[`circle`,{cx:`17.5`,cy:`17.5`,r:`3.5`,key:`w3z12y`}]]),A=g(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),j=g(`waves-horizontal`,[[`path`,{d:`M2 12q2.5 2 5 0t5 0 5 0 5 0`,key:`8ddzzs`}],[`path`,{d:`M2 19q2.5 2 5 0t5 0 5 0 5 0`,key:`1wj4st`}],[`path`,{d:`M2 5q2.5 2 5 0t5 0 5 0 5 0`,key:`69x50u`}]]),M=e(t(),1),N=n(),P=[`done`,`failed`,`cancelled`],F=[`done`,`failed`];function I(e){return e.status===`failed`&&e.autoResumeAt!==void 0}function ve(e){return P.includes(e)}function L(e){return e.archived||I(e)||!F.includes(e.status)?!1:e.finishedAt!==void 0}function R(e){let t=e.finishedAt;return t===void 0||!L(e)?!1:e.seenAt===void 0||e.seenAt<t}function ye(e){return!I(e)&&ve(e.status)&&!R(e)}function be(e){return e.reduce((e,t)=>R(t)?e+1:e,0)}var z={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,cursor:`Cursor`,pi:`pi`};function B(e){let t=e.currentStepId?e.steps.find(t=>t.id===e.currentStepId):void 0;if(t?.backend)return t.backend;if(e.runner)return e.runner;for(let t=e.steps.length-1;t>=0;--t){let n=e.steps[t]?.backend;if(n)return n}return`claude`}function V(e){return e.runner??`claude`}function H(e,t){let n=c(t,e);return n?.enabled===!1?{provider:e,usable:!1,reason:`${z[e]} is disabled. Enable it in Settings → Agents → Providers.`}:n?.status===`connected`?{provider:e,usable:!0}:{provider:e,usable:!1,reason:`${z[e]} credentials are unavailable. Authorize it in Settings → Agents → Providers.`}}function xe(e,t){return H(B(e),t)}function Se(e,t){return H(V(e),t)}function U(e){let t=d(),n=B(e);return t.isSuccess&&t.data?xe(e,t.data):{provider:n,usable:!0}}function Ce(e){let t=d(),n=V(e);return t.isSuccess&&t.data?Se(e,t.data):t.isError?{provider:n,usable:!1,reason:`Provider authentication could not be verified.`}:{provider:n,usable:!1,reason:`Checking agent providers…`}}var we={folder:re,terminal:oe,vscode:de,cursor:_e,zed:ie,windsurf:j,sublime:pe,idea:fe,pycharm:ge,webstorm:T,goland:k,rubymine:me,phpstorm:ue,clion:w,rider:le,"android-studio":A,xcode:he,warp:O,claude:C,codex:ae,opencode:C,pi:C};function Te(e){return e.icon&&we[e.icon]||y}var Ee=RegExp(`^cli:(${f.options.map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`)})$`);function W(e){let t=Ee.exec(e);return t?t[1]:void 0}function De({choices:e,onPick:t,label:n=`Open in…`,title:r,triggerVariant:i=`ghost`,disabled:a=!1,leading:s,trailing:c,slot:l}){return(0,N.jsxs)(S,{children:[(0,N.jsx)(te,{asChild:!0,children:(0,N.jsxs)(o,{variant:i,size:`sm`,title:r,disabled:a,"data-slot":l,children:[(0,N.jsx)(y,{"aria-hidden":`true`}),n]})}),(0,N.jsxs)(ne,{align:`end`,children:[s,s&&e.length>0?(0,N.jsx)(x,{}):null,e.map(({target:e,suffix:n,title:r})=>{let i=Te(e);return(0,N.jsxs)(b,{"data-target":e.id,title:r,onSelect:()=>t(e.id),children:[(0,N.jsx)(i,{"aria-hidden":`true`}),e.label,n??``]},e.id)}),c]})]})}function G(e){return e===`running`||e===`queued`||e===`waiting`}function K(e){return[...e.steps].reverse().find(e=>e.sessionId)?.sessionId}var Oe=/^[A-Za-z0-9._][A-Za-z0-9._-]{0,199}$/,ke={claude:`claude --resume`,codex:`codex resume`,opencode:`opencode --session`,cursor:`agent --resume`,pi:`pi --session`};function Ae(e,t){if(Oe.test(t))return`${ke[e??`claude`]} ${t}`}function je(e){if(G(e.status))return;let t=K(e);if(t===void 0)return;let n=Ae(e.runner,t);if(n!==void 0)return e.worktreePath?`cd ${e.worktreePath} && ${n}`:n}function Me(e,t){let n=W(t);return!n||G(e.status)?!1:n===(e.runner??`claude`)&&K(e)!==void 0}function q(e){let t=G(e.status),n=K(e)!==void 0;return{finish:e.status===`waiting`||e.status===`review`,continueRun:!t&&n,terminal:!t&&n,notes:!0,archive:!t,pin:!e.archived,markUnread:L(e)&&!R(e),cancel:t,deleteRun:!t}}function Ne(e){return`Merge head branch and resolve conflicts in ${e?`PR number ${e}`:`this pull request`}`}function Pe(e){return e===`review`?`Accept the changes without a PR`:`Close the session`}function Fe(e,t){let n=e.filter(e=>!e.archived&&e.status===`queued`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt)).findIndex(e=>e.id===t);return n>=0?n+1:void 0}var Ie=[50,100,200,400,800,1e3,1e3,1e3,1e3],Le=e=>new Promise(t=>setTimeout(t,e));function Re(e){return e instanceof r&&e.status===409&&e.message===`run is still active`}async function J(e,t=Le){for(let n=0;;n+=1)try{return await e()}catch(e){let r=Ie[n];if(!Re(e)||r===void 0)throw e;await t(r)}}function Y(e){return G(e.status)?`live`:q(e).continueRun?`resume`:`unavailable`}function X(e,t){let n=a(e.id,t),o=i(e.id,t),s=U(e),c=Ce(e),[l,u]=(0,M.useState)(void 0),[d,f]=(0,M.useState)(!1),p=(0,M.useRef)(!1),m=Y(e),h=m===`resume`?!c.usable:m===`live`&&!s.usable,g=m===`unavailable`?`no-session`:h?`provider`:void 0,_=g===`no-session`?`This session has ended and no agent session was recorded, so the answer cannot be delivered.`:g===`provider`?m===`resume`?c.reason:s.reason:void 0,v=e=>c.usable?o.mutateAsync({text:e}):Promise.reject(Error(c.reason??`The run provider is unavailable.`));return{mode:m,blockedBy:g,reason:_,isPending:d||n.isPending||o.isPending,error:l,send:async t=>{if(g||p.current)return _;p.current=!0,f(!0),u(void 0);try{if(m===`resume`){await J(()=>v(t));return}try{await n.mutateAsync({text:t})}catch(n){if(n instanceof r&&n.status===409&&K(e)!==void 0){await J(()=>v(t));return}throw n}return}catch(e){let t=e instanceof Error?e.message:String(e);return u(t),t}finally{p.current=!1,f(!1)}}}}function Z({run:e,projectId:t,prNumber:n}){let r=X(e,t),i=ee(),[a,s]=(0,M.useState)(!1),c=a||r.isPending,u=!!r.blockedBy,d=async()=>{if(c||u)return;let e=r.mode===`resume`;s(!0);try{let t=await r.send(Ne(n));t?l(t,{tone:`danger`}):(l(`${e?`Task reopened`:`Sent to the task`} — resolving conflicts${n?` in PR #${n}`:``}`),i())}finally{s(!1)}};return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(o,{type:`button`,size:`sm`,"data-slot":`reference-conflict-action`,disabled:u||c,onClick:()=>void d(),className:`h-7 w-full text-xs`,children:c?`Sending…`:`Resolve conflicts`}),u&&r.reason?(0,N.jsx)(`span`,{className:`block opacity-70`,children:r.reason}):null]})}function ze({projectId:e,runId:t,prNumber:n}){let r=s(e,t);return r.data?(0,N.jsx)(Z,{run:r.data,projectId:e,prNumber:n}):(0,N.jsx)(o,{type:`button`,size:`sm`,disabled:!0,className:`h-7 w-full text-xs`,children:r.isError?`Unavailable`:`Loading…`})}function Be({run:e,reference:t,className:n,compact:r=!1}){return(0,N.jsx)(v,{reference:t,taskTitle:u(e),conflictAction:(0,N.jsx)(Z,{run:e,prNumber:t.number}),className:n,compact:r})}var Ve={md:`text/markdown`,markdown:`text/markdown`,txt:`text/plain`,log:`text/plain`,pdf:`application/pdf`};function Q(e){return p(e.type)?e.type:Ve[e.name.split(`.`).pop()?.toLowerCase()??``]??null}function $(e,t){return t?`pasted image`:`pasted.${m(e)}`}async function He(e,t=`file`){let n=new Uint8Array(await e.arrayBuffer()),r=``;for(let e=0;e<n.length;e+=32768)r+=String.fromCharCode(...n.subarray(e,e+32768));let i=btoa(r),a=Q(e)??`application/octet-stream`,o=h(a),s=t===`clipboard`&&o?void 0:e.name;return{mediaType:a,data:i,...o?{preview:`data:${a};base64,${i}`}:{},name:s||$(a,o),...s?{originalName:s}:{},isImage:o}}function Ue({mediaType:e,data:t,originalName:n}){return{mediaType:e,data:t,...n?{name:n}:{}}}function We(e,t){let n=[],r=[],i=t;for(let t of e){let e=t.name||`attachment`;if(Q(t)===null){r.push(`${e} is not a supported attachment (images, PDF and plain-text files such as TXT or MD)`);continue}if(t.size>5242880){r.push(`${e} is too large (max 5 MB)`);continue}if(i>=4){r.push(`${e} skipped — max 4 attachments per message`);continue}n.push(t),i+=1}return{accepted:n,rejected:r}}function Ge(e,t){let[n,r]=(0,M.useState)(!1),[i,a]=(0,M.useState)(``),o=(0,M.useRef)(!1),[s,c]=(0,M.useState)(!0),l=e=>{a(e),c(!0)},u=e=>{a(e),c(!1),o.current=!1,r(!0)};return{editing:n,draft:i,setDraft:l,begin:()=>{u(e),c(!0)},beginWith:u,commitOnBlur:s,commit:()=>{if(o.current)return;o.current=!0,r(!1);let n=i.trim();n.length===0||n===e||t(n)},cancel:()=>{o.current=!0,r(!1)}}}function Ke({editor:e,className:t}){return(0,N.jsx)(`input`,{"data-slot":`title-input`,"aria-label":`Task title`,autoFocus:!0,value:e.draft,onChange:t=>e.setDraft(t.target.value),onBlur:()=>{e.commitOnBlur&&e.commit()},onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),e.commit()):t.key===`Escape`&&(t.preventDefault(),e.cancel())},className:_(`w-full min-w-0 rounded-sm border border-border bg-card px-1.5 py-0.5 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,t)})}export{ce as A,R as C,T as D,E,w as O,ye as S,D as T,q as _,We as a,U as b,ze as c,Me as d,Pe as f,je as g,Fe as h,He as i,se as j,C as k,Be as l,K as m,Ge as n,Ue as o,G as p,$ as r,Z as s,Ke as t,X as u,De as v,be as w,L as x,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,M as i,k as a,li as o,sn as s,tt as c,ui as l}from"./centered-state-DJLgwvA4.js";import{F as u,a as d,c as f,r as p,s as m,t as h,y as ee}from"./utils-DoBmOlX3.js";import"./use-now-sqAvRMna.js";import{i as g,r as _,s as v,t as y}from"./popover-BRq6QnwI.js";import{a as b,i as x,o as S,r as C,s as w,t as T}from"./command-BvGGv2_u.js";var E=e(t(),1),D=new Map,O=new Map,k=new Set,A=0;function j(e,t){t?O.set(e,A+1):O.delete(e),A++,k.forEach(e=>e())}function te(e,t){let n=`${e}:${typeof t==`string`?t:t.id}`;D.delete(n),D.set(n,{value:typeof t==`string`?null:{status:t.status,archived:t.archived},revision:A+1}),D.size>2e3&&D.delete(D.keys().next().value),A++,k.forEach(e=>e())}function M(e){return(0,E.useSyncExternalStore)(e=>(k.add(e),()=>{k.delete(e)}),()=>A),P(e.projectId,e.id)}var N=()=>A,P=(e,t)=>O.has(e)?null:D.get(`${e}:${t}`)?.value;function F(e,t=[]){let n=new Map(t.map(e=>[`${e.projectId}:${e.id}`,e])),r=!1;for(let n of t){let t=O.get(n.projectId);t!==void 0&&t<=e&&(O.delete(n.projectId),r=!0)}for(let[t,i]of D){let a=n.get(t);i.revision>e||!a||(a.status!==void 0&&a.archived!==void 0?(D.set(t,{value:{status:a.status,archived:a.archived},revision:A+1}),r=!0):i.value===null&&(D.delete(t),r=!0))}r&&(A++,k.forEach(e=>e()))}function I(e=()=>performance.now()){let t=new Map,n=new Set,r,i={connected:!1,samples:[]},a=()=>{i={...i,samples:[...t.values()].map(e=>e.sample)},n.forEach(e=>e())},o=()=>{let n=!1;for(let[r,i]of t)i.deadline<=e()&&(t.delete(r),n=!0);n&&a()};return{getSnapshot:()=>i,subscribe(e){return n.add(e),r||=setInterval(o,1e3),o(),()=>{n.delete(e),n.size||(clearInterval(r),r=void 0)}},expire:o,connected(e){i.connected!==e&&(i={...i,connected:e},a())},replace(n,r,i){for(let[e,r]of t)r.sample.projectId===n&&t.delete(e);let o=i?Date.parse(i):NaN;for(let i of r){let r=Math.max(0,o-Date.parse(i.sampledAt));Number.isFinite(r)&&r<1e4&&i.projectId===n&&t.set(`${n}:${i.runId}`,{sample:i,deadline:e()+1e4-r})}a()},seed(n,r){for(let[e,n]of t)Date.parse(n.sample.sampledAt)<=Date.parse(r)&&t.delete(e);for(let i of n){let n=Math.max(0,Date.parse(r)-Date.parse(i.sampledAt));Number.isFinite(n)&&n<1e4&&!t.has(`${i.projectId}:${i.runId}`)&&t.set(`${i.projectId}:${i.runId}`,{sample:i,deadline:e()+1e4-n})}a()},remove(e,n){for(let[r,i]of t)i.sample.projectId===e&&(!n||i.sample.runId===n)&&t.delete(r);a()}}}var L=I(),ne=()=>(0,E.useSyncExternalStore)(L.subscribe,L.getSnapshot);function re(e,t){if(e===`ping`)return{project:null,event:{type:`ping`}};let n;try{n=JSON.parse(t)}catch{return null}if(!R(n))return null;let r=n.project;if(typeof r!=`string`||r===``)return null;switch(e){case`run`:{let{project:e,...t}=n;return ie(t)?{project:r,event:{type:`run`,run:t}}:null}case`run-deleted`:{let e=n.id;return typeof e==`string`&&e?{project:r,event:{type:`run-deleted`,id:e}}:null}case`todos`:return Array.isArray(n.items)?{project:r,event:{type:`todos`,items:n.items}}:null;case`usage`:return R(n.usage)?{project:r,event:{type:`usage`,usage:n.usage}}:null;default:return null}}function R(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ie(e){return R(e)&&typeof e.id==`string`&&e.id!==``}function ae(e,t){if(!e)return;let n=e.findIndex(e=>e.id===t.id);if(n>=0){let r=[...e];return r[n]=z(e[n],t),r}let r=t.createdAt??``,i=e.findIndex(e=>(e.createdAt??``).localeCompare(r)<0),a=[...e];return a.splice(i<0?e.length:i,0,t),a}function oe(e,t){if(!e)return;let n=e.filter(e=>e.id!==t);return n.length===e.length?e:n}function z(e,t){return e?.usage?{...t,usage:e.usage}:t}var B=Object.freeze({});function se(){let e=B,t=new Set;return{subscribe(e){return t.add(e),()=>t.delete(e)},get:()=>e,set(n){e=n;for(let e of t)e()}}}var V=n(),ce=d(`/workspace/events`),H=2,U=3e3,W=[`run`,`run-deleted`,`todos`,`usage`,`ping`],G=[`project-added`,`project-removed`,`checkout-progress`,`automation-change`,`tracker-changed`],K=new Set;function le(e){return K.add(e),()=>{K.delete(e)}}var q=400,ue=15e3;function de(e){let t;return{onEvent(n){n.type!==`run`&&n.type!==`run-deleted`||t===void 0&&(t=setTimeout(()=>{t=void 0,e.invalidateQueries({queryKey:s.runsIndex})},q))},cancel(){clearTimeout(t),t=void 0}}}function fe(e,t){let n;for(let t of e.getQueryCache().getAll()){if(t.queryKey[1]!==`health`)continue;let e=t.state.data?.bootProject;if(typeof e==`string`){n=e;break}}let r=new Set([t]);return n===t&&r.add(`default`),[...r]}function pe(e){return[[`run-history`,e],[`run-history-context`,e],[`run-history-tail`,e]]}function J(e){return[[e,`runs`],[e,`todos`],[e,`worktrees`],...pe(e)]}function me(e){if(e[0]!==`workspace`)return e[0]===`run-history`||e[0]===`run-history-context`||e[0]===`run-history-tail`?typeof e[1]==`string`?e[1]:void 0:typeof e[0]==`string`?e[0]:void 0}function he(e){return[...new Set(e.getQueryCache().getAll().map(({queryKey:e})=>me(e)).filter(e=>e!==void 0))]}function ge(e){let t,n=new Set;return{onEvent(r){if(!(t!==void 0&&n.has(r))){for(let t of fe(e,r))n.add(t);t===void 0&&(t=setTimeout(()=>{t=void 0;let r=n;n=new Set;let i=f();for(let t of r)for(let n of J(t))e.invalidateQueries({queryKey:n,refetchType:t===i?`active`:`none`})},q))}},cancel(){clearTimeout(t),t=void 0,n.clear()}}}function _e(e,t,n){let r=new Map,i,a=0,o=()=>{if(clearTimeout(i),i=void 0,a>0)return;let o=Y(e),s=r;r=new Map;for(let r of s.values())r.project===o?X(e,t,r.event):n(r.project)},s=()=>{i===void 0&&(i=setTimeout(o,50))};return{onEvent(e,t){let n=e.type===`run`?e.run.id:e.id;r.set(`${t}:${n}`,{event:e,project:t}),s()},beginReconcile(){o(),a+=1},endReconcile(){a!==0&&(--a,a===0&&o())},cancel(){clearTimeout(i),i=void 0,r.clear(),a=0}}}async function ve(e){let t=f(),n=[i.runs.all,s.runsIndex,s.dashboard,i.todos,i.health,i.worktrees,s.providerStatus,s.hostUsage,[`run-history`,t],[`run-history-context`,t]],r=Promise.allSettled([Promise.all([e.cancelQueries({queryKey:[`tracker`],predicate:e=>e.queryKey[2]!==`items`||e.getObserversCount()===0}),e.cancelQueries({queryKey:s.projects})]).then(()=>Promise.all([e.invalidateQueries({queryKey:[`tracker`],predicate:e=>e.queryKey[2]!==`items`||e.getObserversCount()===0}),e.invalidateQueries({queryKey:s.projects})])),...he(e).filter(e=>e!==t).flatMap(t=>J(t).map(t=>e.invalidateQueries({queryKey:t,refetchType:`none`}))),...n.map(t=>e.invalidateQueries({queryKey:t}))]),a=!1,o;try{await Promise.race([r.then(()=>{a=!0}),new Promise(e=>{o=setTimeout(e,ue)})])}finally{clearTimeout(o)}a||await Promise.allSettled(n.map(t=>e.cancelQueries({queryKey:t})))}function Y(e){return m()??e.getQueryData(i.health)?.bootProject}function X(e,t,n){switch(n.type){case`run`:{e.setQueryData(i.runs.list(),e=>ae(e,n.run));let t=i.runs.detail(n.run.id);e.getQueryData(t)!==void 0&&e.setQueryData(t,e=>z(e,n.run));let r=i.runs.changes(n.run.id);e.getQueryData(r)!==void 0&&e.invalidateQueries({queryKey:r}),e.invalidateQueries({queryKey:i.worktrees});return}case`run-deleted`:e.setQueryData(i.runs.list(),e=>oe(e,n.id)),e.removeQueries({queryKey:i.runs.detail(n.id)}),e.removeQueries({queryKey:i.runs.diff(n.id)}),e.invalidateQueries({queryKey:i.worktrees});return;case`todos`:e.setQueryData(i.todos,n.items);return;case`usage`:t.set(n.usage);return;case`ping`:return}}function ye(e,t=ce){let n=r();(0,E.useEffect)(()=>{let r=globalThis.EventSource;if(typeof r!=`function`)return;let a=null,c,d,f=()=>{clearTimeout(c),clearTimeout(d),c=void 0,d=void 0,n.invalidateQueries({queryKey:s.dashboard,refetchType:document.visibilityState===`hidden`?`none`:`active`,predicate:e=>e.queryKey[2]!==`telemetry`&&e.queryKey[2]!==`automations`&&!(e.queryKey[2]===`feed`&&e.queryKey[3]===`github`)})},p=()=>{clearTimeout(c),c=setTimeout(f,250),d??=setTimeout(f,1e3)},m=de(n),h=ge(n),g=_e(n,e,h.onEvent),_,v=!1,y=!1,b=Date.now(),x,S=!1,C=!1,w=0,T=new Set,E=[],D=()=>{S=!0,C=!1;let e=s.providerStatus;n.cancelQueries({queryKey:e,exact:!0}).then(()=>n.invalidateQueries({queryKey:e,exact:!0,refetchType:`active`})).finally(()=>{if(y||!C){S=!1;return}D()})},O=e=>{let t=s.providerStatus,r=o(n.getQueryData(t),e);if(r!==void 0){n.setQueryData(t,r);return}if(S){C=!0;return}D()},k=()=>{w+=1,g.beginReconcile(),ve(n).finally(()=>{--w,w===0&&(y?(T.clear(),E=[]):A()),g.endReconcile()})},A=()=>{let e=T,t=E;T=new Set,E=[];let r=Y(n);for(let t of e)t===r?n.invalidateQueries({queryKey:i.todos}):h.onEvent(t);for(let e of t)O(e)},M=()=>{y||_!==void 0||(_=setTimeout(()=>{_=void 0,y||N()},U))},N=()=>{L.connected(!1),a?.close(),b=Date.now();let i=new r(t,{withCredentials:!0});a=i,i.addEventListener(`open`,()=>{y||a!==i||(b=Date.now(),v&&k(),L.connected(!0),v=!0)});for(let t of W)i.addEventListener(t,r=>{if(y||a!==i)return;b=Date.now();let o=re(t,r.data);if(o){if(m.onEvent(o.event),(o.event.type===`run`||o.event.type===`run-deleted`)&&(p(),o.project&&te(o.project,o.event.type===`run-deleted`?o.event.id:o.event.run),o.project&&(o.event.type===`run-deleted`||o.event.run.status!==`running`)&&L.remove(o.project,o.event.type===`run-deleted`?o.event.id:o.event.run.id)),t===`usage`)try{let e=ee.safeParse(JSON.parse(r.data));e.success&&L.replace(e.data.project,e.data.samples??[],e.data.sentAt)}catch{}if(o.project!==null&&o.project!==Y(n)){h.onEvent(o.project);return}o.event.type===`run`||o.event.type===`run-deleted`?o.project!==null&&g.onEvent(o.event,o.project):o.event.type===`todos`&&w>0?o.project!==null&&T.add(o.project):X(n,e,o.event)}});for(let e of G)i.addEventListener(e,t=>{if(y||a!==i)return;b=Date.now();let r;try{r=JSON.parse(t.data)}catch{return}if(e===`tracker-changed`){if(!u.safeParse(r).success)return;Promise.all([n.cancelQueries({queryKey:[`tracker`]}),n.cancelQueries({queryKey:s.projects})]).then(()=>Promise.all([n.invalidateQueries({queryKey:[`tracker`]}),n.invalidateQueries({queryKey:s.projects})]))}e!==`checkout-progress`&&e!==`automation-change`&&e!==`tracker-changed`&&(r&&typeof r==`object`&&(e===`project-removed`&&`id`in r&&typeof r.id==`string`?(j(r.id,!0),L.remove(r.id)):e===`project-added`&&`project`in r&&r.project&&typeof r.project==`object`&&`id`in r.project&&typeof r.project.id==`string`&&j(r.project.id,!1)),n.invalidateQueries({queryKey:s.projects}),n.invalidateQueries({queryKey:s.dashboard,refetchType:document.visibilityState===`hidden`?`none`:`active`}));for(let t of[...K])t(e,r)});i.addEventListener(`provider-status`,e=>{if(y||a!==i)return;b=Date.now();let t;try{t=JSON.parse(e.data)}catch{return}let n=l(t);if(n){if(w>0){E.push(n);return}O(n)}}),i.addEventListener(`error`,()=>{y||a!==i||(L.connected(!1),i.readyState===H&&M())})},P=()=>{document.visibilityState===`visible`&&(k(),(!a||a.readyState===H)&&(clearTimeout(_),_=void 0,N()))},F=()=>{clearTimeout(_),_=void 0;let e=a;a=null,L.connected(!1),e?.close()},I=e=>{e.persisted&&(k(),N())};return x=setInterval(()=>{y||document.visibilityState!==`visible`||Date.now()-b<=4e4||(clearTimeout(_),_=void 0,N())},1e4),document.addEventListener(`visibilitychange`,P),window.addEventListener(`pagehide`,F),window.addEventListener(`pageshow`,I),N(),()=>{y=!0,clearTimeout(_),clearInterval(x),L.connected(!1),clearTimeout(c),clearTimeout(d),m.cancel(),h.cancel(),g.cancel(),T.clear(),E=[],document.removeEventListener(`visibilitychange`,P),window.removeEventListener(`pagehide`,F),window.removeEventListener(`pageshow`,I);let e=a;a=null,L.connected(!1),e?.close()}},[n,e,t])}var Z=(0,E.createContext)(null);function be({children:e}){let[t]=(0,E.useState)(se);return ye(t),c(),(0,V.jsx)(Z.Provider,{value:t,children:e})}function xe(e){let t=(0,E.useContext)(Z),n=t?t.get:Se;return(0,E.useSyncExternalStore)(t?t.subscribe:Q,()=>e?n()[e]:void 0,()=>void 0)}var Q=()=>()=>void 0,Se=()=>B,Ce=p(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),we=p(`dollar-sign`,[[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`22`,key:`7eqyqh`}],[`path`,{d:`M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6`,key:`1b0p4s`}]]),Te=p(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),Ee=p(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]);function $({slot:e,label:t,value:n,options:r,onChange:i,full:a=!1,allowRelease:o=!1,className:s}){return(0,V.jsx)(`div`,{"data-slot":e,"data-full":a?`true`:void 0,role:`group`,"aria-label":t,className:h(`inline-flex gap-0.5 rounded-md bg-muted p-[3px]`,a&&`flex w-full`,s),children:r.map(e=>{let t=e.value===n;return(0,V.jsxs)(`button`,{type:`button`,"data-value":e.value,"aria-pressed":t,onClick:()=>{t&&!o||i(e.value)},className:h(`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`,a&&`flex-1`,t&&`bg-card font-semibold text-foreground shadow-xs`),children:[e.label,e.count===void 0?null:(0,V.jsx)(`small`,{className:`font-mono text-[11px] font-normal tabular-nums`,children:e.count})]},e.value)})})}function De({slot:e,label:t,options:n,selected:r,onToggle:i,onClear:o,searchPlaceholder:s,emptyLabel:c=`Nothing to filter by`}){let[l,u]=E.useState(!1),d=r.length>0,f=r.length===1?n.find(e=>e.value===r[0])?.label??r[0]:`${r.length} selected`;return(0,V.jsxs)(y,{open:l,onOpenChange:u,children:[(0,V.jsx)(g,{asChild:!0,children:(0,V.jsxs)(`button`,{type:`button`,"data-slot":`facet-${e}`,"data-active":d?`true`:void 0,"aria-label":`Filter by ${t.toLowerCase()}`,className:h(`inline-flex h-7 items-center gap-1.5 rounded-full border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,d&&`border-violet/40 bg-violet/10 text-foreground`),children:[(0,V.jsx)(`span`,{className:h(d&&`text-soft-foreground`),children:t}),d?(0,V.jsx)(`span`,{className:`max-w-[140px] truncate font-semibold`,children:f}):null,(0,V.jsx)(v,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,V.jsxs)(_,{align:`start`,className:`w-64 p-0`,"data-testid":`facet-${e}-menu`,children:[(0,V.jsxs)(T,{children:[(0,V.jsx)(b,{placeholder:s??`Search ${t.toLowerCase()}…`}),(0,V.jsxs)(w,{children:[(0,V.jsx)(C,{children:c}),(0,V.jsx)(x,{children:n.map(e=>{let t=r.includes(e.value);return(0,V.jsxs)(S,{value:e.label,onSelect:()=>i(e.value),"data-slot":`facet-option`,"data-value":e.value,"aria-checked":t,role:`option`,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:h(`flex size-4 shrink-0 items-center justify-center rounded-[4px] border`,t?`border-violet bg-violet text-violet-foreground`:`border-input`),children:t?(0,V.jsx)(a,{className:`size-3`}):null}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.count===void 0?null:(0,V.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-soft-foreground tabular-nums`,children:e.count})]},e.value)})})]})]}),d?(0,V.jsx)(`div`,{className:`border-t border-border p-1`,children:(0,V.jsxs)(`button`,{type:`button`,"data-action":`facet-${e}-clear`,onClick:()=>o(),className:`w-full rounded-sm px-2 py-1.5 text-left text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[`Clear `,t.toLowerCase()]})}):null]})]})}function Oe({label:e,count:t,selected:n,onToggle:r,slot:i,tone:a=`neutral`}){return(0,V.jsxs)(`button`,{type:`button`,"data-slot":i,"data-selected":n?`true`:void 0,"aria-pressed":n,onClick:r,className:h(`inline-flex h-7 items-center gap-1.5 rounded-full border px-2.5 text-xs font-medium transition-colors`,a===`tag`?`border-violet/25 bg-violet/10 text-violet hover:bg-violet/20`:`border-border bg-card text-muted-foreground hover:bg-muted hover:text-foreground`,n&&`border-violet bg-violet text-violet-foreground hover:bg-violet`),children:[e,t===void 0?null:(0,V.jsx)(`span`,{className:h(`font-mono text-[11px] tabular-nums`,!n&&`text-soft-foreground`),children:t})]})}function ke({slot:e,label:t,value:n,options:r,onChange:i}){return(0,V.jsx)($,{slot:e,label:t,value:n,options:r,onChange:i,allowRelease:!0})}export{Ee as a,Ce as c,xe as d,L as f,M as g,F as h,$ as i,be as l,N as m,ke as n,Te as o,ne as p,Oe as r,we as s,De as t,le as u};
|
|
@@ -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{a as r}from"./centered-state-DJLgwvA4.js";import{n as i,t as a}from"./utils-DoBmOlX3.js";import{t as o}from"./chevron-right-B3Ta8VKK.js";import{c as s,m as c,n as l,r as u,t as d}from"./dropdown-menu-B7HeKCfN.js";import{t as f}from"./ellipsis-vertical-g4O4NlLV.js";import{t as p}from"./file-wXNeZwi7.js";import{t as m}from"./folder-wjVId5un.js";import{n as h,r as g,t as _}from"./diff-controls-DskkZqmD.js";import{t as v}from"./git-pull-request-BBEDdTLK.js";import{t as y}from"./square-terminal-C7KCPznz.js";import{t as b}from"./upload-B4OIpdyq.js";import{t as x}from"./diff-stat-yKn7joEr.js";var S=e(t(),1),C=n();function w({root:e,selected:t,onSelect:n}){return(0,C.jsx)(`nav`,{"data-slot":`changes-tree`,"aria-label":`Changed files`,className:`min-w-0 text-[13px]`,children:(0,C.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,C.jsx)(E,{dir:e,depth:0,selected:t,onSelect:n},e.path)),e.files.map(e=>(0,C.jsx)(O,{file:e,depth:0,selected:t,onSelect:n},e.path))]})})}function T({adds:e,dels:t}){return(0,C.jsxs)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-[11px] font-medium tabular-nums`,children:[e>0?(0,C.jsxs)(`span`,{className:`text-success`,children:[`+`,e]}):null,e>0&&t>0?` `:null,t>0?(0,C.jsxs)(`span`,{className:`text-danger`,children:[`−`,t]}):null]})}function E({dir:e,depth:t,selected:n,onSelect:r}){let[i,s]=(0,S.useState)(!0);return(0,C.jsxs)(`li`,{children:[(0,C.jsxs)(`button`,{type:`button`,"data-slot":`tree-dir`,"data-path":e.path,"data-state":i?`open`:`closed`,"aria-expanded":i,onClick:()=>s(e=>!e),className:`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+t*14}px`},children:[(0,C.jsx)(o,{"aria-hidden":`true`,className:a(`size-3.5 shrink-0 transition-transform`,i&&`rotate-90`)}),(0,C.jsx)(m,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,C.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:e.name}),(0,C.jsx)(T,{adds:e.adds,dels:e.dels})]}),i?(0,C.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,C.jsx)(E,{dir:e,depth:t+1,selected:n,onSelect:r},e.path)),e.files.map(e=>(0,C.jsx)(O,{file:e,depth:t+1,selected:n,onSelect:r},e.path))]}):null]})}var D={added:`text-success`,deleted:`text-danger`};function O({file:e,depth:t,selected:n,onSelect:r}){let i=n===e.path;return(0,C.jsx)(`li`,{children:(0,C.jsxs)(`button`,{type:`button`,"data-slot":`tree-file`,"data-path":e.path,"aria-current":i?`true`:void 0,onClick:()=>r(e.path),className:a(`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,i?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${24+t*14}px`},children:[(0,C.jsx)(p,{"aria-hidden":`true`,className:a(`size-3.5 shrink-0`,D[e.status])}),(0,C.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),(0,C.jsx)(T,{adds:e.adds,dels:e.dels})]})})}function k(e,t){return{kind:`dir`,name:e,path:t,dirs:[],files:[],adds:0,dels:0,fileCount:0}}function A(e){let t=e;for(;t.files.length===0&&t.dirs.length===1;){let e=t.dirs[0];t={...e,name:`${t.name}/${e.name}`}}return{...t,dirs:t.dirs.map(A)}}var j=(e,t)=>e.name.localeCompare(t.name);function M(e){let t=k(``,``),n=new Map([[``,t]]),r=e=>{let t=n.get(e);if(t)return t;let i=e.lastIndexOf(`/`),a=r(i===-1?``:e.slice(0,i)),o=k(i===-1?e:e.slice(i+1),e);return a.dirs.push(o),n.set(e,o),o};for(let t of e){let e=t.path.lastIndexOf(`/`);r(e===-1?``:t.path.slice(0,e)).files.push({kind:`file`,name:e===-1?t.path:t.path.slice(e+1),path:t.path,status:t.status,adds:t.adds,dels:t.dels,binary:t.binary})}let i=e=>{e.dirs.forEach(i),e.adds=e.files.reduce((e,t)=>e+t.adds,0)+e.dirs.reduce((e,t)=>e+t.adds,0),e.dels=e.files.reduce((e,t)=>e+t.dels,0)+e.dirs.reduce((e,t)=>e+t.dels,0),e.fileCount=e.files.length+e.dirs.reduce((e,t)=>e+t.fileCount,0),e.dirs.sort(j),e.files.sort(j)};return i(t),{...t,dirs:t.dirs.map(A)}}function N({bar:e,branch:t,stat:n,mode:i,wrap:a,onModeChange:o,onWrapChange:c,onAction:p}){return(0,C.jsxs)(`div`,{"data-slot":`git-toolbar`,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[t?(0,C.jsx)(_,{branch:t}):null,n?(0,C.jsx)(I,{stat:n}):null,(0,C.jsxs)(`span`,{className:`ml-auto flex items-center gap-1`,children:[(0,C.jsx)(`span`,{className:`hidden items-center gap-1 md:flex`,children:(0,C.jsx)(h,{mode:i,wrap:a,onModeChange:o,onWrapChange:c})}),e.secondary.map(e=>(0,C.jsx)(F,{action:e,variant:`outline`,onAction:p},e.id)),(0,C.jsx)(F,{action:e.primary,variant:`primary`,onAction:p}),e.menu.length>0?(0,C.jsxs)(d,{children:[(0,C.jsx)(s,{asChild:!0,children:(0,C.jsx)(r,{variant:`ghost`,size:`icon-sm`,"aria-label":`More git actions`,children:(0,C.jsx)(f,{"aria-hidden":`true`})})}),(0,C.jsx)(l,{align:`end`,"data-slot":`git-toolbar-menu`,children:e.menu.map(e=>(0,C.jsxs)(u,{disabled:!e.enabled,title:e.reason,onSelect:()=>p(e.id),children:[P[e.id],e.label]},e.id))})]}):null]})]})}var P={commit:(0,C.jsx)(g,{"aria-hidden":`true`}),push:(0,C.jsx)(b,{"aria-hidden":`true`}),"create-pr":(0,C.jsx)(v,{"aria-hidden":`true`}),"view-pr":(0,C.jsx)(c,{"aria-hidden":`true`}),"open-terminal":(0,C.jsx)(y,{"aria-hidden":`true`})};function F({action:e,variant:t,onAction:n}){return e.id===`view-pr`?i(e.href)?(0,C.jsx)(r,{asChild:!0,variant:t,size:`sm`,"data-action":e.id,children:(0,C.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,children:[P[e.id],e.label]})}):(0,C.jsxs)(r,{variant:t,size:`sm`,"data-action":e.id,disabled:!0,title:`View PR unavailable — the recorded PR link is not an http(s) URL`,children:[P[e.id],e.label]}):(0,C.jsxs)(r,{variant:t,size:`sm`,"data-action":e.id,disabled:!e.enabled,title:e.enabled?void 0:e.reason,onClick:()=>n(e.id),children:[P[e.id],e.label]})}function I({stat:e}){return(0,C.jsx)(`span`,{"data-slot":`changes-stat`,children:(0,C.jsx)(x,{stat:{adds:L(e.adds),dels:L(e.dels),files:e.files}})})}function L(e){let[t,n]=(0,S.useState)(e),r=(0,S.useRef)(e);return(0,S.useEffect)(()=>{let t=r.current;if(t===e)return;if(typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||typeof requestAnimationFrame!=`function`){r.current=e,n(e);return}let i=performance.now(),a=0,o=s=>{let c=Math.min(1,(s-i)/350),l=1-(1-c)**3;n(Math.round(t+(e-t)*l)),c<1?a=requestAnimationFrame(o):r.current=e};return a=requestAnimationFrame(o),()=>{cancelAnimationFrame(a),r.current=e,n(e)}},[e]),t}export{w as i,N as n,M as r,I as t};
|