{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "popup-whats-new",
  "type": "registry:component",
  "title": "What's New Stories",
  "description": "A release announcement told as stories: segmented bars fill and advance on their own, pause on hover or keyboard focus, and each update brings an animated illustration that slides in from the direction you move.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "modals",
    "changelog",
    "announcement",
    "stories",
    "release",
    "onboarding",
    "carousel"
  ],
  "docs": "https://hyperblur.dev/effects/popup-whats-new",
  "files": [
    {
      "path": "registry/hyperblur/popup-whats-new.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/popup-whats-new.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface PopupWhatsNewItem {\n  title: string;\n  body: string;\n  tag?: string;\n  art?: \"previews\" | \"command\" | \"sync\" | React.ReactNode;\n  href?: string;\n}\n\nexport interface PopupWhatsNewProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n  version?: string;\n  date?: string;\n  items?: PopupWhatsNewItem[];\n  interval?: number;\n  autoPlay?: boolean;\n  onDone?: (dontShowAgain: boolean) => void;\n  open?: boolean;\n  defaultOpen?: boolean;\n  onOpenChange?: (open: boolean) => void;\n  showTrigger?: boolean;\n  triggerLabel?: string;\n  embedded?: boolean;\n  accent?: string;\n}\n\nconst defaultItems: PopupWhatsNewItem[] = [\n  { tag: \"New\", title: \"Preview every branch\", body: \"Each pull request now gets its own live URL with comments pinned to the page.\", art: \"previews\", href: \"#changelog\" },\n  { tag: \"Improved\", title: \"A command bar for everything\", body: \"Press ⌘K to jump to any project, run actions and switch teams without the mouse.\", art: \"command\", href: \"#changelog\" },\n  { tag: \"Faster\", title: \"Sync in under 200 ms\", body: \"Edits now reach every device almost instantly, even on hotel Wi-Fi.\", art: \"sync\", href: \"#changelog\" },\n];\n\nconst focusable = 'a[href], button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\nfunction useModal(active: boolean, panelRef: React.RefObject<HTMLElement | null>, onClose: () => void) {\n  const closeRef = React.useRef(onClose);\n  React.useEffect(() => {\n    closeRef.current = onClose;\n  });\n  React.useEffect(() => {\n    if (!active) return;\n    const panel = panelRef.current;\n    if (!panel) return;\n    const opener = document.activeElement instanceof HTMLElement ? document.activeElement : null;\n    const html = document.documentElement;\n    const prevOverflow = html.style.overflow;\n    html.style.overflow = \"hidden\";\n    (panel.querySelector<HTMLElement>(\"[data-autofocus]\") ?? panel).focus({ preventScroll: true });\n    const onKey = (e: KeyboardEvent) => {\n      if (e.key === \"Escape\") {\n        e.preventDefault();\n        closeRef.current();\n        return;\n      }\n      if (e.key !== \"Tab\") return;\n      const nodes = Array.from(panel.querySelectorAll<HTMLElement>(focusable)).filter((n) => n.getClientRects().length > 0);\n      if (!nodes.length) {\n        e.preventDefault();\n        return;\n      }\n      const first = nodes[0];\n      const last = nodes[nodes.length - 1];\n      const cur = document.activeElement;\n      if (e.shiftKey && (cur === first || cur === panel || !panel.contains(cur))) {\n        e.preventDefault();\n        last.focus();\n      } else if (!e.shiftKey && (cur === last || !panel.contains(cur))) {\n        e.preventDefault();\n        first.focus();\n      }\n    };\n    document.addEventListener(\"keydown\", onKey);\n    return () => {\n      document.removeEventListener(\"keydown\", onKey);\n      html.style.overflow = prevOverflow;\n      opener?.focus({ preventScroll: true });\n    };\n  }, [active, panelRef]);\n}\n\nfunction usePresence(open: boolean, ms: number) {\n  const [mounted, setMounted] = React.useState(open);\n  if (open && !mounted) setMounted(true);\n  React.useEffect(() => {\n    if (open || !mounted) return;\n    const t = window.setTimeout(() => setMounted(false), ms);\n    return () => window.clearTimeout(t);\n  }, [open, mounted, ms]);\n  return mounted;\n}\n\nconst css = `\n.hb-xf9 { --hb-xf9-accent: #34d6b4; box-sizing: border-box; font-family: inherit; color: #ededed; }\n.hb-xf9 *, .hb-xf9 *::before, .hb-xf9 *::after { box-sizing: border-box; }\n.hb-xf9-embedded { position: relative; width: 100%; height: 100%; display: grid; place-items: center; }\n.hb-xf9-trigger { all: unset; box-sizing: border-box; position: relative; display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px 0 12px; border-radius: 999px; font-size: 13px; font-weight: 500; color: #ededed; background: #161616; border: 1px solid #2a2a2a; cursor: pointer; transition: border-color .2s, transform .15s cubic-bezier(.3,.7,.4,1); }\n.hb-xf9-trigger:hover { border-color: #3a3a3a; }\n.hb-xf9-trigger:active { transform: scale(.97); }\n.hb-xf9-trigger:focus-visible { outline: 2px solid var(--hb-xf9-accent); outline-offset: 2px; }\n.hb-xf9-trigger i { font-style: normal; width: 7px; height: 7px; border-radius: 50%; background: var(--hb-xf9-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--hb-xf9-accent) 25%, transparent); }\n.hb-xf9-overlay { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px; min-height: 100dvh; }\n.hb-xf9-embedded .hb-xf9-overlay { position: relative; inset: auto; min-height: 0; padding: 0; width: 100%; }\n.hb-xf9-scrim { position: absolute; inset: 0; background: rgba(0,0,0,.74); backdrop-filter: blur(6px); animation: hb-xf9-fade .3s ease both; }\n.hb-xf9-embedded .hb-xf9-scrim { display: none; }\n.hb-xf9-overlay[data-state=\"closed\"] .hb-xf9-scrim { animation: hb-xf9-fade .2s ease reverse both; }\n.hb-xf9-panel { position: relative; width: min(420px, 100%); max-height: calc(100dvh - 32px); overflow: auto; border-radius: 22px; background: #101010; border: 1px solid #2a2a2a; box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 40px 80px -30px rgba(0,0,0,.9); outline: none; animation: hb-xf9-in .5s cubic-bezier(.16,1,.3,1) both; }\n.hb-xf9-overlay[data-state=\"closed\"] .hb-xf9-panel { animation: hb-xf9-out .2s cubic-bezier(.4,0,1,1) both; }\n.hb-xf9-stage { position: relative; height: 196px; overflow: hidden; background: radial-gradient(80% 90% at 50% 100%, color-mix(in srgb, var(--hb-xf9-accent) 22%, #101010), #121212 70%); border-bottom: 1px solid #1f1f1f; }\n.hb-xf9-stage::before { content: \"\"; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px); background-size: 22px 22px; mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent); }\n.hb-xf9-bars { position: absolute; top: 12px; left: 14px; right: 50px; z-index: 3; display: flex; gap: 4px; }\n.hb-xf9-seg { position: relative; flex: 1; height: 3px; border-radius: 3px; background: rgba(255,255,255,.16); overflow: hidden; }\n.hb-xf9-seg span { position: absolute; inset: 0; border-radius: inherit; background: #fff; transform-origin: left; transform: scaleX(0); }\n.hb-xf9-seg[data-s=\"past\"] span { transform: scaleX(1); }\n.hb-xf9-seg[data-s=\"now\"] span { animation: hb-xf9-bar var(--hb-xf9-ms) linear forwards; }\n.hb-xf9[data-paused=\"true\"] .hb-xf9-seg[data-s=\"now\"] span { animation-play-state: paused; }\n.hb-xf9[data-auto=\"false\"] .hb-xf9-seg[data-s=\"now\"] span { animation: none; transform: scaleX(1); }\n.hb-xf9-close { all: unset; position: absolute; top: 4px; right: 8px; z-index: 4; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: #bdbdbd; cursor: pointer; transition: background .2s, color .2s; }\n.hb-xf9-close:hover { background: rgba(255,255,255,.08); color: #fff; }\n.hb-xf9-close:focus-visible { outline: 2px solid var(--hb-xf9-accent); }\n.hb-xf9-close svg { width: 14px; height: 14px; }\n.hb-xf9-art { position: absolute; inset: 26px 0 0; display: grid; place-items: center; }\n.hb-xf9-art svg { width: 260px; max-width: 86%; height: auto; overflow: visible; }\n.hb-xf9-art[data-dir=\"1\"] { animation: hb-xf9-artR .6s cubic-bezier(.16,1,.3,1) both; }\n.hb-xf9-art[data-dir=\"-1\"] { animation: hb-xf9-artL .6s cubic-bezier(.16,1,.3,1) both; }\n.hb-xf9-tap { all: unset; position: absolute; top: 26px; bottom: 0; z-index: 2; width: 30%; cursor: pointer; }\n.hb-xf9-tap:focus-visible { outline: 2px solid var(--hb-xf9-accent); outline-offset: -4px; border-radius: 10px; }\n.hb-xf9-tap[data-side=\"prev\"] { left: 0; }\n.hb-xf9-tap[data-side=\"next\"] { right: 0; }\n.hb-xf9-copy { padding: 16px 20px 6px; min-height: 128px; }\n.hb-xf9-copy[data-dir=\"1\"] { animation: hb-xf9-txtR .5s cubic-bezier(.16,1,.3,1) .05s both; }\n.hb-xf9-copy[data-dir=\"-1\"] { animation: hb-xf9-txtL .5s cubic-bezier(.16,1,.3,1) .05s both; }\n.hb-xf9-meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: #7a7a7a; }\n.hb-xf9-tag { height: 20px; padding: 0 8px; display: inline-grid; place-items: center; border-radius: 999px; font-size: 10.5px; font-weight: 600; color: var(--hb-xf9-accent); background: color-mix(in srgb, var(--hb-xf9-accent) 12%, transparent); border: 1px solid color-mix(in srgb, var(--hb-xf9-accent) 28%, transparent); }\n.hb-xf9-ver { font-family: var(--font-mono), ui-monospace, monospace; }\n.hb-xf9-title { margin: 10px 0 0; font-family: var(--font-grotesk), var(--font-sans), sans-serif; font-size: 19px; font-weight: 600; letter-spacing: -.02em; }\n.hb-xf9-body { margin: 5px 0 0; font-size: 13px; line-height: 1.5; color: #a1a1a1; }\n.hb-xf9-more { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; font-size: 12px; font-weight: 500; color: color-mix(in srgb, var(--hb-xf9-accent) 75%, #fff); text-decoration: none; border-radius: 4px; }\n.hb-xf9-more:hover { text-decoration: underline; text-underline-offset: 3px; }\n.hb-xf9-more:focus-visible { outline: 2px solid var(--hb-xf9-accent); outline-offset: 2px; }\n.hb-xf9-foot { display: flex; align-items: center; gap: 8px; padding: 12px 20px 18px; }\n.hb-xf9-check { display: inline-flex; align-items: center; gap: 8px; margin-right: auto; font-size: 12px; color: #8f8f8f; cursor: pointer; user-select: none; }\n.hb-xf9-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }\n.hb-xf9-box { width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid #3a3a3a; display: grid; place-items: center; transition: all .2s; }\n.hb-xf9-box svg { width: 10px; height: 10px; color: #0a0a0a; opacity: 0; transform: scale(.5); transition: all .25s cubic-bezier(.3,1.6,.5,1); }\n.hb-xf9-check input:checked + .hb-xf9-box { background: var(--hb-xf9-accent); border-color: var(--hb-xf9-accent); }\n.hb-xf9-check input:checked + .hb-xf9-box svg { opacity: 1; transform: none; }\n.hb-xf9-check input:focus-visible + .hb-xf9-box { outline: 2px solid var(--hb-xf9-accent); outline-offset: 2px; }\n.hb-xf9-btn { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; height: 34px; padding: 0 14px; border-radius: 10px; font-size: 13px; font-weight: 600; cursor: pointer; transition: background .2s, transform .15s cubic-bezier(.3,.7,.4,1), filter .2s; }\n.hb-xf9-btn:active { transform: scale(.97); }\n.hb-xf9-btn:focus-visible { outline: 2px solid var(--hb-xf9-accent); outline-offset: 2px; }\n.hb-xf9-back { color: #a1a1a1; }\n.hb-xf9-back:hover { color: #ededed; background: #1a1a1a; }\n.hb-xf9-next { min-width: 84px; color: #0a0a0a; background: linear-gradient(#f5f5f5, #dadada); box-shadow: inset 0 -1px 0 rgba(0,0,0,.2); }\n.hb-xf9-next:hover { background: #fff; }\n.hb-xf9-a-float { animation: hb-xf9-float 4s ease-in-out infinite; }\n.hb-xf9-a-row { animation: hb-xf9-row 3.6s cubic-bezier(.65,0,.35,1) infinite; }\n.hb-xf9-a-dot { animation: hb-xf9-flow 1.6s linear infinite; }\n.hb-xf9-a-pop { transform-box: fill-box; transform-origin: center; animation: hb-xf9-pop .5s cubic-bezier(.3,1.6,.5,1) .5s both; }\n@keyframes hb-xf9-fade { from { opacity: 0; } }\n@keyframes hb-xf9-in { from { opacity: 0; transform: translateY(16px) scale(.97); } }\n@keyframes hb-xf9-out { to { opacity: 0; transform: scale(.97); } }\n@keyframes hb-xf9-bar { to { transform: scaleX(1); } }\n@keyframes hb-xf9-artR { from { opacity: 0; transform: translateX(40px) scale(.96); } }\n@keyframes hb-xf9-artL { from { opacity: 0; transform: translateX(-40px) scale(.96); } }\n@keyframes hb-xf9-txtR { from { opacity: 0; transform: translateX(14px); } }\n@keyframes hb-xf9-txtL { from { opacity: 0; transform: translateX(-14px); } }\n@keyframes hb-xf9-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }\n@keyframes hb-xf9-row { 0%, 20% { transform: translateY(0); } 33%, 53% { transform: translateY(22px); } 66%, 86% { transform: translateY(44px); } 100% { transform: translateY(0); } }\n@keyframes hb-xf9-flow { from { stroke-dashoffset: 24; } to { stroke-dashoffset: 0; } }\n@keyframes hb-xf9-pop { from { opacity: 0; transform: scale(.3); } }\n@media (prefers-reduced-motion: reduce) {\n  .hb-xf9 *, .hb-xf9 *::before { animation: none !important; transition: none !important; }\n  .hb-xf9-seg[data-s=\"now\"] span { transform: scaleX(1); }\n}\n`;\n\nfunction Art({ kind, accent }: { kind: string; accent: string }) {\n  if (kind === \"command\") {\n    return (\n      <svg viewBox=\"0 0 260 140\" aria-hidden=\"true\">\n        <g className=\"hb-xf9-a-float\">\n          <rect x=\"30\" y=\"8\" width=\"200\" height=\"124\" rx=\"14\" fill=\"#161616\" stroke=\"#2c2c2c\" />\n          <rect x=\"44\" y=\"22\" width=\"172\" height=\"24\" rx=\"7\" fill=\"#0e0e0e\" stroke=\"#262626\" />\n          <circle cx=\"57\" cy=\"34\" r=\"4.5\" fill=\"none\" stroke=\"#6f6f6f\" strokeWidth=\"1.6\" />\n          <rect x=\"68\" y=\"31\" width=\"64\" height=\"6\" rx=\"3\" fill=\"#3a3a3a\" />\n          <rect x=\"188\" y=\"28\" width=\"20\" height=\"12\" rx=\"3\" fill=\"none\" stroke=\"#3a3a3a\" />\n          <g className=\"hb-xf9-a-row\">\n            <rect x=\"40\" y=\"54\" width=\"180\" height=\"20\" rx=\"6\" fill={accent} opacity=\".16\" />\n            <rect x=\"40\" y=\"54\" width=\"3\" height=\"20\" rx=\"1.5\" fill={accent} />\n          </g>\n          {[0, 1, 2].map((i) => (\n            <g key={i}>\n              <rect x=\"50\" y={59 + i * 22} width=\"10\" height=\"10\" rx=\"3\" fill=\"#2c2c2c\" />\n              <rect x=\"68\" y={61 + i * 22} width={[70, 92, 58][i]} height=\"6\" rx=\"3\" fill=\"#4a4a4a\" />\n              <rect x=\"190\" y={60 + i * 22} width=\"22\" height=\"8\" rx=\"2.5\" fill=\"#222\" />\n            </g>\n          ))}\n        </g>\n      </svg>\n    );\n  }\n  if (kind === \"sync\") {\n    return (\n      <svg viewBox=\"0 0 260 140\" aria-hidden=\"true\">\n        <rect x=\"18\" y=\"20\" width=\"120\" height=\"84\" rx=\"10\" fill=\"#161616\" stroke=\"#2c2c2c\" />\n        <rect x=\"28\" y=\"30\" width=\"100\" height=\"64\" rx=\"5\" fill=\"#0e0e0e\" />\n        <rect x=\"36\" y=\"40\" width=\"50\" height=\"6\" rx=\"3\" fill={accent} />\n        <rect x=\"36\" y=\"52\" width=\"80\" height=\"5\" rx=\"2.5\" fill=\"#3a3a3a\" />\n        <rect x=\"36\" y=\"62\" width=\"70\" height=\"5\" rx=\"2.5\" fill=\"#3a3a3a\" />\n        <path d=\"M8 108h140l-6 8H14Z\" fill=\"#1d1d1d\" />\n        <rect x=\"190\" y=\"30\" width=\"54\" height=\"96\" rx=\"12\" fill=\"#161616\" stroke=\"#2c2c2c\" />\n        <rect x=\"197\" y=\"40\" width=\"40\" height=\"76\" rx=\"6\" fill=\"#0e0e0e\" />\n        <rect x=\"203\" y=\"48\" width=\"22\" height=\"5\" rx=\"2.5\" fill={accent} />\n        <rect x=\"203\" y=\"58\" width=\"28\" height=\"4\" rx=\"2\" fill=\"#3a3a3a\" />\n        <rect x=\"203\" y=\"66\" width=\"24\" height=\"4\" rx=\"2\" fill=\"#3a3a3a\" />\n        <path d=\"M140 62 C160 62 168 78 188 78\" fill=\"none\" stroke={accent} strokeWidth=\"2\" strokeLinecap=\"round\" strokeDasharray=\"4 8\" className=\"hb-xf9-a-dot\" />\n        <path d=\"M188 92 C168 92 160 76 140 76\" fill=\"none\" stroke=\"#4a4a4a\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeDasharray=\"4 8\" className=\"hb-xf9-a-dot\" />\n        <g className=\"hb-xf9-a-pop\">\n          <rect x=\"146\" y=\"8\" width=\"44\" height=\"20\" rx=\"10\" fill=\"#0e0e0e\" stroke={accent} />\n          <text x=\"168\" y=\"22\" textAnchor=\"middle\" fontSize=\"10\" fontFamily=\"ui-monospace, monospace\" fill={accent}>180ms</text>\n        </g>\n      </svg>\n    );\n  }\n  return (\n    <svg viewBox=\"0 0 260 140\" aria-hidden=\"true\">\n      <g className=\"hb-xf9-a-float\">\n        <rect x=\"26\" y=\"10\" width=\"208\" height=\"122\" rx=\"12\" fill=\"#161616\" stroke=\"#2c2c2c\" />\n        <circle cx=\"40\" cy=\"22\" r=\"3\" fill=\"#ff5f57\" />\n        <circle cx=\"50\" cy=\"22\" r=\"3\" fill=\"#febc2e\" />\n        <circle cx=\"60\" cy=\"22\" r=\"3\" fill=\"#28c840\" />\n        <rect x=\"74\" y=\"16\" width=\"112\" height=\"12\" rx=\"6\" fill=\"#0e0e0e\" />\n        <text x=\"82\" y=\"25\" fontSize=\"7.5\" fontFamily=\"ui-monospace, monospace\" fill=\"#8f8f8f\">feat-checkout.acme.dev</text>\n        <rect x=\"38\" y=\"40\" width=\"96\" height=\"10\" rx=\"4\" fill=\"#3a3a3a\" />\n        <rect x=\"38\" y=\"56\" width=\"140\" height=\"6\" rx=\"3\" fill=\"#2a2a2a\" />\n        <rect x=\"38\" y=\"68\" width=\"120\" height=\"6\" rx=\"3\" fill=\"#2a2a2a\" />\n        <rect x=\"38\" y=\"84\" width=\"84\" height=\"36\" rx=\"7\" fill=\"#1f1f1f\" />\n        <rect x=\"130\" y=\"84\" width=\"92\" height=\"36\" rx=\"7\" fill=\"#1f1f1f\" />\n      </g>\n      <g className=\"hb-xf9-a-pop\">\n        <circle cx=\"168\" cy=\"90\" r=\"11\" fill={accent} />\n        <text x=\"168\" y=\"94\" textAnchor=\"middle\" fontSize=\"10\" fontWeight=\"700\" fill=\"#0a0a0a\">3</text>\n      </g>\n      <g className=\"hb-xf9-a-pop\" style={{ animationDelay: \".8s\" }}>\n        <rect x=\"178\" y=\"98\" width=\"70\" height=\"26\" rx=\"8\" fill=\"#0e0e0e\" stroke=\"#2c2c2c\" />\n        <rect x=\"186\" y=\"106\" width=\"40\" height=\"4\" rx=\"2\" fill=\"#5a5a5a\" />\n        <rect x=\"186\" y=\"114\" width=\"28\" height=\"4\" rx=\"2\" fill=\"#3a3a3a\" />\n      </g>\n    </svg>\n  );\n}\n\nexport function PopupWhatsNew({\n  version = \"v4.2\",\n  date = \"Nov 6\",\n  items = defaultItems,\n  interval = 6000,\n  autoPlay = true,\n  onDone,\n  open,\n  defaultOpen,\n  onOpenChange,\n  showTrigger = true,\n  triggerLabel = \"What's new\",\n  embedded = false,\n  accent = \"#34d6b4\",\n  className = \"\",\n  style,\n  ...rest\n}: PopupWhatsNewProps) {\n  const uid = React.useId().replace(/[^a-zA-Z0-9_-]/g, \"\");\n  const [inner, setInner] = React.useState(defaultOpen ?? embedded);\n  const isOpen = open ?? inner;\n  const mounted = usePresence(isOpen, 220);\n  const panelRef = React.useRef<HTMLDivElement>(null);\n  const triggerRef = React.useRef<HTMLButtonElement>(null);\n  const touched = React.useRef(false);\n  const [index, setIndex] = React.useState(0);\n  const [dir, setDir] = React.useState(1);\n  const [hover, setHover] = React.useState(false);\n  const [focusIn, setFocusIn] = React.useState(false);\n  const [dontShow, setDontShow] = React.useState(false);\n  const count = items.length;\n  const item = items[Math.min(index, count - 1)];\n  const last = index >= count - 1;\n\n  const setOpen = React.useCallback(\n    (value: boolean) => {\n      touched.current = true;\n      if (open === undefined) setInner(value);\n      onOpenChange?.(value);\n    },\n    [open, onOpenChange],\n  );\n  const close = React.useCallback(() => setOpen(false), [setOpen]);\n  useModal(isOpen && !embedded, panelRef, close);\n\n  React.useEffect(() => {\n    if (!embedded || !touched.current) return;\n    if (isOpen) panelRef.current?.focus({ preventScroll: true });\n    else triggerRef.current?.focus({ preventScroll: true });\n  }, [embedded, isOpen]);\n\n  const go = (next: number) => {\n    if (next < 0 || next >= count) return;\n    setDir(next > index ? 1 : -1);\n    setIndex(next);\n  };\n\n  const done = () => {\n    onDone?.(dontShow);\n    close();\n  };\n\n  if (!item) return null;\n  const kind = typeof item.art === \"string\" ? item.art : \"previews\";\n  const custom = item.art !== undefined && typeof item.art !== \"string\" ? item.art : null;\n\n  return (\n    <div\n      className={`hb-xf9 ${embedded ? \"hb-xf9-embedded\" : \"\"} ${className}`}\n      data-paused={hover || focusIn ? \"true\" : \"false\"}\n      data-auto={autoPlay ? \"true\" : \"false\"}\n      style={{ \"--hb-xf9-accent\": accent, \"--hb-xf9-ms\": `${interval}ms`, ...style } as React.CSSProperties}\n      onKeyDown={(e) => {\n        if (embedded && e.key === \"Escape\" && isOpen) {\n          e.stopPropagation();\n          close();\n        }\n      }}\n      {...rest}\n    >\n      <style href=\"hb-popup-whats-new\" precedence=\"default\">{css}</style>\n      {showTrigger && (!embedded || !mounted) && (\n        <button ref={triggerRef} type=\"button\" className=\"hb-xf9-trigger\" aria-haspopup=\"dialog\" onClick={() => { setIndex(0); setOpen(true); }}>\n          <i aria-hidden=\"true\" />\n          {triggerLabel}\n        </button>\n      )}\n      {mounted && (\n        <div className=\"hb-xf9-overlay\" data-state={isOpen ? \"open\" : \"closed\"}>\n          <div className=\"hb-xf9-scrim\" onClick={close} aria-hidden=\"true\" />\n          <div\n            ref={panelRef}\n            className=\"hb-xf9-panel\"\n            role=\"dialog\"\n            aria-modal={embedded ? undefined : true}\n            aria-roledescription=\"announcement\"\n            aria-labelledby={`${uid}-t`}\n            aria-describedby={`${uid}-b`}\n            tabIndex={-1}\n            onPointerEnter={() => setHover(true)}\n            onPointerLeave={() => setHover(false)}\n            onFocus={(e) => setFocusIn(e.target !== e.currentTarget && e.target.matches(\":focus-visible\"))}\n            onBlur={(e) => {\n              if (!e.currentTarget.contains(e.relatedTarget as Node)) setFocusIn(false);\n            }}\n            onKeyDown={(e) => {\n              if (e.target instanceof HTMLInputElement) return;\n              if (e.key === \"ArrowRight\") go(index + 1);\n              if (e.key === \"ArrowLeft\") go(index - 1);\n            }}\n          >\n            <div className=\"hb-xf9-stage\">\n              <div className=\"hb-xf9-bars\" aria-hidden=\"true\">\n                {items.map((it, i) => (\n                  <span key={it.title} className=\"hb-xf9-seg\" data-s={i < index ? \"past\" : i === index ? \"now\" : \"next\"}>\n                    <span\n                      key={i === index ? `${index}-now` : i}\n                      onAnimationEnd={() => {\n                        if (i === index && !last) go(index + 1);\n                      }}\n                    />\n                  </span>\n                ))}\n              </div>\n              <button type=\"button\" className=\"hb-xf9-close\" aria-label=\"Close\" onClick={close}>\n                <svg viewBox=\"0 0 14 14\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" aria-hidden=\"true\"><path d=\"m3 3 8 8M11 3l-8 8\" /></svg>\n              </button>\n              <div className=\"hb-xf9-art\" key={`a${index}`} data-dir={dir} aria-hidden=\"true\">\n                {custom ?? <Art kind={kind} accent={accent} />}\n              </div>\n              {index > 0 && <button type=\"button\" className=\"hb-xf9-tap\" data-side=\"prev\" tabIndex={-1} aria-label=\"Previous update\" onClick={() => go(index - 1)} />}\n              {!last && <button type=\"button\" className=\"hb-xf9-tap\" data-side=\"next\" tabIndex={-1} aria-label=\"Next update\" onClick={() => go(index + 1)} />}\n            </div>\n            <div className=\"hb-xf9-copy\" key={`c${index}`} data-dir={dir} aria-live=\"polite\">\n              <div className=\"hb-xf9-meta\">\n                {item.tag && <span className=\"hb-xf9-tag\">{item.tag}</span>}\n                <span className=\"hb-xf9-ver\">{version}</span>\n                <span aria-hidden=\"true\">·</span>\n                <span>{date}</span>\n                <span style={{ marginLeft: \"auto\" }}>{index + 1} of {count}</span>\n              </div>\n              <h2 className=\"hb-xf9-title\" id={`${uid}-t`}>{item.title}</h2>\n              <p className=\"hb-xf9-body\" id={`${uid}-b`}>{item.body}</p>\n              {item.href && (\n                <a className=\"hb-xf9-more\" href={item.href}>\n                  Read the changelog\n                  <svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\"><path d=\"M2.5 6h7M6.5 3l3 3-3 3\" /></svg>\n                </a>\n              )}\n            </div>\n            <div className=\"hb-xf9-foot\">\n              <label className=\"hb-xf9-check\">\n                <input type=\"checkbox\" checked={dontShow} onChange={(e) => setDontShow(e.target.checked)} />\n                <span className=\"hb-xf9-box\" aria-hidden=\"true\">\n                  <svg viewBox=\"0 0 10 10\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\"><path d=\"m2 5.2 2 2 4-4.4\" /></svg>\n                </span>\n                Don&apos;t show again\n              </label>\n              {index > 0 && <button type=\"button\" className=\"hb-xf9-btn hb-xf9-back\" onClick={() => go(index - 1)}>Back</button>}\n              <button type=\"button\" className=\"hb-xf9-btn hb-xf9-next\" data-autofocus onClick={() => (last ? done() : go(index + 1))}>\n                {last ? \"Got it\" : \"Next\"}\n              </button>\n            </div>\n          </div>\n        </div>\n      )}\n    </div>\n  );\n}\n"
    }
  ]
}