@aglyn/plugins-ai 1.12.0 → 1.13.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 (37) hide show
  1. package/package.json +17 -17
  2. package/src/lib/components/ai-media-create.component.js +1 -1
  3. package/src/lib/components/ai-media-create.component.js.map +1 -1
  4. package/src/lib/components/ai-upsell-dialog.component.js +1 -1
  5. package/src/lib/components/ai-upsell-dialog.component.js.map +1 -1
  6. package/src/lib/jobs/ai-job-import-step.js +11 -1
  7. package/src/lib/jobs/ai-job-import-step.js.map +1 -1
  8. package/src/lib/jobs/ai-site-import-look.d.ts +19 -4
  9. package/src/lib/jobs/ai-site-import-look.js +142 -45
  10. package/src/lib/jobs/ai-site-import-look.js.map +1 -1
  11. package/src/lib/jobs/ai-theme-brand-inputs.d.ts +12 -0
  12. package/src/lib/jobs/ai-theme-brand-inputs.js +1 -1
  13. package/src/lib/jobs/ai-theme-brand-inputs.js.map +1 -1
  14. package/src/lib/model/ai-site-import.d.ts +29 -1
  15. package/src/lib/model/ai-site-import.js.map +1 -1
  16. package/src/lib/model/ai-upsell-copy.js +1 -1
  17. package/src/lib/model/ai-upsell-copy.js.map +1 -1
  18. package/src/lib/site-import/fixtures/site-layout-recordings.d.ts +32 -0
  19. package/src/lib/site-import/fixtures/site-layout-recordings.js +55 -0
  20. package/src/lib/site-import/fixtures/site-layout-recordings.js.map +1 -1
  21. package/src/lib/site-import/site-import-crawl.d.ts +2 -0
  22. package/src/lib/site-import/site-import-crawl.js +27 -17
  23. package/src/lib/site-import/site-import-crawl.js.map +1 -1
  24. package/src/lib/site-import/site-import-css.d.ts +81 -0
  25. package/src/lib/site-import/site-import-css.js +443 -25
  26. package/src/lib/site-import/site-import-css.js.map +1 -1
  27. package/src/lib/site-import/site-import-data-forms.d.ts +32 -0
  28. package/src/lib/site-import/site-import-data-forms.js +531 -0
  29. package/src/lib/site-import/site-import-data-forms.js.map +1 -0
  30. package/src/lib/site-import/site-import-html.d.ts +8 -1
  31. package/src/lib/site-import/site-import-html.js +18 -5
  32. package/src/lib/site-import/site-import-html.js.map +1 -1
  33. package/src/lib/site-import/site-import-layout.d.ts +1 -1
  34. package/src/lib/site-import/site-import-layout.js +283 -36
  35. package/src/lib/site-import/site-import-layout.js.map +1 -1
  36. package/src/lib/site-import/site-import-nav.js +17 -3
  37. package/src/lib/site-import/site-import-nav.js.map +1 -1
@@ -83,7 +83,7 @@
83
83
  // Aglyn AI credit blocks (which switch it on with their credits, AGL-4144)
84
84
  // are for sale.
85
85
  const addon = aiAddonName();
86
- return canManageBilling ? `${feature} is switched off for this workspace. It comes with ${addon} ` + 'credits, which you can add in Billing.' : `${feature} is switched off for this workspace. It comes with ${addon} ` + 'credits. Ask a workspace owner or admin to add them in Billing.';
86
+ return canManageBilling ? `${feature} is switched off for this workspace. It comes with ${addon} ` + 'credits, which you can add in Billing.' : `${feature} is switched off for this workspace. It comes with ${addon} ` + 'credits. Ask a member holding "Manage billing" to add them in Billing.';
87
87
  }
88
88
 
89
89
  //# sourceMappingURL=ai-upsell-copy.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/model/ai-upsell-copy.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\nimport { aiAddonName } from '@aglyn/aglyn/app-utils/plan-entitlements'\nimport type { AiBriefKind } from './ai-brief-copy'\n\n/**\n * What a \"Create with AI\" or \"Ask AI\" entry makes: the brief kinds, an\n * automation, products, a function or variable, an overlay, and an answer\n * about the figures on a page.\n */\nexport type AiUpsellKind =\n | AiBriefKind\n | 'workflow'\n | 'product'\n | 'logic'\n | 'overlay'\n | 'funnel'\n | 'insight'\n\n/** What one entry's dialog says. */\nexport interface AiUpsellCopy {\n title: string\n does: string\n /** The entry's own label, which the button reads and the offer names; \"Create with AI\" when absent. */\n label?: string\n}\n\n/** The label every \"Create with AI\" entry reads. */\nexport const AI_UPSELL_CREATE_LABEL = 'Create with AI'\n\n/** What the dialog says one entry would do here. */\nexport const AI_UPSELL_COPY: Readonly<Record<AiUpsellKind, AiUpsellCopy>> = {\n page: {\n title: 'Create a page with AI',\n does:\n 'Describe the page you need and AI plans it from your brief, using your theme and ' +\n 'what the site already has. You confirm the plan, and the page is built as an ' +\n 'unpublished draft.',\n },\n template: {\n title: 'Create a page template with AI',\n does:\n 'Describe what each page should show and AI plans the template, filling what ' +\n 'changes from page to page from each record. You confirm the plan, and the template ' +\n 'is built as a draft in your library.',\n },\n layout: {\n title: 'Create a layout with AI',\n does:\n 'Describe what the layout should hold and AI plans it, linking your pages and placing ' +\n 'your navigation or menu component when the site has one. You confirm the plan, and ' +\n 'the layout is built as a draft no page uses until you assign it.',\n },\n form: {\n title: 'Create a form with AI',\n does:\n 'Describe what the form is for and AI plans its fields, its marketing consent and ' +\n 'where each submission goes. You confirm the plan, and the form is built as a draft.',\n },\n component: {\n title: 'Create a reusable component with AI',\n does:\n 'Describe what the component should show and AI plans it, making what each page can ' +\n 'change into its properties. You confirm the plan, and the component is built as a ' +\n 'draft.',\n },\n workflow: {\n title: 'Create an automation with AI',\n does:\n 'Describe what should happen, and when, and AI drafts the automation from the ' +\n 'triggers and steps your plan includes. It is saved switched off for you to review.',\n },\n email: {\n title: 'Create an email with AI',\n does:\n 'Describe the email you need and AI plans a design from the email blocks, with three ' +\n 'subject lines and three preheaders to choose between. You confirm the plan, and the ' +\n 'design is built as a draft that is sent to nobody.',\n },\n campaign: {\n title: 'Create a campaign with AI',\n does:\n 'Describe what the campaign is for and AI writes its email design and a draft campaign ' +\n 'that would send it. Nothing is sent or scheduled, and the campaign is aimed at nobody ' +\n 'until you pick its lists.',\n },\n product: {\n title: 'Create products with AI',\n does:\n 'Describe what the store sells and AI proposes up to twelve products. You review them ' +\n 'before any is created, and each is created as a draft at a suggested price that is not on ' +\n 'your storefront until you review it and activate it.',\n },\n logic: {\n title: 'Create a function or variable with AI',\n does:\n 'Describe what it should work out or hold and AI drafts the function or variable. It ' +\n 'opens unsaved in the editor for you to check and save.',\n },\n overlay: {\n title: 'Create an overlay with AI',\n does:\n 'Describe the announcement bar or popup you want and AI writes its copy within the ' +\n 'overlay’s limits. It is saved switched off, for you to check and turn on.',\n },\n funnel: {\n title: 'Create a funnel with AI',\n does:\n 'Describe the journey you want to measure and AI proposes its steps from the site’s ' +\n 'real pages, forms and products. It opens in the funnel editor for you to check and save.',\n },\n insight: {\n title: 'Ask AI about these numbers',\n label: 'Ask a question',\n does:\n 'Ask a question about the figures on this page and AI answers from them, every answer ' +\n 'traced to the figures it is built from. It reads; it changes nothing.',\n },\n}\n\n/** The label an entry's button reads. */\nexport function aiUpsellLabel(kind: AiUpsellKind): string {\n return AI_UPSELL_COPY[kind].label ?? AI_UPSELL_CREATE_LABEL\n}\n\n/**\n * The sentence that says where the feature comes from, and who can add it.\n * `feature` is what the entry is called: \"Create with AI\" unless it is an ask.\n */\nexport function aiUpsellOffer(canManageBilling: boolean, feature = AI_UPSELL_CREATE_LABEL): string {\n // Since AGL-3965 every paid plan's own credits pay for generation, so this\n // door is reached only where it is switched off for the workspace and\n // Aglyn AI credit blocks (which switch it on with their credits, AGL-4144)\n // are for sale.\n const addon = aiAddonName()\n return canManageBilling\n ? `${feature} is switched off for this workspace. It comes with ${addon} ` +\n 'credits, which you can add in Billing.'\n : `${feature} is switched off for this workspace. It comes with ${addon} ` +\n 'credits. Ask a workspace owner or admin to add them in Billing.'\n}\n"],"names":["aiAddonName","AI_UPSELL_CREATE_LABEL","AI_UPSELL_COPY","page","title","does","template","layout","form","component","workflow","email","campaign","product","logic","overlay","funnel","insight","label","aiUpsellLabel","kind","aiUpsellOffer","canManageBilling","feature","addon"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,WAAW,QAAQ,2CAA0C;AAyBtE,kDAAkD,GAClD,OAAO,MAAMC,yBAAyB,iBAAgB;AAEtD,kDAAkD,GAClD,OAAO,MAAMC,iBAA+D;IAC1EC,MAAM;QACJC,OAAO;QACPC,MACE,sFACA,kFACA;IACJ;IACAC,UAAU;QACRF,OAAO;QACPC,MACE,iFACA,wFACA;IACJ;IACAE,QAAQ;QACNH,OAAO;QACPC,MACE,0FACA,wFACA;IACJ;IACAG,MAAM;QACJJ,OAAO;QACPC,MACE,sFACA;IACJ;IACAI,WAAW;QACTL,OAAO;QACPC,MACE,wFACA,uFACA;IACJ;IACAK,UAAU;QACRN,OAAO;QACPC,MACE,kFACA;IACJ;IACAM,OAAO;QACLP,OAAO;QACPC,MACE,yFACA,yFACA;IACJ;IACAO,UAAU;QACRR,OAAO;QACPC,MACE,2FACA,2FACA;IACJ;IACAQ,SAAS;QACPT,OAAO;QACPC,MACE,0FACA,+FACA;IACJ;IACAS,OAAO;QACLV,OAAO;QACPC,MACE,yFACA;IACJ;IACAU,SAAS;QACPX,OAAO;QACPC,MACE,uFACA;IACJ;IACAW,QAAQ;QACNZ,OAAO;QACPC,MACE,wFACA;IACJ;IACAY,SAAS;QACPb,OAAO;QACPc,OAAO;QACPb,MACE,0FACA;IACJ;AACF,EAAC;AAED,uCAAuC,GACvC,OAAO,SAASc,cAAcC,IAAkB;QACvClB;IAAP,QAAOA,6BAAAA,cAAc,CAACkB,KAAK,CAACF,KAAK,YAA1BhB,6BAA8BD;AACvC;AAEA;;;CAGC,GACD,OAAO,SAASoB,cAAcC,gBAAyB,EAAEC,UAAUtB,sBAAsB;IACvF,2EAA2E;IAC3E,sEAAsE;IACtE,2EAA2E;IAC3E,gBAAgB;IAChB,MAAMuB,QAAQxB;IACd,OAAOsB,mBACH,GAAGC,QAAQ,mDAAmD,EAAEC,MAAM,CAAC,CAAC,GACtE,2CACF,GAAGD,QAAQ,mDAAmD,EAAEC,MAAM,CAAC,CAAC,GACtE;AACR"}
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/model/ai-upsell-copy.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\nimport { aiAddonName } from '@aglyn/aglyn/app-utils/plan-entitlements'\nimport type { AiBriefKind } from './ai-brief-copy'\n\n/**\n * What a \"Create with AI\" or \"Ask AI\" entry makes: the brief kinds, an\n * automation, products, a function or variable, an overlay, and an answer\n * about the figures on a page.\n */\nexport type AiUpsellKind =\n | AiBriefKind\n | 'workflow'\n | 'product'\n | 'logic'\n | 'overlay'\n | 'funnel'\n | 'insight'\n\n/** What one entry's dialog says. */\nexport interface AiUpsellCopy {\n title: string\n does: string\n /** The entry's own label, which the button reads and the offer names; \"Create with AI\" when absent. */\n label?: string\n}\n\n/** The label every \"Create with AI\" entry reads. */\nexport const AI_UPSELL_CREATE_LABEL = 'Create with AI'\n\n/** What the dialog says one entry would do here. */\nexport const AI_UPSELL_COPY: Readonly<Record<AiUpsellKind, AiUpsellCopy>> = {\n page: {\n title: 'Create a page with AI',\n does:\n 'Describe the page you need and AI plans it from your brief, using your theme and ' +\n 'what the site already has. You confirm the plan, and the page is built as an ' +\n 'unpublished draft.',\n },\n template: {\n title: 'Create a page template with AI',\n does:\n 'Describe what each page should show and AI plans the template, filling what ' +\n 'changes from page to page from each record. You confirm the plan, and the template ' +\n 'is built as a draft in your library.',\n },\n layout: {\n title: 'Create a layout with AI',\n does:\n 'Describe what the layout should hold and AI plans it, linking your pages and placing ' +\n 'your navigation or menu component when the site has one. You confirm the plan, and ' +\n 'the layout is built as a draft no page uses until you assign it.',\n },\n form: {\n title: 'Create a form with AI',\n does:\n 'Describe what the form is for and AI plans its fields, its marketing consent and ' +\n 'where each submission goes. You confirm the plan, and the form is built as a draft.',\n },\n component: {\n title: 'Create a reusable component with AI',\n does:\n 'Describe what the component should show and AI plans it, making what each page can ' +\n 'change into its properties. You confirm the plan, and the component is built as a ' +\n 'draft.',\n },\n workflow: {\n title: 'Create an automation with AI',\n does:\n 'Describe what should happen, and when, and AI drafts the automation from the ' +\n 'triggers and steps your plan includes. It is saved switched off for you to review.',\n },\n email: {\n title: 'Create an email with AI',\n does:\n 'Describe the email you need and AI plans a design from the email blocks, with three ' +\n 'subject lines and three preheaders to choose between. You confirm the plan, and the ' +\n 'design is built as a draft that is sent to nobody.',\n },\n campaign: {\n title: 'Create a campaign with AI',\n does:\n 'Describe what the campaign is for and AI writes its email design and a draft campaign ' +\n 'that would send it. Nothing is sent or scheduled, and the campaign is aimed at nobody ' +\n 'until you pick its lists.',\n },\n product: {\n title: 'Create products with AI',\n does:\n 'Describe what the store sells and AI proposes up to twelve products. You review them ' +\n 'before any is created, and each is created as a draft at a suggested price that is not on ' +\n 'your storefront until you review it and activate it.',\n },\n logic: {\n title: 'Create a function or variable with AI',\n does:\n 'Describe what it should work out or hold and AI drafts the function or variable. It ' +\n 'opens unsaved in the editor for you to check and save.',\n },\n overlay: {\n title: 'Create an overlay with AI',\n does:\n 'Describe the announcement bar or popup you want and AI writes its copy within the ' +\n 'overlay’s limits. It is saved switched off, for you to check and turn on.',\n },\n funnel: {\n title: 'Create a funnel with AI',\n does:\n 'Describe the journey you want to measure and AI proposes its steps from the site’s ' +\n 'real pages, forms and products. It opens in the funnel editor for you to check and save.',\n },\n insight: {\n title: 'Ask AI about these numbers',\n label: 'Ask a question',\n does:\n 'Ask a question about the figures on this page and AI answers from them, every answer ' +\n 'traced to the figures it is built from. It reads; it changes nothing.',\n },\n}\n\n/** The label an entry's button reads. */\nexport function aiUpsellLabel(kind: AiUpsellKind): string {\n return AI_UPSELL_COPY[kind].label ?? AI_UPSELL_CREATE_LABEL\n}\n\n/**\n * The sentence that says where the feature comes from, and who can add it.\n * `feature` is what the entry is called: \"Create with AI\" unless it is an ask.\n */\nexport function aiUpsellOffer(canManageBilling: boolean, feature = AI_UPSELL_CREATE_LABEL): string {\n // Since AGL-3965 every paid plan's own credits pay for generation, so this\n // door is reached only where it is switched off for the workspace and\n // Aglyn AI credit blocks (which switch it on with their credits, AGL-4144)\n // are for sale.\n const addon = aiAddonName()\n return canManageBilling\n ? `${feature} is switched off for this workspace. It comes with ${addon} ` +\n 'credits, which you can add in Billing.'\n : `${feature} is switched off for this workspace. It comes with ${addon} ` +\n 'credits. Ask a member holding \"Manage billing\" to add them in Billing.'\n}\n"],"names":["aiAddonName","AI_UPSELL_CREATE_LABEL","AI_UPSELL_COPY","page","title","does","template","layout","form","component","workflow","email","campaign","product","logic","overlay","funnel","insight","label","aiUpsellLabel","kind","aiUpsellOffer","canManageBilling","feature","addon"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,WAAW,QAAQ,2CAA0C;AAyBtE,kDAAkD,GAClD,OAAO,MAAMC,yBAAyB,iBAAgB;AAEtD,kDAAkD,GAClD,OAAO,MAAMC,iBAA+D;IAC1EC,MAAM;QACJC,OAAO;QACPC,MACE,sFACA,kFACA;IACJ;IACAC,UAAU;QACRF,OAAO;QACPC,MACE,iFACA,wFACA;IACJ;IACAE,QAAQ;QACNH,OAAO;QACPC,MACE,0FACA,wFACA;IACJ;IACAG,MAAM;QACJJ,OAAO;QACPC,MACE,sFACA;IACJ;IACAI,WAAW;QACTL,OAAO;QACPC,MACE,wFACA,uFACA;IACJ;IACAK,UAAU;QACRN,OAAO;QACPC,MACE,kFACA;IACJ;IACAM,OAAO;QACLP,OAAO;QACPC,MACE,yFACA,yFACA;IACJ;IACAO,UAAU;QACRR,OAAO;QACPC,MACE,2FACA,2FACA;IACJ;IACAQ,SAAS;QACPT,OAAO;QACPC,MACE,0FACA,+FACA;IACJ;IACAS,OAAO;QACLV,OAAO;QACPC,MACE,yFACA;IACJ;IACAU,SAAS;QACPX,OAAO;QACPC,MACE,uFACA;IACJ;IACAW,QAAQ;QACNZ,OAAO;QACPC,MACE,wFACA;IACJ;IACAY,SAAS;QACPb,OAAO;QACPc,OAAO;QACPb,MACE,0FACA;IACJ;AACF,EAAC;AAED,uCAAuC,GACvC,OAAO,SAASc,cAAcC,IAAkB;QACvClB;IAAP,QAAOA,6BAAAA,cAAc,CAACkB,KAAK,CAACF,KAAK,YAA1BhB,6BAA8BD;AACvC;AAEA;;;CAGC,GACD,OAAO,SAASoB,cAAcC,gBAAyB,EAAEC,UAAUtB,sBAAsB;IACvF,2EAA2E;IAC3E,sEAAsE;IACtE,2EAA2E;IAC3E,gBAAgB;IAChB,MAAMuB,QAAQxB;IACd,OAAOsB,mBACH,GAAGC,QAAQ,mDAAmD,EAAEC,MAAM,CAAC,CAAC,GACtE,2CACF,GAAGD,QAAQ,mDAAmD,EAAEC,MAAM,CAAC,CAAC,GACtE;AACR"}
@@ -17,6 +17,7 @@
17
17
  export declare const SITE_LAYOUT_AGLYN_ORIGIN = "https://aglyn.com";
18
18
  export declare const SITE_LAYOUT_POTTERY_ORIGIN = "https://www.tidewater-pottery.example";
19
19
  export declare const SITE_LAYOUT_BAKERY_ORIGIN = "https://www.hearth-bakery.example";
20
+ export declare const SITE_LAYOUT_GARDEN_ORIGIN = "https://www.fern-and-stone.example";
20
21
  /** The recorded pages, by name: the file and the address it was read from. */
21
22
  export declare const SITE_LAYOUT_PAGES: {
22
23
  readonly home: {
@@ -55,8 +56,39 @@ export declare const SITE_LAYOUT_PAGES: {
55
56
  readonly file: "video-bakery.html";
56
57
  readonly url: "https://www.hearth-bakery.example/";
57
58
  };
59
+ readonly gridServices: {
60
+ readonly file: "grid-services.html";
61
+ readonly url: "https://www.fern-and-stone.example/";
62
+ };
63
+ readonly swappedGrid: {
64
+ readonly file: "swapped-grid.html";
65
+ readonly url: "https://www.fern-and-stone.example/plans";
66
+ };
58
67
  };
59
68
  export type SiteLayoutPageName = keyof typeof SITE_LAYOUT_PAGES;
69
+ /**
70
+ * Pages written for the reads of a site's brand and its forms (AGL-4152),
71
+ * about a bookkeeper that does not exist and in the markup of no builder, so
72
+ * the readers are never tuned to one site. They are not scored against a build
73
+ * as the pages above are.
74
+ *
75
+ * `vars-theme` links five stylesheets, saved beside it in `vars-theme/`: four
76
+ * of a site kit's shared widgets, whose loud colors are nobody's brand, then
77
+ * the site's own, the last link, whose colors and fonts are custom properties
78
+ * (comma triples and the modern spaced syntax) and whose buttons are styled
79
+ * through `:is()` and `:where()`. `json-form` has no `<form>`: its fields are
80
+ * JSON a script block holds, beside two arrays that only look like fields.
81
+ */
82
+ export declare const SITE_READ_ORIGIN = "https://www.harbor-lane.example";
83
+ export declare const SITE_READ_VARS_THEME_URL = "https://www.harbor-lane.example/";
84
+ export declare const SITE_READ_JSON_FORM_URL = "https://www.harbor-lane.example/contact";
85
+ /** A written page's markup, by its file in `site-layout/`. */
86
+ export declare const siteReadPage: (file: "vars-theme.html" | "json-form.html") => string;
87
+ /** The `vars-theme` page's stylesheets, by the address its markup links each from, in link order. */
88
+ export declare const siteReadVarsThemeSheets: () => Array<{
89
+ url: string;
90
+ text: string;
91
+ }>;
60
92
  /** One recorded page's markup. */
61
93
  export declare function siteLayoutRecording(name: SiteLayoutPageName): string;
62
94
  /** Whether an address is on the recorded page's own site. */
@@ -32,6 +32,11 @@
32
32
  * `<video>` playing behind its opening, a YouTube frame, a `lite-youtube`
33
33
  * facade, a card's picture linking a Vimeo page, and an `og:video` in its
34
34
  * head.
35
+ * A garden firm that does not exist either, in the markup a visual grid builder
36
+ * writes (AGL-4152), places every block with a rule of its own on a 24-column
37
+ * grid, inside a `min-width` query: `grid-services` shows three cards and a row
38
+ * of pictures, `swapped-grid` a page whose written order is not the order a
39
+ * visitor reads, so each card's words sit after the next card's heading.
35
40
  *
36
41
  * The aglyn.com recordings keep what the `aglyn-com/` ones dropped and the
37
42
  * layout is made of: class names, inline icons and the page's own stylesheet.
@@ -54,6 +59,7 @@ const DIR = join(__dirname, 'site-layout');
54
59
  export const SITE_LAYOUT_AGLYN_ORIGIN = 'https://aglyn.com';
55
60
  export const SITE_LAYOUT_POTTERY_ORIGIN = 'https://www.tidewater-pottery.example';
56
61
  export const SITE_LAYOUT_BAKERY_ORIGIN = 'https://www.hearth-bakery.example';
62
+ export const SITE_LAYOUT_GARDEN_ORIGIN = 'https://www.fern-and-stone.example';
57
63
  /** The recorded pages, by name: the file and the address it was read from. */ export const SITE_LAYOUT_PAGES = {
58
64
  home: {
59
65
  file: 'aglyn-home.html',
@@ -90,8 +96,57 @@ export const SITE_LAYOUT_BAKERY_ORIGIN = 'https://www.hearth-bakery.example';
90
96
  bakery: {
91
97
  file: 'video-bakery.html',
92
98
  url: `${SITE_LAYOUT_BAKERY_ORIGIN}/`
99
+ },
100
+ gridServices: {
101
+ file: 'grid-services.html',
102
+ url: `${SITE_LAYOUT_GARDEN_ORIGIN}/`
103
+ },
104
+ swappedGrid: {
105
+ file: 'swapped-grid.html',
106
+ url: `${SITE_LAYOUT_GARDEN_ORIGIN}/plans`
93
107
  }
94
108
  };
109
+ /**
110
+ * Pages written for the reads of a site's brand and its forms (AGL-4152),
111
+ * about a bookkeeper that does not exist and in the markup of no builder, so
112
+ * the readers are never tuned to one site. They are not scored against a build
113
+ * as the pages above are.
114
+ *
115
+ * `vars-theme` links five stylesheets, saved beside it in `vars-theme/`: four
116
+ * of a site kit's shared widgets, whose loud colors are nobody's brand, then
117
+ * the site's own, the last link, whose colors and fonts are custom properties
118
+ * (comma triples and the modern spaced syntax) and whose buttons are styled
119
+ * through `:is()` and `:where()`. `json-form` has no `<form>`: its fields are
120
+ * JSON a script block holds, beside two arrays that only look like fields.
121
+ */ export const SITE_READ_ORIGIN = 'https://www.harbor-lane.example';
122
+ export const SITE_READ_VARS_THEME_URL = `${SITE_READ_ORIGIN}/`;
123
+ export const SITE_READ_JSON_FORM_URL = `${SITE_READ_ORIGIN}/contact`;
124
+ /** A written page's markup, by its file in `site-layout/`. */ export const siteReadPage = (file)=>readFileSync(join(DIR, file), 'utf8');
125
+ /** The `vars-theme` page's stylesheets, by the address its markup links each from, in link order. */ export const siteReadVarsThemeSheets = ()=>[
126
+ [
127
+ 'https://cdn.sitekit.example/universal/reset.css',
128
+ 'reset.css'
129
+ ],
130
+ [
131
+ 'https://cdn.sitekit.example/components/gallery.css',
132
+ 'gallery.css'
133
+ ],
134
+ [
135
+ 'https://cdn.sitekit.example/components/map.css',
136
+ 'map.css'
137
+ ],
138
+ [
139
+ 'https://cdn.sitekit.example/components/booking.css',
140
+ 'booking.css'
141
+ ],
142
+ [
143
+ 'https://assets.sitekit.example/sites/4182/site.css',
144
+ 'site.css'
145
+ ]
146
+ ].map(([url, file])=>({
147
+ url: url,
148
+ text: readFileSync(join(DIR, 'vars-theme', file), 'utf8')
149
+ }));
95
150
  const cache = new Map();
96
151
  /** One recorded page's markup. */ export function siteLayoutRecording(name) {
97
152
  const { file } = SITE_LAYOUT_PAGES[name];
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../libs/plugins/ai/src/lib/site-import/fixtures/site-layout-recordings.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 * Pages recorded with their layout (AGL-4106), for the specs of the layout,\n * menu and stylesheet readers, and for the compile and fidelity specs that\n * read what they find.\n *\n * `site-layout/` holds four pages of aglyn.com as AglynBot read them on\n * 2026-10-28 and 2026-10-29 (product, pricing, contact, one blog post), its\n * home page as it read on 2026-11-05, which the 11/5 Keep my site import fell\n * short on (AGL-4152), its pricing page again as it read on 2026-11-01, which a live import fell\n * short on (`livePricing`), its blog listing as it read on 2026-11-03, whose\n * cards crop their pictures to a height of their own (`blog`, AGL-4138), and\n * one page in the markup a Squarespace site is built with, written for these\n * specs about a studio that does not exist, so the readers are never tuned to\n * one site's markup.\n * A bakery that does not exist either, in the markup a WordPress block theme\n * writes, shows a film of every kind the reader reads (AGL-4140): a\n * `<video>` playing behind its opening, a YouTube frame, a `lite-youtube`\n * facade, a card's picture linking a Vimeo page, and an `og:video` in its\n * head.\n *\n * The aglyn.com recordings keep what the `aglyn-com/` ones dropped and the\n * layout is made of: class names, inline icons and the page's own stylesheet.\n * Each was trimmed before it entered the repo: script bodies are gone (one\n * small inline script with a hostile line stands in for them; the\n * structured data stays), so are preload links, `data-*` attributes and\n * `srcset`s; the stylesheet keeps only the rules for classes the page uses\n * and the properties the readers read; class names the kept rules do not name\n * are dropped, a grid framework's own hints kept; the pricing page keeps the\n * first 14 rows of its plan table, and the product, pricing, contact and blog\n * pages their header menu without its panels and their footer's © line. The\n * blog listing keeps its first page of posts, a featured one and six cards,\n * without its search box and its newsletter band, inside the blog post's\n * header and footer. The home page keeps its header and footer whole, for\n * the menu reader. Every address, phone number, author and profile is a\n * placeholder.\n */\n\nimport { readFileSync } from 'node:fs'\nimport { join } from 'node:path'\n\nconst DIR = join(__dirname, 'site-layout')\n\nexport const SITE_LAYOUT_AGLYN_ORIGIN = 'https://aglyn.com'\nexport const SITE_LAYOUT_POTTERY_ORIGIN = 'https://www.tidewater-pottery.example'\nexport const SITE_LAYOUT_BAKERY_ORIGIN = 'https://www.hearth-bakery.example'\n\n/** The recorded pages, by name: the file and the address it was read from. */\nexport const SITE_LAYOUT_PAGES = {\n home: { file: 'aglyn-home.html', url: `${SITE_LAYOUT_AGLYN_ORIGIN}/` },\n product: { file: 'aglyn-product.html', url: `${SITE_LAYOUT_AGLYN_ORIGIN}/product` },\n pricing: { file: 'aglyn-pricing.html', url: `${SITE_LAYOUT_AGLYN_ORIGIN}/pricing` },\n livePricing: { file: 'aglyn-pricing-2026-11.html', url: `${SITE_LAYOUT_AGLYN_ORIGIN}/pricing` },\n contact: { file: 'aglyn-contact.html', url: `${SITE_LAYOUT_AGLYN_ORIGIN}/contact` },\n post: { file: 'aglyn-blog-post.html', url: `${SITE_LAYOUT_AGLYN_ORIGIN}/blog/multi-site-cost-sheet-2026` },\n blog: { file: 'aglyn-blog.html', url: `${SITE_LAYOUT_AGLYN_ORIGIN}/blog` },\n pottery: { file: 'squarespace-pottery.html', url: `${SITE_LAYOUT_POTTERY_ORIGIN}/` },\n bakery: { file: 'video-bakery.html', url: `${SITE_LAYOUT_BAKERY_ORIGIN}/` },\n} as const\n\nexport type SiteLayoutPageName = keyof typeof SITE_LAYOUT_PAGES\n\nconst cache = new Map<string, string>()\n\n/** One recorded page's markup. */\nexport function siteLayoutRecording(name: SiteLayoutPageName): string {\n const { file } = SITE_LAYOUT_PAGES[name]\n const held = cache.get(file)\n if (held !== undefined) return held\n const text = readFileSync(join(DIR, file), 'utf8')\n cache.set(file, text)\n return text\n}\n\n/** Whether an address is on the recorded page's own site. */\nexport function siteLayoutSameSite(name: SiteLayoutPageName): (url: URL) => boolean {\n const origin = new URL(SITE_LAYOUT_PAGES[name].url).origin\n const bare = origin.replace('://www.', '://')\n const www = origin.replace('://', '://www.').replace('://www.www.', '://www.')\n return (url) => url.origin === origin || url.origin === bare || url.origin === www\n}\n"],"names":["readFileSync","join","DIR","__dirname","SITE_LAYOUT_AGLYN_ORIGIN","SITE_LAYOUT_POTTERY_ORIGIN","SITE_LAYOUT_BAKERY_ORIGIN","SITE_LAYOUT_PAGES","home","file","url","product","pricing","livePricing","contact","post","blog","pottery","bakery","cache","Map","siteLayoutRecording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AMC,OAAOJ,MAAMK,GAAG,CAACf;IACvB,IAAIc,SAASE,WAAW,OAAOF;IAC/B,MAAMG,OAAO1B,aAAaC,KAAKC,KAAKO,OAAO;IAC3CU,MAAMQ,GAAG,CAAClB,MAAMiB;IAChB,OAAOA;AACT;AAEA,2DAA2D,GAC3D,OAAO,SAASE,mBAAmBN,IAAwB;IACzD,MAAMO,SAAS,IAAIC,IAAIvB,iBAAiB,CAACe,KAAK,CAACZ,GAAG,EAAEmB,MAAM;IAC1D,MAAME,OAAOF,OAAOG,OAAO,CAAC,WAAW;IACvC,MAAMC,MAAMJ,OAAOG,OAAO,CAAC,OAAO,WAAWA,OAAO,CAAC,eAAe;IACpE,OAAO,CAACtB,MAAQA,IAAImB,MAAM,KAAKA,UAAUnB,IAAImB,MAAM,KAAKE,QAAQrB,IAAImB,MAAM,KAAKI;AACjF"}
1
+ {"version":3,"sources":["../../../../../../../../libs/plugins/ai/src/lib/site-import/fixtures/site-layout-recordings.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 * Pages recorded with their layout (AGL-4106), for the specs of the layout,\n * menu and stylesheet readers, and for the compile and fidelity specs that\n * read what they find.\n *\n * `site-layout/` holds four pages of aglyn.com as AglynBot read them on\n * 2026-10-28 and 2026-10-29 (product, pricing, contact, one blog post), its\n * home page as it read on 2026-11-05, which the 11/5 Keep my site import fell\n * short on (AGL-4152), its pricing page again as it read on 2026-11-01, which a live import fell\n * short on (`livePricing`), its blog listing as it read on 2026-11-03, whose\n * cards crop their pictures to a height of their own (`blog`, AGL-4138), and\n * one page in the markup a Squarespace site is built with, written for these\n * specs about a studio that does not exist, so the readers are never tuned to\n * one site's markup.\n * A bakery that does not exist either, in the markup a WordPress block theme\n * writes, shows a film of every kind the reader reads (AGL-4140): a\n * `<video>` playing behind its opening, a YouTube frame, a `lite-youtube`\n * facade, a card's picture linking a Vimeo page, and an `og:video` in its\n * head.\n * A garden firm that does not exist either, in the markup a visual grid builder\n * writes (AGL-4152), places every block with a rule of its own on a 24-column\n * grid, inside a `min-width` query: `grid-services` shows three cards and a row\n * of pictures, `swapped-grid` a page whose written order is not the order a\n * visitor reads, so each card's words sit after the next card's heading.\n *\n * The aglyn.com recordings keep what the `aglyn-com/` ones dropped and the\n * layout is made of: class names, inline icons and the page's own stylesheet.\n * Each was trimmed before it entered the repo: script bodies are gone (one\n * small inline script with a hostile line stands in for them; the\n * structured data stays), so are preload links, `data-*` attributes and\n * `srcset`s; the stylesheet keeps only the rules for classes the page uses\n * and the properties the readers read; class names the kept rules do not name\n * are dropped, a grid framework's own hints kept; the pricing page keeps the\n * first 14 rows of its plan table, and the product, pricing, contact and blog\n * pages their header menu without its panels and their footer's © line. The\n * blog listing keeps its first page of posts, a featured one and six cards,\n * without its search box and its newsletter band, inside the blog post's\n * header and footer. The home page keeps its header and footer whole, for\n * the menu reader. Every address, phone number, author and profile is a\n * placeholder.\n */\n\nimport { readFileSync } from 'node:fs'\nimport { join } from 'node:path'\n\nconst DIR = join(__dirname, 'site-layout')\n\nexport const SITE_LAYOUT_AGLYN_ORIGIN = 'https://aglyn.com'\nexport const SITE_LAYOUT_POTTERY_ORIGIN = 'https://www.tidewater-pottery.example'\nexport const SITE_LAYOUT_BAKERY_ORIGIN = 'https://www.hearth-bakery.example'\nexport const SITE_LAYOUT_GARDEN_ORIGIN = 'https://www.fern-and-stone.example'\n\n/** The recorded pages, by name: the file and the address it was read from. */\nexport const SITE_LAYOUT_PAGES = {\n home: { file: 'aglyn-home.html', url: `${SITE_LAYOUT_AGLYN_ORIGIN}/` },\n product: { file: 'aglyn-product.html', url: `${SITE_LAYOUT_AGLYN_ORIGIN}/product` },\n pricing: { file: 'aglyn-pricing.html', url: `${SITE_LAYOUT_AGLYN_ORIGIN}/pricing` },\n livePricing: { file: 'aglyn-pricing-2026-11.html', url: `${SITE_LAYOUT_AGLYN_ORIGIN}/pricing` },\n contact: { file: 'aglyn-contact.html', url: `${SITE_LAYOUT_AGLYN_ORIGIN}/contact` },\n post: { file: 'aglyn-blog-post.html', url: `${SITE_LAYOUT_AGLYN_ORIGIN}/blog/multi-site-cost-sheet-2026` },\n blog: { file: 'aglyn-blog.html', url: `${SITE_LAYOUT_AGLYN_ORIGIN}/blog` },\n pottery: { file: 'squarespace-pottery.html', url: `${SITE_LAYOUT_POTTERY_ORIGIN}/` },\n bakery: { file: 'video-bakery.html', url: `${SITE_LAYOUT_BAKERY_ORIGIN}/` },\n gridServices: { file: 'grid-services.html', url: `${SITE_LAYOUT_GARDEN_ORIGIN}/` },\n swappedGrid: { file: 'swapped-grid.html', url: `${SITE_LAYOUT_GARDEN_ORIGIN}/plans` },\n} as const\n\nexport type SiteLayoutPageName = keyof typeof SITE_LAYOUT_PAGES\n\n/**\n * Pages written for the reads of a site's brand and its forms (AGL-4152),\n * about a bookkeeper that does not exist and in the markup of no builder, so\n * the readers are never tuned to one site. They are not scored against a build\n * as the pages above are.\n *\n * `vars-theme` links five stylesheets, saved beside it in `vars-theme/`: four\n * of a site kit's shared widgets, whose loud colors are nobody's brand, then\n * the site's own, the last link, whose colors and fonts are custom properties\n * (comma triples and the modern spaced syntax) and whose buttons are styled\n * through `:is()` and `:where()`. `json-form` has no `<form>`: its fields are\n * JSON a script block holds, beside two arrays that only look like fields.\n */\nexport const SITE_READ_ORIGIN = 'https://www.harbor-lane.example'\n\nexport const SITE_READ_VARS_THEME_URL = `${SITE_READ_ORIGIN}/`\nexport const SITE_READ_JSON_FORM_URL = `${SITE_READ_ORIGIN}/contact`\n\n/** A written page's markup, by its file in `site-layout/`. */\nexport const siteReadPage = (file: 'vars-theme.html' | 'json-form.html'): string => readFileSync(join(DIR, file), 'utf8')\n\n/** The `vars-theme` page's stylesheets, by the address its markup links each from, in link order. */\nexport const siteReadVarsThemeSheets = (): Array<{ url: string; text: string }> =>\n [\n ['https://cdn.sitekit.example/universal/reset.css', 'reset.css'],\n ['https://cdn.sitekit.example/components/gallery.css', 'gallery.css'],\n ['https://cdn.sitekit.example/components/map.css', 'map.css'],\n ['https://cdn.sitekit.example/components/booking.css', 'booking.css'],\n ['https://assets.sitekit.example/sites/4182/site.css', 'site.css'],\n ].map(([url, file]) => ({ url: url as string, text: readFileSync(join(DIR, 'vars-theme', file as string), 'utf8') }))\n\nconst cache = new Map<string, string>()\n\n/** One recorded page's markup. */\nexport function siteLayoutRecording(name: SiteLayoutPageName): string {\n const { file } = SITE_LAYOUT_PAGES[name]\n const held = cache.get(file)\n if (held !== undefined) return held\n const text = readFileSync(join(DIR, file), 'utf8')\n cache.set(file, text)\n return text\n}\n\n/** Whether an address is on the recorded page's own site. */\nexport function siteLayoutSameSite(name: SiteLayoutPageName): (url: URL) => boolean {\n const origin = new URL(SITE_LAYOUT_PAGES[name].url).origin\n const bare = origin.replace('://www.', '://')\n const www = origin.replace('://', '://www.').replace('://www.www.', '://www.')\n return (url) => url.origin === origin || url.origin === bare || url.origin === www\n}\n"],"names":["readFileSync","join","DIR","__dirname","SITE_LAYOUT_AGLYN_ORIGIN","SITE_LAYOUT_POTTERY_ORIGIN","SITE_LAYOUT_BAKERY_ORIGIN","SITE_LAYOUT_GARDEN_ORIGIN","SITE_LAYOUT_PAGES","home","file","url","product","pricing","livePricing","contact","post","blog","pottery","bakery","gridServices","swappedGrid","SITE_READ_ORIGIN","SITE_READ_VARS_THEME_URL","SITE_READ_JSON_FORM_URL","siteReadPage","siteReadVarsThemeSheets","map","text","cache","Map","siteLayoutRecording","name","held","get","undefined","set","siteLayoutSameSite","origin","URL","bare","replace","www"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,G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,IAAI2B,MAAM,KAAKI;AACjF"}
@@ -43,6 +43,8 @@ export declare const SITE_IMPORT_DEFAULTS: {
43
43
  readonly requestTimeoutMs: 8000;
44
44
  readonly robotsMaxBytes: number;
45
45
  readonly sitemapMaxBytes: number;
46
+ /** All the distinct stylesheets one crawl holds at once (AGL-4152): a site's pages share theirs, and one that does not stops here. */
47
+ readonly stylesheetsMaxBytes: number;
46
48
  /** Sitemap documents read, an index's children included: an index of six children is seven. */
47
49
  readonly maxSitemaps: 24;
48
50
  /** URLs a sitemap may contribute to the queue. */
@@ -67,10 +67,11 @@ var _process_env_SITE_IMPORT_BOT_INFO_URL;
67
67
  * and a wave's read is exactly the pages it asks for.
68
68
  *=========================================*/ import { lookalikeBrandForHost } from "@aglyn/shared-util-email/outbound-phishing-screen";
69
69
  import { fenceUntrustedText } from "@aglyn/shared-util-tools/untrusted-text";
70
- import { AI_THEME_REFERENCE_STYLESHEETS, AI_THEME_STYLESHEET_MAX_BYTES, fetchPublicTextDetailed } from "../jobs/ai-theme-brand-inputs.js";
70
+ import { fetchPublicTextDetailed } from "../jobs/ai-theme-brand-inputs.js";
71
71
  import { extractSiteImportPage, readMetaValues } from "./site-import-html.js";
72
72
  import { AGLYN_BOT_TOKEN, parseRobotsTxt, parseSitemap, robotsAllows, robotsRulesFor } from "./site-import-robots.js";
73
73
  import { NO_SITE_IMPORT_HEADERS, siteImportEdgeHeadersFor } from "./site-import-edge.js";
74
+ import { siteImportReadStylesheets } from "./site-import-css.js";
74
75
  import { siteImportLayout, siteImportLookOf } from "./site-import-layout.js";
75
76
  import { siteImportAddressOf, siteImportCanonicalBelieved, siteImportCanonicalClaim, siteImportContentSignature, siteImportIsSystemScreen } from "./site-import-same-page.js";
76
77
  import { siteImportFooterColumns, siteImportNavTree } from "./site-import-nav.js";
@@ -96,6 +97,7 @@ export const SITE_IMPORT_DEFAULTS = {
96
97
  /** One request's own clock, inside the whole crawl's. */ requestTimeoutMs: 8000,
97
98
  robotsMaxBytes: 256 * 1024,
98
99
  sitemapMaxBytes: 4 * 1024 * 1024,
100
+ /** All the distinct stylesheets one crawl holds at once (AGL-4152): a site's pages share theirs, and one that does not stops here. */ stylesheetsMaxBytes: 32 * 1024 * 1024,
99
101
  /** Sitemap documents read, an index's children included: an index of six children is seven. */ maxSitemaps: 24,
100
102
  /** URLs a sitemap may contribute to the queue. */ maxSitemapUrls: 2000,
101
103
  /** Reasons kept in `skipped` before the list stops growing: every address a sitemap may name. */ maxSkipped: 2000,
@@ -220,17 +222,18 @@ function skipReasonFor(result) {
220
222
  const sameSite = (url)=>origins.includes(url.origin) && url.protocol === 'https:';
221
223
  const remainingBytes = ()=>maxTotalBytes - inventory.bytesRead;
222
224
  const outOfTime = ()=>controller.signal.aborted || now() >= deadlineAt;
223
- const request = (url, accept, acceptHeader, maxBytes)=>fetchText(url, {
225
+ /** A stylesheet's read (`sheet`) may be cut at its cap and may go where its CDN sends it: every hop is checked as public all the same. */ const request = (url, accept, acceptHeader, maxBytes, sheet = false)=>fetchText(url, _extends({
224
226
  maxBytes,
225
227
  accept,
226
228
  acceptHeader,
227
229
  userAgent: AGLYN_BOT_USER_AGENT,
228
230
  headersFor,
229
231
  signal: controller.signal,
230
- timeoutMs: Math.max(1, Math.min(SITE_IMPORT_DEFAULTS.requestTimeoutMs, deadlineAt - now())),
232
+ timeoutMs: Math.max(1, Math.min(SITE_IMPORT_DEFAULTS.requestTimeoutMs, deadlineAt - now()))
233
+ }, sheet ? {} : {
231
234
  redirectAllowed: (_from, to)=>sameSite(to),
232
235
  refuseOver: true
233
- });
236
+ }));
234
237
  /** Addresses taken in, read or not: one a page is waiting on that is here and is no page will never be. */ const takenIn = new Set();
235
238
  const skip = (entry)=>{
236
239
  takenIn.add(siteImportAddressOf(entry.url));
@@ -413,18 +416,24 @@ function skipReasonFor(result) {
413
416
  }
414
417
  };
415
418
  const readLayout = (_options_layout = options.layout) != null ? _options_layout : !!only;
416
- /** Linked stylesheets, each asked once a crawl. */ const sheets = new Map();
417
- const stylesheet = (url)=>{
419
+ /** Linked stylesheets, as far as any page has read each: a sheet a page shares is asked no further than it was. */ const sheets = new Map();
420
+ let sheetBytes = 0;
421
+ const stylesheet = async (url, maxBytes)=>{
422
+ var _ref, _ref1, _ref2, _ref3, _ref4;
423
+ var _held_answer, _held_answer1;
418
424
  const held = sheets.get(url);
419
- if (held) return held;
420
- const room = Math.min(AI_THEME_STYLESHEET_MAX_BYTES, remainingBytes() - reserved);
421
- const asked = room <= 0 || outOfTime() ? Promise.resolve(null) : request(url, /text\/css|text\/plain/i, 'text/css,*/*;q=0.1', room).then((answer)=>{
422
- if (!answer.ok) return null;
423
- inventory.bytesRead += answer.bytes;
424
- return answer.text;
425
- }, ()=>null);
426
- sheets.set(url, asked);
427
- return asked;
425
+ if (held && (held.asked >= maxBytes || held.answer && !held.answer.truncated)) return held.answer;
426
+ const room = Math.min(maxBytes, SITE_IMPORT_DEFAULTS.stylesheetsMaxBytes - sheetBytes + ((_ref = held == null ? void 0 : (_held_answer = held.answer) == null ? void 0 : _held_answer.bytes) != null ? _ref : 0), remainingBytes() - reserved);
427
+ if (room <= 0 || outOfTime()) return (_ref1 = held == null ? void 0 : held.answer) != null ? _ref1 : null;
428
+ const read = await request(url, /text\/css|text\/plain/i, 'text/css,*/*;q=0.1', room, true).catch(()=>null);
429
+ if (read == null ? void 0 : read.ok) inventory.bytesRead += read.bytes;
430
+ const answer = (read == null ? void 0 : read.ok) ? read : (_ref2 = held == null ? void 0 : held.answer) != null ? _ref2 : null;
431
+ sheetBytes += ((_ref3 = answer == null ? void 0 : answer.bytes) != null ? _ref3 : 0) - ((_ref4 = held == null ? void 0 : (_held_answer1 = held.answer) == null ? void 0 : _held_answer1.bytes) != null ? _ref4 : 0);
432
+ sheets.set(url, {
433
+ asked: room,
434
+ answer
435
+ });
436
+ return answer;
428
437
  };
429
438
  /** Takes one asked page in: the inventory's next page, a skip, or the reason the read must stop. */ const takeIn = async ({ next, key, cap, page })=>{
430
439
  var _siteImportPageKey;
@@ -515,8 +524,9 @@ function skipReasonFor(result) {
515
524
  // How the page is built (AGL-4106), through its own stylesheets.
516
525
  let built = {};
517
526
  if (extract.structure) {
518
- const linked = await Promise.all(extract.structure.stylesheets.filter((url)=>!/fonts\.googleapis\.com/i.test(url)).slice(0, AI_THEME_REFERENCE_STYLESHEETS).map(stylesheet));
519
- const css = linked.filter((text)=>typeof text === 'string');
527
+ const css = await siteImportReadStylesheets(extract.structure.stylesheets.filter((url)=>!/fonts\.googleapis\.com/i.test(url)), stylesheet, {
528
+ outOfTime
529
+ });
520
530
  const source = _extends({
521
531
  blocks: extract.blocks,
522
532
  organization: extract.organization,