{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "inbox-message-list",
  "title": "Inbox / Message List Block",
  "description": "A two-pane inbox: Inbox, Starred and Archive folders with an unread count, search, rows with unread dots, labels and attachment icons, checkboxes for bulk mark-read and archive, a reading pane with attachments and a reply box, keyboard shortcuts and archive with undo. On phones the list and the message take turns.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/inbox-message-list/inbox-message-list.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport interface InboxMessage {\n  id: string;\n  from: { name: string; email: string; avatar?: string };\n  subject: string;\n  body: string;\n  /** Free text shown in the list, e.g. \"10:42\" or \"Yesterday\". */\n  time: string;\n  unread?: boolean;\n  starred?: boolean;\n  archived?: boolean;\n  labels?: string[];\n  attachments?: { name: string; size: string }[];\n}\n\nexport interface InboxMessageListProps {\n  messages?: InboxMessage[];\n  labels?: Record<string, string>;\n  me?: string;\n  onReply?: (id: string, text: string) => void;\n  theme?: \"dark\" | \"light\";\n  className?: string;\n}\n\nconst PALETTES = {\n  dark: { bg: \"#0A0A0A\", text: \"#F5F4F1\", muted: \"rgba(245,244,241,0.62)\", faint: \"rgba(245,244,241,0.36)\", card: \"#121212\", pane: \"#0F0F0F\", border: \"rgba(255,255,255,0.09)\", chip: \"rgba(255,255,255,0.06)\", hover: \"rgba(255,255,255,0.035)\", sel: \"rgba(255,255,255,0.07)\", on: \"#F5F4F1\", onText: \"#0A0A0A\", accent: \"#FB923C\", star: \"#FBBF24\", ring: \"rgba(245,244,241,0.6)\", input: \"#0D0D0D\" },\n  light: { bg: \"#FAFAF8\", text: \"#0A0A0A\", muted: \"rgba(10,10,10,0.62)\", faint: \"rgba(10,10,10,0.4)\", card: \"#FFFFFF\", pane: \"#FCFCFA\", border: \"rgba(10,10,10,0.09)\", chip: \"rgba(10,10,10,0.05)\", hover: \"rgba(10,10,10,0.025)\", sel: \"rgba(10,10,10,0.05)\", on: \"#0A0A0A\", onText: \"#FAFAF8\", accent: \"#EA580C\", star: \"#D97706\", ring: \"rgba(10,10,10,0.5)\", input: \"#FAFAF8\" },\n};\nconst DEFAULT_LABELS: Record<string, string> = { Billing: \"#4ADE80\", Design: \"#A78BFA\", Bug: \"#F87171\", Sales: \"#60A5FA\", Hiring: \"#FB923C\" };\n\nconst DEFAULT_MESSAGES: InboxMessage[] = [\n  { id: \"m1\", from: { name: \"Mara Okafor\", email: \"mara@nexora.io\", avatar: \"/demo/44.webp\" }, subject: \"Q4 launch plan, final review\", body: \"Hi! I pulled together the last comments on the launch plan. The pricing page copy is the only open item. Can you take a look before Thursday's sync?\\n\\nThe annual discount still says 15% in two places; it should be 20%. Everything else is ready to go.\\n\\nThanks,\\nMara\", time: \"10:42\", unread: true, labels: [\"Design\"], attachments: [{ name: \"launch-plan-v4.pdf\", size: \"2.4 MB\" }] },\n  { id: \"m2\", from: { name: \"Kestrel billing\", email: \"billing@kestrel.dev\" }, subject: \"Invoice NX-2026-0320 is overdue\", body: \"Hello,\\n\\nThis is a friendly reminder that invoice NX-2026-0320 for $12,480.00 was due on 4 October. If you have already paid, please ignore this message.\\n\\nYou can pay online with the link in your account.\", time: \"09:15\", unread: true, labels: [\"Billing\"] },\n  { id: \"m3\", from: { name: \"Daniel Reyes\", email: \"daniel@nexora.io\", avatar: \"/demo/42.webp\" }, subject: \"Checkout bug on Safari\", body: \"Repro: open checkout in Safari 18, apply a coupon, and the total doesn't update until you blur the field. Looks like the input event isn't firing. I have a fix in review.\", time: \"Yesterday\", starred: true, labels: [\"Bug\"] },\n  { id: \"m4\", from: { name: \"Lena Brandt\", email: \"lena@nexora.io\", avatar: \"/demo/55.webp\" }, subject: \"New logo directions\", body: \"Three directions attached. My favourite is B: it reads well at 16px and works in one colour. Let me know what you think and I'll refine it this week.\", time: \"Yesterday\", labels: [\"Design\"], attachments: [{ name: \"logo-directions.fig\", size: \"18.4 MB\" }, { name: \"preview.png\", size: \"1.1 MB\" }] },\n  { id: \"m5\", from: { name: \"Priya Nair\", email: \"priya@halcyon.app\" }, subject: \"Intro: partnership idea\", body: \"Hi there, I lead partnerships at Halcyon. We have a lot of shared customers and I think an integration could save them hours each week. Would you be open to a 20-minute call next week?\", time: \"Mon\", unread: true, labels: [\"Sales\"] },\n  { id: \"m6\", from: { name: \"Tomás Ferreira\", email: \"tomas@nexora.io\", avatar: \"/demo/43.webp\" }, subject: \"Interview loop for the design role\", body: \"Here is the proposed loop: portfolio review, a 60-minute collaborative exercise and a values chat. I've booked three candidates for next week.\", time: \"Mon\", labels: [\"Hiring\"] },\n  { id: \"m7\", from: { name: \"Noor Haddad\", email: \"noor@nexora.io\", avatar: \"/demo/46.webp\" }, subject: \"Thanks for the warm welcome!\", body: \"First week done. Thanks everyone for the patience with my many questions. Lunch on me on Friday!\", time: \"Sun\", starred: true },\n];\n\ntype Folder = \"inbox\" | \"starred\" | \"archive\";\n\nexport function InboxMessageList({ messages, labels = DEFAULT_LABELS, me = \"You\", onReply, theme = \"dark\", className }: InboxMessageListProps) {\n  const p = PALETTES[theme];\n  const reduce = !!useReducedMotion();\n  const uid = React.useId();\n  const [list, setList] = React.useState<InboxMessage[]>(() => messages ?? DEFAULT_MESSAGES);\n  const [folder, setFolder] = React.useState<Folder>(\"inbox\");\n  const [q, setQ] = React.useState(\"\");\n  const [openId, setOpenId] = React.useState<string | null>(\"m1\");\n  const [checked, setChecked] = React.useState<string[]>([]);\n  const [mobileThread, setMobileThread] = React.useState(false);\n  const [undo, setUndo] = React.useState<{ ids: string[]; label: string } | null>(null);\n  const [replies, setReplies] = React.useState<Record<string, string[]>>({});\n  const [draft, setDraft] = React.useState(\"\");\n  const undoTimer = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n  const listRef = React.useRef<HTMLUListElement>(null);\n  React.useEffect(\n    () => () => {\n      if (undoTimer.current) clearTimeout(undoTimer.current);\n    },\n    [],\n  );\n\n  const query = q.trim().toLowerCase();\n  const inFolder = (m: InboxMessage) => (folder === \"archive\" ? m.archived : !m.archived && (folder === \"inbox\" || m.starred));\n  const rows = list.filter((m) => inFolder(m) && (!query || `${m.from.name} ${m.subject} ${m.body}`.toLowerCase().includes(query)));\n  const open = list.find((m) => m.id === openId) ?? null;\n  const unread = list.filter((m) => !m.archived && m.unread).length;\n\n  const patch = (ids: string[], fn: (m: InboxMessage) => Partial<InboxMessage>) => setList((l) => l.map((m) => (ids.includes(m.id) ? { ...m, ...fn(m) } : m)));\n  const select = (id: string) => {\n    setOpenId(id);\n    setMobileThread(true);\n    setDraft(\"\");\n    patch([id], () => ({ unread: false }));\n  };\n  const archive = (ids: string[]) => {\n    if (!ids.length) return;\n    const toArchive = folder !== \"archive\";\n    const idx = rows.findIndex((m) => m.id === openId);\n    patch(ids, () => ({ archived: toArchive }));\n    setChecked([]);\n    if (openId && ids.includes(openId)) {\n      const next = rows.filter((m) => !ids.includes(m.id))[Math.max(0, idx)] ?? null;\n      setOpenId(next?.id ?? null);\n      if (!next) setMobileThread(false);\n      // Keep keyboard focus inside the inbox: the clicked toolbar button disappears with the old message.\n      if (next) requestAnimationFrame(() => listRef.current?.querySelector<HTMLElement>(`[data-id=\"${next.id}\"]`)?.focus({ preventScroll: true }));\n    }\n    setUndo({ ids, label: `${ids.length === 1 ? \"Conversation\" : `${ids.length} conversations`} ${toArchive ? \"archived\" : \"moved to Inbox\"}` });\n    if (undoTimer.current) clearTimeout(undoTimer.current);\n    undoTimer.current = setTimeout(() => setUndo(null), 5000);\n  };\n  const undoArchive = () => {\n    if (!undo) return;\n    patch(undo.ids, (m) => ({ archived: !m.archived }));\n    setUndo(null);\n  };\n  const move = (d: 1 | -1) => {\n    const i = rows.findIndex((m) => m.id === openId);\n    const next = rows[Math.min(rows.length - 1, Math.max(0, i + d))];\n    if (next) {\n      select(next.id);\n      listRef.current?.querySelector<HTMLElement>(`[data-id=\"${next.id}\"]`)?.focus();\n    }\n  };\n  const onKey = (e: React.KeyboardEvent) => {\n    const tag = (e.target as HTMLElement).tagName;\n    if (tag === \"INPUT\" || tag === \"TEXTAREA\" || e.metaKey || e.ctrlKey || e.altKey) return;\n    if (e.key === \"j\" || e.key === \"ArrowDown\") {\n      e.preventDefault();\n      move(1);\n    } else if (e.key === \"k\" || e.key === \"ArrowUp\") {\n      e.preventDefault();\n      move(-1);\n    } else if (e.key === \"e\" && openId) archive([openId]);\n    else if (e.key === \"s\" && openId) patch([openId], (m) => ({ starred: !m.starred }));\n  };\n\n  const ring = { [\"--tw-ring-color\" as string]: p.ring, [\"--tw-ring-offset-color\" as string]: p.card } as React.CSSProperties;\n  const focus = \"outline-none focus-visible:ring-2 focus-visible:ring-offset-2\";\n  const avatar = (f: InboxMessage[\"from\"], size = 34) =>\n    f.avatar ? (\n      // eslint-disable-next-line @next/next/no-img-element\n      <img src={f.avatar} alt=\"\" className=\"shrink-0 rounded-full object-cover\" style={{ width: size, height: size }} />\n    ) : (\n      <span className=\"flex shrink-0 items-center justify-center rounded-full text-[12px] font-semibold\" style={{ width: size, height: size, background: p.chip, color: p.muted }} aria-hidden=\"true\">\n        {f.name\n          .split(\" \")\n          .map((w) => w[0])\n          .join(\"\")\n          .slice(0, 2)}\n      </span>\n    );\n  const starBtn = (m: InboxMessage, size = 14) => (\n    <button type=\"button\" aria-pressed={!!m.starred} aria-label={m.starred ? \"Unstar\" : \"Star\"} onClick={(e) => { e.stopPropagation(); patch([m.id], (x) => ({ starred: !x.starred })); }} className={cn(\"flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-md border-0 bg-transparent\", focus)} style={{ color: m.starred ? p.star : p.faint, ...ring }}>\n      <motion.svg width={size} height={size} viewBox=\"0 0 24 24\" fill={m.starred ? \"currentColor\" : \"none\"} stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinejoin=\"round\" aria-hidden=\"true\" animate={m.starred && !reduce ? { scale: [1, 1.3, 1] } : { scale: 1 }} transition={{ duration: 0.3 }}>\n        <path d=\"m12 3 2.8 5.7 6.2.9-4.5 4.4 1 6.2L12 17.3 6.5 20.2l1-6.2L3 9.6l6.2-.9L12 3Z\" />\n      </motion.svg>\n    </button>\n  );\n\n  return (\n    <section className={cn(\"@container w-full\", className)} style={{ background: p.bg, color: p.text }}>\n      <div className=\"relative mx-auto max-w-6xl px-4 py-10 @[640px]:px-6 @[640px]:py-14\">\n        <div className=\"grid h-[640px] grid-cols-[minmax(0,1fr)] overflow-hidden rounded-2xl border @[860px]:grid-cols-[380px_minmax(0,1fr)]\" style={{ background: p.card, borderColor: p.border }} onKeyDown={onKey}>\n          {/* List */}\n          <div className={cn(\"flex min-h-0 min-w-0 flex-col @[860px]:border-r\", mobileThread && \"hidden @[860px]:flex\")} style={{ borderColor: p.border }}>\n            <div className=\"border-b p-3\" style={{ borderColor: p.border }}>\n              <div className=\"flex items-center gap-1\" role=\"tablist\" aria-label=\"Folders\">\n                {(\n                  [\n                    [\"inbox\", \"Inbox\"],\n                    [\"starred\", \"Starred\"],\n                    [\"archive\", \"Archive\"],\n                  ] as [Folder, string][]\n                ).map(([id, label]) => (\n                  <button\n                    key={id}\n                    type=\"button\"\n                    role=\"tab\"\n                    aria-selected={folder === id}\n                    onClick={() => {\n                      setFolder(id);\n                      setChecked([]);\n                    }}\n                    className={cn(\"relative flex h-8 cursor-pointer items-center gap-1.5 rounded-lg border-0 bg-transparent px-3 text-[13px]\", focus)}\n                    style={{ color: folder === id ? p.text : p.muted, ...ring }}\n                  >\n                    {folder === id && <motion.span layoutId={`${uid}-folder`} className=\"absolute inset-0 rounded-lg\" style={{ background: p.chip }} transition={reduce ? { duration: 0 } : { type: \"spring\", stiffness: 500, damping: 38 }} />}\n                    <span className=\"relative\">{label}</span>\n                    {id === \"inbox\" && unread > 0 && (\n                      <span className=\"relative rounded-full px-1.5 text-[11px] font-semibold tabular-nums\" style={{ background: p.accent, color: \"#0A0A0A\" }}>\n                        {unread}\n                      </span>\n                    )}\n                  </button>\n                ))}\n              </div>\n              <AnimatePresence mode=\"wait\" initial={false}>\n                {checked.length ? (\n                  <motion.div key=\"bulk\" initial={reduce ? false : { opacity: 0, y: -4 }} animate={{ opacity: 1, y: 0 }} exit={reduce ? undefined : { opacity: 0 }} className=\"mt-2.5 flex h-9 items-center justify-between gap-2 rounded-lg px-2\" style={{ background: p.chip }}>\n                    <span className=\"text-[12.5px] tabular-nums\">{checked.length} selected</span>\n                    <span className=\"flex gap-1\">\n                      <button type=\"button\" onClick={() => { patch(checked, () => ({ unread: false })); setChecked([]); }} className={cn(\"h-7 cursor-pointer rounded-md border-0 bg-transparent px-2 text-[12.5px]\", focus)} style={{ color: p.text, ...ring }}>\n                        Mark read\n                      </button>\n                      <button type=\"button\" onClick={() => archive(checked)} className={cn(\"h-7 cursor-pointer rounded-md border-0 px-2.5 text-[12.5px] font-medium\", focus)} style={{ background: p.on, color: p.onText, ...ring }}>\n                        {folder === \"archive\" ? \"Move to Inbox\" : \"Archive\"}\n                      </button>\n                    </span>\n                  </motion.div>\n                ) : (\n                  <motion.label key=\"search\" initial={reduce ? false : { opacity: 0 }} animate={{ opacity: 1 }} exit={reduce ? undefined : { opacity: 0 }} className=\"relative mt-2.5 block\">\n                    <span className=\"sr-only\">Search mail</span>\n                    <svg className=\"pointer-events-none absolute top-1/2 left-3 -translate-y-1/2\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" aria-hidden=\"true\" style={{ color: p.faint }}>\n                      <circle cx=\"11\" cy=\"11\" r=\"7\" />\n                      <path d=\"m20 20-3.5-3.5\" />\n                    </svg>\n                    <input type=\"search\" value={q} onChange={(e) => setQ(e.target.value)} placeholder=\"Search mail\" className={cn(\"h-9 w-full rounded-lg border pr-3 pl-8 text-[13px]\", focus)} style={{ borderColor: p.border, background: p.input, color: p.text, ...ring }} />\n                  </motion.label>\n                )}\n              </AnimatePresence>\n            </div>\n            <ul ref={listRef} className=\"m-0 min-h-0 flex-1 list-none overflow-y-auto p-0\" aria-label=\"Conversations\">\n              <AnimatePresence initial={false}>\n                {rows.map((m) => {\n                  const isOpen = m.id === openId;\n                  const isChecked = checked.includes(m.id);\n                  return (\n                    <motion.li key={m.id} layout={!reduce} initial={reduce ? false : { opacity: 0 }} animate={{ opacity: 1 }} exit={reduce ? undefined : { opacity: 0, x: -40, height: 0, transition: { duration: 0.25 } }} className=\"overflow-hidden border-b\" style={{ borderColor: p.border }}>\n                      <div\n                        role=\"button\"\n                        tabIndex={0}\n                        data-id={m.id}\n                        aria-current={isOpen ? \"true\" : undefined}\n                        aria-label={`${m.unread ? \"Unread, \" : \"\"}${m.from.name}: ${m.subject}`}\n                        onClick={() => select(m.id)}\n                        onKeyDown={(e) => {\n                          if (e.key === \"Enter\" || e.key === \" \") {\n                            e.preventDefault();\n                            select(m.id);\n                          }\n                        }}\n                        className={cn(\"group relative flex cursor-pointer gap-3 px-3.5 py-3 transition-colors hover:bg-[var(--im-h)]\", focus, \"focus-visible:ring-inset\")}\n                        style={{ background: isOpen ? p.sel : \"transparent\", [\"--im-h\" as string]: p.hover, ...ring }}\n                      >\n                        {isOpen && <motion.span layoutId={reduce ? undefined : `${uid}-bar`} className=\"absolute top-0 bottom-0 left-0 w-[2px]\" style={{ background: p.accent }} />}\n                        <span className=\"relative\">\n                          <span className={cn(isChecked ? \"invisible\" : \"group-hover:invisible group-focus-within:invisible\")}>{avatar(m.from)}</span>\n                          <label className={cn(\"absolute inset-0 flex cursor-pointer items-center justify-center\", isChecked ? \"visible\" : \"invisible group-hover:visible group-focus-within:visible\")} onClick={(e) => e.stopPropagation()}>\n                            <input type=\"checkbox\" checked={isChecked} onChange={() => setChecked((c) => (isChecked ? c.filter((x) => x !== m.id) : [...c, m.id]))} className=\"h-4 w-4 cursor-pointer\" style={{ accentColor: p.on }} aria-label={`Select ${m.subject}`} />\n                          </label>\n                        </span>\n                        <span className=\"min-w-0 flex-1\">\n                          <span className=\"flex items-center gap-2\">\n                            {m.unread && <span className=\"h-2 w-2 shrink-0 rounded-full\" style={{ background: p.accent }} aria-hidden=\"true\" />}\n                            <span className={cn(\"min-w-0 flex-1 truncate text-[13.5px]\", m.unread ? \"font-semibold\" : \"font-medium\")} style={{ color: m.unread ? p.text : p.muted }}>\n                              {m.from.name}\n                            </span>\n                            <span className=\"shrink-0 text-[11.5px] tabular-nums\" style={{ color: m.unread ? p.text : p.faint }}>\n                              {m.time}\n                            </span>\n                          </span>\n                          <span className={cn(\"mt-0.5 block truncate text-[13px]\", m.unread && \"font-medium\")} style={{ color: m.unread ? p.text : p.muted }}>\n                            {m.subject}\n                          </span>\n                          <span className=\"mt-0.5 flex items-center gap-1.5\">\n                            <span className=\"min-w-0 flex-1 truncate text-[12.5px]\" style={{ color: p.faint }}>\n                              {m.body.replace(/\\n+/g, \" \")}\n                            </span>\n                            {m.attachments?.length ? (\n                              <svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" aria-label=\"Has attachments\" style={{ color: p.faint }}>\n                                <path d=\"m21 12-8.5 8.5a5 5 0 0 1-7-7L14 5a3.5 3.5 0 0 1 5 5l-8.5 8.5a2 2 0 0 1-3-3L15 8\" />\n                              </svg>\n                            ) : null}\n                          </span>\n                          {m.labels?.length ? (\n                            <span className=\"mt-1.5 flex gap-1\">\n                              {m.labels.map((l) => (\n                                <span key={l} className=\"rounded px-1.5 py-px text-[10.5px] font-medium\" style={{ background: p.chip, color: labels[l] ?? p.muted }}>\n                                  {l}\n                                </span>\n                              ))}\n                            </span>\n                          ) : null}\n                        </span>\n                        <span className=\"-mr-1 self-start\">{starBtn(m, 13)}</span>\n                      </div>\n                    </motion.li>\n                  );\n                })}\n              </AnimatePresence>\n              {rows.length === 0 && (\n                <li className=\"px-6 py-16 text-center text-[13.5px]\" style={{ color: p.muted }}>\n                  {folder === \"inbox\" && !query ? \"Inbox zero. Nice work.\" : \"Nothing here.\"}\n                </li>\n              )}\n            </ul>\n            <p className=\"m-0 hidden border-t px-3.5 py-2 text-[11px] @[860px]:block\" style={{ borderColor: p.border, color: p.faint }} aria-hidden=\"true\">\n              <kbd className=\"font-mono\">j</kbd> <kbd className=\"font-mono\">k</kbd> move · <kbd className=\"font-mono\">e</kbd> archive · <kbd className=\"font-mono\">s</kbd> star\n            </p>\n          </div>\n\n          {/* Reading pane */}\n          <div className={cn(\"min-h-0 min-w-0 flex-col\", mobileThread ? \"flex\" : \"hidden @[860px]:flex\")} style={{ background: p.pane }}>\n            <AnimatePresence mode=\"wait\" initial={false}>\n              {open ? (\n                <motion.article key={open.id} initial={reduce ? false : { opacity: 0, y: 6 }} animate={{ opacity: 1, y: 0 }} exit={reduce ? undefined : { opacity: 0 }} transition={{ duration: 0.18 }} className=\"flex min-h-0 flex-1 flex-col\" aria-labelledby={`${uid}-subj`}>\n                  <div className=\"flex items-center gap-1 border-b px-3 py-2.5\" style={{ borderColor: p.border }}>\n                    <button type=\"button\" onClick={() => setMobileThread(false)} aria-label=\"Back to list\" className={cn(\"flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg border-0 bg-transparent @[860px]:hidden\", focus)} style={{ color: p.muted, ...ring }}>\n                      <svg width=\"15\" height=\"15\" viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n                        <path d=\"m10 3-5 5 5 5\" />\n                      </svg>\n                    </button>\n                    <button type=\"button\" onClick={() => archive([open.id])} className={cn(\"flex h-8 cursor-pointer items-center gap-1.5 rounded-lg border-0 bg-transparent px-2.5 text-[12.5px]\", focus)} style={{ color: p.muted, ...ring }}>\n                      <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n                        <path d=\"M3 4h18v4H3zM5 8v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V8M10 12h4\" />\n                      </svg>\n                      {open.archived ? \"Move to Inbox\" : \"Archive\"}\n                    </button>\n                    <button type=\"button\" onClick={() => patch([open.id], () => ({ unread: true }))} className={cn(\"h-8 cursor-pointer rounded-lg border-0 bg-transparent px-2.5 text-[12.5px]\", focus)} style={{ color: p.muted, ...ring }}>\n                      Mark unread\n                    </button>\n                    <span className=\"ml-auto\">{starBtn(open, 15)}</span>\n                  </div>\n                  <div className=\"min-h-0 flex-1 overflow-y-auto px-5 py-5 @[640px]:px-7\">\n                    <h2 id={`${uid}-subj`} className=\"m-0 text-[19px] leading-snug font-semibold tracking-[-0.015em]\">\n                      {open.subject}\n                    </h2>\n                    {open.labels?.length ? (\n                      <div className=\"mt-2 flex gap-1.5\">\n                        {open.labels.map((l) => (\n                          <span key={l} className=\"rounded px-1.5 py-px text-[11px] font-medium\" style={{ background: p.chip, color: labels[l] ?? p.muted }}>\n                            {l}\n                          </span>\n                        ))}\n                      </div>\n                    ) : null}\n                    <div className=\"mt-5 flex items-center gap-3\">\n                      {avatar(open.from, 38)}\n                      <div className=\"min-w-0 flex-1\">\n                        <p className=\"m-0 text-[13.5px] font-medium\">{open.from.name}</p>\n                        <p className=\"m-0 truncate text-[12px]\" style={{ color: p.faint }}>\n                          {open.from.email} · to {me}\n                        </p>\n                      </div>\n                      <span className=\"text-[12px]\" style={{ color: p.faint }}>\n                        {open.time}\n                      </span>\n                    </div>\n                    <div className=\"mt-4 text-[14px] leading-[1.7] whitespace-pre-line\" style={{ color: p.text }}>\n                      {open.body}\n                    </div>\n                    {open.attachments?.length ? (\n                      <ul className=\"m-0 mt-5 flex list-none flex-wrap gap-2 p-0\">\n                        {open.attachments.map((a) => (\n                          <li key={a.name}>\n                            <a href=\"#\" onClick={(e) => e.preventDefault()} className={cn(\"flex items-center gap-2.5 rounded-xl border px-3 py-2\", focus)} style={{ borderColor: p.border, color: p.text, ...ring }}>\n                              <span className=\"flex h-8 w-8 items-center justify-center rounded-lg font-mono text-[9.5px] font-bold uppercase\" style={{ background: p.chip, color: p.accent }} aria-hidden=\"true\">\n                                {a.name.split(\".\").pop()}\n                              </span>\n                              <span>\n                                <span className=\"block text-[12.5px] font-medium\">{a.name}</span>\n                                <span className=\"block text-[11.5px]\" style={{ color: p.faint }}>\n                                  {a.size}\n                                </span>\n                              </span>\n                            </a>\n                          </li>\n                        ))}\n                      </ul>\n                    ) : null}\n                    <AnimatePresence initial={false}>\n                      {(replies[open.id] ?? []).map((r, i) => (\n                        <motion.div key={i} initial={reduce ? false : { opacity: 0, y: 8 }} animate={{ opacity: 1, y: 0 }} className=\"mt-5 rounded-xl border p-4\" style={{ borderColor: p.border }}>\n                          <p className=\"m-0 text-[12px]\" style={{ color: p.faint }}>\n                            {me} · just now\n                          </p>\n                          <p className=\"m-0 mt-1.5 text-[13.5px] whitespace-pre-line\">{r}</p>\n                        </motion.div>\n                      ))}\n                    </AnimatePresence>\n                  </div>\n                  <form\n                    className=\"border-t p-3 @[640px]:p-4\"\n                    style={{ borderColor: p.border }}\n                    onSubmit={(e) => {\n                      e.preventDefault();\n                      if (!draft.trim()) return;\n                      setReplies((r) => ({ ...r, [open.id]: [...(r[open.id] ?? []), draft.trim()] }));\n                      onReply?.(open.id, draft.trim());\n                      setDraft(\"\");\n                    }}\n                  >\n                    <div className=\"rounded-xl border focus-within:ring-2\" style={{ borderColor: p.border, background: p.input, ...ring }}>\n                      <label htmlFor={`${uid}-reply`} className=\"sr-only\">\n                        Reply to {open.from.name}\n                      </label>\n                      <textarea\n                        id={`${uid}-reply`}\n                        rows={2}\n                        value={draft}\n                        onChange={(e) => setDraft(e.target.value)}\n                        onKeyDown={(e) => {\n                          if (e.key === \"Enter\" && (e.metaKey || e.ctrlKey)) e.currentTarget.form?.requestSubmit();\n                        }}\n                        placeholder={`Reply to ${open.from.name.split(\" \")[0]}…`}\n                        className=\"block w-full resize-none border-0 bg-transparent px-3 pt-2.5 text-[13.5px] outline-none\"\n                        style={{ color: p.text }}\n                      />\n                      <div className=\"flex items-center justify-between px-2 pb-2\">\n                        <span className=\"pl-1 text-[11px]\" style={{ color: p.faint }}>\n                          ⌘ Enter to send\n                        </span>\n                        <button type=\"submit\" disabled={!draft.trim()} className={cn(\"h-8 cursor-pointer rounded-lg border-0 px-3.5 text-[12.5px] font-medium disabled:cursor-not-allowed disabled:opacity-40\", focus)} style={{ background: p.on, color: p.onText, ...ring }}>\n                          Send\n                        </button>\n                      </div>\n                    </div>\n                  </form>\n                </motion.article>\n              ) : (\n                <motion.div key=\"empty\" initial={reduce ? false : { opacity: 0 }} animate={{ opacity: 1 }} className=\"flex flex-1 flex-col items-center justify-center gap-2 p-8 text-center\">\n                  <svg width=\"34\" height=\"34\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.4\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\" style={{ color: p.faint }}>\n                    <path d=\"M3 7l9 6 9-6M4 5h16a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1Z\" />\n                  </svg>\n                  <p className=\"m-0 text-[13.5px]\" style={{ color: p.muted }}>\n                    Select a conversation to read it.\n                  </p>\n                </motion.div>\n              )}\n            </AnimatePresence>\n          </div>\n        </div>\n\n        <div className=\"pointer-events-none absolute inset-x-0 bottom-4 flex justify-center px-4\" aria-live=\"polite\">\n          <AnimatePresence>\n            {undo && (\n              <motion.div key={undo.label} initial={reduce ? false : { opacity: 0, y: 10 }} animate={{ opacity: 1, y: 0 }} exit={reduce ? undefined : { opacity: 0, y: 6 }} className=\"pointer-events-auto flex items-center gap-3 rounded-full py-1.5 pr-1.5 pl-4 text-[13px] shadow-lg\" style={{ background: p.on, color: p.onText }}>\n                {undo.label}\n                <button type=\"button\" onClick={undoArchive} className=\"h-7 cursor-pointer rounded-full border-0 px-3 text-[12.5px] font-semibold\" style={{ background: p.onText, color: p.on }}>\n                  Undo\n                </button>\n              </motion.div>\n            )}\n          </AnimatePresence>\n        </div>\n      </div>\n    </section>\n  );\n}\n\nexport default InboxMessageList;\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}