clearotron 0.7.0 → 0.8.0-beta.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.
- package/THIRD-PARTY-NOTICES.md +71 -2
- package/build-info.json +2 -2
- package/demo/multi-country-focus-search/run/common-law-grid.json +1 -1
- package/docs/CLIENT-MCP.md +17 -0
- package/docs/assets/README.md +19 -3
- package/docs/assets/portal-clearance-report.jpg +0 -0
- package/docs/assets/portal-conflict-landscape.jpg +0 -0
- package/docs/assets/portal-new-clearance.png +0 -0
- package/driver/CHANGELOG.md +48 -0
- package/driver/config-inventory.mjs +15 -2
- package/driver/dev-portal.mjs +2 -0
- package/driver/effort-model.mjs +34 -4
- package/driver/engine/CONTRACT.md +8 -0
- package/driver/engine/anthropic-agent.mjs +74 -16
- package/driver/engine/jx-turn.mjs +11 -3
- package/driver/engine/openai-agent.mjs +33 -7
- package/driver/engine/run-choices.mjs +28 -7
- package/driver/engine/speed.mjs +107 -0
- package/driver/enqueue-schema.mjs +8 -0
- package/driver/enqueue.mjs +14 -2
- package/driver/jx-units.mjs +2 -2
- package/driver/jx.mjs +1 -1
- package/driver/knockout-plain-language.mjs +96 -0
- package/driver/ladder/attempt-record.mjs +14 -2
- package/driver/ladder/dispatch.mjs +2 -2
- package/driver/ladder/form-repair.mjs +1 -1
- package/driver/ladder/stage.mjs +7 -1
- package/driver/mark-logos.mjs +6 -1
- package/driver/order-receipt.mjs +184 -0
- package/driver/package.json +4 -1
- package/driver/picture-shrink-worker.mjs +21 -0
- package/driver/picture-thumbnail.mjs +132 -0
- package/driver/pipeline-knockout.mjs +14 -0
- package/driver/portal-confirmation.mjs +3 -0
- package/driver/portal-report.mjs +44 -1
- package/driver/portal-routes/run.mjs +19 -9
- package/driver/portal-runs.mjs +118 -63
- package/driver/portal-service.mjs +17 -2
- package/driver/predelivery-lint.mjs +3 -3
- package/driver/progress.mjs +33 -5
- package/driver/publish/column-queries.mjs +86 -0
- package/driver/publish/index.mjs +4 -4
- package/driver/publish/knockout.mjs +35 -8
- package/driver/publish/page-shell.mjs +5 -1
- package/driver/publish/read-document.mjs +3 -0
- package/driver/publish/render-knockout.mjs +61 -16
- package/driver/publish/render.mjs +171 -30
- package/driver/publish/search-depth.mjs +45 -1
- package/driver/publish/strings.mjs +23 -0
- package/driver/publish/templates/report.css +73 -0
- package/driver/research-answers.mjs +17 -6
- package/driver/research-checks.mjs +22 -4
- package/driver/research-records.mjs +81 -0
- package/driver/run-quote.mjs +3 -0
- package/driver/run-speed.mjs +89 -0
- package/driver/runner.mjs +50 -21
- package/driver/saved-register-pages.mjs +23 -22
- package/driver/stage-freshness.mjs +5 -0
- package/driver/stages.mjs +2 -2
- package/driver/steps/open-run.mjs +12 -1
- package/driver/suite-census.json +199 -37
- package/driver/tokens.mjs +3 -0
- package/driver/urgent-count.mjs +54 -0
- package/driver/usage-ledger.mjs +8 -2
- package/driver/web-pictures.mjs +532 -0
- package/mcp-server/CHANGELOG.md +16 -0
- package/mcp-server/lib/document-reads.mjs +28 -0
- package/mcp-server/lib/events.mjs +21 -12
- package/mcp-server/lib/findings.mjs +2 -1
- package/mcp-server/lib/knockout.mjs +3 -2
- package/mcp-server/lib/ops.mjs +103 -6
- package/mcp-server/lib/options.mjs +4 -0
- package/mcp-server/lib/plan.mjs +38 -4
- package/mcp-server/lib/result-shapes.mjs +66 -0
- package/mcp-server/lib/runs.mjs +46 -44
- package/mcp-server/lib/urgent.mjs +29 -0
- package/mcp-server/package.json +1 -1
- package/mcp-server/result-shapes.json +2978 -0
- package/mcp-server/server.mjs +67 -14
- package/package.json +4 -1
- package/portal-ui/dist/assets/{index-qNDhqCw9.js → index-DEkVU2FD.js} +1909 -766
- package/portal-ui/dist/assets/{index-CxAkJXIT.css → index-W6SAoDkS.css} +238 -1
- package/portal-ui/dist/index.html +2 -2
- package/portal-ui/package.json +1 -1
- package/providers/jx/src/turn-envelope.mjs +3 -1
- package/providers/oauth-mcp-bridge/CHANGELOG.md +4 -0
- package/providers/oauth-mcp-bridge/package.json +1 -1
- package/providers/signa/src/core.js +54 -12
- package/scripts/README.md +3 -0
- package/scripts/e2e-first-time.mjs +2 -2
- package/scripts/mint-result-shapes.mjs +199 -0
- package/scripts/readme-pictures.mjs +227 -0
- package/scripts/render-check.mjs +4 -1
- package/scripts/report-sections-render-check.mjs +191 -0
- package/scripts/settings-render-check.mjs +68 -11
- package/shared/brand.mjs +8 -0
- package/skills/clearotron-account/SKILL.md +24 -0
- package/skills/clearotron-ops/SKILL.md +23 -9
|
@@ -29,12 +29,13 @@ import { inputsLine } from '../framework-method.mjs';
|
|
|
29
29
|
import { clientConditions } from '../terminal-clamp.mjs'; import { hrefAttr } from './attr.mjs'; // an href is attribute-safe and http(s), or not a link
|
|
30
30
|
import { EXPORT_TOGGLE, exportPopover, EXPORT_MENU_JS } from './report-topbar.mjs'; // the export menu's shell and behaviour, shared with the knockout template // the reader's clause per condition, shared with the cover note
|
|
31
31
|
import { COMMON_LAW, normRegion, regionName, REGION_NAMES } from './regions.mjs';
|
|
32
|
+
import { webNameRow } from './search-depth.mjs'; // what a web name's `url` gives the page, read once for the page and the lint
|
|
32
33
|
import { parseFindingsJson, bindRecommendation, sentenceCaseLead, CLIENT_TIER_BY_COMPOSITE, bandOf, compareBlockingPower, inDispositionMode, reasonedNegativeGroups } from '../findings-model.mjs';
|
|
33
34
|
import { REC, inPriorityWindow, ownerDisplayName } from '../registry-fidelity.mjs';
|
|
34
35
|
import { registrationSystem } from '../jurisdiction-systems.mjs';
|
|
35
36
|
import { REPORT_PAGE as R, RECORD_LINKS as LINK_WORDS, KNOCKOUT_PAGE } from './strings.mjs';
|
|
36
37
|
import { READ_LEAD_RE } from '../report-card-record.mjs'; // D3 — the dedupe gate and the card's acceptance are ONE predicate
|
|
37
|
-
import { logoLockup, BRAND, confPosture, PALETTE, QUADRANT_COLOURS as QC } from '../../shared/brand.mjs';
|
|
38
|
+
import { logoLockup, BRAND, confPosture, PALETTE, QUADRANT_COLOURS as QC, BAND_SOFT, BAND_SOFT_TEXT } from '../../shared/brand.mjs';
|
|
38
39
|
import { NAV_CSS } from '../../shared/site-nav.mjs';
|
|
39
40
|
import { reportPage } from './page-shell.mjs';
|
|
40
41
|
import { registerRecordView, RECORD_LABELS, registrationsCount } from './register-record.mjs';
|
|
@@ -112,6 +113,7 @@ let NEGATIVES_GROUPED = false;
|
|
|
112
113
|
let FRAMEWORK = null;
|
|
113
114
|
let FRAMEWORK_METHOD = null; // the frozen method (framework-method.mjs), where the framework states one
|
|
114
115
|
let AUDIT_HREF = null; // the audit workbook's address, for the line a capped list ends with; null when the run has none
|
|
116
|
+
let WEB_PICTURES = new Map(); // finding ordinal → its saved web pictures, in the card's order; empty without the picture step
|
|
115
117
|
let LOGOS = new Map(); // registration → its saved logo ({ state, src }); empty on a run that fetched none
|
|
116
118
|
const GAUGE_STOP_BY_TONE = { minimal: 1, low: 1, medium: 2, high: 3, severe: 4 };
|
|
117
119
|
// Severity rank for sorting/worst-of: band index in the manifest (0 = most severe); legacy composite
|
|
@@ -1015,18 +1017,28 @@ function clearedGroupsHtml(searchDepth, auditFile) {
|
|
|
1015
1017
|
|
|
1016
1018
|
// THE RUN'S OWN COMMON-LAW SEARCH RECORD, named in words. A row the assessing model backed with the run's own search
|
|
1017
1019
|
// ledger carries that file's name where a web address would be, and the page printed it as a link to nowhere. Only a
|
|
1018
|
-
// reference positively identified as that ledger is renamed; any other source keeps its
|
|
1019
|
-
// truthful label exists for it. The run's record and the audit keep the original reference.
|
|
1020
|
-
const RUN_COMMON_LAW_RECORD = /^(?:\.\/)?(?:_driver\/)?common-law-grid(?:\.half-[a-z0-9]+)?\.json$/i;
|
|
1020
|
+
// reference positively identified as that ledger is renamed (search-depth.mjs, `runRecord`); any other source keeps its
|
|
1021
|
+
// exact reference until a truthful label exists for it. The run's record and the audit keep the original reference.
|
|
1021
1022
|
const RUN_COMMON_LAW_RECORD_LABEL = R.cleared.runCommonLawRecord;
|
|
1022
1023
|
|
|
1024
|
+
// EVERY NAME THE HEADER COUNTS IS PRINTED, AND EACH LINK IS AN ADDRESS. The list used to stop at the register groups'
|
|
1025
|
+
// eight with no pointer to the rest, and the workbook does not carry these names' addresses, so a ninth name was
|
|
1026
|
+
// reachable nowhere a client reads; the list sits in a closed fold, so its length costs the page nothing until it is
|
|
1027
|
+
// opened. A row links each http(s) address search-depth.mjs read out of what the model wrote (`links`), and opens it in
|
|
1028
|
+
// a new tab as the page's other evidence links do. A block that gave no address is not a name and is not here.
|
|
1029
|
+
const webAddressText = (u) => String(u).replace(/^https?:\/\//, '').replace(/\/$/, '');
|
|
1023
1030
|
function webNamesHtml(searchDepth) {
|
|
1024
|
-
|
|
1031
|
+
// A record written before the reader gave each row its links carries only `url`; it is read the same way here.
|
|
1032
|
+
const web = ((searchDepth && searchDepth.cleared && searchDepth.cleared.web) || [])
|
|
1033
|
+
.map((w) => (Array.isArray(w.links) ? w : { ...w, ...(webNameRow(w.url) ?? { links: [], runRecord: false, ref: null, note: true }) }))
|
|
1034
|
+
.filter((w) => !w.note);
|
|
1025
1035
|
if (!web.length) return '';
|
|
1026
|
-
const
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
: w.
|
|
1036
|
+
const rows = web.map((w) => `<div class="crow"><span class="cm-mark">${esc(w.title || '')}</span><span class="curl">${
|
|
1037
|
+
w.runRecord ? esc(RUN_COMMON_LAW_RECORD_LABEL)
|
|
1038
|
+
: w.ref ? esc(w.ref)
|
|
1039
|
+
: w.links.map((u) => (hrefAttr(u)
|
|
1040
|
+
? `<a href="${hrefAttr(u)}" target="_blank" rel="noopener noreferrer">${esc(webAddressText(u))}</a>` : esc(webAddressText(u)))).join(' \u00b7 ')
|
|
1041
|
+
}</span></div>`).join('');
|
|
1030
1042
|
return `<details class="cgroup"><summary><span class="gname">${R.cleared.webAndMarketplace}</span><span class="gcount">${
|
|
1031
1043
|
R.cleared.names(web.length.toLocaleString('en-GB'), web.length)}</span></summary><div class="gbody">${rows}</div></details>`;
|
|
1032
1044
|
}
|
|
@@ -1426,7 +1438,13 @@ function dedupeScatter(findings) {
|
|
|
1426
1438
|
// of "#1", "#2" links. The <title>, first in the <svg>, says what the drawing is; its count is the points drawn.
|
|
1427
1439
|
const chartTitle = R.chartTitle;
|
|
1428
1440
|
|
|
1429
|
-
|
|
1441
|
+
// A DOT SAYS WHICH CONFLICT IT IS (owner, 2026-11-25). Hovering a dot, or moving keyboard focus to it, shows a small
|
|
1442
|
+
// panel beside it with the fields the rights-holders list prints for that conflict: the number on the dot's own colour,
|
|
1443
|
+
// the mark and the band, then the owner and the country (keyFields, one definition for both). The link's name carries
|
|
1444
|
+
// the same fields for a screen reader. The panel is one element in the chart's card that the page script fills and
|
|
1445
|
+
// places on the side of the dot with fewer neighbouring dots; it never covers its own dot, the pointer can rest on it,
|
|
1446
|
+
// and Escape hides it. With scripts off the dot keeps its number as its tooltip, and nothing of this prints.
|
|
1447
|
+
function quadrant(findings, recordsByUri = new Map()) {
|
|
1430
1448
|
const points = dedupeScatter(findings);
|
|
1431
1449
|
const markers = points.map(({ f, cx, cy, on, r, pending }) => {
|
|
1432
1450
|
// Band hexes, hardcoded on purpose: the quadrant panel stays a FIXED LIGHT surface in dark mode
|
|
@@ -1438,8 +1456,16 @@ function quadrant(findings) {
|
|
|
1438
1456
|
? `<circle cx="${X}" cy="${Y}" r="${r}" fill="${QC.pendingFill}" stroke="${fill}" stroke-width="2.5"/><text x="${X}" y="${Y}" text-anchor="middle" dominant-baseline="central" font-size="${fs}" font-weight="900" fill="${fill}">${esc(f.ordinal)}</text>`
|
|
1439
1457
|
: `<circle cx="${X}" cy="${Y}" r="${r}" fill="${fill}" stroke="${PALETTE.ink}" stroke-opacity=".22" stroke-width="1"/><text x="${X}" y="${Y}" text-anchor="middle" dominant-baseline="central" font-size="${fs}" font-weight="900" fill="#fff">${esc(f.ordinal)}</text>`;
|
|
1440
1458
|
const t = cardTarget(f.ordinal);
|
|
1441
|
-
|
|
1459
|
+
if (!t) return inner;
|
|
1460
|
+
const k = keyFields(f, recordsByUri);
|
|
1461
|
+
const name = [String(f.ordinal), f.mark, k.chip, k.who, k.where].filter(Boolean).join(' \u00b7 ');
|
|
1462
|
+
const ring = `<circle class="qring" cx="${X}" cy="${Y}" r="${r + 5}" fill="none" stroke="${PALETTE.ink}" stroke-width="2"/>`;
|
|
1463
|
+
return `<a href="#${t}" aria-label="${escAttr(name)}" data-tip-n="${escAttr(f.ordinal)}" data-tip-mark="${escAttr(f.mark ?? '')}" data-tip-band="${escAttr(k.chip)}" data-tip-tone="${on ? 'med' : 'low'}" data-tip-fill="${fill}" data-tip-sub="${
|
|
1464
|
+
escAttr([k.who, k.where].filter(Boolean).join(' \u00b7 '))}"><title>#${t.slice(1)}</title>${ring}${inner}</a>`;
|
|
1442
1465
|
}).join('');
|
|
1466
|
+
const tipColours = Object.entries({ ink: PALETTE.ink, sub: PALETTE.muted, 'med-bg': BAND_SOFT.med, 'med-tx': BAND_SOFT_TEXT.med,
|
|
1467
|
+
'low-bg': BAND_SOFT.clear, 'low-tx': BAND_SOFT_TEXT.clear }).map(([k, v]) => `--qt-${k}:${v}`).join(';');
|
|
1468
|
+
const tip = `<div class="qtip no-print" aria-hidden="true" hidden style="${tipColours}"><div class="qt1"><span class="qn"></span><span class="qm"></span><span class="qb"></span></div><div class="qs"></div></div>`;
|
|
1443
1469
|
return `<div class="panel land">
|
|
1444
1470
|
<svg viewBox="0 0 560 430" xmlns="http://www.w3.org/2000/svg" font-family="Plus Jakarta Sans, sans-serif">
|
|
1445
1471
|
<title>${chartTitle(points.length)}</title>
|
|
@@ -1456,6 +1482,7 @@ function quadrant(findings) {
|
|
|
1456
1482
|
<span><i style="background:${QC.secondary}"></i>${FRAMEWORK ? R.chart.secondaryWatch : R.chart.secondaryManageable}</span>
|
|
1457
1483
|
<span><i style="background:${QC.pendingFill};border:2px solid ${QC.secondary};width:7px;height:7px"></i>${R.chart.pending}</span>
|
|
1458
1484
|
</div>
|
|
1485
|
+
${tip}
|
|
1459
1486
|
</div>`;
|
|
1460
1487
|
}
|
|
1461
1488
|
|
|
@@ -1464,6 +1491,16 @@ function quadrant(findings) {
|
|
|
1464
1491
|
// (owner-unknown, who === mark, collapses to the mark alone). Classes union ACROSS registrations —
|
|
1465
1492
|
// registrations[0] alone under-reported multi-registration findings vs the card chip. The source token
|
|
1466
1493
|
// keeps the house sentence case ('Register' / 'Common-law') and never wraps mid-word.
|
|
1494
|
+
// What the rights-holders list prints for one conflict, beyond its number and mark: the band chip, the holder where it is
|
|
1495
|
+
// not the mark itself, and the country the list groups it under. The chart's dot panel reads the same fields.
|
|
1496
|
+
const sameName = (a, b) => String(a || '').toLowerCase().replace(/[^a-z0-9]+/g, ' ').trim() === String(b || '').toLowerCase().replace(/[^a-z0-9]+/g, ' ').trim();
|
|
1497
|
+
function keyFields(f, recordsByUri = new Map()) {
|
|
1498
|
+
const chip = (FRAMEWORK && f.composite == null) ? (f.band != null ? String(f.band) : '\u2014') : `C${f.composite}`;
|
|
1499
|
+
const holder = recordOwner(f, recordsByUri) || f.owner?.name || f.mark; // doc-31 step 4: bound from the record
|
|
1500
|
+
const code = regionCode(f);
|
|
1501
|
+
return { chip, holder, who: holder && !sameName(holder, f.mark) ? holder : '', where: code === COMMON_LAW ? R.key.commonLawGroup : (regionName(code) || code) };
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1467
1504
|
function keyRow(f, recordsByUri) {
|
|
1468
1505
|
const on = isOnField(f);
|
|
1469
1506
|
const kn = on ? QC.onField : QC.secondary; // matches this row's quadrant marker — light ramp, see quadrant()
|
|
@@ -1471,11 +1508,10 @@ function keyRow(f, recordsByUri) {
|
|
|
1471
1508
|
const cls = [...new Set((f.owner?.registrations || []).flatMap((r) => Array.isArray(r.classes) ? r.classes : []))]
|
|
1472
1509
|
.map(Number).filter((x) => !Number.isNaN(x)).sort((a, b) => a - b).join('/');
|
|
1473
1510
|
const src = sourceChip(f.source?.source_type || '').label;
|
|
1474
|
-
const who =
|
|
1475
|
-
const chip =
|
|
1476
|
-
const nrm = (s) => String(s || '').toLowerCase().replace(/[^a-z0-9]+/g, ' ').trim();
|
|
1511
|
+
const { chip: chipText, who } = keyFields(f, recordsByUri);
|
|
1512
|
+
const chip = esc(chipText);
|
|
1477
1513
|
const subParts = [];
|
|
1478
|
-
if (who
|
|
1514
|
+
if (who) subParts.push(esc(who));
|
|
1479
1515
|
if (cls) subParts.push(R.key.classes(esc(cls)));
|
|
1480
1516
|
if (src) subParts.push(`<span style="white-space:nowrap">${esc(src)}</span>`);
|
|
1481
1517
|
const t = cardTarget(f.ordinal);
|
|
@@ -1493,10 +1529,10 @@ function keyPanel(findings, recordsByUri = new Map()) {
|
|
|
1493
1529
|
const all = groupByRegion(findings);
|
|
1494
1530
|
const regions = all.filter(g => g.code !== COMMON_LAW);
|
|
1495
1531
|
const clGroup = all.find(g => g.code === COMMON_LAW);
|
|
1496
|
-
const detail = (g, label, sub, collapsed = false) => {
|
|
1532
|
+
const detail = (g, label, sub, collapsed = false, cls = '') => {
|
|
1497
1533
|
const kc = g.hasOnField ? 'med' : 'low';
|
|
1498
1534
|
const rows = g.findings.map(f => keyRow(f, recordsByUri)).join('');
|
|
1499
|
-
return `<details class="rrow"${!collapsed && g.hasOnField ? ' open' : ''}><summary><span class="rcode">${esc(g.code)}</span><span class="rname">${esc(label ?? g.name)}</span><span class="kc ${kc}">${g.chip}</span><span class="rsub">${sub ?? esc(cap(registrationSystem(g.code) ?? ''))}</span><span class="rcount">${g.count}</span></summary><div class="rbody">${rows}</div></details>`;
|
|
1535
|
+
return `<details class="rrow${cls ? ` ${cls}` : ''}"${!collapsed && g.hasOnField ? ' open' : ''}><summary><span class="rcode">${esc(g.code)}</span><span class="rname">${esc(label ?? g.name)}</span><span class="kc ${kc}">${g.chip}</span><span class="rsub">${sub ?? esc(cap(registrationSystem(g.code) ?? ''))}</span><span class="rcount">${g.count}</span></summary><div class="rbody">${rows}</div></details>`;
|
|
1500
1536
|
};
|
|
1501
1537
|
// doc-55 A2 (whitespace): open ONLY the single highest-risk region — the first on-field group in
|
|
1502
1538
|
// exposure order (groups are sorted by lowest ordinal) — and collapse every other region to its
|
|
@@ -1514,7 +1550,7 @@ function keyPanel(findings, recordsByUri = new Map()) {
|
|
|
1514
1550
|
const clFirst = cardTarget((findings.find((f) => regionCode(f) === COMMON_LAW && isOnField(f)) ?? clGroup?.findings[0])?.ordinal);
|
|
1515
1551
|
const clLink = clFirst ? `<a href="#${clFirst}">${esc(R.key.commonLawSectionLink)}</a>` : esc(R.key.commonLawSectionLink);
|
|
1516
1552
|
const clBlock = clGroup
|
|
1517
|
-
? `<p class="keyhint" style="margin-top:10px">${R.key.commonLawHint(clLink)}</p>${detail(clGroup, R.key.commonLawGroup,
|
|
1553
|
+
? `<p class="keyhint" style="margin-top:10px">${R.key.commonLawHint(clLink)}</p>${detail(clGroup, R.key.commonLawGroup, R.key.unregisteredUse, true, 'rcl')}`
|
|
1518
1554
|
: '';
|
|
1519
1555
|
return `<div class="panel keypanel">
|
|
1520
1556
|
<div class="label">${R.key.title}</div>
|
|
@@ -1971,8 +2007,22 @@ function registerRecordBlock(f, recordsByUri, numberOf) {
|
|
|
1971
2007
|
// asked about, or one whose fetch failed draws nothing (owner, 2026-11-25), so a card with no saved logo draws no
|
|
1972
2008
|
// line. A grouped negative row shows up to three small
|
|
1973
2009
|
// logos and "+N" under its text. The image travels inside the report; nothing points at the register's image.
|
|
2010
|
+
// "On the web" (owner, 2026-11-25 and 2026-11-26): the pictures the pages the card says the name is used on declare for
|
|
2011
|
+
// themselves, saved by the picture step, each in the logo's box, captioned with its site alone and opening the page it
|
|
2012
|
+
// came from. Drawn only when it holds a picture; a page that gave none leaves no trace.
|
|
2013
|
+
function webFrame(f) {
|
|
2014
|
+
const pics = WEB_PICTURES.get(String(f.ordinal)) ?? [];
|
|
2015
|
+
if (!pics.length) return '';
|
|
2016
|
+
const figures = pics.slice(0, 8).map((p) => {
|
|
2017
|
+
const href = hrefAttr(p.page);
|
|
2018
|
+
const img = `<img src="${escAttr(p.src)}" alt="${escAttr(R.pictures.webAlt(f.mark ?? '', p.site ?? '', p.fetchedOn ?? ''))}">`;
|
|
2019
|
+
return `<figure class="rr-lg">${href ? `<a href="${href}" target="_blank" rel="noopener noreferrer">${img}</a>` : img}<figcaption>${esc(p.site ?? '')}</figcaption></figure>`;
|
|
2020
|
+
}).join('');
|
|
2021
|
+
return `<div class="pic-set"><div class="pic-head"><span class="pic-lab">${esc(R.pictures.onTheWeb)}</span></div><div class="rr-logos rr-band">${figures}</div></div>`;
|
|
2022
|
+
}
|
|
2023
|
+
|
|
1974
2024
|
function logoLine(f, recordsByUri, { small = false } = {}) {
|
|
1975
|
-
if (!LOGOS.size) return '';
|
|
2025
|
+
if (!LOGOS.size && (small || !WEB_PICTURES.size)) return '';
|
|
1976
2026
|
const figures = shownRegistrations(f, (uri) => Boolean(recordsByUri.get(uri)))
|
|
1977
2027
|
.map((r) => {
|
|
1978
2028
|
const rec = recordsByUri.get(String(r.uri).toLowerCase());
|
|
@@ -1980,8 +2030,15 @@ function logoLine(f, recordsByUri, { small = false } = {}) {
|
|
|
1980
2030
|
return logoFigureHtml(rec, { uri: r.uri, logo: LOGOS.get(normalizeRecordUri(r.uri)), href, caption: !small });
|
|
1981
2031
|
})
|
|
1982
2032
|
.filter(Boolean);
|
|
2033
|
+
// THE PICTURE LINE (owner, 2026-11-25): each set of pictures in a frame of its own under its label, so a reader can
|
|
2034
|
+
// tell which set is which. "Register" holds the logos the run fetched, drawn as before, then "On the web"; each is
|
|
2035
|
+
// drawn only when it holds a picture. The rows under "Marks that can coexist" keep their small unframed logos.
|
|
2036
|
+
if (!small) {
|
|
2037
|
+
const register = figures.length ? `<div class="pic-set"><div class="pic-head"><span class="pic-lab">${esc(R.pictures.register)}</span></div><div class="rr-logos rr-band">${figures.join('')}</div></div>` : '';
|
|
2038
|
+
const web = webFrame(f);
|
|
2039
|
+
return register || web ? `<div class="pic-line">${register}${web}</div>` : '';
|
|
2040
|
+
}
|
|
1983
2041
|
if (!figures.length) return '';
|
|
1984
|
-
if (!small) return `<div class="rr-logos rr-band">${figures.join('')}</div>`;
|
|
1985
2042
|
return `<div class="rr-logos rr-sm">${figures.slice(0, 3).join('')}${figures.length > 3 ? `<span class="rr-more">+${figures.length - 3}</span>` : ''}</div>`;
|
|
1986
2043
|
}
|
|
1987
2044
|
|
|
@@ -2121,6 +2178,12 @@ function manageableLine(f) {
|
|
|
2121
2178
|
// `net` key exists but is blank. `clause` is `foldClause` with the budget arm removed and nothing else.
|
|
2122
2179
|
const clause = (value) => String(value ?? '').trim();
|
|
2123
2180
|
|
|
2181
|
+
// COPY LINK (owner, 2026-11-25): a full card's link to itself, inside the portal only. The page cannot know the portal's
|
|
2182
|
+
// address, so the button asks the portal through the frame bridge, which also shows it; a report opened by itself never
|
|
2183
|
+
// shows it, and it never prints. The tick replaces the link icon once the portal says the copy landed.
|
|
2184
|
+
const COPY_ICONS = '<svg class="ci-link" width="12" height="12" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 8a3 3 0 004.2.3l2-2a3 3 0 00-4.2-4.2l-1 1"/><path d="M8 6a3 3 0 00-4.2-.3l-2 2a3 3 0 004.2 4.2l1-1"/></svg><svg class="ci-tick" width="12" height="12" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2.5 7.5l3 3 6-7"/></svg>';
|
|
2185
|
+
const copyLinkButton = (label, copied) => `<button type="button" class="copy-fi no-print" data-copied="${escAttr(copied)}">${COPY_ICONS}<span>${esc(label)}</span></button>`;
|
|
2186
|
+
|
|
2124
2187
|
function findingCard(f, card, recordsByUri = new Map()) {
|
|
2125
2188
|
const tierCls = isOnField(f) ? 'med' : 'low';
|
|
2126
2189
|
const who = recordOwner(f, recordsByUri) || f.owner?.name || f.mark; // doc-31 step 4: owner bound from the record
|
|
@@ -2144,7 +2207,7 @@ function findingCard(f, card, recordsByUri = new Map()) {
|
|
|
2144
2207
|
<label class="pick no-print"><input type="checkbox" class="pickbox" checked aria-label="${escAttr(R.card.includeInPdf(f.ordinal))}"></label>
|
|
2145
2208
|
<span class="fnum">${esc(f.ordinal)}</span>${cardTitleParts(f, who).title}${evidenceChips(f)}
|
|
2146
2209
|
<span class="tier ${tierCls}">${riskChip(f)}</span>
|
|
2147
|
-
<button class="ask-fi no-print">${R.card.askAi}</button>
|
|
2210
|
+
<span class="fi-acts no-print">${copyLinkButton(R.card.copyLink, R.card.copied)}<button class="ask-fi no-print">${R.card.askAi}</button></span>
|
|
2148
2211
|
</div>
|
|
2149
2212
|
${cardTitleParts(f, who).ownerLine}${logoLine(f, recordsByUri)}
|
|
2150
2213
|
<div class="oneline">${inline(sentenceCaseLead(one))}</div>
|
|
@@ -2166,6 +2229,17 @@ function findingCard(f, card, recordsByUri = new Map()) {
|
|
|
2166
2229
|
// A single conflict below the risk folds too, under the singular, "1 more conflict rated Manageable" (owner,
|
|
2167
2230
|
// 2026-11-19). A conflict with no band on the ladder keeps its full card, since nothing says it is below the risk. A
|
|
2168
2231
|
// run with no framework renders every card in full, as it always has.
|
|
2232
|
+
//
|
|
2233
|
+
// ON PAPER THE HEADER COUNTS THE CARDS PRINTED UNDER IT. The export leaves out every unticked card, so with two of 28
|
|
2234
|
+
// ticked the paper read "28 more conflicts rated Manageable" over two cards. The header carries its own words for one
|
|
2235
|
+
// card and, after the number, for several, both composed here by the catalogue's function, and the export writes the
|
|
2236
|
+
// printed count into it; after printing the screen's words come back. No words are added.
|
|
2237
|
+
//
|
|
2238
|
+
// THE HEADER SAYS HOW MUCH IT HOLDS (owner, 2026-11-25): most of a report's conflicts can sit behind this one line, so
|
|
2239
|
+
// its right end carries a control, "Show all {n}" folded and "Hide" open, drawn as a card's Ask AI pill, and folded it
|
|
2240
|
+
// reads as a pile of cards. The control is words inside the summary, not a second button: the header stays one control
|
|
2241
|
+
// whose name is the title, the words are hidden from assistive technology, and the stylesheet alone swaps them on the
|
|
2242
|
+
// details' open state, so "Expand all" and a page with scripts off keep them right. Neither reaches paper.
|
|
2169
2243
|
function conflictCards(onField, cardFor, recordsByUri) {
|
|
2170
2244
|
const full = (list) => list.map((f) => findingCard(f, cardFor(f), recordsByUri)).join('\n ');
|
|
2171
2245
|
if (!FRAMEWORK) return full(onField);
|
|
@@ -2178,7 +2252,9 @@ function conflictCards(onField, cardFor, recordsByUri) {
|
|
|
2178
2252
|
const bands = [...new Set(below.map(severityRank))].sort((a, b) => a - b).map((i) => FRAMEWORK.bands[i].label);
|
|
2179
2253
|
const cards = below.map((f) => compactCard(f, cardFor(f), recordsByUri, { ticked: false })).join('\n ');
|
|
2180
2254
|
return `${full(kept)}
|
|
2181
|
-
<details class="rgroup lowerband"><summary><span class="gname"
|
|
2255
|
+
<details class="rgroup lowerband"><summary><span class="gname" data-print-one="${escAttr(R.lowerBand(1, bands))}" data-print-many="${
|
|
2256
|
+
escAttr(R.lowerBand(2, bands).slice((2).toLocaleString('en-GB').length))}">${esc(R.lowerBand(below.length, bands))}</span><span class="lb-show no-print" aria-hidden="true"><span class="lb-closed">${
|
|
2257
|
+
esc(R.lowerBandShow(below.length))}</span><span class="lb-open">${esc(R.lowerBandHide)}</span></span></summary><div class="gbody">
|
|
2182
2258
|
${cards}
|
|
2183
2259
|
</div></details>`;
|
|
2184
2260
|
}
|
|
@@ -2423,11 +2499,14 @@ const NAV_SHEET = NAV_CSS;
|
|
|
2423
2499
|
// own sheet, after the base sheet whose print rule opens every fold, which the Knockout keeps. The verdict caption is not a
|
|
2424
2500
|
// fold the reader chose: the page opens it before printing, and its label stays off the paper.
|
|
2425
2501
|
const CLEARANCE_PRINT = readFileSync(join(HERE, 'templates', 'clearance-print.css'), 'utf8');
|
|
2502
|
+
// EXPAND ALL MEANS EVERY FOLD. openAll named five kinds of fold and left six alone on the demo, the term lists and
|
|
2503
|
+
// translation notes inside the register records among them, so a search of the page missed them and the PDF printed
|
|
2504
|
+
// a header with nothing under it. It reads every fold on the page, so a kind added later cannot fall behind it.
|
|
2426
2505
|
const REP_OVERRIDE = '.rep-stickyhead .sitenav{position:static;box-shadow:none;border-bottom:none;background:transparent;-webkit-backdrop-filter:none;backdrop-filter:none}';
|
|
2427
2506
|
const PAGE_JS = `var _hidden=[];
|
|
2428
|
-
function exportPDF(){_hidden=[];document.querySelectorAll('.card').forEach(function(card){var cb=card.querySelector('input.pickbox');if(cb&&!cb.checked){card.classList.add('print-hidden');_hidden.push(card);}});document.querySelectorAll('details.lowerband').forEach(function(d){if(!d.querySelector('.card:not(.print-hidden)')){d.classList.add('print-hidden');_hidden.push(d);}});window.print();}
|
|
2507
|
+
function exportPDF(){_hidden=[];document.querySelectorAll('.card').forEach(function(card){var cb=card.querySelector('input.pickbox');if(cb&&!cb.checked){card.classList.add('print-hidden');_hidden.push(card);}});document.querySelectorAll('details.lowerband').forEach(function(d){if(!d.querySelector('.card:not(.print-hidden)')){d.classList.add('print-hidden');_hidden.push(d);}});document.querySelectorAll('details.lowerband:not(.print-hidden)>summary>.gname').forEach(function(g){var n=g.closest('details').querySelectorAll('.card:not(.print-hidden)').length;if(!g.dataset.printOne||!g.dataset.printMany)return;g.dataset.screen=g.textContent;g.textContent=n===1?g.dataset.printOne:n.toLocaleString('en-GB')+g.dataset.printMany;});window.print();}
|
|
2429
2508
|
function pickAll(v){document.querySelectorAll('input.pickbox').forEach(function(cb){cb.checked=v;});}
|
|
2430
|
-
function openAll(v){document.querySelectorAll('details
|
|
2509
|
+
function openAll(v){document.querySelectorAll('details').forEach(function(d){d.open=v;});}
|
|
2431
2510
|
// doc-55 A1: a rights-holder / marker / cross-link click targets a card by #c<ordinal>. When that card sits
|
|
2432
2511
|
// inside a collapsed <details> (a secondary region's .rgroup, a .rrow), a plain anchor jump lands wrong or
|
|
2433
2512
|
// nowhere. Open every <details> ancestor of the target FIRST, then land on the card top — scroll-margin-top
|
|
@@ -2438,8 +2517,66 @@ function _cardHashGo(){var id=location.hash.slice(1);if(id.charAt(0)!=='c'||!/^[
|
|
|
2438
2517
|
document.addEventListener('click',function(e){var a=e.target.closest?e.target.closest('a[href^="#c"]'):null;if(!a)return;var id=(a.getAttribute('href')||'').slice(1);if(id.charAt(0)!=='c'||!/^[0-9]+$/.test(id.slice(1)))return;var el=document.getElementById(id);if(!el)return;_cardReveal(el);e.preventDefault();try{if(history.replaceState)history.replaceState(null,'','#'+id);}catch(err){}el.scrollIntoView({behavior:(window.matchMedia&&matchMedia('(prefers-reduced-motion: reduce)').matches)?'auto':'smooth',block:'start'});});
|
|
2439
2518
|
window.addEventListener('hashchange',_cardHashGo);
|
|
2440
2519
|
window.addEventListener('load',_cardHashGo);
|
|
2520
|
+
(function(){var land=document.querySelector('.panel.land'),tip=land&&land.querySelector('.qtip');if(!tip)return;
|
|
2521
|
+
var links=[].slice.call(land.querySelectorAll('svg a[data-tip-n]')),cur=null,timer=null;
|
|
2522
|
+
links.forEach(function(a){var t=a.querySelector('title');if(t)a.removeChild(t);});
|
|
2523
|
+
function dot(a){var c=a.querySelectorAll('circle'),r=c[c.length-1].getBoundingClientRect();return {x:r.left+r.width/2,y:r.top+r.height/2,r:r.width/2};}
|
|
2524
|
+
function keyFocus(a){try{return a.matches(':focus-visible');}catch(e){return true;}}
|
|
2525
|
+
function place(a){var P=land.getBoundingClientRect(),d=dot(a),w=tip.offsetWidth,h=tip.offsetHeight,g=10,m=8,x=d.x-P.left,y=d.y-P.top;
|
|
2526
|
+
var cx=Math.min(Math.max(x-w/2,m),P.width-w-m),cy=Math.min(Math.max(y-h/2,m),P.height-h-m);
|
|
2527
|
+
var spots=[{l:x-d.r-g-w,t:cy},{l:x+d.r+g,t:cy},{l:cx,t:y-d.r-g-h},{l:cx,t:y+d.r+g}];
|
|
2528
|
+
var inside=spots.filter(function(p){return p.l>=m&&p.l+w<=P.width-m&&p.t>=m&&p.t+h<=P.height-m;});
|
|
2529
|
+
var others=links.filter(function(o){return o!==a;}).map(dot);
|
|
2530
|
+
function covered(p){return others.filter(function(o){var ox=o.x-P.left,oy=o.y-P.top;return ox+o.r>p.l&&ox-o.r<p.l+w&&oy+o.r>p.t&&oy-o.r<p.t+h;}).length;}
|
|
2531
|
+
var best=inside.length?inside.sort(function(p,q){return covered(p)-covered(q);})[0]:{l:cx,t:Math.min(y+d.r+g,P.height-h-m)};
|
|
2532
|
+
tip.style.left=Math.round(best.l)+'px';tip.style.top=Math.round(best.t)+'px';}
|
|
2533
|
+
function show(a){clearTimeout(timer);if(cur&&cur!==a)cur.classList.remove('qhot');cur=a;a.classList.add('qhot');
|
|
2534
|
+
var n=tip.querySelector('.qn'),b=tip.querySelector('.qb');n.textContent=a.getAttribute('data-tip-n');n.style.background=a.getAttribute('data-tip-fill');
|
|
2535
|
+
tip.querySelector('.qm').textContent=a.getAttribute('data-tip-mark');b.textContent=a.getAttribute('data-tip-band');b.className='qb '+a.getAttribute('data-tip-tone');
|
|
2536
|
+
tip.querySelector('.qs').textContent=a.getAttribute('data-tip-sub')||'';tip.hidden=false;place(a);}
|
|
2537
|
+
function hide(){clearTimeout(timer);tip.hidden=true;if(cur)cur.classList.remove('qhot');cur=null;}
|
|
2538
|
+
function soon(){clearTimeout(timer);timer=setTimeout(hide,200);}
|
|
2539
|
+
links.forEach(function(a){
|
|
2540
|
+
a.addEventListener('pointerenter',function(e){if(e.pointerType==='mouse')show(a);});
|
|
2541
|
+
a.addEventListener('pointerleave',function(e){if(e.pointerType==='mouse')soon();});
|
|
2542
|
+
a.addEventListener('focus',function(){if(keyFocus(a))show(a);});
|
|
2543
|
+
a.addEventListener('blur',function(){if(cur===a)hide();});});
|
|
2544
|
+
tip.addEventListener('pointerenter',function(){clearTimeout(timer);});
|
|
2545
|
+
tip.addEventListener('pointerleave',soon);
|
|
2546
|
+
document.addEventListener('keydown',function(e){if(e.key==='Escape'&&!tip.hidden){hide();e.preventDefault();}});
|
|
2547
|
+
window.addEventListener('beforeprint',hide);})();
|
|
2548
|
+
(function(){var wrap=document.querySelector('.wrap'),words=document.getElementById('cpanel-words');if(!wrap||!words)return;
|
|
2549
|
+
var root=document.documentElement,panel=null,opener=null,WIDE=500,NARROW=452,GW=30,GN=22,EDGE=16,MINCOL=600,FULL=parseFloat(getComputedStyle(wrap).maxWidth)||1120;
|
|
2550
|
+
function roomFor(){var vw=root.clientWidth;if(!root.classList.contains('rep-narrow')&&vw-wrap.getBoundingClientRect().right>=GW+WIDE+EDGE)return {mode:'wide',w:WIDE};
|
|
2551
|
+
var col=Math.min(vw-EDGE-GN-NARROW-EDGE,FULL);if(col<MINCOL)return null;return {mode:'narrow',col:col,w:Math.min(WIDE,vw-EDGE-col-GN-EDGE)};}
|
|
2552
|
+
function keepPlace(el,change){var before=el.getBoundingClientRect().top;change();var dy=Math.round(el.getBoundingClientRect().top-before);if(!dy)return;
|
|
2553
|
+
var ev=null;try{ev=new CustomEvent('rep-shift',{detail:{dy:dy},cancelable:true});}catch(e){}if(!ev||document.dispatchEvent(ev))window.scrollBy({top:dy,left:0,behavior:'instant'});}
|
|
2554
|
+
function reflowed(){try{document.dispatchEvent(new CustomEvent('rep-reflow'));}catch(e){}}
|
|
2555
|
+
function place(){if(!panel||!opener)return;var r=wrap.getBoundingClientRect(),blk=opener.closest('.panel')||opener.parentElement;
|
|
2556
|
+
panel.style.width=panel._w+'px';panel.style.left=Math.round(r.right+window.scrollX+(panel._mode==='wide'?GW:GN))+'px';
|
|
2557
|
+
panel.style.top=Math.round(blk.getBoundingClientRect().top+window.scrollY)+'px';}
|
|
2558
|
+
function fill(n){var card=document.getElementById('c'+n);if(!card)return false;var c=card.cloneNode(true);c.removeAttribute('id');c.setAttribute('data-card-of','c'+n);
|
|
2559
|
+
[].forEach.call(c.querySelectorAll('[id]'),function(e){e.removeAttribute('id');});[].forEach.call(c.querySelectorAll('label.pick'),function(e){e.parentNode.removeChild(e);});
|
|
2560
|
+
if(!c.querySelector('.copy-fi')&&words.content){var ask=c.querySelector('.ask-fi'),cp=words.content.querySelector('.copy-fi');if(ask&&cp)ask.parentNode.insertBefore(cp.cloneNode(true),ask);}
|
|
2561
|
+
var body=panel.querySelector('.cp-body');body.innerHTML='';body.appendChild(c);panel.setAttribute('aria-label',words.getAttribute('data-name').replace('{n}',n));return true;}
|
|
2562
|
+
function build(){panel=document.createElement('aside');panel.className='cpanel no-print';panel.tabIndex=-1;
|
|
2563
|
+
panel.innerHTML='<button type="button" class="cp-close"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" aria-hidden="true"><path d="M3.5 3.5l9 9M12.5 3.5l-9 9"/></svg></button><div class="cp-body"></div>';
|
|
2564
|
+
var x=panel.querySelector('.cp-close');x.setAttribute('aria-label',words.getAttribute('data-close'));x.addEventListener('click',shut);
|
|
2565
|
+
panel.addEventListener('click',function(e){var b=e.target.closest&&e.target.closest('.ask-fi'),of=b&&b.closest('[data-card-of]'),o=of&&document.getElementById(of.getAttribute('data-card-of')),ob=o&&o.querySelector('.ask-fi');if(!ob)return;e.stopPropagation();ob.click();},true);
|
|
2566
|
+
document.body.appendChild(panel);}
|
|
2567
|
+
function open(a,room){var n=(a.getAttribute('href')||'').slice(2);if(!document.getElementById('c'+n))return false;if(!panel)build();fill(n);
|
|
2568
|
+
if(opener&&opener!==a)opener.classList.remove('cite-on');opener=a;a.classList.add('cite-on');panel._mode=room.mode;panel._w=room.w;
|
|
2569
|
+
if(room.mode==='narrow'&&!root.classList.contains('rep-narrow'))keepPlace(a,function(){root.style.setProperty('--rep-col',room.col+'px');root.style.setProperty('--rep-left',EDGE+'px');root.classList.add('rep-narrow');});
|
|
2570
|
+
place();try{panel.focus({preventScroll:true});}catch(e){panel.focus();}reflowed();return true;}
|
|
2571
|
+
function shut(){if(!panel)return;var a=opener;panel.parentNode.removeChild(panel);panel=null;opener=null;
|
|
2572
|
+
if(root.classList.contains('rep-narrow'))keepPlace(a,function(){root.classList.remove('rep-narrow');root.style.removeProperty('--rep-col');root.style.removeProperty('--rep-left');});
|
|
2573
|
+
if(a){a.classList.remove('cite-on');try{a.focus({preventScroll:true});}catch(e){a.focus();}}reflowed();}
|
|
2574
|
+
document.addEventListener('click',function(e){var a=e.target.closest?e.target.closest('.fa-ords a[href^="#c"]'):null;if(!a)return;var room=roomFor();if(room&&open(a,room)){e.preventDefault();e.stopImmediatePropagation();}},true);
|
|
2575
|
+
document.addEventListener('keydown',function(e){if(e.key==='Escape'&&panel&&!e.defaultPrevented)shut();});
|
|
2576
|
+
window.addEventListener('resize',function(){if(!panel)return;var room=roomFor();if(!room||room.mode!==panel._mode){shut();return;}
|
|
2577
|
+
panel._w=room.w;if(room.mode==='narrow')keepPlace(opener,function(){root.style.setProperty('--rep-col',room.col+'px');});place();reflowed();});})();
|
|
2441
2578
|
window.addEventListener('beforeprint',function(){document.querySelectorAll('details').forEach(function(d){d.dataset.o=d.open?'1':'';});document.querySelectorAll('details.sub-more').forEach(function(d){d.open=true;});document.querySelectorAll('.card').forEach(function(c){var b=c.querySelector('input.pickbox');if(b&&!b.checked)return;c.querySelectorAll('details').forEach(function(d){d.open=true;});for(var p=c.parentElement;p;p=p.parentElement)if(p.tagName==='DETAILS')p.open=true;});});
|
|
2442
|
-
window.addEventListener('afterprint',function(){document.querySelectorAll('details').forEach(function(d){d.open=d.dataset.o==='1';});_hidden.forEach(function(c){c.classList.remove('print-hidden');});_hidden=[];});
|
|
2579
|
+
window.addEventListener('afterprint',function(){document.querySelectorAll('details').forEach(function(d){d.open=d.dataset.o==='1';});document.querySelectorAll('.gname[data-screen]').forEach(function(g){g.textContent=g.dataset.screen;delete g.dataset.screen;});_hidden.forEach(function(c){c.classList.remove('print-hidden');});_hidden=[];});
|
|
2443
2580
|
${EXPORT_MENU_JS}`;
|
|
2444
2581
|
|
|
2445
2582
|
// Render a parsed report + findings.json to a full self-contained HTML string.
|
|
@@ -2674,7 +2811,7 @@ const STRIP = Object.freeze([
|
|
|
2674
2811
|
// document does not hold is the page's surface: its two addresses, the confidentiality posture and the demo flag, which
|
|
2675
2812
|
// publish passes beside the document as it always has; and the two sets the document holds by reference, the saved
|
|
2676
2813
|
// records' bodies by uri and the saved logos' images by ref, which publish resolves from the run. PURE given its inputs.
|
|
2677
|
-
function clearanceContextOf(doc, { recordsByUri = new Map(), logos = new Map(), homeHref, chromeHref, delivery, demoData } = {}) {
|
|
2814
|
+
function clearanceContextOf(doc, { recordsByUri = new Map(), logos = new Map(), webPictures = new Map(), homeHref, chromeHref, delivery, demoData } = {}) {
|
|
2678
2815
|
const run = doc?.run ?? {}, scope = doc?.scope ?? {}, client = doc?.client ?? {}, verdict = doc?.verdict ?? {};
|
|
2679
2816
|
const framework = doc?.framework ?? {}, prose = doc?.prose ?? {};
|
|
2680
2817
|
const asMap = (pairs) => (Array.isArray(pairs) ? new Map(pairs) : null);
|
|
@@ -2688,7 +2825,7 @@ function clearanceContextOf(doc, { recordsByUri = new Map(), logos = new Map(),
|
|
|
2688
2825
|
enforcerSignals: client.enforcerSignals, recordOrigin: run.provider?.origin,
|
|
2689
2826
|
recordOrigins: run.provider?.origins, recordCitation: run.provider?.citation ?? null, recordLinks: asMap(client.recordLinks?.byUri),
|
|
2690
2827
|
providerLabel: run.provider?.label, seniorRights: client.seniorRights, findingsSchemaVersion: run.findingsVersion,
|
|
2691
|
-
searchDepth: scope.searchDepth, assessmentNotCompleted: verdict.assessmentNotCompleted, logos,
|
|
2828
|
+
searchDepth: scope.searchDepth, assessmentNotCompleted: verdict.assessmentNotCompleted, logos, webPictures,
|
|
2692
2829
|
followUpKinds: followUpKindsFrom(client.followUpKinds),
|
|
2693
2830
|
});
|
|
2694
2831
|
}
|
|
@@ -2701,6 +2838,7 @@ function clearanceContext(parsed, findings = [], coverage = [], opts = {}) {
|
|
|
2701
2838
|
FRAMEWORK_METHOD = opts.frameworkMethod ?? null;
|
|
2702
2839
|
AUDIT_HREF = hrefAttr(opts.auditFile, { relative: true }) || null;
|
|
2703
2840
|
LOGOS = opts.logos instanceof Map ? opts.logos : new Map();
|
|
2841
|
+
WEB_PICTURES = opts.webPictures instanceof Map ? opts.webPictures : new Map();
|
|
2704
2842
|
SEARCHED_JUR = Array.isArray(opts.searchedJurisdictions) && opts.searchedJurisdictions.length ? opts.searchedJurisdictions : null; // T6 (D4)
|
|
2705
2843
|
SCOPE_WORLDWIDE = opts.scopeBasis === 'worldwide' ? true : null; // the plan's scope_basis; null ⇒ fall back to the ledger-prose sniff
|
|
2706
2844
|
CASE_LAW_BY_ORD = opts.caseLawByOrdinal instanceof Map ? opts.caseLawByOrdinal : new Map(); // T7 (E5)
|
|
@@ -2833,7 +2971,7 @@ function clearanceContext(parsed, findings = [], coverage = [], opts = {}) {
|
|
|
2833
2971
|
let findingsSections, covNum;
|
|
2834
2972
|
if (!DISPOSITION_MODE) {
|
|
2835
2973
|
findingsSections = `${onField.length ? `<div class="sec" id="findings"><span class="num"></span><h2>${R.findings.landscape}</h2></div>
|
|
2836
|
-
<div class="landwrap">${quadrant(sorted)}${keyPanel(sorted, recordsByUri)}</div>
|
|
2974
|
+
<div class="landwrap">${quadrant(sorted, recordsByUri)}${keyPanel(sorted, recordsByUri)}</div>
|
|
2837
2975
|
|
|
2838
2976
|
<div class="sec" id="conflicts"><span class="num"></span><h2>${R.strip.conflicts}</h2></div>
|
|
2839
2977
|
${conflictCards(onField, cardFor, recordsByUri)}` : ''}
|
|
@@ -2848,7 +2986,7 @@ function clearanceContext(parsed, findings = [], coverage = [], opts = {}) {
|
|
|
2848
2986
|
const num = () => String(++secNum).padStart(2, '0');
|
|
2849
2987
|
const landscape = onField.length
|
|
2850
2988
|
? `<div class="sec" id="findings"><span class="num"></span><h2>${R.findings.landscape}</h2></div>
|
|
2851
|
-
<div class="landwrap">${quadrant(sorted)}${keyPanel(sorted, recordsByUri)}</div>
|
|
2989
|
+
<div class="landwrap">${quadrant(sorted, recordsByUri)}${keyPanel(sorted, recordsByUri)}</div>
|
|
2852
2990
|
|
|
2853
2991
|
<div class="sec" id="conflicts"><span class="num"></span><h2>${R.strip.conflicts}</h2></div>
|
|
2854
2992
|
${conflictCards(onField, cardFor, recordsByUri)}`
|
|
@@ -3043,7 +3181,10 @@ export const CLEARANCE_PAGE = Object.freeze({
|
|
|
3043
3181
|
return line;
|
|
3044
3182
|
})()}</span>
|
|
3045
3183
|
${logoLockup({ mark: 16 })}`,
|
|
3046
|
-
|
|
3184
|
+
// The conflict panel's words, read by the page script: its name, its close control's name, and the Copy link a compact
|
|
3185
|
+
// card gains in the panel.
|
|
3186
|
+
afterWrap: () => `\n<template id="cpanel-words" data-name="${escAttr(R.conflictPanel.name('{n}'))}" data-close="${escAttr(R.conflictPanel.close)}">${
|
|
3187
|
+
copyLinkButton(R.card.copyLink, R.card.copied)}</template>\n<script>${PAGE_JS}</script>`,
|
|
3047
3188
|
strip: STRIP,
|
|
3048
3189
|
});
|
|
3049
3190
|
|
|
@@ -65,6 +65,42 @@ export function groupForCleared({ screenVerdict, status } = {}) {
|
|
|
65
65
|
const field = (block, key) => (block.match(new RegExp(`^- ${key}:\\s*(.*)$`, "m")) || [])[1]?.trim() ?? "";
|
|
66
66
|
const noteField = (notes, key) => (notes.match(new RegExp(`${key}=([^;]+)`)) || [])[1]?.trim() ?? "";
|
|
67
67
|
|
|
68
|
+
// THE RUN'S OWN COMMON-LAW SEARCH RECORD, named where a web address would be. A row the assessing model backed with the
|
|
69
|
+
// run's own search ledger carries that file's name in its `url`; the page names it in words rather than linking it.
|
|
70
|
+
export const RUN_COMMON_LAW_RECORD = /^(?:\.\/)?(?:_driver\/)?common-law-grid(?:\.half-[a-z0-9]+)?\.json$/i;
|
|
71
|
+
|
|
72
|
+
// ── A WEB NAME'S ADDRESSES, READ OUT OF WHAT THE MODEL WROTE ───────────────────────────────────────
|
|
73
|
+
//
|
|
74
|
+
// The `url` field is model-written. Measured on the public demos, 2026-11-25: besides one address it held two
|
|
75
|
+
// addresses separated by a semicolon, whole Markdown links of the form `[label](address)` (one or several), and a
|
|
76
|
+
// sentence ("See cell-level receipts below"). The page printed each value as one link, so a Markdown link became a link
|
|
77
|
+
// to nowhere and a sentence became a link. Read here into the http(s) addresses it holds, in order and once each: a
|
|
78
|
+
// Markdown link gives its address, a bare address gives itself, and anything else gives nothing.
|
|
79
|
+
const MD_LINK_TARGET = /\[[^\]]*\]\(\s*(https?:\/\/[^\s)]+)\s*\)?/gi;
|
|
80
|
+
const BARE_ADDRESS = /https?:\/\/[^\s<>"'()[\]]+/gi;
|
|
81
|
+
|
|
82
|
+
/** The http(s) addresses one `url` value holds, in order and without repeats. PURE. */
|
|
83
|
+
export function webAddresses(value) {
|
|
84
|
+
const text = String(value ?? "");
|
|
85
|
+
const out = [];
|
|
86
|
+
const add = (u) => { const a = u.replace(/[.,;:]+$/, ""); if (a && !out.includes(a)) out.push(a); };
|
|
87
|
+
for (const m of text.matchAll(MD_LINK_TARGET)) add(m[1]);
|
|
88
|
+
for (const m of text.replace(MD_LINK_TARGET, " ").matchAll(BARE_ADDRESS)) add(m[0]);
|
|
89
|
+
return out;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* What a web name's `url` gives the page: its http(s) addresses (`links`), the run's own search record (`runRecord`), or
|
|
94
|
+
* one other reference without spaces (`ref`), printed as it stands. A sentence gives nothing: the block is a note. PURE.
|
|
95
|
+
*/
|
|
96
|
+
export function webNameRow(url) {
|
|
97
|
+
const value = String(url ?? "").trim();
|
|
98
|
+
if (RUN_COMMON_LAW_RECORD.test(value)) return { links: [], runRecord: true, ref: null };
|
|
99
|
+
const links = webAddresses(value);
|
|
100
|
+
if (links.length) return { links, runRecord: false, ref: null };
|
|
101
|
+
return value && /^\S+$/.test(value) ? { links: [], runRecord: false, ref: value } : null;
|
|
102
|
+
}
|
|
103
|
+
|
|
68
104
|
/**
|
|
69
105
|
* Every near-name the run read and cleared, register and web, as facts. PURE.
|
|
70
106
|
*
|
|
@@ -118,8 +154,16 @@ export function clearedNames(auditMd, recordIndex = {}) {
|
|
|
118
154
|
// WHAT IT COSTS, stated rather than hidden: a marketplace name sighted with no URL recorded would
|
|
119
155
|
// not be listed here. None exists in any demo, and the row such a block produced was already a
|
|
120
156
|
// name beside an empty column. If one appears, the fix is to record where it was seen.
|
|
157
|
+
//
|
|
158
|
+
// A `url` THAT IS A SENTENCE NAMES NO PLACE, and the block is a note, not a name. Measured on the public Global
|
|
159
|
+
// preliminary demo, 2026-11-25: "No confirmed directly conflicting app or course identified." with the `url`
|
|
160
|
+
// "See cell-level receipts below" was listed as a name, counted in the header, and printed with that sentence as
|
|
161
|
+
// its link. A block counts as a name when its `url` gives at least one http(s) address, names the run's own search
|
|
162
|
+
// record (which the page names in words), or is one other reference, such as a record file, which the page prints
|
|
163
|
+
// as it stands and does not link. `links` is what the page links; `url` stays as written.
|
|
121
164
|
const url = field(block, "url");
|
|
122
|
-
|
|
165
|
+
const row = webNameRow(url);
|
|
166
|
+
if (row) out.web.push({ title, url, ...row, type: field(block, "type") });
|
|
123
167
|
}
|
|
124
168
|
}
|
|
125
169
|
return out;
|
|
@@ -339,7 +339,16 @@ export const RECORD_LINKS = Object.freeze({
|
|
|
339
339
|
});
|
|
340
340
|
|
|
341
341
|
/** The Knockout report page: its own words, section by section. A value a sentence carries arrives formatted. */
|
|
342
|
+
// A card's picture line (owner, 2026-11-25), one set of words for both report pages: each set of pictures sits in a
|
|
343
|
+
// frame of its own under its label.
|
|
344
|
+
const PICTURES = Object.freeze({
|
|
345
|
+
register: 'Register',
|
|
346
|
+
onTheWeb: 'On the web',
|
|
347
|
+
webAlt: (mark, site, date) => `${mark}, picture shown by ${site}, fetched ${date}`,
|
|
348
|
+
});
|
|
349
|
+
|
|
342
350
|
export const KNOCKOUT_PAGE = Object.freeze({
|
|
351
|
+
pictures: PICTURES,
|
|
343
352
|
// The jump strip, in its order.
|
|
344
353
|
strip: Object.freeze({ summary: 'Summary', findings: 'Findings', filings: 'Also considered', next: 'Next steps' }),
|
|
345
354
|
degradedNote: 'Automated research for this name was unavailable — manual verification is recommended before relying on this rating.',
|
|
@@ -404,6 +413,9 @@ export const KNOCKOUT_PAGE = Object.freeze({
|
|
|
404
413
|
finding: Object.freeze({
|
|
405
414
|
unnamed: 'Unnamed finding',
|
|
406
415
|
askAi: '\u2726 Ask AI about this finding',
|
|
416
|
+
// Inside the portal only (owner, 2026-11-25): a link to this card, and the word a screen reader hears once it is copied.
|
|
417
|
+
copyLink: 'Copy link',
|
|
418
|
+
copied: 'Copied',
|
|
407
419
|
fullDetail: 'Full detail',
|
|
408
420
|
sources: 'Sources: ',
|
|
409
421
|
}),
|
|
@@ -648,6 +660,14 @@ export const REPORT_PAGE = Object.freeze({
|
|
|
648
660
|
// The closed heading over the conflicts below the risk (2026-11-18; the singular form 2026-11-19): their count, and
|
|
649
661
|
// each band below the risk by the framework's own word, joined by "or". One conflict reads in the singular.
|
|
650
662
|
lowerBand: (count, bands) => `${count.toLocaleString('en-GB')} more conflict${count === 1 ? '' : 's'} rated ${bands.join(' or ')}`,
|
|
663
|
+
// The folded list's control, on screen only (owner, 2026-11-25): "Show all {n}" while folded, "Show" where the list holds
|
|
664
|
+
// one conflict, and "Hide" while open. {n} is the number the title opens with.
|
|
665
|
+
lowerBandShow: (count) => (count === 1 ? 'Show' : `Show all ${count.toLocaleString('en-GB')}`),
|
|
666
|
+
lowerBandHide: 'Hide',
|
|
667
|
+
// A conflict card's picture line (owner, 2026-11-25): each set of pictures sits in a frame of its own under its label.
|
|
668
|
+
pictures: PICTURES,
|
|
669
|
+
// The conflict panel (owner, 2026-11-25): its name for a screen reader, and the name of the control that shuts it.
|
|
670
|
+
conflictPanel: Object.freeze({ name: (n) => `Conflict ${n}`, close: 'Close' }),
|
|
651
671
|
// The chart of conflicts: its axes, its zone and its legend.
|
|
652
672
|
chart: Object.freeze({
|
|
653
673
|
goodsAxis: 'Goods / services proximity →',
|
|
@@ -686,6 +706,9 @@ export const REPORT_PAGE = Object.freeze({
|
|
|
686
706
|
theRead: 'The read',
|
|
687
707
|
includeInPdf: (n) => `Include conflict ${n} in the PDF`,
|
|
688
708
|
askAi: '\u2726 Ask AI about this finding',
|
|
709
|
+
// Inside the portal only (owner, 2026-11-25): a link to this card, and the word a screen reader hears once it is copied.
|
|
710
|
+
copyLink: 'Copy link',
|
|
711
|
+
copied: 'Copied',
|
|
689
712
|
}),
|
|
690
713
|
// The mark itself: what the mark is, before any conflict.
|
|
691
714
|
markItself: Object.freeze({
|