{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "auth-status-rail",
  "type": "registry:component",
  "title": "Auth Status Rail",
  "description": "A sign-in card with a live status rail beside the form: edge latency with a moving sparkline, workspace detection that switches to SSO for known domains, password policy, device trust and session issuance, each lighting up as you type.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "auth",
    "auth",
    "login",
    "sso",
    "status",
    "timeline",
    "security"
  ],
  "docs": "https://hyperblur.dev/effects/auth-status-rail",
  "files": [
    {
      "path": "registry/hyperblur/auth-status-rail.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/auth-status-rail.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface AuthStatusRailValues {\n  email: string;\n  password: string;\n  sso: boolean;\n}\n\nexport interface AuthStatusRailProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\" | \"onSubmit\"> {\n  brand?: string;\n  title?: string;\n  subtitle?: string;\n  region?: string;\n  device?: string;\n  ssoDomains?: string[];\n  pings?: number[];\n  defaultEmail?: string;\n  forgotHref?: string;\n  statusHref?: string;\n  onSubmit?: (values: AuthStatusRailValues) => boolean | void | Promise<boolean | void>;\n  accent?: string;\n}\n\nconst css = `\n.hb-vf7 {\n  --hb-vf7-accent: #34d399;\n  position: relative;\n  box-sizing: border-box;\n  width: 100%;\n  min-height: 600px;\n  display: grid;\n  place-items: center;\n  padding: 48px 20px;\n  background: #0a0a0a;\n  color: #ededed;\n  font-family: inherit;\n}\n.hb-vf7 *, .hb-vf7 *::before, .hb-vf7 *::after { box-sizing: border-box; }\n.hb-vf7 em { font-style: normal; }\n.hb-vf7-shell { width: 100%; max-width: 820px; container-type: inline-size; }\n.hb-vf7-card { display: grid; grid-template-columns: 1fr; border-radius: 20px; overflow: hidden; border: 1px solid #222; background: #0f0f0f; box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 40px 90px -40px rgba(0,0,0,.9); }\n@container (min-width: 680px) { .hb-vf7-card { grid-template-columns: 1.1fr .9fr; } }\n.hb-vf7-form { padding: 34px clamp(22px, 5cqw, 40px); }\n.hb-vf7-brand { display: flex; align-items: center; gap: 9px; margin-bottom: 24px; font-weight: 600; font-size: 14px; }\n.hb-vf7-brand i { width: 22px; height: 22px; border-radius: 6px; background: #ededed; display: grid; place-items: center; }\n.hb-vf7-title { margin: 0; font-size: 25px; letter-spacing: -.03em; line-height: 1.15; font-weight: 600; }\n.hb-vf7-sub { margin: 8px 0 24px; color: #8f8f8f; font-size: 14px; line-height: 1.55; }\n.hb-vf7-label { display: flex; justify-content: space-between; margin-bottom: 7px; font-size: 12.5px; color: #a1a1a1; }\n.hb-vf7-label a { color: #8f8f8f; text-decoration: none; }\n.hb-vf7-label a:hover { color: #ededed; }\n.hb-vf7-input { width: 100%; height: 44px; margin-bottom: 14px; padding: 0 14px; border-radius: 10px; border: 1px solid #262626; background: #0a0a0a; color: #ededed; font: inherit; font-size: 14px; outline: none; transition: border-color .2s, box-shadow .2s; }\n.hb-vf7-input:focus { border-color: var(--hb-vf7-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--hb-vf7-accent) 14%, transparent); }\n.hb-vf7-input[aria-invalid=\"true\"] { border-color: #ef5f5f; }\n.hb-vf7-pw { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .45s cubic-bezier(.2,.8,.2,1), opacity .3s; }\n.hb-vf7-pw[data-hidden=\"true\"] { grid-template-rows: 0fr; opacity: 0; }\n.hb-vf7-pw > div { overflow: hidden; }\n.hb-vf7-err { margin: -8px 0 12px; font-size: 12px; color: #f39494; }\n.hb-vf7-btn { width: 100%; height: 46px; margin-top: 4px; border: 0; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; font: inherit; font-size: 14.5px; font-weight: 600; color: #0a0a0a; background: #ededed; cursor: pointer; transition: background .2s, transform .2s cubic-bezier(.2,.8,.2,1); }\n.hb-vf7-btn:hover { background: #fff; }\n.hb-vf7-btn:active { transform: scale(.985); }\n.hb-vf7-btn:disabled { cursor: progress; }\n.hb-vf7-btn[data-sso=\"true\"] { background: var(--hb-vf7-accent); color: #04140d; }\n.hb-vf7-spin { width: 15px; height: 15px; border-radius: 50%; border: 2px solid rgba(0,0,0,.2); border-top-color: currentColor; animation: hb-vf7-rot .7s linear infinite; }\n.hb-vf7-alert { margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(239,95,95,.3); background: rgba(239,95,95,.08); color: #f6a3a3; font-size: 13px; }\n.hb-vf7-ok { padding: 8px 0; animation: hb-vf7-in .5s cubic-bezier(.2,.8,.2,1) both; }\n.hb-vf7-ok p { color: #8f8f8f; font-size: 14px; line-height: 1.55; margin: 8px 0 18px; }\n.hb-vf7-link { border: 0; background: none; padding: 0; font: inherit; font-size: 13px; color: #ededed; cursor: pointer; border-bottom: 1px solid #444; }\n.hb-vf7-rail { position: relative; padding: 28px 26px; border-top: 1px solid #1f1f1f; background: linear-gradient(180deg, #0c0c0c, #0a0a0a); }\n@container (min-width: 680px) { .hb-vf7-rail { border-top: 0; border-left: 1px solid #1f1f1f; } }\n.hb-vf7-rhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #6b6b6b; }\n.hb-vf7-rhead a { display: inline-flex; align-items: center; gap: 6px; color: #a1a1a1; text-decoration: none; letter-spacing: 0; text-transform: none; font-size: 12px; }\n.hb-vf7-rhead a i { width: 6px; height: 6px; border-radius: 50%; background: var(--hb-vf7-accent); animation: hb-vf7-blink 2s ease-in-out infinite; }\n.hb-vf7-list { list-style: none; margin: 0; padding: 0; position: relative; }\n.hb-vf7-list::before { content: \"\"; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 1px; background: #232323; }\n.hb-vf7-item { position: relative; display: grid; grid-template-columns: 15px 1fr; gap: 14px; padding-bottom: 18px; }\n.hb-vf7-item:last-child { padding-bottom: 0; }\n.hb-vf7-node { position: relative; z-index: 1; width: 15px; height: 15px; margin-top: 2px; border-radius: 50%; border: 1.5px solid #333; background: #0b0b0b; transition: border-color .4s, background .4s, box-shadow .4s; }\n.hb-vf7-item[data-s=\"ok\"] .hb-vf7-node { border-color: var(--hb-vf7-accent); background: color-mix(in srgb, var(--hb-vf7-accent) 25%, #0b0b0b); box-shadow: 0 0 12px -2px var(--hb-vf7-accent); }\n.hb-vf7-item[data-s=\"live\"] .hb-vf7-node { border-color: var(--hb-vf7-accent); }\n.hb-vf7-item[data-s=\"live\"] .hb-vf7-node::after { content: \"\"; position: absolute; inset: -5px; border-radius: 50%; border: 1px solid var(--hb-vf7-accent); animation: hb-vf7-pulse 1.8s cubic-bezier(.2,.7,.2,1) infinite; }\n.hb-vf7-item[data-s=\"warn\"] .hb-vf7-node { border-color: #f5a524; background: rgba(245,165,36,.2); }\n.hb-vf7-item[data-s=\"busy\"] .hb-vf7-node { border-color: var(--hb-vf7-accent); border-top-color: transparent; animation: hb-vf7-rot .8s linear infinite; }\n.hb-vf7-name { font-size: 13px; font-weight: 500; color: #ededed; display: flex; justify-content: space-between; gap: 10px; }\n.hb-vf7-name em { color: #6b6b6b; font-size: 11px; font-family: var(--font-mono), ui-monospace, monospace; font-weight: 400; }\n.hb-vf7-val { margin-top: 3px; font-size: 12.5px; color: #8f8f8f; line-height: 1.45; animation: hb-vf7-in .35s cubic-bezier(.2,.8,.2,1) both; }\n.hb-vf7-item[data-s=\"ok\"] .hb-vf7-val b { color: var(--hb-vf7-accent); font-weight: 500; }\n.hb-vf7-item[data-s=\"warn\"] .hb-vf7-val b { color: #f5a524; font-weight: 500; }\n.hb-vf7-spark { display: block; width: 100%; height: 26px; margin-top: 8px; overflow: visible; }\n.hb-vf7-spark path { fill: none; stroke: var(--hb-vf7-accent); stroke-width: 1.5; stroke-linejoin: round; transition: d .5s; }\n.hb-vf7 :is(.hb-vf7-btn, .hb-vf7-link, .hb-vf7-label a, .hb-vf7-rhead a):focus-visible { outline: 2px solid var(--hb-vf7-accent); outline-offset: 3px; border-radius: 6px; }\n@keyframes hb-vf7-rot { to { transform: rotate(360deg); } }\n@keyframes hb-vf7-pulse { 0% { opacity: .9; transform: scale(.6); } 100% { opacity: 0; transform: scale(1.4); } }\n@keyframes hb-vf7-blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }\n@keyframes hb-vf7-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }\n@media (prefers-reduced-motion: reduce) {\n  .hb-vf7 *, .hb-vf7 *::before, .hb-vf7 *::after { animation: none !important; transition: none !important; }\n}\n`;\n\nconst isEmail = (v: string) => /^[^\\s@]+@[^\\s@]+\\.[^\\s@]{2,}$/.test(v.trim());\n\nexport function AuthStatusRail({\n  brand = \"Relaybase\",\n  title = \"Sign in to Relaybase\",\n  subtitle = \"Every step of your sign-in is checked in the open. Watch the rail as you go.\",\n  region = \"fra1 Frankfurt\",\n  device = \"MacBook Pro, Lisbon\",\n  ssoDomains = [\"acme.com\", \"globex.io\"],\n  pings = [23, 21, 26, 22, 24, 31, 22, 20, 23, 25, 21, 22],\n  defaultEmail = \"\",\n  forgotHref = \"#forgot\",\n  statusHref = \"#status\",\n  onSubmit,\n  accent = \"#34d399\",\n  className,\n  style,\n  ...rest\n}: AuthStatusRailProps) {\n  const id = React.useId();\n  const [email, setEmail] = React.useState(defaultEmail);\n  const [password, setPassword] = React.useState(\"\");\n  const [touched, setTouched] = React.useState(false);\n  const [status, setStatus] = React.useState<\"idle\" | \"loading\" | \"success\">(\"idle\");\n  const [error, setError] = React.useState<string | null>(null);\n  const [tick, setTick] = React.useState(0);\n\n  React.useEffect(() => {\n    if (window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) return;\n    const t = window.setInterval(() => setTick((n) => n + 1), 1600);\n    return () => window.clearInterval(t);\n  }, []);\n\n  const emailOk = isEmail(email);\n  const domain = emailOk ? email.trim().split(\"@\")[1].toLowerCase() : \"\";\n  const sso = emailOk && ssoDomains.includes(domain);\n  const passOk = password.length >= 8;\n\n  const n = pings.length;\n  const series = Array.from({ length: n }, (_, i) => pings[(i + tick) % n]);\n  const latest = series[n - 1];\n  const max = Math.max(...series) + 4;\n  const min = Math.min(...series) - 4;\n  const pts = series.map((v, i) => [(i / (n - 1)) * 100, 24 - ((v - min) / (max - min)) * 22] as const);\n  const d = pts.map(([x, y], i) => `${i ? \"L\" : \"M\"}${x.toFixed(1)} ${y.toFixed(1)}`).join(\" \");\n\n  const submit = async (e: React.FormEvent) => {\n    e.preventDefault();\n    setTouched(true);\n    setError(null);\n    if (!emailOk || (!sso && !passOk)) return;\n    setStatus(\"loading\");\n    try {\n      const r = onSubmit ? await onSubmit({ email: email.trim(), password, sso }) : await new Promise<boolean>((res) => setTimeout(() => res(true), 1300));\n      if (r === false) {\n        setStatus(\"idle\");\n        setError(\"Those credentials were rejected.\");\n        return;\n      }\n      setStatus(\"success\");\n    } catch (err) {\n      setStatus(\"idle\");\n      setError(err instanceof Error ? err.message : \"Something went wrong. Try again.\");\n    }\n  };\n\n  const rail = [\n    { name: \"Edge region\", meta: `${latest} ms`, s: \"live\", val: <><b>Connected</b> to {region}</>, spark: true },\n    {\n      name: \"Workspace\",\n      meta: domain || \"pending\",\n      s: !emailOk ? \"idle\" : sso ? \"warn\" : \"ok\",\n      val: !emailOk ? \"Waiting for your email\" : sso ? <><b>SAML single sign-on</b> is required for {domain}</> : <><b>Password sign-in</b> allowed for {domain}</>,\n    },\n    {\n      name: \"Credentials\",\n      meta: sso ? \"SSO\" : passOk ? \"policy ok\" : `${password.length}/8`,\n      s: sso ? \"ok\" : passOk ? \"ok\" : password ? \"live\" : \"idle\",\n      val: sso ? <><b>Handled by your identity provider</b></> : passOk ? <><b>Meets policy</b>, checked locally</> : password ? \"Keep typing, 8 characters minimum\" : \"Not entered yet\",\n    },\n    { name: \"Device\", meta: \"trusted\", s: \"ok\", val: <><b>Recognized</b> {device}</> },\n    {\n      name: \"Session\",\n      meta: status === \"success\" ? \"12h\" : \"\",\n      s: status === \"loading\" ? \"busy\" : status === \"success\" ? \"ok\" : \"idle\",\n      val: status === \"loading\" ? \"Issuing an encrypted session token\" : status === \"success\" ? <><b>Session issued</b>, expires in 12 hours</> : \"Starts when you sign in\",\n    },\n  ];\n\n  return (\n    <section className={[\"hb-vf7\", className].filter(Boolean).join(\" \")} style={{ \"--hb-vf7-accent\": accent, ...style } as React.CSSProperties} {...rest}>\n      <style href=\"hb-auth-status-rail\" precedence=\"default\">{css}</style>\n      <div className=\"hb-vf7-shell\">\n        <div className=\"hb-vf7-card\">\n          <div className=\"hb-vf7-form\">\n            <div className=\"hb-vf7-brand\">\n              <i aria-hidden=\"true\"><svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\"><path d=\"M2 9V3l4 3 4-3v6\" stroke=\"#0a0a0a\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\" /></svg></i>\n              {brand}\n            </div>\n            {status === \"success\" ? (\n              <div className=\"hb-vf7-ok\" role=\"status\">\n                <h2 className=\"hb-vf7-title\">You are signed in</h2>\n                <p>Welcome back. {sso ? \"Your identity provider confirmed it is you.\" : \"All five checks passed.\"} Redirecting to your dashboard.</p>\n                <button type=\"button\" className=\"hb-vf7-link\" onClick={() => { setStatus(\"idle\"); setPassword(\"\"); setTouched(false); }}>Not you? Sign out</button>\n              </div>\n            ) : (\n              <form onSubmit={submit} noValidate>\n                <h2 className=\"hb-vf7-title\">{title}</h2>\n                <p className=\"hb-vf7-sub\">{subtitle}</p>\n                {error ? <p className=\"hb-vf7-alert\" role=\"alert\">{error}</p> : null}\n                <label className=\"hb-vf7-label\" htmlFor={`${id}-e`}>Work email</label>\n                <input id={`${id}-e`} className=\"hb-vf7-input\" type=\"email\" autoComplete=\"email\" placeholder=\"jordan@company.com\" value={email} onChange={(e) => setEmail(e.target.value)} aria-invalid={touched && !emailOk ? true : undefined} />\n                {touched && !emailOk ? <p className=\"hb-vf7-err\" role=\"alert\">Enter your work email.</p> : null}\n                <div className=\"hb-vf7-pw\" data-hidden={sso}>\n                  <div>\n                    <div className=\"hb-vf7-label\"><label htmlFor={`${id}-p`}>Password</label><a href={forgotHref} tabIndex={sso ? -1 : 0}>Forgot?</a></div>\n                    <input id={`${id}-p`} className=\"hb-vf7-input\" type=\"password\" autoComplete=\"current-password\" placeholder=\"••••••••\" value={password} onChange={(e) => setPassword(e.target.value)} tabIndex={sso ? -1 : 0} aria-invalid={touched && !sso && !passOk ? true : undefined} />\n                    {touched && !sso && !passOk ? <p className=\"hb-vf7-err\" role=\"alert\">At least 8 characters.</p> : null}\n                  </div>\n                </div>\n                <button type=\"submit\" className=\"hb-vf7-btn\" data-sso={sso} disabled={status === \"loading\"} aria-busy={status === \"loading\"}>\n                  {status === \"loading\" ? <><span className=\"hb-vf7-spin\" aria-hidden=\"true\" />Checking</> : sso ? `Continue with ${domain} SSO` : \"Sign in\"}\n                </button>\n              </form>\n            )}\n          </div>\n          <aside className=\"hb-vf7-rail\" aria-label=\"Sign-in status\">\n            <div className=\"hb-vf7-rhead\">\n              <span>Live status</span>\n              <a href={statusHref}><i aria-hidden=\"true\" />All systems normal</a>\n            </div>\n            <ol className=\"hb-vf7-list\">\n              {rail.map((r) => (\n                <li key={r.name} className=\"hb-vf7-item\" data-s={r.s}>\n                  <span className=\"hb-vf7-node\" aria-hidden=\"true\" />\n                  <div>\n                    <div className=\"hb-vf7-name\">{r.name}<em>{r.meta}</em></div>\n                    <div key={r.s} className=\"hb-vf7-val\">{r.val}</div>\n                    {r.spark ? (\n                      <svg className=\"hb-vf7-spark\" viewBox=\"0 0 100 26\" preserveAspectRatio=\"none\" aria-hidden=\"true\">\n                        <path d={d} vectorEffect=\"non-scaling-stroke\" />\n                      </svg>\n                    ) : null}\n                  </div>\n                </li>\n              ))}\n            </ol>\n          </aside>\n        </div>\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}