forge-openclaw-plugin 0.2.99 → 0.2.100

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/dist/assets/activity-copy-Bj4h9OcF.js +1 -0
  2. package/dist/assets/activity-page-5oyCFOns.js +1 -0
  3. package/dist/assets/ai-surface-workspace-qgk_B57-.js +1 -0
  4. package/dist/assets/atlas-panel-rfH2qOez.js +1 -0
  5. package/dist/assets/{board-Ju0h0SeG.js → board-BkDRaMp6.js} +1 -1
  6. package/dist/assets/calendar-display-preferences-Cid-2RnL.js +1 -0
  7. package/dist/assets/calendar-page-Bo2iua-a.js +1 -0
  8. package/dist/assets/calendar-rules-DA1g3QUk.js +1 -0
  9. package/dist/assets/calendar-ui-Cy1XRwzV.js +1 -0
  10. package/dist/assets/calendar-week-toolbar-DU1Q4RYj.js +1 -0
  11. package/dist/assets/charts-P7EVhIog.js +36 -0
  12. package/dist/assets/companion-sync-lab-page-CosNknOK.js +1 -0
  13. package/dist/assets/daily-metrics-dashboard-LjuGAB3f.js +1 -0
  14. package/dist/assets/date-keys-Cj1G3TOn.js +1 -0
  15. package/dist/assets/entity-links-DwpxhW2H.js +1 -0
  16. package/dist/assets/entity-note-count-link-BmGDB572.js +1 -0
  17. package/dist/assets/entity-notes-surface-DgEgicaE.js +1 -0
  18. package/dist/assets/execution-board-CDRXQB85.js +1 -0
  19. package/dist/assets/faceted-token-search-CE1YauRd.js +1 -0
  20. package/dist/assets/flagship-signal-deck-DDds90Gl.js +1 -0
  21. package/dist/assets/floating-action-menu-CJkI2iFy.js +1 -0
  22. package/dist/assets/forms-BFlTgZ3W.js +1 -0
  23. package/dist/assets/goal-detail-page-cJvHaLMQ.js +1 -0
  24. package/dist/assets/goals-page-f_39hvUV.js +1 -0
  25. package/dist/assets/graph-BZV40eAE.css +1 -0
  26. package/dist/assets/graph-D6JLqDbD.js +318 -0
  27. package/dist/assets/habits-page-DKb96_mj.js +1 -0
  28. package/dist/assets/health-link-options-Cpx8w7uM.js +1 -0
  29. package/dist/assets/index-BHTUu_4M.js +19 -0
  30. package/dist/assets/index-CZbuZQjw.css +1 -0
  31. package/dist/assets/insight-flow-dialog-pzAzyayN.js +1 -0
  32. package/dist/assets/insights-page-Dc9oFltJ.js +8 -0
  33. package/dist/assets/kanban-page-JAxerYh6.js +1 -0
  34. package/dist/assets/knowledge-graph-page-UQ3skqEi.js +1 -0
  35. package/dist/assets/life-force-page-BGDbQuVh.js +1 -0
  36. package/dist/assets/life-force-workspace-B1fYSXRC.js +1 -0
  37. package/dist/assets/maps-B-YMMjus.css +1 -0
  38. package/dist/assets/maps-ClgJoCjz.js +803 -0
  39. package/dist/assets/metric-tile-DX6TclqM.js +1 -0
  40. package/dist/assets/{motion-DRPJkN3a.js → motion-BeD44FeG.js} +1 -1
  41. package/dist/assets/movement-page-6HP6nGJx.js +1 -0
  42. package/dist/assets/note-markdown-DiW2-5d3.js +3 -0
  43. package/dist/assets/note-tags-input-DDLXf54U.js +1 -0
  44. package/dist/assets/notes-page-BuguDjhz.js +1 -0
  45. package/dist/assets/open-in-graph-button-Cg5VrKsC.js +1 -0
  46. package/dist/assets/orbit-map-GD05-0oS.js +1 -0
  47. package/dist/assets/overview-page-DuOs2OCB.js +1 -0
  48. package/dist/assets/page-hero-CQWo1Mm_.js +1 -0
  49. package/dist/assets/pill-cluster-BJogDRDJ.js +1 -0
  50. package/dist/assets/preference-entity-handoff-button-D4WAs9pC.js +1 -0
  51. package/dist/assets/preferences-page-BaJTMU1I.js +1 -0
  52. package/dist/assets/project-collections-DvaX20q_.js +1 -0
  53. package/dist/assets/project-detail-page-drPIFZGb.js +1 -0
  54. package/dist/assets/project-management-hierarchy-page-BUbRXvny.js +1 -0
  55. package/dist/assets/project-management-section-nav-C2Ud8Zdd.js +1 -0
  56. package/dist/assets/projects-page-BGzEZUtg.js +1 -0
  57. package/dist/assets/psyche-behaviors-page-Dmm_Io9D.js +5 -0
  58. package/dist/assets/psyche-flashcards-page-BgNKJ6QJ.js +1 -0
  59. package/dist/assets/psyche-goal-map-page-DXJs98Vr.js +1 -0
  60. package/dist/assets/psyche-graph-CFgs_Bqc.js +1 -0
  61. package/dist/assets/psyche-metrics-page-zYTJDbyZ.js +1 -0
  62. package/dist/assets/psyche-mode-guide-page-XPgRfCOf.js +1 -0
  63. package/dist/assets/psyche-modes-page-B-GA8oRF.js +1 -0
  64. package/dist/assets/psyche-page--r6a3e1t.js +1 -0
  65. package/dist/assets/psyche-patterns-page-BM5-3bMm.js +5 -0
  66. package/dist/assets/psyche-questionnaire-builder-page-CJshQ-mg.js +1 -0
  67. package/dist/assets/psyche-questionnaire-detail-page-USmR5G5A.js +1 -0
  68. package/dist/assets/psyche-questionnaire-run-detail-page-D7iBCmTi.js +1 -0
  69. package/dist/assets/psyche-questionnaire-run-page-Cpil-kDh.js +1 -0
  70. package/dist/assets/psyche-questionnaires-page-C-_y3VwS.js +1 -0
  71. package/dist/assets/psyche-report-detail-page--dkSPRaj.js +3 -0
  72. package/dist/assets/psyche-reports-page-CUaOXmIN.js +1 -0
  73. package/dist/assets/psyche-schemas-HFmg37Wj.js +1 -0
  74. package/dist/assets/psyche-schemas-beliefs-page-BX6xaap3.js +9 -0
  75. package/dist/assets/psyche-screen-time-page-CAAI4mD7.js +1 -0
  76. package/dist/assets/psyche-self-observation-page-BZ6FLuwa.js +1 -0
  77. package/dist/assets/psyche-values-page-yEV6MGt8.js +5 -0
  78. package/dist/assets/query-cache-IQ8W-LNC.js +1 -0
  79. package/dist/assets/report-chain-fields-fZ8Xd4H6.js +1 -0
  80. package/dist/assets/rewards-page-C2HQjIAf.js +1 -0
  81. package/dist/assets/scheduling-rules-editor-BHOpHOrV.js +1 -0
  82. package/dist/assets/schema-badge-DyKbxb51.js +1 -0
  83. package/dist/assets/schema-visuals-D6nxjbYC.js +1 -0
  84. package/dist/assets/select-menu-BX-pZNqL.js +1 -0
  85. package/dist/assets/settings-agents-page-VuYXTiyc.js +6 -0
  86. package/dist/assets/settings-bin-page-BNzvYaOk.js +1 -0
  87. package/dist/assets/settings-calendar-page-CjSFB53S.js +5 -0
  88. package/dist/assets/settings-data-page-CGSlryuI.js +1 -0
  89. package/dist/assets/settings-logs-page-BTK5fine.js +1 -0
  90. package/dist/assets/settings-mobile-page-CRaObOGo.js +1 -0
  91. package/dist/assets/settings-models-page-DFshpYF8.js +1 -0
  92. package/dist/assets/settings-page-BP81Mb5R.js +1 -0
  93. package/dist/assets/settings-rewards-page-CDJ1PH2G.js +1 -0
  94. package/dist/assets/settings-section-nav-CCFm27r2.js +1 -0
  95. package/dist/assets/settings-users-page-TdUocFPa.js +1 -0
  96. package/dist/assets/settings-wiki-page-B2zX0QQG.js +1 -0
  97. package/dist/assets/sleep-page-cI1GMVzk.js +1 -0
  98. package/dist/assets/sports-page-06LTqp0V.js +1 -0
  99. package/dist/assets/state-B-4sS1xO.js +1 -0
  100. package/dist/assets/strategies-page-DXP9Kx8s.js +1 -0
  101. package/dist/assets/strategy-detail-page-D6mx_Mik.js +1 -0
  102. package/dist/assets/strategy-dialog-BvzomTaF.js +1 -0
  103. package/dist/assets/{table-DewbFlTh.js → table-WfAPUppN.js} +1 -1
  104. package/dist/assets/task-detail-page-BIWIggdp.js +1 -0
  105. package/dist/assets/timebox-planning-dialog-CaCnoslG.js +1 -0
  106. package/dist/assets/today-page-DO2mRPT2.js +1 -0
  107. package/dist/assets/training-load-page-CyZ0mlEr.js +1 -0
  108. package/dist/assets/{ui-C2IvSrAz.js → ui-C13Nbgas.js} +4 -4
  109. package/dist/assets/use-psyche-focus-target-C1C_XjYG.js +1 -0
  110. package/dist/assets/vendor-CRS-psbw.css +1 -0
  111. package/dist/assets/vendor-DHkYh85p.js +1052 -0
  112. package/dist/assets/vitals-page-BQvEjTc6.js +1 -0
  113. package/dist/assets/weekly-review-page-Tp6Q9CRj.js +1 -0
  114. package/dist/assets/weight-loss-page-BBzlhLVV.js +1 -0
  115. package/dist/assets/wiki-article-markdown-DQYohmW2.js +4 -0
  116. package/dist/assets/wiki-editor-page-Dem_3eZv.js +26 -0
  117. package/dist/assets/wiki-ingest-history-page-BxoOcCoJ.js +1 -0
  118. package/dist/assets/wiki-ingest-modal-DhguKk3J.js +1 -0
  119. package/dist/assets/wiki-page-BLRxVXkl.js +1 -0
  120. package/dist/assets/workbench-flow-page-DqMkCCTy.js +5 -0
  121. package/dist/assets/workbench-page-BWd02wPw.js +1 -0
  122. package/dist/assets/workout-detail-page-BD8u7GyL.js +2 -0
  123. package/dist/index.html +148 -9
  124. package/dist/openclaw/tools.js +340 -0
  125. package/dist/server/server/migrations/065_weight_loss_nutrition_insights.sql +236 -0
  126. package/dist/server/server/migrations/066_watch_action_receipts.sql +20 -0
  127. package/dist/server/server/src/app.js +266 -13
  128. package/dist/server/server/src/health-weight-loss.js +1378 -0
  129. package/dist/server/server/src/health.js +188 -35
  130. package/dist/server/server/src/openapi.js +449 -0
  131. package/dist/server/server/src/services/context.js +6 -7
  132. package/dist/server/server/src/services/doctor.js +39 -4
  133. package/dist/server/server/src/services/gamification.js +146 -34
  134. package/dist/server/server/src/watch-mobile.js +564 -4
  135. package/dist/server/server/src/web.js +18 -5
  136. package/dist/server/src/components/ui/info-tooltip.js +48 -3
  137. package/dist/server/src/lib/api.js +131 -0
  138. package/dist/server/src/lib/weight-loss-types.js +1 -0
  139. package/openclaw.plugin.json +14 -1
  140. package/package.json +1 -1
  141. package/server/migrations/065_weight_loss_nutrition_insights.sql +236 -0
  142. package/server/migrations/066_watch_action_receipts.sql +20 -0
  143. package/skills/forge-openclaw/SKILL.md +26 -5
  144. package/skills/forge-openclaw/entity_conversation_playbooks.md +134 -5
  145. package/skills/forge-openclaw/psyche_entity_playbooks.md +45 -0
  146. package/dist/assets/index-Cn5Wpwau.css +0 -1
  147. package/dist/assets/index-CwvGs8n4.js +0 -91
  148. package/dist/assets/vendor-B-Lq_OG3.css +0 -1
  149. package/dist/assets/vendor-DL2K5ayT.js +0 -2186
@@ -0,0 +1,19 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/activity-page-5oyCFOns.js","assets/vendor-DHkYh85p.js","assets/vendor-CRS-psbw.css","assets/state-B-4sS1xO.js","assets/page-hero-CQWo1Mm_.js","assets/table-WfAPUppN.js","assets/entity-links-DwpxhW2H.js","assets/board-BkDRaMp6.js","assets/ui-C13Nbgas.js","assets/motion-BeD44FeG.js","assets/forms-BFlTgZ3W.js","assets/graph-D6JLqDbD.js","assets/graph-BZV40eAE.css","assets/calendar-page-Bo2iua-a.js","assets/calendar-week-toolbar-DU1Q4RYj.js","assets/calendar-ui-Cy1XRwzV.js","assets/timebox-planning-dialog-CaCnoslG.js","assets/scheduling-rules-editor-BHOpHOrV.js","assets/floating-action-menu-CJkI2iFy.js","assets/calendar-display-preferences-Cid-2RnL.js","assets/companion-sync-lab-page-CosNknOK.js","assets/goal-detail-page-cJvHaLMQ.js","assets/open-in-graph-button-Cg5VrKsC.js","assets/note-markdown-DiW2-5d3.js","assets/entity-notes-surface-DgEgicaE.js","assets/note-tags-input-DDLXf54U.js","assets/preference-entity-handoff-button-D4WAs9pC.js","assets/project-collections-DvaX20q_.js","assets/activity-copy-Bj4h9OcF.js","assets/goals-page-f_39hvUV.js","assets/entity-note-count-link-BmGDB572.js","assets/pill-cluster-BJogDRDJ.js","assets/habits-page-DKb96_mj.js","assets/use-psyche-focus-target-C1C_XjYG.js","assets/select-menu-BX-pZNqL.js","assets/date-keys-Cj1G3TOn.js","assets/insights-page-Dc9oFltJ.js","assets/insight-flow-dialog-pzAzyayN.js","assets/charts-P7EVhIog.js","assets/kanban-page-JAxerYh6.js","assets/execution-board-CDRXQB85.js","assets/project-management-section-nav-C2Ud8Zdd.js","assets/knowledge-graph-page-UQ3skqEi.js","assets/faceted-token-search-CE1YauRd.js","assets/life-force-page-BGDbQuVh.js","assets/life-force-workspace-B1fYSXRC.js","assets/movement-page-6HP6nGJx.js","assets/notes-page-BuguDjhz.js","assets/overview-page-DuOs2OCB.js","assets/ai-surface-workspace-qgk_B57-.js","assets/flagship-signal-deck-DDds90Gl.js","assets/project-detail-page-drPIFZGb.js","assets/calendar-rules-DA1g3QUk.js","assets/project-management-hierarchy-page-BUbRXvny.js","assets/projects-page-BGzEZUtg.js","assets/settings-wiki-page-B2zX0QQG.js","assets/settings-section-nav-CCFm27r2.js","assets/strategies-page-DXP9Kx8s.js","assets/strategy-dialog-BvzomTaF.js","assets/strategy-detail-page-D6mx_Mik.js","assets/preferences-page-BaJTMU1I.js","assets/psyche-page--r6a3e1t.js","assets/psyche-graph-CFgs_Bqc.js","assets/psyche-behaviors-page-Dmm_Io9D.js","assets/atlas-panel-rfH2qOez.js","assets/schema-badge-DyKbxb51.js","assets/schema-visuals-D6nxjbYC.js","assets/query-cache-IQ8W-LNC.js","assets/psyche-schemas-HFmg37Wj.js","assets/psyche-flashcards-page-BgNKJ6QJ.js","assets/psyche-goal-map-page-DXJs98Vr.js","assets/psyche-metrics-page-zYTJDbyZ.js","assets/daily-metrics-dashboard-LjuGAB3f.js","assets/psyche-mode-guide-page-XPgRfCOf.js","assets/psyche-modes-page-B-GA8oRF.js","assets/psyche-patterns-page-BM5-3bMm.js","assets/orbit-map-GD05-0oS.js","assets/psyche-questionnaire-builder-page-CJshQ-mg.js","assets/psyche-questionnaire-detail-page-USmR5G5A.js","assets/psyche-questionnaire-run-detail-page-D7iBCmTi.js","assets/psyche-questionnaire-run-page-Cpil-kDh.js","assets/psyche-questionnaires-page-C-_y3VwS.js","assets/psyche-report-detail-page--dkSPRaj.js","assets/report-chain-fields-fZ8Xd4H6.js","assets/psyche-reports-page-CUaOXmIN.js","assets/psyche-self-observation-page-BZ6FLuwa.js","assets/psyche-screen-time-page-CAAI4mD7.js","assets/psyche-schemas-beliefs-page-BX6xaap3.js","assets/psyche-values-page-yEV6MGt8.js","assets/settings-page-BP81Mb5R.js","assets/settings-data-page-CGSlryuI.js","assets/metric-tile-DX6TclqM.js","assets/settings-agents-page-VuYXTiyc.js","assets/settings-bin-page-BNzvYaOk.js","assets/settings-calendar-page-CjSFB53S.js","assets/settings-mobile-page-CRaObOGo.js","assets/settings-models-page-DFshpYF8.js","assets/settings-logs-page-BTK5fine.js","assets/settings-rewards-page-CDJ1PH2G.js","assets/settings-users-page-TdUocFPa.js","assets/rewards-page-C2HQjIAf.js","assets/sleep-page-cI1GMVzk.js","assets/health-link-options-Cpx8w7uM.js","assets/sports-page-06LTqp0V.js","assets/training-load-page-CyZ0mlEr.js","assets/workout-detail-page-BD8u7GyL.js","assets/maps-ClgJoCjz.js","assets/maps-B-YMMjus.css","assets/task-detail-page-BIWIggdp.js","assets/today-page-DO2mRPT2.js","assets/vitals-page-BQvEjTc6.js","assets/weight-loss-page-BBzlhLVV.js","assets/wiki-page-BLRxVXkl.js","assets/wiki-article-markdown-DQYohmW2.js","assets/wiki-ingest-modal-DhguKk3J.js","assets/wiki-ingest-history-page-BxoOcCoJ.js","assets/wiki-editor-page-Dem_3eZv.js","assets/weekly-review-page-Tp6Q9CRj.js","assets/workbench-page-BWd02wPw.js","assets/workbench-flow-page-DqMkCCTy.js"])))=>i.map(i=>d[i]);
2
+ var Go=Object.defineProperty;var Vo=(e,t,a)=>t in e?Go(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;var St=(e,t,a)=>Vo(e,typeof t!="symbol"?t+"":t,a);import{aA as Jo,T as Xo,j as s,r as c,aB as Qo,aC as Lt,aD as ji,aE as Ms,aF as ua,aG as is,aH as us,aI as Si,aJ as Kt,aK as ut,aL as Ra,aM as Yo,aN as $r,aO as Zo,aP as Ht,aQ as el,aR as js,aS as It,aT as Ni,aU as _a,aV as $t,aW as os,aX as Mr,aY as Ea,aZ as tl,a_ as sl,a$ as al,b0 as nl,b1 as rl,b2 as Rs,b3 as ft,o as Fs,b4 as zs,b5 as Aa,b6 as il,b7 as Pi,b8 as Ti,b9 as Ii,ba as Oa,bb as Ci,bc as Ws,bd as La,be as Ri,bf as Da,bg as qs,bh as _i,bi as ol,bj as ll,bk as cl,bl as Ei,bm as ma,bn as pa,bo as Ai,bp as dl,bq as ul,br as Oi,bs as ml,bt as pl,bu as hl,bv as gl,bw as fl,bx as yl,by as Li,bz as ls,bA as Di,bB as $i,bC as xl,bD as bl,bE as vl,bF as ha,d as wl,m as Bs,bG as Mi,bH as kl,bI as jl,bJ as Sl,bK as Nl,bL as Pl,bM as Tl,bN as Il,bO as Fi,bP as Fr,bQ as Cl,bR as Rl,bS as _l,bT as $a,bU as El,bV as Al,bW as Ol,bX as Ll,bY as Dl,bZ as q,b_ as Qs,R as zi,b$ as $l,c0 as Ml,c1 as Fl}from"./vendor-DHkYh85p.js";import{i as Ks,j as ms,k as cs,l as zl,m as Wl,a as Wi,f as ql,n as Bl,g as Kl,o as Hl,q as Ul,r as Gl,t as qi,v as Vl,P as Jl,Q as Xl}from"./state-B-4sS1xO.js";import{u as Ql,a as Yl,P as Zl,D as ec,c as tc,S as sc,v as ac,b as nc,C as rc,d as ic}from"./board-BkDRaMp6.js";import{R as yt,P as xt,O as bt,C as vt,T as wt,D as kt,a as Mt,b as oc}from"./ui-C13Nbgas.js";import{m as gt,u as lc,A as Ma}from"./motion-BeD44FeG.js";import{e as fe,s as k,o as me,a as ue,c as Ee,l as es,b as Pt,Z as ga,n as cc}from"./forms-BFlTgZ3W.js";import{H as dc,P as zr}from"./graph-D6JLqDbD.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))n(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&n(i)}).observe(document,{childList:!0,subtree:!0});function a(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?o.credentials="include":r.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(r){if(r.ep)return;r.ep=!0;const o=a(r);fetch(r.href,o)}})();function P(...e){return Jo(Xo(e))}function uc(e){return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(e))}function Fa({className:e,tone:t="primary"}){return s.jsx("span",{"aria-hidden":"true",className:P("inline-block size-4 rounded-full border border-white/14 border-t-transparent bg-[conic-gradient(from_180deg_at_50%_50%,rgba(255,255,255,0.02),rgba(255,255,255,0.34),rgba(255,255,255,0.02))] align-middle motion-safe:animate-spin",t==="primary"&&"shadow-[0_0_0_1px_rgba(192,193,255,0.22)]",t==="subtle"&&"opacity-80 shadow-[0_0_0_1px_rgba(255,255,255,0.08)]",t==="psyche"&&"shadow-[0_0_0_1px_rgba(110,231,183,0.2)]",e)})}function mc(){return{common:{actions:{cancel:"Cancel",close:"Close",create:"Create",edit:"Edit",inspect:"Inspect",open:"Open",refresh:"Refresh",retry:"Retry",save:"Save",reset:"Reset filters",view:"View"},labels:{loading:"Loading",backgroundActivity:"Background activity",syncInProgress:"Sync in progress",connectionState:"Connection state",errorCode:"Error code: {code}",noDate:"No date",noProject:"No project linked",noGoal:"No life goal linked",noExecutionNote:"No execution note attached yet.",noRunNote:"No run note recorded.",released:"Released",stable:"Stable",timedOut:"Timed out",waiting:"Waiting",today:"Today"},enums:{taskStatus:{backlog:"Backlog",focus:"Focus",in_progress:"In progress",blocked:"Blocked",done:"Done"},priority:{critical:"Critical",high:"High",medium:"Medium",low:"Low"},effort:{marathon:"Marathon",deep:"Deep",light:"Light"},energy:{high:"High",steady:"Steady",low:"Low"},projectStatus:{active:"Active",paused:"Suspended",completed:"Finished"},goalHorizon:{quarter:"Quarter",year:"Year",lifetime:"Lifetime"}},shell:{appName:"The Kinetic Forge",appMark:"FORGE",more:"More",command:"Action bar",moreRoutesEyebrow:"More routes",moreRoutesTitle:"Move through Forge",moreRoutesDescription:"Use this sheet for secondary destinations so the bottom bar stays clean and easy to use.",loadingEyebrow:"Forge shell",loadingTitle:"Loading Forge",loadingDescription:"Checking your operator session and loading your latest snapshot.",sessionEyebrow:"Forge operator session",stateEyebrow:"Forge state",settled:"Up to date",savingOne:"Saving {count} change",savingOther:"Saving {count} changes",refreshingOne:"Refreshing {count} view",refreshingOther:"Refreshing {count} views",collapseSidebar:"Collapse sidebar",expandSidebar:"Expand sidebar",rail:{taskBackToKanban:"Back to Kanban",taskOpenToday:"Open Today",projectAll:"All projects",projectGoals:"Goal architecture",goalAll:"All goals",goalProjects:"Active projects",psycheHub:"Psyche hub",psycheReports:"Reports",overview:"Overview",today:"Today"},momentum:{title:"Momentum",streak:"Streak",xp:"XP",momentum:"Momentum",streakBadgeOne:"{count} day streak",streakBadgeOther:"{count} day streak",weeklyXp:"{count} weekly XP",liveMomentum:"{count}% momentum",psycheMode:"Psyche active"}},routeLabels:{overview:"Overview",goals:"Goals",habits:"Habits",projects:"Projects",strategies:"Strategies",preferences:"Preferences",calendar:"Calendar",movement:"Movement",sleep:"Sleep",sports:"Sports",kanban:"Kanban",today:"Today",notes:"Notes",wiki:"KarpaWiki",psyche:"Psyche",activity:"Activity",insights:"Insights",review:"Review",settings:"Settings"},routeDetails:{overview:"See priorities, momentum, and recent evidence in one place.",goals:"Keep long-term direction connected to day-to-day work.",habits:"Track recurring commitments and recurring slips with explicit XP consequences.",projects:"Track the initiatives currently moving your goals forward.",strategies:"Plan the directed path from current work to the end state.",preferences:"Model taste, compare tradeoffs, and inspect preference evidence by context.",calendar:"Sync provider calendars, define work blocks, and plan real timeboxes.",movement:"See stays, trips, landmarks, and movement-linked evidence across time.",sleep:"Inspect sleep timing, recovery, and Psyche-linked context.",sports:"Inspect workout sessions, training volume, and reflection metadata.",kanban:"Move active work across the board without losing context.",today:"Focus today on the clearest next move.",notes:"Search Markdown work notes and reopen the linked work fast.",wiki:"Work in KarpaWiki, the SQLite-backed memory workspace with backlinks, entity links, and optional embeddings.",psyche:"Reflect on values, patterns, and reports with structure.",activity:"Review the visible audit trail of what changed and when.",insights:"Store and review coaching, analysis, and recommendations.",review:"Review the week and set the next push.",settings:"Manage collaboration, safety, and operator preferences."},navigation:{openRoute:"Open {label}",create:"Create",createTitle:"Create in Forge",createDescription:"Choose what you want to add next.",closeCreateMenu:"Close create menu",newGoal:"New life goal",newGoalDescription:"Define a long-term direction.",newProject:"New project",newProjectDescription:"Add a concrete initiative under a life goal.",newTask:"New task",newTaskDescription:"Capture the next actionable step in a project.",newStrategy:"New strategy",newStrategyDescription:"Add a directed plan across projects and tasks."},commandPalette:{searchPlaceholder:"Search Forge routes, records, KarpaWiki pages, notes, and active work",noResults:"No Forge result matches this search yet.",categoryRoute:"Route",categoryGoal:"Goal",categoryProject:"Project",categoryTask:"Task",routeOverview:"Open the overview.",routeToday:"Open today.",routeKanban:"Open the board.",routeNotes:"Search notes.",routeWiki:"Open KarpaWiki.",routePsyche:"Open Psyche.",routeGoals:"Open your life goals.",routeHabits:"Open your habits.",routeProjects:"Open your projects.",routeStrategies:"Open your strategies.",routePreferences:"Open the preferences workspace.",routeCalendar:"Open the calendar workspace.",routeReview:"Open weekly review.",routeSettings:"Open settings.",openLifeGoal:"Open life goal",openFocusTask:"Open focus task"},actionBar:{title:"Forge Action bar",description:"Search routes and Forge records, apply structured filters, or launch create actions from one command surface.",searchPlaceholder:"Search anything in Forge or type create habit…",idleHint:"Search Forge records, routes, and recent work. Add entity-type badges when you want structured narrowing without losing free text.",activeHint:"Free text stays live while selected badges narrow the entity results. Type create plus an entity to jump into the right creation flow.",filtersLabel:"Filter results",filtersPlaceholder:"Add entity type filters…",filtersEmpty:"No filter matches yet.",searching:"Searching Forge...",noResults:"No Forge result matches this search yet.",noResultsWithFilters:"No Forge record matches this query and filter combination yet.",sections:{routes:"Routes",recent:"Recent",quickActions:"Quick actions",results:"Results"}},pageState:{loadingTitle:"Getting things ready",loadingDescription:"Loading the latest Forge data for this view."},settings:{localeLabel:"Language",localeDescription:"Choose the language used throughout Forge.",localeEnglish:"English",localeFrench:"French",localeSaved:"Language saved"},overview:{heroEyebrow:"Strategic overview",heroEmptyTitle:"Ready to get started",heroDescription:"See your goals, active projects, current tasks, and recent evidence in one place.",emptyTitle:"No overview yet",emptyDescription:"Create a life goal, project, or task to give Forge something real to organize.",emptyAction:"Open life goals",commandEyebrow:"Command surface",commandTitle:"Now, next, risks, and recent proof",commandDescription:"See what needs attention now, what comes next, where drift is appearing, and what progress is already visible.",sectionGoals:"Active life goals",sectionProjects:"Active projects",sectionFocus:"Today's focus",sectionEvidence:"Recent evidence",sectionMomentum:"Momentum core",sectionAttention:"Needs attention",noGoals:"No life goals are active yet. Start by defining the direction you want Forge to support.",noProjects:"No active projects yet. Add a project to turn a goal into practical work.",noFocus:"No focus tasks yet. Promote a task when you know what deserves attention next.",noEvidence:"No evidence has been recorded yet. Completed work and logged activity will appear here.",noProjectYet:"No project yet",noAttention:"No major drift signal right now. Forge will raise neglected goals here when they start slipping.",metricsLevel:"Level",metricsWeeklyXp:"Weekly XP",metricsFocusTasks:"Focus tasks",metricsOverdue:"Overdue"},todayPage:{heroEyebrow:"Today",heroEmptyTitle:"No daily direction yet",heroDescription:"Start a task, earn XP, and keep today's work clear.",emptyTitle:"No daily runway yet",emptyDescription:"Add goals, tasks, or reward targets so Forge can shape a useful day plan.",emptyAction:"Open life goals",commandEyebrow:"Today command",commandTitle:"Directive, daily quests, recovery, and finish line",commandDescription:"See the next useful move clearly and keep the day grounded in real work.",questsTitle:"Daily quests",questsEmpty:"No daily quests yet. They will appear once Forge has enough live work and reward context.",rewardsTitle:"Milestone rewards",rewardsEmpty:"No milestone rewards are active yet. Long-term rewards will appear here as progress structure grows.",signalDirective:"Directive",signalQuest:"Quest chain",signalComeback:"Recovery",signalFinish:"Finish line",noDirective:"Choose one clear task to anchor the day.",noQuest:"No active daily quest chain",noQuestDetail:"Daily quests should reinforce real work, not distract from it.",noComeback:"Recovery window is clear",noFinish:"Keep the day clean",noDirectiveDetail:"Promote a real task and Today will become sharper immediately.",noFinishDetail:"A good finish today should make tomorrow lighter, not noisier."},kanban:{heroEyebrow:"Task board",heroTitle:"Task board",heroDescription:"Use the board to move active work, review blocked items, and open task details when you need more context.",emptyTitle:"No board yet",emptyDescription:"Create your first task inside a project to start using the board.",emptyAction:"Open life goals",healthEyebrow:"Board status",healthTitle:"Visible work, focus, blockers, and completed work",healthDescription:"See what is active, what needs attention, and what has already been completed.",visibleWork:"Visible work",focusWork:"Current focus",blockedWork:"Blocked work",completedWork:"Completed work",visibleDetail:"{hidden} tasks are outside the current filters.",focusDetailReady:"These are the tasks most ready to be picked up next.",focusDetailEmpty:"Move one backlog task into focus to make the board more useful.",blockedDetail:"These tasks need a decision, an unblock, or a reset before they can move again.",blockedDetailEmpty:"No blocked tasks right now.",doneDetail:"Completed work stays here until you review it or reopen it.",doneDetailEmpty:"Nothing has been completed on this board yet.",boardFilters:"Board filters",filterGoal:"Goal",filterOwner:"Owner",allGoals:"All goals",allOwners:"All owners",noTasksMatch:"No tasks match these filters",noTasksMatchDescription:"These filters hide every task. Reset them to see the full board again.",taskContext:"Task details",evidence:"Recent activity",runHistory:"Run history",noTaskEvidence:"No activity has been recorded for this task yet.",noRunHistory:"No runs have been recorded for this task yet.",taskPlacement:"Task placement",projectLabel:"Project: {value}",goalLabel:"Life goal: {value}",ownerLabel:"Owner: {value}",dueLabel:"Due: {value}",openTask:"Open task",openProject:"Open project",openGoal:"Open life goal",noProjectLinked:"No project linked",noGoalLinked:"No life goal linked"},dailyRunway:{runwayEyebrow:"Today",runwayTitle:"Tasks for today",prioritiesOne:"{count} task",prioritiesOther:"{count} tasks",unassigned:"Unassigned",runwayItem:"Task {index}",noNote:"No note yet.",inspect:"Open task",actionBacklog:"Start",actionFocus:"Start",actionProgress:"Done",actionBlocked:"Start",timelineEyebrow:"By status",timelineTitle:"Tasks by status",emptyBucket:"Nothing here right now."},executionBoard:{laneBacklogTitle:"Backlog",laneBacklogDetail:"Not started yet",laneFocusTitle:"Focus",laneFocusDetail:"Ready to work on",laneProgressTitle:"In progress",laneProgressDetail:"Currently moving",laneBlockedTitle:"Blocked",laneBlockedDetail:"Needs attention",laneDoneTitle:"Done",laneDoneDetail:"Completed",noExecutionNote:"No note yet.",reopen:"Reopen",emptyLane:"No tasks in this lane.",deleteDropTitle:"Drop here to delete",deleteDropDetail:"Move this task into the Bin.",deleteConfirmTitle:"Delete task?",deleteConfirmDescription:'Move "{title}" to the Bin? You can restore it later from Settings.',deleteConfirmCheckbox:"Do not ask again",deleteConfirmCancel:"No",deleteConfirmSubmit:"Yes, delete",deletingTask:"Deleting…"},weeklyReview:{heroEyebrow:"Weekly review",heroDescription:"Review the week, note what moved, and decide what needs attention next.",summaryEyebrow:"Weekly summary",summaryTitle:"This week, wins, recovery, and next steps",summaryDescription:"Use this review to understand what happened this week and choose the most useful next move.",sectionMomentum:"Momentum summary",sectionGoals:"Goal check-in",sectionWins:"Wins",completionBonus:"Completion bonus",finalize:"Finish review",finalized:"Review finalized",finalizedDetail:"This cycle is already locked into evidence.",finalizePending:"Finalizing review",noWin:"No win recorded yet",noWinDetail:"If this week was quiet, use the review to capture one useful takeaway anyway.",noRecovery:"No recovery suggestion yet",noRecoveryDetail:"If the week felt steady, keep a light recovery option available for next week."},dialogs:{closeDialog:"Close dialog",task:{eyebrow:"Task",createTitle:"Create task",editTitle:"Edit task",description:"Use tasks for the next concrete step inside a project. Pick the project first so Forge can keep the larger context aligned.",project:"Project",selectProject:"Select a project",goal:"Life goal",title:"Title",descriptionLabel:"Description",owner:"Owner",xp:"XP",priority:"Priority",status:"Status",effort:"Effort",energy:"Energy",dueDate:"Due date",tags:"Tags",save:"Save task",create:"Create task"},project:{eyebrow:"Project",createTitle:"Create project",editTitle:"Edit project",description:"Use projects to turn a life goal into a concrete stream of work with tasks, evidence, and momentum.",goal:"Life goal",selectGoal:"Select a life goal",title:"Title",descriptionLabel:"Description",status:"Status",targetXp:"Target XP",themeColor:"Theme color",save:"Save project",create:"Create project",submitError:"Project update failed."},goal:{eyebrow:"Life goal",createTitle:"Create life goal",editTitle:"Edit life goal",description:"Use life goals to define what matters over the coming months or years before you break the path into projects.",title:"Title",descriptionLabel:"Description",horizon:"Horizon",status:"Status",targetXp:"Target XP",themeColor:"Theme color",tags:"Life domains and context",save:"Save life goal",create:"Create life goal",submitError:"Goal update failed."}},taskDetail:{eyebrow:"Task",errorEyebrow:"Task",emptyPayload:"Forge returned an empty task payload.",heroFallback:"Use this task page to update the work, move it forward, and keep its context clear.",commandEyebrow:"Task overview",commandTitle:"What this task is, what to do next, and where it fits",commandDescription:"Use this page to update the task itself and understand its surrounding context clearly.",signalState:"State",signalNext:"Next move",signalEvidence:"Recent activity",signalAnchor:"Connected project",noStateChange:"No state change needed",terminalStateDetail:"This task is already in a completed state unless you decide to reopen it.",noEvidence:"No recent activity yet",noEvidenceDetail:"Completed work, corrections, and logged sessions will appear here as the task moves.",noAnchor:"No connected project yet",linkAnchorDetail:"Connect this task to a project or life goal so Forge can show why it matters.",edit:"Edit task",deleteTask:"Delete",deleting:"Deleting…",deleteTaskConfirm:'Move "{title}" to the Bin? You can restore it later unless you permanently delete it from Settings.',openProject:"Open project",openGoal:"Open life goal",markNotCompleted:"Mark not completed",sectionStatus:"Task status",fieldProject:"Project",fieldGoal:"Life goal",fieldDueDate:"Due date",pendingMove:"Moving",actionBacklog:"Move to backlog",actionFocus:"Move to focus",actionProgress:"Start now",actionBlocked:"Mark blocked",actionDone:"Mark completed",sectionEvidence:"Recent activity",noVisibleEvidence:"No activity has been recorded for this task yet.",removeLog:"Remove log",openRelatedItem:"Open related item",sectionRuns:"Work sessions",noRuns:"No work sessions have been recorded for this task yet.",sectionMetadata:"More task details",metaOwner:"Owner: {value}",metaEffort:"Effort: {value}",metaEnergy:"Energy: {value}",metaCreated:"Created: {value}",metaUpdated:"Last updated: {value}",metaCompleted:"Completed at: {value}",metaNotCompleted:"Not completed"},projectDetail:{errorEyebrow:"Project",heroEyebrow:"Project",commandEyebrow:"Project status",commandTitle:"Momentum, next task, risk, and evidence",commandDescription:"Use this page to see what is moving, what needs attention next, and what evidence already supports the project.",signalMomentum:"Momentum",signalNext:"Next task",signalRisk:"Risk",signalEvidence:"Evidence",trackedTasksOne:"{count} tracked task",trackedTasksOther:"{count} tracked tasks",noNextTask:"No next task selected yet",noNextTaskDetail:"Pick or create a task so the project has a clear next move.",needsFocus:"Needs focus",noRisk:"No immediate risk signal",noRiskDetail:"Blocked or neglected work will appear here when the project starts drifting.",noEvidence:"No recent evidence yet",noEvidenceDetail:"Completed work and logged activity will appear here as the project moves.",compatibility:"Compatibility mode",compatibilityDescription:"This project comes from an older snapshot format. You can review it here, but editing the project itself needs the updated backend.",addTask:"Add task",editProject:"Edit project",suspendProject:"Suspend",suspending:"Suspending…",finishProject:"Finish",finishing:"Finishing…",restartProject:"Restart",restarting:"Restarting…",deleteProject:"Delete",deleting:"Deleting…",deleteProjectConfirm:'Move "{title}" to the Bin? You can restore it later unless you permanently delete it from Settings.',openGoal:"Open life goal",sectionHealth:"Project health",fieldStatus:"Status",fieldProgress:"Progress",fieldMomentum:"Momentum",sectionEvidence:"Recent evidence"},goalDetail:{eyebrow:"Life goal",missingTitle:"This life goal is not available",missingDescription:"Forge cannot find this life goal in the current snapshot. Return to the goals view and choose an active one.",backToGoals:"Back to goals",heroBadgeOne:"{count} project",heroBadgeOther:"{count} projects",commandEyebrow:"Goal status",commandTitle:"Progress, next push, risk, and evidence",commandDescription:"Use this page to see what is advancing the goal, what should move next, and where support is needed.",signalProgress:"Progress",signalNext:"Next push",signalRisk:"Risk",signalEvidence:"Evidence",progressTitle:"{progress}% with {count} completed tasks",progressDetail:"{xp} XP is already banked on this goal.",noProject:"No active project yet",noProjectDetail:"Add a project so this goal has a concrete execution path.",needsProject:"Needs project",nextMove:"Next move: {value}",noRisk:"No drift signal right now",noRiskDetail:"If this goal starts slipping, Forge will surface that pressure here.",noEvidence:"No recent evidence yet",noEvidenceDetail:"Completed tasks, project motion, and agent actions will appear here as proof of progress.",edit:"Edit life goal",addProject:"Add project",deleteGoal:"Delete",deleting:"Deleting…",deleteGoalConfirm:'Move "{title}" to the Bin? You can restore it later unless you permanently delete it from Settings.',sectionProjects:"Projects advancing this goal",noProjects:"This goal does not have an active project yet. Add one to turn the goal into practical motion.",addNextTask:"Add the next task",sectionHealth:"Goal health",fieldProgress:"Progress",fieldCompletedTasks:"Completed tasks",fieldXpBanked:"XP banked",sectionEvidence:"Recent evidence",noEvidenceLogged:"No evidence has been logged for this goal yet. Task completions, project updates, and agent actions will appear here."}}}}const pc=mc(),hc={common:{actions:{cancel:"Annuler",close:"Fermer",create:"Créer",edit:"Modifier",inspect:"Inspecter",open:"Ouvrir",refresh:"Actualiser",retry:"Réessayer",save:"Enregistrer",reset:"Réinitialiser les filtres",view:"Voir"},labels:{loading:"Chargement",backgroundActivity:"Activité en arrière-plan",syncInProgress:"Synchronisation en cours",connectionState:"État de la connexion",errorCode:"Code d'erreur : {code}",noDate:"Aucune date",noProject:"Aucun projet lié",noGoal:"Aucun objectif de vie lié",noExecutionNote:"Aucune note d'exécution pour le moment.",noRunNote:"Aucune note d'exécution enregistrée.",released:"Libérée",stable:"Stable",timedOut:"Expirée",waiting:"En attente",today:"Aujourd'hui"},enums:{taskStatus:{backlog:"Backlog",focus:"Priorité",in_progress:"En cours",blocked:"Bloqué",done:"Terminé"},priority:{critical:"Critique",high:"Élevée",medium:"Moyenne",low:"Basse"},effort:{marathon:"Marathon",deep:"Approfondi",light:"Léger"},energy:{high:"Haute",steady:"Stable",low:"Basse"},projectStatus:{active:"Actif",paused:"Suspendu",completed:"Terminé"},goalHorizon:{quarter:"Trimestre",year:"Année",lifetime:"Vie entière"}},shell:{appName:"The Kinetic Forge",appMark:"FORGE",more:"Plus",command:"Barre d'action",moreRoutesEyebrow:"Autres vues",moreRoutesTitle:"Parcourir Forge",moreRoutesDescription:"Utilisez ce panneau pour accéder aux vues secondaires sans surcharger la barre inférieure.",loadingEyebrow:"Forge",loadingTitle:"Chargement de Forge",loadingDescription:"Vérification de votre session opérateur et chargement du dernier instantané.",sessionEyebrow:"Session opérateur Forge",stateEyebrow:"État de Forge",settled:"À jour",savingOne:"Enregistrement de {count} modification",savingOther:"Enregistrement de {count} modifications",refreshingOne:"Actualisation de {count} vue",refreshingOther:"Actualisation de {count} vues",collapseSidebar:"Réduire la barre latérale",expandSidebar:"Déployer la barre latérale",rail:{taskBackToKanban:"Retour au Kanban",taskOpenToday:"Ouvrir Aujourd'hui",projectAll:"Tous les projets",projectGoals:"Architecture des objectifs",goalAll:"Tous les objectifs",goalProjects:"Projets actifs",psycheHub:"Hub Psyche",psycheReports:"Rapports",overview:"Vue d'ensemble",today:"Aujourd'hui"},momentum:{title:"Momentum",streak:"Série",xp:"XP",momentum:"Momentum",streakBadgeOne:"{count} jour de série",streakBadgeOther:"{count} jours de série",weeklyXp:"{count} XP cette semaine",liveMomentum:"{count}% de momentum",psycheMode:"Psyche active"}},routeLabels:{overview:"Vue d'ensemble",goals:"Objectifs",habits:"Habitudes",projects:"Projets",strategies:"Stratégies",preferences:"Préférences",calendar:"Calendrier",movement:"Mouvement",sleep:"Sommeil",sports:"Sport",kanban:"Kanban",today:"Aujourd'hui",notes:"Notes",wiki:"KarpaWiki",psyche:"Psyche",activity:"Activité",insights:"Insights",review:"Revue",settings:"Réglages"},routeDetails:{overview:"Voyez les priorités, le momentum et les preuves récentes au même endroit.",goals:"Reliez la direction long terme au travail du quotidien.",habits:"Suivez les engagements récurrents et les rechutes avec des conséquences XP explicites.",projects:"Suivez les initiatives qui font avancer vos objectifs.",strategies:"Planifiez le chemin dirigé entre le travail actuel et l'état final.",preferences:"Modélisez les goûts, comparez les arbitrages et inspectez les preuves par contexte.",calendar:"Synchronisez les calendriers, définissez les blocs de travail et planifiez des timeboxes réelles.",movement:"Inspectez séjours, trajets, lieux clés et preuves liées au mouvement.",sleep:"Inspectez le sommeil, la régularité et le contexte lié à Psyche.",sports:"Inspectez les entraînements, le volume et les métadonnées de réflexion.",kanban:"Faites progresser le travail actif sans perdre le contexte.",today:"Concentrez aujourd'hui sur le prochain mouvement le plus net.",notes:"Recherchez les notes Markdown et rouvrez vite le travail lié.",wiki:"Travaillez dans une mémoire explicite basée sur des fichiers avec backlinks, liens Forge et embeddings optionnels.",psyche:"Réfléchissez avec structure sur vos valeurs, vos schémas et vos rapports.",activity:"Relisez la trace visible de ce qui a changé et quand.",insights:"Stockez et relisez coaching, analyses et recommandations.",review:"Relisez la semaine et préparez la prochaine poussée.",settings:"Gérez la collaboration, la sécurité et vos préférences."},navigation:{openRoute:"Ouvrir {label}",create:"Créer",createTitle:"Créer dans Forge",createDescription:"Choisissez ce que vous voulez ajouter ensuite.",closeCreateMenu:"Fermer le menu de création",newGoal:"Nouvel objectif de vie",newGoalDescription:"Définir une direction à long terme.",newProject:"Nouveau projet",newProjectDescription:"Ajouter une initiative concrète sous un objectif de vie.",newTask:"Nouvelle tâche",newTaskDescription:"Capturer la prochaine étape actionnable dans un projet.",newStrategy:"Nouvelle stratégie",newStrategyDescription:"Ajouter un plan dirigé à travers projets et tâches."},commandPalette:{searchPlaceholder:"Rechercher les vues Forge, les fiches, les pages wiki, les notes et le travail actif",noResults:"Aucun résultat Forge ne correspond à cette recherche.",categoryRoute:"Vue",categoryGoal:"Objectif",categoryProject:"Projet",categoryTask:"Tâche",routeOverview:"Ouvrir la vue d'ensemble.",routeToday:"Ouvrir aujourd'hui.",routeKanban:"Ouvrir le tableau.",routeNotes:"Rechercher les notes.",routeWiki:"Ouvrir l'espace mémoire wiki.",routePsyche:"Ouvrir Psyche.",routeGoals:"Ouvrir vos objectifs de vie.",routeHabits:"Ouvrir vos habitudes.",routeProjects:"Ouvrir vos projets.",routeStrategies:"Ouvrir vos stratégies.",routePreferences:"Ouvrir l'espace préférences.",routeCalendar:"Ouvrir l'espace calendrier.",routeReview:"Ouvrir la revue hebdomadaire.",routeSettings:"Ouvrir les réglages.",openLifeGoal:"Ouvrir l'objectif de vie",openFocusTask:"Ouvrir la tâche prioritaire"},actionBar:{title:"Barre d'action Forge",description:"Recherchez des vues et des fiches Forge, ajoutez des filtres structurés ou lancez des actions de création depuis une seule surface.",searchPlaceholder:"Rechercher dans Forge ou taper créer habitude…",idleHint:"Recherchez les fiches, vues et éléments récents de Forge. Ajoutez des badges de type d'entité pour affiner la recherche sans perdre le texte libre.",activeHint:"Le texte libre reste actif pendant que les badges sélectionnés resserrent les résultats. Tapez créer plus un type d'entité pour ouvrir le bon flux de création.",filtersLabel:"Filtrer les résultats",filtersPlaceholder:"Ajouter des filtres de type d'entité…",filtersEmpty:"Aucun filtre correspondant pour le moment.",searching:"Recherche dans Forge...",noResults:"Aucun résultat Forge ne correspond à cette recherche.",noResultsWithFilters:"Aucune fiche Forge ne correspond encore à cette combinaison de requête et de filtres.",sections:{routes:"Vues",recent:"Récent",quickActions:"Actions rapides",results:"Résultats"}},pageState:{loadingTitle:"Préparation en cours",loadingDescription:"Chargement des dernières données Forge pour cette vue."},settings:{localeLabel:"Langue",localeDescription:"Choisissez la langue utilisée dans Forge.",localeEnglish:"Anglais",localeFrench:"Français",localeSaved:"Langue enregistrée"},overview:{heroEyebrow:"Vue stratégique",heroEmptyTitle:"Prêt à démarrer",heroDescription:"Voyez vos objectifs, projets actifs, tâches en cours et preuves récentes au même endroit.",emptyTitle:"Pas encore de vue d'ensemble",emptyDescription:"Créez un objectif de vie, un projet ou une tâche pour donner à Forge une base réelle.",emptyAction:"Ouvrir les objectifs de vie",commandEyebrow:"Vue de commande",commandTitle:"Maintenant, ensuite, risques et preuves récentes",commandDescription:"Cette vue doit montrer ce qui mérite votre attention maintenant, ce qui vient ensuite, où la dérive apparaît et les progrès déjà visibles.",sectionGoals:"Objectifs de vie actifs",sectionProjects:"Projets actifs",sectionFocus:"Priorité du jour",sectionEvidence:"Preuves récentes",sectionMomentum:"Noyau de momentum",sectionAttention:"À surveiller",noGoals:"Aucun objectif de vie actif pour le moment. Commencez par définir la direction que Forge doit soutenir.",noProjects:"Aucun projet actif. Ajoutez un projet pour transformer un objectif en travail concret.",noFocus:"Aucune tâche prioritaire pour le moment. Faites passer une tâche en priorité quand vous savez quoi faire ensuite.",noEvidence:"Aucune preuve enregistrée pour le moment. Le travail accompli et l'activité journalisée apparaîtront ici.",noProjectYet:"Pas encore de projet",noAttention:"Aucun signal majeur de dérive pour le moment. Forge affichera ici les objectifs négligés.",metricsLevel:"Niveau",metricsWeeklyXp:"XP hebdo",metricsFocusTasks:"Tâches prioritaires",metricsOverdue:"En retard"},todayPage:{heroEyebrow:"Aujourd'hui",heroEmptyTitle:"Pas encore de direction du jour",heroDescription:"Commencez une tâche, gagnez de l'XP et gardez la journée claire.",emptyTitle:"Pas encore de piste du jour",emptyDescription:"Ajoutez des objectifs, des tâches ou des cibles de récompense pour que Forge puisse construire une journée utile.",emptyAction:"Ouvrir les objectifs de vie",commandEyebrow:"Commande du jour",commandTitle:"Directive, quêtes du jour, reprise et ligne d'arrivée",commandDescription:"Aujourd'hui doit rendre le prochain mouvement utile évident et garder la journée ancrée dans un vrai travail.",questsTitle:"Quêtes du jour",questsEmpty:"Pas encore de quêtes du jour. Elles apparaîtront quand Forge aura assez de travail réel et de contexte de récompense.",rewardsTitle:"Récompenses jalons",rewardsEmpty:"Aucune récompense jalon active pour le moment. Elles apparaîtront à mesure que la structure de progression se précise.",signalDirective:"Directive",signalQuest:"Chaîne de quêtes",signalComeback:"Reprise",signalFinish:"Ligne d'arrivée",noDirective:"Choisissez une tâche claire pour ancrer la journée.",noQuest:"Aucune chaîne de quêtes active",noQuestDetail:"Les quêtes du jour doivent renforcer le vrai travail, pas le détourner.",noComeback:"La fenêtre de reprise est claire",noFinish:"Gardez la journée nette",noDirectiveDetail:"Faites passer une vraie tâche en priorité et la vue Aujourd'hui deviendra plus nette.",noFinishDetail:"Une bonne fin de journée doit alléger demain, pas l'encombrer."},kanban:{heroEyebrow:"Tableau des tâches",heroTitle:"Tableau des tâches",heroDescription:"Utilisez le tableau pour faire avancer le travail actif, revoir les blocages et ouvrir les détails quand nécessaire.",emptyTitle:"Pas encore de tableau",emptyDescription:"Créez votre première tâche dans un projet pour commencer à utiliser le tableau.",emptyAction:"Ouvrir les objectifs de vie",healthEyebrow:"État du tableau",healthTitle:"Travail visible, priorité, blocages et travail terminé",healthDescription:"Le tableau doit montrer ce qui est actif, ce qui demande de l'attention et ce qui est déjà terminé.",visibleWork:"Travail visible",focusWork:"Priorité actuelle",blockedWork:"Travail bloqué",completedWork:"Travail terminé",visibleDetail:"{hidden} tâches sont hors des filtres actuels.",focusDetailReady:"Ce sont les tâches les plus prêtes à être reprises maintenant.",focusDetailEmpty:"Faites passer une tâche du backlog en priorité pour rendre le tableau plus utile.",blockedDetail:"Ces tâches ont besoin d'une décision, d'un déblocage ou d'une remise à plat avant d'avancer.",blockedDetailEmpty:"Aucune tâche bloquée pour le moment.",doneDetail:"Le travail terminé reste ici jusqu'à sa revue ou sa réouverture.",doneDetailEmpty:"Rien n'a encore été terminé sur ce tableau.",boardFilters:"Filtres du tableau",filterGoal:"Objectif",filterOwner:"Responsable",allGoals:"Tous les objectifs",allOwners:"Tous les responsables",noTasksMatch:"Aucune tâche ne correspond à ces filtres",noTasksMatchDescription:"Ces filtres masquent toutes les tâches. Réinitialisez-les pour revoir l'ensemble du tableau.",taskContext:"Détails de la tâche",evidence:"Activité récente",runHistory:"Historique d'exécution",noTaskEvidence:"Aucune activité n'a encore été enregistrée pour cette tâche.",noRunHistory:"Aucune exécution n'a encore été enregistrée pour cette tâche.",taskPlacement:"Placement de la tâche",projectLabel:"Projet : {value}",goalLabel:"Objectif de vie : {value}",ownerLabel:"Responsable : {value}",dueLabel:"Échéance : {value}",openTask:"Ouvrir la tâche",openProject:"Ouvrir le projet",openGoal:"Ouvrir l'objectif de vie",noProjectLinked:"Aucun projet lié",noGoalLinked:"Aucun objectif de vie lié"},dailyRunway:{runwayEyebrow:"Aujourd'hui",runwayTitle:"Tâches du jour",prioritiesOne:"{count} tâche",prioritiesOther:"{count} tâches",unassigned:"Non attribué",runwayItem:"Tâche {index}",noNote:"Aucune note pour le moment.",inspect:"Ouvrir la tâche",actionBacklog:"Commencer",actionFocus:"Commencer",actionProgress:"Terminer",actionBlocked:"Commencer",timelineEyebrow:"Par statut",timelineTitle:"Tâches par statut",emptyBucket:"Rien ici pour le moment."},executionBoard:{laneBacklogTitle:"Backlog",laneBacklogDetail:"Pas encore commencé",laneFocusTitle:"Priorité",laneFocusDetail:"Prêt à être traité",laneProgressTitle:"En cours",laneProgressDetail:"En mouvement",laneBlockedTitle:"Bloqué",laneBlockedDetail:"Demande de l'attention",laneDoneTitle:"Terminé",laneDoneDetail:"Achevé",noExecutionNote:"Aucune note pour le moment.",reopen:"Rouvrir",emptyLane:"Aucune tâche dans cette colonne.",deleteDropTitle:"Déposer ici pour supprimer",deleteDropDetail:"Déplacez cette tâche dans la corbeille.",deleteConfirmTitle:"Supprimer la tâche ?",deleteConfirmDescription:'Déplacer "{title}" vers la corbeille ? Vous pourrez la restaurer plus tard dans Réglages.',deleteConfirmCheckbox:"Ne plus demander",deleteConfirmCancel:"Non",deleteConfirmSubmit:"Oui, supprimer",deletingTask:"Suppression…"},weeklyReview:{heroEyebrow:"Revue hebdomadaire",heroDescription:"Relisez la semaine, notez ce qui a avancé et décidez de ce qui demande de l'attention ensuite.",summaryEyebrow:"Résumé hebdomadaire",summaryTitle:"Cette semaine, les progrès, la récupération et la suite",summaryDescription:"Utilisez cette revue pour comprendre la semaine et choisir le prochain mouvement utile.",sectionMomentum:"Résumé du momentum",sectionGoals:"Point sur les objectifs",sectionWins:"Progrès",completionBonus:"Bonus de complétion",finalize:"Terminer la revue",finalized:"Revue terminée",finalizedDetail:"Ce cycle est déjà consigné comme preuve.",finalizePending:"Finalisation de la revue",noWin:"Aucun progrès enregistré",noWinDetail:"Même si la semaine a été calme, notez au moins un apprentissage utile.",noRecovery:"Aucune suggestion de récupération",noRecoveryDetail:"Si la semaine a été stable, gardez malgré tout une option légère de récupération."},dialogs:{closeDialog:"Fermer la fenêtre",task:{eyebrow:"Tâche",createTitle:"Créer une tâche",editTitle:"Modifier la tâche",description:"Utilisez les tâches pour représenter la prochaine étape concrète dans un projet. Choisissez d'abord le projet pour garder le bon contexte.",project:"Projet",selectProject:"Sélectionner un projet",goal:"Objectif de vie",title:"Titre",descriptionLabel:"Description",owner:"Responsable",xp:"XP",priority:"Priorité",status:"Statut",effort:"Effort",energy:"Énergie",dueDate:"Date d'échéance",tags:"Tags",save:"Enregistrer la tâche",create:"Créer la tâche"},project:{eyebrow:"Projet",createTitle:"Créer un projet",editTitle:"Modifier le projet",description:"Utilisez les projets pour transformer un objectif de vie en flux de travail concret avec tâches, preuves et momentum.",goal:"Objectif de vie",selectGoal:"Sélectionner un objectif de vie",title:"Titre",descriptionLabel:"Description",status:"Statut",targetXp:"XP cible",themeColor:"Couleur du thème",save:"Enregistrer le projet",create:"Créer le projet",submitError:"La mise à jour du projet a échoué."},goal:{eyebrow:"Objectif de vie",createTitle:"Créer un objectif de vie",editTitle:"Modifier l'objectif de vie",description:"Utilisez les objectifs de vie pour définir ce qui compte sur les mois ou les années à venir avant de le décliner en projets.",title:"Titre",descriptionLabel:"Description",horizon:"Horizon",status:"Statut",targetXp:"XP cible",themeColor:"Couleur du thème",tags:"Domaines de vie et contexte",save:"Enregistrer l'objectif de vie",create:"Créer l'objectif de vie",submitError:"La mise à jour de l'objectif a échoué."}},taskDetail:{eyebrow:"Tâche",errorEyebrow:"Tâche",emptyPayload:"Forge a renvoyé une charge utile de tâche vide.",heroFallback:"Utilisez cette page pour mettre à jour la tâche, la faire avancer et garder son contexte clair.",commandEyebrow:"Commande de tâche",commandTitle:"Statut, prochaine action, preuves et contexte",commandDescription:"Cette page doit aider à modifier directement la tâche et à comprendre clairement son contexte.",signalState:"Statut",signalNext:"Prochaine action",signalEvidence:"Activité récente",signalAnchor:"Projet lié",noStateChange:"Aucun changement d'état nécessaire",terminalStateDetail:"Cette tâche est déjà dans un état terminé, sauf si vous décidez de la rouvrir.",noEvidence:"Aucune activité récente pour le moment",noEvidenceDetail:"Le travail terminé, les corrections et les sessions apparaîtront ici à mesure que la tâche avance.",noAnchor:"Aucun projet lié",linkAnchorDetail:"Reliez cette tâche à un projet ou à un objectif de vie pour que Forge puisse montrer pourquoi elle compte.",edit:"Modifier la tâche",deleteTask:"Supprimer",deleting:"Suppression…",deleteTaskConfirm:`Déplacer "{title}" vers la corbeille ? Vous pourrez la restaurer plus tard tant qu'elle n'est pas supprimée définitivement dans Réglages.`,openProject:"Ouvrir le projet",openGoal:"Ouvrir l'objectif de vie",markNotCompleted:"Marquer comme non terminée",sectionStatus:"Statut de la tâche",fieldProject:"Projet",fieldGoal:"Objectif de vie",fieldDueDate:"Date d'échéance",pendingMove:"Déplacement",actionBacklog:"Passer au backlog",actionFocus:"Passer en priorité",actionProgress:"Commencer maintenant",actionBlocked:"Marquer bloquée",actionDone:"Marquer terminée",sectionEvidence:"Activité récente",noVisibleEvidence:"Aucune activité n'a encore été enregistrée pour cette tâche.",removeLog:"Supprimer l'entrée",openRelatedItem:"Ouvrir l'élément lié",sectionRuns:"Sessions de travail",noRuns:"Aucune session de travail n'a encore été enregistrée pour cette tâche.",sectionMetadata:"Autres détails de la tâche",metaOwner:"Responsable : {value}",metaEffort:"Effort : {value}",metaEnergy:"Énergie : {value}",metaCreated:"Créée : {value}",metaUpdated:"Dernière mise à jour : {value}",metaCompleted:"Terminée le : {value}",metaNotCompleted:"Non terminée"},projectDetail:{errorEyebrow:"Projet",heroEyebrow:"Projet",commandEyebrow:"État du projet",commandTitle:"Momentum, prochaine tâche, risque et preuves",commandDescription:"Utilisez cette page pour voir ce qui avance, ce qui demande votre attention ensuite, et quelles preuves soutiennent déjà le projet.",signalMomentum:"Momentum",signalNext:"Prochaine tâche",signalRisk:"Risque",signalEvidence:"Preuves",trackedTasksOne:"{count} tâche suivie",trackedTasksOther:"{count} tâches suivies",noNextTask:"Aucune prochaine tâche choisie",noNextTaskDetail:"Choisissez ou créez une tâche pour donner au projet un prochain mouvement clair.",needsFocus:"Besoin de priorité",noRisk:"Aucun risque immédiat",noRiskDetail:"Le travail bloqué ou négligé apparaîtra ici si le projet commence à dériver.",noEvidence:"Aucune preuve récente",noEvidenceDetail:"Le travail terminé et l'activité enregistrée apparaîtront ici à mesure que le projet avance.",compatibility:"Mode de compatibilité",compatibilityDescription:"Ce projet provient d'un ancien format d'instantané. Vous pouvez le consulter ici, mais sa modification demande le backend mis à jour.",addTask:"Ajouter une tâche",editProject:"Modifier le projet",suspendProject:"Suspendre",suspending:"Suspension…",finishProject:"Terminer",finishing:"Finalisation…",restartProject:"Relancer",restarting:"Relance…",deleteProject:"Supprimer",deleting:"Suppression…",deleteProjectConfirm:`Déplacer "{title}" vers la corbeille ? Vous pourrez le restaurer plus tard tant qu'il n'est pas supprimé définitivement dans Réglages.`,openGoal:"Ouvrir l'objectif de vie",sectionHealth:"Santé du projet",fieldStatus:"Statut",fieldProgress:"Progression",fieldMomentum:"Momentum",sectionEvidence:"Preuves récentes"},goalDetail:{eyebrow:"Objectif de vie",missingTitle:"Cet objectif de vie n'est pas disponible",missingDescription:"Forge ne trouve pas cet objectif de vie dans l'instantané actuel. Revenez à la vue des objectifs et choisissez-en un actif.",backToGoals:"Retour aux objectifs",heroBadgeOne:"{count} projet",heroBadgeOther:"{count} projets",commandEyebrow:"État de l'objectif",commandTitle:"Progression, prochain élan, risque et preuves",commandDescription:"Utilisez cette page pour voir ce qui fait avancer l'objectif, ce qui doit bouger ensuite, et où du soutien est nécessaire.",signalProgress:"Progression",signalNext:"Prochain élan",signalRisk:"Risque",signalEvidence:"Preuves",progressTitle:"{progress}% avec {count} tâches terminées",progressDetail:"{xp} XP sont déjà cumulés sur cet objectif.",noProject:"Aucun projet actif pour le moment",noProjectDetail:"Ajoutez un projet pour donner à cet objectif un chemin d'exécution concret.",needsProject:"Projet nécessaire",nextMove:"Prochaine action : {value}",noRisk:"Aucun signal de dérive pour le moment",noRiskDetail:"Si cet objectif commence à glisser, Forge affichera cette pression ici.",noEvidence:"Aucune preuve récente",noEvidenceDetail:"Les tâches terminées, le mouvement des projets et les actions d'agents apparaîtront ici comme preuve de progression.",edit:"Modifier l'objectif de vie",addProject:"Ajouter un projet",deleteGoal:"Supprimer",deleting:"Suppression…",deleteGoalConfirm:`Déplacer "{title}" vers la corbeille ? Vous pourrez le restaurer plus tard tant qu'il n'est pas supprimé définitivement dans Réglages.`,sectionProjects:"Projets qui font avancer cet objectif",noProjects:"Cet objectif n'a pas encore de projet actif. Ajoutez-en un pour le transformer en mouvement concret.",addNextTask:"Ajouter la prochaine tâche",sectionHealth:"Santé de l'objectif",fieldProgress:"Progression",fieldCompletedTasks:"Tâches terminées",fieldXpBanked:"XP cumulés",sectionEvidence:"Preuves récentes",noEvidenceLogged:"Aucune preuve n'a encore été enregistrée pour cet objectif. Les tâches terminées, les mises à jour de projet et les actions d'agents apparaîtront ici."}}},Wr={en:pc,fr:hc};function qr(e,t){const a=t.split(".");let n=e;for(const r of a){if(!n||typeof n=="string")return;n=n[r]}return typeof n=="string"?n:void 0}function gc(e,t){return t?e.replace(/\{(\w+)\}/g,(a,n)=>{const r=t[n];return r==null?"":String(r)}):e}function _s(e,t,a){const n=qr(Wr[e],t),r=qr(Wr.en,t);return gc(n??r??t,a)}const fc={locale:"en",t:(e,t)=>_s("en",e,t),formatDate:e=>e?new Intl.DateTimeFormat("en",{month:"short",day:"numeric"}).format(new Date(`${e}T00:00:00.000Z`)):_s("en","common.labels.noDate"),formatDateTime:e=>new Intl.DateTimeFormat("en",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(e)),formatNumber:e=>new Intl.NumberFormat("en").format(e)},Bi=c.createContext(null);function yc({children:e,locale:t}){const a=c.useMemo(()=>({locale:t,t:(n,r)=>_s(t,n,r),formatDate:n=>n?new Intl.DateTimeFormat(t,{month:"short",day:"numeric"}).format(new Date(`${n}T00:00:00.000Z`)):_s(t,"common.labels.noDate"),formatDateTime:n=>new Intl.DateTimeFormat(t,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(n)),formatNumber:n=>new Intl.NumberFormat(t).format(n)}),[t]);return s.jsx(Bi.Provider,{value:a,children:e})}function Le(){return c.useContext(Bi)??fc}function Br({active:e,label:t,className:a,onClick:n}){const{t:r}=Le();return s.jsxs(gt.button,{type:"button",initial:!1,animate:{opacity:e?1:.55,y:0,scale:e?1:.98},transition:{duration:.24,ease:"easeOut"},onClick:n,className:P("surface-pulse ambient-glow inline-flex min-h-11 shrink-0 items-center gap-2.5 rounded-full border border-white/8 px-4 py-2 text-left shadow-[0_18px_40px_rgba(3,8,18,0.22)] backdrop-blur-xl transition hover:border-white/14 hover:bg-white/[0.03]",n?"cursor-pointer":"cursor-default",a),"aria-live":"polite","aria-label":`${r("common.labels.backgroundActivity")}: ${t}`,children:[s.jsx(Fa,{tone:"subtle",className:e?"opacity-100":"opacity-45"}),s.jsxs("div",{className:"inline-flex min-w-0 max-w-full items-center gap-2 whitespace-nowrap",children:[s.jsx("span",{className:"type-label hidden text-white/56 sm:inline",children:r("common.labels.backgroundActivity")}),s.jsx("span",{className:"hidden text-white/30 sm:inline",children:"•"}),s.jsx("span",{className:"truncate text-sm text-white/80",children:t})]})]})}function le({className:e,tone:t="default",size:a="md",wrap:n=!1,...r}){return s.jsx("span",{className:P("inline-flex max-w-full items-center rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] font-medium text-[var(--ui-ink-medium)]",n?"whitespace-normal break-words [overflow-wrap:anywhere]":"overflow-hidden text-ellipsis whitespace-nowrap",a==="xs"?"min-h-5 px-2 py-0.5 text-[10px]":a==="sm"?"min-h-7 px-2.5 py-1 text-[12px]":"min-h-8 px-3 py-1.5 text-[12px]",t==="meta"&&"bg-[var(--ui-surface-1)] text-[var(--ui-ink-soft)]",t==="signal"&&"border-[var(--primary)]/14 bg-[var(--ui-accent-soft)] text-[var(--ui-ink-on-accent)]",e),...r})}const xc=Qo("inline-flex min-w-0 max-w-full items-center justify-center gap-2 overflow-hidden whitespace-nowrap rounded-[var(--radius-control)] font-medium leading-none transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[rgba(192,193,255,0.45)] disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{primary:"border border-[var(--primary)]/14 bg-[var(--ui-accent-soft)] text-[var(--ui-ink-on-accent)] shadow-[var(--ui-shadow-soft)] hover:bg-[var(--ui-accent-soft-hover)]",secondary:"border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-strong)] hover:border-[var(--ui-border-strong)] hover:bg-[var(--ui-surface-hover)]",ghost:"border border-transparent bg-transparent text-[var(--primary)] hover:bg-[var(--ui-surface-1)]"},size:{sm:"min-h-[2.125rem] px-2.5 py-[0.4375rem] text-[13px]",md:"interactive-tap min-h-10 px-3 py-2 text-[13px]",lg:"min-h-11 px-4 py-2.5 text-sm"}},defaultVariants:{variant:"primary",size:"md"}});function de({className:e,variant:t,size:a,pending:n=!1,pendingLabel:r,children:o,disabled:i,...l}){return s.jsxs("button",{className:P(xc({variant:t,size:a}),e),disabled:i||n,"aria-busy":n,...l,children:[n?s.jsx(Fa,{className:"size-3.5",tone:"subtle"}):null,s.jsx("span",{className:"inline-flex min-w-0 max-w-full items-center gap-2 overflow-hidden truncate whitespace-nowrap",children:n&&r?r:o})]})}function bc({value:e,className:t,tone:a="primary"}){const n=`${Math.max(4,Math.min(100,e))}%`,r=a==="secondary"?"from-[var(--secondary)] to-[rgba(78,222,163,0.45)]":a==="tertiary"?"from-[var(--tertiary)] to-[rgba(255,185,95,0.45)]":"from-[var(--primary)] to-[rgba(192,193,255,0.45)]";return s.jsx("div",{className:P("h-1.5 rounded-full bg-white/[0.08]",t),children:s.jsx("div",{className:P("h-full rounded-full bg-gradient-to-r",r),style:{width:n}})})}class Es extends Error{constructor(a){super(a.message);St(this,"status");St(this,"code");St(this,"details");St(this,"requestPath");St(this,"response");this.name="ForgeApiError",this.status=a.status,this.code=a.code,this.details=a.details??[],this.requestPath=a.requestPath,this.response=a.response??null}}function vc(e){return e instanceof Es?{title:`Request failed (${e.status})`,description:e.details.length>0?`${e.message} ${e.details.map(t=>`${t.path}: ${t.message}`).join(" · ")}`:e.message,code:e.code}:e instanceof Error?{title:"Something went wrong",description:e.message,code:"unknown_error"}:{title:"Something went wrong",description:"Unexpected API failure.",code:"unknown_error"}}function Ki(e){return e.trim().replace(/\s+/g," ").toLocaleLowerCase()}function Ft(e){const t=e==null?void 0:e.trim();return t||null}function zt(e){return Ft(e)??"Unnamed calendar"}function Hi(e){switch(e){case"google":return"Google";case"apple":return"Apple";case"microsoft":return"Microsoft";case"macos_local":return"Mac";case"caldav":default:return"CalDAV"}}function wc(e){const t=Ft(e);if(!t)return null;try{const a=new URL(t),r=a.pathname.split("/").map(o=>o.trim()).filter(Boolean).at(-1);return r?`${a.host}/${decodeURIComponent(r)}`:a.host}catch{return t}}function Ys(e){const t=e.map(Ft).filter(a=>!!a);return t.length>0?t.join(" · "):null}function kc(e){const t=[a=>a.providerLabel,a=>Ys([a.providerLabel,a.accountLabel]),a=>Ys([a.providerLabel,a.connectionLabel]),a=>a.connectionLabel,a=>a.accountLabel,a=>wc(a.url),a=>a.url];for(const a of t){const n=e.map(a);if(n.some(o=>!Ft(o)))continue;const r=n.map(o=>Ki(o));if(new Set(r).size===e.length)return n}return e.map((a,n)=>Ys([a.providerLabel,`${n+1}`])??`${n+1}`)}function Ui(e){const t=new Map,a=new Map;for(const n of e){const r=Ki(n.baseName),o=a.get(r)??[];o.push(n),a.set(r,o)}for(const n of a.values()){if(n.length===1){t.set(n[0].id,n[0].baseName);continue}const r=kc(n);n.forEach((o,i)=>{t.set(o.id,`${o.baseName} (${r[i]})`)})}return t}function ps(e){const t=Ui(e.calendars.map(a=>({id:a.url,baseName:zt(a.displayName),providerLabel:Hi(e.provider),connectionLabel:null,accountLabel:e.accountLabel,url:a.url})));return{...e,calendars:e.calendars.map(a=>({...a,dedupedName:t.get(a.url)??zt(a.displayName)}))}}function jc(e,t){const a=new Map(t.map(r=>[r.id,r])),n=Ui(e.map(r=>{const o=a.get(r.connectionId);return{id:r.id,baseName:zt(r.title),providerLabel:o?Hi(o.provider):null,connectionLabel:(o==null?void 0:o.label)??null,accountLabel:(o==null?void 0:o.accountLabel)??null,url:r.remoteId}}));return e.map(r=>({...r,dedupedName:n.get(r.id)??zt(r.title)}))}function Sc(e){return{...e,calendars:jc(e.calendars,e.connections)}}function py(e){return"title"in e?Ft(e.dedupedName)??zt(e.title):Ft(e.dedupedName)??zt(e.displayName)}function Gi(e){const t=e.startsWith("/")?e:`/${e}`;return t.endsWith("/")?t:`${t}/`}function Nc(e){const t=Gi(e);return t==="/"?"/":t.endsWith("/")?t.slice(0,-1):t}function Pc(){return new URL(Gi("/forge/"),window.location.origin)}function za(e){if(e.startsWith("/api/"))return e;const t=e.startsWith("/")?e.slice(1):e;return new URL(t,Pc()).pathname}function fa(e,t=0){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"?e:typeof e=="bigint"?e.toString():e instanceof Error?{name:e.name,message:e.message,stack:e.stack??null}:Array.isArray(e)?t>=3?`[Array(${e.length})]`:e.slice(0,20).map(a=>fa(a,t+1)):e&&typeof e=="object"?t>=3?"[Object]":Object.fromEntries(Object.entries(e).slice(0,30).map(([a,n])=>[a,fa(n,t+1)])):String(e)}function Tc(e){return e?Object.fromEntries(Object.entries(e).map(([t,a])=>[t,fa(a)])):{}}async function Hs(e){try{await fetch(za("/api/v1/diagnostics/logs"),{method:"POST",credentials:"same-origin",keepalive:!0,headers:{"content-type":"application/json","x-forge-source":"ui"},body:JSON.stringify({...e,source:e.source??"ui",details:Tc(e.details)})})}catch{}}function Vi(e){return t=>Hs({...e,...t})}const Ic={allowWorkBlockKinds:[],blockWorkBlockKinds:[],allowCalendarIds:[],blockCalendarIds:[],allowEventTypes:[],blockEventTypes:[],allowEventKeywords:[],blockEventKeywords:[],allowAvailability:[],blockAvailability:[]};function pt(e){return{id:(e==null?void 0:e.id)??"",title:(e==null?void 0:e.title)??"",description:(e==null?void 0:e.description)??"",level:(e==null?void 0:e.level)??"task",status:(e==null?void 0:e.status)??"backlog",priority:(e==null?void 0:e.priority)??"medium",owner:(e==null?void 0:e.owner)??"Albert",goalId:(e==null?void 0:e.goalId)??null,projectId:(e==null?void 0:e.projectId)??null,parentWorkItemId:(e==null?void 0:e.parentWorkItemId)??null,dueDate:(e==null?void 0:e.dueDate)??null,effort:(e==null?void 0:e.effort)??"deep",energy:(e==null?void 0:e.energy)??"steady",points:(e==null?void 0:e.points)??0,plannedDurationSeconds:(e==null?void 0:e.plannedDurationSeconds)??null,schedulingRules:(e==null?void 0:e.schedulingRules)??null,sortOrder:(e==null?void 0:e.sortOrder)??0,resolutionKind:(e==null?void 0:e.resolutionKind)??null,splitParentTaskId:(e==null?void 0:e.splitParentTaskId)??null,aiInstructions:(e==null?void 0:e.aiInstructions)??"",executionMode:(e==null?void 0:e.executionMode)??null,acceptanceCriteria:(e==null?void 0:e.acceptanceCriteria)??[],blockerLinks:(e==null?void 0:e.blockerLinks)??[],completionReport:(e==null?void 0:e.completionReport)??null,gitRefs:(e==null?void 0:e.gitRefs)??[],completedAt:(e==null?void 0:e.completedAt)??null,createdAt:(e==null?void 0:e.createdAt)??new Date(0).toISOString(),updatedAt:(e==null?void 0:e.updatedAt)??new Date(0).toISOString(),tagIds:(e==null?void 0:e.tagIds)??[],userId:(e==null?void 0:e.userId)??null,user:(e==null?void 0:e.user)??null,ownerUserId:(e==null?void 0:e.ownerUserId)??(e==null?void 0:e.userId)??null,ownerUser:(e==null?void 0:e.ownerUser)??(e==null?void 0:e.user)??null,assigneeUserIds:(e==null?void 0:e.assigneeUserIds)??[],assignees:(e==null?void 0:e.assignees)??[],time:(e==null?void 0:e.time)??{totalTrackedSeconds:0,totalCreditedSeconds:0,liveTrackedSeconds:0,liveCreditedSeconds:0,manualAdjustedSeconds:0,activeRunCount:0,hasCurrentRun:!1,currentRunId:null},actionPointSummary:(e==null?void 0:e.actionPointSummary)??{costBand:"standard",totalCostAp:100,expectedDurationSeconds:86400,sustainRateApPerHour:100/24,spentTodayAp:0,spentTotalAp:0,remainingAp:100},splitSuggestion:(e==null?void 0:e.splitSuggestion)??{shouldSplit:!1,reason:null,thresholdSeconds:2*86400}}}function Zs(e){return{id:(e==null?void 0:e.id)??"",title:(e==null?void 0:e.title)??"",description:(e==null?void 0:e.description)??"",horizon:(e==null?void 0:e.horizon)==="quarter"||(e==null?void 0:e.horizon)==="lifetime"?e.horizon:"year",status:(e==null?void 0:e.status)==="paused"||(e==null?void 0:e.status)==="completed"?e.status:"active",targetPoints:(e==null?void 0:e.targetPoints)??0,themeColor:(e==null?void 0:e.themeColor)??"#c8a46b",createdAt:(e==null?void 0:e.createdAt)??new Date(0).toISOString(),updatedAt:(e==null?void 0:e.updatedAt)??new Date(0).toISOString(),tagIds:(e==null?void 0:e.tagIds)??[],userId:(e==null?void 0:e.userId)??null,user:(e==null?void 0:e.user)??null}}function ea(e){return{id:(e==null?void 0:e.id)??"",name:(e==null?void 0:e.name)??"",kind:(e==null?void 0:e.kind)==="value"||(e==null?void 0:e.kind)==="execution"?e.kind:"category",color:(e==null?void 0:e.color)??"#71717a",description:(e==null?void 0:e.description)??"",userId:(e==null?void 0:e.userId)??null,user:(e==null?void 0:e.user)??null}}function ta(e){return{id:(e==null?void 0:e.id)??"",goalId:(e==null?void 0:e.goalId)??"",title:(e==null?void 0:e.title)??"",description:(e==null?void 0:e.description)??(e==null?void 0:e.summary)??"",status:(e==null?void 0:e.status)==="paused"||(e==null?void 0:e.status)==="completed"?e.status:"active",workflowStatus:(e==null?void 0:e.workflowStatus)??"backlog",targetPoints:(e==null?void 0:e.targetPoints)??(e==null?void 0:e.totalPoints)??0,themeColor:(e==null?void 0:e.themeColor)??"#c0c1ff",productRequirementsDocument:(e==null?void 0:e.productRequirementsDocument)??"",schedulingRules:(e==null?void 0:e.schedulingRules)??Ic,createdAt:(e==null?void 0:e.createdAt)??new Date(0).toISOString(),updatedAt:(e==null?void 0:e.updatedAt)??new Date(0).toISOString(),goalTitle:(e==null?void 0:e.goalTitle)??"",activeTaskCount:(e==null?void 0:e.activeTaskCount)??0,completedTaskCount:(e==null?void 0:e.completedTaskCount)??0,totalTasks:(e==null?void 0:e.totalTasks)??0,earnedPoints:(e==null?void 0:e.earnedPoints)??(e==null?void 0:e.totalPoints)??0,progress:(e==null?void 0:e.progress)??0,nextTaskId:(e==null?void 0:e.nextTaskId)??null,nextTaskTitle:(e==null?void 0:e.nextTaskTitle)??null,momentumLabel:(e==null?void 0:e.momentumLabel)??"No momentum yet",userId:(e==null?void 0:e.userId)??null,user:(e==null?void 0:e.user)??null,ownerUserId:(e==null?void 0:e.ownerUserId)??(e==null?void 0:e.userId)??null,ownerUser:(e==null?void 0:e.ownerUser)??(e==null?void 0:e.user)??null,assigneeUserIds:(e==null?void 0:e.assigneeUserIds)??[],assignees:(e==null?void 0:e.assignees)??[],time:(e==null?void 0:e.time)??{totalTrackedSeconds:0,totalCreditedSeconds:0,liveTrackedSeconds:0,liveCreditedSeconds:0,manualAdjustedSeconds:0,activeRunCount:0,hasCurrentRun:!1,currentRunId:null}}}function vs(e){return{id:(e==null?void 0:e.id)??"",title:(e==null?void 0:e.title)??"",description:(e==null?void 0:e.description)??"",status:(e==null?void 0:e.status)??"active",polarity:(e==null?void 0:e.polarity)??"positive",frequency:(e==null?void 0:e.frequency)??"daily",targetCount:(e==null?void 0:e.targetCount)??1,weekDays:(e==null?void 0:e.weekDays)??[],linkedGoalIds:(e==null?void 0:e.linkedGoalIds)??[],linkedProjectIds:(e==null?void 0:e.linkedProjectIds)??[],linkedTaskIds:(e==null?void 0:e.linkedTaskIds)??[],linkedValueIds:(e==null?void 0:e.linkedValueIds)??[],linkedPatternIds:(e==null?void 0:e.linkedPatternIds)??[],linkedBehaviorIds:(e==null?void 0:e.linkedBehaviorIds)??[],linkedBeliefIds:(e==null?void 0:e.linkedBeliefIds)??[],linkedModeIds:(e==null?void 0:e.linkedModeIds)??[],linkedReportIds:(e==null?void 0:e.linkedReportIds)??[],linkedBehaviorId:(e==null?void 0:e.linkedBehaviorId)??null,linkedBehaviorTitle:(e==null?void 0:e.linkedBehaviorTitle)??null,linkedBehaviorTitles:(e==null?void 0:e.linkedBehaviorTitles)??[],rewardXp:(e==null?void 0:e.rewardXp)??12,penaltyXp:(e==null?void 0:e.penaltyXp)??8,generatedHealthEventTemplate:(e==null?void 0:e.generatedHealthEventTemplate)??{enabled:!1,workoutType:"",title:"",durationMinutes:60,xpReward:0,tags:[],links:[],notesTemplate:""},createdAt:(e==null?void 0:e.createdAt)??new Date(0).toISOString(),updatedAt:(e==null?void 0:e.updatedAt)??new Date(0).toISOString(),lastCheckInAt:(e==null?void 0:e.lastCheckInAt)??null,lastCheckInStatus:(e==null?void 0:e.lastCheckInStatus)??null,streakCount:(e==null?void 0:e.streakCount)??0,completionRate:(e==null?void 0:e.completionRate)??0,dueToday:(e==null?void 0:e.dueToday)??!1,userId:(e==null?void 0:e.userId)??null,user:(e==null?void 0:e.user)??null,checkIns:(e==null?void 0:e.checkIns)??[]}}function Kr(e){return{id:(e==null?void 0:e.id)??"",kind:(e==null?void 0:e.kind)??"human",handle:(e==null?void 0:e.handle)??"",displayName:(e==null?void 0:e.displayName)??"",description:(e==null?void 0:e.description)??"",accentColor:(e==null?void 0:e.accentColor)??"#c0c1ff",createdAt:(e==null?void 0:e.createdAt)??new Date(0).toISOString(),updatedAt:(e==null?void 0:e.updatedAt)??new Date(0).toISOString()}}function Cc(e){return{id:(e==null?void 0:e.id)??"",title:(e==null?void 0:e.title)??"",overview:(e==null?void 0:e.overview)??"",endStateDescription:(e==null?void 0:e.endStateDescription)??"",status:(e==null?void 0:e.status)==="paused"||(e==null?void 0:e.status)==="completed"?e.status:"active",targetGoalIds:(e==null?void 0:e.targetGoalIds)??[],targetProjectIds:(e==null?void 0:e.targetProjectIds)??[],linkedEntities:(e==null?void 0:e.linkedEntities)??[],graph:(e==null?void 0:e.graph)??{nodes:[],edges:[]},metrics:(e==null?void 0:e.metrics)??{alignmentScore:0,planCoverageScore:0,sequencingScore:100,scopeDisciplineScore:100,qualityScore:0,targetProgressScore:0,completedNodeCount:0,startedNodeCount:0,readyNodeCount:0,totalNodeCount:1,completedTargetCount:0,totalTargetCount:0,offPlanEntityCount:0,offPlanActiveEntityCount:0,offPlanCompletedEntityCount:0,activeNodeIds:[],nextNodeIds:[],blockedNodeIds:[],outOfOrderNodeIds:[]},isLocked:(e==null?void 0:e.isLocked)??!1,lockedAt:(e==null?void 0:e.lockedAt)??null,lockedByUserId:(e==null?void 0:e.lockedByUserId)??null,lockedByUser:(e==null?void 0:e.lockedByUser)??null,createdAt:(e==null?void 0:e.createdAt)??new Date(0).toISOString(),updatedAt:(e==null?void 0:e.updatedAt)??new Date(0).toISOString(),userId:(e==null?void 0:e.userId)??null,user:(e==null?void 0:e.user)??null}}function Rc(e){var o,i,l,u,h,m,g,f,x,y,R,p,T,_,b,F,v,B,N,A,I,$,ee,ne,oe,V,w,z,ie,te,E,X,M,Z,O,se,pe,Me,Te,Ie,xe,Ce,Ne,we,Ue,Fe,it,ze,Ke,tt,mt,D,Q,C,W,S,ye,ge,st,Rt,Vt,Jt,Xt,Qt,Yt,Zt,j,L,Y,qe,_t,ot,jt,Et,En,An,On,Ln,Dn,$n,Mn,Fn,zn,Wn,qn,Bn,Kn,Hn,Un,Gn,Vn,Jn,Xn,Qn,Yn,Zn,er,tr,sr,ar,nr,rr,ir,or,lr,cr,dr,ur,mr,pr,hr,gr,fr,yr,xr,br,vr,wr,kr,jr,Sr,Nr,Pr,Tr,Ir,Cr,Rr,_r,Er,Ar,Or,Lr,Dr;const t=e,a=(t.projects??t.campaigns??[]).map(ta),n=(((o=t.dashboard)==null?void 0:o.projects)??((i=t.dashboard)==null?void 0:i.campaigns)??a).map(ta),r=(((l=t.overview)==null?void 0:l.projects)??((u=t.overview)==null?void 0:u.campaigns)??n).map(ta);return{...e,meta:{apiVersion:"v1",transport:"rest+sse",generatedAt:((h=e.meta)==null?void 0:h.generatedAt)??new Date().toISOString(),backend:((m=e.meta)==null?void 0:m.backend)??"forge-node-runtime",mode:((g=e.meta)==null?void 0:g.mode)??"transitional-node"},metrics:{totalXp:((f=e.metrics)==null?void 0:f.totalXp)??0,level:((x=e.metrics)==null?void 0:x.level)??1,currentLevelXp:((y=e.metrics)==null?void 0:y.currentLevelXp)??0,nextLevelXp:((R=e.metrics)==null?void 0:R.nextLevelXp)??120,xpIntoLevel:((p=e.metrics)==null?void 0:p.xpIntoLevel)??((T=e.metrics)==null?void 0:T.currentLevelXp)??0,xpToNextLevel:((_=e.metrics)==null?void 0:_.xpToNextLevel)??((b=e.metrics)==null?void 0:b.nextLevelXp)??120,currentLevelStartXp:((F=e.metrics)==null?void 0:F.currentLevelStartXp)??0,nextLevelTotalXp:((v=e.metrics)==null?void 0:v.nextLevelTotalXp)??(((B=e.metrics)==null?void 0:B.totalXp)??0)+(((N=e.metrics)==null?void 0:N.nextLevelXp)??120),levelCurveVersion:((A=e.metrics)==null?void 0:A.levelCurveVersion)??"legacy-linear-120",weeklyXp:((I=e.metrics)==null?void 0:I.weeklyXp)??0,streakDays:(($=e.metrics)==null?void 0:$.streakDays)??0,comboMultiplier:((ee=e.metrics)==null?void 0:ee.comboMultiplier)??1,momentumScore:((ne=e.metrics)==null?void 0:ne.momentumScore)??0,topGoalId:((oe=e.metrics)==null?void 0:oe.topGoalId)??null,topGoalTitle:((V=e.metrics)==null?void 0:V.topGoalTitle)??null},users:(e.users??[]).map(Kr),strategies:(e.strategies??[]).map(Cc),userScope:{selectedUserIds:((w=e.userScope)==null?void 0:w.selectedUserIds)??[],selectedUsers:(((z=e.userScope)==null?void 0:z.selectedUsers)??[]).map(Kr)},dashboard:{stats:{totalPoints:((te=(ie=e.dashboard)==null?void 0:ie.stats)==null?void 0:te.totalPoints)??0,completedThisWeek:((X=(E=e.dashboard)==null?void 0:E.stats)==null?void 0:X.completedThisWeek)??0,activeGoals:((Z=(M=e.dashboard)==null?void 0:M.stats)==null?void 0:Z.activeGoals)??0,alignmentScore:((se=(O=e.dashboard)==null?void 0:O.stats)==null?void 0:se.alignmentScore)??0,focusTasks:((Me=(pe=e.dashboard)==null?void 0:pe.stats)==null?void 0:Me.focusTasks)??0,overdueTasks:((Ie=(Te=e.dashboard)==null?void 0:Te.stats)==null?void 0:Ie.overdueTasks)??0,dueThisWeek:((Ce=(xe=e.dashboard)==null?void 0:xe.stats)==null?void 0:Ce.dueThisWeek)??0},goals:(((Ne=e.dashboard)==null?void 0:Ne.goals)??[]).map(Ge=>({...Ge,...Zs(Ge)})),projects:n,tasks:(((we=e.dashboard)==null?void 0:we.tasks)??[]).map(pt),habits:(((Ue=e.dashboard)==null?void 0:Ue.habits)??e.habits??[]).map(vs),tags:(((Fe=e.dashboard)==null?void 0:Fe.tags)??[]).map(ea),suggestedTags:(((it=e.dashboard)==null?void 0:it.suggestedTags)??[]).map(ea),owners:((ze=e.dashboard)==null?void 0:ze.owners)??[],executionBuckets:(((Ke=e.dashboard)==null?void 0:Ke.executionBuckets)??[]).map(Ge=>({...Ge,tasks:(Ge.tasks??[]).map(pt)})),gamification:((tt=e.dashboard)==null?void 0:tt.gamification)??{totalXp:((mt=e.metrics)==null?void 0:mt.totalXp)??0,level:((D=e.metrics)==null?void 0:D.level)??1,currentLevelXp:((Q=e.metrics)==null?void 0:Q.currentLevelXp)??0,nextLevelXp:((C=e.metrics)==null?void 0:C.nextLevelXp)??120,xpIntoLevel:((W=e.metrics)==null?void 0:W.xpIntoLevel)??((S=e.metrics)==null?void 0:S.currentLevelXp)??0,xpToNextLevel:((ye=e.metrics)==null?void 0:ye.xpToNextLevel)??((ge=e.metrics)==null?void 0:ge.nextLevelXp)??120,currentLevelStartXp:((st=e.metrics)==null?void 0:st.currentLevelStartXp)??0,nextLevelTotalXp:((Rt=e.metrics)==null?void 0:Rt.nextLevelTotalXp)??(((Vt=e.metrics)==null?void 0:Vt.totalXp)??0)+(((Jt=e.metrics)==null?void 0:Jt.nextLevelXp)??120),levelCurveVersion:((Xt=e.metrics)==null?void 0:Xt.levelCurveVersion)??"legacy-linear-120",weeklyXp:((Qt=e.metrics)==null?void 0:Qt.weeklyXp)??0,streakDays:((Yt=e.metrics)==null?void 0:Yt.streakDays)??0,comboMultiplier:((Zt=e.metrics)==null?void 0:Zt.comboMultiplier)??1,momentumScore:((j=e.metrics)==null?void 0:j.momentumScore)??0,topGoalId:((L=e.metrics)==null?void 0:L.topGoalId)??null,topGoalTitle:((Y=e.metrics)==null?void 0:Y.topGoalTitle)??null},achievements:((qe=e.dashboard)==null?void 0:qe.achievements)??[],milestoneRewards:((_t=e.dashboard)==null?void 0:_t.milestoneRewards)??[],recentActivity:((ot=e.dashboard)==null?void 0:ot.recentActivity)??[],notesSummaryByEntity:((jt=e.dashboard)==null?void 0:jt.notesSummaryByEntity)??{}},overview:{generatedAt:((Et=e.overview)==null?void 0:Et.generatedAt)??new Date().toISOString(),strategicHeader:{streakDays:((An=(En=e.overview)==null?void 0:En.strategicHeader)==null?void 0:An.streakDays)??((On=e.metrics)==null?void 0:On.streakDays)??0,level:((Dn=(Ln=e.overview)==null?void 0:Ln.strategicHeader)==null?void 0:Dn.level)??(($n=e.metrics)==null?void 0:$n.level)??1,totalXp:((Fn=(Mn=e.overview)==null?void 0:Mn.strategicHeader)==null?void 0:Fn.totalXp)??((zn=e.metrics)==null?void 0:zn.totalXp)??0,currentLevelXp:((qn=(Wn=e.overview)==null?void 0:Wn.strategicHeader)==null?void 0:qn.currentLevelXp)??((Bn=e.metrics)==null?void 0:Bn.currentLevelXp)??0,nextLevelXp:((Hn=(Kn=e.overview)==null?void 0:Kn.strategicHeader)==null?void 0:Hn.nextLevelXp)??((Un=e.metrics)==null?void 0:Un.nextLevelXp)??120,momentumScore:((Vn=(Gn=e.overview)==null?void 0:Gn.strategicHeader)==null?void 0:Vn.momentumScore)??((Jn=e.metrics)==null?void 0:Jn.momentumScore)??0,focusTasks:((Qn=(Xn=e.overview)==null?void 0:Xn.strategicHeader)==null?void 0:Qn.focusTasks)??0,overdueTasks:((Zn=(Yn=e.overview)==null?void 0:Yn.strategicHeader)==null?void 0:Zn.overdueTasks)??0},projects:r,activeGoals:(((er=e.overview)==null?void 0:er.activeGoals)??[]).map(Ge=>({...Ge,...Zs(Ge)})),topTasks:(((tr=e.overview)==null?void 0:tr.topTasks)??[]).map(pt),dueHabits:(((sr=e.overview)==null?void 0:sr.dueHabits)??((ar=e.today)==null?void 0:ar.dueHabits)??((nr=e.dashboard)==null?void 0:nr.habits)??[]).map(vs),recentEvidence:((rr=e.overview)==null?void 0:rr.recentEvidence)??[],achievements:((ir=e.overview)==null?void 0:ir.achievements)??[],domainBalance:((or=e.overview)==null?void 0:or.domainBalance)??[],neglectedGoals:((lr=e.overview)==null?void 0:lr.neglectedGoals)??[]},today:{generatedAt:((cr=e.today)==null?void 0:cr.generatedAt)??new Date().toISOString(),directive:{task:(ur=(dr=e.today)==null?void 0:dr.directive)!=null&&ur.task?pt(e.today.directive.task):null,goalTitle:((pr=(mr=e.today)==null?void 0:mr.directive)==null?void 0:pr.goalTitle)??null,rewardXp:((gr=(hr=e.today)==null?void 0:hr.directive)==null?void 0:gr.rewardXp)??0,sessionLabel:((yr=(fr=e.today)==null?void 0:fr.directive)==null?void 0:yr.sessionLabel)??"No active session"},timeline:(((xr=e.today)==null?void 0:xr.timeline)??[]).map(Ge=>({...Ge,tasks:(Ge.tasks??[]).map(pt)})),dueHabits:(((br=e.today)==null?void 0:br.dueHabits)??((vr=e.overview)==null?void 0:vr.dueHabits)??((wr=e.dashboard)==null?void 0:wr.habits)??[]).map(vs),dailyQuests:((kr=e.today)==null?void 0:kr.dailyQuests)??[],milestoneRewards:((jr=e.today)==null?void 0:jr.milestoneRewards)??[],recentHabitRewards:((Sr=e.today)==null?void 0:Sr.recentHabitRewards)??[],momentum:{streakDays:((Pr=(Nr=e.today)==null?void 0:Nr.momentum)==null?void 0:Pr.streakDays)??0,momentumScore:((Ir=(Tr=e.today)==null?void 0:Tr.momentum)==null?void 0:Ir.momentumScore)??0,recoveryHint:((Rr=(Cr=e.today)==null?void 0:Cr.momentum)==null?void 0:Rr.recoveryHint)??""}},risk:{generatedAt:((_r=e.risk)==null?void 0:_r.generatedAt)??new Date().toISOString(),overdueTasks:(((Er=e.risk)==null?void 0:Er.overdueTasks)??[]).map(pt),blockedTasks:(((Ar=e.risk)==null?void 0:Ar.blockedTasks)??[]).map(pt),neglectedGoals:((Or=e.risk)==null?void 0:Or.neglectedGoals)??[],summary:((Lr=e.risk)==null?void 0:Lr.summary)??""},goals:(e.goals??[]).map(Zs),projects:a,tags:(e.tags??[]).map(ea),tasks:(e.tasks??[]).map(pt),habits:(e.habits??((Dr=e.dashboard)==null?void 0:Dr.habits)??[]).map(vs),activity:e.activity??[],activeTaskRuns:e.activeTaskRuns??[],lifeForce:e.lifeForce??{userId:"",dateKey:new Date().toISOString().slice(0,10),baselineDailyAp:200,dailyBudgetAp:200,spentTodayAp:0,remainingAp:200,forecastAp:0,plannedRemainingAp:0,targetBandMinAp:170,targetBandMaxAp:200,instantCapacityApPerHour:0,instantFreeApPerHour:0,overloadApPerHour:0,currentDrainApPerHour:0,fatigueBufferApPerHour:0,sleepRecoveryMultiplier:1,readinessMultiplier:1,fatigueDebtCarry:0,stats:[],currentCurve:[],activeDrains:[],plannedDrains:[],warnings:[],recommendations:[],topTaskIdsNeedingSplit:[],updatedAt:new Date(0).toISOString()}}}function Wa(e){const t=typeof e.location=="string"?e.location:"",a=e.place??{label:t,address:"",timezone:"",latitude:null,longitude:null,source:"",externalPlaceId:""};return{...e,place:{label:a.label||t,address:a.address??"",timezone:a.timezone??"",latitude:a.latitude??null,longitude:a.longitude??null,source:a.source??"",externalPlaceId:a.externalPlaceId??""}}}function _c(e){return{...Sc(e),events:e.events.map(Wa)}}async function ya(e){const t=await e.text();if(!t)return null;try{return JSON.parse(t)}catch{return t}}const Ec="/api/v1/diagnostics/logs",Ss="/api/v1/auth/operator-session",Ac="x-forge-source",Oc="ui";function qa(e){return typeof e=="object"&&e!==null?e:null}function Ba(e){const t=qa(e);return typeof(t==null?void 0:t.code)=="string"?t.code:typeof(t==null?void 0:t.error)=="string"?t.error:"request_failed"}function Lc(e,t){return e.status===401&&Ba(t)==="auth_required"}function Ji(e){return e===Ec}function Dc(e){return!!((e==null?void 0:e.body)===void 0||e.body===null||typeof e.body=="string"||typeof URLSearchParams<"u"&&e.body instanceof URLSearchParams||typeof FormData<"u"&&e.body instanceof FormData||typeof Blob<"u"&&e.body instanceof Blob||typeof ArrayBuffer<"u"&&e.body instanceof ArrayBuffer||ArrayBuffer.isView(e.body))}function Xi(e){return e.path!==Ss&&Lc(e.response,e.body)&&Dc(e.init)}function Ka(e,t,a){const n=qa(a),r=Array.isArray(n==null?void 0:n.details)?n.details:[];return new Es({status:t.status,code:Ba(a),message:typeof(n==null?void 0:n.error)=="string"?n.error:typeof(n==null?void 0:n.message)=="string"?n.message:typeof a=="string"?a:`Request failed: ${t.status}`,requestPath:e,details:r,response:typeof a=="string"||a&&typeof a=="object"?a:null})}function Ha(e,t,a){if(Ji(e))return;const n=qa(a),r=Array.isArray(n==null?void 0:n.details)?n.details:[];Hs({level:t.status>=500?"error":"warning",scope:"frontend_api",eventKey:"request_failed",message:`API request failed: ${e}`,route:e,functionName:"request",details:{statusCode:t.status,code:Ba(a),response:typeof a=="string"||a&&typeof a=="object"?a:null,validationIssues:r}})}async function xa(e,t){const a=await ba(e,t),n=await ya(a);return{response:a,body:n}}async function ba(e,t){const a=new Headers(t==null?void 0:t.headers);a.set(Ac,Oc),(t==null?void 0:t.body)!==void 0&&!(typeof FormData<"u"&&t.body instanceof FormData)&&!a.has("content-type")&&a.set("content-type","application/json");let n;try{n=await fetch(za(e),{...t,credentials:"same-origin",headers:a})}catch(r){throw Ji(e)||Hs({level:"error",scope:"frontend_api",eventKey:"request_network_failure",message:`API request failed before reaching Forge: ${e}`,route:e,functionName:"request",details:{error:r instanceof Error?{name:r.name,message:r.message,stack:r.stack??null}:String(r)}}),r}return n}let ws=null;async function Qi(){ws||(ws=(async()=>{const{response:e,body:t}=await xa(Ss);if(!e.ok)throw Ha(Ss,e,t),Ka(Ss,e,t)})().finally(()=>{ws=null})),await ws}async function d(e,t){let{response:a,body:n}=await xa(e,t);if(Xi({path:e,init:t,response:a,body:n})&&(await Qi(),{response:a,body:n}=await xa(e,t)),!a.ok)throw Ha(e,a,n),Ka(e,a,n);return n}async function Yi(e,t){let a=await ba(e,t),n=null;if(a.ok||(n=await ya(a)),Xi({path:e,init:t,response:a,body:n})&&(await Qi(),a=await ba(e,t),n=a.ok?null:await ya(a)),!a.ok)throw Ha(e,a,n),Ka(e,a,n);const r=a.headers.get("content-disposition"),o=r==null?void 0:r.match(/filename=\"([^\"]+)\"/i);return{blob:await a.blob(),fileName:(o==null?void 0:o[1])??null,mimeType:a.headers.get("content-type")||"application/octet-stream"}}function Us(e){return e.map(t=>({contentMarkdown:t.contentMarkdown.trim(),author:t.author.trim()||null})).filter(t=>t.contentMarkdown.length>0)}const $c="forge.selected-user-ids";function Mc(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem($c);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.filter(a=>typeof a=="string").map(a=>a.trim()).filter(Boolean):[]}catch{return[]}}function Fc(e){return e??Mc()}function G(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):void 0}function U(e,t){for(const a of Fc(t))a.trim()&&e.append("userIds",a.trim())}function zc(){return d("/api/v1/auth/operator-session")}function Wc(){return d("/api/v1/auth/operator-session",{method:"DELETE"})}function qc(e){const t=new URLSearchParams;U(t,G(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/context${a}`).then(Rc)}function hy(e){const t=new URLSearchParams;U(t,G(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/life-force${a}`)}function gy(e,t,a){const n=new URLSearchParams;U(n,G(a));const r=n.size>0?`?${n.toString()}`:"";return d(`/api/v1/life-force/templates/${e}${r}`,{method:"PUT",body:JSON.stringify(t)})}function fy(e,t){const a=new URLSearchParams;U(a,G(t));const n=a.size>0?`?${a.toString()}`:"";return d(`/api/v1/life-force/fatigue-signals${n}`,{method:"POST",body:JSON.stringify(e)})}function yy(e,t){var r;const a=new URLSearchParams;U(a,G(e)),(r=t==null?void 0:t.q)!=null&&r.trim()&&a.set("q",t.q.trim());for(const o of(t==null?void 0:t.entityKinds)??[])a.append("entityKind",o);for(const o of(t==null?void 0:t.relationKinds)??[])a.append("relationKind",o);for(const o of(t==null?void 0:t.tags)??[])a.append("tag",o);for(const o of(t==null?void 0:t.owners)??[])a.append("owner",o);t!=null&&t.updatedFrom&&a.set("updatedFrom",t.updatedFrom),t!=null&&t.updatedTo&&a.set("updatedTo",t.updatedTo),typeof(t==null?void 0:t.limit)=="number"&&Number.isFinite(t.limit)&&a.set("limit",String(t.limit)),t!=null&&t.focusNodeId&&a.set("focusNodeId",t.focusNodeId);const n=a.size>0?`?${a.toString()}`:"";return d(`/api/v1/knowledge-graph${n}`).then(o=>o.graph)}function xy(e){const t=new URLSearchParams;e.userId&&t.set("userId",e.userId),e.domain&&t.set("domain",e.domain),e.contextId&&t.set("contextId",e.contextId);const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/preferences/workspace${a}`)}function by(e){return d("/api/v1/preferences/game/start",{method:"POST",body:JSON.stringify(e)})}function vy(e){return d("/api/v1/preferences/catalogs",{method:"POST",body:JSON.stringify(e)})}function wy(e,t){return d(`/api/v1/preferences/catalogs/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function ky(e){return d(`/api/v1/preferences/catalogs/${e}`,{method:"DELETE"})}function jy(e){return d("/api/v1/preferences/catalog-items",{method:"POST",body:JSON.stringify(e)})}function Sy(e,t){return d(`/api/v1/preferences/catalog-items/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Ny(e){return d(`/api/v1/preferences/catalog-items/${e}`,{method:"DELETE"})}function Py(e){return d("/api/v1/preferences/contexts",{method:"POST",body:JSON.stringify(e)})}function Ty(e,t){return d(`/api/v1/preferences/contexts/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Iy(e){return d("/api/v1/preferences/contexts/merge",{method:"POST",body:JSON.stringify(e)})}function Cy(e){return d("/api/v1/preferences/items",{method:"POST",body:JSON.stringify(e)})}function Ry(e,t){return d(`/api/v1/preferences/items/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function _y(e){return d("/api/v1/preferences/items/from-entity",{method:"POST",body:JSON.stringify(e)})}function Ey(e){return d("/api/v1/preferences/judgments",{method:"POST",body:JSON.stringify(e)})}function Ay(e){return d("/api/v1/preferences/signals",{method:"POST",body:JSON.stringify(e)})}function Oy(e,t){return d(`/api/v1/preferences/items/${e}/score`,{method:"PATCH",body:JSON.stringify(t)})}function Ly(e){const t=new URLSearchParams;U(t,G(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/insights${a}`)}function Dy(e){const t=new URLSearchParams;U(t,G(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/psyche/overview${a}`)}function $y(){return d("/api/v1/psyche/metrics")}function My(e){const t=new URLSearchParams;U(t,G(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/psyche/questionnaires${a}`)}function Fy(e,t){const a=new URLSearchParams;U(a,G(t));const n=a.size>0?`?${a.toString()}`:"";return d(`/api/v1/psyche/questionnaires/${e}${n}`)}function zy(e){return d("/api/v1/psyche/questionnaires",{method:"POST",body:JSON.stringify(e)})}function Wy(e,t={}){return d(`/api/v1/psyche/questionnaires/${e}/clone`,{method:"POST",body:JSON.stringify(t)})}function qy(e){return d(`/api/v1/psyche/questionnaires/${e}/draft`,{method:"POST",body:JSON.stringify({})})}function By(e,t){return d(`/api/v1/psyche/questionnaires/${e}/draft`,{method:"PATCH",body:JSON.stringify(t)})}function Ky(e,t={}){return d(`/api/v1/psyche/questionnaires/${e}/publish`,{method:"POST",body:JSON.stringify(t)})}function Hy(e,t={}){return d(`/api/v1/psyche/questionnaires/${e}/runs`,{method:"POST",body:JSON.stringify(t)})}function Uy(e,t){const a=new URLSearchParams;U(a,G(t));const n=a.size>0?`?${a.toString()}`:"";return d(`/api/v1/psyche/questionnaire-runs/${e}${n}`)}function Gy(e,t){return d(`/api/v1/psyche/questionnaire-runs/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Vy(e){return d(`/api/v1/psyche/questionnaire-runs/${e}/complete`,{method:"POST",body:JSON.stringify({})})}function Bc(e){const t=new URLSearchParams;U(t,G(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/psyche/values${a}`)}function Jy(e){return d("/api/v1/psyche/values",{method:"POST",body:JSON.stringify(e)})}function Xy(e,t){return d(`/api/v1/psyche/values/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Kc(e){const t=new URLSearchParams;U(t,G(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/psyche/patterns${a}`)}function Qy(e){return d("/api/v1/psyche/patterns",{method:"POST",body:JSON.stringify(e)})}function Yy(e,t){return d(`/api/v1/psyche/patterns/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Hc(e){const t=new URLSearchParams;U(t,G(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/psyche/behaviors${a}`)}function Zy(e){return d("/api/v1/psyche/behaviors",{method:"POST",body:JSON.stringify(e)})}function ex(e,t){return d(`/api/v1/psyche/behaviors/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function tx(){return d("/api/v1/psyche/schema-catalog")}function Uc(e){const t=new URLSearchParams;U(t,G(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/psyche/beliefs${a}`)}function sx(e){return d("/api/v1/psyche/beliefs",{method:"POST",body:JSON.stringify(e)})}function ax(e,t){return d(`/api/v1/psyche/beliefs/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function nx(e){const t=new URLSearchParams;U(t,G(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/psyche/modes${a}`)}function rx(e){return d("/api/v1/psyche/modes",{method:"POST",body:JSON.stringify(e)})}function ix(e,t){return d(`/api/v1/psyche/modes/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function ox(){return d("/api/v1/psyche/mode-guides")}function lx(e){return d("/api/v1/psyche/mode-guides",{method:"POST",body:JSON.stringify(e)})}function Ua(e){if(e.ok!==!0||!e.entity){const t=typeof e.error=="object"&&e.error!==null?JSON.stringify(e.error):"Batch entity operation failed.";throw new Error(t)}return e.entity}async function cx(e){var n;return{flashcards:((n=(await so({searches:[{entityTypes:["flashcard"],userIds:G(e),limit:500}]})).results[0])==null?void 0:n.matches)??[]}}async function dx(e){const t=await hd({operations:[{entityType:"flashcard",data:e}],atomic:!0});return{flashcard:Ua(t.results[0]??{})}}async function ux(e,t){const a=await gd({operations:[{entityType:"flashcard",id:e,patch:t}],atomic:!0});return{flashcard:Ua(a.results[0]??{})}}async function mx(e){const t=await fd({operations:[{entityType:"flashcard",id:e}],atomic:!0});return{flashcard:Ua(t.results[0]??{})}}function px(){return d("/api/v1/psyche/event-types")}function hx(){return d("/api/v1/psyche/emotions")}function Gc(e){const t=new URLSearchParams;U(t,G(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/psyche/reports${a}`)}function gx(e){return d("/api/v1/psyche/reports",{method:"POST",body:JSON.stringify(e)})}function fx(e){return d(`/api/v1/psyche/reports/${e}`)}function yx(e,t){return d(`/api/v1/psyche/reports/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function xx(e={}){const t=new URLSearchParams;e.linkedEntityType&&t.set("linkedEntityType",e.linkedEntityType),e.linkedEntityId&&t.set("linkedEntityId",e.linkedEntityId),e.anchorKey!==void 0&&e.anchorKey!==null&&t.set("anchorKey",e.anchorKey);for(const n of e.linkedTo??[])t.append("linkedTo",`${n.entityType}:${n.entityId}`);for(const n of e.tags??[])n.trim()&&t.append("tags",n.trim());for(const n of e.textTerms??[])n.trim()&&t.append("textTerms",n.trim());e.author&&t.set("author",e.author),e.query&&t.set("query",e.query),U(t,e.userIds),e.updatedFrom&&t.set("updatedFrom",e.updatedFrom),e.updatedTo&&t.set("updatedTo",e.updatedTo),e.limit&&t.set("limit",String(e.limit));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/notes${a}`)}function Vc(e){return d("/api/v1/notes",{method:"POST",body:JSON.stringify(e)})}function bx(e){return d(`/api/v1/notes/${e}`)}function vx(e,t){return d(`/api/v1/notes/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function wx(e,t="soft"){const a=t==="soft"?"":`?mode=${t}`;return d(`/api/v1/notes/${e}${a}`,{method:"DELETE"})}function kx(){return d("/api/v1/wiki/settings")}function jx(e){return d("/api/v1/wiki/spaces",{method:"POST",body:JSON.stringify(e)})}function Sx(e={}){const t=new URLSearchParams;e.spaceId&&t.set("spaceId",e.spaceId),e.kind&&t.set("kind",e.kind),e.limit&&t.set("limit",String(e.limit));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/wiki/pages${a}`)}function Nx(e){return d(`/api/v1/wiki/pages/${e}`)}function Px(e={}){var a;const t=new URLSearchParams;return(a=e.spaceId)!=null&&a.trim()&&t.set("spaceId",e.spaceId.trim()),d(`/api/v1/wiki/home${t.size>0?`?${t.toString()}`:""}`)}function Tx(e){var a;const t=new URLSearchParams;return(a=e.spaceId)!=null&&a.trim()&&t.set("spaceId",e.spaceId.trim()),d(`/api/v1/wiki/by-slug/${encodeURIComponent(e.slug)}${t.size>0?`?${t.toString()}`:""}`)}function Ix(e={}){var a;const t=new URLSearchParams;return(a=e.spaceId)!=null&&a.trim()&&t.set("spaceId",e.spaceId.trim()),e.kind&&t.set("kind",e.kind),d(`/api/v1/wiki/tree${t.size>0?`?${t.toString()}`:""}`)}function Jc(e){return d("/api/v1/wiki/pages",{method:"POST",body:JSON.stringify({kind:e.kind??"wiki",title:e.title,slug:e.slug??"",parentSlug:e.parentSlug??null,indexOrder:e.indexOrder??0,showInIndex:e.showInIndex??!0,aliases:e.aliases??[],summary:e.summary??"",contentMarkdown:e.contentMarkdown,author:e.author??null,tags:e.tags??[],spaceId:e.spaceId??"",frontmatter:e.frontmatter??{},links:e.links??[]})})}function Cx(e,t){return d(`/api/v1/wiki/pages/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Rx(e,t="soft"){const a=new URLSearchParams;return a.set("mode",t),d(`/api/v1/wiki/pages/${e}?${a.toString()}`,{method:"DELETE"})}function _x(e){return d("/api/v1/wiki/search",{method:"POST",body:JSON.stringify(e)})}function Ex(e={}){return d("/api/v1/wiki/sync",{method:"POST",body:JSON.stringify(e)})}function Ax(e={}){return d("/api/v1/wiki/reindex",{method:"POST",body:JSON.stringify(e)})}function Ox(e){return d("/api/v1/wiki/settings/embedding-profiles",{method:"POST",body:JSON.stringify(e)})}function Lx(e,t){return d(`/api/v1/wiki/settings/${e}-profiles/${t}`,{method:"DELETE"})}function Dx(e){return d("/api/v1/wiki/ingest-jobs",{method:"POST",body:JSON.stringify(e)})}function $x(e){var a,n,r;const t=new FormData;return(a=e.spaceId)!=null&&a.trim()&&t.set("spaceId",e.spaceId.trim()),(n=e.titleHint)!=null&&n.trim()&&t.set("titleHint",e.titleHint.trim()),(r=e.llmProfileId)!=null&&r.trim()&&t.set("llmProfileId",e.llmProfileId.trim()),t.set("parseStrategy",e.parseStrategy??"auto"),t.set("entityProposalMode",e.entityProposalMode??"suggest"),t.set("createAsKind",e.createAsKind??"wiki"),t.set("linkedEntityHints",JSON.stringify(e.linkedEntityHints??[])),e.files.forEach(o=>{t.append("files",o)}),d("/api/v1/wiki/ingest-jobs/uploads",{method:"POST",body:t})}function Xc(e={}){var a;const t=new URLSearchParams;return(a=e.spaceId)!=null&&a.trim()&&t.set("spaceId",e.spaceId.trim()),typeof e.limit=="number"&&t.set("limit",String(e.limit)),d(`/api/v1/wiki/ingest-jobs${t.size>0?`?${t.toString()}`:""}`)}function Mx(e){return d(`/api/v1/wiki/ingest-jobs/${e}`)}function Fx(e){return d("/api/v1/wiki/search",{method:"POST",body:JSON.stringify({spaceId:e.spaceId,kind:e.kind,mode:e.mode??"text",query:e.query??"",profileId:e.profileId,limit:e.limit??8})})}function zx(e){return d(`/api/v1/wiki/ingest-jobs/${e}`,{method:"DELETE"})}function Wx(e){return d(`/api/v1/wiki/ingest-jobs/${e}/rerun`,{method:"POST"})}function qx(e){return d(`/api/v1/wiki/ingest-jobs/${e}/resume`,{method:"POST"})}function Bx(e){return d(`/api/v1/wiki/ingest-jobs/${e.jobId}/review`,{method:"POST",body:JSON.stringify({decisions:e.decisions})})}function Kx(e){return d("/api/v1/insights",{method:"POST",body:JSON.stringify({...e,originAgentId:e.originAgentId||null,originLabel:e.originLabel||null,entityType:e.entityType||null,entityId:e.entityId||null,timeframeLabel:e.timeframeLabel||null,visibility:"visible",status:"open",evidence:[]})})}function Hx(e){return d(`/api/v1/insights/${e}`,{method:"DELETE"})}function Ux(e,t,a=""){return d(`/api/v1/insights/${e}/feedback`,{method:"POST",body:JSON.stringify({feedbackType:t,note:a})})}function Gx(){return d("/api/v1/reviews/weekly")}function Vx(){return d("/api/v1/reviews/weekly/finalize",{method:"POST"})}function Jx(e={}){const t=new URLSearchParams;e.from&&t.set("from",e.from),e.to&&t.set("to",e.to),U(t,G(e.userIds));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/calendar/overview${a}`).then(n=>({...n,calendar:_c(n.calendar)}))}function Xx(e={}){const t=new URLSearchParams;e.from&&t.set("from",e.from),e.to&&t.set("to",e.to),U(t,G(e.userIds));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/psyche/self-observation/calendar${a}`)}function Qx(e){var a;const t=new URLSearchParams;e.from&&t.set("from",e.from),e.to&&t.set("to",e.to),(a=e.search)!=null&&a.trim()&&t.set("search",e.search.trim()),e.includeObservations!==void 0&&t.set("includeObservations",String(e.includeObservations)),e.includeActivity!==void 0&&t.set("includeActivity",String(e.includeActivity)),e.onlyHumanOwned!==void 0&&t.set("onlyHumanOwned",String(e.onlyHumanOwned));for(const n of e.tags??[]){const r=n.trim();r&&t.append("tags",r)}return t.set("format",e.format),U(t,G(e.userIds)),Yi(`/api/v1/psyche/self-observation/calendar/export?${t.toString()}`)}function Yx(){return d("/api/v1/calendar/connections")}function Zx(e){return d("/api/v1/calendar/discovery",{method:"POST",body:JSON.stringify(e)}).then(t=>({...t,discovery:ps(t.discovery)}))}function eb(){return d("/api/v1/calendar/macos-local/status")}function tb(){return d("/api/v1/calendar/macos-local/request-access",{method:"POST"})}function sb(){return d("/api/v1/calendar/macos-local/discovery").then(e=>({...e,discovery:{...e.discovery,sources:e.discovery.sources.map(t=>({...t,calendars:ps({provider:"macos_local",accountLabel:t.accountLabel,serverUrl:"forge-macos-local://eventkit/",principalUrl:null,homeUrl:null,calendars:t.calendars}).calendars}))}}))}function ab(e){return d("/api/v1/calendar/oauth/google/start",{method:"POST",body:JSON.stringify(e)})}function nb(e){return d(`/api/v1/calendar/oauth/google/session/${e}`).then(t=>({...t,session:{...t.session,discovery:t.session.discovery?ps(t.session.discovery):null}}))}function rb(e){return d("/api/v1/calendar/oauth/microsoft/start",{method:"POST",body:JSON.stringify(e)})}function ib(e){return d("/api/v1/calendar/oauth/microsoft/test-config",{method:"POST",body:JSON.stringify(e)})}function ob(e){return d(`/api/v1/calendar/oauth/microsoft/session/${e}`).then(t=>({...t,session:{...t.session,discovery:t.session.discovery?ps(t.session.discovery):null}}))}function lb(e){return d(`/api/v1/calendar/connections/${e}/discovery`).then(t=>({...t,discovery:ps(t.discovery)}))}function cb(e){return d("/api/v1/calendar/connections",{method:"POST",body:JSON.stringify(e)})}function db(e){return d(`/api/v1/calendar/connections/${e}/sync`,{method:"POST"})}function ub(e,t){return d(`/api/v1/calendar/connections/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function mb(e){return d(`/api/v1/calendar/connections/${e}`,{method:"DELETE"})}function pb(){return d("/api/v1/calendar/calendars")}function hb(e){return d("/api/v1/calendar/work-block-templates",{method:"POST",body:JSON.stringify(e)})}function gb(e,t){return d(`/api/v1/calendar/work-block-templates/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function fb(e){return d(`/api/v1/calendar/work-block-templates/${e}`,{method:"DELETE"})}function yb(e){return d("/api/v1/calendar/events",{method:"POST",body:JSON.stringify(e)}).then(t=>({...t,event:Wa(t.event)}))}function xb(e,t){return d(`/api/v1/calendar/events/${e}`,{method:"PATCH",body:JSON.stringify(t)}).then(a=>({...a,event:Wa(a.event)}))}function bb(e){return d(`/api/v1/calendar/events/${e}`,{method:"DELETE"})}function vb(e){return d("/api/v1/calendar/timeboxes",{method:"POST",body:JSON.stringify(e)})}function wb(e,t){return d(`/api/v1/calendar/timeboxes/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function kb(e){return d(`/api/v1/calendar/timeboxes/${e}`,{method:"DELETE"})}function jb(e){return d("/api/v1/calendar/timeboxes/recommend",{method:"POST",body:JSON.stringify(e)})}function Sb(e={}){const t=new URLSearchParams;U(t,e.userIds),e.status&&t.set("status",e.status),e.polarity&&t.set("polarity",e.polarity),e.dueToday&&t.set("dueToday","true"),e.orderBy&&t.set("orderBy",e.orderBy),e.limit&&t.set("limit",String(e.limit));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/habits${a}`)}function Nb(e){return d("/api/v1/habits",{method:"POST",body:JSON.stringify({...e,linkedBehaviorId:e.linkedBehaviorId||null})})}function Pb(e,t){return d(`/api/v1/habits/${e}`,{method:"PATCH",body:JSON.stringify({...t,linkedBehaviorId:t.linkedBehaviorId===""?null:t.linkedBehaviorId})})}function Tb(e){return d(`/api/v1/habits/${e}`,{method:"DELETE"})}function Ib(e,t){return d(`/api/v1/habits/${e}/check-ins`,{method:"POST",body:JSON.stringify(t)})}function Cb(e,t){return d(`/api/v1/habits/${e}/check-ins/${encodeURIComponent(t)}`,{method:"DELETE"})}function Rb(e){return d(`/api/v1/projects/${e}/board`)}function _b(e){const t=new URLSearchParams;if(e!=null&&e.projectId&&t.set("projectId",e.projectId),e!=null&&e.goalId&&t.set("goalId",e.goalId),Array.isArray(e==null?void 0:e.levels)&&e.levels.length>0&&t.set("levels",e.levels.join(",")),Array.isArray(e==null?void 0:e.userIds))for(const n of e.userIds)typeof n=="string"&&n.trim().length>0&&t.append("userIds",n);if(Array.isArray(e==null?void 0:e.assigneeIds))for(const n of e.assigneeIds)typeof n=="string"&&n.trim().length>0&&t.append("assigneeIds",n);const a=t.toString().length>0?`?${t.toString()}`:"";return d(`/api/v1/work-items/hierarchy${a}`)}function Eb(){return d("/api/v1/operator/context")}function Zi(){return d("/api/v1/settings")}function Qc(){return d("/api/v1/doctor")}function Yc(e){return d("/api/v1/doctor/fixes",{method:"POST",body:JSON.stringify(e)})}function Ab(e){return d("/api/v1/settings/models/connections",{method:"POST",body:JSON.stringify(e)})}function Ob(e){return d(`/api/v1/settings/models/connections/${e}`,{method:"DELETE"})}function Lb(e){return d("/api/v1/settings/models/connections/test",{method:"POST",body:JSON.stringify(e)})}function Db(){return d("/api/v1/settings/models/oauth/openai-codex/start",{method:"POST"})}function $b(e){return d(`/api/v1/settings/models/oauth/openai-codex/session/${e}`)}function Mb(e,t){return d(`/api/v1/settings/models/oauth/openai-codex/session/${e}/manual`,{method:"POST",body:JSON.stringify({codeOrUrl:t})})}function Fb(e){return d(`/api/v1/surfaces/${e}/layout`)}function zb(e,t){return d(`/api/v1/surfaces/${e}/layout`,{method:"PUT",body:JSON.stringify(t)})}function Wb(e){return d(`/api/v1/surfaces/${e}/layout/reset`,{method:"POST"})}function Zc(){return d("/api/v1/workbench/flows")}function qb(e){return d("/api/v1/workbench/flows",{method:"POST",body:JSON.stringify(e)})}function ed(e){return d(`/api/v1/workbench/flows/${e}`)}function td(e,t){return d(`/api/v1/workbench/flows/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function sd(e){return d(`/api/v1/workbench/flows/${e}`,{method:"DELETE"})}function ad(e,t){return d(`/api/v1/workbench/flows/${e}/run`,{method:"POST",body:JSON.stringify(t)})}function nd(e,t){return d(`/api/v1/workbench/flows/${e}/chat`,{method:"POST",body:JSON.stringify(t)})}function rd(e,t){return d(`/api/v1/workbench/flows/${e}/runs/${t}`)}function id(e,t){return d(`/api/v1/workbench/flows/${e}/runs/${t}/nodes`)}function od(e,t,a){return d(`/api/v1/workbench/flows/${e}/runs/${t}/nodes/${a}`)}function ld(e,t){return d(`/api/v1/workbench/flows/${e}/nodes/${t}/output`)}function Bb(e){const t=new URLSearchParams;U(t,G(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/health/overview${a}`)}function cd(e){const t=new URLSearchParams;U(t,G(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/health/sleep${a}`)}function Kb(e){return d(`/api/v1/health/sleep/${e}/raw`)}function Hb(e){const t=new URLSearchParams;U(t,G(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/health/fitness${a}`)}function Ub(e){const t=new URLSearchParams;U(t,G(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/health/training-load${a}`)}function Gb(e,t="adaptive"){const a=new URLSearchParams({resolution:t});return d(`/api/v1/health/workouts/${e}/detail?${a.toString()}`)}function Vb(e){const t=new URLSearchParams;U(t,G(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/health/vitals${a}`)}function Jb(e){const t=new URLSearchParams;U(t,G(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/health/weight-loss${a}`)}function Xb(e){const t=new URLSearchParams;U(t,G(e.userIds));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/health/weight-loss/foods/search${a}`,{method:"POST",body:JSON.stringify({query:e.query,limit:e.limit})})}function Qb(e){const t=new URLSearchParams;U(t,G(e.userIds));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/health/weight-loss/foods/barcode${a}`,{method:"POST",body:JSON.stringify({barcode:e.barcode})})}function Yb(e,t){const a=new URLSearchParams;U(a,G(t));const n=a.size>0?`?${a.toString()}`:"";return d(`/api/v1/health/weight-loss/food-logs${n}`,{method:"POST",body:JSON.stringify(e)})}function Zb(e){const t=new URLSearchParams;U(t,G(e.userIds));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/health/weight-loss/parse${a}`,{method:"POST",body:JSON.stringify({text:e.text,imageDescription:e.imageDescription,loggedAt:e.loggedAt,mealLabel:e.mealLabel})})}function ev(e,t){const a=new URLSearchParams;U(a,G(t));const n=a.size>0?`?${a.toString()}`:"";return d(`/api/v1/health/weight-loss/body-checkins${n}`,{method:"POST",body:JSON.stringify(e)})}function tv(e,t){const a=new URLSearchParams;U(a,G(t));const n=a.size>0?`?${a.toString()}`:"";return d(`/api/v1/health/weight-loss/appearance-checkins${n}`,{method:"POST",body:JSON.stringify(e)})}function sv(e,t){const a=new URLSearchParams;U(a,G(t));const n=a.size>0?`?${a.toString()}`:"";return d(`/api/v1/health/weight-loss/subjective-checkins${n}`,{method:"POST",body:JSON.stringify(e)})}function av(e,t){const a=new URLSearchParams;U(a,G(t));const n=a.size>0?`?${a.toString()}`:"";return d(`/api/v1/health/weight-loss/gut-checkins${n}`,{method:"POST",body:JSON.stringify(e)})}function nv(e){const t=new URLSearchParams;e!=null&&e.date&&t.set("date",e.date),U(t,G(e==null?void 0:e.userIds));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/movement/day${a}`)}function rv(e){const t=new URLSearchParams;e!=null&&e.month&&t.set("month",e.month),U(t,G(e==null?void 0:e.userIds));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/movement/month${a}`)}function iv(e){const t=new URLSearchParams;U(t,G(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/movement/all-time${a}`)}function ov(e){const t=new URLSearchParams;U(t,G(e==null?void 0:e.userIds));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/screen-time/day${a}`)}function lv(e){const t=new URLSearchParams;U(t,G(e==null?void 0:e.userIds));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/screen-time/month${a}`)}function cv(e){const t=new URLSearchParams;U(t,G(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/screen-time/all-time${a}`)}function dv(e){const t=new URLSearchParams;U(t,G(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/screen-time/settings${a}`)}function uv(e){const t=new URLSearchParams;U(t,G(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/movement/settings${a}`)}function mv(e,t){const a=new URLSearchParams;U(a,G(t));const n=a.size>0?`?${a.toString()}`:"";return d(`/api/v1/movement/settings${n}`,{method:"PATCH",body:JSON.stringify(e)})}function pv(e){const t=new URLSearchParams;U(t,G(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/movement/places${a}`)}function hv(e,t){const a=new URLSearchParams;U(a,G(t));const n=a.size>0?`?${a.toString()}`:"";return d(`/api/v1/movement/places${n}`,{method:"POST",body:JSON.stringify(e)})}function gv(e,t){return d(`/api/v1/movement/places/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function fv(e,t){return d(`/api/v1/movement/stays/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function yv(e){return d(`/api/v1/movement/trips/${e}`)}function xv(e,t){const a=new URLSearchParams;U(a,G(t));const n=a.size>0?`?${a.toString()}`:"";return d(`/api/v1/movement/boxes/${e}${n}`)}function bv(e){const t=new URLSearchParams;e!=null&&e.before&&t.set("before",e.before),typeof(e==null?void 0:e.limit)=="number"&&t.set("limit",String(e.limit)),e!=null&&e.includeInvalid&&t.set("includeInvalid","true"),U(t,G(e==null?void 0:e.userIds));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/movement/timeline${a}`)}function vv(e,t){const a=new URLSearchParams;U(a,G(t));const n=a.size>0?`?${a.toString()}`:"";return d(`/api/v1/movement/user-boxes${n}`,{method:"POST",body:JSON.stringify(e)})}function wv(e,t){const a=new URLSearchParams;U(a,G(t));const n=a.size>0?`?${a.toString()}`:"";return d(`/api/v1/movement/user-boxes/preflight${n}`,{method:"POST",body:JSON.stringify(e)})}function kv(e,t,a){const n=new URLSearchParams;U(n,G(a));const r=n.size>0?`?${n.toString()}`:"";return d(`/api/v1/movement/user-boxes/${e}${r}`,{method:"PATCH",body:JSON.stringify(t)})}function jv(e,t){const a=new URLSearchParams;U(a,G(t));const n=a.size>0?`?${a.toString()}`:"";return d(`/api/v1/movement/user-boxes/${e}${n}`,{method:"DELETE"})}function Sv(e,t,a){const n=new URLSearchParams;U(n,G(a));const r=n.size>0?`?${n.toString()}`:"";return d(`/api/v1/movement/automatic-boxes/${e}/invalidate${r}`,{method:"POST",body:JSON.stringify(t)})}function Nv(e){return d("/api/v1/movement/selection",{method:"POST",body:JSON.stringify(e)})}function Pv(e){return d("/api/v1/health/pairing-sessions",{method:"POST",body:JSON.stringify(e??{})})}function Tv(e){return d(`/api/v1/health/pairing-sessions/${e}`,{method:"DELETE"})}function Iv(e,t,a){return d(`/api/v1/health/pairing-sessions/${e}/sources/${t}`,{method:"PATCH",body:JSON.stringify({desiredEnabled:a})})}function Cv(e){return d("/api/v1/health/pairing-sessions/revoke-all",{method:"POST",body:JSON.stringify(e??{})})}function Rv(e,t){return d(`/api/v1/health/workouts/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function dd(e,t){return d(`/api/v1/health/sleep/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function _v(){return d("/api/v1/users/directory")}function Ev(e,t){return d(`/api/v1/users/access-grants/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Av(e){return d("/api/v1/users",{method:"POST",body:JSON.stringify(e)})}function Ov(e,t){return d(`/api/v1/users/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Lv(e){return d("/api/v1/strategies",{method:"POST",body:JSON.stringify(e)})}function Dv(e){return d(`/api/v1/strategies/${e}`)}function $v(e,t){return d(`/api/v1/strategies/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Mv(e){return d(`/api/v1/strategies/${e}`,{method:"DELETE"})}function Fv(){return d("/api/v1/settings/bin")}function zv(){return d("/api/v1/settings/data")}function Wv(e){return d("/api/v1/settings/data",{method:"PATCH",body:JSON.stringify(e)})}function qv(){return d("/api/v1/settings/data/scan",{method:"POST",body:JSON.stringify({})})}function Bv(e=""){return d("/api/v1/settings/data/backups",{method:"POST",body:JSON.stringify({note:e})})}function Kv(e,t=!0){return d(`/api/v1/settings/data/backups/${e}/restore`,{method:"POST",body:JSON.stringify({createSafetyBackup:t})})}function Hv(e){return d("/api/v1/settings/data/switch-root",{method:"POST",body:JSON.stringify(e)})}function Uv(e){return Yi(`/api/v1/settings/data/export?format=${e}`)}function Gv(){return d("/api/v1/agents/sessions")}function Vv(e){return d(`/api/v1/agents/sessions/${e}/history`)}function Jv(e,t=""){return d(`/api/v1/agents/sessions/${e}/reconnect`,{method:"POST",body:JSON.stringify({note:t})})}function Xv(e,t={}){return d(`/api/v1/agents/sessions/${e}/disconnect`,{method:"POST",body:JSON.stringify(t)})}function Qv(){return d("/api/v1/agents/onboarding")}function Yv(){return d("/api/v1/approval-requests")}function Zv(e,t=""){return d(`/api/v1/approval-requests/${e}/approve`,{method:"POST",body:JSON.stringify({note:t})})}function ew(e,t=""){return d(`/api/v1/approval-requests/${e}/reject`,{method:"POST",body:JSON.stringify({note:t})})}function tw(){return d("/api/v1/rewards/rules")}function sw(e,t){return d(`/api/v1/rewards/rules/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function aw(e){return d("/api/v1/rewards/bonus",{method:"POST",body:JSON.stringify(e)})}function nw(e=50){return d(`/api/v1/rewards/ledger?limit=${e}`)}function ud(e){const t=new URLSearchParams;U(t,G(e));const a=t.toString()?`?${t}`:"";return d(`/api/v1/metrics/xp${a}`)}function rw(e){const t=new URLSearchParams;U(t,G(e));const a=t.toString()?`?${t}`:"";return d(`/api/v1/gamification/catalog${a}`)}function eo(){return d("/api/v1/gamification/assets")}function to(e){return d("/api/v1/gamification/assets/install",{method:"POST",body:JSON.stringify({style:e})})}function iw(e,t){const a=new URLSearchParams;U(a,G(t));const n=a.toString()?`?${a}`:"";return d(`/api/v1/gamification/equipment${n}`,{method:"PUT",body:JSON.stringify(e)})}function md(e){return d(`/api/v1/gamification/celebrations/${e}/seen`,{method:"POST"})}function pd(e){return d("/api/v1/settings",{method:"PATCH",body:JSON.stringify(e)})}function hd(e){return d("/api/v1/entities/create",{method:"POST",body:JSON.stringify(e)})}function gd(e){return d("/api/v1/entities/update",{method:"POST",body:JSON.stringify(e)})}function fd(e){return d("/api/v1/entities/delete",{method:"POST",body:JSON.stringify(e)})}function ow(e){return d("/api/v1/entities/restore",{method:"POST",body:JSON.stringify(e)})}function so(e){return d("/api/v1/entities/search",{method:"POST",body:JSON.stringify(e)})}function lw(e){return d("/api/v1/settings/tokens",{method:"POST",body:JSON.stringify(e)})}function cw(e){return d(`/api/v1/settings/tokens/${e}/rotate`,{method:"POST"})}function dw(e){return d(`/api/v1/settings/tokens/${e}/revoke`,{method:"POST"})}function uw(e={}){const t=new URLSearchParams;return t.set("limit",String(e.limit??100)),e.entityType&&t.set("entityType",e.entityType),e.entityId&&t.set("entityId",e.entityId),e.includeCorrected&&t.set("includeCorrected","true"),U(t,G(e.userIds)),d(`/api/v1/activity?${t.toString()}`)}function mw(e={}){const t=new URLSearchParams;return t.set("limit",String(e.limit??200)),e.level&&t.set("level",e.level),e.source&&t.set("source",e.source),e.scope&&t.set("scope",e.scope),e.route&&t.set("route",e.route),e.entityType&&t.set("entityType",e.entityType),e.entityId&&t.set("entityId",e.entityId),e.jobId&&t.set("jobId",e.jobId),e.search&&t.set("search",e.search),e.beforeCreatedAt&&t.set("beforeCreatedAt",e.beforeCreatedAt),e.beforeId&&t.set("beforeId",e.beforeId),d(`/api/v1/diagnostics/logs?${t.toString()}`)}function ao(e){return d("/api/v1/goals",{method:"POST",body:JSON.stringify({...e,notes:Us(e.notes)})})}function no(e){return d("/api/v1/projects",{method:"POST",body:JSON.stringify({...e,notes:Us(e.notes)})})}function yd(e,t){return d(`/api/v1/projects/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function pw(e,t="soft"){return d(`/api/v1/projects/${e}${t==="hard"?"?mode=hard":""}`,{method:"DELETE"})}function xd(e,t){return d(`/api/v1/goals/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function hw(e){return d(`/api/v1/goals/${e}`,{method:"DELETE"})}function bd(e){const t={...e,goalId:e.goalId||null,projectId:e.projectId||null,parentWorkItemId:e.parentWorkItemId||null,dueDate:e.dueDate||null,plannedDurationSeconds:e.plannedDurationSeconds===void 0?null:e.plannedDurationSeconds,notes:Us(e.notes)};return d("/api/v1/tasks",{method:"POST",body:JSON.stringify(t)})}function vd(e){const t={...e,goalId:e.goalId||null,projectId:e.projectId||null,parentWorkItemId:e.parentWorkItemId||null,dueDate:e.dueDate||null,plannedDurationSeconds:e.plannedDurationSeconds===void 0?null:e.plannedDurationSeconds,notes:Us(e.notes)};return d("/api/v1/work-items",{method:"POST",body:JSON.stringify(t)})}function Hr(e,t){return d(`/api/v1/tasks/${e}`,{method:"PATCH",body:JSON.stringify({...t,goalId:t.goalId===""?null:t.goalId,projectId:t.projectId===""?null:t.projectId,parentWorkItemId:t.parentWorkItemId===""?null:t.parentWorkItemId,dueDate:t.dueDate===""?null:t.dueDate,plannedDurationSeconds:t.plannedDurationSeconds===void 0?void 0:t.plannedDurationSeconds})})}function gw(e,t){return d(`/api/v1/tasks/${e}/split`,{method:"POST",body:JSON.stringify(t)})}function fw(e){return d(`/api/v1/tasks/${e}`,{method:"DELETE"})}function yw(e){return d(`/api/v1/tasks/${e}/uncomplete`,{method:"POST",body:JSON.stringify({})})}function xw(e){return d(`/api/v1/tasks/${e}/context`)}function bw(e){return d("/api/v1/operator/log-work",{method:"POST",body:JSON.stringify(e)})}function vw(e){return d("/api/v1/work-adjustments",{method:"POST",body:JSON.stringify(e)})}function ww(e,t="Removed from the visible archive."){return d(`/api/v1/activity/${e}/remove`,{method:"POST",body:JSON.stringify({reason:t})})}function wd(e){return d("/api/v1/session-events",{method:"POST",body:JSON.stringify(e)})}function kd(e,t){return d(`/api/v1/tasks/${e}/runs`,{method:"POST",body:JSON.stringify(t)})}function jd(){return d("/api/v1/git-helper/overview")}function Sd(e){var a,n;const t=new URLSearchParams;return t.set("kind",e.kind),(a=e.query)!=null&&a.trim()&&t.set("query",e.query.trim()),(n=e.repository)!=null&&n.trim()&&t.set("repository",e.repository.trim()),d(`/api/v1/git-helper/search?${t.toString()}`)}function Nd(e,t){return d(`/api/v1/task-runs/${e}/heartbeat`,{method:"POST",body:JSON.stringify(t)})}function Pd(e,t={}){return d(`/api/v1/task-runs/${e}/focus`,{method:"POST",body:JSON.stringify(t)})}function Td(e,t){return d(`/api/v1/task-runs/${e}/complete`,{method:"POST",body:JSON.stringify(t)})}function Id(e,t){return d(`/api/v1/task-runs/${e}/release`,{method:"POST",body:JSON.stringify(t)})}const Cd=[{value:"dramatic-smithie",label:"Fantasy",description:"Warm, lighthearted 3D forge art with brighter mascot reactions and playful trophies."},{value:"dark-fantasy",label:"Dark Fantasy",description:"Obsidian iron, ember gold, high-pressure streak energy, and mythic trophy silhouettes."},{value:"mind-locksmith",label:"Mind Locksmith",description:"Modern locksmith-of-the-mind art for planning, memory, Psyche, health, and agent work."}],Wt="dramatic-smithie",kw=["item-trophy-xp-levels-the-first-heat","item-trophy-tasks-anvil-marathon","item-unlock-streaks-molten-crown-fire"];function hs(e){return Cd.some(t=>t.value===e)?e:Wt}function Ns(e,t=512,a=Wt){const n="/forge/",r=n.endsWith("/")?n:`${n}/`,o=hs(a),i=e.startsWith("item-")?"items":e.startsWith("mascot-")?"mascots":"";return`${r}gamification/sprites/themes/${o}/${i?`${i}/`:""}${e}-${t}.webp`}function va(e=Wt){const t="/forge/",a=t.endsWith("/")?t:`${t}/`,n=hs(e);return`${a}gamification-previews/${n}-mascot.webp`}function jw(e,t){const a="/forge/",n=a.endsWith("/")?a:`${a}/`,r=hs(e);return`${n}gamification-previews/${r}-${t}.webp`}function ro(){var t;const e=Ks({queryKey:["forge-settings"],queryFn:Zi,staleTime:3e4});return hs(((t=e==null?void 0:e.data)==null?void 0:t.settings.gamificationTheme)??Wt)}const Ve={totalXp:0,level:1,currentLevelXp:0,nextLevelXp:100,levelCurveVersion:"smith-forge",weeklyXp:0,streakDays:0,comboMultiplier:1,momentumScore:0,topGoalId:null,topGoalTitle:null};function Ps(e){e.currentTarget.hidden=!0}function io(e){const t=(e==null?void 0:e.totalXp)??Ve.totalXp,a=Math.max(1,(e==null?void 0:e.level)??Ve.level),n=(e==null?void 0:e.xpIntoLevel)??(e==null?void 0:e.currentLevelXp)??Ve.currentLevelXp,r=Math.max(1,(e==null?void 0:e.nextLevelXp)??Ve.nextLevelXp),o=Math.max(0,(e==null?void 0:e.xpToNextLevel)??r-n),i=(e==null?void 0:e.currentLevelStartXp)??Math.max(0,t-n);return{totalXp:t,level:a,currentLevelXp:n,nextLevelXp:r,xpIntoLevel:n,xpToNextLevel:o,currentLevelStartXp:i,nextLevelTotalXp:(e==null?void 0:e.nextLevelTotalXp)??i+r,levelCurveVersion:(e==null?void 0:e.levelCurveVersion)??Ve.levelCurveVersion,weeklyXp:(e==null?void 0:e.weeklyXp)??Ve.weeklyXp,streakDays:(e==null?void 0:e.streakDays)??Ve.streakDays,comboMultiplier:(e==null?void 0:e.comboMultiplier)??Ve.comboMultiplier,momentumScore:(e==null?void 0:e.momentumScore)??Ve.momentumScore,topGoalId:(e==null?void 0:e.topGoalId)??Ve.topGoalId,topGoalTitle:(e==null?void 0:e.topGoalTitle)??Ve.topGoalTitle}}function oo(e){return Intl.NumberFormat(void 0,{notation:e>=1e4?"compact":"standard",maximumFractionDigits:1}).format(e)}function Rd({metrics:e,className:t}){const a=io(e),n=Math.min(100,Math.round(a.currentLevelXp/Math.max(1,a.nextLevelXp)*100));return s.jsxs(Lt,{to:"/rewards",className:P("inline-flex min-h-10 max-w-full items-center gap-2 rounded-full border border-white/10 bg-white/[0.055] px-3 py-2 text-[12px] font-medium text-white/78 shadow-[0_12px_30px_rgba(3,8,18,0.18)] transition hover:border-white/16 hover:bg-white/[0.08] hover:text-white",t),children:[s.jsxs("span",{className:"relative grid size-8 shrink-0 place-items-center rounded-full bg-black/24",children:[s.jsx("span",{className:"absolute inset-0 rounded-full",style:{background:`conic-gradient(var(--tertiary) ${n}%, rgba(255,255,255,0.12) 0)`}}),s.jsxs("span",{className:"relative grid size-6 place-items-center rounded-full bg-[rgba(9,13,24,0.92)] text-[10px] text-[var(--tertiary)]",children:["L",a.level]})]}),s.jsxs("span",{className:"min-w-0",children:[s.jsxs("span",{className:"block truncate",children:[a.currentLevelXp,"/",a.nextLevelXp," XP"]}),s.jsxs("span",{className:"block truncate text-[11px] text-white/48",children:[a.streakDays," day streak"]})]})]})}function Sw({metrics:e,compact:t=!1}){var p,T,_;const a=ro(),n=ms(),r=Ks({queryKey:["forge-gamification-assets"],queryFn:eo}),o=cs({mutationFn:to,onSuccess:async()=>{await n.invalidateQueries({queryKey:["forge-gamification-assets"]})}}),i=io(e.profile),l=Math.min(100,Math.round(i.currentLevelXp/Math.max(1,i.nextLevelXp)*100)),u=e.catalogPreview??[],h=e.nextUnlock??u.find(b=>!b.unlocked)??null,m=e.newestUnlock??u.find(b=>b.unlocked)??null,g=(p=e.nextTargets)!=null&&p.length?e.nextTargets:h?[h]:[],f=[...m?[m]:[],...u.filter(b=>b.unlocked&&b.id!==(m==null?void 0:m.id))].slice(0,5),x=((T=e.equipment)==null?void 0:T.selectedMascotSkin)??"default smith",y=(_=r.data)==null?void 0:_.assets.styles.find(b=>b.id===a),R=(y==null?void 0:y.label)??a.split("-").map(b=>b.charAt(0).toUpperCase()+b.slice(1)).join(" ");if(y&&!y.installed){const b=o.isPending&&o.variables===a;return s.jsx("section",{className:"relative isolate min-w-0 overflow-hidden rounded-[24px] border border-white/8 bg-[linear-gradient(135deg,rgba(10,15,28,0.96),rgba(13,22,28,0.94))] p-4 shadow-[0_20px_58px_rgba(3,8,18,0.28)]",children:s.jsxs("div",{className:"grid min-w-0 gap-4 sm:grid-cols-[4.5rem_minmax(0,1fr)] sm:items-center",children:[s.jsx("div",{className:"grid size-18 place-items-center overflow-hidden rounded-[18px] border border-white/10 bg-white/[0.055]",children:s.jsx("img",{src:va(a),alt:`${R} preview`,className:"size-16 object-contain"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[s.jsxs(le,{className:"bg-black/24 text-[var(--tertiary)]",children:["Level ",i.level]}),s.jsxs(le,{className:"bg-black/24 text-white/72",children:[i.currentLevelXp,"/",i.nextLevelXp," XP"]}),s.jsx(le,{className:"bg-amber-400/14 text-amber-100",children:"Assets not downloaded"})]}),s.jsxs("div",{className:"mt-3 flex min-w-0 flex-wrap items-end justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"font-display text-xl text-white",children:["Download ",R," rewards"]}),s.jsx("p",{className:"mt-1 max-w-2xl text-sm leading-6 text-white/58",children:"This installs the optional mascot, trophy, and unlock art for the selected reward style."})]}),s.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[s.jsxs(de,{size:"sm",pending:b,pendingLabel:"Downloading",onClick:()=>o.mutate(a),children:[s.jsx(ji,{className:"size-3.5"}),"Download"]}),s.jsxs(Lt,{to:"/settings",className:"inline-flex min-h-[2.125rem] items-center gap-2 rounded-[var(--radius-control)] border border-white/10 bg-white/[0.055] px-2.5 py-[0.4375rem] text-[13px] font-medium text-white/72 transition hover:border-white/16 hover:bg-white/[0.08] hover:text-white",children:[s.jsx(Ms,{className:"size-3.5"}),"Settings"]})]})]}),o.isError?s.jsx("div",{className:"mt-3 text-sm text-rose-200",children:o.error instanceof Error?o.error.message:"Could not download reward assets."}):s.jsxs("div",{className:"mt-3 text-[11px] uppercase tracking-[0.16em] text-white/38",children:[y.spriteCount,"/",y.expectedSpriteCount," sprites installed"]})]})]})})}return s.jsxs("section",{className:"relative isolate min-w-0 overflow-hidden rounded-[28px] border border-white/8 bg-[linear-gradient(135deg,rgba(10,15,28,0.98),rgba(19,13,28,0.94)_48%,rgba(8,20,30,0.94))] p-4 shadow-[0_24px_70px_rgba(3,8,18,0.34)] md:p-5",children:[s.jsx("div",{className:"absolute inset-0 -z-10 bg-[radial-gradient(circle_at_18%_20%,rgba(249,115,22,0.18),transparent_34%),radial-gradient(circle_at_82%_10%,rgba(56,189,248,0.14),transparent_32%),radial-gradient(circle_at_76%_82%,rgba(167,139,250,0.12),transparent_34%)]"}),s.jsxs("div",{className:"grid min-w-0 gap-4 lg:grid-cols-[minmax(18rem,0.84fr)_minmax(0,1.16fr)] lg:items-center",children:[s.jsxs("div",{className:"relative min-h-[17rem] overflow-hidden rounded-[24px] border border-white/8 bg-[linear-gradient(145deg,rgba(255,255,255,0.055),rgba(8,14,25,0.78))]",children:[s.jsx("img",{src:Ns(e.mascot.spriteKey,512,a),alt:"Forge Smith mascot",onError:Ps,className:"absolute inset-x-0 bottom-3 mx-auto h-[15.5rem] max-w-none object-contain drop-shadow-[0_24px_40px_rgba(0,0,0,0.52)]"}),s.jsxs("div",{className:"absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/76 to-transparent p-4",children:[s.jsxs("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/50",children:[e.scope.label," · ",x.replaceAll("-"," ")]}),s.jsx("div",{className:"mt-1 font-display text-xl text-white",children:e.mascot.headline})]})]}),s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[s.jsxs(le,{className:"bg-black/24 text-[var(--tertiary)]",children:["Level ",i.level]}),s.jsxs(le,{className:"bg-black/24 text-emerald-200",children:[i.streakDays," days"]}),s.jsxs(le,{className:"bg-black/24 text-white/76",children:[oo(i.totalXp)," XP"]})]}),s.jsxs("div",{className:"mt-4 grid gap-3",children:[s.jsxs("div",{className:"flex min-w-0 items-end justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"font-display text-2xl text-white md:text-3xl",children:["Forge level ",i.level]}),s.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-6 text-white/60",children:e.mascot.line})]}),s.jsxs(Lt,{to:"/rewards",className:"inline-flex shrink-0 items-center gap-2 rounded-full bg-[var(--primary)] px-3 py-2 text-[12px] font-semibold text-slate-950 transition hover:opacity-90",children:[s.jsx(ua,{className:"size-3.5"}),"Hall"]})]}),s.jsx(bc,{value:l}),s.jsxs("div",{className:"flex flex-wrap justify-between gap-2 text-[11px] uppercase tracking-[0.16em] text-white/42",children:[s.jsxs("span",{children:[i.currentLevelXp,"/",i.nextLevelXp," XP"]}),s.jsxs("span",{children:[i.xpToNextLevel??i.nextLevelXp-i.currentLevelXp," ","to next"]})]})]}),t?null:s.jsxs("div",{className:"mt-4 grid gap-3 md:grid-cols-[minmax(0,1fr)_minmax(13rem,0.72fr)]",children:[s.jsxs("div",{className:"rounded-[18px] border border-white/8 bg-white/[0.045] p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-white",children:[s.jsx(is,{className:"size-4 text-[var(--tertiary)]"}),"Next targets"]}),s.jsx("div",{className:"mt-3 grid gap-2",children:g.length>0?g.map(b=>s.jsxs("div",{className:"grid grid-cols-[2rem_minmax(0,1fr)_3.5rem] items-center gap-2",children:[s.jsx("img",{src:Ns(b.assetKey,256,a),alt:"",onError:Ps,className:"size-8 object-contain opacity-90"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"truncate text-sm text-white/80",children:b.title}),s.jsx("div",{className:"truncate text-[11px] text-white/42",children:b.requirementText})]}),s.jsxs("div",{className:"text-right text-[11px] text-white/46",children:[b.progressPercent,"%"]})]},b.id)):s.jsx("div",{className:"text-sm text-white/60",children:"All visible rewards unlocked"})})]}),s.jsxs("div",{className:"rounded-[18px] border border-white/8 bg-white/[0.045] p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-white",children:[s.jsx(ua,{className:"size-4 text-amber-200"}),"Latest shelf"]}),s.jsx("div",{className:"mt-3 flex min-w-0 gap-2",children:f.length>0?f.map(b=>s.jsx("img",{src:Ns(b.assetKey,256,a),alt:b.title,title:b.title,onError:Ps,className:"size-11 rounded-2xl bg-black/22 object-contain p-1"},b.id)):s.jsx("div",{className:"text-sm text-white/60",children:"No trophy yet"})}),s.jsxs("div",{className:"mt-3 text-[11px] uppercase tracking-[0.16em] text-white/40",children:[e.unlockedItemCount,"/",e.totalItemCount," unlocked"]})]})]})]})]})]})}function _d({xpNotice:e,celebrations:t,onSeen:a}){const n=lc(),r=ro(),o=t[0]??null,i=(o==null?void 0:o.kind)==="level"||(o==null?void 0:o.kind)==="trophy"||(o==null?void 0:o.kind)==="unlock";return s.jsx(Ma,{children:o?s.jsx(gt.div,{initial:n?{opacity:0}:{opacity:0,y:20,scale:.96},animate:n?{opacity:1}:{opacity:1,y:0,scale:1},exit:n?{opacity:0}:{opacity:0,y:16,scale:.98},transition:{duration:.28,ease:"easeOut"},className:P("pointer-events-auto fixed z-50 px-4",i?"inset-x-0 bottom-24 flex justify-center lg:bottom-8":"right-0 bottom-24 lg:bottom-8"),onAnimationComplete:()=>{window.setTimeout(()=>a(o.id),i?3e3:1800)},children:s.jsxs("div",{className:P("relative min-w-0 overflow-hidden rounded-[26px] border border-white/10 bg-[rgba(10,15,28,0.92)] shadow-[0_32px_90px_rgba(3,8,18,0.48)] backdrop-blur-xl",i?"w-full max-w-[34rem] p-4":"max-w-[24rem] p-3"),children:[s.jsx("div",{className:"absolute inset-0 -z-10 bg-[radial-gradient(circle_at_22%_12%,rgba(249,115,22,0.22),transparent_42%),radial-gradient(circle_at_82%_16%,rgba(139,92,246,0.18),transparent_38%)]"}),s.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[s.jsx("img",{src:Ns(o.assetKey||"mascot-state-020",256,r),alt:"",onError:Ps,className:P("shrink-0 object-contain",i?"size-24":"size-14")}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--tertiary)]",children:o.kind}),s.jsx("div",{className:"mt-1 truncate font-display text-xl text-white",children:o.title}),s.jsx("div",{className:"mt-1 line-clamp-2 text-sm leading-6 text-white/62",children:o.summary})]})]})]})},o.id):e?s.jsx(gt.div,{initial:n?{opacity:0}:{opacity:0,y:14},animate:n?{opacity:1}:{opacity:1,y:0},exit:n?{opacity:0}:{opacity:0,y:10},className:"pointer-events-none fixed inset-x-0 bottom-24 z-50 flex justify-center px-4 lg:bottom-6",children:s.jsxs("div",{className:P("inline-flex items-center gap-2 rounded-full border px-4 py-2 text-sm font-medium shadow-[0_18px_48px_rgba(3,8,18,0.38)] backdrop-blur-xl",e.deltaXp>0?"border-emerald-400/30 bg-emerald-500/14 text-emerald-100":"border-rose-400/30 bg-rose-500/14 text-rose-100"),children:[e.deltaXp>0?s.jsx(us,{className:"size-4 shrink-0"}):s.jsx(Si,{className:"size-4 shrink-0"}),s.jsxs("span",{children:[e.deltaXp>0?`XP +${e.deltaXp}`:`XP ${e.deltaXp}`," ","· ",oo(e.totalXp)," total"]})]})},`xp-${e.totalXp}`):null})}const sa="forge-gamification-assets-setup-dismissed-v1";function Ed(){var y,R;const e=ms(),t=Kt(),[a,n]=c.useState(()=>typeof window>"u"?!0:window.localStorage.getItem(sa)==="1"),[r,o]=c.useState(Wt),i=Ks({queryKey:["forge-gamification-assets"],queryFn:eo,staleTime:3e4}),l=((y=i.data)==null?void 0:y.assets.styles)??[],u=l.filter(p=>p.installed),m=!t.pathname.startsWith("/settings")&&!a&&i.isSuccess&&u.length===0;c.useEffect(()=>{var T;const p=hs((T=i.data)==null?void 0:T.assets.defaultStyle);o(p)},[(R=i.data)==null?void 0:R.assets.defaultStyle]);const g=c.useMemo(()=>l.find(p=>p.id===r)??l.find(p=>p.id===Wt)??l[0],[r,l]),f=cs({mutationFn:async p=>{const T=await to(p);return await pd({gamificationTheme:p}),T},onSuccess:async()=>{window.localStorage.removeItem(sa),await Promise.all([e.invalidateQueries({queryKey:["forge-gamification-assets"]}),e.invalidateQueries({queryKey:["forge-settings"]})])}});function x(){window.localStorage.setItem(sa,"1"),n(!0)}return l.length?s.jsx(yt,{open:m,children:s.jsxs(xt,{children:[s.jsx(bt,{className:"fixed inset-0 z-50 bg-[rgba(3,7,18,0.74)] backdrop-blur-xl"}),s.jsxs(vt,{className:"fixed left-1/2 top-1/2 z-50 w-[min(44rem,calc(100vw-1.25rem))] -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-[30px] border border-white/10 bg-[linear-gradient(180deg,rgba(16,23,36,0.98),rgba(8,12,22,0.98))] shadow-[0_32px_90px_rgba(3,8,18,0.56)] outline-none",children:[s.jsx(wt,{className:"sr-only",children:"Download Forge reward art"}),s.jsx(kt,{className:"sr-only",children:"Choose whether Forge should download optional trophy and mascot art."}),s.jsx("button",{type:"button",onClick:x,className:"absolute right-3 top-3 z-10 inline-flex size-9 items-center justify-center rounded-full border border-white/10 bg-white/8 text-white/62 transition hover:bg-white/12 hover:text-white","aria-label":"Close",children:s.jsx(ut,{className:"size-4"})}),s.jsxs("div",{className:"grid gap-0 md:grid-cols-[16rem_minmax(0,1fr)]",children:[s.jsx("div",{className:"relative min-h-[18rem] overflow-hidden bg-[linear-gradient(160deg,rgba(245,158,11,0.18),rgba(34,197,94,0.12)_42%,rgba(14,165,233,0.14))]",children:s.jsx("img",{src:va(r),alt:"",className:"absolute inset-x-0 bottom-4 mx-auto h-56 max-w-none object-contain drop-shadow-[0_24px_42px_rgba(0,0,0,0.48)]"})}),s.jsxs("div",{className:"p-5 sm:p-6",children:[s.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--tertiary)]",children:"Optional reward art"}),s.jsx("h2",{className:"mt-2 font-display text-2xl text-white",children:"Download trophies and mascot sprites?"}),s.jsx("p",{className:"mt-3 text-sm leading-6 text-white/62",children:"Forge can keep the app package small and install only the reward art style you want. The app works without these images."}),s.jsx("div",{className:"mt-5 grid gap-2",children:l.map(p=>{const T=p.id===r;return s.jsxs("button",{type:"button",onClick:()=>o(p.id),className:["grid grid-cols-[3.5rem_minmax(0,1fr)] items-center gap-3 rounded-[18px] border p-2 text-left transition",T?"border-[var(--primary)] bg-[var(--primary)]/12":"border-white/10 bg-white/[0.04] hover:bg-white/[0.07]"].join(" "),children:[s.jsx("img",{src:va(p.id),alt:"",className:"size-14 object-contain"}),s.jsxs("span",{className:"min-w-0",children:[s.jsx("span",{className:"block truncate text-sm font-semibold text-white",children:p.label}),s.jsx("span",{className:"mt-1 line-clamp-2 block text-[12px] leading-5 text-white/52",children:p.description})]})]},p.id)})}),f.isError?s.jsx("div",{className:"mt-4 rounded-[16px] border border-red-300/20 bg-red-500/10 px-3 py-2 text-[12px] leading-5 text-red-100",children:f.error instanceof Error?f.error.message:"Could not download the selected art."}):null,s.jsxs("div",{className:"mt-5 flex flex-wrap justify-end gap-2",children:[s.jsx("button",{type:"button",onClick:x,className:"inline-flex items-center justify-center rounded-full border border-white/10 px-4 py-2 text-sm font-semibold text-white/72 transition hover:bg-white/8 hover:text-white",children:"Not now"}),s.jsxs("button",{type:"button",disabled:!g||f.isPending,onClick:()=>{g&&f.mutate(g.id)},className:"inline-flex items-center justify-center gap-2 rounded-full bg-[var(--primary)] px-4 py-2 text-sm font-semibold text-slate-950 transition hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-60",children:[s.jsx(ji,{className:"size-4"}),f.isPending?"Downloading":"Download"]})]})]})]})]})]})}):null}const Ad=["goal","project","issue","task","strategy","habit","tag","note","wiki_page","wiki_space","insight","calendar_event","work_block","timebox","value","pattern","behavior","belief","mode","mode_session","flashcard","report","event_type","emotion","workbench","functor","chat"],Od=[{kind:"goal",label:"Goal",icon:Ra,iconName:"Target",accentRgb:[251,191,36]},{kind:"project",label:"Project",icon:Yo,iconName:"FolderOpen",accentRgb:[56,189,248]},{kind:"issue",label:"Issue",icon:$r,iconName:"FileText",accentRgb:[251,146,60]},{kind:"task",label:"Task",icon:Zo,iconName:"ListTodo",accentRgb:[129,140,248]},{kind:"strategy",label:"Strategy",icon:Ht,iconName:"GitBranch",accentRgb:[34,211,238]},{kind:"habit",label:"Habit",icon:el,iconName:"RefreshCw",accentRgb:[45,212,191]},{kind:"tag",label:"Tag",icon:js,iconName:"PanelTop",accentRgb:[163,230,53]},{kind:"note",label:"Note",icon:It,iconName:"NotebookPen",accentRgb:[148,163,184]},{kind:"wiki_page",label:"Wiki Page",icon:Ni,iconName:"StickyNote",accentRgb:[125,211,252]},{kind:"wiki_space",label:"Wiki Space",icon:_a,iconName:"Network",accentRgb:[99,102,241]},{kind:"insight",label:"Insight",icon:is,iconName:"Sparkles",accentRgb:[244,63,94]},{kind:"calendar_event",label:"Calendar Event",icon:$t,iconName:"CalendarDays",accentRgb:[14,165,233]},{kind:"work_block",label:"Work Block",icon:js,iconName:"PanelTop",accentRgb:[16,185,129]},{kind:"timebox",label:"Timebox",icon:os,iconName:"Timer",accentRgb:[244,114,182]},{kind:"value",label:"Value",icon:Mr,iconName:"Heart",accentRgb:[52,211,153]},{kind:"pattern",label:"Pattern",icon:Ea,iconName:"Repeat",accentRgb:[251,113,133]},{kind:"behavior",label:"Behavior",icon:tl,iconName:"Route",accentRgb:[251,146,60]},{kind:"belief",label:"Belief",icon:sl,iconName:"Quote",accentRgb:[167,139,250]},{kind:"mode",label:"Mode",icon:al,iconName:"Shapes",accentRgb:[217,70,239]},{kind:"mode_session",label:"Mode Session",icon:nl,iconName:"Compass",accentRgb:[192,132,252]},{kind:"flashcard",label:"Flashcard",icon:js,iconName:"PanelTop",accentRgb:[20,184,166]},{kind:"report",label:"Report",icon:$r,iconName:"FileText",accentRgb:[96,165,250]},{kind:"event_type",label:"Event Type",icon:$t,iconName:"CalendarDays",accentRgb:[45,212,191]},{kind:"emotion",label:"Emotion",icon:Mr,iconName:"Heart",accentRgb:[248,113,113]},{kind:"workbench",label:"Workbench",icon:rl,iconName:"Workflow",accentRgb:[45,212,191]},{kind:"functor",label:"Functor",icon:is,iconName:"Sparkles",accentRgb:[250,204,21]},{kind:"chat",label:"Chat",icon:Rs,iconName:"Bot",accentRgb:[129,140,248]}];function Ld(e){return`#${e.map(t=>t.toString(16).padStart(2,"0")).join("")}`}function Je(e,t,a){return`rgba(var(--forge-entity-${e}-rgb,${t.join(",")}),${a})`}function Dd(e){return{kind:e.kind,label:e.label,icon:e.icon,iconName:e.iconName,colorToken:{cssVariable:`--forge-entity-${e.kind}-rgb`,rgb:e.accentRgb,hex:Ld(e.accentRgb)},iconClassName:`text-[${Je(e.kind,e.accentRgb,.96)}]`,nameClassName:`text-[${Je(e.kind,e.accentRgb,.96)}]`,badgeClassName:`border-[${Je(e.kind,e.accentRgb,.24)}] bg-[linear-gradient(135deg,${Je(e.kind,e.accentRgb,.24)},${Je(e.kind,e.accentRgb,.08)})] text-white`,subtleBadgeClassName:`border-[${Je(e.kind,e.accentRgb,.18)}] bg-[${Je(e.kind,e.accentRgb,.08)}] text-[${Je(e.kind,e.accentRgb,.92)}]`,buttonClassName:`border-[${Je(e.kind,e.accentRgb,.2)}] bg-[${Je(e.kind,e.accentRgb,.12)}] text-white hover:bg-[${Je(e.kind,e.accentRgb,.18)}]`}}const $d=Object.fromEntries(Od.map(e=>[e.kind,Dd(e)])),Md={goal:"goal",project:"project",task:"task",strategy:"strategy",habit:"habit",tag:"tag",note:"note",insight:"insight",calendar_event:"calendar_event",work_block_template:"work_block",task_timebox:"timebox",psyche_value:"value",behavior_pattern:"pattern",behavior:"behavior",belief_entry:"belief",mode_profile:"mode",mode_guide_session:"mode_session",flashcard:"flashcard",event_type:"event_type",emotion_definition:"emotion",trigger_report:"report"};function Gs(e){return $d[e]}function Nw(e){return Ad.includes(e)}function Ur(e,t){return e==="note"&&(t==null?void 0:t.noteKind)==="wiki"?"wiki_page":Md[e]??null}function Pw(e){return e==="chat"?"chat":"functor"}function Tw(e,t){const a=Gs(e);return t?`border ${a.buttonClassName}`:"border border-white/8 bg-white/[0.05] text-white/62 hover:bg-white/[0.08] hover:text-white"}function et({kind:e,label:t,compact:a=!1,size:n,showIcon:r=!0,iconOnly:o=!1,gradient:i=!0,wrap:l=!1,className:u,...h}){const m=Gs(e),g=m.icon;return s.jsxs(le,{size:n??(a?"sm":"md"),wrap:l,className:P("max-w-full min-w-0 gap-1.5 border font-medium",i?m.badgeClassName:m.subtleBadgeClassName,a&&!o&&"px-2.5",o&&"px-2.5",n==="xs"&&"gap-1 px-2",u),...h,children:[r?s.jsx(g,{className:P(n==="xs"?"size-3":"size-3.5","shrink-0",m.iconClassName)}):null,o?null:s.jsx("span",{className:P("min-w-0 max-w-full",l?"whitespace-normal break-words [overflow-wrap:anywhere]":"truncate"),children:t??m.label})]})}function Fd(e,t,a){return Math.min(a,Math.max(t,e))}function zd(e,t,a){const n=(a==null?void 0:a.offset)??8,r=(a==null?void 0:a.margin)??12,o=(a==null?void 0:a.preferredMaxHeight)??320,i=(a==null?void 0:a.minHeight)??160,[l,u]=c.useState(null),h=c.useCallback(()=>{const m=e.current;if(!m||typeof window>"u"){u(null);return}const g=m.getBoundingClientRect(),f=window.visualViewport,x=(f==null?void 0:f.width)??window.innerWidth,y=(f==null?void 0:f.height)??window.innerHeight,R=(f==null?void 0:f.offsetLeft)??0,p=(f==null?void 0:f.offsetTop)??0,T=Math.min(g.width,x-r*2),_=R+x-r-T,b=Fd(g.left,R+r,_),F=p+y-g.bottom-n-r,v=g.top-p-n-r,B=F<i&&v>F,N=Math.max(i,B?v:F),A=Math.min(o,N),I=B?Math.max(p+r,g.top-n-A):g.bottom+n;u({position:"fixed",left:b,top:I,width:T,maxHeight:A})},[e,r,i,n,o]);return c.useEffect(()=>{if(!t||typeof window>"u"){u(null);return}let m=0;const g=()=>{m===0&&(m=window.requestAnimationFrame(()=>{m=0,h()}))};h();const f=window.visualViewport;return window.addEventListener("resize",g),window.addEventListener("scroll",g,!0),f==null||f.addEventListener("resize",g),f==null||f.addEventListener("scroll",g),()=>{m!==0&&window.cancelAnimationFrame(m),window.removeEventListener("resize",g),window.removeEventListener("scroll",g,!0),f==null||f.removeEventListener("resize",g),f==null||f.removeEventListener("scroll",g)}},[t,h]),l}function aa(e){return e.trim().toLowerCase()}function Gr(e,t){return e.includes(t)?e:[...e,t]}function Wd({options:e,selectedValues:t,onChange:a,placeholder:n="Search or create…",emptyMessage:r="No matching entries yet.",createLabel:o="Create",onCreate:i,className:l,variant:u="default"}){const[h,m]=c.useState(""),[g,f]=c.useState(!1),[x,y]=c.useState(0),[R,p]=c.useState(!1),[T,_]=c.useState(null),[b,F]=c.useState([]),v=c.useRef(null),B=c.useRef(null),N=e??[],A=t??[],I=u==="action-bar",$=zd(v,g,{offset:6,preferredMaxHeight:320,minHeight:160}),ee=c.useMemo(()=>{const E=new Map;return[...b,...N].forEach(X=>{E.set(X.value,X)}),Array.from(E.values())},[b,N]),ne=c.useMemo(()=>A.map(E=>ee.find(X=>X.value===E)??{value:E,label:E}),[ee,A]),oe=aa(h),V=c.useMemo(()=>{const E=ee.filter(X=>!A.includes(X.value));return oe?E.filter(X=>`${X.label} ${X.description??""} ${X.searchText??""}`.toLowerCase().includes(oe)).slice(0,8):E.slice(0,8)},[ee,oe,A]),w=ee.some(E=>aa(E.label)===oe);c.useEffect(()=>{if(!g)return;const E=M=>{var O,se;const Z=M.target;(O=v.current)!=null&&O.contains(Z)||(se=B.current)!=null&&se.contains(Z)||f(!1)},X=M=>{M.key==="Escape"&&f(!1)};return document.addEventListener("pointerdown",E),document.addEventListener("keydown",X),()=>{document.removeEventListener("pointerdown",E),document.removeEventListener("keydown",X)}},[g]);const z=E=>{a(Gr(A,E)),m(""),_(null),y(0),f(!1)},ie=E=>{a(A.filter(X=>X!==E))},te=async()=>{const E=h.trim();if(!(!i||!E)){p(!0);try{const X=await i(E);F(M=>M.some(Z=>Z.value===X.value)?M:[X,...M]),a(Gr(A,X.value)),m(""),_(null),y(0),f(!1)}catch(X){_(X instanceof Error?X.message:"Unable to create that link right now.")}finally{p(!1)}}};return s.jsxs("div",{className:P("relative grid gap-2",l),ref:v,children:[s.jsxs("div",{className:P("rounded-[22px] border border-white/10 bg-white/[0.04]",I?"rounded-[20px] border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3.5 py-3 shadow-[inset_0_1px_0_var(--ui-border-subtle)]":"px-3 py-3"),children:[ne.length>0?s.jsx("div",{className:P("flex flex-wrap gap-2",I?"mb-2.5":"mb-2"),children:ne.map(E=>s.jsxs("span",{className:"inline-flex min-w-0 max-w-full items-center gap-2",children:[E.kind?s.jsx(et,{kind:E.kind,label:E.label,compact:!0,wrap:!0,gradient:!1,className:"max-w-full"}):E.badge?E.badge:s.jsx("span",{className:P("inline-flex items-center gap-2 rounded-full px-3 py-1.5 text-sm",I?"border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]":"bg-white/[0.08] text-white/78"),children:s.jsx("span",{className:"max-w-full break-words whitespace-normal [overflow-wrap:anywhere]",children:E.label})}),s.jsx("button",{type:"button",className:P("rounded-full transition",I?"text-[var(--ui-ink-faint)] hover:text-[var(--ui-ink-strong)]":"text-white/50 hover:text-white"),"aria-label":`Remove ${E.label}`,onClick:()=>ie(E.value),children:s.jsx(ut,{className:"size-3.5"})})]},E.value))}):null,s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ft,{className:P("size-4",I?"text-[var(--ui-ink-faint)]":"text-white/34")}),s.jsx("input",{type:"text",value:h,onChange:E=>{m(E.target.value),_(null),f(!0),y(0)},onFocus:()=>f(!0),onKeyDown:E=>{if(E.key==="Backspace"&&!h&&A.length>0){ie(A[A.length-1]);return}if(E.key==="ArrowDown"){E.preventDefault(),f(!0),y(Z=>V.length===0?0:Math.min(V.length-1,Z+1));return}if(E.key==="ArrowUp"){E.preventDefault(),y(Z=>Math.max(0,Z-1));return}if(E.key==="Escape"){f(!1);return}if(E.key!=="Enter")return;E.preventDefault();const X=V[x];if(X){z(X.value);return}const M=ee.find(Z=>aa(Z.label)===oe);if(M&&!A.includes(M.value)){z(M.value);return}te()},placeholder:n,className:P("min-w-0 flex-1 bg-transparent text-sm focus:outline-none",I?"text-[var(--ui-ink-strong)] placeholder:text-[var(--ui-ink-faint)]":"text-white placeholder:text-white/34")})]})]}),g&&$&&typeof document<"u"?Fs.createPortal(s.jsxs("div",{ref:B,role:"listbox","aria-multiselectable":"true",className:P("z-[80] overflow-y-auto overscroll-contain rounded-[22px] p-2 [webkit-overflow-scrolling:touch]",I?"border border-[var(--ui-border-subtle)] bg-[color-mix(in_srgb,var(--ui-surface-1)_94%,transparent)] shadow-[0_24px_56px_rgba(4,8,18,0.16)]":"border border-white/10 bg-[rgba(10,15,27,0.96)] shadow-[0_26px_60px_rgba(4,8,18,0.32)]","backdrop-blur-xl"),style:$,children:[V.map((E,X)=>s.jsx("button",{type:"button",role:"option","aria-selected":!1,className:P("flex w-full items-start justify-between gap-3 rounded-[18px] px-3 py-2.5 text-left transition",X===x?I?"bg-[var(--ui-surface-3)] text-[var(--ui-ink-strong)]":"bg-white/[0.1] text-white":I?"text-[var(--ui-ink-medium)] hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]":"text-white/70 hover:bg-white/[0.06] hover:text-white"),onMouseEnter:()=>y(X),onMouseDown:M=>M.preventDefault(),onPointerDown:M=>{M.preventDefault(),z(E.value)},onClick:()=>z(E.value),children:s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"truncate text-sm font-medium",children:E.kind?s.jsx(et,{kind:E.kind,label:E.label,compact:!0,gradient:!1}):E.menuBadge?E.menuBadge:E.badge?E.badge:E.label}),E.description?s.jsx("div",{className:P("mt-1 text-xs leading-5",I?"text-[var(--ui-ink-soft)]":"text-white/46"),children:E.description}):null]})},E.value)),!w&&oe&&i?s.jsxs("button",{type:"button",disabled:R,className:P("mt-1 flex w-full items-center gap-2 rounded-[18px] px-3 py-2.5 text-left text-sm transition disabled:opacity-50",I?"text-[var(--secondary)] hover:bg-[var(--ui-surface-hover)]":"text-[var(--secondary)] hover:bg-white/[0.06]"),onMouseDown:E=>E.preventDefault(),onPointerDown:E=>{E.preventDefault(),te()},onClick:()=>void te(),children:[s.jsx(zs,{className:"size-4"}),s.jsx("span",{className:"truncate",children:R?"Creating…":`${o} "${h.trim()}"`})]}):null,V.length===0&&(!oe||w||!i)?s.jsx("div",{className:P("px-3 py-2.5 text-sm",I?"text-[var(--ui-ink-soft)]":"text-white/42"),children:r}):null]}),document.body):null,T?s.jsx("div",{className:"text-sm text-rose-300",children:T}):null]})}const qd={sm:"text-base",md:"text-lg",lg:"text-2xl",xl:"text-3xl"},na={1:"truncate whitespace-nowrap",2:"overflow-hidden whitespace-normal [display:-webkit-box] [-webkit-box-orient:vertical] [-webkit-line-clamp:2]",3:"overflow-hidden whitespace-normal [display:-webkit-box] [-webkit-box-orient:vertical] [-webkit-line-clamp:3]"};function gs({kind:e,label:t,variant:a="inline",size:n="md",showKind:r=!1,showIcon:o=!0,showBadge:i=!1,badgeLabel:l,badgeCompact:u=!0,badgeGradient:h=!1,lines:m=1,labelClassName:g,className:f,...x}){const y=Gs(e),R=y.icon;return a==="pill"?s.jsxs("span",{className:P("inline-flex max-w-full items-center gap-2 rounded-full border px-4 py-2 font-medium shadow-[0_10px_28px_rgba(3,8,18,0.18)]",y.badgeClassName,f),...x,children:[o?s.jsx(R,{className:P("size-4 shrink-0",y.iconClassName)}):null,s.jsx("span",{className:P("min-w-0 max-w-full",na[m],g),children:t})]}):a==="heading"?s.jsxs("span",{className:P("inline-flex max-w-full min-w-0 items-center gap-3",f),...x,children:[i?s.jsx(et,{kind:e,label:l??y.label,compact:u,gradient:h,className:"shrink-0"}):null,r&&!i?s.jsx(et,{kind:e,label:l??y.label,compact:!0,gradient:!1,className:"shrink-0"}):null,s.jsx("span",{className:P("min-w-0 max-w-full font-display leading-tight",qd[n],na[m],y.nameClassName,g),children:t})]}):s.jsxs("span",{className:P("inline-flex max-w-full min-w-0 items-center gap-2",f),...x,children:[o?s.jsx(R,{className:P("size-4 shrink-0",y.iconClassName)}):null,i?s.jsx(et,{kind:e,label:l??y.label,compact:u,gradient:h,className:"shrink-0"}):null,r?s.jsx("span",{className:P("text-sm font-medium",y.nameClassName),children:y.label}):null,s.jsx("span",{className:P("min-w-0 max-w-full",na[m],y.nameClassName,g),children:t})]})}function ve({className:e,size:t,...a}){return s.jsx("input",{...a,className:P("interactive-tap w-full rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3 text-[15px] text-[var(--ui-ink-strong)] outline-none ring-0 placeholder:text-[var(--ui-ink-faint)] transition focus:border-[var(--primary)]/35 focus:bg-[var(--ui-surface-3)]",e)})}function lo(e){return e.map(t=>(t==null?void 0:t.trim())??"").filter(Boolean)}function Bd(e){return Array.isArray(e)?e:[]}function Iw(e){const t=Bd(e);return t.length===1?t[0]:null}function Qe(e){return e?`${e.displayName} · ${e.kind}${e.handle?` · @${e.handle}`:""}`:""}function Ga(e,t="Default Forge owner"){return e?`Suggested owner: ${e.displayName} · ${e.kind}`:t}function Cw(e,t){const a=Qe(t);return a?`${e} · ${a}`:e}function Rw(e,t,a="No description yet."){return lo([e,Qe(t)]).join(" · ")||a}function _w(e,t){const a=t&&"user"in t?t.user:t;return lo([...e,a==null?void 0:a.displayName,a==null?void 0:a.handle,a==null?void 0:a.kind,a==null?void 0:a.description]).join(" ").toLowerCase()}const Kd=["goal","project","task","strategy","habit","note","insight","calendar_event","work_block_template","task_timebox","psyche_value","behavior_pattern","behavior","belief_entry","mode_profile","flashcard","trigger_report"];function wa(e){return e.map(t=>(t==null?void 0:t.trim())??"").filter(Boolean)}function Re(e){return typeof e=="string"&&e.trim().length>0?e.trim():null}function Hd(e){if(!e||typeof e!="object")return null;const t=e,a=Re(t.id),n=Re(t.kind),r=Re(t.displayName);return!a||!r||n!=="human"&&n!=="bot"?null:{id:a,kind:n,displayName:r,handle:Re(t.handle)??"",description:Re(t.description)??"",accentColor:Re(t.accentColor)??"",createdAt:Re(t.createdAt)??"",updatedAt:Re(t.updatedAt)??""}}function Ud(e){return e==="create"||e==="new"||e.startsWith("create ")||e.startsWith("new ")}function Gd(e){return e==="create"||e==="new"?"":e.startsWith("create ")?e.slice(7).trim():e.startsWith("new ")?e.slice(4).trim():null}function as(e){return e.trim().toLowerCase()}function Vd(e,t){return e==="note"?Ur(e,{noteKind:Re(t==null?void 0:t.kind)==="wiki"?"wiki":"evidence"}):Ur(e)}function Vs(e,t){switch(e){case"goal":return"Goal";case"project":return"Project";case"task":return"Task";case"strategy":return"Strategy";case"habit":return"Habit";case"note":return Re(t==null?void 0:t.kind)==="wiki"?"Wiki page":"Note";case"insight":return"Insight";case"calendar_event":return"Calendar event";case"work_block_template":return"Work block";case"task_timebox":return"Timebox";case"psyche_value":return"Value";case"behavior_pattern":return"Pattern";case"behavior":return"Behavior";case"belief_entry":return"Belief";case"mode_profile":return"Mode";case"flashcard":return"Flashcard";case"trigger_report":return"Report";default:return e.replaceAll("_"," ")}}const Vr=[{id:"goal",family:"entity-type",label:"Goal",kind:"goal",searchText:"goal life goal direction",entityTypes:["goal"]},{id:"project",family:"entity-type",label:"Project",kind:"project",searchText:"project initiative",entityTypes:["project"]},{id:"task",family:"entity-type",label:"Task",kind:"task",searchText:"task action work item",entityTypes:["task"]},{id:"strategy",family:"entity-type",label:"Strategy",kind:"strategy",searchText:"strategy plan sequence roadmap",entityTypes:["strategy"]},{id:"habit",family:"entity-type",label:"Habit",kind:"habit",searchText:"habit recurring routine",entityTypes:["habit"]},{id:"note",family:"entity-type",label:"Note",kind:"note",searchText:"note evidence scratch note",entityTypes:["note"]},{id:"wiki_page",family:"entity-type",label:"Wiki page",kind:"wiki_page",searchText:"wiki page karpawiki article knowledge page",entityTypes:["note"]},{id:"calendar_event",family:"entity-type",label:"Calendar event",kind:"calendar_event",searchText:"calendar event meeting block schedule",entityTypes:["calendar_event"]},{id:"psyche_value",family:"entity-type",label:"Value",kind:"value",searchText:"value psyche value",entityTypes:["psyche_value"]},{id:"behavior_pattern",family:"entity-type",label:"Pattern",kind:"pattern",searchText:"pattern loop psyche pattern",entityTypes:["behavior_pattern"]},{id:"behavior",family:"entity-type",label:"Behavior",kind:"behavior",searchText:"behavior psyche behavior",entityTypes:["behavior"]},{id:"belief_entry",family:"entity-type",label:"Belief",kind:"belief",searchText:"belief schema belief entry",entityTypes:["belief_entry"]},{id:"mode_profile",family:"entity-type",label:"Mode",kind:"mode",searchText:"mode profile psyche mode",entityTypes:["mode_profile"]},{id:"flashcard",family:"entity-type",label:"Flashcard",kind:"flashcard",searchText:"flashcard card urge trigger reminder psyche",entityTypes:["flashcard"]},{id:"trigger_report",family:"entity-type",label:"Report",kind:"report",searchText:"report trigger report psyche report",entityTypes:["trigger_report"]}];function co(e,t){return(e==="belief_entry"?[t.statement,t.title,t.name]:e==="flashcard"?[t.title,t.message,t.triggerSentence]:e==="note"?[t.title,t.slug]:[t.title,t.displayName,t.statement,t.name,t.label,t.slug]).map(Re).find(Boolean)??`${Vs(e,t)} ${String(t.id??"")}`}function uo(e,t){const a=[t.summary,t.description,t.overview,t.flexibleAlternative,t.originNote,t.endState,t.whyItMatters,t.valuedDirection,t.triggerSentence,t.triggerSituation,t.contentPlain].map(Re).find(Boolean),n=[t.goalTitle,t.projectTitle,t.status,t.kind].map(Re).find(Boolean),r=Qe(Hd(t.user)),o=wa([e==="note"?Vs(e,t):null,r||null]).join(" · ");return wa([a,n,r||null]).join(" · ")||o}function Jd(e,t){return wa([co(e,t),uo(e,t),Vs(e,t),Re(t.slug),Re(t.handle)]).join(" ").toLowerCase()}function Xd(e,t,a){switch(e){case"goal":return`/goals/${encodeURIComponent(t)}`;case"project":return`/projects/${encodeURIComponent(t)}`;case"task":return`/tasks/${encodeURIComponent(t)}`;case"strategy":return`/strategies/${encodeURIComponent(t)}`;case"habit":return`/habits?focus=${encodeURIComponent(t)}`;case"note":{const n=Re(a.kind),r=Re(a.slug),o=Re(a.spaceId);if(n==="wiki"&&r){const i=o?`?spaceId=${encodeURIComponent(o)}`:"";return`/wiki/page/${encodeURIComponent(r)}${i}`}return"/notes"}case"insight":return"/insights";case"calendar_event":case"work_block_template":case"task_timebox":return"/calendar";case"psyche_value":return`/psyche/values?focus=${encodeURIComponent(t)}`;case"behavior_pattern":return`/psyche/patterns?focus=${encodeURIComponent(t)}`;case"behavior":return`/psyche/behaviors?focus=${encodeURIComponent(t)}`;case"belief_entry":return`/psyche/schemas-beliefs?focus=${encodeURIComponent(t)}`;case"mode_profile":return`/psyche/modes?focus=${encodeURIComponent(t)}`;case"flashcard":return`/psyche/flashcards?focus=${encodeURIComponent(t)}`;case"trigger_report":return`/psyche/reports/${encodeURIComponent(t)}`;default:return null}}function ka(e,t,a){const n=as(e);if(!n)return 0;const r=as(t),o=as(a),i=n.split(/\s+/).filter(Boolean);let l=0;r===n&&(l+=400),r.startsWith(n)&&(l+=240),r.includes(n)&&(l+=180),o.startsWith(n)&&(l+=32),o.includes(n)&&(l+=20);for(const u of i)r.startsWith(u)?l+=36:r.includes(u)&&(l+=24),o.includes(u)&&(l+=12);return l}function mo(e){if(e.length===0)return Kd;const t=new Set;return e.forEach(a=>{a.entityTypes.forEach(n=>t.add(n))}),Array.from(t)}function Qd(e,t,a){if(!e.entityTypes.includes(t))return!1;if(t!=="note")return!0;const n=Re(a.kind);return e.id==="wiki_page"?n==="wiki":e.id==="note"?n!=="wiki":!0}function Yd(e,t,a){if(a.length===0)return!0;const n=new Map;a.forEach(r=>{const o=n.get(r.family)??[];o.push(r),n.set(r.family,o)});for(const r of n.values())if(!r.some(i=>Qd(i,e,t)))return!1;return!0}function Zd(e,t){if(t.length===0)return!0;const a=new Set(t.filter(n=>n.family==="entity-type").map(n=>n.id));return a.size===0?!0:e.filterIds.some(n=>a.has(n))}function eu(e,t){const a=as(e);if(!Ud(a))return[];const n=Gd(a);return n===null?[]:t.map(r=>{const o=[r.title,r.quickActionTitle,r.description,...r.aliases].join(" ").toLowerCase(),i=n.length===0?1:ka(n,r.quickActionTitle,o);return{...r,score:i}}).filter(r=>r.score>0).sort((r,o)=>o.score-r.score||r.quickActionTitle.localeCompare(o.quickActionTitle))}const tu=new Set(mo([]));function su(e){return typeof e=="string"&&tu.has(e)}function je(e,t){const a=t??ft;switch(e){case"action":return{icon:zs,tileClassName:"border-emerald-300/18 bg-emerald-300/12 text-emerald-100 shadow-[0_18px_36px_rgba(52,211,153,0.12)]",badgeClassName:"border-emerald-300/18 bg-emerald-300/10 text-emerald-100"};case"wiki":return{icon:Oa,tileClassName:"border-blue-300/18 bg-blue-300/12 text-blue-100 shadow-[0_18px_36px_rgba(96,165,250,0.12)]",badgeClassName:"border-blue-300/18 bg-blue-300/10 text-blue-100"};case"note":return{icon:It,tileClassName:"border-amber-300/18 bg-amber-300/12 text-amber-100 shadow-[0_18px_36px_rgba(251,191,36,0.12)]",badgeClassName:"border-amber-300/18 bg-amber-300/10 text-amber-100"};case"insight":return{icon:Ii,tileClassName:"border-emerald-300/18 bg-emerald-300/12 text-emerald-100 shadow-[0_18px_36px_rgba(52,211,153,0.12)]",badgeClassName:"border-emerald-300/18 bg-emerald-300/10 text-emerald-100"};case"calendar":return{icon:$t,tileClassName:"border-cyan-300/18 bg-cyan-300/12 text-cyan-100 shadow-[0_18px_36px_rgba(34,211,238,0.12)]",badgeClassName:"border-cyan-300/18 bg-cyan-300/10 text-cyan-100"};case"route":return{icon:a,tileClassName:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)] shadow-[var(--ui-shadow-soft)]",badgeClassName:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-soft)]"};default:return{icon:a,tileClassName:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)] shadow-[var(--ui-shadow-soft)]",badgeClassName:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-soft)]"}}}function au({item:e}){if(e.kind){const n=Gs(e.kind),r=n.icon;return s.jsx("span",{className:P("mt-0.5 inline-flex size-11 shrink-0 items-center justify-center rounded-[17px] border",n.subtleBadgeClassName),children:s.jsx(r,{className:P("size-5",n.iconClassName)})})}const t=je("search",e.icon),a=e.icon??t.icon;return s.jsx("span",{className:P("mt-0.5 inline-flex size-11 shrink-0 items-center justify-center rounded-[17px] border",e.tileClassName??t.tileClassName),children:s.jsx(a,{className:"size-5"})})}function nu({item:e}){if(e.kind&&e.section==="results")return s.jsx(et,{kind:e.kind,label:e.category,compact:!0,gradient:!1});const t=je(e.section==="quick-actions"?"action":"search",e.icon),a=e.icon??t.icon;return s.jsxs("span",{className:P("inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-[11px] font-medium",e.badgeClassName??t.badgeClassName),children:[s.jsx(a,{className:"size-3.5"}),e.category]})}function We(e,t,a){return`${e} ${t} ${a}`.trim().toLowerCase()}function ru({open:e,onOpenChange:t,snapshot:a,selectedUserIds:n,createActions:r}){var V;const o=Aa(),{t:i}=Le(),l=c.useRef([]),[u,h]=c.useState(""),[m,g]=c.useState(0),[f,x]=c.useState([]),y=c.useDeferredValue(u),R=as(y),p=c.useMemo(()=>Vr.filter(w=>f.includes(w.id)),[f]);c.useEffect(()=>{e||(h(""),g(0),x([]))},[e]);const T=c.useMemo(()=>Vr.map(w=>({value:w.id,label:w.label,description:w.id==="wiki_page"?"Search only KarpaWiki pages.":w.id==="note"?"Search notes and evidence that are not wiki pages.":`Search ${w.label.toLowerCase()} records.`,searchText:w.searchText,kind:w.kind})),[]),_=c.useMemo(()=>({routes:i("common.actionBar.sections.routes"),recent:i("common.actionBar.sections.recent"),"quick-actions":i("common.actionBar.sections.quickActions"),results:i("common.actionBar.sections.results")}),[i]),b=c.useMemo(()=>[{id:"route-overview",title:i("common.routeLabels.overview"),detail:i("common.commandPalette.routeOverview"),href:"/overview",category:i("common.commandPalette.categoryRoute"),section:"routes",searchText:We(i("common.routeLabels.overview"),i("common.commandPalette.routeOverview"),i("common.commandPalette.categoryRoute")),score:0,...je("route",Ci)},{id:"route-today",title:i("common.routeLabels.today"),detail:i("common.commandPalette.routeToday"),href:"/today",category:i("common.commandPalette.categoryRoute"),section:"routes",searchText:We(i("common.routeLabels.today"),i("common.commandPalette.routeToday"),i("common.commandPalette.categoryRoute")),score:0,...je("route",Ws)},{id:"route-kanban",title:i("common.routeLabels.kanban"),detail:i("common.commandPalette.routeKanban"),href:"/kanban",category:i("common.commandPalette.categoryRoute"),section:"routes",searchText:We(i("common.routeLabels.kanban"),i("common.commandPalette.routeKanban"),i("common.commandPalette.categoryRoute")),score:0,...je("route",us)},{id:"route-psyche",title:i("common.routeLabels.psyche"),detail:i("common.commandPalette.routePsyche"),href:"/psyche",category:i("common.commandPalette.categoryRoute"),section:"routes",searchText:We(i("common.routeLabels.psyche"),i("common.commandPalette.routePsyche"),i("common.commandPalette.categoryRoute")),score:0,...je("route",La)},{id:"route-notes",title:i("common.routeLabels.notes"),detail:i("common.commandPalette.routeNotes"),href:"/notes",category:i("common.commandPalette.categoryRoute"),section:"routes",searchText:We(i("common.routeLabels.notes"),i("common.commandPalette.routeNotes"),i("common.commandPalette.categoryRoute")),score:0,...je("route",It)},{id:"route-wiki",title:i("common.routeLabels.wiki"),detail:i("common.commandPalette.routeWiki"),href:"/wiki",category:i("common.commandPalette.categoryRoute"),section:"routes",searchText:We(i("common.routeLabels.wiki"),i("common.commandPalette.routeWiki"),i("common.commandPalette.categoryRoute")),score:0,...je("route",Oa)},{id:"route-goals",title:i("common.routeLabels.goals"),detail:i("common.commandPalette.routeGoals"),href:"/goals",category:i("common.commandPalette.categoryRoute"),section:"routes",searchText:We(i("common.routeLabels.goals"),i("common.commandPalette.routeGoals"),i("common.commandPalette.categoryRoute")),score:0,...je("route",Ra)},{id:"route-habits",title:i("common.routeLabels.habits"),detail:i("common.commandPalette.routeHabits"),href:"/habits",category:i("common.commandPalette.categoryRoute"),section:"routes",searchText:We(i("common.routeLabels.habits"),i("common.commandPalette.routeHabits"),i("common.commandPalette.categoryRoute")),score:0,...je("route",Ea)},{id:"route-projects",title:i("common.routeLabels.projects"),detail:i("common.commandPalette.routeProjects"),href:"/projects",category:i("common.commandPalette.categoryRoute"),section:"routes",searchText:We(i("common.routeLabels.projects"),i("common.commandPalette.routeProjects"),i("common.commandPalette.categoryRoute")),score:0,...je("route",Ri)},{id:"route-strategies",title:i("common.routeLabels.strategies"),detail:i("common.commandPalette.routeStrategies"),href:"/strategies",category:i("common.commandPalette.categoryRoute"),section:"routes",searchText:We(i("common.routeLabels.strategies"),i("common.commandPalette.routeStrategies"),i("common.commandPalette.categoryRoute")),score:0,...je("route",Ht)},{id:"route-preferences",title:i("common.routeLabels.preferences"),detail:i("common.commandPalette.routePreferences"),href:"/preferences",category:i("common.commandPalette.categoryRoute"),section:"routes",searchText:We(i("common.routeLabels.preferences"),i("common.commandPalette.routePreferences"),i("common.commandPalette.categoryRoute")),score:0,...je("route",Da)},{id:"route-calendar",title:i("common.routeLabels.calendar"),detail:i("common.commandPalette.routeCalendar"),href:"/calendar",category:i("common.commandPalette.categoryRoute"),section:"routes",searchText:We(i("common.routeLabels.calendar"),i("common.commandPalette.routeCalendar"),i("common.commandPalette.categoryRoute")),score:0,...je("route",$t)},{id:"route-knowledge-graph",title:"Knowledge Graph",detail:"Open the world model and graph views for Forge.",href:"/knowledge-graph",category:i("common.commandPalette.categoryRoute"),section:"routes",searchText:We("Knowledge Graph","Open the world model and graph views for Forge.",i("common.commandPalette.categoryRoute")),score:0,...je("route",_a)},{id:"route-settings",title:i("common.routeLabels.settings"),detail:i("common.commandPalette.routeSettings"),href:"/settings",category:i("common.commandPalette.categoryRoute"),section:"routes",searchText:We(i("common.routeLabels.settings"),i("common.commandPalette.routeSettings"),i("common.commandPalette.categoryRoute")),score:0,...je("route",Ms)}],[i]),F=c.useMemo(()=>{const w=[...a.overview.topTasks.slice(0,4).map(z=>({id:`task-${z.id}`,title:z.title,detail:Qe(z.user)||i("common.commandPalette.openFocusTask"),href:`/tasks/${z.id}`,category:i("common.commandPalette.categoryTask"),section:"recent",searchText:`${z.title} ${Qe(z.user)}`.toLowerCase(),score:0,kind:"task"})),...a.dashboard.projects.slice(0,3).map(z=>({id:`project-${z.id}`,title:z.title,detail:[z.goalTitle,Qe(z.user)].filter(Boolean).join(" · "),href:`/projects/${z.id}`,category:i("common.commandPalette.categoryProject"),section:"recent",searchText:`${z.title} ${z.goalTitle??""} ${Qe(z.user)}`.toLowerCase(),score:0,kind:"project"})),...a.overview.activeGoals.slice(0,2).map(z=>({id:`goal-${z.id}`,title:z.title,detail:Qe(z.user)||i("common.commandPalette.openLifeGoal"),href:`/goals/${z.id}`,category:i("common.commandPalette.categoryGoal"),section:"recent",searchText:`${z.title} ${Qe(z.user)}`.toLowerCase(),score:0,kind:"goal"})),...a.dashboard.habits.slice(0,2).map(z=>({id:`habit-${z.id}`,title:z.title,detail:[z.frequency==="daily"?"Daily habit":"Weekly habit",Qe(z.user)].filter(Boolean).join(" · "),href:`/habits?focus=${z.id}`,category:i("common.routeLabels.habits"),section:"recent",searchText:`${z.title} ${z.frequency} ${Qe(z.user)}`.toLowerCase(),score:0,kind:"habit"}))].slice(0,8);return[...b.slice(0,6),...w]},[b,a,i]),v=Ks({queryKey:["forge-action-bar-search",R,[...f].sort().join("|"),[...n].sort().join("|")],enabled:e&&(R.length>0||p.length>0),queryFn:async()=>{const w=mo(p),z=await so({searches:w.map(te=>({entityTypes:[te],query:y.trim()||void 0,userIds:n.length>0?n:void 0,limit:te==="note"?6:4,clientRef:te}))}),ie=new Map;for(const te of z.results){const E=Array.isArray(te.matches)?te.matches??[]:[];for(const X of E){if(!X||typeof X!="object")continue;const M=X;if(!su(M.entityType)||typeof M.id!="string"||!M.entity||typeof M.entity!="object")continue;const Z=M.entity;if(!Yd(M.entityType,Z,p))continue;const O=Xd(M.entityType,M.id,Z);if(!O)continue;const se=co(M.entityType,Z),pe=uo(M.entityType,Z),Me=Vs(M.entityType,Z),Te=Jd(M.entityType,Z),Ie=Vd(M.entityType,Z)??void 0,xe=R.length>0?ka(y,se,Te):0;let Ce=je("search");M.entityType==="note"?Ce=je(Z.kind==="wiki"?"wiki":"note"):M.entityType==="insight"?Ce=je("insight"):(M.entityType==="calendar_event"||M.entityType==="task_timebox"||M.entityType==="work_block_template")&&(Ce=je("calendar"));const Ne={id:`${M.entityType}-${M.id}`,title:se,detail:pe,href:O,category:Me,section:"results",searchText:Te,score:xe,kind:Ie,icon:Ce.icon,tileClassName:Ce.tileClassName,badgeClassName:Ce.badgeClassName},we=ie.get(Ne.id);(!we||Ne.score>we.score||Ne.score===we.score&&Ne.title<we.title)&&ie.set(Ne.id,Ne)}}return Array.from(ie.values()).sort((te,E)=>E.score!==te.score?E.score-te.score:te.title.localeCompare(E.title)).slice(0,12)}}),B=c.useMemo(()=>R?b.map(w=>({...w,score:ka(y,w.title,w.searchText)})).filter(w=>w.score>0).sort((w,z)=>z.score-w.score||w.title.localeCompare(z.title)).slice(0,4):[],[y,R,b]),N=c.useMemo(()=>eu(y,r).filter(w=>Zd(w,p)).slice(0,6).map(w=>({id:`quick-${w.id}`,title:w.quickActionTitle,detail:w.description,category:"Quick action",section:"quick-actions",searchText:`${w.quickActionTitle} ${w.description} ${w.aliases.join(" ")}`.toLowerCase(),score:w.score,onSelect:w.onSelect,...je("action",zs)})),[r,y,p]),A=c.useMemo(()=>{if(!R&&p.length===0)return F;const w=[...N,...B],z=new Set(w.map(ie=>ie.id));for(const ie of v.data??[])z.has(ie.id)||(z.add(ie.id),w.push(ie));return w.slice(0,16)},[F,v.data,R,N,B,p.length]);c.useEffect(()=>{g(0)},[R,e,f.join("|")]),c.useEffect(()=>{A.length!==0&&g(w=>Math.min(Math.max(w,0),A.length-1))},[A]),c.useEffect(()=>{const w=l.current[m];w==null||w.scrollIntoView({block:"nearest"})},[m]);const I=A[m]??null,$=a.users.filter(w=>n.includes(w.id)),ee=n.length===0?"All humans and bots":$.length===1?((V=$[0])==null?void 0:V.displayName)??"1 selected owner":`${$.length||n.length} selected owners`,ne=(R.length>0||p.length>0)&&v.isFetching,oe=w=>{if(t(!1),w.onSelect){w.onSelect();return}w.href&&o(w.href)};return s.jsx(yt,{open:e,onOpenChange:t,children:s.jsxs(xt,{children:[s.jsx(bt,{className:"surface-overlay fixed inset-0 z-40 backdrop-blur-xl"}),s.jsxs(vt,{className:"surface-modal-panel fixed inset-x-3 bottom-3 top-3 z-50 flex flex-col overflow-hidden rounded-[30px] border sm:inset-x-6 sm:bottom-6 sm:top-6 md:left-1/2 md:right-auto md:top-[9vh] md:h-[min(82vh,48rem)] md:w-[min(64rem,calc(100vw-2rem))] md:-translate-x-1/2 md:bottom-auto",children:[s.jsx(wt,{className:"sr-only",children:i("common.actionBar.title")}),s.jsx(kt,{className:"sr-only",children:i("common.actionBar.description")}),s.jsxs("div",{className:"border-b border-[var(--ui-border-subtle)] px-4 py-4 sm:px-5",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-1.5 text-[12px] text-[var(--ui-ink-medium)]",children:[s.jsx("span",{className:"rounded-full bg-[var(--ui-surface-2)] px-2 py-0.5 text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Scope"}),s.jsx("span",{children:ee})]}),p.length>0?s.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-1.5 text-[12px] text-[var(--ui-ink-medium)]",children:[s.jsx(il,{className:"size-3.5 text-[var(--ui-ink-faint)]"}),s.jsxs("span",{children:[p.length," filter",p.length===1?"":"s"]})]}):null]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:[s.jsx("span",{className:"rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-2.5 py-1",children:"Shift Shift"}),s.jsx("span",{className:"rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-2.5 py-1",children:"Cmd/Ctrl K"})]})]}),s.jsxs("div",{className:"mt-4 rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-4 shadow-[inset_0_1px_0_var(--ui-border-subtle)]",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(ft,{className:"size-5 text-[var(--ui-ink-faint)]"}),s.jsx(ve,{autoFocus:!0,value:u,onChange:w=>h(w.target.value),onKeyDown:w=>{if(w.key==="ArrowDown"){w.preventDefault(),g(z=>A.length===0?0:Math.min(z+1,A.length-1));return}if(w.key==="ArrowUp"){w.preventDefault(),g(z=>Math.max(z-1,0));return}if(w.key==="Enter"&&I){w.preventDefault(),oe(I);return}w.key==="Escape"&&(w.preventDefault(),t(!1))},placeholder:i("common.actionBar.searchPlaceholder"),className:"border-0 bg-transparent px-0 py-0 text-[1rem] focus:border-0"}),ne?s.jsx(Pi,{className:"size-4 shrink-0 animate-spin text-[var(--ui-ink-faint)]"}):null]}),s.jsx("div",{className:"mt-2 pl-8 text-[13px] leading-6 text-[var(--ui-ink-soft)]",children:i(R?"common.actionBar.activeHint":"common.actionBar.idleHint")}),s.jsxs("div",{className:"mt-4 border-t border-[var(--ui-border-subtle)] pt-4",children:[s.jsx("div",{className:"mb-2 pl-1 text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:i("common.actionBar.filtersLabel")}),s.jsx(Wd,{options:T,selectedValues:f,onChange:x,placeholder:i("common.actionBar.filtersPlaceholder"),emptyMessage:i("common.actionBar.filtersEmpty"),variant:"action-bar"})]})]})]}),s.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 py-3 sm:px-4",children:A.length===0?s.jsx("div",{className:"rounded-[24px] border border-dashed border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-8 text-center text-sm text-[var(--ui-ink-soft)]",children:v.isFetching?i("common.actionBar.searching"):p.length>0?i("common.actionBar.noResultsWithFilters"):i("common.actionBar.noResults")}):s.jsx("div",{className:"grid gap-2",children:A.map((w,z)=>{var E;const te=(((E=A[z-1])==null?void 0:E.section)??null)!==w.section;return s.jsxs("div",{children:[te?s.jsx("div",{className:"px-2 pb-1 pt-2 text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)] first:pt-0",children:_[w.section]}):null,s.jsxs("button",{ref:X=>{l.current[z]=X},type:"button",className:P("group flex w-full items-start gap-3 rounded-[24px] border px-4 py-3.5 text-left transition",z===m?"border-[var(--ui-border-strong)] bg-[var(--ui-surface-3)] shadow-[var(--ui-shadow-soft)]":"border-transparent bg-[var(--ui-surface-1)] hover:border-[var(--ui-border-subtle)] hover:bg-[var(--ui-surface-hover)]"),onMouseEnter:()=>g(z),onClick:()=>oe(w),children:[s.jsx(au,{item:w}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"flex flex-wrap items-center gap-2",children:s.jsx(nu,{item:w})}),s.jsx("div",{className:"mt-2 text-[15px] font-medium text-[var(--ui-ink-strong)]",children:w.kind&&w.section==="results"?s.jsx(gs,{kind:w.kind,label:w.title,showIcon:!1,labelClassName:"text-[var(--ui-ink-strong)]"}):w.title}),s.jsx("div",{className:"mt-1 text-sm leading-6 text-[var(--ui-ink-soft)]",children:w.detail})]}),s.jsx(Ti,{className:P("mt-1 size-4 shrink-0 transition",z===m?"text-[var(--ui-ink-medium)]":"text-[var(--ui-ink-faint)] group-hover:text-[var(--ui-ink-soft)]")})]})]},w.id)})})}),s.jsx("div",{className:"border-t border-[var(--ui-border-subtle)] px-4 py-3 sm:px-5",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[12px] text-[var(--ui-ink-faint)]",children:[s.jsx("span",{className:"rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-2.5 py-1",children:"Up/Down navigate"}),s.jsx("span",{className:"rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-2.5 py-1",children:"Enter open"}),s.jsx("span",{className:"rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-2.5 py-1",children:"Esc close"})]})})]})]})})}function Jr({routeKey:e,tone:t="core",children:a}){return s.jsx(gt.div,{"data-route-key":e,"data-route-tone":t,className:"w-full max-w-full min-w-0",initial:!1,animate:{opacity:1,y:0},transition:{duration:.12,ease:"easeOut"},children:a})}function fs({className:e,"aria-label":t="Close dialog",title:a="Close",...n}){return s.jsx("button",{type:"button","aria-label":t,title:a,className:P("inline-flex size-10 shrink-0 items-center justify-center rounded-full border border-white/10 bg-white/[0.05] text-white/72 transition hover:bg-white/[0.1] hover:text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[rgba(192,193,255,0.45)]",e),...n,children:s.jsx(ut,{className:"size-[1.05rem]"})})}function Va({open:e,onOpenChange:t,eyebrow:a,title:n,description:r,children:o}){return s.jsx(yt,{open:e,onOpenChange:t,children:s.jsxs(xt,{children:[s.jsx(bt,{className:"surface-overlay fixed inset-0 z-40 backdrop-blur-xl"}),s.jsxs(vt,{className:"surface-modal-panel fixed inset-x-4 bottom-4 top-4 z-50 mx-auto flex max-w-xl flex-col overflow-hidden rounded-[32px] border",children:[s.jsx("div",{className:"border-b border-[var(--ui-border-subtle)] px-5 py-5",children:s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx("div",{className:"type-label text-[var(--ui-ink-faint)]",children:a}),s.jsx(wt,{className:"mt-2 type-display-section text-[var(--ui-ink-strong)]",children:n}),r?s.jsx(kt,{className:"mt-3 type-body text-[var(--ui-ink-soft)]",children:r}):null]}),s.jsx(Mt,{asChild:!0,children:s.jsx(fs,{})})]})}),s.jsx("div",{className:"min-h-0 flex-1 overflow-x-hidden overflow-y-auto p-4",children:o})]})]})})}const iu={spark:"Spark stage",story:"Story stage",state:"State stage",lens:"Lens stage",pivot:"Pivot stage"};function ou(e,t){return`${e}:${t}`}function Ew(e,t,a){return(e==null?void 0:e[ou(t,a)])??{count:0,latestNoteId:null,latestCreatedAt:null}}function Aw(e){return`${e} Note${e===1?"":"s"}`}function lu(e){return e.replaceAll("_"," ")}function cu(e){if(!e)return null;const t=e.trim().toLowerCase(),a=iu[t];return a||t.split(/[_\-\s]+/).filter(Boolean).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ")}function Ow(e,t){const a=cu(t);return a?e==="trigger_report"?`This note is pinned to the ${a.toLowerCase()} of the report, so it stays attached to that part of the reflective chain.`:`This note is pinned to the "${a}" section of the ${lu(e)} instead of only the whole entity.`:null}function po(e,t){switch(e){case"goal":return`/goals/${t}`;case"project":return`/projects/${t}`;case"task":return`/tasks/${t}`;case"strategy":return`/strategies/${t}`;case"psyche_value":return`/psyche/values?focus=${t}#values-atlas`;case"behavior_pattern":return`/psyche/patterns?focus=${t}#pattern-lanes`;case"behavior":return`/psyche/behaviors?focus=${t}#behavior-columns`;case"belief_entry":return`/psyche/schemas-beliefs?focus=${t}`;case"mode_profile":return`/psyche/modes?focus=${t}`;case"flashcard":return`/psyche/flashcards?focus=${t}`;case"trigger_report":return`/psyche/reports/${t}`;default:return null}}function ho(e,t){switch(e){case"goal":case"project":case"task":case"strategy":case"trigger_report":{const a=po(e,t);return a?`${a}#notes`:null}default:return`/notes?entityType=${encodeURIComponent(e)}&entityId=${encodeURIComponent(t)}`}}function Lw(e){return e.links.find(t=>po(t.entityType,t.entityId)!==null)??e.links[0]??null}function du(e){switch(e.entityType){case"workbench_flow":case"workbench_surface":case"wiki_space":return null;default:return ho(e.entityType,e.entityId)}}function uu({group:e,onSelectNode:t}){return e.relations.length===0?null:s.jsxs("section",{className:"grid gap-3 rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:e.label}),s.jsxs("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:[e.itemCount," entities across ",e.relationCount," relation",e.relationCount===1?"":"s"]})]}),s.jsx(le,{className:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-section)] text-[var(--ui-ink-medium)]",children:e.family})]}),s.jsx("div",{className:"grid gap-3",children:e.relations.map(a=>s.jsxs("div",{className:"grid gap-2",children:[s.jsx("div",{className:"text-xs font-medium text-[var(--ui-ink-soft)]",children:a.label}),s.jsx("div",{className:"grid gap-2",children:a.items.map(n=>s.jsxs("button",{type:"button",className:"flex min-w-0 items-center justify-between gap-3 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-section)] px-3 py-2 text-left transition hover:border-[var(--ui-border-strong)] hover:bg-[var(--ui-surface-hover)]",onClick:()=>t(n),children:[s.jsxs("span",{className:"min-w-0",children:[s.jsx(gs,{kind:n.entityKind,label:n.title,className:"max-w-full",lines:1}),n.subtitle?s.jsx("span",{className:"mt-1 block truncate text-[12px] text-[var(--ui-ink-soft)]",children:n.subtitle}):null]}),s.jsx(qs,{className:"size-4 shrink-0 text-[var(--ui-ink-faint)]"})]},n.id))})]},a.relationKind))})]})}function mu({focus:e,onOpenPage:t,onOpenNotes:a,onOpenHierarchy:n,onSelectNode:r,className:o}){var h;if(!e.focusNode)return s.jsx("div",{className:P("grid h-full place-items-center rounded-[24px] border border-dashed border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-6 text-center",o),children:s.jsxs("div",{className:"grid gap-2",children:[s.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Focus"}),s.jsx("div",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Select a node to inspect its structure, context, and nearby navigation paths."})]})});const i=e.focusNode,l=du(i),u=Object.values(e.secondRingCounts).reduce((m,g)=>m+g,0);return s.jsxs("div",{className:P("grid gap-4",o),children:[s.jsxs("div",{className:"grid gap-4 rounded-[24px] border border-[var(--ui-border-subtle)] bg-[linear-gradient(180deg,rgba(11,17,30,0.98),rgba(9,14,24,0.96))] p-4 shadow-[0_28px_90px_rgba(0,0,0,0.3)]",children:[s.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx(et,{kind:i.entityKind,label:i.entityKind.replaceAll("_"," "),compact:!0}),s.jsx("div",{className:"mt-3",children:s.jsx(gs,{kind:i.entityKind,label:i.title,variant:"heading",size:"lg",lines:3,className:"max-w-full"})}),i.subtitle?s.jsx("div",{className:"mt-2 text-sm text-[var(--ui-ink-soft)]",children:i.subtitle}):null]}),s.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[(h=i.owner)!=null&&h.displayName?s.jsx(le,{className:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]",children:i.owner.displayName}):null,i.updatedAt?s.jsxs(le,{className:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]",children:["Updated ",uc(i.updatedAt)]}):null]})]}),i.description?s.jsx("div",{className:"text-sm leading-6 text-[var(--ui-ink-soft)]",children:i.description}):null,s.jsxs("div",{className:"flex flex-wrap gap-2",children:[i.previewStats.map(m=>s.jsxs(le,{className:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]",children:[m.label,": ",m.value]},`${m.label}-${m.value}`)),s.jsxs(le,{className:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]",children:["Degree: ",i.graphStats.degree]}),s.jsxs(le,{className:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]",children:["Structural: ",i.graphStats.structuralDegree]}),s.jsxs(le,{className:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]",children:["Contextual: ",i.graphStats.contextualDegree]}),s.jsxs(le,{className:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]",children:["Nearby second ring: ",u]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[i.href?s.jsxs(de,{variant:"secondary",onClick:()=>t(i),children:[s.jsx(qs,{className:"size-4"}),"Open page"]}):null,l?s.jsxs(de,{variant:"secondary",onClick:()=>a(i),children:[s.jsx(It,{className:"size-4"}),"Open notes"]}):null,s.jsxs(de,{variant:"secondary",onClick:()=>n(i),children:[s.jsx(_i,{className:"size-4"}),"Open in hierarchy"]})]})]}),s.jsx("div",{className:"grid gap-4",children:e.familyGroups.length>0?e.familyGroups.map(m=>s.jsx(uu,{group:m,onSelectNode:r},m.family)):s.jsx("div",{className:"rounded-[20px] border border-dashed border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-5 text-sm text-[var(--ui-ink-soft)]",children:"This node has no explicit first-ring relationships in the current graph filters."})})]})}function pu({focus:e,onOpenPage:t,onOpenNotes:a,onOpenHierarchy:n,onSelectNode:r,onClose:o}){return s.jsxs("aside",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-[var(--ui-border-subtle)] px-4 py-3",children:[s.jsxs("div",{className:"inline-flex items-center gap-2 text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-soft)]",children:[s.jsx(ol,{className:"size-3.5"}),"Focus Node"]}),o?s.jsxs(de,{variant:"secondary",size:"sm",onClick:o,children:[s.jsx(ut,{className:"size-4"}),"Close"]}):null]}),s.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 pb-4 pt-3",children:s.jsx(mu,{focus:e,onOpenPage:t,onOpenNotes:a,onOpenHierarchy:n,onSelectNode:r})})]})}const At=16,hu=320,gu=180,fu=220;function yu({children:e,className:t}){return s.jsx("div",{className:P("text-sm leading-6 text-white/50",t),children:e})}function Dt({content:e,title:t,label:a="Explain this field",className:n,panelClassName:r}){const[o,i]=c.useState(!1),[l,u]=c.useState({}),h=c.useRef(null),m=c.useRef(null),g=c.useId(),f=typeof document>"u"?null:Fs.createPortal(s.jsxs("span",{id:g,role:"tooltip","aria-hidden":!o,"data-state":o?"open":"closed",style:l,className:P("pointer-events-none fixed z-[9999] grid overflow-y-auto rounded-[8px] border border-white/10 bg-[#0c111e] px-3 py-2.5 text-left font-sans text-sm normal-case leading-6 tracking-normal text-white/74 shadow-[0_18px_48px_rgba(3,8,18,0.42)] transition",o?"translate-y-0 opacity-100":"translate-y-1 opacity-0",r),children:[t?s.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-white/58",children:t}):null,s.jsx("span",{className:"block min-w-0 whitespace-normal break-words",children:e})]}),document.body);return c.useLayoutEffect(()=>{if(!o)return;const x=()=>{const y=m.current;if(!y)return;const R=y.getBoundingClientRect(),p=window.innerWidth<480?window.innerWidth-At*2:Math.min(hu,window.innerWidth-At*2),T=R.left+R.width/2-p/2,_=window.innerWidth-p-At,b=Math.max(At,Math.min(T,_)),v=window.innerHeight-R.bottom>=gu?R.bottom+8:Math.max(At,R.top-fu);u({left:b,maxHeight:`calc(100vh - ${v+At}px)`,top:v,width:p})};return x(),window.addEventListener("resize",x),window.addEventListener("scroll",x,!0),()=>{window.removeEventListener("resize",x),window.removeEventListener("scroll",x,!0)}},[o]),c.useEffect(()=>{if(!o)return;const x=y=>{var R;(R=h.current)!=null&&R.contains(y.target)||i(!1)};return document.addEventListener("pointerdown",x),()=>document.removeEventListener("pointerdown",x)},[o]),s.jsxs("span",{ref:h,className:P("relative inline-flex items-center",n),onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:[s.jsx("button",{ref:m,type:"button","aria-label":a,"aria-describedby":o?g:void 0,"aria-expanded":o,className:"inline-flex size-5 items-center justify-center rounded-full text-white/42 transition hover:bg-white/[0.06] hover:text-white/78 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[rgba(192,193,255,0.35)]",onFocus:()=>i(!0),onBlur:()=>i(!1),onClick:()=>i(x=>!x),onKeyDown:x=>{x.key==="Escape"&&i(!1)},children:s.jsx(ll,{className:"size-3.5"})}),f]})}const Xr="(max-width: 1023px)",xu="forge.question-flow-draft",go=1,bu=1e3;function vu({open:e,wasOpen:t,initialStepId:a,previousInitialStepId:n,currentStepIndex:r,steps:o}){if(!e)return 0;const i=()=>{if(!a)return 0;const u=o.findIndex(h=>h.id===a);return u>=0?u:0};return!t||n!==a?i():o.length===0?0:r>=o.length?Math.max(0,o.length-1):r<0?0:r}function wu(e){const t=e.split(/\n\s*\n/g).map(a=>a.split(`
3
+ `).map(n=>n.trim()).filter(n=>n.length>0)).filter(a=>a.length>0);return t.length===0?null:s.jsx("div",{className:"grid gap-2",children:t.map((a,n)=>{const r=a.filter(i=>i.startsWith("- ")),o=a.filter(i=>!i.startsWith("- "));return s.jsxs("div",{className:"grid gap-2",children:[o.map((i,l)=>s.jsx("p",{children:i},`${n}-${i}-${l}`)),r.length>0?s.jsx("ul",{className:"grid list-disc gap-1 pl-5",children:r.map((i,l)=>s.jsx("li",{children:i.slice(2)},`${n}-${i}-${l}`))}):null]},`section-${n}`)})})}function ku(){const[e,t]=c.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(Xr).matches);return c.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const a=window.matchMedia(Xr),n=r=>{t(r.matches)};return t(a.matches),typeof a.addEventListener=="function"?(a.addEventListener("change",n),()=>a.removeEventListener("change",n)):(a.addListener(n),()=>a.removeListener(n))},[]),e}function Js(){return typeof window<"u"&&typeof window.localStorage<"u"}function Ja(e){return`${xu}.${e}`}function Qr(e){try{return JSON.stringify(e)}catch{return null}}function ju(e){if(!Js())return null;try{const t=window.localStorage.getItem(Ja(e));if(!t)return null;const a=JSON.parse(t);return a.version!==go||typeof a.baseline!="string"||typeof a.draft!="string"?null:a}catch{return null}}function Su(e,t){if(Js())try{window.localStorage.setItem(Ja(e),JSON.stringify(t))}catch{}}function Yr(e){if(Js())try{window.localStorage.removeItem(Ja(e))}catch{}}function ae({label:e,description:t,labelHelp:a,hint:n,error:r,children:o}){return s.jsxs("label",{className:"grid gap-2",children:[s.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-white",children:[s.jsx("span",{children:e}),a?s.jsx(Dt,{content:a,label:`Explain ${e}`}):null]}),t?s.jsx("span",{className:"text-sm leading-6 text-white/54",children:t}):null,o,n?s.jsx(yu,{children:n}):null,r?s.jsx("span",{className:"text-sm text-rose-300",children:r}):null]})}function Ye({options:e,value:t,onChange:a,columns:n=2}){return s.jsx("div",{className:P("grid gap-3",n===3?"md:grid-cols-3":"md:grid-cols-2"),children:e.map(r=>{const o=r.value===t;return s.jsxs("button",{type:"button",className:P("rounded-[22px] border px-4 py-4 text-left transition",o?"border-[rgba(192,193,255,0.28)] bg-[rgba(192,193,255,0.14)] text-white shadow-[0_18px_36px_rgba(5,12,24,0.24)]":"border-white/8 bg-white/[0.04] text-white/72 hover:bg-white/[0.07]"),onClick:()=>a(r.value),children:[s.jsx("div",{className:"font-medium",children:r.label}),r.description?s.jsx("div",{className:"mt-2 text-sm leading-6 text-white/54",children:r.description}):null]},r.value)})})}function Xa({open:e,onOpenChange:t,eyebrow:a,title:n,description:r,value:o,onChange:i,steps:l,onSubmit:u,submitLabel:h,pending:m=!1,pendingLabel:g,error:f,resolveError:x,initialStepId:y,contentClassName:R,draftPersistenceKey:p}){const{t:T}=Le(),_=ku(),[b,F]=c.useState(0),v=c.useRef(e),B=c.useRef(y),N=c.useRef(e),A=c.useRef(null),I=c.useRef(null),$=c.useRef(null),ee=c.useRef(o),ne=l[b];ee.current=o,c.useEffect(()=>{const M=v.current,Z=B.current,O=vu({open:e,wasOpen:M,initialStepId:y,previousInitialStepId:Z,currentStepIndex:b,steps:l});v.current=e,B.current=y,O!==b&&F(O)},[y,e,b,l]);const oe=M=>{i({...o,...M})},V=l.length,w=V===0?0:(b+1)/V*100,z=ne?x==null?void 0:x(ne.id):void 0,ie=z===void 0?f:z,te=c.useCallback(()=>{if(!p)return;const M=I.current,Z=Qr(ee.current);if(!(!M||!Z)){if(Z===M){Yr(p),$.current=Z;return}$.current!==Z&&(Su(p,{version:go,baseline:M,draft:Z,updatedAt:Date.now()}),$.current=Z)}},[p]);c.useEffect(()=>{if(!e){A.current=null;return}if(!p){I.current=null,$.current=null;return}const M=Qr(o);if(!M||A.current===p)return;A.current=p,I.current=M;const Z=ju(p);if(Z&&Z.baseline===M&&Z.draft!==M)try{i(JSON.parse(Z.draft)),$.current=Z.draft;return}catch{Yr(p)}$.current=M},[p,i,e,o]),c.useEffect(()=>{if(!p||!e||!Js())return;const M=window.setInterval(()=>{te()},bu);return()=>window.clearInterval(M)},[p,e,te]),c.useEffect(()=>{N.current&&!e&&te(),N.current=e},[e,te]);const E=M=>{te(),F(M)},X=M=>{M||te(),t(M)};return s.jsx(yt,{open:e,onOpenChange:X,children:s.jsxs(xt,{children:[s.jsx(bt,{className:"fixed inset-0 z-40 bg-[rgba(4,8,18,0.72)] backdrop-blur-xl"}),s.jsxs(vt,{"data-testid":"question-flow-dialog",className:P("fixed z-50 flex flex-col overflow-hidden border border-white/8 bg-[linear-gradient(180deg,rgba(21,28,44,0.985),rgba(12,17,30,0.985))] shadow-[0_30px_90px_rgba(3,8,18,0.45)]",_?"inset-x-3 bottom-3 top-4 rounded-[30px]":"left-1/2 top-1/2 h-[min(52rem,calc(100vh-1rem))] w-[min(56rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 rounded-[34px]",R),children:[s.jsx(wt,{className:"sr-only",children:n}),s.jsx(kt,{className:"sr-only",children:r}),s.jsx("div",{className:"sticky top-0 z-10 border-b border-white/8 bg-[rgba(12,17,30,0.9)] px-4 py-2.5 backdrop-blur-xl md:px-6",children:s.jsxs("div",{className:"flex items-center justify-between gap-4",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3 text-[11px] uppercase tracking-[0.18em] text-white/42",children:[s.jsx("span",{className:"truncate",children:a}),s.jsxs("span",{className:"whitespace-nowrap",children:["Step ",b+1," of ",V]})]}),s.jsx("div",{className:"mt-2 h-1.5 rounded-full bg-white/[0.06]",children:s.jsx(gt.div,{className:"h-full rounded-full bg-[linear-gradient(90deg,rgba(192,193,255,0.9),rgba(125,211,252,0.82))]",animate:{width:`${w}%`},transition:{duration:.35,ease:"easeOut"}})})]}),s.jsx(Mt,{asChild:!0,children:s.jsx(fs,{"aria-label":T("common.dialogs.closeDialog")})})]})}),s.jsx("div",{"data-testid":"question-flow-canvas",className:"min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 py-4 md:px-6 md:py-5",children:s.jsx(Ma,{mode:"wait",children:s.jsx(gt.div,{initial:{opacity:0,y:18},animate:{opacity:1,y:0},exit:{opacity:0,y:-18},transition:{duration:.28,ease:"easeOut"},className:"flex min-h-full min-w-0 flex-col gap-5",children:s.jsxs("div",{className:"flex min-h-full min-w-0 flex-col justify-start",children:[ne.eyebrow?s.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--secondary)]",children:ne.eyebrow}):null,s.jsx("h3",{className:"mt-1.5 font-display text-[clamp(1.45rem,2.15vw,2rem)] leading-tight text-white",children:ne.title}),ne.description?s.jsx("p",{className:"mt-1.5 max-w-3xl text-sm leading-6 text-white/58",children:ne.description}):null,ie?s.jsx("div",{className:"mt-4 rounded-[20px] border border-rose-400/20 bg-rose-400/10 px-4 py-3 text-sm leading-6 text-rose-100",children:wu(ie)}):null,s.jsx("div",{className:"mt-5 grid flex-1 content-start gap-5",children:ne.render(o,oe)})]})},ne.id)})}),s.jsx("div",{className:"sticky bottom-0 border-t border-white/8 bg-[rgba(12,17,30,0.92)] px-4 pt-2.5 pb-[calc(env(safe-area-inset-bottom)+0.75rem)] backdrop-blur-xl md:px-6 md:pb-3",children:s.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2 sm:justify-between",children:[s.jsx("div",{className:"hidden min-w-0 shrink text-[12px] text-white/45 sm:block",children:s.jsxs("span",{className:"truncate whitespace-nowrap",children:["Step ",b+1,"/",V]})}),s.jsxs("div",{className:"flex min-w-0 shrink-0 flex-wrap items-center justify-end gap-1.5 sm:gap-2",children:[b>0?s.jsxs(de,{type:"button",variant:"secondary",className:"min-w-max px-3 text-[12px]",onClick:()=>E(Math.max(0,b-1)),children:[s.jsx(cl,{className:"size-4"}),"Back"]}):s.jsx(Mt,{asChild:!0,children:s.jsx(de,{type:"button",variant:"secondary",className:"min-w-max px-3 text-[12px]",children:T("common.actions.cancel")})}),b<V-1?s.jsxs(de,{type:"button",className:"min-w-max px-3 text-[12px]",onClick:()=>E(Math.min(V-1,b+1)),children:["Continue",s.jsx(Ti,{className:"size-4"})]}):s.jsxs(de,{type:"button",className:"min-w-max px-3 text-[12px]",pending:m,pendingLabel:g,onClick:()=>{te(),u()},children:[s.jsx(Ei,{className:"size-4"}),h]})]})]})})]})]})})}const at=c.forwardRef(function({className:t,...a},n){return s.jsx("textarea",{ref:n,...a,className:P("min-h-28 w-full rounded-[22px] border border-white/8 bg-white/6 px-4 py-3 text-[15px] text-white outline-none placeholder:text-white/35 focus:border-[rgba(192,193,255,0.35)]",t)})}),Nu={contentMarkdown:"",author:""};function Pu(){return{...Nu}}function Qa({notes:e,onChange:t,entityLabel:a}){return s.jsxs("div",{className:"grid gap-3",children:[e.length===0?s.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4 text-sm leading-6 text-white/58",children:["Add an optional Markdown note if this ",a," should start with context, evidence, or a clear handoff summary."]}):null,e.map((n,r)=>s.jsxs("div",{className:"rounded-[20px] border border-white/8 bg-white/[0.04] p-4",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsxs("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:["Creation note ",r+1]}),s.jsx(de,{type:"button",variant:"ghost",size:"sm",onClick:()=>t(e.filter((o,i)=>i!==r)),children:"Remove"})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[s.jsxs("label",{className:"grid gap-2",children:[s.jsx("span",{className:"text-sm text-white/58",children:"Author"}),s.jsx(ve,{value:n.author,placeholder:"Albert",onChange:o=>t(e.map((i,l)=>l===r?{...i,author:o.target.value}:i))})]}),s.jsxs("label",{className:"grid gap-2",children:[s.jsx("span",{className:"text-sm text-white/58",children:"Markdown note"}),s.jsx(at,{className:"min-h-28",value:n.contentMarkdown,placeholder:"Capture why this was created now, what changed, or what the next person should know.",onChange:o=>t(e.map((i,l)=>l===r?{...i,contentMarkdown:o.target.value}:i))})]})]})]},r)),s.jsx("div",{children:s.jsx(de,{type:"button",variant:"secondary",onClick:()=>t([...e,Pu()]),children:"Add creation note"})})]})}function Ya({value:e,users:t,onChange:a,label:n="Owner",defaultLabel:r="Default Forge owner",help:o}){return s.jsxs("label",{className:"grid gap-2",children:[s.jsx("span",{className:"text-sm font-medium text-white",children:n}),o?s.jsx("span",{className:"text-xs leading-5 text-white/52",children:o}):null,s.jsxs("select",{value:e??"",onChange:i=>a(i.target.value||null),className:"min-h-10 rounded-[var(--radius-control)] border border-white/10 bg-white/[0.04] px-3 py-2 text-sm text-white outline-none transition focus:border-[rgba(192,193,255,0.3)]",children:[s.jsx("option",{value:"",children:r}),t.map(i=>s.jsxs("option",{value:i.id,children:[i.displayName," · ",i.kind]},i.id))]})]})}const Tu=["obsidian","solar","aurora","ember","paper","dawn","atelier","custom","system"],Iu=fe(Tu),ht=k().trim().regex(/^#[0-9a-fA-F]{6}$/,"Use a 6-digit hex color"),Cu=me({label:k().trim().min(1,"Theme name is required").max(40),primary:ht,secondary:ht,tertiary:ht,canvas:ht,panel:ht,panelHigh:ht,panelLow:ht,ink:ht}),Ru=["--primary","--secondary","--tertiary","--surface","--surface-low","--surface-panel","--surface-high","--surface-glass","--surface-psyche","--surface-psyche-high","--hero-gradient","--card-gradient","--card-shadow","--card-shadow-hover","--forge-body-ambient-primary","--forge-body-ambient-secondary","--forge-body-gradient-start","--forge-body-gradient-end","--forge-body-text"],fo={label:"Custom Forge",primary:"#7cc7ff",secondary:"#4edea3",tertiary:"#ffb95f",canvas:"#0b1326",panel:"#171f33",panelHigh:"#222a3d",panelLow:"#131b2e",ink:"#eef2ff"},Oe={obsidian:{label:"Obsidian",description:"Deep indigo with cool neon edges. This is the current default.",mode:"dark",preview:{label:"Obsidian",primary:"#c0c1ff",secondary:"#4edea3",tertiary:"#ffb95f",canvas:"#0b1326",panel:"#171f33",panelHigh:"#222a3d",panelLow:"#131b2e",ink:"#eef2ff"}},solar:{label:"Catppuccin",description:"Pastel mocha surfaces inspired by the widely adopted Catppuccin palette.",mode:"dark",preview:{label:"Catppuccin",primary:"#cba6f7",secondary:"#94e2d5",tertiary:"#fab387",canvas:"#1e1e2e",panel:"#313244",panelHigh:"#45475a",panelLow:"#181825",ink:"#cdd6f4"}},aurora:{label:"Nord",description:"Arctic blue-grey surfaces based on Nord's clean and uncluttered palette.",mode:"dark",preview:{label:"Nord",primary:"#88c0d0",secondary:"#a3be8c",tertiary:"#ebcb8b",canvas:"#2e3440",panel:"#3b4252",panelHigh:"#434c5e",panelLow:"#242933",ink:"#eceff4"}},ember:{label:"Dracula",description:"High-contrast purple and pink accents drawn from the official Dracula specification.",mode:"dark",preview:{label:"Dracula",primary:"#bd93f9",secondary:"#8be9fd",tertiary:"#ff79c6",canvas:"#282a36",panel:"#343746",panelHigh:"#424450",panelLow:"#21222c",ink:"#f8f8f2"}},paper:{label:"Paper",description:"Warm ivory surfaces with navy ink and restrained blue-green accents for a crisp daytime workspace.",mode:"light",preview:{label:"Paper",primary:"#2f6fed",secondary:"#1d8f6b",tertiary:"#c9772b",canvas:"#f4efe6",panel:"#fbf7f1",panelHigh:"#ffffff",panelLow:"#e5ddd0",ink:"#182235"}},dawn:{label:"Dawn",description:"Rosy morning tones with plum-blue ink and enough contrast to stay readable across dense settings screens.",mode:"light",preview:{label:"Dawn",primary:"#8b5cf6",secondary:"#ec7a6b",tertiary:"#d0a12b",canvas:"#f8eef1",panel:"#fff7f8",panelHigh:"#ffffff",panelLow:"#ead9df",ink:"#2d1834"}},atelier:{label:"Atelier",description:"Cool drafting-table neutrals with slate ink and modern cobalt accents for a brighter, studio-like shell.",mode:"light",preview:{label:"Atelier",primary:"#2563eb",secondary:"#0f8b6d",tertiary:"#b85c38",canvas:"#edf3f7",panel:"#f8fbfd",panelHigh:"#ffffff",panelLow:"#dbe5ec",ink:"#162334"}}},Dw=[{value:"obsidian",label:Oe.obsidian.label,description:Oe.obsidian.description},{value:"solar",label:Oe.solar.label,description:Oe.solar.description},{value:"aurora",label:Oe.aurora.label,description:Oe.aurora.description},{value:"ember",label:Oe.ember.label,description:Oe.ember.description},{value:"paper",label:Oe.paper.label,description:Oe.paper.description},{value:"dawn",label:Oe.dawn.label,description:Oe.dawn.description},{value:"atelier",label:Oe.atelier.label,description:Oe.atelier.description},{value:"custom",label:"Custom",description:"Use your own Forge token set through the guided editor or direct JSON import."},{value:"system",label:"System",description:"Follow the device preference. Forge maps dark mode to Obsidian and light mode to Paper."}];function ja(e){const t=e.replace("#","");return{r:Number.parseInt(t.slice(0,2),16),g:Number.parseInt(t.slice(2,4),16),b:Number.parseInt(t.slice(4,6),16)}}function _u({r:e,g:t,b:a}){return`#${[e,t,a].map(n=>Math.max(0,Math.min(255,Math.round(n))).toString(16).padStart(2,"0")).join("")}`}function Nt(e,t,a){const n=ja(e),r=ja(t);return _u({r:n.r+(r.r-n.r)*a,g:n.g+(r.g-n.g)*a,b:n.b+(r.b-n.b)*a})}function Xe(e,t){const{r:a,g:n,b:r}=ja(e);return`rgba(${a}, ${n}, ${r}, ${t})`}function Eu(e,t){return e==="system"?t?"obsidian":"paper":e}function $w(e,t){return e==="custom"?t??fo:e==="system"?Oe.obsidian.preview:Oe[e].preview}function Au(e){const t=Nt(e.panelHigh,e.primary,.08),a=Nt(e.panelHigh,e.primary,.16),n=Nt(e.canvas,e.secondary,.06);return{"--primary":e.primary,"--secondary":e.secondary,"--tertiary":e.tertiary,"--surface":e.canvas,"--surface-low":e.panelLow,"--surface-panel":e.panel,"--surface-high":e.panelHigh,"--surface-glass":Xe(e.canvas,.82),"--surface-psyche":Xe(Nt(e.canvas,e.secondary,.12),.94),"--surface-psyche-high":Xe(Nt(e.panelHigh,e.secondary,.1),.96),"--hero-gradient":`linear-gradient(180deg, ${Xe(a,.95)}, ${Xe(n,.95)})`,"--card-gradient":`linear-gradient(180deg, ${Xe(t,.96)}, ${Xe(e.panelLow,.94)})`,"--card-shadow":`0 24px 60px ${Xe(e.canvas,.3)}`,"--card-shadow-hover":`0 32px 80px ${Xe(e.canvas,.38)}`,"--forge-body-ambient-primary":Xe(e.primary,.2),"--forge-body-ambient-secondary":Xe(e.secondary,.14),"--forge-body-gradient-start":Nt(e.panel,e.primary,.08),"--forge-body-gradient-end":Nt(e.canvas,"#000000",.16),"--forge-body-text":e.ink}}function Ou(e,t){if(typeof document>"u")return;const a=typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,n=Eu(e,a),r=document.body,o=document.documentElement;if(r.classList.remove("theme-forge-dark","theme-forge-light","theme-forge-obsidian","theme-forge-solar","theme-forge-aurora","theme-forge-ember","theme-forge-paper","theme-forge-dawn","theme-forge-atelier","theme-forge-custom"),n==="custom"){const i=t??fo,l=Au(i);r.classList.add("theme-forge-custom"),r.classList.add("theme-forge-dark");for(const[u,h]of Object.entries(l))o.style.setProperty(u,h);o.dataset.forgeTheme=i.label;return}for(const i of Ru)o.style.removeProperty(i);delete o.dataset.forgeTheme,r.classList.add(Oe[n].mode==="light"?"theme-forge-light":"theme-forge-dark"),r.classList.add(`theme-forge-${n}`)}const Lu=fe(["en","fr"]),Du=fe(["dark-fantasy","dramatic-smithie","mind-locksmith"]),Za=me({contentMarkdown:k().trim().min(1,"Note content is required"),author:k().trim()}),$u=me({title:k().trim().min(1,"Title is required"),description:k().trim(),horizon:fe(["quarter","year","lifetime"]),status:fe(["active","paused","completed"]),userId:k().trim().nullable().optional(),targetPoints:Ee.number().int().min(25).max(1e4),themeColor:k().trim().regex(/^#[0-9a-fA-F]{6}$/,"Theme color must be a valid hex value"),tagIds:ue(k()),notes:ue(Za)}),Mu=me({goalId:k().trim().min(1,"Life goal is required"),title:k().trim().min(1,"Title is required"),description:k().trim(),status:fe(["active","paused","completed"]),workflowStatus:fe(["backlog","focus","in_progress","blocked","done"]),userId:k().trim().nullable().optional(),assigneeUserIds:ue(k().trim()),targetPoints:Ee.number().int().min(25).max(1e4),themeColor:k().trim().regex(/^#[0-9a-fA-F]{6}$/,"Theme color must be a valid hex value"),productRequirementsDocument:k().trim(),notes:ue(Za)}),Mw=me({profile:me({operatorName:k().trim().min(1,"Name is required"),operatorEmail:k().trim().min(1,"Email is required"),operatorTitle:k().trim().min(1,"Title is required")}),notifications:me({goalDriftAlerts:Pt(),dailyQuestReminders:Pt(),achievementCelebrations:Pt()}),execution:me({maxActiveTasks:Ee.number().int().min(1).max(8),timeAccountingMode:fe(["split","parallel","primary_only"])}),themePreference:Iu,gamificationTheme:Du.default("dramatic-smithie"),customTheme:Cu.nullable().optional(),localePreference:Lu,calendarProviders:me({google:me({clientId:k().trim().optional(),clientSecret:k().trim().optional(),storedClientId:k().optional(),storedClientSecret:k().optional(),appBaseUrl:k().optional(),redirectUri:k().optional(),allowedOrigins:ue(k()).optional(),usesPkce:es(!0).optional(),requiresServerClientSecret:es(!1).optional(),oauthClientType:es("desktop_app").optional(),authMode:es("localhost_pkce").optional(),isConfigured:Pt().optional(),isReadyForPairing:Pt().optional(),isLocalOnly:es(!0).optional(),runtimeOrigin:k().optional(),setupMessage:k().optional()}).optional(),microsoft:me({clientId:k().trim(),tenantId:k().trim(),redirectUri:k().trim()}).optional()}).optional().superRefine((e,t)=>{var l,u;const a=e==null?void 0:e.google;if(!a)return;const n=a.clientId!==void 0,r=a.clientSecret!==void 0,o=(((l=a.clientId)==null?void 0:l.length)??0)>0,i=(((u=a.clientSecret)==null?void 0:u.length)??0)>0;if(n!==r){t.addIssue({code:ga.custom,path:["google",n?"clientSecret":"clientId"],message:"Provide both the Google client ID and client secret together, or clear both together."});return}o!==i&&t.addIssue({code:ga.custom,path:["google",o?"clientSecret":"clientId"],message:"Provide both the Google client ID and client secret together, or clear both together."})}),modelSettings:me({forgeAgent:me({basicChat:me({connectionId:k().trim().nullable().optional(),model:k().trim().optional()}).optional(),wiki:me({connectionId:k().trim().nullable().optional(),model:k().trim().optional()}).optional()}).optional()}).optional()}),Fw=me({label:k().trim().min(1,"Label is required"),agentLabel:k().trim().min(1,"Agent name is required"),agentType:k().trim().min(1,"Agent type is required"),description:k().trim(),trustLevel:fe(["standard","trusted","autonomous"]),autonomyMode:fe(["approval_required","scoped_write","autonomous"]),approvalMode:fe(["approval_by_default","high_impact_only","none"]),scopes:ue(k().trim().min(1)).min(1),bootstrapPolicy:me({mode:fe(["disabled","active_only","scoped","full"]),goalsLimit:Ee.number().int().min(0).max(100),projectsLimit:Ee.number().int().min(0).max(100),tasksLimit:Ee.number().int().min(0).max(100),habitsLimit:Ee.number().int().min(0).max(100),strategiesLimit:Ee.number().int().min(0).max(100),peoplePageLimit:Ee.number().int().min(0).max(50),includePeoplePages:Pt()}),scopePolicy:me({userIds:ue(k().trim().min(1)),projectIds:ue(k().trim().min(1)),tagIds:ue(k().trim().min(1))})}),zw=me({originType:fe(["system","user","agent"]),originAgentId:k().trim(),originLabel:k().trim(),entityType:k().trim(),entityId:k().trim(),timeframeLabel:k().trim(),title:k().trim().min(1,"Title is required"),summary:k().trim().min(1,"Summary is required"),recommendation:k().trim().min(1,"Recommendation is required"),rationale:k().trim(),confidence:Ee.number().min(0).max(1),ctaLabel:k().trim().min(1,"CTA label is required")}),Fu=me({title:k().trim().min(1,"Title is required"),description:k().trim(),level:fe(["issue","task","subtask"]),owner:k().trim().min(1,"Owner is required"),userId:k().trim().nullable().optional(),assigneeUserIds:ue(k().trim()),goalId:k().trim(),projectId:k().trim().min(1,"Project is required"),parentWorkItemId:k().trim().nullable().optional(),priority:fe(["low","medium","high","critical"]),status:fe(["backlog","focus","in_progress","blocked","done"]),effort:fe(["light","deep","marathon"]),energy:fe(["low","steady","high"]),dueDate:k().trim(),points:Ee.number().int().min(5).max(500),plannedDurationSeconds:Ee.number().int().min(60).max(7*86400).nullable().optional(),actionCostBand:fe(["tiny","light","standard","heavy","brutal"]).optional(),aiInstructions:k().trim(),executionMode:fe(["afk","hitl"]).nullable().optional(),acceptanceCriteria:ue(k().trim()),blockerLinks:ue(me({entityType:k().trim().min(1),entityId:k().trim().min(1),label:k().trim().optional()})),completionReport:me({modifiedFiles:ue(k().trim()),workSummary:k().trim(),linkedGitRefIds:ue(k().trim())}).nullable().optional(),gitRefs:ue(me({id:k().trim().min(1).optional(),workItemId:k().trim().optional(),refType:fe(["commit","branch","pull_request"]),provider:k().trim().default("git"),repository:k().trim().default(""),refValue:k().trim().min(1),url:k().trim().url().nullable().optional(),displayTitle:k().trim().default("")})).default([]),tagIds:ue(k()),notes:ue(Za)}),Ww=me({title:k().trim().min(1,"Title is required"),description:k().trim(),status:fe(["active","paused","archived"]),userId:k().trim().nullable().optional(),polarity:fe(["positive","negative"]),frequency:fe(["daily","weekly"]),targetCount:Ee.number().int().min(1).max(14),weekDays:ue(cc().int().min(0).max(6)).max(7),linkedGoalIds:ue(k().trim().min(1)),linkedProjectIds:ue(k().trim().min(1)),linkedTaskIds:ue(k().trim().min(1)),linkedValueIds:ue(k().trim().min(1)),linkedPatternIds:ue(k().trim().min(1)),linkedBehaviorIds:ue(k().trim().min(1)),linkedBeliefIds:ue(k().trim().min(1)),linkedModeIds:ue(k().trim().min(1)),linkedReportIds:ue(k().trim().min(1)),linkedBehaviorId:k().trim(),rewardXp:Ee.number().int().min(1).max(100),penaltyXp:Ee.number().int().min(1).max(100),generatedHealthEventTemplate:me({enabled:Pt(),workoutType:k().trim(),title:k().trim(),durationMinutes:Ee.number().int().min(1).max(1440),xpReward:Ee.number().int().min(0).max(500),tags:ue(k().trim()),links:ue(me({entityType:k().trim().min(1),entityId:k().trim().min(1),relationshipType:k().trim().default("context")})),notesTemplate:k().trim()})}).superRefine((e,t)=>{e.frequency==="weekly"&&e.weekDays.length===0&&t.addIssue({code:ga.custom,path:["weekDays"],message:"Pick at least one weekday"})}),qw=me({entityType:fe(["task","project"]),entityId:k().trim().min(1,"A target is required"),deltaMinutes:Ee.number().int().refine(e=>e!==0,"Minutes must not be zero"),note:k().trim()});me({name:k().trim().min(1,"Name is required"),kind:fe(["value","category","execution"]),userId:k().trim().nullable().optional(),color:k().trim().regex(/^#[0-9a-fA-F]{6}$/,"Color must be a valid hex value"),description:k().trim()});const Ts={title:"",description:"",horizon:"year",status:"active",userId:null,targetPoints:400,themeColor:"#c8a46b",tagIds:[],notes:[]};function zu(e){return{title:e.title,description:e.description,horizon:e.horizon,status:e.status,userId:e.userId??null,targetPoints:e.targetPoints,themeColor:e.themeColor,tagIds:e.tagIds,notes:[]}}function Wu({open:e,pending:t=!1,editingGoal:a,tags:n,users:r,defaultUserId:o=null,onOpenChange:i,onSubmit:l}){const{t:u}=Le(),h=r??[],m=h.find(b=>b.id===o)??null,[g,f]=c.useState(Ts),[x,y]=c.useState(null),[R,p]=c.useState({}),T=b=>{p(Object.fromEntries(Object.entries(b).map(([F,v])=>[F,v==null?void 0:v[0]])))};c.useEffect(()=>{e&&(y(null),p({}),f(a?zu(a):{...Ts,userId:o}))},[o,a,e]);const _=[{id:"intent",eyebrow:"Direction",title:"Name the arc and why it matters",description:"Start with the long-horizon direction itself. We can refine cadence, tags, and visual tone after the intent is clear.",render:(b,F)=>s.jsxs(s.Fragment,{children:[s.jsx(ae,{label:u("common.dialogs.goal.title"),error:R.title??null,children:s.jsx(ve,{value:b.title,onChange:v=>F({title:v.target.value}),placeholder:"Build a durable body and calm energy"})}),s.jsx(ae,{label:u("common.dialogs.goal.descriptionLabel"),children:s.jsx(at,{value:b.description,onChange:v=>F({description:v.target.value}),placeholder:"Write the goal description in Markdown. This can stay short or grow into a long strategic page."})}),s.jsx(Ya,{value:b.userId,users:h,onChange:v=>F({userId:v}),label:"Owner user",defaultLabel:Ga(m),help:"Goals can belong to a human or bot user. The current single-user scope becomes the default when one user is selected."})]})},{id:"cadence",eyebrow:"Cadence",title:"Choose the horizon and current posture",description:"Keep this simple: how long does this arc run, and is it currently active, paused, or already complete?",render:(b,F)=>s.jsxs(s.Fragment,{children:[s.jsx(ae,{label:u("common.dialogs.goal.horizon"),children:s.jsx(Ye,{value:b.horizon,onChange:v=>F({horizon:v}),options:[{value:"quarter",label:u("common.enums.goalHorizon.quarter"),description:"Tight strategic push for the coming months."},{value:"year",label:u("common.enums.goalHorizon.year"),description:"A full-cycle objective for this year."},{value:"lifetime",label:u("common.enums.goalHorizon.lifetime"),description:"A long-running life arc that projects can keep serving."}],columns:3})}),s.jsx(ae,{label:u("common.dialogs.goal.status"),children:s.jsx(Ye,{value:b.status,onChange:v=>F({status:v}),options:[{value:"active",label:u("common.enums.projectStatus.active"),description:"This is live right now."},{value:"paused",label:u("common.enums.projectStatus.paused"),description:"Keep it visible, but do not push it right now."},{value:"completed",label:u("common.enums.projectStatus.completed"),description:"You have already fulfilled this arc."}]})})]})},{id:"signal",eyebrow:"Signal",title:"Set the target and visual signature",description:"Give Forge enough signal to show progress and make this arc recognizable throughout the app.",render:(b,F)=>s.jsxs(s.Fragment,{children:[s.jsx(ae,{label:u("common.dialogs.goal.targetXp"),error:R.targetPoints??null,children:s.jsx(ve,{type:"number",value:b.targetPoints,onChange:v=>F({targetPoints:Number(v.target.value)||0})})}),s.jsx(ae,{label:u("common.dialogs.goal.themeColor"),error:R.themeColor??null,children:s.jsxs("div",{className:"flex items-center gap-3 rounded-[22px] border border-white/8 bg-white/6 px-4 py-3",children:[s.jsx("input",{className:"h-10 w-12 rounded-lg border border-white/10 bg-transparent",type:"color",value:b.themeColor,onChange:v=>F({themeColor:v.target.value})}),s.jsx(ve,{className:"border-none bg-transparent px-0 py-0",value:b.themeColor,onChange:v=>F({themeColor:v.target.value})})]})}),s.jsx(ae,{label:u("common.dialogs.goal.tags"),children:s.jsx("div",{className:"flex flex-wrap gap-2",children:n.map(v=>{const B=b.tagIds.includes(v.id);return s.jsx("button",{type:"button",className:`rounded-full px-3 py-2 text-sm transition ${B?"bg-white/16 text-white":"bg-white/6 text-white/58 hover:bg-white/10 hover:text-white"}`,onClick:()=>F({tagIds:B?b.tagIds.filter(N=>N!==v.id):[...b.tagIds,v.id]}),children:v.name},v.id)})})})]})},{id:"notes",eyebrow:"Evidence",title:"Attach any creation context that should live with this goal",description:"Creation notes become real linked Markdown notes, so strategic context does not vanish into the form flow.",render:(b,F)=>s.jsx(ae,{label:"Creation notes",children:s.jsx(Qa,{notes:b.notes,onChange:v=>F({notes:v}),entityLabel:"goal"})})}];return s.jsx(Xa,{open:e,onOpenChange:i,eyebrow:u("common.dialogs.goal.eyebrow"),title:u(a?"common.dialogs.goal.editTitle":"common.dialogs.goal.createTitle"),description:u("common.dialogs.goal.description"),value:g,onChange:f,draftPersistenceKey:a?`goal.${a.id}`:"goal.new",steps:_,pending:t,pendingLabel:u(a?"common.dialogs.goal.save":"common.dialogs.goal.create"),submitLabel:u(a?"common.dialogs.goal.save":"common.dialogs.goal.create"),error:x,onSubmit:async()=>{y(null);const b=$u.safeParse(g);if(!b.success){T(b.error.flatten().fieldErrors),y("Some answers still need attention before this goal arc can be saved.");return}p({});try{await l(b.data,a==null?void 0:a.id),f(Ts),i(!1)}catch(F){y(F instanceof Error?F.message:u("common.dialogs.goal.submitError"))}}})}function qu({user:e,compact:t=!1,size:a,className:n}){if(!e)return s.jsx(le,{size:a??(t?"sm":"md"),className:P("border-white/10 bg-white/[0.05] text-white/55",n),children:"Unassigned"});const r=e.kind==="bot"?Rs:ma;return s.jsxs(le,{size:a??(t?"sm":"md"),className:P("max-w-full gap-1.5 border text-white",e.kind==="bot"?"border-cyan-300/18 bg-cyan-400/12 text-cyan-50":"border-amber-300/18 bg-amber-400/12 text-amber-50",a==="xs"&&"gap-1",n),children:[s.jsx(r,{className:P(a==="xs"?"size-3":"size-3.5","shrink-0")}),s.jsx("span",{className:"truncate",children:e.displayName}),s.jsx("span",{className:"text-white/55",children:e.kind})]})}const Sa={goalId:"",title:"",description:"",status:"active",workflowStatus:"backlog",userId:null,assigneeUserIds:[],targetPoints:240,themeColor:"#c0c1ff",productRequirementsDocument:"",notes:[]};function Bu(e){return{goalId:e.goalId,title:e.title,description:e.description,status:e.status,workflowStatus:e.workflowStatus,userId:e.userId??null,assigneeUserIds:e.assigneeUserIds??[],targetPoints:e.targetPoints,themeColor:e.themeColor,productRequirementsDocument:e.productRequirementsDocument,notes:[]}}function Ku({open:e,goals:t,users:a,editingProject:n,initialGoalId:r,initialStepId:o,defaultUserId:i=null,onOpenChange:l,onSubmit:u}){const{t:h}=Le(),m=a??[],[g,f]=c.useState(Sa),[x,y]=c.useState(null),[R,p]=c.useState({}),T=t.find(v=>v.id===g.goalId)??null,_=m.find(v=>v.id===((T==null?void 0:T.userId)??i))??null,b=v=>{p(Object.fromEntries(Object.entries(v).map(([B,N])=>[B,N==null?void 0:N[0]])))};c.useEffect(()=>{var v;e&&(y(null),p({}),f(n?Bu(n):{...Sa,goalId:r??"",userId:((v=t.find(B=>B.id===r))==null?void 0:v.userId)??i}))},[i,n,t,r,e]);const F=[{id:"anchor",eyebrow:"Anchor",title:"Attach the project to the right goal",description:"Projects should serve one clear life-goal arc, so start by picking the direction this initiative belongs to.",render:(v,B)=>s.jsx(ae,{label:h("common.dialogs.project.goal"),error:R.goalId??null,children:s.jsx("div",{className:"grid gap-3",children:t.map(N=>{const A=N.id===v.goalId;return s.jsxs("button",{type:"button",className:`rounded-[22px] border px-4 py-4 text-left transition ${A?"border-[rgba(192,193,255,0.28)] bg-[rgba(192,193,255,0.14)] text-white":"border-white/8 bg-white/[0.04] text-white/72 hover:bg-white/[0.07]"}`,onClick:()=>B({goalId:N.id}),children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[s.jsx(gs,{kind:"goal",label:N.title,className:"max-w-full"}),s.jsx(qu,{user:N.user,compact:!0})]}),s.jsx("div",{className:"mt-2 text-sm leading-6 text-white/54",children:N.description||"No strategic note attached yet."})]},N.id)})})})},{id:"shape",eyebrow:"Shape",title:"Name the initiative and the work it will make possible",description:"Keep the project concrete. The title should sound like something you can actually move forward this season.",render:(v,B)=>s.jsxs(s.Fragment,{children:[s.jsx(ae,{label:h("common.dialogs.project.title"),error:R.title??null,children:s.jsx(ve,{value:v.title,onChange:N=>B({title:N.target.value}),placeholder:"Launch the new creative practice system"})}),s.jsx(ae,{label:h("common.dialogs.project.descriptionLabel"),children:s.jsx(at,{value:v.description,onChange:N=>B({description:N.target.value}),placeholder:"Write the project description in Markdown. Use as much detail as the workstream needs."})}),s.jsx(ae,{label:"Product requirements document",children:s.jsx(at,{value:v.productRequirementsDocument,onChange:N=>B({productRequirementsDocument:N.target.value}),placeholder:"Capture the PRD in Markdown so the project view can present it clearly."})}),s.jsx(Ya,{value:v.userId,users:m,onChange:N=>B({userId:N}),label:"Owner user",defaultLabel:Ga(_),help:"Projects can intentionally cross user boundaries, but the linked goal owner is suggested by default."}),s.jsx(ae,{label:"Assignees",children:s.jsx("select",{multiple:!0,value:v.assigneeUserIds,onChange:N=>B({assigneeUserIds:Array.from(N.target.selectedOptions,A=>A.value)}),className:"min-h-28 rounded-[var(--radius-control)] border border-white/10 bg-white/[0.04] px-3 py-2 text-sm text-white outline-none transition focus:border-[rgba(192,193,255,0.3)]",children:m.map(N=>s.jsxs("option",{value:N.id,children:[N.displayName," · ",N.kind]},N.id))})})]})},{id:"signal",eyebrow:"Signal",title:"Set the project's posture and progress target",description:"This keeps the board, reward system, and detail views aligned without forcing you through a giant settings form.",render:(v,B)=>s.jsxs(s.Fragment,{children:[s.jsx(ae,{label:h("common.dialogs.project.status"),children:s.jsx(Ye,{value:v.status,onChange:N=>B({status:N}),options:[{value:"active",label:h("common.enums.projectStatus.active"),description:"Push this initiative now."},{value:"paused",label:h("common.enums.projectStatus.paused"),description:"Keep it available without active pressure."},{value:"completed",label:h("common.enums.projectStatus.completed"),description:"This initiative has landed."}]})}),s.jsx(ae,{label:"Board workflow status",children:s.jsx(Ye,{value:v.workflowStatus,onChange:N=>B({workflowStatus:N}),options:[{value:"backlog",label:"Backlog"},{value:"focus",label:"Focus"},{value:"in_progress",label:"In progress"},{value:"blocked",label:"Blocked"},{value:"done",label:"Done"}]})}),s.jsx(ae,{label:h("common.dialogs.project.targetXp"),error:R.targetPoints??null,children:s.jsx(ve,{type:"number",value:v.targetPoints,onChange:N=>B({targetPoints:Number(N.target.value)||0})})}),s.jsx(ae,{label:h("common.dialogs.project.themeColor"),error:R.themeColor??null,children:s.jsxs("div",{className:"flex items-center gap-3 rounded-[22px] border border-white/8 bg-white/6 px-4 py-3",children:[s.jsx("input",{className:"h-10 w-12 rounded-lg border border-white/10 bg-transparent",type:"color",value:v.themeColor,onChange:N=>B({themeColor:N.target.value})}),s.jsx(ve,{className:"border-none bg-transparent px-0 py-0",value:v.themeColor,onChange:N=>B({themeColor:N.target.value})})]})})]})},{id:"notes",eyebrow:"Evidence",title:"Keep the creation context attached to the project from day one",description:"Use linked Markdown notes when the initiative needs setup context, assumptions, or a handoff summary right away.",render:(v,B)=>s.jsx(ae,{label:"Creation notes",children:s.jsx(Qa,{notes:v.notes,onChange:N=>B({notes:N}),entityLabel:"project"})})}];return s.jsx(Xa,{open:e,onOpenChange:l,eyebrow:h("common.dialogs.project.eyebrow"),title:h(n?"common.dialogs.project.editTitle":"common.dialogs.project.createTitle"),description:h("common.dialogs.project.description"),value:g,onChange:f,draftPersistenceKey:n?`project.${n.id}`:"project.new",steps:F,initialStepId:o,submitLabel:h(n?"common.dialogs.project.save":"common.dialogs.project.create"),error:x,onSubmit:async()=>{y(null);const v=Mu.safeParse(g);if(!v.success){b(v.error.flatten().fieldErrors),y("A couple of answers still need attention before this project can be saved.");return}p({});try{await u(v.data,n==null?void 0:n.id),l(!1)}catch(B){y(B instanceof Error?B.message:h("common.dialogs.project.submitError"))}}})}function ra(e){return typeof e=="string"?e.trim():""}function Hu(e,t){const a=t.find(n=>n.refType===e.refType&&n.refValue===e.refValue&&n.repository===e.repository)??null;return{id:(a==null?void 0:a.id)??`draft-${e.refType}-${e.refValue.replace(/[^a-zA-Z0-9]+/g,"-")}`,workItemId:(a==null?void 0:a.workItemId)??"",refType:e.refType,provider:e.provider,repository:e.repository,refValue:e.refValue,url:e.url,displayTitle:e.displayTitle}}function Uu(e){return e==="branch"?Ht:e==="pull_request"?Ai:dl}function Gu({selectedRefs:e,onChange:t}){const[a,n]=c.useState(null),[r,o]=c.useState(null),[i,l]=c.useState(!1),[u,h]=c.useState("branch"),[m,g]=c.useState(""),[f,x]=c.useState(""),[y,R]=c.useState([]),[p,T]=c.useState([]),[_,b]=c.useState(!1),[F,v]=c.useState(null);c.useEffect(()=>{let I=!1;return l(!0),jd().then($=>{I||(n($.git),x(ee=>ee.trim().length>0?ee:$.git.repository||ee),o(null))}).catch($=>{I||o($ instanceof Error?$.message:"Forge could not load git helper context.")}).finally(()=>{I||l(!1)}),()=>{I=!0}},[]),c.useEffect(()=>{let I=!1;return b(!0),Sd({kind:u,query:m,repository:f}).then($=>{I||(R($.git.refs),T($.git.warnings),v(null))}).catch($=>{I||(v($ instanceof Error?$.message:"Forge could not search git refs right now."),R([]))}).finally(()=>{I||b(!1)}),()=>{I=!0}},[u,m,f]);const B=c.useMemo(()=>{const I=ra(a==null?void 0:a.currentBranch),$=ra(f)||ra(a==null?void 0:a.repository);return I?{key:`branch:${I}`,refType:"branch",provider:$?"github":"git",repository:$,refValue:I,url:$&&I?`https://github.com/${$}/tree/${encodeURIComponent(I)}`:null,displayTitle:I,subtitle:"Current local branch"}:null},[a==null?void 0:a.currentBranch,a==null?void 0:a.repository,f]),N=I=>{const $=Hu(I,e);e.some(ee=>ee.refType===$.refType&&ee.refValue===$.refValue&&ee.repository===$.repository)||t([...e,$])},A=I=>{t(e.filter($=>$.id!==I.id))};return s.jsxs("div",{className:"grid gap-3 rounded-[20px] border border-white/8 bg-white/[0.03] p-4",children:[s.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"type-label text-white/45",children:"Git links"}),s.jsx("div",{className:"mt-2 text-sm leading-6 text-white/58",children:"Pick the live branch, commits, or pull requests from the local repo instead of typing raw hashes."})]}),B?s.jsxs(de,{type:"button",variant:"secondary",size:"sm",onClick:()=>N(B),children:[s.jsx(Ht,{className:"size-4"}),"Use current branch"]}):null]}),s.jsxs("div",{className:"grid gap-2 sm:grid-cols-[10rem_minmax(0,1fr)]",children:[s.jsxs("label",{className:"grid gap-2",children:[s.jsx("span",{className:"type-label text-white/45",children:"Type"}),s.jsxs("select",{value:u,onChange:I=>h(I.target.value),className:"min-h-10 rounded-[var(--radius-control)] border border-white/10 bg-white/[0.04] px-3 py-2 text-sm text-white outline-none transition focus:border-[rgba(192,193,255,0.3)]",children:[s.jsx("option",{value:"branch",children:"Branch"}),s.jsx("option",{value:"commit",children:"Commit"}),s.jsx("option",{value:"pull_request",children:"Pull request"})]})]}),s.jsxs("label",{className:"grid gap-2",children:[s.jsx("span",{className:"type-label text-white/45",children:"Repository"}),s.jsx(ve,{value:f,onChange:I=>x(I.target.value),placeholder:(a==null?void 0:a.repository)||"owner/repo"})]})]}),s.jsxs("label",{className:"grid gap-2",children:[s.jsx("span",{className:"type-label text-white/45",children:"Search"}),s.jsxs("div",{className:"relative",children:[s.jsx(ft,{className:"pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-white/32"}),s.jsx(ve,{value:m,onChange:I=>g(I.target.value),placeholder:u==="branch"?"Search branches":u==="pull_request"?"Search pull requests":"Search commits",className:"pl-10"})]})]}),e.length>0?s.jsxs("div",{className:"grid gap-2",children:[s.jsx("div",{className:"type-label text-white/45",children:"Selected links"}),s.jsx("div",{className:"grid gap-2",children:e.map(I=>s.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-[16px] border border-white/8 bg-white/[0.04] px-3 py-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(le,{className:"bg-white/[0.08] text-white/72",children:I.refType.replaceAll("_"," ")}),s.jsx("div",{className:"truncate text-sm text-white/84",children:I.displayTitle||I.refValue})]}),s.jsx("div",{className:"mt-1 text-xs text-white/46",children:[I.repository,I.refValue].filter(Boolean).join(" · ")})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[I.url?s.jsx("a",{href:I.url,target:"_blank",rel:"noreferrer",className:"inline-flex size-8 items-center justify-center rounded-full text-white/55 transition hover:bg-white/[0.08] hover:text-white",children:s.jsx(pa,{className:"size-4"})}):null,s.jsx("button",{type:"button",className:"inline-flex size-8 items-center justify-center rounded-full text-white/55 transition hover:bg-white/[0.08] hover:text-white",onClick:()=>A(I),children:s.jsx(ut,{className:"size-4"})})]})]},I.id))})]}):null,s.jsxs("div",{className:"grid gap-2 rounded-[16px] border border-white/8 bg-white/[0.02] p-2",children:[i||_?s.jsxs("div",{className:"flex items-center gap-2 px-2 py-4 text-sm text-white/52",children:[s.jsx(Pi,{className:"size-4 animate-spin"}),"Loading git suggestions…"]}):null,r?s.jsx("div",{className:"rounded-[14px] bg-rose-500/10 px-3 py-2 text-sm text-rose-200",children:r}):null,F?s.jsx("div",{className:"rounded-[14px] bg-rose-500/10 px-3 py-2 text-sm text-rose-200",children:F}):null,[...(a==null?void 0:a.warnings)??[],...p].filter(Boolean).slice(0,2).map(I=>s.jsx("div",{className:"rounded-[14px] bg-amber-400/10 px-3 py-2 text-sm text-amber-100",children:I},I)),!_&&!F&&y.length===0?s.jsx("div",{className:"px-2 py-4 text-sm text-white/45",children:"No matching git refs found."}):null,y.map(I=>{const $=Uu(u),ee=e.some(ne=>ne.refType===I.refType&&ne.refValue===I.refValue&&ne.repository===I.repository);return s.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-[14px] px-2 py-2 transition hover:bg-white/[0.04]",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm text-white/82",children:[s.jsx($,{className:"size-4 shrink-0 text-[var(--primary)]"}),s.jsx("span",{className:"truncate",children:I.displayTitle||I.refValue})]}),s.jsx("div",{className:"mt-1 text-xs text-white/46",children:[I.repository,I.subtitle].filter(Boolean).join(" · ")})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[I.url?s.jsx("a",{href:I.url,target:"_blank",rel:"noreferrer",className:"inline-flex size-8 items-center justify-center rounded-full text-white/55 transition hover:bg-white/[0.08] hover:text-white",children:s.jsx(pa,{className:"size-4"})}):null,s.jsx(de,{type:"button",size:"sm",variant:"secondary",disabled:ee,onClick:()=>N(I),children:ee?"Added":"Add"})]})]},I.key)})]})]})}const ns={title:"",description:"",level:"task",owner:"Albert",userId:null,assigneeUserIds:[],goalId:"",projectId:"",parentWorkItemId:null,priority:"medium",status:"focus",effort:"deep",energy:"steady",dueDate:"",points:60,plannedDurationSeconds:86400,actionCostBand:"standard",aiInstructions:"",executionMode:null,acceptanceCriteria:[],blockerLinks:[],completionReport:null,gitRefs:[],tagIds:[],notes:[]},Vu=[];function Ju(e){return e.split(`
4
+ `).map(t=>t.trim()).filter(t=>t.length>0)}function Na(e){return e.modifiedFiles.length===0&&e.workSummary.trim().length===0&&e.linkedGitRefIds.length===0?null:{modifiedFiles:e.modifiedFiles,workSummary:e.workSummary,linkedGitRefIds:e.linkedGitRefIds}}function Xu(e,t){return Na({modifiedFiles:(t==null?void 0:t.modifiedFiles)??[],workSummary:(t==null?void 0:t.workSummary)??"",linkedGitRefIds:e.map(a=>a.id).filter(a=>typeof a=="string")})}function Ze(e){return e.trim().toLowerCase()}function Qu(e){return e==="issue"?["goal","project"]:e==="task"?["goal","project","issue"]:["goal","project","task"]}function Yu(e){return e==="issue"?["goal","project"]:e==="task"?["goal","project","issue"]:["goal","project"]}function Zr(e){return e==="task"?"task":e}function Zu(e){var x;const{editingTask:t,initialGoalId:a,initialLevel:n,initialParentWorkItemId:r,initialProjectId:o,defaultUserId:i,projects:l,users:u,workItems:h}=e;if(t)return nm(t);const m=r?h.find(y=>y.id===r)??null:null,g=l.find(y=>y.id===((m==null?void 0:m.projectId)??o))??null,f=(g==null?void 0:g.userId)??i??null;return{...ns,level:n??((m==null?void 0:m.level)==="issue"?"task":(m==null?void 0:m.level)==="task"?"subtask":ns.level),owner:((x=u.find(y=>y.id===f))==null?void 0:x.displayName)??ns.owner,userId:f,goalId:(m==null?void 0:m.goalId)??(g==null?void 0:g.goalId)??a??"",projectId:(g==null?void 0:g.id)??"",parentWorkItemId:(m==null?void 0:m.id)??null}}function em(e){const{draft:t,goals:a,projects:n,workItems:r}=e,o=[];if(t.goalId){const i=a.find(l=>l.id===t.goalId);i&&o.push({id:`goal:${i.id}`,kind:"goal",mode:"existing",entityId:i.id,label:i.title,description:"Goal",searchText:Ze(`${i.title} ${i.description}`),goalId:i.id,projectId:null,parentWorkItemId:null})}if(t.projectId){const i=n.find(l=>l.id===t.projectId);i&&o.push({id:`project:${i.id}`,kind:"project",mode:"existing",entityId:i.id,label:i.title,description:"Project",searchText:Ze(`${i.title} ${i.description} ${i.goalTitle}`),goalId:i.goalId,projectId:i.id,parentWorkItemId:null})}if(t.parentWorkItemId){const i=r.find(l=>l.id===t.parentWorkItemId);i&&o.push({id:`${i.level}:${i.id}`,kind:i.level==="issue"?"issue":"task",mode:"existing",entityId:i.id,label:i.title,description:i.level==="issue"?"Issue":"Task",searchText:Ze(`${i.title} ${i.description} ${i.aiInstructions}`),goalId:i.goalId,projectId:i.projectId,parentWorkItemId:i.parentWorkItemId})}return o}function tm(e){const{goals:t,projects:a,workItems:n,allowedKinds:r,editingTaskId:o}=e,i=[];return r.includes("goal")&&i.push(...t.map(l=>({id:`goal:${l.id}`,kind:"goal",mode:"existing",entityId:l.id,label:l.title,description:"Goal",searchText:Ze(`${l.title} ${l.description}`),goalId:l.id,projectId:null,parentWorkItemId:null}))),r.includes("project")&&i.push(...a.map(l=>({id:`project:${l.id}`,kind:"project",mode:"existing",entityId:l.id,label:l.title,description:`Project · ${l.goalTitle}`,searchText:Ze(`${l.title} ${l.description} ${l.goalTitle} ${l.productRequirementsDocument}`),goalId:l.goalId,projectId:l.id,parentWorkItemId:null}))),r.includes("issue")&&i.push(...n.filter(l=>l.level==="issue"&&l.id!==o).map(l=>({id:`issue:${l.id}`,kind:"issue",mode:"existing",entityId:l.id,label:l.title,description:"Issue",searchText:Ze(`${l.title} ${l.description} ${l.aiInstructions} ${l.executionMode??""}`),goalId:l.goalId,projectId:l.projectId,parentWorkItemId:null}))),r.includes("task")&&i.push(...n.filter(l=>l.level==="task"&&l.id!==o).map(l=>({id:`task:${l.id}`,kind:"task",mode:"existing",entityId:l.id,label:l.title,description:"Task",searchText:Ze(`${l.title} ${l.description} ${l.aiInstructions} ${l.executionMode??""}`),goalId:l.goalId,projectId:l.projectId,parentWorkItemId:l.parentWorkItemId}))),i}function sm(e,t,a){if(t.kind==="goal"){const n=e.projectId?a.find(o=>o.projectId===e.projectId)??null:null,r=!e.projectId||(n==null?void 0:n.goalId)===t.entityId||t.goalId===e.goalId;return{goalId:t.entityId,projectId:r?e.projectId:"",parentWorkItemId:r?e.parentWorkItemId:null}}if(t.kind==="project"){const n=e.parentWorkItemId?a.find(r=>r.id===e.parentWorkItemId)??null:null;return{goalId:t.goalId??e.goalId,projectId:t.entityId,parentWorkItemId:!n||n.projectId===t.entityId?e.parentWorkItemId:null}}return{goalId:t.goalId??e.goalId,projectId:t.projectId??e.projectId,parentWorkItemId:t.entityId}}function am(e){return e==="goal"?{goalId:"",projectId:"",parentWorkItemId:null}:e==="project"?{projectId:"",parentWorkItemId:null}:{parentWorkItemId:null}}function nm(e){var t;return{title:e.title,description:e.description,level:e.level,owner:e.owner,userId:e.userId??null,assigneeUserIds:e.assigneeUserIds??[],goalId:e.goalId??"",projectId:e.projectId??"",parentWorkItemId:e.parentWorkItemId??null,priority:e.priority,status:e.status,effort:e.effort,energy:e.energy,dueDate:e.dueDate??"",points:e.points,plannedDurationSeconds:e.plannedDurationSeconds??86400,actionCostBand:((t=e.actionPointSummary)==null?void 0:t.costBand)??"standard",aiInstructions:e.aiInstructions,executionMode:e.executionMode,acceptanceCriteria:e.acceptanceCriteria,blockerLinks:e.blockerLinks,completionReport:e.completionReport,gitRefs:e.gitRefs,tagIds:e.tagIds,notes:[]}}function rm({open:e,goals:t,projects:a,workItems:n,tags:r,users:o,editingTask:i,initialProjectId:l,initialGoalId:u,initialParentWorkItemId:h,initialLevel:m,initialStepId:g,defaultUserId:f=null,onRefreshEntities:x,currentCreditedSeconds:y,onOpenChange:R,onAdjustTrackedTime:p,onSubmit:T}){const{t:_}=Le(),b=t??[],F=a??[],v=n??Vu,B=r??[],N=o??[],[A,I]=c.useState(ns),[$,ee]=c.useState(null),[ne,oe]=c.useState({}),[V,w]=c.useState(""),[z,ie]=c.useState(!1),[te,E]=c.useState(0),[X,M]=c.useState(null),[Z,O]=c.useState(null),[se,pe]=c.useState(0),Me=D=>{oe(Object.fromEntries(Object.entries(D).map(([Q,C])=>[Q,C==null?void 0:C[0]])))};c.useEffect(()=>{e&&(ee(null),oe({}),w(""),ie(!1),E(0),M(null),O(null),pe(i?Math.max(0,Math.floor((y??i.time.totalCreditedSeconds)/60)):0),I(Zu({editingTask:i,initialGoalId:u,initialLevel:m,initialParentWorkItemId:h,initialProjectId:l,defaultUserId:f,projects:F,users:N,workItems:v})))},[f,i,u,m,h,l,e,F,N,v,y]);const Te=i?Math.max(0,Math.floor((y??i.time.totalCreditedSeconds)/60)):0,Ie=i?se-Te:0,xe=c.useMemo(()=>F.find(D=>D.id===A.projectId)??null,[A.projectId,F]),Ce=c.useMemo(()=>Qu(A.level),[A.level]),Ne=c.useMemo(()=>Yu(A.level),[A.level]),we=c.useMemo(()=>em({draft:A,goals:b,projects:F,workItems:v}),[A,b,F,v]),Ue=c.useMemo(()=>tm({goals:b,projects:F,workItems:v,allowedKinds:Ce,editingTaskId:i==null?void 0:i.id}),[Ce,i==null?void 0:i.id,b,F,v]),Fe=c.useMemo(()=>{const D=Ze(V),Q=D.length===0?Ue.slice(0,8):Ue.filter(W=>W.searchText.includes(D)).slice(0,8);if(D.length===0)return Q;const C=Ne.map(W=>W==="project"&&!A.goalId?{id:`create:${W}:${D}`,kind:W,mode:"create",label:V.trim(),description:"Pick or create a goal first, then create a project here.",disabled:!0,disabledReason:"Pick or create a goal first."}:W==="issue"&&!A.projectId?{id:`create:${W}:${D}`,kind:W,mode:"create",label:V.trim(),description:"Pick or create a project first, then create an issue here.",disabled:!0,disabledReason:"Pick or create a project first."}:{id:`create:${W}:${D}`,kind:W,mode:"create",label:V.trim(),description:`Create a new ${W} from "${V.trim()}".`});return[...Q,...C]},[V,Ue,Ne,A.goalId,A.projectId]),it=N.find(D=>D.id===((xe==null?void 0:xe.userId)??f))??null;c.useEffect(()=>{xe&&A.goalId!==xe.goalId&&I(D=>({...D,goalId:xe.goalId}))},[A.goalId,xe]);const ze=D=>{I(Q=>({...Q,...sm(Q,D,v)})),w(""),M(null),E(0),ie(!1)},Ke=D=>{I(Q=>({...Q,...am(D)})),M(null)},tt=async D=>{if(D.disabled){M(D.disabledReason??D.description);return}const Q=D.label.trim();if(Q){O(D.id),M(null);try{if(D.kind==="goal"){const C=await ao({...Ts,title:Q,userId:A.userId??null});await(x==null?void 0:x()),ze({id:`goal:${C.goal.id}`,kind:"goal",mode:"existing",entityId:C.goal.id,label:C.goal.title,description:"Goal",searchText:Ze(`${C.goal.title} ${C.goal.description}`),goalId:C.goal.id,projectId:null,parentWorkItemId:null});return}if(D.kind==="project"){if(!A.goalId)throw new Error("Pick or create a goal first.");const C=await no({...Sa,goalId:A.goalId,title:Q,userId:A.userId??null,assigneeUserIds:A.assigneeUserIds});await(x==null?void 0:x()),ze({id:`project:${C.project.id}`,kind:"project",mode:"existing",entityId:C.project.id,label:C.project.title,description:"Project",searchText:Ze(`${C.project.title} ${C.project.description}`),goalId:C.project.goalId,projectId:C.project.id,parentWorkItemId:null});return}if(D.kind==="issue"){if(!A.projectId)throw new Error("Pick or create a project first.");const C=await vd({...ns,level:"issue",title:Q,owner:A.owner,userId:A.userId??null,assigneeUserIds:A.assigneeUserIds,goalId:A.goalId,projectId:A.projectId,executionMode:"afk"});await(x==null?void 0:x()),ze({id:`issue:${C.workItem.id}`,kind:"issue",mode:"existing",entityId:C.workItem.id,label:C.workItem.title,description:"Issue",searchText:Ze(`${C.workItem.title} ${C.workItem.description}`),goalId:C.workItem.goalId,projectId:C.workItem.projectId,parentWorkItemId:null})}}catch(C){M(C instanceof Error?C.message:"Unable to create that linked entity right now.")}finally{O(null)}}},mt=[{id:"anchor",eyebrow:"Placement",title:"Choose where this work belongs",description:"Anchor the work through the hierarchy. Tasks can carry a goal, project, and issue parent together so the chain of meaning stays explicit.",render:(D,Q)=>{var C;return s.jsxs(s.Fragment,{children:[s.jsx(ae,{label:"Hierarchy anchors",labelHelp:"Pick the goal and project anchors, then choose the real parent where needed. Tasks can live under issues, subtasks under tasks.",error:ne.projectId??null,children:s.jsx("div",{className:"grid gap-3",children:s.jsxs("div",{className:"rounded-[24px] border border-white/10 bg-white/[0.04] p-4",children:[we.length>0?s.jsx("div",{className:"mb-3 flex flex-wrap gap-2",children:we.map(W=>s.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full border border-white/8 bg-white/[0.06] px-2.5 py-1.5",children:[s.jsx(et,{kind:Zr(W.kind),label:W.label,compact:!0,gradient:!1,className:"max-w-[16rem]"}),s.jsx("button",{type:"button",className:"rounded-full text-white/52 transition hover:text-white",onClick:()=>Ke(W.kind),"aria-label":`Remove ${W.label}`,children:s.jsx(ut,{className:"size-3.5"})})]},W.id))}):null,s.jsxs("div",{className:"relative",children:[s.jsxs("div",{className:"flex items-center gap-3 rounded-[18px] border border-white/8 bg-black/20 px-4 py-3",children:[s.jsx(ft,{className:"size-4 text-white/36"}),s.jsx("input",{value:V,onChange:W=>{w(W.target.value),ie(!0),E(0),M(null)},onFocus:()=>ie(!0),onBlur:()=>{window.setTimeout(()=>ie(!1),120)},onKeyDown:W=>{if(W.key==="Backspace"&&!V&&we.length>0){Ke(we[we.length-1].kind);return}if(W.key==="ArrowDown"){W.preventDefault(),ie(!0),E(S=>Fe.length===0?0:Math.min(Fe.length-1,S+1));return}if(W.key==="ArrowUp"){W.preventDefault(),E(S=>Math.max(0,S-1));return}if(W.key==="Escape"){ie(!1);return}if(W.key==="Enter"&&Fe[te]){W.preventDefault();const S=Fe[te];S.mode==="existing"?ze(S):tt(S)}},placeholder:'Search or create Goal, Project, or parent Issue like Goal + "Creative system"',className:"min-w-0 flex-1 bg-transparent text-sm text-white placeholder:text-white/34 focus:outline-none"})]}),z?s.jsx("div",{className:"absolute top-full z-20 mt-2 w-full rounded-[22px] border border-white/8 bg-[rgba(8,13,24,0.96)] p-2 shadow-[0_26px_60px_rgba(4,8,18,0.32)] backdrop-blur-xl",children:Fe.length>0?Fe.map((W,S)=>s.jsxs("button",{type:"button",disabled:W.mode==="create"&&W.disabled,className:P("flex w-full items-start justify-between gap-3 rounded-[18px] px-3 py-2.5 text-left transition",S===te?"bg-white/[0.1] text-white":"text-white/70 hover:bg-white/[0.06] hover:text-white",W.mode==="create"&&W.disabled&&"cursor-not-allowed opacity-45"),onMouseEnter:()=>E(S),onMouseDown:ye=>ye.preventDefault(),onClick:()=>{if(W.mode==="existing"){ze(W);return}tt(W)},children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(et,{kind:Zr(W.kind),label:W.mode==="create"?`Create ${W.kind}`:W.label,compact:!0,gradient:!1}),W.mode==="create"?s.jsxs(le,{className:"bg-white/[0.08] text-white/70",children:['"',W.label,'"']}):null]}),s.jsx("div",{className:"mt-1 text-xs leading-5 text-white/46",children:W.description})]}),W.mode==="create"?s.jsx("span",{className:"rounded-full bg-[var(--primary)]/12 p-2 text-[var(--primary)]",children:s.jsx(zs,{className:"size-3.5"})}):null]},W.id)):s.jsx("div",{className:"px-3 py-2.5 text-sm text-white/42",children:"Type to find an existing anchor or create a new one."})}):null]}),X?s.jsx("div",{className:"mt-3 rounded-[16px] border border-rose-400/16 bg-rose-400/10 px-3 py-2 text-sm text-rose-100",children:X}):null]})})}),s.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[s.jsx(ae,{label:"Resolved project",children:s.jsx(ve,{readOnly:!0,value:(xe==null?void 0:xe.title)??"",placeholder:"Select or create a project anchor"})}),s.jsx(ae,{label:"Resolved goal",children:s.jsx(ve,{readOnly:!0,value:((C=b.find(W=>W.id===D.goalId))==null?void 0:C.title)??"",placeholder:"Select or create a goal anchor"})})]})]})}},{id:"shape",eyebrow:"Shape",title:"Define the next concrete move",description:"Keep the task small enough to be actionable and strong enough to clearly move the project forward.",render:(D,Q)=>s.jsxs(s.Fragment,{children:[s.jsx(ae,{label:"Hierarchy level",error:ne.level??null,children:s.jsx(Ye,{value:D.level,onChange:C=>Q({level:C}),options:[{value:"issue",label:"Issue",description:"Vertical slice with AFK or HITL execution mode."},{value:"task",label:"Task",description:"One focused AI session with direct instructions."},{value:"subtask",label:"Subtask",description:"A lightweight child step under a task."}]})}),s.jsx(ae,{label:_("common.dialogs.task.title"),error:ne.title??null,children:s.jsx(ve,{value:D.title,onChange:C=>Q({title:C.target.value}),placeholder:"Draft the first mode atlas sketch"})}),s.jsx(ae,{label:_("common.dialogs.task.descriptionLabel"),children:s.jsx(at,{value:D.description,onChange:C=>Q({description:C.target.value}),placeholder:"Write the task description in Markdown. Keep it short or turn it into a full acceptance doc."})}),D.level==="issue"||D.level==="task"?s.jsxs(s.Fragment,{children:[s.jsx(ae,{label:"Execution mode",children:s.jsx(Ye,{value:D.executionMode??"afk",onChange:C=>Q({executionMode:C}),options:[{value:"afk",label:"AFK",description:"AI can complete the issue flow without waiting on a human decision."},{value:"hitl",label:"HITL",description:"A human decision is required somewhere in the slice."}]})}),s.jsx(ae,{label:"Acceptance criteria",children:s.jsx(at,{value:D.acceptanceCriteria.join(`
5
+ `),onChange:C=>Q({acceptanceCriteria:C.target.value.split(`
6
+ `).map(W=>W.trim()).filter(W=>W.length>0)}),placeholder:"Given ... / When ... / Then ..."})})]}):null,D.level!=="issue"?s.jsx(ae,{label:"AI instructions",children:s.jsx(at,{value:D.aiInstructions,onChange:C=>Q({aiInstructions:C.target.value}),placeholder:"Tell the executing agent which files and patterns matter, and what finished work looks like."})}):null,s.jsx(ae,{label:_("common.dialogs.task.owner"),labelHelp:"The owner is the person or role expected to carry this task.",error:ne.owner??null,children:s.jsx(ve,{value:D.owner,onChange:C=>Q({owner:C.target.value}),placeholder:"Albert"})}),s.jsx(Ya,{value:D.userId,users:N,onChange:C=>{var W;return Q({userId:C,owner:((W=N.find(S=>S.id===C))==null?void 0:W.displayName)??D.owner})},label:"Owner user",defaultLabel:Ga(it),help:"Tasks can belong to a human or bot user. The linked project owner is suggested first so cross-user task routing stays explicit."}),s.jsx(ae,{label:"Assignees",children:s.jsx("select",{multiple:!0,value:D.assigneeUserIds,onChange:C=>Q({assigneeUserIds:Array.from(C.target.selectedOptions,W=>W.value)}),className:"min-h-28 rounded-[var(--radius-control)] border border-white/10 bg-white/[0.04] px-3 py-2 text-sm text-white outline-none transition focus:border-[rgba(192,193,255,0.3)]",children:N.map(C=>s.jsxs("option",{value:C.id,children:[C.displayName," · ",C.kind]},C.id))})})]})},{id:"execution",eyebrow:"Execution",title:"Set priority, status, effort, and energy",description:"This is the minimum the execution engine needs in order to place the task well and show the right next move.",render:(D,Q)=>s.jsxs(s.Fragment,{children:[s.jsx(ae,{label:_("common.dialogs.task.priority"),labelHelp:"Priority controls how strongly Forge should surface this task in the board and daily views.",children:s.jsx(Ye,{value:D.priority,onChange:C=>Q({priority:C}),options:[{value:"low",label:_("common.enums.priority.low")},{value:"medium",label:_("common.enums.priority.medium")},{value:"high",label:_("common.enums.priority.high")},{value:"critical",label:_("common.enums.priority.critical")}]})}),s.jsx(ae,{label:_("common.dialogs.task.status"),labelHelp:"Status tells Forge whether the task is waiting, ready for focus, active, blocked, or done.",children:s.jsx(Ye,{value:D.status,onChange:C=>Q({status:C}),options:[{value:"backlog",label:_("common.enums.taskStatus.backlog")},{value:"focus",label:_("common.enums.taskStatus.focus")},{value:"in_progress",label:_("common.enums.taskStatus.in_progress")},{value:"blocked",label:_("common.enums.taskStatus.blocked")}]})}),s.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[s.jsx(ae,{label:_("common.dialogs.task.effort"),labelHelp:"Effort describes how much concentration and time this task usually needs.",children:s.jsx(Ye,{value:D.effort,onChange:C=>Q({effort:C}),options:[{value:"light",label:_("common.enums.effort.light")},{value:"deep",label:_("common.enums.effort.deep")},{value:"marathon",label:_("common.enums.effort.marathon")}]})}),s.jsx(ae,{label:_("common.dialogs.task.energy"),labelHelp:"Energy helps you match this task to a low-energy, steady, or high-energy moment.",children:s.jsx(Ye,{value:D.energy,onChange:C=>Q({energy:C}),options:[{value:"low",label:_("common.enums.energy.low")},{value:"steady",label:_("common.enums.energy.steady")},{value:"high",label:_("common.enums.energy.high")}]})})]})]})},{id:"signal",eyebrow:"Reward and timing",title:"Set the reward and timing details",description:"This keeps the daily surfaces honest without forcing you through a bloated last-mile form.",render:(D,Q)=>s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[s.jsx(ae,{label:_("common.dialogs.task.xp"),labelHelp:"XP is the reward weight for finishing this task. Higher XP should mean more meaningful work.",error:ne.points??null,children:s.jsx(ve,{type:"number",value:D.points,onChange:C=>Q({points:Number(C.target.value)||0}),placeholder:"60"})}),s.jsx(ae,{label:_("common.dialogs.task.dueDate"),labelHelp:"Only add a due date when timing really matters for this task.",children:s.jsx(ve,{type:"date",value:D.dueDate,onChange:C=>Q({dueDate:C.target.value})})})]}),s.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[s.jsx(ae,{label:"Expected duration",labelHelp:"Life Force uses this as the expected shape of the task. The default is one day.",error:ne.plannedDurationSeconds??null,children:s.jsx(ve,{type:"number",min:15,max:10080,step:15,value:Math.max(15,Math.round((D.plannedDurationSeconds??86400)/60)),onChange:C=>Q({plannedDurationSeconds:Math.max(60,(Number(C.target.value)||1440)*60)})})}),i?s.jsx(ae,{label:"Tracked minutes",labelHelp:"Change the current credited work total without starting a live run. Forge records the difference as a work adjustment when you save.",children:s.jsx(ve,{type:"number",min:0,step:1,value:se,onChange:C=>pe(Math.max(0,Math.trunc(Number(C.target.value)||0)))})}):null,s.jsx(ae,{label:"Action cost",labelHelp:"Choose a simple AP band now. Advanced AP editing can happen later inside the task.",children:s.jsx(Ye,{value:D.actionCostBand??"standard",onChange:C=>Q({actionCostBand:C}),options:[{value:"tiny",label:"Tiny"},{value:"light",label:"Light"},{value:"standard",label:"Standard"},{value:"heavy",label:"Heavy"},{value:"brutal",label:"Brutal"}]})})]}),i?s.jsxs("div",{className:"rounded-[22px] border border-white/8 bg-white/[0.04] px-4 py-3 text-sm leading-6 text-white/62",children:["Currently recorded: ",Te," min."," ",Ie===0?"Saving this edit keeps the tracked total unchanged.":`Saving this edit will ${Ie>0?"add":"remove"} ${Math.abs(Ie)} minute${Math.abs(Ie)===1?"":"s"} from the task history.`]}):null,s.jsx(ae,{label:_("common.dialogs.task.tags"),children:s.jsx("div",{className:"flex flex-wrap gap-2",children:B.map(C=>{const W=D.tagIds.includes(C.id);return s.jsx("button",{type:"button",className:`rounded-full px-3 py-2 text-sm transition ${W?"bg-white/16 text-white":"bg-white/6 text-white/58 hover:bg-white/10 hover:text-white"}`,onClick:()=>Q({tagIds:W?D.tagIds.filter(S=>S!==C.id):[...D.tagIds,C.id]}),children:C.name},C.id)})})})]})},{id:"notes",eyebrow:"Closeout",title:"Capture what changed when the work is done",description:"Completion stays truthful when the closeout records modified files, a concise work summary, and the associated commit refs.",render:(D,Q)=>{var C,W;return s.jsxs(s.Fragment,{children:[D.level!=="issue"?s.jsxs(s.Fragment,{children:[s.jsx(ae,{label:"Work summary",children:s.jsx(at,{value:((C=D.completionReport)==null?void 0:C.workSummary)??"",onChange:S=>{var ye,ge;return Q({completionReport:Na({modifiedFiles:((ye=D.completionReport)==null?void 0:ye.modifiedFiles)??[],workSummary:S.target.value,linkedGitRefIds:((ge=D.completionReport)==null?void 0:ge.linkedGitRefIds)??[]})})},placeholder:"Summarize what changed in this session and what is now true."})}),s.jsx(ae,{label:"Modified files",children:s.jsx(at,{value:(((W=D.completionReport)==null?void 0:W.modifiedFiles)??[]).join(`
7
+ `),onChange:S=>{var ye,ge;return Q({completionReport:Na({modifiedFiles:Ju(S.target.value),workSummary:((ye=D.completionReport)==null?void 0:ye.workSummary)??"",linkedGitRefIds:((ge=D.completionReport)==null?void 0:ge.linkedGitRefIds)??[]})})},placeholder:`src/pages/kanban-page.tsx
8
+ server/src/repositories/tasks.ts`})}),s.jsx(ae,{label:"Git links",children:s.jsx(Gu,{selectedRefs:D.gitRefs,onChange:S=>Q({gitRefs:S,completionReport:Xu(S,D.completionReport)})})})]}):null,s.jsx(ae,{label:"Creation notes",children:s.jsx(Qa,{notes:D.notes,onChange:S=>Q({notes:S}),entityLabel:"task"})})]})}},{id:"notes-evidence",eyebrow:"Evidence",title:"Capture launch context if this task needs a durable work note",description:"These notes become linked Markdown evidence on the task immediately, which helps preserve setup context, blockers, or handoff detail.",render:(D,Q)=>s.jsx("div",{className:"text-sm leading-6 text-white/62",children:"Use the previous step for completion closeout. Use linked notes here only when you want durable extra context, setup detail, or handoff evidence beyond the structured completion report."})}];return s.jsx(Xa,{open:e,onOpenChange:R,eyebrow:_("common.dialogs.task.eyebrow"),title:_(i?"common.dialogs.task.editTitle":"common.dialogs.task.createTitle"),description:_("common.dialogs.task.description"),value:A,onChange:I,draftPersistenceKey:i?`task.${i.id}`:"task.new",steps:mt,initialStepId:g,submitLabel:_(i?"common.dialogs.task.save":"common.dialogs.task.create"),error:$,onSubmit:async()=>{if(ee(null),i&&se<0){ee("Tracked minutes cannot be negative.");return}const D=Fu.safeParse(A);if(!D.success){Me(D.error.flatten().fieldErrors),ee("A few task details still need attention before this move can be saved.");return}oe({});try{await T(D.data,i==null?void 0:i.id),i&&p&&Ie!==0&&await p({entityType:"task",entityId:i.id,deltaMinutes:Ie,note:"Adjusted from task editor."}),R(!1)}catch(Q){ee(Q instanceof Error?Q.message:"Unable to save this task right now.")}}})}const ei="(max-width: 1023px)",ti=["Execution","Psyche","Knowledge"];function im(){const[e,t]=c.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(ei).matches);return c.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const a=window.matchMedia(ei),n=r=>{t(r.matches)};return t(a.matches),typeof a.addEventListener=="function"?(a.addEventListener("change",n),()=>a.removeEventListener("change",n)):(a.addListener(n),()=>a.removeListener(n))},[]),e}function si({kind:e,title:t,description:a,onClick:n}){return s.jsxs("button",{type:"button",className:"w-full min-w-0 rounded-[22px] border border-white/8 bg-white/[0.04] px-4 py-4 text-left transition hover:bg-white/[0.08]",onClick:n,children:[s.jsx(et,{kind:e,label:t,compact:!0,gradient:!1,className:"max-w-full"}),s.jsx("div",{className:"mt-1 text-sm text-white/55",children:a})]})}function om(e){return[{id:"goal",kind:"goal",group:"Execution",title:e("common.navigation.newGoal"),quickActionTitle:"Create life goal",description:e("common.navigation.newGoalDescription"),aliases:["goal","life goal","direction","objective"],filterIds:["goal"]},{id:"project",kind:"project",group:"Execution",title:e("common.navigation.newProject"),quickActionTitle:"Create project",description:e("common.navigation.newProjectDescription"),aliases:["project","initiative"],filterIds:["project"]},{id:"task",kind:"task",group:"Execution",title:e("common.navigation.newTask"),quickActionTitle:"Create task",description:e("common.navigation.newTaskDescription"),aliases:["task","todo","to-do","action item"],filterIds:["task"]},{id:"strategy",kind:"strategy",group:"Execution",title:"Strategy",quickActionTitle:"Create strategy",description:"Plan a directed path across projects and tasks toward a real end state.",aliases:["strategy","plan","roadmap"],filterIds:["strategy"]},{id:"habit",kind:"habit",group:"Execution",title:"Habit",quickActionTitle:"Create habit",description:"Track a recurring commitment or recurring slip with explicit XP logic.",aliases:["habit","routine","recurring"],filterIds:["habit"]},{id:"psyche_value",kind:"value",group:"Psyche",title:"Value",quickActionTitle:"Create value",description:"Place one value into the goal, project, and task constellation.",aliases:["value","psyche value","principle"],filterIds:["psyche_value"]},{id:"behavior_pattern",kind:"pattern",group:"Psyche",title:"Pattern",quickActionTitle:"Create pattern",description:"Map a loop, its payoff, its cost, and the response you want.",aliases:["pattern","loop","behavior pattern","psyche pattern"],filterIds:["behavior_pattern"]},{id:"behavior",kind:"behavior",group:"Psyche",title:"Behavior",quickActionTitle:"Create behavior",description:"Describe the move first, then classify it and link it.",aliases:["behavior","psyche behavior","behaviour"],filterIds:["behavior"]},{id:"flashcard",kind:"flashcard",group:"Psyche",title:"Flashcard",quickActionTitle:"Create flashcard",description:"Write a compact therapeutic card for urges, triggers, or values-based pivots.",aliases:["flashcard","card","urge card","trigger card","therapy card"],filterIds:["flashcard"]},{id:"trigger_report",kind:"report",group:"Psyche",title:"Report",quickActionTitle:"Create report",description:"Start a Spark-to-Pivot reflective chain.",aliases:["report","trigger report","psyche report"],filterIds:["trigger_report"]},{id:"wiki_page",kind:"wiki_page",group:"Knowledge",title:"Wiki page",quickActionTitle:"Create wiki page",description:"Open a fresh KarpaWiki page draft in the current knowledge workspace.",aliases:["wiki","wiki page","karpawiki","page","article"],filterIds:["wiki_page"]}]}function lm({goals:e,projects:t,tags:a,users:n,defaultUserId:r=null,onCreateGoal:o,onCreateProject:i,onCreateTask:l}){const{t:u}=Le(),h=Aa(),m=e??[],g=t??[],f=a??[],x=n??[],[y,R]=c.useState(!1),[p,T]=c.useState(!1),[_,b]=c.useState(!1),F=c.useMemo(()=>om(u),[u]),v=c.useMemo(()=>F.map(N=>({...N,onSelect:()=>{switch(N.id){case"goal":R(!0);return;case"project":T(!0);return;case"task":b(!0);return;case"strategy":h("/strategies?create=1");return;case"habit":h("/habits?create=1");return;case"psyche_value":h("/psyche/values?create=1");return;case"behavior_pattern":h("/psyche/patterns?create=1");return;case"behavior":h("/psyche/behaviors?create=1");return;case"flashcard":h("/psyche/flashcards?create=1");return;case"trigger_report":h("/psyche/reports?create=1");return;case"wiki_page":h("/wiki/new");return;default:return}}})),[h,F]),B=s.jsxs(s.Fragment,{children:[s.jsx(Wu,{open:y,editingGoal:null,tags:f,users:x,defaultUserId:r,onOpenChange:R,onSubmit:async N=>{await o(N)}}),s.jsx(Ku,{open:p,goals:m,users:x,editingProject:null,defaultUserId:r,onOpenChange:T,onSubmit:async N=>{await i(N)}}),s.jsx(rm,{open:_,goals:m,projects:g,tags:f,users:x,editingTask:null,defaultUserId:r,onOpenChange:b,onSubmit:async N=>{await l(N)}})]});return{actions:v,dialogs:B}}function cm({actions:e,className:t}){const{t:a}=Le(),[n,r]=c.useState(!1),[o,i]=c.useState(null),l=im(),u=c.useRef(null),h=c.useRef(null);return c.useEffect(()=>{if(!n||l)return;const m=()=>{var y;const x=(y=u.current)==null?void 0:y.getBoundingClientRect();x&&i({top:Math.max(24,x.top-18),right:Math.max(24,window.innerWidth-x.right)})};m();const g=x=>{var y,R;(y=u.current)!=null&&y.contains(x.target)||(R=h.current)!=null&&R.contains(x.target)||r(!1)},f=x=>{x.key==="Escape"&&r(!1)};return document.addEventListener("pointerdown",g),document.addEventListener("keydown",f),window.addEventListener("resize",m),window.addEventListener("scroll",m,!0),()=>{document.removeEventListener("pointerdown",g),document.removeEventListener("keydown",f),window.removeEventListener("resize",m),window.removeEventListener("scroll",m,!0)}},[l,n]),s.jsxs(s.Fragment,{children:[s.jsx("div",{ref:u,className:t,style:l?{right:"max(1rem, calc(var(--forge-safe-area-right) + 1rem))",bottom:"var(--forge-mobile-create-bottom)"}:void 0,children:s.jsxs(de,{type:"button","data-testid":"create-floating-trigger","aria-expanded":n,"aria-haspopup":"dialog",onClick:()=>r(m=>l?!0:!m),className:`min-w-max max-w-[calc(100vw-2rem)] shrink-0 rounded-full px-3.5 py-2 text-[12px] shadow-[0_20px_60px_rgba(4,8,18,0.34)] ${n?"bg-[linear-gradient(135deg,rgba(192,193,255,0.52),rgba(125,211,252,0.24))] text-white":""}`,children:[s.jsx(is,{className:`size-4 transition ${n?"text-white":"text-white/72"}`}),a("common.navigation.create")]})}),n&&!l&&typeof document<"u"&&o?Fs.createPortal(s.jsxs("div",{ref:h,"data-testid":"create-desktop-menu",className:"fixed z-50 w-[min(26rem,calc(100vw-2rem))] max-h-[min(34rem,calc(100vh-4rem))] overflow-y-auto rounded-[30px] border border-white/8 bg-[linear-gradient(180deg,rgba(18,24,40,0.985),rgba(10,15,27,0.985))] p-4 shadow-[0_28px_90px_rgba(3,8,18,0.46)]",style:{top:`${o.top}px`,right:`${o.right}px`,transform:"translateY(-100%)"},children:[s.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/42",children:"Create"}),s.jsx("div",{className:"mt-2 text-lg font-medium text-white",children:"Start the next move"}),s.jsx("div",{className:"mt-1 text-sm leading-6 text-white/56",children:"Pick one thing to create. The flow keeps the first step light and visible."}),ti.map(m=>s.jsxs("div",{className:"mt-4",children:[s.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/38",children:m}),s.jsx("div",{className:"mt-2 grid gap-2",children:e.filter(g=>g.group===m).map(g=>s.jsx(si,{kind:g.kind,title:g.title,description:g.description,onClick:()=>{r(!1),g.onSelect()}},g.id))})]},m))]}),document.body):null,s.jsx(yt,{open:n&&l,onOpenChange:r,children:s.jsxs(xt,{children:[s.jsx(bt,{className:"fixed inset-0 z-40 bg-[rgba(4,8,18,0.72)] backdrop-blur-xl lg:hidden"}),s.jsxs(vt,{"data-testid":"create-mobile-sheet",className:"fixed inset-x-4 bottom-28 z-50 flex max-h-[min(30rem,calc(100vh-8rem))] flex-col overflow-hidden rounded-[28px] border border-white/8 bg-[linear-gradient(180deg,rgba(24,31,50,0.98),rgba(15,21,36,0.98))] p-0 shadow-[0_30px_90px_rgba(3,8,18,0.45)] lg:hidden",style:{left:"max(1rem, calc(var(--forge-safe-area-left) + 1rem))",right:"max(1rem, calc(var(--forge-safe-area-right) + 1rem))",bottom:"calc(var(--forge-mobile-nav-clearance) - 0.5rem)"},children:[s.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-white/8 px-5 py-5",children:[s.jsxs("div",{children:[s.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:a("common.navigation.create")}),s.jsx(wt,{className:"mt-2 font-display text-2xl text-white",children:a("common.navigation.createTitle")}),s.jsx(kt,{className:"mt-2 text-sm leading-6 text-white/60",children:a("common.navigation.createDescription")})]}),s.jsx(Mt,{asChild:!0,children:s.jsx("button",{type:"button","aria-label":a("common.navigation.closeCreateMenu"),className:"rounded-full bg-white/6 p-2 text-white/65 transition hover:bg-white/10 hover:text-white",children:s.jsx(ut,{className:"size-4"})})})]}),s.jsx("div",{className:"overflow-y-auto p-4 overscroll-contain",children:ti.map(m=>s.jsxs("div",{className:"mt-1 grid gap-2 first:mt-0",children:[s.jsx("div",{className:"px-1 text-[11px] uppercase tracking-[0.18em] text-white/38",children:m}),e.filter(g=>g.group===m).map(g=>s.jsx(si,{kind:g.kind,title:g.title,description:g.description,onClick:()=>{r(!1),g.onSelect()}},g.id))]},m))})]})]})})]})}function lt({className:e,...t}){return s.jsx("div",{className:P("w-full max-w-full min-w-0 rounded-[var(--radius-card)] border border-[var(--ui-border-subtle)] bg-[var(--card-gradient)] p-4 shadow-[var(--card-shadow)] backdrop-blur-sm",e),...t})}const ss=[{to:"/psyche",label:"Overview",icon:La},{to:"/psyche/metrics",label:"Metrics",icon:ul},{to:"/psyche/flashcards",label:"Flashcards",icon:js},{to:"/psyche/values",label:"Values",icon:Oi},{to:"/psyche/patterns",label:"Patterns",icon:ml},{to:"/psyche/questionnaires",label:"Questionnaires",icon:pl},{to:"/psyche/self-observation",label:"Self Observation",icon:Ni},{to:"/psyche/behaviors",label:"Behaviors",icon:_i},{to:"/psyche/reports",label:"Reports",icon:is},{to:"/psyche/goal-map",label:"Goal Map",icon:hl},{to:"/psyche/schemas-beliefs",label:"Schemas & Beliefs",icon:gl},{to:"/psyche/modes",label:"Modes",icon:fl},{to:"/psyche/screen-time",label:"Screen Time",icon:yl},{to:"/preferences",label:"Preferences",icon:Da},{to:"/sleep",label:"Sleep",icon:Li}];function ia(e,t){return t==="/psyche"?e==="/psyche":e===t||e.startsWith(`${t}/`)}function Bw({className:e}){const t=Kt(),[a,n]=c.useState(!1),r=c.useMemo(()=>[...ss].sort((o,i)=>i.to.length-o.to.length).find(o=>ia(t.pathname,o.to))??ss[0],[t.pathname]);return c.useEffect(()=>{if(!a)return;const o=document.body.style.overflow,i=document.body.style.touchAction,l=u=>{u.key==="Escape"&&n(!1)};return document.body.style.overflow="hidden",document.body.style.touchAction="none",window.addEventListener("keydown",l),()=>{document.body.style.overflow=o,document.body.style.touchAction=i,window.removeEventListener("keydown",l)}},[a]),s.jsxs(s.Fragment,{children:[s.jsxs(lt,{className:P("overflow-hidden bg-[linear-gradient(180deg,rgba(15,24,31,0.94),rgba(10,18,25,0.92))] p-2",e),children:[s.jsx("div",{className:"hidden items-center gap-3 lg:flex",children:s.jsx("div",{className:"flex flex-wrap gap-2",children:ss.map(o=>s.jsxs(ls,{to:o.to,end:o.to==="/psyche",className:({isActive:i})=>P("inline-flex items-center gap-2 whitespace-nowrap rounded-full px-3 py-1.5 text-[11px] font-semibold uppercase tracking-[0.14em] transition",i||ia(t.pathname,o.to)?"bg-[rgba(110,231,183,0.18)] text-[var(--tertiary)]":"bg-white/[0.04] text-white/58 hover:bg-white/[0.08] hover:text-white"),children:[s.jsx(o.icon,{className:"size-3.5"}),s.jsx("span",{children:o.label})]},o.to))})}),s.jsx("div",{className:"flex items-center justify-between gap-3 lg:hidden",children:s.jsx("button",{type:"button",className:"inline-flex min-w-0 flex-1 items-center gap-3 rounded-[22px] border border-white/8 bg-[linear-gradient(180deg,rgba(19,28,42,0.96),rgba(11,17,30,0.94))] px-3.5 py-2.5 text-left shadow-[0_18px_38px_rgba(3,8,18,0.2)] transition hover:border-white/12 hover:bg-[linear-gradient(180deg,rgba(24,34,50,0.98),rgba(12,19,34,0.96))]",onClick:()=>n(!0),children:s.jsxs("span",{className:"flex min-w-0 items-center gap-3",children:[s.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-2xl border border-[rgba(110,231,183,0.2)] bg-[rgba(110,231,183,0.12)]",children:s.jsx(r.icon,{className:"size-4 text-[var(--tertiary)]"})}),s.jsxs("span",{className:"min-w-0",children:[s.jsx("span",{className:"block text-[10px] uppercase tracking-[0.18em] text-white/40",children:"Psyche section"}),s.jsx("span",{className:"mt-0.5 block truncate text-sm font-medium text-white",children:r.label})]})]})})})]}),a&&typeof document<"u"?Fs.createPortal(s.jsxs("div",{className:"lg:hidden",children:[s.jsx("div",{className:"fixed inset-0 z-50 bg-[rgba(5,10,18,0.78)] backdrop-blur-xl"}),s.jsx("button",{type:"button","aria-label":"Close psyche sections",className:"fixed inset-0 z-[51]",onClick:()=>n(!1)}),s.jsx("div",{className:"pointer-events-none fixed inset-0 z-[52] flex items-end justify-center px-3 pt-3 sm:px-4 sm:pt-4",style:{paddingLeft:"max(0.75rem, calc(var(--forge-safe-area-left) + 0.75rem))",paddingRight:"max(0.75rem, calc(var(--forge-safe-area-right) + 0.75rem))",paddingTop:"max(0.75rem, calc(env(safe-area-inset-top) + 0.75rem))",paddingBottom:"calc(var(--forge-mobile-nav-clearance) - 0.25rem)"},children:s.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Psyche sections",className:"pointer-events-auto flex max-h-[min(34rem,calc(100dvh-var(--forge-mobile-nav-clearance)-1rem))] w-full max-w-xl min-h-0 flex-col overflow-hidden rounded-[30px] border border-white/10 bg-[radial-gradient(circle_at_top,rgba(110,231,183,0.12),transparent_40%),linear-gradient(180deg,rgba(18,27,42,0.98),rgba(10,15,28,0.98))] shadow-[0_36px_110px_rgba(3,8,18,0.5)]",children:[s.jsx("div",{className:"shrink-0 border-b border-white/8 px-4 pb-2.5 pt-3 sm:px-5",children:s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"font-label text-[10px] uppercase tracking-[0.22em] text-white/38",children:"Psyche sections"}),s.jsxs("div",{className:"mt-1.5 flex min-w-0 flex-wrap items-center gap-2",children:[s.jsx("div",{className:"truncate text-[1.05rem] font-semibold text-white",children:"Move through Psyche"}),s.jsx("span",{className:"rounded-full border border-[rgba(110,231,183,0.18)] bg-[rgba(110,231,183,0.12)] px-2.5 py-1 text-[10px] uppercase tracking-[0.16em] text-[var(--tertiary)]",children:r.label})]})]}),s.jsx("button",{type:"button","aria-label":"Close psyche sections",className:"inline-flex size-10 shrink-0 items-center justify-center rounded-full border border-white/8 bg-white/[0.05] text-white/65 transition hover:border-white/12 hover:bg-white/[0.09] hover:text-white",onClick:()=>n(!1),children:s.jsx(ut,{className:"size-4"})})]})}),s.jsx("div",{className:"min-h-0 overflow-y-auto p-3 overscroll-contain sm:p-4",children:s.jsx("div",{className:"grid gap-2",children:ss.map(o=>{const i=ia(t.pathname,o.to);return s.jsxs(ls,{to:o.to,end:o.to==="/psyche",onClick:()=>n(!1),className:P("group flex items-center justify-between gap-3 rounded-[22px] border px-3.5 py-3 transition-[transform,border-color,background-color,color] duration-150 hover:-translate-y-[1px] hover:text-white",i?"border-[rgba(110,231,183,0.18)] bg-[rgba(110,231,183,0.12)] text-white":"border-white/8 bg-white/[0.04] text-white/72 hover:border-white/12 hover:bg-white/[0.06]"),children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-3",children:[s.jsx("span",{className:P("flex size-10 shrink-0 items-center justify-center rounded-2xl border transition",i?"border-[rgba(110,231,183,0.18)] bg-[rgba(110,231,183,0.14)] text-[var(--tertiary)]":"border-white/8 bg-[rgba(255,255,255,0.03)] text-white/58 group-hover:border-white/12 group-hover:text-white/80"),children:s.jsx(o.icon,{className:"size-4"})}),s.jsxs("span",{className:"min-w-0",children:[s.jsx("span",{className:"block truncate text-sm font-semibold text-white",children:o.label}),s.jsx("span",{className:"mt-0.5 block text-[10px] uppercase tracking-[0.16em] text-white/35",children:o.to==="/preferences"?"Preference system":"Psyche workspace"})]})]}),s.jsx("span",{className:P("rounded-full px-2.5 py-1 text-[10px] uppercase tracking-[0.16em]",i?"bg-[rgba(110,231,183,0.16)] text-[var(--tertiary)]":"bg-white/[0.05] text-white/42"),children:i?"Current":"Open"})]},o.to)})})})]})})]}),document.body):null]})}function dm(e){return e===null?"20":String(Math.max(1,Math.round(e/60)))}function um({tasks:e,projects:t,activeRunCount:a,maxActiveTasks:n,timeAccountingMode:r,pending:o,errorMessage:i,initialTaskId:l,defaultProjectId:u,onCancel:h,onStartExisting:m,onCreateAndStart:g}){const[f,x]=c.useState("existing"),[y,R]=c.useState(""),[p,T]=c.useState(l??null),[_,b]=c.useState(""),[F,v]=c.useState(""),[B,N]=c.useState(u??""),[A,I]=c.useState("planned"),[$,ee]=c.useState("20"),[ne,oe]=c.useState(""),[V,w]=c.useState("");c.useEffect(()=>{x(l?"existing":"new"),R(""),T(l??null),b(""),v(""),N(u??""),I("planned"),ee("20"),oe(""),w("")},[u,l]);const z=c.useMemo(()=>e.filter(O=>O.status!=="done").sort((O,se)=>O.time.hasCurrentRun!==se.time.hasCurrentRun?Number(se.time.hasCurrentRun)-Number(O.time.hasCurrentRun):O.status!==se.status?O.status.localeCompare(se.status):O.title.localeCompare(se.title)),[e]),ie=c.useMemo(()=>{const O=y.trim().toLowerCase();return O?z.filter(se=>{var Me,Te,Ie,xe,Ce,Ne;const pe=t.find(we=>we.id===se.projectId);return[se.title,se.description,se.owner,((Me=se.user)==null?void 0:Me.displayName)??"",((Te=se.user)==null?void 0:Te.handle)??"",((Ie=se.user)==null?void 0:Ie.kind)??"",(pe==null?void 0:pe.title)??"",((xe=pe==null?void 0:pe.user)==null?void 0:xe.displayName)??"",((Ce=pe==null?void 0:pe.user)==null?void 0:Ce.handle)??"",((Ne=pe==null?void 0:pe.user)==null?void 0:Ne.kind)??""].some(we=>we.toLowerCase().includes(O))}):z},[t,z,y]),te=c.useMemo(()=>t.find(O=>O.id===B)??null,[B,t]),E=A==="planned"?Math.max(60,(Number.parseInt($,10)||20)*60):null,X=c.useMemo(()=>{const O=ne.trim(),se=V.trim();return!O&&!se?null:{provider:"github",repository:O,branch:se,baseBranch:"main",branchUrl:O&&se?`https://github.com/${O}/tree/${encodeURIComponent(se)}`:null,pullRequestUrl:null,pullRequestNumber:null,compareUrl:O&&se?`https://github.com/${O}/compare/main...${encodeURIComponent(se)}`:null}},[V,ne]),M=f==="existing"?!!p:!!(_.trim()&&B),Z=r==="split"?"Split time":r==="parallel"?"Parallel time":"Primary only";return s.jsxs("div",{className:"grid gap-4",children:[s.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Start work"}),s.jsx("h3",{className:"mt-2 font-display text-[clamp(1.2rem,1.8vw,1.65rem)] text-white",children:"Pick a task and start the timer"}),s.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-6 text-white/60",children:"Use an existing task or create a new one quickly. Forge will move the task into in progress as soon as work starts."})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs(le,{className:"bg-white/[0.08] text-white/72",children:[a,"/",n," live"]}),s.jsx(le,{className:"bg-white/[0.08] text-white/72",children:Z})]})]}),s.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:[{value:"existing",label:"Existing task",detail:"Search and start something that already exists."},{value:"new",label:"New quick task",detail:"Create a task with a title, short description, and project."}].map(O=>{const se=f===O.value;return s.jsxs("button",{type:"button",className:P("rounded-[18px] border px-4 py-4 text-left transition",se?"border-[rgba(192,193,255,0.28)] bg-[rgba(192,193,255,0.14)] text-white":"border-white/8 bg-white/[0.04] text-white/65 hover:bg-white/[0.07]"),onClick:()=>x(O.value),children:[s.jsx("div",{className:"font-medium",children:O.label}),s.jsx("div",{className:"mt-2 text-sm leading-6 text-inherit/80",children:O.detail})]},O.value)})}),f==="existing"?s.jsxs("div",{className:"grid gap-3",children:[s.jsxs("label",{className:"grid gap-2",children:[s.jsx("span",{className:"type-label text-white/45",children:"Search tasks"}),s.jsxs("div",{className:"relative",children:[s.jsx(ft,{className:"pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-white/32"}),s.jsx(ve,{value:y,onChange:O=>R(O.target.value),placeholder:"Search task, project, human, bot, or owner",className:"pl-10"})]})]}),s.jsx("div",{className:"grid max-h-[19rem] gap-2 overflow-y-auto rounded-[20px] bg-white/[0.03] p-2",children:ie.length===0?s.jsx("div",{className:"rounded-[16px] border border-dashed border-white/8 px-4 py-8 text-center text-sm text-white/42",children:"No tasks match. Switch to New quick task to create one now."}):ie.slice(0,16).map(O=>{const se=p===O.id,pe=t.find(Me=>Me.id===O.projectId);return s.jsx("button",{type:"button",className:P("rounded-[16px] border px-4 py-3 text-left transition",se?"border-[rgba(192,193,255,0.28)] bg-[rgba(192,193,255,0.14)] text-white":"border-white/8 bg-white/[0.04] text-white/72 hover:bg-white/[0.07]"),onClick:()=>T(O.id),children:s.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx(gs,{kind:"task",label:O.title,className:"max-w-full"}),s.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[pe?s.jsx(et,{kind:"project",label:pe.title,compact:!0,gradient:!1}):null,s.jsx(le,{className:"bg-white/[0.08] text-white/70",children:O.status.replaceAll("_"," ")}),O.time.activeRunCount>0?s.jsxs(le,{className:"bg-emerald-500/12 text-emerald-200",children:[O.time.activeRunCount," live"]}):null]})]}),s.jsxs("span",{className:"text-[12px] text-white/45",children:[O.points," xp"]})]})},O.id)})})]}):s.jsxs("div",{className:"grid gap-3",children:[s.jsxs("label",{className:"grid gap-2",children:[s.jsx("span",{className:"type-label text-white/45",children:"Task title"}),s.jsx(ve,{value:_,onChange:O=>b(O.target.value),placeholder:"Write the next concrete task"})]}),s.jsxs("label",{className:"grid gap-2",children:[s.jsx("span",{className:"type-label text-white/45",children:"Short description"}),s.jsx(at,{value:F,onChange:O=>v(O.target.value),placeholder:"Keep it short and concrete."})]}),s.jsxs("label",{className:"grid gap-2",children:[s.jsx("span",{className:"type-label text-white/45",children:"Project"}),s.jsxs("select",{value:B,onChange:O=>N(O.target.value),className:"min-h-10 rounded-[var(--radius-control)] border border-white/10 bg-white/[0.04] px-3 py-2 text-sm text-white outline-none transition focus:border-[rgba(192,193,255,0.3)]",children:[s.jsx("option",{value:"",children:"Select project"}),t.map(O=>s.jsx("option",{value:O.id,children:O.user?`${O.title} · ${O.user.displayName} (${O.user.kind})`:O.title},O.id))]})]}),te?s.jsxs("div",{className:"rounded-[16px] bg-white/[0.04] px-4 py-3 text-sm text-white/62",children:["This task will be created inside ",s.jsx("span",{className:"font-medium text-white",children:te.title}),te.user?` for ${te.user.displayName} (${te.user.kind})`:""," ","and started immediately."]}):null]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx("span",{className:"type-label text-white/45",children:"Timer"}),s.jsxs("div",{className:"grid gap-2 sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_8rem]",children:[[{value:"planned",label:"20 min planned",detail:"Pomodoro-style by default."},{value:"unlimited",label:"Unlimited",detail:"Keep tracking until you stop."}].map(O=>{const se=A===O.value;return s.jsxs("button",{type:"button",className:P("rounded-[18px] border px-4 py-3 text-left transition",se?"border-[rgba(192,193,255,0.28)] bg-[rgba(192,193,255,0.14)] text-white":"border-white/8 bg-white/[0.04] text-white/65 hover:bg-white/[0.07]"),onClick:()=>I(O.value),children:[s.jsx("div",{className:"font-medium",children:O.label}),s.jsx("div",{className:"mt-1.5 text-sm leading-6 text-inherit/80",children:O.detail})]},O.value)}),s.jsxs("label",{className:P("grid gap-2",A!=="planned"&&"opacity-50"),children:[s.jsx("span",{className:"type-label text-white/45",children:"Minutes"}),s.jsx(ve,{type:"number",min:1,max:240,disabled:A!=="planned",value:$,onChange:O=>ee(O.target.value)})]})]})]}),s.jsxs("div",{className:"grid gap-3 rounded-[20px] border border-white/8 bg-white/[0.03] p-4",children:[s.jsxs("div",{children:[s.jsx("div",{className:"type-label text-white/45",children:"GitHub context"}),s.jsx("div",{className:"mt-2 text-sm leading-6 text-white/56",children:"Optional. Record the repository and branch for this work session so the project board can show the live agent branch."})]}),s.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[s.jsxs("label",{className:"grid gap-2",children:[s.jsx("span",{className:"type-label text-white/45",children:"Repository"}),s.jsx(ve,{value:ne,onChange:O=>oe(O.target.value),placeholder:"owner/repo"})]}),s.jsxs("label",{className:"grid gap-2",children:[s.jsx("span",{className:"type-label text-white/45",children:"Branch"}),s.jsx(ve,{value:V,onChange:O=>w(O.target.value),placeholder:"agent/board-redesign"})]})]})]}),i?s.jsx("div",{className:"rounded-[18px] bg-rose-500/10 px-4 py-3 text-sm leading-6 text-rose-200",children:i}):null,s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-t border-white/6 pt-4",children:[s.jsxs("div",{className:"flex flex-wrap gap-2 text-[12px] text-white/45",children:[s.jsx("div",{className:"rounded-full bg-white/[0.05] px-3 py-2",children:"Starts in progress"}),s.jsx("div",{className:"rounded-full bg-white/[0.05] px-3 py-2",children:A==="planned"?`${dm(E)} min target`:"Unlimited timer"})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsx(de,{variant:"secondary",size:"lg",onClick:h,children:"Cancel"}),s.jsxs(de,{size:"lg",pending:o,pendingLabel:"Starting",disabled:!M,onClick:async()=>{if(M){if(f==="existing"&&p){await m(p,{timerMode:A,plannedDurationSeconds:E,gitContext:X});return}await g({title:_.trim(),description:F.trim(),projectId:B,timerMode:A,plannedDurationSeconds:E,gitContext:X})}},children:[f==="existing"?s.jsx(os,{className:"size-4"}):s.jsx(Di,{className:"size-4"}),"Start work",s.jsx($i,{className:"size-4"})]})]})]})]})}function ai({open:e,onOpenChange:t,presentation:a="responsive",...n}){const r=s.jsx(um,{...n,onCancel:()=>t(!1)});return s.jsxs(s.Fragment,{children:[e&&a!=="mobile_sheet"?s.jsx("div",{className:"hidden lg:block",children:s.jsxs("div",{className:"rounded-[24px] border border-white/8 bg-[linear-gradient(180deg,rgba(17,24,39,0.98),rgba(11,16,28,0.97))] p-4 shadow-[0_24px_60px_rgba(3,8,18,0.28)]",children:[s.jsx("div",{className:"mb-3 flex justify-end",children:s.jsxs(de,{variant:"ghost",size:"sm",className:"px-3",onClick:()=>t(!1),children:[s.jsx(ut,{className:"size-4"}),"Close"]})}),r]})}):null,a!=="desktop_inline"?s.jsx("div",{className:a==="responsive"?"lg:hidden":"",children:s.jsx(Va,{open:e,onOpenChange:t,eyebrow:"Start work",title:"Start work",description:"Pick an existing task or create a new one quickly, then start the timer immediately.",children:r})}):null]})}const en=c.createContext({expanded:!1,setExpanded:()=>{}});function ni({children:e}){const[t,a]=c.useState(!1),n=c.useRef(0);return c.useEffect(()=>{if(!t)return;n.current=performance.now();let r=window.scrollY;const o=()=>{if(performance.now()-n.current<280){r=window.scrollY;return}window.scrollY-r>16&&a(!1),r=window.scrollY};return window.addEventListener("scroll",o,{passive:!0}),()=>window.removeEventListener("scroll",o)},[t]),s.jsx(en.Provider,{value:{expanded:t,setExpanded:a},children:e})}function Ot(e){const t=Math.max(0,Math.floor(e)),a=Math.floor(t/3600),n=Math.floor(t%3600/60),r=t%60;return a>0?`${a}:${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}`:`${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}`}function mm(e,t,a,n,r){const o=Math.max(1,e.length),i=Date.parse(a),l=Number.isFinite(i)?Math.max(0,Math.floor((r-i)/1e3)):0;return e.map(u=>{const h=t.find(R=>R.id===u.taskId),m=u.status==="active"?u.elapsedWallSeconds+l:u.elapsedWallSeconds,g=u.status!=="active"?0:n==="parallel"?l:n==="split"?l/o:u.isCurrent?l:0,f=u.creditedSeconds+g,x=u.timerMode==="planned"&&u.plannedDurationSeconds!==null?Math.max(0,u.plannedDurationSeconds-m):null,y=u.timerMode==="planned"&&u.plannedDurationSeconds!==null?Math.max(0,m-u.plannedDurationSeconds):0;return{run:u,title:(h==null?void 0:h.title)??u.taskTitle,wallSeconds:m,creditedSeconds:f,remainingSeconds:x,overtimeSeconds:y}}).sort((u,h)=>Number(h.run.isCurrent)-Number(u.run.isCurrent))}function yo(e,t,a,n){const[r,o]=c.useState(()=>Date.now());return c.useEffect(()=>{if(e.length===0)return;const i=window.setInterval(()=>o(Date.now()),1e3);return()=>window.clearInterval(i)},[e.length]),c.useMemo(()=>mm(e,t,a,n,r),[a,r,e,t,n])}function ri({runs:e,tasks:t,generatedAt:a,timeAccountingMode:n,pending:r,onOpenStartWork:o,onPause:i,onFocus:l}){const{expanded:u,setExpanded:h}=c.useContext(en),m=yo(e,t,a,n),g=m.find(x=>x.run.isCurrent)??m[0]??null,f=g?m.filter(x=>x.run.id!==g.run.id):[];return g?s.jsxs("div",{className:P("flex min-h-[2.125rem] min-w-0 items-center rounded-full border border-white/8 bg-white/[0.04] transition-colors",u&&"border-[var(--primary)]/25 bg-[var(--primary)]/[0.06]"),children:[s.jsxs("button",{type:"button","aria-expanded":u,"aria-label":u?"Collapse work details":"Expand work details",className:"flex min-w-0 flex-1 cursor-pointer items-center gap-1.5 rounded-l-full py-1 pl-2.5 pr-2 transition-colors hover:bg-white/[0.04]",onClick:()=>h(x=>!x),children:[s.jsx(os,{className:"size-3.5 shrink-0 text-[var(--primary)]"}),s.jsx("span",{className:"truncate text-[12px] font-medium text-white",children:g.title}),s.jsx("span",{className:"shrink-0 text-[11px] tabular-nums text-white/44",children:Ot(g.creditedSeconds)})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-0.5 pr-1",children:[f.length>0?s.jsx("button",{type:"button",title:"Switch to next task",disabled:r,className:"inline-flex size-6 items-center justify-center rounded-full bg-[var(--primary)]/15 text-[10px] font-bold tabular-nums text-[var(--primary)] transition hover:bg-[var(--primary)]/25 disabled:pointer-events-none disabled:opacity-70",onClick:()=>void l(f[0].run.id),children:m.length}):null,s.jsx("button",{type:"button",title:"Stop",disabled:r,className:"inline-flex size-6 items-center justify-center rounded-full text-white/50 transition hover:bg-white/[0.1] hover:text-white disabled:pointer-events-none disabled:opacity-70",onClick:()=>void i(g.run.id),children:s.jsx(xl,{className:"size-2.5 fill-current"})}),s.jsx("button",{type:"button",title:"Start new work",disabled:r,className:"inline-flex size-6 items-center justify-center rounded-full text-white/50 transition hover:bg-white/[0.1] hover:text-white disabled:pointer-events-none disabled:opacity-70",onClick:()=>o(),children:s.jsx($i,{className:"size-2.5 fill-current"})})]})]}):s.jsxs("div",{className:"flex min-h-[2.125rem] min-w-0 items-center gap-1.5 rounded-full border border-white/8 bg-white/[0.04] py-1 pl-2.5 pr-1",children:[s.jsx(os,{className:"size-3.5 shrink-0 text-white/48"}),s.jsx("span",{className:"truncate text-[12px] text-white/48",children:"No active work"}),s.jsx("button",{type:"button",className:"ml-auto inline-flex h-[1.5rem] shrink-0 items-center rounded-full bg-white/10 px-2 text-[11px] font-medium text-white transition hover:bg-white/15",onClick:o,children:"Start work"})]})}function ii({runs:e,tasks:t,generatedAt:a,timeAccountingMode:n,pending:r,onOpenStartWork:o,onFocus:i,onPause:l,onComplete:u}){var y,R,p,T;const{expanded:h}=c.useContext(en),m=yo(e,t,a,n),g=m.find(_=>_.run.isCurrent)??m[0]??null,f=g?m.filter(_=>_.run.id!==g.run.id):[],x=n==="split"&&m.length>1?`Split across ${m.length} active tasks`:n==="parallel"&&m.length>1?`Parallel time across ${m.length} active tasks`:n==="primary_only"&&m.length>1?"Only the current task is earning credited time":null;return g?s.jsx(Ma,{initial:!1,children:h?s.jsx(gt.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.25,ease:"easeOut"},className:"overflow-hidden",children:s.jsxs("div",{className:"mt-2 rounded-2xl border border-white/8 bg-[linear-gradient(180deg,rgba(192,193,255,0.10),rgba(192,193,255,0.03))] p-4",children:[s.jsxs("div",{className:"flex flex-col gap-4 xl:flex-row xl:items-start xl:justify-between",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(le,{tone:"signal",className:"text-white/82",children:"Current task"}),s.jsx(le,{tone:"meta",children:g.run.timerMode==="planned"?"Planned timer":"Unlimited timer"}),x?s.jsx(le,{tone:"meta",children:x}):null]}),s.jsx("div",{className:"mt-3 text-xl font-medium text-white md:text-2xl",children:g.title}),s.jsxs("div",{className:"mt-2 flex flex-wrap gap-4 text-sm text-white/62",children:[s.jsxs("span",{children:[Ot(g.creditedSeconds)," credited"]}),s.jsxs("span",{children:[Ot(g.wallSeconds)," wall time"]}),g.run.timerMode==="planned"?g.overtimeSeconds>0?s.jsxs("span",{className:"text-amber-200",children:["+",Ot(g.overtimeSeconds)," overtime"]}):s.jsxs("span",{children:[Ot(g.remainingSeconds??0)," remaining"]}):s.jsx("span",{children:"Unlimited session"})]}),(y=g.run.gitContext)!=null&&y.branch||(R=g.run.gitContext)!=null&&R.pullRequestNumber?s.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[(p=g.run.gitContext)!=null&&p.branch?s.jsxs(le,{tone:"meta",children:[s.jsx(Ht,{className:"mr-1 size-3"}),g.run.gitContext.branch]}):null,(T=g.run.gitContext)!=null&&T.pullRequestNumber?s.jsxs(le,{tone:"meta",children:[s.jsx(Ai,{className:"mr-1 size-3"}),"PR #",g.run.gitContext.pullRequestNumber]}):null]}):null]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs(de,{variant:"secondary",pending:r,pendingLabel:"Opening",onClick:o,children:[s.jsx(os,{className:"size-4"}),"Start work"]}),s.jsxs(de,{variant:"secondary",pending:r,pendingLabel:"Pausing",onClick:()=>void l(g.run.id),children:[s.jsx(bl,{className:"size-4"}),"Pause"]}),s.jsxs(de,{pending:r,pendingLabel:"Completing",onClick:()=>void u(g.run.id),children:[s.jsx(vl,{className:"size-4"}),"Complete"]})]})]}),f.length>0?s.jsx("div",{className:"mt-4 grid gap-2 lg:grid-cols-2",children:f.map(_=>s.jsxs("button",{type:"button",className:P("flex items-center justify-between gap-3 rounded-2xl bg-white/[0.04] px-4 py-3 text-left transition hover:bg-white/[0.08]",r&&"pointer-events-none opacity-70"),onClick:()=>void i(_.run.id),children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"truncate text-sm font-medium text-white/88",children:_.title}),s.jsxs("div",{className:"mt-1 flex flex-wrap gap-3 text-[12px] text-white/48",children:[s.jsxs("span",{children:[Ot(_.creditedSeconds)," credited"]}),s.jsx("span",{children:_.run.timerMode==="planned"?"planned":"unlimited"})]})]}),s.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-white/42",children:[s.jsx(Ws,{className:"size-3.5"}),"Switch"]})]},_.run.id))}):null]})},"timer-rail-detail"):null}):null}function xo({eyebrow:e,title:t,description:a}){const{t:n}=Le();return s.jsxs(lt,{className:"surface-pulse ambient-glow mx-auto grid max-w-2xl gap-4 text-center",children:[s.jsx("div",{className:"type-label text-white/40",children:e??n("common.labels.loading")}),s.jsx("div",{className:"type-display-section text-white",children:t??n("common.pageState.loadingTitle")}),s.jsx("p",{className:"type-body mx-auto max-w-xl text-white/60",children:a??n("common.pageState.loadingDescription")}),s.jsxs("div",{className:"mx-auto flex min-h-11 items-center gap-3 rounded-full bg-white/[0.05] px-4 py-3 text-white/60",children:[s.jsx(Fa,{tone:"subtle",className:"size-3.5"}),s.jsx("span",{className:"type-meta",children:n("common.labels.syncInProgress")})]})]})}function Is({error:e,onRetry:t,eyebrow:a}){const{t:n}=Le(),{title:r,description:o,code:i}=vc(e);return s.jsxs(lt,{className:"mx-auto grid max-w-2xl gap-4",children:[s.jsx("div",{className:"type-label text-rose-200/72",children:a??n("common.labels.connectionState")}),s.jsx("div",{className:"type-display-section text-white",children:r}),s.jsx("p",{className:"type-body text-white/62",children:o}),s.jsx("div",{className:"type-meta text-white/40",children:n("common.labels.errorCode",{code:i})}),t?s.jsx("div",{className:"flex flex-wrap gap-3",children:s.jsxs(de,{type:"button",variant:"secondary",onClick:t,children:[s.jsx(ha,{className:"mr-2 size-4"}),n("common.actions.retry")]})}):null]})}function Kw({eyebrow:e,title:t,description:a,action:n}){const{t:r}=Le();return s.jsxs(lt,{className:"mx-auto grid max-w-2xl gap-4 text-center",children:[s.jsx("div",{className:"type-label text-white/38",children:e??r("common.labels.loading")}),s.jsx("div",{className:"type-display-section text-white",children:t}),s.jsx("p",{className:"type-body mx-auto max-w-xl text-white/60",children:a}),n?s.jsx("div",{className:"flex justify-center",children:n}):null]})}async function re(e){try{return{data:await e()}}catch(t){return{error:t}}}const Ct=zl({reducerPath:"forgeApi",baseQuery:Wl(),tagTypes:["OperatorSession","Settings","Snapshot","Gamification","Doctor","Sleep","Psyche","WikiIngestJobs","WorkbenchFlow","WorkbenchFlows"],endpoints:e=>({getOperatorSession:e.query({queryFn:()=>re(zc),providesTags:["OperatorSession"]}),getSettings:e.query({queryFn:()=>re(Zi),providesTags:["Settings"]}),getForgeDoctor:e.query({queryFn:()=>re(Qc),providesTags:["Doctor"]}),applyForgeDoctorFixes:e.mutation({queryFn:t=>re(()=>Yc(t)),invalidatesTags:["Doctor","Settings"]}),listWorkbenchFlows:e.query({queryFn:()=>re(()=>Zc()),providesTags:["WorkbenchFlows"]}),getWorkbenchFlow:e.query({queryFn:t=>re(()=>ed(t)),providesTags:(t,a,n)=>[{type:"WorkbenchFlow",id:n},"WorkbenchFlows"]}),getWorkbenchFlowRun:e.query({queryFn:({flowId:t,runId:a})=>re(()=>rd(t,a)),providesTags:(t,a,{flowId:n})=>[{type:"WorkbenchFlow",id:n}]}),getWorkbenchFlowRunNodes:e.query({queryFn:({flowId:t,runId:a})=>re(()=>id(t,a)),providesTags:(t,a,{flowId:n})=>[{type:"WorkbenchFlow",id:n}]}),getWorkbenchFlowRunNode:e.query({queryFn:({flowId:t,runId:a,nodeId:n})=>re(()=>od(t,a,n)),providesTags:(t,a,{flowId:n})=>[{type:"WorkbenchFlow",id:n}]}),getWorkbenchFlowNodeOutput:e.query({queryFn:({flowId:t,nodeId:a})=>re(()=>ld(t,a)),providesTags:(t,a,{flowId:n})=>[{type:"WorkbenchFlow",id:n}]}),getSnapshot:e.query({queryFn:t=>re(()=>qc(t)),providesTags:["Snapshot"]}),getXpMetrics:e.query({queryFn:t=>re(()=>ud(t)),providesTags:["Gamification"]}),markGamificationCelebrationSeen:e.mutation({queryFn:t=>re(()=>md(t)),invalidatesTags:["Gamification"]}),revokeOperatorSession:e.mutation({queryFn:()=>re(Wc),invalidatesTags:["OperatorSession","Settings","Snapshot","Gamification"]}),listWikiIngestJobs:e.query({queryFn:()=>re(()=>Xc()),providesTags:["WikiIngestJobs"]}),createTask:e.mutation({queryFn:t=>re(()=>bd(t)),invalidatesTags:["Snapshot"]}),createGoal:e.mutation({queryFn:t=>re(()=>ao(t)),invalidatesTags:["Snapshot"]}),createProject:e.mutation({queryFn:t=>re(()=>no(t)),invalidatesTags:["Snapshot"]}),patchGoal:e.mutation({queryFn:({goalId:t,patch:a})=>re(()=>xd(t,a)),invalidatesTags:["Snapshot"]}),patchProject:e.mutation({queryFn:({projectId:t,patch:a})=>re(()=>yd(t,a)),invalidatesTags:["Snapshot"]}),patchTask:e.mutation({queryFn:({taskId:t,patch:a})=>re(()=>Hr(t,a)),invalidatesTags:["Snapshot"]}),patchTaskStatus:e.mutation({queryFn:({taskId:t,status:a,completedAt:n,enforceTodayWorkLog:r,completedTodayWorkSeconds:o})=>re(()=>Hr(t,{status:a,completedAt:n,enforceTodayWorkLog:r,completedTodayWorkSeconds:o})),invalidatesTags:["Snapshot"]}),claimTaskRun:e.mutation({queryFn:({taskId:t,input:a})=>re(()=>kd(t,a)),invalidatesTags:["Snapshot"]}),heartbeatTaskRun:e.mutation({queryFn:({runId:t,input:a})=>re(()=>Nd(t,a)),invalidatesTags:["Snapshot"]}),focusTaskRun:e.mutation({queryFn:t=>re(()=>Pd(t)),invalidatesTags:["Snapshot"]}),releaseTaskRun:e.mutation({queryFn:({runId:t,input:a})=>re(()=>Id(t,a)),invalidatesTags:["Snapshot"]}),completeTaskRun:e.mutation({queryFn:({runId:t,input:a})=>re(()=>Td(t,a)),invalidatesTags:["Snapshot"]}),getSleepView:e.query({queryFn:t=>re(()=>cd(t)),providesTags:["Sleep"]}),getPsycheValues:e.query({queryFn:t=>re(()=>Bc(t)),providesTags:["Psyche"]}),getBehaviorPatterns:e.query({queryFn:t=>re(()=>Kc(t)),providesTags:["Psyche"]}),getBehaviors:e.query({queryFn:t=>re(()=>Hc(t)),providesTags:["Psyche"]}),getBeliefs:e.query({queryFn:t=>re(()=>Uc(t)),providesTags:["Psyche"]}),getTriggerReports:e.query({queryFn:t=>re(()=>Gc(t)),providesTags:["Psyche"]}),patchSleepSession:e.mutation({queryFn:({sleepId:t,patch:a})=>re(()=>dd(t,a)),invalidatesTags:["Sleep"]}),updateWorkbenchFlow:e.mutation({queryFn:({flowId:t,patch:a})=>re(()=>td(t,a)),invalidatesTags:(t,a,{flowId:n})=>[{type:"WorkbenchFlow",id:n},"WorkbenchFlows"]}),deleteWorkbenchFlow:e.mutation({queryFn:t=>re(()=>sd(t)),invalidatesTags:(t,a,n)=>[{type:"WorkbenchFlow",id:n},"WorkbenchFlows"]}),runWorkbenchFlow:e.mutation({queryFn:({flowId:t,input:a})=>re(()=>ad(t,a)),invalidatesTags:(t,a,{flowId:n})=>[{type:"WorkbenchFlow",id:n}]}),chatWorkbenchFlow:e.mutation({queryFn:({flowId:t,input:a})=>re(()=>nd(t,a)),invalidatesTags:(t,a,{flowId:n})=>[{type:"WorkbenchFlow",id:n}]})})}),{useClaimTaskRunMutation:pm,useCompleteTaskRunMutation:hm,useCreateGoalMutation:gm,useCreateProjectMutation:fm,useCreateTaskMutation:ym,useFocusTaskRunMutation:xm,useGetForgeDoctorQuery:Hw,useGetOperatorSessionQuery:bm,useGetXpMetricsQuery:vm,useGetSettingsQuery:wm,useGetSnapshotQuery:km,useGetWorkbenchFlowQuery:Uw,useGetWorkbenchFlowRunNodeQuery:Gw,useGetWorkbenchFlowRunNodesQuery:Vw,useListWikiIngestJobsQuery:jm,useHeartbeatTaskRunMutation:Sm,useChatWorkbenchFlowMutation:Jw,useDeleteWorkbenchFlowMutation:Xw,usePatchGoalMutation:Nm,usePatchProjectMutation:Pm,usePatchTaskMutation:Tm,usePatchTaskStatusMutation:Im,useReleaseTaskRunMutation:Cm,useMarkGamificationCelebrationSeenMutation:Rm,useApplyForgeDoctorFixesMutation:Qw,useRevokeOperatorSessionMutation:Yw,useRunWorkbenchFlowMutation:Zw,useUpdateWorkbenchFlowMutation:ek}=Ct,bo="forge.selected-user-ids";function _m(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(bo);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.filter(a=>typeof a=="string").map(a=>a.trim()).filter(Boolean):[]}catch{return[]}}function Em(e){if(!(typeof window>"u"))try{window.localStorage.setItem(bo,JSON.stringify(Array.from(new Set(e))))}catch{return}}const Am={collapseProgress:0,selectedUserIds:_m(),displayedRouteKey:"",pendingRouteKey:null,pendingRouteStatus:"idle",routeReadyToCommit:!1,knowledgeGraphOverlayFocus:null},vo=Wi({name:"shell",initialState:Am,reducers:{hydrateSelectedUserIds(e,t){e.selectedUserIds=t.payload},setSelectedUserIds(e,t){e.selectedUserIds=t.payload},setCollapseProgress(e,t){e.collapseProgress=t.payload},syncDisplayedRouteKey(e,t){e.displayedRouteKey=t.payload,e.pendingRouteKey=null,e.pendingRouteStatus="idle",e.routeReadyToCommit=!1},beginRouteHandoff(e,t){if(e.displayedRouteKey===t.payload){e.pendingRouteKey=null,e.pendingRouteStatus="idle",e.routeReadyToCommit=!1;return}e.pendingRouteKey=t.payload,e.pendingRouteStatus="loading",e.routeReadyToCommit=!1},setPendingRouteStatus(e,t){e.pendingRouteStatus=t.payload},setRouteReadyToCommit(e,t){e.routeReadyToCommit=t.payload},commitPendingRoute(e){e.pendingRouteKey&&(e.displayedRouteKey=e.pendingRouteKey,e.pendingRouteKey=null,e.pendingRouteStatus="idle",e.routeReadyToCommit=!1)},cancelPendingRoute(e){e.pendingRouteKey=null,e.pendingRouteStatus="idle",e.routeReadyToCommit=!1},setKnowledgeGraphOverlayFocus(e,t){e.knowledgeGraphOverlayFocus=t.payload},clearKnowledgeGraphOverlayFocus(e){e.knowledgeGraphOverlayFocus=null}}}),{beginRouteHandoff:Om,cancelPendingRoute:tk,clearKnowledgeGraphOverlayFocus:oi,commitPendingRoute:Lm,hydrateSelectedUserIds:Dm,setKnowledgeGraphOverlayFocus:sk,setCollapseProgress:$m,setPendingRouteStatus:ak,setRouteReadyToCommit:nk,setSelectedUserIds:Pa,syncDisplayedRouteKey:Mm}=vo.actions,Fm=vo.reducer,wo=ql();wo.startListening({matcher:Bl(Dm,Pa),effect:async e=>{Array.isArray(e.payload)&&Em(e.payload.filter(t=>typeof t=="string"))}});const zm="knowledge_graph",Wm=220,qm=24,li=.45,Bm=.8;function nt(e,t=4){const a=10**t;return Math.round(e*a)/a}function oa(e){return Math.hypot(e.x,e.y)}function rk(){return!1}function ik(e){let t=0,a=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY;for(const i of e)t+=1,a=Math.min(a,i.x),n=Math.max(n,i.x),r=Math.min(r,i.y),o=Math.max(o,i.y);return t===0?{x:0,y:0}:{x:nt((a+n)/2),y:nt((r+o)/2)}}function Km(e){let t=0,a=0,n=0;for(const r of e)t+=1,a+=r.x,n+=r.y;return t===0?{x:0,y:0}:{x:nt(a/t),y:nt(n/t)}}function ok(e){const t=Km(e);return{changed:Math.abs(t.x)>=1e-4||Math.abs(t.y)>=1e-4,offset:t,positions:e.map(n=>({x:nt(n.x-t.x),y:nt(n.y-t.y)}))}}function lk({centroid:e,boundsCenter:t,camera:a}){return{centroidDistanceFromOrigin:nt(oa(e)),boundsCenterDistanceFromOrigin:nt(oa(t)),cameraDistanceFromOrigin:nt(oa({x:a.x,y:a.y})),cameraToCentroidDistance:nt(Math.hypot(a.x-e.x,a.y-e.y))}}function ck(e){return e.centroidDistanceFromOrigin<=li&&e.cameraDistanceFromOrigin<=li&&e.cameraToCentroidDistance<=Bm}function dk(e="/knowledge-graph"){const t=Vi({scope:zm,route:e,source:"ui"});return async({level:a,eventKey:n,message:r,functionName:o,details:i,entityType:l,entityId:u})=>t({level:a,eventKey:n,message:r,functionName:o??null,details:i,entityType:l??null,entityId:u??null})}const Hm={panelOpen:!1,latestStatus:null,recentEvents:[],recentSnapshots:[]};function ci(e,t,a){const n=[t,...e];return n.length<=a?n:n.slice(0,a)}const ko=Wi({name:"knowledgeGraphDiagnostics",initialState:Hm,reducers:{setKnowledgeGraphDiagnosticsPanelOpen(e,t){e.panelOpen=t.payload},setKnowledgeGraphDiagnosticsStatus(e,t){e.latestStatus=t.payload},recordKnowledgeGraphDiagnosticsEvent(e,t){e.recentEvents=ci(e.recentEvents,t.payload,Wm)},recordKnowledgeGraphDiagnosticsSnapshot(e,t){e.recentSnapshots=ci(e.recentSnapshots,t.payload,qm)},resetKnowledgeGraphDiagnostics(e){e.latestStatus=null,e.recentEvents=[],e.recentSnapshots=[],e.panelOpen=!1}}}),{recordKnowledgeGraphDiagnosticsEvent:uk,recordKnowledgeGraphDiagnosticsSnapshot:mk,resetKnowledgeGraphDiagnostics:pk,setKnowledgeGraphDiagnosticsPanelOpen:hk,setKnowledgeGraphDiagnosticsStatus:gk}=ko.actions,Um=ko.reducer,Gm=wl({shell:Fm,knowledgeGraphDiagnostics:Um,[Ct.reducerPath]:Ct.reducer});function Vm(){const e=Kl({reducer:Gm,middleware:t=>t({serializableCheck:!1}).concat(wo.middleware,Ct.middleware)});return Hl(e.dispatch),e}const tn=Vm();function Jm(){const e=ms();c.useEffect(()=>{const t=new EventSource(za("/api/v1/events/stream")),a=()=>{tn.dispatch(Ct.util.invalidateTags(["OperatorSession","Settings","Snapshot","Gamification","Sleep","Psyche","WikiIngestJobs"])),Promise.all([e.invalidateQueries({queryKey:["forge-snapshot"]}),e.invalidateQueries({queryKey:["task-context"]})])};return t.addEventListener("snapshot",a),t.addEventListener("activity",a),t.onerror=()=>{t.close()},()=>{t.removeEventListener("snapshot",a),t.removeEventListener("activity",a),t.close()}},[e])}const Xm=[{id:"goals",label:"Goals",kinds:["goal"]},{id:"strategies",label:"Strategies",kinds:["strategy"]},{id:"projects",label:"Projects",kinds:["project"]},{id:"tasks",label:"Tasks",kinds:["task"]},{id:"wiki-spaces",label:"Wiki Spaces",kinds:["wiki_space"]},{id:"knowledge",label:"Wiki Pages / Notes",kinds:["wiki_page","note"]},{id:"support",label:"Habits / Insights / Tags",kinds:["habit","insight","tag"]},{id:"calendar",label:"Calendar",kinds:["calendar_event","work_block","timebox"]},{id:"values",label:"Values",kinds:["value"]},{id:"patterns",label:"Patterns",kinds:["pattern"]},{id:"behaviors",label:"Behaviors",kinds:["behavior"]},{id:"beliefs",label:"Beliefs",kinds:["belief"]},{id:"modes",label:"Modes / Mode Sessions",kinds:["mode","mode_session"]},{id:"flashcards",label:"Flashcards",kinds:["flashcard"]},{id:"reports",label:"Reports / Event Types / Emotions",kinds:["report","event_type","emotion"]},{id:"workbench",label:"Workbench / Functors / Chats",kinds:["workbench","functor","chat"]}],fk=Xm.flatMap(e=>[...e.kinds]),yk={goal_project:"Goal to project",goal_task:"Goal to task",project_task:"Project to task",tag_goal:"Tag to goal",tag_task:"Tag to task",tag_strategy:"Tag to strategy",value_goal:"Value to goal",value_project:"Value to project",value_task:"Value to task",strategy_target:"Strategy target",strategy_step:"Strategy step",strategy_link:"Strategy context",habit_link:"Habit link",note_link:"Note link",wiki_parent:"Wiki parent",wiki_link:"Wiki link",calendar_link:"Calendar link",timebox_task:"Timebox to task",timebox_project:"Timebox to project",pattern_value:"Pattern to value",pattern_belief:"Pattern to belief",pattern_mode:"Pattern to mode",behavior_pattern:"Behavior to pattern",behavior_value:"Behavior to value",behavior_belief:"Behavior to belief",behavior_mode:"Behavior to mode",belief_value:"Belief to value",belief_behavior:"Belief to behavior",belief_mode:"Belief to mode",belief_report:"Belief to report",mode_pattern:"Mode to pattern",mode_behavior:"Mode to behavior",mode_value:"Mode to value",flashcard_value:"Flashcard to value",flashcard_behavior:"Flashcard to behavior",flashcard_pattern:"Flashcard to pattern",flashcard_belief:"Flashcard to belief",flashcard_mode:"Flashcard to mode",flashcard_report:"Flashcard to report",report_value:"Report to value",report_pattern:"Report to pattern",report_goal:"Report to goal",report_project:"Report to project",report_task:"Report to task",report_behavior:"Report to behavior",report_belief:"Report to belief",report_mode:"Report to mode",report_event_type:"Report to event type",report_emotion:"Report to emotion",mode_session_mode:"Mode session to mode",workbench_flow:"Workbench flow",workbench_surface:"Workbench surface",workbench_route:"Workbench route"},xk={structural:"Structure",contextual:"Context",taxonomy:"Taxonomy",workspace:"Workspace"};function bk(e,t){return`${e}:${t}`}function vk(e){if(!e)return null;const t=e.indexOf(":");return t<=0||t>=e.length-1?null:{entityType:e.slice(0,t),entityId:e.slice(t+1)}}function jo(e,t){return`${e}:${t}`}function wk(e,t,a){var o;const n=new URLSearchParams;n.set("focus",jo(e,t)),a!=null&&a.view&&a.view!=="graph"&&n.set("view",a.view),(o=a==null?void 0:a.query)!=null&&o.trim()&&n.set("q",a.query.trim());for(const i of(a==null?void 0:a.kinds)??[])n.append("kind",i);for(const i of(a==null?void 0:a.relations)??[])n.append("relation",i);const r=n.toString();return r.length>0?`/knowledge-graph?${r}`:"/knowledge-graph"}const So=[{key:"deep_work",label:"Deep work",description:"High-focus work, coding, writing, studying, or mentally demanding work.",defaultRateApPerHour:14},{key:"admin",label:"Admin",description:"Email, coordination, planning, logistics, and fragmented office work.",defaultRateApPerHour:9},{key:"maintenance",label:"Maintenance",description:"Light chores, errands, upkeep, and low-friction background work.",defaultRateApPerHour:6},{key:"meeting",label:"Meeting",description:"Busy social or collaborative commitments with real cognitive and social load.",defaultRateApPerHour:13},{key:"recovery_break",label:"Rest",description:"Lunch, recovery, and decompression are still activities, just lighter ones.",defaultRateApPerHour:3},{key:"holiday_leisure",label:"Holiday",description:"Leisure, outings, or all-day holiday context that still consumes throughput.",defaultRateApPerHour:4},{key:"light_context",label:"Light context",description:"Visible low-friction context that still occupies a little capacity.",defaultRateApPerHour:2},{key:"task_inherited",label:"Task default",description:"Use the task's own Action Point profile for this timebox.",defaultRateApPerHour:100/24}];function No(e,t,a){return Math.min(a,Math.max(t,e))}function ys(e,t){return Math.max(0,Math.floor((Date.parse(t)-Date.parse(e))/1e3))}function Ut(e,t){const a=t/3600*e;return{rateApPerHour:Number(e.toFixed(2)),totalAp:Number(a.toFixed(2))}}function sn(e){return(e==null?void 0:e.sustainRateApPerHour)??null}function Po(e){var t;return((t=So.find(a=>a.key===e))==null?void 0:t.defaultRateApPerHour)??null}function To(e){var t;return typeof((t=e==null?void 0:e.metadata)==null?void 0:t.activityPresetKey)=="string"?e.metadata.activityPresetKey:null}function Qm(e){var t;return typeof((t=e==null?void 0:e.metadata)==null?void 0:t.customSustainRateApPerHour)=="number"?e.metadata.customSustainRateApPerHour:null}function kk(){return So}function jk(e){return To(e)}function Sk(e){return Qm(e)}function Io(e,t){return typeof e!="number"||!Number.isFinite(e)?`0 ${t}`:`${Number(e.toFixed(1))} ${t}`}function Nk(e){return Io(e,"AP")}function Ym(e){return Io(e,"AP/h")}function Pk(e){const t=sn(e.actionProfile)??4.166666666666667;return Ut(t,ys(e.startsAt,e.endsAt))}function Co(e){return e==="main_activity"?14:e==="secondary_activity"?9:e==="third_activity"||e==="custom"?6:e==="holiday"?4:3}function Tk(e){const t=sn(e.actionProfile)??Co(e.kind);return Ut(t,ys(e.startAt,e.endAt))}function Ik(e){const t="2026-01-01T00:00:00.000Z",a=new Date(t);a.setUTCMinutes(e.startMinute,0,0);const n=new Date(t);n.setUTCMinutes(e.endMinute,0,0),n<=a&&n.setUTCDate(n.getUTCDate()+1);const r=e.customSustainRateApPerHour??Po(e.activityPresetKey)??Co(e.kind);return Ut(r,ys(a.toISOString(),n.toISOString()))}function Zm(e){const t=`${e.title} ${e.eventType??""}`.toLowerCase();return t.includes("lunch")||t.includes("break")||t.includes("rest")?3:t.includes("holiday")||t.includes("vacation")?4:t.includes("meeting")||t.includes("call")||t.includes("interview")?13:t.includes("deep work")||t.includes("focus")?14:t.includes("admin")||t.includes("email")||t.includes("inbox")?9:e.availability==="busy"?12:2}function Ck(e){const t=e.customSustainRateApPerHour??sn(e.actionProfile)??Po(e.activityPresetKey??To(e.actionProfile))??Zm(e);return Ut(t,ys(e.startAt,e.endAt))}function Rk(e){const t=No((e.expectedMet??2)*4,4,22);return Ut(t,ys(e.startedAt,e.endedAt))}function _k(e){return{totalAp:3,rateApPerHour:0}}function Ek(e){if(!e.generatedHealthEventTemplate.enabled)return null;const t=No(e.generatedHealthEventTemplate.durationMinutes||0,0,1440);return t<=0?null:Ut(24,t*60)}function Ak(e){return{totalAp:1,rateApPerHour:0}}const ep={ap:"Action Points estimate remaining usable capacity today from the Life Force model. They combine baseline capacity, current drains, and scheduled recovery.","instant-ap":"Instant AP per hour estimates the headroom Forge thinks you have right now. Positive values mean the current moment can absorb more work; low or negative values suggest recovery or lighter work.",streak:"The streak counts qualifying Forge activity days. It is a consistency signal, not a moral score.",xp:"XP comes from the auditable reward ledger. It summarizes completed work and meaningful captured evidence across Forge.",momentum:"Momentum combines recent XP, task movement, habit evidence, and streak context into a quick operating signal for the selected user scope."},di={title:"Forge surface",purpose:"This view is part of the Forge operating system. It keeps the current user scope, active work timer, search, creation tools, and navigation available while the page focuses on one domain.",primaryAction:"Use the page title, nearby chips, and visible action buttons to decide whether you are reviewing evidence, planning work, or executing the next task.",metricNote:"Numbers in Forge are decision-support signals. Open the local tooltips on metric labels to see exactly what each one means."},ui={overview:{title:"Overview",purpose:"Overview is the daily command page. It combines momentum, Life Force, active goals, active projects, top tasks, health context, and recent evidence into one scan.",primaryAction:"Start here when you need to choose what matters next. Open the top task, inspect the body-signal block, or jump into Today when the next move is unclear.",metricNote:"Momentum, AP, XP, and streak are summary signals. They are meant to point attention, not replace judgement."},"life-force":{title:"Life Force",purpose:"Life Force models daily Action Point capacity, current drains, recovery, and the editable weekly capacity curve.",primaryAction:"Use it to understand whether the next work block should be heavy, light, or delayed until recovery improves.",metricNote:"AP and AP/hour are local planning units. They are not medical or physiological measurements."},goals:{title:"Goals",purpose:"Goals describe long-range direction and keep projects, tasks, habits, and evidence connected to something larger.",primaryAction:"Review goal progress, open a goal detail page, and check whether current projects still point at the right horizon."},habits:{title:"Habits",purpose:"Habits track recurring commitments, check-ins, streak evidence, and reward signals.",primaryAction:"Use this view to check in, inspect habit drift, and decide which routines need adjustment."},projects:{title:"Projects",purpose:"Projects are PRD-backed initiatives that connect goals, strategies, issues, tasks, ownership, and delivery state.",primaryAction:"Open project detail for PRD context, or switch to hierarchy when you need the full goal-to-task chain."},strategies:{title:"Strategies",purpose:"Strategies capture the reasoning layer between goals and execution. They explain why the work is arranged this way.",primaryAction:"Use this view to inspect strategy graphs and check whether active work still follows the intended plan."},preferences:{title:"Preferences",purpose:"Preferences store pairwise judgments, profiles, and model state that help Forge and agents understand taste and priorities.",primaryAction:"Use it when Forge needs clearer ranking signals or when agent recommendations feel misaligned."},calendar:{title:"Calendar",purpose:"Calendar turns planning into timeboxes and provider-backed scheduled commitments.",primaryAction:"Use it to inspect the week, move timeboxes, and keep commitments visible next to execution work."},"knowledge-graph":{title:"Knowledge Graph",purpose:"Knowledge Graph shows Forge entities and links as a living map so goals, tasks, notes, wiki pages, Psyche records, and evidence do not stay isolated.",primaryAction:"Search or focus a node when you need context around an entity before editing or executing work."},workbench:{title:"Workbench",purpose:"Workbench organizes graph flows, AI tools, published outputs, and reusable operations.",primaryAction:"Open a flow when you need a structured tool process instead of a normal page action."},movement:{title:"Movement",purpose:"Movement explains trips, stays, places, and location-derived context from the companion sync.",primaryAction:"Use it to understand where time went, verify movement import quality, and connect place context to daily planning."},sleep:{title:"Sleep",purpose:"Sleep presents canonical nights, recovery context, and raw segment evidence without making transport fragments the main product object.",primaryAction:"Use it to check whether today should be a heavy training/work day or a recovery-biased day."},sports:{title:"Sports",purpose:"Sports is the workout cockpit: sessions, routes, preserved HealthKit evidence, friendly activity names, and per-workout drill-down.",primaryAction:"Open a workout when you need the evidence behind a training-load or heart-rate conclusion."},"training-load":{title:"Training Load",purpose:"Training Load estimates cardiovascular stress from workouts, heart-rate timelines, adaptive HRR zones, and recent vitals.",primaryAction:"Use it to decide whether the next block should build aerobic base, hold load, sharpen intensity, or recover.",metricNote:"ACWR, strain, HR zones, and VO2max are coaching signals. They are not clinical diagnosis and should be interpreted with session context."},vitals:{title:"Vitals",purpose:"Vitals gathers body signals such as resting heart rate, HRV, VO2max, breathing, and body metrics.",primaryAction:"Use it to inspect recovery trends and confirm whether a single number is stable or just a sparse reading."},kanban:{title:"Kanban",purpose:"Kanban is the execution board for active work items and lane movement.",primaryAction:"Move work deliberately between backlog, focus, in progress, blocked, and done. Open task detail for execution notes."},today:{title:"Today",purpose:"Today narrows Forge to immediate commitments, planned work, due habits, and the next meaningful actions.",primaryAction:"Use it when the system feels too broad and you need a single practical runway."},rewards:{title:"Trophy Hall",purpose:"Trophy Hall explains XP, levels, streaks, achievements, cosmetic unlocks, and the Forge Smith state from the reward ledger.",primaryAction:"Use it to understand what behavior earned rewards and what current next targets mean."},notes:{title:"Notes",purpose:"Notes store evidence, thoughts, linked context, and local memory that can attach to Forge entities.",primaryAction:"Capture raw context here, then link it to goals, projects, tasks, Psyche records, or wiki pages."},wiki:{title:"KarpaWiki",purpose:"KarpaWiki is the durable knowledge surface for authored pages, imported material, links, summaries, and entity memory.",primaryAction:"Search before creating, then write or ingest when the knowledge should become reusable."},psyche:{title:"Psyche",purpose:"Psyche tracks values, modes, behaviors, beliefs, patterns, reports, questionnaires, and flashcards as reflective records.",primaryAction:"Use it to turn mental-state evidence into structured reminders, behavior maps, and reviewable reports."},activity:{title:"Activity",purpose:"Activity is the event log for work, imports, edits, agent actions, and recent system evidence.",primaryAction:"Use it to audit what changed and jump back to the entity that produced the evidence."},insights:{title:"Insights",purpose:"Insights stores recommendations and realizations that may need to become real Forge records.",primaryAction:"Review each insight, then apply, link, or dismiss it so it does not remain vague advice."},review:{title:"Weekly Review",purpose:"Weekly Review turns recent evidence into a closeout: wins, calibration, unfinished loops, and next-week direction.",primaryAction:"Use it at the end of a week to convert activity into decisions and written memory."},settings:{title:"Settings",purpose:"Settings controls runtime configuration, data tools, users, agents, mobile pairing, models, rewards, logs, and recovery surfaces.",primaryAction:"Use it for configuration or maintenance. Avoid changing data paths unless you explicitly intend a storage migration."}};function tp(e){if(!e)return di;const t=e.split(":")[0]??e;return ui[e]??ui[t]??di}const sp=[{id:"sleep",matches:e=>e==="/sleep"||e.startsWith("/sleep/"),isReady:e=>e.bootstrapReady&&e.sleepReady}];function ap(e){return sp.find(t=>t.matches(e))??null}function np(e,t){if(!t.bootstrapReady)return!1;const a=ap(e);return a?a.isReady(t):!0}const an=e=>e.shell,rp=Bs(an,e=>e.selectedUserIds),ip=Bs(an,e=>e.collapseProgress);Bs(an,e=>({displayedRouteKey:e.displayedRouteKey,pendingRouteKey:e.pendingRouteKey,pendingRouteStatus:e.pendingRouteStatus,routeReadyToCommit:e.routeReadyToCommit}));const Ro=Bs(e=>e[Ct.reducerPath],e=>{const t=Object.values(e.queries).filter(n=>(n==null?void 0:n.status)==="pending").length,a=Object.values(e.mutations).filter(n=>(n==null?void 0:n.status)==="pending").length;return t+a});function op({backgroundActivityOpen:e,fetchingCount:t,mutatingCount:a,t:n}){var h;const r=jm(void 0,{pollingInterval:e?2e3:15e3,refetchOnFocus:!0,refetchOnReconnect:!0}),o=((h=r.data)==null?void 0:h.jobs)??[],i=o.some(m=>["queued","processing"].includes(m.job.status)),l=c.useMemo(()=>o.filter(m=>["queued","processing"].includes(m.job.status)),[o]);return{activityLabel:c.useMemo(()=>{if(l.length>0){if(l.length===1){const m=l[0];return(m==null?void 0:m.job.latestMessage)||(m==null?void 0:m.job.titleHint)||"1 ingest running"}return`${l.length} ingest jobs running`}return a>0?n(a===1?"common.shell.savingOne":"common.shell.savingOther",{count:a}):t>0?n(t===1?"common.shell.refreshingOne":"common.shell.refreshingOther",{count:t}):n("common.shell.settled")},[l,t,a,n]),hasActiveIngestJobs:i,ingestJobsQuery:r,recentIngestJobs:o}}function lp(e,t,a){return Math.min(Math.max(e,t),a)}function be(e,t,a){return t+(a-t)*e}function cp(e,t){e&&(e.style.setProperty("--forge-shell-collapse",t.toFixed(4)),e.style.setProperty("--forge-shell-desktop-header-padding-top",`${be(t,18,4)}px`),e.style.setProperty("--forge-shell-desktop-header-padding-bottom",`${be(t,15,4)}px`),e.style.setProperty("--forge-shell-desktop-title-size",`${be(t,1.42,.96)}rem`),e.style.setProperty("--forge-shell-desktop-primary-translate-y",`${be(t,0,2)}px`),e.style.setProperty("--forge-shell-desktop-primary-scale",`${be(t,1,.98)}`),e.style.setProperty("--forge-shell-desktop-secondary-opacity",`${be(t,1,0)}`),e.style.setProperty("--forge-shell-desktop-secondary-max-height",`${be(t,176,0)}px`),e.style.setProperty("--forge-shell-desktop-secondary-spacing",`${be(t,14,0)}px`),e.style.setProperty("--forge-shell-desktop-secondary-translate-y",`${be(t,0,-18)}px`),e.style.setProperty("--forge-shell-mobile-header-padding-top",`${be(t,14,4)}px`),e.style.setProperty("--forge-shell-mobile-header-padding-bottom",`${be(t,12,4)}px`),e.style.setProperty("--forge-shell-mobile-title-size",`${be(t,1.2,.9)}rem`),e.style.setProperty("--forge-shell-mobile-primary-translate-y",`${be(t,0,1)}px`),e.style.setProperty("--forge-shell-mobile-primary-scale",`${be(t,1,.98)}`),e.style.setProperty("--forge-shell-mobile-copy-opacity",`${be(t,1,0)}`),e.style.setProperty("--forge-shell-mobile-copy-max-height",`${be(t,320,0)}px`),e.style.setProperty("--forge-shell-mobile-copy-translate-y",`${be(t,0,-14)}px`),e.style.setProperty("--forge-shell-hero-padding-top",`${be(t,20,15)}px`),e.style.setProperty("--forge-shell-hero-padding-bottom",`${be(t,20,14)}px`),e.style.setProperty("--forge-shell-hero-title-translate-y",`${be(t,0,-6)}px`),e.style.setProperty("--forge-shell-hero-title-scale",`${be(t,1,.94)}`),e.style.setProperty("--forge-shell-hero-description-opacity",`${be(t,1,.45)}`),e.style.setProperty("--forge-shell-hero-description-translate-y",`${be(t,0,-5)}px`))}function dp(){var e,t,a;return typeof window>"u"?0:Math.max(window.scrollY||0,((e=document.scrollingElement)==null?void 0:e.scrollTop)||0,((t=document.documentElement)==null?void 0:t.scrollTop)||0,((a=document.body)==null?void 0:a.scrollTop)||0)}const nn=()=>Ul(),rs=Gl;function up(e){const t=nn(),a=rs(ip),n=c.useRef(a);c.useEffect(()=>{n.current=a},[a]),c.useEffect(()=>{const r=()=>{const o=window.innerWidth>=1024?124:96,i=document.scrollingElement??document.documentElement??document.body,u=Math.max(0,i.scrollHeight-window.innerHeight)<o?0:lp(dp()/o,0,1);Math.abs(n.current-u)<.001||t($m(u))};return r(),window.addEventListener("scroll",r,{passive:!0}),window.addEventListener("resize",r),()=>{window.removeEventListener("scroll",r),window.removeEventListener("resize",r)}},[t]),c.useEffect(()=>{cp(e.current,a)},[a,e])}function mp({routePathKey:e,routerLocation:t,outlet:a,routerLocationContext:n,optimisticLocation:r,optimisticRoutePathKey:o,destinationLoadingNode:i}){const l=nn(),u=c.useRef(e),[h,m]=c.useState(e),g=o??e,f=r??t,x=o!==null||h!==e;c.useEffect(()=>{if(o!==null||h===e)return;const p=window.setTimeout(()=>{m(e)},120);return()=>{window.clearTimeout(p)}},[o,h,e]);const y={key:g,node:x?i:a,location:f};c.useEffect(()=>{u.current!==e&&(l(Om(e)),l(Lm()),u.current=e),l(Mm(e))},[l,e]);const R=n?{...n,location:y.location}:null;return{displayedRoute:y,displayedLocationContext:R,pendingRoute:null,visibleLocation:f}}function pp(e){const t=c.useRef(`forge_session_${Math.random().toString(36).slice(2,10)}`);c.useEffect(()=>{if(!e)return;let a=!1,n=!1,r=!1;const o=()=>{a=!0},i=(h,m)=>wd({sessionId:t.current,eventType:h,metrics:m}).catch(()=>{});i("session_started",{visible:document.visibilityState==="visible",interacted:!1});const l=window.setTimeout(()=>{document.visibilityState==="visible"&&a&&!n&&(n=!0,i("dwell_120_seconds",{visible:!0,interacted:!0}))},12e4),u=()=>{const h=Math.max(1,document.documentElement.scrollHeight-window.innerHeight),m=Math.round(window.scrollY/h*100);m>=75&&a&&!r&&(r=!0,i("scroll_depth_75",{visible:document.visibilityState==="visible",interacted:!0,scrollDepth:m}))};return window.addEventListener("pointerdown",o),window.addEventListener("keydown",o),window.addEventListener("scroll",u,{passive:!0}),()=>{window.clearTimeout(l),window.removeEventListener("pointerdown",o),window.removeEventListener("keydown",o),window.removeEventListener("scroll",u)}},[e])}function hp({snapshot:e,settings:t}){const[a]=Sm();c.useEffect(()=>{if(!e||!t||e.activeTaskRuns.length===0)return;const n=()=>{for(const u of e.activeTaskRuns)a({runId:u.id,input:{actor:u.actor,leaseTtlSeconds:u.leaseTtlSeconds,note:u.note}}).unwrap().catch(()=>{})},r=window.setInterval(()=>{n()},3e4),o=()=>{n()},i=()=>{n()},l=()=>{n()};return document.addEventListener("visibilitychange",o),window.addEventListener("focus",i),window.addEventListener("pagehide",l),()=>{window.clearInterval(r),document.removeEventListener("visibilitychange",o),window.removeEventListener("focus",i),window.removeEventListener("pagehide",l)}},[a,t,e])}function gp(e){c.useEffect(()=>{if(!e)return;const t=()=>{Ou(e.themePreference,e.customTheme??null)};if(t(),e.themePreference!=="system"||typeof window>"u"||typeof window.matchMedia!="function")return;const a=window.matchMedia("(prefers-color-scheme: dark)"),n=()=>t();return typeof a.addEventListener=="function"?(a.addEventListener("change",n),()=>a.removeEventListener("change",n)):(a.addListener(n),()=>a.removeListener(n))},[e])}async function fp(e,t=[]){tn.dispatch(Ct.util.invalidateTags(["Snapshot","Gamification"])),await Promise.all([e.invalidateQueries({queryKey:["forge-snapshot"]}),...t.map(a=>e.invalidateQueries({queryKey:a}))])}function He({className:e}){return s.jsx("div",{className:P("surface-pulse rounded-2xl bg-white/[0.05]",e)})}function yp({header:e=!0,sideRail:t=!0,className:a,eyebrow:n,title:r,description:o,columns:i=2,blocks:l=4}){const u=Array.from({length:Math.max(2,l)});return s.jsxs("div",{className:P("grid gap-5",a),"aria-hidden":"true",children:[e?s.jsxs(lt,{className:"grid gap-4",children:[s.jsx(He,{className:P("h-3",n?"w-40":"w-32")}),s.jsx(He,{className:P("h-12",r?"max-w-2xl":"max-w-3xl")}),s.jsx(He,{className:P("h-5",o?"max-w-3xl":"max-w-2xl")})]}):null,s.jsxs("section",{className:P("grid gap-5",t?"xl:grid-cols-[minmax(0,1.15fr)_minmax(0,0.85fr)]":""),children:[s.jsxs("div",{className:"grid gap-5",children:[s.jsxs(lt,{className:"grid gap-4",children:[s.jsx(He,{className:"h-3 w-28"}),s.jsx(He,{className:"h-28 w-full"})]}),s.jsxs(lt,{className:"grid gap-4",children:[s.jsx(He,{className:"h-3 w-40"}),s.jsx("div",{className:P("grid gap-3",i>1?"md:grid-cols-2":""),children:u.map((h,m)=>s.jsx(He,{className:"h-28 w-full"},m))})]})]}),t?s.jsxs("div",{className:"grid gap-5",children:[s.jsxs(lt,{className:"grid gap-4",children:[s.jsx(He,{className:"h-3 w-24"}),s.jsx(He,{className:"h-20 w-full"})]}),s.jsxs(lt,{className:"grid gap-4",children:[s.jsx(He,{className:"h-3 w-36"}),s.jsx(He,{className:"h-16 w-full"}),s.jsx(He,{className:"h-16 w-full"})]})]}):null]})]})}function xp({children:e}){return s.jsx(s.Fragment,{children:e})}const _o={overview:{surfaceId:"overview",title:"Overview",description:"Daily signal, momentum, and current Forge state.",tone:"core",skeleton:{blocks:5,columns:3,sideRail:!0}},"life-force-index":{surfaceId:"life-force-index",title:"Life Force",description:"Action Point capacity, weekday curves, and dynamic drains.",tone:"core",skeleton:{blocks:5,columns:2,sideRail:!0}},"goals-index":{surfaceId:"goals-index",title:"Goals",description:"Goal planning and long-horizon direction.",tone:"execution",skeleton:{blocks:6,columns:2,sideRail:!0}},"habits-index":{surfaceId:"habits-index",title:"Habits",description:"Recurring commitments, streaks, and check-ins.",tone:"execution",skeleton:{blocks:5,columns:2,sideRail:!0}},"goal-detail":{surfaceId:"goal-detail",title:"Goal detail",description:"Goal detail, progress, and linked execution context.",tone:"execution",skeleton:{blocks:5,columns:2,sideRail:!0}},"projects-index":{surfaceId:"projects-index",title:"Projects",description:"PRD-backed projects and execution initiatives.",tone:"execution",skeleton:{blocks:6,columns:2,sideRail:!0}},"project-hierarchy":{surfaceId:"project-hierarchy",title:"Project hierarchy",description:"Full hierarchy from goals down to subtasks.",tone:"execution",skeleton:{blocks:6,columns:2,sideRail:!0}},"project-detail":{surfaceId:"project-detail",title:"Project detail",description:"Project detail, tasks, and execution health.",tone:"execution",skeleton:{blocks:5,columns:2,sideRail:!0}},"strategies-index":{surfaceId:"strategies-index",title:"Strategies",description:"Strategy graphs and long-range execution plans.",tone:"execution",skeleton:{blocks:5,columns:2,sideRail:!0}},"strategy-detail":{surfaceId:"strategy-detail",title:"Strategy detail",description:"Strategy DAG detail, targets, and progress.",tone:"execution",skeleton:{blocks:5,columns:2,sideRail:!0}},"preferences-index":{surfaceId:"preferences-index",title:"Preferences",description:"Preference profiles, pairwise judgments, and model state.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"calendar-index":{surfaceId:"calendar-index",title:"Calendar",description:"Calendar planning, timeboxes, and provider sync.",tone:"core",skeleton:{blocks:6,columns:3,sideRail:!1}},"knowledge-graph-index":{surfaceId:"knowledge-graph-index",title:"Knowledge Graph",description:"One connected map of Forge entities and relationships.",tone:"knowledge",skeleton:{blocks:4,columns:2,sideRail:!0}},"movement-index":{surfaceId:"movement-index",title:"Movement",description:"Movement traces, places, and trip evidence.",tone:"health",skeleton:{blocks:5,columns:2,sideRail:!0}},"sleep-index":{surfaceId:"sleep-index",title:"Sleep",description:"Sleep sessions, health context, and recovery trends.",tone:"health",skeleton:{blocks:5,columns:2,sideRail:!0}},"sports-index":{surfaceId:"sports-index",title:"Sports",description:"Fitness, workouts, and sports context.",tone:"health",skeleton:{blocks:6,columns:3,sideRail:!0}},"sports-workout-detail":{surfaceId:"sports-workout-detail",title:"Workout detail",description:"Raw workout evidence, heart-rate zones, and session context.",tone:"health",skeleton:{blocks:6,columns:2,sideRail:!0}},"training-load-index":{surfaceId:"training-load-index",title:"Training Load",description:"Cardiovascular load, intensity distribution, and targets.",tone:"health",skeleton:{blocks:6,columns:3,sideRail:!0}},"vitals-index":{surfaceId:"vitals-index",title:"Vitals",description:"Body signals, recovery, cardio fitness, and daily metrics.",tone:"health",skeleton:{blocks:6,columns:3,sideRail:!0}},"weight-loss-index":{surfaceId:"weight-loss-index",title:"Weight Loss",description:"Nutrition, calorie balance, body composition, gut comfort, subjective energy, aesthetic signals, and food experiments.",tone:"health",skeleton:{blocks:7,columns:3,sideRail:!0}},"psyche-index":{surfaceId:"psyche-index",title:"Psyche",description:"Values, modes, reports, and reflective context.",tone:"psyche",skeleton:{blocks:6,columns:2,sideRail:!0}},"psyche-metrics":{surfaceId:"psyche-metrics",title:"Psyche metrics",description:"Daily Psyche metric history with plots and statistics.",tone:"psyche",skeleton:{blocks:5,columns:3,sideRail:!0}},"psyche-flashcards":{surfaceId:"psyche-flashcards",title:"Psyche flashcards",description:"Therapeutic reminder cards for urges and triggers.",tone:"psyche",skeleton:{blocks:6,columns:3,sideRail:!1}},"psyche-values":{surfaceId:"psyche-values",title:"Psyche values",description:"Values and linked goal context.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"psyche-patterns":{surfaceId:"psyche-patterns",title:"Psyche patterns",description:"Behavior patterns and recurring loops.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"psyche-questionnaires":{surfaceId:"psyche-questionnaires",title:"Questionnaires",description:"Questionnaire library and recent runs.",tone:"psyche",skeleton:{blocks:6,columns:2,sideRail:!0}},"psyche-questionnaire-new":{surfaceId:"psyche-questionnaire-new",title:"New questionnaire",description:"Questionnaire builder workspace.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!1}},"psyche-questionnaire-detail":{surfaceId:"psyche-questionnaire-detail",title:"Questionnaire detail",description:"Questionnaire detail and scores.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"psyche-questionnaire-edit":{surfaceId:"psyche-questionnaire-edit",title:"Edit questionnaire",description:"Questionnaire builder workspace.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!1}},"psyche-questionnaire-run":{surfaceId:"psyche-questionnaire-run",title:"Take questionnaire",description:"Questionnaire runner and answers.",tone:"psyche",skeleton:{blocks:4,columns:1,sideRail:!1}},"psyche-questionnaire-run-detail":{surfaceId:"psyche-questionnaire-run-detail",title:"Questionnaire run detail",description:"Questionnaire result review.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"psyche-self-observation":{surfaceId:"psyche-self-observation",title:"Self observation",description:"Self-observation notes and reflective tracking.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"psyche-screen-time":{surfaceId:"psyche-screen-time",title:"Screen Time",description:"Device-activity patterns and reflective usage history.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"psyche-behaviors":{surfaceId:"psyche-behaviors",title:"Behaviors",description:"Behavior records and linked evidence.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"psyche-reports":{surfaceId:"psyche-reports",title:"Reports",description:"Trigger and reflective report review.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"psyche-report-detail":{surfaceId:"psyche-report-detail",title:"Report detail",description:"Detailed reflective report view.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"psyche-goal-map":{surfaceId:"psyche-goal-map",title:"Goal map",description:"Goal-to-values relationship map.",tone:"psyche",skeleton:{blocks:4,columns:2,sideRail:!0}},"psyche-schemas-beliefs":{surfaceId:"psyche-schemas-beliefs",title:"Schemas and beliefs",description:"Beliefs, schemas, and linked patterns.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"psyche-modes":{surfaceId:"psyche-modes",title:"Modes",description:"Mode profiles and guides.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"psyche-mode-guide":{surfaceId:"psyche-mode-guide",title:"Mode guide",description:"Guided mode session flow.",tone:"psyche",skeleton:{blocks:4,columns:1,sideRail:!1}},"kanban-index":{surfaceId:"kanban-index",title:"Kanban",description:"Task board execution surface.",tone:"execution",skeleton:{blocks:6,columns:3,sideRail:!1}},"notes-index":{surfaceId:"notes-index",title:"Notes",description:"Notes, evidence, and writing surfaces.",tone:"knowledge",skeleton:{blocks:6,columns:2,sideRail:!0}},"wiki-index":{surfaceId:"wiki-index",title:"KarpaWiki",description:"KarpaWiki search and page navigation.",tone:"knowledge",skeleton:{blocks:6,columns:2,sideRail:!0}},"wiki-ingest-history":{surfaceId:"wiki-ingest-history",title:"KarpaWiki ingest history",description:"Ingest jobs and processing history.",tone:"knowledge",skeleton:{blocks:5,columns:2,sideRail:!0}},"wiki-page-detail":{surfaceId:"wiki-page-detail",title:"KarpaWiki page",description:"KarpaWiki page detail and backlinks.",tone:"knowledge",skeleton:{blocks:5,columns:2,sideRail:!0}},"wiki-new":{surfaceId:"wiki-new",title:"New KarpaWiki page",description:"KarpaWiki editor for new pages.",tone:"knowledge",skeleton:{blocks:4,columns:1,sideRail:!1}},"wiki-edit":{surfaceId:"wiki-edit",title:"Edit KarpaWiki page",description:"KarpaWiki editor for existing pages.",tone:"knowledge",skeleton:{blocks:4,columns:1,sideRail:!1}},"today-index":{surfaceId:"today-index",title:"Today",description:"Current work, time, and daily runway.",tone:"execution",skeleton:{blocks:6,columns:2,sideRail:!0}},workbench:{surfaceId:"workbench",title:"Workbench",description:"Search, organize, and launch Forge flows.",tone:"knowledge",skeleton:{blocks:6,columns:2,sideRail:!0}},"workbench-flow":{surfaceId:"workbench-flow",title:"Workbench flow",description:"Graph editor and runtime surface for a single flow.",tone:"knowledge",skeleton:{blocks:5,columns:2,sideRail:!1}},"activity-index":{surfaceId:"activity-index",title:"Activity",description:"Activity log and event history.",tone:"core",skeleton:{blocks:6,columns:2,sideRail:!0}},"insights-index":{surfaceId:"insights-index",title:"Insights",description:"Insight review and decisions.",tone:"knowledge",skeleton:{blocks:5,columns:2,sideRail:!0}},"weekly-review":{surfaceId:"weekly-review",title:"Weekly review",description:"Weekly review workflow and closeout.",tone:"execution",skeleton:{blocks:5,columns:2,sideRail:!0}},"settings-index":{surfaceId:"settings-index",title:"Settings",description:"Operator settings and runtime configuration.",tone:"settings",skeleton:{blocks:6,columns:2,sideRail:!0}},"settings-data":{surfaceId:"settings-data",title:"Settings data",description:"Runtime storage, backups, exports, and recovery.",tone:"settings",skeleton:{blocks:5,columns:2,sideRail:!0}},"settings-users":{surfaceId:"settings-users",title:"Settings users",description:"User directory and ownership settings.",tone:"settings",skeleton:{blocks:5,columns:2,sideRail:!0}},"settings-calendar":{surfaceId:"settings-calendar",title:"Settings calendar",description:"Calendar provider settings and sync.",tone:"settings",skeleton:{blocks:5,columns:2,sideRail:!0}},"settings-mobile":{surfaceId:"settings-mobile",title:"Settings mobile",description:"Mobile companion settings and pairing.",tone:"settings",skeleton:{blocks:5,columns:2,sideRail:!0}},"settings-mobile-lab":{surfaceId:"settings-mobile-lab",title:"Companion sync lab",description:"Dev-only source-state and movement gap QA fixtures.",tone:"settings",skeleton:{blocks:5,columns:2,sideRail:!0}},"settings-models":{surfaceId:"settings-models",title:"Settings models",description:"Model connections and defaults.",tone:"settings",skeleton:{blocks:5,columns:2,sideRail:!0}},"settings-agents":{surfaceId:"settings-agents",title:"Settings agents",description:"Agent tokens and runtime access.",tone:"settings",skeleton:{blocks:5,columns:2,sideRail:!0}},"settings-rewards":{surfaceId:"settings-rewards",title:"Settings rewards",description:"Rewards and XP rule settings.",tone:"settings",skeleton:{blocks:5,columns:2,sideRail:!0}},rewards:{surfaceId:"rewards",title:"Trophy Hall",description:"Trophies, unlocks, streak pressure, and progression.",tone:"execution",skeleton:{blocks:6,columns:3,sideRail:!0}},"settings-wiki":{surfaceId:"settings-wiki",title:"KarpaWiki settings",description:"KarpaWiki ingestion and profile settings.",tone:"settings",skeleton:{blocks:5,columns:2,sideRail:!0}},"settings-logs":{surfaceId:"settings-logs",title:"Settings logs",description:"Diagnostics and event logs.",tone:"settings",skeleton:{blocks:6,columns:2,sideRail:!0}},"settings-bin":{surfaceId:"settings-bin",title:"Settings bin",description:"Deleted entity recovery.",tone:"settings",skeleton:{blocks:5,columns:2,sideRail:!0}},"task-detail":{surfaceId:"task-detail",title:"Task detail",description:"Task detail, timer, and notes.",tone:"execution",skeleton:{blocks:5,columns:2,sideRail:!0}}};function rn(e){const t=e.startsWith("/forge/")?e.slice(6):e==="/forge"?"/":e,a=t.startsWith("/")?t:`/${t}`;return a.length>1&&a.endsWith("/")?a.slice(0,-1):a}function J(...e){const t=new Set(e.map(rn));return a=>t.has(a)}function bp(e){const t=rn(e);return a=>a===t||a.startsWith(`${t}/`)}function Be(e){return t=>e.test(t)}const vp=[{viewId:"overview",match:J("/","/overview")},{viewId:"life-force-index",match:J("/life-force")},{viewId:"goals-index",match:J("/goals")},{viewId:"habits-index",match:J("/habits")},{viewId:"goal-detail",match:Be(/^\/goals\/[^/]+$/)},{viewId:"project-hierarchy",match:J("/projects/hierarchy")},{viewId:"projects-index",match:J("/projects")},{viewId:"project-detail",match:Be(/^\/projects\/[^/]+$/)},{viewId:"strategies-index",match:J("/strategies")},{viewId:"strategy-detail",match:Be(/^\/strategies\/[^/]+$/)},{viewId:"preferences-index",match:bp("/preferences")},{viewId:"calendar-index",match:J("/calendar")},{viewId:"knowledge-graph-index",match:J("/knowledge-graph")},{viewId:"movement-index",match:J("/movement")},{viewId:"sleep-index",match:J("/sleep")},{viewId:"sports-workout-detail",match:Be(/^\/sports\/workouts\/[^/]+$/)},{viewId:"sports-index",match:J("/sports")},{viewId:"training-load-index",match:J("/training-load")},{viewId:"vitals-index",match:J("/vitals")},{viewId:"weight-loss-index",match:J("/weight-loss")},{viewId:"psyche-metrics",match:J("/psyche/metrics")},{viewId:"psyche-flashcards",match:J("/psyche/flashcards")},{viewId:"psyche-values",match:J("/psyche/values")},{viewId:"psyche-patterns",match:J("/psyche/patterns")},{viewId:"psyche-questionnaire-new",match:J("/psyche/questionnaires/new")},{viewId:"psyche-questionnaire-edit",match:Be(/^\/psyche\/questionnaires\/[^/]+\/edit$/)},{viewId:"psyche-questionnaire-run",match:Be(/^\/psyche\/questionnaires\/[^/]+\/take$/)},{viewId:"psyche-questionnaire-detail",match:Be(/^\/psyche\/questionnaires\/[^/]+$/)},{viewId:"psyche-questionnaires",match:J("/psyche/questionnaires")},{viewId:"psyche-questionnaire-run-detail",match:Be(/^\/psyche\/questionnaire-runs\/[^/]+$/)},{viewId:"psyche-self-observation",match:J("/psyche/self-observation")},{viewId:"psyche-screen-time",match:J("/psyche/screen-time")},{viewId:"psyche-behaviors",match:J("/psyche/behaviors")},{viewId:"psyche-report-detail",match:Be(/^\/psyche\/reports\/[^/]+$/)},{viewId:"psyche-reports",match:J("/psyche/reports")},{viewId:"psyche-goal-map",match:J("/psyche/goal-map")},{viewId:"psyche-schemas-beliefs",match:J("/psyche/schemas-beliefs")},{viewId:"psyche-mode-guide",match:J("/psyche/modes/guide")},{viewId:"psyche-modes",match:J("/psyche/modes")},{viewId:"psyche-index",match:J("/psyche")},{viewId:"kanban-index",match:J("/kanban")},{viewId:"notes-index",match:J("/notes")},{viewId:"wiki-ingest-history",match:J("/wiki/ingest-history")},{viewId:"wiki-page-detail",match:Be(/^\/wiki\/page\/[^/]+$/)},{viewId:"wiki-new",match:J("/wiki/new")},{viewId:"wiki-edit",match:Be(/^\/wiki\/edit\/[^/]+$/)},{viewId:"wiki-index",match:J("/wiki")},{viewId:"today-index",match:J("/today")},{viewId:"workbench-flow",match:Be(/^\/workbench\/[^/]+$/)},{viewId:"workbench",match:J("/workbench")},{viewId:"activity-index",match:J("/activity")},{viewId:"insights-index",match:J("/insights")},{viewId:"weekly-review",match:J("/review/weekly")},{viewId:"settings-data",match:J("/settings/data")},{viewId:"settings-users",match:J("/settings/users")},{viewId:"settings-calendar",match:J("/settings/calendar")},{viewId:"settings-mobile-lab",match:J("/settings/mobile/lab")},{viewId:"settings-mobile",match:J("/settings/mobile")},{viewId:"settings-models",match:J("/settings/models")},{viewId:"settings-agents",match:J("/settings/agents")},{viewId:"settings-rewards",match:J("/settings/rewards")},{viewId:"settings-wiki",match:J("/settings/wiki")},{viewId:"settings-logs",match:J("/settings/logs")},{viewId:"settings-bin",match:J("/settings/bin")},{viewId:"settings-index",match:J("/settings")},{viewId:"rewards",match:J("/rewards")},{viewId:"task-detail",match:Be(/^\/tasks\/[^/]+$/)}];function wp(e){var a;const t=rn(e);return((a=vp.find(n=>n.match(t)))==null?void 0:a.viewId)??"overview"}const kp={core:"route-view-loading--core",execution:"route-view-loading--execution",health:"route-view-loading--health",knowledge:"route-view-loading--knowledge",psyche:"route-view-loading--psyche",settings:"route-view-loading--settings"};function jp({index:e}){return s.jsxs("div",{className:"surface-pulse min-h-[7.5rem] rounded-[22px] border border-white/8 bg-white/[0.04] p-4",style:{animationDelay:`${e*90}ms`},children:[s.jsx("div",{className:"h-2.5 w-24 rounded-full bg-white/10"}),s.jsx("div",{className:"mt-4 h-9 w-full rounded-2xl bg-white/[0.065]"}),s.jsxs("div",{className:"mt-3 grid grid-cols-3 gap-2",children:[s.jsx("div",{className:"h-3 rounded-full bg-white/[0.055]"}),s.jsx("div",{className:"h-3 rounded-full bg-white/[0.045]"}),s.jsx("div",{className:"h-3 rounded-full bg-white/[0.035]"})]})]})}function Eo({meta:e}){const t=e.skeleton??{},a=Math.max(2,t.blocks??4),n=Array.from({length:Math.min(a,6)});return s.jsxs(gt.section,{className:P("route-view-loading relative isolate grid min-h-[28rem] gap-5 overflow-hidden rounded-[28px] border border-white/8 p-4 shadow-[0_24px_70px_rgba(0,0,0,0.24)] sm:p-5",kp[e.tone]),role:"status","aria-busy":"true","aria-live":"polite",initial:{opacity:.72,y:8},animate:{opacity:1,y:0},transition:{duration:.22,ease:"easeOut"},children:[s.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 h-px bg-[linear-gradient(90deg,transparent,rgba(255,255,255,0.42),transparent)]"}),s.jsx("div",{className:"pointer-events-none absolute inset-x-6 top-0 h-24 bg-[linear-gradient(180deg,rgba(255,255,255,0.06),transparent)] opacity-70"}),s.jsxs("header",{className:"relative flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"font-label text-[10px] uppercase tracking-[0.16em] text-white/44",children:"Opening surface"}),s.jsx("h1",{className:"mt-2 font-display text-2xl font-semibold tracking-normal text-white sm:text-3xl",children:e.title}),s.jsx("p",{className:"mt-2 max-w-3xl text-sm leading-6 text-white/58",children:e.description})]}),s.jsxs("div",{className:"inline-flex w-fit items-center gap-2 rounded-full border border-white/10 bg-white/[0.055] px-3 py-2 text-[12px] font-medium text-white/62",children:[s.jsxs("span",{className:"relative flex size-2.5",children:[s.jsx("span",{className:"absolute inline-flex size-full animate-ping rounded-full bg-white/30"}),s.jsx("span",{className:"relative inline-flex size-2.5 rounded-full bg-white/80"})]}),"Loading"]})]}),s.jsx("div",{className:P("relative grid gap-3",(t.columns??2)>1?"md:grid-cols-2 xl:grid-cols-3":""),"aria-hidden":"true",children:n.map((r,o)=>s.jsx(jp,{index:o},o))}),s.jsx(yp,{header:t.header??!1,sideRail:t.sideRail??!0,columns:t.columns??2,blocks:a,className:"relative opacity-80"})]},e.surfaceId)}function Sp({viewId:e,children:t}){const a=_o[e];return s.jsx(c.Suspense,{fallback:s.jsx(Eo,{meta:a}),children:s.jsx(xp,{surfaceId:a.surfaceId,children:t})})}function Np(e,t){return e.length===t.length&&e.every((a,n)=>a===t[n])}function Pp(e,t){if(e.length===0||t.length===0)return e;const a=new Set(t.map(n=>n.id));return e.filter(n=>a.has(n))}function Tp(e,t={}){const a=t.timerMode??"unlimited",n=t.plannedDurationSeconds===void 0?a==="planned"?1200:null:t.plannedDurationSeconds;return{actor:e,timerMode:a,plannedDurationSeconds:n,isCurrent:!0,leaseTtlSeconds:1800,note:""}}function Ip(e){switch(e.entityType){case"workbench_flow":case"workbench_surface":case"wiki_space":return null;default:return ho(e.entityType,e.entityId)}}function mi(e,t,a){const n=new URLSearchParams(e.search);if(t?n.set("focus",jo(t.entityType,t.entityId)):n.delete("focus"),a)for(const[o,i]of Object.entries(a))i===null?n.delete(o):n.set(o,i);const r=n.toString();return r?`?${r}`:""}const Ao=c.createContext(null);let Oo=null;const Xs=[{id:"overview",to:"/overview",labelKey:"common.routeLabels.overview",detailKey:"common.routeDetails.overview",icon:Ci},{id:"life-force",to:"/life-force",label:"Life Force",detail:"Action Point capacity, weekday curves, and instant drains",icon:Mi},{id:"goals",to:"/goals",labelKey:"common.routeLabels.goals",detailKey:"common.routeDetails.goals",icon:Ra},{id:"habits",to:"/habits",labelKey:"common.routeLabels.habits",detailKey:"common.routeDetails.habits",icon:Ea},{id:"projects",to:"/projects",labelKey:"common.routeLabels.projects",detailKey:"common.routeDetails.projects",icon:Ri},{id:"strategies",to:"/strategies",labelKey:"common.routeLabels.strategies",detailKey:"common.routeDetails.strategies",icon:Ht},{id:"preferences",to:"/preferences",labelKey:"common.routeLabels.preferences",detailKey:"common.routeDetails.preferences",icon:Da},{id:"calendar",to:"/calendar",labelKey:"common.routeLabels.calendar",detailKey:"common.routeDetails.calendar",icon:$t},{id:"knowledge-graph",to:"/knowledge-graph",label:"Knowledge Graph",detail:"A living graph of Forge entities, links, and structural layers",icon:Oi},{id:"workbench",to:"/workbench",label:"Workbench",detail:"Global graph flows, AI tools, and published outputs",icon:_a},{id:"movement",to:"/movement",labelKey:"common.routeLabels.movement",detailKey:"common.routeDetails.movement",icon:kl},{id:"sleep",to:"/sleep",labelKey:"common.routeLabels.sleep",detailKey:"common.routeDetails.sleep",icon:Li},{id:"sports",to:"/sports",labelKey:"common.routeLabels.sports",detailKey:"common.routeDetails.sports",icon:jl},{id:"training-load",to:"/training-load",label:"Training Load",detail:"Cardiovascular load, HR zone targets, acute/chronic stress, and adaptation signals",icon:Sl},{id:"vitals",to:"/vitals",label:"Vitals",detail:"Recovery, cardio fitness, breathing, composition, and body signals",icon:Nl},{id:"weight-loss",to:"/weight-loss",label:"Weight Loss",detail:"Food logs, body composition, gut comfort, aesthetic signals, and nutrition experiments",icon:Pl},{id:"kanban",to:"/kanban",labelKey:"common.routeLabels.kanban",detailKey:"common.routeDetails.kanban",icon:us},{id:"today",to:"/today",labelKey:"common.routeLabels.today",detailKey:"common.routeDetails.today",icon:Ws},{id:"rewards",to:"/rewards",label:"Trophy Hall",detail:"Forge Smith levels, streaks, trophies, and cosmetic unlocks",icon:ua},{id:"notes",to:"/notes",labelKey:"common.routeLabels.notes",detailKey:"common.routeDetails.notes",icon:It},{id:"wiki",to:"/wiki",labelKey:"common.routeLabels.wiki",detailKey:"common.routeDetails.wiki",icon:Oa},{id:"psyche",to:"/psyche",labelKey:"common.routeLabels.psyche",detailKey:"common.routeDetails.psyche",icon:La},{id:"activity",to:"/activity",labelKey:"common.routeLabels.activity",detailKey:"common.routeDetails.activity",icon:qs},{id:"insights",to:"/insights",labelKey:"common.routeLabels.insights",detailKey:"common.routeDetails.insights",icon:Ii},{id:"review",to:"/review/weekly",labelKey:"common.routeLabels.review",detailKey:"common.routeDetails.review",icon:Tl},{id:"settings",to:"/settings",labelKey:"common.routeLabels.settings",detailKey:"common.routeDetails.settings",icon:Ms}],Cp=ss.filter(e=>e.to!=="/psyche").map(e=>({id:`psyche:${e.to}`,to:e.to,icon:e.icon,label:e.label,detail:"Psyche shortcut"})),Tt=[...Xs,...Cp],Rp=Xs.filter(e=>e.to!=="/preferences"&&e.to!=="/sleep");function ts(e){const t=Xs.find(a=>a.id===e);if(!t)throw new Error(`Missing primary route: ${e}`);return t}const Ta="forge.desktop-nav-layout",Ia="forge.mobile-nav-layout",pi="forge.nav-layout-migrations",hi="forge.desktop-sidebar-metrics-position",_p="desktop-knowledge-graph-default-v1",Ep="mobile-knowledge-graph-default-v1";function Ap(e){return new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:e>=1e3?1:0}).format(e)}function Op(e){return e==="/wiki"||e.startsWith("/wiki/page/")?"/wiki":e==="/wiki/new"||e.startsWith("/wiki/edit/")?"/wiki/editor":e}function la(e){return`${e.pathname}${e.search}${e.hash}`}function Lp(e,t){const a=new URL(t,"http://forge.local");return{...e,pathname:a.pathname,search:a.search,hash:a.hash,key:`intent:${a.pathname}${a.search}${a.hash}`}}function Dp(e){return e==="/wiki"||e.startsWith("/wiki/page/")||e==="/wiki/new"||e.startsWith("/wiki/edit/")}function Cs(e){return e.startsWith("/psyche")||e==="/preferences"||e.startsWith("/preferences/")||e==="/sleep"||e.startsWith("/sleep/")}function $p(e){const t=new URLSearchParams;return e.job.spaceId&&t.set("spaceId",e.job.spaceId),t.set("ingest","1"),t.set("ingestJobId",e.job.id),{pathname:"/wiki",search:`?${t.toString()}`}}function Mp(e){return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(e))}function Lo(e,t){if(e.length!==t.length)return!1;const a=[...e].sort().join("|"),n=[...t].sort().join("|");return a===n}function As(e,t){return t.to==="/psyche"?Cs(e):e===t.to||e.startsWith(`${t.to}/`)}function ct(e,t){return e.labelKey?t(e.labelKey):e.label??e.to}function on(e,t){return e.detailKey?t(e.detailKey):e.detail??e.to}function Ca(e){return!e.defaultPrevented&&e.button===0&&!e.metaKey&&!e.altKey&&!e.ctrlKey&&!e.shiftKey}function gi(e,t){if(typeof window>"u")return t;try{const a=window.localStorage.getItem(e);if(!a)return t;const n=JSON.parse(a);if(!Array.isArray(n))return t;const r=new Set(Tt.map(m=>m.id)),o=n.filter(m=>typeof m=="string"&&r.has(m)),i=o.length>0?o:t,l=()=>{try{const m=window.localStorage.getItem(pi);if(!m)return{};const g=JSON.parse(m);return g&&typeof g=="object"&&!Array.isArray(g)?g:{}}catch{return{}}},u=m=>{try{window.localStorage.setItem(pi,JSON.stringify(m))}catch{return}},h=(m,g,f)=>{const x=l();if(x[g])return m;const y=m.includes("knowledge-graph")?m:(()=>{const R=m.indexOf(f);return R<0?[...m,"knowledge-graph"]:[...m.slice(0,R+1),"knowledge-graph",...m.slice(R+1)]})();return u({...x,[g]:!0}),y};return e===Ta?h(i,_p,"calendar"):e===Ia?h(i,Ep,"notes"):i}catch{return t}}function fi(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(e,JSON.stringify(t))}catch{return}}function Fp(e){const t=e.split(/\s+/).map(a=>a.trim()).filter(Boolean);return t.length===0?"??":t.length===1?t[0].slice(0,2).toUpperCase():`${t[0][0]??""}${t[1][0]??""}`.toUpperCase()}function Do(e){const t=e.filter(n=>n.kind==="human"),a=e.filter(n=>n.kind==="bot");return[{id:"all",label:"All",shortLabel:"All",description:"Show every human and bot together.",userIds:[],token:"ALL",icon:Fi},{id:"humans",label:"Humans",shortLabel:"Humans",description:"Focus only on human-owned work.",userIds:t.map(n=>n.id),token:"HU",icon:ma},{id:"bots",label:"Bots",shortLabel:"Bots",description:"Focus only on bot-owned work.",userIds:a.map(n=>n.id),token:"AI",icon:Rs},...e.map(n=>({id:n.id,label:n.displayName,shortLabel:n.displayName,description:`${n.kind==="human"?"Human":"Bot"} · ${n.handle}`,userIds:[n.id],token:Fp(n.displayName),icon:n.kind==="human"?ma:Rs}))]}function zp(e,t){return Do(e).find(a=>Lo(t,a.userIds))??{id:"custom",label:t.length>1?`${t.length} selected`:"Custom",shortLabel:t.length>1?`${t.length} selected`:"Custom",description:"Using a custom combination of users.",userIds:t,token:t.length>1?String(t.length):"C",icon:Fi}}function yi({users:e,selectedUserIds:t,onChange:a,compact:n=!1}){const[r,o]=c.useState(!1),i=c.useMemo(()=>Do(e),[e]),l=c.useMemo(()=>zp(e,t),[t,e]),u=l.icon;return s.jsxs(yt,{open:r,onOpenChange:o,children:[s.jsx(oc,{asChild:!0,children:s.jsxs("button",{type:"button",className:P("shell-scope-trigger inline-flex items-center gap-2",n?"px-2.5 text-[12px]":"px-3.5 text-[13px]"),children:[s.jsx("span",{className:"shell-scope-avatar",children:l.id==="all"?s.jsx(u,{className:"size-3.5"}):l.token}),s.jsx("span",{className:P("truncate text-left",n?"max-w-[7.5rem]":"max-w-[11rem]"),children:l.shortLabel})]})}),s.jsxs(xt,{children:[s.jsx(bt,{className:"fixed inset-0 z-50 bg-[rgba(3,7,18,0.72)] backdrop-blur-sm"}),s.jsxs(vt,{className:"fixed left-1/2 top-[12vh] z-50 w-[min(40rem,calc(100vw-1.5rem))] -translate-x-1/2 rounded-[30px] border border-white/10 bg-[rgba(10,15,28,0.97)] p-4 shadow-[0_32px_90px_rgba(0,0,0,0.45)] sm:p-5",children:[s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx(wt,{className:"font-display text-[1.25rem] tracking-[-0.04em] text-white",children:"Choose user scope"}),s.jsx(kt,{className:"mt-1 text-[13px] leading-6 text-white/56",children:"Change which humans and bots shape the current Forge view."})]}),s.jsx(Mt,{asChild:!0,children:s.jsx(fs,{"aria-label":"Close user scope dialog"})})]}),s.jsx("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:i.map(h=>{const m=Lo(t,h.userIds),g=h.icon;return s.jsxs("button",{type:"button",className:P("flex items-center justify-between gap-3 rounded-[24px] border px-4 py-4 text-left transition",m?"border-[rgba(192,193,255,0.24)] bg-[rgba(192,193,255,0.12)] text-white":"border-white/8 bg-white/[0.03] text-white/78 hover:bg-white/[0.06] hover:text-white"),onClick:()=>{a(h.userIds),o(!1)},children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-3",children:[s.jsx("span",{className:"shell-scope-avatar",children:s.jsx(g,{className:"size-3.5"})}),s.jsxs("span",{className:"min-w-0",children:[s.jsx("span",{className:"block truncate text-[14px] font-semibold",children:h.label}),s.jsx("span",{className:"mt-1 block text-[12px] leading-5 text-white/52",children:h.description})]})]}),m?s.jsx(Ei,{className:"size-4 shrink-0 text-[var(--primary)]"}):null]},h.id)})})]})]})]})}function Wp({route:e,compact:t=!1,onRouteIntent:a}){const{t:n}=Le(),r=Kt(),o=ct(e,n),i=e.icon,l=As(r.pathname,e);return s.jsxs(ls,{to:e.to,title:t?o:void 0,"aria-label":o,onClick:u=>{Ca(u)&&(a==null||a(e.to))},className:({isActive:u})=>`interactive-tap flex items-center rounded-[18px] text-sm transition ${u||l?"bg-white/[0.08] text-white shadow-[inset_0_0_0_1px_rgba(192,193,255,0.2)]":"text-white/60 hover:bg-white/[0.04] hover:text-white"} ${t?"justify-center px-3 py-3.5":"gap-3 px-4 py-3"}`,children:[s.jsx(i,{className:"size-4 shrink-0"}),t?null:s.jsx("span",{children:o})]})}function qp({routes:e,onOpenEditor:t,onRouteIntent:a}){const[n,r]=c.useState(!1),{t:o}=Le(),i=Kt(),l=c.useRef(null),u=c.useRef(!1),h=e.slice(0,4),m=Tt.filter(x=>!h.some(y=>y.id===x.id));function g(){u.current=!1,l.current!==null&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>{u.current=!0,r(!1),t==null||t()},520)}function f(){l.current!==null&&(window.clearTimeout(l.current),l.current=null)}return s.jsxs(s.Fragment,{children:[s.jsx("nav",{"data-testid":"mobile-bottom-nav",className:"fixed inset-x-0 bottom-0 z-40 border-t border-white/6 bg-[rgba(9,14,28,0.94)] backdrop-blur-xl lg:hidden",style:{paddingLeft:"max(0.75rem, calc(var(--forge-safe-area-left) + 0.75rem))",paddingRight:"max(0.75rem, calc(var(--forge-safe-area-right) + 0.75rem))",paddingTop:"0.75rem",paddingBottom:"calc(var(--forge-safe-area-bottom) + 0.75rem)"},children:s.jsxs("div",{className:"grid grid-cols-5 gap-2",children:[h.map(x=>s.jsxs(ls,{to:x.to,onPointerDown:g,onPointerUp:f,onPointerLeave:f,onClick:y=>{if(u.current){y.preventDefault(),u.current=!1;return}Ca(y)&&(a==null||a(x.to))},className:({isActive:y})=>`flex min-h-11 flex-col items-center justify-center gap-1 rounded-2xl px-2 py-2 text-[12px] ${y||As(i.pathname,x)?"bg-white/[0.08] text-[var(--primary)]":"text-white/55"}`,children:[s.jsx(x.icon,{className:"size-4"}),s.jsx("span",{children:ct(x,o)})]},x.id)),s.jsxs("button",{type:"button",className:"flex min-h-11 flex-col items-center justify-center gap-1 rounded-2xl px-2 py-2 text-[12px] text-white/55",onClick:()=>{if(u.current){u.current=!1;return}r(!0)},onPointerDown:g,onPointerUp:f,onPointerLeave:f,children:[s.jsx(Ms,{className:"size-4"}),s.jsx("span",{children:o("common.shell.more")})]})]})}),s.jsxs(Va,{open:n,onOpenChange:r,eyebrow:o("common.shell.moreRoutesEyebrow"),title:o("common.shell.moreRoutesTitle"),description:o("common.shell.moreRoutesDescription"),children:[s.jsx("div",{className:"mb-3 flex items-center justify-between gap-3",children:s.jsxs("button",{type:"button",className:"inline-flex min-h-10 items-center gap-2 rounded-full bg-white/[0.05] px-3 py-2 text-sm text-white/72",onClick:()=>{r(!1),t==null||t()},children:[s.jsx($a,{className:"size-4"}),"Customize navigation"]})}),s.jsx("div",{className:"grid gap-3",children:m.map(x=>s.jsxs(ls,{to:x.to,onClick:y=>{Ca(y)&&(a==null||a(x.to)),r(!1)},className:({isActive:y})=>`interactive-tap flex items-center justify-between rounded-[24px] px-4 py-4 ${y||As(i.pathname,x)?"bg-white/[0.08] text-white":"bg-white/[0.04] text-white/70"}`,children:[s.jsxs("span",{className:"flex items-center gap-3",children:[s.jsx(x.icon,{className:"size-4 text-[var(--primary)]"}),s.jsxs("span",{children:[s.jsx("span",{className:"block text-base font-medium",children:ct(x,o)}),s.jsx("span",{className:"mt-1 block text-sm text-white/54",children:on(x,o)})]})]}),s.jsx(qs,{className:"size-4 text-white/35"})]},x.id))})]})]})}function Bp(e,t,a){const n=e.indexOf(t),r=e.indexOf(a);return n<0||r<0||n===r?e:ic(e,n,r)}function Kp({route:e,prefix:t,label:a,onRemove:n}){const r=nc({id:`${t}:${e.id}`});return s.jsxs("div",{ref:r.setNodeRef,style:{transform:rc.Transform.toString(r.transform),transition:r.transition},className:"flex min-h-16 items-center justify-between gap-3 rounded-[20px] bg-white/[0.04] px-4 py-3",children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-3",children:[s.jsx("button",{type:"button",className:"inline-flex size-8 shrink-0 items-center justify-center rounded-full bg-white/[0.05] text-white/50 transition hover:bg-white/[0.08] hover:text-white","aria-label":`Reorder ${a}`,...r.attributes,...r.listeners,children:s.jsx($a,{className:"size-4"})}),s.jsx(e.icon,{className:"size-4 shrink-0 text-[var(--primary)]"}),s.jsx("span",{className:"truncate text-sm text-white",children:a})]}),s.jsx("button",{type:"button",className:"rounded-full bg-white/[0.05] px-3 py-1.5 text-[12px] text-white/70",onClick:n,children:"Remove"})]})}function Hp({open:e,onOpenChange:t,desktopNavIds:a,onDesktopNavIdsChange:n,desktopSidebarMetricsPosition:r,onDesktopSidebarMetricsPositionChange:o,mobileNavIds:i,onMobileNavIdsChange:l}){const{t:u}=Le(),h=Ql(Yl(Zl,{activationConstraint:{distance:6}})),m=Tt.filter(p=>!a.includes(p.id)||!i.includes(p.id)),g=10,f=4;function x(p,T,_,b,F){const v=p.map(N=>Tt.find(A=>A.id===N)??null).filter(N=>N!==null),B=Math.max(0,T-v.length);return s.jsxs("div",{className:"grid gap-2",children:[s.jsx(ec,{sensors:h,collisionDetection:tc,onDragEnd:N=>{const A=String(N.active.id),I=N.over?String(N.over.id):null;I&&_(Bp(p,A.replace(`${F}:`,""),I.replace(`${F}:`,"")))},children:s.jsx(sc,{items:v.map(N=>`${F}:${N.id}`),strategy:ac,children:v.map(N=>s.jsx(Kp,{route:N,prefix:F,label:ct(N,u),onRemove:()=>R(p,N.id,_,b)},`${F}-${N.id}`))})}),Array.from({length:B},(N,A)=>s.jsxs("div",{className:"flex min-h-16 items-center justify-between gap-3 rounded-[20px] border border-dashed border-white/12 bg-white/[0.02] px-4 py-3",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-sm text-white/44",children:"Empty slot"}),s.jsx("div",{className:"text-[12px] text-white/30",children:"Add a route below to fill this slot"})]}),s.jsxs("div",{className:"rounded-full bg-white/[0.05] px-2.5 py-1 text-[11px] text-white/46",children:["Slot ",v.length+A+1]})]},`${F}-empty-${A}`))]})}function y(p,T,_,b){if(p.includes(T))return;const F=[...p,T];_(b?F.slice(0,b):F)}function R(p,T,_,b=1){const F=p.filter(v=>v!==T);F.length<b||_(F)}return s.jsx(Va,{open:e,onOpenChange:t,eyebrow:"Navigation",title:"Customize navigation",description:"Add or remove main routes, Psyche shortcuts, and the Workbench flow workspace.",children:s.jsxs("div",{className:"grid gap-5",children:[s.jsxs("div",{className:"grid gap-3",children:[s.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/38",children:"Desktop sidebar"}),s.jsxs("div",{className:"rounded-[20px] bg-white/[0.03] p-3",children:[s.jsx("div",{className:"text-[11px] uppercase tracking-[0.14em] text-white/38",children:"Metric strip position"}),s.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:[["above","Above navigation"],["below","Below navigation"]].map(([p,T])=>s.jsx("button",{type:"button",className:P("rounded-full px-3 py-1.5 text-[12px] transition",r===p?"bg-[var(--primary)] text-slate-950":"bg-white/[0.05] text-white/70 hover:bg-white/[0.08]"),onClick:()=>o(p),children:T},p))})]}),s.jsx("div",{className:"grid gap-2",children:x(a,g,n,4,"desktop")})]}),s.jsxs("div",{className:"grid gap-3",children:[s.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/38",children:"Mobile bar"}),s.jsx("div",{className:"grid gap-2",children:x(i,f,l,2,"mobile")})]}),s.jsxs("div",{className:"grid gap-3",children:[s.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/38",children:"Available routes"}),s.jsx("div",{className:"grid gap-2",children:m.map(p=>s.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-[20px] bg-white/[0.03] px-4 py-3",children:[s.jsxs("span",{className:"flex items-center gap-3",children:[s.jsx(p.icon,{className:"size-4 text-[var(--primary)]"}),s.jsxs("span",{children:[s.jsx("span",{className:"block text-sm text-white",children:ct(p,u)}),s.jsx("span",{className:"block text-[12px] text-white/48",children:on(p,u)})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[a.includes(p.id)?null:s.jsx("button",{type:"button",className:"rounded-full bg-white/[0.05] px-2.5 py-1.5 text-[11px] text-white/70",onClick:()=>y(a,p.id,n),children:"+ Sidebar"}),i.includes(p.id)?null:s.jsx("button",{type:"button",className:"rounded-full bg-white/[0.05] px-2.5 py-1.5 text-[11px] text-white/70",onClick:()=>y(i,p.id,l,4),children:"+ Mobile"})]})]},`available-${p.id}`))})]})]})})}function Up({onClick:e}){const{t}=Le();return s.jsxs(de,{variant:"secondary",size:"sm",className:"min-w-[8.25rem] px-3.5",onClick:e,children:[s.jsx(ft,{className:"size-4"}),t("common.shell.command"),s.jsx(le,{size:"sm",tone:"meta",className:"ml-1 hidden bg-white/[0.06] text-white/52 xl:inline-flex",children:"Shift Shift"}),s.jsx(le,{size:"sm",tone:"meta",className:"hidden bg-white/[0.06] text-white/52 2xl:inline-flex",children:"Cmd K"})]})}function Gp({children:e,routeLocation:t,onRouteIntent:a,settings:n,timerPending:r,startWorkOpen:o,startWorkPending:i,startWorkError:l,startWorkDefaults:u,onOpenStartWork:h,onCloseStartWork:m,onStartExistingTask:g,onCreateAndStartTask:f,onFocusRun:x,onPauseRun:y,onCompleteRun:R}){const p=Jp(),{t:T}=Le(),_=Tt.find(S=>As(t.pathname,S))??Xs[0],b=tp(_.id),F=Op(t.pathname),[v,B]=c.useState(!1),[N,A]=c.useState(!1),I=c.useRef(null),[$,ee]=c.useState(!1),[ne,oe]=c.useState(()=>gi(Ta,[...Rp.map(S=>S.id)])),[V,w]=c.useState(()=>gi(Ia,[ts("overview").id,ts("today").id,ts("kanban").id,ts("notes").id,ts("knowledge-graph").id])),[z,ie]=c.useState(!1),[te,E]=c.useState(()=>{if(typeof window>"u")return"above";try{return window.localStorage.getItem(hi)==="below"?"below":"above"}catch{return"above"}}),X=c.useRef(!1),M=c.useRef(!1),Z=c.useRef(!1),O=Cs(t.pathname),se=Dp(t.pathname),pe=Cs(t.pathname),Me=t.pathname.startsWith("/workbench"),Te=t.pathname.startsWith("/knowledge-graph"),Ie=se||pe||Me||Te,xe=ne.map(S=>Tt.find(ye=>ye.id===S)??null).filter(S=>S!==null),Ce=V.map(S=>Tt.find(ye=>ye.id===S)??null).filter(S=>S!==null),Ne=qi(),we=Vl(),Ue=rs(Ro),Fe=Ne+we+Ue,{activityLabel:it,hasActiveIngestJobs:ze,ingestJobsQuery:Ke,recentIngestJobs:tt}=op({backgroundActivityOpen:N,fetchingCount:Ne+Ue,mutatingCount:we,t:T}),mt=Xp(p.snapshot,T),D=lm({goals:p.snapshot.dashboard.goals,projects:p.snapshot.dashboard.projects,tags:p.snapshot.tags,users:p.snapshot.users,defaultUserId:p.selectedUserIds.length===1?p.selectedUserIds[0]:null,onCreateGoal:p.createGoal,onCreateProject:p.createProject,onCreateTask:p.createTask}),Q=c.useMemo(()=>t.pathname.startsWith("/tasks/")?[{to:"/kanban",label:T("common.shell.rail.taskBackToKanban")},{to:"/today",label:T("common.shell.rail.taskOpenToday")}]:t.pathname.startsWith("/projects/")?[{to:"/projects",label:T("common.shell.rail.projectAll")},{to:"/goals",label:T("common.shell.rail.projectGoals")}]:t.pathname.startsWith("/goals/")?[{to:"/goals",label:T("common.shell.rail.goalAll")},{to:"/projects",label:T("common.shell.rail.goalProjects")}]:t.pathname.startsWith("/strategies")?[{to:"/strategies",label:T("common.routeLabels.strategies")},{to:"/projects",label:T("common.shell.rail.projectAll")}]:Cs(t.pathname)?[{to:"/psyche",label:T("common.shell.rail.psycheHub")},{to:"/psyche/reports",label:T("common.shell.rail.psycheReports")}]:[{to:"/overview",label:T("common.shell.rail.overview")},{to:"/today",label:T("common.shell.rail.today")}],[t.pathname,T]);c.useEffect(()=>{let S=0;const ye=ge=>{if((ge.metaKey||ge.ctrlKey)&&ge.key.toLowerCase()==="k"){ge.preventDefault(),B(st=>!st),S=0;return}if(ge.key==="Shift"&&!ge.metaKey&&!ge.ctrlKey&&!ge.altKey&&!ge.repeat){const st=window.performance.now();if(st-S<=360){ge.preventDefault(),B(!0),S=0;return}S=st;return}!ge.metaKey&&!ge.ctrlKey&&!ge.altKey&&(S=0)};return window.addEventListener("keydown",ye),()=>window.removeEventListener("keydown",ye)},[]),c.useEffect(()=>{try{window.localStorage.getItem("forge.desktop-nav-collapsed")==="true"&&ee(!0)}catch{return}},[]),c.useEffect(()=>{if(Z.current){Z.current=!1;return}try{window.localStorage.setItem("forge.desktop-nav-collapsed",String($))}catch{return}},[$]),c.useEffect(()=>{try{window.localStorage.setItem(hi,te)}catch{return}},[te]),c.useEffect(()=>{fi(Ta,ne)},[ne]),c.useEffect(()=>{fi(Ia,V)},[V]),c.useEffect(()=>{if(Ie){X.current||(M.current=$,X.current=!0,$||(Z.current=!0,ee(!0)));return}X.current&&(X.current=!1,$!==M.current&&(Z.current=!0,ee(M.current)))},[Ie,$]),up(I);const C=c.useMemo(()=>({"--forge-shell-collapse":"0","--forge-shell-desktop-header-padding-top":"18px","--forge-shell-desktop-header-padding-bottom":"15px","--forge-shell-desktop-title-size":"1.42rem","--forge-shell-desktop-primary-translate-y":"0px","--forge-shell-desktop-primary-scale":"1","--forge-shell-desktop-secondary-opacity":"1","--forge-shell-desktop-secondary-max-height":"176px","--forge-shell-desktop-secondary-spacing":"14px","--forge-shell-desktop-secondary-translate-y":"0px","--forge-shell-mobile-header-padding-top":"14px","--forge-shell-mobile-header-padding-bottom":"12px","--forge-shell-mobile-title-size":"1.2rem","--forge-shell-mobile-primary-translate-y":"0px","--forge-shell-mobile-primary-scale":"1","--forge-shell-mobile-copy-opacity":"1","--forge-shell-mobile-copy-max-height":"320px","--forge-shell-mobile-copy-translate-y":"0px","--forge-shell-hero-padding-top":"20px","--forge-shell-hero-padding-bottom":"20px","--forge-shell-hero-title-translate-y":"0px","--forge-shell-hero-title-scale":"1","--forge-shell-hero-description-opacity":"1","--forge-shell-hero-description-translate-y":"0px"}),[]),W=s.jsx("div",{className:P($?"mt-4":"mt-6"),children:s.jsxs("div",{className:P("rounded-[24px] bg-white/[0.04]",$?"px-2 py-2.5":"p-4"),children:[$?null:s.jsx("div",{className:"type-label text-white/40",children:"Live metrics"}),s.jsx("div",{className:P("grid",$?"gap-1.5":"mt-3 gap-3"),children:mt.map(S=>{const ye=S.icon;return $?s.jsxs("div",{title:`${S.label}: ${S.compactValue}`,className:"flex min-w-0 flex-col items-center gap-1 rounded-[16px] bg-white/[0.04] px-1 py-2.5 text-center",children:[s.jsx(ye,{className:"size-3.5 shrink-0 text-white/42"}),s.jsx("div",{className:"max-w-full text-[12px] font-semibold leading-none text-white",children:S.compactValue})]},S.id):s.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-3 py-3",children:[s.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] uppercase tracking-[0.14em] text-white/42",children:[s.jsx("span",{children:S.label}),s.jsx(Dt,{label:`Explain ${S.label}`,title:S.label,content:ep[S.id]??"This is a live Forge shell metric for the selected user scope.",panelClassName:"normal-case tracking-normal"})]}),s.jsx("div",{className:"mt-1 text-lg font-semibold leading-tight text-white",children:S.expandedValue})]},S.id)})})]})});return s.jsxs("div",{ref:I,className:"min-h-screen",style:C,children:[s.jsx(ru,{open:v,onOpenChange:B,snapshot:p.snapshot,selectedUserIds:p.selectedUserIds,createActions:D.actions}),D.dialogs,s.jsxs("div",{className:"hidden lg:grid lg:min-h-screen",style:{gridTemplateColumns:$?"5.75rem minmax(0,1fr)":"17.75rem minmax(0,1fr)"},children:[s.jsxs("aside",{className:P("flex min-h-screen flex-col border-r border-white/5 py-6 backdrop-blur-xl transition-[padding,width]",$?"px-3":"px-5"),style:{background:"linear-gradient(180deg, color-mix(in srgb, var(--surface-panel) 94%, transparent), color-mix(in srgb, var(--surface-low) 92%, transparent))"},children:[s.jsxs("div",{className:P("flex items-start",$?"flex-col items-center gap-3":"justify-between gap-3"),children:[s.jsxs(Lt,{to:"/overview",className:P("block min-w-0",$&&"text-center"),children:[s.jsx("div",{className:P("font-display text-[var(--primary)]",$?"text-2xl":"text-3xl"),children:T("common.shell.appMark")}),$?null:s.jsxs("div",{className:"type-meta mt-2 text-white/40",children:["Level ",p.snapshot.metrics.level]})]}),s.jsx(de,{type:"button",variant:"secondary",size:"sm",className:"mt-0.5 px-2.5",onClick:()=>ee(S=>!S),"aria-label":T($?"common.shell.expandSidebar":"common.shell.collapseSidebar"),title:T($?"common.shell.expandSidebar":"common.shell.collapseSidebar"),children:$?s.jsx(Rl,{className:"size-4"}):s.jsx(_l,{className:"size-4"})})]}),s.jsxs(de,{type:"button",variant:"secondary",size:"sm",className:P("mt-3",$?"px-2.5":"w-full justify-start px-3"),onClick:()=>ie(!0),children:[s.jsx($a,{className:"size-4"}),$?null:"Customize nav"]}),te==="above"?W:null,s.jsx("div",{className:P("grid gap-2",$?"mt-6":"mt-8"),children:xe.map(S=>s.jsx(Wp,{route:S,compact:$,onRouteIntent:a},S.id))}),te==="below"?W:null]}),s.jsxs("div",{className:"min-h-screen",children:[s.jsx(ni,{children:s.jsxs("header",{className:"sticky top-0 z-30 border-b border-white/5 px-6 backdrop-blur-xl",style:{background:"color-mix(in srgb, var(--surface-glass) 92%, transparent)",paddingTop:"var(--forge-shell-desktop-header-padding-top)",paddingBottom:"var(--forge-shell-desktop-header-padding-bottom)",willChange:"padding, background-color"},children:[s.jsxs("div",{className:"flex items-center justify-between gap-4",style:{transform:"translateY(var(--forge-shell-desktop-primary-translate-y)) scale(var(--forge-shell-desktop-primary-scale))",transformOrigin:"top center",willChange:"transform"},children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-5",children:[s.jsxs("div",{className:"flex shrink-0 items-center gap-2 font-display text-white",style:{fontSize:"var(--forge-shell-desktop-title-size)",lineHeight:1,willChange:"font-size"},children:[s.jsx("span",{children:ct(_,T)}),s.jsx(Dt,{className:"font-sans",label:`Explain ${ct(_,T)}`,title:b.title,content:s.jsxs("span",{className:"grid gap-2",children:[s.jsx("span",{children:b.purpose}),s.jsx("span",{children:b.primaryAction}),b.metricNote?s.jsx("span",{className:"text-white/58",children:b.metricNote}):null]})})]}),s.jsx("div",{className:"min-w-0 flex-1",children:s.jsx(ri,{runs:p.snapshot.activeTaskRuns,tasks:p.snapshot.tasks,generatedAt:p.snapshot.meta.generatedAt,timeAccountingMode:n.execution.timeAccountingMode,pending:r,onOpenStartWork:()=>h(),onPause:y,onFocus:x})})]}),s.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-2",children:[s.jsx(Rd,{metrics:p.snapshot.metrics,className:"hidden xl:inline-flex"}),s.jsx(Br,{active:Fe>0||ze,label:it,onClick:()=>A(!0)}),s.jsx(Up,{onClick:()=>B(!0)}),s.jsxs(de,{variant:"secondary",size:"sm",className:"min-w-[7.25rem] px-3.5",onClick:()=>void p.refresh(),children:[s.jsx(ha,{className:"size-4"}),T("common.actions.refresh")]})]})]}),s.jsx(ii,{runs:p.snapshot.activeTaskRuns,tasks:p.snapshot.tasks,generatedAt:p.snapshot.meta.generatedAt,timeAccountingMode:n.execution.timeAccountingMode,pending:r,onOpenStartWork:()=>h(),onFocus:x,onPause:y,onComplete:R}),s.jsxs("div",{className:"flex items-center justify-between gap-4 overflow-hidden border-t border-white/6",style:{opacity:"var(--forge-shell-desktop-secondary-opacity)",maxHeight:"var(--forge-shell-desktop-secondary-max-height)",marginTop:"var(--forge-shell-desktop-secondary-spacing)",paddingTop:"var(--forge-shell-desktop-secondary-spacing)",transform:"translateY(var(--forge-shell-desktop-secondary-translate-y))",willChange:"opacity, max-height, transform"},children:[s.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[s.jsx("div",{className:"max-w-[34rem] text-[12px] leading-5 text-white/48",children:b.primaryAction}),Q.map(S=>s.jsx(Lt,{to:S.to,className:"interactive-tap inline-flex min-h-10 min-w-max items-center justify-center rounded-full bg-white/[0.04] px-4 py-2 text-[13px] leading-none whitespace-nowrap text-white/62 transition hover:bg-white/[0.07] hover:text-white",children:S.label},S.to)),s.jsx(yi,{users:p.snapshot.users,selectedUserIds:p.selectedUserIds,onChange:p.setSelectedUserIds,compact:!0})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsx(le,{tone:"meta",children:T(p.snapshot.metrics.streakDays===1?"common.shell.momentum.streakBadgeOne":"common.shell.momentum.streakBadgeOther",{count:p.snapshot.metrics.streakDays})}),s.jsx(le,{tone:"meta",children:T("common.shell.momentum.weeklyXp",{count:p.snapshot.metrics.weeklyXp})}),s.jsx(le,{tone:O?"signal":"meta",children:O?T("common.shell.momentum.psycheMode"):T("common.shell.momentum.liveMomentum",{count:p.snapshot.metrics.momentumScore})})]})]})]})}),s.jsx("div",{className:"px-6 pt-3",children:s.jsx(ai,{open:o,onOpenChange:S=>{S||m()},presentation:"desktop_inline",tasks:p.snapshot.tasks,projects:p.snapshot.dashboard.projects,activeRunCount:p.snapshot.activeTaskRuns.length,maxActiveTasks:n.execution.maxActiveTasks,timeAccountingMode:n.execution.timeAccountingMode,pending:i,errorMessage:l,initialTaskId:u.taskId??null,defaultProjectId:u.projectId??null,onStartExisting:g,onCreateAndStart:f})}),s.jsx("main",{className:"px-6 pb-3",children:s.jsx("div",{className:"min-w-0",children:s.jsx(Jr,{routeKey:F,tone:O?"psyche":"core",children:e})})})]})]}),s.jsxs("div",{className:"min-h-[100dvh] overflow-x-clip lg:hidden",children:[s.jsx(ni,{children:s.jsxs("header",{className:"sticky top-0 z-30 border-b border-white/6 px-4 backdrop-blur-xl",style:{background:"color-mix(in srgb, var(--surface-glass) 96%, transparent)",paddingTop:"var(--forge-shell-mobile-header-padding-top)",paddingBottom:"var(--forge-shell-mobile-header-padding-bottom)",willChange:"padding, background-color"},children:[s.jsxs("div",{className:"grid gap-2",style:{transform:"translateY(var(--forge-shell-mobile-primary-translate-y)) scale(var(--forge-shell-mobile-primary-scale))",transformOrigin:"top center",willChange:"transform"},children:[s.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[s.jsx("div",{className:"min-w-0 truncate font-display text-white",style:{fontSize:"var(--forge-shell-mobile-title-size)",willChange:"font-size"},children:ct(_,T)}),s.jsx(Dt,{className:"shrink-0",label:`Explain ${ct(_,T)}`,title:b.title,content:s.jsxs("span",{className:"grid gap-2",children:[s.jsx("span",{children:b.purpose}),s.jsx("span",{children:b.primaryAction}),b.metricNote?s.jsx("span",{className:"text-white/58",children:b.metricNote}):null]})})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[s.jsx(de,{variant:"secondary",size:"sm",className:"min-h-[2.125rem] px-2.5",onClick:()=>B(!0),"aria-label":T("common.actionBar.title"),title:T("common.actionBar.title"),children:s.jsx(ft,{className:"size-4"})}),s.jsxs("div",{className:"inline-flex min-h-[2.125rem] max-w-[9.5rem] items-center gap-1.5 rounded-full border border-white/8 bg-white/[0.05] px-2.5 text-[12px] font-medium text-[var(--primary)]",title:`Level ${p.snapshot.metrics.level} · ${p.snapshot.metrics.totalXp} XP · ${p.snapshot.metrics.streakDays} day streak`,children:[s.jsx(us,{className:"size-3.5 shrink-0"}),s.jsxs("span",{className:"min-w-0 truncate",children:["L",p.snapshot.metrics.level," ·"," ",Ap(p.snapshot.metrics.totalXp)," XP · ",p.snapshot.metrics.streakDays,"d"]})]})]})]}),s.jsx("div",{className:"min-w-0",children:s.jsx(ri,{runs:p.snapshot.activeTaskRuns,tasks:p.snapshot.tasks,generatedAt:p.snapshot.meta.generatedAt,timeAccountingMode:n.execution.timeAccountingMode,pending:r,onOpenStartWork:()=>h(),onPause:y,onFocus:x})})]}),s.jsx(ii,{runs:p.snapshot.activeTaskRuns,tasks:p.snapshot.tasks,generatedAt:p.snapshot.meta.generatedAt,timeAccountingMode:n.execution.timeAccountingMode,pending:r,onOpenStartWork:()=>h(),onFocus:x,onPause:y,onComplete:R}),s.jsxs("div",{className:"overflow-hidden",style:{opacity:"var(--forge-shell-mobile-copy-opacity)",maxHeight:"var(--forge-shell-mobile-copy-max-height)",transform:"translateY(var(--forge-shell-mobile-copy-translate-y))",willChange:"opacity, max-height, transform"},children:[s.jsxs("div",{className:"mt-2 text-[13px] leading-5 text-white/52",children:[on(_,T)," ",b.primaryAction]}),s.jsx("div",{className:"mt-2",children:s.jsx(Br,{active:Fe>0||ze,label:it,onClick:()=>A(!0)})}),s.jsx("div",{className:"mt-3 overflow-x-auto pb-1",children:s.jsx(yi,{users:p.snapshot.users,selectedUserIds:p.selectedUserIds,onChange:p.setSelectedUserIds,compact:!0})})]})]})}),s.jsx(ai,{open:o,onOpenChange:S=>{S||m()},presentation:"mobile_sheet",tasks:p.snapshot.tasks,projects:p.snapshot.dashboard.projects,activeRunCount:p.snapshot.activeTaskRuns.length,maxActiveTasks:n.execution.maxActiveTasks,timeAccountingMode:n.execution.timeAccountingMode,pending:i,errorMessage:l,initialTaskId:u.taskId??null,defaultProjectId:u.projectId??null,onStartExisting:g,onCreateAndStart:f}),s.jsx("main",{className:P("overflow-x-clip pb-2.5 lg:pb-24",Te?"px-0":"px-4"),style:{paddingBottom:"calc(var(--forge-mobile-nav-clearance) + 2.5rem)",paddingLeft:Te?"var(--forge-safe-area-left)":"max(1rem, calc(var(--forge-safe-area-left) + 1rem))",paddingRight:Te?"var(--forge-safe-area-right)":"max(1rem, calc(var(--forge-safe-area-right) + 1rem))"},children:s.jsx(Jr,{routeKey:F,tone:O?"psyche":"core",children:e})}),s.jsx(qp,{routes:Ce,onOpenEditor:()=>ie(!0),onRouteIntent:a}),s.jsx(Hp,{open:z,onOpenChange:ie,desktopNavIds:ne,onDesktopNavIdsChange:oe,desktopSidebarMetricsPosition:te,onDesktopSidebarMetricsPositionChange:E,mobileNavIds:V,onMobileNavIdsChange:w})]}),s.jsx(yt,{open:N,onOpenChange:A,children:s.jsxs(xt,{children:[s.jsx(bt,{className:"fixed inset-0 z-50 bg-[rgba(3,7,18,0.72)] backdrop-blur-sm"}),s.jsxs(vt,{className:"fixed left-1/2 top-[10vh] z-50 w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 rounded-[30px] border border-white/10 bg-[rgba(10,15,28,0.97)] p-4 shadow-[0_32px_90px_rgba(0,0,0,0.45)] sm:p-5",children:[s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx(wt,{className:"font-display text-[1.25rem] tracking-[-0.04em] text-white",children:"Background activity"}),s.jsx(kt,{className:"mt-1 text-[13px] leading-6 text-white/56",children:"Follow active KarpaWiki ingest jobs and reopen completed reviews without leaving your current context."})]}),s.jsx(Mt,{asChild:!0,children:s.jsx(fs,{"aria-label":"Close background activity dialog"})})]}),s.jsx("div",{className:"mt-4 max-h-[65vh] overflow-y-auto",children:Ke.isLoading?s.jsx(xo,{eyebrow:"Background",title:"Loading activity",description:"Checking the latest queued and completed ingest jobs."}):Ke.isError?s.jsx(Is,{eyebrow:"Background",error:Ke.error,onRetry:()=>void Ke.refetch()}):tt.length===0?s.jsx("div",{className:"rounded-[24px] border border-dashed border-white/10 px-4 py-10 text-center text-[13px] leading-6 text-white/42",children:"No background ingest jobs yet."}):s.jsx("div",{className:"grid gap-3",children:tt.map(S=>{const ye=["queued","processing"].includes(S.job.status);return s.jsx(Lt,{to:$p(S),onClick:()=>A(!1),className:"rounded-[24px] border border-white/8 bg-white/[0.03] px-4 py-4 transition hover:bg-white/[0.06]",children:s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"KarpaWiki ingest"}),s.jsx("div",{className:"mt-2 text-[14px] font-semibold text-white",children:S.job.titleHint||S.job.latestMessage||"Background ingest"}),s.jsxs("div",{className:"mt-1 text-[12px] leading-5 text-white/56",children:[S.job.status," · ",S.job.phase," ·"," ",S.job.progressPercent,"% ·"," ",Mp(S.job.updatedAt)]}),s.jsxs("div",{className:"mt-2 text-[12px] leading-5 text-white/46",children:[S.job.createdPageCount," pages ·"," ",S.job.createdEntityCount," entities ·"," ",S.job.acceptedCount," accepted ·"," ",S.job.rejectedCount," rejected"]})]}),s.jsx("div",{className:"shrink-0",children:ye?s.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-white/10 bg-white/[0.04] px-3 py-2 text-xs text-white/58",children:[s.jsx(ha,{className:"size-3.5 animate-spin"}),"Running"]}):s.jsx(le,{tone:"meta",children:S.job.phase})})]})},S.job.id)})})})]})]})}),s.jsx(cm,{className:"fixed z-40 lg:bottom-6 lg:right-6",actions:D.actions})]})}function Vp(){var Jt,Xt,Qt,Yt,Zt;Jm();const e=nn(),t=Aa(),a=c.useRef(null),n=c.useRef(null),r=ms(),o=Kt(),i=c.useContext(Fr),l=Cl();qi(),rs(Ro);const u=rs(rp),h=rs(j=>j.shell.knowledgeGraphOverlayFocus),[m,g]=c.useState(!1),[f,x]=c.useState({}),[y,R]=c.useState(null),[p,T]=c.useState(null),[_,b]=c.useState(null),[F,v]=c.useState(!1),[B,N]=c.useState(null),[A,I]=c.useState(()=>new Set),$=la(o),ee=B?la(B):null,ne=j=>{const L=Lp(o,j);if(la(L)===$){N(null);return}N(L)},oe=bm(),V=km(u,{skip:!oe.isSuccess}),w=wm(void 0,{skip:!oe.isSuccess}),z=oe.isSuccess&&V.isSuccess&&w.isSuccess,ie=vm(u,{skip:!z||!F}),[te,E]=Rm(),X=c.useMemo(()=>{var j;return(((j=ie.data)==null?void 0:j.metrics.celebrations)??[]).filter(L=>!A.has(L.id))},[A,(Jt=ie.data)==null?void 0:Jt.metrics.celebrations]);np(o.pathname,{bootstrapReady:z,sleepReady:!0});const M=wp((B==null?void 0:B.pathname)??o.pathname),Z=c.useMemo(()=>s.jsx(Eo,{meta:_o[M]},ee??$),[M,ee,$]),{displayedRoute:O,displayedLocationContext:se,visibleLocation:pe}=mp({routePathKey:$,routerLocation:o,outlet:l,routerLocationContext:i,optimisticLocation:B,optimisticRoutePathKey:ee,destinationLoadingNode:Z}),Me=j=>{e(Pa(j))};c.useEffect(()=>{ee!==null&&ee===$&&N(null)},[ee,$]),c.useEffect(()=>{if(v(!1),!z)return;const j=window.setTimeout(()=>{v(!0)},8e3);return()=>{window.clearTimeout(j)}},[u,z]);const Te=j=>{const L=mi(o,j);j||e(oi()),t({pathname:"/knowledge-graph",search:L})},Ie=j=>{t({pathname:"/knowledge-graph",search:mi(o,j,{view:"hierarchy"})})};c.useEffect(()=>{oe.isSuccess&&r.invalidateQueries({predicate:j=>{const[L]=j.queryKey;return L==="notes-index"||L==="project-board"||L==="task-context"||typeof L=="string"&&L.startsWith("forge-")}})},[oe.isSuccess,r,u]),c.useEffect(()=>{var Y;const j=(Y=V.data)==null?void 0:Y.users;if(!j||u.length===0)return;const L=Pp(u,j);Np(L,u)||e(Pa(L))},[e,u,(Xt=V.data)==null?void 0:Xt.users]),c.useEffect(()=>{o.pathname.startsWith("/knowledge-graph")||h&&e(oi())},[e,h,o.pathname]),pp(oe.isSuccess),hp({snapshot:V.data,settings:(Qt=w.data)==null?void 0:Qt.settings}),gp((Yt=w.data)==null?void 0:Yt.settings),c.useEffect(()=>{n.current=null,b(null)},[oe.isSuccess,u]),c.useEffect(()=>{var Y;const j=(Y=V.data)==null?void 0:Y.metrics.totalXp;if(typeof j!="number")return;if(n.current===null){n.current=j;return}const L=j-n.current;n.current=j,L!==0&&(b({deltaXp:L,totalXp:j}),r.invalidateQueries({queryKey:["forge-xp-metrics"]}),a.current!==null&&window.clearTimeout(a.current),a.current=window.setTimeout(()=>{b(null),a.current=null},2600))},[r,(Zt=V.data)==null?void 0:Zt.metrics.totalXp]),c.useEffect(()=>()=>{a.current!==null&&window.clearTimeout(a.current)},[]);const[xe]=ym(),[Ce]=gm(),[Ne]=fm(),[we]=Nm(),[Ue]=Pm(),[Fe]=Tm(),[it]=Im(),[ze,Ke]=pm(),[tt,mt]=xm(),[D,Q]=Cm(),[C,W]=hm(),S=async()=>{await fp(r)},ye=async(j,L,Y)=>{var qe,_t;try{await it({taskId:j,status:L,enforceTodayWorkLog:L==="done"&&(Y==null?void 0:Y.completedTodayWorkSeconds)===void 0,completedTodayWorkSeconds:Y==null?void 0:Y.completedTodayWorkSeconds}).unwrap(),await S()}catch(ot){if(ot instanceof Es&&ot.code==="task_completion_work_log_required"&&L==="done"&&(Y==null?void 0:Y.completedTodayWorkSeconds)===void 0){const jt=((_t=(qe=V.data)==null?void 0:qe.tasks.find(Et=>Et.id===j))==null?void 0:_t.title)??"this task";T({taskId:j,title:jt,status:L,customMinutes:"",error:null});return}throw ot}},ge=async j=>{if(p)try{await ye(p.taskId,p.status,{completedTodayWorkSeconds:j}),T(null)}catch(L){T(Y=>Y&&{...Y,error:L instanceof Error?L.message:"Could not close the task right now."})}},st=cs({mutationFn:async j=>{var ot,jt;const L=(ot=V.data)==null?void 0:ot.dashboard.projects.find(Et=>Et.id===j.projectId);if(!L)throw new Error("Select a project before starting work.");const Y=((jt=w.data)==null?void 0:jt.settings.profile.operatorName)??"Albert",qe=await xe({title:j.title,description:j.description,level:"task",owner:Y,userId:L.userId??(u.length===1?u[0]:null),assigneeUserIds:[],goalId:L.goalId,projectId:L.id,parentWorkItemId:null,priority:"medium",status:"in_progress",effort:"deep",energy:"steady",dueDate:"",points:60,plannedDurationSeconds:86400,aiInstructions:"",executionMode:null,acceptanceCriteria:[],blockerLinks:[],completionReport:null,gitRefs:[],tagIds:[],notes:[]}).unwrap();if(!await Rt(qe.task.id,{actor:Y,timerMode:j.timerMode,plannedDurationSeconds:j.plannedDurationSeconds,isCurrent:!0,leaseTtlSeconds:1800,note:"",gitContext:j.gitContext}))throw new Error("The task was created, but live work did not start because the calendar override was cancelled.");return qe.task},onSuccess:async()=>{await S()}}),Rt=async(j,L)=>{try{return await ze({taskId:j,input:L}).unwrap(),await S(),!0}catch(Y){if(Y instanceof Es&&Y.code==="task_run_calendar_blocked"&&typeof window<"u"){const qe=window.prompt("Calendar rules block this task right now. Add a reason to override and start anyway.");return!qe||qe.trim().length===0?!1:(await ze({taskId:j,input:{...L,overrideReason:qe.trim()}}).unwrap(),await S(),!0)}throw Y}};if(oe.isLoading||V.isLoading||w.isLoading)return s.jsx("div",{className:"grid min-h-screen place-items-center p-6",children:s.jsx(xo,{eyebrow:"Forge shell",title:"Loading Forge",description:"Checking your operator session and loading your latest snapshot."})});if(oe.isError)return s.jsx("div",{className:"grid min-h-screen place-items-center p-6",children:s.jsx(Is,{eyebrow:"Forge operator session",error:oe.error,onRetry:()=>void oe.refetch()})});if(w.isError)return s.jsx("div",{className:"grid min-h-screen place-items-center p-6",children:s.jsx(Is,{eyebrow:"Forge settings",error:w.error,onRetry:()=>void w.refetch()})});if(V.isError||!V.data||!w.data)return s.jsx("div",{className:"grid min-h-screen place-items-center p-6",children:s.jsx(Is,{eyebrow:"Forge state",error:V.error,onRetry:()=>void V.refetch()})});const Vt={snapshot:V.data,selectedUserIds:u,setSelectedUserIds:Me,refresh:async()=>{await Promise.all([V.refetch(),S()])},createTask:async j=>{await xe(j).unwrap(),await S()},startTaskNow:async(j,L={})=>{const Y=w.data.settings.profile.operatorName;await Rt(j,Tp(Y,L))},stopTaskRun:async j=>{await D({runId:j.id,input:{actor:j.actor,note:j.note??""}}).unwrap(),await S()},createGoal:async j=>{await Ce(j).unwrap(),await S()},createProject:async j=>{await Ne(j).unwrap(),await S()},patchGoal:async(j,L)=>{await we({goalId:j,patch:L}).unwrap(),await S()},patchProject:async(j,L)=>{await Ue({projectId:j,patch:L}).unwrap(),await S()},patchTask:async(j,L)=>{await Fe({taskId:j,patch:L}).unwrap(),await S()},patchTaskStatus:async(j,L,Y)=>{await ye(j,L,Y)},openStartWork:(j={})=>{x(j),R(null),g(!0)}};return Oo=Vt,s.jsx(yc,{locale:w.data.settings.localePreference,children:s.jsx(Ao.Provider,{value:Vt,children:s.jsxs(s.Fragment,{children:[s.jsx(Ed,{}),s.jsx(Gp,{routeLocation:pe,onRouteIntent:ne,settings:w.data.settings,timerPending:mt.isLoading||Q.isLoading||W.isLoading,startWorkOpen:m,startWorkPending:Ke.isLoading||st.isPending,startWorkError:y,startWorkDefaults:f,onOpenStartWork:j=>{x(j??{}),R(null),g(!0)},onCloseStartWork:()=>{g(!1),R(null)},onStartExistingTask:async(j,L)=>{try{const Y=w.data.settings.profile.operatorName;await Rt(j,{actor:Y,timerMode:L.timerMode,plannedDurationSeconds:L.plannedDurationSeconds,isCurrent:!0,leaseTtlSeconds:1800,note:"",gitContext:L.gitContext})&&(g(!1),R(null))}catch(Y){R(Y instanceof Error?Y.message:"Could not start work.")}},onCreateAndStartTask:async j=>{try{await st.mutateAsync(j),g(!1),R(null)}catch(L){R(L instanceof Error?L.message:"Could not create and start the task.")}},onFocusRun:async j=>{await tt(j).unwrap(),await S()},onPauseRun:async j=>{const L=V.data.activeTaskRuns.find(Y=>Y.id===j);await D({runId:j,input:{actor:L==null?void 0:L.actor,note:(L==null?void 0:L.note)??""}}).unwrap(),await S()},onCompleteRun:async j=>{const L=V.data.activeTaskRuns.find(Y=>Y.id===j);await C({runId:j,input:{actor:L==null?void 0:L.actor,note:(L==null?void 0:L.note)??""}}).unwrap(),await S()},children:s.jsx("div",{className:"relative min-w-0",children:se?s.jsx(Fr.Provider,{value:se,children:O.node}):O.node})}),s.jsx(yt,{open:p!==null,onOpenChange:j=>{j||T(null)},children:s.jsxs(xt,{children:[s.jsx(bt,{className:"fixed inset-0 z-[70] bg-[rgba(5,8,18,0.74)] backdrop-blur-xl"}),s.jsxs(vt,{className:"fixed left-1/2 top-1/2 z-[71] w-[min(92vw,34rem)] -translate-x-1/2 -translate-y-1/2 rounded-[28px] border border-white/10 bg-[linear-gradient(180deg,rgba(16,22,36,0.98),rgba(9,13,22,0.99))] p-6 shadow-[0_32px_90px_rgba(5,8,18,0.58)]",children:[s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx(wt,{className:"font-display text-[1.35rem] leading-tight text-white",children:"Log today's work before closing"}),s.jsxs(kt,{className:"mt-2 text-sm leading-6 text-white/64",children:["Forge closes tasks from actual time worked today, not from the checkbox itself. Add the time you spent on"," ",s.jsx("span",{className:"font-medium text-white",children:(p==null?void 0:p.title)??"this task"})," ","today, or confirm that you did not work on it today."]})]}),s.jsx(fs,{onClick:()=>T(null)})]}),s.jsxs("div",{className:"mt-5",children:[s.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/40",children:"Quick amounts"}),s.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:[{label:"5m",seconds:300},{label:"15m",seconds:900},{label:"30m",seconds:1800},{label:"1h",seconds:3600},{label:"2h",seconds:7200}].map(j=>s.jsx(de,{variant:"secondary",onClick:()=>{ge(j.seconds)},children:j.label},j.label))})]}),s.jsxs("div",{className:"mt-5 grid gap-3 rounded-[20px] bg-white/[0.04] p-4",children:[s.jsxs("label",{className:"grid gap-2 text-sm text-white/72",children:[s.jsx("span",{className:"text-[11px] uppercase tracking-[0.16em] text-white/40",children:"Custom minutes"}),s.jsx("input",{type:"number",min:0,step:5,value:(p==null?void 0:p.customMinutes)??"",onChange:j=>{T(L=>L&&{...L,customMinutes:j.target.value,error:null})},className:"h-11 rounded-[16px] border border-white/10 bg-white/[0.04] px-3 text-sm text-white outline-none transition focus:border-[var(--primary)]/40 focus:bg-white/[0.06]",placeholder:"45"})]}),p!=null&&p.error?s.jsx("div",{className:"text-sm text-rose-200",children:p.error}):null]}),s.jsxs("div",{className:"mt-5 flex flex-wrap justify-end gap-3",children:[s.jsx(de,{variant:"secondary",onClick:()=>T(null),children:"Cancel"}),s.jsx(de,{variant:"secondary",onClick:()=>{ge(0)},children:"No work today"}),s.jsx(de,{onClick:()=>{if(!p)return;const j=Number(p.customMinutes);if(!Number.isFinite(j)||j<0){T(L=>L&&{...L,error:"Enter a valid number of minutes."});return}ge(Math.round(j*60))},children:"Close with logged time"})]})]})]})}),h!=null&&h.focusNode?s.jsx("div",{className:"pointer-events-none fixed inset-y-0 right-0 z-[64] hidden lg:flex lg:max-w-[min(30rem,calc(100vw-4rem))] lg:items-start lg:justify-end lg:p-4",children:s.jsx("div",{className:"pointer-events-auto h-full w-[min(30rem,calc(100vw-4rem))] max-w-full overflow-hidden rounded-[28px] border border-white/10 bg-[linear-gradient(180deg,rgba(8,12,20,0.82),rgba(8,12,20,0.94))] pt-[calc(var(--forge-shell-desktop-header-padding-top)+4.8rem)] shadow-[0_24px_80px_rgba(5,8,18,0.42)] backdrop-blur-xl",children:s.jsx("div",{className:"h-full min-h-0 overflow-hidden",children:s.jsx(pu,{focus:h,onOpenPage:j=>{j.href&&t(j.href)},onOpenNotes:j=>{const L=Ip(j);L&&t(L)},onOpenHierarchy:Ie,onSelectNode:Te,onClose:()=>Te(null)})})})}):null,s.jsx(_d,{xpNotice:_,celebrations:X,onSeen:j=>{E.isLoading||A.has(j)||(I(L=>{const Y=new Set(L);return Y.add(j),Y}),te(j).unwrap().catch(()=>{I(L=>{const Y=new Set(L);return Y.delete(j),Y})}))}})]})})})}function Jp(){const e=c.useContext(Ao),t=Il(),a=e??t??Oo;if(!a)throw new Error("Forge shell context is unavailable.");return a}function Xp(e,t){return[{id:"ap",label:"AP",compactValue:e.lifeForce?String(Math.round(e.lifeForce.remainingAp)):"0",expandedValue:e.lifeForce?`${Math.round(e.lifeForce.remainingAp)} AP left`:"AP unavailable",icon:Mi},{id:"instant-ap",label:"Instant AP/h",compactValue:e.lifeForce?String(Number(e.lifeForce.instantFreeApPerHour.toFixed(1))):"0",expandedValue:e.lifeForce?Ym(e.lifeForce.instantFreeApPerHour):"0 AP/h",icon:Ws},{id:"streak",label:t("common.shell.momentum.streak"),compactValue:String(e.metrics.streakDays),expandedValue:t(e.metrics.streakDays===1?"common.shell.momentum.streakBadgeOne":"common.shell.momentum.streakBadgeOther",{count:e.metrics.streakDays}),icon:Si},{id:"xp",label:t("common.shell.momentum.xp"),compactValue:String(e.metrics.totalXp),expandedValue:`${e.metrics.totalXp} XP`,icon:us},{id:"momentum",label:t("common.shell.momentum.momentum"),compactValue:`${e.metrics.momentumScore}%`,expandedValue:t("common.shell.momentum.liveMomentum",{count:e.metrics.momentumScore}),icon:El}]}function dt(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}function Qp(...e){for(const t of e)if(typeof t=="string")return t;return""}function Yp(...e){for(const t of e){if(typeof t=="number"&&Number.isFinite(t))return t;if(typeof t=="string"){const a=Number(t);if(Number.isFinite(a))return a}}return null}function Zp(...e){for(const t of e){if(Array.isArray(t)){const a=t.filter(n=>typeof n=="string"&&n.trim().length>0);if(a.length>0)return a;continue}if(typeof t=="string"){const a=t.trim();if(!a)continue;try{const n=JSON.parse(a);if(Array.isArray(n)){const r=n.filter(o=>typeof o=="string"&&o.trim().length>0);if(r.length>0)return r}}catch{const n=a.split(",").map(r=>r.trim()).filter(r=>r.length>0);if(n.length>0)return n}}}return[]}function eh(e,t,a){const n={};return(a.length>0?a:[{key:"summary"}]).forEach((o,i)=>{const l=t&&o.key in t?t[o.key]:i===0||o.key==="summary"?e:null;n[o.key]={text:typeof l=="string"?l:Array.isArray(l)||dt(l)?JSON.stringify(l,null,2):String(l??""),json:dt(l)}}),n}function th(e,t,a){var o;const n=e.output??[];if(!t&&n.length===0)return null;const r=t?{...t}:{};if(n.length>0){const i=(o=n[0])==null?void 0:o.key;i&&!(i in r)&&(r[i]=a),n.some(l=>l.key==="summary")&&!("summary"in r)&&(r.summary=a)}return r}function rt(e,t){const a=th(e.definition,t.output,t.primaryText);return{primaryText:t.primaryText,payload:a,logs:t.logs??[],outputMap:eh(t.primaryText,a,e.definition.output)}}function ce(e,t,a,n){return rt(e,{primaryText:a??`${e.definition.title}
9
+ ${e.definition.description}
10
+ Route: ${e.definition.routePath??"n/a"}`,output:t,logs:n})}function sh(e,t,a){const n=Math.max(1,Math.min(50,Math.round(a.limit??12))),r=e.services.entities.search({searches:[{query:a.query,entityTypes:a.entityTypes,limit:n}]}).results[0],o=r!=null&&r.ok?r.matches??[]:[],i=o.slice(0,n).map(l=>{const u=typeof l.title=="string"?l.title:typeof l.name=="string"?l.name:typeof l.id=="string"?l.id:"Untitled";return`${typeof l.entityType=="string"?l.entityType:"entity"}: ${u}`});return{title:t.title,matches:o,summaryText:i.length>0?i.join(`
11
+ `):`No ${t.title.toLowerCase()} matches found.`,limit:n,query:a.query}}function _e(e,t){const a=Qp(e.inputs.query,e.params.query,t.query).trim(),n=Zp(e.inputs.entityTypes,e.params.entityTypes,t.entityTypes),r=Yp(e.inputs.limit,e.params.limit,t.limit)??t.limit??12,o=sh(e.context,e.definition,{query:a,entityTypes:n,limit:r});return rt(e,{primaryText:o.summaryText,output:{summary:o.summaryText,matches:o.matches,matchCount:o.matches.length}})}function ah(e){var a,n;const t=((n=(a=e.context.services.movement).listPlaces)==null?void 0:n.call(a))??[];return rt(e,{primaryText:t.length>0?t.slice(0,24).map(r=>typeof r.label=="string"?r.label:typeof r.name=="string"?r.name:typeof r.id=="string"?r.id:"Place").join(`
12
+ `):"No known places are stored yet.",output:{summary:t.length>0?`${t.length} place${t.length===1?"":"s"} available.`:"No known places are stored yet.",places:t}})}function ln(e){var a,n;const t=((n=(a=e.context.services.health).getSleepViewData)==null?void 0:n.call(a))??null;return rt(e,{primaryText:t&&typeof t=="object"?"Sleep history and derived patterns are available.":"No sleep data is available.",output:t&&typeof t=="object"?{summary:"Sleep history and derived patterns are available.",sleepView:t}:{summary:"No sleep data is available."}})}function cn(e){var a,n;const t=((n=(a=e.context.services.health).getFitnessViewData)==null?void 0:n.call(a))??null;return rt(e,{primaryText:t&&typeof t=="object"?"Workout history and composition are available.":"No sports data is available.",output:t&&typeof t=="object"?{summary:"Workout history and composition are available.",sportsView:t}:{summary:"No sports data is available."}})}function nh(e){var r,o;const t=((o=(r=e.context.services.overview).getContext)==null?void 0:o.call(r))??null,a=dt(t),n=a?[`Projects: ${Array.isArray(a.projects)?a.projects.length:0}`,`Goals: ${Array.isArray(a.activeGoals)?a.activeGoals.length:0}`,`Top tasks: ${Array.isArray(a.topTasks)?a.topTasks.length:0}`,`Due habits: ${Array.isArray(a.dueHabits)?a.dueHabits.length:0}`].join(`
13
+ `):"No overview context is available.";return rt(e,{primaryText:n,output:a?{summary:n,context:a}:{summary:n}})}function $o(e){var i,l;const t=((l=(i=e.context.services.overview).getInsights)==null?void 0:l.call(i))??null,a=dt(t),n=dt(a==null?void 0:a.status),r=dt(a==null?void 0:a.coaching),o=a?[typeof(n==null?void 0:n.systemStatus)=="string"?n.systemStatus:"Insights ready",typeof(r==null?void 0:r.title)=="string"?r.title:null,typeof(r==null?void 0:r.summary)=="string"?r.summary:null].filter(Boolean).join(`
14
+ `):"No insights payload is available.";return rt(e,{primaryText:o,output:a?{summary:o,insights:a}:{summary:o}})}function rh(e){var o,i;const t=((i=(o=e.context.services.overview).getWeeklyReview)==null?void 0:i.call(o))??null,a=dt(t),n=dt(a==null?void 0:a.momentumSummary),r=a?[typeof a.windowLabel=="string"?a.windowLabel:"Weekly review",typeof(n==null?void 0:n.totalXp)=="number"?`${n.totalXp} XP`:null,typeof(n==null?void 0:n.focusHours)=="number"?`${n.focusHours} focus hours`:null].filter(Boolean).join(`
15
+ `):"No weekly review payload is available.";return rt(e,{primaryText:r,output:a?{summary:r,weeklyReview:a}:{summary:r}})}function ih(e){var n,r;const t=((r=(n=e.context.services.wiki).listPages)==null?void 0:r.call(n))??[],a=t.length>0?t.slice(0,12).map(o=>typeof o.title=="string"?o.title:typeof o.slug=="string"?o.slug:typeof o.id=="string"?o.id:"Wiki page").join(`
16
+ `):"No wiki pages are available.";return rt(e,{primaryText:a,output:{summary:a,pages:t}})}function oh(e){var i,l;const t=((l=(i=e.context.services.wiki).getHealth)==null?void 0:l.call(i))??null,a=dt(t),n=Array.isArray(a==null?void 0:a.unresolvedLinks)?a.unresolvedLinks.length:null,r=Array.isArray(a==null?void 0:a.orphanPages)?a.orphanPages.length:null,o=a?["Wiki health summary",n!==null?`${n} unresolved links`:null,r!==null?`${r} orphan pages`:null].filter(Boolean).join(`
17
+ `):"No wiki health payload is available.";return rt(e,{primaryText:o,output:a?{summary:o,health:a}:{summary:o}})}const lh=["text","number","boolean","object","array","json","tool","summary","entity","entity_list","context","metrics","filters","markdown","timeline","selection","record","record_list"],ch={goal:[{key:"id",label:"Id",kind:"text",required:!0},{key:"title",label:"Title",kind:"text",required:!0},{key:"status",label:"Status",kind:"text"},{key:"horizon",label:"Horizon",kind:"text"}],project:[{key:"id",label:"Id",kind:"text",required:!0},{key:"title",label:"Title",kind:"text",required:!0},{key:"status",label:"Status",kind:"text"},{key:"goalId",label:"Goal id",kind:"text"}],task:[{key:"id",label:"Id",kind:"text",required:!0},{key:"title",label:"Title",kind:"text",required:!0},{key:"status",label:"Status",kind:"text"},{key:"priority",label:"Priority",kind:"text"},{key:"projectId",label:"Project id",kind:"text"}],strategy:[{key:"id",label:"Id",kind:"text",required:!0},{key:"title",label:"Title",kind:"text",required:!0},{key:"status",label:"Status",kind:"text"},{key:"overview",label:"Overview",kind:"markdown"}],habit:[{key:"id",label:"Id",kind:"text",required:!0},{key:"title",label:"Title",kind:"text",required:!0},{key:"status",label:"Status",kind:"text"},{key:"frequency",label:"Frequency",kind:"text"},{key:"polarity",label:"Polarity",kind:"text"}],note:[{key:"id",label:"Id",kind:"text",required:!0},{key:"title",label:"Title",kind:"text",required:!0},{key:"summary",label:"Summary",kind:"markdown"},{key:"kind",label:"Kind",kind:"text"},{key:"updatedAt",label:"Updated at",kind:"text"}],insight:[{key:"id",label:"Id",kind:"text",required:!0},{key:"title",label:"Title",kind:"text",required:!0},{key:"summary",label:"Summary",kind:"markdown"},{key:"status",label:"Status",kind:"text"}],calendar_event:[{key:"id",label:"Id",kind:"text",required:!0},{key:"title",label:"Title",kind:"text",required:!0},{key:"startsAt",label:"Starts at",kind:"text"},{key:"endsAt",label:"Ends at",kind:"text"},{key:"origin",label:"Origin",kind:"text"}],wiki_page:[{key:"id",label:"Id",kind:"text",required:!0},{key:"title",label:"Title",kind:"text",required:!0},{key:"slug",label:"Slug",kind:"text"},{key:"summary",label:"Summary",kind:"markdown"}],sleep_session:[{key:"id",label:"Id",kind:"text",required:!0},{key:"startAt",label:"Start",kind:"text"},{key:"endAt",label:"End",kind:"text"},{key:"totalSleepMinutes",label:"Total sleep minutes",kind:"number"}],workout_session:[{key:"id",label:"Id",kind:"text",required:!0},{key:"type",label:"Type",kind:"text"},{key:"startedAt",label:"Started at",kind:"text"},{key:"durationMinutes",label:"Duration minutes",kind:"number"}]},dh={WorkbenchUserMessage:[{key:"message",label:"Message",kind:"text",required:!0}],WorkbenchUserContext:[{key:"context",label:"Context",kind:"record"}],WorkbenchMergedContext:[{key:"merged",label:"Merged",kind:"record",required:!0}],WorkbenchTemplateOutput:[{key:"rendered",label:"Rendered",kind:"markdown",required:!0}],WorkbenchSelectedValue:[{key:"selected",label:"Selected",kind:"record",required:!0}],WorkbenchPublishedOutput:[{key:"published",label:"Published",kind:"record",required:!0}],WeeklyReviewPayload:[{key:"wins",label:"Wins",kind:"record_list"},{key:"trends",label:"Trends",kind:"record_list"}],InsightsPayload:[{key:"insights",label:"Insights",kind:"record_list"},{key:"heatmap",label:"Heatmap",kind:"record_list"}],OperatorOverviewPayload:[{key:"summary",label:"Summary",kind:"markdown"},{key:"currentWork",label:"Current work",kind:"record_list"}],OperatorContextPayload:[{key:"tasks",label:"Tasks",kind:"record_list"},{key:"focus",label:"Focus",kind:"record_list"}],SleepViewData:[{key:"sessions",label:"Sessions",kind:"record_list"},{key:"metrics",label:"Metrics",kind:"metrics"}]};function uh(e){var r,o,i;const t=(r=e.kind)==null?void 0:r.trim().toLowerCase();if(t&&lh.includes(t))return t;const a=((o=e.key)==null?void 0:o.trim().toLowerCase())??"",n=((i=e.modelName)==null?void 0:i.trim().toLowerCase())??"";return t==="content"?a==="summary"||n.includes("summary")?"summary":a==="answer"||a==="rendered"||n.includes("answer")||n.includes("markdown")||n.includes("template")?"markdown":a==="message"||a==="query"||a==="title"||n.includes("message")?"text":e.itemKind?"entity_list":"record":a.endsWith("count")||a==="limit"?"number":a==="summary"?"summary":a==="answer"||a==="rendered"?"markdown":a==="message"||a==="query"?"text":e.itemKind?"entity_list":"record"}function dn(e){return e?ch[e]??[]:[]}function un(e){return e?dh[e]??[]:[]}function mn(e){const t=uh(e),a=dn(e.itemKind),n=un(e.modelName),r=e.shape&&e.shape.length>0?e.shape:a.length>0?a:n;return{...e,kind:t,shape:r.length>0?r:[]}}function ks(e){return e.map(t=>mn(t))}function mh(e,t){return Object.assign(e,{workbench:{...t,WebView:e}})}function Mo(e){return e.split(/[^a-zA-Z0-9]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}function ds(e){const t=e.itemKind?dn(e.itemKind):[],a=e.modelName?un(e.modelName):[];return mn({key:e.key,label:e.label,kind:e.kind,description:e.description,required:e.required??!1,modelName:e.modelName,itemKind:e.itemKind,shape:e.shape??(t.length>0?t:a),exampleValue:e.exampleValue})}function ca(e){const t=e.itemKind?dn(e.itemKind):[],a=e.modelName?un(e.modelName):[];return mn({key:e.key,label:e.label,kind:e.kind,description:e.description,required:e.required??!1,modelName:e.modelName,itemKind:e.itemKind,shape:e.shape??(t.length>0?t:a),exampleValue:e.exampleValue})}function da(e){return{key:e.key,label:e.label,kind:e.kind,description:e.description,required:e.required??!1,options:e.options}}function H(e){return ds({key:"summary",label:(e==null?void 0:e.label)??"Summary",kind:"summary",description:(e==null?void 0:e.description)??"Human-readable summary of what this node currently knows or produced.",modelName:"WorkbenchSummary",exampleValue:e==null?void 0:e.exampleValue})}function Ae(e){const t=Mo(e.itemKind);return[H({label:e.summaryLabel??"Search summary",description:`Compact summary of the current ${e.itemLabel.toLowerCase()} search results.`}),ds({key:e.collectionKey??"matches",label:e.collectionLabel??`${e.itemLabel} matches`,kind:"entity_list",description:`Structured ${e.itemLabel.toLowerCase()} records returned by Forge search.`,modelName:`${t}SearchResults`,itemKind:e.itemKind,exampleValue:`[{"id":"...","title":"Example ${e.itemLabel}"}]`}),ds({key:"matchCount",label:"Match count",kind:"number",description:"Number of records returned by the search.",modelName:`${t}SearchCount`,exampleValue:"12"})]}function De(e){const t=Mo(e.itemKind);return[ca({key:"query",label:"Query",kind:"text",description:`Search text for narrowing ${e.itemLabel.toLowerCase()} results.`,modelName:`${t}SearchQuery`,exampleValue:"backlog"}),ca({key:"entityTypes",label:"Entity types",kind:"array",description:"Entity types to include in the Forge search.",modelName:`${t}SearchEntityTypes`,exampleValue:JSON.stringify(e.defaultEntityTypes??[e.itemKind])}),ca({key:"limit",label:"Limit",kind:"number",description:"Maximum number of results to request.",modelName:`${t}SearchLimit`,exampleValue:String(e.defaultLimit??20)})]}function $e(e){return[da({key:"query",label:"Default query",kind:"text",description:"Used when no query input edge is connected."}),da({key:"entityTypes",label:"Default entity types",kind:"array",description:"Used when no entity types input edge is connected. Enter a JSON array or comma-separated values."}),da({key:"limit",label:"Default limit",kind:"number",description:"Used when no limit input edge is connected."})]}function Se(e){return ds({key:e.key,label:e.label,kind:"context",description:e.description,modelName:e.modelName,shape:e.shape,exampleValue:e.exampleValue})}function Fo(e){return ds({key:e.key,label:e.label,kind:"record_list",description:e.description,modelName:e.modelName,itemKind:e.itemKind,exampleValue:e.exampleValue})}function Pe(e){return{key:"forge.search_entities",label:"Search Forge entities",description:e,accessMode:"read",argsSchema:{type:"object",properties:{query:{type:"string",description:"Search text to match against Forge entities."},entityTypes:{type:"array",items:{type:"string"},description:"Optional entity types to narrow the search."},limit:{type:"number",description:"Maximum number of results to return."}}}}}function Os(e){return{key:"forge.create_note",label:"Create note",description:e,accessMode:"write",argsSchema:{type:"object",properties:{title:{type:"string",description:"Title of the note to create."},summary:{type:"string",description:"Optional short summary for the note."},markdown:{type:"string",description:"Markdown content that should become the note body."}}}}}function Ls(e){return{key:"forge.update_task_status",label:"Move task",description:e,accessMode:"write",argsSchema:{type:"object",properties:{taskId:{type:"string",description:"Task id to update."},status:{type:"string",description:"New Forge task status.",enum:["backlog","focus","in_progress","blocked","done"]}}}}}function ph(e){return[e.kind,e.modelName,e.itemKind?`item:${e.itemKind}`:null].filter(Boolean).join(" · ")}function xi({title:e,ports:t,align:a}){return s.jsxs("div",{className:"grid gap-1.5",children:[s.jsxs("div",{className:P("flex items-center gap-1 text-[10px] uppercase tracking-[0.18em] text-white/34",a==="left"?"text-left":"text-right"),children:[s.jsx("span",{children:e}),s.jsx(Dt,{content:a==="left"?"Inputs are values this box expects from upstream nodes.":"Outputs are values this box publishes for downstream nodes.",label:a==="left"?"Explain box inputs":"Explain box outputs"})]}),t.length===0?s.jsx("div",{className:"rounded-full border border-dashed border-white/10 px-3 py-1.5 text-[11px] text-white/28",children:"None"}):null,t.map(n=>s.jsxs("div",{className:P("relative rounded-[16px] bg-white/[0.05] px-3 py-2 text-[11px] text-white/62",a==="left"?"pl-5 text-left":"pr-5 text-right"),children:[s.jsx(dc,{type:a==="left"?"target":"source",position:a==="left"?zr.Left:zr.Right,id:n.key,className:"!size-2.5 !border !border-white/80 !bg-[#b8c5ff]",style:{[a]:6}}),s.jsx("div",{children:n.label}),s.jsx("div",{className:"mt-1 text-[10px] text-white/38",children:ph(n)})]},n.key))]})}function he(e){return function(a){const[n,r]=c.useState(!1);return s.jsxs("div",{className:"min-w-[280px] rounded-[24px] border border-white/10 bg-[linear-gradient(180deg,rgba(20,28,45,0.98),rgba(11,16,29,0.98))] p-3 shadow-[0_26px_80px_rgba(0,0,0,0.4)]",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"truncate text-sm font-semibold text-white",children:e.title}),s.jsx("div",{className:"mt-1 line-clamp-2 text-[12px] leading-5 text-white/48",children:e.description})]}),s.jsx("div",{className:"rounded-full bg-white/[0.06] px-2.5 py-1 text-[10px] uppercase tracking-[0.16em] text-white/56",children:"box"})]}),e.params.length>0?s.jsxs("div",{className:"mt-3 rounded-[18px] bg-white/[0.04] px-3 py-2 text-[11px] text-white/52",children:[e.params.length," param",e.params.length===1?"":"s"," configurable in the flow editor"]}):null,e.tools.length>0?s.jsxs("div",{className:"mt-2 rounded-[18px] bg-white/[0.04] px-3 py-2 text-[11px] text-white/52",children:[e.tools.length," tool",e.tools.length===1?"":"s"," available"]}):null,s.jsx("div",{className:"mt-2",children:s.jsx("button",{type:"button",className:"rounded-full bg-white/[0.05] px-3 py-1.5 text-[11px] text-white/56 transition hover:bg-white/[0.08] hover:text-white",onClick:()=>r(o=>!o),children:n?"Hide schema":"Preview schema"})}),s.jsxs("div",{className:"mt-3 grid grid-cols-[minmax(0,1fr)_minmax(0,1fr)] gap-3",children:[s.jsx(xi,{title:"Inputs",ports:e.inputs,align:"left"}),s.jsx(xi,{title:"Outputs",ports:e.output,align:"right"})]}),n?s.jsxs("div",{className:"mt-3 rounded-[18px] border border-white/8 bg-black/20 p-3",children:[s.jsxs("div",{className:"flex items-center gap-2 text-[10px] uppercase tracking-[0.18em] text-white/38",children:[s.jsx("span",{children:"Box contract"}),s.jsx(Dt,{content:"This preview summarizes what the box consumes, publishes, and what tools it can expose to AI nodes.",label:"Explain box contract preview"})]}),s.jsx("pre",{className:"mt-2 overflow-auto whitespace-pre-wrap text-[11px] leading-5 text-white/64",children:JSON.stringify({inputs:e.inputs.map(({key:o,kind:i,required:l,description:u,modelName:h,itemKind:m,shape:g,exampleValue:f})=>({key:o,kind:i,required:!!l,description:u,modelName:h,itemKind:m,shape:g,exampleValue:f})),outputs:e.output.map(({key:o,kind:i,required:l,description:u,modelName:h,itemKind:m,shape:g,exampleValue:f})=>({key:o,kind:i,required:!!l,description:u,modelName:h,itemKind:m,shape:g,exampleValue:f})),tools:e.tools.map(({key:o,accessMode:i,argsSchema:l})=>({key:o,accessMode:i,argsSchema:l}))},null,2)})]}):null]})}}function hh(e){const t=new Date(e.getFullYear(),e.getMonth(),1),a=(t.getDay()+6)%7,n=new Date(t);return n.setDate(n.getDate()-a),Array.from({length:35},(r,o)=>{const i=new Date(n);return i.setDate(n.getDate()+o),i})}function gh(e,t){return typeof window>"u"?t:window.localStorage.getItem(e)??t}function fh(e,t){typeof window>"u"||window.localStorage.setItem(e,t)}function pn({compact:e}){const[t,a]=c.useState(()=>new Date);return c.useEffect(()=>{const n=window.setInterval(()=>a(new Date),3e4);return()=>window.clearInterval(n)},[]),s.jsxs("div",{className:"flex h-full flex-col justify-between gap-4 rounded-[20px] bg-white/[0.03] p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 text-white/45",children:[s.jsx(Di,{className:"size-4"}),s.jsx("span",{className:"text-[12px] uppercase tracking-[0.16em]",children:"Local time"})]}),s.jsx("div",{className:P("font-display text-white",e?"text-3xl":"text-5xl"),children:new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit"}).format(t)}),s.jsx("div",{className:"text-sm text-white/58",children:new Intl.DateTimeFormat(void 0,{weekday:"long",month:"long",day:"numeric"}).format(t)})]})}function hn({compact:e}){const t=new Date,a=c.useMemo(()=>hh(t),[t]),n=e?["M","T","W","T","F","S","S"]:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];return s.jsxs("div",{className:"grid gap-3 rounded-[20px] bg-white/[0.03] p-4",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm text-white",children:[s.jsx($t,{className:"size-4 text-[var(--primary)]"}),new Intl.DateTimeFormat(void 0,{month:"long",year:"numeric"}).format(t)]}),s.jsx("div",{className:"text-[12px] text-white/45",children:e?"Mini":"Month view"})]}),s.jsxs("div",{className:"grid grid-cols-7 gap-1.5",children:[n.map(r=>s.jsx("div",{className:"text-center text-[11px] uppercase tracking-[0.14em] text-white/35",children:r},r)),a.map(r=>{const o=r.getMonth()===t.getMonth(),i=r.toDateString()===t.toDateString();return s.jsx("div",{className:P("flex min-h-9 items-center justify-center rounded-xl text-sm",i?"bg-[var(--primary)] text-slate-950":o?"bg-white/[0.04] text-white/78":"bg-transparent text-white/24"),children:r.getDate()},r.toISOString())})]})]})}function gn({surfaceId:e}){const t=`forge.utility.spotify.${e}`,[a,n]=c.useState(()=>gh(t,"https://open.spotify.com/"));return c.useEffect(()=>{fh(t,a)},[t,a]),s.jsxs("div",{className:"grid h-full gap-3 rounded-[20px] bg-white/[0.03] p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 text-white",children:[s.jsx(Al,{className:"size-4 text-[var(--secondary)]"}),s.jsx("span",{className:"text-sm font-semibold",children:"Spotify link"})]}),s.jsx("input",{value:a,onChange:r=>n(r.target.value),className:"w-full rounded-2xl border border-white/10 bg-white/[0.04] px-3 py-2.5 text-sm text-white outline-none transition focus:border-[rgba(192,193,255,0.35)]",placeholder:"Paste a playlist, album, or artist URL"}),s.jsxs("a",{href:a,target:"_blank",rel:"noreferrer",className:"inline-flex min-h-10 items-center justify-center gap-2 rounded-2xl bg-[rgba(78,222,163,0.14)] px-3 py-2 text-sm font-medium text-[var(--secondary)] transition hover:bg-[rgba(78,222,163,0.22)]",children:["Open Spotify",s.jsx(pa,{className:"size-4"})]})]})}function fn({compact:e}){const[t,a]=c.useState(null),[n,r]=c.useState("Locating…");return c.useEffect(()=>{if(typeof navigator>"u"||!navigator.geolocation){r("Location unavailable");return}let o=!1;return navigator.geolocation.getCurrentPosition(async i=>{try{const u=await(await fetch(`https://api.open-meteo.com/v1/forecast?latitude=${i.coords.latitude}&longitude=${i.coords.longitude}&current=temperature_2m,weather_code`)).json();if(o||!u.current)return;a({temperature:Number(u.current.temperature_2m??0),weatherCode:Number(u.current.weather_code??0)}),r("Live")}catch{o||r("Weather unavailable")}},()=>{o||r("Permission denied")},{maximumAge:3e5,timeout:6e3}),()=>{o=!0}},[]),s.jsxs("div",{className:"flex h-full flex-col justify-between gap-4 rounded-[20px] bg-white/[0.03] p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 text-white",children:[s.jsx(Ol,{className:"size-4 text-[var(--tertiary)]"}),s.jsx("span",{className:"text-sm font-semibold",children:"Weather"})]}),t?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:P("font-display text-white",e?"text-3xl":"text-5xl"),children:[Math.round(t.temperature),"°"]}),s.jsxs("div",{className:"text-sm text-white/58",children:["Code ",t.weatherCode," · ",n]})]}):s.jsx("div",{className:"text-sm text-white/58",children:n})]})}function yn({compact:e,defaultUserId:t}){const a=ms(),n=c.useRef(null),r=c.useRef(null),[o,i]=c.useState(""),[l,u]=c.useState(""),h=cs({mutationFn:async()=>Vc({contentMarkdown:`# ${o.trim()||"Quick note"}
18
+
19
+ ${l.trim()}`,author:"Forge quick capture",userId:t??null,links:[]}),onSuccess:async()=>{i(""),u(""),await a.invalidateQueries({queryKey:["notes-index"]})}}),m=cs({mutationFn:async()=>Jc({title:o.trim()||"Quick capture",contentMarkdown:l.trim(),summary:l.trim().slice(0,180),author:"Forge quick capture"}),onSuccess:async()=>{i(""),u(""),await a.invalidateQueries({queryKey:["wiki-pages"]})}});function g(f,x=f){const y=r.current;if(!y)return;const R=y.selectionStart??0,p=y.selectionEnd??0,T=l.slice(R,p),_=`${l.slice(0,R)}${f}${T}${x}${l.slice(p)}`;u(_),requestAnimationFrame(()=>{y.focus(),y.selectionStart=R+f.length,y.selectionEnd=p+f.length})}return s.jsxs("div",{className:"grid h-full min-h-0 gap-3 rounded-[20px] bg-white/[0.03] p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 text-white",children:[s.jsx(It,{className:"size-4 text-[var(--primary)]"}),s.jsx("span",{className:"text-sm font-semibold",children:"Quick capture"})]}),s.jsx("input",{ref:n,value:o,onChange:f=>i(f.target.value),className:"w-full rounded-2xl border border-white/10 bg-white/[0.04] px-3 py-2.5 text-sm text-white outline-none transition focus:border-[rgba(192,193,255,0.35)]",placeholder:"Title"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:[{label:"B",action:()=>g("**")},{label:"I",action:()=>g("_")},{label:"H1",action:()=>g("# ","")},{label:"[]",action:()=>g("- [ ] ","")}].map(f=>s.jsx("button",{type:"button",className:"inline-flex min-h-8 items-center justify-center rounded-xl bg-white/[0.05] px-2.5 text-[12px] font-semibold text-white/72 transition hover:bg-white/[0.08] hover:text-white",onClick:f.action,children:f.label},f.label))}),s.jsx("textarea",{ref:r,value:l,onChange:f=>u(f.target.value),className:P("min-h-0 w-full rounded-[20px] border border-white/10 bg-white/[0.04] px-3 py-3 text-sm text-white outline-none transition focus:border-[rgba(192,193,255,0.35)]",e?"h-28":"h-40"),placeholder:"Write a quick note or rough wiki draft"}),s.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[s.jsxs("button",{type:"button",className:"inline-flex min-h-10 items-center justify-center gap-2 rounded-2xl bg-[rgba(192,193,255,0.16)] px-3 py-2 text-sm font-medium text-[var(--primary)] transition hover:bg-[rgba(192,193,255,0.24)] disabled:opacity-50",disabled:!l.trim()||h.isPending,onClick:()=>h.mutate(),children:[s.jsx(Ll,{className:"size-4"}),"Save as note"]}),s.jsxs("button",{type:"button",className:"inline-flex min-h-10 items-center justify-center gap-2 rounded-2xl bg-[rgba(255,185,95,0.16)] px-3 py-2 text-sm font-medium text-[var(--tertiary)] transition hover:bg-[rgba(255,185,95,0.24)] disabled:opacity-50",disabled:!l.trim()||m.isPending,onClick:()=>m.mutate(),children:[s.jsx(It,{className:"size-4"}),"Save as wiki"]})]})]})}const yh={id:"surface:utility:time",surfaceId:"utility",routePath:null,title:"Clock",icon:"timer",description:"Live local time widget.",category:"Utilities",tags:["utility","clock"],inputs:[],params:[],output:[H({label:"Current time",description:"Formatted local time string published by the clock widget."}),Se({key:"clock",label:"Clock state",description:"Structured clock state including the current ISO timestamp.",modelName:"ForgeClockState"})],tools:[],NodeView:he({title:"Clock",description:"Live local time widget.",inputs:[],params:[],output:[H({label:"Current time",description:"Formatted local time string published by the clock widget."}),Se({key:"clock",label:"Clock state",description:"Structured clock state including the current ISO timestamp.",modelName:"ForgeClockState"})],tools:[]}),WebView:pn,execute:e=>ce(e,{clock:{now:e.context.now}},new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit"}).format(new Date(e.context.now)))};pn.workbench=yh;const xh={id:"surface:utility:mini-calendar",surfaceId:"utility",routePath:null,title:"Mini calendar",icon:"calendar",description:"Compact month calendar widget.",category:"Utilities",tags:["utility","calendar"],inputs:[],params:[],output:[H({label:"Month view",description:"Summary of the compact month calendar widget."}),Se({key:"calendarView",label:"Calendar view",description:"Structured mini-calendar state including the current month anchor.",modelName:"ForgeMiniCalendarView"})],tools:[],NodeView:he({title:"Mini calendar",description:"Compact month calendar widget.",inputs:[],params:[],output:[H({label:"Month view",description:"Summary of the compact month calendar widget."}),Se({key:"calendarView",label:"Calendar view",description:"Structured mini-calendar state including the current month anchor.",modelName:"ForgeMiniCalendarView"})],tools:[]}),WebView:hn,execute:e=>ce(e,{calendarView:{now:e.context.now}},"Compact month calendar")};hn.workbench=xh;const bh={id:"surface:utility:spotify",surfaceId:"utility",routePath:null,title:"Spotify",icon:"music",description:"Pinned music link widget.",category:"Utilities",tags:["utility","spotify"],inputs:[{key:"surfaceId",label:"Surface id",kind:"text",required:!1}],params:[],output:[H({label:"Spotify link",description:"Summary of the pinned music link widget."}),Se({key:"spotifyLink",label:"Spotify state",description:"Structured Spotify widget state and pinned surface context.",modelName:"ForgeSpotifyWidgetState"})],tools:[],NodeView:he({title:"Spotify",description:"Pinned music link widget.",inputs:[{key:"surfaceId",label:"Surface id",kind:"text"}],params:[],output:[H({label:"Spotify link",description:"Summary of the pinned music link widget."}),Se({key:"spotifyLink",label:"Spotify state",description:"Structured Spotify widget state and pinned surface context.",modelName:"ForgeSpotifyWidgetState"})],tools:[]}),WebView:gn,execute:e=>ce(e,{spotifyLink:{surfaceId:e.inputs.surfaceId??null}},"Pinned Spotify link")};gn.workbench=bh;const vh={id:"surface:utility:weather",surfaceId:"utility",routePath:null,title:"Weather",icon:"weather",description:"Location-aware weather widget.",category:"Utilities",tags:["utility","weather"],inputs:[],params:[],output:[H({label:"Weather summary",description:"Summary of the weather widget state."}),Se({key:"weather",label:"Weather payload",description:"Structured weather widget payload.",modelName:"ForgeWeatherWidgetState"})],tools:[],NodeView:he({title:"Weather",description:"Location-aware weather widget.",inputs:[],params:[],output:[H({label:"Weather summary",description:"Summary of the weather widget state."}),Se({key:"weather",label:"Weather payload",description:"Structured weather widget payload.",modelName:"ForgeWeatherWidgetState"})],tools:[]}),WebView:fn,execute:e=>ce(e,{weather:null},"Weather widget")};fn.workbench=vh;const wh={id:"surface:utility:quick-capture",surfaceId:"utility",routePath:null,title:"Quick capture",icon:"capture",description:"Draft a quick note or wiki page.",category:"Capture",tags:["capture","notes"],inputs:[{key:"defaultUserId",label:"Default user id",kind:"text",required:!1}],params:[],output:[H({label:"Draft summary",description:"Summary of the quick-capture draft state."}),Se({key:"draft",label:"Draft context",description:"Structured quick-capture draft context.",modelName:"ForgeQuickCaptureDraft"})],tools:[Os("Create a Forge evidence note from captured markdown.")],NodeView:he({title:"Quick capture",description:"Draft a quick note or wiki page.",inputs:[{key:"defaultUserId",label:"Default user id",kind:"text"}],params:[],output:[H({label:"Draft summary",description:"Summary of the quick-capture draft state."}),Se({key:"draft",label:"Draft context",description:"Structured quick-capture draft context.",modelName:"ForgeQuickCaptureDraft"})],tools:[Os("Create a Forge evidence note from captured markdown.")]}),WebView:yn,execute:e=>ce(e,{draft:{defaultUserId:e.inputs.defaultUserId??null}},"Quick capture can draft notes and wiki pages.")};yn.workbench=wh;function ke(e,t){const a=n=>e(n);return a.displayName=t.title.replace(/\s+/g,""),mh(a,t)}function kh({children:e}){return s.jsx(s.Fragment,{children:e})}function zo(e,t,a,n,r,o){return ke(kh,{id:e,surfaceId:"insights",routePath:"/insights",title:t,icon:"insights",description:a,category:"Insights",tags:n,inputs:[],params:[],output:o,tools:[],NodeView:he({title:t,description:a,inputs:[],params:[],output:o,tools:[]}),execute:r})}const jh=zo("surface:insights:feed","Insights feed","Current coaching feed, status summary, and evidence-backed insight stream.",["insights","feed"],e=>$o(e),[H({label:"Insight summary",description:"Summary of the current coaching feed and evidence-backed insight stream."}),Se({key:"insights",label:"Insight payload",description:"Structured status and coaching payload returned by Forge insights.",modelName:"ForgeInsightsPayload"})]),Sh=zo("surface:insights:coaching","Coaching recommendation","Single-action coaching summary for what Forge thinks matters next.",["insights","coaching"],e=>ce(e,{focus:"coaching_recommendation"},"Coaching recommendation surface for the highest-leverage next move."),[H({label:"Coaching recommendation",description:"Summary of the highest-leverage coaching recommendation."})]);function xn({children:e}){return s.jsx(s.Fragment,{children:e})}const qt=De({itemKind:"task",itemLabel:"Task",defaultEntityTypes:["task"],defaultLimit:24}),Bt=$e(),Nh=ke(xn,{id:"surface:kanban-index:summary",surfaceId:"kanban-index",routePath:"/kanban",title:"Kanban summary",icon:"kanban",description:"Board summary and execution posture.",category:"Execution",tags:["kanban","summary"],inputs:qt,params:Bt,output:[H({label:"Kanban summary",description:"Summary of board posture and execution pressure."})],tools:[],NodeView:he({title:"Kanban summary",description:"Board summary and execution posture.",inputs:qt,params:Bt,output:[H({label:"Kanban summary",description:"Summary of board posture and execution pressure."})],tools:[]}),execute:e=>_e(e,{query:"",entityTypes:["task"],limit:24})}),Ph=ke(xn,{id:"surface:kanban-index:filters",surfaceId:"kanban-index",routePath:"/kanban",title:"Kanban filters",icon:"filter",description:"Goal, owner, and tag filters for board scope.",category:"Execution",tags:["kanban","filters"],inputs:qt,params:Bt,output:[H({label:"Filter summary",description:"Summary of the current Kanban filters and scope."})],tools:[Pe("Search Forge entities by query and entity types.")],NodeView:he({title:"Kanban filters",description:"Goal, owner, and tag filters for board scope.",inputs:qt,params:Bt,output:[H({label:"Filter summary",description:"Summary of the current Kanban filters and scope."})],tools:[Pe("Search Forge entities by query and entity types.")]}),execute:e=>_e(e,{query:"",entityTypes:["task"],limit:24})}),Th=ke(xn,{id:"surface:kanban-index:board",surfaceId:"kanban-index",routePath:"/kanban",title:"Kanban board",icon:"board",description:"Task board with move and execution actions.",category:"Execution",tags:["kanban","board","tasks"],inputs:qt,params:Bt,output:Ae({itemKind:"kanban_task",itemLabel:"Kanban task"}),tools:[Pe("Search Forge entities by query and entity types."),Ls("Update a task status.")],NodeView:he({title:"Kanban board",description:"Task board with move and execution actions.",inputs:qt,params:Bt,output:Ae({itemKind:"kanban_task",itemLabel:"Kanban task"}),tools:[Pe("Search Forge entities by query and entity types."),Ls("Update a task status.")]}),execute:e=>_e(e,{query:"",entityTypes:["task"],limit:24})});function Ih({children:e}){return s.jsx(s.Fragment,{children:e})}function bn(e,t,a,n,r,o,i,l){const u=(l==null?void 0:l.inputs)??[],h=(l==null?void 0:l.params)??[];return ke(Ih,{id:e,surfaceId:"calendar",routePath:"/calendar",title:t,icon:"calendar",description:a,category:"Calendar",tags:n,inputs:u,params:h,output:o,tools:i,NodeView:he({title:t,description:a,inputs:u,params:h,output:o,tools:i}),execute:r})}const Ch=bn("surface:calendar:overview","Calendar overview","Main calendar surface for mirrored events, work blocks, and planned timeboxes.",["calendar","overview"],e=>ce(e,{surfaces:["events","work_blocks","timeboxes"]},"Calendar overview spanning mirrored events, work blocks, and timeboxes."),[H({label:"Calendar summary",description:"Summary of mirrored events, work blocks, and timeboxes."})],[]),Rh=bn("surface:calendar:events","Calendar events","Mirrored calendar events and Forge-managed calendar records.",["calendar","events","mirrored"],e=>_e(e,{query:"",entityTypes:["calendar_event"],limit:20}),Ae({itemKind:"calendar_event",itemLabel:"Calendar event"}),[Pe("Search calendar-backed Forge entities and planning records.")],{inputs:De({itemKind:"calendar_event",itemLabel:"Calendar event",defaultEntityTypes:["calendar_event"],defaultLimit:20}),params:$e()}),_h=bn("surface:calendar:planning","Planning blocks","Planned task timeboxes and reusable work block templates.",["calendar","planning","timeboxes"],e=>_e(e,{query:"",entityTypes:["task_timebox","work_block_template"],limit:20}),Ae({itemKind:"calendar_plan",itemLabel:"Planning record"}),[Pe("Search calendar-backed Forge entities and planning records.")],{inputs:De({itemKind:"calendar_plan",itemLabel:"Planning record",defaultEntityTypes:["task_timebox","work_block_template"],defaultLimit:20}),params:$e()});function Eh({children:e}){return s.jsx(s.Fragment,{children:e})}function vn(e,t,a,n,r,o,i=[],l){const u=(l==null?void 0:l.inputs)??[],h=(l==null?void 0:l.params)??[];return ke(Eh,{id:e,surfaceId:"goals",routePath:"/goals",title:t,icon:"goal",description:a,category:"Goals",tags:n,inputs:u,params:h,output:o,tools:i,NodeView:he({title:t,description:a,inputs:u,params:h,output:o,tools:i}),execute:r})}const Ah=vn("surface:goals:hero","Goals hero","Goals page header and long-horizon direction context.",["goals","hero"],e=>ce(e,null,"Goals page header."),[H({label:"Goals summary",description:"High-level goals page framing."})]),Oh=vn("surface:goals:search-results","Goals list and results","Goal browser, linked context, and search results.",["goals","search"],e=>_e(e,{query:"",entityTypes:["goal"],limit:20}),Ae({itemKind:"goal",itemLabel:"Goal"}),[Pe("Search goal entities by query and entity types.")],{inputs:De({itemKind:"goal",itemLabel:"Goal",defaultEntityTypes:["goal"],defaultLimit:20}),params:$e()}),Lh=vn("surface:goals:summary","Goals summary","Goal collection summary and state context.",["goals","summary"],e=>ce(e,null,"Goal collection summary."),[H({label:"Goals summary",description:"Summary of the goal collection and its current state."})]);function Dh({children:e}){return s.jsx(s.Fragment,{children:e})}function wn(e,t,a,n,r,o,i=[],l){const u=(l==null?void 0:l.inputs)??[],h=(l==null?void 0:l.params)??[];return ke(Dh,{id:e,surfaceId:"habits",routePath:"/habits",title:t,icon:"habit",description:a,category:"Habits",tags:n,inputs:u,params:h,output:o,tools:i,NodeView:he({title:t,description:a,inputs:u,params:h,output:o,tools:i}),execute:r})}const $h=wn("surface:habits:hero","Habits hero","Habits page header and recurring execution context.",["habits","hero"],e=>ce(e,null,"Habits page header."),[H({label:"Habits summary",description:"High-level habits page framing."})]),Mh=wn("surface:habits:search-results","Habits list and results","Habit browser, due habits, and recurring check-in context.",["habits","search","check-ins"],e=>_e(e,{query:"",entityTypes:["habit"],limit:20}),Ae({itemKind:"habit",itemLabel:"Habit"}),[Pe("Search habit entities by query and entity types.")],{inputs:De({itemKind:"habit",itemLabel:"Habit",defaultEntityTypes:["habit"],defaultLimit:20}),params:$e()}),Fh=wn("surface:habits:summary","Habits summary","Habit streaks, due state, and collection-level rhythm context.",["habits","summary","streaks"],e=>ce(e,null,"Habit collection summary."),[H({label:"Habit summary",description:"Summary of habit streaks, due state, and collection rhythm."})]);function zh({children:e}){return s.jsx(s.Fragment,{children:e})}function Gt(e){return ke(zh,{id:e.id,surfaceId:e.surfaceId,routePath:e.routePath,title:e.title,icon:e.surfaceId,description:e.description,category:e.category,tags:e.tags,inputs:[],params:[],output:e.output,tools:[],NodeView:he({title:e.title,description:e.description,inputs:[],params:[],output:e.output,tools:[]}),execute:e.execute})}const Wh=Gt({id:"surface:sleep-index:summary",surfaceId:"sleep-index",routePath:"/sleep",title:"Sleep summary",description:"Recent nightly sleep metrics and recovery posture.",category:"Sleep",tags:["sleep","summary"],execute:e=>ln(e),output:[H({label:"Sleep summary",description:"Summary of recent sleep and recovery posture."}),Se({key:"sleepView",label:"Sleep view",description:"Structured sleep history and derived sleep patterns.",modelName:"ForgeSleepView"})]}),qh=Gt({id:"surface:sleep-index:patterns",surfaceId:"sleep-index",routePath:"/sleep",title:"Sleep patterns",description:"Weekly baseline, stage mix, and timing patterns around canonical nights.",category:"Sleep",tags:["sleep","patterns"],execute:e=>ln(e),output:[H({label:"Sleep pattern summary",description:"Summary of trend, stage averages, and recovery state."}),Se({key:"sleepView",label:"Sleep view",description:"Structured sleep trend, stage averages, and recovery signals.",modelName:"ForgeSleepView"})]}),Bh=Gt({id:"surface:sleep-index:browser",surfaceId:"sleep-index",routePath:"/sleep",title:"Night detail",description:"Interactive sleep calendar, selected-night detail, and optional raw evidence.",category:"Sleep",tags:["sleep","browser","history"],execute:e=>ln(e),output:[H({label:"Night detail summary",description:"Summary of the sleep calendar and selected-night detail."}),Se({key:"sleepView",label:"Sleep view",description:"Structured canonical nights, calendar summaries, and phase detail.",modelName:"ForgeSleepView"})]}),Kh=Gt({id:"surface:sports-index:summary",surfaceId:"sports-index",routePath:"/sports",title:"Sports summary",description:"Recent workout metrics, streaks, and linked-session totals.",category:"Sports",tags:["sports","summary"],execute:e=>cn(e),output:[H({label:"Sports summary",description:"Summary of recent workout metrics and streaks."}),Se({key:"sportsView",label:"Sports view",description:"Structured workout metrics, streaks, and linked session totals.",modelName:"ForgeSportsView"})]}),Hh=Gt({id:"surface:sports-index:composition",surfaceId:"sports-index",routePath:"/sports",title:"Training composition",description:"Workout mix, trend, and session composition context.",category:"Sports",tags:["sports","composition","trend"],execute:e=>cn(e),output:[H({label:"Composition summary",description:"Summary of workout mix, trend, and session composition."}),Se({key:"sportsView",label:"Sports view",description:"Structured workout mix, trend, and session composition data.",modelName:"ForgeSportsView"})]}),Uh=Gt({id:"surface:sports-index:browser",surfaceId:"sports-index",routePath:"/sports",title:"Session browser",description:"Searchable and virtualized workout history browser.",category:"Sports",tags:["sports","browser","history"],execute:e=>cn(e),output:[H({label:"Session browser summary",description:"Summary of searchable workout history."}),Se({key:"sportsView",label:"Sports view",description:"Structured workout history for browsing and analysis.",modelName:"ForgeSportsView"})]});function Gh({children:e}){return s.jsx(s.Fragment,{children:e})}function xs(e,t,a,n,r,o){return ke(Gh,{id:e,surfaceId:"movement-index",routePath:"/movement",title:t,icon:"movement",description:a,category:"Movement",tags:n,inputs:[],params:[],output:o,tools:[],NodeView:he({title:t,description:a,inputs:[],params:[],output:o,tools:[]}),execute:r})}const Vh=xs("surface:movement-index:summary","Movement summary","Tracking mode, daily totals, and passive capture posture.",["movement","summary"],e=>ce(e,null,"Movement summary is available."),[H({label:"Movement summary",description:"Summary of tracking mode, daily totals, and passive capture posture."})]),Jh=xs("surface:movement-index:selection","Movement selection aggregate","Selected-stay and selected-trip aggregate totals.",["movement","selection","aggregate"],e=>ce(e,null,"Selected stay and trip aggregate totals."),[H({label:"Selection summary",description:"Summary of selected-stay and selected-trip aggregates."})]),Xh=xs("surface:movement-index:timeline","Movement life timeline","Life-scale stay and trip timeline with edit access.",["movement","timeline","life"],e=>ce(e,null,"Movement life timeline with stay and trip history."),[H({label:"Timeline summary",description:"Summary of the movement life timeline and trip history."})]),Qh=xs("surface:movement-index:places","Known places","Known places, aliases, and category tags.",["movement","places"],e=>ah(e),[H({label:"Places summary",description:"Summary of known places, aliases, and category tags."}),Fo({key:"places",label:"Known places",description:"Structured list of places known to Forge movement tracking.",modelName:"ForgeMovementPlaces",itemKind:"movement_place"})]),Yh=xs("surface:movement-index:data-browser","Movement data browser","Datapoint browsing, invalid records, and movement data cleanup.",["movement","data","browser"],e=>ce(e,null,"Movement datapoint browser with cleanup actions."),[H({label:"Data browser summary",description:"Summary of movement datapoint browsing and cleanup."})]);function kn({children:e}){return s.jsx(s.Fragment,{children:e})}const Ds=De({itemKind:"note",itemLabel:"Note",defaultEntityTypes:["note"],defaultLimit:20}),$s=$e(),Zh=ke(kn,{id:"surface:notes-index:filters",surfaceId:"notes-index",routePath:"/notes",title:"Note filters",icon:"filter",description:"Entity, tag, text, author, and date filters for notes.",category:"Notes",tags:["notes","filters","search"],inputs:Ds,params:$s,output:[H({label:"Filter summary",description:"Summary of the current note filters and search scope."})],tools:[Pe("Search Forge entities by query and entity types.")],NodeView:he({title:"Note filters",description:"Entity, tag, text, author, and date filters for notes.",inputs:Ds,params:$s,output:[H({label:"Filter summary",description:"Summary of the current note filters and search scope."})],tools:[Pe("Search Forge entities by query and entity types.")]}),execute:e=>_e(e,{query:"",entityTypes:["note"],limit:20})}),eg=ke(kn,{id:"surface:notes-index:composer",surfaceId:"notes-index",routePath:"/notes",title:"Note composer",icon:"write",description:"Markdown note composer with links, tags, and capture actions.",category:"Notes",tags:["notes","composer","capture"],inputs:Ds,params:$s,output:[H({label:"Draft summary",description:"Summary of the current note drafting surface."})],tools:[Os("Create an evidence note from markdown content.")],NodeView:he({title:"Note composer",description:"Markdown note composer with links, tags, and capture actions.",inputs:Ds,params:$s,output:[H({label:"Draft summary",description:"Summary of the current note drafting surface."})],tools:[Os("Create an evidence note from markdown content.")]}),execute:e=>ce(e,{draftable:!0},"This node can draft or create a note.")}),tg=ke(kn,{id:"surface:notes-index:library",surfaceId:"notes-index",routePath:"/notes",title:"Notes library",icon:"library",description:"Filtered library of Forge notes and linked evidence.",category:"Notes",tags:["notes","library","history"],inputs:[],params:[],output:Ae({itemKind:"note",itemLabel:"Note"}),tools:[],NodeView:he({title:"Notes library",description:"Filtered library of Forge notes and linked evidence.",inputs:[],params:[],output:Ae({itemKind:"note",itemLabel:"Note"}),tools:[]}),execute:e=>_e(e,{query:"",entityTypes:["note"],limit:20})});function sg({children:e}){return s.jsx(s.Fragment,{children:e})}function jn(e,t,a,n,r,o){return ke(sg,{id:e,surfaceId:"overview",routePath:"/overview",title:t,icon:"overview",description:a,category:"Overview",tags:n,inputs:[],params:[],output:o,tools:[],NodeView:he({title:t,description:a,inputs:[],params:[],output:o,tools:[]}),execute:r})}const ag=jn("surface:overview:snapshot","Forge snapshot","Live overview of goals, projects, tasks, habits, and current operating pressure.",["overview","snapshot"],e=>nh(e),[H({label:"Overview summary",description:"Compact summary of goals, projects, tasks, and habits."}),Se({key:"context",label:"Overview context",description:"Structured Forge overview context for the current operating picture.",modelName:"ForgeOverviewContext"})]),ng=jn("surface:overview:momentum","Momentum and health","Momentum-focused summary of streaks, neglected areas, and active execution pressure.",["overview","momentum"],e=>ce(e,{dimensions:["momentum","neglected_goals","domain_balance"]},"Overview momentum surface tracking neglected goals, domain balance, and execution pressure."),[H({label:"Momentum summary",description:"Summary of momentum, neglected goals, and execution pressure."})]),rg=jn("surface:overview:insights","Overview insights","Insight-oriented summary of the current Forge operating picture.",["overview","insights"],e=>$o(e),[H({label:"Insight summary",description:"Compact explanation of the current insight payload."}),Se({key:"insights",label:"Insight payload",description:"Structured insight and coaching payload returned by Forge.",modelName:"ForgeInsightsPayload"})]);function ig({children:e}){return s.jsx(s.Fragment,{children:e})}function Sn(e,t,a,n,r,o,i=[],l){const u=(l==null?void 0:l.inputs)??[],h=(l==null?void 0:l.params)??[];return ke(ig,{id:e,surfaceId:"projects",routePath:"/projects",title:t,icon:"projects",description:a,category:"Projects",tags:n,inputs:u,params:h,output:o,tools:i,NodeView:he({title:t,description:a,inputs:u,params:h,output:o,tools:i}),execute:r})}const og=Sn("surface:projects:hero","Projects hero","Projects page header.",["projects","hero"],e=>ce(e,null,"Projects page header."),[H({label:"Projects summary",description:"High-level projects page framing."})]),lg=Sn("surface:projects:search-results","Search and results","Project browser, filters, and search context.",["projects","search"],e=>_e(e,{query:"",entityTypes:["project"],limit:20}),Ae({itemKind:"project",itemLabel:"Project"}),[Pe("Search project entities by query and entity types.")],{inputs:De({itemKind:"project",itemLabel:"Project",defaultEntityTypes:["project"],defaultLimit:20}),params:$e()}),cg=Sn("surface:projects:summary","Collection summary","Collection summary and project state metrics.",["projects","summary"],e=>ce(e,null,"Project collection summary."),[H({label:"Project summary",description:"Summary of the project collection and current state."})]);function dg({children:e}){return s.jsx(s.Fragment,{children:e})}function Nn(e,t,a,n,r,o,i=[],l){const u=(l==null?void 0:l.inputs)??[],h=(l==null?void 0:l.params)??[];return ke(dg,{id:e,surfaceId:"preferences",routePath:"/preferences",title:t,icon:"preferences",description:a,category:"Preferences",tags:n,inputs:u,params:h,output:o,tools:i,NodeView:he({title:t,description:a,inputs:u,params:h,output:o,tools:i}),execute:r})}const ug=Nn("surface:preferences:workspace","Preferences workspace","Main preference modeling workspace, including summaries, tradeoffs, and evidence.",["preferences","workspace"],e=>ce(e,{surfaces:["summary","comparison_game","evidence"]},"Preferences workspace with summary, pairwise comparison, and evidence views."),[H({label:"Preference summary",description:"Summary of the active preference modeling workspace."})]),mg=Nn("surface:preferences:contexts","Preference contexts","Preference contexts that shape which tradeoffs and evidence are active.",["preferences","contexts"],e=>_e(e,{query:"",entityTypes:["preference_context"],limit:20}),Ae({itemKind:"preference_context",itemLabel:"Preference context"}),[Pe("Search preference contexts and modeled preference items.")],{inputs:De({itemKind:"preference_context",itemLabel:"Preference context",defaultEntityTypes:["preference_context"],defaultLimit:20}),params:$e()}),pg=Nn("surface:preferences:items","Preference items","Preference items scored and compared inside the active context.",["preferences","items"],e=>_e(e,{query:"",entityTypes:["preference_item"],limit:20}),Ae({itemKind:"preference_item",itemLabel:"Preference item"}),[Pe("Search preference contexts and modeled preference items.")],{inputs:De({itemKind:"preference_item",itemLabel:"Preference item",defaultEntityTypes:["preference_item"],defaultLimit:20}),params:$e()});function hg({children:e}){return s.jsx(s.Fragment,{children:e})}function Pn(e,t,a,n,r,o,i=[],l){const u=(l==null?void 0:l.inputs)??[],h=(l==null?void 0:l.params)??[];return ke(hg,{id:e,surfaceId:"psyche",routePath:"/psyche",title:t,icon:"psyche",description:a,category:"Psyche",tags:n,inputs:u,params:h,output:o,tools:i,NodeView:he({title:t,description:a,inputs:u,params:h,output:o,tools:i}),execute:r})}const gg=Pn("surface:psyche:overview","Psyche overview","High-level overview of values, patterns, beliefs, modes, and reports.",["psyche","overview"],e=>ce(e,{surfaces:["values","patterns","beliefs","modes","reports"]},"Psyche overview spanning values, patterns, beliefs, modes, and reports."),[H({label:"Psyche summary",description:"Summary of values, patterns, beliefs, modes, and reports."})]),fg=Pn("surface:psyche:values","Psyche values","Values and long-lived internal directions tracked inside Forge.",["psyche","values"],e=>_e(e,{query:"",entityTypes:["psyche_value"],limit:20}),Ae({itemKind:"psyche_value",itemLabel:"Psyche value"}),[Pe("Search psyche entities and reflective records.")],{inputs:De({itemKind:"psyche_value",itemLabel:"Psyche value",defaultEntityTypes:["psyche_value"],defaultLimit:20}),params:$e()}),yg=Pn("surface:psyche:reports","Trigger reports","Trigger reports and behavior-pattern signals linked to reflective work.",["psyche","reports","patterns"],e=>_e(e,{query:"",entityTypes:["trigger_report","behavior_pattern","belief_entry","mode_profile"],limit:20}),Ae({itemKind:"psyche_record",itemLabel:"Psyche record"}),[Pe("Search psyche entities and reflective records.")],{inputs:De({itemKind:"psyche_record",itemLabel:"Psyche record",defaultEntityTypes:["trigger_report","behavior_pattern","belief_entry","mode_profile"],defaultLimit:20}),params:$e()});function xg({children:e}){return s.jsx(s.Fragment,{children:e})}function Tn(e,t,a,n,r,o,i=[],l){const u=(l==null?void 0:l.inputs)??[],h=(l==null?void 0:l.params)??[];return ke(xg,{id:e,surfaceId:"questionnaires",routePath:"/psyche/questionnaires",title:t,icon:"questionnaire",description:a,category:"Questionnaires",tags:n,inputs:u,params:h,output:o,tools:i,NodeView:he({title:t,description:a,inputs:u,params:h,output:o,tools:i}),execute:r})}const bg=Tn("surface:questionnaires:library","Questionnaire library","Library of questionnaire instruments available in Forge.",["questionnaires","library"],e=>_e(e,{query:"",entityTypes:["questionnaire_instrument"],limit:20}),Ae({itemKind:"questionnaire_instrument",itemLabel:"Questionnaire"}),[Pe("Search questionnaire instruments and related records.")],{inputs:De({itemKind:"questionnaire_instrument",itemLabel:"Questionnaire",defaultEntityTypes:["questionnaire_instrument"],defaultLimit:20}),params:$e()}),vg=Tn("surface:questionnaires:drafting","Questionnaire drafting","Drafting and publishing context for questionnaire instruments.",["questionnaires","drafting","authoring"],e=>ce(e,{states:["draft","published","run"]},"Questionnaire drafting surface with draft, publish, and run lifecycle context."),[H({label:"Drafting summary",description:"Summary of questionnaire drafting and lifecycle context."})]),wg=Tn("surface:questionnaires:self-observation","Self-observation calendar","Calendar of self-observation notes and linked psyche context.",["questionnaires","self-observation","psyche"],e=>ce(e,{linkedDomains:["patterns","reports","notes"]},"Self-observation calendar surface with linked psyche context."),[H({label:"Observation summary",description:"Summary of the self-observation calendar and linked psyche context."})]);function kg({children:e}){return s.jsx(s.Fragment,{children:e})}function Wo(e,t,a,n,r,o){return ke(kg,{id:e,surfaceId:"review",routePath:"/review/weekly",title:t,icon:"review",description:a,category:"Review",tags:n,inputs:[],params:[],output:o,tools:[],NodeView:he({title:t,description:a,inputs:[],params:[],output:o,tools:[]}),execute:r})}const jg=Wo("surface:review:weekly-summary","Weekly review summary","Weekly review payload with momentum, wins, calibration, and completion state.",["review","weekly"],e=>rh(e),[H({label:"Weekly review summary",description:"Summary of momentum, wins, calibration, and review completion state."}),Se({key:"weeklyReview",label:"Weekly review payload",description:"Structured weekly review payload returned by Forge.",modelName:"ForgeWeeklyReview"})]),Sg=Wo("surface:review:reward","Review reward","Reward framing and completion incentive for closing the current review cycle.",["review","reward"],e=>ce(e,{reward:"weekly_review_completion"},"Weekly review reward surface for locking the current cycle into evidence."),[H({label:"Review reward summary",description:"Summary of the reward framing for closing the current review cycle."})]);function Ng({children:e}){return s.jsx(s.Fragment,{children:e})}function In(e,t,a,n,r,o,i=[],l){const u=(l==null?void 0:l.inputs)??[],h=(l==null?void 0:l.params)??[];return ke(Ng,{id:e,surfaceId:"strategies",routePath:"/strategies",title:t,icon:"strategy",description:a,category:"Strategies",tags:n,inputs:u,params:h,output:o,tools:i,NodeView:he({title:t,description:a,inputs:u,params:h,output:o,tools:i}),execute:r})}const Pg=In("surface:strategies:hero","Strategies hero","Strategies page header and sequencing context.",["strategies","hero"],e=>ce(e,null,"Strategies page header."),[H({label:"Strategies summary",description:"High-level strategies page framing."})]),Tg=In("surface:strategies:search-results","Strategies list and results","Strategy browser and structured operating context.",["strategies","search"],e=>_e(e,{query:"",entityTypes:["strategy"],limit:20}),Ae({itemKind:"strategy",itemLabel:"Strategy"}),[Pe("Search strategy entities by query and entity types.")],{inputs:De({itemKind:"strategy",itemLabel:"Strategy",defaultEntityTypes:["strategy"],defaultLimit:20}),params:$e()}),Ig=In("surface:strategies:summary","Strategies summary","Strategy collection summary and state context.",["strategies","summary"],e=>ce(e,null,"Strategy collection summary."),[H({label:"Strategy summary",description:"Summary of strategy state and collection context."})]);function Cg({children:e}){return s.jsx(s.Fragment,{children:e})}function Cn(e,t,a,n,r,o,i=[],l){const u=(l==null?void 0:l.inputs)??[],h=(l==null?void 0:l.params)??[];return ke(Cg,{id:e,surfaceId:"tasks",routePath:"/today",title:t,icon:"task",description:a,category:"Tasks",tags:n,inputs:u,params:h,output:o,tools:i,NodeView:he({title:t,description:a,inputs:u,params:h,output:o,tools:i}),execute:r})}const Rg=Cn("surface:tasks:inbox","Task queue","Searchable task queue spanning backlog, focus, and in-progress work.",["tasks","queue","search"],e=>_e(e,{query:"",entityTypes:["task"],limit:20}),Ae({itemKind:"task",itemLabel:"Task"}),[Pe("Search task entities by title, status, or linked context."),Ls("Move a task between backlog, focus, in progress, blocked, and done.")],{inputs:De({itemKind:"task",itemLabel:"Task",defaultEntityTypes:["task"],defaultLimit:20}),params:$e()}),_g=Cn("surface:tasks:focus-lane","Focus lane","Focused task lane for what should happen next right now.",["tasks","focus","execution"],e=>ce(e,{hint:"Use this surface to represent active or next-up work."},"Focus lane context for the current execution board."),[H({label:"Focus summary",description:"Human-readable explanation of what the focus lane represents."})],[Ls("Change task state as the flow decides what should happen next.")]),Eg=Cn("surface:tasks:summary","Task summary","High-level summary of the current task system and work state.",["tasks","summary"],e=>ce(e,{states:["backlog","focus","in_progress","blocked","done"]},"Task system summary with the key task states Forge tracks."),[H({label:"Task summary",description:"High-level summary of the current task system and work state."})]);function Ag({children:e}){return s.jsx(s.Fragment,{children:e})}function bs(e,t,a,n,r,o,i=[],l){const u=(l==null?void 0:l.inputs)??[],h=(l==null?void 0:l.params)??[];return ke(Ag,{id:e,surfaceId:"today",routePath:"/today",title:t,icon:"today",description:a,category:"Today",tags:n,inputs:u,params:h,output:o,tools:i,NodeView:he({title:t,description:a,inputs:u,params:h,output:o,tools:i}),execute:r})}const Og=bs("surface:today:hero","Today hero","Daily execution header and directive.",["today","hero"],e=>ce(e,null,"Daily execution header."),[H({label:"Today summary",description:"High-level framing for today's execution."})]),Lg=bs("surface:today:metrics","Live metrics","Daily XP, level, and momentum metrics.",["today","metrics"],e=>ce(e,null,"Daily metrics."),[H({label:"Metrics summary",description:"Summary of today's XP, level, and momentum metrics."})]),Dg=bs("surface:today:runway","Runway","Execution lane and current work.",["today","execution"],e=>_e(e,{query:"",entityTypes:["task","habit"],limit:16}),Ae({itemKind:"execution_item",itemLabel:"Execution item"}),[Pe("Search today's active tasks and habits by query and entity types.")],{inputs:De({itemKind:"execution_item",itemLabel:"Execution item",defaultEntityTypes:["task","habit"],defaultLimit:16}),params:$e()}),$g=bs("surface:today:calendar","Calendar","Calendar context for today.",["today","calendar"],e=>ce(e,null,"Today's calendar context."),[H({label:"Calendar summary",description:"Summary of today's calendar context."})]),Mg=bs("surface:today:focus","Current focus","Today priorities and focus context.",["today","focus"],e=>_e(e,{query:"",entityTypes:["task","habit"],limit:16}),Ae({itemKind:"focus_item",itemLabel:"Focus item"}),[Pe("Search today's priority tasks and habits by query and entity types.")],{inputs:De({itemKind:"focus_item",itemLabel:"Focus item",defaultEntityTypes:["task","habit"],defaultLimit:16}),params:$e()});function Fg({children:e}){return s.jsx(s.Fragment,{children:e})}function Rn(e,t,a,n,r,o){return ke(Fg,{id:e,surfaceId:"wiki",routePath:"/wiki",title:t,icon:"wiki",description:a,category:"Wiki",tags:n,inputs:[],params:[],output:o,tools:[],NodeView:he({title:t,description:a,inputs:[],params:[],output:o,tools:[]}),execute:r})}const zg=Rn("surface:wiki:pages","Wiki pages","Live list of wiki pages that can be used as memory or authored knowledge.",["wiki","pages"],e=>ih(e),[H({label:"Wiki page summary",description:"Summary of the currently available wiki pages."}),Fo({key:"pages",label:"Wiki pages",description:"Structured wiki page records available in Forge memory.",modelName:"ForgeWikiPages",itemKind:"wiki_page"})]),Wg=Rn("surface:wiki:health","Wiki health","Index health, unresolved links, and orphaned-page signals for the wiki.",["wiki","health"],e=>oh(e),[H({label:"Wiki health summary",description:"Summary of unresolved links and orphaned-page signals."}),Se({key:"health",label:"Wiki health",description:"Structured wiki health payload returned by Forge.",modelName:"ForgeWikiHealth"})]),qg=Rn("surface:wiki:authoring","Wiki authoring","Authoring and ingest surface for creating or refining Forge memory.",["wiki","authoring","ingest"],e=>ce(e,{actions:["upsert","ingest","reindex"]},"Wiki authoring surface for ingesting sources and maintaining memory pages."),[H({label:"Wiki authoring summary",description:"Summary of wiki authoring and ingest actions available on this surface."})]),Bg=[pn,hn,gn,fn,yn,Ch,Rh,_h,Ah,Oh,Lh,$h,Mh,Fh,jh,Sh,Nh,Ph,Th,Zh,eg,tg,ag,ng,rg,Vh,Jh,Xh,Qh,Yh,Wh,qh,Bh,Kh,Hh,Uh,og,lg,cg,ug,mg,pg,gg,fg,yg,bg,vg,wg,jg,Sg,Pg,Tg,Ig,Rg,_g,Eg,Og,Lg,Dg,$g,Mg,zg,Wg,qg],qo=new Map(Bg.filter(e=>e.workbench).map(e=>[e.workbench.id,e.workbench]));function _n(){return Array.from(qo.values())}function Bo(e){return qo.get(e)??null}function Ko(){return _n().map(e=>({id:e.id,boxId:e.id,surfaceId:e.surfaceId,routePath:e.routePath,title:e.title,label:e.title,icon:e.icon??null,description:e.description,category:e.category,tags:e.tags,capabilityModes:["content",...e.tools.length>0?["tool"]:[]],inputs:ks(e.inputs),params:ks(e.params),output:ks(e.output),tools:e.tools,outputs:ks(e.output),toolAdapters:e.tools,snapshotResolverKey:void 0}))}const Ho=c.createContext(null),Kg={definitions:_n(),catalog:Ko(),getDefinition:Bo};function Hg({children:e}){const t=c.useMemo(()=>({definitions:_n(),catalog:Ko(),getDefinition:Bo}),[]);return s.jsx(Ho.Provider,{value:t,children:e})}function Uo(){return c.useContext(Ho)??Kg}function Ok(){return Uo().catalog}function Lk(e){const t=Uo();return e?t.getDefinition(e):null}function Dk({children:e}){return s.jsx(s.Fragment,{children:e})}const Ug="modulepreload",Gg=function(e){return"/forge/"+e},bi={},K=function(t,a,n){let r=Promise.resolve();if(a&&a.length>0){let i=function(h){return Promise.all(h.map(m=>Promise.resolve(m).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),u=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));r=i(a.map(h=>{if(h=Gg(h),h in bi)return;bi[h]=!0;const m=h.endsWith(".css"),g=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${g}`))return;const f=document.createElement("link");if(f.rel=m?"stylesheet":Ug,m||(f.as="script"),f.crossOrigin="",f.href=h,u&&f.setAttribute("nonce",u),document.head.appendChild(f),m)return new Promise((x,y)=>{f.addEventListener("load",x),f.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${h}`)))})}))}function o(i){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=i,window.dispatchEvent(l),!l.defaultPrevented)throw i}return r.then(i=>{for(const l of i||[])l.status==="rejected"&&o(l.reason);return t().catch(o)})},Vg=c.lazy(()=>K(()=>import("./activity-page-5oyCFOns.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(e=>({default:e.ActivityPage}))),Jg=c.lazy(()=>K(()=>import("./calendar-page-Bo2iua-a.js"),__vite__mapDeps([13,1,2,3,14,15,16,17,4,18,19,7,8,9,10,11,12])).then(e=>({default:e.CalendarPage})));c.lazy(()=>K(()=>import("./companion-sync-lab-page-CosNknOK.js"),__vite__mapDeps([20,1,2,4,3,7,8,9,10,11,12])).then(e=>({default:e.CompanionSyncLabPage})));const Xg=c.lazy(()=>K(()=>import("./goal-detail-page-cJvHaLMQ.js"),__vite__mapDeps([21,1,2,3,22,23,24,25,26,27,4,28,6,7,8,9,10,11,12])).then(e=>({default:e.GoalDetailPage}))),Qg=c.lazy(()=>K(()=>import("./goals-page-f_39hvUV.js"),__vite__mapDeps([29,1,2,4,30,31,27,3,7,8,9,10,11,12])).then(e=>({default:e.GoalsPage}))),Yg=c.lazy(()=>K(()=>import("./habits-page-DKb96_mj.js"),__vite__mapDeps([32,1,2,8,3,30,23,33,4,34,35,7,9,10,11,12])).then(e=>({default:e.HabitsPage}))),Zg=c.lazy(()=>K(()=>import("./insights-page-Dc9oFltJ.js"),__vite__mapDeps([36,1,2,3,37,4,38,7,8,9,10,11,12])).then(e=>({default:e.InsightsPage}))),ef=c.lazy(()=>K(()=>import("./kanban-page-JAxerYh6.js"),__vite__mapDeps([39,1,2,3,40,7,30,18,41,4,8,9,10,11,12])).then(e=>({default:e.KanbanPage}))),tf=c.lazy(()=>K(()=>import("./knowledge-graph-page-UQ3skqEi.js"),__vite__mapDeps([42,1,2,8,3,11,12,43,9,7,10])).then(e=>({default:e.KnowledgeGraphPage}))),sf=c.lazy(()=>K(()=>import("./life-force-page-BGDbQuVh.js"),__vite__mapDeps([44,1,2,45,3,18,38,4,7,8,9,10,11,12])).then(e=>({default:e.LifeForcePage}))),af=c.lazy(()=>K(()=>import("./movement-page-6HP6nGJx.js"),__vite__mapDeps([46,1,2,3,43,4,8,9,38,7,10,11,12])).then(e=>({default:e.MovementPage}))),nf=c.lazy(()=>K(()=>import("./notes-page-BuguDjhz.js"),__vite__mapDeps([47,1,2,3,23,25,4,18,7,8,9,10,11,12])).then(e=>({default:e.NotesPage}))),rf=c.lazy(()=>K(()=>import("./overview-page-DuOs2OCB.js"),__vite__mapDeps([48,1,2,49,7,3,50,9,45,18,38,30,4,28,8,10,11,12])).then(e=>({default:e.OverviewPage}))),of=c.lazy(()=>K(()=>import("./project-detail-page-drPIFZGb.js"),__vite__mapDeps([51,1,2,3,17,22,41,52,40,7,30,18,23,24,25,26,4,28,6,8,9,10,11,12])).then(e=>({default:e.ProjectDetailPage}))),lf=c.lazy(()=>K(()=>import("./project-management-hierarchy-page-BUbRXvny.js"),__vite__mapDeps([53,1,2,3,41,4,7,8,9,10,11,12])).then(e=>({default:e.ProjectManagementHierarchyPage}))),cf=c.lazy(()=>K(()=>import("./projects-page-BGzEZUtg.js"),__vite__mapDeps([54,1,2,49,7,3,31,4,30,27,41,8,9,10,11,12])).then(e=>({default:e.ProjectsPage}))),df=c.lazy(()=>K(()=>import("./settings-wiki-page-B2zX0QQG.js"),__vite__mapDeps([55,1,2,3,56,4,7,8,9,10,11,12])).then(e=>({default:e.SettingsWikiPage}))),uf=c.lazy(()=>K(()=>import("./strategies-page-DXP9Kx8s.js"),__vite__mapDeps([57,1,2,3,58,7,4,8,9,10,11,12])).then(e=>({default:e.StrategiesPage}))),mf=c.lazy(()=>K(()=>import("./strategy-detail-page-D6mx_Mik.js"),__vite__mapDeps([59,1,2,3,22,26,58,7,11,12,4,8,9,10])).then(e=>({default:e.StrategyDetailPage}))),pf=c.lazy(()=>K(()=>import("./preferences-page-BaJTMU1I.js"),__vite__mapDeps([60,1,2,8,3,4,7,9,10,11,12])).then(e=>({default:e.PreferencesPage}))),hf=c.lazy(()=>K(()=>import("./psyche-page--r6a3e1t.js"),__vite__mapDeps([61,1,2,3,49,7,62,4,8,9,10,11,12])).then(e=>({default:e.PsychePage}))),gf=c.lazy(()=>K(()=>import("./psyche-behaviors-page-Dmm_Io9D.js"),__vite__mapDeps([63,1,2,3,30,64,65,66,33,4,67,68,10,7,8,9,11,12])).then(e=>({default:e.PsycheBehaviorsPage}))),ff=c.lazy(()=>K(()=>import("./psyche-flashcards-page-BgNKJ6QJ.js"),__vite__mapDeps([69,1,2,3,33,4,68,10,7,8,9,11,12])).then(e=>({default:e.PsycheFlashcardsPage}))),yf=c.lazy(()=>K(()=>import("./psyche-goal-map-page-DXJs98Vr.js"),__vite__mapDeps([70,1,2,3,62,4,7,8,9,10,11,12])).then(e=>({default:e.PsycheGoalMapPage}))),xf=c.lazy(()=>K(()=>import("./psyche-metrics-page-zYTJDbyZ.js"),__vite__mapDeps([71,1,2,3,4,72,8,38,7,9,10,11,12])).then(e=>({default:e.PsycheMetricsPage}))),bf=c.lazy(()=>K(()=>import("./psyche-mode-guide-page-XPgRfCOf.js"),__vite__mapDeps([73,1,2,3,10,4,68,7,8,9,11,12])).then(e=>({default:e.PsycheModeGuidePage}))),vf=c.lazy(()=>K(()=>import("./psyche-modes-page-B-GA8oRF.js"),__vite__mapDeps([74,1,2,3,30,64,33,4,67,68,10,7,8,9,11,12])).then(e=>({default:e.PsycheModesPage}))),wf=c.lazy(()=>K(()=>import("./psyche-patterns-page-BM5-3bMm.js"),__vite__mapDeps([75,1,2,3,30,64,76,9,65,66,33,4,67,68,10,7,8,11,12])).then(e=>({default:e.PsychePatternsPage}))),vi=c.lazy(()=>K(()=>import("./psyche-questionnaire-builder-page-CJshQ-mg.js"),__vite__mapDeps([77,1,2,3,4,7,8,9,10,11,12])).then(e=>({default:e.PsycheQuestionnaireBuilderPage}))),kf=c.lazy(()=>K(()=>import("./psyche-questionnaire-detail-page-USmR5G5A.js"),__vite__mapDeps([78,1,2,3,4,38,7,8,9,10,11,12])).then(e=>({default:e.PsycheQuestionnaireDetailPage}))),jf=c.lazy(()=>K(()=>import("./psyche-questionnaire-run-detail-page-D7iBCmTi.js"),__vite__mapDeps([79,1,2,3,4,7,8,9,10,11,12])).then(e=>({default:e.PsycheQuestionnaireRunDetailPage}))),Sf=c.lazy(()=>K(()=>import("./psyche-questionnaire-run-page-Cpil-kDh.js"),__vite__mapDeps([80,1,2,3,4,7,8,9,10,11,12])).then(e=>({default:e.PsycheQuestionnaireRunPage}))),Nf=c.lazy(()=>K(()=>import("./psyche-questionnaires-page-C-_y3VwS.js"),__vite__mapDeps([81,1,2,3,43,4,7,8,9,10,11,12])).then(e=>({default:e.PsycheQuestionnairesPage}))),Pf=c.lazy(()=>K(()=>import("./psyche-report-detail-page--dkSPRaj.js"),__vite__mapDeps([82,1,2,3,9,37,22,24,23,25,83,4,68,10,66,7,8,11,12])).then(e=>({default:e.PsycheReportDetailPage}))),Tf=c.lazy(()=>K(()=>import("./psyche-reports-page-CUaOXmIN.js"),__vite__mapDeps([84,1,2,3,30,64,65,66,83,4,67,68,10,7,8,9,11,12])).then(e=>({default:e.PsycheReportsPage}))),If=c.lazy(()=>K(()=>import("./psyche-self-observation-page-BZ6FLuwa.js"),__vite__mapDeps([85,1,2,3,25,4,14,15,34,6,7,8,9,10,11,12])).then(e=>({default:e.PsycheSelfObservationPage}))),Cf=c.lazy(()=>K(()=>import("./psyche-screen-time-page-CAAI4mD7.js"),__vite__mapDeps([86,1,2,3,4,38,7,8,9,10,11,12])).then(e=>({default:e.PsycheScreenTimePage}))),Rf=c.lazy(()=>K(()=>import("./psyche-schemas-beliefs-page-BX6xaap3.js"),__vite__mapDeps([87,1,2,3,65,66,30,64,33,4,67,68,10,7,8,9,11,12])).then(e=>({default:e.PsycheSchemasBeliefsPage}))),_f=c.lazy(()=>K(()=>import("./psyche-values-page-yEV6MGt8.js"),__vite__mapDeps([88,1,2,3,30,64,76,9,33,4,68,10,7,8,11,12])).then(e=>({default:e.PsycheValuesPage}))),Ef=c.lazy(()=>K(()=>import("./settings-page-BP81Mb5R.js"),__vite__mapDeps([89,1,2,3,10,56,4,7,8,9,11,12])).then(e=>({default:e.SettingsPage}))),Af=c.lazy(()=>K(()=>import("./settings-data-page-CGSlryuI.js"),__vite__mapDeps([90,1,2,3,56,4,91,7,8,9,10,11,12])).then(e=>({default:e.SettingsDataPage}))),Of=c.lazy(()=>K(()=>import("./settings-agents-page-VuYXTiyc.js"),__vite__mapDeps([92,1,2,3,8,9,56,4,91,7,10,11,12])).then(e=>({default:e.SettingsAgentsPage}))),Lf=c.lazy(()=>K(()=>import("./settings-bin-page-BNzvYaOk.js"),__vite__mapDeps([93,1,2,3,56,4,7,8,9,10,11,12])).then(e=>({default:e.SettingsBinPage}))),Df=c.lazy(()=>K(()=>import("./settings-calendar-page-CjSFB53S.js"),__vite__mapDeps([94,1,2,3,56,4,19,7,8,9,10,11,12])).then(e=>({default:e.SettingsCalendarPage}))),$f=c.lazy(()=>K(()=>import("./settings-mobile-page-CRaObOGo.js"),__vite__mapDeps([95,1,2,3,56,4,7,8,9,10,11,12])).then(e=>({default:e.SettingsMobilePage}))),Mf=c.lazy(()=>K(()=>import("./settings-models-page-DFshpYF8.js"),__vite__mapDeps([96,1,2,3,56,4,7,8,9,10,11,12])).then(e=>({default:e.SettingsModelsPage}))),Ff=c.lazy(()=>K(()=>import("./settings-logs-page-BTK5fine.js"),__vite__mapDeps([97,1,2,3,4,56,7,8,9,10,11,12])).then(e=>({default:e.SettingsLogsPage}))),zf=c.lazy(()=>K(()=>import("./settings-rewards-page-CDJ1PH2G.js"),__vite__mapDeps([98,1,2,3,10,56,9,4,91,7,8,11,12])).then(e=>({default:e.SettingsRewardsPage}))),Wf=c.lazy(()=>K(()=>import("./settings-users-page-TdUocFPa.js"),__vite__mapDeps([99,1,2,3,56,4,11,12,7,8,9,10])).then(e=>({default:e.SettingsUsersPage}))),qf=c.lazy(()=>K(()=>import("./rewards-page-C2HQjIAf.js"),__vite__mapDeps([100,1,2,3,4,7,8,9,10,11,12])).then(e=>({default:e.RewardsPage}))),Bf=c.lazy(()=>K(()=>import("./sleep-page-cI1GMVzk.js"),__vite__mapDeps([101,1,2,3,4,102,7,8,9,10,11,12])).then(e=>({default:e.SleepPage}))),Kf=c.lazy(()=>K(()=>import("./sports-page-06LTqp0V.js"),__vite__mapDeps([103,1,2,3,43,4,35,102,38,7,8,9,10,11,12])).then(e=>({default:e.SportsPage}))),Hf=c.lazy(()=>K(()=>import("./training-load-page-CyZ0mlEr.js"),__vite__mapDeps([104,1,2,3,38,4,7,8,9,10,11,12])).then(e=>({default:e.TrainingLoadPage}))),Uf=c.lazy(()=>K(()=>import("./workout-detail-page-BD8u7GyL.js"),__vite__mapDeps([105,1,2,3,106,107,4,38,7,8,9,10,11,12])).then(e=>({default:e.WorkoutDetailPage}))),Gf=c.lazy(()=>K(()=>import("./task-detail-page-BIWIggdp.js"),__vite__mapDeps([108,1,2,3,16,17,15,22,23,24,25,26,52,4,28,6,7,8,9,10,11,12])).then(e=>({default:e.TaskDetailPage}))),Vf=c.lazy(()=>K(()=>import("./today-page-DO2mRPT2.js"),__vite__mapDeps([109,1,2,3,49,7,30,45,18,38,4,8,9,10,11,12])).then(e=>({default:e.TodayPage}))),Jf=c.lazy(()=>K(()=>import("./vitals-page-BQvEjTc6.js"),__vite__mapDeps([110,1,2,3,4,72,8,38,7,9,10,11,12])).then(e=>({default:e.VitalsPage}))),Xf=c.lazy(()=>K(()=>import("./weight-loss-page-BBzlhLVV.js"),__vite__mapDeps([111,1,2,3,4,7,8,9,10,11,12])).then(e=>({default:e.WeightLossPage}))),wi=c.lazy(()=>K(()=>import("./wiki-page-BLRxVXkl.js"),__vite__mapDeps([112,1,2,8,3,22,113,114,7,9,10,11,12])).then(e=>({default:e.WikiPage}))),Qf=c.lazy(()=>K(()=>import("./wiki-ingest-history-page-BxoOcCoJ.js"),__vite__mapDeps([115,1,2,3,114,8,4,7,9,10,11,12])).then(e=>({default:e.WikiIngestHistoryPage}))),ki=c.lazy(()=>K(()=>import("./wiki-editor-page-Dem_3eZv.js"),__vite__mapDeps([116,1,2,8,3,113,7,9,10,11,12])).then(e=>({default:e.WikiEditorPage}))),Yf=c.lazy(()=>K(()=>import("./weekly-review-page-Tp6Q9CRj.js"),__vite__mapDeps([117,1,2,3,50,9,4,38,7,8,10,11,12])).then(e=>({default:e.WeeklyReviewPage}))),Zf=c.lazy(()=>K(()=>import("./workbench-page-BWd02wPw.js"),__vite__mapDeps([118,1,2,3,43,4,7,8,9,10,11,12])).then(e=>({default:e.WorkbenchPage}))),ey=c.lazy(()=>K(()=>import("./workbench-flow-page-DqMkCCTy.js"),__vite__mapDeps([119,1,2,22,4,11,3,12,8,43,7,9,10])).then(e=>({default:e.WorkbenchFlowPage})));function ty(){const e=Kt();return c.useEffect(()=>{const t=`${e.pathname}${e.search}${e.hash}`,a=Vi({scope:"frontend_runtime",route:t}),n=o=>{a({level:"error",eventKey:"window_error",message:o.message||"Unhandled browser error",functionName:"window.onerror",details:{fileName:o.filename||null,line:o.lineno||null,column:o.colno||null,error:o.error??null}})},r=o=>{a({level:"error",eventKey:"unhandled_rejection",message:"Unhandled promise rejection",functionName:"window.onunhandledrejection",details:{reason:o.reason??null}})};return window.addEventListener("error",n),window.addEventListener("unhandledrejection",r),()=>{window.removeEventListener("error",n),window.removeEventListener("unhandledrejection",r)}},[e.hash,e.pathname,e.search]),c.useEffect(()=>{const t=`${e.pathname}${e.search}${e.hash}`;Hs({level:"info",scope:"frontend_navigation",eventKey:"route_view",message:`Viewed route ${e.pathname}`,route:t,functionName:"DiagnosticsBootstrap.routeView",details:{pathname:e.pathname,search:e.search||null,hash:e.hash||null}})},[e.hash,e.pathname,e.search]),null}function sy(){function e(t,a,n,r){return s.jsx(Sp,{viewId:t,children:r})}return s.jsxs(Hg,{children:[s.jsx(ty,{}),s.jsxs(Dl,{children:[s.jsxs(q,{element:s.jsx(Vp,{}),children:[s.jsx(q,{index:!0,element:s.jsx(Qs,{to:"/overview",replace:!0})}),s.jsx(q,{path:"overview",element:e("overview","Overview","Daily signal, momentum, and current Forge state.",s.jsx(rf,{}))}),s.jsx(q,{path:"life-force",element:e("life-force-index","Life Force","Action Point capacity, weekday curves, and dynamic drains.",s.jsx(sf,{}))}),s.jsx(q,{path:"goals",element:e("goals-index","Goals","Goal planning and long-horizon direction.",s.jsx(Qg,{}))}),s.jsx(q,{path:"habits",element:e("habits-index","Habits","Recurring commitments, streaks, and check-ins.",s.jsx(Yg,{}))}),s.jsx(q,{path:"goals/:goalId",element:e("goal-detail","Goal detail","Goal detail, progress, and linked execution context.",s.jsx(Xg,{}))}),s.jsx(q,{path:"projects",element:e("projects-index","Projects","PRD-backed projects and execution initiatives.",s.jsx(cf,{}))}),s.jsx(q,{path:"projects/hierarchy",element:e("project-hierarchy","Project hierarchy","Full hierarchy from goals down to subtasks.",s.jsx(lf,{}))}),s.jsx(q,{path:"projects/:projectId",element:e("project-detail","Project detail","Project detail, tasks, and execution health.",s.jsx(of,{}))}),s.jsx(q,{path:"strategies",element:e("strategies-index","Strategies","Strategy graphs and long-range execution plans.",s.jsx(uf,{}))}),s.jsx(q,{path:"strategies/:strategyId",element:e("strategy-detail","Strategy detail","Strategy DAG detail, targets, and progress.",s.jsx(mf,{}))}),s.jsx(q,{path:"preferences",element:e("preferences-index","Preferences","Preference profiles, pairwise judgments, and model state.",s.jsx(pf,{}))}),s.jsx(q,{path:"campaigns",element:s.jsx(Qs,{to:"/projects",replace:!0})}),s.jsx(q,{path:"calendar",element:e("calendar-index","Calendar","Calendar planning, timeboxes, and provider sync.",s.jsx(Jg,{}))}),s.jsx(q,{path:"knowledge-graph",element:e("knowledge-graph-index","Knowledge Graph","One connected map of Forge entities and explicit relationships.",s.jsx(tf,{}))}),s.jsx(q,{path:"movement",element:e("movement-index","Movement","Movement traces, places, and trip evidence.",s.jsx(af,{}))}),s.jsx(q,{path:"sleep",element:e("sleep-index","Sleep","Sleep sessions, health context, and recovery trends.",s.jsx(Bf,{}))}),s.jsx(q,{path:"sports",element:e("sports-index","Sports","Fitness, workouts, and sports context.",s.jsx(Kf,{}))}),s.jsx(q,{path:"sports/workouts/:workoutId",element:e("sports-workout-detail","Workout Detail","Raw workout evidence, heart-rate zones, and session context.",s.jsx(Uf,{}))}),s.jsx(q,{path:"training-load",element:e("training-load-index","Training Load","Cardiovascular load, intensity distribution, and training targets.",s.jsx(Hf,{}))}),s.jsx(q,{path:"vitals",element:e("vitals-index","Vitals","Body signals, recovery, cardio fitness, and daily HealthKit metrics.",s.jsx(Jf,{}))}),s.jsx(q,{path:"weight-loss",element:e("weight-loss-index","Weight Loss","Nutrition, body composition, food effects, gut signals, and aesthetic experiments.",s.jsx(Xf,{}))}),s.jsx(q,{path:"psyche",element:e("psyche-index","Psyche","Values, modes, reports, and reflective context.",s.jsx(hf,{}))}),s.jsx(q,{path:"psyche/metrics",element:e("psyche-metrics","Psyche metrics","Daily Psyche metric history with plots and summary statistics.",s.jsx(xf,{}))}),s.jsx(q,{path:"psyche/flashcards",element:e("psyche-flashcards","Psyche flashcards","Therapeutic reminder cards for urges, triggers, and values-based pivots.",s.jsx(ff,{}))}),s.jsx(q,{path:"psyche/values",element:e("psyche-values","Psyche values","Values and linked goal context.",s.jsx(_f,{}))}),s.jsx(q,{path:"psyche/patterns",element:e("psyche-patterns","Psyche patterns","Behavior patterns and recurring loops.",s.jsx(wf,{}))}),s.jsx(q,{path:"psyche/questionnaires",element:e("psyche-questionnaires","Questionnaires","Questionnaire library and recent runs.",s.jsx(Nf,{}))}),s.jsx(q,{path:"psyche/questionnaires/new",element:e("psyche-questionnaire-new","New questionnaire","Questionnaire builder workspace.",s.jsx(vi,{}))}),s.jsx(q,{path:"psyche/questionnaires/:instrumentId",element:e("psyche-questionnaire-detail","Questionnaire detail","Questionnaire detail and scores.",s.jsx(kf,{}))}),s.jsx(q,{path:"psyche/questionnaires/:instrumentId/edit",element:e("psyche-questionnaire-edit","Edit questionnaire","Questionnaire builder workspace.",s.jsx(vi,{}))}),s.jsx(q,{path:"psyche/questionnaires/:instrumentId/take",element:e("psyche-questionnaire-run","Take questionnaire","Questionnaire runner and answers.",s.jsx(Sf,{}))}),s.jsx(q,{path:"psyche/questionnaire-runs/:runId",element:e("psyche-questionnaire-run-detail","Questionnaire run detail","Questionnaire result review.",s.jsx(jf,{}))}),s.jsx(q,{path:"psyche/self-observation",element:e("psyche-self-observation","Self observation","Self-observation notes and reflective tracking.",s.jsx(If,{}))}),s.jsx(q,{path:"psyche/screen-time",element:e("psyche-screen-time","Screen Time","Apple-compliant device-activity patterns and reflective usage history.",s.jsx(Cf,{}))}),s.jsx(q,{path:"psyche/behaviors",element:e("psyche-behaviors","Behaviors","Behavior records and linked evidence.",s.jsx(gf,{}))}),s.jsx(q,{path:"psyche/reports",element:e("psyche-reports","Reports","Trigger and reflective report review.",s.jsx(Tf,{}))}),s.jsx(q,{path:"psyche/reports/:reportId",element:e("psyche-report-detail","Report detail","Detailed reflective report view.",s.jsx(Pf,{}))}),s.jsx(q,{path:"psyche/goal-map",element:e("psyche-goal-map","Goal map","Goal-to-values relationship map.",s.jsx(yf,{}))}),s.jsx(q,{path:"psyche/schemas-beliefs",element:e("psyche-schemas-beliefs","Schemas and beliefs","Beliefs, schemas, and linked patterns.",s.jsx(Rf,{}))}),s.jsx(q,{path:"psyche/modes",element:e("psyche-modes","Modes","Mode profiles and guides.",s.jsx(vf,{}))}),s.jsx(q,{path:"psyche/modes/guide",element:e("psyche-mode-guide","Mode guide","Guided mode session flow.",s.jsx(bf,{}))}),s.jsx(q,{path:"kanban",element:e("kanban-index","Kanban","Task board execution surface.",s.jsx(ef,{}))}),s.jsx(q,{path:"notes",element:e("notes-index","Notes","Notes, evidence, and writing surfaces.",s.jsx(nf,{}))}),s.jsx(q,{path:"wiki",element:e("wiki-index","KarpaWiki","KarpaWiki search and page navigation.",s.jsx(wi,{}))}),s.jsx(q,{path:"wiki/ingest-history",element:e("wiki-ingest-history","KarpaWiki ingest history","Ingest jobs and processing history.",s.jsx(Qf,{}))}),s.jsx(q,{path:"wiki/page/:slug",element:e("wiki-page-detail","KarpaWiki page","KarpaWiki page detail and backlinks.",s.jsx(wi,{}))}),s.jsx(q,{path:"wiki/new",element:e("wiki-new","New KarpaWiki page","KarpaWiki editor for new pages.",s.jsx(ki,{}))}),s.jsx(q,{path:"wiki/edit/:pageId",element:e("wiki-edit","Edit KarpaWiki page","KarpaWiki editor for existing pages.",s.jsx(ki,{}))}),s.jsx(q,{path:"today",element:e("today-index","Today","Current work, time, and daily runway.",s.jsx(Vf,{}))}),s.jsx(q,{path:"workbench",element:e("workbench","Workbench","Search, organize, and launch Forge flows.",s.jsx(Zf,{}))}),s.jsx(q,{path:"workbench/:flowId",element:e("workbench-flow","Workbench flow","Graph editor and runtime surface for a single flow.",s.jsx(ey,{}))}),s.jsx(q,{path:"activity",element:e("activity-index","Activity","Activity log and event history.",s.jsx(Vg,{}))}),s.jsx(q,{path:"insights",element:e("insights-index","Insights","Insight review and decisions.",s.jsx(Zg,{}))}),s.jsx(q,{path:"review/weekly",element:e("weekly-review","Weekly review","Weekly review workflow and closeout.",s.jsx(Yf,{}))}),s.jsx(q,{path:"settings",element:e("settings-index","Settings","Operator settings and runtime configuration.",s.jsx(Ef,{}))}),s.jsx(q,{path:"settings/data",element:e("settings-data","Settings data","Runtime storage, backups, exports, and recovery.",s.jsx(Af,{}))}),s.jsx(q,{path:"settings/users",element:e("settings-users","Settings users","User directory and ownership settings.",s.jsx(Wf,{}))}),s.jsx(q,{path:"settings/calendar",element:e("settings-calendar","Settings calendar","Calendar provider settings and sync.",s.jsx(Df,{}))}),s.jsx(q,{path:"settings/mobile",element:e("settings-mobile","Settings mobile","Mobile companion settings and pairing.",s.jsx($f,{}))}),null,s.jsx(q,{path:"settings/models",element:e("settings-models","Settings models","Model connections and defaults.",s.jsx(Mf,{}))}),s.jsx(q,{path:"settings/agents",element:e("settings-agents","Settings agents","Agent tokens and runtime access.",s.jsx(Of,{}))}),s.jsx(q,{path:"settings/rewards",element:e("settings-rewards","Settings rewards","Rewards and XP rule settings.",s.jsx(zf,{}))}),s.jsx(q,{path:"rewards",element:e("rewards","Trophy Hall","Trophies, unlocks, streak pressure, and Forge Smith progression.",s.jsx(qf,{}))}),s.jsx(q,{path:"settings/wiki",element:e("settings-wiki","KarpaWiki settings","KarpaWiki ingestion and profile settings.",s.jsx(df,{}))}),s.jsx(q,{path:"settings/logs",element:e("settings-logs","Settings logs","Diagnostics and event logs.",s.jsx(Ff,{}))}),s.jsx(q,{path:"settings/bin",element:e("settings-bin","Settings bin","Deleted entity recovery.",s.jsx(Lf,{}))}),s.jsx(q,{path:"tasks/:taskId",element:e("task-detail","Task detail","Task detail, timer, and notes.",s.jsx(Gf,{}))})]}),s.jsx(q,{path:"*",element:s.jsx(Qs,{to:"/overview",replace:!0})})]})]})}class ay extends zi.Component{constructor(){super(...arguments);St(this,"state",{error:null})}static getDerivedStateFromError(a){return{error:a}}componentDidCatch(a,n){console.error("Forge failed to render",a,n)}render(){return this.state.error?s.jsx("main",{className:"grid min-h-dvh place-items-center bg-canvas px-5 py-10 text-ink",children:s.jsxs("section",{className:"w-full max-w-xl rounded-[1.25rem] border border-white/12 bg-panel/90 p-6 shadow-2xl shadow-black/30",children:[s.jsx("p",{className:"font-label text-xs font-bold uppercase tracking-[0.08em] text-primary/80",children:"Forge runtime"}),s.jsx("h1",{className:"mt-3 text-3xl font-bold tracking-normal text-ink",children:"Forge could not finish rendering"}),s.jsx("p",{className:"mt-3 text-sm leading-6 text-ink/70",children:"The HTML entrypoint loaded, but the React application hit an error before the interface could be displayed. Hard refresh the Tailscale page first; if this remains visible, check the browser console and the local Forge runtime logs."}),s.jsx("pre",{className:"mt-4 max-h-44 overflow-auto rounded-2xl border border-white/10 bg-black/30 p-4 text-xs leading-5 text-ink/70",children:this.state.error.message}),s.jsx("button",{className:"mt-5 rounded-full border border-white/12 bg-white/10 px-4 py-2 text-sm font-semibold text-ink transition hover:bg-white/15",type:"button",onClick:()=>window.location.reload(),children:"Reload Forge"})]})}):this.props.children}}const ny=new $l({defaultOptions:{queries:{staleTime:2e4,refetchOnWindowFocus:!1}}});Ml.createRoot(document.getElementById("root")).render(s.jsx(zi.StrictMode,{children:s.jsx(ay,{children:s.jsx(Jl,{store:tn,children:s.jsx(Xl,{client:ny,children:s.jsx(Fl,{basename:Nc("/forge/"),children:s.jsx(sy,{})})})})})}));export{Ww as $,yb as A,de as B,lt as C,xb as D,Is as E,ae as F,bb as G,Qe as H,ve as I,Tk as J,Pk as K,xo as L,Hr as M,Jx as N,hy as O,Le as P,Xa as Q,hw as R,yp as S,at as T,qu as U,gs as V,bc as W,Wu as X,Ku as Y,P as Z,Ew as _,Kw as a,jv as a$,Ya as a0,Ga as a1,Bd as a2,Pb as a3,Nb as a4,Ib as a5,Tb as a6,Ek as a7,Rd as a8,Es as a9,bk as aA,yk as aB,xk as aC,fk as aD,Xm as aE,nn as aF,rs as aG,dk as aH,rk as aI,ok as aJ,ik as aK,lk as aL,Km as aM,ck as aN,vk as aO,oi as aP,sk as aQ,Gs as aR,Va as aS,mu as aT,fs as aU,jo as aV,yy as aW,yi as aX,vv as aY,kv as aZ,hv as a_,Cb as aa,_k as ab,Sb as ac,Dy as ad,Fu as ae,Mu as af,$u as ag,yu as ah,Kx as ai,Ux as aj,Hx as ak,bd as al,no as am,ao as an,Vc as ao,ho as ap,Dt as aq,Ly as ar,fw as as,vw as at,gw as au,Nh as av,Ph as aw,Th as ax,yw as ay,rm as az,et as b,Zi as b$,Sv as b0,fv as b1,bv as b2,xv as b3,pv as b4,wv as b5,mv as b6,gv as b7,Rk as b8,Vh as b9,nx as bA,cx as bB,Gc as bC,xx as bD,vm as bE,Sw as bF,pn as bG,fn as bH,hn as bI,gn as bJ,yn as bK,cd as bL,Hb as bM,Vb as bN,yd as bO,pw as bP,Rb as bQ,_b as bR,og as bS,lg as bT,cg as bU,jx as bV,Ox as bW,Lx as bX,Ex as bY,Ax as bZ,kx as b_,Jh as ba,Xh as bb,Qh as bc,Yh as bd,nv as be,rv as bf,iv as bg,uv as bh,yv as bi,Nv as bj,_w as bk,Rw as bl,vx as bm,wx as bn,Ak as bo,Lw as bp,po as bq,Zh as br,eg as bs,tg as bt,lu as bu,cu as bv,Bc as bw,Kc as bx,Hc as by,Uc as bz,le as c,Gy as c$,$v as c0,Lv as c1,Mv as c2,Dv as c3,_y as c4,Cy as c5,vy as c6,wy as c7,ky as c8,jy as c9,ox as cA,ix as cB,Yy as cC,bx as cD,sx as cE,Wy as cF,qy as cG,zy as cH,By as cI,Ky as cJ,Fy as cK,Uy as cL,jb as cM,wk as cN,za as cO,Ow as cP,Aw as cQ,zw as cR,gy as cS,fy as cT,zb as cU,Wb as cV,Dk as cW,Fb as cX,qw as cY,ud as cZ,Hy as c_,Sy as ca,Ny as cb,by as cc,Ey as cd,Ay as ce,Ry as cf,Oy as cg,Py as ch,Iy as ci,Ty as cj,Bw as ck,xy as cl,Tw as cm,My as cn,ex as co,Zy as cp,Cw as cq,Qy as cr,Jy as cs,rx as ct,tx as cu,ux as cv,dx as cw,mx as cx,$y as cy,lx as cz,Ym as d,tb as d$,Vy as d0,yx as d1,fx as d2,px as d3,hx as d4,gx as d5,Qx as d6,Xx as d7,dv as d8,ov as d9,Wv as dA,Bv as dB,qv as dC,Hv as dD,Kv as dE,Uv as dF,zv as dG,Fw as dH,lw as dI,cw as dJ,dw as dK,Zv as dL,ew as dM,Jv as dN,Xv as dO,bw as dP,Yv as dQ,Qv as dR,Gv as dS,Vv as dT,Eb as dU,ow as dV,fd as dW,Fv as dX,sb as dY,Zx as dZ,eb as d_,lv as da,cv as db,ax as dc,Xy as dd,Cu as de,Oe as df,fo as dg,$w as dh,Hw as di,pd as dj,to as dk,Yw as dl,Qw as dm,Mw as dn,Ou as dp,Dw as dq,Cd as dr,Pa as ds,Ct as dt,va as du,kw as dv,jw as dw,zc as dx,Bb as dy,eo as dz,Ck as e,sv as e$,ib as e0,ab as e1,rb as e2,nb as e3,ob as e4,cb as e5,db as e6,ub as e7,mb as e8,jc as e9,Ns as eA,rw as eB,dd as eC,Wh as eD,qh as eE,Bh as eF,Kb as eG,Rv as eH,Kh as eI,Hh as eJ,Uh as eK,Ub as eL,K as eM,Gb as eN,Id as eO,Td as eP,xw as eQ,Og as eR,Lg as eS,Dg as eT,$g as eU,Mg as eV,Yb as eW,Zb as eX,Xb as eY,Qb as eZ,ev as e_,Yx as ea,pb as eb,lb as ec,Pv as ed,Tv as ee,Cv as ef,Iv as eg,Ab as eh,Ob as ei,Lb as ej,Db as ek,Mb as el,$b as em,zd as en,Nw as eo,mw as ep,sw as eq,aw as er,tw as es,nw as et,Ov as eu,Av as ev,Ev as ew,_v as ex,ro as ey,iw as ez,uc as f,av as f0,tv as f1,Jb as f2,Rx as f3,Px as f4,Tx as f5,Ix as f6,_x as f7,qx as f8,$x as f9,Xw as fA,Zw as fB,Jw as fC,Dx as fa,Bx as fb,Wx as fc,zx as fd,so as fe,Fx as ff,Mx as fg,Xc as fh,Cx as fi,Jc as fj,Nx as fk,Sx as fl,Vx as fm,Gx as fn,qb as fo,Pw as fp,Zc as fq,Vw as fr,Gw as fs,lh as ft,Lk as fu,mn as fv,Ok as fw,Uw as fx,wm as fy,ek as fz,Ur as g,Nk as h,fp as i,Ye as j,kk as k,uw as l,Wd as m,py as n,Sk as o,jk as p,Ik as q,ww as r,Iw as s,hb as t,Jp as u,gb as v,fb as w,vb as x,wb as y,kb as z};