// Shared Lucide-backed Icon for NICO UI kits.
// Renders a real <svg> via React (no DOM replacement) so icons survive re-renders.
// Requires the lucide UMD global to be loaded first.
(function () {
  function toPascal(name) {
    return String(name).replace(/(^|-)([a-z0-9])/g, (_, __, c) => c.toUpperCase());
  }
  function Icon({ name, size = 18, color = "currentColor", strokeWidth = 2, style = {} }) {
    const node = window.lucide && window.lucide[toPascal(name)];
    if (!node) {
      return React.createElement("span", { style: { display: "inline-block", width: size, height: size, ...style } });
    }
    const children = node[2] || [];
    return React.createElement(
      "svg",
      {
        xmlns: "http://www.w3.org/2000/svg",
        width: size, height: size, viewBox: "0 0 24 24",
        fill: "none", stroke: color, strokeWidth,
        strokeLinecap: "round", strokeLinejoin: "round",
        style: { display: "block", flexShrink: 0, ...style },
      },
      children.map((c, i) => React.createElement(c[0], { key: i, ...c[1] }))
    );
  }
  window.Icon = Icon;
})();
