{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "inbox-preview",
  "type": "registry:block",
  "title": "Inbox Preview",
  "description": "A mail client in one block: unread dots, coloured labels, hover actions, rows you swipe to archive or mark read (with undo), j/k/e shortcuts and a reading pane that slides over the list on phones.",
  "categories": [
    "block",
    "Apps"
  ],
  "dependencies": [
    "lucide-react",
    "motion"
  ],
  "registryDependencies": [
    "utils",
    "https://coss.com/ui/r/button.json",
    "https://coss.com/ui/r/kbd.json"
  ],
  "files": [
    {
      "path": "registry/devl/inbox-preview.tsx",
      "type": "registry:component",
      "content": "\"use client\";\n\nimport {\n  ArchiveIcon,\n  ArrowLeftIcon,\n  ClockIcon,\n  InboxIcon,\n  MailIcon,\n  MailOpenIcon,\n  PaperclipIcon,\n  ReplyIcon,\n  SearchIcon,\n  SendIcon,\n} from \"lucide-react\";\nimport { AnimatePresence, motion, type PanInfo, useMotionValue, useReducedMotion, useTransform } from \"motion/react\";\nimport { type KeyboardEvent, useEffect, useId, useMemo, useRef, useState } from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport { Kbd } from \"@/components/ui/kbd\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface InboxLabel {\n  name: string;\n  tone: string;\n}\n\nexport interface InboxEmail {\n  id: string;\n  from: { name: string; email: string; tone?: string };\n  subject: string;\n  snippet: string;\n  body: string[];\n  time: string;\n  date: string;\n  unread?: boolean;\n  labels?: InboxLabel[];\n  attachment?: { name: string; size: string };\n}\n\nexport interface InboxPreviewProps {\n  emails: InboxEmail[];\n  me?: string;\n  onArchive?: (email: InboxEmail) => void;\n  onReply?: (email: InboxEmail, text: string) => void;\n  onSnooze?: (email: InboxEmail) => void;\n  className?: string;\n}\n\nconst ease = [0.23, 1, 0.32, 1] as const;\nconst SWIPE = 88;\nconst TONES = [\n  \"bg-sky-500/15 text-sky-700 dark:text-sky-300\",\n  \"bg-rose-500/15 text-rose-700 dark:text-rose-300\",\n  \"bg-amber-500/15 text-amber-800 dark:text-amber-300\",\n  \"bg-emerald-500/15 text-emerald-700 dark:text-emerald-300\",\n  \"bg-violet-500/15 text-violet-700 dark:text-violet-300\",\n];\n\nfunction initials(name: string) {\n  return name\n    .split(\" \")\n    .map((w) => w[0])\n    .join(\"\")\n    .slice(0, 2)\n    .toUpperCase();\n}\n\nfunction Avatar({ email, size = \"size-9\" }: { email: InboxEmail; size?: string }) {\n  const tone = email.from.tone ?? TONES[email.from.name.length % TONES.length];\n  return (\n    <span className={cn(\"flex shrink-0 items-center justify-center rounded-full font-medium text-xs\", size, tone)}>\n      {initials(email.from.name)}\n    </span>\n  );\n}\n\nfunction Row({\n  email,\n  selected,\n  onSelect,\n  onArchive,\n  onToggleRead,\n  onSnooze,\n}: {\n  email: InboxEmail;\n  selected: boolean;\n  onSelect: () => void;\n  onArchive: () => void;\n  onToggleRead: () => void;\n  onSnooze: () => void;\n}) {\n  const reduce = useReducedMotion();\n  const x = useMotionValue(0);\n  const archiveOpacity = useTransform(x, [-SWIPE, -24, 0], [1, 0.4, 0]);\n  const readOpacity = useTransform(x, [0, 24, SWIPE], [0, 0.4, 1]);\n  const archiveScale = useTransform(x, [-SWIPE * 1.2, -SWIPE, -24], [1.1, 1, 0.7]);\n  const readScale = useTransform(x, [24, SWIPE, SWIPE * 1.2], [0.7, 1, 1.1]);\n  const dragged = useRef(false);\n\n  const onDragEnd = (_: unknown, info: PanInfo) => {\n    if (info.offset.x <= -SWIPE) onArchive();\n    else if (info.offset.x >= SWIPE) onToggleRead();\n    setTimeout(() => (dragged.current = false), 0);\n  };\n\n  return (\n    <motion.li\n      animate={{ height: \"auto\", opacity: 1 }}\n      className=\"group relative overflow-hidden\"\n      exit={{ height: 0, opacity: 0, transition: { duration: reduce ? 0 : 0.22, ease } }}\n      initial={false}\n      layout={reduce ? false : \"position\"}\n    >\n      <div aria-hidden className=\"absolute inset-0 flex items-center justify-between\">\n        <motion.span className=\"flex h-full items-center bg-info ps-5 pe-10 text-white\" style={{ opacity: readOpacity }}>\n          <motion.span style={{ scale: readScale }}>{email.unread ? <MailOpenIcon className=\"size-5\" /> : <MailIcon className=\"size-5\" />}</motion.span>\n        </motion.span>\n        <motion.span className=\"flex h-full items-center bg-success ps-10 pe-5 text-white\" style={{ opacity: archiveOpacity }}>\n          <motion.span style={{ scale: archiveScale }}>\n            <ArchiveIcon className=\"size-5\" />\n          </motion.span>\n        </motion.span>\n      </div>\n      <motion.div\n        className={cn(\n          \"relative isolate flex cursor-pointer touch-pan-y gap-3 border-b bg-card px-4 py-3 outline-none before:absolute before:inset-0 before:-z-10 before:transition-colors before:duration-150 focus-visible:z-10 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset\",\n          selected ? \"before:bg-accent dark:before:bg-white/6\" : \"hover:before:bg-accent/60\",\n        )}\n        data-email-id={email.id}\n        drag=\"x\"\n        dragConstraints={{ left: 0, right: 0 }}\n        dragDirectionLock\n        dragElastic={0.55}\n        onClick={() => !dragged.current && onSelect()}\n        onDragEnd={onDragEnd}\n        onDragStart={() => (dragged.current = true)}\n        onKeyDown={(e) => {\n          if (e.key === \"Enter\" || e.key === \" \") {\n            e.preventDefault();\n            onSelect();\n          }\n        }}\n        role=\"button\"\n        aria-current={selected || undefined}\n        style={{ x }}\n        tabIndex={selected ? 0 : -1}\n      >\n        <span\n          aria-hidden\n          className={cn(\n            \"absolute top-[1.35rem] left-1.5 size-1.5 rounded-full bg-info transition-[opacity,scale] duration-200\",\n            email.unread ? \"scale-100 opacity-100\" : \"scale-50 opacity-0\",\n          )}\n        />\n        <Avatar email={email} />\n        <div className=\"min-w-0 flex-1\">\n          <div className=\"flex items-baseline justify-between gap-2\">\n            <p className={cn(\"truncate text-sm\", email.unread ? \"font-semibold\" : \"font-medium text-foreground/80\")}>\n              {email.unread && <span className=\"sr-only\">Unread: </span>}\n              {email.from.name}\n            </p>\n            <span className=\"relative h-5 shrink-0 text-muted-foreground text-xs tabular-nums\">\n              <span className=\"transition-opacity duration-150 group-focus-within:opacity-0 [@media(hover:hover)]:group-hover:opacity-0\">\n                {email.time}\n              </span>\n            </span>\n          </div>\n          <p className={cn(\"truncate text-sm\", email.unread ? \"font-medium text-foreground\" : \"text-foreground/80\")}>{email.subject}</p>\n          <p className=\"mt-0.5 truncate text-muted-foreground text-xs\">{email.snippet}</p>\n          {(email.labels?.length || email.attachment) && (\n            <div className=\"mt-2 flex items-center gap-1.5\">\n              {email.labels?.map((l) => (\n                <span className={cn(\"rounded-full px-1.5 py-px font-medium text-[0.6875rem]\", l.tone)} key={l.name}>\n                  {l.name}\n                </span>\n              ))}\n              {email.attachment && <PaperclipIcon aria-label=\"Has attachment\" className=\"size-3 text-muted-foreground\" />}\n            </div>\n          )}\n        </div>\n      </motion.div>\n      <div className=\"absolute top-2 right-2 z-20 hidden items-center gap-0.5 rounded-lg border bg-popover p-0.5 opacity-0 shadow-xs/5 transition-opacity duration-150 group-focus-within:opacity-100 sm:flex [@media(hover:hover)]:group-hover:opacity-100\">\n        <button\n          aria-label=\"Archive\"\n          className=\"flex size-7 cursor-pointer items-center justify-center rounded-md text-muted-foreground outline-none hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring\"\n          onClick={(e) => {\n            e.stopPropagation();\n            onArchive();\n          }}\n          tabIndex={-1}\n          type=\"button\"\n        >\n          <ArchiveIcon className=\"size-3.5\" />\n        </button>\n        <button\n          aria-label={email.unread ? \"Mark as read\" : \"Mark as unread\"}\n          className=\"flex size-7 cursor-pointer items-center justify-center rounded-md text-muted-foreground outline-none hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring\"\n          onClick={(e) => {\n            e.stopPropagation();\n            onToggleRead();\n          }}\n          tabIndex={-1}\n          type=\"button\"\n        >\n          {email.unread ? <MailOpenIcon className=\"size-3.5\" /> : <MailIcon className=\"size-3.5\" />}\n        </button>\n        <button\n          aria-label=\"Snooze\"\n          className=\"flex size-7 cursor-pointer items-center justify-center rounded-md text-muted-foreground outline-none hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring\"\n          onClick={(e) => {\n            e.stopPropagation();\n            onSnooze();\n          }}\n          tabIndex={-1}\n          type=\"button\"\n        >\n          <ClockIcon className=\"size-3.5\" />\n        </button>\n      </div>\n    </motion.li>\n  );\n}\n\nexport function InboxPreview({ emails: initial, me = \"you\", onArchive, onReply, onSnooze, className }: InboxPreviewProps) {\n  const reduce = useReducedMotion();\n  const uid = useId();\n  const tabsId = useId();\n  const listRef = useRef<HTMLUListElement>(null);\n  const [emails, setEmails] = useState(() => initial.map((e, i) => (i === 0 ? { ...e, unread: false } : e)));\n  const [selectedId, setSelectedId] = useState<string | null>(initial[0]?.id ?? null);\n  const [mobileOpen, setMobileOpen] = useState(false);\n  const [filter, setFilter] = useState<\"all\" | \"unread\">(\"all\");\n  const [query, setQuery] = useState(\"\");\n  const [undo, setUndo] = useState<{ email: InboxEmail; index: number } | null>(null);\n  const [reply, setReply] = useState(\"\");\n  const [sent, setSent] = useState<string | null>(null);\n\n  const visible = useMemo(() => {\n    const q = query.trim().toLowerCase();\n    return emails.filter(\n      (e) =>\n        (filter === \"all\" || e.unread || e.id === selectedId) &&\n        (!q || `${e.from.name} ${e.subject} ${e.snippet}`.toLowerCase().includes(q)),\n    );\n  }, [emails, filter, query, selectedId]);\n  const selected = emails.find((e) => e.id === selectedId) ?? null;\n  const unreadCount = emails.filter((e) => e.unread).length;\n\n  useEffect(() => {\n    if (!undo) return;\n    const t = setTimeout(() => setUndo(null), 5000);\n    return () => clearTimeout(t);\n  }, [undo]);\n\n  useEffect(() => {\n    if (!sent) return;\n    const t = setTimeout(() => setSent(null), 2400);\n    return () => clearTimeout(t);\n  }, [sent]);\n\n  const select = (id: string) => {\n    setSelectedId(id);\n    setMobileOpen(true);\n    setReply(\"\");\n    setEmails((list) => list.map((e) => (e.id === id ? { ...e, unread: false } : e)));\n  };\n\n  const archive = (id: string) => {\n    const index = emails.findIndex((e) => e.id === id);\n    const email = emails[index];\n    if (!email) return;\n    const nextVisible = visible.filter((e) => e.id !== id);\n    const vi = visible.findIndex((e) => e.id === id);\n    if (selectedId === id) {\n      const n = nextVisible[Math.min(vi, nextVisible.length - 1)];\n      setSelectedId(n?.id ?? null);\n      if (!n) setMobileOpen(false);\n    }\n    setEmails((list) => list.filter((e) => e.id !== id));\n    setUndo({ email, index });\n    onArchive?.(email);\n  };\n\n  const restore = () => {\n    if (!undo) return;\n    setEmails((list) => {\n      const next = [...list];\n      next.splice(Math.min(undo.index, next.length), 0, undo.email);\n      return next;\n    });\n    setSelectedId(undo.email.id);\n    setUndo(null);\n  };\n\n  const toggleRead = (id: string) => setEmails((list) => list.map((e) => (e.id === id ? { ...e, unread: !e.unread } : e)));\n\n  const focusRow = (id: string) => {\n    requestAnimationFrame(() => listRef.current?.querySelector<HTMLElement>(`[data-email-id=\"${id}\"]`)?.focus());\n  };\n\n  const onListKey = (e: KeyboardEvent<HTMLUListElement>) => {\n    if (!visible.length) return;\n    const i = Math.max(0, visible.findIndex((m) => m.id === selectedId));\n    if (e.key === \"j\" || e.key === \"ArrowDown\") {\n      e.preventDefault();\n      const n = visible[Math.min(visible.length - 1, i + 1)];\n      setSelectedId(n.id);\n      focusRow(n.id);\n    } else if (e.key === \"k\" || e.key === \"ArrowUp\") {\n      e.preventDefault();\n      const n = visible[Math.max(0, i - 1)];\n      setSelectedId(n.id);\n      focusRow(n.id);\n    } else if (e.key === \"e\" && selectedId) {\n      e.preventDefault();\n      const after = visible[i + 1] ?? visible[i - 1];\n      archive(selectedId);\n      if (after) focusRow(after.id);\n    } else if (e.key === \"u\" && selectedId) {\n      e.preventDefault();\n      toggleRead(selectedId);\n    }\n  };\n\n  return (\n    <div\n      className={cn(\n        \"relative mx-auto flex h-[680px] w-full max-w-[1100px] overflow-hidden rounded-2xl border bg-card text-card-foreground shadow-xs/5\",\n        className,\n      )}\n    >\n      <div className=\"flex w-full min-w-0 flex-col md:w-[380px] md:shrink-0 md:border-r\">\n        <div className=\"space-y-3 border-b px-4 pt-4 pb-3\">\n          <div className=\"flex items-center justify-between gap-2\">\n            <h2 className=\"flex items-center gap-2 font-semibold text-base tracking-tight\">\n              Inbox\n              <span className=\"rounded-full bg-muted px-1.5 py-px font-medium text-muted-foreground text-xs tabular-nums\">{unreadCount}</span>\n            </h2>\n            <div aria-label=\"Filter\" className=\"grid grid-cols-2 rounded-lg bg-muted p-0.5\" role=\"radiogroup\">\n              {([\"all\", \"unread\"] as const).map((f) => (\n                <button\n                  aria-checked={filter === f}\n                  className={cn(\n                    \"relative h-7 cursor-pointer rounded-md px-3 font-medium text-xs capitalize outline-none transition-colors duration-150 focus-visible:ring-2 focus-visible:ring-ring\",\n                    filter === f ? \"text-foreground\" : \"text-muted-foreground hover:text-foreground\",\n                  )}\n                  key={f}\n                  onClick={() => setFilter(f)}\n                  role=\"radio\"\n                  type=\"button\"\n                >\n                  {filter === f && (\n                    <motion.span\n                      className=\"absolute inset-0 rounded-md bg-background shadow-xs/5 dark:bg-accent\"\n                      layoutId={tabsId}\n                      transition={reduce ? { duration: 0 } : { type: \"spring\", stiffness: 500, damping: 40 }}\n                    />\n                  )}\n                  <span className=\"relative\">{f}</span>\n                </button>\n              ))}\n            </div>\n          </div>\n          <label className=\"flex h-8 items-center gap-2 rounded-lg border bg-background px-2.5 text-sm shadow-xs/5 has-focus-visible:border-ring has-focus-visible:ring-[3px] has-focus-visible:ring-ring/24 dark:bg-input/32\">\n            <SearchIcon className=\"size-3.5 text-muted-foreground\" />\n            <span className=\"sr-only\">Search mail</span>\n            <input\n              className=\"h-full min-w-0 flex-1 bg-transparent outline-none placeholder:text-muted-foreground/72\"\n              onChange={(e) => setQuery(e.target.value)}\n              placeholder=\"Search mail\"\n              type=\"search\"\n              value={query}\n            />\n          </label>\n        </div>\n\n        <div className=\"relative min-h-0 flex-1 overflow-y-auto overflow-x-hidden\">\n          <ul aria-label=\"Messages\" className=\"outline-none\" onKeyDown={onListKey} ref={listRef}>\n            <AnimatePresence initial={false}>\n              {visible.map((email) => (\n                <Row\n                  email={email}\n                  key={email.id}\n                  onArchive={() => archive(email.id)}\n                  onSelect={() => select(email.id)}\n                  onSnooze={() => onSnooze?.(email)}\n                  onToggleRead={() => toggleRead(email.id)}\n                  selected={email.id === selectedId}\n                />\n              ))}\n            </AnimatePresence>\n          </ul>\n          {!visible.length && (\n            <div className=\"flex flex-col items-center px-6 py-16 text-center\">\n              <span className=\"flex size-10 items-center justify-center rounded-full bg-muted text-muted-foreground\">\n                <InboxIcon className=\"size-5\" />\n              </span>\n              <p className=\"mt-3 font-medium text-sm\">{query ? \"No matches\" : filter === \"unread\" ? \"All caught up\" : \"Inbox zero\"}</p>\n              <p className=\"mt-1 text-muted-foreground text-xs\">\n                {query ? `Nothing in your inbox mentions “${query}”.` : \"Nothing new. Go do something nice.\"}\n              </p>\n            </div>\n          )}\n        </div>\n\n        <div className=\"hidden items-center gap-3 border-t px-4 py-2 text-muted-foreground text-xs sm:flex\">\n          <span className=\"flex items-center gap-1\">\n            <Kbd>j</Kbd>\n            <Kbd>k</Kbd> move\n          </span>\n          <span className=\"flex items-center gap-1\">\n            <Kbd>e</Kbd> archive\n          </span>\n          <span className=\"flex items-center gap-1\">\n            <Kbd>u</Kbd> unread\n          </span>\n        </div>\n        <p className=\"border-t px-4 py-2 text-muted-foreground text-xs sm:hidden\">Swipe left to archive, right to mark read</p>\n      </div>\n\n          <section\n            aria-label=\"Reading pane\"\n            className={cn(\n              \"absolute inset-0 z-10 flex min-w-0 flex-1 flex-col bg-card transition-[translate,visibility] duration-300 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none md:static md:z-auto md:translate-x-0\",\n              !mobileOpen && \"max-md:invisible max-md:translate-x-full\",\n            )}\n          >\n            {selected ? (\n              <AnimatePresence initial={false} mode=\"popLayout\">\n                <motion.div\n                  animate={{ opacity: 1, x: 0 }}\n                  className=\"flex min-h-0 flex-1 flex-col\"\n                  exit={{ opacity: 0 }}\n                  initial={{ opacity: 0, x: reduce ? 0 : 12 }}\n                  key={selected.id}\n                  transition={{ duration: 0.18, ease }}\n                >\n                  <div className=\"flex h-[57px] shrink-0 items-center gap-1 border-b px-2 md:px-4\">\n                    <Button aria-label=\"Back to inbox\" className=\"md:hidden\" onClick={() => setMobileOpen(false)} size=\"icon\" variant=\"ghost\">\n                      <ArrowLeftIcon />\n                    </Button>\n                    <div className=\"ms-auto flex items-center gap-1\">\n                      <Button aria-label=\"Archive\" onClick={() => archive(selected.id)} size=\"icon\" variant=\"ghost\">\n                        <ArchiveIcon />\n                      </Button>\n                      <Button aria-label=\"Mark as unread\" onClick={() => toggleRead(selected.id)} size=\"icon\" variant=\"ghost\">\n                        <MailIcon />\n                      </Button>\n                      <Button aria-label=\"Snooze\" onClick={() => onSnooze?.(selected)} size=\"icon\" variant=\"ghost\">\n                        <ClockIcon />\n                      </Button>\n                    </div>\n                  </div>\n                  <div aria-label=\"Message\" className=\"min-h-0 flex-1 overflow-y-auto px-5 py-6 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset sm:px-8\" role=\"region\" tabIndex={0}>\n                    <div className=\"flex flex-wrap gap-1.5\">\n                      {selected.labels?.map((l) => (\n                        <span className={cn(\"rounded-full px-2 py-0.5 font-medium text-xs\", l.tone)} key={l.name}>\n                          {l.name}\n                        </span>\n                      ))}\n                    </div>\n                    <h3 className=\"mt-3 text-balance font-semibold text-xl tracking-tight\">{selected.subject}</h3>\n                    <div className=\"mt-5 flex items-center gap-3\">\n                      <Avatar email={selected} size=\"size-10\" />\n                      <div className=\"min-w-0 flex-1\">\n                        <p className=\"truncate text-sm\">\n                          <span className=\"font-medium\">{selected.from.name}</span>{\" \"}\n                          <span className=\"text-muted-foreground\">&lt;{selected.from.email}&gt;</span>\n                        </p>\n                        <p className=\"text-muted-foreground text-xs\">To {me}</p>\n                      </div>\n                      <span className=\"hidden shrink-0 text-muted-foreground text-xs sm:block\">{selected.date}</span>\n                    </div>\n                    <div className=\"mt-6 max-w-[62ch] space-y-4 text-pretty text-[0.9375rem]/7 text-foreground/90\">\n                      {selected.body.map((p, i) => (\n                        <p key={i}>{p}</p>\n                      ))}\n                    </div>\n                    {selected.attachment && (\n                      <div className=\"mt-6 inline-flex items-center gap-3 rounded-xl border px-3 py-2.5\">\n                        <span className=\"flex size-8 items-center justify-center rounded-lg bg-muted\">\n                          <PaperclipIcon className=\"size-4\" />\n                        </span>\n                        <span className=\"text-sm\">\n                          <span className=\"block font-medium\">{selected.attachment.name}</span>\n                          <span className=\"block text-muted-foreground text-xs\">{selected.attachment.size}</span>\n                        </span>\n                      </div>\n                    )}\n                  </div>\n                  <form\n                    className=\"shrink-0 border-t p-3 sm:p-4\"\n                    onSubmit={(e) => {\n                      e.preventDefault();\n                      if (!reply.trim()) return;\n                      onReply?.(selected, reply.trim());\n                      setSent(selected.from.name.split(\" \")[0]);\n                      setReply(\"\");\n                    }}\n                  >\n                    <div className=\"rounded-xl border bg-background shadow-xs/5 has-focus-visible:border-ring has-focus-visible:ring-[3px] has-focus-visible:ring-ring/24 dark:bg-input/32\">\n                      <label className=\"sr-only\" htmlFor={`${uid}-reply`}>\n                        Reply\n                      </label>\n                      <textarea\n                        className=\"block max-h-32 min-h-16 w-full resize-none bg-transparent px-3 pt-2.5 text-sm outline-none placeholder:text-muted-foreground/72\"\n                        id={`${uid}-reply`}\n                        onChange={(e) => setReply(e.target.value)}\n                        onKeyDown={(e) => {\n                          if (e.key === \"Enter\" && (e.metaKey || e.ctrlKey)) e.currentTarget.form?.requestSubmit();\n                        }}\n                        placeholder={`Reply to ${selected.from.name.split(\" \")[0]}…`}\n                        value={reply}\n                      />\n                      <div className=\"flex items-center justify-between px-2 pb-2\">\n                        <span className=\"ps-1 text-muted-foreground text-xs\" aria-live=\"polite\">\n                          <AnimatePresence initial={false} mode=\"wait\">\n                            <motion.span\n                              animate={{ opacity: 1 }}\n                              className=\"flex items-center gap-1.5\"\n                              exit={{ opacity: 0 }}\n                              initial={{ opacity: 0 }}\n                              key={sent ? \"sent\" : \"hint\"}\n                              transition={{ duration: 0.15 }}\n                            >\n                              {sent ? (\n                                <>\n                                  <ReplyIcon className=\"size-3.5 text-success-foreground\" />\n                                  Sent to {sent}\n                                </>\n                              ) : (\n                                <span className=\"hidden sm:inline\">⌘ Enter to send</span>\n                              )}\n                            </motion.span>\n                          </AnimatePresence>\n                        </span>\n                        <Button className=\"active:scale-[0.97]\" disabled={!reply.trim()} size=\"sm\" type=\"submit\">\n                          <SendIcon />\n                          Send\n                        </Button>\n                      </div>\n                    </div>\n                  </form>\n                </motion.div>\n              </AnimatePresence>\n            ) : (\n              <div className=\"flex flex-1 flex-col items-center justify-center text-center\">\n                <span className=\"flex size-12 items-center justify-center rounded-full bg-muted text-muted-foreground\">\n                  <InboxIcon className=\"size-6\" />\n                </span>\n                <p className=\"mt-3 font-medium text-sm\">Nothing selected</p>\n                <p className=\"mt-1 text-muted-foreground text-xs\">Pick a message to read it here.</p>\n              </div>\n            )}\n          </section>\n\n      <AnimatePresence>\n        {undo && (\n          <motion.div\n            animate={{ opacity: 1, y: 0 }}\n            className={cn(\n              \"absolute bottom-12 left-3 z-20 flex items-center gap-3 rounded-xl border bg-popover py-2 ps-3.5 pe-2 text-sm shadow-lg/10 md:w-[356px] max-md:right-3\",\n              mobileOpen && \"max-md:top-[66px] max-md:bottom-auto\",\n            )}\n            exit={{ opacity: 0, y: reduce ? 0 : 8, transition: { duration: 0.15 } }}\n            initial={{ opacity: 0, y: reduce ? 0 : 8 }}\n            role=\"status\"\n            transition={{ duration: 0.2, ease }}\n          >\n            <ArchiveIcon className=\"size-4 shrink-0 text-muted-foreground\" />\n            <span className=\"min-w-0 flex-1 truncate\">\n              Archived <span className=\"text-muted-foreground\">“{undo.email.subject}”</span>\n            </span>\n            <Button onClick={restore} size=\"sm\" variant=\"ghost\">\n              Undo\n            </Button>\n          </motion.div>\n        )}\n      </AnimatePresence>\n    </div>\n  );\n}\n"
    }
  ]
}