create-pmos 0.320.0 → 0.322.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.
@@ -5,6 +5,7 @@
5
5
  import { pmPost } from './http.js';
6
6
  import { proposalsModel, relationsOf, copyKindOf, copyView, editBody, acceptBody, rejectBody, askBody, askLine, issueBody, mdHtml, sectionAttribution, revDiffHtml } from './premium-doc-edit.js';
7
7
  import { $, $$, esc, openDlg, closeDlg, toast, loadThread, logHtml, turnA, ptx, kv, CHECK, CHEV, AI } from './premium-shell.js';
8
+ import { openDocPage } from './premium-vw-doc.js';
8
9
 
9
10
  const when = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); if (!m) return ''; return +m[3] + ' ' + ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][+m[2] - 1]; };
10
11
 
@@ -52,7 +53,7 @@ export function mountDocSheet(ctx) {
52
53
  const cps = (s.copies || []).map(copyView);
53
54
  const cpc = s.copies == null ? '' : cps.length ? cps.map((c) => `<button type="button" class="chp lk ${c.tone}" data-ds="cp" aria-expanded="${!!s.cp}" title="${esc(c.words)}"><i></i>${esc(c.tool)}: ${esc(c.state.toLowerCase())}</button>`).join('') : `<button type="button" class="chp lk" data-ds="cp" aria-expanded="${!!s.cp}"><i></i>Link a copy</button>`;
54
55
  const file = String(d.path).split('/').pop();
55
- const head = `<div class="dsm2"><span class="chp ${d.st === 'ok' ? 'ok' : d.st === 'draft' ? 'warn' : ''}"><i></i>${esc(d.state)}</span>${revs.length ? `<span class="chp mono">v${revs.length}</span>` : ''}${chk}${cpc}<button type="button" class="chp lk" data-ds="meta" aria-expanded="${!!s.meta}" title="${esc(d.path)}">${esc(file)}</button>${last ? `<span class="chp"><span>Last change: <b>${esc(whoOf(last))}</b>${last.at ? ', ' + esc(when(last.at)) : ''}</span></span>` : ''}${d.when && !last ? `<span class="chp">updated ${esc(d.when)}</span>` : ''}</div>${s.cp ? copiesHtml(s, cps) : ''}${s.meta ? `<div class="dsmeta"><p class="dpath">${esc(d.path)}</p>${m0 && m0.fm.length ? kv(m0.fm) : '<p class="note">The file has no front matter.</p>'}</div>` : ''}`;
56
+ const head = `<div class="dsm2"><span class="chp ${d.st === 'ok' ? 'ok' : d.st === 'draft' ? 'warn' : ''}"><i></i>${esc(d.state)}</span>${revs.length ? `<span class="chp mono">v${revs.length}</span>` : ''}${chk}${cpc}<button type="button" class="chp lk" data-ds="meta" aria-expanded="${!!s.meta}" title="${esc(d.path)}">${esc(file)}</button><button type="button" class="chp lk" data-ds="page" title="Read and edit it as a page in the viewer">Open as a page</button>${last ? `<span class="chp"><span>Last change: <b>${esc(whoOf(last))}</b>${last.at ? ', ' + esc(when(last.at)) : ''}</span></span>` : ''}${d.when && !last ? `<span class="chp">updated ${esc(d.when)}</span>` : ''}</div>${s.cp ? copiesHtml(s, cps) : ''}${s.meta ? `<div class="dsmeta"><p class="dpath">${esc(d.path)}</p>${m0 && m0.fm.length ? kv(m0.fm) : '<p class="note">The file has no front matter.</p>'}</div>` : ''}`;
56
57
  let body = '';
57
58
  if (s.err) body = `<p class="empty3 plain">${esc(s.err)}</p>`;
58
59
  else if (s.tab === 'read') {
@@ -193,7 +194,7 @@ export function mountDocSheet(ctx) {
193
194
  const lg = e.target.closest('[data-lgd]');
194
195
  if (lg && sheet) { toggleCmp(lg.dataset.lgd); return; }
195
196
  const rl = e.target.closest('[data-rel]');
196
- if (rl && sheet) { openSheet({ path: rl.dataset.rel, title: rl.dataset.rt, st: 'ok', state: 'Current', key: 'rel:' + rl.dataset.rel }); return; }
197
+ if (rl && sheet) { openPage({ path: rl.dataset.rel, title: rl.dataset.rt }); return; } // a related file opens as a page beside this one (premium-viewer R1, R2)
197
198
  const t = e.target.closest('[data-sh]');
198
199
  if (t && sheet) { keepDraft(); sheet.vm = false; sheet.tab = t.dataset.sh; sheet.err = null; sheet.msg = ''; drawSheet(); loadTab(sheet.tab); return; }
199
200
  const b = e.target.closest('[data-ds]'); if (b && sheet) { sheetPress(b.dataset.ds); return; }
@@ -221,6 +222,7 @@ export function mountDocSheet(ctx) {
221
222
  const s = sheet; keepDraft();
222
223
  const fail = (m) => { s.busy = false; s.msg = m; drawSheet(); };
223
224
  if (act === 'meta') { s.meta = !s.meta; drawSheet(); return; }
225
+ if (act === 'page') { openPage({ path: s.d.path, title: s.d.title, iniName: s.d.iniName }); return; }
224
226
  if (act === 'cp') { s.cp = !s.cp; s.cpMsg = ''; drawSheet(); return; }
225
227
  if (act === 'cplink') {
226
228
  const t = String(s.cpUrl || '').trim(), kind = copyKindOf(t);
@@ -289,6 +291,11 @@ export function mountDocSheet(ctx) {
289
291
  toast('Rejected. The file is as it was.'); return reloadSheet(s);
290
292
  }
291
293
  }
294
+ /** The document as a page in the viewer (premium-vw-doc.js). A write there reads this sheet again, so its views stay in step. */
295
+ function openPage(doc) {
296
+ const s = sheet;
297
+ openDocPage(doc, { ws: ctx.ws, onWrite: () => { if (sheet === s && s) reloadSheet(s); } });
298
+ }
292
299
  async function pollAsk(s, id) {
293
300
  for (let i = 0; i < 400 && sheet === s; i++) {
294
301
  await new Promise((r) => setTimeout(r, 2000));
@@ -8,6 +8,7 @@ import { pmPost } from './http.js';
8
8
  import { mountDocSheet } from './premium-doc-sheet.js';
9
9
  import { $, $$, esc, openDlg, closeDlg, setMode, toast, loadThread, onScroll, wireRail, logHtml, turnA, ptx, pillOf, kv, H2, CHECK, CHEV, crumbHtml, wireCrumb, AI, openAddDoc, setPageGaps } from './premium-shell.js';
10
10
  import { barHtml, onBar, closeMenu } from './premium-acts.js';
11
+ import { openTicket } from './premium-vw-jira.js';
11
12
 
12
13
  let M = null; // the model
13
14
  let taskView = 'list', taskPage = 0;
@@ -134,6 +135,7 @@ function openTask(t) {
134
135
  const act = t.pmos ? `<div class="tkact"><span class="label">Status</span><div class="seg tkst" role="group" aria-label="Status"><i class="pill"></i>${STATES.map((s) => `<button data-tks="${esc(s)}" aria-pressed="${t.state === s}">${s}</button>`).join('')}</div></div><p class="note" style="margin-top:12px">A PMOS task is kept on the board. Jira tickets are read-only here: Jira owns their status and dates.</p>` : `<p class="xn">${t.src === 'PRD requirement' ? 'Read from the initiative’s PRD. Nothing on this page changes it.' : 'Read from the board. Jira owns its status and dates.'}</p>`;
135
136
  openDlg({ eye: 'Task · real data', title: t.title, sub: M.title, say, stream: turnA(ptx(say)), noteKey: null, pane: `<article class="paper doc">${kv(rows)}${act}</article>`, label: 'Task' });
136
137
  $('#askF').hidden = true; if ($('#oMain .tkst')) pillOf($('#oMain .tkst'));
138
+ if (taskKind(t) === 'jira' && t.ref) openTicket({ ws: M.board.ws, board: M.board.id, initiative: M.id, ref: t.ref }); // the ticket beside its facts (premium-viewer S5)
137
139
  $$('#oMain [data-tks]').forEach((b) => { b.onclick = async () => {
138
140
  if (b.getAttribute('aria-pressed') === 'true') return;
139
141
  const res = await pmPost('/api/boards/tasks/state', { ws: M.board.ws, board: M.board.id, task: t.uid, state: b.dataset.tks });
@@ -10,14 +10,19 @@
10
10
  * version (the design and its versions), GET /api/report-export (the files). PDF is the browser's print. Every render is HTML the server sanitized,
11
11
  * shown in a frame with an empty sandbox: nothing in it runs.
12
12
  * WRITES: only the report-design describe, sample, turn, accept and revert routes, each a press on the page (pmPost, behind the launch nonce). An
13
- * issued cycle is frozen: no design row and no turn. Editing, issuing and the copies in other tools stay in the console. */
13
+ * issued cycle is frozen: no design row and no turn. Issuing and the copies in other tools stay in the console.
14
+ * Edit opens the report's file as a page in the viewer (premium-vw-doc.js, initiative premium-viewer S2): the one document page every markdown file uses,
15
+ * with Present, Print and Download on its bar. Its words are saved there through the /api/doc-sheet routes. */
14
16
  import { $, esc, openDlg, toast, turnA, turnU, ptx, setFull } from './premium-shell.js';
15
17
  import { pmGet, pmPost } from './http.js';
18
+ import { vwShow } from './premium-viewer.js';
19
+ import { openDocPage } from './premium-vw-doc.js';
16
20
 
17
21
  const ICO = (p) => `<svg class="i" viewBox="0 0 24 24">${p}</svg>`;
18
22
  const PREV = ICO('<path d="m15 6-6 6 6 6"/>'), NEXT = ICO('<path d="m9 6 6 6-6 6"/>'), CHV = ICO('<path d="M6 9l6 6 6-6"/>'), XI = ICO('<path d="M6 6l12 12M18 6 6 18"/>');
19
23
  const DLI = ICO('<path d="M12 4v11M7 10l5 5 5-5M5 20h14"/>'), PRI = ICO('<path d="M7 9V4h10v5M7 17H5v-6h14v6h-2M8 14h8v6H8z"/>'), PLAY = ICO('<path d="M8 5v14l11-7z"/>');
20
24
  const CHK = ICO('<path d="M5 12.5l4.5 4.5L19 7.5"/>'), PLUS = ICO('<path d="M12 5v14M5 12h14"/>'), SEND = ICO('<path d="M5 12h14M13 6l6 6-6 6"/>');
25
+ const PEN = ICO('<path d="M4 20h4L19 9l-4-4L4 16z"/>');
21
26
  const EYE = ICO('<path d="M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12z"/><circle cx="12" cy="12" r="3"/>');
22
27
  const W = 1280;
23
28
  const POLL_MS = 800, POLL_MAX = 240000;
@@ -147,7 +152,8 @@ function barHtml() {
147
152
  const item = (k, l, ico, on) => `<button type="button" role="menuitem" data-rr="${k}"${on === undefined ? '' : ` aria-current="${on}"`}>${ico}${l}${on ? CHK : ''}</button>`;
148
153
  return `<div class="dsvr rdbar">${mnuHtml('rm', 'Read', EYE, item('present', 'Present', PLAY) + item('print', 'Print or save as PDF', PRI))}`
149
154
  + `<span class="rdsp">${mnuHtml('fm', R.view === 'deck' ? 'Slide deck' : 'Document', ICO('<path d="M12 3 3 8l9 5 9-5-9-5zM3 13l9 5 9-5"/>'), item('view|deck', 'Slide deck', '', R.view === 'deck') + item('view|doc', 'Document', '', R.view === 'doc'))}`
150
- + `<span class="dsvw"><button type="button" class="dsvb" data-rr="dm" aria-haspopup="menu" aria-expanded="${!!R.dm}">${DLI}Download${CHV}</button>${dm}</span></span></div>`;
155
+ + `<span class="dsvw"><button type="button" class="dsvb" data-rr="dm" aria-haspopup="menu" aria-expanded="${!!R.dm}">${DLI}Download${CHV}</button>${dm}</span>`
156
+ + (R.issued ? '' : `<button type="button" class="dsvb" data-rr="page" title="Read and edit the words as a page">${PEN}Edit</button>`) + '</span></div>';
151
157
  }
152
158
  function draw() {
153
159
  if (!R) return;
@@ -228,6 +234,7 @@ async function act(a) {
228
234
  if (k === 'md') { R.dm = false; saveMd(); draw(); return; }
229
235
  if (k === 'print') { R.mn = ''; draw(); printIt(); return; }
230
236
  if (k === 'present') { R.mn = ''; draw(); present(true); return; }
237
+ if (k === 'page') { openPage(); return; }
231
238
  if (k === 'pick') { const f = $('#rdFile'); if (f) f.click(); return; }
232
239
  if (k === 'ver') {
233
240
  if (v === 'cycle') { R.show = 'cycle'; R.i = 0; draw(); return; }
@@ -253,6 +260,17 @@ async function act(a) {
253
260
  if (r.redraw && r.redraw.started) { await settle(); await readCycle(); draw(); }
254
261
  }
255
262
  }
263
+ /** The report's file as the document page, with this report's Present, Print and Download on its bar. A save there reads the words again here. */
264
+ function openPage() {
265
+ const me = R;
266
+ openDocPage({ path: R.row.path, title: R.name + (R.row.slot ? ' · ' + R.row.slot : '') }, {
267
+ ws: () => me.ws,
268
+ extras: () => [{ k: 'present', label: 'Present', icon: PLAY }, { k: 'print', label: 'Print', icon: PRI },
269
+ { k: 'dl', label: 'Download', icon: DLI, note: 'The files carry the words, not the look. Print or save as PDF keeps the look.', menu: DL.map(([f, l, sub]) => ({ label: l, sub, icon: DLI, download: true, href: '/api/report-export?' + q({ ws: me.ws, path: me.row.path, fmt: f }) })).concat([{ k: 'md', label: 'Markdown (.md)', sub: 'The file, as written.', icon: DLI }]) }],
270
+ onExtra: (k) => { if (R !== me) return; if (k === 'present') { vwShow('main'); act(['present']); } else if (k === 'print') printIt(); else if (k === 'md') saveMd(); },
271
+ onWrite: async () => { if (R !== me) return; try { R.text = await textOf('/api/doc?' + q({ ws: R.ws, path: R.row.path })); R.W = wordsOf(R.text, R.name); } catch { /* the reader keeps what it had */ } if (R === me) draw(); },
272
+ });
273
+ }
256
274
  function saveMd() {
257
275
  const name = (R.row.path.split('/').slice(-2).join('-') || 'report.md');
258
276
  const u = URL.createObjectURL(new Blob([R.text || ''], { type: 'text/markdown' })), a = document.createElement('a');
@@ -0,0 +1,184 @@
1
+ /* premium-vw-doc-model.js — the pure half of the document page in the premium viewer (initiative premium-viewer, S2; planning/prd/premium-viewer-prd.md R2).
2
+ * No DOM and no fetch. It draws a markdown file as a page (title, byline, properties from the front matter, panels, tables, task lists, status labels,
3
+ * expand blocks, code blocks), lays an open proposal from GET /api/doc-sheet/proposals over the current text with each changed section marked, and
4
+ * merges an edited page back into the file so that sections nobody touched keep their exact text. Every value comes from the file, its log or the route. */
5
+ const esc = (s) => String(s == null ? '' : s).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
6
+ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
7
+
8
+ /** "2026-10-19" or an ISO time → "19 Oct 2026". Anything else → ''. */
9
+ export function dayOf(s) { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(s || '')); return m && +m[2] >= 1 && +m[2] <= 12 ? +m[3] + ' ' + MON[+m[2] - 1] + ' ' + m[1] : ''; }
10
+ /** The colour of a status label, by its words. */
11
+ export function toneOf(t) { return /done|complete|passed|shipped|approved|accepted|current/i.test(t) ? 'g' : /progress|review|build/i.test(t) ? 'b' : /not started|blocked|late|fail|risk|stale/i.test(t) ? 'r' : /draft|waiting|paused|proposed/i.test(t) ? 'y' : 'n'; }
12
+
13
+ const lz = (t) => `<span class="lz ${toneOf(t)}" contenteditable="false" data-st>${esc(t)}</span>`;
14
+ const dtp = (d) => `<span class="dt" contenteditable="false" data-dt="${esc(d)}">${esc(dayOf(d))}</span>`;
15
+ export const PANELS = ['info', 'note', 'tip', 'success', 'warning', 'caution', 'important', 'decision'];
16
+ const panel = (k, inner) => `<div class="pnl ${k}" data-k="${k}"><span class="pi pidot" contenteditable="false" aria-hidden="true"></span><div class="pc">${inner}</div></div>`;
17
+ const codeBlock = (lang, code) => `<div class="cb" data-lang="${esc(lang)}"><div class="cbh" contenteditable="false"><span>${esc(lang || 'text')}</span></div><pre>${esc(code)}</pre></div>`;
18
+
19
+ /** One line of markdown inline text → html. Code spans first, so nothing inside them is read as markup. */
20
+ export function inl(s) {
21
+ const codes = [];
22
+ let h = esc(s).replace(/`([^`]+)`/g, (m, c) => { codes.push(c); return `\u0000${codes.length - 1}\u0000`; });
23
+ h = h.replace(/:status\[([^\]]+)\]/g, (m, t) => lz(t))
24
+ .replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>')
25
+ .replace(/(^|[\s(])[_*]([^_*\s][^_*]*)[_*](?=[\s.,;:)!?]|$)/g, '$1<em>$2</em>')
26
+ .replace(/~~([^~]+)~~/g, '<s>$1</s>')
27
+ .replace(/\[([^\]]+)\]\(([^)\s]+)\)/g, (m, t, u) => `<a href="${/^(https?:|mailto:|#|\/)/i.test(u.replace(/&amp;/g, '&')) ? u : '#'}"${/^https?:/i.test(u) ? ' target="_blank" rel="noopener"' : ''}>${t}</a>`)
28
+ .replace(/(^|[\s(])(\d{4}-\d{2}-\d{2})(?=$|[\s.,;:)])/g, (m, a, d) => (dayOf(d) ? a + dtp(d) : m));
29
+ return h.replace(/\u0000(\d+)\u0000/g, (m, i) => `<code>${codes[i]}</code>`);
30
+ }
31
+
32
+ /** The front matter (the YAML block at the top) as [key, value] rows, and where the body starts. Only `key: value` lines are read; a list or a block is shown as written. */
33
+ export function frontOf(text) {
34
+ const t = String(text || '').replace(/\r/g, '');
35
+ const m = /^---\n([\s\S]*?)\n---(?:\n|$)/.exec(t);
36
+ if (!m) return { fm: [], raw: '', body: t };
37
+ const fm = [];
38
+ for (const l of m[1].split('\n')) { const r = /^([A-Za-z_][\w-]*):\s*(.*)$/.exec(l); if (r) fm.push([r[1], r[2].replace(/^"(.*)"$/, '$1').replace(/^'(.*)'$/, '$1')]); else if (fm.length && /^\s+\S/.test(l)) fm[fm.length - 1][1] += (fm[fm.length - 1][1] ? ', ' : '') + l.trim().replace(/^-\s*/, ''); }
39
+ return { fm, raw: m[0], body: t.slice(m[0].length) };
40
+ }
41
+
42
+ /** Markdown body → page html. Standard GitHub markdown: headings, lists, task lists, tables, quotes, `> [!NOTE]` panels, `<details>` expand blocks, code fences and rules.
43
+ * One extra, as the prototype has it: `:status[Done]` is a status label. `heads` lists [level, text, id]; ids run on from `o.start` so several bodies can share one page. */
44
+ export function bodyHtml(src, o = {}) {
45
+ const L = String(src || '').replace(/\r/g, '').split('\n'), out = [], heads = []; let i = 0;
46
+ const start = o.start || 0;
47
+ const isList = (l) => /^\s*([-*+]|\d+[.)])\s/.test(l);
48
+ while (i < L.length) {
49
+ const l = L[i];
50
+ if (!l.trim()) { i++; continue; }
51
+ if (/^```/.test(l)) { const lang = l.slice(3).trim(), buf = []; i++; while (i < L.length && !/^```/.test(L[i])) buf.push(L[i++]); i++; out.push(codeBlock(lang, buf.join('\n'))); continue; }
52
+ const h = /^(#{1,6})\s+(.*)$/.exec(l);
53
+ if (h) { const lv = Math.min(4, Math.max(2, h[1].length)), id = 'vwh' + (start + heads.length); heads.push([lv, h[2].replace(/[*_`]/g, ''), id]); out.push(`<h${lv} id="${id}" data-md="${h[1].length}">${inl(h[2])}</h${lv}>`); i++; continue; }
54
+ if (/^(-{3,}|\*{3,}|_{3,})\s*$/.test(l)) { out.push('<hr>'); i++; continue; }
55
+ if (/^>/.test(l)) {
56
+ const buf = []; while (i < L.length && /^>/.test(L[i])) buf.push(L[i++].replace(/^>\s?/, ''));
57
+ const a = /^\[!(\w+)\]\s*(.*)$/.exec(buf[0]);
58
+ if (a && PANELS.includes(a[1].toLowerCase())) out.push(panel(a[1].toLowerCase(), `<p>${inl([a[2], ...buf.slice(1)].filter((x) => x.trim()).join(' '))}</p>`));
59
+ else out.push(`<blockquote><p>${inl(buf.join(' '))}</p></blockquote>`);
60
+ continue;
61
+ }
62
+ if (/^\s*\|/.test(l)) {
63
+ const rows = []; while (i < L.length && /^\s*\|/.test(L[i])) rows.push(L[i++]);
64
+ const cells = (r) => r.trim().replace(/^\||\|$/g, '').split('|').map((c) => c.trim());
65
+ if (rows.length >= 2 && /^\s*\|?\s*:?-{2,}/.test(rows[1])) {
66
+ const hd = cells(rows[0]);
67
+ out.push(`<div class="tw"><table><thead><tr>${hd.map((c) => `<th>${inl(c)}</th>`).join('')}</tr></thead><tbody>${rows.slice(2).map((r) => { const c = cells(r); return `<tr>${hd.map((_, k) => `<td>${inl(c[k] || '')}</td>`).join('')}</tr>`; }).join('')}</tbody></table></div>`);
68
+ } else out.push(`<p>${inl(rows.join(' '))}</p>`);
69
+ continue;
70
+ }
71
+ if (isList(l)) {
72
+ const ord = /^\s*\d+[.)]/.test(l), items = [];
73
+ while (i < L.length && (isList(L[i]) || (/^\s{2,}\S/.test(L[i]) && items.length))) { if (isList(L[i])) items.push(L[i].replace(/^\s*([-*+]|\d+[.)])\s+/, '')); else items[items.length - 1] += ' ' + L[i].trim(); i++; }
74
+ if (items.every((t) => /^\[[ xX]\]\s/.test(t))) out.push(`<ul class="tasks">${items.map((t) => { const d = /^\[[xX]\]/.test(t); return `<li data-done="${d}"><span class="chk" contenteditable="false" role="checkbox" aria-checked="${d}" aria-label="Done"></span><span>${inl(t.slice(4))}</span></li>`; }).join('')}</ul>`);
75
+ else out.push(`<${ord ? 'ol' : 'ul'}>${items.map((t) => `<li>${inl(t)}</li>`).join('')}</${ord ? 'ol' : 'ul'}>`);
76
+ continue;
77
+ }
78
+ if (/^<details/.test(l)) {
79
+ const sm = /<summary>(.*?)<\/summary>/.exec(l), buf = []; i++;
80
+ if (!sm && i < L.length && /<summary>/.test(L[i])) { const s2 = /<summary>(.*?)<\/summary>/.exec(L[i]); i++; buf.length = 0; const inner = []; while (i < L.length && !/^<\/details>/.test(L[i])) inner.push(L[i++]); i++; const b = bodyHtml(inner.join('\n'), { start: start + heads.length }); heads.push(...b.heads); out.push(`<details class="xp"><summary>${inl(s2 ? s2[1] : 'Details')}</summary><div>${b.html}</div></details>`); continue; }
81
+ while (i < L.length && !/^<\/details>/.test(L[i])) buf.push(L[i++]); i++;
82
+ const b = bodyHtml(buf.join('\n'), { start: start + heads.length }); heads.push(...b.heads);
83
+ out.push(`<details class="xp"><summary>${inl(sm ? sm[1] : 'Details')}</summary><div>${b.html}</div></details>`); continue;
84
+ }
85
+ const buf = []; while (i < L.length && L[i].trim() && !/^(#{1,6}\s|>|\s*\||```|<details|(-{3,}|\*{3,}|_{3,})\s*$)/.test(L[i]) && !isList(L[i])) buf.push(L[i++].trim());
86
+ if (!buf.length) buf.push(L[i++]);
87
+ out.push(`<p>${inl(buf.join(' '))}</p>`);
88
+ }
89
+ return { html: out.join(''), heads };
90
+ }
91
+
92
+ /** The text split at its headings: the front matter, the part before the first heading, then each section as { name, head, body } where `head` is the heading
93
+ * line and `body` the lines up to the next heading of any level. A name used twice carries its count, as sectionsOf() in premium-doc-edit.js and the route name them. */
94
+ export function splitDoc(text) {
95
+ const f = frontOf(text), lines = f.body.split('\n'), secs = [], seen = {};
96
+ let pre = [], cur = null, fence = false;
97
+ for (const l of lines) {
98
+ if (/^```/.test(l)) fence = !fence;
99
+ const h = !fence && /^(#{1,4})\s+(.*)$/.exec(l);
100
+ if (h) { const nm = h[2].replace(/[*`]/g, ''); seen[nm] = (seen[nm] || 0) + 1; cur = { name: nm + (seen[nm] > 1 ? '#' + seen[nm] : ''), head: l, level: h[1].length, lines: [] }; secs.push(cur); } else if (cur) cur.lines.push(l); else pre.push(l);
101
+ }
102
+ return { fmRaw: f.raw, fm: f.fm, pre: pre.join('\n'), sections: secs.map((s) => ({ name: s.name, head: s.head, level: s.level, body: s.lines.join('\n') })) };
103
+ }
104
+ const joinDoc = (d) => d.fmRaw + [d.pre, ...d.sections.map((s) => s.head + '\n' + s.body)].join('\n').replace(/^\n+/, d.fmRaw ? '\n' : '');
105
+
106
+ /** The page's head: title, the first-level heading it came from (kept so a save writes it back), properties and labels, all from the text.
107
+ * The title is typed into only when it is that heading; a title from the front matter stays as the file has it. */
108
+ export function pageHead(text) {
109
+ const d = splitDoc(text), get = (k) => (d.fm.find((r) => r[0].toLowerCase() === k) || [])[1] || '';
110
+ const first = d.sections[0], h1 = first && first.level === 1 && !d.pre.trim() ? first : null;
111
+ const title = get('title') || (h1 ? h1.head.replace(/^#\s+/, '').replace(/[*`]/g, '') : '') || '';
112
+ const labels = (get('tags') || get('labels')).replace(/[[\]]/g, '').split(',').map((x) => x.trim().replace(/^"(.*)"$/, '$1')).filter(Boolean);
113
+ const SKIP = new Set(['title', 'tags', 'labels']);
114
+ const props = d.fm.filter((r) => !SKIP.has(r[0].toLowerCase()) && String(r[1]).trim()).slice(0, 12);
115
+ return { title, h1: h1 ? h1.name : null, h1Head: h1 ? h1.head : null, titleEdits: !!h1 && !get('title'), labels, props };
116
+ }
117
+ /** One property's value as the table draws it: a date as a date, a status word as a label, an id in mono. */
118
+ export function propHtml(k, v) {
119
+ const s = String(v);
120
+ if (/^(status|state)$/i.test(k)) return lz(s);
121
+ if (/^(timestamp|date|updated|created|target|due)$/i.test(k) && dayOf(s)) return dtp(s.slice(0, 10));
122
+ if (/(_id|_slug|_kr|kr|lane|type|path|id)$/i.test(k) || /^[\w:./-]+$/.test(s) && /[:/_]/.test(s)) return `<code>${esc(s)}</code>`;
123
+ return inl(s);
124
+ }
125
+
126
+ /** An open proposal laid over the current text. `p` is a row of GET /api/doc-sheet/proposals; `kept` the names of the sections still applied (all live ones
127
+ * when null). Returns the blocks to draw in order — { md, chg } where chg is null for text that stays, or { name, kind, before, on } for a changed section — and
128
+ * the counts the bar says. A stale section (the route marks it) is never applied: the file changed there since the proposal was made. */
129
+ export function overlay(current, p, kept) {
130
+ const cur = splitDoc(current), aft = splitDoc((p && p.after) || ''), secs = (p && p.sections) || [];
131
+ const live = secs.filter((s) => !s.stale), stale = secs.filter((s) => s.stale);
132
+ const on = (n) => (kept ? kept.includes(n) : true);
133
+ const by = new Map(live.map((s) => [s.name, s]));
134
+ const blocks = [];
135
+ if (cur.pre.trim()) blocks.push({ md: cur.pre, chg: null });
136
+ const added = live.filter((s) => s.kind === 'added');
137
+ const placed = new Set();
138
+ const addAfter = (name) => { // added sections go after the section that precedes them in the proposal's text
139
+ const ai = aft.sections.findIndex((s) => s.name === name);
140
+ for (let k = ai + 1; k < aft.sections.length; k++) {
141
+ const n = aft.sections[k].name, a = added.find((x) => x.name === n);
142
+ if (!a) break;
143
+ if (placed.has(n)) continue; placed.add(n);
144
+ blocks.push({ md: aft.sections[k].head + '\n' + (a.after || ''), chg: { name: n, kind: 'added', before: '', on: on(n) }, hide: !on(n) });
145
+ }
146
+ };
147
+ addAfter(null);
148
+ for (const s of cur.sections) {
149
+ const c = by.get(s.name);
150
+ if (c && c.kind === 'changed') blocks.push({ md: s.head + '\n' + (on(s.name) ? c.after : s.body), chg: { name: s.name, kind: 'changed', before: s.head + '\n' + (c.before != null ? c.before : s.body), on: on(s.name) } });
151
+ else if (c && c.kind === 'removed') blocks.push({ md: s.head + '\n' + s.body, chg: { name: s.name, kind: 'removed', before: s.head + '\n' + s.body, on: on(s.name) } });
152
+ else blocks.push({ md: s.head + '\n' + s.body, chg: null });
153
+ addAfter(s.name);
154
+ }
155
+ for (const a of added) if (!placed.has(a.name)) { const as = aft.sections.find((x) => x.name === a.name); blocks.push({ md: (as ? as.head : '## ' + a.name) + '\n' + (a.after || ''), chg: { name: a.name, kind: 'added', before: '', on: on(a.name) }, hide: !on(a.name) }); }
156
+ const n = live.filter((s) => on(s.name)).length;
157
+ return { blocks, live: live.map((s) => s.name), stale: stale.map((s) => s.name), applied: n, total: live.length };
158
+ }
159
+ /** The bar's words over an agent edit. */
160
+ export function overlayLine(o, v) {
161
+ if (!o.total) return o.stale.length ? `The document changed where the agent proposed ${o.stale.length === 1 ? 'its change' : 'its changes'}, so nothing can be applied. Undo all closes it; ask again for a new one.` : '';
162
+ if (!o.applied) return `Everything is back to v${v}. Undo all closes the agent's edit.`;
163
+ return `The agent changed ${o.applied} ${o.applied === 1 ? 'place' : 'places'}. Click a highlight to see what it said before.` + (o.stale.length ? ` ${o.stale.length} more ${o.stale.length === 1 ? 'change does' : 'changes do'} not apply, because the document changed there since.` : '');
164
+ }
165
+
166
+ /** An edited page back into the file. `orig` is the file as read; `base` the page serialized as it was drawn (before any typing); `now` the page serialized now.
167
+ * Sections whose serialized text did not change keep the file's exact text; the front matter always does. So a save changes only what was typed. */
168
+ export function mergeEdit(orig, base, now) {
169
+ if (base === now) return orig;
170
+ const O = splitDoc(orig), B = splitDoc(base), N = splitDoc(now);
171
+ const bOf = new Map(B.sections.map((s) => [s.name, s])), oOf = new Map(O.sections.map((s) => [s.name, s]));
172
+ const same = (a, b) => a && b && a.head.trim() === b.head.trim() && a.body.trim() === b.body.trim();
173
+ const out = { fmRaw: O.fmRaw, pre: B.pre.trim() === N.pre.trim() ? O.pre : N.pre, sections: [] };
174
+ for (const s of N.sections) {
175
+ const b = bOf.get(s.name), o = oOf.get(s.name);
176
+ out.sections.push(same(s, b) && o ? o : { name: s.name, head: s.head, body: '\n' + s.body.trim() + '\n' });
177
+ }
178
+ let t = joinDoc(out);
179
+ if (/\n$/.test(orig) && !/\n$/.test(t)) t += '\n';
180
+ return t.replace(/\n{3,}/g, '\n\n');
181
+ }
182
+
183
+ /** Words → minutes to read, at 220 words a minute. */
184
+ export function readMinutes(text) { return Math.max(1, Math.round(String(text || '').split(/\s+/).filter(Boolean).length / 220)); }
@@ -0,0 +1,171 @@
1
+ :root{--fs-1:11px;--fs-2:12px;--fs-3:14px;--fs-4:16px;--fs-5:20px;--fs-6:28px}
2
+ /* premium-vw-doc.css — the document page in the premium viewer (initiative premium-viewer, S2). Loaded once by vwStyle('doc'). Sizes are the console's
3
+ * six steps only (var(--fs-1..6)), weights 400/500/600, the page's own tokens otherwise. Checked by premium-console-type.test.js. */
4
+ :root{--vw-lnk:rgb(36,92,190);--vw-pur:rgb(110,72,190)}
5
+ :root[data-theme="dark"]{--vw-lnk:rgb(130,170,250);--vw-pur:rgb(186,160,250)}
6
+ @media (prefers-color-scheme:dark){:root:not([data-theme="light"]){--vw-lnk:rgb(130,170,250);--vw-pur:rgb(186,160,250)}}
7
+ .vwdoc{max-width:780px;margin:0 auto;padding:2px 0 24px;position:relative}
8
+ .vwdoc .gap{flex:1}
9
+ .vwmut{color:var(--ink-3);font-size:var(--fs-2);margin:0}
10
+ .vwline{margin:0 0 10px}
11
+ .vwempty{color:var(--ink-3);font-size:var(--fs-3);padding:24px 4px}
12
+ .vwrow{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:8px}
13
+ .vwrow .vwmut{flex:1;min-width:160px}
14
+ .vwbtn{min-height:34px;padding:0 13px;border-radius:6px;border:1px solid var(--hair);background:var(--card-solid);color:var(--ink);font:500 var(--fs-2) var(--sans);display:inline-flex;align-items:center;gap:6px;cursor:pointer}
15
+ .vwbtn.pri{background:var(--solid);color:var(--on-solid);border-color:var(--solid)}
16
+ .vwbtn[disabled]{opacity:.45;cursor:default}
17
+ .vwbtn .i,.vwseg .i,.vwtb .i,.vwcl .i,.vwagt>.i{width:15px;height:15px;flex:none}
18
+ .vwin{flex:1;min-width:0;min-height:34px;padding:0 11px;border-radius:6px;border:1px solid var(--hair);background:var(--card-solid);color:var(--ink);font:400 var(--fs-3) var(--sans)}
19
+ .vwdoc :focus-visible{outline:2px solid var(--ember);outline-offset:2px}
20
+ /* the document's own bar: Page, Edit, Markdown, and Ask the agent */
21
+ .vwdt{display:flex;align-items:center;gap:8px;margin:0 0 12px;flex-wrap:wrap}
22
+ .vwsg{display:inline-flex;padding:3px;border-radius:8px;background:var(--well);gap:2px}
23
+ .vwseg{min-height:30px;padding:0 11px;border-radius:6px;border:0;background:transparent;color:var(--ink-2);font:500 var(--fs-2) var(--sans);display:inline-flex;align-items:center;gap:6px;cursor:pointer}
24
+ .vwseg[aria-pressed="true"]{background:var(--card-solid);color:var(--ink);box-shadow:var(--card-shadow)}
25
+ .vwseg[disabled]{opacity:.45;cursor:default}
26
+ .vwask{margin:0 0 14px;padding:10px 12px;border:1px solid var(--hair);border-radius:8px;background:var(--card-solid)}
27
+ .vwask textarea{width:100%;box-sizing:border-box;border:0;background:transparent;color:var(--ink);font:400 var(--fs-3)/1.5 var(--sans);resize:vertical;outline:0}
28
+ /* an agent's edit: one bar, then the changed sections highlighted in the page */
29
+ .vwag{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:0 0 12px;padding:8px 8px 8px 14px;border-radius:8px;background:var(--card-solid);border:1px solid var(--hair);box-shadow:var(--card-shadow);font-size:var(--fs-2);color:var(--ink-2)}
30
+ .vwagt{display:flex;gap:9px;align-items:flex-start;flex:1;min-width:200px}
31
+ .vwagt>.i{color:var(--ember-ink);margin-top:2px}
32
+ .vwagt b{display:block;color:var(--ink);font-weight:500}
33
+ .vwaga{display:flex;gap:6px}
34
+ .vwchg{position:relative;margin:0 -12px 6px;padding:2px 12px 2px;border-left:3px solid var(--ok);background:color-mix(in oklab,var(--ok) 8%,transparent);border-top-right-radius:6px;border-bottom-right-radius:6px}
35
+ .vwchg.removed{border-left-color:var(--bad);background:color-mix(in oklab,var(--bad) 7%,transparent)}
36
+ .vwchg.removed .vwcb{text-decoration:line-through;color:var(--ink-3)}
37
+ .vwchg.off{border-left-color:var(--hair);background:transparent}
38
+ .vwchg.off.removed .vwcb{text-decoration:none;color:inherit}
39
+ .vwcl{display:flex;align-items:center;gap:6px;width:100%;min-height:30px;margin:4px 0 0;padding:0;border:0;background:transparent;color:var(--ok);font:500 var(--fs-1) var(--mono);letter-spacing:.04em;text-transform:uppercase;cursor:pointer;text-align:left}
40
+ .vwchg.removed .vwcl{color:var(--bad)}
41
+ .vwchg.off .vwcl{color:var(--ink-3)}
42
+ .vwcl em{margin-left:auto;font-style:normal;text-transform:none;letter-spacing:0;font-family:var(--sans);color:var(--ink-3);text-decoration:underline}
43
+ .vwbefore{margin:6px 0 10px;padding:10px 12px;border-radius:6px;background:var(--well);border:1px dashed var(--hair)}
44
+ .vwlab{margin:0 0 6px;font:500 var(--fs-1) var(--mono);letter-spacing:.06em;text-transform:uppercase;color:var(--ink-3)}
45
+ /* the page itself, drawn like a Confluence page */
46
+ .cf{background:var(--card-solid);border:1px solid var(--hair);border-radius:8px;padding:26px 36px 20px;box-shadow:var(--card-shadow);font-size:var(--fs-3);line-height:1.65;color:var(--ink);transition:box-shadow .25s}
47
+ .cf.editing{box-shadow:0 0 0 2px color-mix(in oklab,var(--ember) 35%,transparent)}
48
+ .cft{font:600 var(--fs-6)/1.25 var(--sans);letter-spacing:-.015em;margin:0 0 10px;outline:0}
49
+ .cfby{display:flex;align-items:center;gap:8px;font-size:var(--fs-2);color:var(--ink-3);flex-wrap:wrap}
50
+ .cfby .avdot{width:22px;height:22px;border-radius:50%;display:grid;place-items:center;background:var(--solid);color:var(--on-solid);font:600 var(--fs-1) var(--sans)}
51
+ .cflb{display:flex;gap:6px;flex-wrap:wrap;margin-top:12px}
52
+ .cflb span{font-size:var(--fs-1);padding:1px 8px;border-radius:6px;background:var(--well);color:var(--ink-2)}
53
+ .cfpr{width:100%;border-collapse:collapse;margin:16px 0 0;font-size:var(--fs-2)}
54
+ .cfpr th{width:150px;text-align:left;font-weight:500;background:var(--well);color:var(--ink-2)}
55
+ .cfpr th,.cfpr td{border:1px solid var(--hair);padding:6px 11px;vertical-align:top;overflow-wrap:anywhere}
56
+ .cfb{outline:0;min-height:80px}
57
+ .cfb>:first-child{margin-top:18px}
58
+ .cfb h2{font:600 var(--fs-5)/1.3 var(--sans);letter-spacing:-.01em;margin:26px 0 8px}
59
+ .cfb h3{font:600 var(--fs-4)/1.35 var(--sans);margin:20px 0 6px}
60
+ .cfb h4{font:600 var(--fs-3)/1.4 var(--sans);margin:16px 0 4px}
61
+ .cfb p{margin:0 0 10px}
62
+ .cfb ul,.cfb ol{margin:0 0 10px;padding-left:24px}
63
+ .cfb li{margin:3px 0}
64
+ .cf a{color:var(--vw-lnk);text-decoration:none}
65
+ .cfb blockquote{margin:0 0 12px;padding:1px 0 1px 16px;border-left:3px solid var(--hair);color:var(--ink-2)}
66
+ .cfb blockquote p:last-child{margin:0}
67
+ .cfb code{font:400 var(--fs-2) var(--mono);background:var(--well);padding:1px 5px;border-radius:6px}
68
+ .cfb hr{border:0;border-top:1px solid var(--hair);margin:22px 0}
69
+ .cfb .tw{overflow-x:auto;margin:0 0 14px}
70
+ .cfb table{border-collapse:collapse;min-width:60%;font-size:var(--fs-2)}
71
+ .cfb th,.cfb td{border:1px solid var(--hair);padding:6px 11px;text-align:left;vertical-align:top;min-width:60px}
72
+ .cfb thead th{background:var(--well);font-weight:500}
73
+ .pnl{display:grid;grid-template-columns:18px minmax(0,1fr);gap:10px;padding:11px 14px;border-radius:6px;margin:0 0 14px;background:var(--pb,var(--well))}
74
+ .pnl .pidot{width:14px;height:14px;margin-top:4px;border-radius:50%;border:2px solid var(--pc,var(--ink-3));box-sizing:border-box;user-select:none}
75
+ .pnl .pc>:last-child{margin-bottom:0}
76
+ .pnl.info{--pb:color-mix(in oklab,var(--vw-lnk) 9%,transparent);--pc:var(--vw-lnk)}
77
+ .pnl.note,.pnl.important{--pb:color-mix(in oklab,var(--vw-pur) 10%,transparent);--pc:var(--vw-pur)}
78
+ .pnl.tip,.pnl.success{--pb:color-mix(in oklab,var(--ok) 10%,transparent);--pc:var(--ok)}
79
+ .pnl.warning{--pb:color-mix(in oklab,var(--ember) 14%,transparent);--pc:var(--ember-ink)}
80
+ .pnl.caution{--pb:color-mix(in oklab,var(--bad) 10%,transparent);--pc:var(--bad)}
81
+ .pnl.decision{--pb:color-mix(in oklab,var(--ok) 7%,transparent);--pc:var(--ok)}
82
+ .pnl.decision .pc::before{content:"Decision";display:block;font:600 var(--fs-1) var(--mono);letter-spacing:.08em;text-transform:uppercase;color:var(--ok);margin-bottom:2px}
83
+ .lz{display:inline-block;padding:0 6px;border-radius:6px;font:600 var(--fs-1)/19px var(--sans);text-transform:uppercase;letter-spacing:.03em;vertical-align:1px;background:var(--well);color:var(--ink-2);white-space:nowrap;user-select:none}
84
+ .lz.g{background:color-mix(in oklab,var(--ok) 14%,transparent);color:var(--ok)}
85
+ .lz.b{background:color-mix(in oklab,var(--vw-lnk) 13%,transparent);color:var(--vw-lnk)}
86
+ .lz.r{background:color-mix(in oklab,var(--bad) 13%,transparent);color:var(--bad)}
87
+ .lz.y{background:color-mix(in oklab,var(--ember) 18%,transparent);color:var(--ember-ink)}
88
+ .dt{display:inline-block;padding:0 6px;border-radius:6px;background:var(--well);line-height:20px;user-select:none}
89
+ .cfb .tasks{list-style:none;padding-left:2px}
90
+ .cfb .tasks li{display:flex;gap:9px;align-items:flex-start}
91
+ .chk{width:16px;height:16px;border:1.5px solid var(--ink-3);border-radius:6px;flex:none;margin-top:4px;display:grid;place-items:center;background:var(--card-solid)}
92
+ .cf.editing .chk{cursor:pointer}
93
+ .chk[aria-checked="true"]{background:var(--vw-lnk);border-color:var(--vw-lnk)}
94
+ .chk[aria-checked="true"]::after{content:"";width:8px;height:4px;border:2px solid var(--card-solid);border-top:0;border-right:0;transform:rotate(-45deg) translate(1px,-1px)}
95
+ .tasks li[data-done="true"]>span:last-child{text-decoration:line-through;color:var(--ink-3)}
96
+ .xp{border:1px solid var(--hair);border-radius:6px;margin:0 0 14px}
97
+ .xp summary{cursor:pointer;padding:7px 12px;font-weight:500;list-style:none;display:flex;gap:8px;align-items:center}
98
+ .xp summary::-webkit-details-marker{display:none}
99
+ .xp summary::before{content:"";width:6px;height:6px;border:solid var(--ink-3);border-width:0 1.5px 1.5px 0;transform:rotate(-45deg);transition:transform .2s}
100
+ .xp[open] summary::before{transform:rotate(45deg)}
101
+ .xp>div{padding:0 14px 4px 26px}
102
+ .cb{border:1px solid var(--hair);border-radius:8px;overflow:hidden;margin:0 0 14px}
103
+ .cbh{display:flex;align-items:center;padding:4px 12px;background:var(--well);font:500 var(--fs-1) var(--mono);color:var(--ink-3);user-select:none}
104
+ .cb pre{margin:0;padding:12px 14px;font:400 var(--fs-2)/1.6 var(--mono);overflow-x:auto;outline:0}
105
+ .cff{display:flex;gap:16px;align-items:center;flex-wrap:wrap;border-top:1px solid var(--hair);margin-top:24px;padding-top:12px;font-size:var(--fs-2);color:var(--ink-3)}
106
+ .cff code{font:400 var(--fs-1) var(--mono);overflow-wrap:anywhere}
107
+ /* editing: a toolbar over the page, a / menu, and the save row */
108
+ .vwetb{position:sticky;top:0;z-index:4;display:flex;align-items:center;gap:1px;overflow-x:auto;scrollbar-width:none;margin:0 0 12px;padding:4px;border-radius:8px;background:var(--card-solid);border:1px solid var(--hair);box-shadow:var(--card-shadow)}
109
+ .vwetb::-webkit-scrollbar{display:none}
110
+ .vwetb .sp{width:1px;height:18px;background:var(--hair);margin:0 4px;flex:none}
111
+ .vwtb{height:32px;min-width:32px;padding:0 7px;border:0;border-radius:6px;background:transparent;display:inline-flex;align-items:center;justify-content:center;gap:5px;font:400 var(--fs-2) var(--sans);color:var(--ink-2);white-space:nowrap;flex:none;cursor:pointer}
112
+ .vwtb[aria-pressed="true"]{background:var(--well);color:var(--ink)}
113
+ .vwtb.fx{font-size:var(--fs-3)}
114
+ .vwtb.dd::after{content:"";width:5px;height:5px;border:solid currentColor;border-width:0 1.4px 1.4px 0;transform:rotate(45deg) translateY(-2px);margin-left:2px;opacity:.6}
115
+ .vwtb .styL{min-width:84px;text-align:left}
116
+ .vwpop{position:absolute;left:var(--rp-px,8px);top:var(--rp-py,0);z-index:20;min-width:220px;max-width:300px;max-height:320px;overflow:auto;padding:5px;border-radius:8px;background:var(--card-solid);border:1px solid var(--hair);box-shadow:var(--card-shadow)}
117
+ .vwpop button{display:grid;grid-template-columns:26px minmax(0,1fr) auto;gap:8px;align-items:center;width:100%;min-height:34px;padding:3px 8px;border:0;border-radius:6px;background:transparent;color:var(--ink);font:400 var(--fs-2) var(--sans);text-align:left;cursor:pointer}
118
+ .vwpop button[aria-current="true"],.vwpop button:focus-visible{background:var(--well)}
119
+ .vwpop .ki{width:24px;height:24px;border-radius:6px;display:grid;place-items:center;background:var(--well);color:var(--ink-2);font:500 var(--fs-1) var(--sans)}
120
+ .vwpop kbd{font:400 var(--fs-1) var(--mono);color:var(--ink-3)}
121
+ .vwpop .vwmut{padding:8px}
122
+ .vwsave{margin:12px 0 0;padding:12px;border:1px solid var(--hair);border-radius:8px;background:var(--card-solid)}
123
+ .vwsave .vwin{width:100%;box-sizing:border-box}
124
+ .vwerr{margin:6px 0 0;font-size:var(--fs-2);color:var(--ember-ink)}
125
+ .vwerr:empty{display:none}
126
+ .vwmd{width:100%;box-sizing:border-box;min-height:420px;padding:16px 18px;border-radius:8px;border:1px solid var(--hair);background:var(--card-solid);color:var(--ink);font:400 var(--fs-2)/1.6 var(--mono);resize:vertical;outline:0}
127
+ @media (max-width:640px){
128
+ .cf{padding:18px 16px 14px;border-radius:6px}
129
+ .cft{font-size:var(--fs-5)}
130
+ .cfpr th{width:110px}
131
+ .vwchg{margin:0 -8px 6px;padding:2px 8px}
132
+ .vwbtn,.vwseg,.vwtb,.vwcl,.vwpop button{min-height:44px}
133
+ .vwtb{min-width:44px}
134
+ .vwin{min-height:44px}
135
+ .vwaga{width:100%}.vwaga .vwbtn{flex:1;justify-content:center}
136
+ }
137
+ @media (prefers-reduced-motion:reduce){.cf,.xp summary::before{transition:none}}
138
+ /* the opener's own buttons on the read bar (a report's Present, Print and Download) */
139
+ .vwxm{position:relative;display:inline-flex}
140
+ .vwxmn{top:calc(100% + 6px);right:0;min-width:260px}
141
+ .vwxmn a{display:grid;grid-template-columns:26px minmax(0,1fr) auto;gap:8px;align-items:center;min-height:34px;padding:3px 8px;border-radius:6px;color:var(--ink);font:400 var(--fs-2) var(--sans);text-decoration:none}
142
+ .vwxmn a:focus-visible{background:var(--well)}
143
+ .vwxmn small{display:block;color:var(--ink-3);font-size:var(--fs-1)}
144
+ .vwxmn .vwmut{padding:6px 8px 4px}
145
+ @media (max-width:640px){.vwxmn{right:auto;left:0;min-width:240px}.vwxmn a{min-height:44px}}
146
+ /* Health, Links and Copies: three chips under the bar, each opening its panel */
147
+ .vwmore{display:flex;gap:6px;flex-wrap:wrap;margin:-4px 0 12px}
148
+ .vwchip{min-height:30px;padding:0 11px;border-radius:6px;border:1px solid var(--hair);background:var(--card-solid);color:var(--ink-2);font:500 var(--fs-2) var(--sans);display:inline-flex;align-items:center;gap:6px;cursor:pointer}
149
+ .vwchip em{font-style:normal;font-family:var(--mono);color:var(--ink-3)}
150
+ .vwchip.ok em{color:var(--ok)}.vwchip.warn em{color:var(--ember-ink)}
151
+ .vwchip[aria-expanded="true"]{background:var(--well);color:var(--ink)}
152
+ .vwmp{margin:0 0 14px;padding:12px 14px;border:1px solid var(--hair);border-radius:8px;background:var(--card-solid);display:grid;gap:8px}
153
+ .vwck{display:grid;gap:4px}
154
+ .vwckr{display:grid;grid-template-columns:12px minmax(0,1fr) auto;gap:4px 10px;align-items:center;padding:6px 0;border-top:1px solid var(--hair);font-size:var(--fs-2)}
155
+ .vwckr .ckdot{width:8px;height:8px;border-radius:50%;background:var(--ink-3)}
156
+ .vwckr.ok i{background:var(--ok)}.vwckr.no i{background:var(--bad)}
157
+ .vwckr b{font-weight:500;font-family:var(--mono);overflow-wrap:anywhere}
158
+ .vwckr span{color:var(--ink-3)}
159
+ .vwckr small{grid-column:2/-1;color:var(--ink-3);font-size:var(--fs-1)}
160
+ .vwlinks{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:12px}
161
+ .vwli{display:flex;align-items:center;gap:8px;justify-content:space-between}
162
+ .vwli>button,.vwli>span:first-child{display:flex;align-items:center;gap:8px;min-width:0;min-height:36px;padding:2px 6px;border:0;border-radius:6px;background:transparent;color:var(--ink);font:400 var(--fs-2) var(--sans);text-align:left}
163
+ .vwli>button{cursor:pointer}
164
+ .vwli b{font-weight:500;display:block;overflow-wrap:anywhere}.vwli small{display:block;color:var(--ink-3);font-size:var(--fs-1)}
165
+ .vwli .i{width:15px;height:15px;flex:none;color:var(--ink-3)}
166
+ .vwcp{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:4px 10px;align-items:center;padding:8px 0;border-top:1px solid var(--hair)}
167
+ .vwcp b{font-weight:500;display:block}.vwcp small{display:block;color:var(--ink-3);font-size:var(--fs-1);overflow-wrap:anywhere}
168
+ .vwcp .vwmut,.vwcp a{grid-column:1/-1}
169
+ .vwcp a{color:var(--vw-lnk);font-size:var(--fs-2)}
170
+ @media (max-width:640px){.vwchip,.vwli>button{min-height:44px}}
171
+ @media (hover:hover){.vwbtn:hover{background:var(--well)}.cf a:hover{text-decoration:underline}.vwtb:hover{background:var(--well);color:var(--ink)}.vwpop button:hover{background:var(--well)}.vwxmn a:hover{background:var(--well)}.vwli>button:hover{background:var(--well)}}