@action-state-group/capsule-viewer 0.1.0 → 0.3.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 (90) hide show
  1. package/README.md +73 -2
  2. package/dist/alias-interpreters.d.ts +18 -0
  3. package/dist/alias-interpreters.js +50 -0
  4. package/dist/alias-interpreters.js.map +1 -0
  5. package/dist/browser.d.ts +5 -2
  6. package/dist/browser.js +19 -5
  7. package/dist/browser.js.map +1 -1
  8. package/dist/builtin-manifests.d.ts +51 -0
  9. package/dist/builtin-manifests.js +196 -0
  10. package/dist/builtin-manifests.js.map +1 -0
  11. package/dist/compliance-styles.d.ts +1 -8
  12. package/dist/compliance-styles.js +41 -3
  13. package/dist/compliance-styles.js.map +1 -1
  14. package/dist/compliance-view.d.ts +41 -1
  15. package/dist/compliance-view.js +737 -303
  16. package/dist/compliance-view.js.map +1 -1
  17. package/dist/compliance.d.ts +33 -4
  18. package/dist/compliance.js +92 -13
  19. package/dist/compliance.js.map +1 -1
  20. package/dist/composed-styles.d.ts +12 -0
  21. package/dist/composed-styles.js +20 -0
  22. package/dist/composed-styles.js.map +1 -0
  23. package/dist/composed-view.d.ts +1 -1
  24. package/dist/composed-view.js +9 -2
  25. package/dist/composed-view.js.map +1 -1
  26. package/dist/contract-report-wording.d.ts +195 -0
  27. package/dist/contract-report-wording.js +1141 -0
  28. package/dist/contract-report-wording.js.map +1 -0
  29. package/dist/contract-report.d.ts +92 -0
  30. package/dist/contract-report.js +63 -0
  31. package/dist/contract-report.js.map +1 -0
  32. package/dist/emitter-shell.html +176 -2
  33. package/dist/emitter.d.ts +36 -0
  34. package/dist/emitter.js +64 -1
  35. package/dist/emitter.js.map +1 -1
  36. package/dist/evidence-graph-view.d.ts +60 -7
  37. package/dist/evidence-graph-view.js +1344 -106
  38. package/dist/evidence-graph-view.js.map +1 -1
  39. package/dist/evidence-graph.iife.js +12410 -5624
  40. package/dist/frame-tokens.generated.d.ts +3 -0
  41. package/dist/frame-tokens.generated.js +5 -0
  42. package/dist/frame-tokens.generated.js.map +1 -0
  43. package/dist/index.d.ts +3 -0
  44. package/dist/index.js +5 -0
  45. package/dist/index.js.map +1 -1
  46. package/dist/outcome-report-presentation.d.ts +48 -0
  47. package/dist/outcome-report-presentation.js +90 -0
  48. package/dist/outcome-report-presentation.js.map +1 -0
  49. package/dist/outcome-report-styles.d.ts +1 -16
  50. package/dist/outcome-report-styles.js +48 -45
  51. package/dist/outcome-report-styles.js.map +1 -1
  52. package/dist/outcome-report-view.d.ts +75 -2
  53. package/dist/outcome-report-view.js +1039 -436
  54. package/dist/outcome-report-view.js.map +1 -1
  55. package/dist/presentation-builder.d.ts +55 -6
  56. package/dist/presentation-builder.js +163 -69
  57. package/dist/presentation-builder.js.map +1 -1
  58. package/dist/presentation-fragment.d.ts +129 -0
  59. package/dist/presentation-fragment.js +213 -0
  60. package/dist/presentation-fragment.js.map +1 -0
  61. package/dist/presentation-mount.d.ts +2 -2
  62. package/dist/presentation-mount.js +1 -1
  63. package/dist/presentation-mount.js.map +1 -1
  64. package/dist/presentation-registry.d.ts +277 -0
  65. package/dist/presentation-registry.js +416 -0
  66. package/dist/presentation-registry.js.map +1 -0
  67. package/dist/record-content.d.ts +68 -0
  68. package/dist/record-content.js +153 -0
  69. package/dist/record-content.js.map +1 -0
  70. package/dist/record-dating.d.ts +10 -0
  71. package/dist/record-dating.js +76 -0
  72. package/dist/record-dating.js.map +1 -0
  73. package/dist/report-front-styles.d.ts +9 -0
  74. package/dist/report-front-styles.js +55 -0
  75. package/dist/report-front-styles.js.map +1 -0
  76. package/dist/report-front.d.ts +78 -0
  77. package/dist/report-front.js +274 -0
  78. package/dist/report-front.js.map +1 -0
  79. package/dist/report-levels.d.ts +206 -0
  80. package/dist/report-levels.js +739 -0
  81. package/dist/report-levels.js.map +1 -0
  82. package/dist/report-provenance.d.ts +111 -0
  83. package/dist/report-provenance.js +535 -0
  84. package/dist/report-provenance.js.map +1 -0
  85. package/dist/viewer-build.d.ts +37 -0
  86. package/dist/viewer-build.js +29 -0
  87. package/dist/viewer-build.js.map +1 -0
  88. package/dist/wording/contract-report-eu-ai-act.en.json +295 -0
  89. package/dist/wording/contract-report-outcomes.en.json +394 -0
  90. package/package.json +3 -2
@@ -1,19 +1,22 @@
1
1
  // SPDX-License-Identifier: BSD-3-Clause
2
- import { buildVerifiedBundleContext, disclosureOf, isVerifiedBundleContext, withCountersigners, } from "@action-state-group/agent-action-capsule";
3
- import { BUILTIN_MANIFEST_COMPOSED, BUILTIN_MANIFEST_EVALUATION_SUMMARY_GRAPH, BUILTIN_MANIFEST_NO_AGGREGATE, BUILTIN_MANIFEST_REPORT_ROWS, BUILTIN_MANIFEST_RESULT, BUILTIN_MANIFEST_RESULT_COMPLIANCE, BUILTIN_MANIFEST_RESULT_OUTCOME_REPORT, } from "@action-state-group/agent-action-capsule";
2
+ import { AGENT_INPUT_ORIGINALS_EXTENSION, BOOK_PAYLOADS_EXTENSION, buildVerifiedBundleContext, carriedCapsuleCommitment, committedDigest, disclosureOf, logCoordinates, PUBLISHED_CAPSULE_RECORD_TYPE, recordTimes, resolveCarriedInput, isVerifiedBundleContext, REQUIREMENT_CLAIM, readOutcomeReportTerms, withCountersigners, } from "@action-state-group/agent-action-capsule";
3
+ import { BUILTIN_MANIFEST_COMPOSED, BUILTIN_MANIFEST_EVALUATION_SUMMARY_GRAPH, BUILTIN_MANIFEST_NO_AGGREGATE, BUILTIN_MANIFEST_REPORT_ROWS, BUILTIN_MANIFEST_RESULT, BUILTIN_MANIFEST_RESULT_COMPLIANCE, BUILTIN_MANIFEST_RESULT_CONTRACT_REPORT, BUILTIN_MANIFEST_RESULT_OUTCOME_REPORT, } from "./builtin-manifests.js";
4
4
  import { classifyCountersignatures, declaredProducerKeys, } from "@action-state-group/agent-action-capsule";
5
5
  import { buildEvidenceGraph, EvidenceGraphError, zoneStatement, } from "@action-state-group/agent-action-capsule";
6
6
  import { digestCapability } from "@action-state-group/agent-action-capsule";
7
- import { renderOutcomeReportPage } from "./outcome-report-view.js";
8
- import { readOutcomeReportPresentation, } from "@action-state-group/agent-action-capsule";
9
- import { renderCompliancePage } from "./compliance-view.js";
7
+ import { renderContractReport, } from "./contract-report.js";
8
+ import { readOutcomeReportPresentation, } from "./outcome-report-presentation.js";
10
9
  import { composedSectionModule } from "./composed-view.js";
10
+ import { DEFAULT_WORDS } from "./contract-report-wording.js";
11
+ import { RECORD_CONTENT_CSS, renderContent } from "./record-content.js";
12
+ import { deferBody, recordAddress, revealRecord, revealRecordsByHash, } from "./report-levels.js";
11
13
  import { readCompliancePresentation, } from "./compliance-presentation.js";
12
14
  import { readPresentationBlock } from "@action-state-group/agent-action-capsule";
13
- import { bundleVerified, PresentationAmbiguityError, PresentationRegistry, } from "@action-state-group/agent-action-capsule";
15
+ import { bundleVerified, PresentationAmbiguityError, PresentationRegistry, presentationExtensionRows, presentationRefusalNotices, } from "./presentation-registry.js";
16
+ import { aacInterpreters, aliasExtensionRows, } from "./alias-interpreters.js";
14
17
  import { buildReportRows, } from "@action-state-group/agent-action-capsule";
15
- import { buildResultRoot, isResultRoot, UNVERIFIED_KEY_LABEL, } from "@action-state-group/agent-action-capsule";
16
- import { buildVerificationPageModel, CHECKED_ON_THIS_PAGE, CHECKS_SCOPE_LINE, FAILED_ON_THIS_PAGE, FULL_VERIFIER_LINE, NOT_CHECKED_ON_THIS_PAGE, RECEIPT_GRADE_DISPLAY, verificationCheckWords, unboundRecordIds, } from "@action-state-group/agent-action-capsule";
18
+ import { buildResultRoot, isResultRoot, UNVERIFIED_KEY_LABEL, utcDateOf, } from "@action-state-group/agent-action-capsule";
19
+ import { buildVerificationPageModel, CHECKED_ON_THIS_PAGE, CHECKS_SCOPE_LINE, FAILED_ON_THIS_PAGE, FULL_VERIFIER_LINE, NOT_CHECKED_ON_THIS_PAGE, RECEIPT_GRADE_DISPLAY, VERIFICATION_BANNER_LINES, verificationBanner, verificationCheckWords, } from "@action-state-group/agent-action-capsule";
17
20
  function element(tag, text) {
18
21
  const value = document.createElement(tag);
19
22
  if (text !== undefined)
@@ -59,30 +62,91 @@ function appendTime(parent, label, value, absent) {
59
62
  parent.append(cell);
60
63
  }
61
64
  const recordsWord = (count) => `${count} ${count === 1 ? "record" : "records"}`;
62
- // The banner is drawn from the verification result alone and precedes every
63
- // row in the DOM; an unverified bundle gets the refusal line here and no
64
- // rows at all, so a reader never meets a payload before the verdict on the
65
- // bundle that carries it. It says what IS proven: a verified bundle with
66
- // records outside the checkpoint names their count up front.
67
- function renderVerificationBanner(root, verified, coverage) {
68
- const banner = element("p", verified
69
- ? coverage.uncheckpointed === 0
70
- ? "Bundle verification passed"
71
- : `Bundle verification passed; ${coverage.uncheckpointed} of ${recordsWord(coverage.total)} uncheckpointed`
72
- : "Bundle verification failed");
73
- banner.dataset.verify = verified ? "verified" : "failed";
74
- banner.dataset.uncheckpointed = String(coverage.uncheckpointed);
75
- root.append(banner);
76
- if (verified)
77
- return banner;
78
- const refusal = element("p", "This bundle did not verify. Its records, rows and payloads are not shown; the verification page below lists which checks failed.");
65
+ const evaluationsWord = (count) => `${count} ${count === 1 ? "evaluation" : "evaluations"}`;
66
+ const requirementsWord = (count) => `${count} ${count === 1 ? "requirement" : "requirements"}`;
67
+ // The banner is drawn from AAC's banner model alone (presentation contract
68
+ // section 6.2) and precedes every row in the DOM; a bundle that fails the
69
+ // page's own checks gets the refusal line here and no rows at all, so a
70
+ // reader never meets a payload before the verdict on the bundle that carries
71
+ // it. It is a pill in the page's top bar: `data-verify` is the state the
72
+ // reader is told (`verified` only for a `valid` verdict), `data-verdict` the
73
+ // strict verdict and `data-checkpoint` what became of the checkpoint
74
+ // signature. Its line is the core's fixed text for the state; the details
75
+ // line under the bar names the findings. The bar also says, from the
76
+ // verification section, how many checks passed, and links down to it.
77
+ function renderVerificationBanner(root, model, coverage) {
78
+ const bar = element("div");
79
+ // A failed bundle's bar is a callout on every page, with or without a
80
+ // report's frame (the shell's .cv-failed); in a report's frame an
81
+ // incomplete one takes its own colours (.cv-incomplete). data-verify
82
+ // stays the banner's.
83
+ bar.className =
84
+ model.state === "failed"
85
+ ? "cv-shell-bar cv-failed"
86
+ : model.state === "incomplete"
87
+ ? "cv-shell-bar cv-incomplete"
88
+ : "cv-shell-bar";
89
+ const banner = element("span", model.line);
90
+ banner.className = "cv-pill";
91
+ banner.dataset.verify = model.state;
92
+ banner.dataset.verdict = model.verdict;
93
+ banner.dataset.checkpoint = model.checkpoint;
94
+ banner.dataset.uncheckpointed = String(model.uncheckpointed);
95
+ bar.append(banner);
96
+ // The verification section's own summary line, filled in once that
97
+ // section is drawn (at the end of renderEvidenceGraph), and a link down
98
+ // to the section.
99
+ const summary = element("span");
100
+ summary.className = "cv-shell-detail";
101
+ summary.dataset.verifySummary = "";
102
+ bar.append(summary);
103
+ if (model.refusal === undefined && coverage.uncheckpointed > 0) {
104
+ const note = element("span", `${coverage.uncheckpointed} of ${recordsWord(coverage.total)} not in the checkpoint`);
105
+ note.className = "cv-shell-note";
106
+ note.dataset.uncheckpointedNote = "";
107
+ bar.append(note);
108
+ }
109
+ const link = element("a", CHECKED_SECTION_TITLE);
110
+ link.className = "cv-shell-link";
111
+ link.setAttribute("href", `#${CHECKED_SECTION_ID}`);
112
+ link.addEventListener("click", () => {
113
+ const section = root.ownerDocument.getElementById(CHECKED_SECTION_ID);
114
+ if (section instanceof root.ownerDocument.defaultView.HTMLDetailsElement)
115
+ section.open = true;
116
+ });
117
+ bar.append(link);
118
+ root.append(bar);
119
+ if (model.detail !== "") {
120
+ const detail = element("p", model.detail);
121
+ detail.className = "cv-banner-detail";
122
+ detail.dataset.bannerDetail = "";
123
+ root.append(detail);
124
+ }
125
+ if (model.refusal === undefined)
126
+ return bar;
127
+ const refusal = element("p", model.refusal);
79
128
  refusal.dataset.refusal = "unverified-bundle";
80
129
  root.append(refusal);
81
- return banner;
130
+ return bar;
131
+ }
132
+ /**
133
+ * Draw the `checking` state into `root`, replacing what it held: the
134
+ * banner alone, with no verdict and no row, until the checks finish
135
+ * (presentation contract section 6.2). Returns that banner's bar.
136
+ */
137
+ export function renderChecking(root) {
138
+ const bar = element("div");
139
+ bar.className = "cv-shell-bar";
140
+ const banner = element("span", VERIFICATION_BANNER_LINES.checking);
141
+ banner.className = "cv-pill";
142
+ banner.dataset.verify = "checking";
143
+ bar.append(banner);
144
+ root.replaceChildren(bar);
145
+ return bar;
82
146
  }
83
147
  /** The words a page says when this viewer cannot verify the bundle at all. */
84
148
  export const UNABLE_TO_VERIFY_LINES = {
85
- banner: "Unable to verify in this viewer",
149
+ banner: VERIFICATION_BANNER_LINES.unable,
86
150
  reason: "This viewer cannot compute the SHA-256 digests the checks need, so nothing was checked and no records are shown. This is not a failed check: the file may well be valid.",
87
151
  command: "To check this file, run:",
88
152
  noCommand: "To check this file, open it from a secure (https) page, or check it with a verifier outside this viewer.",
@@ -112,12 +176,74 @@ export function renderUnableToVerify(root, options = {}) {
112
176
  block.append(command);
113
177
  root.append(element("p", UNABLE_TO_VERIFY_LINES.command), block);
114
178
  }
115
- // Drawn in the outcome-report card's own look when that card renders
116
- // (OUTCOME_REPORT_CSS's .oi-banner rules); the words and data attributes are
117
- // identical either way -- the class is presentation only.
118
- function styleBanner(banner, verified) {
119
- banner.className = `oi oi-banner ${verified ? "oi-banner-ok" : "oi-banner-failed"}`;
179
+ /**
180
+ * The one line a closed "How this page was checked" section shows, so what
181
+ * this page did not check stays in view with it folded: how many of the
182
+ * checks passed (or failed), how many records the file carries, and the
183
+ * signatures or other checks this page did not run.
184
+ */
185
+ export function checkedSummaryLine(verified, model) {
186
+ const total = model.checks.length;
187
+ const failed = model.checks.filter((c) => c.status === "fail").length;
188
+ const passed = model.checks.filter((c) => c.status === "pass").length;
189
+ const notRun = total - failed - passed;
190
+ // A failure can sit outside the numbered checks (a disclosure that does not
191
+ // match its digest, say, or a provenance error outside both counts): a
192
+ // bundle that did not verify never reads as passed.
193
+ // The page's own lists repeat the numbered checks' ground (digests,
194
+ // record rules, closure, range, membership); a failure there is counted
195
+ // only once, as the numbered check it shows up in.
196
+ const pageFailed = model.checkLists.failed.filter((id) => !NUMBERED_CHECK_GROUND.has(id)).length;
197
+ // Numbered checks that did not run are always said, so none reads as
198
+ // passed or failed.
199
+ const notRunNote = notRun > 0 ? `, ${notRun} not run` : "";
200
+ const leads = [];
201
+ if (failed > 0)
202
+ leads.push(`${failed} of ${total} checks failed${notRunNote}`);
203
+ if (pageFailed > 0)
204
+ leads.push(`${pageFailed} ${pageFailed === 1 ? "check" : "checks"} on this page failed`);
205
+ if (failed === 0 && pageFailed === 0)
206
+ leads.push(verified
207
+ ? `${passed} of ${total} checks passed${notRunNote}`
208
+ : SUMMARY_NOT_VERIFIED);
209
+ if (failed === 0 && (pageFailed > 0 || !verified) && notRun > 0)
210
+ leads.push(`${notRun} of ${total} checks not run`);
211
+ const parts = [...leads, recordsWord(model.records.length)];
212
+ // Only the signature checks that are in the not-checked list are named, each
213
+ // by its own words: a signature check that ran (or failed) is never said to
214
+ // be unchecked, so the summary cannot contradict the lists under it.
215
+ const signatures = model.checkLists.notChecked.flatMap((id) => {
216
+ const words = SIGNATURE_CHECKS.get(id);
217
+ return words === undefined ? [] : [words];
218
+ });
219
+ const others = model.checkLists.notChecked.length - signatures.length;
220
+ if (signatures.length > 0)
221
+ parts.push(`${signatures.length === 1
222
+ ? signatures[0]
223
+ : `${signatures.slice(0, -1).join(", ")} and ${signatures.at(-1)}`} not checked here`);
224
+ if (others > 0)
225
+ parts.push(`${others} other ${others === 1 ? "check" : "checks"} not run here`);
226
+ return parts.join(" · ");
120
227
  }
228
+ /** The summary's lead for a bundle that failed outside every counted check. */
229
+ export const SUMMARY_NOT_VERIFIED = "the bundle did not verify";
230
+ const NUMBERED_CHECK_GROUND = new Set([
231
+ "record-digests",
232
+ "record-rules",
233
+ "closure",
234
+ "range",
235
+ "membership",
236
+ ]);
237
+ const SIGNATURE_CHECKS = new Map([
238
+ ["checkpoint-signature", "checkpoint signature"],
239
+ ["producer-signatures", "producer signatures"],
240
+ ["cited-signers", "cited signers' signatures"],
241
+ ["countersignatures", "countersignatures"],
242
+ ]);
243
+ /** The folded verification section's heading. */
244
+ export const CHECKED_SECTION_TITLE = "How this page was checked";
245
+ /** The folded verification section's id, the banner link's target. */
246
+ const CHECKED_SECTION_ID = "cv-checked";
121
247
  // presentation/v1 is rendered here, in the header only, and nowhere else in
122
248
  // this module. Only readPresentationBlock's three known fields ever reach
123
249
  // the DOM -- the chrome rule holds structurally, not by a rendering-site
@@ -228,8 +354,10 @@ const COVERAGE_LABEL = Object.freeze({
228
354
  // stated in words above the list. When it did not, the line says so and
229
355
  // names the verifier's reason -- never "0 records uncheckpointed" on a
230
356
  // bundle whose memberships were never verified -- and when the claim was
231
- // withheld (no checkpoint to stand under) there is no list at all.
232
- function renderCheckpointCoverage(host, records, uncheckpointed, coverage) {
357
+ // withheld (no checkpoint to stand under) there are no counts by status.
358
+ // The records list follows either way: it is where every link to a record
359
+ // lands.
360
+ function renderCheckpointCoverage(host, records, uncheckpointed, coverage, entries, depth) {
233
361
  host.append(element("h4", "Checkpoint coverage"));
234
362
  if (coverage.status === "established") {
235
363
  const count = element("p", `${recordsWord(uncheckpointed)} uncheckpointed of ${recordsWord(records.length)} supplied`);
@@ -242,27 +370,204 @@ function renderCheckpointCoverage(host, records, uncheckpointed, coverage) {
242
370
  line.dataset.coverage = "not-established";
243
371
  line.dataset.claim = coverage.status;
244
372
  host.append(line);
245
- if (coverage.status === "withheld")
246
- return;
247
373
  }
248
- host.append(renderCoverageStatusCounts(records));
249
- const details = element("details");
374
+ if (coverage.status !== "withheld")
375
+ host.append(renderCoverageStatusCounts(records));
376
+ host.append(renderRecordsList(records, entries, depth));
377
+ }
378
+ // Records in this bundle: one entry per capsule id, each with its own address
379
+ // (`record-<capsule id>`, from the id alone, so every packaging of the page
380
+ // gives the same one), and, for an evidence-book record, a second address
381
+ // under the id of the capsule it carries, so a link by either id lands
382
+ // here. An id the bundle repeats is one entry with one address. The address sits
383
+ // inside the entry, not on it: a browser following a link opens every
384
+ // closed <details> around its target, so the entry itself opens too, with
385
+ // no script (and, where script runs, its body is built on that toggle).
386
+ // Closed until a link lands on it or the reader opens it; its body is built
387
+ // when it opens, or before a static page is written. At depth L2 the list
388
+ // is open, but not its entries: there are hundreds, and each opens when a
389
+ // link lands on it or the reader opens it. Other parts of the page link
390
+ // here and never draw a record themselves. For a bundle that did not
391
+ // verify, the list names each record, its kind and its standing, and draws
392
+ // no content.
393
+ function renderRecordsList(records, entries, depth) {
394
+ const details = document.createElement("details");
250
395
  details.dataset.records = "coverage-detail";
251
- const summary = element("summary", `${recordsWord(records.length)}, by capsule id`);
396
+ details.open = depth === "L2";
397
+ // One entry per capsule id, in first-listed order: a repeated id is one
398
+ // record listed more than once, so it gets one entry, one address and a
399
+ // note of how many times the bundle lists it, with each listing's status.
400
+ const listings = new Map();
401
+ for (const record of records)
402
+ listings.set(record.capsuleId, [
403
+ ...(listings.get(record.capsuleId) ?? []),
404
+ record,
405
+ ]);
406
+ const count = listings.size === records.length
407
+ ? recordsWord(listings.size)
408
+ : `${recordsWord(listings.size)} (${records.length} listings)`;
409
+ const summary = element("summary", `Records in this bundle: ${count}, by capsule id`);
252
410
  details.append(summary);
411
+ if (!entries.verified) {
412
+ const note = element("p", "Record content is not shown: this bundle did not verify.");
413
+ note.dataset.records = "not-shown";
414
+ details.append(note);
415
+ }
253
416
  const list = element("ul");
254
417
  list.dataset.records = "coverage";
418
+ // Addresses in two passes, as AAC's Result reader resolves ids: every
419
+ // record's own id first, then a carried capsule's id only where no record
420
+ // has that id (and only once), so a book record listed before the capsule
421
+ // it carries never takes that capsule's address.
422
+ const owners = new Map();
423
+ for (const record of records)
424
+ if (entries.verified && entries.read.has(record.capsuleId))
425
+ if (!owners.has(record.capsuleId))
426
+ owners.set(record.capsuleId, record.capsuleId);
427
+ const own = new Set(records.map((record) => record.capsuleId));
255
428
  for (const record of records) {
256
- const item = element("li", `${record.capsuleId} · `);
257
- const status = element("span", COVERAGE_LABEL[record.status]);
258
- status.dataset.recordStatus = record.status;
259
- status.className = `seal-${record.status}`;
260
- item.dataset.capsuleId = record.capsuleId;
261
- item.append(status);
429
+ const carried = entries.read.get(record.capsuleId)?.carriedCapsuleId;
430
+ if (entries.verified &&
431
+ carried !== undefined &&
432
+ !own.has(carried) &&
433
+ !owners.has(carried))
434
+ owners.set(carried, record.capsuleId);
435
+ }
436
+ const used = new Set();
437
+ const address = (id, holder) => {
438
+ const name = recordAddress(id);
439
+ if (owners.get(id) !== holder || used.has(name))
440
+ return undefined;
441
+ used.add(name);
442
+ const anchor = element("span");
443
+ anchor.className = "cv-record-anchor";
444
+ anchor.id = name;
445
+ return anchor;
446
+ };
447
+ for (const [capsuleId, listed] of listings) {
448
+ const record = listed[0];
449
+ const item = element("li");
450
+ item.dataset.capsuleId = capsuleId;
451
+ const kind = entries.kind(capsuleId);
452
+ const status = element("span");
453
+ listed.forEach((one, i) => {
454
+ if (i > 0)
455
+ status.append(" / ");
456
+ const word = element("span", COVERAGE_LABEL[one.status]);
457
+ word.dataset.recordStatus = one.status;
458
+ word.className = `seal-${one.status}`;
459
+ status.append(word);
460
+ });
461
+ if (listed.length > 1) {
462
+ item.dataset.listed = String(listed.length);
463
+ status.append(` · listed ${listed.length} times in this bundle`);
464
+ }
465
+ const label = `${capsuleId} · ${kind ?? "kind not stated"} · `;
466
+ const read = entries.read.get(capsuleId);
467
+ if (!entries.verified || read === undefined) {
468
+ item.append(document.createTextNode(label), status);
469
+ list.append(item);
470
+ continue;
471
+ }
472
+ const fold = document.createElement("details");
473
+ fold.className = "cv-record";
474
+ fold.dataset.record = record.capsuleId;
475
+ const head = element("summary", label);
476
+ head.append(status);
477
+ fold.append(head);
478
+ const anchors = [record.capsuleId, read.carriedCapsuleId]
479
+ .filter((id) => id !== undefined)
480
+ .map((id) => address(id, record.capsuleId))
481
+ .filter((a) => a !== undefined);
482
+ fold.append(...anchors);
483
+ deferBody(fold, () => entries.build(record.capsuleId, read));
484
+ // Where script runs, the body is built after the browser scrolled to
485
+ // the address; bring it back into view once the body is in place.
486
+ fold.addEventListener("toggle", () => {
487
+ const hash = fold.ownerDocument.defaultView?.location?.hash;
488
+ const target = anchors.find((a) => hash === `#${a.id}`);
489
+ if (fold.open && target !== undefined)
490
+ target.scrollIntoView?.();
491
+ });
492
+ item.append(fold);
262
493
  list.append(item);
263
494
  }
264
495
  details.append(list);
265
- host.append(details);
496
+ return details;
497
+ }
498
+ /**
499
+ * Each record's reading for the records list, from the verifier's resolved
500
+ * context: the Result's reading where a claim reaches the record, otherwise
501
+ * the record's own times, log position, committed digests and disclosed
502
+ * members, and, for an evidence-book record, the capsule it carries,
503
+ * checked as the Result reader checks it (`carriedCapsuleCommitment`,
504
+ * `resolveCarriedInput`).
505
+ */
506
+ async function recordEntries(context, result) {
507
+ const read = new Map();
508
+ for (const record of result?.records.values() ?? []) {
509
+ const id = record.bookRecordId ?? record.capsuleId;
510
+ if (!read.has(id))
511
+ read.set(id, record);
512
+ }
513
+ const bundle = object(context.bundle);
514
+ const memberships = context.completeness.memberships;
515
+ const extensions = object(bundle.extensions);
516
+ const payloads = object(extensions[BOOK_PAYLOADS_EXTENSION]);
517
+ const originals = object(extensions[AGENT_INPUT_ORIGINALS_EXTENSION]);
518
+ for (const raw of context.records) {
519
+ const id = raw.capsule_id;
520
+ if (read.has(id))
521
+ continue;
522
+ const agentInput = disclosureOf(context, id, "agent_input");
523
+ const header = agentInput.state === "disclosed" &&
524
+ object(agentInput.payload).record_type === PUBLISHED_CAPSULE_RECORD_TYPE
525
+ ? agentInput.payload
526
+ : undefined;
527
+ const carried = header === undefined
528
+ ? undefined
529
+ : await carriedCapsuleCommitment(header, payloads);
530
+ const carriedInput = header === undefined
531
+ ? undefined
532
+ : await resolveCarriedInput(header, payloads, originals);
533
+ const references = Array.isArray(raw.references) ? raw.references : [];
534
+ const agentInputDigest = committedDigest(raw, "agent_input");
535
+ const agentOutputDigest = committedDigest(raw, "agent_output");
536
+ const coordinates = logCoordinates(memberships, id);
537
+ read.set(id, {
538
+ ...recordTimes(raw),
539
+ capsuleId: id,
540
+ agentInput,
541
+ agentOutput: disclosureOf(context, id, "agent_output"),
542
+ ...(agentInputDigest === undefined ? {} : { agentInputDigest }),
543
+ ...(agentOutputDigest === undefined ? {} : { agentOutputDigest }),
544
+ ...(coordinates === undefined ? {} : { logCoordinates: coordinates }),
545
+ ...(carriedInput === undefined ? {} : { carriedInput }),
546
+ ...(carried === undefined
547
+ ? {}
548
+ : {
549
+ carriedCapsuleId: carried.capsuleId,
550
+ carriedInputDigest: carried.inputDigest,
551
+ }),
552
+ cites: references.flatMap((ref) => {
553
+ const r = object(ref);
554
+ return r.citation_purpose === "acted_on" && typeof r.digest === "string"
555
+ ? [r.digest]
556
+ : [];
557
+ }),
558
+ });
559
+ }
560
+ return read;
561
+ }
562
+ /** A record's kind: its disclosed book header's `record_type`, else its own `action_type`. */
563
+ function recordKind(raw, read) {
564
+ const header = read?.agentInput.state === "disclosed"
565
+ ? object(read.agentInput.payload).record_type
566
+ : undefined;
567
+ if (typeof header === "string")
568
+ return header;
569
+ const own = object(raw).action_type;
570
+ return typeof own === "string" ? own : undefined;
266
571
  }
267
572
  // Counts by seal status -- the line a reader actually needs (how many of
268
573
  // each) without scrolling a list that is one row per record (500+ rows on a
@@ -347,6 +652,9 @@ function renderExtensionTable(host, rows) {
347
652
  : row.interpreter === undefined
348
653
  ? "uninterpreted"
349
654
  : "interpreted";
655
+ // The interpreter that showed the block, as AAC's renderer wrote it.
656
+ if (row.interpreter !== undefined)
657
+ tr.dataset.interpreter = row.interpreter;
350
658
  if (row.refusal !== undefined) {
351
659
  tr.dataset.refusedModule = row.refusal.id;
352
660
  tr.dataset.refusal = row.refusal.reason;
@@ -410,8 +718,8 @@ function renderCheckLists(host, lists, verifierHint) {
410
718
  // `applied` is the set of extension interpreters this rendering ran; an
411
719
  // extension row says "interpreted by" only for one of them. `refused` is
412
720
  // every module this runtime refused that matched (page, then section).
413
- async function renderVerificationPage(root, context, styled, applied, refused, citedSigners, verifierHint) {
414
- const { bundle, verification: verified, countersigners } = context;
721
+ async function renderVerificationPage(root, context, styled, applied, refused, citedSigners, verifierHint, depth, stamps) {
722
+ const { bundle, verification: verified } = context;
415
723
  const section = element("section");
416
724
  section.dataset.page = "verification";
417
725
  let page = section;
@@ -422,11 +730,19 @@ async function renderVerificationPage(root, context, styled, applied, refused, c
422
730
  section.append(page);
423
731
  }
424
732
  page.append(element("h2", "Verification"));
425
- const stamps = await classifyCountersignatures(context.countersignatures.map((entry) => entry.value), verified.bundleDigest, declaredProducerKeys(bundle), countersigners);
426
- const model = buildVerificationPageModel(bundle, verified, applied, refused, {
733
+ // The strict result too, so these lists are the ones the banner's line
734
+ // points at (verificationBanner reads the same lists).
735
+ const model = buildVerificationPageModel(bundle, verified, aacInterpreters(applied), {
427
736
  stamps,
428
737
  citedSigners,
738
+ ...(context.strict === undefined ? {} : { strict: context.strict }),
429
739
  });
740
+ // AAC's page model carries no presentation refusals: this registry lays
741
+ // its refusal rows over AAC's extension rows (the integrity words from
742
+ // each row's own integrity) and adds a notice for each refused module
743
+ // with no row (presentation contract section 3.2). The deprecated cards'
744
+ // interpreters, which AAC 0.8.0 no longer reports, are applied first.
745
+ const extensions = presentationExtensionRows(aliasExtensionRows(bundle, model.extensions, applied), refused);
430
746
  const summary = element("dl");
431
747
  appendValue(summary, "bundle digest", model.bundleDigest ?? "uncomputable");
432
748
  appendValue(summary, "checkpoint root", model.checkpointRoot ?? "absent");
@@ -440,14 +756,54 @@ async function renderVerificationPage(root, context, styled, applied, refused, c
440
756
  witness.dataset.witness = "self";
441
757
  page.append(witness);
442
758
  }
443
- renderCheckpointCoverage(page, model.records, model.uncheckpointedCount, model.coverage);
759
+ // The content block's own styles: the records list is the core's, inside
760
+ // no module's frame (record-content.ts RECORD_CONTENT_CSS).
761
+ const contentStyle = element("style");
762
+ contentStyle.textContent = RECORD_CONTENT_CSS;
763
+ page.append(contentStyle);
764
+ let result;
765
+ try {
766
+ result = bundleVerified(verified) ? await resultRootOf(context) : undefined;
767
+ }
768
+ catch {
769
+ result = undefined;
770
+ }
771
+ const read = bundleVerified(verified)
772
+ ? await recordEntries(context, result)
773
+ : new Map();
774
+ const rawRecords = new Map();
775
+ for (const raw of Array.isArray(object(bundle).records)
776
+ ? object(bundle).records
777
+ : [])
778
+ if (typeof object(raw).capsule_id === "string")
779
+ rawRecords.set(object(raw).capsule_id, raw);
780
+ renderCheckpointCoverage(page, model.records, model.uncheckpointedCount, model.coverage, {
781
+ verified: bundleVerified(verified),
782
+ read,
783
+ kind: (id) => recordKind(rawRecords.get(id), read.get(id)),
784
+ build: (id, record) => renderRecordEntry(id, record),
785
+ }, depth);
444
786
  renderStamps(page, stamps);
445
787
  renderCompletenessStatement(page, model.completeness);
446
788
  renderChecks(page, model.checks);
447
- renderExtensions(page, model.extensions, model.presentationRefusals);
789
+ renderExtensions(page, extensions, presentationRefusalNotices(refused));
448
790
  renderCheckLists(page, model.checkLists, verifierHint);
449
791
  page.append(element("p", model.verifyIndependentlyLine));
450
- root.append(section);
792
+ // Folded into one section, closed for a bundle that verified; its summary
793
+ // line keeps the counts and what was not checked in view.
794
+ const folded = document.createElement("details");
795
+ folded.className = "cv-checked";
796
+ folded.id = CHECKED_SECTION_ID;
797
+ folded.dataset.checked = "";
798
+ // Open when the bundle did not verify, and at depth L2, where everything
799
+ // is open (presentation contract section 9.1).
800
+ folded.open = !bundleVerified(verified) || depth === "L2";
801
+ const line = checkedSummaryLine(bundleVerified(verified), model);
802
+ const heading = element("summary");
803
+ heading.append(element("strong", CHECKED_SECTION_TITLE), document.createTextNode(` · ${line}`));
804
+ folded.append(heading, section);
805
+ root.append(folded);
806
+ return line;
451
807
  }
452
808
  function metRate(report) {
453
809
  const required = report.outcomes.filter((outcome) => outcome.role === "required");
@@ -669,18 +1025,28 @@ function renderReportRowsTable(reportRows, root) {
669
1025
  // each committed member as disclosed or as `withheld · <digest>`, and the
670
1026
  // records it cites in turn -- so aggregate → daily → case → act is a walk
671
1027
  // over citations, never report-specific markup.
672
- function renderCitedMember(host, field, resolution, committed) {
673
- if (resolution.state !== "disclosed" && committed === undefined)
1028
+ function renderCitedMember(host, field, resolution, committed, label = field) {
1029
+ // A value that does not match its commitment is always noted, even where
1030
+ // the caller has no committed digest to name (a record no claim reaches).
1031
+ if (resolution.state !== "disclosed" &&
1032
+ resolution.state !== "disclosure_mismatch" &&
1033
+ committed === undefined)
674
1034
  return;
675
- host.append(element("h5", field));
1035
+ host.append(element("h5", label));
676
1036
  if (resolution.state === "disclosed") {
677
- host.append(element("pre", display(resolution.payload)));
1037
+ // The core states what it established, once, beside the block; the
1038
+ // content module only draws the content (presentation contract 6.1).
1039
+ const checked = element("p", "The content shown matches the digest the record commits to.");
1040
+ checked.dataset.contentCheck = "digest";
1041
+ host.append(checked, renderContent(resolution.payload, DEFAULT_WORDS.lines));
678
1042
  return;
679
1043
  }
680
1044
  // A withheld member shows the digest the record committed to; a supplied
681
1045
  // value that does not hash to it is never shown, only noted.
682
1046
  const note = element("p", resolution.state === "disclosure_mismatch"
683
- ? `withheld · ${committed}: the disclosed value does not match the committed digest`
1047
+ ? committed === undefined
1048
+ ? "withheld: the disclosed value does not match the committed digest"
1049
+ : `withheld · ${committed}: the disclosed value does not match the committed digest`
684
1050
  : `withheld · ${committed}`);
685
1051
  note.dataset.disclosure = resolution.state;
686
1052
  host.append(note);
@@ -691,12 +1057,46 @@ function renderCitedRecord(record, records, host) {
691
1057
  section.append(renderProvenance(record.capsuleId, record.logCoordinates, record));
692
1058
  renderCitedMember(section, "agent_input", record.agentInput, record.agentInputDigest);
693
1059
  renderCitedMember(section, "agent_output", record.agentOutput, record.agentOutputDigest);
1060
+ renderCarriedInput(section, record);
694
1061
  if (record.cites.length > 0) {
695
1062
  section.append(element("h5", "Cites"));
696
1063
  renderCitationList(record.cites, records, section);
697
1064
  }
698
1065
  host.append(section);
699
1066
  }
1067
+ // An evidence-book record's agent_input is the book's header; what the
1068
+ // capsule it carries sealed is the carried input, drawn the same way.
1069
+ function renderCarriedInput(host, record) {
1070
+ if (record.carriedInput === undefined)
1071
+ return;
1072
+ renderCitedMember(host, "agent_input", record.carriedInput, record.carriedInputDigest, "agent_input of the capsule it carries");
1073
+ }
1074
+ // A record's entry in the records section: its provenance (times, seal
1075
+ // status, log position), each committed member as disclosed or withheld,
1076
+ // the capsule it carries, and the records it cites as links to their
1077
+ // entries.
1078
+ function renderRecordEntry(capsuleId, record) {
1079
+ const body = element("div");
1080
+ body.className = "cv-record-body";
1081
+ body.append(renderProvenance(capsuleId, record.logCoordinates, record));
1082
+ renderCitedMember(body, "agent_input", record.agentInput, record.agentInputDigest);
1083
+ renderCitedMember(body, "agent_output", record.agentOutput, record.agentOutputDigest);
1084
+ renderCarriedInput(body, record);
1085
+ if (record.cites.length > 0) {
1086
+ body.append(element("h5", "Cites"));
1087
+ const list = element("ul");
1088
+ for (const id of record.cites) {
1089
+ const item = element("li");
1090
+ const link = element("a", id);
1091
+ link.setAttribute("href", `#${recordAddress(id)}`);
1092
+ link.addEventListener("click", () => revealRecord(link, id));
1093
+ item.append(link);
1094
+ list.append(item);
1095
+ }
1096
+ body.append(list);
1097
+ }
1098
+ return body;
1099
+ }
700
1100
  // One row per cited id, in citation order: a record supplied in this bundle
701
1101
  // opens under the list on click; one that is not says so and stays.
702
1102
  function renderCitationList(ids, records, host) {
@@ -838,15 +1238,24 @@ function renderClose(close, result, host) {
838
1238
  // `failed` -- never `met`, never its stated verdict, which is kept on
839
1239
  // `data-stated-verdict` only. Otherwise an unresolved citation reads
840
1240
  // `unsupported`. The row stays in every case.
841
- function appendVerdict(parent, claim) {
842
- const shown = claim.failed
1241
+ // The verdict a reader may see: never the producer's word for a claim that
1242
+ // failed verification or whose evidence is not in the bundle.
1243
+ function shownVerdict(claim) {
1244
+ return claim.failed
843
1245
  ? "failed"
844
1246
  : claim.support === "supported"
845
1247
  ? claim.verdict
846
1248
  : "unsupported";
847
- const cell = element(parent.tagName === "TR" ? "td" : "dd", shown);
1249
+ }
1250
+ function appendVerdict(parent, claim) {
1251
+ const shown = shownVerdict(claim);
1252
+ // A later claim's verdict is readiness only (ER section 4.3): never read
1253
+ // as a result that counts.
1254
+ const cell = element(parent.tagName === "TR" ? "td" : "dd", claim.later ? `${shown} (readiness)` : shown);
848
1255
  cell.dataset.verdict = shown;
849
1256
  cell.dataset.support = claim.support;
1257
+ if (claim.later)
1258
+ cell.dataset.later = "true";
850
1259
  if (claim.failed) {
851
1260
  cell.dataset.statedVerdict = claim.verdict;
852
1261
  cell.className = "claim-failed";
@@ -943,12 +1352,14 @@ function renderClaim(claim, result, host) {
943
1352
  }
944
1353
  }
945
1354
  const BUCKETS = [
946
- ["met", "met"],
947
- ["notMet", "not met"],
948
- ["notEvaluable", "not evaluable"],
1355
+ ["met", "met", "buckets.met"],
1356
+ ["notMet", "not met", "buckets.not_met"],
1357
+ ["notEvaluable", "not evaluable", "buckets.not_evaluable"],
1358
+ // ER section 4.2: drawn only when the Result carries the fourth bucket.
1359
+ ["outOfScope", "out of scope", "buckets.out_of_scope"],
949
1360
  ];
950
1361
  // Coverage is the first thing in the Result section after its heading, and
951
- // no number precedes it within the section; then the three buckets, never a
1362
+ // no number precedes it within the section; then the buckets, never a
952
1363
  // single figure; then one row per claim with its own tier and grade. The
953
1364
  // bundle-level verification banner, drawn before every section, is the one
954
1365
  // thing above coverage that can carry digits ("N of M records
@@ -956,40 +1367,82 @@ const BUCKETS = [
956
1367
  // (`result.coverage`, `result.bucketCounts`); a producer figure the claims
957
1368
  // do not bear out shows as a `count mismatch` marker beside the recomputed
958
1369
  // value. `excluded as not applicable` is the one figure carried as stated:
959
- // no claim backs it, by construction.
1370
+ // no claim backs it, by construction. Coverage counts evaluations (one per
1371
+ // claim, ER §3), so the line also names how many distinct requirements the
1372
+ // claims cite, and an UNKNOWN count is never called unresolved requirements.
1373
+ /** Said above the generic Result page when a Result opted into a card whose layout cannot hold its claims (`claimsFitCard`). */
1374
+ export const CARD_UNFIT_NOTE = "This Result's claims don't fit the report layout, so every claim is listed below instead.";
960
1375
  function renderResultPage(result, root) {
961
1376
  const section = element("section");
962
1377
  section.dataset.page = "result";
963
1378
  section.append(element("h1", "Evidence result"));
1379
+ // The requirements the in-force evaluations cover: every claim of one
1380
+ // requirement carries the same applies_from, so a requirement is in force
1381
+ // or later as a whole (ER section 4.3).
1382
+ const requirements = new Set(result.claims
1383
+ .filter((claim) => !claim.later)
1384
+ .map((claim) => JSON.stringify([claim.contractRef, claim.requirementRef]))).size;
964
1385
  const coverage = element("p");
965
- coverage.append(`coverage: ${result.coverage.evaluatedPopulation} requirements evaluated`);
1386
+ coverage.append(`coverage: ${evaluationsWord(result.coverage.evaluatedPopulation)} of ${requirementsWord(requirements)}`);
966
1387
  const evaluatedMarker = countMismatchMarker(result, "evaluated_population");
967
1388
  if (evaluatedMarker !== undefined)
968
1389
  coverage.append(" ", evaluatedMarker);
969
- coverage.append(` · ${result.coverage.excludedNotApplicable} excluded as not applicable · ${result.coverage.unknownCount} unresolved`);
1390
+ coverage.append(` · ${result.coverage.excludedNotApplicable} excluded as not applicable · ${result.coverage.unknownCount} with an unknown result`);
970
1391
  const unknownMarker = countMismatchMarker(result, "unknown_count");
971
1392
  if (unknownMarker !== undefined)
972
1393
  coverage.append(" ", unknownMarker);
1394
+ const later = result.claims.filter((claim) => claim.later);
1395
+ const laterMarker = countMismatchMarker(result, "not_yet_in_force");
1396
+ if (later.length > 0 || laterMarker !== undefined) {
1397
+ coverage.append(` · ${evaluationsWord(later.length)} not yet in force`);
1398
+ if (laterMarker !== undefined)
1399
+ coverage.append(" ", laterMarker);
1400
+ coverage.dataset.notYetInForce = String(later.length);
1401
+ }
973
1402
  coverage.dataset.coverage = "result";
974
1403
  coverage.dataset.evaluated = String(result.coverage.evaluatedPopulation);
1404
+ coverage.dataset.requirements = String(requirements);
975
1405
  coverage.dataset.excluded = String(result.coverage.excludedNotApplicable);
976
1406
  coverage.dataset.excludedBasis = "stated";
977
1407
  coverage.dataset.unknown = String(result.coverage.unknownCount);
978
1408
  section.append(coverage);
1409
+ // ER sections 4.2 and 4.3: whenever a claim is dated, the date "in force"
1410
+ // is relative to; and whenever a claim is dated or the out-of-scope switch
1411
+ // is on, that these are the producer's copy of the contract, never checked
1412
+ // here.
1413
+ const dated = result.claims.some((claim) => claim.appliesFrom !== undefined);
1414
+ if (dated || result.buckets.outOfScope !== undefined) {
1415
+ const copied = element("p");
1416
+ if (dated) {
1417
+ // A dated Result passed validation, so generated_at parses.
1418
+ const date = utcDateOf(result.generatedAt) ?? result.generatedAt;
1419
+ copied.append(`In force as of ${date}. `);
1420
+ copied.dataset.asOf = date;
1421
+ }
1422
+ copied.append(dated && result.buckets.outOfScope !== undefined
1423
+ ? "The dates and the out-of-scope switch are copied from the contract, not re-checked here."
1424
+ : dated
1425
+ ? "The dates are copied from the contract, not re-checked here."
1426
+ : "The out-of-scope switch is copied from the contract, not re-checked here.");
1427
+ copied.dataset.copiedFacts = "contract";
1428
+ section.append(copied);
1429
+ }
979
1430
  const byId = new Map(result.claims.map((claim) => [claim.id, claim]));
980
1431
  const buckets = element("section");
981
1432
  buckets.dataset.buckets = "verdict";
982
1433
  buckets.append(element("h2", "Claims by verdict"));
983
- for (const [key, label] of BUCKETS) {
984
- const count = result.bucketCounts[key];
1434
+ for (const [key, label, field] of BUCKETS) {
1435
+ const ids = result.buckets[key];
1436
+ if (ids === undefined)
1437
+ continue;
1438
+ const count = result.bucketCounts[key] ?? 0;
985
1439
  const heading = element("h3", `${label}: ${count === 0 ? "none" : count}`);
986
1440
  heading.dataset.bucketCount = String(count);
987
1441
  heading.dataset.bucketOf = key;
988
- const marker = countMismatchMarker(result, `buckets.${key === "notMet" ? "not_met" : key === "notEvaluable" ? "not_evaluable" : "met"}`);
1442
+ const marker = countMismatchMarker(result, field);
989
1443
  if (marker !== undefined)
990
1444
  heading.append(" ", marker);
991
1445
  buckets.append(heading);
992
- const ids = result.buckets[key];
993
1446
  if (ids.length === 0) {
994
1447
  buckets.append(element("p", "none"));
995
1448
  continue;
@@ -1012,7 +1465,7 @@ function renderResultPage(result, root) {
1012
1465
  }
1013
1466
  buckets.append(list);
1014
1467
  }
1015
- // The verifier's own state, after the producer's three buckets: claims
1468
+ // The verifier's own state, after the producer's buckets: claims
1016
1469
  // that failed verification (a close state the links contradict). Drawn
1017
1470
  // always, `none` when empty, so a reader never has to infer from an
1018
1471
  // absent heading that nothing failed. Not a verdict bucket: a failed
@@ -1038,6 +1491,26 @@ function renderResultPage(result, root) {
1038
1491
  }
1039
1492
  buckets.append(list);
1040
1493
  }
1494
+ // ER section 4.3: claims not yet in force, their verdicts readiness only,
1495
+ // in no bucket above.
1496
+ if (later.length > 0) {
1497
+ const heading = element("h3", `not yet in force: ${later.length}`);
1498
+ heading.dataset.bucketOf = "notYetInForce";
1499
+ heading.dataset.bucketCount = String(later.length);
1500
+ buckets.append(heading);
1501
+ const list = element("ul");
1502
+ list.dataset.bucket = "notYetInForce";
1503
+ for (const claim of later) {
1504
+ const item = element("li", `${claim.id} · applies from ${claim.appliesFrom ?? ""} · readiness: ${shownVerdict(claim)}`);
1505
+ item.dataset.claimRef = claim.id;
1506
+ if (claim.failed)
1507
+ item.className = "claim-failed";
1508
+ else if (claim.support === "unsupported")
1509
+ item.className = "claim-unsupported";
1510
+ list.append(item);
1511
+ }
1512
+ buckets.append(list);
1513
+ }
1041
1514
  section.append(buckets);
1042
1515
  const table = document.createElement("table");
1043
1516
  table.dataset.claims = "rows";
@@ -1151,6 +1624,17 @@ const reportRowsModule = {
1151
1624
  buildModel: async (context) => defined(await reportRowsOf(context), BUILTIN_MANIFEST_REPORT_ROWS.id),
1152
1625
  render: (model, host) => renderReportRowsTable(model, host.L1),
1153
1626
  };
1627
+ /**
1628
+ * The context's verification with AAC's strict result in its `strict`
1629
+ * member, where this runtime reached one: the contract report's "Witnessed
1630
+ * by" line reads AAC's witness status from it (report-provenance.ts), the
1631
+ * same result the banner reads.
1632
+ */
1633
+ function withStrict(context) {
1634
+ return context.strict === undefined
1635
+ ? context.verification
1636
+ : { ...context.verification, strict: context.strict };
1637
+ }
1154
1638
  const resultOutcomeReportModule = {
1155
1639
  manifest: BUILTIN_MANIFEST_RESULT_OUTCOME_REPORT,
1156
1640
  canRender: async (context) => readOutcomeReportPresentation(context.bundle) !== undefined &&
@@ -1159,12 +1643,12 @@ const resultOutcomeReportModule = {
1159
1643
  result: defined(await resultRootOf(context), BUILTIN_MANIFEST_RESULT_OUTCOME_REPORT.id),
1160
1644
  card: defined(readOutcomeReportPresentation(context.bundle), BUILTIN_MANIFEST_RESULT_OUTCOME_REPORT.id),
1161
1645
  bundle: context.bundle,
1162
- verification: context.verification,
1646
+ verification: withStrict(context),
1163
1647
  }),
1164
1648
  render: async (model, host) => {
1165
1649
  // The banner and the verification page take the card's look.
1166
1650
  host.setChromeClass("oi");
1167
- await renderOutcomeReportPage(model.result, model.card, model.bundle, model.verification, host.L1);
1651
+ await renderContractReport(model.result, { grouping: "lines", options: model.card }, model.bundle, model.verification, { L0: host.L0, L1: host.L1, L2: host.L2, depth: host.depth }, host.wording);
1168
1652
  },
1169
1653
  };
1170
1654
  const resultComplianceModule = {
@@ -1175,9 +1659,130 @@ const resultComplianceModule = {
1175
1659
  result: defined(await resultRootOf(context), BUILTIN_MANIFEST_RESULT_COMPLIANCE.id),
1176
1660
  card: defined(readCompliancePresentation(context.bundle), BUILTIN_MANIFEST_RESULT_COMPLIANCE.id),
1177
1661
  bundle: context.bundle,
1178
- verification: context.verification,
1662
+ verification: withStrict(context),
1179
1663
  }),
1180
- render: (model, host) => renderCompliancePage(model.result, model.card, model.bundle, model.verification, host.L1),
1664
+ render: async (model, host) => {
1665
+ // The card draws its own frame inside the page.
1666
+ host.setChromeClass(COMPLIANCE_CHROME);
1667
+ await renderContractReport(model.result, { grouping: "groups", presentation: model.card }, model.bundle, model.verification, { L0: host.L0, L1: host.L1, L2: host.L2, depth: host.depth }, host.wording);
1668
+ },
1669
+ };
1670
+ /**
1671
+ * The contract-report module's manifest (agent-action-capsule
1672
+ * spec/contract-report-v1.md section 4): the same match as
1673
+ * `aac.builtin.result-contract-report/v0`, which it replaces in this
1674
+ * registry. Registering both would be an ambiguity error (presentation
1675
+ * contract section 4.5). It carries no `executable.wording_sha256`: the pack
1676
+ * is a builder input, recorded as provenance.
1677
+ */
1678
+ export const CONTRACT_REPORT_MANIFEST = Object.freeze({
1679
+ ...BUILTIN_MANIFEST_RESULT_CONTRACT_REPORT,
1680
+ id: "capsuleviewer.contract-report/v0",
1681
+ });
1682
+ /**
1683
+ * The data a contract report draws from, beside the empty
1684
+ * `contract-report/v1` block: an earlier kind's block, read by its own
1685
+ * reader (section 5), the outcome block first, as the built-in manifests'
1686
+ * precedence has it (the compliance card forbids `outcome-report/v1`).
1687
+ */
1688
+ /** The grouping the contract-report module draws for `bundle`, or undefined when it draws the generic Result page. */
1689
+ export function contractReportGroupingOf(bundle) {
1690
+ return contractReportInput(bundle)?.grouping;
1691
+ }
1692
+ function contractReportInput(bundle) {
1693
+ const options = readOutcomeReportPresentation(bundle);
1694
+ if (options !== undefined)
1695
+ return { grouping: "lines", options };
1696
+ const presentation = readCompliancePresentation(bundle);
1697
+ if (presentation !== undefined)
1698
+ return { grouping: "groups", presentation };
1699
+ return undefined;
1700
+ }
1701
+ /**
1702
+ * The contract-report module (contract-report.ts), resolved on
1703
+ * `contract-report/v1`. `canRender` is the generic Result page's, whatever
1704
+ * the pack or the number of contracts (section 4), so every Result root that
1705
+ * opts in reaches it. A Result that carries neither grouping's data draws
1706
+ * the generic Result page, exactly as the built-in it replaces.
1707
+ */
1708
+ /**
1709
+ * Whether every claim has a place of its own on the outcome or EU card. The
1710
+ * cards lay a Result out one conversation by one requirement, so they can
1711
+ * show a claim only when it is a requirement claim whose id names its
1712
+ * conversation (`<conversation>::…`), no two claims share a conversation
1713
+ * and a requirement (a re-judged requirement), and all cite one contract.
1714
+ * The EU card also needs a grouped requirement (`<group>.<test>`); the
1715
+ * Outcomes card needs one of the terms' check and criterion pairs
1716
+ * (`readOutcomeReportTerms`), since agent-action-capsule's outcome model
1717
+ * leaves out any other. Any other Result is drawn as the generic Result
1718
+ * page, which lists every claim: a card never merges a claim into another
1719
+ * or leaves one out (contract-report/v1 section 2).
1720
+ */
1721
+ function claimsFitCard(result, grouping) {
1722
+ if (new Set(result.claims.map((c) => c.contractRef)).size > 1)
1723
+ return false;
1724
+ const placed = grouping === "lines"
1725
+ ? new Set(readOutcomeReportTerms(result).checks.flatMap((check) => check.criteria.map((criterion) => `${check.id}.${criterion.id}`)))
1726
+ : undefined;
1727
+ const seen = new Set();
1728
+ for (const claim of result.claims) {
1729
+ if (claim.type !== REQUIREMENT_CLAIM)
1730
+ return false;
1731
+ const sep = claim.id.indexOf("::");
1732
+ if (sep <= 0)
1733
+ return false;
1734
+ if (placed !== undefined && !placed.has(claim.requirementRef))
1735
+ return false;
1736
+ if (grouping === "groups") {
1737
+ const dot = claim.requirementRef.indexOf(".");
1738
+ if (dot <= 0 || dot === claim.requirementRef.length - 1)
1739
+ return false;
1740
+ }
1741
+ const key = JSON.stringify([claim.id.slice(0, sep), claim.requirementRef]);
1742
+ if (seen.has(key))
1743
+ return false;
1744
+ seen.add(key);
1745
+ }
1746
+ return true;
1747
+ }
1748
+ /** Which interpreters a contract-report render ran, by the bundle it drew: set when its model is built. */
1749
+ const contractReportDrawn = new WeakMap();
1750
+ const contractReportModule = {
1751
+ manifest: CONTRACT_REPORT_MANIFEST,
1752
+ canRender: (context) => isResultRoot(context),
1753
+ buildModel: async (context) => {
1754
+ const result = defined(await resultRootOf(context), CONTRACT_REPORT_MANIFEST.id);
1755
+ const supported = contractReportInput(context.bundle);
1756
+ const input = supported !== undefined && claimsFitCard(result, supported.grouping)
1757
+ ? supported
1758
+ : undefined;
1759
+ if (typeof context.bundle === "object" && context.bundle !== null)
1760
+ contractReportDrawn.set(context.bundle, input ?? null);
1761
+ return {
1762
+ result,
1763
+ ...(input === undefined ? {} : { input }),
1764
+ ...(supported !== undefined && input === undefined
1765
+ ? { unfit: true }
1766
+ : {}),
1767
+ bundle: context.bundle,
1768
+ verification: withStrict(context),
1769
+ };
1770
+ },
1771
+ render: async (model, host) => {
1772
+ if (model.input === undefined) {
1773
+ if (model.unfit === true) {
1774
+ const note = element("p", CARD_UNFIT_NOTE);
1775
+ note.dataset.notice = "card-unfit";
1776
+ host.L1.append(note);
1777
+ }
1778
+ renderResultPage(model.result, host.L1);
1779
+ return;
1780
+ }
1781
+ // The report's banner takes its frame's look (a callout at the top);
1782
+ // the outcome report's verification page takes its look too.
1783
+ host.setChromeClass(model.input.grouping === "lines" ? OUTCOME_CHROME : COMPLIANCE_CHROME);
1784
+ await renderContractReport(model.result, model.input, model.bundle, model.verification, { L0: host.L0, L1: host.L1, L2: host.L2, depth: host.depth }, host.wording);
1785
+ },
1181
1786
  };
1182
1787
  const resultModule = {
1183
1788
  manifest: BUILTIN_MANIFEST_RESULT,
@@ -1224,16 +1829,46 @@ const BUILTIN_MODULE_INTERPRETERS = Object.freeze({
1224
1829
  [BUILTIN_MANIFEST_RESULT.id]: ["result-root"],
1225
1830
  [BUILTIN_MANIFEST_COMPOSED.id]: ["aac.builtin.composed/v0"],
1226
1831
  });
1227
- /** The six built-in modules, registered by default. */
1832
+ /**
1833
+ * The extension interpreters a module ran on `bundle`. The contract-report
1834
+ * module applies the `contract-report/v1` block it resolved on
1835
+ * (contract-report/v1 section 4) and runs the Result reader, plus the one
1836
+ * earlier kind's reader whose data it drew (contractReportInput), never both:
1837
+ * until their removal, earlier blocks are read by their own readers (section 5).
1838
+ */
1839
+ function moduleInterpreters(id, bundle) {
1840
+ if (id === CONTRACT_REPORT_MANIFEST.id) {
1841
+ const drawn = typeof bundle === "object" && bundle !== null
1842
+ ? contractReportDrawn.get(bundle)
1843
+ : undefined;
1844
+ const input = drawn === undefined ? contractReportInput(bundle) : (drawn ?? undefined);
1845
+ return input === undefined
1846
+ ? ["contract-report", "result-root"]
1847
+ : [
1848
+ "contract-report",
1849
+ "result-root",
1850
+ input.grouping === "lines"
1851
+ ? "outcome-report-card"
1852
+ : "compliance-card",
1853
+ ];
1854
+ }
1855
+ return BUILTIN_MODULE_INTERPRETERS[id] ?? [];
1856
+ }
1857
+ /**
1858
+ * The seven built-in modules, registered by default: agent-action-capsule's
1859
+ * seven built-in shapes, with the contract-report module in place of
1860
+ * `aac.builtin.result-contract-report/v0` (contract-report/v1 section 4).
1861
+ */
1228
1862
  export const BUILTIN_PRESENTATIONS = Object.freeze([
1229
1863
  reportRowsModule,
1864
+ contractReportModule,
1230
1865
  resultOutcomeReportModule,
1231
1866
  resultComplianceModule,
1232
1867
  resultModule,
1233
1868
  evaluationSummaryGraphModule,
1234
1869
  noAggregateModule,
1235
1870
  ]);
1236
- /** A fresh registry holding the six built-in modules. */
1871
+ /** A fresh registry holding the seven built-in modules. */
1237
1872
  export function createPresentationRegistry() {
1238
1873
  const registry = new PresentationRegistry();
1239
1874
  for (const module of BUILTIN_PRESENTATIONS)
@@ -1293,6 +1928,7 @@ function citesCheckedSigners(selected) {
1293
1928
  [...claim.close.links, ...claim.close.ignored].some((link) => link.keyId !== undefined)));
1294
1929
  }
1295
1930
  const OUTCOME_CHROME = "oi";
1931
+ const COMPLIANCE_CHROME = "cc";
1296
1932
  function presentationServices(context) {
1297
1933
  return Object.freeze({
1298
1934
  details(summary, open = false) {
@@ -1327,15 +1963,351 @@ export async function renderEvidenceGraph(input, root, countersigners, options =
1327
1963
  : { verifyCommand: options.verifyCommand });
1328
1964
  return;
1329
1965
  }
1330
- // Verify first. Nothing reaches the DOM until the verification result is
1331
- // in hand, and no module is consulted for a bundle that did not verify.
1332
- const context = isVerifiedBundleContext(input)
1333
- ? countersigners === undefined
1966
+ if (isVerifiedBundleContext(input))
1967
+ return renderVerifiedContext(countersigners === undefined
1334
1968
  ? input
1335
- : withCountersigners(input, countersigners)
1336
- : await buildVerifiedBundleContext(input, {
1969
+ : withCountersigners(input, countersigners), root, options);
1970
+ // Verify first. Until the verification result is in hand the page shows
1971
+ // `checking` and nothing else, and no module is consulted for a bundle
1972
+ // that did not verify. A render that rejects while its own `checking` is
1973
+ // still shown puts back what `root` held before the first of the renders
1974
+ // still checking on it began, so it still draws nothing. When another
1975
+ // render on the same root is still checking, its `checking` is put back
1976
+ // instead; another render's `checking` that has ended never is.
1977
+ const group = checkingRenders.get(root) ?? {
1978
+ before: [...root.childNodes],
1979
+ active: new Set(),
1980
+ };
1981
+ checkingRenders.set(root, group);
1982
+ const { active } = group;
1983
+ const checking = renderChecking(root);
1984
+ active.add(checking);
1985
+ try {
1986
+ await renderVerifiedContext(await buildVerifiedBundleContext(input, {
1337
1987
  ...(countersigners === undefined ? {} : { countersigners }),
1338
- });
1988
+ }), root, options);
1989
+ }
1990
+ catch (err) {
1991
+ if (checking.parentNode === root) {
1992
+ const other = [...active].find((node) => node !== checking);
1993
+ if (other !== undefined)
1994
+ root.replaceChildren(other);
1995
+ else
1996
+ root.replaceChildren(...group.before);
1997
+ }
1998
+ throw err;
1999
+ }
2000
+ finally {
2001
+ active.delete(checking);
2002
+ if (active.size === 0)
2003
+ checkingRenders.delete(root);
2004
+ }
2005
+ }
2006
+ // The side margins are not in FRAME_LOOK: the shell centres the page root and
2007
+ // the bar with `auto` margins, and a computed `auto` margin is its used
2008
+ // width, which moves by half a classic scrollbar when a module's content
2009
+ // makes the page scroll. They are compared to within SIDE_MARGIN_SLACK
2010
+ // instead, a constant no module's stylesheet can change: a module that moves
2011
+ // the banner by more is still caught. It assumes a classic scrollbar of up to
2012
+ // 18 CSS px (a native 17px at zoom 100%); at a very low page zoom the
2013
+ // scrollbar is wider in CSS px, and an honest module that makes the page
2014
+ // scroll is then discarded, which fails closed.
2015
+ const SIDE_MARGINS = ["margin-left", "margin-right"];
2016
+ const SIDE_MARGIN_SLACK = 9;
2017
+ // The paddings and border widths: a module that widens them pushes the words
2018
+ // inside out of view.
2019
+ const BOX_EDGES = ["top", "right", "bottom", "left"].flatMap((side) => [
2020
+ `padding-${side}`,
2021
+ `border-${side}-width`,
2022
+ ]);
2023
+ // On the root's ancestors, which in the embedded format are the host page's
2024
+ // own elements, the offsets, paddings, border widths and a transform's
2025
+ // translation are compared to within the same slack: a host that places its
2026
+ // widget with `left: 50%`, `translateX(-50%)` or a percentage margin or
2027
+ // padding resolves them to used px that move with the scrollbar too. A
2028
+ // positioned element's `top` and `left` resolve to where it is, whichever of
2029
+ // its offsets set that, so they stand for `right` and `bottom`, whose used px
2030
+ // follow the height of the module's content and are not compared. A module can
2031
+ // therefore still shift the banner by up to SIDE_MARGIN_SLACK per offset of
2032
+ // each ancestor; `position` and a transform that was `none` are compared
2033
+ // exactly. Those shifts add up, so where the bar sits in the document is
2034
+ // bounded too: it may not rise by more than SIDE_MARGIN_SLACK, nor move
2035
+ // sideways by more than one assumed classic scrollbar, twice
2036
+ // SIDE_MARGIN_SLACK (a widget a host floats right moves by all of it).
2037
+ // Downward is left to the per-ancestor caps, since a scrollbar only narrows
2038
+ // the page and so pushes reflowing host content above the widget down; the
2039
+ // caps keep a module from pushing the banner off the first screen, under
2040
+ // fixed content of its own, through an ancestor. A host that centres a
2041
+ // growing widget vertically lifts the banner by itself; an honest module there
2042
+ // is discarded, which fails closed.
2043
+ const ANCESTOR_OFFSETS = [
2044
+ "top",
2045
+ "left",
2046
+ "margin-top",
2047
+ "margin-bottom",
2048
+ ...BOX_EDGES,
2049
+ ];
2050
+ const ANCESTOR_UNCOMPARED = ["right", "bottom"];
2051
+ // `a` is the frame now, `b` as it was before the module rendered. Words a
2052
+ // reader sees where the page is now must not be covered or clipped (see
2053
+ // readable), unless they already were before the module rendered: a host
2054
+ // that covered or clipped the widget itself is no module's doing.
2055
+ const sameLook = (a, b) => a.look === b.look &&
2056
+ (a.readable !== "no" || b.readable === "no") &&
2057
+ a.clips.length === b.clips.length &&
2058
+ a.clips.every((box, i) => box.width >= b.clips[i].width - 2 * SIDE_MARGIN_SLACK &&
2059
+ box.height >=
2060
+ b.clips[i].height - Math.max(0, box.bar - b.clips[i].bar) - 1) &&
2061
+ Math.abs(a.place[0] - b.place[0]) <= 2 * SIDE_MARGIN_SLACK &&
2062
+ a.place[1] - b.place[1] >= -SIDE_MARGIN_SLACK &&
2063
+ a.offsets.length === b.offsets.length &&
2064
+ a.offsets.every((m, i) => Math.abs(m - b.offsets[i]) <= SIDE_MARGIN_SLACK);
2065
+ // The computed properties of the banner frame a module's stylesheet must not
2066
+ // change (see looks in renderVerifiedContext): what decides whether the
2067
+ // banner and its details line are shown, where, and whether their words can
2068
+ // be read. Layout sizes are left out, since a module's content can change
2069
+ // them without touching the frame.
2070
+ const FRAME_LOOK = [
2071
+ "display",
2072
+ "visibility",
2073
+ "opacity",
2074
+ "color",
2075
+ "background-color",
2076
+ "background-image",
2077
+ "font-size",
2078
+ "text-indent",
2079
+ "position",
2080
+ "top",
2081
+ "left",
2082
+ "right",
2083
+ "bottom",
2084
+ "transform",
2085
+ "scale",
2086
+ "translate",
2087
+ "rotate",
2088
+ "zoom",
2089
+ "margin-top",
2090
+ "margin-bottom",
2091
+ ...BOX_EDGES,
2092
+ "font-family",
2093
+ "-webkit-text-fill-color",
2094
+ "clip",
2095
+ "clip-path",
2096
+ "mask-image",
2097
+ "-webkit-mask-image",
2098
+ "filter",
2099
+ "mix-blend-mode",
2100
+ "overflow",
2101
+ "max-height",
2102
+ "max-width",
2103
+ "z-index",
2104
+ "content-visibility",
2105
+ "contain",
2106
+ ];
2107
+ const ANCESTOR_LOOK = FRAME_LOOK.filter((name) => name !== "transform" &&
2108
+ !ANCESTOR_OFFSETS.includes(name) &&
2109
+ !ANCESTOR_UNCOMPARED.includes(name));
2110
+ // A computed transform split into its linear part, compared exactly, and its
2111
+ // translation in px, compared within the slack. Anything else (`none`) is
2112
+ // compared whole.
2113
+ function splitTransform(value) {
2114
+ const m = /^matrix(3d)?\((.*)\)$/.exec(value);
2115
+ if (m === null)
2116
+ return [value, []];
2117
+ const n = m[2].split(",").map(Number);
2118
+ const moves = m[1] === undefined ? [4, 5] : [12, 13, 14];
2119
+ return [
2120
+ `matrix${m[1] ?? ""}(${n.filter((_, i) => !moves.includes(i)).join(",")})`,
2121
+ moves.map((i) => n[i]),
2122
+ ];
2123
+ }
2124
+ // Whether a reader sees every word of each part where the page is now: for
2125
+ // each character other than white space whose box is in the viewport, the
2126
+ // elements a hit test finds at the box's centre (`elementsFromPoint`) reach
2127
+ // the character's own element before anything of the root's or in <head>
2128
+ // that paints over it (see seeThrough): a module's content, or a module's
2129
+ // rule laying out <head> or <style>. Nothing is scrolled to look. A
2130
+ // character clipped where the page is now (a hit on an element around it
2131
+ // first) is passed over: a reader may have scrolled it out of a scrolling
2132
+ // host, and a module that shrinks a clipping box is caught by its size (see
2133
+ // clips in looks). The host's other elements are passed over too, so a
2134
+ // host's own fixed header a reader scrolls under is no module's doing. A set
2135
+ // of parts none of whose words is seen is "unseen", as is any off a
2136
+ // laid-out document (jsdom). For the test's duration a
2137
+ // constructed stylesheet in a layer, which adds no element a module's rule
2138
+ // could show, makes everything hit-testable, so an overlay with
2139
+ // `pointer-events: none` is still found, even with an unlayered `!important`;
2140
+ // one set important inline, or in the module's own layer, is not. Paint the
2141
+ // browser does not hit-test (an outline, a shadow, a reflection) is not
2142
+ // found either; see #125 for why this check targets a module's mistakes and
2143
+ // not a module that sets out to hide the banner.
2144
+ function readable(parts, root) {
2145
+ const doc = root.ownerDocument;
2146
+ const view = doc.defaultView;
2147
+ if (view === null || view.navigator.userAgent.includes("jsdom"))
2148
+ return "unseen";
2149
+ const tree = root.getRootNode();
2150
+ const scope = tree === doc ? [doc] : [doc, tree];
2151
+ const sheet = new view.CSSStyleSheet();
2152
+ sheet.replaceSync("@layer cv-hit-test{*,*::before,*::after{pointer-events:auto!important}}");
2153
+ for (const at of scope)
2154
+ at.adoptedStyleSheets = [...at.adoptedStyleSheets, sheet];
2155
+ // The viewport less its scrollbars: a point under a scrollbar hits nothing.
2156
+ const port = doc.scrollingElement ?? doc.documentElement;
2157
+ const [width, height] = [port.clientWidth, port.clientHeight];
2158
+ const range = doc.createRange();
2159
+ let seen = 0;
2160
+ try {
2161
+ for (const part of parts) {
2162
+ const text = doc.createTreeWalker(part, view.NodeFilter.SHOW_TEXT);
2163
+ for (let node = text.nextNode(); node !== null; node = text.nextNode()) {
2164
+ const own = node.parentElement;
2165
+ let i = 0;
2166
+ for (const char of node.textContent ?? "") {
2167
+ range.setStart(node, i);
2168
+ i += char.length;
2169
+ range.setEnd(node, i);
2170
+ if (/\s/.test(char))
2171
+ continue;
2172
+ for (const box of range.getClientRects()) {
2173
+ const x = box.left + box.width / 2;
2174
+ const y = box.top + box.height / 2;
2175
+ if (box.width <= 0 || box.height <= 0)
2176
+ continue;
2177
+ if (x < 0 || y < 0 || x >= width || y >= height)
2178
+ continue;
2179
+ let shown = false;
2180
+ for (const hit of tree.elementsFromPoint(x, y)) {
2181
+ if (own.contains(hit)) {
2182
+ shown = true;
2183
+ break;
2184
+ }
2185
+ // Clipped where it is now, by the host or inside the banner:
2186
+ // see clips in looks.
2187
+ if (hit.contains(own))
2188
+ break;
2189
+ if ((root.contains(hit) || doc.head?.contains(hit) === true) &&
2190
+ !seeThrough(hit, view))
2191
+ return "no";
2192
+ }
2193
+ if (shown)
2194
+ seen++;
2195
+ }
2196
+ }
2197
+ }
2198
+ }
2199
+ }
2200
+ finally {
2201
+ for (const at of scope)
2202
+ at.adoptedStyleSheets = at.adoptedStyleSheets.filter((other) => other !== sheet);
2203
+ }
2204
+ return seen > 0 ? "yes" : "unseen";
2205
+ }
2206
+ // Whether a hit-tested element paints nothing of its own over what is under
2207
+ // it: it is transparent (opacity 0, on it or an ancestor), or it has no
2208
+ // background, border, shadow, backdrop filter, text of its own or generated
2209
+ // content and is not replaced content, like a module's empty full-page
2210
+ // container for toasts. A child that does paint is hit-tested on its own.
2211
+ function seeThrough(element, view) {
2212
+ for (let at = element; at !== null; at = at.parentElement)
2213
+ if (view.getComputedStyle(at).opacity === "0")
2214
+ return true;
2215
+ const style = view.getComputedStyle(element);
2216
+ const clear = (color) => color === "transparent" || /^rgba\(.*,\s*0\)$/.test(color);
2217
+ return (clear(style.backgroundColor) &&
2218
+ style.backgroundImage === "none" &&
2219
+ style.boxShadow === "none" &&
2220
+ style.backdropFilter === "none" &&
2221
+ ["top", "right", "bottom", "left"].every((side) => style.getPropertyValue(`border-${side}-width`) === "0px") &&
2222
+ !REPLACED.has(element.localName) &&
2223
+ ![...element.childNodes].some((child) => child.nodeType === 3 && (child.textContent ?? "").trim() !== "") &&
2224
+ ["::before", "::after"].every((pseudo) => ["none", "normal"].includes(view.getComputedStyle(element, pseudo).content)));
2225
+ }
2226
+ const REPLACED = new Set([
2227
+ "img",
2228
+ "video",
2229
+ "canvas",
2230
+ "iframe",
2231
+ "object",
2232
+ "embed",
2233
+ "svg",
2234
+ "input",
2235
+ "textarea",
2236
+ "select",
2237
+ "button",
2238
+ "meter",
2239
+ "progress",
2240
+ ]);
2241
+ // The linear part of the transforms applied to `element`'s content in the
2242
+ // viewport: its own and every ancestor's `transform`, `rotate`, `scale` and
2243
+ // `zoom`. A scroll offset is in its container's own px; this maps it into the
2244
+ // viewport px the bar's box is in. Every one of these properties is compared
2245
+ // exactly on the root's ancestors (see looks), so no module can change it.
2246
+ function linearTransform(element, view) {
2247
+ let matrix = new DOMMatrix();
2248
+ for (let at = element; at !== null; at = at.parentElement) {
2249
+ const style = view.getComputedStyle(at);
2250
+ const zoom = Number.parseFloat(style.zoom) || 1;
2251
+ const rotate = style.rotate === "none" ? "" : rotateFunction(style.rotate);
2252
+ const scale = style.scale === "none" ? "" : `scale3d(${scaleArgs(style.scale)})`;
2253
+ const transform = style.transform === "none" ? "" : style.transform;
2254
+ const local = new DOMMatrix(`${rotate} ${scale} ${transform}`.trim() || "none").scale(zoom, zoom);
2255
+ local.m41 = local.m42 = local.m43 = 0;
2256
+ matrix = local.multiply(matrix);
2257
+ }
2258
+ return matrix;
2259
+ }
2260
+ function rotateFunction(value) {
2261
+ const parts = value.split(/\s+/);
2262
+ if (parts.length === 1)
2263
+ return `rotate(${value})`;
2264
+ const angle = parts.pop();
2265
+ const axis = parts.length === 1
2266
+ ? ({ x: "1 0 0", y: "0 1 0", z: "0 0 1" }[parts[0]] ?? parts[0])
2267
+ : parts.join(" ");
2268
+ return `rotate3d(${axis.split(" ").join(",")},${angle})`;
2269
+ }
2270
+ function scaleArgs(value) {
2271
+ const [x, y = x, z = "1"] = value.split(/\s+/);
2272
+ return `${x},${y},${z}`;
2273
+ }
2274
+ // Whether a box is the containing block of a `position: fixed` box inside
2275
+ // it, in place of the viewport.
2276
+ function holdsFixed(style) {
2277
+ return (style.transform !== "none" ||
2278
+ style.translate !== "none" ||
2279
+ style.rotate !== "none" ||
2280
+ style.scale !== "none" ||
2281
+ style.perspective !== "none" ||
2282
+ style.filter !== "none" ||
2283
+ style.backdropFilter !== "none" ||
2284
+ /paint|layout|strict|content/.test(style.contain) ||
2285
+ /transform|perspective|filter/.test(style.willChange) ||
2286
+ style.containerType !== "normal" ||
2287
+ style.contentVisibility === "auto");
2288
+ }
2289
+ // Resolves after the next frame and then the timers already due. A page
2290
+ // that is not shown draws no frames, so a timer stands in for the frame
2291
+ // there.
2292
+ function settled(view) {
2293
+ return new Promise((done) => {
2294
+ let waiting = true;
2295
+ const next = () => {
2296
+ if (!waiting)
2297
+ return;
2298
+ waiting = false;
2299
+ view.setTimeout(done, 0);
2300
+ };
2301
+ view.requestAnimationFrame(next);
2302
+ view.setTimeout(next, SETTLE_MS);
2303
+ });
2304
+ }
2305
+ // The longest the settle waits for a frame.
2306
+ const SETTLE_MS = 100;
2307
+ // By root, the renders still verifying on it: their `checking` bars, and
2308
+ // what the root held before the first of them began.
2309
+ const checkingRenders = new WeakMap();
2310
+ async function renderVerifiedContext(context, root, options) {
1339
2311
  const { bundle, verification } = context;
1340
2312
  const verified = bundleVerified(verification);
1341
2313
  const registry = options.registry ?? defaultRegistry;
@@ -1393,17 +2365,251 @@ export async function renderEvidenceGraph(input, root, countersigners, options =
1393
2365
  model: await sectionResolution.module.buildModel(context),
1394
2366
  };
1395
2367
  }
2368
+ const stamps = await classifyCountersignatures(context.countersignatures.map((entry) => entry.value), verification.bundleDigest, declaredProducerKeys(bundle), context.countersigners);
2369
+ const bannerModel = verificationBanner(context, stamps);
1396
2370
  const records = object(bundle).records;
1397
2371
  const coverage = {
1398
- uncheckpointed: unboundRecordIds(verification).length,
2372
+ uncheckpointed: bannerModel.uncheckpointed,
1399
2373
  total: Array.isArray(records) ? records.length : 0,
1400
2374
  };
2375
+ // The host's three regions, in order after the banner and the header
2376
+ // (presentation contract section 9.1). L2 opens with the core's
2377
+ // verification section, drawn last but placed first; a module's L2 detail
2378
+ // follows it.
2379
+ const depth = options.depth ?? "L0";
2380
+ const region = (name) => {
2381
+ const node = document.createElement("div");
2382
+ node.dataset.region = name;
2383
+ return node;
2384
+ };
2385
+ let regions = {
2386
+ L0: root,
2387
+ L1: root,
2388
+ L2: root,
2389
+ core: root,
2390
+ };
2391
+ let bar;
1401
2392
  const drawFrame = () => {
1402
2393
  root.replaceChildren();
2394
+ root.classList.remove("cv-shell-chrome");
1403
2395
  renderPresentationHeader(root, bundle);
1404
- return renderVerificationBanner(root, verified, coverage);
2396
+ bar = renderVerificationBanner(root, bannerModel, coverage);
2397
+ const L2 = region("L2");
2398
+ const core = region("L2-core");
2399
+ const L2module = region("L2-module");
2400
+ L2.append(core, L2module);
2401
+ // On a failed bundle L0 and L1 are not created (presentation contract
2402
+ // section 9.1, I1): no module renders, and a notice goes before L2.
2403
+ if (verified) {
2404
+ regions = { L0: region("L0"), L1: region("L1"), L2: L2module, core };
2405
+ root.append(regions.L0, regions.L1, L2);
2406
+ }
2407
+ else {
2408
+ regions = { L0: root, L1: root, L2: L2module, core };
2409
+ root.append(L2);
2410
+ }
2411
+ };
2412
+ /** A page-level notice: first in L1, or before L2 on a failed bundle. */
2413
+ const notice = (note) => {
2414
+ if (verified)
2415
+ regions.L1.append(note);
2416
+ else
2417
+ root.insertBefore(note, regions.core.parentElement);
2418
+ };
2419
+ drawFrame();
2420
+ // The banner and its details line are the core's (contract sections 3 and
2421
+ // 6.2). A module that, while it renders, changes their words, structure or
2422
+ // attributes, hides or moves them, puts anything before them but the
2423
+ // core's own header, or draws a second banner, is discarded for the
2424
+ // refusal like one that throws. The bar's summary line is empty until the
2425
+ // verification section fills it, after every module has rendered. These
2426
+ // checks catch a module's mistakes; they do not hold against module code
2427
+ // written to hide the banner, which the builder's pin governs (#125).
2428
+ const snapshot = (parts) => JSON.stringify(parts.map((part) => part.outerHTML));
2429
+ // How the frame looks: the computed properties that decide whether its
2430
+ // words can be read, for every element of each part, the root and the
2431
+ // root's ancestors, with the root's chrome class as given (the one
2432
+ // restyling a module may ask for, setChromeClass). A stylesheet a module adds that changes any of
2433
+ // them, hiding the banner included, is caught by comparing with this as it
2434
+ // was before the module rendered, so a host that was already hidden (an
2435
+ // inactive tab) is no module's doing. Empty off a document, where no
2436
+ // styles apply; the static builder renders on a root in its document for
2437
+ // this reason.
2438
+ const looks = (parts, chromed) => {
2439
+ const view = root.ownerDocument.defaultView;
2440
+ if (!root.isConnected || view === null)
2441
+ return {
2442
+ look: "",
2443
+ offsets: [],
2444
+ place: [0, 0],
2445
+ readable: "unseen",
2446
+ clips: [],
2447
+ };
2448
+ const had = root.classList.contains("cv-shell-chrome");
2449
+ root.classList.toggle("cv-shell-chrome", chromed);
2450
+ // The root's ancestors too, up to <html>: a transform, opacity, filter,
2451
+ // clip or offset on any of them scales, hides or moves the banner while
2452
+ // every value on the banner itself stays the same.
2453
+ const ancestors = [];
2454
+ for (let at = root.parentElement; at !== null; at = at.parentElement)
2455
+ ancestors.push(at);
2456
+ const elements = [
2457
+ ...ancestors,
2458
+ root,
2459
+ ...parts.flatMap((part) => [part, ...part.querySelectorAll("*")]),
2460
+ ];
2461
+ // A browser also computes each element's ::before and ::after, whose
2462
+ // content can add words to the banner; jsdom computes no pseudo-element.
2463
+ const jsdom = view.navigator.userAgent.includes("jsdom");
2464
+ const pseudos = jsdom ? [null] : [null, "::before", "::after"];
2465
+ const offsets = [];
2466
+ const seen = JSON.stringify(elements.flatMap((element, at) => pseudos.map((pseudo) => {
2467
+ const style = view.getComputedStyle(element, pseudo);
2468
+ const ancestor = at < ancestors.length;
2469
+ const [transform, moves] = ancestor
2470
+ ? splitTransform(style.getPropertyValue("transform"))
2471
+ : [undefined, []];
2472
+ offsets.push(...moves);
2473
+ return [
2474
+ ...(ancestor ? ANCESTOR_LOOK : FRAME_LOOK).map((name) => style.getPropertyValue(name)),
2475
+ ...(transform === undefined ? [] : [transform]),
2476
+ ...[...SIDE_MARGINS, ...(ancestor ? ANCESTOR_OFFSETS : [])].flatMap((name) => {
2477
+ const value = style.getPropertyValue(name);
2478
+ const px = Number.parseFloat(value);
2479
+ offsets.push(Number.isNaN(px) ? 0 : px);
2480
+ return Number.isNaN(px) ? [value] : [];
2481
+ }),
2482
+ ...(pseudo === null ? [] : [style.getPropertyValue("content")]),
2483
+ ];
2484
+ })));
2485
+ // Where the bar sits in the document: its box plus every scroll offset
2486
+ // above it, so a reader's scrolling moves nothing. A scroll offset is in
2487
+ // its container's own px, mapped into viewport px by the transforms on
2488
+ // and above the container (linearTransform), which no module can
2489
+ // change; the viewport's own is in viewport px already.
2490
+ const box = parts[0].getBoundingClientRect();
2491
+ const place = [box.left, box.top];
2492
+ // A box with `position: fixed` stays put while the boxes between it and
2493
+ // its containing block scroll (the viewport, or the nearest ancestor that
2494
+ // makes one for it), so their offsets are left out.
2495
+ let fixed = false;
2496
+ for (let at = parts[0].parentElement; at !== null; at = at.parentElement) {
2497
+ const style = jsdom ? undefined : view.getComputedStyle(at);
2498
+ if (fixed && style !== undefined && holdsFixed(style))
2499
+ fixed = false;
2500
+ if (!fixed && (at.scrollLeft !== 0 || at.scrollTop !== 0)) {
2501
+ const move = at === root.ownerDocument.scrollingElement || jsdom
2502
+ ? { x: at.scrollLeft, y: at.scrollTop }
2503
+ : linearTransform(at, view).transformPoint({
2504
+ x: at.scrollLeft,
2505
+ y: at.scrollTop,
2506
+ });
2507
+ place[0] += move.x;
2508
+ place[1] += move.y;
2509
+ }
2510
+ if (style?.position === "fixed")
2511
+ fixed = true;
2512
+ }
2513
+ const words = readable(parts, root);
2514
+ // The visible size of every box that clips the banner, from <html> down
2515
+ // to the banner's own elements: a module that shrinks one (a scrolling
2516
+ // host's height set to 0) clips the banner wherever the reader has
2517
+ // scrolled. Which boxes clip is compared exactly (`overflow` and
2518
+ // `contain` are in the looks). A width may shrink by one assumed classic
2519
+ // scrollbar, as when the page or the box itself grows one, and a height
2520
+ // by as much as the box's own scrollbar across its bottom grew. The size is
2521
+ // mapped into viewport px through the transforms on and above the box,
2522
+ // which no module can change.
2523
+ const clips = jsdom
2524
+ ? []
2525
+ : elements.flatMap((element) => {
2526
+ const style = view.getComputedStyle(element);
2527
+ if (style.overflowX === "visible" &&
2528
+ style.overflowY === "visible" &&
2529
+ !/paint|strict|content/.test(style.contain) &&
2530
+ style.contentVisibility !== "auto")
2531
+ return [];
2532
+ // In viewport px, as the slack is: under a page zoom a scrollbar
2533
+ // takes more of a box's own px.
2534
+ const matrix = linearTransform(element, view);
2535
+ const across = matrix.transformPoint({ x: element.clientWidth });
2536
+ const down = matrix.transformPoint({ y: element.clientHeight });
2537
+ // The scrollbar across the box's bottom, in viewport px: the box's
2538
+ // height may shrink by only as much as that grows. A page's own
2539
+ // scrollbar leaves any other height alone. The viewport's is what
2540
+ // its height lacks of the window's.
2541
+ // The viewport's size is in viewport px already, as its scroll
2542
+ // offsets are.
2543
+ const viewport = element === root.ownerDocument.scrollingElement;
2544
+ const width = viewport
2545
+ ? element.clientWidth
2546
+ : Math.hypot(across.x, across.y);
2547
+ const height = viewport
2548
+ ? element.clientHeight
2549
+ : Math.hypot(down.x, down.y);
2550
+ const own = matrix.transformPoint({
2551
+ y: element instanceof view.HTMLElement && !viewport
2552
+ ? Math.max(0, element.offsetHeight -
2553
+ element.clientHeight -
2554
+ Number.parseFloat(style.borderTopWidth) -
2555
+ Number.parseFloat(style.borderBottomWidth))
2556
+ : 0,
2557
+ });
2558
+ const bar = viewport
2559
+ ? Math.max(0, view.innerHeight - height)
2560
+ : Math.hypot(own.x, own.y);
2561
+ return [
2562
+ {
2563
+ width,
2564
+ height,
2565
+ bar,
2566
+ },
2567
+ ];
2568
+ });
2569
+ root.classList.toggle("cv-shell-chrome", had);
2570
+ return { look: seen, offsets, place, readable: words, clips };
2571
+ };
2572
+ const frameOf = () => {
2573
+ const detail = bar.nextElementSibling;
2574
+ const parts = [
2575
+ bar,
2576
+ ...(detail?.hasAttribute("data-banner-detail") ? [detail] : []),
2577
+ ];
2578
+ return {
2579
+ parts,
2580
+ header: bar.previousElementSibling,
2581
+ words: snapshot(parts),
2582
+ looks: {
2583
+ plain: looks(parts, false),
2584
+ chrome: looks(parts, true),
2585
+ },
2586
+ };
2587
+ };
2588
+ // Measured only when a module will render: it lays out the page.
2589
+ let frame = selected !== undefined || section !== undefined ? frameOf() : undefined;
2590
+ const assertFrameIntact = () => {
2591
+ const at = frame;
2592
+ const [top, detail] = at.parts;
2593
+ const pill = top.querySelector("[data-verify]");
2594
+ const banners = root.querySelectorAll("[data-verify], [data-banner-detail]");
2595
+ const expected = [pill, ...(detail === undefined ? [] : [detail])];
2596
+ if (pill === null ||
2597
+ banners.length !== expected.length ||
2598
+ expected.some((part, i) => banners[i] !== part) ||
2599
+ // Nodes, not elements: a bare text node before the banner is words
2600
+ // too. The core draws no text node at the root.
2601
+ root.firstChild !== (at.header ?? top) ||
2602
+ top.previousSibling !== at.header ||
2603
+ (at.header !== null && at.header.parentNode !== root) ||
2604
+ (detail !== undefined && detail.previousElementSibling !== top) ||
2605
+ top.parentNode !== root ||
2606
+ top.hidden ||
2607
+ snapshot(at.parts) !== at.words ||
2608
+ !sameLook(looks(at.parts, root.classList.contains("cv-shell-chrome")), root.classList.contains("cv-shell-chrome")
2609
+ ? at.looks.chrome
2610
+ : at.looks.plain))
2611
+ throw new Error("a module altered the verification banner");
1405
2612
  };
1406
- let banner = drawFrame();
1407
2613
  if (refused.length > 0)
1408
2614
  root.dataset.presentationRefused = refused.map((r) => r.id).join(" ");
1409
2615
  else
@@ -1411,56 +2617,83 @@ export async function renderEvidenceGraph(input, root, countersigners, options =
1411
2617
  let chrome;
1412
2618
  if (selected !== undefined) {
1413
2619
  const host = {
1414
- L0: root,
1415
- L1: root,
1416
- L2: root,
1417
- depth: options.depth ?? "L2",
2620
+ L0: regions.L0,
2621
+ L1: regions.L1,
2622
+ L2: regions.L2,
2623
+ depth,
2624
+ ...(options.wording === undefined ? {} : { wording: options.wording }),
1418
2625
  setChromeClass(name) {
1419
- if (name !== OUTCOME_CHROME)
2626
+ if (name !== OUTCOME_CHROME && name !== COMPLIANCE_CHROME)
1420
2627
  throw new Error(`unknown chrome class ${JSON.stringify(name)}`);
1421
2628
  chrome = name;
1422
- styleBanner(banner, verified);
2629
+ // The card keeps its own frame; the pill keeps its look.
2630
+ root.classList.add("cv-shell-chrome");
1423
2631
  },
1424
2632
  };
1425
2633
  try {
1426
2634
  await selected.module.render(selected.model, host, presentationServices(context));
2635
+ assertFrameIntact();
1427
2636
  }
1428
2637
  catch {
1429
2638
  // Everything the module wrote is discarded; no other module is tried.
1430
2639
  chrome = undefined;
1431
- banner = drawFrame();
2640
+ drawFrame();
2641
+ frame = frameOf();
1432
2642
  refusal = "presentation-failed";
1433
2643
  }
1434
2644
  }
1435
2645
  if (refusal === undefined && resolution.kind === "no-presentation") {
1436
2646
  const note = element("p", "No presentation is available for this bundle, audience and format. The records and their verification are below.");
1437
2647
  note.dataset.notice = "no-presentation";
1438
- root.append(note);
2648
+ notice(note);
1439
2649
  }
1440
2650
  // The section renders after the page module, into the same regions. If it
1441
2651
  // throws, everything any module wrote is discarded for the refusal.
1442
2652
  if (section !== undefined && refusal === undefined) {
1443
2653
  try {
1444
2654
  await section.module.render(section.model, {
1445
- L0: root,
1446
- L1: root,
1447
- L2: root,
1448
- depth: "L2",
2655
+ L0: regions.L0,
2656
+ L1: regions.L1,
2657
+ L2: regions.L2,
2658
+ depth,
1449
2659
  setChromeClass() {
1450
2660
  throw new Error("a section has no chrome");
1451
2661
  },
1452
2662
  }, presentationServices(context));
2663
+ assertFrameIntact();
2664
+ }
2665
+ catch {
2666
+ chrome = undefined;
2667
+ drawFrame();
2668
+ refusal = "presentation-failed";
2669
+ }
2670
+ }
2671
+ // A module may still draw once its render has returned, from a timer or
2672
+ // the next frame: a toolbar or a modal it opens when its data is in. The
2673
+ // frame is checked again after the page settles, after the next frame and
2674
+ // then the timers already due. Anything a module draws later is out of
2675
+ // reach (#125). jsdom lays nothing out, so there the checks above are the
2676
+ // last.
2677
+ const view = root.ownerDocument.defaultView;
2678
+ if (refusal === undefined &&
2679
+ (selected !== undefined || section !== undefined) &&
2680
+ root.isConnected &&
2681
+ view !== null &&
2682
+ !view.navigator.userAgent.includes("jsdom")) {
2683
+ await settled(view);
2684
+ try {
2685
+ assertFrameIntact();
1453
2686
  }
1454
2687
  catch {
1455
2688
  chrome = undefined;
1456
- banner = drawFrame();
2689
+ drawFrame();
1457
2690
  refusal = "presentation-failed";
1458
2691
  }
1459
2692
  }
1460
2693
  if (refusal !== undefined) {
1461
2694
  const note = element("p", PRESENTATION_REFUSALS[refusal]);
1462
2695
  note.dataset.refusal = refusal;
1463
- root.append(note);
2696
+ notice(note);
1464
2697
  }
1465
2698
  // The interpreters this rendering actually ran (see extension-interpreters.ts):
1466
2699
  // the presentation header and the countersignature stamp always run; a
@@ -1472,9 +2705,14 @@ export async function renderEvidenceGraph(input, root, countersigners, options =
1472
2705
  if (refusal === undefined)
1473
2706
  for (const ran of [selected, section])
1474
2707
  if (ran !== undefined)
1475
- for (const id of BUILTIN_MODULE_INTERPRETERS[ran.module.manifest.id] ??
1476
- [])
2708
+ for (const id of moduleInterpreters(ran.module.manifest.id, context.bundle))
1477
2709
  applied.add(id);
1478
- await renderVerificationPage(root, context, chrome === OUTCOME_CHROME, applied, refused, refusal === undefined && citesCheckedSigners(selected), options.verifierHint);
2710
+ const checkedLine = await renderVerificationPage(regions.core, context, chrome === OUTCOME_CHROME, applied, refused, refusal === undefined && citesCheckedSigners(selected), options.verifierHint, depth, stamps);
2711
+ // The banner says the same counts as the section it links to.
2712
+ const summary = root.querySelector("[data-verify-summary]");
2713
+ if (summary !== null)
2714
+ summary.textContent = checkedLine;
2715
+ // A page opened at a record's address shows that record.
2716
+ revealRecordsByHash(root.ownerDocument);
1479
2717
  }
1480
2718
  //# sourceMappingURL=evidence-graph-view.js.map