@tixyel/streamelements 7.0.2 → 7.0.3
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 +5 -1
- package/dist/index.es.js +241 -166
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -9584,7 +9584,7 @@ function j(e, t, n) {
|
|
|
9584
9584
|
b: Math.round(a * 255)
|
|
9585
9585
|
};
|
|
9586
9586
|
}
|
|
9587
|
-
async function
|
|
9587
|
+
async function ee(e, t, n) {
|
|
9588
9588
|
let r = l, i = r[0], a = Infinity;
|
|
9589
9589
|
for await (let o of r) {
|
|
9590
9590
|
let r = document.createElement("canvas");
|
|
@@ -9599,7 +9599,7 @@ async function M(e, t, n) {
|
|
|
9599
9599
|
}
|
|
9600
9600
|
//#endregion
|
|
9601
9601
|
//#region src/helper/classes/color.ts
|
|
9602
|
-
var
|
|
9602
|
+
var M = class {
|
|
9603
9603
|
opacity(e = 100, t = "") {
|
|
9604
9604
|
t = t.length > 7 ? t?.substring(0, 6) : t, e = e > 1 ? e / 100 : e;
|
|
9605
9605
|
let n = Math.round(Math.min(Math.max(e, 0), 1) * 255).toString(16).toLowerCase().padStart(2, "0");
|
|
@@ -9639,11 +9639,11 @@ var N = class {
|
|
|
9639
9639
|
let e = A(r.r, r.g, r.b);
|
|
9640
9640
|
return `hsla(${e.h}, ${e.s}%, ${e.l}%, ${r.a})`;
|
|
9641
9641
|
}
|
|
9642
|
-
case "css-color-name": return await
|
|
9642
|
+
case "css-color-name": return await ee(r.r, r.g, r.b);
|
|
9643
9643
|
default: return null;
|
|
9644
9644
|
}
|
|
9645
9645
|
}
|
|
9646
|
-
},
|
|
9646
|
+
}, N = class {
|
|
9647
9647
|
constructor() {
|
|
9648
9648
|
this.PRESETS = {};
|
|
9649
9649
|
}
|
|
@@ -9865,7 +9865,7 @@ var N = class {
|
|
|
9865
9865
|
}
|
|
9866
9866
|
return r ? !a : a;
|
|
9867
9867
|
}
|
|
9868
|
-
let T = new
|
|
9868
|
+
let T = new M(), E = {
|
|
9869
9869
|
BT1: (e) => p > 1 ? e : "",
|
|
9870
9870
|
BT0: (e) => p > 0 ? e : "",
|
|
9871
9871
|
ST1: (e) => p < 1 ? e : "",
|
|
@@ -10089,7 +10089,7 @@ var N = class {
|
|
|
10089
10089
|
let j = e.replace(f.PLACEHOLDERS, (e, t) => typeof d[t] == "string" || typeof d[t] == "number" ? String(d[t]) : t ?? t);
|
|
10090
10090
|
return j = n.method === "loop" ? k(j) : A(j), j;
|
|
10091
10091
|
}
|
|
10092
|
-
},
|
|
10092
|
+
}, P = class {
|
|
10093
10093
|
constructor() {
|
|
10094
10094
|
this.playing = !1;
|
|
10095
10095
|
}
|
|
@@ -10108,23 +10108,40 @@ var N = class {
|
|
|
10108
10108
|
throw Error(`Error playing sound: ${e}`);
|
|
10109
10109
|
}
|
|
10110
10110
|
}
|
|
10111
|
-
},
|
|
10111
|
+
}, F = class {
|
|
10112
10112
|
apply(e, t, n) {
|
|
10113
10113
|
return e.apply(t, n);
|
|
10114
10114
|
}
|
|
10115
10115
|
call(e, t, ...n) {
|
|
10116
10116
|
return e.call(t, ...n);
|
|
10117
10117
|
}
|
|
10118
|
-
},
|
|
10118
|
+
}, I = class {
|
|
10119
10119
|
constructor(e, t, n = [], r = !1, i) {
|
|
10120
10120
|
this.badges = [], this.isSubscriber = !1, this.id = e, this.name = t, this.login = t.toLocaleLowerCase(), this.badges = n, this.isSubscriber = r, this.tier = i;
|
|
10121
10121
|
}
|
|
10122
|
-
},
|
|
10122
|
+
}, L = {
|
|
10123
|
+
broadcaster: [
|
|
10124
|
+
"moderator",
|
|
10125
|
+
"vip",
|
|
10126
|
+
"artist-badge"
|
|
10127
|
+
],
|
|
10128
|
+
moderator: ["lead_moderator"],
|
|
10129
|
+
no_video: ["no_audio"],
|
|
10130
|
+
"60-seconds_1": ["60-seconds_2", "60-seconds_3"],
|
|
10131
|
+
duelyst_1: [
|
|
10132
|
+
"duelyst_2",
|
|
10133
|
+
"duelyst_3",
|
|
10134
|
+
"duelyst_4",
|
|
10135
|
+
"duelyst_5",
|
|
10136
|
+
"duelyst_6",
|
|
10137
|
+
"duelyst_7"
|
|
10138
|
+
]
|
|
10139
|
+
}, R = [], te = class t extends e {
|
|
10123
10140
|
static fixUser(e) {
|
|
10124
10141
|
return typeof e == "string" ? e.trim().replace(/^@+/, "").toLocaleLowerCase() : t.fixUser(e.name);
|
|
10125
10142
|
}
|
|
10126
10143
|
static getRandomSubTier() {
|
|
10127
|
-
return new
|
|
10144
|
+
return new z().probability({
|
|
10128
10145
|
prime: .4,
|
|
10129
10146
|
1e3: .3,
|
|
10130
10147
|
2e3: .2,
|
|
@@ -10138,46 +10155,104 @@ var N = class {
|
|
|
10138
10155
|
e.set(n, [...r, t]);
|
|
10139
10156
|
}
|
|
10140
10157
|
return e;
|
|
10141
|
-
}, /* @__PURE__ */ new Map())),
|
|
10158
|
+
}, /* @__PURE__ */ new Map())), R.push(this);
|
|
10142
10159
|
}
|
|
10143
10160
|
start(e, n = w.badges.map((e) => e.set_id), r) {
|
|
10144
10161
|
let i = e.map((e) => e && t.fixUser(e)).filter((e) => e && e.length).filter((e, t, n) => n.indexOf(e) === t), a = n.filter((e, t, n) => n.indexOf(e) === t);
|
|
10145
10162
|
if (!a.length || !i.length) return [];
|
|
10146
|
-
let o = [], s = r?.limits ?? {},
|
|
10147
|
-
let t =
|
|
10163
|
+
let o = [], s = typeof r?.minimumBadgesPerUser == "number" && r.minimumBadgesPerUser >= 0 ? Math.floor(r.minimumBadgesPerUser) : 1, c = Math.min(s, 3), l = r?.limits ?? {}, u = r?.fixed ?? {}, d = new Set(a), f = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), g = 0, _ = (e) => {
|
|
10164
|
+
let t = l[e];
|
|
10148
10165
|
return typeof t == "number" && t > 0 ? t : Infinity;
|
|
10149
|
-
},
|
|
10150
|
-
let t = f(e);
|
|
10151
|
-
|
|
10152
|
-
},
|
|
10153
|
-
let t =
|
|
10154
|
-
|
|
10155
|
-
|
|
10156
|
-
|
|
10157
|
-
|
|
10158
|
-
|
|
10166
|
+
}, v = (e) => {
|
|
10167
|
+
let t = f.get(e) ?? 0;
|
|
10168
|
+
f.set(e, t + 1);
|
|
10169
|
+
}, y = (e) => {
|
|
10170
|
+
let t = m.get(e) ?? 0;
|
|
10171
|
+
if (t <= 1) {
|
|
10172
|
+
m.delete(e);
|
|
10173
|
+
return;
|
|
10174
|
+
}
|
|
10175
|
+
m.set(e, t - 1);
|
|
10176
|
+
}, b = (e) => e ? typeof e == "string" ? [t.fixUser(e)].filter((e) => !!e) : Array.isArray(e) ? e.map(t.fixUser).filter((e) => !!e) : [] : [], x = (e) => e ? Array.isArray(e) ? e : [e] : [], S = (e, t) => {
|
|
10177
|
+
let n = /* @__PURE__ */ new Map();
|
|
10178
|
+
for (let r of [e, t]) for (let [e, t] of Object.entries(r ?? {})) {
|
|
10179
|
+
let r = n.get(e) ?? [], i = x(t);
|
|
10180
|
+
n.set(e, [...new Set([...r, ...i])]);
|
|
10181
|
+
}
|
|
10182
|
+
return n;
|
|
10183
|
+
}, C = (e, t) => {
|
|
10184
|
+
if (e === t) return;
|
|
10185
|
+
let n = h.get(e) ?? /* @__PURE__ */ new Set();
|
|
10186
|
+
n.add(t), h.set(e, n);
|
|
10187
|
+
let r = h.get(t) ?? /* @__PURE__ */ new Set();
|
|
10188
|
+
r.add(e), h.set(t, r);
|
|
10189
|
+
}, T = (e, t) => t.includes(e) ? !1 : t.every((t) => !h.get(t)?.has(e)), E = (e, t) => {
|
|
10190
|
+
if (!T(e, t)) return !1;
|
|
10191
|
+
let n = _(e), r = f.get(e) ?? 0, i = m.get(e) ?? 0;
|
|
10192
|
+
return r < n && r + i < n;
|
|
10193
|
+
}, D = (e, t) => {
|
|
10194
|
+
if (!T(e, t)) return !1;
|
|
10195
|
+
let n = _(e);
|
|
10196
|
+
return (f.get(e) ?? 0) < n;
|
|
10197
|
+
}, O = (e) => {
|
|
10198
|
+
for (let t = 0; t < a.length; t++) {
|
|
10199
|
+
let n = a[(g + t) % a.length];
|
|
10200
|
+
if (E(n, e)) return g = (g + t + 1) % a.length, n;
|
|
10159
10201
|
}
|
|
10160
10202
|
return null;
|
|
10161
10203
|
};
|
|
10204
|
+
for (let [e, t] of S(L, r?.incompatible)) if (d.has(e)) for (let n of x(t)) d.has(n) && C(e, n);
|
|
10162
10205
|
for (let e of a) {
|
|
10163
|
-
let
|
|
10164
|
-
for (let
|
|
10165
|
-
let
|
|
10166
|
-
|
|
10206
|
+
let t = b(u[e]);
|
|
10207
|
+
for (let n of t) {
|
|
10208
|
+
let t = p.get(n) ?? [];
|
|
10209
|
+
t.includes(e) || p.set(n, [...t, e]);
|
|
10210
|
+
}
|
|
10211
|
+
}
|
|
10212
|
+
for (let [e, t] of Object.entries(u)) d.has(e) || b(t).length && this.emit("warn", /* @__PURE__ */ Error(`Fixed badge "${e}" is not available in the current badge pool`));
|
|
10213
|
+
let k = /* @__PURE__ */ new Map();
|
|
10214
|
+
s > 3 && this.emit("warn", /* @__PURE__ */ Error("minimumBadgesPerUser exceeds the maximum of 3 and was clamped"));
|
|
10215
|
+
for (let e of i) {
|
|
10216
|
+
let t = p.get(e) ?? [], n = [];
|
|
10217
|
+
for (let r of t) {
|
|
10218
|
+
if (n.length >= 3) {
|
|
10219
|
+
this.emit("warn", /* @__PURE__ */ Error(`User "${e}" has more than 3 fixed badges; extra badges were ignored`));
|
|
10220
|
+
break;
|
|
10221
|
+
}
|
|
10222
|
+
if (!T(r, n)) {
|
|
10223
|
+
this.emit("warn", /* @__PURE__ */ Error(`Fixed badge "${r}" for user "${e}" conflicts with another fixed badge and was ignored`));
|
|
10224
|
+
continue;
|
|
10225
|
+
}
|
|
10226
|
+
n.push(r);
|
|
10167
10227
|
}
|
|
10228
|
+
k.set(e, n);
|
|
10229
|
+
for (let e of n) m.set(e, (m.get(e) ?? 0) + 1);
|
|
10168
10230
|
}
|
|
10169
10231
|
for (let e of i) {
|
|
10170
|
-
let n =
|
|
10171
|
-
|
|
10232
|
+
let n = [], r = k.get(e) ?? [];
|
|
10233
|
+
for (let t of r) {
|
|
10234
|
+
if (y(t), !D(t, n)) {
|
|
10235
|
+
this.emit("warn", /* @__PURE__ */ Error(`Fixed badge "${t}" for user "${e}" could not be assigned because its limit was reached`));
|
|
10236
|
+
continue;
|
|
10237
|
+
}
|
|
10238
|
+
n.push(t), v(t);
|
|
10239
|
+
}
|
|
10240
|
+
for (; n.length < c;) {
|
|
10241
|
+
let e = O(n);
|
|
10242
|
+
if (!e) break;
|
|
10243
|
+
n.push(e), v(e);
|
|
10244
|
+
}
|
|
10245
|
+
if (!n.length) {
|
|
10172
10246
|
this.emit("warn", /* @__PURE__ */ Error("Not enough badges to assign to users"));
|
|
10173
10247
|
continue;
|
|
10174
10248
|
}
|
|
10175
|
-
|
|
10249
|
+
n.length < c && this.emit("warn", /* @__PURE__ */ Error(`User "${e}" could only receive ${n.length} badge(s), below the configured minimum of ${c}`));
|
|
10250
|
+
let i = o.length + 1, a = n.some((e) => [
|
|
10176
10251
|
"subscriber",
|
|
10177
10252
|
"prime",
|
|
10178
10253
|
"founder"
|
|
10179
|
-
].includes(String(
|
|
10180
|
-
o.push(s)
|
|
10254
|
+
].includes(String(e).toLocaleLowerCase())), s = new I(`fake_user_${i.toString().padStart(2, "0")}_${Math.random().toString(36).slice(2, 8)}+${this.id}`, e, n, a, a ? t.getRandomSubTier() : void 0);
|
|
10255
|
+
o.push(s);
|
|
10181
10256
|
}
|
|
10182
10257
|
return o.length < i.length && this.emit("warn", /* @__PURE__ */ Error("Some users could not be assigned badges due to limits. Consider increasing limits or adding more badges.")), o;
|
|
10183
10258
|
}
|
|
@@ -10231,7 +10306,7 @@ var N = class {
|
|
|
10231
10306
|
message: new T().array(e)[0]
|
|
10232
10307
|
};
|
|
10233
10308
|
}
|
|
10234
|
-
},
|
|
10309
|
+
}, z = class {
|
|
10235
10310
|
delay(e, t) {
|
|
10236
10311
|
return new Promise((n) => setTimeout(() => {
|
|
10237
10312
|
n(t ? t() ?? null : null);
|
|
@@ -10285,7 +10360,7 @@ var N = class {
|
|
|
10285
10360
|
async findSubscriptionTier({ userId: e, name: t, broadcasterId: n }, r, i = !1) {
|
|
10286
10361
|
let a = (e) => e === "prime" || e === "1000" || e === 1e3 || e === 1 || e === "1" ? 1 : e === "2000" || e === 2e3 || e === 2 || e === "2" ? 2 : e === "3000" || e === 3e3 || e === 3 || e === "3" ? 3 : 1;
|
|
10287
10362
|
if (e?.includes("fake_user_")) {
|
|
10288
|
-
let t =
|
|
10363
|
+
let t = R.find((t) => e.endsWith(`+${t.id}`));
|
|
10289
10364
|
if (t) {
|
|
10290
10365
|
let n = t.getById(e);
|
|
10291
10366
|
if (n) return a(n.tier);
|
|
@@ -10402,30 +10477,30 @@ var N = class {
|
|
|
10402
10477
|
break;
|
|
10403
10478
|
}
|
|
10404
10479
|
}
|
|
10405
|
-
},
|
|
10480
|
+
}, B;
|
|
10406
10481
|
(function(e) {
|
|
10407
|
-
e.number = new i(), e.element = new a(), e.object = new o(), e.message = new E(), e.event = new D(), e.string = new
|
|
10408
|
-
})(
|
|
10482
|
+
e.number = new i(), e.element = new a(), e.object = new o(), e.message = new E(), e.event = new D(), e.string = new N(), e.sound = new P(), e.color = new M(), e.random = new T(), e.fn = new F(), e.utils = new z();
|
|
10483
|
+
})(B ||= {});
|
|
10409
10484
|
//#endregion
|
|
10410
10485
|
//#region src/actions/button.ts
|
|
10411
|
-
var
|
|
10486
|
+
var V = [], H = class e {
|
|
10412
10487
|
constructor(e) {
|
|
10413
|
-
this.field = "button", this.template = "button", this.name = "Button", this.value = "", 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,
|
|
10488
|
+
this.field = "button", this.template = "button", this.name = "Button", this.value = "", 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, V.push(this), window?.client instanceof r && (window?.client?.actions.buttons.push(this), window?.client?.emit("action", this, "created"));
|
|
10414
10489
|
}
|
|
10415
10490
|
generate(e) {
|
|
10416
|
-
return
|
|
10417
|
-
let r =
|
|
10491
|
+
return B.utils.typedValues(e).reduce((e, t, n) => {
|
|
10492
|
+
let r = B.string.compose(this.template, {
|
|
10418
10493
|
index: n,
|
|
10419
10494
|
...t
|
|
10420
10495
|
}, { html: !1 });
|
|
10421
10496
|
e[r] = {
|
|
10422
10497
|
type: "button",
|
|
10423
|
-
label:
|
|
10498
|
+
label: B.string.compose(this.name, {
|
|
10424
10499
|
index: n,
|
|
10425
10500
|
...t
|
|
10426
10501
|
}, { html: !1 })
|
|
10427
10502
|
};
|
|
10428
|
-
let i =
|
|
10503
|
+
let i = B.string.compose(String(this.value), {
|
|
10429
10504
|
index: n,
|
|
10430
10505
|
...t
|
|
10431
10506
|
}, { html: !1 });
|
|
@@ -10442,15 +10517,15 @@ var R = [], z = class e {
|
|
|
10442
10517
|
return this;
|
|
10443
10518
|
}
|
|
10444
10519
|
remove() {
|
|
10445
|
-
let e =
|
|
10446
|
-
if (e > -1 &&
|
|
10520
|
+
let e = V.indexOf(this);
|
|
10521
|
+
if (e > -1 && V.splice(e, 1), !(window?.client instanceof r)) return;
|
|
10447
10522
|
let t = window?.client.actions.buttons.indexOf(this);
|
|
10448
10523
|
t > -1 && (window?.client?.actions.buttons.splice(t, 1), window?.client?.emit("action", this, "removed"));
|
|
10449
10524
|
}
|
|
10450
10525
|
static execute(t, n) {
|
|
10451
10526
|
try {
|
|
10452
|
-
if (
|
|
10453
|
-
let r =
|
|
10527
|
+
if (V.length) {
|
|
10528
|
+
let r = V.filter((e) => typeof e.field == "string" ? e.field === t : typeof e.field == "function" ? e.field(t, n) : !1);
|
|
10454
10529
|
if (r.length && r.every((t) => t instanceof e)) return r.forEach((e) => {
|
|
10455
10530
|
try {
|
|
10456
10531
|
e.parse(t, n), window?.client?.emit("action", e, "executed"), Q.received(`Button executed: ${t}${n ? ` with value: ${n}` : ""}`);
|
|
@@ -10465,9 +10540,9 @@ var R = [], z = class e {
|
|
|
10465
10540
|
return !1;
|
|
10466
10541
|
}
|
|
10467
10542
|
}
|
|
10468
|
-
},
|
|
10543
|
+
}, U = [], W = class e {
|
|
10469
10544
|
constructor(e) {
|
|
10470
|
-
this.prefix = "!", this.arguments = !1, this.test = `${this.prefix}${this.name} arg1 arg2`, this.aliases = [], this.permissions = void 0, this.admins = [], 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,
|
|
10545
|
+
this.prefix = "!", this.arguments = !1, this.test = `${this.prefix}${this.name} arg1 arg2`, this.aliases = [], this.permissions = void 0, this.admins = [], 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, U.push(this), window?.client instanceof r && (window?.client?.actions.commands.push(this), window?.client?.emit("action", this, "created"));
|
|
10471
10546
|
}
|
|
10472
10547
|
run(e, t) {}
|
|
10473
10548
|
verify(e, t, n) {
|
|
@@ -10502,16 +10577,16 @@ var R = [], z = class e {
|
|
|
10502
10577
|
return o === !0 && this.run.apply(window?.client || void 0, [n, t]), o;
|
|
10503
10578
|
}
|
|
10504
10579
|
remove() {
|
|
10505
|
-
let e =
|
|
10506
|
-
if (e > -1 &&
|
|
10580
|
+
let e = U.indexOf(this);
|
|
10581
|
+
if (e > -1 && U.splice(e, 1), !(window?.client instanceof r)) return;
|
|
10507
10582
|
let t = window?.client?.actions.commands.indexOf(this);
|
|
10508
10583
|
t > -1 && (window?.client?.actions.commands.splice(t, 1), window?.client?.emit("action", this, "removed"));
|
|
10509
10584
|
}
|
|
10510
10585
|
static execute(t) {
|
|
10511
10586
|
let n = t.data;
|
|
10512
10587
|
try {
|
|
10513
|
-
if (
|
|
10514
|
-
let r =
|
|
10588
|
+
if (U.length && U.some((e) => n.event.data.text.startsWith(e.prefix))) {
|
|
10589
|
+
let r = U.filter((e) => {
|
|
10515
10590
|
var t = [e.name, ...e.aliases ?? []], r = n.event.data.text.replace(e.prefix, "").split(" ")[0];
|
|
10516
10591
|
return t.includes(r);
|
|
10517
10592
|
});
|
|
@@ -10525,9 +10600,9 @@ var R = [], z = class e {
|
|
|
10525
10600
|
return !1;
|
|
10526
10601
|
}
|
|
10527
10602
|
}
|
|
10528
|
-
},
|
|
10603
|
+
}, G = [], ne = class extends e {
|
|
10529
10604
|
constructor(e = {}) {
|
|
10530
|
-
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,
|
|
10605
|
+
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, G.push(this), Z?.then(async (e) => {
|
|
10531
10606
|
this.loaded = !0, this.SE_API = e, Promise.all([async () => {
|
|
10532
10607
|
let t = await e.store.get(this.id);
|
|
10533
10608
|
t && (this.history = t.slice(-10));
|
|
@@ -10608,7 +10683,7 @@ window.addEventListener("onWidgetLoad", async (e) => {
|
|
|
10608
10683
|
}
|
|
10609
10684
|
}), window.addEventListener("onEventReceived", ({ detail: e }) => {
|
|
10610
10685
|
if (window.client instanceof r && client instanceof r && client) {
|
|
10611
|
-
let r =
|
|
10686
|
+
let r = B.event.parseProvider(e);
|
|
10612
10687
|
switch (r.provider) {
|
|
10613
10688
|
case "streamelements": {
|
|
10614
10689
|
let e = r.data;
|
|
@@ -10623,7 +10698,7 @@ window.addEventListener("onWidgetLoad", async (e) => {
|
|
|
10623
10698
|
switch (e.event.listener) {
|
|
10624
10699
|
case "widget-button": {
|
|
10625
10700
|
let t = e.event;
|
|
10626
|
-
|
|
10701
|
+
H.execute(t.field, t.value);
|
|
10627
10702
|
break;
|
|
10628
10703
|
}
|
|
10629
10704
|
case "subscriber-latest":
|
|
@@ -10637,8 +10712,8 @@ window.addEventListener("onWidgetLoad", async (e) => {
|
|
|
10637
10712
|
var n = t.find((e) => e.id === r.data.key.replace("customWidget.", "") || e.id === r.data.key);
|
|
10638
10713
|
n && n.update(r.data.value);
|
|
10639
10714
|
}
|
|
10640
|
-
if (
|
|
10641
|
-
let e =
|
|
10715
|
+
if (G.length) {
|
|
10716
|
+
let e = G.find((e) => e.id === r.data.key.replace("customWidget.", "") || e.id === r.data.key);
|
|
10642
10717
|
e && e.update(r.data.value);
|
|
10643
10718
|
}
|
|
10644
10719
|
break;
|
|
@@ -10665,7 +10740,7 @@ window.addEventListener("onWidgetLoad", async (e) => {
|
|
|
10665
10740
|
e.event;
|
|
10666
10741
|
break;
|
|
10667
10742
|
case "message":
|
|
10668
|
-
e.event,
|
|
10743
|
+
e.event, W.execute({
|
|
10669
10744
|
provider: "twitch",
|
|
10670
10745
|
data: e
|
|
10671
10746
|
});
|
|
@@ -10690,7 +10765,7 @@ window.addEventListener("onWidgetLoad", async (e) => {
|
|
|
10690
10765
|
let e = r.data;
|
|
10691
10766
|
switch (e.listener) {
|
|
10692
10767
|
case "message":
|
|
10693
|
-
e.event,
|
|
10768
|
+
e.event, W.execute({
|
|
10694
10769
|
provider: "youtube",
|
|
10695
10770
|
data: e
|
|
10696
10771
|
});
|
|
@@ -10727,7 +10802,7 @@ window.addEventListener("onWidgetLoad", async (e) => {
|
|
|
10727
10802
|
});
|
|
10728
10803
|
//#endregion
|
|
10729
10804
|
//#region src/modules/useQueue.ts
|
|
10730
|
-
var
|
|
10805
|
+
var K = class extends e {
|
|
10731
10806
|
constructor(e) {
|
|
10732
10807
|
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") throw Error("A valid processor function must be provided to useQueue.");
|
|
10733
10808
|
this.processor = e.processor, e.duration !== "client" && (this.duration = e.duration ?? 0), this.waitForClientAndBindLoad(e.duration);
|
|
@@ -10798,13 +10873,13 @@ var W = class extends e {
|
|
|
10798
10873
|
on(e, t) {
|
|
10799
10874
|
return e === "load" && this.loaded ? (t.apply(this), this) : (super.on(e, t), this);
|
|
10800
10875
|
}
|
|
10801
|
-
},
|
|
10876
|
+
}, q;
|
|
10802
10877
|
(function(e) {
|
|
10803
|
-
e.queue = new
|
|
10878
|
+
e.queue = new K({
|
|
10804
10879
|
duration: "client",
|
|
10805
10880
|
processor: async function(e) {
|
|
10806
10881
|
if (window.dispatchEvent(new CustomEvent(e.listener, { detail: e.data })), e.listener === "onEventReceived" && e.session) {
|
|
10807
|
-
let t = await
|
|
10882
|
+
let t = await q.generate.event.onSessionUpdate(window?.client && window?.client instanceof r ? window.client.session : void 0, B.event.parseProvider(e.data));
|
|
10808
10883
|
window.dispatchEvent(new CustomEvent("onSessionUpdate", { detail: t }));
|
|
10809
10884
|
}
|
|
10810
10885
|
}
|
|
@@ -11713,10 +11788,10 @@ var W = class extends e {
|
|
|
11713
11788
|
return typeof e != "object" || !e ? e : "type" in e && typeof e.type == "string" ? ((e) => {
|
|
11714
11789
|
if (!e) return e;
|
|
11715
11790
|
switch (e.type) {
|
|
11716
|
-
case "int": return
|
|
11717
|
-
case "string": return
|
|
11718
|
-
case "date": return
|
|
11719
|
-
case "array": return
|
|
11791
|
+
case "int": return B.random.number(e.min, e.max);
|
|
11792
|
+
case "string": return B.random.array(e.options)[0];
|
|
11793
|
+
case "date": return B.random.daysOffset(e.range);
|
|
11794
|
+
case "array": return B.random.array(e.options)[0];
|
|
11720
11795
|
case "recent": return t(e);
|
|
11721
11796
|
default: return e;
|
|
11722
11797
|
}
|
|
@@ -11778,7 +11853,7 @@ var W = class extends e {
|
|
|
11778
11853
|
};
|
|
11779
11854
|
},
|
|
11780
11855
|
async onSessionUpdate(e, t) {
|
|
11781
|
-
if (e ??= await
|
|
11856
|
+
if (e ??= await q.generate.session.get(), t) {
|
|
11782
11857
|
let n = (e, t) => new Date(t.createdAt).getTime() - new Date(e.createdAt).getTime();
|
|
11783
11858
|
switch (t.provider) {
|
|
11784
11859
|
case "twitch": {
|
|
@@ -11876,7 +11951,7 @@ var W = class extends e {
|
|
|
11876
11951
|
name: t.toLowerCase(),
|
|
11877
11952
|
displayName: t,
|
|
11878
11953
|
amount: r,
|
|
11879
|
-
_id:
|
|
11954
|
+
_id: B.random.uuid(),
|
|
11880
11955
|
sessionTop: !1,
|
|
11881
11956
|
type: "superchat",
|
|
11882
11957
|
originalEventName: "superchat-latest",
|
|
@@ -11897,7 +11972,7 @@ var W = class extends e {
|
|
|
11897
11972
|
name: t.toLowerCase(),
|
|
11898
11973
|
displayName: t,
|
|
11899
11974
|
amount: r,
|
|
11900
|
-
_id:
|
|
11975
|
+
_id: B.random.uuid(),
|
|
11901
11976
|
sessionTop: !1,
|
|
11902
11977
|
type: "superchat",
|
|
11903
11978
|
originalEventName: "superchat-latest",
|
|
@@ -11968,16 +12043,16 @@ var W = class extends e {
|
|
|
11968
12043
|
switch (e) {
|
|
11969
12044
|
default:
|
|
11970
12045
|
case "random":
|
|
11971
|
-
var i =
|
|
12046
|
+
var i = B.random.array(Object.keys(r).filter((e) => r[e].length))[0], a = B.random.array(r[i])[0];
|
|
11972
12047
|
return this.onEventReceived(i, a);
|
|
11973
12048
|
case "twitch": switch (t) {
|
|
11974
12049
|
default:
|
|
11975
12050
|
case "random":
|
|
11976
|
-
var a =
|
|
12051
|
+
var a = B.random.array(r[e])[0];
|
|
11977
12052
|
return this.onEventReceived(e, a);
|
|
11978
12053
|
case "message": {
|
|
11979
12054
|
let t = n;
|
|
11980
|
-
var o = t?.name ??
|
|
12055
|
+
var o = t?.name ?? B.random.array(w.names.filter((e) => e.length))[0], s = t?.message ?? B.random.array([...w.twitch_messages, ...w.normal_messages].filter((e) => e.length))[0], c = await B.message.generateBadges(t?.badges ?? [], e), l = B.message.findEmotesInText(s), u = B.message.replaceEmotesWithHTML(s, l), d = t?.color ?? B.random.color("hex"), f = t?.userId ?? B.random.string(16), p = t?.msgId ?? B.random.string(16), m = t?.time ?? Date.now(), h = t?.channel ?? window?.client?.details?.user?.username ?? "local", g = t?.reply ? {
|
|
11981
12056
|
"reply-parent-display-name": t.reply.name,
|
|
11982
12057
|
"reply-parent-msg-body": t.reply.text,
|
|
11983
12058
|
"reply-parent-msg-id": t.reply.msgId,
|
|
@@ -11999,17 +12074,17 @@ var W = class extends e {
|
|
|
11999
12074
|
data: {
|
|
12000
12075
|
time: m,
|
|
12001
12076
|
tags: {
|
|
12002
|
-
"badge-info": `${c.keys.map((e) => `${e}/${c.amount[e] ??
|
|
12077
|
+
"badge-info": `${c.keys.map((e) => `${e}/${c.amount[e] ?? B.random.number(1, 5)}`).join(",")}`,
|
|
12003
12078
|
badges: c.keys.map((e) => `${e}/1`).join(","),
|
|
12004
12079
|
...v,
|
|
12005
12080
|
"tmi-sent-ts": m.toString(),
|
|
12006
|
-
"room-id":
|
|
12081
|
+
"room-id": B.random.string(9, "numbers"),
|
|
12007
12082
|
"user-id": f,
|
|
12008
12083
|
"user-type": "",
|
|
12009
12084
|
color: d,
|
|
12010
12085
|
"display-name": o,
|
|
12011
12086
|
emotes: "",
|
|
12012
|
-
"client-nonce":
|
|
12087
|
+
"client-nonce": B.random.string(16),
|
|
12013
12088
|
flags: "",
|
|
12014
12089
|
id: p,
|
|
12015
12090
|
"first-msg": t?.firstMsg ? "1" : "0",
|
|
@@ -12035,7 +12110,7 @@ var W = class extends e {
|
|
|
12035
12110
|
}
|
|
12036
12111
|
case "cheer":
|
|
12037
12112
|
case "cheer-latest":
|
|
12038
|
-
var y = n?.amount ??
|
|
12113
|
+
var y = n?.amount ?? B.random.number(100, 1e4), b = n?.avatar ?? B.random.array(w.avatars)[0], o = n?.name ?? B.random.array(w.names.filter((e) => e.length))[0], s = n?.message ?? B.random.array(w.normal_messages.filter((e) => e.length))[0];
|
|
12039
12114
|
return {
|
|
12040
12115
|
listener: "cheer-latest",
|
|
12041
12116
|
event: {
|
|
@@ -12045,7 +12120,7 @@ var W = class extends e {
|
|
|
12045
12120
|
displayName: o,
|
|
12046
12121
|
message: s,
|
|
12047
12122
|
providerId: "",
|
|
12048
|
-
_id:
|
|
12123
|
+
_id: B.random.uuid(),
|
|
12049
12124
|
sessionTop: !1,
|
|
12050
12125
|
type: "cheer",
|
|
12051
12126
|
originalEventName: "cheer-latest",
|
|
@@ -12055,7 +12130,7 @@ var W = class extends e {
|
|
|
12055
12130
|
};
|
|
12056
12131
|
case "follower":
|
|
12057
12132
|
case "follower-latest":
|
|
12058
|
-
var b = n?.avatar ??
|
|
12133
|
+
var b = n?.avatar ?? B.random.array(w.avatars)[0], o = n?.name ?? B.random.array(w.names.filter((e) => e.length))[0];
|
|
12059
12134
|
return {
|
|
12060
12135
|
listener: "follower-latest",
|
|
12061
12136
|
event: {
|
|
@@ -12063,7 +12138,7 @@ var W = class extends e {
|
|
|
12063
12138
|
name: o.toLowerCase(),
|
|
12064
12139
|
displayName: o,
|
|
12065
12140
|
providerId: "",
|
|
12066
|
-
_id:
|
|
12141
|
+
_id: B.random.uuid(),
|
|
12067
12142
|
sessionTop: !1,
|
|
12068
12143
|
type: "follower",
|
|
12069
12144
|
originalEventName: "follower-latest",
|
|
@@ -12073,7 +12148,7 @@ var W = class extends e {
|
|
|
12073
12148
|
};
|
|
12074
12149
|
case "raid":
|
|
12075
12150
|
case "raid-latest":
|
|
12076
|
-
var y = n?.amount ??
|
|
12151
|
+
var y = n?.amount ?? B.random.number(1, 100), b = n?.avatar ?? B.random.array(w.avatars)[0], o = n?.name ?? B.random.array(w.names.filter((e) => e.length))[0];
|
|
12077
12152
|
return {
|
|
12078
12153
|
listener: "raid-latest",
|
|
12079
12154
|
event: {
|
|
@@ -12082,7 +12157,7 @@ var W = class extends e {
|
|
|
12082
12157
|
name: o.toLowerCase(),
|
|
12083
12158
|
displayName: o,
|
|
12084
12159
|
providerId: "",
|
|
12085
|
-
_id:
|
|
12160
|
+
_id: B.random.uuid(),
|
|
12086
12161
|
sessionTop: !1,
|
|
12087
12162
|
type: "raid",
|
|
12088
12163
|
originalEventName: "raid-latest",
|
|
@@ -12092,12 +12167,12 @@ var W = class extends e {
|
|
|
12092
12167
|
};
|
|
12093
12168
|
case "subscriber":
|
|
12094
12169
|
case "subscriber-latest":
|
|
12095
|
-
var x = n?.tier ??
|
|
12170
|
+
var x = n?.tier ?? B.random.array([
|
|
12096
12171
|
"1000",
|
|
12097
12172
|
"2000",
|
|
12098
12173
|
"3000",
|
|
12099
12174
|
"prime"
|
|
12100
|
-
])[0], y = n?.amount ??
|
|
12175
|
+
])[0], y = n?.amount ?? B.random.number(1, 24), b = n?.avatar ?? B.random.array(w.avatars)[0], o = n?.name ?? B.random.array(w.names.filter((e) => e.length))[0], S = n?.sender ?? B.random.array(w.names.filter((e) => e.length && e !== o))[0], s = n?.message ?? B.random.array(w.normal_messages.filter((e) => e.length))[0], C = {
|
|
12101
12176
|
default: {
|
|
12102
12177
|
avatar: b,
|
|
12103
12178
|
playedAsCommunityGift: !1
|
|
@@ -12121,7 +12196,7 @@ var W = class extends e {
|
|
|
12121
12196
|
"gift",
|
|
12122
12197
|
"community",
|
|
12123
12198
|
"spam"
|
|
12124
|
-
], E = n?.subType ??
|
|
12199
|
+
], E = n?.subType ?? B.random.array(T)[0];
|
|
12125
12200
|
return E = T.includes(E) ? E : "default", {
|
|
12126
12201
|
listener: "subscriber-latest",
|
|
12127
12202
|
event: {
|
|
@@ -12132,7 +12207,7 @@ var W = class extends e {
|
|
|
12132
12207
|
tier: x,
|
|
12133
12208
|
...C.default,
|
|
12134
12209
|
...C[E],
|
|
12135
|
-
_id:
|
|
12210
|
+
_id: B.random.uuid(),
|
|
12136
12211
|
sessionTop: !1,
|
|
12137
12212
|
type: "subscriber",
|
|
12138
12213
|
originalEventName: "subscriber-latest",
|
|
@@ -12143,7 +12218,7 @@ var W = class extends e {
|
|
|
12143
12218
|
case "delete-message": return {
|
|
12144
12219
|
listener: "delete-message",
|
|
12145
12220
|
event: {
|
|
12146
|
-
msgId: n?.id ??
|
|
12221
|
+
msgId: n?.id ?? B.random.uuid(),
|
|
12147
12222
|
provider: e
|
|
12148
12223
|
},
|
|
12149
12224
|
emulated: !0
|
|
@@ -12151,7 +12226,7 @@ var W = class extends e {
|
|
|
12151
12226
|
case "delete-messages": return {
|
|
12152
12227
|
listener: "delete-messages",
|
|
12153
12228
|
event: {
|
|
12154
|
-
userId: n?.id ??
|
|
12229
|
+
userId: n?.id ?? B.random.number(1e7, 99999999).toString(),
|
|
12155
12230
|
provider: e
|
|
12156
12231
|
},
|
|
12157
12232
|
emulated: !0
|
|
@@ -12160,11 +12235,11 @@ var W = class extends e {
|
|
|
12160
12235
|
case "streamelements": switch (t) {
|
|
12161
12236
|
default:
|
|
12162
12237
|
case "random":
|
|
12163
|
-
var a =
|
|
12238
|
+
var a = B.random.array(r[e])[0];
|
|
12164
12239
|
return this.onEventReceived(e, a);
|
|
12165
12240
|
case "tip":
|
|
12166
12241
|
case "tip-latest":
|
|
12167
|
-
var y = n?.amount ??
|
|
12242
|
+
var y = n?.amount ?? B.random.number(100, 4e3), b = n?.avatar ?? B.random.array(w.avatars)[0], o = n?.name ?? B.random.array(w.names.filter((e) => e.length))[0];
|
|
12168
12243
|
return {
|
|
12169
12244
|
listener: "tip-latest",
|
|
12170
12245
|
event: {
|
|
@@ -12173,7 +12248,7 @@ var W = class extends e {
|
|
|
12173
12248
|
name: o.toLowerCase(),
|
|
12174
12249
|
displayName: o,
|
|
12175
12250
|
providerId: "",
|
|
12176
|
-
_id:
|
|
12251
|
+
_id: B.random.uuid(),
|
|
12177
12252
|
sessionTop: !1,
|
|
12178
12253
|
type: "tip",
|
|
12179
12254
|
originalEventName: "tip-latest",
|
|
@@ -12196,7 +12271,7 @@ var W = class extends e {
|
|
|
12196
12271
|
listener: "bot:counter",
|
|
12197
12272
|
event: {
|
|
12198
12273
|
counter: n?.counter ?? "sampleCounter",
|
|
12199
|
-
value: n?.value ??
|
|
12274
|
+
value: n?.value ?? B.random.number(0, 100),
|
|
12200
12275
|
provider: e
|
|
12201
12276
|
},
|
|
12202
12277
|
emulated: !0
|
|
@@ -12221,12 +12296,12 @@ var W = class extends e {
|
|
|
12221
12296
|
case "youtube": switch (t) {
|
|
12222
12297
|
default:
|
|
12223
12298
|
case "random":
|
|
12224
|
-
var a =
|
|
12299
|
+
var a = B.random.array(r[e])[0];
|
|
12225
12300
|
return this.onEventReceived(e, a);
|
|
12226
12301
|
case "message": {
|
|
12227
|
-
var o = n?.name ??
|
|
12228
|
-
let t = await
|
|
12229
|
-
var l =
|
|
12302
|
+
var o = n?.name ?? B.random.array(w.names.filter((e) => e.length))[0], s = n?.message ?? B.random.array([...w.youtube_messages, ...w.normal_messages].filter((e) => e.length))[0];
|
|
12303
|
+
let t = await B.message.generateBadges(n?.badges ?? [], e);
|
|
12304
|
+
var l = B.message.findEmotesInText(s), u = B.message.replaceEmotesWithHTML(s, l), d = n?.color ?? B.random.color("hex"), f = n?.userId ?? B.random.number(1e7, 99999999).toString(), p = n?.msgId ?? B.random.uuid(), m = n?.time ?? Date.now(), b = n?.avatar ?? B.random.array(w.avatars)[0], h = n?.channel ?? window?.client?.details?.user?.username ?? "local";
|
|
12230
12305
|
return {
|
|
12231
12306
|
listener: "message",
|
|
12232
12307
|
event: {
|
|
@@ -12272,7 +12347,7 @@ var W = class extends e {
|
|
|
12272
12347
|
}
|
|
12273
12348
|
case "subscriber":
|
|
12274
12349
|
case "subscriber-latest":
|
|
12275
|
-
var b = n?.avatar ??
|
|
12350
|
+
var b = n?.avatar ?? B.random.array(w.avatars)[0], o = n?.name ?? B.random.array(w.names.filter((e) => e.length))[0];
|
|
12276
12351
|
return {
|
|
12277
12352
|
listener: "subscriber-latest",
|
|
12278
12353
|
event: {
|
|
@@ -12280,7 +12355,7 @@ var W = class extends e {
|
|
|
12280
12355
|
displayName: o,
|
|
12281
12356
|
name: o.toLowerCase(),
|
|
12282
12357
|
providerId: "",
|
|
12283
|
-
_id:
|
|
12358
|
+
_id: B.random.uuid(),
|
|
12284
12359
|
sessionTop: !1,
|
|
12285
12360
|
type: "subscriber",
|
|
12286
12361
|
originalEventName: "subscriber-latest",
|
|
@@ -12290,7 +12365,7 @@ var W = class extends e {
|
|
|
12290
12365
|
};
|
|
12291
12366
|
case "superchat":
|
|
12292
12367
|
case "superchat-latest":
|
|
12293
|
-
var y = n?.amount ??
|
|
12368
|
+
var y = n?.amount ?? B.random.number(100, 4e3), b = n?.avatar ?? B.random.array(w.avatars)[0], o = n?.name ?? B.random.array(w.names.filter((e) => e.length))[0];
|
|
12294
12369
|
return {
|
|
12295
12370
|
listener: "superchat-latest",
|
|
12296
12371
|
event: {
|
|
@@ -12299,7 +12374,7 @@ var W = class extends e {
|
|
|
12299
12374
|
name: o.toLowerCase(),
|
|
12300
12375
|
displayName: o,
|
|
12301
12376
|
providerId: "",
|
|
12302
|
-
_id:
|
|
12377
|
+
_id: B.random.uuid(),
|
|
12303
12378
|
sessionTop: !1,
|
|
12304
12379
|
type: "superchat",
|
|
12305
12380
|
originalEventName: "superchat-latest",
|
|
@@ -12309,11 +12384,11 @@ var W = class extends e {
|
|
|
12309
12384
|
};
|
|
12310
12385
|
case "sponsor":
|
|
12311
12386
|
case "sponsor-latest":
|
|
12312
|
-
var x = n?.tier ??
|
|
12387
|
+
var x = n?.tier ?? B.random.array([
|
|
12313
12388
|
"1000",
|
|
12314
12389
|
"2000",
|
|
12315
12390
|
"3000"
|
|
12316
|
-
])[0], y = n?.amount ??
|
|
12391
|
+
])[0], y = n?.amount ?? B.random.number(1, 24), b = n?.avatar ?? B.random.array(w.avatars)[0], o = n?.name ?? B.random.array(w.names.filter((e) => e.length))[0], S = n?.sender ?? B.random.array(w.names.filter((e) => e.length && e !== o))[0], s = n?.message ?? B.random.array(w.normal_messages.filter((e) => e.length))[0], C = {
|
|
12317
12392
|
default: {
|
|
12318
12393
|
avatar: b,
|
|
12319
12394
|
playedAsCommunityGift: !1
|
|
@@ -12337,7 +12412,7 @@ var W = class extends e {
|
|
|
12337
12412
|
"gift",
|
|
12338
12413
|
"community",
|
|
12339
12414
|
"spam"
|
|
12340
|
-
], E = n?.subType ??
|
|
12415
|
+
], E = n?.subType ?? B.random.array(T)[0];
|
|
12341
12416
|
return E = T.includes(E) ? E : "default", {
|
|
12342
12417
|
listener: "sponsor-latest",
|
|
12343
12418
|
event: {
|
|
@@ -12347,7 +12422,7 @@ var W = class extends e {
|
|
|
12347
12422
|
providerId: "",
|
|
12348
12423
|
...C.default,
|
|
12349
12424
|
...C[E],
|
|
12350
|
-
_id:
|
|
12425
|
+
_id: B.random.uuid(),
|
|
12351
12426
|
sessionTop: !1,
|
|
12352
12427
|
type: "sponsor",
|
|
12353
12428
|
originalEventName: "sponsor-latest",
|
|
@@ -12362,8 +12437,8 @@ var W = class extends e {
|
|
|
12362
12437
|
}, e.emulate = {
|
|
12363
12438
|
twitch: {
|
|
12364
12439
|
message(e = {}) {
|
|
12365
|
-
|
|
12366
|
-
e &&
|
|
12440
|
+
q.generate.event.onEventReceived("twitch", "message", e).then((e) => {
|
|
12441
|
+
e && q.emulate.send("onEventReceived", e);
|
|
12367
12442
|
});
|
|
12368
12443
|
},
|
|
12369
12444
|
deleteMessage(e) {
|
|
@@ -12372,7 +12447,7 @@ var W = class extends e {
|
|
|
12372
12447
|
listener: "delete-message",
|
|
12373
12448
|
event: { msgId: e }
|
|
12374
12449
|
};
|
|
12375
|
-
|
|
12450
|
+
q.emulate.send("onEventReceived", t);
|
|
12376
12451
|
},
|
|
12377
12452
|
deleteMessages(e) {
|
|
12378
12453
|
if (!e || typeof e != "string") return;
|
|
@@ -12380,79 +12455,79 @@ var W = class extends e {
|
|
|
12380
12455
|
listener: "delete-messages",
|
|
12381
12456
|
event: { userId: e }
|
|
12382
12457
|
};
|
|
12383
|
-
|
|
12458
|
+
q.emulate.send("onEventReceived", t);
|
|
12384
12459
|
},
|
|
12385
12460
|
follower(e = {}) {
|
|
12386
|
-
|
|
12387
|
-
e &&
|
|
12461
|
+
q.generate.event.onEventReceived("twitch", "follower-latest", e).then((e) => {
|
|
12462
|
+
e && q.emulate.send("onEventReceived", e);
|
|
12388
12463
|
});
|
|
12389
12464
|
},
|
|
12390
12465
|
raid(e = {}) {
|
|
12391
|
-
|
|
12392
|
-
e &&
|
|
12466
|
+
q.generate.event.onEventReceived("twitch", "raid-latest", e).then((e) => {
|
|
12467
|
+
e && q.emulate.send("onEventReceived", e);
|
|
12393
12468
|
});
|
|
12394
12469
|
},
|
|
12395
12470
|
cheer(e = {}) {
|
|
12396
|
-
|
|
12397
|
-
e &&
|
|
12471
|
+
q.generate.event.onEventReceived("twitch", "cheer-latest", e).then((e) => {
|
|
12472
|
+
e && q.emulate.send("onEventReceived", e);
|
|
12398
12473
|
});
|
|
12399
12474
|
},
|
|
12400
12475
|
subscriber(e = {}) {
|
|
12401
|
-
|
|
12402
|
-
e &&
|
|
12476
|
+
q.generate.event.onEventReceived("twitch", "subscriber-latest", e).then((e) => {
|
|
12477
|
+
e && q.emulate.send("onEventReceived", e);
|
|
12403
12478
|
});
|
|
12404
12479
|
}
|
|
12405
12480
|
},
|
|
12406
12481
|
streamelements: { tip(e = {}) {
|
|
12407
|
-
|
|
12408
|
-
e &&
|
|
12482
|
+
q.generate.event.onEventReceived("streamelements", "tip-latest", e).then((e) => {
|
|
12483
|
+
e && q.emulate.send("onEventReceived", e);
|
|
12409
12484
|
});
|
|
12410
12485
|
} },
|
|
12411
12486
|
youtube: {
|
|
12412
12487
|
message(e = {}) {
|
|
12413
|
-
|
|
12414
|
-
e &&
|
|
12488
|
+
q.generate.event.onEventReceived("youtube", "message", e).then((e) => {
|
|
12489
|
+
e && q.emulate.send("onEventReceived", e);
|
|
12415
12490
|
});
|
|
12416
12491
|
},
|
|
12417
12492
|
subscriber(e = {}) {
|
|
12418
|
-
|
|
12419
|
-
e &&
|
|
12493
|
+
q.generate.event.onEventReceived("youtube", "subscriber-latest", e).then((e) => {
|
|
12494
|
+
e && q.emulate.send("onEventReceived", e);
|
|
12420
12495
|
});
|
|
12421
12496
|
},
|
|
12422
12497
|
superchat(e = {}) {
|
|
12423
|
-
|
|
12424
|
-
e &&
|
|
12498
|
+
q.generate.event.onEventReceived("youtube", "superchat-latest", e).then((e) => {
|
|
12499
|
+
e && q.emulate.send("onEventReceived", e);
|
|
12425
12500
|
});
|
|
12426
12501
|
},
|
|
12427
12502
|
sponsor(e = {}) {
|
|
12428
|
-
|
|
12429
|
-
e &&
|
|
12503
|
+
q.generate.event.onEventReceived("youtube", "sponsor-latest", e).then((e) => {
|
|
12504
|
+
e && q.emulate.send("onEventReceived", e);
|
|
12430
12505
|
});
|
|
12431
12506
|
}
|
|
12432
12507
|
},
|
|
12433
12508
|
kick: {},
|
|
12434
12509
|
facebook: {},
|
|
12435
12510
|
send(e, t) {
|
|
12436
|
-
if (!
|
|
12511
|
+
if (!q.queue) {
|
|
12437
12512
|
Q.warn("Local queue is not initialized."), window.dispatchEvent(new CustomEvent(e, { detail: t }));
|
|
12438
12513
|
return;
|
|
12439
12514
|
}
|
|
12440
12515
|
switch (e) {
|
|
12441
12516
|
case "onEventReceived":
|
|
12442
|
-
|
|
12517
|
+
q.queue.enqueue({
|
|
12443
12518
|
listener: e,
|
|
12444
12519
|
data: t,
|
|
12445
12520
|
session: e === "onEventReceived" ? !0 : void 0
|
|
12446
12521
|
});
|
|
12447
12522
|
break;
|
|
12448
12523
|
case "onSessionUpdate":
|
|
12449
|
-
|
|
12524
|
+
q.queue.enqueue({
|
|
12450
12525
|
listener: e,
|
|
12451
12526
|
data: t
|
|
12452
12527
|
});
|
|
12453
12528
|
break;
|
|
12454
12529
|
case "onWidgetLoad":
|
|
12455
|
-
|
|
12530
|
+
q.queue.enqueue({
|
|
12456
12531
|
listener: e,
|
|
12457
12532
|
data: t
|
|
12458
12533
|
});
|
|
@@ -12488,15 +12563,15 @@ var W = class extends e {
|
|
|
12488
12563
|
})
|
|
12489
12564
|
}, i = await fetch("./" + (r.data ?? "data.json"), { cache: "no-store" }).then((e) => e.json()).catch(() => ({}));
|
|
12490
12565
|
await fetch("./" + (r.fields ?? "fields.json"), { cache: "no-store" }).then((e) => e.json()).then(async (e) => {
|
|
12491
|
-
let t = Object.entries(e).filter(([e, { value: t }]) => t != null).reduce((e, [t, { value: n }]) => (i && i[t] !== void 0 && (n = i[t]), e[t] = n, e), { ...i }), r = await
|
|
12566
|
+
let t = Object.entries(e).filter(([e, { value: t }]) => t != null).reduce((e, [t, { value: n }]) => (i && i[t] !== void 0 && (n = i[t]), e[t] = n, e), { ...i }), r = await q.generate.event.onWidgetLoad(t, await q.generate.session.get(n));
|
|
12492
12567
|
window.dispatchEvent(new CustomEvent("onWidgetLoad", { detail: r }));
|
|
12493
12568
|
});
|
|
12494
12569
|
}
|
|
12495
12570
|
e.start = t;
|
|
12496
|
-
})(
|
|
12571
|
+
})(q ||= {});
|
|
12497
12572
|
//#endregion
|
|
12498
12573
|
//#region src/modules/useLogger.ts
|
|
12499
|
-
var
|
|
12574
|
+
var J = class {
|
|
12500
12575
|
constructor(e = {}) {
|
|
12501
12576
|
this.error = this.apply({
|
|
12502
12577
|
color: "#721c24",
|
|
@@ -12594,7 +12669,7 @@ var K = class {
|
|
|
12594
12669
|
timeEnd(e) {
|
|
12595
12670
|
!this.enabled || !console.timeEnd || console.timeEnd(e);
|
|
12596
12671
|
}
|
|
12597
|
-
},
|
|
12672
|
+
}, re = class extends e {
|
|
12598
12673
|
constructor(e, t) {
|
|
12599
12674
|
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((e) => {
|
|
12600
12675
|
this.instance = e, this.emit("load", e), this.connect();
|
|
@@ -12631,7 +12706,7 @@ var K = class {
|
|
|
12631
12706
|
msgId: i.id,
|
|
12632
12707
|
channel: i.channel
|
|
12633
12708
|
};
|
|
12634
|
-
|
|
12709
|
+
q.emulate.twitch.message(o);
|
|
12635
12710
|
}
|
|
12636
12711
|
}, this.instance.onChat = (e, t, n, r, i) => {
|
|
12637
12712
|
if (this.emit("chat", e, t, n, r, i), client?.debug && Q.debug("[Client]", `ComfyJS Chat: ${t} (User: ${e})`), this.emulate) {
|
|
@@ -12644,7 +12719,7 @@ var K = class {
|
|
|
12644
12719
|
subscriber: n.subscriber,
|
|
12645
12720
|
founder: n.founder
|
|
12646
12721
|
};
|
|
12647
|
-
|
|
12722
|
+
q.emulate.twitch.message({
|
|
12648
12723
|
name: e,
|
|
12649
12724
|
message: t,
|
|
12650
12725
|
badges: Object.entries(r).map(([e, t]) => t ? e : null).filter(Boolean),
|
|
@@ -12658,7 +12733,7 @@ var K = class {
|
|
|
12658
12733
|
}, this.instance.onWhisper = (e, t, n, r, i) => {
|
|
12659
12734
|
this.emit("whisper", e, t, n, r, i), client?.debug && Q.debug("[Client]", `ComfyJS Whisper: ${t} (User: ${e})`);
|
|
12660
12735
|
}, this.instance.onMessageDeleted = (e, t) => {
|
|
12661
|
-
this.emit("messageDeleted", e, t), client?.debug && Q.debug("[Client]", `ComfyJS Message Deleted: ${e}`), this.emulate &&
|
|
12736
|
+
this.emit("messageDeleted", e, t), client?.debug && Q.debug("[Client]", `ComfyJS Message Deleted: ${e}`), this.emulate && q.emulate.twitch.deleteMessage(e);
|
|
12662
12737
|
}, this.instance.onJoin = (e, t, n) => {
|
|
12663
12738
|
this.emit("join", e, t, n), client?.debug && Q.debug("[Client]", `ComfyJS Join: ${e}`);
|
|
12664
12739
|
}, this.instance.onPart = (e, t, n) => {
|
|
@@ -12666,14 +12741,14 @@ var K = class {
|
|
|
12666
12741
|
}, this.instance.onHosted = (e, t, n, r) => {
|
|
12667
12742
|
this.emit("hosted", e, t, n, r), client?.debug && Q.debug("[Client]", `ComfyJS Hosted: ${e} (${t} viewers)`);
|
|
12668
12743
|
}, this.instance.onRaid = (e, t, n) => {
|
|
12669
|
-
this.emit("raid", e, t, n), client?.debug && Q.debug("[Client]", `ComfyJS Raid: ${e} (${t} viewers)`), this.emulate &&
|
|
12744
|
+
this.emit("raid", e, t, n), client?.debug && Q.debug("[Client]", `ComfyJS Raid: ${e} (${t} viewers)`), this.emulate && q.emulate.twitch.raid({
|
|
12670
12745
|
name: e,
|
|
12671
12746
|
amount: t
|
|
12672
12747
|
});
|
|
12673
12748
|
}, this.instance.onSub = (e, t, n, r) => {
|
|
12674
12749
|
if (this.emit("sub", e, t, n, r), client?.debug && Q.debug("[Client]", `ComfyJS Sub: ${e} (${n.plan})`), this.emulate) {
|
|
12675
12750
|
let r = n.plan === "Prime" ? "prime" : n.plan;
|
|
12676
|
-
|
|
12751
|
+
q.emulate.twitch.subscriber({
|
|
12677
12752
|
name: e,
|
|
12678
12753
|
message: t,
|
|
12679
12754
|
tier: r,
|
|
@@ -12683,7 +12758,7 @@ var K = class {
|
|
|
12683
12758
|
}, this.instance.onResub = (e, t, n, r, i, a) => {
|
|
12684
12759
|
if (this.emit("resub", e, t, n, r, i, a), client?.debug && Q.debug("[Client]", `ComfyJS Resub: ${e} (${r} months)`), this.emulate) {
|
|
12685
12760
|
let n = i.plan === "Prime" ? "prime" : i.plan;
|
|
12686
|
-
|
|
12761
|
+
q.emulate.twitch.subscriber({
|
|
12687
12762
|
name: e,
|
|
12688
12763
|
message: t,
|
|
12689
12764
|
tier: n,
|
|
@@ -12694,7 +12769,7 @@ var K = class {
|
|
|
12694
12769
|
}, this.instance.onSubGift = (e, t, n, r, i, a) => {
|
|
12695
12770
|
if (this.emit("subGift", e, t, n, r, i, a), client?.debug && Q.debug("[Client]", `ComfyJS Sub Gift: ${e} gifted ${r} subs`), this.emulate) {
|
|
12696
12771
|
let t = i.plan === "Prime" ? "prime" : i.plan;
|
|
12697
|
-
|
|
12772
|
+
q.emulate.twitch.subscriber({
|
|
12698
12773
|
name: n,
|
|
12699
12774
|
message: "",
|
|
12700
12775
|
sender: e,
|
|
@@ -12706,7 +12781,7 @@ var K = class {
|
|
|
12706
12781
|
}, this.instance.onSubMysteryGift = (e, t, n, r, i) => {
|
|
12707
12782
|
if (this.emit("subMysteryGift", e, t, n, r, i), client?.debug && Q.debug("[Client]", `ComfyJS Sub Mystery Gift: ${e} gifted ${t} subs`), this.emulate) {
|
|
12708
12783
|
let n = r.plan === "Prime" ? "prime" : r.plan;
|
|
12709
|
-
|
|
12784
|
+
q.emulate.twitch.subscriber({
|
|
12710
12785
|
name: e,
|
|
12711
12786
|
message: "",
|
|
12712
12787
|
amount: t,
|
|
@@ -12715,7 +12790,7 @@ var K = class {
|
|
|
12715
12790
|
});
|
|
12716
12791
|
}
|
|
12717
12792
|
}, this.instance.onGiftSubContinue = (e, t, n) => {
|
|
12718
|
-
this.emit("giftSubContinue", e, t, n), client?.debug && Q.debug("[Client]", `ComfyJS Gift Sub Continue: ${e} continued their gifted sub from ${t}`), this.emulate &&
|
|
12793
|
+
this.emit("giftSubContinue", e, t, n), client?.debug && Q.debug("[Client]", `ComfyJS Gift Sub Continue: ${e} continued their gifted sub from ${t}`), this.emulate && q.emulate.twitch.subscriber({
|
|
12719
12794
|
name: e,
|
|
12720
12795
|
message: "",
|
|
12721
12796
|
sender: t,
|
|
@@ -12723,7 +12798,7 @@ var K = class {
|
|
|
12723
12798
|
subType: "gift"
|
|
12724
12799
|
});
|
|
12725
12800
|
}, this.instance.onCheer = (e, t, n, r, i) => {
|
|
12726
|
-
this.emit("cheer", e, t, n, r, i), client?.debug && Q.debug("[Client]", `ComfyJS Cheer: ${e} cheered ${n} bits - ${t}`), this.emulate &&
|
|
12801
|
+
this.emit("cheer", e, t, n, r, i), client?.debug && Q.debug("[Client]", `ComfyJS Cheer: ${e} cheered ${n} bits - ${t}`), this.emulate && q.emulate.twitch.cheer({
|
|
12727
12802
|
name: e,
|
|
12728
12803
|
message: t,
|
|
12729
12804
|
amount: n
|
|
@@ -12738,7 +12813,7 @@ var K = class {
|
|
|
12738
12813
|
this.emit("reconnect", e), client?.debug && Q.debug("[Client]", `ComfyJS Reconnect: Attempt #${e}`);
|
|
12739
12814
|
}, this.init && this.instance.Init(this.username, this.password, this.channels, this.isDebug);
|
|
12740
12815
|
}
|
|
12741
|
-
},
|
|
12816
|
+
}, Y = {
|
|
12742
12817
|
getOverlayStatus: () => ({
|
|
12743
12818
|
isEditorMode: !1,
|
|
12744
12819
|
muted: !1
|
|
@@ -12758,7 +12833,7 @@ var K = class {
|
|
|
12758
12833
|
setField(e, t, n) {},
|
|
12759
12834
|
store: {
|
|
12760
12835
|
set: function(e, t) {
|
|
12761
|
-
this.list[e] = t, localStorage.setItem("SE_API-STORE", JSON.stringify(
|
|
12836
|
+
this.list[e] = t, localStorage.setItem("SE_API-STORE", JSON.stringify(Y.store.list));
|
|
12762
12837
|
},
|
|
12763
12838
|
get: async function(e) {
|
|
12764
12839
|
return this.list[e] ? this.list[e] : null;
|
|
@@ -12766,9 +12841,9 @@ var K = class {
|
|
|
12766
12841
|
list: {}
|
|
12767
12842
|
}
|
|
12768
12843
|
};
|
|
12769
|
-
async function
|
|
12844
|
+
async function ie() {
|
|
12770
12845
|
let e = localStorage.getItem("SE_API-STORE") ?? "", t = e ? JSON.parse(e) : {};
|
|
12771
|
-
return
|
|
12846
|
+
return Y.store.list = t, Y;
|
|
12772
12847
|
}
|
|
12773
12848
|
//#endregion
|
|
12774
12849
|
//#region src/utils/alejo.ts
|
|
@@ -12821,40 +12896,40 @@ var X;
|
|
|
12821
12896
|
})(X ||= {});
|
|
12822
12897
|
//#endregion
|
|
12823
12898
|
//#region src/main.ts
|
|
12824
|
-
var Z = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(
|
|
12899
|
+
var Z = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(ie()), Q = new J(), $ = {
|
|
12825
12900
|
SeAPI: Z,
|
|
12826
12901
|
Client: r,
|
|
12827
|
-
Helper:
|
|
12828
|
-
Local:
|
|
12902
|
+
Helper: B,
|
|
12903
|
+
Local: q,
|
|
12829
12904
|
Data: w,
|
|
12830
12905
|
logger: Q,
|
|
12831
12906
|
modules: {
|
|
12832
12907
|
EventProvider: e,
|
|
12833
12908
|
useStorage: n,
|
|
12834
|
-
useQueue:
|
|
12835
|
-
useLogger:
|
|
12836
|
-
useComms:
|
|
12837
|
-
FakeUserPool:
|
|
12909
|
+
useQueue: K,
|
|
12910
|
+
useLogger: J,
|
|
12911
|
+
useComms: ne,
|
|
12912
|
+
FakeUserPool: te
|
|
12838
12913
|
},
|
|
12839
12914
|
actions: {
|
|
12840
|
-
Button:
|
|
12841
|
-
Command:
|
|
12915
|
+
Button: H,
|
|
12916
|
+
Command: W
|
|
12842
12917
|
},
|
|
12843
|
-
multistream: { useComfyJs:
|
|
12918
|
+
multistream: { useComfyJs: re },
|
|
12844
12919
|
internal: {
|
|
12845
12920
|
usedStorages: t,
|
|
12846
|
-
usedComms:
|
|
12847
|
-
usedCommands:
|
|
12848
|
-
usedButtons:
|
|
12849
|
-
fakeUserPools:
|
|
12921
|
+
usedComms: G,
|
|
12922
|
+
usedCommands: U,
|
|
12923
|
+
usedButtons: V,
|
|
12924
|
+
fakeUserPools: R
|
|
12850
12925
|
},
|
|
12851
12926
|
pronouns: { Alejo: X }
|
|
12852
12927
|
};
|
|
12853
12928
|
typeof window < "u" ? window.Tixyel = $ : globalThis.Tixyel = $;
|
|
12854
12929
|
//#endregion
|
|
12855
12930
|
//#region src/index.ts
|
|
12856
|
-
var
|
|
12931
|
+
var ae = $;
|
|
12857
12932
|
//#endregion
|
|
12858
|
-
export {
|
|
12933
|
+
export { ae as default };
|
|
12859
12934
|
|
|
12860
12935
|
//# sourceMappingURL=index.es.js.map
|