{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "multi-step-checkout-block",
  "title": "Multi-step Checkout Block",
  "description": "A four-step checkout in one card: a stepper whose connectors fill as you go, contact and address with country-aware postcode checks, delivery options, card payment with brand detection and a Luhn check, a review with edit links, then a placing-order state and a success screen, next to an order summary with tax.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/multi-step-checkout-block/multi-step-checkout-block.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport interface CheckoutLine {\n  name: string;\n  variant?: string;\n  price: number;\n  qty: number;\n  image: string;\n}\nexport interface CheckoutResult {\n  contact: { email: string; name: string; address: string; city: string; zip: string; country: string };\n  delivery: string;\n  /** Only the last four digits ever leave the form. */\n  card: { last4: string; brand: string | null; save: boolean };\n  total: number;\n}\n\nexport interface MultiStepCheckoutBlockProps {\n  lines?: CheckoutLine[];\n  currency?: string;\n  /** Sales tax as a fraction of the subtotal (0.08 = 8%). */\n  taxRate?: number;\n  deliveryOptions?: { id: string; label: string; eta: string; price: number }[];\n  /** Resolve to show success; reject to show an error on the review step. */\n  onComplete?: (result: CheckoutResult) => Promise<void> | void;\n  theme?: \"dark\" | \"light\";\n  className?: string;\n}\n\nconst PALETTES = {\n  dark: {\n    bg: \"#0A0A0A\",\n    card: \"#141414\",\n    side: \"#101010\",\n    title: \"#FFFFFF\",\n    muted: \"rgba(255,255,255,0.45)\",\n    body: \"rgba(255,255,255,0.62)\",\n    line: \"rgba(255,255,255,0.12)\",\n    tile: \"#F1F1F1\",\n    accent: \"#7CDE6A\",\n    accentText: \"#0B1A08\",\n    danger: \"#FF8A7A\",\n    buttonBg: \"#FFFFFF\",\n    buttonText: \"#111111\",\n    ghost: \"rgba(255,255,255,0.07)\",\n    ring: \"rgba(255,255,255,0.55)\",\n    field: \"#0D0D0D\",\n  },\n  light: {\n    bg: \"#FFFFFF\",\n    card: \"#FFFFFF\",\n    side: \"#F7F7F7\",\n    title: \"#111111\",\n    muted: \"rgba(0,0,0,0.45)\",\n    body: \"rgba(0,0,0,0.62)\",\n    line: \"rgba(0,0,0,0.1)\",\n    tile: \"#F1F1F1\",\n    accent: \"#2F9E44\",\n    accentText: \"#FFFFFF\",\n    danger: \"#C0392B\",\n    buttonBg: \"#111111\",\n    buttonText: \"#FFFFFF\",\n    ghost: \"rgba(0,0,0,0.05)\",\n    ring: \"rgba(0,0,0,0.45)\",\n    field: \"#FFFFFF\",\n  },\n};\n\nconst LINES: CheckoutLine[] = [\n  { name: \"Minimal Watch\", variant: \"Black · 38 mm\", price: 79, qty: 1, image: \"/demo/minimal-watch.webp\" },\n  { name: \"Laptop Stand\", variant: \"Silver\", price: 49, qty: 1, image: \"/demo/laptop-stand.webp\" },\n];\nconst DELIVERY = [\n  { id: \"standard\", label: \"Standard\", eta: \"Thu, Nov 12 – Mon, Nov 16\", price: 0 },\n  { id: \"express\", label: \"Express\", eta: \"Tomorrow, Fri Nov 6\", price: 14 },\n  { id: \"pickup\", label: \"Pick up in store\", eta: \"Ready Sat · 120 Market St\", price: 0 },\n];\nconst STEPS = [\"Contact\", \"Delivery\", \"Payment\", \"Review\"];\nconst COUNTRIES = [\"United States\", \"Canada\", \"United Kingdom\"];\nconst ZIP: Record<string, RegExp> = { \"United States\": /^\\d{5}(-\\d{4})?$/, Canada: /^[A-Za-z]\\d[A-Za-z] ?\\d[A-Za-z]\\d$/, \"United Kingdom\": /^[A-Za-z]{1,2}\\d[A-Za-z\\d]? ?\\d[A-Za-z]{2}$/ };\n\nconst money = (n: number, c: string) => `${c}${n.toFixed(2)}`;\nconst brandOf = (d: string) => (/^4/.test(d) ? \"Visa\" : /^(5[1-5]|2[2-7])/.test(d) ? \"Mastercard\" : /^3[47]/.test(d) ? \"Amex\" : null);\nconst luhn = (d: string) => {\n  let s = 0;\n  for (let i = 0; i < d.length; i++) {\n    let n = Number(d[d.length - 1 - i]);\n    if (i % 2) n = n * 2 > 9 ? n * 2 - 9 : n * 2;\n    s += n;\n  }\n  return d.length >= 13 && s % 10 === 0;\n};\n\nexport function MultiStepCheckoutBlock({ lines = LINES, currency = \"$\", taxRate = 0.08, deliveryOptions = DELIVERY, onComplete, theme = \"dark\", className }: MultiStepCheckoutBlockProps) {\n  const p = PALETTES[theme];\n  const reduce = !!useReducedMotion();\n  const uid = React.useId();\n  const [step, setStep] = React.useState(0);\n  const [reached, setReached] = React.useState(0);\n  const [dir, setDir] = React.useState(1);\n  const [tried, setTried] = React.useState<boolean[]>([false, false, false, false]);\n  const [c, setC] = React.useState({ email: \"maya.chen@example.com\", name: \"Maya Chen\", address: \"418 Alder St\", city: \"Portland\", zip: \"\", country: \"United States\" });\n  const [delivery, setDelivery] = React.useState(deliveryOptions[0].id);\n  const [card, setCard] = React.useState({ number: \"\", exp: \"\", cvc: \"\", name: \"\", save: true });\n  const [state, setState] = React.useState<\"form\" | \"busy\" | \"done\" | \"error\">(\"form\");\n  const [summaryOpen, setSummaryOpen] = React.useState(false);\n  const headRef = React.useRef<HTMLHeadingElement>(null);\n\n  const subtotal = lines.reduce((t, l) => t + l.price * l.qty, 0);\n  const ship = deliveryOptions.find((d) => d.id === delivery)!;\n  const tax = Math.round(subtotal * taxRate * 100) / 100;\n  const total = subtotal + ship.price + tax;\n  const digits = card.number.replace(/\\D/g, \"\");\n  const brand = brandOf(digits);\n\n  const contactErr: Partial<Record<keyof typeof c, string>> = {};\n  if (!/^[^\\s@]+@[^\\s@]+\\.[a-z]{2,}$/i.test(c.email.trim())) contactErr.email = \"Enter an email like you@example.com\";\n  if (c.name.trim().split(/\\s+/).length < 2) contactErr.name = \"First and last name\";\n  if (c.address.trim().length < 4) contactErr.address = \"Street and number\";\n  if (!c.city.trim()) contactErr.city = \"Enter a city\";\n  if (!ZIP[c.country].test(c.zip.trim())) contactErr.zip = c.country === \"United States\" ? \"5 digits, like 97209\" : c.country === \"Canada\" ? \"Like K1A 0B1\" : \"Like E2 7DJ\";\n  const [mm, yy] = card.exp.split(\"/\").map(Number);\n  const cardErr: Partial<Record<\"number\" | \"exp\" | \"cvc\" | \"name\", string>> = {};\n  if (!luhn(digits)) cardErr.number = digits.length < 13 ? \"Enter the full card number\" : \"Check the card number\";\n  if (!mm || mm > 12 || !yy || yy < 26 || (yy === 26 && mm < 11)) cardErr.exp = card.exp.length < 5 ? \"MM/YY\" : \"This card has expired\";\n  if (!/^\\d{3,4}$/.test(card.cvc)) cardErr.cvc = \"3 or 4 digits\";\n  if (card.name.trim().length < 2) cardErr.name = \"As printed on the card\";\n  const valid = [Object.keys(contactErr).length === 0, true, Object.keys(cardErr).length === 0, true];\n\n  const go = (to: number) => {\n    setDir(to > step ? 1 : -1);\n    setStep(to);\n    setReached((r) => Math.max(r, to));\n    setTimeout(() => headRef.current?.focus({ preventScroll: true }), 260);\n  };\n  const next = async () => {\n    setTried((t) => t.map((x, i) => (i === step ? true : x)));\n    if (!valid[step]) return;\n    if (step < 3) return go(step + 1);\n    setState(\"busy\");\n    try {\n      await Promise.all([onComplete?.({ contact: c, delivery, card: { last4: digits.slice(-4), brand, save: card.save }, total }), new Promise((r) => setTimeout(r, 1400))]);\n      setState(\"done\");\n    } catch {\n      setState(\"error\");\n    }\n  };\n\n  const focus = \"outline-none focus-visible:ring-2 focus-visible:ring-offset-2\";\n  const fieldCls = cn(\"h-11 w-full rounded-xl border px-3.5 text-[16px] sm:text-[14px]\", focus);\n  const fieldStyle = (bad: boolean) => ({ background: p.field, borderColor: bad ? p.danger : p.line, color: p.title });\n\n  return (\n    <section aria-labelledby={`${uid}-h`} className={cn(\"relative w-full px-4 py-10 sm:px-8\", className)} style={{ background: p.bg, color: p.title, \"--tw-ring-color\": p.ring, \"--tw-ring-offset-color\": p.card } as React.CSSProperties}>\n      <div className=\"mx-auto grid max-w-5xl grid-cols-1 overflow-hidden rounded-3xl border lg:grid-cols-[minmax(0,1fr)_320px]\" style={{ background: p.card, borderColor: p.line }}>\n        <div className=\"min-w-0 p-5 sm:p-8\">\n          <h2 id={`${uid}-h`} className=\"sr-only\">\n            Checkout\n          </h2>\n          {/* Stepper */}\n          <ol className=\"m-0 flex list-none items-center p-0\" aria-label=\"Checkout steps\">\n            {STEPS.map((s, i) => {\n              const done = i < step || state === \"done\";\n              const can = i <= reached && i !== step && state === \"form\";\n              return (\n                <li key={s} className={cn(\"flex items-center\", i < STEPS.length - 1 && \"flex-1\")}>\n                  <button\n                    type=\"button\"\n                    disabled={!can}\n                    onClick={() => go(i)}\n                    aria-current={i === step ? \"step\" : undefined}\n                    className={cn(\"flex items-center gap-2 rounded-full border-0 bg-transparent p-0 text-[13px] font-medium\", can ? \"cursor-pointer\" : \"cursor-default\", focus)}\n                    style={{ color: i <= step ? p.title : p.muted }}\n                  >\n                    <motion.span\n                      className=\"flex h-7 w-7 shrink-0 items-center justify-center rounded-full border text-[12px]\"\n                      initial={false}\n                      animate={{ backgroundColor: done ? p.accent : i === step ? p.buttonBg : \"rgba(0,0,0,0)\", borderColor: done ? p.accent : i === step ? p.buttonBg : p.line, color: done ? p.accentText : i === step ? p.buttonText : p.muted }}\n                      transition={{ duration: reduce ? 0 : 0.25 }}\n                    >\n                      {done ? \"✓\" : i + 1}\n                    </motion.span>\n                    <span className={i === step ? \"\" : \"hidden sm:inline\"}>{s}</span>\n                  </button>\n                  {i < STEPS.length - 1 && (\n                    <span className=\"mx-2 h-[2px] flex-1 overflow-hidden rounded-full sm:mx-3\" style={{ background: p.line }} aria-hidden=\"true\">\n                      <motion.span className=\"block h-full\" style={{ background: p.accent }} initial={false} animate={{ width: i < step || state === \"done\" ? \"100%\" : \"0%\" }} transition={{ duration: reduce ? 0 : 0.4 }} />\n                    </span>\n                  )}\n                </li>\n              );\n            })}\n          </ol>\n\n          <div className=\"relative mt-8 min-h-[360px]\">\n            <AnimatePresence mode=\"wait\" initial={false} custom={dir}>\n              {state === \"done\" ? (\n                <motion.div key=\"done\" initial={reduce ? false : { opacity: 0, y: 12 }} animate={{ opacity: 1, y: 0 }} className=\"flex flex-col items-center py-10 text-center\" role=\"status\">\n                  <motion.span\n                    initial={reduce ? false : { scale: 0, rotate: -30 }}\n                    animate={{ scale: 1, rotate: 0 }}\n                    transition={{ type: \"spring\", stiffness: 300, damping: 15 }}\n                    className=\"flex h-16 w-16 items-center justify-center rounded-full text-[28px]\"\n                    style={{ background: p.accent, color: p.accentText }}\n                  >\n                    ✓\n                  </motion.span>\n                  <h3 ref={headRef} tabIndex={-1} className=\"m-0 mt-5 text-[24px] font-semibold tracking-[-0.02em] outline-none\">\n                    Order NL-20419 placed\n                  </h3>\n                  <p className=\"m-0 mt-2 max-w-sm text-[14px]\" style={{ color: p.body }}>\n                    {money(total, currency)} charged to {brand ?? \"card\"} ···· {digits.slice(-4)}. {ship.label}: {ship.eta}. A receipt is on its way to {c.email}.\n                  </p>\n                </motion.div>\n              ) : (\n                <motion.div key={step} custom={dir} initial={reduce ? false : { opacity: 0, x: dir * 32 }} animate={{ opacity: 1, x: 0 }} exit={reduce ? undefined : { opacity: 0, x: dir * -32 }} transition={{ duration: 0.22 }}>\n                  <h3 ref={headRef} tabIndex={-1} className=\"m-0 text-[20px] font-semibold tracking-[-0.01em] outline-none\">\n                    {[\"Where should we send it?\", \"How fast?\", \"Pay securely\", \"Check and place your order\"][step]}\n                  </h3>\n\n                  {step === 0 && (\n                    <div className=\"mt-5 grid grid-cols-1 gap-3.5 sm:grid-cols-2\">\n                      {(\n                        [\n                          [\"email\", \"Email\", \"email\", true],\n                          [\"name\", \"Full name\", \"name\", true],\n                          [\"address\", \"Address\", \"street-address\", true],\n                          [\"city\", \"City\", \"address-level2\", false],\n                          [\"zip\", c.country === \"United States\" ? \"ZIP code\" : \"Postcode\", \"postal-code\", false],\n                        ] as const\n                      ).map(([k, label, ac, span]) => {\n                        const err = tried[0] ? contactErr[k] : undefined;\n                        return (\n                          <div key={k} className={span ? \"sm:col-span-2\" : \"\"}>\n                            <label htmlFor={`${uid}-${k}`} className=\"mb-1.5 block text-[12.5px] font-medium\" style={{ color: p.body }}>\n                              {label}\n                            </label>\n                            <input\n                              id={`${uid}-${k}`}\n                              type={k === \"email\" ? \"email\" : \"text\"}\n                              autoComplete={ac}\n                              value={c[k]}\n                              onChange={(e) => setC((v) => ({ ...v, [k]: e.target.value }))}\n                              aria-invalid={!!err}\n                              aria-describedby={err ? `${uid}-${k}-e` : undefined}\n                              className={fieldCls}\n                              style={fieldStyle(!!err)}\n                            />\n                            {err && (\n                              <p id={`${uid}-${k}-e`} className=\"m-0 mt-1 text-[12px]\" style={{ color: p.danger }}>\n                                {err}\n                              </p>\n                            )}\n                          </div>\n                        );\n                      })}\n                      <div>\n                        <label htmlFor={`${uid}-country`} className=\"mb-1.5 block text-[12.5px] font-medium\" style={{ color: p.body }}>\n                          Country\n                        </label>\n                        <select\n                          id={`${uid}-country`}\n                          autoComplete=\"country-name\"\n                          value={c.country}\n                          onChange={(e) => setC((v) => ({ ...v, country: e.target.value }))}\n                          className={cn(\"h-11 w-full cursor-pointer rounded-xl border px-3 text-[16px] sm:text-[14px]\", focus)}\n                          style={{ ...fieldStyle(false), colorScheme: theme }}\n                        >\n                          {COUNTRIES.map((x) => (\n                            <option key={x}>{x}</option>\n                          ))}\n                        </select>\n                      </div>\n                    </div>\n                  )}\n\n                  {step === 1 && (\n                    <div role=\"radiogroup\" aria-label=\"Delivery\" className=\"mt-5 flex flex-col gap-2\">\n                      {deliveryOptions.map((d) => {\n                        const on = delivery === d.id;\n                        return (\n                          <button\n                            key={d.id}\n                            type=\"button\"\n                            role=\"radio\"\n                            aria-checked={on}\n                            onClick={() => setDelivery(d.id)}\n                            className={cn(\"flex cursor-pointer items-center gap-3.5 rounded-2xl border p-4 text-left transition-colors\", focus)}\n                            style={{ background: on ? p.ghost : \"transparent\", borderColor: on ? p.title : p.line, color: p.title }}\n                          >\n                            <span aria-hidden=\"true\" className=\"flex h-5 w-5 shrink-0 items-center justify-center rounded-full border-2\" style={{ borderColor: on ? p.title : p.line }}>\n                              {on && <span className=\"h-2.5 w-2.5 rounded-full\" style={{ background: p.title }} />}\n                            </span>\n                            <span className=\"min-w-0 flex-1\">\n                              <span className=\"block text-[14.5px] font-semibold\">{d.label}</span>\n                              <span className=\"block text-[12.5px]\" style={{ color: p.muted }}>\n                                {d.eta}\n                              </span>\n                            </span>\n                            <span className=\"text-[14px] font-semibold tabular-nums\">{d.price ? money(d.price, currency) : \"Free\"}</span>\n                          </button>\n                        );\n                      })}\n                    </div>\n                  )}\n\n                  {step === 2 && (\n                    <div className=\"mt-5 grid grid-cols-2 gap-3.5\">\n                      <div className=\"col-span-2\">\n                        <label htmlFor={`${uid}-num`} className=\"mb-1.5 block text-[12.5px] font-medium\" style={{ color: p.body }}>\n                          Card number\n                        </label>\n                        <div className=\"relative\">\n                          <input\n                            id={`${uid}-num`}\n                            inputMode=\"numeric\"\n                            autoComplete=\"cc-number\"\n                            placeholder=\"1234 5678 9012 3456\"\n                            value={card.number}\n                            onChange={(e) =>\n                              setCard((v) => ({\n                                ...v,\n                                number: e.target.value\n                                  .replace(/\\D/g, \"\")\n                                  .slice(0, 19)\n                                  .replace(/(\\d{4})(?=\\d)/g, \"$1 \"),\n                              }))\n                            }\n                            aria-invalid={tried[2] && !!cardErr.number}\n                            className={cn(fieldCls, \"pr-24 font-mono tracking-[0.04em]\")}\n                            style={fieldStyle(tried[2] && !!cardErr.number)}\n                          />\n                          {brand && (\n                            <span className=\"absolute top-1/2 right-2.5 -translate-y-1/2 rounded-md px-2 py-0.5 text-[11px] font-semibold\" style={{ background: p.ghost }}>\n                              {brand}\n                            </span>\n                          )}\n                        </div>\n                        {tried[2] && cardErr.number && (\n                          <p className=\"m-0 mt-1 text-[12px]\" style={{ color: p.danger }}>\n                            {cardErr.number}\n                          </p>\n                        )}\n                      </div>\n                      {(\n                        [\n                          [\n                            \"exp\",\n                            \"Expiry\",\n                            \"cc-exp\",\n                            \"MM/YY\",\n                            (v: string) => {\n                              const d = v.replace(/\\D/g, \"\").slice(0, 4);\n                              return d.length > 2 ? `${d.slice(0, 2)}/${d.slice(2)}` : d;\n                            },\n                          ],\n                          [\"cvc\", \"CVC\", \"cc-csc\", \"123\", (v: string) => v.replace(/\\D/g, \"\").slice(0, 4)],\n                        ] as const\n                      ).map(([k, label, ac, ph, fmt]) => (\n                        <div key={k}>\n                          <label htmlFor={`${uid}-${k}`} className=\"mb-1.5 block text-[12.5px] font-medium\" style={{ color: p.body }}>\n                            {label}\n                          </label>\n                          <input\n                            id={`${uid}-${k}`}\n                            inputMode=\"numeric\"\n                            autoComplete={ac}\n                            placeholder={ph}\n                            value={card[k]}\n                            onChange={(e) => setCard((v) => ({ ...v, [k]: fmt(e.target.value) }))}\n                            aria-invalid={tried[2] && !!cardErr[k]}\n                            className={fieldCls}\n                            style={fieldStyle(tried[2] && !!cardErr[k])}\n                          />\n                          {tried[2] && cardErr[k] && (\n                            <p className=\"m-0 mt-1 text-[12px]\" style={{ color: p.danger }}>\n                              {cardErr[k]}\n                            </p>\n                          )}\n                        </div>\n                      ))}\n                      <div className=\"col-span-2\">\n                        <label htmlFor={`${uid}-cn`} className=\"mb-1.5 block text-[12.5px] font-medium\" style={{ color: p.body }}>\n                          Name on card\n                        </label>\n                        <input id={`${uid}-cn`} autoComplete=\"cc-name\" value={card.name} onChange={(e) => setCard((v) => ({ ...v, name: e.target.value }))} className={fieldCls} style={fieldStyle(tried[2] && !!cardErr.name)} />\n                        {tried[2] && cardErr.name && (\n                          <p className=\"m-0 mt-1 text-[12px]\" style={{ color: p.danger }}>\n                            {cardErr.name}\n                          </p>\n                        )}\n                      </div>\n                      <label className=\"col-span-2 flex cursor-pointer items-center gap-2.5 text-[13px]\" style={{ color: p.body }}>\n                        <input type=\"checkbox\" checked={card.save} onChange={(e) => setCard((v) => ({ ...v, save: e.target.checked }))} className=\"h-4 w-4\" style={{ accentColor: p.accent }} />\n                        Save this card for next time\n                      </label>\n                      <button\n                        type=\"button\"\n                        onClick={() => setCard((v) => ({ ...v, number: \"4242 4242 4242 4242\", exp: \"08/29\", cvc: \"123\", name: c.name }))}\n                        className={cn(\"col-span-2 cursor-pointer justify-self-start rounded border-0 bg-transparent p-0 text-[12.5px] underline underline-offset-4\", focus)}\n                        style={{ color: p.muted }}\n                      >\n                        Use a test card\n                      </button>\n                    </div>\n                  )}\n\n                  {step === 3 && (\n                    <dl className=\"m-0 mt-5 flex flex-col\">\n                      {[\n                        [\"Ship to\", `${c.name}, ${c.address}, ${c.city} ${c.zip}, ${c.country}`, 0],\n                        [\"Delivery\", `${ship.label} · ${ship.eta} · ${ship.price ? money(ship.price, currency) : \"Free\"}`, 1],\n                        [\"Payment\", `${brand ?? \"Card\"} ···· ${digits.slice(-4)}${card.save ? \" · saved\" : \"\"}`, 2],\n                      ].map(([k, v, to]) => (\n                        <div key={k as string} className=\"flex items-start justify-between gap-4 border-b py-3.5 first:pt-0\" style={{ borderColor: p.line }}>\n                          <div className=\"min-w-0\">\n                            <dt className=\"text-[12px] font-medium tracking-[0.06em] uppercase\" style={{ color: p.muted }}>\n                              {k}\n                            </dt>\n                            <dd className=\"m-0 mt-1 text-[14px]\">{v}</dd>\n                          </div>\n                          <button\n                            type=\"button\"\n                            onClick={() => go(to as number)}\n                            aria-label={`Edit ${(k as string).toLowerCase()}`}\n                            className={cn(\"shrink-0 cursor-pointer rounded border-0 bg-transparent p-0 text-[13px] underline underline-offset-4\", focus)}\n                            style={{ color: p.body }}\n                          >\n                            Edit\n                          </button>\n                        </div>\n                      ))}\n                      {state === \"error\" && (\n                        <p className=\"m-0 mt-3 text-[13px]\" style={{ color: p.danger }} role=\"alert\">\n                          The payment didn’t go through. Check the card or try another.\n                        </p>\n                      )}\n                    </dl>\n                  )}\n                </motion.div>\n              )}\n            </AnimatePresence>\n          </div>\n\n          {state !== \"done\" && (\n            <div className=\"mt-6 flex items-center gap-2\">\n              {step > 0 && (\n                <button\n                  type=\"button\"\n                  onClick={() => go(step - 1)}\n                  disabled={state === \"busy\"}\n                  className={cn(\"h-11 cursor-pointer rounded-full border px-5 text-[14px] font-semibold disabled:opacity-40\", focus)}\n                  style={{ borderColor: p.line, background: \"transparent\", color: p.title }}\n                >\n                  Back\n                </button>\n              )}\n              <button\n                type=\"button\"\n                onClick={next}\n                disabled={state === \"busy\"}\n                className={cn(\"flex h-11 flex-1 cursor-pointer items-center justify-center gap-2 rounded-full border-0 px-5 text-[14px] font-semibold sm:flex-none\", focus)}\n                style={{ background: p.buttonBg, color: p.buttonText }}\n              >\n                {state === \"busy\" && (\n                  <motion.span\n                    aria-hidden=\"true\"\n                    className=\"h-4 w-4 rounded-full border-2\"\n                    style={{ borderColor: `${p.buttonText}33`, borderTopColor: p.buttonText }}\n                    animate={reduce ? undefined : { rotate: 360 }}\n                    transition={{ duration: 0.8, repeat: Infinity, ease: \"linear\" }}\n                  />\n                )}\n                {state === \"busy\" ? (\n                  \"Placing order…\"\n                ) : step === 3 ? (\n                  <>\n                    Place order<span className=\"hidden sm:inline\"> · {money(total, currency)}</span>\n                  </>\n                ) : (\n                  `Continue to ${STEPS[step + 1].toLowerCase()}`\n                )}\n              </button>\n            </div>\n          )}\n        </div>\n\n        {/* Summary */}\n        <aside aria-label=\"Order summary\" className=\"border-t p-5 sm:p-8 lg:border-t-0 lg:border-l\" style={{ background: p.side, borderColor: p.line }}>\n          <button\n            type=\"button\"\n            aria-expanded={summaryOpen}\n            onClick={() => setSummaryOpen((o) => !o)}\n            className={cn(\"flex w-full cursor-pointer items-center justify-between rounded border-0 bg-transparent p-0 text-left lg:hidden\", focus)}\n            style={{ color: p.title }}\n          >\n            <span className=\"text-[14px] font-semibold\">{summaryOpen ? \"Hide\" : \"Show\"} order summary</span>\n            <span className=\"text-[16px] font-semibold tabular-nums\">{money(total, currency)}</span>\n          </button>\n          <p className=\"m-0 hidden text-[14px] font-semibold lg:block\">Order summary</p>\n          <div className={cn(summaryOpen ? \"block\" : \"hidden\", \"lg:block\")}>\n            <ul className=\"m-0 mt-4 flex list-none flex-col gap-3 p-0\">\n              {lines.map((l) => (\n                <li key={l.name} className=\"flex items-center gap-3\">\n                  <span className=\"relative h-14 w-14 shrink-0 rounded-xl\" style={{ background: p.tile }}>\n                    {/* eslint-disable-next-line @next/next/no-img-element -- plain img keeps the block framework-agnostic */}\n                    <img src={l.image} alt=\"\" width={112} height={112} className=\"h-full w-full object-contain p-1\" />\n                    <span className=\"absolute -top-1.5 -right-1.5 flex h-5 min-w-5 items-center justify-center rounded-full px-1 text-[11px] font-bold\" style={{ background: p.buttonBg, color: p.buttonText }}>\n                      {l.qty}\n                    </span>\n                  </span>\n                  <span className=\"min-w-0 flex-1\">\n                    <span className=\"block truncate text-[13.5px] font-medium\">{l.name}</span>\n                    {l.variant && (\n                      <span className=\"block truncate text-[12px]\" style={{ color: p.muted }}>\n                        {l.variant}\n                      </span>\n                    )}\n                  </span>\n                  <span className=\"text-[13.5px] tabular-nums\">{money(l.price * l.qty, currency)}</span>\n                </li>\n              ))}\n            </ul>\n            <dl className=\"m-0 mt-5 flex flex-col gap-2 border-t pt-4 text-[13.5px]\" style={{ borderColor: p.line }}>\n              {[\n                [\"Subtotal\", money(subtotal, currency)],\n                [\"Shipping\", ship.price ? money(ship.price, currency) : \"Free\"],\n                [`Tax (${Math.round(taxRate * 100)}%)`, money(tax, currency)],\n              ].map(([k, v]) => (\n                <div key={k} className=\"flex justify-between\">\n                  <dt style={{ color: p.body }}>{k}</dt>\n                  <dd className=\"m-0 tabular-nums\">{v}</dd>\n                </div>\n              ))}\n              <div className=\"mt-1 flex items-baseline justify-between border-t pt-3\" style={{ borderColor: p.line }}>\n                <dt className=\"font-semibold\">Total</dt>\n                <dd className=\"m-0 text-[20px] font-semibold tabular-nums\" aria-live=\"polite\">\n                  {money(total, currency)}\n                </dd>\n              </div>\n            </dl>\n          </div>\n        </aside>\n      </div>\n    </section>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}