@tixyel/streamelements 3.2.0 → 3.3.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 +27 -3
- package/dist/index.es.js +285 -263
- 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
|
@@ -52,20 +52,23 @@ class O {
|
|
|
52
52
|
var $ = [];
|
|
53
53
|
class D extends O {
|
|
54
54
|
constructor(t) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
super(), this.id = "default", this.loaded = !1, this.SE_API = null, this.id = t.id || this.id, this.data = t.data ?? {}, $.push(this), this.start();
|
|
56
|
+
}
|
|
57
|
+
start() {
|
|
58
|
+
W?.then((t) => {
|
|
59
|
+
this.SE_API = t, t.store.get(this.id).then((e) => {
|
|
60
|
+
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);
|
|
61
|
+
}).catch(() => {
|
|
62
|
+
this.loaded = !0, this.emit("load", null);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
62
65
|
}
|
|
63
66
|
/**
|
|
64
67
|
* Saves the current data to storage.
|
|
65
68
|
* @param data Data to save (defaults to current)
|
|
66
69
|
*/
|
|
67
70
|
save(t = this.data) {
|
|
68
|
-
this.loaded && (this.data = t, SE_API.store.set(this.id, this.data), this.emit("update", this.data));
|
|
71
|
+
this.loaded && this.SE_API && (this.data = t, this.SE_API.store.set(this.id, this.data), this.emit("update", this.data));
|
|
69
72
|
}
|
|
70
73
|
/**
|
|
71
74
|
* Updates the storage data and emits an update event
|
|
@@ -146,43 +149,43 @@ class A extends O {
|
|
|
146
149
|
]), this) : (super.on(t, e), this);
|
|
147
150
|
}
|
|
148
151
|
}
|
|
149
|
-
var F = /* @__PURE__ */ ((
|
|
150
|
-
function U(
|
|
152
|
+
var F = /* @__PURE__ */ ((u) => (u.hehim = "He/Him", u.sheher = "She/Her", u.theythem = "They/Them", u.shethem = "She/They", u.hethem = "He/They", u.heshe = "He/She", u.xexem = "Xe/Xem", u.faefaer = "Fae/Faer", u.vever = "Ve/Ver", u.aeaer = "Ae/Aer", u.ziehir = "Zie/Hir", u.perper = "Per/Per", u.eem = "E/Em", u.itits = "It/Its", u))(F || {});
|
|
153
|
+
function U(u, t = I.data.emotes) {
|
|
151
154
|
const e = [];
|
|
152
155
|
return t.forEach((a) => {
|
|
153
156
|
const n = a.name;
|
|
154
157
|
let i = 0, d = 0;
|
|
155
|
-
for (; i <
|
|
156
|
-
const o =
|
|
158
|
+
for (; i < u.length; ) {
|
|
159
|
+
const o = u.indexOf(n, d);
|
|
157
160
|
if (o === -1) break;
|
|
158
|
-
const
|
|
159
|
-
/\s/.test(
|
|
161
|
+
const l = o > 0 ? u[o - 1] : " ", f = o + n.length < u.length ? u[o + n.length] : " ";
|
|
162
|
+
/\s/.test(l) && /\s/.test(f) && e.push({ ...a, start: o, end: o + n.length }), d = o + 1;
|
|
160
163
|
}
|
|
161
164
|
}), e.sort((a, n) => a.start - n.start);
|
|
162
165
|
}
|
|
163
|
-
function B(
|
|
164
|
-
if (!t.length) return
|
|
166
|
+
function B(u, t) {
|
|
167
|
+
if (!t.length) return u;
|
|
165
168
|
let e = "", a = 0;
|
|
166
169
|
return t.forEach((n) => {
|
|
167
|
-
e +=
|
|
168
|
-
const i = n.urls[4] || n.urls[2] || n.urls[1];
|
|
170
|
+
e += u.substring(a, n.start);
|
|
171
|
+
const i = n.urls[4] || n.urls[3] || n.urls[2] || n.urls[1];
|
|
169
172
|
e += `<img src="${i}" alt="${n.name}" class="emote" style="width: auto; height: 1em; vertical-align: middle;" />`, a = n.end;
|
|
170
|
-
}), e +=
|
|
173
|
+
}), e += u.substring(a), e;
|
|
171
174
|
}
|
|
172
|
-
async function z(
|
|
173
|
-
if (!Array.isArray(
|
|
175
|
+
async function z(u = [], t = "twitch") {
|
|
176
|
+
if (!Array.isArray(u) && typeof u == "string" && (u = u.split(",").map((d) => d.trim())), !u || !u.length) {
|
|
174
177
|
var e = I.rand.number(1, 3);
|
|
175
178
|
for await (const d of Array.from({ length: e }, () => "")) {
|
|
176
179
|
var a = I.rand.array(Object.keys(I.data.badges))[0];
|
|
177
|
-
!
|
|
180
|
+
!u.includes(a) && Array.isArray(u) ? u.push(a) : u = [a];
|
|
178
181
|
}
|
|
179
182
|
}
|
|
180
183
|
var n;
|
|
181
184
|
switch (t) {
|
|
182
185
|
case "twitch": {
|
|
183
186
|
n = {
|
|
184
|
-
keys: Array.from(
|
|
185
|
-
badges: Array.from(
|
|
187
|
+
keys: Array.from(u).filter((d) => d in I.data.badges),
|
|
188
|
+
badges: Array.from(u).slice(0, 3).map((d) => I.data.badges[d]).filter(Boolean)
|
|
186
189
|
};
|
|
187
190
|
break;
|
|
188
191
|
}
|
|
@@ -195,7 +198,7 @@ async function z(m = [], t = "twitch") {
|
|
|
195
198
|
subscriber: { isChatSponsor: !1 },
|
|
196
199
|
moderator: { isChatModerator: !1 }
|
|
197
200
|
};
|
|
198
|
-
n = Object.entries(
|
|
201
|
+
n = Object.entries(u).reduce(
|
|
199
202
|
(d, [o]) => (o in i && Object.assign(d, i[o]), d),
|
|
200
203
|
{
|
|
201
204
|
isVerified: !1,
|
|
@@ -209,7 +212,7 @@ async function z(m = [], t = "twitch") {
|
|
|
209
212
|
}
|
|
210
213
|
return n;
|
|
211
214
|
}
|
|
212
|
-
const
|
|
215
|
+
const J = [
|
|
213
216
|
"https://static-cdn.jtvnw.net/user-default-pictures-uv/13e5fa74-defa-11e9-809c-784f43822e80-profile_image-300x300.png",
|
|
214
217
|
"https://static-cdn.jtvnw.net/user-default-pictures-uv/dbdc9198-def8-11e9-8681-784f43822e80-profile_image-300x300.png",
|
|
215
218
|
"https://static-cdn.jtvnw.net/user-default-pictures-uv/998f01ae-def8-11e9-b95c-784f43822e80-profile_image-300x300.png",
|
|
@@ -217,7 +220,7 @@ const V = [
|
|
|
217
220
|
"https://static-cdn.jtvnw.net/user-default-pictures-uv/ebe4cd89-b4f4-4cd9-adac-2f30151b4209-profile_image-300x300.png",
|
|
218
221
|
"https://static-cdn.jtvnw.net/user-default-pictures-uv/215b7342-def9-11e9-9a66-784f43822e80-profile_image-300x300.png",
|
|
219
222
|
"https://static-cdn.jtvnw.net/user-default-pictures-uv/ead5c8b2-a4c9-4724-b1dd-9f00b46cbd3d-profile_image-300x300.png"
|
|
220
|
-
],
|
|
223
|
+
], K = {
|
|
221
224
|
"100 bits": {
|
|
222
225
|
type: "100 bits",
|
|
223
226
|
version: "1",
|
|
@@ -308,7 +311,7 @@ const V = [
|
|
|
308
311
|
url: "https://static-cdn.jtvnw.net/badges/v1/b817aba4-fad8-49e2-b88a-7cc744dfa6ec/3",
|
|
309
312
|
description: "VIP"
|
|
310
313
|
}
|
|
311
|
-
},
|
|
314
|
+
}, Q = Object.values([
|
|
312
315
|
{
|
|
313
316
|
type: "twitch",
|
|
314
317
|
name: "TheIlluminati",
|
|
@@ -1659,13 +1662,13 @@ const V = [
|
|
|
1659
1662
|
}
|
|
1660
1663
|
}
|
|
1661
1664
|
]).reduce(
|
|
1662
|
-
(
|
|
1665
|
+
(u, t) => (u.some((e) => e.name === t.name) || u.push({
|
|
1663
1666
|
...t,
|
|
1664
1667
|
start: 0,
|
|
1665
1668
|
end: 0
|
|
1666
|
-
}),
|
|
1669
|
+
}), u),
|
|
1667
1670
|
[]
|
|
1668
|
-
),
|
|
1671
|
+
), Z = [
|
|
1669
1672
|
"Hello everyone!",
|
|
1670
1673
|
"PogChamp",
|
|
1671
1674
|
"This stream is amazing!",
|
|
@@ -1716,7 +1719,7 @@ const V = [
|
|
|
1716
1719
|
"BloodTrail hunting time",
|
|
1717
1720
|
"CatBag kitty!",
|
|
1718
1721
|
"c! poggers"
|
|
1719
|
-
],
|
|
1722
|
+
], X = ["Local", "Tixyel", "Urie_s2", "itzzcatt", "BeniArts", "Cupidiko", "shy_madeit"], Y = [
|
|
1720
1723
|
"Filiz",
|
|
1721
1724
|
"Astrid",
|
|
1722
1725
|
"Tatyana",
|
|
@@ -1804,7 +1807,7 @@ const V = [
|
|
|
1804
1807
|
"Szabolcs",
|
|
1805
1808
|
"Hoda",
|
|
1806
1809
|
"Naayf"
|
|
1807
|
-
],
|
|
1810
|
+
], _ = [], tt = ["1000", "2000", "3000", "prime"], s = class s {
|
|
1808
1811
|
static fields(t) {
|
|
1809
1812
|
const e = {
|
|
1810
1813
|
from: "main",
|
|
@@ -1843,12 +1846,12 @@ const V = [
|
|
|
1843
1846
|
]
|
|
1844
1847
|
],
|
|
1845
1848
|
transforms: [
|
|
1846
|
-
[["size", "width", "number", "gap", "duration"], (
|
|
1847
|
-
[["font-family", "font", "family"], (
|
|
1848
|
-
[["range", "radius"], (
|
|
1849
|
-
[["options", "dropdown"], (
|
|
1850
|
-
[["weight"], (
|
|
1851
|
-
[["color", "background"], (
|
|
1849
|
+
[["size", "width", "number", "gap", "duration"], (c) => parseFloat(String(c))],
|
|
1850
|
+
[["font-family", "font", "family"], (c) => c],
|
|
1851
|
+
[["range", "radius"], (c) => parseFloat(String(c))],
|
|
1852
|
+
[["options", "dropdown"], (c) => c],
|
|
1853
|
+
[["weight"], (c) => c],
|
|
1854
|
+
[["color", "background"], (c) => c]
|
|
1852
1855
|
],
|
|
1853
1856
|
labels: [
|
|
1854
1857
|
[["font-size"], " • In pixels"],
|
|
@@ -1856,88 +1859,88 @@ const V = [
|
|
|
1856
1859
|
]
|
|
1857
1860
|
}
|
|
1858
1861
|
};
|
|
1859
|
-
function a(
|
|
1862
|
+
function a(c) {
|
|
1860
1863
|
return {
|
|
1861
1864
|
...e,
|
|
1862
|
-
...
|
|
1863
|
-
endsWith: Array.isArray(
|
|
1864
|
-
ignore: Array.isArray(
|
|
1865
|
-
replace: { ...e.replace, ...
|
|
1865
|
+
...c,
|
|
1866
|
+
endsWith: Array.isArray(c.endsWith) ? c.endsWith : e.endsWith,
|
|
1867
|
+
ignore: Array.isArray(c.ignore) ? c.ignore : e.ignore,
|
|
1868
|
+
replace: { ...e.replace, ...c.replace ?? {} },
|
|
1866
1869
|
settings: {
|
|
1867
|
-
types: Array.isArray(
|
|
1868
|
-
addons: Array.isArray(
|
|
1869
|
-
transforms: Array.isArray(
|
|
1870
|
-
labels: Array.isArray(
|
|
1870
|
+
types: Array.isArray(c.settings?.types) ? c.settings.types : e.settings.types,
|
|
1871
|
+
addons: Array.isArray(c.settings?.addons) ? c.settings.addons : e.settings.addons,
|
|
1872
|
+
transforms: Array.isArray(c.settings?.transforms) ? c.settings.transforms : e.settings.transforms,
|
|
1873
|
+
labels: Array.isArray(c.settings?.labels) ? c.settings.labels : e.settings.labels
|
|
1871
1874
|
},
|
|
1872
|
-
subgroup:
|
|
1873
|
-
template:
|
|
1874
|
-
subgroupTemplate:
|
|
1875
|
-
from:
|
|
1875
|
+
subgroup: c.subgroup ?? e.subgroup,
|
|
1876
|
+
template: c.template ?? e.template,
|
|
1877
|
+
subgroupTemplate: c.subgroupTemplate ?? e.subgroupTemplate,
|
|
1878
|
+
from: c.from ?? e.from
|
|
1876
1879
|
};
|
|
1877
1880
|
}
|
|
1878
|
-
const n = a(t), d = Array.from(document.styleSheets).filter(({ href:
|
|
1879
|
-
(
|
|
1880
|
-
|
|
1881
|
-
|
|
1881
|
+
const n = a(t), d = Array.from(document.styleSheets).filter(({ href: c }) => !c || c.startsWith(window.location.origin)).reduce(
|
|
1882
|
+
(c, { cssRules: p }) => (p && Array.from(p).forEach((v) => {
|
|
1883
|
+
v instanceof CSSStyleRule && v.selectorText === n.from && Array.from(v.style).some((y) => y.startsWith("--")) && Array.from(v.style).filter((y) => y.startsWith("--")).forEach((y) => {
|
|
1884
|
+
c[y] = v.style.getPropertyValue(y).trim();
|
|
1882
1885
|
});
|
|
1883
|
-
}),
|
|
1886
|
+
}), c),
|
|
1884
1887
|
{}
|
|
1885
|
-
), o = Object.entries(d).filter(([
|
|
1886
|
-
(
|
|
1888
|
+
), o = Object.entries(d).filter(([c]) => n.endsWith.some((p) => c.toLowerCase().endsWith(p.toLowerCase()) && !c.includes("-options-"))).filter(([c]) => !n.ignore.some((p) => c.toLowerCase() === p.toLowerCase())).reduce(
|
|
1889
|
+
(c, [p, v]) => (c[p.replace("--", "")] = String(n.replace?.[p] ?? v), c),
|
|
1887
1890
|
{}
|
|
1888
1891
|
);
|
|
1889
|
-
let
|
|
1892
|
+
let l = [];
|
|
1890
1893
|
const f = Object.entries(o).reduce(
|
|
1891
|
-
(
|
|
1892
|
-
let y = n.settings.types.find(([
|
|
1894
|
+
(c, [p, v]) => {
|
|
1895
|
+
let y = n.settings.types.find(([g]) => g.some((b) => p.toLowerCase().includes(b)))?.[1] || "text", x = n.settings.transforms.find(([g]) => g.some((b) => p.toLowerCase().includes(b)))?.[1] || ((g) => g), m = {
|
|
1893
1896
|
type: "text",
|
|
1894
|
-
label: n.settings.labels.find(([
|
|
1895
|
-
...n.settings.addons.find(([
|
|
1897
|
+
label: n.settings.labels.find(([g]) => g.some((b) => p.toLowerCase().includes(b)))?.[1] || "",
|
|
1898
|
+
...n.settings.addons.find(([g]) => g.some((b) => p.toLowerCase().includes(b)))?.[1] || {}
|
|
1896
1899
|
};
|
|
1897
|
-
["min", "max", "step", "label", "type"].forEach((
|
|
1898
|
-
const b = d[`--${p}-${
|
|
1899
|
-
b && b.length && (
|
|
1900
|
+
["min", "max", "step", "label", "type"].forEach((g) => {
|
|
1901
|
+
const b = d[`--${p}-${g}`];
|
|
1902
|
+
b && b.length && (m[g] = isNaN(parseFloat(b)) ? String(b).replace(/^['"]|['"]$/g, "") : String(parseFloat(b)));
|
|
1900
1903
|
});
|
|
1901
|
-
let w = p.replace(/-(size|color|weight|width|height|gap|duration|radius|amount)$/g, "").replace(/-([a-z])/g, (
|
|
1902
|
-
(
|
|
1904
|
+
let w = p.replace(/-(size|color|weight|width|height|gap|duration|radius|amount)$/g, "").replace(/-([a-z])/g, (g, b) => b.toUpperCase()).replace(/[A-Z]/g, " $&").toLowerCase().trim(), k = Object.keys(o).filter(
|
|
1905
|
+
(g) => g.startsWith(w.replace(/[A-Z]/g, "-$&").replaceAll(" ", "-").toLowerCase().slice(1))
|
|
1903
1906
|
);
|
|
1904
|
-
n.subgroup && !
|
|
1907
|
+
n.subgroup && !c[`${w.replace(/[A-Z]/g, "-$&").replaceAll(" ", "-").toLowerCase().slice(1)}-subgroup`] && k.length > 1 && !l.includes(p) && (l.push(...k), c[`${w.replace(/[A-Z]/g, "-$&").replaceAll(" ", "-").toLowerCase().slice(1)}-subgroup`] = {
|
|
1905
1908
|
type: "hidden",
|
|
1906
1909
|
label: n.subgroupTemplate.replaceAll("{key}", s.string.capitalize(w))
|
|
1907
1910
|
});
|
|
1908
1911
|
let E = s.string.capitalize(
|
|
1909
|
-
p.replace(/-([a-z])/g, (
|
|
1912
|
+
p.replace(/-([a-z])/g, (g, b) => b.toUpperCase()).replace(/[A-Z]/g, " $&").toLowerCase()
|
|
1910
1913
|
);
|
|
1911
|
-
|
|
1914
|
+
v = x(v) ?? v;
|
|
1912
1915
|
const S = (() => {
|
|
1913
|
-
const
|
|
1916
|
+
const g = Object.entries(d).filter(([b]) => b.startsWith(`--${p}-options-`)).reduce(
|
|
1914
1917
|
(b, [P, C]) => {
|
|
1915
1918
|
const T = P.replace(`--${p}-options-`, "");
|
|
1916
1919
|
return T && (b[String(C)] = s.string.capitalize(
|
|
1917
|
-
T.replace(/-([a-z])/g, (M,
|
|
1920
|
+
T.replace(/-([a-z])/g, (M, q) => q.toUpperCase()).replace(/[A-Z]/g, " $&").toLowerCase()
|
|
1918
1921
|
)), b;
|
|
1919
1922
|
},
|
|
1920
1923
|
{}
|
|
1921
1924
|
);
|
|
1922
|
-
return Object.keys(
|
|
1925
|
+
return Object.keys(g).length ? g : null;
|
|
1923
1926
|
})();
|
|
1924
|
-
return S && (y = "dropdown",
|
|
1925
|
-
[!1, "inherit", "auto", null].includes(b) && (
|
|
1926
|
-
}),
|
|
1927
|
-
type:
|
|
1928
|
-
label: n.template.toString().replaceAll("{key}", s.string.capitalize(E) +
|
|
1929
|
-
value:
|
|
1930
|
-
min:
|
|
1931
|
-
max:
|
|
1932
|
-
step:
|
|
1933
|
-
options:
|
|
1934
|
-
},
|
|
1927
|
+
return S && (y = "dropdown", m.options = S, v = String(v)), Object.entries(m).forEach(([g, b]) => {
|
|
1928
|
+
[!1, "inherit", "auto", null].includes(b) && (m[g] = v);
|
|
1929
|
+
}), c[p] = {
|
|
1930
|
+
type: m.type || y,
|
|
1931
|
+
label: n.template.toString().replaceAll("{key}", s.string.capitalize(E) + m.label),
|
|
1932
|
+
value: v,
|
|
1933
|
+
min: m.min,
|
|
1934
|
+
max: m.max,
|
|
1935
|
+
step: m.step,
|
|
1936
|
+
options: m.options
|
|
1937
|
+
}, c;
|
|
1935
1938
|
},
|
|
1936
1939
|
{}
|
|
1937
1940
|
), h = Object.entries(f).reduce(
|
|
1938
|
-
(
|
|
1939
|
-
const y =
|
|
1940
|
-
return (y || x) && (
|
|
1941
|
+
(c, [p, v]) => {
|
|
1942
|
+
const y = v?.label?.includes("undefined"), x = !["hidden", "button"].includes(v.type) && v.value === void 0;
|
|
1943
|
+
return (y || x) && (c[p] = v), c;
|
|
1941
1944
|
},
|
|
1942
1945
|
{}
|
|
1943
1946
|
);
|
|
@@ -1968,7 +1971,7 @@ const V = [
|
|
|
1968
1971
|
cache: "no-store"
|
|
1969
1972
|
}).then((a) => a.json()).then(async (a) => {
|
|
1970
1973
|
const n = Object.entries(a).filter(([d, { value: o }]) => o != null).reduce(
|
|
1971
|
-
(d, [o, { value:
|
|
1974
|
+
(d, [o, { value: l }]) => (e && e[o] !== void 0 && (l = e[o]), d[o] = l, d),
|
|
1972
1975
|
{
|
|
1973
1976
|
...e
|
|
1974
1977
|
}
|
|
@@ -1978,15 +1981,15 @@ const V = [
|
|
|
1978
1981
|
}
|
|
1979
1982
|
};
|
|
1980
1983
|
s.data = {
|
|
1981
|
-
names:
|
|
1982
|
-
messages:
|
|
1983
|
-
tiers:
|
|
1984
|
-
avatars:
|
|
1985
|
-
items:
|
|
1986
|
-
emotes:
|
|
1987
|
-
badges:
|
|
1984
|
+
names: X,
|
|
1985
|
+
messages: Z,
|
|
1986
|
+
tiers: tt,
|
|
1987
|
+
avatars: J,
|
|
1988
|
+
items: _,
|
|
1989
|
+
emotes: Q,
|
|
1990
|
+
badges: K,
|
|
1988
1991
|
pronouns: F,
|
|
1989
|
-
tts:
|
|
1992
|
+
tts: Y
|
|
1990
1993
|
}, s.color = {
|
|
1991
1994
|
opacity(t = 100, e) {
|
|
1992
1995
|
e = e.length > 7 ? e.substring(0, 6) : e, t = t > 1 ? t / 100 : t;
|
|
@@ -2381,8 +2384,8 @@ s.data = {
|
|
|
2381
2384
|
async replace(t, e, a) {
|
|
2382
2385
|
const n = [];
|
|
2383
2386
|
t.replace(e, (d, ...o) => {
|
|
2384
|
-
const
|
|
2385
|
-
return n.push(Promise.resolve(
|
|
2387
|
+
const l = typeof a == "function" ? a(d, ...o) : d;
|
|
2388
|
+
return n.push(Promise.resolve(l)), d;
|
|
2386
2389
|
});
|
|
2387
2390
|
const i = await Promise.all(n);
|
|
2388
2391
|
return t.replace(e, () => i.shift() ?? "");
|
|
@@ -2423,12 +2426,12 @@ s.data = {
|
|
|
2423
2426
|
const { mergeSpanStyles: n } = s.element;
|
|
2424
2427
|
e.skip = "<br/>", e.newline = "<br/>";
|
|
2425
2428
|
const i = Object.entries(s.object.flatten(e)).reduce(
|
|
2426
|
-
(r, [
|
|
2427
|
-
if (r[
|
|
2429
|
+
(r, [m, w]) => {
|
|
2430
|
+
if (r[m] = String(w), ["username", "name", "nick", "nickname", "sender"].some((k) => m === k)) {
|
|
2428
2431
|
const k = r?.username || r?.name || r?.nick || r?.nickname || r?.sender;
|
|
2429
2432
|
r.username = r.username || k, r.usernameAt = `@${r.username}`, r.name = r.name || k, r.nick = r.nick || k, r.nickname = r.nickname || k, r.sender = r.sender || k, r.senderAt = `@${r.sender}`;
|
|
2430
2433
|
}
|
|
2431
|
-
return ["amount", "count"].some((k) =>
|
|
2434
|
+
return ["amount", "count"].some((k) => m === k) && (r.amount = String(o), r.count = String(r?.count || o)), r.currency = r.currency || window.client?.details.currency.symbol || "$", r.currencyCode = r.currencyCode || window.client?.details.currency.code || "USD", r;
|
|
2432
2435
|
},
|
|
2433
2436
|
{}
|
|
2434
2437
|
), d = {
|
|
@@ -2436,9 +2439,9 @@ s.data = {
|
|
|
2436
2439
|
MODIFIERS: /\[(\w+)(:[^=]+)?=([^\]]+)\]/g
|
|
2437
2440
|
};
|
|
2438
2441
|
var o = parseFloat(i?.amount ?? i?.count ?? 0);
|
|
2439
|
-
const
|
|
2440
|
-
COLOR: (r,
|
|
2441
|
-
WEIGHT: (r,
|
|
2442
|
+
const l = {
|
|
2443
|
+
COLOR: (r, m) => n(m && s.color.validate(m) ? `color: ${m}` : "", r),
|
|
2444
|
+
WEIGHT: (r, m) => n(m && !isNaN(parseInt(m)) ? `font-weight: ${m}` : "", r),
|
|
2442
2445
|
BOLD: (r) => n("font-weight: bold", r),
|
|
2443
2446
|
LIGHT: (r) => n("font-weight: lighter", r),
|
|
2444
2447
|
STRONG: (r) => n("font-weight: bolder", r),
|
|
@@ -2449,8 +2452,8 @@ s.data = {
|
|
|
2449
2452
|
SUP: (r) => n("vertical-align: super", r),
|
|
2450
2453
|
LARGER: (r) => n("font-size: larger", r),
|
|
2451
2454
|
SMALL: (r) => n("font-size: smaller", r),
|
|
2452
|
-
SHADOW: (r,
|
|
2453
|
-
SIZE: (r,
|
|
2455
|
+
SHADOW: (r, m) => n(`text-shadow: ${m}`, r),
|
|
2456
|
+
SIZE: (r, m) => n(m ? `font-size: ${m}` : "", r)
|
|
2454
2457
|
}, h = {
|
|
2455
2458
|
...{
|
|
2456
2459
|
BT1: (r) => o > 1 ? r : "",
|
|
@@ -2461,11 +2464,11 @@ s.data = {
|
|
|
2461
2464
|
LOW: (r) => r.toLowerCase(),
|
|
2462
2465
|
REV: (r) => r.split("").reverse().join(""),
|
|
2463
2466
|
CAP: (r) => r.charAt(0).toUpperCase() + r.slice(1).toLowerCase(),
|
|
2464
|
-
FALLBACK: (r,
|
|
2467
|
+
FALLBACK: (r, m) => r.length ? r : m ?? r
|
|
2465
2468
|
},
|
|
2466
|
-
...a?.html ?
|
|
2469
|
+
...a?.html ? l : {},
|
|
2467
2470
|
...a.modifiers ?? {}
|
|
2468
|
-
},
|
|
2471
|
+
}, c = {
|
|
2469
2472
|
UPC: ["UPPERCASE", "UPPER", "UPP"],
|
|
2470
2473
|
LOW: ["LOWERCASE", "LOWER", "LWC"],
|
|
2471
2474
|
REV: ["REVERSE", "RVS"],
|
|
@@ -2488,57 +2491,57 @@ s.data = {
|
|
|
2488
2491
|
FALLBACK: ["FALLBACK", "FB"],
|
|
2489
2492
|
...a.aliases ?? {}
|
|
2490
2493
|
};
|
|
2491
|
-
function p(r,
|
|
2492
|
-
const k = Object.entries(
|
|
2494
|
+
function p(r, m, w) {
|
|
2495
|
+
const k = Object.entries(c).find(([j, S]) => S.some((g) => g.toUpperCase() === m.toUpperCase()) ? !0 : j.toUpperCase() === m.toUpperCase()), E = k ? k[0] : m.toUpperCase();
|
|
2493
2496
|
return h[E] ? h[E](r, typeof w == "string" ? w.trim() : null, i) : r;
|
|
2494
2497
|
}
|
|
2495
|
-
function
|
|
2496
|
-
let
|
|
2497
|
-
for (; (w = d.MODIFIERS.exec(
|
|
2498
|
-
const [k, E, j, S] = w,
|
|
2499
|
-
|
|
2498
|
+
function v(r) {
|
|
2499
|
+
let m = r, w;
|
|
2500
|
+
for (; (w = d.MODIFIERS.exec(m)) !== null; ) {
|
|
2501
|
+
const [k, E, j, S] = w, g = p(v(S), E, j);
|
|
2502
|
+
m = m.replace(k, g ?? ""), d.MODIFIERS.lastIndex = 0;
|
|
2500
2503
|
}
|
|
2501
|
-
return
|
|
2504
|
+
return m;
|
|
2502
2505
|
}
|
|
2503
2506
|
function y(r) {
|
|
2504
|
-
let
|
|
2507
|
+
let m = 0;
|
|
2505
2508
|
const w = r.length;
|
|
2506
2509
|
function k(j) {
|
|
2507
2510
|
let S = "";
|
|
2508
|
-
for (;
|
|
2509
|
-
if (r[
|
|
2510
|
-
|
|
2511
|
-
else if (r[
|
|
2511
|
+
for (; m < w; )
|
|
2512
|
+
if (r[m] === "\\")
|
|
2513
|
+
m + 1 < w ? (S += r[m + 1], m += 2) : m++;
|
|
2514
|
+
else if (r[m] === "[" && (!j || j !== "["))
|
|
2512
2515
|
S += E();
|
|
2513
|
-
else if (j && r[
|
|
2514
|
-
|
|
2516
|
+
else if (j && r[m] === j) {
|
|
2517
|
+
m++;
|
|
2515
2518
|
break;
|
|
2516
2519
|
} else
|
|
2517
|
-
S += r[
|
|
2520
|
+
S += r[m++];
|
|
2518
2521
|
return S;
|
|
2519
2522
|
}
|
|
2520
2523
|
function E() {
|
|
2521
|
-
|
|
2524
|
+
m++;
|
|
2522
2525
|
let j = "";
|
|
2523
|
-
for (;
|
|
2526
|
+
for (; m < w && /[A-Za-z0-9]/.test(r[m]); ) j += r[m++];
|
|
2524
2527
|
let S = null;
|
|
2525
|
-
if (r[
|
|
2526
|
-
|
|
2527
|
-
const b =
|
|
2528
|
-
for (;
|
|
2529
|
-
S = r.slice(b,
|
|
2528
|
+
if (r[m] === ":") {
|
|
2529
|
+
m++;
|
|
2530
|
+
const b = m;
|
|
2531
|
+
for (; m < w && r[m] !== "="; ) m++;
|
|
2532
|
+
S = r.slice(b, m);
|
|
2530
2533
|
}
|
|
2531
|
-
r[
|
|
2532
|
-
const
|
|
2533
|
-
return p(
|
|
2534
|
+
r[m] === "=" && m++;
|
|
2535
|
+
const g = k("]");
|
|
2536
|
+
return p(g, j, S);
|
|
2534
2537
|
}
|
|
2535
2538
|
return k();
|
|
2536
2539
|
}
|
|
2537
2540
|
let x = t.replace(
|
|
2538
2541
|
d.PLACEHOLDERS,
|
|
2539
|
-
(r,
|
|
2542
|
+
(r, m) => typeof i[m] == "string" || typeof i[m] == "number" ? String(i[m]) : m ?? m
|
|
2540
2543
|
);
|
|
2541
|
-
return x = a.method === "loop" ?
|
|
2544
|
+
return x = a.method === "loop" ? v(x) : y(x), x;
|
|
2542
2545
|
}
|
|
2543
2546
|
}, s.element = {
|
|
2544
2547
|
/**
|
|
@@ -2574,25 +2577,25 @@ s.data = {
|
|
|
2574
2577
|
* ```
|
|
2575
2578
|
*/
|
|
2576
2579
|
scale(t, e = 0, a = 1, n) {
|
|
2577
|
-
const { return: i = !1, parent: d, base: o } = n || {},
|
|
2578
|
-
if (!
|
|
2580
|
+
const { return: i = !1, parent: d, base: o } = n || {}, l = d || t.parentElement || document.body;
|
|
2581
|
+
if (!l) {
|
|
2579
2582
|
R.logger.warn("No parent element found for scaling");
|
|
2580
2583
|
return;
|
|
2581
2584
|
}
|
|
2582
|
-
const f =
|
|
2583
|
-
if (h === 0 ||
|
|
2585
|
+
const f = l.getBoundingClientRect(), h = t.offsetWidth, c = t.offsetHeight;
|
|
2586
|
+
if (h === 0 || c === 0) {
|
|
2584
2587
|
R.logger.warn("Element has zero width or height, cannot scale");
|
|
2585
2588
|
return;
|
|
2586
2589
|
}
|
|
2587
|
-
const p = f.width * a / h,
|
|
2588
|
-
let y = o === "width" ? p : o === "height" ?
|
|
2590
|
+
const p = f.width * a / h, v = f.height * a / c;
|
|
2591
|
+
let y = o === "width" ? p : o === "height" ? v : Math.min(p, v);
|
|
2589
2592
|
if (e > 0) {
|
|
2590
|
-
const r = f.width * e / h,
|
|
2593
|
+
const r = f.width * e / h, m = f.height * e / c, w = Math.max(r, m);
|
|
2591
2594
|
y = Math.max(w, y);
|
|
2592
2595
|
}
|
|
2593
2596
|
const x = {
|
|
2594
2597
|
width: h * y,
|
|
2595
|
-
height:
|
|
2598
|
+
height: c * y,
|
|
2596
2599
|
scale: y
|
|
2597
2600
|
};
|
|
2598
2601
|
return i || (t.style.transform = `scale(${y})`, t.style.transformOrigin = "center center"), x;
|
|
@@ -2614,27 +2617,27 @@ s.data = {
|
|
|
2614
2617
|
let i = e;
|
|
2615
2618
|
function d(f) {
|
|
2616
2619
|
if (f.nodeType === Node.TEXT_NODE) {
|
|
2617
|
-
const
|
|
2620
|
+
const c = f.textContent?.split("").map((v) => {
|
|
2618
2621
|
const y = document.createElement("span");
|
|
2619
|
-
return y.className = "char", y.dataset.index = String(i++), y.textContent =
|
|
2622
|
+
return y.className = "char", y.dataset.index = String(i++), y.textContent = v, i++, y.outerHTML;
|
|
2620
2623
|
}), p = document.createElement("span");
|
|
2621
|
-
return p.innerHTML =
|
|
2624
|
+
return p.innerHTML = c?.join("") ?? "", p;
|
|
2622
2625
|
} else if (f.nodeType === Node.ELEMENT_NODE) {
|
|
2623
2626
|
const h = f.cloneNode(!1);
|
|
2624
|
-
return f.childNodes.forEach((
|
|
2625
|
-
const p = d(
|
|
2626
|
-
p instanceof Node && Array.from(p.childNodes).forEach((
|
|
2627
|
-
h.appendChild(
|
|
2627
|
+
return f.childNodes.forEach((c) => {
|
|
2628
|
+
const p = d(c);
|
|
2629
|
+
p instanceof Node && Array.from(p.childNodes).forEach((v) => {
|
|
2630
|
+
h.appendChild(v);
|
|
2628
2631
|
});
|
|
2629
2632
|
}), h;
|
|
2630
2633
|
}
|
|
2631
2634
|
return f.cloneNode(!0);
|
|
2632
2635
|
}
|
|
2633
|
-
const o = n.body,
|
|
2636
|
+
const o = n.body, l = document.createElement("div");
|
|
2634
2637
|
return o.childNodes.forEach((f) => {
|
|
2635
2638
|
const h = d(f);
|
|
2636
|
-
h instanceof Node &&
|
|
2637
|
-
}),
|
|
2639
|
+
h instanceof Node && l.appendChild(h);
|
|
2640
|
+
}), l.innerHTML;
|
|
2638
2641
|
}
|
|
2639
2642
|
}, s.object = {
|
|
2640
2643
|
/**
|
|
@@ -2664,14 +2667,14 @@ s.data = {
|
|
|
2664
2667
|
continue;
|
|
2665
2668
|
}
|
|
2666
2669
|
if (i instanceof Map) {
|
|
2667
|
-
i.forEach((o,
|
|
2668
|
-
a[`${d}.${
|
|
2670
|
+
i.forEach((o, l) => {
|
|
2671
|
+
a[`${d}.${l}`] = JSON.stringify(o);
|
|
2669
2672
|
});
|
|
2670
2673
|
continue;
|
|
2671
2674
|
}
|
|
2672
2675
|
if (Array.isArray(i)) {
|
|
2673
|
-
i.forEach((o,
|
|
2674
|
-
const f = `${d}:${
|
|
2676
|
+
i.forEach((o, l) => {
|
|
2677
|
+
const f = `${d}:${l}`;
|
|
2675
2678
|
typeof o == "object" ? Object.assign(a, this.flatten(o, f)) : a[f] = String(o);
|
|
2676
2679
|
});
|
|
2677
2680
|
continue;
|
|
@@ -2938,43 +2941,43 @@ s.data = {
|
|
|
2938
2941
|
},
|
|
2939
2942
|
async get() {
|
|
2940
2943
|
const t = this.available(), e = (n) => {
|
|
2941
|
-
const i = (
|
|
2942
|
-
if (!
|
|
2944
|
+
const i = (l) => {
|
|
2945
|
+
if (!l || !("amount" in l)) return [];
|
|
2943
2946
|
const f = [];
|
|
2944
|
-
for (let h = 0; h <
|
|
2945
|
-
f.push(e(
|
|
2946
|
-
return f.sort((h,
|
|
2947
|
-
}, d = (
|
|
2947
|
+
for (let h = 0; h < l.amount; h++)
|
|
2948
|
+
f.push(e(l.value));
|
|
2949
|
+
return f.sort((h, c) => new Date(c.createdAt).getTime() - new Date(h.createdAt).getTime());
|
|
2950
|
+
}, d = (l) => {
|
|
2948
2951
|
const f = {};
|
|
2949
|
-
for (const h in
|
|
2950
|
-
const
|
|
2951
|
-
f[
|
|
2952
|
+
for (const h in l) {
|
|
2953
|
+
const c = h.replace("_type", "type");
|
|
2954
|
+
f[c] = e(l[h]);
|
|
2952
2955
|
}
|
|
2953
2956
|
return f;
|
|
2954
|
-
}, o = (
|
|
2955
|
-
if (!
|
|
2956
|
-
switch (
|
|
2957
|
+
}, o = (l) => {
|
|
2958
|
+
if (!l) return l;
|
|
2959
|
+
switch (l.type) {
|
|
2957
2960
|
case "int":
|
|
2958
|
-
return s.rand.number(
|
|
2961
|
+
return s.rand.number(l.min, l.max);
|
|
2959
2962
|
case "string":
|
|
2960
|
-
return s.rand.array(
|
|
2963
|
+
return s.rand.array(l.options)[0];
|
|
2961
2964
|
case "date":
|
|
2962
|
-
return s.rand.date(
|
|
2965
|
+
return s.rand.date(l.range);
|
|
2963
2966
|
case "array":
|
|
2964
|
-
return s.rand.array(
|
|
2967
|
+
return s.rand.array(l.options)[0];
|
|
2965
2968
|
case "recent":
|
|
2966
|
-
return i(
|
|
2969
|
+
return i(l);
|
|
2967
2970
|
default:
|
|
2968
|
-
return
|
|
2971
|
+
return l;
|
|
2969
2972
|
}
|
|
2970
2973
|
};
|
|
2971
2974
|
return typeof n != "object" || n === null ? n : "type" in n && typeof n.type == "string" ? o(n) : d(n);
|
|
2972
2975
|
};
|
|
2973
2976
|
var a = Object.entries(e(t)).reduce(
|
|
2974
2977
|
(n, [i, d]) => (Object.entries(d).forEach(
|
|
2975
|
-
([o,
|
|
2978
|
+
([o, l]) => (
|
|
2976
2979
|
//
|
|
2977
|
-
n[`${i}-${o}`] =
|
|
2980
|
+
n[`${i}-${o}`] = l
|
|
2978
2981
|
)
|
|
2979
2982
|
), n),
|
|
2980
2983
|
{}
|
|
@@ -3056,7 +3059,7 @@ s.data = {
|
|
|
3056
3059
|
switch (t) {
|
|
3057
3060
|
default:
|
|
3058
3061
|
case "random": {
|
|
3059
|
-
var i = s.rand.array(Object.keys(n).filter((
|
|
3062
|
+
var i = s.rand.array(Object.keys(n).filter((g) => n[g].length))[0], d = s.rand.array(n[i])[0];
|
|
3060
3063
|
return this.onEventReceived(i, d);
|
|
3061
3064
|
}
|
|
3062
3065
|
case "twitch":
|
|
@@ -3067,7 +3070,7 @@ s.data = {
|
|
|
3067
3070
|
return this.onEventReceived(t, d);
|
|
3068
3071
|
}
|
|
3069
3072
|
case "message": {
|
|
3070
|
-
var o = a?.name ?? s.rand.array(s.data.names.filter((b) => b.length))[0],
|
|
3073
|
+
var o = a?.name ?? s.rand.array(s.data.names.filter((b) => b.length))[0], l = a?.message ?? s.rand.array(s.data.messages.filter((b) => b.length))[0], f = await z(a?.badges ?? [], t), h = U(l), c = B(l, h), p = a?.color ?? s.rand.color("hex"), v = a?.userId ?? s.rand.number(1e7, 99999999).toString(), y = Date.now();
|
|
3071
3074
|
return {
|
|
3072
3075
|
listener: "message",
|
|
3073
3076
|
event: {
|
|
@@ -3081,7 +3084,7 @@ s.data = {
|
|
|
3081
3084
|
subscriber: f.keys.includes("subscriber") ? "1" : "0",
|
|
3082
3085
|
turbo: f.keys.includes("turbo") ? "1" : "0",
|
|
3083
3086
|
"tmi-sent-ts": y.toString(),
|
|
3084
|
-
"user-id":
|
|
3087
|
+
"user-id": v,
|
|
3085
3088
|
"user-type": "",
|
|
3086
3089
|
color: p,
|
|
3087
3090
|
"display-name": o,
|
|
@@ -3096,20 +3099,20 @@ s.data = {
|
|
|
3096
3099
|
displayName: o,
|
|
3097
3100
|
displayColor: p,
|
|
3098
3101
|
channel: "local",
|
|
3099
|
-
text:
|
|
3102
|
+
text: l,
|
|
3100
3103
|
isAction: !1,
|
|
3101
|
-
userId:
|
|
3104
|
+
userId: v,
|
|
3102
3105
|
msgId: s.rand.uuid(),
|
|
3103
3106
|
badges: f.badges,
|
|
3104
3107
|
emotes: h
|
|
3105
3108
|
},
|
|
3106
|
-
renderedText:
|
|
3109
|
+
renderedText: c
|
|
3107
3110
|
}
|
|
3108
3111
|
};
|
|
3109
3112
|
}
|
|
3110
3113
|
case "cheer":
|
|
3111
3114
|
case "cheer-latest": {
|
|
3112
|
-
var x = a?.amount ?? s.rand.number(100, 1e4), r = a?.avatar ?? s.rand.array(s.data.avatars)[0], o = a?.name ?? s.rand.array(s.data.names.filter((C) => C.length))[0],
|
|
3115
|
+
var x = a?.amount ?? s.rand.number(100, 1e4), r = a?.avatar ?? s.rand.array(s.data.avatars)[0], o = a?.name ?? s.rand.array(s.data.names.filter((C) => C.length))[0], l = a?.message ?? s.rand.array(s.data.messages.filter((C) => C.length))[0];
|
|
3113
3116
|
return {
|
|
3114
3117
|
listener: "cheer-latest",
|
|
3115
3118
|
event: {
|
|
@@ -3117,7 +3120,7 @@ s.data = {
|
|
|
3117
3120
|
avatar: r,
|
|
3118
3121
|
name: o.toLowerCase(),
|
|
3119
3122
|
displayName: o,
|
|
3120
|
-
message:
|
|
3123
|
+
message: l,
|
|
3121
3124
|
providerId: "",
|
|
3122
3125
|
_id: s.rand.uuid(),
|
|
3123
3126
|
sessionTop: !1,
|
|
@@ -3163,10 +3166,10 @@ s.data = {
|
|
|
3163
3166
|
}
|
|
3164
3167
|
case "subscriber":
|
|
3165
3168
|
case "subscriber-latest": {
|
|
3166
|
-
var
|
|
3169
|
+
var m = a?.tier ?? s.rand.array(["1000", "2000", "3000"])[0], x = a?.amount ?? s.rand.number(1, 24), r = a?.avatar ?? s.rand.array(s.data.avatars)[0], o = a?.name ?? s.rand.array(s.data.names.filter((M) => M.length))[0], w = a?.sender ?? s.rand.array(s.data.names.filter((M) => M.length && M !== o))[0], l = a?.message ?? s.rand.array(s.data.messages.filter((M) => M.length))[0], k = {
|
|
3167
3170
|
default: {
|
|
3168
3171
|
avatar: r,
|
|
3169
|
-
tier:
|
|
3172
|
+
tier: m,
|
|
3170
3173
|
playedAsCommunityGift: !1
|
|
3171
3174
|
},
|
|
3172
3175
|
gift: {
|
|
@@ -3174,7 +3177,7 @@ s.data = {
|
|
|
3174
3177
|
gifted: !0
|
|
3175
3178
|
},
|
|
3176
3179
|
community: {
|
|
3177
|
-
message:
|
|
3180
|
+
message: l,
|
|
3178
3181
|
sender: w,
|
|
3179
3182
|
bulkGifted: !0
|
|
3180
3183
|
},
|
|
@@ -3282,9 +3285,9 @@ s.data = {
|
|
|
3282
3285
|
return this.onEventReceived(t, d);
|
|
3283
3286
|
}
|
|
3284
3287
|
case "message": {
|
|
3285
|
-
var o = a?.name ?? s.rand.array(s.data.names.filter((L) => L.length))[0],
|
|
3288
|
+
var o = a?.name ?? s.rand.array(s.data.names.filter((L) => L.length))[0], l = a?.message ?? s.rand.array(s.data.messages.filter((L) => L.length))[0];
|
|
3286
3289
|
const P = await z(a?.badges ?? [], t);
|
|
3287
|
-
var h = U(
|
|
3290
|
+
var h = U(l), c = B(l, h), p = a?.color ?? s.rand.color("hex"), v = a?.userId ?? s.rand.number(1e7, 99999999).toString(), y = Date.now(), r = a?.avatar ?? s.rand.array(s.data.avatars)[0];
|
|
3288
3291
|
return {
|
|
3289
3292
|
listener: "message",
|
|
3290
3293
|
event: {
|
|
@@ -3299,9 +3302,9 @@ s.data = {
|
|
|
3299
3302
|
authorChannelId: "local",
|
|
3300
3303
|
publishedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3301
3304
|
hasDisplayContent: !0,
|
|
3302
|
-
displayMessage:
|
|
3305
|
+
displayMessage: l,
|
|
3303
3306
|
textMessageDetails: {
|
|
3304
|
-
messageText:
|
|
3307
|
+
messageText: l
|
|
3305
3308
|
}
|
|
3306
3309
|
},
|
|
3307
3310
|
authorDetails: {
|
|
@@ -3321,11 +3324,11 @@ s.data = {
|
|
|
3321
3324
|
tags: [],
|
|
3322
3325
|
displayColor: s.rand.color("hex"),
|
|
3323
3326
|
channel: "local",
|
|
3324
|
-
text:
|
|
3327
|
+
text: l,
|
|
3325
3328
|
avatar: r,
|
|
3326
3329
|
emotes: []
|
|
3327
3330
|
},
|
|
3328
|
-
renderedText:
|
|
3331
|
+
renderedText: l
|
|
3329
3332
|
}
|
|
3330
3333
|
};
|
|
3331
3334
|
}
|
|
@@ -3366,10 +3369,10 @@ s.data = {
|
|
|
3366
3369
|
}
|
|
3367
3370
|
case "sponsor":
|
|
3368
3371
|
case "sponsor-latest": {
|
|
3369
|
-
var
|
|
3372
|
+
var m = a?.tier ?? s.rand.array(["1000", "2000", "3000"])[0], x = a?.amount ?? s.rand.number(1, 24), r = a?.avatar ?? s.rand.array(s.data.avatars)[0], o = a?.name ?? s.rand.array(s.data.names.filter((L) => L.length))[0], w = a?.sender ?? s.rand.array(s.data.names.filter((L) => L.length && L !== o))[0], l = a?.message ?? s.rand.array(s.data.messages.filter((L) => L.length))[0], k = {
|
|
3370
3373
|
default: {
|
|
3371
3374
|
avatar: r,
|
|
3372
|
-
tier:
|
|
3375
|
+
tier: m,
|
|
3373
3376
|
playedAsCommunityGift: !1
|
|
3374
3377
|
},
|
|
3375
3378
|
gift: {
|
|
@@ -3377,7 +3380,7 @@ s.data = {
|
|
|
3377
3380
|
gifted: !0
|
|
3378
3381
|
},
|
|
3379
3382
|
community: {
|
|
3380
|
-
message:
|
|
3383
|
+
message: l,
|
|
3381
3384
|
sender: w,
|
|
3382
3385
|
bulkGifted: !0
|
|
3383
3386
|
},
|
|
@@ -3471,7 +3474,7 @@ s.data = {
|
|
|
3471
3474
|
}
|
|
3472
3475
|
};
|
|
3473
3476
|
let I = s;
|
|
3474
|
-
class
|
|
3477
|
+
class et {
|
|
3475
3478
|
constructor() {
|
|
3476
3479
|
this.themes = [
|
|
3477
3480
|
{
|
|
@@ -3558,9 +3561,9 @@ class tt {
|
|
|
3558
3561
|
const e = [];
|
|
3559
3562
|
t.background && t.background !== "transparent" && e.push(`background-color: ${t.background}`), t.color && e.push(`color: ${t.color}`), t.bold && e.push("font-weight: bold"), t.italic && e.push("font-style: italic"), t.underline && e.push("text-decoration: underline"), t.fontSize && e.push(`font-size: ${t.fontSize}px`);
|
|
3560
3563
|
const a = "%c", n = (...i) => {
|
|
3561
|
-
const d = Array.from(i).filter((h) => typeof h == "string" || typeof h == "number"), o = Array.from(i).filter((h) => typeof h != "string" && typeof h != "number"),
|
|
3564
|
+
const d = Array.from(i).filter((h) => typeof h == "string" || typeof h == "number"), o = Array.from(i).filter((h) => typeof h != "string" && typeof h != "number"), l = d.length > 0 ? e.join("; ") : null, f = [
|
|
3562
3565
|
d.length > 0 ? a + (t.template?.before ?? "") + d.join(" ") + (t.template?.after ?? "") : null,
|
|
3563
|
-
|
|
3566
|
+
l,
|
|
3564
3567
|
...o
|
|
3565
3568
|
].filter(Boolean);
|
|
3566
3569
|
return console.log(...f);
|
|
@@ -3616,23 +3619,23 @@ class N {
|
|
|
3616
3619
|
}
|
|
3617
3620
|
parse(t, e) {
|
|
3618
3621
|
if (!(window.client instanceof A)) return !1;
|
|
3619
|
-
const a = t.replace(this.prefix, "").split(" ").slice(1).map((
|
|
3622
|
+
const a = t.replace(this.prefix, "").split(" ").slice(1).map((l) => l.trim());
|
|
3620
3623
|
var n = "", i = [];
|
|
3621
3624
|
const d = { bits: "cheer", premium: "prime" };
|
|
3622
3625
|
switch (e.provider) {
|
|
3623
3626
|
case "twitch": {
|
|
3624
|
-
const
|
|
3625
|
-
n =
|
|
3627
|
+
const l = e.data;
|
|
3628
|
+
n = l.event.data.nick || l.event.data.displayName, l.event.data.tags?.badges && (i = l.event.data.tags.badges.toString().replace(/\/\d+/g, "").split(",").map((h) => h in d ? d[h] : h));
|
|
3626
3629
|
break;
|
|
3627
3630
|
}
|
|
3628
3631
|
case "youtube": {
|
|
3629
|
-
const
|
|
3632
|
+
const l = e.data, f = {
|
|
3630
3633
|
isVerified: "verified",
|
|
3631
3634
|
isChatOwner: "owner",
|
|
3632
3635
|
isChatSponsor: "sponsor",
|
|
3633
3636
|
isChatModerator: "moderator"
|
|
3634
3637
|
};
|
|
3635
|
-
n =
|
|
3638
|
+
n = l.event.data.nick || l.event.data.displayName, i = Object.entries(l.event.data.authorDetails).filter(([h, c]) => h.startsWith("is") && c).map(([h]) => f[h]).filter(Boolean);
|
|
3636
3639
|
break;
|
|
3637
3640
|
}
|
|
3638
3641
|
case "kick":
|
|
@@ -3657,7 +3660,7 @@ class N {
|
|
|
3657
3660
|
}
|
|
3658
3661
|
}
|
|
3659
3662
|
}
|
|
3660
|
-
class
|
|
3663
|
+
class at extends O {
|
|
3661
3664
|
constructor(t) {
|
|
3662
3665
|
window.client instanceof A && (super(), this.queue = [], this.priorityQueue = [], this.history = [], this.timeouts = [], this.running = !1, this.duration = void 0, this.loaded = !1, this.duration = t.duration, this.processor = t.processor, window.client.on("load", () => {
|
|
3663
3666
|
this.emit("load"), this.loaded = !0;
|
|
@@ -3711,48 +3714,11 @@ class et extends O {
|
|
|
3711
3714
|
return t === "load" && this.loaded ? (e.apply(this), this) : (super.on(t, e), this);
|
|
3712
3715
|
}
|
|
3713
3716
|
}
|
|
3714
|
-
const H = {
|
|
3715
|
-
getOverlayStatus: () => ({
|
|
3716
|
-
isEditorMode: !1,
|
|
3717
|
-
muted: !1
|
|
3718
|
-
}),
|
|
3719
|
-
resumeQueue: () => {
|
|
3720
|
-
},
|
|
3721
|
-
responses: {},
|
|
3722
|
-
sendMessage(m, t) {
|
|
3723
|
-
},
|
|
3724
|
-
counters: {
|
|
3725
|
-
get(m) {
|
|
3726
|
-
return null;
|
|
3727
|
-
}
|
|
3728
|
-
},
|
|
3729
|
-
sanitize(m) {
|
|
3730
|
-
return m;
|
|
3731
|
-
},
|
|
3732
|
-
cheerFilter(m) {
|
|
3733
|
-
return m;
|
|
3734
|
-
},
|
|
3735
|
-
setField(m, t, e) {
|
|
3736
|
-
},
|
|
3737
|
-
store: {
|
|
3738
|
-
set: function(m, t) {
|
|
3739
|
-
this.list[m] = t, localStorage.setItem("SE_API-STORE", JSON.stringify(H.store.list));
|
|
3740
|
-
},
|
|
3741
|
-
get: async function(m) {
|
|
3742
|
-
return this.list[m] ? this.list[m] : null;
|
|
3743
|
-
},
|
|
3744
|
-
list: {}
|
|
3745
|
-
}
|
|
3746
|
-
};
|
|
3747
|
-
function at() {
|
|
3748
|
-
let m = localStorage.getItem("SE_API-STORE") ?? "", t = m ? JSON.parse(m) : {};
|
|
3749
|
-
return H.store.list = t, H;
|
|
3750
|
-
}
|
|
3751
3717
|
window.addEventListener("load", () => {
|
|
3752
|
-
window.client instanceof A &&
|
|
3718
|
+
window.client instanceof A && I.start();
|
|
3753
3719
|
});
|
|
3754
|
-
window.addEventListener("onWidgetLoad", async (
|
|
3755
|
-
const { detail: t } =
|
|
3720
|
+
window.addEventListener("onWidgetLoad", async (u) => {
|
|
3721
|
+
const { detail: t } = u;
|
|
3756
3722
|
if (window.client instanceof A) {
|
|
3757
3723
|
const e = window.client;
|
|
3758
3724
|
e.fields = t.fieldData, e.session = t.session.data, e.details = {
|
|
@@ -3766,8 +3732,25 @@ window.addEventListener("onWidgetLoad", async (m) => {
|
|
|
3766
3732
|
e.details.provider = "local";
|
|
3767
3733
|
}).catch(() => {
|
|
3768
3734
|
e.details.provider = "local";
|
|
3769
|
-
}) : e.details.provider = "local", e.emit("load", t), e.loaded = !0, e.storage.on("load", () => {
|
|
3770
|
-
|
|
3735
|
+
}) : e.details.provider = "local", e.emit("load", t), e.loaded = !0, e.storage.on("load", (a) => {
|
|
3736
|
+
if (a) {
|
|
3737
|
+
const n = (f) => {
|
|
3738
|
+
const h = Date.now(), c = {};
|
|
3739
|
+
for (const p in f)
|
|
3740
|
+
if (f.hasOwnProperty(p)) {
|
|
3741
|
+
const v = f[p];
|
|
3742
|
+
v.expire && v.expire > h && (c[p] = v);
|
|
3743
|
+
}
|
|
3744
|
+
return c;
|
|
3745
|
+
}, i = n(a.user || {}), d = n(a.avatar || {}), o = n(a.pronoun || {}), l = n(a.emote || {});
|
|
3746
|
+
e.storage.update({
|
|
3747
|
+
user: i,
|
|
3748
|
+
avatar: d,
|
|
3749
|
+
pronoun: o,
|
|
3750
|
+
emote: l
|
|
3751
|
+
});
|
|
3752
|
+
}
|
|
3753
|
+
t.channel.providerId.length && e.storage.add(`avatar.${t.channel.providerId.toLowerCase()}`, {
|
|
3771
3754
|
value: t.channel.avatar,
|
|
3772
3755
|
timestamp: Date.now(),
|
|
3773
3756
|
expire: Date.now() + e.cache.avatar * 60 * 60 * 1e3
|
|
@@ -3775,21 +3758,21 @@ window.addEventListener("onWidgetLoad", async (m) => {
|
|
|
3775
3758
|
});
|
|
3776
3759
|
}
|
|
3777
3760
|
});
|
|
3778
|
-
window.addEventListener("onSessionUpdate", (
|
|
3779
|
-
const { detail: t } =
|
|
3761
|
+
window.addEventListener("onSessionUpdate", (u) => {
|
|
3762
|
+
const { detail: t } = u;
|
|
3780
3763
|
if (window.client instanceof A) {
|
|
3781
3764
|
const e = window.client;
|
|
3782
3765
|
e.session = t.session, e.emit("session", t.session);
|
|
3783
3766
|
}
|
|
3784
3767
|
});
|
|
3785
|
-
window.addEventListener("onEventReceived", ({ detail:
|
|
3768
|
+
window.addEventListener("onEventReceived", ({ detail: u }) => {
|
|
3786
3769
|
if (window.client instanceof A) {
|
|
3787
3770
|
var t = (
|
|
3788
3771
|
// @ts-ignore
|
|
3789
|
-
|
|
3772
|
+
u.event?.provider || u.event?.service || u.event?.data?.provider || window.client.details.provider
|
|
3790
3773
|
);
|
|
3791
|
-
["kvstore:update", "bot:counter", "alertService:toggleSound", "event:skip", "tip-latest", "event:test"].some((i) => i ===
|
|
3792
|
-
const n = { provider: t, data:
|
|
3774
|
+
["kvstore:update", "bot:counter", "alertService:toggleSound", "event:skip", "tip-latest", "event:test"].some((i) => i === u.listener) && (t = "streamelements");
|
|
3775
|
+
const n = { provider: t, data: u };
|
|
3793
3776
|
switch (n.provider) {
|
|
3794
3777
|
case "streamelements": {
|
|
3795
3778
|
const i = n.data;
|
|
@@ -3904,10 +3887,47 @@ window.addEventListener("onEventReceived", ({ detail: m }) => {
|
|
|
3904
3887
|
window.client.emit("event", n);
|
|
3905
3888
|
}
|
|
3906
3889
|
});
|
|
3907
|
-
const
|
|
3890
|
+
const H = {
|
|
3891
|
+
getOverlayStatus: () => ({
|
|
3892
|
+
isEditorMode: !1,
|
|
3893
|
+
muted: !1
|
|
3894
|
+
}),
|
|
3895
|
+
resumeQueue: () => {
|
|
3896
|
+
},
|
|
3897
|
+
responses: {},
|
|
3898
|
+
sendMessage(u, t) {
|
|
3899
|
+
},
|
|
3900
|
+
counters: {
|
|
3901
|
+
get(u) {
|
|
3902
|
+
return null;
|
|
3903
|
+
}
|
|
3904
|
+
},
|
|
3905
|
+
sanitize(u) {
|
|
3906
|
+
return u;
|
|
3907
|
+
},
|
|
3908
|
+
cheerFilter(u) {
|
|
3909
|
+
return u;
|
|
3910
|
+
},
|
|
3911
|
+
setField(u, t, e) {
|
|
3912
|
+
},
|
|
3913
|
+
store: {
|
|
3914
|
+
set: function(u, t) {
|
|
3915
|
+
this.list[u] = t, localStorage.setItem("SE_API-STORE", JSON.stringify(H.store.list));
|
|
3916
|
+
},
|
|
3917
|
+
get: async function(u) {
|
|
3918
|
+
return this.list[u] ? this.list[u] : null;
|
|
3919
|
+
},
|
|
3920
|
+
list: {}
|
|
3921
|
+
}
|
|
3922
|
+
};
|
|
3923
|
+
async function nt() {
|
|
3924
|
+
let u = localStorage.getItem("SE_API-STORE") ?? "", t = u ? JSON.parse(u) : {};
|
|
3925
|
+
return H.store.list = t, H;
|
|
3926
|
+
}
|
|
3927
|
+
const W = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(nt()), R = {
|
|
3908
3928
|
Client: A,
|
|
3909
3929
|
Simulation: I,
|
|
3910
|
-
logger: new
|
|
3930
|
+
logger: new et(),
|
|
3911
3931
|
utils: {
|
|
3912
3932
|
findEmotesInText: U,
|
|
3913
3933
|
replaceEmotesWithHTML: B
|
|
@@ -3917,11 +3937,13 @@ const R = {
|
|
|
3917
3937
|
Command: N,
|
|
3918
3938
|
EventProvider: O,
|
|
3919
3939
|
useStorage: D,
|
|
3920
|
-
useQueue:
|
|
3921
|
-
}
|
|
3940
|
+
useQueue: at
|
|
3941
|
+
},
|
|
3942
|
+
USE_SE_API: W
|
|
3922
3943
|
};
|
|
3923
3944
|
typeof window < "u" && (window.Tixyel = R);
|
|
3924
3945
|
export {
|
|
3925
|
-
R as Tixyel
|
|
3946
|
+
R as Tixyel,
|
|
3947
|
+
W as USE_SE_API
|
|
3926
3948
|
};
|
|
3927
3949
|
//# sourceMappingURL=index.es.js.map
|