{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "form-waitlist",
  "type": "registry:component",
  "title": "Waitlist Form",
  "description": "A waitlist form with a live priority meter: every optional answer moves your estimated spot forward and up through access tiers. Joining reveals a referral link with copy feedback.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "forms",
    "form",
    "waitlist",
    "beta",
    "referral",
    "gamified",
    "launch"
  ],
  "docs": "https://hyperblur.dev/effects/form-waitlist",
  "files": [
    {
      "path": "registry/hyperblur/form-waitlist.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/form-waitlist.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface FormWaitlistValues {\n  email: string;\n  useCase: string;\n  teamSize: number;\n  website: string;\n  source: string;\n}\n\nexport interface FormWaitlistProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onSubmit\" | \"title\"> {\n  product?: string;\n  title?: string;\n  queueLength?: number;\n  useCases?: string[];\n  sources?: string[];\n  referralBase?: string;\n  accent?: string;\n  delay?: number;\n  onSubmit?: (values: FormWaitlistValues, position: number) => void | Promise<void>;\n}\n\nconst tiers = [\"General\", \"Next wave\", \"Priority\", \"First access\"];\n\nconst css = `\n.hb-xh10 {\n  --hb-xh10-a: #a3e635;\n  box-sizing: border-box;\n  width: 100%;\n  max-width: 440px;\n  margin: 0 auto;\n  font-family: inherit;\n  color: #ededed;\n}\n.hb-xh10 *, .hb-xh10 *::before, .hb-xh10 *::after { box-sizing: border-box; }\n.hb-xh10-card { position: relative; overflow: hidden; border: 1px solid #252525; border-radius: 20px; background: #0d0d0d; box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 30px 60px -30px rgba(0,0,0,0.9); }\n.hb-xh10-meter { position: relative; padding: 16px 18px 14px; background: linear-gradient(180deg, color-mix(in srgb, var(--hb-xh10-a) 9%, #111), #0d0d0d); border-bottom: 1px solid #1e1e1e; }\n.hb-xh10-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }\n.hb-xh10-kick { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: #8a8a8a; }\n.hb-xh10-pos { display: block; margin-top: 2px; font-family: var(--font-grotesk, inherit); font-size: 30px; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1; }\n.hb-xh10-pos small { font-size: 14px; color: #6f6f6f; font-weight: 500; letter-spacing: 0; margin-left: 6px; }\n.hb-xh10-tier { padding: 4px 9px; border-radius: 999px; background: color-mix(in srgb, var(--hb-xh10-a) 16%, transparent); color: var(--hb-xh10-a); font-size: 11.5px; font-weight: 600; white-space: nowrap; transition: background 0.3s ease; }\n.hb-xh10-lane { position: relative; height: 8px; margin: 14px 0 6px; border-radius: 8px; background: #1c1c1c; box-shadow: inset 0 1px 2px rgba(0,0,0,0.6); }\n.hb-xh10-fill { position: absolute; inset: 0 auto 0 0; width: calc(var(--hb-xh10-p) * 100%); border-radius: inherit; background: linear-gradient(90deg, color-mix(in srgb, var(--hb-xh10-a) 30%, #1c1c1c), var(--hb-xh10-a)); box-shadow: 0 0 14px color-mix(in srgb, var(--hb-xh10-a) 60%, transparent); transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1); }\n.hb-xh10-knob { position: absolute; top: 50%; left: calc(var(--hb-xh10-p) * 100%); width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: #fff; border: 3px solid var(--hb-xh10-a); box-shadow: 0 0 0 4px color-mix(in srgb, var(--hb-xh10-a) 22%, transparent); transition: left 0.7s cubic-bezier(0.22, 1, 0.36, 1); }\n.hb-xh10-ticks { position: absolute; inset: 0; display: flex; justify-content: space-between; padding: 0 25%; pointer-events: none; }\n.hb-xh10-ticks i { width: 1px; height: 100%; background: rgba(0,0,0,0.5); }\n.hb-xh10-names { display: grid; grid-template-columns: repeat(4, 1fr); font-size: 10.5px; color: #5f5f5f; }\n.hb-xh10-names span { transition: color 0.3s ease; }\n.hb-xh10-names span:nth-child(2) { text-align: center; padding-right: 10%; }\n.hb-xh10-names span:nth-child(3) { text-align: center; padding-left: 10%; }\n.hb-xh10-names span:last-child { text-align: right; }\n.hb-xh10-names span[data-on=\"true\"] { color: #d4d4d4; }\n.hb-xh10-form { display: grid; gap: 13px; padding: 16px 18px 18px; }\n.hb-xh10-f { display: grid; gap: 6px; }\n.hb-xh10-l { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; font-weight: 500; color: #b0b0b0; }\n.hb-xh10-l em { font-style: normal; font-size: 11px; font-weight: 500; color: var(--hb-xh10-a); opacity: 0; transform: translateY(3px); transition: opacity 0.3s ease, transform 0.3s ease; }\n.hb-xh10-f[data-done=\"true\"] .hb-xh10-l em { opacity: 1; transform: none; }\n.hb-xh10-in { width: 100%; height: 40px; padding: 0 12px; border: 1px solid #272727; border-radius: 10px; background: #090909; color: #ededed; font: inherit; font-size: 14px; outline: none; transition: border-color 0.18s ease, box-shadow 0.18s ease; }\n.hb-xh10-in::placeholder { color: #4f4f4f; }\n.hb-xh10-in:focus { border-color: var(--hb-xh10-a); box-shadow: 0 0 0 3px color-mix(in srgb, var(--hb-xh10-a) 18%, transparent); }\n.hb-xh10-in[aria-invalid=\"true\"] { border-color: #f05260; box-shadow: 0 0 0 3px rgba(240,82,96,0.12); }\n.hb-xh10-e { margin: 0; font-size: 11.5px; color: #ff8a95; }\n.hb-xh10-chips { display: flex; flex-wrap: wrap; gap: 6px; }\n.hb-xh10-chip { height: 30px; padding: 0 11px; border: 1px solid #272727; border-radius: 999px; background: #121212; color: #a8a8a8; font: inherit; font-size: 12.5px; cursor: pointer; transition: all 0.2s ease; }\n.hb-xh10-chip:hover { color: #eee; border-color: #3a3a3a; }\n.hb-xh10-chip[aria-checked=\"true\"] { border-color: var(--hb-xh10-a); color: #0b1203; background: var(--hb-xh10-a); font-weight: 600; }\n.hb-xh10-chip:focus-visible { outline: 2px solid var(--hb-xh10-a); outline-offset: 2px; }\n.hb-xh10-range { display: flex; align-items: center; gap: 12px; }\n.hb-xh10-range input { flex: 1; height: 22px; margin: 0; appearance: none; -webkit-appearance: none; background: transparent; cursor: pointer; }\n.hb-xh10-range input::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: linear-gradient(90deg, var(--hb-xh10-a) calc(var(--hb-xh10-r) * 100%), #222 calc(var(--hb-xh10-r) * 100%)); }\n.hb-xh10-range input::-moz-range-track { height: 6px; border-radius: 6px; background: linear-gradient(90deg, var(--hb-xh10-a) calc(var(--hb-xh10-r) * 100%), #222 calc(var(--hb-xh10-r) * 100%)); }\n.hb-xh10-range input::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -6px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 2px 6px rgba(0,0,0,0.6), 0 0 0 4px color-mix(in srgb, var(--hb-xh10-a) 25%, transparent); transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1); }\n.hb-xh10-range input::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 2px 6px rgba(0,0,0,0.6); }\n.hb-xh10-range input:active::-webkit-slider-thumb { transform: scale(1.15); }\n.hb-xh10-range input:focus-visible { outline: 2px solid var(--hb-xh10-a); outline-offset: 4px; border-radius: 6px; }\n.hb-xh10-range output { min-width: 58px; text-align: right; font-family: var(--font-mono, ui-monospace, monospace); font-size: 12px; color: #d0d0d0; font-variant-numeric: tabular-nums; }\n.hb-xh10-two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }\n.hb-xh10-selw { position: relative; }\n.hb-xh10-selw select { appearance: none; padding-right: 28px; cursor: pointer; }\n.hb-xh10-selw svg { position: absolute; right: 10px; top: 50%; width: 12px; height: 12px; transform: translateY(-50%); color: #777; pointer-events: none; }\n.hb-xh10-go { position: relative; height: 44px; border: 0; border-radius: 12px; background: var(--hb-xh10-a); color: #0b1203; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), inset 0 -2px 0 rgba(0,0,0,0.15), 0 10px 24px -12px var(--hb-xh10-a); transition: transform 0.15s cubic-bezier(0.3, 0.7, 0.4, 1), filter 0.2s ease; }\n.hb-xh10-go:hover { filter: brightness(1.06); }\n.hb-xh10-go:active { transform: scale(0.98); }\n.hb-xh10-go:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }\n.hb-xh10-go[aria-busy=\"true\"] { cursor: progress; }\n.hb-xh10-done { display: grid; gap: 12px; padding: 16px 18px 18px; animation: hb-xh10-in 0.5s cubic-bezier(0.22, 1, 0.36, 1); }\n.hb-xh10-done h3 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }\n.hb-xh10-done p { margin: -6px 0 0; font-size: 13px; color: #8f8f8f; line-height: 1.5; }\n.hb-xh10-ref { display: flex; align-items: center; gap: 6px; height: 42px; padding: 0 5px 0 12px; border: 1px dashed #333; border-radius: 11px; background: #0a0a0a; }\n.hb-xh10-ref code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono, ui-monospace, monospace); font-size: 12.5px; color: #d4d4d4; }\n.hb-xh10-copy { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 0; border-radius: 8px; background: #1e1e1e; color: #ededed; font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer; transition: background 0.2s ease, color 0.2s ease; }\n.hb-xh10-copy:hover { background: #262626; }\n.hb-xh10-copy[data-copied=\"true\"] { background: var(--hb-xh10-a); color: #0b1203; }\n.hb-xh10-copy:focus-visible { outline: 2px solid var(--hb-xh10-a); outline-offset: 2px; }\n.hb-xh10-copy svg { width: 13px; height: 13px; }\n.hb-xh10-perks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }\n.hb-xh10-perk { padding: 9px 10px; border-radius: 10px; background: #131313; border: 1px solid #1f1f1f; }\n.hb-xh10-perk b { display: block; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--hb-xh10-a); }\n.hb-xh10-perk span { font-size: 11px; color: #7a7a7a; }\n@keyframes hb-xh10-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }\n@media (prefers-reduced-motion: reduce) {\n  .hb-xh10 *, .hb-xh10 *::before, .hb-xh10 *::after { animation: none !important; transition: none !important; }\n}\n`;\n\nconst emailRe = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]{2,}$/;\nconst teamSteps = [1, 5, 10, 25, 50, 100, 250, 500];\n\nfunction useTween(target: number) {\n  const [value, setValue] = React.useState(target);\n  const from = React.useRef(target);\n  React.useEffect(() => {\n    const start = from.current;\n    if (start === target) return;\n    if (window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) {\n      from.current = target;\n      const id = window.requestAnimationFrame(() => setValue(target));\n      return () => window.cancelAnimationFrame(id);\n    }\n    let raf = 0;\n    let t0 = 0;\n    const step = (t: number) => {\n      if (!t0) t0 = t;\n      const k = Math.min(1, (t - t0) / 700);\n      const e = 1 - Math.pow(1 - k, 3);\n      const v = Math.round(start + (target - start) * e);\n      from.current = v;\n      setValue(v);\n      if (k < 1) raf = window.requestAnimationFrame(step);\n    };\n    raf = window.requestAnimationFrame(step);\n    return () => window.cancelAnimationFrame(raf);\n  }, [target]);\n  return value;\n}\n\nexport function FormWaitlist({\n  product = \"Orbit\",\n  title = \"Join the beta\",\n  queueLength = 6240,\n  useCases = [\"Client sites\", \"Internal tools\", \"SaaS product\", \"Side project\"],\n  sources = [\"A friend\", \"X / Twitter\", \"Newsletter\", \"Podcast\", \"Search\"],\n  referralBase = \"orbit.so/r/\",\n  accent = \"#a3e635\",\n  delay = 1100,\n  onSubmit,\n  className,\n  style,\n  ...rest\n}: FormWaitlistProps) {\n  const uid = React.useId();\n  const [email, setEmail] = React.useState(\"\");\n  const [useCase, setUseCase] = React.useState(\"\");\n  const [teamIdx, setTeamIdx] = React.useState(1);\n  const [website, setWebsite] = React.useState(\"\");\n  const [source, setSource] = React.useState(\"\");\n  const [tried, setTried] = React.useState(false);\n  const [status, setStatus] = React.useState<\"idle\" | \"busy\" | \"done\">(\"idle\");\n  const [copied, setCopied] = React.useState(false);\n  const emailRef = React.useRef<HTMLInputElement>(null);\n  const timer = React.useRef<number | undefined>(undefined);\n\n  React.useEffect(() => () => window.clearTimeout(timer.current), []);\n\n  const emailOk = emailRe.test(email.trim());\n  const siteOk = /^([a-z0-9-]+\\.)+[a-z]{2,}(\\/.*)?$/i.test(website.trim().replace(/^https?:[/][/]/, \"\"));\n  const score = (emailOk ? 0.22 : 0) + (useCase ? 0.2 : 0) + Math.min(0.2, teamIdx * 0.03) + (siteOk ? 0.22 : 0) + (source ? 0.12 : 0);\n  const position = Math.max(1, Math.round(queueLength * (1 - score * 0.82)));\n  const shown = useTween(position);\n  const tier = Math.min(3, Math.floor(score * 4.2));\n  const team = teamSteps[teamIdx];\n\n  const submit = async (e: React.FormEvent) => {\n    e.preventDefault();\n    if (status !== \"idle\") return;\n    if (!emailOk) {\n      setTried(true);\n      emailRef.current?.focus();\n      return;\n    }\n    setStatus(\"busy\");\n    try {\n      const values = { email: email.trim(), useCase, teamSize: team, website: website.trim(), source };\n      await Promise.all([Promise.resolve(onSubmit?.(values, position)), new Promise((r) => window.setTimeout(r, delay))]);\n      setStatus(\"done\");\n    } catch {\n      setStatus(\"idle\");\n    }\n  };\n\n  const code = email.split(\"@\")[0]?.toLowerCase().replace(/[^a-z0-9]/g, \"\").slice(0, 10) || \"you\";\n  const link = `${referralBase}${code}`;\n\n  const copy = async () => {\n    try {\n      await navigator.clipboard.writeText(`https://${link}`);\n    } catch {\n      return;\n    }\n    setCopied(true);\n    window.clearTimeout(timer.current);\n    timer.current = window.setTimeout(() => setCopied(false), 1600);\n  };\n\n  const plus = (n: number) => <em>+{n} spots</em>;\n\n  return (\n    <div className={[\"hb-xh10\", className].filter(Boolean).join(\" \")} style={{ ...style, \"--hb-xh10-a\": accent, \"--hb-xh10-p\": score.toFixed(3) } as React.CSSProperties} {...rest}>\n      <style href=\"hb-form-waitlist\" precedence=\"default\">{css}</style>\n      <div className=\"hb-xh10-card\">\n        <div className=\"hb-xh10-meter\">\n          <div className=\"hb-xh10-top\">\n            <div>\n              <span className=\"hb-xh10-kick\">{status === \"done\" ? \"Your spot\" : `${title} · estimated spot`}</span>\n              <span className=\"hb-xh10-pos\" aria-live=\"polite\">\n                #{shown.toLocaleString(\"en-US\")}\n                <small>of {queueLength.toLocaleString(\"en-US\")}</small>\n              </span>\n            </div>\n            <span className=\"hb-xh10-tier\">{tiers[tier]}</span>\n          </div>\n          <div className=\"hb-xh10-lane\" aria-hidden=\"true\">\n            <span className=\"hb-xh10-fill\" />\n            <span className=\"hb-xh10-ticks\"><i /><i /><i /></span>\n            <span className=\"hb-xh10-knob\" />\n          </div>\n          <div className=\"hb-xh10-names\" aria-hidden=\"true\">\n            {tiers.map((t, i) => <span key={t} data-on={i <= tier}>{t}</span>)}\n          </div>\n        </div>\n        {status === \"done\" ? (\n          <div className=\"hb-xh10-done\" role=\"status\">\n            <h3>You are on the {product} list</h3>\n            <p>We will email {email.trim()} when your wave opens. Every friend who joins with your link moves you up 120 spots.</p>\n            <div className=\"hb-xh10-ref\">\n              <code>{link}</code>\n              <button type=\"button\" className=\"hb-xh10-copy\" data-copied={copied} onClick={copy}>\n                <svg viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n                  {copied ? <path d=\"m3.5 8.5 3 3 6-7\" /> : <><rect x=\"5\" y=\"5\" width=\"9\" height=\"9\" rx=\"2\" /><path d=\"M11 5V3.5A1.5 1.5 0 0 0 9.5 2h-6A1.5 1.5 0 0 0 2 3.5v6A1.5 1.5 0 0 0 3.5 11H5\" /></>}\n                </svg>\n                {copied ? \"Copied\" : \"Copy link\"}\n              </button>\n            </div>\n            <div className=\"hb-xh10-perks\">\n              <div className=\"hb-xh10-perk\"><b>0</b><span>friends joined</span></div>\n              <div className=\"hb-xh10-perk\"><b>120</b><span>spots per invite</span></div>\n              <div className=\"hb-xh10-perk\"><b>3</b><span>invites to Priority</span></div>\n            </div>\n          </div>\n        ) : (\n          <form className=\"hb-xh10-form\" onSubmit={submit} noValidate>\n            <div className=\"hb-xh10-f\" data-done={emailOk}>\n              <label className=\"hb-xh10-l\" htmlFor={`${uid}-em`}>Work email {plus(Math.round(queueLength * 0.22 * 0.82))}</label>\n              <input\n                ref={emailRef}\n                id={`${uid}-em`}\n                className=\"hb-xh10-in\"\n                type=\"email\"\n                autoComplete=\"email\"\n                placeholder=\"ana@foundry.studio\"\n                value={email}\n                onChange={(e) => setEmail(e.target.value)}\n                aria-invalid={tried && !emailOk ? true : undefined}\n                aria-describedby={tried && !emailOk ? `${uid}-em-e` : undefined}\n              />\n              {tried && !emailOk ? <p className=\"hb-xh10-e\" id={`${uid}-em-e`}>We need a valid email to hold your spot.</p> : null}\n            </div>\n            <div className=\"hb-xh10-f\" data-done={Boolean(useCase)}>\n              <span className=\"hb-xh10-l\" id={`${uid}-uc`}>What will you build? {plus(Math.round(queueLength * 0.2 * 0.82))}</span>\n              <div className=\"hb-xh10-chips\" role=\"radiogroup\" aria-labelledby={`${uid}-uc`}>\n                {useCases.map((u) => (\n                  <button key={u} type=\"button\" role=\"radio\" aria-checked={useCase === u} className=\"hb-xh10-chip\" onClick={() => setUseCase(useCase === u ? \"\" : u)}>{u}</button>\n                ))}\n              </div>\n            </div>\n            <div className=\"hb-xh10-f\" data-done={teamIdx > 1}>\n              <label className=\"hb-xh10-l\" htmlFor={`${uid}-ts`}>Team size {plus(Math.round(queueLength * Math.min(0.2, teamIdx * 0.03) * 0.82))}</label>\n              <div className=\"hb-xh10-range\" style={{ \"--hb-xh10-r\": (teamIdx / (teamSteps.length - 1)).toFixed(3) } as React.CSSProperties}>\n                <input id={`${uid}-ts`} type=\"range\" min={0} max={teamSteps.length - 1} step={1} value={teamIdx} onChange={(e) => setTeamIdx(Number(e.target.value))} aria-valuetext={`${team}${teamIdx === teamSteps.length - 1 ? \"+\" : \"\"} people`} />\n                <output htmlFor={`${uid}-ts`}>{team}{teamIdx === teamSteps.length - 1 ? \"+\" : \"\"} {team === 1 ? \"person\" : \"people\"}</output>\n              </div>\n            </div>\n            <div className=\"hb-xh10-two\">\n              <div className=\"hb-xh10-f\" data-done={siteOk}>\n                <label className=\"hb-xh10-l\" htmlFor={`${uid}-ws`}>Website {plus(Math.round(queueLength * 0.22 * 0.82))}</label>\n                <input id={`${uid}-ws`} className=\"hb-xh10-in\" placeholder=\"foundry.studio\" autoComplete=\"url\" value={website} onChange={(e) => setWebsite(e.target.value)} />\n              </div>\n              <div className=\"hb-xh10-f\" data-done={Boolean(source)}>\n                <label className=\"hb-xh10-l\" htmlFor={`${uid}-src`}>Heard from {plus(Math.round(queueLength * 0.12 * 0.82))}</label>\n                <div className=\"hb-xh10-selw\">\n                  <select id={`${uid}-src`} className=\"hb-xh10-in\" value={source} onChange={(e) => setSource(e.target.value)}>\n                    <option value=\"\">Choose</option>\n                    {sources.map((s) => <option key={s} value={s}>{s}</option>)}\n                  </select>\n                  <svg viewBox=\"0 0 12 12\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\"><path d=\"m3 4.5 3 3 3-3\" /></svg>\n                </div>\n              </div>\n            </div>\n            <button type=\"submit\" className=\"hb-xh10-go\" aria-busy={status === \"busy\"}>\n              {status === \"busy\" ? \"Saving your spot...\" : `Claim spot #${position.toLocaleString(\"en-US\")}`}\n            </button>\n          </form>\n        )}\n      </div>\n    </div>\n  );\n}\n"
    }
  ]
}