{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "navbar-search-first",
  "type": "registry:component",
  "title": "Navbar Search First",
  "description": "A docs header built around search: the field widens and pushes the links out of the way, scope chips show live counts, matches are highlighted and every result is reachable by keyboard. On phones a search button sweeps open into a full-width field with Cancel.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "navigation",
    "navbar",
    "search",
    "combobox",
    "docs",
    "command k",
    "keyboard"
  ],
  "docs": "https://hyperblur.dev/effects/navbar-search-first",
  "files": [
    {
      "path": "registry/hyperblur/navbar-search-first.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/navbar-search-first.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface NavbarSearchFirstItem {\n  title: string;\n  section: string;\n  href: string;\n  hint?: string;\n}\n\nexport interface NavbarSearchFirstProps extends Omit<React.HTMLAttributes<HTMLElement>, \"children\" | \"onSelect\"> {\n  brand?: string;\n  placeholder?: string;\n  items?: NavbarSearchFirstItem[];\n  recent?: string[];\n  links?: { label: string; href: string }[];\n  signIn?: { label: string; href: string } | null;\n  defaultQuery?: string;\n  defaultOpen?: boolean;\n  onQueryChange?: (query: string) => void;\n  onSelect?: (item: NavbarSearchFirstItem) => void;\n  accent?: string;\n  showBackdrop?: boolean;\n}\n\nconst defaultItems: NavbarSearchFirstItem[] = [\n  { title: \"Install the CLI\", section: \"Guides\", href: \"#install\", hint: \"2 min read\" },\n  { title: \"Authentication with passkeys\", section: \"Guides\", href: \"#passkeys\", hint: \"Auth\" },\n  { title: \"Deploying to the edge\", section: \"Guides\", href: \"#edge\", hint: \"Runtime\" },\n  { title: \"Rate limits and quotas\", section: \"Guides\", href: \"#limits\", hint: \"Platform\" },\n  { title: \"Webhooks\", section: \"API\", href: \"#webhooks\", hint: \"POST /hooks\" },\n  { title: \"Create a payment intent\", section: \"API\", href: \"#intents\", hint: \"POST /v2/intents\" },\n  { title: \"List invoices\", section: \"API\", href: \"#invoices\", hint: \"GET /v2/invoices\" },\n  { title: \"Refund a charge\", section: \"API\", href: \"#refunds\", hint: \"POST /v2/refunds\" },\n  { title: \"Checkout button\", section: \"Components\", href: \"#checkout-button\", hint: \"React\" },\n  { title: \"Payment element\", section: \"Components\", href: \"#payment-element\", hint: \"React\" },\n  { title: \"Address autocomplete\", section: \"Components\", href: \"#address\", hint: \"React\" },\n  { title: \"Invoice PDF template\", section: \"Components\", href: \"#pdf\", hint: \"Server\" },\n];\n\nconst defaultRecent = [\"webhook signatures\", \"test cards\", \"idempotency keys\"];\n\nconst ease = \"cubic-bezier(.22,1,.36,1)\";\n\nconst css = `\n.hb-xj4 {\n  --hb-xj4-accent: #a78bfa;\n  position: relative;\n  box-sizing: border-box;\n  width: 100%;\n  container-type: inline-size;\n  color: #ededed;\n  font-family: inherit;\n  -webkit-font-smoothing: antialiased;\n}\n.hb-xj4 *, .hb-xj4 *::before, .hb-xj4 *::after { box-sizing: border-box; }\n.hb-xj4[data-backdrop=\"true\"] { min-height: 620px; overflow: hidden; background: #0a0a0a; }\n.hb-xj4-bar {\n  position: relative;\n  z-index: 4;\n  display: flex;\n  align-items: center;\n  gap: 16px;\n  height: 64px;\n  padding: 0 20px;\n  border-bottom: 1px solid #1f1f1f;\n  background: rgba(10,10,10,.86);\n  backdrop-filter: blur(14px) saturate(150%);\n}\n.hb-xj4-brand { display: inline-flex; align-items: center; gap: 10px; flex: none; color: #ededed; font-family: var(--font-grotesk, inherit); font-size: 16px; font-weight: 600; letter-spacing: -.02em; text-decoration: none; }\n.hb-xj4-logo { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: #ededed; color: #0a0a0a; }\n.hb-xj4-logo svg { width: 16px; height: 16px; }\n.hb-xj4-zone { position: relative; flex: 1; display: flex; justify-content: center; min-width: 0; }\n.hb-xj4-field {\n  position: relative;\n  display: flex;\n  align-items: center;\n  gap: 10px;\n  width: 100%;\n  max-width: 460px;\n  height: 42px;\n  padding: 0 8px 0 14px;\n  border: 1px solid #262626;\n  border-radius: 12px;\n  background: linear-gradient(180deg, #161616, #121212);\n  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 1px 2px rgba(0,0,0,.4);\n  transition: max-width .55s ${ease}, border-color .25s ease, box-shadow .3s ease, background-color .3s ease;\n}\n.hb-xj4-field:hover { border-color: #333; }\n.hb-xj4[data-open=\"true\"] .hb-xj4-field {\n  max-width: 680px;\n  border-color: color-mix(in srgb, var(--hb-xj4-accent) 55%, #262626);\n  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 0 0 4px color-mix(in srgb, var(--hb-xj4-accent) 16%, transparent), 0 20px 40px -20px rgba(0,0,0,.8);\n}\n.hb-xj4-field > svg { width: 17px; height: 17px; flex: none; fill: none; stroke: #8f8f8f; stroke-width: 2; stroke-linecap: round; transition: stroke .2s ease; }\n.hb-xj4[data-open=\"true\"] .hb-xj4-field > svg { stroke: var(--hb-xj4-accent); }\n.hb-xj4-input {\n  flex: 1;\n  min-width: 0;\n  height: 100%;\n  border: 0;\n  outline: none;\n  background: none;\n  color: #ededed;\n  font: inherit;\n  font-size: 14.5px;\n}\n.hb-xj4-input::placeholder { color: #6f6f6f; }\n.hb-xj4-input::-webkit-search-cancel-button { display: none; }\n.hb-xj4-kbd {\n  display: inline-flex;\n  align-items: center;\n  height: 24px;\n  padding: 0 7px;\n  border: 1px solid #2c2c2c;\n  border-bottom-width: 2px;\n  border-radius: 6px;\n  background: #1b1b1b;\n  color: #a1a1a1;\n  font-family: var(--font-mono, monospace);\n  font-size: 11px;\n  white-space: nowrap;\n}\n.hb-xj4-clear {\n  display: grid;\n  place-items: center;\n  width: 26px;\n  height: 26px;\n  border: 0;\n  border-radius: 7px;\n  background: #222;\n  color: #a1a1a1;\n  cursor: pointer;\n}\n.hb-xj4-clear svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }\n.hb-xj4-side { display: flex; align-items: center; gap: 4px; flex: none; overflow: hidden; max-width: 420px; transition: max-width .55s ${ease}, opacity .3s ease; }\n.hb-xj4[data-open=\"true\"] .hb-xj4-side { max-width: 0; opacity: 0; }\n.hb-xj4-link { height: 34px; padding: 0 12px; border-radius: 8px; color: #a1a1a1; font-size: 14px; line-height: 34px; text-decoration: none; white-space: nowrap; transition: color .2s ease, background-color .2s ease; }\n.hb-xj4-link:hover { color: #ededed; background: rgba(255,255,255,.05); }\n.hb-xj4-sign { height: 34px; padding: 0 14px; border-radius: 8px; background: #ededed; color: #0a0a0a; font-size: 14px; font-weight: 600; line-height: 34px; text-decoration: none; white-space: nowrap; margin-left: 6px; }\n.hb-xj4-mbtn, .hb-xj4-cancel { display: none; }\n.hb-xj4-panel {\n  position: absolute;\n  top: calc(100% + 10px);\n  left: 50%;\n  width: 100%;\n  max-width: 680px;\n  border: 1px solid #262626;\n  border-radius: 16px;\n  background: linear-gradient(180deg, #151515, #101010);\n  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 30px 70px -20px rgba(0,0,0,.9);\n  overflow: hidden;\n  opacity: 0;\n  visibility: hidden;\n  transform: translate(-50%, -6px) scale(.985);\n  transform-origin: 50% 0;\n  transition: opacity .2s ease, transform .35s ${ease}, visibility 0s linear .35s;\n}\n.hb-xj4[data-open=\"true\"] .hb-xj4-panel { opacity: 1; visibility: visible; transform: translate(-50%, 0) scale(1); transition: opacity .2s ease, transform .35s ${ease}, visibility 0s; }\n.hb-xj4-scopes { display: flex; gap: 6px; padding: 12px 12px 10px; border-bottom: 1px solid #1f1f1f; overflow-x: auto; scrollbar-width: none; }\n.hb-xj4-scope {\n  height: 28px;\n  padding: 0 11px;\n  border: 1px solid #262626;\n  border-radius: 999px;\n  background: transparent;\n  color: #a1a1a1;\n  font: inherit;\n  font-size: 12.5px;\n  white-space: nowrap;\n  cursor: pointer;\n  transition: color .2s ease, background-color .2s ease, border-color .2s ease;\n}\n.hb-xj4-scope:hover { color: #ededed; border-color: #333; }\n.hb-xj4-scope[aria-checked=\"true\"] { color: #0a0a0a; background: #ededed; border-color: #ededed; }\n.hb-xj4-scope span { margin-left: 6px; opacity: .55; font-variant-numeric: tabular-nums; }\n.hb-xj4-list { max-height: 320px; margin: 0; padding: 6px; list-style: none; overflow-y: auto; overscroll-behavior: contain; }\n.hb-xj4-group { padding: 10px 10px 6px; color: #6b6b6b; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }\n.hb-xj4-opt {\n  position: relative;\n  display: flex;\n  align-items: center;\n  gap: 12px;\n  height: 44px;\n  padding: 0 10px;\n  border-radius: 10px;\n  color: #d4d4d4;\n  font-size: 14px;\n  cursor: pointer;\n}\n.hb-xj4-opt[data-active=\"true\"] { background: rgba(255,255,255,.06); color: #fff; }\n.hb-xj4-opt[data-active=\"true\"]::before { content: \"\"; position: absolute; left: 0; top: 12px; bottom: 12px; width: 2px; border-radius: 2px; background: var(--hb-xj4-accent); }\n.hb-xj4-ico { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border: 1px solid #262626; border-radius: 8px; background: #181818; color: #a1a1a1; }\n.hb-xj4-ico svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }\n.hb-xj4-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.hb-xj4-t mark { background: none; color: var(--hb-xj4-accent); font-weight: 600; }\n.hb-xj4-hint { color: #6b6b6b; font-family: var(--font-mono, monospace); font-size: 11.5px; white-space: nowrap; }\n.hb-xj4-enter { display: none; color: #8f8f8f; }\n.hb-xj4-opt[data-active=\"true\"] .hb-xj4-enter { display: inline-flex; }\n.hb-xj4-opt[data-active=\"true\"] .hb-xj4-hint { display: none; }\n.hb-xj4-empty { padding: 28px 16px; color: #8f8f8f; font-size: 14px; text-align: center; }\n.hb-xj4-empty b { color: #ededed; font-weight: 500; }\n.hb-xj4-foot { display: flex; gap: 16px; padding: 10px 14px; border-top: 1px solid #1f1f1f; color: #6b6b6b; font-size: 12px; }\n.hb-xj4-foot span { display: inline-flex; align-items: center; gap: 6px; }\n.hb-xj4-foot .hb-xj4-kbd { height: 20px; padding: 0 5px; font-size: 10.5px; }\n.hb-xj4 a:focus-visible, .hb-xj4 button:focus-visible { outline: 2px solid var(--hb-xj4-accent); outline-offset: 2px; }\n@container (max-width: 640px) {\n  .hb-xj4-bar { gap: 10px; padding: 0 14px; }\n  .hb-xj4-side .hb-xj4-link { display: none; }\n  .hb-xj4-zone { justify-content: flex-end; }\n  .hb-xj4-field { display: none; }\n  .hb-xj4-mbtn {\n    display: grid;\n    place-items: center;\n    width: 38px;\n    height: 38px;\n    border: 1px solid #262626;\n    border-radius: 10px;\n    background: #141414;\n    color: #ededed;\n    cursor: pointer;\n  }\n  .hb-xj4-mbtn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }\n  .hb-xj4[data-open=\"true\"] .hb-xj4-zone {\n    position: absolute;\n    inset: 0;\n    z-index: 2;\n    align-items: center;\n    gap: 8px;\n    padding: 0 10px 0 12px;\n    background: #0c0c0c;\n    animation: hb-xj4-cover .4s ${ease};\n  }\n  .hb-xj4[data-open=\"true\"] .hb-xj4-field { display: flex; max-width: none; height: 40px; }\n  .hb-xj4[data-open=\"true\"] .hb-xj4-mbtn { display: none; }\n  .hb-xj4[data-open=\"true\"] .hb-xj4-cancel {\n    display: block;\n    height: 40px;\n    padding: 0 6px;\n    border: 0;\n    background: none;\n    color: #ededed;\n    font: inherit;\n    font-size: 14px;\n    cursor: pointer;\n  }\n  .hb-xj4-field .hb-xj4-kbd { display: none; }\n  .hb-xj4-panel { position: fixed; top: 64px; left: 0; right: 0; max-width: none; border-radius: 0 0 16px 16px; border-left: 0; border-right: 0; transform: translateY(-6px); }\n  .hb-xj4[data-backdrop=\"true\"] .hb-xj4-panel { position: absolute; top: 64px; }\n  .hb-xj4[data-open=\"true\"] .hb-xj4-panel { transform: none; }\n  .hb-xj4-foot { display: none; }\n}\n@keyframes hb-xj4-cover { from { clip-path: inset(0 0 0 calc(100% - 52px) round 10px); } to { clip-path: inset(0 0 0 0 round 0); } }\n.hb-xj4-page { position: relative; z-index: 1; max-width: 920px; margin: 0 auto; padding: 56px 20px; display: grid; grid-template-columns: 200px 1fr; gap: 40px; }\n.hb-xj4-toc { display: grid; gap: 10px; align-content: start; }\n.hb-xj4-toc span { height: 10px; border-radius: 4px; background: #1a1a1a; }\n.hb-xj4-toc span:nth-child(3n) { width: 70%; }\n.hb-xj4-toc span:nth-child(2) { background: color-mix(in srgb, var(--hb-xj4-accent) 40%, #1a1a1a); width: 80%; }\n.hb-xj4-doc h2 { margin: 0; font-size: 32px; font-weight: 600; letter-spacing: -.03em; }\n.hb-xj4-doc p { margin: 12px 0 0; color: #8f8f8f; font-size: 15px; line-height: 1.6; max-width: 560px; }\n.hb-xj4-code { margin-top: 22px; padding: 16px 18px; border: 1px solid #1f1f1f; border-radius: 12px; background: #0f0f0f; color: #a1a1a1; font-family: var(--font-mono, monospace); font-size: 13px; line-height: 1.7; }\n.hb-xj4-code b { color: var(--hb-xj4-accent); font-weight: 500; }\n@container (max-width: 640px) { .hb-xj4-page { grid-template-columns: 1fr; padding: 32px 16px; } .hb-xj4-toc { display: none; } }\n@media (prefers-reduced-motion: reduce) {\n  .hb-xj4 *, .hb-xj4 *::before, .hb-xj4 *::after { transition: none !important; animation: none !important; }\n}\n`;\n\nfunction SearchIcon() {\n  return (\n    <svg viewBox=\"0 0 20 20\" aria-hidden=\"true\">\n      <circle cx=\"9\" cy=\"9\" r=\"5.5\" />\n      <path d=\"m13.2 13.2 3.3 3.3\" />\n    </svg>\n  );\n}\n\nfunction SectionIcon({ section }: { section: string }) {\n  if (section === \"API\")\n    return (\n      <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\">\n        <path d=\"M5.5 4 2 8l3.5 4M10.5 4 14 8l-3.5 4\" />\n      </svg>\n    );\n  if (section === \"Components\")\n    return (\n      <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\">\n        <rect x=\"2.5\" y=\"2.5\" width=\"4.5\" height=\"4.5\" rx=\"1\" />\n        <rect x=\"9\" y=\"2.5\" width=\"4.5\" height=\"4.5\" rx=\"1\" />\n        <rect x=\"2.5\" y=\"9\" width=\"4.5\" height=\"4.5\" rx=\"1\" />\n        <rect x=\"9\" y=\"9\" width=\"4.5\" height=\"4.5\" rx=\"2.25\" />\n      </svg>\n    );\n  if (section === \"Recent\")\n    return (\n      <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\">\n        <circle cx=\"8\" cy=\"8\" r=\"5.5\" />\n        <path d=\"M8 5v3l2 1.5\" />\n      </svg>\n    );\n  return (\n    <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\">\n      <path d=\"M3.5 2.5h6l3 3v8h-9z\" />\n      <path d=\"M6 8.5h4M6 11h3\" />\n    </svg>\n  );\n}\n\nfunction highlight(text: string, q: string) {\n  if (!q) return text;\n  const at = text.toLowerCase().indexOf(q.toLowerCase());\n  if (at < 0) return text;\n  return (\n    <>\n      {text.slice(0, at)}\n      <mark>{text.slice(at, at + q.length)}</mark>\n      {text.slice(at + q.length)}\n    </>\n  );\n}\n\nexport function NavbarSearchFirst({\n  brand = \"Ledgerline\",\n  placeholder = \"Search docs, API and components\",\n  items = defaultItems,\n  recent = defaultRecent,\n  links = [\n    { label: \"Docs\", href: \"#docs\" },\n    { label: \"Pricing\", href: \"#pricing\" },\n    { label: \"Changelog\", href: \"#changelog\" },\n  ],\n  signIn = { label: \"Dashboard\", href: \"#dashboard\" },\n  defaultQuery = \"\",\n  defaultOpen = false,\n  onQueryChange,\n  onSelect,\n  accent = \"#a78bfa\",\n  showBackdrop = true,\n  className,\n  style,\n  ...rest\n}: NavbarSearchFirstProps) {\n  const [query, setQuery] = React.useState(defaultQuery);\n  const [open, setOpen] = React.useState(defaultOpen);\n  const [scope, setScope] = React.useState(\"All\");\n  const [activeIndex, setActiveIndex] = React.useState(0);\n  const rootRef = React.useRef<HTMLElement>(null);\n  const inputRef = React.useRef<HTMLInputElement>(null);\n  const mbtnRef = React.useRef<HTMLButtonElement>(null);\n  const baseId = React.useId();\n  const listId = `${baseId}-list`;\n\n  const sections = React.useMemo(() => Array.from(new Set(items.map((i) => i.section))), [items]);\n  const q = query.trim();\n\n  const results = React.useMemo(() => {\n    if (!q) {\n      return recent.map((r) => ({ title: r, section: \"Recent\", href: `#search=${encodeURIComponent(r)}` }) as NavbarSearchFirstItem);\n    }\n    const lower = q.toLowerCase();\n    return items\n      .filter((i) => (scope === \"All\" || i.section === scope) && (i.title.toLowerCase().includes(lower) || i.section.toLowerCase().includes(lower) || (i.hint ?? \"\").toLowerCase().includes(lower)))\n      .slice(0, 8);\n  }, [q, items, recent, scope]);\n\n  const counts = React.useMemo(() => {\n    const lower = q.toLowerCase();\n    const map: Record<string, number> = {};\n    for (const i of items) {\n      if (q && !i.title.toLowerCase().includes(lower) && !i.section.toLowerCase().includes(lower) && !(i.hint ?? \"\").toLowerCase().includes(lower)) continue;\n      map[i.section] = (map[i.section] ?? 0) + 1;\n      map.All = (map.All ?? 0) + 1;\n    }\n    return map;\n  }, [q, items]);\n\n  const active = Math.min(activeIndex, Math.max(0, results.length - 1));\n\n  React.useEffect(() => {\n    const onKey = (e: KeyboardEvent) => {\n      const target = e.target as HTMLElement | null;\n      const typing = target && (target.tagName === \"INPUT\" || target.tagName === \"TEXTAREA\" || target.isContentEditable);\n      if ((e.key === \"k\" && (e.metaKey || e.ctrlKey)) || (e.key === \"/\" && !typing)) {\n        e.preventDefault();\n        setOpen(true);\n        inputRef.current?.focus();\n      }\n    };\n    document.addEventListener(\"keydown\", onKey);\n    return () => document.removeEventListener(\"keydown\", onKey);\n  }, []);\n\n  React.useEffect(() => {\n    if (!open) return;\n    const onDown = (e: PointerEvent) => {\n      if (rootRef.current && !rootRef.current.querySelector(\".hb-xj4-zone\")?.contains(e.target as Node)) setOpen(false);\n    };\n    document.addEventListener(\"pointerdown\", onDown);\n    return () => document.removeEventListener(\"pointerdown\", onDown);\n  }, [open]);\n\n  const change = (v: string) => {\n    setQuery(v);\n    setActiveIndex(0);\n    setOpen(true);\n    onQueryChange?.(v);\n  };\n\n  const choose = (item: NavbarSearchFirstItem) => {\n    if (item.section === \"Recent\") {\n      change(item.title);\n      inputRef.current?.focus();\n      return;\n    }\n    onSelect?.(item);\n    setOpen(false);\n    inputRef.current?.blur();\n  };\n\n  const close = () => {\n    setOpen(false);\n    inputRef.current?.blur();\n    if (mbtnRef.current && mbtnRef.current.offsetParent !== null) mbtnRef.current.focus();\n  };\n\n  const onInputKey = (e: React.KeyboardEvent<HTMLInputElement>) => {\n    if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\") {\n      e.preventDefault();\n      setOpen(true);\n      if (!results.length) return;\n      setActiveIndex((active + (e.key === \"ArrowDown\" ? 1 : -1) + results.length) % results.length);\n    } else if (e.key === \"Enter\") {\n      const item = results[active];\n      if (open && item) {\n        e.preventDefault();\n        choose(item);\n      }\n    } else if (e.key === \"Escape\") {\n      e.preventDefault();\n      if (query) change(\"\");\n      else close();\n    }\n  };\n\n  const openMobile = () => {\n    setOpen(true);\n    requestAnimationFrame(() => inputRef.current?.focus());\n  };\n\n  return (\n    <header\n      ref={rootRef}\n      className={[\"hb-xj4\", className].filter(Boolean).join(\" \")}\n      data-open={open ? \"true\" : \"false\"}\n      data-backdrop={showBackdrop ? \"true\" : \"false\"}\n      style={{ \"--hb-xj4-accent\": accent, ...style } as React.CSSProperties}\n      {...rest}\n    >\n      <style href=\"hb-navbar-search-first\" precedence=\"default\">\n        {css}\n      </style>\n      <nav className=\"hb-xj4-bar\" aria-label=\"Main\">\n        <a className=\"hb-xj4-brand\" href=\"#top\">\n          <span className=\"hb-xj4-logo\" aria-hidden=\"true\">\n            <svg viewBox=\"0 0 16 16\">\n              <path d=\"M3 3h4v10H3zM9 6h4v7H9z\" fill=\"currentColor\" />\n            </svg>\n          </span>\n          {brand}\n        </a>\n        <div className=\"hb-xj4-zone\">\n          <button ref={mbtnRef} type=\"button\" className=\"hb-xj4-mbtn\" aria-label=\"Search\" onClick={openMobile}>\n            <SearchIcon />\n          </button>\n          <div className=\"hb-xj4-field\">\n            <SearchIcon />\n            <input\n              ref={inputRef}\n              className=\"hb-xj4-input\"\n              type=\"search\"\n              role=\"combobox\"\n              aria-label={placeholder}\n              aria-expanded={open}\n              aria-controls={listId}\n              aria-autocomplete=\"list\"\n              aria-activedescendant={open && results[active] ? `${baseId}-o${active}` : undefined}\n              placeholder={placeholder}\n              value={query}\n              autoComplete=\"off\"\n              spellCheck={false}\n              onChange={(e) => change(e.target.value)}\n              onFocus={() => setOpen(true)}\n              onKeyDown={onInputKey}\n            />\n            {query ? (\n              <button type=\"button\" className=\"hb-xj4-clear\" aria-label=\"Clear search\" onClick={() => { change(\"\"); inputRef.current?.focus(); }}>\n                <svg viewBox=\"0 0 12 12\" aria-hidden=\"true\">\n                  <path d=\"m3 3 6 6M9 3 3 9\" />\n                </svg>\n              </button>\n            ) : (\n              <kbd className=\"hb-xj4-kbd\">⌘ K</kbd>\n            )}\n          </div>\n          <button type=\"button\" className=\"hb-xj4-cancel\" onClick={close}>\n            Cancel\n          </button>\n          <div className=\"hb-xj4-panel\">\n            <div className=\"hb-xj4-scopes\" role=\"radiogroup\" aria-label=\"Search in\">\n              {[\"All\", ...sections].map((s) => (\n                <button\n                  key={s}\n                  type=\"button\"\n                  role=\"radio\"\n                  aria-checked={scope === s}\n                  className=\"hb-xj4-scope\"\n                  onClick={() => {\n                    setScope(s);\n                    setActiveIndex(0);\n                    inputRef.current?.focus();\n                  }}\n                >\n                  {s}\n                  <span>{counts[s] ?? 0}</span>\n                </button>\n              ))}\n            </div>\n            <ul className=\"hb-xj4-list\" id={listId} role=\"listbox\" aria-label=\"Results\">\n              {results.length === 0 && (\n                <li className=\"hb-xj4-empty\" role=\"presentation\">\n                  No results for <b>“{q}”</b>. Try a shorter term.\n                </li>\n              )}\n              {results.map((item, i) => {\n                const head = i === 0 || results[i - 1].section !== item.section;\n                return (\n                  <React.Fragment key={item.href + i}>\n                    {head && (\n                      <li className=\"hb-xj4-group\" role=\"presentation\">\n                        {item.section === \"Recent\" ? \"Recent searches\" : item.section}\n                      </li>\n                    )}\n                    <li\n                      id={`${baseId}-o${i}`}\n                      role=\"option\"\n                      aria-selected={i === active}\n                      data-active={i === active ? \"true\" : \"false\"}\n                      className=\"hb-xj4-opt\"\n                      onPointerMove={() => i !== active && setActiveIndex(i)}\n                      onPointerDown={(e) => e.preventDefault()}\n                      onClick={() => choose(item)}\n                    >\n                      <span className=\"hb-xj4-ico\">\n                        <SectionIcon section={item.section} />\n                      </span>\n                      <span className=\"hb-xj4-t\">{highlight(item.title, q)}</span>\n                      {item.hint && <span className=\"hb-xj4-hint\">{item.hint}</span>}\n                      <span className=\"hb-xj4-enter\">\n                        <kbd className=\"hb-xj4-kbd\">↵</kbd>\n                      </span>\n                    </li>\n                  </React.Fragment>\n                );\n              })}\n            </ul>\n            <div className=\"hb-xj4-foot\" aria-hidden=\"true\">\n              <span>\n                <kbd className=\"hb-xj4-kbd\">↑</kbd>\n                <kbd className=\"hb-xj4-kbd\">↓</kbd> navigate\n              </span>\n              <span>\n                <kbd className=\"hb-xj4-kbd\">↵</kbd> open\n              </span>\n              <span>\n                <kbd className=\"hb-xj4-kbd\">esc</kbd> close\n              </span>\n            </div>\n          </div>\n        </div>\n        <div className=\"hb-xj4-side\">\n          {links.map((l) => (\n            <a key={l.href} className=\"hb-xj4-link\" href={l.href}>\n              {l.label}\n            </a>\n          ))}\n          {signIn && (\n            <a className=\"hb-xj4-sign\" href={signIn.href}>\n              {signIn.label}\n            </a>\n          )}\n        </div>\n      </nav>\n      {showBackdrop && (\n        <div className=\"hb-xj4-page\" aria-hidden=\"true\">\n          <div className=\"hb-xj4-toc\">\n            <span />\n            <span />\n            <span />\n            <span />\n            <span />\n            <span />\n            <span />\n          </div>\n          <div className=\"hb-xj4-doc\">\n            <h2>Accept your first payment</h2>\n            <p>Create a payment intent on your server, confirm it on the client and listen for the webhook that tells you the money arrived.</p>\n            <div className=\"hb-xj4-code\">\n              <div>\n                <b>const</b> intent = <b>await</b> ledger.intents.create({\"{\"}\n              </div>\n              <div>&nbsp;&nbsp;amount: 4900, currency: &quot;usd&quot;,</div>\n              <div>{\"}\"});</div>\n            </div>\n          </div>\n        </div>\n      )}\n    </header>\n  );\n}\n"
    }
  ]
}