// icons.jsx — shared SVG icon set (Apple Mail / Gmail style outline icons).
// Single source of truth so every tab uses the same crisp, consistent glyphs
// instead of unicode characters that render differently per OS/font.
// Usage:  <window.Ico n="reply" />   ·   <window.Ico n="flag" size={13} />
(function () {
  // 16×16 grid, outline, currentColor stroke. `solid:true` → fill + stroke
  // (used for the "on" state of toggles like a raised flag).
  const ICO = {
    reply:     { d: 'M6 4.5L2.5 8l3.5 3.5M2.5 8h6.5a4 4 0 014 4v.6' },
    replyAll:  { d: 'M4.5 4L1.5 8l3 4M8 4.2L5 8l1.4 1.8M8 8h3a3.7 3.7 0 013.7 3.7v.6' },
    forward:   { d: 'M10 4.5L13.5 8l-3.5 3.5M13.5 8H7a4 4 0 00-4 4v.6' },
    trash:     { d: 'M3 4.5h10M6.4 4.5V3h3.2v1.5M4.6 4.5l.6 9h5.6l.6-9M6.6 6.9v4.3M9.4 6.9v4.3' },
    archive:   { d: 'M2.5 3.4h11v2.7h-11zM3.6 6.1v7.5h8.8V6.1M6.3 8.9L8 10.6l1.7-1.7M8 10.4V7.9' },
    restore:   { d: 'M4 6.6A4.6 4.6 0 118 12.6M3.4 3.6v3.1h3.1' },
    flag:      { d: 'M4 2.5v11M4 3.1h7.6l-1.8 2.3 1.8 2.3H4' },
    flagSolid: { d: 'M4 2.7v10.6M4 3.2h7.5l-1.8 2.3 1.8 2.3H4z', solid: true },
    snooze:    { d: 'M8 2.6a5.4 5.4 0 100 10.8A5.4 5.4 0 008 2.6zM8 5.2v3l2.1 1.3' },
    compose:   { d: 'M8.6 3H3.3v9.7H13V7.5M10.9 2.4l2.2 2.2-5.1 5.1-2.7.6.6-2.7z' },
    edit:      { d: 'M3.2 10.9l6.4-6.4 1.9 1.9-6.4 6.4H3.2zM8.7 5l1.9 1.9' },
    attach:    { d: 'M11.4 5.4l-5 5a2.3 2.3 0 01-3.3-3.3l5.4-5.4a1.5 1.5 0 012.2 2.2l-5.1 5.1a.8.8 0 01-1.1-1.1l4.6-4.6' },
    download:  { d: 'M8 2.6v6.4M5.3 6.7L8 9.4l2.7-2.7M3.2 12.4h9.6' },
    calendar:  { d: 'M3 4.2h10v9.3H3zM3 6.8h10M5.6 2.6v2.2M10.4 2.6v2.2' },
    repeat:    { d: 'M4.2 6.4A4 4 0 0111 5M11.6 3.6v2.7H9M11.8 9.6A4 4 0 015 11M4.4 12.4V9.7h2.6' },
    pin:       { d: 'M8 1.9c-2.2 0-4 1.8-4 4 0 2.9 4 8.2 4 8.2s4-5.3 4-8.2c0-2.2-1.8-4-4-4zM8 7.4a1.5 1.5 0 100-3 1.5 1.5 0 000 3z' },
    person:    { d: 'M8 8.2a2.6 2.6 0 100-5.2 2.6 2.6 0 000 5.2zM3.3 13.4a4.7 4.7 0 019.4 0' },
    clock:     { d: 'M8 2.6a5.4 5.4 0 100 10.8A5.4 5.4 0 008 2.6zM8 5.2v3l2.1 1.3' },
    refresh:   { d: 'M12.4 6.2A4.6 4.6 0 1 0 13 9M12.7 2.8v3.6H9.1' },
    // ── rich-text toolbar ──
    undo:      { d: 'M5.3 5.4L2.6 8l2.7 2.6M2.6 8h6.8a3.6 3.6 0 010 7.2' },
    redo:      { d: 'M10.7 5.4L13.4 8l-2.7 2.6M13.4 8H6.6a3.6 3.6 0 000 7.2' },
    listBullet:{ d: 'M3 4.3h.01M3 8h.01M3 11.7h.01M6 4.3h7.4M6 8h7.4M6 11.7h7.4' },
    listOrdered:{ raw: '<path d="M6.2 4.3h7.3M6.2 8h7.3M6.2 11.7h7.3"/><text x="1.4" y="5.7" font-size="5.2" fill="currentColor" stroke="none">1</text><text x="1.4" y="9.5" font-size="5.2" fill="currentColor" stroke="none">2</text><text x="1.4" y="13.3" font-size="5.2" fill="currentColor" stroke="none">3</text>' },
    outdent:   { d: 'M6 4.3h7.5M6 11.7h7.5M8 8h5.5M5 6.2L3 8l2 1.8' },
    indent:    { d: 'M6 4.3h7.5M6 11.7h7.5M8 8h5.5M3 6.2L5 8l-2 1.8' },
    quote:     { d: 'M3.4 9.6c0-2 1.1-3.3 2.9-3.6M3.4 9.6h2.3v2.4H3.4zM9.4 9.6c0-2 1.1-3.3 2.9-3.6M9.4 9.6h2.3v2.4H9.4z' },
    link:      { d: 'M6.6 9.4l2.8-2.8M6.9 5.6l1-1a2.4 2.4 0 013.5 3.4l-1 1M9.1 10.4l-1 1a2.4 2.4 0 01-3.5-3.4l1-1' },
    image:     { d: 'M2.6 3.6h10.8v8.8H2.6zM2.6 10.2l3.2-3 2.4 2.3 2.2-2.1 2.8 2.7M6 6.4a1.05 1.05 0 11-2.1 0 1.05 1.05 0 012.1 0z' },
    clearFmt:  { d: 'M5.2 13h7M9.6 4.4l3.2 3.2-5 5H5.4l-1.8-1.8a1 1 0 010-1.4l5.2-5.2a1 1 0 011.4 0z' },
  };

  function Ico(props) {
    const { n, size, className } = props || {};
    const i = ICO[n];
    if (!i) return null;
    const s = size || 16;
    const attrs = {
      className: 'ico' + (className ? ' ' + className : ''),
      viewBox: '0 0 16 16', width: s, height: s,
      fill: i.solid ? 'currentColor' : 'none',
      stroke: 'currentColor', strokeWidth: i.solid ? 1.25 : 1.5,
      strokeLinecap: 'round', strokeLinejoin: 'round',
      'aria-hidden': 'true', focusable: 'false',
    };
    if (i.raw) { attrs.dangerouslySetInnerHTML = { __html: i.raw }; return React.createElement('svg', attrs); }
    return React.createElement('svg', attrs, React.createElement('path', { d: i.d }));
  }
  window.Ico = Ico;
  window.ICO_NAMES = Object.keys(ICO);
})();
