import { forwardRef as se, useState as R, useEffect as W, createElement as H } from "react";
const ce = Object.freeze(
  {
    left: 0,
    top: 0,
    width: 16,
    height: 16
  }
), A = Object.freeze({
  rotate: 0,
  vFlip: !1,
  hFlip: !1
}), $ = Object.freeze({
  ...ce,
  ...A
}), Q = Object.freeze({
  ...$,
  body: "",
  hidden: !1
});
function Ie(e, n) {
  const o = {};
  !e.hFlip != !n.hFlip && (o.hFlip = !0), !e.vFlip != !n.vFlip && (o.vFlip = !0);
  const i = ((e.rotate || 0) + (n.rotate || 0)) % 4;
  return i && (o.rotate = i), o;
}
function J(e, n) {
  const o = Ie(e, n);
  for (const i in Q)
    i in A ? i in e && !(i in o) && (o[i] = A[i]) : i in n ? o[i] = n[i] : i in e && (o[i] = e[i]);
  return o;
}
function we(e, n) {
  const o = e.icons, i = e.aliases || /* @__PURE__ */ Object.create(null), t = /* @__PURE__ */ Object.create(null);
  function r(s) {
    if (o[s])
      return t[s] = [];
    if (!(s in t)) {
      t[s] = null;
      const l = i[s] && i[s].parent, c = l && r(l);
      c && (t[s] = [l].concat(c));
    }
    return t[s];
  }
  return Object.keys(o).concat(Object.keys(i)).forEach(r), t;
}
function ve(e, n, o) {
  const i = e.icons, t = e.aliases || /* @__PURE__ */ Object.create(null);
  let r = {};
  function s(l) {
    r = J(
      i[l] || t[l],
      r
    );
  }
  return s(n), o.forEach(s), J(e, r);
}
function le(e, n) {
  const o = [];
  if (typeof e != "object" || typeof e.icons != "object")
    return o;
  e.not_found instanceof Array && e.not_found.forEach((t) => {
    n(t, null), o.push(t);
  });
  const i = we(e);
  for (const t in i) {
    const r = i[t];
    r && (n(t, ve(e, t, r)), o.push(t));
  }
  return o;
}
const ke = {
  provider: "",
  aliases: {},
  not_found: {},
  ...ce
};
function D(e, n) {
  for (const o in n)
    if (o in e && typeof e[o] != typeof n[o])
      return !1;
  return !0;
}
function fe(e) {
  if (typeof e != "object" || e === null)
    return null;
  const n = e;
  if (typeof n.prefix != "string" || !e.icons || typeof e.icons != "object" || !D(e, ke))
    return null;
  const o = n.icons;
  for (const t in o) {
    const r = o[t];
    if (
      // Name cannot be empty
      !t || // Must have body
      typeof r.body != "string" || // Check other props
      !D(
        r,
        Q
      )
    )
      return null;
  }
  const i = n.aliases || /* @__PURE__ */ Object.create(null);
  for (const t in i) {
    const r = i[t], s = r.parent;
    if (
      // Name cannot be empty
      !t || // Parent must be set and point to existing icon
      typeof s != "string" || !o[s] && !i[s] || // Check other props
      !D(
        r,
        Q
      )
    )
      return null;
  }
  return n;
}
const ue = /^[a-z0-9]+(-[a-z0-9]+)*$/, M = (e, n, o, i = "") => {
  const t = e.split(":");
  if (e.slice(0, 1) === "@") {
    if (t.length < 2 || t.length > 3)
      return null;
    i = t.shift().slice(1);
  }
  if (t.length > 3 || !t.length)
    return null;
  if (t.length > 1) {
    const l = t.pop(), c = t.pop(), f = {
      // Allow provider without '@': "provider:prefix:name"
      provider: t.length > 0 ? t[0] : i,
      prefix: c,
      name: l
    };
    return n && !F(f) ? null : f;
  }
  const r = t[0], s = r.split("-");
  if (s.length > 1) {
    const l = {
      provider: i,
      prefix: s.shift(),
      name: s.join("-")
    };
    return n && !F(l) ? null : l;
  }
  if (o && i === "") {
    const l = {
      provider: i,
      prefix: "",
      name: r
    };
    return n && !F(l, o) ? null : l;
  }
  return null;
}, F = (e, n) => e ? !!// Check prefix: cannot be empty, unless allowSimpleName is enabled
// Check name: cannot be empty
((n && e.prefix === "" || e.prefix) && e.name) : !1, K = /* @__PURE__ */ Object.create(null);
function Se(e, n) {
  return {
    provider: e,
    prefix: n,
    icons: /* @__PURE__ */ Object.create(null),
    missing: /* @__PURE__ */ new Set()
  };
}
function S(e, n) {
  const o = K[e] || (K[e] = /* @__PURE__ */ Object.create(null));
  return o[n] || (o[n] = Se(e, n));
}
function ae(e, n) {
  return fe(n) ? le(n, (o, i) => {
    i ? e.icons[o] = i : e.missing.add(o);
  }) : [];
}
function Te(e, n, o) {
  try {
    if (typeof o.body == "string")
      return e.icons[n] = { ...o }, !0;
  } catch {
  }
  return !1;
}
let E = !1;
function de(e) {
  return typeof e == "boolean" && (E = e), E;
}
function X(e) {
  const n = typeof e == "string" ? M(e, !0, E) : e;
  if (n) {
    const o = S(n.provider, n.prefix), i = n.name;
    return o.icons[i] || (o.missing.has(i) ? null : void 0);
  }
}
function Pe(e, n) {
  const o = M(e, !0, E);
  if (!o)
    return !1;
  const i = S(o.provider, o.prefix);
  return n ? Te(i, o.name, n) : (i.missing.add(o.name), !0);
}
function Ce(e, n) {
  if (typeof e != "object")
    return !1;
  if (typeof n != "string" && (n = e.provider || ""), E && !n && !e.prefix) {
    let t = !1;
    return fe(e) && (e.prefix = "", le(e, (r, s) => {
      Pe(r, s) && (t = !0);
    })), t;
  }
  const o = e.prefix;
  if (!F({
    prefix: o,
    name: "a"
  }))
    return !1;
  const i = S(n, o);
  return !!ae(i, e);
}
const he = Object.freeze({
  width: null,
  height: null
}), pe = Object.freeze({
  // Dimensions
  ...he,
  // Transformations
  ...A
}), je = /(-?[0-9.]*[0-9]+[0-9.]*)/g, Ee = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
function Y(e, n, o) {
  if (n === 1)
    return e;
  if (o = o || 100, typeof e == "number")
    return Math.ceil(e * n * o) / o;
  if (typeof e != "string")
    return e;
  const i = e.split(je);
  if (i === null || !i.length)
    return e;
  const t = [];
  let r = i.shift(), s = Ee.test(r);
  for (; ; ) {
    if (s) {
      const l = parseFloat(r);
      isNaN(l) ? t.push(r) : t.push(Math.ceil(l * n * o) / o);
    } else
      t.push(r);
    if (r = i.shift(), r === void 0)
      return t.join("");
    s = !s;
  }
}
function Oe(e, n = "defs") {
  let o = "";
  const i = e.indexOf("<" + n);
  for (; i >= 0; ) {
    const t = e.indexOf(">", i), r = e.indexOf("</" + n);
    if (t === -1 || r === -1)
      break;
    const s = e.indexOf(">", r);
    if (s === -1)
      break;
    o += e.slice(t + 1, r).trim(), e = e.slice(0, i).trim() + e.slice(s + 1);
  }
  return {
    defs: o,
    content: e
  };
}
function Fe(e, n) {
  return e ? "<defs>" + e + "</defs>" + n : n;
}
function Le(e, n, o) {
  const i = Oe(e);
  return Fe(i.defs, n + i.content + o);
}
const Ae = (e) => e === "unset" || e === "undefined" || e === "none";
function Me(e, n) {
  const o = {
    ...$,
    ...e
  }, i = {
    ...pe,
    ...n
  }, t = {
    left: o.left,
    top: o.top,
    width: o.width,
    height: o.height
  };
  let r = o.body;
  [o, i].forEach((x) => {
    const a = [], h = x.hFlip, v = x.vFlip;
    let b = x.rotate;
    h ? v ? b += 2 : (a.push(
      "translate(" + (t.width + t.left).toString() + " " + (0 - t.top).toString() + ")"
    ), a.push("scale(-1 1)"), t.top = t.left = 0) : v && (a.push(
      "translate(" + (0 - t.left).toString() + " " + (t.height + t.top).toString() + ")"
    ), a.push("scale(1 -1)"), t.top = t.left = 0);
    let I;
    switch (b < 0 && (b -= Math.floor(b / 4) * 4), b = b % 4, b) {
      case 1:
        I = t.height / 2 + t.top, a.unshift(
          "rotate(90 " + I.toString() + " " + I.toString() + ")"
        );
        break;
      case 2:
        a.unshift(
          "rotate(180 " + (t.width / 2 + t.left).toString() + " " + (t.height / 2 + t.top).toString() + ")"
        );
        break;
      case 3:
        I = t.width / 2 + t.left, a.unshift(
          "rotate(-90 " + I.toString() + " " + I.toString() + ")"
        );
        break;
    }
    b % 2 === 1 && (t.left !== t.top && (I = t.left, t.left = t.top, t.top = I), t.width !== t.height && (I = t.width, t.width = t.height, t.height = I)), a.length && (r = Le(
      r,
      '<g transform="' + a.join(" ") + '">',
      "</g>"
    ));
  });
  const s = i.width, l = i.height, c = t.width, f = t.height;
  let u, d;
  s === null ? (d = l === null ? "1em" : l === "auto" ? f : l, u = Y(d, c / f)) : (u = s === "auto" ? c : s, d = l === null ? Y(u, f / c) : l === "auto" ? f : l);
  const p = {}, g = (x, a) => {
    Ae(a) || (p[x] = a.toString());
  };
  g("width", u), g("height", d);
  const y = [t.left, t.top, c, f];
  return p.viewBox = y.join(" "), {
    attributes: p,
    viewBox: y,
    body: r
  };
}
const Ne = /\sid="(\S+)"/g, Re = "IconifyId" + Date.now().toString(16) + (Math.random() * 16777216 | 0).toString(16);
let De = 0;
function _e(e, n = Re) {
  const o = [];
  let i;
  for (; i = Ne.exec(e); )
    o.push(i[1]);
  if (!o.length)
    return e;
  const t = "suffix" + (Math.random() * 16777216 | Date.now()).toString(16);
  return o.forEach((r) => {
    const s = typeof n == "function" ? n(r) : n + (De++).toString(), l = r.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
    e = e.replace(
      // Allowed characters before id: [#;"]
      // Allowed characters after id: [)"], .[a-z]
      new RegExp('([#;"])(' + l + ')([")]|\\.[a-z])', "g"),
      "$1" + s + t + "$3"
    );
  }), e = e.replace(new RegExp(t, "g"), ""), e;
}
const U = /* @__PURE__ */ Object.create(null);
function He(e, n) {
  U[e] = n;
}
function q(e) {
  return U[e] || U[""];
}
function V(e) {
  let n;
  if (typeof e.resources == "string")
    n = [e.resources];
  else if (n = e.resources, !(n instanceof Array) || !n.length)
    return null;
  return {
    // API hosts
    resources: n,
    // Root path
    path: e.path || "/",
    // URL length limit
    maxURL: e.maxURL || 500,
    // Timeout before next host is used.
    rotate: e.rotate || 750,
    // Timeout before failing query.
    timeout: e.timeout || 5e3,
    // Randomise default API end point.
    random: e.random === !0,
    // Start index
    index: e.index || 0,
    // Receive data after time out (used if time out kicks in first, then API module sends data anyway).
    dataAfterTimeout: e.dataAfterTimeout !== !1
  };
}
const G = /* @__PURE__ */ Object.create(null), P = [
  "https://api.simplesvg.com",
  "https://api.unisvg.com"
], L = [];
for (; P.length > 0; )
  P.length === 1 || Math.random() > 0.5 ? L.push(P.shift()) : L.push(P.pop());
G[""] = V({
  resources: ["https://api.iconify.design"].concat(L)
});
function Qe(e, n) {
  const o = V(n);
  return o === null ? !1 : (G[e] = o, !0);
}
function B(e) {
  return G[e];
}
const Ue = () => {
  let e;
  try {
    if (e = fetch, typeof e == "function")
      return e;
  } catch {
  }
};
let Z = Ue();
function qe(e, n) {
  const o = B(e);
  if (!o)
    return 0;
  let i;
  if (!o.maxURL)
    i = 0;
  else {
    let t = 0;
    o.resources.forEach((s) => {
      t = Math.max(t, s.length);
    });
    const r = n + ".json?icons=";
    i = o.maxURL - t - o.path.length - r.length;
  }
  return i;
}
function ze(e) {
  return e === 404;
}
const $e = (e, n, o) => {
  const i = [], t = qe(e, n), r = "icons";
  let s = {
    type: r,
    provider: e,
    prefix: n,
    icons: []
  }, l = 0;
  return o.forEach((c, f) => {
    l += c.length + 1, l >= t && f > 0 && (i.push(s), s = {
      type: r,
      provider: e,
      prefix: n,
      icons: []
    }, l = c.length), s.icons.push(c);
  }), i.push(s), i;
};
function Ve(e) {
  if (typeof e == "string") {
    const n = B(e);
    if (n)
      return n.path;
  }
  return "/";
}
const Ge = (e, n, o) => {
  if (!Z) {
    o("abort", 424);
    return;
  }
  let i = Ve(n.provider);
  switch (n.type) {
    case "icons": {
      const r = n.prefix, l = n.icons.join(","), c = new URLSearchParams({
        icons: l
      });
      i += r + ".json?" + c.toString();
      break;
    }
    case "custom": {
      const r = n.uri;
      i += r.slice(0, 1) === "/" ? r.slice(1) : r;
      break;
    }
    default:
      o("abort", 400);
      return;
  }
  let t = 503;
  Z(e + i).then((r) => {
    const s = r.status;
    if (s !== 200) {
      setTimeout(() => {
        o(ze(s) ? "abort" : "next", s);
      });
      return;
    }
    return t = 501, r.json();
  }).then((r) => {
    if (typeof r != "object" || r === null) {
      setTimeout(() => {
        r === 404 ? o("abort", r) : o("next", t);
      });
      return;
    }
    setTimeout(() => {
      o("success", r);
    });
  }).catch(() => {
    o("next", t);
  });
}, Be = {
  prepare: $e,
  send: Ge
};
function We(e) {
  const n = {
    loaded: [],
    missing: [],
    pending: []
  }, o = /* @__PURE__ */ Object.create(null);
  e.sort((t, r) => t.provider !== r.provider ? t.provider.localeCompare(r.provider) : t.prefix !== r.prefix ? t.prefix.localeCompare(r.prefix) : t.name.localeCompare(r.name));
  let i = {
    provider: "",
    prefix: "",
    name: ""
  };
  return e.forEach((t) => {
    if (i.name === t.name && i.prefix === t.prefix && i.provider === t.provider)
      return;
    i = t;
    const r = t.provider, s = t.prefix, l = t.name, c = o[r] || (o[r] = /* @__PURE__ */ Object.create(null)), f = c[s] || (c[s] = S(r, s));
    let u;
    l in f.icons ? u = n.loaded : s === "" || f.missing.has(l) ? u = n.missing : u = n.pending;
    const d = {
      provider: r,
      prefix: s,
      name: l
    };
    u.push(d);
  }), n;
}
function ge(e, n) {
  e.forEach((o) => {
    const i = o.loaderCallbacks;
    i && (o.loaderCallbacks = i.filter((t) => t.id !== n));
  });
}
function Je(e) {
  e.pendingCallbacksFlag || (e.pendingCallbacksFlag = !0, setTimeout(() => {
    e.pendingCallbacksFlag = !1;
    const n = e.loaderCallbacks ? e.loaderCallbacks.slice(0) : [];
    if (!n.length)
      return;
    let o = !1;
    const i = e.provider, t = e.prefix;
    n.forEach((r) => {
      const s = r.icons, l = s.pending.length;
      s.pending = s.pending.filter((c) => {
        if (c.prefix !== t)
          return !0;
        const f = c.name;
        if (e.icons[f])
          s.loaded.push({
            provider: i,
            prefix: t,
            name: f
          });
        else if (e.missing.has(f))
          s.missing.push({
            provider: i,
            prefix: t,
            name: f
          });
        else
          return o = !0, !0;
        return !1;
      }), s.pending.length !== l && (o || ge([e], r.id), r.callback(
        s.loaded.slice(0),
        s.missing.slice(0),
        s.pending.slice(0),
        r.abort
      ));
    });
  }));
}
let Ke = 0;
function Xe(e, n, o) {
  const i = Ke++, t = ge.bind(null, o, i);
  if (!n.pending.length)
    return t;
  const r = {
    id: i,
    icons: n,
    callback: e,
    abort: t
  };
  return o.forEach((s) => {
    (s.loaderCallbacks || (s.loaderCallbacks = [])).push(r);
  }), t;
}
function Ye(e, n = !0, o = !1) {
  const i = [];
  return e.forEach((t) => {
    const r = typeof t == "string" ? M(t, n, o) : t;
    r && i.push(r);
  }), i;
}
var Ze = {
  resources: [],
  index: 0,
  timeout: 2e3,
  rotate: 750,
  random: !1,
  dataAfterTimeout: !1
};
function et(e, n, o, i) {
  const t = e.resources.length, r = e.random ? Math.floor(Math.random() * t) : e.index;
  let s;
  if (e.random) {
    let m = e.resources.slice(0);
    for (s = []; m.length > 1; ) {
      const w = Math.floor(Math.random() * m.length);
      s.push(m[w]), m = m.slice(0, w).concat(m.slice(w + 1));
    }
    s = s.concat(m);
  } else
    s = e.resources.slice(r).concat(e.resources.slice(0, r));
  const l = Date.now();
  let c = "pending", f = 0, u, d = null, p = [], g = [];
  typeof i == "function" && g.push(i);
  function y() {
    d && (clearTimeout(d), d = null);
  }
  function x() {
    c === "pending" && (c = "aborted"), y(), p.forEach((m) => {
      m.status === "pending" && (m.status = "aborted");
    }), p = [];
  }
  function a(m, w) {
    w && (g = []), typeof m == "function" && g.push(m);
  }
  function h() {
    return {
      startTime: l,
      payload: n,
      status: c,
      queriesSent: f,
      queriesPending: p.length,
      subscribe: a,
      abort: x
    };
  }
  function v() {
    c = "failed", g.forEach((m) => {
      m(void 0, u);
    });
  }
  function b() {
    p.forEach((m) => {
      m.status === "pending" && (m.status = "aborted");
    }), p = [];
  }
  function I(m, w, T) {
    const O = w !== "success";
    switch (p = p.filter((k) => k !== m), c) {
      case "pending":
        break;
      case "failed":
        if (O || !e.dataAfterTimeout)
          return;
        break;
      default:
        return;
    }
    if (w === "abort") {
      u = T, v();
      return;
    }
    if (O) {
      u = T, p.length || (s.length ? N() : v());
      return;
    }
    if (y(), b(), !e.random) {
      const k = e.resources.indexOf(m.resource);
      k !== -1 && k !== e.index && (e.index = k);
    }
    c = "completed", g.forEach((k) => {
      k(T);
    });
  }
  function N() {
    if (c !== "pending")
      return;
    y();
    const m = s.shift();
    if (m === void 0) {
      if (p.length) {
        d = setTimeout(() => {
          y(), c === "pending" && (b(), v());
        }, e.timeout);
        return;
      }
      v();
      return;
    }
    const w = {
      status: "pending",
      resource: m,
      callback: (T, O) => {
        I(w, T, O);
      }
    };
    p.push(w), f++, d = setTimeout(N, e.rotate), o(m, n, w.callback);
  }
  return setTimeout(N), h;
}
function me(e) {
  const n = {
    ...Ze,
    ...e
  };
  let o = [];
  function i() {
    o = o.filter((l) => l().status === "pending");
  }
  function t(l, c, f) {
    const u = et(
      n,
      l,
      c,
      (d, p) => {
        i(), f && f(d, p);
      }
    );
    return o.push(u), u;
  }
  function r(l) {
    return o.find((c) => l(c)) || null;
  }
  return {
    query: t,
    find: r,
    setIndex: (l) => {
      n.index = l;
    },
    getIndex: () => n.index,
    cleanup: i
  };
}
function ee() {
}
const _ = /* @__PURE__ */ Object.create(null);
function tt(e) {
  if (!_[e]) {
    const n = B(e);
    if (!n)
      return;
    const o = me(n), i = {
      config: n,
      redundancy: o
    };
    _[e] = i;
  }
  return _[e];
}
function nt(e, n, o) {
  let i, t;
  if (typeof e == "string") {
    const r = q(e);
    if (!r)
      return o(void 0, 424), ee;
    t = r.send;
    const s = tt(e);
    s && (i = s.redundancy);
  } else {
    const r = V(e);
    if (r) {
      i = me(r);
      const s = e.resources ? e.resources[0] : "", l = q(s);
      l && (t = l.send);
    }
  }
  return !i || !t ? (o(void 0, 424), ee) : i.query(n, t, o)().abort;
}
function te() {
}
function ot(e) {
  e.iconsLoaderFlag || (e.iconsLoaderFlag = !0, setTimeout(() => {
    e.iconsLoaderFlag = !1, Je(e);
  }));
}
function it(e) {
  const n = [], o = [];
  return e.forEach((i) => {
    (i.match(ue) ? n : o).push(i);
  }), {
    valid: n,
    invalid: o
  };
}
function C(e, n, o) {
  function i() {
    const t = e.pendingIcons;
    n.forEach((r) => {
      t && t.delete(r), e.icons[r] || e.missing.add(r);
    });
  }
  if (o && typeof o == "object")
    try {
      if (!ae(e, o).length) {
        i();
        return;
      }
    } catch (t) {
      console.error(t);
    }
  i(), ot(e);
}
function ne(e, n) {
  e instanceof Promise ? e.then((o) => {
    n(o);
  }).catch(() => {
    n(null);
  }) : n(e);
}
function rt(e, n) {
  e.iconsToLoad ? e.iconsToLoad = e.iconsToLoad.concat(n).sort() : e.iconsToLoad = n, e.iconsQueueFlag || (e.iconsQueueFlag = !0, setTimeout(() => {
    e.iconsQueueFlag = !1;
    const { provider: o, prefix: i } = e, t = e.iconsToLoad;
    if (delete e.iconsToLoad, !t || !t.length)
      return;
    const r = e.loadIcon;
    if (e.loadIcons && (t.length > 1 || !r)) {
      ne(
        e.loadIcons(t, i, o),
        (u) => {
          C(e, t, u);
        }
      );
      return;
    }
    if (r) {
      t.forEach((u) => {
        const d = r(u, i, o);
        ne(d, (p) => {
          const g = p ? {
            prefix: i,
            icons: {
              [u]: p
            }
          } : null;
          C(e, [u], g);
        });
      });
      return;
    }
    const { valid: s, invalid: l } = it(t);
    if (l.length && C(e, l, null), !s.length)
      return;
    const c = i.match(ue) ? q(o) : null;
    if (!c) {
      C(e, s, null);
      return;
    }
    c.prepare(o, i, s).forEach((u) => {
      nt(o, u, (d) => {
        C(e, u.icons, d);
      });
    });
  }));
}
const st = (e, n) => {
  const o = Ye(e, !0, de()), i = We(o);
  if (!i.pending.length) {
    let c = !0;
    return n && setTimeout(() => {
      c && n(
        i.loaded,
        i.missing,
        i.pending,
        te
      );
    }), () => {
      c = !1;
    };
  }
  const t = /* @__PURE__ */ Object.create(null), r = [];
  let s, l;
  return i.pending.forEach((c) => {
    const { provider: f, prefix: u } = c;
    if (u === l && f === s)
      return;
    s = f, l = u, r.push(S(f, u));
    const d = t[f] || (t[f] = /* @__PURE__ */ Object.create(null));
    d[u] || (d[u] = []);
  }), i.pending.forEach((c) => {
    const { provider: f, prefix: u, name: d } = c, p = S(f, u), g = p.pendingIcons || (p.pendingIcons = /* @__PURE__ */ new Set());
    g.has(d) || (g.add(d), t[f][u].push(d));
  }), r.forEach((c) => {
    const f = t[c.provider][c.prefix];
    f.length && rt(c, f);
  }), n ? Xe(n, i, r) : te;
};
function ct(e, n) {
  const o = {
    ...e
  };
  for (const i in n) {
    const t = n[i], r = typeof t;
    i in he ? (t === null || t && (r === "string" || r === "number")) && (o[i] = t) : r === typeof o[i] && (o[i] = i === "rotate" ? t % 4 : t);
  }
  return o;
}
const lt = /[\s,]+/;
function ft(e, n) {
  n.split(lt).forEach((o) => {
    switch (o.trim()) {
      case "horizontal":
        e.hFlip = !0;
        break;
      case "vertical":
        e.vFlip = !0;
        break;
    }
  });
}
function ut(e, n = 0) {
  const o = e.replace(/^-?[0-9.]*/, "");
  function i(t) {
    for (; t < 0; )
      t += 4;
    return t % 4;
  }
  if (o === "") {
    const t = parseInt(e);
    return isNaN(t) ? 0 : i(t);
  } else if (o !== e) {
    let t = 0;
    switch (o) {
      case "%":
        t = 25;
        break;
      case "deg":
        t = 90;
    }
    if (t) {
      let r = parseFloat(e.slice(0, e.length - o.length));
      return isNaN(r) ? 0 : (r = r / t, r % 1 === 0 ? i(r) : 0);
    }
  }
  return n;
}
function at(e, n) {
  let o = e.indexOf("xlink:") === -1 ? "" : ' xmlns:xlink="http://www.w3.org/1999/xlink"';
  for (const i in n)
    o += " " + i + '="' + n[i] + '"';
  return '<svg xmlns="http://www.w3.org/2000/svg"' + o + ">" + e + "</svg>";
}
function dt(e) {
  return e.replace(/"/g, "'").replace(/%/g, "%25").replace(/#/g, "%23").replace(/</g, "%3C").replace(/>/g, "%3E").replace(/\s+/g, " ");
}
function ht(e) {
  return "data:image/svg+xml," + dt(e);
}
function pt(e) {
  return 'url("' + ht(e) + '")';
}
let j;
function gt() {
  try {
    j = window.trustedTypes.createPolicy("iconify", {
      // eslint-disable-next-line @typescript-eslint/no-unsafe-return
      createHTML: (e) => e
    });
  } catch {
    j = null;
  }
}
function mt(e) {
  return j === void 0 && gt(), j ? j.createHTML(e) : e;
}
const ye = {
  ...pe,
  inline: !1
}, yt = {
  xmlns: "http://www.w3.org/2000/svg",
  xmlnsXlink: "http://www.w3.org/1999/xlink",
  "aria-hidden": !0,
  role: "img"
}, xt = {
  display: "inline-block"
}, z = {
  backgroundColor: "currentColor"
}, xe = {
  backgroundColor: "transparent"
}, oe = {
  Image: "var(--svg)",
  Repeat: "no-repeat",
  Size: "100% 100%"
}, ie = {
  WebkitMask: z,
  mask: z,
  background: xe
};
for (const e in ie) {
  const n = ie[e];
  for (const o in oe)
    n[e + o] = oe[o];
}
const bt = {
  ...ye,
  inline: !0
};
function re(e) {
  return e + (e.match(/^[-0-9.]+$/) ? "px" : "");
}
const It = (e, n, o) => {
  const i = n.inline ? bt : ye, t = ct(i, n), r = n.mode || "svg", s = {}, l = n.style || {}, c = {
    ...r === "svg" ? yt : {}
  };
  if (o) {
    const a = M(o, !1, !0);
    if (a) {
      const h = ["iconify"], v = [
        "provider",
        "prefix"
      ];
      for (const b of v)
        a[b] && h.push("iconify--" + a[b]);
      c.className = h.join(" ");
    }
  }
  for (let a in n) {
    const h = n[a];
    if (h !== void 0)
      switch (a) {
        case "icon":
        case "style":
        case "children":
        case "onLoad":
        case "mode":
        case "ssr":
          break;
        case "_ref":
          c.ref = h;
          break;
        case "className":
          c[a] = (c[a] ? c[a] + " " : "") + h;
          break;
        case "inline":
        case "hFlip":
        case "vFlip":
          t[a] = h === !0 || h === "true" || h === 1;
          break;
        case "flip":
          typeof h == "string" && ft(t, h);
          break;
        case "color":
          s.color = h;
          break;
        case "rotate":
          typeof h == "string" ? t[a] = ut(h) : typeof h == "number" && (t[a] = h);
          break;
        case "ariaHidden":
        case "aria-hidden":
          h !== !0 && h !== "true" && delete c["aria-hidden"];
          break;
        default:
          i[a] === void 0 && (c[a] = h);
      }
  }
  const f = Me(e, t), u = f.attributes;
  if (t.inline && (s.verticalAlign = "-0.125em"), r === "svg") {
    c.style = {
      ...s,
      ...l
    }, Object.assign(c, u);
    let a = 0, h = n.id;
    return typeof h == "string" && (h = h.replace(/-/g, "_")), c.dangerouslySetInnerHTML = {
      __html: mt(_e(f.body, h ? () => h + "ID" + a++ : "iconifyReact"))
    }, H("svg", c);
  }
  const { body: d, width: p, height: g } = e, y = r === "mask" || (r === "bg" ? !1 : d.indexOf("currentColor") !== -1), x = at(d, {
    ...u,
    width: p + "",
    height: g + ""
  });
  return c.style = {
    ...s,
    "--svg": pt(x),
    width: re(u.width),
    height: re(u.height),
    ...xt,
    ...y ? z : xe,
    ...l
  }, H("span", c);
};
de(!0);
He("", Be);
if (typeof document < "u" && typeof window < "u") {
  const e = window;
  if (e.IconifyPreload !== void 0) {
    const n = e.IconifyPreload, o = "Invalid IconifyPreload syntax.";
    typeof n == "object" && n !== null && (n instanceof Array ? n : [n]).forEach((i) => {
      try {
        // Check if item is an object and not null/array
        (typeof i != "object" || i === null || i instanceof Array || // Check for 'icons' and 'prefix'
        typeof i.icons != "object" || typeof i.prefix != "string" || // Add icon set
        !Ce(i)) && console.error(o);
      } catch {
        console.error(o);
      }
    });
  }
  if (e.IconifyProviders !== void 0) {
    const n = e.IconifyProviders;
    if (typeof n == "object" && n !== null)
      for (let o in n) {
        const i = "IconifyProviders[" + o + "] is invalid.";
        try {
          const t = n[o];
          if (typeof t != "object" || !t || t.resources === void 0)
            continue;
          Qe(o, t) || console.error(i);
        } catch {
          console.error(i);
        }
      }
  }
}
function be(e) {
  const [n, o] = R(!!e.ssr), [i, t] = R({});
  function r(g) {
    if (g) {
      const y = e.icon;
      if (typeof y == "object")
        return {
          name: "",
          data: y
        };
      const x = X(y);
      if (x)
        return {
          name: y,
          data: x
        };
    }
    return {
      name: ""
    };
  }
  const [s, l] = R(r(!!e.ssr));
  function c() {
    const g = i.callback;
    g && (g(), t({}));
  }
  function f(g) {
    if (JSON.stringify(s) !== JSON.stringify(g))
      return c(), l(g), !0;
  }
  function u() {
    var g;
    const y = e.icon;
    if (typeof y == "object") {
      f({
        name: "",
        data: y
      });
      return;
    }
    const x = X(y);
    if (f({
      name: y,
      data: x
    }))
      if (x === void 0) {
        const a = st([y], u);
        t({
          callback: a
        });
      } else x && ((g = e.onLoad) === null || g === void 0 || g.call(e, y));
  }
  W(() => (o(!0), c), []), W(() => {
    n && u();
  }, [e.icon, n]);
  const { name: d, data: p } = s;
  return p ? It({
    ...$,
    ...p
  }, e, d) : e.children ? e.children : e.fallback ? e.fallback : H("span", {});
}
const vt = se((e, n) => be({
  ...e,
  _ref: n
})), kt = se((e, n) => be({
  inline: !0,
  ...e,
  _ref: n
}));
export {
  kt as I,
  vt as a
};
//# sourceMappingURL=iconify.G_DkEANe.js.map
