{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "nav-floating-island",
  "type": "registry:component",
  "title": "Nav Floating Island",
  "description": "A centered floating pill nav with a springy highlight that slides between links, a search chip with a Cmd K shortcut and an account menu. It shrinks into a compact island when compact is set or the page scrolls.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "navigation",
    "navbar",
    "floating",
    "pill",
    "command k",
    "profile menu",
    "navigation"
  ],
  "docs": "https://hyperblur.dev/effects/nav-floating-island",
  "files": [
    {
      "path": "registry/hyperblur/nav-floating-island.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/nav-floating-island.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface NavFloatingIslandLink {\n  label: string;\n  href: string;\n}\n\nexport interface NavFloatingIslandUser {\n  name: string;\n  email: string;\n  plan?: string;\n}\n\nexport interface NavFloatingIslandMenuItem {\n  label: string;\n  href?: string;\n  shortcut?: string;\n  danger?: boolean;\n}\n\nexport interface NavFloatingIslandProps extends Omit<React.HTMLAttributes<HTMLElement>, \"children\"> {\n  brand?: string;\n  links?: NavFloatingIslandLink[];\n  active?: number;\n  defaultActive?: number;\n  onActiveChange?: (index: number) => void;\n  compact?: boolean;\n  compactOnScroll?: boolean;\n  searchLabel?: string;\n  onSearch?: () => void;\n  user?: NavFloatingIslandUser | null;\n  menu?: NavFloatingIslandMenuItem[];\n  defaultMenuOpen?: boolean;\n  onMenuItemSelect?: (item: NavFloatingIslandMenuItem) => void;\n  accent?: string;\n  showBackdrop?: boolean;\n}\n\nconst css = `\n.hb-ke2 {\n  --hb-ke2-accent: #10b981;\n  position: relative;\n  box-sizing: border-box;\n  width: 100%;\n  container-type: inline-size;\n  padding: 20px 16px;\n  background: #0a0a0a;\n  color: #ededed;\n  font-family: inherit;\n  -webkit-font-smoothing: antialiased;\n}\n.hb-ke2 *, .hb-ke2 *::before, .hb-ke2 *::after { box-sizing: border-box; }\n.hb-ke2[data-backdrop=\"true\"] { min-height: 600px; overflow: hidden; }\n.hb-ke2-wrap { position: relative; z-index: 3; display: flex; justify-content: center; }\n.hb-ke2-pill {\n  position: relative;\n  display: flex;\n  align-items: center;\n  gap: 6px;\n  max-width: 100%;\n  height: 58px;\n  padding: 0 9px 0 9px;\n  border: 1px solid rgba(255,255,255,.1);\n  border-radius: 999px;\n  background: linear-gradient(180deg, rgba(28,28,30,.82), rgba(16,16,18,.82));\n  backdrop-filter: blur(16px) saturate(150%);\n  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 1px 0 rgba(0,0,0,.4), 0 18px 50px -16px rgba(0,0,0,.85), 0 0 0 6px rgba(255,255,255,.015);\n  transition: height .45s cubic-bezier(.2,.8,.2,1), padding .45s cubic-bezier(.2,.8,.2,1), gap .45s cubic-bezier(.2,.8,.2,1), box-shadow .3s ease;\n}\n.hb-ke2[data-compact=\"true\"] .hb-ke2-pill { height: 46px; padding: 0 5px; gap: 2px; }\n.hb-ke2-brand {\n  display: inline-flex;\n  align-items: center;\n  gap: 9px;\n  flex: none;\n  height: 40px;\n  padding: 0 10px 0 6px;\n  border-radius: 999px;\n  color: #ededed;\n  font-size: 15px;\n  font-weight: 650;\n  letter-spacing: -.015em;\n  text-decoration: none;\n  transition: padding .45s cubic-bezier(.2,.8,.2,1);\n}\n.hb-ke2-logo {\n  position: relative;\n  display: block;\n  flex: none;\n  width: 28px;\n  height: 28px;\n  border-radius: 50%;\n  background: conic-gradient(from 210deg, var(--hb-ke2-accent), #0ea5e9, var(--hb-ke2-accent));\n  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);\n  transition: width .45s cubic-bezier(.2,.8,.2,1), height .45s cubic-bezier(.2,.8,.2,1);\n}\n.hb-ke2-logo::after { content: \"\"; position: absolute; inset: 7px; border-radius: 50%; background: #121214; }\n.hb-ke2-word { display: inline-block; max-width: 120px; overflow: hidden; white-space: nowrap; transition: max-width .45s cubic-bezier(.2,.8,.2,1), opacity .3s ease; }\n.hb-ke2[data-compact=\"true\"] .hb-ke2-word { max-width: 0; opacity: 0; }\n.hb-ke2[data-compact=\"true\"] .hb-ke2-brand { padding: 0 4px; gap: 0; }\n.hb-ke2[data-compact=\"true\"] .hb-ke2-logo { width: 24px; height: 24px; }\n.hb-ke2-sep { width: 1px; height: 22px; flex: none; background: rgba(255,255,255,.1); }\n.hb-ke2-links {\n  position: relative;\n  display: flex;\n  align-items: center;\n  min-width: 0;\n  margin: 0;\n  padding: 0;\n  list-style: none;\n}\n.hb-ke2-hl {\n  position: absolute;\n  list-style: none;\n  top: 50%;\n  left: 0;\n  height: 36px;\n  width: 0;\n  border-radius: 999px;\n  background: rgba(255,255,255,.08);\n  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), inset 0 0 0 1px rgba(255,255,255,.05);\n  opacity: 0;\n  transform: translate3d(var(--hb-ke2-x, 0px), -50%, 0);\n  transition: transform .42s cubic-bezier(.3,1.3,.5,1), width .42s cubic-bezier(.3,1.3,.5,1), opacity .2s ease, height .45s ease;\n  pointer-events: none;\n}\n.hb-ke2-hl::after {\n  content: \"\";\n  position: absolute;\n  left: 50%;\n  bottom: -6px;\n  width: 14px;\n  height: 2px;\n  border-radius: 2px;\n  background: var(--hb-ke2-accent);\n  box-shadow: 0 0 12px 1px var(--hb-ke2-accent);\n  transform: translateX(-50%);\n  transition: opacity .2s ease;\n}\n.hb-ke2-hl[data-hover=\"true\"]::after { opacity: 0; }\n.hb-ke2[data-compact=\"true\"] .hb-ke2-hl { height: 32px; }\n.hb-ke2-link {\n  position: relative;\n  display: inline-flex;\n  align-items: center;\n  height: 36px;\n  padding: 0 14px;\n  border-radius: 999px;\n  color: #8f8f8f;\n  font-size: 14px;\n  font-weight: 500;\n  white-space: nowrap;\n  text-decoration: none;\n  transition: color .2s ease, padding .45s cubic-bezier(.2,.8,.2,1);\n}\n.hb-ke2-link:hover, .hb-ke2-link[aria-current=\"page\"] { color: #ededed; }\n.hb-ke2[data-compact=\"true\"] .hb-ke2-link { padding: 0 11px; height: 32px; font-size: 13.5px; }\n.hb-ke2-search {\n  display: inline-flex;\n  align-items: center;\n  gap: 8px;\n  flex: none;\n  height: 38px;\n  margin: 0 0 0 4px;\n  padding: 0 6px 0 12px;\n  border: 1px solid rgba(255,255,255,.08);\n  border-radius: 999px;\n  background: rgba(255,255,255,.03);\n  color: #8f8f8f;\n  font: inherit;\n  font-size: 13px;\n  cursor: pointer;\n  transition: border-color .2s ease, color .2s ease, background-color .2s ease, height .45s ease, padding .45s ease;\n}\n.hb-ke2-search:hover { color: #ededed; border-color: rgba(255,255,255,.16); background: rgba(255,255,255,.06); }\n.hb-ke2-search svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }\n.hb-ke2-stext { max-width: 90px; overflow: hidden; white-space: nowrap; transition: max-width .45s cubic-bezier(.2,.8,.2,1), opacity .3s ease; }\n.hb-ke2[data-compact=\"true\"] .hb-ke2-stext { max-width: 0; opacity: 0; }\n.hb-ke2[data-compact=\"true\"] .hb-ke2-search { height: 34px; padding: 0 5px 0 10px; }\n.hb-ke2-kbd {\n  display: inline-flex;\n  align-items: center;\n  gap: 2px;\n  height: 24px;\n  padding: 0 7px;\n  border: 1px solid rgba(255,255,255,.1);\n  border-bottom-width: 2px;\n  border-radius: 999px;\n  background: #1a1a1c;\n  color: #c4c4c4;\n  font-size: 11.5px;\n  font-weight: 600;\n  letter-spacing: .02em;\n}\n.hb-ke2-me { position: relative; flex: none; }\n.hb-ke2-av {\n  position: relative;\n  display: grid;\n  place-items: center;\n  width: 38px;\n  height: 38px;\n  margin: 0;\n  padding: 0;\n  border: 0;\n  border-radius: 50%;\n  background: linear-gradient(135deg, #f59e0b, #ef4444 60%, #8b5cf6);\n  color: #fff;\n  font: inherit;\n  font-size: 13px;\n  font-weight: 650;\n  cursor: pointer;\n  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);\n  transition: width .45s ease, height .45s ease, transform .15s ease;\n}\n.hb-ke2-av:active { transform: scale(.94); }\n.hb-ke2-av::after {\n  content: \"\";\n  position: absolute;\n  right: -1px;\n  bottom: -1px;\n  width: 11px;\n  height: 11px;\n  border: 2px solid #141416;\n  border-radius: 50%;\n  background: var(--hb-ke2-accent);\n}\n.hb-ke2[data-compact=\"true\"] .hb-ke2-av { width: 34px; height: 34px; }\n.hb-ke2-menu {\n  position: absolute;\n  z-index: 5;\n  top: calc(100% + 14px);\n  right: -6px;\n  width: 248px;\n  padding: 6px;\n  border: 1px solid rgba(255,255,255,.1);\n  border-radius: 16px;\n  background: linear-gradient(#18181a, #121214);\n  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 24px 60px -12px rgba(0,0,0,.85);\n  transform-origin: calc(100% - 24px) 0;\n  animation: hb-ke2-pop .26s cubic-bezier(.2,.9,.3,1.2) both;\n}\n.hb-ke2-head { display: flex; align-items: center; gap: 10px; padding: 10px 10px 12px; border-bottom: 1px solid rgba(255,255,255,.07); margin-bottom: 6px; }\n.hb-ke2-hn { font-size: 13.5px; font-weight: 600; }\n.hb-ke2-he { margin-top: 2px; color: #8f8f8f; font-size: 12px; }\n.hb-ke2-plan {\n  margin-left: auto;\n  align-self: flex-start;\n  padding: 2px 8px;\n  border-radius: 999px;\n  background: color-mix(in srgb, var(--hb-ke2-accent) 16%, transparent);\n  color: color-mix(in srgb, var(--hb-ke2-accent) 75%, #fff);\n  font-size: 11px;\n  font-weight: 600;\n}\n.hb-ke2-mi {\n  display: flex;\n  align-items: center;\n  width: 100%;\n  height: 36px;\n  margin: 0;\n  padding: 0 10px;\n  border: 0;\n  border-radius: 10px;\n  background: transparent;\n  color: #d4d4d4;\n  font: inherit;\n  font-size: 13.5px;\n  text-align: left;\n  text-decoration: none;\n  cursor: pointer;\n}\n.hb-ke2-mi:hover, .hb-ke2-mi:focus-visible { background: rgba(255,255,255,.06); color: #fff; outline: none; }\n.hb-ke2-mi[data-danger=\"true\"] { color: #f87171; }\n.hb-ke2-mi[data-danger=\"true\"]:hover, .hb-ke2-mi[data-danger=\"true\"]:focus-visible { background: rgba(248,113,113,.1); }\n.hb-ke2-ms { margin-left: auto; color: #6f6f6f; font-size: 12px; }\n.hb-ke2-div { height: 1px; margin: 6px 4px; background: rgba(255,255,255,.07); }\n.hb-ke2 a:focus-visible, .hb-ke2 button:focus-visible { outline: 2px solid var(--hb-ke2-accent); outline-offset: 2px; }\n.hb-ke2-stage { position: absolute; z-index: 1; inset: 0; pointer-events: none; }\n.hb-ke2-stage::before {\n  content: \"\";\n  position: absolute;\n  inset: 0;\n  background:\n    radial-gradient(40% 50% at 20% 30%, color-mix(in srgb, var(--hb-ke2-accent) 22%, transparent), transparent 70%),\n    radial-gradient(45% 55% at 85% 20%, rgba(14,165,233,.18), transparent 70%),\n    radial-gradient(60% 40% at 50% 110%, rgba(139,92,246,.16), transparent 70%);\n}\n.hb-ke2-copy { position: absolute; left: 0; right: 0; top: 150px; padding: 0 24px; text-align: center; opacity: .5; }\n.hb-ke2-t { margin: 0 auto; max-width: 760px; font-size: clamp(32px, 6.4cqi, 64px); font-weight: 650; letter-spacing: -.04em; line-height: 1.02; }\n.hb-ke2-t em { font-style: normal; color: color-mix(in srgb, var(--hb-ke2-accent) 65%, #fff); }\n.hb-ke2-sub { margin: 18px auto 0; max-width: 480px; color: #a1a1a1; font-size: 16px; line-height: 1.55; }\n.hb-ke2-shot {\n  position: absolute;\n  left: 50%;\n  bottom: -120px;\n  width: min(880px, calc(100% - 48px));\n  height: 240px;\n  border: 1px solid rgba(255,255,255,.1);\n  border-radius: 18px;\n  background: linear-gradient(#151517, #0c0c0d);\n  transform: translateX(-50%);\n  opacity: .6;\n}\n.hb-ke2-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }\n@keyframes hb-ke2-pop { from { opacity: 0; transform: translate3d(0,-6px,0) scale(.96); } to { opacity: 1; transform: none; } }\n@container (max-width: 640px) {\n  .hb-ke2-word, .hb-ke2-stext { display: none; }\n  .hb-ke2-brand { padding: 0 4px; }\n  .hb-ke2-search { padding: 0 5px 0 10px; }\n  .hb-ke2-links { overflow-x: auto; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 12px), transparent); mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 12px), transparent); }\n  .hb-ke2-links::-webkit-scrollbar { display: none; }\n  .hb-ke2-link { padding: 0 10px; font-size: 13px; }\n  .hb-ke2-sep { display: none; }\n  .hb-ke2-copy { top: 130px; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-ke2 *, .hb-ke2 *::before, .hb-ke2 *::after { animation: none !important; transition: none !important; }\n}\n`;\n\nconst defaultLinks: NavFloatingIslandLink[] = [\n  { label: \"Overview\", href: \"#\" },\n  { label: \"Reviews\", href: \"#\" },\n  { label: \"Library\", href: \"#\" },\n  { label: \"Pricing\", href: \"#\" },\n];\n\nconst defaultMenu: NavFloatingIslandMenuItem[] = [\n  { label: \"Profile\", href: \"#\", shortcut: \"P\" },\n  { label: \"Billing\", href: \"#\", shortcut: \"B\" },\n  { label: \"Keyboard shortcuts\", shortcut: \"?\" },\n  { label: \"Sign out\", danger: true },\n];\n\nconst noop = () => () => {};\n\nfunction initials(name: string) {\n  return name\n    .split(/\\s+/)\n    .filter(Boolean)\n    .slice(0, 2)\n    .map((p) => p[0]!.toUpperCase())\n    .join(\"\");\n}\n\nexport function NavFloatingIsland({\n  brand = \"Frame\",\n  links = defaultLinks,\n  active,\n  defaultActive = 0,\n  onActiveChange,\n  compact,\n  compactOnScroll = false,\n  searchLabel = \"Search\",\n  onSearch,\n  user = { name: \"Leah Moreno\", email: \"leah@frame.so\", plan: \"Pro\" },\n  menu = defaultMenu,\n  defaultMenuOpen = false,\n  onMenuItemSelect,\n  accent = \"#10b981\",\n  showBackdrop = true,\n  className = \"\",\n  style,\n  ...rest\n}: NavFloatingIslandProps) {\n  const uid = React.useId();\n  const [innerActive, setInnerActive] = React.useState(defaultActive);\n  const current = active ?? innerActive;\n  const [menuOpen, setMenuOpen] = React.useState(defaultMenuOpen);\n  const [scrolled, setScrolled] = React.useState(false);\n  const isCompact = compact ?? (compactOnScroll && scrolled);\n  const listRef = React.useRef<HTMLUListElement>(null);\n  const hlRef = React.useRef<HTMLLIElement>(null);\n  const meRef = React.useRef<HTMLDivElement>(null);\n  const avRef = React.useRef<HTMLButtonElement>(null);\n  const menuRef = React.useRef<HTMLDivElement>(null);\n  const isMac = React.useSyncExternalStore(\n    noop,\n    () => typeof navigator !== \"undefined\" && /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent),\n    () => true,\n  );\n\n  const place = React.useCallback((target: HTMLElement | null, hover: boolean) => {\n    const hl = hlRef.current;\n    const list = listRef.current;\n    if (!hl || !list) return;\n    if (!target) {\n      hl.style.opacity = \"0\";\n      return;\n    }\n    hl.style.setProperty(\"--hb-ke2-x\", `${target.offsetLeft.toFixed(1)}px`);\n    hl.style.width = `${target.offsetWidth.toFixed(1)}px`;\n    hl.style.opacity = \"1\";\n    hl.dataset.hover = hover ? \"true\" : \"false\";\n  }, []);\n\n  const toActive = React.useCallback(() => {\n    const list = listRef.current;\n    if (!list) return;\n    place(list.querySelector<HTMLElement>(`[data-hb-ke2-i=\"${current}\"]`), false);\n  }, [current, place]);\n\n  React.useLayoutEffect(() => {\n    toActive();\n    const list = listRef.current;\n    if (!list || typeof ResizeObserver === \"undefined\") return;\n    const ro = new ResizeObserver(() => toActive());\n    ro.observe(list);\n    return () => ro.disconnect();\n  }, [toActive, isCompact]);\n\n  React.useEffect(() => {\n    if (!compactOnScroll) return;\n    const onScroll = () => setScrolled(window.scrollY > 24);\n    onScroll();\n    window.addEventListener(\"scroll\", onScroll, { passive: true });\n    return () => window.removeEventListener(\"scroll\", onScroll);\n  }, [compactOnScroll]);\n\n  React.useEffect(() => {\n    if (!onSearch) return;\n    const onKey = (e: KeyboardEvent) => {\n      if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === \"k\") {\n        e.preventDefault();\n        onSearch();\n      }\n    };\n    window.addEventListener(\"keydown\", onKey);\n    return () => window.removeEventListener(\"keydown\", onKey);\n  }, [onSearch]);\n\n  React.useEffect(() => {\n    if (!menuOpen) return;\n    const onDown = (e: PointerEvent) => {\n      if (meRef.current && !meRef.current.contains(e.target as Node)) setMenuOpen(false);\n    };\n    document.addEventListener(\"pointerdown\", onDown);\n    return () => document.removeEventListener(\"pointerdown\", onDown);\n  }, [menuOpen]);\n\n  function pick(index: number) {\n    if (active === undefined) setInnerActive(index);\n    onActiveChange?.(index);\n  }\n\n  function menuItems() {\n    return menuRef.current ? Array.from(menuRef.current.querySelectorAll<HTMLElement>('[role=\"menuitem\"]')) : [];\n  }\n\n  function openMenu(focus: \"first\" | \"last\" | null) {\n    setMenuOpen(true);\n    if (focus) {\n      window.requestAnimationFrame(() => {\n        const list = menuItems();\n        (focus === \"first\" ? list[0] : list[list.length - 1])?.focus();\n      });\n    }\n  }\n\n  function closeMenu(refocus: boolean) {\n    setMenuOpen(false);\n    if (refocus) avRef.current?.focus();\n  }\n\n  function onMenuKey(e: React.KeyboardEvent) {\n    const list = menuItems();\n    const at = list.indexOf(document.activeElement as HTMLElement);\n    if (e.key === \"ArrowDown\") {\n      e.preventDefault();\n      list[(at + 1) % list.length]?.focus();\n    } else if (e.key === \"ArrowUp\") {\n      e.preventDefault();\n      list[(at - 1 + list.length) % list.length]?.focus();\n    } else if (e.key === \"Home\") {\n      e.preventDefault();\n      list[0]?.focus();\n    } else if (e.key === \"End\") {\n      e.preventDefault();\n      list[list.length - 1]?.focus();\n    } else if (e.key === \"Escape\") {\n      e.preventDefault();\n      closeMenu(true);\n    } else if (e.key === \"Tab\") {\n      closeMenu(false);\n    }\n  }\n\n  function onLinksKey(e: React.KeyboardEvent) {\n    const nodes = listRef.current ? Array.from(listRef.current.querySelectorAll<HTMLElement>(\"a\")) : [];\n    const at = nodes.indexOf(document.activeElement as HTMLElement);\n    if (at < 0) return;\n    if (e.key === \"ArrowRight\") {\n      e.preventDefault();\n      nodes[(at + 1) % nodes.length]?.focus();\n    } else if (e.key === \"ArrowLeft\") {\n      e.preventDefault();\n      nodes[(at - 1 + nodes.length) % nodes.length]?.focus();\n    }\n  }\n\n  return (\n    <nav\n      aria-label=\"Main\"\n      className={`hb-ke2 ${className}`}\n      data-compact={isCompact ? \"true\" : \"false\"}\n      data-backdrop={showBackdrop ? \"true\" : \"false\"}\n      style={{ \"--hb-ke2-accent\": accent, ...style } as React.CSSProperties}\n      {...rest}\n    >\n      <style href=\"hb-nav-floating-island\" precedence=\"default\">\n        {css}\n      </style>\n      {showBackdrop && (\n        <div className=\"hb-ke2-stage\" aria-hidden=\"true\">\n          <div className=\"hb-ke2-copy\">\n            <p className=\"hb-ke2-t\">\n              Design reviews, <em>without</em> the meeting.\n            </p>\n            <p className=\"hb-ke2-sub\">Drop a Figma link, collect threaded feedback and ship the final frame by Friday.</p>\n          </div>\n          <div className=\"hb-ke2-shot\" />\n        </div>\n      )}\n      <div className=\"hb-ke2-wrap\">\n        <div className=\"hb-ke2-pill\">\n          <a href=\"#\" className=\"hb-ke2-brand\" aria-label={`${brand} home`}>\n            <span className=\"hb-ke2-logo\" aria-hidden=\"true\" />\n            <span className=\"hb-ke2-word\">{brand}</span>\n          </a>\n          <span className=\"hb-ke2-sep\" aria-hidden=\"true\" />\n          <ul ref={listRef} className=\"hb-ke2-links\" onPointerLeave={toActive} onKeyDown={onLinksKey} onBlur={toActive}>\n            <li ref={hlRef} className=\"hb-ke2-hl\" aria-hidden=\"true\" />\n            {links.map((link, i) => (\n              <li key={link.label}>\n                <a\n                  href={link.href}\n                  className=\"hb-ke2-link\"\n                  data-hb-ke2-i={i}\n                  aria-current={i === current ? \"page\" : undefined}\n                  onPointerEnter={(e) => place(e.currentTarget, i !== current)}\n                  onFocus={(e) => place(e.currentTarget, i !== current)}\n                  onClick={() => pick(i)}\n                >\n                  {link.label}\n                </a>\n              </li>\n            ))}\n          </ul>\n          <button type=\"button\" className=\"hb-ke2-search\" onClick={() => onSearch?.()} aria-keyshortcuts={isMac ? \"Meta+K\" : \"Control+K\"}>\n            <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\">\n              <circle cx=\"7\" cy=\"7\" r=\"4.5\" />\n              <path d=\"m10.5 10.5 3 3\" />\n            </svg>\n            <span className=\"hb-ke2-stext\">{searchLabel}</span>\n            <span className=\"hb-ke2-kbd\" aria-hidden=\"true\">\n              {isMac ? \"⌘\" : \"Ctrl\"} K\n            </span>\n          </button>\n          {user && (\n            <div ref={meRef} className=\"hb-ke2-me\">\n              <button\n                ref={avRef}\n                type=\"button\"\n                className=\"hb-ke2-av\"\n                aria-haspopup=\"menu\"\n                aria-expanded={menuOpen}\n                aria-controls={`${uid}-menu`}\n                aria-label={`Account menu for ${user.name}`}\n                onClick={() => (menuOpen ? closeMenu(false) : openMenu(null))}\n                onKeyDown={(e) => {\n                  if (e.key === \"ArrowDown\" || e.key === \"Enter\" || e.key === \" \") {\n                    e.preventDefault();\n                    openMenu(\"first\");\n                  } else if (e.key === \"ArrowUp\") {\n                    e.preventDefault();\n                    openMenu(\"last\");\n                  } else if (e.key === \"Escape\") closeMenu(true);\n                }}\n              >\n                {initials(user.name)}\n              </button>\n              {menuOpen && (\n                <div ref={menuRef} id={`${uid}-menu`} role=\"menu\" aria-label=\"Account\" className=\"hb-ke2-menu\" onKeyDown={onMenuKey}>\n                  <div className=\"hb-ke2-head\" role=\"presentation\">\n                    <div>\n                      <div className=\"hb-ke2-hn\">{user.name}</div>\n                      <div className=\"hb-ke2-he\">{user.email}</div>\n                    </div>\n                    {user.plan && <span className=\"hb-ke2-plan\">{user.plan}</span>}\n                  </div>\n                  {menu.map((item, i) => {\n                    const divider = item.danger && i > 0 && !menu[i - 1]!.danger;\n                    const body = (\n                      <>\n                        {item.label}\n                        {item.shortcut && <span className=\"hb-ke2-ms\">{item.shortcut}</span>}\n                      </>\n                    );\n                    const select = () => {\n                      onMenuItemSelect?.(item);\n                      closeMenu(true);\n                    };\n                    return (\n                      <React.Fragment key={item.label}>\n                        {divider && <div className=\"hb-ke2-div\" role=\"separator\" />}\n                        {item.href ? (\n                          <a\n                            href={item.href}\n                            role=\"menuitem\"\n                            tabIndex={-1}\n                            className=\"hb-ke2-mi\"\n                            data-danger={item.danger ? \"true\" : \"false\"}\n                            onClick={select}\n                          >\n                            {body}\n                          </a>\n                        ) : (\n                          <button\n                            type=\"button\"\n                            role=\"menuitem\"\n                            tabIndex={-1}\n                            className=\"hb-ke2-mi\"\n                            data-danger={item.danger ? \"true\" : \"false\"}\n                            onClick={select}\n                          >\n                            {body}\n                          </button>\n                        )}\n                      </React.Fragment>\n                    );\n                  })}\n                </div>\n              )}\n            </div>\n          )}\n        </div>\n      </div>\n    </nav>\n  );\n}\n"
    }
  ]
}