@tixyel/streamelements 6.0.3 → 6.2.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
- class Z {
1
+ class X {
2
2
  constructor() {
3
3
  this.registeredEvents = {};
4
4
  }
@@ -49,15 +49,12 @@ class Z {
49
49
  return this.registeredEvents[e] = [], this;
50
50
  }
51
51
  }
52
- var tt = [];
53
- class et extends Z {
52
+ const tt = [];
53
+ class it extends X {
54
54
  constructor(e) {
55
- super(), this.id = "default", this.loaded = !1, this.SE_API = null, this.id = e.id || this.id, this.data = e.data ?? {}, tt.push(this), this.start();
56
- }
57
- start() {
58
- gt?.then((e) => {
59
- this.SE_API = e, e.store.get(this.id).then((t) => {
60
- this.data = t ?? this.data, this.loaded = !0, this.emit("load", this.data), JSON.stringify(this.data) !== JSON.stringify(t) && this.emit("update", this.data);
55
+ super(), this.SE_API = null, this.id = "default", this.loaded = !1, this.id = e.id || this.id, this.data = e.data ?? {}, tt.push(this), ct?.then((t) => {
56
+ this.SE_API = t, t.store.get(this.id).then((a) => {
57
+ this.data = a ?? this.data, this.loaded = !0, this.emit("load", this.data), JSON.stringify(this.data) !== JSON.stringify(a) && this.emit("update", this.data);
61
58
  }).catch(() => {
62
59
  this.loaded = !0, this.emit("load", this.data);
63
60
  });
@@ -86,7 +83,7 @@ class et extends Z {
86
83
  * @param value Value to add
87
84
  */
88
85
  add(e, t) {
89
- this.loaded && (et.setByPath(this.data, e, t), this.save(this.data));
86
+ this.loaded && (it.setByPath(this.data, e, t), this.save(this.data));
90
87
  }
91
88
  /**
92
89
  * Clears all data from the storage.
@@ -112,7 +109,7 @@ class et extends Z {
112
109
  return e === "load" && this.loaded ? (t.apply(this, [this.data]), this) : (super.on(e, t), this);
113
110
  }
114
111
  }
115
- class G extends Z {
112
+ class G extends X {
116
113
  constructor(e) {
117
114
  super(), this.id = "default", this.debug = !1, this.fields = {}, this.loaded = !1, this.actions = {
118
115
  commands: [],
@@ -121,7 +118,7 @@ class G extends Z {
121
118
  avatar: 30,
122
119
  pronoun: 60,
123
120
  emote: 120
124
- }, this.id = e.id || this.id, this.storage = new et({
121
+ }, this.id = e.id || this.id, this.storage = new it({
125
122
  id: this.id,
126
123
  data: {
127
124
  user: {},
@@ -154,7 +151,7 @@ class G extends Z {
154
151
  ]), this) : (super.on(e, t), this);
155
152
  }
156
153
  }
157
- class Q {
154
+ class Z {
158
155
  constructor(e) {
159
156
  this.prefix = "!", this.arguments = !1, this.test = `${this.prefix}${this.name} arg1 arg2`, this.aliases = [], this.permissions = void 0, this.admins = [], window.client instanceof G && (this.prefix = e.prefix ?? this.prefix, this.name = e.name, this.description = e.description ?? this.description, this.arguments = e.arguments ?? this.arguments, this.run = e.run, this.test = e.test ?? this.test, this.aliases = e.aliases ?? this.aliases, this.permissions = e.permissions ?? this.permissions, this.admins = e.admins ?? this.admins, window.client.actions.commands.push(this), window.client.emit("action", this, "created"));
160
157
  }
@@ -165,30 +162,30 @@ class Q {
165
162
  }
166
163
  parse(e, t) {
167
164
  if (!(window.client instanceof G)) return !1;
168
- const a = e.replace(this.prefix, "").split(" ").slice(1).map((o) => o.trim());
165
+ const a = e.replace(this.prefix, "").split(" ").slice(1).map((c) => c.trim());
169
166
  var i = "", s = [];
170
167
  const n = { bits: "cheer", premium: "prime" };
171
168
  switch (t.provider) {
172
169
  case "twitch": {
173
- const o = t.data;
174
- i = o.event.data.nick || o.event.data.displayName, o.event.data.tags?.badges && (s = o.event.data.tags.badges.toString().replace(/\/\d+/g, "").split(",").map((g) => g in n ? n[g] : g));
170
+ const c = t.data;
171
+ i = c.event.data.nick || c.event.data.displayName, c.event.data.tags?.badges && (s = c.event.data.tags.badges.toString().replace(/\/\d+/g, "").split(",").map((u) => u in n ? n[u] : u));
175
172
  break;
176
173
  }
177
174
  case "youtube": {
178
- const o = t.data, b = {
175
+ const c = t.data, f = {
179
176
  isVerified: "verified",
180
177
  isChatOwner: "owner",
181
178
  isChatSponsor: "sponsor",
182
179
  isChatModerator: "moderator"
183
180
  };
184
- i = o.event.data.nick || o.event.data.displayName, s = Object.entries(o.event.data.authorDetails).filter(([g, c]) => g.startsWith("is") && c).map(([g]) => b[g]).filter(Boolean), s.includes("sponsor") && (s.push("premium"), s.push("prime")), s.includes("owner") && (s.push("moderator"), s.push("broadcaster"));
181
+ i = c.event.data.nick || c.event.data.displayName, s = Object.entries(c.event.data.authorDetails).filter(([u, o]) => u.startsWith("is") && o).map(([u]) => f[u]).filter(Boolean), s.includes("sponsor") && (s.push("premium"), s.push("prime")), s.includes("owner") && (s.push("moderator"), s.push("broadcaster"));
185
182
  break;
186
183
  }
187
184
  case "kick":
188
185
  return !1;
189
186
  }
190
- const m = this.verify(i, s, a);
191
- return m === !0 && this.run.apply(window.client, [a, t]), m;
187
+ const l = this.verify(i, s, a);
188
+ return l === !0 && this.run.apply(window.client, [a, t]), l;
192
189
  }
193
190
  remove() {
194
191
  if (!(window.client instanceof G)) return;
@@ -204,7 +201,7 @@ class Q {
204
201
  var s = [i.name, ...i.aliases ?? []], n = t.event.data.text.replace(i.prefix, "").split(" ")[0];
205
202
  return s.includes(n);
206
203
  });
207
- if (a.length && a.every((i) => i instanceof Q))
204
+ if (a.length && a.every((i) => i instanceof Z))
208
205
  return a.forEach((i) => {
209
206
  i.parse(t.event.data.text, e), window.client.emit("action", i, "executed"), R.received(`Command executed: ${t.event.data.text} by ${t.event.data.nick || t.event.data.displayName}`, t);
210
207
  }), !0;
@@ -216,7 +213,7 @@ class Q {
216
213
  }
217
214
  }
218
215
  }
219
- const lt = [
216
+ const ut = [
220
217
  "aliceblue",
221
218
  "antiquewhite",
222
219
  "aqua",
@@ -367,17 +364,17 @@ const lt = [
367
364
  "yellowgreen",
368
365
  "transparent"
369
366
  ];
370
- function pt(h, e) {
367
+ function ft(d, e) {
371
368
  if (!e) return null;
372
369
  switch (e) {
373
370
  case "hex": {
374
- const t = h.replace("#", "");
371
+ const t = d.replace("#", "");
375
372
  let a = 0, i = 0, s = 0, n = 1;
376
373
  return t.length === 3 ? (a = parseInt(t[0] + t[0], 16), i = parseInt(t[1] + t[1], 16), s = parseInt(t[2] + t[2], 16)) : t.length === 6 ? (a = parseInt(t.slice(0, 2), 16), i = parseInt(t.slice(2, 4), 16), s = parseInt(t.slice(4, 6), 16)) : t.length === 4 ? (a = parseInt(t[0] + t[0], 16), i = parseInt(t[1] + t[1], 16), s = parseInt(t[2] + t[2], 16), n = parseInt(t[3] + t[3], 16) / 255) : t.length === 8 && (a = parseInt(t.slice(0, 2), 16), i = parseInt(t.slice(2, 4), 16), s = parseInt(t.slice(4, 6), 16), n = parseInt(t.slice(6, 8), 16) / 255), { r: a, g: i, b: s, a: n };
377
374
  }
378
375
  case "rgb":
379
376
  case "rgba": {
380
- const t = h.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/);
377
+ const t = d.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/);
381
378
  return t ? {
382
379
  r: parseInt(t[1]),
383
380
  g: parseInt(t[2]),
@@ -387,17 +384,17 @@ function pt(h, e) {
387
384
  }
388
385
  case "hsl":
389
386
  case "hsla": {
390
- const t = h.match(/hsla?\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%(?:\s*,\s*([\d.]+))?\s*\)/);
387
+ const t = d.match(/hsla?\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%(?:\s*,\s*([\d.]+))?\s*\)/);
391
388
  if (!t) return null;
392
389
  const a = parseInt(t[1]), i = parseInt(t[2]), s = parseInt(t[3]), n = t[4] ? parseFloat(t[4]) : 1;
393
- return { ...bt(a, i, s), a: n };
390
+ return { ...yt(a, i, s), a: n };
394
391
  }
395
392
  case "css-color-name": {
396
393
  const t = document.createElement("canvas");
397
394
  t.width = t.height = 1;
398
395
  const a = t.getContext("2d");
399
396
  if (!a) return null;
400
- a.fillStyle = h, a.fillRect(0, 0, 1, 1);
397
+ a.fillStyle = d, a.fillRect(0, 0, 1, 1);
401
398
  const [i, s, n] = a.getImageData(0, 0, 1, 1).data;
402
399
  return { r: i, g: s, b: n, a: 1 };
403
400
  }
@@ -405,42 +402,42 @@ function pt(h, e) {
405
402
  return null;
406
403
  }
407
404
  }
408
- function ft(h, e = !0) {
405
+ function bt(d, e = !0) {
409
406
  const t = (i) => Math.round(i).toString(16).padStart(2, "0");
410
- let a = `#${t(h.r)}${t(h.g)}${t(h.b)}`;
411
- return e && h.a < 1 && (a += t(h.a * 255)), a;
407
+ let a = `#${t(d.r)}${t(d.g)}${t(d.b)}`;
408
+ return e && d.a < 1 && (a += t(d.a * 255)), a;
412
409
  }
413
- function dt(h, e, t) {
414
- h /= 255, e /= 255, t /= 255;
415
- const a = Math.max(h, e, t), i = Math.min(h, e, t), s = a - i;
416
- let n = 0, m = 0;
417
- const o = (a + i) / 2;
410
+ function lt(d, e, t) {
411
+ d /= 255, e /= 255, t /= 255;
412
+ const a = Math.max(d, e, t), i = Math.min(d, e, t), s = a - i;
413
+ let n = 0, l = 0;
414
+ const c = (a + i) / 2;
418
415
  if (s !== 0)
419
- switch (m = o > 0.5 ? s / (2 - a - i) : s / (a + i), a) {
420
- case h:
416
+ switch (l = c > 0.5 ? s / (2 - a - i) : s / (a + i), a) {
417
+ case d:
421
418
  n = ((e - t) / s + (e < t ? 6 : 0)) / 6;
422
419
  break;
423
420
  case e:
424
- n = ((t - h) / s + 2) / 6;
421
+ n = ((t - d) / s + 2) / 6;
425
422
  break;
426
423
  case t:
427
- n = ((h - e) / s + 4) / 6;
424
+ n = ((d - e) / s + 4) / 6;
428
425
  break;
429
426
  }
430
427
  return {
431
428
  h: Math.round(n * 360),
432
- s: Math.round(m * 100),
433
- l: Math.round(o * 100)
429
+ s: Math.round(l * 100),
430
+ l: Math.round(c * 100)
434
431
  };
435
432
  }
436
- function bt(h, e, t) {
437
- h /= 360, e /= 100, t /= 100;
433
+ function yt(d, e, t) {
434
+ d /= 360, e /= 100, t /= 100;
438
435
  let a, i, s;
439
436
  if (e === 0)
440
437
  a = i = s = t;
441
438
  else {
442
- const n = (b, g, c) => (c < 0 && (c += 1), c > 1 && (c -= 1), c < 0.16666666666666666 ? b + (g - b) * 6 * c : c < 0.5 ? g : c < 0.6666666666666666 ? b + (g - b) * (0.6666666666666666 - c) * 6 : b), m = t < 0.5 ? t * (1 + e) : t + e - t * e, o = 2 * t - m;
443
- a = n(o, m, h + 1 / 3), i = n(o, m, h), s = n(o, m, h - 1 / 3);
439
+ const n = (f, u, o) => (o < 0 && (o += 1), o > 1 && (o -= 1), o < 0.16666666666666666 ? f + (u - f) * 6 * o : o < 0.5 ? u : o < 0.6666666666666666 ? f + (u - f) * (0.6666666666666666 - o) * 6 : f), l = t < 0.5 ? t * (1 + e) : t + e - t * e, c = 2 * t - l;
440
+ a = n(c, l, d + 1 / 3), i = n(c, l, d), s = n(c, l, d - 1 / 3);
444
441
  }
445
442
  return {
446
443
  r: Math.round(a * 255),
@@ -448,21 +445,21 @@ function bt(h, e, t) {
448
445
  b: Math.round(s * 255)
449
446
  };
450
447
  }
451
- async function yt(h, e, t) {
452
- const a = lt;
448
+ async function wt(d, e, t) {
449
+ const a = ut;
453
450
  let i = a[0], s = 1 / 0;
454
451
  for await (const n of a) {
455
- const m = document.createElement("canvas");
456
- m.width = m.height = 1;
457
- const o = m.getContext("2d");
458
- if (!o) continue;
459
- o.fillStyle = n, o.fillRect(0, 0, 1, 1);
460
- const [b, g, c] = o.getImageData(0, 0, 1, 1).data, d = Math.sqrt(Math.pow(h - b, 2) + Math.pow(e - g, 2) + Math.pow(t - c, 2));
461
- if (d < s && (s = d, i = n), d === 0) break;
452
+ const l = document.createElement("canvas");
453
+ l.width = l.height = 1;
454
+ const c = l.getContext("2d");
455
+ if (!c) continue;
456
+ c.fillStyle = n, c.fillRect(0, 0, 1, 1);
457
+ const [f, u, o] = c.getImageData(0, 0, 1, 1).data, m = Math.sqrt(Math.pow(d - f, 2) + Math.pow(e - u, 2) + Math.pow(t - o, 2));
458
+ if (m < s && (s = m, i = n), m === 0) break;
462
459
  }
463
460
  return i;
464
461
  }
465
- const wt = [
462
+ const vt = [
466
463
  "https://static-cdn.jtvnw.net/user-default-pictures-uv/13e5fa74-defa-11e9-809c-784f43822e80-profile_image-300x300.png",
467
464
  "https://static-cdn.jtvnw.net/user-default-pictures-uv/dbdc9198-def8-11e9-8681-784f43822e80-profile_image-300x300.png",
468
465
  "https://static-cdn.jtvnw.net/user-default-pictures-uv/998f01ae-def8-11e9-b95c-784f43822e80-profile_image-300x300.png",
@@ -470,7 +467,7 @@ const wt = [
470
467
  "https://static-cdn.jtvnw.net/user-default-pictures-uv/ebe4cd89-b4f4-4cd9-adac-2f30151b4209-profile_image-300x300.png",
471
468
  "https://static-cdn.jtvnw.net/user-default-pictures-uv/215b7342-def9-11e9-9a66-784f43822e80-profile_image-300x300.png",
472
469
  "https://static-cdn.jtvnw.net/user-default-pictures-uv/ead5c8b2-a4c9-4724-b1dd-9f00b46cbd3d-profile_image-300x300.png"
473
- ], vt = {
470
+ ], kt = {
474
471
  "100 bits": {
475
472
  type: "100 bits",
476
473
  version: "1",
@@ -561,7 +558,7 @@ const wt = [
561
558
  url: "https://static-cdn.jtvnw.net/badges/v1/b817aba4-fad8-49e2-b88a-7cc744dfa6ec/3",
562
559
  description: "VIP"
563
560
  }
564
- }, kt = Object.values([
561
+ }, Ct = Object.values([
565
562
  {
566
563
  type: "twitch",
567
564
  name: "TheIlluminati",
@@ -1912,13 +1909,13 @@ const wt = [
1912
1909
  }
1913
1910
  }
1914
1911
  ]).reduce(
1915
- (h, e) => (h.some((t) => t.name === e.name) || h.push({
1912
+ (d, e) => (d.some((t) => t.name === e.name) || d.push({
1916
1913
  ...e,
1917
1914
  start: 0,
1918
1915
  end: 0
1919
- }), h),
1916
+ }), d),
1920
1917
  []
1921
- ), Ct = [], jt = [
1918
+ ), jt = [], xt = [
1922
1919
  "Hello everyone!",
1923
1920
  "PogChamp",
1924
1921
  "This stream is amazing!",
@@ -1969,7 +1966,7 @@ const wt = [
1969
1966
  "BloodTrail hunting time",
1970
1967
  "CatBag kitty!",
1971
1968
  "c! poggers"
1972
- ], xt = ["Local", "Tixyel", "Urie_s2", "itzzcatt", "BeniArts", "Cupidiko", "shy_madeit"], Ut = ["1000", "2000", "3000", "prime"], Et = [
1969
+ ], Ut = ["Local", "Tixyel", "Urie_s2", "itzzcatt", "BeniArts", "Cupidiko", "shy_madeit"], Et = ["1000", "2000", "3000", "prime"], It = [
1973
1970
  "Filiz",
1974
1971
  "Astrid",
1975
1972
  "Tatyana",
@@ -5231,306 +5228,369 @@ const wt = [
5231
5228
  index: 121
5232
5229
  }
5233
5230
  ];
5234
- var D;
5235
- ((h) => {
5236
- h.avatars = wt, h.badges = vt, h.css_color_names = lt, h.emotes = kt, h.items = Ct, h.messages = jt, h.names = xt, h.tiers = Ut, h.tts = Et, h.youtube_emotes = Tt;
5237
- })(D || (D = {}));
5238
- var y;
5239
- ((h) => {
5231
+ var A;
5232
+ ((d) => {
5233
+ d.avatars = vt, d.badges = kt, d.css_color_names = ut, d.emotes = Ct, d.items = jt, d.messages = xt, d.names = Ut, d.tiers = Et, d.tts = It, d.youtube_emotes = Tt;
5234
+ })(A || (A = {}));
5235
+ var b;
5236
+ ((d) => {
5240
5237
  let e;
5241
5238
  ((n) => {
5242
- function m(g, c = "cardinal") {
5243
- const d = {
5239
+ function l(u, o = "cardinal") {
5240
+ const m = {
5244
5241
  single: ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"],
5245
- tens: ["ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"],
5242
+ tens: [
5243
+ "ten",
5244
+ "eleven",
5245
+ "twelve",
5246
+ "thirteen",
5247
+ "fourteen",
5248
+ "fifteen",
5249
+ "sixteen",
5250
+ "seventeen",
5251
+ "eighteen",
5252
+ "nineteen"
5253
+ ],
5246
5254
  decades: ["twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"]
5247
- }, f = {
5248
- single: ["zeroth", "first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eighth", "ninth"],
5249
- tens: ["tenth", "eleventh", "twelfth", "thirteenth", "fourteenth", "fifteenth", "sixteenth", "seventeenth", "eighteenth", "nineteenth"],
5250
- decades: ["twentieth", "thirtieth", "fortieth", "fiftieth", "sixtieth", "seventieth", "eightieth", "ninetieth"]
5251
- }, l = ["th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th"], p = ["", "thousand", "million", "billion", "trillion", "quadrillion", "quintillion"], C = p.map((U) => U ? `${U}th` : "");
5252
- if (g = Math.abs(Math.floor(g)), c === "suffix") {
5253
- const U = g % 100;
5254
- if (U >= 11 && U <= 13) return `${g}th`;
5255
- const S = g % 10;
5256
- return `${g}${l[S]}`;
5257
- }
5258
- function v(U, S) {
5259
- if (U < 10) return S === "ordinal" ? f.single[U] : d.single[U];
5260
- if (U < 20) return S === "ordinal" ? f.tens[U - 10] : d.tens[U - 10];
5255
+ }, w = {
5256
+ single: [
5257
+ "zeroth",
5258
+ "first",
5259
+ "second",
5260
+ "third",
5261
+ "fourth",
5262
+ "fifth",
5263
+ "sixth",
5264
+ "seventh",
5265
+ "eighth",
5266
+ "ninth"
5267
+ ],
5268
+ tens: [
5269
+ "tenth",
5270
+ "eleventh",
5271
+ "twelfth",
5272
+ "thirteenth",
5273
+ "fourteenth",
5274
+ "fifteenth",
5275
+ "sixteenth",
5276
+ "seventeenth",
5277
+ "eighteenth",
5278
+ "nineteenth"
5279
+ ],
5280
+ decades: [
5281
+ "twentieth",
5282
+ "thirtieth",
5283
+ "fortieth",
5284
+ "fiftieth",
5285
+ "sixtieth",
5286
+ "seventieth",
5287
+ "eightieth",
5288
+ "ninetieth"
5289
+ ]
5290
+ }, h = ["th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th"], p = [
5291
+ "",
5292
+ "thousand",
5293
+ "million",
5294
+ "billion",
5295
+ "trillion",
5296
+ "quadrillion",
5297
+ "quintillion"
5298
+ ], y = p.map((U) => U ? `${U}th` : "");
5299
+ if (u = Math.abs(Math.floor(u)), o === "suffix") {
5300
+ const U = u % 100;
5301
+ if (U >= 11 && U <= 13) return `${u}th`;
5302
+ const S = u % 10;
5303
+ return `${u}${h[S]}`;
5304
+ }
5305
+ function C(U, S) {
5306
+ if (U < 10) return S === "ordinal" ? w.single[U] : m.single[U];
5307
+ if (U < 20) return S === "ordinal" ? w.tens[U - 10] : m.tens[U - 10];
5261
5308
  const L = Math.floor(U / 10), O = U % 10;
5262
- if (O === 0) return S === "ordinal" ? f.decades[L - 2] : d.decades[L - 2];
5263
- const z = d.decades[L - 2], V = S === "ordinal" ? f.single[O] : d.single[O];
5309
+ if (O === 0)
5310
+ return S === "ordinal" ? w.decades[L - 2] : m.decades[L - 2];
5311
+ const z = m.decades[L - 2], V = S === "ordinal" ? w.single[O] : m.single[O];
5264
5312
  return `${z}-${V}`;
5265
5313
  }
5266
5314
  function k(U, S) {
5267
- if (U === 0) return S === "ordinal" ? f.single[0] : d.single[0];
5315
+ if (U === 0) return S === "ordinal" ? w.single[0] : m.single[0];
5268
5316
  const L = Math.floor(U / 100), O = U % 100, z = [];
5269
- return L > 0 && (S === "ordinal" && O === 0 ? z.push(`${d.single[L]} hundredth`) : z.push(`${d.single[L]} hundred`)), O > 0 && z.push(v(O, S)), z.join(" ");
5317
+ return L > 0 && (S === "ordinal" && O === 0 ? z.push(`${m.single[L]} hundredth`) : z.push(`${m.single[L]} hundred`)), O > 0 && z.push(C(O, S)), z.join(" ");
5270
5318
  }
5271
- if (g < 1e3) return k(g, c);
5319
+ if (u < 1e3) return k(u, o);
5272
5320
  const j = [];
5273
- let P = g;
5274
- for (; P > 0; )
5275
- j.push(P % 1e3), P = Math.floor(P / 1e3);
5276
- let A = -1;
5277
- for (let U = 0; U < j.length; U++) j[U] !== 0 && (A = U);
5278
- const J = [];
5321
+ let D = u;
5322
+ for (; D > 0; )
5323
+ j.push(D % 1e3), D = Math.floor(D / 1e3);
5324
+ let J = -1;
5325
+ for (let U = 0; U < j.length; U++) j[U] !== 0 && (J = U);
5326
+ const P = [];
5279
5327
  for (let U = j.length - 1; U >= 0; U--) {
5280
5328
  const S = j[U];
5281
5329
  if (S === 0) continue;
5282
5330
  const L = p[U];
5283
- if (c === "cardinal") {
5331
+ if (o === "cardinal") {
5284
5332
  let O = k(S, "cardinal");
5285
- L && (O += ` ${L}`), J.push(O);
5286
- } else if (U === A)
5333
+ L && (O += ` ${L}`), P.push(O);
5334
+ } else if (U === J)
5287
5335
  if (U > 0) {
5288
- const z = k(S, "cardinal"), V = C[U];
5289
- J.push(z ? `${z} ${V}` : V);
5336
+ const z = k(S, "cardinal"), V = y[U];
5337
+ P.push(z ? `${z} ${V}` : V);
5290
5338
  } else {
5291
5339
  const z = k(S, "ordinal");
5292
- J.push(z);
5340
+ P.push(z);
5293
5341
  }
5294
5342
  else {
5295
5343
  let z = k(S, "cardinal");
5296
- L && (z += ` ${L}`), J.push(z);
5344
+ L && (z += ` ${L}`), P.push(z);
5297
5345
  }
5298
5346
  }
5299
- return J.join(", ");
5347
+ return P.join(", ");
5300
5348
  }
5301
- n.translate = m;
5302
- function o(g, c = 0, d = 100) {
5303
- return Math.min(Math.max(g, c), d);
5349
+ n.translate = l;
5350
+ function c(u, o = 0, m = 100, w = 0) {
5351
+ const h = Math.min(Math.max(u, o), m);
5352
+ return f(h, w);
5304
5353
  }
5305
- n.balance = o;
5306
- function b(g, c = 2) {
5307
- const d = Math.pow(10, c);
5308
- return Math.round(g * d) / d;
5354
+ n.balance = c;
5355
+ function f(u, o = 2) {
5356
+ const m = Math.pow(10, o);
5357
+ return Math.round(u * m) / m;
5309
5358
  }
5310
- n.round = b;
5311
- })(e = h.number || (h.number = {})), ((n) => {
5312
- function m(d, f) {
5359
+ n.round = f, n.random = d.random.number;
5360
+ })(e = d.number || (d.number = {})), ((n) => {
5361
+ function l(f, u) {
5313
5362
  return new Promise(
5314
- (l) => setTimeout(() => {
5315
- if (f) {
5316
- const p = f();
5317
- l(p ?? null);
5318
- } else l(null);
5319
- }, d)
5363
+ (o) => setTimeout(() => {
5364
+ if (u) {
5365
+ const m = u();
5366
+ o(m ?? null);
5367
+ } else o(null);
5368
+ }, f)
5320
5369
  );
5321
5370
  }
5322
- n.delay = m;
5323
- function o(d) {
5324
- return Object.entries(d);
5325
- }
5326
- n.typedEntries = o;
5327
- function b(d) {
5328
- return Object.values(d);
5329
- }
5330
- n.typedValues = b;
5331
- function g(d) {
5332
- return Object.keys(d);
5333
- }
5334
- n.typedKeys = g;
5335
- function c(d) {
5336
- const f = Object.values(d).reduce((v, k) => v + k, 0), l = o(d).sort((v, k) => k[1] - v[1]), p = Math.random() * f;
5337
- let C = 0;
5338
- for (const [v, k] of l)
5339
- if (C += k, p < C)
5340
- return v;
5371
+ n.delay = l, n.typedEntries = a.entries, n.typedValues = a.values, n.typedKeys = a.keys;
5372
+ function c(f) {
5373
+ const u = Object.values(f).reduce((h, p) => h + p, 0), o = (0, n.typedEntries)(f).sort((h, p) => p[1] - h[1]), m = Math.random() * u;
5374
+ let w = 0;
5375
+ for (const [h, p] of o)
5376
+ if (w += p, m < w)
5377
+ return h;
5341
5378
  }
5342
5379
  n.probability = c;
5343
- })(h.utils || (h.utils = {}));
5380
+ })(d.utils || (d.utils = {}));
5344
5381
  let t;
5345
5382
  ((n) => {
5346
- function m(d, f, l) {
5347
- const p = f.match(/^<span(?: class="[^"]*")? style="([^"]*)">(.*)<\/span>$/s);
5383
+ function l(m, w, h) {
5384
+ const p = w.match(/^<span(?: class="[^"]*")? style="([^"]*)">(.*)<\/span>$/s);
5348
5385
  if (p) {
5349
- const C = p[1], v = p[2], k = p[0].match(/class="([^"]*)"/)?.[1] || "";
5350
- let j = [C, d].filter((P) => P.length).map((P) => P.endsWith(";") ? P.slice(0, -1) : P).join("; ").replace(/\s*;\s*/g, "; ").trim();
5351
- return j.endsWith(";") || (j += ";"), `<span${k ? ` class="${k} ${l ?? ""}"` : ""}${j ? ` style="${j}"` : ""}>${v}</span>`;
5386
+ const y = p[1], C = p[2], k = p[0].match(/class="([^"]*)"/)?.[1] || "";
5387
+ let j = [y, m].filter((D) => D.length).map((D) => D.endsWith(";") ? D.slice(0, -1) : D).join("; ").replace(/\s*;\s*/g, "; ").trim();
5388
+ return j.endsWith(";") || (j += ";"), `<span${k ? ` class="${k} ${h ?? ""}"` : ""}${j ? ` style="${j}"` : ""}>${C}</span>`;
5352
5389
  } else
5353
- return d && d.length && !d.endsWith(";") && (d += ";"), `<span${l ? ` class="${l}"` : ""}${d ? ` style="${d}"` : ""}>${f}</span>`;
5390
+ return m && m.length && !m.endsWith(";") && (m += ";"), `<span${h ? ` class="${h}"` : ""}${m ? ` style="${m}"` : ""}>${w}</span>`;
5354
5391
  }
5355
- n.mergeSpanStyles = m;
5356
- function o(d, f = 0, l = 1, p) {
5357
- const { return: C = !1, parent: v, base: k } = p || {}, j = v || d.parentElement || document.body;
5392
+ n.mergeSpanStyles = l;
5393
+ function c(m, w = 0, h = 1, p) {
5394
+ const { return: y = !1, parent: C, base: k } = p || {}, j = C || m.parentElement || document.body;
5358
5395
  if (!j)
5359
5396
  throw new Error("No parent element found for scaling");
5360
- const P = j.getBoundingClientRect(), A = d.offsetWidth, J = d.offsetHeight;
5361
- if (A === 0 || J === 0)
5397
+ const D = j.getBoundingClientRect(), J = m.offsetWidth, P = m.offsetHeight;
5398
+ if (J === 0 || P === 0)
5362
5399
  throw new Error("Element has zero width or height, cannot scale");
5363
- const U = P.width * l / A, S = P.height * l / J;
5400
+ const U = D.width * h / J, S = D.height * h / P;
5364
5401
  let L = k === "width" ? U : k === "height" ? S : Math.min(U, S);
5365
- if (f > 0) {
5366
- const z = P.width * f / A, V = P.height * f / J, W = Math.max(z, V);
5402
+ if (w > 0) {
5403
+ const z = D.width * w / J, V = D.height * w / P, W = Math.max(z, V);
5367
5404
  L = Math.max(W, L);
5368
5405
  }
5369
5406
  const O = {
5370
- width: A * L,
5371
- height: J * L,
5407
+ width: J * L,
5408
+ height: P * L,
5372
5409
  scale: L
5373
5410
  };
5374
- return C || (d.style.transform = `scale(${L})`, d.style.transformOrigin = "center center"), O;
5411
+ return y || (m.style.transform = `scale(${L})`, m.style.transformOrigin = "center center"), O;
5375
5412
  }
5376
- n.scale = o;
5377
- function b(d, f = {}) {
5378
- const { parent: l = d.parentElement, prefer: p = "auto", min: C = 0, max: v = 1, apply: k = () => {
5379
- } } = f;
5380
- if (!l)
5413
+ n.scale = c;
5414
+ function f(m, w = {}) {
5415
+ const {
5416
+ parent: h = m.parentElement,
5417
+ prefer: p = "auto",
5418
+ min: y = 0,
5419
+ max: C = 1,
5420
+ apply: k = () => {
5421
+ }
5422
+ } = w;
5423
+ if (!h)
5381
5424
  throw new Error("No parent element found for scaling");
5382
- const j = l.getBoundingClientRect(), P = d.getBoundingClientRect(), A = j.width, J = j.height, U = P.width, S = P.height;
5383
- let L = A * C / U, O = J * C / S, z = A * v / U, V = J * v / S, W = Math.min(z, V);
5425
+ const j = h.getBoundingClientRect(), D = m.getBoundingClientRect(), J = j.width, P = j.height, U = D.width, S = D.height;
5426
+ let L = J * y / U, O = P * y / S, z = J * C / U, V = P * C / S, W = Math.min(z, V);
5384
5427
  const F = Math.max(L, O);
5385
5428
  W = Math.max(W, F);
5386
- const B = U * W, at = S * W;
5387
- return p === "width" ? W = Math.max(L, Math.min(z, A / U)) : p === "height" ? W = Math.max(O, Math.min(V, J / S)) : B > A ? W = Math.max(L, Math.min(z, A / U)) : at > J && (W = Math.max(O, Math.min(V, J / S))), k.apply(d, [W, d]), W;
5429
+ const B = U * W, st = S * W;
5430
+ return p === "width" ? W = Math.max(L, Math.min(z, J / U)) : p === "height" ? W = Math.max(O, Math.min(V, P / S)) : B > J ? W = Math.max(L, Math.min(z, J / U)) : st > P && (W = Math.max(O, Math.min(V, P / S))), k.apply(m, [W, m]), W;
5388
5431
  }
5389
- n.scalev2 = b;
5390
- function g(d, f = 1, l = {}) {
5391
- const p = parseFloat(getComputedStyle(d).getPropertyValue("font-size")), C = {
5392
- minFontSize: l?.minFontSize ?? 0,
5393
- maxFontSize: l?.maxFontSize ?? p
5394
- }, v = l?.parent || d.parentElement;
5395
- if (!v)
5432
+ n.scalev2 = f;
5433
+ function u(m, w = 1, h = {}) {
5434
+ const p = parseFloat(getComputedStyle(m).getPropertyValue("font-size")), y = {
5435
+ minFontSize: h?.minFontSize ?? 0,
5436
+ maxFontSize: h?.maxFontSize ?? p
5437
+ }, C = h?.parent || m.parentElement;
5438
+ if (!C)
5396
5439
  throw new Error("No parent element found for fitting text");
5397
- const k = v.clientWidth * f, j = d.offsetWidth, P = k / j, A = p * P, J = e.balance(A, C.minFontSize, C.maxFontSize);
5398
- return d.style.fontSize = J + "px", d;
5440
+ const k = C.clientWidth * w, j = m.offsetWidth, D = k / j, J = p * D, P = e.balance(J, y.minFontSize, y.maxFontSize);
5441
+ return m.style.fontSize = P + "px", m;
5399
5442
  }
5400
- n.fitText = g;
5401
- function c(d, f = 0) {
5402
- const p = new DOMParser().parseFromString(d, "text/html");
5403
- let C = f;
5404
- function v(A) {
5405
- if (A.nodeType === Node.TEXT_NODE) {
5406
- const U = (A.textContent || "").split("").map((L, O) => {
5443
+ n.fitText = u;
5444
+ function o(m, w = 0) {
5445
+ const p = new DOMParser().parseFromString(m, "text/html");
5446
+ let y = w;
5447
+ function C(J) {
5448
+ if (J.nodeType === Node.TEXT_NODE) {
5449
+ const U = (J.textContent || "").split("").map((L, O) => {
5407
5450
  const z = document.createElement("span");
5408
- return z.classList.add("char"), z.dataset.index = String(C), z.dataset.exclusivityIndex = String(C), z.style.setProperty("--char-index", String(C)), z.style.setProperty("--exclusivity-index", String(C)), (L === " " || L === `
5409
- ` || L === " ") && (z.style.whiteSpace = "pre-wrap"), z.textContent = L, C++, z;
5451
+ return z.classList.add("char"), z.dataset.index = String(y), z.dataset.exclusivityIndex = String(y), z.style.setProperty("--char-index", String(y)), z.style.setProperty("--exclusivity-index", String(y)), (L === " " || L === `
5452
+ ` || L === " ") && (z.style.whiteSpace = "pre-wrap"), z.textContent = L, y++, z;
5410
5453
  }), S = document.createDocumentFragment();
5411
5454
  return U.forEach((L) => S.appendChild(L)), S;
5412
- } else if (A.nodeType === Node.ELEMENT_NODE) {
5413
- const J = A.cloneNode(!1);
5414
- return J.classList.add("container"), J.dataset.index = String(C), J.style.setProperty("--char-index", String(C)), A.childNodes.forEach((U) => {
5415
- const S = v(U);
5416
- (S instanceof DocumentFragment || S instanceof Node) && J.appendChild(S);
5417
- }), J;
5455
+ } else if (J.nodeType === Node.ELEMENT_NODE) {
5456
+ const P = J.cloneNode(!1);
5457
+ return P.classList.add("container"), P.dataset.index = String(y), P.style.setProperty("--char-index", String(y)), J.childNodes.forEach((U) => {
5458
+ const S = C(U);
5459
+ (S instanceof DocumentFragment || S instanceof Node) && P.appendChild(S);
5460
+ }), P;
5418
5461
  }
5419
- return A.cloneNode(!0);
5462
+ return J.cloneNode(!0);
5420
5463
  }
5421
5464
  const k = p.body, j = document.createElement("div");
5422
- k.childNodes.forEach((A) => {
5423
- if (A.nodeType === Node.TEXT_NODE && !A.textContent?.trim())
5465
+ k.childNodes.forEach((J) => {
5466
+ if (J.nodeType === Node.TEXT_NODE && !J.textContent?.trim())
5424
5467
  return;
5425
- const J = v(A);
5426
- (J instanceof DocumentFragment || J instanceof Node) && j.appendChild(J);
5468
+ const P = C(J);
5469
+ (P instanceof DocumentFragment || P instanceof Node) && j.appendChild(P);
5427
5470
  });
5428
- let P = "";
5429
- return Array.from(j.childNodes).forEach((A) => {
5430
- A.nodeType === Node.TEXT_NODE ? P += A.textContent : P += A.outerHTML;
5431
- }), P;
5471
+ let D = "";
5472
+ return Array.from(j.childNodes).forEach((J) => {
5473
+ J.nodeType === Node.TEXT_NODE ? D += J.textContent : D += J.outerHTML;
5474
+ }), D;
5432
5475
  }
5433
- n.splitTextToChars = c;
5434
- })(t = h.element || (h.element = {}));
5476
+ n.splitTextToChars = o;
5477
+ })(t = d.element || (d.element = {}));
5435
5478
  let a;
5436
5479
  ((n) => {
5437
- function m(o, b = !0, g = "") {
5438
- const c = {};
5439
- for (const d in o) {
5440
- if (!Object.prototype.hasOwnProperty.call(o, d)) continue;
5441
- const f = o[d], l = g ? `${g}.${d}` : d;
5442
- if (f == null) {
5443
- c[l] = String(f);
5480
+ function l(o, m = !0, w = "") {
5481
+ const h = {};
5482
+ for (const p in o) {
5483
+ if (!Object.prototype.hasOwnProperty.call(o, p)) continue;
5484
+ const y = o[p], C = w ? `${w}.${p}` : p;
5485
+ if (y == null) {
5486
+ h[C] = String(y);
5444
5487
  continue;
5445
5488
  }
5446
- if (typeof f == "number" && isNaN(f)) {
5447
- c[l] = "NaN";
5489
+ if (typeof y == "number" && isNaN(y)) {
5490
+ h[C] = "NaN";
5448
5491
  continue;
5449
5492
  }
5450
- if (typeof f == "number" && !isNaN(f)) {
5451
- c[l] = b ? String(f) : f;
5493
+ if (typeof y == "number" && !isNaN(y)) {
5494
+ h[C] = m ? String(y) : y;
5452
5495
  continue;
5453
5496
  }
5454
- if (f instanceof Date) {
5455
- c[l] = f.toISOString();
5497
+ if (y instanceof Date) {
5498
+ h[C] = y.toISOString();
5456
5499
  continue;
5457
5500
  }
5458
- if (f instanceof Map) {
5459
- f.forEach((p, C) => {
5460
- c[`${l}.${C}`] = JSON.stringify(p);
5501
+ if (y instanceof Map) {
5502
+ y.forEach((k, j) => {
5503
+ h[`${C}.${j}`] = JSON.stringify(k);
5461
5504
  });
5462
5505
  continue;
5463
5506
  }
5464
- if (Array.isArray(f)) {
5465
- f.forEach((p, C) => {
5466
- const v = `${l}:${C}`;
5467
- typeof p == "object" ? Object.assign(c, m(p, b, v)) : c[v] = b ? String(p) : p;
5507
+ if (Array.isArray(y)) {
5508
+ y.forEach((k, j) => {
5509
+ const D = `${C}:${j}`;
5510
+ typeof k == "object" ? Object.assign(h, l(k, m, D)) : h[D] = m ? String(k) : k;
5468
5511
  });
5469
5512
  continue;
5470
5513
  }
5471
- if (typeof f == "object") {
5472
- Object.assign(c, m(f, b, l));
5514
+ if (typeof y == "object") {
5515
+ Object.assign(h, l(y, m, C));
5473
5516
  continue;
5474
5517
  }
5475
- c[l] = String(f);
5518
+ h[C] = String(y);
5476
5519
  }
5477
- return c;
5520
+ return h;
5521
+ }
5522
+ n.flatten = l;
5523
+ function c(o) {
5524
+ return Object.entries(o);
5525
+ }
5526
+ n.entries = c;
5527
+ function f(o) {
5528
+ return Object.values(o);
5478
5529
  }
5479
- n.flatten = m;
5480
- })(a = h.object || (h.object = {})), ((n) => {
5481
- function m(c, d = D.emotes) {
5482
- const f = [];
5483
- return d.forEach((l) => {
5484
- const p = l.name;
5485
- let C = 0, v = 0;
5486
- for (; C < c.length; ) {
5487
- const k = c.indexOf(p, v);
5530
+ n.values = f;
5531
+ function u(o) {
5532
+ return Object.keys(o);
5533
+ }
5534
+ n.keys = u;
5535
+ })(a = d.object || (d.object = {})), ((n) => {
5536
+ function l(o, m = A.emotes) {
5537
+ const w = [];
5538
+ return m.forEach((h) => {
5539
+ const p = h.name;
5540
+ let y = 0, C = 0;
5541
+ for (; y < o.length; ) {
5542
+ const k = o.indexOf(p, C);
5488
5543
  if (k === -1) break;
5489
- const j = k > 0 ? c[k - 1] : " ", P = k + p.length < c.length ? c[k + p.length] : " ";
5490
- /\s/.test(j) && /\s/.test(P) && f.push({ ...l, start: k, end: k + p.length }), v = k + 1;
5544
+ const j = k > 0 ? o[k - 1] : " ", D = k + p.length < o.length ? o[k + p.length] : " ";
5545
+ /\s/.test(j) && /\s/.test(D) && w.push({ ...h, start: k, end: k + p.length }), C = k + 1;
5491
5546
  }
5492
- }), f.sort((l, p) => l.start - p.start);
5547
+ }), w.sort((h, p) => h.start - p.start);
5493
5548
  }
5494
- n.findEmotesInText = m;
5495
- function o(c, d) {
5496
- if (!d.length) return c;
5497
- let f = "", l = 0;
5498
- return d.forEach((p) => {
5499
- f += c.substring(l, p.start);
5500
- const v = Array.from({ ...p.urls, length: 5 }).slice(1).reverse().filter(Boolean)[0] || p.urls[1];
5501
- f += `<img src="${v}" alt="${p.name}" class="emote" style="width: auto; height: 1em; vertical-align: middle;" />`, l = p.end;
5502
- }), f += c.substring(l), f;
5549
+ n.findEmotesInText = l;
5550
+ function c(o, m) {
5551
+ if (!m.length) return o;
5552
+ let w = "", h = 0;
5553
+ return m.forEach((p) => {
5554
+ w += o.substring(h, p.start);
5555
+ const C = Array.from({ ...p.urls, length: 5 }).slice(1).reverse().filter(Boolean)[0] || p.urls[1];
5556
+ w += `<img src="${C}" alt="${p.name}" class="emote" style="width: auto; height: 1em; vertical-align: middle;" />`, h = p.end;
5557
+ }), w += o.substring(h), w;
5503
5558
  }
5504
- n.replaceEmotesWithHTML = o;
5505
- function b(c, d = D.youtube_emotes) {
5506
- return Array.from(c.matchAll(/:(.*?):/gim), (l) => l[0]).forEach((l) => {
5507
- const p = d.find((C) => C.shortcuts.includes(l) || C.searchTerms.includes(l.slice(1, -1)));
5559
+ n.replaceEmotesWithHTML = c;
5560
+ function f(o, m = A.youtube_emotes) {
5561
+ return Array.from(o.matchAll(/:(.*?):/gim), (h) => h[0]).forEach((h) => {
5562
+ const p = m.find(
5563
+ (y) => y.shortcuts.includes(h) || y.searchTerms.includes(h.slice(1, -1))
5564
+ );
5508
5565
  if (p) {
5509
- const C = p.image.thumbnails.at(-1)?.url, v = p.image.accessibility.accessibilityData.label;
5510
- C && (c = c.replace(l, `<img src="${C}" alt="${v}" class="emote" style="width: auto; height: 1em; vertical-align: middle;" />`));
5566
+ const y = p.image.thumbnails.at(-1)?.url, C = p.image.accessibility.accessibilityData.label;
5567
+ y && (o = o.replace(
5568
+ h,
5569
+ `<img src="${y}" alt="${C}" class="emote" style="width: auto; height: 1em; vertical-align: middle;" />`
5570
+ ));
5511
5571
  }
5512
- }), c;
5572
+ }), o;
5513
5573
  }
5514
- n.replaceYoutubeEmotesWithHTML = b;
5515
- async function g(c = [], d) {
5516
- if (!Array.isArray(c) && typeof c == "string" && (c = c.split(",").map((v) => v.trim())), !c || !c.length) {
5517
- var f = s.number(1, 3);
5518
- for await (const v of Array.from({ length: f }, () => "")) {
5519
- var l = s.array(Object.keys(D.badges))[0];
5520
- !c.includes(l) && Array.isArray(c) ? c.push(l) : c = [l];
5574
+ n.replaceYoutubeEmotesWithHTML = f;
5575
+ async function u(o = [], m) {
5576
+ if (!Array.isArray(o) && typeof o == "string" && (o = o.split(",").map((C) => C.trim())), !o || !o.length) {
5577
+ var w = s.number(1, 3);
5578
+ for await (const C of Array.from({ length: w }, () => "")) {
5579
+ var h = s.array(Object.keys(A.badges))[0];
5580
+ !o.includes(h) && Array.isArray(o) ? o.push(h) : o = [h];
5521
5581
  }
5522
5582
  }
5523
5583
  var p;
5524
- switch (d) {
5584
+ switch (m) {
5525
5585
  case "twitch": {
5526
5586
  p = {
5527
- keys: Array.from(c).filter((v) => v in D.badges),
5528
- badges: Array.from(c).slice(0, 3).map((v) => D.badges[v]).filter(Boolean)
5587
+ keys: Array.from(o).filter((C) => C in A.badges),
5588
+ badges: Array.from(o).slice(0, 3).map((C) => A.badges[C]).filter(Boolean)
5529
5589
  };
5530
5590
  break;
5531
5591
  }
5532
5592
  case "youtube": {
5533
- var C = {
5593
+ var y = {
5534
5594
  verified: { isVerified: !0 },
5535
5595
  broadcaster: { isChatOwner: !0 },
5536
5596
  host: { isChatOwner: !0 },
@@ -5538,8 +5598,8 @@ var y;
5538
5598
  subscriber: { isChatSponsor: !0 },
5539
5599
  moderator: { isChatModerator: !0 }
5540
5600
  };
5541
- p = Object.entries(c).reduce(
5542
- (v, [k]) => (k in C && Object.assign(v, C[k]), v),
5601
+ p = Object.entries(o).reduce(
5602
+ (C, [k]) => (k in y && Object.assign(C, y[k]), C),
5543
5603
  {
5544
5604
  isVerified: !1,
5545
5605
  isChatOwner: !1,
@@ -5552,10 +5612,16 @@ var y;
5552
5612
  }
5553
5613
  return p;
5554
5614
  }
5555
- n.generateBadges = g;
5556
- })(h.message || (h.message = {})), ((n) => {
5557
- function m(o) {
5558
- var b = o.event?.provider || o.event?.service || o.event?.data?.provider || window.client.details.provider;
5615
+ n.generateBadges = u;
5616
+ })(d.message || (d.message = {})), ((n) => {
5617
+ function l(c) {
5618
+ var f = (
5619
+ // @ts-ignore
5620
+ c.event?.provider || // @ts-ignore
5621
+ c.event?.service || // @ts-ignore
5622
+ c.event?.data?.provider || // @ts-ignore
5623
+ window.client.details.provider
5624
+ );
5559
5625
  return [
5560
5626
  "kvstore:update",
5561
5627
  "bot:counter",
@@ -5563,66 +5629,66 @@ var y;
5563
5629
  "tip-latest",
5564
5630
  "event:test",
5565
5631
  "event:skip"
5566
- ].some((d) => d === o.listener) && (b = "streamelements"), { provider: b, data: o };
5632
+ ].some((m) => m === c.listener) && (f = "streamelements"), { provider: f, data: c };
5567
5633
  }
5568
- n.parseProvider = m;
5569
- })(h.event || (h.event = {})), ((n) => {
5634
+ n.parseProvider = l;
5635
+ })(d.event || (d.event = {})), ((n) => {
5570
5636
  n.PRESETS = {};
5571
- async function m(g, c, d) {
5572
- const f = [];
5573
- g.replace(c, (p, ...C) => {
5574
- const v = typeof d == "function" ? d(p, ...C) : p;
5575
- return f.push(Promise.resolve(v)), p;
5637
+ async function l(u, o, m) {
5638
+ const w = [];
5639
+ u.replace(o, (p, ...y) => {
5640
+ const C = typeof m == "function" ? m(p, ...y) : p;
5641
+ return w.push(Promise.resolve(C)), p;
5576
5642
  });
5577
- const l = await Promise.all(f);
5578
- return g.replace(c, () => l.shift() ?? "");
5643
+ const h = await Promise.all(w);
5644
+ return u.replace(o, () => h.shift() ?? "");
5579
5645
  }
5580
- n.replace = m;
5581
- function o(g) {
5582
- return g.charAt(0).toUpperCase() + g.slice(1);
5646
+ n.replace = l;
5647
+ function c(u) {
5648
+ return u.charAt(0).toUpperCase() + u.slice(1);
5583
5649
  }
5584
- n.capitalize = o;
5585
- function b(g, c = {}, d = {
5650
+ n.capitalize = c;
5651
+ function f(u, o = {}, m = {
5586
5652
  method: "index",
5587
5653
  html: !1,
5588
5654
  debug: !1,
5589
5655
  modifiers: {},
5590
5656
  aliases: {}
5591
5657
  }) {
5592
- const { mergeSpanStyles: f } = t, l = (r, u, w) => d.html ? f(r, u, w) : u, p = {
5658
+ const { mergeSpanStyles: w } = t, h = (r, g, v) => m.html ? w(r, g, v) : g, p = {
5593
5659
  skip: "<br/>",
5594
5660
  newline: "<br/>",
5595
- ...c
5661
+ ...o
5596
5662
  };
5597
- let C = "$", v = "USD";
5663
+ let y = "$", C = "USD";
5598
5664
  if (typeof window < "u")
5599
5665
  try {
5600
- const u = window.client?.details?.currency;
5601
- u?.symbol && (C = String(u.symbol)), u?.code && (v = String(u.code));
5666
+ const g = window.client?.details?.currency;
5667
+ g?.symbol && (y = String(g.symbol)), g?.code && (C = String(g.code));
5602
5668
  } catch {
5603
5669
  }
5604
5670
  const k = Object.entries(a.flatten(p)).reduce(
5605
- (r, [u, w]) => {
5606
- if (r[u] = String(w), ["username", "name", "nick", "nickname", "sender"].some((x) => u === x)) {
5671
+ (r, [g, v]) => {
5672
+ if (r[g] = String(v), ["username", "name", "nick", "nickname", "sender"].some((x) => g === x)) {
5607
5673
  const x = r?.username || r?.name || r?.nick || r?.nickname || r?.sender;
5608
5674
  r.username = r.username || x, r.usernameAt = `@${r.username}`, r.name = r.name || x, r.nick = r.nick || x, r.nickname = r.nickname || x, r.sender = r.sender || x, r.senderAt = `@${r.sender}`;
5609
5675
  }
5610
- return ["amount", "count"].some((x) => u === x) && (r.amount = String(r?.amount || r.count || w), r.count = String(r?.count || r?.amount || w)), r.currency = r.currency || C, r.currencyCode = r.currencyCode || v, r;
5676
+ return ["amount", "count"].some((x) => g === x) && (r.amount = String(r?.amount || r.count || v), r.count = String(r?.count || r?.amount || v)), r.currency = r.currency || y, r.currencyCode = r.currencyCode || C, r;
5611
5677
  },
5612
5678
  {}
5613
5679
  ), j = {
5614
5680
  PLACEHOLDERS: /{([^}]+)}/g,
5615
5681
  MODIFIERS: /\[([^\]=]+)=([^\]]+)\]/g
5616
5682
  };
5617
- var P = parseFloat(k?.amount ?? k?.count ?? 0);
5618
- function A(r, u) {
5619
- const w = r?.trim?.() ?? "";
5620
- if (!w.length) return null;
5621
- const x = u[w], T = parseFloat(String(x !== void 0 ? x : w).replace(/\s/g, ""));
5622
- return isNaN(T) ? null : T;
5623
- }
5624
- function J(r, u, w) {
5625
- const x = isNaN(Number(u)) ? 0 : Math.max(0, parseInt(String(u))), N = A(r, w);
5683
+ var D = parseFloat(k?.amount ?? k?.count ?? 0);
5684
+ function J(r, g) {
5685
+ const v = r?.trim?.() ?? "";
5686
+ if (!v.length) return null;
5687
+ const x = g[v], I = parseFloat(String(x !== void 0 ? x : v).replace(/\s/g, ""));
5688
+ return isNaN(I) ? null : I;
5689
+ }
5690
+ function P(r, g, v) {
5691
+ const x = isNaN(Number(g)) ? 0 : Math.max(0, parseInt(String(g))), N = J(r, v);
5626
5692
  if (N === null) return r;
5627
5693
  try {
5628
5694
  return N.toLocaleString(void 0, {
@@ -5633,46 +5699,46 @@ var y;
5633
5699
  return N.toFixed(x);
5634
5700
  }
5635
5701
  }
5636
- function U(r, u = /* @__PURE__ */ new Date()) {
5637
- const w = u.getTime() - r.getTime(), x = w >= 0, N = Math.abs(w), T = Math.floor(N / 1e3), I = Math.floor(T / 60), M = Math.floor(I / 60), E = Math.floor(M / 24), H = Math.floor(E / 30), _ = Math.floor(E / 365), Y = x ? "ago" : "from now";
5638
- return _ > 0 ? `${_}y ${Y}` : H > 0 ? `${H}mo ${Y}` : E > 0 ? `${E}d ${Y}` : M > 0 ? `${M}h ${Y}` : I > 0 ? `${I}m ${Y}` : `${Math.max(T, 0)}s ${Y}`;
5702
+ function U(r, g = /* @__PURE__ */ new Date()) {
5703
+ const v = g.getTime() - r.getTime(), x = v >= 0, N = Math.abs(v), I = Math.floor(N / 1e3), T = Math.floor(I / 60), M = Math.floor(T / 60), E = Math.floor(M / 24), H = Math.floor(E / 30), _ = Math.floor(E / 365), Y = x ? "ago" : "from now";
5704
+ return _ > 0 ? `${_}y ${Y}` : H > 0 ? `${H}mo ${Y}` : E > 0 ? `${E}d ${Y}` : M > 0 ? `${M}h ${Y}` : T > 0 ? `${T}m ${Y}` : `${Math.max(I, 0)}s ${Y}`;
5639
5705
  }
5640
- function S(r, u, w) {
5706
+ function S(r, g, v) {
5641
5707
  const x = r?.trim?.() ?? "";
5642
5708
  if (!x.length) return r;
5643
- const N = w[x] ?? x, T = new Date(N);
5644
- if (isNaN(T.getTime())) return r;
5645
- const I = (u ?? "date").toString().toLowerCase();
5709
+ const N = v[x] ?? x, I = new Date(N);
5710
+ if (isNaN(I.getTime())) return r;
5711
+ const T = (g ?? "date").toString().toLowerCase();
5646
5712
  try {
5647
- switch (I) {
5713
+ switch (T) {
5648
5714
  case "time":
5649
- return T.toLocaleTimeString();
5715
+ return I.toLocaleTimeString();
5650
5716
  case "datetime":
5651
5717
  case "full":
5652
- return T.toLocaleString();
5718
+ return I.toLocaleString();
5653
5719
  case "relative":
5654
5720
  case "ago":
5655
- return U(T);
5721
+ return U(I);
5656
5722
  case "iso":
5657
- return T.toISOString();
5723
+ return I.toISOString();
5658
5724
  default:
5659
- return T.toLocaleDateString();
5725
+ return I.toLocaleDateString();
5660
5726
  }
5661
5727
  } catch {
5662
5728
  return r;
5663
5729
  }
5664
5730
  }
5665
- function L(r, u, w) {
5666
- const x = r ?? "", [N, T = N] = x.split("|", 2), I = u?.trim();
5731
+ function L(r, g, v) {
5732
+ const x = r ?? "", [N, I = N] = x.split("|", 2), T = g?.trim();
5667
5733
  let M;
5668
- I && w[I] !== void 0 ? M = w[I] : M = w.amount ?? w.count;
5734
+ T && v[T] !== void 0 ? M = v[T] : M = v.amount ?? v.count;
5669
5735
  const E = parseFloat(String(M));
5670
- return isNaN(E) ? N : Math.abs(E) !== 1 ? T : N;
5736
+ return isNaN(E) ? N : Math.abs(E) !== 1 ? I : N;
5671
5737
  }
5672
- function O(r, u, w) {
5673
- const x = u?.trim() ?? "", N = x && w[x] !== void 0 ? w[x] : "", T = String(N), I = (r ?? "").split("|").map((E) => E.trim()).filter((E) => E.length);
5738
+ function O(r, g, v) {
5739
+ const x = g?.trim() ?? "", N = x && v[x] !== void 0 ? v[x] : "", I = String(N), T = (r ?? "").split("|").map((E) => E.trim()).filter((E) => E.length);
5674
5740
  let M;
5675
- for (const E of I) {
5741
+ for (const E of T) {
5676
5742
  const H = E.indexOf(":");
5677
5743
  if (H === -1) continue;
5678
5744
  const _ = E.slice(0, H).trim(), Y = E.slice(H + 1);
@@ -5681,7 +5747,7 @@ var y;
5681
5747
  M = Y;
5682
5748
  continue;
5683
5749
  }
5684
- if (T === _) return Y;
5750
+ if (I === _) return Y;
5685
5751
  }
5686
5752
  }
5687
5753
  return M ?? "";
@@ -5689,46 +5755,46 @@ var y;
5689
5755
  function z(r) {
5690
5756
  return r.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
5691
5757
  }
5692
- function V(r, u) {
5693
- let w = r.trim();
5694
- if (!w.length) return;
5695
- const x = w[0], N = w[w.length - 1];
5758
+ function V(r, g) {
5759
+ let v = r.trim();
5760
+ if (!v.length) return;
5761
+ const x = v[0], N = v[v.length - 1];
5696
5762
  if (x === '"' && N === '"' || x === "'" && N === "'")
5697
- return w.slice(1, -1);
5698
- const T = w.toLowerCase();
5699
- if (T === "true") return !0;
5700
- if (T === "false") return !1;
5701
- if (/^-?\d+(\.\d+)?$/.test(w)) return parseFloat(w);
5702
- const I = u?.[w];
5703
- if (I === void 0) return w;
5704
- const M = String(I).trim(), E = M.toLowerCase();
5705
- return E === "true" ? !0 : E === "false" ? !1 : /^-?\d+(\.\d+)?$/.test(M) ? parseFloat(M) : I;
5763
+ return v.slice(1, -1);
5764
+ const I = v.toLowerCase();
5765
+ if (I === "true") return !0;
5766
+ if (I === "false") return !1;
5767
+ if (/^-?\d+(\.\d+)?$/.test(v)) return parseFloat(v);
5768
+ const T = g?.[v];
5769
+ if (T === void 0) return v;
5770
+ const M = String(T).trim(), E = M.toLowerCase();
5771
+ return E === "true" ? !0 : E === "false" ? !1 : /^-?\d+(\.\d+)?$/.test(M) ? parseFloat(M) : T;
5706
5772
  }
5707
5773
  function W(r) {
5708
5774
  if (typeof r == "boolean") return r;
5709
5775
  if (r == null) return !1;
5710
- const u = String(r).trim().toLowerCase();
5711
- return !(!u.length || ["false", "0", "no", "off", "null", "undefined", "nan"].includes(u));
5776
+ const g = String(r).trim().toLowerCase();
5777
+ return !(!g.length || ["false", "0", "no", "off", "null", "undefined", "nan"].includes(g));
5712
5778
  }
5713
- function F(r, u) {
5714
- let w = r.trim();
5715
- if (!w.length) return !1;
5779
+ function F(r, g) {
5780
+ let v = r.trim();
5781
+ if (!v.length) return !1;
5716
5782
  let x = !1;
5717
- for (; w.startsWith("!"); )
5718
- x = !x, w = w.slice(1).trim();
5783
+ for (; v.startsWith("!"); )
5784
+ x = !x, v = v.slice(1).trim();
5719
5785
  const N = ["===", "!==", "==", "!=", ">=", "<=", ">", "<"];
5720
- let T = null, I = w, M = "";
5786
+ let I = null, T = v, M = "";
5721
5787
  for (const H of N) {
5722
- const _ = w.indexOf(H);
5788
+ const _ = v.indexOf(H);
5723
5789
  if (_ !== -1) {
5724
- T = H, I = w.slice(0, _), M = w.slice(_ + H.length);
5790
+ I = H, T = v.slice(0, _), M = v.slice(_ + H.length);
5725
5791
  break;
5726
5792
  }
5727
5793
  }
5728
5794
  let E;
5729
- if (T) {
5730
- const H = V(I, u), _ = V(M, u);
5731
- switch (T) {
5795
+ if (I) {
5796
+ const H = V(T, g), _ = V(M, g);
5797
+ switch (I) {
5732
5798
  case "===":
5733
5799
  E = H === _;
5734
5800
  break;
@@ -5758,89 +5824,92 @@ var y;
5758
5824
  break;
5759
5825
  }
5760
5826
  } else {
5761
- const H = V(I, u);
5827
+ const H = V(T, g);
5762
5828
  E = W(H);
5763
5829
  }
5764
5830
  return x ? !E : E;
5765
5831
  }
5766
- function B(r, u) {
5767
- let w = r.trim();
5768
- if (!w.length) return !1;
5832
+ function B(r, g) {
5833
+ let v = r.trim();
5834
+ if (!v.length) return !1;
5769
5835
  let x = !1;
5770
- for (; w.startsWith("!"); )
5771
- x = !x, w = w.slice(1).trim();
5772
- const N = w.split("||").map((I) => I.trim()).filter((I) => I.length);
5836
+ for (; v.startsWith("!"); )
5837
+ x = !x, v = v.slice(1).trim();
5838
+ const N = v.split("||").map((T) => T.trim()).filter((T) => T.length);
5773
5839
  if (!N.length) return !!x;
5774
- let T = !1;
5775
- for (const I of N) {
5776
- const M = I.split("&&").map((H) => H.trim()).filter((H) => H.length);
5840
+ let I = !1;
5841
+ for (const T of N) {
5842
+ const M = T.split("&&").map((H) => H.trim()).filter((H) => H.length);
5777
5843
  if (!M.length) continue;
5778
5844
  let E = !0;
5779
5845
  for (const H of M) {
5780
- const _ = F(H, u);
5846
+ const _ = F(H, g);
5781
5847
  if (E = E && _, !E) break;
5782
5848
  }
5783
- if (T = T || E, T) break;
5784
- }
5785
- return x ? !T : T;
5786
- }
5787
- const at = {
5788
- COLOR: (r, u) => l(u && i.validate(u) ? `color: ${u}` : "", r, "color"),
5789
- WEIGHT: (r, u) => l(u && !isNaN(parseInt(u)) ? `font-weight: ${u}` : "", r, "weight"),
5790
- SEMIBOLD: (r) => l("font-weight: 600", r, "semibold"),
5791
- BOLD: (r) => l("font-weight: bold", r, "bold"),
5792
- BLACK: (r) => l("font-weight: 900", r, "black"),
5793
- LIGHT: (r) => l("font-weight: lighter", r, "light"),
5794
- STRONG: (r) => l("font-weight: bolder", r, "strong"),
5795
- ITALIC: (r) => l("font-style: italic", r, "italic"),
5796
- UNDERLINE: (r) => l("text-decoration: underline", r, "underline"),
5797
- STRIKETHROUGH: (r) => l("text-decoration: line-through", r, "strikethrough"),
5798
- SUB: (r) => l("vertical-align: sub", r, "sub"),
5799
- SUP: (r) => l("vertical-align: super", r, "sup"),
5800
- LARGER: (r) => l("font-size: larger", r, "larger"),
5801
- SMALL: (r) => l("font-size: smaller", r, "small"),
5802
- SHADOW: (r, u) => l(`text-shadow: ${u}`, r, "shadow"),
5803
- SIZE: (r, u) => l(u ? `font-size: ${u}` : "", r, "size")
5804
- }, ot = {
5849
+ if (I = I || E, I) break;
5850
+ }
5851
+ return x ? !I : I;
5852
+ }
5853
+ const st = {
5854
+ COLOR: (r, g) => h(g && i.validate(g) ? `color: ${g}` : "", r, "color"),
5855
+ WEIGHT: (r, g) => h(g && !isNaN(parseInt(g)) ? `font-weight: ${g}` : "", r, "weight"),
5856
+ SEMIBOLD: (r) => h("font-weight: 600", r, "semibold"),
5857
+ BOLD: (r) => h("font-weight: bold", r, "bold"),
5858
+ BLACK: (r) => h("font-weight: 900", r, "black"),
5859
+ LIGHT: (r) => h("font-weight: lighter", r, "light"),
5860
+ STRONG: (r) => h("font-weight: bolder", r, "strong"),
5861
+ ITALIC: (r) => h("font-style: italic", r, "italic"),
5862
+ UNDERLINE: (r) => h("text-decoration: underline", r, "underline"),
5863
+ STRIKETHROUGH: (r) => h("text-decoration: line-through", r, "strikethrough"),
5864
+ SUB: (r) => h("vertical-align: sub", r, "sub"),
5865
+ SUP: (r) => h("vertical-align: super", r, "sup"),
5866
+ LARGER: (r) => h("font-size: larger", r, "larger"),
5867
+ SMALL: (r) => h("font-size: smaller", r, "small"),
5868
+ SHADOW: (r, g) => h(`text-shadow: ${g}`, r, "shadow"),
5869
+ SIZE: (r, g) => h(g ? `font-size: ${g}` : "", r, "size")
5870
+ }, dt = {
5805
5871
  ...{
5806
- BT1: (r) => P > 1 ? r : "",
5807
- BT0: (r) => P > 0 ? r : "",
5808
- ST1: (r) => P < 1 ? r : "",
5809
- ST0: (r) => P < 0 ? r : "",
5872
+ BT1: (r) => D > 1 ? r : "",
5873
+ BT0: (r) => D > 0 ? r : "",
5874
+ ST1: (r) => D < 1 ? r : "",
5875
+ ST0: (r) => D < 0 ? r : "",
5810
5876
  UPC: (r) => r.toUpperCase(),
5811
5877
  LOW: (r) => r.toLowerCase(),
5812
5878
  REV: (r) => r.split("").reverse().join(""),
5813
5879
  CAP: (r) => r.charAt(0).toUpperCase() + r.slice(1).toLowerCase(),
5814
- NUMBER: (r, u, w) => J(r, u, w),
5815
- PLURAL: (r, u, w) => L(r, u, w),
5816
- DATE: (r, u, w) => S(r, u, w),
5817
- MAP: (r, u, w) => O(r, u, w),
5880
+ NUMBER: (r, g, v) => P(r, g, v),
5881
+ PLURAL: (r, g, v) => L(r, g, v),
5882
+ DATE: (r, g, v) => S(r, g, v),
5883
+ MAP: (r, g, v) => O(r, g, v),
5818
5884
  ESCAPE: (r) => z(r),
5819
- IF: (r, u, w) => {
5820
- const x = r ?? "", [N, T] = x.split("?", 2);
5821
- if (!T) return x;
5822
- const [I, M = ""] = T.split("|", 2);
5823
- return B(N, w) ? I : M;
5885
+ IF: (r, g, v) => {
5886
+ const x = r ?? "", [N, I] = x.split("?", 2);
5887
+ if (!I) return x;
5888
+ const [T, M = ""] = I.split("|", 2);
5889
+ return B(
5890
+ N,
5891
+ v
5892
+ ) ? T : M;
5824
5893
  },
5825
- PRESET: (r, u) => {
5826
- const w = u?.trim() ?? "";
5827
- if (!w.length) return r;
5828
- const x = n.PRESETS[w];
5894
+ PRESET: (r, g) => {
5895
+ const v = g?.trim() ?? "";
5896
+ if (!v.length) return r;
5897
+ const x = n.PRESETS[v];
5829
5898
  if (!x || !x.length) return r;
5830
- const N = x.split(",").map((I) => I.trim()).filter((I) => I.length).map((I) => {
5831
- const [M, E] = I.split(":");
5899
+ const N = x.split(",").map((T) => T.trim()).filter((T) => T.length).map((T) => {
5900
+ const [M, E] = T.split(":");
5832
5901
  return { name: M.trim(), param: E?.trim() ?? null };
5833
5902
  });
5834
- let T = r;
5835
- for (const { name: I, param: M } of N)
5836
- T = K(T, I, M);
5837
- return T;
5903
+ let I = r;
5904
+ for (const { name: T, param: M } of N)
5905
+ I = K(I, T, M);
5906
+ return I;
5838
5907
  },
5839
- FALLBACK: (r, u) => r.length ? r : u ?? r
5908
+ FALLBACK: (r, g) => r.length ? r : g ?? r
5840
5909
  },
5841
- ...d?.html ? at : {},
5842
- ...d.modifiers ?? {}
5843
- }, ct = {
5910
+ ...m?.html ? st : {},
5911
+ ...m.modifiers ?? {}
5912
+ }, ht = {
5844
5913
  UPC: ["UPPERCASE", "UPPER", "UPP"],
5845
5914
  LOW: ["LOWERCASE", "LOWER", "LWC"],
5846
5915
  REV: ["REVERSE", "RVS"],
@@ -5868,240 +5937,249 @@ var y;
5868
5937
  SHADOW: ["SHADOW", "SHD"],
5869
5938
  FALLBACK: ["FALLBACK", "FB"],
5870
5939
  IF: ["IF", "COND", "CONDITION"],
5871
- ...d.aliases ?? {}
5940
+ ...m.aliases ?? {}
5872
5941
  };
5873
- function K(r, u, w) {
5874
- const x = Object.entries(ct).find(([T, I]) => I.some((M) => M.toUpperCase() === u.toUpperCase()) ? !0 : T.toUpperCase() === u.toUpperCase()), N = x ? x[0] : u.toUpperCase();
5942
+ function K(r, g, v) {
5943
+ const x = Object.entries(ht).find(([I, T]) => T.some((M) => M.toUpperCase() === g.toUpperCase()) ? !0 : I.toUpperCase() === g.toUpperCase()), N = x ? x[0] : g.toUpperCase();
5875
5944
  try {
5876
- return ot[N] ? ot[N](r, typeof w == "string" ? w.trim() : null, k) : d?.html ? l("", r, N.toLowerCase()) : r;
5877
- } catch (T) {
5878
- return d?.debug && typeof console < "u" && typeof console.error == "function" && console.error("[Helper.string.compose] Modifier error", { name: u, param: w, error: T }), r;
5945
+ return dt[N] ? dt[N](r, typeof v == "string" ? v.trim() : null, k) : m?.html ? h("", r, N.toLowerCase()) : r;
5946
+ } catch (I) {
5947
+ return m?.debug && typeof console < "u" && typeof console.error == "function" && console.error("[Helper.string.compose] Modifier error", { name: g, param: v, error: I }), r;
5879
5948
  }
5880
5949
  }
5881
- function st(r) {
5882
- let u = r, w;
5883
- for (; (w = j.MODIFIERS.exec(u)) !== null; ) {
5884
- const [x, N, T] = w, I = N.split(",").map((E) => E.trim()).filter((E) => E.length).map((E) => {
5950
+ function nt(r) {
5951
+ let g = r, v;
5952
+ for (; (v = j.MODIFIERS.exec(g)) !== null; ) {
5953
+ const [x, N, I] = v, T = N.split(",").map((E) => E.trim()).filter((E) => E.length).map((E) => {
5885
5954
  const [H, _] = E.split(":");
5886
5955
  return { name: H.trim(), param: _?.trim() ?? null };
5887
5956
  });
5888
- let M = st(T);
5889
- for (const { name: E, param: H } of I)
5957
+ let M = nt(I);
5958
+ for (const { name: E, param: H } of T)
5890
5959
  M = K(M, E, H);
5891
- u = u.replace(x, M ?? ""), j.MODIFIERS.lastIndex = 0;
5892
- }
5893
- return u;
5894
- }
5895
- function X(r) {
5896
- let u = 0;
5897
- const w = r.length;
5898
- function x(T) {
5899
- let I = "";
5900
- for (; u < w; )
5901
- if (r[u] === "\\")
5902
- u + 1 < w ? (I += r[u + 1], u += 2) : u++;
5903
- else if (r[u] === "[" && (!T || T !== "["))
5904
- I += N();
5905
- else if (T && r[u] === T) {
5906
- u++;
5960
+ g = g.replace(x, M ?? ""), j.MODIFIERS.lastIndex = 0;
5961
+ }
5962
+ return g;
5963
+ }
5964
+ function Q(r) {
5965
+ let g = 0;
5966
+ const v = r.length;
5967
+ function x(I) {
5968
+ let T = "";
5969
+ for (; g < v; )
5970
+ if (r[g] === "\\")
5971
+ g + 1 < v ? (T += r[g + 1], g += 2) : g++;
5972
+ else if (r[g] === "[" && (!I || I !== "["))
5973
+ T += N();
5974
+ else if (I && r[g] === I) {
5975
+ g++;
5907
5976
  break;
5908
5977
  } else
5909
- I += r[u++];
5910
- return I;
5978
+ T += r[g++];
5979
+ return T;
5911
5980
  }
5912
5981
  function N() {
5913
- u++;
5914
- const T = [];
5915
- for (; u < w && r[u] !== "="; ) {
5916
- if (r[u] === ",") {
5917
- u++;
5982
+ g++;
5983
+ const I = [];
5984
+ for (; g < v && r[g] !== "="; ) {
5985
+ if (r[g] === ",") {
5986
+ g++;
5918
5987
  continue;
5919
5988
  }
5920
5989
  let M = "";
5921
- for (; u < w && /[A-Za-z0-9]/.test(r[u]); ) M += r[u++];
5990
+ for (; g < v && /[A-Za-z0-9]/.test(r[g]); ) M += r[g++];
5922
5991
  let E = null;
5923
- if (r[u] === ":") {
5924
- u++;
5925
- const H = u;
5926
- for (; u < w && r[u] !== "," && r[u] !== "="; ) u++;
5927
- E = r.slice(H, u);
5992
+ if (r[g] === ":") {
5993
+ g++;
5994
+ const H = g;
5995
+ for (; g < v && r[g] !== "," && r[g] !== "="; ) g++;
5996
+ E = r.slice(H, g);
5928
5997
  }
5929
- M.length && T.push({ name: M, param: E }), r[u] === "," && u++;
5998
+ M.length && I.push({ name: M, param: E }), r[g] === "," && g++;
5930
5999
  }
5931
- r[u] === "=" && u++;
5932
- const I = x("]");
5933
- return T.reduce((M, { name: E, param: H }) => K(M, E, H), I);
6000
+ r[g] === "=" && g++;
6001
+ const T = x("]");
6002
+ return I.reduce((M, { name: E, param: H }) => K(M, E, H), T);
5934
6003
  }
5935
6004
  return x();
5936
6005
  }
5937
- let $ = g.replace(
6006
+ let $ = u.replace(
5938
6007
  j.PLACEHOLDERS,
5939
- (r, u) => typeof k[u] == "string" || typeof k[u] == "number" ? String(k[u]) : u ?? u
6008
+ (r, g) => typeof k[g] == "string" || typeof k[g] == "number" ? String(k[g]) : g ?? g
5940
6009
  );
5941
- return $ = d.method === "loop" ? st($) : X($), $;
6010
+ return $ = m.method === "loop" ? nt($) : Q($), $;
5942
6011
  }
5943
- n.compose = b;
5944
- })(h.string || (h.string = {})), ((n) => {
6012
+ n.compose = f;
6013
+ })(d.string || (d.string = {})), ((n) => {
5945
6014
  n.playing = !1;
5946
- function m(o, b = 100, g = !1) {
5947
- if (!o || !o.length)
6015
+ function l(c, f = 100, u = !1) {
6016
+ if (!c || !c.length)
5948
6017
  throw new Error("No sound URL provided");
5949
6018
  try {
5950
- g && n.playing && n.audio && n.audio.state !== "closed" && n.audio.close();
5951
- let c = new AudioContext(), d = c.createGain();
5952
- d.connect(c.destination), g && (n.audio = c, n.playing = !0), fetch(o).then((f) => f.arrayBuffer()).then((f) => c.decodeAudioData(f)).then((f) => {
5953
- if (c.state !== "closed") {
5954
- const l = c.createBufferSource();
5955
- l.buffer = f, l.connect(d), d.gain.value = b / 100, l.start(c.currentTime);
6019
+ u && n.playing && n.audio && n.audio.state !== "closed" && n.audio.close();
6020
+ let o = new AudioContext(), m = o.createGain();
6021
+ m.connect(o.destination), u && (n.audio = o, n.playing = !0), fetch(c).then((w) => w.arrayBuffer()).then((w) => o.decodeAudioData(w)).then((w) => {
6022
+ if (o.state !== "closed") {
6023
+ const h = o.createBufferSource();
6024
+ h.buffer = w, h.connect(m), m.gain.value = f / 100, h.start(o.currentTime);
5956
6025
  }
5957
6026
  });
5958
- } catch (c) {
5959
- throw new Error(`Error playing sound: ${c}`);
6027
+ } catch (o) {
6028
+ throw new Error(`Error playing sound: ${o}`);
5960
6029
  }
5961
6030
  }
5962
- n.play = m;
5963
- })(h.sound || (h.sound = {}));
6031
+ n.play = l;
6032
+ })(d.sound || (d.sound = {}));
5964
6033
  let i;
5965
6034
  ((n) => {
5966
- function m(c = 100, d = "") {
5967
- d = d.length > 7 ? d?.substring(0, 6) : d, c = c > 1 ? c / 100 : c;
5968
- let f = Math.round(Math.min(Math.max(c, 0), 1) * 255).toString(16).toLowerCase().padStart(2, "0");
5969
- return d + f;
6035
+ function l(o = 100, m = "") {
6036
+ m = m.length > 7 ? m?.substring(0, 6) : m, o = o > 1 ? o / 100 : o;
6037
+ let w = Math.round(Math.min(Math.max(o, 0), 1) * 255).toString(16).toLowerCase().padStart(2, "0");
6038
+ return m + w;
5970
6039
  }
5971
- n.opacity = m;
5972
- function o(c) {
5973
- if (!c.startsWith("#") || c.length <= 7)
6040
+ n.opacity = l;
6041
+ function c(o) {
6042
+ if (!o.startsWith("#") || o.length <= 7)
5974
6043
  return {
5975
- color: c,
6044
+ color: o,
5976
6045
  opacity: 100
5977
6046
  };
5978
- var l = c.slice(-2), d = parseInt(l, 16) / 255, f = Math.round(d * 100), l = c.length > 7 ? c.slice(0, 7) : c;
6047
+ var h = o.slice(-2), m = parseInt(h, 16) / 255, w = Math.round(m * 100), h = o.length > 7 ? o.slice(0, 7) : o;
5979
6048
  return {
5980
- color: l,
5981
- opacity: f
6049
+ color: h,
6050
+ opacity: w
5982
6051
  };
5983
6052
  }
5984
- n.extract = o;
5985
- function b(c) {
5986
- if (typeof c != "string" || !String(c).trim().length) return !1;
5987
- const d = c.trim();
5988
- return /^#([A-Fa-f0-9]{3}){1,2}$/.test(d) || /^#([A-Fa-f0-9]{4}|[A-Fa-f0-9]{8})$/.test(d) ? "hex" : /^rgb\(\s*(?:\d{1,3}\s*,\s*){2}\d{1,3}\s*\)$/.test(d) ? "rgb" : /^rgba\(\s*(?:\d{1,3}\s*,\s*){3}(?:0|1|0?\.\d+)\s*\)$/.test(d) ? "rgba" : /^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/.test(d) ? "hsl" : /^hsla\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*,\s*(?:0|1|0?\.\d+)\s*\)$/.test(d) ? "hsla" : D.css_color_names.includes(d.toLowerCase()) ? "css-color-name" : !1;
6053
+ n.extract = c;
6054
+ function f(o) {
6055
+ if (typeof o != "string" || !String(o).trim().length) return !1;
6056
+ const m = o.trim();
6057
+ return /^#([A-Fa-f0-9]{3}){1,2}$/.test(m) || /^#([A-Fa-f0-9]{4}|[A-Fa-f0-9]{8})$/.test(m) ? "hex" : /^rgb\(\s*(?:\d{1,3}\s*,\s*){2}\d{1,3}\s*\)$/.test(m) ? "rgb" : /^rgba\(\s*(?:\d{1,3}\s*,\s*){3}(?:0|1|0?\.\d+)\s*\)$/.test(m) ? "rgba" : /^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/.test(m) ? "hsl" : /^hsla\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*,\s*(?:0|1|0?\.\d+)\s*\)$/.test(m) ? "hsla" : A.css_color_names.includes(m.toLowerCase()) ? "css-color-name" : !1;
5989
6058
  }
5990
- n.validate = b;
5991
- async function g(c, d) {
5992
- const f = b(c);
5993
- if (!f) throw new Error(`Invalid color format: ${c}`);
5994
- if (f === d) throw new Error(`Color is already in the desired format: ${d}`);
5995
- const l = pt(c.trim(), f);
5996
- if (!l) throw new Error(`Failed to parse color: ${c}`);
5997
- switch (d) {
6059
+ n.validate = f;
6060
+ async function u(o, m) {
6061
+ const w = f(o);
6062
+ if (!w) throw new Error(`Invalid color format: ${o}`);
6063
+ if (w === m) throw new Error(`Color is already in the desired format: ${m}`);
6064
+ const h = ft(o.trim(), w);
6065
+ if (!h) throw new Error(`Failed to parse color: ${o}`);
6066
+ switch (m) {
5998
6067
  case "hex":
5999
- return ft(l, !1);
6068
+ return bt(h, !1);
6000
6069
  case "rgb":
6001
- return `rgb(${l.r}, ${l.g}, ${l.b})`;
6070
+ return `rgb(${h.r}, ${h.g}, ${h.b})`;
6002
6071
  case "rgba":
6003
- return `rgba(${l.r}, ${l.g}, ${l.b}, ${l.a})`;
6072
+ return `rgba(${h.r}, ${h.g}, ${h.b}, ${h.a})`;
6004
6073
  case "hsl": {
6005
- const p = dt(l.r, l.g, l.b);
6074
+ const p = lt(h.r, h.g, h.b);
6006
6075
  return `hsl(${p.h}, ${p.s}%, ${p.l}%)`;
6007
6076
  }
6008
6077
  case "hsla": {
6009
- const p = dt(l.r, l.g, l.b);
6010
- return `hsla(${p.h}, ${p.s}%, ${p.l}%, ${l.a})`;
6078
+ const p = lt(h.r, h.g, h.b);
6079
+ return `hsla(${p.h}, ${p.s}%, ${p.l}%, ${h.a})`;
6011
6080
  }
6012
6081
  case "css-color-name":
6013
- return await yt(l.r, l.g, l.b);
6082
+ return await wt(h.r, h.g, h.b);
6014
6083
  default:
6015
6084
  return null;
6016
6085
  }
6017
6086
  }
6018
- n.convert = g;
6019
- })(i = h.color || (h.color = {}));
6087
+ n.convert = u;
6088
+ })(i = d.color || (d.color = {}));
6020
6089
  let s;
6021
6090
  ((n) => {
6022
- function m(p = "hex") {
6091
+ function l(p = "hex") {
6023
6092
  switch (p) {
6024
6093
  default:
6025
6094
  case "hex":
6026
6095
  return `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")}`;
6027
6096
  case "hexa": {
6028
- const v = `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")}`, k = Math.floor(Math.random() * 256).toString(16).padStart(2, "0");
6029
- return v + k;
6097
+ const C = `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")}`, k = Math.floor(Math.random() * 256).toString(16).padStart(2, "0");
6098
+ return C + k;
6030
6099
  }
6031
6100
  case "rgb": {
6032
- const v = Math.floor(Math.random() * 256), k = Math.floor(Math.random() * 256), j = Math.floor(Math.random() * 256);
6033
- return `rgb(${v}, ${k}, ${j})`;
6101
+ const C = Math.floor(Math.random() * 256), k = Math.floor(Math.random() * 256), j = Math.floor(Math.random() * 256);
6102
+ return `rgb(${C}, ${k}, ${j})`;
6034
6103
  }
6035
6104
  case "rgba": {
6036
- const v = Math.floor(Math.random() * 256), k = Math.floor(Math.random() * 256), j = Math.floor(Math.random() * 256), P = Math.random().toFixed(2);
6037
- return `rgba(${v}, ${k}, ${j}, ${P})`;
6105
+ const C = Math.floor(Math.random() * 256), k = Math.floor(Math.random() * 256), j = Math.floor(Math.random() * 256), D = Math.random().toFixed(2);
6106
+ return `rgba(${C}, ${k}, ${j}, ${D})`;
6038
6107
  }
6039
6108
  case "hsl": {
6040
- const v = Math.floor(Math.random() * 361), k = Math.floor(Math.random() * 101), j = Math.floor(Math.random() * 101);
6041
- return `hsl(${v}, ${k}%, ${j}%)`;
6109
+ const C = Math.floor(Math.random() * 361), k = Math.floor(Math.random() * 101), j = Math.floor(Math.random() * 101);
6110
+ return `hsl(${C}, ${k}%, ${j}%)`;
6042
6111
  }
6043
6112
  case "hsla": {
6044
- const v = Math.floor(Math.random() * 361), k = Math.floor(Math.random() * 101), j = Math.floor(Math.random() * 101), P = Math.random().toFixed(2);
6045
- return `hsla(${v}, ${k}%, ${j}%, ${P})`;
6113
+ const C = Math.floor(Math.random() * 361), k = Math.floor(Math.random() * 101), j = Math.floor(Math.random() * 101), D = Math.random().toFixed(2);
6114
+ return `hsla(${C}, ${k}%, ${j}%, ${D})`;
6046
6115
  }
6047
6116
  case "css-color-name": {
6048
- var C = D.css_color_names;
6049
- return c(C)[0];
6117
+ var y = A.css_color_names;
6118
+ return o(y)[0];
6050
6119
  }
6051
6120
  }
6052
6121
  }
6053
- n.color = m;
6054
- function o(p, C, v = 0) {
6055
- p > C && ([p, C] = [C, p]);
6056
- const k = Math.random() * (C - p) + p;
6057
- return v ? Number(k.toFixed(v)) : Math.round(k);
6122
+ n.color = l;
6123
+ function c(p, y, C = 0) {
6124
+ p > y && ([p, y] = [y, p]);
6125
+ const k = Math.random() * (y - p) + p;
6126
+ return C ? Number(k.toFixed(C)) : Math.round(k);
6058
6127
  }
6059
- n.number = o;
6060
- function b(p = 0.5) {
6128
+ n.number = c;
6129
+ function f(p = 0.5) {
6061
6130
  return Math.random() > p;
6062
6131
  }
6063
- n.boolean = b;
6064
- function g(p, C = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") {
6065
- let v = "";
6132
+ n.boolean = f;
6133
+ function u(p, y = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") {
6134
+ let C = "";
6066
6135
  for (let k = 0; k < p; k++)
6067
- v += C.charAt(Math.floor(Math.random() * C.length));
6068
- return v;
6136
+ C += y.charAt(Math.floor(Math.random() * y.length));
6137
+ return C;
6069
6138
  }
6070
- n.string = g;
6071
- function c(p) {
6072
- const C = o(0, p.length - 1);
6073
- return [p[C], C];
6139
+ n.string = u;
6140
+ function o(p) {
6141
+ const y = c(0, p.length - 1);
6142
+ return [p[y], y];
6074
6143
  }
6075
- n.array = c;
6076
- function d(p = new Date(2e3, 0, 1), C = /* @__PURE__ */ new Date()) {
6077
- return new Date(o(p.getTime(), C.getTime()));
6144
+ n.array = o;
6145
+ function m(p = new Date(2e3, 0, 1), y = /* @__PURE__ */ new Date()) {
6146
+ return new Date(c(p.getTime(), y.getTime()));
6078
6147
  }
6079
- n.date = d;
6080
- function f(p) {
6081
- const v = Date.now() - o(0, p * 24 * 60 * 60 * 1e3);
6082
- return new Date(v).toISOString();
6148
+ n.date = m;
6149
+ function w(p) {
6150
+ const C = Date.now() - c(0, p * 24 * 60 * 60 * 1e3);
6151
+ return new Date(C).toISOString();
6083
6152
  }
6084
- n.daysOffset = f;
6085
- function l() {
6153
+ n.daysOffset = w;
6154
+ function h() {
6086
6155
  return crypto.randomUUID();
6087
6156
  }
6088
- n.uuid = l;
6089
- })(s = h.random || (h.random = {}));
6090
- })(y || (y = {}));
6091
- class it {
6157
+ n.uuid = h;
6158
+ })(s = d.random || (d.random = {})), ((n) => {
6159
+ function l(f, u, o) {
6160
+ return f.apply(u, o);
6161
+ }
6162
+ n.apply = l;
6163
+ function c(f, u, ...o) {
6164
+ return f.call(u, ...o);
6165
+ }
6166
+ n.call = c;
6167
+ })(d.fn || (d.fn = {}));
6168
+ })(b || (b = {}));
6169
+ class at {
6092
6170
  constructor(e) {
6093
6171
  this.field = "button", this.template = "button", this.name = "Button", this.value = "", window.client instanceof G && (this.field = e.field ?? this.field, this.template = e.template ?? (typeof this.field == "string" ? this.field : this.template), this.name = e.name ?? this.name, this.value = e.value ?? this.value, this.run = e.run, window.client.actions.buttons.push(this), window.client.emit("action", this, "created"));
6094
6172
  }
6095
6173
  generate(e) {
6096
- return y.utils.typedValues(e).reduce(
6174
+ return b.utils.typedValues(e).reduce(
6097
6175
  (a, i, s) => {
6098
- const n = y.string.compose(this.template, { index: s, ...i }, { html: !1 }), m = y.string.compose(this.name, { index: s, ...i }, { html: !1 });
6176
+ const n = b.string.compose(this.template, { index: s, ...i }, { html: !1 }), l = b.string.compose(this.name, { index: s, ...i }, { html: !1 });
6099
6177
  a[n] = {
6100
6178
  type: "button",
6101
- label: m
6179
+ label: l
6102
6180
  };
6103
- let o = y.string.compose(String(this.value), { index: s, ...i }, { html: !1 });
6104
- return isNaN(Number(o)) ? o.toLowerCase() === "true" ? o = !0 : o.toLowerCase() === "false" && (o = !1) : o = Number(o), typeof o < "u" && o && (typeof o != "string" || o.length) && (a[n].value = o), a;
6181
+ let c = b.string.compose(String(this.value), { index: s, ...i }, { html: !1 });
6182
+ return isNaN(Number(c)) ? c.toLowerCase() === "true" ? c = !0 : c.toLowerCase() === "false" && (c = !1) : c = Number(c), typeof c < "u" && c && (typeof c != "string" || c.length) && (a[n].value = c), a;
6105
6183
  },
6106
6184
  {}
6107
6185
  );
@@ -6125,7 +6203,7 @@ class it {
6125
6203
  if (!(window.client instanceof G)) return !1;
6126
6204
  if (window.client.actions.buttons.length) {
6127
6205
  const a = window.client.actions.buttons.filter((i) => typeof i.field == "string" ? i.field === e : typeof i.field == "function" ? i.field(e, t) : !1);
6128
- if (a.length && a.every((i) => i instanceof it))
6206
+ if (a.length && a.every((i) => i instanceof at))
6129
6207
  return a.forEach((i) => {
6130
6208
  try {
6131
6209
  i.parse(e, t), window.client.emit("action", i, "executed"), R.received(`Button executed: ${e}${t ? ` with value: ${t}` : ""}`);
@@ -6142,15 +6220,15 @@ class it {
6142
6220
  }
6143
6221
  }
6144
6222
  var q;
6145
- ((h) => {
6146
- h.generate = {
6223
+ ((d) => {
6224
+ d.generate = {
6147
6225
  session: {
6148
6226
  types: {
6149
- name: { type: "string", options: D.names.filter((t) => t.length) },
6150
- tier: { type: "string", options: D.tiers.filter((t) => t.length) },
6151
- message: { type: "string", options: D.messages.filter((t) => t.length) },
6152
- item: { type: "array", options: D.items },
6153
- avatar: { type: "string", options: D.avatars.filter((t) => t.length) }
6227
+ name: { type: "string", options: A.names.filter((t) => t.length) },
6228
+ tier: { type: "string", options: A.tiers.filter((t) => t.length) },
6229
+ message: { type: "string", options: A.messages.filter((t) => t.length) },
6230
+ item: { type: "array", options: A.items },
6231
+ avatar: { type: "string", options: A.avatars.filter((t) => t.length) }
6154
6232
  },
6155
6233
  available() {
6156
6234
  const t = this.types;
@@ -6239,14 +6317,32 @@ var q;
6239
6317
  },
6240
6318
  charityCampaignDonation: {
6241
6319
  latest: { name: t.name, amount: { type: "int", min: 50, max: 150 } },
6242
- "session-top-donation": { name: t.name, amount: { type: "int", min: 50, max: 200 } },
6243
- "weekly-top-donation": { name: t.name, amount: { type: "int", min: 200, max: 500 } },
6244
- "monthly-top-donation": { name: t.name, amount: { type: "int", min: 500, max: 800 } },
6245
- "alltime-top-donation": { name: t.name, amount: { type: "int", min: 800, max: 1e3 } },
6320
+ "session-top-donation": {
6321
+ name: t.name,
6322
+ amount: { type: "int", min: 50, max: 200 }
6323
+ },
6324
+ "weekly-top-donation": {
6325
+ name: t.name,
6326
+ amount: { type: "int", min: 200, max: 500 }
6327
+ },
6328
+ "monthly-top-donation": {
6329
+ name: t.name,
6330
+ amount: { type: "int", min: 500, max: 800 }
6331
+ },
6332
+ "alltime-top-donation": {
6333
+ name: t.name,
6334
+ amount: { type: "int", min: 800, max: 1e3 }
6335
+ },
6246
6336
  "session-top-donator": { name: t.name, amount: { type: "int", min: 50, max: 200 } },
6247
6337
  "weekly-top-donator": { name: t.name, amount: { type: "int", min: 200, max: 500 } },
6248
- "monthly-top-donator": { name: t.name, amount: { type: "int", min: 500, max: 800 } },
6249
- "alltime-top-donator": { name: t.name, amount: { type: "int", min: 800, max: 1e3 } },
6338
+ "monthly-top-donator": {
6339
+ name: t.name,
6340
+ amount: { type: "int", min: 500, max: 800 }
6341
+ },
6342
+ "alltime-top-donator": {
6343
+ name: t.name,
6344
+ amount: { type: "int", min: 800, max: 1e3 }
6345
+ },
6250
6346
  recent: {
6251
6347
  type: "recent",
6252
6348
  amount: 25,
@@ -6258,15 +6354,43 @@ var q;
6258
6354
  }
6259
6355
  },
6260
6356
  cheer: {
6261
- latest: { name: t.name, amount: { type: "int", min: 200, max: 800 }, message: t.message },
6262
- "session-top-donation": { name: t.name, amount: { type: "int", min: 200, max: 1e3 } },
6263
- "weekly-top-donation": { name: t.name, amount: { type: "int", min: 1e3, max: 5e3 } },
6264
- "monthly-top-donation": { name: t.name, amount: { type: "int", min: 5e3, max: 12e3 } },
6265
- "alltime-top-donation": { name: t.name, amount: { type: "int", min: 12e3, max: 2e4 } },
6266
- "session-top-donator": { name: t.name, amount: { type: "int", min: 200, max: 1e3 } },
6267
- "weekly-top-donator": { name: t.name, amount: { type: "int", min: 1e3, max: 5e3 } },
6268
- "monthly-top-donator": { name: t.name, amount: { type: "int", min: 5e3, max: 12e3 } },
6269
- "alltime-top-donator": { name: t.name, amount: { type: "int", min: 12e3, max: 2e4 } },
6357
+ latest: {
6358
+ name: t.name,
6359
+ amount: { type: "int", min: 200, max: 800 },
6360
+ message: t.message
6361
+ },
6362
+ "session-top-donation": {
6363
+ name: t.name,
6364
+ amount: { type: "int", min: 200, max: 1e3 }
6365
+ },
6366
+ "weekly-top-donation": {
6367
+ name: t.name,
6368
+ amount: { type: "int", min: 1e3, max: 5e3 }
6369
+ },
6370
+ "monthly-top-donation": {
6371
+ name: t.name,
6372
+ amount: { type: "int", min: 5e3, max: 12e3 }
6373
+ },
6374
+ "alltime-top-donation": {
6375
+ name: t.name,
6376
+ amount: { type: "int", min: 12e3, max: 2e4 }
6377
+ },
6378
+ "session-top-donator": {
6379
+ name: t.name,
6380
+ amount: { type: "int", min: 200, max: 1e3 }
6381
+ },
6382
+ "weekly-top-donator": {
6383
+ name: t.name,
6384
+ amount: { type: "int", min: 1e3, max: 5e3 }
6385
+ },
6386
+ "monthly-top-donator": {
6387
+ name: t.name,
6388
+ amount: { type: "int", min: 5e3, max: 12e3 }
6389
+ },
6390
+ "alltime-top-donator": {
6391
+ name: t.name,
6392
+ amount: { type: "int", min: 12e3, max: 2e4 }
6393
+ },
6270
6394
  session: { amount: { type: "int", min: 200, max: 1e3 } },
6271
6395
  week: { amount: { type: "int", min: 1e3, max: 5e3 } },
6272
6396
  month: { amount: { type: "int", min: 5e3, max: 12e3 } },
@@ -6285,14 +6409,35 @@ var q;
6285
6409
  },
6286
6410
  cheerPurchase: {
6287
6411
  latest: { name: t.name, amount: { type: "int", min: 200, max: 400 } },
6288
- "session-top-donation": { name: t.name, amount: { type: "int", min: 200, max: 400 } },
6289
- "weekly-top-donation": { name: t.name, amount: { type: "int", min: 400, max: 800 } },
6290
- "monthly-top-donation": { name: t.name, amount: { type: "int", min: 800, max: 1500 } },
6291
- "alltime-top-donation": { name: t.name, amount: { type: "int", min: 1500, max: 2e3 } },
6292
- "session-top-donator": { name: t.name, amount: { type: "int", min: 200, max: 400 } },
6412
+ "session-top-donation": {
6413
+ name: t.name,
6414
+ amount: { type: "int", min: 200, max: 400 }
6415
+ },
6416
+ "weekly-top-donation": {
6417
+ name: t.name,
6418
+ amount: { type: "int", min: 400, max: 800 }
6419
+ },
6420
+ "monthly-top-donation": {
6421
+ name: t.name,
6422
+ amount: { type: "int", min: 800, max: 1500 }
6423
+ },
6424
+ "alltime-top-donation": {
6425
+ name: t.name,
6426
+ amount: { type: "int", min: 1500, max: 2e3 }
6427
+ },
6428
+ "session-top-donator": {
6429
+ name: t.name,
6430
+ amount: { type: "int", min: 200, max: 400 }
6431
+ },
6293
6432
  "weekly-top-donator": { name: t.name, amount: { type: "int", min: 400, max: 800 } },
6294
- "monthly-top-donator": { name: t.name, amount: { type: "int", min: 800, max: 1500 } },
6295
- "alltime-top-donator": { name: t.name, amount: { type: "int", min: 1500, max: 2e3 } },
6433
+ "monthly-top-donator": {
6434
+ name: t.name,
6435
+ amount: { type: "int", min: 800, max: 1500 }
6436
+ },
6437
+ "alltime-top-donator": {
6438
+ name: t.name,
6439
+ amount: { type: "int", min: 1500, max: 2e3 }
6440
+ },
6296
6441
  recent: {
6297
6442
  type: "recent",
6298
6443
  amount: 25,
@@ -6305,14 +6450,38 @@ var q;
6305
6450
  },
6306
6451
  superchat: {
6307
6452
  latest: { name: t.name, amount: { type: "int", min: 100, max: 400 } },
6308
- "session-top-donation": { name: t.name, amount: { type: "int", min: 100, max: 500 } },
6309
- "weekly-top-donation": { name: t.name, amount: { type: "int", min: 500, max: 1e3 } },
6310
- "monthly-top-donation": { name: t.name, amount: { type: "int", min: 1e3, max: 2e3 } },
6311
- "alltime-top-donation": { name: t.name, amount: { type: "int", min: 2e3, max: 2500 } },
6312
- "session-top-donator": { name: t.name, amount: { type: "int", min: 100, max: 500 } },
6313
- "weekly-top-donator": { name: t.name, amount: { type: "int", min: 500, max: 1e3 } },
6314
- "monthly-top-donator": { name: t.name, amount: { type: "int", min: 1e3, max: 2e3 } },
6315
- "alltime-top-donator": { name: t.name, amount: { type: "int", min: 2e3, max: 2500 } },
6453
+ "session-top-donation": {
6454
+ name: t.name,
6455
+ amount: { type: "int", min: 100, max: 500 }
6456
+ },
6457
+ "weekly-top-donation": {
6458
+ name: t.name,
6459
+ amount: { type: "int", min: 500, max: 1e3 }
6460
+ },
6461
+ "monthly-top-donation": {
6462
+ name: t.name,
6463
+ amount: { type: "int", min: 1e3, max: 2e3 }
6464
+ },
6465
+ "alltime-top-donation": {
6466
+ name: t.name,
6467
+ amount: { type: "int", min: 2e3, max: 2500 }
6468
+ },
6469
+ "session-top-donator": {
6470
+ name: t.name,
6471
+ amount: { type: "int", min: 100, max: 500 }
6472
+ },
6473
+ "weekly-top-donator": {
6474
+ name: t.name,
6475
+ amount: { type: "int", min: 500, max: 1e3 }
6476
+ },
6477
+ "monthly-top-donator": {
6478
+ name: t.name,
6479
+ amount: { type: "int", min: 1e3, max: 2e3 }
6480
+ },
6481
+ "alltime-top-donator": {
6482
+ name: t.name,
6483
+ amount: { type: "int", min: 2e3, max: 2500 }
6484
+ },
6316
6485
  session: { amount: { type: "int", min: 100, max: 500 } },
6317
6486
  week: { amount: { type: "int", min: 500, max: 1e3 } },
6318
6487
  month: { amount: { type: "int", min: 1e3, max: 2e3 } },
@@ -6339,7 +6508,10 @@ var q;
6339
6508
  _type: { type: "array", options: ["follower", "subscriber", "cheer", "donation"] }
6340
6509
  },
6341
6510
  "level-goal": { amount: { type: "int", min: 0, max: 100 } },
6342
- "level-progress": { amount: { type: "int", min: 0, max: 100 }, percent: { type: "int", min: 0, max: 100 } },
6511
+ "level-progress": {
6512
+ amount: { type: "int", min: 0, max: 100 },
6513
+ percent: { type: "int", min: 0, max: 100 }
6514
+ },
6343
6515
  total: { amount: { type: "int", min: 0, max: 100 } },
6344
6516
  "latest-top-contributors": { type: "recent", amount: 25, value: { name: t.name } }
6345
6517
  },
@@ -6353,14 +6525,38 @@ var q;
6353
6525
  },
6354
6526
  tip: {
6355
6527
  latest: { name: t.name, amount: { type: "int", min: 100, max: 400 } },
6356
- "session-top-donation": { name: t.name, amount: { type: "int", min: 100, max: 500 } },
6357
- "weekly-top-donation": { name: t.name, amount: { type: "int", min: 500, max: 1e3 } },
6358
- "monthly-top-donation": { name: t.name, amount: { type: "int", min: 1e3, max: 2e3 } },
6359
- "alltime-top-donation": { name: t.name, amount: { type: "int", min: 2e3, max: 2500 } },
6360
- "session-top-donator": { name: t.name, amount: { type: "int", min: 100, max: 500 } },
6361
- "weekly-top-donator": { name: t.name, amount: { type: "int", min: 500, max: 1e3 } },
6362
- "monthly-top-donator": { name: t.name, amount: { type: "int", min: 1e3, max: 2e3 } },
6363
- "alltime-top-donator": { name: t.name, amount: { type: "int", min: 2e3, max: 2500 } },
6528
+ "session-top-donation": {
6529
+ name: t.name,
6530
+ amount: { type: "int", min: 100, max: 500 }
6531
+ },
6532
+ "weekly-top-donation": {
6533
+ name: t.name,
6534
+ amount: { type: "int", min: 500, max: 1e3 }
6535
+ },
6536
+ "monthly-top-donation": {
6537
+ name: t.name,
6538
+ amount: { type: "int", min: 1e3, max: 2e3 }
6539
+ },
6540
+ "alltime-top-donation": {
6541
+ name: t.name,
6542
+ amount: { type: "int", min: 2e3, max: 2500 }
6543
+ },
6544
+ "session-top-donator": {
6545
+ name: t.name,
6546
+ amount: { type: "int", min: 100, max: 500 }
6547
+ },
6548
+ "weekly-top-donator": {
6549
+ name: t.name,
6550
+ amount: { type: "int", min: 500, max: 1e3 }
6551
+ },
6552
+ "monthly-top-donator": {
6553
+ name: t.name,
6554
+ amount: { type: "int", min: 1e3, max: 2e3 }
6555
+ },
6556
+ "alltime-top-donator": {
6557
+ name: t.name,
6558
+ amount: { type: "int", min: 2e3, max: 2500 }
6559
+ },
6364
6560
  session: { amount: { type: "int", min: 100, max: 500 } },
6365
6561
  week: { amount: { type: "int", min: 500, max: 1e3 } },
6366
6562
  month: { amount: { type: "int", min: 1e3, max: 2e3 } },
@@ -6378,7 +6574,11 @@ var q;
6378
6574
  }
6379
6575
  },
6380
6576
  merch: {
6381
- latest: { name: t.name, amount: { type: "int", min: 0, max: 100 }, items: t.item },
6577
+ latest: {
6578
+ name: t.name,
6579
+ amount: { type: "int", min: 0, max: 100 },
6580
+ items: t.item
6581
+ },
6382
6582
  "goal-orders": { amount: { type: "int", min: 0, max: 100 } },
6383
6583
  "goal-items": { amount: { type: "int", min: 0, max: 100 } },
6384
6584
  "goal-total": { amount: { type: "int", min: 0, max: 100 } },
@@ -6399,43 +6599,45 @@ var q;
6399
6599
  const a = this.available();
6400
6600
  if (t) return t;
6401
6601
  const i = (n) => {
6402
- const m = (g) => {
6403
- if (!g || !("amount" in g)) return [];
6404
- const c = [];
6405
- for (let d = 0; d < g.amount; d++)
6406
- c.push(i(g.value));
6407
- return c.sort((d, f) => new Date(f.createdAt).getTime() - new Date(d.createdAt).getTime());
6408
- }, o = (g) => {
6409
- const c = {};
6410
- for (const d in g) {
6411
- const f = d.replace("_type", "type");
6412
- c[f] = i(g[d]);
6602
+ const l = (u) => {
6603
+ if (!u || !("amount" in u)) return [];
6604
+ const o = [];
6605
+ for (let m = 0; m < u.amount; m++)
6606
+ o.push(i(u.value));
6607
+ return o.sort(
6608
+ (m, w) => new Date(w.createdAt).getTime() - new Date(m.createdAt).getTime()
6609
+ );
6610
+ }, c = (u) => {
6611
+ const o = {};
6612
+ for (const m in u) {
6613
+ const w = m.replace("_type", "type");
6614
+ o[w] = i(u[m]);
6413
6615
  }
6414
- return c;
6415
- }, b = (g) => {
6416
- if (!g) return g;
6417
- switch (g.type) {
6616
+ return o;
6617
+ }, f = (u) => {
6618
+ if (!u) return u;
6619
+ switch (u.type) {
6418
6620
  case "int":
6419
- return y.random.number(g.min, g.max);
6621
+ return b.random.number(u.min, u.max);
6420
6622
  case "string":
6421
- return y.random.array(g.options)[0];
6623
+ return b.random.array(u.options)[0];
6422
6624
  case "date":
6423
- return y.random.daysOffset(g.range);
6625
+ return b.random.daysOffset(u.range);
6424
6626
  case "array":
6425
- return y.random.array(g.options)[0];
6627
+ return b.random.array(u.options)[0];
6426
6628
  case "recent":
6427
- return m(g);
6629
+ return l(u);
6428
6630
  default:
6429
- return g;
6631
+ return u;
6430
6632
  }
6431
6633
  };
6432
- return typeof n != "object" || n === null ? n : "type" in n && typeof n.type == "string" ? b(n) : o(n);
6634
+ return typeof n != "object" || n === null ? n : "type" in n && typeof n.type == "string" ? f(n) : c(n);
6433
6635
  };
6434
6636
  var s = Object.entries(i(a)).reduce(
6435
- (n, [m, o]) => (Object.entries(o).forEach(
6436
- ([b, g]) => (
6637
+ (n, [l, c]) => (Object.entries(c).forEach(
6638
+ ([f, u]) => (
6437
6639
  //
6438
- n[`${m}-${b}`] = g
6640
+ n[`${l}-${f}`] = u
6439
6641
  )
6440
6642
  ), n),
6441
6643
  {}
@@ -6489,51 +6691,73 @@ var q;
6489
6691
  * @returns A Promise that resolves to the simulated onSessionUpdate event data.
6490
6692
  */
6491
6693
  async onSessionUpdate(t, a) {
6492
- if (t ??= await h.generate.session.get(), a) {
6694
+ if (t ??= await d.generate.session.get(), a) {
6493
6695
  const i = (s, n) => new Date(n.createdAt).getTime() - new Date(s.createdAt).getTime();
6494
6696
  switch (a.provider) {
6495
6697
  case "twitch": {
6496
6698
  const s = a.data;
6497
6699
  switch (s.listener) {
6498
6700
  case "cheer-latest": {
6499
- const n = s.event.amount, m = s.event.displayName ?? s.event.name, o = s.event.message;
6500
- t["cheer-latest"] = { name: m, amount: n, message: o };
6501
- const b = (g) => {
6502
- if (g === "all") {
6503
- b("alltime"), b("monthly"), b("weekly"), b("session");
6701
+ const n = s.event.amount, l = s.event.displayName ?? s.event.name, c = s.event.message;
6702
+ t["cheer-latest"] = { name: l, amount: n, message: c };
6703
+ const f = (u) => {
6704
+ if (u === "all") {
6705
+ f("alltime"), f("monthly"), f("weekly"), f("session");
6504
6706
  return;
6505
6707
  }
6506
- const c = t[`cheer-${g}-top-donation`];
6507
- c && n > c.amount && (c.amount = n, c.name = m);
6508
- const d = t[`cheer-${g}-top-donator`], f = t["cheer-recent"].filter((p) => p.name.toLowerCase() === d.name.toLowerCase()).reduce((p, C) => p + C.amount, 0), l = t["cheer-recent"].filter((p) => p.name.toLowerCase() === m.toLowerCase()).reduce((p, C) => p + C.amount, 0);
6509
- l > f && (d.amount = l, d.name = m);
6708
+ const o = t[`cheer-${u}-top-donation`];
6709
+ o && n > o.amount && (o.amount = n, o.name = l);
6710
+ const m = t[`cheer-${u}-top-donator`], w = t["cheer-recent"].filter((p) => p.name.toLowerCase() === m.name.toLowerCase()).reduce((p, y) => p + y.amount, 0), h = t["cheer-recent"].filter((p) => p.name.toLowerCase() === l.toLowerCase()).reduce((p, y) => p + y.amount, 0);
6711
+ h > w && (m.amount = h, m.name = l);
6510
6712
  };
6511
- b("all"), t["cheer-session"].amount += n, t["cheer-week"].amount += n, t["cheer-month"].amount += n, t["cheer-total"].amount += n, t["cheer-count"].count += 1, t["cheer-goal"].amount += n, t["cheer-recent"].unshift({ name: m, amount: n, createdAt: (/* @__PURE__ */ new Date()).toISOString() }), t["cheer-recent"] = (t["cheer-recent"] || []).sort(i);
6713
+ f("all"), t["cheer-session"].amount += n, t["cheer-week"].amount += n, t["cheer-month"].amount += n, t["cheer-total"].amount += n, t["cheer-count"].count += 1, t["cheer-goal"].amount += n, t["cheer-recent"].unshift({
6714
+ name: l,
6715
+ amount: n,
6716
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
6717
+ }), t["cheer-recent"] = (t["cheer-recent"] || []).sort(i);
6512
6718
  break;
6513
6719
  }
6514
6720
  case "follower-latest": {
6515
6721
  const n = s.event.displayName ?? s.event.name;
6516
- t["follower-latest"].name = n, t["follower-session"].count += 1, t["follower-week"].count += 1, t["follower-month"].count += 1, t["follower-total"].count += 1, t["follower-goal"].amount += 1, t["follower-recent"].unshift({ name: n, createdAt: (/* @__PURE__ */ new Date()).toISOString() }), t["follower-recent"] = (t["follower-recent"] || []).sort(i);
6722
+ t["follower-latest"].name = n, t["follower-session"].count += 1, t["follower-week"].count += 1, t["follower-month"].count += 1, t["follower-total"].count += 1, t["follower-goal"].amount += 1, t["follower-recent"].unshift({
6723
+ name: n,
6724
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
6725
+ }), t["follower-recent"] = (t["follower-recent"] || []).sort(
6726
+ i
6727
+ );
6517
6728
  break;
6518
6729
  }
6519
6730
  case "subscriber-latest": {
6520
- const n = s.event.displayName ?? s.event.name, m = s.event.amount, o = s.event.tier, b = s.event.message;
6521
- if (t["subscriber-latest"] = { name: n, amount: m, tier: o, message: b ?? "" }, t["subscriber-recent"].find((g) => g.name.toLowerCase() === n.toLowerCase()) ? m > 1 && (t["subscriber-resub-latest"] = { name: n, amount: m, message: b ?? "" }, t["subscriber-resub-session"].count += 1) : (t["subscriber-new-latest"] = { name: n, amount: m, message: b ?? "" }, t["subscriber-new-session"].count += 1), !(!s.event.gifted && !s.event.bulkGifted && !s.event.isCommunityGift)) if (s.event.gifted && !s.event.bulkGifted && !s.event.isCommunityGift) {
6522
- const g = s.event.sender;
6731
+ const n = s.event.displayName ?? s.event.name, l = s.event.amount, c = s.event.tier, f = s.event.message;
6732
+ if (t["subscriber-latest"] = { name: n, amount: l, tier: c, message: f ?? "" }, t["subscriber-recent"].find(
6733
+ (u) => u.name.toLowerCase() === n.toLowerCase()
6734
+ ) ? l > 1 && (t["subscriber-resub-latest"] = { name: n, amount: l, message: f ?? "" }, t["subscriber-resub-session"].count += 1) : (t["subscriber-new-latest"] = { name: n, amount: l, message: f ?? "" }, t["subscriber-new-session"].count += 1), !(!s.event.gifted && !s.event.bulkGifted && !s.event.isCommunityGift)) if (s.event.gifted && !s.event.bulkGifted && !s.event.isCommunityGift) {
6735
+ const u = s.event.sender;
6523
6736
  t["subscriber-gifted-latest"] = {
6524
6737
  name: n,
6525
- amount: m,
6526
- tier: o,
6527
- message: b ?? "",
6528
- sender: g
6529
- }, t["subscriber-gifted-session"].count += 1, t["subscriber-alltime-gifter"] = { name: g, amount: m };
6738
+ amount: l,
6739
+ tier: c,
6740
+ message: f ?? "",
6741
+ sender: u
6742
+ }, t["subscriber-gifted-session"].count += 1, t["subscriber-alltime-gifter"] = { name: u, amount: l };
6530
6743
  } else s.event.gifted && !s.event.bulkGifted && s.event.isCommunityGift || !s.event.gifted && s.event.bulkGifted && s.event.isCommunityGift;
6531
- t["subscriber-session"].count += m, t["subscriber-week"].count += m, t["subscriber-month"].count += m, t["subscriber-total"].count += m, t["subscriber-goal"].amount += m, t["subscriber-points"].amount += m, t["subscriber-recent"].unshift({ name: n, amount: m, tier: o, createdAt: (/* @__PURE__ */ new Date()).toISOString() }), t["subscriber-recent"] = (t["subscriber-recent"] || []).sort(i);
6744
+ t["subscriber-session"].count += l, t["subscriber-week"].count += l, t["subscriber-month"].count += l, t["subscriber-total"].count += l, t["subscriber-goal"].amount += l, t["subscriber-points"].amount += l, t["subscriber-recent"].unshift({
6745
+ name: n,
6746
+ amount: l,
6747
+ tier: c,
6748
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
6749
+ }), t["subscriber-recent"] = (t["subscriber-recent"] || []).sort(
6750
+ i
6751
+ );
6532
6752
  break;
6533
6753
  }
6534
6754
  case "raid-latest": {
6535
- const n = s.event.displayName ?? s.event.name, m = s.event.amount;
6536
- t["raid-latest"] = { name: n, amount: m }, t["raid-recent"].unshift({ name: n, amount: m, createdAt: (/* @__PURE__ */ new Date()).toISOString() }), t["raid-recent"] = (t["raid-recent"] || []).sort(i);
6755
+ const n = s.event.displayName ?? s.event.name, l = s.event.amount;
6756
+ t["raid-latest"] = { name: n, amount: l }, t["raid-recent"].unshift({
6757
+ name: n,
6758
+ amount: l,
6759
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
6760
+ }), t["raid-recent"] = (t["raid-recent"] || []).sort(i);
6537
6761
  break;
6538
6762
  }
6539
6763
  }
@@ -6542,33 +6766,33 @@ var q;
6542
6766
  case "youtube": {
6543
6767
  const s = a.data;
6544
6768
  if (s.listener === "superchat-latest") {
6545
- const n = s.event.displayName ?? s.event.name, m = s.event.amount;
6769
+ const n = s.event.displayName ?? s.event.name, l = s.event.amount;
6546
6770
  t["superchat-latest"] = {
6547
6771
  name: n.toLowerCase(),
6548
6772
  displayName: n,
6549
- amount: m,
6550
- _id: y.random.uuid(),
6773
+ amount: l,
6774
+ _id: b.random.uuid(),
6551
6775
  sessionTop: !1,
6552
6776
  type: "superchat",
6553
6777
  originalEventName: "superchat-latest",
6554
6778
  providerId: "",
6555
6779
  avatar: ""
6556
6780
  };
6557
- const o = (b) => {
6558
- if (b === "all") {
6559
- o("alltime"), o("monthly"), o("weekly"), o("session");
6781
+ const c = (f) => {
6782
+ if (f === "all") {
6783
+ c("alltime"), c("monthly"), c("weekly"), c("session");
6560
6784
  return;
6561
6785
  }
6562
- const g = t[`superchat-${b}-top-donation`];
6563
- g && m > g.amount && (g.amount = m, g.name = n);
6564
- const c = t[`superchat-${b}-top-donator`], d = t["superchat-recent"].filter((l) => l.name.toLowerCase() === c.name.toLowerCase()).reduce((l, p) => l + p.amount, 0), f = t["superchat-recent"].filter((l) => l.name.toLowerCase() === n.toLowerCase()).reduce((l, p) => l + p.amount, 0);
6565
- f > d && (c.amount = f, c.name = n);
6786
+ const u = t[`superchat-${f}-top-donation`];
6787
+ u && l > u.amount && (u.amount = l, u.name = n);
6788
+ const o = t[`superchat-${f}-top-donator`], m = t["superchat-recent"].filter((h) => h.name.toLowerCase() === o.name.toLowerCase()).reduce((h, p) => h + p.amount, 0), w = t["superchat-recent"].filter((h) => h.name.toLowerCase() === n.toLowerCase()).reduce((h, p) => h + p.amount, 0);
6789
+ w > m && (o.amount = w, o.name = n);
6566
6790
  };
6567
- o("all"), t["superchat-session"].amount += m, t["superchat-week"].amount += m, t["superchat-month"].amount += m, t["superchat-total"].amount += m, t["superchat-count"].count += 1, t["superchat-goal"].amount += m, t["superchat-recent"].unshift({
6791
+ c("all"), t["superchat-session"].amount += l, t["superchat-week"].amount += l, t["superchat-month"].amount += l, t["superchat-total"].amount += l, t["superchat-count"].count += 1, t["superchat-goal"].amount += l, t["superchat-recent"].unshift({
6568
6792
  name: n.toLowerCase(),
6569
6793
  displayName: n,
6570
- amount: m,
6571
- _id: y.random.uuid(),
6794
+ amount: l,
6795
+ _id: b.random.uuid(),
6572
6796
  sessionTop: !1,
6573
6797
  type: "superchat",
6574
6798
  originalEventName: "superchat-latest",
@@ -6581,19 +6805,23 @@ var q;
6581
6805
  case "streamelements": {
6582
6806
  const s = a.data;
6583
6807
  if (s.listener === "tip-latest") {
6584
- const n = s.event.displayName ?? s.event.name, m = s.event.amount;
6585
- t["tip-latest"] = { name: n, amount: m };
6586
- const o = (b) => {
6587
- if (b === "all") {
6588
- o("alltime"), o("monthly"), o("weekly"), o("session");
6808
+ const n = s.event.displayName ?? s.event.name, l = s.event.amount;
6809
+ t["tip-latest"] = { name: n, amount: l };
6810
+ const c = (f) => {
6811
+ if (f === "all") {
6812
+ c("alltime"), c("monthly"), c("weekly"), c("session");
6589
6813
  return;
6590
6814
  }
6591
- const g = t[`tip-${b}-top-donation`];
6592
- g && m > g.amount && (g.amount = m, g.name = n);
6593
- const c = t[`tip-${b}-top-donator`], d = t["tip-recent"].filter((l) => l.name.toLowerCase() === c.name.toLowerCase()).reduce((l, p) => l + p.amount, 0), f = t["tip-recent"].filter((l) => l.name.toLowerCase() === n.toLowerCase()).reduce((l, p) => l + p.amount, 0);
6594
- f > d && (c.amount = f, c.name = n);
6815
+ const u = t[`tip-${f}-top-donation`];
6816
+ u && l > u.amount && (u.amount = l, u.name = n);
6817
+ const o = t[`tip-${f}-top-donator`], m = t["tip-recent"].filter((h) => h.name.toLowerCase() === o.name.toLowerCase()).reduce((h, p) => h + p.amount, 0), w = t["tip-recent"].filter((h) => h.name.toLowerCase() === n.toLowerCase()).reduce((h, p) => h + p.amount, 0);
6818
+ w > m && (o.amount = w, o.name = n);
6595
6819
  };
6596
- o("all"), t["tip-session"].amount += m, t["tip-week"].amount += m, t["tip-month"].amount += m, t["tip-total"].amount += m, t["tip-count"].count += 1, t["tip-goal"].amount += m, t["tip-recent"].unshift({ name: n, amount: m, createdAt: (/* @__PURE__ */ new Date()).toISOString() }), t["tip-recent"] = (t["tip-recent"] || []).sort(i);
6820
+ c("all"), t["tip-session"].amount += l, t["tip-week"].amount += l, t["tip-month"].amount += l, t["tip-total"].amount += l, t["tip-count"].count += 1, t["tip-goal"].amount += l, t["tip-recent"].unshift({
6821
+ name: n,
6822
+ amount: l,
6823
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
6824
+ }), t["tip-recent"] = (t["tip-recent"] || []).sort(i);
6597
6825
  }
6598
6826
  break;
6599
6827
  }
@@ -6618,7 +6846,13 @@ var q;
6618
6846
  */
6619
6847
  async onEventReceived(t = "random", a = "random", i = {}) {
6620
6848
  const s = {
6621
- twitch: ["message", "follower-latest", "cheer-latest", "raid-latest", "subscriber-latest"],
6849
+ twitch: [
6850
+ "message",
6851
+ "follower-latest",
6852
+ "cheer-latest",
6853
+ "raid-latest",
6854
+ "subscriber-latest"
6855
+ ],
6622
6856
  streamelements: ["tip-latest"],
6623
6857
  youtube: ["message", "superchat-latest", "subscriber-latest", "sponsor-latest"],
6624
6858
  kick: [],
@@ -6627,54 +6861,63 @@ var q;
6627
6861
  switch (t) {
6628
6862
  default:
6629
6863
  case "random": {
6630
- var n = y.random.array(Object.keys(s).filter((O) => s[O].length))[0], m = y.random.array(s[n])[0];
6631
- return this.onEventReceived(n, m);
6864
+ var n = b.random.array(
6865
+ Object.keys(s).filter((O) => s[O].length)
6866
+ )[0], l = b.random.array(
6867
+ s[n]
6868
+ )[0];
6869
+ return this.onEventReceived(n, l);
6632
6870
  }
6633
6871
  case "twitch":
6634
6872
  switch (a) {
6635
6873
  default:
6636
6874
  case "random": {
6637
- var m = y.random.array(s[t])[0];
6638
- return this.onEventReceived(t, m);
6875
+ var l = b.random.array(
6876
+ s[t]
6877
+ )[0];
6878
+ return this.onEventReceived(t, l);
6639
6879
  }
6640
6880
  case "message": {
6641
- var o = i?.name ?? y.random.array(D.names.filter((z) => z.length))[0], b = i?.message ?? y.random.array(D.messages.filter((z) => z.length))[0], g = await y.message.generateBadges(i?.badges ?? [], t), c = y.message.findEmotesInText(b), d = y.message.replaceEmotesWithHTML(b, c), f = i?.color ?? y.random.color("hex"), l = i?.userId ?? y.random.number(1e7, 99999999).toString(), p = i?.msgId ?? y.random.uuid(), C = i?.time ?? Date.now(), v = i?.channel ?? client.details.user.username;
6881
+ var c = i?.name ?? b.random.array(A.names.filter((z) => z.length))[0], f = i?.message ?? b.random.array(A.messages.filter((z) => z.length))[0], u = await b.message.generateBadges(
6882
+ i?.badges ?? [],
6883
+ t
6884
+ ), o = b.message.findEmotesInText(f), m = b.message.replaceEmotesWithHTML(f, o), w = i?.color ?? b.random.color("hex"), h = i?.userId ?? b.random.number(1e7, 99999999).toString(), p = i?.msgId ?? b.random.uuid(), y = i?.time ?? Date.now(), C = i?.channel ?? client.details.user.username;
6642
6885
  return {
6643
6886
  listener: "message",
6644
6887
  event: {
6645
6888
  service: t,
6646
6889
  data: {
6647
- time: C,
6890
+ time: y,
6648
6891
  tags: {
6649
- "badge-info": `${g.keys.map((z) => `${z}/${y.random.number(1, 5)}`).join(",")}`,
6650
- badges: g.keys.join("/1,"),
6651
- mod: g.keys.includes("moderator") ? "1" : "0",
6652
- subscriber: g.keys.includes("subscriber") ? "1" : "0",
6653
- turbo: g.keys.includes("turbo") ? "1" : "0",
6654
- "tmi-sent-ts": C.toString(),
6655
- "user-id": l,
6892
+ "badge-info": `${u.keys.map((z) => `${z}/${b.random.number(1, 5)}`).join(",")}`,
6893
+ badges: u.keys.join("/1,"),
6894
+ mod: u.keys.includes("moderator") ? "1" : "0",
6895
+ subscriber: u.keys.includes("subscriber") ? "1" : "0",
6896
+ turbo: u.keys.includes("turbo") ? "1" : "0",
6897
+ "tmi-sent-ts": y.toString(),
6898
+ "user-id": h,
6656
6899
  "user-type": "",
6657
- color: f,
6658
- "display-name": o,
6900
+ color: w,
6901
+ "display-name": c,
6659
6902
  emotes: "",
6660
- "client-nonce": y.random.string(16),
6903
+ "client-nonce": b.random.string(16),
6661
6904
  flags: "",
6662
6905
  id: p,
6663
6906
  "first-msg": "0",
6664
6907
  "returning-chatter": "0"
6665
6908
  },
6666
- nick: o.toLowerCase(),
6667
- displayName: o,
6668
- displayColor: f,
6669
- channel: v,
6670
- text: b,
6909
+ nick: c.toLowerCase(),
6910
+ displayName: c,
6911
+ displayColor: w,
6912
+ channel: C,
6913
+ text: f,
6671
6914
  isAction: !1,
6672
- userId: l,
6915
+ userId: h,
6673
6916
  msgId: p,
6674
- badges: g.badges,
6675
- emotes: c
6917
+ badges: u.badges,
6918
+ emotes: o
6676
6919
  },
6677
- renderedText: d
6920
+ renderedText: m
6678
6921
  },
6679
6922
  // @ts-ignore
6680
6923
  emulated: !0
@@ -6682,17 +6925,17 @@ var q;
6682
6925
  }
6683
6926
  case "cheer":
6684
6927
  case "cheer-latest": {
6685
- var k = i?.amount ?? y.random.number(100, 1e4), j = i?.avatar ?? y.random.array(D.avatars)[0], o = i?.name ?? y.random.array(D.names.filter((W) => W.length))[0], b = i?.message ?? y.random.array(D.messages.filter((W) => W.length))[0];
6928
+ var k = i?.amount ?? b.random.number(100, 1e4), j = i?.avatar ?? b.random.array(A.avatars)[0], c = i?.name ?? b.random.array(A.names.filter((W) => W.length))[0], f = i?.message ?? b.random.array(A.messages.filter((W) => W.length))[0];
6686
6929
  return {
6687
6930
  listener: "cheer-latest",
6688
6931
  event: {
6689
6932
  amount: k,
6690
6933
  avatar: j,
6691
- name: o.toLowerCase(),
6692
- displayName: o,
6693
- message: b,
6934
+ name: c.toLowerCase(),
6935
+ displayName: c,
6936
+ message: f,
6694
6937
  providerId: "",
6695
- _id: y.random.uuid(),
6938
+ _id: b.random.uuid(),
6696
6939
  sessionTop: !1,
6697
6940
  type: "cheer",
6698
6941
  originalEventName: "cheer-latest",
@@ -6704,15 +6947,15 @@ var q;
6704
6947
  }
6705
6948
  case "follower":
6706
6949
  case "follower-latest": {
6707
- var j = i?.avatar ?? y.random.array(D.avatars)[0], o = i?.name ?? y.random.array(D.names.filter((W) => W.length))[0];
6950
+ var j = i?.avatar ?? b.random.array(A.avatars)[0], c = i?.name ?? b.random.array(A.names.filter((W) => W.length))[0];
6708
6951
  return {
6709
6952
  listener: "follower-latest",
6710
6953
  event: {
6711
6954
  avatar: j,
6712
- name: o.toLowerCase(),
6713
- displayName: o,
6955
+ name: c.toLowerCase(),
6956
+ displayName: c,
6714
6957
  providerId: "",
6715
- _id: y.random.uuid(),
6958
+ _id: b.random.uuid(),
6716
6959
  sessionTop: !1,
6717
6960
  type: "follower",
6718
6961
  originalEventName: "follower-latest",
@@ -6724,16 +6967,16 @@ var q;
6724
6967
  }
6725
6968
  case "raid":
6726
6969
  case "raid-latest": {
6727
- var k = i?.amount ?? y.random.number(1, 100), j = i?.avatar ?? y.random.array(D.avatars)[0], o = i?.name ?? y.random.array(D.names.filter((F) => F.length))[0];
6970
+ var k = i?.amount ?? b.random.number(1, 100), j = i?.avatar ?? b.random.array(A.avatars)[0], c = i?.name ?? b.random.array(A.names.filter((F) => F.length))[0];
6728
6971
  return {
6729
6972
  listener: "raid-latest",
6730
6973
  event: {
6731
6974
  amount: k,
6732
6975
  avatar: j,
6733
- name: o.toLowerCase(),
6734
- displayName: o,
6976
+ name: c.toLowerCase(),
6977
+ displayName: c,
6735
6978
  providerId: "",
6736
- _id: y.random.uuid(),
6979
+ _id: b.random.uuid(),
6737
6980
  sessionTop: !1,
6738
6981
  type: "raid",
6739
6982
  originalEventName: "raid-latest",
@@ -6745,37 +6988,37 @@ var q;
6745
6988
  }
6746
6989
  case "subscriber":
6747
6990
  case "subscriber-latest": {
6748
- var P = i?.tier ?? y.random.array(["1000", "2000", "3000", "prime"])[0], k = i?.amount ?? y.random.number(1, 24), j = i?.avatar ?? y.random.array(D.avatars)[0], o = i?.name ?? y.random.array(D.names.filter((B) => B.length))[0], A = i?.sender ?? y.random.array(D.names.filter((B) => B.length && B !== o))[0], b = i?.message ?? y.random.array(D.messages.filter((B) => B.length))[0], J = {
6991
+ var D = i?.tier ?? b.random.array(["1000", "2000", "3000", "prime"])[0], k = i?.amount ?? b.random.number(1, 24), j = i?.avatar ?? b.random.array(A.avatars)[0], c = i?.name ?? b.random.array(A.names.filter((B) => B.length))[0], J = i?.sender ?? b.random.array(A.names.filter((B) => B.length && B !== c))[0], f = i?.message ?? b.random.array(A.messages.filter((B) => B.length))[0], P = {
6749
6992
  default: {
6750
6993
  avatar: j,
6751
6994
  playedAsCommunityGift: !1
6752
6995
  },
6753
6996
  gift: {
6754
- sender: A,
6997
+ sender: J,
6755
6998
  gifted: !0
6756
6999
  },
6757
7000
  community: {
6758
- message: b,
6759
- sender: A,
7001
+ message: f,
7002
+ sender: J,
6760
7003
  bulkGifted: !0
6761
7004
  },
6762
7005
  spam: {
6763
- sender: A,
7006
+ sender: J,
6764
7007
  gifted: !0,
6765
7008
  isCommunityGift: !0
6766
7009
  }
6767
- }, U = ["default", "gift", "community", "spam"], S = i?.subType ?? y.random.array(U)[0];
7010
+ }, U = ["default", "gift", "community", "spam"], S = i?.subType ?? b.random.array(U)[0];
6768
7011
  return S = U.includes(S) ? S : "default", {
6769
7012
  listener: "subscriber-latest",
6770
7013
  event: {
6771
7014
  amount: k,
6772
- name: o.toLowerCase(),
6773
- displayName: o,
7015
+ name: c.toLowerCase(),
7016
+ displayName: c,
6774
7017
  providerId: "",
6775
- tier: P,
6776
- ...J.default,
6777
- ...J[S],
6778
- _id: y.random.uuid(),
7018
+ tier: D,
7019
+ ...P.default,
7020
+ ...P[S],
7021
+ _id: b.random.uuid(),
6779
7022
  sessionTop: !1,
6780
7023
  type: "subscriber",
6781
7024
  originalEventName: "subscriber-latest",
@@ -6789,7 +7032,7 @@ var q;
6789
7032
  return {
6790
7033
  listener: "delete-message",
6791
7034
  event: {
6792
- msgId: i?.id ?? y.random.uuid(),
7035
+ msgId: i?.id ?? b.random.uuid(),
6793
7036
  provider: t
6794
7037
  },
6795
7038
  // @ts-ignore
@@ -6799,7 +7042,7 @@ var q;
6799
7042
  return {
6800
7043
  listener: "delete-messages",
6801
7044
  event: {
6802
- userId: i?.id ?? y.random.number(1e7, 99999999).toString(),
7045
+ userId: i?.id ?? b.random.number(1e7, 99999999).toString(),
6803
7046
  provider: t
6804
7047
  },
6805
7048
  // @ts-ignore
@@ -6810,21 +7053,23 @@ var q;
6810
7053
  switch (a) {
6811
7054
  default:
6812
7055
  case "random": {
6813
- var m = y.random.array(s[t])[0];
6814
- return this.onEventReceived(t, m);
7056
+ var l = b.random.array(
7057
+ s[t]
7058
+ )[0];
7059
+ return this.onEventReceived(t, l);
6815
7060
  }
6816
7061
  case "tip":
6817
7062
  case "tip-latest": {
6818
- var k = i?.amount ?? y.random.number(100, 4e3), j = i?.avatar ?? y.random.array(D.avatars)[0], o = i?.name ?? y.random.array(D.names.filter((F) => F.length))[0];
7063
+ var k = i?.amount ?? b.random.number(100, 4e3), j = i?.avatar ?? b.random.array(A.avatars)[0], c = i?.name ?? b.random.array(A.names.filter((F) => F.length))[0];
6819
7064
  return {
6820
7065
  listener: "tip-latest",
6821
7066
  event: {
6822
7067
  amount: k,
6823
7068
  avatar: j,
6824
- name: o.toLowerCase(),
6825
- displayName: o,
7069
+ name: c.toLowerCase(),
7070
+ displayName: c,
6826
7071
  providerId: "",
6827
- _id: y.random.uuid(),
7072
+ _id: b.random.uuid(),
6828
7073
  sessionTop: !1,
6829
7074
  type: "tip",
6830
7075
  originalEventName: "tip-latest",
@@ -6852,7 +7097,7 @@ var q;
6852
7097
  listener: "bot:counter",
6853
7098
  event: {
6854
7099
  counter: i?.counter ?? "sampleCounter",
6855
- value: i?.value ?? y.random.number(0, 100),
7100
+ value: i?.value ?? b.random.number(0, 100),
6856
7101
  provider: t
6857
7102
  },
6858
7103
  // @ts-ignore
@@ -6887,13 +7132,18 @@ var q;
6887
7132
  switch (a) {
6888
7133
  default:
6889
7134
  case "random": {
6890
- var m = y.random.array(s[t])[0];
6891
- return this.onEventReceived(t, m);
7135
+ var l = b.random.array(
7136
+ s[t]
7137
+ )[0];
7138
+ return this.onEventReceived(t, l);
6892
7139
  }
6893
7140
  case "message": {
6894
- var o = i?.name ?? y.random.array(D.names.filter((X) => X.length))[0], b = i?.message ?? y.random.array(D.messages.filter((X) => X.length))[0];
6895
- const V = await y.message.generateBadges(i?.badges ?? [], t);
6896
- var c = y.message.findEmotesInText(b), d = y.message.replaceEmotesWithHTML(b, c), f = i?.color ?? y.random.color("hex"), l = i?.userId ?? y.random.number(1e7, 99999999).toString(), p = i?.msgId ?? y.random.uuid(), C = i?.time ?? Date.now(), j = i?.avatar ?? y.random.array(D.avatars)[0], v = i?.channel ?? client.details.user.username;
7141
+ var c = i?.name ?? b.random.array(A.names.filter((Q) => Q.length))[0], f = i?.message ?? b.random.array(A.messages.filter((Q) => Q.length))[0];
7142
+ const V = await b.message.generateBadges(
7143
+ i?.badges ?? [],
7144
+ t
7145
+ );
7146
+ var o = b.message.findEmotesInText(f), m = b.message.replaceEmotesWithHTML(f, o), w = i?.color ?? b.random.color("hex"), h = i?.userId ?? b.random.number(1e7, 99999999).toString(), p = i?.msgId ?? b.random.uuid(), y = i?.time ?? Date.now(), j = i?.avatar ?? b.random.array(A.avatars)[0], C = i?.channel ?? client.details.user.username;
6897
7147
  return {
6898
7148
  listener: "message",
6899
7149
  event: {
@@ -6905,36 +7155,36 @@ var q;
6905
7155
  snippet: {
6906
7156
  type: "",
6907
7157
  liveChatId: "",
6908
- authorChannelId: v,
7158
+ authorChannelId: C,
6909
7159
  publishedAt: (/* @__PURE__ */ new Date()).toISOString(),
6910
7160
  hasDisplayContent: !0,
6911
- displayMessage: b,
7161
+ displayMessage: f,
6912
7162
  textMessageDetails: {
6913
- messageText: b
7163
+ messageText: f
6914
7164
  }
6915
7165
  },
6916
7166
  authorDetails: {
6917
- channelId: v,
7167
+ channelId: C,
6918
7168
  channelUrl: "",
6919
- displayName: o,
7169
+ displayName: c,
6920
7170
  profileImageUrl: j,
6921
7171
  ...V
6922
7172
  },
6923
7173
  msgId: p,
6924
- userId: l,
6925
- nick: o.toLowerCase(),
7174
+ userId: h,
7175
+ nick: c.toLowerCase(),
6926
7176
  badges: [],
6927
- displayName: o,
7177
+ displayName: c,
6928
7178
  isAction: !1,
6929
- time: C,
7179
+ time: y,
6930
7180
  tags: [],
6931
- displayColor: f,
6932
- channel: v,
6933
- text: b,
7181
+ displayColor: w,
7182
+ channel: C,
7183
+ text: f,
6934
7184
  avatar: j,
6935
7185
  emotes: []
6936
7186
  },
6937
- renderedText: b
7187
+ renderedText: f
6938
7188
  },
6939
7189
  // @ts-ignore
6940
7190
  emulated: !0
@@ -6942,15 +7192,15 @@ var q;
6942
7192
  }
6943
7193
  case "subscriber":
6944
7194
  case "subscriber-latest": {
6945
- var j = i?.avatar ?? y.random.array(D.avatars)[0], o = i?.name ?? y.random.array(D.names.filter((W) => W.length))[0];
7195
+ var j = i?.avatar ?? b.random.array(A.avatars)[0], c = i?.name ?? b.random.array(A.names.filter((W) => W.length))[0];
6946
7196
  return {
6947
7197
  listener: "subscriber-latest",
6948
7198
  event: {
6949
7199
  avatar: j,
6950
- displayName: o,
6951
- name: o.toLowerCase(),
7200
+ displayName: c,
7201
+ name: c.toLowerCase(),
6952
7202
  providerId: "",
6953
- _id: y.random.uuid(),
7203
+ _id: b.random.uuid(),
6954
7204
  sessionTop: !1,
6955
7205
  type: "subscriber",
6956
7206
  originalEventName: "subscriber-latest",
@@ -6962,16 +7212,16 @@ var q;
6962
7212
  }
6963
7213
  case "superchat":
6964
7214
  case "superchat-latest": {
6965
- var k = i?.amount ?? y.random.number(100, 4e3), j = i?.avatar ?? y.random.array(D.avatars)[0], o = i?.name ?? y.random.array(D.names.filter((F) => F.length))[0];
7215
+ var k = i?.amount ?? b.random.number(100, 4e3), j = i?.avatar ?? b.random.array(A.avatars)[0], c = i?.name ?? b.random.array(A.names.filter((F) => F.length))[0];
6966
7216
  return {
6967
7217
  listener: "superchat-latest",
6968
7218
  event: {
6969
7219
  amount: k,
6970
7220
  avatar: j,
6971
- name: o.toLowerCase(),
6972
- displayName: o,
7221
+ name: c.toLowerCase(),
7222
+ displayName: c,
6973
7223
  providerId: "",
6974
- _id: y.random.uuid(),
7224
+ _id: b.random.uuid(),
6975
7225
  sessionTop: !1,
6976
7226
  type: "superchat",
6977
7227
  originalEventName: "superchat-latest",
@@ -6983,36 +7233,36 @@ var q;
6983
7233
  }
6984
7234
  case "sponsor":
6985
7235
  case "sponsor-latest": {
6986
- var P = i?.tier ?? y.random.array(["1000", "2000", "3000"])[0], k = i?.amount ?? y.random.number(1, 24), j = i?.avatar ?? y.random.array(D.avatars)[0], o = i?.name ?? y.random.array(D.names.filter((K) => K.length))[0], A = i?.sender ?? y.random.array(D.names.filter((K) => K.length && K !== o))[0], b = i?.message ?? y.random.array(D.messages.filter((K) => K.length))[0], J = {
7236
+ var D = i?.tier ?? b.random.array(["1000", "2000", "3000"])[0], k = i?.amount ?? b.random.number(1, 24), j = i?.avatar ?? b.random.array(A.avatars)[0], c = i?.name ?? b.random.array(A.names.filter((K) => K.length))[0], J = i?.sender ?? b.random.array(A.names.filter((K) => K.length && K !== c))[0], f = i?.message ?? b.random.array(A.messages.filter((K) => K.length))[0], P = {
6987
7237
  default: {
6988
7238
  avatar: j,
6989
7239
  playedAsCommunityGift: !1
6990
7240
  },
6991
7241
  gift: {
6992
- sender: A,
7242
+ sender: J,
6993
7243
  gifted: !0
6994
7244
  },
6995
7245
  community: {
6996
- message: b,
6997
- sender: A,
7246
+ message: f,
7247
+ sender: J,
6998
7248
  bulkGifted: !0
6999
7249
  },
7000
7250
  spam: {
7001
- sender: A,
7251
+ sender: J,
7002
7252
  gifted: !0,
7003
7253
  isCommunityGift: !0
7004
7254
  }
7005
- }, U = ["default", "gift", "community", "spam"], S = i?.subType ?? y.random.array(U)[0];
7255
+ }, U = ["default", "gift", "community", "spam"], S = i?.subType ?? b.random.array(U)[0];
7006
7256
  return S = U.includes(S) ? S : "default", {
7007
7257
  listener: "sponsor-latest",
7008
7258
  event: {
7009
7259
  amount: k,
7010
- name: o.toLowerCase(),
7011
- displayName: o,
7260
+ name: c.toLowerCase(),
7261
+ displayName: c,
7012
7262
  providerId: "",
7013
- ...J.default,
7014
- ...J[S],
7015
- _id: y.random.uuid(),
7263
+ ...P.default,
7264
+ ...P[S],
7265
+ _id: b.random.uuid(),
7016
7266
  sessionTop: !1,
7017
7267
  type: "sponsor",
7018
7268
  originalEventName: "sponsor-latest",
@@ -7026,11 +7276,15 @@ var q;
7026
7276
  }
7027
7277
  }
7028
7278
  }
7029
- }, h.emulate = {
7279
+ }, d.emulate = {
7030
7280
  twitch: {
7031
7281
  message(t = {}) {
7032
- h.generate.event.onEventReceived("twitch", "message", t).then((a) => {
7033
- a && h.emulate.send("onEventReceived", a);
7282
+ d.generate.event.onEventReceived(
7283
+ "twitch",
7284
+ "message",
7285
+ t
7286
+ ).then((a) => {
7287
+ a && d.emulate.send("onEventReceived", a);
7034
7288
  });
7035
7289
  },
7036
7290
  deleteMessage(t) {
@@ -7041,7 +7295,7 @@ var q;
7041
7295
  msgId: t
7042
7296
  }
7043
7297
  };
7044
- h.emulate.send("onEventReceived", a);
7298
+ d.emulate.send("onEventReceived", a);
7045
7299
  },
7046
7300
  deleteMessages(t) {
7047
7301
  if (!t || typeof t != "string") return;
@@ -7051,68 +7305,104 @@ var q;
7051
7305
  userId: t
7052
7306
  }
7053
7307
  };
7054
- h.emulate.send("onEventReceived", a);
7308
+ d.emulate.send("onEventReceived", a);
7055
7309
  },
7056
7310
  follower(t = {}) {
7057
- h.generate.event.onEventReceived("twitch", "follower-latest", t).then((a) => {
7058
- a && h.emulate.send("onEventReceived", a);
7311
+ d.generate.event.onEventReceived(
7312
+ "twitch",
7313
+ "follower-latest",
7314
+ t
7315
+ ).then((a) => {
7316
+ a && d.emulate.send("onEventReceived", a);
7059
7317
  });
7060
7318
  },
7061
7319
  raid(t = {}) {
7062
- h.generate.event.onEventReceived("twitch", "raid-latest", t).then((a) => {
7063
- a && h.emulate.send("onEventReceived", a);
7320
+ d.generate.event.onEventReceived(
7321
+ "twitch",
7322
+ "raid-latest",
7323
+ t
7324
+ ).then((a) => {
7325
+ a && d.emulate.send("onEventReceived", a);
7064
7326
  });
7065
7327
  },
7066
7328
  cheer(t = {}) {
7067
- h.generate.event.onEventReceived("twitch", "cheer-latest", t).then((a) => {
7068
- a && h.emulate.send("onEventReceived", a);
7329
+ d.generate.event.onEventReceived(
7330
+ "twitch",
7331
+ "cheer-latest",
7332
+ t
7333
+ ).then((a) => {
7334
+ a && d.emulate.send("onEventReceived", a);
7069
7335
  });
7070
7336
  },
7071
7337
  subscriber(t = {}) {
7072
- h.generate.event.onEventReceived("twitch", "subscriber-latest", t).then((a) => {
7073
- a && h.emulate.send("onEventReceived", a);
7338
+ d.generate.event.onEventReceived(
7339
+ "twitch",
7340
+ "subscriber-latest",
7341
+ t
7342
+ ).then((a) => {
7343
+ a && d.emulate.send("onEventReceived", a);
7074
7344
  });
7075
7345
  }
7076
7346
  },
7077
7347
  streamelements: {
7078
7348
  tip(t = {}) {
7079
- h.generate.event.onEventReceived("streamelements", "tip-latest", t).then((a) => {
7080
- a && h.emulate.send("onEventReceived", a);
7349
+ d.generate.event.onEventReceived(
7350
+ "streamelements",
7351
+ "tip-latest",
7352
+ t
7353
+ ).then((a) => {
7354
+ a && d.emulate.send("onEventReceived", a);
7081
7355
  });
7082
7356
  }
7083
7357
  },
7084
7358
  youtube: {
7085
7359
  message(t = {}) {
7086
- h.generate.event.onEventReceived("youtube", "message", t).then((a) => {
7087
- a && h.emulate.send("onEventReceived", a);
7360
+ d.generate.event.onEventReceived(
7361
+ "youtube",
7362
+ "message",
7363
+ t
7364
+ ).then((a) => {
7365
+ a && d.emulate.send("onEventReceived", a);
7088
7366
  });
7089
7367
  },
7090
7368
  subscriber(t = {}) {
7091
- h.generate.event.onEventReceived("youtube", "subscriber-latest", t).then((a) => {
7092
- a && h.emulate.send("onEventReceived", a);
7369
+ d.generate.event.onEventReceived(
7370
+ "youtube",
7371
+ "subscriber-latest",
7372
+ t
7373
+ ).then((a) => {
7374
+ a && d.emulate.send("onEventReceived", a);
7093
7375
  });
7094
7376
  },
7095
7377
  superchat(t = {}) {
7096
- h.generate.event.onEventReceived("youtube", "superchat-latest", t).then((a) => {
7097
- a && h.emulate.send("onEventReceived", a);
7378
+ d.generate.event.onEventReceived(
7379
+ "youtube",
7380
+ "superchat-latest",
7381
+ t
7382
+ ).then((a) => {
7383
+ a && d.emulate.send("onEventReceived", a);
7098
7384
  });
7099
7385
  },
7100
7386
  sponsor(t = {}) {
7101
- h.generate.event.onEventReceived("youtube", "sponsor-latest", t).then((a) => {
7102
- a && h.emulate.send("onEventReceived", a);
7387
+ d.generate.event.onEventReceived(
7388
+ "youtube",
7389
+ "sponsor-latest",
7390
+ t
7391
+ ).then((a) => {
7392
+ a && d.emulate.send("onEventReceived", a);
7103
7393
  });
7104
7394
  }
7105
7395
  },
7106
7396
  kick: {},
7107
7397
  facebook: {},
7108
7398
  send(t, a) {
7109
- if (!h.queue) {
7399
+ if (!d.queue) {
7110
7400
  R.warn("Local queue is not initialized."), window.dispatchEvent(new CustomEvent(t, { detail: a }));
7111
7401
  return;
7112
7402
  }
7113
7403
  switch (t) {
7114
7404
  case "onEventReceived": {
7115
- h.queue.enqueue({
7405
+ d.queue.enqueue({
7116
7406
  listener: t,
7117
7407
  data: a,
7118
7408
  session: t === "onEventReceived" ? !0 : void 0
@@ -7120,14 +7410,14 @@ var q;
7120
7410
  break;
7121
7411
  }
7122
7412
  case "onSessionUpdate": {
7123
- h.queue.enqueue({
7413
+ d.queue.enqueue({
7124
7414
  listener: t,
7125
7415
  data: a
7126
7416
  });
7127
7417
  break;
7128
7418
  }
7129
7419
  case "onWidgetLoad": {
7130
- h.queue.enqueue({
7420
+ d.queue.enqueue({
7131
7421
  listener: t,
7132
7422
  data: a
7133
7423
  });
@@ -7138,38 +7428,44 @@ var q;
7138
7428
  };
7139
7429
  async function e(t = ["fields.json", "cf.json", "field.json", "customfields.json"], a = ["data.json", "fielddata.json", "fd.json", "DATA.json"], i) {
7140
7430
  const s = {
7141
- fields: t.find((m) => {
7431
+ fields: t.find((l) => {
7142
7432
  try {
7143
- return new URL("./" + m, window.location.href), !0;
7433
+ return new URL("./" + l, window.location.href), !0;
7144
7434
  } catch {
7145
7435
  return !1;
7146
7436
  }
7147
7437
  }),
7148
- data: a.find((m) => {
7438
+ data: a.find((l) => {
7149
7439
  try {
7150
- return new URL("./" + m, window.location.href), !0;
7440
+ return new URL("./" + l, window.location.href), !0;
7151
7441
  } catch {
7152
7442
  return !1;
7153
7443
  }
7154
7444
  })
7155
- }, n = await fetch("./" + (s.data ?? "data.json"), {
7156
- cache: "no-store"
7157
- }).then((m) => m.json()).catch(() => ({}));
7445
+ }, n = await fetch(
7446
+ "./" + (s.data ?? "data.json"),
7447
+ {
7448
+ cache: "no-store"
7449
+ }
7450
+ ).then((l) => l.json()).catch(() => ({}));
7158
7451
  await fetch("./" + (s.fields ?? "fields.json"), {
7159
7452
  cache: "no-store"
7160
- }).then((m) => m.json()).then(async (m) => {
7161
- const o = Object.entries(m).filter(([g, { value: c }]) => c != null).reduce(
7162
- (g, [c, { value: d }]) => (n && n[c] !== void 0 && (d = n[c]), g[c] = d, g),
7453
+ }).then((l) => l.json()).then(async (l) => {
7454
+ const c = Object.entries(l).filter(([u, { value: o }]) => o != null).reduce(
7455
+ (u, [o, { value: m }]) => (n && n[o] !== void 0 && (m = n[o]), u[o] = m, u),
7163
7456
  {
7164
7457
  ...n
7165
7458
  }
7166
- ), b = await h.generate.event.onWidgetLoad(o, await h.generate.session.get(i));
7167
- window.dispatchEvent(new CustomEvent("onWidgetLoad", { detail: b }));
7459
+ ), f = await d.generate.event.onWidgetLoad(
7460
+ c,
7461
+ await d.generate.session.get(i)
7462
+ );
7463
+ window.dispatchEvent(new CustomEvent("onWidgetLoad", { detail: f }));
7168
7464
  });
7169
7465
  }
7170
- h.start = e;
7466
+ d.start = e;
7171
7467
  })(q || (q = {}));
7172
- class mt extends Z {
7468
+ class gt extends X {
7173
7469
  constructor(e) {
7174
7470
  if (super(), this.queue = [], this.priorityQueue = [], this.history = [], this.timeouts = [], this.running = !1, this.duration = void 0, this.loaded = !1, this.clientWaitRetryDelay = 50, !e.processor || typeof e.processor != "function")
7175
7471
  throw new Error("A valid processor function must be provided to useQueue.");
@@ -7267,18 +7563,59 @@ class mt extends Z {
7267
7563
  return e === "load" && this.loaded ? (t.apply(this), this) : (super.on(e, t), this);
7268
7564
  }
7269
7565
  }
7566
+ const et = [];
7567
+ class St extends X {
7568
+ constructor(e = {}) {
7569
+ super(), this.SE_API = null, this.id = "widget communications", this.loaded = !1, this.history = [], this.detected = /* @__PURE__ */ new Set(), this.id = e.id || this.id, et.push(this), ct?.then(async (t) => {
7570
+ this.loaded = !0, this.SE_API = t, Promise.all([
7571
+ async () => {
7572
+ const a = await t.store.get(this.id);
7573
+ a && (this.history = a.slice(-10));
7574
+ },
7575
+ async () => {
7576
+ const a = await t.store.get(this.id + "_detected");
7577
+ a && (this.detected = new Set(a));
7578
+ }
7579
+ ]);
7580
+ });
7581
+ }
7582
+ async send(e, t) {
7583
+ if (this.SE_API) {
7584
+ const a = {
7585
+ nonce: Math.random().toString(36).substring(2),
7586
+ key: e,
7587
+ value: t,
7588
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
7589
+ };
7590
+ this.history.push(a), this.SE_API.store.set(this.id, this.history), this.SE_API.store.set(this.id + "_detected", Array.from(this.detected));
7591
+ }
7592
+ }
7593
+ update(e) {
7594
+ if (!e.length)
7595
+ return;
7596
+ this.history = e, e.filter((a) => !this.detected.has(a.nonce)).forEach((a) => {
7597
+ this.detected.add(a.nonce), this.emit("message", a.key, a.value);
7598
+ });
7599
+ }
7600
+ on(e, t) {
7601
+ return e === "load" && this.loaded ? (t.apply(this), this) : (super.on(e, t), this);
7602
+ }
7603
+ }
7270
7604
  typeof window !== void 0 && (window.addEventListener("load", () => {
7271
- window.client instanceof G && (q.queue = new mt({
7605
+ window.client instanceof G && (q.queue = new gt({
7272
7606
  duration: "client",
7273
7607
  processor: async function(e) {
7274
7608
  if (window.dispatchEvent(new CustomEvent(e.listener, { detail: e.data })), e.listener === "onEventReceived" && e.session) {
7275
- const t = await q.generate.event.onSessionUpdate(client.session, y.event.parseProvider(e.data));
7609
+ const t = await q.generate.event.onSessionUpdate(
7610
+ client.session,
7611
+ b.event.parseProvider(e.data)
7612
+ );
7276
7613
  window.dispatchEvent(new CustomEvent("onSessionUpdate", { detail: t }));
7277
7614
  }
7278
7615
  }
7279
7616
  }));
7280
- }), window.addEventListener("onWidgetLoad", async (h) => {
7281
- const { detail: e } = h;
7617
+ }), window.addEventListener("onWidgetLoad", async (d) => {
7618
+ const { detail: e } = d;
7282
7619
  if (window.client instanceof G) {
7283
7620
  const t = window.client;
7284
7621
  if (t.fields = e.fieldData, t.session = e.session.data, t.details = {
@@ -7293,26 +7630,38 @@ typeof window !== void 0 && (window.addEventListener("load", () => {
7293
7630
  }).catch(() => {
7294
7631
  t.details.provider = "local";
7295
7632
  }) : t.details.provider = "local", t.emit("load", e), t.debug) {
7296
- R.received("Widget loaded!", h.detail);
7297
- const a = h.detail.fieldData;
7633
+ R.received("Widget loaded!", d.detail);
7634
+ const a = d.detail.fieldData;
7298
7635
  Object.keys(a).length && R.received("Field data:", a);
7299
7636
  }
7300
7637
  t.loaded = !0, t.storage.on("load", (a) => {
7301
- if (t.debug && a ? R.debug("[Client]", "Storage loaded for client", `"${t.id}";`, `Provider: "${t.details.provider}";`, a) : t.debug && R.debug("[Client]", "Storage loaded for client", `"${t.id}";`, `Provider: "${t.details.provider}";`, "No data found."), a) {
7302
- const i = (b) => {
7303
- const g = Date.now(), c = {};
7304
- for (const d in b)
7305
- if (b.hasOwnProperty(d)) {
7306
- const f = b[d];
7307
- f.expire && f.expire > g && (c[d] = f);
7638
+ if (t.debug && a ? R.debug(
7639
+ "[Client]",
7640
+ "Storage loaded for client",
7641
+ `"${t.id}";`,
7642
+ `Provider: "${t.details.provider}";`,
7643
+ a
7644
+ ) : t.debug && R.debug(
7645
+ "[Client]",
7646
+ "Storage loaded for client",
7647
+ `"${t.id}";`,
7648
+ `Provider: "${t.details.provider}";`,
7649
+ "No data found."
7650
+ ), a) {
7651
+ const i = (f) => {
7652
+ const u = Date.now(), o = {};
7653
+ for (const m in f)
7654
+ if (f.hasOwnProperty(m)) {
7655
+ const w = f[m];
7656
+ w.expire && w.expire > u && (o[m] = w);
7308
7657
  }
7309
- return c;
7310
- }, s = i(a.user || {}), n = i(a.avatar || {}), m = i(a.pronoun || {}), o = i(a.emote || {});
7658
+ return o;
7659
+ }, s = i(a.user || {}), n = i(a.avatar || {}), l = i(a.pronoun || {}), c = i(a.emote || {});
7311
7660
  t.storage.update({
7312
7661
  user: s,
7313
7662
  avatar: n,
7314
- pronoun: m,
7315
- emote: o
7663
+ pronoun: l,
7664
+ emote: c
7316
7665
  });
7317
7666
  }
7318
7667
  e.channel.providerId.length && t.storage.add(`avatar.${e.channel.providerId.toLowerCase()}`, {
@@ -7322,15 +7671,15 @@ typeof window !== void 0 && (window.addEventListener("load", () => {
7322
7671
  });
7323
7672
  });
7324
7673
  }
7325
- }), window.addEventListener("onSessionUpdate", (h) => {
7326
- const { detail: e } = h;
7674
+ }), window.addEventListener("onSessionUpdate", (d) => {
7675
+ const { detail: e } = d;
7327
7676
  if (window.client instanceof G) {
7328
7677
  const t = window.client;
7329
7678
  t.session = e.session, t.emit("session", e.session), t.debug && R.debug("[Client]", "Session updated", e.session);
7330
7679
  }
7331
- }), window.addEventListener("onEventReceived", ({ detail: h }) => {
7680
+ }), window.addEventListener("onEventReceived", ({ detail: d }) => {
7332
7681
  if (window.client instanceof G) {
7333
- const t = y.event.parseProvider(h);
7682
+ const t = b.event.parseProvider(d);
7334
7683
  switch (t.provider) {
7335
7684
  case "streamelements": {
7336
7685
  const i = t.data;
@@ -7347,7 +7696,7 @@ typeof window !== void 0 && (window.addEventListener("load", () => {
7347
7696
  switch (i.event.listener) {
7348
7697
  case "widget-button": {
7349
7698
  const s = i.event;
7350
- it.execute(s.field, s.value);
7699
+ at.execute(s.field, s.value);
7351
7700
  break;
7352
7701
  }
7353
7702
  case "subscriber-latest": {
@@ -7360,9 +7709,17 @@ typeof window !== void 0 && (window.addEventListener("load", () => {
7360
7709
  case "kvstore:update": {
7361
7710
  const s = i.event;
7362
7711
  if (tt.length) {
7363
- var e = tt.find((n) => n.id === s.data.key.replace("customWidget.", "") || n.id === s.data.key);
7712
+ var e = tt.find(
7713
+ (n) => n.id === s.data.key.replace("customWidget.", "") || n.id === s.data.key
7714
+ );
7364
7715
  e && e.update(s.data.value);
7365
7716
  }
7717
+ if (et.length) {
7718
+ const n = et.find(
7719
+ (l) => l.id === s.data.key.replace("customWidget.", "") || l.id === s.data.key
7720
+ );
7721
+ n && n.update(s.data.value);
7722
+ }
7366
7723
  break;
7367
7724
  }
7368
7725
  case "bot:counter": {
@@ -7390,7 +7747,7 @@ typeof window !== void 0 && (window.addEventListener("load", () => {
7390
7747
  break;
7391
7748
  }
7392
7749
  case "message": {
7393
- i.event, Q.execute({ provider: "twitch", data: i });
7750
+ i.event, Z.execute({ provider: "twitch", data: i });
7394
7751
  break;
7395
7752
  }
7396
7753
  case "follower-latest": {
@@ -7417,7 +7774,7 @@ typeof window !== void 0 && (window.addEventListener("load", () => {
7417
7774
  const i = t.data;
7418
7775
  switch (i.listener) {
7419
7776
  case "message": {
7420
- i.event, Q.execute({ provider: "youtube", data: i });
7777
+ i.event, Z.execute({ provider: "youtube", data: i });
7421
7778
  break;
7422
7779
  }
7423
7780
  case "subscriber-latest": {
@@ -7453,10 +7810,14 @@ typeof window !== void 0 && (window.addEventListener("load", () => {
7453
7810
  "event:test",
7454
7811
  "kvstore:update"
7455
7812
  ];
7456
- client.debug && !a.some((i) => i === t.data.listener) && R.received("[Client]", `Event ${t.data.listener} received from ${t.provider}`, t.data.event);
7813
+ client.debug && !a.some((i) => i === t.data.listener) && R.received(
7814
+ "[Client]",
7815
+ `Event ${t.data.listener} received from ${t.provider}`,
7816
+ t.data.event
7817
+ );
7457
7818
  }
7458
7819
  }));
7459
- const nt = {
7820
+ const rt = {
7460
7821
  getOverlayStatus: () => ({
7461
7822
  isEditorMode: !1,
7462
7823
  muted: !1
@@ -7464,55 +7825,55 @@ const nt = {
7464
7825
  resumeQueue: () => {
7465
7826
  },
7466
7827
  responses: {},
7467
- sendMessage(h, e) {
7828
+ sendMessage(d, e) {
7468
7829
  },
7469
7830
  counters: {
7470
- get(h) {
7831
+ get(d) {
7471
7832
  return null;
7472
7833
  }
7473
7834
  },
7474
- sanitize(h) {
7475
- return h;
7835
+ sanitize(d) {
7836
+ return d;
7476
7837
  },
7477
- cheerFilter(h) {
7478
- return h;
7838
+ cheerFilter(d) {
7839
+ return d;
7479
7840
  },
7480
- setField(h, e, t) {
7841
+ setField(d, e, t) {
7481
7842
  },
7482
7843
  store: {
7483
- set: function(h, e) {
7484
- this.list[h] = e, localStorage.setItem("SE_API-STORE", JSON.stringify(nt.store.list));
7844
+ set: function(d, e) {
7845
+ this.list[d] = e, localStorage.setItem("SE_API-STORE", JSON.stringify(rt.store.list));
7485
7846
  },
7486
- get: async function(h) {
7487
- return this.list[h] ? this.list[h] : null;
7847
+ get: async function(d) {
7848
+ return this.list[d] ? this.list[d] : null;
7488
7849
  },
7489
7850
  list: {}
7490
7851
  }
7491
7852
  };
7492
- async function It() {
7493
- let h = localStorage.getItem("SE_API-STORE") ?? "", e = h ? JSON.parse(h) : {};
7494
- return nt.store.list = e, nt;
7853
+ async function Dt() {
7854
+ let d = localStorage.getItem("SE_API-STORE") ?? "", e = d ? JSON.parse(d) : {};
7855
+ return rt.store.list = e, rt;
7495
7856
  }
7496
- var rt;
7497
- ((h) => {
7857
+ var ot;
7858
+ ((d) => {
7498
7859
  let e;
7499
7860
  ((i) => {
7500
7861
  ((s) => {
7501
7862
  s.hehim = "He/Him", s.sheher = "She/Her", s.theythem = "They/Them", s.shethem = "She/They", s.hethem = "He/They", s.heshe = "He/She", s.xexem = "Xe/Xem", s.faefaer = "Fae/Faer", s.vever = "Ve/Ver", s.aeaer = "Ae/Aer", s.ziehir = "Zie/Hir", s.perper = "Per/Per", s.eem = "E/Em", s.itits = "It/Its";
7502
7863
  })(i.map || (i.map = {}));
7503
- })(e = h.Pronouns || (h.Pronouns = {}));
7864
+ })(e = d.Pronouns || (d.Pronouns = {}));
7504
7865
  async function t() {
7505
7866
  try {
7506
7867
  const i = await fetch("https://pronouns.alejo.io/api/pronouns").then((s) => s.json());
7507
7868
  if (Array.isArray(i) && i.length) {
7508
- const s = Object.fromEntries(i.map(({ name: n, display: m }) => [n, m]));
7869
+ const s = Object.fromEntries(i.map(({ name: n, display: l }) => [n, l]));
7509
7870
  return { ...e.map, ...s };
7510
7871
  }
7511
7872
  } catch {
7512
7873
  }
7513
7874
  return { ...e.map };
7514
7875
  }
7515
- h.list = t;
7876
+ d.list = t;
7516
7877
  async function a(i) {
7517
7878
  if (!i) throw new Error("Username is required to fetch Alejo data.");
7518
7879
  if (i = i.toLowerCase(), i in client.storage.data.pronoun && client.storage.data.pronoun[i].expire > Date.now())
@@ -7529,9 +7890,9 @@ var rt;
7529
7890
  throw new Error(`Failed to fetch pronoun data for user "${i}": ${s instanceof Error ? s.message : s}`);
7530
7891
  }
7531
7892
  }
7532
- h.get = a;
7533
- })(rt || (rt = {}));
7534
- class St extends Z {
7893
+ d.get = a;
7894
+ })(ot || (ot = {}));
7895
+ class At extends X {
7535
7896
  /**
7536
7897
  * Initializes a new ComfyJS instance and connects to Twitch chat.
7537
7898
  * @param options - Configuration options for ComfyJS instance.
@@ -7551,7 +7912,9 @@ class St extends Z {
7551
7912
  load() {
7552
7913
  return typeof window.ComfyJS > "u" || !window.ComfyJS ? new Promise((e, t) => {
7553
7914
  if (this.emulate && !client)
7554
- return t(new Error("useComfyJs: Cannot emulate chat messages without a Client instance."));
7915
+ return t(
7916
+ new Error("useComfyJs: Cannot emulate chat messages without a Client instance.")
7917
+ );
7555
7918
  const a = document.createElement("script");
7556
7919
  a.src = "https://cdn.jsdelivr.net/npm/comfy.js@1.1.29/dist/comfy.min.js", a.type = "text/javascript", a.async = !0, a.onload = () => e(window.ComfyJS), a.onerror = (i) => t(i), document.head.appendChild(a);
7557
7920
  }) : Promise.resolve(window.ComfyJS);
@@ -7571,17 +7934,17 @@ class St extends Z {
7571
7934
  vip: i.vip,
7572
7935
  subscriber: i.subscriber,
7573
7936
  founder: i.founder
7574
- }, m = {
7937
+ }, l = {
7575
7938
  name: e,
7576
7939
  message: `!${t} ${a}`,
7577
- badges: Object.entries(n).map(([o, b]) => b ? o : null).filter(Boolean),
7940
+ badges: Object.entries(n).map(([c, f]) => f ? c : null).filter(Boolean),
7578
7941
  color: s.userColor,
7579
7942
  time: new Date(s.timestamp).getTime(),
7580
7943
  userId: s.userId,
7581
7944
  msgId: s.id,
7582
7945
  channel: s.channel
7583
7946
  };
7584
- q.emulate.twitch.message(m);
7947
+ q.emulate.twitch.message(l);
7585
7948
  }
7586
7949
  }, this.instance.onChat = (e, t, a, i, s) => {
7587
7950
  if (this.emit("chat", e, t, a, i, s), client.debug && R.debug("[Client]", `ComfyJS Chat: ${t} (User: ${e})`), this.emulate) {
@@ -7597,7 +7960,7 @@ class St extends Z {
7597
7960
  q.emulate.twitch.message({
7598
7961
  name: e,
7599
7962
  message: t,
7600
- badges: Object.entries(n).map(([m, o]) => o ? m : null).filter(Boolean),
7963
+ badges: Object.entries(n).map(([l, c]) => c ? l : null).filter(Boolean),
7601
7964
  color: s.userColor,
7602
7965
  time: new Date(s.timestamp).getTime(),
7603
7966
  userId: s.userId,
@@ -7632,29 +7995,40 @@ class St extends Z {
7632
7995
  }
7633
7996
  }, this.instance.onResub = (e, t, a, i, s, n) => {
7634
7997
  if (this.emit("resub", e, t, a, i, s, n), client.debug && R.debug("[Client]", `ComfyJS Resub: ${e} (${i} months)`), this.emulate) {
7635
- const m = s.plan === "Prime" ? "prime" : s.plan;
7998
+ const l = s.plan === "Prime" ? "prime" : s.plan;
7636
7999
  q.emulate.twitch.subscriber({
7637
8000
  name: e,
7638
8001
  message: t,
7639
- tier: m,
8002
+ tier: l,
7640
8003
  amount: i,
7641
8004
  subType: "default"
7642
8005
  });
7643
8006
  }
7644
8007
  }, this.instance.onSubGift = (e, t, a, i, s, n) => {
7645
- if (this.emit("subGift", e, t, a, i, s, n), client.debug && R.debug("[Client]", `ComfyJS Sub Gift: ${e} gifted ${i} subs`), this.emulate) {
7646
- const m = s.plan === "Prime" ? "prime" : s.plan;
8008
+ if (this.emit(
8009
+ "subGift",
8010
+ e,
8011
+ t,
8012
+ a,
8013
+ i,
8014
+ s,
8015
+ n
8016
+ ), client.debug && R.debug("[Client]", `ComfyJS Sub Gift: ${e} gifted ${i} subs`), this.emulate) {
8017
+ const l = s.plan === "Prime" ? "prime" : s.plan;
7647
8018
  q.emulate.twitch.subscriber({
7648
8019
  name: a,
7649
8020
  message: "",
7650
8021
  sender: e,
7651
- tier: m,
8022
+ tier: l,
7652
8023
  amount: i,
7653
8024
  subType: "gift"
7654
8025
  });
7655
8026
  }
7656
8027
  }, this.instance.onSubMysteryGift = (e, t, a, i, s) => {
7657
- if (this.emit("subMysteryGift", e, t, a, i, s), client.debug && R.debug("[Client]", `ComfyJS Sub Mystery Gift: ${e} gifted ${t} subs`), this.emulate) {
8028
+ if (this.emit("subMysteryGift", e, t, a, i, s), client.debug && R.debug(
8029
+ "[Client]",
8030
+ `ComfyJS Sub Mystery Gift: ${e} gifted ${t} subs`
8031
+ ), this.emulate) {
7658
8032
  const n = i.plan === "Prime" ? "prime" : i.plan;
7659
8033
  q.emulate.twitch.subscriber({
7660
8034
  name: e,
@@ -7665,7 +8039,10 @@ class St extends Z {
7665
8039
  });
7666
8040
  }
7667
8041
  }, this.instance.onGiftSubContinue = (e, t, a) => {
7668
- this.emit("giftSubContinue", e, t, a), client.debug && R.debug("[Client]", `ComfyJS Gift Sub Continue: ${e} continued their gifted sub from ${t}`), this.emulate && q.emulate.twitch.subscriber({
8042
+ this.emit("giftSubContinue", e, t, a), client.debug && R.debug(
8043
+ "[Client]",
8044
+ `ComfyJS Gift Sub Continue: ${e} continued their gifted sub from ${t}`
8045
+ ), this.emulate && q.emulate.twitch.subscriber({
7669
8046
  name: e,
7670
8047
  message: "",
7671
8048
  sender: t,
@@ -7681,15 +8058,21 @@ class St extends Z {
7681
8058
  }, this.instance.onChatMode = (e, t) => {
7682
8059
  this.emit("chatMode", e, t), client.debug && R.debug("[Client]", `ComfyJS Chat Mode Changed on ${t}`);
7683
8060
  }, this.instance.onReward = (e, t, a, i, s) => {
7684
- this.emit("reward", e, t, a, i, s), client.debug && R.debug("[Client]", `ComfyJS Reward: ${e} redeemed ${t} for ${a} - ${i}`);
8061
+ this.emit("reward", e, t, a, i, s), client.debug && R.debug(
8062
+ "[Client]",
8063
+ `ComfyJS Reward: ${e} redeemed ${t} for ${a} - ${i}`
8064
+ );
7685
8065
  }, this.instance.onConnected = (e, t, a) => {
7686
- this.emit("connected", e, t, a), client.debug && R.debug("[Client]", `ComfyJS Connected: ${e}:${t} (First Connect: ${a})`);
8066
+ this.emit("connected", e, t, a), client.debug && R.debug(
8067
+ "[Client]",
8068
+ `ComfyJS Connected: ${e}:${t} (First Connect: ${a})`
8069
+ );
7687
8070
  }, this.instance.onReconnect = (e) => {
7688
8071
  this.emit("reconnect", e), client.debug && R.debug("[Client]", `ComfyJS Reconnect: Attempt #${e}`);
7689
8072
  }, this.init && this.instance.Init(this.username, this.password, this.channels, this.isDebug);
7690
8073
  }
7691
8074
  }
7692
- class ut {
8075
+ class pt {
7693
8076
  constructor(e = {}) {
7694
8077
  this.error = this.apply({
7695
8078
  color: "#721c24",
@@ -7756,13 +8139,13 @@ class ut {
7756
8139
  if (!this.enabled || typeof console > "u") return;
7757
8140
  let s = "";
7758
8141
  typeof this.prefix == "function" ? s = this.prefix() : typeof this.prefix == "string" && (s = this.prefix);
7759
- const n = [], m = [];
7760
- if (i.forEach((o) => {
7761
- typeof o == "string" || typeof o == "number" || typeof o == "boolean" ? n.push(o) : m.push(o);
8142
+ const n = [], l = [];
8143
+ if (i.forEach((c) => {
8144
+ typeof c == "string" || typeof c == "number" || typeof c == "boolean" ? n.push(c) : l.push(c);
7762
8145
  }), n.length > 0) {
7763
- const o = n.join(" ");
7764
- console.log(`%c${s.endsWith(" ") ? s : s.trim() + " "}${a}${o}`, t, ...m);
7765
- } else m.length > 0 && console.log(`%c${s.endsWith(" ") ? s : s.trim() + " "}${a}`, t, ...m);
8146
+ const c = n.join(" ");
8147
+ console.log(`%c${s.endsWith(" ") ? s : s.trim() + " "}${a}${c}`, t, ...l);
8148
+ } else l.length > 0 && console.log(`%c${s.endsWith(" ") ? s : s.trim() + " "}${a}`, t, ...l);
7766
8149
  };
7767
8150
  }
7768
8151
  style(e) {
@@ -7788,21 +8171,21 @@ class ut {
7788
8171
  !this.enabled || !console.timeEnd || console.timeEnd(e);
7789
8172
  }
7790
8173
  }
7791
- const gt = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(It()), R = new ut(), ht = {
7792
- SeAPI: gt,
8174
+ const ct = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(Dt()), R = new pt(), mt = {
8175
+ SeAPI: ct,
7793
8176
  Client: G,
7794
- Helper: y,
8177
+ Helper: b,
7795
8178
  Local: q,
7796
- Data: D,
8179
+ Data: A,
7797
8180
  logger: R,
7798
- modules: { EventProvider: Z, useStorage: et, useQueue: mt, useLogger: ut },
7799
- actions: { Button: it, Command: Q },
7800
- multistream: { useComfyJs: St },
7801
- data: { usedStorages: tt },
7802
- pronouns: { Alejo: rt }
8181
+ modules: { EventProvider: X, useStorage: it, useQueue: gt, useLogger: pt, useComms: St },
8182
+ actions: { Button: at, Command: Z },
8183
+ multistream: { useComfyJs: At },
8184
+ data: { usedStorages: tt, usedComms: et },
8185
+ pronouns: { Alejo: ot }
7803
8186
  };
7804
- typeof window < "u" ? window.Tixyel = ht : globalThis.Tixyel = ht;
8187
+ typeof window < "u" ? window.Tixyel = mt : globalThis.Tixyel = mt;
7805
8188
  export {
7806
- ht as default
8189
+ mt as default
7807
8190
  };
7808
8191
  //# sourceMappingURL=index.es.js.map