@aglyn/plugins-ai 1.11.0 → 1.12.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 (58) hide show
  1. package/package.json +17 -17
  2. package/src/lib/jobs/ai-job-import-step.d.ts +1 -1
  3. package/src/lib/jobs/ai-job-import-step.js +26 -7
  4. package/src/lib/jobs/ai-job-import-step.js.map +1 -1
  5. package/src/lib/jobs/ai-job-privacy-step.js +2 -2
  6. package/src/lib/jobs/ai-job-privacy-step.js.map +1 -1
  7. package/src/lib/jobs/ai-site-import-compile.js +27 -37
  8. package/src/lib/jobs/ai-site-import-compile.js.map +1 -1
  9. package/src/lib/jobs/ai-site-import-look.js +20 -1
  10. package/src/lib/jobs/ai-site-import-look.js.map +1 -1
  11. package/src/lib/layout-language/ai-layout-compiler.js +7 -1
  12. package/src/lib/layout-language/ai-layout-compiler.js.map +1 -1
  13. package/src/lib/model/ai-credit-estimate.d.ts +15 -0
  14. package/src/lib/model/ai-credit-estimate.js +13 -0
  15. package/src/lib/model/ai-credit-estimate.js.map +1 -1
  16. package/src/lib/model/ai-site-import-fidelity.d.ts +46 -3
  17. package/src/lib/model/ai-site-import-fidelity.js +254 -62
  18. package/src/lib/model/ai-site-import-fidelity.js.map +1 -1
  19. package/src/lib/model/ai-site-import-report.d.ts +7 -0
  20. package/src/lib/model/ai-site-import-report.js +17 -5
  21. package/src/lib/model/ai-site-import-report.js.map +1 -1
  22. package/src/lib/model/ai-site-import.d.ts +46 -3
  23. package/src/lib/model/ai-site-import.js +34 -11
  24. package/src/lib/model/ai-site-import.js.map +1 -1
  25. package/src/lib/model/ai-site-look.d.ts +16 -0
  26. package/src/lib/model/ai-site-look.js +76 -14
  27. package/src/lib/model/ai-site-look.js.map +1 -1
  28. package/src/lib/site-import/fixtures/aglyn-com-recordings.d.ts +2 -1
  29. package/src/lib/site-import/fixtures/aglyn-com-recordings.js +3 -2
  30. package/src/lib/site-import/fixtures/aglyn-com-recordings.js.map +1 -1
  31. package/src/lib/site-import/fixtures/site-import-crawl-recordings.d.ts +5 -0
  32. package/src/lib/site-import/fixtures/site-import-crawl-recordings.js +116 -3
  33. package/src/lib/site-import/fixtures/site-import-crawl-recordings.js.map +1 -1
  34. package/src/lib/site-import/fixtures/site-import-fidelity-replay.d.ts +7 -0
  35. package/src/lib/site-import/fixtures/site-import-fidelity-replay.js +15 -0
  36. package/src/lib/site-import/fixtures/site-import-fidelity-replay.js.map +1 -1
  37. package/src/lib/site-import/fixtures/site-layout-recordings.js +4 -3
  38. package/src/lib/site-import/fixtures/site-layout-recordings.js.map +1 -1
  39. package/src/lib/site-import/fixtures/site-look-slate.d.ts +2 -1
  40. package/src/lib/site-import/fixtures/site-look-slate.js +2 -1
  41. package/src/lib/site-import/fixtures/site-look-slate.js.map +1 -1
  42. package/src/lib/site-import/site-import-crawl.d.ts +7 -1
  43. package/src/lib/site-import/site-import-crawl.js +101 -6
  44. package/src/lib/site-import/site-import-crawl.js.map +1 -1
  45. package/src/lib/site-import/site-import-css.d.ts +8 -1
  46. package/src/lib/site-import/site-import-css.js +30 -8
  47. package/src/lib/site-import/site-import-css.js.map +1 -1
  48. package/src/lib/site-import/site-import-html.d.ts +2 -0
  49. package/src/lib/site-import/site-import-html.js +3 -0
  50. package/src/lib/site-import/site-import-html.js.map +1 -1
  51. package/src/lib/site-import/site-import-layout.d.ts +9 -2
  52. package/src/lib/site-import/site-import-layout.js +104 -30
  53. package/src/lib/site-import/site-import-layout.js.map +1 -1
  54. package/src/lib/site-import/site-import-page.js +5 -0
  55. package/src/lib/site-import/site-import-page.js.map +1 -1
  56. package/src/lib/site-import/site-import-same-page.d.ts +41 -0
  57. package/src/lib/site-import/site-import-same-page.js +108 -0
  58. package/src/lib/site-import/site-import-same-page.js.map +1 -0
@@ -54,6 +54,13 @@ export interface SiteImportLookPins {
54
54
  buttonFill: SiteImportLookPin;
55
55
  buttonText: SiteImportLookPin;
56
56
  buttonCase: SiteImportLookPin;
57
+ /** The soft bands' fill, in the light and the dark scheme; the dark's source `null` where its stylesheets say none. */
58
+ paper: SiteImportLookPin;
59
+ darkPaper: SiteImportLookPin;
60
+ /** An outlined button's words' color. */
61
+ buttonOutline: SiteImportLookPin;
62
+ /** The case its text buttons, and the links drawn as them, are set in. */
63
+ textCase: SiteImportLookPin;
57
64
  /** Where the theme's side was read: the site's theme as stored, or computed from its site style. */
58
65
  from: SiteImportFidelityTheme['from'] | null;
59
66
  }
@@ -26,7 +26,7 @@ import { _ as _extends } from "@swc/helpers/_/_extends";
26
26
  * p90.
27
27
  */ import { DEFAULT_SITE_THEME } from "@aglyn/aglyn/app-utils/default-site";
28
28
  import { readThemeOverride, resolveSiteTheme } from "@aglyn/aglyn/app-utils/site-theme";
29
- import { SITE_IMPORT_GROUND_DELTA, siteImportFidelityThemeOf, siteImportOklabDelta } from "./ai-site-import-fidelity.js";
29
+ import { SITE_IMPORT_GROUND_DELTA, siteImportFidelityThemeOf, siteImportOklabDelta, siteImportOutlinedColorOf } from "./ai-site-import-fidelity.js";
30
30
  import { aiSiteTheme } from "./ai-site-look.js";
31
31
  const named = (value)=>typeof value === 'string' && value.trim() ? value : null;
32
32
  /** The look a site wears: its base theme with what was saved over it, and which job saved it. */ export function siteImportLookReport(host, state) {
@@ -101,8 +101,8 @@ const hexOrNull = (value)=>typeof value === 'string' && /^#[0-9a-f]{6}$/i.test(v
101
101
  * dark ground, a filled button's fill and label, and its case. `null` where
102
102
  * the import read no look of its source.
103
103
  */ export function siteImportLookPins(host, state) {
104
- var _ref, _ref1, _ref2, _theme_button_fill, _theme_button_label, _ref3;
105
- var _state_home, _theme_dark;
104
+ var _ref, _ref1, _ref2, _theme_button_fill, _theme_button_label, _ref3, _ref4, _ref5, _ref6;
105
+ var _state_home, _theme_dark, _theme_dark1, _theme_button_text;
106
106
  const facts = state == null ? void 0 : (_state_home = state['home']) == null ? void 0 : _state_home['look'];
107
107
  if (!facts || typeof facts !== 'object') return null;
108
108
  const theme = siteImportFidelityThemeFor(host);
@@ -118,7 +118,15 @@ const hexOrNull = (value)=>typeof value === 'string' && /^#[0-9a-f]{6}$/i.test(v
118
118
  theme: drawn,
119
119
  delta: null
120
120
  },
121
- from: (_ref3 = theme == null ? void 0 : theme.from) != null ? _ref3 : null
121
+ paper: colorPin(facts['paperBackground'], (_ref3 = theme == null ? void 0 : theme.light.paper) != null ? _ref3 : null),
122
+ darkPaper: colorPin(facts['darkPaper'], (_ref4 = theme == null ? void 0 : (_theme_dark1 = theme.dark) == null ? void 0 : _theme_dark1.paper) != null ? _ref4 : null),
123
+ buttonOutline: colorPin(facts['buttonOutline'], theme ? siteImportOutlinedColorOf(theme) : null),
124
+ textCase: {
125
+ source: facts['textCase'] === 'upper' || facts['textCase'] === 'none' ? facts['textCase'] : null,
126
+ theme: (_ref5 = theme == null ? void 0 : (_theme_button_text = theme.button.text) == null ? void 0 : _theme_button_text.case) != null ? _ref5 : drawn,
127
+ delta: null
128
+ },
129
+ from: (_ref6 = theme == null ? void 0 : theme.from) != null ? _ref6 : null
122
130
  };
123
131
  }
124
132
  /** The pins as the look line prints them: each source → theme, a color with its ΔE and whether it moved past 0.05. */ export function siteImportLookPinsLine(pins) {
@@ -134,7 +142,11 @@ const hexOrNull = (value)=>typeof value === 'string' && /^#[0-9a-f]{6}$/i.test(v
134
142
  one('darkGround', pins.darkGround),
135
143
  one('buttonFill', pins.buttonFill),
136
144
  one('buttonText', pins.buttonText),
137
- one('buttonCase', pins.buttonCase)
145
+ one('buttonCase', pins.buttonCase),
146
+ one('paper', pins.paper),
147
+ one('darkPaper', pins.darkPaper),
148
+ one('buttonOutline', pins.buttonOutline),
149
+ one('textCase', pins.textCase)
138
150
  ].join(', ')}${where}`;
139
151
  }
140
152
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/model/ai-site-import-report.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 * What the fidelity report says of a built site beside its scores (AGL-4109),\n * pure so a spec reads it: the look the site wears and what its pages cost.\n *\n * The 11/1 report read `host.theme`, the base an import starts from, and said\n * the site wore the starter's indigo while it rendered the source's blue. The\n * look an import saves is `themeOverride` over that base, with `siteStyle`\n * beside it (`aiSaveSiteTheme`). The credits line printed a mean, while the\n * table a quote is made of (`AI_MEASURED_IMPORT_CREDITS`) is a median and a\n * p90.\n */\n\nimport { DEFAULT_SITE_THEME } from '@aglyn/aglyn/app-utils/default-site'\nimport { readThemeOverride, resolveSiteTheme } from '@aglyn/aglyn/app-utils/site-theme'\nimport type { AiJobItemLedger } from './ai-jobs.types'\nimport type { AiSiteImportFinish, AiSiteImportWords } from './ai-site-import'\nimport { SITE_IMPORT_GROUND_DELTA, siteImportFidelityThemeOf, siteImportOklabDelta, type SiteImportFidelityTheme } from './ai-site-import-fidelity'\nimport { aiSiteTheme, type AiSiteStyle } from './ai-site-look'\n\ntype Dict = Record<string, any>\n\n/** The look line's facts, as a site stores them and an import ran them. */\nexport interface SiteImportLookReport {\n /** The base theme the site was given: `siteStyle.base`, or `null` where it holds no style. */\n base: string | null\n /** Whether a look is saved over the base. */\n override: boolean\n /** The job whose look the site wears: `siteStyle.jobId`. */\n jobId: string | null\n /** The source's brand color the look was drawn from: `siteStyle.brand`. */\n brand: string | null\n /** What the import's look pass came to: `look.theme`. */\n pass: string | null\n primary: string | null\n secondary: string | null\n tertiary: string | null\n fonts: string[]\n /** What Keep my site pins of the source's look (AGL-4152), source beside theme; absent where the import read no look of its source. */\n pins?: SiteImportLookPins\n}\n\nconst named = (value: unknown): string | null => (typeof value === 'string' && value.trim() ? value : null)\n\n/** The look a site wears: its base theme with what was saved over it, and which job saved it. */\nexport function siteImportLookReport(host: Dict, state: Dict | null | undefined): SiteImportLookReport {\n const theme = (resolveSiteTheme(host) ?? {}) as Dict\n const light = (theme['colorSchemes']?.['light'] ?? {}) as Dict\n const style = (host['siteStyle'] ?? null) as Dict | null\n const pins = siteImportLookPins(host, state)\n return {\n base: named(style?.['base']),\n override: !!readThemeOverride(host),\n jobId: named(style?.['jobId']),\n brand: named(style?.['brand']),\n pass: named(state?.['look']?.['theme']),\n primary: named(light['primary']?.['main']),\n secondary: named(light['secondary']?.['main']),\n tertiary: named(light['tertiary']?.['main']),\n fonts: ((theme['fonts'] ?? []) as Dict[]).map((font) => String(font['family'] ?? '')).filter(Boolean),\n ...(pins ? { pins } : {}),\n }\n}\n\n/** The look line of the report: what the site wears, and whether it is this job's; and what Keep my site pins, source → theme, where the import read its source's look (AGL-4152). */\nexport function siteImportLookLine(host: Dict, state: Dict | null | undefined, jobId: string): string {\n const look = siteImportLookReport(host, state)\n const colors = (['primary', 'secondary', 'tertiary'] as const).map((key) => `${key} ${look[key] ?? 'not set'}`).join(', ')\n const brand = look.brand ? `, drawn from ${look.brand}` : ''\n const fonts = look.fonts.join(', ') || 'not set'\n const wearing = look.override ? `an override over the ${look.base ?? 'site'} base` : `the ${look.base ?? 'site'} base, no override`\n const whose = look.jobId ? (look.jobId === jobId ? 'saved by this job' : `saved by job ${look.jobId}, not this one`) : 'saved by no job'\n return `${look.pass ?? 'not run'}; ${colors}${brand}; ${fonts}; ${wearing}; ${whose}${look.pins ? `; ${siteImportLookPinsLine(look.pins)}` : ''}`\n}\n\n/*------------------------------------------\n * What Keep my site pins (AGL-4152)\n *-----------------------------------------*/\n\n/** One pin of the look: the source's, the theme's, and how far apart (OKLab ΔE, for a color). */\nexport interface SiteImportLookPin {\n source: string | null\n theme: string | null\n delta: number | null\n}\n\n/** The look's pins, the source's beside the theme's: its grounds, its filled buttons' fill, label and case. */\nexport interface SiteImportLookPins {\n ground: SiteImportLookPin\n darkGround: SiteImportLookPin\n buttonFill: SiteImportLookPin\n buttonText: SiteImportLookPin\n buttonCase: SiteImportLookPin\n /** Where the theme's side was read: the site's theme as stored, or computed from its site style. */\n from: SiteImportFidelityTheme['from'] | null\n}\n\n/** Whether a stored site style holds what its colors are drawn from. */\nfunction isStyle(value: unknown): value is AiSiteStyle {\n const style = value as Partial<AiSiteStyle> | null\n return !!style && typeof style === 'object' && typeof style.seed === 'number' && typeof style.ground === 'string' && typeof style.chroma === 'string' && typeof style.hue === 'number'\n}\n\n/**\n * The theme a built site's pages are drawn in, for the fidelity (AGL-4152):\n * the theme it stores, its override resolved; else, where it stores none,\n * one computed from its site style (`siteStyle`) over the starter theme, and\n * marked so. `null` for a site with neither.\n */\nexport function siteImportFidelityThemeFor(host: Dict): SiteImportFidelityTheme | null {\n const stored = siteImportFidelityThemeOf(resolveSiteTheme(host), 'theme')\n if (stored) return stored\n const style = host['siteStyle']\n return isStyle(style) ? siteImportFidelityThemeOf(aiSiteTheme(style, DEFAULT_SITE_THEME), 'style') : null\n}\n\nconst hexOrNull = (value: unknown): string | null => (typeof value === 'string' && /^#[0-9a-f]{6}$/i.test(value) ? value.toLowerCase() : null)\n\n/** A color pin: the two colors and how far apart. */\nfunction colorPin(source: unknown, theme: string | null): SiteImportLookPin {\n const from = hexOrNull(source)\n const to = hexOrNull(theme)\n return { source: from, theme: to, delta: from && to ? Math.round(siteImportOklabDelta(from, to) * 1000) / 1000 : null }\n}\n\n/**\n * What Keep my site pins of the source's look (AGL-4152), the source's as\n * the reader read it (`home.look`) beside the theme's: the page ground, the\n * dark ground, a filled button's fill and label, and its case. `null` where\n * the import read no look of its source.\n */\nexport function siteImportLookPins(host: Dict, state: Dict | null | undefined): SiteImportLookPins | null {\n const facts = state?.['home']?.['look'] as Dict | null | undefined\n if (!facts || typeof facts !== 'object') return null\n const theme = siteImportFidelityThemeFor(host)\n const wanted = facts['buttonCase'] === 'upper' || facts['buttonCase'] === 'none' ? (facts['buttonCase'] as string) : null\n const drawn = theme?.button.case ?? null\n return {\n ground: colorPin(facts['background'], theme?.light.ground ?? null),\n darkGround: colorPin(facts['darkBackground'], theme?.dark?.ground ?? null),\n buttonFill: colorPin(facts['buttonFill'], theme ? (theme.button.fill ?? theme.light.brand) : null),\n buttonText: colorPin(facts['buttonText'], theme ? (theme.button.label ?? theme.light.onBrand) : null),\n buttonCase: { source: wanted, theme: drawn, delta: null },\n from: theme?.from ?? null,\n }\n}\n\n/** The pins as the look line prints them: each source → theme, a color with its ΔE and whether it moved past 0.05. */\nexport function siteImportLookPinsLine(pins: SiteImportLookPins): string {\n const one = (name: string, pin: SiteImportLookPin) => {\n const said = `${name} ${pin.source ?? 'not read'} → ${pin.theme ?? 'not set'}`\n if (pin.delta !== null) return `${said} (ΔE ${pin.delta.toFixed(3)}, ${pin.delta <= SITE_IMPORT_GROUND_DELTA ? 'kept' : 'moved'})`\n return pin.source && pin.theme ? `${said} (${pin.source === pin.theme ? 'kept' : 'moved'})` : said\n }\n const where = pins.from === 'style' ? ', the theme computed from the site style' : pins.from === null ? ', no theme to read' : ''\n return `pins ${[one('ground', pins.ground), one('darkGround', pins.darkGround), one('buttonFill', pins.buttonFill), one('buttonText', pins.buttonText), one('buttonCase', pins.buttonCase)].join(', ')}${where}`\n}\n\n/**\n * How a page of an import was finished (AGL-4152), as the report scores it:\n * what was asked for on the command line, else what its wave was stamped\n * with at its start, else the import's own; an import that names none reads\n * as Keep my site. Its words are improved where the page says so, else where\n * its wave (or the import) improved them under Improve it.\n */\nexport function siteImportPageFinish(\n state: Dict,\n page: Dict,\n asked: { finish?: AiSiteImportFinish | null; words?: AiSiteImportWords | null } = {},\n): { finish: AiSiteImportFinish; words: AiSiteImportWords; from: 'asked' | 'wave' | 'import' | 'default' } {\n const finishOf = (value: unknown): AiSiteImportFinish | null => (value === 'keep' || value === 'improve' ? value : null)\n const wave = ((state['waves'] ?? []) as Dict[]).find((entry) => entry['index'] === page['wave']) ?? null\n const stamped = finishOf(wave?.['finish'])\n const own = finishOf(state['finish'])\n const finish = asked.finish ?? stamped ?? own ?? 'keep'\n const from = asked.finish ? 'asked' : stamped ? 'wave' : own ? 'import' : 'default'\n const pageWords = page['wording'] === 'kept' || page['wording'] === 'improved' ? (page['wording'] as AiSiteImportWords) : null\n const switched = (wave?.['wording'] ?? state['wording']) === true\n const words = asked.words ?? pageWords ?? (finish === 'improve' && switched ? 'improved' : 'kept')\n return { finish, words, from }\n}\n\n/** One kind of page's cost, as `AI_MEASURED_IMPORT_CREDITS` holds it. */\nexport interface SiteImportCreditsMeasured {\n count: number\n median: number\n p90: number\n mean: number\n}\n\n/** The middle value of what is sorted: the two middle ones' mean, for an even count. */\nfunction median(sorted: readonly number[]): number {\n const middle = Math.floor(sorted.length / 2)\n return sorted.length % 2 ? (sorted[middle] as number) : ((sorted[middle - 1] as number) + (sorted[middle] as number)) / 2\n}\n\n/**\n * What each kind of page cost by the ledger, as the table a quote is read\n * from is measured: over the items that came through and gave nothing back,\n * grouped by how their page was built. The p90 is the nearest rank.\n */\nexport function siteImportCreditsMeasured(\n state: { pages: ReadonlyArray<{ slot: string; build?: string | null }> },\n items: ReadonlyArray<Pick<AiJobItemLedger, 'slot' | 'status' | 'creditsSpent' | 'creditsRefunded'>>,\n): Partial<Record<'arranged' | 'copied', SiteImportCreditsMeasured>> {\n const buildOf = new Map(state.pages.map((page) => [page.slot, page.build ?? null]))\n const out: Partial<Record<'arranged' | 'copied', SiteImportCreditsMeasured>> = {}\n for (const build of ['arranged', 'copied'] as const) {\n const each = items\n .filter((item) => buildOf.get(item.slot) === build && item.status === 'succeeded' && !(Number(item.creditsRefunded) > 0))\n .map((item) => Number(item.creditsSpent ?? 0))\n .sort((a, b) => a - b)\n if (!each.length) continue\n const total = each.reduce((sum, value) => sum + value, 0)\n out[build] = { count: each.length, median: median(each), p90: each[Math.ceil(each.length * 0.9) - 1] as number, mean: total / each.length }\n }\n return out\n}\n\nconst credits = (value: number) => (Number.isInteger(value) ? String(value) : value.toFixed(1))\n\n/** The credits line of the report: each kind of page's count, median, p90 and mean. */\nexport function siteImportCreditsLine(measured: ReturnType<typeof siteImportCreditsMeasured>): string {\n const parts = (['arranged', 'copied'] as const).flatMap((build) => {\n const row = measured[build]\n return row ? [`${row.count} ${build}, median ${credits(row.median)}, p90 ${credits(row.p90)}, mean ${credits(row.mean)}`] : []\n })\n return parts.length ? parts.join('; ') : 'no page in yet'\n}\n"],"names":["DEFAULT_SITE_THEME","readThemeOverride","resolveSiteTheme","SITE_IMPORT_GROUND_DELTA","siteImportFidelityThemeOf","siteImportOklabDelta","aiSiteTheme","named","value","trim","siteImportLookReport","host","state","theme","light","style","pins","siteImportLookPins","base","override","jobId","brand","pass","primary","secondary","tertiary","fonts","map","font","String","filter","Boolean","siteImportLookLine","look","colors","key","join","wearing","whose","siteImportLookPinsLine","isStyle","seed","ground","chroma","hue","siteImportFidelityThemeFor","stored","hexOrNull","test","toLowerCase","colorPin","source","from","to","delta","Math","round","facts","wanted","drawn","button","case","darkGround","dark","buttonFill","fill","buttonText","label","onBrand","buttonCase","one","name","pin","said","toFixed","where","siteImportPageFinish","page","asked","finishOf","wave","find","entry","stamped","own","finish","pageWords","switched","words","median","sorted","middle","floor","length","siteImportCreditsMeasured","items","buildOf","Map","pages","slot","build","out","each","item","get","status","Number","creditsRefunded","creditsSpent","sort","a","b","total","reduce","sum","count","p90","ceil","mean","credits","isInteger","siteImportCreditsLine","measured","parts","flatMap","row"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;CAUC,GAED,SAASA,kBAAkB,QAAQ,sCAAqC;AACxE,SAASC,iBAAiB,EAAEC,gBAAgB,QAAQ,oCAAmC;AAGvF,SAASC,wBAAwB,EAAEC,yBAAyB,EAAEC,oBAAoB,QAAsC,+BAA2B;AACnJ,SAASC,WAAW,QAA0B,oBAAgB;AAwB9D,MAAMC,QAAQ,CAACC,QAAmC,OAAOA,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FAAqF,GACrF,OAAO,SAAS+C,sBAAsBC,QAAsD;IAC1F,MAAMC,QAAQ,AAAC;QAAC;QAAY;KAAS,CAAWC,OAAO,CAAC,CAACxB;QACvD,MAAMyB,MAAMH,QAAQ,CAACtB,MAAM;QAC3B,OAAOyB,MAAM;YAAC,GAAGA,IAAIV,KAAK,CAAC,CAAC,EAAEf,MAAM,SAAS,EAAEmB,QAAQM,IAAIpC,MAAM,EAAE,MAAM,EAAE8B,QAAQM,IAAIT,GAAG,EAAE,OAAO,EAAEG,QAAQM,IAAIP,IAAI,GAAG;SAAC,GAAG,EAAE;IAChI;IACA,OAAOK,MAAM9B,MAAM,GAAG8B,MAAMvF,IAAI,CAAC,QAAQ;AAC3C"}
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/model/ai-site-import-report.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 * What the fidelity report says of a built site beside its scores (AGL-4109),\n * pure so a spec reads it: the look the site wears and what its pages cost.\n *\n * The 11/1 report read `host.theme`, the base an import starts from, and said\n * the site wore the starter's indigo while it rendered the source's blue. The\n * look an import saves is `themeOverride` over that base, with `siteStyle`\n * beside it (`aiSaveSiteTheme`). The credits line printed a mean, while the\n * table a quote is made of (`AI_MEASURED_IMPORT_CREDITS`) is a median and a\n * p90.\n */\n\nimport { DEFAULT_SITE_THEME } from '@aglyn/aglyn/app-utils/default-site'\nimport { readThemeOverride, resolveSiteTheme } from '@aglyn/aglyn/app-utils/site-theme'\nimport type { AiJobItemLedger } from './ai-jobs.types'\nimport type { AiSiteImportFinish, AiSiteImportWords } from './ai-site-import'\nimport { SITE_IMPORT_GROUND_DELTA, siteImportFidelityThemeOf, siteImportOklabDelta, siteImportOutlinedColorOf, type SiteImportFidelityTheme } from './ai-site-import-fidelity'\nimport { aiSiteTheme, type AiSiteStyle } from './ai-site-look'\n\ntype Dict = Record<string, any>\n\n/** The look line's facts, as a site stores them and an import ran them. */\nexport interface SiteImportLookReport {\n /** The base theme the site was given: `siteStyle.base`, or `null` where it holds no style. */\n base: string | null\n /** Whether a look is saved over the base. */\n override: boolean\n /** The job whose look the site wears: `siteStyle.jobId`. */\n jobId: string | null\n /** The source's brand color the look was drawn from: `siteStyle.brand`. */\n brand: string | null\n /** What the import's look pass came to: `look.theme`. */\n pass: string | null\n primary: string | null\n secondary: string | null\n tertiary: string | null\n fonts: string[]\n /** What Keep my site pins of the source's look (AGL-4152), source beside theme; absent where the import read no look of its source. */\n pins?: SiteImportLookPins\n}\n\nconst named = (value: unknown): string | null => (typeof value === 'string' && value.trim() ? value : null)\n\n/** The look a site wears: its base theme with what was saved over it, and which job saved it. */\nexport function siteImportLookReport(host: Dict, state: Dict | null | undefined): SiteImportLookReport {\n const theme = (resolveSiteTheme(host) ?? {}) as Dict\n const light = (theme['colorSchemes']?.['light'] ?? {}) as Dict\n const style = (host['siteStyle'] ?? null) as Dict | null\n const pins = siteImportLookPins(host, state)\n return {\n base: named(style?.['base']),\n override: !!readThemeOverride(host),\n jobId: named(style?.['jobId']),\n brand: named(style?.['brand']),\n pass: named(state?.['look']?.['theme']),\n primary: named(light['primary']?.['main']),\n secondary: named(light['secondary']?.['main']),\n tertiary: named(light['tertiary']?.['main']),\n fonts: ((theme['fonts'] ?? []) as Dict[]).map((font) => String(font['family'] ?? '')).filter(Boolean),\n ...(pins ? { pins } : {}),\n }\n}\n\n/** The look line of the report: what the site wears, and whether it is this job's; and what Keep my site pins, source → theme, where the import read its source's look (AGL-4152). */\nexport function siteImportLookLine(host: Dict, state: Dict | null | undefined, jobId: string): string {\n const look = siteImportLookReport(host, state)\n const colors = (['primary', 'secondary', 'tertiary'] as const).map((key) => `${key} ${look[key] ?? 'not set'}`).join(', ')\n const brand = look.brand ? `, drawn from ${look.brand}` : ''\n const fonts = look.fonts.join(', ') || 'not set'\n const wearing = look.override ? `an override over the ${look.base ?? 'site'} base` : `the ${look.base ?? 'site'} base, no override`\n const whose = look.jobId ? (look.jobId === jobId ? 'saved by this job' : `saved by job ${look.jobId}, not this one`) : 'saved by no job'\n return `${look.pass ?? 'not run'}; ${colors}${brand}; ${fonts}; ${wearing}; ${whose}${look.pins ? `; ${siteImportLookPinsLine(look.pins)}` : ''}`\n}\n\n/*------------------------------------------\n * What Keep my site pins (AGL-4152)\n *-----------------------------------------*/\n\n/** One pin of the look: the source's, the theme's, and how far apart (OKLab ΔE, for a color). */\nexport interface SiteImportLookPin {\n source: string | null\n theme: string | null\n delta: number | null\n}\n\n/** The look's pins, the source's beside the theme's: its grounds, its filled buttons' fill, label and case. */\nexport interface SiteImportLookPins {\n ground: SiteImportLookPin\n darkGround: SiteImportLookPin\n buttonFill: SiteImportLookPin\n buttonText: SiteImportLookPin\n buttonCase: SiteImportLookPin\n /** The soft bands' fill, in the light and the dark scheme; the dark's source `null` where its stylesheets say none. */\n paper: SiteImportLookPin\n darkPaper: SiteImportLookPin\n /** An outlined button's words' color. */\n buttonOutline: SiteImportLookPin\n /** The case its text buttons, and the links drawn as them, are set in. */\n textCase: SiteImportLookPin\n /** Where the theme's side was read: the site's theme as stored, or computed from its site style. */\n from: SiteImportFidelityTheme['from'] | null\n}\n\n/** Whether a stored site style holds what its colors are drawn from. */\nfunction isStyle(value: unknown): value is AiSiteStyle {\n const style = value as Partial<AiSiteStyle> | null\n return !!style && typeof style === 'object' && typeof style.seed === 'number' && typeof style.ground === 'string' && typeof style.chroma === 'string' && typeof style.hue === 'number'\n}\n\n/**\n * The theme a built site's pages are drawn in, for the fidelity (AGL-4152):\n * the theme it stores, its override resolved; else, where it stores none,\n * one computed from its site style (`siteStyle`) over the starter theme, and\n * marked so. `null` for a site with neither.\n */\nexport function siteImportFidelityThemeFor(host: Dict): SiteImportFidelityTheme | null {\n const stored = siteImportFidelityThemeOf(resolveSiteTheme(host), 'theme')\n if (stored) return stored\n const style = host['siteStyle']\n return isStyle(style) ? siteImportFidelityThemeOf(aiSiteTheme(style, DEFAULT_SITE_THEME), 'style') : null\n}\n\nconst hexOrNull = (value: unknown): string | null => (typeof value === 'string' && /^#[0-9a-f]{6}$/i.test(value) ? value.toLowerCase() : null)\n\n/** A color pin: the two colors and how far apart. */\nfunction colorPin(source: unknown, theme: string | null): SiteImportLookPin {\n const from = hexOrNull(source)\n const to = hexOrNull(theme)\n return { source: from, theme: to, delta: from && to ? Math.round(siteImportOklabDelta(from, to) * 1000) / 1000 : null }\n}\n\n/**\n * What Keep my site pins of the source's look (AGL-4152), the source's as\n * the reader read it (`home.look`) beside the theme's: the page ground, the\n * dark ground, a filled button's fill and label, and its case. `null` where\n * the import read no look of its source.\n */\nexport function siteImportLookPins(host: Dict, state: Dict | null | undefined): SiteImportLookPins | null {\n const facts = state?.['home']?.['look'] as Dict | null | undefined\n if (!facts || typeof facts !== 'object') return null\n const theme = siteImportFidelityThemeFor(host)\n const wanted = facts['buttonCase'] === 'upper' || facts['buttonCase'] === 'none' ? (facts['buttonCase'] as string) : null\n const drawn = theme?.button.case ?? null\n return {\n ground: colorPin(facts['background'], theme?.light.ground ?? null),\n darkGround: colorPin(facts['darkBackground'], theme?.dark?.ground ?? null),\n buttonFill: colorPin(facts['buttonFill'], theme ? (theme.button.fill ?? theme.light.brand) : null),\n buttonText: colorPin(facts['buttonText'], theme ? (theme.button.label ?? theme.light.onBrand) : null),\n buttonCase: { source: wanted, theme: drawn, delta: null },\n paper: colorPin(facts['paperBackground'], theme?.light.paper ?? null),\n darkPaper: colorPin(facts['darkPaper'], theme?.dark?.paper ?? null),\n buttonOutline: colorPin(facts['buttonOutline'], theme ? siteImportOutlinedColorOf(theme) : null),\n textCase: { source: facts['textCase'] === 'upper' || facts['textCase'] === 'none' ? (facts['textCase'] as string) : null, theme: theme?.button.text?.case ?? drawn, delta: null },\n from: theme?.from ?? null,\n }\n}\n\n/** The pins as the look line prints them: each source → theme, a color with its ΔE and whether it moved past 0.05. */\nexport function siteImportLookPinsLine(pins: SiteImportLookPins): string {\n const one = (name: string, pin: SiteImportLookPin) => {\n const said = `${name} ${pin.source ?? 'not read'} → ${pin.theme ?? 'not set'}`\n if (pin.delta !== null) return `${said} (ΔE ${pin.delta.toFixed(3)}, ${pin.delta <= SITE_IMPORT_GROUND_DELTA ? 'kept' : 'moved'})`\n return pin.source && pin.theme ? `${said} (${pin.source === pin.theme ? 'kept' : 'moved'})` : said\n }\n const where = pins.from === 'style' ? ', the theme computed from the site style' : pins.from === null ? ', no theme to read' : ''\n return `pins ${[one('ground', pins.ground), one('darkGround', pins.darkGround), one('buttonFill', pins.buttonFill), one('buttonText', pins.buttonText), one('buttonCase', pins.buttonCase), one('paper', pins.paper), one('darkPaper', pins.darkPaper), one('buttonOutline', pins.buttonOutline), one('textCase', pins.textCase)].join(', ')}${where}`\n}\n\n/**\n * How a page of an import was finished (AGL-4152), as the report scores it:\n * what was asked for on the command line, else what its wave was stamped\n * with at its start, else the import's own; an import that names none reads\n * as Keep my site. Its words are improved where the page says so, else where\n * its wave (or the import) improved them under Improve it.\n */\nexport function siteImportPageFinish(\n state: Dict,\n page: Dict,\n asked: { finish?: AiSiteImportFinish | null; words?: AiSiteImportWords | null } = {},\n): { finish: AiSiteImportFinish; words: AiSiteImportWords; from: 'asked' | 'wave' | 'import' | 'default' } {\n const finishOf = (value: unknown): AiSiteImportFinish | null => (value === 'keep' || value === 'improve' ? value : null)\n const wave = ((state['waves'] ?? []) as Dict[]).find((entry) => entry['index'] === page['wave']) ?? null\n const stamped = finishOf(wave?.['finish'])\n const own = finishOf(state['finish'])\n const finish = asked.finish ?? stamped ?? own ?? 'keep'\n const from = asked.finish ? 'asked' : stamped ? 'wave' : own ? 'import' : 'default'\n const pageWords = page['wording'] === 'kept' || page['wording'] === 'improved' ? (page['wording'] as AiSiteImportWords) : null\n const switched = (wave?.['wording'] ?? state['wording']) === true\n const words = asked.words ?? pageWords ?? (finish === 'improve' && switched ? 'improved' : 'kept')\n return { finish, words, from }\n}\n\n/** One kind of page's cost, as `AI_MEASURED_IMPORT_CREDITS` holds it. */\nexport interface SiteImportCreditsMeasured {\n count: number\n median: number\n p90: number\n mean: number\n}\n\n/** The middle value of what is sorted: the two middle ones' mean, for an even count. */\nfunction median(sorted: readonly number[]): number {\n const middle = Math.floor(sorted.length / 2)\n return sorted.length % 2 ? (sorted[middle] as number) : ((sorted[middle - 1] as number) + (sorted[middle] as number)) / 2\n}\n\n/**\n * What each kind of page cost by the ledger, as the table a quote is read\n * from is measured: over the items that came through and gave nothing back,\n * grouped by how their page was built. The p90 is the nearest rank.\n */\nexport function siteImportCreditsMeasured(\n state: { pages: ReadonlyArray<{ slot: string; build?: string | null }> },\n items: ReadonlyArray<Pick<AiJobItemLedger, 'slot' | 'status' | 'creditsSpent' | 'creditsRefunded'>>,\n): Partial<Record<'arranged' | 'copied', SiteImportCreditsMeasured>> {\n const buildOf = new Map(state.pages.map((page) => [page.slot, page.build ?? null]))\n const out: Partial<Record<'arranged' | 'copied', SiteImportCreditsMeasured>> = {}\n for (const build of ['arranged', 'copied'] as const) {\n const each = items\n .filter((item) => buildOf.get(item.slot) === build && item.status === 'succeeded' && !(Number(item.creditsRefunded) > 0))\n .map((item) => Number(item.creditsSpent ?? 0))\n .sort((a, b) => a - b)\n if (!each.length) continue\n const total = each.reduce((sum, value) => sum + value, 0)\n out[build] = { count: each.length, median: median(each), p90: each[Math.ceil(each.length * 0.9) - 1] as number, mean: total / each.length }\n }\n return out\n}\n\nconst credits = (value: number) => (Number.isInteger(value) ? String(value) : value.toFixed(1))\n\n/** The credits line of the report: each kind of page's count, median, p90 and mean. */\nexport function siteImportCreditsLine(measured: ReturnType<typeof siteImportCreditsMeasured>): string {\n const parts = (['arranged', 'copied'] as const).flatMap((build) => {\n const row = measured[build]\n return row ? [`${row.count} ${build}, median ${credits(row.median)}, p90 ${credits(row.p90)}, mean ${credits(row.mean)}`] : []\n })\n return parts.length ? parts.join('; ') : 'no page in yet'\n}\n"],"names":["DEFAULT_SITE_THEME","readThemeOverride","resolveSiteTheme","SITE_IMPORT_GROUND_DELTA","siteImportFidelityThemeOf","siteImportOklabDelta","siteImportOutlinedColorOf","aiSiteTheme","named","value","trim","siteImportLookReport","host","state","theme","light","style","pins","siteImportLookPins","base","override","jobId","brand","pass","primary","secondary","tertiary","fonts","map","font","String","filter","Boolean","siteImportLookLine","look","colors","key","join","wearing","whose","siteImportLookPinsLine","isStyle","seed","ground","chroma","hue","siteImportFidelityThemeFor","stored","hexOrNull","test","toLowerCase","colorPin","source","from","to","delta","Math","round","facts","wanted","drawn","button","case","darkGround","dark","buttonFill","fill","buttonText","label","onBrand","buttonCase","paper","darkPaper","buttonOutline","textCase","text","one","name","pin","said","toFixed","where","siteImportPageFinish","page","asked","finishOf","wave","find","entry","stamped","own","finish","pageWords","switched","words","median","sorted","middle","floor","length","siteImportCreditsMeasured","items","buildOf","Map","pages","slot","build","out","each","item","get","status","Number","creditsRefunded","creditsSpent","sort","a","b","total","reduce","sum","count","p90","ceil","mean","credits","isInteger","siteImportCreditsLine","measured","parts","flatMap","row"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;CAUC,GAED,SAASA,kBAAkB,QAAQ,sCAAqC;AACxE,SAASC,iBAAiB,EAAEC,gBAAgB,QAAQ,oCAAmC;AAGvF,SAASC,wBAAwB,EAAEC,yBAAyB,EAAEC,oBAAoB,EAAEC,yBAAyB,QAAsC,+BAA2B;AAC9K,SAASC,WAAW,QAA0B,oBAAgB;AAwB9D,MAAMC,QAAQ,CAACC,QAAmC,OAAOA,UAAU,YAAYA,MAAMC,IAAI,KAAKD,QAAQ;AAEtG,+FAA+F,GAC/F,OAAO,SAASE,q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AKI,eAAe,IAAI,CAAA,GACrHrF,GAAG,CAAC,CAACiF;gBAAgBA;mBAAPG,QAAOH,qBAAAA,KAAKK,YAAY,YAAjBL,qBAAqB;WAC1CM,IAAI,CAAC,CAACC,GAAGC,IAAMD,IAAIC;QACtB,IAAI,CAACT,KAAKT,MAAM,EAAE;QAClB,MAAMmB,QAAQV,KAAKW,MAAM,CAAC,CAACC,KAAK/G,QAAU+G,MAAM/G,OAAO;QACvDkG,GAAG,CAACD,MAAM,GAAG;YAAEe,OAAOb,KAAKT,MAAM;YAAEJ,QAAQA,OAAOa;YAAOc,KAAKd,IAAI,CAACpD,KAAKmE,IAAI,CAACf,KAAKT,MAAM,GAAG,OAAO,EAAE;YAAYyB,MAAMN,QAAQV,KAAKT,MAAM;QAAC;IAC5I;IACA,OAAOQ;AACT;AAEA,MAAMkB,UAAU,CAACpH,QAAmBuG,OAAOc,SAAS,CAACrH,SAASqB,OAAOrB,SAASA,MAAMuE,OAAO,CAAC;AAE5F,qFAAqF,GACrF,OAAO,SAAS+C,sBAAsBC,QAAsD;IAC1F,MAAMC,QAAQ,AAAC;QAAC;QAAY;KAAS,CAAWC,OAAO,CAAC,CAACxB;QACvD,MAAMyB,MAAMH,QAAQ,CAACtB,MAAM;QAC3B,OAAOyB,MAAM;YAAC,GAAGA,IAAIV,KAAK,CAAC,CAAC,EAAEf,MAAM,SAAS,EAAEmB,QAAQM,IAAIpC,MAAM,EAAE,MAAM,EAAE8B,QAAQM,IAAIT,GAAG,EAAE,OAAO,EAAEG,QAAQM,IAAIP,IAAI,GAAG;SAAC,GAAG,EAAE;IAChI;IACA,OAAOK,MAAM9B,MAAM,GAAG8B,MAAM5F,IAAI,CAAC,QAAQ;AAC3C"}
@@ -119,7 +119,13 @@ export type AiSiteImportLeftOutReason =
119
119
  /** The read stopped (its clock, its bytes, its page count) before it got to it (AGL-4083). */
120
120
  | 'not-reached'
121
121
  /** A link to a file (a download, a PDF with no extension), not a page (AGL-4106). */
122
- | 'file';
122
+ | 'file'
123
+ /** Another address of a page already found: a gallery photo's link, a home page's second address (AGL-4152). */
124
+ | 'duplicate'
125
+ /** The cart, checkout or account screen the site's platform makes, not a page of the owner's (AGL-4152). */
126
+ | 'system-page'
127
+ /** The site itself answers that the address does not exist (404 or 410): a link or sitemap line gone stale (AGL-4152). */
128
+ | 'missing';
123
129
  export declare const AI_SITE_IMPORT_LEFT_OUT_REASONS: readonly AiSiteImportLeftOutReason[];
124
130
  /** The reasons that mean the page was there and AglynBot could not read it: the "could not be read" of what was found. */
125
131
  export declare const AI_SITE_IMPORT_UNREAD_REASONS: readonly AiSiteImportLeftOutReason[];
@@ -128,7 +134,14 @@ export interface AiSiteImportLeftOut {
128
134
  path: string;
129
135
  title: string;
130
136
  reason: AiSiteImportLeftOutReason;
137
+ /** The path of the page a `duplicate` is another address of: where a link to it goes on the new site. */
138
+ sameAs?: string;
131
139
  }
140
+ /** The left-out addresses that are other addresses of a kept page, as their path and that page's. */
141
+ export declare function aiSiteImportOtherAddresses(state: Partial<Pick<AiSiteImportState, 'leftOut'>>): Array<{
142
+ path: string;
143
+ sameAs: string;
144
+ }>;
132
145
  /** A photo brought into the site's media library, as a page places it. */
133
146
  export interface AiSiteImportPhoto {
134
147
  mediaId: string;
@@ -342,9 +355,22 @@ export interface SiteImportLayoutSection {
342
355
  name: string;
343
356
  /** How its edges were found: a landmark (`<section>`), a container of its own, or its headings. */
344
357
  from: 'landmark' | 'container' | 'heading';
358
+ /**
359
+ * Its band against the page's own ground (AGL-4152): a light fill within
360
+ * OKLab ΔE 0.02 of the page's, or none, is `plain`, any other light one
361
+ * `soft`; `brand` and `dark` as its color says.
362
+ */
345
363
  band: SiteImportBand;
364
+ /**
365
+ * Its band by its color's own lightness, near white `plain` and any other
366
+ * light fill `soft`, where that differs from {@link SiteImportLayoutSection.band}:
367
+ * what Improve it and the design answer's text read. Absent, the two agree.
368
+ */
369
+ absoluteBand?: SiteImportBand;
346
370
  /** Its background color as `#rrggbb`, when it has one. */
347
371
  background: string | null;
372
+ /** Its background in the page's dark scheme (AGL-4152), where its stylesheets change it. */
373
+ darkBackground?: string;
348
374
  /** A gradient, a photo, or a film playing on its own behind it (AGL-4140), its poster an image line. */
349
375
  backdrop?: {
350
376
  kind: 'gradient';
@@ -415,10 +441,26 @@ export interface SiteImportLookFacts {
415
441
  link: string | null;
416
442
  /** Its header bar's background. */
417
443
  header: string | null;
418
- /** The fill of its dark bands, the most used first (AGL-4152): the dark ground Keep my site keeps. Absent on a read made before. */
444
+ /**
445
+ * The dark ground Keep my site keeps (AGL-4152): its page's fill in its dark
446
+ * scheme where its stylesheets say one, else the fill of its dark bands, the
447
+ * most used first. Absent on a read made before.
448
+ */
419
449
  darkBackground?: string | null;
450
+ /** The fill of its `soft` bands, the most used first (AGL-4152): what Keep my site's paper is. Absent on a read made before. */
451
+ paperBackground?: string | null;
452
+ /** The fill of its `soft` bands in its dark scheme (AGL-4152), where its stylesheets say one. */
453
+ darkPaper?: string | null;
420
454
  /** Whether its filled buttons are set in capitals (AGL-4152). Absent on a read made before. */
421
455
  buttonCase?: 'upper' | 'none' | null;
456
+ /** Whether its outlined buttons are set in capitals (AGL-4152); `null` for a page with none. */
457
+ outlinedCase?: 'upper' | 'none' | null;
458
+ /** Whether its text buttons and the links a page draws as them are set in capitals (AGL-4152); `null` for a page with none. */
459
+ textCase?: 'upper' | 'none' | null;
460
+ /** The words' color on its outlined buttons (AGL-4152), the most used first. */
461
+ buttonOutline?: string | null;
462
+ /** The fill an outlined button of its own sets (AGL-4152); `null` where they leave the ground showing. */
463
+ outlinedFill?: string | null;
422
464
  /**
423
465
  * The color most of its eyebrows are drawn in, where that is a color of its
424
466
  * own: none of its text's, its buttons' or white (AGL-4138). The look pass
@@ -967,6 +1009,7 @@ export interface AiSiteImportInventoryInput {
967
1009
  skipped: ReadonlyArray<{
968
1010
  url: string;
969
1011
  reason: AiSiteImportLeftOutReason;
1012
+ sameAs?: string;
970
1013
  }>;
971
1014
  /** Skips the crawl only counted. */
972
1015
  skippedOverflow?: number;
@@ -1123,7 +1166,7 @@ export declare function aiSiteImportWordsKept(state: AiSiteImportState, slot: st
1123
1166
  export declare function aiSiteImportWordingPages(state: AiSiteImportState, wave: AiSiteImportWave, choice: AiSiteImportChoice, items?: readonly AiJobItemLedger[] | null): number;
1124
1167
  /**
1125
1168
  * What improving this many pages' wording adds (AGL-4152): a reworded page
1126
- * is quoted as an AI page (`AI_MEASURED_IMPORT_CREDITS.page`) in place of an
1169
+ * is quoted as measured (`AI_MEASURED_IMPORT_CREDITS.reworded`) in place of an
1127
1170
  * arranged one, its design answer and its wording together, so each adds the
1128
1171
  * difference between the two. Its ceiling, the page's two passes, does not
1129
1172
  * move, and no price is new.
@@ -106,7 +106,10 @@ export const AI_SITE_IMPORT_LEFT_OUT_REASONS = [
106
106
  'too-large',
107
107
  'off-site',
108
108
  'not-reached',
109
- 'file'
109
+ 'file',
110
+ 'duplicate',
111
+ 'system-page',
112
+ 'missing'
110
113
  ];
111
114
  /** The reasons that mean the page was there and AglynBot could not read it: the "could not be read" of what was found. */ export const AI_SITE_IMPORT_UNREAD_REASONS = [
112
115
  'unreadable',
@@ -114,6 +117,16 @@ export const AI_SITE_IMPORT_LEFT_OUT_REASONS = [
114
117
  'too-large',
115
118
  'not-reached'
116
119
  ];
120
+ /** The left-out addresses that are other addresses of a kept page, as their path and that page's. */ export function aiSiteImportOtherAddresses(state) {
121
+ var _state_leftOut;
122
+ const key = (path)=>path.split('?')[0].replace(/\/+$/, '') || '/';
123
+ return ((_state_leftOut = state.leftOut) != null ? _state_leftOut : []).flatMap((entry)=>entry.reason === 'duplicate' && entry.sameAs && key(entry.path) !== key(entry.sameAs) ? [
124
+ {
125
+ path: key(entry.path),
126
+ sameAs: key(entry.sameAs)
127
+ }
128
+ ] : []);
129
+ }
117
130
  export const SITE_IMPORT_GROUP_KINDS = [
118
131
  'cards',
119
132
  'steps',
@@ -477,6 +490,7 @@ const wordsOf = (text)=>{
477
490
  var _text_match;
478
491
  return ((_text_match = text.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}-\\u{1D7C2}\\u{1D7C4}-\\u{1D7CB}\\u{1DF00}-\\u{1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F800}-\\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 ? _text_match : []).length;
479
492
  };
493
+ /** How much of a site was turned away counts its pages: never another address of one, or its platform's screen. */ const isOneOfTheSitesPages = (entry)=>entry.reason !== 'duplicate' && entry.reason !== 'system-page';
480
494
  /** One verdict from what became of the home page and how much of the site was turned away. */ function readVerdictOf(home, blocked, total) {
481
495
  var _ref, _ref1;
482
496
  const edge = (home == null ? void 0 : home.edge) === 'vercel' ? 'vercel' : (home == null ? void 0 : home.edge) === 'cloudflare' ? 'cloudflare' : null;
@@ -518,7 +532,7 @@ const wordsOf = (text)=>{
518
532
  */ export function aiSiteImportReadVerdict(crawled) {
519
533
  var _crawled_pages_find, _skip_status, _skip_edge;
520
534
  const blocked = crawled.skipped.filter((entry)=>entry.reason === 'http-error' && entry.status !== undefined && AI_SITE_IMPORT_BLOCKED_STATUSES.has(entry.status)).length;
521
- const total = Math.max(crawled.sitemapUrls, crawled.pages.length + crawled.skipped.length);
535
+ const total = Math.max(crawled.sitemapUrls, crawled.pages.length + crawled.skipped.filter(isOneOfTheSitesPages).length);
522
536
  const page = (_crawled_pages_find = crawled.pages.find((entry)=>entry.foundBy === 'home')) != null ? _crawled_pages_find : crawled.pages.find((entry)=>(entry.path.replace(/\/+$/, '') || '/') === '/');
523
537
  if (page) {
524
538
  const words = page.blocks.reduce((sum, block)=>{
@@ -604,7 +618,7 @@ const NOTHING_SPENT = 'Nothing was brought in and no AI credits were used.';
604
618
  /** The verdict an inventory reads from its own pages and skips, when the step did not hand it the crawl's. */ function inventoryVerdict(input) {
605
619
  var _input_skippedOverflow, _input_pages_find;
606
620
  const blocked = input.skipped.filter((entry)=>entry.reason === 'blocked').length;
607
- const total = input.pages.length + input.skipped.length + Math.max(0, (_input_skippedOverflow = input.skippedOverflow) != null ? _input_skippedOverflow : 0);
621
+ const total = input.pages.length + input.skipped.filter(isOneOfTheSitesPages).length + Math.max(0, (_input_skippedOverflow = input.skippedOverflow) != null ? _input_skippedOverflow : 0);
608
622
  const page = (_input_pages_find = input.pages.find((entry)=>entry.foundBy === 'home')) != null ? _input_pages_find : input.pages.find((entry)=>(entry.path.replace(/\/+$/, '') || '/') === '/');
609
623
  if (page) {
610
624
  const empty = page.words < AI_SITE_IMPORT_MIN_WORDS && page.images === 0;
@@ -772,17 +786,23 @@ const segmentsOf = (path)=>String(path != null ? path : '').split('/').filter(Bo
772
786
  const unreached = input.stoppedBy === 'page-budget' && limit !== null ? 'plan-limit' : 'not-reached';
773
787
  for (const skipped of input.skipped){
774
788
  let path = '/';
789
+ let sameAs = null;
775
790
  try {
776
- path = new URL(skipped.url).pathname;
791
+ const url = new URL(skipped.url);
792
+ // Its query too: forty addresses of one path are told apart by it.
793
+ path = `${url.pathname}${url.search}`;
794
+ if (skipped.sameAs) sameAs = new URL(skipped.sameAs).pathname;
777
795
  } catch (unused) {
778
796
  // A malformed address keeps the root as its path.
779
797
  }
780
- leave({
798
+ leave(_extends({
781
799
  url: skipped.url,
782
800
  path,
783
801
  title: '',
784
802
  reason: skipped.reason === 'not-reached' ? unreached : skipped.reason
785
- });
803
+ }, sameAs ? {
804
+ sameAs
805
+ } : {}));
786
806
  }
787
807
  if (input.skippedOverflow) leftOutCount['unreadable'] = ((_leftOutCount_unreadable = leftOutCount['unreadable']) != null ? _leftOutCount_unreadable : 0) + input.skippedOverflow;
788
808
  // Home first: a site read without its home page plans nothing at all.
@@ -1306,16 +1326,16 @@ const readChars = (read)=>{
1306
1326
  }
1307
1327
  /**
1308
1328
  * What improving this many pages' wording adds (AGL-4152): a reworded page
1309
- * is quoted as an AI page (`AI_MEASURED_IMPORT_CREDITS.page`) in place of an
1329
+ * is quoted as measured (`AI_MEASURED_IMPORT_CREDITS.reworded`) in place of an
1310
1330
  * arranged one, its design answer and its wording together, so each adds the
1311
1331
  * difference between the two. Its ceiling, the page's two passes, does not
1312
1332
  * move, and no price is new.
1313
1333
  */ export function aiSiteImportWordingCredits(pages) {
1314
1334
  const count = whole(pages);
1315
- const { page, arranged } = AI_MEASURED_IMPORT_CREDITS;
1335
+ const { reworded, arranged } = AI_MEASURED_IMPORT_CREDITS;
1316
1336
  return {
1317
- likely: count * (page.median - arranged.median),
1318
- p90: count * (page.p90 - arranged.p90)
1337
+ likely: count * (reworded.median - arranged.median),
1338
+ p90: count * (reworded.p90 - arranged.p90)
1319
1339
  };
1320
1340
  }
1321
1341
  /*------------------------------------------
@@ -1449,7 +1469,10 @@ const whole = (value)=>Math.max(0, Math.floor(Number.isFinite(value) ? value : 0
1449
1469
  'too-large': 'Larger than a page can be to bring in.',
1450
1470
  'off-site': 'It sends visitors to another website.',
1451
1471
  'not-reached': 'Not reached: the read stopped before it got to this page.',
1452
- file: 'A file, not a page.'
1472
+ file: 'A file, not a page.',
1473
+ duplicate: 'A second address for the same page, so it is not brought in twice.',
1474
+ 'system-page': 'A cart, checkout, account, or search screen your website platform makes, not a page of your own.',
1475
+ missing: 'Your site says this page does not exist, though a link or sitemap on your site still points to it.'
1453
1476
  };
1454
1477
  /** "3 pages" / "1 page". */ export function aiSiteImportPagesText(count) {
1455
1478
  return `${count.toLocaleString('en-US')} ${count === 1 ? 'page' : 'pages'}`;