create-pmos 0.401.0 → 0.403.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 (127) hide show
  1. package/package.json +25 -30
  2. package/payload/KIT-VERSION +2 -2
  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/payload/state/log.md +1 -1
  7. package/workspace/board-programs-test.js +227 -0
  8. package/workspace/board-shot.js +54 -0
  9. package/workspace/briefing-premium-adddoc-test.js +28 -22
  10. package/workspace/briefing-premium-board-test.js +107 -82
  11. package/workspace/briefing-premium-calendar-2-test.js +23 -10
  12. package/workspace/briefing-premium-calendar-3-test.js +23 -19
  13. package/workspace/briefing-premium-calendar-test.js +20 -15
  14. package/workspace/briefing-premium-initiative-test.js +25 -12
  15. package/workspace/briefing-premium-insights-test.js +31 -18
  16. package/workspace/briefing-premium-metrics-test.js +8 -8
  17. package/workspace/briefing-premium-sources-test.js +15 -10
  18. package/workspace/briefing-premium-test.js +39 -16
  19. package/workspace/changelog.json +24 -0
  20. package/workspace/fixtures/board-premium-facts.js +20 -3
  21. package/workspace/fixtures/briefing-premium-facts.js +18 -2
  22. package/workspace/fixtures/premium-viewer-fixtures.js +24 -2
  23. package/workspace/fixtures/program-ascent.js +101 -0
  24. package/workspace/guide/home.md +11 -7
  25. package/workspace/guide/index.md +1 -0
  26. package/workspace/guide/jira.md +38 -6
  27. package/workspace/guide/programs.md +37 -0
  28. package/workspace/home-rows-test.js +184 -0
  29. package/workspace/lib/briefing-premium-products.js +4 -4
  30. package/workspace/lib/briefing-premium.js +2 -2
  31. package/workspace/lib/calendar-layers.js +8 -4
  32. package/workspace/lib/initiative-layout.js +4 -3
  33. package/workspace/lib/jira-cli.js +17 -12
  34. package/workspace/lib/jira-status.js +1 -1
  35. package/workspace/lib/jira-tickets.js +126 -24
  36. package/workspace/lib/meeting-files.js +58 -0
  37. package/workspace/lib/meeting-learn.js +139 -0
  38. package/workspace/lib/meeting-material.js +12 -5
  39. package/workspace/lib/notes.js +3 -0
  40. package/workspace/lib/programs.js +129 -0
  41. package/workspace/lib/route-modules.js +1 -0
  42. package/workspace/lib/routes-brief-page.js +8 -1
  43. package/workspace/lib/routes-briefing-premium.js +1 -1
  44. package/workspace/lib/routes-calendar-views.js +24 -3
  45. package/workspace/lib/routes-meeting-material.js +38 -0
  46. package/workspace/lib/routes-meeting-points.js +23 -3
  47. package/workspace/lib/routes-programs.js +122 -0
  48. package/workspace/package-lock.json +2 -2
  49. package/workspace/package.json +1 -1
  50. package/workspace/premium-board-actions-test.js +31 -25
  51. package/workspace/premium-chat-context-test.js +1 -1
  52. package/workspace/premium-chat-goal-view-test.js +1 -1
  53. package/workspace/premium-chat-viewer-test.js +1 -1
  54. package/workspace/premium-core-doc-issue-test.js +13 -7
  55. package/workspace/premium-discuss-landing-test.js +83 -0
  56. package/workspace/premium-link-suggest-test.js +103 -0
  57. package/workspace/premium-report-read-test.js +86 -82
  58. package/workspace/premium-vw-backlog-test.js +6 -5
  59. package/workspace/premium-vw-cal-test.js +45 -19
  60. package/workspace/premium-vw-item-test.js +8 -6
  61. package/workspace/premium-vw-jira-test.js +3 -2
  62. package/workspace/premium-vw-meet-test.js +122 -66
  63. package/workspace/premium-vw-notes-test.js +7 -6
  64. package/workspace/premium-vw-rec-test.js +14 -13
  65. package/workspace/premium-vw-slides-test.js +11 -5
  66. package/workspace/program-panel-test.js +152 -0
  67. package/workspace/public/pm/bd-acts.js +24 -15
  68. package/workspace/public/pm/bd-asks.js +111 -30
  69. package/workspace/public/pm/bd-ini-panel.js +229 -0
  70. package/workspace/public/pm/bd-pop.js +2 -2
  71. package/workspace/public/pm/bd-prog-panel.js +436 -0
  72. package/workspace/public/pm/bd-prog.js +191 -0
  73. package/workspace/public/pm/bd-span.js +98 -15
  74. package/workspace/public/pm/bd-views.js +93 -29
  75. package/workspace/public/pm/cozy-board.css +214 -20
  76. package/workspace/public/pm/cozy-evui.js +4 -2
  77. package/workspace/public/pm/cozy-home-rows.css +54 -0
  78. package/workspace/public/pm/cozy-home.css +35 -0
  79. package/workspace/public/pm/cozy-insights.css +1 -2
  80. package/workspace/public/pm/cozy-mtg-present.css +160 -0
  81. package/workspace/public/pm/cozy-panel.css +155 -0
  82. package/workspace/public/pm/cozy-rec-pill.css +12 -0
  83. package/workspace/public/pm/cozy-rec-pill.js +46 -0
  84. package/workspace/public/pm/cozy-today.css +189 -0
  85. package/workspace/public/pm/cozy-viewer.js +307 -43
  86. package/workspace/public/pm/cozy-vw-mtg.css +96 -94
  87. package/workspace/public/pm/cozy-vw-rp.css +40 -25
  88. package/workspace/public/pm/cozy-vw-shell.css +127 -0
  89. package/workspace/public/pm/cozy-xv.css +51 -0
  90. package/workspace/public/pm/cozy-xv.js +34 -0
  91. package/workspace/public/pm/home-app.js +192 -72
  92. package/workspace/public/pm/home-chat.js +17 -4
  93. package/workspace/public/pm/home-data.js +1 -1
  94. package/workspace/public/pm/home-day.js +64 -0
  95. package/workspace/public/pm/home-ini-model.js +1 -1
  96. package/workspace/public/pm/home-ini.js +197 -54
  97. package/workspace/public/pm/home-list.js +100 -27
  98. package/workspace/public/pm/home-mentions.js +187 -0
  99. package/workspace/public/pm/home-rec-row.js +67 -0
  100. package/workspace/public/pm/home-review.js +20 -10
  101. package/workspace/public/pm/home-task.js +19 -18
  102. package/workspace/public/pm/home-today.js +137 -59
  103. package/workspace/public/pm/premium-board.js +294 -288
  104. package/workspace/public/pm/premium-insights.js +118 -82
  105. package/workspace/public/pm/premium-mtg-present.js +408 -100
  106. package/workspace/public/pm/premium-mtg-replay.js +70 -10
  107. package/workspace/public/pm/premium-report-read.js +118 -63
  108. package/workspace/public/pm/premium-vw-cal.js +62 -34
  109. package/workspace/public/pm/premium-vw-mtg.js +348 -192
  110. package/workspace/public/pm/program-model.js +192 -0
  111. package/workspace/public/pm/rec-state.js +63 -0
  112. package/workspace/public/pm/rp-parts.js +33 -8
  113. package/workspace/public/pm/tk-draft.js +107 -0
  114. package/workspace/public/pm/tk-model.js +134 -0
  115. package/workspace/public/pm/tk-send.js +124 -0
  116. package/workspace/public/pm/tk-tasks.css +120 -0
  117. package/workspace/public/premium-board.html +4 -2
  118. package/workspace/server.js +4 -2
  119. package/workspace/skills/jira-push.skill +3 -3
  120. package/workspace/test-lists/board-programs.json +9 -0
  121. package/workspace/test-lists/prd-to-jira.json +6 -0
  122. package/workspace/test-lists/program-hierarchy.json +11 -0
  123. package/workspace/test-lists/program-panel.json +9 -0
  124. package/workspace/test-lists/viewer-home-rows.json +9 -0
  125. package/workspace/test-lists/viewer-meetings.json +9 -0
  126. package/workspace/test-lists/viewer-shell-a.json +15 -0
  127. package/workspace/tk-tasks-test.js +199 -0
@@ -1,18 +1,17 @@
1
- /* pm/premium-vw-mtg.js — a meeting in the Viewer (initiative premium-agreed-design, area viewer; redesigned by premium-uncovered-features, area
2
- * meetings: MtReplay, MtFocus, MtMaterial, MtAfter, MtNotes and MtPhone.dc.html).
3
- * Head the title, then one line: the day, the time, the length and who is in it. Beside it: the state (Starts in 30 min, Recording),
4
- * the series "‹ 4 of 4 ›" (or "Not in a series"), what it is about (a dashed "What it is about" when it is not linked), Record
5
- * before the meeting, and ⋯ (Copy as Markdown, New meeting, What Record and Focus do).
6
- * Recording while it records, one line in the head: Recording · 12:04 with Highlight, Pause and Stop; "Recording paused at 12:04 · nothing
7
- * is kept while paused" with Resume and Stop; and a warning when the sound stopped or the recording was off for a while.
8
- * Tabs before the meeting none: the prep (Prepared for you, What it is for, What matters today, Agenda, Material, Previous meetings).
9
- * While it records: Live notes | Focus | Transcript. After it: Notes | Replay | Transcript (Replay when it was recorded).
10
- * Focus: Now · topic N of M with Change topic, what was said so far, the agenda with the minutes used, the material with
11
- * Present (a deck: the presenter view, premium-mtg-present.js) and Add material.
12
- * Replay: premium-mtg-replay.js. Notes: the summary, Since the last one, decisions, next steps (Make task, with "Task made ·
13
- * added to <initiative>, under <stage>" and Undo; a work-item through the ticket button), facts, open questions, and the prep.
14
- * Popovers Add material (suggested for this meeting, Find in PMOS, Paste a link, the topic and the series), What it is about (find an
15
- * initiative, suggested from the notes, or the product, the whole portfolio, or leave it out), the series (take it out, put it back).
1
+ /* pm/premium-vw-mtg.js — a meeting in the Viewer (Viewer kit, meetings: XvAPrep, XvALive, XvAMaterial, XvAMaterialPreview, XvAReplay,
2
+ * XvAReplayEdit, XvAPhMeet), in shell A (cozy-viewer.js): the summary first, then folding rows. The title is the header's, once.
3
+ * Before the summary: "Starts in 45 min", what changed since last time, "About <initiative> · 2 people · 3 of 4 ready" and Record
4
+ * (an icon: a red dot). Rows: Agenda (open), What matters today, To be ready, Material, Last time.
5
+ * Recording the summary: "Recording · 12:40" (red), "Now on: <topic>, topic 2 of 3.", the app, and the icons Stop (red), Highlight and
6
+ * Pause; paused: Resume and Stop. A warning line when the sound stopped or the recording was off. Rows: Your notes (open),
7
+ * Caught so far, Material (open), Highlights, Agenda (Change topic, minutes used), Transcript. The summary stays while it records.
8
+ * After recorded: "6 of 15 points kept · 2 to confirm" with Confirm 2, the Replay card (player, "In this part"), then All N kept,
9
+ * Next steps (Make task, work-item), Since the last one, Facts, Prep and material, Transcript. Not recorded: Next steps,
10
+ * Decisions, Open questions and the rest. Pressing a key point corrects it (premium-mtg-replay.js editHtml; lib/meeting-learn.js).
11
+ * Material a row per item. The row opens a preview only you see (back with ←); the icon presents it (premium-mtg-present.js). Add
12
+ * material: Upload a file, Paste a link, Find in PMOS, the suggestions, the topic and the series.
13
+ * ⋯ Change what it is about, the meeting before and after, Copy as Markdown, New meeting, Listen to another app, Pause screen
14
+ * shots, What Record and Focus do, Not part of this series, Make this note private (last: it deletes).
16
15
  *
17
16
  * WHERE EACH PART COMES FROM (nothing is invented; a part the answers do not hold is left out or says so):
18
17
  * GET /api/notes, /api/notes/one the note, its transcript, highlights, body, speakers, screen shots, its place in a series
@@ -26,19 +25,21 @@
26
25
  * WRITES (each a press): Record, Pause, Resume, Stop and Highlight through the page's recorder (premium-meeting.js recCore); POST
27
26
  * /api/notes/save (Your notes), /api/notes/private, /api/notes/speaker (naming a speaker), /api/notes/series-member, /api/notes/link or
28
27
  * /api/calendar-links (About), /api/viewer-meeting/agenda|capture|work-item, /api/plan-items (Make task), /api/meeting-material (Add material,
29
- * Remove), /api/meeting-focus/topic (Change topic), /api/meeting-points (Confirm, Not right).
28
+ * Remove), /api/meeting-material/file (Upload a file), /api/meeting-focus/topic (Change topic), /api/meeting-points (Confirm, Not right),
29
+ * /api/meeting-points/edit (a correction, and what PMOS learns from it).
30
30
  *
31
31
  * meetModel(D, now) → the view model (pure; for the unit suite)
32
32
  * meetHtml(model, ui) → the card's body (pure)
33
33
  * mdOf(model) → the note as Markdown, for Copy as Markdown (pure)
34
34
  * aboutOptions(row | null, W | null, choices | null, notesText) → the What it is about choices (pure)
35
35
  * openMeeting(ref, { ws }) → opens the card. ref: a note id, { note }, { event, date }, a calendar week row or a brief-page today row. */
36
- import { open as vOpen, current as vCur } from './cozy-viewer.js';
37
- import { pmGet, pmPost } from './http.js';
36
+ import { open as vOpen, current as vCur, back as vBack, czSummary, czSections } from './cozy-viewer.js';
37
+ import { pmGet, pmPost, pressFetch } from './http.js';
38
38
  import { noteSheet, aboutChoices, aboutBody, aboutNow } from './premium-vw-meet.js';
39
39
  import { weekView, noteOfRow, sameMeeting, recordable, prevOf, taskEvent, linkBody, mmss, focusView, replayModel, RECORD_LINE, FOCUS_LINE, STOP_LINE, CONSENT_LINE, recCore } from './premium-meeting.js';
40
40
  import { APPS, recall, remember } from './listen-sources.js';
41
- import { replayView, replayHtml } from './premium-mtg-replay.js';
41
+ import { replayView, playerHtml, partHtml, keptHtml, phoneHtml, editHtml, mentions, phraseOf as phraseOfPage } from './premium-mtg-replay.js';
42
+ import { announce } from './rec-state.js';
42
43
 
43
44
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"]/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' }[c]));
44
45
  const clip = (s, n) => { const t = String(s == null ? '' : s).replace(/\s+/g, ' ').trim(); return t.length > n ? t.slice(0, n - 1) + '…' : t; };
@@ -72,7 +73,6 @@ export const EMPTY_NOTES = 'The summary, decisions and next steps are written wh
72
73
  export const LIVE_FOOT = 'Transcribed on this machine. Audio and notes stay here.';
73
74
  export const MINE_HINT = 'Type here. Your lines are kept with the transcript.';
74
75
  export const PRIVATE_TEXT = 'Private: keep only what I type. Audio and transcript are deleted.';
75
- const KIND = { 'pmos-deck': 'Deck', 'pmos-doc': 'Doc', report: 'Report', gdoc: 'Google doc', conf: 'Confluence', link: 'Link' };
76
76
  /** The key of a next step: the first 8 hex of a hash of its words, as lib/viewer-meeting.js stepKey (sha256) — the server sends the keys it
77
77
  * knows, so the page matches on the text it sent. The page keeps the text → key map from the answer of /api/viewer-meeting. */
78
78
  const norm = (t) => String(t || '').toLowerCase().replace(/\s+/g, ' ').trim();
@@ -120,6 +120,21 @@ export function gapsOf(n, now = Date.now()) {
120
120
  return out;
121
121
  }
122
122
 
123
+ const MAT_WORD = { 'pmos-deck': 'PMOS deck', 'pmos-doc': 'PMOS document', report: 'PMOS report', slides: 'Google Slides', gdoc: 'Google Doc', conf: 'Confluence', link: 'Website' };
124
+ const FILE_WORD = { image: 'Image', pdf: 'PDF', html: 'HTML file', pptx: 'PowerPoint file' };
125
+ const MAT_ICON = { 'pmos-deck': 'deck', slides: 'deck', 'pmos-doc': 'doc', gdoc: 'doc', conf: 'doc', report: 'prod', link: 'link', image: 'img', pdf: 'doc', html: 'link', pptx: 'deck' };
126
+ /** A material row as the Viewer lists it (XvAMaterial): its kind in words, where it comes from, and whether Present can show it. */
127
+ export function matRow(m) {
128
+ const k = (m && m.kind) || 'link', file = k === 'file' ? String(m.file || '') : '';
129
+ const word = file ? FILE_WORD[file] || 'File' : MAT_WORD[k] || 'Website';
130
+ const how = file ? 'uploaded' + (m.by ? ' by ' + clip(m.by, 30) : m.from === 'you' ? ' by you' : '') : k === 'link' ? 'opens live' : LINKS.has(k) ? 'link' : '';
131
+ const count = k === 'pmos-deck' && Number(m.slides) ? plural(Number(m.slides), 'slide') : '';
132
+ const sub = [word, how, count, m.topic ? 'for ' + clip(m.topic, 60) : '', m.scope === 'series' ? 'every meeting of the series' : ''].filter(Boolean).join(' · ');
133
+ return { kind: word, title: clip(m.title || m.ref || m.url, 120), sub, url: m.url || '', ref: m.ref || '', mkind: k, file, ws: m.ws || '', scope: m.scope || 'meeting', topic: m.topic || '',
134
+ id: m.id || '', icon: MAT_ICON[file || k] || 'doc', deck: k === 'pmos-deck', slides: Number(m.slides) || 0, present: file !== 'pptx' };
135
+ }
136
+ const LINKS = new Set(['slides', 'gdoc', 'conf']);
137
+
123
138
  /** The view model. D = { row, n (the raw note), S (noteSheet), F (the meeting-focus answer), rep (replayModel), vm (the viewer-meeting answer),
124
139
  * prev (prevOf), about, people, rec: { held, started }, elapsed (ms heard so far), frames (screen shots kept), canRecord, app, steps, points } */
125
140
  export function meetModel(D, now = Date.now()) {
@@ -145,7 +160,6 @@ export function meetModel(D, now = Date.now()) {
145
160
  const primary = mk === 'prep' && D.canRecord ? { k: 'record', label: 'Record' } : null;
146
161
  const series = S && S.series ? { title: S.series.title || title, pos: S.series.pos, count: S.series.count, prev: S.series.prev, next: S.series.next } : null;
147
162
  const seriesOff = !!(S && S.seriesOff);
148
- const menu = (mk === 'notes' ? ['copy', 'fresh'] : ['fresh']).concat(['why']).map((k) => ({ k, label: MENU[k][0], sub: MENU[k][1] }));
149
163
  /* the head's line: day · time · length · people */
150
164
  const len = ok(at) && ok(end) ? Math.round((Date.parse(end) - Date.parse(at)) / 60000) : 0;
151
165
  const heardMin = mk === 'notes' ? Math.round(((rep && rep.len) || (S && S.minutes * 60000) || 0) / 60000) : 0;
@@ -155,7 +169,7 @@ export function meetModel(D, now = Date.now()) {
155
169
  const sub = [mk === 'live' ? 'Live' : dayWord(at, now), hasTime(at) ? (mk === 'live' && hasTime(end) ? hm(at) + ' to ' + hm(end) : hm(at)) : '',
156
170
  heardMin ? heardMin + ' min' : len > 0 && len < 1440 ? len + ' min' : '', peopleText(people)].filter(Boolean).join(' · ');
157
171
  /* prep */
158
- const mats = (F && Array.isArray(F.material) ? F.material : []).map((m) => ({ kind: KIND[m.kind] || (m.kind ? String(m.kind) : 'Link'), title: clip(m.title || m.ref || m.url, 120), sub: [m.topic ? 'For ' + clip(m.topic, 60) : '', m.scope === 'series' ? 'every meeting of the series' : m.from === 'you' ? 'added by you' : m.from ? 'from ' + m.from : ''].filter(Boolean).join(' · ') || 'For the meeting', url: m.url || '', ref: m.ref || '', mkind: m.kind || '', ws: m.ws || '', scope: m.scope || 'meeting', topic: m.topic || '', deck: m.kind === 'pmos-deck', slides: Number(m.slides) || 0 }));
172
+ const mats = (F && Array.isArray(F.material) ? F.material : []).map(matRow);
159
173
  const brief = (F && F.brief) || null;
160
174
  const prev = D.prev || [];
161
175
  const carried = (S && S.carriedIn && S.carriedIn.items) || [];
@@ -203,11 +217,17 @@ export function meetModel(D, now = Date.now()) {
203
217
  const since = S && S.since ? { sub: S.since.day.replace(/^\w+ /, '') + ' · ' + plural(S.since.items.length, 'step') + ' then, ' + S.since.fresh.length + ' new',
204
218
  rows: S.since.items.map((x) => ({ tag: x.state === 'done' ? 'Done' : x.state === 'again' || x.state === 'raised' ? 'Raised again' : 'Not mentioned', k: x.state === 'done' ? 'ok' : x.state === 'again' || x.state === 'raised' ? 'warn' : '', text: x.text, owner: x.owner }))
205
219
  .concat(S.since.fresh.map((x) => ({ tag: 'New', k: 'new', text: x.text, owner: x.owner }))) } : null;
206
- const replay = rep ? replayView(rep, { n, points: D.points || {}, now }) : null;
220
+ const replay = rep ? replayView(rep, { n, points: D.points || {}, edits: D.edits || {}, lessons: D.lessons || [], now }) : null;
207
221
  const trk = rep ? { len: rep.len } : null;
208
222
  const decided = S ? S.decisions.length : 0, nsteps = steps.length, nq = S ? S.questions.length : 0;
209
- const tabs = mk === 'live' ? [['notes', 'Live notes'], ['focus', 'Focus'], ['tr', 'Transcript']]
210
- : mk === 'notes' ? [['notes', 'Notes']].concat(replay ? [['replay', 'Replay']] : [], [['tr', 'Transcript']]) : [];
223
+ /* ⋯ (xvMore order: change it, look back, then stop or remove last) */
224
+ const more = [{ k: 'about', label: D.about ? 'Change what it is about' : 'Link it to an initiative' }]
225
+ .concat(series && series.prev ? [{ k: 'prev', label: 'The meeting before · ' + (series.prev.day || '') }] : [], series && series.next ? [{ k: 'next', label: 'The meeting after · ' + (series.next.day || '') }] : [])
226
+ .concat(mk === 'notes' ? [{ k: 'copy', label: MENU.copy[0] }] : [], [{ k: 'fresh', label: MENU.fresh[0] }])
227
+ .concat(mk === 'live' && n ? [{ k: 'src', label: 'Listen to another app' }, { k: 'shots', label: capture.shots === 'paused' ? 'Resume screen shots' : 'Pause screen shots' }] : [])
228
+ .concat([{ k: 'why', label: MENU.why[0] }])
229
+ .concat(n && series ? [{ sep: true }, { k: 'serout', label: 'Not part of this series' }] : n && seriesOff ? [{ sep: true }, { k: 'serback', label: 'Put it back in its series' }] : [])
230
+ .concat(mk === 'live' && n && !n.private ? [{ k: 'priv', label: 'Make this note private', danger: true }] : []);
211
231
  const parts = [
212
232
  { k: 'prep', title: 'Prep and material', sub: mk === 'prep' ? 'Agenda, material and last time' : 'Prepared ' + (shortDay(at) || 'for this meeting') + ' · ' + mats.length + ' linked', empty: '' },
213
233
  { k: 'live', title: 'Transcript and live notes', sub: mk === 'live' ? mmss(el) + ' · ' + (liveK === 'rec' ? 'recording' : liveK === 'paused' ? 'paused' : 'not capturing') : mk === 'notes' ? Math.max(1, heardMin || Math.round(el / 60000)) + ' min · ' + plural(lines.length, 'line') : 'Starts when you record', empty: mk === 'prep' ? EMPTY_LIVE : '' },
@@ -216,8 +236,8 @@ export function meetModel(D, now = Date.now()) {
216
236
  const kind = mk === 'live' ? 'Meeting · recording' : mk === 'notes' ? 'Meeting notes' : 'Meeting prep';
217
237
  const head = title + ' · ' + (mk === 'live' ? 'now' : hasTime(at) ? (dayWord(at, now) === 'Today' ? (mk === 'notes' ? 'today ' : '') + hm(at) : shortDay(at) + ' ' + hm(at)) : shortDay(at) || 'note');
218
238
  return {
219
- mk, liveK, title, kind, head, noteId: n ? n.id : '', private: !!(n && n.private), at, end, sub, tabs, noNotes: mk === 'prep' && over && !n,
220
- chip, people, primary, menu, when, about: D.about || '', series, seriesOff, parts, recLine, gaps,
239
+ mk, liveK, liveMs: el, title, kind, head, noteId: n ? n.id : '', private: !!(n && n.private), at, end, sub, more, material: mats, noNotes: mk === 'prep' && over && !n,
240
+ chip, people, primary, when, about: D.about || '', series, seriesOff, parts, recLine, gaps,
221
241
  prep: { ready, readyText: ready.filter((r) => r.ok).length + ' of ' + ready.length + ' ready', purpose: clip(purpose, 300), gist: clip(brief && Array.isArray(brief.gist) ? brief.gist.join(' ') : '', 600), matters,
222
242
  agenda: ag.topics.map((t) => ({ n: t.n, text: t.text, min: t.min, set: !!t.set, key: ag.key })), agendaSub: ag.topics.length ? plural(ag.topics.length, 'topic') + (ag.total ? ' · ' + ag.total + ' min' : '') : '', agendaKey: ag.key,
223
243
  toBeReady: clip(prepText, 300), material: mats, prev },
@@ -266,11 +286,13 @@ export function aboutOptions(row, W, choices, text = '', cur = '') {
266
286
  const SV = { link: '<path d="M10 14a4 4 0 0 0 6 0l3-3a4 4 0 0 0-6-6l-1 1M14 10a4 4 0 0 0-6 0l-3 3a4 4 0 0 0 6 6l1-1"/>',
267
287
  prev: '<path d="M15 6l-6 6 6 6"/>', next: '<path d="M9 6l6 6-6 6"/>', chev: '<path d="M7 10l5 5 5-5"/>', flag: '<path d="M5 21V4h11l-2 4 2 4H5"/>',
268
288
  ser: '<path d="M4 6h16M4 12h16M4 18h10"/>', plus: '<path d="M12 5v14M5 12h14"/>', x: '<path d="M6 6l12 12M18 6L6 18"/>', find: '<path d="M11 4a7 7 0 1 0 0 14a7 7 0 1 0 0-14M20 20l-4-4"/>',
269
- pause: '<path d="M8 5v14M16 5v14"/>', stop: '<path d="M7 7h10v10H7z"/>', play: '<path d="M8 5v14l11-7z"/>', check: '<path d="M5 12.5l4.5 4.5L19 7.5"/>',
289
+ pause: '<path d="M9 6v12M15 6v12"/>', stop: '<rect x="7.5" y="7.5" width="9" height="9" rx="1.5"/>', play: '<path d="M8 5v14l11-7z"/>', check: '<path d="M5 12.5l4.5 4.5L19 7.5"/>',
270
290
  doc: '<path d="M7 3h7l5 5v13H7zM14 3v5h5"/>', deck: '<path d="M4 5h16v11H4zM12 16v4M8 20h8"/>', board: '<path d="M4 4h4v16H4zM10 4h4v10h-4zM16 4h4v13h-4z"/>',
271
- prod: '<path d="M5 20V11M12 20V5M19 20v-6"/>', ticket: '<path d="M4 7h16v4a2 2 0 0 0 0 4v4H4v-4a2 2 0 0 0 0-4z"/>', warn: '<path d="M12 4l9 16H3zM12 10v4M12 17v.01"/>', rec: '<circle cx="12" cy="12" r="6"/>' };
291
+ prod: '<path d="M5 20V11M12 20V5M19 20v-6"/>', ticket: '<path d="M4 7h16v4a2 2 0 0 0 0 4v4H4v-4a2 2 0 0 0 0-4z"/>', warn: '<path d="M12 4l9 16H3zM12 10v4M12 17v.01"/>',
292
+ rec: '<circle cx="12" cy="12" r="5"/>', star: '<path d="M12 3.8l2.5 5.2 5.7.8-4.1 4 1 5.7L12 16.8l-5.1 2.7 1-5.7-4.1-4 5.7-.8z"/>',
293
+ img: '<path d="M4 4.5h16v15H4zM9 10a1.6 1.6 0 1 0 0-.01M20 16l-5-5-8 8"/>', up: '<path d="M12 16V4M7 9l5-5 5 5M5 20h14"/>',
294
+ present: '<path d="M3 4h18v12H3zM10 8.5l4 2.5-4 2.5zM8 20h8M12 16v4"/>' };
272
295
  const svg = (k, w, extra) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24"${extra || ''}>${SV[k]}</svg>`;
273
- const dots = '<svg aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" class="vz-dots"><circle cx="5" cy="12" r="2"/><circle cx="12" cy="12" r="2"/><circle cx="19" cy="12" r="2"/></svg>';
274
296
  /* bars split by weight (live topics): an SVG, so each length is an attribute and not an inline style */
275
297
  function weightBar(cls, parts) {
276
298
  const tot = parts.reduce((a, x) => a + x.w, 0) || 1, gap = 1.2, room = 100 - gap * Math.max(0, parts.length - 1);
@@ -286,54 +308,79 @@ const lineHtml = (l, i, ui, seek) => {
286
308
  const t = seek && Number.isFinite(l.t) ? `<button type="button" class="vzm-t vz-hv" data-a="trseek" data-t="${l.t}" aria-label="Play from ${esc(mmss(l.t))}">${esc(mmss(l.t))}</button>` : `<time>${esc(mmss(l.t))}</time>`;
287
309
  return `<div class="vz-line">${t}<span>${who} ${esc(l.text)}</span></div>`;
288
310
  };
289
- const matIcon = (m) => svg(m.deck ? 'deck' : 'doc', 16);
311
+ /** A round press that the icon says (Record, Stop, Highlight, Pause, Resume): no words, the name is its label and its tooltip. */
312
+ const roundBtn = (a, label, icon, tone) => `<button type="button" class="vzm-rb" data-a="${a}" data-tone="${tone || ''}" aria-label="${esc(label)}" title="${esc(label)}">${svg(icon, tone === 'red' ? 22 : 17)}</button>`;
290
313
 
291
- function prepHtml(P, m) {
292
- const h = [];
293
- if (m.noNotes) h.push(`<div class="vzm-box vzm-mut">${esc(NO_NOTES)} <button type="button" class="vzm-btn vzm-card" data-a="m-fresh">New note</button></div>`);
294
- h.push(`<div class="vz-col"><p class="vzm-lbl">Prepared for you <small>${esc(P.readyText)}</small></p>${P.ready.map((r) => `<div class="vz-ready"><span class="vz-mk" data-k="${r.ok ? 'ok' : 'no'}" aria-hidden="true">${r.ok ? svg('check', 12) : '!'}</span><span><b>${esc(r.label)}</b> <em>${esc(r.text)}</em></span></div>`).join('')}</div>`);
295
- if (P.purpose) h.push(`<div><p class="vzm-lbl">What it is for</p><p class="vz-p">${esc(P.purpose)}</p></div>`);
296
- if (P.gist) h.push(`<div><p class="vzm-lbl">In short</p><p class="vz-p">${esc(P.gist)}</p></div>`);
297
- if (P.matters.length) h.push(`<div class="vz-col"><p class="vzm-lbl">What matters today</p>${P.matters.map((x) => `<div class="vz-tagrow"><span class="vz-tag" data-k="${x.k}">${esc(x.tag)}</span><span>${esc(x.text)} <small>${esc(x.meta)}</small></span></div>`).join('')}</div>`);
298
- h.push(`<div class="vz-col"><p class="vzm-lbl">Agenda <small>${esc(P.agendaSub)}</small></p>${P.agenda.length ? P.agenda.map((a, i) => `<div class="vz-ag"><i class="vz-num" aria-hidden="true">${a.n}</i><span>${esc(a.text)}</span><button type="button" class="vz-min vz-hv" data-a="min" data-i="${i}" title="Change the minutes for this topic" aria-label="${esc(a.text)}: ${a.min} minutes. Change">${a.min} min</button></div>`).join('') : '<p class="vz-empty">The invite lists no topics yet.</p>'}</div>`);
299
- if (P.toBeReady) h.push(`<div><p class="vzm-lbl">To be ready</p><p class="vz-p">${esc(P.toBeReady)}</p></div>`);
300
- h.push(materialHtml(P.material, m, false));
301
- h.push(`<div class="vz-col"><p class="vzm-lbl">Previous meetings <small>${P.prev.length ? P.prev.length + ' before this' : 'none kept'}</small></p>${P.prev.map((p) => `<button type="button" class="vz-prev vz-hv" data-a="note" data-id="${esc(p.id)}"><time>${esc(p.date)}</time><span>${esc(p.decided + ' decided · ' + plural(p.steps, 'next step') + (p.overview ? ' · ' + p.overview : ''))}</span></button>`).join('')}</div>`);
302
- return `<div class="vz-col14">${h.join('')}</div>`;
303
- }
304
- /** Material (MtFocus, MtMaterial): each row with Present (a deck) or Open, and Remove; then Add material and its popover. */
305
- function materialHtml(mats, m, focus) {
306
- const rows = mats.map((x, i) => `<div class="vzm-trow"><span class="vzm-mi" aria-hidden="true">${matIcon(x)}</span><span class="vzm-mt"><b>${esc(x.title)}</b> <span class="vzm-mut">· ${esc(x.deck && x.slides ? plural(x.slides, 'slide') : x.sub)}</span></span>`
307
- + (x.deck ? `<button type="button" class="vzm-btn vzm-soft" data-a="present" data-i="${i}">Present</button>${focus ? '<span class="vzm-mut vzm-sm">opens the presenter view</span>' : ''}` : `<button type="button" class="vzm-btn vzm-soft" data-a="mat" data-i="${i}">Open</button>`)
308
- + `<button type="button" class="vzm-ib vz-hv" data-a="matrm" data-i="${i}" aria-label="${esc('Remove ' + x.title)}">${svg('x', 14)}</button></div>`).join('');
309
- return `<div class="vz-col"><p class="vzm-lbl">Material${mats.length ? '' : ' <small>none linked</small>'}</p>${rows}<button type="button" class="vzm-btn vzm-ghost" data-a="addmat" aria-expanded="${m.ui && m.ui.pop === 'mat'}">${svg('plus', 14)}Add material</button><div class="vzm-anc" data-pop="mat"></div></div>`;
310
- }
311
- function liveNotesHtml(m, ui) {
312
- const L = m.live, h = [];
313
- h.push(`<div class="vz-src"><span>Listening to <b>${esc(L.app)}</b> · microphone and meeting</span><button type="button" class="vz-link vz-hv" data-a="src" aria-expanded="${!!ui.src}">Change</button><span class="vz-sp"></span><span>${plural(L.shots, 'screen shot')}${L.shotsPaused ? ' · paused' : ''}</span><button type="button" class="vz-link vz-hv" data-a="shots">${L.shotsPaused ? 'Resume shots' : 'Pause shots'}</button></div>`);
314
- if (ui.src) h.push(appsHtml(L));
315
- h.push(`<label class="vz-priv"><input type="checkbox" data-a="priv"${m.private ? ' checked disabled' : ''}>${esc(PRIVATE_TEXT)}</label>`);
316
- if (ui.ask === 'priv') h.push(`<div class="vz-ask" role="alert"><span>Make this note private? Its audio, transcript and screen shots are deleted now, and none are kept while it stays private.</span><div><button type="button" class="vz-b vz-solid" data-a="privgo">Make it private</button><button type="button" class="vz-b" data-a="askno">Cancel</button></div></div>`);
317
- if (L.topics.length) h.push(`<div class="vz-col"><p class="vzm-lbl">Now on <small>${esc(L.nowSub)}</small></p>${weightBar('vz-stretch', L.topics.map((t) => ({ w: +t.flex || 1, attrs: ` data-k="${t.k}"` })))}${L.topics.map((t) => `<div class="vz-ag" data-k="${t.k}"><i class="vz-num" data-k="${t.k}" aria-hidden="true">${t.n}</i><span>${esc(t.text)}</span><small>${esc(t.state)}</small></div>`).join('')}</div>`);
318
- h.push(`<p class="vz-caught"><b>Caught so far:</b> ${esc(L.caught)}</p>`);
319
- h.push(mineHtml(m, L));
320
- const off = L.total - L.lines.length;
321
- h.push(`<div class="vz-col"><p class="vzm-lbl">Said last <small>${plural(L.total, 'line')} · all of them in Transcript</small></p>${L.lines.length ? L.lines.map((l, i) => lineHtml(l, i + off, ui)).join('') : `<p class="vz-empty">${m.private ? 'This note is private: only what you type is kept.' : 'Nothing has been said yet.'}</p>`}<p class="vz-note vz-fine">${esc(LIVE_FOOT)}</p></div>`);
322
- return `<div class="vz-col14">${h.join('')}</div>`;
314
+ /** The summary (shell A): the state, the words, a quiet line with what it is about, and the meeting's one primary press. */
315
+ /** Where a note sits in its series, "4 of 4 in the series"; the meetings before and after are in ⋯. */
316
+ const serPos = (m) => (m.series && m.series.count > 1 && m.series.pos ? m.series.pos + ' of ' + m.series.count + ' in the series' : '');
317
+ export function summaryHtml(m, ui = {}) {
318
+ const about = `<button type="button" class="vzm-about" data-a="m-about" aria-expanded="${ui.pop === 'about'}" title="What it is about. Change">${m.about ? 'About ' + esc(m.about) : 'What it is about'}</button>`;
319
+ const metaLine = (parts) => `<p class="czs-meta vzm-meta">${[about].concat(parts.filter(Boolean).map(esc)).join(' · ')}</p>`;
320
+ if (m.noNotes) return czSummary({ line: 'Not recorded', text: NO_NOTES, extra: `<div class="vzm-acts"><button type="button" class="vzm-btn vzm-soft" data-a="m-fresh">New note</button></div>` });
321
+ if (m.mk === 'prep') {
322
+ const P = m.prep, c = m.chip;
323
+ const tone = /^Starts in/.test(c.text) ? 'you' : c.text === 'On now' ? 'warn' : '';
324
+ return czSummary({ line: c.text, tone, text: P.gist || P.purpose,
325
+ extra: metaLine([m.people.length ? plural(m.people.length, 'person', 'people') : '', P.readyText]) + (m.primary ? `<div class="vzm-acts">${roundBtn('record', 'Record', 'rec', 'red')}</div>` : '') });
326
+ }
327
+ if (m.mk === 'live') {
328
+ const L = m.live, Fo = m.focus;
329
+ const line = m.liveK === 'rec' ? 'Recording · ' + mmss(m.liveMs || 0) : m.liveK === 'paused' ? 'Paused at ' + mmss(m.liveMs || 0) : 'Recording, but not on this page';
330
+ const now = Fo.now ? 'Now on: ' + Fo.now + (Fo.topics.length > 1 ? ', topic ' + (Fo.topics.findIndex((t) => t.now) + 1) + ' of ' + Fo.topics.length + '.' : '.')
331
+ : Fo.error ? 'Focus could not read this meeting: ' + String(Fo.error).replace(/\.$/, '') + '.' : ''; // honest: a refused read says why
332
+ const text = m.liveK === 'paused' ? 'Nothing is kept while paused. ' + now : m.liveK === 'stale' ? 'Nothing is kept until you resume here. ' + now : now;
333
+ const acts = m.liveK === 'rec' ? roundBtn('stop', 'Stop the recording', 'stop', 'red') + roundBtn('hl', 'Highlight the last 30 seconds', 'star') + roundBtn('pause', 'Pause', 'pause')
334
+ : roundBtn('resume', 'Resume', 'play', 'dark') + roundBtn('stop', 'Stop the recording', 'stop', 'red');
335
+ return czSummary({ line, tone: m.liveK === 'rec' ? 'live' : 'warn', text: text.trim(), extra: metaLine([L.app + ' · microphone and meeting', m.people.length ? plural(m.people.length, 'person', 'people') : '']) + `<div class="vzm-acts">${acts}</div>` });
336
+ }
337
+ const N = m.notes, V = N.replay;
338
+ const text = N.summary || (m.private ? 'This note is private: only what you typed is kept.' : 'No summary was written for this meeting.');
339
+ if (V) {
340
+ const line = (V.raised > V.points.length ? V.points.length + ' of ' + V.raised + ' points kept' : plural(V.points.length, 'point') + ' kept') + (V.toConfirm ? ' · ' + V.toConfirm + ' to confirm' : '');
341
+ return czSummary({ line, tone: V.toConfirm ? 'you' : 'ok', text, extra: metaLine([m.sub, serPos(m)]), primary: V.toConfirm ? { label: 'Confirm ' + V.toConfirm, act: 'confirmall' } : null });
342
+ }
343
+ const said = [N.decisions.length && plural(N.decisions.length, 'decision'), N.steps.length && plural(N.steps.length, 'next step'), N.questions.length && plural(N.questions.length, 'open question')].filter(Boolean).join(' · ');
344
+ return czSummary({ line: said || 'Notes', text, extra: metaLine([m.sub, serPos(m)]) });
345
+ }
346
+
347
+ function agendaHtml(P) {
348
+ return P.agenda.length ? `<div class="vzm-agl">${P.agenda.map((a, i) => `<div class="vz-ag"><i class="vz-num" aria-hidden="true">${a.n}</i><span>${esc(a.text)}</span><button type="button" class="vz-min vz-hv" data-a="min" data-i="${i}" title="Change the minutes for this topic" aria-label="${esc(a.text)}: ${a.min} minutes. Change">${a.min} min</button></div>`).join('')}</div>`
349
+ : '<p class="vz-empty">The invite lists no topics yet.</p>';
350
+ }
351
+ const tagRows = (rows) => rows.map((x) => `<div class="vz-tagrow"><span class="vz-tag" data-k="${x.k}">${esc(x.tag)}</span><span>${esc(x.text)} <small>${esc(x.meta || x.owner || x.src || '')}</small></span></div>`).join('');
352
+ function readyHtml(P) {
353
+ const h = [P.ready.map((r) => `<div class="vz-ready"><span class="vz-mk" data-k="${r.ok ? 'ok' : 'no'}" aria-hidden="true">${r.ok ? svg('check', 12) : '!'}</span><span><b>${esc(r.label)}</b> <em>${esc(r.text)}</em></span></div>`).join('')];
354
+ if (P.purpose) h.push(`<p class="vz-p"><b>What it is for:</b> ${esc(P.purpose)}</p>`);
355
+ if (P.toBeReady) h.push(`<p class="vz-p">${esc(P.toBeReady)}</p>`);
356
+ return h.join('');
357
+ }
358
+ const prevHtml = (P) => P.prev.map((p) => `<button type="button" class="vz-prev vz-hv" data-a="note" data-id="${esc(p.id)}"><time>${esc(p.date)}</time><span>${esc(p.decided + ' decided · ' + plural(p.steps, 'next step') + (p.overview ? ' · ' + p.overview : ''))}</span></button>`).join('');
359
+ /** Material (XvAMaterial): a row per item. Pressing the row previews it for you only; the icon presents it. Then Add material. */
360
+ export function materialHtml(mats, ui = {}) {
361
+ const rows = mats.map((x, i) => `<div class="vzm-mrow"><button type="button" class="vzm-mopen vz-hv" data-a="mat" data-i="${i}" title="Look at it first. Only you see it."><span class="vzm-mi" aria-hidden="true">${svg(x.icon || 'doc', 16)}</span><span class="vzm-mt"><b>${esc(x.title)}</b><small>${esc(x.sub)}</small></span></button>`
362
+ + (x.present ? `<button type="button" class="vzm-ib vzm-pres vz-hv" data-a="present" data-i="${i}" aria-label="${esc('Present ' + x.title)}" title="Present">${svg('present', 17)}</button>` : '') + '</div>').join('');
363
+ return `<div class="vzm-mats">${rows}<button type="button" class="vzm-add vz-hv" data-a="addmat" aria-expanded="${ui.pop === 'mat'}">${svg('plus', 14)}Add material</button><div class="vzm-anc" data-pop="mat"></div></div>`;
323
364
  }
324
365
  const appsHtml = (L) => `<div class="vz-apps" role="radiogroup" aria-label="Where the meeting is">${APPS.map((a) => `<button type="button" role="radio" class="vz-b${a.id === L.appId ? ' vz-solid' : ''}" aria-checked="${a.id === L.appId}" data-a="app" data-id="${a.id}">${esc(a.label)}</button>`).join('')}<span class="vz-note">Used the next time you record or resume.</span></div>`;
325
- function mineHtml(m, L) {
326
- return `<div class="vz-col"><p class="vzm-lbl">Your notes</p><textarea class="vz-mine" data-a="mine" aria-label="Your notes" placeholder="${esc(MINE_HINT)}">${esc(L.mine)}</textarea></div>`
327
- + `<div class="vz-col"><p class="vzm-lbl">Highlights <small>${L.hl.length} kept</small></p>${L.hl.length ? L.hl.map((x) => `<div class="vz-hl"><time>${esc(x.t)}</time><span>${esc(x.text)}</span></div>`).join('') : `<p class="vz-empty">${m.mk === 'live' ? 'Press Highlight to keep the last 30 seconds and the next ones.' : 'No highlights were kept.'}</p>`}</div>`;
328
- }
329
- function focusHtml(m, ui) {
330
- const Fo = m.focus, h = [];
331
- h.push(`<div class="vzm-now"><div class="vzm-r"><p class="vzm-lbl vzm-grow">${esc(Fo.nowLine)}</p>${Fo.topics.length ? `<button type="button" class="vzm-btn" data-a="topic" aria-expanded="${ui.pop === 'topic'}">Change topic</button>` : ''}</div>`
332
- + (ui.pop === 'topic' ? `<div class="vzm-topics" role="group" aria-label="Make it the topic">${Fo.topics.map((t, i) => `<button type="button" class="vzm-chip${t.now ? ' on' : ''}" data-a="topicgo" data-i="${i}"${t.now ? ' aria-current="true"' : ''}>${esc(t.text)}</button>`).join('')}</div>` : '')
333
- + `<p class="vzm-h1">${esc(Fo.now || (Fo.error ? 'Focus could not read this meeting' : 'No topic is current yet'))}</p><p class="vzm-sm">${esc(Fo.error ? Fo.error : Fo.gist ? 'So far: ' + Fo.gist : 'What was said on the topic shows here while the note records.')}</p></div>`);
334
- h.push(`<div><p class="vzm-lbl">Agenda${Fo.agendaSub ? ' · ' + esc(Fo.agendaSub) : ''}</p>${Fo.agenda.length ? Fo.agenda.map((a) => `<div class="vzm-ag" data-k="${a.k}"><span>${a.k === 'now' || a.k === 'late' ? `<b>${a.n} ${esc(a.text)}</b>` : esc(a.n + ' ' + a.text)}</span>${fillBar(a.fill, a.k)}<small>${esc(a.say)}</small></div>`).join('') : '<p class="vz-empty">The invite lists no topics yet.</p>'}</div>`);
335
- h.push(materialHtml(Fo.material, m, true));
336
- return `<div class="vz-col14">${h.join('')}</div>`;
366
+ const mineHtml = (L) => `<textarea class="vz-mine" data-a="mine" aria-label="Your notes" placeholder="${esc(MINE_HINT)}">${esc(L.mine)}</textarea>`;
367
+ const hlHtml = (L) => L.hl.map((x) => `<div class="vz-hl"><time>${esc(x.t)}</time><span>${esc(x.text)}</span></div>`).join('');
368
+ function caughtHtml(m) {
369
+ const L = m.live, Fo = m.focus, h = [];
370
+ if (Fo.gist) h.push(`<p class="vz-p">${esc('So far: ' + Fo.gist)}</p>`);
371
+ else if (Fo.error) h.push(`<p class="vz-empty">${esc(Fo.error)}</p>`);
372
+ if (L.topics.length) h.push(weightBar('vz-stretch', L.topics.map((t) => ({ w: +t.flex || 1, attrs: ` data-k="${t.k}"` }))));
373
+ return h.join('') || '<p class="vz-empty">What was said shows here while the note records.</p>';
374
+ }
375
+ function liveAgendaHtml(m, ui) {
376
+ const Fo = m.focus;
377
+ const change = Fo.topics.length ? `<div class="vzm-r"><span class="vzm-grow"></span><button type="button" class="vzm-btn vzm-soft" data-a="topic" aria-expanded="${ui.pop === 'topic'}">Change topic</button></div>`
378
+ + (ui.pop === 'topic' ? `<div class="vzm-topics" role="group" aria-label="Make it the topic">${Fo.topics.map((t, i) => `<button type="button" class="vzm-chip${t.now ? ' on' : ''}" data-a="topicgo" data-i="${i}"${t.now ? ' aria-current="true"' : ''}>${esc(t.text)}</button>`).join('')}</div>` : '') : '';
379
+ return change + (Fo.agenda.length ? Fo.agenda.map((a) => `<div class="vzm-ag" data-k="${a.k}"><span>${a.k === 'now' || a.k === 'late' ? `<b>${a.n} ${esc(a.text)}</b>` : esc(a.n + ' ' + a.text)}</span>${fillBar(a.fill, a.k)}<small>${esc(a.say)}</small></div>`).join('') : '<p class="vz-empty">The invite lists no topics yet.</p>');
380
+ }
381
+ function transcriptHtml(m, ui, lines, seek) {
382
+ return (lines.length ? lines.map((l, i) => lineHtml(l, i, ui, seek)).join('') : `<p class="vz-empty">${m.private ? 'This note is private: only what you type is kept.' : m.mk === 'live' ? 'Nothing has been said yet.' : 'Nothing was transcribed.'}</p>`)
383
+ + `<p class="vz-note vz-fine">${esc(LIVE_FOOT)}</p>`;
337
384
  }
338
385
  function stepHtml(a, ui) {
339
386
  const made = ui.made && ui.made[a.i];
@@ -342,78 +389,89 @@ function stepHtml(a, ui) {
342
389
  return `<div class="vzm-step"><span class="vzm-grow">${esc(a.text)}</span><span class="vzm-mut vzm-sm">${esc(a.meta.replace('No owner · No date', 'No owner, no date'))}</span>${act}</div>`
343
390
  + (made ? `<div class="vzm-made" role="status">${svg('check', 14)}<span>${made.html}</span>${made.undo ? `<button type="button" class="vzm-btn vzm-ghost" data-a="madeundo" data-i="${a.i}">Undo</button>` : ''}</div>` : '');
344
391
  }
345
- function notesHtml(m, ui) {
346
- const N = m.notes, h = [];
347
- h.push(`<p class="vz-sum">${N.summary ? esc(N.summary) : '<span class="vz-empty">No summary was written for this meeting.</span>'}</p>`);
348
- if (N.since) h.push(`<div class="vz-col"><p class="vzm-lbl">Since the last one <small>${esc(N.since.sub)}</small></p>${N.since.rows.map((s) => `<div class="vz-tagrow"><span class="vz-tag" data-k="${s.k}">${esc(s.tag)}</span><span>${esc(s.text)} <small>${esc(s.owner)}</small></span></div>`).join('')}</div>`);
349
- h.push(`<div class="vz-col"><p class="vzm-lbl">Decisions</p>${N.decisions.length ? N.decisions.map((d) => `<div class="vzm-trow vzm-top"><span class="vzm-grow">${esc(d.text)}</span>${d.why ? `<span class="vzm-mut vzm-sm vzm-why">${esc(d.why)}</span>` : ''}</div>`).join('') : '<p class="vz-empty">No decisions were caught.</p>'}</div>`);
350
- h.push(`<div class="vz-col"><p class="vzm-lbl">Next steps <small>${esc(N.stepsSub)}</small></p>${N.steps.length ? N.steps.map((a) => stepHtml(a, ui)).join('') : '<p class="vz-empty">No next steps were caught.</p>'}</div>`);
351
- if (N.facts.length) h.push(`<div class="vz-col"><p class="vzm-lbl">Facts mentioned <small>checked against the repository</small></p>${N.facts.map((f) => `<div class="vz-tagrow"><span class="vz-tag" data-k="${f.k}">${esc(f.tag)}</span><span>${esc(f.text)} <small>${esc(f.src)}</small></span></div>`).join('')}</div>`);
352
- h.push(`<div class="vz-col"><p class="vzm-lbl">Open questions</p>${N.questions.length ? N.questions.map((q) => `<div class="vzm-trow"><span class="vzm-grow">${esc(q.text)}</span></div>`).join('') : '<p class="vz-empty">No question was left open.</p>'}</div>`);
353
- h.push(`<button type="button" class="vzm-fold vz-hv" data-a="prepfold" aria-expanded="${!!ui.prepOpen}">${svg('next', 14)}<b>Prep and material</b><span class="vzm-mut">${esc(m.parts[0].sub)}</span></button>`);
354
- if (ui.prepOpen) h.push(prepHtml(m.prep, m));
355
- return `<div class="vz-col vz-g16">${h.join('')}</div>`;
356
- }
357
- function transcriptHtml(m, ui) {
358
- const L = m.mk === 'live' ? m.live : null, lines = m.notes.lines, h = [];
359
- if (m.mk === 'notes') h.push(mineHtml(m, m.live));
360
- h.push(`<div class="vz-col"><p class="vzm-lbl">${esc(m.notes.trTitle)}</p>${lines.length ? lines.map((l, i) => lineHtml(l, i, ui, m.mk === 'notes' && !!m.notes.replay)).join('') : `<p class="vz-empty">${m.private ? 'This note is private: only what you type is kept.' : L ? 'Nothing has been said yet.' : 'Nothing was transcribed.'}</p>`}<p class="vz-note vz-fine">${esc(LIVE_FOOT)}</p></div>`);
361
- return `<div class="vz-col14">${h.join('')}</div>`;
362
- }
363
- function recHtml(m, ui) {
364
- const R = m.recLine; if (!R) return '';
365
- const h = [];
366
- const lead = R.k === 'rec' ? '<span class="vzm-dot" aria-hidden="true"></span>' : svg(R.k === 'paused' ? 'pause' : 'warn', 16, ' class="vzm-ink3"');
367
- const acts = R.k === 'rec' ? `<button type="button" class="vzm-btn vzm-card" data-a="hl" title="Keep the last 30 seconds and the next ones">Highlight</button><button type="button" class="vzm-btn vzm-card" data-a="pause" title="Pause listening; resume within an hour">Pause</button>`
368
- : `<button type="button" class="vzm-btn vzm-dark" data-a="resume">Resume</button>`;
369
- h.push(`<div class="vzm-box vzm-rec" role="group" aria-label="Recording" data-k="${R.k}">${lead}<b class="vzm-grow vzm-sm" data-clk="state">${esc(R.text)}</b>${acts}<button type="button" class="vzm-ib vz-hv" data-a="stop" aria-label="Stop the recording" title="Stop and write the notes">${svg('stop', 12, ' class="vzm-fill"')}</button></div>`);
370
- if (ui.ask === 'stop') h.push(`<div class="vz-ask" role="alert"><span><b>Stop for good?</b> ${esc(STOP_LINE)}</span><div><button type="button" class="vz-b vz-solid" data-a="stopgo">Stop and write the notes</button>${m.liveK === 'rec' ? '<button type="button" class="vz-b" data-a="pause">Pause instead</button>' : ''}<button type="button" class="vz-b" data-a="askno">Cancel</button></div></div>`);
371
- for (const g of m.gaps) h.push(`<div class="vzm-warn vzm-sm"><span class="vzm-grow">${g.kind === 'off' ? '<b>Earlier:</b> ' + esc(g.text.replace(/^Earlier: /, '')) : esc(g.text)}</span>${g.kind === 'quiet' ? '<button type="button" class="vzm-btn vzm-card" data-a="src">Listen to another app</button>' : ''}</div>`);
372
- if (ui.src && m.gaps.some((g) => g.kind === 'quiet')) h.push(appsHtml(m.live));
373
- return h.join('');
392
+ const decisionsHtml = (N) => N.decisions.map((d) => `<div class="vzm-trow vzm-top"><span class="vzm-grow">${esc(d.text)}</span>${d.why ? `<span class="vzm-mut vzm-sm vzm-why">${esc(d.why)}</span>` : ''}</div>`).join('');
393
+ /** Replay (XvAReplay): the player and "In this part" in one card; phone: the phone's Replay. The editor shows where the PM pressed. */
394
+ function replayCardHtml(V, ui) {
395
+ const part = { ...ui, edit: ui.editIn === 'part' ? ui.edit : null };
396
+ return `<div class="vzp vzp-card vzp-dt">${playerHtml(V, ui)}${partHtml(V, part)}</div><div class="vzp vzp-card vzp-mb">${phoneHtml(V, ui)}</div>`;
397
+ }
398
+ const countOf = (V) => [['decision', 'decision'], ['question', 'question'], ['action', 'action']].map(([k, w]) => { const c = V.points.filter((p) => p.kind === k).length; return c ? plural(c, w) : ''; }).filter(Boolean).join(' · ');
399
+
400
+ /** The folding rows of each state (shell A czSections). An empty part is left out (zero is silence). */
401
+ export function sectionsOf(m, ui = {}) {
402
+ const P = m.prep, L = m.live, N = m.notes, Fo = m.focus;
403
+ const mat = { id: 'mat', title: 'Material', count: m.material.length ? m.material.length + (m.mk === 'prep' ? ' linked' : '') : '', open: m.mk === 'live', html: materialHtml(m.material, ui) };
404
+ const lastT = P.prev.length ? { id: 'last', title: 'Last time', count: P.prev[0].date, html: prevHtml(P) } : null;
405
+ if (m.mk === 'prep') {
406
+ return [
407
+ { id: 'agenda', title: 'Agenda', count: P.agendaSub, open: true, html: agendaHtml(P) },
408
+ P.matters.length ? { id: 'matters', title: 'What matters today', count: P.matters.length, html: tagRows(P.matters) } : null,
409
+ { id: 'ready', title: 'To be ready', count: P.ready.filter((r) => !r.ok).length || '', html: readyHtml(P) },
410
+ mat, lastT,
411
+ ];
412
+ }
413
+ if (m.mk === 'live') {
414
+ return [
415
+ { id: 'mine', title: 'Your notes', open: true, html: mineHtml(L) },
416
+ { id: 'caught', title: 'Caught so far', count: L.caught === 'nothing yet' ? '' : L.caught.replace(/, /g, ' · '), html: caughtHtml(m) },
417
+ mat,
418
+ L.hl.length ? { id: 'hl', title: 'Highlights', count: L.hl.length, html: hlHtml(L) } : null,
419
+ { id: 'agenda', title: 'Agenda', count: L.nowSub, html: liveAgendaHtml(m, ui) },
420
+ { id: 'tr', title: 'Transcript', count: L.total ? 'live · ' + plural(L.total, 'line') : '', html: transcriptHtml(m, ui, N.lines, false) },
421
+ ];
422
+ }
423
+ const V = N.replay;
424
+ const steps = N.steps.length ? { id: 'steps', title: 'Next steps', count: N.stepsSub || N.steps.length, open: !V, html: N.steps.map((a) => stepHtml(a, ui)).join('') } : null;
425
+ const since = N.since ? { id: 'since', title: 'Since the last one', count: N.since.sub, html: tagRows(N.since.rows) } : null;
426
+ const facts = N.facts.length ? { id: 'facts', title: 'Facts mentioned', count: N.facts.length, html: tagRows(N.facts) } : null;
427
+ const prep = { id: 'prep', title: 'Prep and material', count: m.material.length ? plural(m.material.length, 'item') : '', html: (P.agenda.length ? agendaHtml(P) : '') + materialHtml(m.material, ui) };
428
+ const tr = { id: 'tr', title: 'Transcript', count: N.lines.length ? plural(N.lines.length, 'line') : '', html: `<p class="vzm-lbl">Your notes</p>${mineHtml(L)}${L.hl.length ? '<p class="vzm-lbl">Highlights</p>' + hlHtml(L) : ''}<p class="vzm-lbl">${esc(N.trTitle)}</p>${transcriptHtml(m, ui, N.lines, !!V)}` };
429
+ if (V) {
430
+ const kept = { ...ui, edit: ui.editIn === 'kept' ? ui.edit : null };
431
+ return [{ id: 'kept', title: 'All ' + V.points.length + ' kept', count: countOf(V), html: keptHtml(V, kept) }, steps, since, facts, prep, tr];
432
+ }
433
+ return [
434
+ steps,
435
+ N.decisions.length ? { id: 'dec', title: 'Decisions', count: N.decisions.length, open: true, html: decisionsHtml(N) } : null,
436
+ N.questions.length ? { id: 'q', title: 'Open questions', count: N.questions.length, html: N.questions.map((q) => `<div class="vzm-trow"><span class="vzm-grow">${esc(q.text)}</span></div>`).join('') } : null,
437
+ since, facts, prep, tr,
438
+ ];
374
439
  }
375
- /** The card's body. ui = { tab, pop, more, why, ask, src, naming, pos, playing, speed, filter, sel, leftOpen, made, prepOpen, msg, popHtml } */
440
+
441
+ /** The card's body (shell A): the summary, then the lines that need you now (a question, a message, a warning), Replay, the folds.
442
+ * ui = { pop, why, ask, src, naming, pos, playing, speed, filter, sel, leftOpen, made, msg, edit, editIn, draft, also } */
376
443
  export function meetHtml(m, ui = {}) {
377
- const c = m.chip, h = [];
378
- m.ui = ui;
379
- const ser = m.series ? `<span class="vzm-ser"><button type="button" class="vzm-sb vz-hv" data-a="note" data-id="${esc(m.series.prev ? m.series.prev.id : '')}" aria-label="${esc(m.series.prev ? 'The meeting before, ' + m.series.prev.day : 'No meeting before this one')}"${m.series.prev ? '' : ' disabled'}>${svg('prev', 14)}</button><button type="button" class="vzm-sb vzm-sn vz-hv" data-a="sermenu" aria-expanded="${ui.pop === 'ser'}" title="${esc(m.series.title)}">${esc(m.series.pos + ' of ' + m.series.count)}</button><button type="button" class="vzm-sb vz-hv" data-a="note" data-id="${esc(m.series.next ? m.series.next.id : '')}" aria-label="${esc(m.series.next ? 'The meeting after, ' + m.series.next.day : 'No meeting after this one yet')}"${m.series.next ? '' : ' disabled'}>${svg('next', 14)}</button></span>`
380
- : m.seriesOff ? `<button type="button" class="vzm-chip" data-a="sermenu" aria-expanded="${ui.pop === 'ser'}">${svg('ser', 14)}Not in a series</button>` : '';
381
- const about = m.about ? `<button type="button" class="vzm-chip on" data-a="m-about" aria-expanded="${ui.pop === 'about'}" title="What it is about. Change">${svg('flag', 14)}${esc(m.about)}</button>`
382
- : `<button type="button" class="vzm-chip vzm-dash" data-a="m-about" aria-expanded="${ui.pop === 'about'}">${svg('link', 14)}What it is about</button>`;
383
- const state = m.mk === 'notes' ? '' : `<span class="vzm-chip vzm-state" data-tone="${c.tone}">${c.tone === 'rec' ? '<span class="vzm-dot" aria-hidden="true"></span>' : ''}${esc(c.text)}</span>`;
384
- const pri = m.primary ? `<button type="button" class="vzm-btn vzm-dark" data-a="record" title="${esc(RECORD_LINE)}"><span class="vzm-dot" aria-hidden="true"></span>Record</button>` : '';
385
- h.push(`<div class="vzm-hd"><div class="vzm-ht"><h2 class="vzm-h2">${esc(m.title)}</h2><p class="vzm-sub" data-clk="when">${esc(m.sub)}</p></div><div class="vzm-hc">${state}${ser}${about}${pri}<button type="button" class="vzm-ib vz-hv" data-a="more" aria-label="More for this meeting" aria-expanded="${!!ui.more}">${dots}</button></div></div>`);
386
- h.push('<div class="vzm-anc" data-pop="head"></div>');
387
- if (ui.more) h.push(`<div class="vz-menu vzm-menu" role="menu">${m.menu.map((x) => `<button type="button" role="menuitem" class="vz-hv" data-a="m-${x.k}"><b>${esc(x.label)}</b><small>${esc(x.sub)}</small></button>`).join('')}</div>`);
444
+ const h = ['<div class="vzm-anc" data-pop="head"></div>'];
388
445
  if (m.seriesOff) h.push(`<div class="vzm-box vzm-sm"><span class="vzm-grow">Taken out of the series “${esc(m.title)}”. Its notes no longer compare with the others.</span><button type="button" class="vzm-btn vzm-card" data-a="m-serback">Put it back</button></div>`);
389
- h.push(recHtml(m, ui));
390
446
  if (ui.ask === 'consent') h.push(`<div class="vz-ask" role="alert"><span><b>Tell everyone first.</b> ${esc(CONSENT_LINE.replace('Tell everyone first. ', ''))}</span><div><button type="button" class="vz-b vz-solid" data-a="recgo">I told them, start</button><button type="button" class="vz-b" data-a="askno">Not yet</button></div></div>`);
447
+ if (ui.ask === 'stop') h.push(`<div class="vz-ask" role="alert"><span><b>Stop for good?</b> ${esc(STOP_LINE)}</span><div><button type="button" class="vz-b vz-solid" data-a="stopgo">Stop and write the notes</button>${m.liveK === 'rec' ? '<button type="button" class="vz-b" data-a="pause">Pause instead</button>' : ''}<button type="button" class="vz-b" data-a="askno">Cancel</button></div></div>`);
448
+ if (ui.ask === 'priv') h.push(`<div class="vz-ask" role="alert"><span>Make this note private? Its audio, transcript and screen shots are deleted now, and none are kept while it stays private.</span><div><button type="button" class="vz-b vz-solid" data-a="privgo">Make it private</button><button type="button" class="vz-b" data-a="askno">Cancel</button></div></div>`);
449
+ for (const g of m.gaps) h.push(`<div class="vzm-warn vzm-sm"><span class="vzm-grow">${g.kind === 'off' ? '<b>Earlier:</b> ' + esc(g.text.replace(/^Earlier: /, '')) : esc(g.text)}</span>${g.kind === 'quiet' ? '<button type="button" class="vzm-btn vzm-card" data-a="src">Listen to another app</button>' : ''}</div>`);
450
+ if (ui.src && m.mk === 'live') h.push(appsHtml(m.live));
391
451
  if (ui.why) h.push(`<div class="vz-why" role="note"><p>${esc(RECORD_LINE)}</p><p>${esc(FOCUS_LINE)}</p></div>`);
392
452
  if (ui.msg) h.push(`<p class="vz-msg" role="status" data-tone="${ui.msg.tone || ''}"><span>${esc(ui.msg.text)}</span>${ui.msg.undo ? '<button type="button" class="vz-link vz-hv" data-a="msgundo">Undo</button>' : ''}</p>`);
393
- const tab = m.tabs.some(([k]) => k === ui.tab) ? ui.tab : m.tabs.length ? m.tabs[0][0] : '';
394
- if (m.tabs.length) h.push(`<div class="vzm-tabs" role="tablist" aria-label="${esc(m.title)}">${m.tabs.map(([k, l]) => `<button type="button" role="tab" class="vzm-tab" data-a="tab" data-k="${k}" aria-selected="${k === tab}">${l}</button>`).join('')}</div>`);
395
- const PANE = { focus: () => focusHtml(m, ui), replay: () => replayHtml(m.notes.replay, ui), tr: () => transcriptHtml(m, ui) };
396
- const body = !tab ? prepHtml(m.prep, m) : PANE[tab] ? PANE[tab]() : m.mk === 'live' ? liveNotesHtml(m, ui) : notesHtml(m, ui);
397
- h.push(`<div class="vzm-pane" role="${tab ? 'tabpanel' : 'region'}" data-tab="${tab || 'prep'}">${body}</div>`);
398
- return `<div class="vz vz-mtg" data-mk="${m.mk}" data-tab="${tab || 'prep'}">${h.join('')}</div>`;
453
+ if (m.mk === 'notes' && m.notes.replay) h.push(replayCardHtml(m.notes.replay, ui));
454
+ h.push(czSections(sectionsOf(m, ui), { key: 'meeting-' + m.mk }));
455
+ return summaryHtml(m, ui) + `<div class="vz vz-mtg" data-mk="${m.mk}">${h.join('')}</div>`;
399
456
  }
400
457
 
401
- /** Add material's popover (MtMaterial). P = { row, sug, found, q, topics, series, err, busy } */
458
+ /** Add material's popover (XvAMaterial): Upload a file, Paste a link, Find in PMOS, then the suggestions. P = { row, sug, found, q, topics, err, busy } */
402
459
  export function matPopHtml(P) {
403
- if (!P.row) return `<div class="vzm-pop" role="dialog" aria-label="Add material"><p class="vzm-h3">Add material</p><p class="vzm-sm vzm-mut">Material is kept per calendar meeting. This note has no calendar event.</p></div>`;
404
- return `<div class="vzm-pop" role="dialog" aria-label="Add material"><div class="vzm-r"><p class="vzm-h3 vzm-grow">Add material</p><button type="button" class="vzm-ib vz-hv" data-a="popx" aria-label="Close">${svg('x', 14)}</button></div>`
460
+ if (!P.row) return `<div class="vzm-pop" role="dialog" aria-label="Add material"><p class="vzm-sm vzm-mut">Material is kept per calendar meeting. This note has no calendar event.</p></div>`;
461
+ return `<div class="vzm-pop vzm-addm" role="dialog" aria-label="Add material">`
462
+ + `<label class="vzm-ar vz-hv">${svg('up', 16)}<b>${P.busy ? 'Keeping the file' : 'Upload a file'}</b><small>PDF, image, PPTX, HTML</small><input type="file" data-a="matfile" accept=".pdf,.png,.jpg,.jpeg,.gif,.webp,.pptx,.html,.htm" hidden></label>`
463
+ + `<label class="vzm-ar">${svg('link', 16)}<input data-a="matlink" type="url" placeholder="Paste a link" aria-label="Paste a link"><small>Google Doc, Slides, a website</small></label>`
464
+ + `<label class="vzm-ar">${svg('find', 16)}<input data-a="matq" type="search" placeholder="Find in PMOS" aria-label="Find in PMOS" value="${esc(P.q || '')}"><small>PRDs, reports, decks</small></label>`
405
465
  + `<div data-pl="list">${matListHtml(P)}</div>`
406
- + `<div class="vzm-in">${svg('find', 16)}<input data-a="matq" type="search" placeholder="Find in PMOS" aria-label="Find in PMOS" value="${esc(P.q || '')}"></div>`
407
- + `<div class="vzm-in">${svg('link', 16)}<input data-a="matlink" type="url" placeholder="Paste a link" aria-label="Paste a link"></div>`
408
- + `<div class="vzm-r vzm-sm">${P.topics && P.topics.length ? `<select class="vz-in" data-a="mattopic" aria-label="Topic"><option value="">For the whole meeting</option>${P.topics.map((t) => `<option value="${esc(t)}">For ${esc(clip(t, 60))}</option>`).join('')}</select>` : ''}<label class="vz-priv"><input type="checkbox" data-a="matser">For every meeting in the series</label></div>`
466
+ + `<div class="vzm-r vzm-sm vzm-scope">${P.topics && P.topics.length ? `<select class="vz-in" data-a="mattopic" aria-label="Topic"><option value="">For the whole meeting</option>${P.topics.map((t) => `<option value="${esc(t)}">For ${esc(clip(t, 60))}</option>`).join('')}</select>` : ''}<label class="vz-priv"><input type="checkbox" data-a="matser">For every meeting in the series</label></div>`
409
467
  + '<p class="vzm-sm vzm-mut">The invite in your calendar is not changed.</p>'
410
468
  + `<p class="vz-msg" data-tone="bad" role="alert" data-pl="err"${P.err ? '' : ' hidden'}>${esc(P.err || '')}</p></div>`;
411
469
  }
412
470
  export function matListHtml(P) {
413
471
  const items = P.q ? P.found : P.sug;
414
- if (!items) return `<p class="vzm-mlbl">${P.q ? 'Looking in PMOS' : 'Suggested for this meeting'}</p><p class="vz-empty">Looking in PMOS.</p>`;
415
- return `<p class="vzm-mlbl">${P.q ? 'Found in PMOS' : 'Suggested for this meeting'}</p>` + (items.length ? items.map((it, i) => `<button type="button" class="vzm-mi2 vz-hv" data-a="matadd" data-i="${i}">${svg(it.kind === 'pmos-deck' ? 'deck' : it.kind === 'board' ? 'board' : 'doc', 16)}<span class="vzm-grow">${esc(clip(it.title, 80))}${it.meta ? `<br><span class="vzm-sm vzm-mut">${esc(clip(it.meta, 80))}</span>` : ''}</span><span class="vzm-k">${svg('plus', 16)}</span></button>`).join('')
416
- : `<p class="vz-empty">${P.q ? 'Nothing in PMOS matches. Paste a link instead.' : 'Nothing to suggest yet. Find it in PMOS or paste a link.'}</p>`);
472
+ if (!items) return P.q ? '<p class="vz-empty">Looking in PMOS.</p>' : '';
473
+ if (!items.length) return P.q ? '<p class="vz-empty">Nothing in PMOS matches. Paste a link instead.</p>' : '';
474
+ return `<p class="vzm-mlbl">${P.q ? 'Found in PMOS' : 'Suggested for this meeting'}</p>` + items.map((it, i) => `<button type="button" class="vzm-mi2 vz-hv" data-a="matadd" data-i="${i}">${svg(it.kind === 'pmos-deck' ? 'deck' : it.kind === 'board' ? 'board' : 'doc', 16)}<span class="vzm-grow">${esc(clip(it.title, 80))}${it.meta ? `<br><span class="vzm-sm vzm-mut">${esc(clip(it.meta, 80))}</span>` : ''}</span><span class="vzm-k">Add</span></button>`).join('');
417
475
  }
418
476
  /** What it is about's popover (MtAfter). O = aboutOptions(), q = the find text */
419
477
  export function aboutPopHtml(O, q = '', note = '') {
@@ -467,7 +525,7 @@ export function refOf(ref) {
467
525
  export async function openMeeting(ref, o = {}) {
468
526
  mtgStyle();
469
527
  const R = refOf(ref);
470
- const me = { R, ws: o.ws || new URLSearchParams(location.search).get('ws') || '', ui: { tab: o.tab || '', sel: new Set(), made: {} }, D: null, n: null, row: null, alive: true, timers: [], play: null };
528
+ const me = { R, ws: o.ws || new URLSearchParams(location.search).get('ws') || '', ui: { sel: new Set(), made: {} }, D: null, n: null, row: null, alive: true, timers: [], play: null };
471
529
  if (MT) { MT.alive = false; MT.timers.forEach(clearInterval); stopPlay(MT); }
472
530
  MT = me;
473
531
  const id = 'meeting:' + (R.note || R.event || R.title || 'new');
@@ -482,7 +540,7 @@ export async function openMeeting(ref, o = {}) {
482
540
  me.timers.push(setInterval(() => { if (me.model && me.model.mk === 'live') load(me, true); }, 4000));
483
541
  me.timers.push(setInterval(() => { if (me.model && me.model.mk !== 'live') load(me, true); }, 30000));
484
542
  }
485
- function closed(me) { if (MT === me && !me.reopen) { me.alive = false; me.timers.forEach(clearInterval); stopPlay(me); MT = null; widen(''); } }
543
+ function closed(me) { if (MT === me && !me.reopen && !me.previewing) { me.alive = false; me.timers.forEach(clearInterval); stopPlay(me); MT = null; widen(''); } }
486
544
 
487
545
  /** Read everything the card shows, then draw it. */
488
546
  async function load(me, quiet) {
@@ -537,7 +595,8 @@ async function load(me, quiet) {
537
595
  me.D = { row, n, S, F: F && F.ok ? F : F && F.ok === false ? { ok: false, error: F.error } : null, rep, vm: vm && vm.ok ? vm : null, prev: me.prev || [], about, level,
538
596
  people: (row && row.who && row.who.length ? row.who : F && F.ok && F.event && F.event.attendees && F.event.attendees.length ? F.event.attendees : S && S.context ? S.context.people : []),
539
597
  rec: { held, started: held ? C.started() : null }, elapsedBase: nr ? nr.meeting_ms || 0 : 0, frames: one && one.screen ? (one.screen.frames || []).length : 0,
540
- canRecord: row ? recordable(row) : !!(n && (n.state === 'idle' || !n.state)), app: recall(safeStorage()).app, steps, points: pts && pts.ok ? pts.points || {} : (me.D && me.D.points) || {} };
598
+ canRecord: row ? recordable(row) : !!(n && (n.state === 'idle' || !n.state)), app: recall(safeStorage()).app, steps, points: pts && pts.ok ? pts.points || {} : (me.D && me.D.points) || {},
599
+ edits: pts && pts.ok ? pts.edits || {} : (me.D && me.D.edits) || {}, lessons: pts && pts.ok ? pts.lessons || [] : (me.D && me.D.lessons) || [] };
541
600
  draw(me);
542
601
  }
543
602
  async function keyOf(text) {
@@ -555,10 +614,11 @@ function draw(me) {
555
614
  const body = vCur() && vCur().id === me.vid ? document.querySelector('#czViewer .cz-vw-body') : null;
556
615
  const m = me.model = meetModel({ ...me.D, elapsed: elapsedOf(me) });
557
616
  const busy = body && body.contains(document.activeElement) && /^(TEXTAREA|INPUT|SELECT)$/.test(document.activeElement.tagName);
558
- if (!body || me.kind !== m.kind || me.head !== m.head) { // the header names the state: open again when it changed
559
- me.kind = m.kind; me.head = m.head; me.reopen = true;
560
- const R = me.n ? { note: me.n.id } : me.row ? { event: me.row.id, date: me.row.day } : me.R;
561
- vOpen({ id: me.vid, kind: m.kind, title: m.head, icon: CLOCK_ICON, url: meetingUrl({ ...R, ws: me.ws }), render: (b) => paint(me, b), onClose: () => closed(me) });
617
+ const sig = m.more.map((x) => x.k || '-').join(',');
618
+ if (!body || me.kind !== m.kind || me.head !== m.head || me.sig !== sig) { // the header names the state and ⋯ holds its presses: open again when they changed
619
+ if (me.previewing) return; // the PM is looking at material: the meeting is drawn again when ← comes back to it
620
+ me.kind = m.kind; me.head = m.head; me.sig = sig; me.reopen = true;
621
+ vOpen({ id: me.vid, kind: m.kind, title: m.head, icon: 'meet', url: meetingUrl({ ...refNow(me), ws: me.ws }), render: (b) => paint(me, b), onClose: () => closed(me), more: moreOf(me, m) });
562
622
  widen('mtg');
563
623
  me.reopen = false;
564
624
  return;
@@ -566,24 +626,55 @@ function draw(me) {
566
626
  if (busy) return; // the PM is typing: the next read draws it
567
627
  paint(me, body);
568
628
  }
629
+ const refNow = (me) => (me.n ? { note: me.n.id } : me.row ? { event: me.row.id, date: me.row.day } : me.R);
630
+ /** ⋯ of the meeting: the model's list, each with its press. */
631
+ function moreOf(me, m) {
632
+ const on = (k) => () => act(me, k);
633
+ return m.more.map((x) => (x.sep ? { sep: true } : { label: x.label, danger: !!x.danger, on: on(x.k) }));
634
+ }
635
+ async function act(me, k) {
636
+ const ui = me.ui, m = me.model, S = m && m.series;
637
+ if (k === 'about') return openAbout(me);
638
+ if (k === 'prev' || k === 'next') { const x = S && S[k]; if (x && x.id) openMeeting({ note: x.id }, { ws: me.ws }); return; }
639
+ if (k === 'copy') { const md = mdOf(m); try { await navigator.clipboard.writeText(md); say(me, 'Copied the notes as Markdown.'); } catch { say(me, 'The browser did not allow copying. Select the text in the notes instead.', 'bad'); } return; }
640
+ if (k === 'fresh') return newNote(me.ws);
641
+ if (k === 'src') { ui.src = true; return repaint(me); }
642
+ if (k === 'shots') return shots(me);
643
+ if (k === 'why') { ui.why = !ui.why; return repaint(me); }
644
+ if (k === 'serout' || k === 'serback') return serMember(me, k === 'serout');
645
+ if (k === 'priv') { ui.ask = 'priv'; return repaint(me); }
646
+ }
647
+ async function shots(me) {
648
+ if (!me.n) return;
649
+ const r = await pmPost('/api/viewer-meeting/capture', { id: me.n.id, shots: me.model.live.shotsPaused ? 'on' : 'paused' });
650
+ if (!r || !r.ok) return say(me, 'Not changed: ' + ((r && r.error) || 'no answer'), 'bad');
651
+ me.D.vm = { ...(me.D.vm || {}), capture: r.capture }; say(me, r.capture.shots === 'paused' ? 'Screen shots are paused. Sound and the transcript go on.' : 'Screen shots go on.'); return draw(me);
652
+ }
653
+ async function serMember(me, out) {
654
+ me.ui.pop = ''; const r = await pmPost('/api/notes/series-member', { id: me.n.id, key: out ? 'off' : null });
655
+ say(me, r && r.ok ? (out ? 'Taken out of the series. It stays a note on its own.' : 'Back in its series.') : 'Not saved: ' + ((r && r.error) || 'no answer'), r && r.ok ? '' : 'bad'); return load(me);
656
+ }
569
657
  function paint(me, body) {
570
658
  const top = body.scrollTop;
571
659
  body.innerHTML = meetHtml(me.model, me.ui);
572
660
  body.scrollTop = top;
661
+ const line = body.querySelector('.czs-sum .czs-line > span:not(.czs-dot):not(.czs-r)'); if (line) line.dataset.clk = 'state';
662
+ if (me.ui.edit) { const ta = body.querySelector('.vzp-ed [data-a="etext"]'); if (ta && me.ui.focusEdit) { me.ui.focusEdit = false; ta.focus(); ta.setSelectionRange(ta.value.length, ta.value.length); } }
573
663
  placePop(me, body);
574
664
  body.querySelectorAll('.vzp-top[data-w]').forEach((b) => b.style.setProperty('flex-grow', b.dataset.w)); // the topic names under the strip, as wide as their stretch
575
665
  body.onclick = (e) => press(me, e);
576
666
  body.onchange = (e) => change(me, e);
667
+ // the file picker stays open for seconds while the card may draw again; the input's own handler still runs when it was replaced meanwhile
668
+ body.querySelectorAll('input[type="file"][data-a="matfile"]').forEach((i) => { i.onchange = (e) => { e.stopPropagation(); change(me, e); }; });
577
669
  body.oninput = (e) => input(me, e);
578
670
  body.onkeydown = (e) => keydown(me, e, body);
579
671
  }
580
672
  /** The open popover goes in its anchor, drawn once per paint (its list is redrawn on its own while the PM types). */
581
673
  function placePop(me, body) {
582
- const P = me.ui.pop; if (P !== 'mat' && P !== 'about' && P !== 'ser') return;
674
+ const P = me.ui.pop; if (P !== 'mat' && P !== 'about') return;
583
675
  const anc = P === 'mat' ? body.querySelector('[data-pop="mat"]') : body.querySelector('[data-pop="head"]'); if (!anc) return;
584
676
  if (P === 'mat') { anc.innerHTML = matPopHtml(me.mat || { row: me.row }); if (!me.matShown && anc.scrollIntoView) { me.matShown = true; anc.scrollIntoView({ block: 'nearest' }); } }
585
- else if (P === 'about') anc.innerHTML = me.about ? aboutPopHtml(me.about, me.aboutQ || '', me.row ? 'Applies to every meeting of “' + me.row.title + '”. The calendar itself is never written.' : 'Applies to this note.') : '<div class="vzm-pop"><p class="vz-empty">Reading what it can be about.</p></div>';
586
- else anc.innerHTML = `<div class="vzm-pop vzm-pop-s" role="menu"><button type="button" role="menuitem" class="vzm-mi2 vz-hv" data-a="${me.model.seriesOff ? 'm-serback' : 'm-serout'}">${me.model.seriesOff ? 'Put it back in its series' : 'Not part of this series'}<br><span class="vzm-sm vzm-mut">${me.model.seriesOff ? 'Join the meetings with the same title again' : 'Keep this note on its own'}</span></button></div>`;
677
+ else anc.innerHTML = me.about ? aboutPopHtml(me.about, me.aboutQ || '', me.row ? 'Applies to every meeting of “' + me.row.title + '”. The calendar itself is never written.' : 'Applies to this note.') : '<div class="vzm-pop"><p class="vz-empty">Reading what it can be about.</p></div>';
587
678
  }
588
679
  function keydown(me, e, body) {
589
680
  const a = e.target.dataset && e.target.dataset.a;
@@ -594,7 +685,7 @@ function keydown(me, e, body) {
594
685
  if (e.key === 'Escape' && me.ui.pop) { e.stopPropagation(); me.ui.pop = ''; paint(me, body); }
595
686
  if (a === 'seek' && (e.key === 'ArrowRight' || e.key === 'ArrowLeft')) { e.preventDefault(); const P = ensurePlay(me); if (P) seek(me, P.pos + (e.key === 'ArrowRight' ? 10000 : -10000), false); }
596
687
  }
597
- const bodyEl = () => document.querySelector('#czViewer .cz-vw-body');
688
+ const bodyEl = () => (MT && vCur() && vCur().id === MT.vid ? document.querySelector('#czViewer .cz-vw-body') : null); // null while a preview covers the meeting
598
689
  const repaint = (me) => { const b = bodyEl(); if (b && MT === me) paint(me, b); };
599
690
  function say(me, text, tone, undo) { me.ui.msg = { text, tone, undo }; repaint(me); clearTimeout(me.msgT); me.msgT = setTimeout(() => { if (me.ui.msg && me.ui.msg.text === text) { me.ui.msg = null; repaint(me); } }, 9000); }
600
691
  function tick(me) {
@@ -603,20 +694,19 @@ function tick(me) {
603
694
  if (me.model.mk === 'live' && me.D.rec.held) {
604
695
  const el = elapsedOf(me), s = b.querySelector('[data-clk="state"]');
605
696
  if (s && me.model.liveK === 'rec') s.textContent = 'Recording · ' + mmss(el);
697
+ else if (s && me.model.liveK === 'paused') s.textContent = 'Paused at ' + mmss(el);
606
698
  }
607
699
  }
608
700
 
609
701
  /* the presses */
610
702
  async function press(me, e) {
611
- const t = e.target.closest('[data-a]');
703
+ const pa = e.target.closest('[data-czs-act]'); // the summary's one primary
704
+ const t = pa || e.target.closest('[data-a]');
612
705
  if (!t) { if (me.ui.pop && !e.target.closest('.vzm-pop')) { me.ui.pop = ''; repaint(me); } return; }
613
706
  if (t.disabled) return;
614
- const a = t.dataset.a, ui = me.ui, m = me.model, C = rec();
615
- if (a !== 'more' && !a.startsWith('m-')) ui.more = false;
616
- if (ui.pop && !t.closest('.vzm-pop') && !['addmat', 'm-about', 'sermenu', 'topic'].includes(a)) ui.pop = '';
707
+ const a = pa ? pa.dataset.czsAct : t.dataset.a, ui = me.ui, m = me.model, C = rec();
708
+ if (ui.pop && !t.closest('.vzm-pop') && !['addmat', 'm-about', 'topic'].includes(a)) ui.pop = '';
617
709
  switch (a) {
618
- case 'tab': ui.tab = t.dataset.k; ui.pop = ''; return repaint(me);
619
- case 'more': ui.more = !ui.more; return repaint(me);
620
710
  case 'popx': ui.pop = ''; return repaint(me);
621
711
  case 'askno': ui.ask = null; return repaint(me);
622
712
  case 'record': ui.ask = 'consent'; return repaint(me);
@@ -624,12 +714,12 @@ async function press(me, e) {
624
714
  ui.ask = null; t.disabled = true;
625
715
  const res = me.n && !me.row ? await C.resume(me.n.id) : await C.record(me.row);
626
716
  say(me, res.ok ? 'Recording. Notes are being taken on this machine. Let people know.' : res.error, res.ok ? '' : 'bad');
627
- ui.tab = ''; return load(me);
717
+ announce(); return load(me);
628
718
  }
629
- case 'resume': { t.disabled = true; const res = await C.resume(me.n.id); say(me, res.ok ? 'Listening again.' : res.error, res.ok ? '' : 'bad'); return load(me); }
630
- case 'pause': { ui.ask = null; t.disabled = true; const res = await C.pause(); say(me, res.ok ? 'Paused. You can resume within 1 hour.' : res.error, res.ok ? '' : 'bad'); return load(me); }
719
+ case 'resume': { t.disabled = true; const res = await C.resume(me.n.id); say(me, res.ok ? 'Listening again.' : res.error, res.ok ? '' : 'bad'); announce(); return load(me); }
720
+ case 'pause': { ui.ask = null; t.disabled = true; const res = await C.pause(); say(me, res.ok ? 'Paused. You can resume within 1 hour.' : res.error, res.ok ? '' : 'bad'); announce(); return load(me); }
631
721
  case 'stop': ui.ask = 'stop'; return repaint(me);
632
- case 'stopgo': { ui.ask = null; t.disabled = true; const res = await C.stop(me.n.id); say(me, res.ok ? (res.discarded ? 'Nothing was recorded, so the note was deleted.' : 'Stopped. The final notes are written now.') : res.error, res.ok ? '' : 'bad'); ui.tab = ''; return load(me); }
722
+ case 'stopgo': { ui.ask = null; t.disabled = true; const res = await C.stop(me.n.id); say(me, res.ok ? (res.discarded ? 'Nothing was recorded, so the note was deleted.' : 'Stopped. The final notes are written now.') : res.error, res.ok ? '' : 'bad'); announce(); return load(me); }
633
723
  case 'hl': { const res = await C.highlight(); say(me, res.ok ? 'Keeping the last 30 seconds and the next ones as a highlight.' : res.error, res.ok ? '' : 'bad'); return; }
634
724
  case 'src': ui.src = !ui.src; return repaint(me);
635
725
  case 'app': {
@@ -637,12 +727,6 @@ async function press(me, e) {
637
727
  if (me.n) { const r = await pmPost('/api/viewer-meeting/capture', { id: me.n.id, app: t.dataset.id }); if (r && r.ok) me.D.vm = { ...(me.D.vm || {}), capture: r.capture }; }
638
728
  ui.src = false; return draw(me);
639
729
  }
640
- case 'shots': {
641
- if (!me.n) return;
642
- const r = await pmPost('/api/viewer-meeting/capture', { id: me.n.id, shots: m.live.shotsPaused ? 'on' : 'paused' });
643
- if (!r || !r.ok) return say(me, 'Not changed: ' + ((r && r.error) || 'no answer'), 'bad');
644
- me.D.vm = { ...(me.D.vm || {}), capture: r.capture }; say(me, r.capture.shots === 'paused' ? 'Screen shots are paused. Sound and the transcript go on.' : 'Screen shots go on.'); return draw(me);
645
- }
646
730
  case 'privgo': {
647
731
  ui.ask = null; const r = await pmPost('/api/notes/private', { id: me.n.id, private: true });
648
732
  say(me, r && r.ok ? 'Private. Only what you type is kept.' : 'Not changed: ' + ((r && r.error) || 'no answer'), r && r.ok ? '' : 'bad'); return load(me);
@@ -655,13 +739,8 @@ async function press(me, e) {
655
739
  const i = row.querySelector('input'); if (i) { i.focus(); i.select(); i.onblur = () => setMin(me, +i.dataset.i, i.value); } return;
656
740
  }
657
741
  case 'note': if (t.dataset.id) return openMeeting({ note: t.dataset.id }, { ws: me.ws }); return;
658
- case 'mat': {
659
- const x = matAt(me, +t.dataset.i); if (!x) return;
660
- if (x.url && /^https:\/\//.test(x.url)) { window.open(x.url, '_blank', 'noopener'); return; }
661
- return say(me, '“' + x.title + '” is a PMOS ' + x.kind.toLowerCase() + '. Open it from its initiative.');
662
- }
663
- case 'present': return presentIt(me, matAt(me, +t.dataset.i));
664
- case 'matrm': return removeMat(me, matAt(me, +t.dataset.i));
742
+ case 'mat': return openPreview(me, +t.dataset.i);
743
+ case 'present': return presentIt(me, +t.dataset.i);
665
744
  case 'addmat': if (ui.pop === 'mat') { ui.pop = ''; return repaint(me); } return openMat(me);
666
745
  case 'matadd': { const P = me.mat; const it = P && (P.q ? P.found : P.sug)[+t.dataset.i]; if (it) return addMat(me, it.url && !it.ref ? { url: it.url, title: it.title } : { kind: it.kind, ref: it.ref, title: it.title, ...(it.ws ? { ws: it.ws } : {}) }); return; }
667
746
  case 'topic': ui.pop = ui.pop === 'topic' ? '' : 'topic'; return repaint(me);
@@ -670,12 +749,11 @@ async function press(me, e) {
670
749
  case 'makewi': return makeWorkItem(me, +t.dataset.i);
671
750
  case 'madeundo': { const md = ui.made[+t.dataset.i]; delete ui.made[+t.dataset.i]; repaint(me); if (md && md.undo) await md.undo(); return; }
672
751
  case 'msgundo': { const u = ui.msg && ui.msg.undo; ui.msg = null; if (u) await u(); return; }
673
- case 'prepfold': ui.prepOpen = !ui.prepOpen; return repaint(me);
674
752
  /* Replay */
675
753
  case 'play': return togglePlay(me);
676
754
  case 'speed': { const P = ensurePlay(me); const sp = [1, 1.5, 2]; ui.speed = sp[(sp.indexOf(ui.speed || 1) + 1) % sp.length]; if (P && P.aud) P.aud.playbackRate = ui.speed; return repaint(me); }
677
755
  case 'seekto': if (t.dataset.t !== '') return seek(me, +t.dataset.t, true); return;
678
- case 'trseek': ui.tab = 'replay'; repaint(me); return seek(me, +t.dataset.t, true);
756
+ case 'trseek': { seek(me, +t.dataset.t, true); const c = bodyEl() && bodyEl().querySelector('.vzp-card'); if (c && c.scrollIntoView) c.scrollIntoView({ block: 'nearest' }); return; }
679
757
  case 'seek': { const r = t.getBoundingClientRect(); return seek(me, Math.max(0, Math.min(1, (e.clientX - r.left) / r.width)) * m.notes.replay.len, false); }
680
758
  case 'shotbig': if (m.notes.replay && m.notes.replay.noteId) window.open('/api/notes/screen?id=' + encodeURIComponent(m.notes.replay.noteId) + '&t=' + t.dataset.t, '_blank', 'noopener'); return;
681
759
  case 'pf': ui.filter = t.dataset.k; return repaint(me);
@@ -685,27 +763,71 @@ async function press(me, e) {
685
763
  case 'confirmall': return bulk(me, 'confirmed', m.notes.replay.points.filter((p) => !p.verdict).map((p) => p.id));
686
764
  case 'unwrong': return verdict(me, [t.dataset.id], null, 'It is back in the kept points.');
687
765
  case 'ptask': return bulk(me, 'task', [t.dataset.id]);
688
- /* the head */
689
- case 'sermenu': ui.pop = ui.pop === 'ser' ? '' : 'ser'; return repaint(me);
766
+ /* a correction (XvAReplayEdit) */
767
+ case 'pedit': return startEdit(me, t.dataset.id, t.closest('.czs-body') ? 'kept' : 'part');
768
+ case 'ekind': ui.draft = { ...ui.draft, kind: t.dataset.k, text: draftText() }; return repaint(me);
769
+ case 'elearn': ui.draft = { ...ui.draft, learn: ui.draft.learn === false, text: draftText() }; return repaint(me);
770
+ case 'ecancel': ui.edit = null; ui.draft = null; return repaint(me);
771
+ case 'esave': return saveEdit(me);
772
+ /* the summary's quiet line and the lines under it */
690
773
  case 'm-about': if (ui.pop === 'about') { ui.pop = ''; return repaint(me); } return openAbout(me);
691
774
  case 'aboutpick': return saveAbout(me, t.dataset.v);
692
- case 'm-copy': { ui.more = false; repaint(me); const md = mdOf(m); try { await navigator.clipboard.writeText(md); say(me, 'Copied the notes as Markdown.'); } catch { say(me, 'The browser did not allow copying. Select the text in the notes instead.', 'bad'); } return; }
693
- case 'm-fresh': { ui.more = false; return newNote(me.ws); }
694
- case 'm-serout': case 'm-serback': {
695
- ui.more = false; ui.pop = ''; const r = await pmPost('/api/notes/series-member', { id: me.n.id, key: a === 'm-serout' ? 'off' : null });
696
- say(me, r && r.ok ? (a === 'm-serout' ? 'Taken out of the series. It stays a note on its own.' : 'Back in its series.') : 'Not saved: ' + ((r && r.error) || 'no answer'), r && r.ok ? '' : 'bad'); return load(me);
697
- }
698
- case 'm-why': ui.more = false; ui.why = !ui.why; return repaint(me);
775
+ case 'm-fresh': return newNote(me.ws);
776
+ case 'm-serback': return serMember(me, false);
699
777
  default:
700
778
  }
701
779
  }
780
+ const draftText = () => { const ta = bodyEl() && bodyEl().querySelector('.vzp-ed [data-a="etext"]'); return ta ? ta.value : undefined; };
781
+ /** Opens the correction of one kept point where the PM pressed it: "In this part" or the All kept fold. */
782
+ function startEdit(me, id, where) {
783
+ const V = me.model && me.model.notes.replay, p = V && V.points.find((x) => x.id === id); if (!p) return;
784
+ const ui = me.ui;
785
+ ui.edit = id; ui.editIn = where; ui.draft = { kind: p.kind, text: p.text, learn: true }; ui.focusEdit = true;
786
+ ui.also = 0;
787
+ repaint(me);
788
+ }
789
+ /** While the PM types: what PMOS will remember, and how many other points of this note use those words. */
790
+ function editInput(me, text) {
791
+ const V = me.model && me.model.notes.replay, p = V && V.points.find((x) => x.id === me.ui.edit); if (!p) return;
792
+ me.ui.draft = { ...me.ui.draft, text };
793
+ const ed = bodyEl() && bodyEl().querySelector('.vzp-ed'); if (!ed) return;
794
+ const fresh = document.createElement('div');
795
+ me.ui.also = alsoOf(V, p, text);
796
+ fresh.innerHTML = editHtmlOf(p, me.ui);
797
+ const nl = fresh.querySelector('.vzp-learn'), ol = ed.querySelector('.vzp-learn'); if (nl && ol) ol.innerHTML = nl.innerHTML;
798
+ const nw = fresh.querySelector('.vzp-was'), ow = ed.querySelector('.vzp-was');
799
+ if (nw && !ow) ed.querySelector('.vzp-kinds').after(nw); else if (!nw && ow) ow.remove(); else if (nw && ow) ow.innerHTML = nw.innerHTML;
800
+ const ns = fresh.querySelector('[data-a="esave"]'), os = ed.querySelector('[data-a="esave"]'); if (ns && os) os.disabled = ns.disabled;
801
+ }
802
+ const editHtmlOf = (p, ui) => editHtml(p, ui.draft || {}, ui.also || 0);
803
+ function alsoOf(V, p, text) {
804
+ const ph = phraseOfPage(p.orig.text, text);
805
+ return ph ? V.points.filter((x) => x.id !== p.id && mentions(x.text, ph)).length : 0;
806
+ }
807
+ async function saveEdit(me) {
808
+ const ui = me.ui, V = me.model && me.model.notes.replay, p = V && V.points.find((x) => x.id === ui.edit); if (!p || !me.n) return;
809
+ const text = String(draftText() ?? ui.draft.text ?? '').trim(), kind = ui.draft.kind || p.kind;
810
+ if (!text) return;
811
+ const r = await pmPost('/api/meeting-points/edit', { note: me.n.id, id: p.id, kind, text, orig: p.orig, learn: ui.draft.learn !== false,
812
+ items: V.points.map((x) => ({ id: x.id, text: x.text })) });
813
+ if (!r || !r.ok) return say(me, 'Not saved: ' + ((r && r.error) || 'no answer'), 'bad');
814
+ ui.edit = null; ui.draft = null;
815
+ me.D.edits = r.edits || me.D.edits;
816
+ if (r.lesson) me.D.lessons = (me.D.lessons || []).concat([r.lesson]);
817
+ draw(me);
818
+ const n = (r.check || []).length;
819
+ say(me, r.lesson ? (r.lesson.phrase ? 'Fixed. I will remember what “' + r.lesson.phrase + '” means' : 'Fixed. Future notes use your correction') + (n ? '; ' + plural(n, 'more point') + ' to check.' : '.') : 'Fixed this one only.', '',
820
+ r.lesson ? async () => { const f = await pmPost('/api/meeting-points/forget', { lesson: r.lesson.id }); if (f && f.ok) { me.D.lessons = (me.D.lessons || []).filter((x) => x.id !== r.lesson.id); draw(me); say(me, 'Forgotten. The point stays fixed.'); } else say(me, 'Not forgotten: ' + ((f && f.error) || 'no answer'), 'bad'); } : null);
821
+ }
702
822
  function change(me, e) {
703
823
  const t = e.target;
704
824
  if (t.dataset.a === 'priv' && t.checked) { t.checked = false; me.ui.ask = 'priv'; repaint(me); }
825
+ if (t.dataset.a === 'matfile' && t.files && t.files[0]) uploadMat(me, t.files[0]);
705
826
  }
706
827
  function input(me, e) {
707
828
  const a = e.target.dataset.a, v = e.target.value;
708
829
  if (a === 'mine') return saveMine(me, v);
830
+ if (a === 'etext') return editInput(me, v);
709
831
  if (a === 'matq') { clearTimeout(me.matT); me.matT = setTimeout(() => findMat(me, v.trim()), 220); return; }
710
832
  if (a === 'aboutq') { me.aboutQ = v; const l = bodyEl() && bodyEl().querySelector('.vzm-pop [data-pl="list"]'); if (l && me.about) l.innerHTML = aboutListHtml(me.about, v); }
711
833
  }
@@ -851,23 +973,46 @@ function seek(me, ms, play) {
851
973
  if (play && !P.on) togglePlay(me); else playUi(me);
852
974
  }
853
975
 
854
- /* Present (MtFocus → MtPresent): a PMOS deck in the presenter view */
855
- async function presentIt(me, x) {
856
- if (!x || !x.deck || !x.ref) return;
976
+ /* Present (XvAPresent…): every material the presenter can show, starting with the one pressed. The audience window opens in the press
977
+ * itself (the browser allows a window only then), so pressing Present already shares; PMOS cannot press Share in the call app for you. */
978
+ const AUDIENCE = 'pmos-meeting-audience'; // premium-mtg-present.js AUDIENCE_NAME: the same window, so the presenter finds it
979
+ function audience() { try { const w = window.open('about:blank', AUDIENCE, 'popup=yes,width=1280,height=720'); return w && !w.closed ? w : null; } catch { return null; } }
980
+ function meetingNow(me) {
981
+ const m = me.model, Fo = m ? m.focus : null, cur = Fo ? Fo.agenda.findIndex((a) => a.k === 'now' || a.k === 'late') : -1, a = cur >= 0 ? Fo.agenda[cur] : null;
982
+ const F = me.D && me.D.F, qs = F && F.captured && Array.isArray(F.captured.questions) ? F.captured.questions.filter((z) => z && z.text && !z.answered) : [];
983
+ const last = qs[qs.length - 1];
984
+ return { title: m ? m.title : '', rec: !!(m && m.liveK === 'rec'), at: m && m.at, end: m && m.end, topic: a ? { n: a.n, of: Fo.agenda.length, text: a.text, left: a.plan ? (a.plan - a.used) * 60000 : null } : null, question: last ? last.text : '', asker: last ? last.who || last.by || '' : '' };
985
+ }
986
+ const matId = (x) => x.id || x.mkind + '|' + (x.ref || x.url || x.title);
987
+ async function presentIt(me, i, at) {
988
+ const all = (me.model && me.model.material) || [], x = all[i]; if (!x || !x.present) return;
989
+ const win = audience(); // before anything is awaited
990
+ const M = await import('./premium-mtg-present.js');
991
+ const list = all.filter((y) => y.present), start = list.indexOf(x);
992
+ const pos = { ...(me.presentPos || {}) }; if (at != null) pos[M.matOf(x).id] = at;
993
+ const r = await M.presentMaterial({ mats: list, start, pos, ws: me.ws, meeting: meetingNow(me), getMeeting: () => meetingNow(me), app: me.model.live.app, win,
994
+ onEnd: (p) => { me.presentPos = p; },
995
+ onKeep: async (text) => { if (!me.n || !text) return { ok: false, error: 'the meeting has no note yet' }; const body = String(me.n.body || '').replace(/\s+$/, '') + (me.n.body ? '\n' : '') + 'Question: ' + text; const s = await pmPost('/api/notes/save', { id: me.n.id, body }); if (s && s.ok) me.n.body = body; return s; },
996
+ onAddLink: async (url) => { if (!me.row) return { ok: false, error: 'material is kept per calendar meeting, and this note has none' }; const item = { url, title: new URL(url).hostname }; const r2 = await pmPost('/api/meeting-material', { op: 'add', event: matEv(me.row), scope: 'meeting', item }); if (r2 && r2.ok) load(me, true); return r2 && r2.ok ? { ok: true, item: { kind: 'link', ...item } } : r2; } });
997
+ if (r && r.ok === false) { if (win) { try { win.close(); } catch { /* gone */ } } say(me, r.error, 'bad'); }
998
+ }
999
+
1000
+ /* The preview (XvAMaterialPreview): the material for the PM only, in the Viewer, with ← back to the meeting. ⋯ holds Remove. */
1001
+ async function openPreview(me, i) {
1002
+ const x = me.model && me.model.material[i]; if (!x) return;
857
1003
  const M = await import('./premium-mtg-present.js');
858
- const meetingNow = () => {
859
- const m = me.model, Fo = m ? m.focus : null, cur = Fo ? Fo.agenda.findIndex((a) => a.k === 'now' || a.k === 'late') : -1, a = cur >= 0 ? Fo.agenda[cur] : null;
860
- const F = me.D && me.D.F, qs = F && F.captured && Array.isArray(F.captured.questions) ? F.captured.questions.filter((z) => z && z.text && !z.answered) : [];
861
- const last = qs[qs.length - 1];
862
- return { title: m ? m.title : '', rec: !!(m && m.liveK === 'rec'), at: m && m.at, end: m && m.end, topic: a ? { n: a.n, of: Fo.agenda.length, text: a.text, left: a.plan ? (a.plan - a.used) * 60000 : null } : null, question: last ? last.text : '', asker: last ? last.who || last.by || '' : '' };
863
- };
864
- const r = await M.presentDeck({ ws: x.ws || me.ws, path: x.ref, title: x.title, meeting: meetingNow(), getMeeting: meetingNow,
865
- onKeep: async (text) => { if (!me.n || !text) return { ok: false, error: 'the meeting has no note yet' }; const body = String(me.n.body || '').replace(/\s+$/, '') + (me.n.body ? '\n' : '') + 'Question: ' + text; const s = await pmPost('/api/notes/save', { id: me.n.id, body }); if (s && s.ok) me.n.body = body; return s; } });
866
- if (r && r.ok === false) say(me, r.error, 'bad');
1004
+ const id = matId(x), at = (me.presentPos || {})[M.matOf(x).id] || 0;
1005
+ me.previewing = true;
1006
+ const more = [x.url && /^https:/.test(x.url) ? { label: 'Open in a new tab', on: () => window.open(x.url, '_blank', 'noopener') } : null, { sep: true },
1007
+ { label: 'Remove from this meeting', danger: true, on: () => { vBack(); removeMat(me, x); } }].filter(Boolean);
1008
+ const pv = { at };
1009
+ vOpen({ id: 'material:' + id, kind: 'Meeting material', title: x.title, icon: x.icon === 'deck' ? 'slides' : 'doc', back: true, more,
1010
+ render: (b) => { M.previewMaterial(b, x, { ws: me.ws, at, onAt: (k) => { pv.at = k; }, onPresent: (k) => presentIt(me, i, k) }); },
1011
+ onClose: () => { me.previewing = false; setTimeout(() => { const c = vCur(); if (MT === me && (!c || c.id !== me.vid)) closed(me); else if (MT === me) draw(me); }, 0); } });
867
1012
  }
868
1013
 
869
- /* Add material (MtMaterial): a popover under the Material list */
870
- const matAt = (me, i) => { const tab = me.model && (me.ui.tab && me.model.focus && me.ui.tab in { focus: 1 } ? me.model.focus.material : me.model.prep.material); return tab ? tab[i] : null; };
1014
+ /* Add material (XvAMaterial): a popover under the Material list */
1015
+ const matAt = (me, i) => (me.model ? me.model.material[i] : null);
871
1016
  async function openMat(me) {
872
1017
  const row = me.row;
873
1018
  me.ui.pop = 'mat'; me.matShown = false; me.mat = { row, sug: null, found: null, q: '', topics: [], err: '' };
@@ -905,6 +1050,18 @@ async function addMat(me, item) {
905
1050
  if (!r || !r.ok) return matErr(me, 'Not added: ' + ((r && r.error) || 'no answer'));
906
1051
  me.ui.pop = ''; say(me, 'Added “' + clip(item.title, 60) + '”' + (scope === 'series' ? ' for every meeting of the series.' : ' for this meeting.')); load(me, true);
907
1052
  }
1053
+ /** Upload a file: the bytes go to the workspace (POST /api/meeting-material/file), then the file is added like any other material. */
1054
+ async function uploadMat(me, file) {
1055
+ if (!me.row) return matErr(me, 'Material is kept per calendar meeting. This note has no calendar event.');
1056
+ if (file.size > 20 * 1024 * 1024) return matErr(me, 'The file is larger than 20 MB.');
1057
+ if (me.mat) me.mat.busy = true; matErr(me, ''); repaint(me);
1058
+ let r;
1059
+ try { const res = await pressFetch('/api/meeting-material/file?name=' + encodeURIComponent(file.name), { method: 'POST', body: file, headers: { 'Content-Type': 'application/octet-stream' } }); r = await res.json(); }
1060
+ catch (e) { r = { ok: false, error: (e && e.message) || 'no answer' }; }
1061
+ if (me.mat) me.mat.busy = false;
1062
+ if (!r || !r.ok) { repaint(me); return matErr(me, 'Not kept: ' + ((r && r.error) || 'no answer')); }
1063
+ return addMat(me, { kind: 'file', ref: r.name, title: file.name });
1064
+ }
908
1065
  function addLink(me, v) {
909
1066
  let u = null;
910
1067
  try { u = new URL(String(v).trim()); } catch { /* not an address */ }
@@ -951,7 +1108,6 @@ async function saveAbout(me, v) {
951
1108
  if (typeof window !== 'undefined') {
952
1109
  document.addEventListener('click', (e) => {
953
1110
  if (!MT || !e.target.isConnected) return; // the press repainted the card: its own handler already decided
954
- if (MT.ui.more && !e.target.closest('.vz-menu,[data-a="more"]')) { MT.ui.more = false; repaint(MT); }
955
1111
  if (MT.ui.pop && !e.target.closest('#czViewer')) { MT.ui.pop = ''; repaint(MT); }
956
1112
  });
957
1113
  }