@aglyn/plugins-ai 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +17 -17
- package/src/lib/components/ai-site-start-card.component.d.ts +1 -1
- package/src/lib/components/ai-site-start-card.component.js +40 -13
- package/src/lib/components/ai-site-start-card.component.js.map +1 -1
- package/src/lib/components/ai-site-start-steps.component.d.ts +17 -1
- package/src/lib/components/ai-site-start-steps.component.js +30 -7
- package/src/lib/components/ai-site-start-steps.component.js.map +1 -1
- package/src/lib/components/assist-panel.component.js +8 -12
- package/src/lib/components/assist-panel.component.js.map +1 -1
- package/src/lib/jobs/ai-job-drafts.d.ts +3 -0
- package/src/lib/jobs/ai-job-drafts.js +5 -0
- package/src/lib/jobs/ai-job-drafts.js.map +1 -1
- package/src/lib/jobs/ai-job-layout-language.d.ts +10 -0
- package/src/lib/jobs/ai-job-layout-language.js +38 -2
- package/src/lib/jobs/ai-job-layout-language.js.map +1 -1
- package/src/lib/jobs/ai-job-layout-step.js +3 -3
- package/src/lib/jobs/ai-job-layout-step.js.map +1 -1
- package/src/lib/jobs/ai-site-import-compile.js +15 -7
- package/src/lib/jobs/ai-site-import-compile.js.map +1 -1
- package/src/lib/layout-language/ai-layout-compiler.js +39 -1
- package/src/lib/layout-language/ai-layout-compiler.js.map +1 -1
- package/src/lib/layout-language/ai-layout-frame.d.ts +6 -0
- package/src/lib/layout-language/ai-layout-frame.js +85 -30
- package/src/lib/layout-language/ai-layout-frame.js.map +1 -1
- package/src/lib/layout-language/ai-layout-language.d.ts +5 -0
- package/src/lib/layout-language/ai-layout-language.js.map +1 -1
- package/src/lib/model/ai-site-import-fidelity.d.ts +175 -0
- package/src/lib/model/ai-site-import-fidelity.js +941 -0
- package/src/lib/model/ai-site-import-fidelity.js.map +1 -0
- package/src/lib/model/ai-site-start.d.ts +27 -0
- package/src/lib/model/ai-site-start.js +41 -0
- package/src/lib/model/ai-site-start.js.map +1 -1
- package/src/lib/model/assist-page-change.d.ts +26 -6
- package/src/lib/model/assist-page-change.js +32 -10
- package/src/lib/model/assist-page-change.js.map +1 -1
- package/src/lib/runtime/ai-node-tree.js +18 -2
- package/src/lib/runtime/ai-node-tree.js.map +1 -1
- package/src/lib/server/assist-chat.d.ts +5 -0
- package/src/lib/server/assist-chat.js +11 -2
- package/src/lib/server/assist-chat.js.map +1 -1
- package/src/lib/server/assist-page-change.d.ts +12 -0
- package/src/lib/server/assist-page-change.js +23 -1
- package/src/lib/server/assist-page-change.js.map +1 -1
- package/src/lib/site-import/fixtures/site-import-fidelity-replay.d.ts +62 -0
- package/src/lib/site-import/fixtures/site-import-fidelity-replay.js +374 -0
- package/src/lib/site-import/fixtures/site-import-fidelity-replay.js.map +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/layout-language/ai-layout-compiler.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 { REUSABLE_INSTANCE_COMPONENT_ID } from '@aglyn/aglyn/app-utils/reusable-component-keys'\nimport { CANVAS_ROOT_ELEMENT_ID } from '@aglyn/aglyn/foundation/constants/canvas'\nimport {\n AI_ICON_COMPONENT_ID,\n aiIconOfWord,\n AI_ICON_LIBRARY,\n type AiIconLibraryEntry,\n} from '../runtime/ai-icon-library'\nimport { AI_INSTANCE_REF_PROP } from '../runtime/ai-node-tree'\nimport { AI_TEXT_LIMITS } from '../runtime/ai-palette'\nimport { aiPageScrollInteraction } from '../runtime/ai-page-links'\nimport {\n aiLayoutFitText,\n aiLayoutQuoteGap,\n aiLayoutWords,\n type AiLayoutTextPlace,\n} from './ai-layout-copy'\nimport {\n AI_LAYOUT_GROUP_KINDS,\n AI_LAYOUT_MAX_ITEMS,\n type AiLayoutBand,\n type AiLayoutBlock,\n type AiLayoutGroupStyle,\n type AiLayoutItem,\n type AiLayoutLink,\n type AiLayoutPicture,\n type AiLayoutSection,\n type AiLayoutSettlement,\n} from './ai-layout-language'\nimport {\n AI_LAYOUT_HALF_HEROES,\n aiLayoutDesignChoices,\n aiLayoutFamily,\n aiLayoutGroupVariant,\n type AiLayoutDesign,\n type AiLayoutDesignChoices,\n type AiLayoutGroupVariant,\n type AiLayoutHeroVariant,\n} from './ai-layout-design'\nimport {\n AI_LAYOUT_FEATURED_RECORDS,\n AI_LAYOUT_LISTING_ELEMENTS,\n aiLayoutIsRecordImageAlt,\n aiLayoutListingAt,\n aiLayoutRecordHref,\n aiLayoutRecordImageAltField,\n aiLayoutRepeatFilterOf,\n type AiLayoutListing,\n type AiLayoutListingFilter,\n type AiLayoutListingRole,\n} from './ai-layout-listings'\nimport { aiStorefrontItemIcons } from './ai-layout-storefront'\nimport { aiLayoutContactLabel, aiLayoutWithContactLines } from './ai-layout-contact'\nimport { AI_LAYOUT_LABELS_EN, aiLayoutLabel } from './ai-layout-labels'\nimport {\n aiLayoutRenamedLabel,\n aiLayoutResolveLink,\n type AiLayoutDestination,\n type AiLayoutLinkScope,\n type AiLayoutTargets,\n} from './ai-layout-links'\nimport {\n aiLayoutSpans,\n AI_LAYOUT_FRAMES,\n AiLayoutTreeBuilder,\n type AiLayoutRawTree,\n} from './ai-layout-tree'\n\n/**\n * The layout language compiler (AGL-3660): a page designed in the language\n * (`ai-layout-language.ts`) becomes the element tree the page stores — built\n * from the palette's elements and the theme's tokens only, so the doctrine's\n * building rules hold by construction rather than by a re-ask.\n *\n * What the compiler decides, so no model has to:\n *\n * - STRUCTURE. A section is a semantic `section` band around a Container at\n * a stock width, its content a Stack on the spacing scale; a row of\n * columns is a Grid container whose items are sized `xs:12 md:N` from the\n * relative widths, full width on a phone; a group of cards is a Grid of\n * sized items, or a Stack where it would be one column.\n * - THE OUTLINE. The first section's first heading is the page's one h1 (the\n * plan's title stands in where it gave none); every other section opens at\n * h2; a card's title is one level under its section's heading.\n * - TOKENS. Colors are palette roles, never values: a `brand` band is\n * `primary.main` with its contrast text, a `dark` band pins the site's dark\n * scheme, a `soft` band is the paper surface. So a band reads in the\n * visitor's light or dark mode alike.\n * - LINKS. A button goes to a real page id, a section of this page through\n * the platform's Scroll to element interaction, or an address the brief\n * gave (`ai-layout-links.ts`); one with nowhere to go is left out.\n * - THE PLAN. A form or a component the plan places in a section is placed\n * there, by its id, whether or not the answer remembered it.\n * - RULE 1. Where the workspace keeps reusable components, a section's\n * repeated items are instances of the component its plan places; with\n * none to place they are drawn in their compact form, a title over its\n * text, which is smaller than a block worth a component. A workspace that\n * keeps none (Free) draws its repeats in full.\n * - RULES 8, 9, 14, 16. Seven items a group at most; every picture carries\n * its description as alt text; copy fitted to its place at a clean\n * boundary, with any phone number or email the brief did not give written\n * as a gap; no wrapper around a lone wrapper, no empty element, and no\n * multi-key inline style repeated across a page.\n */\n\nexport interface AiLayoutPagePlan {\n /** The page's title in its plan: the h1 where the first section names none. */\n title: string\n sections: ReadonlyArray<{\n name: string\n uses: readonly string[]\n items: number\n }>\n}\n\nexport interface AiLayoutCompileOptions {\n /**\n * Whether the workspace keeps reusable components (AGL-3030). Where it does,\n * rule 1 holds: repeated items are instances of a component the plan\n * places, or drawn in their compact form.\n */\n reusableComponents: boolean\n /**\n * The ids the page stores its sections under, in plan order\n * (`aiPageSectionNodeId`): each section root is written under its own, and\n * a link to a section scrolls to it. Absent, `section-<n>`.\n */\n sectionIds?: readonly string[]\n /**\n * The site the page belongs to — its kind, its seed and whether this is its\n * home — which the designer layer draws the page's sections for\n * (`ai-layout-design.ts`): a photo hero, pictures beside words, work as an\n * uneven grid of pictures. Absent, the compiler's first design.\n */\n design?: AiLayoutDesign\n /**\n * The site's language (AGL-3760), a code such as `es`: the words the\n * compiler writes itself — \"See all\", a post's link — are in it where it is\n * one `ai-layout-labels.ts` lists. Absent, English.\n */\n language?: string\n /**\n * A page brought in from its owner's own website (AGL-4107): every word is\n * the source's and is drawn exactly as given — never fitted, cut, guarded\n * or left out — and so is every item of every group, every picture (the\n * source's own, never a stand-in), every band and every link. The page's\n * structure is the source's, read by code (`ai-site-import-compile.ts`), so\n * none of the moves that rearrange a model's design applies: no rhythm, no\n * like columns folded into cards, no third strong band settled soft, no\n * contact lines added. Only its opening may take a hero around the\n * source's own picture, as its design answer chose.\n */\n verbatim?: boolean\n}\n\n/** Words exactly as given, one space between them: how a page brought in shows them (AGL-4107). */\nexport function aiLayoutAsWritten(value: unknown): string {\n return typeof value === 'string' ? value.replace(/\\s+/g, ' ').trim() : ''\n}\n\n/**\n * What a section is called to a screen reader: its plan name, with any note\n * the plan left in brackets taken out. A live blog plan (2026-10-09) named a\n * section \"reader notes and kind words [to be added by owner]\"; carried into\n * the label it read as a gap, and the page's gap pass took the section out.\n */\nfunction sectionLabel(name: string, index: number, language?: string): string {\n return aiLayoutFitText(name.replace(/\\[[^\\]]*\\]/g, ' ').replace(/\\s+/g, ' ').trim(), 'note', language) || `Section ${index + 1}`\n}\n\n/** A section root's id where the caller gives none. */\nfunction sectionIdOf(index: number): string {\n return `section-${index + 1}`\n}\n\nexport interface AiLayoutCompiledPage {\n tree: AiLayoutRawTree\n /** Each plan section's root, by its compiled id, in plan order. */\n sectionRoots: string[]\n /** A button's compiled id → the plan section a click scrolls to. */\n scrollTo: Record<string, number>\n settled: AiLayoutSettlement[]\n /**\n * Each plan section's repeated items — cards, steps, figures, component\n * instances, list lines and questions — by the id of the element that\n * draws each (AGL-3660), so a check can count what a visitor sees after\n * anything later takes words out.\n */\n itemIds: string[][]\n /** Plan sections whose only items were quotes, which a published page leaves out (AGL-3676). */\n quotesOnly: number[]\n}\n\n/** The most pictures a page carries; each beyond it is one more empty slot to fill. */\nexport const AI_LAYOUT_MAX_IMAGES = 3\n\n/** The most characters a heading style holds; a longer heading of a page brought in is set as a subtitle (AGL-4107). */\nexport const AI_LAYOUT_HEADLINE_MAX_CHARS = AI_TEXT_LIMITS.headline\n\n/** The most `brand` or `dark` bands a page shows; more and none stands out. */\nexport const AI_LAYOUT_MAX_STRONG_BANDS = 2\n\nconst SECTION_PADDING = { xs: 8, md: 12 } as const\nconst HERO_PADDING = { xs: 10, md: 14 } as const\n\n/** Everything one page's compile shares. */\nexport interface PageScope {\n tree: AiLayoutTreeBuilder\n plan: AiLayoutPagePlan\n targets: AiLayoutTargets\n options: AiLayoutCompileOptions\n settled: AiLayoutSettlement[]\n scrollTo: Record<string, number>\n images: number\n strong: Record<'brand' | 'dark', number>\n /** The section of this page that places the site's form, if one does. */\n formSection: number | null\n /** The icon a picture shows until the owner places one, when its block names none. */\n pageIcon: AiIconLibraryEntry\n /** The forms this page already places, each once. */\n formsPlaced: Set<string>\n /** Each section's repeated items, by the id of the element that draws each (AGL-3660). */\n itemIds: string[][]\n /** The site's design and the choices its seed made, where the page is drawn with one. */\n design: { input: AiLayoutDesign; choices: AiLayoutDesignChoices } | null\n /** Stand-in pictures the design placed beside the model's own (`images`). */\n pictures: number\n /** Sections of words the design set beside a picture. */\n features: number\n /** The last section whose heading the design set beside its items: never two in a row. */\n splitAt: number\n /** Sections whose only items were quotes, left out (AGL-3676). */\n quotesOnly: number[]\n /**\n * The band each section was drawn in, by plan index: what the next one's\n * rhythm reads (AGL-4065). A frame, which draws no page sections, keeps none.\n */\n drawnBands?: AiLayoutBand[]\n /** How many sections in a row, up to this one, showed no picture (AGL-4065). */\n bare?: number\n /** Sections the design set beside a photo because they were the third without one (AGL-4065). */\n rhythm?: number\n}\n\n/** Everything one section's compile shares. */\nexport interface SectionScope {\n page: PageScope\n index: number\n at: string\n band: AiLayoutBand\n centered: boolean\n /** The level of the section's own heading: 1 on the first section, 2 after. */\n level: number\n /**\n * A section of the site's frame — its footer — whose headings are labels:\n * a layout carries no heading outline of its own, since every page brings\n * its own (rule 11).\n */\n frame?: boolean\n /** Whether the section's own heading has been written. */\n headed: boolean\n link: AiLayoutLinkScope\n /** Like items the section may still show (rule 8), across its groups. */\n itemsLeft: number\n /** What the section is about — its plan name and its headings — which picks how its groups are drawn. */\n words?: string\n /** Whether the section's words sit over a photo, where they take the band's own color. */\n overPhoto?: boolean\n /** The section's first heading as the model wrote it: what a stand-in picture is of. */\n heading?: string\n /** A group style the section's arrangement settled, over the one its words would pick. */\n groupStyle?: AiLayoutGroupVariant\n}\n\nconst formIdsOf = (targets: AiLayoutTargets): Set<string> =>\n new Set(targets.forms.map((form) => form.id))\nconst componentOf = (targets: AiLayoutTargets, id: string | undefined) =>\n id\n ? (targets.components.find((component) => component.id === id) ?? null)\n : null\n\n/**\n * The section of this page that places a form: one whose plan places one, or\n * whose design places one by its id.\n */\n/** Whether the site's form lives on another page of the site than this one. */\nfunction formLivesElsewhere(targets: AiLayoutTargets): boolean {\n return !!targets.formPageId && targets.formPageId !== targets.pageId\n}\n\nfunction formSectionOf(\n sections: readonly AiLayoutSection[],\n plan: AiLayoutPagePlan,\n targets: AiLayoutTargets,\n): number | null {\n const forms = formIdsOf(targets)\n const planned = plan.sections.findIndex((section) =>\n section.uses.some((ref) => forms.has(ref)),\n )\n if (planned !== -1) return planned\n // A form drawn on a page it does not live on becomes a button to its page (AGL-3899).\n if (formLivesElsewhere(targets)) return null\n const designed = sections.findIndex((section) =>\n section.blocks.some(\n (block) => block.kind === 'form' && (!block.to || forms.has(block.to)),\n ),\n )\n return designed === -1 ? null : designed\n}\n\n/** Compiles a page designed in the layout language into the tree it stores. */\nexport function aiCompileLayoutPage(\n designed: readonly AiLayoutSection[],\n plan: AiLayoutPagePlan,\n targets: AiLayoutTargets,\n options: AiLayoutCompileOptions,\n): AiLayoutCompiledPage {\n const tree = new AiLayoutTreeBuilder()\n const formSection = formSectionOf(designed, plan, targets)\n // The page a visitor opens to get in touch shows the phone and email the\n // business gave, as links, wherever the design did not (AGL-3979). A page\n // brought in shows what its source shows, and nothing more (AGL-4107).\n const sections = options.verbatim ? designed : aiLayoutWithContactLines(designed, formSection, targets.contact)\n const page: PageScope = {\n tree,\n plan,\n targets,\n options,\n settled: [],\n scrollTo: {},\n images: 0,\n strong: { brand: 0, dark: 0 },\n formSection,\n pageIcon: pageIconOf(sections),\n formsPlaced: new Set(),\n itemIds: plan.sections.map(() => []),\n design: options.design ? { input: options.design, choices: aiLayoutDesignChoices(options.design) } : null,\n pictures: 0,\n features: 0,\n splitAt: -2,\n quotesOnly: [],\n drawnBands: [],\n bare: 0,\n rhythm: 0,\n }\n const roots = plan.sections.map((_, index) => {\n const section = sections[index] ?? { blocks: [] }\n return compileSection(page, section, index)\n })\n const rootId = tree.add(\n 'div',\n null,\n null,\n roots,\n 'page',\n CANVAS_ROOT_ELEMENT_ID,\n )\n return {\n tree: { rootId, nodes: tree.nodes },\n sectionRoots: roots,\n scrollTo: page.scrollTo,\n settled: page.settled,\n itemIds: page.itemIds,\n quotesOnly: page.quotesOnly,\n }\n}\n\n/** The first icon the design names anywhere, else a sparkle: what an empty picture shows. */\nfunction pageIconOf(sections: readonly AiLayoutSection[]): AiIconLibraryEntry {\n for (const section of sections) {\n for (const block of section.blocks) {\n const own = aiIconOfWord(block.icon)\n if (own) return own\n for (const item of block.items ?? []) {\n const icon = aiIconOfWord(item.icon)\n if (icon) return icon\n }\n }\n }\n return AI_ICON_LIBRARY.sparkle\n}\n\n// ── A section ─────────────────────────────────────────────────────────────\n\n/** The listings whose element shows each record's picture: products, posts and events (AGL-4065). */\nconst PICTURED_LISTINGS: ReadonlySet<AiLayoutListing['kind']> = new Set(['products', 'posts', 'events'])\n\n/**\n * A section drawn, and what the next one reads of it (AGL-4065): the band it\n * was drawn in, and whether it showed a picture — its own, a stand-in, a\n * record's photo or a listing that shows its records' pictures.\n */\nfunction compileSection(\n page: PageScope,\n raw: AiLayoutSection,\n index: number,\n): string {\n const scope = sectionScope(page, raw, index)\n const id = drawSection(page, raw, index, scope)\n page.drawnBands ??= []\n page.drawnBands[index] = scope.band\n const listed = aiLayoutListingAt(page.targets.listings ?? [], page.targets.pageId, index)\n const pictured = (!!listed && PICTURED_LISTINGS.has(listed.listing.kind)) || holdsPicture(page.tree, id)\n page.bare = pictured ? 0 : (page.bare ?? 0) + 1\n return id\n}\n\n/** Whether a compiled part holds an Image anywhere under it. */\nfunction holdsPicture(tree: AiLayoutTreeBuilder, id: string): boolean {\n const node = tree.nodes[id]\n if (!node) return false\n return node.componentId === 'image' || (node.nodes ?? []).some((child) => holdsPicture(tree, child))\n}\n\n/**\n * The band a section is drawn in where the site's design keeps a rhythm\n * (AGL-4065): on a `plain` rhythm one ground, every soft band plain; on an\n * `alternate` rhythm the model's bands, except a plain or soft band that\n * would meet the same band above it, which takes the other. Brand and dark\n * bands, and the first section's, are the model's.\n */\nfunction rhythmBand(page: PageScope, index: number, band: AiLayoutBand): AiLayoutBand {\n if (!page.design || index === 0 || (band !== 'plain' && band !== 'soft')) return band\n if (page.design.choices.bandRhythm === 'plain') return 'plain'\n const above = page.drawnBands?.[index - 1]\n if (above !== band) return band\n return band === 'plain' ? 'soft' : 'plain'\n}\n\nfunction sectionScope(page: PageScope, raw: AiLayoutSection, index: number): SectionScope {\n const at = `sections[${index}]`\n const asked = raw.band ?? 'plain'\n // A page brought in keeps the source's bands, every one (AGL-4107).\n const verbatim = page.options.verbatim === true\n const ruled = verbatim ? asked : rhythmBand(page, index, asked)\n if (ruled !== asked) page.settled.push({ at: `${at}.band`, what: `drawn ${ruled}: the page's ${page.design?.choices.bandRhythm} band rhythm` })\n const band = verbatim ? asked : settleBand(page, ruled, at)\n return {\n page,\n index,\n at,\n band,\n centered: raw.align === 'center',\n level: index === 0 ? 1 : 2,\n headed: false,\n itemsLeft: verbatim ? Number.POSITIVE_INFINITY : AI_LAYOUT_MAX_ITEMS,\n link: {\n sections: page.plan.sections.map((section) => section.name),\n from: index,\n formSection: page.formSection,\n },\n heading: raw.blocks.find((block) => block.kind === 'heading')?.text,\n words: [\n page.plan.sections[index]?.name ?? '',\n ...raw.blocks.filter((block) => block.kind === 'heading' || block.kind === 'eyebrow').map((block) => block.text ?? ''),\n ].join(' '),\n }\n}\n\nfunction drawSection(\n page: PageScope,\n raw: AiLayoutSection,\n index: number,\n scope: SectionScope,\n): string {\n const { at, band } = scope\n const verbatim = page.options.verbatim === true\n // A quote is a gap the owner fills, and a published page shows no gap\n // (AGL-3660); a page brought in quotes its own customers' words (AGL-4107).\n const blocks = placePlanned(scope, raw).filter((block) => {\n if (block.kind !== 'quotes' || verbatim) return true\n page.settled.push({ at, what: 'a quotes group left out: a published page shows no customer words the brief did not give' })\n return false\n })\n // A section whose only items were those quotes has none left to show, and is\n // not asked for them again: no answer can give words the brief did not (AGL-3676).\n if (\n !verbatim &&\n raw.blocks.some((block) => block.kind === 'quotes') &&\n !blocks.some((block) => AI_LAYOUT_GROUP_KINDS.has(block.kind) || block.kind === 'component')\n ) {\n page.quotesOnly.push(index)\n }\n // A store's Shop page opens on its grid (AGL-3676): its first section is a\n // short title bar, never a hero, so the products start above the fold.\n if (!verbatim && index === 0 && shopGridAt(page) > 0) return shopTitle(scope, blocks)\n // A section the site's records fill — its catalog, its blog — shows them\n // through the element that keeps them, around the words the design gave it (AGL-3676).\n const listed = verbatim ? null : aiLayoutListingAt(page.targets.listings ?? [], page.targets.pageId, index)\n if (listed) return listingSection(scope, blocks, listed)\n // The site's design draws the sections it has an arrangement for (AGL-3660),\n // the third band in a row with no picture beside one (AGL-4065). A page\n // brought in takes only its hero, around the source's own picture (AGL-4107).\n if (verbatim) {\n const opening = index === 0 && raw.hero ? importedHero(scope, raw, blocks) : null\n if (opening) return opening\n } else if (page.design) {\n const beside = rhythmSection(scope, raw, blocks)\n if (beside) return beside\n const designed = designSection(scope, raw, blocks)\n if (designed) return designed\n }\n const cols = raw.cols && raw.cols.length >= 2 ? raw.cols : null\n // Above the row, the row's columns, and below it.\n const head: AiLayoutBlock[] = []\n const tail: AiLayoutBlock[] = []\n const columns: AiLayoutBlock[][] = cols ? cols.map(() => []) : []\n let placed = false\n for (const block of blocks) {\n if (cols && block.col !== undefined) {\n columns[Math.min(block.col, cols.length - 1)].push(block)\n placed = true\n } else if (placed) {\n tail.push(block)\n } else {\n head.push(block)\n }\n }\n let filled = columns\n .map((column, position) => ({ column, weight: cols?.[position] ?? 1 }))\n .filter((entry) => entry.column.length)\n // A row whose columns each place the same component, one instance a\n // column or more, is that component's group of cards: the compiler lays\n // its instances out once, rather than one like Grid a column (rule 1).\n // Row by row, as the columns showed them: the first of each column, then the second.\n const deepest = Math.max(0, ...filled.map((entry) => entry.column.length))\n const placedHere = Array.from({ length: deepest }, (_, row) =>\n filled.flatMap((entry) => (entry.column[row] ? [entry.column[row]] : [])),\n ).flat()\n const repeated = placedHere[0]?.kind === 'component' ? componentOf(page.targets, placedHere[0].to) : null\n if (\n !verbatim &&\n filled.length >= 2 &&\n repeated &&\n placedHere.every((block) => block.kind === 'component' && block.to === repeated.id)\n ) {\n head.push({ kind: 'cards', to: repeated.id, items: placedHere.map((block) => componentItem(block, repeated.props)) })\n page.settled.push({ at, what: `${placedHere.length} ${repeated.name} instances in ${filled.length} columns drawn as one group` })\n filled = []\n }\n // A row whose columns each hold only one kind of group — a card a column —\n // is that group, laid out by the compiler rather than column by column.\n const groups = filled.flatMap((entry) => entry.column)\n if (\n !verbatim &&\n filled.length >= 2 &&\n groups.every(\n (block) => isItemGroup(block) && block.kind === groups[0].kind && block.to === groups[0].to,\n )\n ) {\n head.push({ ...groups[0], col: undefined, items: groups.flatMap((block) => block.items ?? []) })\n page.settled.push({ at, what: `a ${groups[0].kind} group split over ${filled.length} columns drawn as one` })\n filled = []\n }\n // A row whose columns all say the same kind of thing, three or more across,\n // is a group of cards: one design, the words the columns gave.\n if (!verbatim && filled.length >= 3 && sameShape(filled.map((entry) => entry.column))) {\n head.push(...columnsAsCards(filled.map((entry) => entry.column)))\n page.settled.push({\n at,\n what: `${filled.length} like columns drawn as cards`,\n })\n filled = []\n }\n if (filled.length === 1) {\n // One column with anything in it is no row.\n head.push(...filled[0].column)\n filled = []\n }\n // The section's heading leads its outline: a heading with no words is no\n // heading, the first section always carries the page's one h1, and a\n // heading written after a group whose titles sit under it moves above it.\n const inOrder = () =>\n head.concat(\n filled.flatMap((entry) => entry.column),\n tail,\n )\n const speaks = (block: AiLayoutBlock) =>\n block.kind === 'heading' &&\n !!(verbatim ? aiLayoutAsWritten(block.text) : aiLayoutWords(block.text, 'heading', page.targets.facts, page.options.language))\n for (const list of [head, tail, ...filled.map((entry) => entry.column)]) {\n for (let at = list.length - 1; at >= 0; at -= 1)\n if (list[at].kind === 'heading' && !speaks(list[at])) list.splice(at, 1)\n }\n if (index === 0 && !inOrder().some(speaks)) {\n head.unshift({ kind: 'heading', text: page.plan.title })\n page.settled.push({\n at,\n what: \"no heading; the page's title written as its h1\",\n })\n }\n const order = inOrder()\n const first = order.findIndex(speaks)\n if (\n !verbatim &&\n first > 0 &&\n order\n .slice(0, first)\n .some(\n (block) =>\n block.kind === 'cards' ||\n block.kind === 'steps' ||\n block.kind === 'component',\n )\n ) {\n const lead = order[first]\n for (const list of [head, tail, ...filled.map((entry) => entry.column)]) {\n const at = list.indexOf(lead)\n if (at !== -1) list.splice(at, 1)\n }\n head.unshift({ ...lead, col: undefined })\n page.settled.push({\n at,\n what: 'the heading moved above the group it heads',\n })\n }\n filled = filled.filter((entry) => entry.column.length)\n if (filled.length === 1) {\n head.push(...filled[0].column)\n filled = []\n }\n const wide =\n filled.length > 0 || [...head, ...tail].some((block) => isWideGroup(block))\n const parts: string[] = []\n const headId = compileFlow(scope, head, 'full')\n if (headId) parts.push(centered(scope, headId, wide))\n if (filled.length) parts.push(compileRow(scope, filled))\n const tailId = compileFlow(scope, tail, 'full')\n if (tailId) parts.push(centered(scope, tailId, wide))\n // A frame whose content came to nothing is taken out, leaves first.\n for (let at = parts.length - 1; at >= 0; at -= 1) {\n page.tree.prune(parts[at])\n const part = page.tree.nodes[parts[at]]\n if (AI_LAYOUT_FRAMES.has(part.componentId) && !part.nodes?.length) {\n delete page.tree.nodes[parts[at]]\n parts.splice(at, 1)\n }\n }\n if (!parts.length) {\n // Nothing the design gave this section could be shown: it keeps its\n // place on the page under the name its plan gives it.\n const fallback = compileFlow(\n scope,\n [\n {\n kind: 'heading',\n text: page.plan.sections[index]?.name || page.plan.title,\n },\n ],\n 'full',\n )\n if (fallback) parts.push(fallback)\n page.settled.push({\n at,\n what: 'nothing to show; the section named by its plan',\n })\n }\n const tree = page.tree\n const content =\n parts.length === 1\n ? parts[0]\n : // Gap, not margins: a stack's margin spacing resets its children's\n // margins, which un-centers a reading-width head (AGL-3660).\n tree.add('muiStack', { spacing: '6', useFlexGap: true }, null, parts, 'content')\n const container = tree.add(\n 'muiContainer',\n { maxWidth: wide ? 'lg' : 'md' },\n { py: index === 0 ? { ...HERO_PADDING } : { ...SECTION_PADDING } },\n [content],\n 'container',\n )\n const name = page.plan.sections[index]?.name?.trim() || `Section ${index + 1}`\n return tree.add(\n 'section',\n {\n element: 'section',\n ariaLabel: sectionLabel(name, index, page.options.language),\n ...(band === 'dark' ? { colorScheme: 'dark' } : {}),\n },\n bandSx(band),\n [container],\n 'section',\n page.options.sectionIds?.[index] ?? sectionIdOf(index),\n )\n}\n\n/**\n * A component block's prop values as a card item: its title-like prop as the\n * title and its text-like prop as the text, which `instanceValues` writes\n * back into the same props.\n */\nfunction componentItem(block: AiLayoutBlock, props: Record<string, string>): AiLayoutItem {\n // An item that names no prop is the card itself, written as a cards item.\n const own = (block.items ?? []).find((item) => !(item.title in props) && (item.title.trim() || item.text.trim()))\n if (own && !(block.items ?? []).some((item) => item.title in props)) return { title: own.title, text: own.text }\n const value = (pattern: RegExp) =>\n (block.items ?? []).find((item) => item.title in props && pattern.test(item.title) && item.text.trim())?.text ?? ''\n const title = value(/title|name|heading|label|question|figure|value/i) || block.text || ''\n const text = value(/text|description|body|summary|copy|answer|detail|caption/i)\n return { title, text }\n}\n\n/** A band the page has room for: past two brand or two dark bands, a soft one instead. */\nfunction settleBand(\n page: PageScope,\n band: AiLayoutBand,\n at: string,\n): AiLayoutBand {\n if (band !== 'brand' && band !== 'dark') return band\n // A storefront keeps one dark band at most (AGL-3676): the beta.237 Willow\n // Wick home ran its text bands dark, and read as big empty dark slabs\n // between the products.\n const most = band === 'dark' && page.design && aiLayoutFamily(page.design.input.kind) === 'retail' ? 1 : AI_LAYOUT_MAX_STRONG_BANDS\n if (page.strong[band] >= most) {\n page.settled.push({\n at: `${at}.band`,\n what: `a third ${band} band drawn soft`,\n })\n return 'soft'\n }\n page.strong[band] += 1\n return band\n}\n\n/** A band's own colors, as palette roles: the dark band pins the scheme instead. */\nexport function bandSx(band: AiLayoutBand): Record<string, unknown> | null {\n if (band === 'soft') return { bgcolor: 'background.paper' }\n if (band === 'brand')\n return { bgcolor: 'primary.main', color: 'primary.contrastText' }\n return null\n}\n\n/** A group whose items sit side by side. */\nfunction isItemGroup(block: AiLayoutBlock): boolean {\n return block.kind === 'cards' || block.kind === 'steps' || block.kind === 'stats' || block.kind === 'quotes'\n}\n\n/** Whether a block spans more than a reading column: a row of several items, or a table, tabs or logos of a page brought in. */\nfunction isWideGroup(block: AiLayoutBlock): boolean {\n if (block.kind === 'table' || block.kind === 'tabs' || block.kind === 'logos') return true\n return (\n (block.kind === 'cards' ||\n block.kind === 'steps' ||\n block.kind === 'stats' ||\n block.kind === 'quotes') &&\n (block.items?.length ?? 0) >= 2 &&\n // A page brought in lays a group out as its source does: one to a row reads at a reading width.\n block.columns !== 1\n )\n}\n\n/** A full-width flow centered on a wide section is held to a reading width. */\nfunction centered(scope: SectionScope, flowId: string, wide: boolean): string {\n const flow = scope.page.tree.nodes[flowId]\n const holdsGroup = (flow.nodes ?? []).some(\n (id) => scope.page.tree.nodes[id]?.componentId === 'muiGrid',\n )\n if (!wide || !scope.centered || holdsGroup) return flowId\n return scope.page.tree.add(\n 'muiContainer',\n { maxWidth: 'md', disableGutters: true },\n null,\n [flowId],\n 'measure',\n )\n}\n\n/**\n * The section's blocks with what its plan places in it: a form or a\n * component the plan line names and the design left out is added where the\n * section ends, and a `form` or `component` block naming nothing takes the\n * one the plan line names.\n */\nfunction placePlanned(\n scope: SectionScope,\n raw: AiLayoutSection,\n): AiLayoutBlock[] {\n const { page, index, at } = scope\n const forms = formIdsOf(page.targets)\n const uses = page.plan.sections[index]?.uses ?? []\n const plannedForms = uses.filter((ref) => forms.has(ref))\n const plannedComponents = uses.filter((ref) => componentOf(page.targets, ref))\n const blocks = raw.blocks.map((block) => ({\n ...block,\n ...(block.items ? { items: [...block.items] } : {}),\n }))\n const lastCol =\n raw.cols && raw.cols.length >= 2 ? raw.cols.length - 1 : undefined\n // A form the design drew where the plan places none, on a page the form\n // does not live on, is that page's way to it (AGL-3899): a button to the\n // page that holds the form, never a second copy of the form.\n if (!plannedForms.length && formLivesElsewhere(page.targets)) {\n const at0 = blocks.findIndex((block) => block.kind === 'form')\n if (at0 !== -1) {\n const asks = blocks.some((block) => block.kind === 'button' && (block.to === 'form' || block.to === `page:${page.targets.formPageId}`))\n const col = blocks[at0].col\n const kept = blocks.filter((block) => block.kind !== 'form')\n if (!asks) {\n kept.splice(at0, 0, {\n kind: 'button',\n text: aiLayoutLabel('getInTouch', page.options.language),\n to: 'form',\n ...(col !== undefined ? { col } : {}),\n })\n }\n blocks.splice(0, blocks.length, ...kept)\n page.settled.push({ at, what: 'a form on a page it does not live on; a button to its page instead' })\n }\n }\n for (const block of blocks) {\n if (block.kind === 'form' && !(block.to && forms.has(block.to))) {\n const only =\n page.targets.forms.length === 1 ? page.targets.forms[0].id : undefined\n block.to = plannedForms[0] ?? only\n }\n if (\n (block.kind === 'component' || block.kind === 'cards') &&\n block.to &&\n !componentOf(page.targets, block.to)\n ) {\n if (block.kind === 'component') block.to = plannedComponents[0]\n else delete block.to\n }\n if (block.kind === 'component' && !block.to) block.to = plannedComponents[0]\n // A group whose every item names the same component is that component's\n // placements (AGL-3660): the design put the id on its items, not the block.\n if (AI_LAYOUT_GROUP_KINDS.has(block.kind) && !block.to && block.items?.length) {\n const named = block.items[0]?.to\n if (named && componentOf(page.targets, named) && block.items.every((item) => item.to === named)) {\n block.to = named\n block.items = block.items.map(({ to: _to, ...item }) => item)\n }\n }\n }\n for (const form of plannedForms) {\n if (!blocks.some((block) => block.kind === 'form' && block.to === form)) {\n blocks.push({\n kind: 'form',\n to: form,\n ...(lastCol !== undefined ? { col: lastCol } : {}),\n })\n page.settled.push({ at, what: `the planned form ${form} placed` })\n }\n }\n for (const component of plannedComponents) {\n if (\n blocks.some(\n (block) =>\n (block.kind === 'component' || block.kind === 'cards') &&\n block.to === component,\n )\n )\n continue\n // A group the design drew where the plan places a component is that component's placements.\n const group = blocks.find(\n (block) =>\n AI_LAYOUT_GROUP_KINDS.has(block.kind) &&\n block.kind !== 'faq' &&\n block.kind !== 'list' &&\n !block.to,\n )\n if (group) {\n // Every group of that kind the design split over the row's columns, so\n // each item of the row is drawn alike (AGL-3660), never the first alone.\n for (const like of blocks) {\n if (like.kind === group.kind && !like.to) like.to = component\n }\n continue\n }\n blocks.push({\n kind: 'component',\n to: component,\n ...(lastCol !== undefined ? { col: lastCol } : {}),\n })\n page.settled.push({ at, what: `the planned component ${component} placed` })\n }\n return blocks.filter((block) => {\n if ((block.kind === 'form' || block.kind === 'component') && !block.to) {\n page.settled.push({\n at,\n what: `a ${block.kind} with nothing to place; left out`,\n })\n return false\n }\n // A form is placed once a page: a second copy of the same form asks a\n // visitor the same thing twice.\n if (block.kind === 'form' && block.to) {\n if (page.formsPlaced.has(block.to)) {\n page.settled.push({ at, what: `the form ${block.to} again; left out` })\n return false\n }\n page.formsPlaced.add(block.to)\n }\n return true\n })\n}\n\n/** The block kinds a column holds, as a column's shape is compared. */\nfunction shapeOf(column: readonly AiLayoutBlock[]): string {\n return column.map((block) => block.kind).join(',')\n}\n\n/** What a like column may hold and still be read as a card: its words, a picture and one button. */\nconst CARD_COLUMN_KINDS: ReadonlySet<string> = new Set(['heading', 'text', 'lede', 'eyebrow', 'image', 'note', 'button'])\n\n/** The words of a column a card says: its heading, or its first words. */\nconst WORDS_KINDS: ReadonlySet<string> = new Set(['heading', 'text', 'lede', 'note'])\n\n/**\n * Whether a row's columns all say the same kind of thing (AGL-3660): the\n * same blocks in the same order, words among them, one button at most. The\n * beta.270 Sugar Hollow Galleries page (AGL-3988) was refused for rule 1,\n * \"The same Grid block appears 4 times\": four like columns this read did not\n * fold, each of them drawn as a Grid cell of its own.\n */\nfunction sameShape(columns: readonly AiLayoutBlock[][]): boolean {\n const first = shapeOf(columns[0])\n return (\n columns.every((column) => shapeOf(column) === first) &&\n columns[0].some((block) => WORDS_KINDS.has(block.kind)) &&\n columns[0].every((block) => CARD_COLUMN_KINDS.has(block.kind)) &&\n columns[0].filter((block) => block.kind === 'button').length <= 1\n )\n}\n\n/**\n * Like columns as one group of cards: each column's heading its title, its\n * words its text. Their buttons follow the group (AGL-3988): one, where they\n * all go to the same place, else a list of links, each named by its card.\n */\nfunction columnsAsCards(columns: readonly AiLayoutBlock[][]): AiLayoutBlock[] {\n const cards: AiLayoutBlock = {\n kind: 'cards',\n items: columns.map((column) => {\n const title = column.find((block) => block.kind === 'heading')?.text ?? ''\n const words = column\n .filter(\n (block) =>\n block.kind === 'text' ||\n block.kind === 'lede' ||\n block.kind === 'note',\n )\n .map((block) => block.text ?? '')\n .join(' ')\n const icon = column.find((block) => block.icon)?.icon\n return { title, text: words, ...(icon ? { icon } : {}) }\n }),\n }\n const buttons = columns.flatMap((column) => {\n const button = column.find((block) => block.kind === 'button')\n return button?.to?.trim() ? [{ button, column }] : []\n })\n if (!buttons.length) return [cards]\n const places = new Set(buttons.map(({ button }) => (button.to ?? '').trim().toLowerCase()))\n if (places.size === 1) {\n const { button } = buttons[0] as { button: AiLayoutBlock }\n return [cards, { kind: 'button', text: button.text ?? '', to: button.to, ...(button.style ? { style: button.style } : {}) }]\n }\n return [\n cards,\n {\n kind: 'list',\n items: buttons.map(({ button, column }) => ({\n title: column.find((block) => block.kind === 'heading')?.text || button.text || '',\n text: '',\n to: button.to ?? '',\n })),\n },\n ]\n}\n\n// ── A row of columns ──────────────────────────────────────────────────────\n\n// Spans out of twelve live with the tree, so a frame's repair reads them without the compiler (AGL-3735).\nexport { aiLayoutSpans }\n\nexport function compileRow(\n scope: SectionScope,\n columns: Array<{ column: AiLayoutBlock[]; weight: number }>,\n /** How the columns sit against each other: centered on a page, top-aligned in a footer (AGL-3735). */\n alignItems: 'center' | 'flex-start' = 'center',\n): string {\n const tree = scope.page.tree\n const spans = aiLayoutSpans(columns.map((entry) => entry.weight))\n const items = columns.map((entry, position) => {\n const span = spans[position]\n const flow = compileFlow(\n scope,\n entry.column,\n span >= 8 ? 'full' : span >= 5 ? 'half' : 'narrow',\n )\n const size =\n columns.length >= 4 ? `xs:12 sm:6 md:${span}` : `xs:12 md:${span}`\n return tree.add('muiGrid', { size }, null, [flow], 'column')\n })\n return tree.add(\n 'muiGrid',\n { container: true, spacing: columns.length >= 3 ? '4' : '6' },\n { alignItems },\n items,\n 'row',\n )\n}\n\n// ── A flow of blocks ─────────────────────────────────────────────────────\n\nexport type Room = 'full' | 'half' | 'narrow'\n\n/** A column of blocks, top to bottom, with buttons side by side; `null` when nothing in it compiles. */\nexport function compileFlow(\n scope: SectionScope,\n blocks: readonly AiLayoutBlock[],\n room: Room,\n): string | null {\n const tree = scope.page.tree\n const children: string[] = []\n let buttons: string[] = []\n const flushButtons = () => {\n if (!buttons.length) return\n children.push(\n buttons.length === 1\n ? buttons[0]\n : tree.add(\n 'muiStack',\n {\n direction: 'row',\n spacing: '2',\n useFlexGap: true,\n flexWrap: 'wrap',\n ...(scope.centered ? { justifyContent: 'center' } : {}),\n },\n null,\n buttons,\n 'actions',\n ),\n )\n buttons = []\n }\n for (const block of blocks) {\n if (block.kind === 'button') {\n const id = compileButton(scope, block)\n if (id) buttons.push(id)\n continue\n }\n flushButtons()\n const id = compileBlock(scope, block, room)\n if (id) children.push(id)\n }\n flushButtons()\n if (!children.length) return null\n // One block needs no flow around it.\n if (children.length === 1) return children[0]\n const align = scope.centered && room === 'full'\n // A flow whose words open with a label, a heading and a lede reads as one\n // block at a tighter spacing than the groups under it.\n return tree.add(\n 'muiStack',\n {\n spacing: hasGroup(tree, children) ? '4' : '2.5',\n ...(align ? { alignItems: 'center' } : {}),\n },\n null,\n children,\n 'flow',\n )\n}\n\nfunction hasGroup(tree: AiLayoutTreeBuilder, ids: readonly string[]): boolean {\n return ids.some((id) =>\n ['muiGrid', 'muiList'].includes(tree.nodes[id]?.componentId ?? ''),\n )\n}\n\nfunction compileBlock(\n scope: SectionScope,\n block: AiLayoutBlock,\n room: Room,\n): string | null {\n switch (block.kind) {\n case 'eyebrow':\n return words(\n scope,\n block,\n 'eyebrow',\n 'overline',\n { component: 'p' },\n accent(scope),\n )\n case 'heading':\n return heading(scope, block)\n case 'lede':\n return words(scope, block, 'lede', 'lede', {}, muted(scope))\n case 'text':\n return words(scope, block, 'text', 'body1', {}, muted(scope))\n case 'note':\n return words(scope, block, 'note', 'body2', {}, muted(scope))\n case 'image':\n return image(scope, block, room)\n case 'form':\n return form(scope, block)\n case 'component':\n return component(scope, block)\n case 'list':\n return list(scope, block, room)\n case 'faq':\n return faq(scope, block)\n case 'cards':\n case 'steps':\n case 'stats':\n case 'quotes':\n return group(scope, block, room)\n case 'table':\n return table(scope, block)\n case 'tabs':\n return tabs(scope, block, room)\n case 'logos':\n return logos(scope, block)\n default:\n return null\n }\n}\n\n/** Secondary words' color: muted text, or the band's own on a brand band. */\nfunction muted(scope: SectionScope): Record<string, unknown> | null {\n return scope.band === 'brand' || scope.overPhoto ? null : { color: 'text.secondary' }\n}\n\n/**\n * A List Item Text's secondary words: MUI draws them in the muted text color\n * whatever they sit on, so on a brand band, or over a photo, they take the\n * band's own color as the primary words do (AGL-3886).\n */\nfunction mutedSecondary(scope: SectionScope): Record<string, unknown> {\n return scope.band === 'brand' || scope.overPhoto ? { secondaryColor: 'inherit' } : {}\n}\n\n/** An accent's color: the brand's, or the band's own on a brand band. */\nfunction accent(scope: SectionScope): Record<string, unknown> | null {\n return scope.band === 'brand' || scope.overPhoto ? null : { color: 'primary.main' }\n}\n\nfunction align(scope: SectionScope): Record<string, unknown> {\n return scope.centered ? { align: 'center' } : {}\n}\n\n/**\n * Words as a page shows them: fitted to their place at a clean boundary, or,\n * on a page brought in (AGL-4107), exactly as the source wrote them.\n */\nfunction say(scope: SectionScope, value: unknown, place: AiLayoutTextPlace): string {\n if (scope.page.options.verbatim) return aiLayoutAsWritten(value)\n return aiLayoutWords(value, place, scope.page.targets.facts, scope.page.options.language)\n}\n\nfunction words(\n scope: SectionScope,\n block: AiLayoutBlock,\n place: AiLayoutTextPlace,\n variant: string,\n props: Record<string, unknown>,\n sx: Record<string, unknown> | null,\n): string | null {\n const text = say(scope, block.text, place)\n if (!text) return null\n return scope.page.tree.add(\n 'muiTypography',\n { children: text, variant, ...props, ...align(scope) },\n sx,\n null,\n place,\n )\n}\n\n/** A heading at its place in the outline: the section's own, or one under it. */\nfunction heading(scope: SectionScope, block: AiLayoutBlock): string | null {\n if (scope.frame) {\n const label = aiLayoutWords(\n block.text,\n 'itemTitle',\n scope.page.targets.facts,\n scope.page.options.language,\n )\n return label\n ? scope.page.tree.add(\n 'muiTypography',\n {\n children: label,\n variant: 'subtitle1',\n component: 'p',\n ...align(scope),\n },\n null,\n null,\n 'label',\n )\n : null\n }\n const own = !scope.headed\n const level = own ? scope.level : scope.level + 1\n const place: AiLayoutTextPlace =\n level === 1 ? 'title' : own ? 'heading' : 'itemTitle'\n const text = say(scope, block.text, place)\n if (!text) return null\n scope.headed = scope.headed || own\n // A source's heading longer than a heading style holds is set in a subtitle\n // style, still a heading at its level (AGL-4107): every word of it is kept.\n const long = scope.page.options.verbatim === true && text.length > AI_LAYOUT_HEADLINE_MAX_CHARS\n const variant = long\n ? 'subtitle1'\n : level === 1\n ? block.style === 'large'\n ? 'displayXl'\n : 'h1'\n : own\n ? 'h2'\n : 'h4'\n return scope.page.tree.add(\n 'muiTypography',\n { children: text, variant, component: `h${level}`, ...align(scope) },\n null,\n null,\n 'heading',\n )\n}\n\n/** The level an item's title takes: one under the section's heading, or h2 in a section with none yet. */\nfunction itemLevel(scope: SectionScope): number {\n return scope.headed ? scope.level + 1 : Math.max(2, scope.level)\n}\n\n/** The element an item's title renders as: a heading on a page, a label in the frame. */\nfunction itemElement(scope: SectionScope): string {\n return scope.frame ? 'p' : `h${itemLevel(scope)}`\n}\n\nfunction compileButton(\n scope: SectionScope,\n block: AiLayoutBlock,\n): string | null {\n const verbatim = scope.page.options.verbatim === true\n // Words that carry the phone or the email are kept whole (AGL-3979).\n const asked = verbatim\n ? aiLayoutAsWritten(block.text)\n : aiLayoutContactLabel(block.text, scope.page.targets.contact) ||\n aiLayoutFitText(block.text, 'label', scope.page.options.language)\n if (!asked) return null\n const destination = verbatim\n ? aiLayoutImportedDestination(block.to, scope.page.plan.sections.length)\n : aiLayoutResolveLink(\n block.to,\n asked,\n scope.link,\n scope.page.targets,\n )\n if (!destination) {\n // A page brought in keeps the words of a link that goes nowhere here (AGL-4107).\n if (verbatim) return words(scope, block, 'text', 'body1', {}, muted(scope))\n scope.page.settled.push({\n at: scope.at,\n what: `the button \"${asked}\" has nowhere to go; left out`,\n })\n return null\n }\n // A link of a page brought in longer than a button's label holds is its\n // words, as a link (AGL-4107): every word kept, and it still goes there.\n if (verbatim && asked.length > AI_TEXT_LIMITS.button) return linkedWords(scope, asked, destination)\n // A button to a page merged into the blog names the blog (AGL-3676).\n const label = verbatim ? asked : aiLayoutRenamedLabel(asked, destination)\n if (label !== asked) scope.page.settled.push({ at: scope.at, what: `the button \"${asked}\" named for the blog: \"${label}\"` })\n const style = block.style ?? 'primary'\n // Over a photo, a quiet or outlined button takes the words' own color, as on a brand band.\n const onBrand = scope.band === 'brand' || (!!scope.overPhoto && style !== 'primary')\n const look =\n style === 'quiet'\n ? { variant: 'text', color: onBrand ? 'inherit' : 'primary' }\n : style === 'secondary'\n ? { variant: 'outlined', color: onBrand ? 'inherit' : 'primary' }\n : { variant: 'contained', color: onBrand ? 'secondary' : 'primary' }\n const id = scope.page.tree.add(\n 'muiButton',\n {\n children: label,\n ...look,\n size: scope.index === 0 || block.style === 'large' ? 'large' : 'medium',\n ...destinationProps(destination),\n },\n // Sized to its words, never stretched across the column a Stack would\n // stretch it over (AGL-3660), and aligned with its section.\n { alignSelf: scope.centered ? 'center' : 'flex-start' },\n null,\n 'button',\n )\n linkTo(scope, id, destination)\n return id\n}\n\n/**\n * Where a link of a page brought in goes (AGL-4107), as its compile wrote it:\n * `page:<id>` a page of the site by its id — any page the import plans, which\n * a visitor reaches once that page is live and sees as words until then —\n * `#<n>` section n of this page, a `mailto:` or `tel:` link, or the\n * `https:` address the source linked. Anything else goes nowhere.\n */\nexport function aiLayoutImportedDestination(to: string | undefined, sections: number): AiLayoutDestination | null {\n const value = (to ?? '').trim()\n if (!value) return null\n const page = /^page:([A-Za-z0-9_-]{1,128})$/.exec(value)\n if (page) return { kind: 'page', screenId: page[1] }\n const section = /^#(\\d{1,3})$/.exec(value)\n if (section) {\n const index = Number(section[1]) - 1\n return index >= 0 && index < sections ? { kind: 'section', index } : null\n }\n if (/^mailto:[^\\s@]+@[^\\s@]+$/i.test(value) || /^tel:\\+?[\\d\\s().-]{3,}$/i.test(value)) return { kind: 'contact', href: value }\n try {\n const url = new URL(value)\n return url.protocol === 'https:' ? { kind: 'href', href: url.toString() } : null\n } catch {\n return null\n }\n}\n\n/**\n * A link to a section of this page carries the platform's Scroll to element\n * interaction to that section's root (AGL-3097), by the id the page stores it\n * under.\n */\nfunction linkTo(\n scope: SectionScope,\n id: string,\n destination: AiLayoutDestination,\n): void {\n if (destination.kind !== 'section') return\n const { page } = scope\n page.scrollTo[id] = destination.index\n const target =\n page.options.sectionIds?.[destination.index] ??\n sectionIdOf(destination.index)\n const name =\n page.plan.sections[destination.index]?.name ??\n `section ${destination.index + 1}`\n page.tree.nodes[id].interactions = [aiPageScrollInteraction(target, name)]\n}\n\nexport function destinationProps(\n destination: AiLayoutDestination,\n): Record<string, unknown> {\n if (destination.kind === 'page') return { screenId: destination.screenId }\n if (destination.kind === 'href')\n return { href: destination.href, target: '_blank' }\n if (destination.kind === 'path') return { href: destination.href }\n // A call or an email opens the phone or the mail app, never a new tab (AGL-3979).\n if (destination.kind === 'contact') return { href: destination.href }\n return {}\n}\n\n/**\n * A picture slot: a soft frame at a stock shape showing an icon until the\n * owner places the picture, which then fills it. Its description is its alt\n * text (rule 9), and no source is set here: the compiler stays pure, and\n * `ai-layout-pictures.ts` fills the slot with a photo the site serves itself\n * once the page is checked.\n */\n/**\n * The site kinds whose galleries open in a lightbox by default (AGL-3717): a\n * portfolio's or a photographer's work is looked at, not skimmed, and a\n * visitor who presses a picture expects to see it large and step through the\n * rest. Every other kind opens a picture only where the design says so.\n */\nexport const AI_LIGHTBOX_GALLERY_KINDS: ReadonlySet<string> = new Set([\n 'portfolio',\n 'photography',\n])\n\n/** The `to` that opens an image block's picture in a lightbox (AGL-3717). */\nexport const AI_LAYOUT_LIGHTBOX_TO = 'lightbox'\n\n/** Whether this page's galleries open in a lightbox by default. */\nexport function aiOpensGalleriesInLightbox(page: { design: PageScope['design'] }): boolean {\n const kind = page.design?.input.kind\n return Boolean(kind && AI_LIGHTBOX_GALLERY_KINDS.has(kind))\n}\n\n/**\n * The Image props that make a picture open in a lightbox: as one gallery\n * with the section's other pictures, named for the section, and with the\n * item's title as its caption. The Image element reads exactly these.\n */\nfunction lightboxProps(scope: SectionScope, caption?: string): Record<string, unknown> {\n const name =\n aiLayoutFitText(scope.heading, 'alt', scope.page.options.language) ||\n aiLayoutFitText(scope.page.plan.sections[scope.index]?.name, 'alt', scope.page.options.language) ||\n `Gallery ${scope.index + 1}`\n const words = aiLayoutFitText(caption, 'alt', scope.page.options.language)\n return { lightbox: true, lightboxGallery: name, ...(words ? { lightboxCaption: words } : {}) }\n}\n\nfunction image(\n scope: SectionScope,\n block: AiLayoutBlock,\n room: Room,\n): string | null {\n const { page } = scope\n // A page brought in places the source's own picture, as the library holds it (AGL-4107).\n if (page.options.verbatim) return block.picture ? sourcePicture(scope, block.picture, room) : null\n const alt = aiLayoutFitText(block.text, 'alt', scope.page.options.language)\n if (!alt) return null\n if (page.images >= maxImages(page)) {\n page.settled.push({\n at: scope.at,\n what: `a picture past the page's ${AI_LAYOUT_MAX_IMAGES}; left out`,\n })\n return null\n }\n page.images += 1\n const icon = aiIconOfWord(block.icon) ?? page.pageIcon\n const tree = page.tree\n const mark = tree.add(\n AI_ICON_COMPONENT_ID,\n { iconId: icon.id, size: '64' },\n { color: 'primary.main' },\n null,\n 'imageIcon',\n )\n // `to: lightbox` opens the picture large (AGL-3717); one picture is its\n // own gallery, so it opens alone unless the section has more.\n const opensLarge = block.to?.trim().toLowerCase() === AI_LAYOUT_LIGHTBOX_TO\n const picture = tree.add(\n 'image',\n { alt, objectFit: 'cover', ...(opensLarge ? lightboxProps(scope) : {}) },\n { position: 'absolute', top: 0, left: 0, width: '100%', height: '100%' },\n null,\n 'image',\n )\n return tree.add(\n 'muiBox',\n null,\n {\n position: 'relative',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n overflow: 'hidden',\n // In multiples of the theme's corner radius, so a sharp site's frames are sharp.\n borderRadius: 2,\n bgcolor: 'action.hover',\n // The frame's shape follows its room, so no two slots of a page share one style.\n aspectRatio:\n room === 'full'\n ? page.images === 1\n ? '16 / 9'\n : '21 / 9'\n : room === 'half'\n ? '4 / 3'\n : page.images === 1\n ? '1 / 1'\n : '3 / 4',\n },\n [mark, picture],\n 'frame',\n )\n}\n\n/** A saved form, framed as a card so it reads as the section's one task. */\nfunction form(scope: SectionScope, block: AiLayoutBlock): string | null {\n const tree = scope.page.tree\n const placed = tree.add('form', { formId: block.to }, null, null, 'form')\n const content = tree.add(\n 'muiCardContent',\n null,\n { p: { xs: 3, md: 4 } },\n [placed],\n 'formContent',\n )\n // The card style is the site theme's (AGL-3660), as a card dropped from the\n // drawer takes it; it takes the flow's width, so a centered section never\n // shrinks a form to its button.\n return tree.add('muiCard', null, { alignSelf: 'stretch' }, [content], 'formCard')\n}\n\n/** A reusable component placed by its id, its props filled from the block's items. */\nfunction component(scope: SectionScope, block: AiLayoutBlock): string | null {\n const declared = componentOf(scope.page.targets, block.to)\n if (!declared) return null\n const values: Record<string, unknown> = {}\n for (const item of block.items ?? []) {\n const name = item.title.trim()\n if (name in declared.props && item.text.trim())\n values[name] = aiLayoutWords(item.text, 'text', scope.page.targets.facts, scope.page.options.language)\n }\n // An instance fills at least one prop (rule 1): the block's words, else the\n // name its section has in the plan, rather than the component's placeholder.\n if (!Object.values(values).some(Boolean)) {\n const first = textProps(declared.props)[0]\n const words =\n aiLayoutWords(block.text, 'text', scope.page.targets.facts, scope.page.options.language) ||\n aiLayoutWords(\n scope.page.plan.sections[scope.index]?.name,\n 'itemTitle',\n scope.page.targets.facts,\n scope.page.options.language,\n )\n if (first && words) values[first] = words\n }\n for (const [name, value] of Object.entries(values))\n if (!value) delete values[name]\n return scope.page.tree.add(\n REUSABLE_INSTANCE_COMPONENT_ID,\n {\n [AI_INSTANCE_REF_PROP]: declared.id,\n ...(Object.keys(values).length ? { propValues: values } : {}),\n },\n null,\n null,\n 'instance',\n )\n}\n\nfunction textProps(props: Record<string, string>): string[] {\n return Object.entries(props)\n .filter(([, type]) => type === 'text' || type === 'richText')\n .map(([name]) => name)\n}\n\n/** An item's words as the props of the component that draws it. */\nfunction instanceValues(\n props: Record<string, string>,\n item: AiLayoutItem,\n facts: string,\n language?: string,\n): Record<string, unknown> {\n const texts = textProps(props)\n const titleProp =\n texts.find((name) =>\n /title|name|heading|label|question|figure|value/i.test(name),\n ) ?? texts[0]\n const textProp =\n texts.find(\n (name) =>\n name !== titleProp &&\n /text|description|body|summary|copy|answer|detail|caption/i.test(name),\n ) ?? texts.find((name) => name !== titleProp)\n const values: Record<string, unknown> = {}\n if (titleProp && item.title.trim())\n values[titleProp] = aiLayoutWords(item.title, 'itemTitle', facts, language)\n if (textProp && item.text.trim())\n values[textProp] = aiLayoutWords(item.text, 'itemText', facts, language)\n const first = titleProp ?? textProp\n if (!Object.values(values).some(Boolean) && first)\n values[first] = aiLayoutWords(item.title || item.text, 'itemTitle', facts, language)\n return values\n}\n\n// ── Groups ────────────────────────────────────────────────────────────────\n\n/** Records the elements that draw a section's repeated items, and hands them back. */\nfunction noted<T extends readonly string[]>(scope: SectionScope, ids: T): T {\n if (!scope.frame) scope.page.itemIds[scope.index]?.push(...ids)\n return ids\n}\n\n/** How many items sit side by side in a room. */\nfunction across(\n count: number,\n room: Room,\n kind: AiLayoutBlock['kind'],\n): number {\n if (room === 'narrow') return 1\n if (room === 'half') return count >= 2 && kind === 'stats' ? 2 : 1\n if (count <= 3) return count\n if (count === 4) return 4\n if (count === 7) return 4\n return 3\n}\n\nfunction itemSize(perRow: number): string {\n if (perRow === 2) return 'xs:12 sm:6'\n if (perRow === 3) return 'xs:12 md:4'\n return 'xs:12 sm:6 md:3'\n}\n\n/** Items laid out side by side as a Grid of sized items, or stacked where they sit one to a row. */\nfunction layOut(\n scope: SectionScope,\n items: readonly string[],\n perRow: number,\n spacing: string,\n role: string,\n): string {\n const tree = scope.page.tree\n if (items.length === 1) return items[0]\n if (perRow <= 1) {\n return tree.add('muiStack', { spacing }, null, items, role)\n }\n const size = itemSize(perRow)\n const cells = items.map((id) =>\n tree.add('muiGrid', { size }, null, [id], 'cell'),\n )\n return tree.add('muiGrid', { container: true, spacing }, null, cells, role)\n}\n\n/**\n * Whether repeats must be components here (rule 1): the workspace keeps\n * them. Rule 1 counts like blocks across the whole page, so where it holds\n * every group the plan places no component for is drawn compact, however\n * few its items — two sections of two cards are four like cards.\n */\nfunction rule1(scope: SectionScope): boolean {\n return scope.page.options.reusableComponents\n}\n\n/** The most pictures this page carries: two where rule 1 counts three like frames as a repeat. */\nfunction maxImages(page: PageScope): number {\n return page.options.reusableComponents ? 2 : AI_LAYOUT_MAX_IMAGES\n}\n\n/**\n * The items a group may still show in its section (rule 8): seven like items\n * a section, across all its groups, since eight are a list typed by hand.\n */\n/** Whether an item has words left once they are cleaned and fitted: an item with none is no item. */\nfunction speaks(scope: SectionScope, item: AiLayoutItem): boolean {\n const facts = scope.page.targets.facts\n return !!(\n aiLayoutWords(item.title, 'itemTitle', facts, scope.page.options.language) ||\n aiLayoutWords(item.text, 'itemText', facts, scope.page.options.language)\n )\n}\n\n/** A group's items with every part that has no words left once cleaned emptied, and wordless items left out. */\n/** A title that only names the kind of thing it is: \"Card\", \"Item 2\", \"Title\". */\nconst AI_LAYOUT_PLACEHOLDER_TITLE = /^(?:card|item|title|heading|placeholder|tile|box|feature|service|post|article|entry)\\s*\\d*$/i\n\nfunction cleanItems(\n scope: SectionScope,\n items: readonly AiLayoutItem[],\n): AiLayoutItem[] {\n const facts = scope.page.targets.facts\n // A title that is only the name or id of what places it — a \"Card\" item of\n // the Card component (AGL-3660) — is no words a visitor reads.\n const references = new Set(\n scope.page.targets.components.flatMap((component) => [component.name, component.id]).map((name) => name.trim().toLowerCase()),\n )\n return items\n .map((item) => ({\n ...item,\n title:\n aiLayoutWords(item.title, 'itemTitle', facts, scope.page.options.language) &&\n !references.has(item.title.trim().toLowerCase()) &&\n !AI_LAYOUT_PLACEHOLDER_TITLE.test(item.title.trim())\n ? item.title\n : '',\n text: aiLayoutWords(item.text, 'itemText', facts, scope.page.options.language) ? item.text : '',\n }))\n .filter((item) => speaks(scope, item))\n}\n\nfunction takeItems<T>(scope: SectionScope, items: readonly T[]): T[] {\n const kept = items.slice(0, Math.max(0, scope.itemsLeft))\n if (kept.length < items.length) {\n scope.page.settled.push({\n at: scope.at,\n what: `${items.length - kept.length} items past the section's ${AI_LAYOUT_MAX_ITEMS}; left out`,\n })\n }\n scope.itemsLeft -= kept.length\n return kept\n}\n\n/** `takeItems` on a list it shortens where it stands. */\nfunction takeItemsInPlace<T>(scope: SectionScope, items: T[]): void {\n const kept = takeItems(scope, items)\n items.length = kept.length\n}\n\nfunction group(\n scope: SectionScope,\n block: AiLayoutBlock,\n room: Room,\n): string | null {\n if (scope.page.options.verbatim) return importedGroup(scope, block, room)\n const items = takeItems(scope, cleanItems(scope, block.items ?? []))\n if (!items.length) return null\n const perRow = across(items.length, room, block.kind)\n const placed = componentOf(scope.page.targets, block.to)\n if (placed) return instances(scope, placed, items, perRow)\n const design = scope.page.design\n const retail = !!design && aiLayoutFamily(design.input.kind) === 'retail'\n // A store's making, shown: its steps as pictures over their words (AGL-3676),\n // where the page has the pictures for them.\n if (retail && block.kind === 'steps' && room === 'full' && items.length >= 2 && items.length <= 4 && picturesLeft(scope.page) >= items.length) {\n const drawn = designedGroup(scope, 'articles', items, room)\n if (drawn) return drawn\n }\n if (rule1(scope)) {\n // Picture cards the design draws are the compiler's, not a block typed out\n // by hand (`repeatsCompiled`, AGL-3660), and so are a storefront's icon\n // columns (AGL-3676): the beta.237 Willow Wick home, on a paid plan, drew\n // every other group compact — four bands of a title and a sentence.\n const variant = design && block.kind === 'cards' && block.style !== 'quiet' ? aiLayoutGroupVariant(design.input, design.choices, scope.words ?? '') : null\n // Icon columns side by side, where rule 1 knows them by their cells; any\n // site's groups may take them (AGL-3899), and one to a row outside a\n // store they are drawn compact.\n if (variant === 'icons' && (retail || perRow > 1)) return iconColumns(scope, items, room)\n const pictured = (variant === 'pictures' || variant === 'articles') && room === 'full' && picturesLeft(scope.page) >= items.length\n return (pictured && designedGroup(scope, variant, items, room)) || compactGroup(scope, block, items, perRow)\n }\n if (design && block.kind === 'steps' && (design.choices.steps === 'timeline' || room !== 'full')) {\n return timeline(scope, items)\n }\n if (design && block.kind === 'cards' && block.style !== 'quiet') {\n const variant = scope.groupStyle ?? aiLayoutGroupVariant(design.input, design.choices, scope.words ?? '')\n const drawn = designedGroup(scope, variant, items, room)\n if (drawn) return drawn\n }\n switch (block.kind) {\n case 'steps':\n return layOut(\n scope,\n noted(scope, items.map((item, position) => step(scope, item, position))),\n perRow,\n '4',\n 'steps',\n )\n case 'stats':\n return layOut(\n scope,\n noted(scope, items.map((item) => stat(scope, item))),\n perRow,\n '4',\n 'stats',\n )\n case 'quotes':\n return layOut(\n scope,\n noted(scope, items.map((item) => quote(scope, item))),\n perRow,\n '3',\n 'quotes',\n )\n default:\n return layOut(\n scope,\n noted(scope, items.map((item) => card(scope, block, item))),\n perRow,\n '3',\n 'cards',\n )\n }\n}\n\nfunction instances(\n scope: SectionScope,\n placed: { id: string; props: Record<string, string> },\n items: readonly AiLayoutItem[],\n perRow: number,\n): string {\n const tree = scope.page.tree\n const ids = items.map((item) => {\n const values = instanceValues(placed.props, item, scope.page.targets.facts, scope.page.options.language)\n return tree.add(\n REUSABLE_INSTANCE_COMPONENT_ID,\n {\n [AI_INSTANCE_REF_PROP]: placed.id,\n ...(Object.keys(values).length ? { propValues: values } : {}),\n },\n null,\n null,\n 'instance',\n )\n })\n return layOut(scope, noted(scope, ids), perRow, '3', 'instances')\n}\n\n/**\n * A group in its compact form, a title over its text: two elements an item,\n * under the three a block must have before rule 1 asks for a component.\n */\nfunction compactGroup(\n scope: SectionScope,\n block: AiLayoutBlock,\n items: readonly AiLayoutItem[],\n perRow: number,\n): string {\n const tree = scope.page.tree\n const facts = scope.page.targets.facts\n const pairs = items.map((item, position) => {\n const title =\n block.kind === 'quotes'\n ? aiLayoutQuoteGap(item.text || item.title, scope.page.options.language)\n : block.kind === 'stats'\n ? aiLayoutWords(item.title, 'stat', facts, scope.page.options.language)\n : `${block.kind === 'steps' ? `${position + 1}. ` : ''}${aiLayoutWords(item.title, 'itemTitle', facts, scope.page.options.language)}`\n const text =\n block.kind === 'quotes'\n ? '[Customer name]'\n : aiLayoutWords(\n item.text,\n block.kind === 'stats' ? 'statLabel' : 'itemText',\n facts,\n scope.page.options.language,\n )\n return tree.add(\n 'muiListItemText',\n { primary: title, ...(text ? { secondary: text, ...mutedSecondary(scope) } : {}) },\n null,\n null,\n 'pair',\n )\n })\n return layOut(scope, noted(scope, pairs), perRow, '3', 'compact')\n}\n\n/** A card: an optional icon, its title one level under the section's heading, and its words. */\nfunction card(\n scope: SectionScope,\n block: AiLayoutBlock,\n item: AiLayoutItem,\n): string {\n const tree = scope.page.tree\n const facts = scope.page.targets.facts\n const icon = aiIconOfWord(item.icon) ?? aiIconOfWord(block.icon)\n // A quiet card draws no surface of its own, so it is colored as the band it sits on.\n const quiet = block.style === 'quiet'\n const children = [\n icon\n ? tree.add(\n AI_ICON_COMPONENT_ID,\n { iconId: icon.id, size: '32' },\n quiet ? accent(scope) : { color: 'primary.main' },\n null,\n 'icon',\n )\n : null,\n item.title.trim()\n ? tree.add(\n 'muiTypography',\n {\n children: aiLayoutWords(item.title, 'itemTitle', facts, scope.page.options.language),\n variant: 'h5',\n component: itemElement(scope),\n },\n null,\n null,\n 'title',\n )\n : null,\n item.text.trim()\n ? tree.add(\n 'muiTypography',\n {\n children: aiLayoutWords(item.text, 'itemText', facts, scope.page.options.language),\n variant: 'body1',\n },\n quiet ? muted(scope) : { color: 'text.secondary' },\n null,\n 'text',\n )\n : null,\n ]\n const stack = tree.add(\n 'muiStack',\n { spacing: '1.5' },\n null,\n children,\n 'cardStack',\n )\n if (quiet) return stack\n const content = tree.add(\n 'muiCardContent',\n null,\n { p: 3 },\n [stack],\n 'cardContent',\n )\n // Flat, outlined, raised, tinted or ruled is the site theme's card style\n // (AGL-3660), never a choice stamped on this card.\n return tree.add('muiCard', null, { height: '100%' }, [content], 'card')\n}\n\n/** A numbered step: its number in the brand color, its title and its words. */\nfunction step(\n scope: SectionScope,\n item: AiLayoutItem,\n position: number,\n): string {\n const tree = scope.page.tree\n const facts = scope.page.targets.facts\n return tree.add(\n 'muiStack',\n { spacing: '1' },\n null,\n [\n tree.add(\n 'muiTypography',\n {\n children: String(position + 1).padStart(2, '0'),\n variant: 'h3',\n component: 'p',\n },\n accent(scope),\n null,\n 'number',\n ),\n item.title.trim()\n ? tree.add(\n 'muiTypography',\n {\n children: aiLayoutWords(item.title, 'itemTitle', facts, scope.page.options.language),\n variant: 'h5',\n component: itemElement(scope),\n },\n null,\n null,\n 'title',\n )\n : null,\n item.text.trim()\n ? tree.add(\n 'muiTypography',\n {\n children: aiLayoutWords(item.text, 'itemText', facts, scope.page.options.language),\n variant: 'body1',\n },\n muted(scope),\n null,\n 'text',\n )\n : null,\n ],\n 'step',\n )\n}\n\n/** A figure and its label. A figure the brief did not give is the model's bracketed gap. */\nfunction stat(scope: SectionScope, item: AiLayoutItem): string {\n const tree = scope.page.tree\n const facts = scope.page.targets.facts\n return tree.add(\n 'muiStack',\n { spacing: '0.5', ...(scope.centered ? { alignItems: 'center' } : {}) },\n null,\n [\n tree.add(\n 'muiTypography',\n {\n children: aiLayoutWords(item.title, 'stat', facts, scope.page.options.language) || '[figure]',\n variant: 'h2',\n component: 'p',\n ...align(scope),\n },\n accent(scope),\n null,\n 'figure',\n ),\n item.text.trim()\n ? tree.add(\n 'muiTypography',\n {\n children: aiLayoutWords(item.text, 'statLabel', facts, scope.page.options.language),\n variant: 'body2',\n ...align(scope),\n },\n muted(scope),\n null,\n 'label',\n )\n : null,\n ],\n 'stat',\n )\n}\n\n/** A quote slot: what a customer should be quoted saying, as the gap the owner fills. */\nfunction quote(scope: SectionScope, item: AiLayoutItem): string {\n const tree = scope.page.tree\n const words = aiLayoutQuoteGap(item.text || item.title, scope.page.options.language)\n const who =\n item.text && item.title ? aiLayoutFitText(item.title, 'statLabel', scope.page.options.language) : ''\n const stack = tree.add(\n 'muiStack',\n { spacing: '2' },\n null,\n [\n tree.add(\n AI_ICON_COMPONENT_ID,\n { iconId: AI_ICON_LIBRARY.quote.id, size: '32' },\n { color: 'primary.main' },\n null,\n 'quoteMark',\n ),\n tree.add(\n 'muiTypography',\n { children: words, variant: 'body1' },\n null,\n null,\n 'quote',\n ),\n tree.add(\n 'muiTypography',\n {\n children:\n aiLayoutFitText(\n who ? `[Customer name], ${who.replace(/^\\[|\\]$/g, '')}` : '',\n 'note',\n scope.page.options.language,\n ) || '[Customer name]',\n variant: 'subtitle2',\n component: 'p',\n },\n null,\n null,\n 'attribution',\n ),\n ],\n 'quoteStack',\n )\n const content = tree.add(\n 'muiCardContent',\n null,\n { p: 3 },\n [stack],\n 'quoteContent',\n )\n return tree.add('muiCard', null, { height: '100%' }, [content], 'quoteCard')\n}\n\n/** A list: check-marked lines, or plain lines where rule 1 holds and the list is long. */\nfunction list(scope: SectionScope, block: AiLayoutBlock, room: Room = 'full'): string | null {\n if (scope.page.options.verbatim) return importedList(scope, block, room)\n const tree = scope.page.tree\n const facts = scope.page.targets.facts\n // A list whose lines go somewhere is a list of links: each line that\n // resolves is a Page Link, and one that does not is left out (rule 10).\n if ((block.items ?? []).some((item) => item.to)) {\n const links = (block.items ?? []).flatMap((item) => {\n const label =\n aiLayoutContactLabel(item.title || item.text, scope.page.targets.contact) ||\n aiLayoutFitText(item.title || item.text, 'label', scope.page.options.language)\n const destination = label\n ? aiLayoutResolveLink(item.to, label, scope.link, scope.page.targets)\n : null\n if (!destination) return []\n const id = tree.add(\n 'muiScreenLink',\n {\n children: label,\n renderAs: 'link',\n color: 'inherit',\n ...destinationProps(destination),\n },\n null,\n null,\n 'link',\n )\n linkTo(scope, id, destination)\n return [id]\n })\n return links.length\n ? tree.add('muiStack', { spacing: '1' }, null, noted(scope, links), 'links')\n : null\n }\n const lines = cleanItems(scope, block.items ?? [])\n .map((item) =>\n aiLayoutWords(\n [item.title, item.text].filter((part) => part.trim()).join(' — '),\n 'listItem',\n facts,\n scope.page.options.language,\n ),\n )\n .filter(Boolean)\n takeItemsInPlace(scope, lines)\n if (!lines.length) return null\n if (rule1(scope)) {\n const rows = lines.map((line) =>\n tree.add(\n 'muiListItem',\n { disableGutters: true },\n null,\n [tree.add('muiListItemText', { primary: line }, null, null, 'line')],\n 'row',\n ),\n )\n return tree.add('muiList', { disablePadding: true }, null, noted(scope, rows), 'list')\n }\n const check = aiIconOfWord(block.icon) ?? AI_ICON_LIBRARY.check\n const rows = lines.map((line) =>\n tree.add(\n 'muiStack',\n { direction: 'row', spacing: '1.5', alignItems: 'flex-start' },\n null,\n [\n tree.add(\n AI_ICON_COMPONENT_ID,\n { iconId: check.id, size: '22' },\n accent(scope),\n null,\n 'check',\n ),\n tree.add(\n 'muiTypography',\n { children: line, variant: 'body1' },\n null,\n null,\n 'line',\n ),\n ],\n 'row',\n ),\n )\n return tree.add('muiStack', { spacing: '1.5' }, null, noted(scope, rows), 'list')\n}\n\n/** Questions and answers: an accordion each, or question-over-answer pairs where rule 1 holds. */\nfunction faq(scope: SectionScope, block: AiLayoutBlock): string | null {\n if (scope.page.options.verbatim) return importedFaq(scope, block)\n const tree = scope.page.tree\n const facts = scope.page.targets.facts\n const items = takeItems(\n scope,\n cleanItems(scope, block.items ?? []).filter(\n (item) => !!aiLayoutWords(item.title, 'question', facts, scope.page.options.language),\n ),\n )\n if (!items.length) return null\n if (rule1(scope)) {\n const rows = items.map((item) =>\n tree.add(\n 'muiListItem',\n { disableGutters: true, divider: true },\n null,\n [\n tree.add(\n 'muiListItemText',\n {\n primary: aiLayoutWords(item.title, 'question', facts, scope.page.options.language),\n ...(item.text.trim()\n ? {\n secondary: aiLayoutWords(item.text, 'answer', facts, scope.page.options.language),\n ...mutedSecondary(scope),\n }\n : {}),\n },\n null,\n null,\n 'qa',\n ),\n ],\n 'row',\n ),\n )\n return tree.add('muiList', { disablePadding: true }, null, noted(scope, rows), 'faq')\n }\n const panels = items.map((item, position) =>\n tree.add(\n 'muiAccordion',\n {\n disableGutters: true,\n ...(position === 0 ? { defaultExpanded: true } : {}),\n },\n null,\n [\n tree.add(\n 'muiAccordionSummary',\n { children: aiLayoutWords(item.title, 'question', facts, scope.page.options.language) },\n null,\n null,\n 'question',\n ),\n item.text.trim()\n ? tree.add(\n 'muiAccordionDetails',\n null,\n null,\n [\n tree.add(\n 'muiTypography',\n {\n children: aiLayoutWords(item.text, 'answer', facts, scope.page.options.language),\n variant: 'body1',\n },\n { color: 'text.secondary' },\n null,\n 'answer',\n ),\n ],\n 'details',\n )\n : null,\n ],\n 'panel',\n ),\n )\n return tree.add('muiStack', { spacing: '1.5' }, null, noted(scope, panels), 'faq')\n}\n\n// ── The designer layer (AGL-3660) ─────────────────────────────────────────\n//\n// What `ai-layout-design.ts` chose for the site, drawn: the hero, a section\n// of words beside a picture, a closing band over a photo, a heading beside\n// its items, and groups drawn as pictures, articles, a menu or open ruled\n// columns. Every variant is built from the same palette elements and theme\n// tokens as the rest of the compiler, so the doctrine holds by construction.\n\n/** The most pictures a designed page carries, the model's and the stand-ins together. */\nexport const AI_LAYOUT_MAX_DESIGN_PICTURES = 8\n\n/** The block kinds a section of words holds. */\nconst WORD_KINDS: ReadonlySet<AiLayoutBlock['kind']> = new Set(['eyebrow', 'heading', 'lede', 'text', 'note', 'button'])\n\n/** How many more pictures the page has room for. */\nfunction picturesLeft(page: PageScope): number {\n return AI_LAYOUT_MAX_DESIGN_PICTURES - page.images - page.pictures\n}\n\n/** Whether a heading block has words left once fitted: one with none is no heading. */\nfunction speaksHeading(scope: SectionScope, block: AiLayoutBlock): boolean {\n return block.kind === 'heading' && !!say(scope, block.text, 'heading')\n}\n\n/** The section root every designed section is written under, as `compileSection` writes its own. */\nfunction designedRoot(\n scope: SectionScope,\n children: readonly string[],\n sx: Record<string, unknown> | null,\n dark: boolean,\n): string {\n const { page, index } = scope\n const name = page.plan.sections[index]?.name?.trim() || `Section ${index + 1}`\n return page.tree.add(\n 'section',\n {\n element: 'section',\n ariaLabel: sectionLabel(name, index, page.options.language),\n ...(dark ? { colorScheme: 'dark' } : {}),\n // A photo cover that opens the page runs up under the header, which sits over it.\n ...(index === 0 && scope.overPhoto ? { underHeader: true } : {}),\n },\n sx,\n children,\n 'section',\n page.options.sectionIds?.[index] ?? sectionIdOf(index),\n )\n}\n\n/** A picture a design places: what it shows, whether anyone described it, and the source's own copy on a page brought in (AGL-4107). */\ninterface DesignedPicture {\n alt: string\n given: boolean\n src?: string\n}\n\n/**\n * A picture the design places: the model's own where it described one, else\n * a stand-in — marked decorative, since no one described it, with the\n * section's words as what a stock search looks for. Either is filled by\n * `ai-layout-pictures.ts` after the page is checked, as any slot is.\n */\nfunction designPicture(\n scope: SectionScope,\n picture: DesignedPicture,\n frameSx: Record<string, unknown>,\n role = 'designFrame',\n imageSx: Record<string, unknown> = {},\n): string {\n const tree = scope.page.tree\n // The picture fills its frame by its own size props, so the frame alone\n // carries a style: a page of many pictures repeats no inline style (rule 16).\n const image = designImage(scope, picture, { width: '100%', height: '100%' }, Object.keys(imageSx).length ? imageSx : null)\n return tree.add('muiBox', null, { position: 'relative', overflow: 'hidden', bgcolor: 'action.hover', ...frameSx }, [image], role)\n}\n\n/**\n * The `image` a designed picture is: its alt, its fit and, for a stand-in,\n * decorative. Its slot is filled after the page is checked.\n */\nfunction designImage(\n scope: SectionScope,\n picture: DesignedPicture,\n props: Record<string, unknown>,\n sx: Record<string, unknown> | null,\n): string {\n const { page } = scope\n if (picture.given) page.images += 1\n else page.pictures += 1\n // A page brought in places the source's own picture (AGL-4107), described as\n // the source described it, and decorative where it was not described.\n const described = picture.alt ? { alt: picture.alt } : { decorative: true }\n return page.tree.add(\n 'image',\n picture.src\n ? { src: picture.src, ...described, objectFit: 'cover', ...(page.images > 1 ? { loading: 'lazy' } : {}), ...props }\n : { alt: picture.alt, objectFit: 'cover', ...(picture.given ? {} : { decorative: true }), ...props },\n sx,\n null,\n 'image',\n )\n}\n\n/** What a stand-in picture is of, for a stock search: the section's subject, else the site's. */\nfunction standInAlt(scope: SectionScope, words?: string): string {\n return (\n aiLayoutFitText(words, 'alt', scope.page.options.language) ||\n aiLayoutFitText(scope.heading, 'alt', scope.page.options.language) ||\n aiLayoutFitText(scope.page.plan.sections[scope.index]?.name, 'alt', scope.page.options.language) ||\n aiLayoutFitText(scope.page.plan.title, 'alt', scope.page.options.language) ||\n 'A photo'\n )\n}\n\n/** A grid row of sized cells, as `compileRow` writes one, from ids already compiled. */\nfunction designRow(\n scope: SectionScope,\n cells: ReadonlyArray<{ id: string; size: string; sx?: Record<string, unknown> }>,\n spacing: string,\n alignItems = 'center',\n): string {\n const tree = scope.page.tree\n return tree.add(\n 'muiGrid',\n { container: true, spacing },\n { alignItems },\n cells.map((cell) => tree.add('muiGrid', { size: cell.size }, cell.sx ?? null, [cell.id], 'column')),\n 'row',\n )\n}\n\n/** A section's own arrangement where the design has one; `null` to draw it the compiler's first way. */\nfunction designSection(scope: SectionScope, raw: AiLayoutSection, blocks: readonly AiLayoutBlock[]): string | null {\n const { page, index } = scope\n const design = page.design\n if (!design) return null\n const images = blocks.filter((block) => block.kind === 'image')\n const words = blocks.filter((block) => block.kind !== 'image')\n const ofWords = words.length > 0 && words.every((block) => WORD_KINDS.has(block.kind))\n if (index === 0) {\n if (!ofWords || images.length > 1 || picturesLeft(page) < 1) return null\n const flow = [...words]\n if (!flow.some((block) => speaksHeading(scope, block))) {\n flow.unshift({ kind: 'heading', text: page.plan.title })\n page.settled.push({ at: scope.at, what: \"no heading; the page's title written as its h1\" })\n }\n // A designed hero's title is display-sized; beside a photo, in half the\n // page, it is the page's title size, so a long one still reads in a few lines.\n const lead = flow.findIndex((block) => speaksHeading(scope, block))\n const { style: _style, ...title } = flow[lead]\n flow[lead] = AI_LAYOUT_HALF_HEROES.has(design.choices.hero) ? title : { ...title, style: 'large' }\n sellingHero(scope, flow)\n const given = images[0] ? aiLayoutFitText(images[0].text, 'alt', scope.page.options.language) : ''\n return hero(\n scope,\n flow,\n given ? { alt: given, given: true } : { alt: standInAlt(scope, words.find((block) => speaksHeading(scope, block))?.text), given: false },\n )\n }\n if (ofWords && !images.length && words.some((block) => speaksHeading(scope, block))) {\n const last = index === page.plan.sections.length - 1\n const asks = words.some((block) => block.kind === 'button')\n const strong = scope.band === 'brand' || scope.band === 'dark'\n const told = words.some((block) => block.kind === 'text' || block.kind === 'lede')\n if (last && asks && (strong || scope.centered) && design.choices.coverClose && picturesLeft(page) >= 1) {\n return coverBand(scope, words)\n }\n if (design.choices.features && told && page.features < 2 && picturesLeft(page) >= 1 && !(last && asks && strong)) {\n return feature(scope, words)\n }\n return null\n }\n // A heading over one group of items: the heading beside them.\n if (!design.choices.splitHeads || images.length || page.splitAt === index - 1) return null\n const at = words.findIndex((block) => block.kind === 'cards' || block.kind === 'steps')\n if (at <= 0) return null\n const head = words.slice(0, at)\n const group = words[at]\n const tail = words.slice(at + 1)\n const variant = aiLayoutGroupVariant(design.input, design.choices, scope.words ?? '')\n if (\n !head.every((block) => WORD_KINDS.has(block.kind) && block.kind !== 'button') ||\n !head.some((block) => speaksHeading(scope, block)) ||\n !tail.every((block) => WORD_KINDS.has(block.kind)) ||\n (group.items?.length ?? 0) < 2 ||\n (group.items?.length ?? 0) > 6 ||\n group.to ||\n (group.kind === 'cards' && variant !== 'cards' && variant !== 'ruled') ||\n // A store's making is shown as pictures across the page (AGL-3676), never\n // ruled words in half of it: set beside its heading, a seed that splits\n // headings left a storefront's \"how it is made\" a band of text (AGL-3985).\n (group.kind === 'steps' && aiLayoutFamily(design.input.kind) === 'retail')\n ) {\n return null\n }\n return splitSection(scope, head, group, tail)\n}\n\n/** The first section, in the site's hero arrangement. */\nfunction hero(\n scope: SectionScope,\n flow: readonly AiLayoutBlock[],\n picture: DesignedPicture,\n /** The hero a page brought in opens as (AGL-4107), over the site's own. */\n asked?: AiLayoutHeroVariant,\n): string {\n const { page } = scope\n const tree = page.tree\n const design = page.design as NonNullable<PageScope['design']>\n const home = design.input.home\n // A collage holds two pictures: on a page with room for one, it is drawn\n // split, and so it is on a page brought in, which shows only its own.\n const chosen: AiLayoutHeroVariant = asked ?? design.choices.hero\n const variant: AiLayoutHeroVariant = chosen === 'collage' && (picturesLeft(page) < 2 || page.options.verbatim) ? 'split' : chosen\n page.settled.push({ at: scope.at, what: `drawn as a ${variant} hero` })\n if (variant === 'cover' || variant === 'poster') {\n scope.band = 'dark'\n // A cover sets its words at the start of the page; a poster centers them,\n // taller, as a restaurant's or a band's opening does (AGL-3985).\n scope.centered = variant === 'poster'\n const tall = variant === 'poster'\n return cover(\n scope,\n flow,\n picture,\n home ? (tall ? { xs: '84vh', md: '94vh' } : { xs: '78vh', md: '86vh' }) : tall ? { xs: '52vh', md: '62vh' } : { xs: '46vh', md: '54vh' },\n )\n }\n if (variant === 'bleed') return bleedHero(scope, flow, picture, home)\n if (variant === 'column') return columnHero(scope, flow, picture, home)\n if (variant === 'collage') return collageHero(scope, flow, picture, home)\n if (variant === 'panel') return panelHero(scope, flow, picture, home)\n if (variant === 'portrait') return portraitHero(scope, flow, picture)\n const band = scope.band\n scope.centered = false\n if (variant === 'split') {\n const words = compileFlow(scope, flow, 'half') as string\n const photo = designPicture(scope, picture, {\n aspectRatio: home ? { xs: '4 / 3', md: '4 / 5' } : { xs: '4 / 3', md: '1 / 1' },\n borderRadius: 2,\n })\n const right = design.choices.featureLeft\n const row = designRow(\n scope,\n [\n { id: words, size: 'xs:12 md:6', ...(right ? { sx: { order: { xs: 0, md: 1 } } } : {}) },\n { id: photo, size: 'xs:12 md:6' },\n ],\n '8',\n )\n const container = tree.add('muiContainer', { maxWidth: 'lg' }, { py: { xs: 6, md: 10 } }, [row], 'container')\n return designedRoot(scope, [container], bandSx(band), band === 'dark')\n }\n // Editorial: display type across the page, the rest in a row under it, a wide photo below.\n const top = flow.filter((block) => block.kind === 'eyebrow' || block.kind === 'heading')\n const rest = flow.filter((block) => block.kind !== 'eyebrow' && block.kind !== 'heading')\n const lede = rest.filter((block) => block.kind !== 'button')\n const actions = rest.filter((block) => block.kind === 'button')\n const headId = compileFlow(scope, top, 'full')\n const ledeId = compileFlow(scope, lede, 'half')\n const actionsId = compileFlow(scope, actions, 'half')\n const under =\n ledeId && actionsId\n ? designRow(\n scope,\n [\n { id: ledeId, size: 'xs:12 md:7' },\n { id: actionsId, size: 'xs:12 md:5', sx: { display: 'flex', justifyContent: { xs: 'flex-start', md: 'flex-end' } } },\n ],\n '4',\n 'flex-end',\n )\n : (ledeId ?? actionsId)\n const photo = designPicture(scope, picture, {\n aspectRatio: home ? { xs: '4 / 3', md: '21 / 9' } : { xs: '16 / 9', md: '3 / 1' },\n borderRadius: 2,\n })\n const stack = tree.add('muiStack', { spacing: '6', useFlexGap: true }, null, [headId, under, photo], 'content')\n const container = tree.add('muiContainer', { maxWidth: 'lg' }, { pt: { xs: 8, md: 12 }, pb: { xs: 6, md: 10 } }, [stack], 'container')\n return designedRoot(scope, [container], bandSx(band), band === 'dark')\n}\n\n/** Words over a full-bleed photo, on a scrim that keeps them readable, in the site's dark scheme. */\nfunction cover(\n scope: SectionScope,\n flow: readonly AiLayoutBlock[],\n picture: DesignedPicture,\n minHeight: Record<string, string>,\n): string {\n const tree = scope.page.tree\n // The photo dimmed over black: the scrim that keeps the words over it readable.\n const photo = designPicture(\n scope,\n picture,\n { position: 'absolute', top: 0, left: 0, width: '100%', height: '100%', bgcolor: 'common.black' },\n 'coverPhoto',\n { opacity: 0.42 },\n )\n scope.overPhoto = true\n const words = compileFlow(scope, flow, 'full') as string\n const measure = tree.add(\n 'muiBox',\n null,\n scope.centered ? { maxWidth: { xs: '100%', md: '75%' }, mx: 'auto' } : { maxWidth: { xs: '100%', md: '62%' } },\n [words],\n 'measure',\n )\n const container = tree.add(\n 'muiContainer',\n { maxWidth: 'lg' },\n { position: 'relative', zIndex: 1, py: { xs: 10, md: 14 } },\n [measure],\n 'container',\n )\n return designedRoot(\n scope,\n [photo, container],\n { position: 'relative', overflow: 'hidden', display: 'flex', alignItems: { xs: 'flex-end', md: 'center' }, minHeight },\n true,\n )\n}\n\n/** The surface a band paints, as a palette role: what a picture laid over another is edged in. */\nfunction bandSurface(band: AiLayoutBand): string {\n if (band === 'soft') return 'background.paper'\n if (band === 'brand') return 'primary.main'\n return 'background.default'\n}\n\n/**\n * A bleed hero (AGL-3985): the band in two halves, a photo filling one of\n * them edge to edge, top to bottom, and the words in the other, centered in\n * its height. On a phone the photo sits over the words.\n */\nfunction bleedHero(scope: SectionScope, flow: readonly AiLayoutBlock[], picture: DesignedPicture, home: boolean): string {\n const { page } = scope\n const tree = page.tree\n const design = page.design as NonNullable<PageScope['design']>\n const band = scope.band\n scope.centered = false\n const words = compileFlow(scope, flow, 'half') as string\n const measure = tree.add('muiBox', null, { maxWidth: { xs: '100%', md: '88%' }, px: { xs: 3, sm: 6, md: 8 }, py: { xs: 6, md: 10 } }, [words], 'measure')\n const photo = designPicture(scope, picture, { height: '100%', minHeight: home ? { xs: '46vh', md: '84vh' } : { xs: '36vh', md: '56vh' } }, 'bleedPhoto')\n const right = design.choices.featureLeft\n const row = tree.add(\n 'muiGrid',\n { container: true, spacing: '0' },\n { alignItems: 'stretch' },\n [\n tree.add('muiGrid', { size: 'xs:12 md:6' }, right ? { order: { xs: 0, md: 1 } } : null, [photo], 'column'),\n tree.add('muiGrid', { size: 'xs:12 md:6' }, { display: 'flex', alignItems: 'center', justifyContent: right ? 'flex-end' : 'flex-start' }, [measure], 'column'),\n ],\n 'row',\n )\n return designedRoot(scope, [row], bandSx(band), band === 'dark')\n}\n\n/**\n * A masthead (AGL-3985): the words centered in a narrow column, as a journal\n * or a quiet practice opens, and a wide photo under them.\n */\nfunction columnHero(scope: SectionScope, flow: readonly AiLayoutBlock[], picture: DesignedPicture, home: boolean): string {\n const tree = scope.page.tree\n const band = scope.band\n scope.centered = true\n const words = compileFlow(scope, flow, 'full') as string\n const measure = tree.add('muiBox', null, { maxWidth: { xs: '100%', md: '72%' }, mx: 'auto' }, [words], 'measure')\n const photo = designPicture(scope, picture, {\n aspectRatio: home ? { xs: '4 / 3', md: '16 / 7' } : { xs: '16 / 9', md: '3 / 1' },\n borderRadius: 2,\n })\n const stack = tree.add('muiStack', { spacing: '8', useFlexGap: true }, null, [measure, photo], 'content')\n const container = tree.add('muiContainer', { maxWidth: 'lg' }, { pt: { xs: 8, md: 12 }, pb: { xs: 6, md: 10 } }, [stack], 'container')\n return designedRoot(scope, [container], bandSx(band), band === 'dark')\n}\n\n/**\n * A collage hero (AGL-3985): the words beside two pictures, a tall one and a\n * smaller one laid over its lower corner, edged in the band's own surface, as\n * a shop shows two of its things or an event two moments of its day.\n */\nfunction collageHero(scope: SectionScope, flow: readonly AiLayoutBlock[], picture: DesignedPicture, home: boolean): string {\n const { page } = scope\n const tree = page.tree\n const design = page.design as NonNullable<PageScope['design']>\n const band = scope.band\n scope.centered = false\n const words = compileFlow(scope, flow, 'half') as string\n const tall = designPicture(scope, picture, { width: { xs: '78%', md: '76%' }, aspectRatio: home ? '4 / 5' : '1 / 1', borderRadius: 2 })\n const small = designPicture(\n scope,\n { alt: standInAlt(scope, page.plan.sections[scope.index]?.name), given: false },\n {\n position: 'absolute',\n right: 0,\n bottom: 0,\n width: { xs: '48%', md: '50%' },\n aspectRatio: '1 / 1',\n borderRadius: 2,\n border: 6,\n borderColor: bandSurface(band),\n },\n 'collagePhoto',\n )\n const pictures = tree.add('muiBox', null, { position: 'relative', pb: { xs: 6, md: 10 } }, [tall, small], 'collage')\n const right = design.choices.featureLeft\n const row = designRow(\n scope,\n [\n { id: words, size: 'xs:12 md:5', ...(right ? { sx: { order: { xs: 0, md: 1 } } } : {}) },\n { id: pictures, size: 'xs:12 md:7' },\n ],\n '8',\n )\n const container = tree.add('muiContainer', { maxWidth: 'lg' }, { py: { xs: 6, md: 10 } }, [row], 'container')\n return designedRoot(scope, [container], bandSx(band), band === 'dark')\n}\n\n/**\n * A panel hero (AGL-3985): a full-bleed photo shown as it is, undimmed, and\n * the words on a card of the page's own surface over its lower corner, as an\n * agent's listing or a firm's office opens. The card carries its own colors,\n * so the words read whatever the photo is.\n */\nfunction panelHero(scope: SectionScope, flow: readonly AiLayoutBlock[], picture: DesignedPicture, home: boolean): string {\n const tree = scope.page.tree\n // The words sit on the card, never on the band the model chose.\n scope.band = 'plain'\n scope.centered = false\n const photo = designPicture(scope, picture, { position: 'absolute', top: 0, left: 0, width: '100%', height: '100%' }, 'panelPhoto')\n const words = compileFlow(scope, flow, 'half') as string\n const card = tree.add(\n 'muiBox',\n null,\n { bgcolor: 'background.paper', color: 'text.primary', borderRadius: 2, boxShadow: 3, p: { xs: 4, md: 6 }, maxWidth: { xs: '100%', md: '52%' } },\n [words],\n 'panel',\n )\n const container = tree.add('muiContainer', { maxWidth: 'lg' }, { position: 'relative', zIndex: 1, pt: { xs: 28, md: 36 }, pb: { xs: 4, md: 8 } }, [card], 'container')\n return designedRoot(\n scope,\n [photo, container],\n { position: 'relative', overflow: 'hidden', display: 'flex', alignItems: 'flex-end', minHeight: home ? { xs: '72vh', md: '84vh' } : { xs: '48vh', md: '56vh' } },\n false,\n )\n}\n\n/**\n * A portrait hero (AGL-3985): a person's own page opens on their round\n * photo, the words centered under it.\n */\nfunction portraitHero(scope: SectionScope, flow: readonly AiLayoutBlock[], picture: DesignedPicture): string {\n const tree = scope.page.tree\n const band = scope.band\n scope.centered = true\n const photo = designPicture(scope, picture, { width: { xs: '44%', sm: '30%', md: '22%' }, aspectRatio: '1 / 1', borderRadius: '50%', flexShrink: 0 })\n const words = compileFlow(scope, flow, 'full') as string\n const measure = tree.add('muiBox', null, { maxWidth: { xs: '100%', md: '72%' }, mx: 'auto' }, [words], 'measure')\n const stack = tree.add('muiStack', { spacing: '5', useFlexGap: true, alignItems: 'center' }, null, [photo, measure], 'content')\n const container = tree.add('muiContainer', { maxWidth: 'lg' }, { py: { xs: 8, md: 12 } }, [stack], 'container')\n return designedRoot(scope, [container], bandSx(band), band === 'dark')\n}\n\n/** A closing section of words over a photo. */\nfunction coverBand(scope: SectionScope, words: readonly AiLayoutBlock[]): string {\n scope.band = 'dark'\n scope.centered = true\n scope.page.settled.push({ at: scope.at, what: 'drawn over a photo' })\n return cover(scope, words, { alt: standInAlt(scope), given: false }, { xs: '56vh', md: '64vh' })\n}\n\n/** A section of words beside a picture, the side turning section by section. */\nfunction feature(scope: SectionScope, words: readonly AiLayoutBlock[]): string {\n const { page } = scope\n const design = page.design as NonNullable<PageScope['design']>\n const left = design.choices.featureLeft !== (page.features % 2 === 1)\n page.features += 1\n page.settled.push({ at: scope.at, what: `set beside a picture on the ${left ? 'left' : 'right'}` })\n scope.centered = false\n const flow = compileFlow(scope, words, 'half') as string\n const photo = designPicture(scope, { alt: standInAlt(scope), given: false }, {\n aspectRatio: { xs: '4 / 3', md: page.features === 1 ? '4 / 5' : '1 / 1' },\n borderRadius: 2,\n })\n const row = designRow(\n scope,\n left\n ? [\n { id: photo, size: 'xs:12 md:6' },\n { id: flow, size: 'xs:12 md:6' },\n ]\n : [\n { id: flow, size: 'xs:12 md:6' },\n { id: photo, size: 'xs:12 md:6' },\n ],\n '8',\n )\n const container = page.tree.add('muiContainer', { maxWidth: 'lg' }, { py: { ...SECTION_PADDING } }, [row], 'container')\n return designedRoot(scope, [container], bandSx(scope.band), scope.band === 'dark')\n}\n\n/** The most sections a page sets beside a photo for being the third in a row with none (AGL-4065). */\nconst AI_LAYOUT_RHYTHM_MOST = 2\n\n/** What the compiler notes of a section it set beside a photo for the page's rhythm (AGL-4065). */\nexport const AI_LAYOUT_RHYTHM_NOTE = 'drawn beside a photo: third text-only band'\n\n/**\n * NO THREE TEXT-ONLY BANDS IN A ROW (AGL-4065). The booth-kit trades homes\n * of 2026-10-25 stacked their middles as bands of words with no picture —\n * Holeshot Moto Repair's numbered steps, its repair list and its reasons to\n * trust the shop, one under another. On a page drawn with a design, whose\n * stand-in pictures the stock library fills, a section that would be the\n * third in a row to show no picture is set beside one instead: its words\n * and its items in one half, a photo of its heading's subject in the other,\n * the side turning as the design's own photo-led sections turn. At most\n * twice a page, and only where the page has a picture left.\n *\n * A section of words or of one group of cards or lines qualifies. Steps,\n * questions and figures read best as text and stay so; a section with a\n * picture, a form, a component or a row of columns of its own is drawn as\n * designed; a group the design draws as pictures, articles or a menu\n * already is one; and the page's closing call to action is the design's to\n * draw (`coverClose`). `null` leaves the section to the design.\n */\nfunction rhythmSection(scope: SectionScope, raw: AiLayoutSection, blocks: readonly AiLayoutBlock[]): string | null {\n const { page, index } = scope\n const design = page.design\n if (!design || index === 0 || (page.bare ?? 0) < 2 || (page.rhythm ?? 0) >= AI_LAYOUT_RHYTHM_MOST || picturesLeft(page) < 1) return null\n if (raw.cols && raw.cols.length >= 2) return null\n const words = blocks.filter((block) => WORD_KINDS.has(block.kind))\n const groups = blocks.filter((block) => !WORD_KINDS.has(block.kind))\n if (groups.length > 1 || !words.some((block) => speaksHeading(scope, block))) return null\n const group = groups[0]\n if (group && ((group.kind !== 'cards' && group.kind !== 'list') || group.to || (group.items?.length ?? 0) > 6)) return null\n if (group?.kind === 'cards' && group.style !== 'quiet' && aiLayoutGroupVariant(design.input, design.choices, scope.words ?? '') !== design.choices.group) return null\n const last = index === page.plan.sections.length - 1\n if (last && words.some((block) => block.kind === 'button')) return null\n if (!group) {\n // A section of words the design already sets beside a photo needs no rule.\n if (!words.some((block) => block.kind === 'text' || block.kind === 'lede') || (design.choices.features && page.features < 2)) return null\n page.rhythm = (page.rhythm ?? 0) + 1\n page.settled.push({ at: scope.at, what: AI_LAYOUT_RHYTHM_NOTE })\n return feature(scope, words)\n }\n page.rhythm = (page.rhythm ?? 0) + 1\n page.settled.push({ at: scope.at, what: AI_LAYOUT_RHYTHM_NOTE })\n return featureGroup(scope, words, group)\n}\n\n/**\n * A section's words and its one group beside a picture of its subject\n * (AGL-4065): the words over the items in the wider half, the photo at 4:3\n * in the other, on the side the design's photo-led sections turn to next.\n */\nfunction featureGroup(scope: SectionScope, words: readonly AiLayoutBlock[], group: AiLayoutBlock): string {\n const { page } = scope\n const design = page.design as NonNullable<PageScope['design']>\n const left = design.choices.featureLeft !== (page.features % 2 === 1)\n page.features += 1\n scope.centered = false\n // The heading and its words open the half, the group under them, any button last.\n const flow = compileFlow(scope, [...words.filter((block) => block.kind !== 'button'), group, ...words.filter((block) => block.kind === 'button')], 'half') as string\n const photo = designPicture(scope, { alt: standInAlt(scope), given: false }, { aspectRatio: '4 / 3', borderRadius: 2 })\n const row = designRow(\n scope,\n left\n ? [\n { id: photo, size: 'xs:12 md:5' },\n { id: flow, size: 'xs:12 md:7' },\n ]\n : [\n { id: flow, size: 'xs:12 md:7' },\n { id: photo, size: 'xs:12 md:5' },\n ],\n '8',\n )\n const container = page.tree.add('muiContainer', { maxWidth: 'lg' }, { py: { ...SECTION_PADDING } }, [row], 'container')\n return designedRoot(scope, [container], bandSx(scope.band), scope.band === 'dark')\n}\n\n/**\n * The variant a designed group's item title takes (AGL-4065): the heading\n * style it names, or — where the site's seed sets its titles as labels — the\n * theme's own overline, spaced capitals over the item's words.\n */\nfunction itemTitleVariant(scope: SectionScope, heading: string): string {\n return scope.page.design?.choices.headingCase === 'caps' ? 'overline' : heading\n}\n\n/** A heading beside its items: the words in a narrow column, the items ruled in the wide one. */\nfunction splitSection(\n scope: SectionScope,\n head: readonly AiLayoutBlock[],\n group: AiLayoutBlock,\n tail: readonly AiLayoutBlock[],\n): string {\n const { page } = scope\n scope.centered = false\n scope.groupStyle = 'ruled'\n page.splitAt = scope.index\n page.settled.push({ at: scope.at, what: 'the heading set beside its items' })\n const words = compileFlow(scope, [...head, ...tail], 'half')\n const items = compileFlow(scope, [group], 'half')\n if (!words || !items) {\n const flow = [words, items].filter((id): id is string => !!id)\n const container = page.tree.add('muiContainer', { maxWidth: 'lg' }, { py: { ...SECTION_PADDING } }, flow, 'container')\n return designedRoot(scope, [container], bandSx(scope.band), scope.band === 'dark')\n }\n const row = designRow(\n scope,\n [\n { id: words, size: 'xs:12 md:5' },\n { id: items, size: 'xs:12 md:7' },\n ],\n '8',\n 'flex-start',\n )\n const container = page.tree.add('muiContainer', { maxWidth: 'lg' }, { py: { ...SECTION_PADDING } }, [row], 'container')\n return designedRoot(scope, [container], bandSx(scope.band), scope.band === 'dark')\n}\n\n/**\n * Items under rules, one a line, each opening under a thin rule in the\n * text's own color. One style key an element, so a long list repeats no\n * multi-key inline style (rule 16); and no Stack `divider`, which a\n * published page's renderer hands a Stack as one child and so never draws.\n */\nfunction ruledList(scope: SectionScope, ids: readonly string[], role: string): string {\n const tree = scope.page.tree\n return tree.add(\n 'muiStack',\n { spacing: '2' },\n null,\n ids.map((id) => tree.add('muiBox', null, { borderTop: 1 }, [tree.add('muiBox', null, { pt: 2 }, [id], 'ruledWords')], 'ruledLine')),\n role,\n )\n}\n\n/** Numbered items as a ruled list: each number beside its title and words. */\nfunction timeline(scope: SectionScope, items: readonly AiLayoutItem[]): string {\n const tree = scope.page.tree\n const facts = scope.page.targets.facts\n const rows = items.map((item, position) =>\n tree.add(\n 'muiStack',\n { direction: 'row', spacing: '3', alignItems: 'baseline' },\n null,\n [\n // The numbers keep one column, so every title starts at the same line.\n tree.add(\n 'muiBox',\n null,\n { flex: '0 0 3.5rem' },\n [tree.add('muiTypography', { children: String(position + 1).padStart(2, '0'), variant: 'h4', component: 'p' }, accent(scope), null, 'number')],\n 'numberColumn',\n ),\n tree.add(\n 'muiStack',\n { spacing: '1' },\n null,\n [\n item.title.trim()\n ? tree.add('muiTypography', { children: aiLayoutWords(item.title, 'itemTitle', facts, scope.page.options.language), variant: itemTitleVariant(scope, 'h5'), component: itemElement(scope) }, null, null, 'title')\n : null,\n item.text.trim()\n ? tree.add('muiTypography', { children: aiLayoutWords(item.text, 'itemText', facts, scope.page.options.language), variant: 'body1' }, muted(scope), null, 'text')\n : null,\n ],\n 'stepWords',\n ),\n ],\n 'step',\n ),\n )\n return ruledList(scope, noted(scope, rows), 'timeline')\n}\n\n/** A group drawn the design's way; `null` to draw it as the theme's cards. */\nfunction designedGroup(\n scope: SectionScope,\n variant: AiLayoutGroupVariant,\n items: readonly AiLayoutItem[],\n room: Room,\n): string | null {\n const { page } = scope\n const tree = page.tree\n const facts = page.targets.facts\n const title = (item: AiLayoutItem, type = 'h5') =>\n item.title.trim()\n ? tree.add('muiTypography', { children: aiLayoutWords(item.title, 'itemTitle', facts, scope.page.options.language), variant: type, component: itemElement(scope) }, null, null, 'title')\n : null\n const words = (item: AiLayoutItem, type = 'body1') =>\n item.text.trim()\n ? tree.add('muiTypography', { children: aiLayoutWords(item.text, 'itemText', facts, scope.page.options.language), variant: type }, muted(scope), null, 'text')\n : null\n if (variant === 'cards') return null\n if (variant === 'icons') return iconColumns(scope, items, room)\n const pictured = variant === 'pictures' || variant === 'articles'\n if (variant === 'ruled' || (pictured && (room !== 'full' || picturesLeft(page) < items.length))) {\n const perRow = across(items.length, room, 'cards')\n if (perRow <= 1) {\n // Stacked, the rules run between the items.\n const ids = items.map((item) => tree.add('muiStack', { spacing: '1' }, null, [title(item, itemTitleVariant(scope, 'h5')), words(item)], 'ruled'))\n return ruledList(scope, noted(scope, ids), 'ruledItems')\n }\n // Side by side, each column opens under a rule in the text's own color.\n const ids = items.map((item) =>\n tree.add('muiBox', null, { borderTop: 1 }, [tree.add('muiStack', { spacing: '1' }, { pt: 2.5 }, [title(item, itemTitleVariant(scope, 'h5')), words(item)], 'ruledWords')], 'ruled'),\n )\n return layOut(scope, noted(scope, ids), perRow, '5', 'ruledItems')\n }\n if (variant === 'menu') {\n const ids = items.map((item) => tree.add('muiStack', { spacing: '0.5' }, null, [title(item, 'h6'), words(item, 'body2')], 'dish'))\n noted(scope, ids)\n // Two columns of lines under rules, the first half and the second.\n const half = room === 'full' && ids.length >= 4 ? Math.ceil(ids.length / 2) : ids.length\n const lists = [ids.slice(0, half), ids.slice(half)].filter((list) => list.length).map((list) => ruledList(scope, list, 'menu'))\n if (lists.length === 1) return lists[0]\n // On a phone the two columns read as one list, the second opening under\n // its own rule a line's gap below the first; side by side, a gutter.\n const [first, second] = lists\n return tree.add(\n 'muiGrid',\n { container: true, rowSpacing: '2', columnSpacing: '8' },\n { alignItems: 'flex-start' },\n [\n tree.add('muiGrid', { size: 'xs:12 md:6' }, null, [first], 'column'),\n tree.add('muiGrid', { size: 'xs:12 md:6' }, null, [second], 'column'),\n ],\n 'menuRow',\n )\n }\n // Pictures over each item's title and words.\n const design = page.design as NonNullable<PageScope['design']>\n const mosaic = variant === 'pictures' && design.choices.pictures === 'mosaic' && items.length >= 2\n const portrait = design.input.kind === 'photography'\n const perRow = items.length === 4 || items.length === 2 ? 2 : Math.min(3, items.length)\n page.settled.push({ at: scope.at, what: `${items.length} items drawn as ${mosaic ? 'a mosaic of pictures' : variant}` })\n const cells = items.map((item, position) => {\n // A mosaic's rows turn wide-narrow, narrow-wide; an odd one out spans the row.\n const row = Math.floor(position / 2)\n const lone = mosaic && position === items.length - 1 && items.length % 2 === 1\n const wide = mosaic && !lone && position % 2 === row % 2\n const span = !mosaic ? 12 / perRow : lone ? 12 : wide ? 7 : 5\n const aspect = !mosaic ? (variant === 'articles' ? '3 / 2' : portrait ? '4 / 5' : '4 / 3') : lone ? '21 / 9' : wide ? '4 / 3' : '4 / 5'\n // The picture is its own frame: its shape its one style, so a grid of them repeats no inline style.\n // A portfolio's or a photographer's gallery opens in a lightbox, its\n // pictures one gallery with the item's title as each caption (AGL-3717).\n const opens = variant === 'pictures' && aiOpensGalleriesInLightbox(page)\n // A store's collection tiles open its Shop page (AGL-3676).\n const shop = variant === 'pictures' && !opens && aiLayoutFamily(design.input.kind) === 'retail' ? shopPageOf(page) : null\n const photo = designImage(\n scope,\n { alt: standInAlt(scope, item.title || item.text), given: false },\n { width: '100%', ...(opens ? lightboxProps(scope, item.title) : {}), ...(shop ? { screenId: shop } : {}) },\n { aspectRatio: { xs: '4 / 3', md: aspect } },\n )\n const id = tree.add(\n 'muiStack',\n { spacing: '1.5' },\n null,\n [photo, title(item, variant === 'articles' ? 'h5' : 'h6'), words(item, 'body2')],\n variant === 'articles' ? 'article' : 'work',\n )\n return { id, size: span === 12 ? 'xs:12 sm:12' : `xs:12 ${span === 6 ? 'sm' : 'md'}:${span}` }\n })\n noted(\n scope,\n cells.map((cell) => cell.id),\n )\n return tree.add(\n 'muiGrid',\n { container: true, spacing: mosaic ? '5' : '4' },\n { alignItems: 'flex-start' },\n cells.map((cell) => tree.add('muiGrid', { size: cell.size }, null, [cell.id], 'cell')),\n variant,\n )\n}\n\n// ── A section the site's records fill (AGL-3676) ──────────────────────────\n//\n// The section's words — its eyebrow, heading and lede — are the design's;\n// what it lists is the site's: its products through the commerce plugin's\n// Product grid, its posts through the content plugin's Collection Entries.\n// Any group the design drew for those records (cards naming products, a list\n// of post titles) stands in for them, and is left out.\n\n/** The block kinds a listing stands in for: the records the design described in words. */\nconst LISTING_REPLACES: ReadonlySet<AiLayoutBlock['kind']> = new Set([\n 'cards',\n 'steps',\n 'stats',\n 'quotes',\n 'list',\n 'image',\n 'component',\n])\n\n/** The tokens a post's card binds, filled per post when the page renders. */\nexport const AI_LAYOUT_POST_CARD_TOKENS = [\n '{{entry.title}}',\n '{{entry.excerpt}}',\n '{{entry.date}}',\n '{{entry.author}}',\n '{{entry.url}}',\n '{{entry.coverImage}}',\n] as const\n\n/** The tokens a post's card puts in a link or a picture, which the page's store admits whole. */\nexport const AI_LAYOUT_POST_ADDRESS_TOKENS: readonly string[] = ['{{entry.url}}', '{{entry.coverImage}}']\n\n/** The button under a featured band that opens the whole list, where the site has one and the design gave none. */\nfunction listingAllButton(page: PageScope, listing: AiLayoutListing): AiLayoutBlock | null {\n const language = page.options.language\n if (listing.kind === 'posts')\n return listing.href ? { kind: 'button', text: aiLayoutLabel('allPosts', language), to: listing.href, style: 'secondary' } : null\n const index = listing.placements.find((placement) => placement.role === 'index' && placement.screenId !== page.targets.pageId)\n if (!index) return null\n const text = aiLayoutLabel(\n listing.kind === 'tracks' ? 'allMusic' : listing.kind === 'events' ? 'allEvents' : listing.kind === 'records' ? 'seeAll' : 'shopAll',\n language,\n )\n return { kind: 'button', text, to: `page:${index.screenId}`, style: 'secondary' }\n}\n\nfunction listingSection(\n scope: SectionScope,\n blocks: readonly AiLayoutBlock[],\n placed: { listing: AiLayoutListing; role: AiLayoutListingRole; filter?: AiLayoutListingFilter },\n): string {\n const { page, index, at } = scope\n const { listing, role, filter } = placed\n if (listing.kind === 'reviews') return reviewsSection(scope, blocks)\n if (listing.kind === 'signup') return signupSection(scope, blocks)\n // The grid straight under a Shop page's title bar opens on the products:\n // the title bar already heads the page (AGL-3676).\n const underTitle = listing.kind === 'products' && role === 'index' && index === 1 && shopGridAt(page) === 1\n const left = blocks.filter((block) => LISTING_REPLACES.has(block.kind))\n if (left.length) {\n page.settled.push({\n at,\n what: `${left.map((block) => block.kind).join(', ')} left out: the section lists the site's own ${listing.kind}`,\n })\n }\n const kept = underTitle ? [] : blocks.filter((block) => !LISTING_REPLACES.has(block.kind)).map(({ col: _col, ...block }) => block)\n const words = kept.filter((block) => block.kind !== 'button' && block.kind !== 'form')\n let actions = kept.filter((block) => block.kind === 'button')\n if (!actions.length && role === 'featured') {\n const all = listingAllButton(page, listing)\n if (all) actions = [all]\n }\n if (!underTitle && !words.some((block) => speaksHeading(scope, block))) {\n // Every band of records is headed: the plan's name for it, or on a first section the page's title.\n words.unshift({ kind: 'heading', text: index === 0 ? page.plan.title : page.plan.sections[index]?.name || page.plan.title })\n }\n page.settled.push({ at, what: `lists the site's ${listing.kind} (${role})` })\n const tree = page.tree\n const centered = scope.centered\n const head = compileFlow(scope, words, centered ? 'full' : 'half')\n const link = compileFlow(scope, actions, 'half')\n // An editorial band's head: the words on the left, the way to the whole list on the right.\n const top =\n head && link && !centered\n ? designRow(\n scope,\n [\n { id: head, size: 'xs:12 md:8' },\n { id: link, size: 'xs:12 md:4', sx: { display: 'flex', justifyContent: { xs: 'flex-start', md: 'flex-end' } } },\n ],\n '3',\n 'flex-end',\n )\n : head\n const records = listingElement(scope, listing, role, filter)\n const parts = [\n top ? (centered ? tree.add('muiContainer', { maxWidth: 'md', disableGutters: true }, null, [top], 'measure') : top) : null,\n records,\n centered || !head ? link : null,\n ].filter((id): id is string => !!id)\n const content = tree.add('muiStack', { spacing: '6', useFlexGap: true, ...(centered ? { alignItems: 'center' } : {}) }, null, parts, 'content')\n const container = tree.add(\n 'muiContainer',\n { maxWidth: 'lg' },\n underTitle\n ? { pt: { xs: 2, md: 3 }, pb: { ...SECTION_PADDING } }\n : { py: index === 0 ? { ...HERO_PADDING } : { ...SECTION_PADDING } },\n [content],\n 'container',\n )\n const name = page.plan.sections[index]?.name?.trim() || `Section ${index + 1}`\n return tree.add(\n 'section',\n {\n element: 'section',\n ariaLabel: sectionLabel(name, index, page.options.language),\n ...(scope.band === 'dark' ? { colorScheme: 'dark' } : {}),\n },\n underTitle ? null : bandSx(scope.band),\n [container],\n 'section',\n page.options.sectionIds?.[index] ?? sectionIdOf(index),\n )\n}\n\n/** What a store's reviews are headed with where neither the design nor the plan says. */\nexport const AI_LAYOUT_REVIEWS_HEADING = AI_LAYOUT_LABELS_EN.reviewsHeading\n\n/**\n * A store's own customer reviews (AGL-3676): the commerce plugin's Product\n * reviews in its store-wide scope, carrying the section's heading itself.\n * It lists approved reviews with their star ratings, and on a published page\n * with none — every store that just opened — it shows nothing, heading and\n * all, so the band takes no room until a shopper has written one. No review\n * is ever written here: the design's quotes, if it gave any, were left out.\n */\nfunction reviewsSection(scope: SectionScope, blocks: readonly AiLayoutBlock[]): string {\n const { page, index, at } = scope\n const tree = page.tree\n const given = blocks.find((block) => speaksHeading(scope, block))\n const heading =\n aiLayoutWords(given?.text, 'heading', page.targets.facts, scope.page.options.language) ||\n aiLayoutFitText(page.plan.sections[index]?.name, 'heading', scope.page.options.language) ||\n aiLayoutLabel('reviewsHeading', page.options.language)\n page.settled.push({ at, what: \"the store's own reviews placed: shown once shoppers leave them, never written for them\" })\n const id = tree.add(\n AI_LAYOUT_LISTING_ELEMENTS.reviews,\n { scope: 'store', heading, maxItems: String(AI_LAYOUT_FEATURED_RECORDS.reviews) },\n // The padding is the element's, so a store with no reviews yet keeps no empty band.\n { py: { ...SECTION_PADDING } },\n null,\n 'reviews',\n )\n // The reviews are what the section shows: its shoppers' to write.\n noted(scope, [id, id])\n const container = tree.add('muiContainer', { maxWidth: 'lg' }, null, [id], 'container')\n return designedRoot(scope, [container], bandSx(scope.band), scope.band === 'dark')\n}\n\n/** What a store's sign-up is headed with where neither the design nor the plan says. */\nexport const AI_LAYOUT_SIGNUP_HEADING = AI_LAYOUT_LABELS_EN.signupHeading\n\n/**\n * A store's newsletter sign-up (AGL-3676): the design's heading and words\n * beside the commerce plugin's Newsletter signup field, or over it on a\n * centered band. Any form or button the design drew for it is the field's.\n */\nfunction signupSection(scope: SectionScope, blocks: readonly AiLayoutBlock[]): string {\n const { page, index, at } = scope\n const tree = page.tree\n const flow = blocks\n .filter((block) => WORD_KINDS.has(block.kind) && block.kind !== 'button')\n .map(({ col: _col, ...block }) => block)\n if (!flow.some((block) => speaksHeading(scope, block))) {\n flow.unshift({ kind: 'heading', text: page.plan.sections[index]?.name || aiLayoutLabel('signupHeading', page.options.language) })\n }\n page.settled.push({ at, what: \"the store's newsletter sign-up placed\" })\n const field = tree.add(AI_LAYOUT_LISTING_ELEMENTS.signup, { buttonLabel: aiLayoutLabel('subscribe', page.options.language) }, null, null, 'signup')\n noted(scope, [field, field])\n const words = compileFlow(scope, flow, scope.centered ? 'full' : 'half')\n const body = scope.centered\n ? tree.add(\n 'muiStack',\n { spacing: '4', alignItems: 'center' },\n null,\n [words, tree.add('muiContainer', { maxWidth: 'sm', disableGutters: true }, null, [field], 'measure')],\n 'content',\n )\n : designRow(\n scope,\n [...(words ? [{ id: words, size: 'xs:12 md:6' }] : []), { id: field, size: 'xs:12 md:6' }],\n '6',\n )\n const container = tree.add('muiContainer', { maxWidth: 'lg' }, { py: { ...SECTION_PADDING } }, [body], 'container')\n return designedRoot(scope, [container], bandSx(scope.band), scope.band === 'dark')\n}\n\n/** A store's Shop page's grid section on this page, by plan index; -1 where this page is not its Shop page. */\nfunction shopGridAt(page: PageScope): number {\n const products = (page.targets.listings ?? []).find((listing) => listing.kind === 'products')\n return (\n products?.placements.find((placement) => placement.role === 'index' && placement.screenId === page.targets.pageId)?.section ??\n -1\n )\n}\n\n/** A store's Shop page, by its id, where this page is another page of the store; `null` otherwise. */\nfunction shopPageOf(page: PageScope): string | null {\n const products = (page.targets.listings ?? []).find((listing) => listing.kind === 'products')\n const shop = products?.placements.find((placement) => placement.role === 'index')?.screenId\n return shop && shop !== page.targets.pageId && page.targets.pages.some((entry) => entry.id === shop) ? shop : null\n}\n\n/**\n * A Shop page's opening, as a storefront's collection page opens (AGL-3676):\n * the page's title and one line under it, on the page's own ground, with\n * little room around them — no photo and no buttons — so the grid that\n * follows starts above the fold. The beta.237 Willow Wick /shop opened on a\n * tall candle photo and its words, the products below the fold.\n */\nfunction shopTitle(scope: SectionScope, blocks: readonly AiLayoutBlock[]): string {\n const { page, at } = scope\n const left = blocks.filter((block) => !['eyebrow', 'heading', 'lede', 'text'].includes(block.kind))\n if (left.length) {\n page.settled.push({ at, what: `${left.map((block) => block.kind).join(', ')} left out: a Shop page opens on its title and its grid` })\n }\n const heading = blocks.find((block) => speaksHeading(scope, block))\n const line = blocks.find((block) => block.kind === 'lede' || block.kind === 'text')\n const eyebrow = blocks.find((block) => block.kind === 'eyebrow')\n const flow: AiLayoutBlock[] = [\n ...(eyebrow ? [eyebrow] : []),\n { kind: 'heading', text: heading?.text ?? page.plan.title },\n ...(line ? [{ kind: 'lede' as const, text: line.text }] : []),\n ]\n scope.band = 'plain'\n scope.centered = false\n page.settled.push({ at, what: \"drawn as the Shop page's title bar, the grid under it\" })\n const words = compileFlow(scope, flow, 'half') as string\n const container = page.tree.add('muiContainer', { maxWidth: 'lg' }, { pt: { xs: 5, md: 7 }, pb: { xs: 1, md: 2 } }, [words], 'container')\n return designedRoot(scope, [container], null, false)\n}\n\n/**\n * A storefront's home hero sells (AGL-3676): it opens the shop. Where the\n * design gave it no button to the Shop page, \"Shop all\" leads its buttons,\n * and any other primary button steps back to secondary beside it.\n */\nfunction sellingHero(scope: SectionScope, flow: AiLayoutBlock[]): void {\n const design = scope.page.design\n if (!design?.input.home || aiLayoutFamily(design.input.kind) !== 'retail') return\n const shop = shopPageOf(scope.page)\n if (!shop || flow.some((block) => block.kind === 'button' && block.to === `page:${shop}`)) return\n const firstButton = flow.findIndex((block) => block.kind === 'button')\n for (const [at, block] of flow.entries()) {\n if (block.kind === 'button' && (block.style ?? 'primary') === 'primary') flow[at] = { ...block, style: 'secondary' }\n }\n const text = aiLayoutLabel('shopAll', scope.page.options.language)\n const shopAll: AiLayoutBlock = { kind: 'button', text, to: `page:${shop}`, style: 'primary' }\n if (firstButton === -1) flow.push(shopAll)\n else flow.splice(firstButton, 0, shopAll)\n scope.page.settled.push({ at: scope.at, what: `the hero opens the shop: \"${text}\" leads its buttons` })\n}\n\n/** The button a storefront's hero opens its shop with. */\nexport const AI_LAYOUT_SHOP_ALL = AI_LAYOUT_LABELS_EN.shopAll\n\n/**\n * A storefront's reasons to buy as open columns, each led by an icon over its\n * title and words (AGL-3676): the icon the design named for it, else one its\n * words suggest (shipping a truck, returns the arrows, small batch the hand),\n * else one neutral icon along the row; a row of places (\"Areas we serve\")\n * shows the place marker for every place (AGL-4065). One style key an\n * element, so a row repeats no multi-key inline style (rule 16).\n */\nfunction iconColumns(scope: SectionScope, items: readonly AiLayoutItem[], room: Room): string {\n const { page } = scope\n const tree = page.tree\n const facts = page.targets.facts\n const iconWords = aiStorefrontItemIcons(items, (word) => !!aiIconOfWord(word), {\n section: scope.words ?? '',\n ...(page.design ? { kind: page.design.input.kind } : {}),\n })\n const perRow = across(items.length, room, 'cards')\n const textAlign = scope.centered ? { align: 'center' } : {}\n page.settled.push({ at: scope.at, what: `${items.length} items drawn as icon columns` })\n const ids = items.map((item, position) => {\n const icon = aiIconOfWord(iconWords[position]) ?? AI_ICON_LIBRARY.star\n return tree.add(\n 'muiStack',\n { spacing: '1.5', ...(scope.centered ? { alignItems: 'center' } : {}) },\n null,\n [\n tree.add(AI_ICON_COMPONENT_ID, { iconId: icon.id, size: '32' }, accent(scope), null, 'icon'),\n item.title.trim()\n ? tree.add(\n 'muiTypography',\n { children: aiLayoutWords(item.title, 'itemTitle', facts, scope.page.options.language), variant: itemTitleVariant(scope, 'h6'), component: itemElement(scope), ...textAlign },\n null,\n null,\n 'title',\n )\n : null,\n item.text.trim()\n ? tree.add('muiTypography', { children: aiLayoutWords(item.text, 'itemText', facts, scope.page.options.language), variant: 'body2', ...textAlign }, muted(scope), null, 'text')\n : null,\n ],\n 'iconItem',\n )\n })\n return layOut(scope, noted(scope, ids), perRow, '5', 'icons')\n}\n\n/**\n * The element that lists the records, bound to them: the Product grid over\n * the site's catalog, or Collection Entries over its blog with one post's\n * card as the template it repeats. Its records count as the section's items.\n */\nfunction listingElement(\n scope: SectionScope,\n listing: AiLayoutListing,\n role: AiLayoutListingRole,\n filter?: AiLayoutListingFilter,\n): string {\n const { page } = scope\n const tree = page.tree\n const featured = role === 'featured'\n const shown = featured ? AI_LAYOUT_FEATURED_RECORDS[listing.kind] : 12\n const element = AI_LAYOUT_LISTING_ELEMENTS[listing.kind]\n let id: string\n if (listing.kind === 'tracks') {\n // An empty player (AGL-3716): its \"add your tracks\" state, which the owner\n // fills from their own media library. No source, ever — the section's\n // heading and words are the model's, the recordings the owner's.\n id = tree.add(element, null, null, null, 'player')\n page.settled.push({ at: scope.at, what: 'an empty music player placed for the owner’s own tracks' })\n // The player is what the section shows: its tracks are the owner's to add.\n noted(scope, [id, id])\n return id\n }\n if (listing.kind === 'events') {\n // The site's published events (AGL-3755), each with its date, place and\n // cover: the section's heading is the model's, so the list adds none.\n id = tree.add(element, featured ? { maxItems: String(shown) } : null, null, null, 'events')\n page.settled.push({ at: scope.at, what: 'the site’s events listed by the Event List' })\n noted(scope, [id, id])\n return id\n }\n if (listing.kind === 'products') {\n id = tree.add(\n element,\n {\n source: 'all',\n sort: 'newest',\n columns: String(featured ? Math.min(AI_LAYOUT_FEATURED_RECORDS.products, Math.max(3, listing.records.length)) : 3),\n // The shop's own page browses: a sort and the store's categories as\n // filter chips (shown once it has any), never categories drawn as cards.\n ...(featured ? { maxItems: String(shown) } : { pageSize: String(shown), showSort: true, showCategories: true }),\n cardStyle: 'photo',\n // A storefront's cards sell from the grid (AGL-3676): Add to cart on a\n // product with one variant, Choose options on one with several.\n quickAdd: true,\n // A store that opens before its first products are in says so, with a\n // way to hear when they land (AGL-3676): never placeholder products.\n emptyTitle: aiLayoutLabel('storeEmptyTitle', page.options.language),\n emptyText: aiLayoutLabel(listing.emptyAction ? 'storeEmptyText' : 'storeEmptyTextAlone', page.options.language),\n ...(listing.emptyAction\n ? {\n emptyActionLabel:\n listing.emptyAction.label === AI_LAYOUT_LABELS_EN.getInTouch\n ? aiLayoutLabel('getInTouch', page.options.language)\n : listing.emptyAction.label,\n emptyActionHref: listing.emptyAction.href,\n }\n : {}),\n },\n null,\n null,\n 'products',\n )\n } else if (listing.kind === 'records') {\n id = recordsElement(scope, listing, featured ? shown : null, filter)\n } else {\n id = postsElement(scope, listing, featured ? shown : COLLECTION_INDEX_POSTS)\n }\n // What a visitor sees here is the site's records, however many it keeps —\n // a section named for one group, that group's (AGL-3921): the section shows\n // its planned items when it has any to show.\n const listed = filter?.records.length ? filter.records.length : listing.records.length\n noted(scope, Array.from({ length: Math.max(2, Math.min(shown, listed)) }, () => id))\n return id\n}\n\n/** What a store's Product grid says while the store lists nothing yet (AGL-3676). */\nexport const AI_LAYOUT_STORE_EMPTY = {\n title: AI_LAYOUT_LABELS_EN.storeEmptyTitle,\n text: AI_LAYOUT_LABELS_EN.storeEmptyText,\n /** Said where the site has no page to get in touch on. */\n textAlone: AI_LAYOUT_LABELS_EN.storeEmptyTextAlone,\n} as const\n\n/** The most posts a page of the site lists where it is the writing's own page. */\nconst COLLECTION_INDEX_POSTS = 9\n\n/** The blog's posts as the site's design lists them: a grid of covers, or a ruled list with the dates. */\nfunction postsElement(scope: SectionScope, listing: AiLayoutListing, limit: number): string {\n const { page } = scope\n const tree = page.tree\n const ruled = page.design?.choices.writing === 'ruled'\n const titleElement = itemElement(scope)\n const cover = (sx: Record<string, unknown>) =>\n tree.add(\n 'image',\n { src: '{{entry.coverImage}}', alt: '{{entry.title}}', href: '{{entry.url}}', objectFit: 'cover', width: '100%', loading: 'lazy' },\n sx,\n null,\n 'postCover',\n )\n const meta = tree.add('muiTypography', { children: '{{entry.date}} · {{entry.author}}', variant: 'caption', component: 'p' }, muted(scope), null, 'postMeta')\n const title = tree.add('muiTypography', { children: '{{entry.title}}', variant: ruled ? 'h5' : 'h6', component: titleElement }, null, null, 'postTitle')\n const excerpt = tree.add('muiTypography', { children: '{{entry.excerpt}}', variant: 'body2' }, muted(scope), null, 'postExcerpt')\n const more = tree.add(\n 'muiScreenLink',\n { children: aiLayoutLabel('readPost', page.options.language), href: '{{entry.url}}', renderAs: 'link', color: 'inherit' },\n { alignSelf: 'flex-start' },\n null,\n 'postLink',\n )\n page.settled.push({ at: scope.at, what: `posts listed as ${ruled ? 'a ruled list' : 'a grid of covers'}` })\n const card = ruled\n ? tree.add(\n 'muiBox',\n null,\n { borderTop: 1, pt: 3 },\n [\n tree.add(\n 'muiStack',\n { direction: 'row', spacing: '3', alignItems: 'flex-start' },\n null,\n [\n tree.add('muiStack', { spacing: '1' }, { flex: '1 1 auto', minWidth: 0 }, [meta, title, excerpt, more], 'postWords'),\n tree.add('muiBox', null, { flex: '0 0 auto', width: { xs: '30%', md: '24%' } }, [cover({ aspectRatio: '4 / 3', borderRadius: 2 })], 'postThumb'),\n ],\n 'postRow',\n ),\n ],\n 'post',\n )\n : tree.add('muiStack', { spacing: '1.5' }, null, [cover({ aspectRatio: '3 / 2', borderRadius: 2 }), meta, title, excerpt, more], 'post')\n return tree.add(\n AI_LAYOUT_LISTING_ELEMENTS.posts,\n { collectionSlug: listing.collectionSlug, entriesLimit: String(limit), spacing: ruled ? '3' : '0' },\n ruled ? null : { display: 'grid', gridTemplateColumns: { xs: '1fr', md: 'repeat(3, 1fr)' }, gap: 5 },\n [card],\n 'posts',\n )\n}\n\n// ── A dataset's records (AGL-3616) ───────────────────────────────────────\n\n/** The words of the link under each record's card to its own page (AGL-3727). */\nexport const AI_LAYOUT_RECORD_LINK_LABEL = AI_LAYOUT_LABELS_EN.viewDetails\n\n/** A field whose name says it is a record's kicker: its category, role, time or place. */\nconst RECORD_KICKER = /\\b(category|categories|type|kind|role|title|position|section|course|date|dates|time|times|when|day|days|location|place|where|venue|city|duration|level|tag|tags)\\b/i\n/** A field whose name says it is a record's words: its description, bio or answer. */\nconst RECORD_BODY = /\\b(description|summary|details?|about|bio|biography|answer|text|notes?|body|blurb|overview|excerpt|ingredients|includes)\\b/i\n/** A dataset of questions and answers, listed as a ruled list rather than cards. */\nconst RECORD_QUESTIONS = /\\b(faqs?|questions?|q ?& ?a)\\b/i\n/** A dataset of people, whose photos are portraits. */\nconst RECORD_PEOPLE = /\\b(team|staff|people|crew|instructors?|teachers?|stylists?|therapists?|coaches?|trainers?|chefs?|doctors?|dentists?|artists?|founders?|members?)\\b/i\n\n/** The fields a record's card shows: its name, a kicker line and its words, each by id. */\nexport function aiLayoutRecordCardFields(\n fields: readonly { id: string; name: string; type: string }[],\n): { title: string | null; kicker: string | null; body: string | null } {\n const texts = fields.filter((field) => (field.type === 'text' || field.type === 'sorted') && !aiLayoutIsRecordImageAlt(field.name))\n const title = texts.find((field) => field.type === 'text')?.id ?? null\n const rest = texts.filter((field) => field.id !== title)\n const body = rest.find((field) => field.type === 'text' && RECORD_BODY.test(field.name))?.id ?? null\n const kicker = rest.find((field) => field.id !== body && RECORD_KICKER.test(field.name))?.id ?? null\n // Failing a named one, the next text field is the record's words.\n const words = body ?? rest.find((field) => field.type === 'text' && field.id !== kicker)?.id ?? null\n return { title, kicker, body: words }\n}\n\n/**\n * A dataset's records, as the site's design lists them: a Box that repeats\n * its one card over the dataset — the platform's own repeat, which the page\n * renders once per record — or, for questions and answers, a ruled list.\n * The card binds the record's fields as `{{item.<field>}}`: its name as the\n * item's title, a kicker over it (its category, role or time), and its words.\n * A dataset whose records carry a photo (AGL-3616) leads each card with it,\n * an Image bound to the record's photo field — a portfolio's or a\n * photographer's opening in a lightbox, as one gallery captioned with each\n * record's name, as the design's own picture cards do (AGL-3717) — so a list\n * of pieces stays the image-led gallery it was before it was a dataset.\n * A featured band shows the first few; a page of its own, every record.\n */\nfunction recordsElement(scope: SectionScope, listing: AiLayoutListing, limit: number | null, filter?: AiLayoutListingFilter): string {\n const { page } = scope\n const tree = page.tree\n const fields = aiLayoutRecordCardFields(listing.fields ?? [])\n const questions = RECORD_QUESTIONS.test(listing.name)\n const textAlign = scope.centered && !questions ? { align: 'center' } : {}\n const kicker = fields.kicker\n ? tree.add('muiTypography', { children: `{{item.${fields.kicker}}}`, variant: 'overline', component: 'p', ...textAlign }, accent(scope), null, 'recordKicker')\n : null\n const title = fields.title\n ? tree.add(\n 'muiTypography',\n { children: `{{item.${fields.title}}}`, variant: questions ? 'h6' : 'h5', component: itemElement(scope), ...textAlign },\n null,\n null,\n 'recordTitle',\n )\n : null\n const body = fields.body\n ? tree.add('muiTypography', { children: `{{item.${fields.body}}}`, variant: 'body2', ...textAlign }, muted(scope), null, 'recordBody')\n : null\n const photoField = !questions && listing.imageField ? listing.imageField : null\n const altField = photoField ? aiLayoutRecordImageAltField(listing.fields ?? []) : null\n const opens = Boolean(photoField) && aiOpensGalleriesInLightbox(page)\n // Each card opens its record's own page where the dataset has one (AGL-3727):\n // `/{base}/{{item.<address>}}`, filled per record as the card repeats.\n const recordHref = aiLayoutRecordHref(listing)\n const portrait = page.design?.input.kind === 'photography' || RECORD_PEOPLE.test(listing.name)\n const picture = photoField\n ? tree.add(\n 'image',\n {\n src: `{{item.${photoField}}}`,\n // What the photo shows, where the dataset keeps it; a record's name is what it is called (AGL-3856).\n alt: altField\n ? `{{item.${altField}}}`\n : fields.title\n ? `{{item.${fields.title}}}`\n : aiLayoutFitText(listing.name, 'alt', scope.page.options.language) || 'A photo',\n objectFit: 'cover',\n width: '100%',\n loading: 'lazy',\n ...(opens ? { ...lightboxProps(scope), ...(fields.title ? { lightboxCaption: `{{item.${fields.title}}}` } : {}) } : {}),\n // A photo that does not open in a lightbox opens the record's page.\n ...(recordHref && !opens ? { href: recordHref } : {}),\n },\n { aspectRatio: portrait ? '4 / 5' : '4 / 3', borderRadius: 2 },\n null,\n 'recordImage',\n )\n : null\n const more = recordHref\n ? tree.add(\n 'muiScreenLink',\n { children: aiLayoutLabel('viewDetails', page.options.language), href: recordHref, renderAs: 'link', color: 'inherit' },\n { alignSelf: scope.centered && !questions ? 'center' : 'flex-start' },\n null,\n 'recordLink',\n )\n : null\n page.settled.push({\n at: scope.at,\n what: `${listing.name} listed from its dataset${questions ? ' as a ruled list' : picture ? ' as picture cards' : ' as cards'}${\n recordHref ? `, each linking its page under /${listing.recordBase}` : ''\n }${filter ? `, only those filed “${filter.value}”` : ''}`,\n })\n const card = questions\n ? tree.add('muiStack', { spacing: '1' }, { borderTop: 1, pt: 3 }, [title, body, more], 'record')\n : tree.add(\n 'muiStack',\n { spacing: picture ? '1.5' : '1', ...(scope.centered ? { alignItems: 'center' } : {}) },\n null,\n [picture, kicker, title, body, more],\n 'record',\n )\n return tree.add(\n AI_LAYOUT_LISTING_ELEMENTS.records,\n {\n repeatDataset: listing.datasetId,\n ...(limit ? { repeatLimit: String(limit) } : {}),\n // A section named for one group lists that group's records (AGL-3921).\n ...(filter ? { repeatFilter: aiLayoutRepeatFilterOf(filter) } : {}),\n },\n questions\n ? { display: 'grid', gap: 3 }\n : { display: 'grid', gridTemplateColumns: { xs: '1fr', md: 'repeat(3, 1fr)' }, gap: 5 },\n [card],\n 'records',\n )\n}\n\n// ── A page brought in (AGL-4107) ──────────────────────────────────────────\n//\n// What a page brought in from its owner's own website draws that a designed\n// page never does: the source's own pictures and icons, every item of every\n// group with all its parts (its figure, its paragraphs, its bullet points,\n// its own links), its tables, its tabs and its strips of logos. Every word is\n// the source's, as written, and every element is the palette's with the\n// theme's tokens, as the rest of the compiler draws: a card is the theme's\n// Card, a question the Accordion, a link the Button. One style key on each\n// repeated element, so a page of many items repeats no inline style (rule 16).\n\n/** The source's picture, at its own shape, rounded as the theme rounds a frame. */\nfunction sourcePicture(scope: SectionScope, picture: AiLayoutPicture, role = 'image'): string {\n const { page } = scope\n page.images += 1\n const destination = picture.to ? aiLayoutImportedDestination(picture.to, page.plan.sections.length) : null\n return page.tree.add(\n 'image',\n {\n src: picture.src,\n ...(picture.alt ? { alt: picture.alt } : { decorative: true }),\n objectFit: 'cover',\n // A byline's portrait is drawn at a portrait's size, round.\n ...(picture.small ? { width: AI_LAYOUT_PORTRAIT_SIZE, height: AI_LAYOUT_PORTRAIT_SIZE } : {}),\n // The first picture of the page loads at once, the rest as they are reached.\n ...(page.images > 1 ? { loading: 'lazy' } : {}),\n ...(destination ? destinationProps(destination) : {}),\n },\n { borderRadius: picture.small ? '50%' : 2 },\n null,\n role,\n )\n}\n\n/** The size a byline's portrait is drawn at on a page brought in (AGL-4107): the Image element's own size field, as an author sets it. */\nexport const AI_LAYOUT_PORTRAIT_SIZE = '4rem'\n\n/** An item's picture, over its words: the card's own top, at one shape across its group. */\nfunction itemPicture(scope: SectionScope, picture: AiLayoutPicture): string {\n const { page } = scope\n page.images += 1\n return page.tree.add(\n 'image',\n {\n src: picture.src,\n ...(picture.alt ? { alt: picture.alt } : { decorative: true }),\n objectFit: 'cover',\n ...(page.images > 1 ? { loading: 'lazy' } : {}),\n },\n { aspectRatio: '16 / 9' },\n null,\n 'itemPicture',\n )\n}\n\n/** An icon of a page brought in: the source's own drawing, else the library icon its word names. */\nfunction sourceIcon(scope: SectionScope, own: { iconPath?: string; icon?: string }, size: string, sx: Record<string, unknown> | null, role = 'icon'): string | null {\n const tree = scope.page.tree\n if (own.iconPath) return tree.add(AI_ICON_COMPONENT_ID, { iconPath: own.iconPath, size }, sx, null, role)\n const icon = aiIconOfWord(own.icon)\n return icon ? tree.add(AI_ICON_COMPONENT_ID, { iconId: icon.id, size }, sx, null, role) : null\n}\n\n/** Lines of words as paragraphs of one style, each its own element. */\nfunction paragraphs(scope: SectionScope, lines: readonly (string | undefined)[], variant: string, sx: Record<string, unknown> | null, role = 'text'): string[] {\n const tree = scope.page.tree\n return lines\n .map((line) => aiLayoutAsWritten(line))\n .filter(Boolean)\n .map((line) => tree.add('muiTypography', { children: line, variant, ...align(scope) }, sx, null, role))\n}\n\n/**\n * Words of a page brought in that are a link longer than a button's label\n * holds (AGL-4107): the words in the brand color, inside a Link Container\n * that goes where the source's link went.\n */\nfunction linkedWords(scope: SectionScope, text: string, destination: AiLayoutDestination): string {\n const tree = scope.page.tree\n const words = tree.add('muiTypography', { children: text, variant: 'body1', ...align(scope) }, accent(scope), null, 'linkWords')\n if (destination.kind === 'section') {\n linkTo(scope, words, destination)\n return words\n }\n return tree.add(\n 'muiLinkBox',\n { ...destinationProps(destination), ariaLabel: text.slice(0, AI_TEXT_LIMITS.label), ...(destination.kind === 'href' ? { newTab: true } : {}) },\n null,\n [words],\n 'longLink',\n )\n}\n\n/** An item's bullet points: each led by the source's mark where it drew one, else one under another. */\nfunction bullets(scope: SectionScope, lines: readonly string[], iconPath: string | undefined): string | null {\n const tree = scope.page.tree\n const said = lines.map((line) => aiLayoutAsWritten(line)).filter(Boolean)\n if (!said.length) return null\n if (!iconPath) {\n const rows = said.map((line) => tree.add('muiTypography', { children: line, variant: 'body2' }, null, null, 'line'))\n return tree.add('muiStack', { spacing: '1' }, null, rows, 'bullets')\n }\n const rows = said.map((line) =>\n tree.add(\n 'muiStack',\n { direction: 'row', spacing: '1', alignItems: 'flex-start' },\n null,\n [sourceIcon(scope, { iconPath }, '20', accent(scope), 'check'), tree.add('muiTypography', { children: line, variant: 'body2' }, null, null, 'line')],\n 'row',\n ),\n )\n return tree.add('muiStack', { spacing: '1' }, null, rows, 'bullets')\n}\n\n/** An item's own calls to action, side by side, each as the source drew it. */\nfunction itemLinks(scope: SectionScope, links: readonly AiLayoutLink[]): string | null {\n const tree = scope.page.tree\n const ids = links\n .map((link) => compileButton(scope, { kind: 'button', text: link.text, ...(link.to ? { to: link.to } : {}), style: link.style ?? 'quiet' }))\n .filter((id): id is string => !!id)\n if (!ids.length) return null\n if (ids.length === 1) return ids[0]\n return tree.add('muiStack', { direction: 'row', spacing: '2', useFlexGap: true, flexWrap: 'wrap' }, null, ids, 'actions')\n}\n\n/** How many items of a page brought in sit side by side: as the source lays them out, within the room. */\nfunction importedAcross(block: AiLayoutBlock, count: number, room: Room): number {\n const source = block.columns && block.columns > 0 ? block.columns : count <= 3 ? count : 3\n const wide = Math.max(1, Math.min(4, source, count))\n if (room === 'narrow') return 1\n if (room === 'half') return Math.min(2, wide)\n return wide\n}\n\n/** Whether an item has anything to show. */\nfunction itemShows(item: AiLayoutItem): boolean {\n return Boolean(\n item.title.trim() || item.text.trim() || item.figure?.trim() || item.more?.length || item.list?.length || item.links?.length || item.picture || item.iconPath,\n )\n}\n\n/**\n * A group of a page brought in: every item of it, each with all its parts,\n * laid out in the source's columns and drawn the way its design answer chose\n * (`variant`): the theme's cards, open columns under a rule, open columns led\n * by their icons, or pictures over their words.\n */\nfunction importedGroup(scope: SectionScope, block: AiLayoutBlock, room: Room): string | null {\n const items = (block.items ?? []).filter(itemShows)\n if (!items.length) return null\n const perRow = importedAcross(block, items.length, room)\n const ids = items.map((item) => importedItem(scope, block, item))\n return layOut(scope, noted(scope, ids), perRow, block.kind === 'stats' ? '4' : '3', block.kind === 'cards' ? 'cards' : block.kind)\n}\n\n/** The style an item of a group is drawn in: the design answer's, else the source's own box or none. */\nfunction itemStyle(block: AiLayoutBlock): AiLayoutGroupStyle | 'open' {\n if (block.variant) return block.variant\n if (block.kind === 'stats') return 'open'\n return block.style === 'quiet' ? 'open' : 'cards'\n}\n\n/** One item of a group of a page brought in, every part of it in the source's order. */\nfunction importedItem(scope: SectionScope, block: AiLayoutBlock, item: AiLayoutItem): string {\n const tree = scope.page.tree\n const style = itemStyle(block)\n const kind = block.kind\n const parts: Array<string | null> = []\n const title = aiLayoutAsWritten(item.title)\n const figure = aiLayoutAsWritten(item.figure)\n const titleNode = () =>\n title ? tree.add('muiTypography', { children: title, variant: itemTitleVariant(scope, 'h5'), component: itemElement(scope), ...align(scope) }, null, null, 'title') : null\n if (kind === 'quotes') {\n parts.push(tree.add(AI_ICON_COMPONENT_ID, { iconId: AI_ICON_LIBRARY.quote.id, size: '32' }, { color: 'primary.main' }, null, 'quoteMark'))\n parts.push(...paragraphs(scope, [item.text, ...(item.more ?? [])], 'body1', null, 'quote'))\n if (title) parts.push(tree.add('muiTypography', { children: title, variant: 'subtitle2', component: 'p', ...align(scope) }, null, null, 'attribution'))\n } else if (kind === 'stats') {\n const lead = figure || title\n if (lead) parts.push(tree.add('muiTypography', { children: lead, variant: 'h2', component: 'p', ...align(scope) }, accent(scope), null, 'figure'))\n if (figure && title) parts.push(titleNode())\n parts.push(...paragraphs(scope, [item.text, ...(item.more ?? [])], 'body2', muted(scope), 'label'))\n } else {\n if (item.picture) parts.push(itemPicture(scope, item.picture))\n parts.push(sourceIcon(scope, item, '32', style === 'cards' ? { color: 'primary.main' } : accent(scope)))\n const number = figure ? tree.add('muiTypography', { children: figure, variant: kind === 'steps' ? 'h3' : 'h4', component: 'p', ...align(scope) }, accent(scope), null, kind === 'steps' ? 'number' : 'figure') : null\n // A step's number leads it; a plan's price follows its name.\n if (kind === 'steps') parts.push(number, titleNode())\n else parts.push(titleNode(), number)\n parts.push(...paragraphs(scope, [item.text, ...(item.more ?? [])], 'body1', muted(scope)))\n if (item.list?.length) parts.push(bullets(scope, item.list, item.listIconPath))\n if (item.links?.length) parts.push(itemLinks(scope, item.links))\n }\n const shown = parts.filter((id): id is string => !!id)\n // The picture of a card is its top, edge to edge; the rest sit in its padding.\n const picture = style === 'cards' || style === 'articles' ? (shown[0] && tree.nodes[shown[0]]?.componentId === 'image' ? shown.shift() : null) : null\n const stack = tree.add('muiStack', { spacing: '1.5', ...(scope.centered && (kind === 'stats' || style === 'icons') ? { alignItems: 'center' } : {}) }, null, shown, kind === 'steps' ? 'step' : kind === 'stats' ? 'stat' : 'cardStack')\n let drawn: string\n if (style === 'cards' || style === 'articles') {\n const content = tree.add('muiCardContent', null, { p: 3 }, [stack], 'cardContent')\n drawn = tree.add('muiCard', null, { height: '100%' }, picture ? [picture, content] : [content], kind === 'quotes' ? 'quoteCard' : 'card')\n } else if (style === 'ruled') {\n drawn = tree.add('muiBox', null, { borderTop: 1 }, [tree.add('muiBox', null, { pt: 2.5 }, [stack], 'ruledWords')], 'ruled')\n } else {\n drawn = stack\n }\n // An item the source made one link as a whole is one here (AGL-4107): its\n // words keep their places, and pressing anywhere on it goes where it went.\n const whole = !item.links?.length && item.to ? aiLayoutImportedDestination(item.to, scope.page.plan.sections.length) : null\n if (!whole || whole.kind === 'section') return drawn\n return tree.add(\n 'muiLinkBox',\n { ...destinationProps(whole), ...(title ? { ariaLabel: title.slice(0, 200) } : {}), ...(whole.kind === 'href' ? { newTab: true } : {}) },\n { height: '100%' },\n [drawn],\n 'linked',\n )\n}\n\n/** A list of a page brought in: each line as written, led by the source's mark where it drew one, a link where it was one. */\nfunction importedList(scope: SectionScope, block: AiLayoutBlock, room: Room): string | null {\n const tree = scope.page.tree\n const items = (block.items ?? []).filter((item) => aiLayoutAsWritten(item.title || item.text))\n if (!items.length) return null\n const rows = items.map((item) => {\n const line = aiLayoutAsWritten([item.title, item.text].filter((part) => part.trim()).join(' '))\n const destination = item.to ? aiLayoutImportedDestination(item.to, scope.page.plan.sections.length) : null\n const words = !destination\n ? tree.add('muiTypography', { children: line, variant: 'body1' }, null, null, 'line')\n : line.length > AI_TEXT_LIMITS.button\n ? linkedWords(scope, line, destination)\n : tree.add('muiScreenLink', { children: line, renderAs: 'link', color: 'inherit', ...destinationProps(destination) }, null, null, 'link')\n if (destination && line.length <= AI_TEXT_LIMITS.button) linkTo(scope, words, destination)\n const mark = item.iconPath || item.icon ? sourceIcon(scope, item, '22', accent(scope), 'check') : null\n return mark ? tree.add('muiStack', { direction: 'row', spacing: '1.5', alignItems: 'flex-start' }, null, [mark, words], 'row') : words\n })\n noted(scope, rows)\n const perRow = importedAcross({ ...block, columns: block.columns ?? 1 }, rows.length, room)\n if (perRow > 1) return layOut(scope, rows, perRow, '2', 'list')\n return tree.add('muiStack', { spacing: '1.5' }, null, rows, 'list')\n}\n\n/** Questions and answers of a page brought in: an accordion each, the first open, every answer's paragraphs in it. */\nfunction importedFaq(scope: SectionScope, block: AiLayoutBlock): string | null {\n const tree = scope.page.tree\n const items = (block.items ?? []).filter((item) => aiLayoutAsWritten(item.title))\n if (!items.length) return null\n const panels = items.map((item, position) => {\n const answer = paragraphs(scope, [item.text, ...(item.more ?? [])], 'body1', { color: 'text.secondary' }, 'answer')\n if (item.list?.length) answer.push(bullets(scope, item.list, item.listIconPath) as string)\n if (item.links?.length) {\n const links = itemLinks(scope, item.links)\n if (links) answer.push(links)\n }\n const shown = answer.filter(Boolean)\n return tree.add(\n 'muiAccordion',\n { disableGutters: true, ...(position === 0 ? { defaultExpanded: true } : {}) },\n null,\n [\n tree.add('muiAccordionSummary', { children: aiLayoutAsWritten(item.title) }, null, null, 'question'),\n shown.length\n ? tree.add('muiAccordionDetails', null, null, [shown.length === 1 ? shown[0] : tree.add('muiStack', { spacing: '1.5' }, null, shown, 'answerStack')], 'details')\n : null,\n ],\n 'panel',\n )\n })\n noted(scope, panels)\n return tree.add('muiStack', { spacing: '1.5' }, null, panels, 'faq')\n}\n\n/** A table's cell as the Table element's grid holds it: one line, its pipes escaped. */\nfunction tableCell(text: string): string {\n return aiLayoutAsWritten(text).replace(/\\|/g, '\\\\|')\n}\n\n/** A table of a page brought in: the theme's Table element, every cell's words as written. */\nfunction table(scope: SectionScope, block: AiLayoutBlock): string | null {\n const rows = (block.rows ?? []).filter((row) => row.cells.some((cell) => aiLayoutAsWritten(cell)))\n if (!rows.length) return null\n const width = Math.max(...rows.map((row) => row.cells.length))\n const grid = rows.map((row) => `| ${Array.from({ length: width }, (_, at) => tableCell(row.cells[at] ?? '')).join(' | ')} |`).join('\\n')\n return scope.page.tree.add('dataTable', { rows: grid, headerRow: block.header === true }, null, null, 'table')\n}\n\n/** A label the Tabs element can name a panel by: its words on one line, with no comma it would split at. */\nfunction tabLabel(label: string): string | null {\n const text = aiLayoutAsWritten(label)\n return text && !text.includes(',') && text.length <= AI_TEXT_LIMITS.label ? text : null\n}\n\n/**\n * Tabs of a page brought in: the Tabs element with a panel for each tab,\n * opening on the one the source shows open, where every tab has its panel.\n * A source whose script draws its other panels only when clicked gives a\n * page the open one alone (aglyn.com's plan tabs): then its labels are drawn\n * as the strip they are — the open one filled, the rest outlined — over the\n * panel the source showed, so every label and every word is on the page and\n * no tab opens onto nothing.\n */\nfunction tabs(scope: SectionScope, block: AiLayoutBlock, room: Room): string | null {\n const tree = scope.page.tree\n const given = (block.tabs ?? []).filter((tab) => aiLayoutAsWritten(tab.label) || tab.blocks.length)\n if (!given.length) return null\n const labels = given.map((tab) => tabLabel(tab.label))\n const panels = given.map((tab) => (tab.blocks.length ? compileFlow(scope, tab.blocks, room) : null))\n const whole =\n given.length >= 2 &&\n given.length <= 8 &&\n labels.every((label): label is string => !!label) &&\n new Set(labels.map((label) => label.toLowerCase())).size === labels.length &&\n panels.every(Boolean)\n if (whole) {\n const open = given.findIndex((tab) => tab.selected)\n return tree.add(\n 'muiTabs',\n { labels: (labels as string[]).join('\\n'), variant: 'scrollable', ...(open > 0 ? { opensOn: labels[open] } : {}) },\n null,\n given.map((_, at) => tree.add('muiTabPanel', { label: labels[at] }, null, [panels[at] as string], 'tabPanel')),\n 'tabs',\n )\n }\n const strip = given\n .map((tab) => ({ text: aiLayoutAsWritten(tab.label), selected: tab.selected === true }))\n .filter((tab) => tab.text)\n .map((tab) =>\n tab.selected\n ? tree.add(\n 'muiPaper',\n { variant: 'elevation', elevation: '0' },\n { bgcolor: 'primary.main' },\n [tree.add('muiBox', null, { py: 0.75, color: 'primary.contrastText' }, [tree.add('muiTypography', { children: tab.text, variant: 'body2' }, { px: 2 }, null, 'tabLabel')], 'tabWords')],\n 'tab',\n )\n : chip(scope, tab.text, 'tab'),\n )\n const parts = [\n strip.length ? tree.add('muiStack', { direction: 'row', spacing: '1', useFlexGap: true, flexWrap: 'wrap', ...(scope.centered ? { justifyContent: 'center' } : {}) }, null, strip, 'tabStrip') : null,\n ...panels,\n ].filter((id): id is string => !!id)\n if (!parts.length) return null\n return parts.length === 1 ? parts[0] : tree.add('muiStack', { spacing: '4' }, null, parts, 'tabs')\n}\n\n/** A short line on an outlined surface of the theme's own shape: a label, a tag, a tab the source draws as one. */\nfunction chip(scope: SectionScope, words: string, role: string): string {\n const tree = scope.page.tree\n return tree.add('muiPaper', { variant: 'outlined' }, { py: 0.75 }, [tree.add('muiTypography', { children: words, variant: 'body2' }, { px: 2 }, null, `${role}Label`)], role)\n}\n\n/** A strip of logos of a page brought in: each picture at one height, or each short line as a label on an outlined surface. */\nfunction logos(scope: SectionScope, block: AiLayoutBlock): string | null {\n const tree = scope.page.tree\n const ids = (block.items ?? []).flatMap((item): string[] => {\n if (item.picture) {\n scope.page.images += 1\n return [\n tree.add(\n 'image',\n { src: item.picture.src, ...(item.picture.alt ? { alt: item.picture.alt } : { decorative: true }), objectFit: 'contain', width: 'auto', ...(scope.page.images > 1 ? { loading: 'lazy' } : {}) },\n { height: { xs: 32, md: 40 } },\n null,\n 'logo',\n ),\n ]\n }\n const words = aiLayoutAsWritten([item.title, item.text].filter((part) => part.trim()).join(' '))\n return words ? [chip(scope, words, 'chip')] : []\n })\n if (!ids.length) return null\n return tree.add(\n 'muiStack',\n { direction: 'row', spacing: block.items?.some((item) => item.picture) ? '5' : '1.5', useFlexGap: true, flexWrap: 'wrap', alignItems: 'center', ...(scope.centered ? { justifyContent: 'center' } : {}) },\n null,\n noted(scope, ids),\n 'logos',\n )\n}\n\n/**\n * The opening of a page brought in, as the hero its design answer chose\n * around the source's own picture (AGL-4107): its words and one picture of\n * the source's, nothing else. Any other opening is drawn as its source lays\n * it out, its picture where the source placed it.\n */\nfunction importedHero(scope: SectionScope, raw: AiLayoutSection, blocks: readonly AiLayoutBlock[]): string | null {\n const { page } = scope\n if (!page.design || !raw.hero) return null\n const pictures = blocks.filter((block) => block.kind === 'image' && block.picture)\n if (pictures.length !== 1) return null\n const flow = blocks.filter((block) => block.kind !== 'image')\n if (!flow.length || !flow.every((block) => WORD_KINDS.has(block.kind))) return null\n if (!flow.some((block) => speaksHeading(scope, block))) {\n flow.unshift({ kind: 'heading', text: page.plan.title })\n page.settled.push({ at: scope.at, what: \"no heading; the page's title written as its h1\" })\n }\n const lead = flow.findIndex((block) => speaksHeading(scope, block))\n const { style: _style, ...title } = flow[lead]\n flow[lead] = AI_LAYOUT_HALF_HEROES.has(raw.hero) ? title : { ...title, style: 'large' }\n const picture = pictures[0].picture as AiLayoutPicture\n return hero(scope, flow, { alt: picture.alt, given: true, src: picture.src }, raw.hero)\n}\n\n/** The id the compiled page's root is stored under. */\nexport const AI_LAYOUT_PAGE_ROOT_ID = CANVAS_ROOT_ELEMENT_ID\n"],"names":["REUSABLE_INSTANCE_COMPONENT_ID","CANVAS_ROOT_ELEMENT_ID","AI_ICON_COMPONENT_ID","aiIconOfWord","AI_ICON_LIBRARY","AI_INSTANCE_REF_PROP","AI_TEXT_LIMITS","aiPageScrollInteraction","aiLayoutFitText","aiLayoutQuoteGap","aiLayoutWords","AI_LAYOUT_GROUP_KINDS","AI_LAYOUT_MAX_ITEMS","AI_LAYOUT_HALF_HEROES","aiLayoutDesignChoices","aiLayoutFamily","aiLayoutGroupVariant","AI_LAYOUT_FEATURED_RECORDS","AI_LAYOUT_LISTING_ELEMENTS","aiLayoutIsRecordImageAlt","aiLayoutListingAt","aiLayoutRecordHref","aiLayoutRecordImageAltField","aiLayoutRepeatFilterOf","aiStorefrontItemIcons","aiLayoutContactLabel","aiLayoutWithContactLines","AI_LAYOUT_LABELS_EN","aiLayoutLabel","aiLayoutRenamedLabel","aiLayoutResolveLink","aiLayoutSpans","AI_LAYOUT_FRAMES","AiLayoutTreeBuilder","aiLayoutAsWritten","value","replace","trim","sectionLabel","name","index","language","sectionIdOf","AI_LAYOUT_MAX_IMAGES","AI_LAYOUT_HEADLINE_MAX_CHARS","headline","AI_LAYOUT_MAX_STRONG_BANDS","SECTION_PADDING","xs","md","HERO_PADDING","formIdsOf","targets","Set","forms","map","form","id","componentOf","components","find","component","formLivesElsewhere","formPageId","pageId","formSectionOf","sections","plan","planned","findIndex","section","uses","some","ref","has","designed","blocks","block","kind","to","aiCompileLayoutPage","options","tree","formSection","verbatim","contact","page","settled","scrollTo","images","strong","brand","dark","pageIcon","pageIconOf","formsPlaced","itemIds","design","input","choices","pictures","features","splitAt","quotesOnly","drawnBands","bare","rhythm","roots","_","compileSection","rootId","add","nodes","sectionRoots","own","icon","item","items","sparkle","PICTURED_LISTINGS","raw","scope","sectionScope","drawSection","band","listed","listings","pictured","listing","holdsPicture","node","componentId","child","rhythmBand","bandRhythm","above","at","asked","ruled","push","what","settleBand","centered","align","level","headed","itemsLeft","Number","POSITIVE_INFINITY","link","from","heading","text","words","filter","join","placedHere","placePlanned","shopGridAt","shopTitle","listingSection","opening","hero","importedHero","beside","rhythmSection","designSection","cols","length","head","tail","columns","placed","col","undefined","Math","min","filled","column","position","weight","entry","deepest","max","Array","row","flatMap","flat","repeated","every","componentItem","props","groups","isItemGroup","sameShape","columnsAsCards","inOrder","concat","speaks","facts","list","splice","unshift","title","order","first","slice","lead","indexOf","wide","isWideGroup","parts","headId","compileFlow","compileRow","tailId","part","prune","fallback","content","spacing","useFlexGap","container","maxWidth","py","element","ariaLabel","colorScheme","bandSx","sectionIds","pattern","test","most","bgcolor","color","flowId","flow","holdsGroup","disableGutters","plannedForms","plannedComponents","lastCol","at0","asks","kept","only","named","_to","group","like","shapeOf","CARD_COLUMN_KINDS","WORDS_KINDS","cards","buttons","button","places","toLowerCase","size","style","alignItems","spans","span","room","children","flushButtons","direction","flexWrap","justifyContent","compileButton","compileBlock","hasGroup","ids","includes","accent","muted","image","faq","table","tabs","logos","overPhoto","mutedSecondary","secondaryColor","say","place","variant","sx","frame","label","long","itemLevel","itemElement","destination","aiLayoutImportedDestination","linkedWords","onBrand","look","destinationProps","alignSelf","linkTo","exec","screenId","href","url","URL","protocol","toString","target","interactions","AI_LIGHTBOX_GALLERY_KINDS","AI_LAYOUT_LIGHTBOX_TO","aiOpensGalleriesInLightbox","Boolean","lightboxProps","caption","lightbox","lightboxGallery","lightboxCaption","picture","sourcePicture","alt","maxImages","mark","iconId","opensLarge","objectFit","top","left","width","height","display","overflow","borderRadius","aspectRatio","formId","p","declared","values","Object","textProps","entries","keys","propValues","type","instanceValues","texts","titleProp","textProp","noted","across","count","itemSize","perRow","layOut","role","cells","rule1","reusableComponents","AI_LAYOUT_PLACEHOLDER_TITLE","cleanItems","references","takeItems","takeItemsInPlace","importedGroup","instances","retail","picturesLeft","drawn","designedGroup","iconColumns","compactGroup","steps","timeline","groupStyle","step","stat","quote","card","pairs","primary","secondary","quiet","stack","String","padStart","who","importedList","links","renderAs","lines","rows","line","disablePadding","check","importedFaq","divider","panels","defaultExpanded","AI_LAYOUT_MAX_DESIGN_PICTURES","WORD_KINDS","speaksHeading","designedRoot","underHeader","designPicture","frameSx","imageSx","designImage","given","described","decorative","src","loading","standInAlt","designRow","cell","ofWords","_style","sellingHero","last","told","coverClose","coverBand","feature","splitHeads","splitSection","home","chosen","tall","cover","bleedHero","columnHero","collageHero","panelHero","portraitHero","photo","right","featureLeft","rest","lede","actions","ledeId","actionsId","under","pt","pb","minHeight","opacity","measure","mx","zIndex","bandSurface","px","sm","small","bottom","border","borderColor","boxShadow","flexShrink","AI_LAYOUT_RHYTHM_MOST","AI_LAYOUT_RHYTHM_NOTE","featureGroup","itemTitleVariant","headingCase","ruledList","borderTop","flex","half","ceil","lists","second","rowSpacing","columnSpacing","mosaic","portrait","floor","lone","aspect","opens","shop","shopPageOf","LISTING_REPLACES","AI_LAYOUT_POST_CARD_TOKENS","AI_LAYOUT_POST_ADDRESS_TOKENS","listingAllButton","placements","placement","reviewsSection","signupSection","underTitle","_col","all","records","listingElement","AI_LAYOUT_REVIEWS_HEADING","reviewsHeading","reviews","maxItems","AI_LAYOUT_SIGNUP_HEADING","signupHeading","field","signup","buttonLabel","body","products","pages","eyebrow","firstButton","shopAll","AI_LAYOUT_SHOP_ALL","iconWords","word","textAlign","star","featured","shown","source","sort","pageSize","showSort","showCategories","cardStyle","quickAdd","emptyTitle","emptyText","emptyAction","emptyActionLabel","getInTouch","emptyActionHref","recordsElement","postsElement","COLLECTION_INDEX_POSTS","AI_LAYOUT_STORE_EMPTY","storeEmptyTitle","storeEmptyText","textAlone","storeEmptyTextAlone","limit","writing","titleElement","meta","excerpt","more","minWidth","posts","collectionSlug","entriesLimit","gridTemplateColumns","gap","AI_LAYOUT_RECORD_LINK_LABEL","viewDetails","RECORD_KICKER","RECORD_BODY","RECORD_QUESTIONS","RECORD_PEOPLE","aiLayoutRecordCardFields","fields","kicker","questions","photoField","imageField","altField","recordHref","recordBase","repeatDataset","datasetId","repeatLimit","repeatFilter","AI_LAYOUT_PORTRAIT_SIZE","itemPicture","sourceIcon","iconPath","paragraphs","newTab","bullets","said","itemLinks","importedAcross","itemShows","figure","importedItem","itemStyle","titleNode","number","listIconPath","shift","whole","answer","tableCell","grid","headerRow","header","tabLabel","tab","labels","open","selected","opensOn","strip","elevation","chip","AI_LAYOUT_PAGE_ROOT_ID"],"mappings":";;AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,8BAA8B,QAAQ,iDAAgD;AAC/F,SAASC,sBAAsB,QAAQ,2CAA0C;AACjF,SACEC,oBAAoB,EACpBC,YAAY,EACZC,eAAe,QAEV,gCAA4B;AACnC,SAASC,oBAAoB,QAAQ,6BAAyB;AAC9D,SAASC,cAAc,QAAQ,2BAAuB;AACtD,SAASC,uBAAuB,QAAQ,8BAA0B;AAClE,SACEC,eAAe,EACfC,gBAAgB,EAChBC,aAAa,QAER,sBAAkB;AACzB,SACEC,qBAAqB,EACrBC,mBAAmB,QASd,0BAAsB;AAC7B,SACEC,qBAAqB,EACrBC,qBAAqB,EACrBC,cAAc,EACdC,oBAAoB,QAKf,wBAAoB;AAC3B,SACEC,0BAA0B,EAC1BC,0BAA0B,EAC1BC,wBAAwB,EACxBC,iBAAiB,EACjBC,kBAAkB,EAClBC,2BAA2B,EAC3BC,sBAAsB,QAIjB,0BAAsB;AAC7B,SAASC,qBAAqB,QAAQ,4BAAwB;AAC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AAK5F,QAAQ4F,GAAG;IAAC,GAAGnS,IAAI0C,IAAI;AACxF;AAEA,qDAAqD,GACrD,OAAO,MAAMwb,yBAAyBzlB,uBAAsB"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/layout-language/ai-layout-compiler.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 { REUSABLE_INSTANCE_COMPONENT_ID } from '@aglyn/aglyn/app-utils/reusable-component-keys'\nimport { CANVAS_ROOT_ELEMENT_ID } from '@aglyn/aglyn/foundation/constants/canvas'\nimport {\n AI_ICON_COMPONENT_ID,\n aiIconOfWord,\n AI_ICON_LIBRARY,\n type AiIconLibraryEntry,\n} from '../runtime/ai-icon-library'\nimport { AI_INSTANCE_REF_PROP } from '../runtime/ai-node-tree'\nimport { AI_TEXT_LIMITS } from '../runtime/ai-palette'\nimport { aiPageScrollInteraction } from '../runtime/ai-page-links'\nimport {\n aiLayoutFitText,\n aiLayoutQuoteGap,\n aiLayoutWords,\n type AiLayoutTextPlace,\n} from './ai-layout-copy'\nimport {\n AI_LAYOUT_GROUP_KINDS,\n AI_LAYOUT_MAX_ITEMS,\n type AiLayoutBand,\n type AiLayoutBlock,\n type AiLayoutGroupStyle,\n type AiLayoutItem,\n type AiLayoutLink,\n type AiLayoutPicture,\n type AiLayoutSection,\n type AiLayoutSettlement,\n type AiLayoutTab,\n} from './ai-layout-language'\nimport {\n AI_LAYOUT_HALF_HEROES,\n aiLayoutDesignChoices,\n aiLayoutFamily,\n aiLayoutGroupVariant,\n type AiLayoutDesign,\n type AiLayoutDesignChoices,\n type AiLayoutGroupVariant,\n type AiLayoutHeroVariant,\n} from './ai-layout-design'\nimport {\n AI_LAYOUT_FEATURED_RECORDS,\n AI_LAYOUT_LISTING_ELEMENTS,\n aiLayoutIsRecordImageAlt,\n aiLayoutListingAt,\n aiLayoutRecordHref,\n aiLayoutRecordImageAltField,\n aiLayoutRepeatFilterOf,\n type AiLayoutListing,\n type AiLayoutListingFilter,\n type AiLayoutListingRole,\n} from './ai-layout-listings'\nimport { aiStorefrontItemIcons } from './ai-layout-storefront'\nimport { aiLayoutContactLabel, aiLayoutWithContactLines } from './ai-layout-contact'\nimport { AI_LAYOUT_LABELS_EN, aiLayoutLabel } from './ai-layout-labels'\nimport {\n aiLayoutRenamedLabel,\n aiLayoutResolveLink,\n type AiLayoutDestination,\n type AiLayoutLinkScope,\n type AiLayoutTargets,\n} from './ai-layout-links'\nimport {\n aiLayoutSpans,\n AI_LAYOUT_FRAMES,\n AiLayoutTreeBuilder,\n type AiLayoutRawTree,\n} from './ai-layout-tree'\n\n/**\n * The layout language compiler (AGL-3660): a page designed in the language\n * (`ai-layout-language.ts`) becomes the element tree the page stores — built\n * from the palette's elements and the theme's tokens only, so the doctrine's\n * building rules hold by construction rather than by a re-ask.\n *\n * What the compiler decides, so no model has to:\n *\n * - STRUCTURE. A section is a semantic `section` band around a Container at\n * a stock width, its content a Stack on the spacing scale; a row of\n * columns is a Grid container whose items are sized `xs:12 md:N` from the\n * relative widths, full width on a phone; a group of cards is a Grid of\n * sized items, or a Stack where it would be one column.\n * - THE OUTLINE. The first section's first heading is the page's one h1 (the\n * plan's title stands in where it gave none); every other section opens at\n * h2; a card's title is one level under its section's heading.\n * - TOKENS. Colors are palette roles, never values: a `brand` band is\n * `primary.main` with its contrast text, a `dark` band pins the site's dark\n * scheme, a `soft` band is the paper surface. So a band reads in the\n * visitor's light or dark mode alike.\n * - LINKS. A button goes to a real page id, a section of this page through\n * the platform's Scroll to element interaction, or an address the brief\n * gave (`ai-layout-links.ts`); one with nowhere to go is left out.\n * - THE PLAN. A form or a component the plan places in a section is placed\n * there, by its id, whether or not the answer remembered it.\n * - RULE 1. Where the workspace keeps reusable components, a section's\n * repeated items are instances of the component its plan places; with\n * none to place they are drawn in their compact form, a title over its\n * text, which is smaller than a block worth a component. A workspace that\n * keeps none (Free) draws its repeats in full.\n * - RULES 8, 9, 14, 16. Seven items a group at most; every picture carries\n * its description as alt text; copy fitted to its place at a clean\n * boundary, with any phone number or email the brief did not give written\n * as a gap; no wrapper around a lone wrapper, no empty element, and no\n * multi-key inline style repeated across a page.\n */\n\nexport interface AiLayoutPagePlan {\n /** The page's title in its plan: the h1 where the first section names none. */\n title: string\n sections: ReadonlyArray<{\n name: string\n uses: readonly string[]\n items: number\n }>\n}\n\nexport interface AiLayoutCompileOptions {\n /**\n * Whether the workspace keeps reusable components (AGL-3030). Where it does,\n * rule 1 holds: repeated items are instances of a component the plan\n * places, or drawn in their compact form.\n */\n reusableComponents: boolean\n /**\n * The ids the page stores its sections under, in plan order\n * (`aiPageSectionNodeId`): each section root is written under its own, and\n * a link to a section scrolls to it. Absent, `section-<n>`.\n */\n sectionIds?: readonly string[]\n /**\n * The site the page belongs to — its kind, its seed and whether this is its\n * home — which the designer layer draws the page's sections for\n * (`ai-layout-design.ts`): a photo hero, pictures beside words, work as an\n * uneven grid of pictures. Absent, the compiler's first design.\n */\n design?: AiLayoutDesign\n /**\n * The site's language (AGL-3760), a code such as `es`: the words the\n * compiler writes itself — \"See all\", a post's link — are in it where it is\n * one `ai-layout-labels.ts` lists. Absent, English.\n */\n language?: string\n /**\n * A page brought in from its owner's own website (AGL-4107): every word is\n * the source's and is drawn exactly as given — never fitted, cut, guarded\n * or left out — and so is every item of every group, every picture (the\n * source's own, never a stand-in), every band and every link. The page's\n * structure is the source's, read by code (`ai-site-import-compile.ts`), so\n * none of the moves that rearrange a model's design applies: no rhythm, no\n * like columns folded into cards, no third strong band settled soft, no\n * contact lines added. Only its opening may take a hero around the\n * source's own picture, as its design answer chose.\n */\n verbatim?: boolean\n}\n\n/** Words exactly as given, one space between them: how a page brought in shows them (AGL-4107). */\nexport function aiLayoutAsWritten(value: unknown): string {\n return typeof value === 'string' ? value.replace(/\\s+/g, ' ').trim() : ''\n}\n\n/**\n * What a section is called to a screen reader: its plan name, with any note\n * the plan left in brackets taken out. A live blog plan (2026-10-09) named a\n * section \"reader notes and kind words [to be added by owner]\"; carried into\n * the label it read as a gap, and the page's gap pass took the section out.\n */\nfunction sectionLabel(name: string, index: number, language?: string): string {\n return aiLayoutFitText(name.replace(/\\[[^\\]]*\\]/g, ' ').replace(/\\s+/g, ' ').trim(), 'note', language) || `Section ${index + 1}`\n}\n\n/** A section root's id where the caller gives none. */\nfunction sectionIdOf(index: number): string {\n return `section-${index + 1}`\n}\n\nexport interface AiLayoutCompiledPage {\n tree: AiLayoutRawTree\n /** Each plan section's root, by its compiled id, in plan order. */\n sectionRoots: string[]\n /** A button's compiled id → the plan section a click scrolls to. */\n scrollTo: Record<string, number>\n settled: AiLayoutSettlement[]\n /**\n * Each plan section's repeated items — cards, steps, figures, component\n * instances, list lines and questions — by the id of the element that\n * draws each (AGL-3660), so a check can count what a visitor sees after\n * anything later takes words out.\n */\n itemIds: string[][]\n /** Plan sections whose only items were quotes, which a published page leaves out (AGL-3676). */\n quotesOnly: number[]\n}\n\n/** The most pictures a page carries; each beyond it is one more empty slot to fill. */\nexport const AI_LAYOUT_MAX_IMAGES = 3\n\n/** The most characters a heading style holds; a longer heading of a page brought in is set as a subtitle (AGL-4107). */\nexport const AI_LAYOUT_HEADLINE_MAX_CHARS = AI_TEXT_LIMITS.headline\n\n/** The most `brand` or `dark` bands a page shows; more and none stands out. */\nexport const AI_LAYOUT_MAX_STRONG_BANDS = 2\n\nconst SECTION_PADDING = { xs: 8, md: 12 } as const\nconst HERO_PADDING = { xs: 10, md: 14 } as const\n\n/** Everything one page's compile shares. */\nexport interface PageScope {\n tree: AiLayoutTreeBuilder\n plan: AiLayoutPagePlan\n targets: AiLayoutTargets\n options: AiLayoutCompileOptions\n settled: AiLayoutSettlement[]\n scrollTo: Record<string, number>\n images: number\n strong: Record<'brand' | 'dark', number>\n /** The section of this page that places the site's form, if one does. */\n formSection: number | null\n /** The icon a picture shows until the owner places one, when its block names none. */\n pageIcon: AiIconLibraryEntry\n /** The forms this page already places, each once. */\n formsPlaced: Set<string>\n /** Each section's repeated items, by the id of the element that draws each (AGL-3660). */\n itemIds: string[][]\n /** The site's design and the choices its seed made, where the page is drawn with one. */\n design: { input: AiLayoutDesign; choices: AiLayoutDesignChoices } | null\n /** Stand-in pictures the design placed beside the model's own (`images`). */\n pictures: number\n /** Sections of words the design set beside a picture. */\n features: number\n /** The last section whose heading the design set beside its items: never two in a row. */\n splitAt: number\n /** Sections whose only items were quotes, left out (AGL-3676). */\n quotesOnly: number[]\n /**\n * The band each section was drawn in, by plan index: what the next one's\n * rhythm reads (AGL-4065). A frame, which draws no page sections, keeps none.\n */\n drawnBands?: AiLayoutBand[]\n /** How many sections in a row, up to this one, showed no picture (AGL-4065). */\n bare?: number\n /** Sections the design set beside a photo because they were the third without one (AGL-4065). */\n rhythm?: number\n}\n\n/** Everything one section's compile shares. */\nexport interface SectionScope {\n page: PageScope\n index: number\n at: string\n band: AiLayoutBand\n centered: boolean\n /** The level of the section's own heading: 1 on the first section, 2 after. */\n level: number\n /**\n * A section of the site's frame — its footer — whose headings are labels:\n * a layout carries no heading outline of its own, since every page brings\n * its own (rule 11).\n */\n frame?: boolean\n /** Whether the section's own heading has been written. */\n headed: boolean\n link: AiLayoutLinkScope\n /** Like items the section may still show (rule 8), across its groups. */\n itemsLeft: number\n /** What the section is about — its plan name and its headings — which picks how its groups are drawn. */\n words?: string\n /** Whether the section's words sit over a photo, where they take the band's own color. */\n overPhoto?: boolean\n /** The section's first heading as the model wrote it: what a stand-in picture is of. */\n heading?: string\n /** A group style the section's arrangement settled, over the one its words would pick. */\n groupStyle?: AiLayoutGroupVariant\n}\n\nconst formIdsOf = (targets: AiLayoutTargets): Set<string> =>\n new Set(targets.forms.map((form) => form.id))\nconst componentOf = (targets: AiLayoutTargets, id: string | undefined) =>\n id\n ? (targets.components.find((component) => component.id === id) ?? null)\n : null\n\n/**\n * The section of this page that places a form: one whose plan places one, or\n * whose design places one by its id.\n */\n/** Whether the site's form lives on another page of the site than this one. */\nfunction formLivesElsewhere(targets: AiLayoutTargets): boolean {\n return !!targets.formPageId && targets.formPageId !== targets.pageId\n}\n\nfunction formSectionOf(\n sections: readonly AiLayoutSection[],\n plan: AiLayoutPagePlan,\n targets: AiLayoutTargets,\n): number | null {\n const forms = formIdsOf(targets)\n const planned = plan.sections.findIndex((section) =>\n section.uses.some((ref) => forms.has(ref)),\n )\n if (planned !== -1) return planned\n // A form drawn on a page it does not live on becomes a button to its page (AGL-3899).\n if (formLivesElsewhere(targets)) return null\n const designed = sections.findIndex((section) =>\n section.blocks.some(\n (block) => block.kind === 'form' && (!block.to || forms.has(block.to)),\n ),\n )\n return designed === -1 ? null : designed\n}\n\n/** Compiles a page designed in the layout language into the tree it stores. */\nexport function aiCompileLayoutPage(\n designed: readonly AiLayoutSection[],\n plan: AiLayoutPagePlan,\n targets: AiLayoutTargets,\n options: AiLayoutCompileOptions,\n): AiLayoutCompiledPage {\n const tree = new AiLayoutTreeBuilder()\n const formSection = formSectionOf(designed, plan, targets)\n // The page a visitor opens to get in touch shows the phone and email the\n // business gave, as links, wherever the design did not (AGL-3979). A page\n // brought in shows what its source shows, and nothing more (AGL-4107).\n const sections = options.verbatim ? designed : aiLayoutWithContactLines(designed, formSection, targets.contact)\n const page: PageScope = {\n tree,\n plan,\n targets,\n options,\n settled: [],\n scrollTo: {},\n images: 0,\n strong: { brand: 0, dark: 0 },\n formSection,\n pageIcon: pageIconOf(sections),\n formsPlaced: new Set(),\n itemIds: plan.sections.map(() => []),\n design: options.design ? { input: options.design, choices: aiLayoutDesignChoices(options.design) } : null,\n pictures: 0,\n features: 0,\n splitAt: -2,\n quotesOnly: [],\n drawnBands: [],\n bare: 0,\n rhythm: 0,\n }\n const roots = plan.sections.map((_, index) => {\n const section = sections[index] ?? { blocks: [] }\n return compileSection(page, section, index)\n })\n const rootId = tree.add(\n 'div',\n null,\n null,\n roots,\n 'page',\n CANVAS_ROOT_ELEMENT_ID,\n )\n return {\n tree: { rootId, nodes: tree.nodes },\n sectionRoots: roots,\n scrollTo: page.scrollTo,\n settled: page.settled,\n itemIds: page.itemIds,\n quotesOnly: page.quotesOnly,\n }\n}\n\n/** The first icon the design names anywhere, else a sparkle: what an empty picture shows. */\nfunction pageIconOf(sections: readonly AiLayoutSection[]): AiIconLibraryEntry {\n for (const section of sections) {\n for (const block of section.blocks) {\n const own = aiIconOfWord(block.icon)\n if (own) return own\n for (const item of block.items ?? []) {\n const icon = aiIconOfWord(item.icon)\n if (icon) return icon\n }\n }\n }\n return AI_ICON_LIBRARY.sparkle\n}\n\n// ── A section ─────────────────────────────────────────────────────────────\n\n/** The listings whose element shows each record's picture: products, posts and events (AGL-4065). */\nconst PICTURED_LISTINGS: ReadonlySet<AiLayoutListing['kind']> = new Set(['products', 'posts', 'events'])\n\n/**\n * A section drawn, and what the next one reads of it (AGL-4065): the band it\n * was drawn in, and whether it showed a picture — its own, a stand-in, a\n * record's photo or a listing that shows its records' pictures.\n */\nfunction compileSection(\n page: PageScope,\n raw: AiLayoutSection,\n index: number,\n): string {\n const scope = sectionScope(page, raw, index)\n const id = drawSection(page, raw, index, scope)\n page.drawnBands ??= []\n page.drawnBands[index] = scope.band\n const listed = aiLayoutListingAt(page.targets.listings ?? [], page.targets.pageId, index)\n const pictured = (!!listed && PICTURED_LISTINGS.has(listed.listing.kind)) || holdsPicture(page.tree, id)\n page.bare = pictured ? 0 : (page.bare ?? 0) + 1\n return id\n}\n\n/** Whether a compiled part holds an Image anywhere under it. */\nfunction holdsPicture(tree: AiLayoutTreeBuilder, id: string): boolean {\n const node = tree.nodes[id]\n if (!node) return false\n return node.componentId === 'image' || (node.nodes ?? []).some((child) => holdsPicture(tree, child))\n}\n\n/**\n * The band a section is drawn in where the site's design keeps a rhythm\n * (AGL-4065): on a `plain` rhythm one ground, every soft band plain; on an\n * `alternate` rhythm the model's bands, except a plain or soft band that\n * would meet the same band above it, which takes the other. Brand and dark\n * bands, and the first section's, are the model's.\n */\nfunction rhythmBand(page: PageScope, index: number, band: AiLayoutBand): AiLayoutBand {\n if (!page.design || index === 0 || (band !== 'plain' && band !== 'soft')) return band\n if (page.design.choices.bandRhythm === 'plain') return 'plain'\n const above = page.drawnBands?.[index - 1]\n if (above !== band) return band\n return band === 'plain' ? 'soft' : 'plain'\n}\n\nfunction sectionScope(page: PageScope, raw: AiLayoutSection, index: number): SectionScope {\n const at = `sections[${index}]`\n const asked = raw.band ?? 'plain'\n // A page brought in keeps the source's bands, every one (AGL-4107).\n const verbatim = page.options.verbatim === true\n const ruled = verbatim ? asked : rhythmBand(page, index, asked)\n if (ruled !== asked) page.settled.push({ at: `${at}.band`, what: `drawn ${ruled}: the page's ${page.design?.choices.bandRhythm} band rhythm` })\n const band = verbatim ? asked : settleBand(page, ruled, at)\n return {\n page,\n index,\n at,\n band,\n centered: raw.align === 'center',\n level: index === 0 ? 1 : 2,\n headed: false,\n itemsLeft: verbatim ? Number.POSITIVE_INFINITY : AI_LAYOUT_MAX_ITEMS,\n link: {\n sections: page.plan.sections.map((section) => section.name),\n from: index,\n formSection: page.formSection,\n },\n heading: raw.blocks.find((block) => block.kind === 'heading')?.text,\n words: [\n page.plan.sections[index]?.name ?? '',\n ...raw.blocks.filter((block) => block.kind === 'heading' || block.kind === 'eyebrow').map((block) => block.text ?? ''),\n ].join(' '),\n }\n}\n\nfunction drawSection(\n page: PageScope,\n raw: AiLayoutSection,\n index: number,\n scope: SectionScope,\n): string {\n const { at, band } = scope\n const verbatim = page.options.verbatim === true\n // A quote is a gap the owner fills, and a published page shows no gap\n // (AGL-3660); a page brought in quotes its own customers' words (AGL-4107).\n const blocks = placePlanned(scope, raw).filter((block) => {\n if (block.kind !== 'quotes' || verbatim) return true\n page.settled.push({ at, what: 'a quotes group left out: a published page shows no customer words the brief did not give' })\n return false\n })\n // A section whose only items were those quotes has none left to show, and is\n // not asked for them again: no answer can give words the brief did not (AGL-3676).\n if (\n !verbatim &&\n raw.blocks.some((block) => block.kind === 'quotes') &&\n !blocks.some((block) => AI_LAYOUT_GROUP_KINDS.has(block.kind) || block.kind === 'component')\n ) {\n page.quotesOnly.push(index)\n }\n // A store's Shop page opens on its grid (AGL-3676): its first section is a\n // short title bar, never a hero, so the products start above the fold.\n if (!verbatim && index === 0 && shopGridAt(page) > 0) return shopTitle(scope, blocks)\n // A section the site's records fill — its catalog, its blog — shows them\n // through the element that keeps them, around the words the design gave it (AGL-3676).\n const listed = verbatim ? null : aiLayoutListingAt(page.targets.listings ?? [], page.targets.pageId, index)\n if (listed) return listingSection(scope, blocks, listed)\n // The site's design draws the sections it has an arrangement for (AGL-3660),\n // the third band in a row with no picture beside one (AGL-4065). A page\n // brought in takes only its hero, around the source's own picture (AGL-4107).\n if (verbatim) {\n const opening = index === 0 && raw.hero ? importedHero(scope, raw, blocks) : null\n if (opening) return opening\n } else if (page.design) {\n const beside = rhythmSection(scope, raw, blocks)\n if (beside) return beside\n const designed = designSection(scope, raw, blocks)\n if (designed) return designed\n }\n const cols = raw.cols && raw.cols.length >= 2 ? raw.cols : null\n // Above the row, the row's columns, and below it.\n const head: AiLayoutBlock[] = []\n const tail: AiLayoutBlock[] = []\n const columns: AiLayoutBlock[][] = cols ? cols.map(() => []) : []\n let placed = false\n for (const block of blocks) {\n if (cols && block.col !== undefined) {\n columns[Math.min(block.col, cols.length - 1)].push(block)\n placed = true\n } else if (placed) {\n tail.push(block)\n } else {\n head.push(block)\n }\n }\n let filled = columns\n .map((column, position) => ({ column, weight: cols?.[position] ?? 1 }))\n .filter((entry) => entry.column.length)\n // A row whose columns each place the same component, one instance a\n // column or more, is that component's group of cards: the compiler lays\n // its instances out once, rather than one like Grid a column (rule 1).\n // Row by row, as the columns showed them: the first of each column, then the second.\n const deepest = Math.max(0, ...filled.map((entry) => entry.column.length))\n const placedHere = Array.from({ length: deepest }, (_, row) =>\n filled.flatMap((entry) => (entry.column[row] ? [entry.column[row]] : [])),\n ).flat()\n const repeated = placedHere[0]?.kind === 'component' ? componentOf(page.targets, placedHere[0].to) : null\n if (\n !verbatim &&\n filled.length >= 2 &&\n repeated &&\n placedHere.every((block) => block.kind === 'component' && block.to === repeated.id)\n ) {\n head.push({ kind: 'cards', to: repeated.id, items: placedHere.map((block) => componentItem(block, repeated.props)) })\n page.settled.push({ at, what: `${placedHere.length} ${repeated.name} instances in ${filled.length} columns drawn as one group` })\n filled = []\n }\n // A row whose columns each hold only one kind of group — a card a column —\n // is that group, laid out by the compiler rather than column by column.\n const groups = filled.flatMap((entry) => entry.column)\n if (\n !verbatim &&\n filled.length >= 2 &&\n groups.every(\n (block) => isItemGroup(block) && block.kind === groups[0].kind && block.to === groups[0].to,\n )\n ) {\n head.push({ ...groups[0], col: undefined, items: groups.flatMap((block) => block.items ?? []) })\n page.settled.push({ at, what: `a ${groups[0].kind} group split over ${filled.length} columns drawn as one` })\n filled = []\n }\n // A row whose columns all say the same kind of thing, three or more across,\n // is a group of cards: one design, the words the columns gave.\n if (!verbatim && filled.length >= 3 && sameShape(filled.map((entry) => entry.column))) {\n head.push(...columnsAsCards(filled.map((entry) => entry.column)))\n page.settled.push({\n at,\n what: `${filled.length} like columns drawn as cards`,\n })\n filled = []\n }\n if (filled.length === 1) {\n // One column with anything in it is no row.\n head.push(...filled[0].column)\n filled = []\n }\n // The section's heading leads its outline: a heading with no words is no\n // heading, the first section always carries the page's one h1, and a\n // heading written after a group whose titles sit under it moves above it.\n const inOrder = () =>\n head.concat(\n filled.flatMap((entry) => entry.column),\n tail,\n )\n const speaks = (block: AiLayoutBlock) =>\n block.kind === 'heading' &&\n !!(verbatim ? aiLayoutAsWritten(block.text) : aiLayoutWords(block.text, 'heading', page.targets.facts, page.options.language))\n for (const list of [head, tail, ...filled.map((entry) => entry.column)]) {\n for (let at = list.length - 1; at >= 0; at -= 1)\n if (list[at].kind === 'heading' && !speaks(list[at])) list.splice(at, 1)\n }\n if (index === 0 && !inOrder().some(speaks)) {\n head.unshift({ kind: 'heading', text: page.plan.title })\n page.settled.push({\n at,\n what: \"no heading; the page's title written as its h1\",\n })\n }\n const order = inOrder()\n const first = order.findIndex(speaks)\n if (\n !verbatim &&\n first > 0 &&\n order\n .slice(0, first)\n .some(\n (block) =>\n block.kind === 'cards' ||\n block.kind === 'steps' ||\n block.kind === 'component',\n )\n ) {\n const lead = order[first]\n for (const list of [head, tail, ...filled.map((entry) => entry.column)]) {\n const at = list.indexOf(lead)\n if (at !== -1) list.splice(at, 1)\n }\n head.unshift({ ...lead, col: undefined })\n page.settled.push({\n at,\n what: 'the heading moved above the group it heads',\n })\n }\n filled = filled.filter((entry) => entry.column.length)\n if (filled.length === 1) {\n head.push(...filled[0].column)\n filled = []\n }\n const wide =\n filled.length > 0 || [...head, ...tail].some((block) => isWideGroup(block))\n const parts: string[] = []\n const headId = compileFlow(scope, head, 'full')\n if (headId) parts.push(centered(scope, headId, wide))\n if (filled.length) parts.push(compileRow(scope, filled))\n const tailId = compileFlow(scope, tail, 'full')\n if (tailId) parts.push(centered(scope, tailId, wide))\n // A frame whose content came to nothing is taken out, leaves first.\n for (let at = parts.length - 1; at >= 0; at -= 1) {\n page.tree.prune(parts[at])\n const part = page.tree.nodes[parts[at]]\n if (AI_LAYOUT_FRAMES.has(part.componentId) && !part.nodes?.length) {\n delete page.tree.nodes[parts[at]]\n parts.splice(at, 1)\n }\n }\n if (!parts.length) {\n // Nothing the design gave this section could be shown: it keeps its\n // place on the page under the name its plan gives it.\n const fallback = compileFlow(\n scope,\n [\n {\n kind: 'heading',\n text: page.plan.sections[index]?.name || page.plan.title,\n },\n ],\n 'full',\n )\n if (fallback) parts.push(fallback)\n page.settled.push({\n at,\n what: 'nothing to show; the section named by its plan',\n })\n }\n const tree = page.tree\n const content =\n parts.length === 1\n ? parts[0]\n : // Gap, not margins: a stack's margin spacing resets its children's\n // margins, which un-centers a reading-width head (AGL-3660).\n tree.add('muiStack', { spacing: '6', useFlexGap: true }, null, parts, 'content')\n const container = tree.add(\n 'muiContainer',\n { maxWidth: wide ? 'lg' : 'md' },\n { py: index === 0 ? { ...HERO_PADDING } : { ...SECTION_PADDING } },\n [content],\n 'container',\n )\n const name = page.plan.sections[index]?.name?.trim() || `Section ${index + 1}`\n return tree.add(\n 'section',\n {\n element: 'section',\n ariaLabel: sectionLabel(name, index, page.options.language),\n ...(band === 'dark' ? { colorScheme: 'dark' } : {}),\n },\n bandSx(band),\n [container],\n 'section',\n page.options.sectionIds?.[index] ?? sectionIdOf(index),\n )\n}\n\n/**\n * A component block's prop values as a card item: its title-like prop as the\n * title and its text-like prop as the text, which `instanceValues` writes\n * back into the same props.\n */\nfunction componentItem(block: AiLayoutBlock, props: Record<string, string>): AiLayoutItem {\n // An item that names no prop is the card itself, written as a cards item.\n const own = (block.items ?? []).find((item) => !(item.title in props) && (item.title.trim() || item.text.trim()))\n if (own && !(block.items ?? []).some((item) => item.title in props)) return { title: own.title, text: own.text }\n const value = (pattern: RegExp) =>\n (block.items ?? []).find((item) => item.title in props && pattern.test(item.title) && item.text.trim())?.text ?? ''\n const title = value(/title|name|heading|label|question|figure|value/i) || block.text || ''\n const text = value(/text|description|body|summary|copy|answer|detail|caption/i)\n return { title, text }\n}\n\n/** A band the page has room for: past two brand or two dark bands, a soft one instead. */\nfunction settleBand(\n page: PageScope,\n band: AiLayoutBand,\n at: string,\n): AiLayoutBand {\n if (band !== 'brand' && band !== 'dark') return band\n // A storefront keeps one dark band at most (AGL-3676): the beta.237 Willow\n // Wick home ran its text bands dark, and read as big empty dark slabs\n // between the products.\n const most = band === 'dark' && page.design && aiLayoutFamily(page.design.input.kind) === 'retail' ? 1 : AI_LAYOUT_MAX_STRONG_BANDS\n if (page.strong[band] >= most) {\n page.settled.push({\n at: `${at}.band`,\n what: `a third ${band} band drawn soft`,\n })\n return 'soft'\n }\n page.strong[band] += 1\n return band\n}\n\n/** A band's own colors, as palette roles: the dark band pins the scheme instead. */\nexport function bandSx(band: AiLayoutBand): Record<string, unknown> | null {\n if (band === 'soft') return { bgcolor: 'background.paper' }\n if (band === 'brand')\n return { bgcolor: 'primary.main', color: 'primary.contrastText' }\n return null\n}\n\n/** A group whose items sit side by side. */\nfunction isItemGroup(block: AiLayoutBlock): boolean {\n return block.kind === 'cards' || block.kind === 'steps' || block.kind === 'stats' || block.kind === 'quotes'\n}\n\n/** Whether a block spans more than a reading column: a row of several items, or a table, tabs or logos of a page brought in. */\nfunction isWideGroup(block: AiLayoutBlock): boolean {\n if (block.kind === 'table' || block.kind === 'tabs' || block.kind === 'logos') return true\n return (\n (block.kind === 'cards' ||\n block.kind === 'steps' ||\n block.kind === 'stats' ||\n block.kind === 'quotes') &&\n (block.items?.length ?? 0) >= 2 &&\n // A page brought in lays a group out as its source does: one to a row reads at a reading width.\n block.columns !== 1\n )\n}\n\n/** A full-width flow centered on a wide section is held to a reading width. */\nfunction centered(scope: SectionScope, flowId: string, wide: boolean): string {\n const flow = scope.page.tree.nodes[flowId]\n const holdsGroup = (flow.nodes ?? []).some(\n (id) => scope.page.tree.nodes[id]?.componentId === 'muiGrid',\n )\n if (!wide || !scope.centered || holdsGroup) return flowId\n return scope.page.tree.add(\n 'muiContainer',\n { maxWidth: 'md', disableGutters: true },\n null,\n [flowId],\n 'measure',\n )\n}\n\n/**\n * The section's blocks with what its plan places in it: a form or a\n * component the plan line names and the design left out is added where the\n * section ends, and a `form` or `component` block naming nothing takes the\n * one the plan line names.\n */\nfunction placePlanned(\n scope: SectionScope,\n raw: AiLayoutSection,\n): AiLayoutBlock[] {\n const { page, index, at } = scope\n const forms = formIdsOf(page.targets)\n const uses = page.plan.sections[index]?.uses ?? []\n const plannedForms = uses.filter((ref) => forms.has(ref))\n const plannedComponents = uses.filter((ref) => componentOf(page.targets, ref))\n const blocks = raw.blocks.map((block) => ({\n ...block,\n ...(block.items ? { items: [...block.items] } : {}),\n }))\n const lastCol =\n raw.cols && raw.cols.length >= 2 ? raw.cols.length - 1 : undefined\n // A form the design drew where the plan places none, on a page the form\n // does not live on, is that page's way to it (AGL-3899): a button to the\n // page that holds the form, never a second copy of the form.\n if (!plannedForms.length && formLivesElsewhere(page.targets)) {\n const at0 = blocks.findIndex((block) => block.kind === 'form')\n if (at0 !== -1) {\n const asks = blocks.some((block) => block.kind === 'button' && (block.to === 'form' || block.to === `page:${page.targets.formPageId}`))\n const col = blocks[at0].col\n const kept = blocks.filter((block) => block.kind !== 'form')\n if (!asks) {\n kept.splice(at0, 0, {\n kind: 'button',\n text: aiLayoutLabel('getInTouch', page.options.language),\n to: 'form',\n ...(col !== undefined ? { col } : {}),\n })\n }\n blocks.splice(0, blocks.length, ...kept)\n page.settled.push({ at, what: 'a form on a page it does not live on; a button to its page instead' })\n }\n }\n for (const block of blocks) {\n if (block.kind === 'form' && !(block.to && forms.has(block.to))) {\n const only =\n page.targets.forms.length === 1 ? page.targets.forms[0].id : undefined\n block.to = plannedForms[0] ?? only\n }\n if (\n (block.kind === 'component' || block.kind === 'cards') &&\n block.to &&\n !componentOf(page.targets, block.to)\n ) {\n if (block.kind === 'component') block.to = plannedComponents[0]\n else delete block.to\n }\n if (block.kind === 'component' && !block.to) block.to = plannedComponents[0]\n // A group whose every item names the same component is that component's\n // placements (AGL-3660): the design put the id on its items, not the block.\n if (AI_LAYOUT_GROUP_KINDS.has(block.kind) && !block.to && block.items?.length) {\n const named = block.items[0]?.to\n if (named && componentOf(page.targets, named) && block.items.every((item) => item.to === named)) {\n block.to = named\n block.items = block.items.map(({ to: _to, ...item }) => item)\n }\n }\n }\n for (const form of plannedForms) {\n if (!blocks.some((block) => block.kind === 'form' && block.to === form)) {\n blocks.push({\n kind: 'form',\n to: form,\n ...(lastCol !== undefined ? { col: lastCol } : {}),\n })\n page.settled.push({ at, what: `the planned form ${form} placed` })\n }\n }\n for (const component of plannedComponents) {\n if (\n blocks.some(\n (block) =>\n (block.kind === 'component' || block.kind === 'cards') &&\n block.to === component,\n )\n )\n continue\n // A group the design drew where the plan places a component is that component's placements.\n const group = blocks.find(\n (block) =>\n AI_LAYOUT_GROUP_KINDS.has(block.kind) &&\n block.kind !== 'faq' &&\n block.kind !== 'list' &&\n !block.to,\n )\n if (group) {\n // Every group of that kind the design split over the row's columns, so\n // each item of the row is drawn alike (AGL-3660), never the first alone.\n for (const like of blocks) {\n if (like.kind === group.kind && !like.to) like.to = component\n }\n continue\n }\n blocks.push({\n kind: 'component',\n to: component,\n ...(lastCol !== undefined ? { col: lastCol } : {}),\n })\n page.settled.push({ at, what: `the planned component ${component} placed` })\n }\n return blocks.filter((block) => {\n if ((block.kind === 'form' || block.kind === 'component') && !block.to) {\n page.settled.push({\n at,\n what: `a ${block.kind} with nothing to place; left out`,\n })\n return false\n }\n // A form is placed once a page: a second copy of the same form asks a\n // visitor the same thing twice.\n if (block.kind === 'form' && block.to) {\n if (page.formsPlaced.has(block.to)) {\n page.settled.push({ at, what: `the form ${block.to} again; left out` })\n return false\n }\n page.formsPlaced.add(block.to)\n }\n return true\n })\n}\n\n/** The block kinds a column holds, as a column's shape is compared. */\nfunction shapeOf(column: readonly AiLayoutBlock[]): string {\n return column.map((block) => block.kind).join(',')\n}\n\n/** What a like column may hold and still be read as a card: its words, a picture and one button. */\nconst CARD_COLUMN_KINDS: ReadonlySet<string> = new Set(['heading', 'text', 'lede', 'eyebrow', 'image', 'note', 'button'])\n\n/** The words of a column a card says: its heading, or its first words. */\nconst WORDS_KINDS: ReadonlySet<string> = new Set(['heading', 'text', 'lede', 'note'])\n\n/**\n * Whether a row's columns all say the same kind of thing (AGL-3660): the\n * same blocks in the same order, words among them, one button at most. The\n * beta.270 Sugar Hollow Galleries page (AGL-3988) was refused for rule 1,\n * \"The same Grid block appears 4 times\": four like columns this read did not\n * fold, each of them drawn as a Grid cell of its own.\n */\nfunction sameShape(columns: readonly AiLayoutBlock[][]): boolean {\n const first = shapeOf(columns[0])\n return (\n columns.every((column) => shapeOf(column) === first) &&\n columns[0].some((block) => WORDS_KINDS.has(block.kind)) &&\n columns[0].every((block) => CARD_COLUMN_KINDS.has(block.kind)) &&\n columns[0].filter((block) => block.kind === 'button').length <= 1\n )\n}\n\n/**\n * Like columns as one group of cards: each column's heading its title, its\n * words its text. Their buttons follow the group (AGL-3988): one, where they\n * all go to the same place, else a list of links, each named by its card.\n */\nfunction columnsAsCards(columns: readonly AiLayoutBlock[][]): AiLayoutBlock[] {\n const cards: AiLayoutBlock = {\n kind: 'cards',\n items: columns.map((column) => {\n const title = column.find((block) => block.kind === 'heading')?.text ?? ''\n const words = column\n .filter(\n (block) =>\n block.kind === 'text' ||\n block.kind === 'lede' ||\n block.kind === 'note',\n )\n .map((block) => block.text ?? '')\n .join(' ')\n const icon = column.find((block) => block.icon)?.icon\n return { title, text: words, ...(icon ? { icon } : {}) }\n }),\n }\n const buttons = columns.flatMap((column) => {\n const button = column.find((block) => block.kind === 'button')\n return button?.to?.trim() ? [{ button, column }] : []\n })\n if (!buttons.length) return [cards]\n const places = new Set(buttons.map(({ button }) => (button.to ?? '').trim().toLowerCase()))\n if (places.size === 1) {\n const { button } = buttons[0] as { button: AiLayoutBlock }\n return [cards, { kind: 'button', text: button.text ?? '', to: button.to, ...(button.style ? { style: button.style } : {}) }]\n }\n return [\n cards,\n {\n kind: 'list',\n items: buttons.map(({ button, column }) => ({\n title: column.find((block) => block.kind === 'heading')?.text || button.text || '',\n text: '',\n to: button.to ?? '',\n })),\n },\n ]\n}\n\n// ── A row of columns ──────────────────────────────────────────────────────\n\n// Spans out of twelve live with the tree, so a frame's repair reads them without the compiler (AGL-3735).\nexport { aiLayoutSpans }\n\nexport function compileRow(\n scope: SectionScope,\n columns: Array<{ column: AiLayoutBlock[]; weight: number }>,\n /** How the columns sit against each other: centered on a page, top-aligned in a footer (AGL-3735). */\n alignItems: 'center' | 'flex-start' = 'center',\n): string {\n const tree = scope.page.tree\n const spans = aiLayoutSpans(columns.map((entry) => entry.weight))\n const items = columns.map((entry, position) => {\n const span = spans[position]\n const flow = compileFlow(\n scope,\n entry.column,\n span >= 8 ? 'full' : span >= 5 ? 'half' : 'narrow',\n )\n const size =\n columns.length >= 4 ? `xs:12 sm:6 md:${span}` : `xs:12 md:${span}`\n return tree.add('muiGrid', { size }, null, [flow], 'column')\n })\n return tree.add(\n 'muiGrid',\n { container: true, spacing: columns.length >= 3 ? '4' : '6' },\n { alignItems },\n items,\n 'row',\n )\n}\n\n// ── A flow of blocks ─────────────────────────────────────────────────────\n\nexport type Room = 'full' | 'half' | 'narrow'\n\n/** A column of blocks, top to bottom, with buttons side by side; `null` when nothing in it compiles. */\nexport function compileFlow(\n scope: SectionScope,\n blocks: readonly AiLayoutBlock[],\n room: Room,\n): string | null {\n const tree = scope.page.tree\n const children: string[] = []\n let buttons: string[] = []\n const flushButtons = () => {\n if (!buttons.length) return\n children.push(\n buttons.length === 1\n ? buttons[0]\n : tree.add(\n 'muiStack',\n {\n direction: 'row',\n spacing: '2',\n useFlexGap: true,\n flexWrap: 'wrap',\n ...(scope.centered ? { justifyContent: 'center' } : {}),\n },\n null,\n buttons,\n 'actions',\n ),\n )\n buttons = []\n }\n for (const block of blocks) {\n if (block.kind === 'button') {\n const id = compileButton(scope, block)\n if (id) buttons.push(id)\n continue\n }\n flushButtons()\n const id = compileBlock(scope, block, room)\n if (id) children.push(id)\n }\n flushButtons()\n if (!children.length) return null\n // One block needs no flow around it.\n if (children.length === 1) return children[0]\n const align = scope.centered && room === 'full'\n // A flow whose words open with a label, a heading and a lede reads as one\n // block at a tighter spacing than the groups under it.\n return tree.add(\n 'muiStack',\n {\n spacing: hasGroup(tree, children) ? '4' : '2.5',\n ...(align ? { alignItems: 'center' } : {}),\n },\n null,\n children,\n 'flow',\n )\n}\n\nfunction hasGroup(tree: AiLayoutTreeBuilder, ids: readonly string[]): boolean {\n return ids.some((id) =>\n ['muiGrid', 'muiList'].includes(tree.nodes[id]?.componentId ?? ''),\n )\n}\n\nfunction compileBlock(\n scope: SectionScope,\n block: AiLayoutBlock,\n room: Room,\n): string | null {\n switch (block.kind) {\n case 'eyebrow':\n return words(\n scope,\n block,\n 'eyebrow',\n 'overline',\n { component: 'p' },\n accent(scope),\n )\n case 'heading':\n return heading(scope, block)\n case 'lede':\n return words(scope, block, 'lede', 'lede', {}, muted(scope))\n case 'text':\n return words(scope, block, 'text', 'body1', {}, muted(scope))\n case 'note':\n return words(scope, block, 'note', 'body2', {}, muted(scope))\n case 'image':\n return image(scope, block, room)\n case 'form':\n return form(scope, block)\n case 'component':\n return component(scope, block)\n case 'list':\n return list(scope, block, room)\n case 'faq':\n return faq(scope, block)\n case 'cards':\n case 'steps':\n case 'stats':\n case 'quotes':\n return group(scope, block, room)\n case 'table':\n return table(scope, block)\n case 'tabs':\n return tabs(scope, block, room)\n case 'logos':\n return logos(scope, block)\n default:\n return null\n }\n}\n\n/** Secondary words' color: muted text, or the band's own on a brand band. */\nfunction muted(scope: SectionScope): Record<string, unknown> | null {\n return scope.band === 'brand' || scope.overPhoto ? null : { color: 'text.secondary' }\n}\n\n/**\n * A List Item Text's secondary words: MUI draws them in the muted text color\n * whatever they sit on, so on a brand band, or over a photo, they take the\n * band's own color as the primary words do (AGL-3886).\n */\nfunction mutedSecondary(scope: SectionScope): Record<string, unknown> {\n return scope.band === 'brand' || scope.overPhoto ? { secondaryColor: 'inherit' } : {}\n}\n\n/** An accent's color: the brand's, or the band's own on a brand band. */\nfunction accent(scope: SectionScope): Record<string, unknown> | null {\n return scope.band === 'brand' || scope.overPhoto ? null : { color: 'primary.main' }\n}\n\nfunction align(scope: SectionScope): Record<string, unknown> {\n return scope.centered ? { align: 'center' } : {}\n}\n\n/**\n * Words as a page shows them: fitted to their place at a clean boundary, or,\n * on a page brought in (AGL-4107), exactly as the source wrote them.\n */\nfunction say(scope: SectionScope, value: unknown, place: AiLayoutTextPlace): string {\n if (scope.page.options.verbatim) return aiLayoutAsWritten(value)\n return aiLayoutWords(value, place, scope.page.targets.facts, scope.page.options.language)\n}\n\nfunction words(\n scope: SectionScope,\n block: AiLayoutBlock,\n place: AiLayoutTextPlace,\n variant: string,\n props: Record<string, unknown>,\n sx: Record<string, unknown> | null,\n): string | null {\n const text = say(scope, block.text, place)\n if (!text) return null\n return scope.page.tree.add(\n 'muiTypography',\n { children: text, variant, ...props, ...align(scope) },\n sx,\n null,\n place,\n )\n}\n\n/** A heading at its place in the outline: the section's own, or one under it. */\nfunction heading(scope: SectionScope, block: AiLayoutBlock): string | null {\n if (scope.frame) {\n const label = aiLayoutWords(\n block.text,\n 'itemTitle',\n scope.page.targets.facts,\n scope.page.options.language,\n )\n return label\n ? scope.page.tree.add(\n 'muiTypography',\n {\n children: label,\n variant: 'subtitle1',\n component: 'p',\n ...align(scope),\n },\n null,\n null,\n 'label',\n )\n : null\n }\n const own = !scope.headed\n const level = own ? scope.level : scope.level + 1\n const place: AiLayoutTextPlace =\n level === 1 ? 'title' : own ? 'heading' : 'itemTitle'\n const text = say(scope, block.text, place)\n if (!text) return null\n scope.headed = scope.headed || own\n // A source's heading longer than a heading style holds is set in a subtitle\n // style, still a heading at its level (AGL-4107): every word of it is kept.\n const long = scope.page.options.verbatim === true && text.length > AI_LAYOUT_HEADLINE_MAX_CHARS\n const variant = long\n ? 'subtitle1'\n : level === 1\n ? block.style === 'large'\n ? 'displayXl'\n : 'h1'\n : own\n ? 'h2'\n : 'h4'\n return scope.page.tree.add(\n 'muiTypography',\n { children: text, variant, component: `h${level}`, ...align(scope) },\n null,\n null,\n 'heading',\n )\n}\n\n/** The level an item's title takes: one under the section's heading, or h2 in a section with none yet. */\nfunction itemLevel(scope: SectionScope): number {\n return scope.headed ? scope.level + 1 : Math.max(2, scope.level)\n}\n\n/** The element an item's title renders as: a heading on a page, a label in the frame. */\nfunction itemElement(scope: SectionScope): string {\n return scope.frame ? 'p' : `h${itemLevel(scope)}`\n}\n\nfunction compileButton(\n scope: SectionScope,\n block: AiLayoutBlock,\n): string | null {\n const verbatim = scope.page.options.verbatim === true\n // Words that carry the phone or the email are kept whole (AGL-3979).\n const asked = verbatim\n ? aiLayoutAsWritten(block.text)\n : aiLayoutContactLabel(block.text, scope.page.targets.contact) ||\n aiLayoutFitText(block.text, 'label', scope.page.options.language)\n if (!asked) return null\n const destination = verbatim\n ? aiLayoutImportedDestination(block.to, scope.page.plan.sections.length)\n : aiLayoutResolveLink(\n block.to,\n asked,\n scope.link,\n scope.page.targets,\n )\n if (!destination) {\n // A page brought in keeps the words of a link that goes nowhere here (AGL-4107).\n if (verbatim) return words(scope, block, 'text', 'body1', {}, muted(scope))\n scope.page.settled.push({\n at: scope.at,\n what: `the button \"${asked}\" has nowhere to go; left out`,\n })\n return null\n }\n // A link of a page brought in longer than a button's label holds is its\n // words, as a link (AGL-4107): every word kept, and it still goes there.\n if (verbatim && asked.length > AI_TEXT_LIMITS.button) return linkedWords(scope, asked, destination)\n // A button to a page merged into the blog names the blog (AGL-3676).\n const label = verbatim ? asked : aiLayoutRenamedLabel(asked, destination)\n if (label !== asked) scope.page.settled.push({ at: scope.at, what: `the button \"${asked}\" named for the blog: \"${label}\"` })\n const style = block.style ?? 'primary'\n // Over a photo, a quiet or outlined button takes the words' own color, as on a brand band.\n const onBrand = scope.band === 'brand' || (!!scope.overPhoto && style !== 'primary')\n const look =\n style === 'quiet'\n ? { variant: 'text', color: onBrand ? 'inherit' : 'primary' }\n : style === 'secondary'\n ? { variant: 'outlined', color: onBrand ? 'inherit' : 'primary' }\n : { variant: 'contained', color: onBrand ? 'secondary' : 'primary' }\n const id = scope.page.tree.add(\n 'muiButton',\n {\n children: label,\n ...look,\n size: scope.index === 0 || block.style === 'large' ? 'large' : 'medium',\n ...destinationProps(destination),\n },\n // Sized to its words, never stretched across the column a Stack would\n // stretch it over (AGL-3660), and aligned with its section.\n { alignSelf: scope.centered ? 'center' : 'flex-start' },\n null,\n 'button',\n )\n linkTo(scope, id, destination)\n return id\n}\n\n/**\n * Where a link of a page brought in goes (AGL-4107), as its compile wrote it:\n * `page:<id>` a page of the site by its id — any page the import plans, which\n * a visitor reaches once that page is live and sees as words until then —\n * `#<n>` section n of this page, a `mailto:` or `tel:` link, or the\n * `https:` address the source linked. Anything else goes nowhere.\n */\nexport function aiLayoutImportedDestination(to: string | undefined, sections: number): AiLayoutDestination | null {\n const value = (to ?? '').trim()\n if (!value) return null\n const page = /^page:([A-Za-z0-9_-]{1,128})$/.exec(value)\n if (page) return { kind: 'page', screenId: page[1] }\n const section = /^#(\\d{1,3})$/.exec(value)\n if (section) {\n const index = Number(section[1]) - 1\n return index >= 0 && index < sections ? { kind: 'section', index } : null\n }\n if (/^mailto:[^\\s@]+@[^\\s@]+$/i.test(value) || /^tel:\\+?[\\d\\s().-]{3,}$/i.test(value)) return { kind: 'contact', href: value }\n try {\n const url = new URL(value)\n return url.protocol === 'https:' ? { kind: 'href', href: url.toString() } : null\n } catch {\n return null\n }\n}\n\n/**\n * A link to a section of this page carries the platform's Scroll to element\n * interaction to that section's root (AGL-3097), by the id the page stores it\n * under.\n */\nfunction linkTo(\n scope: SectionScope,\n id: string,\n destination: AiLayoutDestination,\n): void {\n if (destination.kind !== 'section') return\n const { page } = scope\n page.scrollTo[id] = destination.index\n const target =\n page.options.sectionIds?.[destination.index] ??\n sectionIdOf(destination.index)\n const name =\n page.plan.sections[destination.index]?.name ??\n `section ${destination.index + 1}`\n page.tree.nodes[id].interactions = [aiPageScrollInteraction(target, name)]\n}\n\nexport function destinationProps(\n destination: AiLayoutDestination,\n): Record<string, unknown> {\n if (destination.kind === 'page') return { screenId: destination.screenId }\n if (destination.kind === 'href')\n return { href: destination.href, target: '_blank' }\n if (destination.kind === 'path') return { href: destination.href }\n // A call or an email opens the phone or the mail app, never a new tab (AGL-3979).\n if (destination.kind === 'contact') return { href: destination.href }\n return {}\n}\n\n/**\n * A picture slot: a soft frame at a stock shape showing an icon until the\n * owner places the picture, which then fills it. Its description is its alt\n * text (rule 9), and no source is set here: the compiler stays pure, and\n * `ai-layout-pictures.ts` fills the slot with a photo the site serves itself\n * once the page is checked.\n */\n/**\n * The site kinds whose galleries open in a lightbox by default (AGL-3717): a\n * portfolio's or a photographer's work is looked at, not skimmed, and a\n * visitor who presses a picture expects to see it large and step through the\n * rest. Every other kind opens a picture only where the design says so.\n */\nexport const AI_LIGHTBOX_GALLERY_KINDS: ReadonlySet<string> = new Set([\n 'portfolio',\n 'photography',\n])\n\n/** The `to` that opens an image block's picture in a lightbox (AGL-3717). */\nexport const AI_LAYOUT_LIGHTBOX_TO = 'lightbox'\n\n/** Whether this page's galleries open in a lightbox by default. */\nexport function aiOpensGalleriesInLightbox(page: { design: PageScope['design'] }): boolean {\n const kind = page.design?.input.kind\n return Boolean(kind && AI_LIGHTBOX_GALLERY_KINDS.has(kind))\n}\n\n/**\n * The Image props that make a picture open in a lightbox: as one gallery\n * with the section's other pictures, named for the section, and with the\n * item's title as its caption. The Image element reads exactly these.\n */\nfunction lightboxProps(scope: SectionScope, caption?: string): Record<string, unknown> {\n const name =\n aiLayoutFitText(scope.heading, 'alt', scope.page.options.language) ||\n aiLayoutFitText(scope.page.plan.sections[scope.index]?.name, 'alt', scope.page.options.language) ||\n `Gallery ${scope.index + 1}`\n const words = aiLayoutFitText(caption, 'alt', scope.page.options.language)\n return { lightbox: true, lightboxGallery: name, ...(words ? { lightboxCaption: words } : {}) }\n}\n\nfunction image(\n scope: SectionScope,\n block: AiLayoutBlock,\n room: Room,\n): string | null {\n const { page } = scope\n // A page brought in places the source's own picture, as the library holds it (AGL-4107).\n if (page.options.verbatim) return block.picture ? sourcePicture(scope, block.picture, room) : null\n const alt = aiLayoutFitText(block.text, 'alt', scope.page.options.language)\n if (!alt) return null\n if (page.images >= maxImages(page)) {\n page.settled.push({\n at: scope.at,\n what: `a picture past the page's ${AI_LAYOUT_MAX_IMAGES}; left out`,\n })\n return null\n }\n page.images += 1\n const icon = aiIconOfWord(block.icon) ?? page.pageIcon\n const tree = page.tree\n const mark = tree.add(\n AI_ICON_COMPONENT_ID,\n { iconId: icon.id, size: '64' },\n { color: 'primary.main' },\n null,\n 'imageIcon',\n )\n // `to: lightbox` opens the picture large (AGL-3717); one picture is its\n // own gallery, so it opens alone unless the section has more.\n const opensLarge = block.to?.trim().toLowerCase() === AI_LAYOUT_LIGHTBOX_TO\n const picture = tree.add(\n 'image',\n { alt, objectFit: 'cover', ...(opensLarge ? lightboxProps(scope) : {}) },\n { position: 'absolute', top: 0, left: 0, width: '100%', height: '100%' },\n null,\n 'image',\n )\n return tree.add(\n 'muiBox',\n null,\n {\n position: 'relative',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n overflow: 'hidden',\n // In multiples of the theme's corner radius, so a sharp site's frames are sharp.\n borderRadius: 2,\n bgcolor: 'action.hover',\n // The frame's shape follows its room, so no two slots of a page share one style.\n aspectRatio:\n room === 'full'\n ? page.images === 1\n ? '16 / 9'\n : '21 / 9'\n : room === 'half'\n ? '4 / 3'\n : page.images === 1\n ? '1 / 1'\n : '3 / 4',\n },\n [mark, picture],\n 'frame',\n )\n}\n\n/** A saved form, framed as a card so it reads as the section's one task. */\nfunction form(scope: SectionScope, block: AiLayoutBlock): string | null {\n const tree = scope.page.tree\n const placed = tree.add('form', { formId: block.to }, null, null, 'form')\n const content = tree.add(\n 'muiCardContent',\n null,\n { p: { xs: 3, md: 4 } },\n [placed],\n 'formContent',\n )\n // The card style is the site theme's (AGL-3660), as a card dropped from the\n // drawer takes it; it takes the flow's width, so a centered section never\n // shrinks a form to its button.\n return tree.add('muiCard', null, { alignSelf: 'stretch' }, [content], 'formCard')\n}\n\n/** A reusable component placed by its id, its props filled from the block's items. */\nfunction component(scope: SectionScope, block: AiLayoutBlock): string | null {\n const declared = componentOf(scope.page.targets, block.to)\n if (!declared) return null\n const values: Record<string, unknown> = {}\n for (const item of block.items ?? []) {\n const name = item.title.trim()\n if (name in declared.props && item.text.trim())\n values[name] = aiLayoutWords(item.text, 'text', scope.page.targets.facts, scope.page.options.language)\n }\n // An instance fills at least one prop (rule 1): the block's words, else the\n // name its section has in the plan, rather than the component's placeholder.\n if (!Object.values(values).some(Boolean)) {\n const first = textProps(declared.props)[0]\n const words =\n aiLayoutWords(block.text, 'text', scope.page.targets.facts, scope.page.options.language) ||\n aiLayoutWords(\n scope.page.plan.sections[scope.index]?.name,\n 'itemTitle',\n scope.page.targets.facts,\n scope.page.options.language,\n )\n if (first && words) values[first] = words\n }\n for (const [name, value] of Object.entries(values))\n if (!value) delete values[name]\n return scope.page.tree.add(\n REUSABLE_INSTANCE_COMPONENT_ID,\n {\n [AI_INSTANCE_REF_PROP]: declared.id,\n ...(Object.keys(values).length ? { propValues: values } : {}),\n },\n null,\n null,\n 'instance',\n )\n}\n\nfunction textProps(props: Record<string, string>): string[] {\n return Object.entries(props)\n .filter(([, type]) => type === 'text' || type === 'richText')\n .map(([name]) => name)\n}\n\n/** An item's words as the props of the component that draws it. */\nfunction instanceValues(\n props: Record<string, string>,\n item: AiLayoutItem,\n facts: string,\n language?: string,\n): Record<string, unknown> {\n const texts = textProps(props)\n const titleProp =\n texts.find((name) =>\n /title|name|heading|label|question|figure|value/i.test(name),\n ) ?? texts[0]\n const textProp =\n texts.find(\n (name) =>\n name !== titleProp &&\n /text|description|body|summary|copy|answer|detail|caption/i.test(name),\n ) ?? texts.find((name) => name !== titleProp)\n const values: Record<string, unknown> = {}\n if (titleProp && item.title.trim())\n values[titleProp] = aiLayoutWords(item.title, 'itemTitle', facts, language)\n if (textProp && item.text.trim())\n values[textProp] = aiLayoutWords(item.text, 'itemText', facts, language)\n const first = titleProp ?? textProp\n if (!Object.values(values).some(Boolean) && first)\n values[first] = aiLayoutWords(item.title || item.text, 'itemTitle', facts, language)\n return values\n}\n\n// ── Groups ────────────────────────────────────────────────────────────────\n\n/** Records the elements that draw a section's repeated items, and hands them back. */\nfunction noted<T extends readonly string[]>(scope: SectionScope, ids: T): T {\n if (!scope.frame) scope.page.itemIds[scope.index]?.push(...ids)\n return ids\n}\n\n/** How many items sit side by side in a room. */\nfunction across(\n count: number,\n room: Room,\n kind: AiLayoutBlock['kind'],\n): number {\n if (room === 'narrow') return 1\n if (room === 'half') return count >= 2 && kind === 'stats' ? 2 : 1\n if (count <= 3) return count\n if (count === 4) return 4\n if (count === 7) return 4\n return 3\n}\n\nfunction itemSize(perRow: number): string {\n if (perRow === 2) return 'xs:12 sm:6'\n if (perRow === 3) return 'xs:12 md:4'\n return 'xs:12 sm:6 md:3'\n}\n\n/** Items laid out side by side as a Grid of sized items, or stacked where they sit one to a row. */\nfunction layOut(\n scope: SectionScope,\n items: readonly string[],\n perRow: number,\n spacing: string,\n role: string,\n): string {\n const tree = scope.page.tree\n if (items.length === 1) return items[0]\n if (perRow <= 1) {\n return tree.add('muiStack', { spacing }, null, items, role)\n }\n const size = itemSize(perRow)\n const cells = items.map((id) =>\n tree.add('muiGrid', { size }, null, [id], 'cell'),\n )\n return tree.add('muiGrid', { container: true, spacing }, null, cells, role)\n}\n\n/**\n * Whether repeats must be components here (rule 1): the workspace keeps\n * them. Rule 1 counts like blocks across the whole page, so where it holds\n * every group the plan places no component for is drawn compact, however\n * few its items — two sections of two cards are four like cards.\n */\nfunction rule1(scope: SectionScope): boolean {\n return scope.page.options.reusableComponents\n}\n\n/** The most pictures this page carries: two where rule 1 counts three like frames as a repeat. */\nfunction maxImages(page: PageScope): number {\n return page.options.reusableComponents ? 2 : AI_LAYOUT_MAX_IMAGES\n}\n\n/**\n * The items a group may still show in its section (rule 8): seven like items\n * a section, across all its groups, since eight are a list typed by hand.\n */\n/** Whether an item has words left once they are cleaned and fitted: an item with none is no item. */\nfunction speaks(scope: SectionScope, item: AiLayoutItem): boolean {\n const facts = scope.page.targets.facts\n return !!(\n aiLayoutWords(item.title, 'itemTitle', facts, scope.page.options.language) ||\n aiLayoutWords(item.text, 'itemText', facts, scope.page.options.language)\n )\n}\n\n/** A group's items with every part that has no words left once cleaned emptied, and wordless items left out. */\n/** A title that only names the kind of thing it is: \"Card\", \"Item 2\", \"Title\". */\nconst AI_LAYOUT_PLACEHOLDER_TITLE = /^(?:card|item|title|heading|placeholder|tile|box|feature|service|post|article|entry)\\s*\\d*$/i\n\nfunction cleanItems(\n scope: SectionScope,\n items: readonly AiLayoutItem[],\n): AiLayoutItem[] {\n const facts = scope.page.targets.facts\n // A title that is only the name or id of what places it — a \"Card\" item of\n // the Card component (AGL-3660) — is no words a visitor reads.\n const references = new Set(\n scope.page.targets.components.flatMap((component) => [component.name, component.id]).map((name) => name.trim().toLowerCase()),\n )\n return items\n .map((item) => ({\n ...item,\n title:\n aiLayoutWords(item.title, 'itemTitle', facts, scope.page.options.language) &&\n !references.has(item.title.trim().toLowerCase()) &&\n !AI_LAYOUT_PLACEHOLDER_TITLE.test(item.title.trim())\n ? item.title\n : '',\n text: aiLayoutWords(item.text, 'itemText', facts, scope.page.options.language) ? item.text : '',\n }))\n .filter((item) => speaks(scope, item))\n}\n\nfunction takeItems<T>(scope: SectionScope, items: readonly T[]): T[] {\n const kept = items.slice(0, Math.max(0, scope.itemsLeft))\n if (kept.length < items.length) {\n scope.page.settled.push({\n at: scope.at,\n what: `${items.length - kept.length} items past the section's ${AI_LAYOUT_MAX_ITEMS}; left out`,\n })\n }\n scope.itemsLeft -= kept.length\n return kept\n}\n\n/** `takeItems` on a list it shortens where it stands. */\nfunction takeItemsInPlace<T>(scope: SectionScope, items: T[]): void {\n const kept = takeItems(scope, items)\n items.length = kept.length\n}\n\nfunction group(\n scope: SectionScope,\n block: AiLayoutBlock,\n room: Room,\n): string | null {\n if (scope.page.options.verbatim) return importedGroup(scope, block, room)\n const items = takeItems(scope, cleanItems(scope, block.items ?? []))\n if (!items.length) return null\n const perRow = across(items.length, room, block.kind)\n const placed = componentOf(scope.page.targets, block.to)\n if (placed) return instances(scope, placed, items, perRow)\n const design = scope.page.design\n const retail = !!design && aiLayoutFamily(design.input.kind) === 'retail'\n // A store's making, shown: its steps as pictures over their words (AGL-3676),\n // where the page has the pictures for them.\n if (retail && block.kind === 'steps' && room === 'full' && items.length >= 2 && items.length <= 4 && picturesLeft(scope.page) >= items.length) {\n const drawn = designedGroup(scope, 'articles', items, room)\n if (drawn) return drawn\n }\n if (rule1(scope)) {\n // Picture cards the design draws are the compiler's, not a block typed out\n // by hand (`repeatsCompiled`, AGL-3660), and so are a storefront's icon\n // columns (AGL-3676): the beta.237 Willow Wick home, on a paid plan, drew\n // every other group compact — four bands of a title and a sentence.\n const variant = design && block.kind === 'cards' && block.style !== 'quiet' ? aiLayoutGroupVariant(design.input, design.choices, scope.words ?? '') : null\n // Icon columns side by side, where rule 1 knows them by their cells; any\n // site's groups may take them (AGL-3899), and one to a row outside a\n // store they are drawn compact.\n if (variant === 'icons' && (retail || perRow > 1)) return iconColumns(scope, items, room)\n const pictured = (variant === 'pictures' || variant === 'articles') && room === 'full' && picturesLeft(scope.page) >= items.length\n return (pictured && designedGroup(scope, variant, items, room)) || compactGroup(scope, block, items, perRow)\n }\n if (design && block.kind === 'steps' && (design.choices.steps === 'timeline' || room !== 'full')) {\n return timeline(scope, items)\n }\n if (design && block.kind === 'cards' && block.style !== 'quiet') {\n const variant = scope.groupStyle ?? aiLayoutGroupVariant(design.input, design.choices, scope.words ?? '')\n const drawn = designedGroup(scope, variant, items, room)\n if (drawn) return drawn\n }\n switch (block.kind) {\n case 'steps':\n return layOut(\n scope,\n noted(scope, items.map((item, position) => step(scope, item, position))),\n perRow,\n '4',\n 'steps',\n )\n case 'stats':\n return layOut(\n scope,\n noted(scope, items.map((item) => stat(scope, item))),\n perRow,\n '4',\n 'stats',\n )\n case 'quotes':\n return layOut(\n scope,\n noted(scope, items.map((item) => quote(scope, item))),\n perRow,\n '3',\n 'quotes',\n )\n default:\n return layOut(\n scope,\n noted(scope, items.map((item) => card(scope, block, item))),\n perRow,\n '3',\n 'cards',\n )\n }\n}\n\nfunction instances(\n scope: SectionScope,\n placed: { id: string; props: Record<string, string> },\n items: readonly AiLayoutItem[],\n perRow: number,\n): string {\n const tree = scope.page.tree\n const ids = items.map((item) => {\n const values = instanceValues(placed.props, item, scope.page.targets.facts, scope.page.options.language)\n return tree.add(\n REUSABLE_INSTANCE_COMPONENT_ID,\n {\n [AI_INSTANCE_REF_PROP]: placed.id,\n ...(Object.keys(values).length ? { propValues: values } : {}),\n },\n null,\n null,\n 'instance',\n )\n })\n return layOut(scope, noted(scope, ids), perRow, '3', 'instances')\n}\n\n/**\n * A group in its compact form, a title over its text: two elements an item,\n * under the three a block must have before rule 1 asks for a component.\n */\nfunction compactGroup(\n scope: SectionScope,\n block: AiLayoutBlock,\n items: readonly AiLayoutItem[],\n perRow: number,\n): string {\n const tree = scope.page.tree\n const facts = scope.page.targets.facts\n const pairs = items.map((item, position) => {\n const title =\n block.kind === 'quotes'\n ? aiLayoutQuoteGap(item.text || item.title, scope.page.options.language)\n : block.kind === 'stats'\n ? aiLayoutWords(item.title, 'stat', facts, scope.page.options.language)\n : `${block.kind === 'steps' ? `${position + 1}. ` : ''}${aiLayoutWords(item.title, 'itemTitle', facts, scope.page.options.language)}`\n const text =\n block.kind === 'quotes'\n ? '[Customer name]'\n : aiLayoutWords(\n item.text,\n block.kind === 'stats' ? 'statLabel' : 'itemText',\n facts,\n scope.page.options.language,\n )\n return tree.add(\n 'muiListItemText',\n { primary: title, ...(text ? { secondary: text, ...mutedSecondary(scope) } : {}) },\n null,\n null,\n 'pair',\n )\n })\n return layOut(scope, noted(scope, pairs), perRow, '3', 'compact')\n}\n\n/** A card: an optional icon, its title one level under the section's heading, and its words. */\nfunction card(\n scope: SectionScope,\n block: AiLayoutBlock,\n item: AiLayoutItem,\n): string {\n const tree = scope.page.tree\n const facts = scope.page.targets.facts\n const icon = aiIconOfWord(item.icon) ?? aiIconOfWord(block.icon)\n // A quiet card draws no surface of its own, so it is colored as the band it sits on.\n const quiet = block.style === 'quiet'\n const children = [\n icon\n ? tree.add(\n AI_ICON_COMPONENT_ID,\n { iconId: icon.id, size: '32' },\n quiet ? accent(scope) : { color: 'primary.main' },\n null,\n 'icon',\n )\n : null,\n item.title.trim()\n ? tree.add(\n 'muiTypography',\n {\n children: aiLayoutWords(item.title, 'itemTitle', facts, scope.page.options.language),\n variant: 'h5',\n component: itemElement(scope),\n },\n null,\n null,\n 'title',\n )\n : null,\n item.text.trim()\n ? tree.add(\n 'muiTypography',\n {\n children: aiLayoutWords(item.text, 'itemText', facts, scope.page.options.language),\n variant: 'body1',\n },\n quiet ? muted(scope) : { color: 'text.secondary' },\n null,\n 'text',\n )\n : null,\n ]\n const stack = tree.add(\n 'muiStack',\n { spacing: '1.5' },\n null,\n children,\n 'cardStack',\n )\n if (quiet) return stack\n const content = tree.add(\n 'muiCardContent',\n null,\n { p: 3 },\n [stack],\n 'cardContent',\n )\n // Flat, outlined, raised, tinted or ruled is the site theme's card style\n // (AGL-3660), never a choice stamped on this card.\n return tree.add('muiCard', null, { height: '100%' }, [content], 'card')\n}\n\n/** A numbered step: its number in the brand color, its title and its words. */\nfunction step(\n scope: SectionScope,\n item: AiLayoutItem,\n position: number,\n): string {\n const tree = scope.page.tree\n const facts = scope.page.targets.facts\n return tree.add(\n 'muiStack',\n { spacing: '1' },\n null,\n [\n tree.add(\n 'muiTypography',\n {\n children: String(position + 1).padStart(2, '0'),\n variant: 'h3',\n component: 'p',\n },\n accent(scope),\n null,\n 'number',\n ),\n item.title.trim()\n ? tree.add(\n 'muiTypography',\n {\n children: aiLayoutWords(item.title, 'itemTitle', facts, scope.page.options.language),\n variant: 'h5',\n component: itemElement(scope),\n },\n null,\n null,\n 'title',\n )\n : null,\n item.text.trim()\n ? tree.add(\n 'muiTypography',\n {\n children: aiLayoutWords(item.text, 'itemText', facts, scope.page.options.language),\n variant: 'body1',\n },\n muted(scope),\n null,\n 'text',\n )\n : null,\n ],\n 'step',\n )\n}\n\n/** A figure and its label. A figure the brief did not give is the model's bracketed gap. */\nfunction stat(scope: SectionScope, item: AiLayoutItem): string {\n const tree = scope.page.tree\n const facts = scope.page.targets.facts\n return tree.add(\n 'muiStack',\n { spacing: '0.5', ...(scope.centered ? { alignItems: 'center' } : {}) },\n null,\n [\n tree.add(\n 'muiTypography',\n {\n children: aiLayoutWords(item.title, 'stat', facts, scope.page.options.language) || '[figure]',\n variant: 'h2',\n component: 'p',\n ...align(scope),\n },\n accent(scope),\n null,\n 'figure',\n ),\n item.text.trim()\n ? tree.add(\n 'muiTypography',\n {\n children: aiLayoutWords(item.text, 'statLabel', facts, scope.page.options.language),\n variant: 'body2',\n ...align(scope),\n },\n muted(scope),\n null,\n 'label',\n )\n : null,\n ],\n 'stat',\n )\n}\n\n/** A quote slot: what a customer should be quoted saying, as the gap the owner fills. */\nfunction quote(scope: SectionScope, item: AiLayoutItem): string {\n const tree = scope.page.tree\n const words = aiLayoutQuoteGap(item.text || item.title, scope.page.options.language)\n const who =\n item.text && item.title ? aiLayoutFitText(item.title, 'statLabel', scope.page.options.language) : ''\n const stack = tree.add(\n 'muiStack',\n { spacing: '2' },\n null,\n [\n tree.add(\n AI_ICON_COMPONENT_ID,\n { iconId: AI_ICON_LIBRARY.quote.id, size: '32' },\n { color: 'primary.main' },\n null,\n 'quoteMark',\n ),\n tree.add(\n 'muiTypography',\n { children: words, variant: 'body1' },\n null,\n null,\n 'quote',\n ),\n tree.add(\n 'muiTypography',\n {\n children:\n aiLayoutFitText(\n who ? `[Customer name], ${who.replace(/^\\[|\\]$/g, '')}` : '',\n 'note',\n scope.page.options.language,\n ) || '[Customer name]',\n variant: 'subtitle2',\n component: 'p',\n },\n null,\n null,\n 'attribution',\n ),\n ],\n 'quoteStack',\n )\n const content = tree.add(\n 'muiCardContent',\n null,\n { p: 3 },\n [stack],\n 'quoteContent',\n )\n return tree.add('muiCard', null, { height: '100%' }, [content], 'quoteCard')\n}\n\n/** A list: check-marked lines, or plain lines where rule 1 holds and the list is long. */\nfunction list(scope: SectionScope, block: AiLayoutBlock, room: Room = 'full'): string | null {\n if (scope.page.options.verbatim) return importedList(scope, block, room)\n const tree = scope.page.tree\n const facts = scope.page.targets.facts\n // A list whose lines go somewhere is a list of links: each line that\n // resolves is a Page Link, and one that does not is left out (rule 10).\n if ((block.items ?? []).some((item) => item.to)) {\n const links = (block.items ?? []).flatMap((item) => {\n const label =\n aiLayoutContactLabel(item.title || item.text, scope.page.targets.contact) ||\n aiLayoutFitText(item.title || item.text, 'label', scope.page.options.language)\n const destination = label\n ? aiLayoutResolveLink(item.to, label, scope.link, scope.page.targets)\n : null\n if (!destination) return []\n const id = tree.add(\n 'muiScreenLink',\n {\n children: label,\n renderAs: 'link',\n color: 'inherit',\n ...destinationProps(destination),\n },\n null,\n null,\n 'link',\n )\n linkTo(scope, id, destination)\n return [id]\n })\n return links.length\n ? tree.add('muiStack', { spacing: '1' }, null, noted(scope, links), 'links')\n : null\n }\n const lines = cleanItems(scope, block.items ?? [])\n .map((item) =>\n aiLayoutWords(\n [item.title, item.text].filter((part) => part.trim()).join(' — '),\n 'listItem',\n facts,\n scope.page.options.language,\n ),\n )\n .filter(Boolean)\n takeItemsInPlace(scope, lines)\n if (!lines.length) return null\n if (rule1(scope)) {\n const rows = lines.map((line) =>\n tree.add(\n 'muiListItem',\n { disableGutters: true },\n null,\n [tree.add('muiListItemText', { primary: line }, null, null, 'line')],\n 'row',\n ),\n )\n return tree.add('muiList', { disablePadding: true }, null, noted(scope, rows), 'list')\n }\n const check = aiIconOfWord(block.icon) ?? AI_ICON_LIBRARY.check\n const rows = lines.map((line) =>\n tree.add(\n 'muiStack',\n { direction: 'row', spacing: '1.5', alignItems: 'flex-start' },\n null,\n [\n tree.add(\n AI_ICON_COMPONENT_ID,\n { iconId: check.id, size: '22' },\n accent(scope),\n null,\n 'check',\n ),\n tree.add(\n 'muiTypography',\n { children: line, variant: 'body1' },\n null,\n null,\n 'line',\n ),\n ],\n 'row',\n ),\n )\n return tree.add('muiStack', { spacing: '1.5' }, null, noted(scope, rows), 'list')\n}\n\n/** Questions and answers: an accordion each, or question-over-answer pairs where rule 1 holds. */\nfunction faq(scope: SectionScope, block: AiLayoutBlock): string | null {\n if (scope.page.options.verbatim) return importedFaq(scope, block)\n const tree = scope.page.tree\n const facts = scope.page.targets.facts\n const items = takeItems(\n scope,\n cleanItems(scope, block.items ?? []).filter(\n (item) => !!aiLayoutWords(item.title, 'question', facts, scope.page.options.language),\n ),\n )\n if (!items.length) return null\n if (rule1(scope)) {\n const rows = items.map((item) =>\n tree.add(\n 'muiListItem',\n { disableGutters: true, divider: true },\n null,\n [\n tree.add(\n 'muiListItemText',\n {\n primary: aiLayoutWords(item.title, 'question', facts, scope.page.options.language),\n ...(item.text.trim()\n ? {\n secondary: aiLayoutWords(item.text, 'answer', facts, scope.page.options.language),\n ...mutedSecondary(scope),\n }\n : {}),\n },\n null,\n null,\n 'qa',\n ),\n ],\n 'row',\n ),\n )\n return tree.add('muiList', { disablePadding: true }, null, noted(scope, rows), 'faq')\n }\n const panels = items.map((item, position) =>\n tree.add(\n 'muiAccordion',\n {\n disableGutters: true,\n ...(position === 0 ? { defaultExpanded: true } : {}),\n },\n null,\n [\n tree.add(\n 'muiAccordionSummary',\n { children: aiLayoutWords(item.title, 'question', facts, scope.page.options.language) },\n null,\n null,\n 'question',\n ),\n item.text.trim()\n ? tree.add(\n 'muiAccordionDetails',\n null,\n null,\n [\n tree.add(\n 'muiTypography',\n {\n children: aiLayoutWords(item.text, 'answer', facts, scope.page.options.language),\n variant: 'body1',\n },\n { color: 'text.secondary' },\n null,\n 'answer',\n ),\n ],\n 'details',\n )\n : null,\n ],\n 'panel',\n ),\n )\n return tree.add('muiStack', { spacing: '1.5' }, null, noted(scope, panels), 'faq')\n}\n\n// ── The designer layer (AGL-3660) ─────────────────────────────────────────\n//\n// What `ai-layout-design.ts` chose for the site, drawn: the hero, a section\n// of words beside a picture, a closing band over a photo, a heading beside\n// its items, and groups drawn as pictures, articles, a menu or open ruled\n// columns. Every variant is built from the same palette elements and theme\n// tokens as the rest of the compiler, so the doctrine holds by construction.\n\n/** The most pictures a designed page carries, the model's and the stand-ins together. */\nexport const AI_LAYOUT_MAX_DESIGN_PICTURES = 8\n\n/** The block kinds a section of words holds. */\nconst WORD_KINDS: ReadonlySet<AiLayoutBlock['kind']> = new Set(['eyebrow', 'heading', 'lede', 'text', 'note', 'button'])\n\n/** How many more pictures the page has room for. */\nfunction picturesLeft(page: PageScope): number {\n return AI_LAYOUT_MAX_DESIGN_PICTURES - page.images - page.pictures\n}\n\n/** Whether a heading block has words left once fitted: one with none is no heading. */\nfunction speaksHeading(scope: SectionScope, block: AiLayoutBlock): boolean {\n return block.kind === 'heading' && !!say(scope, block.text, 'heading')\n}\n\n/** The section root every designed section is written under, as `compileSection` writes its own. */\nfunction designedRoot(\n scope: SectionScope,\n children: readonly string[],\n sx: Record<string, unknown> | null,\n dark: boolean,\n): string {\n const { page, index } = scope\n const name = page.plan.sections[index]?.name?.trim() || `Section ${index + 1}`\n return page.tree.add(\n 'section',\n {\n element: 'section',\n ariaLabel: sectionLabel(name, index, page.options.language),\n ...(dark ? { colorScheme: 'dark' } : {}),\n // A photo cover that opens the page runs up under the header, which sits over it.\n ...(index === 0 && scope.overPhoto ? { underHeader: true } : {}),\n },\n sx,\n children,\n 'section',\n page.options.sectionIds?.[index] ?? sectionIdOf(index),\n )\n}\n\n/** A picture a design places: what it shows, whether anyone described it, and the source's own copy on a page brought in (AGL-4107). */\ninterface DesignedPicture {\n alt: string\n given: boolean\n src?: string\n}\n\n/**\n * A picture the design places: the model's own where it described one, else\n * a stand-in — marked decorative, since no one described it, with the\n * section's words as what a stock search looks for. Either is filled by\n * `ai-layout-pictures.ts` after the page is checked, as any slot is.\n */\nfunction designPicture(\n scope: SectionScope,\n picture: DesignedPicture,\n frameSx: Record<string, unknown>,\n role = 'designFrame',\n imageSx: Record<string, unknown> = {},\n): string {\n const tree = scope.page.tree\n // The picture fills its frame by its own size props, so the frame alone\n // carries a style: a page of many pictures repeats no inline style (rule 16).\n const image = designImage(scope, picture, { width: '100%', height: '100%' }, Object.keys(imageSx).length ? imageSx : null)\n return tree.add('muiBox', null, { position: 'relative', overflow: 'hidden', bgcolor: 'action.hover', ...frameSx }, [image], role)\n}\n\n/**\n * The `image` a designed picture is: its alt, its fit and, for a stand-in,\n * decorative. Its slot is filled after the page is checked.\n */\nfunction designImage(\n scope: SectionScope,\n picture: DesignedPicture,\n props: Record<string, unknown>,\n sx: Record<string, unknown> | null,\n): string {\n const { page } = scope\n if (picture.given) page.images += 1\n else page.pictures += 1\n // A page brought in places the source's own picture (AGL-4107), described as\n // the source described it, and decorative where it was not described.\n const described = picture.alt ? { alt: picture.alt } : { decorative: true }\n return page.tree.add(\n 'image',\n picture.src\n ? { src: picture.src, ...described, objectFit: 'cover', ...(page.images > 1 ? { loading: 'lazy' } : {}), ...props }\n : { alt: picture.alt, objectFit: 'cover', ...(picture.given ? {} : { decorative: true }), ...props },\n sx,\n null,\n 'image',\n )\n}\n\n/** What a stand-in picture is of, for a stock search: the section's subject, else the site's. */\nfunction standInAlt(scope: SectionScope, words?: string): string {\n return (\n aiLayoutFitText(words, 'alt', scope.page.options.language) ||\n aiLayoutFitText(scope.heading, 'alt', scope.page.options.language) ||\n aiLayoutFitText(scope.page.plan.sections[scope.index]?.name, 'alt', scope.page.options.language) ||\n aiLayoutFitText(scope.page.plan.title, 'alt', scope.page.options.language) ||\n 'A photo'\n )\n}\n\n/** A grid row of sized cells, as `compileRow` writes one, from ids already compiled. */\nfunction designRow(\n scope: SectionScope,\n cells: ReadonlyArray<{ id: string; size: string; sx?: Record<string, unknown> }>,\n spacing: string,\n alignItems = 'center',\n): string {\n const tree = scope.page.tree\n return tree.add(\n 'muiGrid',\n { container: true, spacing },\n { alignItems },\n cells.map((cell) => tree.add('muiGrid', { size: cell.size }, cell.sx ?? null, [cell.id], 'column')),\n 'row',\n )\n}\n\n/** A section's own arrangement where the design has one; `null` to draw it the compiler's first way. */\nfunction designSection(scope: SectionScope, raw: AiLayoutSection, blocks: readonly AiLayoutBlock[]): string | null {\n const { page, index } = scope\n const design = page.design\n if (!design) return null\n const images = blocks.filter((block) => block.kind === 'image')\n const words = blocks.filter((block) => block.kind !== 'image')\n const ofWords = words.length > 0 && words.every((block) => WORD_KINDS.has(block.kind))\n if (index === 0) {\n if (!ofWords || images.length > 1 || picturesLeft(page) < 1) return null\n const flow = [...words]\n if (!flow.some((block) => speaksHeading(scope, block))) {\n flow.unshift({ kind: 'heading', text: page.plan.title })\n page.settled.push({ at: scope.at, what: \"no heading; the page's title written as its h1\" })\n }\n // A designed hero's title is display-sized; beside a photo, in half the\n // page, it is the page's title size, so a long one still reads in a few lines.\n const lead = flow.findIndex((block) => speaksHeading(scope, block))\n const { style: _style, ...title } = flow[lead]\n flow[lead] = AI_LAYOUT_HALF_HEROES.has(design.choices.hero) ? title : { ...title, style: 'large' }\n sellingHero(scope, flow)\n const given = images[0] ? aiLayoutFitText(images[0].text, 'alt', scope.page.options.language) : ''\n return hero(\n scope,\n flow,\n given ? { alt: given, given: true } : { alt: standInAlt(scope, words.find((block) => speaksHeading(scope, block))?.text), given: false },\n )\n }\n if (ofWords && !images.length && words.some((block) => speaksHeading(scope, block))) {\n const last = index === page.plan.sections.length - 1\n const asks = words.some((block) => block.kind === 'button')\n const strong = scope.band === 'brand' || scope.band === 'dark'\n const told = words.some((block) => block.kind === 'text' || block.kind === 'lede')\n if (last && asks && (strong || scope.centered) && design.choices.coverClose && picturesLeft(page) >= 1) {\n return coverBand(scope, words)\n }\n if (design.choices.features && told && page.features < 2 && picturesLeft(page) >= 1 && !(last && asks && strong)) {\n return feature(scope, words)\n }\n return null\n }\n // A heading over one group of items: the heading beside them.\n if (!design.choices.splitHeads || images.length || page.splitAt === index - 1) return null\n const at = words.findIndex((block) => block.kind === 'cards' || block.kind === 'steps')\n if (at <= 0) return null\n const head = words.slice(0, at)\n const group = words[at]\n const tail = words.slice(at + 1)\n const variant = aiLayoutGroupVariant(design.input, design.choices, scope.words ?? '')\n if (\n !head.every((block) => WORD_KINDS.has(block.kind) && block.kind !== 'button') ||\n !head.some((block) => speaksHeading(scope, block)) ||\n !tail.every((block) => WORD_KINDS.has(block.kind)) ||\n (group.items?.length ?? 0) < 2 ||\n (group.items?.length ?? 0) > 6 ||\n group.to ||\n (group.kind === 'cards' && variant !== 'cards' && variant !== 'ruled') ||\n // A store's making is shown as pictures across the page (AGL-3676), never\n // ruled words in half of it: set beside its heading, a seed that splits\n // headings left a storefront's \"how it is made\" a band of text (AGL-3985).\n (group.kind === 'steps' && aiLayoutFamily(design.input.kind) === 'retail')\n ) {\n return null\n }\n return splitSection(scope, head, group, tail)\n}\n\n/** The first section, in the site's hero arrangement. */\nfunction hero(\n scope: SectionScope,\n flow: readonly AiLayoutBlock[],\n picture: DesignedPicture,\n /** The hero a page brought in opens as (AGL-4107), over the site's own. */\n asked?: AiLayoutHeroVariant,\n): string {\n const { page } = scope\n const tree = page.tree\n const design = page.design as NonNullable<PageScope['design']>\n const home = design.input.home\n // A collage holds two pictures: on a page with room for one, it is drawn\n // split, and so it is on a page brought in, which shows only its own.\n const chosen: AiLayoutHeroVariant = asked ?? design.choices.hero\n const variant: AiLayoutHeroVariant = chosen === 'collage' && (picturesLeft(page) < 2 || page.options.verbatim) ? 'split' : chosen\n page.settled.push({ at: scope.at, what: `drawn as a ${variant} hero` })\n if (variant === 'cover' || variant === 'poster') {\n scope.band = 'dark'\n // A cover sets its words at the start of the page; a poster centers them,\n // taller, as a restaurant's or a band's opening does (AGL-3985).\n scope.centered = variant === 'poster'\n const tall = variant === 'poster'\n return cover(\n scope,\n flow,\n picture,\n home ? (tall ? { xs: '84vh', md: '94vh' } : { xs: '78vh', md: '86vh' }) : tall ? { xs: '52vh', md: '62vh' } : { xs: '46vh', md: '54vh' },\n )\n }\n if (variant === 'bleed') return bleedHero(scope, flow, picture, home)\n if (variant === 'column') return columnHero(scope, flow, picture, home)\n if (variant === 'collage') return collageHero(scope, flow, picture, home)\n if (variant === 'panel') return panelHero(scope, flow, picture, home)\n if (variant === 'portrait') return portraitHero(scope, flow, picture)\n const band = scope.band\n scope.centered = false\n if (variant === 'split') {\n const words = compileFlow(scope, flow, 'half') as string\n const photo = designPicture(scope, picture, {\n aspectRatio: home ? { xs: '4 / 3', md: '4 / 5' } : { xs: '4 / 3', md: '1 / 1' },\n borderRadius: 2,\n })\n const right = design.choices.featureLeft\n const row = designRow(\n scope,\n [\n { id: words, size: 'xs:12 md:6', ...(right ? { sx: { order: { xs: 0, md: 1 } } } : {}) },\n { id: photo, size: 'xs:12 md:6' },\n ],\n '8',\n )\n const container = tree.add('muiContainer', { maxWidth: 'lg' }, { py: { xs: 6, md: 10 } }, [row], 'container')\n return designedRoot(scope, [container], bandSx(band), band === 'dark')\n }\n // Editorial: display type across the page, the rest in a row under it, a wide photo below.\n const top = flow.filter((block) => block.kind === 'eyebrow' || block.kind === 'heading')\n const rest = flow.filter((block) => block.kind !== 'eyebrow' && block.kind !== 'heading')\n const lede = rest.filter((block) => block.kind !== 'button')\n const actions = rest.filter((block) => block.kind === 'button')\n const headId = compileFlow(scope, top, 'full')\n const ledeId = compileFlow(scope, lede, 'half')\n const actionsId = compileFlow(scope, actions, 'half')\n const under =\n ledeId && actionsId\n ? designRow(\n scope,\n [\n { id: ledeId, size: 'xs:12 md:7' },\n { id: actionsId, size: 'xs:12 md:5', sx: { display: 'flex', justifyContent: { xs: 'flex-start', md: 'flex-end' } } },\n ],\n '4',\n 'flex-end',\n )\n : (ledeId ?? actionsId)\n const photo = designPicture(scope, picture, {\n aspectRatio: home ? { xs: '4 / 3', md: '21 / 9' } : { xs: '16 / 9', md: '3 / 1' },\n borderRadius: 2,\n })\n const stack = tree.add('muiStack', { spacing: '6', useFlexGap: true }, null, [headId, under, photo], 'content')\n const container = tree.add('muiContainer', { maxWidth: 'lg' }, { pt: { xs: 8, md: 12 }, pb: { xs: 6, md: 10 } }, [stack], 'container')\n return designedRoot(scope, [container], bandSx(band), band === 'dark')\n}\n\n/** Words over a full-bleed photo, on a scrim that keeps them readable, in the site's dark scheme. */\nfunction cover(\n scope: SectionScope,\n flow: readonly AiLayoutBlock[],\n picture: DesignedPicture,\n minHeight: Record<string, string>,\n): string {\n const tree = scope.page.tree\n // The photo dimmed over black: the scrim that keeps the words over it readable.\n const photo = designPicture(\n scope,\n picture,\n { position: 'absolute', top: 0, left: 0, width: '100%', height: '100%', bgcolor: 'common.black' },\n 'coverPhoto',\n { opacity: 0.42 },\n )\n scope.overPhoto = true\n const words = compileFlow(scope, flow, 'full') as string\n const measure = tree.add(\n 'muiBox',\n null,\n scope.centered ? { maxWidth: { xs: '100%', md: '75%' }, mx: 'auto' } : { maxWidth: { xs: '100%', md: '62%' } },\n [words],\n 'measure',\n )\n const container = tree.add(\n 'muiContainer',\n { maxWidth: 'lg' },\n { position: 'relative', zIndex: 1, py: { xs: 10, md: 14 } },\n [measure],\n 'container',\n )\n return designedRoot(\n scope,\n [photo, container],\n { position: 'relative', overflow: 'hidden', display: 'flex', alignItems: { xs: 'flex-end', md: 'center' }, minHeight },\n true,\n )\n}\n\n/** The surface a band paints, as a palette role: what a picture laid over another is edged in. */\nfunction bandSurface(band: AiLayoutBand): string {\n if (band === 'soft') return 'background.paper'\n if (band === 'brand') return 'primary.main'\n return 'background.default'\n}\n\n/**\n * A bleed hero (AGL-3985): the band in two halves, a photo filling one of\n * them edge to edge, top to bottom, and the words in the other, centered in\n * its height. On a phone the photo sits over the words.\n */\nfunction bleedHero(scope: SectionScope, flow: readonly AiLayoutBlock[], picture: DesignedPicture, home: boolean): string {\n const { page } = scope\n const tree = page.tree\n const design = page.design as NonNullable<PageScope['design']>\n const band = scope.band\n scope.centered = false\n const words = compileFlow(scope, flow, 'half') as string\n const measure = tree.add('muiBox', null, { maxWidth: { xs: '100%', md: '88%' }, px: { xs: 3, sm: 6, md: 8 }, py: { xs: 6, md: 10 } }, [words], 'measure')\n const photo = designPicture(scope, picture, { height: '100%', minHeight: home ? { xs: '46vh', md: '84vh' } : { xs: '36vh', md: '56vh' } }, 'bleedPhoto')\n const right = design.choices.featureLeft\n const row = tree.add(\n 'muiGrid',\n { container: true, spacing: '0' },\n { alignItems: 'stretch' },\n [\n tree.add('muiGrid', { size: 'xs:12 md:6' }, right ? { order: { xs: 0, md: 1 } } : null, [photo], 'column'),\n tree.add('muiGrid', { size: 'xs:12 md:6' }, { display: 'flex', alignItems: 'center', justifyContent: right ? 'flex-end' : 'flex-start' }, [measure], 'column'),\n ],\n 'row',\n )\n return designedRoot(scope, [row], bandSx(band), band === 'dark')\n}\n\n/**\n * A masthead (AGL-3985): the words centered in a narrow column, as a journal\n * or a quiet practice opens, and a wide photo under them.\n */\nfunction columnHero(scope: SectionScope, flow: readonly AiLayoutBlock[], picture: DesignedPicture, home: boolean): string {\n const tree = scope.page.tree\n const band = scope.band\n scope.centered = true\n const words = compileFlow(scope, flow, 'full') as string\n const measure = tree.add('muiBox', null, { maxWidth: { xs: '100%', md: '72%' }, mx: 'auto' }, [words], 'measure')\n const photo = designPicture(scope, picture, {\n aspectRatio: home ? { xs: '4 / 3', md: '16 / 7' } : { xs: '16 / 9', md: '3 / 1' },\n borderRadius: 2,\n })\n const stack = tree.add('muiStack', { spacing: '8', useFlexGap: true }, null, [measure, photo], 'content')\n const container = tree.add('muiContainer', { maxWidth: 'lg' }, { pt: { xs: 8, md: 12 }, pb: { xs: 6, md: 10 } }, [stack], 'container')\n return designedRoot(scope, [container], bandSx(band), band === 'dark')\n}\n\n/**\n * A collage hero (AGL-3985): the words beside two pictures, a tall one and a\n * smaller one laid over its lower corner, edged in the band's own surface, as\n * a shop shows two of its things or an event two moments of its day.\n */\nfunction collageHero(scope: SectionScope, flow: readonly AiLayoutBlock[], picture: DesignedPicture, home: boolean): string {\n const { page } = scope\n const tree = page.tree\n const design = page.design as NonNullable<PageScope['design']>\n const band = scope.band\n scope.centered = false\n const words = compileFlow(scope, flow, 'half') as string\n const tall = designPicture(scope, picture, { width: { xs: '78%', md: '76%' }, aspectRatio: home ? '4 / 5' : '1 / 1', borderRadius: 2 })\n const small = designPicture(\n scope,\n { alt: standInAlt(scope, page.plan.sections[scope.index]?.name), given: false },\n {\n position: 'absolute',\n right: 0,\n bottom: 0,\n width: { xs: '48%', md: '50%' },\n aspectRatio: '1 / 1',\n borderRadius: 2,\n border: 6,\n borderColor: bandSurface(band),\n },\n 'collagePhoto',\n )\n const pictures = tree.add('muiBox', null, { position: 'relative', pb: { xs: 6, md: 10 } }, [tall, small], 'collage')\n const right = design.choices.featureLeft\n const row = designRow(\n scope,\n [\n { id: words, size: 'xs:12 md:5', ...(right ? { sx: { order: { xs: 0, md: 1 } } } : {}) },\n { id: pictures, size: 'xs:12 md:7' },\n ],\n '8',\n )\n const container = tree.add('muiContainer', { maxWidth: 'lg' }, { py: { xs: 6, md: 10 } }, [row], 'container')\n return designedRoot(scope, [container], bandSx(band), band === 'dark')\n}\n\n/**\n * A panel hero (AGL-3985): a full-bleed photo shown as it is, undimmed, and\n * the words on a card of the page's own surface over its lower corner, as an\n * agent's listing or a firm's office opens. The card carries its own colors,\n * so the words read whatever the photo is.\n */\nfunction panelHero(scope: SectionScope, flow: readonly AiLayoutBlock[], picture: DesignedPicture, home: boolean): string {\n const tree = scope.page.tree\n // The words sit on the card, never on the band the model chose.\n scope.band = 'plain'\n scope.centered = false\n const photo = designPicture(scope, picture, { position: 'absolute', top: 0, left: 0, width: '100%', height: '100%' }, 'panelPhoto')\n const words = compileFlow(scope, flow, 'half') as string\n const card = tree.add(\n 'muiBox',\n null,\n { bgcolor: 'background.paper', color: 'text.primary', borderRadius: 2, boxShadow: 3, p: { xs: 4, md: 6 }, maxWidth: { xs: '100%', md: '52%' } },\n [words],\n 'panel',\n )\n const container = tree.add('muiContainer', { maxWidth: 'lg' }, { position: 'relative', zIndex: 1, pt: { xs: 28, md: 36 }, pb: { xs: 4, md: 8 } }, [card], 'container')\n return designedRoot(\n scope,\n [photo, container],\n { position: 'relative', overflow: 'hidden', display: 'flex', alignItems: 'flex-end', minHeight: home ? { xs: '72vh', md: '84vh' } : { xs: '48vh', md: '56vh' } },\n false,\n )\n}\n\n/**\n * A portrait hero (AGL-3985): a person's own page opens on their round\n * photo, the words centered under it.\n */\nfunction portraitHero(scope: SectionScope, flow: readonly AiLayoutBlock[], picture: DesignedPicture): string {\n const tree = scope.page.tree\n const band = scope.band\n scope.centered = true\n const photo = designPicture(scope, picture, { width: { xs: '44%', sm: '30%', md: '22%' }, aspectRatio: '1 / 1', borderRadius: '50%', flexShrink: 0 })\n const words = compileFlow(scope, flow, 'full') as string\n const measure = tree.add('muiBox', null, { maxWidth: { xs: '100%', md: '72%' }, mx: 'auto' }, [words], 'measure')\n const stack = tree.add('muiStack', { spacing: '5', useFlexGap: true, alignItems: 'center' }, null, [photo, measure], 'content')\n const container = tree.add('muiContainer', { maxWidth: 'lg' }, { py: { xs: 8, md: 12 } }, [stack], 'container')\n return designedRoot(scope, [container], bandSx(band), band === 'dark')\n}\n\n/** A closing section of words over a photo. */\nfunction coverBand(scope: SectionScope, words: readonly AiLayoutBlock[]): string {\n scope.band = 'dark'\n scope.centered = true\n scope.page.settled.push({ at: scope.at, what: 'drawn over a photo' })\n return cover(scope, words, { alt: standInAlt(scope), given: false }, { xs: '56vh', md: '64vh' })\n}\n\n/** A section of words beside a picture, the side turning section by section. */\nfunction feature(scope: SectionScope, words: readonly AiLayoutBlock[]): string {\n const { page } = scope\n const design = page.design as NonNullable<PageScope['design']>\n const left = design.choices.featureLeft !== (page.features % 2 === 1)\n page.features += 1\n page.settled.push({ at: scope.at, what: `set beside a picture on the ${left ? 'left' : 'right'}` })\n scope.centered = false\n const flow = compileFlow(scope, words, 'half') as string\n const photo = designPicture(scope, { alt: standInAlt(scope), given: false }, {\n aspectRatio: { xs: '4 / 3', md: page.features === 1 ? '4 / 5' : '1 / 1' },\n borderRadius: 2,\n })\n const row = designRow(\n scope,\n left\n ? [\n { id: photo, size: 'xs:12 md:6' },\n { id: flow, size: 'xs:12 md:6' },\n ]\n : [\n { id: flow, size: 'xs:12 md:6' },\n { id: photo, size: 'xs:12 md:6' },\n ],\n '8',\n )\n const container = page.tree.add('muiContainer', { maxWidth: 'lg' }, { py: { ...SECTION_PADDING } }, [row], 'container')\n return designedRoot(scope, [container], bandSx(scope.band), scope.band === 'dark')\n}\n\n/** The most sections a page sets beside a photo for being the third in a row with none (AGL-4065). */\nconst AI_LAYOUT_RHYTHM_MOST = 2\n\n/** What the compiler notes of a section it set beside a photo for the page's rhythm (AGL-4065). */\nexport const AI_LAYOUT_RHYTHM_NOTE = 'drawn beside a photo: third text-only band'\n\n/**\n * NO THREE TEXT-ONLY BANDS IN A ROW (AGL-4065). The booth-kit trades homes\n * of 2026-10-25 stacked their middles as bands of words with no picture —\n * Holeshot Moto Repair's numbered steps, its repair list and its reasons to\n * trust the shop, one under another. On a page drawn with a design, whose\n * stand-in pictures the stock library fills, a section that would be the\n * third in a row to show no picture is set beside one instead: its words\n * and its items in one half, a photo of its heading's subject in the other,\n * the side turning as the design's own photo-led sections turn. At most\n * twice a page, and only where the page has a picture left.\n *\n * A section of words or of one group of cards or lines qualifies. Steps,\n * questions and figures read best as text and stay so; a section with a\n * picture, a form, a component or a row of columns of its own is drawn as\n * designed; a group the design draws as pictures, articles or a menu\n * already is one; and the page's closing call to action is the design's to\n * draw (`coverClose`). `null` leaves the section to the design.\n */\nfunction rhythmSection(scope: SectionScope, raw: AiLayoutSection, blocks: readonly AiLayoutBlock[]): string | null {\n const { page, index } = scope\n const design = page.design\n if (!design || index === 0 || (page.bare ?? 0) < 2 || (page.rhythm ?? 0) >= AI_LAYOUT_RHYTHM_MOST || picturesLeft(page) < 1) return null\n if (raw.cols && raw.cols.length >= 2) return null\n const words = blocks.filter((block) => WORD_KINDS.has(block.kind))\n const groups = blocks.filter((block) => !WORD_KINDS.has(block.kind))\n if (groups.length > 1 || !words.some((block) => speaksHeading(scope, block))) return null\n const group = groups[0]\n if (group && ((group.kind !== 'cards' && group.kind !== 'list') || group.to || (group.items?.length ?? 0) > 6)) return null\n if (group?.kind === 'cards' && group.style !== 'quiet' && aiLayoutGroupVariant(design.input, design.choices, scope.words ?? '') !== design.choices.group) return null\n const last = index === page.plan.sections.length - 1\n if (last && words.some((block) => block.kind === 'button')) return null\n if (!group) {\n // A section of words the design already sets beside a photo needs no rule.\n if (!words.some((block) => block.kind === 'text' || block.kind === 'lede') || (design.choices.features && page.features < 2)) return null\n page.rhythm = (page.rhythm ?? 0) + 1\n page.settled.push({ at: scope.at, what: AI_LAYOUT_RHYTHM_NOTE })\n return feature(scope, words)\n }\n page.rhythm = (page.rhythm ?? 0) + 1\n page.settled.push({ at: scope.at, what: AI_LAYOUT_RHYTHM_NOTE })\n return featureGroup(scope, words, group)\n}\n\n/**\n * A section's words and its one group beside a picture of its subject\n * (AGL-4065): the words over the items in the wider half, the photo at 4:3\n * in the other, on the side the design's photo-led sections turn to next.\n */\nfunction featureGroup(scope: SectionScope, words: readonly AiLayoutBlock[], group: AiLayoutBlock): string {\n const { page } = scope\n const design = page.design as NonNullable<PageScope['design']>\n const left = design.choices.featureLeft !== (page.features % 2 === 1)\n page.features += 1\n scope.centered = false\n // The heading and its words open the half, the group under them, any button last.\n const flow = compileFlow(scope, [...words.filter((block) => block.kind !== 'button'), group, ...words.filter((block) => block.kind === 'button')], 'half') as string\n const photo = designPicture(scope, { alt: standInAlt(scope), given: false }, { aspectRatio: '4 / 3', borderRadius: 2 })\n const row = designRow(\n scope,\n left\n ? [\n { id: photo, size: 'xs:12 md:5' },\n { id: flow, size: 'xs:12 md:7' },\n ]\n : [\n { id: flow, size: 'xs:12 md:7' },\n { id: photo, size: 'xs:12 md:5' },\n ],\n '8',\n )\n const container = page.tree.add('muiContainer', { maxWidth: 'lg' }, { py: { ...SECTION_PADDING } }, [row], 'container')\n return designedRoot(scope, [container], bandSx(scope.band), scope.band === 'dark')\n}\n\n/**\n * The variant a designed group's item title takes (AGL-4065): the heading\n * style it names, or — where the site's seed sets its titles as labels — the\n * theme's own overline, spaced capitals over the item's words.\n */\nfunction itemTitleVariant(scope: SectionScope, heading: string): string {\n return scope.page.design?.choices.headingCase === 'caps' ? 'overline' : heading\n}\n\n/** A heading beside its items: the words in a narrow column, the items ruled in the wide one. */\nfunction splitSection(\n scope: SectionScope,\n head: readonly AiLayoutBlock[],\n group: AiLayoutBlock,\n tail: readonly AiLayoutBlock[],\n): string {\n const { page } = scope\n scope.centered = false\n scope.groupStyle = 'ruled'\n page.splitAt = scope.index\n page.settled.push({ at: scope.at, what: 'the heading set beside its items' })\n const words = compileFlow(scope, [...head, ...tail], 'half')\n const items = compileFlow(scope, [group], 'half')\n if (!words || !items) {\n const flow = [words, items].filter((id): id is string => !!id)\n const container = page.tree.add('muiContainer', { maxWidth: 'lg' }, { py: { ...SECTION_PADDING } }, flow, 'container')\n return designedRoot(scope, [container], bandSx(scope.band), scope.band === 'dark')\n }\n const row = designRow(\n scope,\n [\n { id: words, size: 'xs:12 md:5' },\n { id: items, size: 'xs:12 md:7' },\n ],\n '8',\n 'flex-start',\n )\n const container = page.tree.add('muiContainer', { maxWidth: 'lg' }, { py: { ...SECTION_PADDING } }, [row], 'container')\n return designedRoot(scope, [container], bandSx(scope.band), scope.band === 'dark')\n}\n\n/**\n * Items under rules, one a line, each opening under a thin rule in the\n * text's own color. One style key an element, so a long list repeats no\n * multi-key inline style (rule 16); and no Stack `divider`, which a\n * published page's renderer hands a Stack as one child and so never draws.\n */\nfunction ruledList(scope: SectionScope, ids: readonly string[], role: string): string {\n const tree = scope.page.tree\n return tree.add(\n 'muiStack',\n { spacing: '2' },\n null,\n ids.map((id) => tree.add('muiBox', null, { borderTop: 1 }, [tree.add('muiBox', null, { pt: 2 }, [id], 'ruledWords')], 'ruledLine')),\n role,\n )\n}\n\n/** Numbered items as a ruled list: each number beside its title and words. */\nfunction timeline(scope: SectionScope, items: readonly AiLayoutItem[]): string {\n const tree = scope.page.tree\n const facts = scope.page.targets.facts\n const rows = items.map((item, position) =>\n tree.add(\n 'muiStack',\n { direction: 'row', spacing: '3', alignItems: 'baseline' },\n null,\n [\n // The numbers keep one column, so every title starts at the same line.\n tree.add(\n 'muiBox',\n null,\n { flex: '0 0 3.5rem' },\n [tree.add('muiTypography', { children: String(position + 1).padStart(2, '0'), variant: 'h4', component: 'p' }, accent(scope), null, 'number')],\n 'numberColumn',\n ),\n tree.add(\n 'muiStack',\n { spacing: '1' },\n null,\n [\n item.title.trim()\n ? tree.add('muiTypography', { children: aiLayoutWords(item.title, 'itemTitle', facts, scope.page.options.language), variant: itemTitleVariant(scope, 'h5'), component: itemElement(scope) }, null, null, 'title')\n : null,\n item.text.trim()\n ? tree.add('muiTypography', { children: aiLayoutWords(item.text, 'itemText', facts, scope.page.options.language), variant: 'body1' }, muted(scope), null, 'text')\n : null,\n ],\n 'stepWords',\n ),\n ],\n 'step',\n ),\n )\n return ruledList(scope, noted(scope, rows), 'timeline')\n}\n\n/** A group drawn the design's way; `null` to draw it as the theme's cards. */\nfunction designedGroup(\n scope: SectionScope,\n variant: AiLayoutGroupVariant,\n items: readonly AiLayoutItem[],\n room: Room,\n): string | null {\n const { page } = scope\n const tree = page.tree\n const facts = page.targets.facts\n const title = (item: AiLayoutItem, type = 'h5') =>\n item.title.trim()\n ? tree.add('muiTypography', { children: aiLayoutWords(item.title, 'itemTitle', facts, scope.page.options.language), variant: type, component: itemElement(scope) }, null, null, 'title')\n : null\n const words = (item: AiLayoutItem, type = 'body1') =>\n item.text.trim()\n ? tree.add('muiTypography', { children: aiLayoutWords(item.text, 'itemText', facts, scope.page.options.language), variant: type }, muted(scope), null, 'text')\n : null\n if (variant === 'cards') return null\n if (variant === 'icons') return iconColumns(scope, items, room)\n const pictured = variant === 'pictures' || variant === 'articles'\n if (variant === 'ruled' || (pictured && (room !== 'full' || picturesLeft(page) < items.length))) {\n const perRow = across(items.length, room, 'cards')\n if (perRow <= 1) {\n // Stacked, the rules run between the items.\n const ids = items.map((item) => tree.add('muiStack', { spacing: '1' }, null, [title(item, itemTitleVariant(scope, 'h5')), words(item)], 'ruled'))\n return ruledList(scope, noted(scope, ids), 'ruledItems')\n }\n // Side by side, each column opens under a rule in the text's own color.\n const ids = items.map((item) =>\n tree.add('muiBox', null, { borderTop: 1 }, [tree.add('muiStack', { spacing: '1' }, { pt: 2.5 }, [title(item, itemTitleVariant(scope, 'h5')), words(item)], 'ruledWords')], 'ruled'),\n )\n return layOut(scope, noted(scope, ids), perRow, '5', 'ruledItems')\n }\n if (variant === 'menu') {\n const ids = items.map((item) => tree.add('muiStack', { spacing: '0.5' }, null, [title(item, 'h6'), words(item, 'body2')], 'dish'))\n noted(scope, ids)\n // Two columns of lines under rules, the first half and the second.\n const half = room === 'full' && ids.length >= 4 ? Math.ceil(ids.length / 2) : ids.length\n const lists = [ids.slice(0, half), ids.slice(half)].filter((list) => list.length).map((list) => ruledList(scope, list, 'menu'))\n if (lists.length === 1) return lists[0]\n // On a phone the two columns read as one list, the second opening under\n // its own rule a line's gap below the first; side by side, a gutter.\n const [first, second] = lists\n return tree.add(\n 'muiGrid',\n { container: true, rowSpacing: '2', columnSpacing: '8' },\n { alignItems: 'flex-start' },\n [\n tree.add('muiGrid', { size: 'xs:12 md:6' }, null, [first], 'column'),\n tree.add('muiGrid', { size: 'xs:12 md:6' }, null, [second], 'column'),\n ],\n 'menuRow',\n )\n }\n // Pictures over each item's title and words.\n const design = page.design as NonNullable<PageScope['design']>\n const mosaic = variant === 'pictures' && design.choices.pictures === 'mosaic' && items.length >= 2\n const portrait = design.input.kind === 'photography'\n const perRow = items.length === 4 || items.length === 2 ? 2 : Math.min(3, items.length)\n page.settled.push({ at: scope.at, what: `${items.length} items drawn as ${mosaic ? 'a mosaic of pictures' : variant}` })\n const cells = items.map((item, position) => {\n // A mosaic's rows turn wide-narrow, narrow-wide; an odd one out spans the row.\n const row = Math.floor(position / 2)\n const lone = mosaic && position === items.length - 1 && items.length % 2 === 1\n const wide = mosaic && !lone && position % 2 === row % 2\n const span = !mosaic ? 12 / perRow : lone ? 12 : wide ? 7 : 5\n const aspect = !mosaic ? (variant === 'articles' ? '3 / 2' : portrait ? '4 / 5' : '4 / 3') : lone ? '21 / 9' : wide ? '4 / 3' : '4 / 5'\n // The picture is its own frame: its shape its one style, so a grid of them repeats no inline style.\n // A portfolio's or a photographer's gallery opens in a lightbox, its\n // pictures one gallery with the item's title as each caption (AGL-3717).\n const opens = variant === 'pictures' && aiOpensGalleriesInLightbox(page)\n // A store's collection tiles open its Shop page (AGL-3676).\n const shop = variant === 'pictures' && !opens && aiLayoutFamily(design.input.kind) === 'retail' ? shopPageOf(page) : null\n const photo = designImage(\n scope,\n { alt: standInAlt(scope, item.title || item.text), given: false },\n { width: '100%', ...(opens ? lightboxProps(scope, item.title) : {}), ...(shop ? { screenId: shop } : {}) },\n { aspectRatio: { xs: '4 / 3', md: aspect } },\n )\n const id = tree.add(\n 'muiStack',\n { spacing: '1.5' },\n null,\n [photo, title(item, variant === 'articles' ? 'h5' : 'h6'), words(item, 'body2')],\n variant === 'articles' ? 'article' : 'work',\n )\n return { id, size: span === 12 ? 'xs:12 sm:12' : `xs:12 ${span === 6 ? 'sm' : 'md'}:${span}` }\n })\n noted(\n scope,\n cells.map((cell) => cell.id),\n )\n return tree.add(\n 'muiGrid',\n { container: true, spacing: mosaic ? '5' : '4' },\n { alignItems: 'flex-start' },\n cells.map((cell) => tree.add('muiGrid', { size: cell.size }, null, [cell.id], 'cell')),\n variant,\n )\n}\n\n// ── A section the site's records fill (AGL-3676) ──────────────────────────\n//\n// The section's words — its eyebrow, heading and lede — are the design's;\n// what it lists is the site's: its products through the commerce plugin's\n// Product grid, its posts through the content plugin's Collection Entries.\n// Any group the design drew for those records (cards naming products, a list\n// of post titles) stands in for them, and is left out.\n\n/** The block kinds a listing stands in for: the records the design described in words. */\nconst LISTING_REPLACES: ReadonlySet<AiLayoutBlock['kind']> = new Set([\n 'cards',\n 'steps',\n 'stats',\n 'quotes',\n 'list',\n 'image',\n 'component',\n])\n\n/** The tokens a post's card binds, filled per post when the page renders. */\nexport const AI_LAYOUT_POST_CARD_TOKENS = [\n '{{entry.title}}',\n '{{entry.excerpt}}',\n '{{entry.date}}',\n '{{entry.author}}',\n '{{entry.url}}',\n '{{entry.coverImage}}',\n] as const\n\n/** The tokens a post's card puts in a link or a picture, which the page's store admits whole. */\nexport const AI_LAYOUT_POST_ADDRESS_TOKENS: readonly string[] = ['{{entry.url}}', '{{entry.coverImage}}']\n\n/** The button under a featured band that opens the whole list, where the site has one and the design gave none. */\nfunction listingAllButton(page: PageScope, listing: AiLayoutListing): AiLayoutBlock | null {\n const language = page.options.language\n if (listing.kind === 'posts')\n return listing.href ? { kind: 'button', text: aiLayoutLabel('allPosts', language), to: listing.href, style: 'secondary' } : null\n const index = listing.placements.find((placement) => placement.role === 'index' && placement.screenId !== page.targets.pageId)\n if (!index) return null\n const text = aiLayoutLabel(\n listing.kind === 'tracks' ? 'allMusic' : listing.kind === 'events' ? 'allEvents' : listing.kind === 'records' ? 'seeAll' : 'shopAll',\n language,\n )\n return { kind: 'button', text, to: `page:${index.screenId}`, style: 'secondary' }\n}\n\nfunction listingSection(\n scope: SectionScope,\n blocks: readonly AiLayoutBlock[],\n placed: { listing: AiLayoutListing; role: AiLayoutListingRole; filter?: AiLayoutListingFilter },\n): string {\n const { page, index, at } = scope\n const { listing, role, filter } = placed\n if (listing.kind === 'reviews') return reviewsSection(scope, blocks)\n if (listing.kind === 'signup') return signupSection(scope, blocks)\n // The grid straight under a Shop page's title bar opens on the products:\n // the title bar already heads the page (AGL-3676).\n const underTitle = listing.kind === 'products' && role === 'index' && index === 1 && shopGridAt(page) === 1\n const left = blocks.filter((block) => LISTING_REPLACES.has(block.kind))\n if (left.length) {\n page.settled.push({\n at,\n what: `${left.map((block) => block.kind).join(', ')} left out: the section lists the site's own ${listing.kind}`,\n })\n }\n const kept = underTitle ? [] : blocks.filter((block) => !LISTING_REPLACES.has(block.kind)).map(({ col: _col, ...block }) => block)\n const words = kept.filter((block) => block.kind !== 'button' && block.kind !== 'form')\n let actions = kept.filter((block) => block.kind === 'button')\n if (!actions.length && role === 'featured') {\n const all = listingAllButton(page, listing)\n if (all) actions = [all]\n }\n if (!underTitle && !words.some((block) => speaksHeading(scope, block))) {\n // Every band of records is headed: the plan's name for it, or on a first section the page's title.\n words.unshift({ kind: 'heading', text: index === 0 ? page.plan.title : page.plan.sections[index]?.name || page.plan.title })\n }\n page.settled.push({ at, what: `lists the site's ${listing.kind} (${role})` })\n const tree = page.tree\n const centered = scope.centered\n const head = compileFlow(scope, words, centered ? 'full' : 'half')\n const link = compileFlow(scope, actions, 'half')\n // An editorial band's head: the words on the left, the way to the whole list on the right.\n const top =\n head && link && !centered\n ? designRow(\n scope,\n [\n { id: head, size: 'xs:12 md:8' },\n { id: link, size: 'xs:12 md:4', sx: { display: 'flex', justifyContent: { xs: 'flex-start', md: 'flex-end' } } },\n ],\n '3',\n 'flex-end',\n )\n : head\n const records = listingElement(scope, listing, role, filter)\n const parts = [\n top ? (centered ? tree.add('muiContainer', { maxWidth: 'md', disableGutters: true }, null, [top], 'measure') : top) : null,\n records,\n centered || !head ? link : null,\n ].filter((id): id is string => !!id)\n const content = tree.add('muiStack', { spacing: '6', useFlexGap: true, ...(centered ? { alignItems: 'center' } : {}) }, null, parts, 'content')\n const container = tree.add(\n 'muiContainer',\n { maxWidth: 'lg' },\n underTitle\n ? { pt: { xs: 2, md: 3 }, pb: { ...SECTION_PADDING } }\n : { py: index === 0 ? { ...HERO_PADDING } : { ...SECTION_PADDING } },\n [content],\n 'container',\n )\n const name = page.plan.sections[index]?.name?.trim() || `Section ${index + 1}`\n return tree.add(\n 'section',\n {\n element: 'section',\n ariaLabel: sectionLabel(name, index, page.options.language),\n ...(scope.band === 'dark' ? { colorScheme: 'dark' } : {}),\n },\n underTitle ? null : bandSx(scope.band),\n [container],\n 'section',\n page.options.sectionIds?.[index] ?? sectionIdOf(index),\n )\n}\n\n/** What a store's reviews are headed with where neither the design nor the plan says. */\nexport const AI_LAYOUT_REVIEWS_HEADING = AI_LAYOUT_LABELS_EN.reviewsHeading\n\n/**\n * A store's own customer reviews (AGL-3676): the commerce plugin's Product\n * reviews in its store-wide scope, carrying the section's heading itself.\n * It lists approved reviews with their star ratings, and on a published page\n * with none — every store that just opened — it shows nothing, heading and\n * all, so the band takes no room until a shopper has written one. No review\n * is ever written here: the design's quotes, if it gave any, were left out.\n */\nfunction reviewsSection(scope: SectionScope, blocks: readonly AiLayoutBlock[]): string {\n const { page, index, at } = scope\n const tree = page.tree\n const given = blocks.find((block) => speaksHeading(scope, block))\n const heading =\n aiLayoutWords(given?.text, 'heading', page.targets.facts, scope.page.options.language) ||\n aiLayoutFitText(page.plan.sections[index]?.name, 'heading', scope.page.options.language) ||\n aiLayoutLabel('reviewsHeading', page.options.language)\n page.settled.push({ at, what: \"the store's own reviews placed: shown once shoppers leave them, never written for them\" })\n const id = tree.add(\n AI_LAYOUT_LISTING_ELEMENTS.reviews,\n { scope: 'store', heading, maxItems: String(AI_LAYOUT_FEATURED_RECORDS.reviews) },\n // The padding is the element's, so a store with no reviews yet keeps no empty band.\n { py: { ...SECTION_PADDING } },\n null,\n 'reviews',\n )\n // The reviews are what the section shows: its shoppers' to write.\n noted(scope, [id, id])\n const container = tree.add('muiContainer', { maxWidth: 'lg' }, null, [id], 'container')\n return designedRoot(scope, [container], bandSx(scope.band), scope.band === 'dark')\n}\n\n/** What a store's sign-up is headed with where neither the design nor the plan says. */\nexport const AI_LAYOUT_SIGNUP_HEADING = AI_LAYOUT_LABELS_EN.signupHeading\n\n/**\n * A store's newsletter sign-up (AGL-3676): the design's heading and words\n * beside the commerce plugin's Newsletter signup field, or over it on a\n * centered band. Any form or button the design drew for it is the field's.\n */\nfunction signupSection(scope: SectionScope, blocks: readonly AiLayoutBlock[]): string {\n const { page, index, at } = scope\n const tree = page.tree\n const flow = blocks\n .filter((block) => WORD_KINDS.has(block.kind) && block.kind !== 'button')\n .map(({ col: _col, ...block }) => block)\n if (!flow.some((block) => speaksHeading(scope, block))) {\n flow.unshift({ kind: 'heading', text: page.plan.sections[index]?.name || aiLayoutLabel('signupHeading', page.options.language) })\n }\n page.settled.push({ at, what: \"the store's newsletter sign-up placed\" })\n const field = tree.add(AI_LAYOUT_LISTING_ELEMENTS.signup, { buttonLabel: aiLayoutLabel('subscribe', page.options.language) }, null, null, 'signup')\n noted(scope, [field, field])\n const words = compileFlow(scope, flow, scope.centered ? 'full' : 'half')\n const body = scope.centered\n ? tree.add(\n 'muiStack',\n { spacing: '4', alignItems: 'center' },\n null,\n [words, tree.add('muiContainer', { maxWidth: 'sm', disableGutters: true }, null, [field], 'measure')],\n 'content',\n )\n : designRow(\n scope,\n [...(words ? [{ id: words, size: 'xs:12 md:6' }] : []), { id: field, size: 'xs:12 md:6' }],\n '6',\n )\n const container = tree.add('muiContainer', { maxWidth: 'lg' }, { py: { ...SECTION_PADDING } }, [body], 'container')\n return designedRoot(scope, [container], bandSx(scope.band), scope.band === 'dark')\n}\n\n/** A store's Shop page's grid section on this page, by plan index; -1 where this page is not its Shop page. */\nfunction shopGridAt(page: PageScope): number {\n const products = (page.targets.listings ?? []).find((listing) => listing.kind === 'products')\n return (\n products?.placements.find((placement) => placement.role === 'index' && placement.screenId === page.targets.pageId)?.section ??\n -1\n )\n}\n\n/** A store's Shop page, by its id, where this page is another page of the store; `null` otherwise. */\nfunction shopPageOf(page: PageScope): string | null {\n const products = (page.targets.listings ?? []).find((listing) => listing.kind === 'products')\n const shop = products?.placements.find((placement) => placement.role === 'index')?.screenId\n return shop && shop !== page.targets.pageId && page.targets.pages.some((entry) => entry.id === shop) ? shop : null\n}\n\n/**\n * A Shop page's opening, as a storefront's collection page opens (AGL-3676):\n * the page's title and one line under it, on the page's own ground, with\n * little room around them — no photo and no buttons — so the grid that\n * follows starts above the fold. The beta.237 Willow Wick /shop opened on a\n * tall candle photo and its words, the products below the fold.\n */\nfunction shopTitle(scope: SectionScope, blocks: readonly AiLayoutBlock[]): string {\n const { page, at } = scope\n const left = blocks.filter((block) => !['eyebrow', 'heading', 'lede', 'text'].includes(block.kind))\n if (left.length) {\n page.settled.push({ at, what: `${left.map((block) => block.kind).join(', ')} left out: a Shop page opens on its title and its grid` })\n }\n const heading = blocks.find((block) => speaksHeading(scope, block))\n const line = blocks.find((block) => block.kind === 'lede' || block.kind === 'text')\n const eyebrow = blocks.find((block) => block.kind === 'eyebrow')\n const flow: AiLayoutBlock[] = [\n ...(eyebrow ? [eyebrow] : []),\n { kind: 'heading', text: heading?.text ?? page.plan.title },\n ...(line ? [{ kind: 'lede' as const, text: line.text }] : []),\n ]\n scope.band = 'plain'\n scope.centered = false\n page.settled.push({ at, what: \"drawn as the Shop page's title bar, the grid under it\" })\n const words = compileFlow(scope, flow, 'half') as string\n const container = page.tree.add('muiContainer', { maxWidth: 'lg' }, { pt: { xs: 5, md: 7 }, pb: { xs: 1, md: 2 } }, [words], 'container')\n return designedRoot(scope, [container], null, false)\n}\n\n/**\n * A storefront's home hero sells (AGL-3676): it opens the shop. Where the\n * design gave it no button to the Shop page, \"Shop all\" leads its buttons,\n * and any other primary button steps back to secondary beside it.\n */\nfunction sellingHero(scope: SectionScope, flow: AiLayoutBlock[]): void {\n const design = scope.page.design\n if (!design?.input.home || aiLayoutFamily(design.input.kind) !== 'retail') return\n const shop = shopPageOf(scope.page)\n if (!shop || flow.some((block) => block.kind === 'button' && block.to === `page:${shop}`)) return\n const firstButton = flow.findIndex((block) => block.kind === 'button')\n for (const [at, block] of flow.entries()) {\n if (block.kind === 'button' && (block.style ?? 'primary') === 'primary') flow[at] = { ...block, style: 'secondary' }\n }\n const text = aiLayoutLabel('shopAll', scope.page.options.language)\n const shopAll: AiLayoutBlock = { kind: 'button', text, to: `page:${shop}`, style: 'primary' }\n if (firstButton === -1) flow.push(shopAll)\n else flow.splice(firstButton, 0, shopAll)\n scope.page.settled.push({ at: scope.at, what: `the hero opens the shop: \"${text}\" leads its buttons` })\n}\n\n/** The button a storefront's hero opens its shop with. */\nexport const AI_LAYOUT_SHOP_ALL = AI_LAYOUT_LABELS_EN.shopAll\n\n/**\n * A storefront's reasons to buy as open columns, each led by an icon over its\n * title and words (AGL-3676): the icon the design named for it, else one its\n * words suggest (shipping a truck, returns the arrows, small batch the hand),\n * else one neutral icon along the row; a row of places (\"Areas we serve\")\n * shows the place marker for every place (AGL-4065). One style key an\n * element, so a row repeats no multi-key inline style (rule 16).\n */\nfunction iconColumns(scope: SectionScope, items: readonly AiLayoutItem[], room: Room): string {\n const { page } = scope\n const tree = page.tree\n const facts = page.targets.facts\n const iconWords = aiStorefrontItemIcons(items, (word) => !!aiIconOfWord(word), {\n section: scope.words ?? '',\n ...(page.design ? { kind: page.design.input.kind } : {}),\n })\n const perRow = across(items.length, room, 'cards')\n const textAlign = scope.centered ? { align: 'center' } : {}\n page.settled.push({ at: scope.at, what: `${items.length} items drawn as icon columns` })\n const ids = items.map((item, position) => {\n const icon = aiIconOfWord(iconWords[position]) ?? AI_ICON_LIBRARY.star\n return tree.add(\n 'muiStack',\n { spacing: '1.5', ...(scope.centered ? { alignItems: 'center' } : {}) },\n null,\n [\n tree.add(AI_ICON_COMPONENT_ID, { iconId: icon.id, size: '32' }, accent(scope), null, 'icon'),\n item.title.trim()\n ? tree.add(\n 'muiTypography',\n { children: aiLayoutWords(item.title, 'itemTitle', facts, scope.page.options.language), variant: itemTitleVariant(scope, 'h6'), component: itemElement(scope), ...textAlign },\n null,\n null,\n 'title',\n )\n : null,\n item.text.trim()\n ? tree.add('muiTypography', { children: aiLayoutWords(item.text, 'itemText', facts, scope.page.options.language), variant: 'body2', ...textAlign }, muted(scope), null, 'text')\n : null,\n ],\n 'iconItem',\n )\n })\n return layOut(scope, noted(scope, ids), perRow, '5', 'icons')\n}\n\n/**\n * The element that lists the records, bound to them: the Product grid over\n * the site's catalog, or Collection Entries over its blog with one post's\n * card as the template it repeats. Its records count as the section's items.\n */\nfunction listingElement(\n scope: SectionScope,\n listing: AiLayoutListing,\n role: AiLayoutListingRole,\n filter?: AiLayoutListingFilter,\n): string {\n const { page } = scope\n const tree = page.tree\n const featured = role === 'featured'\n const shown = featured ? AI_LAYOUT_FEATURED_RECORDS[listing.kind] : 12\n const element = AI_LAYOUT_LISTING_ELEMENTS[listing.kind]\n let id: string\n if (listing.kind === 'tracks') {\n // An empty player (AGL-3716): its \"add your tracks\" state, which the owner\n // fills from their own media library. No source, ever — the section's\n // heading and words are the model's, the recordings the owner's.\n id = tree.add(element, null, null, null, 'player')\n page.settled.push({ at: scope.at, what: 'an empty music player placed for the owner’s own tracks' })\n // The player is what the section shows: its tracks are the owner's to add.\n noted(scope, [id, id])\n return id\n }\n if (listing.kind === 'events') {\n // The site's published events (AGL-3755), each with its date, place and\n // cover: the section's heading is the model's, so the list adds none.\n id = tree.add(element, featured ? { maxItems: String(shown) } : null, null, null, 'events')\n page.settled.push({ at: scope.at, what: 'the site’s events listed by the Event List' })\n noted(scope, [id, id])\n return id\n }\n if (listing.kind === 'products') {\n id = tree.add(\n element,\n {\n source: 'all',\n sort: 'newest',\n columns: String(featured ? Math.min(AI_LAYOUT_FEATURED_RECORDS.products, Math.max(3, listing.records.length)) : 3),\n // The shop's own page browses: a sort and the store's categories as\n // filter chips (shown once it has any), never categories drawn as cards.\n ...(featured ? { maxItems: String(shown) } : { pageSize: String(shown), showSort: true, showCategories: true }),\n cardStyle: 'photo',\n // A storefront's cards sell from the grid (AGL-3676): Add to cart on a\n // product with one variant, Choose options on one with several.\n quickAdd: true,\n // A store that opens before its first products are in says so, with a\n // way to hear when they land (AGL-3676): never placeholder products.\n emptyTitle: aiLayoutLabel('storeEmptyTitle', page.options.language),\n emptyText: aiLayoutLabel(listing.emptyAction ? 'storeEmptyText' : 'storeEmptyTextAlone', page.options.language),\n ...(listing.emptyAction\n ? {\n emptyActionLabel:\n listing.emptyAction.label === AI_LAYOUT_LABELS_EN.getInTouch\n ? aiLayoutLabel('getInTouch', page.options.language)\n : listing.emptyAction.label,\n emptyActionHref: listing.emptyAction.href,\n }\n : {}),\n },\n null,\n null,\n 'products',\n )\n } else if (listing.kind === 'records') {\n id = recordsElement(scope, listing, featured ? shown : null, filter)\n } else {\n id = postsElement(scope, listing, featured ? shown : COLLECTION_INDEX_POSTS)\n }\n // What a visitor sees here is the site's records, however many it keeps —\n // a section named for one group, that group's (AGL-3921): the section shows\n // its planned items when it has any to show.\n const listed = filter?.records.length ? filter.records.length : listing.records.length\n noted(scope, Array.from({ length: Math.max(2, Math.min(shown, listed)) }, () => id))\n return id\n}\n\n/** What a store's Product grid says while the store lists nothing yet (AGL-3676). */\nexport const AI_LAYOUT_STORE_EMPTY = {\n title: AI_LAYOUT_LABELS_EN.storeEmptyTitle,\n text: AI_LAYOUT_LABELS_EN.storeEmptyText,\n /** Said where the site has no page to get in touch on. */\n textAlone: AI_LAYOUT_LABELS_EN.storeEmptyTextAlone,\n} as const\n\n/** The most posts a page of the site lists where it is the writing's own page. */\nconst COLLECTION_INDEX_POSTS = 9\n\n/** The blog's posts as the site's design lists them: a grid of covers, or a ruled list with the dates. */\nfunction postsElement(scope: SectionScope, listing: AiLayoutListing, limit: number): string {\n const { page } = scope\n const tree = page.tree\n const ruled = page.design?.choices.writing === 'ruled'\n const titleElement = itemElement(scope)\n const cover = (sx: Record<string, unknown>) =>\n tree.add(\n 'image',\n { src: '{{entry.coverImage}}', alt: '{{entry.title}}', href: '{{entry.url}}', objectFit: 'cover', width: '100%', loading: 'lazy' },\n sx,\n null,\n 'postCover',\n )\n const meta = tree.add('muiTypography', { children: '{{entry.date}} · {{entry.author}}', variant: 'caption', component: 'p' }, muted(scope), null, 'postMeta')\n const title = tree.add('muiTypography', { children: '{{entry.title}}', variant: ruled ? 'h5' : 'h6', component: titleElement }, null, null, 'postTitle')\n const excerpt = tree.add('muiTypography', { children: '{{entry.excerpt}}', variant: 'body2' }, muted(scope), null, 'postExcerpt')\n const more = tree.add(\n 'muiScreenLink',\n { children: aiLayoutLabel('readPost', page.options.language), href: '{{entry.url}}', renderAs: 'link', color: 'inherit' },\n { alignSelf: 'flex-start' },\n null,\n 'postLink',\n )\n page.settled.push({ at: scope.at, what: `posts listed as ${ruled ? 'a ruled list' : 'a grid of covers'}` })\n const card = ruled\n ? tree.add(\n 'muiBox',\n null,\n { borderTop: 1, pt: 3 },\n [\n tree.add(\n 'muiStack',\n { direction: 'row', spacing: '3', alignItems: 'flex-start' },\n null,\n [\n tree.add('muiStack', { spacing: '1' }, { flex: '1 1 auto', minWidth: 0 }, [meta, title, excerpt, more], 'postWords'),\n tree.add('muiBox', null, { flex: '0 0 auto', width: { xs: '30%', md: '24%' } }, [cover({ aspectRatio: '4 / 3', borderRadius: 2 })], 'postThumb'),\n ],\n 'postRow',\n ),\n ],\n 'post',\n )\n : tree.add('muiStack', { spacing: '1.5' }, null, [cover({ aspectRatio: '3 / 2', borderRadius: 2 }), meta, title, excerpt, more], 'post')\n return tree.add(\n AI_LAYOUT_LISTING_ELEMENTS.posts,\n { collectionSlug: listing.collectionSlug, entriesLimit: String(limit), spacing: ruled ? '3' : '0' },\n ruled ? null : { display: 'grid', gridTemplateColumns: { xs: '1fr', md: 'repeat(3, 1fr)' }, gap: 5 },\n [card],\n 'posts',\n )\n}\n\n// ── A dataset's records (AGL-3616) ───────────────────────────────────────\n\n/** The words of the link under each record's card to its own page (AGL-3727). */\nexport const AI_LAYOUT_RECORD_LINK_LABEL = AI_LAYOUT_LABELS_EN.viewDetails\n\n/** A field whose name says it is a record's kicker: its category, role, time or place. */\nconst RECORD_KICKER = /\\b(category|categories|type|kind|role|title|position|section|course|date|dates|time|times|when|day|days|location|place|where|venue|city|duration|level|tag|tags)\\b/i\n/** A field whose name says it is a record's words: its description, bio or answer. */\nconst RECORD_BODY = /\\b(description|summary|details?|about|bio|biography|answer|text|notes?|body|blurb|overview|excerpt|ingredients|includes)\\b/i\n/** A dataset of questions and answers, listed as a ruled list rather than cards. */\nconst RECORD_QUESTIONS = /\\b(faqs?|questions?|q ?& ?a)\\b/i\n/** A dataset of people, whose photos are portraits. */\nconst RECORD_PEOPLE = /\\b(team|staff|people|crew|instructors?|teachers?|stylists?|therapists?|coaches?|trainers?|chefs?|doctors?|dentists?|artists?|founders?|members?)\\b/i\n\n/** The fields a record's card shows: its name, a kicker line and its words, each by id. */\nexport function aiLayoutRecordCardFields(\n fields: readonly { id: string; name: string; type: string }[],\n): { title: string | null; kicker: string | null; body: string | null } {\n const texts = fields.filter((field) => (field.type === 'text' || field.type === 'sorted') && !aiLayoutIsRecordImageAlt(field.name))\n const title = texts.find((field) => field.type === 'text')?.id ?? null\n const rest = texts.filter((field) => field.id !== title)\n const body = rest.find((field) => field.type === 'text' && RECORD_BODY.test(field.name))?.id ?? null\n const kicker = rest.find((field) => field.id !== body && RECORD_KICKER.test(field.name))?.id ?? null\n // Failing a named one, the next text field is the record's words.\n const words = body ?? rest.find((field) => field.type === 'text' && field.id !== kicker)?.id ?? null\n return { title, kicker, body: words }\n}\n\n/**\n * A dataset's records, as the site's design lists them: a Box that repeats\n * its one card over the dataset — the platform's own repeat, which the page\n * renders once per record — or, for questions and answers, a ruled list.\n * The card binds the record's fields as `{{item.<field>}}`: its name as the\n * item's title, a kicker over it (its category, role or time), and its words.\n * A dataset whose records carry a photo (AGL-3616) leads each card with it,\n * an Image bound to the record's photo field — a portfolio's or a\n * photographer's opening in a lightbox, as one gallery captioned with each\n * record's name, as the design's own picture cards do (AGL-3717) — so a list\n * of pieces stays the image-led gallery it was before it was a dataset.\n * A featured band shows the first few; a page of its own, every record.\n */\nfunction recordsElement(scope: SectionScope, listing: AiLayoutListing, limit: number | null, filter?: AiLayoutListingFilter): string {\n const { page } = scope\n const tree = page.tree\n const fields = aiLayoutRecordCardFields(listing.fields ?? [])\n const questions = RECORD_QUESTIONS.test(listing.name)\n const textAlign = scope.centered && !questions ? { align: 'center' } : {}\n const kicker = fields.kicker\n ? tree.add('muiTypography', { children: `{{item.${fields.kicker}}}`, variant: 'overline', component: 'p', ...textAlign }, accent(scope), null, 'recordKicker')\n : null\n const title = fields.title\n ? tree.add(\n 'muiTypography',\n { children: `{{item.${fields.title}}}`, variant: questions ? 'h6' : 'h5', component: itemElement(scope), ...textAlign },\n null,\n null,\n 'recordTitle',\n )\n : null\n const body = fields.body\n ? tree.add('muiTypography', { children: `{{item.${fields.body}}}`, variant: 'body2', ...textAlign }, muted(scope), null, 'recordBody')\n : null\n const photoField = !questions && listing.imageField ? listing.imageField : null\n const altField = photoField ? aiLayoutRecordImageAltField(listing.fields ?? []) : null\n const opens = Boolean(photoField) && aiOpensGalleriesInLightbox(page)\n // Each card opens its record's own page where the dataset has one (AGL-3727):\n // `/{base}/{{item.<address>}}`, filled per record as the card repeats.\n const recordHref = aiLayoutRecordHref(listing)\n const portrait = page.design?.input.kind === 'photography' || RECORD_PEOPLE.test(listing.name)\n const picture = photoField\n ? tree.add(\n 'image',\n {\n src: `{{item.${photoField}}}`,\n // What the photo shows, where the dataset keeps it; a record's name is what it is called (AGL-3856).\n alt: altField\n ? `{{item.${altField}}}`\n : fields.title\n ? `{{item.${fields.title}}}`\n : aiLayoutFitText(listing.name, 'alt', scope.page.options.language) || 'A photo',\n objectFit: 'cover',\n width: '100%',\n loading: 'lazy',\n ...(opens ? { ...lightboxProps(scope), ...(fields.title ? { lightboxCaption: `{{item.${fields.title}}}` } : {}) } : {}),\n // A photo that does not open in a lightbox opens the record's page.\n ...(recordHref && !opens ? { href: recordHref } : {}),\n },\n { aspectRatio: portrait ? '4 / 5' : '4 / 3', borderRadius: 2 },\n null,\n 'recordImage',\n )\n : null\n const more = recordHref\n ? tree.add(\n 'muiScreenLink',\n { children: aiLayoutLabel('viewDetails', page.options.language), href: recordHref, renderAs: 'link', color: 'inherit' },\n { alignSelf: scope.centered && !questions ? 'center' : 'flex-start' },\n null,\n 'recordLink',\n )\n : null\n page.settled.push({\n at: scope.at,\n what: `${listing.name} listed from its dataset${questions ? ' as a ruled list' : picture ? ' as picture cards' : ' as cards'}${\n recordHref ? `, each linking its page under /${listing.recordBase}` : ''\n }${filter ? `, only those filed “${filter.value}”` : ''}`,\n })\n const card = questions\n ? tree.add('muiStack', { spacing: '1' }, { borderTop: 1, pt: 3 }, [title, body, more], 'record')\n : tree.add(\n 'muiStack',\n { spacing: picture ? '1.5' : '1', ...(scope.centered ? { alignItems: 'center' } : {}) },\n null,\n [picture, kicker, title, body, more],\n 'record',\n )\n return tree.add(\n AI_LAYOUT_LISTING_ELEMENTS.records,\n {\n repeatDataset: listing.datasetId,\n ...(limit ? { repeatLimit: String(limit) } : {}),\n // A section named for one group lists that group's records (AGL-3921).\n ...(filter ? { repeatFilter: aiLayoutRepeatFilterOf(filter) } : {}),\n },\n questions\n ? { display: 'grid', gap: 3 }\n : { display: 'grid', gridTemplateColumns: { xs: '1fr', md: 'repeat(3, 1fr)' }, gap: 5 },\n [card],\n 'records',\n )\n}\n\n// ── A page brought in (AGL-4107) ──────────────────────────────────────────\n//\n// What a page brought in from its owner's own website draws that a designed\n// page never does: the source's own pictures and icons, every item of every\n// group with all its parts (its figure, its paragraphs, its bullet points,\n// its own links), its tables, its tabs and its strips of logos. Every word is\n// the source's, as written, and every element is the palette's with the\n// theme's tokens, as the rest of the compiler draws: a card is the theme's\n// Card, a question the Accordion, a link the Button. One style key on each\n// repeated element, so a page of many items repeats no inline style (rule 16).\n\n/** The source's picture, at its own shape, rounded as the theme rounds a frame. */\nfunction sourcePicture(scope: SectionScope, picture: AiLayoutPicture, role = 'image'): string {\n const { page } = scope\n page.images += 1\n const destination = picture.to ? aiLayoutImportedDestination(picture.to, page.plan.sections.length) : null\n return page.tree.add(\n 'image',\n {\n src: picture.src,\n ...(picture.alt ? { alt: picture.alt } : { decorative: true }),\n objectFit: 'cover',\n // A byline's portrait is drawn at a portrait's size, round.\n ...(picture.small ? { width: AI_LAYOUT_PORTRAIT_SIZE, height: AI_LAYOUT_PORTRAIT_SIZE } : {}),\n // The first picture of the page loads at once, the rest as they are reached.\n ...(page.images > 1 ? { loading: 'lazy' } : {}),\n ...(destination ? destinationProps(destination) : {}),\n },\n { borderRadius: picture.small ? '50%' : 2 },\n null,\n role,\n )\n}\n\n/** The size a byline's portrait is drawn at on a page brought in (AGL-4107): the Image element's own size field, as an author sets it. */\nexport const AI_LAYOUT_PORTRAIT_SIZE = '4rem'\n\n/** An item's picture, over its words: the card's own top, at one shape across its group. */\nfunction itemPicture(scope: SectionScope, picture: AiLayoutPicture): string {\n const { page } = scope\n page.images += 1\n return page.tree.add(\n 'image',\n {\n src: picture.src,\n ...(picture.alt ? { alt: picture.alt } : { decorative: true }),\n objectFit: 'cover',\n ...(page.images > 1 ? { loading: 'lazy' } : {}),\n },\n { aspectRatio: '16 / 9' },\n null,\n 'itemPicture',\n )\n}\n\n/** An icon of a page brought in: the source's own drawing, else the library icon its word names. */\nfunction sourceIcon(scope: SectionScope, own: { iconPath?: string; icon?: string }, size: string, sx: Record<string, unknown> | null, role = 'icon'): string | null {\n const tree = scope.page.tree\n if (own.iconPath) return tree.add(AI_ICON_COMPONENT_ID, { iconPath: own.iconPath, size }, sx, null, role)\n const icon = aiIconOfWord(own.icon)\n return icon ? tree.add(AI_ICON_COMPONENT_ID, { iconId: icon.id, size }, sx, null, role) : null\n}\n\n/** Lines of words as paragraphs of one style, each its own element. */\nfunction paragraphs(scope: SectionScope, lines: readonly (string | undefined)[], variant: string, sx: Record<string, unknown> | null, role = 'text'): string[] {\n const tree = scope.page.tree\n return lines\n .map((line) => aiLayoutAsWritten(line))\n .filter(Boolean)\n .map((line) => tree.add('muiTypography', { children: line, variant, ...align(scope) }, sx, null, role))\n}\n\n/**\n * Words of a page brought in that are a link longer than a button's label\n * holds (AGL-4107): the words in the brand color, inside a Link Container\n * that goes where the source's link went.\n */\nfunction linkedWords(scope: SectionScope, text: string, destination: AiLayoutDestination): string {\n const tree = scope.page.tree\n const words = tree.add('muiTypography', { children: text, variant: 'body1', ...align(scope) }, accent(scope), null, 'linkWords')\n if (destination.kind === 'section') {\n linkTo(scope, words, destination)\n return words\n }\n return tree.add(\n 'muiLinkBox',\n { ...destinationProps(destination), ariaLabel: text.slice(0, AI_TEXT_LIMITS.label), ...(destination.kind === 'href' ? { newTab: true } : {}) },\n null,\n [words],\n 'longLink',\n )\n}\n\n/** An item's bullet points: each led by the source's mark where it drew one, else one under another. */\nfunction bullets(scope: SectionScope, lines: readonly string[], iconPath: string | undefined): string | null {\n const tree = scope.page.tree\n const said = lines.map((line) => aiLayoutAsWritten(line)).filter(Boolean)\n if (!said.length) return null\n if (!iconPath) {\n const rows = said.map((line) => tree.add('muiTypography', { children: line, variant: 'body2' }, null, null, 'line'))\n return tree.add('muiStack', { spacing: '1' }, null, rows, 'bullets')\n }\n const rows = said.map((line) =>\n tree.add(\n 'muiStack',\n { direction: 'row', spacing: '1', alignItems: 'flex-start' },\n null,\n [sourceIcon(scope, { iconPath }, '20', accent(scope), 'check'), tree.add('muiTypography', { children: line, variant: 'body2' }, null, null, 'line')],\n 'row',\n ),\n )\n return tree.add('muiStack', { spacing: '1' }, null, rows, 'bullets')\n}\n\n/** An item's own calls to action, side by side, each as the source drew it. */\nfunction itemLinks(scope: SectionScope, links: readonly AiLayoutLink[]): string | null {\n const tree = scope.page.tree\n const ids = links\n .map((link) => compileButton(scope, { kind: 'button', text: link.text, ...(link.to ? { to: link.to } : {}), style: link.style ?? 'quiet' }))\n .filter((id): id is string => !!id)\n if (!ids.length) return null\n if (ids.length === 1) return ids[0]\n return tree.add('muiStack', { direction: 'row', spacing: '2', useFlexGap: true, flexWrap: 'wrap' }, null, ids, 'actions')\n}\n\n/** How many items of a page brought in sit side by side: as the source lays them out, within the room. */\nfunction importedAcross(block: AiLayoutBlock, count: number, room: Room): number {\n const source = block.columns && block.columns > 0 ? block.columns : count <= 3 ? count : 3\n const wide = Math.max(1, Math.min(4, source, count))\n if (room === 'narrow') return 1\n if (room === 'half') return Math.min(2, wide)\n return wide\n}\n\n/** Whether an item has anything to show. */\nfunction itemShows(item: AiLayoutItem): boolean {\n return Boolean(\n item.title.trim() || item.text.trim() || item.figure?.trim() || item.more?.length || item.list?.length || item.links?.length || item.picture || item.iconPath,\n )\n}\n\n/**\n * A group of a page brought in: every item of it, each with all its parts,\n * laid out in the source's columns and drawn the way its design answer chose\n * (`variant`): the theme's cards, open columns under a rule, open columns led\n * by their icons, or pictures over their words.\n */\nfunction importedGroup(scope: SectionScope, block: AiLayoutBlock, room: Room): string | null {\n const items = (block.items ?? []).filter(itemShows)\n if (!items.length) return null\n const perRow = importedAcross(block, items.length, room)\n const ids = items.map((item) => importedItem(scope, block, item))\n return layOut(scope, noted(scope, ids), perRow, block.kind === 'stats' ? '4' : '3', block.kind === 'cards' ? 'cards' : block.kind)\n}\n\n/** The style an item of a group is drawn in: the design answer's, else the source's own box or none. */\nfunction itemStyle(block: AiLayoutBlock): AiLayoutGroupStyle | 'open' {\n if (block.variant) return block.variant\n if (block.kind === 'stats') return 'open'\n return block.style === 'quiet' ? 'open' : 'cards'\n}\n\n/** One item of a group of a page brought in, every part of it in the source's order. */\nfunction importedItem(scope: SectionScope, block: AiLayoutBlock, item: AiLayoutItem): string {\n const tree = scope.page.tree\n const style = itemStyle(block)\n const kind = block.kind\n const parts: Array<string | null> = []\n const title = aiLayoutAsWritten(item.title)\n const figure = aiLayoutAsWritten(item.figure)\n const titleNode = () =>\n title ? tree.add('muiTypography', { children: title, variant: itemTitleVariant(scope, 'h5'), component: itemElement(scope), ...align(scope) }, null, null, 'title') : null\n if (kind === 'quotes') {\n parts.push(tree.add(AI_ICON_COMPONENT_ID, { iconId: AI_ICON_LIBRARY.quote.id, size: '32' }, { color: 'primary.main' }, null, 'quoteMark'))\n parts.push(...paragraphs(scope, [item.text, ...(item.more ?? [])], 'body1', null, 'quote'))\n if (title) parts.push(tree.add('muiTypography', { children: title, variant: 'subtitle2', component: 'p', ...align(scope) }, null, null, 'attribution'))\n } else if (kind === 'stats') {\n const lead = figure || title\n if (lead) parts.push(tree.add('muiTypography', { children: lead, variant: 'h2', component: 'p', ...align(scope) }, accent(scope), null, 'figure'))\n if (figure && title) parts.push(titleNode())\n parts.push(...paragraphs(scope, [item.text, ...(item.more ?? [])], 'body2', muted(scope), 'label'))\n } else {\n if (item.picture) parts.push(itemPicture(scope, item.picture))\n parts.push(sourceIcon(scope, item, '32', style === 'cards' ? { color: 'primary.main' } : accent(scope)))\n const number = figure ? tree.add('muiTypography', { children: figure, variant: kind === 'steps' ? 'h3' : 'h4', component: 'p', ...align(scope) }, accent(scope), null, kind === 'steps' ? 'number' : 'figure') : null\n // A step's number leads it; a plan's price follows its name.\n if (kind === 'steps') parts.push(number, titleNode())\n else parts.push(titleNode(), number)\n parts.push(...paragraphs(scope, [item.text, ...(item.more ?? [])], 'body1', muted(scope)))\n if (item.list?.length) parts.push(bullets(scope, item.list, item.listIconPath))\n if (item.links?.length) parts.push(itemLinks(scope, item.links))\n }\n const shown = parts.filter((id): id is string => !!id)\n // The picture of a card is its top, edge to edge; the rest sit in its padding.\n const picture = style === 'cards' || style === 'articles' ? (shown[0] && tree.nodes[shown[0]]?.componentId === 'image' ? shown.shift() : null) : null\n const stack = tree.add('muiStack', { spacing: '1.5', ...(scope.centered && (kind === 'stats' || style === 'icons') ? { alignItems: 'center' } : {}) }, null, shown, kind === 'steps' ? 'step' : kind === 'stats' ? 'stat' : 'cardStack')\n let drawn: string\n if (style === 'cards' || style === 'articles') {\n const content = tree.add('muiCardContent', null, { p: 3 }, [stack], 'cardContent')\n drawn = tree.add('muiCard', null, { height: '100%' }, picture ? [picture, content] : [content], kind === 'quotes' ? 'quoteCard' : 'card')\n } else if (style === 'ruled') {\n drawn = tree.add('muiBox', null, { borderTop: 1 }, [tree.add('muiBox', null, { pt: 2.5 }, [stack], 'ruledWords')], 'ruled')\n } else {\n drawn = stack\n }\n // An item the source made one link as a whole is one here (AGL-4107): its\n // words keep their places, and pressing anywhere on it goes where it went.\n const whole = !item.links?.length && item.to ? aiLayoutImportedDestination(item.to, scope.page.plan.sections.length) : null\n if (!whole || whole.kind === 'section') return drawn\n return tree.add(\n 'muiLinkBox',\n { ...destinationProps(whole), ...(title ? { ariaLabel: title.slice(0, 200) } : {}), ...(whole.kind === 'href' ? { newTab: true } : {}) },\n { height: '100%' },\n [drawn],\n 'linked',\n )\n}\n\n/** A list of a page brought in: each line as written, led by the source's mark where it drew one, a link where it was one. */\nfunction importedList(scope: SectionScope, block: AiLayoutBlock, room: Room): string | null {\n const tree = scope.page.tree\n const items = (block.items ?? []).filter((item) => aiLayoutAsWritten(item.title || item.text))\n if (!items.length) return null\n const rows = items.map((item) => {\n const line = aiLayoutAsWritten([item.title, item.text].filter((part) => part.trim()).join(' '))\n const destination = item.to ? aiLayoutImportedDestination(item.to, scope.page.plan.sections.length) : null\n const words = !destination\n ? tree.add('muiTypography', { children: line, variant: 'body1' }, null, null, 'line')\n : line.length > AI_TEXT_LIMITS.button\n ? linkedWords(scope, line, destination)\n : tree.add('muiScreenLink', { children: line, renderAs: 'link', color: 'inherit', ...destinationProps(destination) }, null, null, 'link')\n if (destination && line.length <= AI_TEXT_LIMITS.button) linkTo(scope, words, destination)\n const mark = item.iconPath || item.icon ? sourceIcon(scope, item, '22', accent(scope), 'check') : null\n return mark ? tree.add('muiStack', { direction: 'row', spacing: '1.5', alignItems: 'flex-start' }, null, [mark, words], 'row') : words\n })\n noted(scope, rows)\n const perRow = importedAcross({ ...block, columns: block.columns ?? 1 }, rows.length, room)\n if (perRow > 1) return layOut(scope, rows, perRow, '2', 'list')\n return tree.add('muiStack', { spacing: '1.5' }, null, rows, 'list')\n}\n\n/** Questions and answers of a page brought in: an accordion each, the first open, every answer's paragraphs in it. */\nfunction importedFaq(scope: SectionScope, block: AiLayoutBlock): string | null {\n const tree = scope.page.tree\n const items = (block.items ?? []).filter((item) => aiLayoutAsWritten(item.title))\n if (!items.length) return null\n const panels = items.map((item, position) => {\n const answer = paragraphs(scope, [item.text, ...(item.more ?? [])], 'body1', { color: 'text.secondary' }, 'answer')\n if (item.list?.length) answer.push(bullets(scope, item.list, item.listIconPath) as string)\n if (item.links?.length) {\n const links = itemLinks(scope, item.links)\n if (links) answer.push(links)\n }\n const shown = answer.filter(Boolean)\n return tree.add(\n 'muiAccordion',\n { disableGutters: true, ...(position === 0 ? { defaultExpanded: true } : {}) },\n null,\n [\n tree.add('muiAccordionSummary', { children: aiLayoutAsWritten(item.title) }, null, null, 'question'),\n shown.length\n ? tree.add('muiAccordionDetails', null, null, [shown.length === 1 ? shown[0] : tree.add('muiStack', { spacing: '1.5' }, null, shown, 'answerStack')], 'details')\n : null,\n ],\n 'panel',\n )\n })\n noted(scope, panels)\n return tree.add('muiStack', { spacing: '1.5' }, null, panels, 'faq')\n}\n\n/** A table's cell as the Table element's grid holds it: one line, its pipes escaped. */\nfunction tableCell(text: string): string {\n return aiLayoutAsWritten(text).replace(/\\|/g, '\\\\|')\n}\n\n/** A table of a page brought in: the theme's Table element, every cell's words as written. */\nfunction table(scope: SectionScope, block: AiLayoutBlock): string | null {\n const rows = (block.rows ?? []).filter((row) => row.cells.some((cell) => aiLayoutAsWritten(cell)))\n if (!rows.length) return null\n const width = Math.max(...rows.map((row) => row.cells.length))\n const grid = rows.map((row) => `| ${Array.from({ length: width }, (_, at) => tableCell(row.cells[at] ?? '')).join(' | ')} |`).join('\\n')\n return scope.page.tree.add('dataTable', { rows: grid, headerRow: block.header === true }, null, null, 'table')\n}\n\n/** A label the Tabs element can name a panel by: its words on one line, with no comma it would split at. */\nfunction tabLabel(label: string): string | null {\n const text = aiLayoutAsWritten(label)\n return text && !text.includes(',') && text.length <= AI_TEXT_LIMITS.label ? text : null\n}\n\n/**\n * Tabs of a page brought in: the Tabs element with a panel for each tab,\n * opening on the one the source shows open, where every tab has its panel.\n * A source whose script draws its other panels only when clicked gives a\n * page the open one alone (aglyn.com's plan tabs): then its labels are drawn\n * as the strip they are — the open one filled, the rest outlined — over the\n * panel the source showed, so every label and every word is on the page and\n * no tab opens onto nothing.\n */\nfunction tabs(scope: SectionScope, block: AiLayoutBlock, room: Room): string | null {\n const tree = scope.page.tree\n const given = (block.tabs ?? []).filter((tab) => aiLayoutAsWritten(tab.label) || tab.blocks.length)\n if (!given.length) return null\n const labels = given.map((tab) => tabLabel(tab.label))\n const panels = given.map((tab) => (tab.blocks.length ? tabPanel(scope, tab, room) : null))\n const whole =\n given.length >= 2 &&\n given.length <= 8 &&\n labels.every((label): label is string => !!label) &&\n new Set(labels.map((label) => label.toLowerCase())).size === labels.length &&\n panels.every(Boolean)\n if (whole) {\n const open = given.findIndex((tab) => tab.selected)\n return tree.add(\n 'muiTabs',\n { labels: (labels as string[]).join('\\n'), variant: 'scrollable', ...(open > 0 ? { opensOn: labels[open] } : {}) },\n null,\n given.map((_, at) => tree.add('muiTabPanel', { label: labels[at] }, null, [panels[at] as string], 'tabPanel')),\n 'tabs',\n )\n }\n const strip = given\n .map((tab) => ({ text: aiLayoutAsWritten(tab.label), selected: tab.selected === true }))\n .filter((tab) => tab.text)\n .map((tab) =>\n tab.selected\n ? tree.add(\n 'muiPaper',\n { variant: 'elevation', elevation: '0' },\n { bgcolor: 'primary.main' },\n [tree.add('muiBox', null, { py: 0.75, color: 'primary.contrastText' }, [tree.add('muiTypography', { children: tab.text, variant: 'body2' }, { px: 2 }, null, 'tabLabel')], 'tabWords')],\n 'tab',\n )\n : chip(scope, tab.text, 'tab'),\n )\n const parts = [\n strip.length ? tree.add('muiStack', { direction: 'row', spacing: '1', useFlexGap: true, flexWrap: 'wrap', ...(scope.centered ? { justifyContent: 'center' } : {}) }, null, strip, 'tabStrip') : null,\n ...panels,\n ].filter((id): id is string => !!id)\n if (!parts.length) return null\n return parts.length === 1 ? parts[0] : tree.add('muiStack', { spacing: '4' }, null, parts, 'tabs')\n}\n\n/**\n * A tab's panel of a page brought in: its blocks top to bottom, and the row\n * of columns the source sets in it side by side (AGL-4114), as a section\n * sets its row — the blocks above the row, its columns, the blocks below.\n */\nfunction tabPanel(scope: SectionScope, tab: AiLayoutTab, room: Room): string | null {\n const cols = tab.cols && tab.cols.length >= 2 && room !== 'narrow' ? tab.cols : null\n if (!cols || !tab.blocks.some((block) => block.col !== undefined)) return compileFlow(scope, tab.blocks, room)\n const head: AiLayoutBlock[] = []\n const tail: AiLayoutBlock[] = []\n const columns: AiLayoutBlock[][] = cols.map(() => [])\n for (const block of tab.blocks) {\n if (block.col !== undefined) {\n const { col, ...placed } = block\n columns[Math.min(col, cols.length - 1)]?.push(placed)\n } else if (columns.some((column) => column.length)) tail.push(block)\n else head.push(block)\n }\n const filled = columns.map((column, position) => ({ column, weight: cols[position] ?? 1 })).filter((entry) => entry.column.length)\n const parts = [\n head.length ? compileFlow(scope, head, room) : null,\n filled.length >= 2 ? compileRow(scope, filled, 'flex-start') : compileFlow(scope, filled.flatMap((entry) => entry.column), room),\n tail.length ? compileFlow(scope, tail, room) : null,\n ].filter((id): id is string => !!id)\n if (parts.length <= 1) return parts[0] ?? null\n return scope.page.tree.add('muiStack', { spacing: '3' }, null, parts, 'panel')\n}\n\n/** A short line on an outlined surface of the theme's own shape: a label, a tag, a tab the source draws as one. */\nfunction chip(scope: SectionScope, words: string, role: string): string {\n const tree = scope.page.tree\n return tree.add('muiPaper', { variant: 'outlined' }, { py: 0.75 }, [tree.add('muiTypography', { children: words, variant: 'body2' }, { px: 2 }, null, `${role}Label`)], role)\n}\n\n/** A strip of logos of a page brought in: each picture at one height, or each short line as a label on an outlined surface. */\nfunction logos(scope: SectionScope, block: AiLayoutBlock): string | null {\n const tree = scope.page.tree\n const ids = (block.items ?? []).flatMap((item): string[] => {\n if (item.picture) {\n scope.page.images += 1\n return [\n tree.add(\n 'image',\n { src: item.picture.src, ...(item.picture.alt ? { alt: item.picture.alt } : { decorative: true }), objectFit: 'contain', width: 'auto', ...(scope.page.images > 1 ? { loading: 'lazy' } : {}) },\n { height: { xs: 32, md: 40 } },\n null,\n 'logo',\n ),\n ]\n }\n const words = aiLayoutAsWritten([item.title, item.text].filter((part) => part.trim()).join(' '))\n return words ? [chip(scope, words, 'chip')] : []\n })\n if (!ids.length) return null\n return tree.add(\n 'muiStack',\n { direction: 'row', spacing: block.items?.some((item) => item.picture) ? '5' : '1.5', useFlexGap: true, flexWrap: 'wrap', alignItems: 'center', ...(scope.centered ? { justifyContent: 'center' } : {}) },\n null,\n noted(scope, ids),\n 'logos',\n )\n}\n\n/**\n * The opening of a page brought in, as the hero its design answer chose\n * around the source's own picture (AGL-4107): its words and one picture of\n * the source's, nothing else. Any other opening is drawn as its source lays\n * it out, its picture where the source placed it.\n */\nfunction importedHero(scope: SectionScope, raw: AiLayoutSection, blocks: readonly AiLayoutBlock[]): string | null {\n const { page } = scope\n if (!page.design || !raw.hero) return null\n const pictures = blocks.filter((block) => block.kind === 'image' && block.picture)\n if (pictures.length !== 1) return null\n const flow = blocks.filter((block) => block.kind !== 'image')\n if (!flow.length || !flow.every((block) => WORD_KINDS.has(block.kind))) return null\n if (!flow.some((block) => speaksHeading(scope, block))) {\n flow.unshift({ kind: 'heading', text: page.plan.title })\n page.settled.push({ at: scope.at, what: \"no heading; the page's title written as its h1\" })\n }\n const lead = flow.findIndex((block) => speaksHeading(scope, block))\n const { style: _style, ...title } = flow[lead]\n flow[lead] = AI_LAYOUT_HALF_HEROES.has(raw.hero) ? title : { ...title, style: 'large' }\n const picture = pictures[0].picture as AiLayoutPicture\n return hero(scope, flow, { alt: picture.alt, given: true, src: picture.src }, raw.hero)\n}\n\n/** The id the compiled page's root is stored under. */\nexport const AI_LAYOUT_PAGE_ROOT_ID = CANVAS_ROOT_ELEMENT_ID\n"],"names":["REUSABLE_INSTANCE_COMPONENT_ID","CANVAS_ROOT_ELEMENT_ID","AI_ICON_COMPONENT_ID","aiIconOfWord","AI_ICON_LIBRARY","AI_INSTANCE_REF_PROP","AI_TEXT_LIMITS","aiPageScrollInteraction","aiLayoutFitText","aiLayoutQuoteGap","aiLayoutWords","AI_LAYOUT_GROUP_KINDS","AI_LAYOUT_MAX_ITEMS","AI_LAYOUT_HALF_HEROES","aiLayoutDesignChoices","aiLayoutFamily","aiLayoutGroupVariant","AI_LAYOUT_FEATURED_RECORDS","AI_LAYOUT_LISTING_ELEMENTS","aiLayoutIsRecordImageAlt","aiLayoutListingAt","aiLayoutRecordHref","aiLayoutRecordImageAltField","aiLayoutRepeatFilterOf","aiStorefrontItemIcons","aiLayoutContactLabel","aiLayoutWithContactLines","AI_LAYOUT_LABELS_EN","aiLayoutLabel","aiLayoutRenamedLabel","aiLayoutResolveLink","aiLayoutSpans","AI_LAYOUT_FRAMES","AiLayoutTreeBuilder","aiLayoutAsWritten","value","replace","trim","sectionLabel","name","index","language","sectionIdOf","AI_LAYOUT_MAX_IMAGES","AI_LAYOUT_HEADLINE_MAX_CHARS","headline","AI_LAYOUT_MAX_STRONG_BANDS","SECTION_PADDING","xs","md","HERO_PADDING","formIdsOf","targets","Set","forms","map","form","id","componentOf","components","find","component","formLivesElsewhere","formPageId","pageId","formSectionOf","sections","plan","planned","findIndex","section","uses","some","ref","has","designed","blocks","block","kind","to","aiCompileLayoutPage","options","tree","formSection","verbatim","contact","page","settled","scrollTo","images","strong","brand","dark","pageIcon","pageIconOf","formsPlaced","itemIds","design","input","choices","pictures","features","splitAt","quotesOnly","drawnBands","bare","rhythm","roots","_","compileSection","rootId","add","nodes","sectionRoots","own","icon","item","items","sparkle","PICTURED_LISTINGS","raw","scope","sectionScope","drawSection","band","listed","listings","pictured","listing","holdsPicture","node","componentId","child","rhythmBand","bandRhythm","above","at","asked","ruled","push","what","settleBand","centered","align","level","headed","itemsLeft","Number","POSITIVE_INFINITY","link","from","heading","text","words","filter","join","placedHere","placePlanned","shopGridAt","shopTitle","listingSection","opening","hero","importedHero","beside","rhythmSection","designSection","cols","length","head","tail","columns","placed","col","undefined","Math","min","filled","column","position","weight","entry","deepest","max","Array","row","flatMap","flat","repeated","every","componentItem","props","groups","isItemGroup","sameShape","columnsAsCards","inOrder","concat","speaks","facts","list","splice","unshift","title","order","first","slice","lead","indexOf","wide","isWideGroup","parts","headId","compileFlow","compileRow","tailId","part","prune","fallback","content","spacing","useFlexGap","container","maxWidth","py","element","ariaLabel","colorScheme","bandSx","sectionIds","pattern","test","most","bgcolor","color","flowId","flow","holdsGroup","disableGutters","plannedForms","plannedComponents","lastCol","at0","asks","kept","only","named","_to","group","like","shapeOf","CARD_COLUMN_KINDS","WORDS_KINDS","cards","buttons","button","places","toLowerCase","size","style","alignItems","spans","span","room","children","flushButtons","direction","flexWrap","justifyContent","compileButton","compileBlock","hasGroup","ids","includes","accent","muted","image","faq","table","tabs","logos","overPhoto","mutedSecondary","secondaryColor","say","place","variant","sx","frame","label","long","itemLevel","itemElement","destination","aiLayoutImportedDestination","linkedWords","onBrand","look","destinationProps","alignSelf","linkTo","exec","screenId","href","url","URL","protocol","toString","target","interactions","AI_LIGHTBOX_GALLERY_KINDS","AI_LAYOUT_LIGHTBOX_TO","aiOpensGalleriesInLightbox","Boolean","lightboxProps","caption","lightbox","lightboxGallery","lightboxCaption","picture","sourcePicture","alt","maxImages","mark","iconId","opensLarge","objectFit","top","left","width","height","display","overflow","borderRadius","aspectRatio","formId","p","declared","values","Object","textProps","entries","keys","propValues","type","instanceValues","texts","titleProp","textProp","noted","across","count","itemSize","perRow","layOut","role","cells","rule1","reusableComponents","AI_LAYOUT_PLACEHOLDER_TITLE","cleanItems","references","takeItems","takeItemsInPlace","importedGroup","instances","retail","picturesLeft","drawn","designedGroup","iconColumns","compactGroup","steps","timeline","groupStyle","step","stat","quote","card","pairs","primary","secondary","quiet","stack","String","padStart","who","importedList","links","renderAs","lines","rows","line","disablePadding","check","importedFaq","divider","panels","defaultExpanded","AI_LAYOUT_MAX_DESIGN_PICTURES","WORD_KINDS","speaksHeading","designedRoot","underHeader","designPicture","frameSx","imageSx","designImage","given","described","decorative","src","loading","standInAlt","designRow","cell","ofWords","_style","sellingHero","last","told","coverClose","coverBand","feature","splitHeads","splitSection","home","chosen","tall","cover","bleedHero","columnHero","collageHero","panelHero","portraitHero","photo","right","featureLeft","rest","lede","actions","ledeId","actionsId","under","pt","pb","minHeight","opacity","measure","mx","zIndex","bandSurface","px","sm","small","bottom","border","borderColor","boxShadow","flexShrink","AI_LAYOUT_RHYTHM_MOST","AI_LAYOUT_RHYTHM_NOTE","featureGroup","itemTitleVariant","headingCase","ruledList","borderTop","flex","half","ceil","lists","second","rowSpacing","columnSpacing","mosaic","portrait","floor","lone","aspect","opens","shop","shopPageOf","LISTING_REPLACES","AI_LAYOUT_POST_CARD_TOKENS","AI_LAYOUT_POST_ADDRESS_TOKENS","listingAllButton","placements","placement","reviewsSection","signupSection","underTitle","_col","all","records","listingElement","AI_LAYOUT_REVIEWS_HEADING","reviewsHeading","reviews","maxItems","AI_LAYOUT_SIGNUP_HEADING","signupHeading","field","signup","buttonLabel","body","products","pages","eyebrow","firstButton","shopAll","AI_LAYOUT_SHOP_ALL","iconWords","word","textAlign","star","featured","shown","source","sort","pageSize","showSort","showCategories","cardStyle","quickAdd","emptyTitle","emptyText","emptyAction","emptyActionLabel","getInTouch","emptyActionHref","recordsElement","postsElement","COLLECTION_INDEX_POSTS","AI_LAYOUT_STORE_EMPTY","storeEmptyTitle","storeEmptyText","textAlone","storeEmptyTextAlone","limit","writing","titleElement","meta","excerpt","more","minWidth","posts","collectionSlug","entriesLimit","gridTemplateColumns","gap","AI_LAYOUT_RECORD_LINK_LABEL","viewDetails","RECORD_KICKER","RECORD_BODY","RECORD_QUESTIONS","RECORD_PEOPLE","aiLayoutRecordCardFields","fields","kicker","questions","photoField","imageField","altField","recordHref","recordBase","repeatDataset","datasetId","repeatLimit","repeatFilter","AI_LAYOUT_PORTRAIT_SIZE","itemPicture","sourceIcon","iconPath","paragraphs","newTab","bullets","said","itemLinks","importedAcross","itemShows","figure","importedItem","itemStyle","titleNode","number","listIconPath","shift","whole","answer","tableCell","grid","headerRow","header","tabLabel","tab","labels","tabPanel","open","selected","opensOn","strip","elevation","chip","AI_LAYOUT_PAGE_ROOT_ID"],"mappings":";;AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,8BAA8B,QAAQ,iDAAgD;AAC/F,SAASC,sBAAsB,QAAQ,2CAA0C;AACjF,SACEC,oBAAoB,EACpBC,YAAY,EACZC,eAAe,QAEV,gCAA4B;AACnC,SAASC,oBAAoB,QAAQ,6BAAyB;AAC9D,SAASC,cAAc,QAAQ,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