@aglyn/plugins-ai 1.15.2 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/package.json +17 -17
  2. package/src/lib/components/ai-site-import-plan.component.js +1 -1
  3. package/src/lib/components/ai-site-import-plan.component.js.map +1 -1
  4. package/src/lib/jobs/ai-job-import-step.js +6 -4
  5. package/src/lib/jobs/ai-job-import-step.js.map +1 -1
  6. package/src/lib/jobs/ai-job-page-language.d.ts +2 -0
  7. package/src/lib/jobs/ai-job-page-language.js +29 -14
  8. package/src/lib/jobs/ai-job-page-language.js.map +1 -1
  9. package/src/lib/jobs/ai-job-page-step.js +3 -1
  10. package/src/lib/jobs/ai-job-page-step.js.map +1 -1
  11. package/src/lib/jobs/ai-job-text-step.d.ts +1 -0
  12. package/src/lib/jobs/ai-job-text-step.js.map +1 -1
  13. package/src/lib/jobs/ai-site-import-compile.d.ts +9 -1
  14. package/src/lib/jobs/ai-site-import-compile.js +67 -1
  15. package/src/lib/jobs/ai-site-import-compile.js.map +1 -1
  16. package/src/lib/jobs/ai-site-import-honesty.d.ts +6 -2
  17. package/src/lib/jobs/ai-site-import-honesty.js +5 -5
  18. package/src/lib/jobs/ai-site-import-honesty.js.map +1 -1
  19. package/src/lib/jobs/ai-site-import-improve.d.ts +61 -2
  20. package/src/lib/jobs/ai-site-import-improve.js +184 -19
  21. package/src/lib/jobs/ai-site-import-improve.js.map +1 -1
  22. package/src/lib/layout-language/ai-layout-compiler.d.ts +6 -1
  23. package/src/lib/layout-language/ai-layout-compiler.js +27 -9
  24. package/src/lib/layout-language/ai-layout-compiler.js.map +1 -1
  25. package/src/lib/model/ai-site-import-fidelity.d.ts +18 -2
  26. package/src/lib/model/ai-site-import-fidelity.js +35 -11
  27. package/src/lib/model/ai-site-import-fidelity.js.map +1 -1
  28. package/src/lib/model/ai-site-import-view.js +6 -1
  29. package/src/lib/model/ai-site-import-view.js.map +1 -1
  30. package/src/lib/model/ai-site-import.d.ts +8 -1
  31. package/src/lib/model/ai-site-import.js +12 -4
  32. package/src/lib/model/ai-site-import.js.map +1 -1
  33. package/src/lib/runtime/ai-palette.generated.js +36 -5
  34. package/src/lib/runtime/ai-palette.generated.js.map +1 -1
@@ -41,6 +41,10 @@ export interface AiSiteImportHonestyScope {
41
41
  /** Where a link may go, as an answer writes it, and the ledger's links' own destinations. */
42
42
  destinations: ReadonlyMap<string, string>;
43
43
  framing?: AiCopyFraming | null;
44
+ /** Words the platform's own request put to the answer, no one's name or fact (`siteImportFactScope`). */
45
+ vocabulary?: readonly string[];
46
+ /** This page's own `page:<id>`, where it has one: a link the source makes to the page it is on asks nothing of the answer. */
47
+ own?: string | null;
44
48
  }
45
49
  /** Whether text is in the source's own words: its fact tokens, and whatever a scope says of it. */
46
50
  export interface AiSiteImportHonestyFacts {
@@ -49,8 +53,8 @@ export interface AiSiteImportHonestyFacts {
49
53
  /** The source's words, as one text, for what a claim is checked against. */
50
54
  said: string;
51
55
  }
52
- /** What every line of an answer is checked against. */
53
- export declare function aiSiteImportHonestyFacts(scope: readonly string[]): AiSiteImportHonestyFacts;
56
+ /** What every line of an answer is checked against; `vocabulary` is said, and names and claims nothing. */
57
+ export declare function aiSiteImportHonestyFacts(scope: readonly string[], vocabulary?: readonly string[]): AiSiteImportHonestyFacts;
54
58
  /** What one line of new copy says that the source does not: a reason in words, or `null`. */
55
59
  export declare function aiSiteImportInventedIn(text: string, held: AiSiteImportHonestyFacts): string | null;
56
60
  /**
@@ -106,8 +106,8 @@ export const AI_SITE_IMPORT_DROPPED_ITEM_CODE = 'improve-dropped-item';
106
106
  /\b(?:two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|fifteen|twenty|thirty|forty|fifty)\s+(?:years?|clients?|customers?|families|projects?|homes?|offices?|locations?|reviews?|stars?)\b/i
107
107
  ];
108
108
  /** A word that opens a line in quotation marks and runs on: a testimonial, whoever is made to say it. */ const QUOTED = /^["“”'‘][^"“”]{15,}["“”]/;
109
- /** What every line of an answer is checked against. */ export function aiSiteImportHonestyFacts(scope) {
110
- const facts = siteImportFactScope(scope);
109
+ /** What every line of an answer is checked against; `vocabulary` is said, and names and claims nothing. */ export function aiSiteImportHonestyFacts(scope, vocabulary = []) {
110
+ const facts = siteImportFactScope(scope, vocabulary);
111
111
  return {
112
112
  facts,
113
113
  tokens: new Set(scope.flatMap((text)=>siteImportFactTokens(text, facts, false))),
@@ -198,9 +198,9 @@ const dropped = (message)=>({
198
198
  * An answer held to what the import read, and to its ledger (AGL-4152). No
199
199
  * violation is a redesign that may be built; each one names its line.
200
200
  */ export function aiSiteImportHonesty(sections, input) {
201
- var _ref;
201
+ var _input_vocabulary, _ref;
202
202
  var _sections_;
203
- const held = aiSiteImportHonestyFacts(input.scope);
203
+ const held = aiSiteImportHonestyFacts(input.scope, (_input_vocabulary = input.vocabulary) != null ? _input_vocabulary : []);
204
204
  const contacts = input.scope.join(' \n ');
205
205
  const out = [];
206
206
  const refs = new Map(input.ledger.items.map((item)=>[
@@ -262,7 +262,7 @@ const dropped = (message)=>({
262
262
  const keptLines = new Set(input.ledger.items.filter((item)=>kept.has(item.ref)).flatMap((item)=>item.lines));
263
263
  for (const link of input.ledger.links){
264
264
  const to = input.destinations.get(link.ref);
265
- if (!to || links.has(to) || keptLines.has(link.line)) continue;
265
+ if (!to || to === input.own || links.has(to) || keptLines.has(link.line)) continue;
266
266
  out.push(dropped(`${link.ref} ("${link.text.slice(0, 60)}") goes nowhere on the page. Link to it from a button or an item.`));
267
267
  }
268
268
  return out;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/jobs/ai-site-import-honesty.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*==========================================\n * NEW COPY MAY SAY WHAT THE SOURCE SUPPORTS, AND NOTHING IT DOES NOT (AGL-4152).\n *\n * A redesign may describe what the source says and what this kind of business\n * generally does. It may not make up a name, number, price, date, testimonial,\n * client, award, credential, address or guarantee, and it may not lose what\n * the ledger holds. This is the gate, pure, one answer at a time:\n *\n * - `improve-invented-fact`: a word of its copy says a fact, a name, a\n * credential or a guarantee outside what the import read, or a link goes\n * somewhere the source does not.\n * - `improve-dropped-item`: something the ledger holds is not on the page, or\n * is on it twice.\n *\n * Each names the line, so the one re-ask can mend that line.\n *=========================================*/\n\nimport { aiLayoutGuardContacts } from '../layout-language/ai-layout-copy'\nimport type { AiLayoutBlock, AiLayoutItem } from '../layout-language/ai-layout-language'\nimport { siteImportFactScope, siteImportFactTokens, type SiteImportFactScope } from '../model/ai-site-import-fidelity'\nimport type { SiteImportLedger } from '../model/ai-site-import-ledger'\nimport { detectOffVoiceCopy, type AiCopyFraming, type AiDoctrineViolation } from '../runtime/ai-doctrine-validators'\nimport { aiPlaceholderTokens } from '../runtime/ai-placeholder-tokens'\n\nexport const AI_SITE_IMPORT_INVENTED_FACT_CODE = 'improve-invented-fact'\nexport const AI_SITE_IMPORT_DROPPED_ITEM_CODE = 'improve-dropped-item'\n\n/** A block a redesign answered: the layout language, or a `keep` of a ledger ref. */\nexport type AiSiteImportImprovedBlock = AiLayoutBlock | { kind: 'keep'; ref: string; col?: number }\n\n/** A section a redesign answered. */\nexport interface AiSiteImportImprovedSection {\n band?: 'plain' | 'soft' | 'brand' | 'dark'\n cols?: number[]\n align?: 'start' | 'center'\n blocks: AiSiteImportImprovedBlock[]\n}\n\n/** What a redesign's copy is held against. */\nexport interface AiSiteImportHonestyScope {\n ledger: SiteImportLedger\n /** Every line the import read: this page's, the wave's other pages', and what the home page says of the site. */\n scope: readonly string[]\n /** Where a link may go, as an answer writes it, and the ledger's links' own destinations. */\n destinations: ReadonlyMap<string, string>\n framing?: AiCopyFraming | null\n}\n\n/** Words past a sentence's first that are no one's name, in any heading: the short form of a question list. */\nconst NO_NAMES = new Set(['FAQ', 'FAQs', 'I'])\n\n/**\n * Credentials and guarantees: outside what the source says, each is a claim\n * only its owner can make, however a sentence puts it.\n */\nconst CLAIMS: ReadonlyArray<readonly [string, RegExp]> = [\n ['licensed', /\\blicen[sc]ed\\b/i],\n ['certified', /\\b(?:board-)?certified\\b/i],\n ['accredited', /\\baccredited\\b/i],\n ['insured', /\\binsured\\b/i],\n ['bonded', /\\bbonded\\b/i],\n ['award', /\\baward(?:s|-winning)?\\b/i],\n ['guarantee', /\\bguarantee[ds]?\\b/i],\n ['warranty', /\\bwarrant(?:y|ies)\\b/i],\n ['money-back', /\\bmoney[- ]back\\b/i],\n ['top-rated', /\\btop[- ]rated\\b/i],\n ['five-star', /\\b(?:5|five)[- ]star\\b/i],\n ['voted', /\\bvoted\\b/i],\n ['featured in', /\\bfeatured in\\b/i],\n ['trusted by', /\\btrusted by\\b/i],\n]\n\n/** A count no digit says: \"hundreds of clients\", \"two decades\", \"ten years\". */\nconst COUNTS = [\n /\\b(?:hundreds|thousands|millions|dozens|decades?|centur(?:y|ies))\\b/i,\n /\\b(?:two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|fifteen|twenty|thirty|forty|fifty)\\s+(?:years?|clients?|customers?|families|projects?|homes?|offices?|locations?|reviews?|stars?)\\b/i,\n]\n\n/** A word that opens a line in quotation marks and runs on: a testimonial, whoever is made to say it. */\nconst QUOTED = /^[\"“”'‘][^\"“”]{15,}[\"“”]/\n\n/** Whether text is in the source's own words: its fact tokens, and whatever a scope says of it. */\nexport interface AiSiteImportHonestyFacts {\n facts: SiteImportFactScope\n tokens: ReadonlySet<string>\n /** The source's words, as one text, for what a claim is checked against. */\n said: string\n}\n\n/** What every line of an answer is checked against. */\nexport function aiSiteImportHonestyFacts(scope: readonly string[]): AiSiteImportHonestyFacts {\n const facts = siteImportFactScope(scope)\n return { facts, tokens: new Set(scope.flatMap((text) => siteImportFactTokens(text, facts, false))), said: scope.join(' \\n ') }\n}\n\nconst shown = (token: string) => `\"${token.replace(/^[a-z]+:/, '')}\"`\n\n/** What one line of new copy says that the source does not: a reason in words, or `null`. */\nexport function aiSiteImportInventedIn(text: string, held: AiSiteImportHonestyFacts): string | null {\n const invented = siteImportFactTokens(text, held.facts, true).filter((token) => !held.tokens.has(token) && !(token.startsWith('name:') && NO_NAMES.has(token.slice(5))))\n if (invented.length) return `it says ${[...new Set(invented)].map(shown).join(', ')}, which nothing the site says supports. Say only names and figures the site gives; a heading is in sentence case, so a capital reads as a name.`\n for (const [claim, pattern] of CLAIMS) {\n if (pattern.test(text) && !pattern.test(held.said)) return `it claims ${shown(claim)}, which the site does not. Leave credentials, awards and guarantees to the owner.`\n }\n for (const pattern of COUNTS) {\n const found = pattern.exec(text)?.[0]\n if (found && !new RegExp(`\\\\b${found.replace(/\\s+/g, '\\\\s+')}\\\\b`, 'i').test(held.said)) return `it says ${shown(found)}, a count the site does not give.`\n }\n if (QUOTED.test(text.trim()) && !held.said.includes(text.trim().slice(1, 20))) return 'it reads as a testimonial the site does not have. Quote a customer only by keeping their quote.'\n return null\n}\n\n/** Each written line of a block, as its place on the page names it. */\nfunction writtenLines(block: AiLayoutBlock, at: string): Array<{ at: string; text: string }> {\n const out: Array<{ at: string; text: string }> = []\n if (block.text && block.kind !== 'image') out.push({ at, text: block.text })\n ;(block.items ?? []).forEach((item: AiLayoutItem, index) => {\n if (item.title.trim()) out.push({ at: `${at}, item ${index + 1}`, text: item.title })\n if (item.text.trim()) out.push({ at: `${at}, item ${index + 1}`, text: item.text })\n })\n return out\n}\n\n/** Where a block sends a visitor, its own and its items'. */\nconst linksOf = (block: AiLayoutBlock): string[] => [...(block.to ? [block.to] : []), ...(block.items ?? []).flatMap((item) => (item.to ? [item.to] : []))]\n\n/**\n * Every ledger ref an answer places, as often as it places it: each `keep`,\n * each picture on an item, and what a group kept whole holds (AGL-4152).\n */\nexport function aiSiteImportImprovedPlaced(sections: readonly AiSiteImportImprovedSection[], ledger: Pick<SiteImportLedger, 'items'>): string[] {\n const holds = new Map(ledger.items.map((item) => [item.ref, item.holds ?? []]))\n return sections.flatMap((section) =>\n section.blocks.flatMap((block) => (block.kind === 'keep' ? [block.ref, ...(holds.get(block.ref) ?? [])] : (block.items ?? []).flatMap((item) => (item.ref ? [item.ref] : [])))),\n )\n}\n\nconst invented = (message: string, detail?: string): AiDoctrineViolation => ({ rule: 14, code: AI_SITE_IMPORT_INVENTED_FACT_CODE, message, ...(detail ? { detail } : {}) })\nconst dropped = (message: string): AiDoctrineViolation => ({ rule: null, code: AI_SITE_IMPORT_DROPPED_ITEM_CODE, message })\n\n/**\n * An answer held to what the import read, and to its ledger (AGL-4152). No\n * violation is a redesign that may be built; each one names its line.\n */\nexport function aiSiteImportHonesty(sections: readonly AiSiteImportImprovedSection[], input: AiSiteImportHonestyScope): AiDoctrineViolation[] {\n const held = aiSiteImportHonestyFacts(input.scope)\n const contacts = input.scope.join(' \\n ')\n const out: AiDoctrineViolation[] = []\n const refs = new Map(input.ledger.items.map((item) => [item.ref, item]))\n const placed = aiSiteImportImprovedPlaced(sections, input.ledger)\n const links = new Set<string>()\n sections.forEach((section, index) => {\n section.blocks.forEach((raw, position) => {\n if (raw.kind === 'keep') return\n const block = raw\n const at = `section ${index + 1}, block ${position + 1}`\n for (const line of writtenLines(block, at)) {\n const reason = aiSiteImportInventedIn(line.text, held)\n if (reason) out.push(invented(`${line.at}, \"${line.text.slice(0, 80)}\": ${reason}`))\n else if (aiLayoutGuardContacts(line.text, contacts) !== line.text) out.push(invented(`${line.at}, \"${line.text.slice(0, 80)}\": it gives a phone number or email the site does not.`))\n else if (/\\[[^\\]]*\\]/.test(line.text) || aiPlaceholderTokens(line.text).length || detectOffVoiceCopy([{ at: 'line', text: line.text }], input.framing ?? null).length) {\n out.push(invented(`${line.at}, \"${line.text.slice(0, 80)}\": it holds filler, a placeholder or a word that calls the work simple or cheap. Write real words.`))\n }\n }\n for (const to of linksOf(block)) {\n if (input.destinations.has(to)) links.add(input.destinations.get(to) as string)\n else out.push(invented(`${at}: it links to \"${to.slice(0, 80)}\", which is not a page of this site, form, phone, email, a section as #n, or an address the source links.`))\n }\n })\n })\n // What the ledger holds: each thing that must land, once; no ref twice, and none it does not hold.\n const inGroup = new Map(input.ledger.items.flatMap((item) => (item.holds ?? []).map((held) => [held, item.ref] as const)))\n for (const ref of new Set(placed)) {\n if (!refs.has(ref)) out.push(dropped(`keep \"${ref.slice(0, 40)}\" names nothing on this page. Use only the refs the page lists.`))\n else if (placed.filter((entry) => entry === ref).length > 1) {\n const group = inGroup.get(ref)\n out.push(dropped(`${ref} is placed ${placed.filter((entry) => entry === ref).length} times${group && placed.includes(group) ? `: keeping ${group} whole places it already` : ''}. Place it once.`))\n }\n }\n for (const item of input.ledger.items) {\n if (item.must && !placed.includes(item.ref)) out.push(dropped(`${item.ref} is not on the page. Place it with a keep block, exactly once${item.folded ? ': this page is long, so its groups are kept whole' : ''}.`))\n }\n // The page's own opening picture outranks a new one: a picture asked for in words never takes its place.\n const opening = input.ledger.items.find((item) => item.kind === 'picture' && item.section === 0)\n const first = sections[0]?.blocks ?? []\n if (opening && first.some((block) => block.kind === 'image' && !block.picture) && !first.some((block) => block.kind === 'keep' && block.ref === opening.ref)) {\n out.push(dropped(`${opening.ref} is the page's own opening picture. Open with it, with a keep block, in place of a picture asked for in words.`))\n }\n const kept = new Set(placed)\n const keptLines = new Set(input.ledger.items.filter((item) => kept.has(item.ref)).flatMap((item) => item.lines))\n for (const link of input.ledger.links) {\n const to = input.destinations.get(link.ref)\n if (!to || links.has(to) || keptLines.has(link.line)) continue\n out.push(dropped(`${link.ref} (\"${link.text.slice(0, 60)}\") goes nowhere on the page. Link to it from a button or an item.`))\n }\n return out\n}\n"],"names":["aiLayoutGuardContacts","siteImportFactScope","siteImportFactTokens","detectOffVoiceCopy","aiPlaceholderTokens","AI_SITE_IMPORT_INVENTED_FACT_CODE","AI_SITE_IMPORT_DROPPED_ITEM_CODE","NO_NAMES","Set","CLAIMS","COUNTS","QUOTED","aiSiteImportHonestyFacts","scope","facts","tokens","flatMap","text","said","join","shown","token","replace","aiSiteImportInventedIn","held","invented","filter","has","startsWith","slice","length","map","claim","pattern","test","found","exec","RegExp","trim","includes","writtenLines","block","at","out","kind","push","items","forEach","item","index","title","linksOf","to","aiSiteImportImprovedPlaced","sections","ledger","holds","Map","ref","section","blocks","get","message","detail","rule","code","dropped","aiSiteImportHonesty","input","contacts","refs","placed","links","raw","position","line","reason","framing","destinations","add","inGroup","entry","group","must","folded","opening","find","first","some","picture","kept","keptLines","lines","link"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;2CAe2C,GAE3C,SAASA,qBAAqB,QAAQ,uCAAmC;AAEzE,SAASC,mBAAmB,EAAEC,oBAAoB,QAAkC,sCAAkC;AAEtH,SAASC,kBAAkB,QAAsD,uCAAmC;AACpH,SAASC,mBAAmB,QAAQ,sCAAkC;AAEtE,OAAO,MAAMC,oCAAoC,wBAAuB;AACxE,OAAO,MAAMC,mCAAmC,uBAAsB;AAuBtE,6GAA6G,GAC7G,MAAMC,WAAW,IAAIC,IAAI;IAAC;IAAO;IAAQ;CAAI;AAE7C;;;CAGC,GACD,MAAMC,SAAmD;IACvD;QAAC;QAAY;KAAmB;IAChC;QAAC;QAAa;KAA4B;IAC1C;QAAC;QAAc;KAAkB;IACjC;QAAC;QAAW;KAAe;IAC3B;QAAC;QAAU;KAAc;IACzB;QAAC;QAAS;KAA4B;IACtC;QAAC;QAAa;KAAsB;IACpC;QAAC;QAAY;KAAwB;IACrC;QAAC;QAAc;KAAqB;IACpC;QAAC;QAAa;KAAoB;IAClC;QAAC;QAAa;KAA0B;IACxC;QAAC;QAAS;KAAa;IACvB;QAAC;QAAe;KA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honesty.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*==========================================\n * NEW COPY MAY SAY WHAT THE SOURCE SUPPORTS, AND NOTHING IT DOES NOT (AGL-4152).\n *\n * A redesign may describe what the source says and what this kind of business\n * generally does. It may not make up a name, number, price, date, testimonial,\n * client, award, credential, address or guarantee, and it may not lose what\n * the ledger holds. This is the gate, pure, one answer at a time:\n *\n * - `improve-invented-fact`: a word of its copy says a fact, a name, a\n * credential or a guarantee outside what the import read, or a link goes\n * somewhere the source does not.\n * - `improve-dropped-item`: something the ledger holds is not on the page, or\n * is on it twice.\n *\n * Each names the line, so the one re-ask can mend that line.\n *=========================================*/\n\nimport { aiLayoutGuardContacts } from '../layout-language/ai-layout-copy'\nimport type { AiLayoutBlock, AiLayoutItem } from '../layout-language/ai-layout-language'\nimport { siteImportFactScope, siteImportFactTokens, type SiteImportFactScope } from '../model/ai-site-import-fidelity'\nimport type { SiteImportLedger } from '../model/ai-site-import-ledger'\nimport { detectOffVoiceCopy, type AiCopyFraming, type AiDoctrineViolation } from '../runtime/ai-doctrine-validators'\nimport { aiPlaceholderTokens } from '../runtime/ai-placeholder-tokens'\n\nexport const AI_SITE_IMPORT_INVENTED_FACT_CODE = 'improve-invented-fact'\nexport const AI_SITE_IMPORT_DROPPED_ITEM_CODE = 'improve-dropped-item'\n\n/** A block a redesign answered: the layout language, or a `keep` of a ledger ref. */\nexport type AiSiteImportImprovedBlock = AiLayoutBlock | { kind: 'keep'; ref: string; col?: number }\n\n/** A section a redesign answered. */\nexport interface AiSiteImportImprovedSection {\n band?: 'plain' | 'soft' | 'brand' | 'dark'\n cols?: number[]\n align?: 'start' | 'center'\n blocks: AiSiteImportImprovedBlock[]\n}\n\n/** What a redesign's copy is held against. */\nexport interface AiSiteImportHonestyScope {\n ledger: SiteImportLedger\n /** Every line the import read: this page's, the wave's other pages', and what the home page says of the site. */\n scope: readonly string[]\n /** Where a link may go, as an answer writes it, and the ledger's links' own destinations. */\n destinations: ReadonlyMap<string, string>\n framing?: AiCopyFraming | null\n /** Words the platform's own request put to the answer, no one's name or fact (`siteImportFactScope`). */\n vocabulary?: readonly string[]\n /** This page's own `page:<id>`, where it has one: a link the source makes to the page it is on asks nothing of the answer. */\n own?: string | null\n}\n\n/** Words past a sentence's first that are no one's name, in any heading: the short form of a question list. */\nconst NO_NAMES = new Set(['FAQ', 'FAQs', 'I'])\n\n/**\n * Credentials and guarantees: outside what the source says, each is a claim\n * only its owner can make, however a sentence puts it.\n */\nconst CLAIMS: ReadonlyArray<readonly [string, RegExp]> = [\n ['licensed', /\\blicen[sc]ed\\b/i],\n ['certified', /\\b(?:board-)?certified\\b/i],\n ['accredited', /\\baccredited\\b/i],\n ['insured', /\\binsured\\b/i],\n ['bonded', /\\bbonded\\b/i],\n ['award', /\\baward(?:s|-winning)?\\b/i],\n ['guarantee', /\\bguarantee[ds]?\\b/i],\n ['warranty', /\\bwarrant(?:y|ies)\\b/i],\n ['money-back', /\\bmoney[- ]back\\b/i],\n ['top-rated', /\\btop[- ]rated\\b/i],\n ['five-star', /\\b(?:5|five)[- ]star\\b/i],\n ['voted', /\\bvoted\\b/i],\n ['featured in', /\\bfeatured in\\b/i],\n ['trusted by', /\\btrusted by\\b/i],\n]\n\n/** A count no digit says: \"hundreds of clients\", \"two decades\", \"ten years\". */\nconst COUNTS = [\n /\\b(?:hundreds|thousands|millions|dozens|decades?|centur(?:y|ies))\\b/i,\n /\\b(?:two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|fifteen|twenty|thirty|forty|fifty)\\s+(?:years?|clients?|customers?|families|projects?|homes?|offices?|locations?|reviews?|stars?)\\b/i,\n]\n\n/** A word that opens a line in quotation marks and runs on: a testimonial, whoever is made to say it. */\nconst QUOTED = /^[\"“”'‘][^\"“”]{15,}[\"“”]/\n\n/** Whether text is in the source's own words: its fact tokens, and whatever a scope says of it. */\nexport interface AiSiteImportHonestyFacts {\n facts: SiteImportFactScope\n tokens: ReadonlySet<string>\n /** The source's words, as one text, for what a claim is checked against. */\n said: string\n}\n\n/** What every line of an answer is checked against; `vocabulary` is said, and names and claims nothing. */\nexport function aiSiteImportHonestyFacts(scope: readonly string[], vocabulary: readonly string[] = []): AiSiteImportHonestyFacts {\n const facts = siteImportFactScope(scope, vocabulary)\n return { facts, tokens: new Set(scope.flatMap((text) => siteImportFactTokens(text, facts, false))), said: scope.join(' \\n ') }\n}\n\nconst shown = (token: string) => `\"${token.replace(/^[a-z]+:/, '')}\"`\n\n/** What one line of new copy says that the source does not: a reason in words, or `null`. */\nexport function aiSiteImportInventedIn(text: string, held: AiSiteImportHonestyFacts): string | null {\n const invented = siteImportFactTokens(text, held.facts, true).filter((token) => !held.tokens.has(token) && !(token.startsWith('name:') && NO_NAMES.has(token.slice(5))))\n if (invented.length) return `it says ${[...new Set(invented)].map(shown).join(', ')}, which nothing the site says supports. Say only names and figures the site gives; a heading is in sentence case, so a capital reads as a name.`\n for (const [claim, pattern] of CLAIMS) {\n if (pattern.test(text) && !pattern.test(held.said)) return `it claims ${shown(claim)}, which the site does not. Leave credentials, awards and guarantees to the owner.`\n }\n for (const pattern of COUNTS) {\n const found = pattern.exec(text)?.[0]\n if (found && !new RegExp(`\\\\b${found.replace(/\\s+/g, '\\\\s+')}\\\\b`, 'i').test(held.said)) return `it says ${shown(found)}, a count the site does not give.`\n }\n if (QUOTED.test(text.trim()) && !held.said.includes(text.trim().slice(1, 20))) return 'it reads as a testimonial the site does not have. Quote a customer only by keeping their quote.'\n return null\n}\n\n/** Each written line of a block, as its place on the page names it. */\nfunction writtenLines(block: AiLayoutBlock, at: string): Array<{ at: string; text: string }> {\n const out: Array<{ at: string; text: string }> = []\n if (block.text && block.kind !== 'image') out.push({ at, text: block.text })\n ;(block.items ?? []).forEach((item: AiLayoutItem, index) => {\n if (item.title.trim()) out.push({ at: `${at}, item ${index + 1}`, text: item.title })\n if (item.text.trim()) out.push({ at: `${at}, item ${index + 1}`, text: item.text })\n })\n return out\n}\n\n/** Where a block sends a visitor, its own and its items'. */\nconst linksOf = (block: AiLayoutBlock): string[] => [...(block.to ? [block.to] : []), ...(block.items ?? []).flatMap((item) => (item.to ? [item.to] : []))]\n\n/**\n * Every ledger ref an answer places, as often as it places it: each `keep`,\n * each picture on an item, and what a group kept whole holds (AGL-4152).\n */\nexport function aiSiteImportImprovedPlaced(sections: readonly AiSiteImportImprovedSection[], ledger: Pick<SiteImportLedger, 'items'>): string[] {\n const holds = new Map(ledger.items.map((item) => [item.ref, item.holds ?? []]))\n return sections.flatMap((section) =>\n section.blocks.flatMap((block) => (block.kind === 'keep' ? [block.ref, ...(holds.get(block.ref) ?? [])] : (block.items ?? []).flatMap((item) => (item.ref ? [item.ref] : [])))),\n )\n}\n\nconst invented = (message: string, detail?: string): AiDoctrineViolation => ({ rule: 14, code: AI_SITE_IMPORT_INVENTED_FACT_CODE, message, ...(detail ? { detail } : {}) })\nconst dropped = (message: string): AiDoctrineViolation => ({ rule: null, code: AI_SITE_IMPORT_DROPPED_ITEM_CODE, message })\n\n/**\n * An answer held to what the import read, and to its ledger (AGL-4152). No\n * violation is a redesign that may be built; each one names its line.\n */\nexport function aiSiteImportHonesty(sections: readonly AiSiteImportImprovedSection[], input: AiSiteImportHonestyScope): AiDoctrineViolation[] {\n const held = aiSiteImportHonestyFacts(input.scope, input.vocabulary ?? [])\n const contacts = input.scope.join(' \\n ')\n const out: AiDoctrineViolation[] = []\n const refs = new Map(input.ledger.items.map((item) => [item.ref, item]))\n const placed = aiSiteImportImprovedPlaced(sections, input.ledger)\n const links = new Set<string>()\n sections.forEach((section, index) => {\n section.blocks.forEach((raw, position) => {\n if (raw.kind === 'keep') return\n const block = raw\n const at = `section ${index + 1}, block ${position + 1}`\n for (const line of writtenLines(block, at)) {\n const reason = aiSiteImportInventedIn(line.text, held)\n if (reason) out.push(invented(`${line.at}, \"${line.text.slice(0, 80)}\": ${reason}`))\n else if (aiLayoutGuardContacts(line.text, contacts) !== line.text) out.push(invented(`${line.at}, \"${line.text.slice(0, 80)}\": it gives a phone number or email the site does not.`))\n else if (/\\[[^\\]]*\\]/.test(line.text) || aiPlaceholderTokens(line.text).length || detectOffVoiceCopy([{ at: 'line', text: line.text }], input.framing ?? null).length) {\n out.push(invented(`${line.at}, \"${line.text.slice(0, 80)}\": it holds filler, a placeholder or a word that calls the work simple or cheap. Write real words.`))\n }\n }\n for (const to of linksOf(block)) {\n if (input.destinations.has(to)) links.add(input.destinations.get(to) as string)\n else out.push(invented(`${at}: it links to \"${to.slice(0, 80)}\", which is not a page of this site, form, phone, email, a section as #n, or an address the source links.`))\n }\n })\n })\n // What the ledger holds: each thing that must land, once; no ref twice, and none it does not hold.\n const inGroup = new Map(input.ledger.items.flatMap((item) => (item.holds ?? []).map((held) => [held, item.ref] as const)))\n for (const ref of new Set(placed)) {\n if (!refs.has(ref)) out.push(dropped(`keep \"${ref.slice(0, 40)}\" names nothing on this page. Use only the refs the page lists.`))\n else if (placed.filter((entry) => entry === ref).length > 1) {\n const group = inGroup.get(ref)\n out.push(dropped(`${ref} is placed ${placed.filter((entry) => entry === ref).length} times${group && placed.includes(group) ? `: keeping ${group} whole places it already` : ''}. Place it once.`))\n }\n }\n for (const item of input.ledger.items) {\n if (item.must && !placed.includes(item.ref)) out.push(dropped(`${item.ref} is not on the page. Place it with a keep block, exactly once${item.folded ? ': this page is long, so its groups are kept whole' : ''}.`))\n }\n // The page's own opening picture outranks a new one: a picture asked for in words never takes its place.\n const opening = input.ledger.items.find((item) => item.kind === 'picture' && item.section === 0)\n const first = sections[0]?.blocks ?? []\n if (opening && first.some((block) => block.kind === 'image' && !block.picture) && !first.some((block) => block.kind === 'keep' && block.ref === opening.ref)) {\n out.push(dropped(`${opening.ref} is the page's own opening picture. Open with it, with a keep block, in place of a picture asked for in words.`))\n }\n const kept = new Set(placed)\n const keptLines = new Set(input.ledger.items.filter((item) => kept.has(item.ref)).flatMap((item) => item.lines))\n for (const link of input.ledger.links) {\n const to = input.destinations.get(link.ref)\n if (!to || to === input.own || links.has(to) || keptLines.has(link.line)) continue\n out.push(dropped(`${link.ref} (\"${link.text.slice(0, 60)}\") goes nowhere on the page. Link to it from a button or an item.`))\n }\n return out\n}\n"],"names":["aiLayoutGuardContacts","siteImportFactScope","siteImportFactTokens","detectOffVoiceCopy","aiPlaceholderTokens","AI_SITE_IMPORT_INVENTED_FACT_CODE","AI_SITE_IMPORT_DROPPED_ITEM_CODE","NO_NAMES","Set","CLAIMS","COUNTS","QUOTED","aiSiteImportHonestyFacts","scope","vocabulary","facts","tokens","flatMap","text","said","join","shown","token","replace","aiSiteImportInventedIn","held","invented","filter","has","startsWith","slice","length","map","claim","pattern","test","found","exec","RegExp","trim","includes","writtenLines","block","at","out","kind","push","items","forEach","item","index","title","linksOf","to","aiSiteImportImprovedPlaced","sections","ledger","holds","Map","ref","section","blocks","get","message","detail","rule","code","dropped","aiSiteImportHonesty","input","contacts","refs","placed","links","raw","position","line","reason","framing","destinations","add","inGroup","entry","group","must","folded","opening","find","first","some","picture","kept","keptLines","lines","link","own"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;2CAe2C,GAE3C,SAASA,qBAAqB,QAAQ,uCAAmC;AAEzE,SAASC,mBAAmB,EAAEC,oBAAoB,QAAkC,sCAAkC;AAEtH,SAASC,kBAAkB,QAAsD,uCAAmC;AACpH,SAASC,mBAAmB,QAAQ,sCAAkC;AAEtE,OAAO,MAAMC,oCAAoC,wBAAuB;AACxE,OAAO,MAAMC,mCAAmC,uBAAsB;AA2BtE,6GAA6G,GAC7G,MAAMC,WAAW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AAC,CAACgC,OAASA,KAAK4C,KAAK;IAC9G,KAAK,MAAMC,QAAQzB,MAAMb,MAAM,CAACiB,KAAK,CAAE;QACrC,MAAMpB,KAAKgB,MAAMU,YAAY,CAACjB,GAAG,CAACgC,KAAKnC,GAAG;QAC1C,IAAI,CAACN,MAAMA,OAAOgB,MAAM0B,GAAG,IAAItB,MAAM7C,GAAG,CAACyB,OAAOuC,UAAUhE,GAAG,CAACkE,KAAKlB,IAAI,GAAG;QAC1EhC,IAAIE,IAAI,CAACqB,QAAQ,GAAG2B,KAAKnC,GAAG,CAAC,GAAG,EAAEmC,KAAK5E,IAAI,CAACY,KAAK,CAAC,GAAG,IAAI,iEAAiE,CAAC;IAC7H;IACA,OAAOc;AACT"}
@@ -70,6 +70,12 @@ export declare function aiSiteImportImproveDestinations(doc: AiSiteImportDocumen
70
70
  sections?: number;
71
71
  formSection?: number | null;
72
72
  }): Map<string, string>;
73
+ /**
74
+ * The page's own `page:<id>` on the new site (AGL-4152), by its address: a
75
+ * link to it from itself goes nowhere a visitor is not already. `null` where
76
+ * the import plans it under no id, as the home page.
77
+ */
78
+ export declare function aiSiteImportOwnPage(doc: Pick<AiSiteImportDocument, 'url' | 'links'>): string | null;
73
79
  /** A redesign's user turn: the page, its kind of site, how its opening is drawn, and its ledger, fenced as the owner's data. */
74
80
  export declare function aiSiteImportImprovePrompt(input: {
75
81
  screen: {
@@ -91,6 +97,16 @@ export declare function aiSiteImportImprovePrompt(input: {
91
97
  * to a page of photos only stands between a visitor and them.
92
98
  */
93
99
  export declare const AI_SITE_IMPORT_NEW_SECTIONS: Readonly<Record<AiSiteImportPageRole, number>>;
100
+ /**
101
+ * The share of the old page's words a redesign keeps, by role (AGL-4152),
102
+ * where it is not `SITE_IMPORT_IMPROVED_MEANING`. A contact page is asked for
103
+ * a short, welcoming opening over its form: what it must keep is its form,
104
+ * its contact lines and its facts, each held whole on their own lines, and its
105
+ * intent, so its prose is held only at the floor a rewritten line is.
106
+ */
107
+ export declare const AI_SITE_IMPORT_ROLE_MEANING: Readonly<Partial<Record<AiSiteImportPageRole, number>>>;
108
+ /** The share of its old words a page of a role keeps. */
109
+ export declare function aiSiteImportMeaningShare(role: AiSiteImportPageRole): number;
94
110
  /** The fewest content words an old section says for a new one to be its rework (AGL-4152): fewer is a label, which any section may echo. */
95
111
  export declare const AI_SITE_IMPORT_REWORK_LEAST_WORDS = 4;
96
112
  /** The most sections a redesigned page runs to: a page the source already fills has no room for more. */
@@ -152,6 +168,15 @@ export declare function aiSiteImportImproveHero(design: AiLayoutDesign, plan?: A
152
168
  } | null): AiLayoutImportHero;
153
169
  /** How many of a group's items sit across: planned for how much each says. */
154
170
  export declare function aiSiteImportImproveColumns(items: readonly AiLayoutItem[]): number;
171
+ /**
172
+ * The height a source's picture is cropped to where a redesign places it on
173
+ * its own, in px (AGL-4152): wide across the page, closer in a column. A
174
+ * height, not a shape: the Image takes it as its own height field, so a page
175
+ * of pictures kept one by one repeats one style key on each (its rounding),
176
+ * never two, which rule 16 refuses as a repeated inline style. Pictures side
177
+ * by side in a row are cropped alike, whatever shapes they came in.
178
+ */
179
+ export declare const AI_SITE_IMPORT_IMPROVE_FRAME_PX: Readonly<Record<'wide' | 'column', number>>;
155
180
  export interface AiSiteImportImproveCompileInput {
156
181
  doc: AiSiteImportDocument;
157
182
  ledger: SiteImportLedger;
@@ -247,10 +272,42 @@ export interface AiSiteImportImproved<T> {
247
272
  * meaning, contrast, a phone's width) stays a fallback.
248
273
  */
249
274
  export declare const AI_SITE_IMPORT_IMPROVE_SOFT_CODES: ReadonlySet<string>;
275
+ /** The most reasons a page's record keeps of why its redesign missed (AGL-4152). */
276
+ export declare const AI_SITE_IMPORT_REDESIGN_WHY_MOST = 8;
277
+ /** The most characters one reason keeps: the line it names and what it says of it. */
278
+ export declare const AI_SITE_IMPORT_REDESIGN_WHY_CHARS = 300;
279
+ /**
280
+ * Why a redesign missed, line by line (AGL-4152): each violation's code, its
281
+ * message (which names the line it found, `section 1, block 2, "…"`) and its
282
+ * detail, cut short, at most `AI_SITE_IMPORT_REDESIGN_WHY_MOST`. What the
283
+ * page's log and its record say, so a miss can be read after the job, when
284
+ * the answer itself is gone. For the job's record, never the owner's row.
285
+ */
286
+ export declare function aiSiteImportRedesignWhy(violations: readonly AiDoctrineViolation[]): string[];
250
287
  /** Whether every miss of an answer is one it may be taken with past its last re-ask. */
251
288
  export declare function aiSiteImportImproveOnlySoft(violations: readonly AiDoctrineViolation[]): boolean;
252
- /** Every line a redesign's facts may come from: its page, what the site says of itself, its wave's other pages, its name. */
253
- export declare function aiSiteImportImproveScope(doc: Pick<AiSiteImportDocument, 'blocks' | 'siteLines' | 'scope' | 'title'>, siteName: string | null): string[];
289
+ /**
290
+ * The words of a site's plan (AGL-4152): what it says the site is and who it
291
+ * is for, its menu's and footer's labels, its call to action and its proposed
292
+ * page. A redesign is told the plan as its digest, and the plan's own words
293
+ * were held to what the site says when it was made, so a redesign that
294
+ * repeats them invents nothing.
295
+ */
296
+ export declare function aiSiteImportPlanLines(plan: AiSiteImportPlan | null | undefined): string[];
297
+ /**
298
+ * The ways a site's name is said (AGL-4152), where it is written as one run
299
+ * of letters: a web address ("RidgelineBuilders.com") or a name run together.
300
+ * Its address part dropped, its capitals and digits split ("Ridgeline
301
+ * Builders"), a run of capitals on its own ("ABC" of "ABCroofing"), and a run
302
+ * of small letters split into the words the site says elsewhere ("roofing
303
+ * site" of "roofingsite"). A redesign that names the business as a visitor
304
+ * would invents nothing.
305
+ */
306
+ export declare function aiSiteImportNameVariants(name: string, said: ReadonlySet<string>): string[];
307
+ /** Every line a redesign's facts may come from: its page, what the site says of itself, its wave's other pages, its plan, its name. */
308
+ export declare function aiSiteImportImproveScope(doc: Pick<AiSiteImportDocument, 'blocks' | 'siteLines' | 'scope' | 'title'> & {
309
+ plan?: AiSiteImportPlan | null;
310
+ }, siteName: string | null): string[];
254
311
  /** A scored redesign's misses, each as the re-ask names it: what is red on its ledger and its design lines. */
255
312
  export declare function aiSiteImportImprovedMisses(report: Pick<SiteImportPageFidelity, 'improved'>): AiDoctrineViolation[];
256
313
  /** A redesign's read for a page: its ledger, and everywhere a link may go. */
@@ -272,6 +329,8 @@ export declare function aiSiteImportImproveCheck<T>(input: {
272
329
  theme?: SiteImportFidelityTheme | null;
273
330
  /** What the page is for and the new sections it needs; absent, nothing is asked of its plan. */
274
331
  needs?: AiSiteImportImproveNeeds | null;
332
+ /** Words the platform's own request put to the answer (its role's lines), no one's name or fact. */
333
+ vocabulary?: readonly string[];
275
334
  build: (page: AiSiteImportImprovedPage) => {
276
335
  value: T | null;
277
336
  violations: AiDoctrineViolation[];
@@ -42,7 +42,7 @@ import { aiLayoutDesignChoices, aiLayoutGroupVariant } from "../layout-language/
42
42
  import { AI_LAYOUT_ALIGNS, AI_LAYOUT_BANDS, AI_LAYOUT_MAX_COLS, AI_LAYOUT_STYLES, aiReadLayoutBlock } from "../layout-language/ai-layout-language.js";
43
43
  import { AI_ICON_WORDS } from "../runtime/ai-icon-library.js";
44
44
  import { aiSiteHomeArc } from "../model/ai-site-home-arcs.js";
45
- import { siteImportContentKept, siteImportContentWords } from "../model/ai-site-import-fidelity.js";
45
+ import { SITE_IMPORT_IMPROVED_MEANING, SITE_IMPORT_MEANING_FLOOR, siteImportContentKept, siteImportContentWords } from "../model/ai-site-import-fidelity.js";
46
46
  import { siteImportLedger } from "../model/ai-site-import-ledger.js";
47
47
  import { AI_SITE_IMPORT_PAGE_CEILING_CREDITS } from "../model/ai-site-import.js";
48
48
  import { estimateAiBilledUsd } from "../providers/catalog.js";
@@ -431,6 +431,20 @@ const short = (text, most = 80)=>text.length > most ? `${text.slice(0, most - 1)
431
431
  for(let n = 1; n <= ((_input_sections = input.sections) != null ? _input_sections : 0); n += 1)out.set(`#${n}`, `#${n}`);
432
432
  return out;
433
433
  }
434
+ /**
435
+ * The page's own `page:<id>` on the new site (AGL-4152), by its address: a
436
+ * link to it from itself goes nowhere a visitor is not already. `null` where
437
+ * the import plans it under no id, as the home page.
438
+ */ export function aiSiteImportOwnPage(doc) {
439
+ let path;
440
+ try {
441
+ path = new URL(doc.url).pathname.replace(/\/+$/, '') || '/';
442
+ } catch (unused) {
443
+ return null;
444
+ }
445
+ const own = doc.links.find((link)=>link.path === path);
446
+ return own ? `page:${own.id}` : null;
447
+ }
434
448
  /** A redesign's user turn: the page, its kind of site, how its opening is drawn, and its ledger, fenced as the owner's data. */ export function aiSiteImportImprovePrompt(input) {
435
449
  var _input_roleLines;
436
450
  return [
@@ -465,6 +479,19 @@ const short = (text, most = 80)=>text.length > most ? `${text.slice(0, most - 1)
465
479
  contact: 0,
466
480
  faq: 0
467
481
  };
482
+ /**
483
+ * The share of the old page's words a redesign keeps, by role (AGL-4152),
484
+ * where it is not `SITE_IMPORT_IMPROVED_MEANING`. A contact page is asked for
485
+ * a short, welcoming opening over its form: what it must keep is its form,
486
+ * its contact lines and its facts, each held whole on their own lines, and its
487
+ * intent, so its prose is held only at the floor a rewritten line is.
488
+ */ export const AI_SITE_IMPORT_ROLE_MEANING = {
489
+ contact: SITE_IMPORT_MEANING_FLOOR
490
+ };
491
+ /** The share of its old words a page of a role keeps. */ export function aiSiteImportMeaningShare(role) {
492
+ var _AI_SITE_IMPORT_ROLE_MEANING_role;
493
+ return (_AI_SITE_IMPORT_ROLE_MEANING_role = AI_SITE_IMPORT_ROLE_MEANING[role]) != null ? _AI_SITE_IMPORT_ROLE_MEANING_role : SITE_IMPORT_IMPROVED_MEANING;
494
+ }
468
495
  /** The fewest content words an old section says for a new one to be its rework (AGL-4152): fewer is a label, which any section may echo. */ export const AI_SITE_IMPORT_REWORK_LEAST_WORDS = 4;
469
496
  /** The most sections a redesigned page runs to: a page the source already fills has no room for more. */ export const AI_SITE_IMPORT_IMPROVE_MOST_SECTIONS = 10;
470
497
  /** What a page is for, as its plan says, else from its address and what it holds. */ export function aiSiteImportPageRoleOf(doc, slug) {
@@ -732,10 +759,18 @@ const WORD_KINDS = new Set([
732
759
  'button'
733
760
  ]);
734
761
  /** The longest quote a kept set of quotes sets side by side. */ const QUOTE_ACROSS_CHARS = 220;
735
- /** The frame a source's picture is cropped to where a redesign places it: wide across the page, closer in a column. */ const FRAME = {
736
- wide: '16 / 9',
737
- column: '4 / 3'
762
+ /**
763
+ * The height a source's picture is cropped to where a redesign places it on
764
+ * its own, in px (AGL-4152): wide across the page, closer in a column. A
765
+ * height, not a shape: the Image takes it as its own height field, so a page
766
+ * of pictures kept one by one repeats one style key on each (its rounding),
767
+ * never two, which rule 16 refuses as a repeated inline style. Pictures side
768
+ * by side in a row are cropped alike, whatever shapes they came in.
769
+ */ export const AI_SITE_IMPORT_IMPROVE_FRAME_PX = {
770
+ wide: 420,
771
+ column: 300
738
772
  };
773
+ /** The shape a picture on a card is cropped to (AGL-4152): every card of a row alike. */ const CARD_FRAME = '4 / 3';
739
774
  /** The least share of a picture's own words a card says for the card to take that picture (AGL-4152). */ const CARD_PICTURE_KEPT = 0.5;
740
775
  /**
741
776
  * The source's own pictures each set of written cards takes (AGL-4152), by
@@ -815,10 +850,16 @@ const WORD_KINDS = new Set([
815
850
  const written = [];
816
851
  // A brand band in a brand the theme had to deepen would read as neither: dark holds its place.
817
852
  const deepened = !!input.theme && !!input.theme.button.fill && input.theme.button.fill !== input.theme.light.brand;
818
- const resolve = (to)=>{
853
+ // A link to the page it is on, or to the section it sits in, goes nowhere (AGL-4152): to the page's form where it
854
+ // keeps one, which is what a contact page's "Request a quote" means, else it is left out.
855
+ const own = aiSiteImportOwnPage(doc);
856
+ const resolve = (to, at)=>{
819
857
  var _destinations_get;
820
858
  if (!to) return undefined;
821
- return (_destinations_get = destinations.get(to)) != null ? _destinations_get : undefined;
859
+ const resolved = (_destinations_get = destinations.get(to)) != null ? _destinations_get : undefined;
860
+ if (!resolved || resolved !== own && resolved !== `#${at + 1}`) return resolved;
861
+ const form = destinations.get('form');
862
+ return form && form !== `#${at + 1}` ? form : undefined;
822
863
  };
823
864
  const say = (text)=>{
824
865
  if (text == null ? void 0 : text.trim()) written.push(clean(text));
@@ -828,12 +869,11 @@ const WORD_KINDS = new Set([
828
869
  if ((item == null ? void 0 : item.kind) !== 'picture') return null;
829
870
  const picture = aiSiteImportTakePicture(scope, item.lines[0]);
830
871
  return picture ? _extends({}, picture, {
831
- fit: {
832
- ratio: frame,
872
+ fit: _extends({}, frame, {
833
873
  cropped: true,
834
874
  objectFit: 'cover',
835
875
  rounded: true
836
- }
876
+ })
837
877
  }) : null;
838
878
  };
839
879
  // A few short quotes kept whole sit side by side, as a designer sets them, wherever the old page stacked them; in a column, one under another.
@@ -852,7 +892,9 @@ const WORD_KINDS = new Set([
852
892
  col
853
893
  } : {};
854
894
  if (item.kind === 'picture') {
855
- const picture = pictureOf(ref, col !== undefined ? FRAME.column : FRAME.wide);
895
+ const picture = pictureOf(ref, {
896
+ height: col !== undefined ? AI_SITE_IMPORT_IMPROVE_FRAME_PX.column : AI_SITE_IMPORT_IMPROVE_FRAME_PX.wide
897
+ });
856
898
  return picture ? [
857
899
  _extends({
858
900
  kind: 'image',
@@ -911,8 +953,10 @@ const WORD_KINDS = new Set([
911
953
  ];
912
954
  }
913
955
  if (block.kind === 'button') {
956
+ const to = resolve(block.to, index);
957
+ // A button that goes nowhere a visitor is not already is no call to action: it is left out.
958
+ if (block.to && !to) return [];
914
959
  say(block.text);
915
- const to = resolve(block.to);
916
960
  const { to: _asked } = block, rest = _object_without_properties_loose(block, [
917
961
  "to"
918
962
  ]);
@@ -927,8 +971,10 @@ const WORD_KINDS = new Set([
927
971
  say(item.title);
928
972
  say(item.text);
929
973
  const given = item.ref || ((_carded_get = carded.get(block)) == null ? void 0 : _carded_get[at]);
930
- const picture = given ? pictureOf(given, '4 / 3') : null;
931
- const to = resolve(item.to);
974
+ const picture = given ? pictureOf(given, {
975
+ ratio: CARD_FRAME
976
+ }) : null;
977
+ const to = resolve(item.to, index);
932
978
  const { ref: _ref, to: _to } = item, rest = _object_without_properties_loose(item, [
933
979
  "ref",
934
980
  "to"
@@ -1129,25 +1175,140 @@ const plus = (a, b)=>({
1129
1175
  'improve-columns',
1130
1176
  'improve-framing'
1131
1177
  ]);
1178
+ /** The most reasons a page's record keeps of why its redesign missed (AGL-4152). */ export const AI_SITE_IMPORT_REDESIGN_WHY_MOST = 8;
1179
+ /** The most characters one reason keeps: the line it names and what it says of it. */ export const AI_SITE_IMPORT_REDESIGN_WHY_CHARS = 300;
1180
+ /**
1181
+ * Why a redesign missed, line by line (AGL-4152): each violation's code, its
1182
+ * message (which names the line it found, `section 1, block 2, "…"`) and its
1183
+ * detail, cut short, at most `AI_SITE_IMPORT_REDESIGN_WHY_MOST`. What the
1184
+ * page's log and its record say, so a miss can be read after the job, when
1185
+ * the answer itself is gone. For the job's record, never the owner's row.
1186
+ */ export function aiSiteImportRedesignWhy(violations) {
1187
+ const out = [];
1188
+ for (const violation of violations){
1189
+ const said = clean(`${violation.code}: ${violation.message}${violation.detail ? ` ${violation.detail}` : ''}`);
1190
+ const line = said.length > AI_SITE_IMPORT_REDESIGN_WHY_CHARS ? `${said.slice(0, AI_SITE_IMPORT_REDESIGN_WHY_CHARS - 1)}…` : said;
1191
+ if (!out.includes(line)) out.push(line);
1192
+ if (out.length >= AI_SITE_IMPORT_REDESIGN_WHY_MOST) break;
1193
+ }
1194
+ return out;
1195
+ }
1132
1196
  /** Whether every miss of an answer is one it may be taken with past its last re-ask. */ export function aiSiteImportImproveOnlySoft(violations) {
1133
1197
  return violations.length > 0 && violations.every((violation)=>AI_SITE_IMPORT_IMPROVE_SOFT_CODES.has(violation.code));
1134
1198
  }
1135
- /** Every line a redesign's facts may come from: its page, what the site says of itself, its wave's other pages, its name. */ export function aiSiteImportImproveScope(doc, siteName) {
1136
- var _doc_siteLines, _doc_scope;
1199
+ /**
1200
+ * The words of a site's plan (AGL-4152): what it says the site is and who it
1201
+ * is for, its menu's and footer's labels, its call to action and its proposed
1202
+ * page. A redesign is told the plan as its digest, and the plan's own words
1203
+ * were held to what the site says when it was made, so a redesign that
1204
+ * repeats them invents nothing.
1205
+ */ export function aiSiteImportPlanLines(plan) {
1206
+ if (!plan) return [];
1207
+ return [
1208
+ plan.site.what,
1209
+ plan.site.audience,
1210
+ ...plan.nav.groups.map((group)=>group.label),
1211
+ ...plan.nav.footer.map((group)=>group.label),
1212
+ ...plan.nav.primaryCta ? [
1213
+ plan.nav.primaryCta.label
1214
+ ] : [],
1215
+ ...plan.proposed ? [
1216
+ plan.proposed.title,
1217
+ plan.proposed.purpose
1218
+ ] : []
1219
+ ].filter((line)=>typeof line === 'string' && !!line.trim());
1220
+ }
1221
+ /** A web address's top-level part, which says nothing of a name. */ const TLD = /\.(?:com|org|net|io|co|ai|app|dev|us|uk|ca|au|de|fr|info|biz|me|shop|store|site|online)(?:\.[a-z]{2})?$/i;
1222
+ /**
1223
+ * The ways a site's name is said (AGL-4152), where it is written as one run
1224
+ * of letters: a web address ("RidgelineBuilders.com") or a name run together.
1225
+ * Its address part dropped, its capitals and digits split ("Ridgeline
1226
+ * Builders"), a run of capitals on its own ("ABC" of "ABCroofing"), and a run
1227
+ * of small letters split into the words the site says elsewhere ("roofing
1228
+ * site" of "roofingsite"). A redesign that names the business as a visitor
1229
+ * would invents nothing.
1230
+ */ export function aiSiteImportNameVariants(name, said) {
1231
+ const text = clean(name);
1232
+ if (!text || /\s/.test(text) || text.length < 4) return [];
1233
+ const bare = text.replace(/^https?:\/\//i, '').replace(/^www\./i, '').replace(/\/.*$/, '').replace(TLD, '');
1234
+ // A run of small letters as the words the site says, longest first; itself where they do not make it up.
1235
+ const segment = (run)=>{
1236
+ if (run.length < 6 || said.has(run.toLowerCase())) return [
1237
+ run
1238
+ ];
1239
+ const out = [];
1240
+ let rest = run.toLowerCase();
1241
+ while(rest){
1242
+ let found = '';
1243
+ for(let end = rest.length; end >= 3 && !found; end -= 1)if (said.has(rest.slice(0, end))) found = rest.slice(0, end);
1244
+ if (!found) return [
1245
+ run
1246
+ ];
1247
+ out.push(found);
1248
+ rest = rest.slice(found.length);
1249
+ }
1250
+ return out;
1251
+ };
1252
+ const words = bare.split(/[-_.]+|(?<=[a-z])(?=[A-Z])|(?<=[A-Za-z])(?=\d)|(?<=\d)(?=[A-Za-z])/).filter(Boolean).flatMap((part)=>{
1253
+ // A run of capitals before small letters: "ABCroofing" is "ABC" and "roofing", "ABCRoofing" "ABC" and "Roofing".
1254
+ const lead = /^([A-Z]{2,})([a-z]+)$/.exec(part);
1255
+ if (!lead) return segment(part);
1256
+ const caps = lead[1];
1257
+ const tail = `${caps.slice(-1)}${lead[2]}`;
1258
+ return said.has(tail.toLowerCase()) ? [
1259
+ caps.slice(0, -1),
1260
+ tail
1261
+ ] : [
1262
+ caps,
1263
+ ...segment(lead[2])
1264
+ ];
1265
+ });
1266
+ const titled = words.map((word)=>{
1267
+ var _word_;
1268
+ return /^[a-z]/.test(word) ? `${(_word_ = word[0]) == null ? void 0 : _word_.toUpperCase()}${word.slice(1)}` : word;
1269
+ }).join(' ');
1270
+ return [
1271
+ ...new Set([
1272
+ bare,
1273
+ titled
1274
+ ])
1275
+ ].filter((variant)=>variant && variant !== text);
1276
+ }
1277
+ /** Every line a redesign's facts may come from: its page, what the site says of itself, its wave's other pages, its plan, its name. */ export function aiSiteImportImproveScope(doc, siteName) {
1278
+ var _doc_siteLines, _doc_scope, _doc_siteLines1;
1137
1279
  const own = doc.blocks.flatMap((block)=>block.kind === 'image' ? block.alt ? [
1138
1280
  block.alt
1139
1281
  ] : [] : block.text ? [
1140
1282
  block.text
1141
1283
  ] : []);
1142
- return [
1284
+ const lines = [
1143
1285
  ...own,
1144
1286
  ...(_doc_siteLines = doc.siteLines) != null ? _doc_siteLines : [],
1145
1287
  ...(_doc_scope = doc.scope) != null ? _doc_scope : [],
1288
+ ...aiSiteImportPlanLines(doc.plan),
1146
1289
  doc.title,
1147
1290
  ...siteName ? [
1148
1291
  siteName
1149
1292
  ] : []
1150
1293
  ].map(clean).filter(Boolean);
1294
+ // The site's name as a visitor says it, where it is written as an address or run together (AGL-4152).
1295
+ const said = new Set(lines.flatMap((line)=>{
1296
+ var _line_toLowerCase_match;
1297
+ return (_line_toLowerCase_match = line.toLowerCase().match(RegExp("[\\u0041-\\u005A\\u0061-\\u007A\\u00AA\\u00B5\\u00BA\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376-\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0560-\\u0588\\u05D0-\\u05EA\\u05EF-\\u05F2\\u0620-\\u064A\\u066E-\\u066F\\u0671-\\u06D3\\u06D5\\u06E5-\\u06E6\\u06EE-\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4-\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u0860-\\u086A\\u0870-\\u0887\\u0889-\\u088F\\u08A0-\\u08C9\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F-\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC-\\u09DD\\u09DF-\\u09E1\\u09F0-\\u09F1\\u09FC\\u0A05-\\u0A0A\\u0A0F-\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32-\\u0A33\\u0A35-\\u0A36\\u0A38-\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2-\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0-\\u0AE1\\u0AF9\\u0B05-\\u0B0C\\u0B0F-\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32-\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C-\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99-\\u0B9A\\u0B9C\\u0B9E-\\u0B9F\\u0BA3-\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58-\\u0C5A\\u0C5C-\\u0C5D\\u0C60-\\u0C61\\u0C80\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDC-\\u0CDE\\u0CE0-\\u0CE1\\u0CF1-\\u0CF2\\u0D04-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D54-\\u0D56\\u0D5F-\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32-\\u0E33\\u0E40-\\u0E46\\u0E81-\\u0E82\\u0E84\\u0E86-\\u0E8A\\u0E8C-\\u0EA3\\u0EA5\\u0EA7-\\u0EB0\\u0EB2-\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065-\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16F1-\\u16F8\\u1700-\\u1711\\u171F-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1878\\u1880-\\u1884\\u1887-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4C\\u1B83-\\u1BA0\\u1BAE-\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1C80-\\u1C8A\\u1C90-\\u1CBA\\u1CBD-\\u1CBF\\u1CE9-\\u1CEC\\u1CEE-\\u1CF3\\u1CF5-\\u1CF6\\u1CFA\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2183-\\u2184\\u2C00-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3006\\u3031-\\u3035\\u303B-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312F\\u3131-\\u318E\\u31A0-\\u31BF\\u31F0-\\u31FF\\u3400-\\u4DBF\\u4E00-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A-\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6E5\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7DC\\uA7F1-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA8FD-\\uA8FE\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5-\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB69\\uAB70-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40-\\uFB41\\uFB43-\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC\\u{10000}-\\u{1000B}\\u{1000D}-\\u{10026}\\u{10028}-\\u{1003A}\\u{1003C}-\\u{1003D}\\u{1003F}-\\u{1004D}\\u{10050}-\\u{1005D}\\u{10080}-\\u{100FA}\\u{10280}-\\u{1029C}\\u{102A0}-\\u{102D0}\\u{10300}-\\u{1031F}\\u{1032D}-\\u{10340}\\u{10342}-\\u{10349}\\u{10350}-\\u{10375}\\u{10380}-\\u{1039D}\\u{103A0}-\\u{103C3}\\u{103C8}-\\u{103CF}\\u{10400}-\\u{1049D}\\u{104B0}-\\u{104D3}\\u{104D8}-\\u{104FB}\\u{10500}-\\u{10527}\\u{10530}-\\u{10563}\\u{10570}-\\u{1057A}\\u{1057C}-\\u{1058A}\\u{1058C}-\\u{10592}\\u{10594}-\\u{10595}\\u{10597}-\\u{105A1}\\u{105A3}-\\u{105B1}\\u{105B3}-\\u{105B9}\\u{105BB}-\\u{105BC}\\u{105C0}-\\u{105F3}\\u{10600}-\\u{10736}\\u{10740}-\\u{10755}\\u{10760}-\\u{10767}\\u{10780}-\\u{10785}\\u{10787}-\\u{107B0}\\u{107B2}-\\u{107BA}\\u{10800}-\\u{10805}\\u{10808}\\u{1080A}-\\u{10835}\\u{10837}-\\u{10838}\\u{1083C}\\u{1083F}-\\u{10855}\\u{10860}-\\u{10876}\\u{10880}-\\u{1089E}\\u{108E0}-\\u{108F2}\\u{108F4}-\\u{108F5}\\u{10900}-\\u{10915}\\u{10920}-\\u{10939}\\u{10940}-\\u{10959}\\u{10980}-\\u{109B7}\\u{109BE}-\\u{109BF}\\u{10A00}\\u{10A10}-\\u{10A13}\\u{10A15}-\\u{10A17}\\u{10A19}-\\u{10A35}\\u{10A60}-\\u{10A7C}\\u{10A80}-\\u{10A9C}\\u{10AC0}-\\u{10AC7}\\u{10AC9}-\\u{10AE4}\\u{10B00}-\\u{10B35}\\u{10B40}-\\u{10B55}\\u{10B60}-\\u{10B72}\\u{10B80}-\\u{10B91}\\u{10C00}-\\u{10C48}\\u{10C80}-\\u{10CB2}\\u{10CC0}-\\u{10CF2}\\u{10D00}-\\u{10D23}\\u{10D4A}-\\u{10D65}\\u{10D6F}-\\u{10D85}\\u{10E80}-\\u{10EA9}\\u{10EB0}-\\u{10EB1}\\u{10EC2}-\\u{10EC7}\\u{10F00}-\\u{10F1C}\\u{10F27}\\u{10F30}-\\u{10F45}\\u{10F70}-\\u{10F81}\\u{10FB0}-\\u{10FC4}\\u{10FE0}-\\u{10FF6}\\u{11003}-\\u{11037}\\u{11071}-\\u{11072}\\u{11075}\\u{11083}-\\u{110AF}\\u{110D0}-\\u{110E8}\\u{11103}-\\u{11126}\\u{11144}\\u{11147}\\u{11150}-\\u{11172}\\u{11176}\\u{11183}-\\u{111B2}\\u{111C1}-\\u{111C4}\\u{111DA}\\u{111DC}\\u{11200}-\\u{11211}\\u{11213}-\\u{1122B}\\u{1123F}-\\u{11240}\\u{11280}-\\u{11286}\\u{11288}\\u{1128A}-\\u{1128D}\\u{1128F}-\\u{1129D}\\u{1129F}-\\u{112A8}\\u{112B0}-\\u{112DE}\\u{11305}-\\u{1130C}\\u{1130F}-\\u{11310}\\u{11313}-\\u{11328}\\u{1132A}-\\u{11330}\\u{11332}-\\u{11333}\\u{11335}-\\u{11339}\\u{1133D}\\u{11350}\\u{1135D}-\\u{11361}\\u{11380}-\\u{11389}\\u{1138B}\\u{1138E}\\u{11390}-\\u{113B5}\\u{113B7}\\u{113D1}\\u{113D3}\\u{11400}-\\u{11434}\\u{11447}-\\u{1144A}\\u{1145F}-\\u{11461}\\u{11480}-\\u{114AF}\\u{114C4}-\\u{114C5}\\u{114C7}\\u{11580}-\\u{115AE}\\u{115D8}-\\u{115DB}\\u{11600}-\\u{1162F}\\u{11644}\\u{11680}-\\u{116AA}\\u{116B8}\\u{11700}-\\u{1171A}\\u{11740}-\\u{11746}\\u{11800}-\\u{1182B}\\u{118A0}-\\u{118DF}\\u{118FF}-\\u{11906}\\u{11909}\\u{1190C}-\\u{11913}\\u{11915}-\\u{11916}\\u{11918}-\\u{1192F}\\u{1193F}\\u{11941}\\u{119A0}-\\u{119A7}\\u{119AA}-\\u{119D0}\\u{119E1}\\u{119E3}\\u{11A00}\\u{11A0B}-\\u{11A32}\\u{11A3A}\\u{11A50}\\u{11A5C}-\\u{11A89}\\u{11A9D}\\u{11AB0}-\\u{11AF8}\\u{11BC0}-\\u{11BE0}\\u{11C00}-\\u{11C08}\\u{11C0A}-\\u{11C2E}\\u{11C40}\\u{11C72}-\\u{11C8F}\\u{11D00}-\\u{11D06}\\u{11D08}-\\u{11D09}\\u{11D0B}-\\u{11D30}\\u{11D46}\\u{11D60}-\\u{11D65}\\u{11D67}-\\u{11D68}\\u{11D6A}-\\u{11D89}\\u{11D98}\\u{11DB0}-\\u{11DDB}\\u{11EE0}-\\u{11EF2}\\u{11F02}\\u{11F04}-\\u{11F10}\\u{11F12}-\\u{11F33}\\u{11FB0}\\u{12000}-\\u{12399}\\u{12480}-\\u{12543}\\u{12F90}-\\u{12FF0}\\u{13000}-\\u{1342F}\\u{13441}-\\u{13446}\\u{13460}-\\u{143FA}\\u{14400}-\\u{14646}\\u{16100}-\\u{1611D}\\u{16800}-\\u{16A38}\\u{16A40}-\\u{16A5E}\\u{16A70}-\\u{16ABE}\\u{16AD0}-\\u{16AED}\\u{16B00}-\\u{16B2F}\\u{16B40}-\\u{16B43}\\u{16B63}-\\u{16B77}\\u{16B7D}-\\u{16B8F}\\u{16D40}-\\u{16D6C}\\u{16E40}-\\u{16E7F}\\u{16EA0}-\\u{16EB8}\\u{16EBB}-\\u{16ED3}\\u{16F00}-\\u{16F4A}\\u{16F50}\\u{16F93}-\\u{16F9F}\\u{16FE0}-\\u{16FE1}\\u{16FE3}\\u{16FF2}-\\u{16FF3}\\u{17000}-\\u{18CD5}\\u{18CFF}-\\u{18D1E}\\u{18D80}-\\u{18DF2}\\u{1AFF0}-\\u{1AFF3}\\u{1AFF5}-\\u{1AFFB}\\u{1AFFD}-\\u{1AFFE}\\u{1B000}-\\u{1B122}\\u{1B132}\\u{1B150}-\\u{1B152}\\u{1B155}\\u{1B164}-\\u{1B167}\\u{1B170}-\\u{1B2FB}\\u{1BC00}-\\u{1BC6A}\\u{1BC70}-\\u{1BC7C}\\u{1BC80}-\\u{1BC88}\\u{1BC90}-\\u{1BC99}\\u{1D400}-\\u{1D454}\\u{1D456}-\\u{1D49C}\\u{1D49E}-\\u{1D49F}\\u{1D4A2}\\u{1D4A5}-\\u{1D4A6}\\u{1D4A9}-\\u{1D4AC}\\u{1D4AE}-\\u{1D4B9}\\u{1D4BB}\\u{1D4BD}-\\u{1D4C3}\\u{1D4C5}-\\u{1D505}\\u{1D507}-\\u{1D50A}\\u{1D50D}-\\u{1D514}\\u{1D516}-\\u{1D51C}\\u{1D51E}-\\u{1D539}\\u{1D53B}-\\u{1D53E}\\u{1D540}-\\u{1D544}\\u{1D546}\\u{1D54A}-\\u{1D550}\\u{1D552}-\\u{1D6A5}\\u{1D6A8}-\\u{1D6C0}\\u{1D6C2}-\\u{1D6DA}\\u{1D6DC}-\\u{1D6FA}\\u{1D6FC}-\\u{1D714}\\u{1D716}-\\u{1D734}\\u{1D736}-\\u{1D74E}\\u{1D750}-\\u{1D76E}\\u{1D770}-\\u{1D788}\\u{1D78A}-\\u{1D7A8}\\u{1D7AA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}\\u{2CEB0}-\\u{2EBE0}\\u{2EBF0}-\\u{2EE5D}\\u{2F800}-\\u{2FA1D}\\u{30000}-\\u{3134A}\\u{31350}-\\u{33479}\\u0030-\\u0039\\u00B2-\\u00B3\\u00B9\\u00BC-\\u00BE\\u0660-\\u0669\\u06F0-\\u06F9\\u07C0-\\u07C9\\u0966-\\u096F\\u09E6-\\u09EF\\u09F4-\\u09F9\\u0A66-\\u0A6F\\u0AE6-\\u0AEF\\u0B66-\\u0B6F\\u0B72-\\u0B77\\u0BE6-\\u0BF2\\u0C66-\\u0C6F\\u0C78-\\u0C7E\\u0CE6-\\u0CEF\\u0D58-\\u0D5E\\u0D66-\\u0D78\\u0DE6-\\u0DEF\\u0E50-\\u0E59\\u0ED0-\\u0ED9\\u0F20-\\u0F33\\u1040-\\u1049\\u1090-\\u1099\\u1369-\\u137C\\u16EE-\\u16F0\\u17E0-\\u17E9\\u17F0-\\u17F9\\u1810-\\u1819\\u1946-\\u194F\\u19D0-\\u19DA\\u1A80-\\u1A89\\u1A90-\\u1A99\\u1B50-\\u1B59\\u1BB0-\\u1BB9\\u1C40-\\u1C49\\u1C50-\\u1C59\\u2070\\u2074-\\u2079\\u2080-\\u2089\\u2150-\\u2182\\u2185-\\u2189\\u2460-\\u249B\\u24EA-\\u24FF\\u2776-\\u2793\\u2CFD\\u3007\\u3021-\\u3029\\u3038-\\u303A\\u3192-\\u3195\\u3220-\\u3229\\u3248-\\u324F\\u3251-\\u325F\\u3280-\\u3289\\u32B1-\\u32BF\\uA620-\\uA629\\uA6E6-\\uA6EF\\uA830-\\uA835\\uA8D0-\\uA8D9\\uA900-\\uA909\\uA9D0-\\uA9D9\\uA9F0-\\uA9F9\\uAA50-\\uAA59\\uABF0-\\uABF9\\uFF10-\\uFF19\\u{10107}-\\u{10133}\\u{10140}-\\u{10178}\\u{1018A}-\\u{1018B}\\u{102E1}-\\u{102FB}\\u{10320}-\\u{10323}\\u{10341}\\u{1034A}\\u{103D1}-\\u{103D5}\\u{104A0}-\\u{104A9}\\u{10858}-\\u{1085F}\\u{10879}-\\u{1087F}\\u{108A7}-\\u{108AF}\\u{108FB}-\\u{108FF}\\u{10916}-\\u{1091B}\\u{109BC}-\\u{109BD}\\u{109C0}-\\u{109CF}\\u{109D2}-\\u{109FF}\\u{10A40}-\\u{10A48}\\u{10A7D}-\\u{10A7E}\\u{10A9D}-\\u{10A9F}\\u{10AEB}-\\u{10AEF}\\u{10B58}-\\u{10B5F}\\u{10B78}-\\u{10B7F}\\u{10BA9}-\\u{10BAF}\\u{10CFA}-\\u{10CFF}\\u{10D30}-\\u{10D39}\\u{10D40}-\\u{10D49}\\u{10E60}-\\u{10E7E}\\u{10F1D}-\\u{10F26}\\u{10F51}-\\u{10F54}\\u{10FC5}-\\u{10FCB}\\u{11052}-\\u{1106F}\\u{110F0}-\\u{110F9}\\u{11136}-\\u{1113F}\\u{111D0}-\\u{111D9}\\u{111E1}-\\u{111F4}\\u{112F0}-\\u{112F9}\\u{11450}-\\u{11459}\\u{114D0}-\\u{114D9}\\u{11650}-\\u{11659}\\u{116C0}-\\u{116C9}\\u{116D0}-\\u{116E3}\\u{11730}-\\u{1173B}\\u{118E0}-\\u{118F2}\\u{11950}-\\u{11959}\\u{11BF0}-\\u{11BF9}\\u{11C50}-\\u{11C6C}\\u{11D50}-\\u{11D59}\\u{11DA0}-\\u{11DA9}\\u{11DE0}-\\u{11DE9}\\u{11F50}-\\u{11F59}\\u{11FC0}-\\u{11FD4}\\u{12400}-\\u{1246E}\\u{16130}-\\u{16139}\\u{16A60}-\\u{16A69}\\u{16AC0}-\\u{16AC9}\\u{16B50}-\\u{16B59}\\u{16B5B}-\\u{16B61}\\u{16D70}-\\u{16D79}\\u{16E80}-\\u{16E96}\\u{16FF4}-\\u{16FF6}\\u{1CCF0}-\\u{1CCF9}\\u{1D2C0}-\\u{1D2D3}\\u{1D2E0}-\\u{1D2F3}\\u{1D360}-\\u{1D378}\\u{1D7CE}-\\u{1D7FF}\\u{1E140}-\\u{1E149}\\u{1E2F0}-\\u{1E2F9}\\u{1E4F0}-\\u{1E4F9}\\u{1E5F1}-\\u{1E5FA}\\u{1E8C7}-\\u{1E8CF}\\u{1E950}-\\u{1E959}\\u{1EC71}-\\u{1ECAB}\\u{1ECAD}-\\u{1ECAF}\\u{1ECB1}-\\u{1ECB4}\\u{1ED01}-\\u{1ED2D}\\u{1ED2F}-\\u{1ED3D}\\u{1F100}-\\u{1F10C}\\u{1FBF0}-\\u{1FBF9}]+", "gu"))) != null ? _line_toLowerCase_match : [];
1298
+ }));
1299
+ const names = [
1300
+ ...new Set([
1301
+ ...siteName ? [
1302
+ siteName
1303
+ ] : [],
1304
+ ...((_doc_siteLines1 = doc.siteLines) != null ? _doc_siteLines1 : []).slice(0, 6)
1305
+ ])
1306
+ ];
1307
+ const variants = names.flatMap((name)=>aiSiteImportNameVariants(name, said)).filter((variant)=>!lines.includes(variant));
1308
+ return [
1309
+ ...lines,
1310
+ ...variants
1311
+ ];
1151
1312
  }
1152
1313
  /** What each line that missed says to the one re-ask. */ const MISS = {
1153
1314
  facts: 'The page leaves out a fact the owner gives. Say every name, number, price, date, phone and address the ledger shows.',
@@ -1199,7 +1360,7 @@ const plus = (a, b)=>({
1199
1360
  * re-ask; a second miss is the caller's fallback.
1200
1361
  */ export function aiSiteImportImproveCheck(input) {
1201
1362
  return (answer)=>{
1202
- var _input_framing, _input_plan, _input_theme;
1363
+ var _input_framing, _input_vocabulary, _input_plan, _input_theme;
1203
1364
  const read = aiReadImprovedPage(answer);
1204
1365
  if (!read) return {
1205
1366
  value: null,
@@ -1216,11 +1377,14 @@ const plus = (a, b)=>({
1216
1377
  sections: read.length,
1217
1378
  formSection: formAt === -1 ? null : formAt
1218
1379
  });
1380
+ const own = aiSiteImportOwnPage(input.doc);
1219
1381
  const honesty = aiSiteImportHonesty(read, {
1220
1382
  ledger: input.ledger,
1221
1383
  scope: input.scope,
1222
1384
  destinations,
1223
- framing: (_input_framing = input.framing) != null ? _input_framing : null
1385
+ framing: (_input_framing = input.framing) != null ? _input_framing : null,
1386
+ vocabulary: (_input_vocabulary = input.vocabulary) != null ? _input_vocabulary : [],
1387
+ own
1224
1388
  });
1225
1389
  // What it lost and how it is planned, named together, so the one re-ask mends both.
1226
1390
  const planned = input.needs ? aiSiteImportImprovePlanMisses(read, {
@@ -1249,9 +1413,10 @@ const plus = (a, b)=>({
1249
1413
  value: null,
1250
1414
  violations: built.violations
1251
1415
  };
1416
+ // A link the source makes to the page it is on asks nothing of the page (AGL-4152).
1252
1417
  const wanted = input.ledger.links.flatMap((link)=>{
1253
1418
  const to = destinations.get(link.ref);
1254
- return to ? [
1419
+ return to && to !== own ? [
1255
1420
  to
1256
1421
  ] : [];
1257
1422
  });