@tixyel/streamelements 5.4.0 → 5.5.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 W {
1
+ class V {
2
2
  constructor() {
3
3
  this.registeredEvents = {};
4
4
  }
@@ -49,13 +49,13 @@ class W {
49
49
  return this.registeredEvents[e] = [], this;
50
50
  }
51
51
  }
52
- var _ = [];
53
- class V extends W {
52
+ var q = [];
53
+ class G extends V {
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 ?? {}, _.push(this), this.start();
55
+ super(), this.id = "default", this.loaded = !1, this.SE_API = null, this.id = e.id || this.id, this.data = e.data ?? {}, q.push(this), this.start();
56
56
  }
57
57
  start() {
58
- $?.then((e) => {
58
+ et?.then((e) => {
59
59
  this.SE_API = e, e.store.get(this.id).then((t) => {
60
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);
61
61
  }).catch(() => {
@@ -86,7 +86,7 @@ class V extends W {
86
86
  * @param value Value to add
87
87
  */
88
88
  add(e, t) {
89
- this.loaded && (V.setByPath(this.data, e, t), this.save(this.data));
89
+ this.loaded && (G.setByPath(this.data, e, t), this.save(this.data));
90
90
  }
91
91
  /**
92
92
  * Clears all data from the storage.
@@ -112,7 +112,7 @@ class V extends W {
112
112
  return e === "load" && this.loaded ? (t.apply(this, [this.data]), this) : (super.on(e, t), this);
113
113
  }
114
114
  }
115
- class N extends W {
115
+ class M extends V {
116
116
  constructor(e) {
117
117
  super(), this.id = "default", this.debug = !1, this.fields = {}, this.loaded = !1, this.actions = {
118
118
  commands: [],
@@ -121,7 +121,7 @@ class N extends W {
121
121
  avatar: 30,
122
122
  pronoun: 60,
123
123
  emote: 120
124
- }, this.id = e.id || this.id, this.storage = new V({
124
+ }, this.id = e.id || this.id, this.storage = new G({
125
125
  id: this.id,
126
126
  data: {
127
127
  user: {},
@@ -154,9 +154,9 @@ class N extends W {
154
154
  ]), this) : (super.on(e, t), this);
155
155
  }
156
156
  }
157
- class O {
157
+ class _ {
158
158
  constructor(e) {
159
- this.prefix = "!", this.arguments = !1, this.test = `${this.prefix}${this.name} arg1 arg2`, this.aliases = [], this.permissions = void 0, this.admins = [], window.client instanceof N && (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"));
159
+ this.prefix = "!", this.arguments = !1, this.test = `${this.prefix}${this.name} arg1 arg2`, this.aliases = [], this.permissions = void 0, this.admins = [], window.client instanceof M && (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
160
  }
161
161
  run(e, t) {
162
162
  }
@@ -164,7 +164,7 @@ class O {
164
164
  return this.arguments === !0 && (!a || !a.length) ? !1 : !!(this.admins.some((i) => e.toLocaleLowerCase() === i.toLocaleLowerCase()) || this.permissions === !0 || typeof this.permissions > "u" || Array.isArray(this.permissions) && !this.permissions.length || Array.isArray(this.permissions) && (this.permissions.some((i) => e.toLowerCase() === i.toLowerCase() || t.map((s) => s.toLowerCase()).includes(i.toLowerCase())) || this.permissions.includes("*")));
165
165
  }
166
166
  parse(e, t) {
167
- if (!(window.client instanceof N)) return !1;
167
+ if (!(window.client instanceof M)) return !1;
168
168
  const a = e.replace(this.prefix, "").split(" ").slice(1).map((o) => o.trim());
169
169
  var i = "", s = [];
170
170
  const n = { bits: "cheer", premium: "prime" };
@@ -191,12 +191,12 @@ class O {
191
191
  return l === !0 && this.run.apply(window.client, [a, t]), l;
192
192
  }
193
193
  remove() {
194
- if (!(window.client instanceof N)) return;
194
+ if (!(window.client instanceof M)) return;
195
195
  const e = window.client.actions.commands.indexOf(this);
196
196
  e > -1 && (window.client.actions.commands.splice(e, 1), window.client.emit("action", this, "removed"));
197
197
  }
198
198
  static execute(e) {
199
- if (!(window.client instanceof N)) return !1;
199
+ if (!(window.client instanceof M)) return !1;
200
200
  const t = e.data;
201
201
  try {
202
202
  if (window.client.actions.commands.length && window.client.actions.commands.some((a) => t.event.data.text.startsWith(a.prefix))) {
@@ -204,7 +204,7 @@ class O {
204
204
  var s = [i.name, ...i.aliases ?? []], n = t.event.data.text.replace(i.prefix, "").split(" ")[0];
205
205
  return s.includes(n);
206
206
  });
207
- if (a.length && a.every((i) => i instanceof O))
207
+ if (a.length && a.every((i) => i instanceof _))
208
208
  return a.forEach((i) => {
209
209
  i.parse(t.event.data.text, e), window.client.emit("action", i, "executed"), A.received(`Command executed: ${t.event.data.text} by ${t.event.data.nick || t.event.data.displayName}`, t);
210
210
  }), !0;
@@ -216,7 +216,7 @@ class O {
216
216
  }
217
217
  }
218
218
  }
219
- const X = [
219
+ const Z = [
220
220
  "aliceblue",
221
221
  "antiquewhite",
222
222
  "aqua",
@@ -367,7 +367,7 @@ const X = [
367
367
  "yellowgreen",
368
368
  "transparent"
369
369
  ];
370
- function et(h, e) {
370
+ function it(h, e) {
371
371
  if (!e) return null;
372
372
  switch (e) {
373
373
  case "hex": {
@@ -390,7 +390,7 @@ function et(h, e) {
390
390
  const t = h.match(/hsla?\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%(?:\s*,\s*([\d.]+))?\s*\)/);
391
391
  if (!t) return null;
392
392
  const a = parseInt(t[1]), i = parseInt(t[2]), s = parseInt(t[3]), n = t[4] ? parseFloat(t[4]) : 1;
393
- return { ...at(a, i, s), a: n };
393
+ return { ...st(a, i, s), a: n };
394
394
  }
395
395
  case "css-color-name": {
396
396
  const t = document.createElement("canvas");
@@ -405,12 +405,12 @@ function et(h, e) {
405
405
  return null;
406
406
  }
407
407
  }
408
- function it(h, e = !0) {
408
+ function at(h, e = !0) {
409
409
  const t = (i) => Math.round(i).toString(16).padStart(2, "0");
410
410
  let a = `#${t(h.r)}${t(h.g)}${t(h.b)}`;
411
411
  return e && h.a < 1 && (a += t(h.a * 255)), a;
412
412
  }
413
- function K(h, e, t) {
413
+ function X(h, e, t) {
414
414
  h /= 255, e /= 255, t /= 255;
415
415
  const a = Math.max(h, e, t), i = Math.min(h, e, t), s = a - i;
416
416
  let n = 0, l = 0;
@@ -433,7 +433,7 @@ function K(h, e, t) {
433
433
  l: Math.round(o * 100)
434
434
  };
435
435
  }
436
- function at(h, e, t) {
436
+ function st(h, e, t) {
437
437
  h /= 360, e /= 100, t /= 100;
438
438
  let a, i, s;
439
439
  if (e === 0)
@@ -448,8 +448,8 @@ function at(h, e, t) {
448
448
  b: Math.round(s * 255)
449
449
  };
450
450
  }
451
- async function st(h, e, t) {
452
- const a = X;
451
+ async function nt(h, e, t) {
452
+ const a = Z;
453
453
  let i = a[0], s = 1 / 0;
454
454
  for await (const n of a) {
455
455
  const l = document.createElement("canvas");
@@ -457,12 +457,12 @@ async function st(h, e, t) {
457
457
  const o = l.getContext("2d");
458
458
  if (!o) continue;
459
459
  o.fillStyle = n, o.fillRect(0, 0, 1, 1);
460
- const [b, g, r] = o.getImageData(0, 0, 1, 1).data, c = Math.sqrt(Math.pow(h - b, 2) + Math.pow(e - g, 2) + Math.pow(t - r, 2));
461
- if (c < s && (s = c, i = n), c === 0) break;
460
+ const [b, g, r] = o.getImageData(0, 0, 1, 1).data, d = Math.sqrt(Math.pow(h - b, 2) + Math.pow(e - g, 2) + Math.pow(t - r, 2));
461
+ if (d < s && (s = d, i = n), d === 0) break;
462
462
  }
463
463
  return i;
464
464
  }
465
- const nt = [
465
+ const rt = [
466
466
  "https://static-cdn.jtvnw.net/user-default-pictures-uv/13e5fa74-defa-11e9-809c-784f43822e80-profile_image-300x300.png",
467
467
  "https://static-cdn.jtvnw.net/user-default-pictures-uv/dbdc9198-def8-11e9-8681-784f43822e80-profile_image-300x300.png",
468
468
  "https://static-cdn.jtvnw.net/user-default-pictures-uv/998f01ae-def8-11e9-b95c-784f43822e80-profile_image-300x300.png",
@@ -470,7 +470,7 @@ const nt = [
470
470
  "https://static-cdn.jtvnw.net/user-default-pictures-uv/ebe4cd89-b4f4-4cd9-adac-2f30151b4209-profile_image-300x300.png",
471
471
  "https://static-cdn.jtvnw.net/user-default-pictures-uv/215b7342-def9-11e9-9a66-784f43822e80-profile_image-300x300.png",
472
472
  "https://static-cdn.jtvnw.net/user-default-pictures-uv/ead5c8b2-a4c9-4724-b1dd-9f00b46cbd3d-profile_image-300x300.png"
473
- ], rt = {
473
+ ], ot = {
474
474
  "100 bits": {
475
475
  type: "100 bits",
476
476
  version: "1",
@@ -561,7 +561,7 @@ const nt = [
561
561
  url: "https://static-cdn.jtvnw.net/badges/v1/b817aba4-fad8-49e2-b88a-7cc744dfa6ec/3",
562
562
  description: "VIP"
563
563
  }
564
- }, ot = Object.values([
564
+ }, ct = Object.values([
565
565
  {
566
566
  type: "twitch",
567
567
  name: "TheIlluminati",
@@ -1918,7 +1918,7 @@ const nt = [
1918
1918
  end: 0
1919
1919
  }), h),
1920
1920
  []
1921
- ), ct = [], dt = [
1921
+ ), dt = [], ht = [
1922
1922
  "Hello everyone!",
1923
1923
  "PogChamp",
1924
1924
  "This stream is amazing!",
@@ -1969,7 +1969,7 @@ const nt = [
1969
1969
  "BloodTrail hunting time",
1970
1970
  "CatBag kitty!",
1971
1971
  "c! poggers"
1972
- ], ht = ["Local", "Tixyel", "Urie_s2", "itzzcatt", "BeniArts", "Cupidiko", "shy_madeit"], lt = ["1000", "2000", "3000", "prime"], mt = [
1972
+ ], lt = ["Local", "Tixyel", "Urie_s2", "itzzcatt", "BeniArts", "Cupidiko", "shy_madeit"], mt = ["1000", "2000", "3000", "prime"], ut = [
1973
1973
  "Filiz",
1974
1974
  "Astrid",
1975
1975
  "Tatyana",
@@ -2057,7 +2057,7 @@ const nt = [
2057
2057
  "Szabolcs",
2058
2058
  "Hoda",
2059
2059
  "Naayf"
2060
- ], ut = [
2060
+ ], gt = [
2061
2061
  {
2062
2062
  emojiId: "UCkszU2WH9gy1mb0dV-11UJg/flower-rainbow-heart-red",
2063
2063
  shortcuts: [":pride-flower-rainbow-heart:"],
@@ -5233,14 +5233,14 @@ const nt = [
5233
5233
  ];
5234
5234
  var E;
5235
5235
  ((h) => {
5236
- h.avatars = nt, h.badges = rt, h.css_color_names = X, h.emotes = ot, h.items = ct, h.messages = dt, h.names = ht, h.tiers = lt, h.tts = mt, h.youtube_emotes = ut;
5236
+ h.avatars = rt, h.badges = ot, h.css_color_names = Z, h.emotes = ct, h.items = dt, h.messages = ht, h.names = lt, h.tiers = mt, h.tts = ut, h.youtube_emotes = gt;
5237
5237
  })(E || (E = {}));
5238
5238
  var y;
5239
5239
  ((h) => {
5240
5240
  let e;
5241
5241
  ((n) => {
5242
5242
  function l(g, r = "cardinal") {
5243
- const c = {
5243
+ const d = {
5244
5244
  single: ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"],
5245
5245
  tens: ["ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"],
5246
5246
  decades: ["twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"]
@@ -5256,17 +5256,17 @@ var y;
5256
5256
  return `${g}${m[x]}`;
5257
5257
  }
5258
5258
  function w(C, x) {
5259
- if (C < 10) return x === "ordinal" ? f.single[C] : c.single[C];
5260
- if (C < 20) return x === "ordinal" ? f.tens[C - 10] : c.tens[C - 10];
5261
- const D = Math.floor(C / 10), d = C % 10;
5262
- if (d === 0) return x === "ordinal" ? f.decades[D - 2] : c.decades[D - 2];
5263
- const p = c.decades[D - 2], J = x === "ordinal" ? f.single[d] : c.single[d];
5259
+ if (C < 10) return x === "ordinal" ? f.single[C] : d.single[C];
5260
+ if (C < 20) return x === "ordinal" ? f.tens[C - 10] : d.tens[C - 10];
5261
+ const D = Math.floor(C / 10), c = C % 10;
5262
+ if (c === 0) return x === "ordinal" ? f.decades[D - 2] : d.decades[D - 2];
5263
+ const p = d.decades[D - 2], J = x === "ordinal" ? f.single[c] : d.single[c];
5264
5264
  return `${p}-${J}`;
5265
5265
  }
5266
5266
  function k(C, x) {
5267
- if (C === 0) return x === "ordinal" ? f.single[0] : c.single[0];
5268
- const D = Math.floor(C / 100), d = C % 100, p = [];
5269
- return D > 0 && (x === "ordinal" && d === 0 ? p.push(`${c.single[D]} hundredth`) : p.push(`${c.single[D]} hundred`)), d > 0 && p.push(w(d, x)), p.join(" ");
5267
+ if (C === 0) return x === "ordinal" ? f.single[0] : d.single[0];
5268
+ const D = Math.floor(C / 100), c = C % 100, p = [];
5269
+ return D > 0 && (x === "ordinal" && c === 0 ? p.push(`${d.single[D]} hundredth`) : p.push(`${d.single[D]} hundred`)), c > 0 && p.push(w(c, x)), p.join(" ");
5270
5270
  }
5271
5271
  if (g < 1e3) return k(g, r);
5272
5272
  const j = [];
@@ -5281,8 +5281,8 @@ var y;
5281
5281
  if (x === 0) continue;
5282
5282
  const D = u[C];
5283
5283
  if (r === "cardinal") {
5284
- let d = k(x, "cardinal");
5285
- D && (d += ` ${D}`), T.push(d);
5284
+ let c = k(x, "cardinal");
5285
+ D && (c += ` ${D}`), T.push(c);
5286
5286
  } else if (C === I)
5287
5287
  if (C > 0) {
5288
5288
  const p = k(x, "cardinal"), J = v[C];
@@ -5299,41 +5299,41 @@ var y;
5299
5299
  return T.join(", ");
5300
5300
  }
5301
5301
  n.translate = l;
5302
- function o(g, r = 0, c = 100) {
5303
- return Math.min(Math.max(g, r), c);
5302
+ function o(g, r = 0, d = 100) {
5303
+ return Math.min(Math.max(g, r), d);
5304
5304
  }
5305
5305
  n.balance = o;
5306
5306
  function b(g, r = 2) {
5307
- const c = Math.pow(10, r);
5308
- return Math.round(g * c) / c;
5307
+ const d = Math.pow(10, r);
5308
+ return Math.round(g * d) / d;
5309
5309
  }
5310
5310
  n.round = b;
5311
5311
  })(e = h.number || (h.number = {})), ((n) => {
5312
- function l(c, f) {
5312
+ function l(d, f) {
5313
5313
  return new Promise(
5314
5314
  (m) => setTimeout(() => {
5315
5315
  if (f) {
5316
5316
  const u = f();
5317
5317
  m(u ?? null);
5318
5318
  } else m(null);
5319
- }, c)
5319
+ }, d)
5320
5320
  );
5321
5321
  }
5322
5322
  n.delay = l;
5323
- function o(c) {
5324
- return Object.entries(c);
5323
+ function o(d) {
5324
+ return Object.entries(d);
5325
5325
  }
5326
5326
  n.typedEntries = o;
5327
- function b(c) {
5328
- return Object.values(c);
5327
+ function b(d) {
5328
+ return Object.values(d);
5329
5329
  }
5330
5330
  n.typedValues = b;
5331
- function g(c) {
5332
- return Object.keys(c);
5331
+ function g(d) {
5332
+ return Object.keys(d);
5333
5333
  }
5334
5334
  n.typedKeys = g;
5335
- function r(c) {
5336
- const f = Object.values(c).reduce((w, k) => w + k, 0), m = o(c).sort((w, k) => k[1] - w[1]), u = Math.random() * f;
5335
+ function r(d) {
5336
+ const f = Object.values(d).reduce((w, k) => w + k, 0), m = o(d).sort((w, k) => k[1] - w[1]), u = Math.random() * f;
5337
5337
  let v = 0;
5338
5338
  for (const [w, k] of m)
5339
5339
  if (v += k, u < v)
@@ -5343,21 +5343,21 @@ var y;
5343
5343
  })(h.utils || (h.utils = {}));
5344
5344
  let t;
5345
5345
  ((n) => {
5346
- function l(c, f, m) {
5346
+ function l(d, f, m) {
5347
5347
  const u = f.match(/^<span(?: class="[^"]*")? style="([^"]*)">(.*)<\/span>$/s);
5348
5348
  if (u) {
5349
5349
  const v = u[1], w = u[2], k = u[0].match(/class="([^"]*)"/)?.[1] || "";
5350
- let j = [v, c].filter((S) => S.length).map((S) => S.endsWith(";") ? S.slice(0, -1) : S).join("; ").replace(/\s*;\s*/g, "; ").trim();
5350
+ let j = [v, d].filter((S) => S.length).map((S) => S.endsWith(";") ? S.slice(0, -1) : S).join("; ").replace(/\s*;\s*/g, "; ").trim();
5351
5351
  return j.endsWith(";") || (j += ";"), `<span${k ? ` class="${k} ${m ?? ""}"` : ""}${j ? ` style="${j}"` : ""}>${w}</span>`;
5352
5352
  } else
5353
- return c && c.length && !c.endsWith(";") && (c += ";"), `<span${m ? ` class="${m}"` : ""}${c ? ` style="${c}"` : ""}>${f}</span>`;
5353
+ return d && d.length && !d.endsWith(";") && (d += ";"), `<span${m ? ` class="${m}"` : ""}${d ? ` style="${d}"` : ""}>${f}</span>`;
5354
5354
  }
5355
5355
  n.mergeSpanStyles = l;
5356
- function o(c, f = 0, m = 1, u) {
5357
- const { return: v = !1, parent: w, base: k } = u || {}, j = w || c.parentElement || document.body;
5356
+ function o(d, f = 0, m = 1, u) {
5357
+ const { return: v = !1, parent: w, base: k } = u || {}, j = w || d.parentElement || document.body;
5358
5358
  if (!j)
5359
5359
  throw new Error("No parent element found for scaling");
5360
- const S = j.getBoundingClientRect(), I = c.offsetWidth, T = c.offsetHeight;
5360
+ const S = j.getBoundingClientRect(), I = d.offsetWidth, T = d.offsetHeight;
5361
5361
  if (I === 0 || T === 0)
5362
5362
  throw new Error("Element has zero width or height, cannot scale");
5363
5363
  const C = S.width * m / I, x = S.height * m / T;
@@ -5366,44 +5366,44 @@ var y;
5366
5366
  const p = S.width * f / I, J = S.height * f / T, U = Math.max(p, J);
5367
5367
  D = Math.max(U, D);
5368
5368
  }
5369
- const d = {
5369
+ const c = {
5370
5370
  width: I * D,
5371
5371
  height: T * D,
5372
5372
  scale: D
5373
5373
  };
5374
- return v || (c.style.transform = `scale(${D})`, c.style.transformOrigin = "center center"), d;
5374
+ return v || (d.style.transform = `scale(${D})`, d.style.transformOrigin = "center center"), c;
5375
5375
  }
5376
5376
  n.scale = o;
5377
- function b(c, f = {}) {
5378
- const { parent: m = c.parentElement, prefer: u = "auto", min: v = 0, max: w = 1, apply: k = () => {
5377
+ function b(d, f = {}) {
5378
+ const { parent: m = d.parentElement, prefer: u = "auto", min: v = 0, max: w = 1, apply: k = () => {
5379
5379
  } } = f;
5380
5380
  if (!m)
5381
5381
  throw new Error("No parent element found for scaling");
5382
- const j = m.getBoundingClientRect(), S = c.getBoundingClientRect(), I = j.width, T = j.height, C = S.width, x = S.height;
5383
- let D = I * v / C, d = T * v / x, p = I * w / C, J = T * w / x, U = Math.min(p, J);
5384
- const P = Math.max(D, d);
5382
+ const j = m.getBoundingClientRect(), S = d.getBoundingClientRect(), I = j.width, T = j.height, C = S.width, x = S.height;
5383
+ let D = I * v / C, c = T * v / x, p = I * w / C, J = T * w / x, U = Math.min(p, J);
5384
+ const P = Math.max(D, c);
5385
5385
  U = Math.max(U, P);
5386
- const z = C * U, M = x * U;
5387
- return u === "width" ? U = Math.max(D, Math.min(p, I / C)) : u === "height" ? U = Math.max(d, Math.min(J, T / x)) : z > I ? U = Math.max(D, Math.min(p, I / C)) : M > T && (U = Math.max(d, Math.min(J, T / x))), k.apply(c, [U, c]), U;
5386
+ const z = C * U, N = x * U;
5387
+ return u === "width" ? U = Math.max(D, Math.min(p, I / C)) : u === "height" ? U = Math.max(c, Math.min(J, T / x)) : z > I ? U = Math.max(D, Math.min(p, I / C)) : N > T && (U = Math.max(c, Math.min(J, T / x))), k.apply(d, [U, d]), U;
5388
5388
  }
5389
5389
  n.scalev2 = b;
5390
- function g(c, f = 1, m = {}) {
5391
- const u = parseFloat(getComputedStyle(c).getPropertyValue("font-size")), v = {
5390
+ function g(d, f = 1, m = {}) {
5391
+ const u = parseFloat(getComputedStyle(d).getPropertyValue("font-size")), v = {
5392
5392
  minFontSize: m?.minFontSize ?? 0,
5393
5393
  maxFontSize: m?.maxFontSize ?? u
5394
- }, w = m?.parent || c.parentElement;
5394
+ }, w = m?.parent || d.parentElement;
5395
5395
  if (!w)
5396
5396
  throw new Error("No parent element found for fitting text");
5397
- const k = w.clientWidth * f, j = c.offsetWidth, S = k / j, I = u * S, T = e.balance(I, v.minFontSize, v.maxFontSize);
5398
- return c.style.fontSize = T + "px", c;
5397
+ const k = w.clientWidth * f, j = d.offsetWidth, S = k / j, I = u * S, T = e.balance(I, v.minFontSize, v.maxFontSize);
5398
+ return d.style.fontSize = T + "px", d;
5399
5399
  }
5400
5400
  n.fitText = g;
5401
- function r(c, f = 0) {
5402
- const u = new DOMParser().parseFromString(c, "text/html");
5401
+ function r(d, f = 0) {
5402
+ const u = new DOMParser().parseFromString(d, "text/html");
5403
5403
  let v = f;
5404
5404
  function w(I) {
5405
5405
  if (I.nodeType === Node.TEXT_NODE) {
5406
- const C = (I.textContent || "").split("").map((D, d) => {
5406
+ const C = (I.textContent || "").split("").map((D, c) => {
5407
5407
  const p = document.createElement("span");
5408
5408
  return p.classList.add("char"), p.dataset.index = String(v), p.dataset.exclusivityIndex = String(v), p.style.setProperty("--char-index", String(v)), p.style.setProperty("--exclusivity-index", String(v)), (D === " " || D === `
5409
5409
  ` || D === " ") && (p.style.whiteSpace = "pre-wrap"), p.textContent = D, v++, p;
@@ -5436,9 +5436,9 @@ var y;
5436
5436
  ((n) => {
5437
5437
  function l(o, b = !0, g = "") {
5438
5438
  const r = {};
5439
- for (const c in o) {
5440
- if (!Object.prototype.hasOwnProperty.call(o, c)) continue;
5441
- const f = o[c], m = g ? `${g}.${c}` : c;
5439
+ for (const d in o) {
5440
+ if (!Object.prototype.hasOwnProperty.call(o, d)) continue;
5441
+ const f = o[d], m = g ? `${g}.${d}` : d;
5442
5442
  if (f == null) {
5443
5443
  r[m] = String(f);
5444
5444
  continue;
@@ -5478,9 +5478,9 @@ var y;
5478
5478
  }
5479
5479
  n.flatten = l;
5480
5480
  })(a = h.object || (h.object = {})), ((n) => {
5481
- function l(r, c = E.emotes) {
5481
+ function l(r, d = E.emotes) {
5482
5482
  const f = [];
5483
- return c.forEach((m) => {
5483
+ return d.forEach((m) => {
5484
5484
  const u = m.name;
5485
5485
  let v = 0, w = 0;
5486
5486
  for (; v < r.length; ) {
@@ -5492,19 +5492,19 @@ var y;
5492
5492
  }), f.sort((m, u) => m.start - u.start);
5493
5493
  }
5494
5494
  n.findEmotesInText = l;
5495
- function o(r, c) {
5496
- if (!c.length) return r;
5495
+ function o(r, d) {
5496
+ if (!d.length) return r;
5497
5497
  let f = "", m = 0;
5498
- return c.forEach((u) => {
5498
+ return d.forEach((u) => {
5499
5499
  f += r.substring(m, u.start);
5500
5500
  const w = Array.from({ ...u.urls, length: 5 }).slice(1).reverse().filter(Boolean)[0] || u.urls[1];
5501
5501
  f += `<img src="${w}" alt="${u.name}" class="emote" style="width: auto; height: 1em; vertical-align: middle;" />`, m = u.end;
5502
5502
  }), f += r.substring(m), f;
5503
5503
  }
5504
5504
  n.replaceEmotesWithHTML = o;
5505
- function b(r, c = E.youtube_emotes) {
5505
+ function b(r, d = E.youtube_emotes) {
5506
5506
  return Array.from(r.matchAll(/:(.*?):/gim), (m) => m[0]).forEach((m) => {
5507
- const u = c.find((v) => v.shortcuts.includes(m) || v.searchTerms.includes(m.slice(1, -1)));
5507
+ const u = d.find((v) => v.shortcuts.includes(m) || v.searchTerms.includes(m.slice(1, -1)));
5508
5508
  if (u) {
5509
5509
  const v = u.image.thumbnails.at(-1)?.url, w = u.image.accessibility.accessibilityData.label;
5510
5510
  v && (r = r.replace(m, `<img src="${v}" alt="${w}" class="emote" style="width: auto; height: 1em; vertical-align: middle;" />`));
@@ -5512,7 +5512,7 @@ var y;
5512
5512
  }), r;
5513
5513
  }
5514
5514
  n.replaceYoutubeEmotesWithHTML = b;
5515
- async function g(r = [], c) {
5515
+ async function g(r = [], d) {
5516
5516
  if (!Array.isArray(r) && typeof r == "string" && (r = r.split(",").map((w) => w.trim())), !r || !r.length) {
5517
5517
  var f = s.number(1, 3);
5518
5518
  for await (const w of Array.from({ length: f }, () => "")) {
@@ -5521,7 +5521,7 @@ var y;
5521
5521
  }
5522
5522
  }
5523
5523
  var u;
5524
- switch (c) {
5524
+ switch (d) {
5525
5525
  case "twitch": {
5526
5526
  u = {
5527
5527
  keys: Array.from(r).filter((w) => w in E.badges),
@@ -5563,14 +5563,14 @@ var y;
5563
5563
  "tip-latest",
5564
5564
  "event:test",
5565
5565
  "event:skip"
5566
- ].some((c) => c === o.listener) && (b = "streamelements"), { provider: b, data: o };
5566
+ ].some((d) => d === o.listener) && (b = "streamelements"), { provider: b, data: o };
5567
5567
  }
5568
5568
  n.parseProvider = l;
5569
5569
  })(h.event || (h.event = {})), ((n) => {
5570
- async function l(g, r, c) {
5570
+ async function l(g, r, d) {
5571
5571
  const f = [];
5572
5572
  g.replace(r, (u, ...v) => {
5573
- const w = typeof c == "function" ? c(u, ...v) : u;
5573
+ const w = typeof d == "function" ? d(u, ...v) : u;
5574
5574
  return f.push(Promise.resolve(w)), u;
5575
5575
  });
5576
5576
  const m = await Promise.all(f);
@@ -5581,57 +5581,57 @@ var y;
5581
5581
  return g.charAt(0).toUpperCase() + g.slice(1);
5582
5582
  }
5583
5583
  n.capitalize = o;
5584
- function b(g, r = {}, c = {
5584
+ function b(g, r = {}, d = {
5585
5585
  method: "index",
5586
5586
  html: !1,
5587
5587
  modifiers: {},
5588
5588
  aliases: {}
5589
5589
  }) {
5590
- const { mergeSpanStyles: f } = t, m = (d, p, J) => c.html ? f(d, p, J) : p;
5590
+ const { mergeSpanStyles: f } = t, m = (c, p, J) => d.html ? f(c, p, J) : p;
5591
5591
  r.skip = "<br/>", r.newline = "<br/>";
5592
5592
  const u = Object.entries(a.flatten(r)).reduce(
5593
- (d, [p, J]) => {
5594
- if (d[p] = String(J), ["username", "name", "nick", "nickname", "sender"].some((U) => p === U)) {
5595
- const U = d?.username || d?.name || d?.nick || d?.nickname || d?.sender;
5596
- d.username = d.username || U, d.usernameAt = `@${d.username}`, d.name = d.name || U, d.nick = d.nick || U, d.nickname = d.nickname || U, d.sender = d.sender || U, d.senderAt = `@${d.sender}`;
5593
+ (c, [p, J]) => {
5594
+ if (c[p] = String(J), ["username", "name", "nick", "nickname", "sender"].some((U) => p === U)) {
5595
+ const U = c?.username || c?.name || c?.nick || c?.nickname || c?.sender;
5596
+ c.username = c.username || U, c.usernameAt = `@${c.username}`, c.name = c.name || U, c.nick = c.nick || U, c.nickname = c.nickname || U, c.sender = c.sender || U, c.senderAt = `@${c.sender}`;
5597
5597
  }
5598
- return ["amount", "count"].some((U) => p === U) && (d.amount = String(d?.amount || d.count || J), d.count = String(d?.count || d?.amount || J)), d.currency = d.currency || window?.client?.details.currency.symbol || "$", d.currencyCode = d.currencyCode || window?.client?.details.currency.code || "USD", d;
5598
+ return ["amount", "count"].some((U) => p === U) && (c.amount = String(c?.amount || c.count || J), c.count = String(c?.count || c?.amount || J)), c.currency = c.currency || window?.client?.details.currency.symbol || "$", c.currencyCode = c.currencyCode || window?.client?.details.currency.code || "USD", c;
5599
5599
  },
5600
5600
  {}
5601
5601
  ), v = {
5602
5602
  PLACEHOLDERS: /{([^}]+)}/g,
5603
- MODIFIERS: /\[(\w+)(:[^=]+)?=([^\]]+)\]/g
5603
+ MODIFIERS: /\[([^\]=]+)=([^\]]+)\]/g
5604
5604
  };
5605
5605
  var w = parseFloat(u?.amount ?? u?.count ?? 0);
5606
5606
  const k = {
5607
- COLOR: (d, p) => m(p && i.validate(p) ? `color: ${p}` : "", d, "color"),
5608
- WEIGHT: (d, p) => m(p && !isNaN(parseInt(p)) ? `font-weight: ${p}` : "", d, "weight"),
5609
- BOLD: (d) => m("font-weight: bold", d, "bold"),
5610
- LIGHT: (d) => m("font-weight: lighter", d, "light"),
5611
- STRONG: (d) => m("font-weight: bolder", d, "strong"),
5612
- ITALIC: (d) => m("font-style: italic", d, "italic"),
5613
- UNDERLINE: (d) => m("text-decoration: underline", d, "underline"),
5614
- STRIKETHROUGH: (d) => m("text-decoration: line-through", d, "strikethrough"),
5615
- SUB: (d) => m("vertical-align: sub", d, "sub"),
5616
- SUP: (d) => m("vertical-align: super", d, "sup"),
5617
- LARGER: (d) => m("font-size: larger", d, "larger"),
5618
- SMALL: (d) => m("font-size: smaller", d, "small"),
5619
- SHADOW: (d, p) => m(`text-shadow: ${p}`, d, "shadow"),
5620
- SIZE: (d, p) => m(p ? `font-size: ${p}` : "", d, "size")
5607
+ COLOR: (c, p) => m(p && i.validate(p) ? `color: ${p}` : "", c, "color"),
5608
+ WEIGHT: (c, p) => m(p && !isNaN(parseInt(p)) ? `font-weight: ${p}` : "", c, "weight"),
5609
+ BOLD: (c) => m("font-weight: bold", c, "bold"),
5610
+ LIGHT: (c) => m("font-weight: lighter", c, "light"),
5611
+ STRONG: (c) => m("font-weight: bolder", c, "strong"),
5612
+ ITALIC: (c) => m("font-style: italic", c, "italic"),
5613
+ UNDERLINE: (c) => m("text-decoration: underline", c, "underline"),
5614
+ STRIKETHROUGH: (c) => m("text-decoration: line-through", c, "strikethrough"),
5615
+ SUB: (c) => m("vertical-align: sub", c, "sub"),
5616
+ SUP: (c) => m("vertical-align: super", c, "sup"),
5617
+ LARGER: (c) => m("font-size: larger", c, "larger"),
5618
+ SMALL: (c) => m("font-size: smaller", c, "small"),
5619
+ SHADOW: (c, p) => m(`text-shadow: ${p}`, c, "shadow"),
5620
+ SIZE: (c, p) => m(p ? `font-size: ${p}` : "", c, "size")
5621
5621
  }, S = {
5622
5622
  ...{
5623
- BT1: (d) => w > 1 ? d : "",
5624
- BT0: (d) => w > 0 ? d : "",
5625
- ST1: (d) => w < 1 ? d : "",
5626
- ST0: (d) => w < 0 ? d : "",
5627
- UPC: (d) => d.toUpperCase(),
5628
- LOW: (d) => d.toLowerCase(),
5629
- REV: (d) => d.split("").reverse().join(""),
5630
- CAP: (d) => d.charAt(0).toUpperCase() + d.slice(1).toLowerCase(),
5631
- FALLBACK: (d, p) => d.length ? d : p ?? d
5623
+ BT1: (c) => w > 1 ? c : "",
5624
+ BT0: (c) => w > 0 ? c : "",
5625
+ ST1: (c) => w < 1 ? c : "",
5626
+ ST0: (c) => w < 0 ? c : "",
5627
+ UPC: (c) => c.toUpperCase(),
5628
+ LOW: (c) => c.toLowerCase(),
5629
+ REV: (c) => c.split("").reverse().join(""),
5630
+ CAP: (c) => c.charAt(0).toUpperCase() + c.slice(1).toLowerCase(),
5631
+ FALLBACK: (c, p) => c.length ? c : p ?? c
5632
5632
  },
5633
- ...c?.html ? k : {},
5634
- ...c.modifiers ?? {}
5633
+ ...d?.html ? k : {},
5634
+ ...d.modifiers ?? {}
5635
5635
  }, I = {
5636
5636
  UPC: ["UPPERCASE", "UPPER", "UPP"],
5637
5637
  LOW: ["LOWERCASE", "LOWER", "LWC"],
@@ -5653,63 +5653,77 @@ var y;
5653
5653
  SMALL: ["SMALLER", "SM"],
5654
5654
  SHADOW: ["SHADOW", "SHD"],
5655
5655
  FALLBACK: ["FALLBACK", "FB"],
5656
- ...c.aliases ?? {}
5656
+ ...d.aliases ?? {}
5657
5657
  };
5658
- function T(d, p, J) {
5659
- const U = Object.entries(I).find(([z, M]) => M.some((R) => R.toUpperCase() === p.toUpperCase()) ? !0 : z.toUpperCase() === p.toUpperCase()), P = U ? U[0] : p.toUpperCase();
5658
+ function T(c, p, J) {
5659
+ const U = Object.entries(I).find(([z, N]) => N.some((R) => R.toUpperCase() === p.toUpperCase()) ? !0 : z.toUpperCase() === p.toUpperCase()), P = U ? U[0] : p.toUpperCase();
5660
5660
  try {
5661
- return S[P] ? S[P](d, typeof J == "string" ? J.trim() : null, u) : c?.html ? m("", d, P.toLowerCase()) : d;
5661
+ return S[P] ? S[P](c, typeof J == "string" ? J.trim() : null, u) : d?.html ? m("", c, P.toLowerCase()) : c;
5662
5662
  } catch {
5663
- return d;
5663
+ return c;
5664
5664
  }
5665
5665
  }
5666
- function C(d) {
5667
- let p = d, J;
5666
+ function C(c) {
5667
+ let p = c, J;
5668
5668
  for (; (J = v.MODIFIERS.exec(p)) !== null; ) {
5669
- const [U, P, z, M] = J, R = T(C(M), P, z);
5669
+ const [U, P, z] = J, N = P.split(",").map((L) => L.trim()).filter((L) => L.length).map((L) => {
5670
+ const [O, W] = L.split(":");
5671
+ return { name: O.trim(), param: W?.trim() ?? null };
5672
+ });
5673
+ let R = C(z);
5674
+ for (const { name: L, param: O } of N)
5675
+ R = T(R, L, O);
5670
5676
  p = p.replace(U, R ?? ""), v.MODIFIERS.lastIndex = 0;
5671
5677
  }
5672
5678
  return p;
5673
5679
  }
5674
- function x(d) {
5680
+ function x(c) {
5675
5681
  let p = 0;
5676
- const J = d.length;
5682
+ const J = c.length;
5677
5683
  function U(z) {
5678
- let M = "";
5684
+ let N = "";
5679
5685
  for (; p < J; )
5680
- if (d[p] === "\\")
5681
- p + 1 < J ? (M += d[p + 1], p += 2) : p++;
5682
- else if (d[p] === "[" && (!z || z !== "["))
5683
- M += P();
5684
- else if (z && d[p] === z) {
5686
+ if (c[p] === "\\")
5687
+ p + 1 < J ? (N += c[p + 1], p += 2) : p++;
5688
+ else if (c[p] === "[" && (!z || z !== "["))
5689
+ N += P();
5690
+ else if (z && c[p] === z) {
5685
5691
  p++;
5686
5692
  break;
5687
5693
  } else
5688
- M += d[p++];
5689
- return M;
5694
+ N += c[p++];
5695
+ return N;
5690
5696
  }
5691
5697
  function P() {
5692
5698
  p++;
5693
- let z = "";
5694
- for (; p < J && /[A-Za-z0-9]/.test(d[p]); ) z += d[p++];
5695
- let M = null;
5696
- if (d[p] === ":") {
5697
- p++;
5698
- const tt = p;
5699
- for (; p < J && d[p] !== "="; ) p++;
5700
- M = d.slice(tt, p);
5699
+ const z = [];
5700
+ for (; p < J && c[p] !== "="; ) {
5701
+ if (c[p] === ",") {
5702
+ p++;
5703
+ continue;
5704
+ }
5705
+ let R = "";
5706
+ for (; p < J && /[A-Za-z0-9]/.test(c[p]); ) R += c[p++];
5707
+ let L = null;
5708
+ if (c[p] === ":") {
5709
+ p++;
5710
+ const O = p;
5711
+ for (; p < J && c[p] !== "," && c[p] !== "="; ) p++;
5712
+ L = c.slice(O, p);
5713
+ }
5714
+ R.length && z.push({ name: R, param: L }), c[p] === "," && p++;
5701
5715
  }
5702
- d[p] === "=" && p++;
5703
- const R = U("]");
5704
- return T(R, z, M);
5716
+ c[p] === "=" && p++;
5717
+ const N = U("]");
5718
+ return z.reduce((R, { name: L, param: O }) => T(R, L, O), N);
5705
5719
  }
5706
5720
  return U();
5707
5721
  }
5708
5722
  let D = g.replace(
5709
5723
  v.PLACEHOLDERS,
5710
- (d, p) => typeof u[p] == "string" || typeof u[p] == "number" ? String(u[p]) : p ?? p
5724
+ (c, p) => typeof u[p] == "string" || typeof u[p] == "number" ? String(u[p]) : p ?? p
5711
5725
  );
5712
- return D = c.method === "loop" ? C(D) : x(D), D;
5726
+ return D = d.method === "loop" ? C(D) : x(D), D;
5713
5727
  }
5714
5728
  n.compose = b;
5715
5729
  })(h.string || (h.string = {})), ((n) => {
@@ -5719,11 +5733,11 @@ var y;
5719
5733
  throw new Error("No sound URL provided");
5720
5734
  try {
5721
5735
  g && n.playing && n.audio && n.audio.state !== "closed" && n.audio.close();
5722
- let r = new AudioContext(), c = r.createGain();
5723
- c.connect(r.destination), g && (n.audio = r, n.playing = !0), fetch(o).then((f) => f.arrayBuffer()).then((f) => r.decodeAudioData(f)).then((f) => {
5736
+ let r = new AudioContext(), d = r.createGain();
5737
+ d.connect(r.destination), g && (n.audio = r, n.playing = !0), fetch(o).then((f) => f.arrayBuffer()).then((f) => r.decodeAudioData(f)).then((f) => {
5724
5738
  if (r.state !== "closed") {
5725
5739
  const m = r.createBufferSource();
5726
- m.buffer = f, m.connect(c), c.gain.value = b / 100, m.start(r.currentTime);
5740
+ m.buffer = f, m.connect(d), d.gain.value = b / 100, m.start(r.currentTime);
5727
5741
  }
5728
5742
  });
5729
5743
  } catch (r) {
@@ -5734,10 +5748,10 @@ var y;
5734
5748
  })(h.sound || (h.sound = {}));
5735
5749
  let i;
5736
5750
  ((n) => {
5737
- function l(r = 100, c = "") {
5738
- c = c.length > 7 ? c?.substring(0, 6) : c, r = r > 1 ? r / 100 : r;
5751
+ function l(r = 100, d = "") {
5752
+ d = d.length > 7 ? d?.substring(0, 6) : d, r = r > 1 ? r / 100 : r;
5739
5753
  let f = Math.round(Math.min(Math.max(r, 0), 1) * 255).toString(16).toLowerCase().padStart(2, "0");
5740
- return c + f;
5754
+ return d + f;
5741
5755
  }
5742
5756
  n.opacity = l;
5743
5757
  function o(r) {
@@ -5746,7 +5760,7 @@ var y;
5746
5760
  color: r,
5747
5761
  opacity: 100
5748
5762
  };
5749
- var m = r.slice(-2), c = parseInt(m, 16) / 255, f = Math.round(c * 100), m = r.length > 7 ? r.slice(0, 7) : r;
5763
+ var m = r.slice(-2), d = parseInt(m, 16) / 255, f = Math.round(d * 100), m = r.length > 7 ? r.slice(0, 7) : r;
5750
5764
  return {
5751
5765
  color: m,
5752
5766
  opacity: f
@@ -5755,33 +5769,33 @@ var y;
5755
5769
  n.extract = o;
5756
5770
  function b(r) {
5757
5771
  if (typeof r != "string" || !String(r).trim().length) return !1;
5758
- const c = r.trim();
5759
- return /^#([A-Fa-f0-9]{3}){1,2}$/.test(c) || /^#([A-Fa-f0-9]{4}|[A-Fa-f0-9]{8})$/.test(c) ? "hex" : /^rgb\(\s*(?:\d{1,3}\s*,\s*){2}\d{1,3}\s*\)$/.test(c) ? "rgb" : /^rgba\(\s*(?:\d{1,3}\s*,\s*){3}(?:0|1|0?\.\d+)\s*\)$/.test(c) ? "rgba" : /^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/.test(c) ? "hsl" : /^hsla\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*,\s*(?:0|1|0?\.\d+)\s*\)$/.test(c) ? "hsla" : E.css_color_names.includes(c.toLowerCase()) ? "css-color-name" : !1;
5772
+ const d = r.trim();
5773
+ 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" : E.css_color_names.includes(d.toLowerCase()) ? "css-color-name" : !1;
5760
5774
  }
5761
5775
  n.validate = b;
5762
- async function g(r, c) {
5776
+ async function g(r, d) {
5763
5777
  const f = b(r);
5764
5778
  if (!f) throw new Error(`Invalid color format: ${r}`);
5765
- if (f === c) throw new Error(`Color is already in the desired format: ${c}`);
5766
- const m = et(r.trim(), f);
5779
+ if (f === d) throw new Error(`Color is already in the desired format: ${d}`);
5780
+ const m = it(r.trim(), f);
5767
5781
  if (!m) throw new Error(`Failed to parse color: ${r}`);
5768
- switch (c) {
5782
+ switch (d) {
5769
5783
  case "hex":
5770
- return it(m, !1);
5784
+ return at(m, !1);
5771
5785
  case "rgb":
5772
5786
  return `rgb(${m.r}, ${m.g}, ${m.b})`;
5773
5787
  case "rgba":
5774
5788
  return `rgba(${m.r}, ${m.g}, ${m.b}, ${m.a})`;
5775
5789
  case "hsl": {
5776
- const u = K(m.r, m.g, m.b);
5790
+ const u = X(m.r, m.g, m.b);
5777
5791
  return `hsl(${u.h}, ${u.s}%, ${u.l}%)`;
5778
5792
  }
5779
5793
  case "hsla": {
5780
- const u = K(m.r, m.g, m.b);
5794
+ const u = X(m.r, m.g, m.b);
5781
5795
  return `hsla(${u.h}, ${u.s}%, ${u.l}%, ${m.a})`;
5782
5796
  }
5783
5797
  case "css-color-name":
5784
- return await st(m.r, m.g, m.b);
5798
+ return await nt(m.r, m.g, m.b);
5785
5799
  default:
5786
5800
  return null;
5787
5801
  }
@@ -5844,10 +5858,10 @@ var y;
5844
5858
  return [u[v], v];
5845
5859
  }
5846
5860
  n.array = r;
5847
- function c(u = new Date(2e3, 0, 1), v = /* @__PURE__ */ new Date()) {
5861
+ function d(u = new Date(2e3, 0, 1), v = /* @__PURE__ */ new Date()) {
5848
5862
  return new Date(o(u.getTime(), v.getTime()));
5849
5863
  }
5850
- n.date = c;
5864
+ n.date = d;
5851
5865
  function f(u) {
5852
5866
  const w = Date.now() - o(0, u * 24 * 60 * 60 * 1e3);
5853
5867
  return new Date(w).toISOString();
@@ -5859,9 +5873,9 @@ var y;
5859
5873
  n.uuid = m;
5860
5874
  })(s = h.random || (h.random = {}));
5861
5875
  })(y || (y = {}));
5862
- class q {
5876
+ class F {
5863
5877
  constructor(e) {
5864
- this.field = "button", this.template = "button", this.name = "Button", this.value = "", window.client instanceof N && (this.field = e.field ?? this.field, this.template = e.template ?? 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"));
5878
+ this.field = "button", this.template = "button", this.name = "Button", this.value = "", window.client instanceof M && (this.field = e.field ?? this.field, this.template = e.template ?? 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"));
5865
5879
  }
5866
5880
  generate(e) {
5867
5881
  return y.utils.typedValues(e).reduce(
@@ -5887,16 +5901,16 @@ class q {
5887
5901
  return this;
5888
5902
  }
5889
5903
  remove() {
5890
- if (!(window.client instanceof N)) return;
5904
+ if (!(window.client instanceof M)) return;
5891
5905
  const e = window.client.actions.buttons.indexOf(this);
5892
5906
  e > -1 && (window.client.actions.buttons.splice(e, 1), window.client.emit("action", this, "removed"));
5893
5907
  }
5894
5908
  static execute(e, t) {
5895
5909
  try {
5896
- if (!(window.client instanceof N)) return !1;
5910
+ if (!(window.client instanceof M)) return !1;
5897
5911
  if (window.client.actions.buttons.length) {
5898
5912
  const a = window.client.actions.buttons.filter((i) => typeof i.field == "string" ? i.field === e : typeof i.field == "function" ? i.field(e, t) : !1);
5899
- if (a.length && a.every((i) => i instanceof q))
5913
+ if (a.length && a.every((i) => i instanceof F))
5900
5914
  return a.forEach((i) => {
5901
5915
  try {
5902
5916
  i.parse(e, t), window.client.emit("action", i, "executed"), A.received(`Button executed: ${e}${t ? ` with value: ${t}` : ""}`);
@@ -6173,14 +6187,14 @@ var H;
6173
6187
  const l = (g) => {
6174
6188
  if (!g || !("amount" in g)) return [];
6175
6189
  const r = [];
6176
- for (let c = 0; c < g.amount; c++)
6190
+ for (let d = 0; d < g.amount; d++)
6177
6191
  r.push(i(g.value));
6178
- return r.sort((c, f) => new Date(f.createdAt).getTime() - new Date(c.createdAt).getTime());
6192
+ return r.sort((d, f) => new Date(f.createdAt).getTime() - new Date(d.createdAt).getTime());
6179
6193
  }, o = (g) => {
6180
6194
  const r = {};
6181
- for (const c in g) {
6182
- const f = c.replace("_type", "type");
6183
- r[f] = i(g[c]);
6195
+ for (const d in g) {
6196
+ const f = d.replace("_type", "type");
6197
+ r[f] = i(g[d]);
6184
6198
  }
6185
6199
  return r;
6186
6200
  }, b = (g) => {
@@ -6276,8 +6290,8 @@ var H;
6276
6290
  }
6277
6291
  const r = t[`cheer-${g}-top-donation`];
6278
6292
  r && n > r.amount && (r.amount = n, r.name = l);
6279
- const c = t[`cheer-${g}-top-donator`], f = t["cheer-recent"].filter((u) => u.name.toLowerCase() === c.name.toLowerCase()).reduce((u, v) => u + v.amount, 0), m = t["cheer-recent"].filter((u) => u.name.toLowerCase() === l.toLowerCase()).reduce((u, v) => u + v.amount, 0);
6280
- m > f && (c.amount = m, c.name = l);
6293
+ const d = t[`cheer-${g}-top-donator`], f = t["cheer-recent"].filter((u) => u.name.toLowerCase() === d.name.toLowerCase()).reduce((u, v) => u + v.amount, 0), m = t["cheer-recent"].filter((u) => u.name.toLowerCase() === l.toLowerCase()).reduce((u, v) => u + v.amount, 0);
6294
+ m > f && (d.amount = m, d.name = l);
6281
6295
  };
6282
6296
  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: l, amount: n, createdAt: (/* @__PURE__ */ new Date()).toISOString() }), t["cheer-recent"] = (t["cheer-recent"] || []).sort(i);
6283
6297
  break;
@@ -6332,8 +6346,8 @@ var H;
6332
6346
  }
6333
6347
  const g = t[`superchat-${b}-top-donation`];
6334
6348
  g && l > g.amount && (g.amount = l, g.name = n);
6335
- const r = t[`superchat-${b}-top-donator`], c = t["superchat-recent"].filter((m) => m.name.toLowerCase() === r.name.toLowerCase()).reduce((m, u) => m + u.amount, 0), f = t["superchat-recent"].filter((m) => m.name.toLowerCase() === n.toLowerCase()).reduce((m, u) => m + u.amount, 0);
6336
- f > c && (r.amount = f, r.name = n);
6349
+ const r = t[`superchat-${b}-top-donator`], d = t["superchat-recent"].filter((m) => m.name.toLowerCase() === r.name.toLowerCase()).reduce((m, u) => m + u.amount, 0), f = t["superchat-recent"].filter((m) => m.name.toLowerCase() === n.toLowerCase()).reduce((m, u) => m + u.amount, 0);
6350
+ f > d && (r.amount = f, r.name = n);
6337
6351
  };
6338
6352
  o("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({
6339
6353
  name: n.toLowerCase(),
@@ -6361,8 +6375,8 @@ var H;
6361
6375
  }
6362
6376
  const g = t[`tip-${b}-top-donation`];
6363
6377
  g && l > g.amount && (g.amount = l, g.name = n);
6364
- const r = t[`tip-${b}-top-donator`], c = t["tip-recent"].filter((m) => m.name.toLowerCase() === r.name.toLowerCase()).reduce((m, u) => m + u.amount, 0), f = t["tip-recent"].filter((m) => m.name.toLowerCase() === n.toLowerCase()).reduce((m, u) => m + u.amount, 0);
6365
- f > c && (r.amount = f, r.name = n);
6378
+ const r = t[`tip-${b}-top-donator`], d = t["tip-recent"].filter((m) => m.name.toLowerCase() === r.name.toLowerCase()).reduce((m, u) => m + u.amount, 0), f = t["tip-recent"].filter((m) => m.name.toLowerCase() === n.toLowerCase()).reduce((m, u) => m + u.amount, 0);
6379
+ f > d && (r.amount = f, r.name = n);
6366
6380
  };
6367
6381
  o("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({ name: n, amount: l, createdAt: (/* @__PURE__ */ new Date()).toISOString() }), t["tip-recent"] = (t["tip-recent"] || []).sort(i);
6368
6382
  }
@@ -6398,7 +6412,7 @@ var H;
6398
6412
  switch (t) {
6399
6413
  default:
6400
6414
  case "random": {
6401
- var n = y.random.array(Object.keys(s).filter((d) => s[d].length))[0], l = y.random.array(s[n])[0];
6415
+ var n = y.random.array(Object.keys(s).filter((c) => s[c].length))[0], l = y.random.array(s[n])[0];
6402
6416
  return this.onEventReceived(n, l);
6403
6417
  }
6404
6418
  case "twitch":
@@ -6409,7 +6423,7 @@ var H;
6409
6423
  return this.onEventReceived(t, l);
6410
6424
  }
6411
6425
  case "message": {
6412
- var o = i?.name ?? y.random.array(E.names.filter((p) => p.length))[0], b = i?.message ?? y.random.array(E.messages.filter((p) => p.length))[0], g = await y.message.generateBadges(i?.badges ?? [], t), r = y.message.findEmotesInText(b), c = y.message.replaceEmotesWithHTML(b, r), f = i?.color ?? y.random.color("hex"), m = i?.userId ?? y.random.number(1e7, 99999999).toString(), u = i?.msgId ?? y.random.uuid(), v = i?.time ?? Date.now(), w = i?.channel ?? client.details.user.username;
6426
+ var o = i?.name ?? y.random.array(E.names.filter((p) => p.length))[0], b = i?.message ?? y.random.array(E.messages.filter((p) => p.length))[0], g = await y.message.generateBadges(i?.badges ?? [], t), r = y.message.findEmotesInText(b), d = y.message.replaceEmotesWithHTML(b, r), f = i?.color ?? y.random.color("hex"), m = i?.userId ?? y.random.number(1e7, 99999999).toString(), u = i?.msgId ?? y.random.uuid(), v = i?.time ?? Date.now(), w = i?.channel ?? client.details.user.username;
6413
6427
  return {
6414
6428
  listener: "message",
6415
6429
  event: {
@@ -6445,7 +6459,7 @@ var H;
6445
6459
  badges: g.badges,
6446
6460
  emotes: r
6447
6461
  },
6448
- renderedText: c
6462
+ renderedText: d
6449
6463
  },
6450
6464
  // @ts-ignore
6451
6465
  emulated: !0
@@ -6662,9 +6676,9 @@ var H;
6662
6676
  return this.onEventReceived(t, l);
6663
6677
  }
6664
6678
  case "message": {
6665
- var o = i?.name ?? y.random.array(E.names.filter((G) => G.length))[0], b = i?.message ?? y.random.array(E.messages.filter((G) => G.length))[0];
6679
+ var o = i?.name ?? y.random.array(E.names.filter((B) => B.length))[0], b = i?.message ?? y.random.array(E.messages.filter((B) => B.length))[0];
6666
6680
  const J = await y.message.generateBadges(i?.badges ?? [], t);
6667
- var r = y.message.findEmotesInText(b), c = y.message.replaceEmotesWithHTML(b, r), f = i?.color ?? y.random.color("hex"), m = i?.userId ?? y.random.number(1e7, 99999999).toString(), u = i?.msgId ?? y.random.uuid(), v = i?.time ?? Date.now(), j = i?.avatar ?? y.random.array(E.avatars)[0], w = i?.channel ?? client.details.user.username;
6681
+ var r = y.message.findEmotesInText(b), d = y.message.replaceEmotesWithHTML(b, r), f = i?.color ?? y.random.color("hex"), m = i?.userId ?? y.random.number(1e7, 99999999).toString(), u = i?.msgId ?? y.random.uuid(), v = i?.time ?? Date.now(), j = i?.avatar ?? y.random.array(E.avatars)[0], w = i?.channel ?? client.details.user.username;
6668
6682
  return {
6669
6683
  listener: "message",
6670
6684
  event: {
@@ -6754,7 +6768,7 @@ var H;
6754
6768
  }
6755
6769
  case "sponsor":
6756
6770
  case "sponsor-latest": {
6757
- var S = i?.tier ?? y.random.array(["1000", "2000", "3000"])[0], k = i?.amount ?? y.random.number(1, 24), j = i?.avatar ?? y.random.array(E.avatars)[0], o = i?.name ?? y.random.array(E.names.filter((L) => L.length))[0], I = i?.sender ?? y.random.array(E.names.filter((L) => L.length && L !== o))[0], b = i?.message ?? y.random.array(E.messages.filter((L) => L.length))[0], T = {
6771
+ var S = i?.tier ?? y.random.array(["1000", "2000", "3000"])[0], k = i?.amount ?? y.random.number(1, 24), j = i?.avatar ?? y.random.array(E.avatars)[0], o = i?.name ?? y.random.array(E.names.filter((W) => W.length))[0], I = i?.sender ?? y.random.array(E.names.filter((W) => W.length && W !== o))[0], b = i?.message ?? y.random.array(E.messages.filter((W) => W.length))[0], T = {
6758
6772
  default: {
6759
6773
  avatar: j,
6760
6774
  playedAsCommunityGift: !1
@@ -6930,7 +6944,7 @@ var H;
6930
6944
  cache: "no-store"
6931
6945
  }).then((l) => l.json()).then(async (l) => {
6932
6946
  const o = Object.entries(l).filter(([g, { value: r }]) => r != null).reduce(
6933
- (g, [r, { value: c }]) => (n && n[r] !== void 0 && (c = n[r]), g[r] = c, g),
6947
+ (g, [r, { value: d }]) => (n && n[r] !== void 0 && (d = n[r]), g[r] = d, g),
6934
6948
  {
6935
6949
  ...n
6936
6950
  }
@@ -6940,9 +6954,9 @@ var H;
6940
6954
  }
6941
6955
  h.start = e;
6942
6956
  })(H || (H = {}));
6943
- class Q extends W {
6957
+ class $ extends V {
6944
6958
  constructor(e) {
6945
- if (super(), this.queue = [], this.priorityQueue = [], this.history = [], this.timeouts = [], this.running = !1, this.duration = void 0, this.loaded = !1, !(window.client instanceof N))
6959
+ if (super(), this.queue = [], this.priorityQueue = [], this.history = [], this.timeouts = [], this.running = !1, this.duration = void 0, this.loaded = !1, !(window.client instanceof M))
6946
6960
  throw new Error("useQueue can only be instantiated after the Client is initialized.");
6947
6961
  if (!e.processor || typeof e.processor != "function")
6948
6962
  throw new Error("A valid processor function must be provided to useQueue.");
@@ -6999,7 +7013,7 @@ class Q extends W {
6999
7013
  }
7000
7014
  }
7001
7015
  typeof window !== void 0 && (window.addEventListener("load", () => {
7002
- window.client instanceof N && (H.queue = new Q({
7016
+ window.client instanceof M && (H.queue = new $({
7003
7017
  duration: "client",
7004
7018
  processor: async function(e) {
7005
7019
  if (window.dispatchEvent(new CustomEvent(e.listener, { detail: e.data })), e.listener === "onEventReceived" && e.session) {
@@ -7010,7 +7024,7 @@ typeof window !== void 0 && (window.addEventListener("load", () => {
7010
7024
  }));
7011
7025
  }), window.addEventListener("onWidgetLoad", async (h) => {
7012
7026
  const { detail: e } = h;
7013
- if (window.client instanceof N) {
7027
+ if (window.client instanceof M) {
7014
7028
  const t = window.client;
7015
7029
  if (t.fields = e.fieldData, t.session = e.session.data, t.details = {
7016
7030
  ...t.details,
@@ -7032,10 +7046,10 @@ typeof window !== void 0 && (window.addEventListener("load", () => {
7032
7046
  if (t.debug && a ? A.debug("[Client]", "Storage loaded for client", `"${t.id}";`, `Provider: "${t.details.provider}";`, a) : t.debug && A.debug("[Client]", "Storage loaded for client", `"${t.id}";`, `Provider: "${t.details.provider}";`, "No data found."), a) {
7033
7047
  const i = (b) => {
7034
7048
  const g = Date.now(), r = {};
7035
- for (const c in b)
7036
- if (b.hasOwnProperty(c)) {
7037
- const f = b[c];
7038
- f.expire && f.expire > g && (r[c] = f);
7049
+ for (const d in b)
7050
+ if (b.hasOwnProperty(d)) {
7051
+ const f = b[d];
7052
+ f.expire && f.expire > g && (r[d] = f);
7039
7053
  }
7040
7054
  return r;
7041
7055
  }, s = i(a.user || {}), n = i(a.avatar || {}), l = i(a.pronoun || {}), o = i(a.emote || {});
@@ -7055,12 +7069,12 @@ typeof window !== void 0 && (window.addEventListener("load", () => {
7055
7069
  }
7056
7070
  }), window.addEventListener("onSessionUpdate", (h) => {
7057
7071
  const { detail: e } = h;
7058
- if (window.client instanceof N) {
7072
+ if (window.client instanceof M) {
7059
7073
  const t = window.client;
7060
7074
  t.session = e.session, t.emit("session", e.session), t.debug && A.debug("[Client]", "Session updated", e.session);
7061
7075
  }
7062
7076
  }), window.addEventListener("onEventReceived", ({ detail: h }) => {
7063
- if (window.client instanceof N) {
7077
+ if (window.client instanceof M) {
7064
7078
  const t = y.event.parseProvider(h);
7065
7079
  switch (t.provider) {
7066
7080
  case "streamelements": {
@@ -7078,7 +7092,7 @@ typeof window !== void 0 && (window.addEventListener("load", () => {
7078
7092
  switch (i.event.listener) {
7079
7093
  case "widget-button": {
7080
7094
  const s = i.event;
7081
- q.execute(s.field, s.value);
7095
+ F.execute(s.field, s.value);
7082
7096
  break;
7083
7097
  }
7084
7098
  case "subscriber-latest": {
@@ -7090,8 +7104,8 @@ typeof window !== void 0 && (window.addEventListener("load", () => {
7090
7104
  }
7091
7105
  case "kvstore:update": {
7092
7106
  const s = i.event;
7093
- if (_.length) {
7094
- var e = _.find((n) => n.id === s.data.key.replace("customWidget.", ""));
7107
+ if (q.length) {
7108
+ var e = q.find((n) => n.id === s.data.key.replace("customWidget.", "") || n.id === s.data.key);
7095
7109
  e && e.update(s.data.value);
7096
7110
  }
7097
7111
  break;
@@ -7121,7 +7135,7 @@ typeof window !== void 0 && (window.addEventListener("load", () => {
7121
7135
  break;
7122
7136
  }
7123
7137
  case "message": {
7124
- i.event, O.execute({ provider: "twitch", data: i });
7138
+ i.event, _.execute({ provider: "twitch", data: i });
7125
7139
  break;
7126
7140
  }
7127
7141
  case "follower-latest": {
@@ -7148,7 +7162,7 @@ typeof window !== void 0 && (window.addEventListener("load", () => {
7148
7162
  const i = t.data;
7149
7163
  switch (i.listener) {
7150
7164
  case "message": {
7151
- i.event, O.execute({ provider: "youtube", data: i });
7165
+ i.event, _.execute({ provider: "youtube", data: i });
7152
7166
  break;
7153
7167
  }
7154
7168
  case "subscriber-latest": {
@@ -7187,7 +7201,7 @@ typeof window !== void 0 && (window.addEventListener("load", () => {
7187
7201
  client.debug && !a.some((i) => i === t.data.listener) && A.received("[Client]", `Event ${t.data.listener} received from ${t.provider}`, t.data.event);
7188
7202
  }
7189
7203
  }));
7190
- const F = {
7204
+ const K = {
7191
7205
  getOverlayStatus: () => ({
7192
7206
  isEditorMode: !1,
7193
7207
  muted: !1
@@ -7212,7 +7226,7 @@ const F = {
7212
7226
  },
7213
7227
  store: {
7214
7228
  set: function(h, e) {
7215
- this.list[h] = e, localStorage.setItem("SE_API-STORE", JSON.stringify(F.store.list));
7229
+ this.list[h] = e, localStorage.setItem("SE_API-STORE", JSON.stringify(K.store.list));
7216
7230
  },
7217
7231
  get: async function(h) {
7218
7232
  return this.list[h] ? this.list[h] : null;
@@ -7220,11 +7234,11 @@ const F = {
7220
7234
  list: {}
7221
7235
  }
7222
7236
  };
7223
- async function gt() {
7237
+ async function pt() {
7224
7238
  let h = localStorage.getItem("SE_API-STORE") ?? "", e = h ? JSON.parse(h) : {};
7225
- return F.store.list = e, F;
7239
+ return K.store.list = e, K;
7226
7240
  }
7227
- var B;
7241
+ var Y;
7228
7242
  ((h) => {
7229
7243
  let e;
7230
7244
  ((i) => {
@@ -7261,8 +7275,8 @@ var B;
7261
7275
  }
7262
7276
  }
7263
7277
  h.get = a;
7264
- })(B || (B = {}));
7265
- class pt extends W {
7278
+ })(Y || (Y = {}));
7279
+ class ft extends V {
7266
7280
  /**
7267
7281
  * Initializes a new ComfyJS instance and connects to Twitch chat.
7268
7282
  * @param options - Configuration options for ComfyJS instance.
@@ -7420,7 +7434,7 @@ class pt extends W {
7420
7434
  }, this.init && this.instance.Init(this.username, this.password, this.channels, this.isDebug);
7421
7435
  }
7422
7436
  }
7423
- class Z {
7437
+ class tt {
7424
7438
  constructor(e = {}) {
7425
7439
  this.error = this.apply({
7426
7440
  color: "#721c24",
@@ -7519,21 +7533,21 @@ class Z {
7519
7533
  !this.enabled || !console.timeEnd || console.timeEnd(e);
7520
7534
  }
7521
7535
  }
7522
- const $ = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(gt()), A = new Z(), Y = {
7523
- SeAPI: $,
7524
- Client: N,
7536
+ const et = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(pt()), A = new tt(), Q = {
7537
+ SeAPI: et,
7538
+ Client: M,
7525
7539
  Helper: y,
7526
7540
  Local: H,
7527
7541
  Data: E,
7528
7542
  logger: A,
7529
- modules: { EventProvider: W, useStorage: V, useQueue: Q, useLogger: Z },
7530
- actions: { Button: q, Command: O },
7531
- multistream: { useComfyJs: pt },
7532
- data: { usedStorages: _ },
7533
- pronouns: { Alejo: B }
7543
+ modules: { EventProvider: V, useStorage: G, useQueue: $, useLogger: tt },
7544
+ actions: { Button: F, Command: _ },
7545
+ multistream: { useComfyJs: ft },
7546
+ data: { usedStorages: q },
7547
+ pronouns: { Alejo: Y }
7534
7548
  };
7535
- typeof window < "u" ? window.Tixyel = Y : globalThis.Tixyel = Y;
7549
+ typeof window < "u" ? window.Tixyel = Q : globalThis.Tixyel = Q;
7536
7550
  export {
7537
- Y as default
7551
+ Q as default
7538
7552
  };
7539
7553
  //# sourceMappingURL=index.es.js.map