import { emojiPattern as d } from "regex-combined-emojis";
import j from "emoji-toolkit/emoji_strategy.json";
const g = new RegExp(d, "g"), E = "9.0", f = "https://cdn.jsdelivr.net/joypixels/assets/" + E + "/png/unicode/32/";
let h = null, y = f, S = ".png", p = f, P = ".png";
const c = j, x = new RegExp("(^| |(?<=:))(:\\w+:)", "g");
function A() {
  return c;
}
function T(t, e = ".png") {
  t.endsWith("/") || (t = t + "/"), y = t, S = e;
}
function q(t, e = ".svg") {
  t.endsWith("/") || (t = t + "/"), p = t, P = e;
}
function J(t) {
  h = t;
}
function L(t) {
  C(t);
}
function C(t) {
  const e = ["extension", "custom"], n = [
    "name",
    "category",
    "shortname",
    "extension",
    "custom"
  ], o = (s, i, r) => {
    if (s[i] === void 0) {
      if (!e.includes(i))
        return;
      s[i] = r;
    } else
      Array.isArray(s[i]) ? s[i] = s[i].concat(r) : s[i] = r;
  };
  Object.entries(t).forEach((s) => {
    const [i, r] = s;
    if (i in c) {
      const u = c[i];
      for (const m in r) {
        const a = r[m];
        o(u, m, a);
      }
    } else
      n.every((m) => r[m] !== void 0) ? c[i] = r : console.error(
        "The following custom emoji doesn't contain the required properties:",
        r
      );
  });
}
function l(t) {
  function e(o, s) {
    if (!(!o || typeof o != "object")) {
      if ("shortname" in o && (o.shortname === t || o.shortname_alternates.includes(t)))
        return o.key = s, n = o, !0;
      Object.keys(o).some(function(i) {
        return e(o[i], i);
      });
    }
  }
  let n;
  return e(A(), null), n;
}
function U(t) {
  let e = "";
  for (const n of t) {
    const o = n.codePointAt(0).toString(16).padStart(4, "0");
    ["200d", "fe0f"].includes(o) || (e !== "" && (e = e + "-"), e = e + o);
  }
  return e;
}
function W(t) {
  const e = t.split("-");
  let n = "";
  return e.forEach((o) => {
    n = n + String.fromCodePoint(parseInt(o, 16));
  }), n;
}
function _(t) {
  if (t = t == null ? void 0 : t.trim(), t.startsWith(":") && t.endsWith(":"))
    return l(t);
  {
    const e = U(t), n = c[e];
    return n && (n.key = e), n;
  }
}
function b(t) {
  const e = (t.match(x) || []).map((n) => n.trim());
  return v(e);
}
function v(t) {
  const e = t ? t.filter((n) => l(n)) : [];
  return new Set(e);
}
function k(t) {
  const e = [...t.matchAll(g)], n = e.length ? e.map((o) => o[0]) : [];
  return new Set(n);
}
export {
  _ as codeToEmojiData,
  h as customEmojiAssetUrl,
  f as defaultEmojiAssetUrl,
  P as emojiFileExtensionLarge,
  S as emojiFileExtensionSmall,
  p as emojiImageUrlLarge,
  y as emojiImageUrlSmall,
  c as emojiJson,
  g as emojiRegex,
  x as emojiShortCodeRegex,
  E as emojiVersion,
  v as filterValidShortCodes,
  k as findEmojis,
  b as findShortCodes,
  A as getEmojiData,
  L as setCustomEmojiJson,
  J as setCustomEmojiUrl,
  q as setEmojiAssetUrlLarge,
  T as setEmojiAssetUrlSmall,
  l as shortcodeToEmojiData,
  W as stringToUnicode,
  U as unicodeToString,
  C as validateCustomEmojiJson
};
//# sourceMappingURL=index.js.map
