@aglyn/plugins-ai 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/package.json +17 -17
  2. package/src/lib/components/ai-site-start-card.component.d.ts +1 -1
  3. package/src/lib/components/ai-site-start-card.component.js +40 -13
  4. package/src/lib/components/ai-site-start-card.component.js.map +1 -1
  5. package/src/lib/components/ai-site-start-steps.component.d.ts +17 -1
  6. package/src/lib/components/ai-site-start-steps.component.js +30 -7
  7. package/src/lib/components/ai-site-start-steps.component.js.map +1 -1
  8. package/src/lib/components/assist-panel.component.js +8 -12
  9. package/src/lib/components/assist-panel.component.js.map +1 -1
  10. package/src/lib/jobs/ai-job-drafts.d.ts +3 -0
  11. package/src/lib/jobs/ai-job-drafts.js +5 -0
  12. package/src/lib/jobs/ai-job-drafts.js.map +1 -1
  13. package/src/lib/jobs/ai-job-layout-language.d.ts +10 -0
  14. package/src/lib/jobs/ai-job-layout-language.js +38 -2
  15. package/src/lib/jobs/ai-job-layout-language.js.map +1 -1
  16. package/src/lib/jobs/ai-job-layout-step.js +3 -3
  17. package/src/lib/jobs/ai-job-layout-step.js.map +1 -1
  18. package/src/lib/jobs/ai-site-import-compile.js +15 -7
  19. package/src/lib/jobs/ai-site-import-compile.js.map +1 -1
  20. package/src/lib/layout-language/ai-layout-compiler.js +39 -1
  21. package/src/lib/layout-language/ai-layout-compiler.js.map +1 -1
  22. package/src/lib/layout-language/ai-layout-frame.d.ts +6 -0
  23. package/src/lib/layout-language/ai-layout-frame.js +85 -30
  24. package/src/lib/layout-language/ai-layout-frame.js.map +1 -1
  25. package/src/lib/layout-language/ai-layout-language.d.ts +5 -0
  26. package/src/lib/layout-language/ai-layout-language.js.map +1 -1
  27. package/src/lib/model/ai-site-import-fidelity.d.ts +175 -0
  28. package/src/lib/model/ai-site-import-fidelity.js +941 -0
  29. package/src/lib/model/ai-site-import-fidelity.js.map +1 -0
  30. package/src/lib/model/ai-site-start.d.ts +27 -0
  31. package/src/lib/model/ai-site-start.js +41 -0
  32. package/src/lib/model/ai-site-start.js.map +1 -1
  33. package/src/lib/model/assist-page-change.d.ts +26 -6
  34. package/src/lib/model/assist-page-change.js +32 -10
  35. package/src/lib/model/assist-page-change.js.map +1 -1
  36. package/src/lib/runtime/ai-node-tree.js +18 -2
  37. package/src/lib/runtime/ai-node-tree.js.map +1 -1
  38. package/src/lib/server/assist-chat.d.ts +5 -0
  39. package/src/lib/server/assist-chat.js +11 -2
  40. package/src/lib/server/assist-chat.js.map +1 -1
  41. package/src/lib/server/assist-page-change.d.ts +12 -0
  42. package/src/lib/server/assist-page-change.js +23 -1
  43. package/src/lib/server/assist-page-change.js.map +1 -1
  44. package/src/lib/site-import/fixtures/site-import-fidelity-replay.d.ts +62 -0
  45. package/src/lib/site-import/fixtures/site-import-fidelity-replay.js +374 -0
  46. package/src/lib/site-import/fixtures/site-import-fidelity-replay.js.map +1 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/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;AA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AC;sCAC5CkI,WACG,yDACA;;;kCAGR,MAACzM;;0CACC,KAACP;gCAAOiG,OAAM;gCAAUwB,SAAS8M;0CAC9BvH,WAAW,UAAU;;0CAExB,KAAChN;gCAAO4G,SAAQ;gCAAYgU,SAAS;gCAACnT,SAAS,IAAMoF,mBAAmB;0CACrE;;;;;;;;AAMb;AAEA,eAAe7D,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 aiSiteStartAnswersFromStarter,\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 starter,\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(() =>\n pendingSite && !initialAnswers && !starter ? readAiSiteStartAnswers() : null,\n )\n // An AI starter picked in \"Choose your starter\" (AGL-4049): its answers\n // fill the questions, read once, and the start opens on the first one.\n // The style it names arrives chosen — the person chose it by picking the\n // starter — and every answer is theirs to change.\n const [starterAnswers] = useState(() =>\n starter && !initialAnswers && !clientBuild ? aiSiteStartAnswersFromStarter(starter.answers) : null,\n )\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(\n initialAnswers !== null || handedOff !== null || clientAnswers !== null || starterAnswers !== null,\n )\n // A start reopened on its answers opens on the review, every answer there\n // to change; one filled in from a starter, on the first question.\n const [step, setStep] = useState<AiSiteStartStep>(\n initialAnswers || clientAnswers ? 'review' : starterAnswers ? 'kind' : 'choose',\n )\n const [answers, setAnswers] = useState<AiSiteStartAnswers>(\n initialAnswers ?? clientAnswers ?? starterAnswers ?? handedOff ?? AI_SITE_START_ANSWERS,\n )\n // The starter the answers came from, for the site to record (AGL-4049),\n // and the style card that says so.\n const starterChoice = starterAnswers && starter ? starter.choice : null\n const pickedStarterStyle =\n starterAnswers?.kind && starter ? { id: starterAnswers.kind, name: starter.displayName } : null\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, and\n // the AI starter they were filled in from, when they were.\n const made = await pendingSite.create(\n asked.style || starterChoice\n ? {\n ...(asked.style ? { style: asked.style } : {}),\n ...(starterChoice ? { starter: starterChoice } : {}),\n }\n : undefined,\n )\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, starterChoice])\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 {/* Where the answers came from (AGL-4049), on the first question. */}\n {step === 'kind' && starter && starterAnswers ? (\n <Alert severity=\"info\" variant=\"outlined\" data-start-area=\"starter-note\" sx={{ mb: 3 }}>\n {`Filled in from ${starter.displayName}. Change any answer you like.`}\n </Alert>\n ) : null}\n {step === 'kind' && <KindStep {...stepProps} />}\n {step === 'audience' && <AudienceStep {...stepProps} />}\n {step === 'style' && (\n <StyleStep\n {...stepProps}\n starterStyle={pickedStarterStyle}\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","aiSiteStartAnswersFromStarter","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","starter","clientBuild","initialAnswers","modelChoice","data","user","router","userRef","current","uid","verdict","setVerdict","handedOff","starterAnswers","answers","clientAnswers","intake","clientIntake","clientBuildRef","reopened","step","setStep","setAnswers","starterChoice","choice","pickedStarterStyle","kind","name","displayName","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","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","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","mb","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,EAAEC,OAAO,QAAQ,uBAAsB;AACvD,OAAOC,oBAAoB,4DAA2D;AACtF,SAASC,cAAc,QAAQ,6DAA4D;AAC3F,SAASC,kBAAkB,QAAQ,gEAA+D;AAClG,SAASC,eAAe,QAAQ,2CAA0C;AAC1E,SAASC,OAAO,QAAQ,iCAAgC;AACxD,SACEC,KAAK,EACLC,MAAM,EACNC,GAAG,EACHC,MAAM,EACNC,IAAI,EACJC,cAAc,EACdC,IAAI,EACJC,gBAAgB,EAChBC,SAAS,EACTC,MAAM,EACNC,aAAa,EACbC,aAAa,EACbC,iBAAiB,EACjBC,WAAW,EACXC,UAAU,EACVC,KAAK,EACLC,OAAO,EACPC,UAAU,EACVC,aAAa,QACR,gBAAe;AACtB,SAASC,KAAK,EAAEC,QAAQ,QAAoB,uBAAsB;AAClE,SAASC,SAAS,QAAQ,kBAAiB;AAC3C,SACEC,WAAW,EACXC,SAAS,EACTC,KAAK,EACLC,MAAM,EACNC,QAAQ,QAKH,QAAO;AACd,SACEC,yBAAyB,EACzBC,kBAAkB,EAClBC,yBAAyB,EACzBC,uBAAuB,EACvBC,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,SAAS,MAAM,CAAC;kCAAG;;kCACvC,KAACvE;kCACC,cAAA,KAACC;4BAAkBmG,IAAI,GAAG7B,SAAS,WAAW,CAAC;sCAC5C0I,WACG,yDACA;;;kCAGR,MAAClN;;0CACC,KAACP;gCAAOkG,OAAM;gCAAUwB,SAASoN;0CAC9BrH,WAAW,UAAU;;0CAExB,KAACzN;gCAAO6G,SAAQ;gCAAYuU,SAAS;gCAAC1T,SAAS,IAAM4F,mBAAmB;0CACrE;;;;;;;;AAMb;AAEA,eAAerE,gBAAe"}
@@ -102,9 +102,17 @@ export declare function AudienceStep({ answers, answer, tracker, errors, fieldRe
102
102
  * clicked (AGL-4049), and the step does not go forward before one is. "Pick
103
103
  * for me" is a card too: it leaves the kind unset, so the kind the first
104
104
  * answer suggests is the one used, and the card says which.
105
+ *
106
+ * Questions filled in from an AI starter arrive with its style chosen, and
107
+ * `starterStyle` names that card: it says which starter it came from, and
108
+ * that it is the person's to change.
105
109
  */
106
- export declare function StyleStep({ answers, answer, tracker, errors, fieldRef, inspiration, }: StepProps & {
110
+ export declare function StyleStep({ answers, answer, tracker, errors, fieldRef, inspiration, starterStyle, }: StepProps & {
107
111
  inspiration?: AiSiteStartInspirationOffer | null;
112
+ starterStyle?: {
113
+ id: string;
114
+ name: string;
115
+ } | null;
108
116
  }): import("react").JSX.Element;
109
117
  /**
110
118
  * What the guided start offers of Sites I like (AGL-3975), while
@@ -135,6 +143,14 @@ export declare const AI_SITE_START_BRAND_COLORS: ReadonlyArray<{
135
143
  label: string;
136
144
  hex: string;
137
145
  }>;
146
+ /**
147
+ * What a brand color the swatches do not name is called (AGL-4049): one an AI
148
+ * starter brought, or a start reopened on its own. Shown as its swatch and by
149
+ * this name, never as a color code.
150
+ */
151
+ export declare const AI_SITE_START_OWN_BRAND_LABEL = "Chosen color";
152
+ /** A brand color's name: a swatch's, else {@link AI_SITE_START_OWN_BRAND_LABEL} for a color code, else as given. */
153
+ export declare function aiSiteStartBrandLabel(brand: string): string;
138
154
  /**
139
155
  * A step's "More details" (AGL-3979): a collapsed section of optional extras
140
156
  * that fit the step, so a person who wants the site to say more can, and one
@@ -233,7 +233,11 @@ import { aiSiteStylePreview } from "./ai-site-style-previews.js";
233
233
  * clicked (AGL-4049), and the step does not go forward before one is. "Pick
234
234
  * for me" is a card too: it leaves the kind unset, so the kind the first
235
235
  * answer suggests is the one used, and the card says which.
236
- */ export function StyleStep({ answers, answer, tracker, errors, fieldRef, inspiration }) {
236
+ *
237
+ * Questions filled in from an AI starter arrive with its style chosen, and
238
+ * `starterStyle` names that card: it says which starter it came from, and
239
+ * that it is the person's to change.
240
+ */ export function StyleStep({ answers, answer, tracker, errors, fieldRef, inspiration, starterStyle = null }) {
237
241
  const suggested = aiSiteStartKind(_extends({}, answers, {
238
242
  kind: null
239
243
  }));
@@ -252,7 +256,9 @@ import { aiSiteStylePreview } from "./ai-site-style-previews.js";
252
256
  description: `From your answer: ${suggested.label}`,
253
257
  icon: mdiCreation.path
254
258
  },
255
- ...aiSiteStyleCards()
259
+ ...aiSiteStyleCards().map((card)=>card.id === (starterStyle == null ? void 0 : starterStyle.id) ? _extends({}, card, {
260
+ description: `From ${starterStyle.name}. Change it if you like.`
261
+ }) : card)
256
262
  ],
257
263
  value: answers.style,
258
264
  onChange: (id)=>{
@@ -674,8 +680,26 @@ import { aiSiteStylePreview } from "./ai-site-style-previews.js";
674
680
  })
675
681
  });
676
682
  }
677
- /** The brand color, picked from named swatches. */ function BrandField({ answers, answer, tracker }) {
683
+ /**
684
+ * What a brand color the swatches do not name is called (AGL-4049): one an AI
685
+ * starter brought, or a start reopened on its own. Shown as its swatch and by
686
+ * this name, never as a color code.
687
+ */ export const AI_SITE_START_OWN_BRAND_LABEL = 'Chosen color';
688
+ /** A brand color's name: a swatch's, else {@link AI_SITE_START_OWN_BRAND_LABEL} for a color code, else as given. */ export function aiSiteStartBrandLabel(brand) {
689
+ const swatch = AI_SITE_START_BRAND_COLORS.find((color)=>color.hex === brand);
690
+ if (swatch) return swatch.label;
691
+ return /^#[0-9a-f]{6}$/i.test(brand) ? AI_SITE_START_OWN_BRAND_LABEL : brand;
692
+ }
693
+ /** The brand color, picked from named swatches, with a color the swatches do not name kept as one more. */ function BrandField({ answers, answer, tracker }) {
678
694
  const labelId = useId();
695
+ const own = aiSiteStartBrandLabel(answers.brand) === AI_SITE_START_OWN_BRAND_LABEL ? answers.brand : null;
696
+ const swatches = own ? [
697
+ ...AI_SITE_START_BRAND_COLORS,
698
+ {
699
+ label: AI_SITE_START_OWN_BRAND_LABEL,
700
+ hex: own
701
+ }
702
+ ] : AI_SITE_START_BRAND_COLORS;
679
703
  return /*#__PURE__*/ _jsxs(Stack, {
680
704
  spacing: 1,
681
705
  "data-start-area": "field-brand",
@@ -699,7 +723,7 @@ import { aiSiteStylePreview } from "./ai-site-style-previews.js";
699
723
  label: 'Let the style choose',
700
724
  hex: ''
701
725
  },
702
- ...AI_SITE_START_BRAND_COLORS
726
+ ...swatches
703
727
  ].map((color)=>{
704
728
  const picked = (answers.brand || '') === color.hex;
705
729
  return /*#__PURE__*/ _jsx(Tooltip, {
@@ -954,7 +978,7 @@ import { aiSiteStylePreview } from "./ai-site-style-previews.js";
954
978
  });
955
979
  }
956
980
  /** The extras on the review, each as a person reads it, with the step that asks it. */ export function aiSiteStartExtraRows(answers) {
957
- var _ref, _aiSiteSocialLinks;
981
+ var _aiSiteSocialLinks;
958
982
  const rows = [];
959
983
  const add = (label, value, step)=>{
960
984
  if (value.trim()) rows.push({
@@ -970,8 +994,7 @@ import { aiSiteStylePreview } from "./ai-site-style-previews.js";
970
994
  add('Areas you serve', aiSiteServiceAreas(answers.serviceArea).join(', '), 'audience');
971
995
  add('Price range', answers.priceRange, 'audience');
972
996
  add('Languages', answers.languages, 'audience');
973
- const brand = AI_SITE_START_BRAND_COLORS.find((color)=>color.hex === answers.brand);
974
- add('Brand color', (_ref = brand == null ? void 0 : brand.label) != null ? _ref : answers.brand, 'style');
997
+ add('Brand color', answers.brand ? aiSiteStartBrandLabel(answers.brand) : '', 'style');
975
998
  const regional = [
976
999
  answers.region,
977
1000
  answers.postalCode