/* MBEX — icon set (stroke-based, inherits currentColor) */
const ICON_ASSET_VERSION = "20260708-home-icons2";

const I = ({ d, size = 22, sw = 1.8, fill = "none", vb = 24, children, ...p }) => (
  <svg width={size} height={size} viewBox={`0 0 ${vb} ${vb}`} fill={fill}
    stroke="currentColor" strokeWidth={sw} strokeLinecap="round" strokeLinejoin="round" {...p}>
    {d ? <path d={d} /> : children}
  </svg>
);

const ImageIcon = ({ src, size = 22, style, sw, fill, vb, ...p }) => (
  <img
    src={src}
    width={size}
    height={size}
    alt=""
    aria-hidden="true"
    draggable="false"
    {...p}
    style={{ width: size, height: size, display: "block", objectFit: "contain", ...style }}
  />
);

const Icons = {
  home:    (p) => <I d="M3 10.5 12 3l9 7.5M5 9.5V20a1 1 0 0 0 1 1h4v-6h4v6h4a1 1 0 0 0 1-1V9.5" {...p} />,
  history: (p) => <I {...p}><path d="M3.5 12a8.5 8.5 0 1 0 2.6-6.1M3 4v4h4"/><path d="M12 8v4l3 2"/></I>,
  user:    (p) => <I {...p}><circle cx="12" cy="8" r="4"/><path d="M4 20c.8-3.7 3.9-6 8-6s7.2 2.3 8 6"/></I>,
  arrowUp: (p) => <I d="M12 19V5M6 11l6-6 6 6" {...p} />,
  arrowDown:(p) => <I d="M12 5v14M6 13l6 6 6-6" {...p} />,
  swap:    (p) => <I d="M7 4v13M7 4 4 7m3-3 3 3M17 20V7m0 13 3-3m-3 3-3-3" {...p} />,
  close:   (p) => <I d="M6 6l12 12M18 6 6 18" {...p} />,
  dots:    (p) => <I {...p}><circle cx="12" cy="5" r="1.4" fill="currentColor" stroke="none"/><circle cx="12" cy="12" r="1.4" fill="currentColor" stroke="none"/><circle cx="12" cy="19" r="1.4" fill="currentColor" stroke="none"/></I>,
  back:    (p) => <I d="M15 5l-7 7 7 7" {...p} />,
  chevR:   (p) => <I d="M9 5l7 7-7 7" size={16} {...p} />,
  copy:    (p) => <I {...p}><rect x="9" y="9" width="11" height="11" rx="2.5"/><path d="M5 15V5a2 2 0 0 1 2-2h8"/></I>,
  check:   (p) => <I d="M4 12.5l5 5L20 6" {...p} />,
  shield:  (p) => <I {...p}><path d="M12 3l7 3v5c0 4.5-3 8-7 10-4-2-7-5.5-7-10V6l7-3Z"/><path d="M9 12l2 2 4-4"/></I>,
  support: (p) => <ImageIcon src={`/static/miniapp-new/home_icon_support.png?v=${ICON_ASSET_VERSION}`} {...p} />,
  doc:     (p) => <I {...p}><path d="M6 3h8l4 4v14a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1Z"/><path d="M14 3v4h4M8 12h8M8 16h6"/></I>,
  pin:     (p) => <ImageIcon src={`/static/miniapp-new/home_icon_marker.png?v=${ICON_ASSET_VERSION}`} {...p} />,
  gift:    (p) => <ImageIcon src={`/static/miniapp-new/home_icon_gift.png?v=${ICON_ASSET_VERSION}`} {...p} />,
  kyc:     (p) => <ImageIcon src={`/static/miniapp-new/home_icon_kyc.png?v=${ICON_ASSET_VERSION}`} {...p} />,
  bell:    (p) => <I {...p}><path d="M6 10a6 6 0 0 1 12 0c0 5 2 6 2 6H4s2-1 2-6Z"/><path d="M10 20a2 2 0 0 0 4 0"/></I>,
  globe:   (p) => <I {...p}><circle cx="12" cy="12" r="8.5"/><path d="M3.5 12h17M12 3.5c2.5 2.4 2.5 14.6 0 17M12 3.5c-2.5 2.4-2.5 14.6 0 17"/></I>,
  moon:    (p) => <I d="M20 14.5A8 8 0 1 1 9.5 4 6.5 6.5 0 0 0 20 14.5Z" {...p} />,
  sun:     (p) => <I {...p}><circle cx="12" cy="12" r="4.2"/><path d="M12 2v2.5M12 19.5V22M2 12h2.5M19.5 12H22M5 5l1.8 1.8M17.2 17.2 19 19M19 5l-1.8 1.8M6.8 17.2 5 19"/></I>,
  eye:     (p) => <I {...p}><path d="M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z"/><circle cx="12" cy="12" r="3"/></I>,
  eyeOff:  (p) => <I {...p}><path d="M4 4l16 16M9.5 5.8A9.8 9.8 0 0 1 12 5.5c6 0 9.5 6.5 9.5 6.5a16 16 0 0 1-3 3.7M6.4 7.6A16 16 0 0 0 2.5 12S6 18.5 12 18.5a9.6 9.6 0 0 0 2.6-.35"/><path d="M9.9 10a3 3 0 0 0 4.1 4.1"/></I>,
  share:   (p) => <I {...p}><circle cx="6" cy="12" r="2.5"/><circle cx="17" cy="5.5" r="2.5"/><circle cx="17" cy="18.5" r="2.5"/><path d="M8.2 10.8l6.6-3.8M8.2 13.2l6.6 3.8"/></I>,
  wallet:  (p) => <I {...p}><rect x="3" y="6" width="18" height="13" rx="3"/><path d="M3 9h18M16.5 13.5h.01" strokeWidth="2.4"/></I>,
  clock:   (p) => <I {...p}><circle cx="12" cy="12" r="8.5"/><path d="M12 7v5l3.5 2"/></I>,
  bolt:    (p) => <I d="M13 2 4 14h7l-1 8 9-12h-7l1-8Z" {...p} />,
  trend:   (p) => <I d="M3 16l5-5 4 3 6-7M15 7h4v4" {...p} />,
  plus:    (p) => <I d="M12 5v14M5 12h14" {...p} />,
  card:    (p) => <I {...p}><rect x="3" y="5" width="18" height="14" rx="3"/><path d="M3 9.5h18M6.5 14.5h4"/></I>,
  qr:      (p) => <I {...p}><rect x="3.5" y="3.5" width="7" height="7" rx="1.5"/><rect x="13.5" y="3.5" width="7" height="7" rx="1.5"/><rect x="3.5" y="13.5" width="7" height="7" rx="1.5"/><path d="M14 14h2.5v2.5M20.5 14v.01M14 20.5h6.5V18" strokeWidth="1.7"/></I>,
  info:    (p) => <I {...p}><circle cx="12" cy="12" r="8.5"/><path d="M12 11v5M12 7.5v.01" strokeWidth="2.2"/></I>,
  star:    (p) => <I d="M12 3.5l2.6 5.3 5.9.9-4.3 4.1 1 5.8-5.2-2.7-5.2 2.7 1-5.8L3.5 9.7l5.9-.9L12 3.5Z" {...p} />,
};

window.Icons = Icons;
