@tixyel/streamelements 7.6.6 → 7.6.7
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/README.md +4 -4
- package/dist/index.d.ts +290 -265
- package/dist/index.es.js +314 -287
- 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 +2 -2
package/dist/index.es.js
CHANGED
|
@@ -279,6 +279,34 @@ var e = Object.defineProperty, t = (t, n) => {
|
|
|
279
279
|
keys(e) {
|
|
280
280
|
return Object.keys(e);
|
|
281
281
|
}
|
|
282
|
+
updateViaPath(e, t, n, r = !1) {
|
|
283
|
+
let i = t.split("."), a = e;
|
|
284
|
+
for (let e = 0; e < i.length - 1; e++) {
|
|
285
|
+
if (typeof a[i[e]] != "object" || a[i[e]] == null) if (r) a[i[e]] = {};
|
|
286
|
+
else throw Error(`Path ${i.slice(0, e + 1).join(".")} does not exist in the object.`);
|
|
287
|
+
a = a[i[e]];
|
|
288
|
+
}
|
|
289
|
+
return a[i[i.length - 1]] = n, e;
|
|
290
|
+
}
|
|
291
|
+
isDiff(e, t, n = "default") {
|
|
292
|
+
if (n === "json") return JSON.stringify(e) !== JSON.stringify(t);
|
|
293
|
+
if (Object.is(e, t)) return !1;
|
|
294
|
+
if (typeof e != typeof t) return !0;
|
|
295
|
+
if (e == null || t == null) return e !== t;
|
|
296
|
+
if (e instanceof Date && t instanceof Date) return e.getTime() !== t.getTime();
|
|
297
|
+
if (Array.isArray(e) && Array.isArray(t)) {
|
|
298
|
+
if (e.length !== t.length) return !0;
|
|
299
|
+
for (let r = 0; r < e.length; r++) if (this.isDiff(e[r], t[r], n)) return !0;
|
|
300
|
+
return !1;
|
|
301
|
+
}
|
|
302
|
+
if (typeof e == "object" && typeof t == "object") {
|
|
303
|
+
let r = Object.keys(e), i = Object.keys(t);
|
|
304
|
+
if (r.length !== i.length) return !0;
|
|
305
|
+
for (let i of r) if (!Object.prototype.hasOwnProperty.call(t, i) || this.isDiff(e[i], t[i], n)) return !0;
|
|
306
|
+
return !1;
|
|
307
|
+
}
|
|
308
|
+
return e !== t;
|
|
309
|
+
}
|
|
282
310
|
}, a = [
|
|
283
311
|
"https://static-cdn.jtvnw.net/user-default-pictures-uv/13e5fa74-defa-11e9-809c-784f43822e80-profile_image-300x300.png",
|
|
284
312
|
"https://static-cdn.jtvnw.net/user-default-pictures-uv/dbdc9198-def8-11e9-8681-784f43822e80-profile_image-300x300.png",
|
|
@@ -10278,7 +10306,7 @@ var j = class {
|
|
|
10278
10306
|
if (e.length < 3) throw Error("multiCubic requires at least 3 points.");
|
|
10279
10307
|
let i = e.length - 1, a = e.length - 1, o = Math.max(2, Math.round(t * n)), s = Math.max(1, Math.floor(o / i)), c = o % i, l = [], u = [];
|
|
10280
10308
|
for (let t = 0; t < i; t++) {
|
|
10281
|
-
let n = e[t], i = e[t + 1], o = this.getMultiCubicOutgoingControl(n, t), d = this.getMultiCubicIncomingControl(i, t + 1, a), f = s + (c > 0
|
|
10309
|
+
let n = e[t], i = e[t + 1], o = this.getMultiCubicOutgoingControl(n, t), d = this.getMultiCubicIncomingControl(i, t + 1, a), f = s + +(c > 0);
|
|
10282
10310
|
c > 0 && c--;
|
|
10283
10311
|
let p = t === 0 ? 0 : 1;
|
|
10284
10312
|
for (let e = p; e <= f; e++) {
|
|
@@ -10656,85 +10684,89 @@ var H = class {
|
|
|
10656
10684
|
removeAllListeners(e) {
|
|
10657
10685
|
return this.registeredEvents[e] = [], this;
|
|
10658
10686
|
}
|
|
10659
|
-
}, U =
|
|
10687
|
+
}, U = () => {
|
|
10688
|
+
try {
|
|
10689
|
+
return P;
|
|
10690
|
+
} catch {
|
|
10691
|
+
return [];
|
|
10692
|
+
}
|
|
10693
|
+
}, W = class extends H {
|
|
10660
10694
|
constructor(e) {
|
|
10661
|
-
super(), this.
|
|
10662
|
-
|
|
10663
|
-
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);
|
|
10664
|
-
}).catch(() => {
|
|
10665
|
-
this.loaded = !0, this.emit("load", this.data);
|
|
10666
|
-
});
|
|
10667
|
-
});
|
|
10695
|
+
if (super(), this.queue = [], this.priorityQueue = [], this.history = [], this.timeouts = [], this.running = !1, this.duration = void 0, this.loaded = !1, this.clientWaitRetryDelay = 50, !e.processor || typeof e.processor != "function") throw Error("A valid processor function must be provided to useQueue.");
|
|
10696
|
+
this.processor = e.processor, e.duration !== "client" && (this.duration = e.duration ?? 0), this.waitForClientAndBindLoad(e.duration);
|
|
10668
10697
|
}
|
|
10669
|
-
|
|
10670
|
-
|
|
10698
|
+
waitForClientAndBindLoad(e = this.duration, t) {
|
|
10699
|
+
let n = U();
|
|
10700
|
+
if (!n.length) {
|
|
10701
|
+
setTimeout(() => this.waitForClientAndBindLoad(e, t), this.clientWaitRetryDelay);
|
|
10702
|
+
return;
|
|
10703
|
+
}
|
|
10704
|
+
let r = n[0];
|
|
10705
|
+
r.on("load", () => {
|
|
10706
|
+
e === "client" && (this.duration = r.fields?.widgetDuration ?? 0), this.emit("load"), this.loaded = !0, t && t();
|
|
10707
|
+
});
|
|
10671
10708
|
}
|
|
10672
|
-
|
|
10673
|
-
|
|
10709
|
+
enqueue(e, t = {}) {
|
|
10710
|
+
let n = this.hasItems(), r = Array.isArray(e) ? e.map((e) => ({
|
|
10711
|
+
value: e.value,
|
|
10712
|
+
options: e.options ?? {}
|
|
10713
|
+
})) : [{
|
|
10714
|
+
value: e,
|
|
10715
|
+
options: t
|
|
10716
|
+
}];
|
|
10717
|
+
for (let e of r) {
|
|
10674
10718
|
let t = {
|
|
10675
|
-
|
|
10676
|
-
|
|
10719
|
+
isoDate: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10720
|
+
isLoop: e.options?.isLoop ?? !1,
|
|
10721
|
+
isPriority: e.options?.isPriority ?? !1,
|
|
10722
|
+
isImmediate: e.options?.isImmediate ?? !1,
|
|
10723
|
+
value: e.value
|
|
10677
10724
|
};
|
|
10678
|
-
this.
|
|
10725
|
+
t.isPriority && t.isImmediate ? (this.cancel(), this.priorityQueue.unshift(t)) : (t.isPriority ? this.priorityQueue : this.queue).push(t);
|
|
10726
|
+
}
|
|
10727
|
+
return this.running === !1 && n === !1 && this.run(), this.emit("update", this.queue, this.priorityQueue, this.history, this.timeouts), this;
|
|
10728
|
+
}
|
|
10729
|
+
async run() {
|
|
10730
|
+
if (!this.hasItems()) {
|
|
10731
|
+
this.running = !1;
|
|
10732
|
+
return;
|
|
10679
10733
|
}
|
|
10734
|
+
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();
|
|
10680
10735
|
}
|
|
10681
|
-
|
|
10682
|
-
|
|
10736
|
+
async next() {
|
|
10737
|
+
let e = this.priorityQueue.length > 0 ? this.priorityQueue.shift() : this.queue.shift();
|
|
10738
|
+
if (!e) {
|
|
10739
|
+
this.running = !1;
|
|
10740
|
+
return;
|
|
10741
|
+
}
|
|
10742
|
+
try {
|
|
10743
|
+
await this.processor.apply(this, [e.value, this]), this.emit("process", e, this);
|
|
10744
|
+
} catch (e) {
|
|
10745
|
+
console.error(`Error during item processing: ${e instanceof Error ? e.message : String(e)}`);
|
|
10746
|
+
}
|
|
10747
|
+
this.history.push(e);
|
|
10748
|
+
let t = e.isPriority ? this.priorityQueue : this.queue;
|
|
10749
|
+
e.isLoop && t.push(e);
|
|
10683
10750
|
}
|
|
10684
|
-
|
|
10685
|
-
this.
|
|
10751
|
+
resume() {
|
|
10752
|
+
return this.running && this.cancel(), this.hasItems() && this.run(), this;
|
|
10686
10753
|
}
|
|
10687
|
-
|
|
10688
|
-
|
|
10689
|
-
for (let e = 0; e < r.length - 1; e++) (typeof i[r[e]] != "object" || i[r[e]] == null) && (i[r[e]] = {}), i = i[r[e]];
|
|
10690
|
-
return i[r[r.length - 1]] = n, i;
|
|
10754
|
+
update(e) {
|
|
10755
|
+
return this.queue = e.queue ?? this.queue, this.priorityQueue = e.priorityQueue ?? this.priorityQueue, this.history = e.history ?? this.history, this.hasItems() && this.running === !1 && U()[0]?.on("load", () => this.run()), this;
|
|
10691
10756
|
}
|
|
10692
|
-
|
|
10693
|
-
|
|
10757
|
+
cancel() {
|
|
10758
|
+
this.running && (this.timeouts.forEach((e) => clearTimeout(e)), this.timeouts = [], this.running = !1, this.emit("cancel"));
|
|
10694
10759
|
}
|
|
10695
|
-
|
|
10696
|
-
|
|
10697
|
-
super(), this.id = "default", this.debug = !1, this.fields = {}, this.loaded = !1, this.actions = {
|
|
10698
|
-
commands: [],
|
|
10699
|
-
buttons: []
|
|
10700
|
-
}, this.cache = {
|
|
10701
|
-
avatar: 30,
|
|
10702
|
-
pronoun: 60,
|
|
10703
|
-
emote: 120
|
|
10704
|
-
}, this.id = e.id || this.id, this.storage = new U({
|
|
10705
|
-
id: this.id,
|
|
10706
|
-
data: {
|
|
10707
|
-
user: {},
|
|
10708
|
-
avatar: {},
|
|
10709
|
-
pronoun: {},
|
|
10710
|
-
emote: {}
|
|
10711
|
-
}
|
|
10712
|
-
}), this.on("load", () => {
|
|
10713
|
-
this.debug = !!(typeof e.debug == "function" ? e.debug() : e.debug);
|
|
10714
|
-
}), P.push(this);
|
|
10760
|
+
hasItems() {
|
|
10761
|
+
return this.queue.length > 0 || this.priorityQueue.length > 0;
|
|
10715
10762
|
}
|
|
10716
10763
|
on(e, t) {
|
|
10717
|
-
return e === "load" && this.loaded ? (t.apply(this,
|
|
10718
|
-
channel: this.details.user,
|
|
10719
|
-
currency: this.details.currency,
|
|
10720
|
-
fieldData: this.fields,
|
|
10721
|
-
recents: [],
|
|
10722
|
-
session: {
|
|
10723
|
-
data: this.session,
|
|
10724
|
-
settings: {
|
|
10725
|
-
autoReset: !1,
|
|
10726
|
-
calendar: !1,
|
|
10727
|
-
resetOnStart: !1
|
|
10728
|
-
}
|
|
10729
|
-
},
|
|
10730
|
-
overlay: this.details.overlay,
|
|
10731
|
-
emulated: !1
|
|
10732
|
-
}]), this) : (super.on(e, t), this);
|
|
10764
|
+
return e === "load" && this.loaded ? (t.apply(this), this) : (super.on(e, t), this);
|
|
10733
10765
|
}
|
|
10734
10766
|
};
|
|
10735
10767
|
//#endregion
|
|
10736
10768
|
//#region src/local/generator.ts
|
|
10737
|
-
async function
|
|
10769
|
+
async function ae(e, t, n = "USD") {
|
|
10738
10770
|
let r = {
|
|
10739
10771
|
BRL: {
|
|
10740
10772
|
code: "BRL",
|
|
@@ -10778,8 +10810,8 @@ async function oe(e, t, n = "USD") {
|
|
|
10778
10810
|
emulated: !0
|
|
10779
10811
|
};
|
|
10780
10812
|
}
|
|
10781
|
-
async function
|
|
10782
|
-
if (e ??= await
|
|
10813
|
+
async function oe(e, t) {
|
|
10814
|
+
if (e ??= await K.session.get(), t) {
|
|
10783
10815
|
let n = (e, t) => new Date(t.createdAt).getTime() - new Date(e.createdAt).getTime();
|
|
10784
10816
|
switch (t.provider) {
|
|
10785
10817
|
case "twitch": {
|
|
@@ -10947,7 +10979,7 @@ async function se(e, t) {
|
|
|
10947
10979
|
emulated: !0
|
|
10948
10980
|
};
|
|
10949
10981
|
}
|
|
10950
|
-
async function
|
|
10982
|
+
async function G(e = "random", t = "random", n = {}) {
|
|
10951
10983
|
let r = {
|
|
10952
10984
|
twitch: [
|
|
10953
10985
|
"message",
|
|
@@ -10970,12 +11002,12 @@ async function W(e = "random", t = "random", n = {}) {
|
|
|
10970
11002
|
default:
|
|
10971
11003
|
case "random":
|
|
10972
11004
|
var i = new C().array(Object.keys(r).filter((e) => r[e].length))[0], a = new C().array(r[i])[0];
|
|
10973
|
-
return
|
|
11005
|
+
return G(i, a);
|
|
10974
11006
|
case "twitch": switch (t) {
|
|
10975
11007
|
default:
|
|
10976
11008
|
case "random":
|
|
10977
11009
|
var a = new C().array(r[e])[0];
|
|
10978
|
-
return
|
|
11010
|
+
return G(e, a);
|
|
10979
11011
|
case "message": {
|
|
10980
11012
|
let t = n;
|
|
10981
11013
|
var o = t?.name ?? new C().array(S.names.filter((e) => e.length))[0], s = t?.message ?? new C().array([...S.twitch_messages, ...S.normal_messages].filter((e) => e.length))[0], c = await new w().generateBadges(t?.badges ?? [], e), l = new w().findEmotesInText(s), u = new w().replaceEmotesWithHTML(s, l), d = t?.color ?? new C().color("hex"), f = t?.userId ?? new C().string(16), p = t?.msgId ?? new C().string(16), m = t?.time ?? Date.now(), h = t?.channel ?? P?.[0]?.details?.user?.username ?? "local", g = t?.reply ? {
|
|
@@ -11201,7 +11233,7 @@ async function W(e = "random", t = "random", n = {}) {
|
|
|
11201
11233
|
default:
|
|
11202
11234
|
case "random":
|
|
11203
11235
|
var a = new C().array(r[e])[0];
|
|
11204
|
-
return
|
|
11236
|
+
return G(e, a);
|
|
11205
11237
|
case "tip":
|
|
11206
11238
|
case "tip-latest":
|
|
11207
11239
|
var y = n?.amount ?? new C().number(100, 4e3), b = n?.avatar ?? new C().array(S.avatars)[0], o = n?.name ?? new C().array(S.names.filter((e) => e.length))[0];
|
|
@@ -11262,7 +11294,7 @@ async function W(e = "random", t = "random", n = {}) {
|
|
|
11262
11294
|
default:
|
|
11263
11295
|
case "random":
|
|
11264
11296
|
var a = new C().array(r[e])[0];
|
|
11265
|
-
return
|
|
11297
|
+
return G(e, a);
|
|
11266
11298
|
case "message": {
|
|
11267
11299
|
var o = n?.name ?? new C().array(S.names.filter((e) => e.length))[0], s = n?.message ?? new C().array([...S.youtube_messages, ...S.normal_messages].filter((e) => e.length))[0];
|
|
11268
11300
|
let t = await new w().generateBadges(n?.badges ?? [], e);
|
|
@@ -11398,12 +11430,12 @@ async function W(e = "random", t = "random", n = {}) {
|
|
|
11398
11430
|
}
|
|
11399
11431
|
}
|
|
11400
11432
|
}
|
|
11401
|
-
var
|
|
11433
|
+
var K = new class {
|
|
11402
11434
|
constructor() {
|
|
11403
11435
|
this.event = {
|
|
11404
|
-
onWidgetLoad:
|
|
11405
|
-
onSessionUpdate:
|
|
11406
|
-
onEventReceived:
|
|
11436
|
+
onWidgetLoad: ae,
|
|
11437
|
+
onSessionUpdate: oe,
|
|
11438
|
+
onEventReceived: G
|
|
11407
11439
|
}, this.session = {
|
|
11408
11440
|
types: {
|
|
11409
11441
|
name: {
|
|
@@ -12328,99 +12360,175 @@ var G = new class {
|
|
|
12328
12360
|
}
|
|
12329
12361
|
};
|
|
12330
12362
|
}
|
|
12331
|
-
}(),
|
|
12332
|
-
|
|
12333
|
-
|
|
12334
|
-
|
|
12335
|
-
|
|
12336
|
-
|
|
12337
|
-
}, K = class extends H {
|
|
12338
|
-
constructor(e) {
|
|
12339
|
-
if (super(), this.queue = [], this.priorityQueue = [], this.history = [], this.timeouts = [], this.running = !1, this.duration = void 0, this.loaded = !1, this.clientWaitRetryDelay = 50, !e.processor || typeof e.processor != "function") throw Error("A valid processor function must be provided to useQueue.");
|
|
12340
|
-
this.processor = e.processor, e.duration !== "client" && (this.duration = e.duration ?? 0), this.waitForClientAndBindLoad(e.duration);
|
|
12341
|
-
}
|
|
12342
|
-
waitForClientAndBindLoad(e = this.duration, t) {
|
|
12343
|
-
let n = ce();
|
|
12344
|
-
if (!n.length) {
|
|
12345
|
-
setTimeout(() => this.waitForClientAndBindLoad(e, t), this.clientWaitRetryDelay);
|
|
12346
|
-
return;
|
|
12347
|
-
}
|
|
12348
|
-
let r = n[0];
|
|
12349
|
-
r.on("load", () => {
|
|
12350
|
-
e === "client" && (this.duration = r.fields?.widgetDuration ?? 0), this.emit("load"), this.loaded = !0, t && t();
|
|
12351
|
-
});
|
|
12352
|
-
}
|
|
12353
|
-
enqueue(e, t = {}) {
|
|
12354
|
-
let n = this.hasItems(), r = Array.isArray(e) ? e.map((e) => ({
|
|
12355
|
-
value: e.value,
|
|
12356
|
-
options: e.options ?? {}
|
|
12357
|
-
})) : [{
|
|
12358
|
-
value: e,
|
|
12359
|
-
options: t
|
|
12360
|
-
}];
|
|
12361
|
-
for (let e of r) {
|
|
12362
|
-
let t = {
|
|
12363
|
-
isoDate: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12364
|
-
isLoop: e.options?.isLoop ?? !1,
|
|
12365
|
-
isPriority: e.options?.isPriority ?? !1,
|
|
12366
|
-
isImmediate: e.options?.isImmediate ?? !1,
|
|
12367
|
-
value: e.value
|
|
12368
|
-
};
|
|
12369
|
-
t.isPriority && t.isImmediate ? (this.cancel(), this.priorityQueue.unshift(t)) : (t.isPriority ? this.priorityQueue : this.queue).push(t);
|
|
12370
|
-
}
|
|
12371
|
-
return this.running === !1 && n === !1 && this.run(), this.emit("update", this.queue, this.priorityQueue, this.history, this.timeouts), this;
|
|
12372
|
-
}
|
|
12373
|
-
async run() {
|
|
12374
|
-
if (!this.hasItems()) {
|
|
12375
|
-
this.running = !1;
|
|
12376
|
-
return;
|
|
12363
|
+
}(), q = new W({
|
|
12364
|
+
duration: "client",
|
|
12365
|
+
processor: async function(e) {
|
|
12366
|
+
if (window.dispatchEvent(new CustomEvent(e.listener, { detail: e.data })), e.listener === "onEventReceived" && e.session) {
|
|
12367
|
+
let t = await K.event.onSessionUpdate(P?.[0] ? P[0].session : void 0, B.event.parseProvider(e.data));
|
|
12368
|
+
window.dispatchEvent(new CustomEvent("onSessionUpdate", { detail: t }));
|
|
12377
12369
|
}
|
|
12378
|
-
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();
|
|
12379
12370
|
}
|
|
12380
|
-
|
|
12381
|
-
|
|
12382
|
-
|
|
12383
|
-
|
|
12384
|
-
|
|
12385
|
-
|
|
12371
|
+
}), J = {
|
|
12372
|
+
responses: {},
|
|
12373
|
+
sendMessage(e, t = {}) {
|
|
12374
|
+
return new Promise((n, r) => {
|
|
12375
|
+
let i = "resp_" + Math.random().toString(36).substring(2, 15);
|
|
12376
|
+
t.response = i, t.request = e, SE_API.responses[i] = {
|
|
12377
|
+
resolve: n,
|
|
12378
|
+
reject: r
|
|
12379
|
+
}, parent?.postMessage(t, "*");
|
|
12380
|
+
});
|
|
12381
|
+
},
|
|
12382
|
+
counters: { get(e) {
|
|
12383
|
+
return null;
|
|
12384
|
+
} },
|
|
12385
|
+
store: {
|
|
12386
|
+
set: function(e, t) {
|
|
12387
|
+
this.list[e] = t, localStorage.setItem("SE_API-STORE", JSON.stringify(J.store.list));
|
|
12388
|
+
},
|
|
12389
|
+
get: async function(e) {
|
|
12390
|
+
return this.list[e] ? this.list[e] : null;
|
|
12391
|
+
},
|
|
12392
|
+
list: {}
|
|
12393
|
+
},
|
|
12394
|
+
resumeQueue: () => {
|
|
12386
12395
|
try {
|
|
12387
|
-
|
|
12396
|
+
q instanceof W && q?.resume();
|
|
12388
12397
|
} catch (e) {
|
|
12389
|
-
|
|
12398
|
+
return {
|
|
12399
|
+
ok: !1,
|
|
12400
|
+
error: e
|
|
12401
|
+
};
|
|
12390
12402
|
}
|
|
12391
|
-
|
|
12392
|
-
|
|
12393
|
-
|
|
12403
|
+
return { ok: !0 };
|
|
12404
|
+
},
|
|
12405
|
+
sanitize(e) {
|
|
12406
|
+
return e;
|
|
12407
|
+
},
|
|
12408
|
+
cheerFilter(e) {
|
|
12409
|
+
return e;
|
|
12410
|
+
},
|
|
12411
|
+
setField(e, t, n) {},
|
|
12412
|
+
getOverlayStatus: () => ({
|
|
12413
|
+
isEditorMode: !1,
|
|
12414
|
+
muted: !1
|
|
12415
|
+
}),
|
|
12416
|
+
events: {
|
|
12417
|
+
emit(e, t) {
|
|
12418
|
+
let n = {
|
|
12419
|
+
listener: e,
|
|
12420
|
+
event: t,
|
|
12421
|
+
result: void 0
|
|
12422
|
+
}, r = new CustomEvent("onEventReceived", { detail: n });
|
|
12423
|
+
return this.history.push({
|
|
12424
|
+
detail: n,
|
|
12425
|
+
timestamp: r.timeStamp,
|
|
12426
|
+
origin: P?.[0]?.id
|
|
12427
|
+
}), localStorage.setItem("SE_API-EVENTS", JSON.stringify(this.history)), window.dispatchEvent(r) ? { ok: !0 } : { ok: !1 };
|
|
12428
|
+
},
|
|
12429
|
+
broadcast(e, t) {
|
|
12430
|
+
let n = {
|
|
12431
|
+
listener: e,
|
|
12432
|
+
event: t,
|
|
12433
|
+
result: void 0
|
|
12434
|
+
}, r = new CustomEvent("onEventReceived", { detail: n });
|
|
12435
|
+
return this.history.push({
|
|
12436
|
+
detail: n,
|
|
12437
|
+
timestamp: Date.now(),
|
|
12438
|
+
origin: P?.[0]?.id
|
|
12439
|
+
}), localStorage.setItem("SE_API-EVENTS", JSON.stringify(this.history)), window.dispatchEvent(r) ? { ok: !0 } : { ok: !1 };
|
|
12440
|
+
},
|
|
12441
|
+
history: []
|
|
12394
12442
|
}
|
|
12395
|
-
|
|
12396
|
-
|
|
12443
|
+
}, Y = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(se());
|
|
12444
|
+
async function se() {
|
|
12445
|
+
let e = localStorage.getItem("SE_API-STORE") ?? "{}", t = e ? JSON.parse(e) : {};
|
|
12446
|
+
J.store.list = t;
|
|
12447
|
+
let n = localStorage.getItem("SE_API-EVENTS") ?? "[]", r = n ? JSON.parse(n) : [];
|
|
12448
|
+
return J.events.history = r, J;
|
|
12449
|
+
}
|
|
12450
|
+
//#endregion
|
|
12451
|
+
//#region src/modules/useStorage.ts
|
|
12452
|
+
var ce = class extends H {
|
|
12453
|
+
constructor(e) {
|
|
12454
|
+
super(), this.SE_API = null, this.id = "default", this.loaded = !1, this.id = e.id || this.id, this.data = e.data || {}, this.initial = structuredClone(this.data), F.push(this), Y?.then((e) => {
|
|
12455
|
+
this.SE_API = e, e.store.get(this.id).then((e) => {
|
|
12456
|
+
this.data = e || this.data, this.loaded = !0, this.emit("load", this.data), JSON.stringify(this.data) !== JSON.stringify(e) && this.emit("update", this.data, "internal");
|
|
12457
|
+
}).catch(() => {
|
|
12458
|
+
this.loaded = !0, this.emit("load", this.data);
|
|
12459
|
+
});
|
|
12460
|
+
});
|
|
12397
12461
|
}
|
|
12398
|
-
|
|
12399
|
-
|
|
12462
|
+
save(e = this.data) {
|
|
12463
|
+
if (this.loaded && this.SE_API) new i().isDiff(this.data, e) && (this.data = e, this.SE_API.store.set(this.id, this.data), this.emit("save", this.data));
|
|
12464
|
+
else throw Error("Storage not loaded yet");
|
|
12400
12465
|
}
|
|
12401
|
-
|
|
12402
|
-
this.
|
|
12466
|
+
update(e = this.data) {
|
|
12467
|
+
if (this.loaded && new i().isDiff(this.data, e)) {
|
|
12468
|
+
let t = {
|
|
12469
|
+
...this.data,
|
|
12470
|
+
...e
|
|
12471
|
+
};
|
|
12472
|
+
this.save(t), this.emit("update", t, "internal:update");
|
|
12473
|
+
} else throw Error("Storage not loaded yet or data is the same as current");
|
|
12403
12474
|
}
|
|
12404
|
-
|
|
12405
|
-
|
|
12475
|
+
add(e, t) {
|
|
12476
|
+
if (!this.loaded) throw Error("Storage not loaded yet");
|
|
12477
|
+
let n = structuredClone(this.data);
|
|
12478
|
+
n = new i().updateViaPath(n, e, t), this.save(n), this.emit("update", n, "internal:add");
|
|
12479
|
+
}
|
|
12480
|
+
clear() {
|
|
12481
|
+
if (this.loaded) this.save(this.initial), this.emit("update", this.data, "internal:clear");
|
|
12482
|
+
else throw Error("Storage not loaded yet");
|
|
12406
12483
|
}
|
|
12407
12484
|
on(e, t) {
|
|
12408
|
-
return e === "load" && this.loaded ? (t.apply(this), this) : (super.on(e, t), this);
|
|
12485
|
+
return e === "load" && this.loaded ? (t.apply(this, [this.data]), this) : (super.on(e, t), this);
|
|
12409
12486
|
}
|
|
12410
|
-
},
|
|
12411
|
-
|
|
12412
|
-
|
|
12413
|
-
|
|
12414
|
-
|
|
12415
|
-
|
|
12416
|
-
|
|
12487
|
+
}, le = class extends H {
|
|
12488
|
+
constructor(e) {
|
|
12489
|
+
super(), this.id = "default", this.debug = !1, this.fields = {}, this.loaded = !1, this.actions = {
|
|
12490
|
+
commands: [],
|
|
12491
|
+
buttons: []
|
|
12492
|
+
}, this.cache = {
|
|
12493
|
+
avatar: 30,
|
|
12494
|
+
pronoun: 60,
|
|
12495
|
+
emote: 120
|
|
12496
|
+
}, this.id = e.id || this.id, this.storage = new ce({
|
|
12497
|
+
id: this.id,
|
|
12498
|
+
data: {
|
|
12499
|
+
user: {},
|
|
12500
|
+
avatar: {},
|
|
12501
|
+
pronoun: {},
|
|
12502
|
+
emote: {}
|
|
12503
|
+
}
|
|
12504
|
+
}), this.on("load", () => {
|
|
12505
|
+
this.debug = !!(typeof e.debug == "function" ? e.debug() : e.debug);
|
|
12506
|
+
}), P.push(this);
|
|
12507
|
+
}
|
|
12508
|
+
on(e, t) {
|
|
12509
|
+
return e === "load" && this.loaded ? (t.apply(this, [{
|
|
12510
|
+
channel: this.details.user,
|
|
12511
|
+
currency: this.details.currency,
|
|
12512
|
+
fieldData: this.fields,
|
|
12513
|
+
recents: [],
|
|
12514
|
+
session: {
|
|
12515
|
+
data: this.session,
|
|
12516
|
+
settings: {
|
|
12517
|
+
autoReset: !1,
|
|
12518
|
+
calendar: !1,
|
|
12519
|
+
resetOnStart: !1
|
|
12520
|
+
}
|
|
12521
|
+
},
|
|
12522
|
+
overlay: this.details.overlay,
|
|
12523
|
+
emulated: !1
|
|
12524
|
+
}]), this) : (super.on(e, t), this);
|
|
12417
12525
|
}
|
|
12418
|
-
}
|
|
12526
|
+
}, X = new class {
|
|
12419
12527
|
constructor() {
|
|
12420
12528
|
this.twitch = {
|
|
12421
12529
|
message(e = {}) {
|
|
12422
|
-
|
|
12423
|
-
e &&
|
|
12530
|
+
K.event.onEventReceived("twitch", "message", e).then((e) => {
|
|
12531
|
+
e && X.send("onEventReceived", e);
|
|
12424
12532
|
});
|
|
12425
12533
|
},
|
|
12426
12534
|
deleteMessage(e) {
|
|
@@ -12429,7 +12537,7 @@ var G = new class {
|
|
|
12429
12537
|
listener: "delete-message",
|
|
12430
12538
|
event: { msgId: e }
|
|
12431
12539
|
};
|
|
12432
|
-
|
|
12540
|
+
X.send("onEventReceived", t);
|
|
12433
12541
|
},
|
|
12434
12542
|
deleteMessages(e) {
|
|
12435
12543
|
if (!e || typeof e != "string") return;
|
|
@@ -12437,58 +12545,58 @@ var G = new class {
|
|
|
12437
12545
|
listener: "delete-messages",
|
|
12438
12546
|
event: { userId: e }
|
|
12439
12547
|
};
|
|
12440
|
-
|
|
12548
|
+
X.send("onEventReceived", t);
|
|
12441
12549
|
},
|
|
12442
12550
|
follower(e = {}) {
|
|
12443
|
-
|
|
12444
|
-
e &&
|
|
12551
|
+
K.event.onEventReceived("twitch", "follower-latest", e).then((e) => {
|
|
12552
|
+
e && X.send("onEventReceived", e);
|
|
12445
12553
|
});
|
|
12446
12554
|
},
|
|
12447
12555
|
raid(e = {}) {
|
|
12448
|
-
|
|
12449
|
-
e &&
|
|
12556
|
+
K.event.onEventReceived("twitch", "raid-latest", e).then((e) => {
|
|
12557
|
+
e && X.send("onEventReceived", e);
|
|
12450
12558
|
});
|
|
12451
12559
|
},
|
|
12452
12560
|
cheer(e = {}) {
|
|
12453
|
-
|
|
12454
|
-
e &&
|
|
12561
|
+
K.event.onEventReceived("twitch", "cheer-latest", e).then((e) => {
|
|
12562
|
+
e && X.send("onEventReceived", e);
|
|
12455
12563
|
});
|
|
12456
12564
|
},
|
|
12457
12565
|
subscriber(e = {}) {
|
|
12458
|
-
|
|
12459
|
-
e &&
|
|
12566
|
+
K.event.onEventReceived("twitch", "subscriber-latest", e).then((e) => {
|
|
12567
|
+
e && X.send("onEventReceived", e);
|
|
12460
12568
|
});
|
|
12461
12569
|
}
|
|
12462
12570
|
}, this.streamelements = { tip(e = {}) {
|
|
12463
|
-
|
|
12464
|
-
e &&
|
|
12571
|
+
K.event.onEventReceived("streamelements", "tip-latest", e).then((e) => {
|
|
12572
|
+
e && X.send("onEventReceived", e);
|
|
12465
12573
|
});
|
|
12466
12574
|
} }, this.youtube = {
|
|
12467
12575
|
message(e = {}) {
|
|
12468
|
-
|
|
12469
|
-
e &&
|
|
12576
|
+
K.event.onEventReceived("youtube", "message", e).then((e) => {
|
|
12577
|
+
e && X.send("onEventReceived", e);
|
|
12470
12578
|
});
|
|
12471
12579
|
},
|
|
12472
12580
|
subscriber(e = {}) {
|
|
12473
|
-
|
|
12474
|
-
e &&
|
|
12581
|
+
K.event.onEventReceived("youtube", "subscriber-latest", e).then((e) => {
|
|
12582
|
+
e && X.send("onEventReceived", e);
|
|
12475
12583
|
});
|
|
12476
12584
|
},
|
|
12477
12585
|
superchat(e = {}) {
|
|
12478
|
-
|
|
12479
|
-
e &&
|
|
12586
|
+
K.event.onEventReceived("youtube", "superchat-latest", e).then((e) => {
|
|
12587
|
+
e && X.send("onEventReceived", e);
|
|
12480
12588
|
});
|
|
12481
12589
|
},
|
|
12482
12590
|
sponsor(e = {}) {
|
|
12483
|
-
|
|
12484
|
-
e &&
|
|
12591
|
+
K.event.onEventReceived("youtube", "sponsor-latest", e).then((e) => {
|
|
12592
|
+
e && X.send("onEventReceived", e);
|
|
12485
12593
|
});
|
|
12486
12594
|
}
|
|
12487
12595
|
}, this.kick = {}, this.facebook = {};
|
|
12488
12596
|
}
|
|
12489
12597
|
send(e, t) {
|
|
12490
12598
|
if (!q) {
|
|
12491
|
-
|
|
12599
|
+
console.warn("Local queue is not initialized."), window.dispatchEvent(new CustomEvent(e, { detail: t }));
|
|
12492
12600
|
return;
|
|
12493
12601
|
}
|
|
12494
12602
|
switch (e) {
|
|
@@ -12513,9 +12621,9 @@ var G = new class {
|
|
|
12513
12621
|
break;
|
|
12514
12622
|
}
|
|
12515
12623
|
}
|
|
12516
|
-
}(),
|
|
12624
|
+
}(), Z;
|
|
12517
12625
|
(function(e) {
|
|
12518
|
-
e.queue = q, e.generate =
|
|
12626
|
+
e.queue = q, e.generate = K, e.emulate = X;
|
|
12519
12627
|
async function t(e = [
|
|
12520
12628
|
"fields.json",
|
|
12521
12629
|
"cf.json",
|
|
@@ -12544,19 +12652,19 @@ var G = new class {
|
|
|
12544
12652
|
})
|
|
12545
12653
|
}, i = await fetch("./" + (r.data ?? "data.json"), { cache: "no-store" }).then((e) => e.json()).catch(() => ({}));
|
|
12546
12654
|
await fetch("./" + (r.fields ?? "fields.json"), { cache: "no-store" }).then((e) => e.json()).then(async (e) => {
|
|
12547
|
-
let t = Object.entries(e).filter(([e, { value: t }]) => t != null).reduce((e, [t, { value: n }]) => (i && i[t] !== void 0 && (n = i[t]), e[t] = n, e), { ...i }), r = await
|
|
12655
|
+
let t = Object.entries(e).filter(([e, { value: t }]) => t != null).reduce((e, [t, { value: n }]) => (i && i[t] !== void 0 && (n = i[t]), e[t] = n, e), { ...i }), r = await Z.generate.event.onWidgetLoad(t, await Z.generate.session.get(n));
|
|
12548
12656
|
window.dispatchEvent(new CustomEvent("onWidgetLoad", { detail: r }));
|
|
12549
12657
|
});
|
|
12550
12658
|
}
|
|
12551
12659
|
e.start = t;
|
|
12552
|
-
})(
|
|
12660
|
+
})(Z ||= {});
|
|
12553
12661
|
//#endregion
|
|
12554
12662
|
//#region src/modules/fakeUser.ts
|
|
12555
|
-
var
|
|
12663
|
+
var ue = class {
|
|
12556
12664
|
constructor(e, t, n = [], r = !1, i) {
|
|
12557
12665
|
this.badges = [], this.isSubscriber = !1, this.id = e, this.name = t, this.login = t.toLocaleLowerCase(), this.badges = n, this.isSubscriber = r, this.tier = i;
|
|
12558
12666
|
}
|
|
12559
|
-
},
|
|
12667
|
+
}, de = {
|
|
12560
12668
|
broadcaster: [
|
|
12561
12669
|
"moderator",
|
|
12562
12670
|
"vip",
|
|
@@ -12573,7 +12681,7 @@ var le = class {
|
|
|
12573
12681
|
"duelyst_6",
|
|
12574
12682
|
"duelyst_7"
|
|
12575
12683
|
]
|
|
12576
|
-
},
|
|
12684
|
+
}, fe = class e extends H {
|
|
12577
12685
|
static fixUser(t) {
|
|
12578
12686
|
return typeof t == "string" ? t.trim().replace(/^@+/, "").toLocaleLowerCase() : e.fixUser(t.name);
|
|
12579
12687
|
}
|
|
@@ -12638,7 +12746,7 @@ var le = class {
|
|
|
12638
12746
|
}
|
|
12639
12747
|
return null;
|
|
12640
12748
|
};
|
|
12641
|
-
for (let [e, t] of C(
|
|
12749
|
+
for (let [e, t] of C(de, r?.incompatible)) if (d.has(e)) for (let n of x(t)) d.has(n) && w(e, n);
|
|
12642
12750
|
for (let e of a) {
|
|
12643
12751
|
let t = b(u[e]);
|
|
12644
12752
|
for (let n of t) {
|
|
@@ -12684,7 +12792,7 @@ var le = class {
|
|
|
12684
12792
|
continue;
|
|
12685
12793
|
}
|
|
12686
12794
|
n.length < c && this.emit("warn", /* @__PURE__ */ Error(`User "${t}" could only receive ${n.length} badge(s), below the configured minimum of ${c}`));
|
|
12687
|
-
let i = o.length + 1, a = n.some((e) => ["subscriber"].includes(String(e).toLocaleLowerCase())), s = new
|
|
12795
|
+
let i = o.length + 1, a = n.some((e) => ["subscriber"].includes(String(e).toLocaleLowerCase())), s = new ue(`fake_user_${i.toString().padStart(2, "0")}_${Math.random().toString(36).slice(2, 8)}+${this.id}`, t, n, a, a ? e.getRandomSubTier() : void 0);
|
|
12688
12796
|
o.push(s);
|
|
12689
12797
|
}
|
|
12690
12798
|
return o.length < i.length && this.emit("warn", /* @__PURE__ */ Error("Some users could not be assigned badges due to limits. Consider increasing limits or adding more badges.")), o;
|
|
@@ -12739,9 +12847,9 @@ var le = class {
|
|
|
12739
12847
|
message: new C().array(e)[0]
|
|
12740
12848
|
};
|
|
12741
12849
|
}
|
|
12742
|
-
},
|
|
12850
|
+
}, pe = class extends H {
|
|
12743
12851
|
constructor(e = {}) {
|
|
12744
|
-
super(), this.SE_API = null, this.id = "widget communications", this.loaded = !1, this.history = [], this.detected = /* @__PURE__ */ new Set(), this.id = e.id || this.id, I.push(this),
|
|
12852
|
+
super(), this.SE_API = null, this.id = "widget communications", this.loaded = !1, this.history = [], this.detected = /* @__PURE__ */ new Set(), this.id = e.id || this.id, I.push(this), Y?.then(async (e) => {
|
|
12745
12853
|
this.loaded = !0, this.SE_API = e, Promise.all([async () => {
|
|
12746
12854
|
let t = await e.store.get(this.id);
|
|
12747
12855
|
t && (this.history = t.slice(-10));
|
|
@@ -12770,7 +12878,7 @@ var le = class {
|
|
|
12770
12878
|
on(e, t) {
|
|
12771
12879
|
return e === "load" && this.loaded ? (t.apply(this), this) : (super.on(e, t), this);
|
|
12772
12880
|
}
|
|
12773
|
-
},
|
|
12881
|
+
}, me = class {
|
|
12774
12882
|
constructor(e = {}) {
|
|
12775
12883
|
this.error = this.apply({
|
|
12776
12884
|
color: "#721c24",
|
|
@@ -12868,7 +12976,7 @@ var le = class {
|
|
|
12868
12976
|
timeEnd(e) {
|
|
12869
12977
|
!this.enabled || !console.timeEnd || console.timeEnd(e);
|
|
12870
12978
|
}
|
|
12871
|
-
},
|
|
12979
|
+
}, he = class extends H {
|
|
12872
12980
|
constructor(e, t) {
|
|
12873
12981
|
super(), this.isDebug = !1, this.init = !1, this.emulate = !1, this.username = e.username, this.password = e.password, this.channels = e.channels, this.isDebug = !!e.isDebug, this.init = !!e.init, this.emulate = t, this.load().then((e) => {
|
|
12874
12982
|
this.instance = e, this.emit("load", e), this.connect();
|
|
@@ -12905,7 +13013,7 @@ var le = class {
|
|
|
12905
13013
|
msgId: i.id,
|
|
12906
13014
|
channel: i.channel
|
|
12907
13015
|
};
|
|
12908
|
-
|
|
13016
|
+
Z.emulate.twitch.message(o);
|
|
12909
13017
|
}
|
|
12910
13018
|
}, this.instance.onChat = (e, t, n, r, i) => {
|
|
12911
13019
|
if (this.emit("chat", e, t, n, r, i), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Chat: ${t} (User: ${e})`), this.emulate) {
|
|
@@ -12918,7 +13026,7 @@ var le = class {
|
|
|
12918
13026
|
subscriber: n.subscriber,
|
|
12919
13027
|
founder: n.founder
|
|
12920
13028
|
};
|
|
12921
|
-
|
|
13029
|
+
Z.emulate.twitch.message({
|
|
12922
13030
|
name: e,
|
|
12923
13031
|
message: t,
|
|
12924
13032
|
badges: Object.entries(r).map(([e, t]) => t ? e : null).filter(Boolean),
|
|
@@ -12932,7 +13040,7 @@ var le = class {
|
|
|
12932
13040
|
}, this.instance.onWhisper = (e, t, n, r, i) => {
|
|
12933
13041
|
this.emit("whisper", e, t, n, r, i), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Whisper: ${t} (User: ${e})`);
|
|
12934
13042
|
}, this.instance.onMessageDeleted = (e, t) => {
|
|
12935
|
-
this.emit("messageDeleted", e, t), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Message Deleted: ${e}`), this.emulate &&
|
|
13043
|
+
this.emit("messageDeleted", e, t), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Message Deleted: ${e}`), this.emulate && Z.emulate.twitch.deleteMessage(e);
|
|
12936
13044
|
}, this.instance.onJoin = (e, t, n) => {
|
|
12937
13045
|
this.emit("join", e, t, n), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Join: ${e}`);
|
|
12938
13046
|
}, this.instance.onPart = (e, t, n) => {
|
|
@@ -12940,14 +13048,14 @@ var le = class {
|
|
|
12940
13048
|
}, this.instance.onHosted = (e, t, n, r) => {
|
|
12941
13049
|
this.emit("hosted", e, t, n, r), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Hosted: ${e} (${t} viewers)`);
|
|
12942
13050
|
}, this.instance.onRaid = (e, t, n) => {
|
|
12943
|
-
this.emit("raid", e, t, n), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Raid: ${e} (${t} viewers)`), this.emulate &&
|
|
13051
|
+
this.emit("raid", e, t, n), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Raid: ${e} (${t} viewers)`), this.emulate && Z.emulate.twitch.raid({
|
|
12944
13052
|
name: e,
|
|
12945
13053
|
amount: t
|
|
12946
13054
|
});
|
|
12947
13055
|
}, this.instance.onSub = (e, t, n, r) => {
|
|
12948
13056
|
if (this.emit("sub", e, t, n, r), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Sub: ${e} (${n.plan})`), this.emulate) {
|
|
12949
13057
|
let r = n.plan === "Prime" ? "prime" : n.plan;
|
|
12950
|
-
|
|
13058
|
+
Z.emulate.twitch.subscriber({
|
|
12951
13059
|
name: e,
|
|
12952
13060
|
message: t,
|
|
12953
13061
|
tier: r,
|
|
@@ -12957,7 +13065,7 @@ var le = class {
|
|
|
12957
13065
|
}, this.instance.onResub = (e, t, n, r, i, a) => {
|
|
12958
13066
|
if (this.emit("resub", e, t, n, r, i, a), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Resub: ${e} (${r} months)`), this.emulate) {
|
|
12959
13067
|
let n = i.plan === "Prime" ? "prime" : i.plan;
|
|
12960
|
-
|
|
13068
|
+
Z.emulate.twitch.subscriber({
|
|
12961
13069
|
name: e,
|
|
12962
13070
|
message: t,
|
|
12963
13071
|
tier: n,
|
|
@@ -12968,7 +13076,7 @@ var le = class {
|
|
|
12968
13076
|
}, this.instance.onSubGift = (e, t, n, r, i, a) => {
|
|
12969
13077
|
if (this.emit("subGift", e, t, n, r, i, a), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Sub Gift: ${e} gifted ${r} subs`), this.emulate) {
|
|
12970
13078
|
let t = i.plan === "Prime" ? "prime" : i.plan;
|
|
12971
|
-
|
|
13079
|
+
Z.emulate.twitch.subscriber({
|
|
12972
13080
|
name: n,
|
|
12973
13081
|
message: "",
|
|
12974
13082
|
sender: e,
|
|
@@ -12980,7 +13088,7 @@ var le = class {
|
|
|
12980
13088
|
}, this.instance.onSubMysteryGift = (e, t, n, r, i) => {
|
|
12981
13089
|
if (this.emit("subMysteryGift", e, t, n, r, i), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Sub Mystery Gift: ${e} gifted ${t} subs`), this.emulate) {
|
|
12982
13090
|
let n = r.plan === "Prime" ? "prime" : r.plan;
|
|
12983
|
-
|
|
13091
|
+
Z.emulate.twitch.subscriber({
|
|
12984
13092
|
name: e,
|
|
12985
13093
|
message: "",
|
|
12986
13094
|
amount: t,
|
|
@@ -12989,7 +13097,7 @@ var le = class {
|
|
|
12989
13097
|
});
|
|
12990
13098
|
}
|
|
12991
13099
|
}, this.instance.onGiftSubContinue = (e, t, n) => {
|
|
12992
|
-
this.emit("giftSubContinue", e, t, n), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Gift Sub Continue: ${e} continued their gifted sub from ${t}`), this.emulate &&
|
|
13100
|
+
this.emit("giftSubContinue", e, t, n), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Gift Sub Continue: ${e} continued their gifted sub from ${t}`), this.emulate && Z.emulate.twitch.subscriber({
|
|
12993
13101
|
name: e,
|
|
12994
13102
|
message: "",
|
|
12995
13103
|
sender: t,
|
|
@@ -12997,7 +13105,7 @@ var le = class {
|
|
|
12997
13105
|
subType: "gift"
|
|
12998
13106
|
});
|
|
12999
13107
|
}, this.instance.onCheer = (e, t, n, r, i) => {
|
|
13000
|
-
this.emit("cheer", e, t, n, r, i), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Cheer: ${e} cheered ${n} bits - ${t}`), this.emulate &&
|
|
13108
|
+
this.emit("cheer", e, t, n, r, i), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Cheer: ${e} cheered ${n} bits - ${t}`), this.emulate && Z.emulate.twitch.cheer({
|
|
13001
13109
|
name: e,
|
|
13002
13110
|
message: t,
|
|
13003
13111
|
amount: n
|
|
@@ -13012,88 +13120,7 @@ var le = class {
|
|
|
13012
13120
|
this.emit("reconnect", e), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Reconnect: Attempt #${e}`);
|
|
13013
13121
|
}, this.init && this.instance.Init(this.username, this.password, this.channels, this.isDebug);
|
|
13014
13122
|
}
|
|
13015
|
-
},
|
|
13016
|
-
responses: {},
|
|
13017
|
-
sendMessage(e, t = {}) {
|
|
13018
|
-
return new Promise((n, r) => {
|
|
13019
|
-
let i = "resp_" + Math.random().toString(36).substring(2, 15);
|
|
13020
|
-
t.response = i, t.request = e, SE_API.responses[i] = {
|
|
13021
|
-
resolve: n,
|
|
13022
|
-
reject: r
|
|
13023
|
-
}, parent?.postMessage(t, "*");
|
|
13024
|
-
});
|
|
13025
|
-
},
|
|
13026
|
-
counters: { get(e) {
|
|
13027
|
-
return null;
|
|
13028
|
-
} },
|
|
13029
|
-
store: {
|
|
13030
|
-
set: function(e, t) {
|
|
13031
|
-
this.list[e] = t, localStorage.setItem("SE_API-STORE", JSON.stringify(X.store.list));
|
|
13032
|
-
},
|
|
13033
|
-
get: async function(e) {
|
|
13034
|
-
return this.list[e] ? this.list[e] : null;
|
|
13035
|
-
},
|
|
13036
|
-
list: {}
|
|
13037
|
-
},
|
|
13038
|
-
resumeQueue: () => {
|
|
13039
|
-
try {
|
|
13040
|
-
q instanceof K && q?.resume();
|
|
13041
|
-
} catch (e) {
|
|
13042
|
-
return {
|
|
13043
|
-
ok: !1,
|
|
13044
|
-
error: e
|
|
13045
|
-
};
|
|
13046
|
-
}
|
|
13047
|
-
return { ok: !0 };
|
|
13048
|
-
},
|
|
13049
|
-
sanitize(e) {
|
|
13050
|
-
return e;
|
|
13051
|
-
},
|
|
13052
|
-
cheerFilter(e) {
|
|
13053
|
-
return e;
|
|
13054
|
-
},
|
|
13055
|
-
setField(e, t, n) {},
|
|
13056
|
-
getOverlayStatus: () => ({
|
|
13057
|
-
isEditorMode: !1,
|
|
13058
|
-
muted: !1
|
|
13059
|
-
}),
|
|
13060
|
-
events: {
|
|
13061
|
-
emit(e, t) {
|
|
13062
|
-
let n = {
|
|
13063
|
-
listener: e,
|
|
13064
|
-
event: t,
|
|
13065
|
-
result: void 0
|
|
13066
|
-
}, r = new CustomEvent("onEventReceived", { detail: n });
|
|
13067
|
-
return this.history.push({
|
|
13068
|
-
detail: n,
|
|
13069
|
-
timestamp: r.timeStamp,
|
|
13070
|
-
origin: P?.[0]?.id
|
|
13071
|
-
}), localStorage.setItem("SE_API-EVENTS", JSON.stringify(this.history)), window.dispatchEvent(r) ? { ok: !0 } : { ok: !1 };
|
|
13072
|
-
},
|
|
13073
|
-
broadcast(e, t) {
|
|
13074
|
-
let n = {
|
|
13075
|
-
listener: e,
|
|
13076
|
-
event: t,
|
|
13077
|
-
result: void 0
|
|
13078
|
-
}, r = new CustomEvent("onEventReceived", { detail: n });
|
|
13079
|
-
return this.history.push({
|
|
13080
|
-
detail: n,
|
|
13081
|
-
timestamp: Date.now(),
|
|
13082
|
-
origin: P?.[0]?.id
|
|
13083
|
-
}), localStorage.setItem("SE_API-EVENTS", JSON.stringify(this.history)), window.dispatchEvent(r) ? { ok: !0 } : { ok: !1 };
|
|
13084
|
-
},
|
|
13085
|
-
history: []
|
|
13086
|
-
}
|
|
13087
|
-
};
|
|
13088
|
-
async function he() {
|
|
13089
|
-
let e = localStorage.getItem("SE_API-STORE") ?? "{}", t = e ? JSON.parse(e) : {};
|
|
13090
|
-
X.store.list = t;
|
|
13091
|
-
let n = localStorage.getItem("SE_API-EVENTS") ?? "[]", r = n ? JSON.parse(n) : [];
|
|
13092
|
-
return X.events.history = r, X;
|
|
13093
|
-
}
|
|
13094
|
-
//#endregion
|
|
13095
|
-
//#region src/utils/alejo.ts
|
|
13096
|
-
var ge;
|
|
13123
|
+
}, ge;
|
|
13097
13124
|
(function(e) {
|
|
13098
13125
|
let t;
|
|
13099
13126
|
(function(e) {
|
|
@@ -13143,26 +13170,26 @@ var ge;
|
|
|
13143
13170
|
})(ge ||= {});
|
|
13144
13171
|
//#endregion
|
|
13145
13172
|
//#region src/main.ts
|
|
13146
|
-
var
|
|
13147
|
-
SeAPI:
|
|
13148
|
-
Client:
|
|
13173
|
+
var Q = new me(), $ = {
|
|
13174
|
+
SeAPI: Y,
|
|
13175
|
+
Client: le,
|
|
13149
13176
|
Helper: B,
|
|
13150
|
-
Local:
|
|
13177
|
+
Local: Z,
|
|
13151
13178
|
Data: S,
|
|
13152
13179
|
logger: Q,
|
|
13153
13180
|
modules: {
|
|
13154
13181
|
EventProvider: H,
|
|
13155
|
-
useStorage:
|
|
13156
|
-
useQueue:
|
|
13157
|
-
useLogger:
|
|
13158
|
-
useComms:
|
|
13159
|
-
FakeUserPool:
|
|
13182
|
+
useStorage: ce,
|
|
13183
|
+
useQueue: W,
|
|
13184
|
+
useLogger: me,
|
|
13185
|
+
useComms: pe,
|
|
13186
|
+
FakeUserPool: fe
|
|
13160
13187
|
},
|
|
13161
13188
|
actions: {
|
|
13162
13189
|
Button: ie,
|
|
13163
13190
|
Command: V
|
|
13164
13191
|
},
|
|
13165
|
-
multistream: { useComfyJs:
|
|
13192
|
+
multistream: { useComfyJs: he },
|
|
13166
13193
|
internal: te,
|
|
13167
13194
|
pronouns: { Alejo: ge }
|
|
13168
13195
|
};
|