{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "notification-center",
  "type": "registry:component",
  "title": "Notification center",
  "description": "An inbox of app notifications grouped by day, with tabs, unread state, inline actions, archive with undo, and a bell popover.",
  "categories": [
    "feedback"
  ],
  "dependencies": [
    "@tabler/icons-react",
    "@radix-ui/react-popover"
  ],
  "registryDependencies": [],
  "files": [
    {
      "path": "src/registry/overtrue/notification-center.tsx",
      "type": "registry:component",
      "target": "components/overtrue/notification-center.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport {\n  IconAlertTriangle,\n  IconArchive,\n  IconAt,\n  IconBell,\n  IconBellCheck,\n  IconChecks,\n  IconCircleCheck,\n  IconCreditCard,\n  IconGitPullRequest,\n  IconInbox,\n  IconLoader2,\n  IconMail,\n  IconMailOpened,\n  IconMessageCircle,\n  IconRocket,\n  IconShieldCheck,\n  IconUserCheck,\n  IconUserPlus,\n} from \"@tabler/icons-react\";\n\nimport { cn } from \"@/lib/utils\";\n\n/* ------------------------------------------------------------------------ */\n/* Types                                                                     */\n/* ------------------------------------------------------------------------ */\n\n/** Built-in kinds pick an icon and a tone. Any other string falls back to a bell. */\nexport type NotificationKind =\n  | \"mention\"\n  | \"comment\"\n  | \"review\"\n  | \"assignment\"\n  | \"approval\"\n  | \"deploy\"\n  | \"invite\"\n  | \"billing\"\n  | \"security\"\n  | \"alert\"\n  | \"system\"\n  | (string & {});\n\nexport interface NotificationActor {\n  name: string;\n  /** Avatar image URL. Initials are shown without one. */\n  image?: string;\n}\n\nexport interface NotificationAction {\n  id: string;\n  label: string;\n  /** Defaults to \"secondary\". Use one primary action per notification. */\n  variant?: \"primary\" | \"secondary\" | \"destructive\";\n}\n\nexport interface NotificationItem {\n  id: string;\n  title: string;\n  body?: string;\n  time: Date;\n  read?: boolean;\n  kind?: NotificationKind;\n  actor?: NotificationActor;\n  /** Makes the row a link. */\n  href?: string;\n  /** Inline buttons, such as Approve or Reply. */\n  actions?: NotificationAction[];\n}\n\nexport interface NotificationTab {\n  id: string;\n  label: string;\n  filter: (notification: NotificationItem) => boolean;\n  /** Empty state copy for this tab. */\n  emptyTitle?: string;\n  emptyDescription?: string;\n}\n\nexport interface NotificationChange {\n  type: \"read\" | \"unread\" | \"archive\" | \"restore\";\n  ids: string[];\n}\n\nexport interface NotificationRenderInfo {\n  read: boolean;\n  /** Relative time, such as \"5m ago\". */\n  timeLabel: string;\n  group: \"today\" | \"yesterday\" | \"earlier\";\n}\n\n/** Interface copy. Relative times are localized through `locale`. */\nexport interface NotificationCenterLabels {\n  heading: string;\n  tabs: string;\n  all: string;\n  unread: string;\n  markAllRead: string;\n  markRead: string;\n  markUnread: string;\n  archive: string;\n  archived: string;\n  undo: string;\n  restored: string;\n  allRead: string;\n  today: string;\n  yesterday: string;\n  earlier: string;\n  unreadMarker: string;\n  justNow: string;\n  emptyTitle: (tab: string) => string;\n  emptyDescription: (tab: string) => string;\n  trigger: (unread: number) => string;\n  newNotifications: (count: number) => string;\n  working: string;\n  actionDone: (label: string) => string;\n}\n\nexport interface NotificationCenterProps extends Omit<\n  React.ComponentProps<\"div\">,\n  \"children\" | \"onChange\" | \"defaultValue\" | \"title\"\n> {\n  /** Controlled list. Leave undefined and pass `defaultNotifications` to let the panel manage it. */\n  notifications?: NotificationItem[];\n  defaultNotifications?: NotificationItem[];\n  /** Called with the next list after a read, unread, archive, or undo. */\n  onNotificationsChange?: (\n    notifications: NotificationItem[],\n    change: NotificationChange,\n  ) => void;\n  /** Tabs after All and Unread, such as Mentions. */\n  tabs?: NotificationTab[];\n  tab?: string;\n  defaultTab?: string;\n  onTabChange?: (tab: string) => void;\n  /** Anchors relative times and the Today and Yesterday groups. Defaults to the clock. */\n  now?: Date;\n  /** BCP 47 locale for relative times. Defaults to the runtime locale. */\n  locale?: string;\n  /** Replaces the relative time label. */\n  formatTime?: (time: Date, now: Date) => string;\n  /** Called when a row is opened with a click or Enter. The row is marked read. */\n  onOpen?: (notification: NotificationItem) => void;\n  /** Runs an inline action and marks the row read. Return a promise to show progress until it settles. */\n  onAction?: (\n    notification: NotificationItem,\n    action: NotificationAction,\n  ) => void | Promise<unknown>;\n  /** Called once the undo window for an archived notification has closed. */\n  onArchive?: (notification: NotificationItem) => void;\n  /** How long Undo stays available, in ms. Pauses while hovered or focused. Defaults to 5000. */\n  undoTimeout?: number;\n  /** Replaces the text of every row. The row, its unread dot, and its quick actions stay. */\n  renderNotification?: (\n    notification: NotificationItem,\n    info: NotificationRenderInfo,\n  ) => React.ReactNode;\n  /** Header title. Defaults to labels.heading. */\n  heading?: React.ReactNode;\n  /** Extra controls in the header, such as a settings button. */\n  actions?: React.ReactNode;\n  /** Content under the list, such as a View all link. */\n  footer?: React.ReactNode;\n  labels?: Partial<NotificationCenterLabels>;\n}\n\nexport interface NotificationCenterPopoverProps extends NotificationCenterProps {\n  open?: boolean;\n  defaultOpen?: boolean;\n  onOpenChange?: (open: boolean) => void;\n  /** Panel alignment against the bell. Defaults to end. */\n  align?: \"start\" | \"center\" | \"end\";\n  /**\n   * Render the panel in place under the bell instead of a portalled popover.\n   * It stays open on outside clicks and never steals focus on mount. For\n   * documentation, screenshots, and layouts that already manage layering.\n   */\n  inline?: boolean;\n  /** Panel width in px. Defaults to 380, capped by the viewport. */\n  width?: number;\n  triggerClassName?: string;\n  contentClassName?: string;\n}\n\n/* ------------------------------------------------------------------------ */\n/* Helpers                                                                   */\n/* ------------------------------------------------------------------------ */\n\nconst DAY_MS = 86_400_000;\nconst dayNumber = (date: Date) =>\n  Math.round(\n    Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()) / DAY_MS,\n  );\n\nconst defaultLabels: NotificationCenterLabels = {\n  heading: \"Notifications\",\n  tabs: \"Filter notifications\",\n  all: \"All\",\n  unread: \"Unread\",\n  markAllRead: \"Mark all read\",\n  markRead: \"Mark as read\",\n  markUnread: \"Mark as unread\",\n  archive: \"Archive\",\n  archived: \"Archived\",\n  undo: \"Undo\",\n  restored: \"Notification restored\",\n  allRead: \"All marked as read\",\n  today: \"Today\",\n  yesterday: \"Yesterday\",\n  earlier: \"Earlier\",\n  unreadMarker: \"Unread\",\n  justNow: \"Just now\",\n  emptyTitle: (tab) =>\n    tab === \"unread\" ? \"You're all caught up\" : \"Nothing here yet\",\n  emptyDescription: (tab) =>\n    tab === \"unread\"\n      ? \"New activity will show up here as it happens.\"\n      : \"When something needs your attention, it will land here.\",\n  trigger: (unread) =>\n    unread ? `Notifications, ${unread} unread` : \"Notifications\",\n  newNotifications: (count) =>\n    count === 1 ? \"1 new notification\" : `${count} new notifications`,\n  working: \"Working\",\n  actionDone: (label) => `${label}: done`,\n};\n\ninterface KindStyle {\n  Icon: typeof IconBell;\n  /** A theme color for tinted tiles; status kinds use Tailwind status classes instead. */\n  tone?: string;\n  tile?: string;\n  badge?: string;\n}\n\nconst KINDS: Record<string, KindStyle> = {\n  mention: { Icon: IconAt, tone: \"var(--color-primary)\" },\n  comment: { Icon: IconMessageCircle, tone: \"var(--color-chart-4)\" },\n  review: { Icon: IconGitPullRequest, tone: \"var(--color-chart-1)\" },\n  assignment: { Icon: IconUserCheck, tone: \"var(--color-chart-1)\" },\n  approval: { Icon: IconCircleCheck, tone: \"var(--color-chart-2)\" },\n  deploy: { Icon: IconRocket, tone: \"var(--color-chart-2)\" },\n  invite: { Icon: IconUserPlus, tone: \"var(--color-chart-5)\" },\n  billing: { Icon: IconCreditCard, tone: \"var(--color-chart-3)\" },\n  security: { Icon: IconShieldCheck, tone: \"var(--color-chart-5)\" },\n  alert: {\n    Icon: IconAlertTriangle,\n    tile: \"bg-amber-500/12 text-amber-700 ring-amber-500/20 dark:bg-amber-400/12 dark:text-amber-400 dark:ring-amber-400/20\",\n    badge: \"bg-amber-500 text-amber-950 dark:bg-amber-400\",\n  },\n  system: { Icon: IconBell, tone: \"var(--color-muted-foreground)\" },\n};\nconst kindStyle = (kind?: string) => KINDS[kind ?? \"system\"] ?? KINDS.system;\n\nfunction hash(text: string) {\n  let value = 0;\n  for (let i = 0; i < text.length; i++)\n    value = (value * 31 + text.charCodeAt(i)) >>> 0;\n  return value;\n}\n\nfunction initials(name: string) {\n  const words = name.trim().split(/\\s+/);\n  return (\n    (words[0]?.[0] ?? \"\") +\n    (words.length > 1 ? (words[words.length - 1][0] ?? \"\") : \"\")\n  ).toUpperCase();\n}\n\nconst relativeFormats = new Map<string, Intl.RelativeTimeFormat>();\nfunction relativeTime(time: Date, now: Date, locale: string | undefined, justNow: string) {\n  const seconds = (time.getTime() - now.getTime()) / 1000;\n  const abs = Math.abs(seconds);\n  if (abs < 45) return justNow;\n  const key = locale ?? \"\";\n  let format = relativeFormats.get(key);\n  if (!format) {\n    format = new Intl.RelativeTimeFormat(locale, {\n      numeric: \"auto\",\n      style: \"narrow\",\n    });\n    relativeFormats.set(key, format);\n  }\n  const sign = Math.sign(seconds) || -1;\n  if (abs < 3_600) return format.format(sign * Math.max(1, Math.round(abs / 60)), \"minute\");\n  if (abs < 86_400) return format.format(sign * Math.floor(abs / 3_600), \"hour\");\n  const days = dayNumber(time) - dayNumber(now);\n  if (Math.abs(days) < 7) return format.format(days, \"day\");\n  if (Math.abs(days) < 30) return format.format(Math.trunc(days / 7), \"week\");\n  return new Intl.DateTimeFormat(locale, {\n    month: \"short\",\n    day: \"numeric\",\n    year: time.getFullYear() === now.getFullYear() ? undefined : \"numeric\",\n  }).format(time);\n}\n\nconst keyframes =\n  \"@keyframes notification-center-in{from{opacity:0;transform:translateY(-6px) scale(.97)}to{opacity:1;transform:none}}\" +\n  \"@keyframes notification-center-row{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:none}}\" +\n  \"@keyframes notification-center-drain{from{transform:scaleX(1)}to{transform:scaleX(0)}}\";\n\nconst card =\n  \"rounded-2xl border border-border/70 bg-card text-card-foreground shadow-[0_1px_2px_rgb(0_0_0/0.04),0_8px_24px_-12px_rgb(0_0_0/0.10)] dark:shadow-[inset_0_1px_0_rgb(255_255_255/0.05),0_1px_2px_rgb(0_0_0/0.5)]\";\nconst frosted =\n  \"rounded-xl border border-border/70 bg-popover/90 text-popover-foreground shadow-xl backdrop-blur-md\";\nconst ring =\n  \"outline-none focus-visible:ring-2 focus-visible:ring-ring/50\";\n\n/* ------------------------------------------------------------------------ */\n/* Pieces                                                                    */\n/* ------------------------------------------------------------------------ */\n\nfunction Avatar({ notification }: { notification: NotificationItem }) {\n  const style = kindStyle(notification.kind);\n  const { Icon } = style;\n  const toneStyle = style.tone\n    ? ({ \"--tone\": style.tone } as React.CSSProperties)\n    : undefined;\n  if (!notification.actor) {\n    return (\n      <span\n        aria-hidden=\"true\"\n        data-slot=\"notification-center-icon\"\n        style={toneStyle}\n        className={cn(\n          \"flex size-8 shrink-0 items-center justify-center rounded-[10px] ring-1 ring-inset\",\n          style.tile ??\n            \"[background-color:color-mix(in_oklab,var(--tone)_12%,var(--color-card))] [color:color-mix(in_oklab,var(--tone)_70%,var(--color-foreground))] ring-[color-mix(in_oklab,var(--tone)_18%,transparent)]\",\n        )}\n      >\n        <Icon className=\"size-4\" />\n      </span>\n    );\n  }\n  const person = notification.actor;\n  const personTone = `var(--color-chart-${(hash(person.name) % 5) + 1})`;\n  return (\n    <span aria-hidden=\"true\" data-slot=\"notification-center-avatar\" className=\"relative size-8 shrink-0\">\n      {person.image ? (\n        <img\n          src={person.image}\n          alt=\"\"\n          className=\"size-8 rounded-full object-cover ring-1 ring-border/60\"\n        />\n      ) : (\n        <span\n          style={{ \"--tone\": personTone } as React.CSSProperties}\n          className=\"flex size-8 items-center justify-center rounded-full text-xs font-semibold [background-color:color-mix(in_oklab,var(--tone)_16%,var(--color-card))] [color:color-mix(in_oklab,var(--tone)_45%,var(--color-foreground))]\"\n        >\n          {initials(person.name)}\n        </span>\n      )}\n      {notification.kind && (\n        <span\n          style={toneStyle}\n          className={cn(\n            \"absolute -end-1.5 -bottom-1.5 flex size-4 items-center justify-center rounded-full ring-2 ring-(--notification-surface)\",\n            style.badge ?? \"bg-[var(--tone)] text-(--notification-surface)\",\n          )}\n        >\n          <Icon className=\"size-2.5\" stroke={2.5} />\n        </span>\n      )}\n    </span>\n  );\n}\n\nfunction UndoRow({\n  notification,\n  timeout,\n  labels,\n  onUndo,\n  onExpire,\n}: {\n  notification: NotificationItem;\n  timeout: number;\n  labels: NotificationCenterLabels;\n  onUndo: () => void;\n  onExpire: () => void;\n}) {\n  const expire = React.useRef(onExpire);\n  expire.current = onExpire;\n  const remaining = React.useRef(timeout);\n  const started = React.useRef(0);\n  const timer = React.useRef<number | null>(null);\n  const holds = React.useRef({ hover: false, focus: false });\n  const [paused, setPaused] = React.useState(false);\n\n  const start = React.useCallback(() => {\n    if (timer.current !== null) return;\n    started.current = Date.now();\n    timer.current = window.setTimeout(() => expire.current(), remaining.current);\n  }, []);\n  const stop = React.useCallback(() => {\n    if (timer.current === null) return;\n    window.clearTimeout(timer.current);\n    timer.current = null;\n    remaining.current -= Date.now() - started.current;\n  }, []);\n  React.useEffect(() => {\n    start();\n    return stop;\n  }, [start, stop]);\n\n  const hold = (key: \"hover\" | \"focus\", on: boolean) => {\n    holds.current[key] = on;\n    const held = holds.current.hover || holds.current.focus;\n    if (held) stop();\n    else start();\n    setPaused(held);\n  };\n\n  return (\n    <li\n      data-slot=\"notification-center-undo\"\n      data-undo-id={notification.id}\n      onPointerEnter={() => hold(\"hover\", true)}\n      onPointerLeave={() => hold(\"hover\", false)}\n      onFocus={() => hold(\"focus\", true)}\n      onBlur={(event) => {\n        if (!event.currentTarget.contains(event.relatedTarget as Node)) hold(\"focus\", false);\n      }}\n      className=\"relative flex items-center gap-2.5 overflow-hidden rounded-xl bg-muted/40 py-1.5 ps-3 pe-1.5 ring-1 ring-border/60 ring-inset motion-safe:animate-[notification-center-row_200ms_cubic-bezier(0.22,1,0.36,1)]\"\n    >\n      <IconArchive aria-hidden=\"true\" className=\"size-4 shrink-0 text-muted-foreground\" />\n      <p className=\"min-w-0 flex-1 truncate text-[13px] leading-5 text-muted-foreground\">\n        <span className=\"font-medium text-foreground\">{labels.archived}</span>\n        <span aria-hidden=\"true\"> · </span>\n        <span className=\"sr-only\">: </span>\n        {notification.title}\n      </p>\n      <button\n        type=\"button\"\n        data-slot=\"notification-center-undo-button\"\n        onClick={onUndo}\n        className={cn(\n          \"inline-flex h-7 shrink-0 items-center rounded-lg px-2.5 text-xs font-medium text-primary transition-colors duration-150 hover:bg-primary/10 motion-reduce:transition-none\",\n          ring,\n        )}\n      >\n        {labels.undo}\n      </button>\n      <span\n        aria-hidden=\"true\"\n        className=\"pointer-events-none absolute inset-x-3 bottom-1 h-0.5 origin-left rounded-full bg-primary/35 motion-safe:animate-[notification-center-drain_linear_forwards] motion-reduce:hidden\"\n        style={{\n          animationDuration: `${timeout}ms`,\n          animationPlayState: paused ? \"paused\" : \"running\",\n        }}\n      />\n    </li>\n  );\n}\n\n/* ------------------------------------------------------------------------ */\n/* Panel                                                                     */\n/* ------------------------------------------------------------------------ */\n\ntype Variant = \"card\" | \"popover\";\n\nfunction Panel({\n  notifications: notificationsProp,\n  defaultNotifications = [],\n  onNotificationsChange,\n  tabs: extraTabs,\n  tab: tabProp,\n  defaultTab = \"all\",\n  onTabChange,\n  now: nowProp,\n  locale,\n  formatTime,\n  onOpen,\n  onAction,\n  onArchive,\n  undoTimeout = 5000,\n  renderNotification,\n  heading,\n  actions,\n  footer,\n  labels: labelsProp,\n  className,\n  style,\n  variant = \"card\",\n  onEscape,\n  ...props\n}: NotificationCenterProps & { variant?: Variant; onEscape?: () => void }) {\n  const labels = { ...defaultLabels, ...labelsProp };\n  const uid = React.useId();\n  const listRef = React.useRef<HTMLDivElement>(null);\n\n  /* ---- Clock ---- */\n  const [clock, setClock] = React.useState(() => new Date());\n  React.useEffect(() => {\n    if (nowProp) return;\n    const tick = () => setClock(new Date());\n    tick();\n    const timer = window.setInterval(tick, 30_000);\n    return () => window.clearInterval(timer);\n  }, [nowProp]);\n  const now = nowProp ?? clock;\n\n  /* ---- Controlled and uncontrolled state ---- */\n  const [listState, setListState] = React.useState(defaultNotifications);\n  const list = notificationsProp ?? listState;\n  const listRefValue = React.useRef(list);\n  listRefValue.current = list;\n  const commit = (next: NotificationItem[], change: NotificationChange) => {\n    if (notificationsProp === undefined) setListState(next);\n    onNotificationsChange?.(next, change);\n  };\n\n  const tabs = React.useMemo<NotificationTab[]>(\n    () => [\n      { id: \"all\", label: labels.all, filter: () => true },\n      { id: \"unread\", label: labels.unread, filter: (n) => !n.read },\n      ...(extraTabs ?? []),\n    ],\n    [extraTabs, labels.all, labels.unread],\n  );\n  const [tabState, setTabState] = React.useState(defaultTab);\n  const tabId = tabProp ?? tabState;\n  const tab = tabs.find((entry) => entry.id === tabId) ?? tabs[0];\n  // Rows read while in view stay put until the tab changes, so nothing jumps under the pointer.\n  const [retained, setRetained] = React.useState<{ tab: string; ids: string[] }>({\n    tab: tab.id,\n    ids: [],\n  });\n  const kept = retained.tab === tab.id ? retained.ids : [];\n  const inTab = (n: NotificationItem) => tab.filter(n) || kept.includes(n.id);\n  const changeTab = (next: string) => {\n    if (next === tab.id) return;\n    if (tabProp === undefined) setTabState(next);\n    onTabChange?.(next);\n  };\n\n  /* ---- Archive with undo ---- */\n  const [pending, setPending] = React.useState<{ item: NotificationItem; index: number }[]>([]);\n  const pendingRef = React.useRef(pending);\n  pendingRef.current = pending;\n  const archiveCallback = React.useRef(onArchive);\n  archiveCallback.current = onArchive;\n  // Closing the panel commits any archive still waiting for its undo window.\n  React.useEffect(\n    () => () => {\n      for (const entry of pendingRef.current) archiveCallback.current?.(entry.item);\n    },\n    [],\n  );\n\n  const [busy, setBusy] = React.useState<Record<string, string>>({});\n  const [announcement, setAnnouncement] = React.useState(\"\");\n  const announce = (text: string) =>\n    setAnnouncement((current) => (current === text ? `${text} ` : text));\n\n  /* ---- New arrivals ---- */\n  const known = React.useRef<Set<string> | null>(null);\n  React.useEffect(() => {\n    const ids = new Set(list.map((n) => n.id));\n    if (known.current) {\n      const fresh = list.filter((n) => !n.read && !known.current!.has(n.id)).length;\n      if (fresh) announce(labels.newNotifications(fresh));\n    }\n    known.current = ids;\n  }, [list]); // eslint-disable-line react-hooks/exhaustive-deps\n\n  /* ---- Visible rows ---- */\n  type Row = { item: NotificationItem; archived: boolean };\n  const rows: Row[] = [\n    ...list.filter(inTab).map((item) => ({ item, archived: false })),\n    ...pending\n      .filter((entry) => inTab(entry.item))\n      .map((entry) => ({ item: entry.item, archived: true })),\n  ].sort((a, b) => b.item.time.getTime() - a.item.time.getTime());\n  const live = rows.filter((row) => !row.archived);\n  const groupOf = (time: Date): NotificationRenderInfo[\"group\"] => {\n    const diff = dayNumber(now) - dayNumber(time);\n    return diff <= 0 ? \"today\" : diff === 1 ? \"yesterday\" : \"earlier\";\n  };\n  const groups = ([\"today\", \"yesterday\", \"earlier\"] as const)\n    .map((group) => ({\n      group,\n      rows: rows.filter((row) => groupOf(row.item.time) === group),\n    }))\n    .filter((entry) => entry.rows.length > 0);\n\n  /* ---- Roving focus ---- */\n  const [activeState, setActive] = React.useState<string | null>(null);\n  const active =\n    activeState && live.some((row) => row.item.id === activeState)\n      ? activeState\n      : (live[0]?.item.id ?? null);\n  const focusRequest = React.useRef<string | null>(null);\n  const focusRow = (id: string) =>\n    listRef.current\n      ?.querySelector<HTMLElement>(`[data-primary=\"${CSS.escape(id)}\"]`)\n      ?.focus();\n  React.useEffect(() => {\n    if (!focusRequest.current) return;\n    const id = focusRequest.current;\n    focusRequest.current = null;\n    focusRow(id);\n  });\n\n  /* ---- Actions ---- */\n  const setRead = (ids: string[], read: boolean, retain = true) => {\n    const targets = new Set(ids);\n    if (!list.some((n) => targets.has(n.id) && !!n.read !== read)) return;\n    if (retain)\n      setRetained({\n        tab: tab.id,\n        ids: [...kept, ...ids.filter((id) => list.some((n) => n.id === id && inTab(n)))],\n      });\n    commit(\n      list.map((n) => (targets.has(n.id) ? { ...n, read } : n)),\n      { type: read ? \"read\" : \"unread\", ids },\n    );\n  };\n\n  const archive = (item: NotificationItem) => {\n    const index = list.findIndex((n) => n.id === item.id);\n    if (index < 0) return;\n    const position = live.findIndex((row) => row.item.id === item.id);\n    const neighbor = live[position + 1] ?? live[position - 1];\n    if (listRef.current?.contains(document.activeElement)) {\n      if (neighbor) focusRequest.current = neighbor.item.id;\n    }\n    setActive(neighbor?.item.id ?? null);\n    setPending((current) => [...current, { item, index }]);\n    commit(\n      list.filter((n) => n.id !== item.id),\n      { type: \"archive\", ids: [item.id] },\n    );\n    announce(`${labels.archived}: ${item.title}`);\n  };\n\n  const undo = (id: string) => {\n    const entry = pendingRef.current.find((p) => p.item.id === id);\n    if (!entry) return;\n    setPending((current) => current.filter((p) => p.item.id !== id));\n    const current = listRefValue.current;\n    const next = [...current];\n    next.splice(Math.min(entry.index, next.length), 0, entry.item);\n    commit(next, { type: \"restore\", ids: [id] });\n    focusRequest.current = id;\n    setActive(id);\n    announce(labels.restored);\n  };\n\n  const expire = (id: string) => {\n    const entry = pendingRef.current.find((p) => p.item.id === id);\n    setPending((current) => current.filter((p) => p.item.id !== id));\n    if (entry) archiveCallback.current?.(entry.item);\n  };\n\n  const open = (item: NotificationItem) => {\n    setActive(item.id);\n    setRead([item.id], true);\n    onOpen?.(item);\n  };\n\n  const runAction = async (item: NotificationItem, action: NotificationAction) => {\n    if (busy[item.id]) return;\n    // Acting on a notification means it has been seen.\n    setRead([item.id], true);\n    const result = onAction?.(item, action);\n    if (result && typeof (result as Promise<unknown>).then === \"function\") {\n      setBusy((current) => ({ ...current, [item.id]: action.id }));\n      try {\n        await result;\n      } finally {\n        setBusy((current) => {\n          const next = { ...current };\n          delete next[item.id];\n          return next;\n        });\n      }\n    }\n    announce(labels.actionDone(action.label));\n  };\n\n  const tabUnread = (entry: NotificationTab) =>\n    list.filter((n) => !n.read && entry.filter(n)).length;\n  const visibleUnread = live.filter((row) => !row.item.read).map((row) => row.item.id);\n\n  /* ---- Keyboard ---- */\n  const onListKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n    if (event.metaKey || event.ctrlKey || event.altKey) return;\n    const target = event.target as HTMLElement;\n    const rowEl = target.closest<HTMLElement>(\"[data-notification-id]\");\n    const id = rowEl?.dataset.notificationId;\n    const index = id ? live.findIndex((row) => row.item.id === id) : -1;\n    const move = (next: number) => {\n      const row = live[Math.max(0, Math.min(live.length - 1, next))];\n      if (!row) return;\n      event.preventDefault();\n      setActive(row.item.id);\n      focusRow(row.item.id);\n    };\n    switch (event.key) {\n      case \"ArrowDown\":\n        move(index < 0 ? 0 : index + 1);\n        return;\n      case \"ArrowUp\":\n        move(index < 0 ? 0 : index - 1);\n        return;\n      case \"Home\":\n        move(0);\n        return;\n      case \"End\":\n        move(live.length - 1);\n        return;\n      case \"e\":\n      case \"E\":\n        if (index < 0) return;\n        event.preventDefault();\n        archive(live[index].item);\n        return;\n      case \"u\":\n      case \"U\":\n        if (index < 0) return;\n        event.preventDefault();\n        setRead([live[index].item.id], !live[index].item.read);\n        return;\n      case \"z\":\n      case \"Z\": {\n        const last = pendingRef.current[pendingRef.current.length - 1];\n        if (!last) return;\n        event.preventDefault();\n        undo(last.item.id);\n        return;\n      }\n      case \"Escape\":\n        if (!onEscape) return;\n        event.preventDefault();\n        onEscape();\n        return;\n    }\n  };\n\n  /* ---- Rendering ---- */\n  const groupLabel = { today: labels.today, yesterday: labels.yesterday, earlier: labels.earlier };\n  const timeFor = (time: Date) =>\n    formatTime ? formatTime(time, now) : relativeTime(time, now, locale, labels.justNow);\n  const fullTime = (time: Date) =>\n    new Intl.DateTimeFormat(locale, { dateStyle: \"medium\", timeStyle: \"short\" }).format(time);\n\n  const renderRow = (item: NotificationItem) => {\n    const read = !!item.read;\n    const isActive = item.id === active;\n    const timeLabel = timeFor(item.time);\n    const metaId = `${uid}-${item.id}-meta`;\n    const working = busy[item.id];\n    const primaryClass =\n      \"min-w-0 flex-1 text-start outline-none after:absolute after:inset-0 after:rounded-xl after:content-[''] after:transition-shadow after:duration-150 focus-visible:after:ring-2 focus-visible:after:ring-ring/50 motion-reduce:after:transition-none\";\n    const titleNode = (\n      <span\n        className={cn(\n          \"line-clamp-2 text-[13px] leading-5\",\n          read ? \"text-foreground/80\" : \"font-medium text-foreground\",\n        )}\n      >\n        {!read && <span className=\"sr-only\">{labels.unreadMarker}: </span>}\n        {item.title}\n      </span>\n    );\n    const primaryProps = {\n      \"data-primary\": item.id,\n      \"data-slot\": \"notification-center-open\",\n      tabIndex: isActive ? 0 : -1,\n      \"aria-describedby\": metaId,\n      onFocus: () => setActive(item.id),\n      onClick: () => open(item),\n      className: primaryClass,\n    };\n    return (\n      <li\n        key={item.id}\n        data-slot=\"notification-center-item\"\n        data-notification-id={item.id}\n        data-state={read ? \"read\" : \"unread\"}\n        data-kind={item.kind}\n        className={cn(\n          \"group/item relative flex gap-3 rounded-xl py-2.5 ps-[22px] pe-3 transition-colors duration-150 hover:bg-muted/60 motion-reduce:transition-none\",\n          !read && \"bg-primary/[0.035] dark:bg-primary/[0.06]\",\n        )}\n      >\n        {!read && (\n          <span\n            aria-hidden=\"true\"\n            data-slot=\"notification-center-dot\"\n            className=\"absolute start-2 top-[23px] size-1.5 rounded-full bg-primary\"\n          />\n        )}\n        <Avatar notification={item} />\n        <div className=\"min-w-0 flex-1\">\n          {renderNotification ? (\n            <div className=\"flex items-start gap-2\">\n              {item.href ? (\n                <a href={item.href} {...primaryProps}>\n                  {renderNotification(item, { read, timeLabel, group: groupOf(item.time) })}\n                </a>\n              ) : (\n                <button type=\"button\" {...primaryProps}>\n                  {renderNotification(item, { read, timeLabel, group: groupOf(item.time) })}\n                </button>\n              )}\n            </div>\n          ) : (\n            <>\n              <div className=\"flex items-start gap-3\">\n                {item.href ? (\n                  <a href={item.href} {...primaryProps}>\n                    {titleNode}\n                  </a>\n                ) : (\n                  <button type=\"button\" {...primaryProps}>\n                    {titleNode}\n                  </button>\n                )}\n                <time\n                  dateTime={item.time.toISOString()}\n                  title={fullTime(item.time)}\n                  className=\"shrink-0 pt-px text-xs leading-5 whitespace-nowrap text-muted-foreground tabular-nums transition-opacity duration-150 group-focus-within/item:opacity-0 group-hover/item:opacity-0 motion-reduce:transition-none pointer-coarse:hidden\"\n                >\n                  {timeLabel}\n                </time>\n              </div>\n              <p id={metaId} className=\"text-[13px] leading-5 text-muted-foreground\">\n                {item.body && <span className=\"line-clamp-2\">{item.body}</span>}\n                <span className=\"hidden text-xs tabular-nums pointer-coarse:inline\">{timeLabel}</span>\n                <span className=\"sr-only\">\n                  {item.body ? \", \" : \"\"}\n                  {fullTime(item.time)}\n                </span>\n              </p>\n            </>\n          )}\n          {item.actions && item.actions.length > 0 && (\n            <div className=\"relative z-10 mt-2 flex flex-wrap gap-1.5\" data-slot=\"notification-center-actions\">\n              {item.actions.map((action) => {\n                const variant = action.variant ?? \"secondary\";\n                const spinning = working === action.id;\n                return (\n                  <button\n                    key={action.id}\n                    type=\"button\"\n                    tabIndex={isActive ? 0 : -1}\n                    disabled={!!working}\n                    aria-busy={spinning || undefined}\n                    data-variant={variant}\n                    onClick={() => void runAction(item, action)}\n                    className={cn(\n                      \"inline-flex h-7 items-center gap-1.5 rounded-lg px-2.5 text-xs font-medium whitespace-nowrap transition-[color,background-color,border-color,box-shadow,opacity] duration-150 disabled:cursor-default disabled:opacity-60 motion-reduce:transition-none\",\n                      ring,\n                      variant === \"primary\"\n                        ? \"bg-primary text-primary-foreground shadow-[inset_0_1px_0_rgb(255_255_255/0.16),0_1px_2px_rgb(0_0_0/0.12)] dark:shadow-[0_4px_12px_-6px_color-mix(in_oklab,var(--color-primary)_80%,transparent),inset_0_1px_0_rgb(255_255_255/0.16)] hover:bg-primary/90\"\n                        : variant === \"destructive\"\n                          ? \"border border-border/70 bg-card text-rose-700 shadow-[0_1px_2px_rgb(0_0_0/0.04)] hover:border-rose-500/30 hover:bg-rose-500/[0.06] dark:text-rose-400\"\n                          : \"border border-border/70 bg-card text-foreground shadow-[0_1px_2px_rgb(0_0_0/0.04)] hover:bg-muted\",\n                    )}\n                  >\n                    {spinning && (\n                      <IconLoader2 aria-hidden=\"true\" className=\"size-3.5 motion-safe:animate-spin\" />\n                    )}\n                    {action.label}\n                    {spinning && <span className=\"sr-only\">, {labels.working}</span>}\n                  </button>\n                );\n              })}\n            </div>\n          )}\n        </div>\n        <div\n          data-slot=\"notification-center-quick-actions\"\n          className=\"absolute end-2 top-2 z-10 flex items-center gap-0.5 rounded-lg border border-border/70 bg-(--notification-surface) p-0.5 opacity-0 shadow-[0_4px_12px_-6px_rgb(0_0_0/0.18)] transition-opacity duration-150 group-focus-within/item:opacity-100 group-hover/item:opacity-100 motion-reduce:transition-none pointer-coarse:opacity-100\"\n        >\n          <button\n            type=\"button\"\n            tabIndex={isActive ? 0 : -1}\n            aria-label={read ? labels.markUnread : labels.markRead}\n            title={read ? labels.markUnread : labels.markRead}\n            onClick={() => setRead([item.id], !read)}\n            className={cn(\n              \"inline-flex size-6 items-center justify-center rounded-md text-muted-foreground transition-colors duration-150 hover:bg-muted hover:text-foreground motion-reduce:transition-none\",\n              ring,\n            )}\n          >\n            {read ? (\n              <IconMail aria-hidden=\"true\" className=\"size-3.5\" />\n            ) : (\n              <IconMailOpened aria-hidden=\"true\" className=\"size-3.5\" />\n            )}\n          </button>\n          <button\n            type=\"button\"\n            tabIndex={isActive ? 0 : -1}\n            aria-label={labels.archive}\n            title={`${labels.archive} (E)`}\n            aria-keyshortcuts=\"E\"\n            onClick={() => archive(item)}\n            className={cn(\n              \"inline-flex size-6 items-center justify-center rounded-md text-muted-foreground transition-colors duration-150 hover:bg-muted hover:text-foreground motion-reduce:transition-none\",\n              ring,\n            )}\n          >\n            <IconArchive aria-hidden=\"true\" className=\"size-3.5\" />\n          </button>\n        </div>\n      </li>\n    );\n  };\n\n  const empty = (\n    <div\n      data-slot=\"notification-center-empty\"\n      className=\"flex min-h-full flex-col items-center justify-center gap-3 px-6 py-12 text-center\"\n    >\n      <span className=\"relative flex size-11 items-center justify-center rounded-xl bg-muted/40 text-muted-foreground ring-1 ring-border/60 ring-inset\">\n        {tab.id === \"unread\" ? (\n          <IconBellCheck aria-hidden=\"true\" className=\"size-5\" />\n        ) : (\n          <IconInbox aria-hidden=\"true\" className=\"size-5\" />\n        )}\n      </span>\n      <div className=\"space-y-1\">\n        <p className=\"text-sm font-semibold tracking-tight\">\n          {tab.emptyTitle ?? labels.emptyTitle(tab.id)}\n        </p>\n        <p className=\"mx-auto max-w-[17rem] text-[13px] leading-5 text-muted-foreground\">\n          {tab.emptyDescription ?? labels.emptyDescription(tab.id)}\n        </p>\n      </div>\n    </div>\n  );\n\n  return (\n    <div\n      data-slot=\"notification-center\"\n      data-variant={variant}\n      className={cn(\n        \"@container/notifications relative isolate flex min-h-0 min-w-0 flex-col overflow-hidden\",\n        variant === \"card\"\n          ? cn(card, \"[--notification-surface:var(--color-card)]\")\n          : cn(frosted, \"[--notification-surface:var(--color-popover)]\"),\n        className,\n      )}\n      style={style}\n      {...props}\n    >\n      <style>{keyframes}</style>\n      <div\n        data-slot=\"notification-center-header\"\n        className=\"flex shrink-0 items-center gap-2 px-4 pt-3.5 pb-3\"\n      >\n        <h2 id={`${uid}-heading`} className=\"min-w-0 flex-1 truncate text-sm font-semibold tracking-tight\">\n          {heading ?? labels.heading}\n        </h2>\n        <button\n          type=\"button\"\n          data-slot=\"notification-center-mark-all\"\n          disabled={visibleUnread.length === 0}\n          onClick={() => {\n            setRead(visibleUnread, true, false);\n            setRetained({ tab: tab.id, ids: [] });\n            announce(labels.allRead);\n          }}\n          className={cn(\n            \"-me-1.5 inline-flex h-7 shrink-0 items-center gap-1.5 rounded-lg px-2 text-xs font-medium text-muted-foreground transition-colors duration-150 hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50 motion-reduce:transition-none\",\n            ring,\n          )}\n        >\n          <IconChecks aria-hidden=\"true\" className=\"size-3.5\" />\n          {labels.markAllRead}\n        </button>\n        {actions && <div className=\"flex shrink-0 items-center gap-1\">{actions}</div>}\n      </div>\n      <div className=\"shrink-0 px-4 pb-3\">\n        <div\n          role=\"tablist\"\n          aria-label={labels.tabs}\n          data-slot=\"notification-center-tabs\"\n          onKeyDown={(event) => {\n            const index = tabs.findIndex((entry) => entry.id === tab.id);\n            const next =\n              event.key === \"ArrowRight\"\n                ? tabs[(index + 1) % tabs.length]\n                : event.key === \"ArrowLeft\"\n                  ? tabs[(index - 1 + tabs.length) % tabs.length]\n                  : event.key === \"Home\"\n                    ? tabs[0]\n                    : event.key === \"End\"\n                      ? tabs[tabs.length - 1]\n                      : null;\n            if (!next) return;\n            event.preventDefault();\n            changeTab(next.id);\n            event.currentTarget\n              .querySelector<HTMLElement>(`[data-tab=\"${CSS.escape(next.id)}\"]`)\n              ?.focus();\n          }}\n          className=\"flex h-8 w-full items-center gap-0.5 overflow-x-auto rounded-[10px] bg-muted/60 p-1 shadow-[inset_0_0_0_1px_color-mix(in_oklab,var(--color-border)_70%,transparent)] [scrollbar-width:none] dark:bg-muted/40 [&::-webkit-scrollbar]:hidden\"\n        >\n          {tabs.map((entry) => {\n            const selected = entry.id === tab.id;\n            const count = tabUnread(entry);\n            return (\n              <button\n                key={entry.id}\n                type=\"button\"\n                role=\"tab\"\n                id={`${uid}-tab-${entry.id}`}\n                data-tab={entry.id}\n                data-state={selected ? \"active\" : \"inactive\"}\n                aria-selected={selected}\n                aria-controls={`${uid}-panel`}\n                tabIndex={selected ? 0 : -1}\n                onClick={() => changeTab(entry.id)}\n                className={cn(\n                  \"inline-flex h-6 flex-1 items-center justify-center gap-1.5 rounded-md px-2.5 text-xs font-medium whitespace-nowrap transition-[color,background-color,box-shadow] duration-150 motion-reduce:transition-none\",\n                  ring,\n                  selected\n                    ? \"bg-card text-foreground shadow-[0_1px_2px_rgb(0_0_0/0.08),0_0_0_1px_rgb(0_0_0/0.04)] dark:bg-foreground/10 dark:shadow-[inset_0_1px_0_rgb(255_255_255/0.07),0_1px_2px_rgb(0_0_0/0.5)]\"\n                    : \"text-muted-foreground hover:text-foreground\",\n                )}\n              >\n                {entry.label}\n                {count > 0 && (\n                  <span\n                    className={cn(\n                      \"inline-flex h-4 min-w-4 items-center justify-center rounded-full px-1 text-[11px] leading-none font-semibold tabular-nums\",\n                      selected\n                        ? \"bg-primary text-primary-foreground\"\n                        : \"bg-foreground/[0.07] text-muted-foreground\",\n                    )}\n                  >\n                    <span className=\"sr-only\">, </span>\n                    {count}\n                    <span className=\"sr-only\"> {labels.unread.toLowerCase()}</span>\n                  </span>\n                )}\n              </button>\n            );\n          })}\n        </div>\n      </div>\n      <div\n        ref={listRef}\n        id={`${uid}-panel`}\n        role=\"tabpanel\"\n        aria-labelledby={`${uid}-tab-${tab.id}`}\n        data-slot=\"notification-center-list\"\n        onKeyDown={onListKeyDown}\n        className=\"min-h-0 flex-1 overflow-y-auto overscroll-contain border-t border-border/60 px-2 pt-1 pb-2 [scrollbar-width:thin]\"\n      >\n        {rows.length === 0\n          ? empty\n          : groups.map(({ group, rows: groupRows }) => (\n              <section key={group} aria-labelledby={`${uid}-${group}`} className=\"pt-2\">\n                <h3\n                  id={`${uid}-${group}`}\n                  className=\"px-2.5 pb-1.5 text-xs font-medium text-muted-foreground\"\n                >\n                  {groupLabel[group]}\n                </h3>\n                <ul className=\"flex flex-col gap-1\">\n                  {groupRows.map((row) =>\n                    row.archived ? (\n                      <UndoRow\n                        key={row.item.id}\n                        notification={row.item}\n                        timeout={undoTimeout}\n                        labels={labels}\n                        onUndo={() => undo(row.item.id)}\n                        onExpire={() => expire(row.item.id)}\n                      />\n                    ) : (\n                      renderRow(row.item)\n                    ),\n                  )}\n                </ul>\n              </section>\n            ))}\n      </div>\n      {footer && (\n        <div\n          data-slot=\"notification-center-footer\"\n          className=\"shrink-0 border-t border-border/60 px-2 py-2\"\n        >\n          {footer}\n        </div>\n      )}\n      <div aria-live=\"polite\" className=\"sr-only\">\n        {announcement}\n      </div>\n    </div>\n  );\n}\n\n/* ------------------------------------------------------------------------ */\n/* Popover                                                                   */\n/* ------------------------------------------------------------------------ */\n\nfunction NotificationCenterPopover({\n  notifications: notificationsProp,\n  defaultNotifications = [],\n  onNotificationsChange,\n  open: openProp,\n  defaultOpen = false,\n  onOpenChange,\n  align = \"end\",\n  inline = false,\n  width = 380,\n  triggerClassName,\n  contentClassName,\n  labels: labelsProp,\n  className,\n  ...props\n}: NotificationCenterPopoverProps) {\n  const labels = { ...defaultLabels, ...labelsProp };\n  const [listState, setListState] = React.useState(defaultNotifications);\n  const list = notificationsProp ?? listState;\n  const unread = list.filter((n) => !n.read).length;\n  const [openState, setOpenState] = React.useState(defaultOpen);\n  const open = openProp ?? openState;\n  const triggerRef = React.useRef<HTMLButtonElement>(null);\n  const contentRef = React.useRef<HTMLDivElement>(null);\n  const userOpened = React.useRef(false);\n\n  const setOpen = (next: boolean) => {\n    if (next === open) return;\n    if (next) userOpened.current = true;\n    if (openProp === undefined) setOpenState(next);\n    onOpenChange?.(next);\n    if (inline) {\n      if (next) requestAnimationFrame(focusInside);\n      else if (contentRef.current?.contains(document.activeElement)) triggerRef.current?.focus();\n    }\n  };\n  const focusInside = () => {\n    const root = contentRef.current;\n    (\n      root?.querySelector<HTMLElement>('[data-primary][tabindex=\"0\"]') ??\n      root?.querySelector<HTMLElement>('[role=\"tab\"][tabindex=\"0\"]')\n    )?.focus();\n  };\n\n  // A gentle ring when the unread count goes up.\n  const previous = React.useRef(unread);\n  React.useEffect(() => {\n    const grew = unread > previous.current;\n    previous.current = unread;\n    if (!grew || !triggerRef.current) return;\n    if (window.matchMedia?.(\"(prefers-reduced-motion: reduce)\").matches) return;\n    triggerRef.current.querySelector(\"svg\")?.animate?.(\n      [\n        { transform: \"rotate(0)\" },\n        { transform: \"rotate(14deg)\" },\n        { transform: \"rotate(-12deg)\" },\n        { transform: \"rotate(8deg)\" },\n        { transform: \"rotate(-4deg)\" },\n        { transform: \"rotate(0)\" },\n      ],\n      { duration: 700, easing: \"cubic-bezier(0.22, 1, 0.36, 1)\" },\n    );\n  }, [unread]);\n\n  const panel = (\n    <Panel\n      {...props}\n      labels={labelsProp}\n      variant=\"popover\"\n      notifications={list}\n      onNotificationsChange={(next, change) => {\n        if (notificationsProp === undefined) setListState(next);\n        onNotificationsChange?.(next, change);\n      }}\n      onEscape={inline ? () => setOpen(false) : undefined}\n      className={cn(\n        \"w-full\",\n        inline ? \"max-h-[min(34rem,calc(100dvh-6rem))]\" : \"max-h-[min(36rem,var(--radix-popover-content-available-height))]\",\n        contentClassName,\n      )}\n    />\n  );\n\n  const trigger = (\n    <button\n      ref={triggerRef}\n      type=\"button\"\n      data-slot=\"notification-center-trigger\"\n      data-state={open ? \"open\" : \"closed\"}\n      aria-label={labels.trigger(unread)}\n      aria-haspopup=\"dialog\"\n      // Radix supplies aria-expanded and the click handler for the portalled popover.\n      {...(inline ? { \"aria-expanded\": open, onClick: () => setOpen(!open) } : {})}\n      className={cn(\n        \"relative inline-flex size-9 shrink-0 items-center justify-center rounded-xl border border-border/70 bg-card text-muted-foreground shadow-[0_1px_2px_rgb(0_0_0/0.04)] transition-[color,background-color,box-shadow] duration-150 hover:bg-muted hover:text-foreground data-[state=open]:bg-muted data-[state=open]:text-foreground motion-reduce:transition-none\",\n        ring,\n        triggerClassName,\n      )}\n    >\n      <IconBell aria-hidden=\"true\" className=\"size-[18px] origin-top\" />\n      {unread > 0 && (\n        <span\n          aria-hidden=\"true\"\n          data-slot=\"notification-center-badge\"\n          className=\"absolute -end-1.5 -top-1.5 flex h-[18px] min-w-[18px] items-center justify-center rounded-full bg-primary px-1 text-[11px] leading-none font-semibold text-primary-foreground tabular-nums ring-2 ring-card shadow-[0_1px_2px_rgb(0_0_0/0.12)] dark:shadow-[0_2px_8px_-2px_color-mix(in_oklab,var(--color-primary)_70%,transparent)]\"\n        >\n          {unread > 99 ? \"99+\" : unread}\n        </span>\n      )}\n    </button>\n  );\n\n  if (inline) {\n    return (\n      <div\n        data-slot=\"notification-center-popover\"\n        data-state={open ? \"open\" : \"closed\"}\n        className={cn(\"relative inline-flex\", className)}\n      >\n        {trigger}\n        {open && (\n          <div\n            ref={contentRef}\n            role=\"dialog\"\n            aria-label={labels.heading}\n            data-slot=\"notification-center-content\"\n            onKeyDown={(event) => {\n              if (event.key !== \"Escape\" || event.defaultPrevented) return;\n              event.preventDefault();\n              setOpen(false);\n            }}\n            // Sized to the nearest CSS container, or the viewport without one.\n            style={{ width: `min(${width}px, calc(100cqw - 2rem))` }}\n            className={cn(\n              \"absolute top-full z-30 mt-2 flex motion-safe:animate-[notification-center-in_220ms_cubic-bezier(0.22,1,0.36,1)]\",\n              align === \"end\"\n                ? \"end-0 origin-top-right\"\n                : align === \"center\"\n                  ? \"left-1/2 -translate-x-1/2 origin-top\"\n                  : \"start-0 origin-top-left\",\n            )}\n          >\n            {panel}\n          </div>\n        )}\n      </div>\n    );\n  }\n\n  return (\n    <PopoverPrimitive.Root open={open} onOpenChange={setOpen}>\n      <PopoverPrimitive.Trigger asChild>{trigger}</PopoverPrimitive.Trigger>\n      <PopoverPrimitive.Portal>\n        <PopoverPrimitive.Content\n          ref={contentRef}\n          align={align}\n          sideOffset={8}\n          collisionPadding={8}\n          aria-label={labels.heading}\n          data-slot=\"notification-center-content\"\n          onOpenAutoFocus={(event) => {\n            event.preventDefault();\n            if (userOpened.current) requestAnimationFrame(focusInside);\n          }}\n          style={{ width: `min(${width}px, calc(100vw - 16px))` }}\n          className={cn(\n            \"z-50 flex origin-(--radix-popover-content-transform-origin) outline-none motion-safe:animate-[notification-center-in_220ms_cubic-bezier(0.22,1,0.36,1)]\",\n            className,\n          )}\n        >\n          {panel}\n        </PopoverPrimitive.Content>\n      </PopoverPrimitive.Portal>\n    </PopoverPrimitive.Root>\n  );\n}\n\n/* ------------------------------------------------------------------------ */\n/* Export                                                                    */\n/* ------------------------------------------------------------------------ */\n\n/** An inbox of app notifications, grouped by day, with tabs, quick actions, and archive with undo. */\nfunction NotificationCenterRoot(props: NotificationCenterProps) {\n  return <Panel {...props} variant=\"card\" />;\n}\n\nexport const NotificationCenter = Object.assign(NotificationCenterRoot, {\n  /** A bell with an unread badge that opens the panel in a frosted popover. */\n  Popover: NotificationCenterPopover,\n});\nexport { NotificationCenterPopover };\n"
    }
  ],
  "docs": "Documentation: https://ui.overtrue.xyz/components/notification-center. Requires an initialized shadcn/ui project with Tailwind CSS v4."
}
