@tixyel/streamelements 3.4.0 → 3.5.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 +1734 -1530
- package/dist/index.es.js +1824 -1989
- 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 +3 -2
package/dist/index.es.js
CHANGED
|
@@ -1,217 +1,3 @@
|
|
|
1
|
-
class D {
|
|
2
|
-
constructor() {
|
|
3
|
-
this.registeredEvents = {};
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Emits an event to all registered listeners.
|
|
7
|
-
* Returns an array of return values from the listeners.
|
|
8
|
-
* @param eventName The name of the event.
|
|
9
|
-
* @param args Arguments to pass to the listeners.
|
|
10
|
-
*/
|
|
11
|
-
emit(t, ...e) {
|
|
12
|
-
return (this.registeredEvents[t] || []).map((n) => n.apply(this, e));
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Registers an event listener.
|
|
16
|
-
* @param eventName The name of the event.
|
|
17
|
-
* @param callback The callback function.
|
|
18
|
-
*/
|
|
19
|
-
on(t, e) {
|
|
20
|
-
if (typeof e != "function")
|
|
21
|
-
throw new TypeError("Callback must be a function");
|
|
22
|
-
return this.registeredEvents[t] || (this.registeredEvents[t] = []), this.registeredEvents[t].push(e), this;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Removes a specific event listener.
|
|
26
|
-
* @param eventName The name of the event.
|
|
27
|
-
* @param callback The callback function to remove.
|
|
28
|
-
*/
|
|
29
|
-
off(t, e) {
|
|
30
|
-
const a = this.registeredEvents[t] || [];
|
|
31
|
-
return e ? (this.registeredEvents[t] = a.filter((n) => n !== e), this) : (this.registeredEvents[t] = [], this);
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Registers a listener that is executed only once.
|
|
35
|
-
* @param eventName The name of the event.
|
|
36
|
-
* @param callback The callback function.
|
|
37
|
-
*/
|
|
38
|
-
once(t, e) {
|
|
39
|
-
const a = (...n) => {
|
|
40
|
-
this.off(t, a), e.apply(this, n);
|
|
41
|
-
};
|
|
42
|
-
return this.on(t, a), this;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Removes all listeners for a specific event.
|
|
46
|
-
* @param eventName The name of the event.
|
|
47
|
-
*/
|
|
48
|
-
removeAllListeners(t) {
|
|
49
|
-
return this.registeredEvents[t] = [], this;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
var $ = [];
|
|
53
|
-
class G extends D {
|
|
54
|
-
constructor(t) {
|
|
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
|
-
});
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Saves the current data to storage.
|
|
68
|
-
* @param data Data to save (defaults to current)
|
|
69
|
-
*/
|
|
70
|
-
save(t = 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));
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Updates the storage data and emits an update event
|
|
75
|
-
* @param data Data to update (defaults to current)
|
|
76
|
-
*/
|
|
77
|
-
update(t = this.data) {
|
|
78
|
-
this.loaded && JSON.stringify(this.data) !== JSON.stringify(t) && (this.data = { ...this.data, ...t }, this.save(this.data));
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Adds a value to the storage at the specified path.
|
|
82
|
-
* @param path Path to add the value to
|
|
83
|
-
* @param value Value to add
|
|
84
|
-
*/
|
|
85
|
-
add(t, e) {
|
|
86
|
-
this.loaded && (G.setByPath(this.data, t, e), this.save(this.data));
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Clears all data from the storage.
|
|
90
|
-
*/
|
|
91
|
-
clear() {
|
|
92
|
-
this.loaded && (this.data = {}, this.save(this.data));
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Sets a value in the storage at the specified path.
|
|
96
|
-
* @param obj The object to set the value in
|
|
97
|
-
* @param path The path to set the value at
|
|
98
|
-
* @param value The value to set
|
|
99
|
-
* @returns The updated object
|
|
100
|
-
*/
|
|
101
|
-
static setByPath(t, e, a) {
|
|
102
|
-
const n = e.split(".");
|
|
103
|
-
let i = t;
|
|
104
|
-
for (let d = 0; d < n.length - 1; d++)
|
|
105
|
-
(typeof i[n[d]] != "object" || i[n[d]] == null) && (i[n[d]] = {}), i = i[n[d]];
|
|
106
|
-
return i[n[n.length - 1]] = a, i;
|
|
107
|
-
}
|
|
108
|
-
on(t, e) {
|
|
109
|
-
return t === "load" && this.loaded ? (e.apply(this, [this.data]), this) : (super.on(t, e), this);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
class A extends D {
|
|
113
|
-
constructor(t) {
|
|
114
|
-
super(), this.id = "default", this.fields = {}, this.loaded = !1, this.actions = {
|
|
115
|
-
commands: [],
|
|
116
|
-
buttons: []
|
|
117
|
-
}, this.cache = {
|
|
118
|
-
avatar: 30,
|
|
119
|
-
pronoun: 30,
|
|
120
|
-
emote: 30
|
|
121
|
-
}, this.id = t.id || this.id, this.storage = new G({
|
|
122
|
-
id: this.id,
|
|
123
|
-
data: {
|
|
124
|
-
user: {},
|
|
125
|
-
avatar: {},
|
|
126
|
-
pronoun: {},
|
|
127
|
-
emote: {}
|
|
128
|
-
}
|
|
129
|
-
}), window.client = this;
|
|
130
|
-
}
|
|
131
|
-
on(t, e) {
|
|
132
|
-
return t === "load" && this.loaded ? (e.apply(this, [
|
|
133
|
-
{
|
|
134
|
-
channel: this.details.user,
|
|
135
|
-
currency: this.details.currency,
|
|
136
|
-
fieldData: this.fields,
|
|
137
|
-
recents: [],
|
|
138
|
-
session: {
|
|
139
|
-
data: this.session,
|
|
140
|
-
settings: {
|
|
141
|
-
autoReset: !1,
|
|
142
|
-
calendar: !1,
|
|
143
|
-
resetOnStart: !1
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
overlay: this.details.overlay,
|
|
147
|
-
emulated: !1
|
|
148
|
-
}
|
|
149
|
-
]), this) : (super.on(t, e), this);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
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) {
|
|
154
|
-
const e = [];
|
|
155
|
-
return t.forEach((a) => {
|
|
156
|
-
const n = a.name;
|
|
157
|
-
let i = 0, d = 0;
|
|
158
|
-
for (; i < u.length; ) {
|
|
159
|
-
const o = u.indexOf(n, d);
|
|
160
|
-
if (o === -1) break;
|
|
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;
|
|
163
|
-
}
|
|
164
|
-
}), e.sort((a, n) => a.start - n.start);
|
|
165
|
-
}
|
|
166
|
-
function B(u, t) {
|
|
167
|
-
if (!t.length) return u;
|
|
168
|
-
let e = "", a = 0;
|
|
169
|
-
return t.forEach((n) => {
|
|
170
|
-
e += u.substring(a, n.start);
|
|
171
|
-
const d = Array.from({ ...n.urls, length: 5 }).slice(1).reverse().filter(Boolean)[0] || n.urls[1];
|
|
172
|
-
e += `<img src="${d}" alt="${n.name}" class="emote" style="width: auto; height: 1em; vertical-align: middle;" />`, a = n.end;
|
|
173
|
-
}), e += u.substring(a), e;
|
|
174
|
-
}
|
|
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) {
|
|
177
|
-
var e = I.rand.number(1, 3);
|
|
178
|
-
for await (const d of Array.from({ length: e }, () => "")) {
|
|
179
|
-
var a = I.rand.array(Object.keys(I.data.badges))[0];
|
|
180
|
-
!u.includes(a) && Array.isArray(u) ? u.push(a) : u = [a];
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
var n;
|
|
184
|
-
switch (t) {
|
|
185
|
-
case "twitch": {
|
|
186
|
-
n = {
|
|
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)
|
|
189
|
-
};
|
|
190
|
-
break;
|
|
191
|
-
}
|
|
192
|
-
case "youtube": {
|
|
193
|
-
var i = {
|
|
194
|
-
verified: { isVerified: !1 },
|
|
195
|
-
broadcaster: { isChatOwner: !1 },
|
|
196
|
-
host: { isChatOwner: !1 },
|
|
197
|
-
sponsor: { isChatSponsor: !1 },
|
|
198
|
-
subscriber: { isChatSponsor: !1 },
|
|
199
|
-
moderator: { isChatModerator: !1 }
|
|
200
|
-
};
|
|
201
|
-
n = Object.entries(u).reduce(
|
|
202
|
-
(d, [o]) => (o in i && Object.assign(d, i[o]), d),
|
|
203
|
-
{
|
|
204
|
-
isVerified: !1,
|
|
205
|
-
isChatOwner: !1,
|
|
206
|
-
isChatSponsor: !1,
|
|
207
|
-
isChatModerator: !1
|
|
208
|
-
}
|
|
209
|
-
);
|
|
210
|
-
break;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
return n;
|
|
214
|
-
}
|
|
215
1
|
const J = [
|
|
216
2
|
"https://static-cdn.jtvnw.net/user-default-pictures-uv/13e5fa74-defa-11e9-809c-784f43822e80-profile_image-300x300.png",
|
|
217
3
|
"https://static-cdn.jtvnw.net/user-default-pictures-uv/dbdc9198-def8-11e9-8681-784f43822e80-profile_image-300x300.png",
|
|
@@ -311,7 +97,7 @@ const J = [
|
|
|
311
97
|
url: "https://static-cdn.jtvnw.net/badges/v1/b817aba4-fad8-49e2-b88a-7cc744dfa6ec/3",
|
|
312
98
|
description: "VIP"
|
|
313
99
|
}
|
|
314
|
-
},
|
|
100
|
+
}, V = Object.values([
|
|
315
101
|
{
|
|
316
102
|
type: "twitch",
|
|
317
103
|
name: "TheIlluminati",
|
|
@@ -1662,13 +1448,13 @@ const J = [
|
|
|
1662
1448
|
}
|
|
1663
1449
|
}
|
|
1664
1450
|
]).reduce(
|
|
1665
|
-
(
|
|
1666
|
-
...
|
|
1451
|
+
(e, n) => (e.some((t) => t.name === n.name) || e.push({
|
|
1452
|
+
...n,
|
|
1667
1453
|
start: 0,
|
|
1668
1454
|
end: 0
|
|
1669
|
-
}),
|
|
1455
|
+
}), e),
|
|
1670
1456
|
[]
|
|
1671
|
-
),
|
|
1457
|
+
), Q = [
|
|
1672
1458
|
"Hello everyone!",
|
|
1673
1459
|
"PogChamp",
|
|
1674
1460
|
"This stream is amazing!",
|
|
@@ -1719,7 +1505,7 @@ const J = [
|
|
|
1719
1505
|
"BloodTrail hunting time",
|
|
1720
1506
|
"CatBag kitty!",
|
|
1721
1507
|
"c! poggers"
|
|
1722
|
-
],
|
|
1508
|
+
], Z = ["Local", "Tixyel", "Urie_s2", "itzzcatt", "BeniArts", "Cupidiko", "shy_madeit"], X = [
|
|
1723
1509
|
"Filiz",
|
|
1724
1510
|
"Astrid",
|
|
1725
1511
|
"Tatyana",
|
|
@@ -1807,204 +1593,28 @@ const J = [
|
|
|
1807
1593
|
"Szabolcs",
|
|
1808
1594
|
"Hoda",
|
|
1809
1595
|
"Naayf"
|
|
1810
|
-
],
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
["weight"],
|
|
1833
|
-
{
|
|
1834
|
-
options: {
|
|
1835
|
-
100: "Thin",
|
|
1836
|
-
200: "Extra Light",
|
|
1837
|
-
300: "Light",
|
|
1838
|
-
400: "Regular",
|
|
1839
|
-
500: "Medium",
|
|
1840
|
-
600: "Semi Bold",
|
|
1841
|
-
700: "Bold",
|
|
1842
|
-
800: "Extra Bold",
|
|
1843
|
-
900: "Black"
|
|
1844
|
-
}
|
|
1845
|
-
}
|
|
1846
|
-
]
|
|
1847
|
-
],
|
|
1848
|
-
transforms: [
|
|
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]
|
|
1855
|
-
],
|
|
1856
|
-
labels: [
|
|
1857
|
-
[["font-size"], " • In pixels"],
|
|
1858
|
-
[["font-radius"], " • In pixels"]
|
|
1859
|
-
]
|
|
1860
|
-
}
|
|
1861
|
-
};
|
|
1862
|
-
function a(c) {
|
|
1863
|
-
return {
|
|
1864
|
-
...e,
|
|
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 ?? {} },
|
|
1869
|
-
settings: {
|
|
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
|
|
1874
|
-
},
|
|
1875
|
-
subgroup: c.subgroup ?? e.subgroup,
|
|
1876
|
-
template: c.template ?? e.template,
|
|
1877
|
-
subgroupTemplate: c.subgroupTemplate ?? e.subgroupTemplate,
|
|
1878
|
-
from: c.from ?? e.from
|
|
1879
|
-
};
|
|
1880
|
-
}
|
|
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((b) => b.startsWith("--")) && Array.from(v.style).filter((b) => b.startsWith("--")).forEach((b) => {
|
|
1884
|
-
c[b] = v.style.getPropertyValue(b).trim();
|
|
1885
|
-
});
|
|
1886
|
-
}), c),
|
|
1887
|
-
{}
|
|
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),
|
|
1890
|
-
{}
|
|
1891
|
-
);
|
|
1892
|
-
let l = [];
|
|
1893
|
-
const f = Object.entries(o).reduce(
|
|
1894
|
-
(c, [p, v]) => {
|
|
1895
|
-
let b = n.settings.types.find(([g]) => g.some((y) => p.toLowerCase().includes(y)))?.[1] || "text", x = n.settings.transforms.find(([g]) => g.some((y) => p.toLowerCase().includes(y)))?.[1] || ((g) => g), m = {
|
|
1896
|
-
type: "text",
|
|
1897
|
-
label: n.settings.labels.find(([g]) => g.some((y) => p.toLowerCase().includes(y)))?.[1] || "",
|
|
1898
|
-
...n.settings.addons.find(([g]) => g.some((y) => p.toLowerCase().includes(y)))?.[1] || {}
|
|
1899
|
-
};
|
|
1900
|
-
["min", "max", "step", "label", "type"].forEach((g) => {
|
|
1901
|
-
const y = d[`--${p}-${g}`];
|
|
1902
|
-
y && y.length && (m[g] = isNaN(parseFloat(y)) ? String(y).replace(/^['"]|['"]$/g, "") : String(parseFloat(y)));
|
|
1903
|
-
});
|
|
1904
|
-
let w = p.replace(/-(size|color|weight|width|height|gap|duration|radius|amount)$/g, "").replace(/-([a-z])/g, (g, y) => y.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))
|
|
1906
|
-
);
|
|
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`] = {
|
|
1908
|
-
type: "hidden",
|
|
1909
|
-
label: n.subgroupTemplate.replaceAll("{key}", s.string.capitalize(w))
|
|
1910
|
-
});
|
|
1911
|
-
let E = s.string.capitalize(
|
|
1912
|
-
p.replace(/-([a-z])/g, (g, y) => y.toUpperCase()).replace(/[A-Z]/g, " $&").toLowerCase()
|
|
1913
|
-
);
|
|
1914
|
-
v = x(v) ?? v;
|
|
1915
|
-
const S = (() => {
|
|
1916
|
-
const g = Object.entries(d).filter(([y]) => y.startsWith(`--${p}-options-`)).reduce(
|
|
1917
|
-
(y, [P, C]) => {
|
|
1918
|
-
const T = P.replace(`--${p}-options-`, "");
|
|
1919
|
-
return T && (y[String(C)] = s.string.capitalize(
|
|
1920
|
-
T.replace(/-([a-z])/g, (M, q) => q.toUpperCase()).replace(/[A-Z]/g, " $&").toLowerCase()
|
|
1921
|
-
)), y;
|
|
1922
|
-
},
|
|
1923
|
-
{}
|
|
1924
|
-
);
|
|
1925
|
-
return Object.keys(g).length ? g : null;
|
|
1926
|
-
})();
|
|
1927
|
-
return S && (b = "dropdown", m.options = S, v = String(v)), Object.entries(m).forEach(([g, y]) => {
|
|
1928
|
-
[!1, "inherit", "auto", null].includes(y) && (m[g] = v);
|
|
1929
|
-
}), c[p] = {
|
|
1930
|
-
type: m.type || b,
|
|
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;
|
|
1938
|
-
},
|
|
1939
|
-
{}
|
|
1940
|
-
), h = Object.entries(f).reduce(
|
|
1941
|
-
(c, [p, v]) => {
|
|
1942
|
-
const b = v?.label?.includes("undefined"), x = !["hidden", "button"].includes(v.type) && v.value === void 0;
|
|
1943
|
-
return (b || x) && (c[p] = v), c;
|
|
1944
|
-
},
|
|
1945
|
-
{}
|
|
1946
|
-
);
|
|
1947
|
-
if (Object.keys(h).length)
|
|
1948
|
-
throw R.logger.error("Simulation.fields: Detected errors in generated fields:", h), new Error("Error while processing fields");
|
|
1949
|
-
return f;
|
|
1950
|
-
}
|
|
1951
|
-
static async start() {
|
|
1952
|
-
const t = {
|
|
1953
|
-
fields: ["fields.json", "cf.json", "field.json", "customfields.json"].find((a) => {
|
|
1954
|
-
try {
|
|
1955
|
-
return new URL("./" + a, window.location.href), !0;
|
|
1956
|
-
} catch {
|
|
1957
|
-
return !1;
|
|
1958
|
-
}
|
|
1959
|
-
}),
|
|
1960
|
-
data: ["data.json", "fielddata.json", "fd.json", "DATA.json"].find((a) => {
|
|
1961
|
-
try {
|
|
1962
|
-
return new URL("./" + a, window.location.href), !0;
|
|
1963
|
-
} catch {
|
|
1964
|
-
return !1;
|
|
1965
|
-
}
|
|
1966
|
-
})
|
|
1967
|
-
}, e = await fetch("./" + (t.data ?? "data.json"), {
|
|
1968
|
-
cache: "no-store"
|
|
1969
|
-
}).then((a) => a.json()).catch(() => ({}));
|
|
1970
|
-
await fetch("./" + (t.fields ?? "fields.json"), {
|
|
1971
|
-
cache: "no-store"
|
|
1972
|
-
}).then((a) => a.json()).then(async (a) => {
|
|
1973
|
-
const n = Object.entries(a).filter(([d, { value: o }]) => o != null).reduce(
|
|
1974
|
-
(d, [o, { value: l }]) => (e && e[o] !== void 0 && (l = e[o]), d[o] = l, d),
|
|
1975
|
-
{
|
|
1976
|
-
...e
|
|
1977
|
-
}
|
|
1978
|
-
), i = await s.generate.event.onWidgetLoad(n, await s.generate.session.get());
|
|
1979
|
-
window.dispatchEvent(new CustomEvent("onWidgetLoad", { detail: i }));
|
|
1980
|
-
});
|
|
1981
|
-
}
|
|
1982
|
-
};
|
|
1983
|
-
s.data = {
|
|
1984
|
-
names: X,
|
|
1985
|
-
messages: Z,
|
|
1986
|
-
tiers: tt,
|
|
1987
|
-
avatars: J,
|
|
1988
|
-
items: _,
|
|
1989
|
-
emotes: Q,
|
|
1990
|
-
badges: K,
|
|
1991
|
-
pronouns: F,
|
|
1992
|
-
tts: Y
|
|
1993
|
-
}, s.color = {
|
|
1994
|
-
opacity(t = 100, e) {
|
|
1995
|
-
e = e.length > 7 ? e.substring(0, 6) : e, t = t > 1 ? t / 100 : t;
|
|
1996
|
-
let a = Math.round(Math.min(Math.max(t, 0), 1) * 255).toString(16).toLowerCase();
|
|
1997
|
-
return a = a.padStart(2, "0"), e + a;
|
|
1998
|
-
},
|
|
1999
|
-
getOpacity(t) {
|
|
2000
|
-
if (!t.startsWith("#") || t.length <= 7) return { opacity: 100, hex: t };
|
|
2001
|
-
var e = t.slice(-2), a = parseInt(e, 16) / 255, n = Math.round(a * 100), i = t.length > 7 ? t.slice(0, 7) : t;
|
|
2002
|
-
return { opacity: n, color: i };
|
|
2003
|
-
},
|
|
2004
|
-
validate(t) {
|
|
2005
|
-
if (typeof t != "string" || !t.length) return !1;
|
|
2006
|
-
const e = t.trim();
|
|
2007
|
-
return /^#([A-Fa-f0-9]{3}){1,2}$/.test(e) || /^#([A-Fa-f0-9]{4}|[A-Fa-f0-9]{8})$/.test(e) ? "hex" : /^rgb\(\s*(?:\d{1,3}\s*,\s*){2}\d{1,3}\s*\)$/.test(e) ? "rgb" : /^rgba\(\s*(?:\d{1,3}\s*,\s*){3}(?:0|1|0?\.\d+)\s*\)$/.test(e) ? "rgba" : /^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/.test(e) ? "hsl" : /^hsla\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*,\s*(?:0|1|0?\.\d+)\s*\)$/.test(e) ? "hsla" : [
|
|
1596
|
+
], Y = [], tt = ["1000", "2000", "3000", "prime"];
|
|
1597
|
+
var N;
|
|
1598
|
+
((e) => {
|
|
1599
|
+
((n) => {
|
|
1600
|
+
((t) => {
|
|
1601
|
+
t.hehim = "He/Him", t.sheher = "She/Her", t.theythem = "They/Them", t.shethem = "She/They", t.hethem = "He/They", t.heshe = "He/She", t.xexem = "Xe/Xem", t.faefaer = "Fae/Faer", t.vever = "Ve/Ver", t.aeaer = "Ae/Aer", t.ziehir = "Zie/Hir", t.perper = "Per/Per", t.eem = "E/Em", t.itits = "It/Its";
|
|
1602
|
+
})(n.map || (n.map = {}));
|
|
1603
|
+
})(e.Pronouns || (e.Pronouns = {}));
|
|
1604
|
+
})(N || (N = {}));
|
|
1605
|
+
var I;
|
|
1606
|
+
((e) => {
|
|
1607
|
+
e.data = {
|
|
1608
|
+
names: Z,
|
|
1609
|
+
messages: Q,
|
|
1610
|
+
tiers: tt,
|
|
1611
|
+
avatars: J,
|
|
1612
|
+
emotes: V,
|
|
1613
|
+
badges: K,
|
|
1614
|
+
items: Y,
|
|
1615
|
+
tts: X,
|
|
1616
|
+
pronouns: N.Pronouns.map,
|
|
1617
|
+
css_color_names: [
|
|
2008
1618
|
"aliceblue",
|
|
2009
1619
|
"antiquewhite",
|
|
2010
1620
|
"aqua",
|
|
@@ -2154,1505 +1764,1640 @@ s.data = {
|
|
|
2154
1764
|
"yellow",
|
|
2155
1765
|
"yellowgreen",
|
|
2156
1766
|
"transparent"
|
|
2157
|
-
]
|
|
2158
|
-
}
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
"azure",
|
|
2192
|
-
"beige",
|
|
2193
|
-
"bisque",
|
|
2194
|
-
"black",
|
|
2195
|
-
"blanchedalmond",
|
|
2196
|
-
"blue",
|
|
2197
|
-
"blueviolet",
|
|
2198
|
-
"brown",
|
|
2199
|
-
"burlywood",
|
|
2200
|
-
"cadetblue",
|
|
2201
|
-
"chartreuse",
|
|
2202
|
-
"chocolate",
|
|
2203
|
-
"coral",
|
|
2204
|
-
"cornflowerblue",
|
|
2205
|
-
"cornsilk",
|
|
2206
|
-
"crimson",
|
|
2207
|
-
"cyan",
|
|
2208
|
-
"darkblue",
|
|
2209
|
-
"darkcyan",
|
|
2210
|
-
"darkgoldenrod",
|
|
2211
|
-
"darkgray",
|
|
2212
|
-
"darkgreen",
|
|
2213
|
-
"darkgrey",
|
|
2214
|
-
"darkkhaki",
|
|
2215
|
-
"darkmagenta",
|
|
2216
|
-
"darkolivegreen",
|
|
2217
|
-
"darkorange",
|
|
2218
|
-
"darkorchid",
|
|
2219
|
-
"darkred",
|
|
2220
|
-
"darksalmon",
|
|
2221
|
-
"darkseagreen",
|
|
2222
|
-
"darkslateblue",
|
|
2223
|
-
"darkslategray",
|
|
2224
|
-
"darkslategrey",
|
|
2225
|
-
"darkturquoise",
|
|
2226
|
-
"darkviolet",
|
|
2227
|
-
"deeppink",
|
|
2228
|
-
"deepskyblue",
|
|
2229
|
-
"dimgray",
|
|
2230
|
-
"dimgrey",
|
|
2231
|
-
"dodgerblue",
|
|
2232
|
-
"firebrick",
|
|
2233
|
-
"floralwhite",
|
|
2234
|
-
"forestgreen",
|
|
2235
|
-
"fuchsia",
|
|
2236
|
-
"gainsboro",
|
|
2237
|
-
"ghostwhite",
|
|
2238
|
-
"gold",
|
|
2239
|
-
"goldenrod",
|
|
2240
|
-
"gray",
|
|
2241
|
-
"green",
|
|
2242
|
-
"greenyellow",
|
|
2243
|
-
"grey",
|
|
2244
|
-
"honeydew",
|
|
2245
|
-
"hotpink",
|
|
2246
|
-
"indianred",
|
|
2247
|
-
"indigo",
|
|
2248
|
-
"ivory",
|
|
2249
|
-
"khaki",
|
|
2250
|
-
"lavender",
|
|
2251
|
-
"lavenderblush",
|
|
2252
|
-
"lawngreen",
|
|
2253
|
-
"lemonchiffon",
|
|
2254
|
-
"lightblue",
|
|
2255
|
-
"lightcoral",
|
|
2256
|
-
"lightcyan",
|
|
2257
|
-
"lightgoldenrodyellow",
|
|
2258
|
-
"lightgray",
|
|
2259
|
-
"lightgreen",
|
|
2260
|
-
"lightgrey",
|
|
2261
|
-
"lightpink",
|
|
2262
|
-
"lightsalmon",
|
|
2263
|
-
"lightseagreen",
|
|
2264
|
-
"lightskyblue",
|
|
2265
|
-
"lightslategray",
|
|
2266
|
-
"lightslategrey",
|
|
2267
|
-
"lightsteelblue",
|
|
2268
|
-
"lightyellow",
|
|
2269
|
-
"lime",
|
|
2270
|
-
"limegreen",
|
|
2271
|
-
"linen",
|
|
2272
|
-
"magenta",
|
|
2273
|
-
"maroon",
|
|
2274
|
-
"mediumaquamarine",
|
|
2275
|
-
"mediumblue",
|
|
2276
|
-
"mediumorchid",
|
|
2277
|
-
"mediumpurple",
|
|
2278
|
-
"mediumseagreen",
|
|
2279
|
-
"mediumslateblue",
|
|
2280
|
-
"mediumspringgreen",
|
|
2281
|
-
"mediumturquoise",
|
|
2282
|
-
"mediumvioletred",
|
|
2283
|
-
"midnightblue",
|
|
2284
|
-
"mintcream",
|
|
2285
|
-
"mistyrose",
|
|
2286
|
-
"moccasin",
|
|
2287
|
-
"navajowhite",
|
|
2288
|
-
"navy",
|
|
2289
|
-
"oldlace",
|
|
2290
|
-
"olive",
|
|
2291
|
-
"olivedrab",
|
|
2292
|
-
"orange",
|
|
2293
|
-
"orangered",
|
|
2294
|
-
"orchid",
|
|
2295
|
-
"palegoldenrod",
|
|
2296
|
-
"palegreen",
|
|
2297
|
-
"paleturquoise",
|
|
2298
|
-
"palevioletred",
|
|
2299
|
-
"papayawhip",
|
|
2300
|
-
"peachpuff",
|
|
2301
|
-
"peru",
|
|
2302
|
-
"pink",
|
|
2303
|
-
"plum",
|
|
2304
|
-
"powderblue",
|
|
2305
|
-
"purple",
|
|
2306
|
-
"rebeccapurple",
|
|
2307
|
-
"red",
|
|
2308
|
-
"rosybrown",
|
|
2309
|
-
"royalblue",
|
|
2310
|
-
"saddlebrown",
|
|
2311
|
-
"salmon",
|
|
2312
|
-
"sandybrown",
|
|
2313
|
-
"seagreen",
|
|
2314
|
-
"seashell",
|
|
2315
|
-
"sienna",
|
|
2316
|
-
"silver",
|
|
2317
|
-
"skyblue",
|
|
2318
|
-
"slateblue",
|
|
2319
|
-
"slategray",
|
|
2320
|
-
"slategrey",
|
|
2321
|
-
"snow",
|
|
2322
|
-
"springgreen",
|
|
2323
|
-
"steelblue",
|
|
2324
|
-
"tan",
|
|
2325
|
-
"teal",
|
|
2326
|
-
"thistle",
|
|
2327
|
-
"tomato",
|
|
2328
|
-
"turquoise",
|
|
2329
|
-
"violet",
|
|
2330
|
-
"wheat",
|
|
2331
|
-
"white",
|
|
2332
|
-
"whitesmoke",
|
|
2333
|
-
"yellow",
|
|
2334
|
-
"yellowgreen",
|
|
2335
|
-
"transparent"
|
|
2336
|
-
];
|
|
2337
|
-
return this.array(e)[0];
|
|
2338
|
-
}
|
|
1767
|
+
]
|
|
1768
|
+
}, e.color = {
|
|
1769
|
+
/**
|
|
1770
|
+
* Generate opacity hex value
|
|
1771
|
+
* @param opacity - Opacity value from 0 to 100
|
|
1772
|
+
* @param color - Hex color code
|
|
1773
|
+
* @returns - Hex color code with opacity
|
|
1774
|
+
*/
|
|
1775
|
+
opacity(t = 100, i = "") {
|
|
1776
|
+
i = i.length > 7 ? i?.substring(0, 6) : i, t = t > 1 ? t / 100 : t;
|
|
1777
|
+
let a = Math.round(Math.min(Math.max(t, 0), 1) * 255).toString(16).toLowerCase().padStart(2, "0");
|
|
1778
|
+
return i + a;
|
|
1779
|
+
},
|
|
1780
|
+
/**
|
|
1781
|
+
* Extract color and opacity from hex code
|
|
1782
|
+
* @param hex - Hex color code
|
|
1783
|
+
* @returns - Object with color and opacity
|
|
1784
|
+
*/
|
|
1785
|
+
extract(t) {
|
|
1786
|
+
if (!t.startsWith("#") || t.length <= 7)
|
|
1787
|
+
return {
|
|
1788
|
+
color: t,
|
|
1789
|
+
opacity: 100
|
|
1790
|
+
};
|
|
1791
|
+
var s = t.slice(-2), i = parseInt(s, 16) / 255, a = Math.round(i * 100), s = t.length > 7 ? t.slice(0, 7) : t;
|
|
1792
|
+
return {
|
|
1793
|
+
color: s,
|
|
1794
|
+
opacity: a
|
|
1795
|
+
};
|
|
1796
|
+
},
|
|
1797
|
+
validate(t) {
|
|
1798
|
+
if (typeof t != "string" || !String(t).trim().length) return !1;
|
|
1799
|
+
const i = t.trim();
|
|
1800
|
+
return /^#([A-Fa-f0-9]{3}){1,2}$/.test(i) || /^#([A-Fa-f0-9]{4}|[A-Fa-f0-9]{8})$/.test(i) ? "hex" : /^rgb\(\s*(?:\d{1,3}\s*,\s*){2}\d{1,3}\s*\)$/.test(i) ? "rgb" : /^rgba\(\s*(?:\d{1,3}\s*,\s*){3}(?:0|1|0?\.\d+)\s*\)$/.test(i) ? "rgba" : /^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/.test(i) ? "hsl" : /^hsla\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*,\s*(?:0|1|0?\.\d+)\s*\)$/.test(i) ? "hsla" : e.data.css_color_names.includes(i.toLowerCase()) ? "css-color-name" : !1;
|
|
2339
1801
|
}
|
|
2340
|
-
},
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
},
|
|
2363
|
-
uuid() {
|
|
2364
|
-
return window.crypto && typeof crypto?.randomUUID == "function" ? crypto.randomUUID() : "10000000-1000-4000-8000-100000000000".replace(
|
|
2365
|
-
/[018]/g,
|
|
2366
|
-
(t) => (+t ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +t / 4).toString(16)
|
|
2367
|
-
);
|
|
2368
|
-
}
|
|
2369
|
-
}, s.string = {
|
|
2370
|
-
/**
|
|
2371
|
-
* Replaces occurrences in a string based on a pattern with the result of an asynchronous callback function.
|
|
2372
|
-
* @param string - The input string to perform replacements on.
|
|
2373
|
-
* @param pattern - The pattern to match in the string (can be a string or a regular expression).
|
|
2374
|
-
* @param callback - An asynchronous callback function that takes the matched substring and any captured groups as arguments and returns the replacement string.
|
|
2375
|
-
* @returns A promise that resolves to the modified string with replacements applied.
|
|
2376
|
-
* @example
|
|
2377
|
-
* ```javascript
|
|
2378
|
-
* const result = await Simulation.string.replace("Hello World", /World/, async (match) => {
|
|
2379
|
-
* return await fetchSomeData(match); // Assume this function fetches data asynchronously
|
|
2380
|
-
* });
|
|
2381
|
-
* console.log(result); // Output will depend on the fetched data
|
|
2382
|
-
* ```
|
|
2383
|
-
*/
|
|
2384
|
-
async replace(t, e, a) {
|
|
2385
|
-
const n = [];
|
|
2386
|
-
t.replace(e, (d, ...o) => {
|
|
2387
|
-
const l = typeof a == "function" ? a(d, ...o) : d;
|
|
2388
|
-
return n.push(Promise.resolve(l)), d;
|
|
2389
|
-
});
|
|
2390
|
-
const i = await Promise.all(n);
|
|
2391
|
-
return t.replace(e, () => i.shift() ?? "");
|
|
2392
|
-
},
|
|
2393
|
-
/**
|
|
2394
|
-
* Capitalizes the first letter of a given string.
|
|
2395
|
-
* @param string - The input string to be capitalized.
|
|
2396
|
-
* @returns The capitalized string.
|
|
2397
|
-
* @example
|
|
2398
|
-
* ```javascript
|
|
2399
|
-
* const result = Simulation.string.capitalize("hello world");
|
|
2400
|
-
* console.log(result); // Output: "Hello world"
|
|
2401
|
-
* ```
|
|
2402
|
-
*/
|
|
2403
|
-
capitalize(t) {
|
|
2404
|
-
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
2405
|
-
},
|
|
2406
|
-
/**
|
|
2407
|
-
* Composes a template string by replacing placeholders with corresponding values and applying optional modifiers.
|
|
2408
|
-
* @param template - The template string containing placeholders in the format {key} and optional modifiers in the format [MODIFIER:param=value].
|
|
2409
|
-
* @param values - An object containing key-value pairs to replace the placeholders in the template.
|
|
2410
|
-
* @param options - Optional settings for the composition process.
|
|
2411
|
-
* @returns The composed string with placeholders replaced and modifiers applied.
|
|
2412
|
-
* @example
|
|
2413
|
-
* ```javascript
|
|
2414
|
-
* const template = "Hello, {username}! You have {amount} [UPPERCASE=messages] and your name is [CAPITALIZE=name].";
|
|
2415
|
-
* const values = { username: "john_doe", amount: 5, name: "john" };
|
|
2416
|
-
* const result = Simulation.string.compose(template, values);
|
|
2417
|
-
* console.log(result); // Output: "Hello, john_doe! You have 5 MESSAGES and your name is John."
|
|
2418
|
-
* ```
|
|
2419
|
-
*/
|
|
2420
|
-
compose(t, e = {}, a = {
|
|
2421
|
-
method: "index",
|
|
2422
|
-
html: !1,
|
|
2423
|
-
modifiers: {},
|
|
2424
|
-
aliases: {}
|
|
2425
|
-
}) {
|
|
2426
|
-
const { mergeSpanStyles: n } = s.element;
|
|
2427
|
-
e.skip = "<br/>", e.newline = "<br/>";
|
|
2428
|
-
const i = Object.entries(s.object.flatten(e)).reduce(
|
|
2429
|
-
(r, [m, w]) => {
|
|
2430
|
-
if (r[m] = String(w), ["username", "name", "nick", "nickname", "sender"].some((k) => m === k)) {
|
|
2431
|
-
const k = r?.username || r?.name || r?.nick || r?.nickname || r?.sender;
|
|
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}`;
|
|
1802
|
+
}, e.rand = {
|
|
1803
|
+
/**
|
|
1804
|
+
* Generate random color
|
|
1805
|
+
* @param type - Color format
|
|
1806
|
+
* @returns - Random color in specified format
|
|
1807
|
+
* @example
|
|
1808
|
+
* ```javascript
|
|
1809
|
+
* const hexColor = Simulation.rand.color('hex');
|
|
1810
|
+
* console.log(hexColor); // e.g. #3e92cc
|
|
1811
|
+
*
|
|
1812
|
+
* const rgbColor = Simulation.rand.color('rgb');
|
|
1813
|
+
* console.log(rgbColor); // e.g. rgb(62, 146, 204)
|
|
1814
|
+
* ```
|
|
1815
|
+
*/
|
|
1816
|
+
color(t = "hex") {
|
|
1817
|
+
switch (t) {
|
|
1818
|
+
default:
|
|
1819
|
+
case "hex":
|
|
1820
|
+
return `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")}`;
|
|
1821
|
+
case "hexa": {
|
|
1822
|
+
const a = `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")}`, s = Math.floor(Math.random() * 256).toString(16).padStart(2, "0");
|
|
1823
|
+
return a + s;
|
|
2433
1824
|
}
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
LARGER: (r) => n("font-size: larger", r),
|
|
2454
|
-
SMALL: (r) => n("font-size: smaller", r),
|
|
2455
|
-
SHADOW: (r, m) => n(`text-shadow: ${m}`, r),
|
|
2456
|
-
SIZE: (r, m) => n(m ? `font-size: ${m}` : "", r)
|
|
2457
|
-
}, h = {
|
|
2458
|
-
...{
|
|
2459
|
-
BT1: (r) => o > 1 ? r : "",
|
|
2460
|
-
BT0: (r) => o > 0 ? r : "",
|
|
2461
|
-
ST1: (r) => o < 1 ? r : "",
|
|
2462
|
-
ST0: (r) => o < 0 ? r : "",
|
|
2463
|
-
UPC: (r) => r.toUpperCase(),
|
|
2464
|
-
LOW: (r) => r.toLowerCase(),
|
|
2465
|
-
REV: (r) => r.split("").reverse().join(""),
|
|
2466
|
-
CAP: (r) => r.charAt(0).toUpperCase() + r.slice(1).toLowerCase(),
|
|
2467
|
-
FALLBACK: (r, m) => r.length ? r : m ?? r
|
|
2468
|
-
},
|
|
2469
|
-
...a?.html ? l : {},
|
|
2470
|
-
...a.modifiers ?? {}
|
|
2471
|
-
}, c = {
|
|
2472
|
-
UPC: ["UPPERCASE", "UPPER", "UPP"],
|
|
2473
|
-
LOW: ["LOWERCASE", "LOWER", "LWC"],
|
|
2474
|
-
REV: ["REVERSE", "RVS"],
|
|
2475
|
-
CAP: ["CAPITALIZE", "CAPITAL"],
|
|
2476
|
-
BT1: ["BIGGER_THAN_1", "GREATER_THAN_1", "GT1"],
|
|
2477
|
-
BT0: ["BIGGER_THAN_0", "GREATER_THAN_0", "GT0"],
|
|
2478
|
-
ST1: ["SMALLER_THAN_1", "LESS_THAN_1", "LT1"],
|
|
2479
|
-
ST0: ["SMALLER_THAN_0", "LESS_THAN_0", "LT0"],
|
|
2480
|
-
COLOR: ["COLOUR", "CLR", "HIGHLIGHT"],
|
|
2481
|
-
BOLD: ["BOLDEN", "B"],
|
|
2482
|
-
STRONG: ["STRONGEN", "STRONG"],
|
|
2483
|
-
ITALIC: ["ITALICIZE", "ITALIC", "I"],
|
|
2484
|
-
UNDERLINE: ["U", "INS", "INSET", "I"],
|
|
2485
|
-
STRIKETHROUGH: ["STRIKE", "S", "DELETE", "D"],
|
|
2486
|
-
SUB: ["SUBSCRIPT", "SUBS"],
|
|
2487
|
-
SUP: ["SUPERSCRIPT", "SUPS"],
|
|
2488
|
-
LARGER: ["LARGER", "LG"],
|
|
2489
|
-
SMALL: ["SMALLER", "SM"],
|
|
2490
|
-
SHADOW: ["SHADOW", "SHD"],
|
|
2491
|
-
FALLBACK: ["FALLBACK", "FB"],
|
|
2492
|
-
...a.aliases ?? {}
|
|
2493
|
-
};
|
|
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();
|
|
2496
|
-
return h[E] ? h[E](r, typeof w == "string" ? w.trim() : null, i) : r;
|
|
2497
|
-
}
|
|
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;
|
|
2503
|
-
}
|
|
2504
|
-
return m;
|
|
2505
|
-
}
|
|
2506
|
-
function b(r) {
|
|
2507
|
-
let m = 0;
|
|
2508
|
-
const w = r.length;
|
|
2509
|
-
function k(j) {
|
|
2510
|
-
let S = "";
|
|
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 !== "["))
|
|
2515
|
-
S += E();
|
|
2516
|
-
else if (j && r[m] === j) {
|
|
2517
|
-
m++;
|
|
2518
|
-
break;
|
|
2519
|
-
} else
|
|
2520
|
-
S += r[m++];
|
|
2521
|
-
return S;
|
|
2522
|
-
}
|
|
2523
|
-
function E() {
|
|
2524
|
-
m++;
|
|
2525
|
-
let j = "";
|
|
2526
|
-
for (; m < w && /[A-Za-z0-9]/.test(r[m]); ) j += r[m++];
|
|
2527
|
-
let S = null;
|
|
2528
|
-
if (r[m] === ":") {
|
|
2529
|
-
m++;
|
|
2530
|
-
const y = m;
|
|
2531
|
-
for (; m < w && r[m] !== "="; ) m++;
|
|
2532
|
-
S = r.slice(y, m);
|
|
1825
|
+
case "rgb": {
|
|
1826
|
+
const a = Math.floor(Math.random() * 256), s = Math.floor(Math.random() * 256), d = Math.floor(Math.random() * 256);
|
|
1827
|
+
return `rgb(${a}, ${s}, ${d})`;
|
|
1828
|
+
}
|
|
1829
|
+
case "rgba": {
|
|
1830
|
+
const a = Math.floor(Math.random() * 256), s = Math.floor(Math.random() * 256), d = Math.floor(Math.random() * 256), o = Math.random().toFixed(2);
|
|
1831
|
+
return `rgba(${a}, ${s}, ${d}, ${o})`;
|
|
1832
|
+
}
|
|
1833
|
+
case "hsl": {
|
|
1834
|
+
const a = Math.floor(Math.random() * 361), s = Math.floor(Math.random() * 101), d = Math.floor(Math.random() * 101);
|
|
1835
|
+
return `hsl(${a}, ${s}%, ${d}%)`;
|
|
1836
|
+
}
|
|
1837
|
+
case "hsla": {
|
|
1838
|
+
const a = Math.floor(Math.random() * 361), s = Math.floor(Math.random() * 101), d = Math.floor(Math.random() * 101), o = Math.random().toFixed(2);
|
|
1839
|
+
return `hsla(${a}, ${s}%, ${d}%, ${o})`;
|
|
1840
|
+
}
|
|
1841
|
+
case "css-color-name": {
|
|
1842
|
+
var i = e.data.css_color_names;
|
|
1843
|
+
return this.array(i)[0];
|
|
2533
1844
|
}
|
|
2534
|
-
r[m] === "=" && m++;
|
|
2535
|
-
const g = k("]");
|
|
2536
|
-
return p(g, j, S);
|
|
2537
|
-
}
|
|
2538
|
-
return k();
|
|
2539
|
-
}
|
|
2540
|
-
let x = t.replace(
|
|
2541
|
-
d.PLACEHOLDERS,
|
|
2542
|
-
(r, m) => typeof i[m] == "string" || typeof i[m] == "number" ? String(i[m]) : m ?? m
|
|
2543
|
-
);
|
|
2544
|
-
return x = a.method === "loop" ? v(x) : b(x), x;
|
|
2545
|
-
}
|
|
2546
|
-
}, s.element = {
|
|
2547
|
-
/**
|
|
2548
|
-
* Merges outer span styles with inner span styles in the provided HTML string.
|
|
2549
|
-
* @param outerStyle - The style string to be applied to the outer span.
|
|
2550
|
-
* @param innerHTML - The inner HTML string which may contain a span with its own styles.
|
|
2551
|
-
* @returns A new HTML string with merged styles applied to a single span.
|
|
2552
|
-
* @example
|
|
2553
|
-
* ```javascript
|
|
2554
|
-
* const result = Simulation.element.mergeSpanStyles("color: red; font-weight: bold;", '<span style="font-size: 14px;">Hello World</span>');
|
|
2555
|
-
* console.log(result); // Output: '<span style="font-size: 14px; color: red; font-weight: bold;">Hello World</span>'
|
|
2556
|
-
* ```
|
|
2557
|
-
*/
|
|
2558
|
-
mergeSpanStyles(t, e) {
|
|
2559
|
-
const a = e.match(/^<span style="([^"]*)">(.*)<\/span>$/s);
|
|
2560
|
-
if (a) {
|
|
2561
|
-
const n = a[1], i = a[2];
|
|
2562
|
-
return `<span style="${[n, t].filter(Boolean).join("; ").replace(/\s*;\s*/g, "; ").trim()}">${i}</span>`;
|
|
2563
|
-
} else
|
|
2564
|
-
return `<span style="${t}">${e}</span>`;
|
|
2565
|
-
},
|
|
2566
|
-
/**
|
|
2567
|
-
* Scales an HTML element to fit within its parent element based on specified minimum and maximum scale factors.
|
|
2568
|
-
* @param element - The HTML element to be scaled.
|
|
2569
|
-
* @param min - Minimum scale factor (default is 0).
|
|
2570
|
-
* @param max - Maximum scale factor (default is 1).
|
|
2571
|
-
* @param options - Optional settings for scaling.
|
|
2572
|
-
* @returns - An object containing the new width, height, and scale factor, or void if not applied.
|
|
2573
|
-
* @example
|
|
2574
|
-
* ```javascript
|
|
2575
|
-
* const element = document.getElementById('myElement');
|
|
2576
|
-
* Simulation.element.scale(element, 0.5, 1, { return: false });
|
|
2577
|
-
* ```
|
|
2578
|
-
*/
|
|
2579
|
-
scale(t, e = 0, a = 1, n) {
|
|
2580
|
-
const { return: i = !1, parent: d, base: o } = n || {}, l = d || t.parentElement || document.body;
|
|
2581
|
-
if (!l) {
|
|
2582
|
-
R.logger.warn("No parent element found for scaling");
|
|
2583
|
-
return;
|
|
2584
|
-
}
|
|
2585
|
-
const f = l.getBoundingClientRect(), h = t.offsetWidth, c = t.offsetHeight;
|
|
2586
|
-
if (h === 0 || c === 0) {
|
|
2587
|
-
R.logger.warn("Element has zero width or height, cannot scale");
|
|
2588
|
-
return;
|
|
2589
|
-
}
|
|
2590
|
-
const p = f.width * a / h, v = f.height * a / c;
|
|
2591
|
-
let b = o === "width" ? p : o === "height" ? v : Math.min(p, v);
|
|
2592
|
-
if (e > 0) {
|
|
2593
|
-
const r = f.width * e / h, m = f.height * e / c, w = Math.max(r, m);
|
|
2594
|
-
b = Math.max(w, b);
|
|
2595
|
-
}
|
|
2596
|
-
const x = {
|
|
2597
|
-
width: h * b,
|
|
2598
|
-
height: c * b,
|
|
2599
|
-
scale: b
|
|
2600
|
-
};
|
|
2601
|
-
return i || (t.style.transform = `scale(${b})`, t.style.transformOrigin = "center center"), x;
|
|
2602
|
-
},
|
|
2603
|
-
/**
|
|
2604
|
-
* Splits the text content of an HTML string into individual characters wrapped in span elements with a data-index attribute.
|
|
2605
|
-
* @param htmlString - The input HTML string to be processed.
|
|
2606
|
-
* @param startIndex - The starting index for the data-index attribute (default is 0).
|
|
2607
|
-
* @returns - A new HTML string with each character wrapped in a span element.
|
|
2608
|
-
* @example
|
|
2609
|
-
* ```javascript
|
|
2610
|
-
* const result = Simulation.element.splitTextToChars("<p>Hello</p>", 0);
|
|
2611
|
-
* console.log(result);
|
|
2612
|
-
* // Output: '<p><span class="char" data-index="0">H</span><span class="char" data-index="1">e</span><span class="char" data-index="2">l</span><span class="char" data-index="3">l</span><span class="char" data-index="4">o</span></p>'
|
|
2613
|
-
* ```
|
|
2614
|
-
*/
|
|
2615
|
-
splitTextToChars(t, e = 0) {
|
|
2616
|
-
const n = new DOMParser().parseFromString(t, "text/html");
|
|
2617
|
-
let i = e;
|
|
2618
|
-
function d(f) {
|
|
2619
|
-
if (f.nodeType === Node.TEXT_NODE) {
|
|
2620
|
-
const c = f.textContent?.split("").map((v) => {
|
|
2621
|
-
const b = document.createElement("span");
|
|
2622
|
-
return b.className = "char", b.dataset.index = String(i++), b.textContent = v, i++, b.outerHTML;
|
|
2623
|
-
}), p = document.createElement("span");
|
|
2624
|
-
return p.innerHTML = c?.join("") ?? "", p;
|
|
2625
|
-
} else if (f.nodeType === Node.ELEMENT_NODE) {
|
|
2626
|
-
const h = f.cloneNode(!1);
|
|
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);
|
|
2631
|
-
});
|
|
2632
|
-
}), h;
|
|
2633
|
-
}
|
|
2634
|
-
return f.cloneNode(!0);
|
|
2635
|
-
}
|
|
2636
|
-
const o = n.body, l = document.createElement("div");
|
|
2637
|
-
return o.childNodes.forEach((f) => {
|
|
2638
|
-
const h = d(f);
|
|
2639
|
-
h instanceof Node && l.appendChild(h);
|
|
2640
|
-
}), l.innerHTML;
|
|
2641
|
-
}
|
|
2642
|
-
}, s.object = {
|
|
2643
|
-
/**
|
|
2644
|
-
* Flattens a nested object into a single-level object with dot-separated keys.
|
|
2645
|
-
* @param obj - The nested object to be flattened.
|
|
2646
|
-
* @param prefix - The prefix to be added to each key (used for recursion).
|
|
2647
|
-
* @returns A flattened object with dot-separated keys.
|
|
2648
|
-
* @example
|
|
2649
|
-
* ```javascript
|
|
2650
|
-
* const nestedObj = { a: { b: 1, c: { d: 2 } }, e: [3, 4] };
|
|
2651
|
-
* const flatObj = Simulation.object.flatten(nestedObj);
|
|
2652
|
-
* console.log(flatObj);
|
|
2653
|
-
* // Output: { 'a.b': '1', 'a.c.d': '2', 'e:0': '3', 'e:1': '4' }
|
|
2654
|
-
* ```
|
|
2655
|
-
*/
|
|
2656
|
-
flatten(t, e = "") {
|
|
2657
|
-
const a = {};
|
|
2658
|
-
for (const n in t) {
|
|
2659
|
-
if (!Object.prototype.hasOwnProperty.call(t, n)) continue;
|
|
2660
|
-
const i = t[n], d = e ? `${e}.${n}` : n;
|
|
2661
|
-
if (i == null) {
|
|
2662
|
-
a[d] = String(i);
|
|
2663
|
-
continue;
|
|
2664
|
-
}
|
|
2665
|
-
if (i instanceof Date) {
|
|
2666
|
-
a[d] = i.toISOString();
|
|
2667
|
-
continue;
|
|
2668
1845
|
}
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
1846
|
+
},
|
|
1847
|
+
/**
|
|
1848
|
+
* Generate random number
|
|
1849
|
+
* @param min - Minimum value
|
|
1850
|
+
* @param max - Maximum value
|
|
1851
|
+
* @param float - Number of decimal places (0 for integer)
|
|
1852
|
+
* @returns - Random number
|
|
1853
|
+
* @example
|
|
1854
|
+
* ```javascript
|
|
1855
|
+
* const intNumber = Simulation.rand.number(1, 10);
|
|
1856
|
+
* console.log(intNumber); // e.g. 7
|
|
1857
|
+
*
|
|
1858
|
+
* const floatNumber = Simulation.rand.number(1, 10, 2);
|
|
1859
|
+
* console.log(floatNumber); // e.g. 3.14
|
|
1860
|
+
* ```
|
|
1861
|
+
*/
|
|
1862
|
+
number(t, i, a = 0) {
|
|
1863
|
+
t > i && ([t, i] = [i, t]);
|
|
1864
|
+
const s = Math.random() * (i - t) + t;
|
|
1865
|
+
return a ? Number(s.toFixed(a)) : Math.round(s);
|
|
1866
|
+
},
|
|
1867
|
+
/**
|
|
1868
|
+
* Generate random boolean
|
|
1869
|
+
* @param threshold - Threshold between 0 and 1
|
|
1870
|
+
* @returns - Random boolean
|
|
1871
|
+
* @example
|
|
1872
|
+
* ```javascript
|
|
1873
|
+
* const boolValue = Simulation.rand.boolean(0.7);
|
|
1874
|
+
* console.log(boolValue); // e.g. true (70% chance)
|
|
1875
|
+
* ```
|
|
1876
|
+
*/
|
|
1877
|
+
boolean(t = 0.5) {
|
|
1878
|
+
return Math.random() > t;
|
|
1879
|
+
},
|
|
1880
|
+
/**
|
|
1881
|
+
* Generate random string
|
|
1882
|
+
* @param length - Length of the string
|
|
1883
|
+
* @param chars - Characters to use
|
|
1884
|
+
* @returns - Random string
|
|
1885
|
+
* @example
|
|
1886
|
+
* ```javascript
|
|
1887
|
+
* const randString = Simulation.rand.string(10);
|
|
1888
|
+
* console.log(randString); // e.g. "aZ3bT9xYqP"
|
|
1889
|
+
* ```
|
|
1890
|
+
*/
|
|
1891
|
+
string(t, i = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") {
|
|
1892
|
+
let a = "";
|
|
1893
|
+
for (let s = 0; s < t; s++)
|
|
1894
|
+
a += i.charAt(Math.floor(Math.random() * i.length));
|
|
1895
|
+
return a;
|
|
1896
|
+
},
|
|
1897
|
+
/**
|
|
1898
|
+
* Pick random element from array
|
|
1899
|
+
* @param arr - Array to pick from
|
|
1900
|
+
* @returns - Random element and its index
|
|
1901
|
+
* @example
|
|
1902
|
+
* ```javascript
|
|
1903
|
+
* const [element, index] = Simulation.rand.array(['apple', 'banana', 'cherry']);
|
|
1904
|
+
* console.log(element, index); // e.g. "banana", 1
|
|
1905
|
+
* ```
|
|
1906
|
+
*/
|
|
1907
|
+
array(t) {
|
|
1908
|
+
const i = this.number(0, t.length - 1);
|
|
1909
|
+
return [t[i], i];
|
|
1910
|
+
},
|
|
1911
|
+
/**
|
|
1912
|
+
* Generate random date
|
|
1913
|
+
* @param start - Start date
|
|
1914
|
+
* @param end - End date
|
|
1915
|
+
* @returns - Random date between start and end
|
|
1916
|
+
* @example
|
|
1917
|
+
* ```javascript
|
|
1918
|
+
* const randDate = Simulation.rand.date(new Date(2020, 0, 1), new Date());
|
|
1919
|
+
* console.log(randDate); // e.g. 2022-05-15T10:30:00.000Z
|
|
1920
|
+
* ```
|
|
1921
|
+
*/
|
|
1922
|
+
date(t = new Date(2e3, 0, 1), i = /* @__PURE__ */ new Date()) {
|
|
1923
|
+
return new Date(this.number(t.getTime(), i.getTime()));
|
|
1924
|
+
},
|
|
1925
|
+
/**
|
|
1926
|
+
* Generate ISO date string offset by days
|
|
1927
|
+
* @param daysAgo - Number of days to go back
|
|
1928
|
+
* @returns - ISO date string
|
|
1929
|
+
* @example
|
|
1930
|
+
* ```javascript
|
|
1931
|
+
* const isoDate = Simulation.rand.daysOffset(7);
|
|
1932
|
+
* console.log(isoDate); // e.g. "2024-06-10T14:23:45.678Z"
|
|
1933
|
+
*
|
|
1934
|
+
* const isoDate30 = Simulation.rand.daysOffset(30);
|
|
1935
|
+
* console.log(isoDate30); // e.g. "2024-05-18T09:15:30.123Z"
|
|
1936
|
+
* ```
|
|
1937
|
+
*/
|
|
1938
|
+
daysOffset(t) {
|
|
1939
|
+
const a = Date.now() - this.number(0, t * 24 * 60 * 60 * 1e3);
|
|
1940
|
+
return new Date(a).toISOString();
|
|
1941
|
+
},
|
|
1942
|
+
/**
|
|
1943
|
+
* Generate UUID v4
|
|
1944
|
+
* @returns - UUID string
|
|
1945
|
+
* @example
|
|
1946
|
+
* ```javascript
|
|
1947
|
+
* const uuid = Simulation.rand.uuid();
|
|
1948
|
+
* console.log(uuid); // e.g. "3b12f1df-5232-4e3a-9a0c-3f9f1b1b1b1b"
|
|
1949
|
+
* ```
|
|
1950
|
+
*/
|
|
1951
|
+
uuid() {
|
|
1952
|
+
return window.crypto && typeof crypto?.randomUUID == "function" ? crypto.randomUUID() : "10000000-1000-4000-8000-100000000000".replace(
|
|
1953
|
+
/[018]/g,
|
|
1954
|
+
(t) => (+t ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +t / 4).toString(16)
|
|
1955
|
+
);
|
|
2687
1956
|
}
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
value: {
|
|
2753
|
-
name: t.name,
|
|
2754
|
-
amount: { type: "int", min: 10, max: 30 },
|
|
2755
|
-
tier: t.tier,
|
|
2756
|
-
createdAt: { type: "date", range: 400 }
|
|
2757
|
-
}
|
|
2758
|
-
}
|
|
2759
|
-
},
|
|
2760
|
-
host: {
|
|
2761
|
-
latest: { name: t.name, amount: { type: "int", min: 1, max: 10 } },
|
|
2762
|
-
recent: {
|
|
2763
|
-
type: "recent",
|
|
2764
|
-
amount: 25,
|
|
2765
|
-
value: {
|
|
2766
|
-
name: t.name,
|
|
2767
|
-
amount: { type: "int", min: 1, max: 10 },
|
|
2768
|
-
createdAt: { type: "date", range: 400 }
|
|
2769
|
-
}
|
|
2770
|
-
}
|
|
2771
|
-
},
|
|
2772
|
-
raid: {
|
|
2773
|
-
latest: { name: t.name, amount: { type: "int", min: 0, max: 100 } },
|
|
2774
|
-
recent: {
|
|
2775
|
-
type: "recent",
|
|
2776
|
-
amount: 25,
|
|
2777
|
-
value: {
|
|
2778
|
-
name: t.name,
|
|
2779
|
-
amount: { type: "int", min: 0, max: 100 },
|
|
2780
|
-
createdAt: { type: "date", range: 400 }
|
|
2781
|
-
}
|
|
2782
|
-
}
|
|
2783
|
-
},
|
|
2784
|
-
charityCampaignDonation: {
|
|
2785
|
-
latest: { name: t.name, amount: { type: "int", min: 50, max: 150 } },
|
|
2786
|
-
"session-top-donation": { name: t.name, amount: { type: "int", min: 50, max: 200 } },
|
|
2787
|
-
"weekly-top-donation": { name: t.name, amount: { type: "int", min: 200, max: 500 } },
|
|
2788
|
-
"monthly-top-donation": { name: t.name, amount: { type: "int", min: 500, max: 800 } },
|
|
2789
|
-
"alltime-top-donation": { name: t.name, amount: { type: "int", min: 800, max: 1e3 } },
|
|
2790
|
-
"session-top-donator": { name: t.name, amount: { type: "int", min: 50, max: 200 } },
|
|
2791
|
-
"weekly-top-donator": { name: t.name, amount: { type: "int", min: 200, max: 500 } },
|
|
2792
|
-
"monthly-top-donator": { name: t.name, amount: { type: "int", min: 500, max: 800 } },
|
|
2793
|
-
"alltime-top-donator": { name: t.name, amount: { type: "int", min: 800, max: 1e3 } },
|
|
2794
|
-
recent: {
|
|
2795
|
-
type: "recent",
|
|
2796
|
-
amount: 25,
|
|
2797
|
-
value: {
|
|
2798
|
-
name: t.name,
|
|
2799
|
-
amount: { type: "int", min: 50, max: 150 },
|
|
2800
|
-
createdAt: { type: "date", range: 400 }
|
|
2801
|
-
}
|
|
2802
|
-
}
|
|
2803
|
-
},
|
|
2804
|
-
cheer: {
|
|
2805
|
-
latest: { name: t.name, amount: { type: "int", min: 200, max: 800 }, message: t.message },
|
|
2806
|
-
"session-top-donation": { name: t.name, amount: { type: "int", min: 200, max: 1e3 } },
|
|
2807
|
-
"weekly-top-donation": { name: t.name, amount: { type: "int", min: 1e3, max: 5e3 } },
|
|
2808
|
-
"monthly-top-donation": { name: t.name, amount: { type: "int", min: 5e3, max: 12e3 } },
|
|
2809
|
-
"alltime-top-donation": { name: t.name, amount: { type: "int", min: 12e3, max: 2e4 } },
|
|
2810
|
-
"session-top-donator": { name: t.name, amount: { type: "int", min: 200, max: 1e3 } },
|
|
2811
|
-
"weekly-top-donator": { name: t.name, amount: { type: "int", min: 1e3, max: 5e3 } },
|
|
2812
|
-
"monthly-top-donator": { name: t.name, amount: { type: "int", min: 5e3, max: 12e3 } },
|
|
2813
|
-
"alltime-top-donator": { name: t.name, amount: { type: "int", min: 12e3, max: 2e4 } },
|
|
2814
|
-
session: { amount: { type: "int", min: 200, max: 1e3 } },
|
|
2815
|
-
week: { amount: { type: "int", min: 1e3, max: 5e3 } },
|
|
2816
|
-
month: { amount: { type: "int", min: 5e3, max: 12e3 } },
|
|
2817
|
-
goal: { amount: { type: "int", min: 12e3, max: 18e3 } },
|
|
2818
|
-
total: { amount: { type: "int", min: 18e3, max: 2e4 } },
|
|
2819
|
-
count: { count: { type: "int", min: 200, max: 1e3 } },
|
|
2820
|
-
recent: {
|
|
2821
|
-
type: "recent",
|
|
2822
|
-
amount: 25,
|
|
2823
|
-
value: {
|
|
2824
|
-
name: t.name,
|
|
2825
|
-
amount: { type: "int", min: 200, max: 800 },
|
|
2826
|
-
createdAt: { type: "date", range: 400 }
|
|
2827
|
-
}
|
|
2828
|
-
}
|
|
2829
|
-
},
|
|
2830
|
-
cheerPurchase: {
|
|
2831
|
-
latest: { name: t.name, amount: { type: "int", min: 200, max: 400 } },
|
|
2832
|
-
"session-top-donation": { name: t.name, amount: { type: "int", min: 200, max: 400 } },
|
|
2833
|
-
"weekly-top-donation": { name: t.name, amount: { type: "int", min: 400, max: 800 } },
|
|
2834
|
-
"monthly-top-donation": { name: t.name, amount: { type: "int", min: 800, max: 1500 } },
|
|
2835
|
-
"alltime-top-donation": { name: t.name, amount: { type: "int", min: 1500, max: 2e3 } },
|
|
2836
|
-
"session-top-donator": { name: t.name, amount: { type: "int", min: 200, max: 400 } },
|
|
2837
|
-
"weekly-top-donator": { name: t.name, amount: { type: "int", min: 400, max: 800 } },
|
|
2838
|
-
"monthly-top-donator": { name: t.name, amount: { type: "int", min: 800, max: 1500 } },
|
|
2839
|
-
"alltime-top-donator": { name: t.name, amount: { type: "int", min: 1500, max: 2e3 } },
|
|
2840
|
-
recent: {
|
|
2841
|
-
type: "recent",
|
|
2842
|
-
amount: 25,
|
|
2843
|
-
value: {
|
|
2844
|
-
name: t.name,
|
|
2845
|
-
amount: { type: "int", min: 200, max: 400 },
|
|
2846
|
-
createdAt: { type: "date", range: 400 }
|
|
2847
|
-
}
|
|
2848
|
-
}
|
|
2849
|
-
},
|
|
2850
|
-
superchat: {
|
|
2851
|
-
latest: { name: t.name, amount: { type: "int", min: 100, max: 400 } },
|
|
2852
|
-
"session-top-donation": { name: t.name, amount: { type: "int", min: 100, max: 500 } },
|
|
2853
|
-
"weekly-top-donation": { name: t.name, amount: { type: "int", min: 500, max: 1e3 } },
|
|
2854
|
-
"monthly-top-donation": { name: t.name, amount: { type: "int", min: 1e3, max: 2e3 } },
|
|
2855
|
-
"alltime-top-donation": { name: t.name, amount: { type: "int", min: 2e3, max: 2500 } },
|
|
2856
|
-
"session-top-donator": { name: t.name, amount: { type: "int", min: 100, max: 500 } },
|
|
2857
|
-
"weekly-top-donator": { name: t.name, amount: { type: "int", min: 500, max: 1e3 } },
|
|
2858
|
-
"monthly-top-donator": { name: t.name, amount: { type: "int", min: 1e3, max: 2e3 } },
|
|
2859
|
-
"alltime-top-donator": { name: t.name, amount: { type: "int", min: 2e3, max: 2500 } },
|
|
2860
|
-
session: { amount: { type: "int", min: 100, max: 500 } },
|
|
2861
|
-
week: { amount: { type: "int", min: 500, max: 1e3 } },
|
|
2862
|
-
month: { amount: { type: "int", min: 1e3, max: 2e3 } },
|
|
2863
|
-
goal: { amount: { type: "int", min: 2e3, max: 2300 } },
|
|
2864
|
-
total: { amount: { type: "int", min: 2300, max: 2500 } },
|
|
2865
|
-
count: { count: { type: "int", min: 100, max: 500 } },
|
|
2866
|
-
recent: {
|
|
2867
|
-
type: "recent",
|
|
2868
|
-
amount: 25,
|
|
2869
|
-
value: {
|
|
2870
|
-
name: t.name,
|
|
2871
|
-
amount: { type: "int", min: 100, max: 400 },
|
|
2872
|
-
createdAt: { type: "date", range: 400 }
|
|
2873
|
-
}
|
|
2874
|
-
}
|
|
2875
|
-
},
|
|
2876
|
-
hypetrain: {
|
|
2877
|
-
latest: {
|
|
2878
|
-
name: t.name,
|
|
2879
|
-
amount: { type: "int", min: 0, max: 100 },
|
|
2880
|
-
active: { type: "int", min: 0, max: 1 },
|
|
2881
|
-
level: { type: "int", min: 5, max: 10 },
|
|
2882
|
-
levelChanged: { type: "int", min: 0, max: 5 },
|
|
2883
|
-
_type: { type: "array", options: ["follower", "subscriber", "cheer", "donation"] }
|
|
2884
|
-
},
|
|
2885
|
-
"level-goal": { amount: { type: "int", min: 0, max: 100 } },
|
|
2886
|
-
"level-progress": { amount: { type: "int", min: 0, max: 100 }, percent: { type: "int", min: 0, max: 100 } },
|
|
2887
|
-
total: { amount: { type: "int", min: 0, max: 100 } },
|
|
2888
|
-
"latest-top-contributors": { type: "recent", amount: 25, value: { name: t.name } }
|
|
2889
|
-
},
|
|
2890
|
-
"channel-points": {
|
|
2891
|
-
latest: {
|
|
2892
|
-
name: t.name,
|
|
2893
|
-
amount: { type: "int", min: 0, max: 100 },
|
|
2894
|
-
message: t.message,
|
|
2895
|
-
redemption: { type: "array", options: ["Reward 1", "Reward 2", "Reward 3"] }
|
|
2896
|
-
}
|
|
2897
|
-
},
|
|
2898
|
-
tip: {
|
|
2899
|
-
latest: { name: t.name, amount: { type: "int", min: 100, max: 400 } },
|
|
2900
|
-
"session-top-donation": { name: t.name, amount: { type: "int", min: 100, max: 500 } },
|
|
2901
|
-
"weekly-top-donation": { name: t.name, amount: { type: "int", min: 500, max: 1e3 } },
|
|
2902
|
-
"monthly-top-donation": { name: t.name, amount: { type: "int", min: 1e3, max: 2e3 } },
|
|
2903
|
-
"alltime-top-donation": { name: t.name, amount: { type: "int", min: 2e3, max: 2500 } },
|
|
2904
|
-
"session-top-donator": { name: t.name, amount: { type: "int", min: 100, max: 500 } },
|
|
2905
|
-
"weekly-top-donator": { name: t.name, amount: { type: "int", min: 500, max: 1e3 } },
|
|
2906
|
-
"monthly-top-donator": { name: t.name, amount: { type: "int", min: 1e3, max: 2e3 } },
|
|
2907
|
-
"alltime-top-donator": { name: t.name, amount: { type: "int", min: 2e3, max: 2500 } },
|
|
2908
|
-
session: { amount: { type: "int", min: 100, max: 500 } },
|
|
2909
|
-
week: { amount: { type: "int", min: 500, max: 1e3 } },
|
|
2910
|
-
month: { amount: { type: "int", min: 1e3, max: 2e3 } },
|
|
2911
|
-
goal: { amount: { type: "int", min: 2e3, max: 2300 } },
|
|
2912
|
-
total: { amount: { type: "int", min: 2300, max: 2500 } },
|
|
2913
|
-
count: { count: { type: "int", min: 100, max: 500 } },
|
|
2914
|
-
recent: {
|
|
2915
|
-
type: "recent",
|
|
2916
|
-
amount: 25,
|
|
2917
|
-
value: {
|
|
2918
|
-
name: t.name,
|
|
2919
|
-
amount: { type: "int", min: 100, max: 400 },
|
|
2920
|
-
createdAt: { type: "date", range: 400 }
|
|
2921
|
-
}
|
|
1957
|
+
}, e.string = {
|
|
1958
|
+
/**
|
|
1959
|
+
* Replaces occurrences in a string based on a pattern with the result of an asynchronous callback function.
|
|
1960
|
+
* @param string - The input string to perform replacements on.
|
|
1961
|
+
* @param pattern - The pattern to match in the string (can be a string or a regular expression).
|
|
1962
|
+
* @param callback - An asynchronous callback function that takes the matched substring and any captured groups as arguments and returns the replacement string.
|
|
1963
|
+
* @returns A promise that resolves to the modified string with replacements applied.
|
|
1964
|
+
* @example
|
|
1965
|
+
* ```javascript
|
|
1966
|
+
* const result = await Simulation.string.replace("Hello World", /World/, async (match) => {
|
|
1967
|
+
* return await fetchSomeData(match); // Assume this function fetches data asynchronously
|
|
1968
|
+
* });
|
|
1969
|
+
* console.log(result); // Output will depend on the fetched data
|
|
1970
|
+
* ```
|
|
1971
|
+
*/
|
|
1972
|
+
async replace(t, i, a) {
|
|
1973
|
+
const s = [];
|
|
1974
|
+
t.replace(i, (o, ...c) => {
|
|
1975
|
+
const l = typeof a == "function" ? a(o, ...c) : o;
|
|
1976
|
+
return s.push(Promise.resolve(l)), o;
|
|
1977
|
+
});
|
|
1978
|
+
const d = await Promise.all(s);
|
|
1979
|
+
return t.replace(i, () => d.shift() ?? "");
|
|
1980
|
+
},
|
|
1981
|
+
/**
|
|
1982
|
+
* Capitalizes the first letter of a given string.
|
|
1983
|
+
* @param string - The input string to be capitalized.
|
|
1984
|
+
* @returns The capitalized string.
|
|
1985
|
+
* @example
|
|
1986
|
+
* ```javascript
|
|
1987
|
+
* const result = Simulation.string.capitalize("hello world");
|
|
1988
|
+
* console.log(result); // Output: "Hello world"
|
|
1989
|
+
* ```
|
|
1990
|
+
*/
|
|
1991
|
+
capitalize(t) {
|
|
1992
|
+
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
1993
|
+
},
|
|
1994
|
+
/**
|
|
1995
|
+
* Composes a template string by replacing placeholders with corresponding values and applying optional modifiers.
|
|
1996
|
+
* @param template - The template string containing placeholders in the format {key} and optional modifiers in the format [MODIFIER:param=value].
|
|
1997
|
+
* @param values - An object containing key-value pairs to replace the placeholders in the template.
|
|
1998
|
+
* @param options - Optional settings for the composition process.
|
|
1999
|
+
* @returns The composed string with placeholders replaced and modifiers applied.
|
|
2000
|
+
* @example
|
|
2001
|
+
* ```javascript
|
|
2002
|
+
* const template = "Hello, {username}! You have {amount} [UPPERCASE=messages] and your name is [CAPITALIZE=name].";
|
|
2003
|
+
* const values = { username: "john_doe", amount: 5, name: "john" };
|
|
2004
|
+
* const result = Simulation.string.compose(template, values);
|
|
2005
|
+
* console.log(result); // Output: "Hello, john_doe! You have 5 MESSAGES and your name is John."
|
|
2006
|
+
* ```
|
|
2007
|
+
*/
|
|
2008
|
+
compose(t, i = {}, a = {
|
|
2009
|
+
method: "index",
|
|
2010
|
+
html: !1,
|
|
2011
|
+
modifiers: {},
|
|
2012
|
+
aliases: {}
|
|
2013
|
+
}) {
|
|
2014
|
+
const { mergeSpanStyles: s } = e.element;
|
|
2015
|
+
i.skip = "<br/>", i.newline = "<br/>";
|
|
2016
|
+
const d = Object.entries(e.object.flatten(i)).reduce(
|
|
2017
|
+
(r, [m, p]) => {
|
|
2018
|
+
if (r[m] = String(p), ["username", "name", "nick", "nickname", "sender"].some((u) => m === u)) {
|
|
2019
|
+
const u = r?.username || r?.name || r?.nick || r?.nickname || r?.sender;
|
|
2020
|
+
r.username = r.username || u, r.usernameAt = `@${r.username}`, r.name = r.name || u, r.nick = r.nick || u, r.nickname = r.nickname || u, r.sender = r.sender || u, r.senderAt = `@${r.sender}`;
|
|
2922
2021
|
}
|
|
2022
|
+
return ["amount", "count"].some((u) => m === u) && (r.amount = String(c), r.count = String(r?.count || c)), r.currency = r.currency || window.client?.details.currency.symbol || "$", r.currencyCode = r.currencyCode || window.client?.details.currency.code || "USD", r;
|
|
2923
2023
|
},
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2024
|
+
{}
|
|
2025
|
+
), o = {
|
|
2026
|
+
PLACEHOLDERS: /{([^}]+)}/g,
|
|
2027
|
+
MODIFIERS: /\[(\w+)(:[^=]+)?=([^\]]+)\]/g
|
|
2028
|
+
};
|
|
2029
|
+
var c = parseFloat(d?.amount ?? d?.count ?? 0);
|
|
2030
|
+
const l = {
|
|
2031
|
+
COLOR: (r, m) => s(m && e.color.validate(m) ? `color: ${m}` : "", r),
|
|
2032
|
+
WEIGHT: (r, m) => s(m && !isNaN(parseInt(m)) ? `font-weight: ${m}` : "", r),
|
|
2033
|
+
BOLD: (r) => s("font-weight: bold", r),
|
|
2034
|
+
LIGHT: (r) => s("font-weight: lighter", r),
|
|
2035
|
+
STRONG: (r) => s("font-weight: bolder", r),
|
|
2036
|
+
ITALIC: (r) => s("font-style: italic", r),
|
|
2037
|
+
UNDERLINE: (r) => s("text-decoration: underline", r),
|
|
2038
|
+
STRIKETHROUGH: (r) => s("text-decoration: line-through", r),
|
|
2039
|
+
SUB: (r) => s("vertical-align: sub", r),
|
|
2040
|
+
SUP: (r) => s("vertical-align: super", r),
|
|
2041
|
+
LARGER: (r) => s("font-size: larger", r),
|
|
2042
|
+
SMALL: (r) => s("font-size: smaller", r),
|
|
2043
|
+
SHADOW: (r, m) => s(`text-shadow: ${m}`, r),
|
|
2044
|
+
SIZE: (r, m) => s(m ? `font-size: ${m}` : "", r)
|
|
2045
|
+
}, f = {
|
|
2046
|
+
...{
|
|
2047
|
+
BT1: (r) => c > 1 ? r : "",
|
|
2048
|
+
BT0: (r) => c > 0 ? r : "",
|
|
2049
|
+
ST1: (r) => c < 1 ? r : "",
|
|
2050
|
+
ST0: (r) => c < 0 ? r : "",
|
|
2051
|
+
UPC: (r) => r.toUpperCase(),
|
|
2052
|
+
LOW: (r) => r.toLowerCase(),
|
|
2053
|
+
REV: (r) => r.split("").reverse().join(""),
|
|
2054
|
+
CAP: (r) => r.charAt(0).toUpperCase() + r.slice(1).toLowerCase(),
|
|
2055
|
+
FALLBACK: (r, m) => r.length ? r : m ?? r
|
|
2930
2056
|
},
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2057
|
+
...a?.html ? l : {},
|
|
2058
|
+
...a.modifiers ?? {}
|
|
2059
|
+
}, v = {
|
|
2060
|
+
UPC: ["UPPERCASE", "UPPER", "UPP"],
|
|
2061
|
+
LOW: ["LOWERCASE", "LOWER", "LWC"],
|
|
2062
|
+
REV: ["REVERSE", "RVS"],
|
|
2063
|
+
CAP: ["CAPITALIZE", "CAPITAL"],
|
|
2064
|
+
BT1: ["BIGGER_THAN_1", "GREATER_THAN_1", "GT1"],
|
|
2065
|
+
BT0: ["BIGGER_THAN_0", "GREATER_THAN_0", "GT0"],
|
|
2066
|
+
ST1: ["SMALLER_THAN_1", "LESS_THAN_1", "LT1"],
|
|
2067
|
+
ST0: ["SMALLER_THAN_0", "LESS_THAN_0", "LT0"],
|
|
2068
|
+
COLOR: ["COLOUR", "CLR", "HIGHLIGHT"],
|
|
2069
|
+
BOLD: ["BOLDEN", "B"],
|
|
2070
|
+
STRONG: ["STRONGEN", "STRONG"],
|
|
2071
|
+
ITALIC: ["ITALICIZE", "ITALIC", "I"],
|
|
2072
|
+
UNDERLINE: ["U", "INS", "INSET", "I"],
|
|
2073
|
+
STRIKETHROUGH: ["STRIKE", "S", "DELETE", "D"],
|
|
2074
|
+
SUB: ["SUBSCRIPT", "SUBS"],
|
|
2075
|
+
SUP: ["SUPERSCRIPT", "SUPS"],
|
|
2076
|
+
LARGER: ["LARGER", "LG"],
|
|
2077
|
+
SMALL: ["SMALLER", "SM"],
|
|
2078
|
+
SHADOW: ["SHADOW", "SHD"],
|
|
2079
|
+
FALLBACK: ["FALLBACK", "FB"],
|
|
2080
|
+
...a.aliases ?? {}
|
|
2940
2081
|
};
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
}
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2082
|
+
function b(r, m, p) {
|
|
2083
|
+
const u = Object.entries(v).find(([y, x]) => x.some((k) => k.toUpperCase() === m.toUpperCase()) ? !0 : y.toUpperCase() === m.toUpperCase()), E = u ? u[0] : m.toUpperCase();
|
|
2084
|
+
return f[E] ? f[E](r, typeof p == "string" ? p.trim() : null, d) : r;
|
|
2085
|
+
}
|
|
2086
|
+
function j(r) {
|
|
2087
|
+
let m = r, p;
|
|
2088
|
+
for (; (p = o.MODIFIERS.exec(m)) !== null; ) {
|
|
2089
|
+
const [u, E, y, x] = p, k = b(j(x), E, y);
|
|
2090
|
+
m = m.replace(u, k ?? ""), o.MODIFIERS.lastIndex = 0;
|
|
2091
|
+
}
|
|
2092
|
+
return m;
|
|
2093
|
+
}
|
|
2094
|
+
function g(r) {
|
|
2095
|
+
let m = 0;
|
|
2096
|
+
const p = r.length;
|
|
2097
|
+
function u(y) {
|
|
2098
|
+
let x = "";
|
|
2099
|
+
for (; m < p; )
|
|
2100
|
+
if (r[m] === "\\")
|
|
2101
|
+
m + 1 < p ? (x += r[m + 1], m += 2) : m++;
|
|
2102
|
+
else if (r[m] === "[" && (!y || y !== "["))
|
|
2103
|
+
x += E();
|
|
2104
|
+
else if (y && r[m] === y) {
|
|
2105
|
+
m++;
|
|
2106
|
+
break;
|
|
2107
|
+
} else
|
|
2108
|
+
x += r[m++];
|
|
2109
|
+
return x;
|
|
2110
|
+
}
|
|
2111
|
+
function E() {
|
|
2112
|
+
m++;
|
|
2113
|
+
let y = "";
|
|
2114
|
+
for (; m < p && /[A-Za-z0-9]/.test(r[m]); ) y += r[m++];
|
|
2115
|
+
let x = null;
|
|
2116
|
+
if (r[m] === ":") {
|
|
2117
|
+
m++;
|
|
2118
|
+
const T = m;
|
|
2119
|
+
for (; m < p && r[m] !== "="; ) m++;
|
|
2120
|
+
x = r.slice(T, m);
|
|
2972
2121
|
}
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
), n),
|
|
2983
|
-
{}
|
|
2122
|
+
r[m] === "=" && m++;
|
|
2123
|
+
const k = u("]");
|
|
2124
|
+
return b(k, y, x);
|
|
2125
|
+
}
|
|
2126
|
+
return u();
|
|
2127
|
+
}
|
|
2128
|
+
let w = t.replace(
|
|
2129
|
+
o.PLACEHOLDERS,
|
|
2130
|
+
(r, m) => typeof d[m] == "string" || typeof d[m] == "number" ? String(d[m]) : m ?? m
|
|
2984
2131
|
);
|
|
2985
|
-
return a;
|
|
2132
|
+
return w = a.method === "loop" ? j(w) : g(w), w;
|
|
2986
2133
|
}
|
|
2987
|
-
},
|
|
2988
|
-
event: {
|
|
2134
|
+
}, e.element = {
|
|
2989
2135
|
/**
|
|
2990
|
-
*
|
|
2991
|
-
* @param
|
|
2992
|
-
* @param
|
|
2993
|
-
* @
|
|
2994
|
-
* @
|
|
2136
|
+
* Merges outer span styles with inner span styles in the provided HTML string.
|
|
2137
|
+
* @param outerStyle - The style string to be applied to the outer span.
|
|
2138
|
+
* @param innerHTML - The inner HTML string which may contain a span with its own styles.
|
|
2139
|
+
* @returns A new HTML string with merged styles applied to a single span.
|
|
2140
|
+
* @example
|
|
2141
|
+
* ```javascript
|
|
2142
|
+
* const result = Simulation.element.mergeSpanStyles("color: red; font-weight: bold;", '<span style="font-size: 14px;">Hello World</span>');
|
|
2143
|
+
* console.log(result); // Output: '<span style="font-size: 14px; color: red; font-weight: bold;">Hello World</span>'
|
|
2144
|
+
* ```
|
|
2995
2145
|
*/
|
|
2996
|
-
|
|
2997
|
-
const
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
}
|
|
3002
|
-
|
|
3003
|
-
channel: {
|
|
3004
|
-
username: "local",
|
|
3005
|
-
apiToken: "",
|
|
3006
|
-
id: "",
|
|
3007
|
-
providerId: "",
|
|
3008
|
-
avatar: ""
|
|
3009
|
-
},
|
|
3010
|
-
currency: n[a] ?? n.USD,
|
|
3011
|
-
fieldData: t,
|
|
3012
|
-
recents: [],
|
|
3013
|
-
session: {
|
|
3014
|
-
data: e,
|
|
3015
|
-
settings: {
|
|
3016
|
-
autoReset: !1,
|
|
3017
|
-
calendar: !1,
|
|
3018
|
-
resetOnStart: !1
|
|
3019
|
-
}
|
|
3020
|
-
},
|
|
3021
|
-
overlay: {
|
|
3022
|
-
isEditorMode: !0,
|
|
3023
|
-
muted: !1
|
|
3024
|
-
},
|
|
3025
|
-
emulated: !0
|
|
3026
|
-
};
|
|
2146
|
+
mergeSpanStyles(t, i) {
|
|
2147
|
+
const a = i.match(/^<span style="([^"]*)">(.*)<\/span>$/s);
|
|
2148
|
+
if (a) {
|
|
2149
|
+
const s = a[1], d = a[2];
|
|
2150
|
+
return `<span style="${[s, t].filter(Boolean).join("; ").replace(/\s*;\s*/g, "; ").trim()}">${d}</span>`;
|
|
2151
|
+
} else
|
|
2152
|
+
return `<span style="${t}">${i}</span>`;
|
|
3027
2153
|
},
|
|
3028
2154
|
/**
|
|
3029
|
-
*
|
|
3030
|
-
* @param
|
|
3031
|
-
* @
|
|
2155
|
+
* Scales an HTML element to fit within its parent element based on specified minimum and maximum scale factors.
|
|
2156
|
+
* @param element - The HTML element to be scaled.
|
|
2157
|
+
* @param min - Minimum scale factor (default is 0).
|
|
2158
|
+
* @param max - Maximum scale factor (default is 1).
|
|
2159
|
+
* @param options - Optional settings for scaling.
|
|
2160
|
+
* @returns - An object containing the new width, height, and scale factor, or void if not applied.
|
|
2161
|
+
* @example
|
|
2162
|
+
* ```javascript
|
|
2163
|
+
* const element = document.getElementById('myElement');
|
|
2164
|
+
* Simulation.element.scale(element, 0.5, 1, { return: false });
|
|
2165
|
+
* ```
|
|
3032
2166
|
*/
|
|
3033
|
-
|
|
3034
|
-
return
|
|
2167
|
+
scale(t, i = 0, a = 1, s) {
|
|
2168
|
+
const { return: d = !1, parent: o, base: c } = s || {}, l = o || t.parentElement || document.body;
|
|
2169
|
+
if (!l) {
|
|
2170
|
+
P.warn("No parent element found for scaling");
|
|
2171
|
+
return;
|
|
2172
|
+
}
|
|
2173
|
+
const h = l.getBoundingClientRect(), f = t.offsetWidth, v = t.offsetHeight;
|
|
2174
|
+
if (f === 0 || v === 0) {
|
|
2175
|
+
P.warn("Element has zero width or height, cannot scale");
|
|
2176
|
+
return;
|
|
2177
|
+
}
|
|
2178
|
+
const b = h.width * a / f, j = h.height * a / v;
|
|
2179
|
+
let g = c === "width" ? b : c === "height" ? j : Math.min(b, j);
|
|
2180
|
+
if (i > 0) {
|
|
2181
|
+
const r = h.width * i / f, m = h.height * i / v, p = Math.max(r, m);
|
|
2182
|
+
g = Math.max(p, g);
|
|
2183
|
+
}
|
|
2184
|
+
const w = {
|
|
2185
|
+
width: f * g,
|
|
2186
|
+
height: v * g,
|
|
2187
|
+
scale: g
|
|
2188
|
+
};
|
|
2189
|
+
return d || (t.style.transform = `scale(${g})`, t.style.transformOrigin = "center center"), w;
|
|
3035
2190
|
},
|
|
3036
2191
|
/**
|
|
3037
|
-
*
|
|
3038
|
-
* @param
|
|
3039
|
-
* @param
|
|
3040
|
-
* @
|
|
3041
|
-
* @returns A Promise that resolves to the simulated onEventReceived event data, or null if the event type is not supported.
|
|
2192
|
+
* Splits the text content of an HTML string into individual characters wrapped in span elements with a data-index attribute.
|
|
2193
|
+
* @param htmlString - The input HTML string to be processed.
|
|
2194
|
+
* @param startIndex - The starting index for the data-index attribute (default is 0).
|
|
2195
|
+
* @returns - A new HTML string with each character wrapped in a span element.
|
|
3042
2196
|
* @example
|
|
3043
2197
|
* ```javascript
|
|
3044
|
-
*
|
|
3045
|
-
*
|
|
3046
|
-
*
|
|
3047
|
-
* // Simulate a Twitch message event with custom options
|
|
3048
|
-
* const twitchMessageEvent = await Simulation.generate.event.onEventReceived('twitch', 'message', { name: 'Streamer', message: 'Hello World!' });
|
|
2198
|
+
* const result = Simulation.element.splitTextToChars("<p>Hello</p>", 0);
|
|
2199
|
+
* console.log(result);
|
|
2200
|
+
* // Output: '<p><span class="char" data-index="0">H</span><span class="char" data-index="1">e</span><span class="char" data-index="2">l</span><span class="char" data-index="3">l</span><span class="char" data-index="4">o</span></p>'
|
|
3049
2201
|
* ```
|
|
3050
2202
|
*/
|
|
3051
|
-
|
|
3052
|
-
const
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
return
|
|
2203
|
+
splitTextToChars(t, i = 0) {
|
|
2204
|
+
const s = new DOMParser().parseFromString(t, "text/html");
|
|
2205
|
+
let d = i;
|
|
2206
|
+
function o(h) {
|
|
2207
|
+
if (h.nodeType === Node.TEXT_NODE) {
|
|
2208
|
+
const v = h.textContent?.split("").map((j) => {
|
|
2209
|
+
const g = document.createElement("span");
|
|
2210
|
+
return g.className = "char", g.dataset.index = String(d++), g.textContent = j, d++, g.outerHTML;
|
|
2211
|
+
}), b = document.createElement("span");
|
|
2212
|
+
return b.innerHTML = v?.join("") ?? "", b;
|
|
2213
|
+
} else if (h.nodeType === Node.ELEMENT_NODE) {
|
|
2214
|
+
const f = h.cloneNode(!1);
|
|
2215
|
+
return h.childNodes.forEach((v) => {
|
|
2216
|
+
const b = o(v);
|
|
2217
|
+
b instanceof Node && Array.from(b.childNodes).forEach((j) => {
|
|
2218
|
+
f.appendChild(j);
|
|
2219
|
+
});
|
|
2220
|
+
}), f;
|
|
2221
|
+
}
|
|
2222
|
+
return h.cloneNode(!0);
|
|
2223
|
+
}
|
|
2224
|
+
const c = s.body, l = document.createElement("div");
|
|
2225
|
+
return c.childNodes.forEach((h) => {
|
|
2226
|
+
const f = o(h);
|
|
2227
|
+
f instanceof Node && l.appendChild(f);
|
|
2228
|
+
}), l.innerHTML;
|
|
2229
|
+
}
|
|
2230
|
+
}, e.object = {
|
|
2231
|
+
/**
|
|
2232
|
+
* Flattens a nested object into a single-level object with dot-separated keys.
|
|
2233
|
+
* @param obj - The nested object to be flattened.
|
|
2234
|
+
* @param prefix - The prefix to be added to each key (used for recursion).
|
|
2235
|
+
* @returns A flattened object with dot-separated keys.
|
|
2236
|
+
* @example
|
|
2237
|
+
* ```javascript
|
|
2238
|
+
* const nestedObj = { a: { b: 1, c: { d: 2 } }, e: [3, 4] };
|
|
2239
|
+
* const flatObj = Simulation.object.flatten(nestedObj);
|
|
2240
|
+
* console.log(flatObj);
|
|
2241
|
+
* // Output: { 'a.b': '1', 'a.c.d': '2', 'e:0': '3', 'e:1': '4' }
|
|
2242
|
+
* ```
|
|
2243
|
+
*/
|
|
2244
|
+
flatten(t, i = "") {
|
|
2245
|
+
const a = {};
|
|
2246
|
+
for (const s in t) {
|
|
2247
|
+
if (!Object.prototype.hasOwnProperty.call(t, s)) continue;
|
|
2248
|
+
const d = t[s], o = i ? `${i}.${s}` : s;
|
|
2249
|
+
if (d == null) {
|
|
2250
|
+
a[o] = String(d);
|
|
2251
|
+
continue;
|
|
2252
|
+
}
|
|
2253
|
+
if (d instanceof Date) {
|
|
2254
|
+
a[o] = d.toISOString();
|
|
2255
|
+
continue;
|
|
3064
2256
|
}
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
2257
|
+
if (d instanceof Map) {
|
|
2258
|
+
d.forEach((c, l) => {
|
|
2259
|
+
a[`${o}.${l}`] = JSON.stringify(c);
|
|
2260
|
+
});
|
|
2261
|
+
continue;
|
|
2262
|
+
}
|
|
2263
|
+
if (Array.isArray(d)) {
|
|
2264
|
+
d.forEach((c, l) => {
|
|
2265
|
+
const h = `${o}:${l}`;
|
|
2266
|
+
typeof c == "object" ? Object.assign(a, this.flatten(c, h)) : a[h] = String(c);
|
|
2267
|
+
});
|
|
2268
|
+
continue;
|
|
2269
|
+
}
|
|
2270
|
+
if (typeof d == "object") {
|
|
2271
|
+
Object.assign(a, this.flatten(d, o));
|
|
2272
|
+
continue;
|
|
2273
|
+
}
|
|
2274
|
+
a[o] = String(d);
|
|
2275
|
+
}
|
|
2276
|
+
return a;
|
|
2277
|
+
}
|
|
2278
|
+
}, e.generate = {
|
|
2279
|
+
session: {
|
|
2280
|
+
types: {
|
|
2281
|
+
name: { type: "string", options: e.data.names.filter((t) => t.length) },
|
|
2282
|
+
tier: { type: "string", options: e.data.tiers.filter((t) => t.length) },
|
|
2283
|
+
message: { type: "string", options: e.data.messages.filter((t) => t.length) },
|
|
2284
|
+
item: { type: "array", options: e.data.items },
|
|
2285
|
+
avatar: { type: "string", options: e.data.avatars.filter((t) => t.length) }
|
|
2286
|
+
},
|
|
2287
|
+
available() {
|
|
2288
|
+
const t = this.types;
|
|
2289
|
+
return {
|
|
2290
|
+
follower: {
|
|
2291
|
+
latest: { name: t.name },
|
|
2292
|
+
session: { count: { type: "int", min: 50, max: 200 } },
|
|
2293
|
+
week: { count: { type: "int", min: 200, max: 1e3 } },
|
|
2294
|
+
month: { count: { type: "int", min: 1e3, max: 3e3 } },
|
|
2295
|
+
goal: { amount: { type: "int", min: 3e3, max: 7e3 } },
|
|
2296
|
+
total: { count: { type: "int", min: 7e3, max: 1e4 } },
|
|
2297
|
+
recent: {
|
|
2298
|
+
type: "recent",
|
|
2299
|
+
amount: 25,
|
|
2300
|
+
value: { name: t.name, createdAt: { type: "date", range: 400 } }
|
|
3071
2301
|
}
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
2302
|
+
},
|
|
2303
|
+
subscriber: {
|
|
2304
|
+
latest: {
|
|
2305
|
+
name: t.name,
|
|
2306
|
+
amount: { type: "int", min: 10, max: 30 },
|
|
2307
|
+
tier: t.tier,
|
|
2308
|
+
message: t.message
|
|
2309
|
+
},
|
|
2310
|
+
"new-latest": {
|
|
2311
|
+
name: t.name,
|
|
2312
|
+
amount: { type: "int", min: 10, max: 30 },
|
|
2313
|
+
message: t.message
|
|
2314
|
+
},
|
|
2315
|
+
"resub-latest": {
|
|
2316
|
+
name: t.name,
|
|
2317
|
+
amount: { type: "int", min: 10, max: 30 },
|
|
2318
|
+
message: t.message
|
|
2319
|
+
},
|
|
2320
|
+
"gifted-latest": {
|
|
2321
|
+
name: t.name,
|
|
2322
|
+
amount: { type: "int", min: 10, max: 30 },
|
|
2323
|
+
message: t.message,
|
|
2324
|
+
tier: t.tier,
|
|
2325
|
+
sender: t.name
|
|
2326
|
+
},
|
|
2327
|
+
session: { count: { type: "int", min: 10, max: 40 } },
|
|
2328
|
+
"new-session": { count: { type: "int", min: 10, max: 40 } },
|
|
2329
|
+
"resub-session": { count: { type: "int", min: 10, max: 40 } },
|
|
2330
|
+
"gifted-session": { count: { type: "int", min: 10, max: 40 } },
|
|
2331
|
+
week: { count: { type: "int", min: 40, max: 100 } },
|
|
2332
|
+
month: { count: { type: "int", min: 100, max: 200 } },
|
|
2333
|
+
goal: { amount: { type: "int", min: 200, max: 300 } },
|
|
2334
|
+
total: { count: { type: "int", min: 300, max: 400 } },
|
|
2335
|
+
points: { amount: { type: "int", min: 100, max: 400 } },
|
|
2336
|
+
"alltime-gifter": { name: t.name, amount: { type: "int", min: 300, max: 400 } },
|
|
2337
|
+
recent: {
|
|
2338
|
+
type: "recent",
|
|
2339
|
+
amount: 25,
|
|
2340
|
+
value: {
|
|
2341
|
+
name: t.name,
|
|
2342
|
+
amount: { type: "int", min: 10, max: 30 },
|
|
2343
|
+
tier: t.tier,
|
|
2344
|
+
createdAt: { type: "date", range: 400 }
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2347
|
+
},
|
|
2348
|
+
host: {
|
|
2349
|
+
latest: { name: t.name, amount: { type: "int", min: 1, max: 10 } },
|
|
2350
|
+
recent: {
|
|
2351
|
+
type: "recent",
|
|
2352
|
+
amount: 25,
|
|
2353
|
+
value: {
|
|
2354
|
+
name: t.name,
|
|
2355
|
+
amount: { type: "int", min: 1, max: 10 },
|
|
2356
|
+
createdAt: { type: "date", range: 400 }
|
|
2357
|
+
}
|
|
2358
|
+
}
|
|
2359
|
+
},
|
|
2360
|
+
raid: {
|
|
2361
|
+
latest: { name: t.name, amount: { type: "int", min: 0, max: 100 } },
|
|
2362
|
+
recent: {
|
|
2363
|
+
type: "recent",
|
|
2364
|
+
amount: 25,
|
|
2365
|
+
value: {
|
|
2366
|
+
name: t.name,
|
|
2367
|
+
amount: { type: "int", min: 0, max: 100 },
|
|
2368
|
+
createdAt: { type: "date", range: 400 }
|
|
2369
|
+
}
|
|
3112
2370
|
}
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
}
|
|
3130
|
-
|
|
2371
|
+
},
|
|
2372
|
+
charityCampaignDonation: {
|
|
2373
|
+
latest: { name: t.name, amount: { type: "int", min: 50, max: 150 } },
|
|
2374
|
+
"session-top-donation": { name: t.name, amount: { type: "int", min: 50, max: 200 } },
|
|
2375
|
+
"weekly-top-donation": { name: t.name, amount: { type: "int", min: 200, max: 500 } },
|
|
2376
|
+
"monthly-top-donation": { name: t.name, amount: { type: "int", min: 500, max: 800 } },
|
|
2377
|
+
"alltime-top-donation": { name: t.name, amount: { type: "int", min: 800, max: 1e3 } },
|
|
2378
|
+
"session-top-donator": { name: t.name, amount: { type: "int", min: 50, max: 200 } },
|
|
2379
|
+
"weekly-top-donator": { name: t.name, amount: { type: "int", min: 200, max: 500 } },
|
|
2380
|
+
"monthly-top-donator": { name: t.name, amount: { type: "int", min: 500, max: 800 } },
|
|
2381
|
+
"alltime-top-donator": { name: t.name, amount: { type: "int", min: 800, max: 1e3 } },
|
|
2382
|
+
recent: {
|
|
2383
|
+
type: "recent",
|
|
2384
|
+
amount: 25,
|
|
2385
|
+
value: {
|
|
2386
|
+
name: t.name,
|
|
2387
|
+
amount: { type: "int", min: 50, max: 150 },
|
|
2388
|
+
createdAt: { type: "date", range: 400 }
|
|
2389
|
+
}
|
|
3131
2390
|
}
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
2391
|
+
},
|
|
2392
|
+
cheer: {
|
|
2393
|
+
latest: { name: t.name, amount: { type: "int", min: 200, max: 800 }, message: t.message },
|
|
2394
|
+
"session-top-donation": { name: t.name, amount: { type: "int", min: 200, max: 1e3 } },
|
|
2395
|
+
"weekly-top-donation": { name: t.name, amount: { type: "int", min: 1e3, max: 5e3 } },
|
|
2396
|
+
"monthly-top-donation": { name: t.name, amount: { type: "int", min: 5e3, max: 12e3 } },
|
|
2397
|
+
"alltime-top-donation": { name: t.name, amount: { type: "int", min: 12e3, max: 2e4 } },
|
|
2398
|
+
"session-top-donator": { name: t.name, amount: { type: "int", min: 200, max: 1e3 } },
|
|
2399
|
+
"weekly-top-donator": { name: t.name, amount: { type: "int", min: 1e3, max: 5e3 } },
|
|
2400
|
+
"monthly-top-donator": { name: t.name, amount: { type: "int", min: 5e3, max: 12e3 } },
|
|
2401
|
+
"alltime-top-donator": { name: t.name, amount: { type: "int", min: 12e3, max: 2e4 } },
|
|
2402
|
+
session: { amount: { type: "int", min: 200, max: 1e3 } },
|
|
2403
|
+
week: { amount: { type: "int", min: 1e3, max: 5e3 } },
|
|
2404
|
+
month: { amount: { type: "int", min: 5e3, max: 12e3 } },
|
|
2405
|
+
goal: { amount: { type: "int", min: 12e3, max: 18e3 } },
|
|
2406
|
+
total: { amount: { type: "int", min: 18e3, max: 2e4 } },
|
|
2407
|
+
count: { count: { type: "int", min: 200, max: 1e3 } },
|
|
2408
|
+
recent: {
|
|
2409
|
+
type: "recent",
|
|
2410
|
+
amount: 25,
|
|
2411
|
+
value: {
|
|
2412
|
+
name: t.name,
|
|
2413
|
+
amount: { type: "int", min: 200, max: 800 },
|
|
2414
|
+
createdAt: { type: "date", range: 400 }
|
|
2415
|
+
}
|
|
3148
2416
|
}
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
2417
|
+
},
|
|
2418
|
+
cheerPurchase: {
|
|
2419
|
+
latest: { name: t.name, amount: { type: "int", min: 200, max: 400 } },
|
|
2420
|
+
"session-top-donation": { name: t.name, amount: { type: "int", min: 200, max: 400 } },
|
|
2421
|
+
"weekly-top-donation": { name: t.name, amount: { type: "int", min: 400, max: 800 } },
|
|
2422
|
+
"monthly-top-donation": { name: t.name, amount: { type: "int", min: 800, max: 1500 } },
|
|
2423
|
+
"alltime-top-donation": { name: t.name, amount: { type: "int", min: 1500, max: 2e3 } },
|
|
2424
|
+
"session-top-donator": { name: t.name, amount: { type: "int", min: 200, max: 400 } },
|
|
2425
|
+
"weekly-top-donator": { name: t.name, amount: { type: "int", min: 400, max: 800 } },
|
|
2426
|
+
"monthly-top-donator": { name: t.name, amount: { type: "int", min: 800, max: 1500 } },
|
|
2427
|
+
"alltime-top-donator": { name: t.name, amount: { type: "int", min: 1500, max: 2e3 } },
|
|
2428
|
+
recent: {
|
|
2429
|
+
type: "recent",
|
|
2430
|
+
amount: 25,
|
|
2431
|
+
value: {
|
|
2432
|
+
name: t.name,
|
|
2433
|
+
amount: { type: "int", min: 200, max: 400 },
|
|
2434
|
+
createdAt: { type: "date", range: 400 }
|
|
2435
|
+
}
|
|
3166
2436
|
}
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
event: {
|
|
3193
|
-
amount: x,
|
|
3194
|
-
name: o.toLowerCase(),
|
|
3195
|
-
displayName: o,
|
|
3196
|
-
providerId: "",
|
|
3197
|
-
...k.default,
|
|
3198
|
-
...k[j],
|
|
3199
|
-
_id: s.rand.uuid(),
|
|
3200
|
-
sessionTop: !1,
|
|
3201
|
-
type: "subscriber",
|
|
3202
|
-
originalEventName: "subscriber-latest"
|
|
3203
|
-
}
|
|
3204
|
-
};
|
|
2437
|
+
},
|
|
2438
|
+
superchat: {
|
|
2439
|
+
latest: { name: t.name, amount: { type: "int", min: 100, max: 400 } },
|
|
2440
|
+
"session-top-donation": { name: t.name, amount: { type: "int", min: 100, max: 500 } },
|
|
2441
|
+
"weekly-top-donation": { name: t.name, amount: { type: "int", min: 500, max: 1e3 } },
|
|
2442
|
+
"monthly-top-donation": { name: t.name, amount: { type: "int", min: 1e3, max: 2e3 } },
|
|
2443
|
+
"alltime-top-donation": { name: t.name, amount: { type: "int", min: 2e3, max: 2500 } },
|
|
2444
|
+
"session-top-donator": { name: t.name, amount: { type: "int", min: 100, max: 500 } },
|
|
2445
|
+
"weekly-top-donator": { name: t.name, amount: { type: "int", min: 500, max: 1e3 } },
|
|
2446
|
+
"monthly-top-donator": { name: t.name, amount: { type: "int", min: 1e3, max: 2e3 } },
|
|
2447
|
+
"alltime-top-donator": { name: t.name, amount: { type: "int", min: 2e3, max: 2500 } },
|
|
2448
|
+
session: { amount: { type: "int", min: 100, max: 500 } },
|
|
2449
|
+
week: { amount: { type: "int", min: 500, max: 1e3 } },
|
|
2450
|
+
month: { amount: { type: "int", min: 1e3, max: 2e3 } },
|
|
2451
|
+
goal: { amount: { type: "int", min: 2e3, max: 2300 } },
|
|
2452
|
+
total: { amount: { type: "int", min: 2300, max: 2500 } },
|
|
2453
|
+
count: { count: { type: "int", min: 100, max: 500 } },
|
|
2454
|
+
recent: {
|
|
2455
|
+
type: "recent",
|
|
2456
|
+
amount: 25,
|
|
2457
|
+
value: {
|
|
2458
|
+
name: t.name,
|
|
2459
|
+
amount: { type: "int", min: 100, max: 400 },
|
|
2460
|
+
createdAt: { type: "date", range: 400 }
|
|
2461
|
+
}
|
|
3205
2462
|
}
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
}
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
}
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
2463
|
+
},
|
|
2464
|
+
hypetrain: {
|
|
2465
|
+
latest: {
|
|
2466
|
+
name: t.name,
|
|
2467
|
+
amount: { type: "int", min: 0, max: 100 },
|
|
2468
|
+
active: { type: "int", min: 0, max: 1 },
|
|
2469
|
+
level: { type: "int", min: 5, max: 10 },
|
|
2470
|
+
levelChanged: { type: "int", min: 0, max: 5 },
|
|
2471
|
+
_type: { type: "array", options: ["follower", "subscriber", "cheer", "donation"] }
|
|
2472
|
+
},
|
|
2473
|
+
"level-goal": { amount: { type: "int", min: 0, max: 100 } },
|
|
2474
|
+
"level-progress": { amount: { type: "int", min: 0, max: 100 }, percent: { type: "int", min: 0, max: 100 } },
|
|
2475
|
+
total: { amount: { type: "int", min: 0, max: 100 } },
|
|
2476
|
+
"latest-top-contributors": { type: "recent", amount: 25, value: { name: t.name } }
|
|
2477
|
+
},
|
|
2478
|
+
"channel-points": {
|
|
2479
|
+
latest: {
|
|
2480
|
+
name: t.name,
|
|
2481
|
+
amount: { type: "int", min: 0, max: 100 },
|
|
2482
|
+
message: t.message,
|
|
2483
|
+
redemption: { type: "array", options: ["Reward 1", "Reward 2", "Reward 3"] }
|
|
3227
2484
|
}
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
2485
|
+
},
|
|
2486
|
+
tip: {
|
|
2487
|
+
latest: { name: t.name, amount: { type: "int", min: 100, max: 400 } },
|
|
2488
|
+
"session-top-donation": { name: t.name, amount: { type: "int", min: 100, max: 500 } },
|
|
2489
|
+
"weekly-top-donation": { name: t.name, amount: { type: "int", min: 500, max: 1e3 } },
|
|
2490
|
+
"monthly-top-donation": { name: t.name, amount: { type: "int", min: 1e3, max: 2e3 } },
|
|
2491
|
+
"alltime-top-donation": { name: t.name, amount: { type: "int", min: 2e3, max: 2500 } },
|
|
2492
|
+
"session-top-donator": { name: t.name, amount: { type: "int", min: 100, max: 500 } },
|
|
2493
|
+
"weekly-top-donator": { name: t.name, amount: { type: "int", min: 500, max: 1e3 } },
|
|
2494
|
+
"monthly-top-donator": { name: t.name, amount: { type: "int", min: 1e3, max: 2e3 } },
|
|
2495
|
+
"alltime-top-donator": { name: t.name, amount: { type: "int", min: 2e3, max: 2500 } },
|
|
2496
|
+
session: { amount: { type: "int", min: 100, max: 500 } },
|
|
2497
|
+
week: { amount: { type: "int", min: 500, max: 1e3 } },
|
|
2498
|
+
month: { amount: { type: "int", min: 1e3, max: 2e3 } },
|
|
2499
|
+
goal: { amount: { type: "int", min: 2e3, max: 2300 } },
|
|
2500
|
+
total: { amount: { type: "int", min: 2300, max: 2500 } },
|
|
2501
|
+
count: { count: { type: "int", min: 100, max: 500 } },
|
|
2502
|
+
recent: {
|
|
2503
|
+
type: "recent",
|
|
2504
|
+
amount: 25,
|
|
2505
|
+
value: {
|
|
2506
|
+
name: t.name,
|
|
2507
|
+
amount: { type: "int", min: 100, max: 400 },
|
|
2508
|
+
createdAt: { type: "date", range: 400 }
|
|
2509
|
+
}
|
|
3245
2510
|
}
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
value: a?.value ?? s.rand.number(0, 100)
|
|
3262
|
-
}
|
|
3263
|
-
};
|
|
3264
|
-
case "mute":
|
|
3265
|
-
case "unmute":
|
|
3266
|
-
case "alertService:toggleSound": {
|
|
3267
|
-
var S = a?.muted ?? !client.details.overlay.muted;
|
|
3268
|
-
return {
|
|
3269
|
-
listener: "alertService:toggleSound",
|
|
3270
|
-
event: { muted: S }
|
|
3271
|
-
};
|
|
2511
|
+
},
|
|
2512
|
+
merch: {
|
|
2513
|
+
latest: { name: t.name, amount: { type: "int", min: 0, max: 100 }, items: t.item },
|
|
2514
|
+
"goal-orders": { amount: { type: "int", min: 0, max: 100 } },
|
|
2515
|
+
"goal-items": { amount: { type: "int", min: 0, max: 100 } },
|
|
2516
|
+
"goal-total": { amount: { type: "int", min: 0, max: 100 } },
|
|
2517
|
+
recent: { type: "recent", amount: 25, value: { name: t.name } }
|
|
2518
|
+
},
|
|
2519
|
+
purchase: {
|
|
2520
|
+
latest: {
|
|
2521
|
+
name: t.name,
|
|
2522
|
+
amount: { type: "int", min: 0, max: 100 },
|
|
2523
|
+
items: t.item,
|
|
2524
|
+
avatar: t.avatar,
|
|
2525
|
+
message: t.message
|
|
3272
2526
|
}
|
|
3273
|
-
case "skip":
|
|
3274
|
-
case "event:skip":
|
|
3275
|
-
return {
|
|
3276
|
-
listener: "event:skip",
|
|
3277
|
-
event: {}
|
|
3278
|
-
};
|
|
3279
2527
|
}
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
2528
|
+
};
|
|
2529
|
+
},
|
|
2530
|
+
async get() {
|
|
2531
|
+
const t = this.available(), i = (s) => {
|
|
2532
|
+
const d = (l) => {
|
|
2533
|
+
if (!l || !("amount" in l)) return [];
|
|
2534
|
+
const h = [];
|
|
2535
|
+
for (let f = 0; f < l.amount; f++)
|
|
2536
|
+
h.push(i(l.value));
|
|
2537
|
+
return h.sort((f, v) => new Date(v.createdAt).getTime() - new Date(f.createdAt).getTime());
|
|
2538
|
+
}, o = (l) => {
|
|
2539
|
+
const h = {};
|
|
2540
|
+
for (const f in l) {
|
|
2541
|
+
const v = f.replace("_type", "type");
|
|
2542
|
+
h[v] = i(l[f]);
|
|
3286
2543
|
}
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
2544
|
+
return h;
|
|
2545
|
+
}, c = (l) => {
|
|
2546
|
+
if (!l) return l;
|
|
2547
|
+
switch (l.type) {
|
|
2548
|
+
case "int":
|
|
2549
|
+
return e.rand.number(l.min, l.max);
|
|
2550
|
+
case "string":
|
|
2551
|
+
return e.rand.array(l.options)[0];
|
|
2552
|
+
case "date":
|
|
2553
|
+
return e.rand.daysOffset(l.range);
|
|
2554
|
+
case "array":
|
|
2555
|
+
return e.rand.array(l.options)[0];
|
|
2556
|
+
case "recent":
|
|
2557
|
+
return d(l);
|
|
2558
|
+
default:
|
|
2559
|
+
return l;
|
|
2560
|
+
}
|
|
2561
|
+
};
|
|
2562
|
+
return typeof s != "object" || s === null ? s : "type" in s && typeof s.type == "string" ? c(s) : o(s);
|
|
2563
|
+
};
|
|
2564
|
+
var a = Object.entries(i(t)).reduce(
|
|
2565
|
+
(s, [d, o]) => (Object.entries(o).forEach(
|
|
2566
|
+
([c, l]) => (
|
|
2567
|
+
//
|
|
2568
|
+
s[`${d}-${c}`] = l
|
|
2569
|
+
)
|
|
2570
|
+
), s),
|
|
2571
|
+
{}
|
|
2572
|
+
);
|
|
2573
|
+
return a;
|
|
2574
|
+
}
|
|
2575
|
+
},
|
|
2576
|
+
event: {
|
|
2577
|
+
/**
|
|
2578
|
+
* Simulates the onWidgetLoad event for a widget.
|
|
2579
|
+
* @param fields - The field values to be included in the event.
|
|
2580
|
+
* @param session - The session data to be included in the event.
|
|
2581
|
+
* @param currency - The currency to be used (default is 'USD').
|
|
2582
|
+
* @returns A Promise that resolves to the simulated onWidgetLoad event data.
|
|
2583
|
+
*/
|
|
2584
|
+
async onWidgetLoad(t, i, a = "USD") {
|
|
2585
|
+
const s = {
|
|
2586
|
+
BRL: { code: "BRL", name: "Brazilian Real", symbol: "R$" },
|
|
2587
|
+
USD: { code: "USD", name: "US Dollar", symbol: "$" },
|
|
2588
|
+
EUR: { code: "EUR", name: "Euro", symbol: "€" }
|
|
2589
|
+
};
|
|
2590
|
+
return {
|
|
2591
|
+
channel: {
|
|
2592
|
+
username: "local",
|
|
2593
|
+
apiToken: "",
|
|
2594
|
+
id: "",
|
|
2595
|
+
providerId: "",
|
|
2596
|
+
avatar: ""
|
|
2597
|
+
},
|
|
2598
|
+
currency: s[a] ?? s.USD,
|
|
2599
|
+
fieldData: t,
|
|
2600
|
+
recents: [],
|
|
2601
|
+
session: {
|
|
2602
|
+
data: i,
|
|
2603
|
+
settings: {
|
|
2604
|
+
autoReset: !1,
|
|
2605
|
+
calendar: !1,
|
|
2606
|
+
resetOnStart: !1
|
|
2607
|
+
}
|
|
2608
|
+
},
|
|
2609
|
+
overlay: {
|
|
2610
|
+
isEditorMode: !0,
|
|
2611
|
+
muted: !1
|
|
2612
|
+
},
|
|
2613
|
+
emulated: !0
|
|
2614
|
+
};
|
|
2615
|
+
},
|
|
2616
|
+
/**
|
|
2617
|
+
* Simulates the onSessionUpdate event for a widget.
|
|
2618
|
+
* @param session - The session data to be included in the event.
|
|
2619
|
+
* @returns A Promise that resolves to the simulated onSessionUpdate event data.
|
|
2620
|
+
*/
|
|
2621
|
+
async onSessionUpdate(t) {
|
|
2622
|
+
return t ??= await e.generate.session.get(), { session: t };
|
|
2623
|
+
},
|
|
2624
|
+
/**
|
|
2625
|
+
* Simulates the onEventReceived event for a widget.
|
|
2626
|
+
* @param provider - The provider of the event (default is 'random').
|
|
2627
|
+
* @param type - The type of event to simulate (default is 'random').
|
|
2628
|
+
* @param options - Additional options to customize the event data.
|
|
2629
|
+
* @returns A Promise that resolves to the simulated onEventReceived event data, or null if the event type is not supported.
|
|
2630
|
+
* @example
|
|
2631
|
+
* ```javascript
|
|
2632
|
+
* // Simulate a random event
|
|
2633
|
+
* const randomEvent = await Simulation.generate.event.onEventReceived();
|
|
2634
|
+
*
|
|
2635
|
+
* // Simulate a Twitch message event with custom options
|
|
2636
|
+
* const twitchMessageEvent = await Simulation.generate.event.onEventReceived('twitch', 'message', { name: 'Streamer', message: 'Hello World!' });
|
|
2637
|
+
* ```
|
|
2638
|
+
*/
|
|
2639
|
+
async onEventReceived(t = "random", i = "random", a = {}) {
|
|
2640
|
+
const s = {
|
|
2641
|
+
twitch: ["message", "follower-latest", "cheer-latest", "raid-latest", "subscriber-latest"],
|
|
2642
|
+
streamelements: ["tip-latest"],
|
|
2643
|
+
youtube: ["message", "superchat-latest", "subscriber-latest", "sponsor-latest"],
|
|
2644
|
+
kick: [],
|
|
2645
|
+
facebook: []
|
|
2646
|
+
};
|
|
2647
|
+
switch (t) {
|
|
2648
|
+
default:
|
|
2649
|
+
case "random": {
|
|
2650
|
+
var d = e.rand.array(Object.keys(s).filter((k) => s[k].length))[0], o = e.rand.array(s[d])[0];
|
|
2651
|
+
return this.onEventReceived(d, o);
|
|
2652
|
+
}
|
|
2653
|
+
case "twitch":
|
|
2654
|
+
switch (i) {
|
|
2655
|
+
default:
|
|
2656
|
+
case "random": {
|
|
2657
|
+
var o = e.rand.array(s[t])[0];
|
|
2658
|
+
return this.onEventReceived(t, o);
|
|
2659
|
+
}
|
|
2660
|
+
case "message": {
|
|
2661
|
+
var c = a?.name ?? e.rand.array(e.data.names.filter((T) => T.length))[0], l = a?.message ?? e.rand.array(e.data.messages.filter((T) => T.length))[0], h = await B(a?.badges ?? [], t), f = U(l), v = S(l, f), b = a?.color ?? e.rand.color("hex"), j = a?.userId ?? e.rand.number(1e7, 99999999).toString(), g = Date.now();
|
|
2662
|
+
return {
|
|
2663
|
+
listener: "message",
|
|
2664
|
+
event: {
|
|
2665
|
+
service: t,
|
|
2666
|
+
data: {
|
|
2667
|
+
time: g,
|
|
2668
|
+
tags: {
|
|
2669
|
+
"badge-info": `${h.keys.map((T) => `${T}/${e.rand.number(1, 5)}`).join(",")}`,
|
|
2670
|
+
badges: h.keys.join("/1,"),
|
|
2671
|
+
mod: h.keys.includes("moderator") ? "1" : "0",
|
|
2672
|
+
subscriber: h.keys.includes("subscriber") ? "1" : "0",
|
|
2673
|
+
turbo: h.keys.includes("turbo") ? "1" : "0",
|
|
2674
|
+
"tmi-sent-ts": g.toString(),
|
|
2675
|
+
"user-id": j,
|
|
2676
|
+
"user-type": "",
|
|
2677
|
+
color: b,
|
|
2678
|
+
"display-name": c,
|
|
2679
|
+
emotes: "",
|
|
2680
|
+
"client-nonce": e.rand.string(16),
|
|
2681
|
+
flags: "",
|
|
2682
|
+
id: e.rand.uuid(),
|
|
2683
|
+
"first-msg": "0",
|
|
2684
|
+
"returning-chatter": "0"
|
|
2685
|
+
},
|
|
2686
|
+
nick: c.toLowerCase(),
|
|
2687
|
+
displayName: c,
|
|
2688
|
+
displayColor: b,
|
|
2689
|
+
channel: "local",
|
|
2690
|
+
text: l,
|
|
2691
|
+
isAction: !1,
|
|
2692
|
+
userId: j,
|
|
2693
|
+
msgId: e.rand.uuid(),
|
|
2694
|
+
badges: h.badges,
|
|
2695
|
+
emotes: f
|
|
3316
2696
|
},
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
2697
|
+
renderedText: v
|
|
2698
|
+
}
|
|
2699
|
+
};
|
|
2700
|
+
}
|
|
2701
|
+
case "cheer":
|
|
2702
|
+
case "cheer-latest": {
|
|
2703
|
+
var w = a?.amount ?? e.rand.number(100, 1e4), r = a?.avatar ?? e.rand.array(e.data.avatars)[0], c = a?.name ?? e.rand.array(e.data.names.filter((A) => A.length))[0], l = a?.message ?? e.rand.array(e.data.messages.filter((A) => A.length))[0];
|
|
2704
|
+
return {
|
|
2705
|
+
listener: "cheer-latest",
|
|
2706
|
+
event: {
|
|
2707
|
+
amount: w,
|
|
2708
|
+
avatar: r,
|
|
2709
|
+
name: c.toLowerCase(),
|
|
2710
|
+
displayName: c,
|
|
2711
|
+
message: l,
|
|
2712
|
+
providerId: "",
|
|
2713
|
+
_id: e.rand.uuid(),
|
|
2714
|
+
sessionTop: !1,
|
|
2715
|
+
type: "cheer",
|
|
2716
|
+
originalEventName: "cheer-latest"
|
|
2717
|
+
}
|
|
2718
|
+
};
|
|
2719
|
+
}
|
|
2720
|
+
case "follower":
|
|
2721
|
+
case "follower-latest": {
|
|
2722
|
+
var r = a?.avatar ?? e.rand.array(e.data.avatars)[0], c = a?.name ?? e.rand.array(e.data.names.filter((A) => A.length))[0];
|
|
2723
|
+
return {
|
|
2724
|
+
listener: "follower-latest",
|
|
2725
|
+
event: {
|
|
3328
2726
|
avatar: r,
|
|
3329
|
-
|
|
2727
|
+
name: c.toLowerCase(),
|
|
2728
|
+
displayName: c,
|
|
2729
|
+
providerId: "",
|
|
2730
|
+
_id: e.rand.uuid(),
|
|
2731
|
+
sessionTop: !1,
|
|
2732
|
+
type: "follower",
|
|
2733
|
+
originalEventName: "follower-latest"
|
|
2734
|
+
}
|
|
2735
|
+
};
|
|
2736
|
+
}
|
|
2737
|
+
case "raid":
|
|
2738
|
+
case "raid-latest": {
|
|
2739
|
+
var w = a?.amount ?? e.rand.number(1, 100), r = a?.avatar ?? e.rand.array(e.data.avatars)[0], c = a?.name ?? e.rand.array(e.data.names.filter((R) => R.length))[0];
|
|
2740
|
+
return {
|
|
2741
|
+
listener: "raid-latest",
|
|
2742
|
+
event: {
|
|
2743
|
+
amount: w,
|
|
2744
|
+
avatar: r,
|
|
2745
|
+
name: c.toLowerCase(),
|
|
2746
|
+
displayName: c,
|
|
2747
|
+
providerId: "",
|
|
2748
|
+
_id: e.rand.uuid(),
|
|
2749
|
+
sessionTop: !1,
|
|
2750
|
+
type: "raid",
|
|
2751
|
+
originalEventName: "raid-latest"
|
|
2752
|
+
}
|
|
2753
|
+
};
|
|
2754
|
+
}
|
|
2755
|
+
case "subscriber":
|
|
2756
|
+
case "subscriber-latest": {
|
|
2757
|
+
var m = a?.tier ?? e.rand.array(["1000", "2000", "3000"])[0], w = a?.amount ?? e.rand.number(1, 24), r = a?.avatar ?? e.rand.array(e.data.avatars)[0], c = a?.name ?? e.rand.array(e.data.names.filter((M) => M.length))[0], p = a?.sender ?? e.rand.array(e.data.names.filter((M) => M.length && M !== c))[0], l = a?.message ?? e.rand.array(e.data.messages.filter((M) => M.length))[0], u = {
|
|
2758
|
+
default: {
|
|
2759
|
+
avatar: r,
|
|
2760
|
+
tier: m,
|
|
2761
|
+
playedAsCommunityGift: !1
|
|
3330
2762
|
},
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
2763
|
+
gift: {
|
|
2764
|
+
sender: p,
|
|
2765
|
+
gifted: !0
|
|
2766
|
+
},
|
|
2767
|
+
community: {
|
|
2768
|
+
message: l,
|
|
2769
|
+
sender: p,
|
|
2770
|
+
bulkGifted: !0
|
|
2771
|
+
},
|
|
2772
|
+
spam: {
|
|
2773
|
+
sender: p,
|
|
2774
|
+
gifted: !0,
|
|
2775
|
+
isCommunityGift: !0
|
|
2776
|
+
}
|
|
2777
|
+
}, E = ["default", "gift", "community", "spam"], y = a?.subType ?? e.rand.array(E)[0];
|
|
2778
|
+
return y = E.includes(y) ? y : "default", {
|
|
2779
|
+
listener: "subscriber-latest",
|
|
2780
|
+
event: {
|
|
2781
|
+
amount: w,
|
|
2782
|
+
name: c.toLowerCase(),
|
|
2783
|
+
displayName: c,
|
|
2784
|
+
providerId: "",
|
|
2785
|
+
...u.default,
|
|
2786
|
+
...u[y],
|
|
2787
|
+
_id: e.rand.uuid(),
|
|
2788
|
+
sessionTop: !1,
|
|
2789
|
+
type: "subscriber",
|
|
2790
|
+
originalEventName: "subscriber-latest"
|
|
2791
|
+
}
|
|
2792
|
+
};
|
|
2793
|
+
}
|
|
2794
|
+
case "delete-message":
|
|
2795
|
+
return {
|
|
2796
|
+
listener: "delete-message",
|
|
2797
|
+
event: {
|
|
2798
|
+
msgId: a?.id ?? e.rand.uuid()
|
|
2799
|
+
}
|
|
2800
|
+
};
|
|
2801
|
+
case "delete-messages":
|
|
2802
|
+
return {
|
|
2803
|
+
listener: "delete-messages",
|
|
2804
|
+
event: {
|
|
2805
|
+
userId: a?.id ?? e.rand.number(1e7, 99999999).toString()
|
|
2806
|
+
}
|
|
2807
|
+
};
|
|
3351
2808
|
}
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
2809
|
+
case "streamelements":
|
|
2810
|
+
switch (i) {
|
|
2811
|
+
default:
|
|
2812
|
+
case "random": {
|
|
2813
|
+
var o = e.rand.array(s[t])[0];
|
|
2814
|
+
return this.onEventReceived(t, o);
|
|
2815
|
+
}
|
|
2816
|
+
case "tip":
|
|
2817
|
+
case "tip-latest": {
|
|
2818
|
+
var w = a?.amount ?? e.rand.number(100, 4e3), r = a?.avatar ?? e.rand.array(e.data.avatars)[0], c = a?.name ?? e.rand.array(e.data.names.filter((R) => R.length))[0];
|
|
2819
|
+
return {
|
|
2820
|
+
listener: "tip-latest",
|
|
2821
|
+
event: {
|
|
2822
|
+
amount: w,
|
|
2823
|
+
avatar: r,
|
|
2824
|
+
name: c.toLowerCase(),
|
|
2825
|
+
displayName: c,
|
|
2826
|
+
providerId: "",
|
|
2827
|
+
_id: e.rand.uuid(),
|
|
2828
|
+
sessionTop: !1,
|
|
2829
|
+
type: "tip",
|
|
2830
|
+
originalEventName: "tip-latest"
|
|
2831
|
+
}
|
|
2832
|
+
};
|
|
2833
|
+
}
|
|
2834
|
+
case "kvstore:update":
|
|
2835
|
+
return {
|
|
2836
|
+
listener: "kvstore:update",
|
|
2837
|
+
event: {
|
|
2838
|
+
data: {
|
|
2839
|
+
key: `customWidget.${a?.key ?? "sampleKey"}`,
|
|
2840
|
+
value: a?.value ?? "sampleValue"
|
|
2841
|
+
}
|
|
2842
|
+
}
|
|
2843
|
+
};
|
|
2844
|
+
case "bot:counter":
|
|
2845
|
+
return {
|
|
2846
|
+
listener: "bot:counter",
|
|
2847
|
+
event: {
|
|
2848
|
+
counter: a?.counter ?? "sampleCounter",
|
|
2849
|
+
value: a?.value ?? e.rand.number(0, 100)
|
|
2850
|
+
}
|
|
2851
|
+
};
|
|
2852
|
+
case "mute":
|
|
2853
|
+
case "unmute":
|
|
2854
|
+
case "alertService:toggleSound": {
|
|
2855
|
+
var x = a?.muted ?? !client.details.overlay.muted;
|
|
2856
|
+
return {
|
|
2857
|
+
listener: "alertService:toggleSound",
|
|
2858
|
+
event: { muted: x }
|
|
2859
|
+
};
|
|
2860
|
+
}
|
|
2861
|
+
case "skip":
|
|
2862
|
+
case "event:skip":
|
|
2863
|
+
return {
|
|
2864
|
+
listener: "event:skip",
|
|
2865
|
+
event: {}
|
|
2866
|
+
};
|
|
3369
2867
|
}
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
2868
|
+
case "youtube":
|
|
2869
|
+
switch (i) {
|
|
2870
|
+
default:
|
|
2871
|
+
case "random": {
|
|
2872
|
+
var o = e.rand.array(s[t])[0];
|
|
2873
|
+
return this.onEventReceived(t, o);
|
|
2874
|
+
}
|
|
2875
|
+
case "message": {
|
|
2876
|
+
var c = a?.name ?? e.rand.array(e.data.names.filter((L) => L.length))[0], l = a?.message ?? e.rand.array(e.data.messages.filter((L) => L.length))[0];
|
|
2877
|
+
const D = await B(a?.badges ?? [], t);
|
|
2878
|
+
var f = U(l), v = S(l, f), b = a?.color ?? e.rand.color("hex"), j = a?.userId ?? e.rand.number(1e7, 99999999).toString(), g = Date.now(), r = a?.avatar ?? e.rand.array(e.data.avatars)[0];
|
|
2879
|
+
return {
|
|
2880
|
+
listener: "message",
|
|
2881
|
+
event: {
|
|
2882
|
+
service: "youtube",
|
|
2883
|
+
data: {
|
|
2884
|
+
kind: "",
|
|
2885
|
+
etag: "",
|
|
2886
|
+
id: "",
|
|
2887
|
+
snippet: {
|
|
2888
|
+
type: "",
|
|
2889
|
+
liveChatId: "",
|
|
2890
|
+
authorChannelId: "local",
|
|
2891
|
+
publishedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2892
|
+
hasDisplayContent: !0,
|
|
2893
|
+
displayMessage: l,
|
|
2894
|
+
textMessageDetails: {
|
|
2895
|
+
messageText: l
|
|
2896
|
+
}
|
|
2897
|
+
},
|
|
2898
|
+
authorDetails: {
|
|
2899
|
+
channelId: "local",
|
|
2900
|
+
channelUrl: "",
|
|
2901
|
+
displayName: c,
|
|
2902
|
+
profileImageUrl: r,
|
|
2903
|
+
...D
|
|
2904
|
+
},
|
|
2905
|
+
msgId: e.rand.uuid(),
|
|
2906
|
+
userId: e.rand.uuid(),
|
|
2907
|
+
nick: c.toLowerCase(),
|
|
2908
|
+
badges: [],
|
|
2909
|
+
displayName: c,
|
|
2910
|
+
isAction: !1,
|
|
2911
|
+
time: Date.now(),
|
|
2912
|
+
tags: [],
|
|
2913
|
+
displayColor: e.rand.color("hex"),
|
|
2914
|
+
channel: "local",
|
|
2915
|
+
text: l,
|
|
2916
|
+
avatar: r,
|
|
2917
|
+
emotes: []
|
|
2918
|
+
},
|
|
2919
|
+
renderedText: l
|
|
2920
|
+
}
|
|
2921
|
+
};
|
|
2922
|
+
}
|
|
2923
|
+
case "subscriber":
|
|
2924
|
+
case "subscriber-latest": {
|
|
2925
|
+
var r = a?.avatar ?? e.rand.array(e.data.avatars)[0], c = a?.name ?? e.rand.array(e.data.names.filter((A) => A.length))[0];
|
|
2926
|
+
return {
|
|
2927
|
+
listener: "subscriber-latest",
|
|
2928
|
+
event: {
|
|
2929
|
+
avatar: r,
|
|
2930
|
+
displayName: c,
|
|
2931
|
+
name: c.toLowerCase(),
|
|
2932
|
+
providerId: "",
|
|
2933
|
+
_id: e.rand.uuid(),
|
|
2934
|
+
sessionTop: !1,
|
|
2935
|
+
type: "subscriber",
|
|
2936
|
+
originalEventName: "subscriber-latest"
|
|
2937
|
+
}
|
|
2938
|
+
};
|
|
2939
|
+
}
|
|
2940
|
+
case "superchat":
|
|
2941
|
+
case "superchat-latest": {
|
|
2942
|
+
var w = a?.amount ?? e.rand.number(100, 4e3), r = a?.avatar ?? e.rand.array(e.data.avatars)[0], c = a?.name ?? e.rand.array(e.data.names.filter((R) => R.length))[0];
|
|
2943
|
+
return {
|
|
2944
|
+
listener: "superchat-latest",
|
|
2945
|
+
event: {
|
|
2946
|
+
amount: w,
|
|
2947
|
+
avatar: r,
|
|
2948
|
+
name: c.toLowerCase(),
|
|
2949
|
+
displayName: c,
|
|
2950
|
+
providerId: "",
|
|
2951
|
+
_id: e.rand.uuid(),
|
|
2952
|
+
sessionTop: !1,
|
|
2953
|
+
type: "superchat",
|
|
2954
|
+
originalEventName: "superchat-latest"
|
|
2955
|
+
}
|
|
2956
|
+
};
|
|
2957
|
+
}
|
|
2958
|
+
case "sponsor":
|
|
2959
|
+
case "sponsor-latest": {
|
|
2960
|
+
var m = a?.tier ?? e.rand.array(["1000", "2000", "3000"])[0], w = a?.amount ?? e.rand.number(1, 24), r = a?.avatar ?? e.rand.array(e.data.avatars)[0], c = a?.name ?? e.rand.array(e.data.names.filter((L) => L.length))[0], p = a?.sender ?? e.rand.array(e.data.names.filter((L) => L.length && L !== c))[0], l = a?.message ?? e.rand.array(e.data.messages.filter((L) => L.length))[0], u = {
|
|
2961
|
+
default: {
|
|
2962
|
+
avatar: r,
|
|
2963
|
+
tier: m,
|
|
2964
|
+
playedAsCommunityGift: !1
|
|
2965
|
+
},
|
|
2966
|
+
gift: {
|
|
2967
|
+
sender: p,
|
|
2968
|
+
gifted: !0
|
|
2969
|
+
},
|
|
2970
|
+
community: {
|
|
2971
|
+
message: l,
|
|
2972
|
+
sender: p,
|
|
2973
|
+
bulkGifted: !0
|
|
2974
|
+
},
|
|
2975
|
+
spam: {
|
|
2976
|
+
sender: p,
|
|
2977
|
+
gifted: !0,
|
|
2978
|
+
isCommunityGift: !0
|
|
2979
|
+
}
|
|
2980
|
+
}, E = ["default", "gift", "community", "spam"], y = a?.subType ?? e.rand.array(E)[0];
|
|
2981
|
+
return y = E.includes(y) ? y : "default", {
|
|
2982
|
+
listener: "sponsor-latest",
|
|
2983
|
+
event: {
|
|
2984
|
+
amount: w,
|
|
2985
|
+
name: c.toLowerCase(),
|
|
2986
|
+
displayName: c,
|
|
2987
|
+
providerId: "",
|
|
2988
|
+
...u.default,
|
|
2989
|
+
...u[y],
|
|
2990
|
+
_id: e.rand.uuid(),
|
|
2991
|
+
sessionTop: !1,
|
|
2992
|
+
type: "sponsor",
|
|
2993
|
+
originalEventName: "sponsor-latest"
|
|
2994
|
+
}
|
|
2995
|
+
};
|
|
2996
|
+
}
|
|
3408
2997
|
}
|
|
3409
|
-
|
|
2998
|
+
}
|
|
2999
|
+
}
|
|
3000
|
+
}
|
|
3001
|
+
}, e.emulate = {
|
|
3002
|
+
twitch: {
|
|
3003
|
+
message(t = {}) {
|
|
3004
|
+
e.generate.event.onEventReceived("twitch", "message", t).then((i) => {
|
|
3005
|
+
i && e.emulate.send("onEventReceived", i);
|
|
3006
|
+
});
|
|
3007
|
+
},
|
|
3008
|
+
follower(t = {}) {
|
|
3009
|
+
e.generate.event.onEventReceived("twitch", "follower-latest", t).then((i) => {
|
|
3010
|
+
i && e.emulate.send("onEventReceived", i);
|
|
3011
|
+
});
|
|
3012
|
+
},
|
|
3013
|
+
raid(t = {}) {
|
|
3014
|
+
e.generate.event.onEventReceived("twitch", "raid-latest", t).then((i) => {
|
|
3015
|
+
i && e.emulate.send("onEventReceived", i);
|
|
3016
|
+
});
|
|
3017
|
+
},
|
|
3018
|
+
cheer(t = {}) {
|
|
3019
|
+
e.generate.event.onEventReceived("twitch", "cheer-latest", t).then((i) => {
|
|
3020
|
+
i && e.emulate.send("onEventReceived", i);
|
|
3021
|
+
});
|
|
3022
|
+
},
|
|
3023
|
+
subscriber(t = {}) {
|
|
3024
|
+
e.generate.event.onEventReceived("twitch", "subscriber-latest", t).then((i) => {
|
|
3025
|
+
i && e.emulate.send("onEventReceived", i);
|
|
3026
|
+
});
|
|
3027
|
+
}
|
|
3028
|
+
},
|
|
3029
|
+
streamelements: {
|
|
3030
|
+
tip(t = {}) {
|
|
3031
|
+
e.generate.event.onEventReceived("streamelements", "tip-latest", t).then((i) => {
|
|
3032
|
+
i && e.emulate.send("onEventReceived", i);
|
|
3033
|
+
});
|
|
3034
|
+
}
|
|
3035
|
+
},
|
|
3036
|
+
youtube: {
|
|
3037
|
+
message(t = {}) {
|
|
3038
|
+
e.generate.event.onEventReceived("youtube", "message", t).then((i) => {
|
|
3039
|
+
i && e.emulate.send("onEventReceived", i);
|
|
3040
|
+
});
|
|
3041
|
+
},
|
|
3042
|
+
subscriber(t = {}) {
|
|
3043
|
+
e.generate.event.onEventReceived("youtube", "subscriber-latest", t).then((i) => {
|
|
3044
|
+
i && e.emulate.send("onEventReceived", i);
|
|
3045
|
+
});
|
|
3046
|
+
},
|
|
3047
|
+
superchat(t = {}) {
|
|
3048
|
+
e.generate.event.onEventReceived("youtube", "superchat-latest", t).then((i) => {
|
|
3049
|
+
i && e.emulate.send("onEventReceived", i);
|
|
3050
|
+
});
|
|
3051
|
+
},
|
|
3052
|
+
sponsor(t = {}) {
|
|
3053
|
+
e.generate.event.onEventReceived("youtube", "sponsor-latest", t).then((i) => {
|
|
3054
|
+
i && e.emulate.send("onEventReceived", i);
|
|
3055
|
+
});
|
|
3410
3056
|
}
|
|
3057
|
+
},
|
|
3058
|
+
kick: {},
|
|
3059
|
+
facebook: {},
|
|
3060
|
+
send(t, i) {
|
|
3061
|
+
window.dispatchEvent(new CustomEvent(t, { detail: i }));
|
|
3062
|
+
}
|
|
3063
|
+
};
|
|
3064
|
+
async function n(t = ["fields.json", "cf.json", "field.json", "customfields.json"], i = ["data.json", "fielddata.json", "fd.json", "DATA.json"]) {
|
|
3065
|
+
const a = {
|
|
3066
|
+
fields: t.find((d) => {
|
|
3067
|
+
try {
|
|
3068
|
+
return new URL("./" + d, window.location.href), !0;
|
|
3069
|
+
} catch {
|
|
3070
|
+
return !1;
|
|
3071
|
+
}
|
|
3072
|
+
}),
|
|
3073
|
+
data: i.find((d) => {
|
|
3074
|
+
try {
|
|
3075
|
+
return new URL("./" + d, window.location.href), !0;
|
|
3076
|
+
} catch {
|
|
3077
|
+
return !1;
|
|
3078
|
+
}
|
|
3079
|
+
})
|
|
3080
|
+
}, s = await fetch("./" + (a.data ?? "data.json"), {
|
|
3081
|
+
cache: "no-store"
|
|
3082
|
+
}).then((d) => d.json()).catch(() => ({}));
|
|
3083
|
+
await fetch("./" + (a.fields ?? "fields.json"), {
|
|
3084
|
+
cache: "no-store"
|
|
3085
|
+
}).then((d) => d.json()).then(async (d) => {
|
|
3086
|
+
const o = Object.entries(d).filter(([l, { value: h }]) => h != null).reduce(
|
|
3087
|
+
(l, [h, { value: f }]) => (s && s[h] !== void 0 && (f = s[h]), l[h] = f, l),
|
|
3088
|
+
{
|
|
3089
|
+
...s
|
|
3090
|
+
}
|
|
3091
|
+
), c = await e.generate.event.onWidgetLoad(o, await e.generate.session.get());
|
|
3092
|
+
window.dispatchEvent(new CustomEvent("onWidgetLoad", { detail: c }));
|
|
3093
|
+
});
|
|
3094
|
+
}
|
|
3095
|
+
e.start = n;
|
|
3096
|
+
})(I || (I = {}));
|
|
3097
|
+
function U(e, n = I.data.emotes) {
|
|
3098
|
+
const t = [];
|
|
3099
|
+
return n.forEach((i) => {
|
|
3100
|
+
const a = i.name;
|
|
3101
|
+
let s = 0, d = 0;
|
|
3102
|
+
for (; s < e.length; ) {
|
|
3103
|
+
const o = e.indexOf(a, d);
|
|
3104
|
+
if (o === -1) break;
|
|
3105
|
+
const c = o > 0 ? e[o - 1] : " ", l = o + a.length < e.length ? e[o + a.length] : " ";
|
|
3106
|
+
/\s/.test(c) && /\s/.test(l) && t.push({ ...i, start: o, end: o + a.length }), d = o + 1;
|
|
3107
|
+
}
|
|
3108
|
+
}), t.sort((i, a) => i.start - a.start);
|
|
3109
|
+
}
|
|
3110
|
+
function S(e, n) {
|
|
3111
|
+
if (!n.length) return e;
|
|
3112
|
+
let t = "", i = 0;
|
|
3113
|
+
return n.forEach((a) => {
|
|
3114
|
+
t += e.substring(i, a.start);
|
|
3115
|
+
const d = Array.from({ ...a.urls, length: 5 }).slice(1).reverse().filter(Boolean)[0] || a.urls[1];
|
|
3116
|
+
t += `<img src="${d}" alt="${a.name}" class="emote" style="width: auto; height: 1em; vertical-align: middle;" />`, i = a.end;
|
|
3117
|
+
}), t += e.substring(i), t;
|
|
3118
|
+
}
|
|
3119
|
+
async function B(e = [], n = "twitch") {
|
|
3120
|
+
if (!Array.isArray(e) && typeof e == "string" && (e = e.split(",").map((d) => d.trim())), !e || !e.length) {
|
|
3121
|
+
var t = I.rand.number(1, 3);
|
|
3122
|
+
for await (const d of Array.from({ length: t }, () => "")) {
|
|
3123
|
+
var i = I.rand.array(Object.keys(I.data.badges))[0];
|
|
3124
|
+
!e.includes(i) && Array.isArray(e) ? e.push(i) : e = [i];
|
|
3411
3125
|
}
|
|
3412
3126
|
}
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
e
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3127
|
+
var a;
|
|
3128
|
+
switch (n) {
|
|
3129
|
+
case "twitch": {
|
|
3130
|
+
a = {
|
|
3131
|
+
keys: Array.from(e).filter((d) => d in I.data.badges),
|
|
3132
|
+
badges: Array.from(e).slice(0, 3).map((d) => I.data.badges[d]).filter(Boolean)
|
|
3133
|
+
};
|
|
3134
|
+
break;
|
|
3135
|
+
}
|
|
3136
|
+
case "youtube": {
|
|
3137
|
+
var s = {
|
|
3138
|
+
verified: { isVerified: !1 },
|
|
3139
|
+
broadcaster: { isChatOwner: !1 },
|
|
3140
|
+
host: { isChatOwner: !1 },
|
|
3141
|
+
sponsor: { isChatSponsor: !1 },
|
|
3142
|
+
subscriber: { isChatSponsor: !1 },
|
|
3143
|
+
moderator: { isChatModerator: !1 }
|
|
3144
|
+
};
|
|
3145
|
+
a = Object.entries(e).reduce(
|
|
3146
|
+
(d, [o]) => (o in s && Object.assign(d, s[o]), d),
|
|
3147
|
+
{
|
|
3148
|
+
isVerified: !1,
|
|
3149
|
+
isChatOwner: !1,
|
|
3150
|
+
isChatSponsor: !1,
|
|
3151
|
+
isChatModerator: !1
|
|
3152
|
+
}
|
|
3153
|
+
);
|
|
3154
|
+
break;
|
|
3439
3155
|
}
|
|
3156
|
+
}
|
|
3157
|
+
return a;
|
|
3158
|
+
}
|
|
3159
|
+
const H = {
|
|
3160
|
+
getOverlayStatus: () => ({
|
|
3161
|
+
isEditorMode: !1,
|
|
3162
|
+
muted: !1
|
|
3163
|
+
}),
|
|
3164
|
+
resumeQueue: () => {
|
|
3440
3165
|
},
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3166
|
+
responses: {},
|
|
3167
|
+
sendMessage(e, n) {
|
|
3168
|
+
},
|
|
3169
|
+
counters: {
|
|
3170
|
+
get(e) {
|
|
3171
|
+
return null;
|
|
3446
3172
|
}
|
|
3447
3173
|
},
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3174
|
+
sanitize(e) {
|
|
3175
|
+
return e;
|
|
3176
|
+
},
|
|
3177
|
+
cheerFilter(e) {
|
|
3178
|
+
return e;
|
|
3179
|
+
},
|
|
3180
|
+
setField(e, n, t) {
|
|
3181
|
+
},
|
|
3182
|
+
store: {
|
|
3183
|
+
set: function(e, n) {
|
|
3184
|
+
this.list[e] = n, localStorage.setItem("SE_API-STORE", JSON.stringify(H.store.list));
|
|
3458
3185
|
},
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
e && s.emulate.send("onEventReceived", e);
|
|
3462
|
-
});
|
|
3186
|
+
get: async function(e) {
|
|
3187
|
+
return this.list[e] ? this.list[e] : null;
|
|
3463
3188
|
},
|
|
3464
|
-
|
|
3465
|
-
s.generate.event.onEventReceived("youtube", "sponsor-latest", t).then((e) => {
|
|
3466
|
-
e && s.emulate.send("onEventReceived", e);
|
|
3467
|
-
});
|
|
3468
|
-
}
|
|
3469
|
-
},
|
|
3470
|
-
kick: {},
|
|
3471
|
-
facebook: {},
|
|
3472
|
-
send(t, e) {
|
|
3473
|
-
window.dispatchEvent(new CustomEvent(t, { detail: e }));
|
|
3189
|
+
list: {}
|
|
3474
3190
|
}
|
|
3475
3191
|
};
|
|
3476
|
-
|
|
3477
|
-
|
|
3192
|
+
async function et() {
|
|
3193
|
+
let e = localStorage.getItem("SE_API-STORE") ?? "", n = e ? JSON.parse(e) : {};
|
|
3194
|
+
return H.store.list = n, H;
|
|
3195
|
+
}
|
|
3196
|
+
class O {
|
|
3478
3197
|
constructor() {
|
|
3479
|
-
this.
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
name: "received",
|
|
3527
|
-
color: "#E6BBFF",
|
|
3528
|
-
background: "transparent",
|
|
3529
|
-
bold: !1,
|
|
3530
|
-
italic: !1,
|
|
3531
|
-
fontSize: 14,
|
|
3532
|
-
template: { before: " ⬇ ", after: "" }
|
|
3533
|
-
},
|
|
3534
|
-
{
|
|
3535
|
-
name: "simple",
|
|
3536
|
-
color: "#f5c6cb",
|
|
3537
|
-
background: "transparent",
|
|
3538
|
-
bold: !1,
|
|
3539
|
-
italic: !1,
|
|
3540
|
-
fontSize: 14,
|
|
3541
|
-
template: { before: "", after: "" }
|
|
3542
|
-
},
|
|
3543
|
-
{
|
|
3544
|
-
name: "info",
|
|
3545
|
-
color: "#f6c6cb",
|
|
3546
|
-
background: "transparent",
|
|
3547
|
-
bold: !1,
|
|
3548
|
-
italic: !1,
|
|
3549
|
-
fontSize: 14,
|
|
3550
|
-
template: { before: " ℹ ", after: "" }
|
|
3551
|
-
}
|
|
3552
|
-
], this.error = () => {
|
|
3553
|
-
}, this.success = () => {
|
|
3554
|
-
}, this.alert = () => {
|
|
3555
|
-
}, this.warn = () => {
|
|
3556
|
-
}, this.status = () => {
|
|
3557
|
-
}, this.received = () => {
|
|
3558
|
-
}, this.simple = () => {
|
|
3559
|
-
}, this.info = () => {
|
|
3560
|
-
}, this.themes.forEach((t) => {
|
|
3561
|
-
const e = [];
|
|
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`);
|
|
3563
|
-
const a = "%c", n = (...i) => {
|
|
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 = [
|
|
3565
|
-
d.length > 0 ? a + (t.template?.before ?? "") + d.join(" ") + (t.template?.after ?? "") : null,
|
|
3566
|
-
l,
|
|
3567
|
-
...o
|
|
3568
|
-
].filter(Boolean);
|
|
3569
|
-
return console.log(...f);
|
|
3570
|
-
};
|
|
3571
|
-
this[t.name] = n;
|
|
3572
|
-
});
|
|
3198
|
+
this.registeredEvents = {};
|
|
3199
|
+
}
|
|
3200
|
+
/**
|
|
3201
|
+
* Emits an event to all registered listeners.
|
|
3202
|
+
* Returns an array of return values from the listeners.
|
|
3203
|
+
* @param eventName The name of the event.
|
|
3204
|
+
* @param args Arguments to pass to the listeners.
|
|
3205
|
+
*/
|
|
3206
|
+
emit(n, ...t) {
|
|
3207
|
+
return (this.registeredEvents[n] || []).map((a) => a.apply(this, t));
|
|
3208
|
+
}
|
|
3209
|
+
/**
|
|
3210
|
+
* Registers an event listener.
|
|
3211
|
+
* @param eventName The name of the event.
|
|
3212
|
+
* @param callback The callback function.
|
|
3213
|
+
*/
|
|
3214
|
+
on(n, t) {
|
|
3215
|
+
if (typeof t != "function")
|
|
3216
|
+
throw new TypeError("Callback must be a function");
|
|
3217
|
+
return this.registeredEvents[n] || (this.registeredEvents[n] = []), this.registeredEvents[n].push(t), this;
|
|
3218
|
+
}
|
|
3219
|
+
/**
|
|
3220
|
+
* Removes a specific event listener.
|
|
3221
|
+
* @param eventName The name of the event.
|
|
3222
|
+
* @param callback The callback function to remove.
|
|
3223
|
+
*/
|
|
3224
|
+
off(n, t) {
|
|
3225
|
+
const i = this.registeredEvents[n] || [];
|
|
3226
|
+
return t ? (this.registeredEvents[n] = i.filter((a) => a !== t), this) : (this.registeredEvents[n] = [], this);
|
|
3227
|
+
}
|
|
3228
|
+
/**
|
|
3229
|
+
* Registers a listener that is executed only once.
|
|
3230
|
+
* @param eventName The name of the event.
|
|
3231
|
+
* @param callback The callback function.
|
|
3232
|
+
*/
|
|
3233
|
+
once(n, t) {
|
|
3234
|
+
const i = (...a) => {
|
|
3235
|
+
this.off(n, i), t.apply(this, a);
|
|
3236
|
+
};
|
|
3237
|
+
return this.on(n, i), this;
|
|
3238
|
+
}
|
|
3239
|
+
/**
|
|
3240
|
+
* Removes all listeners for a specific event.
|
|
3241
|
+
* @param eventName The name of the event.
|
|
3242
|
+
*/
|
|
3243
|
+
removeAllListeners(n) {
|
|
3244
|
+
return this.registeredEvents[n] = [], this;
|
|
3573
3245
|
}
|
|
3574
3246
|
}
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3247
|
+
var F = [];
|
|
3248
|
+
class $ extends O {
|
|
3249
|
+
constructor(n) {
|
|
3250
|
+
super(), this.id = "default", this.loaded = !1, this.SE_API = null, this.id = n.id || this.id, this.data = n.data ?? {}, F.push(this), this.start();
|
|
3578
3251
|
}
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3252
|
+
start() {
|
|
3253
|
+
W?.then((n) => {
|
|
3254
|
+
this.SE_API = n, n.store.get(this.id).then((t) => {
|
|
3255
|
+
this.data = t ?? this.data, this.loaded = !0, this.emit("load", this.data), JSON.stringify(this.data) !== JSON.stringify(t) && this.emit("update", this.data);
|
|
3256
|
+
}).catch(() => {
|
|
3257
|
+
this.loaded = !0, this.emit("load", null);
|
|
3258
|
+
});
|
|
3259
|
+
});
|
|
3587
3260
|
}
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3261
|
+
/**
|
|
3262
|
+
* Saves the current data to storage.
|
|
3263
|
+
* @param data Data to save (defaults to current)
|
|
3264
|
+
*/
|
|
3265
|
+
save(n = this.data) {
|
|
3266
|
+
this.loaded && this.SE_API && (this.data = n, this.SE_API.store.set(this.id, this.data), this.emit("update", this.data));
|
|
3267
|
+
}
|
|
3268
|
+
/**
|
|
3269
|
+
* Updates the storage data and emits an update event
|
|
3270
|
+
* @param data Data to update (defaults to current)
|
|
3271
|
+
*/
|
|
3272
|
+
update(n = this.data) {
|
|
3273
|
+
this.loaded && JSON.stringify(this.data) !== JSON.stringify(n) && (this.data = { ...this.data, ...n }, this.save(this.data));
|
|
3274
|
+
}
|
|
3275
|
+
/**
|
|
3276
|
+
* Adds a value to the storage at the specified path.
|
|
3277
|
+
* @param path Path to add the value to
|
|
3278
|
+
* @param value Value to add
|
|
3279
|
+
*/
|
|
3280
|
+
add(n, t) {
|
|
3281
|
+
this.loaded && ($.setByPath(this.data, n, t), this.save(this.data));
|
|
3282
|
+
}
|
|
3283
|
+
/**
|
|
3284
|
+
* Clears all data from the storage.
|
|
3285
|
+
*/
|
|
3286
|
+
clear() {
|
|
3287
|
+
this.loaded && (this.data = {}, this.save(this.data));
|
|
3288
|
+
}
|
|
3289
|
+
/**
|
|
3290
|
+
* Sets a value in the storage at the specified path.
|
|
3291
|
+
* @param obj The object to set the value in
|
|
3292
|
+
* @param path The path to set the value at
|
|
3293
|
+
* @param value The value to set
|
|
3294
|
+
* @returns The updated object
|
|
3295
|
+
*/
|
|
3296
|
+
static setByPath(n, t, i) {
|
|
3297
|
+
const a = t.split(".");
|
|
3298
|
+
let s = n;
|
|
3299
|
+
for (let d = 0; d < a.length - 1; d++)
|
|
3300
|
+
(typeof s[a[d]] != "object" || s[a[d]] == null) && (s[a[d]] = {}), s = s[a[d]];
|
|
3301
|
+
return s[a[a.length - 1]] = i, s;
|
|
3302
|
+
}
|
|
3303
|
+
on(n, t) {
|
|
3304
|
+
return n === "load" && this.loaded ? (t.apply(this, [this.data]), this) : (super.on(n, t), this);
|
|
3305
|
+
}
|
|
3306
|
+
}
|
|
3307
|
+
class C extends O {
|
|
3308
|
+
constructor(n) {
|
|
3309
|
+
super(), this.id = "default", this.fields = {}, this.loaded = !1, this.actions = {
|
|
3310
|
+
commands: [],
|
|
3311
|
+
buttons: []
|
|
3312
|
+
}, this.cache = {
|
|
3313
|
+
avatar: 30,
|
|
3314
|
+
pronoun: 30,
|
|
3315
|
+
emote: 30
|
|
3316
|
+
}, this.id = n.id || this.id, this.storage = new $({
|
|
3317
|
+
id: this.id,
|
|
3318
|
+
data: {
|
|
3319
|
+
user: {},
|
|
3320
|
+
avatar: {},
|
|
3321
|
+
pronoun: {},
|
|
3322
|
+
emote: {}
|
|
3323
|
+
}
|
|
3324
|
+
}), window.client = this;
|
|
3325
|
+
}
|
|
3326
|
+
on(n, t) {
|
|
3327
|
+
return n === "load" && this.loaded ? (t.apply(this, [
|
|
3328
|
+
{
|
|
3329
|
+
channel: this.details.user,
|
|
3330
|
+
currency: this.details.currency,
|
|
3331
|
+
fieldData: this.fields,
|
|
3332
|
+
recents: [],
|
|
3333
|
+
session: {
|
|
3334
|
+
data: this.session,
|
|
3335
|
+
settings: {
|
|
3336
|
+
autoReset: !1,
|
|
3337
|
+
calendar: !1,
|
|
3338
|
+
resetOnStart: !1
|
|
3598
3339
|
}
|
|
3599
|
-
|
|
3600
|
-
|
|
3340
|
+
},
|
|
3341
|
+
overlay: this.details.overlay,
|
|
3342
|
+
emulated: !1
|
|
3601
3343
|
}
|
|
3602
|
-
|
|
3603
|
-
return !1;
|
|
3604
|
-
} finally {
|
|
3605
|
-
return !1;
|
|
3606
|
-
}
|
|
3344
|
+
]), this) : (super.on(n, t), this);
|
|
3607
3345
|
}
|
|
3608
3346
|
}
|
|
3609
|
-
class
|
|
3610
|
-
constructor(
|
|
3611
|
-
this.prefix = "!", this.arguments = !1, this.test = `${this.prefix}${this.name} arg1 arg2`, this.aliases = [], this.permissions = void 0, this.admins = [], window.client instanceof
|
|
3347
|
+
class _ {
|
|
3348
|
+
constructor(n) {
|
|
3349
|
+
this.prefix = "!", this.arguments = !1, this.test = `${this.prefix}${this.name} arg1 arg2`, this.aliases = [], this.permissions = void 0, this.admins = [], window.client instanceof C && (this.prefix = n.prefix ?? this.prefix, this.name = n.name, this.description = n.description ?? this.description, this.arguments = n.arguments ?? this.arguments, this.run = n.run, this.test = n.test ?? this.test, this.aliases = n.aliases ?? this.aliases, this.permissions = n.permissions ?? this.permissions, this.admins = n.admins ?? this.admins, window.client.actions.commands.push(this), window.client.emit("action", this, "created"));
|
|
3612
3350
|
}
|
|
3613
|
-
run(
|
|
3351
|
+
run(n, t) {
|
|
3614
3352
|
}
|
|
3615
|
-
verify(
|
|
3616
|
-
return this.arguments === !0 && (!
|
|
3353
|
+
verify(n, t, i) {
|
|
3354
|
+
return this.arguments === !0 && (!i || !i.length) ? !1 : this.admins.some((a) => n.toLocaleLowerCase() === a.toLocaleLowerCase()) ? !0 : this.permissions === !0 || typeof this.permissions > "u" || Array.isArray(this.permissions) && !this.permissions.length ? !1 : !!(Array.isArray(this.permissions) && this.permissions.some((a) => n.toLowerCase() === a.toLowerCase() || t.map((s) => s.toLowerCase()).includes(a.toLowerCase())));
|
|
3617
3355
|
}
|
|
3618
|
-
parse(
|
|
3619
|
-
if (!(window.client instanceof
|
|
3620
|
-
const
|
|
3621
|
-
var
|
|
3356
|
+
parse(n, t) {
|
|
3357
|
+
if (!(window.client instanceof C)) return !1;
|
|
3358
|
+
const i = n.replace(this.prefix, "").split(" ").slice(1).map((c) => c.trim());
|
|
3359
|
+
var a = "", s = [];
|
|
3622
3360
|
const d = { bits: "cheer", premium: "prime" };
|
|
3623
|
-
switch (
|
|
3361
|
+
switch (t.provider) {
|
|
3624
3362
|
case "twitch": {
|
|
3625
|
-
const
|
|
3626
|
-
|
|
3363
|
+
const c = t.data;
|
|
3364
|
+
a = c.event.data.nick || c.event.data.displayName, c.event.data.tags?.badges && (s = c.event.data.tags.badges.toString().replace(/\/\d+/g, "").split(",").map((h) => h in d ? d[h] : h));
|
|
3627
3365
|
break;
|
|
3628
3366
|
}
|
|
3629
3367
|
case "youtube": {
|
|
3630
|
-
const
|
|
3368
|
+
const c = t.data, l = {
|
|
3631
3369
|
isVerified: "verified",
|
|
3632
3370
|
isChatOwner: "owner",
|
|
3633
3371
|
isChatSponsor: "sponsor",
|
|
3634
3372
|
isChatModerator: "moderator"
|
|
3635
3373
|
};
|
|
3636
|
-
|
|
3374
|
+
a = c.event.data.nick || c.event.data.displayName, s = Object.entries(c.event.data.authorDetails).filter(([h, f]) => h.startsWith("is") && f).map(([h]) => l[h]).filter(Boolean);
|
|
3637
3375
|
break;
|
|
3638
3376
|
}
|
|
3639
3377
|
case "kick":
|
|
3640
3378
|
return !1;
|
|
3641
3379
|
}
|
|
3642
|
-
const o = this.verify(
|
|
3643
|
-
return o === !0 && this.run.apply(window.client, [
|
|
3380
|
+
const o = this.verify(a, s, i);
|
|
3381
|
+
return o === !0 && this.run.apply(window.client, [i, t]), o;
|
|
3382
|
+
}
|
|
3383
|
+
remove() {
|
|
3384
|
+
if (!(window.client instanceof C)) return;
|
|
3385
|
+
const n = window.client.actions.commands.indexOf(this);
|
|
3386
|
+
n > -1 && (window.client.actions.commands.splice(n, 1), window.client.emit("action", this, "removed"));
|
|
3644
3387
|
}
|
|
3645
|
-
static execute(
|
|
3646
|
-
if (!(window.client instanceof
|
|
3647
|
-
const
|
|
3388
|
+
static execute(n) {
|
|
3389
|
+
if (!(window.client instanceof C)) return !1;
|
|
3390
|
+
const t = n.data;
|
|
3648
3391
|
try {
|
|
3649
|
-
if (window.client.actions.commands.length && window.client.actions.commands.some((
|
|
3650
|
-
const
|
|
3651
|
-
var
|
|
3652
|
-
return
|
|
3392
|
+
if (window.client.actions.commands.length && window.client.actions.commands.some((i) => t.event.data.text.startsWith(i.prefix))) {
|
|
3393
|
+
const i = window.client.actions.commands.filter((a) => {
|
|
3394
|
+
var s = [a.name, ...a.aliases ?? []], d = t.event.data.text.replace(a.prefix, "").split(" ")[0];
|
|
3395
|
+
return s.includes(d);
|
|
3653
3396
|
});
|
|
3654
|
-
if (
|
|
3655
|
-
return
|
|
3397
|
+
if (i.length && i.every((a) => a instanceof _))
|
|
3398
|
+
return i.forEach((a) => {
|
|
3399
|
+
a.parse(t.event.data.text, n), window.client.emit("action", a, "executed"), P.received(`Command executed: ${t.event.data.text} by ${t.event.data.nick || t.event.data.displayName}`, t);
|
|
3400
|
+
}), !0;
|
|
3656
3401
|
}
|
|
3657
3402
|
} catch {
|
|
3658
3403
|
return !1;
|
|
@@ -3661,21 +3406,21 @@ class O {
|
|
|
3661
3406
|
}
|
|
3662
3407
|
}
|
|
3663
3408
|
}
|
|
3664
|
-
class at extends
|
|
3665
|
-
constructor(
|
|
3666
|
-
window.client instanceof
|
|
3409
|
+
class at extends O {
|
|
3410
|
+
constructor(n) {
|
|
3411
|
+
window.client instanceof C && (super(), this.queue = [], this.priorityQueue = [], this.history = [], this.timeouts = [], this.running = !1, this.duration = void 0, this.loaded = !1, this.duration = n.duration, this.processor = n.processor, window.client.on("load", () => {
|
|
3667
3412
|
this.emit("load"), this.loaded = !0;
|
|
3668
3413
|
}));
|
|
3669
3414
|
}
|
|
3670
|
-
enqueue(
|
|
3671
|
-
const
|
|
3415
|
+
enqueue(n, t = {}) {
|
|
3416
|
+
const i = {
|
|
3672
3417
|
isoDate: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3673
|
-
isLoop:
|
|
3674
|
-
isPriority:
|
|
3675
|
-
isImmediate:
|
|
3676
|
-
value:
|
|
3677
|
-
},
|
|
3678
|
-
return
|
|
3418
|
+
isLoop: t?.isLoop ?? !1,
|
|
3419
|
+
isPriority: t?.isPriority ?? !1,
|
|
3420
|
+
isImmediate: t?.isImmediate ?? !1,
|
|
3421
|
+
value: n
|
|
3422
|
+
}, a = this.hasItems();
|
|
3423
|
+
return i.isPriority && i.isImmediate ? (this.cancel(), this.priorityQueue.unshift(i)) : (i.isPriority ? this.priorityQueue : this.queue).push(i), this.running === !1 && a === !1 && this.run(), this.emit("update", this.queue, this.priorityQueue, this.history, this.timeouts), this;
|
|
3679
3424
|
}
|
|
3680
3425
|
async run() {
|
|
3681
3426
|
if (!this.hasItems()) {
|
|
@@ -3685,135 +3430,270 @@ class at extends D {
|
|
|
3685
3430
|
this.running = !0, await this.next(), typeof this.duration == "number" && this.duration > 0 ? this.timeouts.push(setTimeout(() => this.run(), this.duration)) : (this.duration === 0 || this.duration !== -1 && this.duration !== !1) && this.run();
|
|
3686
3431
|
}
|
|
3687
3432
|
async next() {
|
|
3688
|
-
const
|
|
3689
|
-
if (!
|
|
3433
|
+
const n = this.priorityQueue.length > 0 ? this.priorityQueue.shift() : this.queue.shift();
|
|
3434
|
+
if (!n) {
|
|
3690
3435
|
this.running = !1;
|
|
3691
3436
|
return;
|
|
3692
3437
|
}
|
|
3693
3438
|
try {
|
|
3694
|
-
await this.processor.apply(this, [
|
|
3695
|
-
} catch (
|
|
3696
|
-
|
|
3439
|
+
await this.processor.apply(this, [n.value, this]), this.emit("process", n, this);
|
|
3440
|
+
} catch (i) {
|
|
3441
|
+
P.error(`Error during item processing: ${i instanceof Error ? i.message : String(i)}`);
|
|
3697
3442
|
}
|
|
3698
|
-
this.history.push(
|
|
3699
|
-
const
|
|
3700
|
-
|
|
3443
|
+
this.history.push(n);
|
|
3444
|
+
const t = n.isPriority ? this.priorityQueue : this.queue;
|
|
3445
|
+
n.isLoop && t.push(n);
|
|
3701
3446
|
}
|
|
3702
3447
|
resume() {
|
|
3703
3448
|
return this.running && this.cancel(), this.hasItems() && this.run(), this;
|
|
3704
3449
|
}
|
|
3705
|
-
update(
|
|
3706
|
-
return this.queue =
|
|
3450
|
+
update(n) {
|
|
3451
|
+
return this.queue = n.queue ?? this.queue, this.priorityQueue = n.priorityQueue ?? this.priorityQueue, this.history = n.history ?? this.history, this.hasItems() && this.running === !1 && window.client?.on("load", () => this.run()), this;
|
|
3707
3452
|
}
|
|
3708
3453
|
cancel() {
|
|
3709
|
-
this.running && (this.timeouts.forEach((
|
|
3454
|
+
this.running && (this.timeouts.forEach((n) => clearTimeout(n)), this.timeouts = [], this.running = !1, this.emit("cancel"));
|
|
3710
3455
|
}
|
|
3711
3456
|
hasItems() {
|
|
3712
3457
|
return this.queue.length > 0 || this.priorityQueue.length > 0;
|
|
3713
3458
|
}
|
|
3714
|
-
on(
|
|
3715
|
-
return
|
|
3459
|
+
on(n, t) {
|
|
3460
|
+
return n === "load" && this.loaded ? (t.apply(this), this) : (super.on(n, t), this);
|
|
3461
|
+
}
|
|
3462
|
+
}
|
|
3463
|
+
class G {
|
|
3464
|
+
constructor(n) {
|
|
3465
|
+
this.field = "button", this.template = "button", window.client instanceof C && (this.field = n.field ?? this.field, this.template = n.template ?? this.template, this.run = n.run, window.client.actions.buttons.push(this), window.client.emit("action", this, "created"));
|
|
3466
|
+
}
|
|
3467
|
+
parse(n, t) {
|
|
3468
|
+
var i = n.replace(typeof this.field == "string" ? this.field : this.template.replace(/\{[^}]*\}/g, "") ?? "", "").trim();
|
|
3469
|
+
try {
|
|
3470
|
+
this.run.apply(window.client, [i.length ? i : n ?? n, t]);
|
|
3471
|
+
} catch (a) {
|
|
3472
|
+
throw new Error(`Error running button "${this.field}": ${a instanceof Error ? a.message : a}`);
|
|
3473
|
+
}
|
|
3474
|
+
return this;
|
|
3475
|
+
}
|
|
3476
|
+
remove() {
|
|
3477
|
+
if (!(window.client instanceof C)) return;
|
|
3478
|
+
const n = window.client.actions.buttons.indexOf(this);
|
|
3479
|
+
n > -1 && (window.client.actions.buttons.splice(n, 1), window.client.emit("action", this, "removed"));
|
|
3480
|
+
}
|
|
3481
|
+
static execute(n, t) {
|
|
3482
|
+
try {
|
|
3483
|
+
if (!(window.client instanceof C)) return !1;
|
|
3484
|
+
if (window.client.actions.buttons.length) {
|
|
3485
|
+
const i = window.client.actions.buttons.filter((a) => typeof a.field == "string" ? a.field === n : typeof a.field == "function" ? a.field(n, t) : !1);
|
|
3486
|
+
if (i.length && i.every((a) => a instanceof G))
|
|
3487
|
+
return i.forEach((a) => {
|
|
3488
|
+
try {
|
|
3489
|
+
a.parse(n, t), window.client.emit("action", a, "executed"), P.received(`Button executed: ${n}${t ? ` with value: ${t}` : ""}`);
|
|
3490
|
+
} catch (s) {
|
|
3491
|
+
P.error(`Error executing button "${n}": ${s instanceof Error ? s.message : s}`);
|
|
3492
|
+
}
|
|
3493
|
+
}), !0;
|
|
3494
|
+
}
|
|
3495
|
+
} catch {
|
|
3496
|
+
return !1;
|
|
3497
|
+
} finally {
|
|
3498
|
+
return !1;
|
|
3499
|
+
}
|
|
3500
|
+
}
|
|
3501
|
+
}
|
|
3502
|
+
class z {
|
|
3503
|
+
constructor(n = {}) {
|
|
3504
|
+
this.error = this.apply({
|
|
3505
|
+
color: "#721c24",
|
|
3506
|
+
background: "#f8d7da",
|
|
3507
|
+
bold: !0,
|
|
3508
|
+
italic: !1,
|
|
3509
|
+
icon: "✖"
|
|
3510
|
+
}), this.warn = this.apply({
|
|
3511
|
+
color: "#856404",
|
|
3512
|
+
background: "#fff3cd",
|
|
3513
|
+
bold: !0,
|
|
3514
|
+
italic: !1,
|
|
3515
|
+
fontSize: 20
|
|
3516
|
+
}), this.success = this.apply({
|
|
3517
|
+
color: "#155724",
|
|
3518
|
+
background: "#d4edda",
|
|
3519
|
+
bold: !0,
|
|
3520
|
+
italic: !1,
|
|
3521
|
+
fontSize: 18,
|
|
3522
|
+
icon: "✔"
|
|
3523
|
+
}), this.info = this.apply({
|
|
3524
|
+
color: "#0c5460",
|
|
3525
|
+
background: "#d1ecf1",
|
|
3526
|
+
fontSize: 12,
|
|
3527
|
+
icon: "ℹ"
|
|
3528
|
+
}), this.debug = this.apply({
|
|
3529
|
+
color: "#6c757d",
|
|
3530
|
+
background: "transparent",
|
|
3531
|
+
fontSize: 11,
|
|
3532
|
+
icon: "●"
|
|
3533
|
+
}), this.alert = this.apply({
|
|
3534
|
+
color: "#856404",
|
|
3535
|
+
background: "#fff3cd",
|
|
3536
|
+
bold: !0,
|
|
3537
|
+
italic: !1,
|
|
3538
|
+
fontSize: 20,
|
|
3539
|
+
icon: "⚠"
|
|
3540
|
+
}), this.status = this.apply({
|
|
3541
|
+
color: "#0c5460",
|
|
3542
|
+
background: "#d1ecf1",
|
|
3543
|
+
bold: !0,
|
|
3544
|
+
italic: !1,
|
|
3545
|
+
fontSize: 12,
|
|
3546
|
+
icon: "·"
|
|
3547
|
+
}), this.received = this.apply({
|
|
3548
|
+
color: "#E6BBFF",
|
|
3549
|
+
background: "transparent",
|
|
3550
|
+
bold: !1,
|
|
3551
|
+
italic: !1,
|
|
3552
|
+
fontSize: 14,
|
|
3553
|
+
icon: "⬇"
|
|
3554
|
+
}), this.simple = this.apply({
|
|
3555
|
+
color: "#f6c6cb",
|
|
3556
|
+
background: "transparent",
|
|
3557
|
+
bold: !1,
|
|
3558
|
+
italic: !1,
|
|
3559
|
+
fontSize: 14,
|
|
3560
|
+
icon: "☼"
|
|
3561
|
+
}), this.enabled = n.enabled ?? !0, this.prefix = n.prefix ? `[${n.prefix}]` : "";
|
|
3562
|
+
}
|
|
3563
|
+
apply(n) {
|
|
3564
|
+
const t = this.style(n), i = n.icon ? `${n.icon} ` : "";
|
|
3565
|
+
return (...a) => {
|
|
3566
|
+
if (!this.enabled || typeof console > "u") return;
|
|
3567
|
+
const s = this.prefix ? `${this.prefix} ` : "", d = [], o = [];
|
|
3568
|
+
if (a.forEach((c) => {
|
|
3569
|
+
typeof c == "string" || typeof c == "number" || typeof c == "boolean" ? d.push(c) : o.push(c);
|
|
3570
|
+
}), d.length > 0) {
|
|
3571
|
+
const c = d.join(" ");
|
|
3572
|
+
console.log(`%c${i}${s}${c}`, t, ...o);
|
|
3573
|
+
} else o.length > 0 && console.log(`%c${i}${s}`, t, ...o);
|
|
3574
|
+
};
|
|
3575
|
+
}
|
|
3576
|
+
style(n) {
|
|
3577
|
+
const t = [];
|
|
3578
|
+
return n.background && n.background !== "transparent" && (t.push(`background: ${n.background}`), t.push("padding: 2px 6px"), t.push("border-radius: 3px")), n.color && t.push(`color: ${n.color}`), n.bold && t.push("font-weight: bold"), n.italic && t.push("font-style: italic"), n.fontSize && t.push(`font-size: ${n.fontSize}px`), t.join("; ");
|
|
3579
|
+
}
|
|
3580
|
+
group(n) {
|
|
3581
|
+
!this.enabled || !console.group || console.group(n);
|
|
3582
|
+
}
|
|
3583
|
+
groupCollapsed(n) {
|
|
3584
|
+
!this.enabled || !console.groupCollapsed || console.groupCollapsed(n);
|
|
3585
|
+
}
|
|
3586
|
+
groupEnd() {
|
|
3587
|
+
!this.enabled || !console.groupEnd || console.groupEnd();
|
|
3588
|
+
}
|
|
3589
|
+
table(n) {
|
|
3590
|
+
!this.enabled || !console.table || console.table(n);
|
|
3591
|
+
}
|
|
3592
|
+
time(n) {
|
|
3593
|
+
!this.enabled || !console.time || console.time(n);
|
|
3594
|
+
}
|
|
3595
|
+
timeEnd(n) {
|
|
3596
|
+
!this.enabled || !console.timeEnd || console.timeEnd(n);
|
|
3716
3597
|
}
|
|
3717
3598
|
}
|
|
3718
3599
|
window.addEventListener("load", () => {
|
|
3719
|
-
window.client instanceof A && I.start();
|
|
3720
3600
|
});
|
|
3721
|
-
window.addEventListener("onWidgetLoad", async (
|
|
3722
|
-
const { detail:
|
|
3723
|
-
if (window.client instanceof
|
|
3724
|
-
const
|
|
3725
|
-
|
|
3726
|
-
...
|
|
3727
|
-
user:
|
|
3728
|
-
currency:
|
|
3729
|
-
overlay:
|
|
3730
|
-
},
|
|
3731
|
-
if (
|
|
3732
|
-
return
|
|
3733
|
-
|
|
3601
|
+
window.addEventListener("onWidgetLoad", async (e) => {
|
|
3602
|
+
const { detail: n } = e;
|
|
3603
|
+
if (window.client instanceof C) {
|
|
3604
|
+
const t = window.client;
|
|
3605
|
+
t.fields = n.fieldData, t.session = n.session.data, t.details = {
|
|
3606
|
+
...t.details,
|
|
3607
|
+
user: n.channel,
|
|
3608
|
+
currency: n.currency,
|
|
3609
|
+
overlay: n.overlay
|
|
3610
|
+
}, n.channel.id && !n.emulated ? await fetch(`https://api.streamelements.com/kappa/v2/channels/${n.channel.id}/`).then((i) => i.json()).then((i) => {
|
|
3611
|
+
if (i.provider)
|
|
3612
|
+
return t.details.provider = i.provider, i.provider;
|
|
3613
|
+
t.details.provider = "local";
|
|
3734
3614
|
}).catch(() => {
|
|
3735
|
-
|
|
3736
|
-
}) :
|
|
3737
|
-
if (
|
|
3738
|
-
const
|
|
3739
|
-
const h = Date.now(),
|
|
3740
|
-
for (const
|
|
3741
|
-
if (
|
|
3742
|
-
const
|
|
3743
|
-
|
|
3615
|
+
t.details.provider = "local";
|
|
3616
|
+
}) : t.details.provider = "local", t.emit("load", n), t.loaded = !0, t.storage.on("load", (i) => {
|
|
3617
|
+
if (i) {
|
|
3618
|
+
const a = (l) => {
|
|
3619
|
+
const h = Date.now(), f = {};
|
|
3620
|
+
for (const v in l)
|
|
3621
|
+
if (l.hasOwnProperty(v)) {
|
|
3622
|
+
const b = l[v];
|
|
3623
|
+
b.expire && b.expire > h && (f[v] = b);
|
|
3744
3624
|
}
|
|
3745
|
-
return
|
|
3746
|
-
},
|
|
3747
|
-
|
|
3748
|
-
user:
|
|
3625
|
+
return f;
|
|
3626
|
+
}, s = a(i.user || {}), d = a(i.avatar || {}), o = a(i.pronoun || {}), c = a(i.emote || {});
|
|
3627
|
+
t.storage.update({
|
|
3628
|
+
user: s,
|
|
3749
3629
|
avatar: d,
|
|
3750
3630
|
pronoun: o,
|
|
3751
|
-
emote:
|
|
3631
|
+
emote: c
|
|
3752
3632
|
});
|
|
3753
3633
|
}
|
|
3754
|
-
|
|
3755
|
-
value:
|
|
3634
|
+
n.channel.providerId.length && t.storage.add(`avatar.${n.channel.providerId.toLowerCase()}`, {
|
|
3635
|
+
value: n.channel.avatar,
|
|
3756
3636
|
timestamp: Date.now(),
|
|
3757
|
-
expire: Date.now() +
|
|
3637
|
+
expire: Date.now() + t.cache.avatar * 60 * 60 * 1e3
|
|
3758
3638
|
});
|
|
3759
3639
|
});
|
|
3760
3640
|
}
|
|
3761
3641
|
});
|
|
3762
|
-
window.addEventListener("onSessionUpdate", (
|
|
3763
|
-
const { detail:
|
|
3764
|
-
if (window.client instanceof
|
|
3765
|
-
const
|
|
3766
|
-
|
|
3642
|
+
window.addEventListener("onSessionUpdate", (e) => {
|
|
3643
|
+
const { detail: n } = e;
|
|
3644
|
+
if (window.client instanceof C) {
|
|
3645
|
+
const t = window.client;
|
|
3646
|
+
t.session = n.session, t.emit("session", n.session);
|
|
3767
3647
|
}
|
|
3768
3648
|
});
|
|
3769
|
-
window.addEventListener("onEventReceived", ({ detail:
|
|
3770
|
-
if (window.client instanceof
|
|
3771
|
-
var
|
|
3649
|
+
window.addEventListener("onEventReceived", ({ detail: e }) => {
|
|
3650
|
+
if (window.client instanceof C) {
|
|
3651
|
+
var n = (
|
|
3772
3652
|
// @ts-ignore
|
|
3773
|
-
|
|
3653
|
+
e.event?.provider || e.event?.service || e.event?.data?.provider || window.client.details.provider
|
|
3774
3654
|
);
|
|
3775
|
-
["kvstore:update", "bot:counter", "alertService:toggleSound", "event:skip", "tip-latest", "event:test"].some((
|
|
3776
|
-
const
|
|
3777
|
-
switch (
|
|
3655
|
+
["kvstore:update", "bot:counter", "alertService:toggleSound", "event:skip", "tip-latest", "event:test"].some((s) => s === e.listener) && (n = "streamelements");
|
|
3656
|
+
const a = { provider: n, data: e };
|
|
3657
|
+
switch (a.provider) {
|
|
3778
3658
|
case "streamelements": {
|
|
3779
|
-
const
|
|
3780
|
-
switch (
|
|
3659
|
+
const s = a.data;
|
|
3660
|
+
switch (s.listener) {
|
|
3781
3661
|
case "tip-latest": {
|
|
3782
|
-
|
|
3662
|
+
s.event;
|
|
3783
3663
|
break;
|
|
3784
3664
|
}
|
|
3785
3665
|
case "event:skip": {
|
|
3786
|
-
|
|
3666
|
+
s.event;
|
|
3787
3667
|
break;
|
|
3788
3668
|
}
|
|
3789
3669
|
case "event:test": {
|
|
3790
|
-
switch (
|
|
3670
|
+
switch (s.event.listener) {
|
|
3791
3671
|
case "widget-button": {
|
|
3792
|
-
const d =
|
|
3793
|
-
|
|
3672
|
+
const d = s.event;
|
|
3673
|
+
G.execute(d.field, d.value);
|
|
3794
3674
|
break;
|
|
3795
3675
|
}
|
|
3796
3676
|
case "subscriber-latest": {
|
|
3797
|
-
|
|
3677
|
+
s.event;
|
|
3798
3678
|
break;
|
|
3799
3679
|
}
|
|
3800
3680
|
}
|
|
3801
3681
|
break;
|
|
3802
3682
|
}
|
|
3803
3683
|
case "kvstore:update": {
|
|
3804
|
-
const d =
|
|
3805
|
-
if (
|
|
3806
|
-
var
|
|
3807
|
-
|
|
3684
|
+
const d = s.event;
|
|
3685
|
+
if (F.length) {
|
|
3686
|
+
var t = F.find((o) => o.id === d.data.key.replace("customWidget.", ""));
|
|
3687
|
+
t && t.update(d.data.value);
|
|
3808
3688
|
}
|
|
3809
3689
|
break;
|
|
3810
3690
|
}
|
|
3811
3691
|
case "bot:counter": {
|
|
3812
|
-
|
|
3692
|
+
s.event;
|
|
3813
3693
|
break;
|
|
3814
3694
|
}
|
|
3815
3695
|
case "alertService:toggleSound": {
|
|
3816
|
-
const d =
|
|
3696
|
+
const d = s.event;
|
|
3817
3697
|
client.details.overlay.muted = !!d.muted;
|
|
3818
3698
|
break;
|
|
3819
3699
|
}
|
|
@@ -3821,130 +3701,85 @@ window.addEventListener("onEventReceived", ({ detail: u }) => {
|
|
|
3821
3701
|
break;
|
|
3822
3702
|
}
|
|
3823
3703
|
case "twitch": {
|
|
3824
|
-
const
|
|
3825
|
-
switch (
|
|
3704
|
+
const s = a.data;
|
|
3705
|
+
switch (s.listener) {
|
|
3826
3706
|
case "delete-message": {
|
|
3827
|
-
|
|
3707
|
+
s.event;
|
|
3828
3708
|
break;
|
|
3829
3709
|
}
|
|
3830
3710
|
case "delete-messages": {
|
|
3831
|
-
|
|
3711
|
+
s.event;
|
|
3832
3712
|
break;
|
|
3833
3713
|
}
|
|
3834
3714
|
case "message": {
|
|
3835
|
-
|
|
3715
|
+
s.event, _.execute({ provider: "twitch", data: s });
|
|
3836
3716
|
break;
|
|
3837
3717
|
}
|
|
3838
3718
|
case "follower-latest": {
|
|
3839
|
-
|
|
3719
|
+
s.event;
|
|
3840
3720
|
break;
|
|
3841
3721
|
}
|
|
3842
3722
|
case "cheer-latest": {
|
|
3843
|
-
|
|
3723
|
+
s.event;
|
|
3844
3724
|
break;
|
|
3845
3725
|
}
|
|
3846
3726
|
case "subscriber-latest": {
|
|
3847
|
-
(!
|
|
3727
|
+
(!s.event.gifted && !s.event.bulkGifted && !s.event.isCommunityGift || s.event.gifted && !s.event.bulkGifted && !s.event.isCommunityGift || s.event.gifted && !s.event.bulkGifted && s.event.isCommunityGift || !s.event.gifted && s.event.bulkGifted && !s.event.isCommunityGift) && s.event;
|
|
3848
3728
|
break;
|
|
3849
3729
|
}
|
|
3850
3730
|
case "raid-latest": {
|
|
3851
|
-
|
|
3731
|
+
s.event;
|
|
3852
3732
|
break;
|
|
3853
3733
|
}
|
|
3854
3734
|
}
|
|
3855
3735
|
break;
|
|
3856
3736
|
}
|
|
3857
3737
|
case "youtube": {
|
|
3858
|
-
const
|
|
3859
|
-
switch (
|
|
3738
|
+
const s = a.data;
|
|
3739
|
+
switch (s.listener) {
|
|
3860
3740
|
case "message": {
|
|
3861
|
-
|
|
3741
|
+
s.event, _.execute({ provider: "youtube", data: s });
|
|
3862
3742
|
break;
|
|
3863
3743
|
}
|
|
3864
3744
|
case "subscriber-latest": {
|
|
3865
|
-
|
|
3745
|
+
s.event;
|
|
3866
3746
|
break;
|
|
3867
3747
|
}
|
|
3868
3748
|
case "sponsor-latest": {
|
|
3869
|
-
|
|
3749
|
+
s.event, (!s.event.gifted && !s.event.bulkGifted && !s.event.isCommunityGift || s.event.gifted && !s.event.bulkGifted && !s.event.isCommunityGift || s.event.gifted && !s.event.bulkGifted && s.event.isCommunityGift || !s.event.gifted && s.event.bulkGifted && !s.event.isCommunityGift) && s.event;
|
|
3870
3750
|
break;
|
|
3871
3751
|
}
|
|
3872
3752
|
case "superchat-latest": {
|
|
3873
|
-
|
|
3753
|
+
s.event;
|
|
3874
3754
|
break;
|
|
3875
3755
|
}
|
|
3876
3756
|
}
|
|
3877
3757
|
break;
|
|
3878
3758
|
}
|
|
3879
3759
|
case "kick": {
|
|
3880
|
-
|
|
3760
|
+
a.data;
|
|
3881
3761
|
break;
|
|
3882
3762
|
}
|
|
3883
3763
|
case "facebook": {
|
|
3884
|
-
|
|
3764
|
+
a.data;
|
|
3885
3765
|
break;
|
|
3886
3766
|
}
|
|
3887
3767
|
}
|
|
3888
|
-
window.client.emit("event",
|
|
3768
|
+
window.client.emit("event", a);
|
|
3889
3769
|
}
|
|
3890
3770
|
});
|
|
3891
|
-
const
|
|
3892
|
-
|
|
3893
|
-
isEditorMode: !1,
|
|
3894
|
-
muted: !1
|
|
3895
|
-
}),
|
|
3896
|
-
resumeQueue: () => {
|
|
3897
|
-
},
|
|
3898
|
-
responses: {},
|
|
3899
|
-
sendMessage(u, t) {
|
|
3900
|
-
},
|
|
3901
|
-
counters: {
|
|
3902
|
-
get(u) {
|
|
3903
|
-
return null;
|
|
3904
|
-
}
|
|
3905
|
-
},
|
|
3906
|
-
sanitize(u) {
|
|
3907
|
-
return u;
|
|
3908
|
-
},
|
|
3909
|
-
cheerFilter(u) {
|
|
3910
|
-
return u;
|
|
3911
|
-
},
|
|
3912
|
-
setField(u, t, e) {
|
|
3913
|
-
},
|
|
3914
|
-
store: {
|
|
3915
|
-
set: function(u, t) {
|
|
3916
|
-
this.list[u] = t, localStorage.setItem("SE_API-STORE", JSON.stringify(H.store.list));
|
|
3917
|
-
},
|
|
3918
|
-
get: async function(u) {
|
|
3919
|
-
return this.list[u] ? this.list[u] : null;
|
|
3920
|
-
},
|
|
3921
|
-
list: {}
|
|
3922
|
-
}
|
|
3923
|
-
};
|
|
3924
|
-
async function nt() {
|
|
3925
|
-
let u = localStorage.getItem("SE_API-STORE") ?? "", t = u ? JSON.parse(u) : {};
|
|
3926
|
-
return H.store.list = t, H;
|
|
3927
|
-
}
|
|
3928
|
-
const W = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(nt()), R = {
|
|
3929
|
-
Client: A,
|
|
3771
|
+
const W = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(et()), P = new z(), nt = {
|
|
3772
|
+
USE_SE_API: W,
|
|
3930
3773
|
Simulation: I,
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
},
|
|
3936
|
-
modules: {
|
|
3937
|
-
Button: N,
|
|
3938
|
-
Command: O,
|
|
3939
|
-
EventProvider: D,
|
|
3940
|
-
useStorage: G,
|
|
3941
|
-
useQueue: at
|
|
3942
|
-
},
|
|
3943
|
-
USE_SE_API: W
|
|
3774
|
+
Client: C,
|
|
3775
|
+
logger: P,
|
|
3776
|
+
utils: { findEmotesInText: U, replaceEmotesWithHTML: S, generateBadges: B },
|
|
3777
|
+
modules: { Button: G, Command: _, EventProvider: O, useStorage: $, useQueue: at, Logger: z }
|
|
3944
3778
|
};
|
|
3945
|
-
typeof window < "u" && (window.Tixyel =
|
|
3779
|
+
typeof window < "u" && (window.Tixyel = nt);
|
|
3946
3780
|
export {
|
|
3947
|
-
|
|
3948
|
-
W as USE_SE_API
|
|
3781
|
+
nt as Tixyel,
|
|
3782
|
+
W as USE_SE_API,
|
|
3783
|
+
P as logger
|
|
3949
3784
|
};
|
|
3950
3785
|
//# sourceMappingURL=index.es.js.map
|