@tixyel/streamelements 7.6.5 → 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 +291 -266
- package/dist/index.es.js +319 -288
- 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++) {
|
|
@@ -10623,7 +10651,11 @@ window.addEventListener("onWidgetLoad", async (e) => {
|
|
|
10623
10651
|
"event:skip",
|
|
10624
10652
|
"event:test",
|
|
10625
10653
|
"kvstore:update"
|
|
10626
|
-
].some((e) => e === n.data.listener) &&
|
|
10654
|
+
].some((e) => e === n.data.listener) && [
|
|
10655
|
+
"streamelements",
|
|
10656
|
+
"twitch",
|
|
10657
|
+
"youtube"
|
|
10658
|
+
].some((e) => e === n.provider) && Q.received("[Client]", `Event ${n.data.listener} received from ${n.provider}`, n.data.event);
|
|
10627
10659
|
});
|
|
10628
10660
|
});
|
|
10629
10661
|
//#endregion
|
|
@@ -10652,85 +10684,89 @@ var H = class {
|
|
|
10652
10684
|
removeAllListeners(e) {
|
|
10653
10685
|
return this.registeredEvents[e] = [], this;
|
|
10654
10686
|
}
|
|
10655
|
-
}, U =
|
|
10687
|
+
}, U = () => {
|
|
10688
|
+
try {
|
|
10689
|
+
return P;
|
|
10690
|
+
} catch {
|
|
10691
|
+
return [];
|
|
10692
|
+
}
|
|
10693
|
+
}, W = class extends H {
|
|
10656
10694
|
constructor(e) {
|
|
10657
|
-
super(), this.
|
|
10658
|
-
|
|
10659
|
-
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);
|
|
10660
|
-
}).catch(() => {
|
|
10661
|
-
this.loaded = !0, this.emit("load", this.data);
|
|
10662
|
-
});
|
|
10663
|
-
});
|
|
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);
|
|
10664
10697
|
}
|
|
10665
|
-
|
|
10666
|
-
|
|
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
|
+
});
|
|
10667
10708
|
}
|
|
10668
|
-
|
|
10669
|
-
|
|
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) {
|
|
10670
10718
|
let t = {
|
|
10671
|
-
|
|
10672
|
-
|
|
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
|
|
10673
10724
|
};
|
|
10674
|
-
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;
|
|
10675
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();
|
|
10676
10735
|
}
|
|
10677
|
-
|
|
10678
|
-
|
|
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);
|
|
10679
10750
|
}
|
|
10680
|
-
|
|
10681
|
-
this.
|
|
10751
|
+
resume() {
|
|
10752
|
+
return this.running && this.cancel(), this.hasItems() && this.run(), this;
|
|
10682
10753
|
}
|
|
10683
|
-
|
|
10684
|
-
|
|
10685
|
-
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]];
|
|
10686
|
-
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;
|
|
10687
10756
|
}
|
|
10688
|
-
|
|
10689
|
-
|
|
10757
|
+
cancel() {
|
|
10758
|
+
this.running && (this.timeouts.forEach((e) => clearTimeout(e)), this.timeouts = [], this.running = !1, this.emit("cancel"));
|
|
10690
10759
|
}
|
|
10691
|
-
|
|
10692
|
-
|
|
10693
|
-
super(), this.id = "default", this.debug = !1, this.fields = {}, this.loaded = !1, this.actions = {
|
|
10694
|
-
commands: [],
|
|
10695
|
-
buttons: []
|
|
10696
|
-
}, this.cache = {
|
|
10697
|
-
avatar: 30,
|
|
10698
|
-
pronoun: 60,
|
|
10699
|
-
emote: 120
|
|
10700
|
-
}, this.id = e.id || this.id, this.storage = new U({
|
|
10701
|
-
id: this.id,
|
|
10702
|
-
data: {
|
|
10703
|
-
user: {},
|
|
10704
|
-
avatar: {},
|
|
10705
|
-
pronoun: {},
|
|
10706
|
-
emote: {}
|
|
10707
|
-
}
|
|
10708
|
-
}), this.on("load", () => {
|
|
10709
|
-
this.debug = !!(typeof e.debug == "function" ? e.debug() : e.debug);
|
|
10710
|
-
}), P.push(this);
|
|
10760
|
+
hasItems() {
|
|
10761
|
+
return this.queue.length > 0 || this.priorityQueue.length > 0;
|
|
10711
10762
|
}
|
|
10712
10763
|
on(e, t) {
|
|
10713
|
-
return e === "load" && this.loaded ? (t.apply(this,
|
|
10714
|
-
channel: this.details.user,
|
|
10715
|
-
currency: this.details.currency,
|
|
10716
|
-
fieldData: this.fields,
|
|
10717
|
-
recents: [],
|
|
10718
|
-
session: {
|
|
10719
|
-
data: this.session,
|
|
10720
|
-
settings: {
|
|
10721
|
-
autoReset: !1,
|
|
10722
|
-
calendar: !1,
|
|
10723
|
-
resetOnStart: !1
|
|
10724
|
-
}
|
|
10725
|
-
},
|
|
10726
|
-
overlay: this.details.overlay,
|
|
10727
|
-
emulated: !1
|
|
10728
|
-
}]), this) : (super.on(e, t), this);
|
|
10764
|
+
return e === "load" && this.loaded ? (t.apply(this), this) : (super.on(e, t), this);
|
|
10729
10765
|
}
|
|
10730
10766
|
};
|
|
10731
10767
|
//#endregion
|
|
10732
10768
|
//#region src/local/generator.ts
|
|
10733
|
-
async function
|
|
10769
|
+
async function ae(e, t, n = "USD") {
|
|
10734
10770
|
let r = {
|
|
10735
10771
|
BRL: {
|
|
10736
10772
|
code: "BRL",
|
|
@@ -10774,8 +10810,8 @@ async function oe(e, t, n = "USD") {
|
|
|
10774
10810
|
emulated: !0
|
|
10775
10811
|
};
|
|
10776
10812
|
}
|
|
10777
|
-
async function
|
|
10778
|
-
if (e ??= await
|
|
10813
|
+
async function oe(e, t) {
|
|
10814
|
+
if (e ??= await K.session.get(), t) {
|
|
10779
10815
|
let n = (e, t) => new Date(t.createdAt).getTime() - new Date(e.createdAt).getTime();
|
|
10780
10816
|
switch (t.provider) {
|
|
10781
10817
|
case "twitch": {
|
|
@@ -10943,7 +10979,7 @@ async function se(e, t) {
|
|
|
10943
10979
|
emulated: !0
|
|
10944
10980
|
};
|
|
10945
10981
|
}
|
|
10946
|
-
async function
|
|
10982
|
+
async function G(e = "random", t = "random", n = {}) {
|
|
10947
10983
|
let r = {
|
|
10948
10984
|
twitch: [
|
|
10949
10985
|
"message",
|
|
@@ -10966,12 +11002,12 @@ async function W(e = "random", t = "random", n = {}) {
|
|
|
10966
11002
|
default:
|
|
10967
11003
|
case "random":
|
|
10968
11004
|
var i = new C().array(Object.keys(r).filter((e) => r[e].length))[0], a = new C().array(r[i])[0];
|
|
10969
|
-
return
|
|
11005
|
+
return G(i, a);
|
|
10970
11006
|
case "twitch": switch (t) {
|
|
10971
11007
|
default:
|
|
10972
11008
|
case "random":
|
|
10973
11009
|
var a = new C().array(r[e])[0];
|
|
10974
|
-
return
|
|
11010
|
+
return G(e, a);
|
|
10975
11011
|
case "message": {
|
|
10976
11012
|
let t = n;
|
|
10977
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 ? {
|
|
@@ -11197,7 +11233,7 @@ async function W(e = "random", t = "random", n = {}) {
|
|
|
11197
11233
|
default:
|
|
11198
11234
|
case "random":
|
|
11199
11235
|
var a = new C().array(r[e])[0];
|
|
11200
|
-
return
|
|
11236
|
+
return G(e, a);
|
|
11201
11237
|
case "tip":
|
|
11202
11238
|
case "tip-latest":
|
|
11203
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];
|
|
@@ -11258,7 +11294,7 @@ async function W(e = "random", t = "random", n = {}) {
|
|
|
11258
11294
|
default:
|
|
11259
11295
|
case "random":
|
|
11260
11296
|
var a = new C().array(r[e])[0];
|
|
11261
|
-
return
|
|
11297
|
+
return G(e, a);
|
|
11262
11298
|
case "message": {
|
|
11263
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];
|
|
11264
11300
|
let t = await new w().generateBadges(n?.badges ?? [], e);
|
|
@@ -11394,12 +11430,12 @@ async function W(e = "random", t = "random", n = {}) {
|
|
|
11394
11430
|
}
|
|
11395
11431
|
}
|
|
11396
11432
|
}
|
|
11397
|
-
var
|
|
11433
|
+
var K = new class {
|
|
11398
11434
|
constructor() {
|
|
11399
11435
|
this.event = {
|
|
11400
|
-
onWidgetLoad:
|
|
11401
|
-
onSessionUpdate:
|
|
11402
|
-
onEventReceived:
|
|
11436
|
+
onWidgetLoad: ae,
|
|
11437
|
+
onSessionUpdate: oe,
|
|
11438
|
+
onEventReceived: G
|
|
11403
11439
|
}, this.session = {
|
|
11404
11440
|
types: {
|
|
11405
11441
|
name: {
|
|
@@ -12324,99 +12360,175 @@ var G = new class {
|
|
|
12324
12360
|
}
|
|
12325
12361
|
};
|
|
12326
12362
|
}
|
|
12327
|
-
}(),
|
|
12328
|
-
|
|
12329
|
-
|
|
12330
|
-
|
|
12331
|
-
|
|
12332
|
-
|
|
12333
|
-
}, K = class extends H {
|
|
12334
|
-
constructor(e) {
|
|
12335
|
-
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.");
|
|
12336
|
-
this.processor = e.processor, e.duration !== "client" && (this.duration = e.duration ?? 0), this.waitForClientAndBindLoad(e.duration);
|
|
12337
|
-
}
|
|
12338
|
-
waitForClientAndBindLoad(e = this.duration, t) {
|
|
12339
|
-
let n = ce();
|
|
12340
|
-
if (!n.length) {
|
|
12341
|
-
setTimeout(() => this.waitForClientAndBindLoad(e, t), this.clientWaitRetryDelay);
|
|
12342
|
-
return;
|
|
12343
|
-
}
|
|
12344
|
-
let r = n[0];
|
|
12345
|
-
r.on("load", () => {
|
|
12346
|
-
e === "client" && (this.duration = r.fields?.widgetDuration ?? 0), this.emit("load"), this.loaded = !0, t && t();
|
|
12347
|
-
});
|
|
12348
|
-
}
|
|
12349
|
-
enqueue(e, t = {}) {
|
|
12350
|
-
let n = this.hasItems(), r = Array.isArray(e) ? e.map((e) => ({
|
|
12351
|
-
value: e.value,
|
|
12352
|
-
options: e.options ?? {}
|
|
12353
|
-
})) : [{
|
|
12354
|
-
value: e,
|
|
12355
|
-
options: t
|
|
12356
|
-
}];
|
|
12357
|
-
for (let e of r) {
|
|
12358
|
-
let t = {
|
|
12359
|
-
isoDate: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12360
|
-
isLoop: e.options?.isLoop ?? !1,
|
|
12361
|
-
isPriority: e.options?.isPriority ?? !1,
|
|
12362
|
-
isImmediate: e.options?.isImmediate ?? !1,
|
|
12363
|
-
value: e.value
|
|
12364
|
-
};
|
|
12365
|
-
t.isPriority && t.isImmediate ? (this.cancel(), this.priorityQueue.unshift(t)) : (t.isPriority ? this.priorityQueue : this.queue).push(t);
|
|
12366
|
-
}
|
|
12367
|
-
return this.running === !1 && n === !1 && this.run(), this.emit("update", this.queue, this.priorityQueue, this.history, this.timeouts), this;
|
|
12368
|
-
}
|
|
12369
|
-
async run() {
|
|
12370
|
-
if (!this.hasItems()) {
|
|
12371
|
-
this.running = !1;
|
|
12372
|
-
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 }));
|
|
12373
12369
|
}
|
|
12374
|
-
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();
|
|
12375
12370
|
}
|
|
12376
|
-
|
|
12377
|
-
|
|
12378
|
-
|
|
12379
|
-
|
|
12380
|
-
|
|
12381
|
-
|
|
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: () => {
|
|
12382
12395
|
try {
|
|
12383
|
-
|
|
12396
|
+
q instanceof W && q?.resume();
|
|
12384
12397
|
} catch (e) {
|
|
12385
|
-
|
|
12398
|
+
return {
|
|
12399
|
+
ok: !1,
|
|
12400
|
+
error: e
|
|
12401
|
+
};
|
|
12386
12402
|
}
|
|
12387
|
-
|
|
12388
|
-
|
|
12389
|
-
|
|
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: []
|
|
12390
12442
|
}
|
|
12391
|
-
|
|
12392
|
-
|
|
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
|
+
});
|
|
12393
12461
|
}
|
|
12394
|
-
|
|
12395
|
-
|
|
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");
|
|
12396
12465
|
}
|
|
12397
|
-
|
|
12398
|
-
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");
|
|
12399
12474
|
}
|
|
12400
|
-
|
|
12401
|
-
|
|
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");
|
|
12402
12483
|
}
|
|
12403
12484
|
on(e, t) {
|
|
12404
|
-
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);
|
|
12405
12486
|
}
|
|
12406
|
-
},
|
|
12407
|
-
|
|
12408
|
-
|
|
12409
|
-
|
|
12410
|
-
|
|
12411
|
-
|
|
12412
|
-
|
|
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);
|
|
12413
12525
|
}
|
|
12414
|
-
}
|
|
12526
|
+
}, X = new class {
|
|
12415
12527
|
constructor() {
|
|
12416
12528
|
this.twitch = {
|
|
12417
12529
|
message(e = {}) {
|
|
12418
|
-
|
|
12419
|
-
e &&
|
|
12530
|
+
K.event.onEventReceived("twitch", "message", e).then((e) => {
|
|
12531
|
+
e && X.send("onEventReceived", e);
|
|
12420
12532
|
});
|
|
12421
12533
|
},
|
|
12422
12534
|
deleteMessage(e) {
|
|
@@ -12425,7 +12537,7 @@ var G = new class {
|
|
|
12425
12537
|
listener: "delete-message",
|
|
12426
12538
|
event: { msgId: e }
|
|
12427
12539
|
};
|
|
12428
|
-
|
|
12540
|
+
X.send("onEventReceived", t);
|
|
12429
12541
|
},
|
|
12430
12542
|
deleteMessages(e) {
|
|
12431
12543
|
if (!e || typeof e != "string") return;
|
|
@@ -12433,58 +12545,58 @@ var G = new class {
|
|
|
12433
12545
|
listener: "delete-messages",
|
|
12434
12546
|
event: { userId: e }
|
|
12435
12547
|
};
|
|
12436
|
-
|
|
12548
|
+
X.send("onEventReceived", t);
|
|
12437
12549
|
},
|
|
12438
12550
|
follower(e = {}) {
|
|
12439
|
-
|
|
12440
|
-
e &&
|
|
12551
|
+
K.event.onEventReceived("twitch", "follower-latest", e).then((e) => {
|
|
12552
|
+
e && X.send("onEventReceived", e);
|
|
12441
12553
|
});
|
|
12442
12554
|
},
|
|
12443
12555
|
raid(e = {}) {
|
|
12444
|
-
|
|
12445
|
-
e &&
|
|
12556
|
+
K.event.onEventReceived("twitch", "raid-latest", e).then((e) => {
|
|
12557
|
+
e && X.send("onEventReceived", e);
|
|
12446
12558
|
});
|
|
12447
12559
|
},
|
|
12448
12560
|
cheer(e = {}) {
|
|
12449
|
-
|
|
12450
|
-
e &&
|
|
12561
|
+
K.event.onEventReceived("twitch", "cheer-latest", e).then((e) => {
|
|
12562
|
+
e && X.send("onEventReceived", e);
|
|
12451
12563
|
});
|
|
12452
12564
|
},
|
|
12453
12565
|
subscriber(e = {}) {
|
|
12454
|
-
|
|
12455
|
-
e &&
|
|
12566
|
+
K.event.onEventReceived("twitch", "subscriber-latest", e).then((e) => {
|
|
12567
|
+
e && X.send("onEventReceived", e);
|
|
12456
12568
|
});
|
|
12457
12569
|
}
|
|
12458
12570
|
}, this.streamelements = { tip(e = {}) {
|
|
12459
|
-
|
|
12460
|
-
e &&
|
|
12571
|
+
K.event.onEventReceived("streamelements", "tip-latest", e).then((e) => {
|
|
12572
|
+
e && X.send("onEventReceived", e);
|
|
12461
12573
|
});
|
|
12462
12574
|
} }, this.youtube = {
|
|
12463
12575
|
message(e = {}) {
|
|
12464
|
-
|
|
12465
|
-
e &&
|
|
12576
|
+
K.event.onEventReceived("youtube", "message", e).then((e) => {
|
|
12577
|
+
e && X.send("onEventReceived", e);
|
|
12466
12578
|
});
|
|
12467
12579
|
},
|
|
12468
12580
|
subscriber(e = {}) {
|
|
12469
|
-
|
|
12470
|
-
e &&
|
|
12581
|
+
K.event.onEventReceived("youtube", "subscriber-latest", e).then((e) => {
|
|
12582
|
+
e && X.send("onEventReceived", e);
|
|
12471
12583
|
});
|
|
12472
12584
|
},
|
|
12473
12585
|
superchat(e = {}) {
|
|
12474
|
-
|
|
12475
|
-
e &&
|
|
12586
|
+
K.event.onEventReceived("youtube", "superchat-latest", e).then((e) => {
|
|
12587
|
+
e && X.send("onEventReceived", e);
|
|
12476
12588
|
});
|
|
12477
12589
|
},
|
|
12478
12590
|
sponsor(e = {}) {
|
|
12479
|
-
|
|
12480
|
-
e &&
|
|
12591
|
+
K.event.onEventReceived("youtube", "sponsor-latest", e).then((e) => {
|
|
12592
|
+
e && X.send("onEventReceived", e);
|
|
12481
12593
|
});
|
|
12482
12594
|
}
|
|
12483
12595
|
}, this.kick = {}, this.facebook = {};
|
|
12484
12596
|
}
|
|
12485
12597
|
send(e, t) {
|
|
12486
12598
|
if (!q) {
|
|
12487
|
-
|
|
12599
|
+
console.warn("Local queue is not initialized."), window.dispatchEvent(new CustomEvent(e, { detail: t }));
|
|
12488
12600
|
return;
|
|
12489
12601
|
}
|
|
12490
12602
|
switch (e) {
|
|
@@ -12509,9 +12621,9 @@ var G = new class {
|
|
|
12509
12621
|
break;
|
|
12510
12622
|
}
|
|
12511
12623
|
}
|
|
12512
|
-
}(),
|
|
12624
|
+
}(), Z;
|
|
12513
12625
|
(function(e) {
|
|
12514
|
-
e.queue = q, e.generate =
|
|
12626
|
+
e.queue = q, e.generate = K, e.emulate = X;
|
|
12515
12627
|
async function t(e = [
|
|
12516
12628
|
"fields.json",
|
|
12517
12629
|
"cf.json",
|
|
@@ -12540,19 +12652,19 @@ var G = new class {
|
|
|
12540
12652
|
})
|
|
12541
12653
|
}, i = await fetch("./" + (r.data ?? "data.json"), { cache: "no-store" }).then((e) => e.json()).catch(() => ({}));
|
|
12542
12654
|
await fetch("./" + (r.fields ?? "fields.json"), { cache: "no-store" }).then((e) => e.json()).then(async (e) => {
|
|
12543
|
-
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));
|
|
12544
12656
|
window.dispatchEvent(new CustomEvent("onWidgetLoad", { detail: r }));
|
|
12545
12657
|
});
|
|
12546
12658
|
}
|
|
12547
12659
|
e.start = t;
|
|
12548
|
-
})(
|
|
12660
|
+
})(Z ||= {});
|
|
12549
12661
|
//#endregion
|
|
12550
12662
|
//#region src/modules/fakeUser.ts
|
|
12551
|
-
var
|
|
12663
|
+
var ue = class {
|
|
12552
12664
|
constructor(e, t, n = [], r = !1, i) {
|
|
12553
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;
|
|
12554
12666
|
}
|
|
12555
|
-
},
|
|
12667
|
+
}, de = {
|
|
12556
12668
|
broadcaster: [
|
|
12557
12669
|
"moderator",
|
|
12558
12670
|
"vip",
|
|
@@ -12569,7 +12681,7 @@ var le = class {
|
|
|
12569
12681
|
"duelyst_6",
|
|
12570
12682
|
"duelyst_7"
|
|
12571
12683
|
]
|
|
12572
|
-
},
|
|
12684
|
+
}, fe = class e extends H {
|
|
12573
12685
|
static fixUser(t) {
|
|
12574
12686
|
return typeof t == "string" ? t.trim().replace(/^@+/, "").toLocaleLowerCase() : e.fixUser(t.name);
|
|
12575
12687
|
}
|
|
@@ -12634,7 +12746,7 @@ var le = class {
|
|
|
12634
12746
|
}
|
|
12635
12747
|
return null;
|
|
12636
12748
|
};
|
|
12637
|
-
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);
|
|
12638
12750
|
for (let e of a) {
|
|
12639
12751
|
let t = b(u[e]);
|
|
12640
12752
|
for (let n of t) {
|
|
@@ -12680,7 +12792,7 @@ var le = class {
|
|
|
12680
12792
|
continue;
|
|
12681
12793
|
}
|
|
12682
12794
|
n.length < c && this.emit("warn", /* @__PURE__ */ Error(`User "${t}" could only receive ${n.length} badge(s), below the configured minimum of ${c}`));
|
|
12683
|
-
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);
|
|
12684
12796
|
o.push(s);
|
|
12685
12797
|
}
|
|
12686
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;
|
|
@@ -12735,9 +12847,9 @@ var le = class {
|
|
|
12735
12847
|
message: new C().array(e)[0]
|
|
12736
12848
|
};
|
|
12737
12849
|
}
|
|
12738
|
-
},
|
|
12850
|
+
}, pe = class extends H {
|
|
12739
12851
|
constructor(e = {}) {
|
|
12740
|
-
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) => {
|
|
12741
12853
|
this.loaded = !0, this.SE_API = e, Promise.all([async () => {
|
|
12742
12854
|
let t = await e.store.get(this.id);
|
|
12743
12855
|
t && (this.history = t.slice(-10));
|
|
@@ -12766,7 +12878,7 @@ var le = class {
|
|
|
12766
12878
|
on(e, t) {
|
|
12767
12879
|
return e === "load" && this.loaded ? (t.apply(this), this) : (super.on(e, t), this);
|
|
12768
12880
|
}
|
|
12769
|
-
},
|
|
12881
|
+
}, me = class {
|
|
12770
12882
|
constructor(e = {}) {
|
|
12771
12883
|
this.error = this.apply({
|
|
12772
12884
|
color: "#721c24",
|
|
@@ -12864,7 +12976,7 @@ var le = class {
|
|
|
12864
12976
|
timeEnd(e) {
|
|
12865
12977
|
!this.enabled || !console.timeEnd || console.timeEnd(e);
|
|
12866
12978
|
}
|
|
12867
|
-
},
|
|
12979
|
+
}, he = class extends H {
|
|
12868
12980
|
constructor(e, t) {
|
|
12869
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) => {
|
|
12870
12982
|
this.instance = e, this.emit("load", e), this.connect();
|
|
@@ -12901,7 +13013,7 @@ var le = class {
|
|
|
12901
13013
|
msgId: i.id,
|
|
12902
13014
|
channel: i.channel
|
|
12903
13015
|
};
|
|
12904
|
-
|
|
13016
|
+
Z.emulate.twitch.message(o);
|
|
12905
13017
|
}
|
|
12906
13018
|
}, this.instance.onChat = (e, t, n, r, i) => {
|
|
12907
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) {
|
|
@@ -12914,7 +13026,7 @@ var le = class {
|
|
|
12914
13026
|
subscriber: n.subscriber,
|
|
12915
13027
|
founder: n.founder
|
|
12916
13028
|
};
|
|
12917
|
-
|
|
13029
|
+
Z.emulate.twitch.message({
|
|
12918
13030
|
name: e,
|
|
12919
13031
|
message: t,
|
|
12920
13032
|
badges: Object.entries(r).map(([e, t]) => t ? e : null).filter(Boolean),
|
|
@@ -12928,7 +13040,7 @@ var le = class {
|
|
|
12928
13040
|
}, this.instance.onWhisper = (e, t, n, r, i) => {
|
|
12929
13041
|
this.emit("whisper", e, t, n, r, i), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Whisper: ${t} (User: ${e})`);
|
|
12930
13042
|
}, this.instance.onMessageDeleted = (e, t) => {
|
|
12931
|
-
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);
|
|
12932
13044
|
}, this.instance.onJoin = (e, t, n) => {
|
|
12933
13045
|
this.emit("join", e, t, n), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Join: ${e}`);
|
|
12934
13046
|
}, this.instance.onPart = (e, t, n) => {
|
|
@@ -12936,14 +13048,14 @@ var le = class {
|
|
|
12936
13048
|
}, this.instance.onHosted = (e, t, n, r) => {
|
|
12937
13049
|
this.emit("hosted", e, t, n, r), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Hosted: ${e} (${t} viewers)`);
|
|
12938
13050
|
}, this.instance.onRaid = (e, t, n) => {
|
|
12939
|
-
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({
|
|
12940
13052
|
name: e,
|
|
12941
13053
|
amount: t
|
|
12942
13054
|
});
|
|
12943
13055
|
}, this.instance.onSub = (e, t, n, r) => {
|
|
12944
13056
|
if (this.emit("sub", e, t, n, r), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Sub: ${e} (${n.plan})`), this.emulate) {
|
|
12945
13057
|
let r = n.plan === "Prime" ? "prime" : n.plan;
|
|
12946
|
-
|
|
13058
|
+
Z.emulate.twitch.subscriber({
|
|
12947
13059
|
name: e,
|
|
12948
13060
|
message: t,
|
|
12949
13061
|
tier: r,
|
|
@@ -12953,7 +13065,7 @@ var le = class {
|
|
|
12953
13065
|
}, this.instance.onResub = (e, t, n, r, i, a) => {
|
|
12954
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) {
|
|
12955
13067
|
let n = i.plan === "Prime" ? "prime" : i.plan;
|
|
12956
|
-
|
|
13068
|
+
Z.emulate.twitch.subscriber({
|
|
12957
13069
|
name: e,
|
|
12958
13070
|
message: t,
|
|
12959
13071
|
tier: n,
|
|
@@ -12964,7 +13076,7 @@ var le = class {
|
|
|
12964
13076
|
}, this.instance.onSubGift = (e, t, n, r, i, a) => {
|
|
12965
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) {
|
|
12966
13078
|
let t = i.plan === "Prime" ? "prime" : i.plan;
|
|
12967
|
-
|
|
13079
|
+
Z.emulate.twitch.subscriber({
|
|
12968
13080
|
name: n,
|
|
12969
13081
|
message: "",
|
|
12970
13082
|
sender: e,
|
|
@@ -12976,7 +13088,7 @@ var le = class {
|
|
|
12976
13088
|
}, this.instance.onSubMysteryGift = (e, t, n, r, i) => {
|
|
12977
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) {
|
|
12978
13090
|
let n = r.plan === "Prime" ? "prime" : r.plan;
|
|
12979
|
-
|
|
13091
|
+
Z.emulate.twitch.subscriber({
|
|
12980
13092
|
name: e,
|
|
12981
13093
|
message: "",
|
|
12982
13094
|
amount: t,
|
|
@@ -12985,7 +13097,7 @@ var le = class {
|
|
|
12985
13097
|
});
|
|
12986
13098
|
}
|
|
12987
13099
|
}, this.instance.onGiftSubContinue = (e, t, n) => {
|
|
12988
|
-
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({
|
|
12989
13101
|
name: e,
|
|
12990
13102
|
message: "",
|
|
12991
13103
|
sender: t,
|
|
@@ -12993,7 +13105,7 @@ var le = class {
|
|
|
12993
13105
|
subType: "gift"
|
|
12994
13106
|
});
|
|
12995
13107
|
}, this.instance.onCheer = (e, t, n, r, i) => {
|
|
12996
|
-
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({
|
|
12997
13109
|
name: e,
|
|
12998
13110
|
message: t,
|
|
12999
13111
|
amount: n
|
|
@@ -13008,88 +13120,7 @@ var le = class {
|
|
|
13008
13120
|
this.emit("reconnect", e), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Reconnect: Attempt #${e}`);
|
|
13009
13121
|
}, this.init && this.instance.Init(this.username, this.password, this.channels, this.isDebug);
|
|
13010
13122
|
}
|
|
13011
|
-
},
|
|
13012
|
-
responses: {},
|
|
13013
|
-
sendMessage(e, t = {}) {
|
|
13014
|
-
return new Promise((n, r) => {
|
|
13015
|
-
let i = "resp_" + Math.random().toString(36).substring(2, 15);
|
|
13016
|
-
t.response = i, t.request = e, SE_API.responses[i] = {
|
|
13017
|
-
resolve: n,
|
|
13018
|
-
reject: r
|
|
13019
|
-
}, parent?.postMessage(t, "*");
|
|
13020
|
-
});
|
|
13021
|
-
},
|
|
13022
|
-
counters: { get(e) {
|
|
13023
|
-
return null;
|
|
13024
|
-
} },
|
|
13025
|
-
store: {
|
|
13026
|
-
set: function(e, t) {
|
|
13027
|
-
this.list[e] = t, localStorage.setItem("SE_API-STORE", JSON.stringify(X.store.list));
|
|
13028
|
-
},
|
|
13029
|
-
get: async function(e) {
|
|
13030
|
-
return this.list[e] ? this.list[e] : null;
|
|
13031
|
-
},
|
|
13032
|
-
list: {}
|
|
13033
|
-
},
|
|
13034
|
-
resumeQueue: () => {
|
|
13035
|
-
try {
|
|
13036
|
-
q instanceof K && q?.resume();
|
|
13037
|
-
} catch (e) {
|
|
13038
|
-
return {
|
|
13039
|
-
ok: !1,
|
|
13040
|
-
error: e
|
|
13041
|
-
};
|
|
13042
|
-
}
|
|
13043
|
-
return { ok: !0 };
|
|
13044
|
-
},
|
|
13045
|
-
sanitize(e) {
|
|
13046
|
-
return e;
|
|
13047
|
-
},
|
|
13048
|
-
cheerFilter(e) {
|
|
13049
|
-
return e;
|
|
13050
|
-
},
|
|
13051
|
-
setField(e, t, n) {},
|
|
13052
|
-
getOverlayStatus: () => ({
|
|
13053
|
-
isEditorMode: !1,
|
|
13054
|
-
muted: !1
|
|
13055
|
-
}),
|
|
13056
|
-
events: {
|
|
13057
|
-
emit(e, t) {
|
|
13058
|
-
let n = {
|
|
13059
|
-
listener: e,
|
|
13060
|
-
event: t,
|
|
13061
|
-
result: void 0
|
|
13062
|
-
}, r = new CustomEvent("onEventReceived", { detail: n });
|
|
13063
|
-
return this.history.push({
|
|
13064
|
-
detail: n,
|
|
13065
|
-
timestamp: r.timeStamp,
|
|
13066
|
-
origin: P?.[0]?.id
|
|
13067
|
-
}), localStorage.setItem("SE_API-EVENTS", JSON.stringify(this.history)), window.dispatchEvent(r) ? { ok: !0 } : { ok: !1 };
|
|
13068
|
-
},
|
|
13069
|
-
broadcast(e, t) {
|
|
13070
|
-
let n = {
|
|
13071
|
-
listener: e,
|
|
13072
|
-
event: t,
|
|
13073
|
-
result: void 0
|
|
13074
|
-
}, r = new CustomEvent("onEventReceived", { detail: n });
|
|
13075
|
-
return this.history.push({
|
|
13076
|
-
detail: n,
|
|
13077
|
-
timestamp: Date.now(),
|
|
13078
|
-
origin: P?.[0]?.id
|
|
13079
|
-
}), localStorage.setItem("SE_API-EVENTS", JSON.stringify(this.history)), window.dispatchEvent(r) ? { ok: !0 } : { ok: !1 };
|
|
13080
|
-
},
|
|
13081
|
-
history: []
|
|
13082
|
-
}
|
|
13083
|
-
};
|
|
13084
|
-
async function he() {
|
|
13085
|
-
let e = localStorage.getItem("SE_API-STORE") ?? "{}", t = e ? JSON.parse(e) : {};
|
|
13086
|
-
X.store.list = t;
|
|
13087
|
-
let n = localStorage.getItem("SE_API-EVENTS") ?? "[]", r = n ? JSON.parse(n) : [];
|
|
13088
|
-
return X.events.history = r, X;
|
|
13089
|
-
}
|
|
13090
|
-
//#endregion
|
|
13091
|
-
//#region src/utils/alejo.ts
|
|
13092
|
-
var ge;
|
|
13123
|
+
}, ge;
|
|
13093
13124
|
(function(e) {
|
|
13094
13125
|
let t;
|
|
13095
13126
|
(function(e) {
|
|
@@ -13139,26 +13170,26 @@ var ge;
|
|
|
13139
13170
|
})(ge ||= {});
|
|
13140
13171
|
//#endregion
|
|
13141
13172
|
//#region src/main.ts
|
|
13142
|
-
var
|
|
13143
|
-
SeAPI:
|
|
13144
|
-
Client:
|
|
13173
|
+
var Q = new me(), $ = {
|
|
13174
|
+
SeAPI: Y,
|
|
13175
|
+
Client: le,
|
|
13145
13176
|
Helper: B,
|
|
13146
|
-
Local:
|
|
13177
|
+
Local: Z,
|
|
13147
13178
|
Data: S,
|
|
13148
13179
|
logger: Q,
|
|
13149
13180
|
modules: {
|
|
13150
13181
|
EventProvider: H,
|
|
13151
|
-
useStorage:
|
|
13152
|
-
useQueue:
|
|
13153
|
-
useLogger:
|
|
13154
|
-
useComms:
|
|
13155
|
-
FakeUserPool:
|
|
13182
|
+
useStorage: ce,
|
|
13183
|
+
useQueue: W,
|
|
13184
|
+
useLogger: me,
|
|
13185
|
+
useComms: pe,
|
|
13186
|
+
FakeUserPool: fe
|
|
13156
13187
|
},
|
|
13157
13188
|
actions: {
|
|
13158
13189
|
Button: ie,
|
|
13159
13190
|
Command: V
|
|
13160
13191
|
},
|
|
13161
|
-
multistream: { useComfyJs:
|
|
13192
|
+
multistream: { useComfyJs: he },
|
|
13162
13193
|
internal: te,
|
|
13163
13194
|
pronouns: { Alejo: ge }
|
|
13164
13195
|
};
|