create-pmos 0.399.0 → 0.401.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 (425) 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 +2 -2
  7. package/workspace/briefing-premium-board-test.js +3 -3
  8. package/workspace/briefing-premium-doc-edit-test.js +2 -8
  9. package/workspace/briefing-premium-sources-test.js +2 -0
  10. package/workspace/briefing-premium-test.js +6 -2
  11. package/workspace/briefing-premium-work-test.js +9 -4
  12. package/workspace/c3-capture-test.js +0 -17
  13. package/workspace/changelog.json +29 -0
  14. package/workspace/guide/briefing-premium.md +2 -2
  15. package/workspace/guide/home.md +24 -3
  16. package/workspace/guide/layout.md +2 -2
  17. package/workspace/guide/notes.md +2 -2
  18. package/workspace/guide/phone-companion.md +1 -1
  19. package/workspace/lib/core-docs.js +2 -2
  20. package/workspace/lib/route-modules.js +1 -9
  21. package/workspace/lib/routes-phone-day.js +18 -9
  22. package/workspace/lib/routes-slash.js +95 -0
  23. package/workspace/package-lock.json +2 -2
  24. package/workspace/package.json +1 -2
  25. package/workspace/premium-chat-goal-view-test.js +1 -1
  26. package/workspace/premium-chat-term-test.js +0 -10
  27. package/workspace/premium-menu-rows-test.js +1 -1
  28. package/workspace/premium-phone-card-test.js +8 -3
  29. package/workspace/premium-vw-cal-test.js +4 -1
  30. package/workspace/premium-vw-doc-test.js +1 -8
  31. package/workspace/premium-work-depth-test.js +2 -3
  32. package/workspace/public/capture.html +23 -0
  33. package/workspace/public/pm/c3-base.js +47 -0
  34. package/workspace/public/pm/c3-capture.js +1 -1
  35. package/workspace/public/pm/c3-ini-ui.js +1 -1
  36. package/workspace/public/pm/c3-sheet.js +1 -1
  37. package/workspace/public/pm/c3-toast.js +1 -1
  38. package/workspace/public/pm/console3.css +3 -0
  39. package/workspace/public/pm/cozy-home.css +21 -6
  40. package/workspace/public/pm/cozy-today.css +4 -3
  41. package/workspace/public/pm/cozy-viewer.js +4 -2
  42. package/workspace/public/pm/cozy.css +9 -0
  43. package/workspace/public/pm/goal-chat.js +5 -1
  44. package/workspace/public/pm/home-app.js +65 -33
  45. package/workspace/public/pm/home-chat.js +34 -29
  46. package/workspace/public/pm/home-data.js +10 -2
  47. package/workspace/public/pm/home-dictate.js +7 -4
  48. package/workspace/public/pm/home-ini.js +13 -3
  49. package/workspace/public/pm/home-list.js +18 -10
  50. package/workspace/public/pm/home-more.js +2 -2
  51. package/workspace/public/pm/home-phone-card.js +9 -4
  52. package/workspace/public/pm/home-review.js +2 -3
  53. package/workspace/public/pm/home-today.js +11 -8
  54. package/workspace/public/pm/home-work.js +13 -8
  55. package/workspace/public/pm/note-dock.js +1 -2
  56. package/workspace/public/pm/notes-links.js +1 -2
  57. package/workspace/public/pm/notes-task.js +3 -4
  58. package/workspace/public/pm/premium-board.js +1 -1
  59. package/workspace/public/pm/premium-initiative-head.js +3 -3
  60. package/workspace/public/pm/premium-vw-doc.css +20 -2
  61. package/workspace/public/pm/premium-vw-doc.js +22 -7
  62. package/workspace/public/pm/premium-vw-item.css +6 -0
  63. package/workspace/public/pm/view-notes.js +2 -2
  64. package/workspace/replaced-tests.json +435 -0
  65. package/workspace/run-tests.js +323 -28
  66. package/workspace/server.js +15 -10
  67. package/workspace/test-files.json +4 -140
  68. package/workspace/test-lists/base.json +1 -2
  69. package/workspace/test-lists/c3-desktop-light-load.json +1 -2
  70. package/workspace/test-lists/c3-initiative-boards.json +1 -2
  71. package/workspace/test-lists/c3-meeting-focus.json +2 -12
  72. package/workspace/test-lists/c3-work-agent.json +1 -2
  73. package/workspace/test-lists/calendar-tidy-up.json +1 -2
  74. package/workspace/test-lists/console3-reports.json +1 -2
  75. package/workspace/test-lists/docs-three-way-sync.json +1 -2
  76. package/workspace/test-lists/extension-capture.json +5 -0
  77. package/workspace/test-lists/jira-wbs.json +1 -2
  78. package/workspace/test-lists/legacy-cleanup-a.json +9 -0
  79. package/workspace/test-lists/meeting-material.json +1 -2
  80. package/workspace/test-lists/meeting-notes.json +2 -36
  81. package/workspace/test-lists/meeting-replay.json +1 -2
  82. package/workspace/test-lists/mm-capture.json +2 -12
  83. package/workspace/test-lists/my-work.json +2 -10
  84. package/workspace/test-lists/onboarding-firstrun.json +2 -12
  85. package/workspace/test-lists/people-directory.json +1 -2
  86. package/workspace/test-lists/run2-a.json +1 -2
  87. package/workspace/test-lists/run2-d.json +2 -19
  88. package/workspace/test-lists/run3-b.json +1 -2
  89. package/workspace/test-lists/run3-c.json +2 -12
  90. package/workspace/test-lists/run4-b.json +1 -2
  91. package/workspace/test-lists/run4-d.json +1 -5
  92. package/workspace/test-lists/run5-c.json +1 -11
  93. package/workspace/test-lists/run6.json +1 -5
  94. package/workspace/test-lists/workspace-launch-flags.json +2 -12
  95. package/workspace/test-lists/workspace-profile-detection.json +2 -10
  96. package/workspace/test-timings.json +242 -123
  97. package/workspace/c3-briefing-test.js +0 -136
  98. package/workspace/c3-core-docs-test.js +0 -170
  99. package/workspace/c3-driver-fixture.js +0 -64
  100. package/workspace/c3-driver-test.js +0 -169
  101. package/workspace/c3-foundation-test.js +0 -163
  102. package/workspace/c3-ib-items-test.js +0 -114
  103. package/workspace/c3-ib-more-test.js +0 -146
  104. package/workspace/c3-ib-triage-backlog-test.js +0 -128
  105. package/workspace/c3-ini-harness.js +0 -66
  106. package/workspace/c3-ini-life-test.js +0 -167
  107. package/workspace/c3-initiatives-test.js +0 -186
  108. package/workspace/c3-light-load-test.js +0 -112
  109. package/workspace/c3-one-home-test.js +0 -149
  110. package/workspace/c3-phone-test.js +0 -289
  111. package/workspace/c3-quiet-test.js +0 -157
  112. package/workspace/c3-report-design-real-test.js +0 -264
  113. package/workspace/c3-report-design-test.js +0 -442
  114. package/workspace/c3-report-setup-test.js +0 -192
  115. package/workspace/c3-report-structure-real-test.js +0 -248
  116. package/workspace/c3-report-structure-test.js +0 -397
  117. package/workspace/c3-reports-test.js +0 -288
  118. package/workspace/c3-scan-test.js +0 -517
  119. package/workspace/c3-sessions-panel-test.js +0 -365
  120. package/workspace/c3-settings-test.js +0 -204
  121. package/workspace/c3-updates-test.js +0 -131
  122. package/workspace/c3-work-test.js +0 -260
  123. package/workspace/cut-stub.js +0 -40
  124. package/workspace/first-paint-audit.js +0 -160
  125. package/workspace/lib/c3-full-console.js +0 -15
  126. package/workspace/lib/engine/derived/trust.js +0 -3
  127. package/workspace/lib/engine/plan-forecast.js +0 -342
  128. package/workspace/lib/engine/report-families.js +0 -175
  129. package/workspace/lib/engine/truth-table.js +0 -57
  130. package/workspace/lib/routes-c3-init.js +0 -54
  131. package/workspace/lib/routes-c3-life.js +0 -120
  132. package/workspace/lib/routes-c3-timeline.js +0 -192
  133. package/workspace/lib/routes-forecast.js +0 -86
  134. package/workspace/lib/routes-releases.js +0 -130
  135. package/workspace/lib/routes-report-facts.js +0 -85
  136. package/workspace/lib/routes-report-families.js +0 -33
  137. package/workspace/lib/routes-signals.js +0 -51
  138. package/workspace/lib/routes-timeline.js +0 -197
  139. package/workspace/public/c3.html +0 -35
  140. package/workspace/public/index.html +0 -156
  141. package/workspace/public/pm/app.js +0 -831
  142. package/workspace/public/pm/bd-board.js +0 -159
  143. package/workspace/public/pm/bd-drag.js +0 -59
  144. package/workspace/public/pm/bd-model.js +0 -152
  145. package/workspace/public/pm/bd-timeline.js +0 -233
  146. package/workspace/public/pm/bd-tree.js +0 -244
  147. package/workspace/public/pm/board-copy.js +0 -59
  148. package/workspace/public/pm/board-read.js +0 -38
  149. package/workspace/public/pm/branches-sheet.js +0 -56
  150. package/workspace/public/pm/breakdown-api.js +0 -58
  151. package/workspace/public/pm/breakdown-copy.js +0 -138
  152. package/workspace/public/pm/briefing-deck.js +0 -441
  153. package/workspace/public/pm/briefing-model.js +0 -251
  154. package/workspace/public/pm/c3-ambient.js +0 -100
  155. package/workspace/public/pm/c3-audience-link.js +0 -21
  156. package/workspace/public/pm/c3-audience.js +0 -46
  157. package/workspace/public/pm/c3-boot.js +0 -13
  158. package/workspace/public/pm/c3-breakdown.js +0 -240
  159. package/workspace/public/pm/c3-brief-data.js +0 -11
  160. package/workspace/public/pm/c3-brief-mentions.js +0 -137
  161. package/workspace/public/pm/c3-brief-needs.js +0 -288
  162. package/workspace/public/pm/c3-brief-pulse.js +0 -112
  163. package/workspace/public/pm/c3-brief-summary.js +0 -139
  164. package/workspace/public/pm/c3-brief-today.js +0 -79
  165. package/workspace/public/pm/c3-brief.js +0 -279
  166. package/workspace/public/pm/c3-cal-strategy.js +0 -529
  167. package/workspace/public/pm/c3-calendar.js +0 -965
  168. package/workspace/public/pm/c3-calpop.js +0 -111
  169. package/workspace/public/pm/c3-case.js +0 -196
  170. package/workspace/public/pm/c3-core-docs.css +0 -18
  171. package/workspace/public/pm/c3-core-docs.js +0 -236
  172. package/workspace/public/pm/c3-daypart.js +0 -176
  173. package/workspace/public/pm/c3-demo-boards.js +0 -764
  174. package/workspace/public/pm/c3-demo-brief-ix.js +0 -350
  175. package/workspace/public/pm/c3-demo-brief-page.js +0 -70
  176. package/workspace/public/pm/c3-demo-cal-ix.js +0 -74
  177. package/workspace/public/pm/c3-demo-cal2.js +0 -66
  178. package/workspace/public/pm/c3-demo-cal3.js +0 -173
  179. package/workspace/public/pm/c3-demo-cal4.js +0 -169
  180. package/workspace/public/pm/c3-demo-cal5.js +0 -52
  181. package/workspace/public/pm/c3-demo-coredocs.js +0 -221
  182. package/workspace/public/pm/c3-demo-data.js +0 -552
  183. package/workspace/public/pm/c3-demo-focus.js +0 -181
  184. package/workspace/public/pm/c3-demo-init.js +0 -430
  185. package/workspace/public/pm/c3-demo-life.js +0 -77
  186. package/workspace/public/pm/c3-demo-material.js +0 -58
  187. package/workspace/public/pm/c3-demo-misc2.js +0 -34
  188. package/workspace/public/pm/c3-demo-phone.js +0 -48
  189. package/workspace/public/pm/c3-demo-plan2.js +0 -30
  190. package/workspace/public/pm/c3-demo-rd.js +0 -432
  191. package/workspace/public/pm/c3-demo-rep-ix.js +0 -126
  192. package/workspace/public/pm/c3-demo-rep2.js +0 -130
  193. package/workspace/public/pm/c3-demo-rep3.js +0 -138
  194. package/workspace/public/pm/c3-demo-rs.js +0 -287
  195. package/workspace/public/pm/c3-demo-term.js +0 -153
  196. package/workspace/public/pm/c3-demo-time.js +0 -49
  197. package/workspace/public/pm/c3-demo-work-ix.js +0 -32
  198. package/workspace/public/pm/c3-demo.js +0 -131
  199. package/workspace/public/pm/c3-design-studio.js +0 -369
  200. package/workspace/public/pm/c3-doc-formats.js +0 -153
  201. package/workspace/public/pm/c3-doc-sheet.js +0 -1230
  202. package/workspace/public/pm/c3-dock.js +0 -206
  203. package/workspace/public/pm/c3-docs.js +0 -291
  204. package/workspace/public/pm/c3-driver-work.js +0 -110
  205. package/workspace/public/pm/c3-driver.css +0 -18
  206. package/workspace/public/pm/c3-driver.js +0 -298
  207. package/workspace/public/pm/c3-focus.css +0 -304
  208. package/workspace/public/pm/c3-focus.js +0 -983
  209. package/workspace/public/pm/c3-ib-docs.js +0 -92
  210. package/workspace/public/pm/c3-ib-initiatives.js +0 -201
  211. package/workspace/public/pm/c3-ib-items.js +0 -210
  212. package/workspace/public/pm/c3-ib-releases.js +0 -48
  213. package/workspace/public/pm/c3-ib-sprints.js +0 -201
  214. package/workspace/public/pm/c3-ib-triage.js +0 -177
  215. package/workspace/public/pm/c3-ii-tabs.js +0 -252
  216. package/workspace/public/pm/c3-ini-life.css +0 -34
  217. package/workspace/public/pm/c3-ini-life.js +0 -379
  218. package/workspace/public/pm/c3-ini-records.js +0 -197
  219. package/workspace/public/pm/c3-ini-timeline.js +0 -278
  220. package/workspace/public/pm/c3-ini-work.js +0 -139
  221. package/workspace/public/pm/c3-init-extras.js +0 -170
  222. package/workspace/public/pm/c3-initiatives.js +0 -852
  223. package/workspace/public/pm/c3-lifecycle-panels.js +0 -479
  224. package/workspace/public/pm/c3-look.js +0 -27
  225. package/workspace/public/pm/c3-material.css +0 -22
  226. package/workspace/public/pm/c3-material.js +0 -321
  227. package/workspace/public/pm/c3-md.js +0 -3
  228. package/workspace/public/pm/c3-misc-panels.js +0 -89
  229. package/workspace/public/pm/c3-new-session.js +0 -110
  230. package/workspace/public/pm/c3-notes.js +0 -751
  231. package/workspace/public/pm/c3-phone-boot.js +0 -47
  232. package/workspace/public/pm/c3-phone-detail.js +0 -97
  233. package/workspace/public/pm/c3-phone-model.js +0 -3
  234. package/workspace/public/pm/c3-phone.css +0 -66
  235. package/workspace/public/pm/c3-phone.js +0 -444
  236. package/workspace/public/pm/c3-plan-panels.js +0 -163
  237. package/workspace/public/pm/c3-plan.js +0 -193
  238. package/workspace/public/pm/c3-quiet.css +0 -113
  239. package/workspace/public/pm/c3-quiet.js +0 -177
  240. package/workspace/public/pm/c3-replay.css +0 -133
  241. package/workspace/public/pm/c3-replay.js +0 -429
  242. package/workspace/public/pm/c3-report-deck.css +0 -163
  243. package/workspace/public/pm/c3-report-deck.js +0 -598
  244. package/workspace/public/pm/c3-report-frame.css +0 -20
  245. package/workspace/public/pm/c3-report-print.css +0 -20
  246. package/workspace/public/pm/c3-report-setup.css +0 -67
  247. package/workspace/public/pm/c3-report-setup.js +0 -298
  248. package/workspace/public/pm/c3-report-store.js +0 -244
  249. package/workspace/public/pm/c3-report-structure.css +0 -44
  250. package/workspace/public/pm/c3-report-structure.js +0 -473
  251. package/workspace/public/pm/c3-reports.css +0 -68
  252. package/workspace/public/pm/c3-reports.js +0 -377
  253. package/workspace/public/pm/c3-roadmap.js +0 -249
  254. package/workspace/public/pm/c3-scan-api.js +0 -167
  255. package/workspace/public/pm/c3-scan-next.js +0 -248
  256. package/workspace/public/pm/c3-scan-setup.js +0 -313
  257. package/workspace/public/pm/c3-scan-words.js +0 -41
  258. package/workspace/public/pm/c3-scan.css +0 -74
  259. package/workspace/public/pm/c3-scan.js +0 -93
  260. package/workspace/public/pm/c3-session-chat.js +0 -103
  261. package/workspace/public/pm/c3-session-conv.js +0 -165
  262. package/workspace/public/pm/c3-session-term.js +0 -216
  263. package/workspace/public/pm/c3-settings.css +0 -85
  264. package/workspace/public/pm/c3-settings.js +0 -1045
  265. package/workspace/public/pm/c3-shell.js +0 -628
  266. package/workspace/public/pm/c3-signals.js +0 -196
  267. package/workspace/public/pm/c3-strategy-panels.js +0 -45
  268. package/workspace/public/pm/c3-swipe.js +0 -230
  269. package/workspace/public/pm/c3-terminal-data.js +0 -48
  270. package/workspace/public/pm/c3-terminal-edge.js +0 -91
  271. package/workspace/public/pm/c3-terminal-icons.js +0 -40
  272. package/workspace/public/pm/c3-terminal-results.js +0 -141
  273. package/workspace/public/pm/c3-terminal.js +0 -52
  274. package/workspace/public/pm/c3-tickets.js +0 -163
  275. package/workspace/public/pm/c3-timeline.js +0 -201
  276. package/workspace/public/pm/calendar-views.js +0 -1049
  277. package/workspace/public/pm/console3-lift.md +0 -220
  278. package/workspace/public/pm/cozy-home.js +0 -172
  279. package/workspace/public/pm/cozy-initiative.css +0 -138
  280. package/workspace/public/pm/cycle-review.js +0 -125
  281. package/workspace/public/pm/data.js +0 -1577
  282. package/workspace/public/pm/dest-board.js +0 -444
  283. package/workspace/public/pm/dest-docs.js +0 -530
  284. package/workspace/public/pm/dest-initiatives.js +0 -162
  285. package/workspace/public/pm/dest-mywork.js +0 -307
  286. package/workspace/public/pm/dest-notes.js +0 -537
  287. package/workspace/public/pm/dest-people.js +0 -449
  288. package/workspace/public/pm/dest-reports.js +0 -383
  289. package/workspace/public/pm/dest-settings.js +0 -601
  290. package/workspace/public/pm/dest-today.js +0 -267
  291. package/workspace/public/pm/display-word.js +0 -56
  292. package/workspace/public/pm/doc-editor.js +0 -473
  293. package/workspace/public/pm/doc-graph.js +0 -272
  294. package/workspace/public/pm/doc-health-panel.js +0 -110
  295. package/workspace/public/pm/doc-rail.js +0 -167
  296. package/workspace/public/pm/doc-remote.js +0 -180
  297. package/workspace/public/pm/dock-sessions.js +0 -472
  298. package/workspace/public/pm/dock.js +0 -216
  299. package/workspace/public/pm/fixture.js +0 -821
  300. package/workspace/public/pm/flag-picker.js +0 -104
  301. package/workspace/public/pm/frame-copy.js +0 -278
  302. package/workspace/public/pm/freshness-line.js +0 -149
  303. package/workspace/public/pm/handoff-box.js +0 -82
  304. package/workspace/public/pm/initiative-list.js +0 -235
  305. package/workspace/public/pm/initiative-sheet.js +0 -331
  306. package/workspace/public/pm/initiatives-api.js +0 -95
  307. package/workspace/public/pm/initiatives-copy.js +0 -287
  308. package/workspace/public/pm/initiatives-timeline-copy.js +0 -59
  309. package/workspace/public/pm/initiatives-timeline.js +0 -410
  310. package/workspace/public/pm/initiatives-ui.js +0 -291
  311. package/workspace/public/pm/item-sheet.js +0 -268
  312. package/workspace/public/pm/keep-card.js +0 -204
  313. package/workspace/public/pm/lifecycle-lens-model.js +0 -246
  314. package/workspace/public/pm/lifecycle-lens.js +0 -276
  315. package/workspace/public/pm/lifecycle.js +0 -111
  316. package/workspace/public/pm/mobile.css +0 -366
  317. package/workspace/public/pm/mobile.js +0 -581
  318. package/workspace/public/pm/modes-live.js +0 -453
  319. package/workspace/public/pm/modes.js +0 -147
  320. package/workspace/public/pm/my-work-card.js +0 -51
  321. package/workspace/public/pm/my-work-data.js +0 -36
  322. package/workspace/public/pm/new-initiative-sheet.js +0 -169
  323. package/workspace/public/pm/next-step-ui.js +0 -190
  324. package/workspace/public/pm/outbox-panel.js +0 -125
  325. package/workspace/public/pm/palette-copy.js +0 -55
  326. package/workspace/public/pm/palette.js +0 -343
  327. package/workspace/public/pm/panel-breakdown.js +0 -702
  328. package/workspace/public/pm/panel-cockpit.js +0 -425
  329. package/workspace/public/pm/panel-detail.js +0 -1513
  330. package/workspace/public/pm/panel-initiatives.js +0 -929
  331. package/workspace/public/pm/panel-newsess.js +0 -709
  332. package/workspace/public/pm/panel-repos.js +0 -741
  333. package/workspace/public/pm/panel-tabs.js +0 -1506
  334. package/workspace/public/pm/panel-trees.js +0 -204
  335. package/workspace/public/pm/people-link.js +0 -106
  336. package/workspace/public/pm/phone-deck.js +0 -167
  337. package/workspace/public/pm/pm-work-view.js +0 -1533
  338. package/workspace/public/pm/portfolio-report.js +0 -61
  339. package/workspace/public/pm/premium-acts.js +0 -280
  340. package/workspace/public/pm/premium-brief.js +0 -111
  341. package/workspace/public/pm/premium-chat.js +0 -22
  342. package/workspace/public/pm/premium-doc-sheet.js +0 -312
  343. package/workspace/public/pm/premium-initiative.js +0 -324
  344. package/workspace/public/pm/premium-insights.css +0 -228
  345. package/workspace/public/pm/premium-metric-tiles.js +0 -68
  346. package/workspace/public/pm/premium-report-brief.js +0 -132
  347. package/workspace/public/pm/premium-vw-rec.js +0 -67
  348. package/workspace/public/pm/premium-wide.css +0 -30
  349. package/workspace/public/pm/print.css +0 -44
  350. package/workspace/public/pm/provider-cards.js +0 -136
  351. package/workspace/public/pm/registry.js +0 -203
  352. package/workspace/public/pm/release-card.js +0 -110
  353. package/workspace/public/pm/releases-view.js +0 -248
  354. package/workspace/public/pm/report-families-view.js +0 -505
  355. package/workspace/public/pm/report-slides.js +0 -438
  356. package/workspace/public/pm/report-tab.js +0 -33
  357. package/workspace/public/pm/report-view.js +0 -337
  358. package/workspace/public/pm/reports-copy.js +0 -134
  359. package/workspace/public/pm/roadmap.js +0 -294
  360. package/workspace/public/pm/run-card.js +0 -260
  361. package/workspace/public/pm/sessions-panel.js +0 -219
  362. package/workspace/public/pm/sheet-jira.js +0 -353
  363. package/workspace/public/pm/shell-bell.js +0 -163
  364. package/workspace/public/pm/shell-model.js +0 -83
  365. package/workspace/public/pm/shell-phone.js +0 -124
  366. package/workspace/public/pm/shell-readaloud.js +0 -53
  367. package/workspace/public/pm/shell-recording.js +0 -274
  368. package/workspace/public/pm/shell-ticker.js +0 -90
  369. package/workspace/public/pm/sig-watch.js +0 -41
  370. package/workspace/public/pm/slide-confirm.js +0 -163
  371. package/workspace/public/pm/slides-copy.js +0 -52
  372. package/workspace/public/pm/status-banner.js +0 -95
  373. package/workspace/public/pm/tab-doc.js +0 -859
  374. package/workspace/public/pm/tab-gone.js +0 -21
  375. package/workspace/public/pm/tab-term.js +0 -1210
  376. package/workspace/public/pm/tab-web.js +0 -90
  377. package/workspace/public/pm/timeline-copy.js +0 -48
  378. package/workspace/public/pm/timeline-forecast-view.js +0 -164
  379. package/workspace/public/pm/today-agenda.js +0 -331
  380. package/workspace/public/pm/today-cards.js +0 -244
  381. package/workspace/public/pm/today-copy.js +0 -506
  382. package/workspace/public/pm/today-day.js +0 -1371
  383. package/workspace/public/pm/today-goals.js +0 -297
  384. package/workspace/public/pm/today-jobs.js +0 -84
  385. package/workspace/public/pm/today-mentions.js +0 -50
  386. package/workspace/public/pm/topbar.js +0 -202
  387. package/workspace/public/pm/triage-card.js +0 -60
  388. package/workspace/public/pm/undo-hold.js +0 -103
  389. package/workspace/public/pm/view-addrepo.js +0 -208
  390. package/workspace/public/pm/view-files.js +0 -197
  391. package/workspace/public/pm/view-livenotes.js +0 -399
  392. package/workspace/public/pm/view-today.js +0 -13
  393. package/workspace/public/pm/view-validate.js +0 -171
  394. package/workspace/public/pm/welcome.js +0 -391
  395. package/workspace/public/pm/work-place.js +0 -68
  396. package/workspace/public/pm/xlsx-read.js +0 -117
  397. package/workspace/public/welcome.html +0 -22
  398. package/workspace/test-lists/browser-suites-green.json +0 -5
  399. package/workspace/test-lists/c3-core-docs.json +0 -9
  400. package/workspace/test-lists/c3-doc-sheet-rich.json +0 -6
  401. package/workspace/test-lists/c3-doc-sheet-size.json +0 -6
  402. package/workspace/test-lists/c3-doc-sheet-v2.json +0 -6
  403. package/workspace/test-lists/c3-ib-items.json +0 -9
  404. package/workspace/test-lists/c3-ib-more.json +0 -9
  405. package/workspace/test-lists/c3-ib-triage-backlog.json +0 -9
  406. package/workspace/test-lists/c3-ini-life.json +0 -9
  407. package/workspace/test-lists/c3-meeting-board.json +0 -5
  408. package/workspace/test-lists/c3-meeting-card.json +0 -5
  409. package/workspace/test-lists/c3-notes-place.json +0 -5
  410. package/workspace/test-lists/c3-notes-series.json +0 -5
  411. package/workspace/test-lists/calendar-time-page.json +0 -5
  412. package/workspace/test-lists/calpop.json +0 -4
  413. package/workspace/test-lists/console3-briefing.json +0 -9
  414. package/workspace/test-lists/console3-foundation.json +0 -9
  415. package/workspace/test-lists/console3-work-page.json +0 -9
  416. package/workspace/test-lists/premium-brief-parity.json +0 -9
  417. package/workspace/test-lists/report-design-studio-ui.json +0 -5
  418. package/workspace/test-lists/report-structure-ui.json +0 -11
  419. package/workspace/test-lists/report-workspace-ui.json +0 -5
  420. package/workspace/test-lists/run3-a.json +0 -5
  421. package/workspace/test-lists/run3-d.json +0 -6
  422. package/workspace/test-lists/run4-c.json +0 -13
  423. package/workspace/test-lists/today-goals-jobs-ui.json +0 -5
  424. package/workspace/test-lists/today-mentions-cards.json +0 -5
  425. package/workspace/test-lists/workspace-tabs-declutter.json +0 -13
@@ -1,505 +0,0 @@
1
- /* pm/report-families-view.js — console3: the four report families, the claims check, the send slide and who-holds-what, behaving as the
2
- * console3 mockup's Reports tab does (console3.html lines 4205 to 4380: R2F, pjSecs/pdSecs/peSecs, rsRow, r2composer, cmRow, caseFor 'rpt:'/'com:').
3
- *
4
- * mountReportFamilies(host, ctx) / disposeReportFamilies(host). One persistent root per host.
5
- * Real mode: GET /api/report-families once; POST /api/report-families/check (pure); sections come from ctx.reportFacts (the facts route).
6
- * Demo mode (window.__c3demo, with window.__c3repix from c3-demo-rep-ix.js): the mockup's own reports, sections and messages; nothing is requested.
7
- *
8
- * What a press does:
9
- * - a section row opens IN PLACE (c3-expand): why it is here, the claims with their label and a Traced / Needs your input mark, the sources as
10
- * jump chips (they click the Initiatives, Calendar, Work or Briefing tab), and "Fix with the agent": it opens the report as a document on Ask the
11
- * agent with the fix written in, so the agent starts from the page and its draft is accepted only by the PM's slide (page-starts-agent).
12
- * - a swipe right approves a section and a swipe left cuts it (c3-swipe). In DEMO the decision is kept on the page, with an Undo toast. In REAL mode
13
- * no route stores a section decision, so the swipe is off and the legend and the row say why.
14
- * - the Send row opens the case file (c3-case) with the slide. DEMO: the slide marks the report Sent and adds it to the Sent card (nothing leaves).
15
- * REAL: opening the row queues ONE draft through POST /api/outbox/draft (the claim lines of the sections, labelled), the slide is bound to that
16
- * draft's hash and calls POST /api/outbox/confirm. With no channel connected the answer is "no channel connected" and the page says exactly that.
17
- * A claim line with no label or ticket key blocks the slide with the reason; customer-facing variants allow only fact and cited labels (server rule).
18
- * - Communications (demo): the message queue (swipe right sends, left holds, external needs the slide) and the who-holds-what truth table.
19
- * An agent can only draft. Sending is the PM's slide. Nothing here sends anything. */
20
- import { el } from './dom.js';
21
- import { strategyPanel } from './c3-strategy-panels.js';
22
- import { pmGet, pmPost } from './http.js';
23
- import { ensureC3Css, c3ic, c3ring, c3Phone } from './pm-work-view.js';
24
- import { attachExpand } from './c3-expand.js';
25
- import { attachSwipe } from './c3-swipe.js';
26
- import { renderCase } from './c3-case.js';
27
- import { openSheet } from './c3-sheet.js';
28
- import { toast } from './c3-toast.js';
29
- import { openDocSheet, splitDoc } from './c3-doc-sheet.js';
30
- import { forecastChecksCard } from './c3-misc-panels.js';
31
- import { c3btn } from './page-agent.js';
32
-
33
- const insts = new WeakMap();
34
- const FAM_ICON = { project: 'tree', product: 'target', communications: 'out', periodic: 'cal' };
35
- const fixPrompt = (s) => (s.st === 'stale' ? 'Bring the section “' + s.h + '” up to date with its sources.' : 'Fix the section “' + s.h + '”: give each claim a label (fact, cited or reported) and its source or ticket key.');
36
- const NO_STORE = 'Approving or cutting a section is not recorded here yet: no record stores a section decision.';
37
- const dim = (t) => el('span', { class: 'dim mono', style: 'font-size:var(--fs-2)' }, t);
38
- const rx = () => (typeof window !== 'undefined' && window.__c3demo && window.__c3repix) || null;
39
- const cap = (s) => { const t = String(s || '').replace(/_/g, ' '); return t.charAt(0).toUpperCase() + t.slice(1); };
40
-
41
- function make(host) {
42
- return { host, root: el('div', { class: 'c3', 'data-report-families': '' }), families: null, error: null, sel: null, variant: null, rep: { project: 'pj1', product: 'pd1' }, check: null, seq: 0,
43
- dec: {}, flagged: {}, sent: {}, csent: {}, chold: {}, open: {}, hist: null, docText: {}, cleanups: [], draft: null, draftErr: null, draftBusy: false, outMsg: {}, outSent: null };
44
- }
45
-
46
- /* ── jump to the source: the page's own tab buttons (the mockup's RSRC) ── */
47
- const RSRC = { time: ['init', 'forecast'], tix: ['init', 'tickets'], wbs: ['init', 'breakdown'], docs: ['init', 'documents'], sig: ['init', 'signals'], life: ['init', 'lifecycle'], roadmap: ['init', 'roadmap'], strat: ['init', 'lifecycle'], comms: ['rep', 'communications'], brief: ['brief'], cal: ['cal'], work: ['work'] };
48
- function jump(kind) {
49
- const t = RSRC[kind];
50
- if (!t) return;
51
- const tab = document.querySelector('[data-c3-tab="' + t[0] + '"]');
52
- if (tab) tab.click();
53
- if (!t[1]) return;
54
- let n = 0;
55
- const go = () => {
56
- const b = t[0] === 'init' ? document.querySelector('[data-c3-init="' + t[1] + '"]') : document.querySelector('[data-family="' + t[1] + '"]');
57
- if (b) b.click(); else if (++n < 25) setTimeout(go, 80);
58
- };
59
- go();
60
- }
61
- /* a real claim's source text → the view that holds it (only the ones that name one) */
62
- function kindOf(text) {
63
- const t = String(text || '').toLowerCase();
64
- if (/jira|ticket/.test(t)) return 'tix'; if (/calendar/.test(t)) return 'cal'; if (/timeline|forecast/.test(t)) return 'time'; if (/analytics|signal/.test(t)) return 'sig'; if (/brief/.test(t)) return 'brief';
65
- return '';
66
- }
67
-
68
- /* ── the model: variants, sections and counts, from the demo fixtures or the real facts ── */
69
- const famOf = (inst) => inst.families.find((f) => f.id === inst.sel);
70
- const variantsOf = (inst, fam) => { const R = rx(); return R ? R.pills(fam.id) : fam.variants.map((v) => ({ id: v.id, name: v.name, external: !!v.external })); };
71
- const repIdOf = (inst, fam) => (fam.id === 'periodic' ? inst.variant : (inst.rep[fam.id] || 'r'));
72
- const keyOf = (inst, fam) => fam.id + '.' + repIdOf(inst, fam) + '.' + (fam.id === 'periodic' ? 'x' : inst.variant);
73
- const variantOf = (inst, fam) => variantsOf(inst, fam).find((v) => v.id === inst.variant) || variantsOf(inst, fam)[0] || { id: '', name: '' };
74
- const repOf = (inst, fam) => { const R = rx(); return R ? ((R.REPORTS[fam.id] || []).find((r) => r.id === repIdOf(inst, fam)) || (R.REPORTS[fam.id] || [])[0] || null) : null; };
75
-
76
- /* a report is a document (the mockup's r2doc): the sections the sheet saved flow back into the rows (the mockup's r2text) */
77
- const docPath = (fam, rid, variant) => 'planning/reports/' + fam + '-' + rid + '-' + variant + '.md';
78
- const pathOf = (inst, fam) => docPath(fam.id, repIdOf(inst, fam), inst.variant);
79
- function withDoc(inst, fam, secs) {
80
- const text = inst.docText[pathOf(inst, fam)]; if (!text) return secs;
81
- const sp = splitDoc(text);
82
- return secs.map((s) => { const m = sp.find((x) => x.name === s.h); return m && m.text !== s.t ? { ...s, t: m.text, edited: true } : s; });
83
- }
84
- function sectionsOf(inst, fam, ctx) { return withDoc(inst, fam, baseSections(inst, fam, ctx)); }
85
- function baseSections(inst, fam, ctx) {
86
- const R = rx();
87
- if (R) return R.sections(fam.id, repIdOf(inst, fam), inst.variant);
88
- const given = (ctx && ctx.reportFacts && ctx.reportFacts[fam.id]) || [];
89
- return fam.sections.map((name, i) => {
90
- const g = given.find((s) => s.name === name) || { name, title: cap(name), claims: [] };
91
- const r = inst.check && inst.check.sections && inst.check.sections[i];
92
- const claims = (g.claims || []).map((c) => ({ text: (c && (c.text || c.id)) || String(c), label: c && c.basis, source: c && c.source, ok: !(c && c.ok === false) }));
93
- const st = !r ? 'check' : r.stale_source > 0 ? 'stale' : (r.needs_input > 0 || r.traced === 0) ? 'check' : 'ok';
94
- const src = []; const seen = new Set();
95
- for (const c of claims) if (c.source && !seen.has(c.source)) { seen.add(c.source); src.push(['doc', c.source, kindOf(c.source)]); }
96
- return { id: name, h: g.title ? cap(g.title) : cap(name), t: claims.length ? claims.map((c) => c.text).join(' ') : 'No claim has been written for this section yet.', src, st, by: 'Records', why: '', claims };
97
- });
98
- }
99
- const decOf = (inst, key, id) => inst.dec[key + '|' + id] || '';
100
- function readyOf(inst, key, secs) {
101
- const d = (s) => decOf(inst, key, s.id);
102
- return { n: secs.length - secs.filter((s) => d(s) === 'cut').length, ap: secs.filter((s) => d(s) === 'ok').length, fl: secs.filter((s) => s.st !== 'ok' && d(s) !== 'ok' && d(s) !== 'cut').length };
103
- }
104
-
105
- /* ── loading ── */
106
- async function load(inst, ctx) {
107
- const j = await pmGet('/api/report-families');
108
- if (!insts.has(inst.host)) return;
109
- if (!j || j.ok === false) inst.error = (j && j.error) || 'Could not read the report families.';
110
- else { inst.families = j.families || []; inst.error = null; if (!inst.sel && inst.families[0]) { inst.sel = inst.families[0].id; inst.variant = defaultVariant(inst, inst.families[0]); } }
111
- if (!rx()) { const o = await pmGet('/api/outbox'); if (insts.has(inst.host) && o && o.ok) inst.outSent = (o.entries || []).filter((e) => e.state === 'sent'); }
112
- inst.hist = null;
113
- await runCheck(inst, ctx);
114
- }
115
- const defaultVariant = (inst, fam) => (variantsOf(inst, fam)[0] || {}).id || null;
116
-
117
- async function runCheck(inst, ctx) {
118
- const fam = inst.families && famOf(inst);
119
- if (!fam) { draw(inst, ctx); return; }
120
- if (rx()) { draw(inst, ctx); return; } // the demo's sections carry their own state; no request
121
- const seq = ++inst.seq;
122
- const j = await pmPost('/api/report-families/check', { family: inst.sel, variant: inst.variant, sections: (fam.sections || []).map((name) => { const g = ((ctx && ctx.reportFacts && ctx.reportFacts[inst.sel]) || []).find((s) => s.name === name); return g || { name, title: cap(name), claims: [] }; }) });
123
- if (seq !== inst.seq || !insts.has(inst.host)) return;
124
- inst.check = j && j.ok ? j : null;
125
- draw(inst, ctx);
126
- }
127
-
128
- function pick(inst, ctx, fam, variant) { inst.sel = fam.id; inst.variant = variant || defaultVariant(inst, fam); inst.check = null; inst.draft = null; inst.draftErr = null; draw(inst, ctx); runCheck(inst, ctx); }
129
-
130
- /* ── pieces lifted from the demo path of the earlier pass: the forecast chart, the reports list ── */
131
- const NSV = 'http://www.w3.org/2000/svg';
132
- const sv = (tag, attrs, ...kids) => { const n = document.createElementNS(NSV, tag); for (const k of Object.keys(attrs || {})) n.setAttribute(k, attrs[k]); for (const c of kids) if (c) n.appendChild(c); return n; };
133
- const svt = (x, y, t, a) => { const n = sv('text', { x, y, ...(a || {}) }); n.textContent = t; return n; };
134
-
135
- function reportsList(inst, ctx, fam, list, selId) {
136
- const choose = (id) => { inst.rep[fam.id] = id; inst.draft = null; draw(inst, ctx); };
137
- return el('section', { class: 'card sect', 'data-rp-section': 'reports' }, el('div', { class: 'sh2' }, el('h2', null, c3ic('doc', 'sm'), 'Reports ', el('span', { class: 'bdg g' }, String(list.length)))),
138
- el('ul', { class: 'list' }, list.map((r) => {
139
- const on = r.id === selId;
140
- const li = el('li', { class: 'nrow', 'data-row': '', 'data-a': 'rsel', 'data-report': r.id, tabindex: '0', 'aria-current': String(on), style: on ? 'background:var(--accw);border-radius:8px' : null },
141
- el('span', { class: 'ki' }, c3ic(on ? 'eye' : 'doc')),
142
- el('div', { class: 'nb' }, el('span', { class: 'tt' }, r.n), el('div', { class: 'chips' }, el('span', { class: 'chip2' }, c3ic('clock', 'sm'), 'Due ' + r.due))));
143
- li.addEventListener('click', () => choose(r.id));
144
- li.addEventListener('keydown', (e) => { if (e.target === li && (e.key === 'Enter' || e.key === ' ')) { e.preventDefault(); choose(r.id); } });
145
- return li;
146
- })));
147
- }
148
-
149
- /* ── a section row (the mockup's rsRow) ── */
150
- const ORIG = { Agent: ['spark', 'var(--purple)', 'Agent wrote'], You: ['user', 'var(--acc)', 'You'], Records: ['doc', 'var(--muted-foreground)', 'From records'] };
151
- const STATE = { ok: ['var(--success)', 'Traced', 'check'], stale: ['var(--warning)', 'Stale source', 'alert'], check: ['var(--acc)', 'Needs your input', 'eye'] };
152
- const LABEL_TONE = { fact: ['check', 'ok'], cited: ['check', 'ok'], reported: ['user', ''], estimate: ['clock', 'warn'], assumption: ['alert', 'warn'], judgement: ['eye', ''] };
153
-
154
- function claimRow(c) {
155
- const L = LABEL_TONE[c.label];
156
- const bad = c.ok === false || !L;
157
- const traced = !bad && (c.label === 'fact' || c.label === 'cited' || c.label === 'reported');
158
- return el('li', { class: bad ? 'bad' : L[1], 'data-claim': '' }, c3ic(bad ? 'alert' : L[0], 'sm'), el('span', null, c.text + ' ', el('b', { class: 'dim', style: 'font-weight:500' }, traced ? 'Traced' : 'Needs your input')),
159
- el('span', { class: 'tag' }, (c.label || 'unlabelled') + (c.source ? ' · ' + c.source : '')));
160
- }
161
- function detail(s, onFix) {
162
- const claims = s.claims && s.claims.length ? s.claims.map(claimRow) : [el('li', { class: s.st === 'ok' ? 'ok' : s.st === 'stale' ? 'warn' : 'warn' }, c3ic(STATE[s.st][2], 'sm'), el('span', null, STATE[s.st][1] + (s.st === 'stale' ? ': a source is out of date. Refresh it before this goes out.' : s.st === 'check' ? ': a person decides this one.' : ': every number has a source.')), el('span', { class: 'tag' }, 'claims check'))];
163
- const chips = s.src.length ? s.src.map((q) => (q[2] ? el('button', { type: 'button', class: 'chip2 lk', 'data-a': 'rsrc', 'data-k': q[2], onClick: (e) => { e.stopPropagation(); jump(q[2]); } }, c3ic(q[0], 'sm'), q[1], c3ic('next', 'sm'))
164
- : el('span', { class: 'chip2' }, c3ic(q[0], 'sm'), q[1]))) : [el('span', { class: 'dim', style: 'font-size:var(--fs-2)' }, s.by === 'You' ? 'Your judgement. No source to trace.' : 'No source is recorded for this section.')];
165
- return el('div', { class: 'dpn' },
166
- s.why ? el('div', { class: 'dim', style: 'font-size:var(--fs-2)' }, c3ic('info', 'sm'), ' Why it is here: ' + s.why) : null,
167
- el('div', { class: 'dim', style: 'font-size:var(--fs-2)' }, 'Claims check'), el('ul', { class: 'chgl' }, claims),
168
- el('div', { class: 'dim', style: 'font-size:var(--fs-2)' }, 'Where it comes from'), el('div', { class: 'chips2', style: 'flex-wrap:wrap' }, chips),
169
- s.st !== 'ok' ? el('div', { class: 'chips2' }, c3btn('chip2 lk', { 'data-rp-act': 'fix' }, [c3ic('spark', 'sm'), 'Fix with the agent'], (e) => { e.stopPropagation(); if (onFix) onFix(s); })) : null);
170
- }
171
-
172
- function sectionRow(inst, ctx, fam, key, s, onFix) {
173
- const DEMO = !!rx();
174
- const k = key + '|' + s.id; const dst = decOf(inst, key, s.id);
175
- const cc = STATE[s.st]; const o = ORIG[s.by] || ORIG.Agent;
176
- const li = el('li', { class: 'nrow' + (dst === 'cut' ? ' cutr' : ''), 'data-row': '', 'data-section': s.id, 'data-rs': k, tabindex: '0', style: dst === 'cut' ? 'opacity:.5' : null });
177
- const xp = el('div', { class: 'xp' }, el('div', { class: 'xi' }, detail(s, onFix)));
178
- li.append(el('span', { class: 'ki', style: 'color:' + (dst === 'ok' ? 'var(--success)' : cc[0]) }, c3ic(dst === 'ok' ? 'check' : dst === 'cut' ? 'x' : cc[2])),
179
- el('div', { class: 'nb' }, el('span', { class: 'tt' }, s.h), el('div', { class: 'dim', style: 'font-size:var(--fs-2);margin-top:2px' }, s.t),
180
- el('div', { class: 'chips' }, el('span', { class: 'chip2', style: 'color:' + o[1] }, c3ic(o[0], 'sm'), o[2]), el('span', { class: 'chip2', style: 'color:' + cc[0] }, c3ic(cc[2], 'sm'), cc[1]),
181
- dst ? el('span', { class: 'chip2' }, dst === 'ok' ? 'Approved' : 'Cut') : null), xp));
182
- if (DEMO) li.append(el('span', { class: 'sg', title: 'Suggested: approve (drag right)' }, el('span', { class: 'g l' }, c3ic('moon')), el('span', { class: 'g r y' }, c3ic('check'))));
183
- const ex = attachExpand(li, xp, { key: k, initial: !!inst.open[k], onToggle: (on) => { inst.open[k] = on; } });
184
- inst.cleanups.push(ex.detach);
185
- if (DEMO) {
186
- const decide = (side) => {
187
- const prev = inst.dec[k];
188
- inst.dec[k] = side === 'right' ? 'ok' : 'cut';
189
- li.classList.add('leave');
190
- setTimeout(() => { toast(side === 'right' ? 'Section approved' : 'Section cut', () => { if (prev) inst.dec[k] = prev; else delete inst.dec[k]; inst.draft = null; draw(inst, ctx); }); inst.draft = null; draw(inst, ctx); }, 230);
191
- };
192
- inst.cleanups.push(attachSwipe(li, { onRight: () => decide('right'), onLeft: () => decide('left'), labelRight: 'Approve', labelLeft: 'Cut', iconRight: 'check', iconLeft: 'moon' }));
193
- } else li.setAttribute('aria-description', NO_STORE);
194
- return li;
195
- }
196
-
197
- /* ── the report as a document (the mockup's docopen, console3.html 4136 and 4335): the DOCUMENT SHEET with its six modes ── */
198
- const mdOf = (secs) => secs.map((s) => '## ' + s.h + '\n' + s.t + '\n').join('\n');
199
- const EDGE = { ok: ['in sync', 'ok', 'check'], stale: ['out of sync', 'bad', 'alert'], check: ['needs your input', '', 'eye'] };
200
- const NO_STORE_WHY = 'Issue this report first. Editing by hand and asking the agent change a stored document, and this report has none yet: it is generated from the records each time the page opens. Nothing is lost.';
201
-
202
- /** Real mode with no stored document: the checks are the claims check, one per section (traced, or not). */
203
- function generatedHealth(secs) {
204
- const checks = secs.map((s) => ({ id: s.id, name: s.h, pass: s.st === 'ok', reason: s.st === 'ok' ? 'every number has a source' : s.st === 'stale' ? 'a source is out of date' : 'a person decides this one' }));
205
- return { passed: checks.filter((c) => c.pass).length, total: checks.length, checks };
206
- }
207
-
208
- function reportRelations(inst, secs, repName, getSheet) {
209
- return (doc) => {
210
- const seen = new Map();
211
- secs.forEach((s) => (s.src || []).forEach((q) => { const e = seen.get(q[1]) || { q, st: [] }; e.st.push(s); seen.set(q[1], e); }));
212
- const stOf = (e) => (e.st.some((s) => s.st === 'stale') ? 'stale' : e.st.some((s) => s.st === 'check') ? 'check' : 'ok');
213
- const R = rx(); const sent = R ? ((inst.hist && inst.hist[(famOf(inst) || {}).id]) || []).filter((h) => h[1] === repName) : (inst.outSent || []).filter((e) => (e.subject || '').indexOf(repName) === 0);
214
- const go = (kind) => { const sh = getSheet(); if (sh) sh.close(); jump(kind); };
215
- return el('div', { class: 'dpn', 'data-doc-relations': '' },
216
- el('div', { class: 'dim', style: 'font-size:var(--fs-2)' }, 'This report cites'),
217
- seen.size ? el('ul', { class: 'chgl' }, [...seen.values()].map((e) => { const x = EDGE[stOf(e)]; return el('li', { class: x[1], 'data-edge': stOf(e) }, c3ic(x[2], 'sm'),
218
- el('span', null, e.q[1] + ' · ', el('b', null, e.st.map((s) => s.h).join(', ')), ' · ' + x[0] + ' ', e.q[2] ? el('button', { type: 'button', class: 'chip2 lk', 'data-a': 'rsrc', 'data-k': e.q[2], onClick: () => go(e.q[2]) }, c3ic('next', 'sm'), 'Open') : null)); }))
219
- : el('div', { class: 'fold' }, c3ic('info', 'sm'), 'No section cites a source yet.'),
220
- el('div', { class: 'dim', style: 'font-size:var(--fs-2)' }, 'Cited by'),
221
- sent.length ? el('ul', { class: 'chgl' }, sent.map((h) => (Array.isArray(h)
222
- ? el('li', { class: 'ok' }, c3ic('out', 'sm'), el('span', null, h[1] + ' · sent to ' + h[2] + ' · ' + h[0] + ' · ' + h[3]))
223
- : el('li', { class: 'ok' }, c3ic('out', 'sm'), el('span', null, (h.subject || h.channel) + ' · ' + h.state)))))
224
- : el('div', { class: 'fold' }, c3ic('info', 'sm'), 'Nothing cites this report yet: it has not been sent.'),
225
- el('div', { class: 'dim', style: 'font-size:var(--fs-2)' }, 'Each section of the report is traced to its source in Initiatives, Calendar or Work.'));
226
- };
227
- }
228
-
229
- function secExtraOf(secs, getSheet) {
230
- return (name) => {
231
- const s = secs.find((x) => x.h === name); if (!s) return null;
232
- const claims = s.claims && s.claims.length ? s.claims.map(claimRow) : [];
233
- const chips = (s.src || []).map((q) => (q[2] ? el('button', { type: 'button', class: 'chip2 lk', 'data-a': 'rsrc', 'data-k': q[2], onClick: () => { const sh = getSheet(); if (sh) sh.close(); jump(q[2]); } }, c3ic(q[0], 'sm'), q[1], c3ic('next', 'sm')) : el('span', { class: 'chip2' }, c3ic(q[0], 'sm'), q[1])));
234
- const stt = STATE[s.st];
235
- return el('div', { class: 'dpn', 'data-rp-claims': s.id },
236
- claims.length ? el('ul', { class: 'chgl' }, claims) : null,
237
- el('div', { class: 'chips2', style: 'flex-wrap:wrap' }, el('span', { class: 'chip2', style: 'color:' + stt[0] }, c3ic(stt[2], 'sm'), stt[1]), chips.length ? chips : el('span', { class: 'dim', style: 'font-size:var(--fs-2)' }, s.by === 'You' ? 'Your judgement. No source to trace.' : 'No source is recorded for this section.')));
238
- };
239
- }
240
-
241
- /** Open a report (or a communications message) as a document. path/name name it; secs are its sections; mode is the segment to start on. */
242
- async function openReportDoc(inst, ctx, { fam, path, name, aud, repName, secs, mode, prompt }) {
243
- const ws = (ctx && ctx.ws) || '';
244
- let text = null;
245
- try { const r = await fetch('/api/doc?ws=' + encodeURIComponent(ws) + '&path=' + encodeURIComponent(path)); if (r.ok) text = await r.text(); } catch { /* no stored document */ }
246
- if (!insts.has(inst.host)) return;
247
- const stored = text != null;
248
- if (stored) inst.docText[path] = text;
249
- let sheet = null; const getSheet = () => sheet;
250
- const doc = { path, name, ty: 'Report', v: stored ? 'v1' : '', st: 'draft', ini: '', iniName: 'Portfolio' };
251
- sheet = openDocSheet({ ws, doc, mode: mode || 'read', prompt: prompt || '', relations: reportRelations(inst, secs, repName || name, getSheet), secExtra: secExtraOf(secs, getSheet),
252
- generated: stored ? null : { text: mdOf(secs), why: NO_STORE_WHY, health: generatedHealth(secs) },
253
- onChanged: async () => { try { const r = await fetch('/api/doc?ws=' + encodeURIComponent(ws) + '&path=' + encodeURIComponent(path)); if (r.ok) { inst.docText[path] = await r.text(); draw(inst, ctx); } } catch { /* the rows keep what they show */ } } });
254
- void aud; void fam;
255
- return sheet;
256
- }
257
-
258
- /* ── Send: the case file and the slide ── */
259
- function bodyOf(inst, key, fam, aud, secs) {
260
- const lines = [];
261
- for (const s of secs) {
262
- if (decOf(inst, key, s.id) === 'cut') continue;
263
- for (const c of s.claims || []) { const key = /\b[A-Z][A-Z0-9]+-\d+\b/.exec(c.source || ''); const lab = key ? key[0] : c.label; lines.push('- ' + c.text + (lab ? ' [' + lab + ']' : '')); }
264
- }
265
- return lines.length ? fam.name + ' report for ' + aud + '\n' + lines.join('\n') : '';
266
- }
267
- async function ensureDraft(inst, ctx, fam, key, aud, secs) {
268
- const body = bodyOf(inst, key, fam, aud, secs);
269
- if (!body || inst.draftBusy) return;
270
- if ((inst.draft && inst.draft.body === body) || (inst.draftErr && inst.draftErr.body === body)) return;
271
- inst.draftBusy = true;
272
- const r = await pmPost('/api/outbox/draft', { channel: 'customer-note', recipient: aud, subject: fam.name + ' report for ' + aud, body });
273
- inst.draftBusy = false;
274
- if (!insts.has(inst.host)) return;
275
- if (r && r.ok && r.entry) { inst.draft = { entry: r.entry, body }; inst.draftErr = null; } else { inst.draft = null; inst.draftErr = { body, error: (r && (r.error || r.reason)) || 'The draft could not be queued.' }; }
276
- draw(inst, ctx);
277
- }
278
- async function confirmReal(inst, ctx, hashFull) {
279
- const d = inst.draft; const hash = String(hashFull).split('|')[0];
280
- let text;
281
- if (!d || d.entry.hash !== hash) text = 'The content changed after the slide was prepared. Nothing was sent. Slide again.';
282
- else {
283
- const r = await pmPost('/api/outbox/confirm', { id: d.entry.id, hash });
284
- if (r && r.ok) text = 'Sent.';
285
- else if (r && r.reason === 'no channel connected') text = 'No channel connected. Nothing was sent. The draft stays queued in the outbox.';
286
- else text = 'Not sent: ' + ((r && (r.reason || r.error)) || 'no answer') + '.';
287
- }
288
- if (!insts.has(inst.host)) return;
289
- inst.outMsg[inst.draft ? inst.draft.entry.id : 'x'] = text;
290
- toast(text);
291
- draw(inst, ctx);
292
- }
293
-
294
- function sendCase(inst, ctx, fam, key, secs, q, aud, repName, vr) {
295
- const DEMO = !!rx();
296
- /* "Resolve the flagged sections first" (the mockup's confirmCase): the case settles on that choice with an undo, and a toast says "Flags opened." The sections themselves stay as they are. */
297
- const open = () => { inst.flagged[key] = 1; toast('Flags opened.', () => { delete inst.flagged[key]; draw(inst, ctx); }); draw(inst, ctx); };
298
- const settled = (cs) => {
299
- cs.querySelectorAll('.opts,.c3slide').forEach((n) => n.remove());
300
- cs.append(el('div', { class: 'chips2', 'data-flags-settled': '' }, c3ic('check', 'sm'), el('b', { style: 'font-size:var(--fs-3);color:var(--success)' }, 'Resolve the flagged sections first'),
301
- el('button', { type: 'button', class: 'chip2 lk', onclick: () => { delete inst.flagged[key]; draw(inst, ctx); } }, c3ic('undo', 'sm'), 'undo')));
302
- return cs;
303
- };
304
- if (DEMO) {
305
- const R = rx();
306
- const model = { id: 'rpt:' + key, sit: 'The ' + repName + ' for ' + aud + ' has ' + q.ap + ' of ' + q.n + ' sections approved' + (q.fl ? ' and ' + q.fl + ' still need a look' : '') + '. Sending is final: it goes in the history with what it said.', conf: q.fl ? 64 : 86,
307
- chg: [['check', q.ap + ' of ' + q.n + ' sections approved', 'sections', q.ap === q.n ? 'ok' : 'warn'], ['alert', q.fl ? q.fl + ' section' + (q.fl > 1 ? 's' : '') + ' stale or unconfirmed' : 'All sections traced', 'claims check', q.fl ? 'warn' : 'ok'], ['user', 'Audience: ' + aud, 'audience']],
308
- opts: [{ id: 's', l: 'Send it', rec: q.fl ? 0 : 1, outward: true, fx: [['check', 'Recorded with its sources', 'ok']] }, { id: 'r', l: 'Resolve the flagged sections first', rec: q.fl ? 1 : 0, fx: [['eye', 'Review what is stale', 'ok']] }, { id: 'h', l: 'Not yet', fx: [] }] };
309
- const cs = renderCase(model, { outbox: true, onConfirm: ({ option }) => {
310
- if (option.id === 's') {
311
- const hist = inst.hist[fam.id]; const ent = ['Thu 8 Oct', repName, aud, 'just sent', ''];
312
- inst.sent[key] = 1; hist.unshift(ent);
313
- toast('Sent to ' + aud + '. It is in the history.', () => { delete inst.sent[key]; const i = hist.indexOf(ent); if (i >= 0) hist.splice(i, 1); draw(inst, ctx); });
314
- draw(inst, ctx);
315
- } else if (option.id === 'r') open(); else { toast('Held.'); draw(inst, ctx); }
316
- } });
317
- void R;
318
- return inst.flagged[key] ? settled(cs) : cs;
319
- }
320
- /* REAL: the draft is the unit; the slide is bound to its hash */
321
- const d = inst.draft; const err = inst.draftErr;
322
- const claimsN = secs.reduce((n, s) => n + (s.claims || []).length, 0);
323
- const blocked = d && !d.entry.claims.ok;
324
- const none = !claimsN || (!d && !err && !inst.draftBusy && !bodyOf(inst, key, fam, aud, secs));
325
- const chg = [];
326
- chg.push(['out', none ? 'No section has a claim yet: there is nothing to send.' : d ? 'Draft queued in the outbox, hash ' + d.entry.hash.slice(0, 10) : err ? err.error : 'Queuing the draft in the outbox.', 'outbox', none || err ? 'warn' : 'ok']);
327
- if (d) chg.push([d.entry.claims.ok ? 'check' : 'alert', d.entry.claims.ok ? 'Every claim line has a label.' : d.entry.claims.refused.length + ' claim line' + (d.entry.claims.refused.length > 1 ? 's fail' : ' fails') + ' the outbound trust rules (a label with its source, or a ticket key).', 'claims check', d.entry.claims.ok ? 'ok' : 'bad']);
328
- if (blocked) d.entry.claims.refused.forEach((l) => chg.push(['x', l, 'refused', 'bad']));
329
- if (vr && vr.external) chg.push(['shield', 'A customer report allows only fact and cited labels.', 'rule', 'warn']);
330
- chg.push(['user', 'Audience: ' + aud, 'audience']);
331
- const msg = d && inst.outMsg[d.entry.id];
332
- const model = { id: d ? d.entry.hash : 'rpt:' + key, sit: msg || 'Nothing has been sent. The slide sends exactly this draft, bound to its hash, and only when a channel is connected.', conf: q.fl ? 40 : 70, chg,
333
- outboxReason: none ? 'Nothing to send: no section has a claim yet.' : blocked ? 'Blocked: a claim line has no label the rules accept, or no ticket key. Fix it or cut it.' : err ? err.error : 'The draft is not ready yet.',
334
- opts: [{ id: 's', l: 'Send it', rec: q.fl ? 0 : 1, outward: true, fx: [['out', 'Goes through the outbox, bound to the hash', 'ok']] }, { id: 'r', l: 'Resolve the flagged sections first', rec: q.fl ? 1 : 0, fx: [['eye', 'Review what is stale', 'ok']] }, { id: 'h', l: 'Not yet', fx: [] }] };
335
- const cr = renderCase(model, { outbox: !!d && !blocked, onConfirm: ({ option, hash }) => { if (option.id === 's') confirmReal(inst, ctx, hash); else if (option.id === 'r') open(); else { toast('Held.'); draw(inst, ctx); } } });
336
- return inst.flagged[key] ? settled(cr) : cr;
337
- }
338
-
339
- function sendRow(inst, ctx, fam, key, secs, q, aud, repName, vr) {
340
- const DEMO = !!rx(); const sent = DEMO && inst.sent[key]; const k = key + '|send';
341
- const li = el('li', { class: 'nrow', 'data-row': '', 'data-send': '', tabindex: '0' });
342
- const xp = el('div', { class: 'xp' }, el('div', { class: 'xi' }));
343
- const fill = () => { const xi = xp.querySelector('.xi'); xi.replaceChildren(sendCase(inst, ctx, fam, key, secs, q, aud, repName, vr)); };
344
- li.append(el('span', { class: 'ki', style: 'color:' + (sent ? 'var(--success)' : 'var(--acc)') }, c3ic(sent ? 'check' : 'out')),
345
- el('div', { class: 'nb' }, el('span', { class: 'tt' }, sent ? 'Sent' : 'Send'), el('div', { class: 'dim', style: 'font-size:var(--fs-2)' },
346
- sent ? 'It is in the history with its sources.' : DEMO ? q.ap + ' of ' + q.n + ' approved. Slide to send, or swipe sections first.' : 'Slide to send. Nothing is sent while no channel is connected.'), xp));
347
- if (!sent) fill(); else xp.querySelector('.xi').replaceChildren(el('div', { class: 'fold' }, c3ic('check', 'sm'), 'Sent. It is in the history with its sources.'));
348
- const ex = attachExpand(li, xp, { key: k, initial: !!inst.open[k], onToggle: (on) => { inst.open[k] = on; if (on && !DEMO) ensureDraft(inst, ctx, fam, key, aud, secs); } });
349
- inst.cleanups.push(ex.detach);
350
- if (inst.open[k] && !DEMO) ensureDraft(inst, ctx, fam, key, aud, secs);
351
- return li;
352
- }
353
-
354
- /* ── Communications (demo): the queue ── */
355
- function cmRow(inst, ctx, c) {
356
- const st = inst.csent[c.id] ? 'sent' : inst.chold[c.id] ? 'held' : 'draft';
357
- const sc = { draft: ['var(--acc)', 'Draft'], held: ['var(--mfg)', 'Held'], sent: ['var(--success)', 'Sent'] }[st];
358
- const k = 'cm' + c.id;
359
- const sendIt = () => { inst.csent[c.id] = 1; const was = inst.chold[c.id]; delete inst.chold[c.id]; toast(c.ext ? 'Approved. Sent to ' + c.to + '.' : 'Sent to ' + c.to + '.', () => { delete inst.csent[c.id]; if (was) inst.chold[c.id] = was; draw(inst, ctx); }); draw(inst, ctx); };
360
- const hold = () => { inst.chold[c.id] = 1; toast('Held.', () => { delete inst.chold[c.id]; draw(inst, ctx); }); draw(inst, ctx); };
361
- const model = { id: 'com:' + c.id, quote: c.body, sit: c.why, conf: c.ext ? 72 : 84,
362
- chg: [['out', 'To ' + c.to + ' by ' + c.ch, 'channel'], ['user', 'Tone: ' + c.tone, 'agent'], ['alert', c.risk, 'risk', c.ext ? 'warn' : '']],
363
- opts: [{ id: 's', l: c.ext ? 'Approve and send' : 'Send now', rec: c.ext ? 0 : 1, outward: true, fx: [['check', 'Logged in the history', 'ok']] }, { id: 'o', l: 'Open and edit it first', rec: c.ext ? 1 : 0, fx: [] }, { id: 'h', l: 'Hold it', fx: [['clock', 'Reminder tomorrow']] }] };
364
- const cs = renderCase(model, { outbox: true, onConfirm: ({ option }) => { if (option.id === 's') sendIt(); else if (option.id === 'h') hold(); else { const m = (id, h, t) => ({ id, h, t, src: [], st: 'ok', by: 'Agent', why: '', claims: [] }); openReportDoc(inst, ctx, { fam: 'communications', path: docPath('communications', c.id, 'msg'), name: c.t, repName: c.t, aud: c.to, mode: 'edit', secs: [m('m', 'Message', c.body), m('w', 'Why now', c.why), m('t', 'Tone and risk', c.tone + '. ' + c.risk)] }); } } });
365
- inst.cleanups.push(() => cs.c3case.dispose());
366
- const li = el('li', { class: 'nrow', 'data-row': '', 'data-cm': c.id, tabindex: '0' });
367
- const xp = el('div', { class: 'xp' }, el('div', { class: 'xi' }, cs));
368
- li.append(el('span', { class: 'ki', style: 'color:' + sc[0] }, c3ic(c.ext ? 'out' : 'reply')),
369
- el('div', { class: 'nb' }, el('span', { class: 'tt' }, c.t), el('div', { class: 'chips' }, el('span', { class: 'chip2', style: 'color:' + sc[0] }, sc[1]), el('span', { class: 'chip2' }, c3ic('user', 'sm'), c.to), el('span', { class: 'chip2' }, c3ic('clock', 'sm'), c.due), el('span', { class: 'tag' }, c.ch),
370
- c.ext ? el('span', { class: 'st warn' }, c3ic('shield', 'sm'), 'external, you approve') : null), xp),
371
- el('span', { class: 'sg', title: 'Suggested: send (drag right)' }, el('span', { class: 'g l' }, c3ic('moon')), el('span', { class: 'g r y' }, c3ic('check'))));
372
- inst.cleanups.push(attachExpand(li, xp, { key: k, initial: !!inst.open[k], onToggle: (on) => { inst.open[k] = on; } }).detach);
373
- inst.cleanups.push(attachSwipe(li, { onRight: sendIt, onLeft: hold, labelRight: c.ext ? 'Approve and send' : 'Send', labelLeft: 'Hold', iconRight: 'out', iconLeft: 'moon', disabled: () => st === 'sent' }));
374
- return li;
375
- }
376
- function commsQueue(inst, ctx, fam) {
377
- const R = rx(); const aud = inst.variant || 'all';
378
- const L = R.COMMS.filter((c) => aud === 'all' || c.aud === aud);
379
- return el('section', { class: 'card sect', 'data-rp-section': 'queue' }, el('div', { class: 'sh2' }, el('h2', null, c3ic('out', 'sm'), 'Messages ', el('span', { class: 'bdg g' }, String(L.length))), dim('by when it matters')),
380
- el('ul', { class: 'list' }, L.map((c) => cmRow(inst, ctx, c))),
381
- el('div', { class: 'pgl' }, el('span', null, 'swipe right: send'), el('span', null, 'swipe left: hold'), el('span', null, 'external: you approve')));
382
- }
383
-
384
- /* ── right-hand cards ── */
385
- const bars = (rows) => el('div', { class: 'hbs' }, rows.map((r, i) => el('div', { class: 'hbr', style: '--c:' + r[2] }, el('div', { class: 'l' }, el('span', null, r[0]), el('i', null, String(r[3]))), el('div', { class: 'tk' }, el('u', { style: 'width:' + Math.max(2, r[1] * 100) + '%;animation-delay:' + (i * 90) + 'ms' })))));
386
-
387
- function claimsCard(secs) {
388
- const t = { ok: 0, stale: 0, check: 0 }; secs.forEach((s) => { t[s.st]++; });
389
- const all = Math.max(1, secs.length);
390
- return el('section', { class: 'card', 'data-rp-section': 'claims' }, el('h3', null, c3ic('shield'), 'Claims check ', el('span', { class: 'dim', style: 'text-transform:none;letter-spacing:0' }, 'every number traced')),
391
- bars([['Traced to a source', t.ok / all, 'var(--success)', t.ok], ['Source is stale', t.stale / all, 'var(--warning)', t.stale], ['Needs your input', t.check / all, 'var(--acc)', t.check]]),
392
- el('div', { class: 'dim', style: 'font-size:var(--fs-2)' }, 'A report with an untraced number does not go out. Guesses are labelled as guesses.'));
393
- }
394
- function sentCard(inst, fam) {
395
- const R = rx();
396
- const head = el('h3', null, c3ic('clock'), 'Sent ', el('span', { class: 'dim', style: 'text-transform:none;letter-spacing:0' }, 'who read it, what came back'));
397
- if (R) {
398
- const list = (inst.hist && inst.hist[fam.id]) || [];
399
- return el('section', { class: 'card', 'data-rp-section': 'sent' }, head, el('ul', { class: 'hx' }, list.map((h) => el('li', null, el('span', { class: 'chip2' }, c3ic('out', 'sm'), h[2]), el('span', null, h[1], el('small', null, h[3] + (h[4] ? ' · ' + h[4] : ''))), el('span', { class: 'w' }, h[0])))));
400
- }
401
- const sent = inst.outSent || [];
402
- return el('section', { class: 'card', 'data-rp-section': 'sent' }, head, sent.length ? el('ul', { class: 'hx' }, sent.map((e) => el('li', null, el('span', { class: 'chip2' }, c3ic('out', 'sm'), e.recipient || e.channel), el('span', null, (e.subject || e.body.split('\n')[0]), el('small', null, e.channel)), el('span', { class: 'w' }, e.state))))
403
- : el('div', { class: 'fold' }, c3ic('check', 'sm'), 'Nothing has been sent. No channel is connected, so nothing can go out yet.'));
404
- }
405
- function truthBlock(inst, ctx) {
406
- const R = rx();
407
- const sec = el('section', { class: 'card', 'data-rp-section': 'who-holds-what' }, el('h3', null, c3ic('user'), 'Who holds what ', el('span', { class: 'dim', style: 'text-transform:none;letter-spacing:0' }, 'told against true now')));
408
- if (R) {
409
- sec.appendChild(el('ul', { class: 'hx' }, R.TRUTH.map((x) => { const cur = !x[4] || inst.csent.c1;
410
- return el('li', { 'data-person': x[0], 'data-state': cur ? 'in sync' : 'stale' }, el('span', { class: 'chip2', style: 'color:' + (cur ? 'var(--success)' : 'var(--destructive)') }, c3ic(cur ? 'check' : 'alert', 'sm'), x[0]),
411
- el('span', null, 'Told: ' + x[2], el('small', null, 'Now: ' + x[3] + (cur ? '' : ' · ' + x[4] + ' days apart'))), el('span', { class: 'w' }, x[1])); })));
412
- return sec;
413
- }
414
- const rows = (ctx && ctx.reportFacts && ctx.reportFacts.truthTable) || [];
415
- if (!rows.length) { sec.appendChild(el('div', { class: 'fold' }, c3ic('check', 'sm'), 'No message has told anyone a claim yet.')); return sec; }
416
- const tone = (s) => (s === 'contradicted' ? 'var(--destructive)' : s === 'stale' ? 'var(--warning)' : 'var(--success)');
417
- sec.appendChild(el('ul', { class: 'hx' }, rows.flatMap((p) => p.claims.map((c) => el('li', { 'data-person': p.person, 'data-state': c.state },
418
- el('span', { class: 'chip2', style: 'color:' + tone(c.state) }, c3ic(c.state === 'contradicted' || c.state === 'stale' ? 'alert' : 'check', 'sm'), p.person),
419
- el('span', null, c.text || c.id, el('small', null, c.state)), el('span', { class: 'w' }, c.state))))));
420
- return sec;
421
- }
422
- const guardCard = () => el('section', { class: 'card', 'data-rp-section': 'guardrails' }, el('h3', null, c3ic('shield'), 'Guardrails'),
423
- el('ul', { class: 'chgl' }, ['External messages need your approval. They are never sent automatically.', 'A claim line with no label or ticket key blocks the slide.', 'Every message is logged with what it said.', 'With no channel connected nothing is sent, and the page says so.'].map((t) => el('li', { class: 'ok' }, c3ic('check', 'sm'), el('span', null, t)))));
424
-
425
- /* ── the page ── */
426
- function draw(inst, ctx) {
427
- const root = inst.root;
428
- inst.cleanups.splice(0).forEach((f) => { try { f(); } catch { /* a detach that fails changes nothing */ } });
429
- if (inst.error) { root.replaceChildren(el('div', { class: 'fold w', role: 'alert' }, c3ic('alert', 'sm'), inst.error)); return; }
430
- if (!inst.families) { root.replaceChildren(el('div', { class: 'fold a', role: 'status' }, el('span', { class: 'c3spin' }, c3ic('spark', 'sm')), 'Reading the report families.')); return; }
431
- const R = rx();
432
- if (R && !inst.hist) inst.hist = JSON.parse(JSON.stringify(R.HIST));
433
- const fam = famOf(inst);
434
- const badges = ctx && ctx.reportFacts && ctx.reportFacts.badges;
435
- const draftN = R ? R.COMMS.filter((c) => !inst.csent[c.id] && !inst.chold[c.id]).length : (badges && badges.communications) || 0;
436
- const seg = el('div', { class: 'seg', role: 'group', 'aria-label': 'Report type', 'data-rp-section': 'families' }, inst.families.map((f) => el('button', { type: 'button', 'data-a': 'rfam', 'data-family': f.id, 'aria-pressed': String(f.id === inst.sel), 'aria-current': f.id === inst.sel ? 'true' : null,
437
- title: f.intent + ' · ' + f.cadence, onClick: () => pick(inst, ctx, f) }, c3ic(FAM_ICON[f.id] || 'doc', 'sm'), f.name, f.id === 'communications' && draftN ? [' ', el('span', { class: 'bdg' }, String(draftN))] : null)));
438
- const bar = el('div', { class: 'calbar', style: 'flex-wrap:wrap' }, seg,
439
- fam ? el('div', { class: 'chips2', role: 'group', 'aria-label': fam.name + ' variants' }, variantsOf(inst, fam).map((v) => el('button', { type: 'button', class: 'pill', 'data-a': fam.id === 'periodic' ? 'rsel' : 'raud', 'data-variant': v.id, 'aria-pressed': String(v.id === inst.variant), onClick: () => { inst.variant = v.id; inst.draft = null; inst.draftErr = null; if (!R) { inst.check = null; draw(inst, ctx); runCheck(inst, ctx); } else draw(inst, ctx); } }, v.name))) : null);
440
- let body = el('div', { class: 'fold' }, c3ic('check', 'sm'), 'No report family is defined.');
441
- if (fam) {
442
- const key = keyOf(inst, fam); const vr = variantOf(inst, fam); const rep = repOf(inst, fam);
443
- const secs = sectionsOf(inst, fam, ctx);
444
- const q = readyOf(inst, key, secs);
445
- const audName = R ? (fam.id === 'periodic' ? rep.aud : vr.name) : (vr.name || fam.name);
446
- const repName = R && rep ? rep.n : fam.name;
447
- const comms = { drafts: draftN, sent: R ? R.COMMS.filter((c) => inst.csent[c.id]).length : 0 };
448
- const hd = R ? R.info(fam.id, repIdOf(inst, fam), audName, q, comms) : null;
449
- const traced = secs.filter((s) => s.st === 'ok').length;
450
- const head = el('div', { class: 'lh' }, el('span', { class: 'ki' }, c3ic(FAM_ICON[fam.id] || 'doc')),
451
- el('div', { style: 'min-width:0' }, el('b', null, hd ? hd.h : fam.name + ': ' + traced + ' of ' + secs.length + ' sections traced'), el('div', { class: 'dim', 'data-rp-section-purpose': '' }, hd ? hd.s : fam.purpose)),
452
- hd ? c3ring(hd.p[0], Math.max(1, hd.p[1]), 44) : c3ring(traced, Math.max(1, secs.length), 44, traced + '/' + secs.length));
453
- const F = R ? R.FAMS[fam.id] : null;
454
- const facts = el('div', { class: 'lkrow' }, [['target', 'Purpose', F ? F.purpose : fam.purpose], ['user', 'Audience', F ? F.aud : fam.variants.map((v) => v.audience).join(', ')], ['bolt', 'Intent', F ? F.intent : fam.intent], ['cal', 'Cadence', F ? F.cad : fam.cadence]]
455
- .map((x) => el('span', { class: 'chip2', title: x[2] }, c3ic(x[0], 'sm'), el('b', { style: 'font-weight:600' }, x[1]), ' ' + String(x[2] || '').slice(0, 38))));
456
- const c = inst.check;
457
- const notes = !R && c ? [...(c.reasons || []).map((t) => el('div', { class: 'fold w', 'data-blocked': '' }, c3ic('alert', 'sm'), t)), ...(c.warnings || []).map((t) => el('div', { class: 'fold w' }, c3ic('info', 'sm'), t))] : [];
458
- /* the report card: a row per section, then Send */
459
- const doc = el('section', { class: 'card sect', 'data-rp-section': 'family', 'aria-label': fam.name },
460
- el('div', { class: 'sh2' }, el('h2', null, c3ic('doc', 'sm'), repName + ' ', R ? el('span', { class: 'chip2' }, c3ic('user', 'sm'), audName) : el('span', { class: 'bdg g' }, String(secs.length)), R ? null : dim(vr.name)),
461
- el('span', { class: 'chips2' }, el('button', { type: 'button', class: 'ib sm', 'data-a': 'docopen', title: 'Open as a document to edit by hand or ask the agent', 'aria-label': 'Open as a document to edit by hand or ask the agent', onClick: () => openReportDoc(inst, ctx, { fam, path: pathOf(inst, fam), name: repName + ' for ' + audName, aud: audName, repName, secs: secs.filter((s) => decOf(inst, key, s.id) !== 'cut') }) }, c3ic('notes', 'sm')))),
462
- el('ul', { class: 'list' }, secs.length ? [...secs.map((s) => sectionRow(inst, ctx, fam, key, s, (x) => openReportDoc(inst, ctx, { fam, path: pathOf(inst, fam), name: repName + ' for ' + audName, aud: audName, repName, secs: secs.filter((q) => decOf(inst, key, q.id) !== 'cut'), mode: 'ask', prompt: fixPrompt(x) }))), sendRow(inst, ctx, fam, key, secs, q, audName, repName, vr)] : el('li', { class: 'fold' }, c3ic('check', 'sm'), 'This family has no sections.')),
463
- el('div', { class: 'pgl' }, R ? [el('span', null, 'swipe right: approve'), el('span', null, 'swipe left: cut'), el('span', null, 'tap: where it comes from')] : [el('span', null, 'tap: where it comes from'), el('span', null, 'approve and cut: off, no record stores them')]),
464
- notes.length ? el('div', { 'data-rp-section': 'check-notes', style: 'display:grid;gap:var(--sp-2)' }, notes) : null);
465
- const rf = (ctx && ctx.reportFacts) || {};
466
- const sctx = { goInit: (id) => { if (ctx && ctx.openInitiative) ctx.openInitiative(ctx.repo, id); } };
467
- const left = [(ctx && ctx.plan) || null];
468
- let right = [];
469
- if (R && fam.id === 'communications') { left.push(commsQueue(inst, ctx, fam)); right = [truthBlock(inst, ctx), el('section', { class: 'card', 'data-rp-section': 'channels' }, el('h3', null, c3ic('out'), 'Channels'), bars(R.CHANNELS)), guardCard(), sentCard(inst, fam)]; }
470
- else {
471
- if (R && R.REPORTS[fam.id] && fam.id !== 'periodic') left.push(reportsList(inst, ctx, fam, R.REPORTS[fam.id], repIdOf(inst, fam)));
472
- left.push(doc);
473
- if (fam.id === 'project') { const rp = repOf(inst, fam); const nm = (R && R.INM) || {}; right.push((ctx && ctx.portfolio) || null, forecastChecksCard(rp && rp.i ? { id: rp.i, title: nm[rp.i] || String(rp.n || '').replace(/ status$/, '') } : {})); }
474
- if (fam.id === 'product') right.push(strategyPanel('north', sctx, { view: 'year', plain: true }), strategyPanel('outcomes', sctx)); // the mockup's product report (line 4345): north star, quarter outcomes, then the benchmark
475
- if (R && fam.id === 'product') right.push(el('section', { class: 'card', 'data-rp-section': 'benchmark' }, el('h3', null, c3ic('report'), 'Benchmark ', el('span', { class: 'dim', style: 'text-transform:none;letter-spacing:0' }, 'checkout conversion')), bars(R.BENCH)));
476
- if (R && fam.id === 'periodic') right.push(el('section', { class: 'card', 'data-rp-section': 'rhythm' }, el('h3', null, c3ic('cal'), 'Rhythm ', el('span', { class: 'dim', style: 'text-transform:none;letter-spacing:0' }, 'next due')),
477
- el('ul', { class: 'hx' }, R.REPORTS.periodic.map((x) => el('li', null, el('span', { class: 'chip2', style: 'color:' + (x.pct >= 0.8 ? 'var(--success)' : 'var(--acc)') }, c3ic('doc', 'sm'), Math.round(x.pct * 100) + '%'), el('span', null, x.n, el('small', null, x.cad + ' · ' + x.aud)), el('span', { class: 'w' }, x.due))))));
478
- right.push(claimsCard(secs));
479
- if (fam.id === 'communications') right.push(truthBlock(inst, ctx), guardCard());
480
- right.push(sentCard(inst, fam));
481
- if (R && fam.id === 'periodic') right.push(el('section', { class: 'card', 'data-rp-section': 'questions' }, el('h3', null, c3ic('reply'), 'Open questions from readers'), el('ul', { class: 'chgl' }, R.QUESTIONS.map((t) => el('li', { class: 'warn' }, c3ic('reply', 'sm'), el('span', null, t))))));
482
- }
483
- body = el('div', null, head, facts, el('div', { class: 'brief sbb' }, el('div', { class: 'bcols' }, el('div', { class: 'bcol l' }, left), el('div', { class: 'bcol r' }, right))));
484
- }
485
- root.replaceChildren(el('div', { class: 'calwrap' }, bar, el('div', { class: 'calbody' }, body)));
486
- /* in demo the shell's own outbox host would repeat the Communications queue the page now draws */
487
- const oh = inst.host.parentNode && inst.host.parentNode.querySelector && inst.host.parentNode.querySelector('[data-c3pg="outbox-host"]');
488
- if (oh) { if (R) oh.setAttribute('data-rp-hide', ''); else oh.removeAttribute('data-rp-hide'); }
489
- }
490
-
491
- export function mountReportFamilies(host, ctx) {
492
- let inst = insts.get(host);
493
- if (!inst) { inst = make(host); insts.set(host, inst); inst.stopPhone = c3Phone(inst.root); }
494
- ensureC3Css();
495
- if (inst.root.parentNode !== host) host.replaceChildren(inst.root);
496
- if (ctx && ctx.FIXTURE) { inst.root.replaceChildren(el('div', { class: 'fold' }, c3ic('info', 'sm'), 'Report families are not shown in fixture mode.')); return; }
497
- if (!inst.families && !inst.loading) { inst.loading = true; draw(inst, ctx); load(inst, ctx).finally(() => { inst.loading = false; }); } else draw(inst, ctx);
498
- }
499
-
500
- export function disposeReportFamilies(host) {
501
- const inst = insts.get(host);
502
- if (!inst) return;
503
- inst.seq++; inst.cleanups.splice(0).forEach((f) => { try { f(); } catch { /* nothing */ } });
504
- if (inst.stopPhone) inst.stopPhone(); inst.root.remove(); insts.delete(host);
505
- }