{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "contact-chat-widget",
  "type": "registry:component",
  "title": "Contact Chat Widget",
  "description": "A dark contact section with a support chat card: the greeting types in, quick replies stream an answer, and an inline email card validates, loads and confirms.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "contact",
    "contact",
    "chat",
    "support",
    "quick replies",
    "typing",
    "form"
  ],
  "docs": "https://hyperblur.dev/effects/contact-chat-widget",
  "files": [
    {
      "path": "registry/hyperblur/contact-chat-widget.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/contact-chat-widget.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface ContactChatReply {\n  label: string;\n  answer: string;\n}\n\nexport interface ContactChatChannel {\n  label: string;\n  detail: string;\n  href: string;\n}\n\nexport interface ContactChatValues {\n  email: string;\n  topic: string | null;\n  message: string;\n}\n\nexport interface ContactChatWidgetProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\" | \"onSubmit\"> {\n  eyebrow?: string;\n  title?: string;\n  subtitle?: string;\n  agentName?: string;\n  team?: string[];\n  greeting?: string[];\n  replies?: ContactChatReply[];\n  channels?: ContactChatChannel[];\n  onSubmit?: (values: ContactChatValues) => void | Promise<unknown>;\n  accent?: string;\n}\n\ntype Msg = { id: number; from: \"agent\" | \"user\" | \"card\" | \"done\"; text: string };\n\nconst defaultReplies: ContactChatReply[] = [\n  { label: \"Pricing for my team\", answer: \"Teams of 10 or more get volume pricing from $9 per seat. I can send you a quote with your exact numbers.\" },\n  { label: \"Book a demo\", answer: \"Happy to set one up. Demos run 25 minutes and we tailor them to the tools you already use.\" },\n  { label: \"Something is broken\", answer: \"Sorry about that. Share a quick description and an engineer from the on-call rotation will pick it up.\" },\n  { label: \"Migrating from Notion\", answer: \"Our importer moves pages, databases and comments in one pass. Most workspaces finish in under ten minutes.\" },\n];\n\nconst defaultChannels: ContactChatChannel[] = [\n  { label: \"Live chat\", detail: \"Median first reply 3m 40s\", href: \"#\" },\n  { label: \"Email\", detail: \"help@fieldnote.app\", href: \"mailto:help@fieldnote.app\" },\n  { label: \"Status\", detail: \"All systems normal\", href: \"#\" },\n];\n\nconst css = `\n.hb-yi2 {\n  --hb-yi2-accent: #8b5cf6;\n  container-type: inline-size;\n  position: relative;\n  box-sizing: border-box;\n  width: 100%;\n  overflow: hidden;\n  isolation: isolate;\n  background: #0a0a0a;\n  color: #ededed;\n  font-family: inherit;\n  -webkit-font-smoothing: antialiased;\n}\n.hb-yi2 *, .hb-yi2 *::before, .hb-yi2 *::after { box-sizing: border-box; }\n.hb-yi2::before {\n  content: \"\"; position: absolute; z-index: -1; right: -10%; top: -30%; width: 70%; height: 120%;\n  background: radial-gradient(closest-side, color-mix(in srgb, var(--hb-yi2-accent) 22%, transparent), transparent 70%);\n}\n.hb-yi2::after {\n  content: \"\"; position: absolute; z-index: -1; inset: 0;\n  background-image: linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);\n  background-size: 56px 56px;\n  mask-image: radial-gradient(ellipse at 70% 40%, #000, transparent 70%);\n}\n.hb-yi2-inner { max-width: 1120px; margin: 0 auto; padding: 72px 20px 80px; display: grid; gap: 44px; align-items: center; }\n.hb-yi2-eyebrow {\n  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 18px; padding: 5px 11px 5px 8px; border-radius: 999px;\n  border: 1px solid rgba(255, 255, 255, .1); background: rgba(255, 255, 255, .03); font-size: 12px; color: #c9c9c9;\n}\n.hb-yi2-live { width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 0 rgba(52, 211, 153, .6); animation: hb-yi2-ping 2s infinite; }\n.hb-yi2-title { margin: 0; font-size: clamp(30px, 5cqi, 52px); line-height: 1.04; letter-spacing: -.04em; font-weight: 600; }\n.hb-yi2-title span { color: transparent; background: linear-gradient(90deg, #fff, color-mix(in srgb, var(--hb-yi2-accent) 70%, #fff)); -webkit-background-clip: text; background-clip: text; }\n.hb-yi2-sub { margin: 18px 0 0; max-width: 460px; font-size: 16px; line-height: 1.6; color: #8f8f8f; }\n.hb-yi2-channels { list-style: none; margin: 30px 0 0; padding: 0; display: grid; gap: 1px; max-width: 440px; border-radius: 14px; overflow: hidden; border: 1px solid rgba(255, 255, 255, .08); background: rgba(255, 255, 255, .06); }\n.hb-yi2-channels a {\n  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; background: #0d0d0d;\n  color: inherit; text-decoration: none; font-size: 14px; transition: background .2s;\n}\n.hb-yi2-channels a:hover { background: #141414; }\n.hb-yi2-channels a:focus-visible { outline: 2px solid var(--hb-yi2-accent); outline-offset: -2px; }\n.hb-yi2-channels b { font-weight: 500; }\n.hb-yi2-channels span { color: #8f8f8f; font-size: 13px; display: inline-flex; align-items: center; gap: 8px; }\n.hb-yi2-channels svg { width: 14px; height: 14px; color: #5f5f5f; transition: transform .2s, color .2s; }\n.hb-yi2-channels a:hover svg { transform: translateX(3px); color: #ededed; }\n.hb-yi2-widget {\n  position: relative; width: 100%; max-width: 400px; justify-self: center; border-radius: 22px; overflow: hidden;\n  background: linear-gradient(180deg, #151515, #0f0f0f); border: 1px solid rgba(255, 255, 255, .09);\n  box-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset, 0 40px 80px -30px rgba(0, 0, 0, .9), 0 0 0 1px rgba(0, 0, 0, .4);\n  animation: hb-yi2-pop .7s cubic-bezier(.2, .9, .25, 1.15) both;\n}\n.hb-yi2-top {\n  position: relative; padding: 18px 18px 16px; display: flex; align-items: center; gap: 12px;\n  background: linear-gradient(135deg, color-mix(in srgb, var(--hb-yi2-accent) 38%, #121212), #141414 70%);\n  border-bottom: 1px solid rgba(255, 255, 255, .07);\n}\n.hb-yi2-stack { display: flex; }\n.hb-yi2-face {\n  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; margin-left: -9px; font-size: 12px; font-weight: 600; color: #fff;\n  border: 2px solid #1a1a1a;\n}\n.hb-yi2-face:first-child { margin-left: 0; }\n.hb-yi2-top-text { min-width: 0; flex: 1; }\n.hb-yi2-top-text p { margin: 0; }\n.hb-yi2-top-name { font-size: 15px; font-weight: 600; }\n.hb-yi2-top-note { margin-top: 2px !important; font-size: 12px; color: #b9b9b9; display: flex; align-items: center; gap: 6px; }\n.hb-yi2-top-note::before { content: \"\"; width: 6px; height: 6px; border-radius: 50%; background: #34d399; }\n.hb-yi2-thread { height: 330px; overflow-y: auto; padding: 18px 16px 12px; display: flex; flex-direction: column; gap: 8px; scroll-behavior: smooth; scrollbar-width: thin; scrollbar-color: #2a2a2a transparent; }\n.hb-yi2-row { display: flex; gap: 8px; align-items: flex-end; animation: hb-yi2-in .35s cubic-bezier(.2, .8, .2, 1) both; }\n.hb-yi2-row[data-from=\"user\"] { justify-content: flex-end; }\n.hb-yi2-mini { width: 24px; height: 24px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 10px; font-weight: 600; color: #fff; }\n.hb-yi2-row[data-chain=\"true\"] .hb-yi2-mini { visibility: hidden; }\n.hb-yi2-bubble { max-width: 82%; padding: 10px 13px; border-radius: 16px; font-size: 14px; line-height: 1.5; background: #1d1d1d; border: 1px solid rgba(255, 255, 255, .06); border-bottom-left-radius: 5px; }\n.hb-yi2-row[data-from=\"user\"] .hb-yi2-bubble {\n  background: var(--hb-yi2-accent); border-color: transparent; color: #fff; border-bottom-left-radius: 16px; border-bottom-right-radius: 5px;\n  box-shadow: 0 8px 20px -10px var(--hb-yi2-accent);\n}\n.hb-yi2-caret { display: inline-block; width: 2px; height: 1em; margin-left: 2px; vertical-align: -2px; background: currentColor; animation: hb-yi2-blink 1s steps(1) infinite; }\n.hb-yi2-dots { display: inline-flex; gap: 4px; padding: 4px 2px; }\n.hb-yi2-dots i { width: 6px; height: 6px; border-radius: 50%; background: #8f8f8f; animation: hb-yi2-bounce 1.2s infinite ease-in-out; }\n.hb-yi2-dots i:nth-child(2) { animation-delay: .15s; }\n.hb-yi2-dots i:nth-child(3) { animation-delay: .3s; }\n.hb-yi2-chips { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; padding: 4px 0 2px 32px; }\n.hb-yi2-chip {\n  padding: 7px 12px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--hb-yi2-accent) 55%, transparent);\n  background: color-mix(in srgb, var(--hb-yi2-accent) 10%, transparent); color: color-mix(in srgb, var(--hb-yi2-accent) 45%, #fff);\n  font: inherit; font-size: 13px; cursor: pointer; animation: hb-yi2-in .4s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--hb-yi2-i) * 70ms);\n  transition: background .2s, transform .2s, color .2s;\n}\n.hb-yi2-chip:hover { background: color-mix(in srgb, var(--hb-yi2-accent) 22%, transparent); color: #fff; transform: translateY(-1px); }\n.hb-yi2-chip:focus-visible, .hb-yi2-send:focus-visible, .hb-yi2-cardbtn:focus-visible { outline: 2px solid var(--hb-yi2-accent); outline-offset: 2px; }\n.hb-yi2-card { margin-left: 32px; padding: 14px; border-radius: 14px; background: #151515; border: 1px solid rgba(255, 255, 255, .08); display: grid; gap: 8px; animation: hb-yi2-in .4s cubic-bezier(.2, .8, .2, 1) both; }\n.hb-yi2-card label { font-size: 12px; color: #a1a1a1; }\n.hb-yi2-cardrow { display: flex; gap: 6px; }\n.hb-yi2-card input {\n  flex: 1; min-width: 0; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .1); background: #0b0b0b;\n  color: #ededed; font: inherit; font-size: 14px; outline: none; transition: border-color .2s, box-shadow .2s;\n}\n.hb-yi2-card input:focus { border-color: var(--hb-yi2-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--hb-yi2-accent) 25%, transparent); }\n.hb-yi2-card[data-invalid=\"true\"] input { border-color: #f87171; }\n.hb-yi2-err { font-size: 12px; color: #f87171; }\n.hb-yi2-cardbtn {\n  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 10px; border: 0;\n  background: #ededed; color: #0a0a0a; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: background .2s;\n}\n.hb-yi2-cardbtn:hover:not(:disabled) { background: #fff; }\n.hb-yi2-cardbtn:disabled { cursor: progress; opacity: .8; }\n.hb-yi2-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(0, 0, 0, .2); border-top-color: #0a0a0a; animation: hb-yi2-spin .7s linear infinite; }\n.hb-yi2-done { margin-left: 32px; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; font-size: 13px; line-height: 1.5; color: #d1fae5; background: rgba(16, 185, 129, .1); border: 1px solid rgba(16, 185, 129, .3); animation: hb-yi2-in .4s both; }\n.hb-yi2-done svg { width: 16px; height: 16px; flex: none; margin-top: 2px; color: #34d399; }\n.hb-yi2-compose { display: flex; gap: 8px; align-items: center; padding: 12px; border-top: 1px solid rgba(255, 255, 255, .07); background: #121212; }\n.hb-yi2-compose input {\n  flex: 1; min-width: 0; height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .08); background: #0b0b0b;\n  color: #ededed; font: inherit; font-size: 14px; outline: none; transition: border-color .2s;\n}\n.hb-yi2-compose input:focus { border-color: color-mix(in srgb, var(--hb-yi2-accent) 70%, transparent); }\n.hb-yi2-send {\n  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 0; flex: none; cursor: pointer;\n  background: var(--hb-yi2-accent); color: #fff; transition: transform .2s, opacity .2s;\n}\n.hb-yi2-send:hover:not(:disabled) { transform: scale(1.06); }\n.hb-yi2-send:disabled { opacity: .35; cursor: not-allowed; }\n.hb-yi2-send svg { width: 16px; height: 16px; }\n.hb-yi2-foot { padding: 0 12px 10px; background: #121212; font-size: 11px; color: #5f5f5f; text-align: center; }\n@keyframes hb-yi2-in { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }\n@keyframes hb-yi2-pop { from { opacity: 0; transform: translateY(24px) scale(.96); } to { opacity: 1; transform: none; } }\n@keyframes hb-yi2-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }\n@keyframes hb-yi2-blink { 50% { opacity: 0; } }\n@keyframes hb-yi2-spin { to { transform: rotate(360deg); } }\n@keyframes hb-yi2-ping { 0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .6); } 80%, 100% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); } }\n@container (min-width: 820px) {\n  .hb-yi2-inner { grid-template-columns: minmax(0, 1fr) 400px; gap: 64px; padding: 104px 32px 112px; }\n  .hb-yi2-widget { justify-self: end; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-yi2-widget, .hb-yi2-row, .hb-yi2-chip, .hb-yi2-card, .hb-yi2-done, .hb-yi2-dots i, .hb-yi2-caret, .hb-yi2-live { animation: none; }\n  .hb-yi2-thread { scroll-behavior: auto; }\n  .hb-yi2-chip, .hb-yi2-send, .hb-yi2-channels a, .hb-yi2-channels svg { transition: none; }\n}\n`;\n\nconst faces = [\n  \"linear-gradient(135deg, #f472b6, #8b5cf6)\",\n  \"linear-gradient(135deg, #38bdf8, #2f7bff)\",\n  \"linear-gradient(135deg, #fbbf24, #f97316)\",\n];\n\nconst emailOk = (v: string) => /^[^\\s@]+@[^\\s@]+\\.[^\\s@]{2,}$/.test(v.trim());\n\nfunction initials(name: string) {\n  return name\n    .split(\" \")\n    .map((p) => p[0] ?? \"\")\n    .join(\"\")\n    .slice(0, 2)\n    .toUpperCase();\n}\n\nfunction Arrow() {\n  return (\n    <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n      <path d=\"M5 12h14M13 6l6 6-6 6\" />\n    </svg>\n  );\n}\n\nexport function ContactChatWidget({\n  eyebrow = \"4 people online now\",\n  title = \"Questions? Talk to a human, not a ticket queue.\",\n  subtitle = \"Our support team is spread across three time zones, so someone who knows the product answers within minutes, any day of the week.\",\n  agentName = \"Priya Raman\",\n  team = [\"Priya Raman\", \"Leo Brandt\", \"Ama Osei\"],\n  greeting = [\"Hi there, I am Priya from the Fieldnote team.\", \"What can we help you with today?\"],\n  replies = defaultReplies,\n  channels = defaultChannels,\n  onSubmit,\n  accent = \"#8b5cf6\",\n  className = \"\",\n  style,\n  ...rest\n}: ContactChatWidgetProps) {\n  const [messages, setMessages] = React.useState<Msg[]>(() => [{ id: 0, from: \"agent\", text: greeting[0] ?? \"\" }]);\n  const [typing, setTyping] = React.useState(false);\n  const [live, setLive] = React.useState<string | null>(null);\n  const [chips, setChips] = React.useState(false);\n  const [topic, setTopic] = React.useState<string | null>(null);\n  const [draft, setDraft] = React.useState(\"\");\n  const [lastMessage, setLastMessage] = React.useState(\"\");\n  const [email, setEmail] = React.useState(\"\");\n  const [tried, setTried] = React.useState(false);\n  const [status, setStatus] = React.useState<\"idle\" | \"loading\" | \"done\">(\"idle\");\n  const timers = React.useRef<number[]>([]);\n  const idRef = React.useRef(1);\n  const threadRef = React.useRef<HTMLDivElement>(null);\n  const fieldId = React.useId();\n\n  const later = React.useCallback((fn: () => void, ms: number) => {\n    timers.current.push(window.setTimeout(fn, ms));\n  }, []);\n\n  const push = React.useCallback((from: Msg[\"from\"], text: string) => {\n    const id = idRef.current++;\n    setMessages((m) => [...m, { id, from, text }]);\n  }, []);\n\n  const say = React.useCallback(\n    (text: string, after?: () => void) => {\n      const reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n      if (reduce) {\n        push(\"agent\", text);\n        after?.();\n        return;\n      }\n      setTyping(true);\n      later(() => {\n        setTyping(false);\n        let n = 0;\n        const tick = () => {\n          n = Math.min(text.length, n + 3);\n          if (n >= text.length) {\n            setLive(null);\n            push(\"agent\", text);\n            after?.();\n            return;\n          }\n          setLive(text.slice(0, n));\n          later(tick, 22);\n        };\n        tick();\n      }, 900);\n    },\n    [later, push],\n  );\n\n  const second = greeting[1];\n\n  React.useEffect(() => {\n    const list = timers.current;\n    const id = window.setTimeout(() => {\n      if (second) say(second, () => setChips(true));\n      else setChips(true);\n    }, 500);\n    list.push(id);\n    return () => {\n      list.forEach((t) => window.clearTimeout(t));\n      list.length = 0;\n    };\n  }, [second, say]);\n\n  React.useEffect(() => {\n    const el = threadRef.current;\n    if (el) el.scrollTop = el.scrollHeight;\n  }, [messages, typing, live, chips]);\n\n  const askEmail = () => {\n    later(() => say(\"Where should we send the follow up?\", () => push(\"card\", \"\")), 250);\n  };\n\n  const choose = (r: ContactChatReply) => {\n    setChips(false);\n    setTopic(r.label);\n    setLastMessage(r.label);\n    push(\"user\", r.label);\n    say(r.answer, askEmail);\n  };\n\n  const send = (e: React.FormEvent) => {\n    e.preventDefault();\n    const text = draft.trim();\n    if (!text || typing || live !== null) return;\n    setDraft(\"\");\n    setChips(false);\n    setLastMessage(text);\n    push(\"user\", text);\n    if (status === \"done\") {\n      say(\"Thanks, I added that to your conversation.\");\n      return;\n    }\n    const hasCard = messages.some((m) => m.from === \"card\");\n    if (hasCard) say(\"Got it. Drop your email above and we will pick this up right away.\");\n    else say(\"Thanks for the details. Let me loop in the right person.\", askEmail);\n  };\n\n  const submitEmail = async (e: React.FormEvent) => {\n    e.preventDefault();\n    setTried(true);\n    if (!emailOk(email) || status !== \"idle\") return;\n    setStatus(\"loading\");\n    try {\n      await onSubmit?.({ email: email.trim(), topic, message: lastMessage });\n    } catch {\n      setStatus(\"idle\");\n      return;\n    }\n    later(() => setStatus(\"done\"), 700);\n  };\n\n  const invalid = tried && !emailOk(email);\n  const busy = typing || live !== null;\n  const vars = { \"--hb-yi2-accent\": accent, ...style } as React.CSSProperties;\n  const agentFace = faces[0];\n\n  return (\n    <section className={`hb-yi2 ${className}`} style={vars} {...rest}>\n      <style href=\"hb-contact-chat-widget\" precedence=\"default\">{css}</style>\n      <div className=\"hb-yi2-inner\">\n        <div>\n          {eyebrow ? (\n            <p className=\"hb-yi2-eyebrow\">\n              <span className=\"hb-yi2-live\" aria-hidden=\"true\" />\n              {eyebrow}\n            </p>\n          ) : null}\n          <h2 className=\"hb-yi2-title\">\n            {title.split(\", \").length > 1 ? (\n              <>\n                {title.split(\", \")[0]},<br />\n                <span>{title.split(\", \").slice(1).join(\", \")}</span>\n              </>\n            ) : (\n              title\n            )}\n          </h2>\n          {subtitle ? <p className=\"hb-yi2-sub\">{subtitle}</p> : null}\n          <ul className=\"hb-yi2-channels\">\n            {channels.map((c) => (\n              <li key={c.label}>\n                <a href={c.href}>\n                  <b>{c.label}</b>\n                  <span>\n                    {c.detail}\n                    <Arrow />\n                  </span>\n                </a>\n              </li>\n            ))}\n          </ul>\n        </div>\n\n        <div className=\"hb-yi2-widget\" role=\"region\" aria-label=\"Support chat\">\n          <div className=\"hb-yi2-top\">\n            <div className=\"hb-yi2-stack\" aria-hidden=\"true\">\n              {team.slice(0, 3).map((n, i) => (\n                <span key={n} className=\"hb-yi2-face\" style={{ background: faces[i % faces.length] }}>\n                  {initials(n)}\n                </span>\n              ))}\n            </div>\n            <div className=\"hb-yi2-top-text\">\n              <p className=\"hb-yi2-top-name\">Fieldnote support</p>\n              <p className=\"hb-yi2-top-note\">Typically replies in 4 minutes</p>\n            </div>\n          </div>\n          <div className=\"hb-yi2-thread\" ref={threadRef} aria-live=\"polite\">\n            {messages.map((m, i) => {\n              const prev = messages[i - 1];\n              const chain = !!prev && prev.from === m.from;\n              if (m.from === \"card\") {\n                return status === \"done\" ? (\n                  <div key={m.id} className=\"hb-yi2-done\" role=\"status\">\n                    <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.4\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n                      <path d=\"M5 12.5l4.5 4.5L19 7.5\" />\n                    </svg>\n                    <span>{`You are all set. ${agentName.split(\" \")[0]} will reply to ${email.trim()} within 4 minutes.`}</span>\n                  </div>\n                ) : (\n                  <form key={m.id} className=\"hb-yi2-card\" data-invalid={invalid} noValidate onSubmit={submitEmail} aria-busy={status === \"loading\" || undefined}>\n                    <label htmlFor={`${fieldId}-mail`}>Your email</label>\n                    <div className=\"hb-yi2-cardrow\">\n                      <input\n                        id={`${fieldId}-mail`}\n                        type=\"email\"\n                        autoComplete=\"email\"\n                        placeholder=\"you@company.com\"\n                        value={email}\n                        aria-invalid={invalid}\n                        aria-describedby={invalid ? `${fieldId}-err` : undefined}\n                        onChange={(e) => setEmail(e.target.value)}\n                      />\n                      <button type=\"submit\" className=\"hb-yi2-cardbtn\" disabled={status === \"loading\"}>\n                        {status === \"loading\" ? <span className=\"hb-yi2-spin\" aria-hidden=\"true\" /> : null}\n                        {status === \"loading\" ? \"Sending\" : \"Send\"}\n                      </button>\n                    </div>\n                    {invalid ? <span id={`${fieldId}-err`} className=\"hb-yi2-err\">That email does not look right.</span> : null}\n                  </form>\n                );\n              }\n              return (\n                <div key={m.id} className=\"hb-yi2-row\" data-from={m.from} data-chain={chain}>\n                  {m.from === \"agent\" ? (\n                    <span className=\"hb-yi2-mini\" style={{ background: agentFace }} aria-hidden=\"true\">\n                      {initials(agentName)}\n                    </span>\n                  ) : null}\n                  <div className=\"hb-yi2-bubble\">{m.text}</div>\n                </div>\n              );\n            })}\n            {typing || live !== null ? (\n              <div className=\"hb-yi2-row\" data-from=\"agent\" data-chain={messages[messages.length - 1]?.from === \"agent\"}>\n                <span className=\"hb-yi2-mini\" style={{ background: agentFace }} aria-hidden=\"true\">\n                  {initials(agentName)}\n                </span>\n                <div className=\"hb-yi2-bubble\">\n                  {live !== null ? (\n                    <>\n                      {live}\n                      <span className=\"hb-yi2-caret\" aria-hidden=\"true\" />\n                    </>\n                  ) : (\n                    <span className=\"hb-yi2-dots\" aria-label={`${agentName} is typing`}>\n                      <i />\n                      <i />\n                      <i />\n                    </span>\n                  )}\n                </div>\n              </div>\n            ) : null}\n            {chips ? (\n              <div className=\"hb-yi2-chips\" role=\"group\" aria-label=\"Quick replies\">\n                {replies.map((r, i) => (\n                  <button key={r.label} type=\"button\" className=\"hb-yi2-chip\" style={{ \"--hb-yi2-i\": i } as React.CSSProperties} onClick={() => choose(r)}>\n                    {r.label}\n                  </button>\n                ))}\n              </div>\n            ) : null}\n          </div>\n          <form className=\"hb-yi2-compose\" onSubmit={send}>\n            <input aria-label=\"Write a message\" placeholder=\"Write a message\" value={draft} onChange={(e) => setDraft(e.target.value)} />\n            <button type=\"submit\" className=\"hb-yi2-send\" disabled={!draft.trim() || busy} aria-label=\"Send message\">\n              <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n                <path d=\"M12 19V5M5 12l7-7 7 7\" />\n              </svg>\n            </button>\n          </form>\n          <p className=\"hb-yi2-foot\">We reply here and by email</p>\n        </div>\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}