@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.d.ts +114 -10
- package/dist/index.es.js +1272 -889
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -1
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
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
|
-
|
|
53
|
-
class
|
|
52
|
+
const tt = [];
|
|
53
|
+
class it extends X {
|
|
54
54
|
constructor(e) {
|
|
55
|
-
super(), this.id = "default", this.loaded = !1, this.
|
|
56
|
-
|
|
57
|
-
|
|
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 && (
|
|
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
|
|
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
|
|
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
|
|
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((
|
|
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
|
|
174
|
-
i =
|
|
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
|
|
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 =
|
|
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
|
|
191
|
-
return
|
|
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
|
|
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
|
|
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
|
|
367
|
+
function ft(d, e) {
|
|
371
368
|
if (!e) return null;
|
|
372
369
|
switch (e) {
|
|
373
370
|
case "hex": {
|
|
374
|
-
const t =
|
|
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 =
|
|
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 =
|
|
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 { ...
|
|
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 =
|
|
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
|
|
405
|
+
function bt(d, e = !0) {
|
|
409
406
|
const t = (i) => Math.round(i).toString(16).padStart(2, "0");
|
|
410
|
-
let a = `#${t(
|
|
411
|
-
return e &&
|
|
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
|
|
414
|
-
|
|
415
|
-
const a = Math.max(
|
|
416
|
-
let n = 0,
|
|
417
|
-
const
|
|
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 (
|
|
420
|
-
case
|
|
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 -
|
|
421
|
+
n = ((t - d) / s + 2) / 6;
|
|
425
422
|
break;
|
|
426
423
|
case t:
|
|
427
|
-
n = ((
|
|
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(
|
|
433
|
-
l: Math.round(
|
|
429
|
+
s: Math.round(l * 100),
|
|
430
|
+
l: Math.round(c * 100)
|
|
434
431
|
};
|
|
435
432
|
}
|
|
436
|
-
function
|
|
437
|
-
|
|
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 = (
|
|
443
|
-
a = n(
|
|
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
|
|
452
|
-
const a =
|
|
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
|
|
456
|
-
|
|
457
|
-
const
|
|
458
|
-
if (!
|
|
459
|
-
|
|
460
|
-
const [
|
|
461
|
-
if (
|
|
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
|
|
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
|
-
],
|
|
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
|
-
},
|
|
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
|
-
(
|
|
1912
|
+
(d, e) => (d.some((t) => t.name === e.name) || d.push({
|
|
1916
1913
|
...e,
|
|
1917
1914
|
start: 0,
|
|
1918
1915
|
end: 0
|
|
1919
|
-
}),
|
|
1916
|
+
}), d),
|
|
1920
1917
|
[]
|
|
1921
|
-
),
|
|
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
|
-
],
|
|
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
|
|
5235
|
-
((
|
|
5236
|
-
|
|
5237
|
-
})(
|
|
5238
|
-
var
|
|
5239
|
-
((
|
|
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
|
|
5243
|
-
const
|
|
5239
|
+
function l(u, o = "cardinal") {
|
|
5240
|
+
const m = {
|
|
5244
5241
|
single: ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"],
|
|
5245
|
-
tens: [
|
|
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
|
-
},
|
|
5248
|
-
single: [
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
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)
|
|
5263
|
-
|
|
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" ?
|
|
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(`${
|
|
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 (
|
|
5319
|
+
if (u < 1e3) return k(u, o);
|
|
5272
5320
|
const j = [];
|
|
5273
|
-
let
|
|
5274
|
-
for (;
|
|
5275
|
-
j.push(
|
|
5276
|
-
let
|
|
5277
|
-
for (let U = 0; U < j.length; U++) j[U] !== 0 && (
|
|
5278
|
-
const
|
|
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 (
|
|
5331
|
+
if (o === "cardinal") {
|
|
5284
5332
|
let O = k(S, "cardinal");
|
|
5285
|
-
L && (O += ` ${L}`),
|
|
5286
|
-
} else if (U ===
|
|
5333
|
+
L && (O += ` ${L}`), P.push(O);
|
|
5334
|
+
} else if (U === J)
|
|
5287
5335
|
if (U > 0) {
|
|
5288
|
-
const z = k(S, "cardinal"), V =
|
|
5289
|
-
|
|
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
|
-
|
|
5340
|
+
P.push(z);
|
|
5293
5341
|
}
|
|
5294
5342
|
else {
|
|
5295
5343
|
let z = k(S, "cardinal");
|
|
5296
|
-
L && (z += ` ${L}`),
|
|
5344
|
+
L && (z += ` ${L}`), P.push(z);
|
|
5297
5345
|
}
|
|
5298
5346
|
}
|
|
5299
|
-
return
|
|
5347
|
+
return P.join(", ");
|
|
5300
5348
|
}
|
|
5301
|
-
n.translate =
|
|
5302
|
-
function
|
|
5303
|
-
|
|
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 =
|
|
5306
|
-
function
|
|
5307
|
-
const
|
|
5308
|
-
return Math.round(
|
|
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 =
|
|
5311
|
-
})(e =
|
|
5312
|
-
function
|
|
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
|
-
(
|
|
5315
|
-
if (
|
|
5316
|
-
const
|
|
5317
|
-
|
|
5318
|
-
} else
|
|
5319
|
-
},
|
|
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 =
|
|
5323
|
-
function
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
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
|
-
})(
|
|
5380
|
+
})(d.utils || (d.utils = {}));
|
|
5344
5381
|
let t;
|
|
5345
5382
|
((n) => {
|
|
5346
|
-
function m
|
|
5347
|
-
const p =
|
|
5383
|
+
function l(m, w, h) {
|
|
5384
|
+
const p = w.match(/^<span(?: class="[^"]*")? style="([^"]*)">(.*)<\/span>$/s);
|
|
5348
5385
|
if (p) {
|
|
5349
|
-
const
|
|
5350
|
-
let j = [
|
|
5351
|
-
return j.endsWith(";") || (j += ";"), `<span${k ? ` class="${k} ${
|
|
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
|
|
5390
|
+
return m && m.length && !m.endsWith(";") && (m += ";"), `<span${h ? ` class="${h}"` : ""}${m ? ` style="${m}"` : ""}>${w}</span>`;
|
|
5354
5391
|
}
|
|
5355
|
-
n.mergeSpanStyles =
|
|
5356
|
-
function
|
|
5357
|
-
const { return:
|
|
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
|
|
5361
|
-
if (
|
|
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 =
|
|
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 (
|
|
5366
|
-
const z =
|
|
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:
|
|
5371
|
-
height:
|
|
5407
|
+
width: J * L,
|
|
5408
|
+
height: P * L,
|
|
5372
5409
|
scale: L
|
|
5373
5410
|
};
|
|
5374
|
-
return
|
|
5411
|
+
return y || (m.style.transform = `scale(${L})`, m.style.transformOrigin = "center center"), O;
|
|
5375
5412
|
}
|
|
5376
|
-
n.scale =
|
|
5377
|
-
function
|
|
5378
|
-
const {
|
|
5379
|
-
|
|
5380
|
-
|
|
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 =
|
|
5383
|
-
let L =
|
|
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,
|
|
5387
|
-
return p === "width" ? W = Math.max(L, Math.min(z,
|
|
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 =
|
|
5390
|
-
function
|
|
5391
|
-
const p = parseFloat(getComputedStyle(
|
|
5392
|
-
minFontSize:
|
|
5393
|
-
maxFontSize:
|
|
5394
|
-
},
|
|
5395
|
-
if (!
|
|
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 =
|
|
5398
|
-
return
|
|
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 =
|
|
5401
|
-
function
|
|
5402
|
-
const p = new DOMParser().parseFromString(
|
|
5403
|
-
let
|
|
5404
|
-
function
|
|
5405
|
-
if (
|
|
5406
|
-
const U = (
|
|
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(
|
|
5409
|
-
` || L === " ") && (z.style.whiteSpace = "pre-wrap"), z.textContent = L,
|
|
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 (
|
|
5413
|
-
const
|
|
5414
|
-
return
|
|
5415
|
-
const S =
|
|
5416
|
-
(S instanceof DocumentFragment || S instanceof Node) &&
|
|
5417
|
-
}),
|
|
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
|
|
5462
|
+
return J.cloneNode(!0);
|
|
5420
5463
|
}
|
|
5421
5464
|
const k = p.body, j = document.createElement("div");
|
|
5422
|
-
k.childNodes.forEach((
|
|
5423
|
-
if (
|
|
5465
|
+
k.childNodes.forEach((J) => {
|
|
5466
|
+
if (J.nodeType === Node.TEXT_NODE && !J.textContent?.trim())
|
|
5424
5467
|
return;
|
|
5425
|
-
const
|
|
5426
|
-
(
|
|
5468
|
+
const P = C(J);
|
|
5469
|
+
(P instanceof DocumentFragment || P instanceof Node) && j.appendChild(P);
|
|
5427
5470
|
});
|
|
5428
|
-
let
|
|
5429
|
-
return Array.from(j.childNodes).forEach((
|
|
5430
|
-
|
|
5431
|
-
}),
|
|
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 =
|
|
5434
|
-
})(t =
|
|
5476
|
+
n.splitTextToChars = o;
|
|
5477
|
+
})(t = d.element || (d.element = {}));
|
|
5435
5478
|
let a;
|
|
5436
5479
|
((n) => {
|
|
5437
|
-
function
|
|
5438
|
-
const
|
|
5439
|
-
for (const
|
|
5440
|
-
if (!Object.prototype.hasOwnProperty.call(o,
|
|
5441
|
-
const
|
|
5442
|
-
if (
|
|
5443
|
-
|
|
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
|
|
5447
|
-
|
|
5489
|
+
if (typeof y == "number" && isNaN(y)) {
|
|
5490
|
+
h[C] = "NaN";
|
|
5448
5491
|
continue;
|
|
5449
5492
|
}
|
|
5450
|
-
if (typeof
|
|
5451
|
-
|
|
5493
|
+
if (typeof y == "number" && !isNaN(y)) {
|
|
5494
|
+
h[C] = m ? String(y) : y;
|
|
5452
5495
|
continue;
|
|
5453
5496
|
}
|
|
5454
|
-
if (
|
|
5455
|
-
|
|
5497
|
+
if (y instanceof Date) {
|
|
5498
|
+
h[C] = y.toISOString();
|
|
5456
5499
|
continue;
|
|
5457
5500
|
}
|
|
5458
|
-
if (
|
|
5459
|
-
|
|
5460
|
-
|
|
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(
|
|
5465
|
-
|
|
5466
|
-
const
|
|
5467
|
-
typeof
|
|
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
|
|
5472
|
-
Object.assign(
|
|
5514
|
+
if (typeof y == "object") {
|
|
5515
|
+
Object.assign(h, l(y, m, C));
|
|
5473
5516
|
continue;
|
|
5474
5517
|
}
|
|
5475
|
-
|
|
5518
|
+
h[C] = String(y);
|
|
5476
5519
|
}
|
|
5477
|
-
return
|
|
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.
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
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 ?
|
|
5490
|
-
/\s/.test(j) && /\s/.test(
|
|
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
|
-
}),
|
|
5547
|
+
}), w.sort((h, p) => h.start - p.start);
|
|
5493
5548
|
}
|
|
5494
|
-
n.findEmotesInText =
|
|
5495
|
-
function o
|
|
5496
|
-
if (!
|
|
5497
|
-
let
|
|
5498
|
-
return
|
|
5499
|
-
|
|
5500
|
-
const
|
|
5501
|
-
|
|
5502
|
-
}),
|
|
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 =
|
|
5505
|
-
function
|
|
5506
|
-
return Array.from(
|
|
5507
|
-
const p =
|
|
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
|
|
5510
|
-
|
|
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
|
-
}),
|
|
5572
|
+
}), o;
|
|
5513
5573
|
}
|
|
5514
|
-
n.replaceYoutubeEmotesWithHTML =
|
|
5515
|
-
async function
|
|
5516
|
-
if (!Array.isArray(
|
|
5517
|
-
var
|
|
5518
|
-
for await (const
|
|
5519
|
-
var
|
|
5520
|
-
!
|
|
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 (
|
|
5584
|
+
switch (m) {
|
|
5525
5585
|
case "twitch": {
|
|
5526
5586
|
p = {
|
|
5527
|
-
keys: Array.from(
|
|
5528
|
-
badges: Array.from(
|
|
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
|
|
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(
|
|
5542
|
-
(
|
|
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 =
|
|
5556
|
-
})(
|
|
5557
|
-
function
|
|
5558
|
-
var
|
|
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((
|
|
5632
|
+
].some((m) => m === c.listener) && (f = "streamelements"), { provider: f, data: c };
|
|
5567
5633
|
}
|
|
5568
|
-
n.parseProvider =
|
|
5569
|
-
})(
|
|
5634
|
+
n.parseProvider = l;
|
|
5635
|
+
})(d.event || (d.event = {})), ((n) => {
|
|
5570
5636
|
n.PRESETS = {};
|
|
5571
|
-
async function
|
|
5572
|
-
const
|
|
5573
|
-
|
|
5574
|
-
const
|
|
5575
|
-
return
|
|
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
|
|
5578
|
-
return
|
|
5643
|
+
const h = await Promise.all(w);
|
|
5644
|
+
return u.replace(o, () => h.shift() ?? "");
|
|
5579
5645
|
}
|
|
5580
|
-
n.replace =
|
|
5581
|
-
function
|
|
5582
|
-
return
|
|
5646
|
+
n.replace = l;
|
|
5647
|
+
function c(u) {
|
|
5648
|
+
return u.charAt(0).toUpperCase() + u.slice(1);
|
|
5583
5649
|
}
|
|
5584
|
-
n.capitalize =
|
|
5585
|
-
function
|
|
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:
|
|
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
|
-
...
|
|
5661
|
+
...o
|
|
5596
5662
|
};
|
|
5597
|
-
let
|
|
5663
|
+
let y = "$", C = "USD";
|
|
5598
5664
|
if (typeof window < "u")
|
|
5599
5665
|
try {
|
|
5600
|
-
const
|
|
5601
|
-
|
|
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, [
|
|
5606
|
-
if (r[
|
|
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) =>
|
|
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
|
|
5618
|
-
function
|
|
5619
|
-
const
|
|
5620
|
-
if (!
|
|
5621
|
-
const x =
|
|
5622
|
-
return isNaN(
|
|
5623
|
-
}
|
|
5624
|
-
function
|
|
5625
|
-
const x = isNaN(Number(
|
|
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,
|
|
5637
|
-
const
|
|
5638
|
-
return _ > 0 ? `${_}y ${Y}` : H > 0 ? `${H}mo ${Y}` : E > 0 ? `${E}d ${Y}` : M > 0 ? `${M}h ${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,
|
|
5706
|
+
function S(r, g, v) {
|
|
5641
5707
|
const x = r?.trim?.() ?? "";
|
|
5642
5708
|
if (!x.length) return r;
|
|
5643
|
-
const N =
|
|
5644
|
-
if (isNaN(
|
|
5645
|
-
const
|
|
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 (
|
|
5713
|
+
switch (T) {
|
|
5648
5714
|
case "time":
|
|
5649
|
-
return
|
|
5715
|
+
return I.toLocaleTimeString();
|
|
5650
5716
|
case "datetime":
|
|
5651
5717
|
case "full":
|
|
5652
|
-
return
|
|
5718
|
+
return I.toLocaleString();
|
|
5653
5719
|
case "relative":
|
|
5654
5720
|
case "ago":
|
|
5655
|
-
return U(
|
|
5721
|
+
return U(I);
|
|
5656
5722
|
case "iso":
|
|
5657
|
-
return
|
|
5723
|
+
return I.toISOString();
|
|
5658
5724
|
default:
|
|
5659
|
-
return
|
|
5725
|
+
return I.toLocaleDateString();
|
|
5660
5726
|
}
|
|
5661
5727
|
} catch {
|
|
5662
5728
|
return r;
|
|
5663
5729
|
}
|
|
5664
5730
|
}
|
|
5665
|
-
function L(r,
|
|
5666
|
-
const x = r ?? "", [N,
|
|
5731
|
+
function L(r, g, v) {
|
|
5732
|
+
const x = r ?? "", [N, I = N] = x.split("|", 2), T = g?.trim();
|
|
5667
5733
|
let M;
|
|
5668
|
-
|
|
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 ?
|
|
5736
|
+
return isNaN(E) ? N : Math.abs(E) !== 1 ? I : N;
|
|
5671
5737
|
}
|
|
5672
|
-
function O(r,
|
|
5673
|
-
const x =
|
|
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
|
|
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 (
|
|
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, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
5691
5757
|
}
|
|
5692
|
-
function V(r,
|
|
5693
|
-
let
|
|
5694
|
-
if (!
|
|
5695
|
-
const x =
|
|
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
|
|
5698
|
-
const
|
|
5699
|
-
if (
|
|
5700
|
-
if (
|
|
5701
|
-
if (/^-?\d+(\.\d+)?$/.test(
|
|
5702
|
-
const
|
|
5703
|
-
if (
|
|
5704
|
-
const M = String(
|
|
5705
|
-
return E === "true" ? !0 : E === "false" ? !1 : /^-?\d+(\.\d+)?$/.test(M) ? parseFloat(M) :
|
|
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
|
|
5711
|
-
return !(!
|
|
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,
|
|
5714
|
-
let
|
|
5715
|
-
if (!
|
|
5779
|
+
function F(r, g) {
|
|
5780
|
+
let v = r.trim();
|
|
5781
|
+
if (!v.length) return !1;
|
|
5716
5782
|
let x = !1;
|
|
5717
|
-
for (;
|
|
5718
|
-
x = !x,
|
|
5783
|
+
for (; v.startsWith("!"); )
|
|
5784
|
+
x = !x, v = v.slice(1).trim();
|
|
5719
5785
|
const N = ["===", "!==", "==", "!=", ">=", "<=", ">", "<"];
|
|
5720
|
-
let
|
|
5786
|
+
let I = null, T = v, M = "";
|
|
5721
5787
|
for (const H of N) {
|
|
5722
|
-
const _ =
|
|
5788
|
+
const _ = v.indexOf(H);
|
|
5723
5789
|
if (_ !== -1) {
|
|
5724
|
-
|
|
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 (
|
|
5730
|
-
const H = V(
|
|
5731
|
-
switch (
|
|
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(
|
|
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,
|
|
5767
|
-
let
|
|
5768
|
-
if (!
|
|
5832
|
+
function B(r, g) {
|
|
5833
|
+
let v = r.trim();
|
|
5834
|
+
if (!v.length) return !1;
|
|
5769
5835
|
let x = !1;
|
|
5770
|
-
for (;
|
|
5771
|
-
x = !x,
|
|
5772
|
-
const N =
|
|
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
|
|
5775
|
-
for (const
|
|
5776
|
-
const M =
|
|
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,
|
|
5846
|
+
const _ = F(H, g);
|
|
5781
5847
|
if (E = E && _, !E) break;
|
|
5782
5848
|
}
|
|
5783
|
-
if (
|
|
5784
|
-
}
|
|
5785
|
-
return x ? !
|
|
5786
|
-
}
|
|
5787
|
-
const
|
|
5788
|
-
COLOR: (r,
|
|
5789
|
-
WEIGHT: (r,
|
|
5790
|
-
SEMIBOLD: (r) =>
|
|
5791
|
-
BOLD: (r) =>
|
|
5792
|
-
BLACK: (r) =>
|
|
5793
|
-
LIGHT: (r) =>
|
|
5794
|
-
STRONG: (r) =>
|
|
5795
|
-
ITALIC: (r) =>
|
|
5796
|
-
UNDERLINE: (r) =>
|
|
5797
|
-
STRIKETHROUGH: (r) =>
|
|
5798
|
-
SUB: (r) =>
|
|
5799
|
-
SUP: (r) =>
|
|
5800
|
-
LARGER: (r) =>
|
|
5801
|
-
SMALL: (r) =>
|
|
5802
|
-
SHADOW: (r,
|
|
5803
|
-
SIZE: (r,
|
|
5804
|
-
},
|
|
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) =>
|
|
5807
|
-
BT0: (r) =>
|
|
5808
|
-
ST1: (r) =>
|
|
5809
|
-
ST0: (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,
|
|
5815
|
-
PLURAL: (r,
|
|
5816
|
-
DATE: (r,
|
|
5817
|
-
MAP: (r,
|
|
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,
|
|
5820
|
-
const x = r ?? "", [N,
|
|
5821
|
-
if (!
|
|
5822
|
-
const [
|
|
5823
|
-
return B(
|
|
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,
|
|
5826
|
-
const
|
|
5827
|
-
if (!
|
|
5828
|
-
const x = n.PRESETS[
|
|
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((
|
|
5831
|
-
const [M, E] =
|
|
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
|
|
5835
|
-
for (const { name:
|
|
5836
|
-
|
|
5837
|
-
return
|
|
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,
|
|
5908
|
+
FALLBACK: (r, g) => r.length ? r : g ?? r
|
|
5840
5909
|
},
|
|
5841
|
-
...
|
|
5842
|
-
...
|
|
5843
|
-
},
|
|
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
|
-
...
|
|
5940
|
+
...m.aliases ?? {}
|
|
5872
5941
|
};
|
|
5873
|
-
function K(r,
|
|
5874
|
-
const x = Object.entries(
|
|
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
|
|
5877
|
-
} catch (
|
|
5878
|
-
return
|
|
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
|
|
5882
|
-
let
|
|
5883
|
-
for (; (
|
|
5884
|
-
const [x, N,
|
|
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 =
|
|
5889
|
-
for (const { name: E, param: H } of
|
|
5957
|
+
let M = nt(I);
|
|
5958
|
+
for (const { name: E, param: H } of T)
|
|
5890
5959
|
M = K(M, E, H);
|
|
5891
|
-
|
|
5892
|
-
}
|
|
5893
|
-
return
|
|
5894
|
-
}
|
|
5895
|
-
function
|
|
5896
|
-
let
|
|
5897
|
-
const
|
|
5898
|
-
function x(
|
|
5899
|
-
let
|
|
5900
|
-
for (;
|
|
5901
|
-
if (r[
|
|
5902
|
-
|
|
5903
|
-
else if (r[
|
|
5904
|
-
|
|
5905
|
-
else if (
|
|
5906
|
-
|
|
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
|
-
|
|
5910
|
-
return
|
|
5978
|
+
T += r[g++];
|
|
5979
|
+
return T;
|
|
5911
5980
|
}
|
|
5912
5981
|
function N() {
|
|
5913
|
-
|
|
5914
|
-
const
|
|
5915
|
-
for (;
|
|
5916
|
-
if (r[
|
|
5917
|
-
|
|
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 (;
|
|
5990
|
+
for (; g < v && /[A-Za-z0-9]/.test(r[g]); ) M += r[g++];
|
|
5922
5991
|
let E = null;
|
|
5923
|
-
if (r[
|
|
5924
|
-
|
|
5925
|
-
const H =
|
|
5926
|
-
for (;
|
|
5927
|
-
E = r.slice(H,
|
|
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 &&
|
|
5998
|
+
M.length && I.push({ name: M, param: E }), r[g] === "," && g++;
|
|
5930
5999
|
}
|
|
5931
|
-
r[
|
|
5932
|
-
const
|
|
5933
|
-
return
|
|
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 $ =
|
|
6006
|
+
let $ = u.replace(
|
|
5938
6007
|
j.PLACEHOLDERS,
|
|
5939
|
-
(r,
|
|
6008
|
+
(r, g) => typeof k[g] == "string" || typeof k[g] == "number" ? String(k[g]) : g ?? g
|
|
5940
6009
|
);
|
|
5941
|
-
return $ =
|
|
6010
|
+
return $ = m.method === "loop" ? nt($) : Q($), $;
|
|
5942
6011
|
}
|
|
5943
|
-
n.compose =
|
|
5944
|
-
})(
|
|
6012
|
+
n.compose = f;
|
|
6013
|
+
})(d.string || (d.string = {})), ((n) => {
|
|
5945
6014
|
n.playing = !1;
|
|
5946
|
-
function
|
|
5947
|
-
if (!
|
|
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
|
-
|
|
5951
|
-
let
|
|
5952
|
-
|
|
5953
|
-
if (
|
|
5954
|
-
const
|
|
5955
|
-
|
|
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 (
|
|
5959
|
-
throw new Error(`Error playing sound: ${
|
|
6027
|
+
} catch (o) {
|
|
6028
|
+
throw new Error(`Error playing sound: ${o}`);
|
|
5960
6029
|
}
|
|
5961
6030
|
}
|
|
5962
|
-
n.play =
|
|
5963
|
-
})(
|
|
6031
|
+
n.play = l;
|
|
6032
|
+
})(d.sound || (d.sound = {}));
|
|
5964
6033
|
let i;
|
|
5965
6034
|
((n) => {
|
|
5966
|
-
function
|
|
5967
|
-
|
|
5968
|
-
let
|
|
5969
|
-
return
|
|
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 =
|
|
5972
|
-
function o
|
|
5973
|
-
if (!
|
|
6040
|
+
n.opacity = l;
|
|
6041
|
+
function c(o) {
|
|
6042
|
+
if (!o.startsWith("#") || o.length <= 7)
|
|
5974
6043
|
return {
|
|
5975
|
-
color:
|
|
6044
|
+
color: o,
|
|
5976
6045
|
opacity: 100
|
|
5977
6046
|
};
|
|
5978
|
-
var
|
|
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:
|
|
5981
|
-
opacity:
|
|
6049
|
+
color: h,
|
|
6050
|
+
opacity: w
|
|
5982
6051
|
};
|
|
5983
6052
|
}
|
|
5984
|
-
n.extract =
|
|
5985
|
-
function
|
|
5986
|
-
if (typeof
|
|
5987
|
-
const
|
|
5988
|
-
return /^#([A-Fa-f0-9]{3}){1,2}$/.test(
|
|
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 =
|
|
5991
|
-
async function
|
|
5992
|
-
const
|
|
5993
|
-
if (!
|
|
5994
|
-
if (
|
|
5995
|
-
const
|
|
5996
|
-
if (!
|
|
5997
|
-
switch (
|
|
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
|
|
6068
|
+
return bt(h, !1);
|
|
6000
6069
|
case "rgb":
|
|
6001
|
-
return `rgb(${
|
|
6070
|
+
return `rgb(${h.r}, ${h.g}, ${h.b})`;
|
|
6002
6071
|
case "rgba":
|
|
6003
|
-
return `rgba(${
|
|
6072
|
+
return `rgba(${h.r}, ${h.g}, ${h.b}, ${h.a})`;
|
|
6004
6073
|
case "hsl": {
|
|
6005
|
-
const p =
|
|
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 =
|
|
6010
|
-
return `hsla(${p.h}, ${p.s}%, ${p.l}%, ${
|
|
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
|
|
6082
|
+
return await wt(h.r, h.g, h.b);
|
|
6014
6083
|
default:
|
|
6015
6084
|
return null;
|
|
6016
6085
|
}
|
|
6017
6086
|
}
|
|
6018
|
-
n.convert =
|
|
6019
|
-
})(i =
|
|
6087
|
+
n.convert = u;
|
|
6088
|
+
})(i = d.color || (d.color = {}));
|
|
6020
6089
|
let s;
|
|
6021
6090
|
((n) => {
|
|
6022
|
-
function
|
|
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
|
|
6029
|
-
return
|
|
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
|
|
6033
|
-
return `rgb(${
|
|
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
|
|
6037
|
-
return `rgba(${
|
|
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
|
|
6041
|
-
return `hsl(${
|
|
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
|
|
6045
|
-
return `hsla(${
|
|
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
|
|
6049
|
-
return
|
|
6117
|
+
var y = A.css_color_names;
|
|
6118
|
+
return o(y)[0];
|
|
6050
6119
|
}
|
|
6051
6120
|
}
|
|
6052
6121
|
}
|
|
6053
|
-
n.color =
|
|
6054
|
-
function
|
|
6055
|
-
p >
|
|
6056
|
-
const k = Math.random() * (
|
|
6057
|
-
return
|
|
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 =
|
|
6060
|
-
function
|
|
6128
|
+
n.number = c;
|
|
6129
|
+
function f(p = 0.5) {
|
|
6061
6130
|
return Math.random() > p;
|
|
6062
6131
|
}
|
|
6063
|
-
n.boolean =
|
|
6064
|
-
function
|
|
6065
|
-
let
|
|
6132
|
+
n.boolean = f;
|
|
6133
|
+
function u(p, y = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") {
|
|
6134
|
+
let C = "";
|
|
6066
6135
|
for (let k = 0; k < p; k++)
|
|
6067
|
-
|
|
6068
|
-
return
|
|
6136
|
+
C += y.charAt(Math.floor(Math.random() * y.length));
|
|
6137
|
+
return C;
|
|
6069
6138
|
}
|
|
6070
|
-
n.string =
|
|
6071
|
-
function
|
|
6072
|
-
const
|
|
6073
|
-
return [p[
|
|
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 =
|
|
6076
|
-
function
|
|
6077
|
-
return new Date(
|
|
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 =
|
|
6080
|
-
function
|
|
6081
|
-
const
|
|
6082
|
-
return new Date(
|
|
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 =
|
|
6085
|
-
function
|
|
6153
|
+
n.daysOffset = w;
|
|
6154
|
+
function h() {
|
|
6086
6155
|
return crypto.randomUUID();
|
|
6087
6156
|
}
|
|
6088
|
-
n.uuid =
|
|
6089
|
-
})(s =
|
|
6090
|
-
|
|
6091
|
-
|
|
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
|
|
6174
|
+
return b.utils.typedValues(e).reduce(
|
|
6097
6175
|
(a, i, s) => {
|
|
6098
|
-
const n =
|
|
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:
|
|
6179
|
+
label: l
|
|
6102
6180
|
};
|
|
6103
|
-
let
|
|
6104
|
-
return isNaN(Number(
|
|
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
|
|
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
|
-
((
|
|
6146
|
-
|
|
6223
|
+
((d) => {
|
|
6224
|
+
d.generate = {
|
|
6147
6225
|
session: {
|
|
6148
6226
|
types: {
|
|
6149
|
-
name: { type: "string", options:
|
|
6150
|
-
tier: { type: "string", options:
|
|
6151
|
-
message: { type: "string", options:
|
|
6152
|
-
item: { type: "array", options:
|
|
6153
|
-
avatar: { type: "string", options:
|
|
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": {
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
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": {
|
|
6249
|
-
|
|
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: {
|
|
6262
|
-
|
|
6263
|
-
|
|
6264
|
-
|
|
6265
|
-
|
|
6266
|
-
"session-top-
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
|
|
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": {
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
"
|
|
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": {
|
|
6295
|
-
|
|
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": {
|
|
6309
|
-
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
"
|
|
6313
|
-
|
|
6314
|
-
|
|
6315
|
-
|
|
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": {
|
|
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": {
|
|
6357
|
-
|
|
6358
|
-
|
|
6359
|
-
|
|
6360
|
-
"
|
|
6361
|
-
|
|
6362
|
-
|
|
6363
|
-
|
|
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: {
|
|
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
|
|
6403
|
-
if (!
|
|
6404
|
-
const
|
|
6405
|
-
for (let
|
|
6406
|
-
|
|
6407
|
-
return
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
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
|
|
6415
|
-
},
|
|
6416
|
-
if (!
|
|
6417
|
-
switch (
|
|
6616
|
+
return o;
|
|
6617
|
+
}, f = (u) => {
|
|
6618
|
+
if (!u) return u;
|
|
6619
|
+
switch (u.type) {
|
|
6418
6620
|
case "int":
|
|
6419
|
-
return
|
|
6621
|
+
return b.random.number(u.min, u.max);
|
|
6420
6622
|
case "string":
|
|
6421
|
-
return
|
|
6623
|
+
return b.random.array(u.options)[0];
|
|
6422
6624
|
case "date":
|
|
6423
|
-
return
|
|
6625
|
+
return b.random.daysOffset(u.range);
|
|
6424
6626
|
case "array":
|
|
6425
|
-
return
|
|
6627
|
+
return b.random.array(u.options)[0];
|
|
6426
6628
|
case "recent":
|
|
6427
|
-
return
|
|
6629
|
+
return l(u);
|
|
6428
6630
|
default:
|
|
6429
|
-
return
|
|
6631
|
+
return u;
|
|
6430
6632
|
}
|
|
6431
6633
|
};
|
|
6432
|
-
return typeof n != "object" || n === null ? n : "type" in n && typeof n.type == "string" ?
|
|
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, [
|
|
6436
|
-
([
|
|
6637
|
+
(n, [l, c]) => (Object.entries(c).forEach(
|
|
6638
|
+
([f, u]) => (
|
|
6437
6639
|
//
|
|
6438
|
-
n[`${
|
|
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
|
|
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,
|
|
6500
|
-
t["cheer-latest"] = { name:
|
|
6501
|
-
const
|
|
6502
|
-
if (
|
|
6503
|
-
|
|
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
|
|
6507
|
-
|
|
6508
|
-
const
|
|
6509
|
-
|
|
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
|
-
|
|
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({
|
|
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,
|
|
6521
|
-
if (t["subscriber-latest"] = { name: n, amount:
|
|
6522
|
-
|
|
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:
|
|
6526
|
-
tier:
|
|
6527
|
-
message:
|
|
6528
|
-
sender:
|
|
6529
|
-
}, t["subscriber-gifted-session"].count += 1, t["subscriber-alltime-gifter"] = { name:
|
|
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 +=
|
|
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,
|
|
6536
|
-
t["raid-latest"] = { name: n, amount:
|
|
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,
|
|
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:
|
|
6550
|
-
_id:
|
|
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
|
|
6558
|
-
if (
|
|
6559
|
-
|
|
6781
|
+
const c = (f) => {
|
|
6782
|
+
if (f === "all") {
|
|
6783
|
+
c("alltime"), c("monthly"), c("weekly"), c("session");
|
|
6560
6784
|
return;
|
|
6561
6785
|
}
|
|
6562
|
-
const
|
|
6563
|
-
|
|
6564
|
-
const
|
|
6565
|
-
|
|
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
|
-
|
|
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:
|
|
6571
|
-
_id:
|
|
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,
|
|
6585
|
-
t["tip-latest"] = { name: n, amount:
|
|
6586
|
-
const
|
|
6587
|
-
if (
|
|
6588
|
-
|
|
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
|
|
6592
|
-
|
|
6593
|
-
const
|
|
6594
|
-
|
|
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
|
-
|
|
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: [
|
|
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 =
|
|
6631
|
-
|
|
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
|
|
6638
|
-
|
|
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
|
|
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:
|
|
6890
|
+
time: y,
|
|
6648
6891
|
tags: {
|
|
6649
|
-
"badge-info": `${
|
|
6650
|
-
badges:
|
|
6651
|
-
mod:
|
|
6652
|
-
subscriber:
|
|
6653
|
-
turbo:
|
|
6654
|
-
"tmi-sent-ts":
|
|
6655
|
-
"user-id":
|
|
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:
|
|
6658
|
-
"display-name":
|
|
6900
|
+
color: w,
|
|
6901
|
+
"display-name": c,
|
|
6659
6902
|
emotes: "",
|
|
6660
|
-
"client-nonce":
|
|
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:
|
|
6667
|
-
displayName:
|
|
6668
|
-
displayColor:
|
|
6669
|
-
channel:
|
|
6670
|
-
text:
|
|
6909
|
+
nick: c.toLowerCase(),
|
|
6910
|
+
displayName: c,
|
|
6911
|
+
displayColor: w,
|
|
6912
|
+
channel: C,
|
|
6913
|
+
text: f,
|
|
6671
6914
|
isAction: !1,
|
|
6672
|
-
userId:
|
|
6915
|
+
userId: h,
|
|
6673
6916
|
msgId: p,
|
|
6674
|
-
badges:
|
|
6675
|
-
emotes:
|
|
6917
|
+
badges: u.badges,
|
|
6918
|
+
emotes: o
|
|
6676
6919
|
},
|
|
6677
|
-
renderedText:
|
|
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 ??
|
|
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:
|
|
6692
|
-
displayName:
|
|
6693
|
-
message:
|
|
6934
|
+
name: c.toLowerCase(),
|
|
6935
|
+
displayName: c,
|
|
6936
|
+
message: f,
|
|
6694
6937
|
providerId: "",
|
|
6695
|
-
_id:
|
|
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 ??
|
|
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:
|
|
6713
|
-
displayName:
|
|
6955
|
+
name: c.toLowerCase(),
|
|
6956
|
+
displayName: c,
|
|
6714
6957
|
providerId: "",
|
|
6715
|
-
_id:
|
|
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 ??
|
|
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:
|
|
6734
|
-
displayName:
|
|
6976
|
+
name: c.toLowerCase(),
|
|
6977
|
+
displayName: c,
|
|
6735
6978
|
providerId: "",
|
|
6736
|
-
_id:
|
|
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
|
|
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:
|
|
6997
|
+
sender: J,
|
|
6755
6998
|
gifted: !0
|
|
6756
6999
|
},
|
|
6757
7000
|
community: {
|
|
6758
|
-
message:
|
|
6759
|
-
sender:
|
|
7001
|
+
message: f,
|
|
7002
|
+
sender: J,
|
|
6760
7003
|
bulkGifted: !0
|
|
6761
7004
|
},
|
|
6762
7005
|
spam: {
|
|
6763
|
-
sender:
|
|
7006
|
+
sender: J,
|
|
6764
7007
|
gifted: !0,
|
|
6765
7008
|
isCommunityGift: !0
|
|
6766
7009
|
}
|
|
6767
|
-
}, U = ["default", "gift", "community", "spam"], S = i?.subType ??
|
|
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:
|
|
6773
|
-
displayName:
|
|
7015
|
+
name: c.toLowerCase(),
|
|
7016
|
+
displayName: c,
|
|
6774
7017
|
providerId: "",
|
|
6775
|
-
tier:
|
|
6776
|
-
...
|
|
6777
|
-
...
|
|
6778
|
-
_id:
|
|
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 ??
|
|
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 ??
|
|
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
|
|
6814
|
-
|
|
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 ??
|
|
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:
|
|
6825
|
-
displayName:
|
|
7069
|
+
name: c.toLowerCase(),
|
|
7070
|
+
displayName: c,
|
|
6826
7071
|
providerId: "",
|
|
6827
|
-
_id:
|
|
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 ??
|
|
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
|
|
6891
|
-
|
|
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
|
|
6895
|
-
const V = await
|
|
6896
|
-
|
|
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:
|
|
7158
|
+
authorChannelId: C,
|
|
6909
7159
|
publishedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6910
7160
|
hasDisplayContent: !0,
|
|
6911
|
-
displayMessage:
|
|
7161
|
+
displayMessage: f,
|
|
6912
7162
|
textMessageDetails: {
|
|
6913
|
-
messageText:
|
|
7163
|
+
messageText: f
|
|
6914
7164
|
}
|
|
6915
7165
|
},
|
|
6916
7166
|
authorDetails: {
|
|
6917
|
-
channelId:
|
|
7167
|
+
channelId: C,
|
|
6918
7168
|
channelUrl: "",
|
|
6919
|
-
displayName:
|
|
7169
|
+
displayName: c,
|
|
6920
7170
|
profileImageUrl: j,
|
|
6921
7171
|
...V
|
|
6922
7172
|
},
|
|
6923
7173
|
msgId: p,
|
|
6924
|
-
userId:
|
|
6925
|
-
nick:
|
|
7174
|
+
userId: h,
|
|
7175
|
+
nick: c.toLowerCase(),
|
|
6926
7176
|
badges: [],
|
|
6927
|
-
displayName:
|
|
7177
|
+
displayName: c,
|
|
6928
7178
|
isAction: !1,
|
|
6929
|
-
time:
|
|
7179
|
+
time: y,
|
|
6930
7180
|
tags: [],
|
|
6931
|
-
displayColor:
|
|
6932
|
-
channel:
|
|
6933
|
-
text:
|
|
7181
|
+
displayColor: w,
|
|
7182
|
+
channel: C,
|
|
7183
|
+
text: f,
|
|
6934
7184
|
avatar: j,
|
|
6935
7185
|
emotes: []
|
|
6936
7186
|
},
|
|
6937
|
-
renderedText:
|
|
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 ??
|
|
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:
|
|
6951
|
-
name:
|
|
7200
|
+
displayName: c,
|
|
7201
|
+
name: c.toLowerCase(),
|
|
6952
7202
|
providerId: "",
|
|
6953
|
-
_id:
|
|
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 ??
|
|
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:
|
|
6972
|
-
displayName:
|
|
7221
|
+
name: c.toLowerCase(),
|
|
7222
|
+
displayName: c,
|
|
6973
7223
|
providerId: "",
|
|
6974
|
-
_id:
|
|
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
|
|
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:
|
|
7242
|
+
sender: J,
|
|
6993
7243
|
gifted: !0
|
|
6994
7244
|
},
|
|
6995
7245
|
community: {
|
|
6996
|
-
message:
|
|
6997
|
-
sender:
|
|
7246
|
+
message: f,
|
|
7247
|
+
sender: J,
|
|
6998
7248
|
bulkGifted: !0
|
|
6999
7249
|
},
|
|
7000
7250
|
spam: {
|
|
7001
|
-
sender:
|
|
7251
|
+
sender: J,
|
|
7002
7252
|
gifted: !0,
|
|
7003
7253
|
isCommunityGift: !0
|
|
7004
7254
|
}
|
|
7005
|
-
}, U = ["default", "gift", "community", "spam"], S = i?.subType ??
|
|
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:
|
|
7011
|
-
displayName:
|
|
7260
|
+
name: c.toLowerCase(),
|
|
7261
|
+
displayName: c,
|
|
7012
7262
|
providerId: "",
|
|
7013
|
-
...
|
|
7014
|
-
...
|
|
7015
|
-
_id:
|
|
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
|
-
},
|
|
7279
|
+
}, d.emulate = {
|
|
7030
7280
|
twitch: {
|
|
7031
7281
|
message(t = {}) {
|
|
7032
|
-
|
|
7033
|
-
|
|
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
|
-
|
|
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
|
-
|
|
7308
|
+
d.emulate.send("onEventReceived", a);
|
|
7055
7309
|
},
|
|
7056
7310
|
follower(t = {}) {
|
|
7057
|
-
|
|
7058
|
-
|
|
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
|
-
|
|
7063
|
-
|
|
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
|
-
|
|
7068
|
-
|
|
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
|
-
|
|
7073
|
-
|
|
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
|
-
|
|
7080
|
-
|
|
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
|
-
|
|
7087
|
-
|
|
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
|
-
|
|
7092
|
-
|
|
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
|
-
|
|
7097
|
-
|
|
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
|
-
|
|
7102
|
-
|
|
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 (!
|
|
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
|
-
|
|
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
|
-
|
|
7413
|
+
d.queue.enqueue({
|
|
7124
7414
|
listener: t,
|
|
7125
7415
|
data: a
|
|
7126
7416
|
});
|
|
7127
7417
|
break;
|
|
7128
7418
|
}
|
|
7129
7419
|
case "onWidgetLoad": {
|
|
7130
|
-
|
|
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((
|
|
7431
|
+
fields: t.find((l) => {
|
|
7142
7432
|
try {
|
|
7143
|
-
return new URL("./" +
|
|
7433
|
+
return new URL("./" + l, window.location.href), !0;
|
|
7144
7434
|
} catch {
|
|
7145
7435
|
return !1;
|
|
7146
7436
|
}
|
|
7147
7437
|
}),
|
|
7148
|
-
data: a.find((
|
|
7438
|
+
data: a.find((l) => {
|
|
7149
7439
|
try {
|
|
7150
|
-
return new URL("./" +
|
|
7440
|
+
return new URL("./" + l, window.location.href), !0;
|
|
7151
7441
|
} catch {
|
|
7152
7442
|
return !1;
|
|
7153
7443
|
}
|
|
7154
7444
|
})
|
|
7155
|
-
}, n = await fetch(
|
|
7156
|
-
|
|
7157
|
-
|
|
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((
|
|
7161
|
-
const
|
|
7162
|
-
(
|
|
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
|
-
),
|
|
7167
|
-
|
|
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
|
-
|
|
7466
|
+
d.start = e;
|
|
7171
7467
|
})(q || (q = {}));
|
|
7172
|
-
class
|
|
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
|
|
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(
|
|
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 (
|
|
7281
|
-
const { detail: e } =
|
|
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!",
|
|
7297
|
-
const a =
|
|
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(
|
|
7302
|
-
|
|
7303
|
-
|
|
7304
|
-
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
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
|
|
7310
|
-
}, s = i(a.user || {}), n = i(a.avatar || {}),
|
|
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:
|
|
7315
|
-
emote:
|
|
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", (
|
|
7326
|
-
const { detail: e } =
|
|
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:
|
|
7680
|
+
}), window.addEventListener("onEventReceived", ({ detail: d }) => {
|
|
7332
7681
|
if (window.client instanceof G) {
|
|
7333
|
-
const t =
|
|
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
|
-
|
|
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(
|
|
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,
|
|
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,
|
|
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(
|
|
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
|
|
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(
|
|
7828
|
+
sendMessage(d, e) {
|
|
7468
7829
|
},
|
|
7469
7830
|
counters: {
|
|
7470
|
-
get(
|
|
7831
|
+
get(d) {
|
|
7471
7832
|
return null;
|
|
7472
7833
|
}
|
|
7473
7834
|
},
|
|
7474
|
-
sanitize(
|
|
7475
|
-
return
|
|
7835
|
+
sanitize(d) {
|
|
7836
|
+
return d;
|
|
7476
7837
|
},
|
|
7477
|
-
cheerFilter(
|
|
7478
|
-
return
|
|
7838
|
+
cheerFilter(d) {
|
|
7839
|
+
return d;
|
|
7479
7840
|
},
|
|
7480
|
-
setField(
|
|
7841
|
+
setField(d, e, t) {
|
|
7481
7842
|
},
|
|
7482
7843
|
store: {
|
|
7483
|
-
set: function(
|
|
7484
|
-
this.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(
|
|
7487
|
-
return this.list[
|
|
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
|
|
7493
|
-
let
|
|
7494
|
-
return
|
|
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
|
|
7497
|
-
((
|
|
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 =
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
7533
|
-
})(
|
|
7534
|
-
class
|
|
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(
|
|
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
|
-
},
|
|
7937
|
+
}, l = {
|
|
7575
7938
|
name: e,
|
|
7576
7939
|
message: `!${t} ${a}`,
|
|
7577
|
-
badges: Object.entries(n).map(([
|
|
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(
|
|
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(([
|
|
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
|
|
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:
|
|
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(
|
|
7646
|
-
|
|
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:
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
|
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 = [],
|
|
7760
|
-
if (i.forEach((
|
|
7761
|
-
typeof
|
|
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
|
|
7764
|
-
console.log(`%c${s.endsWith(" ") ? s : s.trim() + " "}${a}${
|
|
7765
|
-
} else
|
|
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
|
|
7792
|
-
SeAPI:
|
|
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:
|
|
8177
|
+
Helper: b,
|
|
7795
8178
|
Local: q,
|
|
7796
|
-
Data:
|
|
8179
|
+
Data: A,
|
|
7797
8180
|
logger: R,
|
|
7798
|
-
modules: { EventProvider:
|
|
7799
|
-
actions: { Button:
|
|
7800
|
-
multistream: { useComfyJs:
|
|
7801
|
-
data: { usedStorages: tt },
|
|
7802
|
-
pronouns: { Alejo:
|
|
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 =
|
|
8187
|
+
typeof window < "u" ? window.Tixyel = mt : globalThis.Tixyel = mt;
|
|
7805
8188
|
export {
|
|
7806
|
-
|
|
8189
|
+
mt as default
|
|
7807
8190
|
};
|
|
7808
8191
|
//# sourceMappingURL=index.es.js.map
|