@tixyel/streamelements 7.6.8 → 7.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +149 -1
- package/dist/index.es.js +299 -107
- 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
|
@@ -227,6 +227,43 @@ var e = Object.defineProperty, t = (t, n) => {
|
|
|
227
227
|
e.nodeType === Node.TEXT_NODE ? l += e.textContent : l += e.outerHTML;
|
|
228
228
|
}), l;
|
|
229
229
|
}
|
|
230
|
+
getElementCSSVariables(e = ":root", t = () => !0, n) {
|
|
231
|
+
let r = Array.from(document.styleSheets), i = [];
|
|
232
|
+
for (let t of r) {
|
|
233
|
+
try {
|
|
234
|
+
for (let n of Array.from(t.cssRules)) n?.selectorText === e && (i = [...n.cssText.matchAll(/(--[\w-]+)\s*:\s*([^;]+);/g)].map((e) => [e[1], e[2].trim()]));
|
|
235
|
+
} catch {}
|
|
236
|
+
if (i.length) break;
|
|
237
|
+
}
|
|
238
|
+
return i.filter(([e]) => n?.filterHelpers ? e.endsWith("-min") || e.endsWith("-max") ? !1 : !e.endsWith("-step") : !0).filter(t);
|
|
239
|
+
}
|
|
240
|
+
CSS(e, t) {
|
|
241
|
+
let n = (e) => e.startsWith("--") ? e : e.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
|
|
242
|
+
for (let [r, i] of Object.entries(t)) {
|
|
243
|
+
let t = n(r);
|
|
244
|
+
if (i == null) {
|
|
245
|
+
e.style.setProperty(t, "");
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
let a = String(i).trim();
|
|
249
|
+
if (a.endsWith("!important")) {
|
|
250
|
+
let n = a.replace(/\s*!important\s*$/, "").trim();
|
|
251
|
+
e.style.setProperty(t, n, "important");
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
e.style.setProperty(t, a);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
escapeHtml(e) {
|
|
258
|
+
let t = {
|
|
259
|
+
"&": "&",
|
|
260
|
+
"<": "<",
|
|
261
|
+
">": ">",
|
|
262
|
+
"\"": """,
|
|
263
|
+
"'": "'"
|
|
264
|
+
};
|
|
265
|
+
return e.replace(/[&<>"']/g, (e) => t[e]);
|
|
266
|
+
}
|
|
230
267
|
}, i = class {
|
|
231
268
|
flatten(e, t = !0, n = "") {
|
|
232
269
|
let r = {};
|
|
@@ -10036,7 +10073,7 @@ var j = class {
|
|
|
10036
10073
|
let M = e.replace(f.PLACEHOLDERS, (e, t) => typeof d[t] == "string" || typeof d[t] == "number" ? String(d[t]) : t ?? t);
|
|
10037
10074
|
return M = n.method === "loop" ? k(M) : A(M), M;
|
|
10038
10075
|
}
|
|
10039
|
-
},
|
|
10076
|
+
}, ee = class {
|
|
10040
10077
|
constructor() {
|
|
10041
10078
|
this.playing = !1;
|
|
10042
10079
|
}
|
|
@@ -10055,21 +10092,21 @@ var j = class {
|
|
|
10055
10092
|
throw Error(`Error playing sound: ${e}`);
|
|
10056
10093
|
}
|
|
10057
10094
|
}
|
|
10058
|
-
},
|
|
10095
|
+
}, te = class {
|
|
10059
10096
|
apply(e, t, n) {
|
|
10060
10097
|
return e.apply(t, n);
|
|
10061
10098
|
}
|
|
10062
10099
|
call(e, t, ...n) {
|
|
10063
10100
|
return e.call(t, ...n);
|
|
10064
10101
|
}
|
|
10065
|
-
},
|
|
10066
|
-
fakeUserPools: () =>
|
|
10067
|
-
usedButtons: () =>
|
|
10068
|
-
usedClients: () =>
|
|
10069
|
-
usedCommands: () =>
|
|
10070
|
-
usedComms: () =>
|
|
10071
|
-
usedStorages: () =>
|
|
10072
|
-
}),
|
|
10102
|
+
}, ne = /* @__PURE__ */ t({
|
|
10103
|
+
fakeUserPools: () => R,
|
|
10104
|
+
usedButtons: () => L,
|
|
10105
|
+
usedClients: () => N,
|
|
10106
|
+
usedCommands: () => I,
|
|
10107
|
+
usedComms: () => F,
|
|
10108
|
+
usedStorages: () => P
|
|
10109
|
+
}), N = [], P = [], F = [], I = [], L = [], R = [], z = class e {
|
|
10073
10110
|
delay(e, t) {
|
|
10074
10111
|
return new Promise((n) => setTimeout(() => {
|
|
10075
10112
|
n(t ? t() ?? null : null);
|
|
@@ -10123,7 +10160,7 @@ var j = class {
|
|
|
10123
10160
|
async findSubscriptionTier({ userId: e, name: t, broadcasterId: n }, r, i = !1) {
|
|
10124
10161
|
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;
|
|
10125
10162
|
if (e?.includes("fake_user_")) {
|
|
10126
|
-
let t =
|
|
10163
|
+
let t = R.find((t) => e.endsWith(`+${t.id}`));
|
|
10127
10164
|
if (t) {
|
|
10128
10165
|
let n = t.getById(e);
|
|
10129
10166
|
if (n) return a(n.tier);
|
|
@@ -10361,15 +10398,170 @@ var j = class {
|
|
|
10361
10398
|
y: r
|
|
10362
10399
|
};
|
|
10363
10400
|
}
|
|
10364
|
-
},
|
|
10401
|
+
}, ie = class {
|
|
10402
|
+
assignFields(e, t = "", n = {}, r) {
|
|
10403
|
+
if (!(!e || typeof e != "object")) return Object.assign(n, Object.entries(e).reduce((e, [n, { type: i, label: a, ...o }]) => (e[t + n] = {
|
|
10404
|
+
type: i || "text",
|
|
10405
|
+
label: a,
|
|
10406
|
+
...o,
|
|
10407
|
+
group: r && r.length ? r : o?.group
|
|
10408
|
+
}, e), {})), n;
|
|
10409
|
+
}
|
|
10410
|
+
checkFieldErrors(e) {
|
|
10411
|
+
let t = Object.entries(e).filter(([e, t]) => !!(t.label && t.label.includes("undefined") || !["hidden", "button"].some((e) => e === t.type) && t.value === void 0 || ["hidden", "button"].includes(t.type) && t.label === void 0));
|
|
10412
|
+
if (t.length) throw Error(`StreamElements custom fields have errors: ${t.map(([e, t]) => `${e} (${t.label ?? t.type})`).join(", ")}`);
|
|
10413
|
+
}
|
|
10414
|
+
transformCSSIntoFields(e, t = "name", r = (e) => e, i = () => null) {
|
|
10415
|
+
let a = new M(), o = new j(), s = new n(), c = Object.fromEntries(e);
|
|
10416
|
+
return e.reduce((e, [n, l]) => {
|
|
10417
|
+
let u = i(n, l) ?? "", d = r(String(n).replace("--", "").replaceAll("-", " ").replace("message ", "")).trim();
|
|
10418
|
+
switch (!e[u] && u.length && (e["/" + u] = {
|
|
10419
|
+
type: "hidden",
|
|
10420
|
+
label: a.capitalize(u)
|
|
10421
|
+
}), t) {
|
|
10422
|
+
case "name":
|
|
10423
|
+
if (["color"].some((e) => n.endsWith(e))) e[n] = {
|
|
10424
|
+
type: "colorpicker",
|
|
10425
|
+
label: a.capitalize(d),
|
|
10426
|
+
value: l
|
|
10427
|
+
};
|
|
10428
|
+
else if ([
|
|
10429
|
+
"size",
|
|
10430
|
+
"width",
|
|
10431
|
+
"height",
|
|
10432
|
+
"spacing",
|
|
10433
|
+
"gap",
|
|
10434
|
+
"radius"
|
|
10435
|
+
].some((e) => n.endsWith(e))) {
|
|
10436
|
+
var f = c[n + "-min"] ? parseFloat(c[n + "-min"]) : void 0, p = c[n + "-max"] ? parseFloat(c[n + "-max"]) : void 0, m = c[n + "-step"] ? parseFloat(c[n + "-step"]) : void 0;
|
|
10437
|
+
e[n] = {
|
|
10438
|
+
type: "number",
|
|
10439
|
+
label: a.capitalize(d),
|
|
10440
|
+
value: parseFloat(l),
|
|
10441
|
+
min: f,
|
|
10442
|
+
max: p,
|
|
10443
|
+
step: m
|
|
10444
|
+
};
|
|
10445
|
+
} else ["weight"].some((e) => n.endsWith(e)) ? e[n] = {
|
|
10446
|
+
type: "dropdown",
|
|
10447
|
+
label: a.capitalize(d),
|
|
10448
|
+
value: String(l),
|
|
10449
|
+
options: {
|
|
10450
|
+
100: "Thin 100",
|
|
10451
|
+
200: "Extra Light 200",
|
|
10452
|
+
300: "Light 300",
|
|
10453
|
+
400: "Normal 400",
|
|
10454
|
+
500: "Medium 500",
|
|
10455
|
+
600: "Semi Bold 600",
|
|
10456
|
+
700: "Bold 700",
|
|
10457
|
+
800: "Extra Bold 800",
|
|
10458
|
+
900: "Black 900"
|
|
10459
|
+
}
|
|
10460
|
+
} : n.endsWith("font-family") && (e[n] = {
|
|
10461
|
+
type: "googleFont",
|
|
10462
|
+
label: a.capitalize(d),
|
|
10463
|
+
value: l.split(",")[0].trim().replaceAll("'", "")
|
|
10464
|
+
});
|
|
10465
|
+
break;
|
|
10466
|
+
case "value":
|
|
10467
|
+
if (o.validate(l)) e[n] = {
|
|
10468
|
+
type: "colorpicker",
|
|
10469
|
+
label: a.capitalize(d) + " color",
|
|
10470
|
+
value: l
|
|
10471
|
+
};
|
|
10472
|
+
else if (l.startsWith("linear-gradient(") || l.startsWith("radial-gradient(")) {
|
|
10473
|
+
let t = l.match(ae);
|
|
10474
|
+
t && t.forEach((t, r) => {
|
|
10475
|
+
e[`${n}-gradient`] = {
|
|
10476
|
+
type: "hidden",
|
|
10477
|
+
label: "• Gradient colors"
|
|
10478
|
+
}, e[`${n}-gradient-${r}`] = {
|
|
10479
|
+
type: "colorpicker",
|
|
10480
|
+
label: a.capitalize(d) + ` ${s.translate(r + 1, "suffix")} color`,
|
|
10481
|
+
value: t
|
|
10482
|
+
};
|
|
10483
|
+
});
|
|
10484
|
+
} else if (l.endsWith("px")) {
|
|
10485
|
+
var f = c[n + "-min"] ? parseFloat(c[n + "-min"]) : void 0, p = c[n + "-max"] ? parseFloat(c[n + "-max"]) : void 0, m = c[n + "-step"] ? parseFloat(c[n + "-step"]) : void 0;
|
|
10486
|
+
e[n] = {
|
|
10487
|
+
type: "number",
|
|
10488
|
+
label: a.capitalize(d) + " (px)",
|
|
10489
|
+
value: parseFloat(l.replace("px", "")),
|
|
10490
|
+
min: f,
|
|
10491
|
+
max: p,
|
|
10492
|
+
step: m
|
|
10493
|
+
};
|
|
10494
|
+
} else if (l.endsWith("em")) {
|
|
10495
|
+
var f = c[n + "-min"] ? parseFloat(c[n + "-min"]) : void 0, p = c[n + "-max"] ? parseFloat(c[n + "-max"]) : void 0, m = c[n + "-step"] ? parseFloat(c[n + "-step"]) : void 0;
|
|
10496
|
+
e[n] = {
|
|
10497
|
+
type: "number",
|
|
10498
|
+
label: a.capitalize(d) + " (em)",
|
|
10499
|
+
value: parseFloat(l.replace("em", "")),
|
|
10500
|
+
min: f,
|
|
10501
|
+
max: p,
|
|
10502
|
+
step: m
|
|
10503
|
+
};
|
|
10504
|
+
} else if (isNaN(parseFloat(l))) e[n] = {
|
|
10505
|
+
type: "text",
|
|
10506
|
+
label: a.capitalize(d),
|
|
10507
|
+
value: l
|
|
10508
|
+
};
|
|
10509
|
+
else {
|
|
10510
|
+
var f = c[n + "-min"] ? parseFloat(c[n + "-min"]) : void 0, p = c[n + "-max"] ? parseFloat(c[n + "-max"]) : void 0, m = c[n + "-step"] ? parseFloat(c[n + "-step"]) : void 0;
|
|
10511
|
+
e[n] = {
|
|
10512
|
+
type: "number",
|
|
10513
|
+
label: a.capitalize(d),
|
|
10514
|
+
value: parseFloat(l),
|
|
10515
|
+
min: f,
|
|
10516
|
+
max: p,
|
|
10517
|
+
step: m
|
|
10518
|
+
};
|
|
10519
|
+
}
|
|
10520
|
+
break;
|
|
10521
|
+
}
|
|
10522
|
+
return e;
|
|
10523
|
+
}, {});
|
|
10524
|
+
}
|
|
10525
|
+
splitFieldLabel(e, t, n = 31) {
|
|
10526
|
+
let r = Math.max(1, Math.floor(n)), i = String(t).trim().match(/\[[^\]]+\]|\S+/g) ?? [], a = [], o = "", s = (e) => {
|
|
10527
|
+
if (!o.length) {
|
|
10528
|
+
o = e;
|
|
10529
|
+
return;
|
|
10530
|
+
}
|
|
10531
|
+
if (`${o} ${e}`.length <= r) {
|
|
10532
|
+
o += ` ${e}`;
|
|
10533
|
+
return;
|
|
10534
|
+
}
|
|
10535
|
+
a.push(o), o = e;
|
|
10536
|
+
};
|
|
10537
|
+
for (let e of i) {
|
|
10538
|
+
if (e.startsWith("[") && e.endsWith("]")) {
|
|
10539
|
+
let t = e.slice(1, -1).trim();
|
|
10540
|
+
if (!t.length) continue;
|
|
10541
|
+
o.length && (a.push(o), o = ""), a.push(t);
|
|
10542
|
+
continue;
|
|
10543
|
+
}
|
|
10544
|
+
let t = e;
|
|
10545
|
+
for (; t.length > r;) {
|
|
10546
|
+
let e = t.slice(0, r);
|
|
10547
|
+
o.length && (a.push(o), o = ""), a.push(e), t = t.slice(r);
|
|
10548
|
+
}
|
|
10549
|
+
t.length && s(t);
|
|
10550
|
+
}
|
|
10551
|
+
return o.length && a.push(o), a.length || a.push(""), Object.fromEntries(a.map((t, n) => [`${e}[${n}]`, {
|
|
10552
|
+
type: "hidden",
|
|
10553
|
+
label: t
|
|
10554
|
+
}]));
|
|
10555
|
+
}
|
|
10556
|
+
}, ae = /(#)(?:([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})?|([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])?)|(rgb|rgba)\((?:\s*(0*(?:0|1[0-9]{0,2}|2(?:[0-4][0-9]?|5[0-4]?|[6-9])?|[3-9][0-9]?)(?:\.[0-9]+)?|255(?:\.0+)?|\.[0-9]+)\s*,\s*(0*(?:0|1[0-9]{0,2}|2(?:[0-4][0-9]?|5[0-4]?|[6-9])?|[3-9][0-9]?)(?:\.[0-9]+)?|255(?:\.0+)?|\.[0-9]+)\s*,\s*(0*(?:0|1[0-9]{0,2}|2(?:[0-4][0-9]?|5[0-4]?|[6-9])?|[3-9][0-9]?)(?:\.[0-9]+)?|255(?:\.0+)?|\.[0-9]+)(?:\s*,\s*(0*(?:(?:0|[1-9][0-9]?)(?:\.[0-9]+)?|100(?:\.0+)?|\.[0-9]+)%|0*0*(?:\.[0-9]+)?|1(?:\.0+)?|\.[0-9]+))?\s*|\s*(0*(?:0|1[0-9]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(?:\/)\s*(0*(?:(?:0|[1-9][0-9]?)(?:\.[0-9]+)?|100(?:\.0+)?|\.[0-9]+)%|0*0*(?:\.[0-9]+)?|1(?:\.0+)?|\.[0-9]+))?\s*)?)\)|(yellowgreen|yellow|whitesmoke|white|wheat|VisitedText|violet|turquoise|transparent|tomato|thistle|teal|tan|steelblue|springgreen|snow|slategrey|slategray|slateblue|skyblue|silver|sienna|SelectedItemText|SelectedItem|seashell|seagreen|sandybrown|salmon|saddlebrown|royalblue|rosybrown|red|rebeccapurple|purple|powderblue|plum|pink|peru|peachpuff|papayawhip|palevioletred|paleturquoise|palegreen|palegoldenrod|orchid|orangered|orange|olivedrab|olive|oldlace|navy|navajowhite|moccasin|mistyrose|mintcream|midnightblue|mediumvioletred|mediumturquoise|mediumspringgreen|mediumslateblue|mediumseagreen|mediumpurple|mediumorchid|mediumblue|mediumaquamarine|maroon|MarkText|Mark|magenta|LinkText|linen|limegreen|lime|lightyellow|lightsteelblue|lightslategrey|lightslategray|lightskyblue|lightseagreen|lightsalmon|lightpink|lightgrey|lightgreen|lightgray|lightgoldenrodyellow|lightcyan|lightcoral|lightblue|lemonchiffon|lawngreen|lavenderblush|lavender|khaki|ivory|indigo|indianred|hotpink|honeydew|HighlightText|Highlight|grey|greenyellow|green|GrayText|gray|goldenrod|gold|ghostwhite|gainsboro|fuchsia|forestgreen|floralwhite|firebrick|FieldText|Field|dodgerblue|dimgrey|dimgray|deepskyblue|deeppink|darkviolet|darkturquoise|darkslategrey|darkslategray|darkslateblue|darkseagreen|darksalmon|darkred|darkorchid|darkorange|darkolivegreen|darkmagenta|darkkhaki|darkgrey|darkgreen|darkgray|darkgoldenrod|darkcyan|darkblue|cyan|currentColor|crimson|cornsilk|cornflowerblue|coral|chocolate|chartreuse|CanvasText|Canvas|cadetblue|ButtonText|ButtonFace|ButtonBorder|burlywood|brown|blueviolet|blue|blanchedalmond|black|bisque|beige|azure|aquamarine|aqua|antiquewhite|aliceblue|ActiveText|AccentColorText|AccentColor)/gi, B;
|
|
10365
10557
|
(function(e) {
|
|
10366
|
-
e.animate = new re(), e.number = new n(), e.element = new r(), e.object = new i(), e.message = new w(), e.event = new T(), e.string = new M(), e.sound = new
|
|
10558
|
+
e.animate = new re(), e.number = new n(), e.element = new r(), e.object = new i(), e.message = new w(), e.event = new T(), e.string = new M(), e.sound = new ee(), e.color = new j(), e.random = new C(), e.fn = new te(), e.utils = new z(), e.streamelements = new ie();
|
|
10367
10559
|
})(B ||= {});
|
|
10368
10560
|
//#endregion
|
|
10369
10561
|
//#region src/actions/button.ts
|
|
10370
|
-
var
|
|
10562
|
+
var oe = class e {
|
|
10371
10563
|
constructor(e) {
|
|
10372
|
-
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,
|
|
10564
|
+
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, L.push(this), N.length && N.forEach((e) => {
|
|
10373
10565
|
e.actions.buttons.push(this), e.emit("action", this, "created");
|
|
10374
10566
|
});
|
|
10375
10567
|
}
|
|
@@ -10396,25 +10588,25 @@ var ie = class e {
|
|
|
10396
10588
|
parse(e, t) {
|
|
10397
10589
|
var n = e.replace(typeof this.field == "string" ? this.field : this.template.replace(/\{[^}]*\}/g, "") ?? "", "").trim();
|
|
10398
10590
|
try {
|
|
10399
|
-
this.run.apply(
|
|
10591
|
+
this.run.apply(N[0] || void 0, [n.length ? n : e ?? e, t]);
|
|
10400
10592
|
} catch (e) {
|
|
10401
10593
|
throw Error(`Error running button "${this.field}": ${e instanceof Error ? e.message : e}`);
|
|
10402
10594
|
}
|
|
10403
10595
|
return this;
|
|
10404
10596
|
}
|
|
10405
10597
|
remove() {
|
|
10406
|
-
let e =
|
|
10407
|
-
if (e > -1 &&
|
|
10408
|
-
let t =
|
|
10409
|
-
t > -1 && (
|
|
10598
|
+
let e = L.indexOf(this);
|
|
10599
|
+
if (e > -1 && L.splice(e, 1), !N.length) return;
|
|
10600
|
+
let t = N[0]?.actions.buttons.indexOf(this);
|
|
10601
|
+
t > -1 && (N[0]?.actions.buttons.splice(t, 1), N[0]?.emit("action", this, "removed"));
|
|
10410
10602
|
}
|
|
10411
10603
|
static execute(t, n) {
|
|
10412
10604
|
try {
|
|
10413
|
-
if (
|
|
10414
|
-
let r =
|
|
10605
|
+
if (L.length) {
|
|
10606
|
+
let r = L.filter((e) => typeof e.field == "string" ? e.field === t : typeof e.field == "function" ? e.field(t, n) : !1);
|
|
10415
10607
|
if (r.length && r.every((t) => t instanceof e)) return r.forEach((e) => {
|
|
10416
10608
|
try {
|
|
10417
|
-
e.parse(t, n),
|
|
10609
|
+
e.parse(t, n), N.forEach((t) => {
|
|
10418
10610
|
t.emit("action", e, "executed");
|
|
10419
10611
|
}), Q.received(`Button executed: ${t}${n ? ` with value: ${n}` : ""}`);
|
|
10420
10612
|
} catch (e) {
|
|
@@ -10430,7 +10622,7 @@ var ie = class e {
|
|
|
10430
10622
|
}
|
|
10431
10623
|
}, V = class e {
|
|
10432
10624
|
constructor(e) {
|
|
10433
|
-
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,
|
|
10625
|
+
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, I.push(this), N.length && N.forEach((e) => {
|
|
10434
10626
|
e.actions.commands.push(this), e.emit("action", this, "created");
|
|
10435
10627
|
});
|
|
10436
10628
|
}
|
|
@@ -10464,24 +10656,24 @@ var ie = class e {
|
|
|
10464
10656
|
case "kick": return !1;
|
|
10465
10657
|
}
|
|
10466
10658
|
let o = this.verify(r, i, n);
|
|
10467
|
-
return o === !0 && this.run.apply(
|
|
10659
|
+
return o === !0 && this.run.apply(N[0] || void 0, [n, t]), o;
|
|
10468
10660
|
}
|
|
10469
10661
|
remove() {
|
|
10470
|
-
let e =
|
|
10471
|
-
if (e > -1 &&
|
|
10472
|
-
let t =
|
|
10473
|
-
t > -1 && (
|
|
10662
|
+
let e = I.indexOf(this);
|
|
10663
|
+
if (e > -1 && I.splice(e, 1), !N.length) return;
|
|
10664
|
+
let t = N[0]?.actions.commands.indexOf(this);
|
|
10665
|
+
t > -1 && (N[0]?.actions.commands.splice(t, 1), N[0]?.emit("action", this, "removed"));
|
|
10474
10666
|
}
|
|
10475
10667
|
static execute(t) {
|
|
10476
10668
|
let n = t.data;
|
|
10477
10669
|
try {
|
|
10478
|
-
if (
|
|
10479
|
-
let r =
|
|
10670
|
+
if (I.length && I.some((e) => n.event.data.text.startsWith(e.prefix))) {
|
|
10671
|
+
let r = I.filter((e) => {
|
|
10480
10672
|
var t = [e.name, ...e.aliases ?? []], r = n.event.data.text.replace(e.prefix, "").split(" ")[0];
|
|
10481
10673
|
return t.includes(r);
|
|
10482
10674
|
});
|
|
10483
10675
|
if (r.length && r.every((t) => t instanceof e)) return r.forEach((e) => {
|
|
10484
|
-
e.parse(n.event.data.text, t),
|
|
10676
|
+
e.parse(n.event.data.text, t), N.forEach((t) => {
|
|
10485
10677
|
t.emit("action", e, "executed");
|
|
10486
10678
|
}), Q.received(`Command executed: ${n.event.data.text} by ${n.event.data.nick || n.event.data.displayName}`, n);
|
|
10487
10679
|
}), !0;
|
|
@@ -10495,7 +10687,7 @@ var ie = class e {
|
|
|
10495
10687
|
};
|
|
10496
10688
|
window.addEventListener("onWidgetLoad", async (e) => {
|
|
10497
10689
|
let { detail: t } = e;
|
|
10498
|
-
|
|
10690
|
+
N.length && N.forEach(async (n) => {
|
|
10499
10691
|
if (n.fields = t.fieldData, n.session = t.session.data, n.details = {
|
|
10500
10692
|
...n.details,
|
|
10501
10693
|
user: t.channel,
|
|
@@ -10537,11 +10729,11 @@ window.addEventListener("onWidgetLoad", async (e) => {
|
|
|
10537
10729
|
});
|
|
10538
10730
|
}), window.addEventListener("onSessionUpdate", (e) => {
|
|
10539
10731
|
let { detail: t } = e;
|
|
10540
|
-
|
|
10732
|
+
N.length && N.forEach((e) => {
|
|
10541
10733
|
e.session = t.session, e.emit("session", t.session), e.debug && Q.debug("[Client]", "Session updated", t.session);
|
|
10542
10734
|
});
|
|
10543
10735
|
}), window.addEventListener("onEventReceived", ({ detail: e }) => {
|
|
10544
|
-
|
|
10736
|
+
N.length && N.forEach((t) => {
|
|
10545
10737
|
let n = B.event.parseProvider(e);
|
|
10546
10738
|
switch (n.provider) {
|
|
10547
10739
|
case "streamelements": {
|
|
@@ -10557,7 +10749,7 @@ window.addEventListener("onWidgetLoad", async (e) => {
|
|
|
10557
10749
|
switch (e.event.listener) {
|
|
10558
10750
|
case "widget-button": {
|
|
10559
10751
|
let t = e.event;
|
|
10560
|
-
|
|
10752
|
+
oe.execute(t.field, t.value);
|
|
10561
10753
|
break;
|
|
10562
10754
|
}
|
|
10563
10755
|
case "subscriber-latest":
|
|
@@ -10567,12 +10759,12 @@ window.addEventListener("onWidgetLoad", async (e) => {
|
|
|
10567
10759
|
break;
|
|
10568
10760
|
case "kvstore:update": {
|
|
10569
10761
|
let t = e.event;
|
|
10570
|
-
if (
|
|
10571
|
-
var r =
|
|
10762
|
+
if (P.length) {
|
|
10763
|
+
var r = P.find((e) => e.id === t.data.key.replace("customWidget.", "") || e.id === t.data.key);
|
|
10572
10764
|
r && r.update(t.data.value);
|
|
10573
10765
|
}
|
|
10574
|
-
if (
|
|
10575
|
-
let e =
|
|
10766
|
+
if (F.length) {
|
|
10767
|
+
let e = F.find((e) => e.id === t.data.key.replace("customWidget.", "") || e.id === t.data.key);
|
|
10576
10768
|
e && e.update(t.data.value);
|
|
10577
10769
|
}
|
|
10578
10770
|
break;
|
|
@@ -10686,7 +10878,7 @@ var H = class {
|
|
|
10686
10878
|
}
|
|
10687
10879
|
}, U = () => {
|
|
10688
10880
|
try {
|
|
10689
|
-
return
|
|
10881
|
+
return N;
|
|
10690
10882
|
} catch {
|
|
10691
10883
|
return [];
|
|
10692
10884
|
}
|
|
@@ -10766,7 +10958,7 @@ var H = class {
|
|
|
10766
10958
|
};
|
|
10767
10959
|
//#endregion
|
|
10768
10960
|
//#region src/local/generator.ts
|
|
10769
|
-
async function
|
|
10961
|
+
async function se(e, t, n = "USD") {
|
|
10770
10962
|
let r = {
|
|
10771
10963
|
BRL: {
|
|
10772
10964
|
code: "BRL",
|
|
@@ -10810,7 +11002,7 @@ async function ae(e, t, n = "USD") {
|
|
|
10810
11002
|
emulated: !0
|
|
10811
11003
|
};
|
|
10812
11004
|
}
|
|
10813
|
-
async function
|
|
11005
|
+
async function ce(e, t) {
|
|
10814
11006
|
if (e ??= await K.session.get(), t) {
|
|
10815
11007
|
let n = (e, t) => new Date(t.createdAt).getTime() - new Date(e.createdAt).getTime();
|
|
10816
11008
|
switch (t.provider) {
|
|
@@ -11010,7 +11202,7 @@ async function G(e = "random", t = "random", n = {}) {
|
|
|
11010
11202
|
return G(e, a);
|
|
11011
11203
|
case "message": {
|
|
11012
11204
|
let t = n;
|
|
11013
|
-
var o = t?.name ?? new C().array(S.names.filter((e) => e.length))[0], s = t?.message ?? new C().array([...S.twitch_messages, ...S.normal_messages].filter((e) => e.length))[0], c = await new w().generateBadges(t?.badges ?? [], e), l = new w().findEmotesInText(s), u = new w().replaceEmotesWithHTML(s, l), d = t?.color ?? new C().color("hex"), f = t?.userId ?? new C().string(16), p = t?.msgId ?? new C().string(16), m = t?.time ?? Date.now(), h = t?.channel ??
|
|
11205
|
+
var o = t?.name ?? new C().array(S.names.filter((e) => e.length))[0], s = t?.message ?? new C().array([...S.twitch_messages, ...S.normal_messages].filter((e) => e.length))[0], c = await new w().generateBadges(t?.badges ?? [], e), l = new w().findEmotesInText(s), u = new w().replaceEmotesWithHTML(s, l), d = t?.color ?? new C().color("hex"), f = t?.userId ?? new C().string(16), p = t?.msgId ?? new C().string(16), m = t?.time ?? Date.now(), h = t?.channel ?? N?.[0]?.details?.user?.username ?? "local", g = t?.reply ? {
|
|
11014
11206
|
"reply-parent-display-name": t.reply.name,
|
|
11015
11207
|
"reply-parent-msg-body": t.reply.text,
|
|
11016
11208
|
"reply-parent-msg-id": t.reply.msgId,
|
|
@@ -11196,7 +11388,7 @@ async function G(e = "random", t = "random", n = {}) {
|
|
|
11196
11388
|
"Highlight Message",
|
|
11197
11389
|
"Send a Shoutout",
|
|
11198
11390
|
"Drink Water"
|
|
11199
|
-
])[0], A = n?.quantity ?? 1, j = n?.providerId ?? new C().uuid(), M = n?.id ?? new C().uuid(), h = n?.channel ?? n?.broadcaster ?? n?.streamer ??
|
|
11391
|
+
])[0], A = n?.quantity ?? 1, j = n?.providerId ?? new C().uuid(), M = n?.id ?? new C().uuid(), h = n?.channel ?? n?.broadcaster ?? n?.streamer ?? N?.[0]?.details?.user?.username ?? "local", ee = n?.activityId ?? new C().uuid(), m = n?.time ?? Date.now();
|
|
11200
11392
|
return {
|
|
11201
11393
|
listener: "event",
|
|
11202
11394
|
event: {
|
|
@@ -11208,7 +11400,7 @@ async function G(e = "random", t = "random", n = {}) {
|
|
|
11208
11400
|
createdAt: new Date(m).toISOString(),
|
|
11209
11401
|
expiresAt: new Date(m + 36e5).toISOString(),
|
|
11210
11402
|
updatedAt: new Date(m).toISOString(),
|
|
11211
|
-
activityId:
|
|
11403
|
+
activityId: ee,
|
|
11212
11404
|
sessionEventsCount: 1,
|
|
11213
11405
|
isMock: !0,
|
|
11214
11406
|
data: {
|
|
@@ -11278,7 +11470,7 @@ async function G(e = "random", t = "random", n = {}) {
|
|
|
11278
11470
|
case "alertService:toggleSound": return {
|
|
11279
11471
|
listener: "alertService:toggleSound",
|
|
11280
11472
|
event: {
|
|
11281
|
-
muted: n?.muted ??
|
|
11473
|
+
muted: n?.muted ?? N?.[0]?.details?.overlay?.muted ?? !1,
|
|
11282
11474
|
provider: e
|
|
11283
11475
|
},
|
|
11284
11476
|
emulated: !0
|
|
@@ -11298,7 +11490,7 @@ async function G(e = "random", t = "random", n = {}) {
|
|
|
11298
11490
|
case "message": {
|
|
11299
11491
|
var o = n?.name ?? new C().array(S.names.filter((e) => e.length))[0], s = n?.message ?? new C().array([...S.youtube_messages, ...S.normal_messages].filter((e) => e.length))[0];
|
|
11300
11492
|
let t = await new w().generateBadges(n?.badges ?? [], e);
|
|
11301
|
-
var l = new w().findEmotesInText(s), u = new w().replaceEmotesWithHTML(s, l), d = n?.color ?? new C().color("hex"), f = n?.userId ?? new C().number(1e7, 99999999).toString(), p = n?.msgId ?? new C().uuid(), m = n?.time ?? Date.now(), b = n?.avatar ?? new C().array(S.avatars)[0], h = n?.channel ??
|
|
11493
|
+
var l = new w().findEmotesInText(s), u = new w().replaceEmotesWithHTML(s, l), d = n?.color ?? new C().color("hex"), f = n?.userId ?? new C().number(1e7, 99999999).toString(), p = n?.msgId ?? new C().uuid(), m = n?.time ?? Date.now(), b = n?.avatar ?? new C().array(S.avatars)[0], h = n?.channel ?? N?.[0]?.details?.user?.username ?? "local";
|
|
11302
11494
|
return {
|
|
11303
11495
|
listener: "message",
|
|
11304
11496
|
event: {
|
|
@@ -11433,8 +11625,8 @@ async function G(e = "random", t = "random", n = {}) {
|
|
|
11433
11625
|
var K = new class {
|
|
11434
11626
|
constructor() {
|
|
11435
11627
|
this.event = {
|
|
11436
|
-
onWidgetLoad:
|
|
11437
|
-
onSessionUpdate:
|
|
11628
|
+
onWidgetLoad: se,
|
|
11629
|
+
onSessionUpdate: ce,
|
|
11438
11630
|
onEventReceived: G
|
|
11439
11631
|
}, this.session = {
|
|
11440
11632
|
types: {
|
|
@@ -12364,7 +12556,7 @@ var K = new class {
|
|
|
12364
12556
|
duration: "client",
|
|
12365
12557
|
processor: async function(e) {
|
|
12366
12558
|
if (window.dispatchEvent(new CustomEvent(e.listener, { detail: e.data })), e.listener === "onEventReceived" && e.session) {
|
|
12367
|
-
let t = await K.event.onSessionUpdate(
|
|
12559
|
+
let t = await K.event.onSessionUpdate(N?.[0] ? N[0].session : void 0, B.event.parseProvider(e.data));
|
|
12368
12560
|
window.dispatchEvent(new CustomEvent("onSessionUpdate", { detail: t }));
|
|
12369
12561
|
}
|
|
12370
12562
|
}
|
|
@@ -12423,7 +12615,7 @@ var K = new class {
|
|
|
12423
12615
|
return this.history.push({
|
|
12424
12616
|
detail: n,
|
|
12425
12617
|
timestamp: r.timeStamp,
|
|
12426
|
-
origin:
|
|
12618
|
+
origin: N?.[0]?.id
|
|
12427
12619
|
}), localStorage.setItem("SE_API-EVENTS", JSON.stringify(this.history)), window.dispatchEvent(r) ? { ok: !0 } : { ok: !1 };
|
|
12428
12620
|
},
|
|
12429
12621
|
broadcast(e, t) {
|
|
@@ -12435,13 +12627,13 @@ var K = new class {
|
|
|
12435
12627
|
return this.history.push({
|
|
12436
12628
|
detail: n,
|
|
12437
12629
|
timestamp: Date.now(),
|
|
12438
|
-
origin:
|
|
12630
|
+
origin: N?.[0]?.id
|
|
12439
12631
|
}), localStorage.setItem("SE_API-EVENTS", JSON.stringify(this.history)), window.dispatchEvent(r) ? { ok: !0 } : { ok: !1 };
|
|
12440
12632
|
},
|
|
12441
12633
|
history: []
|
|
12442
12634
|
}
|
|
12443
|
-
}, Y = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(
|
|
12444
|
-
async function
|
|
12635
|
+
}, Y = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(le());
|
|
12636
|
+
async function le() {
|
|
12445
12637
|
let e = localStorage.getItem("SE_API-STORE") ?? "{}", t = e ? JSON.parse(e) : {};
|
|
12446
12638
|
J.store.list = t;
|
|
12447
12639
|
let n = localStorage.getItem("SE_API-EVENTS") ?? "[]", r = n ? JSON.parse(n) : [];
|
|
@@ -12449,9 +12641,9 @@ async function se() {
|
|
|
12449
12641
|
}
|
|
12450
12642
|
//#endregion
|
|
12451
12643
|
//#region src/modules/useStorage.ts
|
|
12452
|
-
var
|
|
12644
|
+
var ue = class extends H {
|
|
12453
12645
|
constructor(e) {
|
|
12454
|
-
super(), this.SE_API = null, this.id = "default", this.loaded = !1, this.id = e.id || this.id, this.data = e.data || {}, this.initial = structuredClone(this.data),
|
|
12646
|
+
super(), this.SE_API = null, this.id = "default", this.loaded = !1, this.id = e.id || this.id, this.data = e.data || {}, this.initial = structuredClone(this.data), P.push(this), Y?.then((e) => {
|
|
12455
12647
|
this.SE_API = e, e.store.get(this.id).then((e) => {
|
|
12456
12648
|
this.data = e || this.data, this.loaded = !0, this.emit("load", this.data), JSON.stringify(this.data) !== JSON.stringify(e) && this.emit("update", this.data, "internal");
|
|
12457
12649
|
}).catch(() => {
|
|
@@ -12484,7 +12676,7 @@ var ce = class extends H {
|
|
|
12484
12676
|
on(e, t) {
|
|
12485
12677
|
return e === "load" && this.loaded ? (t.apply(this, [this.data]), this) : (super.on(e, t), this);
|
|
12486
12678
|
}
|
|
12487
|
-
},
|
|
12679
|
+
}, de = class extends H {
|
|
12488
12680
|
constructor(e) {
|
|
12489
12681
|
super(), this.id = "default", this.debug = !1, this.fields = {}, this.loaded = !1, this.actions = {
|
|
12490
12682
|
commands: [],
|
|
@@ -12493,7 +12685,7 @@ var ce = class extends H {
|
|
|
12493
12685
|
avatar: 30,
|
|
12494
12686
|
pronoun: 60,
|
|
12495
12687
|
emote: 120
|
|
12496
|
-
}, this.id = e.id || this.id, this.storage = new
|
|
12688
|
+
}, this.id = e.id || this.id, this.storage = new ue({
|
|
12497
12689
|
id: this.id,
|
|
12498
12690
|
data: {
|
|
12499
12691
|
user: {},
|
|
@@ -12503,7 +12695,7 @@ var ce = class extends H {
|
|
|
12503
12695
|
}
|
|
12504
12696
|
}), this.on("load", () => {
|
|
12505
12697
|
this.debug = !!(typeof e.debug == "function" ? e.debug() : e.debug);
|
|
12506
|
-
}),
|
|
12698
|
+
}), N.push(this);
|
|
12507
12699
|
}
|
|
12508
12700
|
on(e, t) {
|
|
12509
12701
|
return e === "load" && this.loaded ? (t.apply(this, [{
|
|
@@ -12660,11 +12852,11 @@ var ce = class extends H {
|
|
|
12660
12852
|
})(Z ||= {});
|
|
12661
12853
|
//#endregion
|
|
12662
12854
|
//#region src/modules/fakeUser.ts
|
|
12663
|
-
var
|
|
12855
|
+
var fe = class {
|
|
12664
12856
|
constructor(e, t, n = [], r = !1, i) {
|
|
12665
12857
|
this.badges = [], this.isSubscriber = !1, this.id = e, this.name = t, this.login = t.toLocaleLowerCase(), this.badges = n, this.isSubscriber = r, this.tier = i;
|
|
12666
12858
|
}
|
|
12667
|
-
},
|
|
12859
|
+
}, pe = {
|
|
12668
12860
|
broadcaster: [
|
|
12669
12861
|
"moderator",
|
|
12670
12862
|
"vip",
|
|
@@ -12681,12 +12873,12 @@ var ue = class {
|
|
|
12681
12873
|
"duelyst_6",
|
|
12682
12874
|
"duelyst_7"
|
|
12683
12875
|
]
|
|
12684
|
-
},
|
|
12876
|
+
}, me = class e extends H {
|
|
12685
12877
|
static fixUser(t) {
|
|
12686
12878
|
return typeof t == "string" ? t.trim().replace(/^@+/, "").toLocaleLowerCase() : e.fixUser(t.name);
|
|
12687
12879
|
}
|
|
12688
12880
|
static getRandomSubTier() {
|
|
12689
|
-
return new
|
|
12881
|
+
return new z().probability({
|
|
12690
12882
|
prime: .4,
|
|
12691
12883
|
1e3: .3,
|
|
12692
12884
|
2e3: .2,
|
|
@@ -12700,7 +12892,7 @@ var ue = class {
|
|
|
12700
12892
|
e.set(n, [...r, t]);
|
|
12701
12893
|
}
|
|
12702
12894
|
return e;
|
|
12703
|
-
}, /* @__PURE__ */ new Map())),
|
|
12895
|
+
}, /* @__PURE__ */ new Map())), R.push(this);
|
|
12704
12896
|
}
|
|
12705
12897
|
start(t, n = S.badges.map((e) => e.set_id), r) {
|
|
12706
12898
|
let i = t.map((t) => t && e.fixUser(t)).filter((e) => e && e.length).filter((e, t, n) => n.indexOf(e) === t), a = n.filter((e, t, n) => n.indexOf(e) === t);
|
|
@@ -12746,7 +12938,7 @@ var ue = class {
|
|
|
12746
12938
|
}
|
|
12747
12939
|
return null;
|
|
12748
12940
|
};
|
|
12749
|
-
for (let [e, t] of C(
|
|
12941
|
+
for (let [e, t] of C(pe, r?.incompatible)) if (d.has(e)) for (let n of x(t)) d.has(n) && w(e, n);
|
|
12750
12942
|
for (let e of a) {
|
|
12751
12943
|
let t = b(u[e]);
|
|
12752
12944
|
for (let n of t) {
|
|
@@ -12792,7 +12984,7 @@ var ue = class {
|
|
|
12792
12984
|
continue;
|
|
12793
12985
|
}
|
|
12794
12986
|
n.length < c && this.emit("warn", /* @__PURE__ */ Error(`User "${t}" could only receive ${n.length} badge(s), below the configured minimum of ${c}`));
|
|
12795
|
-
let i = o.length + 1, a = n.some((e) => ["subscriber"].includes(String(e).toLocaleLowerCase())), s = new
|
|
12987
|
+
let i = o.length + 1, a = n.some((e) => ["subscriber"].includes(String(e).toLocaleLowerCase())), s = new fe(`fake_user_${i.toString().padStart(2, "0")}_${Math.random().toString(36).slice(2, 8)}+${this.id}`, t, n, a, a ? e.getRandomSubTier() : void 0);
|
|
12796
12988
|
o.push(s);
|
|
12797
12989
|
}
|
|
12798
12990
|
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;
|
|
@@ -12847,9 +13039,9 @@ var ue = class {
|
|
|
12847
13039
|
message: new C().array(e)[0]
|
|
12848
13040
|
};
|
|
12849
13041
|
}
|
|
12850
|
-
},
|
|
13042
|
+
}, he = class extends H {
|
|
12851
13043
|
constructor(e = {}) {
|
|
12852
|
-
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,
|
|
13044
|
+
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, F.push(this), Y?.then(async (e) => {
|
|
12853
13045
|
this.loaded = !0, this.SE_API = e, Promise.all([async () => {
|
|
12854
13046
|
let t = await e.store.get(this.id);
|
|
12855
13047
|
t && (this.history = t.slice(-10));
|
|
@@ -12878,7 +13070,7 @@ var ue = class {
|
|
|
12878
13070
|
on(e, t) {
|
|
12879
13071
|
return e === "load" && this.loaded ? (t.apply(this), this) : (super.on(e, t), this);
|
|
12880
13072
|
}
|
|
12881
|
-
},
|
|
13073
|
+
}, ge = class {
|
|
12882
13074
|
constructor(e = {}) {
|
|
12883
13075
|
this.error = this.apply({
|
|
12884
13076
|
color: "#721c24",
|
|
@@ -12976,7 +13168,7 @@ var ue = class {
|
|
|
12976
13168
|
timeEnd(e) {
|
|
12977
13169
|
!this.enabled || !console.timeEnd || console.timeEnd(e);
|
|
12978
13170
|
}
|
|
12979
|
-
},
|
|
13171
|
+
}, _e = class extends H {
|
|
12980
13172
|
constructor(e, t) {
|
|
12981
13173
|
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) => {
|
|
12982
13174
|
this.instance = e, this.emit("load", e), this.connect();
|
|
@@ -12986,16 +13178,16 @@ var ue = class {
|
|
|
12986
13178
|
}
|
|
12987
13179
|
load() {
|
|
12988
13180
|
return window.ComfyJS === void 0 || !window.ComfyJS ? new Promise((e, t) => {
|
|
12989
|
-
if (this.emulate && !
|
|
13181
|
+
if (this.emulate && !N.length) return t(/* @__PURE__ */ Error("useComfyJs: Cannot emulate chat messages without a Client instance."));
|
|
12990
13182
|
let n = document.createElement("script");
|
|
12991
13183
|
n.src = "https://cdn.jsdelivr.net/npm/comfy.js@1.1.29/dist/comfy.min.js", n.type = "text/javascript", n.async = !0, n.onload = () => e(window.ComfyJS), n.onerror = (e) => t(e), document.head.appendChild(n);
|
|
12992
13184
|
}) : Promise.resolve(window.ComfyJS);
|
|
12993
13185
|
}
|
|
12994
13186
|
connect() {
|
|
12995
13187
|
this.instance.onError = (e) => {
|
|
12996
|
-
this.emit("error", e),
|
|
13188
|
+
this.emit("error", e), N.some((e) => e.debug) && Q.error("[Client]", "ComfyJS Error:", e);
|
|
12997
13189
|
}, this.instance.onCommand = (e, t, n, r, i) => {
|
|
12998
|
-
if (this.emit("command", e, t, n, r, i),
|
|
13190
|
+
if (this.emit("command", e, t, n, r, i), N.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Command: !${t} ${n} (User: ${e})`), this.emulate) {
|
|
12999
13191
|
let a = {
|
|
13000
13192
|
...r,
|
|
13001
13193
|
broadcaster: r.broadcaster,
|
|
@@ -13016,7 +13208,7 @@ var ue = class {
|
|
|
13016
13208
|
Z.emulate.twitch.message(o);
|
|
13017
13209
|
}
|
|
13018
13210
|
}, this.instance.onChat = (e, t, n, r, i) => {
|
|
13019
|
-
if (this.emit("chat", e, t, n, r, i),
|
|
13211
|
+
if (this.emit("chat", e, t, n, r, i), N.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Chat: ${t} (User: ${e})`), this.emulate) {
|
|
13020
13212
|
let r = {
|
|
13021
13213
|
...n,
|
|
13022
13214
|
...i.userBadges,
|
|
@@ -13038,22 +13230,22 @@ var ue = class {
|
|
|
13038
13230
|
});
|
|
13039
13231
|
}
|
|
13040
13232
|
}, this.instance.onWhisper = (e, t, n, r, i) => {
|
|
13041
|
-
this.emit("whisper", e, t, n, r, i),
|
|
13233
|
+
this.emit("whisper", e, t, n, r, i), N.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Whisper: ${t} (User: ${e})`);
|
|
13042
13234
|
}, this.instance.onMessageDeleted = (e, t) => {
|
|
13043
|
-
this.emit("messageDeleted", e, t),
|
|
13235
|
+
this.emit("messageDeleted", e, t), N.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Message Deleted: ${e}`), this.emulate && Z.emulate.twitch.deleteMessage(e);
|
|
13044
13236
|
}, this.instance.onJoin = (e, t, n) => {
|
|
13045
|
-
this.emit("join", e, t, n),
|
|
13237
|
+
this.emit("join", e, t, n), N.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Join: ${e}`);
|
|
13046
13238
|
}, this.instance.onPart = (e, t, n) => {
|
|
13047
|
-
this.emit("part", e, t, n),
|
|
13239
|
+
this.emit("part", e, t, n), N.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Part: ${e}`);
|
|
13048
13240
|
}, this.instance.onHosted = (e, t, n, r) => {
|
|
13049
|
-
this.emit("hosted", e, t, n, r),
|
|
13241
|
+
this.emit("hosted", e, t, n, r), N.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Hosted: ${e} (${t} viewers)`);
|
|
13050
13242
|
}, this.instance.onRaid = (e, t, n) => {
|
|
13051
|
-
this.emit("raid", e, t, n),
|
|
13243
|
+
this.emit("raid", e, t, n), N.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Raid: ${e} (${t} viewers)`), this.emulate && Z.emulate.twitch.raid({
|
|
13052
13244
|
name: e,
|
|
13053
13245
|
amount: t
|
|
13054
13246
|
});
|
|
13055
13247
|
}, this.instance.onSub = (e, t, n, r) => {
|
|
13056
|
-
if (this.emit("sub", e, t, n, r),
|
|
13248
|
+
if (this.emit("sub", e, t, n, r), N.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Sub: ${e} (${n.plan})`), this.emulate) {
|
|
13057
13249
|
let r = n.plan === "Prime" ? "prime" : n.plan;
|
|
13058
13250
|
Z.emulate.twitch.subscriber({
|
|
13059
13251
|
name: e,
|
|
@@ -13063,7 +13255,7 @@ var ue = class {
|
|
|
13063
13255
|
});
|
|
13064
13256
|
}
|
|
13065
13257
|
}, this.instance.onResub = (e, t, n, r, i, a) => {
|
|
13066
|
-
if (this.emit("resub", e, t, n, r, i, a),
|
|
13258
|
+
if (this.emit("resub", e, t, n, r, i, a), N.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Resub: ${e} (${r} months)`), this.emulate) {
|
|
13067
13259
|
let n = i.plan === "Prime" ? "prime" : i.plan;
|
|
13068
13260
|
Z.emulate.twitch.subscriber({
|
|
13069
13261
|
name: e,
|
|
@@ -13074,7 +13266,7 @@ var ue = class {
|
|
|
13074
13266
|
});
|
|
13075
13267
|
}
|
|
13076
13268
|
}, this.instance.onSubGift = (e, t, n, r, i, a) => {
|
|
13077
|
-
if (this.emit("subGift", e, t, n, r, i, a),
|
|
13269
|
+
if (this.emit("subGift", e, t, n, r, i, a), N.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Sub Gift: ${e} gifted ${r} subs`), this.emulate) {
|
|
13078
13270
|
let t = i.plan === "Prime" ? "prime" : i.plan;
|
|
13079
13271
|
Z.emulate.twitch.subscriber({
|
|
13080
13272
|
name: n,
|
|
@@ -13086,7 +13278,7 @@ var ue = class {
|
|
|
13086
13278
|
});
|
|
13087
13279
|
}
|
|
13088
13280
|
}, this.instance.onSubMysteryGift = (e, t, n, r, i) => {
|
|
13089
|
-
if (this.emit("subMysteryGift", e, t, n, r, i),
|
|
13281
|
+
if (this.emit("subMysteryGift", e, t, n, r, i), N.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Sub Mystery Gift: ${e} gifted ${t} subs`), this.emulate) {
|
|
13090
13282
|
let n = r.plan === "Prime" ? "prime" : r.plan;
|
|
13091
13283
|
Z.emulate.twitch.subscriber({
|
|
13092
13284
|
name: e,
|
|
@@ -13097,7 +13289,7 @@ var ue = class {
|
|
|
13097
13289
|
});
|
|
13098
13290
|
}
|
|
13099
13291
|
}, this.instance.onGiftSubContinue = (e, t, n) => {
|
|
13100
|
-
this.emit("giftSubContinue", e, t, n),
|
|
13292
|
+
this.emit("giftSubContinue", e, t, n), N.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Gift Sub Continue: ${e} continued their gifted sub from ${t}`), this.emulate && Z.emulate.twitch.subscriber({
|
|
13101
13293
|
name: e,
|
|
13102
13294
|
message: "",
|
|
13103
13295
|
sender: t,
|
|
@@ -13105,22 +13297,22 @@ var ue = class {
|
|
|
13105
13297
|
subType: "gift"
|
|
13106
13298
|
});
|
|
13107
13299
|
}, this.instance.onCheer = (e, t, n, r, i) => {
|
|
13108
|
-
this.emit("cheer", e, t, n, r, i),
|
|
13300
|
+
this.emit("cheer", e, t, n, r, i), N.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Cheer: ${e} cheered ${n} bits - ${t}`), this.emulate && Z.emulate.twitch.cheer({
|
|
13109
13301
|
name: e,
|
|
13110
13302
|
message: t,
|
|
13111
13303
|
amount: n
|
|
13112
13304
|
});
|
|
13113
13305
|
}, this.instance.onChatMode = (e, t) => {
|
|
13114
|
-
this.emit("chatMode", e, t),
|
|
13306
|
+
this.emit("chatMode", e, t), N.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Chat Mode Changed on ${t}`);
|
|
13115
13307
|
}, this.instance.onReward = (e, t, n, r, i) => {
|
|
13116
|
-
this.emit("reward", e, t, n, r, i),
|
|
13308
|
+
this.emit("reward", e, t, n, r, i), N.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Reward: ${e} redeemed ${t} for ${n} - ${r}`);
|
|
13117
13309
|
}, this.instance.onConnected = (e, t, n) => {
|
|
13118
|
-
this.emit("connected", e, t, n),
|
|
13310
|
+
this.emit("connected", e, t, n), N.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Connected: ${e}:${t} (First Connect: ${n})`);
|
|
13119
13311
|
}, this.instance.onReconnect = (e) => {
|
|
13120
|
-
this.emit("reconnect", e),
|
|
13312
|
+
this.emit("reconnect", e), N.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Reconnect: Attempt #${e}`);
|
|
13121
13313
|
}, this.init && this.instance.Init(this.username, this.password, this.channels, this.isDebug);
|
|
13122
13314
|
}
|
|
13123
|
-
},
|
|
13315
|
+
}, ve;
|
|
13124
13316
|
(function(e) {
|
|
13125
13317
|
let t;
|
|
13126
13318
|
(function(e) {
|
|
@@ -13144,7 +13336,7 @@ var ue = class {
|
|
|
13144
13336
|
e.list = n;
|
|
13145
13337
|
async function r(e) {
|
|
13146
13338
|
if (!e) throw Error("Username is required to fetch Alejo data.");
|
|
13147
|
-
if (e = e.toLowerCase(), !
|
|
13339
|
+
if (e = e.toLowerCase(), !N.length) {
|
|
13148
13340
|
try {
|
|
13149
13341
|
let t = await fetch(`https://pronouns.alejo.io/api/users/${e}`).then((e) => e.json()).then(([e]) => e);
|
|
13150
13342
|
if (t) return t.pronoun_id;
|
|
@@ -13153,7 +13345,7 @@ var ue = class {
|
|
|
13153
13345
|
}
|
|
13154
13346
|
return;
|
|
13155
13347
|
}
|
|
13156
|
-
let t =
|
|
13348
|
+
let t = N?.[0];
|
|
13157
13349
|
if (e in t.storage.data.pronoun && t.storage.data.pronoun[e].expire > Date.now()) return t.storage.data.pronoun[e].value;
|
|
13158
13350
|
try {
|
|
13159
13351
|
let n = await fetch(`https://pronouns.alejo.io/api/users/${e}`).then((e) => e.json()).then(([e]) => e);
|
|
@@ -13167,37 +13359,37 @@ var ue = class {
|
|
|
13167
13359
|
}
|
|
13168
13360
|
}
|
|
13169
13361
|
e.get = r;
|
|
13170
|
-
})(
|
|
13362
|
+
})(ve ||= {});
|
|
13171
13363
|
//#endregion
|
|
13172
13364
|
//#region src/main.ts
|
|
13173
|
-
var Q = new
|
|
13365
|
+
var Q = new ge(), $ = {
|
|
13174
13366
|
SeAPI: Y,
|
|
13175
|
-
Client:
|
|
13367
|
+
Client: de,
|
|
13176
13368
|
Helper: B,
|
|
13177
13369
|
Local: Z,
|
|
13178
13370
|
Data: S,
|
|
13179
13371
|
logger: Q,
|
|
13180
13372
|
modules: {
|
|
13181
13373
|
EventProvider: H,
|
|
13182
|
-
useStorage:
|
|
13374
|
+
useStorage: ue,
|
|
13183
13375
|
useQueue: W,
|
|
13184
|
-
useLogger:
|
|
13185
|
-
useComms:
|
|
13186
|
-
FakeUserPool:
|
|
13376
|
+
useLogger: ge,
|
|
13377
|
+
useComms: he,
|
|
13378
|
+
FakeUserPool: me
|
|
13187
13379
|
},
|
|
13188
13380
|
actions: {
|
|
13189
|
-
Button:
|
|
13381
|
+
Button: oe,
|
|
13190
13382
|
Command: V
|
|
13191
13383
|
},
|
|
13192
|
-
multistream: { useComfyJs:
|
|
13193
|
-
internal:
|
|
13194
|
-
pronouns: { Alejo:
|
|
13384
|
+
multistream: { useComfyJs: _e },
|
|
13385
|
+
internal: ne,
|
|
13386
|
+
pronouns: { Alejo: ve }
|
|
13195
13387
|
};
|
|
13196
13388
|
typeof window < "u" ? window.Tixyel = $ : globalThis.Tixyel = $;
|
|
13197
13389
|
//#endregion
|
|
13198
13390
|
//#region src/index.ts
|
|
13199
|
-
var
|
|
13391
|
+
var ye = $;
|
|
13200
13392
|
//#endregion
|
|
13201
|
-
export {
|
|
13393
|
+
export { ye as default };
|
|
13202
13394
|
|
|
13203
13395
|
//# sourceMappingURL=index.es.js.map
|