@tixyel/streamelements 7.6.8 → 7.7.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 +137 -1
- package/dist/index.es.js +289 -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,33 @@ 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
|
+
}
|
|
230
257
|
}, i = class {
|
|
231
258
|
flatten(e, t = !0, n = "") {
|
|
232
259
|
let r = {};
|
|
@@ -10036,7 +10063,7 @@ var j = class {
|
|
|
10036
10063
|
let M = e.replace(f.PLACEHOLDERS, (e, t) => typeof d[t] == "string" || typeof d[t] == "number" ? String(d[t]) : t ?? t);
|
|
10037
10064
|
return M = n.method === "loop" ? k(M) : A(M), M;
|
|
10038
10065
|
}
|
|
10039
|
-
},
|
|
10066
|
+
}, ee = class {
|
|
10040
10067
|
constructor() {
|
|
10041
10068
|
this.playing = !1;
|
|
10042
10069
|
}
|
|
@@ -10055,21 +10082,21 @@ var j = class {
|
|
|
10055
10082
|
throw Error(`Error playing sound: ${e}`);
|
|
10056
10083
|
}
|
|
10057
10084
|
}
|
|
10058
|
-
},
|
|
10085
|
+
}, te = class {
|
|
10059
10086
|
apply(e, t, n) {
|
|
10060
10087
|
return e.apply(t, n);
|
|
10061
10088
|
}
|
|
10062
10089
|
call(e, t, ...n) {
|
|
10063
10090
|
return e.call(t, ...n);
|
|
10064
10091
|
}
|
|
10065
|
-
},
|
|
10066
|
-
fakeUserPools: () =>
|
|
10067
|
-
usedButtons: () =>
|
|
10068
|
-
usedClients: () =>
|
|
10069
|
-
usedCommands: () =>
|
|
10070
|
-
usedComms: () =>
|
|
10071
|
-
usedStorages: () =>
|
|
10072
|
-
}),
|
|
10092
|
+
}, ne = /* @__PURE__ */ t({
|
|
10093
|
+
fakeUserPools: () => R,
|
|
10094
|
+
usedButtons: () => L,
|
|
10095
|
+
usedClients: () => N,
|
|
10096
|
+
usedCommands: () => I,
|
|
10097
|
+
usedComms: () => F,
|
|
10098
|
+
usedStorages: () => P
|
|
10099
|
+
}), N = [], P = [], F = [], I = [], L = [], R = [], z = class e {
|
|
10073
10100
|
delay(e, t) {
|
|
10074
10101
|
return new Promise((n) => setTimeout(() => {
|
|
10075
10102
|
n(t ? t() ?? null : null);
|
|
@@ -10123,7 +10150,7 @@ var j = class {
|
|
|
10123
10150
|
async findSubscriptionTier({ userId: e, name: t, broadcasterId: n }, r, i = !1) {
|
|
10124
10151
|
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
10152
|
if (e?.includes("fake_user_")) {
|
|
10126
|
-
let t =
|
|
10153
|
+
let t = R.find((t) => e.endsWith(`+${t.id}`));
|
|
10127
10154
|
if (t) {
|
|
10128
10155
|
let n = t.getById(e);
|
|
10129
10156
|
if (n) return a(n.tier);
|
|
@@ -10361,15 +10388,170 @@ var j = class {
|
|
|
10361
10388
|
y: r
|
|
10362
10389
|
};
|
|
10363
10390
|
}
|
|
10364
|
-
},
|
|
10391
|
+
}, ie = class {
|
|
10392
|
+
assignFields(e, t = "", n = {}, r) {
|
|
10393
|
+
if (!(!e || typeof e != "object")) return Object.assign(n, Object.entries(e).reduce((e, [n, { type: i, label: a, ...o }]) => (e[t + n] = {
|
|
10394
|
+
type: i || "text",
|
|
10395
|
+
label: a,
|
|
10396
|
+
...o,
|
|
10397
|
+
group: r && r.length ? r : o?.group
|
|
10398
|
+
}, e), {})), n;
|
|
10399
|
+
}
|
|
10400
|
+
checkFieldErrors(e) {
|
|
10401
|
+
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));
|
|
10402
|
+
if (t.length) throw Error(`StreamElements custom fields have errors: ${t.map(([e, t]) => `${e} (${t.label ?? t.type})`).join(", ")}`);
|
|
10403
|
+
}
|
|
10404
|
+
transformCSSIntoFields(e, t = "name", r = (e) => e, i = () => null) {
|
|
10405
|
+
let a = new M(), o = new j(), s = new n(), c = Object.fromEntries(e);
|
|
10406
|
+
return e.reduce((e, [n, l]) => {
|
|
10407
|
+
let u = i(n, l) ?? "", d = r(String(n).replace("--", "").replaceAll("-", " ").replace("message ", "")).trim();
|
|
10408
|
+
switch (!e[u] && u.length && (e["/" + u] = {
|
|
10409
|
+
type: "hidden",
|
|
10410
|
+
label: a.capitalize(u)
|
|
10411
|
+
}), t) {
|
|
10412
|
+
case "name":
|
|
10413
|
+
if (["color"].some((e) => n.endsWith(e))) e[n] = {
|
|
10414
|
+
type: "colorpicker",
|
|
10415
|
+
label: a.capitalize(d),
|
|
10416
|
+
value: l
|
|
10417
|
+
};
|
|
10418
|
+
else if ([
|
|
10419
|
+
"size",
|
|
10420
|
+
"width",
|
|
10421
|
+
"height",
|
|
10422
|
+
"spacing",
|
|
10423
|
+
"gap",
|
|
10424
|
+
"radius"
|
|
10425
|
+
].some((e) => n.endsWith(e))) {
|
|
10426
|
+
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;
|
|
10427
|
+
e[n] = {
|
|
10428
|
+
type: "number",
|
|
10429
|
+
label: a.capitalize(d),
|
|
10430
|
+
value: parseFloat(l),
|
|
10431
|
+
min: f,
|
|
10432
|
+
max: p,
|
|
10433
|
+
step: m
|
|
10434
|
+
};
|
|
10435
|
+
} else ["weight"].some((e) => n.endsWith(e)) ? e[n] = {
|
|
10436
|
+
type: "dropdown",
|
|
10437
|
+
label: a.capitalize(d),
|
|
10438
|
+
value: String(l),
|
|
10439
|
+
options: {
|
|
10440
|
+
100: "Thin 100",
|
|
10441
|
+
200: "Extra Light 200",
|
|
10442
|
+
300: "Light 300",
|
|
10443
|
+
400: "Normal 400",
|
|
10444
|
+
500: "Medium 500",
|
|
10445
|
+
600: "Semi Bold 600",
|
|
10446
|
+
700: "Bold 700",
|
|
10447
|
+
800: "Extra Bold 800",
|
|
10448
|
+
900: "Black 900"
|
|
10449
|
+
}
|
|
10450
|
+
} : n.endsWith("font-family") && (e[n] = {
|
|
10451
|
+
type: "googleFont",
|
|
10452
|
+
label: a.capitalize(d),
|
|
10453
|
+
value: l.split(",")[0].trim().replaceAll("'", "")
|
|
10454
|
+
});
|
|
10455
|
+
break;
|
|
10456
|
+
case "value":
|
|
10457
|
+
if (o.validate(l)) e[n] = {
|
|
10458
|
+
type: "colorpicker",
|
|
10459
|
+
label: a.capitalize(d) + " color",
|
|
10460
|
+
value: l
|
|
10461
|
+
};
|
|
10462
|
+
else if (l.startsWith("linear-gradient(") || l.startsWith("radial-gradient(")) {
|
|
10463
|
+
let t = l.match(ae);
|
|
10464
|
+
t && t.forEach((t, r) => {
|
|
10465
|
+
e[`${n}-gradient`] = {
|
|
10466
|
+
type: "hidden",
|
|
10467
|
+
label: "• Gradient colors"
|
|
10468
|
+
}, e[`${n}-gradient-${r}`] = {
|
|
10469
|
+
type: "colorpicker",
|
|
10470
|
+
label: a.capitalize(d) + ` ${s.translate(r + 1, "suffix")} color`,
|
|
10471
|
+
value: t
|
|
10472
|
+
};
|
|
10473
|
+
});
|
|
10474
|
+
} else if (l.endsWith("px")) {
|
|
10475
|
+
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;
|
|
10476
|
+
e[n] = {
|
|
10477
|
+
type: "number",
|
|
10478
|
+
label: a.capitalize(d) + " (px)",
|
|
10479
|
+
value: parseFloat(l.replace("px", "")),
|
|
10480
|
+
min: f,
|
|
10481
|
+
max: p,
|
|
10482
|
+
step: m
|
|
10483
|
+
};
|
|
10484
|
+
} else if (l.endsWith("em")) {
|
|
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) + " (em)",
|
|
10489
|
+
value: parseFloat(l.replace("em", "")),
|
|
10490
|
+
min: f,
|
|
10491
|
+
max: p,
|
|
10492
|
+
step: m
|
|
10493
|
+
};
|
|
10494
|
+
} else if (isNaN(parseFloat(l))) e[n] = {
|
|
10495
|
+
type: "text",
|
|
10496
|
+
label: a.capitalize(d),
|
|
10497
|
+
value: l
|
|
10498
|
+
};
|
|
10499
|
+
else {
|
|
10500
|
+
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;
|
|
10501
|
+
e[n] = {
|
|
10502
|
+
type: "number",
|
|
10503
|
+
label: a.capitalize(d),
|
|
10504
|
+
value: parseFloat(l),
|
|
10505
|
+
min: f,
|
|
10506
|
+
max: p,
|
|
10507
|
+
step: m
|
|
10508
|
+
};
|
|
10509
|
+
}
|
|
10510
|
+
break;
|
|
10511
|
+
}
|
|
10512
|
+
return e;
|
|
10513
|
+
}, {});
|
|
10514
|
+
}
|
|
10515
|
+
splitFieldLabel(e, t, n = 31) {
|
|
10516
|
+
let r = Math.max(1, Math.floor(n)), i = String(t).trim().match(/\[[^\]]+\]|\S+/g) ?? [], a = [], o = "", s = (e) => {
|
|
10517
|
+
if (!o.length) {
|
|
10518
|
+
o = e;
|
|
10519
|
+
return;
|
|
10520
|
+
}
|
|
10521
|
+
if (`${o} ${e}`.length <= r) {
|
|
10522
|
+
o += ` ${e}`;
|
|
10523
|
+
return;
|
|
10524
|
+
}
|
|
10525
|
+
a.push(o), o = e;
|
|
10526
|
+
};
|
|
10527
|
+
for (let e of i) {
|
|
10528
|
+
if (e.startsWith("[") && e.endsWith("]")) {
|
|
10529
|
+
let t = e.slice(1, -1).trim();
|
|
10530
|
+
if (!t.length) continue;
|
|
10531
|
+
o.length && (a.push(o), o = ""), a.push(t);
|
|
10532
|
+
continue;
|
|
10533
|
+
}
|
|
10534
|
+
let t = e;
|
|
10535
|
+
for (; t.length > r;) {
|
|
10536
|
+
let e = t.slice(0, r);
|
|
10537
|
+
o.length && (a.push(o), o = ""), a.push(e), t = t.slice(r);
|
|
10538
|
+
}
|
|
10539
|
+
t.length && s(t);
|
|
10540
|
+
}
|
|
10541
|
+
return o.length && a.push(o), a.length || a.push(""), Object.fromEntries(a.map((t, n) => [`${e}[${n}]`, {
|
|
10542
|
+
type: "hidden",
|
|
10543
|
+
label: t
|
|
10544
|
+
}]));
|
|
10545
|
+
}
|
|
10546
|
+
}, 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]{0,2}|2(?:[0-4][0-9]?|5[0-4]?|[6-9])?|[3-9][0-9]?)(?:\.[0-9]+)?|255(?:\.0+)?|\.[0-9]+)\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]+)\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:\.[0-9]+)?|150(?:\.0+)?)\s+(-?[0-9]+(?:\.[0-9]+)?(?:deg|rad|grad|turn)?)\s*(?:(?:\s*(?:\/)\s*(0*(?:(?:0|[1-9][0-9]?)(?:\.[0-9]+)?|100(?:\.0+)?|\.[0-9]+)%|0*0*(?:\.[0-9]+)?|1(?:\.0+)?|\.[0-9]+))?\s*)?\)|(color)\((?:(srgb|srgb-linear|display-p3|a98-rgb|prophoto-rgb|rec2020)(?:\s+|\s*,\s*)(0*0*(?:\.[0-9]+)?|1(?:\.0+)?|\.[0-9]+|0*(?:(?:0|[1-9][0-9]?)(?:\.[0-9]+)?|100(?:\.0+)?|\.[0-9]+)%)(?:\s+|\s*,\s*)(0*0*(?:\.[0-9]+)?|1(?:\.0+)?|\.[0-9]+|0*(?:(?:0|[1-9][0-9]?)(?:\.[0-9]+)?|100(?:\.0+)?|\.[0-9]+)%)(?:\s+|\s*,\s*)(0*0*(?:\.[0-9]+)?|1(?:\.0+)?|\.[0-9]+|0*(?:(?:0|[1-9][0-9]?)(?:\.[0-9]+)?|100(?:\.0+)?|\.[0-9]+)%)(?:(?:\s+\s*(?:\/)\s*(0*(?:(?:0|[1-9][0-9]?)(?:\.[0-9]+)?|100(?:\.0+)?|\.[0-9]+)%|0*0*(?:\.[0-9]+)?|1(?:\.0+)?|\.[0-9]+))?\s*)?|(xyz|xyz-d50|xyz-d65)(?:\s+|\s*,\s*)(-?[0-9]+(?:\.[0-9]+)?%?)(?:\s+|\s*,\s*)(-?[0-9]+(?:\.[0-9]+)?%?)(?:\s+|\s*,\s*)(-?[0-9]+(?:\.[0-9]+)?%?)(?:(?:\s+\s*(?:\/)\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
10547
|
(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
|
|
10548
|
+
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
10549
|
})(B ||= {});
|
|
10368
10550
|
//#endregion
|
|
10369
10551
|
//#region src/actions/button.ts
|
|
10370
|
-
var
|
|
10552
|
+
var oe = class e {
|
|
10371
10553
|
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,
|
|
10554
|
+
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
10555
|
e.actions.buttons.push(this), e.emit("action", this, "created");
|
|
10374
10556
|
});
|
|
10375
10557
|
}
|
|
@@ -10396,25 +10578,25 @@ var ie = class e {
|
|
|
10396
10578
|
parse(e, t) {
|
|
10397
10579
|
var n = e.replace(typeof this.field == "string" ? this.field : this.template.replace(/\{[^}]*\}/g, "") ?? "", "").trim();
|
|
10398
10580
|
try {
|
|
10399
|
-
this.run.apply(
|
|
10581
|
+
this.run.apply(N[0] || void 0, [n.length ? n : e ?? e, t]);
|
|
10400
10582
|
} catch (e) {
|
|
10401
10583
|
throw Error(`Error running button "${this.field}": ${e instanceof Error ? e.message : e}`);
|
|
10402
10584
|
}
|
|
10403
10585
|
return this;
|
|
10404
10586
|
}
|
|
10405
10587
|
remove() {
|
|
10406
|
-
let e =
|
|
10407
|
-
if (e > -1 &&
|
|
10408
|
-
let t =
|
|
10409
|
-
t > -1 && (
|
|
10588
|
+
let e = L.indexOf(this);
|
|
10589
|
+
if (e > -1 && L.splice(e, 1), !N.length) return;
|
|
10590
|
+
let t = N[0]?.actions.buttons.indexOf(this);
|
|
10591
|
+
t > -1 && (N[0]?.actions.buttons.splice(t, 1), N[0]?.emit("action", this, "removed"));
|
|
10410
10592
|
}
|
|
10411
10593
|
static execute(t, n) {
|
|
10412
10594
|
try {
|
|
10413
|
-
if (
|
|
10414
|
-
let r =
|
|
10595
|
+
if (L.length) {
|
|
10596
|
+
let r = L.filter((e) => typeof e.field == "string" ? e.field === t : typeof e.field == "function" ? e.field(t, n) : !1);
|
|
10415
10597
|
if (r.length && r.every((t) => t instanceof e)) return r.forEach((e) => {
|
|
10416
10598
|
try {
|
|
10417
|
-
e.parse(t, n),
|
|
10599
|
+
e.parse(t, n), N.forEach((t) => {
|
|
10418
10600
|
t.emit("action", e, "executed");
|
|
10419
10601
|
}), Q.received(`Button executed: ${t}${n ? ` with value: ${n}` : ""}`);
|
|
10420
10602
|
} catch (e) {
|
|
@@ -10430,7 +10612,7 @@ var ie = class e {
|
|
|
10430
10612
|
}
|
|
10431
10613
|
}, V = class e {
|
|
10432
10614
|
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,
|
|
10615
|
+
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
10616
|
e.actions.commands.push(this), e.emit("action", this, "created");
|
|
10435
10617
|
});
|
|
10436
10618
|
}
|
|
@@ -10464,24 +10646,24 @@ var ie = class e {
|
|
|
10464
10646
|
case "kick": return !1;
|
|
10465
10647
|
}
|
|
10466
10648
|
let o = this.verify(r, i, n);
|
|
10467
|
-
return o === !0 && this.run.apply(
|
|
10649
|
+
return o === !0 && this.run.apply(N[0] || void 0, [n, t]), o;
|
|
10468
10650
|
}
|
|
10469
10651
|
remove() {
|
|
10470
|
-
let e =
|
|
10471
|
-
if (e > -1 &&
|
|
10472
|
-
let t =
|
|
10473
|
-
t > -1 && (
|
|
10652
|
+
let e = I.indexOf(this);
|
|
10653
|
+
if (e > -1 && I.splice(e, 1), !N.length) return;
|
|
10654
|
+
let t = N[0]?.actions.commands.indexOf(this);
|
|
10655
|
+
t > -1 && (N[0]?.actions.commands.splice(t, 1), N[0]?.emit("action", this, "removed"));
|
|
10474
10656
|
}
|
|
10475
10657
|
static execute(t) {
|
|
10476
10658
|
let n = t.data;
|
|
10477
10659
|
try {
|
|
10478
|
-
if (
|
|
10479
|
-
let r =
|
|
10660
|
+
if (I.length && I.some((e) => n.event.data.text.startsWith(e.prefix))) {
|
|
10661
|
+
let r = I.filter((e) => {
|
|
10480
10662
|
var t = [e.name, ...e.aliases ?? []], r = n.event.data.text.replace(e.prefix, "").split(" ")[0];
|
|
10481
10663
|
return t.includes(r);
|
|
10482
10664
|
});
|
|
10483
10665
|
if (r.length && r.every((t) => t instanceof e)) return r.forEach((e) => {
|
|
10484
|
-
e.parse(n.event.data.text, t),
|
|
10666
|
+
e.parse(n.event.data.text, t), N.forEach((t) => {
|
|
10485
10667
|
t.emit("action", e, "executed");
|
|
10486
10668
|
}), Q.received(`Command executed: ${n.event.data.text} by ${n.event.data.nick || n.event.data.displayName}`, n);
|
|
10487
10669
|
}), !0;
|
|
@@ -10495,7 +10677,7 @@ var ie = class e {
|
|
|
10495
10677
|
};
|
|
10496
10678
|
window.addEventListener("onWidgetLoad", async (e) => {
|
|
10497
10679
|
let { detail: t } = e;
|
|
10498
|
-
|
|
10680
|
+
N.length && N.forEach(async (n) => {
|
|
10499
10681
|
if (n.fields = t.fieldData, n.session = t.session.data, n.details = {
|
|
10500
10682
|
...n.details,
|
|
10501
10683
|
user: t.channel,
|
|
@@ -10537,11 +10719,11 @@ window.addEventListener("onWidgetLoad", async (e) => {
|
|
|
10537
10719
|
});
|
|
10538
10720
|
}), window.addEventListener("onSessionUpdate", (e) => {
|
|
10539
10721
|
let { detail: t } = e;
|
|
10540
|
-
|
|
10722
|
+
N.length && N.forEach((e) => {
|
|
10541
10723
|
e.session = t.session, e.emit("session", t.session), e.debug && Q.debug("[Client]", "Session updated", t.session);
|
|
10542
10724
|
});
|
|
10543
10725
|
}), window.addEventListener("onEventReceived", ({ detail: e }) => {
|
|
10544
|
-
|
|
10726
|
+
N.length && N.forEach((t) => {
|
|
10545
10727
|
let n = B.event.parseProvider(e);
|
|
10546
10728
|
switch (n.provider) {
|
|
10547
10729
|
case "streamelements": {
|
|
@@ -10557,7 +10739,7 @@ window.addEventListener("onWidgetLoad", async (e) => {
|
|
|
10557
10739
|
switch (e.event.listener) {
|
|
10558
10740
|
case "widget-button": {
|
|
10559
10741
|
let t = e.event;
|
|
10560
|
-
|
|
10742
|
+
oe.execute(t.field, t.value);
|
|
10561
10743
|
break;
|
|
10562
10744
|
}
|
|
10563
10745
|
case "subscriber-latest":
|
|
@@ -10567,12 +10749,12 @@ window.addEventListener("onWidgetLoad", async (e) => {
|
|
|
10567
10749
|
break;
|
|
10568
10750
|
case "kvstore:update": {
|
|
10569
10751
|
let t = e.event;
|
|
10570
|
-
if (
|
|
10571
|
-
var r =
|
|
10752
|
+
if (P.length) {
|
|
10753
|
+
var r = P.find((e) => e.id === t.data.key.replace("customWidget.", "") || e.id === t.data.key);
|
|
10572
10754
|
r && r.update(t.data.value);
|
|
10573
10755
|
}
|
|
10574
|
-
if (
|
|
10575
|
-
let e =
|
|
10756
|
+
if (F.length) {
|
|
10757
|
+
let e = F.find((e) => e.id === t.data.key.replace("customWidget.", "") || e.id === t.data.key);
|
|
10576
10758
|
e && e.update(t.data.value);
|
|
10577
10759
|
}
|
|
10578
10760
|
break;
|
|
@@ -10686,7 +10868,7 @@ var H = class {
|
|
|
10686
10868
|
}
|
|
10687
10869
|
}, U = () => {
|
|
10688
10870
|
try {
|
|
10689
|
-
return
|
|
10871
|
+
return N;
|
|
10690
10872
|
} catch {
|
|
10691
10873
|
return [];
|
|
10692
10874
|
}
|
|
@@ -10766,7 +10948,7 @@ var H = class {
|
|
|
10766
10948
|
};
|
|
10767
10949
|
//#endregion
|
|
10768
10950
|
//#region src/local/generator.ts
|
|
10769
|
-
async function
|
|
10951
|
+
async function se(e, t, n = "USD") {
|
|
10770
10952
|
let r = {
|
|
10771
10953
|
BRL: {
|
|
10772
10954
|
code: "BRL",
|
|
@@ -10810,7 +10992,7 @@ async function ae(e, t, n = "USD") {
|
|
|
10810
10992
|
emulated: !0
|
|
10811
10993
|
};
|
|
10812
10994
|
}
|
|
10813
|
-
async function
|
|
10995
|
+
async function ce(e, t) {
|
|
10814
10996
|
if (e ??= await K.session.get(), t) {
|
|
10815
10997
|
let n = (e, t) => new Date(t.createdAt).getTime() - new Date(e.createdAt).getTime();
|
|
10816
10998
|
switch (t.provider) {
|
|
@@ -11010,7 +11192,7 @@ async function G(e = "random", t = "random", n = {}) {
|
|
|
11010
11192
|
return G(e, a);
|
|
11011
11193
|
case "message": {
|
|
11012
11194
|
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 ??
|
|
11195
|
+
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
11196
|
"reply-parent-display-name": t.reply.name,
|
|
11015
11197
|
"reply-parent-msg-body": t.reply.text,
|
|
11016
11198
|
"reply-parent-msg-id": t.reply.msgId,
|
|
@@ -11196,7 +11378,7 @@ async function G(e = "random", t = "random", n = {}) {
|
|
|
11196
11378
|
"Highlight Message",
|
|
11197
11379
|
"Send a Shoutout",
|
|
11198
11380
|
"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 ??
|
|
11381
|
+
])[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
11382
|
return {
|
|
11201
11383
|
listener: "event",
|
|
11202
11384
|
event: {
|
|
@@ -11208,7 +11390,7 @@ async function G(e = "random", t = "random", n = {}) {
|
|
|
11208
11390
|
createdAt: new Date(m).toISOString(),
|
|
11209
11391
|
expiresAt: new Date(m + 36e5).toISOString(),
|
|
11210
11392
|
updatedAt: new Date(m).toISOString(),
|
|
11211
|
-
activityId:
|
|
11393
|
+
activityId: ee,
|
|
11212
11394
|
sessionEventsCount: 1,
|
|
11213
11395
|
isMock: !0,
|
|
11214
11396
|
data: {
|
|
@@ -11278,7 +11460,7 @@ async function G(e = "random", t = "random", n = {}) {
|
|
|
11278
11460
|
case "alertService:toggleSound": return {
|
|
11279
11461
|
listener: "alertService:toggleSound",
|
|
11280
11462
|
event: {
|
|
11281
|
-
muted: n?.muted ??
|
|
11463
|
+
muted: n?.muted ?? N?.[0]?.details?.overlay?.muted ?? !1,
|
|
11282
11464
|
provider: e
|
|
11283
11465
|
},
|
|
11284
11466
|
emulated: !0
|
|
@@ -11298,7 +11480,7 @@ async function G(e = "random", t = "random", n = {}) {
|
|
|
11298
11480
|
case "message": {
|
|
11299
11481
|
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
11482
|
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 ??
|
|
11483
|
+
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
11484
|
return {
|
|
11303
11485
|
listener: "message",
|
|
11304
11486
|
event: {
|
|
@@ -11433,8 +11615,8 @@ async function G(e = "random", t = "random", n = {}) {
|
|
|
11433
11615
|
var K = new class {
|
|
11434
11616
|
constructor() {
|
|
11435
11617
|
this.event = {
|
|
11436
|
-
onWidgetLoad:
|
|
11437
|
-
onSessionUpdate:
|
|
11618
|
+
onWidgetLoad: se,
|
|
11619
|
+
onSessionUpdate: ce,
|
|
11438
11620
|
onEventReceived: G
|
|
11439
11621
|
}, this.session = {
|
|
11440
11622
|
types: {
|
|
@@ -12364,7 +12546,7 @@ var K = new class {
|
|
|
12364
12546
|
duration: "client",
|
|
12365
12547
|
processor: async function(e) {
|
|
12366
12548
|
if (window.dispatchEvent(new CustomEvent(e.listener, { detail: e.data })), e.listener === "onEventReceived" && e.session) {
|
|
12367
|
-
let t = await K.event.onSessionUpdate(
|
|
12549
|
+
let t = await K.event.onSessionUpdate(N?.[0] ? N[0].session : void 0, B.event.parseProvider(e.data));
|
|
12368
12550
|
window.dispatchEvent(new CustomEvent("onSessionUpdate", { detail: t }));
|
|
12369
12551
|
}
|
|
12370
12552
|
}
|
|
@@ -12423,7 +12605,7 @@ var K = new class {
|
|
|
12423
12605
|
return this.history.push({
|
|
12424
12606
|
detail: n,
|
|
12425
12607
|
timestamp: r.timeStamp,
|
|
12426
|
-
origin:
|
|
12608
|
+
origin: N?.[0]?.id
|
|
12427
12609
|
}), localStorage.setItem("SE_API-EVENTS", JSON.stringify(this.history)), window.dispatchEvent(r) ? { ok: !0 } : { ok: !1 };
|
|
12428
12610
|
},
|
|
12429
12611
|
broadcast(e, t) {
|
|
@@ -12435,13 +12617,13 @@ var K = new class {
|
|
|
12435
12617
|
return this.history.push({
|
|
12436
12618
|
detail: n,
|
|
12437
12619
|
timestamp: Date.now(),
|
|
12438
|
-
origin:
|
|
12620
|
+
origin: N?.[0]?.id
|
|
12439
12621
|
}), localStorage.setItem("SE_API-EVENTS", JSON.stringify(this.history)), window.dispatchEvent(r) ? { ok: !0 } : { ok: !1 };
|
|
12440
12622
|
},
|
|
12441
12623
|
history: []
|
|
12442
12624
|
}
|
|
12443
|
-
}, Y = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(
|
|
12444
|
-
async function
|
|
12625
|
+
}, Y = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(le());
|
|
12626
|
+
async function le() {
|
|
12445
12627
|
let e = localStorage.getItem("SE_API-STORE") ?? "{}", t = e ? JSON.parse(e) : {};
|
|
12446
12628
|
J.store.list = t;
|
|
12447
12629
|
let n = localStorage.getItem("SE_API-EVENTS") ?? "[]", r = n ? JSON.parse(n) : [];
|
|
@@ -12449,9 +12631,9 @@ async function se() {
|
|
|
12449
12631
|
}
|
|
12450
12632
|
//#endregion
|
|
12451
12633
|
//#region src/modules/useStorage.ts
|
|
12452
|
-
var
|
|
12634
|
+
var ue = class extends H {
|
|
12453
12635
|
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),
|
|
12636
|
+
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
12637
|
this.SE_API = e, e.store.get(this.id).then((e) => {
|
|
12456
12638
|
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
12639
|
}).catch(() => {
|
|
@@ -12484,7 +12666,7 @@ var ce = class extends H {
|
|
|
12484
12666
|
on(e, t) {
|
|
12485
12667
|
return e === "load" && this.loaded ? (t.apply(this, [this.data]), this) : (super.on(e, t), this);
|
|
12486
12668
|
}
|
|
12487
|
-
},
|
|
12669
|
+
}, de = class extends H {
|
|
12488
12670
|
constructor(e) {
|
|
12489
12671
|
super(), this.id = "default", this.debug = !1, this.fields = {}, this.loaded = !1, this.actions = {
|
|
12490
12672
|
commands: [],
|
|
@@ -12493,7 +12675,7 @@ var ce = class extends H {
|
|
|
12493
12675
|
avatar: 30,
|
|
12494
12676
|
pronoun: 60,
|
|
12495
12677
|
emote: 120
|
|
12496
|
-
}, this.id = e.id || this.id, this.storage = new
|
|
12678
|
+
}, this.id = e.id || this.id, this.storage = new ue({
|
|
12497
12679
|
id: this.id,
|
|
12498
12680
|
data: {
|
|
12499
12681
|
user: {},
|
|
@@ -12503,7 +12685,7 @@ var ce = class extends H {
|
|
|
12503
12685
|
}
|
|
12504
12686
|
}), this.on("load", () => {
|
|
12505
12687
|
this.debug = !!(typeof e.debug == "function" ? e.debug() : e.debug);
|
|
12506
|
-
}),
|
|
12688
|
+
}), N.push(this);
|
|
12507
12689
|
}
|
|
12508
12690
|
on(e, t) {
|
|
12509
12691
|
return e === "load" && this.loaded ? (t.apply(this, [{
|
|
@@ -12660,11 +12842,11 @@ var ce = class extends H {
|
|
|
12660
12842
|
})(Z ||= {});
|
|
12661
12843
|
//#endregion
|
|
12662
12844
|
//#region src/modules/fakeUser.ts
|
|
12663
|
-
var
|
|
12845
|
+
var fe = class {
|
|
12664
12846
|
constructor(e, t, n = [], r = !1, i) {
|
|
12665
12847
|
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
12848
|
}
|
|
12667
|
-
},
|
|
12849
|
+
}, pe = {
|
|
12668
12850
|
broadcaster: [
|
|
12669
12851
|
"moderator",
|
|
12670
12852
|
"vip",
|
|
@@ -12681,12 +12863,12 @@ var ue = class {
|
|
|
12681
12863
|
"duelyst_6",
|
|
12682
12864
|
"duelyst_7"
|
|
12683
12865
|
]
|
|
12684
|
-
},
|
|
12866
|
+
}, me = class e extends H {
|
|
12685
12867
|
static fixUser(t) {
|
|
12686
12868
|
return typeof t == "string" ? t.trim().replace(/^@+/, "").toLocaleLowerCase() : e.fixUser(t.name);
|
|
12687
12869
|
}
|
|
12688
12870
|
static getRandomSubTier() {
|
|
12689
|
-
return new
|
|
12871
|
+
return new z().probability({
|
|
12690
12872
|
prime: .4,
|
|
12691
12873
|
1e3: .3,
|
|
12692
12874
|
2e3: .2,
|
|
@@ -12700,7 +12882,7 @@ var ue = class {
|
|
|
12700
12882
|
e.set(n, [...r, t]);
|
|
12701
12883
|
}
|
|
12702
12884
|
return e;
|
|
12703
|
-
}, /* @__PURE__ */ new Map())),
|
|
12885
|
+
}, /* @__PURE__ */ new Map())), R.push(this);
|
|
12704
12886
|
}
|
|
12705
12887
|
start(t, n = S.badges.map((e) => e.set_id), r) {
|
|
12706
12888
|
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 +12928,7 @@ var ue = class {
|
|
|
12746
12928
|
}
|
|
12747
12929
|
return null;
|
|
12748
12930
|
};
|
|
12749
|
-
for (let [e, t] of C(
|
|
12931
|
+
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
12932
|
for (let e of a) {
|
|
12751
12933
|
let t = b(u[e]);
|
|
12752
12934
|
for (let n of t) {
|
|
@@ -12792,7 +12974,7 @@ var ue = class {
|
|
|
12792
12974
|
continue;
|
|
12793
12975
|
}
|
|
12794
12976
|
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
|
|
12977
|
+
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
12978
|
o.push(s);
|
|
12797
12979
|
}
|
|
12798
12980
|
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 +13029,9 @@ var ue = class {
|
|
|
12847
13029
|
message: new C().array(e)[0]
|
|
12848
13030
|
};
|
|
12849
13031
|
}
|
|
12850
|
-
},
|
|
13032
|
+
}, he = class extends H {
|
|
12851
13033
|
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,
|
|
13034
|
+
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
13035
|
this.loaded = !0, this.SE_API = e, Promise.all([async () => {
|
|
12854
13036
|
let t = await e.store.get(this.id);
|
|
12855
13037
|
t && (this.history = t.slice(-10));
|
|
@@ -12878,7 +13060,7 @@ var ue = class {
|
|
|
12878
13060
|
on(e, t) {
|
|
12879
13061
|
return e === "load" && this.loaded ? (t.apply(this), this) : (super.on(e, t), this);
|
|
12880
13062
|
}
|
|
12881
|
-
},
|
|
13063
|
+
}, ge = class {
|
|
12882
13064
|
constructor(e = {}) {
|
|
12883
13065
|
this.error = this.apply({
|
|
12884
13066
|
color: "#721c24",
|
|
@@ -12976,7 +13158,7 @@ var ue = class {
|
|
|
12976
13158
|
timeEnd(e) {
|
|
12977
13159
|
!this.enabled || !console.timeEnd || console.timeEnd(e);
|
|
12978
13160
|
}
|
|
12979
|
-
},
|
|
13161
|
+
}, _e = class extends H {
|
|
12980
13162
|
constructor(e, t) {
|
|
12981
13163
|
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
13164
|
this.instance = e, this.emit("load", e), this.connect();
|
|
@@ -12986,16 +13168,16 @@ var ue = class {
|
|
|
12986
13168
|
}
|
|
12987
13169
|
load() {
|
|
12988
13170
|
return window.ComfyJS === void 0 || !window.ComfyJS ? new Promise((e, t) => {
|
|
12989
|
-
if (this.emulate && !
|
|
13171
|
+
if (this.emulate && !N.length) return t(/* @__PURE__ */ Error("useComfyJs: Cannot emulate chat messages without a Client instance."));
|
|
12990
13172
|
let n = document.createElement("script");
|
|
12991
13173
|
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
13174
|
}) : Promise.resolve(window.ComfyJS);
|
|
12993
13175
|
}
|
|
12994
13176
|
connect() {
|
|
12995
13177
|
this.instance.onError = (e) => {
|
|
12996
|
-
this.emit("error", e),
|
|
13178
|
+
this.emit("error", e), N.some((e) => e.debug) && Q.error("[Client]", "ComfyJS Error:", e);
|
|
12997
13179
|
}, this.instance.onCommand = (e, t, n, r, i) => {
|
|
12998
|
-
if (this.emit("command", e, t, n, r, i),
|
|
13180
|
+
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
13181
|
let a = {
|
|
13000
13182
|
...r,
|
|
13001
13183
|
broadcaster: r.broadcaster,
|
|
@@ -13016,7 +13198,7 @@ var ue = class {
|
|
|
13016
13198
|
Z.emulate.twitch.message(o);
|
|
13017
13199
|
}
|
|
13018
13200
|
}, this.instance.onChat = (e, t, n, r, i) => {
|
|
13019
|
-
if (this.emit("chat", e, t, n, r, i),
|
|
13201
|
+
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
13202
|
let r = {
|
|
13021
13203
|
...n,
|
|
13022
13204
|
...i.userBadges,
|
|
@@ -13038,22 +13220,22 @@ var ue = class {
|
|
|
13038
13220
|
});
|
|
13039
13221
|
}
|
|
13040
13222
|
}, this.instance.onWhisper = (e, t, n, r, i) => {
|
|
13041
|
-
this.emit("whisper", e, t, n, r, i),
|
|
13223
|
+
this.emit("whisper", e, t, n, r, i), N.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Whisper: ${t} (User: ${e})`);
|
|
13042
13224
|
}, this.instance.onMessageDeleted = (e, t) => {
|
|
13043
|
-
this.emit("messageDeleted", e, t),
|
|
13225
|
+
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
13226
|
}, this.instance.onJoin = (e, t, n) => {
|
|
13045
|
-
this.emit("join", e, t, n),
|
|
13227
|
+
this.emit("join", e, t, n), N.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Join: ${e}`);
|
|
13046
13228
|
}, this.instance.onPart = (e, t, n) => {
|
|
13047
|
-
this.emit("part", e, t, n),
|
|
13229
|
+
this.emit("part", e, t, n), N.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Part: ${e}`);
|
|
13048
13230
|
}, this.instance.onHosted = (e, t, n, r) => {
|
|
13049
|
-
this.emit("hosted", e, t, n, r),
|
|
13231
|
+
this.emit("hosted", e, t, n, r), N.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Hosted: ${e} (${t} viewers)`);
|
|
13050
13232
|
}, this.instance.onRaid = (e, t, n) => {
|
|
13051
|
-
this.emit("raid", e, t, n),
|
|
13233
|
+
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
13234
|
name: e,
|
|
13053
13235
|
amount: t
|
|
13054
13236
|
});
|
|
13055
13237
|
}, this.instance.onSub = (e, t, n, r) => {
|
|
13056
|
-
if (this.emit("sub", e, t, n, r),
|
|
13238
|
+
if (this.emit("sub", e, t, n, r), N.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Sub: ${e} (${n.plan})`), this.emulate) {
|
|
13057
13239
|
let r = n.plan === "Prime" ? "prime" : n.plan;
|
|
13058
13240
|
Z.emulate.twitch.subscriber({
|
|
13059
13241
|
name: e,
|
|
@@ -13063,7 +13245,7 @@ var ue = class {
|
|
|
13063
13245
|
});
|
|
13064
13246
|
}
|
|
13065
13247
|
}, this.instance.onResub = (e, t, n, r, i, a) => {
|
|
13066
|
-
if (this.emit("resub", e, t, n, r, i, a),
|
|
13248
|
+
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
13249
|
let n = i.plan === "Prime" ? "prime" : i.plan;
|
|
13068
13250
|
Z.emulate.twitch.subscriber({
|
|
13069
13251
|
name: e,
|
|
@@ -13074,7 +13256,7 @@ var ue = class {
|
|
|
13074
13256
|
});
|
|
13075
13257
|
}
|
|
13076
13258
|
}, this.instance.onSubGift = (e, t, n, r, i, a) => {
|
|
13077
|
-
if (this.emit("subGift", e, t, n, r, i, a),
|
|
13259
|
+
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
13260
|
let t = i.plan === "Prime" ? "prime" : i.plan;
|
|
13079
13261
|
Z.emulate.twitch.subscriber({
|
|
13080
13262
|
name: n,
|
|
@@ -13086,7 +13268,7 @@ var ue = class {
|
|
|
13086
13268
|
});
|
|
13087
13269
|
}
|
|
13088
13270
|
}, this.instance.onSubMysteryGift = (e, t, n, r, i) => {
|
|
13089
|
-
if (this.emit("subMysteryGift", e, t, n, r, i),
|
|
13271
|
+
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
13272
|
let n = r.plan === "Prime" ? "prime" : r.plan;
|
|
13091
13273
|
Z.emulate.twitch.subscriber({
|
|
13092
13274
|
name: e,
|
|
@@ -13097,7 +13279,7 @@ var ue = class {
|
|
|
13097
13279
|
});
|
|
13098
13280
|
}
|
|
13099
13281
|
}, this.instance.onGiftSubContinue = (e, t, n) => {
|
|
13100
|
-
this.emit("giftSubContinue", e, t, n),
|
|
13282
|
+
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
13283
|
name: e,
|
|
13102
13284
|
message: "",
|
|
13103
13285
|
sender: t,
|
|
@@ -13105,22 +13287,22 @@ var ue = class {
|
|
|
13105
13287
|
subType: "gift"
|
|
13106
13288
|
});
|
|
13107
13289
|
}, this.instance.onCheer = (e, t, n, r, i) => {
|
|
13108
|
-
this.emit("cheer", e, t, n, r, i),
|
|
13290
|
+
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
13291
|
name: e,
|
|
13110
13292
|
message: t,
|
|
13111
13293
|
amount: n
|
|
13112
13294
|
});
|
|
13113
13295
|
}, this.instance.onChatMode = (e, t) => {
|
|
13114
|
-
this.emit("chatMode", e, t),
|
|
13296
|
+
this.emit("chatMode", e, t), N.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Chat Mode Changed on ${t}`);
|
|
13115
13297
|
}, this.instance.onReward = (e, t, n, r, i) => {
|
|
13116
|
-
this.emit("reward", e, t, n, r, i),
|
|
13298
|
+
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
13299
|
}, this.instance.onConnected = (e, t, n) => {
|
|
13118
|
-
this.emit("connected", e, t, n),
|
|
13300
|
+
this.emit("connected", e, t, n), N.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Connected: ${e}:${t} (First Connect: ${n})`);
|
|
13119
13301
|
}, this.instance.onReconnect = (e) => {
|
|
13120
|
-
this.emit("reconnect", e),
|
|
13302
|
+
this.emit("reconnect", e), N.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Reconnect: Attempt #${e}`);
|
|
13121
13303
|
}, this.init && this.instance.Init(this.username, this.password, this.channels, this.isDebug);
|
|
13122
13304
|
}
|
|
13123
|
-
},
|
|
13305
|
+
}, ve;
|
|
13124
13306
|
(function(e) {
|
|
13125
13307
|
let t;
|
|
13126
13308
|
(function(e) {
|
|
@@ -13144,7 +13326,7 @@ var ue = class {
|
|
|
13144
13326
|
e.list = n;
|
|
13145
13327
|
async function r(e) {
|
|
13146
13328
|
if (!e) throw Error("Username is required to fetch Alejo data.");
|
|
13147
|
-
if (e = e.toLowerCase(), !
|
|
13329
|
+
if (e = e.toLowerCase(), !N.length) {
|
|
13148
13330
|
try {
|
|
13149
13331
|
let t = await fetch(`https://pronouns.alejo.io/api/users/${e}`).then((e) => e.json()).then(([e]) => e);
|
|
13150
13332
|
if (t) return t.pronoun_id;
|
|
@@ -13153,7 +13335,7 @@ var ue = class {
|
|
|
13153
13335
|
}
|
|
13154
13336
|
return;
|
|
13155
13337
|
}
|
|
13156
|
-
let t =
|
|
13338
|
+
let t = N?.[0];
|
|
13157
13339
|
if (e in t.storage.data.pronoun && t.storage.data.pronoun[e].expire > Date.now()) return t.storage.data.pronoun[e].value;
|
|
13158
13340
|
try {
|
|
13159
13341
|
let n = await fetch(`https://pronouns.alejo.io/api/users/${e}`).then((e) => e.json()).then(([e]) => e);
|
|
@@ -13167,37 +13349,37 @@ var ue = class {
|
|
|
13167
13349
|
}
|
|
13168
13350
|
}
|
|
13169
13351
|
e.get = r;
|
|
13170
|
-
})(
|
|
13352
|
+
})(ve ||= {});
|
|
13171
13353
|
//#endregion
|
|
13172
13354
|
//#region src/main.ts
|
|
13173
|
-
var Q = new
|
|
13355
|
+
var Q = new ge(), $ = {
|
|
13174
13356
|
SeAPI: Y,
|
|
13175
|
-
Client:
|
|
13357
|
+
Client: de,
|
|
13176
13358
|
Helper: B,
|
|
13177
13359
|
Local: Z,
|
|
13178
13360
|
Data: S,
|
|
13179
13361
|
logger: Q,
|
|
13180
13362
|
modules: {
|
|
13181
13363
|
EventProvider: H,
|
|
13182
|
-
useStorage:
|
|
13364
|
+
useStorage: ue,
|
|
13183
13365
|
useQueue: W,
|
|
13184
|
-
useLogger:
|
|
13185
|
-
useComms:
|
|
13186
|
-
FakeUserPool:
|
|
13366
|
+
useLogger: ge,
|
|
13367
|
+
useComms: he,
|
|
13368
|
+
FakeUserPool: me
|
|
13187
13369
|
},
|
|
13188
13370
|
actions: {
|
|
13189
|
-
Button:
|
|
13371
|
+
Button: oe,
|
|
13190
13372
|
Command: V
|
|
13191
13373
|
},
|
|
13192
|
-
multistream: { useComfyJs:
|
|
13193
|
-
internal:
|
|
13194
|
-
pronouns: { Alejo:
|
|
13374
|
+
multistream: { useComfyJs: _e },
|
|
13375
|
+
internal: ne,
|
|
13376
|
+
pronouns: { Alejo: ve }
|
|
13195
13377
|
};
|
|
13196
13378
|
typeof window < "u" ? window.Tixyel = $ : globalThis.Tixyel = $;
|
|
13197
13379
|
//#endregion
|
|
13198
13380
|
//#region src/index.ts
|
|
13199
|
-
var
|
|
13381
|
+
var ye = $;
|
|
13200
13382
|
//#endregion
|
|
13201
|
-
export {
|
|
13383
|
+
export { ye as default };
|
|
13202
13384
|
|
|
13203
13385
|
//# sourceMappingURL=index.es.js.map
|