{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "region-bars",
  "title": "Region Bars",
  "type": "registry:component",
  "description": "Top countries by traffic, re-ranking as shares shift",
  "dependencies": [
    "motion@^12.43.0"
  ],
  "files": [
    {
      "path": "src/kavyn/region-bars.jsx",
      "type": "registry:file",
      "target": "@components/kavyn/region-bars.jsx",
      "content": "'use client'\n\nimport { useEffect, useState } from 'react'\nimport { motion } from 'motion/react'\n\nconst REGIONS = [\n  { name: 'India', code: 'IN', v: 34 }, { name: 'United States', code: 'US', v: 27 }, { name: 'Germany', code: 'DE', v: 12 },\n  { name: 'Brazil', code: 'BR', v: 9 }, { name: 'Singapore', code: 'SG', v: 7 }, { name: 'Japan', code: 'JP', v: 5 },\n]\n\n// Top regions by traffic. Bars re-rank themselves as live shares shift.\nexport default function RegionBars({ regions = REGIONS, interval = 2200, title = 'Top countries' }) {\n  const [list, setList] = useState(regions)\n  useEffect(() => {\n    const id = setInterval(() => {\n      if (document.hidden) return\n      setList((l) => {\n        const moved = l.map((r) => ({ ...r, v: Math.max(1, r.v + (Math.random() - 0.5) * 6) }))\n        const sum = moved.reduce((s, r) => s + r.v, 0)\n        return moved.map((r) => ({ ...r, v: (r.v / sum) * 94 })).sort((a, b) => b.v - a.v)\n      })\n    }, interval)\n    return () => clearInterval(id)\n  }, [interval])\n  const max = Math.max(...list.map((r) => r.v), 1)\n  return (\n    <div className=\"w-[380px] max-w-full rounded-2xl border border-line bg-panel p-4\">\n      <div className=\"mb-3 flex justify-between text-xs\"><span className=\"text-tx\">{title}</span><span className=\"text-faint\">share of requests</span></div>\n      <ul className=\"space-y-1.5\">\n        {list.map((r, i) => (\n          <motion.li key={r.code} layout transition={{ type: 'spring', stiffness: 360, damping: 32 }} className=\"relative h-8 overflow-hidden rounded-lg bg-panel2\">\n            <motion.div className={`absolute inset-y-0 left-0 rounded-lg ${i === 0 ? 'bg-acc/30' : 'bg-line2/70'}`} animate={{ width: `${(r.v / max) * 100}%` }} transition={{ type: 'spring', stiffness: 120, damping: 22 }} />\n            <div className=\"relative flex h-full items-center justify-between px-3 text-xs\">\n              <span className=\"flex items-center gap-2 text-tx\"><span className=\"font-mono text-[10px] text-faint\">{r.code}</span>{r.name}</span>\n              <span className=\"font-mono tabular-nums text-mute\">{r.v.toFixed(1)}%</span>\n            </div>\n          </motion.li>\n        ))}\n      </ul>\n    </div>\n  )\n}\n"
    }
  ],
  "cssVars": {
    "theme": {
      "color-bg": "var(--bg)",
      "color-panel": "var(--panel)",
      "color-panel2": "var(--panel2)",
      "color-line": "var(--line)",
      "color-line2": "var(--line2)",
      "color-tx": "var(--tx)",
      "color-mute": "var(--mute)",
      "color-faint": "var(--faint)",
      "color-acc": "var(--acc)",
      "color-acc-fg": "var(--acc-fg)"
    },
    "light": {
      "bg": "#ffffff",
      "panel": "#f5f5f7",
      "panel2": "#e8e8ed",
      "line": "#e5e5ea",
      "line2": "#d2d2d7",
      "tx": "#1d1d1f",
      "mute": "#6e6e73",
      "faint": "#a1a1a6",
      "acc": "#1d1d1f",
      "acc-fg": "#ffffff"
    },
    "dark": {
      "bg": "#000000",
      "panel": "#141416",
      "panel2": "#1f1f22",
      "line": "#262628",
      "line2": "#3a3a3d",
      "tx": "#f5f5f7",
      "mute": "#a1a1a6",
      "faint": "#6e6e73",
      "acc": "#f5f5f7",
      "acc-fg": "#000000"
    }
  },
  "css": {
    ".light": {
      "--bg": "#ffffff",
      "--panel": "#f5f5f7",
      "--panel2": "#e8e8ed",
      "--line": "#e5e5ea",
      "--line2": "#d2d2d7",
      "--tx": "#1d1d1f",
      "--mute": "#6e6e73",
      "--faint": "#a1a1a6",
      "--acc": "#1d1d1f",
      "--acc-fg": "#ffffff"
    }
  }
}
