forge-openclaw-plugin 0.3.2 → 0.3.4

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 (214) hide show
  1. package/dist/assets/action-bar-CMGr_Uv_.js +1 -0
  2. package/dist/assets/activity-page-DwGKkJtr.js +1 -0
  3. package/dist/assets/ai-surface-workspace-UtnoNmjq.js +1 -0
  4. package/dist/assets/{atlas-panel-G3wGxjYf.js → atlas-panel-f1kc-LkD.js} +1 -1
  5. package/dist/assets/{board-dIX6etHh.js → board-CLOHbg6t.js} +1 -1
  6. package/dist/assets/calendar-page-C4YqeVrC.js +1 -0
  7. package/dist/assets/calendar-rules-BQppCPiN.js +1 -0
  8. package/dist/assets/{calendar-week-toolbar-CWSK5hJl.js → calendar-week-toolbar-DdPuHUwd.js} +1 -1
  9. package/dist/assets/{charts-DFnEuIMB.js → charts-DwTguE_x.js} +1 -1
  10. package/dist/assets/companion-sync-lab-page-N3cR33GS.js +1 -0
  11. package/dist/assets/daily-metrics-dashboard-CXnAtN2T.js +1 -0
  12. package/dist/assets/define-workbench-box-DkffygDU.js +1 -0
  13. package/dist/assets/entity-link-multiselect-wuyJ8BbW.js +1 -0
  14. package/dist/assets/{entity-note-count-link-ef3ZOpKM.js → entity-note-count-link-CEtKyMAl.js} +1 -1
  15. package/dist/assets/entity-notes-surface-iKNiierJ.js +1 -0
  16. package/dist/assets/execution-board-DesFZ1f5.js +1 -0
  17. package/dist/assets/{faceted-token-search-CZmtyJTT.js → faceted-token-search-D4Okr-Kr.js} +1 -1
  18. package/dist/assets/{flagship-signal-deck-DxRfmfpN.js → flagship-signal-deck-CW91n6u9.js} +1 -1
  19. package/dist/assets/{floating-action-menu-cKjNsPYD.js → floating-action-menu-GCeuOdYZ.js} +1 -1
  20. package/dist/assets/{forms-hB0SqEh-.js → forms-C5d5hTf2.js} +1 -1
  21. package/dist/assets/generic-node-view-COhU_Wm3.js +10 -0
  22. package/dist/assets/goal-detail-page-Bd8JU3IK.js +1 -0
  23. package/dist/assets/goal-dialog-CLz5fYhO.js +1 -0
  24. package/dist/assets/goals-page-CZHNVyY-.js +1 -0
  25. package/dist/assets/{graph-DDUZNRsO.js → graph-Cd5WF3lw.js} +1 -1
  26. package/dist/assets/habits-page-CXiBB7_N.js +1 -0
  27. package/dist/assets/health-boxes-BUcsxDLh.js +1 -0
  28. package/dist/assets/index-BejvcRGb.js +2 -0
  29. package/dist/assets/{index-Bcem7l5u.css → index-CEgIwgk9.css} +1 -1
  30. package/dist/assets/inline-note-fields-CcRDO3pd.js +1 -0
  31. package/dist/assets/insight-flow-dialog-DUBk2MR8.js +1 -0
  32. package/dist/assets/{insights-page-DHG-o9P_.js → insights-page-8fLhCYsM.js} +3 -3
  33. package/dist/assets/kanban-boxes-CH7plRk1.js +1 -0
  34. package/dist/assets/kanban-page-Bq-aYwUL.js +1 -0
  35. package/dist/assets/knowledge-graph-page-DYFfWh4Y.js +1 -0
  36. package/dist/assets/life-force-page-D80rgBBR.js +1 -0
  37. package/dist/assets/{life-force-workspace-sszLD-Yn.js → life-force-workspace-CcmZRRfU.js} +1 -1
  38. package/dist/assets/{maps-C-yOWiDN.js → maps-D0Mm6WPG.js} +1 -1
  39. package/dist/assets/{metric-tile-B-tDTcBt.js → metric-tile-DysHMgM3.js} +1 -1
  40. package/dist/assets/{motion-Lt5B1XuE.js → motion-DwjmC9aq.js} +1 -1
  41. package/dist/assets/movement-boxes-BH3botKt.js +1 -0
  42. package/dist/assets/movement-page-D5KLMKS9.js +1 -0
  43. package/dist/assets/{note-markdown-CCyyE85h.js → note-markdown-Byd_vNkS.js} +1 -1
  44. package/dist/assets/note-tags-input-DYAFDq8Q.js +1 -0
  45. package/dist/assets/notes-boxes-CPiPps1e.js +1 -0
  46. package/dist/assets/notes-page-DehVrOOb.js +1 -0
  47. package/dist/assets/{open-in-graph-button-CMjJZX7G.js → open-in-graph-button-L21MKsb5.js} +1 -1
  48. package/dist/assets/{orbit-map-v2Pv9RU_.js → orbit-map-ChJOQ8CN.js} +1 -1
  49. package/dist/assets/overview-page-D_ewyeWF.js +1 -0
  50. package/dist/assets/page-hero-DlHEJ0Yt.js +1 -0
  51. package/dist/assets/pill-cluster-DhOR4m7X.js +1 -0
  52. package/dist/assets/{preference-entity-handoff-button-CKDxCnbl.js → preference-entity-handoff-button-ugHU2us9.js} +1 -1
  53. package/dist/assets/preferences-page-BTTXeSDR.js +1 -0
  54. package/dist/assets/{project-collections-NBwk6yV-.js → project-collections-USb6PUe0.js} +1 -1
  55. package/dist/assets/project-detail-page-1tD6tUsB.js +1 -0
  56. package/dist/assets/project-dialog-BaHhJqP6.js +1 -0
  57. package/dist/assets/project-management-hierarchy-page-D4HV8QXs.js +1 -0
  58. package/dist/assets/project-management-section-nav-9OV6_ifH.js +1 -0
  59. package/dist/assets/projects-boxes-AyudWls3.js +1 -0
  60. package/dist/assets/projects-page-DizVVzbt.js +1 -0
  61. package/dist/assets/psyche-behaviors-page-CX5MJjWj.js +5 -0
  62. package/dist/assets/psyche-flashcards-page-DzCGy-FV.js +1 -0
  63. package/dist/assets/psyche-goal-map-page-BcKR792E.js +1 -0
  64. package/dist/assets/psyche-graph-BNllZR67.js +1 -0
  65. package/dist/assets/psyche-metrics-page-CpEKlZLO.js +1 -0
  66. package/dist/assets/psyche-mode-guide-page-DXKSE2o7.js +1 -0
  67. package/dist/assets/psyche-modes-page-Bh6eeNm1.js +1 -0
  68. package/dist/assets/psyche-page-B44RJrrC.js +1 -0
  69. package/dist/assets/psyche-patterns-page-Bm7T5FMJ.js +5 -0
  70. package/dist/assets/psyche-questionnaire-builder-page-BNtMNjY8.js +1 -0
  71. package/dist/assets/psyche-questionnaire-detail-page-BnMXErRK.js +1 -0
  72. package/dist/assets/psyche-questionnaire-run-detail-page-CWKxbdwZ.js +1 -0
  73. package/dist/assets/psyche-questionnaire-run-page-DwH7Sk52.js +1 -0
  74. package/dist/assets/psyche-questionnaires-page-B1t_a8QU.js +1 -0
  75. package/dist/assets/{psyche-report-detail-page-Ci14mNUK.js → psyche-report-detail-page-x2AtC99e.js} +3 -3
  76. package/dist/assets/psyche-reports-page-KiwCgWPa.js +1 -0
  77. package/dist/assets/{psyche-schemas-Dxj554nU.js → psyche-schemas-Dtskzvv1.js} +1 -1
  78. package/dist/assets/psyche-schemas-beliefs-page-CIEoAJAp.js +9 -0
  79. package/dist/assets/psyche-screen-time-page-DO6UycL9.js +1 -0
  80. package/dist/assets/psyche-self-observation-page-CPcpUSdm.js +1 -0
  81. package/dist/assets/psyche-values-page-BAgNeo4L.js +5 -0
  82. package/dist/assets/question-flow-dialog-BByFV8Yw.js +2 -0
  83. package/dist/assets/{report-chain-fields-CbkT7WOO.js → report-chain-fields-BpRWMp7h.js} +1 -1
  84. package/dist/assets/rewards-page-kIiX8SHn.js +1 -0
  85. package/dist/assets/{scheduling-rules-editor-BUGnZJ0g.js → scheduling-rules-editor-oQXGcL5l.js} +1 -1
  86. package/dist/assets/{schema-badge-CLAA4p-b.js → schema-badge-BoNjw3h4.js} +1 -1
  87. package/dist/assets/schemas-IBbtdPzn.js +1 -0
  88. package/dist/assets/{select-menu-Cqs5t3ng.js → select-menu-U-YryCwP.js} +1 -1
  89. package/dist/assets/{settings-agents-page-pmkVrOO8.js → settings-agents-page-CbHeMq3e.js} +4 -4
  90. package/dist/assets/settings-bin-page-LxS2YPsA.js +1 -0
  91. package/dist/assets/{settings-calendar-page-BBjAMOCf.js → settings-calendar-page-CZc-I-HK.js} +3 -3
  92. package/dist/assets/settings-data-page-m-aBRMR9.js +1 -0
  93. package/dist/assets/settings-logs-page-BUEGWlQu.js +1 -0
  94. package/dist/assets/settings-mobile-page-C_5CHjHl.js +1 -0
  95. package/dist/assets/settings-models-page-B4HQu8kL.js +1 -0
  96. package/dist/assets/settings-page-CY8N-fNV.js +1 -0
  97. package/dist/assets/settings-rewards-page-C0XQoWjb.js +1 -0
  98. package/dist/assets/{settings-section-nav-Co0AaDG-.js → settings-section-nav-CkqqtM0F.js} +1 -1
  99. package/dist/assets/settings-users-page-COCBOq7d.js +1 -0
  100. package/dist/assets/settings-wiki-page-Dy1d7-z-.js +1 -0
  101. package/dist/assets/sleep-page-1kKicdFq.js +1 -0
  102. package/dist/assets/sports-page-DJErRii_.js +1 -0
  103. package/dist/assets/{state-vCcAT5Hq.js → state-BtwEvpO6.js} +1 -1
  104. package/dist/assets/strategies-page-CWNFb9vv.js +1 -0
  105. package/dist/assets/strategy-detail-page-D9rFVXRS.js +1 -0
  106. package/dist/assets/strategy-dialog-BIVHfUR6.js +1 -0
  107. package/dist/assets/{surface-CyWI7e1R.js → surface-B3oXO1No.js} +1 -1
  108. package/dist/assets/{table-BNqMG3_S.js → table-BuONJH1s.js} +1 -1
  109. package/dist/assets/task-detail-page-r8ipOpAF.js +1 -0
  110. package/dist/assets/task-dialog-C3kkWtcT.js +6 -0
  111. package/dist/assets/timebox-planning-dialog-BadS5tEr.js +1 -0
  112. package/dist/assets/today-boxes-CiccN0Gw.js +1 -0
  113. package/dist/assets/today-page-DvQredbl.js +1 -0
  114. package/dist/assets/training-load-page-CkX-nSoe.js +1 -0
  115. package/dist/assets/{ui-C1iwpj2-.js → ui-B9O-eUim.js} +1 -1
  116. package/dist/assets/use-anchored-overlay-position-BrQ4cqKn.js +1 -0
  117. package/dist/assets/{use-psyche-focus-target-Ct-acS9G.js → use-psyche-focus-target-Cuxni3SK.js} +1 -1
  118. package/dist/assets/user-badge-BKzwGZDd.js +1 -0
  119. package/dist/assets/user-ownership-DJGl4rAj.js +1 -0
  120. package/dist/assets/user-select-field-BNqv8-wd.js +1 -0
  121. package/dist/assets/utility-widgets-DvxKA6dI.js +3 -0
  122. package/dist/assets/{vendor-Dnkkx2co.js → vendor-Cpmju3nw.js} +1 -1
  123. package/dist/assets/vitals-page-CRIsr_C7.js +1 -0
  124. package/dist/assets/weekly-review-page-CNqxLRCd.js +1 -0
  125. package/dist/assets/weight-loss-page-SSsCp1Yw.js +5 -0
  126. package/dist/assets/{wiki-article-markdown-Bi02AsVt.js → wiki-article-markdown-C9VKineE.js} +2 -2
  127. package/dist/assets/{wiki-editor-page-OZf9l4Tg.js → wiki-editor-page-DxGsKvF7.js} +5 -5
  128. package/dist/assets/wiki-ingest-history-page-CFmP7K1F.js +1 -0
  129. package/dist/assets/wiki-ingest-modal-BLw2PSWP.js +1 -0
  130. package/dist/assets/wiki-page-BiQ-jAuz.js +1 -0
  131. package/dist/assets/workbench-flow-page-D960hXu_.js +5 -0
  132. package/dist/assets/workbench-page-BWlY-FiL.js +1 -0
  133. package/dist/assets/workout-detail-page-G32yJoE9.js +2 -0
  134. package/dist/index.html +8 -10
  135. package/dist/server/server/src/app.js +10 -0
  136. package/dist/server/server/src/health-weight-loss.js +11 -3
  137. package/dist/server/server/src/services/dashboard.js +4 -4
  138. package/dist/server/server/src/services/gamification.js +71 -32
  139. package/openclaw.plugin.json +1 -1
  140. package/package.json +1 -1
  141. package/dist/assets/activity-page-DRRbpVK-.js +0 -1
  142. package/dist/assets/ai-surface-workspace-DJPt-OaW.js +0 -1
  143. package/dist/assets/calendar-page-y8G1ige8.js +0 -1
  144. package/dist/assets/calendar-rules-CRhXqGQu.js +0 -1
  145. package/dist/assets/companion-sync-lab-page-kEgOF3c6.js +0 -1
  146. package/dist/assets/daily-metrics-dashboard-BJjUIZVA.js +0 -1
  147. package/dist/assets/entity-notes-surface-CaCjjUaq.js +0 -1
  148. package/dist/assets/execution-board-RRWm2srb.js +0 -1
  149. package/dist/assets/goal-detail-page-BgQlK7yT.js +0 -1
  150. package/dist/assets/goals-page-Cz2i3pVy.js +0 -1
  151. package/dist/assets/habits-page-BmEmWCGv.js +0 -1
  152. package/dist/assets/index-QJkjKYzZ.js +0 -19
  153. package/dist/assets/insight-flow-dialog-CdYMHwMP.js +0 -1
  154. package/dist/assets/kanban-page-C6S_fJRc.js +0 -1
  155. package/dist/assets/knowledge-graph-page-juA9QCy0.js +0 -1
  156. package/dist/assets/life-force-page-ChTIA4mV.js +0 -1
  157. package/dist/assets/movement-page-Dx3T3HrG.js +0 -1
  158. package/dist/assets/note-tags-input-BS14YXHn.js +0 -1
  159. package/dist/assets/notes-page-D3yGl8TN.js +0 -1
  160. package/dist/assets/overview-page-DSOpBpHf.js +0 -1
  161. package/dist/assets/page-hero-CONuJu5J.js +0 -1
  162. package/dist/assets/pill-cluster-W2fY48OM.js +0 -1
  163. package/dist/assets/preferences-page-Br3zrLlH.js +0 -1
  164. package/dist/assets/project-detail-page-BIU9_TRN.js +0 -1
  165. package/dist/assets/project-management-hierarchy-page-C2H620xD.js +0 -1
  166. package/dist/assets/project-management-section-nav-DRPVS1Eh.js +0 -1
  167. package/dist/assets/projects-page-w7a_L2-z.js +0 -1
  168. package/dist/assets/psyche-behaviors-page-Dt4CMC-q.js +0 -5
  169. package/dist/assets/psyche-flashcards-page-rXz06dqO.js +0 -1
  170. package/dist/assets/psyche-goal-map-page-BCcD6Jkl.js +0 -1
  171. package/dist/assets/psyche-graph-CXlAj4ED.js +0 -1
  172. package/dist/assets/psyche-metrics-page-B1otiir6.js +0 -1
  173. package/dist/assets/psyche-mode-guide-page-C6AdVIAv.js +0 -1
  174. package/dist/assets/psyche-modes-page-DoUqz2mR.js +0 -1
  175. package/dist/assets/psyche-page-BJNLQn8W.js +0 -1
  176. package/dist/assets/psyche-patterns-page-CzpMSAPu.js +0 -5
  177. package/dist/assets/psyche-questionnaire-builder-page-DjzatGVZ.js +0 -1
  178. package/dist/assets/psyche-questionnaire-detail-page-B0Qfowfg.js +0 -1
  179. package/dist/assets/psyche-questionnaire-run-detail-page-B2dNj4jJ.js +0 -1
  180. package/dist/assets/psyche-questionnaire-run-page-DyD9Ui-g.js +0 -1
  181. package/dist/assets/psyche-questionnaires-page-BxfKcoi3.js +0 -1
  182. package/dist/assets/psyche-reports-page-ALhNueiV.js +0 -1
  183. package/dist/assets/psyche-schemas-beliefs-page-C0P2Vw6-.js +0 -9
  184. package/dist/assets/psyche-screen-time-page-BYnaT3cb.js +0 -1
  185. package/dist/assets/psyche-self-observation-page-eM9vpwIB.js +0 -1
  186. package/dist/assets/psyche-values-page-BqrGIDok.js +0 -5
  187. package/dist/assets/rewards-page-DpAJ8IxE.js +0 -1
  188. package/dist/assets/settings-bin-page-BwtLrweW.js +0 -1
  189. package/dist/assets/settings-data-page-Bqy5SukM.js +0 -1
  190. package/dist/assets/settings-logs-page-8khtrf4T.js +0 -1
  191. package/dist/assets/settings-mobile-page-BcyRjEU_.js +0 -1
  192. package/dist/assets/settings-models-page-DlSnO9WX.js +0 -1
  193. package/dist/assets/settings-page-CyBQ2qcB.js +0 -1
  194. package/dist/assets/settings-rewards-page-BBX2WtVM.js +0 -1
  195. package/dist/assets/settings-users-page-JSnfFFPu.js +0 -1
  196. package/dist/assets/settings-wiki-page--nT23Fdy.js +0 -1
  197. package/dist/assets/sleep-page-CGMi3MtV.js +0 -1
  198. package/dist/assets/sports-page-Kv5bBoLr.js +0 -1
  199. package/dist/assets/strategies-page-Br7RdUJO.js +0 -1
  200. package/dist/assets/strategy-detail-page-CBWXjUhC.js +0 -1
  201. package/dist/assets/strategy-dialog-BTwkaSxI.js +0 -1
  202. package/dist/assets/task-detail-page-Qis9354n.js +0 -1
  203. package/dist/assets/timebox-planning-dialog-DB8snOBD.js +0 -1
  204. package/dist/assets/today-page-D9A5PU0S.js +0 -1
  205. package/dist/assets/training-load-page-Bpd4DQAh.js +0 -1
  206. package/dist/assets/vitals-page-CVYC-4RG.js +0 -1
  207. package/dist/assets/weekly-review-page-BP7N3fNB.js +0 -1
  208. package/dist/assets/weight-loss-page-_fX3N1UK.js +0 -5
  209. package/dist/assets/wiki-ingest-history-page-CzeNSL7N.js +0 -1
  210. package/dist/assets/wiki-ingest-modal-Ig_xnyc6.js +0 -1
  211. package/dist/assets/wiki-page-B4xuNgY4.js +0 -1
  212. package/dist/assets/workbench-flow-page-BhRJCALC.js +0 -5
  213. package/dist/assets/workbench-page-DxVs2AOY.js +0 -1
  214. package/dist/assets/workout-detail-page-D4wfkE98.js +0 -2
@@ -1 +0,0 @@
1
- import{r as Q,j as e}from"./vendor-Dnkkx2co.js";import{i as N}from"./state-vCcAT5Hq.js";import{S as B,E as G,c as l,ch as U,C as i,Z as x,B as V,d5 as X,d6 as Y,d7 as z,d8 as Z}from"./index-QJkjKYzZ.js";import{P as J}from"./page-hero-CONuJu5J.js";import{R as w,A,C,X as L,Y as F,T,a as k}from"./charts-DFnEuIMB.js";import"./motion-Lt5B1XuE.js";import"./ui-C1iwpj2-.js";import"./forms-hB0SqEh-.js";import"./board-dIX6etHh.js";import"./graph-DDUZNRsO.js";const S="min-w-0 rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-section)] p-5 shadow-[var(--card-shadow)]",_="min-w-0 rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",j="min-w-0 rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-5",d="font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",P="font-label text-[10px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",b="text-[var(--ui-ink-soft)]",m="border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",O="border border-[color-mix(in_srgb,var(--info)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-info-soft)] text-[color-mix(in_srgb,var(--info)_74%,var(--ui-ink-strong)_26%)]",K="var(--ui-border-subtle)",h="var(--ui-ink-faint)",ee="color-mix(in_srgb,var(--success)_82%,var(--primary)_18%)",se="color-mix(in_srgb,var(--success)_18%,transparent)",M="color-mix(in_srgb,var(--info)_86%,var(--primary)_14%)",W="color-mix(in_srgb,var(--info)_16%,transparent)",te="var(--ui-ink-strong)",ae="color-mix(in_srgb,var(--ui-ink-strong)_12%,transparent)",D={background:"var(--ui-surface-modal)",border:"1px solid var(--ui-border-subtle)",borderRadius:"8px",color:"var(--ui-ink-strong)"};function re(t){switch(t){case"fresh":return"border border-[color-mix(in_srgb,var(--success)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_74%,var(--ui-ink-strong)_26%)]";case"stale":return"border border-[color-mix(in_srgb,var(--warning)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_74%,var(--ui-ink-strong)_26%)]";case"unavailable":return"border border-[color-mix(in_srgb,var(--danger)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-danger-soft)] text-[color-mix(in_srgb,var(--danger)_74%,var(--ui-ink-strong)_26%)]";default:return m}}function n(t){return t>=3600?`${(t/3600).toFixed(1)}h`:`${Math.round(t/60)}m`}function R(t){return`${String(t).padStart(2,"0")}:00`}function $(t){return["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][t]??"Day"}function ie(t,r,c){return!t||!r?c:`${new Date(t).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})} → ${new Date(r).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}`}function H(t,r){const c=typeof t=="number"?t:typeof t=="string"?Number(t):0;return[r==="totalActivitySeconds"||r==="averageActivitySeconds"?n(c):String(Math.round(c)),r==="totalActivitySeconds"?"Activity":r==="averageActivitySeconds"?"Avg activity":r==="pickupCount"||r==="averagePickups"?r==="averagePickups"?"Avg pickups":"Pickups":r==="averageNotifications"?"Avg notifications":"Notifications"]}function fe(){const[t,r]=Q.useState("day"),c=N({queryKey:["forge-screen-time-settings"],queryFn:()=>X().then(s=>s.settings)}),v=N({queryKey:["forge-screen-time-day"],queryFn:()=>Y().then(s=>s.screenTime)}),p=N({queryKey:["forge-screen-time-month"],queryFn:()=>z().then(s=>s.screenTime)}),f=N({queryKey:["forge-screen-time-all-time"],queryFn:()=>Z().then(s=>s.screenTime)});if(c.isLoading||v.isLoading||p.isLoading||f.isLoading)return e.jsx(B,{});const q=c.error??v.error??p.error??f.error;if(q||!c.data||!v.data||!p.data||!f.data)return e.jsx(G,{eyebrow:"Psyche",error:q,onRetry:()=>{c.refetch(),v.refetch(),p.refetch(),f.refetch()}});const a=c.data,o=v.data,g=p.data,u=f.data,E=o.topApps.slice(0,3).map(s=>s.displayName||s.bundleIdentifier),I=typeof a.metadata.snapshot_source=="string"?a.metadata.snapshot_source.replaceAll("_"," "):"device activity report";return e.jsxs("div",{className:"space-y-5",children:[e.jsx(J,{title:"Screen Time",titleText:"Screen Time",description:"Apple-compliant device activity, hourly usage, and reflective phone context woven into Psyche.",actions:e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(l,{tone:"default",className:m,children:a.authorizationStatus.replaceAll("_"," ")}),e.jsx(l,{tone:"default",className:m,children:a.captureState.replaceAll("_"," ")}),e.jsx(l,{tone:"default",className:re(a.captureFreshness),children:a.captureFreshness}),e.jsx(l,{tone:"default",className:m,children:a.syncEnabled?"Sync on":"Sync paused"})]})}),e.jsx(U,{}),e.jsxs(i,{className:S,children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:d,children:"Reflective device activity"}),e.jsx("div",{className:x("mt-2 max-w-3xl text-sm",b),children:"Forge treats Screen Time as reflective evidence, not as fake exact foreground traces. Movement overlap is estimated from hourly bins and stays truthful about that."})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:["day","month","all_time"].map(s=>e.jsx(V,{variant:"ghost",className:t===s?"h-9 rounded-full border border-[color-mix(in_srgb,var(--success)_35%,var(--ui-border-subtle)_65%)] bg-[var(--ui-success-soft)] px-4 text-[color-mix(in_srgb,var(--success)_76%,var(--ui-ink-strong)_24%)]":"h-9 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 text-[var(--ui-ink-soft)]",onClick:()=>r(s),children:s==="all_time"?"All time":s},s))})]}),e.jsxs("div",{className:"mt-5 grid gap-3 md:grid-cols-3",children:[e.jsxs(i,{className:_,children:[e.jsx("div",{className:P,children:"Today on screen"}),e.jsx("div",{className:"mt-3 font-display text-4xl text-[var(--ui-ink-strong)]",children:n(o.summary.totalActivitySeconds)}),e.jsxs("div",{className:x("mt-2 text-sm",b),children:["Across ",o.summary.activeHourCount," active hours."]})]}),e.jsxs(i,{className:_,children:[e.jsx("div",{className:P,children:"Pickups today"}),e.jsx("div",{className:"mt-3 font-display text-4xl text-[var(--ui-ink-strong)]",children:o.summary.pickupCount}),e.jsxs("div",{className:x("mt-2 text-sm",b),children:["First pickup"," ",o.summary.firstPickupAt?new Date(o.summary.firstPickupAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"not captured","."]})]}),e.jsxs(i,{className:_,children:[e.jsx("div",{className:P,children:"Capture health"}),e.jsx("div",{className:"mt-3 text-lg text-[var(--ui-ink-strong)]",children:a.captureFreshness==="fresh"?a.captureAgeHours!==null?`Updated ${a.captureAgeHours.toFixed(1)}h ago`:"Fresh capture":a.captureFreshness==="stale"?a.captureAgeHours!==null?`Last refresh ${a.captureAgeHours.toFixed(1)}h ago`:"Capture is stale":a.captureFreshness==="unavailable"?"Unavailable":"Waiting for capture"}),e.jsxs("div",{className:x("mt-2 text-sm",b),children:[a.capturedDayCount," days, ",a.capturedHourCount," ","hourly slices, ",a.captureWindowDays," day window."]})]})]}),e.jsx(i,{className:x("mt-3",_),children:e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(l,{tone:"default",className:m,children:I}),e.jsx(l,{tone:"default",className:m,children:"Hourly model"}),e.jsx(l,{tone:"default",className:m,children:ie(a.lastCaptureStartedAt,a.lastCaptureEndedAt,"No captured range yet")}),E.map(s=>e.jsx(l,{tone:"default",className:O,children:s},s))]})})]}),t==="day"?e.jsxs("section",{className:"grid gap-4 lg:grid-cols-[minmax(0,2fr)_minmax(18rem,1fr)]",children:[e.jsxs(i,{className:S,children:[e.jsx("div",{className:d,children:"Hourly rhythm"}),e.jsx("div",{className:x("mt-2 text-sm",b),children:"Activity, pickups, and notification pressure across the day."}),e.jsx("div",{className:"mt-5 h-72",children:e.jsx(w,{width:"100%",height:"100%",children:e.jsxs(A,{data:o.hourlySegments,children:[e.jsx(C,{stroke:K,vertical:!1}),e.jsx(L,{dataKey:"hourIndex",tickFormatter:R,stroke:h,tickLine:!1,axisLine:!1}),e.jsx(F,{stroke:h,tickLine:!1,axisLine:!1,tickFormatter:s=>n(Number(s))}),e.jsx(T,{contentStyle:D,formatter:(s,y)=>H(s,String(y)),labelFormatter:s=>R(Number(s))}),e.jsx(k,{type:"monotone",dataKey:"totalActivitySeconds",stroke:ee,fill:se,strokeWidth:2}),e.jsx(k,{type:"monotone",dataKey:"pickupCount",stroke:M,fill:W,strokeWidth:1.6})]})})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs(i,{className:j,children:[e.jsx("div",{className:d,children:"Top apps"}),e.jsx("div",{className:"mt-4 space-y-3",children:o.topApps.slice(0,6).map(s=>e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-medium text-[var(--ui-ink-strong)]",children:s.displayName||s.bundleIdentifier}),e.jsx("div",{className:"truncate text-xs text-[var(--ui-ink-faint)]",children:s.categoryLabel||s.bundleIdentifier})]}),e.jsx("div",{className:"text-sm text-[var(--ui-ink-soft)]",children:n(s.totalActivitySeconds)})]},s.id))})]}),e.jsxs(i,{className:j,children:[e.jsx("div",{className:d,children:"Top categories"}),e.jsx("div",{className:"mt-4 flex flex-wrap gap-2",children:o.topCategories.slice(0,8).map(s=>e.jsxs(l,{tone:"default",className:m,children:[s.categoryLabel," ·"," ",n(s.totalActivitySeconds)]},s.id))})]})]})]}):null,t==="month"?e.jsxs("section",{className:"grid gap-4 lg:grid-cols-[minmax(0,2fr)_minmax(18rem,1fr)]",children:[e.jsxs(i,{className:S,children:[e.jsx("div",{className:d,children:"Monthly drift"}),e.jsx("div",{className:"mt-5 h-72",children:e.jsx(w,{width:"100%",height:"100%",children:e.jsxs(A,{data:g.days,children:[e.jsx(C,{stroke:K,vertical:!1}),e.jsx(L,{dataKey:"dateKey",stroke:h,tickLine:!1,axisLine:!1}),e.jsx(F,{stroke:h,tickLine:!1,axisLine:!1,tickFormatter:s=>n(Number(s))}),e.jsx(T,{contentStyle:D,formatter:(s,y)=>H(s,String(y))}),e.jsx(k,{type:"monotone",dataKey:"totalActivitySeconds",stroke:te,fill:ae,strokeWidth:2})]})})})]}),e.jsxs(i,{className:j,children:[e.jsx("div",{className:d,children:"Month summary"}),e.jsxs("div",{className:"mt-4 space-y-3 text-sm text-[var(--ui-ink-soft)]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{children:"Total activity"}),e.jsx("span",{children:n(g.totals.totalActivitySeconds)})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{children:"Pickups"}),e.jsx("span",{children:g.totals.pickupCount})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{children:"Notifications"}),e.jsx("span",{children:g.totals.notificationCount})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{children:"Active days"}),e.jsx("span",{children:g.totals.activeDays})]})]})]})]}):null,t==="all_time"?e.jsxs("section",{className:"grid gap-4 lg:grid-cols-[minmax(0,2fr)_minmax(18rem,1fr)]",children:[e.jsxs(i,{className:S,children:[e.jsx("div",{className:d,children:"Weekday pattern"}),e.jsx("div",{className:"mt-5 h-72",children:e.jsx(w,{width:"100%",height:"100%",children:e.jsxs(A,{data:u.weekdayPattern,children:[e.jsx(C,{stroke:K,vertical:!1}),e.jsx(L,{dataKey:"weekday",tickFormatter:$,stroke:h,tickLine:!1,axisLine:!1}),e.jsx(F,{stroke:h,tickLine:!1,axisLine:!1,tickFormatter:s=>n(Number(s))}),e.jsx(T,{contentStyle:D,formatter:(s,y)=>H(s,String(y)),labelFormatter:s=>$(Number(s))}),e.jsx(k,{type:"monotone",dataKey:"averageActivitySeconds",stroke:M,fill:W,strokeWidth:2})]})})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs(i,{className:j,children:[e.jsx("div",{className:d,children:"Lifetime summary"}),e.jsxs("div",{className:"mt-4 space-y-3 text-sm text-[var(--ui-ink-soft)]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{children:"Days captured"}),e.jsx("span",{children:u.summary.dayCount})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{children:"Total activity"}),e.jsx("span",{children:n(u.summary.totalActivitySeconds)})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{children:"Average per day"}),e.jsx("span",{children:n(u.summary.averageDailyActivitySeconds)})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{children:"Total pickups"}),e.jsx("span",{children:u.summary.totalPickups})]})]})]}),e.jsxs(i,{className:j,children:[e.jsx("div",{className:d,children:"Dominant categories"}),e.jsx("div",{className:"mt-4 flex flex-wrap gap-2",children:u.topCategories.slice(0,10).map(s=>e.jsxs(l,{tone:"default",className:m,children:[s.categoryLabel," ·"," ",n(s.totalActivitySeconds)]},s.id))})]})]})]}):null]})}export{fe as PsycheScreenTimePage};
@@ -1 +0,0 @@
1
- import{b5 as It,r as m,j as e,b4 as Q,aD as Ct,aG as Re,aT as At,c7 as Be,bg as Ke}from"./vendor-Dnkkx2co.js";import{j as Ot,i as M,k as W}from"./state-vCcAT5Hq.js";import{u as _t,s as Et,d3 as Mt,i as qe,bm as ze,ao as Ft,bn as Lt,H as he,S as $t,E as Pt,B as w,ch as Dt,C as He,c as f,Z as v,I as ie,aT as Rt,a0 as Bt,a1 as Kt,T as qt,m as oe,bk as N,bl as S,U as Ue,b as Ve,bu as rt,d4 as zt,bw as Ht,bx as Ut,by as Vt,bz as Qt,bA as Wt,bC as Yt}from"./index-QJkjKYzZ.js";import{n as F,p as Qe,N as We}from"./note-tags-input-BS14YXHn.js";import{P as Gt}from"./page-hero-CONuJu5J.js";import{C as Xt}from"./calendar-week-toolbar-CWSK5hJl.js";import{S as le}from"./select-menu-Cqs5t3ng.js";import{s as Ye,b as de,c as Jt,f as Ge,d as Xe}from"./calendar-ui-Cy1XRwzV.js";import{g as Zt,a as es}from"./entity-links-DwpxhW2H.js";import"./motion-Lt5B1XuE.js";import"./ui-C1iwpj2-.js";import"./forms-hB0SqEh-.js";import"./board-dIX6etHh.js";import"./graph-DDUZNRsO.js";const nt="Self-observation",ts="Forge activity",Z="Entity · ",J="all",ss=[{value:"compact",label:"Compact",description:"One row per entry: time, entity, title."},{value:"informative",label:"Informative",description:"Adds one short preview line and key context."},{value:"extended",label:"Extended",description:"Adds a little more context with a hard text cap."}],rs=[{value:"markdown",label:"Markdown brief",description:"Readable weekly notes for sharing with a therapist."},{value:"csv",label:"CSV table",description:"Structured rows for spreadsheet review."},{value:"json",label:"JSON archive",description:"Full structured payload with filters and metadata."},{value:"ics",label:"Calendar file",description:"Importable weekly timeline in calendar apps."}],Je="box-border min-w-0 max-w-full overflow-hidden rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-section)]",Y="box-border min-w-0 max-w-full overflow-hidden rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)]",ce="text-[11px] font-medium uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",P="text-sm font-medium text-[var(--ui-ink-strong)]",Ze="text-[var(--ui-ink-soft)]",ue="text-[var(--ui-ink-faint)]",K="max-w-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",me="max-w-full border border-[color-mix(in_srgb,var(--info)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-info-soft)] text-[color-mix(in_srgb,var(--info)_74%,var(--ui-ink-strong)_26%)]",pe="max-w-full border border-[color-mix(in_srgb,var(--warning)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_74%,var(--ui-ink-strong)_26%)]",ve="inline-flex max-w-full items-center gap-2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 py-1.5 text-xs text-[var(--ui-ink-medium)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]",et="inline-flex max-w-full items-center gap-1 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-2 py-1 text-[11px] text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]",tt="min-w-0 rounded-[8px] border border-dashed border-[var(--ui-border-subtle)] text-left text-sm text-[var(--ui-ink-faint)] transition hover:border-[var(--ui-border-strong)] hover:text-[var(--ui-ink-medium)]",at=new Set(["goal","project","task","strategy","habit","tag","psyche_value","behavior","belief_entry","mode_profile"]),q={noteId:null,contentMarkdown:"",author:"",tags:[],userId:null,observedAtInput:"",linkedPatternIds:[],linkedTriggerReportId:null,linkedEntityValues:[]};function z(n=[]){return F([nt,...n])}function k(n,r){return`${n}:${r}`}function ns(n){const r=n.indexOf(":");if(r<=0||r>=n.length-1)return null;const i=n.slice(0,r);return at.has(i)?{entityType:i,entityId:n.slice(r+1)}:null}function as(n){return n!==null}function is(n){const r=new Set;return n.filter(i=>{const o=`${i.entityType}:${i.entityId}:${i.anchorKey??""}`;return r.has(o)?!1:(r.add(o),!0)})}function it(n){const r=new Date(n);if(Number.isNaN(r.getTime()))return"";const i=r.getFullYear(),o=String(r.getMonth()+1).padStart(2,"0"),x=String(r.getDate()).padStart(2,"0"),g=String(r.getHours()).padStart(2,"0"),_=String(r.getMinutes()).padStart(2,"0");return`${i}-${o}-${x}T${g}:${_}`}function G(n){const r=n.getFullYear(),i=String(n.getMonth()+1).padStart(2,"0"),o=String(n.getDate()).padStart(2,"0");return`${r}-${i}-${o}`}function X(n){return new Date(n).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function H(n,r){const i=n.replace(/\s+/g," ").trim();return i.length<=r?i:`${i.slice(0,Math.max(0,r-3)).trimEnd()}...`}function os(n,r=120){return H(n.contentPlain||n.contentMarkdown,r)}function ot(n){const r=n.note.frontmatter.movement;return!!r&&typeof r=="object"&&!Array.isArray(r)}function T(n){return n.kind==="observation"}function ls(n){return T(n)?n.observation.note.user:n.activity.event.user}function ds(n){if(T(n)){const i=n.observation;return[i.note.contentPlain,i.note.contentMarkdown,i.note.author??"",i.tags.join(" "),i.linkedPatterns.map(o=>o.title).join(" "),i.linkedReports.map(o=>o.title).join(" ")].join(" ").toLowerCase()}const r=n.activity.event;return[r.title,r.description,r.actor??"",r.eventType,r.entityType,n.tags.join(" ")].join(" ").toLowerCase()}function cs(n,r){if(r.length===0)return!0;const i=new Set(n.map(o=>o.toLowerCase()));return r.some(o=>i.has(o.toLowerCase()))}function us(n,r=160){const i=[n.title,n.description].filter(Boolean).join(". ");return H(i,r)}function ms(n,r){const i=n.note.contentPlain||n.note.contentMarkdown;return H(i||"Observation",r)}function ps(n){if(ot(n))return"Movement";const r=n.note.links.find(i=>i.entityType!=="behavior_pattern"&&i.entityType!=="trigger_report");return r?rt(r.entityType):n.linkedPatterns.length>0?"Pattern":n.linkedReports.length>0?"Trigger report":"Observation"}function st(n){const r=n.tags.find(i=>i.startsWith(Z));return r?r.replace(`${Z}`,""):H(n.event.entityType||"Activity",32)}function vs(n){const r=n.filter(i=>i.startsWith(Z)).sort((i,o)=>i.localeCompare(o));return[{value:J,label:"All entities",description:"Show every entity kind across the week."},...r.map(i=>({value:i,label:i.replace(`${Z}`,""),description:`Only entries tagged ${i}.`}))]}function hs(n,r){const i=URL.createObjectURL(n),o=document.createElement("a");o.href=i,o.download=r,o.click(),URL.revokeObjectURL(i)}function gs(n,r,i){const o=new Date(n),x=new Date(r);return x.setHours(i,Number.isNaN(o.getTime())?0:o.getMinutes(),0,0),x.toISOString()}function xs(n,r){var i;return n?{noteId:n.note.id,contentMarkdown:n.note.contentMarkdown,author:n.note.author??"",tags:F(n.note.tags??[]),userId:n.note.userId??r,observedAtInput:it(n.observedAt),linkedPatternIds:n.linkedPatterns.map(o=>o.id),linkedTriggerReportId:((i=n.linkedReports[0])==null?void 0:i.id)??null,linkedEntityValues:n.note.links.filter(o=>o.entityType!=="behavior_pattern"&&o.entityType!=="trigger_report"&&at.has(o.entityType)).map(o=>k(o.entityType,o.entityId))}:{...q,tags:z(),userId:r}}function bs(n){return n.map(r=>({value:r.id,label:r.title,description:`${r.targetBehavior||r.preferredResponse||"Pattern"}${r.user?` · ${he(r.user)}`:""}`,searchText:`${r.title} ${r.targetBehavior} ${r.description} ${r.preferredResponse}`.toLowerCase(),kind:"pattern"}))}function fs(n){return n.map(r=>({value:r.id,label:r.title,description:`${r.customEventType||r.eventSituation||"Trigger report"}${r.user?` · ${he(r.user)}`:""}`,searchText:`${r.title} ${r.customEventType} ${r.eventSituation}`.toLowerCase(),kind:"report"}))}function ys({goals:n,projects:r,tasks:i,strategies:o,habits:x,tags:g,values:_,behaviors:C,beliefs:ee,modes:A}){return[...[...n.map(s=>({value:k("goal",s.id),label:s.title,description:S(s.description,s.user,"Goal"),searchText:N([s.title,s.description??""],s),kind:"goal"})),...r.map(s=>({value:k("project",s.id),label:s.title,description:S(s.description,s.user,"Project"),searchText:N([s.title,s.description??""],s),kind:"project"})),...i.map(s=>({value:k("task",s.id),label:s.title,description:S(s.description,s.user,s.owner??void 0),searchText:N([s.title,s.description??"",s.owner??""],s),kind:"task"})),...o.map(s=>({value:k("strategy",s.id),label:s.title,description:S(s.overview,s.user,"Strategy"),searchText:N([s.title,s.overview??"",s.endStateDescription??""],s),kind:"strategy"})),...x.map(s=>({value:k("habit",s.id),label:s.title,description:S(s.description,s.user,"Habit"),searchText:N([s.title,s.description??""],s),kind:"habit"})),...g.map(s=>({value:k("tag",s.id),label:s.name,description:S(s.description,s.user,s.kind??void 0),searchText:N([s.name,s.kind??"",s.description??""],s)})),..._.map(s=>({value:k("psyche_value",s.id),label:s.title,description:S(s.description,s.user,"Psyche value"),searchText:N([s.title,s.description,s.valuedDirection],s),kind:"value"})),...C.map(s=>({value:k("behavior",s.id),label:s.title,description:S(s.description,s.user,"Behavior"),searchText:N([s.title,s.description,s.kind],s),kind:"behavior"})),...ee.map(s=>({value:k("belief_entry",s.id),label:s.statement,description:S(s.flexibleAlternative||s.originNote,s.user,"Belief"),searchText:N([s.statement,s.flexibleAlternative,s.originNote],s),kind:"belief"})),...A.map(s=>({value:k("mode_profile",s.id),label:s.title,description:S(s.archetype||s.family,s.user,"Mode"),searchText:N([s.title,s.archetype,s.family,s.persona],s),kind:"mode"}))]].sort((s,te)=>s.label.localeCompare(te.label))}function ws(n){return n.note.links.filter(r=>r.entityType!=="behavior_pattern"&&r.entityType!=="trigger_report").slice(0,2).map(r=>e.jsx(f,{className:K,children:rt(r.entityType)},`${n.note.id}-${r.entityType}-${r.entityId}`))}function $s(){var Oe,_e,Ee,Me,Fe,Le,$e,Pe,De;const n=It(),r=Ot(),i=_t(),o=Array.isArray(i.selectedUserIds)?i.selectedUserIds:[],x=Et(o),[g,_]=m.useState(()=>Ye()),[C,ee]=m.useState([]),[A,ge]=m.useState(J),[s,te]=m.useState(""),[L,xe]=m.useState(!1),[D,lt]=m.useState(!0),[R,dt]=m.useState(!0),[y,ct]=m.useState("informative"),[se,ut]=m.useState("markdown"),[mt,E]=m.useState(!1),[u,b]=m.useState({...q,tags:z(),userId:x}),[pt,re]=m.useState(null),be=m.useMemo(()=>de(g,7),[g]),ne=m.useMemo(()=>Jt(g),[g]),fe=m.useMemo(()=>Array.from({length:24},(t,a)=>a),[]),j=M({queryKey:["forge-psyche-self-observation-calendar",g.toISOString(),...o],queryFn:()=>zt({from:g.toISOString(),to:be.toISOString(),userIds:o})}),ye=M({queryKey:["forge-psyche-values",...o],queryFn:()=>Ht(o)}),we=M({queryKey:["forge-psyche-patterns",...o],queryFn:()=>Ut(o)}),ke=M({queryKey:["forge-psyche-behaviors",...o],queryFn:()=>Vt(o)}),je=M({queryKey:["forge-psyche-beliefs",...o],queryFn:()=>Qt(o)}),Ne=M({queryKey:["forge-psyche-modes",...o],queryFn:()=>Wt(o)}),Se=M({queryKey:["forge-psyche-reports",...o],queryFn:()=>Yt(o)}),Te=W({mutationFn:()=>Mt({from:g.toISOString(),to:be.toISOString(),userIds:o,tags:F(A===J?C:[...C,A]),includeObservations:D,includeActivity:R,onlyHumanOwned:L,search:s.trim(),format:se}),onSuccess:t=>{hs(t.blob,t.fileName??`forge-self-observation.${se}`)}}),U=W({mutationFn:async t=>{const a=Qe(t.observedAtInput)??new Date().toISOString(),d=is([...t.linkedEntityValues.map(l=>ns(l)).filter(as).map(l=>({entityType:l.entityType,entityId:l.entityId,anchorKey:null})),...t.linkedPatternIds.map(l=>({entityType:"behavior_pattern",entityId:l,anchorKey:null})),...t.linkedTriggerReportId?[{entityType:"trigger_report",entityId:t.linkedTriggerReportId,anchorKey:null}]:[]]);return t.noteId?ze(t.noteId,{contentMarkdown:t.contentMarkdown.trim(),author:t.author.trim()||null,tags:F(t.tags),userId:t.userId,frontmatter:{observedAt:a},links:d}):Ft({contentMarkdown:t.contentMarkdown.trim(),author:t.author.trim()||null,tags:F(t.tags),userId:t.userId,frontmatter:{observedAt:a},links:d})},onSuccess:async()=>{E(!1),b({...q,tags:z(),userId:x}),await Promise.all([r.invalidateQueries({queryKey:["forge-psyche-self-observation-calendar"]}),qe(r),r.invalidateQueries({queryKey:["forge-psyche-overview"]})])}}),vt=W({mutationFn:async({noteId:t,frontmatter:a})=>ze(t,{frontmatter:a}),onSuccess:async()=>{await r.invalidateQueries({queryKey:["forge-psyche-self-observation-calendar"]})}}),ae=W({mutationFn:t=>Lt(t),onSuccess:async(t,a)=>{u.noteId===a&&(E(!1),b({...q,tags:z(),userId:x})),await Promise.all([r.invalidateQueries({queryKey:["forge-psyche-self-observation-calendar"]}),qe(r),r.invalidateQueries({queryKey:["forge-psyche-overview"]})])}}),V=m.useMemo(()=>{var t;return F([nt,ts,...((t=j.data)==null?void 0:t.calendar.availableTags)??[]])},[(Oe=j.data)==null?void 0:Oe.calendar.availableTags]),ht=m.useMemo(()=>{var t;return bs(((t=we.data)==null?void 0:t.patterns)??[])},[(_e=we.data)==null?void 0:_e.patterns]),gt=m.useMemo(()=>vs(V),[V]),xt=m.useMemo(()=>{var t;return fs(((t=Se.data)==null?void 0:t.reports)??[])},[(Ee=Se.data)==null?void 0:Ee.reports]),bt=m.useMemo(()=>{var t,a,d,l;return ys({goals:i.snapshot.goals,projects:i.snapshot.dashboard.projects,tasks:i.snapshot.tasks,strategies:i.snapshot.strategies,habits:i.snapshot.habits,tags:i.snapshot.tags,values:((t=ye.data)==null?void 0:t.values)??[],behaviors:((a=ke.data)==null?void 0:a.behaviors)??[],beliefs:((d=je.data)==null?void 0:d.beliefs)??[],modes:((l=Ne.data)==null?void 0:l.modes)??[]})},[(Me=ke.data)==null?void 0:Me.behaviors,(Fe=je.data)==null?void 0:Fe.beliefs,(Le=Ne.data)==null?void 0:Le.modes,i.snapshot.dashboard.projects,i.snapshot.goals,i.snapshot.habits,i.snapshot.strategies,i.snapshot.tags,i.snapshot.tasks,($e=ye.data)==null?void 0:$e.values]),ft=i.snapshot.users.filter(t=>o.includes(t.id)),yt=o.length===0?"All owners in scope":o.length===1?he(ft[0]??null):`${o.length} owners selected`,O=m.useMemo(()=>{var d,l;const t=F(A===J?C:[...C,A]);return[...(((d=j.data)==null?void 0:d.calendar.observations)??[]).map(c=>({kind:"observation",id:c.note.id,observedAt:c.observedAt,tags:c.tags,observation:c})),...(((l=j.data)==null?void 0:l.calendar.activity)??[]).map(c=>({kind:"activity",id:c.id,observedAt:c.observedAt,tags:c.tags,activity:c}))].filter(c=>{var I;if(T(c)&&!D||!T(c)&&!R||L&&((I=ls(c))==null?void 0:I.kind)!=="human"||!cs(c.tags,t))return!1;const p=s.trim().toLowerCase();return!(p&&!ds(c).includes(p))}).sort((c,p)=>c.observedAt.localeCompare(p.observedAt))},[A,(Pe=j.data)==null?void 0:Pe.calendar.activity,(De=j.data)==null?void 0:De.calendar.observations,L,s,C,R,D]),wt=m.useMemo(()=>O.filter(T).length,[O]),kt=m.useMemo(()=>O.filter(t=>!T(t)).length,[O]),Ie=m.useMemo(()=>{const t=new Map;for(const a of O){const d=new Date(a.observedAt),l=`${G(d)}:${d.getHours()}`,c=t.get(l)??[];c.push(a),t.set(l,c)}for(const a of t.values())a.sort((d,l)=>d.observedAt.localeCompare(l.observedAt));return t},[O]),Ce=t=>{const a=y==="compact",d=y==="extended",l=ms(t,a?92:d?144:112),c=a?"":os(t.note,d?220:120),p=ps(t),I=d?4:2;return e.jsx("div",{draggable:!a,"data-self-observation-card":t.note.id,onDragStart:h=>{a||(re(t.note.id),h.dataTransfer.setData("text/forge-self-observation-id",t.note.id))},onDragEnd:()=>re(null),className:v("min-w-0 rounded-[8px] border p-3 text-[var(--ui-ink-strong)] transition",ot(t)?"border-[color-mix(in_srgb,var(--info)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-info-soft)] hover:bg-[color-mix(in_srgb,var(--info)_12%,var(--ui-surface-1)_88%)]":"border-[color-mix(in_srgb,var(--success)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-success-soft)] hover:bg-[color-mix(in_srgb,var(--success)_12%,var(--ui-surface-1)_88%)]",a&&"px-2.5 py-2"),children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("button",{type:"button",className:"min-w-0 flex-1 text-left",onClick:()=>Nt(t),children:a?e.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[e.jsx("div",{className:"shrink-0 text-[11px] uppercase tracking-[0.16em] text-[color-mix(in_srgb,var(--success)_72%,var(--ui-ink-strong)_28%)]",children:X(t.observedAt)}),e.jsx(f,{className:v("shrink-0",me),children:p}),e.jsx("div",{className:"min-w-0 truncate text-sm font-medium text-[var(--ui-ink-strong)]",children:l})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-wrap items-start justify-between gap-2",children:e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.16em] text-[color-mix(in_srgb,var(--success)_72%,var(--ui-ink-strong)_28%)]",children:X(t.observedAt)}),e.jsx(f,{className:me,children:p}),e.jsx(Ue,{user:t.note.user,compact:!0})]})}),e.jsx("div",{className:"mt-2 break-words text-sm font-medium text-[var(--ui-ink-strong)] [overflow-wrap:anywhere]",children:l}),e.jsx("div",{className:v("mt-1 break-words text-sm leading-6 text-[var(--ui-ink-soft)] [overflow-wrap:anywhere]",d?"line-clamp-3":"line-clamp-1"),children:c}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-1.5",children:[t.note.author?e.jsx(f,{className:K,children:t.note.author}):null,t.tags.slice(0,I).map(h=>e.jsx(f,{className:me,children:h},`${t.id}-${h}`)),ws(t),t.linkedPatterns.slice(0,d?2:1).map(h=>e.jsx(Ve,{kind:"pattern",label:h.title,compact:!0,gradient:!1},h.id)),t.linkedReports.slice(0,1).map(h=>e.jsx(Ve,{kind:"report",label:h.title,compact:!0,gradient:!1},h.id))]})]})}),a?null:e.jsx("button",{type:"button",className:"rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-2 text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-danger-soft)] hover:text-[color-mix(in_srgb,var(--danger)_74%,var(--ui-ink-strong)_26%)]","aria-label":`Delete observation ${t.note.id}`,onClick:h=>{h.stopPropagation(),ae.mutateAsync(t.note.id)},children:e.jsx(Be,{className:"size-3.5"})})]})},t.id)},Ae=t=>{const a=y==="compact",d=y==="extended",l=Zt(t.event),c=es(t.event),p=H(t.event.title||"Forge activity",a?92:d?144:112),I=a?"":us(t.event,d?220:120),h=d?4:2;return e.jsx("div",{role:a&&l?"button":void 0,tabIndex:a&&l?0:void 0,className:v("min-w-0 rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-3 text-[var(--ui-ink-medium)]",a&&"px-2.5 py-2",a&&l&&"cursor-pointer"),onClick:a&&l?()=>n(l):void 0,children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx("div",{className:"min-w-0 flex-1",children:a?e.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[e.jsx("div",{className:v("shrink-0 text-[11px] uppercase tracking-[0.16em]",ue),children:X(t.observedAt)}),e.jsx(f,{className:v("shrink-0",pe),children:st(t)}),e.jsx("div",{className:"min-w-0 truncate text-sm font-medium text-[var(--ui-ink-strong)]",children:p})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:v("text-xs uppercase tracking-[0.16em]",ue),children:X(t.observedAt)}),e.jsx(f,{className:pe,children:st(t)}),e.jsx(Ue,{user:t.event.user,compact:!0})]}),e.jsx("div",{className:"mt-2 break-words text-sm font-medium text-[var(--ui-ink-strong)] [overflow-wrap:anywhere]",children:p}),t.event.description?e.jsx("div",{className:v("mt-1 break-words text-sm leading-6 text-[var(--ui-ink-soft)] [overflow-wrap:anywhere]",d?"line-clamp-3":"line-clamp-1"),children:I}):null,e.jsx("div",{className:"mt-3 flex flex-wrap gap-1.5",children:t.tags.slice(0,h).map(B=>e.jsx(f,{className:K,children:B},`${t.id}-${B}`))})]})}),!a&&l&&c?e.jsxs(w,{size:"sm",variant:"secondary",onClick:()=>n(l),className:"shrink-0",children:[e.jsx(Ke,{className:"size-4"}),c]}):null]})},t.id)},jt=t=>{b({...q,userId:x,tags:z(),observedAtInput:t?it(t.toISOString()):""})},$=(t,a)=>{const d=new Date(t);d.setHours(a,0,0,0),jt(d),E(!0)},Nt=t=>{b(xs(t,x)),E(!0)},St=async(t,a,d)=>{await vt.mutateAsync({noteId:t.note.id,frontmatter:{...t.note.frontmatter,observedAt:gs(t.observedAt,a,d)}})},Tt=async()=>{const t=await U.mutateAsync(u),a=new URLSearchParams;a.set("create","1"),a.set("sourceObservationNoteId",t.note.id),t.note.userId&&a.set("userId",t.note.userId),n(`/psyche/patterns?${a.toString()}`)};return j.isLoading?e.jsx($t,{}):j.isError?e.jsx(Pt,{eyebrow:"Self Observation",error:j.error,onRetry:()=>void j.refetch()}):e.jsxs("div",{className:"grid gap-5",children:[e.jsx(Gt,{title:"Self Observation",titleText:"Self Observation",description:"Map handwritten reflections and lower-priority Forge activity onto the real week by hour, so the calendar shows both what you noticed and what the system recorded you doing.",badge:`${O.length} visible this week`,actions:e.jsxs(w,{onClick:()=>$(new Date,new Date().getHours()),children:[e.jsx(Q,{className:"size-4"}),"Add observation"]})}),e.jsx(Dt,{}),e.jsxs(He,{className:v("grid gap-4 p-5",Je),children:[e.jsx(Xt,{eyebrow:"Observation week",description:"True self-observation stays primary. Forge activity sits underneath it as supporting context, so you can review the week as lived evidence and export exactly the slice you want to share.",weekStart:g,badges:e.jsxs(e.Fragment,{children:[e.jsx(f,{className:K,children:yt}),e.jsxs(f,{className:"max-w-full border border-[color-mix(in_srgb,var(--success)_32%,var(--ui-border-subtle)_68%)] bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_74%,var(--ui-ink-strong)_26%)]",children:[wt," observations"]}),e.jsxs(f,{className:pe,children:[kt," activity"]}),e.jsx(f,{className:K,children:L?"Human-owned only":"All owners"})]}),onPrevious:()=>_(de(g,-7)),onCurrent:()=>_(Ye()),onNext:()=>_(de(g,7))}),e.jsxs("div",{className:"grid min-w-0 max-w-full gap-4 xl:grid-cols-[minmax(0,1.4fr)_minmax(18rem,0.8fr)]",children:[e.jsxs("div",{className:v("grid min-w-0 w-full max-w-[calc(100vw-4rem)] box-border gap-3 p-4 sm:max-w-full",Y),children:[e.jsxs("div",{children:[e.jsx("div",{className:ce,children:"Filter timeline"}),e.jsx("div",{className:v("mt-1 break-words text-sm [overflow-wrap:anywhere]",Ze),children:"Search the week, focus a specific entity kind, switch density, and narrow the timeline before you review it."})]}),e.jsxs("div",{className:"grid min-w-0 max-w-full gap-3 lg:grid-cols-[minmax(0,1.1fr)_minmax(15rem,0.8fr)_minmax(15rem,0.8fr)]",children:[e.jsx(ie,{value:s,onChange:t=>te(t.target.value),placeholder:"Search notes, authors, activity, or entity labels"}),e.jsx(le,{label:"Entity kind",value:A,options:gt,onChange:ge}),e.jsx(le,{label:"Entry view",value:y,options:ss,onChange:ct})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:ce,children:"Extra tags"}),e.jsx("div",{className:v("break-words text-xs [overflow-wrap:anywhere]",ue),children:"Add narrower filters like `focus`, `Forge activity`, or `Source · UI`."}),e.jsx(We,{value:C,onChange:ee,availableTags:V,placeholder:"Filter by tag"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(w,{variant:D?"primary":"ghost",onClick:()=>lt(t=>!t),children:D?"Hide observations":"Show observations"}),e.jsx(w,{variant:R?"secondary":"ghost",onClick:()=>dt(t=>!t),children:R?"Hide Forge activity":"Show Forge activity"}),e.jsx(w,{variant:L?"secondary":"primary",onClick:()=>xe(!1),children:"All owners"}),e.jsx(w,{variant:L?"primary":"ghost",onClick:()=>xe(!0),children:"Human only"})]})]}),e.jsxs("div",{className:v("grid min-w-0 w-full max-w-[calc(100vw-4rem)] box-border gap-3 p-4 sm:max-w-full",Y),children:[e.jsxs("div",{className:"min-w-0 max-w-full",children:[e.jsx("div",{className:ce,children:"Export week"}),e.jsx("div",{className:v("mt-1 break-words text-sm [overflow-wrap:anywhere]",Ze),children:"Export respects the current search, entity, tag, owner, and observation/activity filters."})]}),e.jsx(le,{label:"Export format",value:se,options:rs,onChange:ut}),e.jsxs(w,{variant:"secondary",pending:Te.isPending,pendingLabel:"Exporting",onClick:()=>void Te.mutateAsync(),children:[e.jsx(Ct,{className:"size-4"}),"Export week"]})]})]})]}),e.jsxs(He,{className:v("min-w-0 overflow-hidden p-0",Je),children:[e.jsx("div",{className:"hidden overflow-x-auto lg:block",children:e.jsxs("div",{className:"min-w-[76rem]",children:[e.jsxs("div",{className:"grid grid-cols-[5rem_repeat(7,minmax(10rem,1fr))] border-b border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)]",children:[e.jsx("div",{className:"border-r border-[var(--ui-border-subtle)] px-3 py-4 text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Hour"}),ne.map(t=>e.jsxs("div",{className:"border-r border-[var(--ui-border-subtle)] px-3 py-4 last:border-r-0",children:[e.jsx("div",{className:"text-sm font-medium text-[var(--ui-ink-strong)]",children:Ge(t)}),e.jsx("div",{className:"mt-1 text-xs text-[var(--ui-ink-faint)]",children:G(t)})]},t.toISOString()))]}),fe.map(t=>e.jsxs("div",{className:"grid grid-cols-[5rem_repeat(7,minmax(10rem,1fr))] border-b border-[var(--ui-border-subtle)] last:border-b-0",children:[e.jsx("div",{className:"border-r border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-4 text-sm text-[var(--ui-ink-soft)]",children:Xe(t)}),ne.map(a=>{const l=`${G(a)}:${t}`,c=Ie.get(l)??[];return e.jsx("div",{"data-self-observation-slot":l,className:v("border-r border-[var(--ui-border-subtle)] px-2 py-2 last:border-r-0",y==="compact"?"min-h-[4.25rem]":y==="extended"?"min-h-[7rem]":"min-h-[5.5rem]"),onDragOver:p=>p.preventDefault(),onDrop:p=>{p.preventDefault();const I=p.dataTransfer.getData("text/forge-self-observation-id")||pt;if(!I)return;const h=O.find(B=>T(B)&&B.observation.note.id===I);!h||!T(h)||(St(h.observation,a,t),re(null))},children:e.jsxs("div",{className:"grid gap-2",children:[c.length>0?e.jsx("div",{className:"flex justify-end",children:e.jsxs("button",{type:"button",className:et,onClick:()=>$(a,t),children:[e.jsx(Q,{className:"size-3.5"}),"Add"]})}):null,c.map(p=>T(p)?Ce(p.observation):Ae(p.activity)),c.length===0?e.jsx("button",{type:"button",className:v(tt,y==="compact"?"px-3 py-2":"px-3 py-4"),onClick:()=>$(a,t),children:y==="compact"?"Add":"Add observation"}):null]})},l)})]},t))]})}),e.jsx("div",{className:"grid gap-4 p-4 lg:hidden",children:ne.map(t=>{const a=G(t);return e.jsxs("div",{className:v("p-3",Y),children:[e.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-3 rounded-[8px] bg-[var(--ui-surface-2)] px-3 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"break-words text-sm font-medium text-[var(--ui-ink-strong)] [overflow-wrap:anywhere]",children:Ge(t)}),e.jsx("div",{className:"mt-1 text-xs text-[var(--ui-ink-faint)]",children:a})]}),e.jsxs(w,{size:"sm",variant:"secondary",onClick:()=>$(t,new Date().getHours()),children:[e.jsx(Q,{className:"size-4"}),"Add"]})]}),e.jsx("div",{className:"mt-3 grid gap-2",children:fe.map(d=>{const l=`${a}:${d}`,c=Ie.get(l)??[];return e.jsxs("div",{"data-self-observation-slot-mobile":l,className:"min-w-0 rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:Xe(d)}),e.jsxs("button",{type:"button",className:et,onClick:()=>$(t,d),children:[e.jsx(Q,{className:"size-3.5"}),"Add"]})]}),e.jsx("div",{className:"mt-2 grid gap-2",children:c.length===0?e.jsx("button",{type:"button",className:v(tt,y==="compact"?"px-3 py-2":"px-3 py-3"),onClick:()=>$(t,d),children:y==="compact"?"Add":"Add observation"}):c.map(p=>T(p)?Ce(p.observation):Ae(p.activity))})]},l)})})]},a)})})]}),e.jsx(Rt,{open:mt,onOpenChange:E,eyebrow:"Self Observation",title:u.noteId?"Edit observation":"Add observation",description:"Capture the note, set the exact observation time, then attach the pattern, trigger report, and any other Forge records that belong to that moment.",children:e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-3 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]",children:[e.jsx(Bt,{value:u.userId,users:i.snapshot.users,onChange:t=>b(a=>({...a,userId:t})),defaultLabel:Kt(i.snapshot.users.find(t=>t.id===x)??null,"Choose observation owner"),help:"Observation notes stay multi-user aware just like the rest of Forge."}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:P,children:"Author"}),e.jsx(ie,{value:u.author,onChange:t=>b(a=>({...a,author:t.target.value})),placeholder:"Albert"})]})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:P,children:"Observed at"}),e.jsx(ie,{type:"datetime-local",value:u.observedAtInput,onChange:t=>b(a=>({...a,observedAtInput:t.target.value}))})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:P,children:"Observation note"}),e.jsx(qt,{value:u.contentMarkdown,onChange:t=>b(a=>({...a,contentMarkdown:t.target.value})),className:"min-h-[14rem]",placeholder:"What happened in this hour, what did you notice, and what mattered?"})]}),e.jsx(We,{value:u.tags,onChange:t=>b(a=>({...a,tags:t})),availableTags:V,placeholder:"Add note tags for the observation"}),e.jsxs("div",{className:"grid gap-3 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:P,children:"Linked patterns"}),e.jsxs("button",{type:"button",className:ve,onClick:()=>void Tt(),disabled:U.isPending||u.contentMarkdown.trim().length===0,children:[e.jsx(Re,{className:"size-3.5"}),"Create pattern from observation"]})]}),e.jsx(oe,{options:ht,selectedValues:u.linkedPatternIds,onChange:t=>b(a=>({...a,linkedPatternIds:t})),placeholder:"Search patterns in scope",emptyMessage:"No patterns in scope yet."})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:P,children:"Trigger report"}),e.jsxs("button",{type:"button",className:ve,onClick:()=>{const t=new URLSearchParams;t.set("create","1"),u.observedAtInput&&t.set("occurredAt",Qe(u.observedAtInput)??new Date().toISOString()),u.userId&&t.set("userId",u.userId),n(`/psyche/reports?${t.toString()}`),E(!1)},children:[e.jsx(Re,{className:"size-3.5"}),"Create report from time"]})]}),e.jsx(oe,{options:xt,selectedValues:u.linkedTriggerReportId?[u.linkedTriggerReportId]:[],onChange:t=>b(a=>({...a,linkedTriggerReportId:t.at(-1)??null})),placeholder:"Search trigger reports in scope",emptyMessage:"No trigger reports in scope yet."})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:P,children:"Linked records"}),e.jsx(oe,{options:bt,selectedValues:u.linkedEntityValues,onChange:t=>b(a=>({...a,linkedEntityValues:t})),placeholder:"Link goals, projects, tasks, values, beliefs, modes, or other Forge records",emptyMessage:"No linked records in scope yet."})]}),e.jsxs("div",{className:v("px-4 py-4",Y),children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 break-words text-sm text-[var(--ui-ink-medium)] [overflow-wrap:anywhere]",children:[e.jsx(At,{className:"size-4 text-[var(--tertiary)]"}),"Cards appear in the hourly week grid at the exact observation time, whether they came from deliberate reflection or rolling movement sync."]}),e.jsx("div",{className:"mt-2 break-words text-sm leading-6 text-[var(--ui-ink-soft)] [overflow-wrap:anywhere]",children:"Move them later by drag-and-drop, edit the timestamp directly here, or delete them from the card itself when the observation should not stay on the calendar."})]}),e.jsxs("div",{className:"flex flex-wrap justify-between gap-3",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[u.noteId?e.jsxs(w,{variant:"secondary",pending:ae.isPending,pendingLabel:"Deleting",onClick:()=>u.noteId?void ae.mutateAsync(u.noteId):void 0,children:[e.jsx(Be,{className:"size-4"}),"Delete observation"]}):null,u.linkedTriggerReportId?e.jsxs("button",{type:"button",className:v(ve,"py-2 text-sm"),onClick:()=>n(`/psyche/reports/${u.linkedTriggerReportId}`),children:[e.jsx(Ke,{className:"size-4"}),"Open linked report"]}):null]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(w,{variant:"secondary",onClick:()=>E(!1),children:"Cancel"}),e.jsx(w,{pending:U.isPending,pendingLabel:"Saving",disabled:u.contentMarkdown.trim().length===0,onClick:()=>void U.mutateAsync(u),children:"Save observation"})]})]})]})})]})}export{$s as PsycheSelfObservationPage};
@@ -1,5 +0,0 @@
1
- import{c2 as $,r as g,j as e}from"./vendor-Dnkkx2co.js";import{j as B,i as O,k as Q}from"./state-vCcAT5Hq.js";import{u as K,s as q,da as R,cp as W,L as z,E as H,B as k,V as T,ch as J,_ as X,U as Y,b as f,Q as Z,a0 as ee,a1 as se,F as l,I as F,T as w,cj as b,bw as te}from"./index-QJkjKYzZ.js";import{E as ae}from"./entity-note-count-link-ef3ZOpKM.js";import{A as ie}from"./atlas-panel-G3wGxjYf.js";import{O as re}from"./orbit-map-v2Pv9RU_.js";import{u as ne,p as le}from"./use-psyche-focus-target-Ct-acS9G.js";import{P as oe}from"./page-hero-CONuJu5J.js";import{p as D}from"./psyche-schemas-Dxj554nU.js";import"./motion-Lt5B1XuE.js";import"./ui-C1iwpj2-.js";import"./forms-hB0SqEh-.js";import"./board-dIX6etHh.js";import"./graph-DDUZNRsO.js";const y={title:"",description:"",valuedDirection:"",whyItMatters:"",linkedGoalIds:[],linkedProjectIds:[],linkedTaskIds:[],committedActions:[],userId:null};function I(a,u){return a.includes(u)?a.filter(m=>m!==u):[...a,u]}function de(a){return{title:a.title,description:a.description,valuedDirection:a.valuedDirection,whyItMatters:a.whyItMatters,linkedGoalIds:a.linkedGoalIds,linkedProjectIds:a.linkedProjectIds,linkedTaskIds:a.linkedTaskIds,committedActions:a.committedActions,userId:a.userId??null}}function Ie(){var E;const a=K(),u=B(),[m,N]=$(),[L,o]=g.useState(!1),[p,h]=g.useState(null),[P,d]=g.useState(y),[A,v]=g.useState(null),j=O({queryKey:["forge-psyche-values"],queryFn:te}),x=((E=j.data)==null?void 0:E.values)??[],c=q(a.selectedUserIds),C=m.get("focus"),V=a.snapshot.dashboard.notesSummaryByEntity;ne(C),g.useEffect(()=>{if(m.get("create")==="1"){o(!0),h(null),d({...y,userId:c});const s=new URLSearchParams(m);s.delete("create"),N(s,{replace:!0})}},[c,m,N]);const S=Q({mutationFn:async s=>{const i=D.parse(s);return p?R(p.id,i):W(i)},onSuccess:async()=>{o(!1),h(null),d({...y,userId:c}),v(null),await Promise.all([u.invalidateQueries({queryKey:["forge-psyche-values"]}),u.invalidateQueries({queryKey:["forge-psyche-overview"]})])}}),M=g.useMemo(()=>x.slice(0,5).map((s,i)=>({id:s.id,label:`${s.linkedGoalIds.length} goals`,title:s.title,detail:s.valuedDirection,href:`/psyche/values?focus=${s.id}#values-atlas`,angle:-90+i*68,radius:150+i%2*20,tone:["mint","sky","violet","rose"][i%4]})),[x]),U=[{id:"direction",eyebrow:"Compass",title:"Name the direction you want to protect",description:"Start with the value itself and the life-direction it points toward.",render:(s,i)=>e.jsxs(e.Fragment,{children:[e.jsx(ee,{value:s.userId??null,users:a.snapshot.users,onChange:t=>i({userId:t}),defaultLabel:se(a.snapshot.users.find(t=>t.id===c)??null,"Choose value owner"),help:"Values can belong to a human or bot user while still linking to goals, projects, and tasks across Forge."}),e.jsx(l,{label:"Value name",children:e.jsx(F,{value:s.title,onChange:t=>i({title:t.target.value}),placeholder:"Repair with steadiness"})}),e.jsx(l,{label:"Valued direction",children:e.jsx(F,{value:s.valuedDirection,onChange:t=>i({valuedDirection:t.target.value}),placeholder:"Warm, brave, and honest connection"})}),e.jsx(l,{label:"Why it matters",children:e.jsx(w,{value:s.whyItMatters,onChange:t=>i({whyItMatters:t.target.value}),placeholder:"Why is this direction important enough to protect when pressure rises?"})})]})},{id:"shape",eyebrow:"Texture",title:"Describe how the value should feel in lived form",description:"Keep this concrete enough that later reports and behaviors can map back to it.",render:(s,i)=>e.jsxs(e.Fragment,{children:[e.jsx(l,{label:"Description",children:e.jsx(w,{value:s.description,onChange:t=>i({description:t.target.value}),placeholder:"Describe what this value looks like in daily behavior, not just in theory."})}),e.jsx(l,{label:"Committed action ideas",children:e.jsx(w,{value:s.committedActions.join(`
2
- `),onChange:t=>i({committedActions:t.target.value.split(`
3
- `).map(n=>n.trim()).filter(Boolean)}),placeholder:`One line per action
4
- Text your sister before Friday
5
- Take a ten-minute reset walk`})})]})},{id:"links",eyebrow:"Placement",title:"Place the value into the real system of work",description:"This is where values become graphical anchors across goals, projects, and tasks instead of standalone notes.",render:(s,i)=>e.jsxs(e.Fragment,{children:[e.jsx(l,{label:"Linked goals",children:e.jsx("div",{className:"flex flex-wrap gap-2",children:a.snapshot.goals.map(t=>{const n=s.linkedGoalIds.includes(t.id);return e.jsx("button",{type:"button",className:`rounded-full px-2.5 py-2 text-sm transition ${b("goal",n)}`,onClick:()=>i({linkedGoalIds:I(s.linkedGoalIds,t.id)}),children:e.jsx(f,{kind:"goal",label:t.title,compact:!0,gradient:!1})},t.id)})})}),e.jsx(l,{label:"Linked projects",children:e.jsx("div",{className:"flex flex-wrap gap-2",children:a.snapshot.dashboard.projects.map(t=>{const n=s.linkedProjectIds.includes(t.id);return e.jsx("button",{type:"button",className:`rounded-full px-2.5 py-2 text-sm transition ${b("project",n)}`,onClick:()=>i({linkedProjectIds:I(s.linkedProjectIds,t.id)}),children:e.jsx(f,{kind:"project",label:t.title,compact:!0,gradient:!1})},t.id)})})}),e.jsx(l,{label:"Linked tasks",children:e.jsx("div",{className:"flex max-h-48 flex-wrap gap-2 overflow-y-auto",children:a.snapshot.tasks.slice(0,24).map(t=>{const n=s.linkedTaskIds.includes(t.id);return e.jsx("button",{type:"button",className:`rounded-full px-2.5 py-2 text-sm transition ${b("task",n)}`,onClick:()=>i({linkedTaskIds:I(s.linkedTaskIds,t.id)}),children:e.jsx(f,{kind:"task",label:t.title,compact:!0,gradient:!1})},t.id)})})})]})}];return j.isLoading?e.jsx(z,{eyebrow:"Psyche values",title:"Loading value constellation",description:"Hydrating values, linked goals, projects, and tasks."}):j.isError?e.jsx(H,{eyebrow:"Psyche values",error:j.error,onRetry:()=>void j.refetch()}):e.jsxs("div",{className:"grid gap-5",children:[e.jsx(oe,{entityKind:"value",title:e.jsx(T,{kind:"value",label:"Values",variant:"heading",size:"lg"}),description:"Map values as living anchors. Each one should visibly relate to goals, projects, and tasks so reflection stops feeling separate from the rest of life.",badge:`${x.length} values`,actions:e.jsx(k,{onClick:()=>{h(null),d({...y,userId:c}),o(!0)},children:"Add value"})}),e.jsx(J,{}),e.jsx(re,{title:"Place values inside the wider life system",description:"Values are not just notes. This constellation shows which directions are already attached to real goals, projects, and concrete tasks.",centerLabel:"Value field",centerValue:`${x.length} mapped`,nodes:M,action:e.jsx(k,{onClick:()=>{h(null),d({...y,userId:c}),o(!0)},children:"Add value"})}),e.jsx(ie,{eyebrow:"Values in context",title:"See why each value matters and where it lives",description:"Each card combines the value narrative with its linked goals, projects, tasks, and committed actions so you can understand the shape immediately.",tone:"mint",className:"scroll-mt-24",children:e.jsx("div",{id:"values-atlas",className:"grid gap-4",children:x.length===0?e.jsx("div",{className:"flex justify-start",children:e.jsx(k,{onClick:()=>{h(null),d({...y,userId:c}),o(!0)},children:"Add value"})}):x.map(s=>{const i=a.snapshot.goals.filter(r=>s.linkedGoalIds.includes(r.id)),t=a.snapshot.dashboard.projects.filter(r=>s.linkedProjectIds.includes(r.id)),n=a.snapshot.tasks.filter(r=>s.linkedTaskIds.includes(r.id)),G=C===s.id,_=X(V,"psyche_value",s.id).count;return e.jsxs("div",{"data-psyche-focus-id":s.id,className:`min-w-0 rounded-[26px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-5 transition ${le(G)}`,children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(T,{kind:"value",label:s.title,variant:"heading",size:"xl",lines:2,labelClassName:"[overflow-wrap:anywhere]"}),e.jsx("div",{className:"mt-2 text-sm text-[var(--tertiary)]",children:s.valuedDirection})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.user?e.jsx(Y,{user:s.user,compact:!0}):null,e.jsx(ae,{entityType:"psyche_value",entityId:s.id,count:_}),e.jsx(k,{variant:"secondary",onClick:()=>{h(s),d(de(s)),o(!0)},children:"Edit"})]})]}),e.jsx("p",{className:"mt-4 max-w-3xl break-words text-sm leading-7 text-[var(--ui-ink-soft)] [overflow-wrap:anywhere]",children:s.description}),e.jsxs("div",{className:"mt-5 grid gap-4 lg:grid-cols-[minmax(0,0.9fr)_minmax(0,1.1fr)]",children:[e.jsxs("div",{className:"min-w-0 rounded-[22px] bg-[var(--ui-surface-2)] p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Why it matters"}),e.jsx("div",{className:"mt-2 break-words text-sm leading-6 text-[var(--ui-ink-soft)] [overflow-wrap:anywhere]",children:s.whyItMatters})]}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[e.jsxs("div",{className:"min-w-0 rounded-[22px] bg-[var(--ui-surface-2)] p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Goals"}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:i.length===0?e.jsx("span",{className:"text-sm text-[var(--ui-ink-faint)]",children:"None linked"}):i.map(r=>e.jsx(f,{kind:"goal",label:r.title,compact:!0,wrap:!0},r.id))})]}),e.jsxs("div",{className:"min-w-0 rounded-[22px] bg-[var(--ui-surface-2)] p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Projects"}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:t.length===0?e.jsx("span",{className:"text-sm text-[var(--ui-ink-faint)]",children:"None linked"}):t.map(r=>e.jsx(f,{kind:"project",label:r.title,compact:!0,wrap:!0},r.id))})]}),e.jsxs("div",{className:"min-w-0 rounded-[22px] bg-[var(--ui-surface-2)] p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Tasks"}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:n.length===0?e.jsx("span",{className:"text-sm text-[var(--ui-ink-faint)]",children:"None linked"}):n.slice(0,4).map(r=>e.jsx(f,{kind:"task",label:r.title,compact:!0,wrap:!0},r.id))})]})]})]}),e.jsx("div",{className:"mt-4 grid gap-2 md:grid-cols-2",children:s.committedActions.map(r=>e.jsx("div",{className:"min-w-0 break-words rounded-[18px] bg-[color-mix(in_srgb,var(--success)_10%,var(--ui-surface-1)_90%)] px-4 py-3 text-sm text-[var(--ui-ink-medium)] [overflow-wrap:anywhere]",children:r},r))})]},s.id)})})}),e.jsx(Z,{open:L,onOpenChange:o,eyebrow:"Value",title:p?"Refine value placement":"Create value",description:"Forge should capture values through guided placement, not a raw admin form.",value:P,onChange:d,draftPersistenceKey:p?`psyche.value.${p.id}`:"psyche.value.new",steps:U,submitLabel:p?"Save value":"Create value",pending:S.isPending,error:A,onSubmit:async()=>{v(null);const s=D.safeParse(P);if(!s.success){v("This value still needs a title and valued direction before it can be saved.");return}try{await S.mutateAsync(s.data)}catch(i){v(i instanceof Error?i.message:"Unable to save this value right now.")}}})]})}export{Ie as PsycheValuesPage};
@@ -1 +0,0 @@
1
- import{r as S,j as t,aF as le,ds as ce,aI as J,aG as Z,dt as ee,b3 as de,bl as ue}from"./vendor-Dnkkx2co.js";import{j as me,i as he,k as pe}from"./state-vCcAT5Hq.js";import{u as ke,ey as ge,aI as fe,bE as ye,dq as Ce,ez as be,E as ve,a8 as xe,B as j,eA as A,c as N,C as D,Z as P,W as re,eB as we}from"./index-QJkjKYzZ.js";import{P as Se}from"./page-hero-CONuJu5J.js";import"./motion-Lt5B1XuE.js";import"./ui-C1iwpj2-.js";import"./forms-hB0SqEh-.js";import"./board-dIX6etHh.js";import"./graph-DDUZNRsO.js";const U=[{id:"xp_levels",label:"XP and level",trophyCount:8,unlockCount:4},{id:"streaks",label:"Streak and comeback",trophyCount:14,unlockCount:10},{id:"tasks",label:"Tasks and focus runs",trophyCount:14,unlockCount:4},{id:"projects",label:"Projects, goals, and strategy",trophyCount:14,unlockCount:4},{id:"wiki",label:"Wiki, notes, and knowledge graph",trophyCount:16,unlockCount:6},{id:"psyche",label:"Psyche",trophyCount:18,unlockCount:10},{id:"habits",label:"Habits, Life Force, and health",trophyCount:8,unlockCount:8},{id:"agents",label:"Agents and collaboration",trophyCount:4,unlockCount:2}],je=[1,2,3,5,7,14,21,30,45,60,90,180,365,730],Ae=[1,2,3,5,7,10,14,21,30,60];function e(r,l){return{metric:r,threshold:l}}function n(...r){return{allOf:r}}function $(r){return r.toLowerCase().replace(/['’]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Te(r,l){const u=(r+1)/l;return u>.82?"platinum":u>.55?"gold":u>.25?"silver":"bronze"}function _e(r){return r==="platinum"?"legendary":r==="gold"?"hard":r==="silver"?"standard":"intro"}function Ne(r){return r==="platinum"?"legendary":r==="gold"?"epic":r==="silver"?"rare":"common"}function Pe(r){return`item-${r.kind}-${$(r.category)}-${$(r.title)}`}function a(r,l,u,d,i,m){return{category:r,kind:"trophy",title:l,summary:i,requirement:u,requirementText:d,reward:`${l} trophy on the Forge shelf`}}function o(r,l,u,d,i,m,p){return{category:r,kind:"unlock",title:l,summary:m,requirement:d,requirementText:i,reward:`${l} cosmetic`,unlockType:u,rewardPayload:p}}const Re=[a("xp_levels","The First Heat",e("nonManualXp",5e3),"Earn 5,000 non-manual XP.","The first real furnace of work is hot enough to be noticed."),a("xp_levels","Bellows Graduate",e("nonManualXp",1e4),"Earn 10,000 non-manual XP.","Your reward ledger is no longer a spark; it is a system."),a("xp_levels","Iron Apprentice",e("nonManualXp",2e4),"Earn 20,000 non-manual XP.","You have repeated the work enough that the anvil knows your hand."),a("xp_levels","Steel Temper",e("nonManualXp",5e4),"Earn 50,000 non-manual XP.","Pressure has started to make the metal cleaner instead of louder."),a("xp_levels","Crown of Coals",e("nonManualXp",1e5),"Earn 100,000 non-manual XP.","A visible crown for an invisible mountain of completed work."),a("xp_levels","Obsidian Master",e("nonManualXp",25e4),"Earn 250,000 non-manual XP.","The Forge Smith stops testing your seriousness and starts respecting it."),a("xp_levels","Star-Forge Adept",e("nonManualXp",5e5),"Earn 500,000 non-manual XP.","Your XP trail burns like a constellation across the operating system."),a("xp_levels","Mythic Smith",e("nonManualXp",1e6),"Earn 1,000,000 non-manual XP.","A ridiculous trophy for a ridiculous amount of lived execution.")],Fe=[o("xp_levels","Obsidian Smith","mascot_skin",e("nonManualXp",8e3),"Earn 8,000 non-manual XP.","A dramatic black-iron Forge Smith skin.",{mascotSkin:"obsidian-smith"}),o("xp_levels","Molten Progress Bar","hud_treatment",e("nonManualXp",25e3),"Earn 25,000 non-manual XP.","A bright molten XP fill for the level ring.",{hudTreatment:"molten-progress"}),o("xp_levels","Apex Level Frame","icon_frame",e("nonManualXp",1e5),"Earn 100,000 non-manual XP.","A high-tier frame for level and trophy icons.",{iconFrame:"apex-level"}),o("xp_levels","Masterwork Glow","celebration_variant",e("nonManualXp",25e4),"Earn 250,000 non-manual XP.","A stronger forge-bell reveal for major unlocks.",{celebrationVariant:"masterwork-glow"})],Ee=[a("streaks","Spark Kept",e("longestStreakDays",1),"Play one qualifying day.","The first day is small, but the forge heard it."),a("streaks","Three-Day Furnace",e("longestStreakDays",3),"Reach a 3-day streak.","Three returns make the first shape of discipline."),a("streaks","Week-Fire",e("longestStreakDays",7),"Reach a 7-day streak.","Seven days changes the temperature of your life."),a("streaks","Twin-Week Bellows",e("longestStreakDays",14),"Reach a 14-day streak.","Two weeks of showing up makes the room expect you."),a("streaks","Cinder Discipline",e("longestStreakDays",21),"Reach a 21-day streak.","The fire is not accidental anymore."),a("streaks","Monthly Forge",e("longestStreakDays",30),"Reach a 30-day streak.","A full month of returns becomes a personal weather system."),a("streaks","Sixty-Day Flame",e("longestStreakDays",60),"Reach a 60-day streak.","The Smith grows stronger because you stopped disappearing."),a("streaks","Quarter-Anvil",e("longestStreakDays",90),"Reach a 90-day streak.","Ninety days is not motivation. It is architecture."),a("streaks","Half-Year Inferno",e("longestStreakDays",180),"Reach a 180-day streak.","The forge is now a season of your life."),a("streaks","Year of Steel",e("longestStreakDays",365),"Reach a 365-day streak.","A year of returns. The anvil has become a witness."),a("streaks","Comeback Hammer",e("comebackAfter7Count",1),"Return after 7+ missed days and complete a qualifying action.","You came back after the room went cold."),a("streaks","Repair Artist",e("comebackAfter7Count",3),"Complete 3 major comebacks.","Breaking the chain did not become breaking the story."),a("streaks","Rust Refuser",n(e("comebackAfter7Count",5),e("longestStreakDays",30)),"Complete 5 major comebacks and reach a 30-day streak.","You repeatedly turned absence into a new strike."),a("streaks","Relentless Return",n(e("comebackAfter7Count",8),e("longestStreakDays",90)),"Complete 8 major comebacks and reach a 90-day streak.","This trophy is for the part of you that keeps coming back.")],Ie=[o("streaks","Bronze Ember Flame","streak_effect",e("longestStreakDays",3),"Reach a 3-day streak.","A small ember around the streak HUD.",{streakEffect:"bronze-ember"}),o("streaks","Blue Forge-Fire","streak_effect",e("longestStreakDays",7),"Reach a 7-day streak.","A cool blue streak flame.",{streakEffect:"blue-forge-fire"}),o("streaks","Violet Arc Flame","streak_effect",e("longestStreakDays",21),"Reach a 21-day streak.","A sharper violet flame effect.",{streakEffect:"violet-arc"}),o("streaks","Molten Crown Fire","streak_effect",e("longestStreakDays",60),"Reach a 60-day streak.","A crown-like fire treatment for streaks.",{streakEffect:"molten-crown"}),o("streaks","Stern Pressure Pose","mascot_pose",e("comebackAfter7Count",1),"Complete a major comeback.","Unlocks the Smith's stern pressure pose.",{mascotPose:"stern-pressure"}),o("streaks","Comeback Pose","mascot_pose",e("comebackAfter7Count",2),"Complete 2 major comebacks.","Unlocks the Smith's comeback repair pose.",{mascotPose:"comeback"}),o("streaks","Awakening Forge Pose","mascot_pose",e("longestStreakDays",30),"Reach a 30-day streak.","Unlocks the forge awakening mascot pose.",{mascotPose:"awakening-forge"}),o("streaks","Yearfire Aura","streak_effect",e("longestStreakDays",365),"Reach a 365-day streak.","A huge aura for year-scale presence.",{streakEffect:"yearfire-aura"}),o("streaks","Old Foundry Shelf","trophy_shelf",e("longestStreakDays",90),"Reach a 90-day streak.","A warmer trophy shelf skin.",{trophyShelf:"old-foundry"}),o("streaks","Relentless Bell","celebration_variant",e("longestStreakDays",180),"Reach a 180-day streak.","A heavier celebration sound-and-spark treatment.",{celebrationVariant:"relentless-bell"})],Me=[a("tasks","First Strike",e("taskCompletionCount",25),"Complete 25 tasks.","A real task trail begins."),a("tasks","Clean Swing",n(e("taskCompletionCount",50),e("focusRunCount",10)),"Complete 50 tasks and 10 task runs.","Tasks and time-tracked execution start to converge."),a("tasks","Five Rivets",n(e("taskCompletionCount",75),e("taskCloseoutReportCount",5)),"Complete 75 tasks and 5 completion reports.","You are leaving proof behind, not just checkmarks."),a("tasks","Task Blade",n(e("taskCompletionCount",120),e("focusRunCount",25)),"Complete 120 tasks and 25 task runs.","A sharp blade forged out of repeated finishes."),a("tasks","Anvil Marathon",n(e("taskCompletionCount",300),e("focusRunCount",75)),"Complete 300 tasks and 75 task runs.","The long road achievement for serious execution."),a("tasks","Deep-Work Maul",e("creditedFocusMinutes",3e3),"Log 3,000 credited focus minutes.","The heavy hammer of deliberate time."),a("tasks","Planned Heat",e("plannedFocusRunCount",25),"Complete 25 planned task runs.","You planned the heat before striking the metal."),a("tasks","Closeout Scribe",e("taskCloseoutReportCount",25),"Write 25 task completion reports.","The Forge remembers what changed because you wrote it down."),a("tasks","Hundred-Hammer Road",e("taskCompletionCount",500),"Complete 500 tasks.","A road paved with finished work."),a("tasks","Timebox Knight",n(e("plannedFocusRunCount",75),e("creditedFocusMinutes",7500)),"Complete 75 planned runs and 7,500 focus minutes.","A trophy for time that obeyed the mission."),a("tasks","Backlog Breaker",e("taskCompletionCount",750),"Complete 750 tasks.","The backlog learned to fear your return."),a("tasks","Execution Monarch",n(e("taskCompletionCount",1e3),e("focusRunCount",200)),"Complete 1,000 tasks and 200 task runs.","A crown for turning vague intention into finished artifacts."),a("tasks","Forge Ledger Exact",e("taskCloseoutReportCount",100),"Write 100 task completion reports.","The most boring discipline becomes the most useful history."),a("tasks","The Hammer Does Not Blink",n(e("taskCompletionCount",1500),e("creditedFocusMinutes",15e3)),"Complete 1,500 tasks and 15,000 focus minutes.","For absurd consistency under real load.")],Ke=[o("tasks","Hammer Cursor","icon_frame",e("taskCompletionCount",75),"Complete 75 tasks.","A hammer-shaped action accent.",{iconFrame:"hammer-cursor"}),o("tasks","Focus Rail Glow","hud_treatment",e("focusRunCount",25),"Complete 25 task runs.","A task-run glow for compact HUDs.",{hudTreatment:"focus-rail-glow"}),o("tasks","Completion Burst","celebration_variant",e("taskCloseoutReportCount",25),"Write 25 completion reports.","A sharper task-completion burst.",{celebrationVariant:"completion-burst"}),o("tasks","Ember Knight","mascot_skin",e("taskCompletionCount",500),"Complete 500 tasks.","A molten-armored Forge Smith skin for execution mastery.",{mascotSkin:"ember-knight"})],$e=[a("projects","Aligned Spark",e("goalLinkedTaskCompletionCount",25),"Complete 25 goal-linked tasks.","Work starts pointing at something bigger."),a("projects","Goal Rivet",n(e("goalLinkedTaskCompletionCount",50),e("distinctGoalsWithCompletions",3)),"Complete 50 goal-linked tasks across 3 goals.","Several goals now have real rivets, not just titles."),a("projects","Strategist's Seal",n(e("goalLinkedTaskCompletionCount",50),e("distinctGoalsWithCompletions",5)),"Complete 50 goal-linked tasks across 5 goals.","A seal for strategy that survived contact with execution."),a("projects","Project Spine",n(e("projectLinkedTaskCompletionCount",100),e("activeProjectCount",5)),"Complete 100 project-linked tasks while maintaining 5 active projects.","The work has a spine across multiple initiatives."),a("projects","Strategy Weld",e("strategyCount",10),"Create 10 strategies.","You forged planning layers instead of improvising every day."),a("projects","Purpose Hammer",e("goalLinkedTaskCompletionCount",150),"Complete 150 goal-linked tasks.","The hammer keeps landing where your stated life points."),a("projects","Arc Builder",n(e("projectLinkedTaskCompletionCount",250),e("distinctGoalsWithCompletions",8)),"Complete 250 project-linked tasks across 8 goals.","Multiple arcs moved because you kept building."),a("projects","North-Star Foundry",n(e("goalLinkedTaskCompletionCount",300),e("strategyCount",20)),"Complete 300 goal-linked tasks and create 20 strategies.","The north star is no longer decorative."),a("projects","Project Finisher",e("projectCompletionCount",5),"Complete 5 projects.","Finished projects leave heavier evidence than active dreams."),a("projects","Life-Work Crown",n(e("projectCompletionCount",10),e("goalLinkedTaskCompletionCount",500)),"Complete 10 projects and 500 goal-linked tasks.","A crown for long arcs that actually closed."),a("projects","Portfolio Anvil",e("activeProjectCount",12),"Maintain 12 active projects.","A large operating portfolio, held without flattening."),a("projects","Tracer Bullet Guild",n(e("projectCompletionCount",15),e("strategyCount",35)),"Complete 15 projects and create 35 strategies.","Strategy and delivery joined hands repeatedly."),a("projects","Mountain Moved",e("goalLinkedTaskCompletionCount",1e3),"Complete 1,000 goal-linked tasks.","The trophy for moving a mountain one task at a time."),a("projects","The Work Had A Spine",n(e("projectCompletionCount",25),e("distinctGoalsWithCompletions",12)),"Complete 25 projects across 12 goals.","Your life map became execution history.")],Le=[o("projects","Goal Compass Frame","icon_frame",e("goalLinkedTaskCompletionCount",50),"Complete 50 goal-linked tasks.","A compass frame for aligned-work trophies.",{iconFrame:"goal-compass"}),o("projects","War-Room Iron Shelf","trophy_shelf",e("projectLinkedTaskCompletionCount",150),"Complete 150 project-linked tasks.","A darker tactical trophy shelf.",{trophyShelf:"war-room-iron"}),o("projects","North-Star HUD","hud_treatment",e("strategyCount",20),"Create 20 strategies.","A strategy-forward HUD treatment.",{hudTreatment:"north-star"}),o("projects","Foundry Compass Burst","celebration_variant",e("projectCompletionCount",10),"Complete 10 projects.","A compass-shaped major reveal.",{celebrationVariant:"foundry-compass"})],Ge=[a("wiki","First Inscription",e("wikiPageCount",50),"Create 50 wiki pages.","Knowledge has started to become an archive."),a("wiki","Memory Rivet",e("noteCount",100),"Create 100 notes.","The system remembers because you gave it material."),a("wiki","Archive Ember",n(e("wikiPageCount",150),e("wikiLinkCount",50)),"Create 150 wiki pages and 50 wiki links.","The archive starts connecting to itself."),a("wiki","Knowledge Anvil",n(e("wikiPageCount",250),e("wikiLinkCount",150)),"Create 250 wiki pages and 150 wiki links.","A serious anvil of memory and links."),a("wiki","Living Index",n(e("wikiPageWithSummaryCount",100),e("linkedWikiPageCount",100)),"Maintain 100 wiki pages with summaries and linked entities.","Pages now carry shape, summary, and relationships."),a("wiki","Black Library",n(e("wikiPageCount",500),e("wikiLinkCount",300)),"Create 500 wiki pages and 300 wiki links.","The great hard knowledge trophy."),a("wiki","Obsidian Index",n(e("wikiPageWithSummaryCount",250),e("wikiLinkCount",500)),"Maintain 250 summarized pages and 500 links.","The archive is no longer just big; it is navigable."),a("wiki","Graph Lantern",e("knowledgeGraphNodeCount",500),"Reach 500 Knowledge Graph nodes.","The graph has enough stars to navigate by."),a("wiki","Entity Weaver",e("linkedWikiPageCount",200),"Link 200 wiki pages to other pages or entities.","Your memory connects to the operating system."),a("wiki","Codex Temper",n(e("wikiPageCount",750),e("wikiLinkCount",750)),"Create 750 wiki pages and 750 wiki links.","A codex tempered by breadth and connection."),a("wiki","Note Furnace",e("noteCount",500),"Create 500 notes.","Raw notes became a real furnace of evidence."),a("wiki","Archive Cartographer",n(e("wikiPageWithSummaryCount",400),e("linkedWikiPageCount",300)),"Maintain 400 summarized pages and 300 linked pages.","You mapped the archive enough that it can map you back."),a("wiki","The Shelf Breathes",e("knowledgeGraphNodeCount",1e3),"Reach 1,000 Knowledge Graph nodes.","The knowledge system feels alive at a glance."),a("wiki","Librarian of Coals",n(e("noteCount",1e3),e("wikiLinkCount",1e3)),"Create 1,000 notes and 1,000 wiki links.","A trophy for the long, quiet archive discipline."),a("wiki","Living Codex",n(e("wikiPageCount",1500),e("wikiPageWithSummaryCount",750),e("wikiLinkCount",1500)),"Create 1,500 pages, 750 summarized pages, and 1,500 links.","The living memory crown."),a("wiki","Memory Starfield",e("knowledgeGraphNodeCount",2e3),"Reach 2,000 Knowledge Graph nodes.","The graph becomes a sky.")],Oe=[o("wiki","Quiet Library Shelf","trophy_shelf",e("wikiPageCount",150),"Create 150 wiki pages.","A quiet library shelf skin.",{trophyShelf:"quiet-library"}),o("wiki","Rune Page Frame","icon_frame",e("wikiLinkCount",150),"Create 150 wiki links.","A runic frame for knowledge trophies.",{iconFrame:"rune-page"}),o("wiki","Scholar Glass HUD","hud_treatment",e("wikiPageWithSummaryCount",100),"Maintain 100 summarized wiki pages.","A glassy scholar HUD treatment.",{hudTreatment:"scholar-glass"}),o("wiki","Archive Sparks","celebration_variant",e("linkedWikiPageCount",200),"Link 200 wiki pages to other pages or entities.","A page-flare reveal variant.",{celebrationVariant:"archive-sparks"}),o("wiki","Astral Archive Shelf","trophy_shelf",e("knowledgeGraphNodeCount",1e3),"Reach 1,000 Knowledge Graph nodes.","A cosmic trophy shelf for memory work.",{trophyShelf:"astral-archive"}),o("wiki","Reading Smith Pose","mascot_pose",e("wikiPageWithSummaryCount",250),"Maintain 250 summarized wiki pages.","Unlocks the Forge Smith reading pose.",{mascotPose:"reading"})],De=[a("psyche","Named Spark",e("psycheValueCount",5),"Create 5 Psyche values.","You named the values the forge should obey."),a("psyche","Pattern Tongs",e("behaviorPatternCount",5),"Create 5 behavior patterns.","The recurring loops are now held with tongs."),a("psyche","Belief Crucible",e("beliefEntryCount",5),"Create 5 belief entries.","Beliefs entered the fire where they can be worked."),a("psyche","Mode Lantern",e("modeProfileCount",3),"Create 3 mode profiles.","The inner cast has names and lantern light."),a("psyche","Trigger Witness",e("triggerReportCount",3),"Create 3 trigger reports.","You turned moments of activation into evidence."),a("psyche","Mode Cartographer",n(e("modeProfileCount",8),e("linkedModeProfileCount",8)),"Create 8 mode profiles, each linked to a value, behavior, or pattern.","A map of modes, not a pile of labels."),a("psyche","Trigger Alchemist",n(e("triggerReportRichCount",30),e("triggerReportCompletedCount",20)),"Complete 30 rich trigger reports and mark 20 reports beyond draft.","Activation was turned into material for change."),a("psyche","Pattern Breaker",n(e("behaviorPatternCount",20),e("behaviorPatternWithReplacementCount",10)),"Create 20 patterns and link 10 to replacement responses.","The old loops now have counter-moves."),a("psyche","Belief Temperer",n(e("beliefEntryCount",25),e("beliefFlexibleAlternativeCount",25)),"Create 25 beliefs with flexible alternatives.","Rigid beliefs were heated until they could bend."),a("psyche","Value Blade",n(e("psycheValueCount",10),e("goalLinkedTaskCompletionCount",100)),"Create 10 values and complete 100 goal-linked tasks.","Values and work started cutting in the same direction."),a("psyche","Shadow Temper",n(e("modeProfileCount",12),e("triggerReportRichCount",50)),"Create 12 modes and 50 rich trigger reports.","Shadow material became usable steel."),a("psyche","Inner Forge",n(e("psycheValueCount",12),e("behaviorPatternCount",25),e("beliefFlexibleAlternativeCount",30)),"Create 12 values, 25 patterns, and 30 flexible beliefs.","A full inner forge takes shape."),a("psyche","Schema Bell",e("questionnaireRunCount",40),"Complete 40 questionnaire runs.","Structured self-observation rang the bell repeatedly."),a("psyche","Mode Guide",e("modeGuideSessionCount",5),"Complete 5 mode guide sessions.","Guided mode work became an actual practice."),a("psyche","Repair Script",e("behaviorCount",10),"Create 10 Psyche behaviors.","Behaviors now carry repair plans, not just names."),a("psyche","Flexible Self",e("beliefFlexibleAlternativeCount",50),"Create 50 beliefs with flexible alternatives.","A trophy for not letting old beliefs remain iron cages."),a("psyche","Trigger Cartography",e("triggerReportRichCount",100),"Create 100 rich trigger reports.","The map of activation became detailed enough to steer by."),a("psyche","The Inner Council",n(e("modeProfileCount",20),e("behaviorCount",20),e("beliefFlexibleAlternativeCount",75)),"Create 20 modes, 20 behaviors, and 75 flexible beliefs.","The inner system became a council instead of noise.")],He=[o("psyche","Scholar Smith","mascot_skin",e("psycheValueCount",7),"Create 7 Psyche values.","A wise, bookish Forge Smith skin.",{mascotSkin:"scholar-smith"}),o("psyche","Wise Smith Pose","mascot_pose",e("modeProfileCount",3),"Create 3 mode profiles.","Unlocks the wise mentor pose.",{mascotPose:"wise"}),o("psyche","Reflection Frame","icon_frame",e("beliefEntryCount",10),"Create 10 belief entries.","A reflective frame for Psyche trophies.",{iconFrame:"reflection"}),o("psyche","Mode Lens HUD","hud_treatment",e("modeProfileCount",8),"Create 8 mode profiles.","A HUD tuned to Psyche work.",{hudTreatment:"mode-lens"}),o("psyche","Shadow Smith","mascot_skin",e("triggerReportRichCount",25),"Create 25 rich trigger reports.","A darker Smith skin for shadow work.",{mascotSkin:"shadow-smith"}),o("psyche","Arcane Metallurgist","mascot_skin",e("beliefFlexibleAlternativeCount",25),"Create 25 beliefs with flexible alternatives.","A rune-lit Smith skin for deep reflection.",{mascotSkin:"arcane-metallurgist"}),o("psyche","Inner-Fire Halo","streak_effect",e("psycheValueCount",10),"Create 10 Psyche values.","A halo-like flame for reflective momentum.",{streakEffect:"inner-fire-halo"}),o("psyche","Mode Lantern Reveal","celebration_variant",e("modeProfileCount",12),"Create 12 mode profiles.","A lantern reveal for Psyche unlocks.",{celebrationVariant:"mode-lantern"}),o("psyche","Therapist's Shelf","trophy_shelf",e("triggerReportRichCount",50),"Create 50 rich trigger reports.","A quiet shelf for inner-work trophies.",{trophyShelf:"therapist-shelf"}),o("psyche","Prismatic Crucible","celebration_variant",e("beliefFlexibleAlternativeCount",50),"Create 50 flexible belief alternatives.","A prismatic reveal for belief work.",{celebrationVariant:"prismatic-crucible"})],ze=[a("habits","Ritual Spark",e("habitAlignedCount",25),"Record 25 aligned habit check-ins.","Your recurring commitments have started to leave marks."),a("habits","Routine Rivet",e("habitAlignedCount",75),"Record 75 aligned habit check-ins.","The habit rail is no longer decorative."),a("habits","Habit Heat",n(e("habitAlignedCount",150),e("habitStreakMax",14)),"Record 150 aligned check-ins and a 14-day habit streak.","One behavior got hot enough to shape you."),a("habits","Ritual Iron",e("habitAlignedCount",365),"Record 365 aligned habit check-ins.","The hard habit trophy."),a("habits","Recovery Shield",e("recoveryEventCount",50),"Earn 50 recovery rewards.","Recovery was treated as part of the work."),a("habits","Life-Force Alloy",e("lifeForceSnapshotCount",100),"Record 100 Life Force day snapshots.","Energy accounting became a usable alloy."),a("habits","Sleep Temper",e("healthSleepSessionCount",120),"Import 120 sleep sessions.","Sleep became evidence, not a guess."),a("habits","Vitality Forge",n(e("workoutSessionCount",100),e("healthSleepSessionCount",200)),"Import 100 workouts and 200 sleep sessions.","Body data and execution entered the same forge.")],Be=[o("habits","Recovery Blue Flame","streak_effect",e("recoveryEventCount",20),"Earn 20 recovery rewards.","A cooler recovery flame.",{streakEffect:"recovery-blue"}),o("habits","Ritual Check Glow","hud_treatment",e("habitAlignedCount",75),"Record 75 aligned habit check-ins.","A habit-check glow for the HUD.",{hudTreatment:"ritual-check"}),o("habits","Storm Forger","mascot_skin",e("workoutSessionCount",50),"Import 50 workouts.","A storm-lit Smith skin for movement arcs.",{mascotSkin:"storm-forger"}),o("habits","Clockwork Smith","mascot_skin",e("habitAlignedCount",150),"Record 150 aligned habit check-ins.","A clockwork skin for ritual precision.",{mascotSkin:"clockwork-smith"}),o("habits","Vital Flame","streak_effect",e("healthSleepSessionCount",90),"Import 90 sleep sessions.","A vital-sign flame around streak indicators.",{streakEffect:"vital-flame"}),o("habits","Life-Force Frame","icon_frame",e("lifeForceSnapshotCount",100),"Record 100 Life Force snapshots.","An AP-inspired frame for body trophies.",{iconFrame:"life-force"}),o("habits","Steady-State Aura","streak_effect",e("habitStreakMax",60),"Reach a 60-day habit streak.","An aura for long stable rituals.",{streakEffect:"steady-state"}),o("habits","Celestial Smith","mascot_skin",n(e("workoutSessionCount",100),e("healthSleepSessionCount",200)),"Import 100 workouts and 200 sleep sessions.","A celestial skin for body stewardship.",{mascotSkin:"celestial-smith"})],We=[a("agents","Companion Spark",e("agentActionCount",5),"Record 5 agent actions.","The first sign of a working human-agent council."),a("agents","Bot Bellows",e("agentCompletedActionCount",20),"Complete 20 agent actions.","Agents are not just present; they are moving work."),a("agents","Council Spark",e("collaborationRewardCount",50),"Earn 50 collaboration rewards.","The collaboration trophy for meaningful assisted work."),a("agents","Guild Forge",n(e("agentCompletedActionCount",100),e("collaborationRewardCount",100)),"Complete 100 agent actions and earn 100 collaboration rewards.","The Forge has become a small guild.")],Ue=[o("agents","Guild Badge Frame","icon_frame",e("agentCompletedActionCount",20),"Complete 20 agent actions.","A guild frame for agent trophies.",{iconFrame:"guild-badge"}),o("agents","Council Sparks Reveal","celebration_variant",e("collaborationRewardCount",50),"Earn 50 collaboration rewards.","A council-sparks reveal for collaboration.",{celebrationVariant:"council-sparks"})],Ye=[...Re,...Fe,...Ee,...Ie,...Me,...Ke,...$e,...Le,...Ge,...Oe,...De,...He,...ze,...Be,...We,...Ue];function Xe(){let r=0,l=0,u=0;const d=new Map;return Ye.map(i=>{const m=U.find(L=>L.id===i.category);if(!m)throw new Error(`Unknown gamification category ${i.category}`);const p=d.get(i.category)??{trophy:0,unlock:0},x=p[i.kind];p[i.kind]+=1,d.set(i.category,p);const R=i.kind==="trophy"?m.trophyCount:m.unlockCount,v=Te(x,R),F=`${i.kind}-${$(i.category)}-${$(i.title)}`,w=i.kind==="trophy"?l++:u++;return{id:F,kind:i.kind,category:i.category,tier:v,difficulty:_e(v),hidden:i.hidden??!1,title:i.title,summary:i.summary,requirement:i.requirement,requirementText:i.requirementText,reward:i.reward,unlockType:i.kind==="unlock"?i.unlockType??"icon_frame":null,rewardPayload:i.kind==="unlock"?i.rewardPayload??{}:{trophyId:F},assetKey:Pe(i),sheetKey:`${i.kind==="trophy"?"trophies":"unlocks"}-r${Math.floor(w/10)+1}-c${w%10+1}`,rarity:Ne(v),sortOrder:r++}})}const y=Xe();function qe(){if(y.length!==144)throw new Error(`GAMIFICATION_CATALOG must contain exactly 144 items; found ${y.length}.`);const r=y.filter(d=>d.kind==="trophy").length,l=y.filter(d=>d.kind==="unlock").length;if(r!==96||l!==48)throw new Error(`GAMIFICATION_CATALOG must contain 96 trophies and 48 unlocks; found ${r}/${l}.`);for(const d of U){const i=y.filter(p=>p.category===d.id&&p.kind==="trophy").length,m=y.filter(p=>p.category===d.id&&p.kind==="unlock").length;if(i!==d.trophyCount||m!==d.unlockCount)throw new Error(`${d.id} expected ${d.trophyCount}/${d.unlockCount}, found ${i}/${m}.`)}if(new Set(y.map(d=>d.assetKey)).size!==y.length)throw new Error("Every trophy and unlock must have a unique asset key.")}qe();const te=U.map(r=>({id:r.id,label:r.label})),Ve=Array.from({length:30},(r,l)=>`mascot-state-${String(l+1).padStart(3,"0")}`),Qe=je.map((r,l)=>[r,`mascot-state-${String(17+l).padStart(3,"0")}`]),Je=Ae.map((r,l)=>[r,`mascot-state-${String(10-l).padStart(3,"0")}`]),z=Ve;if(z.length!==30)throw new Error(`GAMIFICATION_MASCOT_KEYS must contain exactly 30 mascot/state keys; found ${z.length}.`);function Ze(r){switch(r.category){case"xp_levels":return"#f59e0b";case"streaks":return"#fb923c";case"tasks":return"#f97316";case"projects":return"#38bdf8";case"wiki":return"#a78bfa";case"psyche":return"#8b5cf6";case"habits":return"#4ade80";case"agents":return"#22d3ee";default:return"#f59e0b"}}function et(r){return["cinematic stylized blacksmith game icon",r.category.replace(/_/g," "),r.kind,r.title,"obsidian iron, ember gold, cool violet and cyan steel highlights, no text"].join(", ")}const tt=Object.fromEntries(y.map(r=>[r.assetKey,{key:r.assetKey,role:"item",itemKind:r.kind,alt:`${r.title} ${r.kind} icon.`,dominantColor:Ze(r),tierFrame:r.tier,sourcePath:`gamification/source/themes/dark-fantasy/items/${r.assetKey}.png`,spritePath:`gamification/sprites/themes/dark-fantasy/items/${r.assetKey}-{size}.webp`,sheetKey:r.sheetKey,prompt:et(r)}])),at=Object.fromEntries(z.map(r=>{const l=Number(r.replace("mascot-state-","")),u=l<=10,d=l>=17;return[r,{key:r,role:d||u?"streak":"mascot",alt:u?"The Forge Smith in a safe cold-forge absence state.":"The Forge Smith mascot in a dramatic blacksmith game-art pose.",dominantColor:u?"#64748b":d?"#fb923c":"#38bdf8",tierFrame:"none",sourcePath:`gamification/source/themes/dark-fantasy/mascots/${r}.png`,spritePath:`gamification/sprites/themes/dark-fantasy/mascots/${r}-{size}.webp`,sheetKey:null,prompt:"dramatic Forge Smith blacksmith mascot, premium game art, no text, no watermark"}]}));({...tt,...at});function T(r){r.currentTarget.hidden=!0}const rt=["all","bronze","silver","gold","platinum"],st=[{id:"trophies",label:"Trophies"},{id:"unlocks",label:"Unlocks"},{id:"armory",label:"Mascot Armory"},{id:"streak",label:"Streak Forge"}],B={mascot_skin:{field:"selectedMascotSkin",payloadKey:"mascotSkin",label:"Mascot skin"},hud_treatment:{field:"selectedHudTreatment",payloadKey:"hudTreatment",label:"HUD treatment"},streak_effect:{field:"selectedStreakEffect",payloadKey:"streakEffect",label:"Streak flame"},trophy_shelf:{field:"selectedTrophyShelf",payloadKey:"trophyShelf",label:"Trophy shelf"},celebration_variant:{field:"selectedCelebrationVariant",payloadKey:"celebrationVariant",label:"Celebration"}};function se(r){switch(r){case"platinum":return"border-[color-mix(in_srgb,var(--primary)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-accent-soft)] text-[var(--primary)]";case"gold":return"border-[color-mix(in_srgb,var(--warning)_32%,var(--ui-border-subtle)_68%)] bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_78%,var(--ui-ink-strong)_22%)]";case"silver":return"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]";default:return"border-[color-mix(in_srgb,var(--warning)_26%,var(--ui-border-subtle)_74%)] bg-[var(--ui-warning-soft)] text-[var(--warning)]"}}const ae="min-w-0 overflow-hidden rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-4",H="min-w-0 overflow-hidden rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",C="text-[var(--ui-ink-strong)]",b="text-[var(--ui-ink-soft)]",_="text-[var(--ui-ink-faint)]",W="bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]";function ot(r){const l=r.unlockType?B[r.unlockType]:null,u=l?r.rewardPayload[l.payloadKey]:null;return typeof u=="string"?u:null}function nt({item:r,gamificationTheme:l,onSelect:u}){return t.jsxs("button",{type:"button",onClick:()=>u(r),className:P("group relative min-h-[19rem] overflow-hidden rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-4 text-left shadow-[var(--ui-shadow-soft)] transition hover:-translate-y-0.5 hover:border-[color-mix(in_srgb,var(--primary)_30%,var(--ui-border-subtle)_70%)] hover:bg-[var(--ui-surface-hover)]",!r.unlocked&&"opacity-78"),children:[t.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-3",children:[t.jsx(N,{className:P("border",se(r.tier)),children:r.tier}),t.jsx(N,{className:W,children:r.unlocked?"earned":"locked"})]}),t.jsx("div",{className:"mt-3 grid place-items-center",children:t.jsx("img",{src:A(r.assetKey,512,l),alt:"",onError:T,className:P("size-36 object-contain drop-shadow-[var(--ui-shadow-soft)] transition group-hover:scale-[1.03]",!r.unlocked&&"grayscale")})}),t.jsxs("div",{className:"mt-3 min-w-0",children:[t.jsx("div",{className:`font-display text-lg ${C}`,children:r.title}),t.jsx("p",{className:`mt-2 line-clamp-2 text-sm leading-6 ${b}`,children:r.unlocked?r.summary:r.requirementText})]}),t.jsxs("div",{className:"mt-4",children:[t.jsx(re,{value:r.progressPercent}),t.jsxs("div",{className:`mt-2 flex justify-between gap-3 text-[11px] uppercase tracking-[0.16em] ${_}`,children:[t.jsxs("span",{children:[r.progressCurrent,"/",r.progressTarget]}),t.jsxs("span",{children:[r.progressPercent,"%"]})]})]})]})}function gt(){var X,q,V,Q;const r=ke(),l=ge(),u=me(),d=fe(),i=Array.isArray(r.selectedUserIds)?r.selectedUserIds:[],[m,p]=S.useState("trophies"),[x,R]=S.useState("all"),[v,F]=S.useState("all"),[w,L]=S.useState("all"),[G,oe]=S.useState(""),[k,E]=S.useState(null),I=he({queryKey:["forge-gamification-catalog",...i],queryFn:()=>we(i)}),M=ye(i),Y=pe({mutationFn:s=>be(s,i),onSuccess:async()=>{await Promise.all([u.invalidateQueries({queryKey:["forge-gamification-catalog"]}),u.invalidateQueries({queryKey:["forge-xp-metrics"]})]),d(Ce.util.invalidateTags(["Gamification"]))}}),g=(X=I.data)==null?void 0:X.catalog,O=(g==null?void 0:g.items)??[],ne=S.useMemo(()=>{const s=G.trim().toLowerCase();return O.filter(c=>m==="trophies"&&c.kind!=="trophy"||m==="unlocks"&&c.kind!=="unlock"||(m==="armory"||m==="streak")&&c.kind!=="unlock"||m==="armory"&&!c.unlockType||m==="streak"&&c.unlockType!=="streak_effect"||x!=="all"&&c.category!==x||v!=="all"&&c.tier!==v||w==="unlocked"&&!c.unlocked||w==="locked"&&c.unlocked?!1:s?`${c.title} ${c.summary} ${c.requirementText} ${c.reward}`.toLowerCase().includes(s):!0)},[x,O,G,w,m,v]),h=(g==null?void 0:g.equipment)??((q=M.data)==null?void 0:q.metrics.equipment)??null,ie=O.filter(s=>s.kind==="unlock"&&s.unlockType&&B[s.unlockType]);return I.isError?t.jsx(ve,{eyebrow:"Rewards",error:I.error,onRetry:()=>void I.refetch()}):t.jsxs("div",{className:"mx-auto grid w-full max-w-[1320px] gap-5",children:[t.jsx(Se,{title:"Trophy Hall",description:"Achievements are earned from real Forge behavior: tasks, runs, goals, wiki links, Psyche work, habits, Life Force, health, and collaboration.",badge:g?`${g.unlockedCount}/${g.totalCount} earned`:"Loading",actions:(V=M.data)!=null&&V.metrics?t.jsx(xe,{metrics:M.data.metrics.profile}):null}),t.jsxs("section",{className:"grid gap-3 lg:grid-cols-[minmax(0,1fr)_minmax(20rem,0.42fr)]",children:[t.jsxs("div",{className:ae,children:[t.jsx("div",{className:"flex flex-wrap gap-2",children:st.map(s=>t.jsxs(j,{type:"button",variant:m===s.id?"primary":"secondary",size:"sm",onClick:()=>p(s.id),children:[s.id==="trophies"?t.jsx(le,{className:"size-4"}):null,s.id==="armory"?t.jsx(ce,{className:"size-4"}):null,s.id==="streak"?t.jsx(J,{className:"size-4"}):null,s.id==="unlocks"?t.jsx(Z,{className:"size-4"}):null,s.label]},s.id))}),t.jsxs("div",{className:"mt-4 flex min-w-0 flex-wrap items-center gap-2",children:[["all","unlocked","locked"].map(s=>t.jsxs(j,{type:"button",variant:w===s?"primary":"secondary",size:"sm",onClick:()=>L(s),children:[s==="locked"?t.jsx(ee,{className:"size-4"}):null,s]},s)),t.jsxs("label",{className:`ml-auto flex min-h-10 min-w-0 max-w-full items-center gap-2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 text-sm ${b} sm:min-w-[16rem]`,children:[t.jsx(de,{className:`size-4 shrink-0 ${_}`}),t.jsx("input",{value:G,onChange:s=>oe(s.target.value),placeholder:"Search rewards",className:"min-w-0 flex-1 bg-transparent text-[var(--ui-ink-strong)] outline-none placeholder:text-[var(--ui-ink-faint)]"})]})]}),t.jsxs("div",{className:"mt-4 flex min-w-0 flex-wrap gap-2",children:[t.jsx(j,{type:"button",variant:x==="all"?"primary":"secondary",size:"sm",onClick:()=>R("all"),children:"all categories"}),te.map(s=>t.jsx(j,{type:"button",variant:x===s.id?"primary":"secondary",size:"sm",onClick:()=>R(s.id),children:s.label},s.id))]}),t.jsx("div",{className:"mt-4 flex min-w-0 flex-wrap gap-2",children:rt.map(s=>t.jsx(j,{type:"button",variant:v===s?"primary":"secondary",size:"sm",onClick:()=>F(s),children:s},s))})]}),t.jsxs("div",{className:ae,children:[t.jsxs("div",{className:`flex items-center gap-2 text-sm font-semibold ${C}`,children:[t.jsx(Z,{className:"size-4 text-[var(--tertiary)]"}),"Near completion"]}),((g==null?void 0:g.nextTargets)??[]).map(s=>t.jsxs("button",{type:"button",onClick:()=>E(s),className:"grid min-w-0 grid-cols-[2.75rem_minmax(0,1fr)_3rem] items-center gap-3 rounded-2xl border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-2 text-left transition hover:bg-[var(--ui-surface-hover)]",children:[t.jsx("img",{src:A(s.assetKey,256,l),alt:"",onError:T,className:"size-11 object-contain"}),t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:`block truncate text-sm ${C}`,children:s.title}),t.jsx("span",{className:`block truncate text-[11px] ${_}`,children:s.requirementText})]}),t.jsxs("span",{className:`text-right text-xs ${b}`,children:[s.progressPercent,"%"]})]},s.id))]})]}),m==="armory"?t.jsxs("section",{className:"grid gap-3 lg:grid-cols-[minmax(18rem,0.42fr)_minmax(0,1fr)]",children:[t.jsxs("div",{className:"relative min-h-[24rem] overflow-hidden rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-4 shadow-[var(--ui-shadow-soft)]",children:[t.jsx("img",{src:A(((Q=M.data)==null?void 0:Q.metrics.mascot.spriteKey)??"mascot-state-014",512,l),alt:"Forge Smith mascot",onError:T,className:"absolute inset-x-0 bottom-0 mx-auto h-[23rem] object-contain"}),t.jsxs("div",{className:"relative z-10",children:[t.jsx(N,{className:"bg-[var(--ui-accent-soft)] text-[var(--tertiary)]",children:"Equipped"}),t.jsxs("div",{className:`mt-3 grid gap-1 text-sm ${b}`,children:[t.jsxs("span",{children:["Skin: ",(h==null?void 0:h.selectedMascotSkin)??"default"]}),t.jsxs("span",{children:["HUD: ",(h==null?void 0:h.selectedHudTreatment)??"default"]}),t.jsxs("span",{children:["Flame: ",(h==null?void 0:h.selectedStreakEffect)??"default"]}),t.jsxs("span",{children:["Shelf: ",(h==null?void 0:h.selectedTrophyShelf)??"default"]})]})]})]}),t.jsx("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3",children:ie.map(s=>{const c=s.unlockType?B[s.unlockType]:null,f=ot(s),K=!!(c&&f&&(h==null?void 0:h[c.field])===f);return t.jsxs(D,{className:P("p-4",!s.unlocked&&"opacity-70"),children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsx(N,{className:W,children:(c==null?void 0:c.label)??"Cosmetic"}),K?t.jsx(ue,{className:"size-4 text-[var(--success)]"}):null]}),t.jsx("img",{src:A(s.assetKey,256,l),alt:"",onError:T,className:P("mx-auto mt-3 size-28 object-contain",!s.unlocked&&"grayscale")}),t.jsx("div",{className:`mt-3 font-display text-lg ${C}`,children:s.title}),t.jsx("p",{className:`mt-2 line-clamp-2 text-sm leading-6 ${b}`,children:s.unlocked?s.summary:s.requirementText}),t.jsx(j,{type:"button",variant:K?"secondary":"primary",size:"sm",disabled:!s.unlocked||!c||!f||Y.isPending,className:"mt-4 w-full",onClick:()=>{!c||!f||Y.mutate({[c.field]:K?null:f})},children:K?"Unequip":s.unlocked?"Equip":"Locked"})]},s.id)})})]}):m==="streak"?t.jsxs("section",{className:"grid gap-4",children:[t.jsxs(D,{className:"p-4",children:[t.jsxs("div",{className:`flex items-center gap-2 font-display text-xl ${C}`,children:[t.jsx(J,{className:"size-5 text-[var(--tertiary)]"}),"Streak power states"]}),t.jsx("div",{className:"mt-4 grid gap-3 sm:grid-cols-2 md:grid-cols-4 xl:grid-cols-5",children:Qe.map(([s,c])=>t.jsxs("div",{className:H,children:[t.jsx("img",{src:A(c,256,l),alt:"",onError:T,className:"mx-auto size-28 object-contain"}),t.jsxs("div",{className:`mt-2 text-center text-sm ${b}`,children:[s," day power"]})]},c))})]}),t.jsxs(D,{className:"p-4",children:[t.jsxs("div",{className:`flex items-center gap-2 font-display text-xl ${C}`,children:[t.jsx(ee,{className:`size-5 ${_}`}),"Absence pressure states"]}),t.jsx("div",{className:"mt-4 grid gap-3 sm:grid-cols-2 md:grid-cols-4 xl:grid-cols-5",children:Je.map(([s,c])=>t.jsxs("div",{className:H,children:[t.jsx("img",{src:A(c,256,l),alt:"",onError:T,className:"mx-auto size-28 object-contain"}),t.jsxs("div",{className:`mt-2 text-center text-sm ${b}`,children:[s," days away"]})]},c))})]})]}):t.jsx("section",{className:"grid gap-5",children:te.map(s=>{const c=ne.filter(f=>f.category===s.id);return c.length===0?null:t.jsxs("section",{className:"grid gap-3",children:[t.jsx("div",{className:"flex items-end justify-between gap-3",children:t.jsxs("div",{children:[t.jsx("div",{className:`font-display text-xl ${C}`,children:s.label}),t.jsxs("div",{className:`text-sm ${_}`,children:[c.length," visible rewards"]})]})}),t.jsx("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:c.map(f=>t.jsx(nt,{item:f,gamificationTheme:l,onSelect:E},f.id))})]},s.id)})}),k?t.jsx("div",{className:"fixed inset-0 z-50 grid place-items-center bg-[var(--ui-overlay)] p-4 backdrop-blur-sm",onClick:()=>E(null),children:t.jsxs("div",{className:"max-h-[calc(100vh-2rem)] w-full max-w-[34rem] overflow-y-auto rounded-[26px] border border-[var(--ui-border-subtle)] bg-[var(--card-gradient)] p-5 shadow-[var(--card-shadow)]",onClick:s=>s.stopPropagation(),children:[t.jsxs("div",{className:"flex min-w-0 flex-col gap-4 sm:flex-row sm:items-start",children:[t.jsx("img",{src:A(k.assetKey,512,l),alt:"",onError:T,className:"size-32 shrink-0 object-contain"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.jsx(N,{className:P("border",se(k.tier)),children:k.tier}),t.jsx(N,{className:W,children:k.kind})]}),t.jsx("div",{className:`mt-3 font-display text-2xl ${C}`,children:k.title}),t.jsx("p",{className:`mt-2 text-sm leading-6 ${b}`,children:k.summary})]})]}),t.jsxs("div",{className:`mt-5 ${H}`,children:[t.jsx("div",{className:`text-sm font-semibold ${C}`,children:"Requirement"}),t.jsx("p",{className:`mt-2 text-sm leading-6 ${b}`,children:k.requirementText}),t.jsxs("div",{className:"mt-4",children:[t.jsx(re,{value:k.progressPercent}),t.jsxs("div",{className:`mt-2 flex justify-between gap-3 text-[11px] uppercase tracking-[0.16em] ${_}`,children:[t.jsxs("span",{children:[k.progressCurrent,"/",k.progressTarget]}),t.jsx("span",{children:k.unlocked?"earned":"locked"})]})]})]}),t.jsx("div",{className:"mt-4 flex justify-end",children:t.jsx(j,{type:"button",variant:"secondary",onClick:()=>E(null),children:"Close"})})]})}):null]})}export{gt as RewardsPage};
@@ -1 +0,0 @@
1
- import{r as u,j as e,b3 as q,c$ as E,c7 as R}from"./vendor-Dnkkx2co.js";import{j as Q,i as B,k as h}from"./state-vCcAT5Hq.js";import{S as K}from"./settings-section-nav-Co0AaDG-.js";import{dT as P,dU as A,S as H,E as $,C as x,I as V,Z as W,B as y,b as G,du as Y,dV as O}from"./index-QJkjKYzZ.js";import{P as U}from"./page-hero-CONuJu5J.js";import"./motion-Lt5B1XuE.js";import"./ui-C1iwpj2-.js";import"./forms-hB0SqEh-.js";import"./board-dIX6etHh.js";import"./graph-DDUZNRsO.js";const a={goal:"Goals",project:"Projects",task:"Tasks",strategy:"Strategies",habit:"Habits",tag:"Tags",note:"Notes",insight:"Insights",psyche_value:"Values",behavior_pattern:"Patterns",behavior:"Behaviors",belief_entry:"Beliefs",mode_profile:"Modes",mode_guide_session:"Mode guides",flashcard:"Flashcards",event_type:"Event types",emotion_definition:"Emotions",trigger_report:"Reports",calendar_event:"Calendar events",work_block_template:"Work blocks",task_timebox:"Timeboxes",preference_catalog:"Preference catalogs",preference_catalog_item:"Preference catalog items",preference_context:"Preference contexts",preference_item:"Preference items",questionnaire_instrument:"Questionnaires",sleep_session:"Sleep sessions",workout_session:"Workout sessions"},Z={goal:"goal",project:"project",task:"task",strategy:"strategy",habit:"habit",tag:null,note:null,insight:"report",psyche_value:"value",behavior_pattern:"pattern",behavior:"behavior",belief_entry:"belief",mode_profile:"mode",mode_guide_session:"mode",flashcard:"flashcard",event_type:null,emotion_definition:null,trigger_report:"report",calendar_event:null,work_block_template:null,task_timebox:null,preference_catalog:null,preference_catalog_item:null,preference_context:null,preference_item:null,questionnaire_instrument:null,sleep_session:null,workout_session:null},v="font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",J="text-[var(--ui-ink-strong)]",j="text-[var(--ui-ink-soft)]",m="text-[var(--ui-ink-faint)]",X="border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)] hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]",ee="border-[color-mix(in_srgb,var(--primary)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-accent-soft)] text-[var(--primary)]",te="grid min-w-0 gap-3 rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-4 lg:grid-cols-[minmax(0,1fr)_auto]";function se(f){return new Date(f).toLocaleString()}function pe(){var C,T;const f=Q(),[b,D]=u.useState(""),[l,L]=u.useState([]),c=B({queryKey:["forge-operator-session"],queryFn:Y}),M=c.isSuccess,o=B({queryKey:["forge-settings-bin"],queryFn:O,enabled:M}),p=async()=>{await f.invalidateQueries({predicate:t=>Array.isArray(t.queryKey)&&typeof t.queryKey[0]=="string"&&t.queryKey[0].startsWith("forge-")})},_=h({mutationFn:t=>P({operations:[{entityType:t.entityType,id:t.entityId}]}),onSuccess:p}),w=h({mutationFn:t=>A({operations:[{entityType:t.entityType,id:t.entityId,mode:"hard"}]}),onSuccess:p}),k=h({mutationFn:t=>P({operations:t.map(s=>({entityType:s.entityType,id:s.entityId}))}),onSuccess:p}),N=h({mutationFn:t=>A({operations:t.map(s=>({entityType:s.entityType,id:s.entityId,mode:"hard"}))}),onSuccess:p}),d=((C=o.data)==null?void 0:C.bin.records)??[],g=b.trim().toLowerCase(),r=u.useMemo(()=>d.filter(t=>l.length===0||l.includes(t.entityType)?g?[t.title,t.subtitle??"",t.entityType,t.entityId,t.deletedByActor??"",t.deletedSource??"",t.deleteReason??""].join(" ").toLowerCase().includes(g):!0:!1),[g,d,l]),S=u.useMemo(()=>{const t=new Map;for(const s of r){const i=t.get(s.entityType)??[];i.push(s),t.set(s.entityType,i)}return[...t.entries()].sort((s,i)=>a[s[0]].localeCompare(a[i[0]]))},[r]),I=u.useMemo(()=>[...new Set(d.map(t=>t.entityType))].sort((t,s)=>a[t].localeCompare(a[s])),[d]);function z(t){L(s=>s.includes(t)?s.filter(i=>i!==t):[...s,t])}async function F(){r.length===0||!window.confirm(`Permanently delete ${r.length} item${r.length===1?"":"s"} from the bin? This cannot be undone.`)||await N.mutateAsync(r)}return c.isLoading||o.isLoading?e.jsx(H,{eyebrow:"Settings",title:"Loading bin",description:"Loading deleted items and restore controls.",columns:2,blocks:6}):c.isError?e.jsx($,{eyebrow:"Settings",error:c.error,onRetry:()=>void c.refetch()}):o.isError?e.jsx($,{eyebrow:"Settings",error:o.error,onRetry:()=>void o.refetch()}):e.jsxs("div",{className:"mx-auto grid w-full max-w-[1220px] gap-5",children:[e.jsx(U,{title:"Bin",description:"Restore soft-deleted items or permanently remove them when you really mean it.",badge:`${((T=o.data)==null?void 0:T.bin.totalCount)??0} deleted items`}),e.jsx(K,{}),e.jsxs(x,{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-start",children:[e.jsxs("div",{className:"grid gap-4",children:[e.jsx("div",{className:v,children:"Find deleted items"}),e.jsxs("div",{className:"relative",children:[e.jsx(q,{className:`pointer-events-none absolute left-4 top-1/2 size-4 -translate-y-1/2 ${m}`}),e.jsx(V,{value:b,onChange:t=>D(t.target.value),placeholder:"Search title, id, reason, or source",className:"pl-11"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:I.map(t=>{const s=l.includes(t);return e.jsx("button",{type:"button",onClick:()=>z(t),className:W("rounded-full border px-3 py-1.5 text-[11px] font-semibold uppercase tracking-[0.14em] transition",s?ee:X),children:a[t]},t)})})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 lg:max-w-[22rem] lg:justify-end",children:[e.jsxs(y,{variant:"secondary",size:"sm",disabled:r.length===0,pending:k.isPending,pendingLabel:"Restoring",onClick:()=>void k.mutateAsync(r),children:[e.jsx(E,{className:"size-4"}),e.jsx("span",{children:"Restore visible"})]}),e.jsxs(y,{variant:"secondary",size:"sm",disabled:r.length===0,pending:N.isPending,pendingLabel:"Deleting",onClick:()=>void F(),children:[e.jsx(R,{className:"size-4"}),e.jsx("span",{children:"Delete visible forever"})]})]})]}),e.jsxs("div",{className:`flex flex-wrap gap-3 text-sm ${m}`,children:[e.jsxs("span",{children:[r.length," visible"]}),l.length>0?e.jsxs("span",{children:[l.length," type filters active"]}):null,g?e.jsxs("span",{children:["Search: “",b.trim(),"”"]}):null]})]}),d.length===0?e.jsxs(x,{children:[e.jsx("div",{className:v,children:"Deleted items"}),e.jsx("div",{className:`mt-4 ${j}`,children:"Nothing is in the bin right now."})]}):S.length===0?e.jsxs(x,{children:[e.jsx("div",{className:v,children:"Deleted items"}),e.jsx("div",{className:`mt-4 ${j}`,children:"No deleted items match the current search or filters."})]}):e.jsx("div",{className:"grid gap-5",children:S.map(([t,s])=>{const i=Z[t];return e.jsxs(x,{children:[e.jsx("div",{className:"flex flex-wrap items-center justify-between gap-3",children:e.jsxs("div",{className:"flex items-center gap-3",children:[i?e.jsx(G,{kind:i,label:a[t],compact:!0}):null,i?null:e.jsx("div",{className:`rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 py-1 text-[11px] uppercase tracking-[0.16em] ${m}`,children:a[t]}),e.jsxs("div",{className:`text-sm ${m}`,children:[s.length," deleted"]})]})}),e.jsx("div",{className:"mt-4 grid gap-3",children:s.map(n=>e.jsxs("div",{className:te,children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:`break-words text-lg font-medium [overflow-wrap:anywhere] ${J}`,children:n.title}),n.subtitle?e.jsx("div",{className:`mt-1 break-words text-sm [overflow-wrap:anywhere] ${j}`,children:n.subtitle}):null,e.jsxs("div",{className:`mt-3 flex flex-wrap gap-3 break-words text-xs [overflow-wrap:anywhere] ${m}`,children:[e.jsxs("span",{children:["Deleted ",se(n.deletedAt)]}),n.deletedByActor?e.jsxs("span",{children:["By ",n.deletedByActor]}):null,n.deletedSource?e.jsxs("span",{children:["Source ",n.deletedSource]}):null,n.deleteReason?e.jsxs("span",{children:["Reason: ",n.deleteReason]}):null]})]}),e.jsxs("div",{className:"flex flex-wrap items-start justify-end gap-2",children:[e.jsxs(y,{variant:"secondary",size:"sm",pending:_.isPending,pendingLabel:"Restoring",onClick:()=>void _.mutateAsync(n),children:[e.jsx(E,{className:"size-4"}),e.jsx("span",{children:"Restore"})]}),e.jsxs(y,{variant:"secondary",size:"sm",pending:w.isPending,pendingLabel:"Deleting",onClick:()=>void w.mutateAsync(n),children:[e.jsx(R,{className:"size-4"}),e.jsx("span",{children:"Delete forever"})]})]})]},`${n.entityType}:${n.entityId}`))})]},t)})})]})}export{pe as SettingsBinPage};
@@ -1 +0,0 @@
1
- import{r as o,j as e,da as V,db as Y,cr as xe,dc as Z,aQ as J,dd as me,aD as ge,cg as pe}from"./vendor-Dnkkx2co.js";import{j as he,i as X,k}from"./state-vCcAT5Hq.js";import{dy as ve,dz as be,dA as fe,dB as je,dC as ke,dD as ye,j as we,F as Ne,I as ee,c as u,S as Fe,E as ae,B as m,C as y,Z as T,Q as te,f as Se,du as Re,dE as De}from"./index-QJkjKYzZ.js";import{S as Ce}from"./settings-section-nav-Co0AaDG-.js";import{P as Be}from"./page-hero-CONuJu5J.js";import{M as g}from"./metric-tile-B-tDTcBt.js";import"./motion-Lt5B1XuE.js";import"./ui-C1iwpj2-.js";import"./forms-hB0SqEh-.js";import"./board-dIX6etHh.js";import"./graph-DDUZNRsO.js";function A(t){if(!Number.isFinite(t)||t<=0)return"0 B";const l=["B","KB","MB","GB","TB"];let i=t,x=0;for(;i>=1024&&x<l.length-1;)i/=1024,x+=1;return`${i.toFixed(i>=100?0:i>=10?1:2)} ${l[x]}`}function _e(t,l){const i=URL.createObjectURL(t),x=document.createElement("a");x.href=i,x.download=l,x.click(),URL.revokeObjectURL(i)}function Me(t){return t?t===1?"Every hour":t===24?"Every day":t===168?"Every week":`Every ${t} hours`:"Off"}function se(t){switch(t){case"manual":return"Manual";case"automatic":return"Automatic";case"pre_restore":return"Safety backup before restore";case"pre_switch_root":return"Safety backup before folder change";default:return t}}function w(t,l="Unknown time"){if(!t)return l;const i=new Date(t);return Number.isNaN(i.getTime())?l:Se(t)}function Ae({tone:t,message:l}){return e.jsx("div",{className:T("rounded-[20px] border px-4 py-3 text-sm leading-6",t==="success"?"border-[color-mix(in_srgb,var(--success)_26%,var(--ui-border-subtle)_74%)] bg-[var(--ui-success-soft)] text-[var(--success)]":t==="warning"?"border-[color-mix(in_srgb,var(--warning)_26%,var(--ui-border-subtle)_74%)] bg-[var(--ui-warning-soft)] text-[var(--warning)]":"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-soft)]"),children:l})}function z({label:t,value:l,icon:i}){return e.jsxs("div",{className:"min-w-0 overflow-hidden rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:[e.jsx(i,{className:"size-4"}),e.jsx("span",{className:"min-w-0 break-words",children:t})]}),e.jsx("div",{className:"mt-3 min-w-0 break-all text-sm leading-6 text-[var(--ui-ink-soft)] [overflow-wrap:anywhere]",children:l})]})}function Ie(){var G,W;const t=he(),[l,i]=o.useState(""),[x,$]=o.useState(""),[E,q]=o.useState(""),[O,U]=o.useState(!0),[b,re]=o.useState([]),[L,f]=o.useState(null),[ne,N]=o.useState(!1),[c,F]=o.useState({mode:"migrate_current",targetDataRoot:"",createSafetyBackup:!0}),[ie,j]=o.useState(null),[n,P]=o.useState(null),[K,H]=o.useState({createSafetyBackup:!0}),[oe,R]=o.useState(null),h=X({queryKey:["forge-operator-session"],queryFn:Re}),le=h.isSuccess,S=X({queryKey:["forge-data-management"],queryFn:De,enabled:le}),D=async()=>{await Promise.all([t.invalidateQueries({queryKey:["forge-operator-session"]}),t.invalidateQueries({queryKey:["forge-data-management"]})])},I=k({mutationFn:()=>ve({backupDirectory:l,backupFrequencyHours:x==="off"?null:Number(x||"24"),backupRetentionDays:E==="forever"?null:Number(E||"30"),autoRepairEnabled:O}),onSuccess:async()=>{f({tone:"success",message:"Backup settings saved."}),await D()}}),C=k({mutationFn:()=>be("Manual backup from Settings → Data"),onSuccess:async()=>{f({tone:"success",message:"Backup created."}),await D()}}),B=k({mutationFn:fe,onSuccess:({candidates:a})=>{re(a),f({tone:a.some(d=>d.newerThanCurrent)?"warning":"neutral",message:a.length>0?`Found ${a.length} Forge ${a.length===1?"copy":"copies"} on disk.`:"No other Forge data copies were found in the scanned folders."})}}),_=k({mutationFn:a=>je({targetDataRoot:a.targetDataRoot,mode:a.mode,createSafetyBackup:a.createSafetyBackup}),onSuccess:async()=>{f({tone:"success",message:"Forge is now using the selected data folder."}),N(!1),await D()}}),M=k({mutationFn:({backupId:a,createSafetyBackup:d})=>ke(a,d),onSuccess:async()=>{f({tone:"success",message:"Backup restored. Forge is now running from that restored state."}),P(null),await D()}}),Q=k({mutationFn:async a=>{const d=await ye(a);return _e(d.blob,d.fileName??`forge-export.${a}`),a},onSuccess:a=>{f({tone:"neutral",message:`Started download for ${a}.`})}}),s=(G=S.data)==null?void 0:G.data;o.useEffect(()=>{s&&(i(a=>a||s.settings.backupDirectory),$(a=>a||(s.settings.backupFrequencyHours?String(s.settings.backupFrequencyHours):"off")),U(s.settings.autoRepairEnabled),q(a=>a||(s.settings.backupRetentionDays?String(s.settings.backupRetentionDays):"forever")),F(a=>({...a,targetDataRoot:a.targetDataRoot||s.current.dataRoot})))},[s]);const de=o.useMemo(()=>b.find(a=>a.newerThanCurrent),[b]),p=o.useMemo(()=>b.find(a=>a.dataRoot===c.targetDataRoot.trim()),[c.targetDataRoot,b]),ce=[{id:"mode",eyebrow:"Step 1",title:"What do you want Forge to do?",description:"Choose whether Forge should move the current data into a new folder or switch to a folder that already contains the right Forge data.",render:(a,d)=>e.jsxs("div",{className:"grid gap-4",children:[e.jsx(we,{value:a.mode,onChange:v=>d({mode:v}),options:[{value:"migrate_current",label:"Move the current data",description:"Copy the live database and local secrets key into a new folder, then switch Forge to it."},{value:"adopt_existing",label:"Use an existing data folder",description:"Keep the target folder as it is and point Forge at that existing database directly."}]}),e.jsxs("label",{className:"flex items-start gap-3 rounded-[20px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-3",children:[e.jsx("input",{type:"checkbox",className:"mt-1",checked:a.createSafetyBackup,onChange:v=>d({createSafetyBackup:v.target.checked})}),e.jsx("span",{className:"text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Create one safety backup first."})]})]})},{id:"folder",eyebrow:"Step 2",title:c.mode==="migrate_current"?"Choose the new data folder":"Choose the data folder to use",description:c.mode==="migrate_current"?"Pick an empty folder for the moved Forge data.":"Pick the folder that already contains the Forge data you trust.",render:(a,d)=>e.jsxs("div",{className:"grid gap-4",children:[e.jsx(Ne,{label:"Data folder",description:"Forge will place or read the database and backups from here.",children:e.jsx(ee,{value:a.targetDataRoot,onChange:v=>d({targetDataRoot:v.target.value}),placeholder:"/absolute/path/to/forge-data"})}),p?e.jsxs("div",{className:"rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4 text-sm leading-6 text-[var(--ui-ink-soft)]",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:"Found on this machine"}),e.jsx("div",{className:"mt-2 break-all",children:p.databasePath}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsx(u,{tone:"meta",children:p.sourceHint}),e.jsxs(u,{tone:"meta",children:[p.counts.notes," notes"]}),e.jsxs(u,{tone:"meta",children:[p.counts.tasks," tasks"]}),p.newerThanCurrent?e.jsx(u,{className:"bg-[var(--ui-warning-soft)] text-[var(--warning)]",children:"Newer than the current copy"}):null]})]}):e.jsx("div",{className:"rounded-[22px] border border-dashed border-[var(--ui-border-subtle)] px-4 py-4 text-sm leading-6 text-[var(--ui-ink-soft)]",children:c.mode==="migrate_current"?"Forge will copy the current data into this folder and then switch over.":"If this folder already holds a Forge database, Forge will start using it after you confirm."})]})}],ue=[{id:"review",eyebrow:"Step 1",title:"Review the backup you want to restore",description:"Restoring replaces the current database with the selected backup.",render:(a,d)=>e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4 text-sm leading-6 text-[var(--ui-ink-soft)]",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:n?w(n.createdAt):"Selected backup"}),e.jsx("div",{className:"mt-2",children:(n==null?void 0:n.note)||"Forge backup archive"}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsx(u,{tone:"meta",children:n?se(n.mode):"Backup"}),e.jsx(u,{tone:"meta",children:n?A(n.sizeBytes):"0 B"}),n!=null&&n.includesWiki?e.jsx(u,{tone:"meta",children:"Includes wiki"}):null]})]}),e.jsxs("label",{className:"flex items-start gap-3 rounded-[20px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-3",children:[e.jsx("input",{type:"checkbox",className:"mt-1",checked:a.createSafetyBackup,onChange:v=>d({createSafetyBackup:v.target.checked})}),e.jsx("span",{className:"text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Create one safety backup of the current state first."})]})]})},{id:"confirm",eyebrow:"Step 2",title:"Confirm the restore",description:"Use this only when you are confident this backup is the state you want back.",render:()=>e.jsx("div",{className:"rounded-[22px] border border-[color-mix(in_srgb,var(--warning)_26%,var(--ui-border-subtle)_74%)] bg-[var(--ui-warning-soft)] p-4 text-sm leading-6 text-[var(--warning)]",children:"Forge will replace the live database with this backup, then reopen the restored copy."})}];if(h.isLoading||S.isLoading)return e.jsx(Fe,{eyebrow:"Data",title:"Loading data controls",description:"Checking the live data folder, backup plan, and recovery tools.",columns:3,blocks:6});if(h.isError)return e.jsx(ae,{eyebrow:"Data",error:h.error,onRetry:()=>void h.refetch()});if(S.isError||!s)return e.jsx(ae,{eyebrow:"Data",error:S.error??new Error("Forge returned an empty data payload."),onRetry:()=>void S.refetch()});const r=s.current;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mx-auto grid w-full max-w-[1480px] gap-5",children:[e.jsx(Be,{eyebrow:"Data, backups, recovery",title:"Data",description:"See where Forge is saving the live data, keep it protected with backups, look for a newer copy on disk if something goes wrong, and download the database or its structure when you need it.",badge:`${r.integrityOk?"Healthy":"Needs attention"} · ${A(r.databaseSizeBytes)}`,actions:e.jsxs(e.Fragment,{children:[e.jsxs(m,{variant:"secondary",pending:B.isPending,pendingLabel:"Scanning",onClick:()=>void B.mutateAsync(),children:[e.jsx(V,{className:"size-4"}),"Look for other Forge copies"]}),e.jsxs(m,{pending:C.isPending,pendingLabel:"Creating backup",onClick:()=>void C.mutateAsync(),children:[e.jsx(Y,{className:"size-4"}),"Create backup now"]})]})}),e.jsx(Ce,{}),(W=h.data)!=null&&W.session?e.jsxs("div",{className:"rounded-[20px] border border-[color-mix(in_srgb,var(--success)_26%,var(--ui-border-subtle)_74%)] bg-[var(--ui-success-soft)] px-4 py-3 text-sm text-[var(--ui-ink-medium)]",children:["You are managing Forge data as"," ",e.jsx("span",{className:"font-medium text-[var(--ui-ink-strong)]",children:h.data.session.actorLabel}),"."]}):null,L?e.jsx(Ae,{tone:L.tone,message:L.message}):null,e.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1.15fr)_minmax(0,0.85fr)]",children:[e.jsxs(y,{className:"grid gap-5",children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Live data folder"}),e.jsx("div",{className:"mt-2 min-w-0 break-all text-xl font-semibold text-[var(--ui-ink-strong)] [overflow-wrap:anywhere]",children:r.dataRoot}),e.jsx("div",{className:"mt-2 max-w-3xl text-sm leading-6 text-[var(--ui-ink-soft)]",children:"This is the folder Forge is reading and writing right now."})]}),e.jsx(u,{className:T(r.integrityOk?"bg-[var(--ui-success-soft)] text-[var(--success)]":"bg-[var(--ui-warning-soft)] text-[var(--warning)]"),children:r.integrityMessage})]}),e.jsxs("div",{className:"grid min-w-0 gap-3 md:grid-cols-2 xl:grid-cols-3",children:[e.jsx(z,{label:"Database file",value:r.databasePath,icon:xe}),e.jsx(z,{label:"Folder layout",value:r.layout,icon:Z}),e.jsx(z,{label:"Last database change",value:r.databaseLastModifiedAt?w(r.databaseLastModifiedAt):"Unknown",icon:J})]}),e.jsxs("div",{className:"grid min-w-0 gap-3 md:grid-cols-3 xl:grid-cols-6",children:[e.jsx(g,{label:"Notes",value:r.counts.notes}),e.jsx(g,{label:"Goals",value:r.counts.goals}),e.jsx(g,{label:"Projects",value:r.counts.projects}),e.jsx(g,{label:"Tasks",value:r.counts.tasks}),e.jsx(g,{label:"Runs",value:r.counts.taskRuns}),e.jsx(g,{label:"Tags",value:r.counts.tags})]})]}),e.jsxs(y,{className:"grid gap-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex size-11 items-center justify-center rounded-2xl border border-[color-mix(in_srgb,var(--success)_26%,var(--ui-border-subtle)_74%)] bg-[var(--ui-success-soft)]",children:e.jsx(me,{className:"size-5 text-[var(--success)]"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-semibold text-[var(--ui-ink-strong)]",children:"Protection plan"}),e.jsx("div",{className:"mt-1 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Choose where backups go, how often Forge creates them, and whether scans should call out newer copies found elsewhere on disk."})]})]}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[e.jsx(g,{label:"Automatic backup",value:Me(s.settings.backupFrequencyHours),detail:s.settings.lastAutoBackupAt?`Last run ${w(s.settings.lastAutoBackupAt)}`:"No automatic backup recorded yet"}),e.jsx(g,{label:"Manual backup",value:s.settings.lastManualBackupAt?w(s.settings.lastManualBackupAt):"None yet",detail:`${s.backups.length} backup${s.backups.length===1?"":"s"} saved`}),e.jsx(g,{label:"Retention",value:s.settings.backupRetentionDays?`${s.settings.backupRetentionDays} days`:"Keep forever",detail:"Automatic backups only"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Backup folder"}),e.jsx(ee,{value:l,onChange:a=>i(a.target.value)})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Automatic backup"}),e.jsxs("select",{className:"h-11 rounded-[16px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 text-sm text-[var(--ui-ink-strong)] outline-none transition focus:border-[var(--primary)]",value:x||"24",onChange:a=>$(a.target.value),children:[e.jsx("option",{value:"off",children:"Off"}),e.jsx("option",{value:"1",children:"Every hour"}),e.jsx("option",{value:"6",children:"Every 6 hours"}),e.jsx("option",{value:"24",children:"Every day"}),e.jsx("option",{value:"168",children:"Every week"})]})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Keep automatic backups"}),e.jsxs("select",{className:"h-11 rounded-[16px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 text-sm text-[var(--ui-ink-strong)] outline-none transition focus:border-[var(--primary)]",value:E||"30",onChange:a=>q(a.target.value),children:[e.jsx("option",{value:"7",children:"7 days"}),e.jsx("option",{value:"14",children:"14 days"}),e.jsx("option",{value:"30",children:"30 days"}),e.jsx("option",{value:"90",children:"90 days"}),e.jsx("option",{value:"365",children:"1 year"}),e.jsx("option",{value:"forever",children:"Keep forever"})]})]}),e.jsxs("label",{className:"flex items-start gap-3 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-3",children:[e.jsx("input",{type:"checkbox",className:"mt-1",checked:O,onChange:a=>U(a.target.checked)}),e.jsx("span",{className:"text-sm leading-6 text-[var(--ui-ink-soft)]",children:"When I scan, point out Forge copies that look newer than the one I am using now."})]}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsx(m,{pending:I.isPending,pendingLabel:"Saving",onClick:()=>void I.mutateAsync(),children:"Save backup settings"}),e.jsx(m,{variant:"secondary",pending:C.isPending,pendingLabel:"Creating backup",onClick:()=>void C.mutateAsync(),children:"Create backup now"})]})]})]})]}),e.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,0.9fr)_minmax(0,1.1fr)]",children:[e.jsxs(y,{className:"grid gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Change data folder"}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Move today’s Forge data into a new folder, or switch to another folder that already contains the right Forge database."})]}),e.jsxs("div",{className:"rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4 text-sm leading-6 text-[var(--ui-ink-soft)]",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:"Current folder"}),e.jsx("div",{className:"mt-2 break-all",children:r.dataRoot}),p?e.jsxs("div",{className:"mt-3 text-sm text-[var(--ui-ink-soft)]",children:["Selected scanned copy: ",p.dataRoot]}):null]}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsxs(m,{onClick:()=>{F(a=>({...a,mode:"migrate_current",targetDataRoot:a.targetDataRoot||r.dataRoot})),j(null),N(!0)},children:[e.jsx(Z,{className:"size-4"}),"Move current data"]}),e.jsxs(m,{variant:"secondary",onClick:()=>{F(a=>({...a,mode:"adopt_existing",targetDataRoot:a.targetDataRoot||r.dataRoot})),j(null),N(!0)},children:[e.jsx(J,{className:"size-4"}),"Use existing data folder"]})]})]}),e.jsxs(y,{className:"grid gap-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Downloads"}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Download the live database itself, or export a structure and table snapshot in other formats."})]}),e.jsx(ge,{className:"size-5 text-[var(--ui-ink-faint)]"})]}),e.jsx("div",{className:"grid gap-3",children:s.exportOptions.map(a=>e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-[20px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-semibold text-[var(--ui-ink-strong)]",children:a.label}),e.jsx("div",{className:"mt-1 text-sm leading-6 text-[var(--ui-ink-soft)]",children:a.description})]}),e.jsx(m,{variant:"secondary",pending:Q.isPending,pendingLabel:"Preparing",onClick:()=>void Q.mutateAsync(a.format),children:"Download"})]},a.format))})]})]}),e.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1.05fr)_minmax(0,0.95fr)]",children:[e.jsxs(y,{className:"grid gap-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Backup history"}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Go back to an older saved state if you need to undo a bad change."})]}),e.jsx(Y,{className:"size-5 text-[var(--ui-ink-faint)]"})]}),e.jsx("div",{className:"grid gap-3",children:s.backups.length===0?e.jsx("div",{className:"rounded-[20px] border border-dashed border-[var(--ui-border-subtle)] px-4 py-6 text-sm text-[var(--ui-ink-soft)]",children:"No backups yet. Create one now so you have a safe restore point."}):s.backups.map(a=>e.jsxs("div",{className:"rounded-[20px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"text-sm font-semibold text-[var(--ui-ink-strong)]",children:w(a.createdAt)}),e.jsx(u,{tone:"meta",children:se(a.mode)})]}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:a.note||"Forge backup archive"})]}),e.jsx(m,{variant:"secondary",onClick:()=>{H({createSafetyBackup:!0}),R(null),P(a)},children:"Restore"})]}),e.jsxs("div",{className:"mt-3 grid gap-2 text-xs text-[var(--ui-ink-faint)] md:grid-cols-2",children:[e.jsx("div",{className:"break-all",children:a.archivePath}),e.jsx("div",{children:A(a.sizeBytes)})]})]},a.id))})]}),e.jsxs(y,{className:"grid gap-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Find other Forge copies"}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Search common folders on this machine for other Forge databases. Use this when Forge opened the wrong copy or when you think a newer copy exists somewhere else."})]}),e.jsxs(m,{variant:"secondary",pending:B.isPending,pendingLabel:"Scanning",onClick:()=>void B.mutateAsync(),children:[e.jsx(V,{className:"size-4"}),"Scan now"]})]}),e.jsx("div",{className:"grid gap-3",children:b.length===0?e.jsx("div",{className:"rounded-[20px] border border-dashed border-[var(--ui-border-subtle)] px-4 py-6 text-sm text-[var(--ui-ink-soft)]",children:"No scan results yet. Run a scan to compare the live data folder with other Forge copies on disk."}):b.map(a=>e.jsxs("div",{className:T("rounded-[22px] border p-4",a.sameAsCurrent?"border-[color-mix(in_srgb,var(--success)_24%,var(--ui-border-subtle)_76%)] bg-[var(--ui-success-soft)]":a.newerThanCurrent?"border-[color-mix(in_srgb,var(--warning)_26%,var(--ui-border-subtle)_74%)] bg-[var(--ui-warning-soft)]":"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)]"),children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"text-sm font-semibold text-[var(--ui-ink-strong)]",children:a.dataRoot}),e.jsx(u,{tone:"meta",children:a.sourceHint}),a.newerThanCurrent?e.jsx(u,{className:"bg-[var(--ui-warning-soft)] text-[var(--warning)]",children:"Newer than current"}):null,a.sameAsCurrent?e.jsx(u,{className:"bg-[var(--ui-success-soft)] text-[var(--success)]",children:"Current copy"}):null]}),e.jsx("div",{className:"mt-2 break-all text-sm text-[var(--ui-ink-soft)]",children:a.databasePath})]}),a.sameAsCurrent?null:e.jsx(m,{variant:"secondary",onClick:()=>{F({mode:"adopt_existing",targetDataRoot:a.dataRoot,createSafetyBackup:!0}),j(null),N(!0)},children:"Use this folder"})]}),e.jsxs("div",{className:"mt-4 grid gap-2 text-xs text-[var(--ui-ink-faint)] md:grid-cols-5",children:[e.jsx("div",{children:a.integrityMessage}),e.jsx("div",{children:w(a.databaseLastModifiedAt??new Date().toISOString())}),e.jsx("div",{children:A(a.databaseSizeBytes)}),e.jsxs("div",{children:[a.counts.notes," notes"]}),e.jsxs("div",{children:[a.counts.tasks," tasks"]})]})]},a.id))}),de?e.jsxs("div",{className:"flex items-start gap-3 rounded-[20px] border border-[color-mix(in_srgb,var(--warning)_26%,var(--ui-border-subtle)_74%)] bg-[var(--ui-warning-soft)] px-4 py-3 text-sm text-[var(--warning)]",children:[e.jsx(pe,{className:"mt-0.5 size-4 shrink-0"}),e.jsx("div",{children:"Forge found a copy on disk that looks newer than the one you are using now. Review it carefully before switching."})]}):null]})]})]}),e.jsx(te,{open:ne,onOpenChange:a=>{N(a),a||j(null)},eyebrow:"Data folder",title:c.mode==="migrate_current"?"Move Forge data":"Use an existing Forge data folder",description:"This guided flow keeps the folder change explicit and gives you a safety backup option first.",value:c,onChange:F,draftPersistenceKey:`settings.data.root.${c.mode}`,steps:ce,pending:_.isPending,pendingLabel:c.mode==="migrate_current"?"Moving data":"Switching folder",submitLabel:c.mode==="migrate_current"?"Move and switch":"Use this folder",error:ie??(_.error instanceof Error?_.error.message:null),onSubmit:async()=>{if(!c.targetDataRoot.trim()){j("Choose a data folder first.");return}j(null),await _.mutateAsync(c)}}),e.jsx(te,{open:n!==null,onOpenChange:a=>{a||(P(null),R(null))},eyebrow:"Restore backup",title:"Restore Forge backup",description:"This flow replaces the live data with an older saved state.",value:K,onChange:H,draftPersistenceKey:n?`settings.data.restore.${n.id}`:"settings.data.restore",steps:ue,pending:M.isPending,pendingLabel:"Restoring",submitLabel:"Restore this backup",error:oe??(M.error instanceof Error?M.error.message:null),onSubmit:async()=>{if(!n){R("Choose a backup first.");return}R(null),await M.mutateAsync({backupId:n.id,createSafetyBackup:K.createSafetyBackup})}})]})}export{Ie as SettingsDataPage};
@@ -1 +0,0 @@
1
- import{c2 as H,r as c,j as r,cs as V,aK as Q,b3 as G,F as J}from"./vendor-Dnkkx2co.js";import{x as W}from"./state-vCcAT5Hq.js";import{c as q,S as Z,E as X,C as F,B as A,I as Y,Z as z,en as ee,eo as te,b as se,ep as re}from"./index-QJkjKYzZ.js";import{P as ne}from"./page-hero-CONuJu5J.js";import{S as ie}from"./settings-section-nav-Co0AaDG-.js";import"./motion-Lt5B1XuE.js";import"./ui-C1iwpj2-.js";import"./forms-hB0SqEh-.js";import"./board-dIX6etHh.js";import"./graph-DDUZNRsO.js";const ae=["error","warning","info","debug"],oe=["server","ui","system","agent","openclaw"],le=60,P="text-[11px] font-medium uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",T="text-[var(--ui-ink-soft)]",h="text-[var(--ui-ink-faint)]",ce="text-[var(--ui-ink-strong)]",de="bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]",ue="relative rounded-[20px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 py-2.5",ge="inline-flex max-w-full items-center gap-1.5 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-1.5 py-1",me="z-[80] overflow-y-auto overscroll-contain rounded-[20px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-popover)] p-2 shadow-[var(--ui-shadow-floating)] backdrop-blur-xl [webkit-overflow-scrolling:touch]",fe="rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-3";function L(t){return t.trim().toLowerCase()}function C(t){return Array.from(new Set(t.map(n=>(n==null?void 0:n.trim())??"").filter(Boolean)))}function $(t,n){const s=C(t.getAll(n));if(s.length>0)return s;const a=t.get(n);return a!=null&&a.trim()?[a.trim()]:[]}function pe(t){return new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"medium"}).format(new Date(t))}function U(t){return t==="error"?"border-[color-mix(in_srgb,var(--danger)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-danger-soft)] text-[color-mix(in_srgb,var(--danger)_76%,var(--ui-ink-strong)_24%)]":t==="warning"?"border-[color-mix(in_srgb,var(--warning)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_78%,var(--ui-ink-strong)_22%)]":t==="info"?"border-[color-mix(in_srgb,var(--primary)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-accent-soft)] text-[var(--primary)]":"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]"}function B(t){return t==="error"?"Errors":t==="warning"?"Warnings":t==="info"?"Info":"Debug"}function R(t){return t==="openclaw"?"OpenClaw":t.charAt(0).toUpperCase()+t.slice(1)}function xe(t){return[t.scope?`scope: ${t.scope}`:null,t.eventKey?`event: ${t.eventKey}`:null,t.route?`route: ${t.route}`:null,t.functionName?`function: ${t.functionName}`:null,t.jobId?`job: ${t.jobId}`:null,t.entityType&&t.entityId?`entity: ${t.entityType}:${t.entityId}`:null,t.requestId?`request: ${t.requestId}`:null].filter(n=>!!n)}function he(t){return L([t.message,t.scope,t.eventKey,t.route,t.functionName,t.requestId,t.entityType,t.entityId,t.jobId,JSON.stringify(t.details)].filter(Boolean).join(" "))}function j(t,n){return r.jsx(q,{size:"sm",className:z(de,n),children:t})}function K(t,n){return te(t)?r.jsx(se,{kind:t,label:n,compact:!0,gradient:!1}):j(n,"bg-[var(--ui-accent-soft)] text-[var(--primary)]")}function k({label:t,placeholder:n,options:s,selectedIds:a,onChange:m,emptyMessage:u="No matches yet."}){const[w,d]=c.useState(!1),[b,v]=c.useState(""),[I,y]=c.useState(0),E=c.useRef(null),M=c.useRef(null),O=ee(E,w,{offset:8,preferredMaxHeight:320,minHeight:160}),_=c.useMemo(()=>a.map(i=>s.find(o=>o.id===i)??null).filter(i=>i!==null),[s,a]),p=L(b),x=c.useMemo(()=>{const i=s.filter(o=>!a.includes(o.id));return p?i.filter(o=>L(`${o.label} ${o.description??""} ${o.searchText??""}`).includes(p)).slice(0,10):i.slice(0,10)},[p,s,a]),N=i=>{a.includes(i)||(m([...a,i]),v(""),y(0),d(!1))},D=i=>{m(a.filter(o=>o!==i))};return c.useEffect(()=>{if(!w)return;const i=e=>{var g,f;const l=e.target;(g=E.current)!=null&&g.contains(l)||(f=M.current)!=null&&f.contains(l)||d(!1)},o=e=>{e.key==="Escape"&&d(!1)};return document.addEventListener("pointerdown",i),document.addEventListener("keydown",o),()=>{document.removeEventListener("pointerdown",i),document.removeEventListener("keydown",o)}},[w]),r.jsxs("label",{className:"grid gap-2",children:[r.jsx("span",{className:P,children:t}),r.jsxs("div",{ref:E,className:ue,children:[_.length>0?r.jsx("div",{className:"mb-2 flex flex-wrap gap-1.5",children:_.map(i=>r.jsxs("span",{className:ge,children:[i.badge,r.jsx("button",{type:"button",className:`rounded-full p-0.5 transition hover:text-[var(--ui-ink-strong)] ${h}`,onClick:()=>D(i.id),"aria-label":`Remove ${i.label}`,children:r.jsx(Q,{className:"size-3"})})]},i.id))}):null,r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(G,{className:`size-3.5 ${h}`}),r.jsx("input",{value:b,onChange:i=>{v(i.target.value),y(0),d(!0)},onFocus:()=>d(!0),onKeyDown:i=>{if(i.key==="Backspace"&&!b&&a.length>0){D(a[a.length-1]);return}if(i.key==="ArrowDown"){i.preventDefault(),d(!0),y(o=>x.length===0?0:Math.min(x.length-1,o+1));return}if(i.key==="ArrowUp"){i.preventDefault(),y(o=>Math.max(0,o-1));return}if(i.key==="Escape"){d(!1);return}i.key==="Enter"&&x[I]&&(i.preventDefault(),N(x[I].id))},placeholder:n,className:"min-w-0 flex-1 bg-transparent text-sm text-[var(--ui-ink-strong)] placeholder:text-[var(--ui-ink-faint)] focus:outline-none"})]}),w&&O&&typeof document<"u"?J.createPortal(r.jsx("div",{ref:M,role:"listbox","aria-multiselectable":"true",className:me,style:O,children:x.length>0?x.map((i,o)=>r.jsx("button",{type:"button",role:"option","aria-selected":!1,className:z("flex w-full items-start justify-between gap-3 rounded-[16px] px-3 py-2 text-left transition",o===I?"bg-[var(--ui-accent-soft)] text-[var(--ui-ink-strong)]":"text-[var(--ui-ink-soft)] hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]"),onMouseEnter:()=>y(o),onMouseDown:e=>e.preventDefault(),onClick:()=>N(i.id),children:r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"truncate text-sm font-medium",children:i.menuBadge??i.badge}),i.description?r.jsx("div",{className:`mt-1 text-xs leading-5 ${h}`,children:i.description}):null]})},i.id)):r.jsx("div",{className:`px-3 py-2 text-sm ${h}`,children:u})}),document.body):null]})]})}function be(t,n){const s=`${n.entityType}:${n.entityId}`;t.has(s)||t.set(s,{id:s,label:n.label,description:n.description,searchText:n.searchText,badge:n.badge,menuBadge:n.menuBadge})}function ve(t){const n=new Map;for(const s of t){if(!s.entityType||!s.entityId)continue;const a=`${s.entityType}:${s.entityId}`;if(n.has(a))continue;const m=s.entityType==="wiki_ingest_job"?`Ingest ${s.entityId}`:`${s.entityType} ${s.entityId}`;be(n,{entityType:s.entityType,entityId:s.entityId,label:m,description:"Seen in diagnostics logs",searchText:L(`${m} ${s.scope} ${s.message} ${s.eventKey}`),badge:K(s.entityType,m),menuBadge:K(s.entityType,m)})}return Array.from(n.values()).sort((s,a)=>s.label.localeCompare(a.label))}const ye=c.memo(function({entry:n}){const[s,a]=c.useState(!1),m=c.useMemo(()=>s&&Object.keys(n.details).length>0?JSON.stringify(n.details,null,2):"",[s,n.details]);return r.jsxs(F,{className:"grid gap-4",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[r.jsxs("div",{className:"grid min-w-0 gap-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[r.jsx("span",{className:z("rounded-full border px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.16em]",U(n.level)),children:n.level}),r.jsx("span",{className:`rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-3)] px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.16em] ${T}`,children:n.source}),r.jsx("span",{className:`rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-3)] px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.16em] ${T}`,children:n.scope}),n.eventKey?r.jsx("span",{className:`max-w-full break-words rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-3)] px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.16em] [overflow-wrap:anywhere] ${h}`,children:n.eventKey}):null]}),r.jsx("div",{className:`break-words text-base font-medium [overflow-wrap:anywhere] ${ce}`,children:n.message}),r.jsx("div",{className:`flex flex-wrap gap-3 break-words text-xs [overflow-wrap:anywhere] ${h}`,children:xe(n).map(u=>r.jsx("span",{children:u},u))})]}),r.jsxs("div",{className:`shrink-0 text-right text-xs ${h}`,children:[r.jsx("div",{children:pe(n.createdAt)}),r.jsx("div",{className:"mt-1 font-mono text-[11px]",children:n.id})]})]}),Object.keys(n.details).length>0?r.jsxs("details",{className:fe,onToggle:u=>a(u.currentTarget.open),children:[r.jsx("summary",{className:`cursor-pointer text-sm ${T}`,children:"View structured details"}),s?r.jsx("pre",{className:`mt-3 overflow-x-auto whitespace-pre-wrap text-xs leading-6 ${T}`,children:m}):null]}):null]})});function Le(){const[t,n]=H(),s=c.useMemo(()=>{var f,S;const e=((f=t.get("entityType"))==null?void 0:f.trim())||"",l=((S=t.get("entityId"))==null?void 0:S.trim())||"",g=$(t,"entity");return g.length===0&&e&&l&&g.push(`${e}:${l}`),{search:t.get("search")||"",levels:$(t,"level"),sources:$(t,"source"),scopes:$(t,"scope"),routes:$(t,"route"),jobs:$(t,"jobId"),entities:C(g)}},[t]),a=W({queryKey:["forge-diagnostic-logs","settings-filters"],initialPageParam:null,queryFn:({pageParam:e})=>re({limit:le,beforeCreatedAt:e==null?void 0:e.beforeCreatedAt,beforeId:e==null?void 0:e.beforeId}),getNextPageParam:e=>e.nextCursor,retry:!1,refetchOnWindowFocus:!1}),m=(e,l)=>{const g=new URLSearchParams(t);l.trim()?g.set(e,l.trim()):g.delete(e),n(g,{replace:!0})},u=(e,l,g=[])=>{const f=new URLSearchParams(t);f.delete(e);for(const S of g)f.delete(S);for(const S of C(l))f.append(e,S);n(f,{replace:!0})},w=()=>{const e=new URLSearchParams(t);["search","level","source","scope","route","jobId","entity","entityType","entityId"].forEach(l=>e.delete(l)),n(e,{replace:!0})},d=c.useMemo(()=>{var e;return((e=a.data)==null?void 0:e.pages.flatMap(l=>l.logs))??[]},[a.data]),b=L(s.search),v=c.useRef(null),I=c.useMemo(()=>ae.map(e=>({id:e,label:B(e),searchText:`${e} ${B(e)}`,badge:r.jsx(q,{size:"sm",className:U(e),children:B(e)})})),[]),y=c.useMemo(()=>oe.map(e=>({id:e,label:R(e),searchText:`${e} ${R(e)}`,badge:j(R(e))})),[]),E=c.useMemo(()=>C(d.map(e=>e.scope)).map(e=>({id:e,label:e,searchText:e,badge:j(e)})),[d]),M=c.useMemo(()=>C(d.map(e=>e.route)).map(e=>({id:e,label:e,description:"Filter logs to one or more exact routes.",searchText:e,badge:j(e,"max-w-[16rem]"),menuBadge:j(e)})),[d]),O=c.useMemo(()=>C(d.map(e=>e.jobId)).map(e=>({id:e,label:e,description:"Background job or ingest run id.",searchText:e,badge:j(e,"max-w-[14rem]"),menuBadge:j(e)})),[d]),_=c.useMemo(()=>ve(d),[d]),p=c.useMemo(()=>d.filter(e=>{if(b&&!he(e).includes(b)||s.levels.length>0&&!s.levels.includes(e.level)||s.sources.length>0&&!s.sources.includes(e.source)||s.scopes.length>0&&!s.scopes.includes(e.scope)||s.routes.length>0&&!s.routes.includes(e.route??"")||s.jobs.length>0&&!s.jobs.includes(e.jobId??""))return!1;if(s.entities.length>0){const l=e.entityType&&e.entityId?`${e.entityType}:${e.entityId}`:"";if(!l||!s.entities.includes(l))return!1}return!0}),[s,b,d]),x=[s.search,s.levels.join("|"),s.sources.join("|"),s.scopes.join("|"),s.routes.join("|"),s.jobs.join("|"),s.entities.join("|")].join("::");c.useEffect(()=>{var e;(e=v.current)==null||e.scrollTo({top:0})},[x]);const N=V({count:p.length,getScrollElement:()=>v.current,estimateSize:()=>260,overscan:8}),D=N.getVirtualItems(),i=()=>{const e=v.current;if(!e||!a.hasNextPage||a.isFetchingNextPage)return;e.scrollHeight-e.scrollTop-e.clientHeight<=800&&a.fetchNextPage()},o=s.levels.length+s.sources.length+s.scopes.length+s.routes.length+s.jobs.length+s.entities.length+(s.search.trim()?1:0);return a.isPending?r.jsx(Z,{eyebrow:"Settings",title:"Loading diagnostics",description:"Collecting the latest frontend, backend, and runtime traces.",columns:1,blocks:6}):a.isError?r.jsx(X,{eyebrow:"Settings",error:a.error,onRetry:()=>void a.refetch()}):r.jsxs("div",{className:"mx-auto grid w-full max-w-[1220px] gap-5",children:[r.jsx(ne,{title:"Logs",description:"Inspect shared diagnostics from the UI, backend routes, background jobs, and LLM flows.",badge:`${p.length} matching${p.length!==d.length?` · ${d.length} loaded`:""}${a.hasNextPage?" · more available":""}`}),r.jsx(ie,{}),r.jsxs(F,{className:"grid gap-4",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("div",{className:P,children:"Filters"}),r.jsx("div",{className:`mt-2 max-w-3xl text-sm leading-6 ${T}`,children:"Use token filters with OR-style badge selections for levels, sources, routes, jobs, scopes, and linked entities. Search still matches the message body and structured details."})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o>0?r.jsxs(A,{variant:"ghost",size:"sm",onClick:w,children:["Clear ",o]}):null,r.jsx(A,{variant:"secondary",size:"sm",onClick:()=>void a.refetch(),pending:a.isRefetching&&!a.isFetchingNextPage,pendingLabel:"Refreshing",children:"Refresh"})]})]}),r.jsxs("label",{className:"grid gap-2",children:[r.jsx("span",{className:P,children:"Search message or details"}),r.jsx(Y,{value:s.search,onChange:e=>m("search",e.target.value),placeholder:"LLM compilation failed, wiki_ingest, request_failed…",className:"h-11 rounded-[20px]"})]}),r.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[r.jsx(k,{label:"Levels",placeholder:"Add one or more levels",options:I,selectedIds:s.levels,onChange:e=>u("level",e),emptyMessage:"No additional log levels."}),r.jsx(k,{label:"Sources",placeholder:"Add one or more sources",options:y,selectedIds:s.sources,onChange:e=>u("source",e),emptyMessage:"No additional log sources."}),r.jsx(k,{label:"Scopes",placeholder:"Search scopes",options:E,selectedIds:s.scopes,onChange:e=>u("scope",e),emptyMessage:"No scopes match the current logs."}),r.jsx(k,{label:"Routes",placeholder:"Search exact routes",options:M,selectedIds:s.routes,onChange:e=>u("route",e),emptyMessage:"No routes match the current logs."}),r.jsx(k,{label:"Jobs",placeholder:"Search job ids",options:O,selectedIds:s.jobs,onChange:e=>u("jobId",e),emptyMessage:"No job ids match the current logs."}),r.jsx(k,{label:"Entities",placeholder:"Search Forge entities or logged ids",options:_,selectedIds:s.entities,onChange:e=>u("entity",e,["entityType","entityId"]),emptyMessage:"No logged entities match yet."})]})]}),r.jsx("div",{className:"grid gap-3",children:p.length===0?r.jsx(F,{className:`text-sm ${T}`,children:"No diagnostic entries match the current filters yet."}):r.jsx(F,{className:"p-0",children:r.jsxs("div",{ref:v,onScroll:i,className:"h-[72vh] overflow-y-auto px-3 py-3",children:[r.jsx("div",{className:"relative",style:{height:`${N.getTotalSize()}px`},children:D.map(e=>{const l=p[e.index];return l?r.jsx("div",{"data-index":e.index,ref:N.measureElement,className:"absolute left-0 top-0 w-full pb-3",style:{transform:`translateY(${e.start}px)`},children:r.jsx(ye,{entry:l})},l.id):null})}),r.jsx("div",{className:`border-t border-[var(--ui-border-subtle)] px-1 py-3 text-center text-xs ${h}`,children:a.isFetchingNextPage?"Loading older logs...":a.hasNextPage?"Scroll to load older logs.":`Showing all ${d.length} loaded logs.`})]})})})]})}export{Le as SettingsLogsPage};
@@ -1 +0,0 @@
1
- import{r as u,dh as ae,j as e,di as ie,dj as ne,cw as _,cx as D,dg as te,dk as G,dl as re,bl as K,bK as B,dm as le,dn as W,aC as E,cb as L,dp as oe}from"./vendor-Dnkkx2co.js";import{j as de,i as ce,k as P}from"./state-vCcAT5Hq.js";import{u as me,s as xe,eb as pe,ec as he,ed as ue,ee as ve,S as ge,E as fe,C as Q,B as m,c as t,dw as je}from"./index-QJkjKYzZ.js";import{S as we}from"./settings-section-nav-Co0AaDG-.js";import{P as be}from"./page-hero-CONuJu5J.js";import"./motion-Lt5B1XuE.js";import"./ui-C1iwpj2-.js";import"./forms-hB0SqEh-.js";import"./board-dIX6etHh.js";import"./graph-DDUZNRsO.js";function Ne(a){return a.replaceAll("."," ")}function ye(a){const d=typeof a.sleepNights=="number"?a.sleepNights:typeof a.sleepSessions=="number"?a.sleepSessions:0,g=typeof a.sleepSegments=="number"?a.sleepSegments:0,S=typeof a.sleepRawRecords=="number"?a.sleepRawRecords:0,b=typeof a.sleepSessions=="number"?a.sleepSessions:0,N=typeof a.workouts=="number"?a.workouts:0,x=a.vitals&&typeof a.vitals=="object"&&!Array.isArray(a.vitals)&&typeof a.vitals.metricEntries=="number"?a.vitals.metricEntries:0;return`${d||b} nights · ${g} segments · ${S} raw records · ${N} workouts · ${x} vitals`}function J(a){return a?"signal":"meta"}function ke(a){return a.replaceAll("_"," ")}function Pe(a){return a?new Date(a).toLocaleString():"Waiting for device update"}function Se(a,d){return a?d?"signal":"default":"meta"}function $e(a){return a.transportMode==="iroh"?"Iroh":"Manual HTTP"}function Ce(a){return a.transportMode==="iroh"?"signal":"meta"}const j="font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",i="text-[var(--ui-ink-soft)]",v="text-[var(--ui-ink-faint)]",l="rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)]",w="rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)]",V="rounded-[24px] border border-dashed border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)]",T="inline-flex min-h-11 items-center gap-2 rounded-[16px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3 text-sm text-[var(--ui-ink-medium)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]";function Oe(){const a=me(),d=de(),g=Array.isArray(a.selectedUserIds)?a.selectedUserIds:[],S=xe(g),[b,N]=u.useState(null),[x,$]=u.useState(!1),[C,y]=u.useState(!1),[F,R]=u.useState(!1),[r,X]=u.useState(null),p=ce({queryKey:["forge-companion-overview",...g],queryFn:async()=>(await je(g)).overview}),c=P({mutationFn:async(s="iroh")=>pe({userId:S??null,transportMode:s}),onSuccess:async s=>{X({qrPayload:s.qrPayload}),$(!0),await d.invalidateQueries({queryKey:["forge-companion-overview"]})}}),A=P({mutationFn:async s=>he(s),onSuccess:async()=>{await d.invalidateQueries({queryKey:["forge-companion-overview"]})}}),I=P({mutationFn:async()=>ue({userIds:g,includeRevoked:!1}),onSuccess:async()=>{await d.invalidateQueries({queryKey:["forge-companion-overview"]})}}),k=P({mutationFn:async s=>ve(s.pairingSessionId,s.source,s.desiredEnabled),onSuccess:async()=>{await d.invalidateQueries({queryKey:["forge-companion-overview"]})}});if(u.useEffect(()=>{if(!r){N(null);return}ae.toDataURL(JSON.stringify(r.qrPayload),{width:320,margin:1}).then(N)},[r]),u.useEffect(()=>{y(!1),R(!1)},[r]),p.isLoading)return e.jsx(ge,{eyebrow:"Companion",title:"Loading mobile companion",description:"Checking pairing state and recent sync status.",columns:2,blocks:5});if(p.isError||!p.data)return e.jsx(fe,{eyebrow:"Companion",error:p.error??new Error("Companion overview unavailable"),onRetry:()=>void p.refetch()});const n=p.data,f=n.pairings.filter(s=>s.status!=="revoked"),M=n.pairings.length-f.length,z=r?JSON.stringify(r.qrPayload,null,2):"",Y=async()=>{if(r&&x){$(!1);return}if(r&&!x){$(!0);return}await c.mutateAsync("iroh")},Z=async()=>{await c.mutateAsync("manual-http")},ee=async()=>{if(z){if(!navigator.clipboard){y(!0);return}try{await navigator.clipboard.writeText(z),R(!0),window.setTimeout(()=>R(!1),1800)}catch{y(!0)}}};return e.jsxs("div",{className:"mx-auto grid min-w-0 w-full max-w-[1220px] gap-5 pb-24 lg:pb-0",children:[e.jsx(be,{title:"Mobile companion",description:"Pair the native iPhone companion, sync Apple Health, and keep the bridge open for watch and location signals.",badge:n.healthState.replaceAll("_"," ")}),e.jsx(we,{}),e.jsxs("section",{className:"grid min-w-0 gap-4",children:[null,e.jsxs(Q,{className:"grid min-w-0 gap-4 overflow-hidden",children:[e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:j,children:"Pair iPhone"}),e.jsx("div",{className:"mt-2 text-lg text-[var(--ui-ink-strong)]",children:"Pair your iPhone privately"}),e.jsx("div",{className:`mt-2 max-w-3xl text-sm leading-6 ${i}`,children:"Forge uses its own Iroh/QUIC companion route by default. Scan once from the iPhone app; manual HTTP stays as the advanced LAN or Tailscale path."})]}),e.jsxs("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:flex-wrap sm:justify-end",children:[e.jsxs(m,{variant:"secondary",className:"w-full sm:w-auto",onClick:()=>void Z(),pending:c.isPending&&c.variables==="manual-http",pendingLabel:"Generating",children:[e.jsx(ie,{className:"size-4"}),"Advanced HTTP"]}),e.jsxs(m,{className:"w-full sm:w-auto",onClick:()=>void Y(),pending:c.isPending&&c.variables!=="manual-http",pendingLabel:"Generating",children:[e.jsx(ne,{className:"size-4"}),r?x?"Hide QR":"Show QR":"Generate Forge QR",r?x?e.jsx(_,{className:"size-4"}):e.jsx(D,{className:"size-4"}):null]})]})]}),x?e.jsxs("div",{className:"grid min-w-0 gap-4 overflow-hidden rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-4 sm:p-5",children:[e.jsxs("div",{className:"grid min-w-0 gap-4 lg:grid-cols-[minmax(260px,360px)_1fr]",children:[b?e.jsxs("div",{className:"grid justify-items-center gap-4 rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-6 py-6 text-[var(--ui-ink-strong)]",children:[e.jsx("img",{src:b,alt:"Forge Companion pairing QR code",className:"w-full max-w-[320px]"}),e.jsx("div",{className:`max-w-[320px] text-center text-sm ${i}`,children:"Scan this code from Forge Companion on iPhone."})]}):e.jsx("div",{className:`${V} px-5 py-8 text-center text-sm ${i}`,children:"Generating the QR code now."}),e.jsxs("div",{className:"grid content-start gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r?e.jsxs(t,{tone:Ce(r.qrPayload),children:[e.jsx(te,{className:"size-3"}),$e(r.qrPayload)]}):null,e.jsxs(t,{tone:"meta",children:[e.jsx(G,{className:"size-3"}),"One-time token"]})]}),e.jsxs("div",{className:`grid gap-3 text-sm leading-6 ${i}`,children:[e.jsxs("div",{className:"flex gap-3",children:[e.jsx(re,{className:`mt-1 size-4 shrink-0 ${v}`}),e.jsx("span",{children:"Open Forge Companion and choose Scan Forge QR."})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(G,{className:`mt-1 size-4 shrink-0 ${v}`}),e.jsx("span",{children:"The iPhone receives the desktop node, relay hint, and pairing token for the Forge Iroh route."})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(K,{className:`mt-1 size-4 shrink-0 ${v}`}),e.jsx("span",{children:"After verification, the app moves straight into native permissions and first sync."})]})]}),e.jsxs("div",{className:`flex flex-wrap items-center justify-between gap-3 ${w} p-4`,children:[e.jsx("div",{className:`text-sm ${i}`,children:r?e.jsxs("span",{children:["Expires"," ",new Date(r.qrPayload.expiresAt).toLocaleString(),"."]}):"Generate the one-time QR and scan it from the iPhone app."}),r?e.jsxs(m,{variant:"secondary",pending:c.isPending,pendingLabel:"Generating",onClick:()=>void c.mutateAsync("iroh"),children:[e.jsx(B,{className:"size-4"}),"Regenerate QR"]}):null]})]})]}),r?e.jsxs("div",{className:`grid gap-3 ${w} p-4 text-sm ${i}`,children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{className:"max-w-2xl",children:[e.jsx("div",{className:"text-[var(--ui-ink-strong)]",children:"Fallback pairing payload"}),e.jsx("div",{className:`mt-1 text-xs leading-5 ${v}`,children:"Use this only when the iPhone camera cannot scan the QR. The payload contains the same Forge Iroh connection recipe."})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(m,{variant:"secondary",onClick:()=>void ee(),children:[F?e.jsx(K,{className:"size-4"}):e.jsx(le,{className:"size-4"}),F?"Copied":"Copy payload"]}),e.jsxs(m,{variant:"secondary",onClick:()=>y(s=>!s),children:[C?"Hide payload":"Show payload",C?e.jsx(_,{className:"size-4"}):e.jsx(D,{className:"size-4"})]})]})]}),C?e.jsx("pre",{className:"max-h-56 overflow-auto whitespace-pre-wrap break-words rounded-[16px] border border-[var(--ui-border-subtle)] bg-[var(--ui-code-bg)] p-3 font-mono text-[11px] leading-5 text-[var(--ui-code-text)]",children:z}):null]}):null]}):e.jsx("div",{className:`${V} px-5 py-6 text-sm leading-6 ${i}`,children:"Generate a one-time Forge QR when the iPhone is in your hand. The code expires automatically and can be regenerated anytime."})]}),e.jsxs(Q,{className:"grid min-w-0 gap-4 overflow-hidden",children:[e.jsx("div",{className:j,children:"Companion state"}),e.jsxs("div",{className:"grid min-w-0 max-w-full gap-3 md:grid-cols-3",children:[e.jsxs("div",{className:`${l} p-4`,children:[e.jsx("div",{className:`text-sm ${i}`,children:"Pairings"}),e.jsx("div",{className:"mt-2 font-display text-3xl text-[var(--ui-ink-strong)]",children:f.length}),M>0?e.jsxs("div",{className:`mt-2 text-xs ${v}`,children:[M," revoked hidden"]}):null]}),e.jsxs("div",{className:`${l} p-4`,children:[e.jsx("div",{className:`text-sm ${i}`,children:"Sleep sessions"}),e.jsx("div",{className:"mt-2 font-display text-3xl text-[var(--ui-ink-strong)]",children:n.counts.sleepSessions})]}),e.jsxs("div",{className:`${l} p-4`,children:[e.jsx("div",{className:`text-sm ${i}`,children:"Raw sleep records"}),e.jsx("div",{className:"mt-2 font-display text-3xl text-[var(--ui-ink-strong)]",children:n.counts.sleepRawRecords})]}),e.jsxs("div",{className:`${l} p-4`,children:[e.jsx("div",{className:`text-sm ${i}`,children:"Workouts"}),e.jsx("div",{className:"mt-2 font-display text-3xl text-[var(--ui-ink-strong)]",children:n.counts.workouts})]}),e.jsxs("div",{className:`${l} p-4`,children:[e.jsx("div",{className:`text-sm ${i}`,children:"Vitals days"}),e.jsx("div",{className:"mt-2 font-display text-3xl text-[var(--ui-ink-strong)]",children:n.counts.vitalsDaySummaries??0})]}),e.jsxs("div",{className:`${l} p-4`,children:[e.jsx("div",{className:`text-sm ${i}`,children:"Vital entries"}),e.jsx("div",{className:"mt-2 font-display text-3xl text-[var(--ui-ink-strong)]",children:n.counts.vitalsMetricEntries??0})]}),e.jsxs("div",{className:`${l} p-4`,children:[e.jsx("div",{className:`text-sm ${i}`,children:"Reflected sleep"}),e.jsx("div",{className:"mt-2 font-display text-3xl text-[var(--ui-ink-strong)]",children:n.counts.reflectiveSleepSessions})]}),e.jsxs("div",{className:`${l} p-4`,children:[e.jsx("div",{className:`text-sm ${i}`,children:"Linked workouts"}),e.jsx("div",{className:"mt-2 font-display text-3xl text-[var(--ui-ink-strong)]",children:n.counts.linkedWorkouts})]}),e.jsxs("div",{className:`${l} p-4`,children:[e.jsx("div",{className:`text-sm ${i}`,children:"Habit-generated"}),e.jsx("div",{className:"mt-2 font-display text-3xl text-[var(--ui-ink-strong)]",children:n.counts.habitGeneratedWorkouts})]}),e.jsxs("div",{className:`${l} p-4`,children:[e.jsx("div",{className:`text-sm ${i}`,children:"Reconciled"}),e.jsx("div",{className:"mt-2 font-display text-3xl text-[var(--ui-ink-strong)]",children:n.counts.reconciledWorkouts})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(t,{children:n.healthState.replaceAll("_"," ")}),n.lastSyncAt?e.jsxs(t,{tone:"meta",children:["Last sync ",new Date(n.lastSyncAt).toLocaleString()]}):null,e.jsxs(t,{tone:J(n.permissions.healthKitAuthorized),children:["HealthKit"," ",n.permissions.healthKitAuthorized?"ready":"needed"]}),e.jsxs(t,{tone:J(n.permissions.backgroundRefreshEnabled),children:["Background refresh"," ",n.permissions.backgroundRefreshEnabled?"ready":"not yet"]}),e.jsxs(t,{tone:"meta",children:["Location ",n.permissions.locationReady?"ready":"later"]}),e.jsxs(t,{tone:"meta",children:["Motion ",n.permissions.motionReady?"ready":"later"]})]}),e.jsxs("div",{className:`grid gap-3 ${w} p-4`,children:[e.jsx("div",{className:j,children:"Pairing path"}),e.jsxs("div",{className:`grid gap-2 text-sm ${i}`,children:[e.jsx("div",{children:"1. Generate the Forge QR from this page."}),e.jsx("div",{children:"2. Scan it in Forge Companion to pass the desktop node and pairing token."}),e.jsx("div",{children:"3. Approve Health access on iPhone, then run the first sync."}),e.jsx("div",{children:"4. Use Advanced HTTP only for a local, Tailscale, or direct TCP route."})]})]}),e.jsxs("div",{className:"grid min-w-0 gap-3",children:[f.length>0?e.jsx("div",{className:"flex min-w-0 max-w-full justify-end overflow-hidden",children:e.jsxs(m,{variant:"secondary",pending:I.isPending,pendingLabel:"Revoking all",onClick:()=>void I.mutateAsync(),children:[e.jsx(W,{className:"size-4"}),"Revoke all"]})}):null,f.map(s=>e.jsxs("div",{className:`grid min-w-0 max-w-full gap-3 overflow-hidden ${l} px-4 py-4`,children:[e.jsxs("div",{className:"flex min-w-0 max-w-full flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-base text-[var(--ui-ink-strong)]",children:s.deviceName??s.label}),e.jsxs("div",{className:`mt-1 text-sm ${i}`,children:[s.platform??"ios"," · ",s.status]})]}),e.jsxs("div",{className:"flex min-w-0 flex-wrap gap-2",children:[e.jsx(t,{tone:s.status==="healthy"?"signal":"meta",children:s.status.replaceAll("_"," ")}),s.lastSyncAt?e.jsxs(t,{tone:"meta",children:["Synced ",new Date(s.lastSyncAt).toLocaleString()]}):null]})]}),e.jsx("div",{className:"flex min-w-0 max-w-full flex-wrap gap-2 overflow-hidden",children:s.capabilities.map(h=>e.jsx(t,{tone:"meta",size:"sm",wrap:!0,children:Ne(h)},h))}),e.jsxs("div",{className:`flex min-w-0 max-w-full flex-wrap items-center justify-between gap-3 overflow-hidden text-sm ${i}`,children:[e.jsxs("div",{className:"grid min-w-0 max-w-full flex-1 basis-[16rem] gap-1",children:[e.jsx("div",{className:"min-w-0 max-w-full break-all [overflow-wrap:anywhere]",children:s.apiBaseUrl}),e.jsxs("div",{className:"min-w-0 max-w-full break-words [overflow-wrap:anywhere]",children:["Expires ",new Date(s.expiresAt).toLocaleString()]}),s.lastSyncError?e.jsx("div",{className:"text-[color-mix(in_srgb,var(--danger)_76%,var(--ui-ink-strong)_24%)]",children:s.lastSyncError}):null]}),e.jsxs(m,{variant:"secondary",pending:A.isPending&&A.variables===s.id,pendingLabel:"Revoking",disabled:s.status==="revoked",onClick:()=>void A.mutateAsync(s.id),children:[e.jsx(W,{className:"size-4"}),s.status==="revoked"?"Revoked":"Revoke"]})]}),e.jsxs("div",{className:"grid min-w-0 gap-3 rounded-[16px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-3",children:[e.jsx("div",{className:j,children:"Device sync sources"}),[["health","Health"],["movement","Movement"],["screenTime","Screen Time"]].map(([h,O])=>{var H,U;const o=s.sourceStates[h],se=o.desiredEnabled!==o.appliedEnabled,q=k.isPending&&((H=k.variables)==null?void 0:H.pairingSessionId)===s.id&&((U=k.variables)==null?void 0:U.source)===h;return e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-[14px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 py-3",children:[e.jsxs("div",{className:"grid min-w-0 gap-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"text-sm text-[var(--ui-ink-strong)]",children:O}),e.jsx(t,{tone:Se(o.desiredEnabled,o.syncEligible),size:"sm",children:o.desiredEnabled?"Enabled":"Off"}),se?e.jsx(t,{tone:"meta",size:"sm",children:"Pending on phone"}):e.jsx(t,{tone:"meta",size:"sm",children:"Applied"})]}),e.jsxs("div",{className:`break-words text-xs [overflow-wrap:anywhere] ${i}`,children:["Authorization"," ",ke(o.authorizationStatus)," · ","Last seen"," ",Pe(o.lastObservedAt)]})]}),e.jsx("button",{type:"button",role:"switch","aria-checked":o.desiredEnabled,"aria-label":`${O} sync source`,disabled:q,onClick:()=>void k.mutateAsync({pairingSessionId:s.id,source:h,desiredEnabled:!o.desiredEnabled}),className:`relative inline-flex h-7 w-12 items-center rounded-full border transition ${o.desiredEnabled?"border-[color-mix(in_srgb,var(--primary)_45%,var(--ui-border-subtle)_55%)] bg-[var(--ui-accent-soft)]":"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-3)]"} ${q?"opacity-60":""}`,children:e.jsx("span",{className:`inline-block size-5 rounded-full bg-[var(--ui-ink-strong)] shadow transition ${o.desiredEnabled?"translate-x-6":"translate-x-1"}`})})]},h)})]})]},s.id)),f.length===0?e.jsx("div",{className:`${w} px-4 py-6 text-sm ${i}`,children:"No companion paired yet. Generate a QR code, then open the iOS companion and scan it."}):null]}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsxs(m,{variant:"secondary",onClick:()=>void p.refetch(),children:[e.jsx(B,{className:"size-4"}),"Refresh status"]}),e.jsxs(E,{to:"/sleep",className:T,children:[e.jsx(L,{className:"size-4"}),"Open sleep view"]}),e.jsxs(E,{to:"/sports",className:T,children:[e.jsx(L,{className:"size-4"}),"Open sports view"]}),e.jsxs(E,{to:"/vitals",className:T,children:[e.jsx(L,{className:"size-4"}),"Open vitals view"]})]})]})]}),e.jsxs(Q,{className:"grid min-w-0 gap-4 overflow-hidden",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:j,children:"Sync history"}),e.jsx("div",{className:"mt-2 text-lg text-[var(--ui-ink-strong)]",children:"Recent HealthKit import runs"})]}),e.jsxs(t,{tone:"meta",children:[n.importRuns.length," recent runs"]})]}),e.jsxs("div",{className:"grid min-w-0 gap-3",children:[n.importRuns.map(s=>e.jsxs("div",{className:`grid gap-3 ${l} px-4 py-4 lg:grid-cols-[minmax(0,1fr)_auto]`,children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(oe,{className:`size-4 ${v}`}),e.jsxs("div",{className:"text-base text-[var(--ui-ink-strong)]",children:[s.sourceDevice||"iPhone"," import"]}),e.jsx(t,{tone:s.status==="completed"?"signal":"meta",children:s.status})]}),e.jsxs("div",{className:`break-words text-sm [overflow-wrap:anywhere] ${i}`,children:[new Date(s.importedAt).toLocaleString()," ·"," ",ye(s.payloadSummary)]}),e.jsxs("div",{className:`flex flex-wrap gap-2 text-sm ${i}`,children:[e.jsxs(t,{tone:"meta",children:["Imported ",s.importedCount]}),e.jsxs(t,{tone:"meta",children:["Created ",s.createdCount]}),e.jsxs(t,{tone:"meta",children:["Updated ",s.updatedCount]}),e.jsxs(t,{tone:"meta",children:["Merged ",s.mergedCount]})]}),s.errorMessage?e.jsx("div",{className:"text-sm text-[color-mix(in_srgb,var(--danger)_76%,var(--ui-ink-strong)_24%)]",children:s.errorMessage}):null]}),s.pairingSessionId?e.jsxs("div",{className:`break-words text-sm [overflow-wrap:anywhere] ${v} lg:text-right`,children:["Pairing ",s.pairingSessionId]}):null]},s.id)),n.importRuns.length===0?e.jsx("div",{className:`${w} px-4 py-6 text-sm ${i}`,children:"No sync runs yet. Pair the iPhone companion and run the first HealthKit import."}):null]})]})]})}export{Oe as SettingsMobilePage};
@@ -1 +0,0 @@
1
- import{r as n,j as e,b2 as le,dq as fe,c7 as ce,dr as ke,aG as ye,bn as Ne,de as Ce}from"./vendor-Dnkkx2co.js";import{j as we,i as I,k as h}from"./state-vCcAT5Hq.js";import{S as Ae}from"./settings-section-nav-Co0AaDG-.js";import{P as Se}from"./page-hero-CONuJu5J.js";import{dg as Oe,ef as Ie,eg as Me,eh as Pe,ei as Le,ej as Ee,ek as Ke,el as Fe,L as Ue,E as _e,C as w,B as d,c as l,dv as ze,bY as $e,em as Be}from"./index-QJkjKYzZ.js";import"./motion-Lt5B1XuE.js";import"./ui-C1iwpj2-.js";import"./forms-hB0SqEh-.js";import"./board-dIX6etHh.js";import"./graph-DDUZNRsO.js";const ue="grid min-w-0 gap-2 rounded-[20px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-4",M="grid min-w-0 gap-3 rounded-[20px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-4",P="rounded-[20px] border border-dashed border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-5 text-sm leading-6 text-[var(--ui-ink-soft)]",o="min-w-0 rounded-[16px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 py-3 text-sm text-[var(--ui-ink-strong)] outline-none placeholder:text-[var(--ui-ink-faint)] transition focus:border-[var(--primary)]/35 focus:bg-[var(--ui-surface-3)]",j="text-sm text-[var(--ui-ink-strong)]",L="text-[var(--ui-ink-soft)]",m="text-[var(--ui-ink-faint)]",We="text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",g="bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]",qe="bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_78%,var(--ui-ink-strong)_22%)]",Qe="rounded-[20px] border border-[color-mix(in_srgb,var(--danger)_28%,var(--ui-border-subtle)_72%)] bg-[var(--ui-danger-soft)] px-4 py-5 text-sm leading-6 text-[color-mix(in_srgb,var(--danger)_76%,var(--ui-ink-strong)_24%)]";function E(i="openai-api"){return{label:i==="openai-codex"?"OpenAI Codex":i==="openai-compatible"?"Local compatible endpoint":i==="mock"?"Workbench mock runtime":"OpenAI API",provider:i,baseUrl:i==="openai-codex"?"https://chatgpt.com/backend-api":i==="openai-compatible"?"http://127.0.0.1:11434/v1":i==="mock"?"mock://workbench":"https://api.openai.com/v1",model:i==="mock"?"mock-echo":"gpt-5.4-mini",apiKey:""}}function Te(i){return{id:i.id,label:i.label,provider:i.provider,baseUrl:i.baseUrl,model:i.model,apiKey:""}}function aa(){var ie,te,ne,re,oe;const i=we(),[s,x]=n.useState(()=>E()),[K,F]=n.useState(""),[U,_]=n.useState("gpt-5.4-mini"),[z,$]=n.useState(""),[B,W]=n.useState("gpt-5.4-mini"),[A,me]=n.useState("Fast wiki search"),[S,ge]=n.useState("text-embedding-3-small"),[q,he]=n.useState("https://api.openai.com/v1"),[Q,T]=n.useState(""),[R,xe]=n.useState("1200"),[D,pe]=n.useState("200"),[O,y]=n.useState(""),[c,N]=n.useState(null),[G,v]=n.useState(null),u=I({queryKey:["forge-settings"],queryFn:ze}),C=I({queryKey:["forge-wiki-settings"],queryFn:$e}),ve=I({queryKey:["forge-openai-codex-oauth",c],queryFn:async()=>{if(!c)throw new Error("Missing OAuth session id");return await Be(c)},enabled:!!c,refetchInterval:a=>{var de;const r=(de=a.state.data)==null?void 0:de.session.status;return r&&["authorized","error","consumed","expired"].includes(r)?!1:1500}}),f=async()=>{await i.invalidateQueries({queryKey:["forge-settings"]}),await i.invalidateQueries({queryKey:["forge-wiki-settings"]}),await i.invalidateQueries({queryKey:["forge-wiki-search"]}),await i.invalidateQueries({queryKey:["forge-openai-codex-oauth",c]})},Z=h({mutationFn:()=>Oe({modelSettings:{forgeAgent:{basicChat:{connectionId:K||null,model:U},wiki:{connectionId:z||null,model:B}}}}),onSuccess:f}),H=h({mutationFn:()=>Ie({id:s.id,label:s.label,provider:s.provider,authMode:s.provider==="openai-codex"?"oauth":"api_key",baseUrl:s.baseUrl,model:s.model,apiKey:s.provider==="openai-codex"?void 0:s.apiKey||void 0,oauthSessionId:s.provider==="openai-codex"?c??void 0:void 0}),onSuccess:async()=>{v("Connection saved."),s.provider==="openai-codex"&&(N(null),y("")),x(E(s.provider)),await f()},onError:a=>{v(a instanceof Error?a.message:"Connection save failed.")}}),Y=h({mutationFn:Me,onSuccess:f}),J=h({mutationFn:()=>Pe({label:A.trim(),model:S.trim(),baseUrl:q.trim(),apiKey:Q.trim()||void 0,chunkSize:Number(R),chunkOverlap:Number(D)}),onSuccess:async()=>{T(""),await f()}}),V=h({mutationFn:a=>Le("embedding",a),onSuccess:f}),X=h({mutationFn:async()=>Ee({connectionId:s.id,provider:s.provider,baseUrl:s.baseUrl,model:s.model,apiKey:s.provider==="openai-codex"?void 0:s.apiKey||void 0}),onSuccess:({result:a})=>{v(`Connection test succeeded: ${a.outputPreview}`)},onError:a=>{v(a instanceof Error?a.message:"Connection test failed.")}}),ee=h({mutationFn:Ke,onSuccess:({session:a})=>{N(a.id),v("OpenAI Codex OAuth started."),a.authUrl&&window.open(a.authUrl,"_blank","noopener,noreferrer")}}),ae=h({mutationFn:async()=>{if(!c)throw new Error("No OAuth session started yet.");return await Fe(c,O)},onSuccess:({session:a})=>{v(a.status==="authorized"?"OpenAI Codex OAuth authorized.":"Manual OAuth code submitted.")}});n.useEffect(()=>{var r;const a=(r=u.data)==null?void 0:r.settings;a&&(F(a.modelSettings.forgeAgent.basicChat.connectionId??""),_(a.modelSettings.forgeAgent.basicChat.model),$(a.modelSettings.forgeAgent.wiki.provider==="openai-codex"?a.modelSettings.forgeAgent.wiki.connectionId??"":""),W(a.modelSettings.forgeAgent.wiki.model))},[u.data]);const p=((ie=u.data)==null?void 0:ie.settings.modelSettings.connections)??[],se=p.filter(a=>a.provider==="openai-codex"&&a.authMode==="oauth"),be=se.filter(a=>a.hasStoredCredential),t=((te=ve.data)==null?void 0:te.session)??null,b=s.id?p.find(a=>a.id===s.id):null,je=n.useMemo(()=>!s.label.trim()||!s.model.trim()?!1:s.provider==="openai-codex"?!!((t==null?void 0:t.status)==="authorized"||s.id&&(b!=null&&b.hasStoredCredential)):s.provider==="mock"?!0:s.apiKey.trim().length>0||!!s.id,[s,b==null?void 0:b.hasStoredCredential,t==null?void 0:t.status]);if(u.isLoading)return e.jsx(Ue,{eyebrow:"Models",title:"Loading model settings",description:"Fetching Forge agent defaults and configured AI connections."});if(u.isError||!((ne=u.data)!=null&&ne.settings))return e.jsx(_e,{eyebrow:"Models",error:u.error??new Error("Forge returned an empty model settings payload."),onRetry:()=>void u.refetch()});const k=u.data.settings;return e.jsxs("div",{className:"mx-auto grid min-w-0 w-full max-w-[1440px] gap-5",children:[e.jsx(Se,{eyebrow:"AI runtime",title:"Model Settings",description:"Manage Forge Agent defaults, OpenAI OAuth/API connections, and local OpenAI-compatible endpoints as first-class chat agents.",badge:`${p.length} model connection${p.length===1?"":"s"}`}),e.jsx(Ae,{}),e.jsxs(w,{className:"grid gap-5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(le,{className:"size-4 text-[var(--secondary)]"}),e.jsxs("div",{children:[e.jsx("div",{className:j,children:"Forge Agent defaults"}),e.jsx("div",{className:`text-xs leading-5 ${m}`,children:"Forge Agent stays the default system agent. Choose which model connection powers basic chat and the managed wiki workflow."})]})]}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsxs("label",{className:ue,children:[e.jsx("span",{className:`text-sm ${L}`,children:"Basic chat connection"}),e.jsxs("select",{className:o,value:K,onChange:a=>F(a.target.value),children:[e.jsx("option",{value:"",children:"No external connection"}),p.map(a=>e.jsxs("option",{value:a.id,children:[a.label," (",a.agentLabel,")"]},a.id))]}),e.jsx("input",{className:o,value:U,onChange:a=>_(a.target.value),placeholder:"Model"})]}),e.jsxs("label",{className:ue,children:[e.jsx("span",{className:`text-sm ${L}`,children:"KarpaWiki Codex OAuth connection"}),e.jsxs("select",{className:o,value:z,onChange:a=>$(a.target.value),children:[e.jsx("option",{value:"",children:"No Codex OAuth connection"}),se.map(a=>e.jsxs("option",{value:a.id,disabled:!a.hasStoredCredential,children:[a.label," (",a.accountLabel??a.agentLabel,")",a.hasStoredCredential?"":" · needs OAuth"]},a.id))]}),e.jsx("input",{className:o,value:B,onChange:a=>W(a.target.value),placeholder:"Model"}),e.jsx("span",{className:`text-xs leading-5 ${m}`,children:"KarpaWiki smart ingest uses ChatGPT/Codex OAuth only. It does not use metered OpenAI Platform API keys."})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsx(d,{pending:Z.isPending,pendingLabel:"Saving defaults",onClick:()=>void Z.mutateAsync(),children:"Save Forge Agent defaults"}),e.jsxs(l,{className:g,children:["Forge Agent",k.modelSettings.forgeAgent.basicChat.connectionLabel?` basic chat: ${k.modelSettings.forgeAgent.basicChat.connectionLabel}`:" basic chat stays local"]}),e.jsx(l,{className:g,children:k.modelSettings.forgeAgent.wiki.connectionLabel?`KarpaWiki OAuth: ${k.modelSettings.forgeAgent.wiki.connectionLabel}`:"KarpaWiki: no Codex OAuth model selected"}),be.length===0?e.jsx(l,{className:qe,children:"Add OpenAI Codex OAuth before smart ingest"}):null]})]}),e.jsxs(w,{className:"grid gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(fe,{className:"size-4 text-[var(--secondary)]"}),e.jsxs("div",{children:[e.jsx("div",{className:j,children:"KarpaWiki embeddings"}),e.jsx("div",{className:`text-xs leading-5 ${m}`,children:"Semantic search profiles live with model settings. They remain optional; KarpaWiki text search and entity-linked search still work without embeddings."})]})]}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,1fr)_minmax(20rem,0.9fr)]",children:[e.jsxs("div",{className:"grid gap-3",children:[C.isLoading?e.jsx("div",{className:P,children:"Loading embedding profiles."}):null,C.isError?e.jsx("div",{className:Qe,children:"Could not load KarpaWiki embedding profiles."}):null,((re=C.data)==null?void 0:re.settings.embeddingProfiles.length)===0?e.jsx("div",{className:P,children:"No embedding profile yet. Add one only if you want semantic wiki search in addition to exact search and links."}):null,(oe=C.data)==null?void 0:oe.settings.embeddingProfiles.map(a=>e.jsxs("div",{className:"grid min-w-0 gap-2 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-[var(--ui-ink-strong)]",children:a.label}),e.jsxs("div",{className:`mt-1 break-words text-xs [overflow-wrap:anywhere] ${m}`,children:[a.model," · ",a.baseUrl]})]}),e.jsx(d,{variant:"secondary",pending:V.isPending,pendingLabel:"Deleting",onClick:()=>void V.mutateAsync(a.id),children:e.jsx(ce,{className:"size-4"})})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(l,{className:g,children:["chunk ",a.chunkSize]}),e.jsxs(l,{className:g,children:["overlap ",a.chunkOverlap]}),e.jsx(l,{className:g,children:a.enabled?"enabled":"disabled"})]})]},a.id))]}),e.jsxs("div",{className:M,children:[e.jsx("input",{className:o,value:A,onChange:a=>me(a.target.value),placeholder:"Profile label"}),e.jsx("input",{className:o,value:S,onChange:a=>ge(a.target.value),placeholder:"Embedding model"}),e.jsx("input",{className:o,value:q,onChange:a=>he(a.target.value),placeholder:"Embedding base URL"}),e.jsx("input",{className:o,value:Q,onChange:a=>T(a.target.value),placeholder:"Embedding API key (optional)",type:"password"}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsx("input",{className:o,value:R,onChange:a=>xe(a.target.value),placeholder:"Chunk size",type:"number"}),e.jsx("input",{className:o,value:D,onChange:a=>pe(a.target.value),placeholder:"Chunk overlap",type:"number"})]}),e.jsx(d,{pending:J.isPending,pendingLabel:"Saving",disabled:!A.trim()||!S.trim(),onClick:()=>void J.mutateAsync(),children:"Save embedding profile"})]})]})]}),e.jsxs("div",{className:"grid min-w-0 gap-5 xl:grid-cols-[minmax(0,1.1fr)_minmax(0,0.9fr)]",children:[e.jsxs(w,{className:"grid gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ke,{className:"size-4 text-[var(--secondary)]"}),e.jsxs("div",{children:[e.jsx("div",{className:j,children:"Connection editor"}),e.jsx("div",{className:`text-xs leading-5 ${m}`,children:"Every saved connection becomes a first-class agent layered on top of Forge Agent."})]})]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:We,children:"Provider"}),e.jsx("div",{className:"grid gap-2 md:grid-cols-3",children:[["openai-api","OpenAI API"],["openai-codex","OpenAI Codex OAuth"],["openai-compatible","OpenAI-compatible"]].map(([a,r])=>e.jsx("button",{type:"button",className:`rounded-[18px] px-4 py-3 text-left text-sm transition ${s.provider===a?"border border-[color-mix(in_srgb,var(--primary)_34%,var(--ui-border-subtle)_66%)] bg-[var(--ui-accent-soft)] text-[var(--ui-ink-strong)] shadow-[var(--ui-shadow-soft)]":"border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)] hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]"}`,onClick:()=>{x(E(a)),N(null),y("")},children:r},a))})]}),e.jsx("input",{className:o,value:s.label,onChange:a=>x(r=>({...r,label:a.target.value})),placeholder:"Connection label"}),e.jsx("input",{className:o,value:s.model,onChange:a=>x(r=>({...r,model:a.target.value})),placeholder:"Model"}),s.provider==="mock"?e.jsxs("div",{className:M,children:[e.jsx("div",{className:j,children:"The Workbench mock runtime is only meant for local development and test workflows."}),e.jsxs("div",{className:`text-xs leading-5 ${m}`,children:["Use mock models like ",e.jsx("code",{children:"mock-echo"}),","," ",e.jsx("code",{children:"mock-json"}),",",e.jsx("code",{children:"mock-tool-search"}),","," ",e.jsx("code",{children:"mock-tool-note"}),", or",e.jsx("code",{children:"mock-chat-memory"})," to exercise deterministic flow behavior without a real external model."]})]}):s.provider!=="openai-codex"?e.jsxs(e.Fragment,{children:[e.jsx("input",{className:o,value:s.baseUrl,onChange:a=>x(r=>({...r,baseUrl:a.target.value})),placeholder:"Base URL"}),e.jsx("input",{className:o,value:s.apiKey,onChange:a=>x(r=>({...r,apiKey:a.target.value})),placeholder:s.id?"Leave blank to keep the stored key":"API key",type:"password"})]}):e.jsxs("div",{className:M,children:[e.jsxs("div",{className:j,children:["OpenAI Codex uses the documented PKCE flow with the local callback at"," ",e.jsx("span",{className:"break-words [overflow-wrap:anywhere]",children:k.modelSettings.oauth.openAiCodex.callbackUrl})]}),e.jsx("div",{className:`text-xs leading-5 ${m}`,children:"Start OAuth, finish the browser sign-in, then save the resulting connection as a chat agent backed by the ChatGPT Codex runtime."}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsxs(d,{variant:"secondary",pending:ee.isPending,pendingLabel:"Starting OAuth",onClick:()=>void ee.mutateAsync(),children:[e.jsx(ye,{className:"size-4"}),"Start OAuth"]}),t!=null&&t.authUrl?e.jsxs(d,{variant:"secondary",onClick:()=>window.open(t.authUrl??"","_blank","noopener,noreferrer"),children:["Open sign-in",e.jsx(Ne,{className:"size-4"})]}):null]}),t?e.jsxs("div",{className:"grid min-w-0 gap-2 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-code-bg)] p-3 text-sm text-[var(--ui-code-text)]",children:[e.jsxs("div",{children:["Status: ",t.status]}),t.accountLabel?e.jsxs("div",{children:["Account: ",t.accountLabel]}):null,t.error?e.jsx("div",{className:"text-[color-mix(in_srgb,var(--danger)_76%,var(--ui-ink-strong)_24%)]",children:t.error}):null]}):null,e.jsxs("div",{className:"grid gap-2",children:[e.jsx("input",{className:o,value:O,onChange:a=>y(a.target.value),placeholder:"Paste the authorization code or full redirect URL"}),e.jsx(d,{variant:"secondary",disabled:!O.trim()||!c,pending:ae.isPending,pendingLabel:"Submitting",onClick:()=>void ae.mutateAsync(),children:"Submit manual code"})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsx(d,{pending:H.isPending,pendingLabel:"Saving connection",disabled:!je,onClick:()=>void H.mutateAsync(),children:"Save connection"}),e.jsxs(d,{variant:"secondary",pending:X.isPending,pendingLabel:"Testing",disabled:s.provider==="openai-codex"?!s.id:s.provider==="mock"?!1:!s.id&&!s.apiKey.trim(),onClick:()=>void X.mutateAsync(),children:[e.jsx(Ce,{className:"size-4"}),"Test connection"]})]}),G?e.jsx("div",{className:`rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3 text-sm ${L}`,children:G}):null]})]}),e.jsxs(w,{className:"grid gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(le,{className:"size-4 text-[var(--secondary)]"}),e.jsxs("div",{children:[e.jsx("div",{className:j,children:"Connected agents"}),e.jsx("div",{className:`text-xs leading-5 ${m}`,children:"Each connection registers its own chat-facing agent identity."})]})]}),e.jsxs("div",{className:"grid gap-3",children:[p.length===0?e.jsx("div",{className:P,children:"No external model connection yet. Add one with OAuth or API credentials and Forge will expose it as a first-class agent."}):null,p.map(a=>e.jsxs("div",{className:"grid min-w-0 gap-3 rounded-[20px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-4",children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"break-words text-[var(--ui-ink-strong)] [overflow-wrap:anywhere]",children:a.label}),e.jsxs("div",{className:`mt-1 break-words text-xs [overflow-wrap:anywhere] ${m}`,children:[a.agentLabel," · ",a.provider," ·"," ",a.model]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(d,{variant:"secondary",onClick:()=>{x(Te(a)),N(null),y("")},children:"Edit"}),e.jsx(d,{variant:"secondary",pending:Y.isPending,pendingLabel:"Deleting",onClick:()=>void Y.mutateAsync(a.id),children:e.jsx(ce,{className:"size-4"})})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(l,{className:g,children:a.authMode==="oauth"?"OAuth":"API key"}),e.jsx(l,{className:g,children:a.status}),e.jsx(l,{className:g,wrap:!0,children:a.baseUrl}),a.accountLabel?e.jsx(l,{className:g,wrap:!0,children:a.accountLabel}):null]})]},a.id))]})]})]})]})}export{aa as SettingsModelsPage};