@aglyn/plugins-ai 1.0.0-beta.292 → 1.0.0-beta.293

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/package.json +17 -17
  2. package/src/lib/components/ai-site-import-job.component.js +5 -4
  3. package/src/lib/components/ai-site-import-job.component.js.map +1 -1
  4. package/src/lib/components/ai-site-import-start.component.js +3 -3
  5. package/src/lib/components/ai-site-import-start.component.js.map +1 -1
  6. package/src/lib/components/ai-site-start-card.component.d.ts +1 -1
  7. package/src/lib/components/ai-site-start-card.component.js +129 -29
  8. package/src/lib/components/ai-site-start-card.component.js.map +1 -1
  9. package/src/lib/components/ai-site-start-steps.component.d.ts +15 -3
  10. package/src/lib/components/ai-site-start-steps.component.js +42 -25
  11. package/src/lib/components/ai-site-start-steps.component.js.map +1 -1
  12. package/src/lib/components/ai-site-style-previews.d.ts +17 -0
  13. package/src/lib/components/ai-site-style-previews.js +26 -95
  14. package/src/lib/components/ai-site-style-previews.js.map +1 -1
  15. package/src/lib/declarations.server.js +22 -0
  16. package/src/lib/declarations.server.js.map +1 -1
  17. package/src/lib/jobs/ai-job-import-step.d.ts +21 -2
  18. package/src/lib/jobs/ai-job-import-step.js +179 -49
  19. package/src/lib/jobs/ai-job-import-step.js.map +1 -1
  20. package/src/lib/jobs/ai-job-layout-language.d.ts +27 -3
  21. package/src/lib/jobs/ai-job-layout-language.js +156 -113
  22. package/src/lib/jobs/ai-job-layout-language.js.map +1 -1
  23. package/src/lib/jobs/ai-job-layout-step.js +56 -17
  24. package/src/lib/jobs/ai-job-layout-step.js.map +1 -1
  25. package/src/lib/jobs/ai-job-page-language.d.ts +25 -15
  26. package/src/lib/jobs/ai-job-page-language.js +120 -66
  27. package/src/lib/jobs/ai-job-page-language.js.map +1 -1
  28. package/src/lib/jobs/ai-job-page-step.js +27 -7
  29. package/src/lib/jobs/ai-job-page-step.js.map +1 -1
  30. package/src/lib/jobs/ai-job-site-datasets.d.ts +12 -4
  31. package/src/lib/jobs/ai-job-site-datasets.js +36 -16
  32. package/src/lib/jobs/ai-job-site-datasets.js.map +1 -1
  33. package/src/lib/jobs/ai-jobs.js +6 -2
  34. package/src/lib/jobs/ai-jobs.js.map +1 -1
  35. package/src/lib/jobs/ai-layout-stock-photos.d.ts +50 -1
  36. package/src/lib/jobs/ai-layout-stock-photos.js +586 -35
  37. package/src/lib/jobs/ai-layout-stock-photos.js.map +1 -1
  38. package/src/lib/jobs/ai-site-import-compile.d.ts +147 -0
  39. package/src/lib/jobs/ai-site-import-compile.js +1143 -0
  40. package/src/lib/jobs/ai-site-import-compile.js.map +1 -0
  41. package/src/lib/jobs/ai-site-import-document.d.ts +9 -36
  42. package/src/lib/jobs/ai-site-import-document.js +23 -489
  43. package/src/lib/jobs/ai-site-import-document.js.map +1 -1
  44. package/src/lib/jobs/ai-site-import-look.d.ts +54 -7
  45. package/src/lib/jobs/ai-site-import-look.js +163 -52
  46. package/src/lib/jobs/ai-site-import-look.js.map +1 -1
  47. package/src/lib/jobs/ai-site-import-publish.d.ts +7 -1
  48. package/src/lib/jobs/ai-site-import-publish.js +19 -5
  49. package/src/lib/jobs/ai-site-import-publish.js.map +1 -1
  50. package/src/lib/jobs/ai-site-late-photos.js +4 -2
  51. package/src/lib/jobs/ai-site-late-photos.js.map +1 -1
  52. package/src/lib/jobs/ai-site-publish.d.ts +10 -1
  53. package/src/lib/jobs/ai-site-publish.js +8 -3
  54. package/src/lib/jobs/ai-site-publish.js.map +1 -1
  55. package/src/lib/jobs/fixtures/ai-stock-photo-agl4092-1029-recordings.d.ts +23 -0
  56. package/src/lib/jobs/fixtures/ai-stock-photo-agl4092-1029-recordings.js +677 -0
  57. package/src/lib/jobs/fixtures/ai-stock-photo-agl4092-1029-recordings.js.map +1 -0
  58. package/src/lib/layout-language/ai-layout-compiler.d.ts +26 -0
  59. package/src/lib/layout-language/ai-layout-compiler.js +677 -33
  60. package/src/lib/layout-language/ai-layout-compiler.js.map +1 -1
  61. package/src/lib/layout-language/ai-layout-frame-hollows.js +5 -1
  62. package/src/lib/layout-language/ai-layout-frame-hollows.js.map +1 -1
  63. package/src/lib/layout-language/ai-layout-frame-source.d.ts +196 -0
  64. package/src/lib/layout-language/ai-layout-frame-source.js +726 -0
  65. package/src/lib/layout-language/ai-layout-frame-source.js.map +1 -0
  66. package/src/lib/layout-language/ai-layout-frame.d.ts +22 -0
  67. package/src/lib/layout-language/ai-layout-frame.js +121 -29
  68. package/src/lib/layout-language/ai-layout-frame.js.map +1 -1
  69. package/src/lib/layout-language/ai-layout-language.d.ts +103 -37
  70. package/src/lib/layout-language/ai-layout-language.js +85 -120
  71. package/src/lib/layout-language/ai-layout-language.js.map +1 -1
  72. package/src/lib/model/ai-credit-estimate.d.ts +11 -7
  73. package/src/lib/model/ai-credit-estimate.js +11 -7
  74. package/src/lib/model/ai-credit-estimate.js.map +1 -1
  75. package/src/lib/model/ai-site-import.d.ts +307 -13
  76. package/src/lib/model/ai-site-import.js +227 -19
  77. package/src/lib/model/ai-site-import.js.map +1 -1
  78. package/src/lib/model/ai-site-look.d.ts +65 -1
  79. package/src/lib/model/ai-site-look.js +141 -23
  80. package/src/lib/model/ai-site-look.js.map +1 -1
  81. package/src/lib/model/ai-site-photos.d.ts +2 -0
  82. package/src/lib/model/ai-site-photos.js.map +1 -1
  83. package/src/lib/model/ai-site-start-steps.d.ts +4 -3
  84. package/src/lib/model/ai-site-start-steps.js +11 -3
  85. package/src/lib/model/ai-site-start-steps.js.map +1 -1
  86. package/src/lib/model/ai-site-start.d.ts +23 -2
  87. package/src/lib/model/ai-site-start.js +25 -3
  88. package/src/lib/model/ai-site-start.js.map +1 -1
  89. package/src/lib/providers/routing.d.ts +11 -0
  90. package/src/lib/providers/routing.js +23 -0
  91. package/src/lib/providers/routing.js.map +1 -1
  92. package/src/lib/runtime/ai-doctrine-validators.d.ts +4 -2
  93. package/src/lib/runtime/ai-doctrine-validators.js +7 -2
  94. package/src/lib/runtime/ai-doctrine-validators.js.map +1 -1
  95. package/src/lib/runtime/ai-icon-library.d.ts +4 -0
  96. package/src/lib/runtime/ai-icon-library.js +4 -0
  97. package/src/lib/runtime/ai-icon-library.js.map +1 -1
  98. package/src/lib/runtime/ai-node-tree.js +5 -1
  99. package/src/lib/runtime/ai-node-tree.js.map +1 -1
  100. package/src/lib/runtime/ai-palette.d.ts +2 -0
  101. package/src/lib/runtime/ai-palette.generated.js +19 -3
  102. package/src/lib/runtime/ai-palette.generated.js.map +1 -1
  103. package/src/lib/runtime/ai-palette.js +2 -1
  104. package/src/lib/runtime/ai-palette.js.map +1 -1
  105. package/src/lib/site-import/fixtures/site-layout-recordings.d.ts +50 -0
  106. package/src/lib/site-import/fixtures/site-layout-recordings.js +86 -0
  107. package/src/lib/site-import/fixtures/site-layout-recordings.js.map +1 -0
  108. package/src/lib/site-import/site-import-crawl.d.ts +18 -1
  109. package/src/lib/site-import/site-import-crawl.js +70 -10
  110. package/src/lib/site-import/site-import-crawl.js.map +1 -1
  111. package/src/lib/site-import/site-import-css.d.ts +110 -0
  112. package/src/lib/site-import/site-import-css.js +826 -0
  113. package/src/lib/site-import/site-import-css.js.map +1 -0
  114. package/src/lib/site-import/site-import-html.d.ts +116 -1
  115. package/src/lib/site-import/site-import-html.js +538 -46
  116. package/src/lib/site-import/site-import-html.js.map +1 -1
  117. package/src/lib/site-import/site-import-layout.d.ts +79 -0
  118. package/src/lib/site-import/site-import-layout.js +1608 -0
  119. package/src/lib/site-import/site-import-layout.js.map +1 -0
  120. package/src/lib/site-import/site-import-nav.d.ts +40 -0
  121. package/src/lib/site-import/site-import-nav.js +437 -0
  122. package/src/lib/site-import/site-import-nav.js.map +1 -0
  123. package/src/lib/site-import/site-import-page.d.ts +8 -1
  124. package/src/lib/site-import/site-import-page.js +24 -2
  125. package/src/lib/site-import/site-import-page.js.map +1 -1
  126. package/src/lib/assets/site-styles/beauty.webp +0 -0
  127. package/src/lib/assets/site-styles/blog.webp +0 -0
  128. package/src/lib/assets/site-styles/business.webp +0 -0
  129. package/src/lib/assets/site-styles/coming-soon.webp +0 -0
  130. package/src/lib/assets/site-styles/education.webp +0 -0
  131. package/src/lib/assets/site-styles/events.webp +0 -0
  132. package/src/lib/assets/site-styles/fitness.webp +0 -0
  133. package/src/lib/assets/site-styles/landing.webp +0 -0
  134. package/src/lib/assets/site-styles/music.webp +0 -0
  135. package/src/lib/assets/site-styles/nonprofit.webp +0 -0
  136. package/src/lib/assets/site-styles/personal.webp +0 -0
  137. package/src/lib/assets/site-styles/photography.webp +0 -0
  138. package/src/lib/assets/site-styles/portfolio.webp +0 -0
  139. package/src/lib/assets/site-styles/professional.webp +0 -0
  140. package/src/lib/assets/site-styles/realestate.webp +0 -0
  141. package/src/lib/assets/site-styles/restaurant.webp +0 -0
  142. package/src/lib/assets/site-styles/store.webp +0 -0
  143. package/src/lib/assets/site-styles/studio.webp +0 -0
  144. package/src/lib/assets/site-styles/trades.webp +0 -0
  145. package/src/lib/assets/site-styles/wellness.webp +0 -0
  146. package/src/lib/assets/site-styles/yoga.webp +0 -0
  147. package/src/lib/site-import/site-import-review.d.ts +0 -40
  148. package/src/lib/site-import/site-import-review.js +0 -149
  149. package/src/lib/site-import/site-import-review.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/components/ai-site-start-card.component.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n'use client'\n\nimport { lockdownRefusalText, parseLockdownRefusal, PLATFORM_BRAND_NAME } from '@aglyn/aglyn'\nimport { trackEvent } from '@aglyn/aglyn/app-utils/analytics-events'\nimport type { ConsoleHostFirstRunZoneProps } from '@aglyn/aglyn/plugin-manager/feature-plugins'\nimport { ICON_VARIANT_CLOSE } from '@aglyn/shared-data-enums'\nimport { mdiCreation, mdiPageLayoutHeaderFooter, mdiWebSync } from '@aglyn/shared-data-mdi'\nimport { pluginDocsHelp } from '@aglyn/aglyn/app-utils/docs-help'\nimport { HelpTip, MdiIcon } from '@aglyn/shared-ui-jsx'\nimport BlockedControl from '@aglyn/shared-ui-jsx/components/blocked-control.component'\nimport { PrerequisiteNotice } from '@aglyn/shared-ui-jsx/components/prerequisite-notice.component'\nimport { authorizedFetch } from '@aglyn/shared-util-http/authorized-token'\nimport { useUser } from '@aglyn/tenant-feature-instance'\nimport {\n Alert,\n AppBar,\n Box,\n Button,\n Card,\n CardActionArea,\n Chip,\n CircularProgress,\n Container,\n Dialog,\n DialogActions,\n DialogContent,\n DialogContentText,\n DialogTitle,\n IconButton,\n Stack,\n Toolbar,\n Typography,\n useMediaQuery,\n} from '@mui/material'\nimport { alpha, useTheme, type Theme } from '@mui/material/styles'\nimport { useRouter } from 'next/navigation'\nimport {\n useCallback,\n useEffect,\n useId,\n useRef,\n useState,\n type KeyboardEvent,\n type MouseEvent,\n type ReactNode,\n type SyntheticEvent,\n} from 'react'\nimport {\n AI_JOB_AUTO_CONFIRM_INPUT,\n AI_SITE_FREE_PAGES,\n aiFreeCreditsNoneLeftText,\n aiFreeCreditsResetLabel,\n aiFreeSiteCreditRange,\n aiFreeSitePrompt,\n aiSiteCreditRange,\n type AiFreeCreditsLeft,\n aiSitePagesBand,\n} from '../model/ai-site-job'\nimport { FREE_AI_TASTE_CREDITS_PER_MONTH } from '../plan-entitlements'\nimport {\n AI_CREDITS_CONFIRM_CODE,\n aiCreditRangeText,\n type AiCreditRange,\n type AiCreditsPrompt,\n} from '../model/ai-credit-estimate'\nimport { AiCreditsPromptNotice } from './ai-credits-prompt.component'\nimport {\n AI_SITE_START_ANSWERS,\n aiSiteStartAnswersFromClientBuild,\n aiSiteStartBrief,\n aiSiteStartClientBrief,\n aiSiteStartClientInputs,\n aiSiteStartClientNote,\n aiSiteStartExtrasGiven,\n aiSiteStartInputs,\n aiSiteStartRefusal,\n type AiSiteStartAnswers,\n} from '../model/ai-site-start'\nimport { aiSiteInspirationLimit } from '../model/ai-site-inspiration'\nimport {\n aiSiteStartFieldErrors,\n aiSiteStartFirstInvalidStep,\n aiSiteStartNextStep,\n aiSiteStartPreviousStep,\n aiSiteStartStepErrors,\n aiSiteStartStepIndex,\n AI_SITE_START_STEPS,\n AI_SITE_START_STEP_FIELDS,\n type AiSiteStartField,\n type AiSiteStartStep,\n} from '../model/ai-site-start-steps'\nimport type { AiJobSummary } from '../model/ai-jobs.types'\nimport { aiSiteKindOfInputs } from '../model/ai-site-kinds'\nimport { aiSiteStartClickOf, useAiSiteStartTracking } from './ai-site-start-tracking'\nimport {\n AudienceStep,\n DetailsStep,\n KindStep,\n MoreDetails,\n ReviewStep,\n StartProgress,\n StepHelp,\n StyleStep,\n} from './ai-site-start-steps.component'\nimport { AiJobFollow } from './ai-job-follow.component'\nimport { AiModelSelector } from './ai-model-selector.component'\nimport { useAiModelChoice } from './use-ai-model-choice'\nimport { aiCreditsBillingHref, aiSiteBuildHref } from './ai-job-links'\nimport { publishAiJob } from './ai-jobs-store'\nimport { clearAiSiteStartAnswers, readAiSiteStartAnswers } from '../model/ai-site-start-handoff'\nimport { AiSiteImportStart } from './ai-site-import-start.component'\nimport { aiSiteImportOfferOf, type AiSiteImportAvailability } from '../model/ai-site-import-view'\n\n/**\n * The guided start (AGL-2918), on the `hostFirstRun` zone of the page a newly\n * created site lands on: a choice, a few questions, and the site scaffold they\n * become.\n *\n * ── Two steps (AGL-3594) ─────────────────────────────────────────────────\n *\n * Step 1 asks how to start, as two equal cards: the starter site — a\n * ready-made home page with a header and footer — or AI. The starter card is\n * the zone's `startBlank`, which gives a site born for the guided start the\n * starter every other new site is born with. The AI card moves on to the\n * questions, one decision a step (AGL-3898; see {@link AiSiteStartCard}).\n *\n * ── A full screen dialog, and therefore three ways out ───────────────────\n *\n * The questions take the whole screen, which is the only presentation that\n * gets them read — but a surface that takes the screen and cannot be left is\n * a funnel, so leaving is drawn first and works three ways on both steps:\n *\n * - the close control at the start of the header,\n * - \"Skip\" at the end of it, named \"Skip and start blank\",\n * - Escape, which `Dialog` reports through `onClose`.\n *\n * Before a job is started all three are the zone's own `startBlank`: the\n * starter site, and no job, no draft, no record of a site half begun. After,\n * they close through `leave`, and the job builds the site.\n *\n * ── Or before the site exists (AGL-3761) ─────────────────────────────────\n *\n * \"Create site\" draws this straight away, with the zone's `pendingSite` and\n * no site. Step 1 then asks the site's name and address (the shell's own\n * fields) above the two cards, and the site is created only by a choice that\n * needs one: the starter card or Skip (`startBlank`, which creates it with the\n * starter), or Plan my site, which creates it and then starts the job on it.\n * The close control and Escape create nothing there: they are `leave`. If the\n * site was created and its job could not start, the site is a real one, and\n * every way out gives it the starter as above, so none is left empty.\n *\n * Escape and the close control are DISMISSALS, though, and Skip is a choice\n * (AGL-3660, 2026-10-08). Once anything is typed or picked, a dismissal asks\n * \"Leave without your answers?\" first, focused on Keep editing, so a stray\n * Escape — the second press after closing the model menu was the one in\n * production — can never trade a brief for the starter. Escape that reached\n * the dialog from a portal it does not contain (a menu, a select's list) is\n * that popup's, and the dialog ignores it.\n *\n * The header is the dialog's own chrome rather than part of its body, so the\n * way out cannot be scrolled off, and it is never disabled — least of all\n * while a request is in flight, which is the moment a person most wants it.\n * Nothing is focused ahead of the dialog's own frame, so the first thing a\n * keyboard reaches is the close control.\n *\n * ── It is absent until the route has answered ────────────────────────────\n *\n * The dialog covers the page, so being drawn on a guess is worse here than it\n * is for a card: it would be a takeover every flag-off workspace watches\n * disappear. Nothing renders at all — no `Dialog`, no portal — until the jobs\n * route has admitted this workspace, and a 404, a 403 or an unreachable route\n * is this widget staying absent and the ordinary blank page being all there\n * is. That the widget is mounted is itself the last of a stack of gates: the\n * shell held the plan's `aiGenerative` entitlement, the site's AI switch and\n * the reader's `ai.generate` first. A lockdown is the start door's to say,\n * here, in its own words.\n *\n * ── It builds and publishes for you ──────────────────────────────────────\n *\n * \"Plan my site\" starts a `site` job, which PLANS first: the pages, their\n * addresses, the navigation, the layout, the contact form and a palette. The\n * guided start confirms its own plan (AGL-3594), so the build follows with no\n * approval to make, and the site is published, indexable, when it is done.\n * The person edits or unpublishes it afterwards.\n *\n * ── It stays with the job (AGL-3593) ─────────────────────────────────────\n *\n * Once the job exists the dialog follows it live — planning, the plan with\n * its Confirm, building, then the draft pages to open — so a person never has\n * to leave it to get their site built. \"Open AI jobs\" follows the job in the\n * Assist panel instead; it leaves the guided start the way every other exit\n * does, because the dialog covers the panel it opens.\n */\n\ntype Verdict = 'checking' | 'ready' | 'hidden'\n\n/** Labels the dialog for a reader, from its own heading. */\nconst TITLE_ID = 'ai-site-start-title'\n\n/**\n * The takeover's surface, for its paper, its bar and its footer alike: the\n * console page's own background (AGL-3596). The paper sits at elevation 0,\n * which is what keeps MUI's dark-mode elevation overlay off it.\n */\nexport const AI_SITE_START_SURFACE_SX = { bgcolor: 'background.default' } as const\n\n/** The soft round badge an icon sits in, in its accent's tint. */\nfunction IconBadge({ accent, children }: { accent: 'primary' | 'secondary'; children: ReactNode }) {\n return (\n <Box\n aria-hidden\n sx={(theme: Theme) => ({\n width: theme.spacing(9),\n height: theme.spacing(9),\n borderRadius: '50%',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n bgcolor: alpha(theme.palette[accent].main, theme.palette.mode === 'dark' ? 0.24 : 0.12),\n color: `${accent}.main`,\n fontSize: theme.spacing(5.5),\n })}\n >\n {children}\n </Box>\n )\n}\n\n/**\n * One way to start, as a card the whole of which is the button. Its accessible\n * name is its title; its description describes it.\n */\nfunction ChoiceCard({\n accent,\n icon,\n iconId,\n title,\n description,\n busy = false,\n blocked = null,\n onChoose,\n children,\n}: {\n accent: 'primary' | 'secondary'\n icon: string\n /** Names the icon for a reader of the markup; the icon itself is decorative. */\n iconId: string\n title: string\n description: string\n busy?: boolean\n /**\n * Why the card cannot be chosen here, when the workspace can change that\n * (AGL-3976): drawn disabled with the reason, never hidden.\n */\n blocked?: string | null\n onChoose: () => void\n children?: ReactNode\n}) {\n const id = useId()\n return (\n <Card\n variant=\"outlined\"\n sx={(theme: Theme) => ({\n borderRadius: 2,\n height: '100%',\n transition: theme.transitions.create(['border-color', 'box-shadow', 'transform'], {\n duration: theme.transitions.duration.shorter,\n }),\n '&:hover, &:focus-within': {\n borderColor: `${accent}.main`,\n boxShadow: theme.shadows[4],\n transform: `translateY(-${theme.spacing(0.25)})`,\n },\n '@media (prefers-reduced-motion: reduce)': {\n transition: 'none',\n '&:hover, &:focus-within': { transform: 'none' },\n },\n })}\n >\n <BlockedControl blocked={Boolean(blocked)} reason={blocked ?? ''} fullWidth>\n <CardActionArea\n onClick={onChoose}\n disabled={busy}\n aria-labelledby={`${id}-title`}\n aria-describedby={`${id}-description`}\n aria-busy={busy || undefined}\n sx={{ height: '100%', p: { xs: 3, sm: 4 } }}\n >\n <Stack spacing={2} sx={{ alignItems: 'center', textAlign: 'center' }}>\n <IconBadge accent={accent}>\n {busy ? (\n <CircularProgress size=\"1em\" color={accent} aria-label={`${title}…`} />\n ) : (\n <MdiIcon path={icon} data-icon={iconId} aria-hidden />\n )}\n </IconBadge>\n <Typography id={`${id}-title`} variant=\"h6\" component=\"h2\">\n {title}\n </Typography>\n <Typography id={`${id}-description`} variant=\"body2\" color=\"text.secondary\">\n {description}\n </Typography>\n {children}\n </Stack>\n </CardActionArea>\n </BlockedControl>\n </Card>\n )\n}\n\n/** A small label above a group of questions. */\n/**\n * Each part of the guided start links its own section of the Start with AI\n * guide (AGL-3660), so a `?` says what that one group of answers changes.\n */\nconst START_HELP = {\n choose: pluginDocsHelp('aiStart', {\n anchor: '#how-do-you-want-to-start',\n excerpt:\n 'The starter site gives you a ready-made home page to edit. Start with AI asks a few questions, then plans, writes and publishes your pages.',\n }),\n estimate: pluginDocsHelp('aiCredits', {\n anchor: '#before-a-job-starts',\n excerpt:\n 'About what a start like this costs, measured on real builds, and the most it can cost. What it really costs is what each step spends, and you can watch that add up while it runs.',\n }),\n}\n\nfunction SectionLabel({ children, help }: { children: ReactNode; help?: ReturnType<typeof pluginDocsHelp> }) {\n return (\n <Stack direction=\"row\" spacing={0.5} sx={{ alignItems: 'center' }}>\n <Typography variant=\"overline\" color=\"text.secondary\" component=\"h2\" sx={{ display: 'block' }}>\n {children}\n </Typography>\n {help ? <HelpTip {...help} /> : null}\n </Stack>\n )\n}\n\n/**\n * The guided start, as the `hostFirstRun` zone draws it, or reopened on a\n * failed start's own answers (AGL-3596): `initialAnswers` opens it on the\n * questions, filled in, for the person to adjust and start a fresh job.\n */\nexport type AiSiteStartCardProps = ConsoleHostFirstRunZoneProps & {\n initialAnswers?: AiSiteStartAnswers | null\n}\n\n/**\n * The questions are one decision a step (AGL-3898): what kind of site it is\n * (typed, or a card), who it is for, the style (cards that show each one,\n * \"Pick for me\" first and picked), the details, and a review that plans the\n * site (`ai-site-start-steps.component.tsx`). Back and Next keep every\n * answer; Enter in a text answer is Next; each step's heading takes the focus\n * when it is drawn; a step that cannot go forward says why beside the field\n * and puts the cursor in it. The answers are the same object the single form\n * held, and only the review turns them into the job, through the same\n * `aiSiteStartBrief` and `aiSiteStartInputs`. Each step is reported as a\n * funnel, with where people struggle (`ai-site-start-tracking.ts`).\n */\nexport function AiSiteStartCard({\n hostId,\n orgId,\n orgSlug,\n host,\n startBlank,\n leave,\n pendingSite,\n clientBuild,\n initialAnswers = null,\n}: AiSiteStartCardProps) {\n const { data: user } = useUser()\n const router = useRouter()\n // Held in a ref so a request reads WHO is signed in, never the identity of\n // the object that says so.\n const userRef = useRef(user)\n userRef.current = user\n const uid = user?.uid ?? null\n const [verdict, setVerdict] = useState<Verdict>('checking')\n // \"Start again\" on a start whose empty site was removed (AGL-3936) opens\n // Create site with that start's answers: read once, and only here, where\n // the site does not exist yet. It opens on the first question, where the\n // site's name and address are asked, with every answer after it filled in.\n const [handedOff] = useState(() => (pendingSite && !initialAnswers ? readAiSiteStartAnswers() : null))\n // A site staff are building for a client (AGL-3958): the intake answered\n // the questions already, so the start opens on the review with them, and\n // stays on this screen once it has started. Read once, like a reopened start.\n const [clientAnswers] = useState(() =>\n clientBuild && !initialAnswers ? aiSiteStartAnswersFromClientBuild(clientBuild.intake) : null,\n )\n const [clientIntake] = useState(() => clientBuild?.intake ?? null)\n const clientBuildRef = useRef(clientBuild)\n clientBuildRef.current = clientBuild\n // Read once: a start reopened on its answers stays one while it is open.\n const reopened = useRef(initialAnswers !== null || handedOff !== null || clientAnswers !== null)\n // A start reopened on its answers opens on the review, every answer there to change.\n const [step, setStep] = useState<AiSiteStartStep>(initialAnswers || clientAnswers ? 'review' : 'choose')\n const [answers, setAnswers] = useState<AiSiteStartAnswers>(\n initialAnswers ?? clientAnswers ?? handedOff ?? AI_SITE_START_ANSWERS,\n )\n // The steps whose reasons not to go forward are shown: the ones Next was refused on.\n const [checked, setChecked] = useState<ReadonlySet<AiSiteStartStep>>(() => new Set())\n // A step opened from the review's Edit goes back to the review on Next.\n const [returnTo, setReturnTo] = useState<AiSiteStartStep | null>(null)\n // Each step's heading takes the focus when the step changes, never on the first draw.\n const headingRef = useRef<HTMLHeadingElement | null>(null)\n const drawnStep = useRef<AiSiteStartStep | null>(null)\n const fieldRefs = useRef<Partial<Record<AiSiteStartField, HTMLInputElement | null>>>({})\n const theme = useTheme()\n const compact = useMediaQuery(theme.breakpoints.down('sm'), { noSsr: true })\n const [busy, setBusy] = useState(false)\n // The starter card's own busy state while `startBlank` runs (AGL-3594).\n const [startingStarter, setStartingStarter] = useState(false)\n const [notice, setNotice] = useState<string | null>(null)\n /** The site job \"Plan my site\" started, as the create door answered with it. */\n const [started, setStarted] = useState<AiJobSummary | null>(null)\n // The Free taste's page band (AGL-3594), read off the verdict request.\n const [freeTaste, setFreeTaste] = useState(false)\n // Whether the Style step asks for the sites the person likes (AGL-3975),\n // read off the same verdict request: `release_ai_site_inspiration`.\n const [siteInspiration, setSiteInspiration] = useState(false)\n // What the Free workspace has left this month (AGL-3660), as the same read\n // the create door refuses on: the less of its own band and its owner's\n // allowance across their Free workspaces. `null` when the route said none.\n const [freeCredits, setFreeCredits] = useState<AiFreeCreditsLeft | null>(null)\n // \"Leave without your answers?\" (AGL-3660): a dismissal with a brief typed.\n const [confirmingLeave, setConfirmingLeave] = useState(false)\n // The dialog's own root, to tell its Escape from a nested popup's.\n const dialogRef = useRef<HTMLDivElement | null>(null)\n // Drawn by \"Create site\" before the site exists (AGL-3761): the shell's\n // name and address are asked on step 1, and the site is created only by\n // the starter, Skip, or Plan my site. Read through a ref by the verdict\n // below, which must not re-run when the shell re-renders it.\n const pendingRef = useRef(pendingSite)\n pendingRef.current = pendingSite\n const creating = Boolean(pendingSite) && !pendingSite?.created\n // The funnel (AGL-3898): each step drawn, left and abandoned, and where people struggle.\n const tracker = useAiSiteStartTracking(step, verdict === 'ready')\n // \"Bring my site\" (AGL-3976): asked of its own door, absent while its flag\n // is off, drawn disabled with the reason where the workspace can change it.\n const [importAvailability, setImportAvailability] = useState<AiSiteImportAvailability>({ state: 'checking' })\n const [importing, setImporting] = useState(false)\n\n useEffect(() => {\n if (!orgId || !uid) return\n let active = true\n void (async () => {\n try {\n const response = await authorizedFetch(\n userRef.current,\n // `siteImport=1`: whether \"Bring my site\" is offered here (AGL-3976), on the same read.\n `/api/ai/jobs?orgId=${encodeURIComponent(orgId)}&limit=1&siteImport=1`,\n )\n const payload = response.ok ? await response.json().catch(() => null) : null\n if (active) {\n setSiteInspiration(payload?.siteInspiration === true)\n if (payload?.freeTaste === true) {\n setFreeTaste(true)\n const credits = payload?.freeCredits as AiFreeCreditsLeft | undefined\n if (credits && Number.isFinite(credits.left)) setFreeCredits(credits)\n // A reopened start keeps the pages it asked for, within the band.\n setAnswers((current) => ({\n ...current,\n pages: reopened.current ? Math.min(current.pages, AI_SITE_FREE_PAGES.max) : AI_SITE_FREE_PAGES.max,\n welcomeEmail: false,\n }))\n }\n const shown = response.status !== 404 && response.status !== 403\n setImportAvailability(aiSiteImportOfferOf(payload?.siteImport))\n setVerdict(shown ? 'ready' : 'hidden')\n // \"Create site\" shows its own dialog when this one will not draw.\n pendingRef.current?.ready(shown)\n clientBuildRef.current?.ready?.(shown)\n }\n } catch {\n if (active) {\n setVerdict('hidden')\n pendingRef.current?.ready(false)\n clientBuildRef.current?.ready?.(false)\n }\n }\n })()\n return () => {\n active = false\n }\n }, [orgId, uid])\n\n const answer = useCallback(\n (patch: Partial<AiSiteStartAnswers>) =>\n setAnswers((current) => ({ ...current, ...patch })),\n [],\n )\n\n // A Free start past what is left asks first (AGL-3722): it is admitted on\n // its measured p90, and one past what is left starts only on \"Build what\n // fits\" (pausing with Resume where the credits run out), or smaller as the\n // home page alone. The create door asks the same, so a stale dialog meets\n // the prompt there too (`serverPrompt`). Nothing at all left is a dead\n // stop until the credits renew or the workspace upgrades.\n const [serverPrompt, setServerPrompt] = useState<AiCreditsPrompt | null>(null)\n // The door's prompt was for the pages it was asked with.\n useEffect(() => setServerPrompt(null), [answers.pages])\n // A store's first products and a blog's first posts are part of the start (AGL-3676, AGL-3798).\n const siteKind = aiSiteKindOfInputs(aiSiteStartInputs(answers))?.id ?? null\n const prompt = freeTaste ? (aiFreeSitePrompt(freeCredits, answers.pages, { siteKind }) ?? serverPrompt) : null\n const noneLeft = freeTaste && freeCredits !== null && freeCredits.left <= 0\n const refusal = aiSiteStartRefusal(answers, { freeTaste })\n const band = aiSitePagesBand(freeTaste)\n // On a paid plan the person picks the model that builds the site (AGL-3660),\n // Auto by default, from the models their plan allows; every step of the job\n // runs on it. A Free workspace builds on the default and is offered none.\n const modelChoice = useAiModelChoice({ orgId, hostId, surface: 'jobs', kind: 'job.page' })\n // A pick remembered from before needs its cost to estimate by; Auto does not,\n // and the list is otherwise read when the picker opens.\n const { load: loadModels, model: rememberedModel } = modelChoice\n useEffect(() => {\n if (!freeTaste && step === 'review' && rememberedModel) loadModels()\n }, [freeTaste, step, rememberedModel, loadModels])\n const pickedModel = freeTaste ? null : modelChoice.model\n\n const plan = useCallback(async (options: { creditsConfirmed?: boolean; pages?: number } = {}) => {\n const asked = options.pages ? { ...answers, pages: options.pages } : answers\n if (!orgId || aiSiteStartRefusal(asked, { freeTaste }) || noneLeft) return\n // Past what is left, only an explicit go-ahead starts it.\n if (freeTaste && !options.creditsConfirmed && aiFreeSitePrompt(freeCredits, asked.pages, { siteKind })) return\n if (options.pages) answer({ pages: options.pages })\n setBusy(true)\n setNotice(null)\n setServerPrompt(null)\n try {\n const requestJob = (siteId: string | null, check: boolean) =>\n authorizedFetch(userRef.current, '/api/ai/jobs', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n orgId,\n hostId: siteId,\n kind: 'site',\n // A client build's intake rides along (AGL-3958): the name and\n // towns as the inputs the questions leave empty (the towns only\n // while no address is given, AGL-3995), and how to reach the\n // business, its hours and the owner's words in the brief.\n brief: [aiSiteStartBrief(asked), clientIntake ? aiSiteStartClientBrief(clientIntake) : '']\n .filter(Boolean)\n .join(' '),\n // The guided start confirms its own plan (AGL-3594): the build\n // follows the plan with no approval to make.\n // The sites they like go only while the start asks for them (AGL-3975).\n inputs: {\n ...aiSiteStartInputs(siteInspiration ? asked : { ...asked, inspiration: [] }),\n ...(clientIntake ? aiSiteStartClientInputs(clientIntake, asked) : {}),\n [AI_JOB_AUTO_CONFIRM_INPUT]: true,\n },\n ...(pickedModel ? { model: pickedModel } : {}),\n ...(options.creditsConfirmed ? { creditsConfirmed: true } : {}),\n ...(check ? { check: true } : {}),\n }),\n })\n // A refusal said in the dialog, or the Free go-ahead it asks for.\n const refused = async (response: Response): Promise<unknown> => {\n const payload = await response.json().catch(() => null)\n if (response.ok) return payload ?? {}\n if (response.status === 409 && payload?.code === AI_CREDITS_CONFIRM_CODE && payload?.credits) {\n setServerPrompt(payload.credits as AiCreditsPrompt)\n return null\n }\n const locked = parseLockdownRefusal(response.status, payload)\n setNotice(\n locked\n ? lockdownRefusalText(locked)\n : String(payload?.error ?? 'The site could not be started. Try again.'),\n )\n return null\n }\n // The site, created now when it does not exist yet (AGL-3761): this is\n // the moment the person asked for it. The start is checked first\n // (AGL-3859), so one the jobs route would refuse, or would ask the Free\n // go-ahead for, is answered before any site exists. A refusal about the\n // name or address goes back to step 1, where they are typed.\n let site = { hostId, host, orgSlug }\n if (!hostId && pendingSite) {\n if (!pendingSite.created && !(await refused(await requestJob(null, true)))) return\n const made = await pendingSite.create()\n if ('error' in made) {\n setNotice(made.error)\n if (made.address) setStep('choose')\n return\n }\n site = { hostId: made.hostId, host: made.host, orgSlug: made.orgSlug || orgSlug }\n }\n if (!site.hostId) return\n const payload = (await refused(await requestJob(site.hostId, false))) as { job?: AiJobSummary } | null\n if (!payload) return\n const created = (payload?.job as AiJobSummary | undefined) ?? null\n if (!created) {\n setNotice('The site could not be started. Try again.')\n return\n }\n // The indicator and the launcher count it from the moment it exists.\n publishAiJob(created)\n // A removed start's answers have been used (AGL-3936).\n clearAiSiteStartAnswers()\n // Which optional details the site was asked for with (AGL-3979), by id only.\n tracker.detailsGiven(\n aiSiteStartExtrasGiven(asked).map((field) => ({\n field,\n step: AI_SITE_START_STEPS.find((at) => AI_SITE_START_STEP_FIELDS[at].includes(field)) ?? 'details',\n })),\n )\n // The funnel's last step: the site is started, and nothing after is leaving it.\n tracker.complete()\n tracker.finish()\n // A client build follows its job here, on the build's own screen, which\n // goes on to send the owner the preview (AGL-3958).\n if (clientIntake) {\n clientBuildRef.current?.onStarted?.({ id: created.id })\n setStarted(created)\n return\n }\n // Where the next step is (AGL-3594): the site's \"Building your site\"\n // page for this job. The zone closes without the starter first, so the\n // setup page does not ask again behind it.\n const href = aiSiteBuildHref(site.orgSlug, site.host, created.id)\n if (href) {\n ;(leave ?? (() => undefined))()\n router.push(href)\n return\n }\n setStarted(created)\n } catch {\n setNotice('The site could not be started. Try again.')\n } finally {\n setBusy(false)\n }\n }, [orgId, hostId, answers, answer, freeTaste, freeCredits, noneLeft, orgSlug, host, leave, router, pickedModel, pendingSite, siteKind, tracker, clientIntake, siteInspiration])\n\n // The zone's `startBlank`. Before the site exists it creates it with the\n // starter, and answers `false` when it could not — most often a name or\n // address to fix, which step 1 shows.\n const runStartBlank = useCallback(() => {\n const result = startBlank()\n if (result && typeof result.then === 'function') {\n void result.then((done) => {\n if (done) return\n setStartingStarter(false)\n setStep('choose')\n })\n }\n }, [startBlank])\n\n const chooseStarter = useCallback(() => {\n if (pendingSite && !pendingSite.created && !pendingSite.check()) return\n setStartingStarter(true)\n trackEvent('site_start_choice', { choice: 'starter' })\n // The starter is a way to start, not a way to leave: no abandonment after it.\n tracker.finish()\n runStartBlank()\n }, [pendingSite, runStartBlank, tracker])\n\n const chooseImport = useCallback(() => {\n if (importAvailability.state !== 'ready') return\n if (pendingSite && !pendingSite.created && !pendingSite.check()) return\n trackEvent('site_start_choice', { choice: 'import' })\n tracker.complete()\n setImporting(true)\n }, [importAvailability.state, pendingSite, tracker])\n\n const chooseAi = useCallback(() => {\n if (pendingSite && !pendingSite.created && !pendingSite.check()) return\n trackEvent('site_start_choice', { choice: 'ai' })\n tracker.complete()\n setStep('kind')\n }, [pendingSite, tracker])\n\n // The heading of each step takes the focus as the step is drawn, so a\n // keyboard and a screen reader start where the new question does.\n useEffect(() => {\n if (verdict !== 'ready') return\n if (drawnStep.current !== null && drawnStep.current !== step) headingRef.current?.focus()\n drawnStep.current = step\n }, [step, verdict])\n\n /** Forward from a question step, when its answers may go forward. */\n const next = useCallback(() => {\n if (step === 'choose' || step === 'review') return\n const errors = aiSiteStartStepErrors(step, answers, { freeTaste })\n if (errors.length) {\n setChecked((current) => new Set(current).add(step))\n for (const error of errors) tracker.fieldError(error.field, error.code)\n fieldRefs.current[errors[0].field]?.focus()\n return\n }\n tracker.complete()\n const target = returnTo ?? aiSiteStartNextStep(step)\n setReturnTo(null)\n // A review reached with an answer that cannot go forward opens on that answer instead.\n if (target === 'review') {\n const invalid = aiSiteStartFirstInvalidStep(answers, { freeTaste })\n if (invalid && invalid !== 'review') {\n setChecked((current) => new Set(current).add(invalid))\n setStep(invalid)\n return\n }\n }\n if (target) setStep(target)\n }, [step, answers, freeTaste, returnTo, tracker])\n\n /** Back one step, keeping every answer. */\n const back = useCallback(() => {\n const target = aiSiteStartPreviousStep(step)\n if (!target) return\n tracker.back()\n setReturnTo(null)\n setStep(target)\n }, [step, tracker])\n\n /** From the review, to the step that asks an answer, and back to the review on Next. */\n const edit = useCallback(\n (target: AiSiteStartStep) => {\n tracker.back()\n setReturnTo('review')\n setStep(target)\n },\n [tracker],\n )\n\n /** From the progress, back to a step already answered: from the review it is Edit. */\n const goBackTo = (target: AiSiteStartStep) => {\n if (aiSiteStartStepIndex(target) >= aiSiteStartStepIndex(step)) return\n if (step === 'review') {\n edit(target)\n return\n }\n tracker.back()\n setReturnTo(null)\n setStep(target)\n }\n\n if (verdict !== 'ready') return null\n\n // Before a job is started Skip is the blank site, which writes the starter\n // (AGL-3594); after, it only closes — the job builds the site.\n const exit = started ? (leave ?? runStartBlank) : runStartBlank\n // Skip, as the header draws it: before a site is started it is leaving the questions.\n const skip = () => {\n if (!started) tracker.abandon('skip')\n exit()\n }\n // Escape and the close control. Before \"Create site\" has made the site\n // (AGL-3761) there is nothing to give a starter to, so they only close,\n // and nothing is created; otherwise they are the same way out as Skip.\n const dismissTo = creating && !started ? (leave ?? runStartBlank) : exit\n // Anything the person typed or picked, which a dismissal must not discard\n // silently (AGL-3660). After a job starts there is nothing left to lose.\n const drafted =\n !started &&\n Boolean(\n answers.siteType.trim() ||\n answers.audience.trim() ||\n answers.kind !== null ||\n aiSiteStartExtrasGiven(answers).length > 0 ||\n (creating && pendingSite?.dirty),\n )\n // Escape and the close control: a dismissal, never a choice. Escape that\n // bubbled here through React from a portal outside this dialog's own DOM is\n // a nested menu's, already handled there, and is not this dialog's to act on.\n const dismiss = (event?: SyntheticEvent | object, reason?: string) => {\n if (reason === 'escapeKeyDown') {\n const target = (event as SyntheticEvent | undefined)?.target\n const root = dialogRef.current\n if (root && target instanceof Node && !root.contains(target)) return\n }\n if (drafted) setConfirmingLeave(true)\n else closeTo()\n }\n // The dismissal itself, once nothing typed is in the way of it.\n const closeTo = () => {\n if (!started) tracker.abandon('close')\n dismissTo()\n }\n const leaveDraft = () => {\n setConfirmingLeave(false)\n closeTo()\n }\n\n // The chosen model's cost against Auto's, as the model list states it.\n const modelMultiplier =\n (pickedModel && modelChoice.options?.options.find((option) => option.id === pickedModel)?.multiplier) || 1\n // What the start is likely to cost and at most (AGL-3722): \"About 137\n // credits (up to 283)\", the measured figures scaled by the chosen model.\n const scaled = (range: AiCreditRange): AiCreditRange => ({\n likely: Math.round(range.likely * modelMultiplier),\n p90: Math.round(range.p90 * modelMultiplier),\n ceiling: Math.round(range.ceiling * modelMultiplier),\n })\n const estimate = freeTaste\n ? aiFreeSiteCreditRange(answers.pages, { siteKind })\n : scaled(aiSiteCreditRange(answers.pages, { welcomeEmail: answers.welcomeEmail, siteKind }))\n // A Free start quotes what is LEFT (AGL-3660), shared across the owner's\n // Free workspaces — never the month's whole allowance as if none were spent.\n const estimateText = freeTaste\n ? freeCredits\n ? `${aiCreditRangeText(estimate)}. You have ${freeCredits.left.toLocaleString('en-US')} of your ${freeCredits.total.toLocaleString('en-US')} free AI credits left this month, until ${aiFreeCreditsResetLabel(freeCredits.resetsOn)}`\n : `${aiCreditRangeText(estimate)}, of the ${FREE_AI_TASTE_CREDITS_PER_MONTH} AI credits you get free each month`\n : `${aiCreditRangeText(estimate)}, estimated`\n\n // The card is drawn wherever the workspace could use it, disabled where it cannot yet.\n const showsImport = importAvailability.state === 'ready' || importAvailability.state === 'blocked'\n const choosing = step === 'choose' && !started && !importing\n const reviewing = step === 'review' && !started && !importing\n const asking = step !== 'choose' && !started && !importing\n // Each answer's reason not to go forward, shown on a step once Next was refused there.\n const fieldErrors = aiSiteStartFieldErrors(answers, { freeTaste })\n const shownErrors = Object.fromEntries(\n AI_SITE_START_STEP_FIELDS[step]\n .filter((field) => checked.has(step) && fieldErrors[field])\n .map((field) => [field, fieldErrors[field]]),\n )\n const stepProps = {\n answers,\n answer,\n tracker,\n errors: shownErrors,\n fieldRef: (field: AiSiteStartField) => (node: HTMLInputElement | null) => {\n fieldRefs.current[field] = node\n },\n }\n const HEADINGS: Record<AiSiteStartStep, { title: string; lede: string }> = {\n choose: {\n title: 'How do you want to start?',\n lede: creating ? 'Name your site, then choose how it starts. You can change everything later.' : 'You can change everything later.',\n },\n kind: {\n title: 'What are you building?',\n lede: `Say it in a few words, or pick the closest. ${PLATFORM_BRAND_NAME} AI plans and writes your pages from it.`,\n },\n audience: { title: 'Who is it for?', lede: 'The pages and the contact form are written for them.' },\n style: {\n title: 'Choose a style',\n lede: 'Each picture is an example home page in that style. Yours is written for your business, with its own colors and fonts within the style you pick.',\n },\n details: {\n title: 'A few details',\n lede: 'How customers reach you, where messages go, how many pages, and what else to draft. All can be changed later.',\n },\n review: {\n title: 'Review your site',\n lede: started\n ? `${PLATFORM_BRAND_NAME} AI is on it.`\n : `${PLATFORM_BRAND_NAME} AI plans and writes your pages from these answers, then publishes your site.`,\n },\n }\n const heading = importing\n ? {\n title: 'Bring my site',\n lede: `Bring the website you have now into ${PLATFORM_BRAND_NAME}: its pages, words and photos. First, prove it is yours.`,\n }\n : HEADINGS[step]\n // Enter in a text answer is Next. A select, a card or a button keeps its own Enter.\n const onStepKeyDown = (event: KeyboardEvent<HTMLElement>) => {\n if (event.key !== 'Enter' || event.nativeEvent.isComposing || !asking || reviewing) return\n const target = event.target as HTMLElement\n if (target.tagName !== 'INPUT' || (target as HTMLInputElement).type === 'hidden') return\n event.preventDefault()\n next()\n }\n\n return (\n <Dialog\n open\n fullScreen\n ref={dialogRef}\n onClose={dismiss}\n aria-labelledby={TITLE_ID}\n // Where people get lost (AGL-3898): any input puts off the idle signal,\n // and every click is read for rage and dead clicks.\n onClickCapture={(event: MouseEvent<HTMLElement>) => tracker.click(aiSiteStartClickOf(event))}\n onKeyDownCapture={() => tracker.activity()}\n onInputCapture={() => tracker.activity()}\n // The console's own page surface, in both modes. A Dialog's paper sits\n // at elevation 24 by default, and in dark mode MUI lightens an elevated\n // paper with a white overlay, which turned the whole takeover a\n // washed-out gray; the overlay is for floating surfaces, and this one\n // fills the screen, so its paper is flat.\n slotProps={{ paper: { elevation: 0, sx: AI_SITE_START_SURFACE_SX } }}\n >\n {/*\n The way out, before anything it is a way out of: a slim header on the\n paper surface. On a narrow screen it is the TITLE that gives way, so\n the exits keep their words at every width.\n */}\n <AppBar\n position=\"relative\"\n color=\"inherit\"\n elevation={0}\n enableColorOnDark\n data-start-area=\"header\"\n sx={{ ...AI_SITE_START_SURFACE_SX, borderBottom: 1, borderColor: 'divider' }}\n >\n <Toolbar variant=\"dense\" sx={{ gap: 1 }}>\n <IconButton\n edge=\"start\"\n color=\"inherit\"\n onClick={() => dismiss()}\n aria-label=\"Close the guided start\"\n >\n <MdiIcon path={ICON_VARIANT_CLOSE.path} />\n </IconButton>\n <Typography\n id={TITLE_ID}\n variant=\"subtitle1\"\n component=\"div\"\n noWrap\n sx={{ textOverflow: 'ellipsis', flex: 1 }}\n >\n {'Start your site'}\n </Typography>\n <Button color=\"inherit\" onClick={skip} aria-label={started ? 'Close' : 'Skip and start blank'}>\n {started ? 'Close' : 'Skip'}\n </Button>\n </Toolbar>\n </AppBar>\n <DialogContent sx={{ px: { xs: 2, sm: 3 } }} onKeyDown={onStepKeyDown}>\n {/* The step timeline spans the whole dialog, above the step's own\n narrower column (AGL-4014): MUI's Stepper as it comes. */}\n {importing ? null : (\n <Box sx={{ pt: { xs: 3, sm: 4 } }}>\n <StartProgress step={step} compact={compact} onStep={started ? undefined : goBackTo} />\n </Box>\n )}\n <Container\n maxWidth={choosing || step === 'kind' || step === 'style' ? 'md' : 'sm'}\n disableGutters\n sx={{ py: { xs: 3, sm: 5 } }}\n >\n <Stack spacing={4}>\n <Stack spacing={1} sx={{ textAlign: choosing ? 'center' : 'left' }} data-start-area=\"heading\">\n <Typography\n ref={headingRef}\n tabIndex={-1}\n variant=\"h4\"\n component=\"h1\"\n sx={{ '&:focus': { outline: 'none' }, '&:focus-visible': { outline: 'none' } }}\n >\n {heading.title}\n </Typography>\n <Typography variant=\"body1\" color=\"text.secondary\">\n {choosing ? (\n <HelpTip sx={{ float: 'right' }} {...START_HELP.choose} />\n ) : importing ? null : (\n <StepHelp step={step} />\n )}\n {heading.lede}\n </Typography>\n </Stack>\n {notice && (\n <Alert severity=\"info\" data-start-area=\"notice\">\n {notice}\n </Alert>\n )}\n {asking && noneLeft && freeCredits && (\n <Alert\n severity=\"warning\"\n data-start-area=\"notice\"\n action={\n orgSlug ? (\n <Button color=\"inherit\" size=\"small\" href={aiCreditsBillingHref(orgSlug)}>\n {'Upgrade'}\n </Button>\n ) : undefined\n }\n >\n {aiFreeCreditsNoneLeftText(freeCredits.resetsOn)}\n </Alert>\n )}\n {choosing && creating && pendingSite ? (\n <Stack spacing={2} component=\"section\" aria-label=\"Your site\">\n <SectionLabel>{'Your site'}</SectionLabel>\n {pendingSite.fields}\n {/* Start in preview (AGL-4086). Off for the starter and for\n Start with AI; Bring my site asks again, defaulting on. */}\n {pendingSite.previewControl?.('ai')}\n </Stack>\n ) : null}\n {importing && orgId ? (\n <AiSiteImportStart\n orgId={orgId}\n orgSlug={orgSlug}\n hostId={hostId}\n host={host}\n user={user}\n pendingSite={pendingSite}\n onBack={() => setImporting(false)}\n leave={leave}\n />\n ) : choosing ? (\n <Stack spacing={2}>\n <Box\n data-start-area=\"choose-cards\"\n sx={{\n display: 'grid',\n gridTemplateColumns: showsImport ? { xs: '1fr', sm: '1fr 1fr', md: '1fr 1fr 1fr' } : { xs: '1fr', sm: '1fr 1fr' },\n gap: 3,\n }}\n >\n <ChoiceCard\n accent=\"secondary\"\n icon={mdiPageLayoutHeaderFooter.path}\n iconId=\"page-layout-header-footer\"\n title=\"Start from the starter site\"\n description=\"A ready-made home page with a header, footer and contact form you can edit.\"\n busy={startingStarter}\n onChoose={chooseStarter}\n />\n <ChoiceCard\n accent=\"primary\"\n icon={mdiCreation.path}\n iconId=\"creation\"\n title=\"Start with AI\"\n description={`Answer a few questions and ${PLATFORM_BRAND_NAME} AI plans your pages.`}\n onChoose={chooseAi}\n >\n <Chip size=\"small\" color=\"primary\" label=\"Recommended\" />\n {freeTaste && (\n <Typography variant=\"caption\" color=\"text.secondary\">\n {`Up to ${AI_SITE_FREE_PAGES.max} pages on the Free plan`}\n </Typography>\n )}\n </ChoiceCard>\n {showsImport && (\n <ChoiceCard\n accent=\"secondary\"\n icon={mdiWebSync.path}\n iconId=\"web-sync\"\n title=\"Bring my site\"\n description={`Bring the website you have now into ${PLATFORM_BRAND_NAME}: its pages, words and photos, rewritten in your new design.`}\n blocked={importAvailability.state === 'blocked' ? importAvailability.message : null}\n onChoose={chooseImport}\n >\n {importAvailability.state === 'blocked' && importAvailability.reason === 'plan' ? (\n <Chip size=\"small\" variant=\"outlined\" label=\"Paid plans\" />\n ) : null}\n </ChoiceCard>\n )}\n </Box>\n {importAvailability.state === 'blocked' ? (\n <PrerequisiteNotice\n {...(importAvailability.reason === 'plan' && orgSlug\n ? { href: aiCreditsBillingHref(orgSlug), actionLabel: 'Upgrade' }\n : {})}\n >\n {importAvailability.message}\n </PrerequisiteNotice>\n ) : null}\n </Stack>\n ) : started && orgId ? (\n <Card variant=\"outlined\" sx={{ borderRadius: 2, p: { xs: 2, sm: 3 } }}>\n <AiJobFollow\n job={started}\n orgId={orgId}\n orgSlug={orgSlug}\n user={user}\n intro={\n 'Your site is being planned. It is then built and published for you, with ' +\n 'nothing to approve. You can edit or unpublish it afterwards.'\n }\n // Full screen: AI jobs opens in the panel this dialog covers.\n onOpenJobs={exit}\n />\n </Card>\n ) : (\n <Box component=\"section\">\n {step === 'kind' && <KindStep {...stepProps} />}\n {step === 'audience' && <AudienceStep {...stepProps} />}\n {step === 'style' && (\n <StyleStep\n {...stepProps}\n inspiration={\n siteInspiration\n ? { limit: aiSiteInspirationLimit(freeTaste), upgradeHref: orgSlug ? aiCreditsBillingHref(orgSlug) : null }\n : null\n }\n />\n )}\n {step === 'details' && <DetailsStep {...stepProps} freeTaste={freeTaste} band={band} />}\n {/* Each question step's optional extras, collapsed, after its own answers (AGL-3979). */}\n {step !== 'review' && (\n <Box sx={{ mt: 3 }}>\n <MoreDetails key={step} step={step} {...stepProps} />\n </Box>\n )}\n {step === 'review' && (\n <ReviewStep answers={answers} freeTaste={freeTaste} onEdit={edit} inspiration={siteInspiration}>\n {clientIntake && (\n <Alert severity=\"info\" variant=\"outlined\" data-start-area=\"client-intake\">\n {aiSiteStartClientNote(clientIntake)}\n </Alert>\n )}\n {!noneLeft && prompt && (\n <AiCreditsPromptNotice\n prompt={prompt}\n noun=\"site\"\n orgSlug={orgSlug}\n busy={busy}\n onBuildWhatFits={() => void plan({ creditsConfirmed: true })}\n onSmaller={() => void plan({ creditsConfirmed: true, pages: 1 })}\n />\n )}\n </ReviewStep>\n )}\n </Box>\n )}\n </Stack>\n </Container>\n </DialogContent>\n {asking && (\n /* The footer stays put while the questions scroll. It wraps, because\n the estimate, the reason and the buttons are wider than a phone. */\n <DialogActions\n data-start-area=\"footer\"\n sx={{\n px: { xs: 2, sm: 3 },\n py: 2,\n flexWrap: 'wrap',\n rowGap: 1,\n columnGap: 2,\n borderTop: 1,\n borderColor: 'divider',\n ...AI_SITE_START_SURFACE_SX,\n }}\n >\n {reviewing && (\n <Stack direction=\"row\" spacing={0.5} sx={{ alignItems: 'center', mr: 'auto', minWidth: 0 }}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {`${estimateText}.`}\n </Typography>\n <HelpTip {...START_HELP.estimate} ariaLabel=\"How the estimate works\" />\n </Stack>\n )}\n {reviewing && refusal && (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {refusal}\n </Typography>\n )}\n {reviewing && !freeTaste && <AiModelSelector choice={modelChoice} disabled={busy} />}\n <Button onClick={back} sx={reviewing ? undefined : { mr: 'auto' }}>\n {'Back'}\n </Button>\n {reviewing ? (\n <Button\n variant=\"contained\"\n size=\"large\"\n disabled={busy || Boolean(refusal) || Boolean(prompt) || noneLeft}\n onClick={() => void plan()}\n startIcon={<MdiIcon path={mdiCreation.path} />}\n >\n {busy ? 'Starting…' : 'Plan my site'}\n </Button>\n ) : (\n <Button variant=\"contained\" size=\"large\" onClick={next}>\n {returnTo === 'review' ? 'Back to review' : 'Next'}\n </Button>\n )}\n </DialogActions>\n )}\n <Dialog\n open={confirmingLeave}\n onClose={() => setConfirmingLeave(false)}\n aria-labelledby={`${TITLE_ID}-leave`}\n aria-describedby={`${TITLE_ID}-leave-text`}\n maxWidth=\"xs\"\n >\n <DialogTitle id={`${TITLE_ID}-leave`}>{'Leave without your answers?'}</DialogTitle>\n <DialogContent>\n <DialogContentText id={`${TITLE_ID}-leave-text`}>\n {creating\n ? 'What you typed is not saved, and no site is created.'\n : 'What you typed is not saved. Leaving starts your site from the starter site instead.'}\n </DialogContentText>\n </DialogContent>\n <DialogActions>\n <Button color=\"inherit\" onClick={leaveDraft}>\n {creating ? 'Leave' : 'Leave and start blank'}\n </Button>\n <Button variant=\"contained\" autoFocus onClick={() => setConfirmingLeave(false)}>\n {'Keep editing'}\n </Button>\n </DialogActions>\n </Dialog>\n </Dialog>\n )\n}\n\nexport default AiSiteStartCard\n"],"names":["lockdownRefusalText","parseLockdownRefusal","PLATFORM_BRAND_NAME","trackEvent","ICON_VARIANT_CLOSE","mdiCreation","mdiPageLayoutHeaderFooter","mdiWebSync","pluginDocsHelp","HelpTip","MdiIcon","BlockedControl","PrerequisiteNotice","authorizedFetch","useUser","Alert","AppBar","Box","Button","Card","CardActionArea","Chip","CircularProgress","Container","Dialog","DialogActions","DialogContent","DialogContentText","DialogTitle","IconButton","Stack","Toolbar","Typography","useMediaQuery","alpha","useTheme","useRouter","useCallback","useEffect","useId","useRef","useState","AI_JOB_AUTO_CONFIRM_INPUT","AI_SITE_FREE_PAGES","aiFreeCreditsNoneLeftText","aiFreeCreditsResetLabel","aiFreeSiteCreditRange","aiFreeSitePrompt","aiSiteCreditRange","aiSitePagesBand","FREE_AI_TASTE_CREDITS_PER_MONTH","AI_CREDITS_CONFIRM_CODE","aiCreditRangeText","AiCreditsPromptNotice","AI_SITE_START_ANSWERS","aiSiteStartAnswersFromClientBuild","aiSiteStartBrief","aiSiteStartClientBrief","aiSiteStartClientInputs","aiSiteStartClientNote","aiSiteStartExtrasGiven","aiSiteStartInputs","aiSiteStartRefusal","aiSiteInspirationLimit","aiSiteStartFieldErrors","aiSiteStartFirstInvalidStep","aiSiteStartNextStep","aiSiteStartPreviousStep","aiSiteStartStepErrors","aiSiteStartStepIndex","AI_SITE_START_STEPS","AI_SITE_START_STEP_FIELDS","aiSiteKindOfInputs","aiSiteStartClickOf","useAiSiteStartTracking","AudienceStep","DetailsStep","KindStep","MoreDetails","ReviewStep","StartProgress","StepHelp","StyleStep","AiJobFollow","AiModelSelector","useAiModelChoice","aiCreditsBillingHref","aiSiteBuildHref","publishAiJob","clearAiSiteStartAnswers","readAiSiteStartAnswers","AiSiteImportStart","aiSiteImportOfferOf","TITLE_ID","AI_SITE_START_SURFACE_SX","bgcolor","IconBadge","accent","children","aria-hidden","sx","theme","width","spacing","height","borderRadius","display","alignItems","justifyContent","palette","main","mode","color","fontSize","ChoiceCard","icon","iconId","title","description","busy","blocked","onChoose","id","variant","transition","transitions","create","duration","shorter","borderColor","boxShadow","shadows","transform","Boolean","reason","fullWidth","onClick","disabled","aria-labelledby","aria-describedby","aria-busy","undefined","p","xs","sm","textAlign","size","aria-label","path","data-icon","component","START_HELP","choose","anchor","excerpt","estimate","SectionLabel","help","direction","AiSiteStartCard","hostId","orgId","orgSlug","host","startBlank","leave","pendingSite","clientBuild","initialAnswers","modelChoice","data","user","router","userRef","current","uid","verdict","setVerdict","handedOff","clientAnswers","intake","clientIntake","clientBuildRef","reopened","step","setStep","answers","setAnswers","checked","setChecked","Set","returnTo","setReturnTo","headingRef","drawnStep","fieldRefs","compact","breakpoints","down","noSsr","setBusy","startingStarter","setStartingStarter","notice","setNotice","started","setStarted","freeTaste","setFreeTaste","siteInspiration","setSiteInspiration","freeCredits","setFreeCredits","confirmingLeave","setConfirmingLeave","dialogRef","pendingRef","creating","created","tracker","importAvailability","setImportAvailability","state","importing","setImporting","active","response","encodeURIComponent","payload","ok","json","catch","credits","Number","isFinite","left","pages","Math","min","max","welcomeEmail","shown","status","siteImport","ready","answer","patch","serverPrompt","setServerPrompt","siteKind","prompt","noneLeft","refusal","band","surface","kind","load","loadModels","model","rememberedModel","pickedModel","plan","options","asked","creditsConfirmed","requestJob","siteId","check","method","headers","body","JSON","stringify","brief","filter","join","inputs","inspiration","refused","code","locked","String","error","site","made","address","job","detailsGiven","map","field","find","at","includes","complete","finish","onStarted","href","push","runStartBlank","result","then","done","chooseStarter","choice","chooseImport","chooseAi","focus","next","errors","length","add","fieldError","target","invalid","back","edit","goBackTo","exit","skip","abandon","dismissTo","drafted","siteType","trim","audience","dirty","dismiss","event","root","Node","contains","closeTo","leaveDraft","modelMultiplier","option","multiplier","scaled","range","likely","round","p90","ceiling","estimateText","toLocaleString","total","resetsOn","showsImport","choosing","reviewing","asking","fieldErrors","shownErrors","Object","fromEntries","has","stepProps","fieldRef","node","HEADINGS","lede","style","details","review","heading","onStepKeyDown","key","nativeEvent","isComposing","tagName","type","preventDefault","open","fullScreen","ref","onClose","onClickCapture","click","onKeyDownCapture","activity","onInputCapture","slotProps","paper","elevation","position","enableColorOnDark","data-start-area","borderBottom","gap","edge","noWrap","textOverflow","flex","px","onKeyDown","pt","onStep","maxWidth","disableGutters","py","tabIndex","outline","float","severity","action","fields","previewControl","onBack","gridTemplateColumns","md","label","message","actionLabel","intro","onOpenJobs","limit","upgradeHref","mt","onEdit","noun","onBuildWhatFits","onSmaller","flexWrap","rowGap","columnGap","borderTop","mr","minWidth","ariaLabel","startIcon","autoFocus"],"mappings":"AAAA;;;;;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AS,IAAMhK,mBAAmB;gBAClC5E,mBAAiB,GAAG7C,SAAS,MAAM,CAAC;gBACpC8C,oBAAkB,GAAG9C,SAAS,WAAW,CAAC;gBAC1C+S,UAAS;;kCAET,KAAChX;wBAAY8F,IAAI,GAAG7B,SAAS,MAAM,CAAC;kCAAG;;kCACvC,KAACnE;kCACC,cAAA,KAACC;4BAAkB+F,IAAI,GAAG7B,SAAS,WAAW,CAAC;sCAC5C4H,WACG,yDACA;;;kCAGR,MAAChM;;0CACC,KAACP;gCAAO8F,OAAM;gCAAUwB,SAASoM;0CAC9BnH,WAAW,UAAU;;0CAExB,KAACvM;gCAAOyG,SAAQ;gCAAYkT,SAAS;gCAACrS,SAAS,IAAM8E,mBAAmB;0CACrE;;;;;;;;AAMb;AAEA,eAAevD,gBAAe"}
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/components/ai-site-start-card.component.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n'use client'\n\nimport { lockdownRefusalText, parseLockdownRefusal, PLATFORM_BRAND_NAME } from '@aglyn/aglyn'\nimport { trackEvent } from '@aglyn/aglyn/app-utils/analytics-events'\nimport type { ConsoleHostFirstRunZoneProps } from '@aglyn/aglyn/plugin-manager/feature-plugins'\nimport { ICON_VARIANT_CLOSE } from '@aglyn/shared-data-enums'\nimport { mdiCreation, mdiPageLayoutHeaderFooter, mdiWebSync } from '@aglyn/shared-data-mdi'\nimport { pluginDocsHelp } from '@aglyn/aglyn/app-utils/docs-help'\nimport { HelpTip, MdiIcon } from '@aglyn/shared-ui-jsx'\nimport BlockedControl from '@aglyn/shared-ui-jsx/components/blocked-control.component'\nimport { OptionCardGrid } from '@aglyn/shared-ui-jsx/components/option-card-grid.component'\nimport { PrerequisiteNotice } from '@aglyn/shared-ui-jsx/components/prerequisite-notice.component'\nimport { authorizedFetch } from '@aglyn/shared-util-http/authorized-token'\nimport { useUser } from '@aglyn/tenant-feature-instance'\nimport {\n Alert,\n AppBar,\n Box,\n Button,\n Card,\n CardActionArea,\n Chip,\n CircularProgress,\n Container,\n Dialog,\n DialogActions,\n DialogContent,\n DialogContentText,\n DialogTitle,\n IconButton,\n Stack,\n Toolbar,\n Typography,\n useMediaQuery,\n} from '@mui/material'\nimport { alpha, useTheme, type Theme } from '@mui/material/styles'\nimport { useRouter } from 'next/navigation'\nimport {\n useCallback,\n useEffect,\n useId,\n useRef,\n useState,\n type KeyboardEvent,\n type MouseEvent,\n type ReactNode,\n type SyntheticEvent,\n} from 'react'\nimport {\n AI_JOB_AUTO_CONFIRM_INPUT,\n AI_SITE_FREE_PAGES,\n aiFreeCreditsNoneLeftText,\n aiFreeCreditsResetLabel,\n aiFreeSiteCreditRange,\n aiFreeSitePrompt,\n aiSiteCreditRange,\n type AiFreeCreditsLeft,\n aiSitePagesBand,\n} from '../model/ai-site-job'\nimport { FREE_AI_TASTE_CREDITS_PER_MONTH } from '../plan-entitlements'\nimport {\n AI_CREDITS_CONFIRM_CODE,\n aiCreditRangeText,\n type AiCreditRange,\n type AiCreditsPrompt,\n} from '../model/ai-credit-estimate'\nimport { AiCreditsPromptNotice } from './ai-credits-prompt.component'\nimport {\n AI_SITE_START_ANSWERS,\n AI_SITE_START_STYLE_REQUIRED,\n aiSiteStartAnswersFromClientBuild,\n aiSiteStartBrief,\n aiSiteStartClientBrief,\n aiSiteStartClientInputs,\n aiSiteStartClientNote,\n aiSiteStartExtrasGiven,\n aiSiteStartInputs,\n aiSiteStartKind,\n aiSiteStartRefusal,\n type AiSiteStartAnswers,\n} from '../model/ai-site-start'\nimport { aiSiteInspirationLimit } from '../model/ai-site-inspiration'\nimport {\n aiSiteStartFieldErrors,\n aiSiteStartFirstInvalidStep,\n aiSiteStartNextStep,\n aiSiteStartPreviousStep,\n aiSiteStartStepErrors,\n aiSiteStartStepIndex,\n AI_SITE_START_STEPS,\n AI_SITE_START_STEP_FIELDS,\n type AiSiteStartField,\n type AiSiteStartStep,\n} from '../model/ai-site-start-steps'\nimport type { AiJobSummary } from '../model/ai-jobs.types'\nimport { aiSiteKindOfInputs } from '../model/ai-site-kinds'\nimport { aiSiteStartClickOf, useAiSiteStartTracking } from './ai-site-start-tracking'\nimport {\n aiSiteStyleCards,\n AudienceStep,\n DetailsStep,\n KindStep,\n MoreDetails,\n ReviewStep,\n StartProgress,\n StepHelp,\n StyleStep,\n} from './ai-site-start-steps.component'\nimport { AiJobFollow } from './ai-job-follow.component'\nimport { AiModelSelector } from './ai-model-selector.component'\nimport { useAiModelChoice } from './use-ai-model-choice'\nimport { aiCreditsBillingHref, aiSiteBuildHref } from './ai-job-links'\nimport { publishAiJob } from './ai-jobs-store'\nimport { clearAiSiteStartAnswers, readAiSiteStartAnswers } from '../model/ai-site-start-handoff'\nimport { AiSiteImportStart } from './ai-site-import-start.component'\nimport { aiSiteImportOfferOf, type AiSiteImportAvailability } from '../model/ai-site-import-view'\n\n/**\n * The guided start (AGL-2918), on the `hostFirstRun` zone of the page a newly\n * created site lands on: a choice, a few questions, and the site scaffold they\n * become.\n *\n * ── Two steps (AGL-3594) ─────────────────────────────────────────────────\n *\n * Step 1 asks how to start, as two equal cards: the starter site — a\n * ready-made home page with a header and footer — or AI. The starter card\n * asks a style first (AGL-4049), from the same 21 cards the AI start's Style\n * step shows, with nothing chosen; its Create site is the zone's\n * `startBlank` with that style, which gives the site the starter every other\n * new site is born with, in that style's look. The AI card moves on to the\n * questions, one decision a step (AGL-3898; see {@link AiSiteStartCard}).\n *\n * ── A full screen dialog, and therefore three ways out ───────────────────\n *\n * The questions take the whole screen, which is the only presentation that\n * gets them read — but a surface that takes the screen and cannot be left is\n * a funnel, so leaving is drawn first and works on every step:\n *\n * - the close control at the start of the header,\n * - on a site that already exists, \"Skip\" at the end of it, named \"Skip and\n * start blank\",\n * - Escape, which `Dialog` reports through `onClose`.\n *\n * On a site that exists, before a job is started, all of them are the zone's\n * own `startBlank`: the starter site, and no job, no draft, no record of a\n * site half begun. After, they close through `leave`, and the job builds the\n * site.\n *\n * ── Or before the site exists (AGL-3761) ─────────────────────────────────\n *\n * \"Create site\" draws this straight away, with the zone's `pendingSite` and\n * no site. Step 1 then asks the site's name and address (the shell's own\n * fields) above the two cards, and the site is created only by a choice that\n * needs one: the starter card's Create site, once a style is chosen\n * (`startBlank`, which creates it with the starter in that style), or Plan my\n * site, which creates it and then starts the job on it. Nothing is chosen for\n * a person (AGL-4049), so there is no Skip: the close control and Escape\n * create nothing there, they are `leave`. If the site was created and its job\n * could not start, the site is a real one, and every way out gives it the\n * starter as above, in the style its questions took, so none is left empty.\n *\n * Escape and the close control are DISMISSALS, though, and Skip is a choice\n * (AGL-3660, 2026-10-08). Once anything is typed or picked, a dismissal asks\n * \"Leave without your answers?\" first, focused on Keep editing, so a stray\n * Escape — the second press after closing the model menu was the one in\n * production — can never trade a brief for the starter. Escape that reached\n * the dialog from a portal it does not contain (a menu, a select's list) is\n * that popup's, and the dialog ignores it.\n *\n * The header is the dialog's own chrome rather than part of its body, so the\n * way out cannot be scrolled off, and it is never disabled — least of all\n * while a request is in flight, which is the moment a person most wants it.\n * Nothing is focused ahead of the dialog's own frame, so the first thing a\n * keyboard reaches is the close control.\n *\n * ── It is absent until the route has answered ────────────────────────────\n *\n * The dialog covers the page, so being drawn on a guess is worse here than it\n * is for a card: it would be a takeover every flag-off workspace watches\n * disappear. Nothing renders at all — no `Dialog`, no portal — until the jobs\n * route has admitted this workspace, and a 404, a 403 or an unreachable route\n * is this widget staying absent and the ordinary blank page being all there\n * is. That the widget is mounted is itself the last of a stack of gates: the\n * shell held the plan's `aiGenerative` entitlement, the site's AI switch and\n * the reader's `ai.generate` first. A lockdown is the start door's to say,\n * here, in its own words.\n *\n * ── It builds and publishes for you ──────────────────────────────────────\n *\n * \"Plan my site\" starts a `site` job, which PLANS first: the pages, their\n * addresses, the navigation, the layout, the contact form and a palette. The\n * guided start confirms its own plan (AGL-3594), so the build follows with no\n * approval to make, and the site is published, indexable, when it is done.\n * The person edits or unpublishes it afterwards.\n *\n * ── It stays with the job (AGL-3593) ─────────────────────────────────────\n *\n * Once the job exists the dialog follows it live — planning, the plan with\n * its Confirm, building, then the draft pages to open — so a person never has\n * to leave it to get their site built. \"Open AI jobs\" follows the job in the\n * Assist panel instead; it leaves the guided start the way every other exit\n * does, because the dialog covers the panel it opens.\n */\n\ntype Verdict = 'checking' | 'ready' | 'hidden'\n\n/** Labels the dialog for a reader, from its own heading. */\nconst TITLE_ID = 'ai-site-start-title'\n\n/**\n * The takeover's surface, for its paper, its bar and its footer alike: the\n * console page's own background (AGL-3596). The paper sits at elevation 0,\n * which is what keeps MUI's dark-mode elevation overlay off it.\n */\nexport const AI_SITE_START_SURFACE_SX = { bgcolor: 'background.default' } as const\n\n/** The soft round badge an icon sits in, in its accent's tint. */\nfunction IconBadge({ accent, children }: { accent: 'primary' | 'secondary'; children: ReactNode }) {\n return (\n <Box\n aria-hidden\n sx={(theme: Theme) => ({\n width: theme.spacing(9),\n height: theme.spacing(9),\n borderRadius: '50%',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n bgcolor: alpha(theme.palette[accent].main, theme.palette.mode === 'dark' ? 0.24 : 0.12),\n color: `${accent}.main`,\n fontSize: theme.spacing(5.5),\n })}\n >\n {children}\n </Box>\n )\n}\n\n/**\n * One way to start, as a card the whole of which is the button. Its accessible\n * name is its title; its description describes it.\n */\nfunction ChoiceCard({\n accent,\n icon,\n iconId,\n title,\n description,\n busy = false,\n blocked = null,\n onChoose,\n children,\n}: {\n accent: 'primary' | 'secondary'\n icon: string\n /** Names the icon for a reader of the markup; the icon itself is decorative. */\n iconId: string\n title: string\n description: string\n busy?: boolean\n /**\n * Why the card cannot be chosen here, when the workspace can change that\n * (AGL-3976): drawn disabled with the reason, never hidden.\n */\n blocked?: string | null\n onChoose: () => void\n children?: ReactNode\n}) {\n const id = useId()\n return (\n <Card\n variant=\"outlined\"\n sx={(theme: Theme) => ({\n borderRadius: 2,\n height: '100%',\n transition: theme.transitions.create(['border-color', 'box-shadow', 'transform'], {\n duration: theme.transitions.duration.shorter,\n }),\n '&:hover, &:focus-within': {\n borderColor: `${accent}.main`,\n boxShadow: theme.shadows[4],\n transform: `translateY(-${theme.spacing(0.25)})`,\n },\n '@media (prefers-reduced-motion: reduce)': {\n transition: 'none',\n '&:hover, &:focus-within': { transform: 'none' },\n },\n })}\n >\n <BlockedControl blocked={Boolean(blocked)} reason={blocked ?? ''} fullWidth>\n <CardActionArea\n onClick={onChoose}\n disabled={busy}\n aria-labelledby={`${id}-title`}\n aria-describedby={`${id}-description`}\n aria-busy={busy || undefined}\n sx={{ height: '100%', p: { xs: 3, sm: 4 } }}\n >\n <Stack spacing={2} sx={{ alignItems: 'center', textAlign: 'center' }}>\n <IconBadge accent={accent}>\n {busy ? (\n <CircularProgress size=\"1em\" color={accent} aria-label={`${title}…`} />\n ) : (\n <MdiIcon path={icon} data-icon={iconId} aria-hidden />\n )}\n </IconBadge>\n <Typography id={`${id}-title`} variant=\"h6\" component=\"h2\">\n {title}\n </Typography>\n <Typography id={`${id}-description`} variant=\"body2\" color=\"text.secondary\">\n {description}\n </Typography>\n {children}\n </Stack>\n </CardActionArea>\n </BlockedControl>\n </Card>\n )\n}\n\n/** A small label above a group of questions. */\n/**\n * Each part of the guided start links its own section of the Start with AI\n * guide (AGL-3660), so a `?` says what that one group of answers changes.\n */\nconst START_HELP = {\n choose: pluginDocsHelp('aiStart', {\n anchor: '#how-do-you-want-to-start',\n excerpt:\n 'The starter site gives you a ready-made home page to edit, in a style you choose. Start with AI asks a few questions, then plans, writes and publishes your pages.',\n }),\n estimate: pluginDocsHelp('aiCredits', {\n anchor: '#before-a-job-starts',\n excerpt:\n 'About what a start like this costs, measured on real builds, and the most it can cost. What it really costs is what each step spends, and you can watch that add up while it runs.',\n }),\n}\n\nfunction SectionLabel({ children, help }: { children: ReactNode; help?: ReturnType<typeof pluginDocsHelp> }) {\n return (\n <Stack direction=\"row\" spacing={0.5} sx={{ alignItems: 'center' }}>\n <Typography variant=\"overline\" color=\"text.secondary\" component=\"h2\" sx={{ display: 'block' }}>\n {children}\n </Typography>\n {help ? <HelpTip {...help} /> : null}\n </Stack>\n )\n}\n\n/**\n * The guided start, as the `hostFirstRun` zone draws it, or reopened on a\n * failed start's own answers (AGL-3596): `initialAnswers` opens it on the\n * questions, filled in, for the person to adjust and start a fresh job.\n */\nexport type AiSiteStartCardProps = ConsoleHostFirstRunZoneProps & {\n initialAnswers?: AiSiteStartAnswers | null\n}\n\n/**\n * The questions are one decision a step (AGL-3898): what kind of site it is\n * (typed, or a card), who it is for, the style (cards that show each one,\n * \"Pick for me\" first and picked), the details, and a review that plans the\n * site (`ai-site-start-steps.component.tsx`). Back and Next keep every\n * answer; Enter in a text answer is Next; each step's heading takes the focus\n * when it is drawn; a step that cannot go forward says why beside the field\n * and puts the cursor in it. The answers are the same object the single form\n * held, and only the review turns them into the job, through the same\n * `aiSiteStartBrief` and `aiSiteStartInputs`. Each step is reported as a\n * funnel, with where people struggle (`ai-site-start-tracking.ts`).\n */\nexport function AiSiteStartCard({\n hostId,\n orgId,\n orgSlug,\n host,\n startBlank,\n leave,\n pendingSite,\n chooseStarter: chooseStarterInShell,\n clientBuild,\n initialAnswers = null,\n}: AiSiteStartCardProps) {\n const { data: user } = useUser()\n const router = useRouter()\n // Held in a ref so a request reads WHO is signed in, never the identity of\n // the object that says so.\n const userRef = useRef(user)\n userRef.current = user\n const uid = user?.uid ?? null\n const [verdict, setVerdict] = useState<Verdict>('checking')\n // \"Start again\" on a start whose empty site was removed (AGL-3936) opens\n // Create site with that start's answers: read once, and only here, where\n // the site does not exist yet. It opens on the first question, where the\n // site's name and address are asked, with every answer after it filled in.\n const [handedOff] = useState(() => (pendingSite && !initialAnswers ? readAiSiteStartAnswers() : null))\n // A site staff are building for a client (AGL-3958): the intake answered\n // the questions already, so the start opens on the review with them, and\n // stays on this screen once it has started. Read once, like a reopened start.\n const [clientAnswers] = useState(() =>\n clientBuild && !initialAnswers ? aiSiteStartAnswersFromClientBuild(clientBuild.intake) : null,\n )\n const [clientIntake] = useState(() => clientBuild?.intake ?? null)\n const clientBuildRef = useRef(clientBuild)\n clientBuildRef.current = clientBuild\n // Read once: a start reopened on its answers stays one while it is open.\n const reopened = useRef(initialAnswers !== null || handedOff !== null || clientAnswers !== null)\n // A start reopened on its answers opens on the review, every answer there to change.\n const [step, setStep] = useState<AiSiteStartStep>(initialAnswers || clientAnswers ? 'review' : 'choose')\n const [answers, setAnswers] = useState<AiSiteStartAnswers>(\n initialAnswers ?? clientAnswers ?? handedOff ?? AI_SITE_START_ANSWERS,\n )\n // The steps whose reasons not to go forward are shown: the ones Next was refused on.\n const [checked, setChecked] = useState<ReadonlySet<AiSiteStartStep>>(() => new Set())\n // A step opened from the review's Edit goes back to the review on Next.\n const [returnTo, setReturnTo] = useState<AiSiteStartStep | null>(null)\n // Each step's heading takes the focus when the step changes, never on the first draw.\n const headingRef = useRef<HTMLHeadingElement | null>(null)\n const drawnStep = useRef<AiSiteStartStep | null>(null)\n const fieldRefs = useRef<Partial<Record<AiSiteStartField, HTMLInputElement | null>>>({})\n const theme = useTheme()\n const compact = useMediaQuery(theme.breakpoints.down('sm'), { noSsr: true })\n const [busy, setBusy] = useState(false)\n // The starter card's own busy state while `startBlank` runs (AGL-3594).\n const [startingStarter, setStartingStarter] = useState(false)\n // The starter card's style choice (AGL-4049): drawn after the starter card\n // is clicked, with nothing chosen until a card is.\n const [pickingStyle, setPickingStyle] = useState(false)\n const [starterStyle, setStarterStyle] = useState<string | null>(null)\n const [notice, setNotice] = useState<string | null>(null)\n /** The site job \"Plan my site\" started, as the create door answered with it. */\n const [started, setStarted] = useState<AiJobSummary | null>(null)\n // The Free taste's page band (AGL-3594), read off the verdict request.\n const [freeTaste, setFreeTaste] = useState(false)\n // Whether the Style step asks for the sites the person likes (AGL-3975),\n // read off the same verdict request: `release_ai_site_inspiration`.\n const [siteInspiration, setSiteInspiration] = useState(false)\n // What the Free workspace has left this month (AGL-3660), as the same read\n // the create door refuses on: the less of its own band and its owner's\n // allowance across their Free workspaces. `null` when the route said none.\n const [freeCredits, setFreeCredits] = useState<AiFreeCreditsLeft | null>(null)\n // \"Leave without your answers?\" (AGL-3660): a dismissal with a brief typed.\n const [confirmingLeave, setConfirmingLeave] = useState(false)\n // The dialog's own root, to tell its Escape from a nested popup's.\n const dialogRef = useRef<HTMLDivElement | null>(null)\n // Drawn by \"Create site\" before the site exists (AGL-3761): the shell's\n // name and address are asked on step 1, and the site is created only by\n // the starter, Skip, or Plan my site. Read through a ref by the verdict\n // below, which must not re-run when the shell re-renders it.\n const pendingRef = useRef(pendingSite)\n pendingRef.current = pendingSite\n const creating = Boolean(pendingSite) && !pendingSite?.created\n // The funnel (AGL-3898): each step drawn, left and abandoned, and where people struggle.\n const tracker = useAiSiteStartTracking(step, verdict === 'ready')\n // \"Bring my site\" (AGL-3976): asked of its own door, absent while its flag\n // is off, drawn disabled with the reason where the workspace can change it.\n const [importAvailability, setImportAvailability] = useState<AiSiteImportAvailability>({ state: 'checking' })\n const [importing, setImporting] = useState(false)\n\n useEffect(() => {\n if (!orgId || !uid) return\n let active = true\n void (async () => {\n try {\n const response = await authorizedFetch(\n userRef.current,\n // `siteImport=1`: whether \"Bring my site\" is offered here (AGL-3976), on the same read.\n `/api/ai/jobs?orgId=${encodeURIComponent(orgId)}&limit=1&siteImport=1`,\n )\n const payload = response.ok ? await response.json().catch(() => null) : null\n if (active) {\n setSiteInspiration(payload?.siteInspiration === true)\n if (payload?.freeTaste === true) {\n setFreeTaste(true)\n const credits = payload?.freeCredits as AiFreeCreditsLeft | undefined\n if (credits && Number.isFinite(credits.left)) setFreeCredits(credits)\n // A reopened start keeps the pages it asked for, within the band.\n setAnswers((current) => ({\n ...current,\n pages: reopened.current ? Math.min(current.pages, AI_SITE_FREE_PAGES.max) : AI_SITE_FREE_PAGES.max,\n welcomeEmail: false,\n }))\n }\n const shown = response.status !== 404 && response.status !== 403\n setImportAvailability(aiSiteImportOfferOf(payload?.siteImport))\n setVerdict(shown ? 'ready' : 'hidden')\n // \"Create site\" shows its own dialog when this one will not draw.\n pendingRef.current?.ready(shown)\n clientBuildRef.current?.ready?.(shown)\n }\n } catch {\n if (active) {\n setVerdict('hidden')\n pendingRef.current?.ready(false)\n clientBuildRef.current?.ready?.(false)\n }\n }\n })()\n return () => {\n active = false\n }\n }, [orgId, uid])\n\n const answer = useCallback(\n (patch: Partial<AiSiteStartAnswers>) =>\n setAnswers((current) => ({ ...current, ...patch })),\n [],\n )\n\n // A Free start past what is left asks first (AGL-3722): it is admitted on\n // its measured p90, and one past what is left starts only on \"Build what\n // fits\" (pausing with Resume where the credits run out), or smaller as the\n // home page alone. The create door asks the same, so a stale dialog meets\n // the prompt there too (`serverPrompt`). Nothing at all left is a dead\n // stop until the credits renew or the workspace upgrades.\n const [serverPrompt, setServerPrompt] = useState<AiCreditsPrompt | null>(null)\n // The door's prompt was for the pages it was asked with.\n useEffect(() => setServerPrompt(null), [answers.pages])\n // A store's first products and a blog's first posts are part of the start (AGL-3676, AGL-3798).\n const siteKind = aiSiteKindOfInputs(aiSiteStartInputs(answers))?.id ?? null\n const prompt = freeTaste ? (aiFreeSitePrompt(freeCredits, answers.pages, { siteKind }) ?? serverPrompt) : null\n const noneLeft = freeTaste && freeCredits !== null && freeCredits.left <= 0\n // The door's refusal, else the questions' own: a style not yet chosen (AGL-4049).\n const refusal =\n aiSiteStartRefusal(answers, { freeTaste }) ?? (answers.style === null ? AI_SITE_START_STYLE_REQUIRED : null)\n const band = aiSitePagesBand(freeTaste)\n // On a paid plan the person picks the model that builds the site (AGL-3660),\n // Auto by default, from the models their plan allows; every step of the job\n // runs on it. A Free workspace builds on the default and is offered none.\n const modelChoice = useAiModelChoice({ orgId, hostId, surface: 'jobs', kind: 'job.page' })\n // A pick remembered from before needs its cost to estimate by; Auto does not,\n // and the list is otherwise read when the picker opens.\n const { load: loadModels, model: rememberedModel } = modelChoice\n useEffect(() => {\n if (!freeTaste && step === 'review' && rememberedModel) loadModels()\n }, [freeTaste, step, rememberedModel, loadModels])\n const pickedModel = freeTaste ? null : modelChoice.model\n\n const plan = useCallback(async (options: { creditsConfirmed?: boolean; pages?: number } = {}) => {\n const asked = options.pages ? { ...answers, pages: options.pages } : answers\n if (!orgId || aiSiteStartRefusal(asked, { freeTaste }) || asked.style === null || noneLeft) return\n // Past what is left, only an explicit go-ahead starts it.\n if (freeTaste && !options.creditsConfirmed && aiFreeSitePrompt(freeCredits, asked.pages, { siteKind })) return\n if (options.pages) answer({ pages: options.pages })\n setBusy(true)\n setNotice(null)\n setServerPrompt(null)\n try {\n const requestJob = (siteId: string | null, check: boolean) =>\n authorizedFetch(userRef.current, '/api/ai/jobs', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n orgId,\n hostId: siteId,\n kind: 'site',\n // A client build's intake rides along (AGL-3958): the name and\n // towns as the inputs the questions leave empty (the towns only\n // while no address is given, AGL-3995), and how to reach the\n // business, its hours and the owner's words in the brief.\n brief: [aiSiteStartBrief(asked), clientIntake ? aiSiteStartClientBrief(clientIntake) : '']\n .filter(Boolean)\n .join(' '),\n // The guided start confirms its own plan (AGL-3594): the build\n // follows the plan with no approval to make.\n // The sites they like go only while the start asks for them (AGL-3975).\n inputs: {\n ...aiSiteStartInputs(siteInspiration ? asked : { ...asked, inspiration: [] }),\n ...(clientIntake ? aiSiteStartClientInputs(clientIntake, asked) : {}),\n [AI_JOB_AUTO_CONFIRM_INPUT]: true,\n },\n ...(pickedModel ? { model: pickedModel } : {}),\n ...(options.creditsConfirmed ? { creditsConfirmed: true } : {}),\n ...(check ? { check: true } : {}),\n }),\n })\n // A refusal said in the dialog, or the Free go-ahead it asks for.\n const refused = async (response: Response): Promise<unknown> => {\n const payload = await response.json().catch(() => null)\n if (response.ok) return payload ?? {}\n if (response.status === 409 && payload?.code === AI_CREDITS_CONFIRM_CODE && payload?.credits) {\n setServerPrompt(payload.credits as AiCreditsPrompt)\n return null\n }\n const locked = parseLockdownRefusal(response.status, payload)\n setNotice(\n locked\n ? lockdownRefusalText(locked)\n : String(payload?.error ?? 'The site could not be started. Try again.'),\n )\n return null\n }\n // The site, created now when it does not exist yet (AGL-3761): this is\n // the moment the person asked for it. The start is checked first\n // (AGL-3859), so one the jobs route would refuse, or would ask the Free\n // go-ahead for, is answered before any site exists. A refusal about the\n // name or address goes back to step 1, where they are typed.\n let site = { hostId, host, orgSlug }\n if (!hostId && pendingSite) {\n if (!pendingSite.created && !(await refused(await requestJob(null, true)))) return\n // The style the questions took (AGL-4049), recorded on the site.\n const made = await pendingSite.create(asked.style ? { style: asked.style } : undefined)\n if ('error' in made) {\n setNotice(made.error)\n if (made.address) setStep('choose')\n return\n }\n site = { hostId: made.hostId, host: made.host, orgSlug: made.orgSlug || orgSlug }\n }\n if (!site.hostId) return\n const payload = (await refused(await requestJob(site.hostId, false))) as { job?: AiJobSummary } | null\n if (!payload) return\n const created = (payload?.job as AiJobSummary | undefined) ?? null\n if (!created) {\n setNotice('The site could not be started. Try again.')\n return\n }\n // The indicator and the launcher count it from the moment it exists.\n publishAiJob(created)\n // A removed start's answers have been used (AGL-3936).\n clearAiSiteStartAnswers()\n // Which optional details the site was asked for with (AGL-3979), by id only.\n tracker.detailsGiven(\n aiSiteStartExtrasGiven(asked).map((field) => ({\n field,\n step: AI_SITE_START_STEPS.find((at) => AI_SITE_START_STEP_FIELDS[at].includes(field)) ?? 'details',\n })),\n )\n // The funnel's last step: the site is started, and nothing after is leaving it.\n tracker.complete()\n tracker.finish()\n // A client build follows its job here, on the build's own screen, which\n // goes on to send the owner the preview (AGL-3958).\n if (clientIntake) {\n clientBuildRef.current?.onStarted?.({ id: created.id })\n setStarted(created)\n return\n }\n // Where the next step is (AGL-3594): the site's \"Building your site\"\n // page for this job. The zone closes without the starter first, so the\n // setup page does not ask again behind it.\n const href = aiSiteBuildHref(site.orgSlug, site.host, created.id)\n if (href) {\n ;(leave ?? (() => undefined))()\n router.push(href)\n return\n }\n setStarted(created)\n } catch {\n setNotice('The site could not be started. Try again.')\n } finally {\n setBusy(false)\n }\n }, [orgId, hostId, answers, answer, freeTaste, freeCredits, noneLeft, orgSlug, host, leave, router, pickedModel, pendingSite, siteKind, tracker, clientIntake, siteInspiration])\n\n // The zone's `startBlank`, with the style chosen for the starter (AGL-4049).\n // Before the site exists it creates it with the starter, and answers\n // `false` when it could not — most often a name or address to fix, which\n // step 1 shows.\n const runStartBlank = useCallback(\n (options?: { style?: string }) => {\n const result = startBlank(options?.style ? { style: options.style } : undefined)\n if (result && typeof result.then === 'function') {\n void result.then((done) => {\n if (done) return\n setStartingStarter(false)\n setPickingStyle(false)\n setStep('choose')\n })\n }\n },\n [startBlank],\n )\n\n // The starter card asks a style first (AGL-4049): nothing is created, and\n // nothing chosen, until a style card is clicked and Create site with it.\n // Where the shell offers \"Choose your starter\" — the platform's styles and\n // the marketplace's starters together — the card hands the choice to it\n // instead, and asks no style itself.\n const chooseStarter = useCallback(() => {\n if (pendingSite && !pendingSite.created && !pendingSite.check()) return\n trackEvent('site_start_choice', { choice: 'starter' })\n if (chooseStarterInShell && pendingSite && !pendingSite.created) return chooseStarterInShell()\n setPickingStyle(true)\n }, [chooseStarterInShell, pendingSite])\n const starterInShell = Boolean(chooseStarterInShell && pendingSite && !pendingSite.created)\n\n const createStarter = useCallback(() => {\n if (!starterStyle || startingStarter) return\n setStartingStarter(true)\n // The starter is a way to start, not a way to leave: no abandonment after it.\n tracker.finish()\n runStartBlank({ style: starterStyle })\n }, [runStartBlank, starterStyle, startingStarter, tracker])\n\n const chooseImport = useCallback(() => {\n if (importAvailability.state !== 'ready') return\n if (pendingSite && !pendingSite.created && !pendingSite.check()) return\n trackEvent('site_start_choice', { choice: 'import' })\n tracker.complete()\n setImporting(true)\n }, [importAvailability.state, pendingSite, tracker])\n\n const chooseAi = useCallback(() => {\n if (pendingSite && !pendingSite.created && !pendingSite.check()) return\n trackEvent('site_start_choice', { choice: 'ai' })\n tracker.complete()\n setStep('kind')\n }, [pendingSite, tracker])\n\n // The heading of each step takes the focus as the step is drawn, so a\n // keyboard and a screen reader start where the new question does.\n useEffect(() => {\n if (verdict !== 'ready') return\n if (drawnStep.current !== null && drawnStep.current !== step) headingRef.current?.focus()\n drawnStep.current = step\n }, [step, verdict])\n\n /** Forward from a question step, when its answers may go forward. */\n const next = useCallback(() => {\n if (step === 'choose' || step === 'review') return\n const errors = aiSiteStartStepErrors(step, answers, { freeTaste })\n if (errors.length) {\n setChecked((current) => new Set(current).add(step))\n for (const error of errors) tracker.fieldError(error.field, error.code)\n fieldRefs.current[errors[0].field]?.focus()\n return\n }\n tracker.complete()\n const target = returnTo ?? aiSiteStartNextStep(step)\n setReturnTo(null)\n // A review reached with an answer that cannot go forward opens on that answer instead.\n if (target === 'review') {\n const invalid = aiSiteStartFirstInvalidStep(answers, { freeTaste })\n if (invalid && invalid !== 'review') {\n setChecked((current) => new Set(current).add(invalid))\n setStep(invalid)\n return\n }\n }\n if (target) setStep(target)\n }, [step, answers, freeTaste, returnTo, tracker])\n\n /** Back one step, keeping every answer. */\n const back = useCallback(() => {\n const target = aiSiteStartPreviousStep(step)\n if (!target) return\n tracker.back()\n setReturnTo(null)\n setStep(target)\n }, [step, tracker])\n\n /** From the review, to the step that asks an answer, and back to the review on Next. */\n const edit = useCallback(\n (target: AiSiteStartStep) => {\n tracker.back()\n setReturnTo('review')\n setStep(target)\n },\n [tracker],\n )\n\n /** From the progress, back to a step already answered: from the review it is Edit. */\n const goBackTo = (target: AiSiteStartStep) => {\n if (aiSiteStartStepIndex(target) >= aiSiteStartStepIndex(step)) return\n if (step === 'review') {\n edit(target)\n return\n }\n tracker.back()\n setReturnTo(null)\n setStep(target)\n }\n\n if (verdict !== 'ready') return null\n\n // The style a way out gives the starter on a site that exists (AGL-4049):\n // the one the starter's style view or the questions took, if any.\n const exitStyle =\n starterStyle ?? (answers.style !== null ? aiSiteStartKind(answers).id : null)\n const giveStarter = () => runStartBlank(exitStyle ? { style: exitStyle } : undefined)\n // Before a job is started Skip is the blank site, which writes the starter\n // (AGL-3594); after, it only closes — the job builds the site.\n const exit = started ? (leave ?? giveStarter) : giveStarter\n // Skip, as the header draws it: before a site is started it is leaving the questions.\n const skip = () => {\n if (!started) tracker.abandon('skip')\n exit()\n }\n // Escape and the close control. Before \"Create site\" has made the site\n // (AGL-3761) there is nothing to give a starter to, so they only close,\n // and nothing is created; otherwise they are the same way out as Skip.\n const dismissTo = creating && !started ? (leave ?? giveStarter) : exit\n // Anything the person typed or picked, which a dismissal must not discard\n // silently (AGL-3660). After a job starts there is nothing left to lose.\n const drafted =\n !started &&\n Boolean(\n answers.siteType.trim() ||\n answers.audience.trim() ||\n answers.style !== null ||\n starterStyle !== null ||\n aiSiteStartExtrasGiven(answers).length > 0 ||\n (creating && pendingSite?.dirty),\n )\n // Escape and the close control: a dismissal, never a choice. Escape that\n // bubbled here through React from a portal outside this dialog's own DOM is\n // a nested menu's, already handled there, and is not this dialog's to act on.\n const dismiss = (event?: SyntheticEvent | object, reason?: string) => {\n if (reason === 'escapeKeyDown') {\n const target = (event as SyntheticEvent | undefined)?.target\n const root = dialogRef.current\n if (root && target instanceof Node && !root.contains(target)) return\n }\n if (drafted) setConfirmingLeave(true)\n else closeTo()\n }\n // The dismissal itself, once nothing typed is in the way of it.\n const closeTo = () => {\n if (!started) tracker.abandon('close')\n dismissTo()\n }\n const leaveDraft = () => {\n setConfirmingLeave(false)\n closeTo()\n }\n\n // The chosen model's cost against Auto's, as the model list states it.\n const modelMultiplier =\n (pickedModel && modelChoice.options?.options.find((option) => option.id === pickedModel)?.multiplier) || 1\n // What the start is likely to cost and at most (AGL-3722): \"About 137\n // credits (up to 283)\", the measured figures scaled by the chosen model.\n const scaled = (range: AiCreditRange): AiCreditRange => ({\n likely: Math.round(range.likely * modelMultiplier),\n p90: Math.round(range.p90 * modelMultiplier),\n ceiling: Math.round(range.ceiling * modelMultiplier),\n })\n const estimate = freeTaste\n ? aiFreeSiteCreditRange(answers.pages, { siteKind })\n : scaled(aiSiteCreditRange(answers.pages, { welcomeEmail: answers.welcomeEmail, siteKind }))\n // A Free start quotes what is LEFT (AGL-3660), shared across the owner's\n // Free workspaces — never the month's whole allowance as if none were spent.\n const estimateText = freeTaste\n ? freeCredits\n ? `${aiCreditRangeText(estimate)}. You have ${freeCredits.left.toLocaleString('en-US')} of your ${freeCredits.total.toLocaleString('en-US')} free AI credits left this month, until ${aiFreeCreditsResetLabel(freeCredits.resetsOn)}`\n : `${aiCreditRangeText(estimate)}, of the ${FREE_AI_TASTE_CREDITS_PER_MONTH} AI credits you get free each month`\n : `${aiCreditRangeText(estimate)}, estimated`\n\n // The card is drawn wherever the workspace could use it, disabled where it cannot yet.\n const showsImport = importAvailability.state === 'ready' || importAvailability.state === 'blocked'\n // The starter's style view (AGL-4049), on step 1.\n const stylingStarter = step === 'choose' && pickingStyle && !started && !importing\n const choosing = step === 'choose' && !pickingStyle && !started && !importing\n const reviewing = step === 'review' && !started && !importing\n const asking = step !== 'choose' && !started && !importing\n // Each answer's reason not to go forward, shown on a step once Next was refused there.\n const fieldErrors = aiSiteStartFieldErrors(answers, { freeTaste })\n const shownErrors = Object.fromEntries(\n AI_SITE_START_STEP_FIELDS[step]\n .filter((field) => checked.has(step) && fieldErrors[field])\n .map((field) => [field, fieldErrors[field]]),\n )\n const stepProps = {\n answers,\n answer,\n tracker,\n errors: shownErrors,\n fieldRef: (field: AiSiteStartField) => (node: HTMLInputElement | null) => {\n fieldRefs.current[field] = node\n },\n }\n const HEADINGS: Record<AiSiteStartStep, { title: string; lede: string }> = {\n choose: {\n title: 'How do you want to start?',\n lede: creating ? 'Name your site, then choose how it starts. You can change everything later.' : 'You can change everything later.',\n },\n kind: {\n title: 'What are you building?',\n lede: `Say it in a few words, or pick the closest. ${PLATFORM_BRAND_NAME} AI plans and writes your pages from it.`,\n },\n audience: { title: 'Who is it for?', lede: 'The pages and the contact form are written for them.' },\n style: {\n title: 'Choose a style',\n lede: 'Each picture is an example home page in that style. Yours is written for your business, with its own colors and fonts within the style you pick.',\n },\n details: {\n title: 'A few details',\n lede: 'How customers reach you, where messages go, how many pages, and what else to draft. All can be changed later.',\n },\n review: {\n title: 'Review your site',\n lede: started\n ? `${PLATFORM_BRAND_NAME} AI is on it.`\n : `${PLATFORM_BRAND_NAME} AI plans and writes your pages from these answers, then publishes your site.`,\n },\n }\n const heading = importing\n ? {\n title: 'Bring my site',\n lede: `Bring the website you have now into ${PLATFORM_BRAND_NAME}: its pages, words and photos. First, prove it is yours.`,\n }\n : stylingStarter\n ? {\n title: 'Choose a style',\n lede: 'Your site starts with a home page, a header and a footer in the style you choose. You can change everything later.',\n }\n : HEADINGS[step]\n // Enter in a text answer is Next. A select, a card or a button keeps its own Enter.\n const onStepKeyDown = (event: KeyboardEvent<HTMLElement>) => {\n if (event.key !== 'Enter' || event.nativeEvent.isComposing || !asking || reviewing) return\n const target = event.target as HTMLElement\n if (target.tagName !== 'INPUT' || (target as HTMLInputElement).type === 'hidden') return\n event.preventDefault()\n next()\n }\n\n return (\n <Dialog\n open\n fullScreen\n ref={dialogRef}\n onClose={dismiss}\n aria-labelledby={TITLE_ID}\n // Where people get lost (AGL-3898): any input puts off the idle signal,\n // and every click is read for rage and dead clicks.\n onClickCapture={(event: MouseEvent<HTMLElement>) => tracker.click(aiSiteStartClickOf(event))}\n onKeyDownCapture={() => tracker.activity()}\n onInputCapture={() => tracker.activity()}\n // The console's own page surface, in both modes. A Dialog's paper sits\n // at elevation 24 by default, and in dark mode MUI lightens an elevated\n // paper with a white overlay, which turned the whole takeover a\n // washed-out gray; the overlay is for floating surfaces, and this one\n // fills the screen, so its paper is flat.\n slotProps={{ paper: { elevation: 0, sx: AI_SITE_START_SURFACE_SX } }}\n >\n {/*\n The way out, before anything it is a way out of: a slim header on the\n paper surface. On a narrow screen it is the TITLE that gives way, so\n the exits keep their words at every width.\n */}\n <AppBar\n position=\"relative\"\n color=\"inherit\"\n elevation={0}\n enableColorOnDark\n data-start-area=\"header\"\n sx={{ ...AI_SITE_START_SURFACE_SX, borderBottom: 1, borderColor: 'divider' }}\n >\n <Toolbar variant=\"dense\" sx={{ gap: 1 }}>\n <IconButton\n edge=\"start\"\n color=\"inherit\"\n onClick={() => dismiss()}\n aria-label=\"Close the guided start\"\n >\n <MdiIcon path={ICON_VARIANT_CLOSE.path} />\n </IconButton>\n <Typography\n id={TITLE_ID}\n variant=\"subtitle1\"\n component=\"div\"\n noWrap\n sx={{ textOverflow: 'ellipsis', flex: 1 }}\n >\n {'Start your site'}\n </Typography>\n {/* No Skip before the site exists (AGL-4049): nothing is chosen for\n a person, and the close control already leaves with nothing made. */}\n {creating && !started ? null : (\n <Button color=\"inherit\" onClick={skip} aria-label={started ? 'Close' : 'Skip and start blank'}>\n {started ? 'Close' : 'Skip'}\n </Button>\n )}\n </Toolbar>\n </AppBar>\n <DialogContent sx={{ px: { xs: 2, sm: 3 } }} onKeyDown={onStepKeyDown}>\n {/* The step timeline spans the whole dialog, above the step's own\n narrower column (AGL-4014): MUI's Stepper as it comes. */}\n {importing || stylingStarter ? null : (\n <Box sx={{ pt: { xs: 3, sm: 4 } }}>\n <StartProgress step={step} compact={compact} onStep={started ? undefined : goBackTo} />\n </Box>\n )}\n <Container\n maxWidth={choosing || stylingStarter || step === 'kind' || step === 'style' ? 'md' : 'sm'}\n disableGutters\n sx={{ py: { xs: 3, sm: 5 } }}\n >\n <Stack spacing={4}>\n <Stack spacing={1} sx={{ textAlign: choosing ? 'center' : 'left' }} data-start-area=\"heading\">\n <Typography\n ref={headingRef}\n tabIndex={-1}\n variant=\"h4\"\n component=\"h1\"\n sx={{ '&:focus': { outline: 'none' }, '&:focus-visible': { outline: 'none' } }}\n >\n {heading.title}\n </Typography>\n <Typography variant=\"body1\" color=\"text.secondary\">\n {choosing || stylingStarter ? (\n <HelpTip sx={{ float: 'right' }} {...START_HELP.choose} />\n ) : importing ? null : (\n <StepHelp step={step} />\n )}\n {heading.lede}\n </Typography>\n </Stack>\n {notice && (\n <Alert severity=\"info\" data-start-area=\"notice\">\n {notice}\n </Alert>\n )}\n {asking && noneLeft && freeCredits && (\n <Alert\n severity=\"warning\"\n data-start-area=\"notice\"\n action={\n orgSlug ? (\n <Button color=\"inherit\" size=\"small\" href={aiCreditsBillingHref(orgSlug)}>\n {'Upgrade'}\n </Button>\n ) : undefined\n }\n >\n {aiFreeCreditsNoneLeftText(freeCredits.resetsOn)}\n </Alert>\n )}\n {choosing && creating && pendingSite ? (\n <Stack spacing={2} component=\"section\" aria-label=\"Your site\">\n <SectionLabel>{'Your site'}</SectionLabel>\n {pendingSite.fields}\n {/* Start in preview (AGL-4086). Off for the starter and for\n Start with AI; Bring my site asks again, defaulting on. */}\n {pendingSite.previewControl?.('ai')}\n </Stack>\n ) : null}\n {importing && orgId ? (\n <AiSiteImportStart\n orgId={orgId}\n orgSlug={orgSlug}\n hostId={hostId}\n host={host}\n user={user}\n pendingSite={pendingSite}\n onBack={() => setImporting(false)}\n leave={leave}\n />\n ) : stylingStarter ? (\n <Stack spacing={3} component=\"section\" aria-label=\"Style of your starter site\">\n <OptionCardGrid\n label=\"Style of site\"\n data-start-area=\"starter-style-cards\"\n columns={{ xs: 2, sm: 2, md: 3 }}\n options={aiSiteStyleCards()}\n value={starterStyle}\n onChange={(id) => {\n setStarterStyle(id)\n tracker.fieldPicked('style')\n }}\n />\n {/* Start in preview (AGL-4086), for the starter. */}\n {creating ? pendingSite?.previewControl?.('starter') : null}\n </Stack>\n ) : choosing ? (\n <Stack spacing={2}>\n <Box\n data-start-area=\"choose-cards\"\n sx={{\n display: 'grid',\n gridTemplateColumns: showsImport ? { xs: '1fr', sm: '1fr 1fr', md: '1fr 1fr 1fr' } : { xs: '1fr', sm: '1fr 1fr' },\n gap: 3,\n }}\n >\n <ChoiceCard\n accent=\"secondary\"\n icon={mdiPageLayoutHeaderFooter.path}\n iconId=\"page-layout-header-footer\"\n title={starterInShell ? 'Start from a starter site' : 'Start from the starter site'}\n description={\n starterInShell\n ? 'A ready-made website from the marketplace, in a style you choose.'\n : 'A ready-made home page with a header, footer and contact form, in a style you choose.'\n }\n busy={startingStarter}\n onChoose={chooseStarter}\n />\n <ChoiceCard\n accent=\"primary\"\n icon={mdiCreation.path}\n iconId=\"creation\"\n title=\"Start with AI\"\n description={`Answer a few questions and ${PLATFORM_BRAND_NAME} AI plans your pages.`}\n onChoose={chooseAi}\n >\n <Chip size=\"small\" color=\"primary\" label=\"Recommended\" />\n {freeTaste && (\n <Typography variant=\"caption\" color=\"text.secondary\">\n {`Up to ${AI_SITE_FREE_PAGES.max} pages on the Free plan`}\n </Typography>\n )}\n </ChoiceCard>\n {showsImport && (\n <ChoiceCard\n accent=\"secondary\"\n icon={mdiWebSync.path}\n iconId=\"web-sync\"\n title=\"Bring my site\"\n description={`Bring the website you have now into ${PLATFORM_BRAND_NAME}: every word as you wrote it, laid out as your pages are, in your new site’s preview.`}\n blocked={importAvailability.state === 'blocked' ? importAvailability.message : null}\n onChoose={chooseImport}\n >\n {importAvailability.state === 'blocked' && importAvailability.reason === 'plan' ? (\n <Chip size=\"small\" variant=\"outlined\" label=\"Paid plans\" />\n ) : null}\n </ChoiceCard>\n )}\n </Box>\n {importAvailability.state === 'blocked' ? (\n <PrerequisiteNotice\n {...(importAvailability.reason === 'plan' && orgSlug\n ? { href: aiCreditsBillingHref(orgSlug), actionLabel: 'Upgrade' }\n : {})}\n >\n {importAvailability.message}\n </PrerequisiteNotice>\n ) : null}\n </Stack>\n ) : started && orgId ? (\n <Card variant=\"outlined\" sx={{ borderRadius: 2, p: { xs: 2, sm: 3 } }}>\n <AiJobFollow\n job={started}\n orgId={orgId}\n orgSlug={orgSlug}\n user={user}\n intro={\n 'Your site is being planned. It is then built and published for you, with ' +\n 'nothing to approve. You can edit or unpublish it afterwards.'\n }\n // Full screen: AI jobs opens in the panel this dialog covers.\n onOpenJobs={exit}\n />\n </Card>\n ) : (\n <Box component=\"section\">\n {step === 'kind' && <KindStep {...stepProps} />}\n {step === 'audience' && <AudienceStep {...stepProps} />}\n {step === 'style' && (\n <StyleStep\n {...stepProps}\n inspiration={\n siteInspiration\n ? { limit: aiSiteInspirationLimit(freeTaste), upgradeHref: orgSlug ? aiCreditsBillingHref(orgSlug) : null }\n : null\n }\n />\n )}\n {step === 'details' && <DetailsStep {...stepProps} freeTaste={freeTaste} band={band} />}\n {/* Each question step's optional extras, collapsed, after its own answers (AGL-3979). */}\n {step !== 'review' && (\n <Box sx={{ mt: 3 }}>\n <MoreDetails key={step} step={step} {...stepProps} />\n </Box>\n )}\n {step === 'review' && (\n <ReviewStep answers={answers} freeTaste={freeTaste} onEdit={edit} inspiration={siteInspiration}>\n {clientIntake && (\n <Alert severity=\"info\" variant=\"outlined\" data-start-area=\"client-intake\">\n {aiSiteStartClientNote(clientIntake)}\n </Alert>\n )}\n {!noneLeft && prompt && (\n <AiCreditsPromptNotice\n prompt={prompt}\n noun=\"site\"\n orgSlug={orgSlug}\n busy={busy}\n onBuildWhatFits={() => void plan({ creditsConfirmed: true })}\n onSmaller={() => void plan({ creditsConfirmed: true, pages: 1 })}\n />\n )}\n </ReviewStep>\n )}\n </Box>\n )}\n </Stack>\n </Container>\n </DialogContent>\n {stylingStarter && (\n /* The starter's style view (AGL-4049): Create site waits for a style. */\n <DialogActions\n data-start-area=\"footer\"\n sx={{\n px: { xs: 2, sm: 3 },\n py: 2,\n flexWrap: 'wrap',\n rowGap: 1,\n columnGap: 2,\n borderTop: 1,\n borderColor: 'divider',\n ...AI_SITE_START_SURFACE_SX,\n }}\n >\n <Button onClick={() => setPickingStyle(false)} disabled={startingStarter} sx={{ mr: 'auto' }}>\n {'Back'}\n </Button>\n {starterStyle ? null : (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Choose a style to continue.'}\n </Typography>\n )}\n <Button\n variant=\"contained\"\n size=\"large\"\n disabled={!starterStyle || startingStarter}\n onClick={createStarter}\n >\n {startingStarter ? (creating ? 'Creating…' : 'Starting…') : creating ? 'Create site' : 'Use this style'}\n </Button>\n </DialogActions>\n )}\n {asking && (\n /* The footer stays put while the questions scroll. It wraps, because\n the estimate, the reason and the buttons are wider than a phone. */\n <DialogActions\n data-start-area=\"footer\"\n sx={{\n px: { xs: 2, sm: 3 },\n py: 2,\n flexWrap: 'wrap',\n rowGap: 1,\n columnGap: 2,\n borderTop: 1,\n borderColor: 'divider',\n ...AI_SITE_START_SURFACE_SX,\n }}\n >\n {reviewing && (\n <Stack direction=\"row\" spacing={0.5} sx={{ alignItems: 'center', mr: 'auto', minWidth: 0 }}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {`${estimateText}.`}\n </Typography>\n <HelpTip {...START_HELP.estimate} ariaLabel=\"How the estimate works\" />\n </Stack>\n )}\n {reviewing && refusal && (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {refusal}\n </Typography>\n )}\n {reviewing && !freeTaste && <AiModelSelector choice={modelChoice} disabled={busy} />}\n <Button onClick={back} sx={reviewing ? undefined : { mr: 'auto' }}>\n {'Back'}\n </Button>\n {reviewing ? (\n <Button\n variant=\"contained\"\n size=\"large\"\n disabled={busy || Boolean(refusal) || Boolean(prompt) || noneLeft}\n onClick={() => void plan()}\n startIcon={<MdiIcon path={mdiCreation.path} />}\n >\n {busy ? 'Starting…' : 'Plan my site'}\n </Button>\n ) : (\n <Button variant=\"contained\" size=\"large\" onClick={next}>\n {returnTo === 'review' ? 'Back to review' : 'Next'}\n </Button>\n )}\n </DialogActions>\n )}\n <Dialog\n open={confirmingLeave}\n onClose={() => setConfirmingLeave(false)}\n aria-labelledby={`${TITLE_ID}-leave`}\n aria-describedby={`${TITLE_ID}-leave-text`}\n maxWidth=\"xs\"\n >\n <DialogTitle id={`${TITLE_ID}-leave`}>{'Leave without your answers?'}</DialogTitle>\n <DialogContent>\n <DialogContentText id={`${TITLE_ID}-leave-text`}>\n {creating\n ? 'What you typed is not saved, and no site is created.'\n : 'What you typed is not saved. Leaving starts your site from the starter site instead.'}\n </DialogContentText>\n </DialogContent>\n <DialogActions>\n <Button color=\"inherit\" onClick={leaveDraft}>\n {creating ? 'Leave' : 'Leave and start blank'}\n </Button>\n <Button variant=\"contained\" autoFocus onClick={() => setConfirmingLeave(false)}>\n {'Keep editing'}\n </Button>\n </DialogActions>\n </Dialog>\n </Dialog>\n )\n}\n\nexport default AiSiteStartCard\n"],"names":["lockdownRefusalText","parseLockdownRefusal","PLATFORM_BRAND_NAME","trackEvent","ICON_VARIANT_CLOSE","mdiCreation","mdiPageLayoutHeaderFooter","mdiWebSync","pluginDocsHelp","HelpTip","MdiIcon","BlockedControl","OptionCardGrid","PrerequisiteNotice","authorizedFetch","useUser","Alert","AppBar","Box","Button","Card","CardActionArea","Chip","CircularProgress","Container","Dialog","DialogActions","DialogContent","DialogContentText","DialogTitle","IconButton","Stack","Toolbar","Typography","useMediaQuery","alpha","useTheme","useRouter","useCallback","useEffect","useId","useRef","useState","AI_JOB_AUTO_CONFIRM_INPUT","AI_SITE_FREE_PAGES","aiFreeCreditsNoneLeftText","aiFreeCreditsResetLabel","aiFreeSiteCreditRange","aiFreeSitePrompt","aiSiteCreditRange","aiSitePagesBand","FREE_AI_TASTE_CREDITS_PER_MONTH","AI_CREDITS_CONFIRM_CODE","aiCreditRangeText","AiCreditsPromptNotice","AI_SITE_START_ANSWERS","AI_SITE_START_STYLE_REQUIRED","aiSiteStartAnswersFromClientBuild","aiSiteStartBrief","aiSiteStartClientBrief","aiSiteStartClientInputs","aiSiteStartClientNote","aiSiteStartExtrasGiven","aiSiteStartInputs","aiSiteStartKind","aiSiteStartRefusal","aiSiteInspirationLimit","aiSiteStartFieldErrors","aiSiteStartFirstInvalidStep","aiSiteStartNextStep","aiSiteStartPreviousStep","aiSiteStartStepErrors","aiSiteStartStepIndex","AI_SITE_START_STEPS","AI_SITE_START_STEP_FIELDS","aiSiteKindOfInputs","aiSiteStartClickOf","useAiSiteStartTracking","aiSiteStyleCards","AudienceStep","DetailsStep","KindStep","MoreDetails","ReviewStep","StartProgress","StepHelp","StyleStep","AiJobFollow","AiModelSelector","useAiModelChoice","aiCreditsBillingHref","aiSiteBuildHref","publishAiJob","clearAiSiteStartAnswers","readAiSiteStartAnswers","AiSiteImportStart","aiSiteImportOfferOf","TITLE_ID","AI_SITE_START_SURFACE_SX","bgcolor","IconBadge","accent","children","aria-hidden","sx","theme","width","spacing","height","borderRadius","display","alignItems","justifyContent","palette","main","mode","color","fontSize","ChoiceCard","icon","iconId","title","description","busy","blocked","onChoose","id","variant","transition","transitions","create","duration","shorter","borderColor","boxShadow","shadows","transform","Boolean","reason","fullWidth","onClick","disabled","aria-labelledby","aria-describedby","aria-busy","undefined","p","xs","sm","textAlign","size","aria-label","path","data-icon","component","START_HELP","choose","anchor","excerpt","estimate","SectionLabel","help","direction","AiSiteStartCard","hostId","orgId","orgSlug","host","startBlank","leave","pendingSite","chooseStarter","chooseStarterInShell","clientBuild","initialAnswers","modelChoice","data","user","router","userRef","current","uid","verdict","setVerdict","handedOff","clientAnswers","intake","clientIntake","clientBuildRef","reopened","step","setStep","answers","setAnswers","checked","setChecked","Set","returnTo","setReturnTo","headingRef","drawnStep","fieldRefs","compact","breakpoints","down","noSsr","setBusy","startingStarter","setStartingStarter","pickingStyle","setPickingStyle","starterStyle","setStarterStyle","notice","setNotice","started","setStarted","freeTaste","setFreeTaste","siteInspiration","setSiteInspiration","freeCredits","setFreeCredits","confirmingLeave","setConfirmingLeave","dialogRef","pendingRef","creating","created","tracker","importAvailability","setImportAvailability","state","importing","setImporting","active","response","encodeURIComponent","payload","ok","json","catch","credits","Number","isFinite","left","pages","Math","min","max","welcomeEmail","shown","status","siteImport","ready","answer","patch","serverPrompt","setServerPrompt","siteKind","prompt","noneLeft","refusal","style","band","surface","kind","load","loadModels","model","rememberedModel","pickedModel","plan","options","asked","creditsConfirmed","requestJob","siteId","check","method","headers","body","JSON","stringify","brief","filter","join","inputs","inspiration","refused","code","locked","String","error","site","made","address","job","detailsGiven","map","field","find","at","includes","complete","finish","onStarted","href","push","runStartBlank","result","then","done","choice","starterInShell","createStarter","chooseImport","chooseAi","focus","next","errors","length","add","fieldError","target","invalid","back","edit","goBackTo","exitStyle","giveStarter","exit","skip","abandon","dismissTo","drafted","siteType","trim","audience","dirty","dismiss","event","root","Node","contains","closeTo","leaveDraft","modelMultiplier","option","multiplier","scaled","range","likely","round","p90","ceiling","estimateText","toLocaleString","total","resetsOn","showsImport","stylingStarter","choosing","reviewing","asking","fieldErrors","shownErrors","Object","fromEntries","has","stepProps","fieldRef","node","HEADINGS","lede","details","review","heading","onStepKeyDown","key","nativeEvent","isComposing","tagName","type","preventDefault","open","fullScreen","ref","onClose","onClickCapture","click","onKeyDownCapture","activity","onInputCapture","slotProps","paper","elevation","position","enableColorOnDark","data-start-area","borderBottom","gap","edge","noWrap","textOverflow","flex","px","onKeyDown","pt","onStep","maxWidth","disableGutters","py","tabIndex","outline","float","severity","action","fields","previewControl","onBack","label","columns","md","value","onChange","fieldPicked","gridTemplateColumns","message","actionLabel","intro","onOpenJobs","limit","upgradeHref","mt","onEdit","noun","onBuildWhatFits","onSmaller","flexWrap","rowGap","columnGap","borderTop","mr","minWidth","ariaLabel","startIcon","autoFocus"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;AAEA,SAASA,mBAAmB,EAAEC,oBAAoB,EAAEC,mBAAmB,QAAQ,eAAc;AAC7F,SAASC,UAAU,QAAQ,0CAAyC;AAEpE,SAASC,kBAAkB,QAAQ,2BAA0B;AAC7D,SAASC,WAAW,EAAEC,yBAAyB,EAAEC,UAAU,QAAQ,yBAAwB;AAC3F,SAASC,cAAc,QAAQ,mCAAkC;AACjE,SAASC,OAAO,EAAE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,KAAChN;gCAAO4G,SAAQ;gCAAYgU,SAAS;gCAACnT,SAAS,IAAMoF,mBAAmB;0CACrE;;;;;;;;AAMb;AAEA,eAAe7D,gBAAe"}
@@ -18,6 +18,7 @@ import { type ReactNode, type Ref } from 'react';
18
18
  import { type AiSiteStartAnswers } from '../model/ai-site-start';
19
19
  import { type AiSiteStartField, type AiSiteStartFieldError, type AiSiteStartStep } from '../model/ai-site-start-steps';
20
20
  import type { AiSiteStartTracker } from './ai-site-start-tracking';
21
+ import { aiSiteStylePreview } from './ai-site-style-previews';
21
22
  /**
22
23
  * The guided start's question steps (AGL-3898), one decision each. Each step
23
24
  * draws its own answers and writes them through `answer`, exactly the patch
@@ -62,6 +63,16 @@ export declare const START_STEP_HELP: {
62
63
  export declare function startTypeTitle(type: string): string;
63
64
  /** The id the style grid gives "Pick for me", which is no kind: the answers' `kind: null`. */
64
65
  export declare const AI_SITE_STYLE_AUTO = "auto";
66
+ /**
67
+ * The 21 style cards, each with its example home page (AGL-3898), as the
68
+ * Style step and the starter site's style choice (AGL-4049) both draw them.
69
+ */
70
+ export declare function aiSiteStyleCards(): Array<{
71
+ id: string;
72
+ title: string;
73
+ description: string;
74
+ image?: NonNullable<ReturnType<typeof aiSiteStylePreview>>;
75
+ }>;
65
76
  /**
66
77
  * The progress through the steps: labeled steps on a wide screen, a bar and
67
78
  * "Step 3 of 6" on a phone. On a wide screen a step already answered is a
@@ -87,9 +98,10 @@ export declare function KindStep({ answers, answer, tracker, errors, fieldRef }:
87
98
  /** Step: who the site is for. Optional. */
88
99
  export declare function AudienceStep({ answers, answer, tracker, errors, fieldRef }: StepProps): import("react").JSX.Element;
89
100
  /**
90
- * Step: the style, from cards that show it. "Pick for me" leaves the kind
91
- * unset, which is what the single form's unpicked state was: the kind the
92
- * first answer suggests is the one used, and the card says which.
101
+ * Step: the style, from cards that show it. Nothing is chosen until a card is
102
+ * clicked (AGL-4049), and the step does not go forward before one is. "Pick
103
+ * for me" is a card too: it leaves the kind unset, so the kind the first
104
+ * answer suggests is the one used, and the card says which.
93
105
  */
94
106
  export declare function StyleStep({ answers, answer, tracker, errors, fieldRef, inspiration, }: StepProps & {
95
107
  inspiration?: AiSiteStartInspirationOffer | null;
@@ -24,13 +24,14 @@ import { OptionCardGrid } from "@aglyn/shared-ui-jsx/components/option-card-grid
24
24
  import { BlockedControl } from "@aglyn/shared-ui-jsx/components/blocked-control.component";
25
25
  import { PrerequisiteNotice } from "@aglyn/shared-ui-jsx/components/prerequisite-notice.component";
26
26
  import { OpeningHoursPicker } from "@aglyn/shared-ui-jsx/components/weekly-hours-picker.component";
27
- import { Accordion, AccordionDetails, AccordionSummary, Box, Divider, LinearProgress, List, ListItemButton, MenuItem, Stack, Step, StepButton, StepLabel, Stepper, TextField, Tooltip, Typography } from "@mui/material";
27
+ import { Accordion, AccordionDetails, AccordionSummary, Box, Divider, FormHelperText, LinearProgress, List, ListItemButton, MenuItem, Stack, Step, StepButton, StepLabel, Stepper, TextField, Tooltip, Typography } from "@mui/material";
28
28
  import { Fragment, useId, useState } from "react";
29
29
  import { aiSiteHoursSentence, aiSiteServiceAreas, aiSiteSocialLinks } from "../model/ai-site-details.js";
30
30
  import { AI_SITE_FREE_PAGES_NOTE, AI_SITE_SUBMISSION_CHOICES } from "../model/ai-site-job.js";
31
31
  import { AI_SITE_KINDS } from "../model/ai-site-kinds.js";
32
32
  import { AI_SITE_INSPIRATION_LIMITS, AI_SITE_INSPIRATION_MAX, AI_SITE_INSPIRATION_PAID_NOTE, aiSiteInspirationHost } from "../model/ai-site-inspiration.js";
33
- import { AI_SITE_START_TYPES, aiSiteStartInspirationTyped, aiSiteStartKind } from "../model/ai-site-start.js";
33
+ import { SITE_STYLE_AUTO } from "@aglyn/aglyn/app-utils/site-styles";
34
+ import { AI_SITE_START_TYPES, aiSiteStartInspirationTyped, aiSiteStartKind, aiSiteStartStyleAnswer } from "../model/ai-site-start.js";
34
35
  import { AI_SITE_START_MORE_FIELDS, AI_SITE_START_STEP_LABELS, AI_SITE_START_STEPS, aiSiteStartStepIndex } from "../model/ai-site-start-steps.js";
35
36
  import { aiSiteStylePreview } from "./ai-site-style-previews.js";
36
37
  /**
@@ -75,7 +76,22 @@ import { aiSiteStylePreview } from "./ai-site-style-previews.js";
75
76
  const words = type.replace(/^(a|an)\s+/i, '');
76
77
  return words.charAt(0).toUpperCase() + words.slice(1);
77
78
  }
78
- /** The id the style grid gives "Pick for me", which is no kind: the answers' `kind: null`. */ export const AI_SITE_STYLE_AUTO = 'auto';
79
+ /** The id the style grid gives "Pick for me", which is no kind: the answers' `kind: null`. */ export const AI_SITE_STYLE_AUTO = SITE_STYLE_AUTO;
80
+ /**
81
+ * The 21 style cards, each with its example home page (AGL-3898), as the
82
+ * Style step and the starter site's style choice (AGL-4049) both draw them.
83
+ */ export function aiSiteStyleCards() {
84
+ return AI_SITE_KINDS.map((kind)=>{
85
+ const image = aiSiteStylePreview(kind.id);
86
+ return _extends({
87
+ id: kind.id,
88
+ title: kind.label,
89
+ description: kind.blurb
90
+ }, image ? {
91
+ image
92
+ } : {});
93
+ });
94
+ }
79
95
  /**
80
96
  * The progress through the steps: labeled steps on a wide screen, a bar and
81
97
  * "Step 3 of 6" on a phone. On a wide screen a step already answered is a
@@ -213,11 +229,11 @@ import { aiSiteStylePreview } from "./ai-site-style-previews.js";
213
229
  });
214
230
  }
215
231
  /**
216
- * Step: the style, from cards that show it. "Pick for me" leaves the kind
217
- * unset, which is what the single form's unpicked state was: the kind the
218
- * first answer suggests is the one used, and the card says which.
232
+ * Step: the style, from cards that show it. Nothing is chosen until a card is
233
+ * clicked (AGL-4049), and the step does not go forward before one is. "Pick
234
+ * for me" is a card too: it leaves the kind unset, so the kind the first
235
+ * answer suggests is the one used, and the card says which.
219
236
  */ export function StyleStep({ answers, answer, tracker, errors, fieldRef, inspiration }) {
220
- var _answers_kind;
221
237
  const suggested = aiSiteStartKind(_extends({}, answers, {
222
238
  kind: null
223
239
  }));
@@ -236,30 +252,31 @@ import { aiSiteStylePreview } from "./ai-site-style-previews.js";
236
252
  description: `From your answer: ${suggested.label}`,
237
253
  icon: mdiCreation.path
238
254
  },
239
- ...AI_SITE_KINDS.map((kind)=>{
240
- const image = aiSiteStylePreview(kind.id);
241
- return _extends({
242
- id: kind.id,
243
- title: kind.label,
244
- description: kind.blurb
245
- }, image ? {
246
- image
247
- } : {});
248
- })
255
+ ...aiSiteStyleCards()
249
256
  ],
250
- value: (_answers_kind = answers.kind) != null ? _answers_kind : AI_SITE_STYLE_AUTO,
257
+ value: answers.style,
251
258
  onChange: (id)=>{
252
- answer({
253
- kind: id === AI_SITE_STYLE_AUTO ? null : id
254
- });
255
- tracker.fieldPicked('kind');
259
+ answer(aiSiteStartStyleAnswer(id));
260
+ tracker.fieldPicked('style');
256
261
  }
257
262
  });
258
- if (!inspiration) return cards;
263
+ const chosen = /*#__PURE__*/ _jsxs(Stack, {
264
+ spacing: 1,
265
+ "data-start-area": "field-style",
266
+ children: [
267
+ cards,
268
+ errors.style ? /*#__PURE__*/ _jsx(FormHelperText, {
269
+ error: true,
270
+ role: "alert",
271
+ children: errors.style.message
272
+ }) : null
273
+ ]
274
+ });
275
+ if (!inspiration) return chosen;
259
276
  return /*#__PURE__*/ _jsxs(Stack, {
260
277
  spacing: 4,
261
278
  children: [
262
- cards,
279
+ chosen,
263
280
  /*#__PURE__*/ _jsx(InspirationFields, {
264
281
  answers: answers,
265
282
  answer: answer,
@@ -1049,7 +1066,7 @@ import { aiSiteStylePreview } from "./ai-site-style-previews.js";
1049
1066
  },
1050
1067
  {
1051
1068
  label: 'Style',
1052
- value: answers.kind ? kind.label : `${kind.label}, picked for you`,
1069
+ value: answers.style === null ? 'Not chosen yet' : answers.kind ? kind.label : `${kind.label}, picked for you`,
1053
1070
  step: 'style'
1054
1071
  },
1055
1072
  ...inspiration ? [