{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "form-signup",
  "type": "registry:component",
  "title": "Signup Form",
  "description": "Account creation with a live username availability check, email typo suggestions and four password checks that fill as bars. Ends on an animated envelope with a resend countdown.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "forms",
    "form",
    "signup",
    "register",
    "password",
    "validation",
    "username"
  ],
  "docs": "https://hyperblur.dev/effects/form-signup",
  "files": [
    {
      "path": "registry/hyperblur/form-signup.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/form-signup.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface FormSignupValues {\n  email: string;\n  username: string;\n  password: string;\n}\n\nexport interface FormSignupProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onSubmit\" | \"title\"> {\n  title?: string;\n  subtitle?: string;\n  brand?: string;\n  takenUsernames?: string[];\n  emailDomains?: string[];\n  resendSeconds?: number;\n  submitLabel?: string;\n  accent?: string;\n  delay?: number;\n  onSubmit?: (values: FormSignupValues) => void | Promise<void>;\n  onResend?: (email: string) => void;\n}\n\nconst css = `\n.hb-xh2 {\n  --hb-xh2-a: #8b5cf6;\n  box-sizing: border-box;\n  width: 100%;\n  max-width: 400px;\n  margin: 0 auto;\n  font-family: inherit;\n  color: #ededed;\n}\n.hb-xh2 *, .hb-xh2 *::before, .hb-xh2 *::after { box-sizing: border-box; }\n.hb-xh2-card {\n  position: relative;\n  padding: 24px 22px 20px;\n  border-radius: 20px;\n  background: #0f0f10;\n  border: 1px solid #242426;\n  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 30px 60px -30px rgba(0,0,0,0.9);\n}\n.hb-xh2-card::after {\n  content: \"\";\n  position: absolute;\n  left: 22px;\n  right: 22px;\n  top: -1px;\n  height: 1px;\n  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--hb-xh2-a) 80%, #fff), transparent);\n  opacity: 0.7;\n}\n.hb-xh2-brand { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: #d6d6d6; }\n.hb-xh2-mark { width: 22px; height: 22px; border-radius: 7px; background: conic-gradient(from 210deg, var(--hb-xh2-a), #22d3ee, var(--hb-xh2-a)); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18); }\n.hb-xh2-title { margin: 16px 0 4px; font-size: 21px; font-weight: 600; letter-spacing: -0.025em; }\n.hb-xh2-sub { margin: 0 0 18px; font-size: 13px; color: #8f8f8f; }\n.hb-xh2-form { display: grid; gap: 14px; }\n.hb-xh2-field { display: grid; gap: 6px; }\n.hb-xh2-label { font-size: 12px; font-weight: 500; color: #b3b3b3; }\n.hb-xh2-box {\n  position: relative;\n  display: flex;\n  align-items: center;\n  height: 42px;\n  border: 1px solid #27272a;\n  border-radius: 11px;\n  background: #131315;\n  transition: border-color 0.2s ease, box-shadow 0.2s ease;\n}\n.hb-xh2-box:hover { border-color: #34343a; }\n.hb-xh2-box:focus-within { border-color: var(--hb-xh2-a); box-shadow: 0 0 0 4px color-mix(in srgb, var(--hb-xh2-a) 18%, transparent); }\n.hb-xh2-box[data-state=\"bad\"] { border-color: #ef4f5f; box-shadow: 0 0 0 4px rgba(239,79,95,0.12); }\n.hb-xh2-box[data-state=\"good\"] { border-color: color-mix(in srgb, #34d399 55%, #27272a); }\n.hb-xh2-pre { padding-left: 12px; font-size: 14px; color: #5f5f66; }\n.hb-xh2-in { flex: 1; min-width: 0; height: 100%; padding: 0 12px; border: 0; outline: 0; background: transparent; color: #ededed; font: inherit; font-size: 14px; }\n.hb-xh2-pre + .hb-xh2-in { padding-left: 2px; }\n.hb-xh2-in::placeholder { color: #55555c; }\n.hb-xh2-side { display: flex; align-items: center; padding-right: 10px; }\n.hb-xh2-eye { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: #7a7a82; cursor: pointer; transition: color 0.2s ease, background 0.2s ease; }\n.hb-xh2-eye:hover { color: #ededed; background: #1d1d20; }\n.hb-xh2-eye:focus-visible { outline: 2px solid var(--hb-xh2-a); outline-offset: 1px; }\n.hb-xh2-eye svg { width: 17px; height: 17px; }\n.hb-xh2-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 500; white-space: nowrap; animation: hb-xh2-in 0.25s cubic-bezier(0.22, 1, 0.36, 1); }\n.hb-xh2-tag[data-tone=\"ok\"] { color: #4ade80; }\n.hb-xh2-tag[data-tone=\"bad\"] { color: #ff8793; }\n.hb-xh2-tag[data-tone=\"wait\"] { color: #8f8f96; }\n.hb-xh2-tag svg { width: 14px; height: 14px; }\n.hb-xh2-ring { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid #3a3a40; border-top-color: #b8b8c0; animation: hb-xh2-rot 0.7s linear infinite; }\n.hb-xh2-msg { margin: 0; font-size: 12px; color: #ff8793; animation: hb-xh2-in 0.22s ease-out; }\n.hb-xh2-hint { margin: 0; font-size: 12px; color: #8f8f96; animation: hb-xh2-in 0.22s ease-out; }\n.hb-xh2-fix {\n  padding: 0;\n  border: 0;\n  background: none;\n  color: #c4b5fd;\n  font: inherit;\n  font-weight: 500;\n  cursor: pointer;\n  text-decoration: underline;\n  text-decoration-color: color-mix(in srgb, #c4b5fd 40%, transparent);\n  text-underline-offset: 3px;\n}\n.hb-xh2-fix:focus-visible { outline: 2px solid var(--hb-xh2-a); outline-offset: 2px; border-radius: 3px; }\n.hb-xh2-rules { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 2px; }\n.hb-xh2-rule { display: grid; gap: 5px; }\n.hb-xh2-bar { height: 3px; border-radius: 3px; background: #232327; overflow: hidden; }\n.hb-xh2-bar i { display: block; height: 100%; width: 100%; background: var(--hb-xh2-s, #4ade80); transform-origin: left; transform: scaleX(0); transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), background 0.3s ease; }\n.hb-xh2-rule[data-ok=\"true\"] .hb-xh2-bar i { transform: scaleX(1); }\n.hb-xh2-rule span { font-size: 10.5px; color: #6b6b72; transition: color 0.25s ease; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n.hb-xh2-rule[data-ok=\"true\"] span { color: #c9c9cf; }\n.hb-xh2-check { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: #9a9aa2; line-height: 1.45; cursor: pointer; }\n.hb-xh2-check input { position: absolute; opacity: 0; pointer-events: none; }\n.hb-xh2-tick { flex: none; display: grid; place-items: center; width: 18px; height: 18px; margin-top: 1px; border-radius: 6px; border: 1px solid #3a3a40; background: #131315; transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1); }\n.hb-xh2-tick svg { width: 12px; height: 12px; stroke: #fff; stroke-dasharray: 20; stroke-dashoffset: 20; transition: stroke-dashoffset 0.3s cubic-bezier(0.65, 0, 0.35, 1); }\n.hb-xh2-check input:checked + .hb-xh2-tick { background: var(--hb-xh2-a); border-color: var(--hb-xh2-a); }\n.hb-xh2-check input:checked + .hb-xh2-tick svg { stroke-dashoffset: 0; }\n.hb-xh2-check:active .hb-xh2-tick { transform: scale(0.88); }\n.hb-xh2-check input:focus-visible + .hb-xh2-tick { outline: 2px solid var(--hb-xh2-a); outline-offset: 2px; }\n.hb-xh2-check[data-bad=\"true\"] .hb-xh2-tick { border-color: #ef4f5f; }\n.hb-xh2-check a { color: #d4d4d8; text-underline-offset: 2px; }\n.hb-xh2-go {\n  position: relative;\n  overflow: hidden;\n  height: 44px;\n  border: 0;\n  border-radius: 12px;\n  background: #f4f4f5;\n  color: #0a0a0a;\n  font: inherit;\n  font-size: 14px;\n  font-weight: 600;\n  cursor: pointer;\n  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.12), 0 8px 24px -10px color-mix(in srgb, var(--hb-xh2-a) 80%, transparent);\n  transition: transform 0.15s cubic-bezier(0.3, 0.7, 0.4, 1), background 0.2s ease;\n}\n.hb-xh2-go::before { content: \"\"; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(139,92,246,0.25) 50%, transparent 70%); transform: translateX(-100%); transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1); }\n.hb-xh2-go:hover::before { transform: translateX(100%); }\n.hb-xh2-go:hover { background: #fff; }\n.hb-xh2-go:active { transform: scale(0.985); }\n.hb-xh2-go:focus-visible { outline: 2px solid var(--hb-xh2-a); outline-offset: 3px; }\n.hb-xh2-go[aria-busy=\"true\"] { cursor: progress; }\n.hb-xh2-gol { position: relative; display: inline-flex; align-items: center; gap: 8px; }\n.hb-xh2-dots { display: inline-flex; gap: 4px; }\n.hb-xh2-dots i { width: 5px; height: 5px; border-radius: 50%; background: #0a0a0a; animation: hb-xh2-bob 0.9s cubic-bezier(0.45, 0, 0.55, 1) infinite; }\n.hb-xh2-dots i:nth-child(2) { animation-delay: 0.12s; }\n.hb-xh2-dots i:nth-child(3) { animation-delay: 0.24s; }\n.hb-xh2-alt { margin: 2px 0 0; text-align: center; font-size: 12.5px; color: #7d7d85; }\n.hb-xh2-alt a { color: #e4e4e7; text-decoration: none; font-weight: 500; }\n.hb-xh2-alt a:hover { text-decoration: underline; text-underline-offset: 3px; }\n.hb-xh2-done { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 10px 0 4px; animation: hb-xh2-rise 0.55s cubic-bezier(0.22, 1, 0.36, 1); }\n.hb-xh2-env { position: relative; width: 74px; height: 58px; margin-bottom: 8px; }\n.hb-xh2-env svg { width: 100%; height: 100%; overflow: visible; }\n.hb-xh2-env .hb-xh2-letter { animation: hb-xh2-letter 1.1s 0.2s cubic-bezier(0.22, 1, 0.36, 1) both; }\n.hb-xh2-env .hb-xh2-flap { transform-origin: 37px 14px; animation: hb-xh2-flap 0.6s cubic-bezier(0.65, 0, 0.35, 1) both; }\n.hb-xh2-done h3 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -0.02em; }\n.hb-xh2-done p { margin: 0; font-size: 13px; color: #8f8f96; line-height: 1.5; }\n.hb-xh2-done strong { color: #ededed; font-weight: 500; }\n.hb-xh2-acts { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; justify-content: center; }\n.hb-xh2-sec { height: 34px; padding: 0 12px; border: 1px solid #2a2a2e; border-radius: 10px; background: #151517; color: #d4d4d8; font: inherit; font-size: 12.5px; cursor: pointer; font-variant-numeric: tabular-nums; transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease; }\n.hb-xh2-sec:hover:not(:disabled) { background: #1c1c1f; border-color: #3a3a40; }\n.hb-xh2-sec:disabled { color: #6b6b72; cursor: default; }\n.hb-xh2-sec:focus-visible { outline: 2px solid var(--hb-xh2-a); outline-offset: 2px; }\n@keyframes hb-xh2-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }\n@keyframes hb-xh2-rise { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }\n@keyframes hb-xh2-rot { to { transform: rotate(360deg); } }\n@keyframes hb-xh2-bob { 0%, 100% { transform: translateY(0); opacity: 0.5; } 50% { transform: translateY(-3px); opacity: 1; } }\n@keyframes hb-xh2-flap { from { transform: scaleY(1); } to { transform: scaleY(-1); } }\n@keyframes hb-xh2-letter { 0% { transform: translateY(14px); opacity: 0; } 100% { transform: translateY(-12px); opacity: 1; } }\n@media (prefers-reduced-motion: reduce) {\n  .hb-xh2 *, .hb-xh2 *::before, .hb-xh2 *::after { animation: none !important; transition: none !important; }\n  .hb-xh2-env .hb-xh2-flap { transform: scaleY(-1); }\n  .hb-xh2-env .hb-xh2-letter { transform: translateY(-12px); }\n}\n`;\n\nconst emailRe = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]{2,}$/;\nconst userRe = /^[a-z0-9_]{3,20}$/;\n\nfunction distance(a: string, b: string) {\n  const row = Array.from({ length: b.length + 1 }, (_, i) => i);\n  for (let i = 1; i <= a.length; i++) {\n    let prev = row[0];\n    row[0] = i;\n    for (let j = 1; j <= b.length; j++) {\n      const tmp = row[j];\n      row[j] = Math.min(row[j] + 1, row[j - 1] + 1, prev + (a[i - 1] === b[j - 1] ? 0 : 1));\n      prev = tmp;\n    }\n  }\n  return row[b.length];\n}\n\nfunction hashText(text: string) {\n  let h = 2166136261;\n  for (let i = 0; i < text.length; i++) {\n    h ^= text.charCodeAt(i);\n    h = Math.imul(h, 16777619);\n  }\n  return h >>> 0;\n}\n\nconst rules = [\n  { label: \"8+ chars\", test: (p: string) => p.length >= 8 },\n  { label: \"Number\", test: (p: string) => /\\d/.test(p) },\n  { label: \"Uppercase\", test: (p: string) => /[A-Z]/.test(p) },\n  { label: \"Symbol\", test: (p: string) => /[^A-Za-z0-9]/.test(p) },\n];\n\nconst strengthColor = [\"#ef4f5f\", \"#ef4f5f\", \"#f5a524\", \"#a3e635\", \"#4ade80\"];\n\nexport function FormSignup({\n  title = \"Create your account\",\n  subtitle = \"Free for 14 days. No credit card required.\",\n  brand = \"Lumen\",\n  takenUsernames = [\"admin\", \"maya\", \"lumen\", \"support\", \"root\", \"design\"],\n  emailDomains = [\"gmail.com\", \"outlook.com\", \"yahoo.com\", \"icloud.com\", \"hotmail.com\", \"proton.me\"],\n  resendSeconds = 30,\n  submitLabel = \"Create account\",\n  accent = \"#8b5cf6\",\n  delay = 1200,\n  onSubmit,\n  onResend,\n  className,\n  style,\n  ...rest\n}: FormSignupProps) {\n  const uid = React.useId();\n  const [email, setEmail] = React.useState(\"\");\n  const [username, setUsername] = React.useState(\"\");\n  const [password, setPassword] = React.useState(\"\");\n  const [visible, setVisible] = React.useState(false);\n  const [terms, setTerms] = React.useState(false);\n  const [touched, setTouched] = React.useState<Record<string, boolean>>({});\n  const [check, setCheck] = React.useState<\"idle\" | \"checking\" | \"free\" | \"taken\">(\"idle\");\n  const [status, setStatus] = React.useState<\"idle\" | \"loading\" | \"sent\">(\"idle\");\n  const [left, setLeft] = React.useState(0);\n  const timer = React.useRef<number | undefined>(undefined);\n  const tick = React.useRef<number | undefined>(undefined);\n  const refs = React.useRef<Record<string, HTMLInputElement | null>>({});\n\n  React.useEffect(() => () => {\n    window.clearTimeout(timer.current);\n    window.clearInterval(tick.current);\n  }, []);\n\n  const taken = React.useMemo(() => new Set(takenUsernames.map((t) => t.toLowerCase())), [takenUsernames]);\n\n  const startCountdown = () => {\n    window.clearInterval(tick.current);\n    setLeft(resendSeconds);\n    tick.current = window.setInterval(() => {\n      setLeft((s) => {\n        if (s <= 1) window.clearInterval(tick.current);\n        return Math.max(0, s - 1);\n      });\n    }, 1000);\n  };\n\n  const onUser = (e: React.ChangeEvent<HTMLInputElement>) => {\n    const next = e.target.value.toLowerCase().replace(/[^a-z0-9_]/g, \"\").slice(0, 20);\n    setUsername(next);\n    window.clearTimeout(timer.current);\n    if (!userRe.test(next)) {\n      setCheck(\"idle\");\n      return;\n    }\n    setCheck(\"checking\");\n    timer.current = window.setTimeout(() => setCheck(taken.has(next) ? \"taken\" : \"free\"), 650);\n  };\n\n  const domain = email.split(\"@\")[1]?.toLowerCase() ?? \"\";\n  let suggestion = \"\";\n  if (domain.includes(\".\") && !emailDomains.includes(domain)) {\n    let best = \"\";\n    let bestD = 3;\n    for (const d of emailDomains) {\n      const dd = distance(domain, d);\n      if (dd < bestD) {\n        best = d;\n        bestD = dd;\n      }\n    }\n    if (best) suggestion = `${email.split(\"@\")[0]}@${best}`;\n  }\n\n  const passed = rules.filter((r) => r.test(password)).length;\n  const errors: Record<string, string> = {};\n  if (!emailRe.test(email.trim())) errors.email = email ? \"Enter a complete email address.\" : \"Email is required.\";\n  if (!userRe.test(username)) errors.username = \"3 to 20 letters, numbers or underscores.\";\n  else if (check === \"taken\") errors.username = \"That username is taken.\";\n  if (passed < 4) errors.password = \"Your password needs all four checks.\";\n  if (!terms) errors.terms = \"Please accept the terms to continue.\";\n  const show = (k: string) => (touched[k] ? errors[k] : undefined);\n  const alt = `${username}${(hashText(username) % 89) + 10}`;\n\n  const submit = async (e: React.FormEvent) => {\n    e.preventDefault();\n    if (status === \"loading\") return;\n    if (Object.keys(errors).length || check === \"checking\") {\n      setTouched({ email: true, username: true, password: true, terms: true });\n      const first = [\"email\", \"username\", \"password\", \"terms\"].find((k) => errors[k]);\n      if (first) refs.current[first]?.focus();\n      return;\n    }\n    setStatus(\"loading\");\n    try {\n      await Promise.all([Promise.resolve(onSubmit?.({ email: email.trim(), username, password })), new Promise((r) => window.setTimeout(r, delay))]);\n      setStatus(\"sent\");\n      startCountdown();\n    } catch {\n      setStatus(\"idle\");\n    }\n  };\n\n  const userState = show(\"username\") ? \"bad\" : check === \"free\" ? \"good\" : undefined;\n\n  return (\n    <div className={[\"hb-xh2\", className].filter(Boolean).join(\" \")} style={{ ...style, \"--hb-xh2-a\": accent } as React.CSSProperties} {...rest}>\n      <style href=\"hb-form-signup\" precedence=\"default\">{css}</style>\n      <div className=\"hb-xh2-card\">\n        {status === \"sent\" ? (\n          <div className=\"hb-xh2-done\" role=\"status\">\n            <div className=\"hb-xh2-env\" aria-hidden=\"true\">\n              <svg viewBox=\"0 0 74 58\">\n                <rect className=\"hb-xh2-letter\" x=\"14\" y=\"10\" width=\"46\" height=\"34\" rx=\"4\" fill=\"#f4f4f5\" />\n                <path className=\"hb-xh2-letter\" d=\"M22 20h24M22 27h30M22 34h18\" stroke=\"#a1a1aa\" strokeWidth=\"2.4\" strokeLinecap=\"round\" />\n                <path d=\"M4 18v32a4 4 0 0 0 4 4h58a4 4 0 0 0 4-4V18L37 38 4 18Z\" fill={accent} />\n                <path d=\"M4 50 30 32M70 50 44 32\" stroke=\"rgba(0,0,0,0.25)\" strokeWidth=\"1.5\" />\n                <path className=\"hb-xh2-flap\" d=\"M4 18 37 38 70 18 37 14Z\" fill=\"rgba(255,255,255,0.2)\" />\n              </svg>\n            </div>\n            <h3>Check your inbox</h3>\n            <p>We sent a verification link to <strong>{email.trim()}</strong>. It expires in 24 hours.</p>\n            <div className=\"hb-xh2-acts\">\n              <button\n                type=\"button\"\n                className=\"hb-xh2-sec\"\n                disabled={left > 0}\n                onClick={() => { onResend?.(email.trim()); startCountdown(); }}\n              >\n                {left > 0 ? `Resend in 0:${left.toString().padStart(2, \"0\")}` : \"Resend email\"}\n              </button>\n              <button type=\"button\" className=\"hb-xh2-sec\" onClick={() => { setStatus(\"idle\"); window.clearInterval(tick.current); }}>\n                Use a different email\n              </button>\n            </div>\n          </div>\n        ) : (\n          <>\n            <div className=\"hb-xh2-brand\"><span className=\"hb-xh2-mark\" aria-hidden=\"true\" />{brand}</div>\n            <h3 className=\"hb-xh2-title\">{title}</h3>\n            <p className=\"hb-xh2-sub\">{subtitle}</p>\n            <form className=\"hb-xh2-form\" onSubmit={submit} noValidate>\n              <div className=\"hb-xh2-field\">\n                <label className=\"hb-xh2-label\" htmlFor={`${uid}-email`}>Email</label>\n                <div className=\"hb-xh2-box\" data-state={show(\"email\") ? \"bad\" : undefined}>\n                  <input\n                    ref={(el) => { refs.current.email = el; }}\n                    id={`${uid}-email`}\n                    className=\"hb-xh2-in\"\n                    type=\"email\"\n                    autoComplete=\"email\"\n                    placeholder=\"you@company.com\"\n                    value={email}\n                    onChange={(e) => setEmail(e.target.value.trim())}\n                    onBlur={() => setTouched((t) => ({ ...t, email: true }))}\n                    aria-invalid={show(\"email\") ? true : undefined}\n                    aria-describedby={`${uid}-email-m`}\n                  />\n                </div>\n                <div id={`${uid}-email-m`} aria-live=\"polite\">\n                  {suggestion ? (\n                    <p className=\"hb-xh2-hint\">\n                      Did you mean{\" \"}\n                      <button type=\"button\" className=\"hb-xh2-fix\" onClick={() => setEmail(suggestion)}>{suggestion}</button>?\n                    </p>\n                  ) : show(\"email\") ? (\n                    <p className=\"hb-xh2-msg\">{show(\"email\")}</p>\n                  ) : null}\n                </div>\n              </div>\n              <div className=\"hb-xh2-field\">\n                <label className=\"hb-xh2-label\" htmlFor={`${uid}-user`}>Username</label>\n                <div className=\"hb-xh2-box\" data-state={userState}>\n                  <span className=\"hb-xh2-pre\" aria-hidden=\"true\">{brand.toLowerCase().replace(/[^a-z0-9]/g, \"\")}.app/</span>\n                  <input\n                    ref={(el) => { refs.current.username = el; }}\n                    id={`${uid}-user`}\n                    className=\"hb-xh2-in\"\n                    autoComplete=\"username\"\n                    placeholder=\"maya_chen\"\n                    value={username}\n                    onChange={onUser}\n                    onBlur={() => setTouched((t) => ({ ...t, username: true }))}\n                    aria-invalid={show(\"username\") ? true : undefined}\n                    aria-describedby={`${uid}-user-m`}\n                  />\n                  <span className=\"hb-xh2-side\" aria-live=\"polite\">\n                    {check === \"checking\" ? <span className=\"hb-xh2-tag\" data-tone=\"wait\"><span className=\"hb-xh2-ring\" />Checking</span> : null}\n                    {check === \"free\" ? (\n                      <span className=\"hb-xh2-tag\" data-tone=\"ok\">\n                        <svg viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\"><path d=\"m4 8.5 2.5 2.5L12 5.5\" /></svg>\n                        Available\n                      </span>\n                    ) : null}\n                    {check === \"taken\" ? <span className=\"hb-xh2-tag\" data-tone=\"bad\">Taken</span> : null}\n                  </span>\n                </div>\n                <div id={`${uid}-user-m`}>\n                  {check === \"taken\" ? (\n                    <p className=\"hb-xh2-hint\">\n                      Try{\" \"}\n                      <button\n                        type=\"button\"\n                        className=\"hb-xh2-fix\"\n                        onClick={() => { setUsername(alt); setCheck(taken.has(alt) ? \"taken\" : \"free\"); }}\n                      >\n                        {alt}\n                      </button>{\" \"}\n                      instead.\n                    </p>\n                  ) : show(\"username\") ? <p className=\"hb-xh2-msg\">{show(\"username\")}</p> : null}\n                </div>\n              </div>\n              <div className=\"hb-xh2-field\">\n                <label className=\"hb-xh2-label\" htmlFor={`${uid}-pw`}>Password</label>\n                <div className=\"hb-xh2-box\" data-state={show(\"password\") ? \"bad\" : passed === 4 ? \"good\" : undefined}>\n                  <input\n                    ref={(el) => { refs.current.password = el; }}\n                    id={`${uid}-pw`}\n                    className=\"hb-xh2-in\"\n                    type={visible ? \"text\" : \"password\"}\n                    autoComplete=\"new-password\"\n                    placeholder=\"At least 8 characters\"\n                    value={password}\n                    onChange={(e) => setPassword(e.target.value)}\n                    onBlur={() => setTouched((t) => ({ ...t, password: true }))}\n                    aria-invalid={show(\"password\") ? true : undefined}\n                    aria-describedby={`${uid}-pw-r`}\n                  />\n                  <span className=\"hb-xh2-side\">\n                    <button type=\"button\" className=\"hb-xh2-eye\" onClick={() => setVisible((v) => !v)} aria-label={visible ? \"Hide password\" : \"Show password\"} aria-pressed={visible}>\n                      <svg 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                        {visible ? null : <path d=\"M4 4l16 16\" />}\n                      </svg>\n                    </button>\n                  </span>\n                </div>\n                <div className=\"hb-xh2-rules\" id={`${uid}-pw-r`} style={{ \"--hb-xh2-s\": strengthColor[passed] } as React.CSSProperties}>\n                  {rules.map((r) => (\n                    <div key={r.label} className=\"hb-xh2-rule\" data-ok={r.test(password)}>\n                      <span className=\"hb-xh2-bar\"><i /></span>\n                      <span>{r.label}</span>\n                    </div>\n                  ))}\n                </div>\n              </div>\n              <label className=\"hb-xh2-check\" data-bad={show(\"terms\") ? true : undefined}>\n                <input\n                  ref={(el) => { refs.current.terms = el; }}\n                  type=\"checkbox\"\n                  checked={terms}\n                  onChange={(e) => setTerms(e.target.checked)}\n                  aria-invalid={show(\"terms\") ? true : undefined}\n                />\n                <span className=\"hb-xh2-tick\" aria-hidden=\"true\">\n                  <svg viewBox=\"0 0 12 12\" fill=\"none\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\"><path d=\"m2.5 6.2 2.3 2.3 4.7-5\" /></svg>\n                </span>\n                <span>I agree to the <a href=\"#terms\">Terms</a> and <a href=\"#privacy\">Privacy Policy</a>.</span>\n              </label>\n              <button type=\"submit\" className=\"hb-xh2-go\" aria-busy={status === \"loading\"}>\n                <span className=\"hb-xh2-gol\">\n                  {status === \"loading\" ? (\n                    <>\n                      Creating account\n                      <span className=\"hb-xh2-dots\" aria-hidden=\"true\"><i /><i /><i /></span>\n                    </>\n                  ) : submitLabel}\n                </span>\n              </button>\n              <p className=\"hb-xh2-alt\">Already have an account? <a href=\"#signin\">Sign in</a></p>\n            </form>\n          </>\n        )}\n      </div>\n    </div>\n  );\n}\n"
    }
  ]
}