const Icon = ({ name, size = 20, stroke = 1.75, style }) => {
  const p = { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: stroke, strokeLinecap: "round", strokeLinejoin: "round", style };
  const paths = {
    plane: <path d="M10.5 21 12 15.5 21 11 21 8 12 10 9 5 7 5 8 9.5 4 11 4 13 10.5 12 10 17 8 18 8 19.5 10.5 18.5 10.5 21Z"/>,
    list: <><path d="M8 6h13M8 12h13M8 18h13"/><circle cx="4" cy="6" r="1.2"/><circle cx="4" cy="12" r="1.2"/><circle cx="4" cy="18" r="1.2"/></>,
    clock: <><circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/></>,
    user: <><circle cx="12" cy="8" r="4"/><path d="M4 21c0-4 4-6 8-6s8 2 8 6"/></>,
    plus: <><path d="M12 5v14M5 12h14"/></>,
    chev_right: <path d="M9 6l6 6-6 6"/>,
    chev_down: <path d="M6 9l6 6 6-6"/>,
    chev_left: <path d="M15 6l-6 6 6 6"/>,
    search: <><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></>,
    lock: <><rect x="4" y="10" width="16" height="11" rx="2"/><path d="M8 10V7a4 4 0 0 1 8 0v3"/></>,
    check: <path d="m5 12 5 5 9-11"/>,
    x: <path d="m6 6 12 12M18 6 6 18"/>,
    send: <><path d="M22 2 11 13"/><path d="M22 2 15 22l-4-9-9-4 20-7Z"/></>,
    shield: <path d="M12 22s8-4 8-11V4l-8-2-8 2v7c0 7 8 11 8 11Z"/>,
    bolt: <path d="M13 2 4 14h7l-1 8 9-12h-7l1-8Z"/>,
    eye: <><path d="M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12Z"/><circle cx="12" cy="12" r="3"/></>,
    eye_off: <><path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-6 0-10-7-10-7a18.5 18.5 0 0 1 5.06-5.94"/><path d="M9.9 4.24A9.12 9.12 0 0 1 12 4c6 0 10 7 10 7a18.5 18.5 0 0 1-1.94 2.74"/><line x1="1" y1="1" x2="23" y2="23"/></>,
    edit: <><path d="M12 20h9"/><path d="M16.5 3.5a2.1 2.1 0 1 1 3 3L7 19l-4 1 1-4 12.5-12.5Z"/></>,
    trash: <><path d="M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2M6 6v14a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V6"/></>,
    copy: <><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></>,
    star: <path d="m12 2 3.1 6.3 7 1-5 4.9 1.2 6.9L12 17.8 5.7 21.1 7 14.2l-5-4.9 7-1L12 2Z"/>,
    chart: <><path d="M3 3v18h18"/><path d="M7 14l4-4 3 3 5-6"/></>,
    shield_check: <><path d="M12 22s8-4 8-11V4l-8-2-8 2v7c0 7 8 11 8 11Z"/><path d="m9 12 2 2 4-4"/></>,
    log: <><rect x="3" y="3" width="18" height="18" rx="2"/><path d="M7 8h10M7 12h10M7 16h7"/></>,
    map: <><path d="M9 20 3 21V5l6-2 6 2 6-2v16l-6 2-6-2Z"/><path d="M9 3v17M15 5v17"/></>,
    arrow_right: <path d="M5 12h14m-6-6 6 6-6 6"/>,
    'chevron-up': <path d="m18 15-6-6-6 6"/>,
    'chevron-down': <path d="m6 9 6 6 6-6"/>,
    info: <><circle cx="12" cy="12" r="9"/><path d="M12 8h.01M11 12h1v5h1"/></>,
    sun: <><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/></>,
    moon: <path d="M21 13a9 9 0 1 1-10-10 7 7 0 0 0 10 10Z"/>,
    refresh: <><path d="M3 12a9 9 0 0 1 15-6.7l3-3"/><path d="M21 3v6h-6"/><path d="M21 12a9 9 0 0 1-15 6.7l-3 3"/><path d="M3 21v-6h6"/></>,
    filter: <path d="M3 4h18l-7 9v6l-4 2v-8L3 4Z"/>,
    download: <><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="M7 10l5 5 5-5M12 15V3"/></>,
    users: <><circle cx="9" cy="8" r="3.5"/><path d="M2 21c0-3 3-5 7-5s7 2 7 5"/><path d="M17 11a3 3 0 1 0 0-6"/><path d="M22 21c0-2.5-2-4-4-4"/></>,
    ban: <><circle cx="12" cy="12" r="9"/><path d="m6 6 12 12"/></>,
    gift: <><rect x="3" y="8" width="18" height="13" rx="2"/><path d="M3 12h18M12 8v13M12 8s-4-6-7-3 3 3 7 3ZM12 8s4-6 7-3-3 3-7 3Z"/></>,
    menu: <><path d="M3 6h18M3 12h18M3 18h18"/></>,
    logout: <><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><path d="M16 17l5-5-5-5M21 12H9"/></>,
    settings: <><circle cx="12" cy="12" r="3"/><path d="M12 1v2M12 21v2M4.2 4.2l1.4 1.4M18.4 18.4l1.4 1.4M1 12h2M21 12h2M4.2 19.8l1.4-1.4M18.4 5.6l1.4-1.4"/></>,
    layers: <><path d="m12 2 10 6-10 6L2 8l10-6Z"/><path d="m2 14 10 6 10-6"/></>,
    calendar: <><rect x="3" y="5" width="18" height="16" rx="2"/><path d="M8 3v4M16 3v4M3 10h18"/></>
  };
  return <svg {...p}>{paths[name] || null}</svg>;
};
const Spark = ({ data, w=80, h=24 }) => {
  const max = Math.max(...data, 1), min = Math.min(...data);
  const pts = data.map((v,i)=>[i*(w/(data.length-1)), h - ((v-min)/((max-min)||1))*(h-4) - 2]);
  const d = pts.map((p,i)=>`${i?'L':'M'}${p[0].toFixed(1)} ${p[1].toFixed(1)}`).join(' ');
  return (
    <svg width={w} height={h}>
      <defs><linearGradient id={`sp-${w}`} x1="0" x2="1"><stop offset="0" stopColor="#FFB86B"/><stop offset="1" stopColor="#B545FF"/></linearGradient></defs>
      <path d={d} fill="none" stroke={`url(#sp-${w})`} strokeWidth="1.75" strokeLinejoin="round" strokeLinecap="round"/>
    </svg>
  );
};
Object.assign(window, { Icon, Spark });
