@aglyn/plugins-ai 1.0.0-beta.285 → 1.0.0-beta.288
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/assets/site-styles/nonprofit.webp +0 -0
- package/src/lib/assets/site-styles/professional.webp +0 -0
- package/src/lib/assets/site-styles/store.webp +0 -0
- package/src/lib/assets/site-styles/trades.webp +0 -0
- package/src/lib/components/ai-theme-proposal-card.component.js +12 -3
- package/src/lib/components/ai-theme-proposal-card.component.js.map +1 -1
- package/src/lib/declarations.js +5 -2
- package/src/lib/declarations.js.map +1 -1
- package/src/lib/declarations.server.js +12 -0
- package/src/lib/declarations.server.js.map +1 -1
- package/src/lib/jobs/ai-build-capabilities.d.ts +3 -1
- package/src/lib/jobs/ai-build-capabilities.js +27 -2
- package/src/lib/jobs/ai-build-capabilities.js.map +1 -1
- package/src/lib/jobs/ai-business-profile-prefill.js +6 -3
- package/src/lib/jobs/ai-business-profile-prefill.js.map +1 -1
- package/src/lib/jobs/ai-image-reads.d.ts +59 -0
- package/src/lib/jobs/ai-image-reads.js +138 -0
- package/src/lib/jobs/ai-image-reads.js.map +1 -0
- package/src/lib/jobs/ai-job-build-step.d.ts +29 -0
- package/src/lib/jobs/ai-job-build-step.js +83 -12
- package/src/lib/jobs/ai-job-build-step.js.map +1 -1
- package/src/lib/jobs/ai-job-duplicate-step.d.ts +2 -1
- package/src/lib/jobs/ai-job-duplicate-step.js +6 -6
- package/src/lib/jobs/ai-job-duplicate-step.js.map +1 -1
- package/src/lib/jobs/ai-job-import-step.d.ts +4 -2
- package/src/lib/jobs/ai-job-import-step.js +15 -11
- package/src/lib/jobs/ai-job-import-step.js.map +1 -1
- package/src/lib/jobs/ai-job-insight-step.d.ts +10 -0
- package/src/lib/jobs/ai-job-insight-step.js +23 -5
- package/src/lib/jobs/ai-job-insight-step.js.map +1 -1
- package/src/lib/jobs/ai-job-layout-language.js +2 -1
- package/src/lib/jobs/ai-job-layout-language.js.map +1 -1
- package/src/lib/jobs/ai-job-media-step.d.ts +2 -1
- package/src/lib/jobs/ai-job-media-step.js +6 -8
- package/src/lib/jobs/ai-job-media-step.js.map +1 -1
- package/src/lib/jobs/ai-job-navigation-step.d.ts +2 -1
- package/src/lib/jobs/ai-job-navigation-step.js +7 -9
- package/src/lib/jobs/ai-job-navigation-step.js.map +1 -1
- package/src/lib/jobs/ai-job-page-language.js +7 -1
- package/src/lib/jobs/ai-job-page-language.js.map +1 -1
- package/src/lib/jobs/ai-job-page-sections.js +16 -3
- package/src/lib/jobs/ai-job-page-sections.js.map +1 -1
- package/src/lib/jobs/ai-job-page-step.js +9 -1
- package/src/lib/jobs/ai-job-page-step.js.map +1 -1
- package/src/lib/jobs/ai-job-plan-step.d.ts +30 -8
- package/src/lib/jobs/ai-job-plan-step.js +78 -13
- package/src/lib/jobs/ai-job-plan-step.js.map +1 -1
- package/src/lib/jobs/ai-job-privacy-step.d.ts +4 -2
- package/src/lib/jobs/ai-job-privacy-step.js +14 -15
- package/src/lib/jobs/ai-job-privacy-step.js.map +1 -1
- package/src/lib/jobs/ai-job-products-step.js +5 -3
- package/src/lib/jobs/ai-job-products-step.js.map +1 -1
- package/src/lib/jobs/ai-job-settings-step.d.ts +2 -1
- package/src/lib/jobs/ai-job-settings-step.js +7 -8
- package/src/lib/jobs/ai-job-settings-step.js.map +1 -1
- package/src/lib/jobs/ai-job-site-content.d.ts +34 -1
- package/src/lib/jobs/ai-job-site-content.js +67 -8
- package/src/lib/jobs/ai-job-site-content.js.map +1 -1
- package/src/lib/jobs/ai-job-site-datasets.d.ts +53 -3
- package/src/lib/jobs/ai-job-site-datasets.js +300 -30
- package/src/lib/jobs/ai-job-site-datasets.js.map +1 -1
- package/src/lib/jobs/ai-job-site-step.js +6 -3
- package/src/lib/jobs/ai-job-site-step.js.map +1 -1
- package/src/lib/jobs/ai-job-site-store-pages.js +3 -3
- package/src/lib/jobs/ai-job-site-store-pages.js.map +1 -1
- package/src/lib/jobs/ai-job-text-step.js +2 -1
- package/src/lib/jobs/ai-job-text-step.js.map +1 -1
- package/src/lib/jobs/ai-job-tracking-step.d.ts +2 -1
- package/src/lib/jobs/ai-job-tracking-step.js +7 -8
- package/src/lib/jobs/ai-job-tracking-step.js.map +1 -1
- package/src/lib/jobs/ai-jobs-beat.d.ts +11 -7
- package/src/lib/jobs/ai-jobs-beat.js +18 -8
- package/src/lib/jobs/ai-jobs-beat.js.map +1 -1
- package/src/lib/jobs/ai-jobs-notify.d.ts +66 -1
- package/src/lib/jobs/ai-jobs-notify.js +136 -3
- package/src/lib/jobs/ai-jobs-notify.js.map +1 -1
- package/src/lib/jobs/ai-layout-stock-photos.d.ts +155 -7
- package/src/lib/jobs/ai-layout-stock-photos.js +1517 -220
- package/src/lib/jobs/ai-layout-stock-photos.js.map +1 -1
- package/src/lib/jobs/ai-product-image.d.ts +14 -0
- package/src/lib/jobs/ai-product-image.js +73 -21
- package/src/lib/jobs/ai-product-image.js.map +1 -1
- package/src/lib/jobs/ai-theme-brand-inputs.d.ts +9 -1
- package/src/lib/jobs/ai-theme-brand-inputs.js +28 -2
- package/src/lib/jobs/ai-theme-brand-inputs.js.map +1 -1
- package/src/lib/jobs/fixtures/ai-site-agl4065-datasets.d.ts +175 -0
- package/src/lib/jobs/fixtures/ai-site-agl4065-datasets.js +601 -0
- package/src/lib/jobs/fixtures/ai-site-agl4065-datasets.js.map +1 -0
- package/src/lib/jobs/fixtures/ai-site-agl4065-pages.d.ts +46 -0
- package/src/lib/jobs/fixtures/ai-site-agl4065-pages.js +2862 -0
- package/src/lib/jobs/fixtures/ai-site-agl4065-pages.js.map +1 -0
- package/src/lib/jobs/fixtures/ai-site-agl4065-plans.d.ts +74 -0
- package/src/lib/jobs/fixtures/ai-site-agl4065-plans.js +888 -0
- package/src/lib/jobs/fixtures/ai-site-agl4065-plans.js.map +1 -0
- package/src/lib/jobs/fixtures/ai-site-agl4092-datasets.d.ts +120 -0
- package/src/lib/jobs/fixtures/ai-site-agl4092-datasets.js +410 -0
- package/src/lib/jobs/fixtures/ai-site-agl4092-datasets.js.map +1 -0
- package/src/lib/jobs/fixtures/ai-stock-photo-agl4065-judge.d.ts +29 -0
- package/src/lib/jobs/fixtures/ai-stock-photo-agl4065-judge.js +81 -0
- package/src/lib/jobs/fixtures/ai-stock-photo-agl4065-judge.js.map +1 -0
- package/src/lib/jobs/fixtures/ai-stock-photo-agl4065-recordings.d.ts +87 -0
- package/src/lib/jobs/fixtures/ai-stock-photo-agl4065-recordings.js +225 -0
- package/src/lib/jobs/fixtures/ai-stock-photo-agl4065-recordings.js.map +1 -0
- package/src/lib/jobs/fixtures/ai-stock-photo-agl4092-recordings.d.ts +26 -0
- package/src/lib/jobs/fixtures/ai-stock-photo-agl4092-recordings.js +714 -0
- package/src/lib/jobs/fixtures/ai-stock-photo-agl4092-recordings.js.map +1 -0
- package/src/lib/layout-language/ai-layout-compiler.d.ts +11 -0
- package/src/lib/layout-language/ai-layout-compiler.js +194 -18
- package/src/lib/layout-language/ai-layout-compiler.js.map +1 -1
- package/src/lib/layout-language/ai-layout-copy.d.ts +37 -0
- package/src/lib/layout-language/ai-layout-copy.js +383 -3
- package/src/lib/layout-language/ai-layout-copy.js.map +1 -1
- package/src/lib/layout-language/ai-layout-design.d.ts +19 -0
- package/src/lib/layout-language/ai-layout-design.js +31 -11
- package/src/lib/layout-language/ai-layout-design.js.map +1 -1
- package/src/lib/layout-language/ai-layout-listings.d.ts +7 -1
- package/src/lib/layout-language/ai-layout-listings.js +9 -1
- package/src/lib/layout-language/ai-layout-listings.js.map +1 -1
- package/src/lib/layout-language/ai-layout-pictures.d.ts +39 -1
- package/src/lib/layout-language/ai-layout-pictures.js +141 -4
- package/src/lib/layout-language/ai-layout-pictures.js.map +1 -1
- package/src/lib/layout-language/ai-layout-storefront.d.ts +18 -4
- package/src/lib/layout-language/ai-layout-storefront.js +100 -20
- package/src/lib/layout-language/ai-layout-storefront.js.map +1 -1
- package/src/lib/model/ai-build-job.d.ts +7 -0
- package/src/lib/model/ai-build-job.js +36 -7
- package/src/lib/model/ai-build-job.js.map +1 -1
- package/src/lib/model/ai-build-plan.d.ts +28 -4
- package/src/lib/model/ai-build-plan.js +49 -9
- package/src/lib/model/ai-build-plan.js.map +1 -1
- package/src/lib/model/ai-build-progress.js +3 -1
- package/src/lib/model/ai-build-progress.js.map +1 -1
- package/src/lib/model/ai-job-notice.d.ts +8 -0
- package/src/lib/model/ai-job-notice.js +33 -0
- package/src/lib/model/ai-job-notice.js.map +1 -1
- package/src/lib/model/ai-job-plan-lines.d.ts +2 -1
- package/src/lib/model/ai-job-plan-lines.js +6 -1
- package/src/lib/model/ai-job-plan-lines.js.map +1 -1
- package/src/lib/model/ai-jobs.types.d.ts +8 -0
- package/src/lib/model/ai-jobs.types.js.map +1 -1
- package/src/lib/model/ai-permissions.d.ts +13 -0
- package/src/lib/model/ai-permissions.js +29 -1
- package/src/lib/model/ai-permissions.js.map +1 -1
- package/src/lib/model/ai-plan-said-sections.d.ts +12 -3
- package/src/lib/model/ai-plan-said-sections.js +22 -5
- package/src/lib/model/ai-plan-said-sections.js.map +1 -1
- package/src/lib/model/ai-products.d.ts +18 -0
- package/src/lib/model/ai-products.js +32 -0
- package/src/lib/model/ai-products.js.map +1 -1
- package/src/lib/model/ai-site-context.d.ts +6 -2
- package/src/lib/model/ai-site-context.js +8 -2
- package/src/lib/model/ai-site-context.js.map +1 -1
- package/src/lib/model/ai-site-inspiration.d.ts +3 -2
- package/src/lib/model/ai-site-inspiration.js +3 -2
- package/src/lib/model/ai-site-inspiration.js.map +1 -1
- package/src/lib/plugin.js +4 -13
- package/src/lib/plugin.js.map +1 -1
- package/src/lib/providers/anthropic.js +9 -2
- package/src/lib/providers/anthropic.js.map +1 -1
- package/src/lib/providers/catalog.js +14 -5
- package/src/lib/providers/catalog.js.map +1 -1
- package/src/lib/providers/contract.d.ts +24 -1
- package/src/lib/providers/contract.js.map +1 -1
- package/src/lib/providers/routing.js +5 -2
- package/src/lib/providers/routing.js.map +1 -1
- package/src/lib/runtime/ai-dataset-generation.d.ts +120 -1
- package/src/lib/runtime/ai-dataset-generation.js +352 -3
- package/src/lib/runtime/ai-dataset-generation.js.map +1 -1
- package/src/lib/runtime/ai-dev-replay.d.ts +1 -0
- package/src/lib/runtime/ai-dev-replay.js +4 -2
- package/src/lib/runtime/ai-dev-replay.js.map +1 -1
- package/src/lib/runtime/ai-doctrine-validators.d.ts +47 -3
- package/src/lib/runtime/ai-doctrine-validators.js +345 -28
- package/src/lib/runtime/ai-doctrine-validators.js.map +1 -1
- package/src/lib/runtime/ai-doctrine.d.ts +5 -4
- package/src/lib/runtime/ai-doctrine.js +10 -3
- package/src/lib/runtime/ai-doctrine.js.map +1 -1
- package/src/lib/runtime/ai-icon-library.d.ts +27 -1
- package/src/lib/runtime/ai-icon-library.js +30 -3
- package/src/lib/runtime/ai-icon-library.js.map +1 -1
- package/src/lib/runtime/ai-products-generation.d.ts +11 -1
- package/src/lib/runtime/ai-products-generation.js +51 -4
- package/src/lib/runtime/ai-products-generation.js.map +1 -1
- package/src/lib/runtime/assist-answer-cache.d.ts +2 -0
- package/src/lib/runtime/assist-answer-cache.js +5 -2
- package/src/lib/runtime/assist-answer-cache.js.map +1 -1
- package/src/lib/server/ai-allotments.js +7 -2
- package/src/lib/server/ai-allotments.js.map +1 -1
- package/src/lib/server/ai-experiment-versions.js +5 -5
- package/src/lib/server/ai-experiment-versions.js.map +1 -1
- package/src/lib/server/ai-host-permissions-roster.d.ts +25 -0
- package/src/lib/server/ai-host-permissions-roster.js +33 -0
- package/src/lib/server/ai-host-permissions-roster.js.map +1 -0
- package/src/lib/server/ai-host-permissions.js +8 -6
- package/src/lib/server/ai-host-permissions.js.map +1 -1
- package/src/lib/server/ai-image-reads-route.d.ts +17 -0
- package/src/lib/server/ai-image-reads-route.js +106 -0
- package/src/lib/server/ai-image-reads-route.js.map +1 -0
- package/src/lib/server/ai-seo-apply.js +5 -5
- package/src/lib/server/ai-seo-apply.js.map +1 -1
- package/src/lib/server/ai-site-import-route.js +7 -4
- package/src/lib/server/ai-site-import-route.js.map +1 -1
- package/src/lib/server/assist-build.d.ts +15 -1
- package/src/lib/server/assist-build.js +30 -3
- package/src/lib/server/assist-build.js.map +1 -1
- package/src/lib/server/assist-chat.d.ts +11 -7
- package/src/lib/server/assist-chat.js +185 -48
- package/src/lib/server/assist-chat.js.map +1 -1
- package/src/lib/server/assist-docs-query.d.ts +51 -0
- package/src/lib/server/assist-docs-query.js +57 -0
- package/src/lib/server/assist-docs-query.js.map +1 -0
- package/src/lib/server/assist-jobs-context.d.ts +102 -0
- package/src/lib/server/assist-jobs-context.js +227 -0
- package/src/lib/server/assist-jobs-context.js.map +1 -0
- package/src/lib/server/assist-view-context.d.ts +8 -4
- package/src/lib/server/assist-view-context.js +12 -7
- package/src/lib/server/assist-view-context.js.map +1 -1
- package/src/lib/server.js +12 -0
- package/src/lib/server.js.map +1 -1
- package/src/lib/tools/ai-dataset-tool.d.ts +11 -1
- package/src/lib/tools/ai-dataset-tool.js +24 -7
- package/src/lib/tools/ai-dataset-tool.js.map +1 -1
- package/src/lib/tools/ai-duplicate-resource-tool.js +5 -6
- package/src/lib/tools/ai-duplicate-resource-tool.js.map +1 -1
- package/src/lib/components/ai-collaborator-permissions-column.component.d.ts +0 -32
- package/src/lib/components/ai-collaborator-permissions-column.component.js +0 -132
- package/src/lib/components/ai-collaborator-permissions-column.component.js.map +0 -1
|
@@ -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 { 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 AiLayoutItem,\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\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 `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\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).\n const sections = 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 }\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\nfunction compileSection(\n page: PageScope,\n raw: AiLayoutSection,\n index: number,\n): string {\n const at = `sections[${index}]`\n const band = settleBand(page, raw.band ?? 'plain', at)\n const scope: SectionScope = {\n page,\n index,\n at,\n band,\n centered: raw.align === 'center',\n level: index === 0 ? 1 : 2,\n headed: false,\n itemsLeft: 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 // A quote is a gap the owner fills, and a published page shows no gap (AGL-3660).\n const blocks = placePlanned(scope, raw).filter((block) => {\n if (block.kind !== 'quotes') 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 (raw.blocks.some((block) => block.kind === 'quotes') && !blocks.some((block) => AI_LAYOUT_GROUP_KINDS.has(block.kind) || block.kind === 'component')) {\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 (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 = 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 if (page.design) {\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 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 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 (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 !!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 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. */\nfunction isWideGroup(block: AiLayoutBlock): boolean {\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 )\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)\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 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\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 = aiLayoutWords(block.text, place, scope.page.targets.facts, scope.page.options.language)\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 = aiLayoutWords(block.text, place, scope.page.targets.facts, scope.page.options.language)\n if (!text) return null\n scope.headed = scope.headed || own\n const variant =\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 // Words that carry the phone or the email are kept whole (AGL-3979).\n const asked =\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 = aiLayoutResolveLink(\n block.to,\n asked,\n scope.link,\n scope.page.targets,\n )\n if (!destination) {\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 button to a page merged into the blog names the blog (AGL-3676).\n const label = 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 * 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 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 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): string | null {\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 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' && !!aiLayoutWords(block.text, 'heading', scope.page.targets.facts, scope.page.options.language)\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/**\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: { alt: string; given: boolean },\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: { alt: string; given: boolean },\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 return page.tree.add(\n 'image',\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: { alt: string; given: boolean },\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 split.\n const chosen: AiLayoutHeroVariant = design.choices.hero\n const variant: AiLayoutHeroVariant = chosen === 'collage' && picturesLeft(page) < 2 ? '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: { alt: string; given: boolean },\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: { alt: string; given: boolean }, 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: { alt: string; given: boolean }, 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: { alt: string; given: boolean }, 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: { alt: string; given: boolean }, 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: { alt: string; given: boolean }): 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/** 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: '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), 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), 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 * never the same twice in a row. One style key an element, so a row repeats\n * 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 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: '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/** 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","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","sectionLabel","name","index","language","replace","trim","sectionIdOf","AI_LAYOUT_MAX_IMAGES","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","contact","page","settled","scrollTo","images","strong","brand","dark","pageIcon","pageIconOf","formsPlaced","itemIds","design","input","choices","pictures","features","splitAt","quotesOnly","roots","_","compileSection","rootId","add","nodes","sectionRoots","own","icon","item","items","sparkle","raw","placedHere","at","band","settleBand","scope","centered","align","level","headed","itemsLeft","link","from","heading","text","words","filter","join","placePlanned","push","what","shopGridAt","shopTitle","listed","listings","listingSection","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","componentId","fallback","content","spacing","useFlexGap","container","maxWidth","py","element","ariaLabel","colorScheme","bandSx","sectionIds","value","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","overPhoto","mutedSecondary","secondaryColor","place","variant","sx","frame","label","itemLevel","itemElement","asked","destination","onBrand","look","destinationProps","alignSelf","linkTo","target","interactions","screenId","href","AI_LIGHTBOX_GALLERY_KINDS","AI_LAYOUT_LIGHTBOX_TO","aiOpensGalleriesInLightbox","Boolean","lightboxProps","caption","lightbox","lightboxGallery","lightboxCaption","alt","maxImages","mark","iconId","opensLarge","picture","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","instances","retail","picturesLeft","drawn","designedGroup","iconColumns","pictured","compactGroup","steps","timeline","groupStyle","step","stat","quote","card","pairs","primary","secondary","quiet","stack","String","padStart","who","links","renderAs","lines","rows","line","disablePadding","check","divider","panels","defaultExpanded","AI_LAYOUT_MAX_DESIGN_PICTURES","WORD_KINDS","speaksHeading","designedRoot","underHeader","designPicture","frameSx","imageSx","designImage","given","decorative","standInAlt","designRow","cell","ofWords","_style","hero","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","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","listing","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","ruled","writing","titleElement","src","loading","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_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,uBAAuB,QAAQ,8BAA0B;AAClE,SACEC,eAAe,EACfC,gBAAgB,EAChBC,aAAa,QAER,sBAAkB;AACzB,SACEC,qBAAqB,EACrBC,mBAAmB,QAMd,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;AAC9D,SAASC,oBAAoB,EAAEC,wBAAwB,QAAQ,yBAAqB;AACpF,SAASC,mBAAmB,EAAEC,aAAa,QAAQ,wBAAoB;AACvE,SACEC,oBAAoB,EACpBC,mBAAmB,QAId,uBAAmB;AAC1B,SACEC,aAAa,EACbC,gBAAgB,EAChBC,mBAAmB,QAEd,sBAAkB;AA6EzB;;;;;CAKC,GACD,SAASC,aAAaC,IAAY,EAAEC,KAAa,EAAEC,QAAiB;IAClE,OAAO7B,gBAAgB2B,KAAKG,OAAO,CAAC,eAAe,KAAKA,OAAO,CAAC,QAAQ,KAAKC,IAAI,IAAI,QAAQF,aAAa,CAAC,QAAQ,EAAED,QAAQ,GAAG;AAClI;AAEA,qDAAqD,GACrD,SAASI,YAAYJ,KAAa;IAChC,OAAO,CA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;QAACtK;KAAK,EACN;AAEJ;AAEA,qDAAqD,GACrD,OAAO,MAAM0L,yBAAyB3gB,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 { 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 AiLayoutItem,\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\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 `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).\n const sections = 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 const ruled = 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 = 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: 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 // A quote is a gap the owner fills, and a published page shows no gap (AGL-3660).\n const blocks = placePlanned(scope, raw).filter((block) => {\n if (block.kind !== 'quotes') 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 (raw.blocks.some((block) => block.kind === 'quotes') && !blocks.some((block) => AI_LAYOUT_GROUP_KINDS.has(block.kind) || block.kind === 'component')) {\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 (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 = 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).\n 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 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 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 (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 !!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 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. */\nfunction isWideGroup(block: AiLayoutBlock): boolean {\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 )\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)\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 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\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 = aiLayoutWords(block.text, place, scope.page.targets.facts, scope.page.options.language)\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 = aiLayoutWords(block.text, place, scope.page.targets.facts, scope.page.options.language)\n if (!text) return null\n scope.headed = scope.headed || own\n const variant =\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 // Words that carry the phone or the email are kept whole (AGL-3979).\n const asked =\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 = aiLayoutResolveLink(\n block.to,\n asked,\n scope.link,\n scope.page.targets,\n )\n if (!destination) {\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 button to a page merged into the blog names the blog (AGL-3676).\n const label = 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 * 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 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 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): string | null {\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 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' && !!aiLayoutWords(block.text, 'heading', scope.page.targets.facts, scope.page.options.language)\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/**\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: { alt: string; given: boolean },\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: { alt: string; given: boolean },\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 return page.tree.add(\n 'image',\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: { alt: string; given: boolean },\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 split.\n const chosen: AiLayoutHeroVariant = design.choices.hero\n const variant: AiLayoutHeroVariant = chosen === 'collage' && picturesLeft(page) < 2 ? '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: { alt: string; given: boolean },\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: { alt: string; given: boolean }, 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: { alt: string; given: boolean }, 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: { alt: string; given: boolean }, 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: { alt: string; given: boolean }, 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: { alt: string; given: boolean }): 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/** 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","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","sectionLabel","name","index","language","replace","trim","sectionIdOf","AI_LAYOUT_MAX_IMAGES","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","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","link","from","heading","text","words","filter","join","placedHere","placePlanned","shopGridAt","shopTitle","listingSection","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","value","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","overPhoto","mutedSecondary","secondaryColor","place","variant","sx","frame","label","itemLevel","itemElement","destination","onBrand","look","destinationProps","alignSelf","linkTo","target","interactions","screenId","href","AI_LIGHTBOX_GALLERY_KINDS","AI_LAYOUT_LIGHTBOX_TO","aiOpensGalleriesInLightbox","Boolean","lightboxProps","caption","lightbox","lightboxGallery","lightboxCaption","alt","maxImages","mark","iconId","opensLarge","picture","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","instances","retail","picturesLeft","drawn","designedGroup","iconColumns","compactGroup","steps","timeline","groupStyle","step","stat","quote","card","pairs","primary","secondary","quiet","stack","String","padStart","who","links","renderAs","lines","rows","line","disablePadding","check","divider","panels","defaultExpanded","AI_LAYOUT_MAX_DESIGN_PICTURES","WORD_KINDS","speaksHeading","designedRoot","underHeader","designPicture","frameSx","imageSx","designImage","given","decorative","standInAlt","designRow","cell","ofWords","_style","hero","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","src","loading","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_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;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