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
@@ -0,0 +1,466 @@
1
+ /* pm/home-ini.js — an initiative's layout inside Home, as the canvas draws it (initiative premium-uncovered-features, Initiative; artboards InStage,
2
+ * InTasks, InDocs, InPhone). The pure half is home-ini-model.js.
3
+ *
4
+ * mountIni(ctx) once, from home-app.js. ctx: { S, VW, pmGet, pmPost, toast, load, openFile, iniTitle, drawList, wait }
5
+ * iniList(sc) after each draw of the list column: the stage move in the initiative's card, the Tasks group and the Core documents group
6
+ * iniOverview(v) the initiative in the Viewer: Tasks (the default), Documents or Stage. true when it opened.
7
+ *
8
+ * The stage move (InStage): the card shows "Moves on by itself when all N are done" (a switch, on by default, kept in file mode) and Move to <next>
9
+ * with Back beside it. Move with items still open asks first (Move anyway, with a note); Back always asks for a reason. Both go to POST /api/boards/move
10
+ * with the note or reason as the move's why. When every exit item is done and the switch is on, the page moves the stage by itself, never into a
11
+ * milestone (Deliver, Evaluate), and says so in a toast with Undo; Undo moves it back and keeps it from moving out of that stage by itself again.
12
+ * Tasks (InTasks): grouped by stage, by groups the PM names (drag a task between them; group sets are saved for the workspace), by owner, by status
13
+ * or not at all. Core documents (InDocs): the list column shows only the documents that need a look; the Viewer lists them all with their details.
14
+ * Every write is the PM's press, file mode only: /api/boards/move, /api/boards/tasks/*, /api/lifecycle, /api/core-docs/draft, /api/initiative-layout. */
15
+ import * as MD from './home-ini-model.js';
16
+
17
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
18
+ const SVG = (d, w = 16, sw = 1.8) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
19
+ const I = {
20
+ next: 'M5 12h14M13 6l6 6-6 6', back: 'M9 14L4 9l5-5M4 9h10a6 6 0 0 1 0 12h-3', plus: 'M12 5v14M5 12h14', down: 'M7 10l5 5 5-5', right: 'M10 7l5 5-5 5',
21
+ more: 'M5 12h.01M12 12h.01M19 12h.01', check: 'M5 12l5 5 9-10', list: 'M9 6h11M9 12h11M9 18h11M4.5 6h.01M4.5 12h.01M4.5 18h.01', doc: 'M7 3h7l5 5v13H7zM14 3v5h5',
22
+ };
23
+ const PHONE = 760;
24
+ const isPhone = () => innerWidth <= PHONE;
25
+ const X = { ctx: null, L: new Map(), reading: new Set(), tried: new Set(), view: 'tasks', doc: { by: 'stage', filter: 'all', more: new Set() }, shut: new Set(), pop: null, toastT: 0, addTo: '' };
26
+
27
+ /* ── reading the layout record ── */
28
+ const curM = () => { const S = X.ctx && X.ctx.S; return S && S.ini && S.ini !== 'product' && S.IMid === S.ini ? S.IM : null; };
29
+ const wsOf = (M) => (M && M.board && M.board.ws) || undefined;
30
+ const bw = (M) => ({ ws: M.board.ws, board: M.board.id });
31
+ async function readL(id, M, force) {
32
+ if (!force && (X.L.has(id) || X.reading.has(id))) return;
33
+ X.reading.add(id);
34
+ const r = await X.ctx.pmGet('/api/initiative-layout?initiative=' + encodeURIComponent(id) + (wsOf(M) ? '&ws=' + encodeURIComponent(wsOf(M)) : ''));
35
+ X.reading.delete(id);
36
+ X.L.set(id, r && r.ok ? { ...r, read: true } : { auto: true, held: [], by: 'stage', names: [], of: {}, stage: {}, sets: [], read: false });
37
+ X.ctx.drawList(); redrawView();
38
+ }
39
+ const Lof = (id) => X.L.get(id) || { auto: true, held: [], by: 'stage', names: [], of: {}, stage: {}, sets: [], read: false };
40
+ async function press(id, M, body) {
41
+ const r = await X.ctx.pmPost('/api/initiative-layout', { ws: wsOf(M), initiative: id, ...body });
42
+ if (r && r.ok) { X.L.set(id, { ...r, read: true }); X.ctx.drawList(); redrawView(); return true; }
43
+ X.ctx.toast((r && r.error) || 'Nothing was changed.');
44
+ return false;
45
+ }
46
+
47
+ /* ── the stage move in the card (InStage) ── */
48
+ function moveHtml(id, M, mv) {
49
+ if (mv.why) return `<div class="hi-mv" data-hi-mv><p class="hi-why">${esc(mv.why)}</p></div>`;
50
+ return `<div class="hi-mv" data-hi-mv>`
51
+ + `<div class="hi-swl"><button type="button" class="hi-sw" role="switch" aria-checked="${mv.auto}" data-hi-auto aria-label="Moves on by itself">${''}</button><span>${esc(mv.swText)}</span></div>`
52
+ + (mv.msNote ? `<p class="hi-note">${mv.ready ? '<b>Ready to move.</b> ' : ''}${esc(mv.msNote)}</p>` : mv.held && mv.auto ? `<p class="hi-note">You undid a move by itself out of ${esc(mv.cur)}, so it waits for you here.</p>` : '')
53
+ + `<div class="hi-mvb"><button type="button" class="hi-btn sm dark" data-hi-move aria-haspopup="dialog" aria-expanded="${!!(X.pop && X.pop.kind === 'move')}">Move to ${mv.ms ? '<i class="cz-ms" aria-hidden="true"></i>' : ''}${esc(mv.next)}${SVG(I.next, 14)}</button>`
54
+ + (mv.canBack ? `<button type="button" class="hi-ib" data-hi-back aria-haspopup="dialog" aria-label="Move back a stage, to ${esc(mv.prev)}" title="Move back to ${esc(mv.prev)}">${SVG(I.back, 16)}</button>` : '') + '</div></div>';
55
+ }
56
+ function mvOf(id, M) { return MD.moveModel(X.ctx.S.H || null, M, Lof(id), Date.now()); }
57
+
58
+ async function doMove(id, M, to, why, o = {}) {
59
+ const from = M.acts.stage;
60
+ const r = await X.ctx.pmPost('/api/boards/move', { ...bw(M), id, to, why });
61
+ if (!r || r.ok === false) { X.ctx.toast((r && r.error) || 'The stage did not move.'); return false; }
62
+ const title = X.ctx.iniTitle(id);
63
+ if (o.undo) { X.ctx.toast(title + ' is back in ' + to + '.'); }
64
+ else undoToast(title + ' ' + (o.auto ? MD.moveModel(X.ctx.S.H, M, Lof(id)).toast(true) : 'moved to ' + to), async () => {
65
+ const ok = await doMove(id, { ...M, acts: { ...M.acts, stage: to } }, from, MD.whyOf('undo'), { undo: true });
66
+ if (ok && o.auto) await press(id, M, { kind: 'hold', stage: from });
67
+ });
68
+ await X.ctx.load();
69
+ return true;
70
+ }
71
+ function undoToast(text, undo) {
72
+ let el = document.getElementById('hiToast');
73
+ if (!el) { el = document.createElement('div'); el.id = 'hiToast'; el.className = 'hi-toast'; el.setAttribute('role', 'status'); el.setAttribute('aria-live', 'polite'); document.body.appendChild(el); }
74
+ el.innerHTML = `<span>${esc(text)}</span><button type="button" data-hi-undo>Undo</button>`;
75
+ el.hidden = false; el.classList.add('on');
76
+ el.querySelector('[data-hi-undo]').onclick = () => { hide(); undo(); };
77
+ const hide = () => { el.classList.remove('on'); el.hidden = true; };
78
+ clearTimeout(X.toastT); X.toastT = setTimeout(hide, 9000);
79
+ }
80
+ function autoCheck(id, M, mv) {
81
+ const L = Lof(id);
82
+ if (!L.read || !mv.autoReady) return;
83
+ const k = id; // at most one move by itself per initiative while the page is open: a chain of moves would read as drift
84
+ if (X.tried.has(k)) return;
85
+ X.tried.add(k);
86
+ doMove(id, M, mv.next, MD.whyOf('auto'), { auto: true });
87
+ }
88
+
89
+ /* ── the popovers: Move anyway, Back, and the small menus ── */
90
+ function closePop() {
91
+ if (!X.pop) return;
92
+ const a = X.pop.anchor; X.pop.el.remove(); if (X.pop.scrim) X.pop.scrim.remove(); X.pop = null;
93
+ if (a && a.isConnected) { a.setAttribute('aria-expanded', 'false'); try { a.focus(); } catch { /* gone */ } }
94
+ }
95
+ function openPop(anchor, kind, html, onClick, o = {}) {
96
+ closePop();
97
+ const el = document.createElement('div');
98
+ const sheet = isPhone() && !o.menu;
99
+ el.className = 'cz hi-pop' + (sheet ? ' sheet' : '') + (o.menu ? ' menu' : '');
100
+ el.setAttribute('role', o.menu ? 'menu' : 'dialog'); el.setAttribute('aria-label', o.label || ''); el.setAttribute('data-esc-layer', '');
101
+ el.innerHTML = (sheet ? '<div class="hi-grab" aria-hidden="true"></div>' : '') + html;
102
+ let scrim = null;
103
+ if (sheet) { scrim = document.createElement('div'); scrim.className = 'hi-scrim'; scrim.onclick = closePop; document.body.appendChild(scrim); }
104
+ document.body.appendChild(el);
105
+ if (!sheet) { // under the button that opened it, kept inside the window: run-time geometry, set as two custom properties
106
+ const r = anchor.getBoundingClientRect(), w = el.offsetWidth, hh = el.offsetHeight;
107
+ const col = !o.menu && anchor.closest('#hmList'); // a dialog from the list column opens beside the column (InStage), not over it
108
+ let x, y;
109
+ if (col) { const c = col.getBoundingClientRect(); x = c.right + 12; y = Math.min(innerHeight - hh - 12, Math.max(12, r.top - 60)); }
110
+ else { x = r.left + w > innerWidth - 12 ? r.right - w : r.left; y = r.bottom + 8 + hh > innerHeight - 12 ? r.top - hh - 8 : r.bottom + 8; }
111
+ x = Math.max(12, Math.min(innerWidth - w - 12, x)); y = Math.max(12, y);
112
+ el.style.setProperty('--hi-x', Math.round(x) + 'px'); el.style.setProperty('--hi-y', Math.round(y) + 'px');
113
+ }
114
+ anchor.setAttribute('aria-expanded', 'true');
115
+ X.pop = { el, scrim, anchor, kind };
116
+ el.addEventListener('click', (e) => { const b = e.target.closest('button'); if (b && !b.disabled) onClick(b, el); });
117
+ el.addEventListener('keydown', (e) => { if (e.key === 'Escape') { e.stopPropagation(); e.preventDefault(); closePop(); } });
118
+ const f = el.querySelector((sheet && o.sheetFocus) || o.focus || 'input, textarea, button:not([disabled])'); if (f) setTimeout(() => f.focus(), 0);
119
+ return el;
120
+ }
121
+ // Escape closes the popover first: on window in the capture phase, so Home's own Escape (the phone's list sheet, the Viewer) waits for the next press
122
+ if (typeof window !== 'undefined' && typeof window.addEventListener === 'function') window.addEventListener('keydown', (e) => { if (e.key === 'Escape' && X.pop) { e.stopPropagation(); e.preventDefault(); closePop(); } }, true);
123
+ if (typeof document !== 'undefined') document.addEventListener('mousedown', (e) => { if (X.pop && !X.pop.el.contains(e.target) && !(X.pop.anchor && X.pop.anchor.contains(e.target)) && !(X.pop.scrim && X.pop.scrim === e.target)) closePop(); }, true);
124
+
125
+ function popMove(anchor, id, M, mv) {
126
+ const title = X.ctx.iniTitle(id);
127
+ const ck = mv.items.map((x) => `<span class="hi-ck${x.done ? ' on' : ''}"><i aria-hidden="true">${x.done ? SVG(I.check, 10, 3.5) : ''}</i>${esc(x.label)}</span>`).join('');
128
+ openPop(anchor, 'move', `<p class="hi-h3">Move ${esc(title)} to ${esc(mv.next)}?</p><div class="hi-cks">${ck}</div>`
129
+ + `<div class="hi-warn"><b>${esc(mv.openHead)}</b> ${esc(mv.openList)} ${mv.open.length === 1 ? 'It stays' : 'They stay'} open on ${esc(mv.cur)} until ${mv.open.length === 1 ? 'it is' : 'they are'} done.</div>`
130
+ + `<label class="hi-field"><span>Note <em>· optional, kept with the move</em></span><input id="hiNote" maxlength="400" autocomplete="off"></label>`
131
+ + `<div class="hi-acts"><button type="button" class="hi-btn dark" data-hi-go>Move anyway</button><button type="button" class="hi-btn ghost" data-hi-x>Not yet</button></div>`,
132
+ async (b, el) => {
133
+ if ('hiX' in b.dataset) { closePop(); return; }
134
+ if ('hiGo' in b.dataset) { b.disabled = true; const note = el.querySelector('#hiNote').value; closePop(); await doMove(id, M, mv.next, MD.whyOf('move', '', note)); }
135
+ }, { label: 'Move ' + title + ' to ' + mv.next, sheetFocus: '[data-hi-go]' });
136
+ }
137
+ function popBack(anchor, id, M, mv) {
138
+ const title = X.ctx.iniTitle(id);
139
+ let chip = '';
140
+ const el = openPop(anchor, 'back', `<p class="hi-lbl">Back a stage</p><p class="hi-h3">Move ${esc(title)} back to ${esc(mv.prev)}?</p><p class="hi-small">${esc(mv.cur)} keeps what was done.</p>`
141
+ + `<div class="hi-chips" role="group" aria-label="Why it goes back">${MD.BACK_REASONS.map((r) => `<button type="button" class="cz-chip" aria-pressed="false" data-hi-why="${esc(r)}">${esc(r)}</button>`).join('')}</div>`
142
+ + `<label class="hi-field"><span class="hi-vh">What changed</span><textarea id="hiWhy" rows="2" maxlength="400" placeholder="What changed"></textarea></label>`
143
+ + `<div class="hi-acts"><button type="button" class="hi-btn dark" data-hi-go disabled>Move back</button><button type="button" class="hi-btn ghost" data-hi-x>Cancel</button></div>`,
144
+ async (b, pel) => {
145
+ if ('hiX' in b.dataset) { closePop(); return; }
146
+ if (b.dataset.hiWhy) { chip = b.dataset.hiWhy; pel.querySelectorAll('[data-hi-why]').forEach((c) => { c.setAttribute('aria-pressed', String(c === b)); c.classList.toggle('on', c === b); }); sync(); return; }
147
+ if ('hiGo' in b.dataset) { const t = pel.querySelector('#hiWhy').value; closePop(); await doMove(id, M, mv.prev, MD.whyOf('back', chip, t)); }
148
+ }, { label: 'Move ' + title + ' back to ' + mv.prev, focus: '[data-hi-why]' });
149
+ const sync = () => { el.querySelector('[data-hi-go]').disabled = !MD.backReady(chip, el.querySelector('#hiWhy').value); };
150
+ el.querySelector('#hiWhy').addEventListener('input', sync);
151
+ }
152
+ /** A small menu: items [{ label, sub?, on?, go }] with optional labels { head: 'Group by' } between them. */
153
+ function menu(anchor, items, label) {
154
+ openPop(anchor, 'menu', items.map((x, i) => (x.head ? `<p class="hi-mlbl">${esc(x.head)}</p>` : x.hr ? '<div class="hi-hr"></div>'
155
+ : `<button type="button" class="hi-mi${x.on ? ' on' : ''}" role="${x.radio ? 'menuitemradio' : 'menuitem'}"${x.radio ? ` aria-checked="${!!x.on}"` : ''} data-hi-mi="${i}"${x.disabled ? ' disabled' : ''}>${x.icon ? SVG(x.icon, 16) : ''}<span>${esc(x.label)}</span>${x.sub ? `<em>${esc(x.sub)}</em>` : ''}</button>`)).join(''),
156
+ (b) => { const it = items[+b.dataset.hiMi]; closePop(); if (it && it.go) it.go(anchor); }, { menu: true, label });
157
+ }
158
+ function ask(anchor, label, value, go) { // one line of words, inline (no browser prompt)
159
+ openPop(anchor, 'ask', `<label class="hi-field"><span>${esc(label)}</span><input id="hiAsk" maxlength="40" autocomplete="off" value="${esc(value || '')}"></label><div class="hi-acts"><button type="button" class="hi-btn dark" data-hi-go>Save</button><button type="button" class="hi-btn ghost" data-hi-x>Cancel</button></div>`,
160
+ (b, el) => { if ('hiX' in b.dataset) { closePop(); return; } if ('hiGo' in b.dataset) { const v = el.querySelector('#hiAsk').value.trim(); if (!v) return; closePop(); go(v); } }, { label });
161
+ const i = X.pop.el.querySelector('#hiAsk');
162
+ i.addEventListener('keydown', (e) => { if (e.key === 'Enter') { e.preventDefault(); const v = i.value.trim(); if (v) { closePop(); go(v); } } });
163
+ }
164
+
165
+ /* ── the list column (InTasks, InDocs) ── */
166
+ function tasksGroupHtml(id, M, L) {
167
+ const rows = MD.taskRows(M, L);
168
+ const T = MD.listTasks(rows);
169
+ const shut = X.shut.has('tasks');
170
+ const row = (t) => `<div class="hm-r hi-r" data-id="hi:${esc(t.key)}">`
171
+ + (t.canCheck ? `<button type="button" class="hi-chk" data-hi-chk="${esc(t.key)}" aria-pressed="false" aria-label="Mark ${esc(t.title)} done"></button>` : '<span class="hi-chk off" aria-hidden="true"></span>')
172
+ + `<button type="button" class="hm-rm" data-hi-task="${esc(t.key)}"><span class="hm-rt"><b>${esc(t.title)}</b><em class="${t.late ? 'late' : 'q'}">${esc([t.owner || (t.jira ? 'Jira' : ''), t.due].filter(Boolean).join(' · ') || t.state)}</em></span></button></div>`;
173
+ return `<section class="hm-g hi-g" data-hi="tasks" aria-label="Tasks"><div class="hm-ghr"><button type="button" class="hm-gh" data-hi-fold="tasks" aria-expanded="${!shut}">${SVG(shut ? I.right : I.down, 12, 2.2)}<span>Tasks</span><span class="hi-n">${T.open ? T.open + ' open' : rows.length ? 'all done' : 'none'}</span></button>`
174
+ + `<button type="button" class="hm-gadd" data-hi-addtask aria-label="Add a task to ${esc(X.ctx.iniTitle(id))}" title="Add a task">${SVG(I.plus, 14, 2.2)}</button></div>`
175
+ + (shut ? '' : T.top.map(row).join('')
176
+ + `<div class="hm-r hi-r"><button type="button" class="hm-rm" data-hi-open="tasks"><span class="hm-tile hi-sq">${SVG(I.list, 14)}</span><span class="hm-rt"><b>All tasks</b><em class="q">${esc(T.sub || 'No task yet')}</em></span></button></div>`)
177
+ + '</section>';
178
+ }
179
+ function docsGroupHtml(M) {
180
+ const rows = MD.docRows(M);
181
+ if (!rows.length && (!M.docs || M.docs.missing)) return '';
182
+ const look = rows.filter((d) => d.look);
183
+ const shut = X.shut.has('docs');
184
+ const row = (d) => `<div class="hm-r hi-r"><button type="button" class="hm-rm" data-hi-doc="${esc(d.key)}"><i class="hm-dot hi-risk" aria-hidden="true"></i><span class="hm-tile">${SVG(I.doc, 14)}</span><span class="hm-rt"><b>${esc(d.title)}</b><em class="risk">${esc(MD.docPill(d)[0] + (d.when ? ' · ' + d.when : ''))}</em></span></button></div>`;
185
+ return `<section class="hm-g hi-g" data-hi="docs" aria-label="Core documents"><div class="hm-ghr"><button type="button" class="hm-gh" data-hi-fold="docs" aria-expanded="${!shut}">${SVG(shut ? I.right : I.down, 12, 2.2)}<span>Core documents</span><span class="hi-n">${rows.length}</span></button></div>`
186
+ + (shut ? '' : look.map(row).join('')
187
+ + `<div class="hm-r hi-r"><button type="button" class="hm-rm" data-hi-open="docs"><span class="hm-tile hi-sq">${SVG(I.list, 14)}</span><span class="hm-rt"><b>All ${rows.length} ${rows.length === 1 ? 'document' : 'documents'}</b><em class="q">${look.length ? look.length + ' need a look · opens the list in the Viewer' : 'Opens the list in the Viewer'}</em></span></button></div>`)
188
+ + '</section>';
189
+ }
190
+ /** Put html in the list once per change: a node marked data-hi=<key>, placed by where(). Nothing is redrawn when the html is the same. */
191
+ function put(sc, key, html, where) {
192
+ let n = sc.querySelector(`:scope [data-hi-slot="${key}"]`);
193
+ if (!html) { if (n) n.remove(); return; }
194
+ if (!n) { n = document.createElement('div'); n.dataset.hiSlot = key; n.className = 'hi-slot'; }
195
+ if (n.__h !== html) { n.__h = html; n.innerHTML = html; }
196
+ where(n);
197
+ }
198
+ export function iniList(sc) {
199
+ if (!X.ctx || !sc) return;
200
+ const S = X.ctx.S, M = curM();
201
+ if (!M) { sc.querySelectorAll('[data-hi-slot]').forEach((n) => n.remove()); return; }
202
+ const id = S.ini;
203
+ readL(id, M);
204
+ const L = Lof(id), mv = mvOf(id, M);
205
+ const box = sc.querySelector('.hm-card .hm-box');
206
+ if (box) put(box, 'mv', mv.cur ? moveHtml(id, M, mv) : '', (n) => { const a = box.querySelector(':scope > .hm-acts'); if (n.nextElementSibling !== a) box.insertBefore(n, a); });
207
+ const card = sc.querySelector(':scope > .hm-card');
208
+ put(sc, 'tasks', tasksGroupHtml(id, M, L), (n) => { const after = card || null; if (after ? after.nextElementSibling !== n : sc.firstElementChild !== n) { if (after) after.after(n); else sc.prepend(n); } });
209
+ // the Files group listed the same documents: Core documents takes its place (InDocs), the documents that need a look and "All N documents"
210
+ const files = sc.querySelector(':scope > section.hm-g[aria-label="Files"]');
211
+ if (files) files.hidden = true;
212
+ put(sc, 'docs', docsGroupHtml(M), (n) => { const gs = [...sc.querySelectorAll(':scope > section.hm-g:not([hidden])')]; const last = gs[gs.length - 1]; if (last && last.nextElementSibling !== n) last.after(n); else if (!last && n.parentNode !== sc) sc.append(n); });
213
+ autoCheck(id, M, mv);
214
+ }
215
+
216
+ /* ── the Viewer: Tasks, Documents, Stage ── */
217
+ const KIND = { tasks: 'Tasks', docs: 'Documents', stage: 'Stage' };
218
+ const ICON = { tasks: 'list', docs: 'doc', stage: 'goal' };
219
+ let BODY = null;
220
+ function segHtml(v) { return `<div class="cz-seg hi-seg" role="group" aria-label="Show">${Object.entries(KIND).map(([k, l]) => `<button type="button" data-hi-view="${k}" aria-pressed="${k === v}">${l}</button>`).join('')}</div>`; }
221
+ function taskRowHtml(t, mine, stages) {
222
+ const pill = t.stage ? `<button type="button" class="hi-pill" data-hi-tstage="${esc(t.key)}" aria-label="Stage: ${esc(t.stage)}. Change">${esc(t.stage)}</button>` : `<button type="button" class="hi-pill dash" data-hi-tstage="${esc(t.key)}">Set stage</button>`;
223
+ return `<div class="hi-trow${t.done ? ' done' : ''}" data-ov-tkrow="${esc(t.key)}"${mine ? ` draggable="true" data-hi-drag="${esc(t.key)}"` : ''}>`
224
+ + (t.canCheck ? `<button type="button" class="hi-chk${t.done ? ' on' : ''}" data-hi-chk="${esc(t.key)}" aria-pressed="${t.done}" aria-label="${t.done ? 'Reopen' : 'Mark done'}: ${esc(t.title)}">${t.done ? SVG(I.check, 12, 3) : ''}</button>` : `<span class="hi-chk off${t.done ? ' on' : ''}" aria-hidden="true" title="${t.jira ? 'Jira keeps its state' : 'A PRD requirement has no state'}">${t.done ? SVG(I.check, 12, 3) : ''}</span>`)
225
+ + `<button type="button" class="hi-tt" data-ov-tk="${esc(t.key)}" aria-label="Open ${esc(t.title)}">${esc(t.title)}${t.jira && t.ref ? ` <em>${esc(t.ref)}</em>` : ''}</button>`
226
+ + pill + (t.av ? `<span class="hi-av" title="${esc(t.owner)}">${esc(t.av)}</span>` : '') + `<span class="hi-due${t.late ? ' late' : ''}">${esc(t.due || (t.req ? 'PRD' : t.state === 'In progress' ? 'running' : ''))}</span>`
227
+ + `<button type="button" class="hi-ib sm" data-hi-tmore="${esc(t.key)}" aria-haspopup="menu" aria-label="More for ${esc(t.title)}">${SVG(I.more, 14, 3)}</button></div>`;
228
+ }
229
+ function tasksView(id, M) {
230
+ const L = Lof(id), by = L.by || 'stage', rows = MD.taskRows(M, L), stages = (M.acts && M.acts.stages) || [];
231
+ const G = MD.taskGroups(rows, L, by, stages);
232
+ const mine = by === 'mine';
233
+ const target = mine ? (L.names.includes(X.addTo) ? X.addTo : L.names[0] || '') : by === 'stage' ? M.acts.stage || '' : '';
234
+ const groups = G.map((g) => {
235
+ const shut = X.shut.has('vt:' + g.key);
236
+ const head = g.title == null ? '' : `<div class="hi-gh"><button type="button" class="hi-ghb" data-hi-vfold="${esc(g.key)}" aria-expanded="${!shut}">${SVG(shut ? I.right : I.down, 14, 2)}<b>${esc(g.title)}</b><span>${g.open} open</span></button>`
237
+ + (g.mine ? `<button type="button" class="hi-ib sm" data-hi-gmore="${esc(g.title)}" aria-haspopup="menu" aria-label="More for ${esc(g.title)}">${SVG(I.more, 14, 3)}</button>` : '') + '</div>';
238
+ return `<section class="hi-tg" data-hi-drop="${esc(g.mine ? g.title : g.loose ? '' : '')}"${mine ? ' data-hi-dz' : ''} aria-label="${esc(g.title || 'Tasks')}">${head}${shut ? '' : g.rows.map((t) => taskRowHtml(t, mine, stages)).join('') || '<p class="hi-empty">Drag a task here.</p>'}</section>`;
239
+ }).join('');
240
+ const note = mine ? 'You name the groups. Drag a task between groups. The stage still shows on each task, so grouping never hides where it sits.'
241
+ : by === 'stage' ? 'A task keeps the stage you give it. Jira tickets and PRD requirements count for Build.' : '';
242
+ return `<div class="hi-vh2"><h2>Tasks</h2><button type="button" class="cz-pick hi-pick" data-hi-by aria-haspopup="menu" aria-expanded="false">Group: ${esc(MD.BY_LABEL[by])}${SVG(I.down, 14)}</button>`
243
+ + `<button type="button" class="hi-ib solid" data-hi-focusadd aria-label="Add a task">${SVG(I.plus, 16)}</button></div>`
244
+ + (rows.length ? groups : `<p class="hi-empty">${esc((M.tasks && M.tasks.note) || 'No task yet.')} Add one below.</p>`)
245
+ + (mine ? `<button type="button" class="hi-btn sm ghost hi-self" data-hi-newgroup>${SVG(I.plus, 14)}New group</button>` : '')
246
+ + (note ? `<p class="hi-small">${esc(note)}</p>` : '')
247
+ + `<div class="hi-add"><label for="ovTask" class="hi-vh">Add a task</label><input id="ovTask" maxlength="200" autocomplete="off" placeholder="Add a task${target ? ' to ' + esc(target) : ''}" data-hi-target="${esc(target)}"><button type="button" class="hi-ib sm" data-ov-add aria-label="Add the task">${SVG(I.next, 14)}</button></div>`
248
+ + `<div class="hi-foot"><button type="button" class="hi-btn sm ghost" data-ov-record>Open the full record</button>${M.board && M.board.id ? '<button type="button" class="hi-btn sm ghost" data-ov-sprint>Sprint</button>' : ''}</div>`;
249
+ }
250
+ function docRowHtml(d, cur, later) {
251
+ if (later) return `<div class="hi-drow later" data-ov-doc="${esc(d.key)}"><span class="hi-dic dash">${SVG(I.doc, 16)}</span><span class="hi-dt">${esc(d.title)} · comes in ${esc(d.phase)}</span>${d.act && d.act.kind === 'draft' && !d.running ? `<button type="button" class="hi-btn sm ghost" data-ov-draft="${esc(d.key)}">Draft it now</button>` : ''}</div>`;
252
+ const [pt, pc] = MD.docPill(d, cur);
253
+ // a document with no file yet is never a dead press: it says what happens to it (data-ov-none), and offers the draft when PMOS can write it
254
+ const open = d.path && d.st === 'draft' && d.slot ? `data-ov-dread="${esc(d.key)}"` : d.path ? `data-ov-open="${esc(d.path)}" data-ov-name="${esc(d.title)}"` : `data-ov-none="${esc(d.key)}"`;
255
+ const meta = [d.when, d.by, d.link ? d.link.kind : ''].filter(Boolean).join(' · ') || d.what;
256
+ return `<div class="hi-drow${d.look ? ' look' : ''}" data-ov-doc="${esc(d.key)}">`
257
+ + `<button type="button" class="hi-dmain" ${open} aria-label="${d.path ? 'Open ' : ''}${esc(d.title)}"><span class="hi-dic">${SVG(I.doc, 16)}</span><span class="hi-dtx"><b>${esc(d.title)}</b> <span class="hi-k">· ${esc(d.kind)}${d.core ? ' · core' : ''}</span><em>${esc(meta)}</em>${d.link ? `<small>${esc(d.link.kind + ': ' + d.link.url)}</small>` : ''}</span></button>`
258
+ + (d.act && d.act.kind === 'draft' && !d.running && d.st === 'missing' ? `<button type="button" class="hi-btn sm" data-ov-draft="${esc(d.key)}">Draft it</button>` : `<span class="hi-pill ${pc}">${esc(pt)}</span>`) + '</div>';
259
+ }
260
+ function docsView(id, M) {
261
+ const rows = MD.docRows(M), cur = MD.phaseOf(M.acts && M.acts.stage);
262
+ if (!rows.length) return `<div class="hi-vh2"><h2>No documents</h2><button type="button" class="hi-ib" data-ov-adddoc aria-label="Add a document" title="Add a document">${SVG(I.plus, 16)}</button></div><p class="hi-empty">${M.docs && M.docs.missing ? 'The core documents could not be read.' : 'This initiative has no core document yet.'}</p>`;
263
+ const chips = MD.docChips(rows), G = MD.docGroups(rows, M.acts && M.acts.stage, X.doc);
264
+ const groups = G.map((g) => {
265
+ const fold = g.fold && !X.doc.more.has(g.key) && g.rows.length > g.fold + 1;
266
+ const shown = fold ? g.rows.slice(0, g.fold) : g.rows;
267
+ return (g.title ? `<p class="hi-lbl">${esc(g.title)}</p>` : '') + shown.map((d) => docRowHtml(d, cur, g.later)).join('')
268
+ + (fold ? `<button type="button" class="hi-btn sm ghost hi-self" data-hi-dmore="${esc(g.key)}">Show ${g.rows.length - g.fold} more in ${esc(g.title)}</button>` : '');
269
+ }).join('') || '<p class="hi-empty">No document matches.</p>';
270
+ return `<div class="hi-vh2"><h2>${rows.length} ${rows.length === 1 ? 'document' : 'documents'}</h2><button type="button" class="cz-pick hi-pick" data-hi-dby aria-haspopup="menu" aria-expanded="false">Group: ${esc(MD.DOC_BY[X.doc.by])}${SVG(I.down, 14)}</button>`
271
+ + `<button type="button" class="hi-ib" data-ov-adddoc aria-label="Add a document" title="Add a document">${SVG(I.plus, 16)}</button></div>`
272
+ + (M.docs && M.docs.cap ? `<p class="hi-small" data-ov-dsum>${esc(M.docs.cap)}</p>` : '')
273
+ + `<div class="hi-chips" role="group" aria-label="Show">${chips.map((c) => `<button type="button" class="cz-chip${X.doc.filter === c.k ? ' on' : ''}" aria-pressed="${X.doc.filter === c.k}" data-hi-dfilter="${esc(c.k)}">${esc(c.label)} ${c.n}</button>`).join('')}</div>`
274
+ + groups + '<p class="hi-small">Press a row to open the document. Core marks the documents a stage needs.</p>';
275
+ }
276
+ function stageView(id, M, ask) {
277
+ const mv = mvOf(id, M), stages = (M.acts && M.acts.stages) || [];
278
+ const move = stages.length && !M.acts.self ? `<div class="hi-stages" role="group" aria-label="Move to a stage">${stages.map((s) => `<button type="button" class="cz-chip${s === M.acts.stage ? ' on' : ''}" aria-pressed="${s === M.acts.stage}" data-ov-move="${esc(s)}">${MD.isMilestone(s) ? '<i class="cz-ms" aria-hidden="true"></i>' : ''}${esc(s)}</button>`).join('')}</div>` : '<p class="hi-small">The stage of this board comes from the workflow engine.</p>';
279
+ const life = M.acts && M.acts.life ? `<button type="button" class="hi-btn sm" data-ov-life="active">Resume</button>${M.acts.reason ? `<p class="hi-small">${esc(M.acts.reason)}</p>` : ''}`
280
+ : ask ? `<label class="hi-field"><span>${ask === 'on-hold' ? 'Put on hold' : 'Cancel'}: why? It goes on the record.</span><input id="ovWhy" autocomplete="off" maxlength="300"></label><div class="hi-acts"><button type="button" class="hi-btn dark sm" data-ov-life-go>Record</button><button type="button" class="hi-btn sm ghost" data-ov-life-no>Not now</button></div>`
281
+ : `<button type="button" class="hi-btn sm" data-ov-life="on-hold">Put on hold</button><button type="button" class="hi-btn sm ghost" data-ov-life="cancelled">Cancel</button>`;
282
+ const ck = mv.items.map((x) => `<span class="hi-ck${x.done ? ' on' : ''}"><i aria-hidden="true">${x.done ? SVG(I.check, 10, 3.5) : ''}</i>${esc(x.label)}</span>`).join('') || '<p class="hi-small">No exit item is on record for this stage.</p>';
283
+ return `<div class="hi-vh2"><h2>${esc(mv.cur || 'No stage')}</h2></div>`
284
+ + (X.ctx.S.H && X.ctx.S.H.steps ? `<div class="cz-ladder hi-lad" role="img" aria-label="${esc(X.ctx.S.H.ladderAria || '')}">${X.ctx.S.H.steps.map((s) => `<i class="${[s.cls, s.ms ? 'ms' : ''].filter(Boolean).join(' ')}" title="${esc(s.label)}"></i>`).join('')}</div>` : '')
285
+ + `<section class="hi-sec"><p class="hi-lbl">${esc(mv.title)}</p><div class="hi-cks">${ck}</div></section>`
286
+ + (mv.why ? '' : `<section class="hi-sec"><div class="hi-swl"><button type="button" class="hi-sw" role="switch" aria-checked="${mv.auto}" data-hi-auto aria-label="Moves on by itself"></button><span>${esc(mv.swText)}</span></div><p class="hi-small">When every exit item is done, PMOS moves the stage and tells you, with Undo. It never moves into a milestone (Deliver or Evaluate) by itself. Turn this off and every move waits for you.</p></section>`)
287
+ + `<section class="hi-sec"><p class="hi-lbl">Move to a stage</p>${move}<p class="hi-small">A move by hand keeps open items open. Back asks for a reason from the card.</p></section>`
288
+ + `<section class="hi-sec"><p class="hi-lbl">Hold or stop</p><div class="hi-acts">${life}</div></section>`
289
+ + `<div class="hi-foot"><button type="button" class="hi-btn sm ghost" data-ov-record>Open the full record</button>${M.board && M.board.id ? '<button type="button" class="hi-btn sm ghost" data-ov-sprint>Sprint</button>' : ''}</div>`;
290
+ }
291
+ let STAGE_ASK = null;
292
+ function draw(b) {
293
+ const S = X.ctx.S, id = S.ini, M = curM();
294
+ if (!M) { b.innerHTML = `<div class="hi-v"><p class="hi-small" role="status">${X.failed === id ? 'The initiative could not be read.' : 'Reading the initiative.'}</p></div>`; return; }
295
+ const v = X.view;
296
+ b.innerHTML = `<div class="hi-v" data-hi-v="${v}">${segHtml(v)}${v === 'docs' ? docsView(id, M) : v === 'stage' ? stageView(id, M, STAGE_ASK) : tasksView(id, M)}<p class="hi-small" role="status" id="ovMsg"></p></div>`;
297
+ }
298
+ function redrawView() {
299
+ if (!BODY || !BODY.isConnected || !X.ctx) return;
300
+ const cur = X.ctx.VW.current(); if (!cur || cur.id !== 'ov:' + X.ctx.S.ini) return;
301
+ const ae = document.activeElement, keep = ae && BODY.contains(ae) && ae.id ? ae.id : null, val = keep && ae.value != null ? ae.value : null;
302
+ const st = BODY.scrollTop; draw(BODY); BODY.scrollTop = st;
303
+ if (keep) { const n = BODY.querySelector('#' + keep); if (n) { if (val != null) n.value = val; n.focus(); } }
304
+ }
305
+ export function iniOverview(view) {
306
+ if (!X.ctx) return false;
307
+ const S = X.ctx.S, id = S.ini;
308
+ if (!id || id === 'product') return false;
309
+ X.view = KIND[view] ? view : 'tasks'; // the card's Overview opens on Tasks (InTasks); a list line or the switch names its own view
310
+ STAGE_ASK = null;
311
+ const VW = X.ctx.VW;
312
+ BODY = VW.open({ id: 'ov:' + id, kind: KIND[X.view], title: X.ctx.iniTitle(id), icon: ICON[X.view], render: draw });
313
+ if (!curM()) { X.failed = null; X.ctx.loadIni().then(() => { if (S.ini !== id) return; if (!curM()) X.failed = id; X.ctx.drawList(); redrawView(); }); } // a slow first read: read it again rather than say it failed
314
+ wire(BODY, id);
315
+ return true;
316
+ }
317
+ function wire(body, id) {
318
+ const S = X.ctx.S;
319
+ const say = (m) => { const el = body.querySelector('#ovMsg'); if (el) el.textContent = m; };
320
+ const after = async (r, ok) => { if (r && r.ok !== false) { X.ctx.toast(ok); await X.ctx.load(); redrawView(); return true; } say((r && r.error) || 'Nothing was changed.'); return false; };
321
+ const addTask = async () => {
322
+ const M = curM(); const inp = body.querySelector('#ovTask'); if (!M || !inp) return;
323
+ const v = inp.value.trim(); if (!v) return;
324
+ const L = Lof(id), target = inp.dataset.hiTarget || '';
325
+ const r = await X.ctx.pmPost('/api/boards/tasks/add', { ...bw(M), initiative: id, title: v });
326
+ if (!r || r.ok === false) { say((r && r.error) || 'The task was not added.'); return; }
327
+ const key = r.item ? 'task:' + (r.item.uid || r.item.key) : '';
328
+ if (key && /^task:[A-Za-z0-9]/.test(key)) {
329
+ if (L.by === 'mine' && target) await press(id, M, { kind: 'place', task: key, group: target });
330
+ const stg = L.by === 'stage' || !L.by ? (M.acts.stage || '') : M.acts.stage || '';
331
+ if (stg) await press(id, M, { kind: 'stage', task: key, stage: stg });
332
+ }
333
+ inp.value = '';
334
+ await after(r, 'Task added.');
335
+ const n = body.querySelector('#ovTask'); if (n) n.focus();
336
+ };
337
+ body.onkeydown = (e) => { if (e.target.id === 'ovTask' && e.key === 'Enter') { e.preventDefault(); addTask(); } };
338
+ body.onclick = async (e) => {
339
+ const t = e.target.closest('button'); const M = curM(); if (!t || t.disabled || !M) return;
340
+ const d = t.dataset;
341
+ if (d.hiView) { iniOverview(d.hiView); return; }
342
+ if ('hiAuto' in d) { press(id, M, { kind: 'auto', on: t.getAttribute('aria-checked') !== 'true' }); return; }
343
+ if ('hiBy' in d) {
344
+ const L = Lof(id);
345
+ const same = (n) => n.join('|').toLowerCase() === L.names.join('|').toLowerCase();
346
+ menu(t, [{ head: 'Group by' }, ...['stage', 'mine', 'owner', 'status', 'none'].map((k) => ({ label: MD.BY_LABEL[k], sub: k === 'stage' ? ((M.acts && M.acts.stages) || []).slice(Math.max(0, ((M.acts && M.acts.stages) || []).indexOf(M.acts.stage)), Math.max(0, ((M.acts && M.acts.stages) || []).indexOf(M.acts.stage)) + 3).join(', ') : k === 'mine' && L.names.length ? L.names.join(', ') : '', radio: true, on: L.by === k, go: () => press(id, M, { kind: 'by', by: k }) })),
347
+ { hr: true }, { head: 'Saved group sets' },
348
+ ...(L.sets || []).map((s) => ({ label: s.names.join(' · '), sub: same(s.names) ? 'this one' : s.name !== s.names.join(' · ') ? s.name : '', go: async () => { if (await press(id, M, { kind: 'groups', names: s.names })) press(id, M, { kind: 'by', by: 'mine' }); } })),
349
+ { label: 'Save these groups as a set', icon: I.plus, disabled: !L.names.length, go: () => press(id, M, { kind: 'set', name: L.names.join(' · '), names: L.names }) }], 'Group tasks by');
350
+ return;
351
+ }
352
+ if ('hiNewgroup' in d) { const L = Lof(id); ask(t, 'Name the group', '', (v) => press(id, M, { kind: 'groups', names: L.names.concat(v) })); return; }
353
+ if (d.hiGmore) {
354
+ const g = d.hiGmore, L = Lof(id);
355
+ menu(t, [{ label: 'Rename', go: (a) => ask(a, 'Rename ' + g, g, (v) => press(id, M, { kind: 'rename', from: g, to: v })) },
356
+ { label: 'Add a task here', go: () => { X.addTo = g; redrawView(); const n = body.querySelector('#ovTask'); if (n) n.focus(); } },
357
+ { label: 'Delete the group', sub: 'Its tasks stay', go: () => press(id, M, { kind: 'groups', names: L.names.filter((x) => x !== g) }) }], 'More for ' + g);
358
+ return;
359
+ }
360
+ if (d.hiVfold) { const k = 'vt:' + d.hiVfold; if (X.shut.has(k)) X.shut.delete(k); else X.shut.add(k); redrawView(); return; }
361
+ if ('hiFocusadd' in d) { const n = body.querySelector('#ovTask'); if (n) n.focus(); return; }
362
+ if ('ovAdd' in d) { addTask(); return; }
363
+ if (d.hiChk) { const row = MD.taskRows(M, Lof(id)).find((x) => x.key === d.hiChk); if (row && row.canCheck) after(await X.ctx.pmPost('/api/boards/tasks/state', { ...bw(M), task: row.uid, state: row.done ? 'To do' : 'Done' }), row.done ? 'Reopened.' : 'Done.'); return; }
364
+ if (d.hiTstage) {
365
+ const key = d.hiTstage, stages = (M.acts && M.acts.stages) || [];
366
+ menu(t, [{ head: 'Stage of this task' }, ...stages.map((s) => ({ label: s, radio: true, on: (Lof(id).stage || {})[key] === s, go: () => press(id, M, { kind: 'stage', task: key, stage: s }) })), { label: 'No stage', go: () => press(id, M, { kind: 'stage', task: key, stage: '' }) }], 'Stage of this task');
367
+ return;
368
+ }
369
+ if (d.hiTmore) {
370
+ const key = d.hiTmore, row = MD.taskRows(M, Lof(id)).find((x) => x.key === key); if (!row) return;
371
+ const L = Lof(id);
372
+ const items = [{ label: 'Open', go: () => openTask(id, M, key) }];
373
+ if (row.canCheck) { items.push({ head: 'Status' }); for (const s of ['To do', 'In progress', 'In review', 'Done']) items.push({ label: s, radio: true, on: row.state === s, go: async () => after(await X.ctx.pmPost('/api/boards/tasks/state', { ...bw(M), task: row.uid, state: s }), 'Status changed.') }); }
374
+ if (L.names.length) { items.push({ head: 'Group' }); for (const g of L.names) items.push({ label: g, radio: true, on: row.group === g, go: () => press(id, M, { kind: 'place', task: key, group: g }) }); items.push({ label: 'Not in a group', go: () => press(id, M, { kind: 'place', task: key, group: '' }) }); }
375
+ menu(t, items, 'More for ' + row.title);
376
+ return;
377
+ }
378
+ if (d.ovTk) { openTask(id, M, d.ovTk); return; }
379
+ if ('ovRecord' in d || 'ovSprint' in d) {
380
+ const o = bw(M);
381
+ if ('ovSprint' in d) { (await import('./premium-vw-jira.js')).openSprint(o); return; }
382
+ (await import('./premium-vw-item.js')).openWorkItem({ kind: 'initiative', id, title: M.title, ...o });
383
+ return;
384
+ }
385
+ // documents
386
+ if ('hiDby' in d) { menu(t, Object.entries(MD.DOC_BY).map(([k, l]) => ({ label: l, radio: true, on: X.doc.by === k, go: () => { X.doc.by = k; redrawView(); } })), 'Group documents by'); return; }
387
+ if (d.hiDfilter) { X.doc.filter = d.hiDfilter; redrawView(); return; }
388
+ if (d.hiDmore) { X.doc.more.add(d.hiDmore); redrawView(); return; }
389
+ if (d.ovDraft) { after(await X.ctx.pmPost('/api/core-docs/draft', { ws: M.board.ws, scope: M.docs.scope, key: d.ovDraft }), 'The draft started. It waits for you to read.'); return; }
390
+ if (d.ovOpen) { X.ctx.openFile({ path: d.ovOpen, name: d.ovName }); return; }
391
+ if (d.ovNone) {
392
+ const doc = (M.docs.rows || []).find((x) => x.key === d.ovNone); if (!doc) return;
393
+ if (doc.running) { X.ctx.toast(doc.title + ' is being drafted now. It opens here when it is ready.'); return; }
394
+ const can = doc.act && doc.act.kind === 'draft';
395
+ if (can) menu(t, [{ label: 'Draft it now', sub: 'PMOS writes a first draft for you to read', go: async () => after(await X.ctx.pmPost('/api/core-docs/draft', { ws: M.board.ws, scope: M.docs.scope, key: doc.key }), 'The draft started. It waits for you to read.') }],
396
+ doc.title + ' has no file yet' + (doc.by ? ' · ' + doc.by : ''));
397
+ if (!can) X.ctx.toast(doc.title + ' has no file yet.' + (doc.by ? ' ' + doc.by + '.' : ''));
398
+ return;
399
+ }
400
+ if (d.ovDread) {
401
+ const doc = (M.docs.rows || []).find((x) => x.key === d.ovDread); if (!doc) return;
402
+ const A = await import('./home-draft.js');
403
+ A.openDraftVw({ VW: X.ctx.VW, pmGet: X.ctx.pmGet, pmPost: X.ctx.pmPost, toast: X.ctx.toast, wait: X.ctx.wait || '', ws: M.board.ws, scope: M.docs.scope, doc, onIssued: () => X.ctx.load() });
404
+ return;
405
+ }
406
+ if ('ovAdddoc' in d) {
407
+ const A = await import('./home-adddoc.js');
408
+ A.openAddDocVw({ VW: X.ctx.VW, pmPost: X.ctx.pmPost, toast: X.ctx.toast, wait: X.ctx.wait || '', ws: M.board.ws, scope: M.docs.scope, phases: MD.PHASES, title: X.ctx.iniTitle(id), back: () => iniOverview('docs'), onAdded: async () => { await X.ctx.load(); if (S.ini === id) iniOverview('docs'); } });
409
+ return;
410
+ }
411
+ // stage
412
+ if (d.ovMove) { if (t.getAttribute('aria-pressed') === 'true') return; const ok = await after(await X.ctx.pmPost('/api/boards/move', { ...bw(M), id, to: d.ovMove, why: 'Moved by hand' }), 'Moved to ' + d.ovMove + '.'); void ok; return; }
413
+ if (d.ovLife === 'active') { after(await X.ctx.pmPost('/api/lifecycle', { ws: M.board.ws, initiative_id: id, state: 'active', reason: '' }), 'Recorded.'); return; }
414
+ if (d.ovLife) { STAGE_ASK = d.ovLife; redrawView(); const w = body.querySelector('#ovWhy'); if (w) w.focus(); return; }
415
+ if ('ovLifeNo' in d) { STAGE_ASK = null; redrawView(); return; }
416
+ if ('ovLifeGo' in d) { const reason = (body.querySelector('#ovWhy').value || '').trim(); if (reason.length < 3) { say('Say why in a few words. It goes on the record.'); return; } const st = STAGE_ASK; STAGE_ASK = null; after(await X.ctx.pmPost('/api/lifecycle', { ws: M.board.ws, initiative_id: id, state: st, reason }), 'Recorded.'); }
417
+ };
418
+ // drag a task between the PM's groups (InTasks)
419
+ body.ondragstart = (e) => { const r = e.target.closest && e.target.closest('[data-hi-drag]'); if (!r) return; e.dataTransfer.setData('text/plain', r.dataset.hiDrag); e.dataTransfer.effectAllowed = 'move'; r.classList.add('drag'); };
420
+ body.ondragend = (e) => { const r = e.target.closest && e.target.closest('[data-hi-drag]'); if (r) r.classList.remove('drag'); body.querySelectorAll('.hi-tg.over').forEach((n) => n.classList.remove('over')); };
421
+ body.ondragover = (e) => { const z = e.target.closest && e.target.closest('[data-hi-dz]'); if (!z) return; e.preventDefault(); body.querySelectorAll('.hi-tg.over').forEach((n) => { if (n !== z) n.classList.remove('over'); }); z.classList.add('over'); };
422
+ body.ondrop = (e) => { const z = e.target.closest && e.target.closest('[data-hi-dz]'); if (!z) return; e.preventDefault(); z.classList.remove('over'); const key = e.dataTransfer.getData('text/plain'); const M = curM(); if (key && M) press(id, M, { kind: 'place', task: key, group: z.dataset.hiDrop || '' }); };
423
+ }
424
+ async function openTask(id, M, key) {
425
+ const row = (M.tasks.rows || []).find((x) => x.key === key); if (!row) return;
426
+ const o = bw(M);
427
+ if (!row.pmos && row.ref && /^Jira/.test(row.src || '')) { (await import('./premium-vw-jira.js')).openTicket({ ...o, initiative: id, ref: row.ref }); return; }
428
+ (await import('./premium-vw-item.js')).openWorkItem({ kind: 'task', ini: id, key: row.key, title: row.title, ...o });
429
+ }
430
+
431
+ /* ── presses on the list column ── */
432
+ function onList(e) {
433
+ const t = e.target.closest('button'); if (!t || !X.ctx) return;
434
+ const d = t.dataset, M = curM(), id = X.ctx.S.ini;
435
+ if (!M || !id) return;
436
+ if ('hiMove' in d) {
437
+ const mv = mvOf(id, M);
438
+ if (!mv.canMove) return;
439
+ if (mv.open.length) popMove(t, id, M, mv); else doMove(id, M, mv.next, mv.allDone ? 'Moved by hand: every exit item is done.' : 'Moved by hand');
440
+ return;
441
+ }
442
+ if ('hiBack' in d) { const mv = mvOf(id, M); if (mv.canBack) popBack(t, id, M, mv); return; }
443
+ if ('hiAuto' in d) { press(id, M, { kind: 'auto', on: t.getAttribute('aria-checked') !== 'true' }); return; }
444
+ if (d.hiFold) { if (X.shut.has(d.hiFold)) X.shut.delete(d.hiFold); else X.shut.add(d.hiFold); X.ctx.drawList(); return; }
445
+ if ('hiAddtask' in d) { X.view = 'tasks'; iniOverview(); setTimeout(() => { const n = document.querySelector('#czViewer #ovTask'); if (n) n.focus(); }, 0); return; }
446
+ if (d.hiOpen) { iniOverview(d.hiOpen); return; }
447
+ if (d.hiTask) { openTask(id, M, d.hiTask); return; }
448
+ if (d.hiChk) { const row = MD.taskRows(M, Lof(id)).find((x) => x.key === d.hiChk); if (row && row.canCheck) X.ctx.pmPost('/api/boards/tasks/state', { ...bw(M), task: row.uid, state: 'Done' }).then(async (r) => { if (r && r.ok !== false) { X.ctx.toast('Done: ' + row.title + '.'); await X.ctx.load(); redrawView(); } else X.ctx.toast((r && r.error) || 'Nothing was changed.'); }); return; }
449
+ if (d.hiDoc) {
450
+ const doc = MD.docRows(M).find((x) => x.key === d.hiDoc);
451
+ if (doc && doc.path && !(doc.st === 'draft' && doc.slot)) X.ctx.openFile({ path: doc.path, name: doc.title });
452
+ else iniOverview('docs');
453
+ }
454
+ }
455
+
456
+ export function mountIni(ctx) {
457
+ X.ctx = ctx;
458
+ if (typeof document === 'undefined') return X;
459
+ if (!document.querySelector('link[data-hi-css]')) { const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = '/pm/home-ini.css'; l.dataset.hiCss = ''; document.head.appendChild(l); }
460
+ const list = document.getElementById('hmList');
461
+ if (list) list.addEventListener('click', onList);
462
+ ctx.VW.onChange((v) => { if (!v.open || !/^ov:/.test(v.id || '')) closePop(); });
463
+ return X;
464
+ }
465
+ /** For a test: the module's own state. */
466
+ export const _state = () => X;