@tixyel/streamelements 3.7.0 → 3.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- const X = [
1
+ const Q = [
2
2
  "https://static-cdn.jtvnw.net/user-default-pictures-uv/13e5fa74-defa-11e9-809c-784f43822e80-profile_image-300x300.png",
3
3
  "https://static-cdn.jtvnw.net/user-default-pictures-uv/dbdc9198-def8-11e9-8681-784f43822e80-profile_image-300x300.png",
4
4
  "https://static-cdn.jtvnw.net/user-default-pictures-uv/998f01ae-def8-11e9-b95c-784f43822e80-profile_image-300x300.png",
@@ -6,7 +6,7 @@ const X = [
6
6
  "https://static-cdn.jtvnw.net/user-default-pictures-uv/ebe4cd89-b4f4-4cd9-adac-2f30151b4209-profile_image-300x300.png",
7
7
  "https://static-cdn.jtvnw.net/user-default-pictures-uv/215b7342-def9-11e9-9a66-784f43822e80-profile_image-300x300.png",
8
8
  "https://static-cdn.jtvnw.net/user-default-pictures-uv/ead5c8b2-a4c9-4724-b1dd-9f00b46cbd3d-profile_image-300x300.png"
9
- ], Q = {
9
+ ], Z = {
10
10
  "100 bits": {
11
11
  type: "100 bits",
12
12
  version: "1",
@@ -97,7 +97,7 @@ const X = [
97
97
  url: "https://static-cdn.jtvnw.net/badges/v1/b817aba4-fad8-49e2-b88a-7cc744dfa6ec/3",
98
98
  description: "VIP"
99
99
  }
100
- }, Z = Object.values([
100
+ }, $ = Object.values([
101
101
  {
102
102
  type: "twitch",
103
103
  name: "TheIlluminati",
@@ -1448,13 +1448,13 @@ const X = [
1448
1448
  }
1449
1449
  }
1450
1450
  ]).reduce(
1451
- (s, a) => (s.some((n) => n.name === a.name) || s.push({
1452
- ...a,
1451
+ (e, s) => (e.some((i) => i.name === s.name) || e.push({
1452
+ ...s,
1453
1453
  start: 0,
1454
1454
  end: 0
1455
- }), s),
1455
+ }), e),
1456
1456
  []
1457
- ), $ = [
1457
+ ), tt = [
1458
1458
  "Hello everyone!",
1459
1459
  "PogChamp",
1460
1460
  "This stream is amazing!",
@@ -1505,7 +1505,7 @@ const X = [
1505
1505
  "BloodTrail hunting time",
1506
1506
  "CatBag kitty!",
1507
1507
  "c! poggers"
1508
- ], tt = ["Local", "Tixyel", "Urie_s2", "itzzcatt", "BeniArts", "Cupidiko", "shy_madeit"], et = [
1508
+ ], et = ["Local", "Tixyel", "Urie_s2", "itzzcatt", "BeniArts", "Cupidiko", "shy_madeit"], st = [
1509
1509
  "Filiz",
1510
1510
  "Astrid",
1511
1511
  "Tatyana",
@@ -1593,7 +1593,7 @@ const X = [
1593
1593
  "Szabolcs",
1594
1594
  "Hoda",
1595
1595
  "Naayf"
1596
- ], st = [], at = ["1000", "2000", "3000", "prime"], it = [
1596
+ ], at = [], it = ["1000", "2000", "3000", "prime"], nt = [
1597
1597
  "aliceblue",
1598
1598
  "antiquewhite",
1599
1599
  "aqua",
@@ -1743,7 +1743,7 @@ const X = [
1743
1743
  "yellow",
1744
1744
  "yellowgreen",
1745
1745
  "transparent"
1746
- ], nt = [
1746
+ ], rt = [
1747
1747
  {
1748
1748
  emojiId: "UCkszU2WH9gy1mb0dV-11UJg/flower-rainbow-heart-red",
1749
1749
  shortcuts: [":pride-flower-rainbow-heart:"],
@@ -4917,164 +4917,164 @@ const X = [
4917
4917
  index: 121
4918
4918
  }
4919
4919
  ];
4920
- var R;
4921
- ((s) => {
4922
- let a;
4923
- ((t) => {
4924
- ((e) => {
4925
- e.hehim = "He/Him", e.sheher = "She/Her", e.theythem = "They/Them", e.shethem = "She/They", e.hethem = "He/They", e.heshe = "He/She", e.xexem = "Xe/Xem", e.faefaer = "Fae/Faer", e.vever = "Ve/Ver", e.aeaer = "Ae/Aer", e.ziehir = "Zie/Hir", e.perper = "Per/Per", e.eem = "E/Em", e.itits = "It/Its";
4926
- })(t.map || (t.map = {}));
4927
- })(a = s.Pronouns || (s.Pronouns = {}));
4928
- async function n() {
4920
+ var O;
4921
+ ((e) => {
4922
+ let s;
4923
+ ((o) => {
4924
+ ((t) => {
4925
+ t.hehim = "He/Him", t.sheher = "She/Her", t.theythem = "They/Them", t.shethem = "She/They", t.hethem = "He/They", t.heshe = "He/She", t.xexem = "Xe/Xem", t.faefaer = "Fae/Faer", t.vever = "Ve/Ver", t.aeaer = "Ae/Aer", t.ziehir = "Zie/Hir", t.perper = "Per/Per", t.eem = "E/Em", t.itits = "It/Its";
4926
+ })(o.map || (o.map = {}));
4927
+ })(s = e.Pronouns || (e.Pronouns = {}));
4928
+ async function i() {
4929
4929
  try {
4930
- const t = await fetch("https://pronouns.alejo.io/api/pronouns").then((e) => e.json());
4931
- if (Array.isArray(t) && t.length) {
4932
- const e = Object.fromEntries(t.map(({ name: i, display: r }) => [i, r]));
4933
- return { ...a.map, ...e };
4930
+ const o = await fetch("https://pronouns.alejo.io/api/pronouns").then((t) => t.json());
4931
+ if (Array.isArray(o) && o.length) {
4932
+ const t = Object.fromEntries(o.map(({ name: a, display: n }) => [a, n]));
4933
+ return { ...s.map, ...t };
4934
4934
  }
4935
4935
  } catch {
4936
4936
  }
4937
- return { ...a.map };
4937
+ return { ...s.map };
4938
4938
  }
4939
- s.list = n;
4940
- async function o(t) {
4941
- if (!t) throw new Error("Username is required to fetch Alejo data.");
4942
- if (t = t.toLowerCase(), t in client.storage.data.pronoun && client.storage.data.pronoun[t].expire > Date.now())
4943
- return client.storage.data.pronoun[t].value;
4939
+ e.list = i;
4940
+ async function d(o) {
4941
+ if (!o) throw new Error("Username is required to fetch Alejo data.");
4942
+ if (o = o.toLowerCase(), o in client.storage.data.pronoun && client.storage.data.pronoun[o].expire > Date.now())
4943
+ return client.storage.data.pronoun[o].value;
4944
4944
  try {
4945
- const e = await fetch(`https://pronouns.alejo.io/api/users/${t}`).then((i) => i.json()).then(([i]) => i);
4946
- if (e)
4947
- return client.storage.add(`pronoun.${t}`, {
4948
- value: e.pronoun_id,
4945
+ const t = await fetch(`https://pronouns.alejo.io/api/users/${o}`).then((a) => a.json()).then(([a]) => a);
4946
+ if (t)
4947
+ return client.storage.add(`pronoun.${o}`, {
4948
+ value: t.pronoun_id,
4949
4949
  timestamp: Date.now(),
4950
4950
  expire: Date.now() + client.cache.pronoun * 60 * 1e3
4951
- }), client.storage.data.pronoun[t].value ?? e.pronoun_id;
4952
- } catch (e) {
4953
- throw new Error(`Failed to fetch pronoun data for user "${t}": ${e instanceof Error ? e.message : e}`);
4951
+ }), client.storage.data.pronoun[o].value ?? t.pronoun_id;
4952
+ } catch (t) {
4953
+ throw new Error(`Failed to fetch pronoun data for user "${o}": ${t instanceof Error ? t.message : t}`);
4954
4954
  }
4955
4955
  }
4956
- s.get = o;
4957
- })(R || (R = {}));
4958
- function rt(s, a) {
4959
- if (!a) return null;
4960
- switch (a) {
4956
+ e.get = d;
4957
+ })(O || (O = {}));
4958
+ function ct(e, s) {
4959
+ if (!s) return null;
4960
+ switch (s) {
4961
4961
  case "hex": {
4962
- const n = s.replace("#", "");
4963
- let o = 0, t = 0, e = 0, i = 1;
4964
- return n.length === 3 ? (o = parseInt(n[0] + n[0], 16), t = parseInt(n[1] + n[1], 16), e = parseInt(n[2] + n[2], 16)) : n.length === 6 ? (o = parseInt(n.slice(0, 2), 16), t = parseInt(n.slice(2, 4), 16), e = parseInt(n.slice(4, 6), 16)) : n.length === 4 ? (o = parseInt(n[0] + n[0], 16), t = parseInt(n[1] + n[1], 16), e = parseInt(n[2] + n[2], 16), i = parseInt(n[3] + n[3], 16) / 255) : n.length === 8 && (o = parseInt(n.slice(0, 2), 16), t = parseInt(n.slice(2, 4), 16), e = parseInt(n.slice(4, 6), 16), i = parseInt(n.slice(6, 8), 16) / 255), { r: o, g: t, b: e, a: i };
4962
+ const i = e.replace("#", "");
4963
+ let d = 0, o = 0, t = 0, a = 1;
4964
+ return i.length === 3 ? (d = parseInt(i[0] + i[0], 16), o = parseInt(i[1] + i[1], 16), t = parseInt(i[2] + i[2], 16)) : i.length === 6 ? (d = parseInt(i.slice(0, 2), 16), o = parseInt(i.slice(2, 4), 16), t = parseInt(i.slice(4, 6), 16)) : i.length === 4 ? (d = parseInt(i[0] + i[0], 16), o = parseInt(i[1] + i[1], 16), t = parseInt(i[2] + i[2], 16), a = parseInt(i[3] + i[3], 16) / 255) : i.length === 8 && (d = parseInt(i.slice(0, 2), 16), o = parseInt(i.slice(2, 4), 16), t = parseInt(i.slice(4, 6), 16), a = parseInt(i.slice(6, 8), 16) / 255), { r: d, g: o, b: t, a };
4965
4965
  }
4966
4966
  case "rgb":
4967
4967
  case "rgba": {
4968
- const n = s.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/);
4969
- return n ? {
4970
- r: parseInt(n[1]),
4971
- g: parseInt(n[2]),
4972
- b: parseInt(n[3]),
4973
- a: n[4] ? parseFloat(n[4]) : 1
4968
+ const i = e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/);
4969
+ return i ? {
4970
+ r: parseInt(i[1]),
4971
+ g: parseInt(i[2]),
4972
+ b: parseInt(i[3]),
4973
+ a: i[4] ? parseFloat(i[4]) : 1
4974
4974
  } : null;
4975
4975
  }
4976
4976
  case "hsl":
4977
4977
  case "hsla": {
4978
- const n = s.match(/hsla?\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%(?:\s*,\s*([\d.]+))?\s*\)/);
4979
- if (!n) return null;
4980
- const o = parseInt(n[1]), t = parseInt(n[2]), e = parseInt(n[3]), i = n[4] ? parseFloat(n[4]) : 1;
4981
- return { ...ot(o, t, e), a: i };
4978
+ const i = e.match(/hsla?\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%(?:\s*,\s*([\d.]+))?\s*\)/);
4979
+ if (!i) return null;
4980
+ const d = parseInt(i[1]), o = parseInt(i[2]), t = parseInt(i[3]), a = i[4] ? parseFloat(i[4]) : 1;
4981
+ return { ...dt(d, o, t), a };
4982
4982
  }
4983
4983
  case "css-color-name": {
4984
- const n = document.createElement("canvas");
4985
- n.width = n.height = 1;
4986
- const o = n.getContext("2d");
4987
- if (!o) return null;
4988
- o.fillStyle = s, o.fillRect(0, 0, 1, 1);
4989
- const [t, e, i] = o.getImageData(0, 0, 1, 1).data;
4990
- return { r: t, g: e, b: i, a: 1 };
4984
+ const i = document.createElement("canvas");
4985
+ i.width = i.height = 1;
4986
+ const d = i.getContext("2d");
4987
+ if (!d) return null;
4988
+ d.fillStyle = e, d.fillRect(0, 0, 1, 1);
4989
+ const [o, t, a] = d.getImageData(0, 0, 1, 1).data;
4990
+ return { r: o, g: t, b: a, a: 1 };
4991
4991
  }
4992
4992
  default:
4993
4993
  return null;
4994
4994
  }
4995
4995
  }
4996
- function ct(s, a = !0) {
4997
- const n = (t) => Math.round(t).toString(16).padStart(2, "0");
4998
- let o = `#${n(s.r)}${n(s.g)}${n(s.b)}`;
4999
- return a && s.a < 1 && (o += n(s.a * 255)), o;
4996
+ function ot(e, s = !0) {
4997
+ const i = (o) => Math.round(o).toString(16).padStart(2, "0");
4998
+ let d = `#${i(e.r)}${i(e.g)}${i(e.b)}`;
4999
+ return s && e.a < 1 && (d += i(e.a * 255)), d;
5000
5000
  }
5001
- function F(s, a, n) {
5002
- s /= 255, a /= 255, n /= 255;
5003
- const o = Math.max(s, a, n), t = Math.min(s, a, n), e = o - t;
5004
- let i = 0, r = 0;
5005
- const d = (o + t) / 2;
5006
- if (e !== 0)
5007
- switch (r = d > 0.5 ? e / (2 - o - t) : e / (o + t), o) {
5008
- case s:
5009
- i = ((a - n) / e + (a < n ? 6 : 0)) / 6;
5001
+ function B(e, s, i) {
5002
+ e /= 255, s /= 255, i /= 255;
5003
+ const d = Math.max(e, s, i), o = Math.min(e, s, i), t = d - o;
5004
+ let a = 0, n = 0;
5005
+ const r = (d + o) / 2;
5006
+ if (t !== 0)
5007
+ switch (n = r > 0.5 ? t / (2 - d - o) : t / (d + o), d) {
5008
+ case e:
5009
+ a = ((s - i) / t + (s < i ? 6 : 0)) / 6;
5010
5010
  break;
5011
- case a:
5012
- i = ((n - s) / e + 2) / 6;
5011
+ case s:
5012
+ a = ((i - e) / t + 2) / 6;
5013
5013
  break;
5014
- case n:
5015
- i = ((s - a) / e + 4) / 6;
5014
+ case i:
5015
+ a = ((e - s) / t + 4) / 6;
5016
5016
  break;
5017
5017
  }
5018
5018
  return {
5019
- h: Math.round(i * 360),
5020
- s: Math.round(r * 100),
5021
- l: Math.round(d * 100)
5019
+ h: Math.round(a * 360),
5020
+ s: Math.round(n * 100),
5021
+ l: Math.round(r * 100)
5022
5022
  };
5023
5023
  }
5024
- function ot(s, a, n) {
5025
- s /= 360, a /= 100, n /= 100;
5026
- let o, t, e;
5027
- if (a === 0)
5028
- o = t = e = n;
5024
+ function dt(e, s, i) {
5025
+ e /= 360, s /= 100, i /= 100;
5026
+ let d, o, t;
5027
+ if (s === 0)
5028
+ d = o = t = i;
5029
5029
  else {
5030
- const i = (u, h, m) => (m < 0 && (m += 1), m > 1 && (m -= 1), m < 0.16666666666666666 ? u + (h - u) * 6 * m : m < 0.5 ? h : m < 0.6666666666666666 ? u + (h - u) * (0.6666666666666666 - m) * 6 : u), r = n < 0.5 ? n * (1 + a) : n + a - n * a, d = 2 * n - r;
5031
- o = i(d, r, s + 1 / 3), t = i(d, r, s), e = i(d, r, s - 1 / 3);
5030
+ const a = (h, u, l) => (l < 0 && (l += 1), l > 1 && (l -= 1), l < 0.16666666666666666 ? h + (u - h) * 6 * l : l < 0.5 ? u : l < 0.6666666666666666 ? h + (u - h) * (0.6666666666666666 - l) * 6 : h), n = i < 0.5 ? i * (1 + s) : i + s - i * s, r = 2 * i - n;
5031
+ d = a(r, n, e + 1 / 3), o = a(r, n, e), t = a(r, n, e - 1 / 3);
5032
5032
  }
5033
5033
  return {
5034
- r: Math.round(o * 255),
5035
- g: Math.round(t * 255),
5036
- b: Math.round(e * 255)
5034
+ r: Math.round(d * 255),
5035
+ g: Math.round(o * 255),
5036
+ b: Math.round(t * 255)
5037
5037
  };
5038
5038
  }
5039
- function dt(s, a, n) {
5040
- const o = T.data.css_color_names;
5041
- let t = o[0], e = 1 / 0;
5042
- for (const i of o) {
5043
- const r = document.createElement("canvas");
5044
- r.width = r.height = 1;
5045
- const d = r.getContext("2d");
5046
- if (!d) continue;
5047
- d.fillStyle = i, d.fillRect(0, 0, 1, 1);
5048
- const [u, h, m] = d.getImageData(0, 0, 1, 1).data, g = Math.sqrt(Math.pow(s - u, 2) + Math.pow(a - h, 2) + Math.pow(n - m, 2));
5049
- if (g < e && (e = g, t = i), g === 0) break;
5039
+ function ht(e, s, i) {
5040
+ const d = D.data.css_color_names;
5041
+ let o = d[0], t = 1 / 0;
5042
+ for (const a of d) {
5043
+ const n = document.createElement("canvas");
5044
+ n.width = n.height = 1;
5045
+ const r = n.getContext("2d");
5046
+ if (!r) continue;
5047
+ r.fillStyle = a, r.fillRect(0, 0, 1, 1);
5048
+ const [h, u, l] = r.getImageData(0, 0, 1, 1).data, g = Math.sqrt(Math.pow(e - h, 2) + Math.pow(s - u, 2) + Math.pow(i - l, 2));
5049
+ if (g < t && (t = g, o = a), g === 0) break;
5050
5050
  }
5051
- return t;
5051
+ return o;
5052
5052
  }
5053
- var T;
5054
- ((s) => {
5055
- s.data = {
5056
- names: tt,
5057
- messages: $,
5058
- tiers: at,
5059
- avatars: X,
5060
- emotes: Z,
5061
- youtube_emotes: nt,
5062
- badges: Q,
5063
- items: st,
5064
- tts: et,
5065
- pronouns: R.Pronouns.map,
5066
- css_color_names: it
5067
- }, s.color = {
5053
+ var D;
5054
+ ((e) => {
5055
+ e.data = {
5056
+ names: et,
5057
+ messages: tt,
5058
+ tiers: it,
5059
+ avatars: Q,
5060
+ emotes: $,
5061
+ youtube_emotes: rt,
5062
+ badges: Z,
5063
+ items: at,
5064
+ tts: st,
5065
+ pronouns: O.Pronouns.map,
5066
+ css_color_names: nt
5067
+ }, e.color = {
5068
5068
  /**
5069
5069
  * Generate opacity hex value
5070
5070
  * @param opacity - Opacity value from 0 to 100
5071
5071
  * @param color - Hex color code
5072
5072
  * @returns - Hex color code with opacity
5073
5073
  */
5074
- opacity(t = 100, e = "") {
5075
- e = e.length > 7 ? e?.substring(0, 6) : e, t = t > 1 ? t / 100 : t;
5076
- let i = Math.round(Math.min(Math.max(t, 0), 1) * 255).toString(16).toLowerCase().padStart(2, "0");
5077
- return e + i;
5074
+ opacity(t = 100, a = "") {
5075
+ a = a.length > 7 ? a?.substring(0, 6) : a, t = t > 1 ? t / 100 : t;
5076
+ let n = Math.round(Math.min(Math.max(t, 0), 1) * 255).toString(16).toLowerCase().padStart(2, "0");
5077
+ return a + n;
5078
5078
  },
5079
5079
  /**
5080
5080
  * Extract color and opacity from hex code
@@ -5087,16 +5087,16 @@ var T;
5087
5087
  color: t,
5088
5088
  opacity: 100
5089
5089
  };
5090
- var r = t.slice(-2), e = parseInt(r, 16) / 255, i = Math.round(e * 100), r = t.length > 7 ? t.slice(0, 7) : t;
5090
+ var r = t.slice(-2), a = parseInt(r, 16) / 255, n = Math.round(a * 100), r = t.length > 7 ? t.slice(0, 7) : t;
5091
5091
  return {
5092
5092
  color: r,
5093
- opacity: i
5093
+ opacity: n
5094
5094
  };
5095
5095
  },
5096
5096
  validate(t) {
5097
5097
  if (typeof t != "string" || !String(t).trim().length) return !1;
5098
- const e = t.trim();
5099
- return /^#([A-Fa-f0-9]{3}){1,2}$/.test(e) || /^#([A-Fa-f0-9]{4}|[A-Fa-f0-9]{8})$/.test(e) ? "hex" : /^rgb\(\s*(?:\d{1,3}\s*,\s*){2}\d{1,3}\s*\)$/.test(e) ? "rgb" : /^rgba\(\s*(?:\d{1,3}\s*,\s*){3}(?:0|1|0?\.\d+)\s*\)$/.test(e) ? "rgba" : /^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/.test(e) ? "hsl" : /^hsla\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*,\s*(?:0|1|0?\.\d+)\s*\)$/.test(e) ? "hsla" : s.data.css_color_names.includes(e.toLowerCase()) ? "css-color-name" : !1;
5098
+ const a = t.trim();
5099
+ return /^#([A-Fa-f0-9]{3}){1,2}$/.test(a) || /^#([A-Fa-f0-9]{4}|[A-Fa-f0-9]{8})$/.test(a) ? "hex" : /^rgb\(\s*(?:\d{1,3}\s*,\s*){2}\d{1,3}\s*\)$/.test(a) ? "rgb" : /^rgba\(\s*(?:\d{1,3}\s*,\s*){3}(?:0|1|0?\.\d+)\s*\)$/.test(a) ? "rgba" : /^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/.test(a) ? "hsl" : /^hsla\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*,\s*(?:0|1|0?\.\d+)\s*\)$/.test(a) ? "hsla" : e.data.css_color_names.includes(a.toLowerCase()) ? "css-color-name" : !1;
5100
5100
  },
5101
5101
  /**
5102
5102
  * Convert color to different format
@@ -5111,37 +5111,37 @@ var T;
5111
5111
  * const colorName = Simulation.color.convert("#FF5733", "css-color-name"); // "orangered"
5112
5112
  * ```
5113
5113
  */
5114
- convert(t, e) {
5115
- const i = this.validate(t);
5116
- if (!i)
5114
+ convert(t, a) {
5115
+ const n = this.validate(t);
5116
+ if (!n)
5117
5117
  throw new Error(`Invalid color format: ${t}`);
5118
- if (i === e)
5119
- throw new Error(`Color is already in the desired format: ${e}`);
5120
- const r = rt(t.trim(), i);
5118
+ if (n === a)
5119
+ throw new Error(`Color is already in the desired format: ${a}`);
5120
+ const r = ct(t.trim(), n);
5121
5121
  if (!r)
5122
5122
  throw new Error(`Failed to parse color: ${t}`);
5123
- switch (e) {
5123
+ switch (a) {
5124
5124
  case "hex":
5125
- return ct(r, !1);
5125
+ return ot(r, !1);
5126
5126
  case "rgb":
5127
5127
  return `rgb(${r.r}, ${r.g}, ${r.b})`;
5128
5128
  case "rgba":
5129
5129
  return `rgba(${r.r}, ${r.g}, ${r.b}, ${r.a})`;
5130
5130
  case "hsl": {
5131
- const d = F(r.r, r.g, r.b);
5132
- return `hsl(${d.h}, ${d.s}%, ${d.l}%)`;
5131
+ const h = B(r.r, r.g, r.b);
5132
+ return `hsl(${h.h}, ${h.s}%, ${h.l}%)`;
5133
5133
  }
5134
5134
  case "hsla": {
5135
- const d = F(r.r, r.g, r.b);
5136
- return `hsla(${d.h}, ${d.s}%, ${d.l}%, ${r.a})`;
5135
+ const h = B(r.r, r.g, r.b);
5136
+ return `hsla(${h.h}, ${h.s}%, ${h.l}%, ${r.a})`;
5137
5137
  }
5138
5138
  case "css-color-name":
5139
- return dt(r.r, r.g, r.b);
5139
+ return ht(r.r, r.g, r.b);
5140
5140
  default:
5141
5141
  return null;
5142
5142
  }
5143
5143
  }
5144
- }, s.rand = {
5144
+ }, e.rand = {
5145
5145
  /**
5146
5146
  * Generate random color
5147
5147
  * @param type - Color format
@@ -5161,28 +5161,28 @@ var T;
5161
5161
  case "hex":
5162
5162
  return `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")}`;
5163
5163
  case "hexa": {
5164
- const i = `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")}`, r = Math.floor(Math.random() * 256).toString(16).padStart(2, "0");
5165
- return i + r;
5164
+ const n = `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")}`, r = Math.floor(Math.random() * 256).toString(16).padStart(2, "0");
5165
+ return n + r;
5166
5166
  }
5167
5167
  case "rgb": {
5168
- const i = Math.floor(Math.random() * 256), r = Math.floor(Math.random() * 256), d = Math.floor(Math.random() * 256);
5169
- return `rgb(${i}, ${r}, ${d})`;
5168
+ const n = Math.floor(Math.random() * 256), r = Math.floor(Math.random() * 256), h = Math.floor(Math.random() * 256);
5169
+ return `rgb(${n}, ${r}, ${h})`;
5170
5170
  }
5171
5171
  case "rgba": {
5172
- const i = Math.floor(Math.random() * 256), r = Math.floor(Math.random() * 256), d = Math.floor(Math.random() * 256), u = Math.random().toFixed(2);
5173
- return `rgba(${i}, ${r}, ${d}, ${u})`;
5172
+ const n = Math.floor(Math.random() * 256), r = Math.floor(Math.random() * 256), h = Math.floor(Math.random() * 256), u = Math.random().toFixed(2);
5173
+ return `rgba(${n}, ${r}, ${h}, ${u})`;
5174
5174
  }
5175
5175
  case "hsl": {
5176
- const i = Math.floor(Math.random() * 361), r = Math.floor(Math.random() * 101), d = Math.floor(Math.random() * 101);
5177
- return `hsl(${i}, ${r}%, ${d}%)`;
5176
+ const n = Math.floor(Math.random() * 361), r = Math.floor(Math.random() * 101), h = Math.floor(Math.random() * 101);
5177
+ return `hsl(${n}, ${r}%, ${h}%)`;
5178
5178
  }
5179
5179
  case "hsla": {
5180
- const i = Math.floor(Math.random() * 361), r = Math.floor(Math.random() * 101), d = Math.floor(Math.random() * 101), u = Math.random().toFixed(2);
5181
- return `hsla(${i}, ${r}%, ${d}%, ${u})`;
5180
+ const n = Math.floor(Math.random() * 361), r = Math.floor(Math.random() * 101), h = Math.floor(Math.random() * 101), u = Math.random().toFixed(2);
5181
+ return `hsla(${n}, ${r}%, ${h}%, ${u})`;
5182
5182
  }
5183
5183
  case "css-color-name": {
5184
- var e = s.data.css_color_names;
5185
- return this.array(e)[0];
5184
+ var a = e.data.css_color_names;
5185
+ return this.array(a)[0];
5186
5186
  }
5187
5187
  }
5188
5188
  },
@@ -5201,10 +5201,10 @@ var T;
5201
5201
  * console.log(floatNumber); // e.g. 3.14
5202
5202
  * ```
5203
5203
  */
5204
- number(t, e, i = 0) {
5205
- t > e && ([t, e] = [e, t]);
5206
- const r = Math.random() * (e - t) + t;
5207
- return i ? Number(r.toFixed(i)) : Math.round(r);
5204
+ number(t, a, n = 0) {
5205
+ t > a && ([t, a] = [a, t]);
5206
+ const r = Math.random() * (a - t) + t;
5207
+ return n ? Number(r.toFixed(n)) : Math.round(r);
5208
5208
  },
5209
5209
  /**
5210
5210
  * Generate random boolean
@@ -5230,11 +5230,11 @@ var T;
5230
5230
  * console.log(randString); // e.g. "aZ3bT9xYqP"
5231
5231
  * ```
5232
5232
  */
5233
- string(t, e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") {
5234
- let i = "";
5233
+ string(t, a = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") {
5234
+ let n = "";
5235
5235
  for (let r = 0; r < t; r++)
5236
- i += e.charAt(Math.floor(Math.random() * e.length));
5237
- return i;
5236
+ n += a.charAt(Math.floor(Math.random() * a.length));
5237
+ return n;
5238
5238
  },
5239
5239
  /**
5240
5240
  * Pick random element from array
@@ -5247,8 +5247,8 @@ var T;
5247
5247
  * ```
5248
5248
  */
5249
5249
  array(t) {
5250
- const e = this.number(0, t.length - 1);
5251
- return [t[e], e];
5250
+ const a = this.number(0, t.length - 1);
5251
+ return [t[a], a];
5252
5252
  },
5253
5253
  /**
5254
5254
  * Generate random date
@@ -5261,8 +5261,8 @@ var T;
5261
5261
  * console.log(randDate); // e.g. 2022-05-15T10:30:00.000Z
5262
5262
  * ```
5263
5263
  */
5264
- date(t = new Date(2e3, 0, 1), e = /* @__PURE__ */ new Date()) {
5265
- return new Date(this.number(t.getTime(), e.getTime()));
5264
+ date(t = new Date(2e3, 0, 1), a = /* @__PURE__ */ new Date()) {
5265
+ return new Date(this.number(t.getTime(), a.getTime()));
5266
5266
  },
5267
5267
  /**
5268
5268
  * Generate ISO date string offset by days
@@ -5278,8 +5278,8 @@ var T;
5278
5278
  * ```
5279
5279
  */
5280
5280
  daysOffset(t) {
5281
- const i = Date.now() - this.number(0, t * 24 * 60 * 60 * 1e3);
5282
- return new Date(i).toISOString();
5281
+ const n = Date.now() - this.number(0, t * 24 * 60 * 60 * 1e3);
5282
+ return new Date(n).toISOString();
5283
5283
  },
5284
5284
  /**
5285
5285
  * Generate UUID v4
@@ -5296,7 +5296,7 @@ var T;
5296
5296
  (t) => (+t ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +t / 4).toString(16)
5297
5297
  );
5298
5298
  }
5299
- }, s.string = {
5299
+ }, e.string = {
5300
5300
  /**
5301
5301
  * Replaces occurrences in a string based on a pattern with the result of an asynchronous callback function.
5302
5302
  * @param string - The input string to perform replacements on.
@@ -5311,14 +5311,14 @@ var T;
5311
5311
  * console.log(result); // Output will depend on the fetched data
5312
5312
  * ```
5313
5313
  */
5314
- async replace(t, e, i) {
5314
+ async replace(t, a, n) {
5315
5315
  const r = [];
5316
- t.replace(e, (u, ...h) => {
5317
- const m = typeof i == "function" ? i(u, ...h) : u;
5318
- return r.push(Promise.resolve(m)), u;
5316
+ t.replace(a, (u, ...l) => {
5317
+ const g = typeof n == "function" ? n(u, ...l) : u;
5318
+ return r.push(Promise.resolve(g)), u;
5319
5319
  });
5320
- const d = await Promise.all(r);
5321
- return t.replace(e, () => d.shift() ?? "");
5320
+ const h = await Promise.all(r);
5321
+ return t.replace(a, () => h.shift() ?? "");
5322
5322
  },
5323
5323
  /**
5324
5324
  * Capitalizes the first letter of a given string.
@@ -5347,31 +5347,31 @@ var T;
5347
5347
  * console.log(result); // Output: "Hello, john_doe! You have 5 MESSAGES and your name is John."
5348
5348
  * ```
5349
5349
  */
5350
- compose(t, e = {}, i = {
5350
+ compose(t, a = {}, n = {
5351
5351
  method: "index",
5352
5352
  html: !1,
5353
5353
  modifiers: {},
5354
5354
  aliases: {}
5355
5355
  }) {
5356
- const { mergeSpanStyles: r } = s.element;
5357
- e.skip = "<br/>", e.newline = "<br/>";
5358
- const d = Object.entries(s.object.flatten(e)).reduce(
5359
- (c, [l, b]) => {
5360
- if (c[l] = String(b), ["username", "name", "nick", "nickname", "sender"].some((w) => l === w)) {
5361
- const w = c?.username || c?.name || c?.nick || c?.nickname || c?.sender;
5362
- c.username = c.username || w, c.usernameAt = `@${c.username}`, c.name = c.name || w, c.nick = c.nick || w, c.nickname = c.nickname || w, c.sender = c.sender || w, c.senderAt = `@${c.sender}`;
5356
+ const { mergeSpanStyles: r } = e.element;
5357
+ a.skip = "<br/>", a.newline = "<br/>";
5358
+ const h = Object.entries(e.object.flatten(a)).reduce(
5359
+ (c, [m, b]) => {
5360
+ if (c[m] = String(b), ["username", "name", "nick", "nickname", "sender"].some((v) => m === v)) {
5361
+ const v = c?.username || c?.name || c?.nick || c?.nickname || c?.sender;
5362
+ c.username = c.username || v, c.usernameAt = `@${c.username}`, c.name = c.name || v, c.nick = c.nick || v, c.nickname = c.nickname || v, c.sender = c.sender || v, c.senderAt = `@${c.sender}`;
5363
5363
  }
5364
- return ["amount", "count"].some((w) => l === w) && (c.amount = String(h), c.count = String(c?.count || h)), c.currency = c.currency || window.client?.details.currency.symbol || "$", c.currencyCode = c.currencyCode || window.client?.details.currency.code || "USD", c;
5364
+ return ["amount", "count"].some((v) => m === v) && (c.amount = String(c?.amount || c.count || b), c.count = String(c?.count || c?.amount || b)), c.currency = c.currency || window.client?.details.currency.symbol || "$", c.currencyCode = c.currencyCode || window.client?.details.currency.code || "USD", c;
5365
5365
  },
5366
5366
  {}
5367
5367
  ), u = {
5368
5368
  PLACEHOLDERS: /{([^}]+)}/g,
5369
5369
  MODIFIERS: /\[(\w+)(:[^=]+)?=([^\]]+)\]/g
5370
5370
  };
5371
- var h = parseFloat(d?.amount ?? d?.count ?? 0);
5372
- const m = {
5373
- COLOR: (c, l) => r(l && s.color.validate(l) ? `color: ${l}` : "", c),
5374
- WEIGHT: (c, l) => r(l && !isNaN(parseInt(l)) ? `font-weight: ${l}` : "", c),
5371
+ var l = parseFloat(h?.amount ?? h?.count ?? 0);
5372
+ const g = {
5373
+ COLOR: (c, m) => r(m && e.color.validate(m) ? `color: ${m}` : "", c),
5374
+ WEIGHT: (c, m) => r(m && !isNaN(parseInt(m)) ? `font-weight: ${m}` : "", c),
5375
5375
  BOLD: (c) => r("font-weight: bold", c),
5376
5376
  LIGHT: (c) => r("font-weight: lighter", c),
5377
5377
  STRONG: (c) => r("font-weight: bolder", c),
@@ -5382,23 +5382,23 @@ var T;
5382
5382
  SUP: (c) => r("vertical-align: super", c),
5383
5383
  LARGER: (c) => r("font-size: larger", c),
5384
5384
  SMALL: (c) => r("font-size: smaller", c),
5385
- SHADOW: (c, l) => r(`text-shadow: ${l}`, c),
5386
- SIZE: (c, l) => r(l ? `font-size: ${l}` : "", c)
5387
- }, f = {
5385
+ SHADOW: (c, m) => r(`text-shadow: ${m}`, c),
5386
+ SIZE: (c, m) => r(m ? `font-size: ${m}` : "", c)
5387
+ }, y = {
5388
5388
  ...{
5389
- BT1: (c) => h > 1 ? c : "",
5390
- BT0: (c) => h > 0 ? c : "",
5391
- ST1: (c) => h < 1 ? c : "",
5392
- ST0: (c) => h < 0 ? c : "",
5389
+ BT1: (c) => l > 1 ? c : "",
5390
+ BT0: (c) => l > 0 ? c : "",
5391
+ ST1: (c) => l < 1 ? c : "",
5392
+ ST0: (c) => l < 0 ? c : "",
5393
5393
  UPC: (c) => c.toUpperCase(),
5394
5394
  LOW: (c) => c.toLowerCase(),
5395
5395
  REV: (c) => c.split("").reverse().join(""),
5396
5396
  CAP: (c) => c.charAt(0).toUpperCase() + c.slice(1).toLowerCase(),
5397
- FALLBACK: (c, l) => c.length ? c : l ?? c
5397
+ FALLBACK: (c, m) => c.length ? c : m ?? c
5398
5398
  },
5399
- ...i?.html ? m : {},
5400
- ...i.modifiers ?? {}
5401
- }, v = {
5399
+ ...n?.html ? g : {},
5400
+ ...n.modifiers ?? {}
5401
+ }, k = {
5402
5402
  UPC: ["UPPERCASE", "UPPER", "UPP"],
5403
5403
  LOW: ["LOWERCASE", "LOWER", "LWC"],
5404
5404
  REV: ["REVERSE", "RVS"],
@@ -5419,61 +5419,61 @@ var T;
5419
5419
  SMALL: ["SMALLER", "SM"],
5420
5420
  SHADOW: ["SHADOW", "SHD"],
5421
5421
  FALLBACK: ["FALLBACK", "FB"],
5422
- ...i.aliases ?? {}
5422
+ ...n.aliases ?? {}
5423
5423
  };
5424
- function C(c, l, b) {
5425
- const w = Object.entries(v).find(([k, x]) => x.some((U) => U.toUpperCase() === l.toUpperCase()) ? !0 : k.toUpperCase() === l.toUpperCase()), I = w ? w[0] : l.toUpperCase();
5426
- return f[I] ? f[I](c, typeof b == "string" ? b.trim() : null, d) : c;
5424
+ function U(c, m, b) {
5425
+ const v = Object.entries(k).find(([j, I]) => I.some((x) => x.toUpperCase() === m.toUpperCase()) ? !0 : j.toUpperCase() === m.toUpperCase()), E = v ? v[0] : m.toUpperCase();
5426
+ return y[E] ? y[E](c, typeof b == "string" ? b.trim() : null, h) : c;
5427
5427
  }
5428
- function j(c) {
5429
- let l = c, b;
5430
- for (; (b = u.MODIFIERS.exec(l)) !== null; ) {
5431
- const [w, I, k, x] = b, U = C(j(x), I, k);
5432
- l = l.replace(w, U ?? ""), u.MODIFIERS.lastIndex = 0;
5428
+ function C(c) {
5429
+ let m = c, b;
5430
+ for (; (b = u.MODIFIERS.exec(m)) !== null; ) {
5431
+ const [v, E, j, I] = b, x = U(C(I), E, j);
5432
+ m = m.replace(v, x ?? ""), u.MODIFIERS.lastIndex = 0;
5433
5433
  }
5434
- return l;
5434
+ return m;
5435
5435
  }
5436
5436
  function p(c) {
5437
- let l = 0;
5437
+ let m = 0;
5438
5438
  const b = c.length;
5439
- function w(k) {
5440
- let x = "";
5441
- for (; l < b; )
5442
- if (c[l] === "\\")
5443
- l + 1 < b ? (x += c[l + 1], l += 2) : l++;
5444
- else if (c[l] === "[" && (!k || k !== "["))
5445
- x += I();
5446
- else if (k && c[l] === k) {
5447
- l++;
5439
+ function v(j) {
5440
+ let I = "";
5441
+ for (; m < b; )
5442
+ if (c[m] === "\\")
5443
+ m + 1 < b ? (I += c[m + 1], m += 2) : m++;
5444
+ else if (c[m] === "[" && (!j || j !== "["))
5445
+ I += E();
5446
+ else if (j && c[m] === j) {
5447
+ m++;
5448
5448
  break;
5449
5449
  } else
5450
- x += c[l++];
5451
- return x;
5452
- }
5453
- function I() {
5454
- l++;
5455
- let k = "";
5456
- for (; l < b && /[A-Za-z0-9]/.test(c[l]); ) k += c[l++];
5457
- let x = null;
5458
- if (c[l] === ":") {
5459
- l++;
5460
- const H = l;
5461
- for (; l < b && c[l] !== "="; ) l++;
5462
- x = c.slice(H, l);
5450
+ I += c[m++];
5451
+ return I;
5452
+ }
5453
+ function E() {
5454
+ m++;
5455
+ let j = "";
5456
+ for (; m < b && /[A-Za-z0-9]/.test(c[m]); ) j += c[m++];
5457
+ let I = null;
5458
+ if (c[m] === ":") {
5459
+ m++;
5460
+ const J = m;
5461
+ for (; m < b && c[m] !== "="; ) m++;
5462
+ I = c.slice(J, m);
5463
5463
  }
5464
- c[l] === "=" && l++;
5465
- const U = w("]");
5466
- return C(U, k, x);
5464
+ c[m] === "=" && m++;
5465
+ const x = v("]");
5466
+ return U(x, j, I);
5467
5467
  }
5468
- return w();
5468
+ return v();
5469
5469
  }
5470
- let y = t.replace(
5470
+ let w = t.replace(
5471
5471
  u.PLACEHOLDERS,
5472
- (c, l) => typeof d[l] == "string" || typeof d[l] == "number" ? String(d[l]) : l ?? l
5472
+ (c, m) => typeof h[m] == "string" || typeof h[m] == "number" ? String(h[m]) : m ?? m
5473
5473
  );
5474
- return y = i.method === "loop" ? j(y) : p(y), y;
5474
+ return w = n.method === "loop" ? C(w) : p(w), w;
5475
5475
  }
5476
- }, s.number = {
5476
+ }, e.number = {
5477
5477
  /**
5478
5478
  * Translate number to words
5479
5479
  * @param num - Number to translate
@@ -5485,8 +5485,8 @@ var T;
5485
5485
  * console.log(cardinal); // "forty-two"
5486
5486
  * ```
5487
5487
  */
5488
- translate(t, e = "cardinal") {
5489
- const i = {
5488
+ translate(t, a = "cardinal") {
5489
+ const n = {
5490
5490
  single: ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"],
5491
5491
  tens: ["ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"],
5492
5492
  decades: ["twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"]
@@ -5494,55 +5494,55 @@ var T;
5494
5494
  single: ["zeroth", "first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eighth", "ninth"],
5495
5495
  tens: ["tenth", "eleventh", "twelfth", "thirteenth", "fourteenth", "fifteenth", "sixteenth", "seventeenth", "eighteenth", "nineteenth"],
5496
5496
  decades: ["twentieth", "thirtieth", "fortieth", "fiftieth", "sixtieth", "seventieth", "eightieth", "ninetieth"]
5497
- }, d = ["th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th"], u = ["", "thousand", "million", "billion", "trillion", "quadrillion", "quintillion"], h = u.map((p) => p ? `${p}th` : "");
5498
- if (t = Math.abs(Math.floor(t)), e === "suffix") {
5497
+ }, h = ["th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th"], u = ["", "thousand", "million", "billion", "trillion", "quadrillion", "quintillion"], l = u.map((p) => p ? `${p}th` : "");
5498
+ if (t = Math.abs(Math.floor(t)), a === "suffix") {
5499
5499
  const p = t % 100;
5500
5500
  if (p >= 11 && p <= 13) return `${t}th`;
5501
- const y = t % 10;
5502
- return `${t}${d[y]}`;
5503
- }
5504
- function m(p, y) {
5505
- if (p < 10) return y === "ordinal" ? r.single[p] : i.single[p];
5506
- if (p < 20) return y === "ordinal" ? r.tens[p - 10] : i.tens[p - 10];
5507
- const c = Math.floor(p / 10), l = p % 10;
5508
- if (l === 0) return y === "ordinal" ? r.decades[c - 2] : i.decades[c - 2];
5509
- const b = i.decades[c - 2], w = y === "ordinal" ? r.single[l] : i.single[l];
5510
- return `${b}-${w}`;
5511
- }
5512
- function g(p, y) {
5513
- if (p === 0) return y === "ordinal" ? r.single[0] : i.single[0];
5514
- const c = Math.floor(p / 100), l = p % 100, b = [];
5515
- return c > 0 && (y === "ordinal" && l === 0 ? b.push(`${i.single[c]} hundredth`) : b.push(`${i.single[c]} hundred`)), l > 0 && b.push(m(l, y)), b.join(" ");
5516
- }
5517
- if (t < 1e3) return g(t, e);
5518
- const f = [];
5519
- let v = t;
5520
- for (; v > 0; )
5521
- f.push(v % 1e3), v = Math.floor(v / 1e3);
5522
- let C = -1;
5523
- for (let p = 0; p < f.length; p++) f[p] !== 0 && (C = p);
5524
- const j = [];
5525
- for (let p = f.length - 1; p >= 0; p--) {
5526
- const y = f[p];
5527
- if (y === 0) continue;
5501
+ const w = t % 10;
5502
+ return `${t}${h[w]}`;
5503
+ }
5504
+ function g(p, w) {
5505
+ if (p < 10) return w === "ordinal" ? r.single[p] : n.single[p];
5506
+ if (p < 20) return w === "ordinal" ? r.tens[p - 10] : n.tens[p - 10];
5507
+ const c = Math.floor(p / 10), m = p % 10;
5508
+ if (m === 0) return w === "ordinal" ? r.decades[c - 2] : n.decades[c - 2];
5509
+ const b = n.decades[c - 2], v = w === "ordinal" ? r.single[m] : n.single[m];
5510
+ return `${b}-${v}`;
5511
+ }
5512
+ function f(p, w) {
5513
+ if (p === 0) return w === "ordinal" ? r.single[0] : n.single[0];
5514
+ const c = Math.floor(p / 100), m = p % 100, b = [];
5515
+ return c > 0 && (w === "ordinal" && m === 0 ? b.push(`${n.single[c]} hundredth`) : b.push(`${n.single[c]} hundred`)), m > 0 && b.push(g(m, w)), b.join(" ");
5516
+ }
5517
+ if (t < 1e3) return f(t, a);
5518
+ const y = [];
5519
+ let k = t;
5520
+ for (; k > 0; )
5521
+ y.push(k % 1e3), k = Math.floor(k / 1e3);
5522
+ let U = -1;
5523
+ for (let p = 0; p < y.length; p++) y[p] !== 0 && (U = p);
5524
+ const C = [];
5525
+ for (let p = y.length - 1; p >= 0; p--) {
5526
+ const w = y[p];
5527
+ if (w === 0) continue;
5528
5528
  const c = u[p];
5529
- if (e === "cardinal") {
5530
- let l = g(y, "cardinal");
5531
- c && (l += ` ${c}`), j.push(l);
5532
- } else if (p === C)
5529
+ if (a === "cardinal") {
5530
+ let m = f(w, "cardinal");
5531
+ c && (m += ` ${c}`), C.push(m);
5532
+ } else if (p === U)
5533
5533
  if (p > 0) {
5534
- const b = g(y, "cardinal"), w = h[p];
5535
- j.push(b ? `${b} ${w}` : w);
5534
+ const b = f(w, "cardinal"), v = l[p];
5535
+ C.push(b ? `${b} ${v}` : v);
5536
5536
  } else {
5537
- const b = g(y, "ordinal");
5538
- j.push(b);
5537
+ const b = f(w, "ordinal");
5538
+ C.push(b);
5539
5539
  }
5540
5540
  else {
5541
- let b = g(y, "cardinal");
5542
- c && (b += ` ${c}`), j.push(b);
5541
+ let b = f(w, "cardinal");
5542
+ c && (b += ` ${c}`), C.push(b);
5543
5543
  }
5544
5544
  }
5545
- return j.join(", ");
5545
+ return C.join(", ");
5546
5546
  },
5547
5547
  /**
5548
5548
  * Balances a number within a specified range
@@ -5556,10 +5556,10 @@ var T;
5556
5556
  * console.log(balancedValue); // 100
5557
5557
  * ```
5558
5558
  */
5559
- balance(t, e = 0, i = 100) {
5560
- return Math.min(Math.max(t, e), i);
5559
+ balance(t, a = 0, n = 100) {
5560
+ return Math.min(Math.max(t, a), n);
5561
5561
  }
5562
- }, s.element = {
5562
+ }, e.element = {
5563
5563
  /**
5564
5564
  * Merges outer span styles with inner span styles in the provided HTML string.
5565
5565
  * @param outerStyle - The style string to be applied to the outer span.
@@ -5571,13 +5571,13 @@ var T;
5571
5571
  * console.log(result); // Output: '<span style="font-size: 14px; color: red; font-weight: bold;">Hello World</span>'
5572
5572
  * ```
5573
5573
  */
5574
- mergeSpanStyles(t, e) {
5575
- const i = e.match(/^<span style="([^"]*)">(.*)<\/span>$/s);
5576
- if (i) {
5577
- const r = i[1], d = i[2];
5578
- return `<span style="${[r, t].filter(Boolean).join("; ").replace(/\s*;\s*/g, "; ").trim()}">${d}</span>`;
5574
+ mergeSpanStyles(t, a) {
5575
+ const n = a.match(/^<span style="([^"]*)">(.*)<\/span>$/s);
5576
+ if (n) {
5577
+ const r = n[1], h = n[2];
5578
+ return `<span style="${[r, t].filter(Boolean).join("; ").replace(/\s*;\s*/g, "; ").trim()}">${h}</span>`;
5579
5579
  } else
5580
- return `<span style="${t}">${e}</span>`;
5580
+ return `<span style="${t}">${a}</span>`;
5581
5581
  },
5582
5582
  /**
5583
5583
  * Scales an HTML element to fit within its parent element based on specified minimum and maximum scale factors.
@@ -5592,29 +5592,29 @@ var T;
5592
5592
  * Simulation.element.scale(element, 0.5, 1, { return: false });
5593
5593
  * ```
5594
5594
  */
5595
- scale(t, e = 0, i = 1, r) {
5596
- const { return: d = !1, parent: u, base: h } = r || {}, m = u || t.parentElement || document.body;
5597
- if (!m) {
5598
- J.warn("No parent element found for scaling");
5595
+ scale(t, a = 0, n = 1, r) {
5596
+ const { return: h = !1, parent: u, base: l } = r || {}, g = u || t.parentElement || document.body;
5597
+ if (!g) {
5598
+ z.warn("No parent element found for scaling");
5599
5599
  return;
5600
5600
  }
5601
- const g = m.getBoundingClientRect(), f = t.offsetWidth, v = t.offsetHeight;
5602
- if (f === 0 || v === 0) {
5603
- J.warn("Element has zero width or height, cannot scale");
5601
+ const f = g.getBoundingClientRect(), y = t.offsetWidth, k = t.offsetHeight;
5602
+ if (y === 0 || k === 0) {
5603
+ z.warn("Element has zero width or height, cannot scale");
5604
5604
  return;
5605
5605
  }
5606
- const C = g.width * i / f, j = g.height * i / v;
5607
- let p = h === "width" ? C : h === "height" ? j : Math.min(C, j);
5608
- if (e > 0) {
5609
- const c = g.width * e / f, l = g.height * e / v, b = Math.max(c, l);
5606
+ const U = f.width * n / y, C = f.height * n / k;
5607
+ let p = l === "width" ? U : l === "height" ? C : Math.min(U, C);
5608
+ if (a > 0) {
5609
+ const c = f.width * a / y, m = f.height * a / k, b = Math.max(c, m);
5610
5610
  p = Math.max(b, p);
5611
5611
  }
5612
- const y = {
5613
- width: f * p,
5614
- height: v * p,
5612
+ const w = {
5613
+ width: y * p,
5614
+ height: k * p,
5615
5615
  scale: p
5616
5616
  };
5617
- return d || (t.style.transform = `scale(${p})`, t.style.transformOrigin = "center center"), y;
5617
+ return h || (t.style.transform = `scale(${p})`, t.style.transformOrigin = "center center"), w;
5618
5618
  },
5619
5619
  /**
5620
5620
  * Splits the text content of an HTML string into individual characters wrapped in span elements with a data-index attribute.
@@ -5628,34 +5628,34 @@ var T;
5628
5628
  * // Output: '<p><span class="char" data-index="0">H</span><span class="char" data-index="1">e</span><span class="char" data-index="2">l</span><span class="char" data-index="3">l</span><span class="char" data-index="4">o</span></p>'
5629
5629
  * ```
5630
5630
  */
5631
- splitTextToChars(t, e = 0) {
5631
+ splitTextToChars(t, a = 0) {
5632
5632
  const r = new DOMParser().parseFromString(t, "text/html");
5633
- let d = e;
5634
- function u(g) {
5635
- if (g.nodeType === Node.TEXT_NODE) {
5636
- const v = g.textContent?.split("").map((j) => {
5633
+ let h = a;
5634
+ function u(f) {
5635
+ if (f.nodeType === Node.TEXT_NODE) {
5636
+ const k = f.textContent?.split("").map((C) => {
5637
5637
  const p = document.createElement("span");
5638
- return p.className = "char", p.dataset.index = String(d++), p.textContent = j, d++, p.outerHTML;
5639
- }), C = document.createElement("span");
5640
- return C.innerHTML = v?.join("") ?? "", C;
5641
- } else if (g.nodeType === Node.ELEMENT_NODE) {
5642
- const f = g.cloneNode(!1);
5643
- return g.childNodes.forEach((v) => {
5644
- const C = u(v);
5645
- C instanceof Node && Array.from(C.childNodes).forEach((j) => {
5646
- f.appendChild(j);
5638
+ return p.className = "char", p.dataset.index = String(h++), p.textContent = C, h++, p.outerHTML;
5639
+ }), U = document.createElement("span");
5640
+ return U.innerHTML = k?.join("") ?? "", U;
5641
+ } else if (f.nodeType === Node.ELEMENT_NODE) {
5642
+ const y = f.cloneNode(!1);
5643
+ return f.childNodes.forEach((k) => {
5644
+ const U = u(k);
5645
+ U instanceof Node && Array.from(U.childNodes).forEach((C) => {
5646
+ y.appendChild(C);
5647
5647
  });
5648
- }), f;
5648
+ }), y;
5649
5649
  }
5650
- return g.cloneNode(!0);
5650
+ return f.cloneNode(!0);
5651
5651
  }
5652
- const h = r.body, m = document.createElement("div");
5653
- return h.childNodes.forEach((g) => {
5654
- const f = u(g);
5655
- f instanceof Node && m.appendChild(f);
5656
- }), m.innerHTML;
5652
+ const l = r.body, g = document.createElement("div");
5653
+ return l.childNodes.forEach((f) => {
5654
+ const y = u(f);
5655
+ y instanceof Node && g.appendChild(y);
5656
+ }), g.innerHTML;
5657
5657
  }
5658
- }, s.object = {
5658
+ }, e.object = {
5659
5659
  /**
5660
5660
  * Flattens a nested object into a single-level object with dot-separated keys.
5661
5661
  * @param obj - The nested object to be flattened.
@@ -5669,48 +5669,48 @@ var T;
5669
5669
  * // Output: { 'a.b': '1', 'a.c.d': '2', 'e:0': '3', 'e:1': '4' }
5670
5670
  * ```
5671
5671
  */
5672
- flatten(t, e = "") {
5673
- const i = {};
5672
+ flatten(t, a = "") {
5673
+ const n = {};
5674
5674
  for (const r in t) {
5675
5675
  if (!Object.prototype.hasOwnProperty.call(t, r)) continue;
5676
- const d = t[r], u = e ? `${e}.${r}` : r;
5677
- if (d == null) {
5678
- i[u] = String(d);
5676
+ const h = t[r], u = a ? `${a}.${r}` : r;
5677
+ if (h == null) {
5678
+ n[u] = String(h);
5679
5679
  continue;
5680
5680
  }
5681
- if (d instanceof Date) {
5682
- i[u] = d.toISOString();
5681
+ if (h instanceof Date) {
5682
+ n[u] = h.toISOString();
5683
5683
  continue;
5684
5684
  }
5685
- if (d instanceof Map) {
5686
- d.forEach((h, m) => {
5687
- i[`${u}.${m}`] = JSON.stringify(h);
5685
+ if (h instanceof Map) {
5686
+ h.forEach((l, g) => {
5687
+ n[`${u}.${g}`] = JSON.stringify(l);
5688
5688
  });
5689
5689
  continue;
5690
5690
  }
5691
- if (Array.isArray(d)) {
5692
- d.forEach((h, m) => {
5693
- const g = `${u}:${m}`;
5694
- typeof h == "object" ? Object.assign(i, this.flatten(h, g)) : i[g] = String(h);
5691
+ if (Array.isArray(h)) {
5692
+ h.forEach((l, g) => {
5693
+ const f = `${u}:${g}`;
5694
+ typeof l == "object" ? Object.assign(n, this.flatten(l, f)) : n[f] = String(l);
5695
5695
  });
5696
5696
  continue;
5697
5697
  }
5698
- if (typeof d == "object") {
5699
- Object.assign(i, this.flatten(d, u));
5698
+ if (typeof h == "object") {
5699
+ Object.assign(n, this.flatten(h, u));
5700
5700
  continue;
5701
5701
  }
5702
- i[u] = String(d);
5702
+ n[u] = String(h);
5703
5703
  }
5704
- return i;
5704
+ return n;
5705
5705
  }
5706
- }, s.generate = {
5706
+ }, e.generate = {
5707
5707
  session: {
5708
5708
  types: {
5709
- name: { type: "string", options: s.data.names.filter((t) => t.length) },
5710
- tier: { type: "string", options: s.data.tiers.filter((t) => t.length) },
5711
- message: { type: "string", options: s.data.messages.filter((t) => t.length) },
5712
- item: { type: "array", options: s.data.items },
5713
- avatar: { type: "string", options: s.data.avatars.filter((t) => t.length) }
5709
+ name: { type: "string", options: e.data.names.filter((t) => t.length) },
5710
+ tier: { type: "string", options: e.data.tiers.filter((t) => t.length) },
5711
+ message: { type: "string", options: e.data.messages.filter((t) => t.length) },
5712
+ item: { type: "array", options: e.data.items },
5713
+ avatar: { type: "string", options: e.data.avatars.filter((t) => t.length) }
5714
5714
  },
5715
5715
  available() {
5716
5716
  const t = this.types;
@@ -5956,49 +5956,49 @@ var T;
5956
5956
  };
5957
5957
  },
5958
5958
  async get() {
5959
- const t = this.available(), e = (r) => {
5960
- const d = (m) => {
5961
- if (!m || !("amount" in m)) return [];
5962
- const g = [];
5963
- for (let f = 0; f < m.amount; f++)
5964
- g.push(e(m.value));
5965
- return g.sort((f, v) => new Date(v.createdAt).getTime() - new Date(f.createdAt).getTime());
5966
- }, u = (m) => {
5967
- const g = {};
5968
- for (const f in m) {
5969
- const v = f.replace("_type", "type");
5970
- g[v] = e(m[f]);
5959
+ const t = this.available(), a = (r) => {
5960
+ const h = (g) => {
5961
+ if (!g || !("amount" in g)) return [];
5962
+ const f = [];
5963
+ for (let y = 0; y < g.amount; y++)
5964
+ f.push(a(g.value));
5965
+ return f.sort((y, k) => new Date(k.createdAt).getTime() - new Date(y.createdAt).getTime());
5966
+ }, u = (g) => {
5967
+ const f = {};
5968
+ for (const y in g) {
5969
+ const k = y.replace("_type", "type");
5970
+ f[k] = a(g[y]);
5971
5971
  }
5972
- return g;
5973
- }, h = (m) => {
5974
- if (!m) return m;
5975
- switch (m.type) {
5972
+ return f;
5973
+ }, l = (g) => {
5974
+ if (!g) return g;
5975
+ switch (g.type) {
5976
5976
  case "int":
5977
- return s.rand.number(m.min, m.max);
5977
+ return e.rand.number(g.min, g.max);
5978
5978
  case "string":
5979
- return s.rand.array(m.options)[0];
5979
+ return e.rand.array(g.options)[0];
5980
5980
  case "date":
5981
- return s.rand.daysOffset(m.range);
5981
+ return e.rand.daysOffset(g.range);
5982
5982
  case "array":
5983
- return s.rand.array(m.options)[0];
5983
+ return e.rand.array(g.options)[0];
5984
5984
  case "recent":
5985
- return d(m);
5985
+ return h(g);
5986
5986
  default:
5987
- return m;
5987
+ return g;
5988
5988
  }
5989
5989
  };
5990
- return typeof r != "object" || r === null ? r : "type" in r && typeof r.type == "string" ? h(r) : u(r);
5990
+ return typeof r != "object" || r === null ? r : "type" in r && typeof r.type == "string" ? l(r) : u(r);
5991
5991
  };
5992
- var i = Object.entries(e(t)).reduce(
5993
- (r, [d, u]) => (Object.entries(u).forEach(
5994
- ([h, m]) => (
5992
+ var n = Object.entries(a(t)).reduce(
5993
+ (r, [h, u]) => (Object.entries(u).forEach(
5994
+ ([l, g]) => (
5995
5995
  //
5996
- r[`${d}-${h}`] = m
5996
+ r[`${h}-${l}`] = g
5997
5997
  )
5998
5998
  ), r),
5999
5999
  {}
6000
6000
  );
6001
- return i;
6001
+ return n;
6002
6002
  }
6003
6003
  },
6004
6004
  event: {
@@ -6009,7 +6009,7 @@ var T;
6009
6009
  * @param currency - The currency to be used (default is 'USD').
6010
6010
  * @returns A Promise that resolves to the simulated onWidgetLoad event data.
6011
6011
  */
6012
- async onWidgetLoad(t, e, i = "USD") {
6012
+ async onWidgetLoad(t, a, n = "USD") {
6013
6013
  const r = {
6014
6014
  BRL: { code: "BRL", name: "Brazilian Real", symbol: "R$" },
6015
6015
  USD: { code: "USD", name: "US Dollar", symbol: "$" },
@@ -6023,11 +6023,11 @@ var T;
6023
6023
  providerId: "",
6024
6024
  avatar: ""
6025
6025
  },
6026
- currency: r[i] ?? r.USD,
6026
+ currency: r[n] ?? r.USD,
6027
6027
  fieldData: t,
6028
6028
  recents: [],
6029
6029
  session: {
6030
- data: e,
6030
+ data: a,
6031
6031
  settings: {
6032
6032
  autoReset: !1,
6033
6033
  calendar: !1,
@@ -6047,7 +6047,7 @@ var T;
6047
6047
  * @returns A Promise that resolves to the simulated onSessionUpdate event data.
6048
6048
  */
6049
6049
  async onSessionUpdate(t) {
6050
- return t ??= await s.generate.session.get(), { session: t };
6050
+ return t ??= await e.generate.session.get(), { session: t };
6051
6051
  },
6052
6052
  /**
6053
6053
  * Simulates the onEventReceived event for a widget.
@@ -6064,7 +6064,7 @@ var T;
6064
6064
  * const twitchMessageEvent = await Simulation.generate.event.onEventReceived('twitch', 'message', { name: 'Streamer', message: 'Hello World!' });
6065
6065
  * ```
6066
6066
  */
6067
- async onEventReceived(t = "random", e = "random", i = {}) {
6067
+ async onEventReceived(t = "random", a = "random", n = {}) {
6068
6068
  const r = {
6069
6069
  twitch: ["message", "follower-latest", "cheer-latest", "raid-latest", "subscriber-latest"],
6070
6070
  streamelements: ["tip-latest"],
@@ -6075,18 +6075,18 @@ var T;
6075
6075
  switch (t) {
6076
6076
  default:
6077
6077
  case "random": {
6078
- var d = s.rand.array(Object.keys(r).filter((U) => r[U].length))[0], u = s.rand.array(r[d])[0];
6079
- return this.onEventReceived(d, u);
6078
+ var h = e.rand.array(Object.keys(r).filter((x) => r[x].length))[0], u = e.rand.array(r[h])[0];
6079
+ return this.onEventReceived(h, u);
6080
6080
  }
6081
6081
  case "twitch":
6082
- switch (e) {
6082
+ switch (a) {
6083
6083
  default:
6084
6084
  case "random": {
6085
- var u = s.rand.array(r[t])[0];
6085
+ var u = e.rand.array(r[t])[0];
6086
6086
  return this.onEventReceived(t, u);
6087
6087
  }
6088
6088
  case "message": {
6089
- var h = i?.name ?? s.rand.array(s.data.names.filter((H) => H.length))[0], m = i?.message ?? s.rand.array(s.data.messages.filter((H) => H.length))[0], g = await G(i?.badges ?? [], t), f = V(m), v = q(m, f), C = i?.color ?? s.rand.color("hex"), j = i?.userId ?? s.rand.number(1e7, 99999999).toString(), p = Date.now();
6089
+ var l = n?.name ?? e.rand.array(e.data.names.filter((J) => J.length))[0], g = n?.message ?? e.rand.array(e.data.messages.filter((J) => J.length))[0], f = await S(n?.badges ?? [], t), y = q(g), k = G(g, y), U = n?.color ?? e.rand.color("hex"), C = n?.userId ?? e.rand.number(1e7, 99999999).toString(), p = Date.now();
6090
6090
  return {
6091
6091
  listener: "message",
6092
6092
  event: {
@@ -6094,51 +6094,51 @@ var T;
6094
6094
  data: {
6095
6095
  time: p,
6096
6096
  tags: {
6097
- "badge-info": `${g.keys.map((H) => `${H}/${s.rand.number(1, 5)}`).join(",")}`,
6098
- badges: g.keys.join("/1,"),
6099
- mod: g.keys.includes("moderator") ? "1" : "0",
6100
- subscriber: g.keys.includes("subscriber") ? "1" : "0",
6101
- turbo: g.keys.includes("turbo") ? "1" : "0",
6097
+ "badge-info": `${f.keys.map((J) => `${J}/${e.rand.number(1, 5)}`).join(",")}`,
6098
+ badges: f.keys.join("/1,"),
6099
+ mod: f.keys.includes("moderator") ? "1" : "0",
6100
+ subscriber: f.keys.includes("subscriber") ? "1" : "0",
6101
+ turbo: f.keys.includes("turbo") ? "1" : "0",
6102
6102
  "tmi-sent-ts": p.toString(),
6103
- "user-id": j,
6103
+ "user-id": C,
6104
6104
  "user-type": "",
6105
- color: C,
6106
- "display-name": h,
6105
+ color: U,
6106
+ "display-name": l,
6107
6107
  emotes: "",
6108
- "client-nonce": s.rand.string(16),
6108
+ "client-nonce": e.rand.string(16),
6109
6109
  flags: "",
6110
- id: s.rand.uuid(),
6110
+ id: e.rand.uuid(),
6111
6111
  "first-msg": "0",
6112
6112
  "returning-chatter": "0"
6113
6113
  },
6114
- nick: h.toLowerCase(),
6115
- displayName: h,
6116
- displayColor: C,
6114
+ nick: l.toLowerCase(),
6115
+ displayName: l,
6116
+ displayColor: U,
6117
6117
  channel: "local",
6118
- text: m,
6118
+ text: g,
6119
6119
  isAction: !1,
6120
- userId: j,
6121
- msgId: s.rand.uuid(),
6122
- badges: g.badges,
6123
- emotes: f
6120
+ userId: C,
6121
+ msgId: e.rand.uuid(),
6122
+ badges: f.badges,
6123
+ emotes: y
6124
6124
  },
6125
- renderedText: v
6125
+ renderedText: k
6126
6126
  }
6127
6127
  };
6128
6128
  }
6129
6129
  case "cheer":
6130
6130
  case "cheer-latest": {
6131
- var y = i?.amount ?? s.rand.number(100, 1e4), c = i?.avatar ?? s.rand.array(s.data.avatars)[0], h = i?.name ?? s.rand.array(s.data.names.filter((D) => D.length))[0], m = i?.message ?? s.rand.array(s.data.messages.filter((D) => D.length))[0];
6131
+ var w = n?.amount ?? e.rand.number(100, 1e4), c = n?.avatar ?? e.rand.array(e.data.avatars)[0], l = n?.name ?? e.rand.array(e.data.names.filter((A) => A.length))[0], g = n?.message ?? e.rand.array(e.data.messages.filter((A) => A.length))[0];
6132
6132
  return {
6133
6133
  listener: "cheer-latest",
6134
6134
  event: {
6135
- amount: y,
6135
+ amount: w,
6136
6136
  avatar: c,
6137
- name: h.toLowerCase(),
6138
- displayName: h,
6139
- message: m,
6137
+ name: l.toLowerCase(),
6138
+ displayName: l,
6139
+ message: g,
6140
6140
  providerId: "",
6141
- _id: s.rand.uuid(),
6141
+ _id: e.rand.uuid(),
6142
6142
  sessionTop: !1,
6143
6143
  type: "cheer",
6144
6144
  originalEventName: "cheer-latest",
@@ -6148,15 +6148,15 @@ var T;
6148
6148
  }
6149
6149
  case "follower":
6150
6150
  case "follower-latest": {
6151
- var c = i?.avatar ?? s.rand.array(s.data.avatars)[0], h = i?.name ?? s.rand.array(s.data.names.filter((D) => D.length))[0];
6151
+ var c = n?.avatar ?? e.rand.array(e.data.avatars)[0], l = n?.name ?? e.rand.array(e.data.names.filter((A) => A.length))[0];
6152
6152
  return {
6153
6153
  listener: "follower-latest",
6154
6154
  event: {
6155
6155
  avatar: c,
6156
- name: h.toLowerCase(),
6157
- displayName: h,
6156
+ name: l.toLowerCase(),
6157
+ displayName: l,
6158
6158
  providerId: "",
6159
- _id: s.rand.uuid(),
6159
+ _id: e.rand.uuid(),
6160
6160
  sessionTop: !1,
6161
6161
  type: "follower",
6162
6162
  originalEventName: "follower-latest",
@@ -6166,16 +6166,16 @@ var T;
6166
6166
  }
6167
6167
  case "raid":
6168
6168
  case "raid-latest": {
6169
- var y = i?.amount ?? s.rand.number(1, 100), c = i?.avatar ?? s.rand.array(s.data.avatars)[0], h = i?.name ?? s.rand.array(s.data.names.filter((z) => z.length))[0];
6169
+ var w = n?.amount ?? e.rand.number(1, 100), c = n?.avatar ?? e.rand.array(e.data.avatars)[0], l = n?.name ?? e.rand.array(e.data.names.filter((P) => P.length))[0];
6170
6170
  return {
6171
6171
  listener: "raid-latest",
6172
6172
  event: {
6173
- amount: y,
6173
+ amount: w,
6174
6174
  avatar: c,
6175
- name: h.toLowerCase(),
6176
- displayName: h,
6175
+ name: l.toLowerCase(),
6176
+ displayName: l,
6177
6177
  providerId: "",
6178
- _id: s.rand.uuid(),
6178
+ _id: e.rand.uuid(),
6179
6179
  sessionTop: !1,
6180
6180
  type: "raid",
6181
6181
  originalEventName: "raid-latest",
@@ -6185,10 +6185,10 @@ var T;
6185
6185
  }
6186
6186
  case "subscriber":
6187
6187
  case "subscriber-latest": {
6188
- var l = i?.tier ?? s.rand.array(["1000", "2000", "3000"])[0], y = i?.amount ?? s.rand.number(1, 24), c = i?.avatar ?? s.rand.array(s.data.avatars)[0], h = i?.name ?? s.rand.array(s.data.names.filter((P) => P.length))[0], b = i?.sender ?? s.rand.array(s.data.names.filter((P) => P.length && P !== h))[0], m = i?.message ?? s.rand.array(s.data.messages.filter((P) => P.length))[0], w = {
6188
+ var m = n?.tier ?? e.rand.array(["1000", "2000", "3000"])[0], w = n?.amount ?? e.rand.number(1, 24), c = n?.avatar ?? e.rand.array(e.data.avatars)[0], l = n?.name ?? e.rand.array(e.data.names.filter((M) => M.length))[0], b = n?.sender ?? e.rand.array(e.data.names.filter((M) => M.length && M !== l))[0], g = n?.message ?? e.rand.array(e.data.messages.filter((M) => M.length))[0], v = {
6189
6189
  default: {
6190
6190
  avatar: c,
6191
- tier: l,
6191
+ tier: m,
6192
6192
  playedAsCommunityGift: !1
6193
6193
  },
6194
6194
  gift: {
@@ -6196,7 +6196,7 @@ var T;
6196
6196
  gifted: !0
6197
6197
  },
6198
6198
  community: {
6199
- message: m,
6199
+ message: g,
6200
6200
  sender: b,
6201
6201
  bulkGifted: !0
6202
6202
  },
@@ -6205,17 +6205,17 @@ var T;
6205
6205
  gifted: !0,
6206
6206
  isCommunityGift: !0
6207
6207
  }
6208
- }, I = ["default", "gift", "community", "spam"], k = i?.subType ?? s.rand.array(I)[0];
6209
- return k = I.includes(k) ? k : "default", {
6208
+ }, E = ["default", "gift", "community", "spam"], j = n?.subType ?? e.rand.array(E)[0];
6209
+ return j = E.includes(j) ? j : "default", {
6210
6210
  listener: "subscriber-latest",
6211
6211
  event: {
6212
- amount: y,
6213
- name: h.toLowerCase(),
6214
- displayName: h,
6212
+ amount: w,
6213
+ name: l.toLowerCase(),
6214
+ displayName: l,
6215
6215
  providerId: "",
6216
- ...w.default,
6217
- ...w[k],
6218
- _id: s.rand.uuid(),
6216
+ ...v.default,
6217
+ ...v[j],
6218
+ _id: e.rand.uuid(),
6219
6219
  sessionTop: !1,
6220
6220
  type: "subscriber",
6221
6221
  originalEventName: "subscriber-latest",
@@ -6227,7 +6227,7 @@ var T;
6227
6227
  return {
6228
6228
  listener: "delete-message",
6229
6229
  event: {
6230
- msgId: i?.id ?? s.rand.uuid(),
6230
+ msgId: n?.id ?? e.rand.uuid(),
6231
6231
  provider: t
6232
6232
  }
6233
6233
  };
@@ -6235,30 +6235,30 @@ var T;
6235
6235
  return {
6236
6236
  listener: "delete-messages",
6237
6237
  event: {
6238
- userId: i?.id ?? s.rand.number(1e7, 99999999).toString(),
6238
+ userId: n?.id ?? e.rand.number(1e7, 99999999).toString(),
6239
6239
  provider: t
6240
6240
  }
6241
6241
  };
6242
6242
  }
6243
6243
  case "streamelements":
6244
- switch (e) {
6244
+ switch (a) {
6245
6245
  default:
6246
6246
  case "random": {
6247
- var u = s.rand.array(r[t])[0];
6247
+ var u = e.rand.array(r[t])[0];
6248
6248
  return this.onEventReceived(t, u);
6249
6249
  }
6250
6250
  case "tip":
6251
6251
  case "tip-latest": {
6252
- var y = i?.amount ?? s.rand.number(100, 4e3), c = i?.avatar ?? s.rand.array(s.data.avatars)[0], h = i?.name ?? s.rand.array(s.data.names.filter((z) => z.length))[0];
6252
+ var w = n?.amount ?? e.rand.number(100, 4e3), c = n?.avatar ?? e.rand.array(e.data.avatars)[0], l = n?.name ?? e.rand.array(e.data.names.filter((P) => P.length))[0];
6253
6253
  return {
6254
6254
  listener: "tip-latest",
6255
6255
  event: {
6256
- amount: y,
6256
+ amount: w,
6257
6257
  avatar: c,
6258
- name: h.toLowerCase(),
6259
- displayName: h,
6258
+ name: l.toLowerCase(),
6259
+ displayName: l,
6260
6260
  providerId: "",
6261
- _id: s.rand.uuid(),
6261
+ _id: e.rand.uuid(),
6262
6262
  sessionTop: !1,
6263
6263
  type: "tip",
6264
6264
  originalEventName: "tip-latest",
@@ -6271,8 +6271,8 @@ var T;
6271
6271
  listener: "kvstore:update",
6272
6272
  event: {
6273
6273
  data: {
6274
- key: `customWidget.${i?.key ?? "sampleKey"}`,
6275
- value: i?.value ?? "sampleValue"
6274
+ key: `customWidget.${n?.key ?? "sampleKey"}`,
6275
+ value: n?.value ?? "sampleValue"
6276
6276
  },
6277
6277
  provider: t
6278
6278
  }
@@ -6281,19 +6281,19 @@ var T;
6281
6281
  return {
6282
6282
  listener: "bot:counter",
6283
6283
  event: {
6284
- counter: i?.counter ?? "sampleCounter",
6285
- value: i?.value ?? s.rand.number(0, 100),
6284
+ counter: n?.counter ?? "sampleCounter",
6285
+ value: n?.value ?? e.rand.number(0, 100),
6286
6286
  provider: t
6287
6287
  }
6288
6288
  };
6289
6289
  case "mute":
6290
6290
  case "unmute":
6291
6291
  case "alertService:toggleSound": {
6292
- var x = i?.muted ?? !client.details.overlay.muted;
6292
+ var I = n?.muted ?? !client.details.overlay.muted;
6293
6293
  return {
6294
6294
  listener: "alertService:toggleSound",
6295
6295
  event: {
6296
- muted: x,
6296
+ muted: I,
6297
6297
  provider: t
6298
6298
  }
6299
6299
  };
@@ -6308,16 +6308,16 @@ var T;
6308
6308
  };
6309
6309
  }
6310
6310
  case "youtube":
6311
- switch (e) {
6311
+ switch (a) {
6312
6312
  default:
6313
6313
  case "random": {
6314
- var u = s.rand.array(r[t])[0];
6314
+ var u = e.rand.array(r[t])[0];
6315
6315
  return this.onEventReceived(t, u);
6316
6316
  }
6317
6317
  case "message": {
6318
- var h = i?.name ?? s.rand.array(s.data.names.filter((A) => A.length))[0], m = i?.message ?? s.rand.array(s.data.messages.filter((A) => A.length))[0];
6319
- const L = await G(i?.badges ?? [], t);
6320
- var f = V(m), v = q(m, f), C = i?.color ?? s.rand.color("hex"), j = i?.userId ?? s.rand.number(1e7, 99999999).toString(), p = Date.now(), c = i?.avatar ?? s.rand.array(s.data.avatars)[0];
6318
+ var l = n?.name ?? e.rand.array(e.data.names.filter((H) => H.length))[0], g = n?.message ?? e.rand.array(e.data.messages.filter((H) => H.length))[0];
6319
+ const R = await S(n?.badges ?? [], t);
6320
+ var y = q(g), k = G(g, y), U = n?.color ?? e.rand.color("hex"), C = n?.userId ?? e.rand.number(1e7, 99999999).toString(), p = Date.now(), c = n?.avatar ?? e.rand.array(e.data.avatars)[0];
6321
6321
  return {
6322
6322
  listener: "message",
6323
6323
  event: {
@@ -6332,47 +6332,47 @@ var T;
6332
6332
  authorChannelId: "local",
6333
6333
  publishedAt: (/* @__PURE__ */ new Date()).toISOString(),
6334
6334
  hasDisplayContent: !0,
6335
- displayMessage: m,
6335
+ displayMessage: g,
6336
6336
  textMessageDetails: {
6337
- messageText: m
6337
+ messageText: g
6338
6338
  }
6339
6339
  },
6340
6340
  authorDetails: {
6341
6341
  channelId: "local",
6342
6342
  channelUrl: "",
6343
- displayName: h,
6343
+ displayName: l,
6344
6344
  profileImageUrl: c,
6345
- ...L
6345
+ ...R
6346
6346
  },
6347
- msgId: s.rand.uuid(),
6348
- userId: s.rand.uuid(),
6349
- nick: h.toLowerCase(),
6347
+ msgId: e.rand.uuid(),
6348
+ userId: e.rand.uuid(),
6349
+ nick: l.toLowerCase(),
6350
6350
  badges: [],
6351
- displayName: h,
6351
+ displayName: l,
6352
6352
  isAction: !1,
6353
6353
  time: Date.now(),
6354
6354
  tags: [],
6355
- displayColor: s.rand.color("hex"),
6355
+ displayColor: e.rand.color("hex"),
6356
6356
  channel: "local",
6357
- text: m,
6357
+ text: g,
6358
6358
  avatar: c,
6359
6359
  emotes: []
6360
6360
  },
6361
- renderedText: m
6361
+ renderedText: g
6362
6362
  }
6363
6363
  };
6364
6364
  }
6365
6365
  case "subscriber":
6366
6366
  case "subscriber-latest": {
6367
- var c = i?.avatar ?? s.rand.array(s.data.avatars)[0], h = i?.name ?? s.rand.array(s.data.names.filter((D) => D.length))[0];
6367
+ var c = n?.avatar ?? e.rand.array(e.data.avatars)[0], l = n?.name ?? e.rand.array(e.data.names.filter((A) => A.length))[0];
6368
6368
  return {
6369
6369
  listener: "subscriber-latest",
6370
6370
  event: {
6371
6371
  avatar: c,
6372
- displayName: h,
6373
- name: h.toLowerCase(),
6372
+ displayName: l,
6373
+ name: l.toLowerCase(),
6374
6374
  providerId: "",
6375
- _id: s.rand.uuid(),
6375
+ _id: e.rand.uuid(),
6376
6376
  sessionTop: !1,
6377
6377
  type: "subscriber",
6378
6378
  originalEventName: "subscriber-latest",
@@ -6382,16 +6382,16 @@ var T;
6382
6382
  }
6383
6383
  case "superchat":
6384
6384
  case "superchat-latest": {
6385
- var y = i?.amount ?? s.rand.number(100, 4e3), c = i?.avatar ?? s.rand.array(s.data.avatars)[0], h = i?.name ?? s.rand.array(s.data.names.filter((z) => z.length))[0];
6385
+ var w = n?.amount ?? e.rand.number(100, 4e3), c = n?.avatar ?? e.rand.array(e.data.avatars)[0], l = n?.name ?? e.rand.array(e.data.names.filter((P) => P.length))[0];
6386
6386
  return {
6387
6387
  listener: "superchat-latest",
6388
6388
  event: {
6389
- amount: y,
6389
+ amount: w,
6390
6390
  avatar: c,
6391
- name: h.toLowerCase(),
6392
- displayName: h,
6391
+ name: l.toLowerCase(),
6392
+ displayName: l,
6393
6393
  providerId: "",
6394
- _id: s.rand.uuid(),
6394
+ _id: e.rand.uuid(),
6395
6395
  sessionTop: !1,
6396
6396
  type: "superchat",
6397
6397
  originalEventName: "superchat-latest",
@@ -6401,10 +6401,10 @@ var T;
6401
6401
  }
6402
6402
  case "sponsor":
6403
6403
  case "sponsor-latest": {
6404
- var l = i?.tier ?? s.rand.array(["1000", "2000", "3000"])[0], y = i?.amount ?? s.rand.number(1, 24), c = i?.avatar ?? s.rand.array(s.data.avatars)[0], h = i?.name ?? s.rand.array(s.data.names.filter((A) => A.length))[0], b = i?.sender ?? s.rand.array(s.data.names.filter((A) => A.length && A !== h))[0], m = i?.message ?? s.rand.array(s.data.messages.filter((A) => A.length))[0], w = {
6404
+ var m = n?.tier ?? e.rand.array(["1000", "2000", "3000"])[0], w = n?.amount ?? e.rand.number(1, 24), c = n?.avatar ?? e.rand.array(e.data.avatars)[0], l = n?.name ?? e.rand.array(e.data.names.filter((H) => H.length))[0], b = n?.sender ?? e.rand.array(e.data.names.filter((H) => H.length && H !== l))[0], g = n?.message ?? e.rand.array(e.data.messages.filter((H) => H.length))[0], v = {
6405
6405
  default: {
6406
6406
  avatar: c,
6407
- tier: l,
6407
+ tier: m,
6408
6408
  playedAsCommunityGift: !1
6409
6409
  },
6410
6410
  gift: {
@@ -6412,7 +6412,7 @@ var T;
6412
6412
  gifted: !0
6413
6413
  },
6414
6414
  community: {
6415
- message: m,
6415
+ message: g,
6416
6416
  sender: b,
6417
6417
  bulkGifted: !0
6418
6418
  },
@@ -6421,17 +6421,17 @@ var T;
6421
6421
  gifted: !0,
6422
6422
  isCommunityGift: !0
6423
6423
  }
6424
- }, I = ["default", "gift", "community", "spam"], k = i?.subType ?? s.rand.array(I)[0];
6425
- return k = I.includes(k) ? k : "default", {
6424
+ }, E = ["default", "gift", "community", "spam"], j = n?.subType ?? e.rand.array(E)[0];
6425
+ return j = E.includes(j) ? j : "default", {
6426
6426
  listener: "sponsor-latest",
6427
6427
  event: {
6428
- amount: y,
6429
- name: h.toLowerCase(),
6430
- displayName: h,
6428
+ amount: w,
6429
+ name: l.toLowerCase(),
6430
+ displayName: l,
6431
6431
  providerId: "",
6432
- ...w.default,
6433
- ...w[k],
6434
- _id: s.rand.uuid(),
6432
+ ...v.default,
6433
+ ...v[j],
6434
+ _id: e.rand.uuid(),
6435
6435
  sessionTop: !1,
6436
6436
  type: "sponsor",
6437
6437
  originalEventName: "sponsor-latest",
@@ -6443,164 +6443,168 @@ var T;
6443
6443
  }
6444
6444
  }
6445
6445
  }
6446
- }, s.emulate = {
6446
+ }, e.emulate = {
6447
6447
  twitch: {
6448
6448
  message(t = {}) {
6449
- s.generate.event.onEventReceived("twitch", "message", t).then((e) => {
6450
- e && s.emulate.send("onEventReceived", e);
6449
+ e.generate.event.onEventReceived("twitch", "message", t).then((a) => {
6450
+ a && e.emulate.send("onEventReceived", a);
6451
6451
  });
6452
6452
  },
6453
6453
  follower(t = {}) {
6454
- s.generate.event.onEventReceived("twitch", "follower-latest", t).then((e) => {
6455
- e && s.emulate.send("onEventReceived", e);
6454
+ e.generate.event.onEventReceived("twitch", "follower-latest", t).then((a) => {
6455
+ a && e.emulate.send("onEventReceived", a);
6456
6456
  });
6457
6457
  },
6458
6458
  raid(t = {}) {
6459
- s.generate.event.onEventReceived("twitch", "raid-latest", t).then((e) => {
6460
- e && s.emulate.send("onEventReceived", e);
6459
+ e.generate.event.onEventReceived("twitch", "raid-latest", t).then((a) => {
6460
+ a && e.emulate.send("onEventReceived", a);
6461
6461
  });
6462
6462
  },
6463
6463
  cheer(t = {}) {
6464
- s.generate.event.onEventReceived("twitch", "cheer-latest", t).then((e) => {
6465
- e && s.emulate.send("onEventReceived", e);
6464
+ e.generate.event.onEventReceived("twitch", "cheer-latest", t).then((a) => {
6465
+ a && e.emulate.send("onEventReceived", a);
6466
6466
  });
6467
6467
  },
6468
6468
  subscriber(t = {}) {
6469
- s.generate.event.onEventReceived("twitch", "subscriber-latest", t).then((e) => {
6470
- e && s.emulate.send("onEventReceived", e);
6469
+ e.generate.event.onEventReceived("twitch", "subscriber-latest", t).then((a) => {
6470
+ a && e.emulate.send("onEventReceived", a);
6471
6471
  });
6472
6472
  }
6473
6473
  },
6474
6474
  streamelements: {
6475
6475
  tip(t = {}) {
6476
- s.generate.event.onEventReceived("streamelements", "tip-latest", t).then((e) => {
6477
- e && s.emulate.send("onEventReceived", e);
6476
+ e.generate.event.onEventReceived("streamelements", "tip-latest", t).then((a) => {
6477
+ a && e.emulate.send("onEventReceived", a);
6478
6478
  });
6479
6479
  }
6480
6480
  },
6481
6481
  youtube: {
6482
6482
  message(t = {}) {
6483
- s.generate.event.onEventReceived("youtube", "message", t).then((e) => {
6484
- e && s.emulate.send("onEventReceived", e);
6483
+ e.generate.event.onEventReceived("youtube", "message", t).then((a) => {
6484
+ a && e.emulate.send("onEventReceived", a);
6485
6485
  });
6486
6486
  },
6487
6487
  subscriber(t = {}) {
6488
- s.generate.event.onEventReceived("youtube", "subscriber-latest", t).then((e) => {
6489
- e && s.emulate.send("onEventReceived", e);
6488
+ e.generate.event.onEventReceived("youtube", "subscriber-latest", t).then((a) => {
6489
+ a && e.emulate.send("onEventReceived", a);
6490
6490
  });
6491
6491
  },
6492
6492
  superchat(t = {}) {
6493
- s.generate.event.onEventReceived("youtube", "superchat-latest", t).then((e) => {
6494
- e && s.emulate.send("onEventReceived", e);
6493
+ e.generate.event.onEventReceived("youtube", "superchat-latest", t).then((a) => {
6494
+ a && e.emulate.send("onEventReceived", a);
6495
6495
  });
6496
6496
  },
6497
6497
  sponsor(t = {}) {
6498
- s.generate.event.onEventReceived("youtube", "sponsor-latest", t).then((e) => {
6499
- e && s.emulate.send("onEventReceived", e);
6498
+ e.generate.event.onEventReceived("youtube", "sponsor-latest", t).then((a) => {
6499
+ a && e.emulate.send("onEventReceived", a);
6500
6500
  });
6501
6501
  }
6502
6502
  },
6503
6503
  kick: {},
6504
6504
  facebook: {},
6505
- send(t, e) {
6506
- window.dispatchEvent(new CustomEvent(t, { detail: e }));
6505
+ send(t, a) {
6506
+ window.dispatchEvent(new CustomEvent(t, { detail: a }));
6507
6507
  }
6508
6508
  };
6509
- function a(t) {
6510
- return new Promise((e) => setTimeout(e, t));
6509
+ function s(t) {
6510
+ return new Promise((a) => setTimeout(a, t));
6511
+ }
6512
+ e.delay = s;
6513
+ function i(t) {
6514
+ return Object.entries(t);
6511
6515
  }
6512
- s.delay = a;
6513
- function n(t) {
6514
- const e = Object.values(t).reduce((u, h) => u + h, 0), i = Object.entries(t).sort((u, h) => h[1] - u[1]), r = Math.random() * e;
6515
- let d = 0;
6516
- for (const [u, h] of i)
6517
- if (d += h, r < d)
6516
+ e.typedEntries = i;
6517
+ function d(t) {
6518
+ const a = Object.values(t).reduce((u, l) => u + l, 0), n = i(t).sort((u, l) => l[1] - u[1]), r = Math.random() * a;
6519
+ let h = 0;
6520
+ for (const [u, l] of n)
6521
+ if (h += l, r < h)
6518
6522
  return u;
6519
6523
  }
6520
- s.probability = n;
6521
- async function o(t = ["fields.json", "cf.json", "field.json", "customfields.json"], e = ["data.json", "fielddata.json", "fd.json", "DATA.json"]) {
6522
- const i = {
6523
- fields: t.find((d) => {
6524
+ e.probability = d;
6525
+ async function o(t = ["fields.json", "cf.json", "field.json", "customfields.json"], a = ["data.json", "fielddata.json", "fd.json", "DATA.json"]) {
6526
+ const n = {
6527
+ fields: t.find((h) => {
6524
6528
  try {
6525
- return new URL("./" + d, window.location.href), !0;
6529
+ return new URL("./" + h, window.location.href), !0;
6526
6530
  } catch {
6527
6531
  return !1;
6528
6532
  }
6529
6533
  }),
6530
- data: e.find((d) => {
6534
+ data: a.find((h) => {
6531
6535
  try {
6532
- return new URL("./" + d, window.location.href), !0;
6536
+ return new URL("./" + h, window.location.href), !0;
6533
6537
  } catch {
6534
6538
  return !1;
6535
6539
  }
6536
6540
  })
6537
- }, r = await fetch("./" + (i.data ?? "data.json"), {
6541
+ }, r = await fetch("./" + (n.data ?? "data.json"), {
6538
6542
  cache: "no-store"
6539
- }).then((d) => d.json()).catch(() => ({}));
6540
- await fetch("./" + (i.fields ?? "fields.json"), {
6543
+ }).then((h) => h.json()).catch(() => ({}));
6544
+ await fetch("./" + (n.fields ?? "fields.json"), {
6541
6545
  cache: "no-store"
6542
- }).then((d) => d.json()).then(async (d) => {
6543
- const u = Object.entries(d).filter(([m, { value: g }]) => g != null).reduce(
6544
- (m, [g, { value: f }]) => (r && r[g] !== void 0 && (f = r[g]), m[g] = f, m),
6546
+ }).then((h) => h.json()).then(async (h) => {
6547
+ const u = Object.entries(h).filter(([g, { value: f }]) => f != null).reduce(
6548
+ (g, [f, { value: y }]) => (r && r[f] !== void 0 && (y = r[f]), g[f] = y, g),
6545
6549
  {
6546
6550
  ...r
6547
6551
  }
6548
- ), h = await s.generate.event.onWidgetLoad(u, await s.generate.session.get());
6549
- window.dispatchEvent(new CustomEvent("onWidgetLoad", { detail: h }));
6552
+ ), l = await e.generate.event.onWidgetLoad(u, await e.generate.session.get());
6553
+ window.dispatchEvent(new CustomEvent("onWidgetLoad", { detail: l }));
6550
6554
  });
6551
6555
  }
6552
- s.start = o;
6553
- })(T || (T = {}));
6554
- function V(s, a = T.data.emotes) {
6555
- const n = [];
6556
- return a.forEach((o) => {
6557
- const t = o.name;
6558
- let e = 0, i = 0;
6559
- for (; e < s.length; ) {
6560
- const r = s.indexOf(t, i);
6561
- if (r === -1) break;
6562
- const d = r > 0 ? s[r - 1] : " ", u = r + t.length < s.length ? s[r + t.length] : " ";
6563
- /\s/.test(d) && /\s/.test(u) && n.push({ ...o, start: r, end: r + t.length }), i = r + 1;
6556
+ e.start = o;
6557
+ })(D || (D = {}));
6558
+ function q(e, s = D.data.emotes) {
6559
+ const i = [];
6560
+ return s.forEach((d) => {
6561
+ const o = d.name;
6562
+ let t = 0, a = 0;
6563
+ for (; t < e.length; ) {
6564
+ const n = e.indexOf(o, a);
6565
+ if (n === -1) break;
6566
+ const r = n > 0 ? e[n - 1] : " ", h = n + o.length < e.length ? e[n + o.length] : " ";
6567
+ /\s/.test(r) && /\s/.test(h) && i.push({ ...d, start: n, end: n + o.length }), a = n + 1;
6564
6568
  }
6565
- }), n.sort((o, t) => o.start - t.start);
6569
+ }), i.sort((d, o) => d.start - o.start);
6566
6570
  }
6567
- function q(s, a) {
6568
- if (!a.length) return s;
6569
- let n = "", o = 0;
6570
- return a.forEach((t) => {
6571
- n += s.substring(o, t.start);
6572
- const i = Array.from({ ...t.urls, length: 5 }).slice(1).reverse().filter(Boolean)[0] || t.urls[1];
6573
- n += `<img src="${i}" alt="${t.name}" class="emote" style="width: auto; height: 1em; vertical-align: middle;" />`, o = t.end;
6574
- }), n += s.substring(o), n;
6571
+ function G(e, s) {
6572
+ if (!s.length) return e;
6573
+ let i = "", d = 0;
6574
+ return s.forEach((o) => {
6575
+ i += e.substring(d, o.start);
6576
+ const a = Array.from({ ...o.urls, length: 5 }).slice(1).reverse().filter(Boolean)[0] || o.urls[1];
6577
+ i += `<img src="${a}" alt="${o.name}" class="emote" style="width: auto; height: 1em; vertical-align: middle;" />`, d = o.end;
6578
+ }), i += e.substring(d), i;
6575
6579
  }
6576
- function ht(s, a = T.data.youtube_emotes) {
6577
- return Array.from(s.matchAll(/:(.*?):/gim), (o) => o[0]).forEach((o) => {
6578
- const t = a.find((e) => e.shortcuts.includes(o) || e.searchTerms.includes(o.slice(1, -1)));
6579
- if (t) {
6580
- const e = t.image.thumbnails.at(-1)?.url, i = t.image.accessibility.accessibilityData.label;
6581
- e && (s = s.replace(o, `<img src="${e}" alt="${i}" class="emote" style="width: auto; height: 1em; vertical-align: middle;" />`));
6580
+ function lt(e, s = D.data.youtube_emotes) {
6581
+ return Array.from(e.matchAll(/:(.*?):/gim), (d) => d[0]).forEach((d) => {
6582
+ const o = s.find((t) => t.shortcuts.includes(d) || t.searchTerms.includes(d.slice(1, -1)));
6583
+ if (o) {
6584
+ const t = o.image.thumbnails.at(-1)?.url, a = o.image.accessibility.accessibilityData.label;
6585
+ t && (e = e.replace(d, `<img src="${t}" alt="${a}" class="emote" style="width: auto; height: 1em; vertical-align: middle;" />`));
6582
6586
  }
6583
- }), s;
6587
+ }), e;
6584
6588
  }
6585
- async function G(s = [], a = "twitch") {
6586
- if (!Array.isArray(s) && typeof s == "string" && (s = s.split(",").map((i) => i.trim())), !s || !s.length) {
6587
- var n = T.rand.number(1, 3);
6588
- for await (const i of Array.from({ length: n }, () => "")) {
6589
- var o = T.rand.array(Object.keys(T.data.badges))[0];
6590
- !s.includes(o) && Array.isArray(s) ? s.push(o) : s = [o];
6589
+ async function S(e = [], s = "twitch") {
6590
+ if (!Array.isArray(e) && typeof e == "string" && (e = e.split(",").map((a) => a.trim())), !e || !e.length) {
6591
+ var i = D.rand.number(1, 3);
6592
+ for await (const a of Array.from({ length: i }, () => "")) {
6593
+ var d = D.rand.array(Object.keys(D.data.badges))[0];
6594
+ !e.includes(d) && Array.isArray(e) ? e.push(d) : e = [d];
6591
6595
  }
6592
6596
  }
6593
- var t;
6594
- switch (a) {
6597
+ var o;
6598
+ switch (s) {
6595
6599
  case "twitch": {
6596
- t = {
6597
- keys: Array.from(s).filter((i) => i in T.data.badges),
6598
- badges: Array.from(s).slice(0, 3).map((i) => T.data.badges[i]).filter(Boolean)
6600
+ o = {
6601
+ keys: Array.from(e).filter((a) => a in D.data.badges),
6602
+ badges: Array.from(e).slice(0, 3).map((a) => D.data.badges[a]).filter(Boolean)
6599
6603
  };
6600
6604
  break;
6601
6605
  }
6602
6606
  case "youtube": {
6603
- var e = {
6607
+ var t = {
6604
6608
  verified: { isVerified: !1 },
6605
6609
  broadcaster: { isChatOwner: !1 },
6606
6610
  host: { isChatOwner: !1 },
@@ -6608,8 +6612,8 @@ async function G(s = [], a = "twitch") {
6608
6612
  subscriber: { isChatSponsor: !1 },
6609
6613
  moderator: { isChatModerator: !1 }
6610
6614
  };
6611
- t = Object.entries(s).reduce(
6612
- (i, [r]) => (r in e && Object.assign(i, e[r]), i),
6615
+ o = Object.entries(e).reduce(
6616
+ (a, [n]) => (n in t && Object.assign(a, t[n]), a),
6613
6617
  {
6614
6618
  isVerified: !1,
6615
6619
  isChatOwner: !1,
@@ -6620,9 +6624,9 @@ async function G(s = [], a = "twitch") {
6620
6624
  break;
6621
6625
  }
6622
6626
  }
6623
- return t;
6627
+ return o;
6624
6628
  }
6625
- const S = {
6629
+ const F = {
6626
6630
  getOverlayStatus: () => ({
6627
6631
  isEditorMode: !1,
6628
6632
  muted: !1
@@ -6630,36 +6634,36 @@ const S = {
6630
6634
  resumeQueue: () => {
6631
6635
  },
6632
6636
  responses: {},
6633
- sendMessage(s, a) {
6637
+ sendMessage(e, s) {
6634
6638
  },
6635
6639
  counters: {
6636
- get(s) {
6640
+ get(e) {
6637
6641
  return null;
6638
6642
  }
6639
6643
  },
6640
- sanitize(s) {
6641
- return s;
6644
+ sanitize(e) {
6645
+ return e;
6642
6646
  },
6643
- cheerFilter(s) {
6644
- return s;
6647
+ cheerFilter(e) {
6648
+ return e;
6645
6649
  },
6646
- setField(s, a, n) {
6650
+ setField(e, s, i) {
6647
6651
  },
6648
6652
  store: {
6649
- set: function(s, a) {
6650
- this.list[s] = a, localStorage.setItem("SE_API-STORE", JSON.stringify(S.store.list));
6653
+ set: function(e, s) {
6654
+ this.list[e] = s, localStorage.setItem("SE_API-STORE", JSON.stringify(F.store.list));
6651
6655
  },
6652
- get: async function(s) {
6653
- return this.list[s] ? this.list[s] : null;
6656
+ get: async function(e) {
6657
+ return this.list[e] ? this.list[e] : null;
6654
6658
  },
6655
6659
  list: {}
6656
6660
  }
6657
6661
  };
6658
- async function lt() {
6659
- let s = localStorage.getItem("SE_API-STORE") ?? "", a = s ? JSON.parse(s) : {};
6660
- return S.store.list = a, S;
6662
+ async function mt() {
6663
+ let e = localStorage.getItem("SE_API-STORE") ?? "", s = e ? JSON.parse(e) : {};
6664
+ return F.store.list = s, F;
6661
6665
  }
6662
- class N {
6666
+ class W {
6663
6667
  /**
6664
6668
  * Stores registered event listeners.
6665
6669
  */
@@ -6670,63 +6674,63 @@ class N {
6670
6674
  * @param eventName The name of the event.
6671
6675
  * @param args Arguments to pass to the listeners.
6672
6676
  */
6673
- emit(a, ...n) {
6674
- return (this.registeredEvents[a] || []).map((t) => t.apply(this, n));
6677
+ emit(s, ...i) {
6678
+ return (this.registeredEvents[s] || []).map((o) => o.apply(this, i));
6675
6679
  }
6676
6680
  /**
6677
6681
  * Registers an event listener.
6678
6682
  * @param eventName The name of the event.
6679
6683
  * @param callback The callback function.
6680
6684
  */
6681
- on(a, n) {
6682
- if (typeof n != "function")
6685
+ on(s, i) {
6686
+ if (typeof i != "function")
6683
6687
  throw new TypeError("Callback must be a function");
6684
- return this.registeredEvents[a] || (this.registeredEvents[a] = []), this.registeredEvents[a].push(n), this;
6688
+ return this.registeredEvents[s] || (this.registeredEvents[s] = []), this.registeredEvents[s].push(i), this;
6685
6689
  }
6686
6690
  /**
6687
6691
  * Removes a specific event listener.
6688
6692
  * @param eventName The name of the event.
6689
6693
  * @param callback The callback function to remove.
6690
6694
  */
6691
- off(a, n) {
6692
- const o = this.registeredEvents[a] || [];
6693
- return n ? (this.registeredEvents[a] = o.filter((t) => t !== n), this) : (this.registeredEvents[a] = [], this);
6695
+ off(s, i) {
6696
+ const d = this.registeredEvents[s] || [];
6697
+ return i ? (this.registeredEvents[s] = d.filter((o) => o !== i), this) : (this.registeredEvents[s] = [], this);
6694
6698
  }
6695
6699
  /**
6696
6700
  * Registers a listener that is executed only once.
6697
6701
  * @param eventName The name of the event.
6698
6702
  * @param callback The callback function.
6699
6703
  */
6700
- once(a, n) {
6701
- const o = (...t) => {
6702
- this.off(a, o), n.apply(this, t);
6704
+ once(s, i) {
6705
+ const d = (...o) => {
6706
+ this.off(s, d), i.apply(this, o);
6703
6707
  };
6704
- return this.on(a, o), this;
6708
+ return this.on(s, d), this;
6705
6709
  }
6706
6710
  /**
6707
6711
  * Removes all listeners for a specific event.
6708
6712
  * @param eventName The name of the event.
6709
6713
  */
6710
- removeAllListeners(a) {
6711
- return this.registeredEvents[a] = [], this;
6714
+ removeAllListeners(s) {
6715
+ return this.registeredEvents[s] = [], this;
6712
6716
  }
6713
6717
  }
6714
- var O = [];
6715
- class W extends N {
6718
+ var N = [];
6719
+ class _ extends W {
6716
6720
  /**
6717
6721
  * The unique identifier for the storage instance.
6718
6722
  */
6719
6723
  id = "default";
6720
6724
  loaded = !1;
6721
6725
  data;
6722
- constructor(a) {
6723
- super(), this.id = a.id || this.id, this.data = a.data ?? {}, O.push(this), this.start();
6726
+ constructor(s) {
6727
+ super(), this.id = s.id || this.id, this.data = s.data ?? {}, N.push(this), this.start();
6724
6728
  }
6725
6729
  SE_API = null;
6726
6730
  start() {
6727
- K?.then((a) => {
6728
- this.SE_API = a, a.store.get(this.id).then((n) => {
6729
- this.data = n ?? this.data, this.loaded = !0, this.emit("load", this.data), JSON.stringify(this.data) !== JSON.stringify(n) && this.emit("update", this.data);
6731
+ Y?.then((s) => {
6732
+ this.SE_API = s, s.store.get(this.id).then((i) => {
6733
+ this.data = i ?? this.data, this.loaded = !0, this.emit("load", this.data), JSON.stringify(this.data) !== JSON.stringify(i) && this.emit("update", this.data);
6730
6734
  }).catch(() => {
6731
6735
  this.loaded = !0, this.emit("load", this.data);
6732
6736
  });
@@ -6736,23 +6740,23 @@ class W extends N {
6736
6740
  * Saves the current data to storage.
6737
6741
  * @param data Data to save (defaults to current)
6738
6742
  */
6739
- save(a = this.data) {
6740
- this.loaded && this.SE_API && (this.data = a, this.SE_API.store.set(this.id, this.data), this.emit("update", this.data));
6743
+ save(s = this.data) {
6744
+ this.loaded && this.SE_API && (this.data = s, this.SE_API.store.set(this.id, this.data), this.emit("update", this.data));
6741
6745
  }
6742
6746
  /**
6743
6747
  * Updates the storage data and emits an update event
6744
6748
  * @param data Data to update (defaults to current)
6745
6749
  */
6746
- update(a = this.data) {
6747
- this.loaded && JSON.stringify(this.data) !== JSON.stringify(a) && (this.data = { ...this.data, ...a }, this.save(this.data));
6750
+ update(s = this.data) {
6751
+ this.loaded && JSON.stringify(this.data) !== JSON.stringify(s) && (this.data = { ...this.data, ...s }, this.save(this.data));
6748
6752
  }
6749
6753
  /**
6750
6754
  * Adds a value to the storage at the specified path.
6751
6755
  * @param path Path to add the value to
6752
6756
  * @param value Value to add
6753
6757
  */
6754
- add(a, n) {
6755
- this.loaded && (W.setByPath(this.data, a, n), this.save(this.data));
6758
+ add(s, i) {
6759
+ this.loaded && (_.setByPath(this.data, s, i), this.save(this.data));
6756
6760
  }
6757
6761
  /**
6758
6762
  * Clears all data from the storage.
@@ -6767,25 +6771,25 @@ class W extends N {
6767
6771
  * @param value The value to set
6768
6772
  * @returns The updated object
6769
6773
  */
6770
- static setByPath(a, n, o) {
6771
- const t = n.split(".");
6772
- let e = a;
6773
- for (let i = 0; i < t.length - 1; i++)
6774
- (typeof e[t[i]] != "object" || e[t[i]] == null) && (e[t[i]] = {}), e = e[t[i]];
6775
- return e[t[t.length - 1]] = o, e;
6774
+ static setByPath(s, i, d) {
6775
+ const o = i.split(".");
6776
+ let t = s;
6777
+ for (let a = 0; a < o.length - 1; a++)
6778
+ (typeof t[o[a]] != "object" || t[o[a]] == null) && (t[o[a]] = {}), t = t[o[a]];
6779
+ return t[o[o.length - 1]] = d, t;
6776
6780
  }
6777
- on(a, n) {
6778
- return a === "load" && this.loaded ? (n.apply(this, [this.data]), this) : (super.on(a, n), this);
6781
+ on(s, i) {
6782
+ return s === "load" && this.loaded ? (i.apply(this, [this.data]), this) : (super.on(s, i), this);
6779
6783
  }
6780
6784
  }
6781
- class E extends N {
6785
+ class T extends W {
6782
6786
  id = "default";
6783
6787
  storage;
6784
6788
  fields = {};
6785
6789
  session;
6786
6790
  loaded = !1;
6787
- constructor(a) {
6788
- super(), this.id = a.id || this.id, this.storage = new W({
6791
+ constructor(s) {
6792
+ super(), this.id = s.id || this.id, this.storage = new _({
6789
6793
  id: this.id,
6790
6794
  data: {
6791
6795
  user: {},
@@ -6805,8 +6809,8 @@ class E extends N {
6805
6809
  pronoun: 60,
6806
6810
  emote: 120
6807
6811
  };
6808
- on(a, n) {
6809
- return a === "load" && this.loaded ? (n.apply(this, [
6812
+ on(s, i) {
6813
+ return s === "load" && this.loaded ? (i.apply(this, [
6810
6814
  {
6811
6815
  channel: this.details.user,
6812
6816
  currency: this.details.currency,
@@ -6823,10 +6827,10 @@ class E extends N {
6823
6827
  overlay: this.details.overlay,
6824
6828
  emulated: !1
6825
6829
  }
6826
- ]), this) : (super.on(a, n), this);
6830
+ ]), this) : (super.on(s, i), this);
6827
6831
  }
6828
6832
  }
6829
- class M {
6833
+ class L {
6830
6834
  prefix = "!";
6831
6835
  name;
6832
6836
  description;
@@ -6835,58 +6839,58 @@ class M {
6835
6839
  aliases = [];
6836
6840
  permissions = void 0;
6837
6841
  admins = [];
6838
- constructor(a) {
6839
- window.client instanceof E && (this.prefix = a.prefix ?? this.prefix, this.name = a.name, this.description = a.description ?? this.description, this.arguments = a.arguments ?? this.arguments, this.run = a.run, this.test = a.test ?? this.test, this.aliases = a.aliases ?? this.aliases, this.permissions = a.permissions ?? this.permissions, this.admins = a.admins ?? this.admins, window.client.actions.commands.push(this), window.client.emit("action", this, "created"));
6842
+ constructor(s) {
6843
+ window.client instanceof T && (this.prefix = s.prefix ?? this.prefix, this.name = s.name, this.description = s.description ?? this.description, this.arguments = s.arguments ?? this.arguments, this.run = s.run, this.test = s.test ?? this.test, this.aliases = s.aliases ?? this.aliases, this.permissions = s.permissions ?? this.permissions, this.admins = s.admins ?? this.admins, window.client.actions.commands.push(this), window.client.emit("action", this, "created"));
6840
6844
  }
6841
- run(a, n) {
6845
+ run(s, i) {
6842
6846
  }
6843
- verify(a, n, o) {
6844
- return this.arguments === !0 && (!o || !o.length) ? !1 : this.admins.some((t) => a.toLocaleLowerCase() === t.toLocaleLowerCase()) ? !0 : this.permissions === !0 || typeof this.permissions > "u" || Array.isArray(this.permissions) && !this.permissions.length ? !1 : !!(Array.isArray(this.permissions) && this.permissions.some((t) => a.toLowerCase() === t.toLowerCase() || n.map((e) => e.toLowerCase()).includes(t.toLowerCase())));
6847
+ verify(s, i, d) {
6848
+ return this.arguments === !0 && (!d || !d.length) ? !1 : this.admins.some((o) => s.toLocaleLowerCase() === o.toLocaleLowerCase()) ? !0 : this.permissions === !0 || typeof this.permissions > "u" || Array.isArray(this.permissions) && !this.permissions.length ? !1 : !!(Array.isArray(this.permissions) && this.permissions.some((o) => s.toLowerCase() === o.toLowerCase() || i.map((t) => t.toLowerCase()).includes(o.toLowerCase())));
6845
6849
  }
6846
- parse(a, n) {
6847
- if (!(window.client instanceof E)) return !1;
6848
- const o = a.replace(this.prefix, "").split(" ").slice(1).map((d) => d.trim());
6849
- var t = "", e = [];
6850
- const i = { bits: "cheer", premium: "prime" };
6851
- switch (n.provider) {
6850
+ parse(s, i) {
6851
+ if (!(window.client instanceof T)) return !1;
6852
+ const d = s.replace(this.prefix, "").split(" ").slice(1).map((r) => r.trim());
6853
+ var o = "", t = [];
6854
+ const a = { bits: "cheer", premium: "prime" };
6855
+ switch (i.provider) {
6852
6856
  case "twitch": {
6853
- const d = n.data;
6854
- t = d.event.data.nick || d.event.data.displayName, d.event.data.tags?.badges && (e = d.event.data.tags.badges.toString().replace(/\/\d+/g, "").split(",").map((h) => h in i ? i[h] : h));
6857
+ const r = i.data;
6858
+ o = r.event.data.nick || r.event.data.displayName, r.event.data.tags?.badges && (t = r.event.data.tags.badges.toString().replace(/\/\d+/g, "").split(",").map((u) => u in a ? a[u] : u));
6855
6859
  break;
6856
6860
  }
6857
6861
  case "youtube": {
6858
- const d = n.data, u = {
6862
+ const r = i.data, h = {
6859
6863
  isVerified: "verified",
6860
6864
  isChatOwner: "owner",
6861
6865
  isChatSponsor: "sponsor",
6862
6866
  isChatModerator: "moderator"
6863
6867
  };
6864
- t = d.event.data.nick || d.event.data.displayName, e = Object.entries(d.event.data.authorDetails).filter(([h, m]) => h.startsWith("is") && m).map(([h]) => u[h]).filter(Boolean);
6868
+ o = r.event.data.nick || r.event.data.displayName, t = Object.entries(r.event.data.authorDetails).filter(([u, l]) => u.startsWith("is") && l).map(([u]) => h[u]).filter(Boolean);
6865
6869
  break;
6866
6870
  }
6867
6871
  case "kick":
6868
6872
  return !1;
6869
6873
  }
6870
- const r = this.verify(t, e, o);
6871
- return r === !0 && this.run.apply(window.client, [o, n]), r;
6874
+ const n = this.verify(o, t, d);
6875
+ return n === !0 && this.run.apply(window.client, [d, i]), n;
6872
6876
  }
6873
6877
  remove() {
6874
- if (!(window.client instanceof E)) return;
6875
- const a = window.client.actions.commands.indexOf(this);
6876
- a > -1 && (window.client.actions.commands.splice(a, 1), window.client.emit("action", this, "removed"));
6878
+ if (!(window.client instanceof T)) return;
6879
+ const s = window.client.actions.commands.indexOf(this);
6880
+ s > -1 && (window.client.actions.commands.splice(s, 1), window.client.emit("action", this, "removed"));
6877
6881
  }
6878
- static execute(a) {
6879
- if (!(window.client instanceof E)) return !1;
6880
- const n = a.data;
6882
+ static execute(s) {
6883
+ if (!(window.client instanceof T)) return !1;
6884
+ const i = s.data;
6881
6885
  try {
6882
- if (window.client.actions.commands.length && window.client.actions.commands.some((o) => n.event.data.text.startsWith(o.prefix))) {
6883
- const o = window.client.actions.commands.filter((t) => {
6884
- var e = [t.name, ...t.aliases ?? []], i = n.event.data.text.replace(t.prefix, "").split(" ")[0];
6885
- return e.includes(i);
6886
+ if (window.client.actions.commands.length && window.client.actions.commands.some((d) => i.event.data.text.startsWith(d.prefix))) {
6887
+ const d = window.client.actions.commands.filter((o) => {
6888
+ var t = [o.name, ...o.aliases ?? []], a = i.event.data.text.replace(o.prefix, "").split(" ")[0];
6889
+ return t.includes(a);
6886
6890
  });
6887
- if (o.length && o.every((t) => t instanceof M))
6888
- return o.forEach((t) => {
6889
- t.parse(n.event.data.text, a), window.client.emit("action", t, "executed"), J.received(`Command executed: ${n.event.data.text} by ${n.event.data.nick || n.event.data.displayName}`, n);
6891
+ if (d.length && d.every((o) => o instanceof L))
6892
+ return d.forEach((o) => {
6893
+ o.parse(i.event.data.text, s), window.client.emit("action", o, "executed"), z.received(`Command executed: ${i.event.data.text} by ${i.event.data.nick || i.event.data.displayName}`, i);
6890
6894
  }), !0;
6891
6895
  }
6892
6896
  } catch {
@@ -6896,7 +6900,7 @@ class M {
6896
6900
  }
6897
6901
  }
6898
6902
  }
6899
- class mt extends N {
6903
+ class ut extends W {
6900
6904
  queue = [];
6901
6905
  priorityQueue = [];
6902
6906
  history = [];
@@ -6905,20 +6909,20 @@ class mt extends N {
6905
6909
  duration = void 0;
6906
6910
  loaded = !1;
6907
6911
  processor;
6908
- constructor(a) {
6909
- window.client instanceof E && (super(), this.duration = a.duration, this.processor = a.processor, window.client.on("load", () => {
6912
+ constructor(s) {
6913
+ window.client instanceof T && (super(), this.duration = s.duration, this.processor = s.processor, window.client.on("load", () => {
6910
6914
  this.emit("load"), this.loaded = !0;
6911
6915
  }));
6912
6916
  }
6913
- enqueue(a, n = {}) {
6914
- const o = {
6917
+ enqueue(s, i = {}) {
6918
+ const d = {
6915
6919
  isoDate: (/* @__PURE__ */ new Date()).toISOString(),
6916
- isLoop: n?.isLoop ?? !1,
6917
- isPriority: n?.isPriority ?? !1,
6918
- isImmediate: n?.isImmediate ?? !1,
6919
- value: a
6920
- }, t = this.hasItems();
6921
- return o.isPriority && o.isImmediate ? (this.cancel(), this.priorityQueue.unshift(o)) : (o.isPriority ? this.priorityQueue : this.queue).push(o), this.running === !1 && t === !1 && this.run(), this.emit("update", this.queue, this.priorityQueue, this.history, this.timeouts), this;
6920
+ isLoop: i?.isLoop ?? !1,
6921
+ isPriority: i?.isPriority ?? !1,
6922
+ isImmediate: i?.isImmediate ?? !1,
6923
+ value: s
6924
+ }, o = this.hasItems();
6925
+ return d.isPriority && d.isImmediate ? (this.cancel(), this.priorityQueue.unshift(d)) : (d.isPriority ? this.priorityQueue : this.queue).push(d), this.running === !1 && o === !1 && this.run(), this.emit("update", this.queue, this.priorityQueue, this.history, this.timeouts), this;
6922
6926
  }
6923
6927
  async run() {
6924
6928
  if (!this.hasItems()) {
@@ -6928,68 +6932,68 @@ class mt extends N {
6928
6932
  this.running = !0, await this.next(), typeof this.duration == "number" && this.duration > 0 ? this.timeouts.push(setTimeout(() => this.run(), this.duration)) : (this.duration === 0 || this.duration !== -1 && this.duration !== !1) && this.run();
6929
6933
  }
6930
6934
  async next() {
6931
- const a = this.priorityQueue.length > 0 ? this.priorityQueue.shift() : this.queue.shift();
6932
- if (!a) {
6935
+ const s = this.priorityQueue.length > 0 ? this.priorityQueue.shift() : this.queue.shift();
6936
+ if (!s) {
6933
6937
  this.running = !1;
6934
6938
  return;
6935
6939
  }
6936
6940
  try {
6937
- await this.processor.apply(this, [a.value, this]), this.emit("process", a, this);
6938
- } catch (o) {
6939
- J.error(`Error during item processing: ${o instanceof Error ? o.message : String(o)}`);
6941
+ await this.processor.apply(this, [s.value, this]), this.emit("process", s, this);
6942
+ } catch (d) {
6943
+ z.error(`Error during item processing: ${d instanceof Error ? d.message : String(d)}`);
6940
6944
  }
6941
- this.history.push(a);
6942
- const n = a.isPriority ? this.priorityQueue : this.queue;
6943
- a.isLoop && n.push(a);
6945
+ this.history.push(s);
6946
+ const i = s.isPriority ? this.priorityQueue : this.queue;
6947
+ s.isLoop && i.push(s);
6944
6948
  }
6945
6949
  resume() {
6946
6950
  return this.running && this.cancel(), this.hasItems() && this.run(), this;
6947
6951
  }
6948
- update(a) {
6949
- return this.queue = a.queue ?? this.queue, this.priorityQueue = a.priorityQueue ?? this.priorityQueue, this.history = a.history ?? this.history, this.hasItems() && this.running === !1 && window.client?.on("load", () => this.run()), this;
6952
+ update(s) {
6953
+ return this.queue = s.queue ?? this.queue, this.priorityQueue = s.priorityQueue ?? this.priorityQueue, this.history = s.history ?? this.history, this.hasItems() && this.running === !1 && window.client?.on("load", () => this.run()), this;
6950
6954
  }
6951
6955
  cancel() {
6952
- this.running && (this.timeouts.forEach((a) => clearTimeout(a)), this.timeouts = [], this.running = !1, this.emit("cancel"));
6956
+ this.running && (this.timeouts.forEach((s) => clearTimeout(s)), this.timeouts = [], this.running = !1, this.emit("cancel"));
6953
6957
  }
6954
6958
  hasItems() {
6955
6959
  return this.queue.length > 0 || this.priorityQueue.length > 0;
6956
6960
  }
6957
- on(a, n) {
6958
- return a === "load" && this.loaded ? (n.apply(this), this) : (super.on(a, n), this);
6961
+ on(s, i) {
6962
+ return s === "load" && this.loaded ? (i.apply(this), this) : (super.on(s, i), this);
6959
6963
  }
6960
6964
  }
6961
- class _ {
6965
+ class V {
6962
6966
  field = "button";
6963
6967
  template = "button";
6964
6968
  run;
6965
- constructor(a) {
6966
- window.client instanceof E && (this.field = a.field ?? this.field, this.template = a.template ?? this.template, this.run = a.run, window.client.actions.buttons.push(this), window.client.emit("action", this, "created"));
6969
+ constructor(s) {
6970
+ window.client instanceof T && (this.field = s.field ?? this.field, this.template = s.template ?? this.template, this.run = s.run, window.client.actions.buttons.push(this), window.client.emit("action", this, "created"));
6967
6971
  }
6968
- parse(a, n) {
6969
- var o = a.replace(typeof this.field == "string" ? this.field : this.template.replace(/\{[^}]*\}/g, "") ?? "", "").trim();
6972
+ parse(s, i) {
6973
+ var d = s.replace(typeof this.field == "string" ? this.field : this.template.replace(/\{[^}]*\}/g, "") ?? "", "").trim();
6970
6974
  try {
6971
- this.run.apply(window.client, [o.length ? o : a ?? a, n]);
6972
- } catch (t) {
6973
- throw new Error(`Error running button "${this.field}": ${t instanceof Error ? t.message : t}`);
6975
+ this.run.apply(window.client, [d.length ? d : s ?? s, i]);
6976
+ } catch (o) {
6977
+ throw new Error(`Error running button "${this.field}": ${o instanceof Error ? o.message : o}`);
6974
6978
  }
6975
6979
  return this;
6976
6980
  }
6977
6981
  remove() {
6978
- if (!(window.client instanceof E)) return;
6979
- const a = window.client.actions.buttons.indexOf(this);
6980
- a > -1 && (window.client.actions.buttons.splice(a, 1), window.client.emit("action", this, "removed"));
6982
+ if (!(window.client instanceof T)) return;
6983
+ const s = window.client.actions.buttons.indexOf(this);
6984
+ s > -1 && (window.client.actions.buttons.splice(s, 1), window.client.emit("action", this, "removed"));
6981
6985
  }
6982
- static execute(a, n) {
6986
+ static execute(s, i) {
6983
6987
  try {
6984
- if (!(window.client instanceof E)) return !1;
6988
+ if (!(window.client instanceof T)) return !1;
6985
6989
  if (window.client.actions.buttons.length) {
6986
- const o = window.client.actions.buttons.filter((t) => typeof t.field == "string" ? t.field === a : typeof t.field == "function" ? t.field(a, n) : !1);
6987
- if (o.length && o.every((t) => t instanceof _))
6988
- return o.forEach((t) => {
6990
+ const d = window.client.actions.buttons.filter((o) => typeof o.field == "string" ? o.field === s : typeof o.field == "function" ? o.field(s, i) : !1);
6991
+ if (d.length && d.every((o) => o instanceof V))
6992
+ return d.forEach((o) => {
6989
6993
  try {
6990
- t.parse(a, n), window.client.emit("action", t, "executed"), J.received(`Button executed: ${a}${n ? ` with value: ${n}` : ""}`);
6991
- } catch (e) {
6992
- J.error(`Error executing button "${a}": ${e instanceof Error ? e.message : e}`);
6994
+ o.parse(s, i), window.client.emit("action", o, "executed"), z.received(`Button executed: ${s}${i ? ` with value: ${i}` : ""}`);
6995
+ } catch (t) {
6996
+ z.error(`Error executing button "${s}": ${t instanceof Error ? t.message : t}`);
6993
6997
  }
6994
6998
  }), !0;
6995
6999
  }
@@ -7000,7 +7004,7 @@ class _ {
7000
7004
  }
7001
7005
  }
7002
7006
  }
7003
- class B {
7007
+ class K {
7004
7008
  enabled;
7005
7009
  prefix;
7006
7010
  error = this.apply({
@@ -7069,244 +7073,244 @@ class B {
7069
7073
  fontSize: 14,
7070
7074
  icon: "☼"
7071
7075
  });
7072
- constructor(a = {}) {
7073
- this.enabled = a.enabled ?? !0, this.prefix = a.prefix ? `[${a.prefix}]` : "";
7076
+ constructor(s = {}) {
7077
+ this.enabled = s.enabled ?? !0, this.prefix = s.prefix ? `[${s.prefix}]` : "";
7074
7078
  }
7075
- apply(a) {
7076
- const n = this.style(a), o = a.icon ? `${a.icon} ` : "";
7077
- return (...t) => {
7079
+ apply(s) {
7080
+ const i = this.style(s), d = s.icon ? `${s.icon} ` : "";
7081
+ return (...o) => {
7078
7082
  if (!this.enabled || typeof console > "u") return;
7079
- const e = this.prefix ? `${this.prefix} ` : "", i = [], r = [];
7080
- if (t.forEach((d) => {
7081
- typeof d == "string" || typeof d == "number" || typeof d == "boolean" ? i.push(d) : r.push(d);
7082
- }), i.length > 0) {
7083
- const d = i.join(" ");
7084
- console.log(`%c${o}${e}${d}`, n, ...r);
7085
- } else r.length > 0 && console.log(`%c${o}${e}`, n, ...r);
7083
+ const t = this.prefix ? `${this.prefix} ` : "", a = [], n = [];
7084
+ if (o.forEach((r) => {
7085
+ typeof r == "string" || typeof r == "number" || typeof r == "boolean" ? a.push(r) : n.push(r);
7086
+ }), a.length > 0) {
7087
+ const r = a.join(" ");
7088
+ console.log(`%c${d}${t}${r}`, i, ...n);
7089
+ } else n.length > 0 && console.log(`%c${d}${t}`, i, ...n);
7086
7090
  };
7087
7091
  }
7088
- style(a) {
7089
- const n = [];
7090
- return a.background && a.background !== "transparent" && (n.push(`background: ${a.background}`), n.push("padding: 2px 6px"), n.push("border-radius: 3px")), a.color && n.push(`color: ${a.color}`), a.bold && n.push("font-weight: bold"), a.italic && n.push("font-style: italic"), a.fontSize && n.push(`font-size: ${a.fontSize}px`), n.join("; ");
7092
+ style(s) {
7093
+ const i = [];
7094
+ return s.background && s.background !== "transparent" && (i.push(`background: ${s.background}`), i.push("padding: 2px 6px"), i.push("border-radius: 3px")), s.color && i.push(`color: ${s.color}`), s.bold && i.push("font-weight: bold"), s.italic && i.push("font-style: italic"), s.fontSize && i.push(`font-size: ${s.fontSize}px`), i.join("; ");
7091
7095
  }
7092
- group(a) {
7093
- !this.enabled || !console.group || console.group(a);
7096
+ group(s) {
7097
+ !this.enabled || !console.group || console.group(s);
7094
7098
  }
7095
- groupCollapsed(a) {
7096
- !this.enabled || !console.groupCollapsed || console.groupCollapsed(a);
7099
+ groupCollapsed(s) {
7100
+ !this.enabled || !console.groupCollapsed || console.groupCollapsed(s);
7097
7101
  }
7098
7102
  groupEnd() {
7099
7103
  !this.enabled || !console.groupEnd || console.groupEnd();
7100
7104
  }
7101
- table(a) {
7102
- !this.enabled || !console.table || console.table(a);
7105
+ table(s) {
7106
+ !this.enabled || !console.table || console.table(s);
7103
7107
  }
7104
- time(a) {
7105
- !this.enabled || !console.time || console.time(a);
7108
+ time(s) {
7109
+ !this.enabled || !console.time || console.time(s);
7106
7110
  }
7107
- timeEnd(a) {
7108
- !this.enabled || !console.timeEnd || console.timeEnd(a);
7111
+ timeEnd(s) {
7112
+ !this.enabled || !console.timeEnd || console.timeEnd(s);
7109
7113
  }
7110
7114
  }
7111
7115
  window.addEventListener("load", () => {
7112
7116
  });
7113
- window.addEventListener("onWidgetLoad", async (s) => {
7114
- const { detail: a } = s;
7115
- if (window.client instanceof E) {
7116
- const n = window.client;
7117
- n.fields = a.fieldData, n.session = a.session.data, n.details = {
7118
- ...n.details,
7119
- user: a.channel,
7120
- currency: a.currency,
7121
- overlay: a.overlay
7122
- }, a.channel.id && !a.emulated ? await fetch(`https://api.streamelements.com/kappa/v2/channels/${a.channel.id}/`).then((o) => o.json()).then((o) => {
7123
- if (o.provider)
7124
- return n.details.provider = o.provider, o.provider;
7125
- n.details.provider = "local";
7117
+ window.addEventListener("onWidgetLoad", async (e) => {
7118
+ const { detail: s } = e;
7119
+ if (window.client instanceof T) {
7120
+ const i = window.client;
7121
+ i.fields = s.fieldData, i.session = s.session.data, i.details = {
7122
+ ...i.details,
7123
+ user: s.channel,
7124
+ currency: s.currency,
7125
+ overlay: s.overlay
7126
+ }, s.channel.id && !s.emulated ? await fetch(`https://api.streamelements.com/kappa/v2/channels/${s.channel.id}/`).then((d) => d.json()).then((d) => {
7127
+ if (d.provider)
7128
+ return i.details.provider = d.provider, d.provider;
7129
+ i.details.provider = "local";
7126
7130
  }).catch(() => {
7127
- n.details.provider = "local";
7128
- }) : n.details.provider = "local", n.emit("load", a), n.loaded = !0, n.storage.on("load", (o) => {
7129
- if (o) {
7130
- const t = (u) => {
7131
- const h = Date.now(), m = {};
7132
- for (const g in u)
7133
- if (u.hasOwnProperty(g)) {
7134
- const f = u[g];
7135
- f.expire && f.expire > h && (m[g] = f);
7131
+ i.details.provider = "local";
7132
+ }) : i.details.provider = "local", i.emit("load", s), i.loaded = !0, i.storage.on("load", (d) => {
7133
+ if (d) {
7134
+ const o = (h) => {
7135
+ const u = Date.now(), l = {};
7136
+ for (const g in h)
7137
+ if (h.hasOwnProperty(g)) {
7138
+ const f = h[g];
7139
+ f.expire && f.expire > u && (l[g] = f);
7136
7140
  }
7137
- return m;
7138
- }, e = t(o.user || {}), i = t(o.avatar || {}), r = t(o.pronoun || {}), d = t(o.emote || {});
7139
- n.storage.update({
7140
- user: e,
7141
- avatar: i,
7142
- pronoun: r,
7143
- emote: d
7141
+ return l;
7142
+ }, t = o(d.user || {}), a = o(d.avatar || {}), n = o(d.pronoun || {}), r = o(d.emote || {});
7143
+ i.storage.update({
7144
+ user: t,
7145
+ avatar: a,
7146
+ pronoun: n,
7147
+ emote: r
7144
7148
  });
7145
7149
  }
7146
- a.channel.providerId.length && n.storage.add(`avatar.${a.channel.providerId.toLowerCase()}`, {
7147
- value: a.channel.avatar,
7150
+ s.channel.providerId.length && i.storage.add(`avatar.${s.channel.providerId.toLowerCase()}`, {
7151
+ value: s.channel.avatar,
7148
7152
  timestamp: Date.now(),
7149
- expire: Date.now() + n.cache.avatar * 60 * 1e3
7153
+ expire: Date.now() + i.cache.avatar * 60 * 1e3
7150
7154
  });
7151
7155
  });
7152
7156
  }
7153
7157
  });
7154
- window.addEventListener("onSessionUpdate", (s) => {
7155
- const { detail: a } = s;
7156
- if (window.client instanceof E) {
7157
- const n = window.client;
7158
- n.session = a.session, n.emit("session", a.session);
7158
+ window.addEventListener("onSessionUpdate", (e) => {
7159
+ const { detail: s } = e;
7160
+ if (window.client instanceof T) {
7161
+ const i = window.client;
7162
+ i.session = s.session, i.emit("session", s.session);
7159
7163
  }
7160
7164
  });
7161
- window.addEventListener("onEventReceived", ({ detail: s }) => {
7162
- if (window.client instanceof E) {
7163
- var a = s.event?.provider || s.event?.service || s.event?.data?.provider || window.client.details.provider;
7164
- ["kvstore:update", "bot:counter", "alertService:toggleSound", "event:skip", "tip-latest", "event:test"].some((e) => e === s.listener) && (a = "streamelements");
7165
- const t = { provider: a, data: s };
7166
- switch (t.provider) {
7165
+ window.addEventListener("onEventReceived", ({ detail: e }) => {
7166
+ if (window.client instanceof T) {
7167
+ var s = e.event?.provider || e.event?.service || e.event?.data?.provider || window.client.details.provider;
7168
+ ["kvstore:update", "bot:counter", "alertService:toggleSound", "event:skip", "tip-latest", "event:test"].some((t) => t === e.listener) && (s = "streamelements");
7169
+ const o = { provider: s, data: e };
7170
+ switch (o.provider) {
7167
7171
  case "streamelements": {
7168
- const e = t.data;
7169
- switch (e.listener) {
7172
+ const t = o.data;
7173
+ switch (t.listener) {
7170
7174
  case "tip-latest": {
7171
- e.event;
7175
+ t.event;
7172
7176
  break;
7173
7177
  }
7174
7178
  case "event:skip": {
7175
- e.event;
7179
+ t.event;
7176
7180
  break;
7177
7181
  }
7178
7182
  case "event:test": {
7179
- switch (e.event.listener) {
7183
+ switch (t.event.listener) {
7180
7184
  case "widget-button": {
7181
- const i = e.event;
7182
- _.execute(i.field, i.value);
7185
+ const a = t.event;
7186
+ V.execute(a.field, a.value);
7183
7187
  break;
7184
7188
  }
7185
7189
  case "subscriber-latest": {
7186
- e.event;
7190
+ t.event;
7187
7191
  break;
7188
7192
  }
7189
7193
  }
7190
7194
  break;
7191
7195
  }
7192
7196
  case "kvstore:update": {
7193
- const i = e.event;
7194
- if (O.length) {
7195
- var n = O.find((r) => r.id === i.data.key.replace("customWidget.", ""));
7196
- n && n.update(i.data.value);
7197
+ const a = t.event;
7198
+ if (N.length) {
7199
+ var i = N.find((n) => n.id === a.data.key.replace("customWidget.", ""));
7200
+ i && i.update(a.data.value);
7197
7201
  }
7198
7202
  break;
7199
7203
  }
7200
7204
  case "bot:counter": {
7201
- e.event;
7205
+ t.event;
7202
7206
  break;
7203
7207
  }
7204
7208
  case "alertService:toggleSound": {
7205
- const i = e.event;
7206
- client.details.overlay.muted = !!i.muted;
7209
+ const a = t.event;
7210
+ client.details.overlay.muted = !!a.muted;
7207
7211
  break;
7208
7212
  }
7209
7213
  }
7210
- window.client.emit("event", "streamelements", t.data);
7214
+ window.client.emit("event", "streamelements", o.data);
7211
7215
  break;
7212
7216
  }
7213
7217
  case "twitch": {
7214
- const e = t.data;
7215
- switch (e.listener) {
7218
+ const t = o.data;
7219
+ switch (t.listener) {
7216
7220
  case "delete-message": {
7217
- e.event;
7221
+ t.event;
7218
7222
  break;
7219
7223
  }
7220
7224
  case "delete-messages": {
7221
- e.event;
7225
+ t.event;
7222
7226
  break;
7223
7227
  }
7224
7228
  case "message": {
7225
- e.event, M.execute({ provider: "twitch", data: e });
7229
+ t.event, L.execute({ provider: "twitch", data: t });
7226
7230
  break;
7227
7231
  }
7228
7232
  case "follower-latest": {
7229
- e.event;
7233
+ t.event;
7230
7234
  break;
7231
7235
  }
7232
7236
  case "cheer-latest": {
7233
- e.event;
7237
+ t.event;
7234
7238
  break;
7235
7239
  }
7236
7240
  case "subscriber-latest": {
7237
- (!e.event.gifted && !e.event.bulkGifted && !e.event.isCommunityGift || e.event.gifted && !e.event.bulkGifted && !e.event.isCommunityGift || e.event.gifted && !e.event.bulkGifted && e.event.isCommunityGift || !e.event.gifted && e.event.bulkGifted && !e.event.isCommunityGift) && e.event;
7241
+ (!t.event.gifted && !t.event.bulkGifted && !t.event.isCommunityGift || t.event.gifted && !t.event.bulkGifted && !t.event.isCommunityGift || t.event.gifted && !t.event.bulkGifted && t.event.isCommunityGift || !t.event.gifted && t.event.bulkGifted && !t.event.isCommunityGift) && t.event;
7238
7242
  break;
7239
7243
  }
7240
7244
  case "raid-latest": {
7241
- e.event;
7245
+ t.event;
7242
7246
  break;
7243
7247
  }
7244
7248
  }
7245
- window.client.emit("event", "twitch", t.data);
7249
+ window.client.emit("event", "twitch", o.data);
7246
7250
  break;
7247
7251
  }
7248
7252
  case "youtube": {
7249
- const e = t.data;
7250
- switch (e.listener) {
7253
+ const t = o.data;
7254
+ switch (t.listener) {
7251
7255
  case "message": {
7252
- e.event, M.execute({ provider: "youtube", data: e });
7256
+ t.event, L.execute({ provider: "youtube", data: t });
7253
7257
  break;
7254
7258
  }
7255
7259
  case "subscriber-latest": {
7256
- e.event;
7260
+ t.event;
7257
7261
  break;
7258
7262
  }
7259
7263
  case "sponsor-latest": {
7260
- e.event, (!e.event.gifted && !e.event.bulkGifted && !e.event.isCommunityGift || e.event.gifted && !e.event.bulkGifted && !e.event.isCommunityGift || e.event.gifted && !e.event.bulkGifted && e.event.isCommunityGift || !e.event.gifted && e.event.bulkGifted && !e.event.isCommunityGift) && e.event;
7264
+ t.event, (!t.event.gifted && !t.event.bulkGifted && !t.event.isCommunityGift || t.event.gifted && !t.event.bulkGifted && !t.event.isCommunityGift || t.event.gifted && !t.event.bulkGifted && t.event.isCommunityGift || !t.event.gifted && t.event.bulkGifted && !t.event.isCommunityGift) && t.event;
7261
7265
  break;
7262
7266
  }
7263
7267
  case "superchat-latest": {
7264
- e.event;
7268
+ t.event;
7265
7269
  break;
7266
7270
  }
7267
7271
  }
7268
- window.client.emit("event", "youtube", t.data);
7272
+ window.client.emit("event", "youtube", o.data);
7269
7273
  break;
7270
7274
  }
7271
7275
  case "kick": {
7272
- window.client.emit("event", "kick", t.data);
7276
+ window.client.emit("event", "kick", o.data);
7273
7277
  break;
7274
7278
  }
7275
7279
  case "facebook": {
7276
- window.client.emit("event", "facebook", t.data);
7280
+ window.client.emit("event", "facebook", o.data);
7277
7281
  break;
7278
7282
  }
7279
7283
  }
7280
7284
  }
7281
7285
  });
7282
- const K = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(lt()), J = new B(), ut = {
7283
- Client: E,
7284
- USE_SE_API: K,
7285
- Simulation: T,
7286
- logger: J,
7287
- Alejo: R,
7286
+ const Y = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(mt()), z = new K(), gt = {
7287
+ Client: T,
7288
+ USE_SE_API: Y,
7289
+ Simulation: D,
7290
+ logger: z,
7291
+ Alejo: O,
7288
7292
  utils: {
7289
- findEmotesInText: V,
7290
- replaceEmotesWithHTML: q,
7291
- replaceYoutubeEmotesWithHTML: ht,
7292
- generateBadges: G
7293
+ findEmotesInText: q,
7294
+ replaceEmotesWithHTML: G,
7295
+ replaceYoutubeEmotesWithHTML: lt,
7296
+ generateBadges: S
7293
7297
  },
7294
7298
  modules: {
7295
- Button: _,
7296
- Command: M,
7297
- EventProvider: N,
7298
- useStorage: W,
7299
- useQueue: mt,
7300
- Logger: B
7299
+ Button: V,
7300
+ Command: L,
7301
+ EventProvider: W,
7302
+ useStorage: _,
7303
+ useQueue: ut,
7304
+ Logger: K
7301
7305
  },
7302
7306
  data: {
7303
- usedStorages: O
7307
+ usedStorages: N
7304
7308
  }
7305
7309
  };
7306
- typeof window < "u" && (window.Tixyel = ut);
7310
+ typeof window < "u" && (window.Tixyel = gt);
7307
7311
  export {
7308
- ut as Tixyel,
7309
- K as USE_SE_API,
7310
- J as logger
7312
+ gt as Tixyel,
7313
+ Y as USE_SE_API,
7314
+ z as logger
7311
7315
  };
7312
7316
  //# sourceMappingURL=index.es.js.map