@domandigital/craft 0.12.0 → 0.14.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/dist/index.js CHANGED
@@ -2250,14 +2250,14 @@ function contractionHits(ctx) {
2250
2250
  for (const doc2 of documents(ctx)) {
2251
2251
  if (doc2.words < 800) continue;
2252
2252
  const text = doc2.blocks.map((b) => withoutHeadings(b.text)).join("\n");
2253
- const count2 = (text.match(CONTRACTION) ?? []).length;
2254
- const rate = count2 * 1e3 / doc2.words;
2253
+ const count4 = (text.match(CONTRACTION) ?? []).length;
2254
+ const rate = count4 * 1e3 / doc2.words;
2255
2255
  if (rate < 1) {
2256
2256
  const first = sentences(doc2)[0];
2257
2257
  hits.push({
2258
2258
  path: doc2.path,
2259
2259
  offset: first?.offset ?? 0,
2260
- message: `${count2} contraction${count2 === 1 ? "" : "s"} in ${thousands(doc2.words)} words. Prose with none reads stiff; formal legal pages are the exception`
2260
+ message: `${count4} contraction${count4 === 1 ? "" : "s"} in ${thousands(doc2.words)} words. Prose with none reads stiff; formal legal pages are the exception`
2261
2261
  });
2262
2262
  }
2263
2263
  }
@@ -2380,16 +2380,16 @@ function filler(words2, seed = 1, options = {}) {
2380
2380
  return state % n;
2381
2381
  };
2382
2382
  const out = [];
2383
- let count2 = 0;
2383
+ let count4 = 0;
2384
2384
  let i = 0;
2385
- while (count2 < words2) {
2385
+ while (count4 < words2) {
2386
2386
  const length = uniform ?? shape[i % shape.length];
2387
2387
  const s = [];
2388
2388
  for (let w = 0; w < length; w += 1) s.push(FILLER_WORDS[next(FILLER_WORDS.length)]);
2389
2389
  if (contractions && i % 6 === 2) s.splice(1, 0, "we're");
2390
2390
  s[0] = s[0].charAt(0).toUpperCase() + s[0].slice(1);
2391
2391
  out.push(`${s.join(" ")}.`);
2392
- count2 += s.length;
2392
+ count4 += s.length;
2393
2393
  i += 1;
2394
2394
  }
2395
2395
  const paragraphs = [];
@@ -3529,64 +3529,76 @@ export function IntroCinematic() { return <AnimatePresence /> }`),
3529
3529
  }
3530
3530
  ];
3531
3531
 
3532
- // src/character/house.ts
3533
- var HOUSE = {
3534
- "em-dash": { tier: "block", label: "em dash, use a full stop or a comma" },
3535
- emoji: { tier: "block", label: "emoji" },
3536
- "not-just-but": { tier: "block", label: "contrastive negation. The template is the tell, not the sentiment. Say the positive claim" },
3537
- "no-x-no-y": {
3538
- tier: "block",
3539
- label: '"No X, no Y" list. Defining the brand by what it is not, itemised, is the same template as contrastive negation'
3540
- },
3541
- "no-x-badge": { tier: "block", label: 'standalone "No X" badge. Reads as a slapped-on kicker, and worse when reused across pieces' },
3542
- "ai-phrase": { tier: "block", label: "AI tell" },
3543
- "plainer-word": { tier: "block", label: "a plainer word exists. Name the mechanism instead" },
3544
- "plain-english": { tier: "block", label: 'use "properly explained"' },
3545
- buzzword: { tier: "block", label: "forbidden phrase" },
3546
- "negative-reassurance": { tier: "block", label: "negative reassurance, say what they get" },
3547
- // Evidence of a pasted chat reply, not a matter of style. Moved from review
3548
- // on 2026-09-24 after its estate hits were read (ROADMAP.md): 15 of 15 real.
3549
- "chatbot-residue": { tier: "block", label: "chatbot residue. A chat reply was pasted in: remove it, and source or cut the claim it backed" },
3550
- "review-phrase": { tier: "review", label: "review tier" },
3551
- "ai-vocabulary": { tier: "review", label: "AI vocabulary" },
3552
- "stock-phrase": { tier: "review", label: "stock phrase" },
3553
- "hollow-imperative": { tier: "review", label: "hollow imperative" },
3554
- "rhetorical-opener": { tier: "review", label: "rhetorical question opener" },
3555
- "staccato-triplet": { tier: "review", label: "staccato triplet" },
3556
- "where-x-meets-y": { tier: "review", label: "'where X meets Y'" },
3557
- "ing-tail": { tier: "review", label: "empty -ing tail" },
3558
- "vague-attribution": { tier: "review", label: "unnamed source" },
3559
- "closing-summary": { tier: "review", label: "closing summary" },
3560
- "false-range": { tier: "review", label: "false range" },
3561
- "placeholder": { tier: "review", label: "unfilled placeholder" },
3562
- // Every estate hit so far is real (38 in five DD articles, 2026-09-24), but
3563
- // a proposal can honestly say "the attached research". Review until measured there.
3564
- "prompt-context": { tier: "review", label: "prompt context: the model naming its own inputs" },
3565
- "question-reveal": { tier: "review", label: "staged reveal" },
3566
- "inline-label-list": { tier: "review", label: "bold-label bullets" },
3567
- "phrase-density": { tier: "review", label: "density" },
3568
- "aphorism-density": { tier: "review", label: "density" },
3569
- "contraction-scarcity": { tier: "review", label: "density" },
3570
- "sentence-rhythm": { tier: "review", label: "density" },
3571
- "repeated-sentence": { tier: "review", label: "repetition" },
3572
- "heading-shape": { tier: "review", label: "headings" },
3573
- "heading-echo": { tier: "review", label: "headings" },
3574
- // Banned only "when vague", per the rules. Too noisy for a sweep.
3575
- "vague-word": { tier: "explicit", label: "vague" }
3576
- };
3577
- function houseRule(id, name = id) {
3578
- return HOUSE[id] ?? { tier: "review", label: name };
3579
- }
3580
- var HOUSE_LOCKED = "the house blocking tier cannot be lowered by a repo. A genuine one-off takes copy-ok on its line; a rule that is wrong is changed in craft's house.ts and COPY.md";
3581
- function holdHouseBlocks(exceptions, severity) {
3582
- const blocks = (tell) => HOUSE[tell]?.tier === "block";
3583
- const refusedSeverity = Object.entries(severity).filter(([tell, o]) => blocks(tell) && o.level !== "block").map(([tell]) => tell);
3584
- return {
3585
- exceptions: exceptions.filter((e) => !blocks(e.tell)),
3586
- refused: exceptions.filter((e) => blocks(e.tell)),
3587
- severity: Object.fromEntries(Object.entries(severity).filter(([tell]) => !refusedSeverity.includes(tell))),
3588
- refusedSeverity
3532
+ // src/snapshot/types.ts
3533
+ var SNAPSHOT_VERSION = 2;
3534
+
3535
+ // src/snapshot/fixture.ts
3536
+ function makeSnapshot(patch = {}) {
3537
+ const base = {
3538
+ version: SNAPSHOT_VERSION,
3539
+ url: "https://example.test/",
3540
+ capturedAt: "2026-09-23T00:00:00.000Z",
3541
+ viewport: { width: 1440, height: 900 },
3542
+ pageHeight: 4200,
3543
+ ground: "rgb(255, 255, 255)",
3544
+ colours: {
3545
+ backgrounds: [
3546
+ { value: "rgb(255, 255, 255)", area: 6e6, chars: 0 },
3547
+ { value: "rgb(31, 58, 46)", area: 9e4, chars: 0 }
3548
+ ],
3549
+ text: [
3550
+ { value: "rgb(28, 28, 26)", area: 0, chars: 5200 },
3551
+ { value: "rgb(31, 58, 46)", area: 0, chars: 300 }
3552
+ ]
3553
+ },
3554
+ fonts: [
3555
+ { family: "S\xF6hne", chars: 4200, displayChars: 0, italicChars: 0, weights: [400, 500] },
3556
+ { family: "Tiempos Headline", chars: 900, displayChars: 900, italicChars: 0, weights: [500] }
3557
+ ],
3558
+ headings: [
3559
+ { level: 1, family: "Tiempos Headline", sizePx: 64, weight: 500, italic: false, italicPart: false, text: "Boilers fixed the same day in Brackley", top: 180 },
3560
+ { level: 2, family: "Tiempos Headline", sizePx: 36, weight: 500, italic: false, italicPart: false, text: "What we fix", top: 1100 }
3561
+ ],
3562
+ controls: [
3563
+ { kind: "button", radiusPx: 4, heightPx: 44, background: "rgb(31, 58, 46)", text: "Book a visit" },
3564
+ { kind: "link", radiusPx: 4, heightPx: 44, background: "rgb(255, 255, 255)", text: "Call 01280 000000" },
3565
+ { kind: "button", radiusPx: 4, heightPx: 40, background: "rgb(31, 58, 46)", text: "Send" },
3566
+ { kind: "link", radiusPx: 4, heightPx: 40, background: "rgb(31, 58, 46)", text: "See prices" }
3567
+ ],
3568
+ sections: [
3569
+ { top: 0, height: 800, kind: "hero", label: "Boilers fixed the same day in Brackley", cards: 0, iconCards: 0, hiddenAtLoad: false },
3570
+ { top: 800, height: 900, kind: "text", label: "What we fix", cards: 0, iconCards: 0, hiddenAtLoad: false },
3571
+ { top: 1700, height: 900, kind: "cards", label: "Recent jobs", cards: 3, iconCards: 0, hiddenAtLoad: false },
3572
+ { top: 2600, height: 700, kind: "text", label: "Prices", cards: 0, iconCards: 0, hiddenAtLoad: false },
3573
+ { top: 3300, height: 900, kind: "text", label: "Contact", cards: 0, iconCards: 0, hiddenAtLoad: false }
3574
+ ],
3575
+ effects: {
3576
+ glass: 0,
3577
+ gradientText: 0,
3578
+ gradients: [],
3579
+ glows: 0,
3580
+ gridBackgrounds: 0,
3581
+ marquees: 0,
3582
+ hairlineShadowCards: 0,
3583
+ eyebrowChip: false
3584
+ },
3585
+ motion: { hiddenSections: 0, sections: 5, animations: 0, introOverlay: false },
3586
+ metrics: {
3587
+ fontSizes: [14, 16, 20, 36, 64],
3588
+ fontWeights: [400, 500],
3589
+ radii: ["4px"],
3590
+ shadows: [],
3591
+ spacingOnScalePct: 96,
3592
+ bodyLineLengthCh: 68,
3593
+ bodyFontSizePx: 17
3594
+ }
3589
3595
  };
3596
+ const out = { ...base };
3597
+ for (const [key, value] of Object.entries(patch)) {
3598
+ const current = base[key];
3599
+ out[key] = value && typeof value === "object" && !Array.isArray(value) && current && typeof current === "object" && !Array.isArray(current) ? { ...current, ...value } : value;
3600
+ }
3601
+ return out;
3590
3602
  }
3591
3603
 
3592
3604
  // src/character/parse.ts
@@ -3920,90 +3932,678 @@ function extractStrings(file) {
3920
3932
  return [];
3921
3933
  }
3922
3934
 
3923
- // src/snapshot/types.ts
3924
- var SNAPSHOT_VERSION = 2;
3925
-
3926
- // src/snapshot/fixture.ts
3927
- function makeSnapshot(patch = {}) {
3928
- const base = {
3929
- version: SNAPSHOT_VERSION,
3930
- url: "https://example.test/",
3931
- capturedAt: "2026-09-23T00:00:00.000Z",
3932
- viewport: { width: 1440, height: 900 },
3933
- pageHeight: 4200,
3934
- ground: "rgb(255, 255, 255)",
3935
- colours: {
3936
- backgrounds: [
3937
- { value: "rgb(255, 255, 255)", area: 6e6, chars: 0 },
3938
- { value: "rgb(31, 58, 46)", area: 9e4, chars: 0 }
3939
- ],
3940
- text: [
3941
- { value: "rgb(28, 28, 26)", area: 0, chars: 5200 },
3942
- { value: "rgb(31, 58, 46)", area: 0, chars: 300 }
3943
- ]
3944
- },
3945
- fonts: [
3946
- { family: "S\xF6hne", chars: 4200, displayChars: 0, italicChars: 0, weights: [400, 500] },
3947
- { family: "Tiempos Headline", chars: 900, displayChars: 900, italicChars: 0, weights: [500] }
3948
- ],
3949
- headings: [
3950
- { level: 1, family: "Tiempos Headline", sizePx: 64, weight: 500, italic: false, italicPart: false, text: "Boilers fixed the same day in Brackley", top: 180 },
3951
- { level: 2, family: "Tiempos Headline", sizePx: 36, weight: 500, italic: false, italicPart: false, text: "What we fix", top: 1100 }
3952
- ],
3953
- controls: [
3954
- { kind: "button", radiusPx: 4, heightPx: 44, background: "rgb(31, 58, 46)", text: "Book a visit" },
3955
- { kind: "link", radiusPx: 4, heightPx: 44, background: "rgb(255, 255, 255)", text: "Call 01280 000000" },
3956
- { kind: "button", radiusPx: 4, heightPx: 40, background: "rgb(31, 58, 46)", text: "Send" },
3957
- { kind: "link", radiusPx: 4, heightPx: 40, background: "rgb(31, 58, 46)", text: "See prices" }
3958
- ],
3959
- sections: [
3960
- { top: 0, height: 800, kind: "hero", label: "Boilers fixed the same day in Brackley", cards: 0, iconCards: 0, hiddenAtLoad: false },
3961
- { top: 800, height: 900, kind: "text", label: "What we fix", cards: 0, iconCards: 0, hiddenAtLoad: false },
3962
- { top: 1700, height: 900, kind: "cards", label: "Recent jobs", cards: 3, iconCards: 0, hiddenAtLoad: false },
3963
- { top: 2600, height: 700, kind: "text", label: "Prices", cards: 0, iconCards: 0, hiddenAtLoad: false },
3964
- { top: 3300, height: 900, kind: "text", label: "Contact", cards: 0, iconCards: 0, hiddenAtLoad: false }
3965
- ],
3966
- effects: {
3967
- glass: 0,
3968
- gradientText: 0,
3969
- gradients: [],
3970
- glows: 0,
3971
- gridBackgrounds: 0,
3972
- marquees: 0,
3973
- hairlineShadowCards: 0,
3974
- eyebrowChip: false
3975
- },
3976
- motion: { hiddenSections: 0, sections: 5, animations: 0, introOverlay: false },
3977
- metrics: {
3978
- fontSizes: [14, 16, 20, 36, 64],
3979
- fontWeights: [400, 500],
3980
- radii: ["4px"],
3981
- shadows: [],
3982
- spacingOnScalePct: 96,
3983
- bodyLineLengthCh: 68,
3984
- bodyFontSizePx: 17
3985
- }
3935
+ // src/character/facts.ts
3936
+ var MONTH = "(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:t(?:ember)?)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)";
3937
+ var PATTERNS = [
3938
+ ["url", /\bhttps?:\/\/[^\s<>"'`)\]]+|\bwww\.[^\s<>"'`)\]]+/gi],
3939
+ ["email", /\b[\w.+-]+@[\w-]+(?:\.[\w-]+)+\b/g],
3940
+ ["phone", /(?:\+44\s?\(?0?\)?\s?|\b0)\d(?:[\s-]?\d){8,9}\b/g],
3941
+ ["postcode", /\b[A-Z]{1,2}\d[A-Z\d]?\s?\d[A-Z]{2}\b/g],
3942
+ ["money", /[£$€]\s?\d[\d,]*(?:\.\d{1,2})?(?:\s?(?:k|m|bn)\b)?|\b\d[\d,]*(?:\.\d{1,2})?\s?(?:pounds|GBP)\b/gi],
3943
+ ["date", new RegExp(`\\b\\d{1,2}(?:st|nd|rd|th)?\\s+${MONTH}\\b(?:\\s+\\d{4})?|\\b${MONTH}\\s+\\d{1,2}(?:st|nd|rd|th)?\\b(?:,?\\s+\\d{4})?|\\b${MONTH}\\s+\\d{4}\\b|\\b\\d{1,2}\\/\\d{1,2}\\/\\d{2,4}\\b|\\b(?:19|20)\\d{2}\\b`, "g")],
3944
+ ["time", /\b\d{1,2}(?:[:.]\d{2})?\s?(?:am|pm)\b|\b\d{1,2}:\d{2}\b/gi],
3945
+ ["number", /\b\d[\d,]*(?:\.\d+)?%?|\b\d+(?:\.\d+)?\s?(?:per ?cent)\b/gi]
3946
+ ];
3947
+ var NAME = /[A-Z][a-zA-Z’'&-]*[a-zA-Z](?:\s+(?:of|and|&|the)?\s*[A-Z][a-zA-Z’'&-]*[a-zA-Z])*/g;
3948
+ var normalise = (kind, value) => {
3949
+ const v = value.trim();
3950
+ if (kind === "phone") return v.replace(/[^\d+]/g, "").replace(/^\+44\(?0?\)?/, "0").replace(/^\+44/, "0");
3951
+ if (kind === "money" || kind === "number") return v.replace(/[\s,]/g, "").toLowerCase();
3952
+ if (kind === "postcode") return v.replace(/\s/g, "").toUpperCase();
3953
+ if (kind === "url") return v.replace(/[.,;:]+$/, "").toLowerCase();
3954
+ return v.replace(/\s+/g, " ").toLowerCase();
3955
+ };
3956
+ function visibleText(file) {
3957
+ const prose = /\.(md|markdown|mdx|txt)$/i.test(file.path);
3958
+ return (prose ? extractCopy(file) : extractStrings(file)).map((b) => b.text).join("\n");
3959
+ }
3960
+ function protectedFacts(text) {
3961
+ const facts = [];
3962
+ let rest = text;
3963
+ const mask = (start, length) => {
3964
+ rest = rest.slice(0, start) + " ".repeat(length) + rest.slice(start + length);
3986
3965
  };
3987
- const out = { ...base };
3988
- for (const [key, value] of Object.entries(patch)) {
3989
- const current = base[key];
3990
- out[key] = value && typeof value === "object" && !Array.isArray(value) && current && typeof current === "object" && !Array.isArray(current) ? { ...current, ...value } : value;
3966
+ for (const [kind, pattern] of PATTERNS) {
3967
+ for (const m of [...rest.matchAll(pattern)]) {
3968
+ const value = m[0].replace(/[.,;:]+$/, "");
3969
+ facts.push({ kind, value, key: `${kind}:${normalise(kind, value)}` });
3970
+ mask(m.index ?? 0, m[0].length);
3971
+ }
3991
3972
  }
3992
- return out;
3993
- }
3994
-
3995
- // src/snapshot/fonts.ts
3996
- var SYSTEM = /^(?:system-ui|-apple-system|BlinkMacSystemFont|ui-sans-serif|ui-serif|ui-monospace|ui-rounded|sans-serif|serif|monospace|cursive)$/i;
3997
- function normaliseFamily(raw) {
3998
- let name = raw.replace(/["']/g, "").trim();
3999
- const next = name.match(/^__(.+?)(?:_Fallback)?_[0-9a-f]{5,8}$/i);
4000
- if (next) name = next[1].replace(/_/g, " ");
4001
- name = name.replace(/\s+Fallback$/i, "").replace(/\s+Variable$/i, "");
4002
- if (SYSTEM.test(name)) return "system-ui";
4003
- if (!/\s/.test(name) && (/[a-z][A-Z]/.test(name) || /^[a-z]+(?:-[a-z]+)+$/.test(name))) {
4004
- name = name.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/-/g, " ").replace(/\b([a-z])/g, (c) => c.toUpperCase()).replace(/\bDm\b/, "DM");
3973
+ const lines = rest.split("\n");
3974
+ for (const line of lines) {
3975
+ if (/^\s{0,3}#{1,6}\s/.test(line)) continue;
3976
+ for (const m of line.matchAll(NAME)) {
3977
+ const at = m.index ?? 0;
3978
+ const before = line.slice(0, at).trimEnd();
3979
+ const opensSentence = before === "" || /[.!?:"“(>*-]$/.test(before) || /^\s*(?:[-*+]|\d+\.)$/.test(before);
3980
+ const word = m[0];
3981
+ const acronym = /^[A-Z]{2,}$/.test(word);
3982
+ if (opensSentence && !acronym && !/\s/.test(word)) continue;
3983
+ if (word === "I") continue;
3984
+ facts.push({ kind: "name", value: word, key: `name:${normalise("name", word)}` });
3985
+ }
4005
3986
  }
4006
- return name;
3987
+ return facts;
3988
+ }
3989
+ var unique = (facts) => [...new Map(facts.map((f4) => [f4.key, f4])).values()];
3990
+ function compareFacts(before, after) {
3991
+ const a = unique(protectedFacts(before));
3992
+ const b = unique(protectedFacts(after));
3993
+ const inA = new Set(a.map((f4) => f4.key));
3994
+ const inB = new Set(b.map((f4) => f4.key));
3995
+ return {
3996
+ before: a.length,
3997
+ after: b.length,
3998
+ lost: a.filter((f4) => !inB.has(f4.key)),
3999
+ added: b.filter((f4) => !inA.has(f4.key))
4000
+ };
4001
+ }
4002
+ function formatComparison(result, beforePath, afterPath) {
4003
+ const lines = [`craft copy compare: ${beforePath} -> ${afterPath}`, ` ${result.before} protected facts before, ${result.after} after`];
4004
+ if (result.lost.length) {
4005
+ lines.push("", ` Lost (${result.lost.length}): restore each, or say why it went`);
4006
+ for (const f4 of result.lost) lines.push(` ${f4.kind.padEnd(9)} ${f4.value}`);
4007
+ }
4008
+ if (result.added.length) {
4009
+ lines.push("", ` Added (${result.added.length}): each needs a source, or it is invented`);
4010
+ for (const f4 of result.added) lines.push(` ${f4.kind.padEnd(9)} ${f4.value}`);
4011
+ }
4012
+ if (!result.lost.length && !result.added.length) lines.push("", " Every fact kept, nothing added.");
4013
+ return lines.join("\n");
4014
+ }
4015
+
4016
+ // src/character/specificity.ts
4017
+ var TRADE_NOUNS = [
4018
+ // heating, plumbing, electrical
4019
+ "boiler",
4020
+ "radiator",
4021
+ "combi",
4022
+ "cylinder",
4023
+ "thermostat",
4024
+ "underfloor heating",
4025
+ "heat pump",
4026
+ "solar panel",
4027
+ "plumbing",
4028
+ "plumber",
4029
+ "leak",
4030
+ "toilet",
4031
+ "shower",
4032
+ "bathroom",
4033
+ "wet room",
4034
+ "drain",
4035
+ "fuse board",
4036
+ "fuseboard",
4037
+ "consumer unit",
4038
+ "rewire",
4039
+ "socket",
4040
+ "ev charger",
4041
+ "electrician",
4042
+ "gas engineer",
4043
+ "power flush",
4044
+ "landlord certificate",
4045
+ "eicr",
4046
+ // building and outside
4047
+ "extension",
4048
+ "loft conversion",
4049
+ "loft",
4050
+ "kitchen",
4051
+ "roof",
4052
+ "roofer",
4053
+ "gutter",
4054
+ "chimney",
4055
+ "driveway",
4056
+ "patio",
4057
+ "fence",
4058
+ "fencing",
4059
+ "decking",
4060
+ "window",
4061
+ "conservatory",
4062
+ "plastering",
4063
+ "plasterer",
4064
+ "render",
4065
+ "brickwork",
4066
+ "bricklayer",
4067
+ "tiling",
4068
+ "tiler",
4069
+ "flooring",
4070
+ "carpet",
4071
+ "joinery",
4072
+ "joiner",
4073
+ "carpenter",
4074
+ "staircase",
4075
+ "damp",
4076
+ "scaffolding",
4077
+ "garage conversion",
4078
+ "lawn",
4079
+ "hedge",
4080
+ "tree surgery",
4081
+ "stump",
4082
+ "landscaping",
4083
+ "gardener",
4084
+ "gate",
4085
+ "locksmith",
4086
+ "pest control",
4087
+ "wasp",
4088
+ "cleaning",
4089
+ "oven",
4090
+ "end of tenancy",
4091
+ // vehicles
4092
+ "mot",
4093
+ "tyre",
4094
+ "brake",
4095
+ "clutch",
4096
+ "cambelt",
4097
+ "exhaust",
4098
+ "gearbox",
4099
+ "valeting",
4100
+ // personal and health
4101
+ "haircut",
4102
+ "skin fade",
4103
+ "beard",
4104
+ "barber",
4105
+ "balayage",
4106
+ "nails",
4107
+ "lashes",
4108
+ "massage",
4109
+ "physio",
4110
+ "physiotherapy",
4111
+ "osteopath",
4112
+ "chiropractor",
4113
+ "dentist",
4114
+ "dental",
4115
+ "implant",
4116
+ "brace",
4117
+ "invisalign",
4118
+ "hygienist",
4119
+ "optician",
4120
+ "eye test",
4121
+ "vet",
4122
+ "grooming",
4123
+ "dog walking",
4124
+ "personal trainer",
4125
+ "yoga",
4126
+ "pilates",
4127
+ // professional
4128
+ "accountant",
4129
+ "tax return",
4130
+ "bookkeeping",
4131
+ "payroll",
4132
+ "vat",
4133
+ "self assessment",
4134
+ "solicitor",
4135
+ "conveyancing",
4136
+ "probate",
4137
+ "divorce",
4138
+ "lasting power of attorney",
4139
+ "mortgage",
4140
+ "surveyor",
4141
+ "architect",
4142
+ "planning permission",
4143
+ "building regulations",
4144
+ // web and digital, for the agency's own pages
4145
+ "website",
4146
+ "web design",
4147
+ "seo",
4148
+ "hosting",
4149
+ "google business profile",
4150
+ "online shop",
4151
+ "ecommerce",
4152
+ // food and hospitality
4153
+ "breakfast",
4154
+ "lunch",
4155
+ "dinner",
4156
+ "coffee",
4157
+ "bakery",
4158
+ "cake",
4159
+ "catering",
4160
+ "wedding",
4161
+ "venue"
4162
+ ];
4163
+ var STOCK_FIGURES = [
4164
+ /\b24\s?\/\s?7\b/gi,
4165
+ /\b24[\s-]hours?\b/gi,
4166
+ /\b1[01]0\s?%/g,
4167
+ /\b(?:5|five)[\s-]?star\b/gi,
4168
+ /#\s?1\b/g,
4169
+ /\bno\.?\s?1\b/gi,
4170
+ /\b365\s+days\b/gi
4171
+ ];
4172
+ var NOT_NAMES = new Set(
4173
+ "a an the and of for to in on at by with your you our we us it get free quote quotes call now today book booking contact learn more read see view explore discover start started home about services service quality trusted trust expert experts expertise professional professionals best solutions solution digital team welcome why choose how works local reliable affordable fast friendly premium leading excellence excellent results success growth business businesses customer customers client clients care support help new our story mission vision values innovation innovative modern simple easy smart better great amazing perfect ultimate transform elevate empower unlock experience experienced dedicated passionate committed tailored bespoke seamless peace mind can do all every everything more less here there this that what who where when need needs make difference satisfaction guaranteed".split(" ")
4174
+ );
4175
+ var BRIEF_STOP = new Set(
4176
+ "a an the and or of for to in on at by with from who that which what their they them its it is are was were be been being has have had do does did can will would should could may might must this these those there here as into over under business company small local family run based owned services service provides provide offering offers people customers clients home homes house houses area areas around near across nearby town city county village uk".split(" ")
4177
+ );
4178
+ var WORD2 = /[A-Za-z0-9£$€][\w'’£$€%.,-]*/g;
4179
+ var countWords2 = (text) => (text.match(WORD2) ?? []).length;
4180
+ var escape2 = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
4181
+ var termPattern = (term) => new RegExp(`(?<![\\w\xA3$\u20AC])${term.split(/\s+/).map(escape2).join("[\\s-]+")}(?:s|es)?(?![\\w])`, "i");
4182
+ var TRADE_PATTERNS = TRADE_NOUNS.map((t) => [t, termPattern(t)]);
4183
+ var SMALL_WORDS = /* @__PURE__ */ new Set(["a", "an", "the", "and", "or", "of", "in", "on", "at", "to", "for", "by", "with", "from"]);
4184
+ function caseless(line) {
4185
+ const words2 = line.match(/[A-Za-z][A-Za-z’'-]*/g) ?? [];
4186
+ const letters = words2.filter((w) => w.length >= 2);
4187
+ if (letters.length >= 3 && letters.filter((w) => w === w.toUpperCase()).length / letters.length >= 0.6) return "shout";
4188
+ const content = letters.filter((w) => !SMALL_WORDS.has(w.toLowerCase()));
4189
+ if (content.length >= 3 && content.filter((w) => /^[A-Z]/.test(w)).length / content.length >= 0.8) return "title";
4190
+ return null;
4191
+ }
4192
+ var maskStock = (text) => STOCK_FIGURES.reduce((t, re) => t.replace(re, (m) => " ".repeat(m.length)), text);
4193
+ function briefTerms(brief) {
4194
+ const terms = /* @__PURE__ */ new Set();
4195
+ for (const w of brief.match(/[A-Za-z][A-Za-z’'&-]*/g) ?? []) {
4196
+ const lower = w.toLowerCase();
4197
+ if (/^[A-Z]/.test(w) && w.length >= 3 && !BRIEF_STOP.has(lower) && !NOT_NAMES.has(lower)) terms.add(lower);
4198
+ }
4199
+ for (const [term, re] of TRADE_PATTERNS) if (re.test(brief)) terms.add(term);
4200
+ for (const f4 of protectedFacts(maskStock(brief))) if (f4.kind !== "name") terms.add(f4.value.toLowerCase());
4201
+ return [...terms];
4202
+ }
4203
+ function specifics(text, brief) {
4204
+ const found = /* @__PURE__ */ new Map();
4205
+ const add = (kind, value) => {
4206
+ const key = value.toLowerCase().replace(/\s+/g, " ").trim();
4207
+ if (key && !found.has(key)) found.set(key, { kind, value, key });
4208
+ };
4209
+ for (const raw of text.split("\n")) {
4210
+ const line = maskStock(raw);
4211
+ if (!line.trim()) continue;
4212
+ const capitals = caseless(line);
4213
+ for (const f4 of protectedFacts(line)) {
4214
+ if (f4.kind === "name") {
4215
+ if (capitals === "shout") continue;
4216
+ if (capitals === "title") {
4217
+ for (const acronym of f4.value.match(/\b[A-Z]{2,}\b/g) ?? []) add("name", acronym);
4218
+ continue;
4219
+ }
4220
+ const words2 = f4.value.split(/\s+/);
4221
+ const named = (w) => !NOT_NAMES.has(w.toLowerCase()) && w !== "&";
4222
+ const first = words2.findIndex(named);
4223
+ if (first === -1) continue;
4224
+ const last = words2.length - 1 - [...words2].reverse().findIndex(named);
4225
+ add("name", words2.slice(first, last + 1).join(" "));
4226
+ continue;
4227
+ }
4228
+ add(f4.kind, f4.value);
4229
+ }
4230
+ for (const [term, re] of TRADE_PATTERNS) {
4231
+ const m = re.exec(line);
4232
+ if (m) add("trade", term);
4233
+ }
4234
+ }
4235
+ if (brief) {
4236
+ for (const term of briefTerms(brief)) {
4237
+ if ([...found.keys()].some((k) => k === term || k.split(" ").includes(term))) continue;
4238
+ if (termPattern(term).test(text)) add("brief", term);
4239
+ }
4240
+ }
4241
+ return [...found.values()];
4242
+ }
4243
+ function specificity(text, brief) {
4244
+ const list = specifics(text, brief);
4245
+ const words2 = countWords2(text);
4246
+ const trade = list.filter((s) => s.kind === "trade").length;
4247
+ const hard = list.length - trade;
4248
+ return {
4249
+ words: words2,
4250
+ specifics: list,
4251
+ hard,
4252
+ trade,
4253
+ perHundred: words2 ? Math.round(list.length / words2 * 1e3) / 10 : 0,
4254
+ generic: hard === 0 && trade < 2
4255
+ };
4256
+ }
4257
+ var NOT_SERVICE_ROLES = /* @__PURE__ */ new Set(["testimonials", "team", "faq", "contact", "logos", "stats", "cta-band", "footer-cta", "marquee"]);
4258
+ var SERVICE_ROLES = /* @__PURE__ */ new Set(["features", "process", "pricing", "cards"]);
4259
+ var SERVICE_LABEL = /\bservices?\b|\bwhat we (?:do|fix|offer|make|build)\b|\bhow we\b|\bour work\b|\bwe (?:fix|fit|install|repair|build|offer|make)\b/i;
4260
+ function sentencesOf(blocks) {
4261
+ const out = [];
4262
+ for (const block of blocks) {
4263
+ for (const m of block.matchAll(/[^.!?]+[.!?]*/g)) {
4264
+ const s = m[0].trim();
4265
+ if (countWords2(s) >= 3) out.push(s);
4266
+ }
4267
+ }
4268
+ return [...new Set(out)];
4269
+ }
4270
+ function pageCopy(snapshot) {
4271
+ const withText2 = snapshot.sections.filter((s) => s.text);
4272
+ if (!snapshot.firstScreenText && withText2.length === 0) return null;
4273
+ const hero = [...snapshot.firstScreenText ?? [], ...snapshot.sections.filter((s) => s.kind === "hero").flatMap((s) => s.text ?? [])];
4274
+ const services = snapshot.sections.filter((s) => s.kind !== "hero" && !NOT_SERVICE_ROLES.has(s.role ?? s.kind)).filter((s) => SERVICE_ROLES.has(s.role ?? s.kind) || SERVICE_LABEL.test(s.label)).flatMap((s) => s.text ?? []);
4275
+ const all = [...snapshot.firstScreenText ?? [], ...withText2.flatMap((s) => s.text ?? [])];
4276
+ return { url: snapshot.url, hero: sentencesOf(hero), services: sentencesOf(services), all };
4277
+ }
4278
+ function side(page, other, brief) {
4279
+ const otherKeys = new Set(specifics(other.all.join("\n"), brief).map((s) => s.key));
4280
+ const sentences3 = [.../* @__PURE__ */ new Set([...page.hero, ...page.services])];
4281
+ const interchangeable = sentences3.filter((s) => !specifics(s, brief).some((x) => !otherKeys.has(x.key)));
4282
+ return {
4283
+ url: page.url,
4284
+ sentences: sentences3.length,
4285
+ interchangeable,
4286
+ share: sentences3.length ? Math.round(interchangeable.length / sentences3.length * 1e3) / 1e3 : null,
4287
+ perHundred: specificity(sentences3.join("\n"), brief).perHundred
4288
+ };
4289
+ }
4290
+ function compareCompetitor(ours, competitor, brief) {
4291
+ return { ours: side(ours, competitor, brief), competitor: side(competitor, ours, brief), brief: Boolean(brief) };
4292
+ }
4293
+ var pctOf = (share) => share === null ? "no sentences" : `${Math.round(share * 100)}%`;
4294
+ function formatCompetitor(result) {
4295
+ const row = (label, s) => ` ${label.padEnd(11)} ${s.interchangeable.length} of ${s.sentences} (${pctOf(s.share)}), ${s.perHundred} specifics per 100 words`;
4296
+ const lines = [
4297
+ `craft copy compare: ${result.ours.url} against ${result.competitor.url}`,
4298
+ " Hero and service sentences holding nothing the other page does not also say:",
4299
+ row("ours", result.ours),
4300
+ row("competitor", result.competitor)
4301
+ ];
4302
+ if (result.brief) lines.push(" The brief's own terms were recognised on both pages.");
4303
+ if (result.ours.interchangeable.length) {
4304
+ lines.push("", " Interchangeable on ours: add the job, the place, the price or the name only this business has");
4305
+ for (const s of result.ours.interchangeable.slice(0, 12)) lines.push(` "${s.length > 110 ? `${s.slice(0, 107)}...` : s}"`);
4306
+ if (result.ours.interchangeable.length > 12) lines.push(` and ${result.ours.interchangeable.length - 12} more`);
4307
+ } else {
4308
+ lines.push("", " Every hero and service sentence on ours holds something the competitor does not say.");
4309
+ }
4310
+ return lines.join("\n");
4311
+ }
4312
+
4313
+ // src/character/tells/specificity.ts
4314
+ var count = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
4315
+ var snapHit = (s, message, excerpt) => ({ path: s.url, offset: 0, message, excerpt: excerpt ?? message });
4316
+ var ENTITIES = { amp: "&", nbsp: " ", rsquo: "\u2019", lsquo: "\u2018", ldquo: "\u201C", rdquo: "\u201D", quot: '"', apos: "'", "#39": "'", pound: "\xA3" };
4317
+ function literalText(inner) {
4318
+ const t = inner.replace(/\{\s*(["'`])\s*\1\s*\}/g, " ").replace(/<br\s*\/?>/gi, " ").replace(/<[^>]+>/g, " ");
4319
+ if (/[{}]/.test(t)) return null;
4320
+ return t.replace(/&(#?\w+);/g, (m, e) => ENTITIES[e] ?? m).replace(/\s+/g, " ").trim();
4321
+ }
4322
+ var HOME_FILE = /(?:^|\/)app\/(?:\([^/]+\)\/)*page\.(?:tsx|jsx|mdx)$|(?:^|\/)pages\/index\.(?:tsx|jsx|astro|vue|mdx)$|(?:^|\/)routes\/(?:\([^/]+\)\/)*\+page\.svelte$|^(?:(?:public|src|site|www)\/)?index\.html?$|(?:^|\/)[\w-]*(?:hero|home)[\w-]*\.(?:tsx|jsx|astro|vue|svelte|html?)$/i;
4323
+ var HOME_URL = /^https?:\/\/[^/?#]+(?:\/(?:[a-z]{2}(?:-[a-z]{2})?\/?)?(?:index\.html?)?)?(?:[?#].*)?$/i;
4324
+ var H1 = /<h1\b[^>]*>([\s\S]*?)<\/h1>/gi;
4325
+ var NEXT_P = /<p\b[^>]*>([\s\S]*?)<\/p>/i;
4326
+ function headlines(ctx) {
4327
+ const out = [];
4328
+ for (const file of ctx.files) {
4329
+ if (fileKind(file.path) !== "markup" || !HOME_FILE.test(file.path)) continue;
4330
+ for (const m of file.text.matchAll(H1)) {
4331
+ const h1 = literalText(m[1]);
4332
+ if (!h1) continue;
4333
+ const after = file.text.slice((m.index ?? 0) + m[0].length, (m.index ?? 0) + m[0].length + 1200);
4334
+ const p = NEXT_P.exec(after);
4335
+ const sub = p ? literalText(p[1]) : null;
4336
+ out.push({ path: file.path, offset: m.index ?? 0, h1, text: [h1, sub].filter(Boolean).join("\n") });
4337
+ }
4338
+ }
4339
+ return out;
4340
+ }
4341
+ var GENERIC_MESSAGE = "the headline and the line under it name nothing particular: no place, name, number, price or job";
4342
+ var STANDING_CLAIM = /(?<![\w#])(?:trusted|reliable|reputable|award[- ]winning|top[- ]rated|best[- ]rated|highly (?:rated|recommended|experienced|skilled|qualified)|fully (?:qualified|certified|accredited|licensed|insured)|(?:qualified|certified|accredited|approved|registered|experienced|expert) (?:engineers?|electricians?|plumbers?|builders?|technicians?|installers?|team|tradesmen|professionals?|staff)|(?:years|decades) of experience|(?:5|five)[- ]star (?:service|rated|reviews?)|(?:happy|satisfied) (?:customers|clients)|(?:customers|clients) (?:love|trust|recommend)|number one|no\.? ?1|#1)(?![\w])/i;
4343
+ var PROOF_NAMES = [
4344
+ "Gas Safe",
4345
+ "NICEIC",
4346
+ "NAPIT",
4347
+ "ELECSA",
4348
+ "Stroma",
4349
+ "TrustMark",
4350
+ "Which? Trusted Trader",
4351
+ "Checkatrade",
4352
+ "TrustATrader",
4353
+ "Rated People",
4354
+ "MyBuilder",
4355
+ "Federation of Master Builders",
4356
+ "FMB",
4357
+ "Guild of Master Craftsmen",
4358
+ "OFTEC",
4359
+ "HETAS",
4360
+ "CIPHE",
4361
+ "APHC",
4362
+ "CHAS",
4363
+ "SafeContractor",
4364
+ "Constructionline",
4365
+ "FENSA",
4366
+ "CERTASS",
4367
+ "MCS",
4368
+ "RECC",
4369
+ "BPEC",
4370
+ "City & Guilds",
4371
+ "NVQ",
4372
+ "CSCS",
4373
+ "Worcester Bosch",
4374
+ "Vaillant",
4375
+ "Viessmann",
4376
+ "BAFE",
4377
+ "NSI",
4378
+ "SSAIB",
4379
+ "BPCA",
4380
+ "RICS",
4381
+ "CIOB",
4382
+ "RIBA",
4383
+ "ICAEW",
4384
+ "ACCA",
4385
+ "CIMA",
4386
+ "SRA",
4387
+ "Law Society",
4388
+ "GDC",
4389
+ "GMC",
4390
+ "HCPC",
4391
+ "CQC",
4392
+ "Ofsted",
4393
+ "ISO 9001",
4394
+ "ISO 27001",
4395
+ "Cyber Essentials",
4396
+ "Companies House",
4397
+ "FCA",
4398
+ "Trustpilot",
4399
+ "Feefo",
4400
+ "Reviews.io",
4401
+ "Yell",
4402
+ "Houzz"
4403
+ ];
4404
+ var escape3 = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
4405
+ var PROOF_NAME = new RegExp(`(?<![\\w])(?:${PROOF_NAMES.map(escape3).join("|")})(?![\\w])`);
4406
+ var PROOF_NAME_ANY_CASE = new RegExp(PROOF_NAME.source, "i");
4407
+ var PROOF_PATTERNS = [
4408
+ PROOF_NAME,
4409
+ /\bGoogle (?:reviews?|rating)\b|\breviews? on Google\b/i,
4410
+ // A rating or a count of reviews: "4.9 out of 5", "rated 5", "212 reviews".
4411
+ /\b[1-5](?:\.\d)?\s?(?:\/\s?5|out of 5)\b|\brated\s+[1-5](?:\.\d)?\b|★{3,}|\b\d[\d,]*\+?\s+(?:verified\s+)?(?:reviews|ratings)\b/i,
4412
+ // A registration or licence number.
4413
+ /\b(?:reg(?:istration|istered)?|licen[cs]e|membership|company)\s*(?:no\.?|number|#)\s*:?\s*[A-Z0-9-]{4,}/i
4414
+ ];
4415
+ var isQuote = (block) => /^["“]/.test(block) && block.split(/\s+/).length >= 8 || /^[—–-]\s*[A-Z]/.test(block);
4416
+ function sectionHasProof(s, section, index) {
4417
+ if ((section.role ?? section.kind) === "testimonials") return true;
4418
+ const text = section.text ?? [];
4419
+ if (text.some((b) => isQuote(b) || PROOF_PATTERNS.some((re) => re.test(b)))) return true;
4420
+ return (s.images ?? []).some((i) => i.section === index && i.role === "logo" && PROOF_NAME_ANY_CASE.test(`${i.alt ?? ""} ${i.src}`));
4421
+ }
4422
+ function unprovenClaims(s) {
4423
+ const proof = s.sections.map((section, i) => sectionHasProof(s, section, i));
4424
+ const out = [];
4425
+ s.sections.forEach((section, i) => {
4426
+ if (!section.text || proof[i] || proof[i - 1] || proof[i + 1]) return;
4427
+ for (const sentence of sentencesOf(section.text)) {
4428
+ const m = STANDING_CLAIM.exec(sentence);
4429
+ if (m) out.push({ claim: m[0], sentence, section: section.label });
4430
+ }
4431
+ });
4432
+ return out;
4433
+ }
4434
+ var withText = (texts, patch = () => ({})) => {
4435
+ const base = makeSnapshot();
4436
+ return { ...base, sections: base.sections.map((sec, i) => ({ ...sec, text: texts[i] ?? [], ...patch(i) })) };
4437
+ };
4438
+ var CLAIM_TEXT = ["What we fix", "Our fully qualified engineers are trusted by homeowners across the county."];
4439
+ var SPECIFICITY_COPY_TELLS = [
4440
+ {
4441
+ id: "generic-hero-claim",
4442
+ name: "Headline that fits any business",
4443
+ generation: 1,
4444
+ severity: "warn",
4445
+ surface: "copy",
4446
+ why: "The first thing a visitor reads on the home page names no place, no person, no price and no job, so it would fit every competitor's site unchanged. A model writes it when it has nothing particular to say.",
4447
+ fix: 'Put what only this business can say on the first screen: the job, the town, a price, the name. "Boilers fixed the same day in Brackley" beats "Quality you can trust".',
4448
+ detect: (ctx) => headlines(ctx).filter((h) => specificity(h.text).generic).map((h) => ({ path: h.path, offset: h.offset, message: GENERIC_MESSAGE, excerpt: h.h1 })),
4449
+ fixtures: {
4450
+ flag: [
4451
+ { path: "app/page.tsx", text: '<section>\n <h1 className="text-6xl">Quality you can trust</h1>\n <p>We deliver reliable solutions tailored to your needs.</p>\n</section>' },
4452
+ // Shouted and Title Case: its capitals are not names, and its figures are stock.
4453
+ { path: "index.html", text: "<h1>YOUR VISION, OUR EXPERTISE</h1>\n<p>24/7 Support And 100% Satisfaction Guaranteed For Every Customer</p>" }
4454
+ ],
4455
+ pass: [
4456
+ { path: "app/page.tsx", text: '<h1 className="text-6xl">Boilers fixed the same day in Brackley</h1>' },
4457
+ // A stock headline rescued by the line under it.
4458
+ { path: "index.html", text: "<h1>Quality you can trust</h1>\n<p>Gas Safe registered engineers in Northampton since 2009.</p>" },
4459
+ // Two trade nouns say what the business does.
4460
+ { path: "index.html", text: "<h1>Plumbing and boiler repairs</h1>" },
4461
+ // The words come from data: nothing to read.
4462
+ { path: "app/page.tsx", text: '<h1 className="text-6xl">{site.headline}</h1>' },
4463
+ // Another page's headline is a label, not the site's claim.
4464
+ { path: "app/privacy/page.tsx", text: "<h1>Privacy policy</h1>\n<p>This policy explains how we use your data.</p>" }
4465
+ ]
4466
+ },
4467
+ rendered: {
4468
+ detect: (s) => {
4469
+ if (!s.firstScreenText || !HOME_URL.test(s.url)) return [];
4470
+ const text = s.firstScreenText.join("\n");
4471
+ if (!text.trim() || !specificity(text).generic) return [];
4472
+ const h1 = s.headings.find((h) => h.level === 1 && h.top < s.viewport.height);
4473
+ return [snapHit(s, `the first screen names nothing particular: no place, name, number, price or job`, h1?.text ?? s.firstScreenText[0])];
4474
+ },
4475
+ fixtures: {
4476
+ flag: [
4477
+ makeSnapshot({ firstScreenText: ["Quality you can trust", "We deliver reliable solutions tailored to your needs."], headings: [{ ...makeSnapshot().headings[0], text: "Quality you can trust" }] }),
4478
+ makeSnapshot({ firstScreenText: ["YOUR VISION, OUR EXPERTISE", "24/7 support. 100% satisfaction. 5-star service."] })
4479
+ ],
4480
+ pass: [
4481
+ makeSnapshot(),
4482
+ makeSnapshot({ firstScreenText: ["Boilers fixed the same day in Brackley", "From \xA385, with the part on the van."] }),
4483
+ makeSnapshot({ firstScreenText: ["Quality plumbing you can trust", "Boilers, radiators and underfloor heating."] }),
4484
+ // A first screen that is a picture and nothing else is not judged on its words.
4485
+ makeSnapshot({ firstScreenText: [] }),
4486
+ // Nor is any page but the home page.
4487
+ makeSnapshot({ url: "https://example.test/privacy", firstScreenText: ["Privacy policy", "This policy explains how we use your data."] })
4488
+ ]
4489
+ }
4490
+ }
4491
+ }
4492
+ ];
4493
+ var SPECIFICITY_RENDERED_TELLS = [
4494
+ {
4495
+ id: "unproven-claim",
4496
+ name: "Claim with no proof next to it",
4497
+ generation: 1,
4498
+ severity: "warn",
4499
+ surface: "rendered",
4500
+ why: `"Trusted", "fully qualified" and "award-winning" ask the visitor to take the business's word for it. A page built with no reviews and no registration number makes the claim anyway, with nothing beside it.`,
4501
+ fix: "Put the proof where the claim is: the Gas Safe or NICEIC number, the named review with its town, the rating and where it was left. Or cut the claim.",
4502
+ rendered: {
4503
+ detect: (s) => {
4504
+ if (!s.sections.some((x) => x.text)) return [];
4505
+ const found = unprovenClaims(s);
4506
+ if (found.length === 0) return [];
4507
+ const first = found[0];
4508
+ const where = first.section ? `"${first.section}"` : "an unnamed section";
4509
+ return [snapHit(s, `${count(found.length, "claim")} with no review or accreditation within one section: "${first.claim}" in ${where}`, first.sentence)];
4510
+ },
4511
+ fixtures: {
4512
+ flag: [
4513
+ withText([["Boilers fixed the same day in Brackley"], CLAIM_TEXT]),
4514
+ // Proof two sections away is not next to the claim.
4515
+ withText([["Boilers fixed the same day in Brackley"], CLAIM_TEXT, ["Recent jobs"], ["\u201CThey turned up on time and fixed the boiler in an hour.\u201D", "Sam, Brackley"]], (i) => i === 3 ? { role: "testimonials" } : {})
4516
+ ],
4517
+ pass: [
4518
+ makeSnapshot(),
4519
+ withText([["Boilers fixed the same day in Brackley"], ["Our fully qualified engineers are Gas Safe registered, number 123456."]]),
4520
+ withText([["Boilers fixed the same day in Brackley"], CLAIM_TEXT, ["What customers said"]], (i) => i === 2 ? { role: "testimonials" } : {}),
4521
+ withText([["Rated 4.9 out of 5 from 212 reviews on Google"], CLAIM_TEXT]),
4522
+ {
4523
+ ...withText([["Boilers fixed the same day in Brackley"], CLAIM_TEXT]),
4524
+ images: [{ src: "https://example.test/img/gas-safe-register.svg", host: "example.test", width: 96, height: 96, top: 1200, role: "logo", alt: "Gas Safe Register", decorative: false, section: 1, background: false }]
4525
+ }
4526
+ ]
4527
+ }
4528
+ }
4529
+ }
4530
+ ];
4531
+
4532
+ // src/character/house.ts
4533
+ var HOUSE = {
4534
+ "em-dash": { tier: "block", label: "em dash, use a full stop or a comma" },
4535
+ emoji: { tier: "block", label: "emoji" },
4536
+ "not-just-but": { tier: "block", label: "contrastive negation. The template is the tell, not the sentiment. Say the positive claim" },
4537
+ "no-x-no-y": {
4538
+ tier: "block",
4539
+ label: '"No X, no Y" list. Defining the brand by what it is not, itemised, is the same template as contrastive negation'
4540
+ },
4541
+ "no-x-badge": { tier: "block", label: 'standalone "No X" badge. Reads as a slapped-on kicker, and worse when reused across pieces' },
4542
+ "ai-phrase": { tier: "block", label: "AI tell" },
4543
+ "plainer-word": { tier: "block", label: "a plainer word exists. Name the mechanism instead" },
4544
+ "plain-english": { tier: "block", label: 'use "properly explained"' },
4545
+ buzzword: { tier: "block", label: "forbidden phrase" },
4546
+ "negative-reassurance": { tier: "block", label: "negative reassurance, say what they get" },
4547
+ // Evidence of a pasted chat reply, not a matter of style. Moved from review
4548
+ // on 2026-09-24 after its estate hits were read (ROADMAP.md): 15 of 15 real.
4549
+ "chatbot-residue": { tier: "block", label: "chatbot residue. A chat reply was pasted in: remove it, and source or cut the claim it backed" },
4550
+ "review-phrase": { tier: "review", label: "review tier" },
4551
+ "ai-vocabulary": { tier: "review", label: "AI vocabulary" },
4552
+ "stock-phrase": { tier: "review", label: "stock phrase" },
4553
+ "hollow-imperative": { tier: "review", label: "hollow imperative" },
4554
+ "rhetorical-opener": { tier: "review", label: "rhetorical question opener" },
4555
+ "staccato-triplet": { tier: "review", label: "staccato triplet" },
4556
+ "where-x-meets-y": { tier: "review", label: "'where X meets Y'" },
4557
+ "ing-tail": { tier: "review", label: "empty -ing tail" },
4558
+ "vague-attribution": { tier: "review", label: "unnamed source" },
4559
+ "closing-summary": { tier: "review", label: "closing summary" },
4560
+ "false-range": { tier: "review", label: "false range" },
4561
+ "placeholder": { tier: "review", label: "unfilled placeholder" },
4562
+ // Every estate hit so far is real (38 in five DD articles, 2026-09-24), but
4563
+ // a proposal can honestly say "the attached research". Review until measured there.
4564
+ "prompt-context": { tier: "review", label: "prompt context: the model naming its own inputs" },
4565
+ "question-reveal": { tier: "review", label: "staged reveal" },
4566
+ "inline-label-list": { tier: "review", label: "bold-label bullets" },
4567
+ "phrase-density": { tier: "review", label: "density" },
4568
+ "aphorism-density": { tier: "review", label: "density" },
4569
+ "contraction-scarcity": { tier: "review", label: "density" },
4570
+ "sentence-rhythm": { tier: "review", label: "density" },
4571
+ "repeated-sentence": { tier: "review", label: "repetition" },
4572
+ "heading-shape": { tier: "review", label: "headings" },
4573
+ "heading-echo": { tier: "review", label: "headings" },
4574
+ // A threshold on a count, not a named pattern: a person decides whether the
4575
+ // headline needed a particular. Review until its estate hits are read.
4576
+ "generic-hero-claim": { tier: "review", label: "headline that fits any business" },
4577
+ // Banned only "when vague", per the rules. Too noisy for a sweep.
4578
+ "vague-word": { tier: "explicit", label: "vague" }
4579
+ };
4580
+ function houseRule(id, name = id) {
4581
+ return HOUSE[id] ?? { tier: "review", label: name };
4582
+ }
4583
+ var HOUSE_LOCKED = "the house blocking tier cannot be lowered by a repo. A genuine one-off takes copy-ok on its line; a rule that is wrong is changed in craft's house.ts and COPY.md";
4584
+ function holdHouseBlocks(exceptions, severity) {
4585
+ const blocks = (tell) => HOUSE[tell]?.tier === "block";
4586
+ const refusedSeverity = Object.entries(severity).filter(([tell, o]) => blocks(tell) && o.level !== "block").map(([tell]) => tell);
4587
+ return {
4588
+ exceptions: exceptions.filter((e) => !blocks(e.tell)),
4589
+ refused: exceptions.filter((e) => blocks(e.tell)),
4590
+ severity: Object.fromEntries(Object.entries(severity).filter(([tell]) => !refusedSeverity.includes(tell))),
4591
+ refusedSeverity
4592
+ };
4593
+ }
4594
+
4595
+ // src/snapshot/fonts.ts
4596
+ var SYSTEM = /^(?:system-ui|-apple-system|BlinkMacSystemFont|ui-sans-serif|ui-serif|ui-monospace|ui-rounded|sans-serif|serif|monospace|cursive)$/i;
4597
+ function normaliseFamily(raw) {
4598
+ let name = raw.replace(/["']/g, "").trim();
4599
+ const next = name.match(/^__(.+?)(?:_Fallback)?_[0-9a-f]{5,8}$/i);
4600
+ if (next) name = next[1].replace(/_/g, " ");
4601
+ name = name.replace(/\s+Fallback$/i, "").replace(/\s+Variable$/i, "");
4602
+ if (SYSTEM.test(name)) return "system-ui";
4603
+ if (!/\s/.test(name) && (/[a-z][A-Z]/.test(name) || /^[a-z]+(?:-[a-z]+)+$/.test(name))) {
4604
+ name = name.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/-/g, " ").replace(/\b([a-z])/g, (c) => c.toUpperCase()).replace(/\bDm\b/, "DM");
4605
+ }
4606
+ return name;
4007
4607
  }
4008
4608
  var KNOWN = {
4009
4609
  fraunces: "serif",
@@ -4109,7 +4709,7 @@ function blueToPurple(s) {
4109
4709
  }
4110
4710
  return hits;
4111
4711
  }
4112
- var count = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
4712
+ var count2 = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
4113
4713
  var RENDERED_PATHS = {
4114
4714
  "reflex-font": {
4115
4715
  detect: reflexFonts(REFLEX_FONTS_1),
@@ -4147,11 +4747,11 @@ var RENDERED_PATHS = {
4147
4747
  }
4148
4748
  },
4149
4749
  "gradient-text": {
4150
- detect: (s) => s.effects.gradientText > 0 ? [hit(s, `${count(s.effects.gradientText, "heading")} painted with a gradient`)] : [],
4750
+ detect: (s) => s.effects.gradientText > 0 ? [hit(s, `${count2(s.effects.gradientText, "heading")} painted with a gradient`)] : [],
4151
4751
  fixtures: { flag: [makeSnapshot({ effects: { gradientText: 1 } })], pass: [makeSnapshot()] }
4152
4752
  },
4153
4753
  "glass-panel": {
4154
- detect: (s) => s.effects.glass > 0 ? [hit(s, `${count(s.effects.glass, "translucent blurred panel")}`)] : [],
4754
+ detect: (s) => s.effects.glass > 0 ? [hit(s, `${count2(s.effects.glass, "translucent blurred panel")}`)] : [],
4155
4755
  fixtures: { flag: [makeSnapshot({ effects: { glass: 2 } })], pass: [makeSnapshot()] }
4156
4756
  },
4157
4757
  "cream-palette": {
@@ -4229,7 +4829,7 @@ var RENDERED_PATHS = {
4229
4829
  detect: (s) => {
4230
4830
  const radial = s.effects.gradients.filter((g) => g.radial).length;
4231
4831
  const n = s.effects.glows + radial;
4232
- return n > 0 ? [hit(s, `${count(n, "soft glow")} behind the content`)] : [];
4832
+ return n > 0 ? [hit(s, `${count2(n, "soft glow")} behind the content`)] : [];
4233
4833
  },
4234
4834
  fixtures: {
4235
4835
  flag: [makeSnapshot({ effects: { glows: 1 } }), makeSnapshot({ effects: { gradients: [{ stops: ["rgba(99, 102, 241, 0.3)", "rgba(0, 0, 0, 0)"], area: 9e5, radial: true }] } })],
@@ -4237,28 +4837,829 @@ var RENDERED_PATHS = {
4237
4837
  }
4238
4838
  },
4239
4839
  "grid-background": {
4240
- detect: (s) => s.effects.gridBackgrounds > 0 ? [hit(s, `${count(s.effects.gridBackgrounds, "graph-paper background")}`)] : [],
4840
+ detect: (s) => s.effects.gridBackgrounds > 0 ? [hit(s, `${count2(s.effects.gridBackgrounds, "graph-paper background")}`)] : [],
4241
4841
  fixtures: { flag: [makeSnapshot({ effects: { gridBackgrounds: 1 } })], pass: [makeSnapshot()] }
4242
4842
  },
4243
- marquee: {
4244
- detect: (s) => s.effects.marquees > 0 ? [hit(s, `${count(s.effects.marquees, "endless scrolling strip")}`)] : [],
4245
- fixtures: { flag: [makeSnapshot({ effects: { marquees: 1 } })], pass: [makeSnapshot()] }
4843
+ marquee: {
4844
+ detect: (s) => s.effects.marquees > 0 ? [hit(s, `${count2(s.effects.marquees, "endless scrolling strip")}`)] : [],
4845
+ fixtures: { flag: [makeSnapshot({ effects: { marquees: 1 } })], pass: [makeSnapshot()] }
4846
+ },
4847
+ "thin-border-wide-shadow": {
4848
+ detect: (s) => s.effects.hairlineShadowCards >= 3 ? [hit(s, `${s.effects.hairlineShadowCards} cards with a hairline border under a wide shadow`)] : [],
4849
+ fixtures: { flag: [makeSnapshot({ effects: { hairlineShadowCards: 3 } })], pass: [makeSnapshot(), makeSnapshot({ effects: { hairlineShadowCards: 1 } })] }
4850
+ },
4851
+ "intro-cinematic": {
4852
+ detect: (s) => s.motion.introOverlay ? [hit(s, "a full-screen layer covers the page at load and then leaves")] : [],
4853
+ fixtures: { flag: [makeSnapshot({ motion: { introOverlay: true } })], pass: [makeSnapshot()] }
4854
+ }
4855
+ };
4856
+
4857
+ // src/fingerprint/index.ts
4858
+ var FINGERPRINT_VERSION = 2;
4859
+ var CHROMATIC = 0.03;
4860
+ var MIN_ACCENT_AREA = 2e4;
4861
+ var oklch = (value) => {
4862
+ const parsed = parseColour(value);
4863
+ return parsed && parsed.alpha > 0.5 ? parsed.oklch : null;
4864
+ };
4865
+ function accentOf(s) {
4866
+ const buttons = /* @__PURE__ */ new Map();
4867
+ for (const c of s.controls) {
4868
+ const o = oklch(c.background);
4869
+ if (o && o.c >= CHROMATIC) buttons.set(c.background, (buttons.get(c.background) ?? 0) + 1);
4870
+ }
4871
+ const topButton = [...buttons].sort((a, b) => b[1] - a[1])[0];
4872
+ if (topButton) return oklch(topButton[0]);
4873
+ const bg = s.colours.backgrounds.map((b) => ({ o: oklch(b.value), w: b.area })).filter((x) => x.o && x.o.c >= CHROMATIC && x.w >= MIN_ACCENT_AREA).sort((a, b) => b.w - a.w)[0];
4874
+ if (bg) return bg.o;
4875
+ const text = s.colours.text.map((t) => ({ o: oklch(t.value), w: t.chars })).filter((x) => x.o && x.o.c >= CHROMATIC).sort((a, b) => b.w - a.w)[0];
4876
+ return text ? text.o : null;
4877
+ }
4878
+ function faces(s) {
4879
+ const byChars = [...s.fonts].sort((a, b) => b.chars - a.chars);
4880
+ const byDisplay = [...s.fonts].sort((a, b) => b.displayChars - a.displayChars);
4881
+ const bodyName = normaliseFamily(byChars[0]?.family ?? "system-ui");
4882
+ const displayName = normaliseFamily((byDisplay[0]?.displayChars ? byDisplay[0].family : byChars[0]?.family) ?? "system-ui");
4883
+ return {
4884
+ display: { family: displayName, class: fontClass(displayName) },
4885
+ body: { family: bodyName, class: fontClass(bodyName) }
4886
+ };
4887
+ }
4888
+ function median(values) {
4889
+ if (values.length === 0) return null;
4890
+ const sorted = [...values].sort((a, b) => a - b);
4891
+ const mid = Math.floor(sorted.length / 2);
4892
+ return sorted.length % 2 ? sorted[mid] : (sorted[mid - 1] + sorted[mid]) / 2;
4893
+ }
4894
+ function fingerprint(s) {
4895
+ const effects = [];
4896
+ if (s.effects.glass > 0) effects.push("glass-panel");
4897
+ if (s.effects.gradientText > 0) effects.push("gradient-text");
4898
+ if (s.effects.glows > 0 || s.effects.gradients.some((g) => g.radial)) effects.push("radial-spotlight-glow");
4899
+ if (s.effects.gridBackgrounds > 0) effects.push("grid-background");
4900
+ if (s.effects.marquees > 0) effects.push("marquee");
4901
+ if (s.effects.hairlineShadowCards >= 3) effects.push("thin-border-wide-shadow");
4902
+ if (s.effects.eyebrowChip) effects.push("hero-eyebrow-chip");
4903
+ if (s.motion.introOverlay) effects.push("intro-cinematic");
4904
+ const below = s.sections.filter((x) => x.top > s.viewport.height).length;
4905
+ return {
4906
+ version: FINGERPRINT_VERSION,
4907
+ accent: accentOf(s),
4908
+ ground: oklch(s.ground) ?? { l: 1, c: 0, h: 0 },
4909
+ ...faces(s),
4910
+ roundness: median(s.controls.map((c) => Math.min(0.5, c.radiusPx / Math.max(1, c.heightPx)))),
4911
+ motion: below ? Math.min(1, s.motion.hiddenSections / below) : 0,
4912
+ effects: effects.sort(),
4913
+ layout: s.sections.map((x) => x.kind),
4914
+ ...s.sections.length > 0 && s.sections.every((x) => x.role && x.geometry) ? {
4915
+ sections: s.sections.map((x) => ({
4916
+ role: x.role,
4917
+ centred: x.geometry.centredShare,
4918
+ width: x.geometry.contentWidthRatio,
4919
+ symmetry: x.geometry.mirrorSymmetry,
4920
+ controls: x.geometry.controls,
4921
+ cards: x.cards,
4922
+ background: x.geometry.background === s.ground ? null : oklch(x.geometry.background),
4923
+ badges: (x.badges ?? []).map((b) => b.toLowerCase()),
4924
+ avatars: x.avatars ?? 0,
4925
+ carousel: x.carousel ?? false,
4926
+ figures: x.figures ?? 0
4927
+ }))
4928
+ } : {}
4929
+ };
4930
+ }
4931
+ var DISTANCE_WEIGHTS = { accent: 0.25, type: 0.25, ground: 0.1, shape: 0.1, motion: 0.1, effects: 0.1, layout: 0.1 };
4932
+ function levenshtein(a, b, cost = (x, y) => x === y ? 0 : 1) {
4933
+ const row = Array.from({ length: b.length + 1 }, (_, i) => i);
4934
+ for (let i = 1; i <= a.length; i += 1) {
4935
+ let prev = row[0];
4936
+ row[0] = i;
4937
+ for (let j = 1; j <= b.length; j += 1) {
4938
+ const cur = row[j];
4939
+ row[j] = Math.min(row[j] + 1, row[j - 1] + 1, prev + cost(a[i - 1], b[j - 1]));
4940
+ prev = cur;
4941
+ }
4942
+ }
4943
+ return row[b.length];
4944
+ }
4945
+ function sectionCost(x, y) {
4946
+ if (x.role !== y.role) return 1;
4947
+ return Math.min(0.5, (Math.abs(x.centred - y.centred) + Math.abs(x.width - y.width)) / 2);
4948
+ }
4949
+ function layoutDistance(a, b) {
4950
+ if (a.sections && b.sections) {
4951
+ const longest2 = Math.max(a.sections.length, b.sections.length);
4952
+ return longest2 === 0 ? 0 : levenshtein(a.sections, b.sections, sectionCost) / longest2;
4953
+ }
4954
+ const longest = Math.max(a.layout.length, b.layout.length);
4955
+ return longest === 0 ? 0 : levenshtein(a.layout, b.layout) / longest;
4956
+ }
4957
+ var clamp = (n) => Math.max(0, Math.min(1, n));
4958
+ function faceDistance(a, b) {
4959
+ if (a.family.toLowerCase() === b.family.toLowerCase()) return 0;
4960
+ return a.class === b.class ? 0.5 : 1;
4961
+ }
4962
+ function fingerprintDistance(a, b) {
4963
+ const accent = a.accent && b.accent ? clamp(deltaEOk(a.accent, b.accent) / 0.3) : a.accent || b.accent ? 1 : 0;
4964
+ const ground = clamp(deltaEOk(a.ground, b.ground) / 0.15);
4965
+ const type = 0.6 * faceDistance(a.display, b.display) + 0.4 * faceDistance(a.body, b.body);
4966
+ const shape = a.roundness === null || b.roundness === null ? a.roundness === b.roundness ? 0 : 0.5 : clamp(Math.abs(a.roundness - b.roundness) / 0.5);
4967
+ const motion = clamp(Math.abs(a.motion - b.motion));
4968
+ const union = /* @__PURE__ */ new Set([...a.effects, ...b.effects]);
4969
+ const shared = a.effects.filter((e) => b.effects.includes(e)).length;
4970
+ const effects = union.size === 0 ? 0 : 1 - shared / union.size;
4971
+ const layout = layoutDistance(a, b);
4972
+ const parts2 = { accent, ground, type, shape, motion, effects, layout };
4973
+ const total = Object.keys(DISTANCE_WEIGHTS).reduce((sum, k) => sum + DISTANCE_WEIGHTS[k] * parts2[k], 0);
4974
+ return { total: Math.round(total * 1e3) / 1e3, parts: parts2 };
4975
+ }
4976
+ function nearest(target2, set, k = set.length) {
4977
+ return set.map((item) => ({ id: item.id, distance: fingerprintDistance(target2, item.fingerprint) })).sort((x, y) => x.distance.total - y.distance.total).slice(0, k);
4978
+ }
4979
+
4980
+ // src/null/index.ts
4981
+ var NULL_VERSION = 1;
4982
+ function nullPrompt(brief) {
4983
+ return [
4984
+ `Build the home page for this business: ${brief.trim()}`,
4985
+ "",
4986
+ "Write it as one complete, self-contained HTML file. You may load fonts and libraries from a CDN. Use real copy, not placeholder text. Reply with the HTML only."
4987
+ ].join("\n");
4988
+ }
4989
+ function extractHtml(reply) {
4990
+ const start = reply.search(/<!doctype html|<html[\s>]/i);
4991
+ if (start < 0) return null;
4992
+ const end = reply.toLowerCase().lastIndexOf("</html>");
4993
+ const html = end > start ? reply.slice(start, end + "</html>".length) : reply.slice(start).replace(/\s*```\s*$/, "");
4994
+ return html.length > 200 ? html : null;
4995
+ }
4996
+ var MIN_RUNS = 5;
4997
+ var TYPICAL_AT = 0.1;
4998
+ function meanNearest(distances, k) {
4999
+ const sorted = [...distances].sort((a, b) => a - b).slice(0, k);
5000
+ return sorted.reduce((s, d) => s + d, 0) / sorted.length;
5001
+ }
5002
+ function median2(values) {
5003
+ const sorted = [...values].sort((a, b) => a - b);
5004
+ const mid = Math.floor(sorted.length / 2);
5005
+ return sorted.length % 2 ? sorted[mid] : (sorted[mid - 1] + sorted[mid]) / 2;
5006
+ }
5007
+ function typicality(target2, runs, k = 3) {
5008
+ if (runs.length < MIN_RUNS) throw new Error(`a null model needs at least ${MIN_RUNS} runs; this one has ${runs.length}`);
5009
+ const kk = Math.min(k, runs.length - 1);
5010
+ const toTarget = runs.map((r) => ({ id: r.id, distance: fingerprintDistance(target2, r.fingerprint).total }));
5011
+ const distance = meanNearest(
5012
+ toTarget.map((t) => t.distance),
5013
+ kk
5014
+ );
5015
+ const loo = runs.map(
5016
+ (r, i) => meanNearest(
5017
+ runs.filter((_, j) => j !== i).map((o) => fingerprintDistance(r.fingerprint, o.fingerprint).total),
5018
+ kk
5019
+ )
5020
+ );
5021
+ const score = loo.filter((d) => d >= distance).length / loo.length;
5022
+ return {
5023
+ score: Math.round(score * 100) / 100,
5024
+ typical: score >= TYPICAL_AT,
5025
+ distance: Math.round(distance * 1e3) / 1e3,
5026
+ baseline: Math.round(median2(loo) * 1e3) / 1e3,
5027
+ nearest: toTarget.sort((a, b) => a.distance - b.distance).slice(0, kk),
5028
+ shared: sharedChoices(target2, runs)
5029
+ };
5030
+ }
5031
+ var HUES = [
5032
+ ["red", 0, 45],
5033
+ ["orange", 45, 75],
5034
+ ["yellow", 75, 110],
5035
+ ["green", 110, 165],
5036
+ ["teal", 165, 215],
5037
+ ["blue", 215, 265],
5038
+ ["violet", 265, 315],
5039
+ ["pink", 315, 360]
5040
+ ];
5041
+ function hueName(o) {
5042
+ if (!o) return "none";
5043
+ if (o.c < 0.03) return "neutral";
5044
+ return HUES.find(([, lo, hi]) => o.h >= lo && o.h < hi)?.[0] ?? "red";
5045
+ }
5046
+ function groundName(o) {
5047
+ if (o.l < 0.3) return "dark";
5048
+ if (isCream(o)) return "cream";
5049
+ if (o.l >= 0.97 && o.c < 0.012) return "white";
5050
+ return o.c < 0.02 ? "grey" : "tinted";
5051
+ }
5052
+ function shapeName(roundness) {
5053
+ if (roundness === null) return "no buttons";
5054
+ if (roundness >= 0.45) return "pill";
5055
+ return roundness >= 0.15 ? "soft" : "square";
5056
+ }
5057
+ function choicesOf(fp) {
5058
+ return {
5059
+ display: [fp.display.family],
5060
+ body: [fp.body.family],
5061
+ accent: [hueName(fp.accent)],
5062
+ ground: [groundName(fp.ground)],
5063
+ shape: [shapeName(fp.roundness)],
5064
+ motion: [fp.motion >= 0.6 ? "reveals most sections" : fp.motion > 0 ? "reveals some sections" : "no scroll reveals"],
5065
+ effects: fp.effects,
5066
+ opening: [fp.layout.slice(0, 3).join(" > ") || "none"]
5067
+ };
5068
+ }
5069
+ function sharedChoices(target2, runs) {
5070
+ const mine = choicesOf(target2);
5071
+ const all = runs.map((r) => choicesOf(r.fingerprint));
5072
+ const out = [];
5073
+ for (const [part, values] of Object.entries(mine)) {
5074
+ for (const value of values) {
5075
+ const count4 = all.filter((c) => c[part].includes(value)).length;
5076
+ if (count4 / runs.length >= 0.25) out.push({ part, value, runs: count4, of: runs.length });
5077
+ }
5078
+ }
5079
+ return out.sort((a, b) => b.runs - a.runs);
5080
+ }
5081
+ var REFLEX_1 = new Set(REFLEX_FONTS_1.map((f4) => f4.toLowerCase()));
5082
+ var REFLEX_2 = new Set(REFLEX_FONTS_2.map((f4) => f4.toLowerCase()));
5083
+ function knownFor(kind, value, sample) {
5084
+ if (kind === "face") return REFLEX_1.has(value.toLowerCase()) ? "reflex-font" : REFLEX_2.has(value.toLowerCase()) ? "reflex-font-2" : null;
5085
+ if (kind === "accent" && value === "violet") return sample.some((f4) => f4.accent && isAiViolet(f4.accent)) ? "ai-violet" : null;
5086
+ if (kind === "ground" && value === "cream") return "cream-palette";
5087
+ if (kind === "shape" && value === "pill") return "pill-everything";
5088
+ if (kind === "motion" && value === "reveals most sections") return "reveal-everywhere";
5089
+ if (kind === "tell") return value;
5090
+ if (kind === "opening" && /^hero > (?:logos|stats)/.test(value)) return "hero-then-proof";
5091
+ return null;
5092
+ }
5093
+ var STOP = new Set(
5094
+ "a an the and or but of to in on for with at by from as is are be we our you your us it its this that these those will can all more get has have not no any".split(" ")
5095
+ );
5096
+ function grams(text) {
5097
+ const out = /* @__PURE__ */ new Set();
5098
+ for (const clause of text.toLowerCase().replace(/[’']/g, "'").split(/[.!?;:|()\u2013\u2014\u00b7•]+|,\s/)) {
5099
+ const words2 = clause.match(/[a-z][a-z'-]*/g) ?? [];
5100
+ for (let n = 2; n <= 4; n += 1) {
5101
+ for (let i = 0; i + n <= words2.length; i += 1) {
5102
+ const g = words2.slice(i, i + n);
5103
+ if (STOP.has(g[0]) || STOP.has(g[n - 1])) continue;
5104
+ if (g.filter((w) => !STOP.has(w)).length < 2) continue;
5105
+ out.add(g.join(" "));
5106
+ }
5107
+ }
5108
+ }
5109
+ return out;
5110
+ }
5111
+ var GRAMMAR = /* @__PURE__ */ new Set([
5112
+ "privacy policy",
5113
+ "cookie policy",
5114
+ "rights reserved",
5115
+ "all rights reserved",
5116
+ "terms of service",
5117
+ "terms and conditions",
5118
+ "terms conditions",
5119
+ "how it works",
5120
+ "what we do",
5121
+ "about us",
5122
+ "contact us",
5123
+ "get in touch",
5124
+ "opening hours",
5125
+ "read more",
5126
+ "learn more",
5127
+ "book now",
5128
+ "free quote",
5129
+ "our services",
5130
+ "quick links",
5131
+ "email address",
5132
+ "phone number",
5133
+ "full name",
5134
+ "first name",
5135
+ "last name",
5136
+ "your name",
5137
+ "your email",
5138
+ "send message"
5139
+ ]);
5140
+ var LEGAL = /©|&copy;|\bregistered (?:in|office|number)\b|\bcompany (?:no|number|reg)|\bvat (?:no|number|reg)/i;
5141
+ var NOISE = /\S+@\S+|https?:\/\/\S+|\b[\w-]+(?:\.[\w-]+)*\.(?:co\.uk|com|org|net|uk|io)\b|\b\d{1,2}(?:[:.]\d{2})?\s*(?:am|pm)\b|\d+/gi;
5142
+ function textGrams(text) {
5143
+ if (LEGAL.test(text)) return /* @__PURE__ */ new Set();
5144
+ const out = grams(text.replace(NOISE, " | "));
5145
+ for (const g of out) if (GRAMMAR.has(g)) out.delete(g);
5146
+ return out;
5147
+ }
5148
+ function properNouns(brief) {
5149
+ return new Set((brief.match(/\b[A-Z][a-z]+/g) ?? []).map((w) => w.toLowerCase()).filter((w) => !STOP.has(w)));
5150
+ }
5151
+ function harvest(models, options = {}) {
5152
+ const minShare = options.minShare ?? 0.25;
5153
+ const runs = models.flatMap((m, b) => m.runs.map((r) => ({ ...r, brief: b })));
5154
+ const of = runs.length;
5155
+ if (of === 0) return [];
5156
+ const multiBrief = models.length > 1;
5157
+ const sample = runs.map((r) => r.fingerprint);
5158
+ const tally = /* @__PURE__ */ new Map();
5159
+ const add = (kind, value, run, brief, example) => {
5160
+ const key = `${kind}\0${value}`;
5161
+ const t = tally.get(key) ?? { kind, value, runs: /* @__PURE__ */ new Set(), briefs: /* @__PURE__ */ new Set(), example };
5162
+ t.runs.add(run);
5163
+ t.briefs.add(brief);
5164
+ tally.set(key, t);
5165
+ };
5166
+ runs.forEach((r, i) => {
5167
+ const c = choicesOf(r.fingerprint);
5168
+ for (const f4 of /* @__PURE__ */ new Set([...c.display, ...c.body])) add("face", f4, i, r.brief);
5169
+ add("accent", c.accent[0], i, r.brief);
5170
+ add("ground", c.ground[0], i, r.brief);
5171
+ add("shape", c.shape[0], i, r.brief);
5172
+ add("motion", c.motion[0], i, r.brief);
5173
+ add("opening", c.opening[0], i, r.brief);
5174
+ for (const t of r.tells) add("tell", t, i, r.brief);
5175
+ });
5176
+ const out = [];
5177
+ for (const t of tally.values()) {
5178
+ if (t.runs.size / of < minShare) continue;
5179
+ if (t.kind === "accent" && (t.value === "none" || t.value === "neutral")) continue;
5180
+ if (t.kind === "shape" && t.value === "no buttons") continue;
5181
+ if (t.kind === "ground" && (t.value === "white" || t.value === "grey")) continue;
5182
+ if (t.kind === "motion" && t.value === "no scroll reveals") continue;
5183
+ out.push({ kind: t.kind, value: t.value, runs: t.runs.size, of, briefs: t.briefs.size, known: knownFor(t.kind, t.value, sample) });
5184
+ }
5185
+ const phraseMin = Math.max(3, Math.ceil(of * minShare * 0.4));
5186
+ const names = models.map((m) => properNouns(m.brief));
5187
+ const phrases2 = /* @__PURE__ */ new Map();
5188
+ runs.forEach((r, i) => {
5189
+ for (const text of r.copy) {
5190
+ for (const g of textGrams(text)) {
5191
+ if (g.split(" ").some((w) => names[r.brief].has(w))) continue;
5192
+ const p = phrases2.get(g) ?? { runs: /* @__PURE__ */ new Set(), briefs: /* @__PURE__ */ new Set(), example: text.trim().slice(0, 140) };
5193
+ p.runs.add(i);
5194
+ p.briefs.add(r.brief);
5195
+ phrases2.set(g, p);
5196
+ }
5197
+ }
5198
+ });
5199
+ const kept = [...phrases2].filter(([, p]) => p.runs.size >= phraseMin && (!multiBrief || p.briefs.size >= 2)).sort((a, b) => b[1].runs.size - a[1].runs.size || b[0].length - a[0].length);
5200
+ const maximal = kept.filter(([g, p]) => !kept.some(([h, q]) => h !== g && h.includes(g) && q.runs.size >= 0.8 * p.runs.size));
5201
+ for (const [g, p] of maximal.slice(0, 40)) {
5202
+ out.push({ kind: "phrase", value: g, runs: p.runs.size, of, briefs: p.briefs.size, known: options.copyTell?.(g) ?? null, example: p.example });
5203
+ }
5204
+ const order = ["face", "accent", "ground", "shape", "motion", "opening", "tell", "phrase"];
5205
+ return out.sort((a, b) => order.indexOf(a.kind) - order.indexOf(b.kind) || b.runs - a.runs);
5206
+ }
5207
+ function hueSwatch(runs, hue) {
5208
+ const hits = runs.map((r) => r.fingerprint.accent).filter((o) => !!o && hueName(o) === hue);
5209
+ if (hits.length === 0) return null;
5210
+ const centre = hits.reduce((best, o) => hits.reduce((s, p) => s + deltaEOk(o, p), 0) < hits.reduce((s, p) => s + deltaEOk(best, p), 0) ? o : best);
5211
+ return formatHex(oklchToRgb(centre));
5212
+ }
5213
+
5214
+ // src/fingerprint/component.ts
5215
+ var PROMO_BADGE = /\b(?:most popular|popular|recommended|best value|best seller|bestseller|most chosen)\b/i;
5216
+ function componentsOf(fp, role) {
5217
+ return (fp.sections ?? []).filter((s) => s.role === role);
5218
+ }
5219
+ var clamp2 = (n) => Math.max(0, Math.min(1, n));
5220
+ var diff = (a, b, scale) => a === void 0 || b === void 0 ? null : clamp2(Math.abs(a - b) / scale);
5221
+ function componentDistance(a, b) {
5222
+ if (a.role !== b.role) return 1;
5223
+ const promo = (s) => (s.badges ?? []).some((t) => PROMO_BADGE.test(t));
5224
+ const parts2 = [
5225
+ diff(a.centred, b.centred, 1),
5226
+ diff(a.width, b.width, 0.5),
5227
+ diff(a.symmetry, b.symmetry, 0.5),
5228
+ diff(a.controls, b.controls, 2),
5229
+ diff(a.cards, b.cards, 3),
5230
+ diff(a.figures, b.figures, 3),
5231
+ diff(a.avatars, b.avatars, 3),
5232
+ a.carousel === void 0 || b.carousel === void 0 ? null : a.carousel === b.carousel ? 0 : 1,
5233
+ a.badges === void 0 || b.badges === void 0 ? null : promo(a) === promo(b) ? 0 : 1,
5234
+ a.background === void 0 || b.background === void 0 ? null : a.background === null || b.background === null ? a.background === b.background ? 0 : 1 : clamp2(deltaEOk(a.background, b.background) / 0.3)
5235
+ ];
5236
+ const known = parts2.filter((p) => p !== null);
5237
+ return known.length === 0 ? 0 : Math.round(known.reduce((s, p) => s + p, 0) / known.length * 1e3) / 1e3;
5238
+ }
5239
+ function componentShared(a, b) {
5240
+ if (a.role !== b.role) return [];
5241
+ const out = [];
5242
+ const both = (f4) => f4(a) && f4(b);
5243
+ if (both((s) => s.centred >= 0.7)) out.push("centred");
5244
+ else if (both((s) => s.centred < 0.3)) out.push("left-aligned");
5245
+ if (both((s) => s.width <= 0.6)) out.push("narrow column");
5246
+ else if (both((s) => s.width >= 0.8)) out.push("full width");
5247
+ if (a.controls !== void 0 && a.controls === b.controls && a.controls > 0) out.push(`${a.controls} button${a.controls === 1 ? "" : "s"}`);
5248
+ if (a.cards !== void 0 && a.cards === b.cards && a.cards >= 2) out.push(`${a.cards} cards`);
5249
+ if (both((s) => (s.figures ?? 0) >= 3)) out.push("a row of figures");
5250
+ if (both((s) => (s.avatars ?? 0) >= 2)) out.push("avatars");
5251
+ if (both((s) => s.carousel === true)) out.push("carousel");
5252
+ if (both((s) => (s.badges ?? []).some((t) => PROMO_BADGE.test(t)))) out.push("promo badge");
5253
+ if (a.background && b.background && deltaEOk(a.background, b.background) <= 0.06) out.push("same coloured band");
5254
+ else if (a.background === null && b.background === null) out.push("on the page ground");
5255
+ return out;
5256
+ }
5257
+ function closestComponents(a, b, role) {
5258
+ let best = null;
5259
+ for (const x of componentsOf(a, role)) {
5260
+ for (const y of componentsOf(b, role)) {
5261
+ const distance = componentDistance(x, y);
5262
+ if (!best || distance < best.distance) best = { distance, shared: componentShared(x, y) };
5263
+ }
5264
+ }
5265
+ return best;
5266
+ }
5267
+ function estateComponentPairs(register, role) {
5268
+ const out = [];
5269
+ const s = register.sites;
5270
+ for (let i = 0; i < s.length; i += 1) {
5271
+ for (let j = i + 1; j < s.length; j += 1) {
5272
+ const c = closestComponents(s[i].fingerprint, s[j].fingerprint, role);
5273
+ if (c) out.push({ a: s[i].id, b: s[j].id, ...c });
5274
+ }
5275
+ }
5276
+ return out.sort((x, y) => x.distance - y.distance);
5277
+ }
5278
+ var meanNearest2 = (d, k) => {
5279
+ const s = [...d].sort((a, b) => a - b).slice(0, k);
5280
+ return s.reduce((t, v) => t + v, 0) / s.length;
5281
+ };
5282
+ function componentTypicality(target2, runs, k = 3) {
5283
+ const pool = runs.flatMap((r) => componentsOf(r.fingerprint, target2.role).slice(0, 1));
5284
+ if (pool.length < MIN_RUNS) return null;
5285
+ const kk = Math.min(k, pool.length - 1);
5286
+ const distance = meanNearest2(pool.map((p) => componentDistance(target2, p)), kk);
5287
+ const loo = pool.map((p, i) => meanNearest2(pool.filter((_, j) => j !== i).map((o) => componentDistance(p, o)), kk));
5288
+ const score = loo.filter((d) => d >= distance).length / loo.length;
5289
+ const sorted = [...loo].sort((a, b) => a - b);
5290
+ const mid = Math.floor(sorted.length / 2);
5291
+ const baseline = sorted.length % 2 ? sorted[mid] : (sorted[mid - 1] + sorted[mid]) / 2;
5292
+ return {
5293
+ role: target2.role,
5294
+ score: Math.round(score * 100) / 100,
5295
+ typical: score >= TYPICAL_AT,
5296
+ distance: Math.round(distance * 1e3) / 1e3,
5297
+ baseline: Math.round(baseline * 1e3) / 1e3,
5298
+ runs: pool.length
5299
+ };
5300
+ }
5301
+ var COMPONENT_ROLES = ["cta-band", "footer-cta", "pricing", "testimonials", "faq", "process", "features", "team", "contact", "stats"];
5302
+ function componentTypicalities(fp, runs, k = 3) {
5303
+ const out = [];
5304
+ for (const role of COMPONENT_ROLES) {
5305
+ const first = componentsOf(fp, role)[0];
5306
+ const t = first ? componentTypicality(first, runs, k) : null;
5307
+ if (t) out.push(t);
5308
+ }
5309
+ return out;
5310
+ }
5311
+
5312
+ // src/snapshot/rendered-tells.ts
5313
+ var hit2 = (s, message, excerpt) => ({ path: s.url, offset: 0, message, excerpt: excerpt ?? message });
5314
+ var GROUND = "rgb(255, 255, 255)";
5315
+ var BAND = "rgb(31, 58, 46)";
5316
+ var geo = (patch = {}) => ({
5317
+ centredShare: 0.1,
5318
+ mirrorSymmetry: 0.6,
5319
+ whitespaceRatio: 0.7,
5320
+ contentWidthRatio: 0.85,
5321
+ background: GROUND,
5322
+ controls: 0,
5323
+ ...patch
5324
+ });
5325
+ function withSection(index, patch, roles = []) {
5326
+ const base = makeSnapshot();
5327
+ return {
5328
+ ...base,
5329
+ sections: base.sections.map((s, i) => ({ ...s, role: roles[i] ?? s.kind, geometry: geo(), badges: [], avatars: 0, carousel: false, figures: 0, ...i === index ? patch : {} }))
5330
+ };
5331
+ }
5332
+ var measured = (s) => s.geometry !== void 0 && s.role !== void 0;
5333
+ var RENDERED_TELLS = [
5334
+ {
5335
+ id: "cta-band-stock",
5336
+ name: "Stock call-to-action band",
5337
+ generation: 1,
5338
+ severity: "warn",
5339
+ surface: "rendered",
5340
+ why: "A full-width coloured band with a centred heading, one line and one or two buttons is what a model closes every section run with. It asks for the booking the same way on every site.",
5341
+ fix: "Keep the ask, change the band: put it where the decision is made (next to the prices, after the proof), in the client's own words, laid out like the rest of the page rather than as a centred slab.",
5342
+ rendered: {
5343
+ detect: (s) => s.sections.filter((x) => measured(x) && (x.role === "cta-band" || x.role === "footer-cta")).filter((x) => {
5344
+ const g = x.geometry;
5345
+ return g.centredShare >= 0.8 && g.background !== s.ground && g.controls >= 1 && g.controls <= 2 && g.contentWidthRatio <= 0.7;
5346
+ }).map((x) => hit2(s, `a centred ${x.role === "footer-cta" ? "closing " : ""}band on its own colour with ${x.geometry.controls === 1 ? "one button" : "two buttons"}`, x.label)),
5347
+ fixtures: {
5348
+ flag: [
5349
+ withSection(4, { role: "footer-cta", label: "Boiler out today?", geometry: geo({ centredShare: 1, background: BAND, controls: 1, contentWidthRatio: 0.45 }) }),
5350
+ withSection(3, { role: "cta-band", label: "Ready to book?", geometry: geo({ centredShare: 0.9, background: BAND, controls: 2, contentWidthRatio: 0.5 }) })
5351
+ ],
5352
+ pass: [
5353
+ makeSnapshot(),
5354
+ // The same ask, laid out like the page: left-aligned on the ground.
5355
+ withSection(4, { role: "footer-cta", label: "Book a visit", geometry: geo({ centredShare: 0.1, background: GROUND, controls: 1, contentWidthRatio: 0.85 }) })
5356
+ ]
5357
+ }
5358
+ }
5359
+ },
5360
+ {
5361
+ id: "pricing-trio-popular",
5362
+ name: "Three-tier pricing with a popular badge",
5363
+ generation: 1,
5364
+ severity: "warn",
5365
+ surface: "rendered",
5366
+ why: "Three price cards with the middle one badged 'Most popular' is the SaaS pricing page, applied to a plumber or a salon whether or not anyone chose the middle option.",
5367
+ fix: "Keep the prices. Show them the way the trade quotes (a price list, per job, per visit), and drop the badge unless it is true and the client can say how many people chose it.",
5368
+ rendered: {
5369
+ detect: (s) => s.sections.filter((x) => measured(x) && x.role === "pricing" && x.cards === 3).filter((x) => (x.badges ?? []).some((b) => PROMO_BADGE.test(b))).map((x) => hit2(s, `three price cards, one badged "${(x.badges ?? []).find((b) => PROMO_BADGE.test(b))}"`, x.label)),
5370
+ fixtures: {
5371
+ flag: [withSection(3, { role: "pricing", kind: "cards", cards: 3, badges: ["Most popular"], label: "Plans" })],
5372
+ pass: [
5373
+ makeSnapshot(),
5374
+ withSection(3, { role: "pricing", kind: "cards", cards: 3, badges: [], label: "Prices" }),
5375
+ withSection(3, { role: "pricing", kind: "text", cards: 0, badges: [], label: "Price list" })
5376
+ ]
5377
+ }
5378
+ }
5379
+ },
5380
+ {
5381
+ id: "testimonial-avatar-carousel",
5382
+ name: "Avatar testimonial carousel",
5383
+ generation: 1,
5384
+ severity: "warn",
5385
+ surface: "rendered",
5386
+ why: "Round headshots over quotes in a sliding carousel is the stock testimonial block. Most visitors see the first slide only, and stock or AI faces make every quote read as invented.",
5387
+ fix: "Show the reviews all at once, where they come from (the Google rating, the named job, the town), with real photos of the work rather than of the reviewer.",
5388
+ rendered: {
5389
+ detect: (s) => s.sections.filter((x) => measured(x) && x.role === "testimonials" && x.carousel === true && (x.avatars ?? 0) >= 2).map((x) => hit2(s, `${x.avatars} round portraits in a sliding testimonial carousel`, x.label)),
5390
+ fixtures: {
5391
+ flag: [withSection(2, { role: "testimonials", avatars: 3, carousel: true, label: "What our clients say" })],
5392
+ pass: [
5393
+ makeSnapshot(),
5394
+ withSection(2, { role: "testimonials", avatars: 3, carousel: false, label: "Reviews" }),
5395
+ withSection(2, { role: "testimonials", avatars: 0, carousel: true, label: "Reviews" })
5396
+ ]
5397
+ }
5398
+ }
5399
+ },
5400
+ {
5401
+ id: "faq-accordion-closer",
5402
+ name: "FAQ accordion as the closer",
5403
+ generation: 2,
5404
+ severity: "warn",
5405
+ surface: "rendered",
5406
+ why: "Ending the page on a collapsed FAQ, often followed only by a band, is the model's default page ending. The answers a buyer needs are hidden behind clicks at the point they decide.",
5407
+ fix: "Answer the questions that block a booking where they arise (price next to prices, area next to the map), and end on the call to action or the proof.",
5408
+ rendered: {
5409
+ detect: (s) => {
5410
+ const body = s.sections.filter((x) => x.role !== "footer-cta" && x.role !== "cta-band");
5411
+ const last = body[body.length - 1];
5412
+ return last && measured(last) && last.role === "faq" ? [hit2(s, "the page ends on a question-and-answer list", last.label)] : [];
5413
+ },
5414
+ fixtures: {
5415
+ flag: [
5416
+ withSection(4, { role: "faq", label: "Common questions" }),
5417
+ {
5418
+ ...withSection(3, { role: "faq", label: "FAQ" }),
5419
+ sections: withSection(3, { role: "faq", label: "FAQ" }).sections.map((x, i) => i === 4 ? { ...x, role: "footer-cta" } : x)
5420
+ }
5421
+ ],
5422
+ pass: [makeSnapshot(), withSection(2, { role: "faq", label: "Common questions" })]
5423
+ }
5424
+ }
5425
+ },
5426
+ {
5427
+ id: "stats-row",
5428
+ name: "Row of big numbers",
5429
+ generation: 1,
5430
+ severity: "warn",
5431
+ surface: "rendered",
5432
+ why: "Three or four large figures in a row (500+ clients, 98% satisfaction, 10 years) is the stock proof block, and the numbers are often round, unsourced or invented.",
5433
+ fix: "Keep a figure only if it is true and sourced, and put it in a sentence next to what it proves. One real number in context beats four in a row.",
5434
+ rendered: {
5435
+ detect: (s) => s.sections.filter((x, i) => measured(x) && (x.role === "stats" || x.kind === "stats") && (x.figures ?? 0) >= 3 && (x.figures ?? 0) <= 6 && !(i === 1 && s.sections[0]?.kind === "hero")).map((x) => hit2(s, `${x.figures} large figures in a row`, x.label)),
5436
+ fixtures: {
5437
+ flag: [withSection(3, { role: "stats", kind: "stats", figures: 4, label: "500+" })],
5438
+ pass: [
5439
+ makeSnapshot(),
5440
+ withSection(3, { role: "text", kind: "text", figures: 1, label: "Since 2009" }),
5441
+ withSection(1, { role: "stats", kind: "stats", figures: 4, label: "500+" })
5442
+ ]
5443
+ }
5444
+ }
5445
+ },
5446
+ {
5447
+ id: "centred-everything",
5448
+ name: "Every section centred",
5449
+ generation: 2,
5450
+ severity: "warn",
5451
+ surface: "rendered",
5452
+ why: "When almost every section stacks a centred heading over centred text, the page has no reading line and every block looks like the one before. It is the layout nothing was decided for.",
5453
+ fix: "Pick an alignment and hold it: left-aligned text with a clear edge, keeping centring for the one moment that earns it.",
5454
+ rendered: {
5455
+ detect: (s) => {
5456
+ const m = s.sections.filter(measured);
5457
+ if (m.length < 4) return [];
5458
+ const centred = m.filter((x) => x.geometry.centredShare >= 0.7).length;
5459
+ return centred / m.length >= 0.8 ? [hit2(s, `${centred} of ${m.length} sections centre their text`)] : [];
5460
+ },
5461
+ fixtures: {
5462
+ flag: [{ ...makeSnapshot(), sections: makeSnapshot().sections.map((x) => ({ ...x, role: x.kind, geometry: geo({ centredShare: 0.9 }) })) }],
5463
+ pass: [
5464
+ makeSnapshot(),
5465
+ { ...makeSnapshot(), sections: makeSnapshot().sections.map((x, i) => ({ ...x, role: x.kind, geometry: geo({ centredShare: i < 2 ? 0.9 : 0.1 }) })) }
5466
+ ]
5467
+ }
5468
+ }
5469
+ }
5470
+ ];
5471
+
5472
+ // src/snapshot/imagery-tells.ts
5473
+ var hit3 = (s, message, excerpt) => ({ path: s.url, offset: 0, message, excerpt: excerpt ?? message });
5474
+ var STOCK_PHOTO_HOSTS = {
5475
+ "unsplash.com": "Unsplash",
5476
+ "pexels.com": "Pexels",
5477
+ "pixabay.com": "Pixabay",
5478
+ "istockphoto.com": "iStock",
5479
+ "gettyimages.com": "Getty Images",
5480
+ "shutterstock.com": "Shutterstock",
5481
+ "ftcdn.net": "Adobe Stock",
5482
+ "dreamstime.com": "Dreamstime",
5483
+ "depositphotos.com": "Depositphotos",
5484
+ "freepik.com": "Freepik",
5485
+ "rawpixel.com": "rawpixel",
5486
+ "stocksnap.io": "StockSnap",
5487
+ "burst.shopifycdn.com": "Burst",
5488
+ "picsum.photos": "Lorem Picsum",
5489
+ "loremflickr.com": "LoremFlickr",
5490
+ "placehold.co": "a placeholder service",
5491
+ "placeholder.com": "a placeholder service",
5492
+ "dummyimage.com": "a placeholder service"
5493
+ };
5494
+ var STOCK_AVATAR_HOSTS = {
5495
+ "randomuser.me": "randomuser.me",
5496
+ "pravatar.cc": "Pravatar",
5497
+ "dicebear.com": "DiceBear",
5498
+ "xsgames.co": "a random-face service",
5499
+ "thispersondoesnotexist.com": "a generated face",
5500
+ "generated.photos": "a generated face"
5501
+ };
5502
+ var STOCK_FILENAMES = [
5503
+ [/(?:^|[/_-])shutterstock[_-]?\d{4,}/i, "Shutterstock"],
5504
+ [/(?:^|[/_-])istock(?:photo)?[_-]?\d{4,}/i, "iStock"],
5505
+ [/(?:^|[/_-])adobestock[_-]?\d{4,}/i, "Adobe Stock"],
5506
+ [/(?:^|[/_-])gettyimages[_-]?\d{4,}/i, "Getty Images"],
5507
+ [/(?:^|[/_-])depositphotos[_-]?\d{4,}/i, "Depositphotos"],
5508
+ [/(?:^|[/_-])dreamstime[_-]/i, "Dreamstime"],
5509
+ [/(?:^|[/_-])pexels-[a-z0-9-]*\d{4,}/i, "Pexels"],
5510
+ [/-unsplash\.(?:jpe?g|png|webp|avif)(?:[?#]|$)/i, "Unsplash"],
5511
+ // Unsplash's photo ids: photo-<13-digit timestamp>-<12 hex>.
5512
+ [/photo-1\d{12}-[0-9a-f]{12}/, "Unsplash"]
5513
+ ];
5514
+ var byHost = (host, table) => {
5515
+ if (!host) return null;
5516
+ const h = host.toLowerCase();
5517
+ for (const [domain, name] of Object.entries(table)) if (h === domain || h.endsWith(`.${domain}`)) return name;
5518
+ return null;
5519
+ };
5520
+ function stockSource(image) {
5521
+ const host = byHost(image.host, STOCK_PHOTO_HOSTS);
5522
+ if (host) return host;
5523
+ let path = image.src.replace(/^[a-z][a-z0-9+.-]*:\/\/[^/?#]*/i, "").replace(/[?#].*$/, "");
5524
+ try {
5525
+ path = decodeURIComponent(path);
5526
+ } catch {
5527
+ }
5528
+ for (const [re, name] of STOCK_FILENAMES) if (re.test(path)) return name;
5529
+ return null;
5530
+ }
5531
+ function stockAvatarSource(image) {
5532
+ return byHost(image.host, STOCK_AVATAR_HOSTS) ?? stockSource(image);
5533
+ }
5534
+ var picture = (patch = {}) => ({
5535
+ src: "https://example.test/images/boiler-swap-hinton.jpg",
5536
+ host: "example.test",
5537
+ width: 640,
5538
+ height: 480,
5539
+ top: 1800,
5540
+ role: "photo",
5541
+ alt: "The new combi boiler fitted in a kitchen cupboard in Hinton",
5542
+ decorative: false,
5543
+ section: 2,
5544
+ background: false,
5545
+ ...patch
5546
+ });
5547
+ var withImages = (images) => ({ ...makeSnapshot(), images });
5548
+ var AI_XMP = { digitalSourceType: "trainedAlgorithmicMedia", source: "xmp", c2pa: false, bytes: 48e3 };
5549
+ var NOTHING = { digitalSourceType: null, source: null, c2pa: false, bytes: 48e3 };
5550
+ var count3 = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
5551
+ var IMAGERY_TELLS = [
5552
+ {
5553
+ id: "stock-photo",
5554
+ name: "Stock photography",
5555
+ generation: 1,
5556
+ severity: "warn",
5557
+ surface: "rendered",
5558
+ why: "A picture from a stock library is the picture every other site in the trade can use. It shows a job the client did not do, in a kitchen that is not theirs, and a visitor who has seen it before stops believing the rest.",
5559
+ fix: "Use a photo of the client's own work, premises or people, even a plain one taken on a phone. Where there is none yet, use fewer pictures rather than a library one.",
5560
+ rendered: {
5561
+ detect: (s) => {
5562
+ const found = (s.images ?? []).filter((i) => i.role === "photo" || i.role === "illustration").map((i) => ({ image: i, from: stockSource(i) })).filter((x) => x.from);
5563
+ if (found.length === 0) return [];
5564
+ const names = [...new Set(found.map((x) => x.from))].join(", ");
5565
+ return [hit3(s, `${count3(found.length, "picture")} from ${names}`, found[0].image.src)];
5566
+ },
5567
+ fixtures: {
5568
+ flag: [
5569
+ withImages([picture({ src: "https://images.unsplash.com/photo-1581578731548-c64695cc6952?w=1600", host: "images.unsplash.com", alt: "Plumber fixing a sink" })]),
5570
+ // Downloaded and self-hosted, found by the library's own file name.
5571
+ withImages([picture({ src: "https://example.test/img/shutterstock_1234567890.jpg" })])
5572
+ ],
5573
+ pass: [makeSnapshot(), withImages([picture()]), withImages([picture({ role: "icon", width: 48, height: 48, src: "https://images.unsplash.com/photo-1581578731548-c64695cc6952", host: "images.unsplash.com" })])]
5574
+ }
5575
+ }
5576
+ },
5577
+ {
5578
+ id: "stock-avatar",
5579
+ name: "Stock or placeholder faces",
5580
+ generation: 1,
5581
+ severity: "warn",
5582
+ surface: "rendered",
5583
+ why: "Round portraits from a placeholder-face service or a stock library next to reviews make every quote read as invented, and some of those faces are generated people who do not exist.",
5584
+ fix: "Drop the portraits. Name the reviewer, the town and the job, and link the review to where it was left.",
5585
+ rendered: {
5586
+ detect: (s) => {
5587
+ const found = (s.images ?? []).filter((i) => i.role === "avatar").map((i) => ({ image: i, from: stockAvatarSource(i) })).filter((x) => x.from);
5588
+ if (found.length === 0) return [];
5589
+ const names = [...new Set(found.map((x) => x.from))].join(", ");
5590
+ return [hit3(s, `${count3(found.length, "portrait")} from ${names}`, found[0].image.src)];
5591
+ },
5592
+ fixtures: {
5593
+ flag: [
5594
+ withImages([picture(), picture({ role: "avatar", width: 56, height: 56, src: "https://i.pravatar.cc/150?img=12", host: "i.pravatar.cc", alt: "Sarah" })]),
5595
+ withImages([picture({ role: "avatar", width: 64, height: 64, src: "https://images.unsplash.com/photo-1494790108377-be9c29b29330?crop=faces", host: "images.unsplash.com" })])
5596
+ ],
5597
+ pass: [makeSnapshot(), withImages([picture(), picture({ role: "avatar", width: 56, height: 56, src: "https://example.test/team/sam.jpg", alt: "Sam, engineer" })])]
5598
+ }
5599
+ }
4246
5600
  },
4247
- "thin-border-wide-shadow": {
4248
- detect: (s) => s.effects.hairlineShadowCards >= 3 ? [hit(s, `${s.effects.hairlineShadowCards} cards with a hairline border under a wide shadow`)] : [],
4249
- fixtures: { flag: [makeSnapshot({ effects: { hairlineShadowCards: 3 } })], pass: [makeSnapshot(), makeSnapshot({ effects: { hairlineShadowCards: 1 } })] }
5601
+ {
5602
+ id: "ai-image",
5603
+ name: "Generated image",
5604
+ generation: 2,
5605
+ severity: "warn",
5606
+ surface: "rendered",
5607
+ why: "The file itself says a model made it (its XMP or Content Credentials name a trained-model source). A generated picture stands in for work the client did not photograph, and anyone can read the label.",
5608
+ fix: "Replace it with a photo of the real thing: the work, the premises, the people. Where there is none yet, use fewer pictures.",
5609
+ rendered: {
5610
+ detect: (s) => {
5611
+ const found = (s.images ?? []).filter((i) => i.provenance?.digitalSourceType);
5612
+ if (found.length === 0) return [];
5613
+ const first = found[0].provenance;
5614
+ const where = first.source === "xmp" ? "its XMP metadata" : first.source === "c2pa" ? "its Content Credentials" : "its metadata";
5615
+ return [hit3(s, `${count3(found.length, "image")} labelled as made by a generative model (${first.digitalSourceType} in ${where})`, found[0].src)];
5616
+ },
5617
+ fixtures: {
5618
+ flag: [
5619
+ withImages([picture({ provenance: AI_XMP })]),
5620
+ withImages([picture({ provenance: { digitalSourceType: "compositeWithTrainedAlgorithmicMedia", source: "c2pa", c2pa: true, bytes: 12e4 } })])
5621
+ ],
5622
+ // Credentials that say nothing about a model, and an image never read, are not findings.
5623
+ pass: [makeSnapshot(), withImages([picture({ provenance: NOTHING })]), withImages([picture({ provenance: { ...NOTHING, c2pa: true } })]), withImages([picture()])]
5624
+ }
5625
+ }
4250
5626
  },
4251
- "intro-cinematic": {
4252
- detect: (s) => s.motion.introOverlay ? [hit(s, "a full-screen layer covers the page at load and then leaves")] : [],
4253
- fixtures: { flag: [makeSnapshot({ motion: { introOverlay: true } })], pass: [makeSnapshot()] }
5627
+ {
5628
+ id: "no-real-imagery",
5629
+ name: "No photograph on the page",
5630
+ generation: 1,
5631
+ severity: "warn",
5632
+ surface: "rendered",
5633
+ why: "A page with no photograph at all, only icons and illustrations, is the page a model builds when it has no assets. Icon tiles stand in for the evidence a buyer looks for: the work, the premises, the people.",
5634
+ fix: "Add one real photo of the work where the claim is made: a finished job next to the service, the team next to the booking. One plain photo beats any number of icons.",
5635
+ rendered: {
5636
+ detect: (s) => {
5637
+ if (!s.images || s.sections.length < 4) return [];
5638
+ if (s.images.some((i) => i.role === "photo")) return [];
5639
+ const icons = s.images.filter((i) => i.role === "icon" || i.role === "illustration").length;
5640
+ return [hit3(s, `no photograph on the page${icons ? `: ${count3(icons, "icon or illustration", "icons and illustrations")} instead` : ""}`)];
5641
+ },
5642
+ fixtures: {
5643
+ flag: [
5644
+ withImages([picture({ role: "icon", width: 48, height: 48, src: "https://example.test/icons/wrench.svg" }), picture({ role: "illustration", width: 480, height: 360, src: "https://example.test/hero.svg" })]),
5645
+ withImages([])
5646
+ ],
5647
+ // A snapshot with no image record is never judged; nor is a page too short to be a site.
5648
+ pass: [makeSnapshot(), withImages([picture()]), { ...withImages([]), sections: makeSnapshot().sections.slice(0, 3) }]
5649
+ }
5650
+ }
4254
5651
  }
4255
- };
5652
+ ];
4256
5653
 
4257
5654
  // src/character/check.ts
4258
- var CATALOGUE_VERSION = "2026.09.9";
4259
- var CATALOGUE = [...SOURCE_TELLS, ...COPY_TELLS, ...RESEARCH_TELLS, ...DENSITY_TELLS].map(
4260
- (t) => RENDERED_PATHS[t.id] ? { ...t, rendered: RENDERED_PATHS[t.id] } : t
4261
- );
5655
+ var CATALOGUE_VERSION = "2026.09.12";
5656
+ var CATALOGUE = [
5657
+ ...[...SOURCE_TELLS, ...COPY_TELLS, ...RESEARCH_TELLS, ...DENSITY_TELLS].map((t) => RENDERED_PATHS[t.id] ? { ...t, rendered: RENDERED_PATHS[t.id] } : t),
5658
+ ...SPECIFICITY_COPY_TELLS,
5659
+ ...RENDERED_TELLS,
5660
+ ...IMAGERY_TELLS,
5661
+ ...SPECIFICITY_RENDERED_TELLS
5662
+ ];
4262
5663
  function tellById(id) {
4263
5664
  return CATALOGUE.find((t) => t.id === id);
4264
5665
  }
@@ -4280,17 +5681,17 @@ var MARKER = /\b(?:copy|craft)-ok\b/;
4280
5681
  function marked(lines, line) {
4281
5682
  return MARKER.test(lines[line - 1] ?? "") || MARKER.test(lines[line - 2] ?? "");
4282
5683
  }
4283
- function toFinding(tell, hit2, texts) {
4284
- const text = texts.get(hit2.path) ?? "";
5684
+ function toFinding(tell, hit4, texts) {
5685
+ const text = texts.get(hit4.path) ?? "";
4285
5686
  return {
4286
5687
  tell: tell.id,
4287
5688
  name: tell.name,
4288
5689
  generation: tell.generation,
4289
5690
  severity: tell.severity,
4290
- path: hit2.path,
4291
- line: texts.has(hit2.path) ? lineAt(text, hit2.offset) : 0,
4292
- excerpt: hit2.excerpt ?? excerptAt(text, hit2.offset),
4293
- message: hit2.message,
5691
+ path: hit4.path,
5692
+ line: texts.has(hit4.path) ? lineAt(text, hit4.offset) : 0,
5693
+ excerpt: hit4.excerpt ?? excerptAt(text, hit4.offset),
5694
+ message: hit4.message,
4294
5695
  fix: tell.fix,
4295
5696
  ...tell.surface === "copy" ? { house: houseRule(tell.id, tell.name).tier } : {}
4296
5697
  };
@@ -4309,14 +5710,14 @@ function report(tells, files, run, options) {
4309
5710
  };
4310
5711
  const excepted = /* @__PURE__ */ new Map();
4311
5712
  for (const tell of selected) {
4312
- for (const hit2 of run(tell)) {
4313
- const exception = applied.find((e) => e.tell === tell.id && (!e.path || hit2.path.includes(e.path)));
5713
+ for (const hit4 of run(tell)) {
5714
+ const exception = applied.find((e) => e.tell === tell.id && (!e.path || hit4.path.includes(e.path)));
4314
5715
  if (exception) {
4315
5716
  excepted.set(exception, (excepted.get(exception) ?? 0) + 1);
4316
5717
  continue;
4317
5718
  }
4318
- const finding = toFinding(tell, hit2, texts);
4319
- if (marked(linesOf(hit2.path), finding.line)) {
5719
+ const finding = toFinding(tell, hit4, texts);
5720
+ if (marked(linesOf(hit4.path), finding.line)) {
4320
5721
  suppressed.push({ tell: tell.id, path: finding.path, line: finding.line });
4321
5722
  continue;
4322
5723
  }
@@ -4334,7 +5735,7 @@ function report(tells, files, run, options) {
4334
5735
  catalogueVersion: CATALOGUE_VERSION,
4335
5736
  findings,
4336
5737
  rejectedExceptions: rejected,
4337
- excepted: [...excepted].map(([e, count2]) => ({ tell: e.tell, because: e.because, count: count2 })),
5738
+ excepted: [...excepted].map(([e, count4]) => ({ tell: e.tell, because: e.because, count: count4 })),
4338
5739
  suppressed,
4339
5740
  summary: {
4340
5741
  files: files.length,
@@ -4370,11 +5771,12 @@ function auditSnapshot(snapshot, options = {}) {
4370
5771
  }
4371
5772
  function runTell(tell, files) {
4372
5773
  if (tell.surface === "source") return tell.detect({ files: files.map(parseFile) });
5774
+ if (tell.surface === "rendered") throw new Error(`${tell.id} is seen on a rendered page only; run tell.rendered.detect(snapshot)`);
4373
5775
  return tell.detect(copyContext(files));
4374
5776
  }
4375
5777
  function catalogueTable() {
4376
5778
  const rows = CATALOGUE.map(
4377
- (t) => `| \`${t.id}\` | ${t.generation} | ${t.surface}${t.rendered ? " + rendered" : ""} | ${t.severity} | ${t.name} | ${t.why.replace(/\|/g, "\\|")} |`
5779
+ (t) => `| \`${t.id}\` | ${t.generation} | ${t.surface}${t.rendered && t.surface !== "rendered" ? " + rendered" : ""} | ${t.severity} | ${t.name} | ${t.why.replace(/\|/g, "\\|")} |`
4378
5780
  );
4379
5781
  return [
4380
5782
  `Catalogue version \`${CATALOGUE_VERSION}\`, ${CATALOGUE.length} tells.`,
@@ -4439,87 +5841,6 @@ function formatReport(report2, title) {
4439
5841
  return lines.join("\n").replace(/^\n/, "");
4440
5842
  }
4441
5843
 
4442
- // src/character/facts.ts
4443
- var MONTH = "(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:t(?:ember)?)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)";
4444
- var PATTERNS = [
4445
- ["url", /\bhttps?:\/\/[^\s<>"'`)\]]+|\bwww\.[^\s<>"'`)\]]+/gi],
4446
- ["email", /\b[\w.+-]+@[\w-]+(?:\.[\w-]+)+\b/g],
4447
- ["phone", /(?:\+44\s?\(?0?\)?\s?|\b0)\d(?:[\s-]?\d){8,9}\b/g],
4448
- ["postcode", /\b[A-Z]{1,2}\d[A-Z\d]?\s?\d[A-Z]{2}\b/g],
4449
- ["money", /[£$€]\s?\d[\d,]*(?:\.\d{1,2})?(?:\s?(?:k|m|bn)\b)?|\b\d[\d,]*(?:\.\d{1,2})?\s?(?:pounds|GBP)\b/gi],
4450
- ["date", new RegExp(`\\b\\d{1,2}(?:st|nd|rd|th)?\\s+${MONTH}\\b(?:\\s+\\d{4})?|\\b${MONTH}\\s+\\d{1,2}(?:st|nd|rd|th)?\\b(?:,?\\s+\\d{4})?|\\b${MONTH}\\s+\\d{4}\\b|\\b\\d{1,2}\\/\\d{1,2}\\/\\d{2,4}\\b|\\b(?:19|20)\\d{2}\\b`, "g")],
4451
- ["time", /\b\d{1,2}(?:[:.]\d{2})?\s?(?:am|pm)\b|\b\d{1,2}:\d{2}\b/gi],
4452
- ["number", /\b\d[\d,]*(?:\.\d+)?%?|\b\d+(?:\.\d+)?\s?(?:per ?cent)\b/gi]
4453
- ];
4454
- var NAME = /[A-Z][a-zA-Z’'&-]*[a-zA-Z](?:\s+(?:of|and|&|the)?\s*[A-Z][a-zA-Z’'&-]*[a-zA-Z])*/g;
4455
- var normalise = (kind, value) => {
4456
- const v = value.trim();
4457
- if (kind === "phone") return v.replace(/[^\d+]/g, "").replace(/^\+44\(?0?\)?/, "0").replace(/^\+44/, "0");
4458
- if (kind === "money" || kind === "number") return v.replace(/[\s,]/g, "").toLowerCase();
4459
- if (kind === "postcode") return v.replace(/\s/g, "").toUpperCase();
4460
- if (kind === "url") return v.replace(/[.,;:]+$/, "").toLowerCase();
4461
- return v.replace(/\s+/g, " ").toLowerCase();
4462
- };
4463
- function visibleText(file) {
4464
- const prose = /\.(md|markdown|mdx|txt)$/i.test(file.path);
4465
- return (prose ? extractCopy(file) : extractStrings(file)).map((b) => b.text).join("\n");
4466
- }
4467
- function protectedFacts(text) {
4468
- const facts = [];
4469
- let rest = text;
4470
- const mask = (start, length) => {
4471
- rest = rest.slice(0, start) + " ".repeat(length) + rest.slice(start + length);
4472
- };
4473
- for (const [kind, pattern] of PATTERNS) {
4474
- for (const m of [...rest.matchAll(pattern)]) {
4475
- const value = m[0].replace(/[.,;:]+$/, "");
4476
- facts.push({ kind, value, key: `${kind}:${normalise(kind, value)}` });
4477
- mask(m.index ?? 0, m[0].length);
4478
- }
4479
- }
4480
- const lines = rest.split("\n");
4481
- for (const line of lines) {
4482
- if (/^\s{0,3}#{1,6}\s/.test(line)) continue;
4483
- for (const m of line.matchAll(NAME)) {
4484
- const at = m.index ?? 0;
4485
- const before = line.slice(0, at).trimEnd();
4486
- const opensSentence = before === "" || /[.!?:"“(>*-]$/.test(before) || /^\s*(?:[-*+]|\d+\.)$/.test(before);
4487
- const word = m[0];
4488
- const acronym = /^[A-Z]{2,}$/.test(word);
4489
- if (opensSentence && !acronym && !/\s/.test(word)) continue;
4490
- if (word === "I") continue;
4491
- facts.push({ kind: "name", value: word, key: `name:${normalise("name", word)}` });
4492
- }
4493
- }
4494
- return facts;
4495
- }
4496
- var unique = (facts) => [...new Map(facts.map((f4) => [f4.key, f4])).values()];
4497
- function compareFacts(before, after) {
4498
- const a = unique(protectedFacts(before));
4499
- const b = unique(protectedFacts(after));
4500
- const inA = new Set(a.map((f4) => f4.key));
4501
- const inB = new Set(b.map((f4) => f4.key));
4502
- return {
4503
- before: a.length,
4504
- after: b.length,
4505
- lost: a.filter((f4) => !inB.has(f4.key)),
4506
- added: b.filter((f4) => !inA.has(f4.key))
4507
- };
4508
- }
4509
- function formatComparison(result, beforePath, afterPath) {
4510
- const lines = [`craft copy compare: ${beforePath} -> ${afterPath}`, ` ${result.before} protected facts before, ${result.after} after`];
4511
- if (result.lost.length) {
4512
- lines.push("", ` Lost (${result.lost.length}): restore each, or say why it went`);
4513
- for (const f4 of result.lost) lines.push(` ${f4.kind.padEnd(9)} ${f4.value}`);
4514
- }
4515
- if (result.added.length) {
4516
- lines.push("", ` Added (${result.added.length}): each needs a source, or it is invented`);
4517
- for (const f4 of result.added) lines.push(` ${f4.kind.padEnd(9)} ${f4.value}`);
4518
- }
4519
- if (!result.lost.length && !result.added.length) lines.push("", " Every fact kept, nothing added.");
4520
- return lines.join("\n");
4521
- }
4522
-
4523
5844
  // src/character/claims.ts
4524
5845
  var CLAIM_KINDS = /* @__PURE__ */ new Set(["money", "number", "date"]);
4525
5846
  var PROPER = "[A-Z][\\w&.\u2019'-]*(?:\\s+(?:of|and|&|the|for)?\\s*[A-Z][\\w&.\u2019'-]*)*";
@@ -4822,6 +6143,41 @@ function toJson(data) {
4822
6143
  return JSON.stringify({ schemaVersion: JSON_SCHEMA_VERSION, ...data }, null, 2);
4823
6144
  }
4824
6145
 
6146
+ // src/snapshot/provenance.ts
6147
+ var PROVENANCE_SCAN_BYTES = 256 * 1024;
6148
+ var AI_SOURCE_TYPES = ["compositeWithTrainedAlgorithmicMedia", "trainedAlgorithmicMedia"];
6149
+ var MARKER2 = new RegExp(`(?:${AI_SOURCE_TYPES.join("|")})`);
6150
+ var C2PA_BOX = /jumd[\s\S]{16,24}c2pa/;
6151
+ var C2PA_PNG = /caBX/;
6152
+ function latin1(bytes) {
6153
+ let out = "";
6154
+ for (let i = 0; i < bytes.length; i += 8192) {
6155
+ out += String.fromCharCode(...bytes.subarray(i, Math.min(bytes.length, i + 8192)));
6156
+ }
6157
+ return out;
6158
+ }
6159
+ function xmpPackets(text) {
6160
+ const out = [];
6161
+ const open = /<x:xmpmeta\b|<\?xpacket begin/g;
6162
+ let m;
6163
+ while (m = open.exec(text)) {
6164
+ const close = text.indexOf(m[0].startsWith("<x:") ? "</x:xmpmeta>" : "<?xpacket end", m.index);
6165
+ out.push([m.index, close === -1 ? text.length : close]);
6166
+ if (close === -1) break;
6167
+ open.lastIndex = close;
6168
+ }
6169
+ return out;
6170
+ }
6171
+ function scanProvenance(bytes) {
6172
+ const head = bytes.subarray(0, PROVENANCE_SCAN_BYTES);
6173
+ const text = latin1(head);
6174
+ const c2pa = C2PA_BOX.test(text) || text.startsWith("\x89PNG") && C2PA_PNG.test(text);
6175
+ const m = MARKER2.exec(text);
6176
+ if (!m) return { digitalSourceType: null, source: null, c2pa, bytes: head.length };
6177
+ const inXmp = xmpPackets(text).some(([a, b]) => m.index >= a && m.index < b);
6178
+ return { digitalSourceType: m[0], source: inXmp ? "xmp" : c2pa ? "c2pa" : "other", c2pa, bytes: head.length };
6179
+ }
6180
+
4825
6181
  // src/snapshot/migrate.ts
4826
6182
  var READABLE_SNAPSHOT_VERSIONS = [1, 2];
4827
6183
  function readSnapshot(data, source = "snapshot") {
@@ -4863,143 +6219,34 @@ function visualMeasures(img, maxSamples = 1e6) {
4863
6219
  const yb = 0.5 * (r + g) - b;
4864
6220
  sumRg += rg;
4865
6221
  sumYb += yb;
4866
- sumRg2 += rg * rg;
4867
- sumYb2 += yb * yb;
4868
- n += 1;
4869
- const l = lum(x, y);
4870
- if (x + step < w && y + step < h) {
4871
- if (Math.abs(lum(x + step, y) - l) + Math.abs(lum(x, y + step) - l) > EDGE_STEP) edges += 1;
4872
- edgeN += 1;
4873
- }
4874
- if (x < w / 2) {
4875
- asym += Math.abs(l - lum(w - 1 - x, y));
4876
- asymN += 1;
4877
- }
4878
- }
4879
- }
4880
- const meanRg = sumRg / n;
4881
- const meanYb = sumYb / n;
4882
- const sdRg = Math.sqrt(Math.max(0, sumRg2 / n - meanRg * meanRg));
4883
- const sdYb = Math.sqrt(Math.max(0, sumYb2 / n - meanYb * meanYb));
4884
- const colourfulness = Math.sqrt(sdRg ** 2 + sdYb ** 2) + 0.3 * Math.sqrt(meanRg ** 2 + meanYb ** 2);
4885
- const round2 = (v, d = 3) => Math.round(v * 10 ** d) / 10 ** d;
4886
- return {
4887
- colourfulness: round2(colourfulness, 1),
4888
- edgeDensity: round2(edgeN ? edges / edgeN : 0),
4889
- symmetry: round2(asymN ? 1 - asym / asymN / 255 : 1),
4890
- width: w,
4891
- height: h,
4892
- sampled: n
4893
- };
4894
- }
4895
-
4896
- // src/fingerprint/index.ts
4897
- var FINGERPRINT_VERSION = 2;
4898
- var CHROMATIC = 0.03;
4899
- var MIN_ACCENT_AREA = 2e4;
4900
- var oklch = (value) => {
4901
- const parsed = parseColour(value);
4902
- return parsed && parsed.alpha > 0.5 ? parsed.oklch : null;
4903
- };
4904
- function accentOf(s) {
4905
- const buttons = /* @__PURE__ */ new Map();
4906
- for (const c of s.controls) {
4907
- const o = oklch(c.background);
4908
- if (o && o.c >= CHROMATIC) buttons.set(c.background, (buttons.get(c.background) ?? 0) + 1);
4909
- }
4910
- const topButton = [...buttons].sort((a, b) => b[1] - a[1])[0];
4911
- if (topButton) return oklch(topButton[0]);
4912
- const bg = s.colours.backgrounds.map((b) => ({ o: oklch(b.value), w: b.area })).filter((x) => x.o && x.o.c >= CHROMATIC && x.w >= MIN_ACCENT_AREA).sort((a, b) => b.w - a.w)[0];
4913
- if (bg) return bg.o;
4914
- const text = s.colours.text.map((t) => ({ o: oklch(t.value), w: t.chars })).filter((x) => x.o && x.o.c >= CHROMATIC).sort((a, b) => b.w - a.w)[0];
4915
- return text ? text.o : null;
4916
- }
4917
- function faces(s) {
4918
- const byChars = [...s.fonts].sort((a, b) => b.chars - a.chars);
4919
- const byDisplay = [...s.fonts].sort((a, b) => b.displayChars - a.displayChars);
4920
- const bodyName = normaliseFamily(byChars[0]?.family ?? "system-ui");
4921
- const displayName = normaliseFamily((byDisplay[0]?.displayChars ? byDisplay[0].family : byChars[0]?.family) ?? "system-ui");
4922
- return {
4923
- display: { family: displayName, class: fontClass(displayName) },
4924
- body: { family: bodyName, class: fontClass(bodyName) }
4925
- };
4926
- }
4927
- function median(values) {
4928
- if (values.length === 0) return null;
4929
- const sorted = [...values].sort((a, b) => a - b);
4930
- const mid = Math.floor(sorted.length / 2);
4931
- return sorted.length % 2 ? sorted[mid] : (sorted[mid - 1] + sorted[mid]) / 2;
4932
- }
4933
- function fingerprint(s) {
4934
- const effects = [];
4935
- if (s.effects.glass > 0) effects.push("glass-panel");
4936
- if (s.effects.gradientText > 0) effects.push("gradient-text");
4937
- if (s.effects.glows > 0 || s.effects.gradients.some((g) => g.radial)) effects.push("radial-spotlight-glow");
4938
- if (s.effects.gridBackgrounds > 0) effects.push("grid-background");
4939
- if (s.effects.marquees > 0) effects.push("marquee");
4940
- if (s.effects.hairlineShadowCards >= 3) effects.push("thin-border-wide-shadow");
4941
- if (s.effects.eyebrowChip) effects.push("hero-eyebrow-chip");
4942
- if (s.motion.introOverlay) effects.push("intro-cinematic");
4943
- const below = s.sections.filter((x) => x.top > s.viewport.height).length;
4944
- return {
4945
- version: FINGERPRINT_VERSION,
4946
- accent: accentOf(s),
4947
- ground: oklch(s.ground) ?? { l: 1, c: 0, h: 0 },
4948
- ...faces(s),
4949
- roundness: median(s.controls.map((c) => Math.min(0.5, c.radiusPx / Math.max(1, c.heightPx)))),
4950
- motion: below ? Math.min(1, s.motion.hiddenSections / below) : 0,
4951
- effects: effects.sort(),
4952
- layout: s.sections.map((x) => x.kind),
4953
- ...s.sections.length > 0 && s.sections.every((x) => x.role && x.geometry) ? { sections: s.sections.map((x) => ({ role: x.role, centred: x.geometry.centredShare, width: x.geometry.contentWidthRatio })) } : {}
4954
- };
4955
- }
4956
- var DISTANCE_WEIGHTS = { accent: 0.25, type: 0.25, ground: 0.1, shape: 0.1, motion: 0.1, effects: 0.1, layout: 0.1 };
4957
- function levenshtein(a, b, cost = (x, y) => x === y ? 0 : 1) {
4958
- const row = Array.from({ length: b.length + 1 }, (_, i) => i);
4959
- for (let i = 1; i <= a.length; i += 1) {
4960
- let prev = row[0];
4961
- row[0] = i;
4962
- for (let j = 1; j <= b.length; j += 1) {
4963
- const cur = row[j];
4964
- row[j] = Math.min(row[j] + 1, row[j - 1] + 1, prev + cost(a[i - 1], b[j - 1]));
4965
- prev = cur;
4966
- }
4967
- }
4968
- return row[b.length];
4969
- }
4970
- function sectionCost(x, y) {
4971
- if (x.role !== y.role) return 1;
4972
- return Math.min(0.5, (Math.abs(x.centred - y.centred) + Math.abs(x.width - y.width)) / 2);
4973
- }
4974
- function layoutDistance(a, b) {
4975
- if (a.sections && b.sections) {
4976
- const longest2 = Math.max(a.sections.length, b.sections.length);
4977
- return longest2 === 0 ? 0 : levenshtein(a.sections, b.sections, sectionCost) / longest2;
4978
- }
4979
- const longest = Math.max(a.layout.length, b.layout.length);
4980
- return longest === 0 ? 0 : levenshtein(a.layout, b.layout) / longest;
4981
- }
4982
- var clamp = (n) => Math.max(0, Math.min(1, n));
4983
- function faceDistance(a, b) {
4984
- if (a.family.toLowerCase() === b.family.toLowerCase()) return 0;
4985
- return a.class === b.class ? 0.5 : 1;
4986
- }
4987
- function fingerprintDistance(a, b) {
4988
- const accent = a.accent && b.accent ? clamp(deltaEOk(a.accent, b.accent) / 0.3) : a.accent || b.accent ? 1 : 0;
4989
- const ground = clamp(deltaEOk(a.ground, b.ground) / 0.15);
4990
- const type = 0.6 * faceDistance(a.display, b.display) + 0.4 * faceDistance(a.body, b.body);
4991
- const shape = a.roundness === null || b.roundness === null ? a.roundness === b.roundness ? 0 : 0.5 : clamp(Math.abs(a.roundness - b.roundness) / 0.5);
4992
- const motion = clamp(Math.abs(a.motion - b.motion));
4993
- const union = /* @__PURE__ */ new Set([...a.effects, ...b.effects]);
4994
- const shared = a.effects.filter((e) => b.effects.includes(e)).length;
4995
- const effects = union.size === 0 ? 0 : 1 - shared / union.size;
4996
- const layout = layoutDistance(a, b);
4997
- const parts2 = { accent, ground, type, shape, motion, effects, layout };
4998
- const total = Object.keys(DISTANCE_WEIGHTS).reduce((sum, k) => sum + DISTANCE_WEIGHTS[k] * parts2[k], 0);
4999
- return { total: Math.round(total * 1e3) / 1e3, parts: parts2 };
5000
- }
5001
- function nearest(target2, set, k = set.length) {
5002
- return set.map((item) => ({ id: item.id, distance: fingerprintDistance(target2, item.fingerprint) })).sort((x, y) => x.distance.total - y.distance.total).slice(0, k);
6222
+ sumRg2 += rg * rg;
6223
+ sumYb2 += yb * yb;
6224
+ n += 1;
6225
+ const l = lum(x, y);
6226
+ if (x + step < w && y + step < h) {
6227
+ if (Math.abs(lum(x + step, y) - l) + Math.abs(lum(x, y + step) - l) > EDGE_STEP) edges += 1;
6228
+ edgeN += 1;
6229
+ }
6230
+ if (x < w / 2) {
6231
+ asym += Math.abs(l - lum(w - 1 - x, y));
6232
+ asymN += 1;
6233
+ }
6234
+ }
6235
+ }
6236
+ const meanRg = sumRg / n;
6237
+ const meanYb = sumYb / n;
6238
+ const sdRg = Math.sqrt(Math.max(0, sumRg2 / n - meanRg * meanRg));
6239
+ const sdYb = Math.sqrt(Math.max(0, sumYb2 / n - meanYb * meanYb));
6240
+ const colourfulness = Math.sqrt(sdRg ** 2 + sdYb ** 2) + 0.3 * Math.sqrt(meanRg ** 2 + meanYb ** 2);
6241
+ const round2 = (v, d = 3) => Math.round(v * 10 ** d) / 10 ** d;
6242
+ return {
6243
+ colourfulness: round2(colourfulness, 1),
6244
+ edgeDensity: round2(edgeN ? edges / edgeN : 0),
6245
+ symmetry: round2(asymN ? 1 - asym / asymN / 255 : 1),
6246
+ width: w,
6247
+ height: h,
6248
+ sampled: n
6249
+ };
5003
6250
  }
5004
6251
 
5005
6252
  // src/direction/types.ts
@@ -5136,9 +6383,9 @@ function licencesJson() {
5136
6383
  var PREFERENCE = /\b(?:client (?:likes|liked|wants|wanted|asked|chose|prefers?)|(?:we|they|i) (?:like|liked|love|loved|prefer)|on[- ]trend|trendy|popular|what (?:everyone|competitors) (?:uses?|does)|brand (?:colou?r|font|guidelines?) (?:is|are|says?))\b/i;
5137
6384
  var MOOD = /\b(?:modern|clean|fresh|professional|trustworthy|premium|elegant|sleek|timeless|minimal(?:ist)?|bold|vibrant|friendly|approachable|luxur(?:y|ious)|sophisticated|contemporary|stylish|warm|inviting|high[- ]end)\b/gi;
5138
6385
  var VALUE_WORDS = /* @__PURE__ */ new Set(["green", "blue", "navy", "black", "white", "cream", "grey", "gray", "gold", "yellow", "orange", "purple", "violet", "pink", "brown", "teal", "bottle", "dark", "light", "deep", "pale", "bright", "colour", "color", "font", "face", "serif", "sans", "type", "lettering"]);
5139
- var STOP = /* @__PURE__ */ new Set(["with", "that", "this", "from", "their", "they", "have", "been", "were", "which", "what", "when", "where", "there", "about", "into", "onto", "over", "same", "each", "every"]);
6386
+ var STOP2 = /* @__PURE__ */ new Set(["with", "that", "this", "from", "their", "they", "have", "been", "were", "which", "what", "when", "where", "there", "about", "into", "onto", "over", "same", "each", "every"]);
5140
6387
  function words(text) {
5141
- return new Set((text.toLowerCase().match(/[a-z][a-z'-]{3,}/g) ?? []).map((w) => w.replace(/'s$/, "")).filter((w) => !STOP.has(w) && !VALUE_WORDS.has(w)));
6388
+ return new Set((text.toLowerCase().match(/[a-z][a-z'-]{3,}/g) ?? []).map((w) => w.replace(/'s$/, "")).filter((w) => !STOP2.has(w) && !VALUE_WORDS.has(w)));
5142
6389
  }
5143
6390
  function tellFor(key, value) {
5144
6391
  if (key === "accent") {
@@ -5271,14 +6518,14 @@ function validateDirection(input, ctx = {}) {
5271
6518
  if (fp && typeof c.value === "string") {
5272
6519
  if ((key === "accent" || key === "ground") && parseColour(c.value)) {
5273
6520
  const declared = parseColour(c.value).oklch;
5274
- const measured = key === "accent" ? fp.accent : fp.ground;
5275
- if (measured && deltaEOk(declared, measured) > 0.08) {
5276
- warn(`${at}.value`, `the page does not show it: its ${key} measures oklch(${measured.l.toFixed(2)} ${measured.c.toFixed(3)} ${measured.h.toFixed(0)})`);
6521
+ const measured2 = key === "accent" ? fp.accent : fp.ground;
6522
+ if (measured2 && deltaEOk(declared, measured2) > 0.08) {
6523
+ warn(`${at}.value`, `the page does not show it: its ${key} measures oklch(${measured2.l.toFixed(2)} ${measured2.c.toFixed(3)} ${measured2.h.toFixed(0)})`);
5277
6524
  }
5278
6525
  }
5279
6526
  if (key === "display" || key === "body") {
5280
- const measured = key === "display" ? fp.display.family : fp.body.family;
5281
- if (normaliseFamily(c.value).toLowerCase() !== measured.toLowerCase()) warn(`${at}.value`, `the page sets ${measured}, not ${c.value}`);
6527
+ const measured2 = key === "display" ? fp.display.family : fp.body.family;
6528
+ if (normaliseFamily(c.value).toLowerCase() !== measured2.toLowerCase()) warn(`${at}.value`, `the page sets ${measured2}, not ${c.value}`);
5282
6529
  }
5283
6530
  }
5284
6531
  if (ok) decided += 1;
@@ -5289,8 +6536,8 @@ function validateDirection(input, ctx = {}) {
5289
6536
  // src/direction/init.ts
5290
6537
  var hex = (o) => {
5291
6538
  const { r, g, b } = oklchToRgb(o);
5292
- const clamp2 = (n) => Math.min(1, Math.max(0, n));
5293
- return formatHex({ r: clamp2(r), g: clamp2(g), b: clamp2(b) });
6539
+ const clamp3 = (n) => Math.min(1, Math.max(0, n));
6540
+ return formatHex({ r: clamp3(r), g: clamp3(g), b: clamp3(b) });
5294
6541
  };
5295
6542
  function initDirection(input) {
5296
6543
  const fp = input.current;
@@ -5430,240 +6677,6 @@ function propose(input) {
5430
6677
  };
5431
6678
  }
5432
6679
 
5433
- // src/null/index.ts
5434
- var NULL_VERSION = 1;
5435
- function nullPrompt(brief) {
5436
- return [
5437
- `Build the home page for this business: ${brief.trim()}`,
5438
- "",
5439
- "Write it as one complete, self-contained HTML file. You may load fonts and libraries from a CDN. Use real copy, not placeholder text. Reply with the HTML only."
5440
- ].join("\n");
5441
- }
5442
- function extractHtml(reply) {
5443
- const start = reply.search(/<!doctype html|<html[\s>]/i);
5444
- if (start < 0) return null;
5445
- const end = reply.toLowerCase().lastIndexOf("</html>");
5446
- const html = end > start ? reply.slice(start, end + "</html>".length) : reply.slice(start).replace(/\s*```\s*$/, "");
5447
- return html.length > 200 ? html : null;
5448
- }
5449
- var MIN_RUNS = 5;
5450
- var TYPICAL_AT = 0.1;
5451
- function meanNearest(distances, k) {
5452
- const sorted = [...distances].sort((a, b) => a - b).slice(0, k);
5453
- return sorted.reduce((s, d) => s + d, 0) / sorted.length;
5454
- }
5455
- function median2(values) {
5456
- const sorted = [...values].sort((a, b) => a - b);
5457
- const mid = Math.floor(sorted.length / 2);
5458
- return sorted.length % 2 ? sorted[mid] : (sorted[mid - 1] + sorted[mid]) / 2;
5459
- }
5460
- function typicality(target2, runs, k = 3) {
5461
- if (runs.length < MIN_RUNS) throw new Error(`a null model needs at least ${MIN_RUNS} runs; this one has ${runs.length}`);
5462
- const kk = Math.min(k, runs.length - 1);
5463
- const toTarget = runs.map((r) => ({ id: r.id, distance: fingerprintDistance(target2, r.fingerprint).total }));
5464
- const distance = meanNearest(
5465
- toTarget.map((t) => t.distance),
5466
- kk
5467
- );
5468
- const loo = runs.map(
5469
- (r, i) => meanNearest(
5470
- runs.filter((_, j) => j !== i).map((o) => fingerprintDistance(r.fingerprint, o.fingerprint).total),
5471
- kk
5472
- )
5473
- );
5474
- const score = loo.filter((d) => d >= distance).length / loo.length;
5475
- return {
5476
- score: Math.round(score * 100) / 100,
5477
- typical: score >= TYPICAL_AT,
5478
- distance: Math.round(distance * 1e3) / 1e3,
5479
- baseline: Math.round(median2(loo) * 1e3) / 1e3,
5480
- nearest: toTarget.sort((a, b) => a.distance - b.distance).slice(0, kk),
5481
- shared: sharedChoices(target2, runs)
5482
- };
5483
- }
5484
- var HUES = [
5485
- ["red", 0, 45],
5486
- ["orange", 45, 75],
5487
- ["yellow", 75, 110],
5488
- ["green", 110, 165],
5489
- ["teal", 165, 215],
5490
- ["blue", 215, 265],
5491
- ["violet", 265, 315],
5492
- ["pink", 315, 360]
5493
- ];
5494
- function hueName(o) {
5495
- if (!o) return "none";
5496
- if (o.c < 0.03) return "neutral";
5497
- return HUES.find(([, lo, hi]) => o.h >= lo && o.h < hi)?.[0] ?? "red";
5498
- }
5499
- function groundName(o) {
5500
- if (o.l < 0.3) return "dark";
5501
- if (isCream(o)) return "cream";
5502
- if (o.l >= 0.97 && o.c < 0.012) return "white";
5503
- return o.c < 0.02 ? "grey" : "tinted";
5504
- }
5505
- function shapeName(roundness) {
5506
- if (roundness === null) return "no buttons";
5507
- if (roundness >= 0.45) return "pill";
5508
- return roundness >= 0.15 ? "soft" : "square";
5509
- }
5510
- function choicesOf(fp) {
5511
- return {
5512
- display: [fp.display.family],
5513
- body: [fp.body.family],
5514
- accent: [hueName(fp.accent)],
5515
- ground: [groundName(fp.ground)],
5516
- shape: [shapeName(fp.roundness)],
5517
- motion: [fp.motion >= 0.6 ? "reveals most sections" : fp.motion > 0 ? "reveals some sections" : "no scroll reveals"],
5518
- effects: fp.effects,
5519
- opening: [fp.layout.slice(0, 3).join(" > ") || "none"]
5520
- };
5521
- }
5522
- function sharedChoices(target2, runs) {
5523
- const mine = choicesOf(target2);
5524
- const all = runs.map((r) => choicesOf(r.fingerprint));
5525
- const out = [];
5526
- for (const [part, values] of Object.entries(mine)) {
5527
- for (const value of values) {
5528
- const count2 = all.filter((c) => c[part].includes(value)).length;
5529
- if (count2 / runs.length >= 0.25) out.push({ part, value, runs: count2, of: runs.length });
5530
- }
5531
- }
5532
- return out.sort((a, b) => b.runs - a.runs);
5533
- }
5534
- var REFLEX_1 = new Set(REFLEX_FONTS_1.map((f4) => f4.toLowerCase()));
5535
- var REFLEX_2 = new Set(REFLEX_FONTS_2.map((f4) => f4.toLowerCase()));
5536
- function knownFor(kind, value, sample) {
5537
- if (kind === "face") return REFLEX_1.has(value.toLowerCase()) ? "reflex-font" : REFLEX_2.has(value.toLowerCase()) ? "reflex-font-2" : null;
5538
- if (kind === "accent" && value === "violet") return sample.some((f4) => f4.accent && isAiViolet(f4.accent)) ? "ai-violet" : null;
5539
- if (kind === "ground" && value === "cream") return "cream-palette";
5540
- if (kind === "shape" && value === "pill") return "pill-everything";
5541
- if (kind === "motion" && value === "reveals most sections") return "reveal-everywhere";
5542
- if (kind === "tell") return value;
5543
- if (kind === "opening" && /^hero > (?:logos|stats)/.test(value)) return "hero-then-proof";
5544
- return null;
5545
- }
5546
- var STOP2 = new Set(
5547
- "a an the and or but of to in on for with at by from as is are be we our you your us it its this that these those will can all more get has have not no any".split(" ")
5548
- );
5549
- function grams(text) {
5550
- const out = /* @__PURE__ */ new Set();
5551
- for (const clause of text.toLowerCase().replace(/[’']/g, "'").split(/[.!?;:|()\u2013\u2014\u00b7•]+|,\s/)) {
5552
- const words2 = clause.match(/[a-z][a-z'-]*/g) ?? [];
5553
- for (let n = 2; n <= 4; n += 1) {
5554
- for (let i = 0; i + n <= words2.length; i += 1) {
5555
- const g = words2.slice(i, i + n);
5556
- if (STOP2.has(g[0]) || STOP2.has(g[n - 1])) continue;
5557
- if (g.filter((w) => !STOP2.has(w)).length < 2) continue;
5558
- out.add(g.join(" "));
5559
- }
5560
- }
5561
- }
5562
- return out;
5563
- }
5564
- var GRAMMAR = /* @__PURE__ */ new Set([
5565
- "privacy policy",
5566
- "cookie policy",
5567
- "rights reserved",
5568
- "all rights reserved",
5569
- "terms of service",
5570
- "terms and conditions",
5571
- "terms conditions",
5572
- "how it works",
5573
- "what we do",
5574
- "about us",
5575
- "contact us",
5576
- "get in touch",
5577
- "opening hours",
5578
- "read more",
5579
- "learn more",
5580
- "book now",
5581
- "free quote",
5582
- "our services",
5583
- "quick links",
5584
- "email address",
5585
- "phone number",
5586
- "full name",
5587
- "first name",
5588
- "last name",
5589
- "your name",
5590
- "your email",
5591
- "send message"
5592
- ]);
5593
- var LEGAL = /©|&copy;|\bregistered (?:in|office|number)\b|\bcompany (?:no|number|reg)|\bvat (?:no|number|reg)/i;
5594
- var NOISE = /\S+@\S+|https?:\/\/\S+|\b[\w-]+(?:\.[\w-]+)*\.(?:co\.uk|com|org|net|uk|io)\b|\b\d{1,2}(?:[:.]\d{2})?\s*(?:am|pm)\b|\d+/gi;
5595
- function textGrams(text) {
5596
- if (LEGAL.test(text)) return /* @__PURE__ */ new Set();
5597
- const out = grams(text.replace(NOISE, " | "));
5598
- for (const g of out) if (GRAMMAR.has(g)) out.delete(g);
5599
- return out;
5600
- }
5601
- function properNouns(brief) {
5602
- return new Set((brief.match(/\b[A-Z][a-z]+/g) ?? []).map((w) => w.toLowerCase()).filter((w) => !STOP2.has(w)));
5603
- }
5604
- function harvest(models, options = {}) {
5605
- const minShare = options.minShare ?? 0.25;
5606
- const runs = models.flatMap((m, b) => m.runs.map((r) => ({ ...r, brief: b })));
5607
- const of = runs.length;
5608
- if (of === 0) return [];
5609
- const multiBrief = models.length > 1;
5610
- const sample = runs.map((r) => r.fingerprint);
5611
- const tally = /* @__PURE__ */ new Map();
5612
- const add = (kind, value, run, brief, example) => {
5613
- const key = `${kind}\0${value}`;
5614
- const t = tally.get(key) ?? { kind, value, runs: /* @__PURE__ */ new Set(), briefs: /* @__PURE__ */ new Set(), example };
5615
- t.runs.add(run);
5616
- t.briefs.add(brief);
5617
- tally.set(key, t);
5618
- };
5619
- runs.forEach((r, i) => {
5620
- const c = choicesOf(r.fingerprint);
5621
- for (const f4 of /* @__PURE__ */ new Set([...c.display, ...c.body])) add("face", f4, i, r.brief);
5622
- add("accent", c.accent[0], i, r.brief);
5623
- add("ground", c.ground[0], i, r.brief);
5624
- add("shape", c.shape[0], i, r.brief);
5625
- add("motion", c.motion[0], i, r.brief);
5626
- add("opening", c.opening[0], i, r.brief);
5627
- for (const t of r.tells) add("tell", t, i, r.brief);
5628
- });
5629
- const out = [];
5630
- for (const t of tally.values()) {
5631
- if (t.runs.size / of < minShare) continue;
5632
- if (t.kind === "accent" && (t.value === "none" || t.value === "neutral")) continue;
5633
- if (t.kind === "shape" && t.value === "no buttons") continue;
5634
- if (t.kind === "ground" && (t.value === "white" || t.value === "grey")) continue;
5635
- if (t.kind === "motion" && t.value === "no scroll reveals") continue;
5636
- out.push({ kind: t.kind, value: t.value, runs: t.runs.size, of, briefs: t.briefs.size, known: knownFor(t.kind, t.value, sample) });
5637
- }
5638
- const phraseMin = Math.max(3, Math.ceil(of * minShare * 0.4));
5639
- const names = models.map((m) => properNouns(m.brief));
5640
- const phrases2 = /* @__PURE__ */ new Map();
5641
- runs.forEach((r, i) => {
5642
- for (const text of r.copy) {
5643
- for (const g of textGrams(text)) {
5644
- if (g.split(" ").some((w) => names[r.brief].has(w))) continue;
5645
- const p = phrases2.get(g) ?? { runs: /* @__PURE__ */ new Set(), briefs: /* @__PURE__ */ new Set(), example: text.trim().slice(0, 140) };
5646
- p.runs.add(i);
5647
- p.briefs.add(r.brief);
5648
- phrases2.set(g, p);
5649
- }
5650
- }
5651
- });
5652
- const kept = [...phrases2].filter(([, p]) => p.runs.size >= phraseMin && (!multiBrief || p.briefs.size >= 2)).sort((a, b) => b[1].runs.size - a[1].runs.size || b[0].length - a[0].length);
5653
- const maximal = kept.filter(([g, p]) => !kept.some(([h, q]) => h !== g && h.includes(g) && q.runs.size >= 0.8 * p.runs.size));
5654
- for (const [g, p] of maximal.slice(0, 40)) {
5655
- out.push({ kind: "phrase", value: g, runs: p.runs.size, of, briefs: p.briefs.size, known: options.copyTell?.(g) ?? null, example: p.example });
5656
- }
5657
- const order = ["face", "accent", "ground", "shape", "motion", "opening", "tell", "phrase"];
5658
- return out.sort((a, b) => order.indexOf(a.kind) - order.indexOf(b.kind) || b.runs - a.runs);
5659
- }
5660
- function hueSwatch(runs, hue) {
5661
- const hits = runs.map((r) => r.fingerprint.accent).filter((o) => !!o && hueName(o) === hue);
5662
- if (hits.length === 0) return null;
5663
- const centre = hits.reduce((best, o) => hits.reduce((s, p) => s + deltaEOk(o, p), 0) < hits.reduce((s, p) => s + deltaEOk(best, p), 0) ? o : best);
5664
- return formatHex(oklchToRgb(centre));
5665
- }
5666
-
5667
6680
  // src/estate/index.ts
5668
6681
  var ESTATE_VERSION = 1;
5669
6682
  var SIBLING_AT = 0.31;
@@ -5920,6 +6933,7 @@ function retrofitPlan(report2, direction) {
5920
6933
  }
5921
6934
  export {
5922
6935
  AI_PHRASES,
6936
+ AI_SOURCE_TYPES,
5923
6937
  AI_VIOLET,
5924
6938
  AI_WORDS,
5925
6939
  BASELINE_VERSION,
@@ -5927,6 +6941,7 @@ export {
5927
6941
  CATALOGUE,
5928
6942
  CATALOGUE_VERSION,
5929
6943
  CHOICE_KEYS,
6944
+ COMPONENT_ROLES,
5930
6945
  DEFAULT_IGNORE,
5931
6946
  DENSITIES,
5932
6947
  DENSITY_NAMES,
@@ -5940,10 +6955,13 @@ export {
5940
6955
  ESTATE_VERSION,
5941
6956
  EXIT_RATIO,
5942
6957
  FINGERPRINT_VERSION,
6958
+ HOME_FILE,
6959
+ HOME_URL,
5943
6960
  HOUSE,
5944
6961
  HOUSE_BUDGET,
5945
6962
  HOUSE_LOCKED,
5946
6963
  HOUSE_TYPE,
6964
+ IMAGERY_TELLS,
5947
6965
  JSON_SCHEMA_VERSION,
5948
6966
  LICENCES,
5949
6967
  LIGHTNESS_CURVE,
@@ -5953,12 +6971,16 @@ export {
5953
6971
  NULL_VERSION,
5954
6972
  PILL_LIMIT,
5955
6973
  PLAINER_WORDS,
6974
+ PROMO_BADGE,
6975
+ PROOF_NAMES,
5956
6976
  PROPOSED,
6977
+ PROVENANCE_SCAN_BYTES,
5957
6978
  RAMP_STEPS,
5958
6979
  READABLE_SNAPSHOT_VERSIONS,
5959
6980
  REFLEX_FONTS_1,
5960
6981
  REFLEX_FONTS_2,
5961
6982
  RENDERED_PATHS,
6983
+ RENDERED_TELLS,
5962
6984
  REVEAL_LIMIT,
5963
6985
  REVIEW_PHRASES,
5964
6986
  SCALE,
@@ -5968,9 +6990,16 @@ export {
5968
6990
  SNAPSHOT_VERSION,
5969
6991
  SOURCE_KINDS,
5970
6992
  SPACE_STEPS,
6993
+ SPECIFICITY_COPY_TELLS,
6994
+ SPECIFICITY_RENDERED_TELLS,
5971
6995
  SPRING,
6996
+ STANDING_CLAIM,
6997
+ STOCK_AVATAR_HOSTS,
6998
+ STOCK_FIGURES,
6999
+ STOCK_PHOTO_HOSTS,
5972
7000
  STOCK_PHRASES,
5973
7001
  TELL_HEAVY,
7002
+ TRADE_NOUNS,
5974
7003
  TYPE_STEPS,
5975
7004
  TYPICAL_AT,
5976
7005
  VAGUE_WORDS,
@@ -5981,14 +7010,23 @@ export {
5981
7010
  applyHouseGate,
5982
7011
  applySeverity,
5983
7012
  auditSnapshot,
7013
+ briefTerms,
5984
7014
  catalogueTable,
5985
7015
  characterReport,
5986
7016
  checkCopy,
5987
7017
  checkPair,
5988
7018
  checkRestraint,
5989
7019
  choicesOf,
7020
+ closestComponents,
7021
+ compareCompetitor,
5990
7022
  compareFacts,
5991
7023
  compareToEstate,
7024
+ componentDistance,
7025
+ componentShared,
7026
+ componentTypicalities,
7027
+ componentTypicality,
7028
+ componentsOf,
7029
+ countWords2 as countWords,
5992
7030
  craftTokens,
5993
7031
  createBaseline,
5994
7032
  deltaEOk,
@@ -5997,6 +7035,7 @@ export {
5997
7035
  densityTokens,
5998
7036
  emitCss,
5999
7037
  emptyEstate,
7038
+ estateComponentPairs,
6000
7039
  estatePairs,
6001
7040
  exitDuration,
6002
7041
  extractHtml,
@@ -6012,6 +7051,7 @@ export {
6012
7051
  fontClass,
6013
7052
  formatClaims,
6014
7053
  formatComparison,
7054
+ formatCompetitor,
6015
7055
  formatHex,
6016
7056
  formatReport,
6017
7057
  globToRegExp,
@@ -6038,6 +7078,7 @@ export {
6038
7078
  nullPrompt,
6039
7079
  oklchToHex,
6040
7080
  oklchToRgb,
7081
+ pageCopy,
6041
7082
  paletteFromPixels,
6042
7083
  parseBaseline,
6043
7084
  parseColour,
@@ -6050,14 +7091,20 @@ export {
6050
7091
  readSnapshot,
6051
7092
  retrofitPlan,
6052
7093
  runTell,
7094
+ scanProvenance,
6053
7095
  scanSource,
6054
7096
  sectionRhythm,
6055
7097
  semantic,
7098
+ sentencesOf,
6056
7099
  severityExceptions,
6057
7100
  shapeName,
6058
7101
  sharedParts,
6059
7102
  shouldAnimate,
6060
7103
  siblingLine,
7104
+ specificity,
7105
+ specifics,
7106
+ stockAvatarSource,
7107
+ stockSource,
6061
7108
  tailwindV3Preset,
6062
7109
  tailwindV4Theme,
6063
7110
  tellById,
@@ -6066,6 +7113,7 @@ export {
6066
7113
  toSarif,
6067
7114
  typeFeatureTokens,
6068
7115
  typicality,
7116
+ unprovenClaims,
6069
7117
  validateDirection,
6070
7118
  visibleText,
6071
7119
  visualMeasures,