{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "map-directions-card",
  "type": "registry:component",
  "title": "Map Directions Card",
  "description": "A location card with a locally drawn street map, a dropping pin and an animated route, the address, an hours line, a distance chip, and Open in Maps and Open in Waze links built from the address or coordinates.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "ordering",
    "map",
    "directions",
    "location",
    "address",
    "waze",
    "store"
  ],
  "docs": "https://hyperblur.dev/effects/map-directions-card",
  "files": [
    {
      "path": "registry/hyperblur/map-directions-card.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/map-directions-card.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface MapDirectionsLabels {\n  openMaps: string;\n  openWaze: string;\n  mapLabel: string;\n  you: string;\n}\n\nexport interface MapDirectionsCardProps extends React.HTMLAttributes<HTMLDivElement> {\n  name?: string;\n  address?: string;\n  lat?: number;\n  lng?: number;\n  hours?: string;\n  status?: \"open\" | \"closing\" | \"closed\";\n  distance?: string;\n  streets?: string[];\n  showRoute?: boolean;\n  appearance?: \"dark\" | \"light\";\n  accent?: string;\n  labels?: Partial<MapDirectionsLabels>;\n  onDirections?: (app: \"maps\" | \"waze\", href: string) => void;\n}\n\nconst defaultLabels: MapDirectionsLabels = {\n  openMaps: \"Open in Maps\",\n  openWaze: \"Open in Waze\",\n  mapLabel: \"Map showing {name}\",\n  you: \"You\",\n};\n\nexport function buildMapsHref(address: string, lat?: number, lng?: number): string {\n  const query = typeof lat === \"number\" && typeof lng === \"number\" ? `${lat},${lng}` : address;\n  return `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(query)}`;\n}\n\nexport function buildWazeHref(address: string, lat?: number, lng?: number): string {\n  if (typeof lat === \"number\" && typeof lng === \"number\") {\n    return `https://waze.com/ul?ll=${lat},${lng}&navigate=yes`;\n  }\n  return `https://waze.com/ul?q=${encodeURIComponent(address)}&navigate=yes`;\n}\n\nconst css = `\n.hb-od2 {\n  --hb-od2-accent: #2f7bff;\n  --hb-od2-bg: #111111;\n  --hb-od2-line: #262626;\n  --hb-od2-text: #ededed;\n  --hb-od2-muted: #8f8f8f;\n  --hb-od2-land: #15171c;\n  --hb-od2-block: #1c1f26;\n  --hb-od2-road: #2b2f39;\n  --hb-od2-major: #3a3f4b;\n  --hb-od2-park: #17291f;\n  --hb-od2-water: #142235;\n  --hb-od2-label: #6c7280;\n  box-sizing: border-box;\n  container-type: inline-size;\n  width: 100%;\n  color: var(--hb-od2-text);\n  font-family: inherit;\n  font-size: 12px;\n  line-height: 1.4;\n}\n.hb-od2[data-appearance=\"light\"] {\n  --hb-od2-bg: #ffffff;\n  --hb-od2-line: #e6e4de;\n  --hb-od2-text: #151515;\n  --hb-od2-muted: #6d6d6d;\n  --hb-od2-land: #f1efe9;\n  --hb-od2-block: #e6e3da;\n  --hb-od2-road: #ffffff;\n  --hb-od2-major: #ffffff;\n  --hb-od2-park: #d7ebd2;\n  --hb-od2-water: #cfe2f5;\n  --hb-od2-label: #8a877f;\n}\n.hb-od2 *, .hb-od2 *::before, .hb-od2 *::after { box-sizing: border-box; }\n.hb-od2-card {\n  display: grid;\n  grid-template-columns: 1fr;\n  overflow: hidden;\n  border: 1px solid var(--hb-od2-line);\n  border-radius: 18px;\n  background: var(--hb-od2-bg);\n  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);\n}\n.hb-od2-map {\n  position: relative;\n  min-height: 132px;\n  overflow: hidden;\n  background: var(--hb-od2-land);\n}\n.hb-od2-map > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }\n.hb-od2-route {\n  fill: none;\n  stroke: var(--hb-od2-accent);\n  stroke-width: 2.4;\n  stroke-linecap: round;\n  stroke-linejoin: round;\n  stroke-dasharray: 220;\n  stroke-dashoffset: 220;\n  animation: hb-od2-draw 1.4s 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;\n}\n.hb-od2-glow { fill: none; stroke: var(--hb-od2-accent); stroke-width: 7; stroke-linecap: round; opacity: 0.16; }\n.hb-od2-me { fill: #ffffff; stroke: var(--hb-od2-accent); stroke-width: 2.4; }\n.hb-od2-mehalo { fill: var(--hb-od2-accent); opacity: 0.18; }\n.hb-od2-pinbody {\n  transform-box: fill-box;\n  transform-origin: 50% 100%;\n  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.35));\n  animation: hb-od2-drop 0.7s 0.15s cubic-bezier(0.3, 1.5, 0.5, 1) both;\n}\n.hb-od2-shadow {\n  fill: rgba(0, 0, 0, 0.35);\n  transform-box: fill-box;\n  transform-origin: center;\n  animation: hb-od2-shade 0.7s 0.15s cubic-bezier(0.3, 1.5, 0.5, 1) both;\n}\n.hb-od2-ring {\n  fill: none;\n  stroke: var(--hb-od2-accent);\n  stroke-width: 1.2;\n  opacity: 0;\n  transform-box: fill-box;\n  transform-origin: center;\n  animation: hb-od2-ring 2.4s 1s ease-out infinite;\n}\n.hb-od2-chip {\n  position: absolute;\n  left: 10px;\n  top: 10px;\n  display: inline-flex;\n  align-items: center;\n  gap: 5px;\n  height: 24px;\n  padding: 0 9px;\n  border: 1px solid color-mix(in srgb, var(--hb-od2-text) 12%, transparent);\n  border-radius: 999px;\n  background: color-mix(in srgb, var(--hb-od2-bg) 82%, transparent);\n  backdrop-filter: blur(8px);\n  -webkit-backdrop-filter: blur(8px);\n  color: var(--hb-od2-text);\n  font-size: 11px;\n  font-weight: 600;\n  white-space: nowrap;\n  font-variant-numeric: tabular-nums;\n}\n.hb-od2-chip svg { color: var(--hb-od2-accent); }\n.hb-od2-info {\n  display: flex;\n  min-width: 0;\n  flex-direction: column;\n  gap: 6px;\n  padding: 12px 13px;\n}\n.hb-od2-name {\n  margin: 0;\n  overflow: hidden;\n  font-size: 14px;\n  font-weight: 600;\n  letter-spacing: -0.01em;\n  text-overflow: ellipsis;\n  white-space: nowrap;\n}\n.hb-od2-addr {\n  display: -webkit-box;\n  margin: 0;\n  overflow: hidden;\n  color: var(--hb-od2-muted);\n  font-size: 11.5px;\n  font-style: normal;\n  line-height: 1.45;\n  -webkit-line-clamp: 2;\n  -webkit-box-orient: vertical;\n}\n.hb-od2-hours {\n  display: flex;\n  min-width: 0;\n  align-items: center;\n  gap: 6px;\n  font-size: 11.5px;\n  white-space: nowrap;\n}\n.hb-od2-hours span:last-child { overflow: hidden; text-overflow: ellipsis; }\n.hb-od2-dot {\n  flex: none;\n  width: 7px;\n  height: 7px;\n  border-radius: 50%;\n  background: #22c55e;\n  box-shadow: 0 0 0 3px color-mix(in srgb, #22c55e 20%, transparent);\n}\n.hb-od2-hours[data-status=\"closing\"] .hb-od2-dot { background: #f59e0b; box-shadow: 0 0 0 3px color-mix(in srgb, #f59e0b 22%, transparent); }\n.hb-od2-hours[data-status=\"closed\"] .hb-od2-dot { background: #ef4444; box-shadow: 0 0 0 3px color-mix(in srgb, #ef4444 20%, transparent); }\n.hb-od2-actions {\n  display: grid;\n  grid-template-columns: 1fr;\n  gap: 6px;\n  margin-top: auto;\n  padding-top: 2px;\n}\n.hb-od2-btn {\n  display: inline-flex;\n  min-width: 0;\n  align-items: center;\n  justify-content: center;\n  gap: 7px;\n  height: 29px;\n  padding: 0 12px;\n  border: 1px solid var(--hb-od2-line);\n  border-radius: 999px;\n  color: var(--hb-od2-text);\n  font-size: 11.5px;\n  font-weight: 600;\n  text-decoration: none;\n  white-space: nowrap;\n  transition: background 0.18s ease, border-color 0.18s ease, transform 0.12s ease;\n}\n.hb-od2-btn:hover { border-color: color-mix(in srgb, var(--hb-od2-text) 30%, transparent); background: color-mix(in srgb, var(--hb-od2-text) 5%, transparent); }\n.hb-od2-btn:active { transform: scale(0.97); }\n.hb-od2-btn:focus-visible { outline: 2px solid var(--hb-od2-accent); outline-offset: 2px; }\n.hb-od2-btn[data-primary=\"true\"] { border-color: transparent; background: var(--hb-od2-accent); color: #ffffff; }\n.hb-od2-btn[data-primary=\"true\"]:hover { background: color-mix(in srgb, var(--hb-od2-accent) 86%, #ffffff); }\n.hb-od2-btn svg { flex: none; }\n@container (min-width: 320px) {\n  .hb-od2-card { grid-template-columns: minmax(0, 0.85fr) minmax(0, 1fr); }\n  .hb-od2-map { min-height: 168px; }\n}\n@container (min-width: 560px) {\n  .hb-od2-card { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }\n  .hb-od2-map { min-height: 240px; }\n  .hb-od2-info { gap: 10px; padding: 22px; }\n  .hb-od2-name { font-size: 17px; }\n  .hb-od2-addr, .hb-od2-hours { font-size: 13px; }\n  .hb-od2-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }\n  .hb-od2-btn { height: 38px; font-size: 12.5px; }\n}\n@keyframes hb-od2-draw { to { stroke-dashoffset: 0; } }\n@keyframes hb-od2-drop {\n  0% { opacity: 0; transform: translateY(-36px) scale(0.9); }\n  60% { opacity: 1; }\n  100% { opacity: 1; transform: translateY(0) scale(1); }\n}\n@keyframes hb-od2-shade {\n  0% { opacity: 0; transform: scale(0.3); }\n  100% { opacity: 1; transform: scale(1); }\n}\n@keyframes hb-od2-ring {\n  0% { opacity: 0.7; transform: scale(0.4); }\n  100% { opacity: 0; transform: scale(1.8); }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-od2-route { animation: none; stroke-dashoffset: 0; }\n  .hb-od2-pinbody, .hb-od2-shadow { animation: none; }\n  .hb-od2-ring { animation: none; opacity: 0; }\n  .hb-od2-btn { transition: none; }\n}\n`;\n\nfunction hash(n: number): number {\n  let x = (n + 0x9e3779b9) | 0;\n  x = Math.imul(x ^ (x >>> 16), 0x85ebca6b);\n  x = Math.imul(x ^ (x >>> 13), 0xc2b2ae35);\n  return ((x ^ (x >>> 16)) >>> 0) / 4294967296;\n}\n\nconst cols = [0, 34, 70, 108, 146, 186];\nconst rows = [0, 30, 62, 98, 132];\n\nfunction MapArt({ streets, showRoute, you }: { streets: string[]; showRoute: boolean; you: string }) {\n  const blocks: React.ReactNode[] = [];\n  for (let r = 0; r < rows.length - 1; r++) {\n    for (let c = 0; c < cols.length - 1; c++) {\n      const i = r * 10 + c;\n      if ((r === 0 && c >= 3) || (r === 1 && c === 4)) continue;\n      const x = cols[c] + 5;\n      const y = rows[r] + 5;\n      const w = cols[c + 1] - cols[c] - 10;\n      const h = rows[r + 1] - rows[r] - 10;\n      const split = hash(i) > 0.55;\n      if (split) {\n        const cut = (w * (0.4 + hash(i + 50) * 0.2)).toFixed(1);\n        blocks.push(<rect key={`${i}a`} x={x} y={y} width={cut} height={h} rx=\"2\" />);\n        blocks.push(<rect key={`${i}b`} x={(x + Number(cut) + 3).toFixed(1)} y={y} width={(w - Number(cut) - 3).toFixed(1)} height={h} rx=\"2\" />);\n      } else {\n        blocks.push(<rect key={i} x={x} y={y} width={w} height={h} rx=\"2\" />);\n      }\n    }\n  }\n  return (\n    <svg viewBox=\"0 0 200 160\" preserveAspectRatio=\"xMidYMid slice\" aria-hidden=\"true\">\n      <rect width=\"200\" height=\"160\" fill=\"var(--hb-od2-land)\" />\n      <g fill=\"var(--hb-od2-block)\">{blocks}</g>\n      <path d=\"M113 5h70v53h-36z\" fill=\"var(--hb-od2-park)\" />\n      <circle cx=\"160\" cy=\"22\" r=\"5\" fill=\"var(--hb-od2-park)\" stroke=\"color-mix(in srgb, #3fa45b 40%, transparent)\" strokeWidth=\"1\" />\n      <circle cx=\"172\" cy=\"40\" r=\"4\" fill=\"var(--hb-od2-park)\" stroke=\"color-mix(in srgb, #3fa45b 40%, transparent)\" strokeWidth=\"1\" />\n      <path d=\"M-5 152 C 40 136, 70 160, 110 146 S 170 128, 210 140 V 170 H -5 Z\" fill=\"var(--hb-od2-water)\" />\n      <g stroke=\"var(--hb-od2-road)\" strokeWidth=\"4\" fill=\"none\">\n        {cols.slice(1, -1).map((x) => (\n          <path key={`c${x}`} d={`M${x} -5V140`} />\n        ))}\n        {rows.slice(1).map((y) => (\n          <path key={`r${y}`} d={`M-5 ${y}H205`} />\n        ))}\n      </g>\n      <path d=\"M-5 128 L 205 18\" stroke=\"var(--hb-od2-major)\" strokeWidth=\"7\" fill=\"none\" />\n      <path d=\"M70 -5V145\" stroke=\"var(--hb-od2-major)\" strokeWidth=\"6\" fill=\"none\" />\n      <g fill=\"var(--hb-od2-label)\" fontSize=\"5.4\" fontWeight=\"600\" letterSpacing=\"0.4\" fontFamily=\"inherit\">\n        {streets[0] ? (\n          <text x=\"74\" y=\"56\" transform=\"rotate(90 74 56)\">\n            {streets[0].toUpperCase()}\n          </text>\n        ) : null}\n        {streets[1] ? (\n          <text x=\"128\" y=\"54\" transform=\"rotate(-27.6 128 54)\">\n            {streets[1].toUpperCase()}\n          </text>\n        ) : null}\n        {streets[2] ? (\n          <text x=\"8\" y=\"95.5\">\n            {streets[2].toUpperCase()}\n          </text>\n        ) : null}\n      </g>\n      {showRoute ? (\n        <g>\n          <path className=\"hb-od2-glow\" d=\"M146 98 V62 H108 V82\" />\n          <path className=\"hb-od2-route\" d=\"M146 98 V62 H108 V82\" />\n          <circle className=\"hb-od2-mehalo\" cx=\"146\" cy=\"98\" r=\"8\" />\n          <circle className=\"hb-od2-me\" cx=\"146\" cy=\"98\" r=\"3.6\" />\n          <text x=\"152\" y=\"109\" fill=\"var(--hb-od2-label)\" fontSize=\"6\" fontWeight=\"700\" fontFamily=\"inherit\">\n            {you}\n          </text>\n        </g>\n      ) : null}\n      <g transform=\"translate(108 82)\">\n        <ellipse className=\"hb-od2-ring\" cx=\"0\" cy=\"0\" rx=\"8\" ry=\"4\" />\n        <ellipse className=\"hb-od2-shadow\" cx=\"0\" cy=\"0.5\" rx=\"4.5\" ry=\"1.8\" />\n        <g transform=\"scale(0.62)\">\n          <g className=\"hb-od2-pinbody\">\n            <g transform=\"translate(-13 -33)\">\n              <path d=\"M13 33c-1.2-3.6-11-11.5-11-19.5a11 11 0 0 1 22 0c0 8-9.8 15.9-11 19.5z\" fill=\"var(--hb-od2-accent)\" stroke=\"#ffffff\" strokeWidth=\"1.6\" />\n              <circle cx=\"13\" cy=\"13.2\" r=\"5.2\" fill=\"#ffffff\" />\n              <path d=\"M10.6 10.6v3.2a2.4 2.4 0 0 0 4.8 0v-3.2M13 10.6v6\" stroke=\"var(--hb-od2-accent)\" strokeWidth=\"1.2\" strokeLinecap=\"round\" fill=\"none\" />\n            </g>\n          </g>\n        </g>\n      </g>\n    </svg>\n  );\n}\n\nexport function MapDirectionsCard({\n  name = \"Corner Kitchen\",\n  address = \"418 Maple Avenue, Brooklyn, NY 11215\",\n  lat,\n  lng,\n  hours = \"Open today · 11 am to 10 pm\",\n  status = \"open\",\n  distance = \"1.2 mi · 6 min\",\n  streets = [\"Maple Ave\", \"Union Blvd\", \"8th St\"],\n  showRoute = true,\n  appearance = \"dark\",\n  accent = \"#2f7bff\",\n  labels,\n  onDirections,\n  className = \"\",\n  style,\n  ...rest\n}: MapDirectionsCardProps) {\n  const l = { ...defaultLabels, ...labels };\n  const maps = buildMapsHref(address, lat, lng);\n  const waze = buildWazeHref(address, lat, lng);\n\n  return (\n    <div\n      className={`hb-od2 ${className}`}\n      data-appearance={appearance}\n      style={{ \"--hb-od2-accent\": accent, ...style } as React.CSSProperties}\n      {...rest}\n    >\n      <style href=\"hb-map-directions-card\" precedence=\"default\">{css}</style>\n      <div className=\"hb-od2-card\">\n        <div className=\"hb-od2-map\" role=\"img\" aria-label={l.mapLabel.replace(\"{name}\", name)}>\n          <MapArt streets={streets} showRoute={showRoute} you={l.you} />\n          {distance ? (\n            <span className=\"hb-od2-chip\">\n              <svg width=\"11\" height=\"11\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden=\"true\">\n                <path d=\"M3 11l18-8-8 18-2-8z\" />\n              </svg>\n              {distance}\n            </span>\n          ) : null}\n        </div>\n        <div className=\"hb-od2-info\">\n          <h3 className=\"hb-od2-name\">{name}</h3>\n          <address className=\"hb-od2-addr\">{address}</address>\n          {hours ? (\n            <div className=\"hb-od2-hours\" data-status={status}>\n              <span className=\"hb-od2-dot\" aria-hidden=\"true\" />\n              <span>{hours}</span>\n            </div>\n          ) : null}\n          <div className=\"hb-od2-actions\">\n            <a\n              className=\"hb-od2-btn\"\n              data-primary=\"true\"\n              href={maps}\n              target=\"_blank\"\n              rel=\"noopener noreferrer\"\n              onClick={() => onDirections?.(\"maps\", maps)}\n            >\n              <svg width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n                <path d=\"M9 4L3 6.5v13.5L9 17.5l6 2.5 6-2.5V4l-6 2.5L9 4zM9 4v13.5M15 6.5V20\" />\n              </svg>\n              {l.openMaps}\n            </a>\n            <a\n              className=\"hb-od2-btn\"\n              href={waze}\n              target=\"_blank\"\n              rel=\"noopener noreferrer\"\n              onClick={() => onDirections?.(\"waze\", waze)}\n            >\n              <svg width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n                <path d=\"M12 3l7 18-7-4-7 4z\" />\n              </svg>\n              {l.openWaze}\n            </a>\n          </div>\n        </div>\n      </div>\n    </div>\n  );\n}\n"
    }
  ]
}