@tixyel/streamelements 6.4.3 → 6.4.4
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 +17 -1
- package/dist/index.es.js +647 -630
- 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 +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class Z {
|
|
2
2
|
constructor() {
|
|
3
3
|
this.registeredEvents = {};
|
|
4
4
|
}
|
|
@@ -49,10 +49,10 @@ class X {
|
|
|
49
49
|
return this.registeredEvents[e] = [], this;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
const
|
|
53
|
-
class
|
|
52
|
+
const et = [];
|
|
53
|
+
class at extends Z {
|
|
54
54
|
constructor(e) {
|
|
55
|
-
super(), this.SE_API = null, this.id = "default", this.loaded = !1, this.id = e.id || this.id, this.data = e.data ?? {},
|
|
55
|
+
super(), this.SE_API = null, this.id = "default", this.loaded = !1, this.id = e.id || this.id, this.data = e.data ?? {}, et.push(this), ct?.then((t) => {
|
|
56
56
|
this.SE_API = t, t.store.get(this.id).then((a) => {
|
|
57
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);
|
|
58
58
|
}).catch(() => {
|
|
@@ -83,7 +83,7 @@ class it extends X {
|
|
|
83
83
|
* @param value Value to add
|
|
84
84
|
*/
|
|
85
85
|
add(e, t) {
|
|
86
|
-
this.loaded && (
|
|
86
|
+
this.loaded && (at.setByPath(this.data, e, t), this.save(this.data));
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
89
|
* Clears all data from the storage.
|
|
@@ -109,7 +109,7 @@ class it extends X {
|
|
|
109
109
|
return e === "load" && this.loaded ? (t.apply(this, [this.data]), this) : (super.on(e, t), this);
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
class
|
|
112
|
+
class G extends Z {
|
|
113
113
|
constructor(e) {
|
|
114
114
|
super(), this.id = "default", this.debug = !1, this.fields = {}, this.loaded = !1, this.actions = {
|
|
115
115
|
commands: [],
|
|
@@ -118,7 +118,7 @@ class q extends X {
|
|
|
118
118
|
avatar: 30,
|
|
119
119
|
pronoun: 60,
|
|
120
120
|
emote: 120
|
|
121
|
-
}, this.id = e.id || this.id, this.storage = new
|
|
121
|
+
}, this.id = e.id || this.id, this.storage = new at({
|
|
122
122
|
id: this.id,
|
|
123
123
|
data: {
|
|
124
124
|
user: {},
|
|
@@ -151,9 +151,9 @@ class q extends X {
|
|
|
151
151
|
]), this) : (super.on(e, t), this);
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
-
class
|
|
154
|
+
class $ {
|
|
155
155
|
constructor(e) {
|
|
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
|
|
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"));
|
|
157
157
|
}
|
|
158
158
|
run(e, t) {
|
|
159
159
|
}
|
|
@@ -163,7 +163,7 @@ class Z {
|
|
|
163
163
|
) || this.permissions.includes("*")));
|
|
164
164
|
}
|
|
165
165
|
parse(e, t) {
|
|
166
|
-
if (!(window.client instanceof
|
|
166
|
+
if (!(window.client instanceof G)) return !1;
|
|
167
167
|
const a = e.replace(this.prefix, "").split(" ").slice(1).map((c) => c.trim());
|
|
168
168
|
var i = "", s = [];
|
|
169
169
|
const n = { bits: "cheer", premium: "prime" };
|
|
@@ -190,12 +190,12 @@ class Z {
|
|
|
190
190
|
return m === !0 && this.run.apply(window.client, [a, t]), m;
|
|
191
191
|
}
|
|
192
192
|
remove() {
|
|
193
|
-
if (!(window.client instanceof
|
|
193
|
+
if (!(window.client instanceof G)) return;
|
|
194
194
|
const e = window.client.actions.commands.indexOf(this);
|
|
195
195
|
e > -1 && (window.client.actions.commands.splice(e, 1), window.client.emit("action", this, "removed"));
|
|
196
196
|
}
|
|
197
197
|
static execute(e) {
|
|
198
|
-
if (!(window.client instanceof
|
|
198
|
+
if (!(window.client instanceof G)) return !1;
|
|
199
199
|
const t = e.data;
|
|
200
200
|
try {
|
|
201
201
|
if (window.client.actions.commands.length && window.client.actions.commands.some((a) => t.event.data.text.startsWith(a.prefix))) {
|
|
@@ -203,9 +203,9 @@ class Z {
|
|
|
203
203
|
var s = [i.name, ...i.aliases ?? []], n = t.event.data.text.replace(i.prefix, "").split(" ")[0];
|
|
204
204
|
return s.includes(n);
|
|
205
205
|
});
|
|
206
|
-
if (a.length && a.every((i) => i instanceof
|
|
206
|
+
if (a.length && a.every((i) => i instanceof $))
|
|
207
207
|
return a.forEach((i) => {
|
|
208
|
-
i.parse(t.event.data.text, e), window?.client?.emit("action", i, "executed"),
|
|
208
|
+
i.parse(t.event.data.text, e), window?.client?.emit("action", i, "executed"), R.received(
|
|
209
209
|
`Command executed: ${t.event.data.text} by ${t.event.data.nick || t.event.data.displayName}`,
|
|
210
210
|
t
|
|
211
211
|
);
|
|
@@ -369,7 +369,7 @@ const ut = [
|
|
|
369
369
|
"yellowgreen",
|
|
370
370
|
"transparent"
|
|
371
371
|
];
|
|
372
|
-
function
|
|
372
|
+
function bt(l, e) {
|
|
373
373
|
if (!e) return null;
|
|
374
374
|
switch (e) {
|
|
375
375
|
case "hex": {
|
|
@@ -392,7 +392,7 @@ function ft(l, e) {
|
|
|
392
392
|
const t = l.match(/hsla?\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%(?:\s*,\s*([\d.]+))?\s*\)/);
|
|
393
393
|
if (!t) return null;
|
|
394
394
|
const a = parseInt(t[1]), i = parseInt(t[2]), s = parseInt(t[3]), n = t[4] ? parseFloat(t[4]) : 1;
|
|
395
|
-
return { ...
|
|
395
|
+
return { ...wt(a, i, s), a: n };
|
|
396
396
|
}
|
|
397
397
|
case "css-color-name": {
|
|
398
398
|
const t = document.createElement("canvas");
|
|
@@ -407,7 +407,7 @@ function ft(l, e) {
|
|
|
407
407
|
return null;
|
|
408
408
|
}
|
|
409
409
|
}
|
|
410
|
-
function
|
|
410
|
+
function yt(l, e = !0) {
|
|
411
411
|
const t = (i) => Math.round(i).toString(16).padStart(2, "0");
|
|
412
412
|
let a = `#${t(l.r)}${t(l.g)}${t(l.b)}`;
|
|
413
413
|
return e && l.a < 1 && (a += t(l.a * 255)), a;
|
|
@@ -435,7 +435,7 @@ function lt(l, e, t) {
|
|
|
435
435
|
l: Math.round(c * 100)
|
|
436
436
|
};
|
|
437
437
|
}
|
|
438
|
-
function
|
|
438
|
+
function wt(l, e, t) {
|
|
439
439
|
l /= 360, e /= 100, t /= 100;
|
|
440
440
|
let a, i, s;
|
|
441
441
|
if (e === 0)
|
|
@@ -450,7 +450,7 @@ function yt(l, e, t) {
|
|
|
450
450
|
b: Math.round(s * 255)
|
|
451
451
|
};
|
|
452
452
|
}
|
|
453
|
-
async function
|
|
453
|
+
async function vt(l, e, t) {
|
|
454
454
|
const a = ut;
|
|
455
455
|
let i = a[0], s = 1 / 0;
|
|
456
456
|
for await (const n of a) {
|
|
@@ -459,12 +459,12 @@ async function wt(l, e, t) {
|
|
|
459
459
|
const c = m.getContext("2d");
|
|
460
460
|
if (!c) continue;
|
|
461
461
|
c.fillStyle = n, c.fillRect(0, 0, 1, 1);
|
|
462
|
-
const [b, p, o] = c.getImageData(0, 0, 1, 1).data,
|
|
463
|
-
if (
|
|
462
|
+
const [b, p, o] = c.getImageData(0, 0, 1, 1).data, d = Math.sqrt(Math.pow(l - b, 2) + Math.pow(e - p, 2) + Math.pow(t - o, 2));
|
|
463
|
+
if (d < s && (s = d, i = n), d === 0) break;
|
|
464
464
|
}
|
|
465
465
|
return i;
|
|
466
466
|
}
|
|
467
|
-
const
|
|
467
|
+
const kt = [
|
|
468
468
|
"https://static-cdn.jtvnw.net/user-default-pictures-uv/13e5fa74-defa-11e9-809c-784f43822e80-profile_image-300x300.png",
|
|
469
469
|
"https://static-cdn.jtvnw.net/user-default-pictures-uv/dbdc9198-def8-11e9-8681-784f43822e80-profile_image-300x300.png",
|
|
470
470
|
"https://static-cdn.jtvnw.net/user-default-pictures-uv/998f01ae-def8-11e9-b95c-784f43822e80-profile_image-300x300.png",
|
|
@@ -472,7 +472,7 @@ const vt = [
|
|
|
472
472
|
"https://static-cdn.jtvnw.net/user-default-pictures-uv/ebe4cd89-b4f4-4cd9-adac-2f30151b4209-profile_image-300x300.png",
|
|
473
473
|
"https://static-cdn.jtvnw.net/user-default-pictures-uv/215b7342-def9-11e9-9a66-784f43822e80-profile_image-300x300.png",
|
|
474
474
|
"https://static-cdn.jtvnw.net/user-default-pictures-uv/ead5c8b2-a4c9-4724-b1dd-9f00b46cbd3d-profile_image-300x300.png"
|
|
475
|
-
],
|
|
475
|
+
], Ct = {
|
|
476
476
|
"100 bits": {
|
|
477
477
|
type: "100 bits",
|
|
478
478
|
version: "1",
|
|
@@ -563,7 +563,7 @@ const vt = [
|
|
|
563
563
|
url: "https://static-cdn.jtvnw.net/badges/v1/b817aba4-fad8-49e2-b88a-7cc744dfa6ec/3",
|
|
564
564
|
description: "VIP"
|
|
565
565
|
}
|
|
566
|
-
},
|
|
566
|
+
}, jt = Object.values([
|
|
567
567
|
{
|
|
568
568
|
type: "twitch",
|
|
569
569
|
name: "TheIlluminati",
|
|
@@ -1920,7 +1920,7 @@ const vt = [
|
|
|
1920
1920
|
end: 0
|
|
1921
1921
|
}), l),
|
|
1922
1922
|
[]
|
|
1923
|
-
),
|
|
1923
|
+
), xt = [], Ut = [
|
|
1924
1924
|
"Hello everyone!",
|
|
1925
1925
|
"PogChamp",
|
|
1926
1926
|
"This stream is amazing!",
|
|
@@ -1971,7 +1971,7 @@ const vt = [
|
|
|
1971
1971
|
"BloodTrail hunting time",
|
|
1972
1972
|
"CatBag kitty!",
|
|
1973
1973
|
"c! poggers"
|
|
1974
|
-
],
|
|
1974
|
+
], Et = ["Local", "Tixyel", "Urie_s2", "itzzcatt", "BeniArts", "Cupidiko", "shy_madeit"], It = ["1000", "2000", "3000", "prime"], Tt = [
|
|
1975
1975
|
"Filiz",
|
|
1976
1976
|
"Astrid",
|
|
1977
1977
|
"Tatyana",
|
|
@@ -2059,7 +2059,7 @@ const vt = [
|
|
|
2059
2059
|
"Szabolcs",
|
|
2060
2060
|
"Hoda",
|
|
2061
2061
|
"Naayf"
|
|
2062
|
-
],
|
|
2062
|
+
], St = [
|
|
2063
2063
|
{
|
|
2064
2064
|
emojiId: "UCkszU2WH9gy1mb0dV-11UJg/flower-rainbow-heart-red",
|
|
2065
2065
|
shortcuts: [":pride-flower-rainbow-heart:"],
|
|
@@ -5233,15 +5233,15 @@ const vt = [
|
|
|
5233
5233
|
index: 121
|
|
5234
5234
|
}
|
|
5235
5235
|
];
|
|
5236
|
-
var
|
|
5236
|
+
var M;
|
|
5237
5237
|
((l) => {
|
|
5238
|
-
l.avatars =
|
|
5239
|
-
})(
|
|
5238
|
+
l.avatars = kt, l.badges = Ct, l.css_color_names = ut, l.emotes = jt, l.items = xt, l.messages = Ut, l.names = Et, l.tiers = It, l.tts = Tt, l.youtube_emotes = St;
|
|
5239
|
+
})(M || (M = {}));
|
|
5240
5240
|
var w;
|
|
5241
5241
|
((l) => {
|
|
5242
5242
|
let e;
|
|
5243
5243
|
((n) => {
|
|
5244
|
-
function m(o,
|
|
5244
|
+
function m(o, d = "cardinal") {
|
|
5245
5245
|
const f = {
|
|
5246
5246
|
single: ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"],
|
|
5247
5247
|
tens: [
|
|
@@ -5257,7 +5257,7 @@ var w;
|
|
|
5257
5257
|
"nineteen"
|
|
5258
5258
|
],
|
|
5259
5259
|
decades: ["twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"]
|
|
5260
|
-
},
|
|
5260
|
+
}, h = {
|
|
5261
5261
|
single: [
|
|
5262
5262
|
"zeroth",
|
|
5263
5263
|
"first",
|
|
@@ -5300,215 +5300,215 @@ var w;
|
|
|
5300
5300
|
"trillion",
|
|
5301
5301
|
"quadrillion",
|
|
5302
5302
|
"quintillion"
|
|
5303
|
-
],
|
|
5304
|
-
if (o = Math.abs(Math.floor(o)),
|
|
5303
|
+
], C = y.map((j) => j ? `${j}th` : "");
|
|
5304
|
+
if (o = Math.abs(Math.floor(o)), d === "suffix") {
|
|
5305
5305
|
const j = o % 100;
|
|
5306
5306
|
if (j >= 11 && j <= 13) return `${o}th`;
|
|
5307
|
-
const
|
|
5308
|
-
return `${o}${g[
|
|
5309
|
-
}
|
|
5310
|
-
function
|
|
5311
|
-
if (j < 10) return
|
|
5312
|
-
if (j < 20) return
|
|
5313
|
-
const
|
|
5314
|
-
if (
|
|
5315
|
-
return
|
|
5316
|
-
const W = f.decades[
|
|
5317
|
-
return `${W}-${
|
|
5318
|
-
}
|
|
5319
|
-
function
|
|
5320
|
-
if (j === 0) return
|
|
5321
|
-
const
|
|
5322
|
-
return
|
|
5323
|
-
}
|
|
5324
|
-
if (o < 1e3) return
|
|
5325
|
-
const
|
|
5326
|
-
let
|
|
5327
|
-
for (;
|
|
5328
|
-
|
|
5329
|
-
let
|
|
5330
|
-
for (let j = 0; j <
|
|
5307
|
+
const P = o % 10;
|
|
5308
|
+
return `${o}${g[P]}`;
|
|
5309
|
+
}
|
|
5310
|
+
function k(j, P) {
|
|
5311
|
+
if (j < 10) return P === "ordinal" ? h.single[j] : f.single[j];
|
|
5312
|
+
if (j < 20) return P === "ordinal" ? h.tens[j - 10] : f.tens[j - 10];
|
|
5313
|
+
const O = Math.floor(j / 10), z = j % 10;
|
|
5314
|
+
if (z === 0)
|
|
5315
|
+
return P === "ordinal" ? h.decades[O - 2] : f.decades[O - 2];
|
|
5316
|
+
const W = f.decades[O - 2], D = P === "ordinal" ? h.single[z] : f.single[z];
|
|
5317
|
+
return `${W}-${D}`;
|
|
5318
|
+
}
|
|
5319
|
+
function S(j, P) {
|
|
5320
|
+
if (j === 0) return P === "ordinal" ? h.single[0] : f.single[0];
|
|
5321
|
+
const O = Math.floor(j / 100), z = j % 100, W = [];
|
|
5322
|
+
return O > 0 && (P === "ordinal" && z === 0 ? W.push(`${f.single[O]} hundredth`) : W.push(`${f.single[O]} hundred`)), z > 0 && W.push(k(z, P)), W.join(" ");
|
|
5323
|
+
}
|
|
5324
|
+
if (o < 1e3) return S(o, d);
|
|
5325
|
+
const J = [];
|
|
5326
|
+
let E = o;
|
|
5327
|
+
for (; E > 0; )
|
|
5328
|
+
J.push(E % 1e3), E = Math.floor(E / 1e3);
|
|
5329
|
+
let T = -1;
|
|
5330
|
+
for (let j = 0; j < J.length; j++) J[j] !== 0 && (T = j);
|
|
5331
5331
|
const _ = [];
|
|
5332
|
-
for (let j =
|
|
5333
|
-
const
|
|
5334
|
-
if (
|
|
5335
|
-
const
|
|
5336
|
-
if (
|
|
5337
|
-
let
|
|
5338
|
-
|
|
5339
|
-
} else if (j ===
|
|
5332
|
+
for (let j = J.length - 1; j >= 0; j--) {
|
|
5333
|
+
const P = J[j];
|
|
5334
|
+
if (P === 0) continue;
|
|
5335
|
+
const O = y[j];
|
|
5336
|
+
if (d === "cardinal") {
|
|
5337
|
+
let z = S(P, "cardinal");
|
|
5338
|
+
O && (z += ` ${O}`), _.push(z);
|
|
5339
|
+
} else if (j === T)
|
|
5340
5340
|
if (j > 0) {
|
|
5341
|
-
const W =
|
|
5342
|
-
_.push(W ? `${W} ${
|
|
5341
|
+
const W = S(P, "cardinal"), D = C[j];
|
|
5342
|
+
_.push(W ? `${W} ${D}` : D);
|
|
5343
5343
|
} else {
|
|
5344
|
-
const W =
|
|
5344
|
+
const W = S(P, "ordinal");
|
|
5345
5345
|
_.push(W);
|
|
5346
5346
|
}
|
|
5347
5347
|
else {
|
|
5348
|
-
let W =
|
|
5349
|
-
|
|
5348
|
+
let W = S(P, "cardinal");
|
|
5349
|
+
O && (W += ` ${O}`), _.push(W);
|
|
5350
5350
|
}
|
|
5351
5351
|
}
|
|
5352
5352
|
return _.join(", ");
|
|
5353
5353
|
}
|
|
5354
5354
|
n.translate = m;
|
|
5355
|
-
function c(o,
|
|
5356
|
-
const g = Math.min(Math.max(o,
|
|
5357
|
-
return b(g,
|
|
5355
|
+
function c(o, d = 0, f = 100, h = 0) {
|
|
5356
|
+
const g = Math.min(Math.max(o, d), f);
|
|
5357
|
+
return b(g, h);
|
|
5358
5358
|
}
|
|
5359
5359
|
n.balance = c;
|
|
5360
|
-
function b(o,
|
|
5361
|
-
const f = Math.pow(10,
|
|
5360
|
+
function b(o, d = 2) {
|
|
5361
|
+
const f = Math.pow(10, d);
|
|
5362
5362
|
return Math.round(o * f) / f;
|
|
5363
5363
|
}
|
|
5364
5364
|
n.round = b;
|
|
5365
|
-
function p(o,
|
|
5366
|
-
o >
|
|
5367
|
-
const
|
|
5368
|
-
return f ? Number(
|
|
5365
|
+
function p(o, d, f = 0) {
|
|
5366
|
+
o > d && ([o, d] = [d, o]);
|
|
5367
|
+
const h = Math.random() * (d - o) + o;
|
|
5368
|
+
return f ? Number(h.toFixed(f)) : Math.round(h);
|
|
5369
5369
|
}
|
|
5370
5370
|
n.number = p;
|
|
5371
5371
|
})(e = l.number || (l.number = {}));
|
|
5372
5372
|
let t;
|
|
5373
5373
|
((n) => {
|
|
5374
|
-
function m(
|
|
5374
|
+
function m(d, f, h) {
|
|
5375
5375
|
const g = f.match(/^<span(?: class="[^"]*")? style="([^"]*)">(.*)<\/span>$/s);
|
|
5376
5376
|
if (g) {
|
|
5377
|
-
const y = g[1],
|
|
5378
|
-
let
|
|
5379
|
-
return
|
|
5377
|
+
const y = g[1], C = g[2], k = g[0].match(/class="([^"]*)"/)?.[1] || "";
|
|
5378
|
+
let S = [y, d].filter((J) => J.length).map((J) => J.endsWith(";") ? J.slice(0, -1) : J).join("; ").replace(/\s*;\s*/g, "; ").trim();
|
|
5379
|
+
return S.endsWith(";") || (S += ";"), `<span${k ? ` class="${k} ${h ?? ""}"` : ""}${S ? ` style="${S}"` : ""}>${C}</span>`;
|
|
5380
5380
|
} else
|
|
5381
|
-
return
|
|
5381
|
+
return d && d.length && !d.endsWith(";") && (d += ";"), `<span${h ? ` class="${h}"` : ""}${d ? ` style="${d}"` : ""}>${f}</span>`;
|
|
5382
5382
|
}
|
|
5383
5383
|
n.mergeSpanStyles = m;
|
|
5384
|
-
function c(
|
|
5385
|
-
const { return: y = !1, parent:
|
|
5386
|
-
if (!
|
|
5384
|
+
function c(d, f = 0, h = 1, g) {
|
|
5385
|
+
const { return: y = !1, parent: C, base: k } = g || {}, S = C || d.parentElement || document.body;
|
|
5386
|
+
if (!S)
|
|
5387
5387
|
throw new Error("No parent element found for scaling");
|
|
5388
|
-
const
|
|
5389
|
-
if (
|
|
5388
|
+
const J = S.getBoundingClientRect(), E = d.offsetWidth, T = d.offsetHeight;
|
|
5389
|
+
if (E === 0 || T === 0)
|
|
5390
5390
|
throw new Error("Element has zero width or height, cannot scale");
|
|
5391
|
-
const _ =
|
|
5392
|
-
let
|
|
5391
|
+
const _ = J.width * h / E, j = J.height * h / T;
|
|
5392
|
+
let P = k === "width" ? _ : k === "height" ? j : Math.min(_, j);
|
|
5393
5393
|
if (f > 0) {
|
|
5394
|
-
const
|
|
5395
|
-
|
|
5394
|
+
const z = J.width * f / E, W = J.height * f / T, D = Math.max(z, W);
|
|
5395
|
+
P = Math.max(D, P);
|
|
5396
5396
|
}
|
|
5397
|
-
const
|
|
5398
|
-
width:
|
|
5399
|
-
height:
|
|
5400
|
-
scale:
|
|
5397
|
+
const O = {
|
|
5398
|
+
width: E * P,
|
|
5399
|
+
height: T * P,
|
|
5400
|
+
scale: P
|
|
5401
5401
|
};
|
|
5402
|
-
return y || (
|
|
5402
|
+
return y || (d.style.transform = `scale(${P})`, d.style.transformOrigin = "center center"), O;
|
|
5403
5403
|
}
|
|
5404
5404
|
n.scale = c;
|
|
5405
|
-
function b(
|
|
5405
|
+
function b(d, f = {}) {
|
|
5406
5406
|
const {
|
|
5407
|
-
parent:
|
|
5407
|
+
parent: h = d.parentElement,
|
|
5408
5408
|
prefer: g = "auto",
|
|
5409
5409
|
min: y = 0,
|
|
5410
|
-
max:
|
|
5411
|
-
apply:
|
|
5410
|
+
max: C = 1,
|
|
5411
|
+
apply: k = () => {
|
|
5412
5412
|
}
|
|
5413
5413
|
} = f;
|
|
5414
|
-
if (!
|
|
5414
|
+
if (!h)
|
|
5415
5415
|
throw new Error("No parent element found for scaling");
|
|
5416
|
-
const
|
|
5417
|
-
let
|
|
5418
|
-
const
|
|
5419
|
-
|
|
5420
|
-
const
|
|
5421
|
-
return g === "width" ?
|
|
5416
|
+
const S = h.getBoundingClientRect(), J = d.getBoundingClientRect(), E = S.width, T = S.height, _ = J.width, j = J.height;
|
|
5417
|
+
let P = E * y / _, O = T * y / j, z = E * C / _, W = T * C / j, D = Math.min(z, W);
|
|
5418
|
+
const tt = Math.max(P, O);
|
|
5419
|
+
D = Math.max(D, tt);
|
|
5420
|
+
const q = _ * D, F = j * D;
|
|
5421
|
+
return g === "width" ? D = Math.max(P, Math.min(z, E / _)) : g === "height" ? D = Math.max(O, Math.min(W, T / j)) : q > E ? D = Math.max(P, Math.min(z, E / _)) : F > T && (D = Math.max(O, Math.min(W, T / j))), k.apply(d, [D, d]), D;
|
|
5422
5422
|
}
|
|
5423
5423
|
n.scalev2 = b;
|
|
5424
|
-
function p(
|
|
5425
|
-
const g = parseFloat(getComputedStyle(
|
|
5426
|
-
minFontSize:
|
|
5427
|
-
maxFontSize:
|
|
5428
|
-
},
|
|
5429
|
-
if (!
|
|
5424
|
+
function p(d, f = 1, h = {}) {
|
|
5425
|
+
const g = parseFloat(getComputedStyle(d).getPropertyValue("font-size")), y = {
|
|
5426
|
+
minFontSize: h?.minFontSize ?? 0,
|
|
5427
|
+
maxFontSize: h?.maxFontSize ?? g
|
|
5428
|
+
}, C = h?.parent || d.parentElement;
|
|
5429
|
+
if (!C)
|
|
5430
5430
|
throw new Error("No parent element found for fitting text");
|
|
5431
|
-
const
|
|
5432
|
-
return
|
|
5431
|
+
const k = C.clientWidth * f, S = d.offsetWidth, J = k / S, E = g * J, T = e.balance(E, y.minFontSize, y.maxFontSize);
|
|
5432
|
+
return d.style.fontSize = T + "px", d;
|
|
5433
5433
|
}
|
|
5434
5434
|
n.fitText = p;
|
|
5435
|
-
function o(
|
|
5436
|
-
const g = new DOMParser().parseFromString(
|
|
5435
|
+
function o(d, f = 0) {
|
|
5436
|
+
const g = new DOMParser().parseFromString(d, "text/html");
|
|
5437
5437
|
let y = f;
|
|
5438
|
-
function
|
|
5439
|
-
if (
|
|
5440
|
-
const _ = (
|
|
5441
|
-
const
|
|
5442
|
-
return
|
|
5443
|
-
` ||
|
|
5438
|
+
function C(E) {
|
|
5439
|
+
if (E.nodeType === Node.TEXT_NODE) {
|
|
5440
|
+
const _ = (E.textContent || "").split("").map((P, O) => {
|
|
5441
|
+
const z = document.createElement("span");
|
|
5442
|
+
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)), (P === " " || P === `
|
|
5443
|
+
` || P === " ") && (z.style.whiteSpace = "pre-wrap"), z.textContent = P, y++, z;
|
|
5444
5444
|
}), j = document.createDocumentFragment();
|
|
5445
|
-
return _.forEach((
|
|
5446
|
-
} else if (
|
|
5447
|
-
const
|
|
5448
|
-
return
|
|
5449
|
-
const j =
|
|
5450
|
-
(j instanceof DocumentFragment || j instanceof Node) &&
|
|
5451
|
-
}),
|
|
5452
|
-
}
|
|
5453
|
-
return
|
|
5454
|
-
}
|
|
5455
|
-
const
|
|
5456
|
-
|
|
5457
|
-
if (
|
|
5445
|
+
return _.forEach((P) => j.appendChild(P)), j;
|
|
5446
|
+
} else if (E.nodeType === Node.ELEMENT_NODE) {
|
|
5447
|
+
const T = E.cloneNode(!1);
|
|
5448
|
+
return T.classList.add("container"), T.dataset.index = String(y), T.style.setProperty("--char-index", String(y)), E.childNodes.forEach((_) => {
|
|
5449
|
+
const j = C(_);
|
|
5450
|
+
(j instanceof DocumentFragment || j instanceof Node) && T.appendChild(j);
|
|
5451
|
+
}), T;
|
|
5452
|
+
}
|
|
5453
|
+
return E.cloneNode(!0);
|
|
5454
|
+
}
|
|
5455
|
+
const k = g.body, S = document.createElement("div");
|
|
5456
|
+
k.childNodes.forEach((E) => {
|
|
5457
|
+
if (E.nodeType === Node.TEXT_NODE && !E.textContent?.trim())
|
|
5458
5458
|
return;
|
|
5459
|
-
const
|
|
5460
|
-
(
|
|
5459
|
+
const T = C(E);
|
|
5460
|
+
(T instanceof DocumentFragment || T instanceof Node) && S.appendChild(T);
|
|
5461
5461
|
});
|
|
5462
|
-
let
|
|
5463
|
-
return Array.from(
|
|
5464
|
-
|
|
5465
|
-
}),
|
|
5462
|
+
let J = "";
|
|
5463
|
+
return Array.from(S.childNodes).forEach((E) => {
|
|
5464
|
+
E.nodeType === Node.TEXT_NODE ? J += E.textContent : J += E.outerHTML;
|
|
5465
|
+
}), J;
|
|
5466
5466
|
}
|
|
5467
5467
|
n.splitTextToChars = o;
|
|
5468
5468
|
})(t = l.element || (l.element = {}));
|
|
5469
5469
|
let a;
|
|
5470
5470
|
((n) => {
|
|
5471
|
-
function m(o,
|
|
5472
|
-
const
|
|
5471
|
+
function m(o, d = !0, f = "") {
|
|
5472
|
+
const h = {};
|
|
5473
5473
|
for (const g in o) {
|
|
5474
5474
|
if (!Object.prototype.hasOwnProperty.call(o, g)) continue;
|
|
5475
|
-
const y = o[g],
|
|
5475
|
+
const y = o[g], C = f ? `${f}.${g}` : g;
|
|
5476
5476
|
if (y == null) {
|
|
5477
|
-
|
|
5477
|
+
h[C] = String(y);
|
|
5478
5478
|
continue;
|
|
5479
5479
|
}
|
|
5480
5480
|
if (typeof y == "number" && isNaN(y)) {
|
|
5481
|
-
|
|
5481
|
+
h[C] = "NaN";
|
|
5482
5482
|
continue;
|
|
5483
5483
|
}
|
|
5484
5484
|
if (typeof y == "number" && !isNaN(y)) {
|
|
5485
|
-
|
|
5485
|
+
h[C] = d ? String(y) : y;
|
|
5486
5486
|
continue;
|
|
5487
5487
|
}
|
|
5488
5488
|
if (y instanceof Date) {
|
|
5489
|
-
|
|
5489
|
+
h[C] = y.toISOString();
|
|
5490
5490
|
continue;
|
|
5491
5491
|
}
|
|
5492
5492
|
if (y instanceof Map) {
|
|
5493
|
-
y.forEach((
|
|
5494
|
-
|
|
5493
|
+
y.forEach((k, S) => {
|
|
5494
|
+
h[`${C}.${S}`] = JSON.stringify(k);
|
|
5495
5495
|
});
|
|
5496
5496
|
continue;
|
|
5497
5497
|
}
|
|
5498
5498
|
if (Array.isArray(y)) {
|
|
5499
|
-
y.forEach((
|
|
5500
|
-
const
|
|
5501
|
-
typeof
|
|
5499
|
+
y.forEach((k, S) => {
|
|
5500
|
+
const J = `${C}:${S}`;
|
|
5501
|
+
typeof k == "object" ? Object.assign(h, m(k, d, J)) : h[J] = d ? String(k) : k;
|
|
5502
5502
|
});
|
|
5503
5503
|
continue;
|
|
5504
5504
|
}
|
|
5505
5505
|
if (typeof y == "object") {
|
|
5506
|
-
Object.assign(
|
|
5506
|
+
Object.assign(h, m(y, d, C));
|
|
5507
5507
|
continue;
|
|
5508
5508
|
}
|
|
5509
|
-
|
|
5509
|
+
h[C] = String(y);
|
|
5510
5510
|
}
|
|
5511
|
-
return
|
|
5511
|
+
return h;
|
|
5512
5512
|
}
|
|
5513
5513
|
n.flatten = m;
|
|
5514
5514
|
function c(o) {
|
|
@@ -5524,64 +5524,73 @@ var w;
|
|
|
5524
5524
|
}
|
|
5525
5525
|
n.keys = p;
|
|
5526
5526
|
})(a = l.object || (l.object = {})), ((n) => {
|
|
5527
|
-
function m(o,
|
|
5527
|
+
function m(o, d = M.emotes) {
|
|
5528
5528
|
const f = [];
|
|
5529
|
-
return
|
|
5530
|
-
const g =
|
|
5531
|
-
let y = 0,
|
|
5529
|
+
return d.forEach((h) => {
|
|
5530
|
+
const g = h.name;
|
|
5531
|
+
let y = 0, C = 0;
|
|
5532
5532
|
for (; y < o.length; ) {
|
|
5533
|
-
const
|
|
5534
|
-
if (
|
|
5535
|
-
const
|
|
5536
|
-
/\s/.test(
|
|
5533
|
+
const k = o.indexOf(g, C);
|
|
5534
|
+
if (k === -1) break;
|
|
5535
|
+
const S = k > 0 ? o[k - 1] : " ", J = k + g.length < o.length ? o[k + g.length] : " ";
|
|
5536
|
+
/\s/.test(S) && /\s/.test(J) && f.push({ ...h, start: k, end: k + g.length }), C = k + 1;
|
|
5537
5537
|
}
|
|
5538
|
-
}), f.sort((
|
|
5538
|
+
}), f.sort((h, g) => h.start - g.start);
|
|
5539
5539
|
}
|
|
5540
5540
|
n.findEmotesInText = m;
|
|
5541
|
-
function c(o,
|
|
5542
|
-
if (!
|
|
5543
|
-
let f = "",
|
|
5544
|
-
return
|
|
5545
|
-
f += o.substring(
|
|
5546
|
-
const
|
|
5547
|
-
f += `<img src="${
|
|
5548
|
-
}), f += o.substring(
|
|
5541
|
+
function c(o, d) {
|
|
5542
|
+
if (!d.length) return o;
|
|
5543
|
+
let f = "", h = 0;
|
|
5544
|
+
return d.forEach((g) => {
|
|
5545
|
+
f += o.substring(h, g.start);
|
|
5546
|
+
const C = Array.from({ ...g.urls, length: 5 }).slice(1).reverse().filter(Boolean)[0] || g.urls[1];
|
|
5547
|
+
f += `<img src="${C}" alt="${g.name}" class="emote" style="width: auto; height: 1em; vertical-align: middle;" />`, h = g.end;
|
|
5548
|
+
}), f += o.substring(h), f;
|
|
5549
5549
|
}
|
|
5550
5550
|
n.replaceEmotesWithHTML = c;
|
|
5551
|
-
function b(o,
|
|
5552
|
-
return Array.from(o.matchAll(/:(.*?):/gim), (
|
|
5553
|
-
const g =
|
|
5554
|
-
(y) => y.shortcuts.includes(
|
|
5551
|
+
function b(o, d = M.youtube_emotes) {
|
|
5552
|
+
return Array.from(o.matchAll(/:(.*?):/gim), (h) => h[0]).forEach((h) => {
|
|
5553
|
+
const g = d.find(
|
|
5554
|
+
(y) => y.shortcuts.includes(h) || y.searchTerms.includes(h.slice(1, -1))
|
|
5555
5555
|
);
|
|
5556
5556
|
if (g) {
|
|
5557
|
-
const y = g.image.thumbnails.at(-1)?.url,
|
|
5557
|
+
const y = g.image.thumbnails.at(-1)?.url, C = g.image.accessibility.accessibilityData.label;
|
|
5558
5558
|
y && (o = o.replace(
|
|
5559
|
-
|
|
5560
|
-
`<img src="${y}" alt="${
|
|
5559
|
+
h,
|
|
5560
|
+
`<img src="${y}" alt="${C}" class="emote" style="width: auto; height: 1em; vertical-align: middle;" />`
|
|
5561
5561
|
));
|
|
5562
5562
|
}
|
|
5563
5563
|
}), o;
|
|
5564
5564
|
}
|
|
5565
5565
|
n.replaceYoutubeEmotesWithHTML = b;
|
|
5566
|
-
async function p(o = [],
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
|
|
5566
|
+
async function p(o = [], d) {
|
|
5567
|
+
!Array.isArray(o) && typeof o == "string" && (o = o.split(",").map((k) => k.trim()));
|
|
5568
|
+
var f = o.map((k) => k.split("/")[0]);
|
|
5569
|
+
if (!f || !f.length) {
|
|
5570
|
+
var h = s.number(1, 3);
|
|
5571
|
+
for await (const k of Array.from({ length: h }, () => "")) {
|
|
5572
|
+
var g = s.array(Object.keys(M.badges))[0];
|
|
5573
|
+
!f.includes(g) && Array.isArray(f) ? f.push(g) : f = [g];
|
|
5574
|
+
}
|
|
5575
|
+
}
|
|
5576
|
+
var y;
|
|
5577
|
+
switch (d) {
|
|
5576
5578
|
case "twitch": {
|
|
5577
|
-
|
|
5578
|
-
keys: Array.from(
|
|
5579
|
-
badges: Array.from(
|
|
5579
|
+
y = {
|
|
5580
|
+
keys: Array.from(f).filter((k) => k in M.badges),
|
|
5581
|
+
badges: Array.from(f).slice(0, 3).map((k) => M.badges[k]).filter(Boolean),
|
|
5582
|
+
amount: o.reduce(
|
|
5583
|
+
(k, S) => {
|
|
5584
|
+
var [J, E = "1"] = S.split("/");
|
|
5585
|
+
return (isNaN(parseInt(E)) || !E.length) && (E = "1"), k[J] = parseInt(E) || 1, k;
|
|
5586
|
+
},
|
|
5587
|
+
{}
|
|
5588
|
+
)
|
|
5580
5589
|
};
|
|
5581
5590
|
break;
|
|
5582
5591
|
}
|
|
5583
5592
|
case "youtube": {
|
|
5584
|
-
var
|
|
5593
|
+
var C = {
|
|
5585
5594
|
verified: { isVerified: !0 },
|
|
5586
5595
|
broadcaster: { isChatOwner: !0 },
|
|
5587
5596
|
host: { isChatOwner: !0 },
|
|
@@ -5589,8 +5598,8 @@ var w;
|
|
|
5589
5598
|
subscriber: { isChatSponsor: !0 },
|
|
5590
5599
|
moderator: { isChatModerator: !0 }
|
|
5591
5600
|
};
|
|
5592
|
-
|
|
5593
|
-
(
|
|
5601
|
+
y = Object.entries(f).reduce(
|
|
5602
|
+
(k, [S]) => (S in C && Object.assign(k, C[S]), k),
|
|
5594
5603
|
{
|
|
5595
5604
|
isVerified: !1,
|
|
5596
5605
|
isChatOwner: !1,
|
|
@@ -5601,7 +5610,7 @@ var w;
|
|
|
5601
5610
|
break;
|
|
5602
5611
|
}
|
|
5603
5612
|
}
|
|
5604
|
-
return
|
|
5613
|
+
return y;
|
|
5605
5614
|
}
|
|
5606
5615
|
n.generateBadges = p;
|
|
5607
5616
|
})(l.message || (l.message = {})), ((n) => {
|
|
@@ -5620,88 +5629,88 @@ var w;
|
|
|
5620
5629
|
"tip-latest",
|
|
5621
5630
|
"event:test",
|
|
5622
5631
|
"event:skip"
|
|
5623
|
-
].some((
|
|
5632
|
+
].some((d) => d === c.listener) && (b = "streamelements"), { provider: b, data: c };
|
|
5624
5633
|
}
|
|
5625
5634
|
n.parseProvider = m;
|
|
5626
5635
|
})(l.event || (l.event = {})), ((n) => {
|
|
5627
5636
|
n.PRESETS = {};
|
|
5628
|
-
async function m(p, o,
|
|
5637
|
+
async function m(p, o, d) {
|
|
5629
5638
|
const f = [];
|
|
5630
5639
|
p.replace(o, (g, ...y) => {
|
|
5631
|
-
const
|
|
5632
|
-
return f.push(Promise.resolve(
|
|
5640
|
+
const C = typeof d == "function" ? d(g, ...y) : g;
|
|
5641
|
+
return f.push(Promise.resolve(C)), g;
|
|
5633
5642
|
});
|
|
5634
|
-
const
|
|
5635
|
-
return p.replace(o, () =>
|
|
5643
|
+
const h = await Promise.all(f);
|
|
5644
|
+
return p.replace(o, () => h.shift() ?? "");
|
|
5636
5645
|
}
|
|
5637
5646
|
n.replace = m;
|
|
5638
5647
|
function c(p) {
|
|
5639
5648
|
return p.charAt(0).toUpperCase() + p.slice(1);
|
|
5640
5649
|
}
|
|
5641
5650
|
n.capitalize = c;
|
|
5642
|
-
function b(p, o = {},
|
|
5651
|
+
function b(p, o = {}, d = {
|
|
5643
5652
|
method: "index",
|
|
5644
5653
|
html: !1,
|
|
5645
5654
|
debug: !1,
|
|
5646
5655
|
modifiers: {},
|
|
5647
5656
|
aliases: {}
|
|
5648
5657
|
}) {
|
|
5649
|
-
const { mergeSpanStyles: f } = t,
|
|
5658
|
+
const { mergeSpanStyles: f } = t, h = (r, u, v) => d.html ? f(r, u, v) : u, g = {
|
|
5650
5659
|
skip: "<br/>",
|
|
5651
5660
|
newline: "<br/>",
|
|
5652
5661
|
...o
|
|
5653
5662
|
};
|
|
5654
|
-
let y = "$",
|
|
5663
|
+
let y = "$", C = "USD";
|
|
5655
5664
|
if (typeof window < "u")
|
|
5656
5665
|
try {
|
|
5657
5666
|
const u = window?.client?.details?.currency;
|
|
5658
|
-
u?.symbol && (y = String(u.symbol)), u?.code && (
|
|
5667
|
+
u?.symbol && (y = String(u.symbol)), u?.code && (C = String(u.code));
|
|
5659
5668
|
} catch {
|
|
5660
5669
|
}
|
|
5661
|
-
const
|
|
5662
|
-
(r, [u,
|
|
5663
|
-
if (r[u] = String(
|
|
5664
|
-
const
|
|
5665
|
-
r.username = r.username ||
|
|
5670
|
+
const k = Object.entries(a.flatten(g)).reduce(
|
|
5671
|
+
(r, [u, v]) => {
|
|
5672
|
+
if (r[u] = String(v), ["username", "name", "nick", "nickname", "sender"].some((x) => u === x)) {
|
|
5673
|
+
const x = r?.username || r?.name || r?.nick || r?.nickname || r?.sender;
|
|
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}`;
|
|
5666
5675
|
}
|
|
5667
|
-
return ["amount", "count"].some((
|
|
5676
|
+
return ["amount", "count"].some((x) => u === 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;
|
|
5668
5677
|
},
|
|
5669
5678
|
{}
|
|
5670
|
-
),
|
|
5679
|
+
), S = {
|
|
5671
5680
|
PLACEHOLDERS: /{([^}]+)}/g,
|
|
5672
5681
|
MODIFIERS: /\[([^\]=]+)=([^\]]+)\]/g
|
|
5673
5682
|
};
|
|
5674
|
-
var
|
|
5675
|
-
function
|
|
5676
|
-
const
|
|
5677
|
-
if (!
|
|
5678
|
-
const
|
|
5683
|
+
var J = parseFloat(k?.amount ?? k?.count ?? 0);
|
|
5684
|
+
function E(r, u) {
|
|
5685
|
+
const v = r?.trim?.() ?? "";
|
|
5686
|
+
if (!v.length) return null;
|
|
5687
|
+
const x = u[v], I = parseFloat(String(x !== void 0 ? x : v).replace(/\s/g, ""));
|
|
5679
5688
|
return isNaN(I) ? null : I;
|
|
5680
5689
|
}
|
|
5681
|
-
function
|
|
5682
|
-
const
|
|
5683
|
-
if (
|
|
5690
|
+
function T(r, u, v) {
|
|
5691
|
+
const x = isNaN(Number(u)) ? 0 : Math.max(0, parseInt(String(u))), N = E(r, v);
|
|
5692
|
+
if (N === null) return r;
|
|
5684
5693
|
try {
|
|
5685
|
-
return
|
|
5686
|
-
minimumFractionDigits:
|
|
5687
|
-
maximumFractionDigits:
|
|
5694
|
+
return N.toLocaleString(void 0, {
|
|
5695
|
+
minimumFractionDigits: x,
|
|
5696
|
+
maximumFractionDigits: x
|
|
5688
5697
|
});
|
|
5689
5698
|
} catch {
|
|
5690
|
-
return
|
|
5699
|
+
return N.toFixed(x);
|
|
5691
5700
|
}
|
|
5692
5701
|
}
|
|
5693
5702
|
function _(r, u = /* @__PURE__ */ new Date()) {
|
|
5694
|
-
const
|
|
5695
|
-
return V > 0 ? `${V}y ${
|
|
5703
|
+
const v = u.getTime() - r.getTime(), x = v >= 0, N = Math.abs(v), I = Math.floor(N / 1e3), A = Math.floor(I / 60), H = Math.floor(A / 60), U = Math.floor(H / 24), L = Math.floor(U / 30), V = Math.floor(U / 365), X = x ? "ago" : "from now";
|
|
5704
|
+
return V > 0 ? `${V}y ${X}` : L > 0 ? `${L}mo ${X}` : U > 0 ? `${U}d ${X}` : H > 0 ? `${H}h ${X}` : A > 0 ? `${A}m ${X}` : `${Math.max(I, 0)}s ${X}`;
|
|
5696
5705
|
}
|
|
5697
|
-
function j(r, u,
|
|
5698
|
-
const
|
|
5699
|
-
if (!
|
|
5700
|
-
const
|
|
5706
|
+
function j(r, u, v) {
|
|
5707
|
+
const x = r?.trim?.() ?? "";
|
|
5708
|
+
if (!x.length) return r;
|
|
5709
|
+
const N = v[x] ?? x, I = new Date(N);
|
|
5701
5710
|
if (isNaN(I.getTime())) return r;
|
|
5702
|
-
const
|
|
5711
|
+
const A = (u ?? "date").toString().toLowerCase();
|
|
5703
5712
|
try {
|
|
5704
|
-
switch (
|
|
5713
|
+
switch (A) {
|
|
5705
5714
|
case "time":
|
|
5706
5715
|
return I.toLocaleTimeString();
|
|
5707
5716
|
case "datetime":
|
|
@@ -5719,188 +5728,188 @@ var w;
|
|
|
5719
5728
|
return r;
|
|
5720
5729
|
}
|
|
5721
5730
|
}
|
|
5722
|
-
function
|
|
5723
|
-
const
|
|
5724
|
-
let
|
|
5725
|
-
|
|
5726
|
-
const
|
|
5727
|
-
return isNaN(
|
|
5728
|
-
}
|
|
5729
|
-
function
|
|
5730
|
-
const
|
|
5731
|
-
let
|
|
5732
|
-
for (const
|
|
5733
|
-
const
|
|
5734
|
-
if (
|
|
5735
|
-
const V =
|
|
5731
|
+
function P(r, u, v) {
|
|
5732
|
+
const x = r ?? "", [N, I = N] = x.split("|", 2), A = u?.trim();
|
|
5733
|
+
let H;
|
|
5734
|
+
A && v[A] !== void 0 ? H = v[A] : H = v.amount ?? v.count;
|
|
5735
|
+
const U = parseFloat(String(H));
|
|
5736
|
+
return isNaN(U) ? N : Math.abs(U) !== 1 ? I : N;
|
|
5737
|
+
}
|
|
5738
|
+
function O(r, u, v) {
|
|
5739
|
+
const x = u?.trim() ?? "", N = x && v[x] !== void 0 ? v[x] : "", I = String(N), A = (r ?? "").split("|").map((U) => U.trim()).filter((U) => U.length);
|
|
5740
|
+
let H;
|
|
5741
|
+
for (const U of A) {
|
|
5742
|
+
const L = U.indexOf(":");
|
|
5743
|
+
if (L === -1) continue;
|
|
5744
|
+
const V = U.slice(0, L).trim(), X = U.slice(L + 1);
|
|
5736
5745
|
if (V.length) {
|
|
5737
5746
|
if (V.toLowerCase() === "default") {
|
|
5738
|
-
|
|
5747
|
+
H = X;
|
|
5739
5748
|
continue;
|
|
5740
5749
|
}
|
|
5741
|
-
if (I === V) return
|
|
5750
|
+
if (I === V) return X;
|
|
5742
5751
|
}
|
|
5743
5752
|
}
|
|
5744
|
-
return
|
|
5753
|
+
return H ?? "";
|
|
5745
5754
|
}
|
|
5746
|
-
function
|
|
5755
|
+
function z(r) {
|
|
5747
5756
|
return r.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
5748
5757
|
}
|
|
5749
5758
|
function W(r, u) {
|
|
5750
|
-
let
|
|
5751
|
-
if (!
|
|
5752
|
-
const
|
|
5753
|
-
if (
|
|
5754
|
-
return
|
|
5755
|
-
const I =
|
|
5759
|
+
let v = r.trim();
|
|
5760
|
+
if (!v.length) return;
|
|
5761
|
+
const x = v[0], N = v[v.length - 1];
|
|
5762
|
+
if (x === '"' && N === '"' || x === "'" && N === "'")
|
|
5763
|
+
return v.slice(1, -1);
|
|
5764
|
+
const I = v.toLowerCase();
|
|
5756
5765
|
if (I === "true") return !0;
|
|
5757
5766
|
if (I === "false") return !1;
|
|
5758
|
-
if (/^-?\d+(\.\d+)?$/.test(
|
|
5759
|
-
const
|
|
5760
|
-
if (
|
|
5761
|
-
const
|
|
5762
|
-
return
|
|
5767
|
+
if (/^-?\d+(\.\d+)?$/.test(v)) return parseFloat(v);
|
|
5768
|
+
const A = u?.[v];
|
|
5769
|
+
if (A === void 0) return v;
|
|
5770
|
+
const H = String(A).trim(), U = H.toLowerCase();
|
|
5771
|
+
return U === "true" ? !0 : U === "false" ? !1 : /^-?\d+(\.\d+)?$/.test(H) ? parseFloat(H) : A;
|
|
5763
5772
|
}
|
|
5764
|
-
function
|
|
5773
|
+
function D(r) {
|
|
5765
5774
|
if (typeof r == "boolean") return r;
|
|
5766
5775
|
if (r == null) return !1;
|
|
5767
5776
|
const u = String(r).trim().toLowerCase();
|
|
5768
5777
|
return !(!u.length || ["false", "0", "no", "off", "null", "undefined", "nan"].includes(u));
|
|
5769
5778
|
}
|
|
5770
|
-
function
|
|
5771
|
-
let
|
|
5772
|
-
if (!
|
|
5773
|
-
let
|
|
5774
|
-
for (;
|
|
5775
|
-
|
|
5776
|
-
const
|
|
5777
|
-
let I = null,
|
|
5778
|
-
for (const
|
|
5779
|
-
const V =
|
|
5779
|
+
function tt(r, u) {
|
|
5780
|
+
let v = r.trim();
|
|
5781
|
+
if (!v.length) return !1;
|
|
5782
|
+
let x = !1;
|
|
5783
|
+
for (; v.startsWith("!"); )
|
|
5784
|
+
x = !x, v = v.slice(1).trim();
|
|
5785
|
+
const N = ["===", "!==", "==", "!=", ">=", "<=", ">", "<"];
|
|
5786
|
+
let I = null, A = v, H = "";
|
|
5787
|
+
for (const L of N) {
|
|
5788
|
+
const V = v.indexOf(L);
|
|
5780
5789
|
if (V !== -1) {
|
|
5781
|
-
I =
|
|
5790
|
+
I = L, A = v.slice(0, V), H = v.slice(V + L.length);
|
|
5782
5791
|
break;
|
|
5783
5792
|
}
|
|
5784
5793
|
}
|
|
5785
|
-
let
|
|
5794
|
+
let U;
|
|
5786
5795
|
if (I) {
|
|
5787
|
-
const
|
|
5796
|
+
const L = W(A, u), V = W(H, u);
|
|
5788
5797
|
switch (I) {
|
|
5789
5798
|
case "===":
|
|
5790
|
-
|
|
5799
|
+
U = L === V;
|
|
5791
5800
|
break;
|
|
5792
5801
|
case "!==":
|
|
5793
|
-
|
|
5802
|
+
U = L !== V;
|
|
5794
5803
|
break;
|
|
5795
5804
|
case "==":
|
|
5796
|
-
|
|
5805
|
+
U = L == V;
|
|
5797
5806
|
break;
|
|
5798
5807
|
case "!=":
|
|
5799
|
-
|
|
5808
|
+
U = L != V;
|
|
5800
5809
|
break;
|
|
5801
5810
|
case ">=":
|
|
5802
|
-
|
|
5811
|
+
U = L >= V;
|
|
5803
5812
|
break;
|
|
5804
5813
|
case "<=":
|
|
5805
|
-
|
|
5814
|
+
U = L <= V;
|
|
5806
5815
|
break;
|
|
5807
5816
|
case ">":
|
|
5808
|
-
|
|
5817
|
+
U = L > V;
|
|
5809
5818
|
break;
|
|
5810
5819
|
case "<":
|
|
5811
|
-
|
|
5820
|
+
U = L < V;
|
|
5812
5821
|
break;
|
|
5813
5822
|
default:
|
|
5814
|
-
|
|
5823
|
+
U = !1;
|
|
5815
5824
|
break;
|
|
5816
5825
|
}
|
|
5817
5826
|
} else {
|
|
5818
|
-
const
|
|
5819
|
-
|
|
5820
|
-
}
|
|
5821
|
-
return
|
|
5822
|
-
}
|
|
5823
|
-
function
|
|
5824
|
-
let
|
|
5825
|
-
if (!
|
|
5826
|
-
let
|
|
5827
|
-
for (;
|
|
5828
|
-
|
|
5829
|
-
const
|
|
5830
|
-
if (!
|
|
5827
|
+
const L = W(A, u);
|
|
5828
|
+
U = D(L);
|
|
5829
|
+
}
|
|
5830
|
+
return x ? !U : U;
|
|
5831
|
+
}
|
|
5832
|
+
function q(r, u) {
|
|
5833
|
+
let v = r.trim();
|
|
5834
|
+
if (!v.length) return !1;
|
|
5835
|
+
let x = !1;
|
|
5836
|
+
for (; v.startsWith("!"); )
|
|
5837
|
+
x = !x, v = v.slice(1).trim();
|
|
5838
|
+
const N = v.split("||").map((A) => A.trim()).filter((A) => A.length);
|
|
5839
|
+
if (!N.length) return !!x;
|
|
5831
5840
|
let I = !1;
|
|
5832
|
-
for (const
|
|
5833
|
-
const
|
|
5834
|
-
if (!
|
|
5835
|
-
let
|
|
5836
|
-
for (const
|
|
5837
|
-
const V =
|
|
5838
|
-
if (
|
|
5841
|
+
for (const A of N) {
|
|
5842
|
+
const H = A.split("&&").map((L) => L.trim()).filter((L) => L.length);
|
|
5843
|
+
if (!H.length) continue;
|
|
5844
|
+
let U = !0;
|
|
5845
|
+
for (const L of H) {
|
|
5846
|
+
const V = tt(L, u);
|
|
5847
|
+
if (U = U && V, !U) break;
|
|
5839
5848
|
}
|
|
5840
|
-
if (I = I ||
|
|
5841
|
-
}
|
|
5842
|
-
return
|
|
5843
|
-
}
|
|
5844
|
-
const
|
|
5845
|
-
COLOR: (r, u) =>
|
|
5846
|
-
WEIGHT: (r, u) =>
|
|
5847
|
-
SEMIBOLD: (r) =>
|
|
5848
|
-
BOLD: (r) =>
|
|
5849
|
-
BLACK: (r) =>
|
|
5850
|
-
LIGHT: (r) =>
|
|
5851
|
-
STRONG: (r) =>
|
|
5852
|
-
ITALIC: (r) =>
|
|
5853
|
-
UNDERLINE: (r) =>
|
|
5854
|
-
STRIKETHROUGH: (r) =>
|
|
5855
|
-
SUB: (r) =>
|
|
5856
|
-
SUP: (r) =>
|
|
5857
|
-
LARGER: (r) =>
|
|
5858
|
-
SMALL: (r) =>
|
|
5859
|
-
SHADOW: (r, u) =>
|
|
5860
|
-
SIZE: (r, u) =>
|
|
5861
|
-
},
|
|
5849
|
+
if (I = I || U, I) break;
|
|
5850
|
+
}
|
|
5851
|
+
return x ? !I : I;
|
|
5852
|
+
}
|
|
5853
|
+
const F = {
|
|
5854
|
+
COLOR: (r, u) => h(u && i.validate(u) ? `color: ${u}` : "", r, "color"),
|
|
5855
|
+
WEIGHT: (r, u) => h(u && !isNaN(parseInt(u)) ? `font-weight: ${u}` : "", 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, u) => h(`text-shadow: ${u}`, r, "shadow"),
|
|
5869
|
+
SIZE: (r, u) => h(u ? `font-size: ${u}` : "", r, "size")
|
|
5870
|
+
}, Y = {
|
|
5862
5871
|
...{
|
|
5863
|
-
BT1: (r) =>
|
|
5864
|
-
BT0: (r) =>
|
|
5865
|
-
ST1: (r) =>
|
|
5866
|
-
ST0: (r) =>
|
|
5872
|
+
BT1: (r) => J > 1 ? r : "",
|
|
5873
|
+
BT0: (r) => J > 0 ? r : "",
|
|
5874
|
+
ST1: (r) => J < 1 ? r : "",
|
|
5875
|
+
ST0: (r) => J < 0 ? r : "",
|
|
5867
5876
|
UPC: (r) => r.toUpperCase(),
|
|
5868
5877
|
LOW: (r) => r.toLowerCase(),
|
|
5869
5878
|
REV: (r) => r.split("").reverse().join(""),
|
|
5870
5879
|
CAP: (r) => r.charAt(0).toUpperCase() + r.slice(1).toLowerCase(),
|
|
5871
|
-
NUMBER: (r, u,
|
|
5872
|
-
PLURAL: (r, u,
|
|
5873
|
-
DATE: (r, u,
|
|
5874
|
-
MAP: (r, u,
|
|
5875
|
-
ESCAPE: (r) =>
|
|
5876
|
-
IF: (r, u,
|
|
5877
|
-
const
|
|
5878
|
-
if (!I) return
|
|
5879
|
-
const [
|
|
5880
|
-
return
|
|
5881
|
-
|
|
5882
|
-
|
|
5883
|
-
) ?
|
|
5880
|
+
NUMBER: (r, u, v) => T(r, u, v),
|
|
5881
|
+
PLURAL: (r, u, v) => P(r, u, v),
|
|
5882
|
+
DATE: (r, u, v) => j(r, u, v),
|
|
5883
|
+
MAP: (r, u, v) => O(r, u, v),
|
|
5884
|
+
ESCAPE: (r) => z(r),
|
|
5885
|
+
IF: (r, u, v) => {
|
|
5886
|
+
const x = r ?? "", [N, I] = x.split("?", 2);
|
|
5887
|
+
if (!I) return x;
|
|
5888
|
+
const [A, H = ""] = I.split("|", 2);
|
|
5889
|
+
return q(
|
|
5890
|
+
N,
|
|
5891
|
+
v
|
|
5892
|
+
) ? A : H;
|
|
5884
5893
|
},
|
|
5885
5894
|
PRESET: (r, u) => {
|
|
5886
|
-
const
|
|
5887
|
-
if (!
|
|
5888
|
-
const
|
|
5889
|
-
if (!
|
|
5890
|
-
const
|
|
5891
|
-
const [
|
|
5892
|
-
return { name:
|
|
5895
|
+
const v = u?.trim() ?? "";
|
|
5896
|
+
if (!v.length) return r;
|
|
5897
|
+
const x = n.PRESETS[v];
|
|
5898
|
+
if (!x || !x.length) return r;
|
|
5899
|
+
const N = x.split(",").map((A) => A.trim()).filter((A) => A.length).map((A) => {
|
|
5900
|
+
const [H, U] = A.split(":");
|
|
5901
|
+
return { name: H.trim(), param: U?.trim() ?? null };
|
|
5893
5902
|
});
|
|
5894
5903
|
let I = r;
|
|
5895
|
-
for (const { name:
|
|
5896
|
-
I =
|
|
5904
|
+
for (const { name: A, param: H } of N)
|
|
5905
|
+
I = nt(I, A, H);
|
|
5897
5906
|
return I;
|
|
5898
5907
|
},
|
|
5899
5908
|
FALLBACK: (r, u) => r.length ? r : u ?? r
|
|
5900
5909
|
},
|
|
5901
|
-
...
|
|
5902
|
-
...
|
|
5903
|
-
},
|
|
5910
|
+
...d?.html ? F : {},
|
|
5911
|
+
...d.modifiers ?? {}
|
|
5912
|
+
}, ft = {
|
|
5904
5913
|
UPC: ["UPPERCASE", "UPPER", "UPP"],
|
|
5905
5914
|
LOW: ["LOWERCASE", "LOWER", "LWC"],
|
|
5906
5915
|
REV: ["REVERSE", "RVS"],
|
|
@@ -5928,77 +5937,77 @@ var w;
|
|
|
5928
5937
|
SHADOW: ["SHADOW", "SHD"],
|
|
5929
5938
|
FALLBACK: ["FALLBACK", "FB"],
|
|
5930
5939
|
IF: ["IF", "COND", "CONDITION"],
|
|
5931
|
-
...
|
|
5940
|
+
...d.aliases ?? {}
|
|
5932
5941
|
};
|
|
5933
|
-
function
|
|
5934
|
-
const
|
|
5942
|
+
function nt(r, u, v) {
|
|
5943
|
+
const x = Object.entries(ft).find(([I, A]) => A.some((H) => H.toUpperCase() === u.toUpperCase()) ? !0 : I.toUpperCase() === u.toUpperCase()), N = x ? x[0] : u.toUpperCase();
|
|
5935
5944
|
try {
|
|
5936
|
-
return
|
|
5945
|
+
return Y[N] ? Y[N](r, typeof v == "string" ? v.trim() : null, k) : d?.html ? h("", r, N.toLowerCase()) : r;
|
|
5937
5946
|
} catch (I) {
|
|
5938
|
-
return
|
|
5947
|
+
return d?.debug && typeof console < "u" && typeof console.error == "function" && console.error("[Helper.string.compose] Modifier error", { name: u, param: v, error: I }), r;
|
|
5939
5948
|
}
|
|
5940
5949
|
}
|
|
5941
|
-
function
|
|
5942
|
-
let u = r,
|
|
5943
|
-
for (; (
|
|
5944
|
-
const [
|
|
5945
|
-
const [
|
|
5946
|
-
return { name:
|
|
5950
|
+
function dt(r) {
|
|
5951
|
+
let u = r, v;
|
|
5952
|
+
for (; (v = S.MODIFIERS.exec(u)) !== null; ) {
|
|
5953
|
+
const [x, N, I] = v, A = N.split(",").map((U) => U.trim()).filter((U) => U.length).map((U) => {
|
|
5954
|
+
const [L, V] = U.split(":");
|
|
5955
|
+
return { name: L.trim(), param: V?.trim() ?? null };
|
|
5947
5956
|
});
|
|
5948
|
-
let
|
|
5949
|
-
for (const { name:
|
|
5950
|
-
|
|
5951
|
-
u = u.replace(
|
|
5957
|
+
let H = dt(I);
|
|
5958
|
+
for (const { name: U, param: L } of A)
|
|
5959
|
+
H = nt(H, U, L);
|
|
5960
|
+
u = u.replace(x, H ?? ""), S.MODIFIERS.lastIndex = 0;
|
|
5952
5961
|
}
|
|
5953
5962
|
return u;
|
|
5954
5963
|
}
|
|
5955
|
-
function
|
|
5964
|
+
function ht(r) {
|
|
5956
5965
|
let u = 0;
|
|
5957
|
-
const
|
|
5958
|
-
function
|
|
5959
|
-
let
|
|
5960
|
-
for (; u <
|
|
5966
|
+
const v = r.length;
|
|
5967
|
+
function x(I) {
|
|
5968
|
+
let A = "";
|
|
5969
|
+
for (; u < v; )
|
|
5961
5970
|
if (r[u] === "\\")
|
|
5962
|
-
u + 1 <
|
|
5971
|
+
u + 1 < v ? (A += r[u + 1], u += 2) : u++;
|
|
5963
5972
|
else if (r[u] === "[" && (!I || I !== "["))
|
|
5964
|
-
|
|
5973
|
+
A += N();
|
|
5965
5974
|
else if (I && r[u] === I) {
|
|
5966
5975
|
u++;
|
|
5967
5976
|
break;
|
|
5968
5977
|
} else
|
|
5969
|
-
|
|
5970
|
-
return
|
|
5978
|
+
A += r[u++];
|
|
5979
|
+
return A;
|
|
5971
5980
|
}
|
|
5972
|
-
function
|
|
5981
|
+
function N() {
|
|
5973
5982
|
u++;
|
|
5974
5983
|
const I = [];
|
|
5975
|
-
for (; u <
|
|
5984
|
+
for (; u < v && r[u] !== "="; ) {
|
|
5976
5985
|
if (r[u] === ",") {
|
|
5977
5986
|
u++;
|
|
5978
5987
|
continue;
|
|
5979
5988
|
}
|
|
5980
|
-
let
|
|
5981
|
-
for (; u <
|
|
5982
|
-
let
|
|
5989
|
+
let H = "";
|
|
5990
|
+
for (; u < v && /[A-Za-z0-9]/.test(r[u]); ) H += r[u++];
|
|
5991
|
+
let U = null;
|
|
5983
5992
|
if (r[u] === ":") {
|
|
5984
5993
|
u++;
|
|
5985
|
-
const
|
|
5986
|
-
for (; u <
|
|
5987
|
-
|
|
5994
|
+
const L = u;
|
|
5995
|
+
for (; u < v && r[u] !== "," && r[u] !== "="; ) u++;
|
|
5996
|
+
U = r.slice(L, u);
|
|
5988
5997
|
}
|
|
5989
|
-
|
|
5998
|
+
H.length && I.push({ name: H, param: U }), r[u] === "," && u++;
|
|
5990
5999
|
}
|
|
5991
6000
|
r[u] === "=" && u++;
|
|
5992
|
-
const
|
|
5993
|
-
return I.reduce((
|
|
6001
|
+
const A = x("]");
|
|
6002
|
+
return I.reduce((H, { name: U, param: L }) => nt(H, U, L), A);
|
|
5994
6003
|
}
|
|
5995
|
-
return
|
|
6004
|
+
return x();
|
|
5996
6005
|
}
|
|
5997
|
-
let
|
|
5998
|
-
|
|
5999
|
-
(r, u) => typeof
|
|
6006
|
+
let K = p.replace(
|
|
6007
|
+
S.PLACEHOLDERS,
|
|
6008
|
+
(r, u) => typeof k[u] == "string" || typeof k[u] == "number" ? String(k[u]) : u ?? u
|
|
6000
6009
|
);
|
|
6001
|
-
return
|
|
6010
|
+
return K = d.method === "loop" ? dt(K) : ht(K), K;
|
|
6002
6011
|
}
|
|
6003
6012
|
n.compose = b;
|
|
6004
6013
|
})(l.string || (l.string = {})), ((n) => {
|
|
@@ -6008,11 +6017,11 @@ var w;
|
|
|
6008
6017
|
throw new Error("No sound URL provided");
|
|
6009
6018
|
try {
|
|
6010
6019
|
p && n.playing && n.audio && n.audio.state !== "closed" && n.audio.close();
|
|
6011
|
-
let o = new AudioContext(),
|
|
6012
|
-
|
|
6020
|
+
let o = new AudioContext(), d = o.createGain();
|
|
6021
|
+
d.connect(o.destination), p && (n.audio = o, n.playing = !0), fetch(c).then((f) => f.arrayBuffer()).then((f) => o.decodeAudioData(f)).then((f) => {
|
|
6013
6022
|
if (o.state !== "closed") {
|
|
6014
|
-
const
|
|
6015
|
-
|
|
6023
|
+
const h = o.createBufferSource();
|
|
6024
|
+
h.buffer = f, h.connect(d), d.gain.value = b / 100, h.start(o.currentTime);
|
|
6016
6025
|
}
|
|
6017
6026
|
});
|
|
6018
6027
|
} catch (o) {
|
|
@@ -6023,10 +6032,10 @@ var w;
|
|
|
6023
6032
|
})(l.sound || (l.sound = {}));
|
|
6024
6033
|
let i;
|
|
6025
6034
|
((n) => {
|
|
6026
|
-
function m(o = 100,
|
|
6027
|
-
|
|
6035
|
+
function m(o = 100, d = "") {
|
|
6036
|
+
d = d.length > 7 ? d?.substring(0, 6) : d, o = o > 1 ? o / 100 : o;
|
|
6028
6037
|
let f = Math.round(Math.min(Math.max(o, 0), 1) * 255).toString(16).toLowerCase().padStart(2, "0");
|
|
6029
|
-
return
|
|
6038
|
+
return d + f;
|
|
6030
6039
|
}
|
|
6031
6040
|
n.opacity = m;
|
|
6032
6041
|
function c(o) {
|
|
@@ -6035,42 +6044,42 @@ var w;
|
|
|
6035
6044
|
color: o,
|
|
6036
6045
|
opacity: 100
|
|
6037
6046
|
};
|
|
6038
|
-
var
|
|
6047
|
+
var h = o.slice(-2), d = parseInt(h, 16) / 255, f = Math.round(d * 100), h = o.length > 7 ? o.slice(0, 7) : o;
|
|
6039
6048
|
return {
|
|
6040
|
-
color:
|
|
6049
|
+
color: h,
|
|
6041
6050
|
opacity: f
|
|
6042
6051
|
};
|
|
6043
6052
|
}
|
|
6044
6053
|
n.extract = c;
|
|
6045
6054
|
function b(o) {
|
|
6046
6055
|
if (typeof o != "string" || !String(o).trim().length) return !1;
|
|
6047
|
-
const
|
|
6048
|
-
return /^#([A-Fa-f0-9]{3}){1,2}$/.test(
|
|
6056
|
+
const d = o.trim();
|
|
6057
|
+
return /^#([A-Fa-f0-9]{3}){1,2}$/.test(d) || /^#([A-Fa-f0-9]{4}|[A-Fa-f0-9]{8})$/.test(d) ? "hex" : /^rgb\(\s*(?:\d{1,3}\s*,\s*){2}\d{1,3}\s*\)$/.test(d) ? "rgb" : /^rgba\(\s*(?:\d{1,3}\s*,\s*){3}(?:0|1|0?\.\d+)\s*\)$/.test(d) ? "rgba" : /^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/.test(d) ? "hsl" : /^hsla\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*,\s*(?:0|1|0?\.\d+)\s*\)$/.test(d) ? "hsla" : M.css_color_names.includes(d.toLowerCase()) ? "css-color-name" : !1;
|
|
6049
6058
|
}
|
|
6050
6059
|
n.validate = b;
|
|
6051
|
-
async function p(o,
|
|
6060
|
+
async function p(o, d) {
|
|
6052
6061
|
const f = b(o);
|
|
6053
6062
|
if (!f) throw new Error(`Invalid color format: ${o}`);
|
|
6054
|
-
if (f ===
|
|
6055
|
-
const
|
|
6056
|
-
if (!
|
|
6057
|
-
switch (
|
|
6063
|
+
if (f === d) throw new Error(`Color is already in the desired format: ${d}`);
|
|
6064
|
+
const h = bt(o.trim(), f);
|
|
6065
|
+
if (!h) throw new Error(`Failed to parse color: ${o}`);
|
|
6066
|
+
switch (d) {
|
|
6058
6067
|
case "hex":
|
|
6059
|
-
return
|
|
6068
|
+
return yt(h, !1);
|
|
6060
6069
|
case "rgb":
|
|
6061
|
-
return `rgb(${
|
|
6070
|
+
return `rgb(${h.r}, ${h.g}, ${h.b})`;
|
|
6062
6071
|
case "rgba":
|
|
6063
|
-
return `rgba(${
|
|
6072
|
+
return `rgba(${h.r}, ${h.g}, ${h.b}, ${h.a})`;
|
|
6064
6073
|
case "hsl": {
|
|
6065
|
-
const g = lt(
|
|
6074
|
+
const g = lt(h.r, h.g, h.b);
|
|
6066
6075
|
return `hsl(${g.h}, ${g.s}%, ${g.l}%)`;
|
|
6067
6076
|
}
|
|
6068
6077
|
case "hsla": {
|
|
6069
|
-
const g = lt(
|
|
6070
|
-
return `hsla(${g.h}, ${g.s}%, ${g.l}%, ${
|
|
6078
|
+
const g = lt(h.r, h.g, h.b);
|
|
6079
|
+
return `hsla(${g.h}, ${g.s}%, ${g.l}%, ${h.a})`;
|
|
6071
6080
|
}
|
|
6072
6081
|
case "css-color-name":
|
|
6073
|
-
return await
|
|
6082
|
+
return await vt(h.r, h.g, h.b);
|
|
6074
6083
|
default:
|
|
6075
6084
|
return null;
|
|
6076
6085
|
}
|
|
@@ -6085,36 +6094,36 @@ var w;
|
|
|
6085
6094
|
case "hex":
|
|
6086
6095
|
return `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")}`;
|
|
6087
6096
|
case "hexa": {
|
|
6088
|
-
const
|
|
6089
|
-
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;
|
|
6090
6099
|
}
|
|
6091
6100
|
case "rgb": {
|
|
6092
|
-
const
|
|
6093
|
-
return `rgb(${
|
|
6101
|
+
const C = Math.floor(Math.random() * 256), k = Math.floor(Math.random() * 256), S = Math.floor(Math.random() * 256);
|
|
6102
|
+
return `rgb(${C}, ${k}, ${S})`;
|
|
6094
6103
|
}
|
|
6095
6104
|
case "rgba": {
|
|
6096
|
-
const
|
|
6097
|
-
return `rgba(${
|
|
6105
|
+
const C = Math.floor(Math.random() * 256), k = Math.floor(Math.random() * 256), S = Math.floor(Math.random() * 256), J = Math.random().toFixed(2);
|
|
6106
|
+
return `rgba(${C}, ${k}, ${S}, ${J})`;
|
|
6098
6107
|
}
|
|
6099
6108
|
case "hsl": {
|
|
6100
|
-
const
|
|
6101
|
-
return `hsl(${
|
|
6109
|
+
const C = Math.floor(Math.random() * 361), k = Math.floor(Math.random() * 101), S = Math.floor(Math.random() * 101);
|
|
6110
|
+
return `hsl(${C}, ${k}%, ${S}%)`;
|
|
6102
6111
|
}
|
|
6103
6112
|
case "hsla": {
|
|
6104
|
-
const
|
|
6105
|
-
return `hsla(${
|
|
6113
|
+
const C = Math.floor(Math.random() * 361), k = Math.floor(Math.random() * 101), S = Math.floor(Math.random() * 101), J = Math.random().toFixed(2);
|
|
6114
|
+
return `hsla(${C}, ${k}%, ${S}%, ${J})`;
|
|
6106
6115
|
}
|
|
6107
6116
|
case "css-color-name": {
|
|
6108
|
-
var y =
|
|
6117
|
+
var y = M.css_color_names;
|
|
6109
6118
|
return o(y)[0];
|
|
6110
6119
|
}
|
|
6111
6120
|
}
|
|
6112
6121
|
}
|
|
6113
6122
|
n.color = m;
|
|
6114
|
-
function c(g, y,
|
|
6123
|
+
function c(g, y, C = 0) {
|
|
6115
6124
|
g > y && ([g, y] = [y, g]);
|
|
6116
|
-
const
|
|
6117
|
-
return
|
|
6125
|
+
const k = Math.random() * (y - g) + g;
|
|
6126
|
+
return C ? Number(k.toFixed(C)) : Math.round(k);
|
|
6118
6127
|
}
|
|
6119
6128
|
n.number = c;
|
|
6120
6129
|
function b(g = 0.5) {
|
|
@@ -6122,10 +6131,10 @@ var w;
|
|
|
6122
6131
|
}
|
|
6123
6132
|
n.boolean = b;
|
|
6124
6133
|
function p(g, y = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") {
|
|
6125
|
-
let
|
|
6126
|
-
for (let
|
|
6127
|
-
|
|
6128
|
-
return
|
|
6134
|
+
let C = "";
|
|
6135
|
+
for (let k = 0; k < g; k++)
|
|
6136
|
+
C += y.charAt(Math.floor(Math.random() * y.length));
|
|
6137
|
+
return C;
|
|
6129
6138
|
}
|
|
6130
6139
|
n.string = p;
|
|
6131
6140
|
function o(g) {
|
|
@@ -6133,19 +6142,19 @@ var w;
|
|
|
6133
6142
|
return [g[y], y];
|
|
6134
6143
|
}
|
|
6135
6144
|
n.array = o;
|
|
6136
|
-
function
|
|
6145
|
+
function d(g = new Date(2e3, 0, 1), y = /* @__PURE__ */ new Date()) {
|
|
6137
6146
|
return new Date(c(g.getTime(), y.getTime()));
|
|
6138
6147
|
}
|
|
6139
|
-
n.date =
|
|
6148
|
+
n.date = d;
|
|
6140
6149
|
function f(g) {
|
|
6141
|
-
const
|
|
6142
|
-
return new Date(
|
|
6150
|
+
const C = Date.now() - c(0, g * 24 * 60 * 60 * 1e3);
|
|
6151
|
+
return new Date(C).toISOString();
|
|
6143
6152
|
}
|
|
6144
6153
|
n.daysOffset = f;
|
|
6145
|
-
function
|
|
6154
|
+
function h() {
|
|
6146
6155
|
return crypto.randomUUID();
|
|
6147
6156
|
}
|
|
6148
|
-
n.uuid =
|
|
6157
|
+
n.uuid = h;
|
|
6149
6158
|
})(s = l.random || (l.random = {})), ((n) => {
|
|
6150
6159
|
function m(b, p, o) {
|
|
6151
6160
|
return b.apply(p, o);
|
|
@@ -6156,42 +6165,42 @@ var w;
|
|
|
6156
6165
|
}
|
|
6157
6166
|
n.call = c;
|
|
6158
6167
|
})(l.fn || (l.fn = {})), ((n) => {
|
|
6159
|
-
function m(
|
|
6168
|
+
function m(d, f) {
|
|
6160
6169
|
return new Promise(
|
|
6161
|
-
(
|
|
6170
|
+
(h) => setTimeout(() => {
|
|
6162
6171
|
if (f) {
|
|
6163
6172
|
const g = f();
|
|
6164
|
-
|
|
6165
|
-
} else
|
|
6166
|
-
},
|
|
6173
|
+
h(g ?? null);
|
|
6174
|
+
} else h(null);
|
|
6175
|
+
}, d)
|
|
6167
6176
|
);
|
|
6168
6177
|
}
|
|
6169
6178
|
n.delay = m;
|
|
6170
|
-
function c(
|
|
6171
|
-
return Object.entries(
|
|
6179
|
+
function c(d) {
|
|
6180
|
+
return Object.entries(d);
|
|
6172
6181
|
}
|
|
6173
6182
|
n.typedEntries = c;
|
|
6174
|
-
function b(
|
|
6175
|
-
return Object.values(
|
|
6183
|
+
function b(d) {
|
|
6184
|
+
return Object.values(d);
|
|
6176
6185
|
}
|
|
6177
6186
|
n.typedValues = b;
|
|
6178
|
-
function p(
|
|
6179
|
-
return Object.keys(
|
|
6187
|
+
function p(d) {
|
|
6188
|
+
return Object.keys(d);
|
|
6180
6189
|
}
|
|
6181
6190
|
n.typedKeys = p;
|
|
6182
|
-
function o(
|
|
6183
|
-
const f = Object.values(
|
|
6191
|
+
function o(d) {
|
|
6192
|
+
const f = Object.values(d).reduce((C, k) => C + k, 0), h = c(d).sort((C, k) => k[1] - C[1]), g = Math.random() * f;
|
|
6184
6193
|
let y = 0;
|
|
6185
|
-
for (const [
|
|
6186
|
-
if (y +=
|
|
6187
|
-
return
|
|
6194
|
+
for (const [C, k] of h)
|
|
6195
|
+
if (y += k, g < y)
|
|
6196
|
+
return C;
|
|
6188
6197
|
}
|
|
6189
6198
|
n.probability = o;
|
|
6190
6199
|
})(l.utils || (l.utils = {}));
|
|
6191
6200
|
})(w || (w = {}));
|
|
6192
|
-
class
|
|
6201
|
+
class st {
|
|
6193
6202
|
constructor(e) {
|
|
6194
|
-
this.field = "button", this.template = "button", this.name = "Button", this.value = "", window.client instanceof
|
|
6203
|
+
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"));
|
|
6195
6204
|
}
|
|
6196
6205
|
generate(e) {
|
|
6197
6206
|
return w.utils.typedValues(e).reduce(
|
|
@@ -6226,21 +6235,21 @@ class at {
|
|
|
6226
6235
|
return this;
|
|
6227
6236
|
}
|
|
6228
6237
|
remove() {
|
|
6229
|
-
if (!(window.client instanceof
|
|
6238
|
+
if (!(window.client instanceof G)) return;
|
|
6230
6239
|
const e = window.client.actions.buttons.indexOf(this);
|
|
6231
6240
|
e > -1 && (window.client.actions.buttons.splice(e, 1), window.client.emit("action", this, "removed"));
|
|
6232
6241
|
}
|
|
6233
6242
|
static execute(e, t) {
|
|
6234
6243
|
try {
|
|
6235
|
-
if (!(window.client instanceof
|
|
6244
|
+
if (!(window.client instanceof G)) return !1;
|
|
6236
6245
|
if (window.client.actions.buttons.length) {
|
|
6237
6246
|
const a = window.client.actions.buttons.filter((i) => typeof i.field == "string" ? i.field === e : typeof i.field == "function" ? i.field(e, t) : !1);
|
|
6238
|
-
if (a.length && a.every((i) => i instanceof
|
|
6247
|
+
if (a.length && a.every((i) => i instanceof st))
|
|
6239
6248
|
return a.forEach((i) => {
|
|
6240
6249
|
try {
|
|
6241
|
-
i.parse(e, t), window?.client?.emit("action", i, "executed"),
|
|
6250
|
+
i.parse(e, t), window?.client?.emit("action", i, "executed"), R.received(`Button executed: ${e}${t ? ` with value: ${t}` : ""}`);
|
|
6242
6251
|
} catch (s) {
|
|
6243
|
-
|
|
6252
|
+
R.error(
|
|
6244
6253
|
`Error executing button "${e}": ${s instanceof Error ? s.message : s}`
|
|
6245
6254
|
);
|
|
6246
6255
|
}
|
|
@@ -6253,10 +6262,10 @@ class at {
|
|
|
6253
6262
|
}
|
|
6254
6263
|
}
|
|
6255
6264
|
}
|
|
6256
|
-
const
|
|
6257
|
-
class
|
|
6265
|
+
const it = [];
|
|
6266
|
+
class Dt extends Z {
|
|
6258
6267
|
constructor(e = {}) {
|
|
6259
|
-
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,
|
|
6268
|
+
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, it.push(this), ct?.then(async (t) => {
|
|
6260
6269
|
this.loaded = !0, this.SE_API = t, Promise.all([
|
|
6261
6270
|
async () => {
|
|
6262
6271
|
const a = await t.store.get(this.id);
|
|
@@ -6293,7 +6302,7 @@ class St extends X {
|
|
|
6293
6302
|
}
|
|
6294
6303
|
typeof window !== void 0 && (window.addEventListener("onWidgetLoad", async (l) => {
|
|
6295
6304
|
const { detail: e } = l;
|
|
6296
|
-
if (window.client instanceof
|
|
6305
|
+
if (window.client instanceof G && client instanceof G && client) {
|
|
6297
6306
|
const t = window.client;
|
|
6298
6307
|
if (t.fields = e.fieldData, t.session = e.session.data, t.details = {
|
|
6299
6308
|
...t.details,
|
|
@@ -6307,18 +6316,18 @@ typeof window !== void 0 && (window.addEventListener("onWidgetLoad", async (l) =
|
|
|
6307
6316
|
}).catch(() => {
|
|
6308
6317
|
t.details.provider = "local";
|
|
6309
6318
|
}) : t.details.provider = "local", t.emit("load", e), t.debug) {
|
|
6310
|
-
|
|
6319
|
+
R.received("Widget loaded!", l.detail);
|
|
6311
6320
|
const a = l.detail.fieldData;
|
|
6312
|
-
Object.keys(a).length &&
|
|
6321
|
+
Object.keys(a).length && R.received("Field data:", a);
|
|
6313
6322
|
}
|
|
6314
6323
|
t.loaded = !0, t.storage.on("load", (a) => {
|
|
6315
|
-
if (t.debug && a ?
|
|
6324
|
+
if (t.debug && a ? R.debug(
|
|
6316
6325
|
"[Client]",
|
|
6317
6326
|
"Storage loaded for client",
|
|
6318
6327
|
`"${t.id}";`,
|
|
6319
6328
|
`Provider: "${t.details.provider}";`,
|
|
6320
6329
|
a
|
|
6321
|
-
) : t.debug &&
|
|
6330
|
+
) : t.debug && R.debug(
|
|
6322
6331
|
"[Client]",
|
|
6323
6332
|
"Storage loaded for client",
|
|
6324
6333
|
`"${t.id}";`,
|
|
@@ -6327,10 +6336,10 @@ typeof window !== void 0 && (window.addEventListener("onWidgetLoad", async (l) =
|
|
|
6327
6336
|
), a) {
|
|
6328
6337
|
const i = (b) => {
|
|
6329
6338
|
const p = Date.now(), o = {};
|
|
6330
|
-
for (const
|
|
6331
|
-
if (b.hasOwnProperty(
|
|
6332
|
-
const f = b[
|
|
6333
|
-
f.expire && f.expire > p && (o[
|
|
6339
|
+
for (const d in b)
|
|
6340
|
+
if (b.hasOwnProperty(d)) {
|
|
6341
|
+
const f = b[d];
|
|
6342
|
+
f.expire && f.expire > p && (o[d] = f);
|
|
6334
6343
|
}
|
|
6335
6344
|
return o;
|
|
6336
6345
|
}, s = i(a.user || {}), n = i(a.avatar || {}), m = i(a.pronoun || {}), c = i(a.emote || {});
|
|
@@ -6350,12 +6359,12 @@ typeof window !== void 0 && (window.addEventListener("onWidgetLoad", async (l) =
|
|
|
6350
6359
|
}
|
|
6351
6360
|
}), window.addEventListener("onSessionUpdate", (l) => {
|
|
6352
6361
|
const { detail: e } = l;
|
|
6353
|
-
if (window.client instanceof
|
|
6362
|
+
if (window.client instanceof G && client instanceof G && client) {
|
|
6354
6363
|
const t = window.client;
|
|
6355
|
-
t.session = e.session, t.emit("session", e.session), t.debug &&
|
|
6364
|
+
t.session = e.session, t.emit("session", e.session), t.debug && R.debug("[Client]", "Session updated", e.session);
|
|
6356
6365
|
}
|
|
6357
6366
|
}), window.addEventListener("onEventReceived", ({ detail: l }) => {
|
|
6358
|
-
if (window.client instanceof
|
|
6367
|
+
if (window.client instanceof G && client instanceof G && client) {
|
|
6359
6368
|
const t = w.event.parseProvider(l);
|
|
6360
6369
|
switch (t.provider) {
|
|
6361
6370
|
case "streamelements": {
|
|
@@ -6373,7 +6382,7 @@ typeof window !== void 0 && (window.addEventListener("onWidgetLoad", async (l) =
|
|
|
6373
6382
|
switch (i.event.listener) {
|
|
6374
6383
|
case "widget-button": {
|
|
6375
6384
|
const s = i.event;
|
|
6376
|
-
|
|
6385
|
+
st.execute(s.field, s.value);
|
|
6377
6386
|
break;
|
|
6378
6387
|
}
|
|
6379
6388
|
case "subscriber-latest": {
|
|
@@ -6385,14 +6394,14 @@ typeof window !== void 0 && (window.addEventListener("onWidgetLoad", async (l) =
|
|
|
6385
6394
|
}
|
|
6386
6395
|
case "kvstore:update": {
|
|
6387
6396
|
const s = i.event;
|
|
6388
|
-
if (
|
|
6389
|
-
var e =
|
|
6397
|
+
if (et.length) {
|
|
6398
|
+
var e = et.find(
|
|
6390
6399
|
(n) => n.id === s.data.key.replace("customWidget.", "") || n.id === s.data.key
|
|
6391
6400
|
);
|
|
6392
6401
|
e && e.update(s.data.value);
|
|
6393
6402
|
}
|
|
6394
|
-
if (
|
|
6395
|
-
const n =
|
|
6403
|
+
if (it.length) {
|
|
6404
|
+
const n = it.find(
|
|
6396
6405
|
(m) => m.id === s.data.key.replace("customWidget.", "") || m.id === s.data.key
|
|
6397
6406
|
);
|
|
6398
6407
|
n && n.update(s.data.value);
|
|
@@ -6424,7 +6433,7 @@ typeof window !== void 0 && (window.addEventListener("onWidgetLoad", async (l) =
|
|
|
6424
6433
|
break;
|
|
6425
6434
|
}
|
|
6426
6435
|
case "message": {
|
|
6427
|
-
i.event,
|
|
6436
|
+
i.event, $.execute({ provider: "twitch", data: i });
|
|
6428
6437
|
break;
|
|
6429
6438
|
}
|
|
6430
6439
|
case "follower-latest": {
|
|
@@ -6451,7 +6460,7 @@ typeof window !== void 0 && (window.addEventListener("onWidgetLoad", async (l) =
|
|
|
6451
6460
|
const i = t.data;
|
|
6452
6461
|
switch (i.listener) {
|
|
6453
6462
|
case "message": {
|
|
6454
|
-
i.event,
|
|
6463
|
+
i.event, $.execute({ provider: "youtube", data: i });
|
|
6455
6464
|
break;
|
|
6456
6465
|
}
|
|
6457
6466
|
case "subscriber-latest": {
|
|
@@ -6487,21 +6496,21 @@ typeof window !== void 0 && (window.addEventListener("onWidgetLoad", async (l) =
|
|
|
6487
6496
|
"event:test",
|
|
6488
6497
|
"kvstore:update"
|
|
6489
6498
|
];
|
|
6490
|
-
client.debug && !a.some((i) => i === t.data.listener) &&
|
|
6499
|
+
client.debug && !a.some((i) => i === t.data.listener) && R.received(
|
|
6491
6500
|
"[Client]",
|
|
6492
6501
|
`Event ${t.data.listener} received from ${t.provider}`,
|
|
6493
6502
|
t.data.event
|
|
6494
6503
|
);
|
|
6495
6504
|
}
|
|
6496
6505
|
}));
|
|
6497
|
-
class gt extends
|
|
6506
|
+
class gt extends Z {
|
|
6498
6507
|
constructor(e) {
|
|
6499
6508
|
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")
|
|
6500
6509
|
throw new Error("A valid processor function must be provided to useQueue.");
|
|
6501
6510
|
this.processor = e.processor, e.duration !== "client" && (this.duration = e.duration ?? 0), this.waitForClientAndBindLoad(e.duration);
|
|
6502
6511
|
}
|
|
6503
6512
|
waitForClientAndBindLoad(e = this.duration, t) {
|
|
6504
|
-
if (!(window?.client instanceof
|
|
6513
|
+
if (!(window?.client instanceof G)) {
|
|
6505
6514
|
setTimeout(
|
|
6506
6515
|
() => this.waitForClientAndBindLoad(e, t),
|
|
6507
6516
|
this.clientWaitRetryDelay
|
|
@@ -6542,7 +6551,7 @@ class gt extends X {
|
|
|
6542
6551
|
try {
|
|
6543
6552
|
await this.processor.apply(this, [e.value, this]), this.emit("process", e, this);
|
|
6544
6553
|
} catch (a) {
|
|
6545
|
-
|
|
6554
|
+
R.error(
|
|
6546
6555
|
`Error during item processing: ${a instanceof Error ? a.message : String(a)}`
|
|
6547
6556
|
);
|
|
6548
6557
|
}
|
|
@@ -6595,14 +6604,14 @@ class gt extends X {
|
|
|
6595
6604
|
return e === "load" && this.loaded ? (t.apply(this), this) : (super.on(e, t), this);
|
|
6596
6605
|
}
|
|
6597
6606
|
}
|
|
6598
|
-
var
|
|
6607
|
+
var B;
|
|
6599
6608
|
((l) => {
|
|
6600
6609
|
l.queue = new gt({
|
|
6601
6610
|
duration: "client",
|
|
6602
6611
|
processor: async function(a) {
|
|
6603
6612
|
if (window.dispatchEvent(new CustomEvent(a.listener, { detail: a.data })), a.listener === "onEventReceived" && a.session) {
|
|
6604
6613
|
const i = await l.generate.event.onSessionUpdate(
|
|
6605
|
-
window?.client && window?.client instanceof
|
|
6614
|
+
window?.client && window?.client instanceof G ? window.client.session : void 0,
|
|
6606
6615
|
w.event.parseProvider(a.data)
|
|
6607
6616
|
);
|
|
6608
6617
|
window.dispatchEvent(new CustomEvent("onSessionUpdate", { detail: i }));
|
|
@@ -6611,11 +6620,11 @@ var G;
|
|
|
6611
6620
|
}), l.generate = {
|
|
6612
6621
|
session: {
|
|
6613
6622
|
types: {
|
|
6614
|
-
name: { type: "string", options:
|
|
6615
|
-
tier: { type: "string", options:
|
|
6616
|
-
message: { type: "string", options:
|
|
6617
|
-
item: { type: "array", options:
|
|
6618
|
-
avatar: { type: "string", options:
|
|
6623
|
+
name: { type: "string", options: M.names.filter((t) => t.length) },
|
|
6624
|
+
tier: { type: "string", options: M.tiers.filter((t) => t.length) },
|
|
6625
|
+
message: { type: "string", options: M.messages.filter((t) => t.length) },
|
|
6626
|
+
item: { type: "array", options: M.items },
|
|
6627
|
+
avatar: { type: "string", options: M.avatars.filter((t) => t.length) }
|
|
6619
6628
|
},
|
|
6620
6629
|
available() {
|
|
6621
6630
|
const t = this.types;
|
|
@@ -6989,16 +6998,16 @@ var G;
|
|
|
6989
6998
|
const m = (p) => {
|
|
6990
6999
|
if (!p || !("amount" in p)) return [];
|
|
6991
7000
|
const o = [];
|
|
6992
|
-
for (let
|
|
7001
|
+
for (let d = 0; d < p.amount; d++)
|
|
6993
7002
|
o.push(i(p.value));
|
|
6994
7003
|
return o.sort(
|
|
6995
|
-
(
|
|
7004
|
+
(d, f) => new Date(f.createdAt).getTime() - new Date(d.createdAt).getTime()
|
|
6996
7005
|
);
|
|
6997
7006
|
}, c = (p) => {
|
|
6998
7007
|
const o = {};
|
|
6999
|
-
for (const
|
|
7000
|
-
const f =
|
|
7001
|
-
o[f] = i(p[
|
|
7008
|
+
for (const d in p) {
|
|
7009
|
+
const f = d.replace("_type", "type");
|
|
7010
|
+
o[f] = i(p[d]);
|
|
7002
7011
|
}
|
|
7003
7012
|
return o;
|
|
7004
7013
|
}, b = (p) => {
|
|
@@ -7094,8 +7103,8 @@ var G;
|
|
|
7094
7103
|
}
|
|
7095
7104
|
const o = t[`cheer-${p}-top-donation`];
|
|
7096
7105
|
o && n > o.amount && (o.amount = n, o.name = m);
|
|
7097
|
-
const
|
|
7098
|
-
|
|
7106
|
+
const d = t[`cheer-${p}-top-donator`], f = t["cheer-recent"].filter((g) => g.name.toLowerCase() === d.name.toLowerCase()).reduce((g, y) => g + y.amount, 0), h = t["cheer-recent"].filter((g) => g.name.toLowerCase() === m.toLowerCase()).reduce((g, y) => g + y.amount, 0);
|
|
7107
|
+
h > f && (d.amount = h, d.name = m);
|
|
7099
7108
|
};
|
|
7100
7109
|
b("all"), t["cheer-session"].amount += n, t["cheer-week"].amount += n, t["cheer-month"].amount += n, t["cheer-total"].amount += n, t["cheer-count"].count += 1, t["cheer-goal"].amount += n, t["cheer-recent"].unshift({
|
|
7101
7110
|
name: m,
|
|
@@ -7172,8 +7181,8 @@ var G;
|
|
|
7172
7181
|
}
|
|
7173
7182
|
const p = t[`superchat-${b}-top-donation`];
|
|
7174
7183
|
p && m > p.amount && (p.amount = m, p.name = n);
|
|
7175
|
-
const o = t[`superchat-${b}-top-donator`],
|
|
7176
|
-
f >
|
|
7184
|
+
const o = t[`superchat-${b}-top-donator`], d = t["superchat-recent"].filter((h) => h.name.toLowerCase() === o.name.toLowerCase()).reduce((h, g) => h + g.amount, 0), f = t["superchat-recent"].filter((h) => h.name.toLowerCase() === n.toLowerCase()).reduce((h, g) => h + g.amount, 0);
|
|
7185
|
+
f > d && (o.amount = f, o.name = n);
|
|
7177
7186
|
};
|
|
7178
7187
|
c("all"), t["superchat-session"].amount += m, t["superchat-week"].amount += m, t["superchat-month"].amount += m, t["superchat-total"].amount += m, t["superchat-count"].count += 1, t["superchat-goal"].amount += m, t["superchat-recent"].unshift({
|
|
7179
7188
|
name: n.toLowerCase(),
|
|
@@ -7201,8 +7210,8 @@ var G;
|
|
|
7201
7210
|
}
|
|
7202
7211
|
const p = t[`tip-${b}-top-donation`];
|
|
7203
7212
|
p && m > p.amount && (p.amount = m, p.name = n);
|
|
7204
|
-
const o = t[`tip-${b}-top-donator`],
|
|
7205
|
-
f >
|
|
7213
|
+
const o = t[`tip-${b}-top-donator`], d = t["tip-recent"].filter((h) => h.name.toLowerCase() === o.name.toLowerCase()).reduce((h, g) => h + g.amount, 0), f = t["tip-recent"].filter((h) => h.name.toLowerCase() === n.toLowerCase()).reduce((h, g) => h + g.amount, 0);
|
|
7214
|
+
f > d && (o.amount = f, o.name = n);
|
|
7206
7215
|
};
|
|
7207
7216
|
c("all"), t["tip-session"].amount += m, t["tip-week"].amount += m, t["tip-month"].amount += m, t["tip-total"].amount += m, t["tip-count"].count += 1, t["tip-goal"].amount += m, t["tip-recent"].unshift({
|
|
7208
7217
|
name: n,
|
|
@@ -7249,7 +7258,7 @@ var G;
|
|
|
7249
7258
|
default:
|
|
7250
7259
|
case "random": {
|
|
7251
7260
|
var n = w.random.array(
|
|
7252
|
-
Object.keys(s).filter((
|
|
7261
|
+
Object.keys(s).filter((D) => s[D].length)
|
|
7253
7262
|
)[0], m = w.random.array(
|
|
7254
7263
|
s[n]
|
|
7255
7264
|
)[0];
|
|
@@ -7265,10 +7274,22 @@ var G;
|
|
|
7265
7274
|
return this.onEventReceived(t, m);
|
|
7266
7275
|
}
|
|
7267
7276
|
case "message": {
|
|
7268
|
-
|
|
7269
|
-
|
|
7270
|
-
|
|
7271
|
-
|
|
7277
|
+
const D = i;
|
|
7278
|
+
var c = D?.name ?? w.random.array(M.names.filter((q) => q.length))[0], b = D?.message ?? w.random.array(M.messages.filter((q) => q.length))[0], p = await w.message.generateBadges(D?.badges ?? [], t), o = w.message.findEmotesInText(b), d = w.message.replaceEmotesWithHTML(b, o), f = D?.color ?? w.random.color("hex"), h = D?.userId ?? w.random.string(16), g = D?.msgId ?? w.random.string(16), y = D?.time ?? Date.now(), C = D?.channel ?? window?.client?.details?.user?.username ?? "local", k = D?.reply ? {
|
|
7279
|
+
"reply-parent-display-name": D.reply.name,
|
|
7280
|
+
"reply-parent-msg-body": D.reply.text,
|
|
7281
|
+
"reply-parent-msg-id": D.reply.msgId,
|
|
7282
|
+
"reply-parent-user-id": D.reply.userId,
|
|
7283
|
+
"reply-parent-user-login": D.reply.name.toLowerCase()
|
|
7284
|
+
} : {}, S = D?.thread ? {
|
|
7285
|
+
"reply-thread-parent-msg-id": D.thread.msgId,
|
|
7286
|
+
"reply-thread-parent-user-login": D.thread.name.toLowerCase()
|
|
7287
|
+
} : {}, J = {
|
|
7288
|
+
vip: p.keys.includes("vip") ? "" : void 0,
|
|
7289
|
+
subscriber: p.keys.includes("subscriber") ? "1" : "0",
|
|
7290
|
+
mod: p.keys.includes("moderator") ? "1" : "0",
|
|
7291
|
+
turbo: p.keys.includes("turbo") ? "1" : "0"
|
|
7292
|
+
};
|
|
7272
7293
|
return {
|
|
7273
7294
|
listener: "message",
|
|
7274
7295
|
event: {
|
|
@@ -7276,13 +7297,11 @@ var G;
|
|
|
7276
7297
|
data: {
|
|
7277
7298
|
time: y,
|
|
7278
7299
|
tags: {
|
|
7279
|
-
"badge-info": `${p.keys.map((
|
|
7280
|
-
badges: p.keys.join("
|
|
7281
|
-
|
|
7282
|
-
subscriber: p.keys.includes("subscriber") ? "1" : "0",
|
|
7283
|
-
turbo: p.keys.includes("turbo") ? "1" : "0",
|
|
7300
|
+
"badge-info": `${p.keys.map((q) => `${q}/${p.amount[q] ?? w.random.number(1, 5)}`).join(",")}`,
|
|
7301
|
+
badges: p.keys.map((q) => `${q}/1`).join(","),
|
|
7302
|
+
...J,
|
|
7284
7303
|
"tmi-sent-ts": y.toString(),
|
|
7285
|
-
"user-id":
|
|
7304
|
+
"user-id": h,
|
|
7286
7305
|
"user-type": "",
|
|
7287
7306
|
color: f,
|
|
7288
7307
|
"display-name": c,
|
|
@@ -7290,21 +7309,23 @@ var G;
|
|
|
7290
7309
|
"client-nonce": w.random.string(16),
|
|
7291
7310
|
flags: "",
|
|
7292
7311
|
id: g,
|
|
7293
|
-
"first-msg": "0",
|
|
7294
|
-
"returning-chatter": "0"
|
|
7312
|
+
"first-msg": D?.firstMsg ? "1" : "0",
|
|
7313
|
+
"returning-chatter": D?.returningChatter ? "1" : "0",
|
|
7314
|
+
...k,
|
|
7315
|
+
...S
|
|
7295
7316
|
},
|
|
7296
7317
|
nick: c.toLowerCase(),
|
|
7297
7318
|
displayName: c,
|
|
7298
7319
|
displayColor: f,
|
|
7299
|
-
channel:
|
|
7320
|
+
channel: C,
|
|
7300
7321
|
text: b,
|
|
7301
7322
|
isAction: !1,
|
|
7302
|
-
userId:
|
|
7323
|
+
userId: h,
|
|
7303
7324
|
msgId: g,
|
|
7304
7325
|
badges: p.badges,
|
|
7305
7326
|
emotes: o
|
|
7306
7327
|
},
|
|
7307
|
-
renderedText:
|
|
7328
|
+
renderedText: d
|
|
7308
7329
|
},
|
|
7309
7330
|
// @ts-ignore
|
|
7310
7331
|
emulated: !0
|
|
@@ -7312,12 +7333,12 @@ var G;
|
|
|
7312
7333
|
}
|
|
7313
7334
|
case "cheer":
|
|
7314
7335
|
case "cheer-latest": {
|
|
7315
|
-
var
|
|
7336
|
+
var E = i?.amount ?? w.random.number(100, 1e4), T = i?.avatar ?? w.random.array(M.avatars)[0], c = i?.name ?? w.random.array(M.names.filter((F) => F.length))[0], b = i?.message ?? w.random.array(M.messages.filter((F) => F.length))[0];
|
|
7316
7337
|
return {
|
|
7317
7338
|
listener: "cheer-latest",
|
|
7318
7339
|
event: {
|
|
7319
|
-
amount:
|
|
7320
|
-
avatar:
|
|
7340
|
+
amount: E,
|
|
7341
|
+
avatar: T,
|
|
7321
7342
|
name: c.toLowerCase(),
|
|
7322
7343
|
displayName: c,
|
|
7323
7344
|
message: b,
|
|
@@ -7334,11 +7355,11 @@ var G;
|
|
|
7334
7355
|
}
|
|
7335
7356
|
case "follower":
|
|
7336
7357
|
case "follower-latest": {
|
|
7337
|
-
var
|
|
7358
|
+
var T = i?.avatar ?? w.random.array(M.avatars)[0], c = i?.name ?? w.random.array(M.names.filter((F) => F.length))[0];
|
|
7338
7359
|
return {
|
|
7339
7360
|
listener: "follower-latest",
|
|
7340
7361
|
event: {
|
|
7341
|
-
avatar:
|
|
7362
|
+
avatar: T,
|
|
7342
7363
|
name: c.toLowerCase(),
|
|
7343
7364
|
displayName: c,
|
|
7344
7365
|
providerId: "",
|
|
@@ -7354,12 +7375,12 @@ var G;
|
|
|
7354
7375
|
}
|
|
7355
7376
|
case "raid":
|
|
7356
7377
|
case "raid-latest": {
|
|
7357
|
-
var
|
|
7378
|
+
var E = i?.amount ?? w.random.number(1, 100), T = i?.avatar ?? w.random.array(M.avatars)[0], c = i?.name ?? w.random.array(M.names.filter((Q) => Q.length))[0];
|
|
7358
7379
|
return {
|
|
7359
7380
|
listener: "raid-latest",
|
|
7360
7381
|
event: {
|
|
7361
|
-
amount:
|
|
7362
|
-
avatar:
|
|
7382
|
+
amount: E,
|
|
7383
|
+
avatar: T,
|
|
7363
7384
|
name: c.toLowerCase(),
|
|
7364
7385
|
displayName: c,
|
|
7365
7386
|
providerId: "",
|
|
@@ -7375,36 +7396,36 @@ var G;
|
|
|
7375
7396
|
}
|
|
7376
7397
|
case "subscriber":
|
|
7377
7398
|
case "subscriber-latest": {
|
|
7378
|
-
var
|
|
7399
|
+
var _ = i?.tier ?? w.random.array(["1000", "2000", "3000", "prime"])[0], E = i?.amount ?? w.random.number(1, 24), T = i?.avatar ?? w.random.array(M.avatars)[0], c = i?.name ?? w.random.array(M.names.filter((Y) => Y.length))[0], j = i?.sender ?? w.random.array(M.names.filter((Y) => Y.length && Y !== c))[0], b = i?.message ?? w.random.array(M.messages.filter((Y) => Y.length))[0], P = {
|
|
7379
7400
|
default: {
|
|
7380
|
-
avatar:
|
|
7401
|
+
avatar: T,
|
|
7381
7402
|
playedAsCommunityGift: !1
|
|
7382
7403
|
},
|
|
7383
7404
|
gift: {
|
|
7384
|
-
sender:
|
|
7405
|
+
sender: j,
|
|
7385
7406
|
gifted: !0
|
|
7386
7407
|
},
|
|
7387
7408
|
community: {
|
|
7388
7409
|
message: b,
|
|
7389
|
-
sender:
|
|
7410
|
+
sender: j,
|
|
7390
7411
|
bulkGifted: !0
|
|
7391
7412
|
},
|
|
7392
7413
|
spam: {
|
|
7393
|
-
sender:
|
|
7414
|
+
sender: j,
|
|
7394
7415
|
gifted: !0,
|
|
7395
7416
|
isCommunityGift: !0
|
|
7396
7417
|
}
|
|
7397
|
-
},
|
|
7398
|
-
return
|
|
7418
|
+
}, O = ["default", "gift", "community", "spam"], z = i?.subType ?? w.random.array(O)[0];
|
|
7419
|
+
return z = O.includes(z) ? z : "default", {
|
|
7399
7420
|
listener: "subscriber-latest",
|
|
7400
7421
|
event: {
|
|
7401
|
-
amount:
|
|
7422
|
+
amount: E,
|
|
7402
7423
|
name: c.toLowerCase(),
|
|
7403
7424
|
displayName: c,
|
|
7404
7425
|
providerId: "",
|
|
7405
|
-
tier:
|
|
7406
|
-
...
|
|
7407
|
-
...
|
|
7426
|
+
tier: _,
|
|
7427
|
+
...P.default,
|
|
7428
|
+
...P[z],
|
|
7408
7429
|
_id: w.random.uuid(),
|
|
7409
7430
|
sessionTop: !1,
|
|
7410
7431
|
type: "subscriber",
|
|
@@ -7447,12 +7468,12 @@ var G;
|
|
|
7447
7468
|
}
|
|
7448
7469
|
case "tip":
|
|
7449
7470
|
case "tip-latest": {
|
|
7450
|
-
var
|
|
7471
|
+
var E = i?.amount ?? w.random.number(100, 4e3), T = i?.avatar ?? w.random.array(M.avatars)[0], c = i?.name ?? w.random.array(M.names.filter((Q) => Q.length))[0];
|
|
7451
7472
|
return {
|
|
7452
7473
|
listener: "tip-latest",
|
|
7453
7474
|
event: {
|
|
7454
|
-
amount:
|
|
7455
|
-
avatar:
|
|
7475
|
+
amount: E,
|
|
7476
|
+
avatar: T,
|
|
7456
7477
|
name: c.toLowerCase(),
|
|
7457
7478
|
displayName: c,
|
|
7458
7479
|
providerId: "",
|
|
@@ -7493,11 +7514,11 @@ var G;
|
|
|
7493
7514
|
case "mute":
|
|
7494
7515
|
case "unmute":
|
|
7495
7516
|
case "alertService:toggleSound": {
|
|
7496
|
-
var
|
|
7517
|
+
var W = i?.muted ?? window?.client?.details?.overlay?.muted ?? !1;
|
|
7497
7518
|
return {
|
|
7498
7519
|
listener: "alertService:toggleSound",
|
|
7499
7520
|
event: {
|
|
7500
|
-
muted:
|
|
7521
|
+
muted: W,
|
|
7501
7522
|
provider: t
|
|
7502
7523
|
},
|
|
7503
7524
|
// @ts-ignore
|
|
@@ -7525,12 +7546,12 @@ var G;
|
|
|
7525
7546
|
return this.onEventReceived(t, m);
|
|
7526
7547
|
}
|
|
7527
7548
|
case "message": {
|
|
7528
|
-
var c = i?.name ?? w.random.array(
|
|
7529
|
-
const
|
|
7549
|
+
var c = i?.name ?? w.random.array(M.names.filter((u) => u.length))[0], b = i?.message ?? w.random.array(M.messages.filter((u) => u.length))[0];
|
|
7550
|
+
const q = await w.message.generateBadges(
|
|
7530
7551
|
i?.badges ?? [],
|
|
7531
7552
|
t
|
|
7532
7553
|
);
|
|
7533
|
-
var o = w.message.findEmotesInText(b),
|
|
7554
|
+
var o = w.message.findEmotesInText(b), d = w.message.replaceEmotesWithHTML(b, o), f = i?.color ?? w.random.color("hex"), h = i?.userId ?? w.random.number(1e7, 99999999).toString(), g = i?.msgId ?? w.random.uuid(), y = i?.time ?? Date.now(), T = i?.avatar ?? w.random.array(M.avatars)[0], C = i?.channel ?? window?.client?.details?.user?.username ?? "local";
|
|
7534
7555
|
return {
|
|
7535
7556
|
listener: "message",
|
|
7536
7557
|
event: {
|
|
@@ -7542,7 +7563,7 @@ var G;
|
|
|
7542
7563
|
snippet: {
|
|
7543
7564
|
type: "",
|
|
7544
7565
|
liveChatId: "",
|
|
7545
|
-
authorChannelId:
|
|
7566
|
+
authorChannelId: C,
|
|
7546
7567
|
publishedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7547
7568
|
hasDisplayContent: !0,
|
|
7548
7569
|
displayMessage: b,
|
|
@@ -7551,14 +7572,14 @@ var G;
|
|
|
7551
7572
|
}
|
|
7552
7573
|
},
|
|
7553
7574
|
authorDetails: {
|
|
7554
|
-
channelId:
|
|
7575
|
+
channelId: C,
|
|
7555
7576
|
channelUrl: "",
|
|
7556
7577
|
displayName: c,
|
|
7557
|
-
profileImageUrl:
|
|
7558
|
-
...
|
|
7578
|
+
profileImageUrl: T,
|
|
7579
|
+
...q
|
|
7559
7580
|
},
|
|
7560
7581
|
msgId: g,
|
|
7561
|
-
userId:
|
|
7582
|
+
userId: h,
|
|
7562
7583
|
nick: c.toLowerCase(),
|
|
7563
7584
|
badges: [],
|
|
7564
7585
|
displayName: c,
|
|
@@ -7566,9 +7587,9 @@ var G;
|
|
|
7566
7587
|
time: y,
|
|
7567
7588
|
tags: [],
|
|
7568
7589
|
displayColor: f,
|
|
7569
|
-
channel:
|
|
7590
|
+
channel: C,
|
|
7570
7591
|
text: b,
|
|
7571
|
-
avatar:
|
|
7592
|
+
avatar: T,
|
|
7572
7593
|
emotes: []
|
|
7573
7594
|
},
|
|
7574
7595
|
renderedText: b
|
|
@@ -7579,11 +7600,11 @@ var G;
|
|
|
7579
7600
|
}
|
|
7580
7601
|
case "subscriber":
|
|
7581
7602
|
case "subscriber-latest": {
|
|
7582
|
-
var
|
|
7603
|
+
var T = i?.avatar ?? w.random.array(M.avatars)[0], c = i?.name ?? w.random.array(M.names.filter((F) => F.length))[0];
|
|
7583
7604
|
return {
|
|
7584
7605
|
listener: "subscriber-latest",
|
|
7585
7606
|
event: {
|
|
7586
|
-
avatar:
|
|
7607
|
+
avatar: T,
|
|
7587
7608
|
displayName: c,
|
|
7588
7609
|
name: c.toLowerCase(),
|
|
7589
7610
|
providerId: "",
|
|
@@ -7599,12 +7620,12 @@ var G;
|
|
|
7599
7620
|
}
|
|
7600
7621
|
case "superchat":
|
|
7601
7622
|
case "superchat-latest": {
|
|
7602
|
-
var
|
|
7623
|
+
var E = i?.amount ?? w.random.number(100, 4e3), T = i?.avatar ?? w.random.array(M.avatars)[0], c = i?.name ?? w.random.array(M.names.filter((Q) => Q.length))[0];
|
|
7603
7624
|
return {
|
|
7604
7625
|
listener: "superchat-latest",
|
|
7605
7626
|
event: {
|
|
7606
|
-
amount:
|
|
7607
|
-
avatar:
|
|
7627
|
+
amount: E,
|
|
7628
|
+
avatar: T,
|
|
7608
7629
|
name: c.toLowerCase(),
|
|
7609
7630
|
displayName: c,
|
|
7610
7631
|
providerId: "",
|
|
@@ -7620,35 +7641,35 @@ var G;
|
|
|
7620
7641
|
}
|
|
7621
7642
|
case "sponsor":
|
|
7622
7643
|
case "sponsor-latest": {
|
|
7623
|
-
var
|
|
7644
|
+
var _ = i?.tier ?? w.random.array(["1000", "2000", "3000"])[0], E = i?.amount ?? w.random.number(1, 24), T = i?.avatar ?? w.random.array(M.avatars)[0], c = i?.name ?? w.random.array(M.names.filter((K) => K.length))[0], j = i?.sender ?? w.random.array(M.names.filter((K) => K.length && K !== c))[0], b = i?.message ?? w.random.array(M.messages.filter((K) => K.length))[0], P = {
|
|
7624
7645
|
default: {
|
|
7625
|
-
avatar:
|
|
7646
|
+
avatar: T,
|
|
7626
7647
|
playedAsCommunityGift: !1
|
|
7627
7648
|
},
|
|
7628
7649
|
gift: {
|
|
7629
|
-
sender:
|
|
7650
|
+
sender: j,
|
|
7630
7651
|
gifted: !0
|
|
7631
7652
|
},
|
|
7632
7653
|
community: {
|
|
7633
7654
|
message: b,
|
|
7634
|
-
sender:
|
|
7655
|
+
sender: j,
|
|
7635
7656
|
bulkGifted: !0
|
|
7636
7657
|
},
|
|
7637
7658
|
spam: {
|
|
7638
|
-
sender:
|
|
7659
|
+
sender: j,
|
|
7639
7660
|
gifted: !0,
|
|
7640
7661
|
isCommunityGift: !0
|
|
7641
7662
|
}
|
|
7642
|
-
},
|
|
7643
|
-
return
|
|
7663
|
+
}, O = ["default", "gift", "community", "spam"], z = i?.subType ?? w.random.array(O)[0];
|
|
7664
|
+
return z = O.includes(z) ? z : "default", {
|
|
7644
7665
|
listener: "sponsor-latest",
|
|
7645
7666
|
event: {
|
|
7646
|
-
amount:
|
|
7667
|
+
amount: E,
|
|
7647
7668
|
name: c.toLowerCase(),
|
|
7648
7669
|
displayName: c,
|
|
7649
7670
|
providerId: "",
|
|
7650
|
-
...
|
|
7651
|
-
...
|
|
7671
|
+
...P.default,
|
|
7672
|
+
...P[z],
|
|
7652
7673
|
_id: w.random.uuid(),
|
|
7653
7674
|
sessionTop: !1,
|
|
7654
7675
|
type: "sponsor",
|
|
@@ -7666,11 +7687,7 @@ var G;
|
|
|
7666
7687
|
}, l.emulate = {
|
|
7667
7688
|
twitch: {
|
|
7668
7689
|
message(t = {}) {
|
|
7669
|
-
l.generate.event.onEventReceived(
|
|
7670
|
-
"twitch",
|
|
7671
|
-
"message",
|
|
7672
|
-
t
|
|
7673
|
-
).then((a) => {
|
|
7690
|
+
l.generate.event.onEventReceived("twitch", "message", t).then((a) => {
|
|
7674
7691
|
a && l.emulate.send("onEventReceived", a);
|
|
7675
7692
|
});
|
|
7676
7693
|
},
|
|
@@ -7784,7 +7801,7 @@ var G;
|
|
|
7784
7801
|
facebook: {},
|
|
7785
7802
|
send(t, a) {
|
|
7786
7803
|
if (!l.queue) {
|
|
7787
|
-
|
|
7804
|
+
R.warn("Local queue is not initialized."), window.dispatchEvent(new CustomEvent(t, { detail: a }));
|
|
7788
7805
|
return;
|
|
7789
7806
|
}
|
|
7790
7807
|
switch (t) {
|
|
@@ -7839,7 +7856,7 @@ var G;
|
|
|
7839
7856
|
cache: "no-store"
|
|
7840
7857
|
}).then((m) => m.json()).then(async (m) => {
|
|
7841
7858
|
const c = Object.entries(m).filter(([p, { value: o }]) => o != null).reduce(
|
|
7842
|
-
(p, [o, { value:
|
|
7859
|
+
(p, [o, { value: d }]) => (n && n[o] !== void 0 && (d = n[o]), p[o] = d, p),
|
|
7843
7860
|
{
|
|
7844
7861
|
...n
|
|
7845
7862
|
}
|
|
@@ -7851,7 +7868,7 @@ var G;
|
|
|
7851
7868
|
});
|
|
7852
7869
|
}
|
|
7853
7870
|
l.start = e;
|
|
7854
|
-
})(
|
|
7871
|
+
})(B || (B = {}));
|
|
7855
7872
|
const rt = {
|
|
7856
7873
|
getOverlayStatus: () => ({
|
|
7857
7874
|
isEditorMode: !1,
|
|
@@ -7885,7 +7902,7 @@ const rt = {
|
|
|
7885
7902
|
list: {}
|
|
7886
7903
|
}
|
|
7887
7904
|
};
|
|
7888
|
-
async function
|
|
7905
|
+
async function At() {
|
|
7889
7906
|
let l = localStorage.getItem("SE_API-STORE") ?? "", e = l ? JSON.parse(l) : {};
|
|
7890
7907
|
return rt.store.list = e, rt;
|
|
7891
7908
|
}
|
|
@@ -7945,7 +7962,7 @@ var ot;
|
|
|
7945
7962
|
}
|
|
7946
7963
|
l.get = a;
|
|
7947
7964
|
})(ot || (ot = {}));
|
|
7948
|
-
class
|
|
7965
|
+
class Jt extends Z {
|
|
7949
7966
|
/**
|
|
7950
7967
|
* Initializes a new ComfyJS instance and connects to Twitch chat.
|
|
7951
7968
|
* @param options - Configuration options for ComfyJS instance.
|
|
@@ -7955,7 +7972,7 @@ class At extends X {
|
|
|
7955
7972
|
super(), this.isDebug = !1, this.init = !1, this.emulate = !1, this.username = e.username, this.password = e.password, this.channels = e.channels, this.isDebug = !!e.isDebug, this.init = !!e.init, this.emulate = t, this.load().then((a) => {
|
|
7956
7973
|
this.instance = a, this.emit("load", a), this.connect();
|
|
7957
7974
|
}).catch((a) => {
|
|
7958
|
-
|
|
7975
|
+
R.error("useComfyJs: Failed to load ComfyJS", a);
|
|
7959
7976
|
});
|
|
7960
7977
|
}
|
|
7961
7978
|
/**
|
|
@@ -7977,9 +7994,9 @@ class At extends X {
|
|
|
7977
7994
|
*/
|
|
7978
7995
|
connect() {
|
|
7979
7996
|
this.instance.onError = (e) => {
|
|
7980
|
-
this.emit("error", e), client?.debug &&
|
|
7997
|
+
this.emit("error", e), client?.debug && R.error("[Client]", "ComfyJS Error:", e);
|
|
7981
7998
|
}, this.instance.onCommand = (e, t, a, i, s) => {
|
|
7982
|
-
if (this.emit("command", e, t, a, i, s), client?.debug &&
|
|
7999
|
+
if (this.emit("command", e, t, a, i, s), client?.debug && R.debug("[Client]", `ComfyJS Command: !${t} ${a} (User: ${e})`), this.emulate) {
|
|
7983
8000
|
const n = {
|
|
7984
8001
|
...i,
|
|
7985
8002
|
broadcaster: i.broadcaster,
|
|
@@ -7997,10 +8014,10 @@ class At extends X {
|
|
|
7997
8014
|
msgId: s.id,
|
|
7998
8015
|
channel: s.channel
|
|
7999
8016
|
};
|
|
8000
|
-
|
|
8017
|
+
B.emulate.twitch.message(m);
|
|
8001
8018
|
}
|
|
8002
8019
|
}, this.instance.onChat = (e, t, a, i, s) => {
|
|
8003
|
-
if (this.emit("chat", e, t, a, i, s), client?.debug &&
|
|
8020
|
+
if (this.emit("chat", e, t, a, i, s), client?.debug && R.debug("[Client]", `ComfyJS Chat: ${t} (User: ${e})`), this.emulate) {
|
|
8004
8021
|
const n = {
|
|
8005
8022
|
...a,
|
|
8006
8023
|
...s.userBadges,
|
|
@@ -8010,7 +8027,7 @@ class At extends X {
|
|
|
8010
8027
|
subscriber: a.subscriber,
|
|
8011
8028
|
founder: a.founder
|
|
8012
8029
|
};
|
|
8013
|
-
|
|
8030
|
+
B.emulate.twitch.message({
|
|
8014
8031
|
name: e,
|
|
8015
8032
|
message: t,
|
|
8016
8033
|
badges: Object.entries(n).map(([m, c]) => c ? m : null).filter(Boolean),
|
|
@@ -8022,24 +8039,24 @@ class At extends X {
|
|
|
8022
8039
|
});
|
|
8023
8040
|
}
|
|
8024
8041
|
}, this.instance.onWhisper = (e, t, a, i, s) => {
|
|
8025
|
-
this.emit("whisper", e, t, a, i, s), client?.debug &&
|
|
8042
|
+
this.emit("whisper", e, t, a, i, s), client?.debug && R.debug("[Client]", `ComfyJS Whisper: ${t} (User: ${e})`);
|
|
8026
8043
|
}, this.instance.onMessageDeleted = (e, t) => {
|
|
8027
|
-
this.emit("messageDeleted", e, t), client?.debug &&
|
|
8044
|
+
this.emit("messageDeleted", e, t), client?.debug && R.debug("[Client]", `ComfyJS Message Deleted: ${e}`), this.emulate && B.emulate.twitch.deleteMessage(e);
|
|
8028
8045
|
}, this.instance.onJoin = (e, t, a) => {
|
|
8029
|
-
this.emit("join", e, t, a), client?.debug &&
|
|
8046
|
+
this.emit("join", e, t, a), client?.debug && R.debug("[Client]", `ComfyJS Join: ${e}`);
|
|
8030
8047
|
}, this.instance.onPart = (e, t, a) => {
|
|
8031
|
-
this.emit("part", e, t, a), client?.debug &&
|
|
8048
|
+
this.emit("part", e, t, a), client?.debug && R.debug("[Client]", `ComfyJS Part: ${e}`);
|
|
8032
8049
|
}, this.instance.onHosted = (e, t, a, i) => {
|
|
8033
|
-
this.emit("hosted", e, t, a, i), client?.debug &&
|
|
8050
|
+
this.emit("hosted", e, t, a, i), client?.debug && R.debug("[Client]", `ComfyJS Hosted: ${e} (${t} viewers)`);
|
|
8034
8051
|
}, this.instance.onRaid = (e, t, a) => {
|
|
8035
|
-
this.emit("raid", e, t, a), client?.debug &&
|
|
8052
|
+
this.emit("raid", e, t, a), client?.debug && R.debug("[Client]", `ComfyJS Raid: ${e} (${t} viewers)`), this.emulate && B.emulate.twitch.raid({
|
|
8036
8053
|
name: e,
|
|
8037
8054
|
amount: t
|
|
8038
8055
|
});
|
|
8039
8056
|
}, this.instance.onSub = (e, t, a, i) => {
|
|
8040
|
-
if (this.emit("sub", e, t, a, i), client?.debug &&
|
|
8057
|
+
if (this.emit("sub", e, t, a, i), client?.debug && R.debug("[Client]", `ComfyJS Sub: ${e} (${a.plan})`), this.emulate) {
|
|
8041
8058
|
const s = a.plan === "Prime" ? "prime" : a.plan;
|
|
8042
|
-
|
|
8059
|
+
B.emulate.twitch.subscriber({
|
|
8043
8060
|
name: e,
|
|
8044
8061
|
message: t,
|
|
8045
8062
|
tier: s,
|
|
@@ -8047,9 +8064,9 @@ class At extends X {
|
|
|
8047
8064
|
});
|
|
8048
8065
|
}
|
|
8049
8066
|
}, this.instance.onResub = (e, t, a, i, s, n) => {
|
|
8050
|
-
if (this.emit("resub", e, t, a, i, s, n), client?.debug &&
|
|
8067
|
+
if (this.emit("resub", e, t, a, i, s, n), client?.debug && R.debug("[Client]", `ComfyJS Resub: ${e} (${i} months)`), this.emulate) {
|
|
8051
8068
|
const m = s.plan === "Prime" ? "prime" : s.plan;
|
|
8052
|
-
|
|
8069
|
+
B.emulate.twitch.subscriber({
|
|
8053
8070
|
name: e,
|
|
8054
8071
|
message: t,
|
|
8055
8072
|
tier: m,
|
|
@@ -8066,9 +8083,9 @@ class At extends X {
|
|
|
8066
8083
|
i,
|
|
8067
8084
|
s,
|
|
8068
8085
|
n
|
|
8069
|
-
), client?.debug &&
|
|
8086
|
+
), client?.debug && R.debug("[Client]", `ComfyJS Sub Gift: ${e} gifted ${i} subs`), this.emulate) {
|
|
8070
8087
|
const m = s.plan === "Prime" ? "prime" : s.plan;
|
|
8071
|
-
|
|
8088
|
+
B.emulate.twitch.subscriber({
|
|
8072
8089
|
name: a,
|
|
8073
8090
|
message: "",
|
|
8074
8091
|
sender: e,
|
|
@@ -8078,12 +8095,12 @@ class At extends X {
|
|
|
8078
8095
|
});
|
|
8079
8096
|
}
|
|
8080
8097
|
}, this.instance.onSubMysteryGift = (e, t, a, i, s) => {
|
|
8081
|
-
if (this.emit("subMysteryGift", e, t, a, i, s), client?.debug &&
|
|
8098
|
+
if (this.emit("subMysteryGift", e, t, a, i, s), client?.debug && R.debug(
|
|
8082
8099
|
"[Client]",
|
|
8083
8100
|
`ComfyJS Sub Mystery Gift: ${e} gifted ${t} subs`
|
|
8084
8101
|
), this.emulate) {
|
|
8085
8102
|
const n = i.plan === "Prime" ? "prime" : i.plan;
|
|
8086
|
-
|
|
8103
|
+
B.emulate.twitch.subscriber({
|
|
8087
8104
|
name: e,
|
|
8088
8105
|
message: "",
|
|
8089
8106
|
amount: t,
|
|
@@ -8092,10 +8109,10 @@ class At extends X {
|
|
|
8092
8109
|
});
|
|
8093
8110
|
}
|
|
8094
8111
|
}, this.instance.onGiftSubContinue = (e, t, a) => {
|
|
8095
|
-
this.emit("giftSubContinue", e, t, a), client?.debug &&
|
|
8112
|
+
this.emit("giftSubContinue", e, t, a), client?.debug && R.debug(
|
|
8096
8113
|
"[Client]",
|
|
8097
8114
|
`ComfyJS Gift Sub Continue: ${e} continued their gifted sub from ${t}`
|
|
8098
|
-
), this.emulate &&
|
|
8115
|
+
), this.emulate && B.emulate.twitch.subscriber({
|
|
8099
8116
|
name: e,
|
|
8100
8117
|
message: "",
|
|
8101
8118
|
sender: t,
|
|
@@ -8103,25 +8120,25 @@ class At extends X {
|
|
|
8103
8120
|
subType: "gift"
|
|
8104
8121
|
});
|
|
8105
8122
|
}, this.instance.onCheer = (e, t, a, i, s) => {
|
|
8106
|
-
this.emit("cheer", e, t, a, i, s), client?.debug &&
|
|
8123
|
+
this.emit("cheer", e, t, a, i, s), client?.debug && R.debug("[Client]", `ComfyJS Cheer: ${e} cheered ${a} bits - ${t}`), this.emulate && B.emulate.twitch.cheer({
|
|
8107
8124
|
name: e,
|
|
8108
8125
|
message: t,
|
|
8109
8126
|
amount: a
|
|
8110
8127
|
});
|
|
8111
8128
|
}, this.instance.onChatMode = (e, t) => {
|
|
8112
|
-
this.emit("chatMode", e, t), client?.debug &&
|
|
8129
|
+
this.emit("chatMode", e, t), client?.debug && R.debug("[Client]", `ComfyJS Chat Mode Changed on ${t}`);
|
|
8113
8130
|
}, this.instance.onReward = (e, t, a, i, s) => {
|
|
8114
|
-
this.emit("reward", e, t, a, i, s), client?.debug &&
|
|
8131
|
+
this.emit("reward", e, t, a, i, s), client?.debug && R.debug(
|
|
8115
8132
|
"[Client]",
|
|
8116
8133
|
`ComfyJS Reward: ${e} redeemed ${t} for ${a} - ${i}`
|
|
8117
8134
|
);
|
|
8118
8135
|
}, this.instance.onConnected = (e, t, a) => {
|
|
8119
|
-
this.emit("connected", e, t, a), client?.debug &&
|
|
8136
|
+
this.emit("connected", e, t, a), client?.debug && R.debug(
|
|
8120
8137
|
"[Client]",
|
|
8121
8138
|
`ComfyJS Connected: ${e}:${t} (First Connect: ${a})`
|
|
8122
8139
|
);
|
|
8123
8140
|
}, this.instance.onReconnect = (e) => {
|
|
8124
|
-
this.emit("reconnect", e), client?.debug &&
|
|
8141
|
+
this.emit("reconnect", e), client?.debug && R.debug("[Client]", `ComfyJS Reconnect: Attempt #${e}`);
|
|
8125
8142
|
}, this.init && this.instance.Init(this.username, this.password, this.channels, this.isDebug);
|
|
8126
8143
|
}
|
|
8127
8144
|
}
|
|
@@ -8224,30 +8241,30 @@ class pt {
|
|
|
8224
8241
|
!this.enabled || !console.timeEnd || console.timeEnd(e);
|
|
8225
8242
|
}
|
|
8226
8243
|
}
|
|
8227
|
-
const ct = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(
|
|
8244
|
+
const ct = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(At()), R = new pt(), mt = {
|
|
8228
8245
|
SeAPI: ct,
|
|
8229
|
-
Client:
|
|
8246
|
+
Client: G,
|
|
8230
8247
|
Helper: w,
|
|
8231
|
-
Local:
|
|
8232
|
-
Data:
|
|
8233
|
-
logger:
|
|
8248
|
+
Local: B,
|
|
8249
|
+
Data: M,
|
|
8250
|
+
logger: R,
|
|
8234
8251
|
modules: {
|
|
8235
|
-
EventProvider:
|
|
8236
|
-
useStorage:
|
|
8252
|
+
EventProvider: Z,
|
|
8253
|
+
useStorage: at,
|
|
8237
8254
|
useQueue: gt,
|
|
8238
8255
|
useLogger: pt,
|
|
8239
|
-
useComms:
|
|
8256
|
+
useComms: Dt
|
|
8240
8257
|
},
|
|
8241
8258
|
actions: {
|
|
8242
|
-
Button:
|
|
8243
|
-
Command:
|
|
8259
|
+
Button: st,
|
|
8260
|
+
Command: $
|
|
8244
8261
|
},
|
|
8245
8262
|
multistream: {
|
|
8246
|
-
useComfyJs:
|
|
8263
|
+
useComfyJs: Jt
|
|
8247
8264
|
},
|
|
8248
8265
|
data: {
|
|
8249
|
-
usedStorages:
|
|
8250
|
-
usedComms:
|
|
8266
|
+
usedStorages: et,
|
|
8267
|
+
usedComms: it
|
|
8251
8268
|
},
|
|
8252
8269
|
pronouns: {
|
|
8253
8270
|
Alejo: ot
|