{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "auth-flow-two-factor-setup",
  "type": "registry:component",
  "title": "Auth Flow Two-Factor Setup",
  "description": "A three-step authenticator setup: a scannable-looking code grid that ripples in with a scan line and a copyable setup key, a code check beside a ring synced to the 30-second window, and blurred backup codes that must be revealed and confirmed as stored before finishing.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "auth",
    "auth",
    "2fa",
    "authenticator",
    "backup codes",
    "security",
    "setup"
  ],
  "docs": "https://hyperblur.dev/effects/auth-flow-two-factor-setup",
  "files": [
    {
      "path": "registry/hyperblur/auth-flow-two-factor-setup.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/auth-flow-two-factor-setup.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface AuthFlowTwoFactorSetupProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n  issuer?: string;\n  account?: string;\n  secret?: string;\n  backupCodes?: string[];\n  defaultStep?: number;\n  onVerify?: (code: string) => boolean | void | Promise<boolean | void>;\n  onComplete?: () => void;\n  onStepChange?: (step: number) => void;\n  headingAs?: \"h1\" | \"h2\" | \"h3\";\n  accent?: string;\n}\n\nconst css = `\n@keyframes hb-vg3-reveal {\n  from { clip-path: circle(0% at 50% 50%); }\n  to { clip-path: circle(75% at 50% 50%); }\n}\n@keyframes hb-vg3-scan {\n  0% { transform: translateY(-10%); opacity: 0; }\n  12% { opacity: 1; }\n  88% { opacity: 1; }\n  100% { transform: translateY(1000%); opacity: 0; }\n}\n@keyframes hb-vg3-in {\n  from { opacity: 0; transform: translate3d(14px, 0, 0); }\n  to { opacity: 1; transform: translate3d(0, 0, 0); }\n}\n@keyframes hb-vg3-pop {\n  0% { transform: scale(.6); opacity: 0; }\n  60% { transform: scale(1.08); opacity: 1; }\n  100% { transform: scale(1); }\n}\n@keyframes hb-vg3-tick { from { stroke-dashoffset: 0; } to { stroke-dashoffset: var(--hb-vg3-c); } }\n@keyframes hb-vg3-shake {\n  0%, 100% { transform: translateX(0); }\n  25% { transform: translateX(-7px); }\n  50% { transform: translateX(6px); }\n  75% { transform: translateX(-3px); }\n}\n.hb-vg3 {\n  --hb-vg3-accent: #818cf8;\n  position: relative;\n  box-sizing: border-box;\n  width: 100%;\n  padding: 72px 20px;\n  overflow: hidden;\n  isolation: isolate;\n  container-type: inline-size;\n  background: #0a0a0a;\n  color: #ededed;\n  font-family: inherit;\n  -webkit-font-smoothing: antialiased;\n}\n.hb-vg3 *, .hb-vg3 *::before, .hb-vg3 *::after { box-sizing: border-box; }\n.hb-vg3::before {\n  content: \"\";\n  position: absolute;\n  inset: 0;\n  z-index: -1;\n  background: radial-gradient(ellipse 50% 45% at 50% 0%, color-mix(in srgb, var(--hb-vg3-accent) 14%, transparent), transparent 70%);\n}\n.hb-vg3-shell { max-width: 780px; margin: 0 auto; border: 1px solid #222; border-radius: 24px; background: linear-gradient(180deg, #131313, #0d0d0d); box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 50px 100px -50px #000; overflow: hidden; }\n.hb-vg3-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 28px; border-bottom: 1px solid #1d1d1d; background: #0f0f0f; }\n.hb-vg3-title { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.01em; }\n.hb-vg3-steps { display: flex; align-items: center; gap: 0; margin: 0; padding: 0; list-style: none; }\n.hb-vg3-steps li { display: flex; align-items: center; color: #6b6b6b; font-size: 12.5px; font-weight: 550; transition: color .3s ease; }\n.hb-vg3-steps li[data-state=\"current\"], .hb-vg3-steps li[data-state=\"done\"] { color: #ededed; }\n.hb-vg3-num { display: grid; place-items: center; width: 22px; height: 22px; margin-right: 8px; border: 1px solid #2c2c2c; border-radius: 50%; font: 600 11px/1 var(--font-mono), ui-monospace, monospace; transition: background .3s ease, border-color .3s ease, color .3s ease; }\n.hb-vg3-steps li[data-state=\"current\"] .hb-vg3-num { border-color: var(--hb-vg3-accent); color: var(--hb-vg3-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--hb-vg3-accent) 15%, transparent); }\n.hb-vg3-steps li[data-state=\"done\"] .hb-vg3-num { border-color: transparent; background: var(--hb-vg3-accent); color: #0a0a0a; }\n.hb-vg3-link { width: 28px; height: 1px; margin: 0 10px; background: #2a2a2a; position: relative; overflow: hidden; }\n.hb-vg3-link::after { content: \"\"; position: absolute; inset: 0; background: var(--hb-vg3-accent); transform: scaleX(var(--f, 0)); transform-origin: left; transition: transform .5s cubic-bezier(.65, 0, .35, 1); }\n.hb-vg3-body { padding: 30px 28px 28px; }\n.hb-vg3-pane { animation: hb-vg3-in .4s cubic-bezier(.2, .8, .2, 1) both; }\n.hb-vg3-grid { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 32px; align-items: center; }\n.hb-vg3-qr { position: relative; padding: 14px; border-radius: 18px; background: #f5f5f5; box-shadow: 0 20px 40px -20px color-mix(in srgb, var(--hb-vg3-accent) 70%, transparent), 0 0 0 1px rgba(255,255,255,.1); overflow: hidden; }\n.hb-vg3-qr svg { display: block; width: 100%; height: auto; animation: hb-vg3-reveal 1.1s cubic-bezier(.3, .7, .2, 1) both; }\n.hb-vg3-scanline { position: absolute; left: 8px; right: 8px; top: 8px; height: 10%; background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--hb-vg3-accent) 45%, transparent)); border-bottom: 2px solid var(--hb-vg3-accent); animation: hb-vg3-scan 2.8s 1s cubic-bezier(.45, 0, .55, 1) infinite; pointer-events: none; }\n.hb-vg3-h { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: -.02em; }\n.hb-vg3-p { margin: 8px 0 0; color: #a1a1a1; font-size: 14px; line-height: 1.6; }\n.hb-vg3-apps { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }\n.hb-vg3-apps span { padding: 4px 9px; border: 1px solid #262626; border-radius: 999px; color: #a1a1a1; font-size: 12px; }\n.hb-vg3-key { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding: 10px 10px 10px 14px; border: 1px dashed #2f2f2f; border-radius: 12px; background: #0a0a0a; }\n.hb-vg3-key code { color: #ededed; font: 500 13.5px/1.4 var(--font-mono), ui-monospace, monospace; letter-spacing: .06em; word-break: break-all; }\n.hb-vg3-mini { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border: 1px solid #2a2a2a; border-radius: 8px; background: #161616; color: #ededed; font: inherit; font-size: 12.5px; font-weight: 550; cursor: pointer; transition: background .2s ease, border-color .2s ease, transform .12s ease; }\n.hb-vg3-mini:hover { background: #1d1d1d; border-color: #3a3a3a; }\n.hb-vg3-mini:active { transform: scale(.96); }\n.hb-vg3-mini:focus-visible, .hb-vg3-btn:focus-visible, .hb-vg3-ghost:focus-visible, .hb-vg3-check input:focus-visible + span { outline: 2px solid var(--hb-vg3-accent); outline-offset: 2px; }\n.hb-vg3-mini[data-ok=\"true\"] { color: #86efac; border-color: #14532d; }\n.hb-vg3-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 28px; padding-top: 22px; border-top: 1px solid #1d1d1d; }\n.hb-vg3-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 20px; border: 0; border-radius: 11px; background: var(--hb-vg3-accent); color: #0a0a0a; font: inherit; font-size: 14px; font-weight: 650; cursor: pointer; box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 10px 24px -12px var(--hb-vg3-accent); transition: transform .15s ease, filter .2s ease, opacity .2s ease; }\n.hb-vg3-btn:hover:not(:disabled) { filter: brightness(1.08); }\n.hb-vg3-btn:active:not(:disabled) { transform: scale(.97); }\n.hb-vg3-btn:disabled { opacity: .35; cursor: not-allowed; }\n.hb-vg3-ghost { height: 42px; padding: 0 14px; border: 0; border-radius: 11px; background: none; color: #a1a1a1; font: inherit; font-size: 14px; font-weight: 550; cursor: pointer; }\n.hb-vg3-ghost:hover { color: #ededed; background: #161616; }\n.hb-vg3-verify { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px; align-items: center; }\n.hb-vg3-code { position: relative; margin-top: 20px; }\n.hb-vg3-code input { width: 100%; height: 64px; padding: 0 20px; border: 1px solid #262626; border-radius: 14px; background: #0a0a0a; color: #ededed; font: 500 30px/1 var(--font-mono), ui-monospace, monospace; letter-spacing: .5em; font-variant-numeric: tabular-nums; outline: none; transition: border-color .2s ease, box-shadow .2s ease; }\n.hb-vg3-code input::placeholder { color: #333; }\n.hb-vg3-code input:focus { border-color: color-mix(in srgb, var(--hb-vg3-accent) 60%, #262626); box-shadow: 0 0 0 4px color-mix(in srgb, var(--hb-vg3-accent) 14%, transparent); }\n.hb-vg3-code[data-bad=\"true\"] input { border-color: #7f1d1d; color: #fca5a5; animation: hb-vg3-shake .4s ease; }\n.hb-vg3-note { min-height: 20px; margin-top: 10px; color: #8f8f8f; font-size: 12.5px; }\n.hb-vg3-note[data-bad=\"true\"] { color: #fca5a5; }\n.hb-vg3-totp { position: relative; display: grid; place-items: center; width: 112px; height: 112px; }\n.hb-vg3-totp svg { position: absolute; inset: 0; transform: rotate(-90deg); }\n.hb-vg3-totp circle:last-child { stroke: var(--hb-vg3-accent); stroke-dasharray: var(--hb-vg3-c); animation: hb-vg3-tick 30s linear infinite; animation-delay: var(--hb-vg3-off, 0s); }\n.hb-vg3-totp div { text-align: center; }\n.hb-vg3-totp b { display: block; font: 600 17px/1 var(--font-mono), ui-monospace, monospace; letter-spacing: .08em; }\n.hb-vg3-totp small { display: block; margin-top: 6px; color: #8f8f8f; font-size: 10.5px; }\n.hb-vg3-codes { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; margin: 20px 0 0; padding: 18px; border: 1px solid #1f1f1f; border-radius: 14px; background: repeating-linear-gradient(135deg, #0c0c0c 0 8px, #0e0e0e 8px 16px); list-style: none; counter-reset: hb-vg3-n; }\n.hb-vg3-codes li { display: flex; align-items: center; gap: 10px; font: 500 14.5px/1.5 var(--font-mono), ui-monospace, monospace; letter-spacing: .05em; counter-increment: hb-vg3-n; transition: filter .45s ease, opacity .45s ease; transition-delay: calc(var(--d) * 35ms); }\n.hb-vg3-codes li::before { content: counter(hb-vg3-n, decimal-leading-zero); color: #4f4f4f; font-size: 11px; }\n.hb-vg3-codes[data-hidden=\"true\"] li { filter: blur(6px); opacity: .55; }\n.hb-vg3-unhide { position: absolute; inset: 0; display: grid; place-items: center; border: 0; border-radius: 14px; background: rgba(10,10,10,.25); color: #ededed; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; }\n.hb-vg3-unhide span { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border: 1px solid #333; border-radius: 999px; background: #151515; box-shadow: 0 10px 30px -10px #000; }\n.hb-vg3-unhide:focus-visible span { outline: 2px solid var(--hb-vg3-accent); outline-offset: 2px; }\n.hb-vg3-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }\n.hb-vg3-check { display: flex; align-items: center; gap: 10px; color: #cfcfcf; font-size: 13.5px; cursor: pointer; }\n.hb-vg3-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }\n.hb-vg3-check span { display: grid; place-items: center; width: 18px; height: 18px; border: 1px solid #3a3a3a; border-radius: 5px; background: #0a0a0a; transition: background .2s ease, border-color .2s ease; }\n.hb-vg3-check input:checked + span { border-color: var(--hb-vg3-accent); background: var(--hb-vg3-accent); color: #0a0a0a; }\n.hb-vg3-check svg { opacity: 0; transition: opacity .15s ease; }\n.hb-vg3-check input:checked + span svg { opacity: 1; }\n.hb-vg3-done { display: flex; flex-direction: column; align-items: center; padding: 18px 0 8px; text-align: center; }\n.hb-vg3-shield { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 22px; background: color-mix(in srgb, var(--hb-vg3-accent) 16%, #111); color: var(--hb-vg3-accent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hb-vg3-accent) 40%, transparent), 0 20px 50px -20px var(--hb-vg3-accent); animation: hb-vg3-pop .55s cubic-bezier(.3, 1.4, .5, 1) both; }\n.hb-vg3-done .hb-vg3-p { max-width: 420px; }\n@container (max-width: 640px) {\n  .hb-vg3-head { flex-direction: column; align-items: flex-start; }\n  .hb-vg3-steps li > span:last-child { display: none; }\n  .hb-vg3-grid, .hb-vg3-verify { grid-template-columns: minmax(0, 1fr); }\n  .hb-vg3-qr { max-width: 220px; }\n  .hb-vg3-totp { display: none; }\n  .hb-vg3-codes { grid-template-columns: minmax(0, 1fr); }\n  .hb-vg3-body { padding: 24px 20px; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-vg3 *, .hb-vg3 *::before, .hb-vg3 *::after { animation: none !important; transition: none !important; }\n  .hb-vg3-scanline { display: none; }\n}\n`;\n\nfunction hash(n: number) {\n  let x = (n ^ 0x9e3779b9) >>> 0;\n  x = Math.imul(x ^ (x >>> 16), 0x85ebca6b) >>> 0;\n  x = Math.imul(x ^ (x >>> 13), 0xc2b2ae35) >>> 0;\n  return (x ^ (x >>> 16)) >>> 0;\n}\n\nfunction seedOf(s: string) {\n  let h = 2166136261;\n  for (let i = 0; i < s.length; i++) h = Math.imul(h ^ s.charCodeAt(i), 16777619) >>> 0;\n  return h;\n}\n\nconst N = 25;\n\nfunction finder(x: number, y: number, ox: number, oy: number) {\n  const dx = x - ox;\n  const dy = y - oy;\n  if (dx < -1 || dy < -1 || dx > 7 || dy > 7) return null;\n  if (dx < 0 || dy < 0 || dx > 6 || dy > 6) return false;\n  if (dx === 0 || dy === 0 || dx === 6 || dy === 6) return true;\n  if (dx >= 2 && dx <= 4 && dy >= 2 && dy <= 4) return true;\n  return false;\n}\n\nfunction matrixPath(seed: number) {\n  let d = \"\";\n  for (let y = 0; y < N; y++) {\n    for (let x = 0; x < N; x++) {\n      let on: boolean | null = finder(x, y, 0, 0);\n      if (on === null) on = finder(x, y, N - 7, 0);\n      if (on === null) on = finder(x, y, 0, N - 7);\n      if (on === null) {\n        const ax = x - 18;\n        const ay = y - 18;\n        if (ax >= -2 && ax <= 2 && ay >= -2 && ay <= 2) on = Math.max(Math.abs(ax), Math.abs(ay)) !== 1;\n        else if (y === 6) on = x % 2 === 0;\n        else if (x === 6) on = y % 2 === 0;\n        else on = hash(seed + y * N + x) % 100 < 48;\n      }\n      if (on) d += `M${x} ${y}h1v1h-1z`;\n    }\n  }\n  return d;\n}\n\nfunction wait<T>(result: T | Promise<T>, ms: number) {\n  return result instanceof Promise ? result : new Promise<T>((resolve) => window.setTimeout(() => resolve(result), ms));\n}\n\nconst labels = [\"Scan\", \"Verify\", \"Save codes\"];\n\nexport function AuthFlowTwoFactorSetup({\n  issuer = \"Northwind\",\n  account = \"maya.chen@northwind.io\",\n  secret = \"JBSWY3DPEHPK3PXPNW4QK7ZL\",\n  backupCodes = [\"4F7K-2QXM\", \"9TDR-HB3L\", \"C8WN-61PV\", \"Q2JE-7ZKA\", \"M5YH-D4RT\", \"X1GP-8BNC\", \"R6LA-3WFQ\", \"V9SK-T2EJ\", \"B3ZD-5MHU\", \"H7NC-Y0QW\"],\n  defaultStep = 0,\n  onVerify,\n  onComplete,\n  onStepChange,\n  headingAs = \"h2\",\n  accent = \"#818cf8\",\n  className = \"\",\n  style,\n  ...rest\n}: AuthFlowTwoFactorSetupProps) {\n  const Heading = headingAs;\n  const uid = React.useId();\n  const [step, setStep] = React.useState(Math.max(0, Math.min(3, defaultStep)));\n  const [copied, setCopied] = React.useState(\"\");\n  const [code, setCode] = React.useState(\"\");\n  const [bad, setBad] = React.useState(false);\n  const [busy, setBusy] = React.useState(false);\n  const [hidden, setHidden] = React.useState(true);\n  const [saved, setSaved] = React.useState(false);\n  const rootRef = React.useRef<HTMLElement>(null);\n  const path = React.useMemo(() => matrixPath(seedOf(secret)), [secret]);\n  const grouped = secret.replace(/(.{4})/g, \"$1 \").trim();\n\n  React.useEffect(() => {\n    rootRef.current?.style.setProperty(\"--hb-vg3-off\", `${(-((Date.now() / 1000) % 30)).toFixed(2)}s`);\n  }, []);\n\n  const go = (n: number) => {\n    setStep(n);\n    onStepChange?.(n);\n  };\n\n  const copy = (text: string, id: string) => {\n    navigator.clipboard?.writeText(text).catch(() => undefined);\n    setCopied(id);\n    window.setTimeout(() => setCopied((c) => (c === id ? \"\" : c)), 1600);\n  };\n\n  const download = () => {\n    const body = `${issuer} backup codes for ${account}\\n\\n${backupCodes.join(\"\\n\")}\\n\\nEach code works once.\\n`;\n    const url = URL.createObjectURL(new Blob([body], { type: \"text/plain\" }));\n    const a = document.createElement(\"a\");\n    a.href = url;\n    a.download = `${issuer.toLowerCase()}-backup-codes.txt`;\n    a.click();\n    window.setTimeout(() => URL.revokeObjectURL(url), 500);\n  };\n\n  const verify = (e: React.FormEvent) => {\n    e.preventDefault();\n    if (code.length !== 6 || busy) return;\n    setBusy(true);\n    wait(onVerify ? onVerify(code) : true, 800).then(\n      (ok) => {\n        setBusy(false);\n        if (ok === false) {\n          setBad(true);\n          setCode(\"\");\n        } else go(2);\n      },\n      () => {\n        setBusy(false);\n        setBad(true);\n      },\n    );\n  };\n\n  const C = 2 * Math.PI * 50;\n  const vars = { \"--hb-vg3-accent\": accent, \"--hb-vg3-c\": C.toFixed(2), ...style } as React.CSSProperties;\n  const chk = (\n    <svg width=\"11\" height=\"11\" viewBox=\"0 0 12 12\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n      <path d=\"M2.5 6.5l2.2 2.2L9.5 3.8\" />\n    </svg>\n  );\n\n  return (\n    <section ref={rootRef} className={`hb-vg3 ${className}`} style={vars} aria-labelledby={`${uid}-t`} {...rest}>\n      <style href=\"hb-auth-flow-two-factor-setup\" precedence=\"default\">{css}</style>\n      <div className=\"hb-vg3-shell\">\n        <div className=\"hb-vg3-head\">\n          <Heading id={`${uid}-t`} className=\"hb-vg3-title\">Turn on two-factor authentication</Heading>\n          <ol className=\"hb-vg3-steps\" aria-label=\"Setup progress\">\n            {labels.map((l, i) => (\n              <li key={l} data-state={step > i ? \"done\" : step === i ? \"current\" : \"todo\"} aria-current={step === i ? \"step\" : undefined}>\n                {i > 0 ? <i className=\"hb-vg3-link\" style={{ \"--f\": step >= i ? 1 : 0 } as React.CSSProperties} aria-hidden=\"true\" /> : null}\n                <span className=\"hb-vg3-num\">{step > i ? chk : i + 1}</span>\n                <span>{l}</span>\n              </li>\n            ))}\n          </ol>\n        </div>\n        <div className=\"hb-vg3-body\">\n          {step === 0 ? (\n            <div className=\"hb-vg3-pane\" key=\"scan\">\n              <div className=\"hb-vg3-grid\">\n                <div className=\"hb-vg3-qr\">\n                  <svg viewBox={`-1 -1 ${N + 2} ${N + 2}`} shapeRendering=\"crispEdges\" role=\"img\" aria-label={`Setup code for ${issuer}`}>\n                    <path d={path} fill=\"#0a0a0a\" />\n                  </svg>\n                  <span className=\"hb-vg3-scanline\" aria-hidden=\"true\" />\n                </div>\n                <div>\n                  <h3 className=\"hb-vg3-h\">Scan with your authenticator</h3>\n                  <p className=\"hb-vg3-p\">Open your authenticator app, tap add account and point the camera at the code. It links {issuer} to <b>{account}</b>.</p>\n                  <div className=\"hb-vg3-apps\" aria-label=\"Works with\">\n                    <span>1Password</span>\n                    <span>Authy</span>\n                    <span>Google Authenticator</span>\n                  </div>\n                  <div className=\"hb-vg3-key\">\n                    <code aria-label=\"Setup key\">{grouped}</code>\n                    <button type=\"button\" className=\"hb-vg3-mini\" data-ok={copied === \"key\"} onClick={() => copy(secret, \"key\")}>\n                      {copied === \"key\" ? \"Copied\" : \"Copy key\"}\n                    </button>\n                  </div>\n                </div>\n              </div>\n              <div className=\"hb-vg3-foot\">\n                <span className=\"hb-vg3-p\" style={{ margin: 0 }}>Can&apos;t scan? Type the key instead.</span>\n                <button type=\"button\" className=\"hb-vg3-btn\" onClick={() => go(1)}>I&apos;ve added it</button>\n              </div>\n            </div>\n          ) : step === 1 ? (\n            <form className=\"hb-vg3-pane\" key=\"verify\" onSubmit={verify} noValidate>\n              <div className=\"hb-vg3-verify\">\n                <div>\n                  <h3 className=\"hb-vg3-h\">Enter the 6-digit code</h3>\n                  <p className=\"hb-vg3-p\">Your app shows a new code for {issuer} every 30 seconds. Type the current one.</p>\n                  <div className=\"hb-vg3-code\" data-bad={bad}>\n                    <input\n                      value={code}\n                      onChange={(e) => {\n                        setBad(false);\n                        setCode(e.target.value.replace(/\\D/g, \"\").slice(0, 6));\n                      }}\n                      inputMode=\"numeric\"\n                      autoComplete=\"one-time-code\"\n                      placeholder=\"000000\"\n                      aria-label=\"Authenticator code\"\n                      aria-invalid={bad || undefined}\n                      aria-describedby={`${uid}-n`}\n                    />\n                  </div>\n                  <div id={`${uid}-n`} className=\"hb-vg3-note\" data-bad={bad} aria-live=\"polite\">\n                    {bad ? \"That code is not valid. Wait for the next one and try again.\" : busy ? \"Checking with your app\" : \"Tip: codes refresh when the ring completes.\"}\n                  </div>\n                </div>\n                <div className=\"hb-vg3-totp\" aria-hidden=\"true\">\n                  <svg width=\"112\" height=\"112\" viewBox=\"0 0 112 112\" fill=\"none\" strokeWidth=\"4\" strokeLinecap=\"round\">\n                    <circle cx=\"56\" cy=\"56\" r=\"50\" stroke=\"#1f1f1f\" />\n                    <circle cx=\"56\" cy=\"56\" r=\"50\" />\n                  </svg>\n                  <div>\n                    <b>{issuer.slice(0, 2).toUpperCase()}</b>\n                    <small>30s window</small>\n                  </div>\n                </div>\n              </div>\n              <div className=\"hb-vg3-foot\">\n                <button type=\"button\" className=\"hb-vg3-ghost\" onClick={() => go(0)}>Back</button>\n                <button type=\"submit\" className=\"hb-vg3-btn\" disabled={code.length !== 6 || busy} aria-busy={busy || undefined}>\n                  {busy ? \"Verifying\" : \"Verify code\"}\n                </button>\n              </div>\n            </form>\n          ) : step === 2 ? (\n            <div className=\"hb-vg3-pane\" key=\"codes\">\n              <h3 className=\"hb-vg3-h\">Save your backup codes</h3>\n              <p className=\"hb-vg3-p\">If you lose your phone, each code signs you in once. Store them somewhere only you can reach.</p>\n              <div style={{ position: \"relative\" }}>\n                <ul className=\"hb-vg3-codes\" data-hidden={hidden} aria-label=\"Backup codes\">\n                  {backupCodes.map((c, i) => (\n                    <li key={c} style={{ \"--d\": i } as React.CSSProperties} aria-hidden={hidden || undefined}>\n                      {c}\n                    </li>\n                  ))}\n                </ul>\n                {hidden ? (\n                  <button type=\"button\" className=\"hb-vg3-unhide\" onClick={() => setHidden(false)}>\n                    <span>\n                      <svg width=\"15\" height=\"15\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n                        <path d=\"M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z\" />\n                        <circle cx=\"12\" cy=\"12\" r=\"3\" />\n                      </svg>\n                      Reveal {backupCodes.length} codes\n                    </span>\n                  </button>\n                ) : null}\n              </div>\n              <div className=\"hb-vg3-actions\">\n                <button type=\"button\" className=\"hb-vg3-mini\" data-ok={copied === \"codes\"} onClick={() => copy(backupCodes.join(\"\\n\"), \"codes\")} disabled={hidden}>\n                  {copied === \"codes\" ? \"Copied\" : \"Copy all\"}\n                </button>\n                <button type=\"button\" className=\"hb-vg3-mini\" onClick={download} disabled={hidden}>Download .txt</button>\n              </div>\n              <div className=\"hb-vg3-foot\">\n                <label className=\"hb-vg3-check\">\n                  <input type=\"checkbox\" checked={saved} onChange={(e) => setSaved(e.target.checked)} />\n                  <span>{chk}</span>\n                  I&apos;ve stored these codes safely\n                </label>\n                <button\n                  type=\"button\"\n                  className=\"hb-vg3-btn\"\n                  disabled={!saved}\n                  onClick={() => {\n                    go(3);\n                    onComplete?.();\n                  }}\n                >\n                  Finish setup\n                </button>\n              </div>\n            </div>\n          ) : (\n            <div className=\"hb-vg3-pane hb-vg3-done\" key=\"done\" role=\"status\">\n              <span className=\"hb-vg3-shield\" aria-hidden=\"true\">\n                <svg width=\"32\" height=\"32\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.9\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n                  <path d=\"M12 3l7 3v5c0 4.5-3 8.3-7 10-4-1.7-7-5.5-7-10V6l7-3z\" />\n                  <path d=\"M8.8 12.2l2.2 2.2 4.2-4.4\" />\n                </svg>\n              </span>\n              <h3 className=\"hb-vg3-h\" style={{ marginTop: 18 }}>Two-factor is on</h3>\n              <p className=\"hb-vg3-p\">Next time you sign in to {issuer}, we&apos;ll ask for a code from your authenticator. You can manage methods in Security settings.</p>\n            </div>\n          )}\n        </div>\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}