{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "geo-map",
  "type": "registry:component",
  "title": "Geo map",
  "description": "A dot-matrix world map with glowing markers sized by value, status colors, and animated arcs between locations.",
  "categories": [
    "operations"
  ],
  "dependencies": [],
  "registryDependencies": [],
  "files": [
    {
      "path": "src/registry/overtrue/geo-map.tsx",
      "type": "registry:component",
      "target": "components/overtrue/geo-map.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\nexport type GeoMapStatus = \"ok\" | \"warn\" | \"critical\";\n\n/** A position as `[latitude, longitude]` in decimal degrees. */\nexport type GeoMapCoordinates = [lat: number, lng: number];\n\nexport interface GeoMapPoint {\n  id: string;\n  label: string;\n  /** Latitude in decimal degrees, north positive. Drawn between 84°N and 56°S. */\n  lat: number;\n  /** Longitude in decimal degrees, east positive. */\n  lng: number;\n  /** Sizes the marker by area, relative to the largest value on the map. */\n  value?: number;\n  /** Health of the location. Defaults to ok. */\n  status?: GeoMapStatus;\n  /** Any CSS color. Overrides the status color for this marker. */\n  color?: string;\n  /** Force the sonar pulse on or off. Critical points pulse by default. */\n  pulse?: boolean;\n  /** Secondary text for the readout, such as a region code. */\n  description?: string;\n}\n\nexport interface GeoMapArc {\n  id: string;\n  /** A point id, or coordinates for a location without a marker. */\n  from: GeoMapCoordinates | string;\n  /** A point id, or coordinates for a location without a marker. */\n  to: GeoMapCoordinates | string;\n  /** Weights the arc's stroke relative to the largest arc value. */\n  value?: number;\n  /** Any CSS color. Defaults to the arc color. */\n  color?: string;\n}\n\nexport interface GeoMapColors {\n  /** Land dots. Defaults to a muted-foreground mix. */\n  land?: string;\n  /** Healthy markers and the glow they cast. Defaults to var(--color-primary). */\n  marker?: string;\n  /** Arcs and their travelling pulses. Defaults to var(--color-primary). */\n  arc?: string;\n  /** Degraded markers. Defaults to amber. */\n  warn?: string;\n  /** Critical markers. Defaults to var(--color-destructive). */\n  critical?: string;\n}\n\n/** Map geometry passed to `overlay`, for drawing your own SVG in map units. */\nexport interface GeoMapProjection {\n  /** viewBox width, always 1000. */\n  width: number;\n  /** viewBox height, about 420. */\n  height: number;\n  /** viewBox units per CSS pixel at the current size. Multiply pixel sizes by it. */\n  unit: number;\n  /** Latitude and longitude to viewBox coordinates. */\n  project: (lat: number, lng: number) => [x: number, y: number];\n}\n\nexport interface GeoMapProps extends Omit<\n  React.ComponentProps<\"div\">,\n  \"title\" | \"children\"\n> {\n  points: GeoMapPoint[];\n  /** Curved connections between points or coordinates, with a travelling pulse. */\n  arcs?: GeoMapArc[];\n  title?: React.ReactNode;\n  description?: React.ReactNode;\n  /** Controls at the top right, such as a live badge or a metric picker. */\n  actions?: React.ReactNode;\n  /** Dot columns across the map, or \"auto\" for a steady dot pitch at any size. */\n  density?: number | \"auto\";\n  /** Dot diameter as a fraction of the dot pitch, 0.15–1. Defaults to 0.5. */\n  dotSize?: number;\n  colors?: GeoMapColors;\n  /** Name of the value, e.g. \"Requests/s\". Shown in the readout and legend. */\n  valueLabel?: string;\n  /** Formats point values. Defaults to a compact number. */\n  valueFormatter?: (value: number) => string;\n  /** Names for each status in the readout, legend, and labels. */\n  statusLabels?: Partial<Record<GeoMapStatus, string>>;\n  /** The selected point. Pass null for none; leave undefined to let the map manage it. */\n  selectedId?: string | null;\n  defaultSelectedId?: string | null;\n  onSelectedChange?: (id: string | null, point: GeoMapPoint | null) => void;\n  /** Replaces the readout body for the hovered, focused, or selected point. */\n  renderTooltip?: (point: GeoMapPoint) => React.ReactNode;\n  /** Readout content when no point is active. Defaults to a count and total. */\n  summary?: React.ReactNode;\n  /** Draw your own SVG above the land, in viewBox units. */\n  overlay?: (projection: GeoMapProjection) => React.ReactNode;\n  /** Content beside the map on wide cards and below it on narrow ones, such as a synced list. */\n  aside?: React.ReactNode;\n  /** Fixed map height in pixels. By default the map keeps its aspect ratio. */\n  height?: number;\n  showLegend?: boolean;\n  /** Animate arc pulses and marker sonar. Always off under reduced motion. */\n  animated?: boolean;\n}\n\n/* ------------------------------------------------------------------------ */\n/* Projection                                                                */\n/* ------------------------------------------------------------------------ */\n\n// Robinson projection (Snyder's table, 5° steps, linear interpolation), central\n// meridian 11°E so the seam falls in the Bering Strait, cropped to 84°N–56°S. The land mask below was sampled from the same\n// inverse, so projected coordinates and land dots always agree.\nconst ROBINSON_X = [\n  1, 0.9986, 0.9954, 0.99, 0.9822, 0.973, 0.96, 0.9427, 0.9216, 0.8962, 0.8679,\n  0.835, 0.7986, 0.7597, 0.7186, 0.6732, 0.6213, 0.5722, 0.5322,\n];\nconst ROBINSON_Y = [\n  0, 0.062, 0.124, 0.186, 0.248, 0.31, 0.372, 0.434, 0.4958, 0.5571, 0.6176,\n  0.6769, 0.7346, 0.7903, 0.8435, 0.8936, 0.9394, 0.9761, 1,\n];\nconst LAT_TOP = 84;\nconst LAT_BOTTOM = -56;\nconst CENTRAL_MERIDIAN = 11;\nconst DEG = Math.PI / 180;\n\nfunction robinson(table: number[], lat: number) {\n  const a = Math.min(89.9999, Math.abs(lat)) / 5;\n  const i = Math.floor(a);\n  return table[i] + (table[i + 1] - table[i]) * (a - i);\n}\n\n/** viewBox width of the map. */\nexport const GEO_MAP_WIDTH = 1000;\nconst SCALE = GEO_MAP_WIDTH / (2 * Math.PI * 0.8487);\nconst Y_TOP = 1.3523 * robinson(ROBINSON_Y, LAT_TOP);\n/** viewBox height of the map, about 420.26. */\nexport const GEO_MAP_HEIGHT =\n  (Y_TOP + 1.3523 * robinson(ROBINSON_Y, LAT_BOTTOM)) * SCALE;\n\n/**\n * Project latitude and longitude (decimal degrees) to GeoMap viewBox coordinates:\n * x runs 0–1000 from 169°W eastwards round to 169°W again (centered on 11°E), y runs\n * 0–≈420 from 84°N to 56°S. Longitudes wrap; latitudes outside the crop are pinned.\n */\nexport function projectGeo(lat: number, lng: number): [x: number, y: number] {\n  const la = Math.min(LAT_TOP, Math.max(LAT_BOTTOM, lat));\n  const ln = ((((lng - CENTRAL_MERIDIAN + 180) % 360) + 360) % 360) - 180;\n  const x =\n    GEO_MAP_WIDTH / 2 + SCALE * 0.8487 * robinson(ROBINSON_X, la) * ln * DEG;\n  const y = (Y_TOP - Math.sign(la) * 1.3523 * robinson(ROBINSON_Y, la)) * SCALE;\n  return [x, y];\n}\n\n/* ------------------------------------------------------------------------ */\n/* Land mask                                                                 */\n/* ------------------------------------------------------------------------ */\n\n// 400 × 168 land bitmap on the projection above, generated once by rasterising the\n// Natural Earth-derived country outlines shipped with jsvectormap in headless Chrome\n// (4×4 supersampling per cell). Run-length encoded in row-major order: runs alternate\n// water and land starting with water, one base-64 digit per run, with runs over 63\n// split by a zero-length opposite run.\nconst LAND_COLS = 400;\nconst LAND_ROWS = 168;\nconst LAND_RLE = [\n  \"_0_0G113HD_0_0_0_0_0ek32_0_0_0_0_0TtN212F2T4_0_0_0_0EF5XLAl511_0_0_0y152122C\",\n  \"2cN521s3_0_0_0o3E2485bO3z2_0_0_0j313224333618ax6J21BJ2_0_0_0K8421219GTv4JJI6\",\n  \"21_0_0_056H2RRv3LJ_0_0_0V85233132613GPw3Ib92_0_0_04G33122CFQw3A3111f88_0_0X2\",\n  \"P22B642EDQd1J3841j1GL2_0_02D11C18C443GBPZ8T41_06_0_0EL2E2B23134348DLYFK4241_\",\n  \"0D18_0vg5351252465CKaJ42421A141_0P_0r_0541279HdM222K1_0S_0l21_037A7GF1OH142_\",\n  \"0x_0d_0786228CD8M8384_0-_0c_04133BBAF8L9292_0v52_0fy421276BAG4MA2_0_0791_0W_\",\n  \"0161A5D7gA3_0_0A_0c_D551E7fB3_0y1A_0d_E7J5gB3_0u2228_0b11F3jF7L2hC333_0m6611\",\n  \"_0f8219fE833zB5_0n2353_0n4EeE914p283256_0hG3_0m5HbEEp3D4511_0gF6_0h3LfBEo493\",\n  \"144_0iG7_0d3Og9Fp392136_0iH6_0a2Sj4Jl11491118_0iI6_0_02j3Li33292112_0p11F5_0\",\n  \"-12j2Mi3245_0_0111C4_0_02i3Mi3163_0_05C2_0_03j1Mi2362_0_07C2_0_01_0321n51_0_\",\n  \"0712_0_0Dx2432s_0_0912_0_0D21s112144o_0_0C22_0_0D11X2L66l_0_0F11_0_0DY5K66m_\",\n  \"0_0E21_0_0CX123KA1od1C1_0N31_0_0Ae2MwV323A5_0L_0_0Ea223JyD2G331A4_0M51_0_08b\",\n  \"132D22-F2E993_0N53_0_05b141327z439342CC83_0M64_0_02b2G-C834AD74_0H2164_0_03b\",\n  \"142A_C52243953674_0G92_0_04r_02BB42A18395_0EB1_0_03p_0498253242P3_0617C2_0_0\",\n  \"2o_04A8261334N4_052223C2_0_01o_05AG1433N5_0374B2_0_02n_059E3623N5_0474A2_0_0\",\n  \"2m_068812141724O3_094384_0_01m_0925BJ1222_0P6375_0_01l_0A23DQ_0P7338_0_01k_0\",\n  \"AJM22_0P7239_0_02i_0BJQ_0QB6_0_06f_0BMO_0S94_0_09d_0CQ63C_0T92_0_0Ac_0DR4832\",\n  \"3_0U82_0_0B12Y_0DU1_0k_0_0L12P45_0D-1_0E_0_0L21J4173_0C_2_0E_0_0L11HE3_0B_01\",\n  \"3_0D_0_0K22FF3_09o2F3_0B_0_0L32EG2_08q2F421_06_0_0N12DH2_07r2F8_04_0_0O13CH1\",\n  \"_08s2G41452v_0_0O13BL1_04t3F33Bt31_0_0M13A_0Qu3MAr32_0_0R9F4_06v3NAp42_0_0R9\",\n  \"E134_03w2NAN2N_0_0a98393_02w2MCJ5H22_0_0c974A4_w3LFG6F_0o2sA64F3xx3JGF8E32_0\",\n  \"_0d954G5vx4IHCAE32_0_0eHA24242sy3HICBEF2_0_0TE_0Gz3FJBCEF2_0_0VC_0Gz4BMAD31B\",\n  \"E2_0_0X13B_0A-4AO7JCD2_0_0cA_0A_0128Q7JDC2_0_0d9_0A_0217S6KCD3_0_0e6_0A_07V6\",\n  \"KCD112_0_0f4_0A_04Y6K228H1_0_0e4B211x_0281R5L137H2_0_0e2A7x_0235S4L145F211_0\",\n  \"_0f38Gq_09S4L162H2_0_0i2223Hq_08S311K161L1_0_0g42Kq_07U122I3P4_0_0i12Mo_07X2\",\n  \"K1O5_0_0mLq_05X2K2H173_0_0mMqE2oZ1L2F281_0_0nRmB5nq233D5_0_0uSm2Elr324B5_0_0\",\n  \"vT_04gt323B4_0_0vU_04gu31396_0_0uW_03fw688_0_0tW_03dy66A7122_0_0gX_03c-56A25\",\n  \"32_0_0fZ_02Q1A_569_0_0sczQ2A_01469221194_0_0ZeyP29_0346733B332_0_0VgwY_04557\",\n  \"33C225_0_0SlsX_0656113311241132C_0_0PmsW_073F112DC81_0_0DosJ1A_092F122FA61_0\",\n  \"_0FpqU_0A1aA2331_0_0CpqU_0B3XA91_0_0CorT_0C7SA_0_0NnrT_0G5P723_0_0NmrT_0N221\",\n  \"42G242_0_0NlsU_0P141P3_0_0MjuU_0v1_0_0MjuU_0c1A1_0_0VhvU_0b652_0_0VhuV91_0P7\",\n  \"62_0_0WfvV82_0P762_0_0WfuW73_0K31773_0_0WeuW64_0JC65N1_0_09cuV56_0IF45_0_0Yb\",\n  \"uU56_0HI35_0_0aZuS76_0HQY2_0_01YuR86_0GR_0_0bYvP96_0FT_0_0aXwOA5_0EW_0_0ZXwO\",\n  \"A5_0AaH1_0_0IWxO86_09cH1_0_0HVyO85_09e_0_0YS_01N85_08f_0_0YQ_03M95_08f_0_0YP\",\n  \"_04LB3_09g_0_0XO_05K_0Og_0_0XO_05K_0Nh_0_0XO_05J_0Pg_0_0XO_06I_0Pg_0_0XO_07H\",\n  \"_0Pg_0_0XN_08G_0Qf_0_0YN_09E_0Re_0_0ZM_0AD_0Se_0_0ZL_0BC_0TD4M_0_0bK_0BB_0U9\",\n  \"AJ_0_0cK_0B9_0V9BI_0_0dJ_0D3_0Z5G21E_0_0eF_0_0_0GDN2_0_0GG_0_0_0GBP1_0_0GH_0\",\n  \"_0_0FBP1_0_0FH_0_0_0GAP2_0_0GG_0_0_0H6S4_0_0EC_0_0_0r5_0_0FC_0_0_0s2_0_0HC_0\",\n  \"_0_0M1R122_0_0J9_0_0_0O3O3_0_0MB_0_0_0M3N3_0_0NA_0_0_0M2N3_0_0R8_0_0_0j3_0_0\",\n  \"S9_0_0_0h4_0_0T7_0_0_0h5_0_0U8_0_0_0h2_0_0X9_0_0_0_0_0_0D9_0_0_0_0_0_0D8_0_0\",\n  \"61_0_0_0_078_0_061_0_0_0_086_0_0_0_0_0_0H682_0_0_0_0_0_06691_0_0_0_0_0_085_0\",\n  \"_0_0_0_0_0I5_0_0_0_0_0_0J6_0_0_0_0_0_0J1_0_0_0_0L\",\n].join(\"\");\nconst RLE_DIGITS =\n  \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_\";\n\nlet landTable: Float64Array | null = null;\n\n/** Summed-area table of the decoded bitmap, built on first use. */\nfunction landIntegral() {\n  if (landTable) return landTable;\n  const bits = new Uint8Array(LAND_COLS * LAND_ROWS);\n  let k = 0;\n  let land = false;\n  for (const digit of LAND_RLE) {\n    const run = RLE_DIGITS.indexOf(digit);\n    if (land) bits.fill(1, k, k + run);\n    k += run;\n    land = !land;\n  }\n  const w = LAND_COLS + 1;\n  const table = new Float64Array(w * (LAND_ROWS + 1));\n  for (let j = 0; j < LAND_ROWS; j++) {\n    let row = 0;\n    for (let i = 0; i < LAND_COLS; i++) {\n      row += bits[j * LAND_COLS + i];\n      table[(j + 1) * w + i + 1] = table[j * w + i + 1] + row;\n    }\n  }\n  landTable = table;\n  return table;\n}\n\ninterface LandDots {\n  d: string;\n  pitch: number;\n  count: number;\n}\n\nconst landCache = new Map<number, LandDots>();\nconst r2 = (value: number) => Math.round(value * 100) / 100;\n\n/**\n * Resample the bitmap to `cols` dot columns. The summed-area table is bilinear inside\n * each cell, so any dot pitch gets an exact land fraction. All dots form one path of\n * zero-length segments that render as round caps: one DOM node for thousands of dots.\n */\nfunction landDots(columns: number): LandDots {\n  const cols = Math.min(480, Math.max(40, Math.round(columns)));\n  const cached = landCache.get(cols);\n  if (cached) return cached;\n  const table = landIntegral();\n  const w = LAND_COLS + 1;\n  const source = GEO_MAP_WIDTH / LAND_COLS;\n  const at = (sx: number, sy: number) => {\n    const x = Math.min(LAND_COLS, Math.max(0, sx));\n    const y = Math.min(LAND_ROWS, Math.max(0, sy));\n    const i = Math.min(LAND_COLS - 1, Math.floor(x));\n    const j = Math.min(LAND_ROWS - 1, Math.floor(y));\n    const u = x - i;\n    const v = y - j;\n    const o = j * w + i;\n    return (\n      table[o] * (1 - u) * (1 - v) +\n      table[o + 1] * u * (1 - v) +\n      table[o + w] * (1 - u) * v +\n      table[o + w + 1] * u * v\n    );\n  };\n  const pitch = GEO_MAP_WIDTH / cols;\n  const rows = Math.floor(GEO_MAP_HEIGHT / pitch);\n  const top = (GEO_MAP_HEIGHT - rows * pitch) / 2;\n  const span = pitch / source;\n  let d = \"\";\n  let count = 0;\n  for (let j = 0; j < rows; j++) {\n    const y0 = (top + j * pitch) / source;\n    const y1 = y0 + span;\n    let last = -1;\n    for (let i = 0; i < cols; i++) {\n      const x0 = i * span;\n      const x1 = x0 + span;\n      const cover =\n        (at(x1, y1) - at(x0, y1) - at(x1, y0) + at(x0, y0)) / (span * span);\n      if (cover < 0.4) continue;\n      d +=\n        last < 0\n          ? `M${r2((i + 0.5) * pitch)} ${r2(top + (j + 0.5) * pitch)}h0`\n          : `m${r2((i - last) * pitch)} 0h0`;\n      last = i;\n      count += 1;\n    }\n  }\n  const result = { d, pitch, count };\n  landCache.set(cols, result);\n  return result;\n}\n\n/* ------------------------------------------------------------------------ */\n/* Helpers                                                                   */\n/* ------------------------------------------------------------------------ */\n\nconst defaultStatusLabels: Record<GeoMapStatus, string> = {\n  ok: \"Healthy\",\n  warn: \"Degraded\",\n  critical: \"Critical\",\n};\nconst statusOrder: GeoMapStatus[] = [\"ok\", \"warn\", \"critical\"];\nconst AMBER = \"var(--color-amber-500, oklch(76.9% 0.188 70.08))\";\n\nconst compact = new Intl.NumberFormat(\"en-US\", {\n  notation: \"compact\",\n  maximumFractionDigits: 1,\n});\nconst defaultValueFormatter = (value: number) => compact.format(value);\n\nfunction formatCoordinate(value: number, positive: string, negative: string) {\n  return `${Math.abs(value).toFixed(1)}°${value >= 0 ? positive : negative}`;\n}\n\nfunction finite(value: number | undefined): value is number {\n  return value != null && Number.isFinite(value);\n}\n\nfunction useReducedMotion() {\n  return React.useSyncExternalStore(\n    (onChange) => {\n      const query = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\n      query.addEventListener(\"change\", onChange);\n      return () => query.removeEventListener(\"change\", onChange);\n    },\n    () => window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches,\n    () => false,\n  );\n}\n\n/** Quadratic arc bowed toward the pole, like a great circle on a flat map. */\nfunction arcPath([x0, y0]: [number, number], [x1, y1]: [number, number]) {\n  const dx = x1 - x0;\n  const dy = y1 - y0;\n  const length = Math.hypot(dx, dy) || 1;\n  let nx = -dy / length;\n  let ny = dx / length;\n  if (ny > 0) {\n    nx = -nx;\n    ny = -ny;\n  }\n  const lift = Math.min(150, length * 0.28);\n  const cx = (x0 + x1) / 2 + nx * lift;\n  const cy = (y0 + y1) / 2 + ny * lift;\n  return {\n    d: `M${r2(x0)} ${r2(y0)}Q${r2(cx)} ${r2(cy)} ${r2(x1)} ${r2(y1)}`,\n    length,\n  };\n}\n\n/* ------------------------------------------------------------------------ */\n/* Marker                                                                    */\n/* ------------------------------------------------------------------------ */\n\ninterface MarkerProps {\n  point: GeoMapPoint;\n  x: number;\n  y: number;\n  radius: number;\n  unit: number;\n  color: string;\n  status: GeoMapStatus;\n  label: string;\n  pulse: boolean;\n  halo: string;\n  active: boolean;\n  selected: boolean;\n  dimmed: boolean;\n  tabStop: boolean;\n  onHover: (id: string | null) => void;\n  onFocusPoint: (id: string) => void;\n  onToggle: (id: string) => void;\n}\n\nconst Marker = React.memo(function Marker({\n  point,\n  x,\n  y,\n  radius,\n  unit,\n  color,\n  status,\n  label,\n  pulse,\n  halo,\n  active,\n  selected,\n  dimmed,\n  tabStop,\n  onHover,\n  onFocusPoint,\n  onToggle,\n}: MarkerProps) {\n  const ring = radius + 3.5 * unit;\n  return (\n    <g\n      role=\"button\"\n      tabIndex={tabStop ? 0 : -1}\n      aria-label={label}\n      aria-pressed={selected}\n      data-slot=\"geo-map-marker\"\n      data-id={point.id}\n      data-status={status}\n      data-active={active || undefined}\n      data-selected={selected || undefined}\n      transform={`translate(${r2(x)} ${r2(y)})`}\n      className={cn(\n        \"group/marker pointer-events-auto cursor-pointer outline-none\",\n        \"transition-opacity duration-300 motion-reduce:transition-none\",\n        dimmed && \"opacity-45\",\n      )}\n      style={{ color }}\n      onPointerEnter={() => onHover(point.id)}\n      onPointerLeave={() => onHover(null)}\n      onFocus={() => onFocusPoint(point.id)}\n      onClick={() => onToggle(point.id)}\n      onKeyDown={(event) => {\n        if (event.key === \"Enter\" || event.key === \" \") {\n          event.preventDefault();\n          onToggle(point.id);\n        }\n      }}\n    >\n      <circle r={Math.max(9 * unit, radius + 4 * unit)} fill=\"transparent\" />\n      {pulse ? (\n        <>\n          <circle\n            r={radius}\n            fill=\"none\"\n            stroke=\"currentColor\"\n            strokeWidth={1.25 * unit}\n            className=\"geo-map-pulse motion-reduce:hidden\"\n          />\n          <circle\n            r={radius}\n            fill=\"none\"\n            stroke=\"currentColor\"\n            strokeWidth={1.25 * unit}\n            className=\"geo-map-pulse motion-reduce:hidden\"\n            style={{ animationDelay: \"-1.1s\" }}\n          />\n          <circle\n            r={radius * 2}\n            fill=\"none\"\n            stroke=\"currentColor\"\n            strokeOpacity={0.45}\n            strokeWidth={unit}\n            className=\"hidden motion-reduce:inline\"\n          />\n        </>\n      ) : null}\n      <circle\n        r={radius * 3.2}\n        fill={halo}\n        className={cn(\n          \"transition-[opacity,r] duration-500 motion-reduce:transition-none\",\n          active || selected ? \"opacity-100\" : \"opacity-60\",\n        )}\n      />\n      <circle\n        r={radius}\n        fill=\"currentColor\"\n        stroke=\"var(--color-card)\"\n        strokeWidth={1.25 * unit}\n        className=\"transition-[r] duration-500 ease-out motion-reduce:transition-none\"\n      />\n      <circle\n        r={Math.max(0.9 * unit, radius * 0.36)}\n        fill=\"white\"\n        opacity={0.82}\n        className=\"transition-[r] duration-500 ease-out motion-reduce:transition-none\"\n      />\n      <circle\n        r={ring}\n        fill=\"none\"\n        stroke=\"var(--color-foreground)\"\n        strokeOpacity={0.75}\n        strokeWidth={1.25 * unit}\n        className={cn(\n          \"transition-opacity duration-150 motion-reduce:transition-none\",\n          active || selected ? \"opacity-100\" : \"opacity-0\",\n        )}\n      />\n      <circle\n        r={ring + 2 * unit}\n        fill=\"none\"\n        stroke=\"var(--color-ring)\"\n        strokeWidth={2.5 * unit}\n        className=\"opacity-0 group-focus-visible/marker:opacity-60\"\n      />\n    </g>\n  );\n});\n\n/* ------------------------------------------------------------------------ */\n/* GeoMap                                                                    */\n/* ------------------------------------------------------------------------ */\n\n/**\n * A dot-matrix world map with glowing, value-sized markers and animated arcs. Hover\n * or focus a marker to read it in a readout fixed inside the card; the map is one\n * tab stop and arrow keys move west to east.\n */\nfunction GeoMap({\n  points,\n  arcs,\n  title,\n  description,\n  actions,\n  density = \"auto\",\n  dotSize = 0.5,\n  colors,\n  valueLabel = \"Value\",\n  valueFormatter = defaultValueFormatter,\n  statusLabels,\n  selectedId,\n  defaultSelectedId = null,\n  onSelectedChange,\n  renderTooltip,\n  summary,\n  overlay,\n  aside,\n  height,\n  showLegend = true,\n  animated = true,\n  className,\n  style,\n  ...props\n}: GeoMapProps) {\n  const uid = React.useId().replace(/[^a-zA-Z0-9_-]/g, \"\");\n  const reduced = useReducedMotion();\n  const motion = animated && !reduced;\n  const labels = { ...defaultStatusLabels, ...statusLabels };\n  const stageRef = React.useRef<HTMLDivElement>(null);\n  const [box, setBox] = React.useState<{ w: number; h: number } | null>(null);\n  const [hoveredId, setHoveredId] = React.useState<string | null>(null);\n  const [focusedId, setFocusedId] = React.useState<string | null>(null);\n  const [tabStopId, setTabStopId] = React.useState<string | null>(null);\n  const [innerSelected, setInnerSelected] = React.useState<string | null>(\n    defaultSelectedId,\n  );\n  const controlled = selectedId !== undefined;\n  const selected = controlled ? selectedId : innerSelected;\n\n  React.useLayoutEffect(() => {\n    const stage = stageRef.current;\n    if (!stage) return;\n    const measure = () => {\n      const w = Math.round(stage.clientWidth);\n      const h = Math.round(stage.clientHeight);\n      setBox((current) =>\n        current && current.w === w && current.h === h ? current : { w, h },\n      );\n    };\n    measure();\n    const observer = new ResizeObserver(measure);\n    observer.observe(stage);\n    return () => observer.disconnect();\n  }, []);\n\n  // CSS pixels → viewBox units. Markers and strokes keep their pixel size at any width.\n  const scale = box\n    ? Math.min(box.w / GEO_MAP_WIDTH, box.h / GEO_MAP_HEIGHT) || 0.62\n    : 0.62;\n  const unit = 1 / scale;\n  const mapWidth = GEO_MAP_WIDTH * scale;\n  // Auto density: a finer pitch on small maps keeps coastlines legible, up to ~3.8px wide.\n  const columns =\n    density === \"auto\"\n      ? Math.round(\n          mapWidth / Math.min(3.8, Math.max(2.9, mapWidth / 190)) / 4,\n        ) * 4\n      : density;\n  // Markers shrink a little on small maps so clusters stay readable.\n  const markerScale = Math.min(1, Math.max(0.62, mapWidth / 620));\n  const land = landDots(columns);\n  const dot = land.pitch * Math.min(1, Math.max(0.15, dotSize));\n\n  const colorOf = React.useCallback((point: GeoMapPoint) => {\n    if (point.color) return point.color;\n    const status = point.status ?? \"ok\";\n    return status === \"critical\"\n      ? \"var(--geo-map-critical)\"\n      : status === \"warn\"\n        ? \"var(--geo-map-warn)\"\n        : \"var(--geo-map-marker)\";\n  }, []);\n\n  const byId = React.useMemo(\n    () => new Map(points.map((point) => [point.id, point])),\n    [points],\n  );\n  const maxValue = React.useMemo(\n    () =>\n      points.reduce(\n        (max, point) =>\n          finite(point.value) ? Math.max(max, point.value) : max,\n        0,\n      ),\n    [points],\n  );\n  const total = React.useMemo(\n    () =>\n      points.reduce(\n        (sum, point) => (finite(point.value) ? sum + point.value : sum),\n        0,\n      ),\n    [points],\n  );\n  const counts = React.useMemo(() => {\n    const result = { ok: 0, warn: 0, critical: 0 };\n    for (const point of points) result[point.status ?? \"ok\"] += 1;\n    return result;\n  }, [points]);\n\n  // West to east, then north to south: the order arrow keys follow.\n  const ordered = React.useMemo(\n    () => [...points].sort((a, b) => a.lng - b.lng || b.lat - a.lat),\n    [points],\n  );\n\n  const sizeOf = (point: GeoMapPoint) => {\n    const t =\n      maxValue > 0 && finite(point.value)\n        ? Math.sqrt(Math.max(0, point.value) / maxValue)\n        : 0.45;\n    return (3 + 4.5 * t) * markerScale;\n  };\n\n  // Hover and focus are transient and dim the rest; a selection only keeps the readout.\n  const transientId = hoveredId ?? focusedId ?? null;\n  const activeId = transientId ?? selected ?? null;\n  const activePoint = activeId ? (byId.get(activeId) ?? null) : null;\n  const stopId =\n    tabStopId && byId.has(tabStopId)\n      ? tabStopId\n      : selected && byId.has(selected)\n        ? selected\n        : (ordered[0]?.id ?? null);\n\n  const setSelected = React.useCallback(\n    (id: string | null) => {\n      if (!controlled) setInnerSelected(id);\n      onSelectedChange?.(id, id ? (byId.get(id) ?? null) : null);\n    },\n    [controlled, onSelectedChange, byId],\n  );\n  const onToggle = React.useCallback(\n    (id: string) => setSelected(selected === id ? null : id),\n    [selected, setSelected],\n  );\n  const onFocusPoint = React.useCallback((id: string) => {\n    setFocusedId(id);\n    setTabStopId(id);\n  }, []);\n\n  const resolve = (end: GeoMapCoordinates | string) => {\n    if (typeof end === \"string\") {\n      const point = byId.get(end);\n      return point ? projectGeo(point.lat, point.lng) : null;\n    }\n    return projectGeo(end[0], end[1]);\n  };\n\n  const arcMax = (arcs ?? []).reduce(\n    (max, arc) => (finite(arc.value) ? Math.max(max, arc.value) : max),\n    0,\n  );\n  const drawnArcs = (arcs ?? []).flatMap((arc, index) => {\n    const a = resolve(arc.from);\n    const b = resolve(arc.to);\n    if (!a || !b) return [];\n    const { d, length } = arcPath(a, b);\n    const weight =\n      arcMax > 0 && finite(arc.value)\n        ? 0.45 + 0.55 * (arc.value / arcMax)\n        : 0.75;\n    const linked =\n      activeId != null && (arc.from === activeId || arc.to === activeId);\n    return [\n      {\n        arc,\n        index,\n        a,\n        b,\n        d,\n        weight,\n        linked,\n        // Longer arcs travel a little longer; a fixed stagger keeps pulses out of step.\n        duration: 2.2 + length / 420,\n        delay: -((index * 0.73) % 2.6),\n        color: arc.color ?? \"var(--geo-map-arc)\",\n      },\n    ];\n  });\n\n  // Land lit by nearby markers: one masked copy of the dots per marker color.\n  const glowGroups = React.useMemo(() => {\n    const groups = new Map<string, GeoMapPoint[]>();\n    for (const point of points) {\n      const color = colorOf(point);\n      if (!groups.has(color)) groups.set(color, []);\n      groups.get(color)!.push(point);\n    }\n    return [...groups.entries()];\n  }, [points, colorOf]);\n\n  const glowIndex = new Map(glowGroups.map(([color], g) => [color, g]));\n\n  const project = React.useCallback(\n    (lat: number, lng: number) => projectGeo(lat, lng),\n    [],\n  );\n\n  const onKeyDown = (event: React.KeyboardEvent<SVGSVGElement>) => {\n    const target = event.target as Element;\n    const id = target.getAttribute(\"data-id\");\n    if (!id || target.getAttribute(\"data-slot\") !== \"geo-map-marker\") return;\n    if (event.key === \"Escape\") {\n      if (selected != null) {\n        event.preventDefault();\n        setSelected(null);\n      }\n      return;\n    }\n    const index = ordered.findIndex((point) => point.id === id);\n    const moves: Record<string, number> = {\n      ArrowRight: index + 1,\n      ArrowDown: index + 1,\n      ArrowLeft: index - 1,\n      ArrowUp: index - 1,\n      Home: 0,\n      End: ordered.length - 1,\n    };\n    if (!(event.key in moves)) return;\n    event.preventDefault();\n    const next =\n      ordered[Math.min(ordered.length - 1, Math.max(0, moves[event.key]))];\n    if (!next) return;\n    setTabStopId(next.id);\n    event.currentTarget\n      .querySelector<SVGGElement>(\n        `[data-slot=\"geo-map-marker\"][data-id=\"${CSS.escape(next.id)}\"]`,\n      )\n      ?.focus();\n  };\n\n  const describe = (point: GeoMapPoint) => {\n    const parts = [point.label];\n    if (point.description) parts.push(point.description);\n    if (finite(point.value))\n      parts.push(`${valueLabel} ${valueFormatter(point.value)}`);\n    parts.push(labels[point.status ?? \"ok\"]);\n    return parts.join(\", \");\n  };\n\n  const hasHeader = title != null || description != null || actions != null;\n  const mapLabel = typeof title === \"string\" ? title : \"World map\";\n  const H = GEO_MAP_HEIGHT;\n  const viewBox = `0 0 ${GEO_MAP_WIDTH} ${r2(H)}`;\n  const activeXY = activePoint\n    ? projectGeo(activePoint.lat, activePoint.lng)\n    : null;\n  const attention = counts.warn + counts.critical;\n\n  const toneOf = (status: GeoMapStatus) =>\n    status === \"critical\"\n      ? \"text-destructive\"\n      : status === \"warn\"\n        ? \"text-amber-700 dark:text-amber-400\"\n        : \"text-foreground/80\";\n\n  let readout: React.ReactNode;\n  if (activePoint && renderTooltip) {\n    readout = renderTooltip(activePoint);\n  } else if (activePoint) {\n    const status = activePoint.status ?? \"ok\";\n    readout = (\n      <>\n        <div className=\"flex min-w-16 flex-col\">\n          <span className=\"text-base leading-5 font-semibold tracking-tight tabular-nums\">\n            {finite(activePoint.value)\n              ? valueFormatter(activePoint.value)\n              : \"—\"}\n          </span>\n          <span className=\"truncate text-[10.5px] leading-4 text-muted-foreground\">\n            {valueLabel}\n          </span>\n        </div>\n        <div className=\"flex min-w-0 flex-col\">\n          <span className=\"flex min-w-0 items-baseline gap-1.5 text-xs leading-5\">\n            <span className=\"truncate font-medium text-foreground\">\n              {activePoint.label}\n            </span>\n            {activePoint.description ? (\n              <span className=\"shrink-0 font-mono text-[10.5px] text-muted-foreground\">\n                {activePoint.description}\n              </span>\n            ) : null}\n          </span>\n          <span className=\"flex min-w-0 items-center gap-1.5 text-[10.5px] leading-4 text-muted-foreground\">\n            <span\n              aria-hidden=\"true\"\n              className=\"size-1.5 shrink-0 rounded-full\"\n              style={{ background: colorOf(activePoint) }}\n            />\n            <span className={cn(\"shrink-0 font-medium\", toneOf(status))}>\n              {labels[status]}\n            </span>\n            <span aria-hidden=\"true\">·</span>\n            <span className=\"truncate font-mono tabular-nums\">\n              {formatCoordinate(activePoint.lat, \"N\", \"S\")}{\" \"}\n              {formatCoordinate(activePoint.lng, \"E\", \"W\")}\n            </span>\n          </span>\n        </div>\n      </>\n    );\n  } else if (summary != null) {\n    readout = summary;\n  } else {\n    readout = (\n      <>\n        <div className=\"flex min-w-16 flex-col\">\n          <span className=\"text-base leading-5 font-semibold tracking-tight tabular-nums\">\n            {maxValue > 0 ? valueFormatter(total) : points.length}\n          </span>\n          <span className=\"truncate text-[10.5px] leading-4 text-muted-foreground\">\n            {maxValue > 0 ? `total ${valueLabel}` : \"locations\"}\n          </span>\n        </div>\n        <div className=\"flex min-w-0 flex-col\">\n          <span className=\"truncate text-xs leading-5 text-foreground\">\n            <span className=\"tabular-nums\">{points.length}</span>{\" \"}\n            {points.length === 1 ? \"location\" : \"locations\"}\n            {drawnArcs.length ? (\n              <>\n                {\" · \"}\n                <span className=\"tabular-nums\">{drawnArcs.length}</span>{\" \"}\n                {drawnArcs.length === 1 ? \"route\" : \"routes\"}\n              </>\n            ) : null}\n          </span>\n          <span\n            className={cn(\n              \"truncate text-[10.5px] leading-4\",\n              counts.critical\n                ? \"text-destructive\"\n                : attention\n                  ? \"text-amber-700 dark:text-amber-400\"\n                  : \"text-muted-foreground\",\n            )}\n          >\n            {attention\n              ? `${attention} need attention`\n              : \"All locations healthy\"}\n          </span>\n        </div>\n      </>\n    );\n  }\n\n  const projection: GeoMapProjection = {\n    width: GEO_MAP_WIDTH,\n    height: H,\n    unit,\n    project,\n  };\n\n  return (\n    <div\n      data-slot=\"geo-map\"\n      className={cn(\n        \"@container/geo-map flex min-w-0 flex-col overflow-hidden rounded-xl border bg-card text-card-foreground shadow-xs\",\n        \"[--geo-map-land:color-mix(in_oklab,var(--color-muted-foreground)_36%,transparent)] dark:[--geo-map-land:color-mix(in_oklab,var(--color-muted-foreground)_46%,transparent)]\",\n        \"[--geo-map-marker:var(--color-primary)] [--geo-map-arc:var(--color-primary)] [--geo-map-critical:var(--color-destructive)]\",\n        className,\n      )}\n      style={\n        {\n          \"--geo-map-warn\": AMBER,\n          ...(colors?.land ? { \"--geo-map-land\": colors.land } : null),\n          ...(colors?.marker ? { \"--geo-map-marker\": colors.marker } : null),\n          ...(colors?.arc ? { \"--geo-map-arc\": colors.arc } : null),\n          ...(colors?.warn ? { \"--geo-map-warn\": colors.warn } : null),\n          ...(colors?.critical\n            ? { \"--geo-map-critical\": colors.critical }\n            : null),\n          ...style,\n        } as React.CSSProperties\n      }\n      {...props}\n    >\n      {hasHeader ? (\n        <div\n          data-slot=\"geo-map-header\"\n          className=\"flex flex-col gap-1 px-5 pt-5\"\n        >\n          <div className=\"flex min-h-6 items-start justify-between gap-3\">\n            {title != null ? (\n              <h3 className=\"min-w-0 text-sm leading-6 font-semibold tracking-tight\">\n                {title}\n              </h3>\n            ) : (\n              <span />\n            )}\n            {actions != null ? (\n              <div className=\"flex shrink-0 items-center gap-2\">{actions}</div>\n            ) : null}\n          </div>\n          {description != null ? (\n            <p className=\"text-xs text-muted-foreground\">{description}</p>\n          ) : null}\n        </div>\n      ) : null}\n\n      <div\n        className={cn(\n          \"grid min-w-0 flex-1\",\n          aside != null &&\n            \"@2xl/geo-map:grid-cols-[minmax(0,1fr)_minmax(14rem,17rem)]\",\n        )}\n      >\n        <div className=\"flex min-w-0 flex-col justify-center px-4 py-4\">\n          <div\n            ref={stageRef}\n            data-slot=\"geo-map-stage\"\n            className=\"relative w-full\"\n            style={\n              height != null\n                ? { height }\n                : { aspectRatio: `${GEO_MAP_WIDTH} / ${r2(H)}` }\n            }\n          >\n            <svg\n              data-slot=\"geo-map-land\"\n              aria-hidden=\"true\"\n              viewBox={viewBox}\n              className=\"absolute inset-0 size-full overflow-visible\"\n            >\n              <defs>\n                <radialGradient id={`${uid}-glow`}>\n                  <stop offset=\"0\" stopColor=\"white\" stopOpacity=\"1\" />\n                  <stop offset=\"0.45\" stopColor=\"white\" stopOpacity=\"0.55\" />\n                  <stop offset=\"1\" stopColor=\"white\" stopOpacity=\"0\" />\n                </radialGradient>\n                {glowGroups.map(([color, members], g) => (\n                  <mask\n                    key={color}\n                    id={`${uid}-lit-${g}`}\n                    maskUnits=\"userSpaceOnUse\"\n                    x=\"0\"\n                    y=\"0\"\n                    width={GEO_MAP_WIDTH}\n                    height={H}\n                  >\n                    {members.map((point) => {\n                      const [x, y] = projectGeo(point.lat, point.lng);\n                      const t =\n                        maxValue > 0 && finite(point.value)\n                          ? Math.sqrt(Math.max(0, point.value) / maxValue)\n                          : 0.45;\n                      const boost = point.id === activeId ? 1.35 : 1;\n                      return (\n                        <circle\n                          key={point.id}\n                          cx={r2(x)}\n                          cy={r2(y)}\n                          r={r2((22 + 46 * t) * boost)}\n                          fill={`url(#${uid}-glow)`}\n                          className=\"transition-[r] duration-700 ease-out motion-reduce:transition-none\"\n                        />\n                      );\n                    })}\n                  </mask>\n                ))}\n              </defs>\n              <path\n                data-slot=\"geo-map-dots\"\n                d={land.d}\n                fill=\"none\"\n                stroke=\"var(--geo-map-land)\"\n                strokeWidth={r2(dot)}\n                strokeLinecap=\"round\"\n              />\n              {glowGroups.map(([color], g) => (\n                <path\n                  key={color}\n                  d={land.d}\n                  fill=\"none\"\n                  stroke={color}\n                  strokeWidth={r2(dot * 1.08)}\n                  strokeLinecap=\"round\"\n                  mask={`url(#${uid}-lit-${g})`}\n                  className=\"opacity-75 dark:opacity-90\"\n                />\n              ))}\n            </svg>\n\n            <svg\n              data-slot=\"geo-map-overlay\"\n              role=\"group\"\n              aria-label={`${mapLabel}: ${points.length} ${points.length === 1 ? \"location\" : \"locations\"}. Use the arrow keys to move between them.`}\n              viewBox={viewBox}\n              className=\"pointer-events-none absolute inset-0 size-full overflow-visible will-change-transform\"\n              onKeyDown={onKeyDown}\n              onBlur={(event) => {\n                if (!event.currentTarget.contains(event.relatedTarget as Node))\n                  setFocusedId(null);\n              }}\n            >\n              <defs>\n                {glowGroups.map(([color], g) => (\n                  <radialGradient key={color} id={`${uid}-halo-${g}`}>\n                    <stop\n                      offset=\"0.25\"\n                      style={{ stopColor: color }}\n                      stopOpacity=\"0.5\"\n                    />\n                    <stop\n                      offset=\"1\"\n                      style={{ stopColor: color }}\n                      stopOpacity=\"0\"\n                    />\n                  </radialGradient>\n                ))}\n                {drawnArcs.map(({ arc, a, b, color }) => (\n                  <linearGradient\n                    key={arc.id}\n                    id={`${uid}-arc-${arc.id.replace(/[^a-zA-Z0-9_-]/g, \"\")}`}\n                    gradientUnits=\"userSpaceOnUse\"\n                    x1={r2(a[0])}\n                    y1={r2(a[1])}\n                    x2={r2(b[0])}\n                    y2={r2(b[1])}\n                  >\n                    <stop\n                      offset=\"0\"\n                      style={{ stopColor: color }}\n                      stopOpacity=\"0.08\"\n                    />\n                    <stop\n                      offset=\"0.6\"\n                      style={{ stopColor: color }}\n                      stopOpacity=\"0.5\"\n                    />\n                    <stop\n                      offset=\"1\"\n                      style={{ stopColor: color }}\n                      stopOpacity=\"0.9\"\n                    />\n                  </linearGradient>\n                ))}\n              </defs>\n\n              {activeXY ? (\n                <g\n                  data-slot=\"geo-map-crosshair\"\n                  aria-hidden=\"true\"\n                  stroke=\"var(--color-foreground)\"\n                  strokeOpacity={0.2}\n                  strokeWidth={unit}\n                  strokeDasharray={`${r2(2 * unit)} ${r2(3 * unit)}`}\n                >\n                  <line\n                    x1={0}\n                    x2={GEO_MAP_WIDTH}\n                    y1={r2(activeXY[1])}\n                    y2={r2(activeXY[1])}\n                  />\n                  <line\n                    x1={r2(activeXY[0])}\n                    x2={r2(activeXY[0])}\n                    y1={0}\n                    y2={r2(H)}\n                  />\n                </g>\n              ) : null}\n\n              <g data-slot=\"geo-map-arcs\" aria-hidden=\"true\">\n                {drawnArcs.map(\n                  ({\n                    arc,\n                    d,\n                    b,\n                    a,\n                    weight,\n                    linked,\n                    duration,\n                    delay,\n                    color,\n                  }) => {\n                    const dim = transientId != null && !linked;\n                    const fromCoords = typeof arc.from !== \"string\";\n                    return (\n                      <g\n                        key={arc.id}\n                        data-slot=\"geo-map-arc\"\n                        data-linked={linked || undefined}\n                        className={cn(\n                          \"transition-opacity duration-300 motion-reduce:transition-none\",\n                          dim ? \"opacity-25\" : \"opacity-100\",\n                        )}\n                      >\n                        <path\n                          d={d}\n                          fill=\"none\"\n                          stroke={`url(#${uid}-arc-${arc.id.replace(/[^a-zA-Z0-9_-]/g, \"\")})`}\n                          strokeWidth={r2(\n                            (0.75 + 0.75 * weight) * unit * (linked ? 1.4 : 1),\n                          )}\n                          strokeLinecap=\"round\"\n                        />\n                        {fromCoords ? (\n                          <circle\n                            cx={r2(a[0])}\n                            cy={r2(a[1])}\n                            r={r2(1.75 * unit)}\n                            fill={color}\n                            fillOpacity={0.7}\n                          />\n                        ) : null}\n                        {typeof arc.to !== \"string\" ? (\n                          <circle\n                            cx={r2(b[0])}\n                            cy={r2(b[1])}\n                            r={r2(1.75 * unit)}\n                            fill={color}\n                          />\n                        ) : null}\n                        {motion\n                          ? (\n                              [\n                                [0.34, 1.75, 0.4],\n                                [0.12, 2.25, 0.85],\n                                [0.008, 4, 1],\n                              ] as const\n                            ).map(([dash, width, opacity], layer) => (\n                              <path\n                                key={layer}\n                                d={d}\n                                pathLength={1}\n                                fill=\"none\"\n                                stroke={\n                                  layer === 2\n                                    ? `color-mix(in oklab, ${color} 30%, white)`\n                                    : color\n                                }\n                                strokeOpacity={opacity}\n                                strokeWidth={r2(\n                                  width * unit * (0.7 + 0.3 * weight),\n                                )}\n                                strokeLinecap=\"round\"\n                                // One dash of length `dash` that ends at the pattern origin, so every\n                                // layer's head sits at the same point as the offset slides along.\n                                strokeDasharray={`0 ${3 - dash} ${dash} 0`}\n                                className=\"geo-map-comet\"\n                                style={{\n                                  animationDuration: `${duration.toFixed(2)}s`,\n                                  animationDelay: `${delay.toFixed(2)}s`,\n                                }}\n                              />\n                            ))\n                          : null}\n                      </g>\n                    );\n                  },\n                )}\n              </g>\n\n              {overlay ? (\n                <g data-slot=\"geo-map-custom\">{overlay(projection)}</g>\n              ) : null}\n\n              <g\n                data-slot=\"geo-map-markers\"\n                onPointerLeave={() => setHoveredId(null)}\n              >\n                {[...points]\n                  .sort((a, b) => {\n                    const rank = (point: GeoMapPoint) =>\n                      (point.id === activeId ? 4 : 0) +\n                      (point.id === selected ? 2 : 0) +\n                      (point.status === \"critical\" ? 1 : 0);\n                    return rank(a) - rank(b) || sizeOf(b) - sizeOf(a);\n                  })\n                  .map((point) => {\n                    const [x, y] = projectGeo(point.lat, point.lng);\n                    const status = point.status ?? \"ok\";\n                    return (\n                      <Marker\n                        key={point.id}\n                        point={point}\n                        x={x}\n                        y={y}\n                        radius={sizeOf(point) * unit}\n                        unit={unit}\n                        color={colorOf(point)}\n                        status={status}\n                        label={describe(point)}\n                        pulse={motion && (point.pulse ?? status === \"critical\")}\n                        halo={`url(#${uid}-halo-${glowIndex.get(colorOf(point)) ?? 0})`}\n                        active={point.id === activeId}\n                        selected={point.id === selected}\n                        dimmed={\n                          transientId != null &&\n                          point.id !== activeId &&\n                          !drawnArcs.some(\n                            (arc) =>\n                              arc.linked &&\n                              (arc.arc.from === point.id ||\n                                arc.arc.to === point.id),\n                          )\n                        }\n                        tabStop={point.id === stopId}\n                        onHover={setHoveredId}\n                        onFocusPoint={onFocusPoint}\n                        onToggle={onToggle}\n                      />\n                    );\n                  })}\n              </g>\n\n              {activeXY ? (\n                <g\n                  aria-hidden=\"true\"\n                  className=\"font-mono\"\n                  fontSize={r2(9.5 * unit)}\n                  fill=\"var(--color-muted-foreground)\"\n                  stroke=\"var(--color-card)\"\n                  strokeWidth={r2(3 * unit)}\n                  paintOrder=\"stroke\"\n                  strokeLinejoin=\"round\"\n                >\n                  <text x={r2(2 * unit)} y={r2(activeXY[1] - 4 * unit)}>\n                    {formatCoordinate(activePoint!.lat, \"N\", \"S\")}\n                  </text>\n                  <text x={r2(activeXY[0] + 4 * unit)} y={r2(H - 2 * unit)}>\n                    {formatCoordinate(activePoint!.lng, \"E\", \"W\")}\n                  </text>\n                </g>\n              ) : null}\n            </svg>\n          </div>\n        </div>\n\n        {aside != null ? (\n          <div\n            data-slot=\"geo-map-aside\"\n            className=\"min-w-0 border-t @2xl/geo-map:border-t-0 @2xl/geo-map:border-l\"\n          >\n            {aside}\n          </div>\n        ) : null}\n      </div>\n\n      <div\n        data-slot=\"geo-map-footer\"\n        className=\"flex flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-5 py-3\"\n      >\n        <div\n          data-slot=\"geo-map-readout\"\n          aria-hidden={activePoint ? true : undefined}\n          data-active={activePoint ? true : undefined}\n          className=\"flex min-h-9 min-w-0 flex-1 basis-56 items-center gap-3\"\n        >\n          {readout}\n        </div>\n        {showLegend ? (\n          <div\n            data-slot=\"geo-map-legend\"\n            className=\"flex flex-wrap items-center gap-x-3.5 gap-y-1 text-[11px] text-muted-foreground\"\n          >\n            {statusOrder\n              .filter((status) => status === \"ok\" || counts[status] > 0)\n              .map((status) => (\n                <span key={status} className=\"inline-flex items-center gap-1.5\">\n                  <span\n                    aria-hidden=\"true\"\n                    className=\"size-2 rounded-full\"\n                    style={{\n                      background:\n                        status === \"critical\"\n                          ? \"var(--geo-map-critical)\"\n                          : status === \"warn\"\n                            ? \"var(--geo-map-warn)\"\n                            : \"var(--geo-map-marker)\",\n                    }}\n                  />\n                  {labels[status]}\n                  <span className=\"font-medium text-foreground tabular-nums\">\n                    {counts[status]}\n                  </span>\n                </span>\n              ))}\n            {maxValue > 0 ? (\n              <span className=\"inline-flex items-center gap-1.5\">\n                <span\n                  aria-hidden=\"true\"\n                  className=\"inline-flex items-center gap-0.5\"\n                >\n                  <span className=\"size-1.5 rounded-full border border-muted-foreground/70\" />\n                  <span className=\"size-2.5 rounded-full border border-muted-foreground/70\" />\n                </span>\n                {valueLabel}\n              </span>\n            ) : null}\n          </div>\n        ) : null}\n      </div>\n\n      <style href=\"overtrue-geo-map\" precedence=\"default\">\n        {`@keyframes geo-map-travel{0%{stroke-dashoffset:0}72%,100%{stroke-dashoffset:-1.36}}\n@keyframes geo-map-pulse{0%{transform:scale(1);opacity:.75}80%,100%{transform:scale(3.4);opacity:0}}\n.geo-map-comet{stroke-dashoffset:0;animation-name:geo-map-travel;animation-iteration-count:infinite;animation-timing-function:cubic-bezier(.45,0,.3,1)}\n.geo-map-pulse{transform-box:fill-box;transform-origin:center;animation:geo-map-pulse 2.2s cubic-bezier(.2,.6,.3,1) infinite}\n@media (prefers-reduced-motion:reduce){.geo-map-comet,.geo-map-pulse{animation:none;display:none}}`}\n      </style>\n    </div>\n  );\n}\n\nexport { GeoMap };\n"
    }
  ],
  "docs": "Documentation: https://ui.overtrue.xyz/components/geo-map. Requires an initialized shadcn/ui project with Tailwind CSS v4."
}
