forge-openclaw-plugin 0.3.15 → 0.3.17
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 +6 -6
- package/dist/assets/{action-bar-B9MYlps2.js → action-bar-D3CEYlj4.js} +1 -1
- package/dist/assets/{activity-page-DbzbChcE.js → activity-page-Ce1pHIu5.js} +1 -1
- package/dist/assets/{ai-surface-workspace-CF0257Hs.js → ai-surface-workspace-DEliwOjF.js} +1 -1
- package/dist/assets/artifacts-page-BgyFVIVM.js +2 -0
- package/dist/assets/{atlas-panel-CO3RYAKn.js → atlas-panel-VZOnJa1c.js} +1 -1
- package/dist/assets/{board-CuxQRKPJ.js → board-DprRipIG.js} +1 -1
- package/dist/assets/{calendar-page-BuuHKEHC.js → calendar-page-Zstsn4uG.js} +1 -1
- package/dist/assets/{calendar-rules-DKftgNx5.js → calendar-rules-BGIBuEDk.js} +1 -1
- package/dist/assets/{calendar-week-toolbar-ChIpkT-G.js → calendar-week-toolbar-DXFkMkbq.js} +1 -1
- package/dist/assets/{charts-BzT4pUPg.js → charts-C5S0-BL7.js} +1 -1
- package/dist/assets/{companion-sync-lab-page-BZRX4Btw.js → companion-sync-lab-page-DIPPLFKt.js} +1 -1
- package/dist/assets/{daily-metrics-dashboard-CXDsaAQd.js → daily-metrics-dashboard-CG-OOCJz.js} +1 -1
- package/dist/assets/{define-workbench-box-CpG0Zb1L.js → define-workbench-box-BEEdtBkQ.js} +1 -1
- package/dist/assets/{entity-link-multiselect-Dl4rZqdg.js → entity-link-multiselect-BfDAROHB.js} +1 -1
- package/dist/assets/{entity-note-count-link-Bs1aKYyD.js → entity-note-count-link-BGOiaash.js} +1 -1
- package/dist/assets/{entity-notes-surface-B56XSw7M.js → entity-notes-surface-DPsJwqQa.js} +1 -1
- package/dist/assets/execution-board-Dg-2GSKv.js +1 -0
- package/dist/assets/{faceted-token-search-Dg2rjknH.js → faceted-token-search-DV7MSVYb.js} +1 -1
- package/dist/assets/{flagship-signal-deck-C6KVPhmM.js → flagship-signal-deck-D3wVL3bC.js} +1 -1
- package/dist/assets/{floating-action-menu-DAFAEBcA.js → floating-action-menu-BUs382px.js} +1 -1
- package/dist/assets/{forms-D1qJ3oOP.js → forms-ByKjodjN.js} +1 -1
- package/dist/assets/{generic-node-view-C6DK5hJ6.js → generic-node-view-BY5dbPXJ.js} +1 -1
- package/dist/assets/{goal-detail-page-CC4VXud6.js → goal-detail-page-MYr6j2B4.js} +1 -1
- package/dist/assets/{goal-dialog-15hD8EBp.js → goal-dialog-nkdME5Uy.js} +1 -1
- package/dist/assets/goals-page-BsFeBzU1.js +1 -0
- package/dist/assets/{graph-BF4IsheG.js → graph-CHVj0Z7n.js} +1 -1
- package/dist/assets/habits-page-wO461EVU.js +1 -0
- package/dist/assets/{health-boxes-DqgvIYoL.js → health-boxes-BphMeSJj.js} +1 -1
- package/dist/assets/index-CSd8ylsy.css +1 -0
- package/dist/assets/index-gmPaoLN-.js +2 -0
- package/dist/assets/{inline-note-fields-COgzxr_7.js → inline-note-fields-BvQwmMAv.js} +1 -1
- package/dist/assets/{insight-flow-dialog-Dmb6NSGp.js → insight-flow-dialog-H_eaOmst.js} +1 -1
- package/dist/assets/{insights-page-OnqR4cYI.js → insights-page-DINYe3cB.js} +3 -3
- package/dist/assets/{kanban-boxes-BWUzntCV.js → kanban-boxes-oACOTDYG.js} +1 -1
- package/dist/assets/{kanban-page-BI16Gzp_.js → kanban-page-BGLXH91f.js} +1 -1
- package/dist/assets/knowledge-graph-page-VfMvw5jL.js +1 -0
- package/dist/assets/{life-force-page-CDEXEQai.js → life-force-page-DQPb6UL-.js} +1 -1
- package/dist/assets/{life-force-workspace-C7UOnJEf.js → life-force-workspace-BJ1aI3JE.js} +1 -1
- package/dist/assets/{maps-BTVHALP8.js → maps-CvEHVkBk.js} +1 -1
- package/dist/assets/{metric-tile-boeHB1R1.js → metric-tile-CbEe19Gd.js} +1 -1
- package/dist/assets/{motion-DcgUnXhY.js → motion-BibSzp57.js} +1 -1
- package/dist/assets/{movement-boxes-BUSqaTL2.js → movement-boxes-dtDYhw5c.js} +1 -1
- package/dist/assets/{movement-page-DcbO0497.js → movement-page-BhmwCHjs.js} +1 -1
- package/dist/assets/{note-markdown-DXXI3W3V.js → note-markdown-CG8u2d6p.js} +1 -1
- package/dist/assets/{note-tags-input-CYh3TVW2.js → note-tags-input-D_conqDO.js} +1 -1
- package/dist/assets/{notes-boxes-CMJXX2K0.js → notes-boxes-BLKucFqW.js} +1 -1
- package/dist/assets/notes-page-CafVxWjb.js +1 -0
- package/dist/assets/{open-in-graph-button-4UYrp1XP.js → open-in-graph-button-DFQ4r6SN.js} +1 -1
- package/dist/assets/{orbit-map-BwK7sDaC.js → orbit-map-DsEl3ori.js} +1 -1
- package/dist/assets/overview-page-BffcX-pM.js +1 -0
- package/dist/assets/page-hero-U603l9rQ.js +1 -0
- package/dist/assets/pill-cluster-BYVFNppV.js +1 -0
- package/dist/assets/{preference-entity-handoff-button-C2ATjvws.js → preference-entity-handoff-button-cPrTpHsV.js} +1 -1
- package/dist/assets/{preferences-page-BAexXHye.js → preferences-page-DQjFIOmt.js} +1 -1
- package/dist/assets/{project-collections-B9nr-Ts-.js → project-collections-B9OGHGqm.js} +1 -1
- package/dist/assets/project-detail-page-r1Sw2kcO.js +1 -0
- package/dist/assets/{project-dialog-CBA-D65n.js → project-dialog-B2_PcXAf.js} +1 -1
- package/dist/assets/project-management-hierarchy-page-qLNG8hsh.js +1 -0
- package/dist/assets/{project-management-section-nav-DJ3QKCtr.js → project-management-section-nav-DFUlmMEB.js} +1 -1
- package/dist/assets/{projects-boxes-iBu_PRqe.js → projects-boxes-BA7_XaqX.js} +1 -1
- package/dist/assets/projects-page-B6ggXWFw.js +1 -0
- package/dist/assets/psyche-behaviors-page-ByWpXlLq.js +5 -0
- package/dist/assets/{psyche-flashcards-page-DQaw_vUQ.js → psyche-flashcards-page-B9nSc0mk.js} +1 -1
- package/dist/assets/{psyche-goal-map-page-C-ZTVOEP.js → psyche-goal-map-page-BQU7qI88.js} +1 -1
- package/dist/assets/{psyche-graph-DYzeClxn.js → psyche-graph-DCeP7r2b.js} +1 -1
- package/dist/assets/{psyche-metrics-page-C9hKn10A.js → psyche-metrics-page-DD2lOP-J.js} +1 -1
- package/dist/assets/psyche-mode-guide-page-DbtZgnjr.js +1 -0
- package/dist/assets/psyche-modes-page-3zFJWFQf.js +1 -0
- package/dist/assets/psyche-page-D5vXYkfB.js +1 -0
- package/dist/assets/psyche-patterns-page-BneAAeKS.js +5 -0
- package/dist/assets/{psyche-questionnaire-builder-page-gRwdGXde.js → psyche-questionnaire-builder-page-BH1la5C9.js} +1 -1
- package/dist/assets/{psyche-questionnaire-detail-page-CIP9b2UI.js → psyche-questionnaire-detail-page-DYav634P.js} +1 -1
- package/dist/assets/psyche-questionnaire-run-detail-page-9VaijhJm.js +1 -0
- package/dist/assets/{psyche-questionnaire-run-page-CXiJyd5i.js → psyche-questionnaire-run-page-e1T6k_dS.js} +1 -1
- package/dist/assets/{psyche-questionnaires-page-CFPKwA3O.js → psyche-questionnaires-page-Dyv367z9.js} +1 -1
- package/dist/assets/{psyche-report-detail-page-dU30a2WE.js → psyche-report-detail-page-hqxHIXw2.js} +3 -3
- package/dist/assets/psyche-reports-page-DhIfcGbt.js +1 -0
- package/dist/assets/{psyche-schemas-DDol0j-g.js → psyche-schemas-Cg51Ztxz.js} +1 -1
- package/dist/assets/psyche-schemas-beliefs-page-Dgb5o9vx.js +9 -0
- package/dist/assets/{psyche-screen-time-page-lIe6GQxJ.js → psyche-screen-time-page-D6MnJGNa.js} +1 -1
- package/dist/assets/{psyche-self-observation-page-BTE3KfIl.js → psyche-self-observation-page-C1Vyezbv.js} +1 -1
- package/dist/assets/{psyche-values-page-DclBZ9xw.js → psyche-values-page-B_JWVw1Q.js} +2 -2
- package/dist/assets/{question-flow-dialog-Ded2E85L.js → question-flow-dialog-yMYVk998.js} +2 -2
- package/dist/assets/{report-chain-fields-DY640iqL.js → report-chain-fields-D4NM9a6I.js} +1 -1
- package/dist/assets/rewards-page-B5-bcL4R.js +1 -0
- package/dist/assets/{scheduling-rules-editor-jakFfxqF.js → scheduling-rules-editor-De72IUax.js} +1 -1
- package/dist/assets/{schema-badge-30B5syHA.js → schema-badge-jX28kUa6.js} +1 -1
- package/dist/assets/{schemas-Db29G8NU.js → schemas-BlFy-uPR.js} +1 -1
- package/dist/assets/{select-menu-BF2zI3RW.js → select-menu-BXv1rsVc.js} +1 -1
- package/dist/assets/{settings-agents-page-Bh-Bv6FQ.js → settings-agents-page-DN_np10S.js} +1 -1
- package/dist/assets/settings-bin-page-BM5BpK_i.js +1 -0
- package/dist/assets/{settings-calendar-page-BA4_Qqiu.js → settings-calendar-page-Cg0gSSFs.js} +3 -3
- package/dist/assets/{settings-data-page-K4kpmQJY.js → settings-data-page-Dwmp2rLy.js} +1 -1
- package/dist/assets/{settings-logs-page-DkuNPAZo.js → settings-logs-page-DQNM21Re.js} +1 -1
- package/dist/assets/{settings-mobile-page-4pCNwD91.js → settings-mobile-page-DQdiRa-a.js} +1 -1
- package/dist/assets/settings-models-page-CAEPpuHF.js +1 -0
- package/dist/assets/{settings-page-B_Be0vOY.js → settings-page-Cl2KiCFg.js} +1 -1
- package/dist/assets/{settings-rewards-page-C6nFTWJu.js → settings-rewards-page-DoIUumhe.js} +1 -1
- package/dist/assets/{settings-section-nav-Lo-VKCfZ.js → settings-section-nav-D_N87IG0.js} +1 -1
- package/dist/assets/{settings-users-page-CVzNp4-m.js → settings-users-page-CPesR62N.js} +1 -1
- package/dist/assets/{settings-wiki-page-DXM--7BB.js → settings-wiki-page-BxMQM5Vi.js} +1 -1
- package/dist/assets/{sleep-page-DvPdZMKx.js → sleep-page-DUYmQKrg.js} +1 -1
- package/dist/assets/{sports-page-DjuZlOur.js → sports-page-Bzi5TF9T.js} +1 -1
- package/dist/assets/{state-Bpe5dF3T.js → state-BFyKSULP.js} +1 -1
- package/dist/assets/{strategies-page-PE1IlatS.js → strategies-page-C-T2MZx4.js} +1 -1
- package/dist/assets/{strategy-detail-page-C4KiEGCI.js → strategy-detail-page-3tYuSZu-.js} +1 -1
- package/dist/assets/{strategy-dialog-Cwf7Y3P5.js → strategy-dialog-BWm4slo4.js} +1 -1
- package/dist/assets/{surface-ubuOfukq.js → surface-BJObZeRw.js} +1 -1
- package/dist/assets/{table-U7otr5go.js → table-CTLroJKN.js} +1 -1
- package/dist/assets/task-detail-page-ZZOXSpSF.js +1 -0
- package/dist/assets/{task-dialog-CI_Fy_FW.js → task-dialog-2wy0xI7f.js} +5 -5
- package/dist/assets/timebox-planning-dialog-C6h0Hp71.js +1 -0
- package/dist/assets/{today-boxes-CYuxSkZf.js → today-boxes-B_TdgSDz.js} +1 -1
- package/dist/assets/today-page-Dipns9tl.js +1 -0
- package/dist/assets/training-load-page-B78e1-o-.js +1 -0
- package/dist/assets/{ui-B9TWEtCx.js → ui-uo_bNP7c.js} +1 -1
- package/dist/assets/{use-anchored-overlay-position-BY4kNzPj.js → use-anchored-overlay-position-BSxFX6Hi.js} +1 -1
- package/dist/assets/{use-psyche-focus-target-BhNedCZB.js → use-psyche-focus-target-1GLkhYiv.js} +1 -1
- package/dist/assets/{user-badge-ByhC6bMU.js → user-badge-C4eZu1e_.js} +1 -1
- package/dist/assets/{user-select-field-fx129Uh6.js → user-select-field-CmKwcbZt.js} +1 -1
- package/dist/assets/{utility-widgets-ilORjDmg.js → utility-widgets-B06wQFrd.js} +2 -2
- package/dist/assets/{vendor-BwL6m4SE.js → vendor-B7FKSwHK.js} +222 -212
- package/dist/assets/{vitals-page-mdEqIm_9.js → vitals-page-BC7QFsm2.js} +1 -1
- package/dist/assets/{weekly-review-page-C8W-yg5r.js → weekly-review-page-BjNsNoWj.js} +1 -1
- package/dist/assets/{weight-loss-page-BApTknCn.js → weight-loss-page-BOahGY9r.js} +1 -1
- package/dist/assets/{wiki-article-markdown-DBccllQg.js → wiki-article-markdown-DO47HnZf.js} +2 -2
- package/dist/assets/{wiki-editor-page-BfRfH1O3.js → wiki-editor-page-OWRUHl4O.js} +5 -5
- package/dist/assets/{wiki-ingest-history-page-C-6H3MU6.js → wiki-ingest-history-page-CuHpg2lZ.js} +1 -1
- package/dist/assets/{wiki-ingest-modal-DnlhByD_.js → wiki-ingest-modal-EZ3kX-vA.js} +1 -1
- package/dist/assets/wiki-page-BPV3HIgu.js +1 -0
- package/dist/assets/{workbench-flow-page-_-NKIx5R.js → workbench-flow-page-C53KueEz.js} +3 -3
- package/dist/assets/{workbench-page-NIAzggwX.js → workbench-page-DJ7nT2JQ.js} +1 -1
- package/dist/assets/workout-detail-page-Dhyu0q7o.js +2 -0
- package/dist/index.html +8 -8
- package/dist/openclaw/api-client.js +28 -2
- package/dist/openclaw/local-runtime.js +31 -14
- package/dist/openclaw/parity.d.ts +1 -1
- package/dist/openclaw/parity.js +10 -0
- package/dist/openclaw/routes.js +78 -0
- package/dist/openclaw/tools.js +42 -0
- package/dist/server/apps/api/migrations/072_artifact_store.sql +106 -0
- package/dist/server/{server → apps/api}/src/app.js +365 -4
- package/dist/server/{server → apps/api}/src/connectors/box-registry.js +3 -3
- package/dist/server/{server → apps/api}/src/db.js +23 -4
- package/dist/server/{server → apps/api}/src/health-weight-loss.js +1 -1
- package/dist/server/{server → apps/api}/src/openapi.js +570 -1
- package/dist/server/{server → apps/api}/src/questionnaire-seeds.js +1 -1
- package/dist/server/{server → apps/api}/src/repositories/ai-connectors.js +1 -1
- package/dist/server/apps/api/src/repositories/entity-links.js +66 -0
- package/dist/server/{server → apps/api}/src/repositories/habits.js +1 -1
- package/dist/server/apps/api/src/services/artifacts.js +1059 -0
- package/dist/server/{server → apps/api}/src/services/companion-iroh.js +4 -1
- package/dist/server/{server → apps/api}/src/services/doctor.js +3 -3
- package/dist/server/{server → apps/api}/src/services/entity-crud.js +22 -0
- package/dist/server/{server → apps/api}/src/services/gamification-assets.js +1 -1
- package/dist/server/{server → apps/api}/src/services/gamification.js +1 -1
- package/dist/server/{server → apps/api}/src/services/knowledge-graph.js +48 -3
- package/dist/server/{server → apps/api}/src/services/psyche-observation-calendar.js +1 -0
- package/dist/server/{server → apps/api}/src/types.js +4 -2
- package/dist/server/{server → apps/api}/src/watch-mobile.js +1 -1
- package/dist/server/{src → apps/web/src}/lib/api.js +69 -0
- package/dist/server/{src → apps/web/src}/lib/entity-visuals.js +10 -1
- package/dist/server/{src → apps/web/src}/lib/knowledge-graph-types.js +9 -0
- package/openclaw.plugin.json +2 -1
- package/package.json +3 -3
- package/server/index.js +3 -3
- package/server/migrations/072_artifact_store.sql +106 -0
- package/skills/forge-openclaw/SKILL.md +60 -7
- package/skills/forge-openclaw/entity_conversation_playbooks.md +212 -14
- package/skills/forge-openclaw/psyche_entity_playbooks.md +20 -0
- package/dist/assets/execution-board-D66C_ikW.js +0 -1
- package/dist/assets/goals-page-CQ2lJMzI.js +0 -1
- package/dist/assets/habits-page-a7KVPaQp.js +0 -1
- package/dist/assets/index-ClJbJhca.css +0 -1
- package/dist/assets/index-FpGANF9S.js +0 -2
- package/dist/assets/knowledge-graph-page-DxEBaEke.js +0 -1
- package/dist/assets/notes-page-DvHMcQey.js +0 -1
- package/dist/assets/overview-page-Z5vaUTm3.js +0 -1
- package/dist/assets/page-hero-DvrM83_C.js +0 -1
- package/dist/assets/pill-cluster-DYI3Ibj8.js +0 -1
- package/dist/assets/project-detail-page-B9PqyPu9.js +0 -1
- package/dist/assets/project-management-hierarchy-page-DXK14jn0.js +0 -1
- package/dist/assets/projects-page-CdAk-ByT.js +0 -1
- package/dist/assets/psyche-behaviors-page-CbhhTfU2.js +0 -5
- package/dist/assets/psyche-mode-guide-page-CR8e984W.js +0 -1
- package/dist/assets/psyche-modes-page-lQdpAcY3.js +0 -1
- package/dist/assets/psyche-page-CTdIDkw9.js +0 -1
- package/dist/assets/psyche-patterns-page-Drgm-f7I.js +0 -5
- package/dist/assets/psyche-questionnaire-run-detail-page-SYndwtF3.js +0 -1
- package/dist/assets/psyche-reports-page-Cn0EBndy.js +0 -1
- package/dist/assets/psyche-schemas-beliefs-page-Bab4xSWv.js +0 -9
- package/dist/assets/rewards-page-FxUXB76B.js +0 -1
- package/dist/assets/settings-bin-page-DT8JJero.js +0 -1
- package/dist/assets/settings-models-page-CZHG3t7W.js +0 -1
- package/dist/assets/task-detail-page-B3SMFZQ3.js +0 -1
- package/dist/assets/timebox-planning-dialog-BtFuVoA1.js +0 -1
- package/dist/assets/today-page-CHGpLEZ3.js +0 -1
- package/dist/assets/training-load-page-GZJF-Yy5.js +0 -1
- package/dist/assets/wiki-page-DPZ55e3x.js +0 -1
- package/dist/assets/workout-detail-page-3fxr6HL4.js +0 -2
- /package/dist/server/{server → apps/api}/migrations/001_core.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/002_psyche.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/003_habits.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/004_habit_links.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/005_habit_psyche_links.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/006_work_adjustments.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/007_weekly_review_closures.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/008_calendar_execution.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/009_true_calendar_events.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/010_calendar_selection_state.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/011_calendar_timezone_backfill.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/012_work_block_ranges.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/013_microsoft_local_auth_settings.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/014_note_tags_and_ephemeral.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/015_multi_user_and_strategies.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/016_health_companion.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/016_strategy_contracts_and_user_graph.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/017_preferences.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/018_preference_catalogs.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/019_wiki_memory.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/020_wiki_page_hierarchy.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/021_hide_evidence_from_wiki_index.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/022_wiki_ingest_background.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/023_diagnostic_logs.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/024_questionnaires.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/025_ai_model_connections.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/026_custom_theme_settings.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/027_ai_processors.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/028_movement_domain.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/029_watch_micro_capture.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/030_surface_layouts.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/031_ai_processor_runtime_upgrades.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/032_ai_connectors.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/033_movement_trip_point_sync.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/034_movement_segment_sync.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/035_google_local_auth_settings.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/036_google_local_auth_client_secret.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/037_workbench_public_inputs_and_run_inputs.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/038_data_management_settings.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/039_life_force_and_action_points.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/040_screen_time_domain.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/041_companion_source_states.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/042_movement_boxes.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/043_movement_box_overlap_overrides.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/044_macos_local_calendar_provider.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/045_sleep_nights_and_raw_segments.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/046_work_item_hierarchy.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/047_sleep_source_records.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/048_task_run_git_context.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/049_agent_runtime_sessions.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/050_agent_token_bootstrap_policy.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/051_agent_token_scope_policy.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/052_agent_identity_tightening.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/053_agent_runtime_session_canonical_labels.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/054_sqlite_backed_wiki_memory.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/055_gamification_progression.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/056_gamification_equipment.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/057_gamification_catalog_cleanup.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/058_gamification_theme_preference.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/059_data_backup_retention.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/060_psyche_devrage_metrics.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/061_health_workout_raw_evidence.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/062_health_mobile_sync_sessions.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/063_psyche_flashcards.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/064_health_workout_time_series_identity.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/065_weight_loss_nutrition_insights.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/066_watch_action_receipts.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/067_weight_loss_daily_active_overrides.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/068_remove_generated_movement_wiki_logs.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/069_psyche_devrage_cumulative_rage.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/070_health_mobile_sync_completion_index.sql +0 -0
- /package/dist/server/{server → apps/api}/migrations/071_agent_runtime_claude_identity.sql +0 -0
- /package/dist/server/{server → apps/api}/src/data-management-types.js +0 -0
- /package/dist/server/{server → apps/api}/src/debug.js +0 -0
- /package/dist/server/{server → apps/api}/src/demo-data.js +0 -0
- /package/dist/server/{server → apps/api}/src/discovery-advertiser.js +0 -0
- /package/dist/server/{server → apps/api}/src/e2e-server.js +0 -0
- /package/dist/server/{server → apps/api}/src/errors.js +0 -0
- /package/dist/server/{server → apps/api}/src/health-workout-adapters.js +0 -0
- /package/dist/server/{server → apps/api}/src/health-workout-analytics.js +0 -0
- /package/dist/server/{server → apps/api}/src/health.js +0 -0
- /package/dist/server/{server → apps/api}/src/index.js +0 -0
- /package/dist/server/{server → apps/api}/src/managers/base.js +0 -0
- /package/dist/server/{server → apps/api}/src/managers/contracts.js +0 -0
- /package/dist/server/{server → apps/api}/src/managers/platform/api-gateway-manager.js +0 -0
- /package/dist/server/{server → apps/api}/src/managers/platform/audit-manager.js +0 -0
- /package/dist/server/{server → apps/api}/src/managers/platform/authentication-manager.js +0 -0
- /package/dist/server/{server → apps/api}/src/managers/platform/authorization-manager.js +0 -0
- /package/dist/server/{server → apps/api}/src/managers/platform/background-job-manager.js +0 -0
- /package/dist/server/{server → apps/api}/src/managers/platform/configuration-manager.js +0 -0
- /package/dist/server/{server → apps/api}/src/managers/platform/database-manager.js +0 -0
- /package/dist/server/{server → apps/api}/src/managers/platform/event-bus-manager.js +0 -0
- /package/dist/server/{server → apps/api}/src/managers/platform/external-service-manager.js +0 -0
- /package/dist/server/{server → apps/api}/src/managers/platform/health-manager.js +0 -0
- /package/dist/server/{server → apps/api}/src/managers/platform/llm-manager.js +0 -0
- /package/dist/server/{server → apps/api}/src/managers/platform/migration-manager.js +0 -0
- /package/dist/server/{server → apps/api}/src/managers/platform/mock-workbench-provider.js +0 -0
- /package/dist/server/{server → apps/api}/src/managers/platform/openai-responses-provider.js +0 -0
- /package/dist/server/{server → apps/api}/src/managers/platform/search-index-manager.js +0 -0
- /package/dist/server/{server → apps/api}/src/managers/platform/secrets-manager.js +0 -0
- /package/dist/server/{server → apps/api}/src/managers/platform/session-manager.js +0 -0
- /package/dist/server/{server → apps/api}/src/managers/platform/storage-manager.js +0 -0
- /package/dist/server/{server → apps/api}/src/managers/platform/token-manager.js +0 -0
- /package/dist/server/{server → apps/api}/src/managers/platform/transaction-manager.js +0 -0
- /package/dist/server/{server → apps/api}/src/managers/platform/trusted-network.js +0 -0
- /package/dist/server/{server → apps/api}/src/managers/runtime.js +0 -0
- /package/dist/server/{server → apps/api}/src/managers/type-guards.js +0 -0
- /package/dist/server/{server → apps/api}/src/movement.js +0 -0
- /package/dist/server/{server → apps/api}/src/preferences-seeds.js +0 -0
- /package/dist/server/{server → apps/api}/src/preferences-types.js +0 -0
- /package/dist/server/{server → apps/api}/src/psyche-types.js +0 -0
- /package/dist/server/{server → apps/api}/src/questionnaire-flow.js +0 -0
- /package/dist/server/{server → apps/api}/src/questionnaire-types.js +0 -0
- /package/dist/server/{server → apps/api}/src/repositories/activity-events.js +0 -0
- /package/dist/server/{server → apps/api}/src/repositories/agent-runtime-sessions.js +0 -0
- /package/dist/server/{server → apps/api}/src/repositories/ai-processors.js +0 -0
- /package/dist/server/{server → apps/api}/src/repositories/calendar.js +0 -0
- /package/dist/server/{server → apps/api}/src/repositories/collaboration.js +0 -0
- /package/dist/server/{server → apps/api}/src/repositories/deleted-entities.js +0 -0
- /package/dist/server/{server → apps/api}/src/repositories/diagnostic-logs.js +0 -0
- /package/dist/server/{server → apps/api}/src/repositories/domains.js +0 -0
- /package/dist/server/{server → apps/api}/src/repositories/entity-ownership.js +0 -0
- /package/dist/server/{server → apps/api}/src/repositories/event-log.js +0 -0
- /package/dist/server/{server → apps/api}/src/repositories/gamification.js +0 -0
- /package/dist/server/{server → apps/api}/src/repositories/goals.js +0 -0
- /package/dist/server/{server → apps/api}/src/repositories/model-settings.js +0 -0
- /package/dist/server/{server → apps/api}/src/repositories/notes.js +0 -0
- /package/dist/server/{server → apps/api}/src/repositories/preferences.js +0 -0
- /package/dist/server/{server → apps/api}/src/repositories/projects.js +0 -0
- /package/dist/server/{server → apps/api}/src/repositories/psyche.js +0 -0
- /package/dist/server/{server → apps/api}/src/repositories/questionnaires.js +0 -0
- /package/dist/server/{server → apps/api}/src/repositories/rewards.js +0 -0
- /package/dist/server/{server → apps/api}/src/repositories/settings.js +0 -0
- /package/dist/server/{server → apps/api}/src/repositories/strategies.js +0 -0
- /package/dist/server/{server → apps/api}/src/repositories/surface-layouts.js +0 -0
- /package/dist/server/{server → apps/api}/src/repositories/tags.js +0 -0
- /package/dist/server/{server → apps/api}/src/repositories/task-runs.js +0 -0
- /package/dist/server/{server → apps/api}/src/repositories/tasks.js +0 -0
- /package/dist/server/{server → apps/api}/src/repositories/users.js +0 -0
- /package/dist/server/{server → apps/api}/src/repositories/weekly-reviews.js +0 -0
- /package/dist/server/{server → apps/api}/src/repositories/wiki-memory.js +0 -0
- /package/dist/server/{server → apps/api}/src/repositories/work-adjustments.js +0 -0
- /package/dist/server/{server → apps/api}/src/runtime-data-root.js +0 -0
- /package/dist/server/{server → apps/api}/src/screen-time.js +0 -0
- /package/dist/server/{server → apps/api}/src/seed-demo.js +0 -0
- /package/dist/server/{server → apps/api}/src/services/calendar-runtime.js +0 -0
- /package/dist/server/{server → apps/api}/src/services/context.js +0 -0
- /package/dist/server/{server → apps/api}/src/services/dashboard.js +0 -0
- /package/dist/server/{server → apps/api}/src/services/data-management.js +0 -0
- /package/dist/server/{server → apps/api}/src/services/devrage-scanner.js +0 -0
- /package/dist/server/{server → apps/api}/src/services/devrage.js +0 -0
- /package/dist/server/{server → apps/api}/src/services/git-helper.js +0 -0
- /package/dist/server/{server → apps/api}/src/services/google-calendar-oauth-config.js +0 -0
- /package/dist/server/{server → apps/api}/src/services/insights.js +0 -0
- /package/dist/server/{server → apps/api}/src/services/legacy-wiki-markdown-import.js +0 -0
- /package/dist/server/{server → apps/api}/src/services/life-force-model.js +0 -0
- /package/dist/server/{server → apps/api}/src/services/life-force.js +0 -0
- /package/dist/server/{server → apps/api}/src/services/macos-calendar-helper.js +0 -0
- /package/dist/server/{server → apps/api}/src/services/openai-codex-oauth.js +0 -0
- /package/dist/server/{server → apps/api}/src/services/projects.js +0 -0
- /package/dist/server/{server → apps/api}/src/services/psyche.js +0 -0
- /package/dist/server/{server → apps/api}/src/services/relations.js +0 -0
- /package/dist/server/{server → apps/api}/src/services/reviews.js +0 -0
- /package/dist/server/{server → apps/api}/src/services/run-recovery.js +0 -0
- /package/dist/server/{server → apps/api}/src/services/tagging.js +0 -0
- /package/dist/server/{server → apps/api}/src/services/task-run-watchdog.js +0 -0
- /package/dist/server/{server → apps/api}/src/services/work-time.js +0 -0
- /package/dist/server/{server → apps/api}/src/web.js +0 -0
- /package/dist/server/{src → apps/web/src}/components/customization/utility-widgets.js +0 -0
- /package/dist/server/{src → apps/web/src}/components/ui/info-tooltip.js +0 -0
- /package/dist/server/{src → apps/web/src}/components/workbench-boxes/calendar/calendar-boxes.js +0 -0
- /package/dist/server/{src → apps/web/src}/components/workbench-boxes/goals/goals-boxes.js +0 -0
- /package/dist/server/{src → apps/web/src}/components/workbench-boxes/habits/habits-boxes.js +0 -0
- /package/dist/server/{src → apps/web/src}/components/workbench-boxes/health/health-boxes.js +0 -0
- /package/dist/server/{src → apps/web/src}/components/workbench-boxes/insights/insights-boxes.js +0 -0
- /package/dist/server/{src → apps/web/src}/components/workbench-boxes/kanban/kanban-boxes.js +0 -0
- /package/dist/server/{src → apps/web/src}/components/workbench-boxes/movement/movement-boxes.js +0 -0
- /package/dist/server/{src → apps/web/src}/components/workbench-boxes/notes/notes-boxes.js +0 -0
- /package/dist/server/{src → apps/web/src}/components/workbench-boxes/overview/overview-boxes.js +0 -0
- /package/dist/server/{src → apps/web/src}/components/workbench-boxes/preferences/preferences-boxes.js +0 -0
- /package/dist/server/{src → apps/web/src}/components/workbench-boxes/projects/projects-boxes.js +0 -0
- /package/dist/server/{src → apps/web/src}/components/workbench-boxes/psyche/psyche-boxes.js +0 -0
- /package/dist/server/{src → apps/web/src}/components/workbench-boxes/questionnaires/questionnaires-boxes.js +0 -0
- /package/dist/server/{src → apps/web/src}/components/workbench-boxes/review/review-boxes.js +0 -0
- /package/dist/server/{src → apps/web/src}/components/workbench-boxes/shared/define-workbench-box.js +0 -0
- /package/dist/server/{src → apps/web/src}/components/workbench-boxes/shared/generic-node-view.js +0 -0
- /package/dist/server/{src → apps/web/src}/components/workbench-boxes/strategies/strategies-boxes.js +0 -0
- /package/dist/server/{src → apps/web/src}/components/workbench-boxes/tasks/tasks-boxes.js +0 -0
- /package/dist/server/{src → apps/web/src}/components/workbench-boxes/today/today-boxes.js +0 -0
- /package/dist/server/{src → apps/web/src}/components/workbench-boxes/wiki/wiki-boxes.js +0 -0
- /package/dist/server/{src → apps/web/src}/lib/api-error.js +0 -0
- /package/dist/server/{src → apps/web/src}/lib/calendar-name-deduper.js +0 -0
- /package/dist/server/{src → apps/web/src}/lib/data-management-types.js +0 -0
- /package/dist/server/{src → apps/web/src}/lib/date-keys.js +0 -0
- /package/dist/server/{src → apps/web/src}/lib/diagnostics.js +0 -0
- /package/dist/server/{src → apps/web/src}/lib/gamification-catalog.js +0 -0
- /package/dist/server/{src → apps/web/src}/lib/knowledge-graph.js +0 -0
- /package/dist/server/{src → apps/web/src}/lib/psyche-schemas.js +0 -0
- /package/dist/server/{src → apps/web/src}/lib/psyche-types.js +0 -0
- /package/dist/server/{src → apps/web/src}/lib/questionnaire-types.js +0 -0
- /package/dist/server/{src → apps/web/src}/lib/runtime-paths.js +0 -0
- /package/dist/server/{src → apps/web/src}/lib/schemas.js +0 -0
- /package/dist/server/{src → apps/web/src}/lib/snapshot-normalizer.js +0 -0
- /package/dist/server/{src → apps/web/src}/lib/theme-system.js +0 -0
- /package/dist/server/{src → apps/web/src}/lib/types.js +0 -0
- /package/dist/server/{src → apps/web/src}/lib/utils.js +0 -0
- /package/dist/server/{src → apps/web/src}/lib/weight-loss-energy-model.js +0 -0
- /package/dist/server/{src → apps/web/src}/lib/weight-loss-types.js +0 -0
- /package/dist/server/{src → apps/web/src}/lib/workbench/boxes.js +0 -0
- /package/dist/server/{src → apps/web/src}/lib/workbench/contracts.js +0 -0
- /package/dist/server/{src → apps/web/src}/lib/workbench/nodes.js +0 -0
- /package/dist/server/{src → apps/web/src}/lib/workbench/registry.js +0 -0
- /package/dist/server/{src → apps/web/src}/lib/workbench/runtime.js +0 -0
- /package/dist/server/{src → apps/web/src}/lib/workbench/tool-catalog.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{bu as xe,aL as ze,b9 as Ke,c7 as is,bF as rs,j as e,aC as A,b2 as Pe,c6 as ns,b6 as ls,r as y,c8 as cs,aV as ue,aG as ds,bo as os,ct as us,aP as Ee,b3 as ms,bD as xs}from"./vendor-BwL6m4SE.js";import{j as ps,i as J,k as w}from"./state-Bpe5dF3T.js";import{c as q,a4 as Ue,b as X,k as i,u as gs,d as hs,S as vs,e as Me,V as fs,E as Re,C as ks,B as k,n as T,m as me,x as Fe,aA as bs,i as js,e5 as Ns,e6 as ys,M as ws,ae as Ss,af as Ts,G as As,r as Cs,ag as Is,K as $s,e7 as Ds,N as Oe,O as _s}from"./index-FpGANF9S.js";import{a as Ps,T as Es}from"./timebox-planning-dialog-BtFuVoA1.js";import{O as Ms}from"./open-in-graph-button-4UYrp1XP.js";import{N as Y}from"./note-markdown-DXXI3W3V.js";import{E as Rs}from"./entity-notes-surface-B56XSw7M.js";import{P as Fs}from"./preference-entity-handoff-button-C2ATjvws.js";import{TaskDialog as Os}from"./task-dialog-CI_Fy_FW.js";import{g as Ls,e as Bs,W as qs}from"./calendar-rules-DKftgNx5.js";import{P as zs}from"./page-hero-DvrM83_C.js";import{U as Le}from"./user-badge-ByhC6bMU.js";import{g as Ks,a as Us}from"./activity-copy-Bj4h9OcF.js";import{g as Be,a as qe}from"./entity-links-DwpxhW2H.js";import{g as Ws}from"./user-ownership-DJGl4rAj.js";import"./motion-DcgUnXhY.js";import"./ui-B9TWEtCx.js";import"./board-CuxQRKPJ.js";import"./forms-D1qJ3oOP.js";import"./scheduling-rules-editor-jakFfxqF.js";import"./question-flow-dialog-Ded2E85L.js";import"./calendar-ui-Cy1XRwzV.js";import"./note-tags-input-CYh3TVW2.js";import"./entity-link-multiselect-Dl4rZqdg.js";import"./use-anchored-overlay-position-BY4kNzPj.js";import"./goal-dialog-15hD8EBp.js";import"./inline-note-fields-COgzxr_7.js";import"./user-select-field-fx129Uh6.js";import"./schemas-Db29G8NU.js";import"./project-dialog-CBA-D65n.js";const Z=[{status:"backlog",label:"Backlog",description:"Not started yet.",icon:xe},{status:"focus",label:"Focus",description:"Ready to start soon.",icon:ze},{status:"in_progress",label:"In progress",description:"Work is active now.",icon:Ke},{status:"blocked",label:"Blocked",description:"Something is stopping progress.",icon:is},{status:"done",label:"Done",description:"The task is completed.",icon:rs}],Qs={issue:{label:"Issue",noun:"issue",descriptor:"Vertical slice issue",heroDescription:"Track the vertical slice, keep the acceptance bar explicit, and surface the execution context without losing the product-level story."},task:{label:"Task",noun:"task",descriptor:"AI session task",heroDescription:"Drive one focused AI execution session, keep the work contract crisp, and show the concrete evidence of what changed."},subtask:{label:"Subtask",noun:"subtask",descriptor:"Granular child step",heroDescription:"Keep the child step sharply scoped, trace its parent chain, and make the work evidence visible without opening the editor."}},Gs={commit:{label:"Commit",className:"bg-emerald-500/12 text-emerald-100"},branch:{label:"Branch",className:"bg-sky-500/12 text-sky-100"},pull_request:{label:"Pull request",className:"bg-fuchsia-500/12 text-fuchsia-100"}};function pe(a){return a==="issue"?"issue":"task"}function Hs(a,o){switch(a){case"goal":return`/goals/${o}`;case"project":return`/projects/${o}`;case"task":return`/tasks/${o}`;case"strategy":return`/strategies/${o}`;case"habit":return"/habits";default:return null}}function _(a){if(!a||a<=0)return"0 min";if(a<3600)return`${Math.max(1,Math.round(a/60))} min`;const o=Math.floor(a/3600),u=Math.round(a%3600/60);return u===0?`${o} h`:`${o} h ${u} min`}function x({label:a,help:o}){return e.jsxs("div",{className:"flex items-center gap-2 text-sm text-[var(--ui-ink-soft)]",children:[e.jsx("span",{children:a}),o?e.jsx(Ue,{content:o,label:`Explain ${a}`}):null]})}function P({eyebrow:a,title:o,description:u,children:c,className:p}){return e.jsxs("div",{className:q("min-w-0 rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-4 sm:p-5",p),children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:a}),e.jsx("div",{className:"mt-2 text-lg font-medium text-[var(--ui-ink-strong)]",children:o}),u?e.jsx("p",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:u}):null,e.jsx("div",{className:"mt-4",children:c})]})}function h({label:a,value:o,hint:u,className:c}){return e.jsxs("div",{className:q("min-w-0 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-3",c),children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:a}),e.jsx("div",{className:"mt-2 text-base font-medium text-[var(--ui-ink-strong)]",children:o}),u?e.jsx("div",{className:"mt-1 text-sm leading-5 text-[var(--ui-ink-faint)]",children:u}):null]})}function Vs({payload:a,relatedWorkItems:o,availableTags:u,workItemMeta:c,taskLevel:p,hasAiBrief:v,botOwner:ee,formatDate:b,formatDateTime:C}){const E=a.task.parentWorkItemId?o.find(l=>l.id===a.task.parentWorkItemId)??null:null,M=o.filter(l=>l.parentWorkItemId===a.task.id).sort((l,j)=>l.sortOrder-j.sortOrder),z=(a.task.tagIds??[]).map(l=>u.find(j=>j.id===l)??null).filter(l=>!!l),R=a.task.blockerLinks??[];return e.jsxs("div",{className:"mt-5 grid gap-4 xl:grid-cols-[minmax(0,1.15fr)_minmax(0,1fr)_minmax(0,1fr)]",children:[e.jsx(P,{eyebrow:"Hierarchy",title:"Context map",description:`See where this ${c.noun} sits in the larger planning ladder without opening the board.`,children:e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{children:[e.jsx(x,{label:"Project",help:`The project is the main work stream this ${c.noun} belongs to.`}),e.jsx("div",{className:"mt-2",children:a.project?e.jsx(A,{to:`/projects/${a.project.id}`,className:"inline-flex max-w-full",children:e.jsx(X,{kind:"project",label:a.project.title,compact:!0,gradient:!1,wrap:!0,className:"max-w-full"})}):e.jsx(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-soft)]",children:"No project linked"})})]}),e.jsxs("div",{children:[e.jsx(x,{label:"Goal",help:"The goal shows the longer-term result this work supports."}),e.jsx("div",{className:"mt-2",children:a.goal?e.jsx(A,{to:`/goals/${a.goal.id}`,className:"inline-flex max-w-full",children:e.jsx(X,{kind:"goal",label:a.goal.title,compact:!0,gradient:!1,wrap:!0,className:"max-w-full"})}):e.jsx(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-soft)]",children:"No goal linked"})})]}),e.jsxs("div",{children:[e.jsx(x,{label:"Parent item",help:"Issues parent tasks, tasks parent subtasks, and split child items stay legible here."}),e.jsx("div",{className:"mt-2",children:E?e.jsx(A,{to:`/tasks/${E.id}`,className:"inline-flex max-w-full",children:e.jsx(X,{kind:pe(E.level),label:E.title,compact:!0,gradient:!1,wrap:!0,className:"max-w-full"})}):e.jsx(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-soft)]",children:"No parent work item"})})]}),e.jsxs("div",{children:[e.jsx(x,{label:"Child items",help:"Child work items let you scan the next layer down without leaving the detail view."}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:M.length>0?M.map(l=>e.jsx(A,{to:`/tasks/${l.id}`,className:"inline-flex max-w-full",children:e.jsx(X,{kind:pe(l.level),label:l.title,compact:!0,gradient:!1,wrap:!0,className:"max-w-full"})},l.id)):e.jsx(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-soft)]",children:"No child work items"})})]})]})}),e.jsx(P,{eyebrow:"Execution",title:"Execution profile",description:"Surface the operating mode, AI posture, tags, and blockers as a single readable brief.",children:e.jsxs("div",{className:"grid gap-3",children:[e.jsx(h,{label:"Work-item type",value:c.descriptor,hint:p==="task"?"Tasks are meant to fit one focused AI session.":p==="issue"?"Issues hold the vertical slice and its delivery contract.":"Subtasks stay intentionally small and concrete."}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(h,{label:"Execution mode",value:a.task.executionMode?a.task.executionMode.toUpperCase():"Not set"}),e.jsx(h,{label:"AI posture",value:v?"AI brief ready":p==="issue"?"Issue narrative only":"Needs AI brief"})]}),e.jsxs("div",{children:[e.jsx(x,{label:"Tags",help:"Tags shape filtering and fast scanning across the board and hierarchy views."}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:z.length>0?z.map(l=>e.jsx(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]",children:l.name},l.id)):e.jsx(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-soft)]",children:"No tags"})})]}),e.jsxs("div",{children:[e.jsx(x,{label:"Blockers",help:"Blockers tie this work item to the entities that currently constrain it."}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:R.length>0?R.map(l=>{const j=Hs(l.entityType,l.entityId),K=e.jsx(i,{wrap:!0,className:"bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_78%,var(--ui-ink-strong)_22%)]",children:l.label??`${l.entityType} · ${l.entityId}`},`${l.entityType}:${l.entityId}`);return j?e.jsx(A,{to:j,className:"inline-flex max-w-full",children:K},`${l.entityType}:${l.entityId}`):K}):e.jsx(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-soft)]",children:"No blockers linked"})})]})]})}),e.jsx(P,{eyebrow:"People and timing",title:"Accountability surface",description:"Show who owns the work, who is helping, and when the record moved.",children:e.jsxs("div",{className:"grid gap-3",children:[e.jsx(h,{label:"Owner",value:e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.task.user?e.jsx(Le,{user:a.task.user,compact:!0}):null,e.jsx("span",{children:a.task.owner}),ee?e.jsxs(i,{className:"bg-[var(--ui-accent-soft)] text-[var(--tertiary)]",children:[e.jsx(Pe,{className:"mr-1 size-3.5"}),"Bot owner"]}):null]})}),e.jsxs("div",{children:[e.jsx(x,{label:"Assignees"}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:a.task.assignees&&a.task.assignees.length>0?a.task.assignees.map(l=>e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 py-1.5 text-sm text-[var(--ui-ink-medium)]",children:[e.jsx(Le,{user:l,compact:!0}),e.jsx("span",{children:l.displayName}),l.kind==="bot"?e.jsx(Pe,{className:"size-3.5 text-[var(--tertiary)]"}):null]},l.id)):e.jsx(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-soft)]",children:"No assignees"})})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(h,{label:"Due date",value:b(a.task.dueDate),hint:`Use due dates only when timing materially matters for this ${c.noun}.`}),e.jsx(h,{label:"Completed",value:a.task.completedAt?C(a.task.completedAt):"Not completed"})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(h,{label:"Created",value:C(a.task.createdAt)}),e.jsx(h,{label:"Updated",value:C(a.task.updatedAt)})]})]})})]})}function Tt(){var Se,Te,Ae,Ce,Ie,$e,De;const{t:a,formatDate:o,formatDateTime:u}=gs(),c=hs(),p=Array.isArray(c.selectedUserIds)?c.selectedUserIds:[],v=ns(),ee=ls(),b=ps(),C=Ws(p),[E,M]=y.useState(!1),[z,R]=y.useState(!1),[l,j]=y.useState(!1),[K,ge]=y.useState(!1),[We,se]=y.useState(!1),[Qe,U]=y.useState(null),[W,Ge]=y.useState(()=>typeof window<"u"?window.matchMedia("(max-width: 1023px)").matches:!1),[te]=y.useState(()=>{const s=new Date,r=new Date(s);r.setHours(0,0,0,0);const n=new Date(s);return n.setHours(23,59,59,999),{from:r.toISOString(),to:n.toISOString()}}),[F]=y.useState(()=>{const s=new Date,r=new Date(s);r.setHours(0,0,0,0);const n=new Date(r);return n.setDate(n.getDate()+7),n.setHours(23,59,59,999),{from:r.toISOString(),to:n.toISOString()}});y.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const s=window.matchMedia("(max-width: 1023px)"),r=n=>Ge(n?n.matches:s.matches);return r(),typeof s.addEventListener=="function"?(s.addEventListener("change",r),()=>s.removeEventListener("change",r)):(s.addListener(r),()=>s.removeListener(r))},[]);const $=J({queryKey:["task-context",v.taskId],queryFn:()=>Ds(v.taskId),enabled:!!v.taskId}),He=J({queryKey:["task-calendar-overview",v.taskId,te.from,te.to,...p],queryFn:()=>Oe({...te,userIds:p}),enabled:!!v.taskId}),I=J({queryKey:["forge-life-force",...p],queryFn:async()=>(await _s(p)).lifeForce}),Ve=J({queryKey:["task-calendar-overview",v.taskId,F.from,F.to,...p],queryFn:()=>Oe({...F,userIds:p}),enabled:!!v.taskId}),N=async()=>{await Promise.all([js(b),b.invalidateQueries({queryKey:["task-context",v.taskId]}),b.invalidateQueries({queryKey:["activity-archive"]}),b.invalidateQueries({queryKey:["project-board"]}),b.invalidateQueries({queryKey:["forge-xp-metrics"]}),b.invalidateQueries({queryKey:["forge-reward-ledger"]}),b.invalidateQueries({queryKey:["forge-operator-context"]}),b.invalidateQueries({queryKey:["task-calendar-overview",v.taskId]}),b.invalidateQueries({queryKey:["forge-calendar-overview"]})])},Q=w({mutationFn:({taskId:s,patch:r})=>c.patchTask(s,r),onSuccess:N}),Je=w({mutationFn:s=>Ss(s),onSuccess:N}),Xe=w({mutationFn:s=>Cs(s),onSuccess:N}),he=w({mutationFn:({runId:s,actor:r,note:n})=>Ns(s,{actor:r,note:n??""}),onSuccess:N}),ve=w({mutationFn:({runId:s,actor:r,note:n})=>ys(s,{actor:r,note:n??""}),onSuccess:N}),ae=w({mutationFn:Is,onSuccess:N}),fe=w({mutationFn:s=>Ts(s),onSuccess:N}),ie=w({mutationFn:ws,onSuccess:N}),ke=w({mutationFn:({timeboxId:s,patch:r})=>As(s,r),onSuccess:N}),Ye=w({mutationFn:$s,onSuccess:N}),t=$.data;if($.isLoading)return e.jsx(vs,{});if($.isError)return e.jsx(Me,{eyebrow:a("common.taskDetail.errorEyebrow"),error:$.error,onRetry:()=>void $.refetch()});if(!t)return e.jsx(Me,{eyebrow:a("common.taskDetail.errorEyebrow"),error:new Error(a("common.taskDetail.emptyPayload")),onRetry:()=>void $.refetch()});const f=t.activeTaskRun??null,m=t.task.actionPointSummary??null,be=Z.find(s=>s.status===t.task.status)??Z[0],re=t.task.level??"task",je=t.task.aiInstructions??"",Ze=Ls(t.task,(Se=t.project)==null?void 0:Se.schedulingRules),D=Bs({rules:Ze,overview:(Te=He.data)==null?void 0:Te.calendar}),G=(((Ae=Ve.data)==null?void 0:Ae.calendar.timeboxes)??[]).filter(s=>s.taskId===t.task.id).sort((s,r)=>Date.parse(s.startsAt)-Date.parse(r.startsAt)),ne=G[0]??null,g=Qs[re],le=pe(re),es=c.snapshot.workItems??c.snapshot.tasks??[],ss=c.snapshot.tags??[],ce=t.task.acceptanceCriteria??[],H=t.task.gitRefs??[],d=t.task.completionReport,Ne=new Set((d==null?void 0:d.linkedGitRefIds)??[]),de=H.filter(s=>Ne.has(s.id)),ye=H.filter(s=>!Ne.has(s.id)),oe=((Ce=t.task.user)==null?void 0:Ce.kind)==="bot"||((Ie=t.task.ownerUser)==null?void 0:Ie.kind)==="bot",O=(t.task.assignees??[]).filter(s=>s.kind==="bot"),V=je.trim().length>0,S=W?"w-full justify-start":"",ts=s=>{switch(s){case"active":return"Active";case"completed":return"Completed";case"released":return"Paused";case"timed_out":return"Timed out";default:return s}},we=async s=>{await c.patchTaskStatus(t.task.id,s),await N(),se(!1)},as=async()=>{window.confirm(`Delete ${g.noun} "${t.task.title}"?`)&&(await fe.mutateAsync(t.task.id),ee(t.project?`/projects/${t.project.id}`:t.goal?`/goals/${t.goal.id}`:"/kanban"))};return e.jsxs("div",{className:"grid gap-5",children:[e.jsx(zs,{entityKind:le,title:e.jsx(Re,{kind:le,label:t.task.title,variant:"heading",size:"lg",lines:3,className:"max-w-full",labelClassName:"[overflow-wrap:anywhere]"}),titleText:t.task.title,description:t.task.description?e.jsx(Y,{markdown:t.task.description,className:"[&>p]:text-[13px] [&>p]:leading-6 [&>blockquote]:text-[13px] [&>ul]:text-[13px] [&>ol]:text-[13px]"}):g.heroDescription,badge:m?`${t.task.points} xp · ${Math.round(m.totalCostAp)} AP`:`${t.task.points} xp`,actions:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(fs,{metrics:c.snapshot.metrics}),e.jsx(Fs,{userId:C,domain:"tasks",entityType:"task",entityId:t.task.id,label:t.task.title,description:t.task.description}),e.jsx(Ms,{entityType:"task",entityId:t.task.id})]})}),e.jsxs(ks,{className:"min-w-0 overflow-hidden",children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:g.label}),e.jsx("div",{className:"mt-2",children:e.jsx(Re,{kind:le,label:t.task.title,variant:"heading",size:"xl",lines:3,className:"max-w-full",labelClassName:"[overflow-wrap:anywhere]"})}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-soft)]",children:t.task.description?e.jsx(Y,{markdown:t.task.description,className:"[&>p]:text-sm [&>p]:leading-6 [&>blockquote]:text-sm [&>ul]:text-sm [&>ol]:text-sm"}):`This page shows the ${g.noun}, where it belongs, what is driving it, and the concrete evidence of what has happened on it so far.`})]}),e.jsx("div",{className:q("shrink-0",W?"w-full":""),children:e.jsxs("div",{className:q("flex flex-wrap items-center gap-2",W&&"grid w-full grid-cols-1"),children:[e.jsxs(k,{className:S,pending:$.isFetching,pendingLabel:f?"Opening":"Starting",onClick:async()=>{await c.startTaskNow(t.task.id),await N()},children:[e.jsx(Ke,{className:"size-4 fill-current"}),f?"Focus work":"Start work"]}),f?e.jsxs(e.Fragment,{children:[e.jsx(k,{className:S,variant:"secondary",pending:he.isPending,pendingLabel:"Pausing",onClick:async()=>{await he.mutateAsync({runId:f.id,actor:f.actor,note:f.note})},children:"Pause"}),e.jsx(k,{className:S,variant:"secondary",pending:ve.isPending,pendingLabel:"Completing",onClick:async()=>{await ve.mutateAsync({runId:f.id,actor:f.actor,note:f.note})},children:"Complete"})]}):null,e.jsxs(k,{className:S,variant:"secondary",onClick:()=>se(!0),children:[e.jsx(be.icon,{className:"size-4"}),"Change status"]}),e.jsxs(k,{className:S,variant:"secondary",onClick:()=>M(!0),children:[e.jsx(cs,{className:"size-4"}),"Edit ",g.noun]}),e.jsxs(k,{className:S,variant:"secondary",onClick:()=>R(!0),children:[e.jsx(xe,{className:"size-4"}),"Adjust work"]}),e.jsxs(k,{className:S,variant:"secondary",pending:ie.isPending,pendingLabel:"Planning",onClick:()=>j(!0),children:[e.jsx(ue,{className:"size-4"}),"Time Box"]}),t.task.status==="done"?e.jsx(k,{className:S,variant:"secondary",onClick:async()=>{await Je.mutateAsync(t.task.id)},children:"Mark as not done"}):null,e.jsxs(k,{className:q(S,"text-[color-mix(in_srgb,var(--danger)_76%,var(--ui-ink-strong)_24%)] hover:bg-[var(--ui-danger-soft)]"),variant:"ghost",pending:fe.isPending,pendingLabel:a("common.taskDetail.deleting"),onClick:()=>void as(),children:["Delete ",g.noun]})]})})]}),e.jsxs("div",{className:"mt-5 flex flex-wrap gap-2",children:[e.jsx(i,{className:"bg-[var(--primary)]/14 text-[var(--primary)]",children:g.label}),e.jsx(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]",children:g.descriptor}),e.jsx(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]",children:be.label}),e.jsx(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]",children:a(`common.enums.priority.${t.task.priority}`)}),e.jsx(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]",children:a(`common.enums.effort.${t.task.effort}`)}),e.jsx(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]",children:a(`common.enums.energy.${t.task.energy}`)}),e.jsxs(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]",children:[t.task.points," xp"]}),t.task.time.totalCreditedSeconds>0?e.jsxs(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]",children:[Math.floor(t.task.time.totalCreditedSeconds/60)," min tracked"]}):null,f?e.jsx(i,{className:"bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_76%,var(--ui-ink-strong)_24%)]",children:"Timer active"}):null,t.task.executionMode?e.jsx(i,{className:t.task.executionMode==="afk"?"bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_76%,var(--ui-ink-strong)_24%)]":"bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_78%,var(--ui-ink-strong)_22%)]",children:t.task.executionMode.toUpperCase()}):null,V?e.jsx(i,{className:"bg-[var(--ui-accent-soft)] text-[var(--primary)]",children:"AI brief ready"}):null,oe||O.length>0?e.jsx(i,{className:"bg-[var(--ui-accent-soft)] text-[var(--tertiary)]",children:"Bot collaboration live"}):null,ne?e.jsx(A,{to:`/calendar?timeboxId=${encodeURIComponent(ne.id)}`,className:"inline-flex",children:e.jsxs(i,{className:"cursor-pointer bg-[var(--primary)]/16 text-[var(--primary)] transition hover:bg-[var(--primary)]/24",children:["Timeboxed · ",u(ne.startsAt)]})}):null]}),W?null:e.jsxs("div",{className:"mt-5",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Status"}),e.jsx("div",{className:"mt-3 grid gap-2 md:grid-cols-2 xl:grid-cols-5",children:Z.map(s=>{const r=s.icon,n=s.status===t.task.status;return e.jsxs("button",{type:"button",disabled:n||Q.isPending,className:`rounded-[18px] border px-3.5 py-3 text-left transition ${n?"border-[color-mix(in_srgb,var(--primary)_34%,var(--ui-border-subtle)_66%)] bg-[var(--ui-accent-soft)] text-[var(--ui-ink-strong)]":"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)] hover:bg-[var(--ui-surface-3)]"}`,onClick:()=>void we(s.status),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(r,{className:"size-4 shrink-0 text-[var(--primary)]"}),e.jsx("span",{className:"font-medium",children:s.label})]}),e.jsx("div",{className:"mt-2 text-xs leading-5 text-[var(--ui-ink-faint)]",children:s.description})]},s.status)})})]}),e.jsx(Vs,{payload:t,relatedWorkItems:es,availableTags:ss,workItemMeta:g,taskLevel:re,hasAiBrief:V,botOwner:oe,formatDate:o,formatDateTime:u}),V||ce.length>0||d||H.length>0?e.jsxs("div",{className:"mt-5 grid gap-4 xl:grid-cols-[minmax(0,1.05fr)_minmax(0,1fr)]",children:[e.jsx(P,{eyebrow:"Execution brief",title:"AI and delivery instructions",description:"The narrative, criteria, and execution intent live together so the detail view can stand on its own.",children:e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"rounded-[20px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-[var(--ui-ink-soft)]",children:[e.jsx(ds,{className:"size-4 text-[var(--primary)]"}),e.jsx("span",{children:"AI instructions"})]}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-medium)]",children:V?e.jsx(Y,{markdown:je,className:"[&>p]:text-sm [&>p]:leading-6 [&>blockquote]:text-sm [&>ul]:text-sm [&>ol]:text-sm"}):`No AI instructions have been written for this ${g.noun} yet.`})]}),e.jsxs("div",{className:"rounded-[20px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-[var(--ui-ink-soft)]",children:[e.jsx(ze,{className:"size-4 text-[var(--success)]"}),e.jsx("span",{children:"Acceptance criteria"})]}),ce.length>0?e.jsx("div",{className:"mt-3 grid gap-2",children:ce.map((s,r)=>e.jsx("div",{className:"rounded-[16px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3 text-sm leading-6 text-[var(--ui-ink-medium)]",children:s},`${t.task.id}-criterion-${r}`))}):e.jsx("div",{className:"mt-3 rounded-[16px] border border-dashed border-[var(--ui-border-subtle)] px-4 py-3 text-sm text-[var(--ui-ink-faint)]",children:"No acceptance criteria captured yet."})]})]})}),e.jsx(P,{eyebrow:"Evidence",title:"Work done, changed files, and git traceability",description:"Show the work summary, file footprint, and linked refs directly in the detail view.",children:e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"rounded-[20px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-[var(--ui-ink-soft)]",children:[e.jsx(os,{className:"size-4 text-[var(--primary)]"}),e.jsx("span",{children:"Work summary"})]}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-medium)]",children:d!=null&&d.workSummary?e.jsx(Y,{markdown:d.workSummary,className:"[&>p]:text-sm [&>p]:leading-6 [&>blockquote]:text-sm [&>ul]:text-sm [&>ol]:text-sm"}):"No work summary yet."})]}),e.jsxs("div",{className:"rounded-[20px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-[var(--ui-ink-soft)]",children:[e.jsx(us,{className:"size-4 text-[var(--warning)]"}),e.jsx("span",{children:"Changed files"})]}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:d!=null&&d.modifiedFiles&&d.modifiedFiles.length>0?d.modifiedFiles.map(s=>e.jsx(i,{wrap:!0,className:"bg-[var(--ui-surface-3)] font-mono text-[11px] text-[var(--ui-ink-medium)]",children:s},s)):e.jsx(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-soft)]",children:"No changed files listed"})})]}),e.jsxs("div",{className:"rounded-[20px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-[var(--ui-ink-soft)]",children:[e.jsx(Ee,{className:"size-4 text-[var(--tertiary)]"}),e.jsx("span",{children:"Git refs"})]}),e.jsxs("div",{className:"mt-3 grid gap-3",children:[[de,ye].filter(s=>s.length>0).map((s,r)=>e.jsxs("div",{className:"grid gap-2",children:[de.length>0&&ye.length>0?e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:r===0?"Linked in completion report":"Other recorded refs"}):null,s.map(n=>{const L=Gs[n.refType],B=e.jsxs("div",{className:"rounded-[16px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(i,{className:L.className,children:L.label}),e.jsx("div",{className:"font-mono text-sm text-[var(--ui-ink-strong)]",children:n.refValue})]}),e.jsx("div",{className:"mt-2 text-sm text-[var(--ui-ink-soft)]",children:n.displayTitle||n.repository||n.provider})]});return n.url?e.jsxs("a",{href:n.url,target:"_blank",rel:"noreferrer",className:"group block",children:[B,e.jsxs("div",{className:"mt-2 inline-flex items-center gap-1 text-[11px] uppercase tracking-[0.16em] text-[var(--primary)]",children:["Open ref",e.jsx(ms,{className:"size-3.5 transition group-hover:translate-x-0.5 group-hover:-translate-y-0.5"})]})]},n.id):e.jsx("div",{children:B},n.id)})]},`git-group-${r}`)),H.length===0?e.jsx(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-soft)]",children:"No git refs recorded"}):null]})]})]})})]}):null,e.jsxs("div",{className:"mt-5 grid gap-4 xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]",children:[e.jsxs(P,{eyebrow:"Work done",title:"Execution ledger",description:"Surface tracked work, credited work, and manual adjustments without opening the timer history.",children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[e.jsx(h,{label:"Tracked total",value:_(t.task.time.totalTrackedSeconds)}),e.jsx(h,{label:"Credited total",value:_(t.task.time.totalCreditedSeconds)}),e.jsx(h,{label:"Live work",value:_(t.task.time.liveCreditedSeconds)}),e.jsx(h,{label:"Manual adjustments",value:_(t.task.time.manualAdjustedSeconds)})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsxs(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]",children:["Today credited"," ",_(t.task.time.todayCreditedSeconds??0)]}),e.jsxs(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]",children:["Live tracked"," ",_(t.task.time.liveTrackedSeconds)]}),e.jsxs(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]",children:["Active runs ",t.task.time.activeRunCount]})]})]}),e.jsxs(P,{eyebrow:"Workflow health",title:"Signal scan",description:"A fast read on how ready this work item is for execution and closeout.",children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(h,{label:"Closeout readiness",value:d!=null&&d.workSummary||de.length>0?"Evidence present":"Needs closeout evidence",hint:($e=d==null?void 0:d.modifiedFiles)!=null&&$e.length?`${d.modifiedFiles.length} changed file${d.modifiedFiles.length===1?"":"s"} listed`:"No changed-file evidence captured yet."}),e.jsx(h,{label:"Collaboration model",value:oe||O.length>0?"Human + bot":t.task.assignees&&t.task.assignees.length>0?"Shared human work":"Single owner",hint:O.length>0?`${O.length} bot assignee${O.length===1?"":"s"} attached`:"No bot assignee attached."})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsxs(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]",children:["Priority ",a(`common.enums.priority.${t.task.priority}`)]}),e.jsxs(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]",children:["Effort ",a(`common.enums.effort.${t.task.effort}`)]}),e.jsxs(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]",children:["Energy ",a(`common.enums.energy.${t.task.energy}`)]}),e.jsxs(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]",children:["Duration"," ",_(t.task.plannedDurationSeconds)]})]})]})]}),e.jsxs("div",{className:"mt-5 rounded-[20px] bg-[var(--ui-surface-2)] p-4",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Action Point load"}),e.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[e.jsxs("div",{className:"rounded-[16px] bg-[var(--ui-surface-1)] px-3.5 py-3",children:[e.jsx(x,{label:"Total cost"}),e.jsx("div",{className:"mt-2 text-lg text-[var(--ui-ink-strong)]",children:m?T(m.totalCostAp):"Not calibrated"})]}),e.jsxs("div",{className:"rounded-[16px] bg-[var(--ui-surface-1)] px-3.5 py-3",children:[e.jsx(x,{label:"Today debit"}),e.jsx("div",{className:"mt-2 text-lg text-[var(--ui-ink-strong)]",children:m?T(m.spentTodayAp):"0 AP"})]}),e.jsxs("div",{className:"rounded-[16px] bg-[var(--ui-surface-1)] px-3.5 py-3",children:[e.jsx(x,{label:"Sustain rate"}),e.jsx("div",{className:"mt-2 text-lg text-[var(--ui-ink-strong)]",children:m?me(m.sustainRateApPerHour):"0 AP/h"})]}),e.jsxs("div",{className:"rounded-[16px] bg-[var(--ui-surface-1)] px-3.5 py-3",children:[e.jsx(x,{label:"Expected duration"}),e.jsx("div",{className:"mt-2 text-lg text-[var(--ui-ink-strong)]",children:m?`${Math.round(m.expectedDurationSeconds/3600)} h`:"No target"})]})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[(De=t.task.splitSuggestion)!=null&&De.shouldSplit?e.jsx(i,{className:"bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_78%,var(--ui-ink-strong)_22%)]",children:"Split it"}):null,m?e.jsxs(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]",children:["Remaining ",T(m.remainingAp)]}):null,m?e.jsxs(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]",children:["Spent total ",T(m.spentTotalAp)]}):null,m?e.jsx(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]",children:m.costBand}):null]}),e.jsx("p",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"This task only debits the Action Points you actually worked today. Marking it done does not consume the full estimate by itself."})]}),e.jsxs("div",{className:"mt-5 rounded-[20px] bg-[var(--ui-surface-2)] p-4",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Today's Life Force context"}),e.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-3",children:[e.jsxs("div",{className:"rounded-[16px] bg-[var(--ui-surface-1)] px-3.5 py-3",children:[e.jsx(x,{label:"Daily AP"}),e.jsx("div",{className:"mt-2 text-lg text-[var(--ui-ink-strong)]",children:I.data?`${T(I.data.spentTodayAp)} / ${T(I.data.dailyBudgetAp)}`:"Loading..."})]}),e.jsxs("div",{className:"rounded-[16px] bg-[var(--ui-surface-1)] px-3.5 py-3",children:[e.jsx(x,{label:"Instant headroom"}),e.jsx("div",{className:"mt-2 text-lg text-[var(--ui-ink-strong)]",children:I.data?me(I.data.instantFreeApPerHour):"Loading..."})]}),e.jsxs("div",{className:"rounded-[16px] bg-[var(--ui-surface-1)] px-3.5 py-3",children:[e.jsx(x,{label:"Forecast"}),e.jsx("div",{className:"mt-2 text-lg text-[var(--ui-ink-strong)]",children:I.data?`${T(I.data.forecastAp)} / ${T(I.data.dailyBudgetAp)}`:"Loading..."})]})]})]}),e.jsxs("div",{className:"mt-5 rounded-[20px] bg-[var(--ui-surface-2)] p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-[var(--ui-ink-soft)]",children:[e.jsx("span",{children:"Current timer"}),e.jsx(Ue,{content:"This shows whether work is running on the task right now and how much time has been credited.",label:"Explain current timer"})]}),e.jsx("div",{className:"mt-3 text-[var(--ui-ink-strong)]",children:f?`${f.timerMode==="planned"?"Planned":"Unlimited"} timer active with ${Math.floor(f.creditedSeconds/60)} credited minutes.`:"No timer is running on this task right now."})]}),e.jsxs("div",{className:"mt-5 grid gap-4 xl:grid-cols-[minmax(0,1fr)_20rem]",children:[e.jsxs("div",{className:"rounded-[20px] bg-[var(--ui-surface-2)] p-4",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Task scheduling"}),e.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[16px] bg-[var(--ui-surface-1)] px-3.5 py-3",children:[e.jsx(x,{label:"Rule source"}),e.jsx("div",{className:"mt-2 text-[var(--ui-ink-strong)]",children:t.task.schedulingRules?"Task-specific override":"Uses project defaults"})]}),e.jsxs("div",{className:"rounded-[16px] bg-[var(--ui-surface-1)] px-3.5 py-3",children:[e.jsx(x,{label:"Planned duration"}),e.jsx("div",{className:"mt-2 text-[var(--ui-ink-strong)]",children:t.task.plannedDurationSeconds?`${Math.round(t.task.plannedDurationSeconds/60)} min`:"No duration target"})]})]}),e.jsx("p",{className:"mt-4 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Scheduling rules now live behind the guided modal flow instead of an inline editor. Use it to change eligible blocks, blocked contexts, and the planning duration without overcrowding the task page."}),e.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[e.jsxs(k,{onClick:()=>ge(!0),children:[e.jsx(ue,{className:"size-4"}),"Edit task scheduling"]}),e.jsx(A,{to:"/calendar",children:e.jsx(k,{variant:"secondary",children:"Open calendar workspace"})})]})]}),e.jsxs("div",{className:"rounded-[20px] bg-[var(--ui-surface-2)] p-4",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Calendar status"}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsx(i,{className:D.tone==="blocked"?"bg-[var(--ui-danger-soft)] text-[color-mix(in_srgb,var(--danger)_76%,var(--ui-ink-strong)_24%)]":D.tone==="waiting"?"bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_78%,var(--ui-ink-strong)_22%)]":"bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_76%,var(--ui-ink-strong)_24%)]",children:D.label}),e.jsx(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]",children:t.task.schedulingRules?"Task override":"Using project defaults"}),t.task.plannedDurationSeconds?e.jsxs(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]",children:[Math.round(t.task.plannedDurationSeconds/60)," min target"]}):null]}),e.jsx("p",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Forge checks these rules before a live run starts. If the current calendar context is blocked, you can still override with an explicit reason."}),D.context.length>0?e.jsxs("div",{className:"mt-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Current context"}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:D.context.map(s=>e.jsx(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]",children:s},s))})]}):null,D.conflicts.length>0?e.jsx("div",{className:"mt-4 grid gap-2",children:D.conflicts.map(s=>e.jsx("div",{className:"rounded-[16px] bg-[var(--ui-danger-soft)] px-3 py-2 text-sm text-[color-mix(in_srgb,var(--danger)_76%,var(--ui-ink-strong)_24%)]",children:s},s))}):null,e.jsx("div",{className:"mt-4 flex flex-wrap gap-2",children:e.jsxs(k,{pending:ie.isPending||ke.isPending,pendingLabel:"Planning",onClick:()=>{U(null),j(!0)},children:[e.jsx(ue,{className:"size-4"}),"Time Box"]})})]})]}),e.jsxs("div",{className:"mt-5 rounded-[20px] bg-[var(--ui-surface-2)] p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Scheduled blocks"}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Open a scheduled block to edit the day, the hour range, or the AP profile tied to this task."})]}),e.jsx(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]",children:G.length})]}),e.jsxs("div",{className:"mt-4 grid gap-3",children:[G.length===0?e.jsx("div",{className:"rounded-[18px] bg-[var(--ui-surface-1)] px-4 py-4 text-sm text-[var(--ui-ink-faint)]",children:"No future timeboxes are attached to this task yet."}):null,G.map(s=>e.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{U(s),j(!0)},onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),U(s),j(!0))},className:"rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-4 text-left transition hover:bg-[var(--ui-surface-hover)]",children:[e.jsx("div",{className:"flex flex-wrap items-start justify-between gap-3",children:e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"line-clamp-2 font-medium leading-6 text-[var(--ui-ink-strong)]",children:s.title}),e.jsxs("div",{className:"mt-1 flex items-center gap-2 text-sm text-[var(--ui-ink-soft)]",children:[e.jsx(xe,{className:"size-3.5 shrink-0"}),u(s.startsAt)," to"," ",u(s.endsAt)]})]})}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsx(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]",children:s.source}),e.jsx(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]",children:s.status}),e.jsx(i,{className:"bg-[var(--primary)]/14 text-[var(--primary)]",children:me(Fe(s).rateApPerHour)}),e.jsx(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]",children:T(Fe(s).totalAp)}),s.overrideReason?e.jsx(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]",children:s.overrideReason}):null]}),e.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[e.jsx("span",{className:"rounded-[999px] bg-[var(--ui-surface-3)] px-3 py-1 text-xs text-[var(--ui-ink-medium)]",children:"Edit in guide"}),e.jsx(A,{to:`/calendar?timeboxId=${encodeURIComponent(s.id)}`,onClick:r=>r.stopPropagation(),className:"rounded-[999px] bg-[var(--ui-surface-3)] px-3 py-1 text-xs text-[var(--ui-ink-medium)] transition hover:bg-[var(--ui-surface-hover)]",children:"Open in calendar"})]})]},s.id))]})]}),e.jsx("div",{className:"mt-5",children:e.jsx(Rs,{entityType:"task",entityId:t.task.id,title:`${g.label} notes`,description:`Capture real progress, blockers, and context in Markdown so the ${g.noun} keeps a durable work log.`,invalidateQueryKeys:[["task-context",v.taskId],...t.task.projectId?[["project-board",t.task.projectId]]:[]]})}),e.jsxs("div",{className:"mt-5",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Activity"}),e.jsxs("div",{className:"mt-4 grid gap-3",children:[t.activity.length===0?e.jsx("div",{className:"rounded-[18px] bg-[var(--ui-surface-2)] p-4 text-sm text-[var(--ui-ink-faint)]",children:"No activity has been recorded for this task yet."}):null,t.activity.map(s=>e.jsxs("div",{className:"rounded-[18px] bg-[var(--ui-surface-2)] p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:Ks(s)}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:Us(s)}),e.jsx("div",{className:"mt-3 text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:u(s.createdAt)})]}),e.jsx(k,{variant:"ghost",className:"shrink-0",onClick:async()=>{await Xe.mutateAsync(s.id)},children:"Remove"})]}),Be(s)&&qe(s)?e.jsx(A,{to:Be(s),className:"mt-3 inline-flex text-[11px] uppercase tracking-[0.16em] text-[var(--primary)]",children:qe(s)}):null]},s.id))]})]}),e.jsxs("div",{className:"mt-5",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Timer sessions"}),e.jsxs("div",{className:"mt-4 grid gap-3",children:[t.taskRuns.length===0?e.jsx("div",{className:"rounded-[18px] bg-[var(--ui-surface-2)] p-4 text-sm text-[var(--ui-ink-faint)]",children:"No timer sessions have been recorded for this task yet."}):null,t.taskRuns.map(s=>{var r,n,L,B,_e;return e.jsxs("div",{className:"rounded-[18px] bg-[var(--ui-surface-2)] p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:s.actor}),e.jsx(i,{children:ts(s.status)})]}),(r=s.gitContext)!=null&&r.branch||(n=s.gitContext)!=null&&n.pullRequestNumber?e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[(L=s.gitContext)!=null&&L.branch?e.jsxs(i,{className:"bg-[var(--ui-accent-soft)] text-[var(--primary)]",children:[e.jsx(Ee,{className:"mr-1 size-3"}),s.gitContext.branch]}):null,(B=s.gitContext)!=null&&B.pullRequestNumber?e.jsxs(i,{className:"bg-[var(--ui-accent-soft)] text-[var(--tertiary)]",children:[e.jsx(xs,{className:"mr-1 size-3"}),"PR #",s.gitContext.pullRequestNumber]}):null,(_e=s.gitContext)!=null&&_e.repository?e.jsx(i,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-soft)]",children:s.gitContext.repository}):null]}):null,e.jsx("div",{className:"mt-2 text-sm text-[var(--ui-ink-soft)]",children:s.note||a("common.labels.noRunNote")}),e.jsx("div",{className:"mt-3 text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:u(s.updatedAt)})]},s.id)})]})]})]}),e.jsx(Os,{open:E,goals:c.snapshot.goals,projects:c.snapshot.dashboard.projects,workItems:c.snapshot.workItems,tags:c.snapshot.tags,users:c.snapshot.users,editingTask:t.task,defaultUserId:t.task.userId??C,onRefreshEntities:c.refresh,currentCreditedSeconds:t.task.time.totalCreditedSeconds,onOpenChange:M,onAdjustTrackedTime:async s=>{await ae.mutateAsync(s)},onSubmit:async(s,r)=>{r&&await Q.mutateAsync({taskId:r,patch:s})}}),e.jsx(qs,{open:z,onOpenChange:R,entityType:"task",entityId:t.task.id,targetLabel:t.task.title,currentCreditedSeconds:t.task.time.totalCreditedSeconds,pending:ae.isPending,onSubmit:async s=>{await ae.mutateAsync(s)}}),e.jsx(Ps,{open:l,onOpenChange:s=>{j(s),s||U(null)},tasks:[t.task],initialTaskId:t.task.id,lockedTaskId:t.task.id,editingTimebox:Qe,from:F.from,to:F.to,userIds:p,onCreateTimebox:async s=>{await ie.mutateAsync({...s,userId:C??void 0})},onUpdateTimebox:async(s,r)=>{await ke.mutateAsync({timeboxId:s,patch:{...r,userId:C??void 0}})},onDeleteTimebox:async s=>{await Ye.mutateAsync(s)}}),e.jsx(Es,{open:K,onOpenChange:ge,tasks:[t.task],onSave:async({taskId:s,schedulingRules:r,plannedDurationSeconds:n})=>{await Q.mutateAsync({taskId:s,patch:{schedulingRules:r,plannedDurationSeconds:n}}),await b.invalidateQueries({queryKey:["task-calendar-overview",v.taskId]})}}),e.jsx(bs,{open:We,onOpenChange:se,eyebrow:`${g.label} status`,title:"Change status",description:`Pick the state that best matches where this ${g.noun} is right now.`,children:e.jsx("div",{className:"grid gap-3",children:Z.map(s=>{const r=s.icon,n=s.status===t.task.status;return e.jsx("button",{type:"button",disabled:n||Q.isPending,className:`rounded-[22px] border px-4 py-4 text-left transition ${n?"border-[color-mix(in_srgb,var(--primary)_34%,var(--ui-border-subtle)_66%)] bg-[var(--ui-accent-soft)] text-[var(--ui-ink-strong)]":"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)] hover:bg-[var(--ui-surface-3)]"}`,onClick:()=>void we(s.status),children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(r,{className:"size-4 shrink-0 text-[var(--primary)]"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:s.label}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-faint)]",children:s.description})]})]})},s.status)})})})]})}export{Tt as TaskDetailPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as j,j as e,aG as Ie}from"./vendor-BwL6m4SE.js";import{S as Re}from"./scheduling-rules-editor-jakFfxqF.js";import{aA as _e,C as ye,B as Y,x as ae,o as q,k as h,n as z,I as C,m as se,c6 as Ee,N as Le}from"./index-FpGANF9S.js";import{i as je}from"./state-Bpe5dF3T.js";import{F as y,a as Me,Q as Fe}from"./question-flow-dialog-Ded2E85L.js";import{f as $e}from"./calendar-ui-Cy1XRwzV.js";function Je({open:s,onOpenChange:o,tasks:m,onSave:v}){const c=j.useMemo(()=>m.filter(f=>f.status!=="done"),[m]),[I,k]=j.useState("");j.useEffect(()=>{if(s){if(c.length===0){k("");return}k(f=>f&&c.some(g=>g.id===f)?f:c[0].id)}},[c,s]);const N=c.find(f=>f.id===I)??null;return e.jsx(_e,{open:s,onOpenChange:o,eyebrow:"Calendar",title:"Adjust task scheduling rules",description:"Choose a task, then tell Forge which work blocks, calendar conditions, or keywords should allow or block that work.",children:e.jsxs("div",{className:"grid min-w-0 gap-4",children:[e.jsx(ye,{className:"min-w-0 overflow-hidden rounded-[28px] border border-[var(--ui-border-subtle)] !bg-[var(--ui-surface-1)]",children:e.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[e.jsx("div",{className:"rounded-[18px] bg-[var(--primary)]/14 p-3 text-[var(--primary)]",children:e.jsx(Ie,{className:"size-4"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:"Guided rule editing"}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Use this when a task should only run in certain blocks such as Secondary Activity, or should stay blocked during clinic, rest, or other provider events."})]})]})}),c.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"grid min-w-0 gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Task"}),e.jsx("select",{value:I,onChange:f=>k(f.target.value),className:"w-full min-w-0 max-w-full rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-3 text-[15px] text-[var(--ui-ink-strong)] outline-none transition focus:border-[var(--ui-border-strong)] focus:ring-2 focus:ring-[var(--primary)]/20",children:c.map(f=>e.jsx("option",{value:f.id,children:f.title},f.id))})]}),N?e.jsx(Re,{title:"Task rules",subtitle:"These rules are saved directly on the task. They drive blocked-now checks and future timebox recommendations.",initialRules:N.schedulingRules,initialPlannedDurationSeconds:N.plannedDurationSeconds,allowPlannedDuration:!0,saveLabel:"Save task rules",onSave:async({schedulingRules:f,plannedDurationSeconds:g})=>{await v({taskId:N.id,schedulingRules:f,plannedDurationSeconds:g===void 0?N.plannedDurationSeconds:g??null}),o(!1)}}):null]}):e.jsxs(ye,{className:"min-w-0 overflow-hidden rounded-[28px] border border-[var(--ui-border-subtle)] !bg-[var(--ui-surface-1)]",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:"No schedulable tasks yet"}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Create or reopen a task first, then come back here to define work-block and calendar eligibility."}),e.jsx("div",{className:"mt-4",children:e.jsx(Y,{variant:"secondary",onClick:()=>o(!1),children:"Close"})})]})]})})}function E(s){return s.slice(0,10)}function Ke(s){return new Date(`${s}T00:00:00`).toISOString()}function He(s){return new Date(`${s}T23:59:59.999`).toISOString()}function re(s,o,m){return s<o?o:s>m?m:s}function we(s,o){const m=E(s),v=E(o),c=new Date(`${m}T12:00:00`);return c.setDate(c.getDate()+1),re(E(c.toISOString()),m,v)}function be(s){return String(s).padStart(2,"0")}function G(s){return`${be(s.getHours())}:${be(s.getMinutes())}`}function ke(s,o){if(!s||!o)return null;const m=new Date(`${s}T${o}:00`);return Number.isNaN(m.getTime())?null:m}function U(s,o,m){if(m){const k=new Date(m.startsAt),N=new Date(m.endsAt);return{startTime:G(k),endTime:G(N)}}const v=new Date(`${s}T09:00:00`),c=Math.max(1800,Math.min(o??3600,360*60)),I=new Date(v.getTime()+c*1e3);return{startTime:G(v),endTime:G(I)}}function Ne(s,o){return`${new Date(s).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})} - ${new Date(o).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}`}function J(s,o){return`${$e(new Date(s))} · ${Ne(s,o)}`}const Se="rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)]",ne="rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)]",p="bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]",ee="rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-3 text-[15px] text-[var(--ui-ink-strong)] outline-none transition focus:border-[var(--ui-border-strong)] focus:ring-2 focus:ring-[var(--primary)]/20";function te({title:s,subtitle:o,emptyLabel:m,children:v}){const c=Array.isArray(v)?v:v?[v]:[];return e.jsxs("div",{className:`${Se} p-4`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:s}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:o})]}),e.jsx(h,{className:p,children:c.length})]}),e.jsx("div",{className:"mt-3 grid gap-2",children:c.length>0?c:e.jsx("div",{className:"rounded-[18px] border border-dashed border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-3 text-sm text-[var(--ui-ink-muted)]",children:m})})]})}function Be({event:s}){return e.jsxs("div",{className:`${ne} px-3 py-3`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:s.title}),e.jsx(h,{className:p,children:s.availability})]}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:J(s.startAt,s.endAt)})]})}function Oe({block:s}){return e.jsxs("div",{className:`${ne} px-3 py-3`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:s.title}),e.jsx(h,{className:p,children:s.blockingState})]}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:J(s.startAt,s.endAt)})]})}function We({timebox:s}){const o=ae(s);return e.jsxs("div",{className:`${ne} px-3 py-3`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:s.title}),e.jsx(h,{className:p,children:s.source})]}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:J(s.startsAt,s.endsAt)}),e.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[e.jsx(h,{className:p,children:se(o.rateApPerHour)}),e.jsx(h,{className:p,children:z(o.totalAp)})]})]})}function Xe({open:s,onOpenChange:o,tasks:m,from:v,to:c,onCreateTimebox:I,onUpdateTimebox:k,onDeleteTimebox:N,initialTaskId:f,lockedTaskId:g,editingTimebox:t,userIds:le}){var he,pe,fe,ve,ge,xe;const L=!!t,w=j.useMemo(()=>{const a=g??(t==null?void 0:t.taskId)??null,d=m.filter(u=>u.status!=="done"||u.id===a);if(!a)return d;const r=d.find(u=>u.id===a);return r?[r]:[]},[t==null?void 0:t.taskId,g,m]),M=E(v),F=E(c),ie=t?re(E(t.startsAt),M,F):we(v,c),oe=g??(t==null?void 0:t.taskId)??f??((he=w[0])==null?void 0:he.id)??"",$=w.find(a=>a.id===oe)??w[0]??null,de=U(ie,$==null?void 0:$.plannedDurationSeconds,t?{startsAt:t.startsAt,endsAt:t.endsAt}:null),[i,O]=j.useState({taskId:oe,preferredDate:ie,plannerMode:t?"manual":"suggested",selectedTimeboxId:"",activityPresetKey:((pe=t==null?void 0:t.actionProfile)==null?void 0:pe.profileKey)??"task_inherited",customSustainRateApPerHour:((fe=t==null?void 0:t.actionProfile)==null?void 0:fe.sourceMethod)==="manual"?t.actionProfile.sustainRateApPerHour:null,manualStartTime:de.startTime,manualEndTime:de.endTime,manualTitle:(t==null?void 0:t.title)??($==null?void 0:$.title)??"",overrideReason:(t==null?void 0:t.overrideReason)??""}),[Ae,b]=j.useState(null),[Pe,W]=j.useState(!1),[De,ce]=j.useState(!1);j.useEffect(()=>{var _,H,B;if(!s)return;const a=g??f??((_=w[0])==null?void 0:_.id)??"",d=(t==null?void 0:t.taskId)??a,r=w.find(x=>x.id===d)??w[0]??null,u=t?re(E(t.startsAt),M,F):we(v,c),n=U(u,r==null?void 0:r.plannedDurationSeconds,t?{startsAt:t.startsAt,endsAt:t.endsAt}:null);b(null),O({taskId:d,preferredDate:u,plannerMode:t?"manual":"suggested",selectedTimeboxId:"",activityPresetKey:((H=t==null?void 0:t.actionProfile)==null?void 0:H.profileKey)??"task_inherited",customSustainRateApPerHour:((B=t==null?void 0:t.actionProfile)==null?void 0:B.sourceMethod)==="manual"?t.actionProfile.sustainRateApPerHour:null,manualStartTime:n.startTime,manualEndTime:n.endTime,manualTitle:(t==null?void 0:t.title)??(r==null?void 0:r.title)??"",overrideReason:(t==null?void 0:t.overrideReason)??""})},[w,t,v,f,g,F,M,s,c]);const l=w.find(a=>a.id===i.taskId)??null,P=j.useMemo(()=>({from:Ke(i.preferredDate),to:He(i.preferredDate)}),[i.preferredDate]),D=je({queryKey:["forge-calendar-suggestions-dialog",i.taskId,P.from,P.to],queryFn:()=>Ee({taskId:i.taskId,from:P.from,to:P.to,limit:8}),enabled:s&&i.taskId.length>0}),X=je({queryKey:["forge-calendar-timebox-dialog-day",P.from,P.to,...le??[]],queryFn:()=>Le({from:P.from,to:P.to,userIds:le}),enabled:s});j.useEffect(()=>{var d;if(!s)return;const a=((d=D.data)==null?void 0:d.timeboxes)??[];if(!a.length){O(r=>r.selectedTimeboxId?{...r,selectedTimeboxId:""}:r);return}O(r=>r.selectedTimeboxId&&a.some(u=>u.id===r.selectedTimeboxId)?r:{...r,selectedTimeboxId:a[0].id})},[s,D.data]);const A=(ve=X.data)==null?void 0:ve.calendar,Z=(A==null?void 0:A.events)??[],V=(A==null?void 0:A.workBlockInstances)??[],T=(A==null?void 0:A.timeboxes)??[],K=(((ge=D.data)==null?void 0:ge.timeboxes)??[]).find(a=>a.id===i.selectedTimeboxId),S=ke(i.preferredDate,i.manualStartTime),R=ke(i.preferredDate,i.manualEndTime),Q=S&&R?ae({startsAt:S.toISOString(),endsAt:R.toISOString(),actionProfile:i.customSustainRateApPerHour!==null||i.activityPresetKey!=="task_inherited"?{id:"manual-preview",profileKey:"manual-preview",title:i.manualTitle||(l==null?void 0:l.title)||"Manual timebox",entityType:"task_timebox",mode:"container",startupAp:0,totalCostAp:0,expectedDurationSeconds:null,sustainRateApPerHour:i.customSustainRateApPerHour??((xe=q().find(a=>a.key===i.activityPresetKey))==null?void 0:xe.defaultRateApPerHour)??100/24,demandWeights:{activation:.1,focus:.3,vigor:.1,composure:.1,flow:.4},doubleCountPolicy:"container_only",sourceMethod:"manual",costBand:"light",recoveryEffect:0,metadata:{},createdAt:S.toISOString(),updatedAt:S.toISOString()}:null}):null,ue=L?"Review the task tied to this scheduled block":g?"Review the task you are planning":"Choose the task you want to place into the calendar",me=L?"The timebox stays linked to this task. Update the day, hours, title, or AP profile without leaving the planning flow.":g?"Forge will use this task's current duration target and scheduling rules while it looks for viable slots.":"Forge will use the task's current planned duration and scheduling rules when it searches for valid slots.",Ce=j.useMemo(()=>[{id:"task",eyebrow:"Planning",title:ue,description:me,render:(a,d)=>e.jsxs("div",{className:"grid min-w-0 max-w-full gap-4 overflow-hidden",children:[g?null:e.jsx(y,{label:"Task",children:e.jsx("select",{value:a.taskId,onChange:r=>(()=>{const u=w.find(_=>_.id===r.target.value),n=U(a.preferredDate,u==null?void 0:u.plannedDurationSeconds);d({taskId:r.target.value,selectedTimeboxId:"",activityPresetKey:"task_inherited",customSustainRateApPerHour:null,manualStartTime:n.startTime,manualEndTime:n.endTime,manualTitle:(u==null?void 0:u.title)??a.manualTitle})})(),className:ee,children:w.map(r=>e.jsx("option",{value:r.id,children:r.title},r.id))})}),l?e.jsxs("div",{className:"min-w-0 max-w-full overflow-hidden rounded-[28px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-5 shadow-[var(--ui-shadow-soft)]",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-muted)]",children:"Time Box"}),e.jsx("div",{className:"mt-2 break-words font-display text-[1.4rem] leading-tight text-[var(--ui-ink-strong)]",children:l.title})]}),e.jsx(h,{className:p,children:l.status})]}),e.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[e.jsx(h,{className:p,children:l.plannedDurationSeconds?`${Math.round(l.plannedDurationSeconds/60)} min target`:"No duration yet"}),e.jsx(h,{className:p,children:l.schedulingRules?"Task-specific rules":"Uses project rules"}),e.jsxs(h,{className:p,children:[l.points," xp"]}),l.plannedDurationSeconds?e.jsxs(h,{className:p,children:[z(l.plannedDurationSeconds/3600/24*100)," ","target load"]}):null]}),e.jsx("p",{className:"mt-4 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Pick a day first, then either accept one of Forge's suggested slots or set the block manually."}),L&&t&&N?e.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-between gap-3 rounded-[20px] border border-[color-mix(in_srgb,var(--danger)_24%,var(--ui-border-subtle)_76%)] bg-[var(--ui-danger-soft)] px-4 py-3",children:[e.jsx("div",{className:"text-sm leading-6 text-[color-mix(in_srgb,var(--danger)_76%,var(--ui-ink-strong)_24%)]",children:"Remove this planned timebox if you no longer want it in the calendar."}),e.jsx(Y,{type:"button",variant:"ghost",className:"text-[color-mix(in_srgb,var(--danger)_76%,var(--ui-ink-strong)_24%)] hover:bg-[var(--ui-danger-soft)]",pending:De,pendingLabel:"Deleting",onClick:()=>void(async()=>{b(null),ce(!0);try{await N(t.id),o(!1)}catch(r){b(r instanceof Error?r.message:"Forge could not delete this timebox.")}finally{ce(!1)}})(),children:"Delete timebox"})]}):null]}):null]})},{id:"day",eyebrow:"Calendar",title:"Choose the day and review what is already there",description:"Forge reads the real day first so the timebox stays grounded in your provider events, work blocks, and already-planned work.",render:(a,d)=>e.jsx("div",{className:"grid gap-5",children:e.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,16rem)_minmax(0,1fr)]",children:[e.jsxs("div",{className:"grid gap-4",children:[e.jsx(y,{label:"Date",description:"Choose the day you want to protect for this task.",children:e.jsx(C,{type:"date",min:M,max:F,value:a.preferredDate,onChange:r=>{const u=U(r.target.value,l==null?void 0:l.plannedDurationSeconds,t?{startsAt:`${r.target.value}T${a.manualStartTime}:00`,endsAt:`${r.target.value}T${a.manualEndTime}:00`}:null);d({preferredDate:r.target.value,selectedTimeboxId:"",manualStartTime:u.startTime,manualEndTime:u.endTime})}})}),e.jsx(y,{label:"Planning style",description:"Take Forge's slot recommendation when it fits, or set the block yourself.",children:e.jsx(Me,{value:a.plannerMode,onChange:r=>d({plannerMode:r}),options:[{value:"suggested",label:"Use suggestions",description:"Forge proposes slots that fit the task rules and the selected day."},{value:"manual",label:"Set it manually",description:"You choose the exact start and end time yourself."}]})})]}),e.jsxs("div",{className:"rounded-[28px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-5",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-muted)]",children:"Selected day"}),e.jsx("div",{className:"mt-2 font-display text-[1.3rem] leading-tight text-[var(--ui-ink-strong)]",children:a.preferredDate?new Date(`${a.preferredDate}T12:00:00`).toLocaleDateString([],{weekday:"long",month:"long",day:"numeric"}):"Choose a day"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(h,{className:p,children:[Z.length," events"]}),e.jsxs(h,{className:p,children:[V.length," work blocks"]}),e.jsxs(h,{className:p,children:[T.length," timeboxes"]})]})]}),e.jsx("p",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"This is the context Forge will use while recommending a slot. You can still place the block manually if you want something more exact."}),X.isLoading?e.jsx("div",{className:"mt-4 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-4 text-sm text-[var(--ui-ink-soft)]",children:"Loading the selected day…"}):e.jsxs("div",{className:"mt-4 grid gap-4 xl:grid-cols-3",children:[e.jsx(te,{title:"Provider events",subtitle:"Busy or free events already on the day.",emptyLabel:"No mirrored events on this day.",children:Z.slice(0,4).map(r=>e.jsx(Be,{event:r},r.id))}),e.jsx(te,{title:"Work blocks",subtitle:"Recurring allowed or blocked containers.",emptyLabel:"No work blocks land on this day.",children:V.slice(0,4).map(r=>e.jsx(Oe,{block:r},r.id))}),e.jsx(te,{title:"Planned timeboxes",subtitle:"Existing owned work already placed there.",emptyLabel:"No other planned timeboxes yet.",children:T.slice(0,4).map(r=>e.jsx(We,{timebox:r},r.id))})]})]})]})})},{id:"slot",eyebrow:i.plannerMode==="suggested"?"Suggestion":"Manual",title:i.plannerMode==="suggested"?"Choose one of Forge's suggested slots":"Set the exact timebox yourself",description:i.plannerMode==="suggested"?"Forge proposes slots that fit the selected day, the task rules, and the current calendar picture.":"Use manual mode when the right block is obvious to you or when you want to place the timebox despite imperfect recommendations.",render:(a,d)=>{var u;if(a.plannerMode==="manual")return e.jsxs("div",{className:"grid gap-5",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsx(y,{label:"Day",description:"Pick the day for the block. Forge defaults to a future day, but you can move it.",children:e.jsx(C,{type:"date",min:M,max:F,value:a.preferredDate,onChange:n=>d({preferredDate:n.target.value})})}),e.jsx(y,{label:"Start time",description:"Choose when the protected work block should begin.",children:e.jsx(C,{type:"time",step:300,value:a.manualStartTime,onChange:n=>d({manualStartTime:n.target.value})})}),e.jsx(y,{label:"End time",description:"Choose when the work block should end.",children:e.jsx(C,{type:"time",step:300,value:a.manualEndTime,onChange:n=>d({manualEndTime:n.target.value})})})]}),e.jsx(y,{label:"Title",description:"By default Forge uses the task title. Tighten it only if a shorter calendar label would help.",children:e.jsx(C,{value:a.manualTitle,onChange:n=>d({manualTitle:n.target.value}),placeholder:(l==null?void 0:l.title)??"Task timebox"})}),e.jsx(y,{label:"Override reason",description:"Optional. Add a short reason only if you are intentionally placing the block despite the normal rules or calendar shape.",children:e.jsx(C,{value:a.overrideReason,onChange:n=>d({overrideReason:n.target.value}),placeholder:"Protected writing block before clinic."})}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(y,{label:"Activity profile",children:e.jsx("select",{value:a.activityPresetKey??"task_inherited",onChange:n=>d({activityPresetKey:n.target.value}),className:ee,children:q().map(n=>e.jsx("option",{value:n.key,children:n.label},n.key))})}),e.jsx(y,{label:"Custom AP per hour",children:e.jsx(C,{type:"number",min:0,step:.5,value:a.customSustainRateApPerHour??"",onChange:n=>d({customSustainRateApPerHour:n.target.value.trim()===""?null:Number(n.target.value)}),placeholder:"Leave empty to use the activity profile"})})]}),e.jsxs("div",{className:`${Se} p-4`,children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:a.manualTitle||(l==null?void 0:l.title)||"Manual timebox"}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:S&&R?`${S.toLocaleDateString([],{weekday:"long",month:"short",day:"numeric"})} · ${Ne(S.toISOString(),R.toISOString())}`:"Choose a start and end time."})]}),e.jsx(h,{className:p,children:"manual"})]}),Q?e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsx(h,{className:p,children:se(Q.rateApPerHour)}),e.jsx(h,{className:p,children:z(Q.totalAp)})]}):null]})]});const r=((u=D.data)==null?void 0:u.timeboxes)??[];return D.isLoading?e.jsx("div",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Looking for valid slots on the selected day…"}):r.length?e.jsx("div",{className:"grid gap-3",children:r.map(n=>{var B;const _=a.selectedTimeboxId===n.id,H=ae({...n,actionProfile:a.customSustainRateApPerHour!==null||a.activityPresetKey!=="task_inherited"?{id:"suggested-preview",profileKey:"suggested-preview",title:n.title,entityType:"task_timebox",mode:"container",startupAp:0,totalCostAp:0,expectedDurationSeconds:null,sustainRateApPerHour:a.customSustainRateApPerHour??((B=q().find(x=>x.key===a.activityPresetKey))==null?void 0:B.defaultRateApPerHour)??100/24,demandWeights:{activation:.1,focus:.3,vigor:.1,composure:.1,flow:.4},doubleCountPolicy:"container_only",sourceMethod:"manual",costBand:"light",recoveryEffect:0,metadata:{},createdAt:n.startsAt,updatedAt:n.startsAt}:null});return e.jsxs("button",{type:"button",onClick:()=>d({selectedTimeboxId:n.id}),className:`rounded-[24px] border px-4 py-4 text-left transition ${_?"border-[color-mix(in_srgb,var(--primary)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-accent-soft)] text-[var(--ui-ink-strong)] shadow-[var(--ui-shadow-soft)]":"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)] hover:border-[var(--ui-border-strong)] hover:bg-[var(--ui-surface-hover)]"}`,children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("div",{className:"font-medium",children:n.title}),e.jsx(h,{className:p,children:n.source})]}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:J(n.startsAt,n.endsAt)}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsx(h,{className:p,children:se(H.rateApPerHour)}),e.jsx(h,{className:p,children:z(H.totalAp)})]}),_?e.jsxs("div",{className:"mt-4 grid gap-4 md:grid-cols-2",children:[e.jsx(y,{label:"Activity profile",children:e.jsx("select",{value:a.activityPresetKey??"task_inherited",onChange:x=>d({activityPresetKey:x.target.value}),className:ee,children:q().map(x=>e.jsx("option",{value:x.key,children:x.label},x.key))})}),e.jsx(y,{label:"Custom AP per hour",children:e.jsx(C,{type:"number",min:0,step:.5,value:a.customSustainRateApPerHour??"",onChange:x=>d({customSustainRateApPerHour:x.target.value.trim()===""?null:Number(x.target.value)}),placeholder:"Leave empty to use the activity profile"})})]}):null]},n.id)})}):e.jsxs("div",{className:"grid gap-3",children:[e.jsx("div",{className:"rounded-[24px] border border-[color-mix(in_srgb,var(--warning)_24%,var(--ui-border-subtle)_76%)] bg-[var(--ui-warning-soft)] px-4 py-4 text-sm leading-6 text-[color-mix(in_srgb,var(--warning)_72%,var(--ui-ink-strong)_28%)]",children:"Forge could not find a valid slot on this day. Try another day, adjust the task rules, or switch to manual placement if you already know the right block."}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(Y,{variant:"secondary",onClick:()=>void D.refetch(),children:"Refresh suggestions"}),e.jsx(Y,{variant:"secondary",onClick:()=>d({plannerMode:"manual"}),children:"Switch to manual"})]})]})}}],[w,X.isLoading,V,Z,T,i.plannerMode,t,v,g,F,Q,M,l,D.data,D.isLoading,me,ue,c]);return e.jsx(Fe,{open:s,onOpenChange:o,eyebrow:"Calendar",title:L?"Edit timebox":"Plan work",description:L?"Update the day, hour range, title, and AP profile for this scheduled block without leaving the task or calendar view.":"Review the day, let Forge recommend valid slots, and place a real timebox on the task without leaving the detail view.",value:i,onChange:O,draftPersistenceKey:t?`calendar.timebox.${t.id}`:`calendar.timebox.new.${(l==null?void 0:l.id)??"unscoped"}`,steps:Ce,submitLabel:L?"Save timebox":"Schedule timebox",pending:Pe,pendingLabel:"Scheduling",error:Ae,contentClassName:"md:w-[min(70rem,calc(100vw-1.5rem))]",onSubmit:async()=>{if(!l){b("Choose a task before scheduling a timebox.");return}if(i.plannerMode==="manual"){if(!S||!R){b("Choose a valid manual start and end time.");return}if(R<=S){b("The manual timebox needs an end time after the start time.");return}b(null),W(!0);try{const a={title:i.manualTitle.trim()||l.title,startsAt:S.toISOString(),endsAt:R.toISOString(),overrideReason:i.overrideReason.trim()||null,activityPresetKey:i.activityPresetKey,customSustainRateApPerHour:i.customSustainRateApPerHour};t&&k?await k(t.id,a):await I({taskId:l.id,projectId:l.projectId,...a,source:"manual"}),o(!1)}catch(a){b(a instanceof Error?a.message:"Forge could not create the manual timebox.")}finally{W(!1)}return}if(!K){b("Pick one suggested slot before scheduling the timebox.");return}b(null),W(!0);try{const a={title:K.title,startsAt:K.startsAt,endsAt:K.endsAt,activityPresetKey:i.activityPresetKey,customSustainRateApPerHour:i.customSustainRateApPerHour};t&&k?await k(t.id,a):await I({taskId:l.id,projectId:l.projectId,...a,source:K.source}),o(!1)}catch(a){b(a instanceof Error?a.message:"Forge could not create the selected timebox.")}finally{W(!1)}}})}export{Je as T,Xe as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,aC as b,bW as L,b9 as C,bF as X,b6 as F,r as D,aV as O,cv as M}from"./vendor-BwL6m4SE.js";import{i as U}from"./state-Bpe5dF3T.js";import{A as z}from"./ai-surface-workspace-CF0257Hs.js";import{T as Q,W as V,M as q,S as K,Q as G}from"./utility-widgets-ilORjDmg.js";import{E as H}from"./entity-note-count-link-Bs1aKYyD.js";import{u as _,a4 as I,k as x,R as Y,b as S,E,B as J,c as Z,d as ee,h as te,C as k,P as se,N as ae}from"./index-FpGANF9S.js";import{S as $}from"./surface-ubuOfukq.js";import{a as ie}from"./life-force-workspace-C7UOnJEf.js";import{P}from"./page-hero-DvrM83_C.js";import{T as ne,a as re,b as oe,c as le,d as de}from"./today-boxes-CYuxSkZf.js";import"./board-CuxQRKPJ.js";import"./generic-node-view-C6DK5hJ6.js";import"./graph-BF4IsheG.js";import"./motion-DcgUnXhY.js";import"./ui-B9TWEtCx.js";import"./forms-D1qJ3oOP.js";import"./floating-action-menu-DAFAEBcA.js";import"./charts-BzT4pUPg.js";import"./define-workbench-box-CpG0Zb1L.js";function A(s,t){return t.find(c=>c.id===s.goalId)??null}function ce(s,t){return s.tagIds.map(c=>t.find(d=>d.id===c)).filter(Boolean)}function me(s,t){(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),t())}function ue(s,t){switch(s.status){case"backlog":return{label:t.backlog,action:"start",icon:C};case"focus":return{label:t.focus,action:"start",icon:C};case"in_progress":return{label:t.in_progress,nextStatus:"done",action:"move",icon:X};case"blocked":return{label:t.blocked,action:"start",icon:C};default:return null}}function xe({tasks:s,timeline:t,goals:c,tags:d,notesSummaryByEntity:N,selectedTaskId:j,onSelectTask:r,onMove:p,onStartTask:f}){const{t:o,formatDate:w}=_(),T={backlog:o("common.dailyRunway.actionBacklog"),focus:o("common.dailyRunway.actionFocus"),in_progress:o("common.dailyRunway.actionProgress"),blocked:o("common.dailyRunway.actionBlocked")};return e.jsxs("div",{className:"grid min-w-0 gap-4 2xl:grid-cols-[minmax(0,1.3fr)_minmax(17rem,0.9fr)]",children:[e.jsxs($,{className:"min-w-0 rounded-[24px]",children:[e.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:o("common.dailyRunway.runwayEyebrow")}),e.jsx(I,{content:"These are the tasks that matter most for today. Click a card to open the task details. Use Start to begin work immediately."})]}),e.jsx("h4",{className:"mt-2 font-display text-2xl text-[var(--ui-ink-strong)]",children:o("common.dailyRunway.runwayTitle")})]}),e.jsx(x,{className:"shrink-0 text-[var(--primary)]",children:o(s.length===1?"common.dailyRunway.prioritiesOne":"common.dailyRunway.prioritiesOther",{count:s.length})})]}),e.jsx("div",{className:"mt-4 grid min-w-0 gap-3",children:s.map((a,y)=>{const l=ue(a,T),i=ce(a,d).slice(0,2),n=A(a,c),h=j===a.id,B=Y(N,"task",a.id).count;return e.jsxs("article",{role:"button",tabIndex:0,"aria-pressed":h,className:Z("grid w-full gap-3 rounded-[22px] border px-4 py-4 text-left transition",h?"border-[var(--primary)]/28 bg-[var(--ui-accent-soft)] shadow-[var(--ui-shadow-soft)]":"border-transparent bg-[var(--ui-surface-1)] hover:border-[var(--ui-border-subtle)] hover:bg-[var(--ui-surface-hover)]"),onClick:()=>r(a.id),onKeyDown:m=>me(m,()=>r(a.id)),children:[e.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:o("common.dailyRunway.runwayItem",{index:y+1})}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[n?e.jsx(b,{to:`/goals/${n.id}`,className:"min-w-0 max-w-full transition hover:opacity-85",onClick:m=>m.stopPropagation(),children:e.jsx(S,{kind:"goal",label:n.title,compact:!0,gradient:!1})}):e.jsx(S,{kind:"goal",label:o("common.dailyRunway.unassigned"),compact:!0,gradient:!1}),a.time.activeRunCount>0?e.jsx(x,{className:"border-[color-mix(in_srgb,#10b981_24%,transparent)] bg-[color-mix(in_srgb,#10b981_16%,var(--ui-surface-1))] text-[color-mix(in_srgb,#10b981_80%,var(--ui-ink-strong)_20%)]",children:"Live"}):null]}),e.jsx("div",{className:"mt-2",children:e.jsx(b,{to:`/tasks/${a.id}`,className:"block min-w-0 max-w-full transition hover:opacity-85",onClick:m=>m.stopPropagation(),children:e.jsx(E,{kind:"task",label:a.title,variant:"heading",size:"md"})})}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:a.description||o("common.dailyRunway.noNote")})]}),e.jsx(x,{className:"shrink-0 self-start",children:a.status.replaceAll("_"," ")})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(x,{className:"bg-[var(--primary)]/14 text-[var(--primary)]",children:[a.points," xp"]}),e.jsx(H,{entityType:"task",entityId:a.id,count:B}),a.time.totalCreditedSeconds>0?e.jsxs(x,{tone:"meta",children:[Math.floor(a.time.totalCreditedSeconds/60)," min tracked"]}):null,e.jsx(x,{tone:"meta",children:a.effort}),e.jsx(x,{tone:"meta",children:w(a.dueDate)}),i.map(m=>e.jsx(x,{className:"bg-[var(--ui-surface-2)]",style:{color:m.color},children:m.name},m.id))]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:a.owner}),l?e.jsxs(J,{variant:l.action==="start"?"primary":"secondary",className:"px-3 py-2 text-[11px] uppercase tracking-[0.16em]",onClick:async m=>{if(m.stopPropagation(),l.action==="start"){await f(a.id);return}l.nextStatus&&await p(a.id,l.nextStatus)},children:[e.jsx(l.icon,{className:"mr-2 size-3.5"}),l.label]}):null]})]},a.id)})})]}),e.jsxs($,{className:"min-w-0 rounded-[24px]",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:o("common.dailyRunway.timelineEyebrow")}),e.jsx(I,{content:"This groups today's tasks by status, so you can see what is already moving, what is ready to start, what is blocked, and what is done."})]}),e.jsx("h4",{className:"mt-2 font-display text-2xl text-[var(--ui-ink-strong)]",children:o("common.dailyRunway.timelineTitle")}),e.jsx("div",{className:"mt-4 grid min-w-0 gap-3",children:t.map(a=>e.jsxs($,{muted:!0,className:"min-w-0 overflow-hidden rounded-[20px]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:a.label}),e.jsx(x,{tone:"meta",children:a.tasks.length})]}),e.jsxs("div",{className:"mt-3 grid gap-2",children:[a.tasks.slice(0,3).map(y=>{const l=A(y,c);return e.jsxs(b,{to:`/tasks/${y.id}`,className:"flex min-w-0 items-center justify-between gap-3 overflow-hidden rounded-[16px] bg-[var(--ui-surface-1)] px-3 py-3 text-left transition hover:bg-[var(--ui-surface-hover)]",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(E,{kind:"task",label:y.title,className:"max-w-full",labelClassName:"[overflow-wrap:anywhere]"}),e.jsx("div",{className:"mt-2",children:e.jsx(S,{kind:"goal",label:(l==null?void 0:l.title)??o("common.dailyRunway.unassigned"),compact:!0,gradient:!1})})]}),e.jsx(L,{className:"size-4 shrink-0 text-[var(--ui-ink-faint)]"})]},y.id)}),a.tasks.length===0?e.jsx("div",{className:"text-sm text-[var(--ui-ink-faint)]",children:o("common.dailyRunway.emptyBucket")}):null]})]},a.id))})]})]})}const he=5,g="text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",u="text-[var(--ui-ink-soft)]",v="text-[var(--ui-ink-strong)]",R="min-w-0 rounded-[20px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] shadow-[var(--ui-shadow-soft)]",W="min-w-0 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)]",pe="inline-flex min-h-10 max-w-full shrink-0 items-center justify-center gap-2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-2 text-xs font-medium text-[var(--ui-ink-medium)] shadow-[var(--ui-shadow-soft)] transition hover:border-[var(--ui-border-strong)] hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]";function fe(){const s=new Date;s.setHours(0,0,0,0);const t=new Date(s);return t.setDate(t.getDate()+1),{start:s,end:t,from:s.toISOString(),to:t.toISOString()}}function ye(s,t){const c=new Date(s.startAt),d=new Date(s.endAt);return c<t.end&&d>t.start}function ge(s){if(s.isAllDay)return"All day";const t=new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"});return`${t.format(new Date(s.startAt))} - ${t.format(new Date(s.endAt))}`}function Be(){var l;const{t:s}=_(),t=ee(),c=F(),d=D.useMemo(()=>fe(),[]),N=Array.isArray(t.selectedUserIds)?t.selectedUserIds:[],j=U({queryKey:["forge-calendar-overview",d.from,d.to,...N],queryFn:()=>ae({from:d.from,to:d.to,userIds:N})}),r=t.snapshot.today.directive.task,p=t.snapshot.today.milestoneRewards.find(i=>!i.completed)??t.snapshot.today.milestoneRewards[0]??null,f=t.snapshot.risk.blockedTasks[0]??t.snapshot.risk.overdueTasks[0]??null,o=Math.max(0,t.snapshot.metrics.nextLevelXp-t.snapshot.metrics.currentLevelXp),w=D.useMemo(()=>{var i;return(((i=j.data)==null?void 0:i.calendar.events)??[]).filter(n=>!n.deletedAt&&n.status!=="cancelled"&&ye(n,d)).sort((n,h)=>new Date(n.startAt).getTime()-new Date(h.startAt).getTime())},[(l=j.data)==null?void 0:l.calendar.events,d]),T=w.slice(0,he);if(!(t.snapshot.lifeForce!==void 0||r!==null||t.snapshot.overview.topTasks.length>0||t.snapshot.today.dueHabits.length>0||t.snapshot.today.dailyQuests.length>0||t.snapshot.today.milestoneRewards.length>0||w.length>0)&&!j.isLoading)return e.jsxs("div",{className:"grid gap-4",children:[e.jsx(P,{title:"Today",titleText:"Today",description:"Start a task, earn XP, and keep today's work clear.",badge:`${t.snapshot.metrics.weeklyXp} weekly xp`}),e.jsx(te,{eyebrow:s("common.todayPage.heroEyebrow"),title:s("common.todayPage.emptyTitle"),description:s("common.todayPage.emptyDescription"),action:e.jsx(b,{to:"/goals",className:"inline-flex min-h-10 min-w-max shrink-0 items-center justify-center rounded-full bg-[var(--primary)] px-4 py-2 text-sm font-medium whitespace-nowrap text-[var(--ui-ink-on-accent)] transition hover:opacity-90",children:s("common.todayPage.emptyAction")})})]});const y=[{id:"hero",title:"Today",description:"Compact page header.",defaultWidth:12,defaultHeight:2,removable:!1,surfaceChrome:"none",defaultTitleVisible:!1,defaultDescriptionVisible:!1,render:()=>e.jsx(ne,{children:e.jsx(P,{title:"Today",titleText:"Today",description:(r==null?void 0:r.description)??"Start one real task, collect XP, and keep today's work moving.",badge:`${t.snapshot.metrics.weeklyXp} weekly xp`})})},{id:"life-force",title:"Life Force",description:"Instant headroom, AP use today, and tiredness signals.",defaultWidth:12,defaultHeight:3,minWidth:5,render:()=>e.jsx(ie,{selectedUserIds:t.selectedUserIds,fallbackLifeForce:t.snapshot.lifeForce,onRefresh:t.refresh})},{id:"metrics",title:"Live metrics",description:"XP, level, and momentum stay visible but lighter than before.",defaultWidth:5,defaultHeight:4,minWidth:4,render:({compact:i})=>e.jsx(re,{children:e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs(k,{className:"min-w-0 p-4",children:[e.jsx("div",{className:g,children:"Weekly XP"}),e.jsx("div",{className:"mt-2 break-words font-display text-4xl text-[var(--primary)]",children:t.snapshot.metrics.weeklyXp}),e.jsxs("div",{className:`mt-1 text-sm ${u}`,children:[t.snapshot.metrics.totalXp," total XP"]})]}),e.jsxs(k,{className:"min-w-0 p-4",children:[e.jsx("div",{className:g,children:"Level"}),e.jsx("div",{className:`mt-2 font-display text-4xl ${v}`,children:t.snapshot.metrics.level}),e.jsxs("div",{className:`mt-1 text-sm ${u}`,children:[o," xp to the next level"]}),i?null:e.jsx("div",{className:"mt-3",children:e.jsx(se,{value:t.snapshot.metrics.currentLevelXp/t.snapshot.metrics.nextLevelXp*100,tone:"tertiary"})})]}),e.jsxs(k,{className:"min-w-0 p-4",children:[e.jsx("div",{className:g,children:"Momentum"}),e.jsxs("div",{className:`mt-2 font-display text-4xl ${v}`,children:[t.snapshot.metrics.momentumScore,"%"]}),e.jsxs("div",{className:`mt-1 text-sm ${u}`,children:[t.snapshot.metrics.streakDays," day streak"]})]}),e.jsxs(k,{className:"min-w-0 p-4",children:[e.jsx("div",{className:g,children:"Next reward"}),e.jsx("div",{className:`mt-2 break-words text-base font-semibold ${v}`,children:(p==null?void 0:p.title)??"Keep showing up"}),e.jsx("div",{className:`mt-1 text-sm ${u}`,children:(p==null?void 0:p.progressLabel)??"The next visible win comes from a task completion or aligned habit check-in."})]})]})})},{id:"runway",title:"Runway",description:"The execution lane itself can be widened or narrowed.",defaultWidth:7,defaultHeight:6,minWidth:5,render:()=>e.jsx(oe,{children:e.jsx(xe,{tasks:t.snapshot.overview.topTasks,timeline:t.snapshot.today.timeline,goals:t.snapshot.goals,tags:t.snapshot.tags,notesSummaryByEntity:t.snapshot.dashboard.notesSummaryByEntity,selectedTaskId:(r==null?void 0:r.id)??null,onSelectTask:i=>c(`/tasks/${i}`),onStartTask:async i=>{await t.startTaskNow(i)},onMove:async(i,n)=>{await t.patchTaskStatus(i,n)}})})},{id:"calendar",title:"Calendar",description:"Today's events stay grouped with their results instead of splitting search from outcome.",defaultWidth:5,defaultHeight:5,minWidth:4,render:({compact:i})=>e.jsx(le,{children:e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("div",{className:"inline-flex size-10 shrink-0 items-center justify-center rounded-2xl bg-[var(--primary)]/14 text-[var(--primary)]",children:e.jsx(O,{className:"size-4"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:g,children:"Today's calendar"}),e.jsx("div",{className:`text-sm font-semibold ${v}`,children:new Intl.DateTimeFormat(void 0,{weekday:"short",month:"short",day:"numeric"}).format(d.start)}),e.jsxs("div",{className:`text-sm ${u}`,children:[w.length," event",w.length===1?"":"s"]})]})]}),e.jsxs(b,{to:"/calendar",className:pe,children:["Open calendar",e.jsx(M,{className:"size-3.5"})]})]}),w.length===0?e.jsx("div",{className:`${W} px-4 py-4 text-sm ${u}`,children:"Nothing is scheduled yet for today."}):T.map(n=>e.jsxs("button",{type:"button",className:`${W} grid gap-2 px-3 py-3 text-left transition hover:bg-[var(--ui-surface-hover)]`,onClick:()=>c("/calendar"),children:[e.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:`truncate text-sm font-medium ${v}`,children:n.title}),e.jsx("div",{className:`mt-1 text-sm ${u}`,children:ge(n)})]}),e.jsx(x,{className:"shrink-0 bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]",children:n.originType==="native"?"Forge":n.originType})]}),!i&&n.description?e.jsx("div",{className:`line-clamp-2 text-sm leading-6 ${u}`,children:n.description}):null]},n.id))]})})},{id:"focus",title:"Current focus",description:"Current task, comeback task, and due habits stay in one movable stack.",defaultWidth:12,defaultHeight:4,minWidth:6,render:({compact:i})=>{var n;return e.jsx(de,{children:e.jsxs("div",{className:"grid min-w-0 gap-4 xl:grid-cols-[minmax(0,1.2fr)_minmax(0,0.8fr)]",children:[e.jsxs("div",{className:`${R} p-4`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:g,children:"Current task"}),r?e.jsx(H,{entityType:"task",entityId:r.id,count:((n=t.snapshot.dashboard.notesSummaryByEntity[`task:${r.id}`])==null?void 0:n.count)??0}):null]}),e.jsx("div",{className:`mt-3 break-words text-base font-semibold ${v}`,children:(r==null?void 0:r.title)??"Pick a task from the runway"}),e.jsx("div",{className:`mt-2 text-sm leading-6 ${u}`,children:(r==null?void 0:r.description)??"Once a task is active, the timer rail and this panel stay aligned."}),r?e.jsx("button",{type:"button",className:"mt-4 inline-flex min-h-10 max-w-full items-center justify-center rounded-2xl border border-[color-mix(in_srgb,var(--primary)_24%,transparent)] bg-[var(--ui-accent-soft)] px-3.5 py-2 text-sm font-medium text-[var(--primary)] shadow-[var(--ui-shadow-soft)] transition hover:bg-[var(--ui-accent-soft-hover)]",onClick:async()=>{await t.startTaskNow(r.id)},children:"Start work"}):null]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:`${R} p-4`,children:[e.jsx("div",{className:g,children:"Recovery task"}),e.jsx("div",{className:`mt-3 break-words text-sm font-semibold ${v}`,children:(f==null?void 0:f.title)??"No blocked or overdue task is dominating today"}),i?null:e.jsx("div",{className:`mt-2 text-sm leading-6 ${u}`,children:(f==null?void 0:f.description)??"If something slips, it will surface here as the clean comeback move."})]}),e.jsxs("div",{className:`${R} p-4`,children:[e.jsx("div",{className:g,children:"Due habits"}),e.jsx("div",{className:"mt-3 grid gap-2",children:t.snapshot.today.dueHabits.slice(0,i?2:3).map(h=>e.jsxs("div",{className:`${W} flex items-center justify-between gap-3 px-3 py-2.5`,children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:`truncate text-sm font-medium ${v}`,children:h.title}),i?null:e.jsx("div",{className:`text-sm ${u}`,children:h.frequency})]}),e.jsxs(x,{className:"shrink-0 bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_78%,var(--ui-ink-strong)_22%)]",children:[h.rewardXp," xp"]})]},h.id))})]})]})]})})}},{id:"time",title:"Clock",description:"Optional utility widget.",defaultWidth:3,defaultHeight:2,defaultHidden:!0,render:({compact:i})=>e.jsx(Q,{compact:i})},{id:"weather",title:"Weather",description:"Optional utility widget.",defaultWidth:3,defaultHeight:2,defaultHidden:!0,render:({compact:i})=>e.jsx(V,{compact:i})},{id:"mini-calendar",title:"Mini calendar",description:"Optional utility widget.",defaultWidth:4,defaultHeight:3,defaultHidden:!0,render:({compact:i})=>e.jsx(q,{compact:i})},{id:"spotify",title:"Spotify",description:"Optional utility widget.",defaultWidth:4,defaultHeight:2,defaultHidden:!0,render:()=>e.jsx(K,{surfaceId:"today"})},{id:"quick-capture",title:"Quick capture",description:"Save a note or wiki draft without leaving Today.",defaultWidth:5,defaultHeight:3,defaultHidden:!0,render:({compact:i})=>{var n;return e.jsx(G,{compact:i,defaultUserId:t.selectedUserIds[0]??((n=t.snapshot.users[0])==null?void 0:n.id)??null})}}];return e.jsx(z,{surfaceId:"today",baseWidgets:y})}export{Be as TodayPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as m,j as e,du as B,aL as K,bB as W,aH as O,ca as P,br as $,dv as F,bs as V}from"./vendor-BwL6m4SE.js";import{i as G}from"./state-Bpe5dF3T.js";import{C as h,a4 as p,k as N,d as U,S as q,e as Q,e2 as Y}from"./index-FpGANF9S.js";import{e as Z,C as I,X as C,Y as k,T as _,B as y,d as E,a as X,c as D,i as J,P as ee,j as ae,k as ie,f as te}from"./charts-BzT4pUPg.js";import{P as re}from"./page-hero-DvrM83_C.js";import"./motion-DcgUnXhY.js";import"./ui-B9TWEtCx.js";import"./board-CuxQRKPJ.js";import"./forms-D1qJ3oOP.js";function M({height:i,children:a}){const d=m.useRef(null),[n,o]=m.useState(0);return m.useEffect(()=>{const t=d.current;if(!t)return;const u=()=>{o(Math.max(0,Math.floor(t.getBoundingClientRect().width)))};if(u(),typeof ResizeObserver>"u")return window.addEventListener("resize",u),()=>window.removeEventListener("resize",u);const f=new ResizeObserver(u);return f.observe(t),()=>f.disconnect()},[]),e.jsx("div",{ref:d,style:{height:i},className:"min-w-0",children:n>24?a({width:n,height:i}):null})}const T=["below_z1","zone_1","zone_2","zone_3","zone_4","zone_5"],S={below_z1:"Below Z1",zone_1:"Z1",zone_2:"Z2",zone_3:"Z3",zone_4:"Z4",zone_5:"Z5"},se={below_z1:"var(--ui-ink-muted)",zone_1:"var(--info)",zone_2:"var(--success)",zone_3:"var(--warning)",zone_4:"var(--tertiary)",zone_5:"var(--danger)"},w={timeInZone:"Each block totals the minutes Forge can place into adaptive HRR zones from stored heart-rate samples. Weekly is the default planning view because it matches common training microcycles; monthly and daily views help detect longer trends or recent spikes.",smartMode:"Smart modes do not change the underlying data. They change the coaching lens: combat readiness prioritizes hard-day spacing and controlled high intensity, aerobic base prioritizes low-zone development, and endurance pro compares the distribution with pyramidal or polarized endurance planning patterns.",interpretation:"This paragraph explains what the selected mode concludes from the latest load balance, zone distribution, hard-day count, and data confidence. It is a planning summary, not a medical clearance.",drivers:"Drivers are the signals helping the selected mode: examples include enough easy/base work, controlled high-zone share, stable acute/chronic load, or improving data quality.",limiters:"Limiters are the signals that should constrain the next block. If Forge lists a limiter, the next target should usually solve that before adding more hard work.",targets:"Next targets translate the selected mode into a practical week and next workout. The range is intentionally bounded so training can progress without turning every good week into a maximal week."};function ne(i){return i.key==="combat_readiness"?"Combat":i.key==="aerobic_base"?"Base":"Endurance"}function de(i){return i>=82?"signal":i>=65?"default":"meta"}function oe(i){switch(i){case"vo2max_4x4":return"4x4 VO2max";case"zone_2_base":return"Zone 2 / base";case"technical_kickboxing":return"Technical kickboxing";case"easy_aerobic":return"Easy aerobic";case"recovery":return"Recovery";default:return i.replaceAll("_"," ")}}function le(i,a){return a==="daily"?i.bucketKey.slice(5):a==="monthly"?i.bucketKey.slice(2):i.bucketKey.replace(/^20/,"'")}function ce(i,a){const d=a==="daily"?30:12;return i.slice(-d).map(n=>({bucket:le(n,a),total:Math.round(n.durationMinutes),load:n.trainingLoad,confidence:n.confidence,...Object.fromEntries(T.map(o=>[o,n.zoneMinutes[o]??0]))}))}function ue(i,a){return i.zoneTimeSeries[a]}function xe({mode:i}){return e.jsxs("div",{className:"grid gap-3 lg:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-muted)]",children:[e.jsx(W,{className:"size-3.5"}),"Drivers",e.jsx(p,{label:"Explain training drivers",title:"Drivers",content:w.drivers})]}),e.jsx("div",{className:"mt-3 grid gap-2 text-[12px] leading-5 text-[var(--ui-ink-medium)]",children:(i.drivers.length>0?i.drivers:["No positive driver is strong enough yet."]).map(a=>e.jsx("div",{children:a},a))})]}),e.jsxs("div",{className:"rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-muted)]",children:[e.jsx(O,{className:"size-3.5"}),"Limiters",e.jsx(p,{label:"Explain training limiters",title:"Limiters",content:w.limiters})]}),e.jsx("div",{className:"mt-3 grid gap-2 text-[12px] leading-5 text-[var(--ui-ink-medium)]",children:(i.limitingFactors.length>0?i.limitingFactors:["No major limiter in this mode right now."]).map(a=>e.jsx("div",{children:a},a))})]})]})}function me({trainingLoad:i}){const[a,d]=m.useState(i.trainingIntelligence.defaultMode),[n,o]=m.useState("weekly"),t=i.trainingIntelligence.modes.find(r=>r.key===a)??i.trainingIntelligence.modes[0],u=ue(i,n),f=m.useMemo(()=>ce(u,n),[u,n]),L=u.slice(-8).reverse();return t?e.jsxs("section",{className:"grid gap-4 xl:grid-cols-[minmax(0,1.25fr)_minmax(340px,0.75fr)]",children:[e.jsxs(h,{className:"overflow-hidden",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"font-label text-[10px] uppercase tracking-[0.18em] text-[var(--ui-ink-muted)]",children:"Zone intelligence"}),e.jsx(p,{label:"Explain zone intelligence",title:"Time in zone",content:w.timeInZone})]}),e.jsx("div",{className:"mt-2 text-lg text-[var(--ui-ink-strong)]",children:"Time in zone by training block"}),e.jsx("div",{className:"mt-1 max-w-2xl text-[12px] leading-5 text-[var(--ui-ink-muted)]",children:"Weekly by default because most training plans are adjusted week by week. The stacked bars preserve the full zone split, while the table adds load rate, hard days, and data confidence."})]}),e.jsx("div",{className:"grid grid-cols-3 gap-1 rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-1",children:[["weekly","Week"],["monthly","Month"],["daily","90d"]].map(([r,c])=>e.jsx("button",{type:"button",className:`rounded-[6px] px-3 py-1.5 text-[12px] ${n===r?"bg-[var(--ui-surface-2)] text-[var(--ui-ink-strong)]":"text-[var(--ui-ink-muted)]"}`,onClick:()=>o(r),children:c},r))})]}),e.jsx("div",{className:"mt-5",children:e.jsx(M,{height:320,children:({width:r,height:c})=>e.jsxs(Z,{data:f,width:r,height:c,children:[e.jsx(I,{stroke:"var(--ui-border-subtle)",vertical:!1}),e.jsx(C,{dataKey:"bucket",tick:{fill:"var(--ui-ink-muted)",fontSize:10}}),e.jsx(k,{tick:{fill:"var(--ui-ink-muted)",fontSize:10},width:42}),e.jsx(_,{formatter:(v,l)=>[`${Number(v).toFixed(0)} min`,S[l]??String(l)],contentStyle:{background:"var(--ui-surface-modal)",border:"1px solid var(--ui-border-subtle)",borderRadius:8,color:"var(--ui-ink-strong)"}}),T.map(v=>e.jsx(y,{dataKey:v,stackId:"zones",fill:se[v],name:v},v))]})})}),e.jsx("div",{className:"mt-4 grid gap-3 md:hidden",children:L.map(r=>e.jsxs("div",{className:"rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-semibold text-[var(--ui-ink-strong)]",children:r.bucketKey}),e.jsxs("div",{className:"mt-1 text-xs leading-5 text-[var(--ui-ink-muted)]",children:["Load ",r.trainingLoad," · ",r.loadPerMinute," ","TRIMP/min"]})]}),e.jsx(N,{tone:"meta",children:r.confidence})]}),e.jsx("div",{className:"mt-3 grid grid-cols-2 gap-2 text-[12px] min-[360px]:grid-cols-3",children:T.map(c=>e.jsxs("div",{className:"rounded-[8px] bg-[var(--ui-surface-2)] px-2 py-1.5",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-[var(--ui-ink-muted)]",children:S[c]}),e.jsxs("div",{className:"mt-0.5 text-[var(--ui-ink-medium)]",children:[r.zoneMinutes[c]," min"]})]},c))}),e.jsxs("div",{className:"mt-3 text-xs leading-5 text-[var(--ui-ink-muted)]",children:[r.hardDayCount," hard day",r.hardDayCount===1?"":"s"," in this block."]})]},r.bucketKey))}),e.jsxs("div",{className:"mt-4 hidden overflow-x-auto rounded-[8px] border border-[var(--ui-border-subtle)] md:block",children:[e.jsxs("div",{className:"grid min-w-[760px] grid-cols-[96px_72px_72px_repeat(6,64px)_72px_80px] bg-[var(--ui-surface-2)] px-3 py-2 text-[10px] uppercase tracking-[0.14em] text-[var(--ui-ink-muted)]",children:[e.jsx("div",{children:"Block"}),e.jsx("div",{children:"Load"}),e.jsx("div",{children:"TRIMP/min"}),T.map(r=>e.jsx("div",{children:S[r]},r)),e.jsx("div",{children:"Hard"}),e.jsx("div",{children:"Quality"})]}),L.map(r=>e.jsxs("div",{className:"grid min-w-[760px] grid-cols-[96px_72px_72px_repeat(6,64px)_72px_80px] border-t border-[var(--ui-border-subtle)] px-3 py-2 text-[12px] text-[var(--ui-ink-medium)]",children:[e.jsx("div",{className:"text-[var(--ui-ink-strong)]",children:r.bucketKey}),e.jsx("div",{children:r.trainingLoad}),e.jsx("div",{children:r.loadPerMinute}),T.map(c=>e.jsx("div",{children:r.zoneMinutes[c]},c)),e.jsx("div",{children:r.hardDayCount}),e.jsx("div",{children:r.confidence})]},r.bucketKey))]})]}),e.jsxs(h,{className:"overflow-hidden",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"font-label text-[10px] uppercase tracking-[0.18em] text-[var(--ui-ink-muted)]",children:"Smart training mode"}),e.jsx(p,{label:"Explain smart training modes",title:"Training mode",content:w.smartMode})]}),e.jsx("div",{className:"mt-2 text-lg text-[var(--ui-ink-strong)]",children:t.label})]}),e.jsxs(N,{tone:de(t.score),children:[t.score,"/100"]})]}),e.jsx("div",{className:"mt-4 grid grid-cols-3 gap-1 rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-1",children:i.trainingIntelligence.modes.map(r=>e.jsx("button",{type:"button",className:`rounded-[6px] px-2 py-2 text-[12px] ${r.key===t.key?"bg-[var(--ui-surface-2)] text-[var(--ui-ink-strong)]":"text-[var(--ui-ink-muted)]"}`,onClick:()=>d(r.key),children:ne(r)},r.key))}),e.jsxs("div",{className:"mt-4 rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-muted)]",children:[e.jsx(B,{className:"size-3.5"}),"Interpretation",e.jsx(p,{label:"Explain this interpretation",title:"Interpretation",content:w.interpretation})]}),e.jsx("div",{className:"mt-3 text-[13px] leading-5 text-[var(--ui-ink-medium)]",children:t.summary}),e.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2 text-[11px] text-[var(--ui-ink-muted)]",children:[e.jsxs("div",{children:["Balance: ",t.loadBalance.status]}),e.jsxs("div",{children:["Confidence: ",t.confidence]}),e.jsxs("div",{children:["ACWR: ",t.loadBalance.acuteChronicRatio??"n/a"]}),e.jsxs("div",{children:["Baseline:"," ",t.loadBalance.latestWeekBaselineLoadRatio??"n/a","x"]})]})]}),e.jsx("div",{className:"mt-4",children:e.jsx(xe,{mode:t})}),e.jsxs("div",{className:"mt-4 grid gap-3 rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-muted)]",children:[e.jsx(K,{className:"size-3.5"}),"Next targets",e.jsx(p,{label:"Explain next training targets",title:"Next targets",content:w.targets})]}),e.jsxs("div",{className:"grid gap-2 text-[12px] leading-5 text-[var(--ui-ink-medium)]",children:[e.jsxs("div",{children:["Next week: ",t.nextWeekTargets.totalMinutesRange[0],"-",t.nextWeekTargets.totalMinutesRange[1]," min · max"," ",t.nextWeekTargets.maxHardSessions," hard sessions · at least ",t.nextWeekTargets.minimumEasyMinutes," easy/base min."]}),e.jsxs("div",{children:["Next workout:"," ",e.jsx("span",{className:"text-[var(--ui-ink-strong)]",children:oe(t.nextWorkout.recommendedType)})," ","for ",t.nextWorkout.durationMinutesRange[0],"-",t.nextWorkout.durationMinutesRange[1]," min, ceiling"," ",t.nextWorkout.intensityCeiling,"."]}),e.jsx("div",{className:"text-[var(--ui-ink-muted)]",children:t.nextWorkout.reason}),t.nextWeekTargets.warning?e.jsx("div",{className:"rounded-[6px] bg-[var(--ui-warning-soft)] px-2 py-1 text-[color-mix(in_srgb,var(--warning)_78%,var(--ui-ink-strong)_22%)]",children:t.nextWeekTargets.warning}):null]})]})]})]}):null}const he={low:"var(--success)",moderate:"var(--warning)",high:"var(--danger)"},ge={below_z1:"var(--ui-ink-muted)",zone_1:"var(--info)",zone_2:"var(--success)",zone_3:"var(--warning)",zone_4:"var(--tertiary)",zone_5:"var(--danger)"},x={hero:"Forge estimates cardiovascular training stress from stored workouts, heart-rate samples, adaptive heart-rate-reserve zones, and recent vitals. Use this page to decide whether the next training block should build aerobic base, hold load steady, sharpen intensity, or recover. The numbers support coaching decisions; they are not medical diagnosis.",acuteLoad:"Acute load is the last seven days of Forge's TRIMP-like internal load. It rises when workouts are longer, harder, or spend more time in high heart-rate zones. Compare it with chronic load before adding hard sessions.",chronicBase:"Chronic base is the average weekly load over the last 28 days. It is Forge's estimate of the current load you have recently proven you can absorb.",acwr:"ACWR is acute load divided by chronic weekly load. Values near 1.0 usually mean the current week resembles the recent base. High values ask for recovery checks; low values suggest underloading. Treat it as a flag, not a verdict.",vo2max:"VO2max is the latest available wearable estimate in ml/kg/min. Forge shows the recent change when enough points exist, but wearable VO2max can move with device model, terrain, heat, and workout type.",weeklyMap:"This chart combines weekly internal load, training hours, and the share of time in zones 4 and 5. It helps reveal whether fatigue comes from total volume, hard intensity, or both.",adaptationRadar:"The radar compresses six signals into one coach view: current load, base capacity, acute/chronic balance, heart-rate data quality, high-intensity pressure, and VO2max movement.",intensityTarget:"This compares your recent or all-time low, moderate, and high intensity distribution with broad target bands used in endurance and combat-sport conditioning. The target is a planning reference, not a rule.",hrZones:"These bars show minutes in each adaptive HRR zone. Zone 2 is commonly used for aerobic base, zones 4 and 5 for threshold and VO2max work, and below-zone time often reflects warm-up, recovery, or missing cardiovascular load.",dailyTexture:"Daily texture shows whether load spikes are coming from easy volume, threshold work, or high-intensity minutes. It is useful for spacing hard days and avoiding accidental clusters.",sessionSignals:"Recent workout rows expose the session evidence behind the summary: date, activity, training load, high-zone share, heart-rate response, and data confidence.",sportContribution:"Sport contribution groups load by workout type. In kickboxing and other combat sports, wrist heart rate can undercount short striking spikes, so compare this with how the session actually felt."};function A(i,a=0){return i==null||Number.isNaN(i)?"n/a":`${(i*100).toFixed(a)}%`}function b(i,a=0){return i==null||Number.isNaN(i)?"n/a":i.toFixed(a)}function ve(i){switch(i){case"productive":return{label:"Productive",tone:"signal",text:"Acute load is close to the current chronic base."};case"underloaded":return{label:"Underloaded",tone:"meta",text:"The recent week is below the four-week baseline."};case"overload_watch":return{label:"Watch load",tone:"default",text:"Acute load or strain is elevated enough to deserve recovery checks."};default:return{label:"Building signal",tone:"meta",text:"Forge needs more recent training evidence for a cleaner read."}}}function R({label:i,value:a,detail:d,help:n,icon:o}){return e.jsxs(h,{className:"relative min-h-[136px] overflow-hidden",children:[e.jsx("div",{className:"absolute right-3 top-3 rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-2 text-[var(--ui-ink-muted)]",children:e.jsx(o,{className:"size-4"})}),e.jsxs("div",{className:"flex max-w-[80%] items-center gap-1.5",children:[e.jsx("div",{className:"font-label text-[10px] uppercase tracking-[0.18em] text-[var(--ui-ink-muted)]",children:i}),e.jsx(p,{label:`Explain ${i}`,title:i,content:n})]}),e.jsx("div",{className:"mt-4 font-display text-4xl leading-none text-[var(--ui-ink-strong)]",children:a}),e.jsx("div",{className:"mt-3 max-w-[24rem] text-[12px] leading-5 text-[var(--ui-ink-muted)]",children:d})]})}function j({eyebrow:i,title:a,description:d,help:n,action:o}){return e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"font-label text-[10px] uppercase tracking-[0.18em] text-[var(--ui-ink-muted)]",children:i}),e.jsx(p,{label:`Explain ${i}`,title:a,content:n})]}),e.jsx("div",{className:"mt-2 text-lg text-[var(--ui-ink-strong)]",children:a}),d?e.jsx("div",{className:"mt-1 max-w-2xl text-[12px] leading-5 text-[var(--ui-ink-muted)]",children:d}):null]}),o?e.jsx("div",{className:"shrink-0",children:o}):null]})}function pe(i){return i.weeklyLoad.map(a=>({week:a.weekKey.replace(/^20/,"'"),load:a.trainingLoad,hours:a.durationHours,loadPerHour:a.loadPerHour,high:Math.round(a.highPercentage*100),moderate:Math.round(a.moderatePercentage*100),low:Math.round(a.lowPercentage*100)}))}function be(i){return i.dailyLoad.map(a=>({date:a.dateKey.slice(5),load:a.trainingLoad,high:a.highIntensityMinutes,moderate:a.moderateIntensityMinutes,low:a.lowIntensityMinutes}))}function je(i,a){return(a==="recent"?i.recentIntensityDistribution:i.intensityDistribution).map(n=>({...n,percent:Math.round(n.percentage*100),targetLow:Math.round(n.targetRange[0]*100),targetHigh:Math.round(n.targetRange[1]*100),fill:he[n.key]??"var(--ui-ink-medium)"}))}function fe(i,a){return(a==="recent"?i.recentZoneTotals:i.zoneTotals).map(n=>({...n,minutes:Math.round(n.seconds/60),percent:Math.round(n.percentage*100),fill:ge[n.key]??"var(--ui-ink-medium)"}))}function ke(i){const a=i.summary,d=a.acuteChronicRatio==null?45:Math.max(0,Math.min(100,100-Math.abs(a.acuteChronicRatio-1)*80));return[{axis:"Load",value:Math.min(100,a.acuteLoad7d/3)},{axis:"Base",value:Math.min(100,a.chronicWeeklyLoad28d/3)},{axis:"Balance",value:d},{axis:"Quality",value:Math.min(100,a.averageHeartRateCoverage*100)},{axis:"High",value:Math.min(100,a.highIntensityMinutes7d*1.8)},{axis:"VO2",value:a.vo2MaxDelta==null?50:Math.max(0,Math.min(100,50+a.vo2MaxDelta*10))}]}function ye({sessions:i}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid gap-3 md:hidden",children:i.slice(0,20).map(a=>e.jsxs("div",{className:"rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-medium text-[var(--ui-ink-medium)]",children:a.workoutTypeLabel}),e.jsxs("div",{className:"mt-1 text-[11px] text-[var(--ui-ink-muted)]",children:[a.dateKey.slice(5)," ·"," ",b(a.durationMinutes,0),"m ·"," ",a.confidence]})]}),e.jsxs(N,{tone:"meta",children:[b(a.trainingLoad,0)," load"]})]}),e.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2 text-[12px] text-[var(--ui-ink-medium)]",children:[e.jsxs("div",{className:"rounded-[8px] bg-[var(--ui-surface-2)] px-2 py-1.5",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-[0.14em] text-[var(--ui-ink-muted)]",children:"Z4+Z5"}),e.jsx("div",{className:"mt-0.5 text-[var(--ui-ink-strong)]",children:A(a.highIntensityPercentage)})]}),e.jsxs("div",{className:"rounded-[8px] bg-[var(--ui-surface-2)] px-2 py-1.5",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-[0.14em] text-[var(--ui-ink-muted)]",children:"HR"}),e.jsxs("div",{className:"mt-0.5 text-[var(--ui-ink-strong)]",children:[a.averageHr?Math.round(a.averageHr):"n/a",a.maxHr?`/${Math.round(a.maxHr)}`:""]})]})]})]},a.id))}),e.jsxs("div",{className:"hidden overflow-hidden rounded-[8px] border border-[var(--ui-border-subtle)] md:block",children:[e.jsxs("div",{className:"grid grid-cols-[88px_minmax(118px,1fr)_64px_72px_72px] bg-[var(--ui-surface-2)] px-3 py-2 text-[10px] uppercase tracking-[0.16em] text-[var(--ui-ink-muted)]",children:[e.jsx("div",{children:"Date"}),e.jsx("div",{children:"Session"}),e.jsx("div",{children:"Load"}),e.jsx("div",{children:"Z4+Z5"}),e.jsx("div",{children:"HR"})]}),e.jsx("div",{className:"max-h-[370px] overflow-auto",children:i.slice(0,20).map(a=>e.jsxs("div",{className:"grid grid-cols-[88px_minmax(118px,1fr)_64px_72px_72px] border-t border-[var(--ui-border-subtle)] px-3 py-2 text-[12px] text-[var(--ui-ink-medium)]",children:[e.jsx("div",{className:"text-[var(--ui-ink-strong)]/52",children:a.dateKey.slice(5)}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-[var(--ui-ink-medium)]",children:a.workoutTypeLabel}),e.jsxs("div",{className:"mt-0.5 text-[10px] text-[var(--ui-ink-muted)]",children:[b(a.durationMinutes,0),"m ·"," ",a.confidence]})]}),e.jsx("div",{className:"text-[var(--ui-ink-strong)]",children:b(a.trainingLoad,0)}),e.jsx("div",{children:A(a.highIntensityPercentage)}),e.jsxs("div",{children:[a.averageHr?Math.round(a.averageHr):"n/a",a.maxHr?`/${Math.round(a.maxHr)}`:""]})]},a.id))})]})]})}function Ce(){const i=U(),a=Array.isArray(i.selectedUserIds)?i.selectedUserIds:[],[d,n]=m.useState("recent"),o=G({queryKey:["forge-training-load",...a],queryFn:async()=>(await Y(a)).trainingLoad}),t=o.data,u=ve((t==null?void 0:t.summary.readiness)??"insufficient_data"),f=m.useMemo(()=>t?pe(t):[],[t]),L=m.useMemo(()=>t?be(t):[],[t]),r=m.useMemo(()=>t?je(t,d):[],[d,t]),c=m.useMemo(()=>t?fe(t,d):[],[d,t]),v=m.useMemo(()=>t?ke(t):[],[t]);if(o.isLoading)return e.jsx(q,{eyebrow:"Training Load",title:"Loading cardiovascular model",description:"Computing acute load, zone distribution, and target bands from workout evidence.",columns:3,blocks:8});if(o.isError||!t)return e.jsx(Q,{eyebrow:"Training Load",error:o.error??new Error("Training load data unavailable"),onRetry:()=>void o.refetch()});const{summary:l}=t;return e.jsxs("div",{className:"grid gap-5",children:[e.jsx(re,{eyebrow:"Health",entityKind:"habit",title:"Training Load",titleText:"Training Load",description:"Forge estimates cardiovascular training stress from workout duration, heart-rate response, adaptive HRR zones, and recent vitals so you can plan the next training block with clearer load and recovery context.",helpContent:x.hero,badge:`${l.sessionCount} sessions · ${l.reliableSessionCount} high-resolution`,actions:e.jsx(N,{tone:u.tone,children:u.label})}),e.jsxs("section",{className:"grid gap-4 lg:grid-cols-4",children:[R({label:"Acute load",value:b(l.acuteLoad7d,0),detail:`Last 7 days of internal load. ${u.text}`,help:x.acuteLoad,icon:$}),R({label:"Chronic base",value:b(l.chronicWeeklyLoad28d,0),detail:"Average weekly load across the last 28 days.",help:x.chronicBase,icon:F}),R({label:"ACWR",value:b(l.acuteChronicRatio,2),detail:"Acute load divided by chronic weekly load. Useful as a flag, not a verdict.",help:x.acwr,icon:W}),R({label:"VO2 max",value:l.vo2MaxLatest?b(l.vo2MaxLatest,1):"n/a",detail:l.vo2MaxDelta==null?"No delta available yet.":`${l.vo2MaxDelta>=0?"+":""}${l.vo2MaxDelta} since the first recent point.`,help:x.vo2max,icon:V})]}),e.jsx(me,{trainingLoad:t}),e.jsxs("section",{className:"grid gap-4 xl:grid-cols-[minmax(0,1.35fr)_minmax(320px,0.65fr)]",children:[e.jsxs(h,{className:"overflow-hidden",children:[e.jsx(j,{eyebrow:"Weekly load map",title:"Load, hours, and high-intensity share over the last 26 weeks.",description:"Load estimates internal stress; hours show volume; the red line shows how much of each week landed in zones 4 and 5.",help:x.weeklyMap,action:e.jsx(N,{tone:"meta",children:"TRIMP · HRR zones"})}),e.jsx("div",{className:"mt-5",children:e.jsx(M,{height:340,children:({width:s,height:g})=>e.jsxs(E,{data:f,width:s,height:g,children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"trainingLoadFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"var(--info)",stopOpacity:.38}),e.jsx("stop",{offset:"100%",stopColor:"var(--info)",stopOpacity:.04})]})}),e.jsx(I,{stroke:"var(--ui-border-subtle)",vertical:!1}),e.jsx(C,{dataKey:"week",tick:{fill:"var(--ui-ink-muted)",fontSize:10}}),e.jsx(k,{yAxisId:"load",tick:{fill:"var(--ui-ink-muted)",fontSize:10},width:42}),e.jsx(k,{yAxisId:"pct",orientation:"right",domain:[0,100],tick:{fill:"var(--ui-ink-muted)",fontSize:10},width:38}),e.jsx(_,{contentStyle:{background:"var(--ui-surface-modal)",border:"1px solid var(--ui-border-subtle)",borderRadius:8,color:"var(--ui-ink-strong)"}}),e.jsx(X,{yAxisId:"load",type:"monotone",dataKey:"load",name:"Training load",stroke:"var(--info)",fill:"url(#trainingLoadFill)",strokeWidth:2}),e.jsx(y,{yAxisId:"load",dataKey:"hours",name:"Hours",fill:"var(--primary)",radius:[3,3,0,0]}),e.jsx(D,{yAxisId:"pct",type:"monotone",dataKey:"high",name:"Z4+Z5 %",stroke:"var(--danger)",strokeWidth:2.4,dot:{r:2}})]})})})]}),e.jsxs(h,{className:"overflow-hidden",children:[e.jsx(j,{eyebrow:"Adaptation radar",title:"Current signal balance",description:"A compact coach view of load, base, balance, data quality, high-intensity pressure, and VO2max movement.",help:x.adaptationRadar}),e.jsx("div",{className:"mt-4",children:e.jsx(M,{height:300,children:({width:s,height:g})=>e.jsxs(J,{data:v,width:s,height:g,children:[e.jsx(ee,{stroke:"var(--ui-border-subtle)"}),e.jsx(ae,{dataKey:"axis",tick:{fill:"var(--ui-ink-muted)",fontSize:10}}),e.jsx(ie,{dataKey:"value",stroke:"var(--success)",fill:"var(--success)",fillOpacity:.24}),e.jsx(_,{contentStyle:{background:"var(--ui-surface-modal)",border:"1px solid var(--ui-border-subtle)",borderRadius:8,color:"var(--ui-ink-strong)"}})]})})})]})]}),e.jsxs("section",{className:"grid gap-4 xl:grid-cols-[minmax(0,0.8fr)_minmax(0,1.2fr)]",children:[e.jsxs(h,{children:[e.jsx(j,{eyebrow:"Intensity target",title:"Distribution vs target bands",description:"Compare the selected time window with broad low, moderate, and high intensity bands.",help:x.intensityTarget,action:e.jsx("div",{className:"grid grid-cols-2 gap-1 rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-1",children:[["recent","28d"],["all","All"]].map(([s,g])=>e.jsx("button",{type:"button",className:`rounded-[6px] px-3 py-1.5 text-[12px] ${d===s?"bg-[var(--ui-surface-2)] text-[var(--ui-ink-strong)]":"text-[var(--ui-ink-muted)]"}`,onClick:()=>n(s),children:g},s))})}),e.jsx("div",{className:"mt-4 grid gap-3",children:r.map(s=>e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 text-[12px]",children:[e.jsx("span",{className:"text-[var(--ui-ink-medium)]",children:s.label}),e.jsxs("span",{className:"text-[var(--ui-ink-strong)]",children:[s.percent,"% · target ",s.targetLow,"-",s.targetHigh,"%"]})]}),e.jsxs("div",{className:"relative h-3 overflow-hidden rounded-full bg-[var(--ui-surface-2)]",children:[e.jsx("div",{className:"absolute inset-y-0 rounded-full bg-[var(--ui-surface-2)]",style:{left:`${s.targetLow}%`,width:`${Math.max(2,s.targetHigh-s.targetLow)}%`}}),e.jsx("div",{className:"relative h-full rounded-full",style:{width:`${Math.max(1,s.percent)}%`,background:s.fill}})]})]},s.key))}),e.jsx("div",{className:"mt-5 grid gap-2 rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-3 text-[12px] leading-5 text-[var(--ui-ink-muted)]",children:t.targetModel.monitoringNotes.map(s=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(K,{className:"mt-0.5 size-3.5 shrink-0 text-[var(--primary)]"}),e.jsx("span",{children:s})]},s))})]}),e.jsxs(h,{children:[e.jsx(j,{eyebrow:"HR zones",title:`Detailed zone distribution for ${d==="recent"?"the last 28 days":"all available sessions"}.`,help:x.hrZones}),e.jsx("div",{className:"mt-4",children:e.jsx(M,{height:290,children:({width:s,height:g})=>e.jsxs(Z,{data:c,width:s,height:g,children:[e.jsx(I,{stroke:"var(--ui-border-subtle)",vertical:!1}),e.jsx(C,{dataKey:"label",interval:0,tick:{fill:"var(--ui-ink-muted)",fontSize:10}}),e.jsx(k,{tick:{fill:"var(--ui-ink-muted)",fontSize:10},width:38}),e.jsx(_,{formatter:(z,H)=>[H==="minutes"?`${z} min`:`${z}%`,H],contentStyle:{background:"var(--ui-surface-modal)",border:"1px solid var(--ui-border-subtle)",borderRadius:8,color:"var(--ui-ink-strong)"}}),e.jsx(y,{dataKey:"minutes",name:"minutes",radius:[4,4,0,0],children:c.map(z=>e.jsx(te,{fill:z.fill},z.key))})]})})})]})]}),e.jsxs("section",{className:"grid gap-4 xl:grid-cols-[minmax(0,1fr)_420px]",children:[e.jsxs(h,{children:[e.jsx(j,{eyebrow:"Daily load texture",title:"Easy, threshold, and high-intensity minutes against daily load.",help:x.dailyTexture}),e.jsx("div",{className:"mt-4",children:e.jsx(M,{height:310,children:({width:s,height:g})=>e.jsxs(E,{data:L,width:s,height:g,children:[e.jsx(I,{stroke:"var(--ui-border-subtle)",vertical:!1}),e.jsx(C,{dataKey:"date",tick:{fill:"var(--ui-ink-muted)",fontSize:10}}),e.jsx(k,{yAxisId:"minutes",tick:{fill:"var(--ui-ink-muted)",fontSize:10},width:38}),e.jsx(k,{yAxisId:"load",orientation:"right",tick:{fill:"var(--ui-ink-muted)",fontSize:10},width:38}),e.jsx(_,{contentStyle:{background:"var(--ui-surface-modal)",border:"1px solid var(--ui-border-subtle)",borderRadius:8,color:"var(--ui-ink-strong)"}}),e.jsx(y,{yAxisId:"minutes",dataKey:"low",stackId:"zones",fill:"var(--success)",name:"low min"}),e.jsx(y,{yAxisId:"minutes",dataKey:"moderate",stackId:"zones",fill:"var(--warning)",name:"threshold min"}),e.jsx(y,{yAxisId:"minutes",dataKey:"high",stackId:"zones",fill:"var(--danger)",name:"high min"}),e.jsx(D,{yAxisId:"load",type:"monotone",dataKey:"load",stroke:"var(--info)",strokeWidth:2.2,dot:!1})]})})})]}),e.jsxs(h,{children:[e.jsx(j,{eyebrow:"Session signals",title:"Recent workouts",help:x.sessionSignals,action:e.jsxs(N,{tone:"meta",children:[l.hardDayCount7d," hard days / 7d"]})}),e.jsx("div",{className:"mt-4",children:e.jsx(ye,{sessions:t.sessionSignals})})]})]}),e.jsxs("section",{className:"grid gap-4 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]",children:[e.jsxs(h,{children:[e.jsx(j,{eyebrow:"Sport contribution",title:"Load by workout type",help:x.sportContribution}),e.jsx("div",{className:"mt-3 grid gap-3",children:t.activityBreakdown.slice(0,8).map(s=>e.jsxs("div",{className:"grid gap-2 rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-3 sm:grid-cols-[minmax(0,1fr)_76px_76px_76px]",children:[e.jsxs("div",{children:[e.jsx("div",{className:"truncate text-sm text-[var(--ui-ink-strong)]",children:s.workoutTypeLabel}),e.jsxs("div",{className:"mt-1 text-[11px] text-[var(--ui-ink-muted)]",children:[s.sessionCount," sessions ·"," ",s.activityFamilyLabel]})]}),e.jsxs("div",{className:"text-[12px] text-[var(--ui-ink-medium)]",children:[e.jsxs("span",{className:"block text-[var(--ui-ink-strong)]",children:[s.durationHours,"h"]}),"volume"]}),e.jsxs("div",{className:"text-[12px] text-[var(--ui-ink-medium)]",children:[e.jsx("span",{className:"block text-[var(--ui-ink-strong)]",children:s.trainingLoad}),"load"]}),e.jsxs("div",{className:"text-[12px] text-[var(--ui-ink-medium)]",children:[e.jsx("span",{className:"block text-[var(--ui-ink-strong)]",children:A(s.highPercentage)}),"high"]})]},s.workoutType))})]}),e.jsxs(h,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(P,{className:"size-4 text-[color-mix(in_srgb,var(--warning)_78%,var(--ui-ink-strong)_22%)]"}),e.jsx("div",{className:"font-label text-[10px] uppercase tracking-[0.18em] text-[var(--ui-ink-muted)]",children:"Interpretation guardrails"})]}),e.jsxs("div",{className:"mt-4 grid gap-3 text-[12px] leading-5 text-[var(--ui-ink-muted)]",children:[e.jsx("p",{children:"Forge is estimating training stress from heart-rate reserve zones and a TRIMP-like load. This is good for trend decisions, but it is not a substitute for lactate testing, gas exchange thresholds, or coach-led periodization."}),e.jsx("p",{children:"Combat sports add sensor noise: wrist HR can miss short spikes during punching and clinch work. Treat high-intensity minutes as minimum evidence when the session had a lot of arm motion."}),e.jsx("p",{children:"The practical target is not maximum Z5. Keep hard combat sessions meaningful, then add easy aerobic base when the high-intensity share is already high."})]})]})]})]})}export{Ce as TrainingLoadPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b6 as Se,c6 as Ee,bY as We,r as c,j as e,b7 as Pe,cs as O,aG as ie,cB as Re,cG as ze,c1 as Ke,bX as $e,aC as le,aK as ce,bG as Le,cv as qe}from"./vendor-BwL6m4SE.js";import{R as de,P as ue,O as pe,C as me,T as xe,a as ge,D as Te}from"./ui-B9TWEtCx.js";import{j as Ue,i as K,k as Fe}from"./state-Bpe5dF3T.js";import{d as Be,W as De,a_ as Oe,L as D,e as ne,h as Me,b as oe,V as Qe,B as T,c as w,c8 as Je,I as _e,k as Ae,ek as He,bn as Ge,el as Ye,em as Ve,en as Xe,eo as Ze}from"./index-FpGANF9S.js";import{O as es}from"./open-in-graph-button-4UYrp1XP.js";import{W as ss}from"./wiki-article-markdown-DBccllQg.js";import{W as ts}from"./wiki-ingest-modal-DnlhByD_.js";import"./motion-DcgUnXhY.js";import"./board-CuxQRKPJ.js";import"./forms-D1qJ3oOP.js";function rs(a){return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",year:"numeric"}).format(new Date(a))}function as(a){return a.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function he({nodes:a,activeSlug:i,spaceId:u,depth:n=0}){return e.jsx("ul",{className:w("grid gap-1",n>0&&"mt-1"),children:a.map(d=>e.jsx(is,{node:d,activeSlug:i,spaceId:u,depth:n},d.page.id))})}function fe(a,i){return i?a.page.slug===i?!0:a.children.some(u=>fe(u,i)):!1}function is({node:a,activeSlug:i,spaceId:u,depth:n}){const d=a.children.length>0,f=a.page.slug===i,x=fe(a,i),[l,b]=c.useState(d&&(n===0||x));return c.useEffect(()=>{x&&b(!0)},[x]),e.jsxs("li",{className:"grid gap-1",children:[e.jsxs("div",{className:"flex items-start gap-1",children:[d?e.jsx("button",{type:"button",className:w("mt-1 inline-flex size-5 shrink-0 items-center justify-center rounded-md text-[var(--ui-ink-faint)] transition hover:bg-[var(--ui-surface-1)] hover:text-[var(--ui-ink-strong)]",n>0&&"size-4"),style:{marginLeft:`${n*.7}rem`},"aria-label":l?`Collapse ${a.page.title}`:`Expand ${a.page.title}`,"aria-expanded":l,onClick:()=>b(N=>!N),children:l?e.jsx(O,{className:"size-3.5"}):e.jsx(qe,{className:"size-3.5"})}):e.jsx("span",{className:"mt-1 size-5 shrink-0",style:{marginLeft:`${n*.7}rem`}}),e.jsx(le,{to:{pathname:a.page.slug==="index"?"/wiki":`/wiki/page/${encodeURIComponent(a.page.slug)}`,search:`?spaceId=${encodeURIComponent(u)}`},className:w("min-w-0 flex-1 rounded-lg px-2 py-1.5 text-[12px] leading-5 transition",f?"bg-[var(--ui-surface-2)] text-[var(--ui-ink-strong)]":"text-[var(--ui-ink-soft)] hover:bg-[var(--ui-surface-1)] hover:text-[var(--ui-ink-strong)]"),children:e.jsx("span",{className:"line-clamp-2",children:a.page.title})})]}),d&&l?e.jsx(he,{nodes:a.children,activeSlug:i,spaceId:u,depth:n+1}):null]})}function ns({open:a,onOpenChange:i,spaces:u,activeSpaceId:n,onSelect:d}){var x;const f=((x=u.find(l=>l.visibility==="shared"))==null?void 0:x.id)??"";return e.jsx(de,{open:a,onOpenChange:i,children:e.jsxs(ue,{children:[e.jsx(pe,{className:"fixed inset-0 z-50 surface-overlay backdrop-blur-sm"}),e.jsxs(me,{className:"fixed left-1/2 top-[14vh] z-50 w-[min(28rem,calc(100vw-1.5rem))] -translate-x-1/2 rounded-[28px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-popover)] p-4 shadow-[var(--ui-shadow-floating)] sm:p-5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(xe,{className:"font-display text-[1.2rem] tracking-[-0.04em] text-[var(--ui-ink-strong)]",children:"Choose KarpaWiki space"}),e.jsx(Te,{className:"mt-1 text-[13px] leading-6 text-[var(--ui-ink-soft)]",children:"Switch the reading space without leaving the article surface."})]}),e.jsx(ge,{asChild:!0,children:e.jsx("button",{type:"button",className:"rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-2 text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-2)] hover:text-[var(--ui-ink-strong)]","aria-label":"Close space picker",children:e.jsx(ce,{className:"size-4"})})})]}),e.jsx("div",{className:"mt-4 grid gap-2",children:u.map(l=>{const b=l.id===n,N=l.id===f;return e.jsxs("button",{type:"button",className:w("flex items-center justify-between gap-3 rounded-[22px] border px-4 py-3 text-left transition",b?"border-[color-mix(in_srgb,var(--primary)_26%,transparent)] bg-[var(--ui-accent-soft)] text-[var(--ui-ink-strong)]":"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)] hover:bg-[var(--ui-surface-2)] hover:text-[var(--ui-ink-strong)]"),onClick:()=>{d(l.id),i(!1)},children:[e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block text-[14px] font-semibold text-inherit",children:l.label}),e.jsx("span",{className:"mt-1 block text-[12px] leading-5 text-[var(--ui-ink-soft)]",children:l.description||`/${l.slug}`}),N?e.jsx("span",{className:"mt-2 inline-flex rounded-full bg-amber-200/90 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.14em] text-stone-950",children:"Recovered pages"}):null]}),b?e.jsx(Le,{className:"size-4 shrink-0 text-[var(--primary)]"}):null]},l.id)})})]})]})})}function fs(){var H,G,Y,V,X,Z,ee,se,te,re;const a=Be(),i=Se(),u=Ue(),{slug:n}=Ee(),[d,f]=We(),[x,l]=c.useState(!1),[b,N]=c.useState(!1),[U,E]=c.useState(!1),[v,be]=c.useState("hybrid"),[W,ve]=c.useState(""),[P,M]=c.useState(""),Q=c.useRef(null),F=d.get("spaceId")??"",ke=d.get("ingest")==="1",J=d.get("ingestJobId"),p=K({queryKey:["forge-wiki-settings"],queryFn:Ge}),t=F||((G=(H=p.data)==null?void 0:H.settings.spaces[0])==null?void 0:G.id)||"",R=((Y=p.data)==null?void 0:Y.settings.embeddingProfiles.filter(s=>s.enabled))??[];c.useEffect(()=>{var s;!P&&((s=R[0])!=null&&s.id)&&M(R[0].id)},[R,P]),c.useEffect(()=>{var s,o;if(!F&&((o=(s=p.data)==null?void 0:s.settings.spaces[0])!=null&&o.id)){const g=new URLSearchParams(d);g.set("spaceId",p.data.settings.spaces[0].id),f(g,{replace:!0})}},[d,F,f,p.data]);const I=K({queryKey:["forge-wiki-home",t],queryFn:()=>Ye({spaceId:t||void 0}),enabled:!!t&&!n}),h=K({queryKey:["forge-wiki-page-by-slug",t,n],queryFn:()=>Ve({slug:n??"index",spaceId:t||void 0}),enabled:!!t&&!!n}),z=K({queryKey:["forge-wiki-tree",t],queryFn:()=>Xe({spaceId:t||void 0,kind:"wiki"}),enabled:!!t}),C=K({queryKey:["forge-wiki-modal-search",t,v,W,P],queryFn:()=>Ze({spaceId:t||void 0,mode:v,query:W.trim(),profileId:(v==="semantic"||v==="hybrid")&&P||void 0,limit:30}),enabled:x&&!!t&&W.trim().length>0}),$=n?h.data??null:I.data??null,[ye,je]=c.useState(null);c.useEffect(()=>{$&&je($)},[$]);const L=!!t&&(n?h.isFetching:I.isFetching),k=$??(L?ye:null),r=(k==null?void 0:k.page)??null,m=((V=p.data)==null?void 0:V.settings.spaces.find(s=>s.id===t))??null,y=((X=p.data)==null?void 0:X.settings.spaces.find(s=>s.visibility==="shared"))??null,we=!!y&&!!m&&(m==null?void 0:m.id)!==(y==null?void 0:y.id)&&(m==null?void 0:m.visibility)==="personal",q=(r==null?void 0:r.slug)!=="index",j=n&&h.error instanceof De&&h.error.status===404?n.trim():null;c.useEffect(()=>{if(!t||!j)return;const s=new URLSearchParams;s.set("spaceId",t),s.set("title",j);const o=as(j);o&&s.set("slug",o),i(`/wiki/new?${s.toString()}`,{replace:!0})},[t,j,i]);const _=c.useMemo(()=>((r==null?void 0:r.links)??[]).map(s=>({id:`${s.entityType}:${s.entityId}`,href:Oe(s.entityType,s.entityId),label:`${s.entityType} · ${s.entityId}`})),[r==null?void 0:r.links]),S=Fe({mutationFn:async s=>He(s),onSuccess:async()=>{await Promise.all([u.invalidateQueries({queryKey:["forge-wiki-tree"]}),u.invalidateQueries({queryKey:["forge-wiki-home"]}),u.invalidateQueries({queryKey:["forge-wiki-page-by-slug"]}),u.invalidateQueries({queryKey:["forge-wiki-modal-search"]})]),i(`/wiki${t?`?spaceId=${encodeURIComponent(t)}`:""}`)}}),B=(s,o=!1)=>{const g=new URLSearchParams(d);s(g),f(g,{replace:o})},A=s=>{B(o=>{o.set("ingest","1"),s?o.set("ingestJobId",s):o.delete("ingestJobId"),t&&o.set("spaceId",t)})},Ne=()=>{B(s=>{s.delete("ingest"),s.delete("ingestJobId")})},Ie=s=>{B(o=>{o.set("ingest","1"),s?o.set("ingestJobId",s):o.delete("ingestJobId"),t&&o.set("spaceId",t)})},Ce=()=>{!r||!q||S.isPending||!window.confirm(`Delete KarpaWiki page "${r.title}"? You can restore it later from the bin.`)||S.mutateAsync(r.id)};return c.useEffect(()=>{if(!U)return;const s=g=>{var ae;(ae=Q.current)!=null&&ae.contains(g.target)||E(!1)},o=g=>{g.key==="Escape"&&E(!1)};return document.addEventListener("pointerdown",s),document.addEventListener("keydown",o),()=>{document.removeEventListener("pointerdown",s),document.removeEventListener("keydown",o)}},[U]),!r&&(p.isLoading||z.isLoading||!n&&I.isLoading||n&&h.isLoading)?e.jsx(D,{eyebrow:"KarpaWiki",title:"Loading the article",description:"Preparing the current space, article, and KarpaWiki index."}):!r&&!j&&(p.isError||I.isError||h.isError||z.isError)?e.jsx(ne,{eyebrow:"KarpaWiki",error:p.error??I.error??h.error??z.error,onRetry:()=>{p.refetch(),I.refetch(),h.refetch(),z.refetch()}}):r?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 py-4 sm:px-5 lg:px-6",children:e.jsxs("div",{className:"mx-auto flex w-full max-w-[1680px] flex-col gap-4",children:[e.jsxs("section",{className:"wiki-frame px-3 py-3 sm:px-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(oe,{kind:"wiki_page",label:"KarpaWiki page",compact:!0,gradient:!1}),m?e.jsx(oe,{kind:"wiki_space",label:m.label,compact:!0,gradient:!1,wrap:!0,className:"max-w-[20rem]"}):null,e.jsx("span",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:rs(r.updatedAt)}),e.jsx(Qe,{metrics:a.snapshot.metrics,className:"ml-auto"})]}),e.jsxs("div",{className:"mt-3 flex flex-col gap-2 lg:flex-row lg:items-center",children:[e.jsxs("button",{type:"button",className:"wiki-search-launch flex min-h-[2.9rem] w-full items-center gap-3 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 text-left text-[14px] text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-2)] hover:text-[var(--ui-ink-strong)] lg:flex-1",onClick:()=>l(!0),children:[e.jsx(Pe,{className:"size-4 shrink-0 text-[var(--ui-ink-faint)]"}),e.jsx("span",{children:"Search KarpaWiki"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 lg:shrink-0",children:[e.jsxs("button",{type:"button",className:"wiki-space-trigger inline-flex min-h-[2.9rem] items-center gap-2 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 text-[13px] font-medium text-[var(--ui-ink-medium)] transition hover:bg-[var(--ui-surface-2)] hover:text-[var(--ui-ink-strong)]",onClick:()=>N(!0),children:[e.jsx("span",{className:"text-[11px] uppercase tracking-[0.14em] text-[var(--ui-ink-faint)]",children:"Space"}),e.jsx("span",{className:"max-w-[16rem] truncate",children:(m==null?void 0:m.label)??"KarpaWiki space"}),e.jsx(O,{className:"size-3.5 text-[var(--ui-ink-faint)]"})]}),e.jsxs("div",{className:"relative",ref:Q,children:[e.jsxs(T,{variant:"secondary",size:"sm",className:"min-h-[2.9rem]",onClick:()=>E(s=>!s),children:[e.jsx(ie,{className:"size-3.5"}),"Ingest",e.jsx(O,{className:"size-3.5"})]}),U?e.jsxs("div",{className:"absolute right-0 top-[calc(100%+0.5rem)] z-20 grid min-w-[15rem] gap-2 rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-popover)] p-2 shadow-[var(--ui-shadow-floating)]",children:[e.jsxs("button",{type:"button",className:"flex items-start gap-3 rounded-[18px] px-3 py-3 text-left transition hover:bg-[var(--ui-surface-2)]",onClick:()=>{E(!1),A()},children:[e.jsx(ie,{className:"mt-0.5 size-4 shrink-0 text-[var(--primary)]"}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-sm font-medium text-[var(--ui-ink-strong)]",children:"New ingest"}),e.jsx("span",{className:"mt-1 block text-xs leading-5 text-[var(--ui-ink-faint)]",children:"Start a fresh import from files, URLs, or pasted text."})]})]}),e.jsxs("button",{type:"button",className:"flex items-start gap-3 rounded-[18px] px-3 py-3 text-left transition hover:bg-[var(--ui-surface-2)]",onClick:()=>{E(!1),i(`/wiki/ingest-history${t?`?spaceId=${encodeURIComponent(t)}`:""}`)},children:[e.jsx(Re,{className:"mt-0.5 size-4 shrink-0 text-[var(--secondary)]"}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-sm font-medium text-[var(--ui-ink-strong)]",children:"History"}),e.jsx("span",{className:"mt-1 block text-xs leading-5 text-[var(--ui-ink-faint)]",children:"Browse prior ingests, reopen reviews, and delete old ingest records."})]})]})]}):null]}),e.jsxs(T,{variant:"secondary",size:"sm",className:"min-h-[2.9rem]",onClick:()=>i(`/wiki/edit/${encodeURIComponent(r.id)}?spaceId=${encodeURIComponent(t)}`,{state:{initialPage:r}}),children:[e.jsx(ze,{className:"size-3.5"}),"Edit"]}),e.jsx(es,{entityType:"note",entityId:r.id,label:"Open in graph",size:"sm"}),e.jsxs(T,{variant:"secondary",size:"sm",className:w("min-h-[2.9rem] border border-rose-400/18 bg-rose-500/10 text-rose-100 hover:bg-rose-500/18",!q&&"opacity-60"),onClick:Ce,pending:S.isPending,pendingLabel:"Deleting",disabled:!q,title:q?"Delete this KarpaWiki page":"The KarpaWiki home page cannot be deleted",children:[e.jsx(Ke,{className:"size-3.5"}),"Delete"]}),e.jsxs(T,{size:"sm",className:"min-h-[2.9rem]",onClick:()=>i(`/wiki/new?spaceId=${encodeURIComponent(t)}`),children:[e.jsx($e,{className:"size-3.5"}),"New page"]})]})]}),we&&y?e.jsxs("div",{className:"mt-3 flex flex-col gap-3 rounded-[22px] border border-amber-300/20 bg-amber-300/[0.08] px-4 py-3 text-[13px] leading-6 text-amber-50 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("span",{children:["You are viewing the personal starter wiki. The recovered people, story, and conversation pages are in"," ",e.jsx("strong",{children:y.label}),"."]}),e.jsx("button",{type:"button",className:"inline-flex min-h-10 shrink-0 items-center justify-center rounded-2xl bg-amber-200 px-4 text-[12px] font-semibold uppercase tracking-[0.14em] text-stone-950 transition hover:bg-amber-100",onClick:()=>{i({pathname:"/wiki",search:`?spaceId=${encodeURIComponent(y.id)}`})},children:"Open shared memory"})]}):null]}),e.jsxs("section",{className:"grid gap-4 lg:grid-cols-[15rem_minmax(0,1fr)] xl:grid-cols-[16rem_minmax(0,1fr)]",children:[e.jsxs("aside",{className:"wiki-frame h-fit px-2 py-3 sm:px-3 lg:sticky lg:top-[5.75rem]",children:[e.jsx("div",{className:"px-2 pb-2 text-[11px] font-semibold uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Index"}),e.jsx(he,{nodes:((Z=z.data)==null?void 0:Z.tree)??[],activeSlug:r.slug,spaceId:t})]}),e.jsxs("article",{"aria-busy":L,className:w("wiki-frame relative overflow-hidden px-4 py-5 transition-[opacity,transform] duration-200 sm:px-6 sm:py-6",L&&"opacity-[0.985]"),children:[L?e.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 h-px bg-[color-mix(in_srgb,var(--primary)_70%,transparent)] opacity-90"}):null,e.jsxs("div",{className:"wiki-reading-copy wiki-reading-flow mx-auto max-w-[76rem]",children:[S.isError?e.jsx("div",{className:"mb-4 rounded-[18px] border border-rose-400/20 bg-rose-500/10 px-4 py-3 text-sm text-rose-100",children:S.error instanceof Error?S.error.message:"Forge could not delete this KarpaWiki page."}):null,e.jsx(ss,{markdown:r.contentMarkdown,spaceId:t}),r.summary.trim()?e.jsx("p",{className:"mt-5 border-t border-[var(--ui-border-subtle)] pt-4 text-[13px] leading-6 text-[var(--ui-ink-soft)]",children:r.summary}):null,_.length>0?e.jsxs("section",{className:"mt-8 border-t border-[var(--ui-border-subtle)] pt-4",children:[e.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Forge links"}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:_.map(s=>e.jsx("a",{href:s.href?Je(s.href):void 0,className:"rounded-full bg-[var(--ui-surface-2)] px-3 py-1.5 text-[12px] text-[var(--ui-ink-medium)] transition hover:bg-[var(--ui-surface-3)] hover:text-[var(--ui-ink-strong)]",children:s.label},s.id))})]}):null,k!=null&&k.backlinkSourceNotes.length?e.jsxs("section",{className:"mt-8 border-t border-[var(--ui-border-subtle)] pt-4",children:[e.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Linked here"}),e.jsx("div",{className:"mt-3 grid gap-2 sm:grid-cols-2",children:k.backlinkSourceNotes.map(s=>e.jsxs(le,{to:{pathname:s.slug==="index"?"/wiki":`/wiki/page/${encodeURIComponent(s.slug)}`,search:`?spaceId=${encodeURIComponent(s.spaceId)}`},className:"rounded-xl border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-3 transition hover:bg-[var(--ui-surface-2)]",children:[e.jsx("div",{className:"text-[13px] font-semibold text-[var(--ui-ink-strong)]",children:s.title}),s.summary?e.jsx("div",{className:"mt-1 text-[12px] leading-5 text-[var(--ui-ink-soft)]",children:s.summary}):null]},s.id))})]}):null]})]})]})]})}),e.jsx(de,{open:x,onOpenChange:l,children:e.jsxs(ue,{children:[e.jsx(pe,{className:"fixed inset-0 z-50 surface-overlay backdrop-blur-sm"}),e.jsxs(me,{className:"fixed left-1/2 top-[8vh] z-50 w-[min(54rem,calc(100vw-1.5rem))] -translate-x-1/2 rounded-[28px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-popover)] p-4 shadow-[var(--ui-shadow-floating)] sm:p-5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsx("div",{children:e.jsx(xe,{className:"font-display text-[1.35rem] tracking-[-0.04em] text-[var(--ui-ink-strong)]",children:"Search the wiki"})}),e.jsx(ge,{asChild:!0,children:e.jsx("button",{type:"button",className:"rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-2 text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-2)] hover:text-[var(--ui-ink-strong)]","aria-label":"Close search",children:e.jsx(ce,{className:"size-4"})})})]}),e.jsxs("div",{className:"mt-4 grid gap-3",children:[e.jsx(_e,{autoFocus:!0,value:W,onChange:s=>ve(s.target.value),placeholder:"Search KarpaWiki pages",className:"h-11 rounded-2xl border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[14px] text-[var(--ui-ink-strong)] placeholder:text-[var(--ui-ink-faint)]"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[["text","hybrid","semantic","entity"].map(s=>e.jsx("button",{type:"button",className:w("rounded-full px-3 py-1.5 text-[12px] font-medium uppercase tracking-[0.14em] transition",v===s?"bg-[var(--ui-surface-3)] text-[var(--ui-ink-strong)]":"bg-[var(--ui-surface-1)] text-[var(--ui-ink-soft)] hover:bg-[var(--ui-surface-2)] hover:text-[var(--ui-ink-strong)]"),onClick:()=>be(s),children:s},s)),(v==="semantic"||v==="hybrid")&&R.length>0?e.jsx("select",{className:"ml-auto rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-1.5 text-[12px] text-[var(--ui-ink-strong)]",value:P,onChange:s=>M(s.target.value),children:R.map(s=>e.jsx("option",{value:s.id,children:s.label},s.id))}):null]})]}),e.jsx("div",{className:"mt-4 max-h-[60vh] overflow-y-auto",children:W.trim()?C.isLoading?e.jsx(D,{eyebrow:"KarpaWiki search",title:"Searching",description:"Ranking matching pages for this query."}):C.isError?e.jsx(ne,{eyebrow:"KarpaWiki search",error:C.error,onRetry:()=>void C.refetch()}):(ee=C.data)!=null&&ee.results.length?e.jsx("div",{className:"grid gap-2",children:C.data.results.map(s=>e.jsx("button",{type:"button",className:"rounded-2xl border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-3 text-left transition hover:bg-[var(--ui-surface-2)]",onClick:()=>{l(!1),i({pathname:s.page.slug==="index"?"/wiki":`/wiki/page/${encodeURIComponent(s.page.slug)}`,search:`?spaceId=${encodeURIComponent(s.page.spaceId)}`})},children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[14px] font-semibold text-[var(--ui-ink-strong)]",children:s.page.title}),s.page.summary?e.jsx("div",{className:"mt-1 text-[12px] leading-5 text-[var(--ui-ink-soft)]",children:s.page.summary}):null]}),e.jsx(Ae,{size:"sm",tone:"meta",children:s.score.toFixed(2)})]})},s.page.id))}):e.jsx("div",{className:"rounded-2xl border border-dashed border-[var(--ui-border-subtle)] px-4 py-10 text-center text-[13px] leading-6 text-[var(--ui-ink-faint)]",children:"No pages matched this search."}):e.jsx("div",{className:"rounded-2xl border border-dashed border-[var(--ui-border-subtle)] px-4 py-10 text-center text-[13px] leading-6 text-[var(--ui-ink-faint)]",children:"Start typing to search the current KarpaWiki space."})})]})]})}),e.jsx(ns,{open:b,onOpenChange:N,spaces:((se=p.data)==null?void 0:se.settings.spaces)??[],activeSpaceId:t,onSelect:s=>{i({pathname:"/wiki",search:`?spaceId=${encodeURIComponent(s)}`},{replace:!0})}}),e.jsx(ts,{open:ke,onOpenChange:s=>{if(s){A(J);return}Ne()},spaces:((te=p.data)==null?void 0:te.settings.spaces)??[],llmProfiles:((re=p.data)==null?void 0:re.settings.llmProfiles)??[],initialSpaceId:t,selectedJobId:J,onJobSelected:Ie,linkedEntityHints:r.links.map(s=>({entityType:s.entityType,entityId:s.entityId,anchorKey:null}))??[]})]}):j?e.jsx(D,{eyebrow:"KarpaWiki",title:"Opening a new page",description:`Creating a draft for ${j}.`}):e.jsx(Me,{eyebrow:"KarpaWiki",title:"Article not found",description:"This page does not exist in the selected space."})}export{fs as WikiPage};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/maps-BTVHALP8.js","assets/vendor-BwL6m4SE.js","assets/vendor-CRS-psbw.css","assets/maps-B-YMMjus.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{S as B,e as D,k as j,C as c,T as H,I as P,B as E,e3 as I,e1 as K,e4 as W}from"./index-FpGANF9S.js";import{c6 as Q,r as h,j as e,aC as O,cL as q,bs as Z,bB as Y,dw as G,cm as U}from"./vendor-BwL6m4SE.js";import{j as V,i as X,k as J}from"./state-Bpe5dF3T.js";import"./maps-BTVHALP8.js";import{P as ee}from"./page-hero-DvrM83_C.js";import{R as C,A as te,C as ae,X as T,Y as _,T as z,a as se,e as ie,B as re}from"./charts-BzT4pUPg.js";import"./motion-DcgUnXhY.js";import"./ui-B9TWEtCx.js";import"./board-CuxQRKPJ.js";import"./forms-D1qJ3oOP.js";const A={below_z1:"#94a3b8",zone_1:"#38bdf8",zone_2:"#22c55e",zone_3:"#eab308",zone_4:"#f97316",zone_5:"#ef4444"};function k(t){return t?`${Math.round(t/60)}m`:"0m"}function F(t,s){const o=new Intl.DateTimeFormat(void 0,{weekday:"short",day:"numeric",month:"short"}),n=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit"});return`${o.format(new Date(t))} · ${n.format(new Date(t))} - ${n.format(new Date(s))}`}function $(t){const s=typeof t=="number"?Math.floor(t):Number.parseFloat(String(t??""));return Number.isFinite(s)?new Date(s).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):""}function ne(t,s){if(typeof t=="number"){const o=Number.isInteger(t)?String(t):t.toFixed(1);return s&&s!=="count"?`${o} ${s}`:o}return typeof t=="boolean"?t?"Yes":"No":t==null?"n/a":String(t)}function oe(t){return t.length===0?null:{minLat:Math.min(...t.map(s=>s.latitude)),maxLat:Math.max(...t.map(s=>s.latitude)),minLon:Math.min(...t.map(s=>s.longitude)),maxLon:Math.max(...t.map(s=>s.longitude))}}function le({points:t}){var g;const s=h.useRef(null),[o,n]=h.useState(!1),u=typeof window<"u"?((g=window.localStorage.getItem("forge.map.tile-url"))==null?void 0:g.trim())??"":"";h.useEffect(()=>{let x=!1,i=null;if(!u||!s.current||t.length<2){n(!1);return}return I(()=>import("./maps-BTVHALP8.js").then(r=>r.m),__vite__mapDeps([0,1,2,3])).then(r=>{x||!s.current||(i=new r.Map({container:s.current,style:{version:8,sources:{tiles:{type:"raster",tiles:[u],tileSize:256}},layers:[{id:"tiles",type:"raster",source:"tiles"}]},center:[t[0].longitude,t[0].latitude],zoom:13,attributionControl:!1}),i.on("load",()=>{if(!i)return;const d=t.map(m=>[m.longitude,m.latitude]);i.addSource("route",{type:"geojson",data:{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:d}}}),i.addLayer({id:"route",type:"line",source:"route",paint:{"line-color":"#f97316","line-width":4}});const f=d.reduce((m,p)=>m.extend(p),new r.LngLatBounds(d[0],d[0]));i.fitBounds(f,{padding:44,maxZoom:15}),n(!0)}))}),()=>{x=!0,i==null||i.remove()}},[t,u]);const l=oe(t),v=h.useMemo(()=>{if(!l||t.length<2)return"";const x=720,i=280,r=Math.max(1e-6,l.maxLon-l.minLon),d=Math.max(1e-6,l.maxLat-l.minLat);return t.map(f=>{const m=(f.longitude-l.minLon)/r*x,p=i-(f.latitude-l.minLat)/d*i;return`${m.toFixed(1)},${p.toFixed(1)}`}).join(" ")},[l,t]);return e.jsxs("div",{className:"relative min-h-[280px] overflow-hidden rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)]",children:[e.jsx("div",{ref:s,className:"absolute inset-0"}),o?null:e.jsxs("svg",{viewBox:"0 0 720 280",className:"absolute inset-0 h-full w-full",children:[e.jsx("rect",{width:"720",height:"280",fill:"var(--ui-surface-1)"}),v?e.jsx("polyline",{points:v,fill:"none",stroke:"#f97316",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round"}):null]}),e.jsx("div",{className:"absolute left-3 top-3 max-w-[calc(100%-1.5rem)] rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--surface-glass)] px-3 py-2 text-xs text-[var(--ui-ink-medium)] backdrop-blur",children:u?"Local-first map tiles configured":"No tile source configured; showing private route shape only"})]})}function de({zones:t}){return e.jsx("div",{className:"grid gap-3",children:t.map(s=>e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 text-sm",children:[e.jsx("span",{className:"min-w-0 break-words text-[var(--ui-ink-medium)] [overflow-wrap:anywhere]",children:s.label}),e.jsxs("span",{className:"shrink-0 text-[var(--ui-ink-strong)]",children:[(s.percentage*100).toFixed(1),"% · ",k(s.seconds)]})]}),e.jsx("div",{className:"h-2 overflow-hidden rounded-full bg-[var(--ui-surface-2)]",children:e.jsx("div",{className:"h-full rounded-full",style:{width:`${Math.max(1,s.percentage*100)}%`,background:A[s.key]??"#f8fafc"}})})]},s.key))})}function we(){var p,y,N,b,S,L,R,M;const{workoutId:t=""}=Q(),s=V(),o=X({queryKey:["workout-detail",t],queryFn:()=>W(t),enabled:t.length>0}),n=o.data,[u,l]=h.useState(""),[v,g]=h.useState("");h.useEffect(()=>{n!=null&&n.workout&&(l(n.workout.meaningText??""),g(n.workout.tags.join(", ")))},[n==null?void 0:n.workout]);const x=J({mutationFn:()=>K(t,{meaningText:u,tags:v.split(",").map(a=>a.trim()).filter(Boolean)}),onSuccess:async()=>{await s.invalidateQueries({queryKey:["workout-detail",t]}),await s.invalidateQueries({queryKey:["forge-fitness"]})}});if(o.isLoading)return e.jsx(B,{title:"Loading workout"});if(o.isError||!n)return e.jsx(D,{eyebrow:"Workout detail",error:o.error??new Error("Forge could not load this workout detail."),onRetry:()=>void o.refetch()});const{workout:i,analytics:r,evidence:d}=n,f=d.timeSeries.filter(a=>a.metricKey==="heart_rate").map((a,w)=>({time:Date.parse(a.startedAt)+w/1e3,bpm:a.value})),m=r.zoneDurations.map(a=>({zone:a.label,minutes:Math.round(a.seconds/60),fill:A[a.key]??"#f8fafc"}));return e.jsxs("div",{className:"grid gap-6",children:[e.jsxs(O,{to:"/sports",className:"inline-flex w-fit items-center gap-2 text-sm text-[var(--ui-ink-soft)] transition hover:text-[var(--ui-ink-strong)]",children:[e.jsx(q,{className:"size-4"}),"Back to sports"]}),e.jsx(ee,{eyebrow:"Workout evidence",title:i.workoutTypeLabel??i.workoutType,description:`${F(i.startedAt,i.endedAt)} · ${i.sourceDevice||"Apple Health"}`,actions:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(j,{children:k(i.durationSeconds)}),e.jsxs(j,{tone:"meta",children:[r.confidence," HR zones"]}),(p=r.routeSummary)!=null&&p.hasRoute?e.jsxs(j,{tone:"meta",children:[r.routeSummary.pointCount," route points"]}):null]})}),e.jsxs("section",{className:"grid gap-4 lg:grid-cols-4",children:[e.jsxs(c,{children:[e.jsx("div",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Avg HR"}),e.jsx("div",{className:"mt-3 font-display text-4xl text-[var(--ui-ink-strong)]",children:r.hrSummary.averageHr??i.averageHeartRate??"n/a"}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-faint)]",children:"bpm"})]}),e.jsxs(c,{children:[e.jsx("div",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Max HR"}),e.jsx("div",{className:"mt-3 font-display text-4xl text-[var(--ui-ink-strong)]",children:r.hrSummary.maxHr??i.maxHeartRate??"n/a"}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-faint)]",children:"bpm"})]}),e.jsxs(c,{children:[e.jsx("div",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Training load"}),e.jsx("div",{className:"mt-3 font-display text-4xl text-[var(--ui-ink-strong)]",children:r.load.trimp??"n/a"}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-faint)]",children:"Forge TRIMP"})]}),e.jsxs(c,{children:[e.jsx("div",{className:"text-sm text-[var(--ui-ink-soft)]",children:"HR coverage"}),e.jsxs("div",{className:"mt-3 font-display text-4xl text-[var(--ui-ink-strong)]",children:[Math.round((r.dataQuality.sampleCoverage??0)*100),"%"]}),e.jsxs("div",{className:"mt-1 text-sm text-[var(--ui-ink-faint)]",children:[r.dataQuality.heartRateSampleCount??0," samples"]})]})]}),e.jsxs("section",{className:"grid min-w-0 gap-4 xl:grid-cols-[minmax(0,1.25fr)_minmax(280px,0.75fr)]",children:[e.jsxs(c,{className:"min-h-[360px] min-w-0 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[var(--ui-ink-strong)]",children:[e.jsx(Z,{className:"size-4 text-[var(--primary)]"}),"Heart-rate timeline"]}),e.jsx("div",{className:"mt-4 h-[300px]",children:f.length>0?e.jsx(C,{width:"100%",height:"100%",children:e.jsxs(te,{data:f,children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"hrFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#ef4444",stopOpacity:.38}),e.jsx("stop",{offset:"100%",stopColor:"#ef4444",stopOpacity:.04})]})}),e.jsx(ae,{stroke:"var(--ui-border-subtle)",vertical:!1}),e.jsx(T,{dataKey:"time",interval:"preserveStartEnd",tick:{fill:"var(--ui-ink-soft)",fontSize:11},tickFormatter:$,type:"number",domain:["dataMin","dataMax"]}),e.jsx(_,{tick:{fill:"var(--ui-ink-soft)",fontSize:11},width:42}),e.jsx(z,{labelFormatter:$,contentStyle:{background:"var(--surface-glass)",border:"1px solid var(--ui-border-subtle)",borderRadius:8,color:"var(--ui-ink-strong)"}}),e.jsx(se,{type:"monotone",dataKey:"bpm",stroke:"#ef4444",fill:"url(#hrFill)",strokeWidth:2,dot:!1})]})}):e.jsx("div",{className:"grid h-full place-items-center rounded-[8px] bg-[var(--ui-surface-1)] text-sm text-[var(--ui-ink-soft)]",children:"No raw HR timeline has been synced for this workout yet."})})]}),e.jsxs(c,{className:"min-w-0 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[var(--ui-ink-strong)]",children:[e.jsx(Y,{className:"size-4 text-[var(--primary)]"}),"Zone mix"]}),e.jsx("div",{className:"mt-4",children:e.jsx(de,{zones:r.zoneDurations})}),e.jsx("div",{className:"mt-5 h-[180px]",children:e.jsx(C,{width:"100%",height:"100%",children:e.jsxs(ie,{data:m,children:[e.jsx(T,{dataKey:"zone",tick:{fill:"var(--ui-ink-soft)",fontSize:10}}),e.jsx(_,{tick:{fill:"var(--ui-ink-soft)",fontSize:10},width:34}),e.jsx(z,{contentStyle:{background:"var(--surface-glass)",border:"1px solid var(--ui-border-subtle)",borderRadius:8,color:"var(--ui-ink-strong)"}}),e.jsx(re,{dataKey:"minutes",radius:[4,4,0,0]})]})})})]})]}),e.jsxs("section",{className:"grid min-w-0 gap-4 xl:grid-cols-[minmax(0,1fr)_360px]",children:[e.jsxs(c,{className:"min-w-0 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[var(--ui-ink-strong)]",children:[e.jsx(G,{className:"size-4 text-[var(--primary)]"}),"Route"]}),e.jsx("div",{className:"mt-4",children:d.routePoints.length>1?e.jsx(le,{points:d.routePoints}):e.jsx("div",{className:"grid min-h-[240px] place-items-center rounded-[8px] bg-[var(--ui-surface-1)] text-sm text-[var(--ui-ink-soft)]",children:"No route evidence is available for this workout."})})]}),e.jsxs(c,{className:"min-w-0 overflow-hidden",children:[e.jsx("div",{className:"text-[var(--ui-ink-strong)]",children:"Captured metrics"}),e.jsx("div",{className:"mt-4 grid gap-3",children:(((y=i.details)==null?void 0:y.metrics)??[]).slice(0,14).map(a=>e.jsxs("div",{className:"min-w-0 rounded-[8px] bg-[var(--ui-surface-1)] px-3 py-2",children:[e.jsx("div",{className:"break-words text-sm text-[var(--ui-ink-soft)] [overflow-wrap:anywhere]",children:a.label}),e.jsx("div",{className:"mt-1 break-words text-[var(--ui-ink-strong)] [overflow-wrap:anywhere]",children:ne(a.value,a.unit)})]},`${a.category}:${a.key}:${a.statistic}`))})]})]}),e.jsxs("section",{className:"grid min-w-0 gap-4 lg:grid-cols-[minmax(0,1fr)_minmax(280px,0.7fr)]",children:[e.jsxs(c,{className:"min-w-0 overflow-hidden",children:[e.jsx("div",{className:"text-[var(--ui-ink-strong)]",children:"Events and phases"}),e.jsxs("div",{className:"mt-4 grid gap-3",children:[[...((N=i.details)==null?void 0:N.events)??[],...((b=i.details)==null?void 0:b.components)??[]].slice(0,18).map((a,w)=>e.jsxs("div",{className:"min-w-0 rounded-[8px] bg-[var(--ui-surface-1)] px-4 py-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("div",{className:"min-w-0 break-words text-[var(--ui-ink-strong)] [overflow-wrap:anywhere]",children:"label"in a?a.label:a.activity.canonicalLabel}),e.jsx(j,{tone:"meta",children:k(a.durationSeconds)})]}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:F(a.startedAt,a.endedAt??a.startedAt)})]},`${"type"in a?a.type:a.externalUid}:${a.startedAt}:${w}`)),(((L=(S=i.details)==null?void 0:S.events)==null?void 0:L.length)??0)+(((M=(R=i.details)==null?void 0:R.components)==null?void 0:M.length)??0)===0?e.jsx("div",{className:"rounded-[8px] bg-[var(--ui-surface-1)] p-4 text-sm text-[var(--ui-ink-soft)]",children:"No provider events or phases were captured."}):null]})]}),e.jsxs(c,{className:"min-w-0 overflow-hidden",children:[e.jsx("div",{className:"text-[var(--ui-ink-strong)]",children:"Reflection"}),e.jsxs("div",{className:"mt-4 grid gap-4",children:[e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Meaning and impact"}),e.jsx(H,{className:"min-h-[160px]",value:u,onChange:a=>l(a.target.value)})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Tags"}),e.jsx(P,{value:v,onChange:a=>g(a.target.value)})]}),e.jsxs(E,{type:"button",pending:x.isPending,pendingLabel:"Saving",onClick:()=>x.mutate(),children:[e.jsx(U,{className:"size-4"}),"Save reflection"]})]})]})]})]})}export{we as WorkoutDetailPage};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/server/{server → apps/api}/migrations/016_strategy_contracts_and_user_graph.sql
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/server/{server → apps/api}/migrations/037_workbench_public_inputs_and_run_inputs.sql
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/server/{server → apps/api}/migrations/053_agent_runtime_session_canonical_labels.sql
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|