create-pmos 0.398.0 → 0.400.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (515) hide show
  1. package/package.json +30 -25
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/briefing-premium-adddoc-test.js +19 -15
  7. package/workspace/briefing-premium-board-test.js +82 -50
  8. package/workspace/briefing-premium-calendar-2-test.js +36 -36
  9. package/workspace/briefing-premium-calendar-3-test.js +39 -39
  10. package/workspace/briefing-premium-calendar-test.js +23 -24
  11. package/workspace/briefing-premium-doc-edit-test.js +8 -10
  12. package/workspace/briefing-premium-initiative-test.js +38 -16
  13. package/workspace/briefing-premium-insights-test.js +114 -37
  14. package/workspace/briefing-premium-metrics-test.js +6 -4
  15. package/workspace/briefing-premium-products-test.js +10 -7
  16. package/workspace/briefing-premium-sources-test.js +25 -22
  17. package/workspace/briefing-premium-test.js +48 -43
  18. package/workspace/briefing-premium-work-test.js +16 -11
  19. package/workspace/c3-capture-test.js +0 -17
  20. package/workspace/changelog.json +29 -0
  21. package/workspace/ev-everywhere-test.js +210 -0
  22. package/workspace/fixtures/premium-viewer-fixtures.js +11 -6
  23. package/workspace/guide/briefing-premium.md +2 -2
  24. package/workspace/guide/home.md +58 -19
  25. package/workspace/guide/index.md +1 -1
  26. package/workspace/guide/layout.md +2 -2
  27. package/workspace/guide/notes.md +2 -2
  28. package/workspace/guide/phone-companion.md +1 -1
  29. package/workspace/lib/board-grill.js +63 -0
  30. package/workspace/lib/board-premium.js +36 -5
  31. package/workspace/lib/initiative-layout.js +77 -0
  32. package/workspace/lib/insights-premium.js +3 -2
  33. package/workspace/lib/insights-records.js +21 -7
  34. package/workspace/lib/meeting-points.js +52 -0
  35. package/workspace/lib/news-for-you.js +88 -0
  36. package/workspace/lib/notes-series.js +29 -6
  37. package/workspace/lib/report-confirm.js +48 -0
  38. package/workspace/lib/route-modules.js +9 -9
  39. package/workspace/lib/routes-board-docs.js +46 -0
  40. package/workspace/lib/routes-board-grill.js +90 -0
  41. package/workspace/lib/routes-home-review.js +108 -0
  42. package/workspace/lib/routes-initiative-layout.js +57 -0
  43. package/workspace/lib/routes-insights-premium.js +4 -1
  44. package/workspace/lib/routes-insights-records.js +8 -4
  45. package/workspace/lib/routes-meeting-points.js +37 -0
  46. package/workspace/lib/routes-news.js +57 -0
  47. package/workspace/lib/routes-notes.js +2 -1
  48. package/workspace/lib/routes-phone-day.js +18 -9
  49. package/workspace/lib/routes-report-confirm.js +31 -0
  50. package/workspace/lib/routes-search.js +38 -0
  51. package/workspace/lib/routes-slash.js +95 -0
  52. package/workspace/lib/search-index.js +176 -0
  53. package/workspace/package-lock.json +2 -2
  54. package/workspace/package.json +1 -2
  55. package/workspace/premium-board-actions-test.js +86 -50
  56. package/workspace/premium-briefing-depth-test.js +55 -54
  57. package/workspace/premium-chat-chart-tab-test.js +4 -2
  58. package/workspace/premium-chat-goal-view-test.js +1 -1
  59. package/workspace/premium-chat-report-tab-test.js +16 -2
  60. package/workspace/premium-chat-term-test.js +0 -10
  61. package/workspace/premium-core-doc-issue-test.js +15 -13
  62. package/workspace/premium-menu-rows-test.js +1 -1
  63. package/workspace/premium-phone-card-test.js +7 -5
  64. package/workspace/premium-report-read-test.js +55 -18
  65. package/workspace/premium-vw-backlog-test.js +2 -2
  66. package/workspace/premium-vw-cal-test.js +50 -35
  67. package/workspace/premium-vw-doc-test.js +10 -11
  68. package/workspace/premium-vw-item-test.js +1 -1
  69. package/workspace/premium-vw-jira-test.js +2 -2
  70. package/workspace/premium-vw-meet-test.js +37 -40
  71. package/workspace/premium-vw-notes-test.js +21 -19
  72. package/workspace/premium-vw-rec-test.js +11 -12
  73. package/workspace/premium-welcome-test.js +3 -3
  74. package/workspace/premium-work-depth-test.js +5 -6
  75. package/workspace/public/capture.html +23 -0
  76. package/workspace/public/pm/bd-acts.js +303 -225
  77. package/workspace/public/pm/bd-asks.js +261 -0
  78. package/workspace/public/pm/bd-pop.js +59 -0
  79. package/workspace/public/pm/bd-span.js +49 -13
  80. package/workspace/public/pm/bd-views.js +169 -0
  81. package/workspace/public/pm/c3-base.js +47 -0
  82. package/workspace/public/pm/c3-capture.js +1 -1
  83. package/workspace/public/pm/c3-ini-ui.js +1 -1
  84. package/workspace/public/pm/c3-sheet.js +1 -1
  85. package/workspace/public/pm/c3-toast.js +1 -1
  86. package/workspace/public/pm/console3.css +3 -0
  87. package/workspace/public/pm/cozy-board.css +301 -0
  88. package/workspace/public/pm/cozy-ev.css +228 -0
  89. package/workspace/public/pm/cozy-evmodel.js +106 -0
  90. package/workspace/public/pm/cozy-evui.js +47 -0
  91. package/workspace/public/pm/cozy-home.css +20 -5
  92. package/workspace/public/pm/cozy-insights.css +148 -10
  93. package/workspace/public/pm/cozy-nav.js +103 -39
  94. package/workspace/public/pm/cozy-news.js +140 -0
  95. package/workspace/public/pm/cozy-search.js +203 -0
  96. package/workspace/public/pm/cozy-settings.js +198 -0
  97. package/workspace/public/pm/cozy-sources.js +89 -0
  98. package/workspace/public/pm/cozy-today.css +220 -0
  99. package/workspace/public/pm/cozy-viewer.js +5 -2
  100. package/workspace/public/pm/cozy-vw-mtg.css +350 -0
  101. package/workspace/public/pm/cozy-vw-rp.css +152 -0
  102. package/workspace/public/pm/cozy.css +9 -0
  103. package/workspace/public/pm/goal-chat.js +5 -1
  104. package/workspace/public/pm/home-adddoc.js +5 -5
  105. package/workspace/public/pm/home-app.js +365 -70
  106. package/workspace/public/pm/home-around.js +24 -126
  107. package/workspace/public/pm/home-chat.js +77 -18
  108. package/workspace/public/pm/home-data.js +9 -7
  109. package/workspace/public/pm/home-dictate.js +57 -0
  110. package/workspace/public/pm/home-draft.js +6 -6
  111. package/workspace/public/pm/home-ini-model.js +190 -0
  112. package/workspace/public/pm/home-ini.css +171 -0
  113. package/workspace/public/pm/home-ini.js +466 -0
  114. package/workspace/public/pm/home-list.js +289 -0
  115. package/workspace/public/pm/home-more.js +18 -135
  116. package/workspace/public/pm/home-phone-card.js +13 -8
  117. package/workspace/public/pm/home-review.js +103 -0
  118. package/workspace/public/pm/home-task.js +67 -0
  119. package/workspace/public/pm/home-today.js +148 -0
  120. package/workspace/public/pm/home-work.js +63 -28
  121. package/workspace/public/pm/note-dock.js +1 -2
  122. package/workspace/public/pm/notes-links.js +1 -2
  123. package/workspace/public/pm/notes-task.js +3 -4
  124. package/workspace/public/pm/premium-board.js +164 -40
  125. package/workspace/public/pm/premium-chart-tab.js +4 -5
  126. package/workspace/public/pm/premium-first.js +5 -7
  127. package/workspace/public/pm/premium-initiative-head.js +3 -3
  128. package/workspace/public/pm/premium-insights.js +499 -202
  129. package/workspace/public/pm/premium-mtg-present.js +138 -0
  130. package/workspace/public/pm/premium-mtg-replay.js +142 -0
  131. package/workspace/public/pm/premium-report-read.js +216 -52
  132. package/workspace/public/pm/premium-report-tab.js +44 -19
  133. package/workspace/public/pm/premium-shell.js +7 -7
  134. package/workspace/public/pm/premium-vw-cal.js +150 -60
  135. package/workspace/public/pm/premium-vw-doc.css +20 -2
  136. package/workspace/public/pm/premium-vw-doc.js +22 -7
  137. package/workspace/public/pm/premium-vw-mtg.js +488 -261
  138. package/workspace/public/pm/premium-vw-notes.js +61 -0
  139. package/workspace/public/pm/rp-parts.js +269 -0
  140. package/workspace/public/pm/view-notes.js +2 -2
  141. package/workspace/public/premium-board.html +4 -3
  142. package/workspace/public/premium-insights.html +10 -10
  143. package/workspace/public/premium.html +3 -1
  144. package/workspace/r/m1.png +0 -0
  145. package/workspace/r/m2.png +0 -0
  146. package/workspace/r/m3.png +0 -0
  147. package/workspace/r/nl.png +0 -0
  148. package/workspace/replaced-tests.json +435 -0
  149. package/workspace/run-tests.js +323 -28
  150. package/workspace/server.js +15 -10
  151. package/workspace/test-files.json +3 -140
  152. package/workspace/test-lists/base.json +1 -2
  153. package/workspace/test-lists/c3-desktop-light-load.json +1 -2
  154. package/workspace/test-lists/c3-initiative-boards.json +1 -2
  155. package/workspace/test-lists/c3-meeting-focus.json +2 -12
  156. package/workspace/test-lists/c3-work-agent.json +1 -2
  157. package/workspace/test-lists/calendar-tidy-up.json +1 -2
  158. package/workspace/test-lists/console3-reports.json +1 -2
  159. package/workspace/test-lists/docs-three-way-sync.json +1 -2
  160. package/workspace/test-lists/extension-capture.json +5 -0
  161. package/workspace/test-lists/initiative-layout.json +9 -0
  162. package/workspace/test-lists/jira-wbs.json +1 -2
  163. package/workspace/test-lists/legacy-cleanup-a.json +9 -0
  164. package/workspace/test-lists/meeting-material.json +1 -2
  165. package/workspace/test-lists/meeting-notes.json +2 -36
  166. package/workspace/test-lists/meeting-replay.json +1 -2
  167. package/workspace/test-lists/mm-capture.json +2 -12
  168. package/workspace/test-lists/my-work.json +2 -10
  169. package/workspace/test-lists/onboarding-firstrun.json +2 -12
  170. package/workspace/test-lists/people-directory.json +1 -2
  171. package/workspace/test-lists/premium-uncovered-meetings.json +9 -0
  172. package/workspace/test-lists/premium-uncovered-reports.json +9 -0
  173. package/workspace/test-lists/run2-a.json +1 -2
  174. package/workspace/test-lists/run2-d.json +2 -19
  175. package/workspace/test-lists/run3-b.json +1 -2
  176. package/workspace/test-lists/run3-c.json +2 -12
  177. package/workspace/test-lists/run4-b.json +1 -2
  178. package/workspace/test-lists/run4-d.json +1 -5
  179. package/workspace/test-lists/run5-c.json +1 -11
  180. package/workspace/test-lists/run6.json +1 -5
  181. package/workspace/test-lists/uf-everywhere.json +15 -0
  182. package/workspace/test-lists/uf-home.json +9 -0
  183. package/workspace/test-lists/uncovered-board.json +9 -0
  184. package/workspace/test-lists/workspace-launch-flags.json +2 -12
  185. package/workspace/test-lists/workspace-profile-detection.json +2 -10
  186. package/workspace/test-timings.json +242 -123
  187. package/workspace/c3-briefing-test.js +0 -136
  188. package/workspace/c3-core-docs-test.js +0 -170
  189. package/workspace/c3-driver-fixture.js +0 -64
  190. package/workspace/c3-driver-test.js +0 -169
  191. package/workspace/c3-foundation-test.js +0 -163
  192. package/workspace/c3-ib-items-test.js +0 -114
  193. package/workspace/c3-ib-more-test.js +0 -146
  194. package/workspace/c3-ib-triage-backlog-test.js +0 -128
  195. package/workspace/c3-ini-harness.js +0 -66
  196. package/workspace/c3-ini-life-test.js +0 -167
  197. package/workspace/c3-initiatives-test.js +0 -186
  198. package/workspace/c3-light-load-test.js +0 -112
  199. package/workspace/c3-one-home-test.js +0 -149
  200. package/workspace/c3-phone-test.js +0 -289
  201. package/workspace/c3-quiet-test.js +0 -157
  202. package/workspace/c3-report-design-real-test.js +0 -264
  203. package/workspace/c3-report-design-test.js +0 -442
  204. package/workspace/c3-report-setup-test.js +0 -192
  205. package/workspace/c3-report-structure-real-test.js +0 -248
  206. package/workspace/c3-report-structure-test.js +0 -397
  207. package/workspace/c3-reports-test.js +0 -288
  208. package/workspace/c3-scan-test.js +0 -517
  209. package/workspace/c3-sessions-panel-test.js +0 -365
  210. package/workspace/c3-settings-test.js +0 -204
  211. package/workspace/c3-updates-test.js +0 -131
  212. package/workspace/c3-work-test.js +0 -260
  213. package/workspace/cut-stub.js +0 -40
  214. package/workspace/first-paint-audit.js +0 -160
  215. package/workspace/lib/c3-full-console.js +0 -15
  216. package/workspace/lib/engine/derived/trust.js +0 -3
  217. package/workspace/lib/engine/plan-forecast.js +0 -342
  218. package/workspace/lib/engine/report-families.js +0 -175
  219. package/workspace/lib/engine/truth-table.js +0 -57
  220. package/workspace/lib/routes-c3-init.js +0 -54
  221. package/workspace/lib/routes-c3-life.js +0 -120
  222. package/workspace/lib/routes-c3-timeline.js +0 -192
  223. package/workspace/lib/routes-forecast.js +0 -86
  224. package/workspace/lib/routes-releases.js +0 -130
  225. package/workspace/lib/routes-report-facts.js +0 -85
  226. package/workspace/lib/routes-report-families.js +0 -33
  227. package/workspace/lib/routes-signals.js +0 -51
  228. package/workspace/lib/routes-timeline.js +0 -197
  229. package/workspace/public/c3.html +0 -35
  230. package/workspace/public/index.html +0 -156
  231. package/workspace/public/pm/app.js +0 -831
  232. package/workspace/public/pm/bd-board.js +0 -159
  233. package/workspace/public/pm/bd-drag.js +0 -59
  234. package/workspace/public/pm/bd-model.js +0 -152
  235. package/workspace/public/pm/bd-timeline.js +0 -233
  236. package/workspace/public/pm/bd-tree.js +0 -244
  237. package/workspace/public/pm/board-copy.js +0 -59
  238. package/workspace/public/pm/board-read.js +0 -38
  239. package/workspace/public/pm/branches-sheet.js +0 -56
  240. package/workspace/public/pm/breakdown-api.js +0 -58
  241. package/workspace/public/pm/breakdown-copy.js +0 -138
  242. package/workspace/public/pm/briefing-deck.js +0 -441
  243. package/workspace/public/pm/briefing-model.js +0 -251
  244. package/workspace/public/pm/c3-ambient.js +0 -100
  245. package/workspace/public/pm/c3-audience-link.js +0 -21
  246. package/workspace/public/pm/c3-audience.js +0 -46
  247. package/workspace/public/pm/c3-boot.js +0 -13
  248. package/workspace/public/pm/c3-breakdown.js +0 -240
  249. package/workspace/public/pm/c3-brief-data.js +0 -11
  250. package/workspace/public/pm/c3-brief-mentions.js +0 -137
  251. package/workspace/public/pm/c3-brief-needs.js +0 -288
  252. package/workspace/public/pm/c3-brief-pulse.js +0 -112
  253. package/workspace/public/pm/c3-brief-summary.js +0 -139
  254. package/workspace/public/pm/c3-brief-today.js +0 -79
  255. package/workspace/public/pm/c3-brief.js +0 -279
  256. package/workspace/public/pm/c3-cal-strategy.js +0 -529
  257. package/workspace/public/pm/c3-calendar.js +0 -965
  258. package/workspace/public/pm/c3-calpop.js +0 -111
  259. package/workspace/public/pm/c3-case.js +0 -196
  260. package/workspace/public/pm/c3-core-docs.css +0 -18
  261. package/workspace/public/pm/c3-core-docs.js +0 -236
  262. package/workspace/public/pm/c3-daypart.js +0 -176
  263. package/workspace/public/pm/c3-demo-boards.js +0 -764
  264. package/workspace/public/pm/c3-demo-brief-ix.js +0 -350
  265. package/workspace/public/pm/c3-demo-brief-page.js +0 -70
  266. package/workspace/public/pm/c3-demo-cal-ix.js +0 -74
  267. package/workspace/public/pm/c3-demo-cal2.js +0 -66
  268. package/workspace/public/pm/c3-demo-cal3.js +0 -173
  269. package/workspace/public/pm/c3-demo-cal4.js +0 -169
  270. package/workspace/public/pm/c3-demo-cal5.js +0 -52
  271. package/workspace/public/pm/c3-demo-coredocs.js +0 -221
  272. package/workspace/public/pm/c3-demo-data.js +0 -552
  273. package/workspace/public/pm/c3-demo-focus.js +0 -181
  274. package/workspace/public/pm/c3-demo-init.js +0 -430
  275. package/workspace/public/pm/c3-demo-life.js +0 -77
  276. package/workspace/public/pm/c3-demo-material.js +0 -58
  277. package/workspace/public/pm/c3-demo-misc2.js +0 -34
  278. package/workspace/public/pm/c3-demo-phone.js +0 -48
  279. package/workspace/public/pm/c3-demo-plan2.js +0 -30
  280. package/workspace/public/pm/c3-demo-rd.js +0 -432
  281. package/workspace/public/pm/c3-demo-rep-ix.js +0 -126
  282. package/workspace/public/pm/c3-demo-rep2.js +0 -130
  283. package/workspace/public/pm/c3-demo-rep3.js +0 -138
  284. package/workspace/public/pm/c3-demo-rs.js +0 -287
  285. package/workspace/public/pm/c3-demo-term.js +0 -153
  286. package/workspace/public/pm/c3-demo-time.js +0 -49
  287. package/workspace/public/pm/c3-demo-work-ix.js +0 -32
  288. package/workspace/public/pm/c3-demo.js +0 -131
  289. package/workspace/public/pm/c3-design-studio.js +0 -369
  290. package/workspace/public/pm/c3-doc-formats.js +0 -153
  291. package/workspace/public/pm/c3-doc-sheet.js +0 -1230
  292. package/workspace/public/pm/c3-dock.js +0 -206
  293. package/workspace/public/pm/c3-docs.js +0 -291
  294. package/workspace/public/pm/c3-driver-work.js +0 -110
  295. package/workspace/public/pm/c3-driver.css +0 -18
  296. package/workspace/public/pm/c3-driver.js +0 -298
  297. package/workspace/public/pm/c3-focus.css +0 -304
  298. package/workspace/public/pm/c3-focus.js +0 -983
  299. package/workspace/public/pm/c3-ib-docs.js +0 -92
  300. package/workspace/public/pm/c3-ib-initiatives.js +0 -201
  301. package/workspace/public/pm/c3-ib-items.js +0 -210
  302. package/workspace/public/pm/c3-ib-releases.js +0 -48
  303. package/workspace/public/pm/c3-ib-sprints.js +0 -201
  304. package/workspace/public/pm/c3-ib-triage.js +0 -177
  305. package/workspace/public/pm/c3-ii-tabs.js +0 -252
  306. package/workspace/public/pm/c3-ini-life.css +0 -34
  307. package/workspace/public/pm/c3-ini-life.js +0 -379
  308. package/workspace/public/pm/c3-ini-records.js +0 -197
  309. package/workspace/public/pm/c3-ini-timeline.js +0 -278
  310. package/workspace/public/pm/c3-ini-work.js +0 -139
  311. package/workspace/public/pm/c3-init-extras.js +0 -170
  312. package/workspace/public/pm/c3-initiatives.js +0 -852
  313. package/workspace/public/pm/c3-lifecycle-panels.js +0 -479
  314. package/workspace/public/pm/c3-look.js +0 -27
  315. package/workspace/public/pm/c3-material.css +0 -22
  316. package/workspace/public/pm/c3-material.js +0 -321
  317. package/workspace/public/pm/c3-md.js +0 -3
  318. package/workspace/public/pm/c3-misc-panels.js +0 -89
  319. package/workspace/public/pm/c3-new-session.js +0 -110
  320. package/workspace/public/pm/c3-notes.js +0 -751
  321. package/workspace/public/pm/c3-phone-boot.js +0 -47
  322. package/workspace/public/pm/c3-phone-detail.js +0 -97
  323. package/workspace/public/pm/c3-phone-model.js +0 -3
  324. package/workspace/public/pm/c3-phone.css +0 -66
  325. package/workspace/public/pm/c3-phone.js +0 -444
  326. package/workspace/public/pm/c3-plan-panels.js +0 -163
  327. package/workspace/public/pm/c3-plan.js +0 -193
  328. package/workspace/public/pm/c3-quiet.css +0 -113
  329. package/workspace/public/pm/c3-quiet.js +0 -177
  330. package/workspace/public/pm/c3-replay.css +0 -133
  331. package/workspace/public/pm/c3-replay.js +0 -429
  332. package/workspace/public/pm/c3-report-deck.css +0 -163
  333. package/workspace/public/pm/c3-report-deck.js +0 -598
  334. package/workspace/public/pm/c3-report-frame.css +0 -20
  335. package/workspace/public/pm/c3-report-print.css +0 -20
  336. package/workspace/public/pm/c3-report-setup.css +0 -67
  337. package/workspace/public/pm/c3-report-setup.js +0 -298
  338. package/workspace/public/pm/c3-report-store.js +0 -244
  339. package/workspace/public/pm/c3-report-structure.css +0 -44
  340. package/workspace/public/pm/c3-report-structure.js +0 -473
  341. package/workspace/public/pm/c3-reports.css +0 -68
  342. package/workspace/public/pm/c3-reports.js +0 -377
  343. package/workspace/public/pm/c3-roadmap.js +0 -249
  344. package/workspace/public/pm/c3-scan-api.js +0 -167
  345. package/workspace/public/pm/c3-scan-next.js +0 -248
  346. package/workspace/public/pm/c3-scan-setup.js +0 -313
  347. package/workspace/public/pm/c3-scan-words.js +0 -41
  348. package/workspace/public/pm/c3-scan.css +0 -74
  349. package/workspace/public/pm/c3-scan.js +0 -93
  350. package/workspace/public/pm/c3-session-chat.js +0 -103
  351. package/workspace/public/pm/c3-session-conv.js +0 -165
  352. package/workspace/public/pm/c3-session-term.js +0 -216
  353. package/workspace/public/pm/c3-settings.css +0 -85
  354. package/workspace/public/pm/c3-settings.js +0 -1045
  355. package/workspace/public/pm/c3-shell.js +0 -628
  356. package/workspace/public/pm/c3-signals.js +0 -196
  357. package/workspace/public/pm/c3-strategy-panels.js +0 -45
  358. package/workspace/public/pm/c3-swipe.js +0 -230
  359. package/workspace/public/pm/c3-terminal-data.js +0 -48
  360. package/workspace/public/pm/c3-terminal-edge.js +0 -91
  361. package/workspace/public/pm/c3-terminal-icons.js +0 -40
  362. package/workspace/public/pm/c3-terminal-results.js +0 -141
  363. package/workspace/public/pm/c3-terminal.js +0 -52
  364. package/workspace/public/pm/c3-tickets.js +0 -163
  365. package/workspace/public/pm/c3-timeline.js +0 -201
  366. package/workspace/public/pm/calendar-views.js +0 -1049
  367. package/workspace/public/pm/console3-lift.md +0 -220
  368. package/workspace/public/pm/cozy-home.js +0 -172
  369. package/workspace/public/pm/cozy-initiative.css +0 -138
  370. package/workspace/public/pm/cycle-review.js +0 -125
  371. package/workspace/public/pm/data.js +0 -1577
  372. package/workspace/public/pm/dest-board.js +0 -444
  373. package/workspace/public/pm/dest-docs.js +0 -530
  374. package/workspace/public/pm/dest-initiatives.js +0 -162
  375. package/workspace/public/pm/dest-mywork.js +0 -307
  376. package/workspace/public/pm/dest-notes.js +0 -537
  377. package/workspace/public/pm/dest-people.js +0 -449
  378. package/workspace/public/pm/dest-reports.js +0 -383
  379. package/workspace/public/pm/dest-settings.js +0 -601
  380. package/workspace/public/pm/dest-today.js +0 -267
  381. package/workspace/public/pm/display-word.js +0 -56
  382. package/workspace/public/pm/doc-editor.js +0 -473
  383. package/workspace/public/pm/doc-graph.js +0 -272
  384. package/workspace/public/pm/doc-health-panel.js +0 -110
  385. package/workspace/public/pm/doc-rail.js +0 -167
  386. package/workspace/public/pm/doc-remote.js +0 -180
  387. package/workspace/public/pm/dock-sessions.js +0 -472
  388. package/workspace/public/pm/dock.js +0 -216
  389. package/workspace/public/pm/fixture.js +0 -821
  390. package/workspace/public/pm/flag-picker.js +0 -104
  391. package/workspace/public/pm/frame-copy.js +0 -278
  392. package/workspace/public/pm/freshness-line.js +0 -149
  393. package/workspace/public/pm/handoff-box.js +0 -82
  394. package/workspace/public/pm/initiative-list.js +0 -235
  395. package/workspace/public/pm/initiative-sheet.js +0 -331
  396. package/workspace/public/pm/initiatives-api.js +0 -95
  397. package/workspace/public/pm/initiatives-copy.js +0 -287
  398. package/workspace/public/pm/initiatives-timeline-copy.js +0 -59
  399. package/workspace/public/pm/initiatives-timeline.js +0 -410
  400. package/workspace/public/pm/initiatives-ui.js +0 -291
  401. package/workspace/public/pm/item-sheet.js +0 -268
  402. package/workspace/public/pm/keep-card.js +0 -204
  403. package/workspace/public/pm/lifecycle-lens-model.js +0 -246
  404. package/workspace/public/pm/lifecycle-lens.js +0 -276
  405. package/workspace/public/pm/lifecycle.js +0 -111
  406. package/workspace/public/pm/mobile.css +0 -366
  407. package/workspace/public/pm/mobile.js +0 -581
  408. package/workspace/public/pm/modes-live.js +0 -453
  409. package/workspace/public/pm/modes.js +0 -147
  410. package/workspace/public/pm/my-work-card.js +0 -51
  411. package/workspace/public/pm/my-work-data.js +0 -36
  412. package/workspace/public/pm/new-initiative-sheet.js +0 -169
  413. package/workspace/public/pm/next-step-ui.js +0 -190
  414. package/workspace/public/pm/outbox-panel.js +0 -125
  415. package/workspace/public/pm/palette-copy.js +0 -55
  416. package/workspace/public/pm/palette.js +0 -343
  417. package/workspace/public/pm/panel-breakdown.js +0 -702
  418. package/workspace/public/pm/panel-cockpit.js +0 -425
  419. package/workspace/public/pm/panel-detail.js +0 -1513
  420. package/workspace/public/pm/panel-initiatives.js +0 -929
  421. package/workspace/public/pm/panel-newsess.js +0 -709
  422. package/workspace/public/pm/panel-repos.js +0 -741
  423. package/workspace/public/pm/panel-tabs.js +0 -1506
  424. package/workspace/public/pm/panel-trees.js +0 -204
  425. package/workspace/public/pm/people-link.js +0 -106
  426. package/workspace/public/pm/phone-deck.js +0 -167
  427. package/workspace/public/pm/pm-work-view.js +0 -1533
  428. package/workspace/public/pm/portfolio-report.js +0 -61
  429. package/workspace/public/pm/premium-acts.js +0 -280
  430. package/workspace/public/pm/premium-brief.js +0 -111
  431. package/workspace/public/pm/premium-chat.js +0 -22
  432. package/workspace/public/pm/premium-doc-sheet.js +0 -312
  433. package/workspace/public/pm/premium-initiative.js +0 -324
  434. package/workspace/public/pm/premium-insights.css +0 -228
  435. package/workspace/public/pm/premium-metric-tiles.js +0 -68
  436. package/workspace/public/pm/premium-report-brief.js +0 -132
  437. package/workspace/public/pm/premium-vw-rec.js +0 -67
  438. package/workspace/public/pm/premium-wide.css +0 -30
  439. package/workspace/public/pm/print.css +0 -44
  440. package/workspace/public/pm/provider-cards.js +0 -136
  441. package/workspace/public/pm/registry.js +0 -203
  442. package/workspace/public/pm/release-card.js +0 -110
  443. package/workspace/public/pm/releases-view.js +0 -248
  444. package/workspace/public/pm/report-families-view.js +0 -505
  445. package/workspace/public/pm/report-slides.js +0 -438
  446. package/workspace/public/pm/report-tab.js +0 -33
  447. package/workspace/public/pm/report-view.js +0 -337
  448. package/workspace/public/pm/reports-copy.js +0 -134
  449. package/workspace/public/pm/roadmap.js +0 -294
  450. package/workspace/public/pm/run-card.js +0 -260
  451. package/workspace/public/pm/sessions-panel.js +0 -219
  452. package/workspace/public/pm/sheet-jira.js +0 -353
  453. package/workspace/public/pm/shell-bell.js +0 -163
  454. package/workspace/public/pm/shell-model.js +0 -83
  455. package/workspace/public/pm/shell-phone.js +0 -124
  456. package/workspace/public/pm/shell-readaloud.js +0 -53
  457. package/workspace/public/pm/shell-recording.js +0 -274
  458. package/workspace/public/pm/shell-ticker.js +0 -90
  459. package/workspace/public/pm/sig-watch.js +0 -41
  460. package/workspace/public/pm/slide-confirm.js +0 -163
  461. package/workspace/public/pm/slides-copy.js +0 -52
  462. package/workspace/public/pm/status-banner.js +0 -95
  463. package/workspace/public/pm/tab-doc.js +0 -859
  464. package/workspace/public/pm/tab-gone.js +0 -21
  465. package/workspace/public/pm/tab-term.js +0 -1210
  466. package/workspace/public/pm/tab-web.js +0 -90
  467. package/workspace/public/pm/timeline-copy.js +0 -48
  468. package/workspace/public/pm/timeline-forecast-view.js +0 -164
  469. package/workspace/public/pm/today-agenda.js +0 -331
  470. package/workspace/public/pm/today-cards.js +0 -244
  471. package/workspace/public/pm/today-copy.js +0 -506
  472. package/workspace/public/pm/today-day.js +0 -1371
  473. package/workspace/public/pm/today-goals.js +0 -297
  474. package/workspace/public/pm/today-jobs.js +0 -84
  475. package/workspace/public/pm/today-mentions.js +0 -50
  476. package/workspace/public/pm/topbar.js +0 -202
  477. package/workspace/public/pm/triage-card.js +0 -60
  478. package/workspace/public/pm/undo-hold.js +0 -103
  479. package/workspace/public/pm/view-addrepo.js +0 -208
  480. package/workspace/public/pm/view-files.js +0 -197
  481. package/workspace/public/pm/view-livenotes.js +0 -399
  482. package/workspace/public/pm/view-today.js +0 -13
  483. package/workspace/public/pm/view-validate.js +0 -171
  484. package/workspace/public/pm/welcome.js +0 -391
  485. package/workspace/public/pm/work-place.js +0 -68
  486. package/workspace/public/pm/xlsx-read.js +0 -117
  487. package/workspace/public/welcome.html +0 -22
  488. package/workspace/test-lists/browser-suites-green.json +0 -5
  489. package/workspace/test-lists/c3-core-docs.json +0 -9
  490. package/workspace/test-lists/c3-doc-sheet-rich.json +0 -6
  491. package/workspace/test-lists/c3-doc-sheet-size.json +0 -6
  492. package/workspace/test-lists/c3-doc-sheet-v2.json +0 -6
  493. package/workspace/test-lists/c3-ib-items.json +0 -9
  494. package/workspace/test-lists/c3-ib-more.json +0 -9
  495. package/workspace/test-lists/c3-ib-triage-backlog.json +0 -9
  496. package/workspace/test-lists/c3-ini-life.json +0 -9
  497. package/workspace/test-lists/c3-meeting-board.json +0 -5
  498. package/workspace/test-lists/c3-meeting-card.json +0 -5
  499. package/workspace/test-lists/c3-notes-place.json +0 -5
  500. package/workspace/test-lists/c3-notes-series.json +0 -5
  501. package/workspace/test-lists/calendar-time-page.json +0 -5
  502. package/workspace/test-lists/calpop.json +0 -4
  503. package/workspace/test-lists/console3-briefing.json +0 -9
  504. package/workspace/test-lists/console3-foundation.json +0 -9
  505. package/workspace/test-lists/console3-work-page.json +0 -9
  506. package/workspace/test-lists/premium-brief-parity.json +0 -9
  507. package/workspace/test-lists/report-design-studio-ui.json +0 -5
  508. package/workspace/test-lists/report-structure-ui.json +0 -11
  509. package/workspace/test-lists/report-workspace-ui.json +0 -5
  510. package/workspace/test-lists/run3-a.json +0 -5
  511. package/workspace/test-lists/run3-d.json +0 -6
  512. package/workspace/test-lists/run4-c.json +0 -13
  513. package/workspace/test-lists/today-goals-jobs-ui.json +0 -5
  514. package/workspace/test-lists/today-mentions-cards.json +0 -5
  515. package/workspace/test-lists/workspace-tabs-declutter.json +0 -13
@@ -1,65 +1,129 @@
1
1
  /**
2
- * cozy-nav.js — the floating place menu of the Agreed design (initiative premium-agreed-design).
2
+ * cozy-nav.js — the floating menu (initiative premium-agreed-design; redrawn by premium-uncovered-features E1, canvas EvMenu and EvPhone).
3
3
  *
4
- * One button, bottom left on desktop and bottom right on a phone, opens Home, Board, Insights and Settings.
5
- * It is the one way between places: the old five-place rail is gone (premium-shell.js takes it out of the page).
6
- * Settings has no design yet, so it opens the Viewer on its placeholder (cozy-viewer.js). Nothing here leads to the console.
4
+ * One button, bottom left on desktop and bottom right on a phone, opens the menu: Home, Board, Insights; then Search (⌘K), New for you
5
+ * (its count), Sources (the source furthest behind, with an amber dot), Settings and Theme (Light, Dark, Auto). It is the one way between
6
+ * places. Closed, the button shows two dots: blue when something is new for you, amber when a source is stale. Nothing moves.
7
+ * Search pm/cozy-search.js: across the repository and every worktree; Ctrl K (Cmd K) or "/" opens it from any page
8
+ * New for you pm/cozy-news.js: the FYI items (mentions, tasks given to you, finished work) in the Viewer
9
+ * Sources pm/cozy-sources.js: what PMOS reads and how old each reading is, in the Viewer
10
+ * Settings pm/cozy-settings.js: General, Connectors, Workspaces, Updates, What's new
11
+ * A page with features the design does not draw yet passes opts.more (Home): a quiet "More" row then follows Settings.
12
+ * The counts come from GET /api/news-for-you and GET /api/sources, read when the page opens and every two minutes while it is shown.
13
+ * Nothing here leads to the console, and nothing here writes but the theme (this device).
7
14
  */
8
- import { placeholder } from './cozy-viewer.js';
15
+ import { esc, svg, ICON, wsQ } from './cozy-evui.js';
16
+ import { fabLabel, staleOf } from './cozy-evmodel.js';
9
17
 
10
18
  export const PLACES = [
11
- { key: 'home', label: 'Home', href: '/premium.html', d: 'M4 11l8-7 8 7v9h-5v-6h-6v6H4z' },
12
- { key: 'board', label: 'Board', href: '/premium-board.html', d: 'M12 3 3 8l9 5 9-5zM3 13l9 5 9-5' },
13
- { key: 'insights', label: 'Insights', href: '/premium-insights.html', d: 'M4 20V10M10 20V4M16 20v-8M22 20H2' },
19
+ { key: 'home', label: 'Home', href: '/premium.html', d: ICON.home },
20
+ { key: 'board', label: 'Board', href: '/premium-board.html', d: ICON.board },
21
+ { key: 'insights', label: 'Insights', href: '/premium-insights.html', d: ICON.insights },
14
22
  ];
15
- const MENU = 'M4 7h16M4 12h16M4 17h16';
16
- const CLOSE = 'M6 6l12 12M18 6L6 18';
17
- const MORE = 'M5 12h.01M12 12h.01M19 12h.01';
18
- const GEAR = 'M12 9a3 3 0 1 0 0 6a3 3 0 1 0 0-6M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9l2.1 2.1M16.9 16.9l2.1 2.1M4.9 19.1l2.1-2.1M16.9 7.1l2.1-2.1';
19
- const svg = (d) => `<svg viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
23
+ export { fabLabel };
24
+ const THEME_KEY = 'pmos.c3.theme';
25
+ const THEMES = [['light', 'Light'], ['dark', 'Dark'], ['auto', 'Auto']];
26
+ const CSS = '/pm/cozy-ev.css';
27
+ const N = { news: 0, stale: null, here: 'home' };
20
28
 
21
- /** The label the button reads: "Open the menu. You are in Board". */
22
- export function fabLabel(here, open) {
23
- const p = PLACES.find((x) => x.key === here);
24
- return open ? 'Close the menu' : 'Open the menu. You are in ' + (p ? p.label : 'PMOS');
29
+ const store = { get(k) { try { return localStorage.getItem(k); } catch { return null; } }, set(k, v) { try { if (v) localStorage.setItem(k, v); else localStorage.removeItem(k); } catch { /* a private window */ } } };
30
+ /** The theme the PM picked on this device: light, dark or auto. */
31
+ export const themePick = () => { const t = store.get(THEME_KEY); return t === 'light' || t === 'dark' ? t : 'auto'; };
32
+ /** Apply a pick: Auto follows the computer, and follows it when it changes. */
33
+ export function setTheme(pick, doc = document, { keep = true } = {}) {
34
+ const p = pick === 'light' || pick === 'dark' ? pick : 'auto';
35
+ if (keep) store.set(THEME_KEY, p === 'auto' ? '' : p);
36
+ const dark = p === 'dark' || (p === 'auto' && typeof matchMedia === 'function' && matchMedia('(prefers-color-scheme: dark)').matches);
37
+ doc.documentElement.dataset.theme = dark ? 'dark' : 'light';
38
+ doc.querySelectorAll('[data-ev-theme]').forEach((b) => b.setAttribute('aria-pressed', String(b.dataset.evTheme === p)));
39
+ doc.dispatchEvent(new CustomEvent('cz:theme', { detail: { pick: p, dark } }));
25
40
  }
26
41
 
27
- /** The menu's markup for one place; pure, so a unit test can read it. */
28
- export function menuHtml(here) {
29
- return PLACES.map((p) => `<a href="${p.href}"${p.key === here ? ' aria-current="page"' : ''}>${svg(p.d)}<span>${p.label}</span></a>`).join('')
30
- + `<button type="button" class="cz-set" data-cz-more>${svg(MORE)}<span>More</span></button>`
31
- + `<button type="button" class="cz-set" data-cz-settings>${svg(GEAR)}<span>Settings</span></button>`;
42
+ /** The menu's markup; pure, so a unit test can read it. here: home | board | insights. o: { news, stale: { text } | null, more, theme } */
43
+ export function menuHtml(here, o = {}) {
44
+ const news = o.news > 0 ? `<span class="ev-k"><span class="ev-pill y">${o.news > 99 ? '99+' : o.news}</span></span>` : '';
45
+ const stale = o.stale ? `<span class="ev-k"><i class="ev-dot risk" aria-hidden="true"></i>${esc(o.stale.text)}</span>` : '';
46
+ const th = o.theme || 'auto';
47
+ return PLACES.map((p) => `<a href="${p.href}"${p.key === here ? ' aria-current="page"' : ''}>${svg(p.d, 18)}${p.key === here ? `<b>${p.label}</b>` : `<span>${p.label}</span>`}</a>`).join('')
48
+ + '<div class="ev-hr" role="separator"></div>'
49
+ + `<button type="button" class="ev-mi" data-cz-search>${svg(ICON.search, 18)}<span>Search</span><span class="ev-k"><span class="ev-kbd">⌘K</span></span></button>`
50
+ + `<button type="button" class="ev-mi" data-cz-news aria-label="New for you${o.news > 0 ? ', ' + o.news + ' new' : ''}">${svg(ICON.news, 18)}<span>New for you</span>${news}</button>`
51
+ + `<button type="button" class="ev-mi" data-cz-sources aria-label="Sources${o.stale ? ', ' + esc(o.stale.text) : ''}">${svg(ICON.sources, 18)}<span>Sources</span>${stale}</button>`
52
+ + `<button type="button" class="ev-mi" data-cz-settings>${svg(ICON.settings, 18)}<span>Settings</span></button>`
53
+ + (o.more ? `<button type="button" class="ev-mi ev-mmore" data-cz-more>${svg(ICON.more, 18)}<span>More</span></button>` : '')
54
+ + `<div class="ev-mi ev-theme">${svg(ICON.theme, 18)}<span>Theme</span><span class="ev-seg sm" role="group" aria-label="Theme">${THEMES.map(([k, w]) => `<button type="button" data-ev-theme="${k}" aria-pressed="${k === th}">${w}</button>`).join('')}</span></div>`;
32
55
  }
33
56
 
57
+ function addCss(doc) {
58
+ if (doc.querySelector(`link[href="${CSS}"]`)) return;
59
+ const l = doc.createElement('link'); l.rel = 'stylesheet'; l.href = CSS; doc.head.append(l);
60
+ }
61
+ async function getj(p) { try { const r = await fetch(p, { credentials: 'same-origin' }); return r.ok ? await r.json() : null; } catch { return null; } }
62
+
34
63
  /** Mount the menu once. `here` is home | board | insights. Returns the wrapper. */
35
64
  export function mountNav(here, doc = document, opts = {}) {
36
65
  const old = doc.getElementById('czNav'); if (old) return old;
66
+ N.here = here;
37
67
  doc.body.classList.add('cz');
68
+ addCss(doc);
69
+ { const u = new URLSearchParams(location.search).get('theme'); setTheme(u || themePick(), doc, { keep: false }); } // ?theme= shows that theme and is not kept
70
+ if (typeof matchMedia === 'function') { const mq = matchMedia('(prefers-color-scheme: dark)'); const f = () => { if (themePick() === 'auto') setTheme('auto', doc); }; if (mq.addEventListener) mq.addEventListener('change', f); }
71
+ try { if (localStorage.getItem('pmos.cz.viewer') === 'popup') doc.body.classList.add('ev-vw-popup'); } catch { /* no storage */ }
38
72
  const w = doc.createElement('div'); w.className = 'cz-fabw'; w.id = 'czNav';
39
- w.innerHTML = `<nav class="cz-fabm" id="czMenu" aria-label="Places" hidden>${menuHtml(here)}</nav>`
40
- + `<button type="button" class="cz-fab" id="czFab" aria-controls="czMenu" aria-expanded="false" aria-label="${fabLabel(here, false)}">${svg(MENU)}</button>`;
73
+ w.innerHTML = '<div class="ev-scrim" id="czScrim" hidden></div>'
74
+ + `<nav class="cz-fabm ev-menu" id="czMenu" aria-label="Menu" hidden></nav>`
75
+ + `<button type="button" class="cz-fab" id="czFab" aria-controls="czMenu" aria-expanded="false" aria-label="${fabLabel(here, false)}">${svg(ICON.menu, 22)}</button>`
76
+ + '<i class="ev-fd you" id="czFdYou" hidden></i><i class="ev-fd risk" id="czFdRisk" hidden></i>';
41
77
  doc.body.appendChild(w);
42
- const fab = w.querySelector('#czFab'), menu = w.querySelector('#czMenu');
78
+ const fab = w.querySelector('#czFab'), menu = w.querySelector('#czMenu'), scrim = w.querySelector('#czScrim');
79
+ const draw = () => {
80
+ menu.innerHTML = menuHtml(here, { news: N.news, stale: N.stale, more: !!opts.more, theme: themePick() });
81
+ w.querySelector('#czFdYou').hidden = !(N.news > 0) || !menu.hidden;
82
+ w.querySelector('#czFdRisk').hidden = !N.stale || !menu.hidden;
83
+ if (menu.hidden) fab.setAttribute('aria-label', fabLabel(here, false, !!N.stale) + (N.news > 0 ? '. ' + N.news + ' new for you' : ''));
84
+ };
43
85
  const set = (open) => {
44
- menu.hidden = !open; fab.setAttribute('aria-expanded', String(open));
45
- fab.setAttribute('aria-label', fabLabel(here, open)); fab.innerHTML = svg(open ? CLOSE : MENU);
86
+ menu.hidden = !open; scrim.hidden = !open; fab.setAttribute('aria-expanded', String(open));
87
+ fab.setAttribute('aria-label', fabLabel(here, open, !!N.stale)); fab.innerHTML = svg(open ? ICON.close : ICON.menu, 22);
88
+ draw();
89
+ if (open) { const f = menu.querySelector('a, button'); if (f) f.focus(); }
46
90
  };
91
+ draw();
47
92
  fab.addEventListener('click', () => set(menu.hidden));
48
- doc.addEventListener('keydown', (e) => { if (e.key === 'Escape' && !menu.hidden) { set(false); fab.focus(); } });
93
+ scrim.addEventListener('click', () => set(false));
94
+ doc.addEventListener('keydown', (e) => { if (e.key === 'Escape' && !menu.hidden) { e.stopPropagation(); set(false); fab.focus(); } }, true);
49
95
  // set() redraws the button's icon, so the pressed icon may be gone from the page by now: only a press still on the page closes the menu
50
96
  doc.addEventListener('click', (e) => { if (!menu.hidden && e.target.isConnected && !w.contains(e.target)) set(false); });
51
- // Settings and More: the minimal versions of the features the design does not draw yet (home-more.js), each with "Waiting for design"
52
- menu.querySelector('[data-cz-settings]').addEventListener('click', () => { set(false); import('./home-more.js').then((M) => M.openSettings()).catch(() => placeholder('Settings', { icon: 'gear' })); });
53
- menu.querySelector('[data-cz-more]').addEventListener('click', () => {
97
+ menu.addEventListener('click', (e) => {
98
+ const b = e.target.closest('button'); if (!b) return;
99
+ if (b.dataset.evTheme) { setTheme(b.dataset.evTheme, doc); return; }
54
100
  set(false);
55
- if (opts.more) { opts.more()(fab); return; }
56
- import('./home-more.js').then((M) => moreList(M, doc)).catch(() => placeholder('More', { icon: 'list' }));
101
+ if ('czSearch' in b.dataset) import('./cozy-search.js').then((M) => M.openSearch(opts.search ? { go: opts.search() } : {}));
102
+ else if ('czNews' in b.dataset) import('./cozy-news.js').then((M) => M.openNews(opts.news ? { go: opts.news() } : {}));
103
+ else if ('czSources' in b.dataset) import('./cozy-sources.js').then((M) => M.openSources());
104
+ else if ('czSettings' in b.dataset) import('./cozy-settings.js').then((M) => M.openSettings());
105
+ else if ('czMore' in b.dataset && opts.more) opts.more()(fab);
57
106
  });
107
+ // Ctrl K (Cmd K) and "/" open Search from any page; a second press focuses it
108
+ doc.addEventListener('keydown', (e) => {
109
+ const t = e.target, typing = t && t.matches && t.matches('input, textarea, select, [contenteditable="true"], [contenteditable=""]');
110
+ const k = (e.ctrlKey || e.metaKey) && !e.altKey && !e.shiftKey && (e.key === 'k' || e.key === 'K');
111
+ if (!k && !(e.key === '/' && !e.ctrlKey && !e.metaKey && !e.altKey && !typing)) return;
112
+ if (t && t.closest && t.closest('.xterm')) return; // a terminal keeps its keys
113
+ e.preventDefault(); e.stopImmediatePropagation();
114
+ import('./cozy-search.js').then((M) => M.openSearch(opts.search ? { go: opts.search() } : {}));
115
+ }, true);
116
+ const read = async () => {
117
+ if (doc.hidden) return;
118
+ const [n, s] = await Promise.all([getj('/api/news-for-you' + wsQ()), getj('/api/sources' + wsQ())]);
119
+ if (n && n.ok) N.news = n.count || 0;
120
+ if (s && s.ok) N.stale = staleOf(s.sources);
121
+ if (menu.hidden || !menu.contains(doc.activeElement)) draw();
122
+ };
123
+ read();
124
+ setInterval(read, 120000);
125
+ doc.addEventListener('visibilitychange', () => { if (!doc.hidden) read(); });
126
+ doc.addEventListener('cz:news', (e) => { if (e.detail && Number.isFinite(e.detail.count)) { N.news = e.detail.count; draw(); } else read(); });
127
+ window.addEventListener('pm:sources', (e) => { const d = e.detail; if (d && d.ok) { N.stale = staleOf(d.sources); draw(); } });
58
128
  return w;
59
129
  }
60
- /** The features with no design yet, as one list in the Viewer, on a page that has no menu of its own for them. */
61
- function moreList(M, doc) {
62
- const go = { work: M.openMyWork, around: M.openAround, inbox: () => M.openInbox(), eod: M.openEndOfDay, rec: M.openRecorder, search: () => M.openSearch(), products: M.openProducts, sources: M.openSources, settings: M.openSettings,
63
- cal: () => (doc.defaultView.czViews && doc.defaultView.czViews.openCalendar ? doc.defaultView.czViews.openCalendar({ view: 'day' }) : placeholder('Calendar', { icon: 'cal' })) };
64
- return M.listCard(M.moreItems.map(([k, l]) => [l, go[k]]));
65
- }
@@ -0,0 +1,140 @@
1
+ /* pm/cozy-news.js — New for you, in the Viewer (initiative premium-uncovered-features, E2; canvas EvInbox, HmAround). It replaces the Inbox
2
+ * (the bell) and Around you.
3
+ *
4
+ * For your information only: Mentions, Given to you, Finished while you were away (GET /api/news-for-you), and today's digests from the
5
+ * morning brief (GET /api/briefing-premium). An item leaves once it is seen: the items shown are marked seen when the card closes, and
6
+ * Mark all seen marks them at once (POST /api/news-for-you/seen). Open on a row shows the item: a mention with Make it a task, Mark read and
7
+ * Open in its source; a task with its source; finished work opens where it waits. What Around you also showed has one home each, named
8
+ * under "Where the rest went", and each line opens it (home-around.js keeps those views). The prep line Around you held (the meetings left
9
+ * today and how many are prepped, GET /api/brief-page) sits under the head when a meeting is still ahead.
10
+ * openNews({ go? }) → the body element */
11
+ import { pmGet, pmPost } from './http.js';
12
+ import { open as vwOpen, current as vwCurrent } from './cozy-viewer.js';
13
+ import { esc, svg, ICON, toast, wsParam, wsQ, skelRows, cantRead, allClear } from './cozy-evui.js';
14
+ import { initials, ago } from './cozy-evmodel.js';
15
+
16
+ const SRC = { slack: 'Slack', jira: 'Jira', confluence: 'Confluence', mail: 'Mail' };
17
+ const N = { r: null, dig: null, prep: '', view: '', body: null, shown: new Set(), madd: new Set(), mread: new Set(), busy: false };
18
+ const homeUrl = (params) => { const q = new URLSearchParams(params); if (wsParam()) q.set('ws', wsParam()); return '/premium.html?' + q.toString(); };
19
+ const https = (u) => (/^https:\/\/\S+$/i.test(String(u || '')) ? u : '');
20
+ /** The deep link of a finished item, as the bell's was: a My work item opens its dialog; anything else opens on Home. */
21
+ const finHref = (it) => (/^item:/.test(it.open) ? homeUrl({ item: it.open.slice(5) }) : homeUrl(it.pws ? { open: it.open, pws: it.pws } : { open: it.open }));
22
+ const taskLine = (m) => (m.asks ? 'Reply to ' + String(m.who || 'the sender').split(/\s+/)[0] + ' (' + (SRC[m.source] || m.source || 'source') + ') by today' : 'Read ' + String(m.who || 'the sender').split(/\s+/)[0] + '\'s note (' + (SRC[m.source] || m.source || 'source') + ')');
23
+
24
+ function items() { return N.r && N.r.ok ? N.r.groups.flatMap((g) => g.items) : []; }
25
+ function rowHtml(it) {
26
+ const who = it.kind === 'mention' ? it.who : it.kind === 'task' ? (it.from || 'Someone') : (it.product || 'Agent');
27
+ const av = `<span class="ev-av${it.kind === 'finished' ? ' b' : ''}" aria-hidden="true">${esc(initials(who))}</span>`;
28
+ const sub = it.kind === 'mention' ? ['“' + it.text + '”', [SRC[it.source] || it.source, it.where].filter(Boolean).join(' '), ago(it.at ? new Date(it.at).toISOString() : '')].filter(Boolean).join(' · ')
29
+ : it.kind === 'task' ? ['From ' + (it.from || 'a source') + (it.key ? ' ' + it.key : ''), it.due ? 'due ' + it.due : '', it.initiative ? 'filed under ' + it.initiative : ''].filter(Boolean).join(' · ')
30
+ : [it.what, it.product, it.target, it.at ? ago(new Date(it.at).toISOString()) : ''].filter(Boolean).join(' · ');
31
+ return `<div class="ev-trow" data-ev-id="${esc(it.id)}"><i class="ev-dot you" aria-hidden="true"></i>${av}<div class="ev-tx"><p><b>${esc(it.title)}</b></p><p class="ev-small ev-mut">${esc(sub)}</p></div>`
32
+ + `<button type="button" class="ev-ib" data-ev-open="${esc(it.id)}" aria-label="Open: ${esc(it.title)}" title="Open">${svg(ICON.open, 16)}</button></div>`;
33
+ }
34
+ const REST = [
35
+ ['pulse', 'Portfolio pulse', 'Insights · Goals. Home does not repeat it.'],
36
+ ['rep', 'Found in your work', 'Insights · Library, at the top.'],
37
+ ['prop', 'Proposals', 'the initiative’s next step, because they need an answer.'],
38
+ ['scan', 'Scan now', 'Ask in chat: “scan for billing news”.'],
39
+ ];
40
+ function digHtml() {
41
+ const d = N.dig; if (!d || !d.length) return '';
42
+ return `<section id="aroundDig" class="ev-dig"><p class="ev-lbl">Digests ${d.length}</p>${d.map((e) => { const x = e.dialog || {}, p = x.pane || {}, l = https(x.link);
43
+ return `<div class="ev-trow"><i class="ev-dot none" aria-hidden="true"></i><span class="ev-av" aria-hidden="true">${esc(initials(e.title))}</span><div class="ev-tx"><p><b>${esc(e.title)}</b></p><p class="ev-small ev-mut">${esc(e.sub || '')}</p>${(p.paras || []).map((t) => `<p class="ev-small">${esc(t)}</p>`).join('')}</div>${l ? `<a class="ev-ib srcLink" href="${esc(l)}" target="_blank" rel="noopener noreferrer" aria-label="Open ${esc(x.linkLabel || 'it')}" title="${esc(x.linkLabel || 'Open it')}">${svg(ICON.open, 16)}</a>` : ''}</div>`; }).join('')}</section>`;
44
+ }
45
+ function listHtml() {
46
+ const r = N.r;
47
+ const head = `<div class="ev-head"><h2 class="ev-h2">New since this morning</h2>${r && r.ok && r.count ? '<button type="button" class="ev-btn sm ghost" data-ev-all>Mark all seen</button>' : ''}</div>`;
48
+ const two = '<div class="ev-two"><div class="ev-box"><b>Initiatives</b> (left)<br><span class="ev-mut">Each shows its next step. It stays until you act.</span></div><div class="ev-box blue"><b>New for you</b> (here)<br><span class="ev-mut">For your information. It goes once you have seen it.</span></div></div>';
49
+ let body;
50
+ if (!r) body = skelRows(3) + '<p class="ev-small ev-mut">Reading what is new for you</p>';
51
+ else if (!r.ok) body = cantRead({ what: 'New for you', why: r.error || '' });
52
+ else if (!r.count) body = allClear('Nothing new since you last looked');
53
+ else body = r.groups.map((g) => `<p class="ev-lbl">${esc(g.label)}</p>` + g.items.map(rowHtml).join('')).join('');
54
+ const notRead = r && r.ok && r.read ? [['mentions', 'Mentions'], ['inbox', 'The agents\' results'], ['work', 'Your tasks']].filter(([k]) => r.read[k] === false).map(([, l]) => l) : [];
55
+ const rest = `<p class="ev-lbl">Where the rest went</p><div class="ev-box ev-rest">${REST.map(([k, t, w]) => `<button type="button" data-ev-rest="${k}"><b>${esc(t)}</b><span>${esc(w)}</span></button>`).join('')}</div>`;
56
+ const foot = '<div class="ev-foot"><div class="ev-box ev-small"><b>Not here, so nothing shows twice</b><br>A mention that asks you something, a passed review or a proposal becomes the next step of its initiative. A task given to you shows here once, then sits under its initiative. Goal trends live in Insights.</div></div>';
57
+ return head + (N.prep || '') + two + body + (notRead.length ? `<p class="ev-small ev-mut" role="status">Not read: ${esc(notRead.join(', '))}.</p>` : '') + digHtml() + rest + foot;
58
+ }
59
+ function detailHtml(it) {
60
+ const back = '<div class="ev-head"><button type="button" class="ev-btn sm ghost" data-ev-back>' + svg(ICON.back, 16) + 'New for you</button></div>';
61
+ if (it.kind === 'mention') {
62
+ const l = https(it.link), done = N.madd.has(it.id), read = N.mread.has(it.id);
63
+ return back + `<p class="ev-lbl">${esc([SRC[it.source] || it.source, it.where, ago(it.at ? new Date(it.at).toISOString() : '')].filter(Boolean).join(' · '))}${it.asks ? ' · asks you something' : ''}</p><h2 class="ev-h2">${esc(it.title)}</h2><p class="ev-q">${esc(it.text)}</p>`
64
+ + (it.initiative ? `<p class="ev-small ev-mut">${esc(it.initiative)}</p>` : '')
65
+ + `<div class="ev-acts">${done ? '<span class="ev-pill ok">In your tasks</span>' : '<button type="button" class="ev-btn sm pri" data-ev-act="task">Make it a task</button>'}${read ? '<span class="ev-pill">Marked read</span>' : '<button type="button" class="ev-btn sm" data-ev-act="read">Mark read</button>'}${l ? `<a class="ev-btn sm" href="${esc(l)}" target="_blank" rel="noopener noreferrer">Open in ${esc(SRC[it.source] || 'its source')}</a>` : ''}</div>`
66
+ + (done ? '' : `<p class="ev-small ev-mut">Make it a task adds “${esc(taskLine(it))}” to your tasks. Mark read keeps it out of today's list. Nothing here replies or posts.</p>`);
67
+ }
68
+ const l = https(it.link);
69
+ return back + `<p class="ev-lbl">Given to you · ${esc(it.from || 'a source')}</p><h2 class="ev-h2">${esc(it.title.replace(/^New task: /, ''))}</h2>`
70
+ + `<p class="ev-small ev-mut">${esc([it.key, it.due ? 'due ' + it.due : '', it.initiative ? 'filed under ' + it.initiative : ''].filter(Boolean).join(' · '))}</p>`
71
+ + `<div class="ev-acts"><a class="ev-btn sm pri" href="${esc(homeUrl({ item: it.tid }))}">Open in Home</a>${l ? `<a class="ev-btn sm" href="${esc(l)}" target="_blank" rel="noopener noreferrer">Open in ${esc(it.from || 'its source')}</a>` : ''}</div>`;
72
+ }
73
+ function draw() {
74
+ const b = N.body; if (!b || !b.isConnected) return;
75
+ { const c = vwCurrent(); if (!c || c.id !== 'news') return; } // the Viewer moved on to another item: a late read draws nothing
76
+ const it = N.view && items().find((x) => x.id === N.view);
77
+ b.innerHTML = it ? detailHtml(it) : listHtml();
78
+ if (!it) for (const x of items()) N.shown.add(x.id);
79
+ }
80
+ async function read() {
81
+ const [r, d, bp] = await Promise.all([pmGet('/api/news-for-you' + wsQ()), N.dig ? Promise.resolve(null) : pmGet('/api/briefing-premium' + wsQ()), pmGet('/api/brief-page' + wsQ())]);
82
+ N.prep = bp && bp.ok !== false ? await import('./home-around.js').then((M) => M.prepHtmlOf(bp)).catch(() => '') : '';
83
+ N.r = r && r.ok ? r : { ok: false, error: (r && r.error) || 'the server did not answer' };
84
+ if (d && d.ok && d.model) { const T = d.model.today || {}; N.dig = [].concat(T.earlier || [], T.ahead || []).filter((e) => e && e.kind === 'digest'); }
85
+ draw();
86
+ if (N.r.ok) document.dispatchEvent(new CustomEvent('cz:news', { detail: { count: N.r.count } }));
87
+ }
88
+ /** Mark ids seen; the count in the menu follows. */
89
+ async function seen(ids) {
90
+ const L = [...ids].filter(Boolean); if (!L.length) return true;
91
+ let ok = true;
92
+ for (let i = 0; i < L.length; i += 300) { const r = await pmPost('/api/news-for-you/seen', { ids: L.slice(i, i + 300) }); if (!r || !r.ok) ok = false; }
93
+ document.dispatchEvent(new CustomEvent('cz:news', {}));
94
+ return ok;
95
+ }
96
+
97
+ export function openNews(o = {}) {
98
+ N.view = ''; N.shown = new Set();
99
+ N.body = vwOpen({ id: 'news', kind: 'For your information', title: 'New for you', icon: ICON.news, render: (b) => { b.classList.add('ev-card-b', 'ev-news'); N.body = b; draw(); wire(b, o); },
100
+ onClose: () => { const ids = [...N.shown]; N.shown = new Set(); seen(ids); } }); // an item leaves once seen: what the card showed is seen when it closes
101
+ read();
102
+ return N.body;
103
+ }
104
+ function wire(b, o) {
105
+ b.onclick = async (e) => {
106
+ const t = e.target.closest('button'); if (!t || N.busy) return;
107
+ if ('evRetry' in t.dataset) { N.r = null; draw(); read(); return; }
108
+ if ('evSources' in t.dataset) { import('./cozy-sources.js').then((M) => M.openSources()); return; }
109
+ if ('evBack' in t.dataset) { N.view = ''; draw(); const f = b.querySelector('[data-ev-open]'); if (f) f.focus(); return; }
110
+ if ('evAll' in t.dataset) {
111
+ N.busy = true; const ids = items().map((x) => x.id);
112
+ const ok = await seen(ids); N.busy = false;
113
+ if (!ok) { toast('It was not marked seen. The server did not answer.'); return; }
114
+ N.shown = new Set(); toast('Marked seen.'); N.r = null; draw(); read(); return;
115
+ }
116
+ if (t.dataset.evRest) {
117
+ const k = t.dataset.evRest;
118
+ // each opens its view, so every press the old Around you held (keep, dismiss, Scan now, set up) is still one press away
119
+ import('./home-around.js').then((M) => M.openAround(k)); return;
120
+ }
121
+ if (t.dataset.evOpen) {
122
+ const it = items().find((x) => x.id === t.dataset.evOpen); if (!it) return;
123
+ N.shown.add(it.id);
124
+ if (it.kind === 'finished') { await seen([it.id]); location.assign(finHref(it)); return; }
125
+ N.view = it.id; draw(); const f = b.querySelector('[data-ev-back]'); if (f) f.focus(); return;
126
+ }
127
+ if (t.dataset.evAct) {
128
+ const it = items().find((x) => x.id === N.view); if (!it) return;
129
+ N.busy = true; t.disabled = true;
130
+ const r = t.dataset.evAct === 'task' ? await pmPost('/api/pm-items/add', { line: taskLine(it) }) : await pmPost('/api/mentions/read', { id: it.mid, read: true });
131
+ N.busy = false;
132
+ if (!r || r.ok === false) { toast('That did not go through' + (r && r.error ? ': ' + r.error : '.')); t.disabled = false; return; }
133
+ if (t.dataset.evAct === 'task') { N.madd.add(it.id); toast('Added to your tasks: ' + taskLine(it).replace(/ by today$/, '')); } else { N.mread.add(it.id); toast('Marked read.'); }
134
+ draw();
135
+ }
136
+ };
137
+ void o;
138
+ }
139
+ /** Still open on this item? For a page that redraws around the Viewer. */
140
+ export const isNewsOpen = () => { const c = vwCurrent(); return !!(c && c.id === 'news'); };
@@ -0,0 +1,203 @@
1
+ /* pm/cozy-search.js — Search (initiative premium-uncovered-features, E1; canvas EvSearch, and EvPhone on the right).
2
+ *
3
+ * One palette over the page: the query, the kind chips with their counts (All, Initiatives, Documents, Slides, Reports, Artifacts, Meetings)
4
+ * and the worktree picker ("main + 3 worktrees"); the results grouped (Initiatives · Documents, slides and reports · Artifacts and designs ·
5
+ * Meetings), and last "Ask Claude about …", which starts a chat in Home. ↑ ↓ move, ↵ opens, Esc closes. On a phone it is the whole screen.
6
+ * openSearch({ go?, q? }) go: the page's own opener ({ ini } | { ses } | { doc }), used before a page change
7
+ * closeSearch()
8
+ * It reads GET /api/find (the repository and every worktree: lib/search-index.js), GET /api/boards/backlog (the initiatives' stage) and
9
+ * GET /api/sessions. A result opens in the Viewer when it can: a document of main as its page (premium-vw-doc.js), a meeting as its card,
10
+ * any other file read-only from its worktree (GET /api/find/file). Nothing here writes. */
11
+ import { esc, svg, ICON, wsParam, wsQ, skelRows, cantRead, failedItem } from './cozy-evui.js';
12
+ const ARROW = { up: 'M12 19V5M6 11l6-6 6 6', down: 'M12 5v14M6 13l6 6 6-6', enter: 'M20 5v7a3 3 0 0 1-3 3H5M9 11l-4 4 4 4' }; // the footer's keys, drawn (R28-13: no glyph as a control)
13
+ import { SEARCH_KINDS, PHONE_KINDS, searchGroups, resultSub, resultTag, wtChip } from './cozy-evmodel.js';
14
+ import { open as vwOpen, current as vwCurrent } from './cozy-viewer.js';
15
+
16
+ const PHONE = 760;
17
+ const isPhone = () => innerWidth <= PHONE;
18
+ const S = { el: null, q: '', kind: 'all', at: 0, rows: [], res: null, busy: false, err: '', wt: null, wtOpen: false, back: null, go: null, seq: 0, boards: null, sessions: null, t: 0 };
19
+ const KIND_ICON = { initiative: ICON.flag, document: ICON.doc, slides: ICON.slides, report: ICON.report, artifact: ICON.design, file: ICON.file, meeting: ICON.meet, session: ICON.session };
20
+ async function getj(p) { try { const r = await fetch(p, { credentials: 'same-origin' }); const j = await r.json().catch(() => null); return j || { ok: false, error: 'the server did not answer' }; } catch { return { ok: false, error: 'the server did not answer' }; } }
21
+ const WT_KEY = 'pmos.search.wt';
22
+ const wtPick = () => { try { const v = JSON.parse(localStorage.getItem(WT_KEY) || 'null'); return Array.isArray(v) ? v : null; } catch { return null; } };
23
+
24
+ function mount() {
25
+ if (S.el && S.el.isConnected) return S.el;
26
+ const d = document.createElement('div');
27
+ d.innerHTML = '<div class="ev-sp-scrim" id="evSpScrim" hidden></div>'
28
+ + '<div class="ev-sp" id="evSearch" role="dialog" aria-modal="true" aria-label="Search" hidden>'
29
+ + `<div class="ev-sp-in">${svg(ICON.search, 20)}<label for="evQ" class="ev-vh">Search PMOS</label><input id="evQ" type="text" autocomplete="off" spellcheck="false" placeholder="Search initiatives, documents, slides, reports, artifacts and meetings" role="combobox" aria-expanded="true" aria-controls="evRes" aria-autocomplete="list"><span class="ev-kbd">Esc</span><button type="button" class="ev-ib x" data-ev="close" aria-label="Close search">${svg(ICON.close, 18)}</button></div>`
30
+ + '<div class="ev-sp-chips" id="evChips" role="group" aria-label="Kind"></div>'
31
+ + '<div class="ev-sp-list" id="evRes" role="listbox" aria-label="Results"></div>'
32
+ + `<div class="ev-sp-ft"><span><span class="ev-kbd" role="img" aria-label="Arrow up">${svg(ARROW.up, 12)}</span> <span class="ev-kbd" role="img" aria-label="Arrow down">${svg(ARROW.down, 12)}</span> move</span><span><span class="ev-kbd" role="img" aria-label="Enter">${svg(ARROW.enter, 12)}</span> open</span><span class="ev-r">Searches the repo and every worktree. Opens in the Viewer when it can.</span></div>`
33
+ + '</div>';
34
+ document.body.append(...d.childNodes);
35
+ S.el = document.getElementById('evSearch');
36
+ document.getElementById('evSpScrim').addEventListener('click', closeSearch);
37
+ const q = S.el.querySelector('#evQ');
38
+ q.addEventListener('input', () => { S.q = q.value; S.at = 0; schedule(); });
39
+ q.addEventListener('keydown', (e) => {
40
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') { e.preventDefault(); const n = S.rows.length; if (n) { S.at = (S.at + (e.key === 'ArrowDown' ? 1 : n - 1)) % n; drawList(); } }
41
+ else if (e.key === 'Enter') { e.preventDefault(); const r = S.rows[S.at]; if (r) go(r); }
42
+ });
43
+ S.el.addEventListener('keydown', (e) => { if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); if (S.wtOpen) { S.wtOpen = false; drawChips(); return; } closeSearch(); } });
44
+ S.el.addEventListener('click', (e) => {
45
+ const b = e.target.closest('button, input[type="checkbox"]'); if (!b) return;
46
+ if (b.dataset.ev === 'close') { closeSearch(); return; }
47
+ if (b.dataset.evKind) { S.kind = b.dataset.evKind; S.at = 0; draw(); q.focus(); return; }
48
+ if ('evWt' in b.dataset) { S.wtOpen = !S.wtOpen; drawChips(); return; }
49
+ if (b.dataset.evWtId) { const all = (S.res && S.res.worktrees || []).filter((w) => !w.main).map((w) => w.id); const cur = new Set(S.wt || all); if (b.checked) cur.add(b.dataset.evWtId); else cur.delete(b.dataset.evWtId); S.wt = [...cur]; try { localStorage.setItem(WT_KEY, JSON.stringify(S.wt)); } catch { /* no storage */ } run(); return; }
50
+ if (b.dataset.evI != null) { const r = S.rows[+b.dataset.evI]; if (r) go(r); }
51
+ });
52
+ return S.el;
53
+ }
54
+
55
+ export function openSearch(o = {}) {
56
+ const el = mount();
57
+ S.go = typeof o.go === 'function' ? o.go : null;
58
+ if (!el.hidden) { el.querySelector('#evQ').focus(); return el; }
59
+ const ae = document.activeElement; S.back = ae && ae !== document.body ? ae : null;
60
+ S.wt = wtPick(); S.wtOpen = false; S.kind = 'all'; S.at = 0;
61
+ if (o.q != null) S.q = String(o.q);
62
+ el.hidden = false; document.getElementById('evSpScrim').hidden = false; el.setAttribute('data-esc-layer', '');
63
+ const q = el.querySelector('#evQ'); q.value = S.q; q.focus(); q.select();
64
+ if (!S.boards) getj('/api/boards/backlog?limit=200' + wsQ('&')).then((b) => { S.boards = b && b.ok && Array.isArray(b.rows) ? b : { rows: [] }; draw(); });
65
+ if (!S.sessions) getj('/api/sessions').then((s) => { S.sessions = s && Array.isArray(s.sessions) ? s.sessions.filter((x) => !x.automatic && x.shown !== 'exited') : []; draw(); });
66
+ run();
67
+ return el;
68
+ }
69
+ export function closeSearch() {
70
+ if (!S.el || S.el.hidden) return;
71
+ S.el.hidden = true; document.getElementById('evSpScrim').hidden = true; S.el.removeAttribute('data-esc-layer');
72
+ const b = S.back; S.back = null; if (b && b.isConnected) { try { b.focus(); } catch { /* gone */ } }
73
+ }
74
+ export const isSearchOpen = () => !!(S.el && !S.el.hidden);
75
+
76
+ function schedule() { clearTimeout(S.t); S.t = setTimeout(run, 160); draw(); }
77
+ async function run() {
78
+ const q = S.q.trim(), my = ++S.seq;
79
+ if (q.length < 2) { S.res = S.res && { ...S.res, results: [], counts: {} }; S.busy = false; S.err = ''; draw(); if (!S.res) { const r = await getj('/api/find?q=' + wsQ('&')); if (my === S.seq && r.ok) { S.res = r; drawChips(); } } return; }
80
+ S.busy = true; S.err = ''; draw();
81
+ const wt = S.wt ? '&wt=' + encodeURIComponent(S.wt.join(',') || '-') : '';
82
+ const r = await getj('/api/find?q=' + encodeURIComponent(q) + wsQ('&') + wt);
83
+ if (my !== S.seq) return;
84
+ S.busy = false;
85
+ if (!r.ok) { S.err = r.error || 'the server did not answer'; draw(); return; }
86
+ S.res = r; draw();
87
+ }
88
+
89
+ /** Every row the palette shows for the query: the search's results, the board's initiatives and the sessions that match, each once. */
90
+ function allRows() {
91
+ const q = S.q.trim().toLowerCase();
92
+ if (q.length < 2 || !S.res) return [];
93
+ const res = (S.res.results || []).slice();
94
+ const B = (S.boards && S.boards.rows) || [];
95
+ const seen = new Set(res.filter((r) => r.kind === 'initiative').map((r) => r.id));
96
+ for (const r of res) if (r.kind === 'initiative') { const b = B.find((x) => x.id === r.id); if (b) Object.assign(r, { stage: b.stage, lane: r.lane || b.lane, days: b.days_in_stage || b.days || null, title: b.title || r.title, board: S.boards.board, bws: S.boards.ws }); }
97
+ for (const b of B) if (!seen.has(b.id) && (String(b.title || '') + ' ' + b.id).toLowerCase().includes(q)) res.unshift({ kind: 'initiative', group: 'initiative', id: b.id, title: b.title || b.id, lane: b.lane, stage: b.stage, days: b.days_in_stage || null, board: S.boards.board, bws: S.boards.ws, why: 'name' });
98
+ for (const s of S.sessions || []) if ((String(s.name || '') + ' ' + String((s.hx && s.hx.title) || '')).toLowerCase().includes(q)) res.push({ kind: 'session', group: 'meeting', id: s.id, title: (s.hx && s.hx.title) || s.name || s.id, where: s.cwd && s.cwd !== '.' ? s.cwd : '', state: s.state || '', why: 'name' });
99
+ return res;
100
+ }
101
+ const countsOf = (rows) => { const c = { all: rows.length }; for (const r of rows) { const k = r.group === 'session' ? 'meeting' : r.group || r.kind; c[k] = (c[k] || 0) + 1; } return c; };
102
+
103
+ function drawChips() {
104
+ const box = S.el && S.el.querySelector('#evChips'); if (!box) return;
105
+ const rows = allRows(), c = countsOf(rows), K = isPhone() ? PHONE_KINDS : SEARCH_KINDS, wts = (S.res && S.res.worktrees) || [];
106
+ const on = (w) => !S.wt || S.wt.includes(w.id);
107
+ const shown = wts.map((w) => ({ ...w, on: w.main || on(w) }));
108
+ box.innerHTML = K.map(([k, l]) => `<button type="button" class="ev-chip${S.kind === k ? ' on' : ''}" data-ev-kind="${k}" aria-pressed="${S.kind === k}">${esc(l)}${!isPhone() && S.q.trim().length >= 2 ? ' ' + (c[k] || 0) : ''}</button>`).join('')
109
+ + `<button type="button" class="ev-chip gh ev-wt" data-ev-wt aria-expanded="${S.wtOpen}" aria-haspopup="true" title="Which worktrees Search reads">${svg(ICON.branch, 14)}${esc(wtChip(shown))}</button>`
110
+ + `<div class="ev-wtm" role="group" aria-label="Worktrees"${S.wtOpen ? '' : ' hidden'}>${shown.map((w) => `<label><input type="checkbox" ${w.main ? 'checked disabled' : `data-ev-wt-id="${esc(w.id)}"${w.on ? ' checked' : ''}`}><span>${esc(w.main ? 'main' : w.name)}</span><small>${w.main ? 'always' : w.error ? esc(w.error) : esc(w.id)}</small></label>`).join('')}</div>`;
111
+ }
112
+ function rowHtml(r, i) {
113
+ const tag = resultTag(r), sub = resultSub(r);
114
+ const right = r.kind === 'document' && r.draft ? '<span class="ev-pill y">Draft</span>' : esc(tag);
115
+ const title = r.kind === 'initiative' ? `<b>${esc(r.title)}</b>` : esc(r.title);
116
+ const subHtml = r.draft ? esc(sub).replace(/^worktree (\S+)/, 'worktree <b>$1</b>') : esc(sub);
117
+ const two = isPhone() ? `<span class="ev-t">${title}${sub ? `<br><span class="ev-small ev-mut">${subHtml}</span>` : ''}</span>` : `<span class="ev-t">${title}${sub ? ` <span class="ev-mut">· ${subHtml}</span>` : ''}</span>`;
118
+ return `<button type="button" class="ev-mi${i === S.at ? ' hl' : ''}" role="option" id="evo${i}" data-ev-i="${i}" aria-selected="${i === S.at}">${svg(KIND_ICON[r.kind] || ICON.doc, 18)}${two}${right ? `<span class="ev-k">${right}</span>` : ''}</button>`;
119
+ }
120
+ function drawList() {
121
+ const box = S.el && S.el.querySelector('#evRes'); if (!box) return;
122
+ const q = S.q.trim();
123
+ let rows = allRows();
124
+ if (S.kind !== 'all') rows = rows.filter((r) => (S.kind === 'artifact' ? ['artifact', 'file'].includes(r.kind) : S.kind === 'meeting' ? ['meeting', 'session'].includes(r.kind) : r.kind === S.kind));
125
+ const groups = searchGroups(rows, { phone: isPhone() });
126
+ S.rows = groups.flatMap((g) => g.rows);
127
+ const ask = q.length >= 2 ? { kind: 'ask', title: q } : null;
128
+ if (ask) S.rows.push(ask);
129
+ S.at = Math.min(S.at, Math.max(0, S.rows.length - 1));
130
+ let h = '', i = 0;
131
+ if (q.length < 2) h = '<p class="ev-sp-empty">Type two letters or more. Search reads the initiatives, the documents, slides and reports, the artifacts and designs, and the meetings, in the repository and every worktree.</p>';
132
+ else if (S.err) h = cantRead({ what: 'Search', why: S.err, sources: false });
133
+ else if (S.busy && !groups.length) h = skelRows(3);
134
+ else if (!groups.length) h = `<p class="ev-sp-empty" role="status">Nothing matches “${esc(q)}”${S.kind !== 'all' ? ' in this kind' : ''}.</p>`;
135
+ groups.forEach((g, gi) => {
136
+ h += `<p class="ev-mlbl">${esc(g.label)}</p>` + g.rows.map((r) => rowHtml(r, i++)).join('');
137
+ if (gi === 0 && isPhone() && g.key === 'initiative') h += '<div class="ev-sp-chips ev-phchips" aria-hidden="true"></div>';
138
+ });
139
+ if (S.res && S.res.more && q.length >= 2) h += `<p class="ev-sp-empty">${S.res.more} more match. Pick a kind to see them.</p>`;
140
+ if (ask) h += `<div class="ev-hr" role="separator"></div><button type="button" class="ev-mi${i === S.at ? ' hl' : ''}" role="option" id="evo${i}" data-ev-i="${i}" aria-selected="${i === S.at}">${svg(ICON.chat, 18)}<span class="ev-t">Ask Claude about <b>“${esc(q)}”</b></span><span class="ev-k">Starts a chat in Home</span></button>`;
141
+ const chips = S.el.querySelector('#evChips');
142
+ if (chips && chips.parentNode !== S.el) S.el.insertBefore(chips, box); // home first, so the redraw below never drops it
143
+ box.innerHTML = h;
144
+ // the phone draws the kind chips after the Initiatives group (EvPhone)
145
+ const ph = box.querySelector('.ev-phchips');
146
+ if (ph && chips) ph.replaceWith(chips);
147
+ const r = box.querySelector('[data-ev-retry]'); if (r) r.onclick = () => run();
148
+ const a = box.querySelector('#evo' + S.at); if (a) { S.el.querySelector('#evQ').setAttribute('aria-activedescendant', a.id); a.scrollIntoView({ block: 'nearest' }); }
149
+ }
150
+ function draw() { if (!S.el || S.el.hidden) return; drawChips(); drawList(); }
151
+ addEventListener('resize', () => draw());
152
+
153
+ /* ── open a result ── */
154
+ const onHome = () => /^\/(?:premium(?:\.html)?|index\.html)?$/.test(location.pathname);
155
+ function homeUrl(params) { const q = new URLSearchParams(params); if (wsParam()) q.set('ws', wsParam()); return '/premium.html?' + q.toString(); }
156
+ function go(r) {
157
+ closeSearch();
158
+ if (r.kind === 'ask') { askClaude(r.title); return; }
159
+ if (r.kind === 'initiative') { if (S.go) { S.go({ ini: r.id }); return; } location.assign(homeUrl(r.board ? { ini: r.id, board: r.board } : { ini: r.id })); return; }
160
+ if (r.kind === 'session') { if (S.go) { S.go({ ses: r.id }); return; } location.assign(homeUrl({ session: r.id })); return; }
161
+ if (r.kind === 'meeting') { import('./premium-vw-open.js').then(() => window.czViews.openMeeting({ note: r.id }, { ws: wsParam() })).catch(() => openFileCard(r)); return; }
162
+ if (r.main && /\.md$/i.test(r.path)) {
163
+ import('./premium-vw-doc.js').then((M) => { if (!M.openDocPage({ path: r.path, title: r.title }, { ws: () => wsParam() })) openFileCard(r); }).catch(() => openFileCard(r));
164
+ return;
165
+ }
166
+ openFileCard(r);
167
+ }
168
+ /** "Ask Claude about …" starts a chat in Home: the question is put in Home's box, not sent. */
169
+ function askClaude(q) {
170
+ const text = 'Tell me about “' + q + '” in this product.';
171
+ const box = onHome() && document.getElementById('hmIn');
172
+ if (box) { box.value = text; box.dispatchEvent(new Event('input', { bubbles: true })); box.focus(); return; }
173
+ location.assign(homeUrl({ say: text }));
174
+ }
175
+
176
+ /** A file read-only from its worktree, in the Viewer: Markdown as text, HTML as a still picture (no scripts), anything else as text. */
177
+ export function openFileCard(r) {
178
+ const kind = { document: 'Document', slides: 'Slides', report: 'Report', artifact: 'Artifact', file: 'File' }[r.kind] || 'File';
179
+ const where = r.main ? 'main' : 'worktree ' + (r.branch || r.wt);
180
+ const vid = 'search:' + (r.wt || 'main') + ':' + r.path;
181
+ const body = vwOpen({ id: vid, kind: kind + ' · ' + where, title: r.title || r.path, icon: r.kind === 'slides' ? 'slides' : r.kind === 'report' ? 'report' : 'doc', render: (b) => { b.classList.add('ev-card-b'); b.innerHTML = skelRows(3); } });
182
+ const load = async () => {
183
+ const f = await getj('/api/find/file?wt=' + encodeURIComponent(r.wt || 'main') + '&path=' + encodeURIComponent(r.path) + wsQ('&'));
184
+ if (!body.isConnected || !vwCurrent() || vwCurrent().id !== vid) return; // the Viewer moved on: a late read draws nothing
185
+ if (!f.ok) {
186
+ body.innerHTML = `<h2 class="ev-h2">${esc(r.title || r.path)}</h2>` + failedItem({ what: 'This ' + kind.toLowerCase(), why: f.error, find: (r.path || '').split('/').pop().replace(/\.[^.]+$/, '') });
187
+ body.querySelector('[data-ev-retry]').onclick = () => { body.innerHTML = skelRows(3); load(); };
188
+ const fi = body.querySelector('[data-ev-find]'); if (fi) fi.onclick = () => openSearch({ q: fi.dataset.evFind });
189
+ return;
190
+ }
191
+ const head = `<p class="ev-lbl">${esc(f.path)} · ${esc(f.main ? 'main' : 'worktree ' + (f.branch || f.wt))}${f.main ? '' : ' · not merged'}</p>`;
192
+ if (/\.html?$/i.test(f.path)) {
193
+ body.innerHTML = head + '<iframe class="ev-frame" sandbox="" referrerpolicy="no-referrer" title="' + esc(r.title || f.path) + '"></iframe><p class="ev-small ev-mut">A still picture of the page: its scripts do not run here.</p>';
194
+ body.querySelector('iframe').srcdoc = f.text;
195
+ } else if (/\.(md|mdx|txt)$/i.test(f.path)) {
196
+ body.innerHTML = head + '<div class="ev-md"></div>';
197
+ try { const M = await import('./cozy-md.js'); const box = body.querySelector('.ev-md'); box.append(...M.toDom(M.parseMd(f.text.replace(/^---\n[\s\S]*?\n---\n/, '')), document)); }
198
+ catch { body.querySelector('.ev-md').outerHTML = `<pre class="ev-pre">${esc(f.text)}</pre>`; }
199
+ } else body.innerHTML = head + `<pre class="ev-pre">${esc(f.text)}</pre>`;
200
+ };
201
+ load();
202
+ return body;
203
+ }