@tixyel/streamelements 7.5.2 → 7.6.1

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.es.js CHANGED
@@ -1,104 +1,12 @@
1
- //#region src/modules/EventProvider.ts
2
- var e = class {
3
- constructor() {
4
- this.registeredEvents = {};
5
- }
6
- emit(e, ...t) {
7
- return (this.registeredEvents[e] || []).map((e) => e.apply(this, t));
8
- }
9
- on(e, t) {
10
- if (typeof t != "function") throw TypeError("Callback must be a function");
11
- return this.registeredEvents[e] || (this.registeredEvents[e] = []), this.registeredEvents[e].push(t), this;
12
- }
13
- off(e, t) {
14
- let n = this.registeredEvents[e] || [];
15
- return t ? (this.registeredEvents[e] = n.filter((e) => e !== t), this) : (this.registeredEvents[e] = [], this);
16
- }
17
- once(e, t) {
18
- let n = (...r) => {
19
- this.off(e, n), t.apply(this, r);
20
- };
21
- return this.on(e, n), this;
22
- }
23
- removeAllListeners(e) {
24
- return this.registeredEvents[e] = [], this;
25
- }
26
- }, t = [], n = class n extends e {
27
- constructor(e) {
28
- super(), this.SE_API = null, this.id = "default", this.loaded = !1, this.id = e.id || this.id, this.data = e.data ?? {}, t.push(this), Z?.then((e) => {
29
- this.SE_API = e, e.store.get(this.id).then((e) => {
30
- 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);
31
- }).catch(() => {
32
- this.loaded = !0, this.emit("load", this.data);
33
- });
34
- });
35
- }
36
- save(e = this.data) {
37
- this.loaded && this.SE_API && JSON.stringify(this.data) !== JSON.stringify(e) && (this.data = e, this.SE_API.store.set(this.id, this.data), this.emit("update", this.data));
38
- }
39
- update(e = this.data) {
40
- if (this.loaded && JSON.stringify(this.data) !== JSON.stringify(e)) {
41
- let t = {
42
- ...this.data,
43
- ...e
44
- };
45
- this.save(t);
46
- }
47
- }
48
- add(e, t) {
49
- this.loaded && (n.setByPath(this.data, e, t), this.save(this.data));
50
- }
51
- clear() {
52
- this.loaded && (this.data = {}, this.save(this.data));
53
- }
54
- static setByPath(e, t, n) {
55
- let r = t.split("."), i = e;
56
- 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]];
57
- return i[r[r.length - 1]] = n, i;
58
- }
59
- on(e, t) {
60
- return e === "load" && this.loaded ? (t.apply(this, [this.data]), this) : (super.on(e, t), this);
61
- }
62
- }, r = class extends e {
63
- constructor(e) {
64
- super(), this.id = "default", this.debug = !1, this.fields = {}, this.loaded = !1, this.actions = {
65
- commands: [],
66
- buttons: []
67
- }, this.cache = {
68
- avatar: 30,
69
- pronoun: 60,
70
- emote: 120
71
- }, this.id = e.id || this.id, this.storage = new n({
72
- id: this.id,
73
- data: {
74
- user: {},
75
- avatar: {},
76
- pronoun: {},
77
- emote: {}
78
- }
79
- }), this.on("load", () => {
80
- this.debug = !!(typeof e.debug == "function" ? e.debug() : e.debug);
81
- }), window.client = this;
82
- }
83
- on(e, t) {
84
- return e === "load" && this.loaded ? (t.apply(this, [{
85
- channel: this.details.user,
86
- currency: this.details.currency,
87
- fieldData: this.fields,
88
- recents: [],
89
- session: {
90
- data: this.session,
91
- settings: {
92
- autoReset: !1,
93
- calendar: !1,
94
- resetOnStart: !1
95
- }
96
- },
97
- overlay: this.details.overlay,
98
- emulated: !1
99
- }]), this) : (super.on(e, t), this);
100
- }
101
- }, i = class {
1
+ //#region \0rolldown/runtime.js
2
+ var e = Object.defineProperty, t = (t, n) => {
3
+ let r = {};
4
+ for (var i in t) e(r, i, {
5
+ get: t[i],
6
+ enumerable: !0
7
+ });
8
+ return n || e(r, Symbol.toStringTag, { value: "Module" }), r;
9
+ }, n = class {
102
10
  translate(e, t = "cardinal") {
103
11
  let n = {
104
12
  single: [
@@ -247,7 +155,7 @@ var e = class {
247
155
  let r = Math.random() * (t - e) + e;
248
156
  return n ? Number(r.toFixed(n)) : Math.round(r);
249
157
  }
250
- }, a = class {
158
+ }, r = class {
251
159
  mergeSpanStyles(e, t, n) {
252
160
  let r = t.match(/^<span(?: class="[^"]*")? style="([^"]*)">(.*)<\/span>$/s);
253
161
  if (r) {
@@ -280,13 +188,13 @@ var e = class {
280
188
  let v = d * _, y = f * _;
281
189
  return r === "width" ? _ = Math.max(p, Math.min(h, l / d)) : r === "height" ? _ = Math.max(m, Math.min(g, u / f)) : v > l ? _ = Math.max(p, Math.min(h, l / d)) : y > u && (_ = Math.max(m, Math.min(g, u / f))), o.apply(e, [_, e]), _;
282
190
  }
283
- fitText(e, t = 1, n = {}) {
284
- let r = parseFloat(getComputedStyle(e).getPropertyValue("font-size")), a = {
285
- minFontSize: n?.minFontSize ?? 0,
286
- maxFontSize: n?.maxFontSize ?? r
287
- }, o = n?.parent || e.parentElement;
191
+ fitText(e, t = 1, r = {}) {
192
+ let i = parseFloat(getComputedStyle(e).getPropertyValue("font-size")), a = {
193
+ minFontSize: r?.minFontSize ?? 0,
194
+ maxFontSize: r?.maxFontSize ?? i
195
+ }, o = r?.parent || e.parentElement;
288
196
  if (!o) throw Error("No parent element found for fitting text");
289
- let s = r * (o.clientWidth * t / e.offsetWidth), c = new i().balance(s, a.minFontSize, a.maxFontSize);
197
+ let s = i * (o.clientWidth * t / e.offsetWidth), c = new n().balance(s, a.minFontSize, a.maxFontSize);
290
198
  return e.style.fontSize = c + "px", e;
291
199
  }
292
200
  splitTextToChars(e, t = 0, n = !1, r = {}) {
@@ -319,7 +227,7 @@ var e = class {
319
227
  e.nodeType === Node.TEXT_NODE ? l += e.textContent : l += e.outerHTML;
320
228
  }), l;
321
229
  }
322
- }, o = class {
230
+ }, i = class {
323
231
  flatten(e, t = !0, n = "") {
324
232
  let r = {};
325
233
  for (let i in e) {
@@ -371,7 +279,7 @@ var e = class {
371
279
  keys(e) {
372
280
  return Object.keys(e);
373
281
  }
374
- }, s = [
282
+ }, a = [
375
283
  "https://static-cdn.jtvnw.net/user-default-pictures-uv/13e5fa74-defa-11e9-809c-784f43822e80-profile_image-300x300.png",
376
284
  "https://static-cdn.jtvnw.net/user-default-pictures-uv/dbdc9198-def8-11e9-8681-784f43822e80-profile_image-300x300.png",
377
285
  "https://static-cdn.jtvnw.net/user-default-pictures-uv/998f01ae-def8-11e9-b95c-784f43822e80-profile_image-300x300.png",
@@ -379,7 +287,7 @@ var e = class {
379
287
  "https://static-cdn.jtvnw.net/user-default-pictures-uv/ebe4cd89-b4f4-4cd9-adac-2f30151b4209-profile_image-300x300.png",
380
288
  "https://static-cdn.jtvnw.net/user-default-pictures-uv/215b7342-def9-11e9-9a66-784f43822e80-profile_image-300x300.png",
381
289
  "https://static-cdn.jtvnw.net/user-default-pictures-uv/ead5c8b2-a4c9-4724-b1dd-9f00b46cbd3d-profile_image-300x300.png"
382
- ], c = [
290
+ ], o = [
383
291
  {
384
292
  set_id: "qsmp2",
385
293
  versions: [{
@@ -4645,7 +4553,7 @@ var e = class {
4645
4553
  click_url: null
4646
4554
  }]
4647
4555
  }
4648
- ], l = /* @__PURE__ */ "aliceblue.antiquewhite.aqua.aquamarine.azure.beige.bisque.black.blanchedalmond.blue.blueviolet.brown.burlywood.cadetblue.chartreuse.chocolate.coral.cornflowerblue.cornsilk.crimson.cyan.darkblue.darkcyan.darkgoldenrod.darkgray.darkgreen.darkgrey.darkkhaki.darkmagenta.darkolivegreen.darkorange.darkorchid.darkred.darksalmon.darkseagreen.darkslateblue.darkslategray.darkslategrey.darkturquoise.darkviolet.deeppink.deepskyblue.dimgray.dimgrey.dodgerblue.firebrick.floralwhite.forestgreen.fuchsia.gainsboro.ghostwhite.gold.goldenrod.gray.green.greenyellow.grey.honeydew.hotpink.indianred.indigo.ivory.khaki.lavender.lavenderblush.lawngreen.lemonchiffon.lightblue.lightcoral.lightcyan.lightgoldenrodyellow.lightgray.lightgreen.lightgrey.lightpink.lightsalmon.lightseagreen.lightskyblue.lightslategray.lightslategrey.lightsteelblue.lightyellow.lime.limegreen.linen.magenta.maroon.mediumaquamarine.mediumblue.mediumorchid.mediumpurple.mediumseagreen.mediumslateblue.mediumspringgreen.mediumturquoise.mediumvioletred.midnightblue.mintcream.mistyrose.moccasin.navajowhite.navy.oldlace.olive.olivedrab.orange.orangered.orchid.palegoldenrod.palegreen.paleturquoise.palevioletred.papayawhip.peachpuff.peru.pink.plum.powderblue.purple.rebeccapurple.red.rosybrown.royalblue.saddlebrown.salmon.sandybrown.seagreen.seashell.sienna.silver.skyblue.slateblue.slategray.slategrey.snow.springgreen.steelblue.tan.teal.thistle.tomato.turquoise.violet.wheat.white.whitesmoke.yellow.yellowgreen.transparent".split("."), u = [
4556
+ ], s = /* @__PURE__ */ "aliceblue.antiquewhite.aqua.aquamarine.azure.beige.bisque.black.blanchedalmond.blue.blueviolet.brown.burlywood.cadetblue.chartreuse.chocolate.coral.cornflowerblue.cornsilk.crimson.cyan.darkblue.darkcyan.darkgoldenrod.darkgray.darkgreen.darkgrey.darkkhaki.darkmagenta.darkolivegreen.darkorange.darkorchid.darkred.darksalmon.darkseagreen.darkslateblue.darkslategray.darkslategrey.darkturquoise.darkviolet.deeppink.deepskyblue.dimgray.dimgrey.dodgerblue.firebrick.floralwhite.forestgreen.fuchsia.gainsboro.ghostwhite.gold.goldenrod.gray.green.greenyellow.grey.honeydew.hotpink.indianred.indigo.ivory.khaki.lavender.lavenderblush.lawngreen.lemonchiffon.lightblue.lightcoral.lightcyan.lightgoldenrodyellow.lightgray.lightgreen.lightgrey.lightpink.lightsalmon.lightseagreen.lightskyblue.lightslategray.lightslategrey.lightsteelblue.lightyellow.lime.limegreen.linen.magenta.maroon.mediumaquamarine.mediumblue.mediumorchid.mediumpurple.mediumseagreen.mediumslateblue.mediumspringgreen.mediumturquoise.mediumvioletred.midnightblue.mintcream.mistyrose.moccasin.navajowhite.navy.oldlace.olive.olivedrab.orange.orangered.orchid.palegoldenrod.palegreen.paleturquoise.palevioletred.papayawhip.peachpuff.peru.pink.plum.powderblue.purple.rebeccapurple.red.rosybrown.royalblue.saddlebrown.salmon.sandybrown.seagreen.seashell.sienna.silver.skyblue.slateblue.slategray.slategrey.snow.springgreen.steelblue.tan.teal.thistle.tomato.turquoise.violet.wheat.white.whitesmoke.yellow.yellowgreen.transparent".split("."), c = [
4649
4557
  {
4650
4558
  id: "01FCY771D800007PQ2DF3GDTN6",
4651
4559
  name: "RainTime",
@@ -5174,7 +5082,7 @@ var e = class {
5174
5082
  4: "https://cdn.7tv.app/emote/01GBFDVP18000CRDCG0DV7KEMY/4x.webp"
5175
5083
  }
5176
5084
  }
5177
- ], d = [
5085
+ ], l = [
5178
5086
  {
5179
5087
  id: "54fa8f1401e468494b85b537",
5180
5088
  name: ":tf:",
@@ -5890,7 +5798,7 @@ var e = class {
5890
5798
  4: "https://cdn.betterttv.net/emote/662953eeea369c0ece39eb93/3x"
5891
5799
  }
5892
5800
  }
5893
- ], f = [
5801
+ ], u = [
5894
5802
  {
5895
5803
  id: "9",
5896
5804
  name: "ZrehplaR",
@@ -6056,7 +5964,7 @@ var e = class {
6056
5964
  4: "https://cdn.frankerfacez.com/emote/720729/4"
6057
5965
  }
6058
5966
  }
6059
- ], p = [
5967
+ ], d = [
6060
5968
  {
6061
5969
  type: "twitch",
6062
5970
  name: "AsexualPride",
@@ -6835,9 +6743,9 @@ var e = class {
6835
6743
  start: 214,
6836
6744
  end: 221
6837
6745
  }
6838
- ], m = Object.values([
6839
- ...p,
6840
- ...d.map((e) => ({
6746
+ ], f = Object.values([
6747
+ ...d,
6748
+ ...l.map((e) => ({
6841
6749
  type: e.platform,
6842
6750
  name: e.name,
6843
6751
  id: e.id,
@@ -6845,7 +6753,7 @@ var e = class {
6845
6753
  animated: e.animated,
6846
6754
  urls: e.urls
6847
6755
  })),
6848
- ...u.map((e) => ({
6756
+ ...c.map((e) => ({
6849
6757
  type: e.platform,
6850
6758
  name: e.name,
6851
6759
  id: e.id,
@@ -6853,7 +6761,7 @@ var e = class {
6853
6761
  animated: e.animated,
6854
6762
  urls: e.urls
6855
6763
  })),
6856
- ...f.map((e) => ({
6764
+ ...u.map((e) => ({
6857
6765
  type: e.platform,
6858
6766
  name: e.name,
6859
6767
  id: e.id,
@@ -6865,11 +6773,11 @@ var e = class {
6865
6773
  ...t,
6866
6774
  start: 0,
6867
6775
  end: 0
6868
- }), e), []), h = [], g = /* @__PURE__ */ "haHAA,CiGrip,PopNemo,PogChamp,bttvNice,ariW wave,DinoDance,CruW salute,c! PogChamp,LUL LUL LUL,CandianRage,CatBag kitty!,<3 good times,catJAM vibing,DuckerZ quack,:tf: trollface,haHAA good one,HSWP let's go!,DxCat claws out,ConcernDoge hmm,BroBalt nice one,VoHiYo everyone!,LuL that was funny,Kappa just kidding,FBCatch nice grab!,cvHazmat stay safe,CookieTime nom nom,LuL that was funny,CruW crew assembled,GlitchCat GlitchCat,CoolCat staying calm,bUrself be yourself!,catJAM catJAM catJAM,HSWP here we go again,Shush moment incoming,duDudu rhythm section,:tf: face palm moment,duDudu rhythm section,HSWP here we go again,PunchTrees PunchTrees,SSSsss Minecraft time,KappaPride represent!,haHAA that joke though,DoritosChip snack time,DoritosChip snack time,asexualPride represent,duDudu dancing on beat,FBBlock defensive play!,ariW waving at everyone,PopNemo finding our way,ariW waving at everyone,TheIlluminati confirmed,SSSsss slithering vibes,GayPride celebrate love,BloodTrail hunting time,TheIlluminati confirmed,LUL can't stop laughing,HypeCheer clap clap clap,DuckerZ quacking in chat,Wait for it... PogChamp!,HypeCheer clap clap clap,KPOPTT music to our ears,FrogPonder thinking frog,IntersexPride we're here,KappaPride be proud Kappa,cvHazmat suit up for this,BrainSlug giving me ideas,KappaPride be proud Kappa,This music is fire catJAM,I just followed! PogChamp,MrDestructoid robot vibes,BroBalt brotherhood moment,VoHiYo greetings from chat,PogChamp PogChamp PogChamp,DxCat meow meow KomodoHype,Squid1 Squid2 Squid3 Squid4,KomodoHype the hype is real,DarkMode gang where you at?,Wait what just happened? D:,TakeNRG infinite energy NRG,CookieTime break time snack,The dedication is real here,PopCorn watching this unfold,CandianRage maple syrup fury,PopCorn watching this unfold,LesbianPride strong together,DinoDance DinoDance DinoDance,TakeNRG this energy is unreal,Everyone gets hype! HypeCheer,CiGrip strong grip on the game,CoolCat no stress allowed here,BisexualPride all love matters,GenderFluidPride freedom to be,DarkMode gang in here DarkMode,HypeFail oops that didn't work,HypePopcorn this is the moment,ConcernDoge is everything okay?,BloodTrail following the leader,This is so wholesome AngelThump,ImGlitch technical difficulties,Anyone else eating? DoritosChip,PixelBob retro vibes with Kappa,SoonerLater catch you next time,imGlitch glitchy but we love it,KomodoHype the energy is crazy!,NonbinaryPride beyond the binary,PansexualPride love is universal,This community is the best Kappa,BrainSlug with the big brain play,TransgenderPride living authentic,AngelThump wholesomeness incoming,GlitchCat imGlitch what happened?,CrreamAwk that was awkward VoHiYo,IronmouseLuv appreciate the stream,PunchTrees minecraft mode activated,The skill on display here is unreal,LesbianPride GayPride BisexualPride,PogChamp PogChamp PogChamp PogChamp,TwitchUnity we're all here for this,This is absolutely insane KomodoHype,Never seen anything like this before,Vibing with cat-shaped avatars catJAM,EarthDay appreciation for this stream,TheIlluminati knows something we don't,Shush they're about to do something big,Can we appreciate this moment? PogChamp,MrDestructoid destroying the competition,AsexualPride IntersexPride GenderFluidPride,TransgenderPride PansexualPride NonbinaryPride".split(","), _ = /* @__PURE__ */ ":ytg: Keep it up!.:yt: YouTube hype!.:gar: Amazing as always!.No words, just :awesome:.You got this! :yougotthis:.:elbowbump: Great teamwork!.Love this energy! :goodvibes:.Just arrived! :hand-pink-waving:.Great gameplay! :hand-yellow-nails:.:face-pink-tears: Tears of joy here.This stream is incredible :awesome:.Hydration break everyone! :hydrate:.:text-green-game-over: You won this!.:face-blue-star-eyes: You're a star!.Virtual hug for everyone :virtualhug:.Happy to be here! :face-green-smiling:.Chilling with my dog :chillwdog: vibing.:face-red-heart-shape: Love what you do.:person-turqouise-waving: Hey everyone!.This community is the best! :goodvibes:.:face-blue-smiling: Amazing vibes today.:goodvibes: Only good vibes in this chat.:body-blue-raised-arms: Victory is ours!.:pride-flower-rainbow-heart: Love is love.:octopus-red-waving: Waves from the chat!.:thanksdoc: Thanks for the entertainment!.:face-purple-crying: Why is this so good??.:eyes-pink-heart-shape: Beautiful gameplay.:fish-orange-wide-eyes: Eyes on the prize!.:whistle-red-blow: That was a performance!.Respect the grind :hand-green-crystal-ball:.Learning so much from this stream :learning:.:pride-people-embracing-two: Community love!.:face-red-droopy-eyes: long day but worth it.Chilling with my cat :chillwcat: so peaceful.:face-fuchsia-tongue-out: Having too much fun.:person-purple-stage-event: This is showtime!.:card-red-penalty: That was risky! Bold move!.:face-purple-smiling-tears: This is too good!.:face-orange-tv-shape: Broadcasting excellence.:face-orange-tv-shape: Broadcasting excellence.:face-blue-heart-eyes: This stream has my heart.:person-turquoise-crowd-surf: Crowd going wild!.Best gaming session ever :trophy-yellow-smiling:.:hand-purple-blue-peace: Peace out, great stream!.:face-purple-sweating: Clutch moment! So intense!.:hand-orange-covering-eyes: Can't believe my eyes!.:face-blue-question-mark: How do you even do that?.:baseball-white-cap-out: Home run! Total knockout!.:volcano-green-lava-orange: Things are getting HOT.:face-purple-smiling-fangs: Evil laugh at that play.:stopwatch-blue-hand-timer: Speedrunning like a pro.:location-yellow-teal-bars: Streaming from the top!.:face-purple-open-box: What's next? More surprises?.:person-turquoise-wizard-wand: Like magic out there!.:face-blue-wide-eyes: Did that actually just happen?!.:medal-yellow-first-red: Number one stream right here.:face-turquoise-music-note: Vibing to this soundtrack.Can we just appreciate how awesome this is? :awesome:.:popcorn-yellow-striped-smile: This is the main event!.:face-orange-raised-eyebrow: Interesting strategy there.:person-blue-speaking-microphone: Let's go! Hype it up!.:pride-megaphone-rainbow-handle: Amplifying good vibes!.:rocket-red-countdown-liftoff: Let's go! Time to launch!.:person-blue-holding-pencil: Taking notes on these skills.:face-fuchsia-poop-shape: That was a mess! But we survived.:person-pink-swaying-hair: The style, the skill, everything!.:body-turquoise-yoga-pose: So smooth and calm under pressure.:penguin-blue-waving-tear: Goodbye for now, fantastic stream!.:face-turquoise-covering-eyes: Wait what? How did you do that?.:face-turquoise-covering-eyes: Wait what? How did you do that?.:clock-turquoise-looking-up: What time is it? Time to watch you!.:person-blue-eating-spaghetti: Fueling up after that performance.:hourglass-purple-sand-orange: Time flies when you're having fun.:face-turquoise-drinking-coffee: Coffee and gaming, perfect combo.:person-turquoise-writes-headphones: That's some creative strategy.:face-purple-rain-drops: Emotional over here :face-pink-drinking-tea:.:pride-person-heart-lesbian: Proud and here :pride-flowers-turquoise-transgender:".split("."), v = /* @__PURE__ */ "GG!.Wow just wow.Fire fire fire.Simply amazing.Never gets old.Veteran energy.That was insane.Hello everyone!.Best moment ever.Love seeing this.Walking the walk.Cannot look away.Love seeing this.Never disappoints.What a turnaround.Never counted out.Respect the grind.Never disappoints.Respect the grind.Hard work pays off.Consistency is key.Art form of gaming.Great gameplay btw.This is next level.Peak entertainment.This is why I watch.Real recognize real.Chat is going crazy.Motivation overload.When it matters most.Setting the bar high.Different vibe today.Flow state activated.Comeback king energy.Mind blown right now.Cannot stop watching.The dedication shows.Vibes are immaculate.Automatic excellence.Always coming through.Unmatched performance.Promises and delivers.Mental game is strong.Calculated every move.One step ahead always.Heart racing right now.On the edge of my seat.In the zone completely.Next level inspiration.From behind to victory.Confidence is key here.This is playoff energy.I love this community!.So satisfying to watch.Pure talent right here.Clutch moment incoming.This is peak streaming.Delivers under pressure.Ice in the veins moment.This stream is amazing!.So composed and focused.Muscle memory is insane.Gonna apply this myself.Backing it up every time.Every stream gets better.Good energy in this chat.Physical and mental peak.Tournament mode activated.Absolute unit of a player.Playing 4D chess out here.This is pure content gold.Always believes in the win.Champion mentality showing.Winners mindset on display.This deserves all the hype.Community makes it special.Red pilled and game pilled.Experience matters so much.Been perfecting this craft.Masterclass happening live.First time here, loving it!.Bringing the A game tonight.Nothing stops this momentum.Outsmarting the competition.This chat is moving so fast!.Incredible skills on display.Years of practice paying off.The way they handle pressure.Unstoppable force on display.Precision and power combined.Nothing can break this focus.This is beautiful to witness.Vision and execution perfect.Can we get some hype in chat?.Taking mental notes right now.Stealing all these strategies.Absolutely crushing it today!.POG! POG! POG! This is insane!.Just got here, what did I miss?.Showing everyone how it is done.Knowledge translation to action.Learning from the absolute best.Stream quality is insane today!.Not gonna lie, that was genius!.Gaming at its finest right here.Best stream on Twitch right now!.The strategy here is chef's kiss.This is what greatness looks like.Going to bed, good night everyone!.Content like this is why I tune in.Clap clap clap! Amazing performance!.Absolutely phenomenal content today!.Respect to the dedication shown here.I'm taking notes for my own gameplay.Legendary session right here, no cap.The mechanics on display here are unreal.This is what peak performance looks like.This is why I love this community so much.Setting records and breaking expectations.First time watching and I'm already hooked.Every single play is calculated perfection.The game knowledge displayed here is insane.The fundamentals here are next level perfect.Watching someone who truly loves their craft.The way they handle adversity is so inspiring.Every single decision is calculated perfectly.The combination of speed and accuracy is wild.This is what happens when talent meets effort.The artistry in gameplay displayed right here.Stream just made my day a million times better.This level of consistency is absolutely insane.The decision making under pressure is flawless.The improvement from stream to stream is crazy.The mental fortitude required for this is huge.Reading opponents like they are so predictable.How many years did it take to reach this level?.This person has transcended normal skill levels.The ability to stay cool under extreme pressure.Been here since the beginning, never looked back.Never seen a player adapt so quickly to mistakes.This is exactly what peak performance looks like.Years of training visible in every single moment.Professional level execution on full display here.This is the standard that everyone should aspire to.Nothing phases this player when the stakes are high.This is entertainment at the absolute highest level".split("."), y = [
6869
- ...g,
6870
- ..._,
6871
- ...v
6872
- ], b = [
6776
+ }), e), []), p = [], m = /* @__PURE__ */ "haHAA,CiGrip,PopNemo,PogChamp,bttvNice,ariW wave,DinoDance,CruW salute,c! PogChamp,LUL LUL LUL,CandianRage,CatBag kitty!,<3 good times,catJAM vibing,DuckerZ quack,:tf: trollface,haHAA good one,HSWP let's go!,DxCat claws out,ConcernDoge hmm,BroBalt nice one,VoHiYo everyone!,LuL that was funny,Kappa just kidding,FBCatch nice grab!,cvHazmat stay safe,CookieTime nom nom,LuL that was funny,CruW crew assembled,GlitchCat GlitchCat,CoolCat staying calm,bUrself be yourself!,catJAM catJAM catJAM,HSWP here we go again,Shush moment incoming,duDudu rhythm section,:tf: face palm moment,duDudu rhythm section,HSWP here we go again,PunchTrees PunchTrees,SSSsss Minecraft time,KappaPride represent!,haHAA that joke though,DoritosChip snack time,DoritosChip snack time,asexualPride represent,duDudu dancing on beat,FBBlock defensive play!,ariW waving at everyone,PopNemo finding our way,ariW waving at everyone,TheIlluminati confirmed,SSSsss slithering vibes,GayPride celebrate love,BloodTrail hunting time,TheIlluminati confirmed,LUL can't stop laughing,HypeCheer clap clap clap,DuckerZ quacking in chat,Wait for it... PogChamp!,HypeCheer clap clap clap,KPOPTT music to our ears,FrogPonder thinking frog,IntersexPride we're here,KappaPride be proud Kappa,cvHazmat suit up for this,BrainSlug giving me ideas,KappaPride be proud Kappa,This music is fire catJAM,I just followed! PogChamp,MrDestructoid robot vibes,BroBalt brotherhood moment,VoHiYo greetings from chat,PogChamp PogChamp PogChamp,DxCat meow meow KomodoHype,Squid1 Squid2 Squid3 Squid4,KomodoHype the hype is real,DarkMode gang where you at?,Wait what just happened? D:,TakeNRG infinite energy NRG,CookieTime break time snack,The dedication is real here,PopCorn watching this unfold,CandianRage maple syrup fury,PopCorn watching this unfold,LesbianPride strong together,DinoDance DinoDance DinoDance,TakeNRG this energy is unreal,Everyone gets hype! HypeCheer,CiGrip strong grip on the game,CoolCat no stress allowed here,BisexualPride all love matters,GenderFluidPride freedom to be,DarkMode gang in here DarkMode,HypeFail oops that didn't work,HypePopcorn this is the moment,ConcernDoge is everything okay?,BloodTrail following the leader,This is so wholesome AngelThump,ImGlitch technical difficulties,Anyone else eating? DoritosChip,PixelBob retro vibes with Kappa,SoonerLater catch you next time,imGlitch glitchy but we love it,KomodoHype the energy is crazy!,NonbinaryPride beyond the binary,PansexualPride love is universal,This community is the best Kappa,BrainSlug with the big brain play,TransgenderPride living authentic,AngelThump wholesomeness incoming,GlitchCat imGlitch what happened?,CrreamAwk that was awkward VoHiYo,IronmouseLuv appreciate the stream,PunchTrees minecraft mode activated,The skill on display here is unreal,LesbianPride GayPride BisexualPride,PogChamp PogChamp PogChamp PogChamp,TwitchUnity we're all here for this,This is absolutely insane KomodoHype,Never seen anything like this before,Vibing with cat-shaped avatars catJAM,EarthDay appreciation for this stream,TheIlluminati knows something we don't,Shush they're about to do something big,Can we appreciate this moment? PogChamp,MrDestructoid destroying the competition,AsexualPride IntersexPride GenderFluidPride,TransgenderPride PansexualPride NonbinaryPride".split(","), h = /* @__PURE__ */ ":ytg: Keep it up!.:yt: YouTube hype!.:gar: Amazing as always!.No words, just :awesome:.You got this! :yougotthis:.:elbowbump: Great teamwork!.Love this energy! :goodvibes:.Just arrived! :hand-pink-waving:.Great gameplay! :hand-yellow-nails:.:face-pink-tears: Tears of joy here.This stream is incredible :awesome:.Hydration break everyone! :hydrate:.:text-green-game-over: You won this!.:face-blue-star-eyes: You're a star!.Virtual hug for everyone :virtualhug:.Happy to be here! :face-green-smiling:.Chilling with my dog :chillwdog: vibing.:face-red-heart-shape: Love what you do.:person-turqouise-waving: Hey everyone!.This community is the best! :goodvibes:.:face-blue-smiling: Amazing vibes today.:goodvibes: Only good vibes in this chat.:body-blue-raised-arms: Victory is ours!.:pride-flower-rainbow-heart: Love is love.:octopus-red-waving: Waves from the chat!.:thanksdoc: Thanks for the entertainment!.:face-purple-crying: Why is this so good??.:eyes-pink-heart-shape: Beautiful gameplay.:fish-orange-wide-eyes: Eyes on the prize!.:whistle-red-blow: That was a performance!.Respect the grind :hand-green-crystal-ball:.Learning so much from this stream :learning:.:pride-people-embracing-two: Community love!.:face-red-droopy-eyes: long day but worth it.Chilling with my cat :chillwcat: so peaceful.:face-fuchsia-tongue-out: Having too much fun.:person-purple-stage-event: This is showtime!.:card-red-penalty: That was risky! Bold move!.:face-purple-smiling-tears: This is too good!.:face-orange-tv-shape: Broadcasting excellence.:face-orange-tv-shape: Broadcasting excellence.:face-blue-heart-eyes: This stream has my heart.:person-turquoise-crowd-surf: Crowd going wild!.Best gaming session ever :trophy-yellow-smiling:.:hand-purple-blue-peace: Peace out, great stream!.:face-purple-sweating: Clutch moment! So intense!.:hand-orange-covering-eyes: Can't believe my eyes!.:face-blue-question-mark: How do you even do that?.:baseball-white-cap-out: Home run! Total knockout!.:volcano-green-lava-orange: Things are getting HOT.:face-purple-smiling-fangs: Evil laugh at that play.:stopwatch-blue-hand-timer: Speedrunning like a pro.:location-yellow-teal-bars: Streaming from the top!.:face-purple-open-box: What's next? More surprises?.:person-turquoise-wizard-wand: Like magic out there!.:face-blue-wide-eyes: Did that actually just happen?!.:medal-yellow-first-red: Number one stream right here.:face-turquoise-music-note: Vibing to this soundtrack.Can we just appreciate how awesome this is? :awesome:.:popcorn-yellow-striped-smile: This is the main event!.:face-orange-raised-eyebrow: Interesting strategy there.:person-blue-speaking-microphone: Let's go! Hype it up!.:pride-megaphone-rainbow-handle: Amplifying good vibes!.:rocket-red-countdown-liftoff: Let's go! Time to launch!.:person-blue-holding-pencil: Taking notes on these skills.:face-fuchsia-poop-shape: That was a mess! But we survived.:person-pink-swaying-hair: The style, the skill, everything!.:body-turquoise-yoga-pose: So smooth and calm under pressure.:penguin-blue-waving-tear: Goodbye for now, fantastic stream!.:face-turquoise-covering-eyes: Wait what? How did you do that?.:face-turquoise-covering-eyes: Wait what? How did you do that?.:clock-turquoise-looking-up: What time is it? Time to watch you!.:person-blue-eating-spaghetti: Fueling up after that performance.:hourglass-purple-sand-orange: Time flies when you're having fun.:face-turquoise-drinking-coffee: Coffee and gaming, perfect combo.:person-turquoise-writes-headphones: That's some creative strategy.:face-purple-rain-drops: Emotional over here :face-pink-drinking-tea:.:pride-person-heart-lesbian: Proud and here :pride-flowers-turquoise-transgender:".split("."), g = /* @__PURE__ */ "GG!.Wow just wow.Fire fire fire.Simply amazing.Never gets old.Veteran energy.That was insane.Hello everyone!.Best moment ever.Love seeing this.Walking the walk.Cannot look away.Love seeing this.Never disappoints.What a turnaround.Never counted out.Respect the grind.Never disappoints.Respect the grind.Hard work pays off.Consistency is key.Art form of gaming.Great gameplay btw.This is next level.Peak entertainment.This is why I watch.Real recognize real.Chat is going crazy.Motivation overload.When it matters most.Setting the bar high.Different vibe today.Flow state activated.Comeback king energy.Mind blown right now.Cannot stop watching.The dedication shows.Vibes are immaculate.Automatic excellence.Always coming through.Unmatched performance.Promises and delivers.Mental game is strong.Calculated every move.One step ahead always.Heart racing right now.On the edge of my seat.In the zone completely.Next level inspiration.From behind to victory.Confidence is key here.This is playoff energy.I love this community!.So satisfying to watch.Pure talent right here.Clutch moment incoming.This is peak streaming.Delivers under pressure.Ice in the veins moment.This stream is amazing!.So composed and focused.Muscle memory is insane.Gonna apply this myself.Backing it up every time.Every stream gets better.Good energy in this chat.Physical and mental peak.Tournament mode activated.Absolute unit of a player.Playing 4D chess out here.This is pure content gold.Always believes in the win.Champion mentality showing.Winners mindset on display.This deserves all the hype.Community makes it special.Red pilled and game pilled.Experience matters so much.Been perfecting this craft.Masterclass happening live.First time here, loving it!.Bringing the A game tonight.Nothing stops this momentum.Outsmarting the competition.This chat is moving so fast!.Incredible skills on display.Years of practice paying off.The way they handle pressure.Unstoppable force on display.Precision and power combined.Nothing can break this focus.This is beautiful to witness.Vision and execution perfect.Can we get some hype in chat?.Taking mental notes right now.Stealing all these strategies.Absolutely crushing it today!.POG! POG! POG! This is insane!.Just got here, what did I miss?.Showing everyone how it is done.Knowledge translation to action.Learning from the absolute best.Stream quality is insane today!.Not gonna lie, that was genius!.Gaming at its finest right here.Best stream on Twitch right now!.The strategy here is chef's kiss.This is what greatness looks like.Going to bed, good night everyone!.Content like this is why I tune in.Clap clap clap! Amazing performance!.Absolutely phenomenal content today!.Respect to the dedication shown here.I'm taking notes for my own gameplay.Legendary session right here, no cap.The mechanics on display here are unreal.This is what peak performance looks like.This is why I love this community so much.Setting records and breaking expectations.First time watching and I'm already hooked.Every single play is calculated perfection.The game knowledge displayed here is insane.The fundamentals here are next level perfect.Watching someone who truly loves their craft.The way they handle adversity is so inspiring.Every single decision is calculated perfectly.The combination of speed and accuracy is wild.This is what happens when talent meets effort.The artistry in gameplay displayed right here.Stream just made my day a million times better.This level of consistency is absolutely insane.The decision making under pressure is flawless.The improvement from stream to stream is crazy.The mental fortitude required for this is huge.Reading opponents like they are so predictable.How many years did it take to reach this level?.This person has transcended normal skill levels.The ability to stay cool under extreme pressure.Been here since the beginning, never looked back.Never seen a player adapt so quickly to mistakes.This is exactly what peak performance looks like.Years of training visible in every single moment.Professional level execution on full display here.This is the standard that everyone should aspire to.Nothing phases this player when the stakes are high.This is entertainment at the absolute highest level".split("."), _ = [
6777
+ ...m,
6778
+ ...h,
6779
+ ...g
6780
+ ], v = [
6873
6781
  "Tixyel",
6874
6782
  "awigui",
6875
6783
  "kurao_w",
@@ -6884,12 +6792,12 @@ var e = class {
6884
6792
  "shy_madeit",
6885
6793
  "SpookySony",
6886
6794
  "nanagadesign"
6887
- ], x = [
6795
+ ], y = [
6888
6796
  "1000",
6889
6797
  "2000",
6890
6798
  "3000",
6891
6799
  "prime"
6892
- ], S = /* @__PURE__ */ "Filiz.Astrid.Tatyana.Maxim.Carmen.Ines.Cristiano.Vitoria.Ricardo.Maja.Jan.Jacek.Ewa.Ruben.Lotte.Liv.Seoyeon.Takumi.Mizuki.Giorgio.Carla.Bianca.Karl.Dora.Mathieu.Celine.Chantal.Penelope.Miguel.Mia.Enrique.Conchita.Geraint.Salli.Matthew.Kimberly.Kendra.Justin.Joey.Joanna.Ivy.Raveena.Aditi.Emma.Brian.Amy.Russell.Nicole.Vicki.Marlene.Hans.Naja.Mads.Gwyneth.Zhiyu.Tracy.Danny.Huihui.Yaoyao.Kangkang.HanHan.Zhiwei.Asaf.An.Stefanos.Filip.Ivan.Heidi.Herena.Kalpana.Hemant.Matej.Andika.Rizwan.Lado.Valluvar.Linda.Heather.Sean.Michael.Karsten.Guillaume.Pattara.Jakub.Szabolcs.Hoda.Naayf".split("."), C = [
6800
+ ], b = /* @__PURE__ */ "Filiz.Astrid.Tatyana.Maxim.Carmen.Ines.Cristiano.Vitoria.Ricardo.Maja.Jan.Jacek.Ewa.Ruben.Lotte.Liv.Seoyeon.Takumi.Mizuki.Giorgio.Carla.Bianca.Karl.Dora.Mathieu.Celine.Chantal.Penelope.Miguel.Mia.Enrique.Conchita.Geraint.Salli.Matthew.Kimberly.Kendra.Justin.Joey.Joanna.Ivy.Raveena.Aditi.Emma.Brian.Amy.Russell.Nicole.Vicki.Marlene.Hans.Naja.Mads.Gwyneth.Zhiyu.Tracy.Danny.Huihui.Yaoyao.Kangkang.HanHan.Zhiwei.Asaf.An.Stefanos.Filip.Ivan.Heidi.Herena.Kalpana.Hemant.Matej.Andika.Rizwan.Lado.Valluvar.Linda.Heather.Sean.Michael.Karsten.Guillaume.Pattara.Jakub.Szabolcs.Hoda.Naayf".split("."), x = [
6893
6801
  {
6894
6802
  emojiId: "UCkszU2WH9gy1mb0dV-11UJg/flower-rainbow-heart-red",
6895
6803
  shortcuts: [":pride-flower-rainbow-heart:"],
@@ -9208,13 +9116,13 @@ var e = class {
9208
9116
  isCustomEmoji: !0,
9209
9117
  index: 121
9210
9118
  }
9211
- ], w;
9119
+ ], S;
9212
9120
  (function(e) {
9213
- e.avatars = s, e.badges = c, e.css_color_names = l, e.items = h, e.names = b, e.tiers = x, e.tts = S, e.messages = y, e.normal_messages = v, e.twitch_messages = g, e.youtube_messages = _, e.emotes = m, e.ffz_emotes = f, e.bttv_emotes = d, e.seventv_emotes = u, e.twitch_emotes = p, e.youtube_emotes = C;
9214
- })(w ||= {});
9121
+ e.avatars = a, e.badges = o, e.css_color_names = s, e.items = p, e.names = v, e.tiers = y, e.tts = b, e.messages = _, e.normal_messages = g, e.twitch_messages = m, e.youtube_messages = h, e.emotes = f, e.ffz_emotes = u, e.bttv_emotes = l, e.seventv_emotes = c, e.twitch_emotes = d, e.youtube_emotes = x;
9122
+ })(S ||= {});
9215
9123
  //#endregion
9216
9124
  //#region src/helper/classes/random.ts
9217
- var T = class {
9125
+ var C = class {
9218
9126
  color(e = "hex") {
9219
9127
  switch (e) {
9220
9128
  default:
@@ -9225,7 +9133,7 @@ var T = class {
9225
9133
  case "hsl": return `hsl(${Math.floor(Math.random() * 361)}, ${Math.floor(Math.random() * 101)}%, ${Math.floor(Math.random() * 101)}%)`;
9226
9134
  case "hsla": return `hsla(${Math.floor(Math.random() * 361)}, ${Math.floor(Math.random() * 101)}%, ${Math.floor(Math.random() * 101)}%, ${Math.random().toFixed(2)})`;
9227
9135
  case "css-color-name":
9228
- var t = w.css_color_names;
9136
+ var t = S.css_color_names;
9229
9137
  return this.array(t)[0];
9230
9138
  }
9231
9139
  }
@@ -9257,11 +9165,11 @@ var T = class {
9257
9165
  uuid() {
9258
9166
  return crypto.randomUUID();
9259
9167
  }
9260
- }, E = class {
9168
+ }, w = class {
9261
9169
  constructor() {
9262
9170
  this.badgePriority = /* @__PURE__ */ "broadcaster.lead_moderator.moderator.vip.artist-badge.subscriber.sub-gift-leader.founder.sub-gifter.bits-leader.bits.admin.global_mod.staff.partner.ambassador.predictions.twitchbot.extension.game-developer.hype-train.bot-badge.turbo.premium.no_video.no_audio".split(".");
9263
9171
  }
9264
- findEmotesInText(e, t = w.emotes) {
9172
+ findEmotesInText(e, t = S.emotes) {
9265
9173
  let n = [];
9266
9174
  return t.filter((e) => e.type !== "emoji").forEach((t) => {
9267
9175
  let r = t.name, i = 0;
@@ -9295,7 +9203,7 @@ var T = class {
9295
9203
  hasOnlyEmotes(e, t) {
9296
9204
  return t.reduce((e, t) => e.replace(RegExp(`\\b${t.name}\\b`, "g"), "").replace(/<img[^>]*class="emote"[^>]*>/gi, ""), e).trim().length === 0;
9297
9205
  }
9298
- replaceYoutubeEmotesWithHTML(e, t = w.youtube_emotes) {
9206
+ replaceYoutubeEmotesWithHTML(e, t = S.youtube_emotes) {
9299
9207
  return Array.from(e.matchAll(/:(.*?):/gim), (e) => e[0]).forEach((n) => {
9300
9208
  let r = t.find((e) => e.shortcuts.includes(n) || e.searchTerms.includes(n.slice(1, -1)));
9301
9209
  if (r) {
@@ -9304,7 +9212,7 @@ var T = class {
9304
9212
  }
9305
9213
  }), e;
9306
9214
  }
9307
- mapGlobalBadgeVersions(e = w.badges) {
9215
+ mapGlobalBadgeVersions(e = S.badges) {
9308
9216
  return e.map((e) => ({
9309
9217
  id: e.set_id,
9310
9218
  versions: e.versions.map((t) => ({
@@ -9316,7 +9224,7 @@ var T = class {
9316
9224
  }));
9317
9225
  }
9318
9226
  mapGlobalBadgeVersionAmount(e, t) {
9319
- let n = (e) => w.badges.find((t) => t.set_id === e).versions.map((e) => [e.id, parseInt(e.id)]), r = "0";
9227
+ let n = (e) => S.badges.find((t) => t.set_id === e).versions.map((e) => [e.id, parseInt(e.id)]), r = "0";
9320
9228
  switch (e) {
9321
9229
  case "subscriber": {
9322
9230
  if (isNaN(parseInt(t))) return r;
@@ -9429,42 +9337,42 @@ var T = class {
9429
9337
  return r;
9430
9338
  }
9431
9339
  async generateBadges(e = [], t) {
9432
- let n = this.mapGlobalBadgeVersions();
9340
+ let r = this.mapGlobalBadgeVersions();
9433
9341
  !Array.isArray(e) && typeof e == "string" && (e = e.split(",").map((e) => e.trim()));
9434
- var r = e.map((e) => e.split("/")[0]);
9435
- if (!r || !r.length) {
9436
- let e = new i(), t = new T();
9342
+ var i = e.map((e) => e.split("/")[0]);
9343
+ if (!i || !i.length) {
9344
+ let e = new n(), t = new C();
9437
9345
  var a = e.random(1, 3);
9438
9346
  for await (let e of Array.from({ length: a }, () => "")) {
9439
- let e = t.array(n)[0];
9440
- !r.includes(e.id) && Array.isArray(r) ? r.push(e.id) : r = [e.id];
9347
+ let e = t.array(r)[0];
9348
+ !i.includes(e.id) && Array.isArray(i) ? i.push(e.id) : i = [e.id];
9441
9349
  }
9442
9350
  }
9443
- r = r.sort((e, t) => {
9351
+ i = i.sort((e, t) => {
9444
9352
  let n = this.badgePriority.indexOf(e), r = this.badgePriority.indexOf(t);
9445
9353
  return (n === -1 ? 2 ** 53 - 1 : n) - (r === -1 ? 2 ** 53 - 1 : r);
9446
9354
  });
9447
9355
  var o;
9448
9356
  switch (t) {
9449
9357
  case "twitch": {
9450
- let t = Array.from(r).filter((e) => n.some((t) => t.id === e)), i = e.reduce((e, t) => {
9358
+ let t = Array.from(i).filter((e) => r.some((t) => t.id === e)), n = e.reduce((e, t) => {
9451
9359
  var [n, r = "1"] = t.split("/");
9452
9360
  let i = r;
9453
9361
  return isNaN(parseInt(i)) ? i ||= 0 : i = parseInt(i), e[n] = this.mapGlobalBadgeVersionAmount(n, i), e;
9454
9362
  }, {});
9455
9363
  o = {
9456
9364
  keys: t,
9457
- versions: i,
9365
+ versions: n,
9458
9366
  amount: e.reduce((e, t) => {
9459
9367
  var [n, r = "1"] = t.split("/");
9460
9368
  let i = r;
9461
9369
  return isNaN(parseInt(i)) ? i ||= 0 : i = parseInt(i), e[n] = i, e;
9462
9370
  }, {}),
9463
- badges: Array.from(r).slice(0, 3).map((e) => {
9464
- let t = n.find((t) => t.id === e);
9371
+ badges: Array.from(i).slice(0, 3).map((e) => {
9372
+ let t = r.find((t) => t.id === e);
9465
9373
  if (t?.versions && t.versions.length) {
9466
- let n = i[e];
9467
- return t.versions.find((e) => e.version === String(n)) || t.versions[0];
9374
+ let r = n[e];
9375
+ return t.versions.find((e) => e.version === String(r)) || t.versions[0];
9468
9376
  }
9469
9377
  }).filter(Boolean)
9470
9378
  };
@@ -9480,7 +9388,7 @@ var T = class {
9480
9388
  subscriber: { isChatSponsor: !0 },
9481
9389
  moderator: { isChatModerator: !0 }
9482
9390
  };
9483
- o = Object.values(r).reduce((e, t) => (t in s && Object.assign(e, s[t]), e), {
9391
+ o = Object.values(i).reduce((e, t) => (t in s && Object.assign(e, s[t]), e), {
9484
9392
  isVerified: !1,
9485
9393
  isChatOwner: !1,
9486
9394
  isChatSponsor: !1,
@@ -9490,7 +9398,7 @@ var T = class {
9490
9398
  }
9491
9399
  return o;
9492
9400
  }
9493
- }, D = class {
9401
+ }, T = class {
9494
9402
  parseProvider(e, t) {
9495
9403
  var n = e?.provider || e.event?.provider || e.event?.service || e.event?.data?.provider || t || window?.client?.details?.provider || "twitch";
9496
9404
  return [
@@ -9508,7 +9416,7 @@ var T = class {
9508
9416
  };
9509
9417
  //#endregion
9510
9418
  //#region src/utils/color.ts
9511
- function O(e, t) {
9419
+ function E(e, t) {
9512
9420
  if (!t) return null;
9513
9421
  switch (t) {
9514
9422
  case "hex": {
@@ -9536,7 +9444,7 @@ function O(e, t) {
9536
9444
  if (!t) return null;
9537
9445
  let n = parseInt(t[1]), r = parseInt(t[2]), i = parseInt(t[3]), a = t[4] ? parseFloat(t[4]) : 1;
9538
9446
  return {
9539
- ...j(n, r, i),
9447
+ ...k(n, r, i),
9540
9448
  a
9541
9449
  };
9542
9450
  }
@@ -9557,11 +9465,11 @@ function O(e, t) {
9557
9465
  default: return null;
9558
9466
  }
9559
9467
  }
9560
- function k(e, t = !0) {
9468
+ function D(e, t = !0) {
9561
9469
  let n = (e) => Math.round(e).toString(16).padStart(2, "0"), r = `#${n(e.r)}${n(e.g)}${n(e.b)}`;
9562
9470
  return t && e.a < 1 && (r += n(e.a * 255)), r;
9563
9471
  }
9564
- function A(e, t, n) {
9472
+ function O(e, t, n) {
9565
9473
  e /= 255, t /= 255, n /= 255;
9566
9474
  let r = Math.max(e, t, n), i = Math.min(e, t, n), a = r - i, o = 0, s = 0, c = (r + i) / 2;
9567
9475
  if (a !== 0) switch (s = c > .5 ? a / (2 - r - i) : a / (r + i), r) {
@@ -9581,7 +9489,7 @@ function A(e, t, n) {
9581
9489
  l: Math.round(c * 100)
9582
9490
  };
9583
9491
  }
9584
- function j(e, t, n) {
9492
+ function k(e, t, n) {
9585
9493
  e /= 360, t /= 100, n /= 100;
9586
9494
  let r, i, a;
9587
9495
  if (t === 0) r = i = a = n;
@@ -9595,8 +9503,8 @@ function j(e, t, n) {
9595
9503
  b: Math.round(a * 255)
9596
9504
  };
9597
9505
  }
9598
- async function ee(e, t, n) {
9599
- let r = l, i = r[0], a = Infinity;
9506
+ async function A(e, t, n) {
9507
+ let r = s, i = r[0], a = Infinity;
9600
9508
  for await (let o of r) {
9601
9509
  let r = document.createElement("canvas");
9602
9510
  r.width = r.height = 1;
@@ -9610,7 +9518,7 @@ async function ee(e, t, n) {
9610
9518
  }
9611
9519
  //#endregion
9612
9520
  //#region src/helper/classes/color.ts
9613
- var M = class {
9521
+ var j = class {
9614
9522
  opacity(e = 100, t = "") {
9615
9523
  t = t.length > 7 ? t?.substring(0, 6) : t, e = e > 1 ? e / 100 : e;
9616
9524
  let n = Math.round(Math.min(Math.max(e, 0), 1) * 255).toString(16).toLowerCase().padStart(2, "0");
@@ -9630,31 +9538,31 @@ var M = class {
9630
9538
  validate(e) {
9631
9539
  if (typeof e != "string" || !String(e).trim().length) return !1;
9632
9540
  let t = e.trim();
9633
- return /^#([A-Fa-f0-9]{3}){1,2}$/.test(t) || /^#([A-Fa-f0-9]{4}|[A-Fa-f0-9]{8})$/.test(t) ? "hex" : /^rgb\(\s*(?:\d{1,3}\s*,\s*){2}\d{1,3}\s*\)$/.test(t) ? "rgb" : /^rgba\(\s*(?:\d{1,3}\s*,\s*){3}(?:0|1|0?\.\d+)\s*\)$/.test(t) ? "rgba" : /^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/.test(t) ? "hsl" : /^hsla\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*,\s*(?:0|1|0?\.\d+)\s*\)$/.test(t) ? "hsla" : w.css_color_names.includes(t.toLowerCase()) ? "css-color-name" : !1;
9541
+ return /^#([A-Fa-f0-9]{3}){1,2}$/.test(t) || /^#([A-Fa-f0-9]{4}|[A-Fa-f0-9]{8})$/.test(t) ? "hex" : /^rgb\(\s*(?:\d{1,3}\s*,\s*){2}\d{1,3}\s*\)$/.test(t) ? "rgb" : /^rgba\(\s*(?:\d{1,3}\s*,\s*){3}(?:0|1|0?\.\d+)\s*\)$/.test(t) ? "rgba" : /^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/.test(t) ? "hsl" : /^hsla\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*,\s*(?:0|1|0?\.\d+)\s*\)$/.test(t) ? "hsla" : S.css_color_names.includes(t.toLowerCase()) ? "css-color-name" : !1;
9634
9542
  }
9635
9543
  async convert(e, t) {
9636
9544
  let n = this.validate(e);
9637
9545
  if (!n) throw Error(`Invalid color format: ${e}`);
9638
9546
  if (n === t) throw Error(`Color is already in the desired format: ${t}`);
9639
- let r = O(e.trim(), n);
9547
+ let r = E(e.trim(), n);
9640
9548
  if (!r) throw Error(`Failed to parse color: ${e}`);
9641
9549
  switch (t) {
9642
- case "hex": return k(r, !1);
9550
+ case "hex": return D(r, !1);
9643
9551
  case "rgb": return `rgb(${r.r}, ${r.g}, ${r.b})`;
9644
9552
  case "rgba": return `rgba(${r.r}, ${r.g}, ${r.b}, ${r.a})`;
9645
9553
  case "hsl": {
9646
- let e = A(r.r, r.g, r.b);
9554
+ let e = O(r.r, r.g, r.b);
9647
9555
  return `hsl(${e.h}, ${e.s}%, ${e.l}%)`;
9648
9556
  }
9649
9557
  case "hsla": {
9650
- let e = A(r.r, r.g, r.b);
9558
+ let e = O(r.r, r.g, r.b);
9651
9559
  return `hsla(${e.h}, ${e.s}%, ${e.l}%, ${r.a})`;
9652
9560
  }
9653
- case "css-color-name": return await ee(r.r, r.g, r.b);
9561
+ case "css-color-name": return await A(r.r, r.g, r.b);
9654
9562
  default: return null;
9655
9563
  }
9656
9564
  }
9657
- }, te = class {
9565
+ }, M = class {
9658
9566
  constructor() {
9659
9567
  this.PRESETS = {};
9660
9568
  }
@@ -9677,7 +9585,7 @@ var M = class {
9677
9585
  modifiers: {},
9678
9586
  aliases: {}
9679
9587
  }) {
9680
- let { mergeSpanStyles: r } = new a(), i = (e, t, i) => n.html ? r(e, t, i) : t, s = {
9588
+ let { mergeSpanStyles: a } = new r(), o = (e, t, r) => n.html ? a(e, t, r) : t, s = {
9681
9589
  skip: "<br/>",
9682
9590
  newline: "<br/>",
9683
9591
  ...t
@@ -9686,7 +9594,7 @@ var M = class {
9686
9594
  let e = (window?.client)?.details?.currency;
9687
9595
  e?.symbol && (c = String(e.symbol)), e?.code && (l = String(e.code));
9688
9596
  } catch {}
9689
- let u = new o(), d = Object.entries(u.flatten(s)).reduce((e, [t, n]) => {
9597
+ let u = new i(), d = Object.entries(u.flatten(s)).reduce((e, [t, n]) => {
9690
9598
  if (e[t] = String(n), [
9691
9599
  "username",
9692
9600
  "name",
@@ -9876,7 +9784,7 @@ var M = class {
9876
9784
  }
9877
9785
  return r ? !a : a;
9878
9786
  }
9879
- let T = new M(), E = {
9787
+ let T = new j(), E = {
9880
9788
  BT1: (e) => p > 1 ? e : "",
9881
9789
  BT0: (e) => p > 0 ? e : "",
9882
9790
  ST1: (e) => p < 1 ? e : "",
@@ -9913,22 +9821,22 @@ var M = class {
9913
9821
  },
9914
9822
  FALLBACK: (e, t) => e.length ? e : t ?? e,
9915
9823
  ...n?.html ? {
9916
- COLOR: (e, t) => i(t && T.validate(t) ? `color: ${t}` : "", e, "color"),
9917
- WEIGHT: (e, t) => i(t && !isNaN(parseInt(t)) ? `font-weight: ${t}` : "", e, "weight"),
9918
- SEMIBOLD: (e) => i("font-weight: 600", e, "semibold"),
9919
- BOLD: (e) => i("font-weight: bold", e, "bold"),
9920
- BLACK: (e) => i("font-weight: 900", e, "black"),
9921
- LIGHT: (e) => i("font-weight: lighter", e, "light"),
9922
- STRONG: (e) => i("font-weight: bolder", e, "strong"),
9923
- ITALIC: (e) => i("font-style: italic", e, "italic"),
9924
- UNDERLINE: (e) => i("text-decoration: underline", e, "underline"),
9925
- STRIKETHROUGH: (e) => i("text-decoration: line-through", e, "strikethrough"),
9926
- SUB: (e) => i("vertical-align: sub", e, "sub"),
9927
- SUP: (e) => i("vertical-align: super", e, "sup"),
9928
- LARGER: (e) => i("font-size: larger", e, "larger"),
9929
- SMALL: (e) => i("font-size: smaller", e, "small"),
9930
- SHADOW: (e, t) => i(`text-shadow: ${t}`, e, "shadow"),
9931
- SIZE: (e, t) => i(t ? `font-size: ${t}` : "", e, "size")
9824
+ COLOR: (e, t) => o(t && T.validate(t) ? `color: ${t}` : "", e, "color"),
9825
+ WEIGHT: (e, t) => o(t && !isNaN(parseInt(t)) ? `font-weight: ${t}` : "", e, "weight"),
9826
+ SEMIBOLD: (e) => o("font-weight: 600", e, "semibold"),
9827
+ BOLD: (e) => o("font-weight: bold", e, "bold"),
9828
+ BLACK: (e) => o("font-weight: 900", e, "black"),
9829
+ LIGHT: (e) => o("font-weight: lighter", e, "light"),
9830
+ STRONG: (e) => o("font-weight: bolder", e, "strong"),
9831
+ ITALIC: (e) => o("font-style: italic", e, "italic"),
9832
+ UNDERLINE: (e) => o("text-decoration: underline", e, "underline"),
9833
+ STRIKETHROUGH: (e) => o("text-decoration: line-through", e, "strikethrough"),
9834
+ SUB: (e) => o("vertical-align: sub", e, "sub"),
9835
+ SUP: (e) => o("vertical-align: super", e, "sup"),
9836
+ LARGER: (e) => o("font-size: larger", e, "larger"),
9837
+ SMALL: (e) => o("font-size: smaller", e, "small"),
9838
+ SHADOW: (e, t) => o(`text-shadow: ${t}`, e, "shadow"),
9839
+ SIZE: (e, t) => o(t ? `font-size: ${t}` : "", e, "size")
9932
9840
  } : {},
9933
9841
  ...n.modifiers ?? {}
9934
9842
  }, D = {
@@ -10031,9 +9939,9 @@ var M = class {
10031
9939
  ...n.aliases ?? {}
10032
9940
  };
10033
9941
  function O(e, t, r) {
10034
- let a = Object.entries(D).find(([e, n]) => n.some((e) => e.toUpperCase() === t.toUpperCase()) ? !0 : e.toUpperCase() === t.toUpperCase()), o = a ? a[0] : t.toUpperCase();
9942
+ let i = Object.entries(D).find(([e, n]) => n.some((e) => e.toUpperCase() === t.toUpperCase()) ? !0 : e.toUpperCase() === t.toUpperCase()), a = i ? i[0] : t.toUpperCase();
10035
9943
  try {
10036
- return E[o] ? E[o](e, typeof r == "string" ? r.trim() : null, d) : n?.html ? i("", e, o.toLowerCase()) : e;
9944
+ return E[a] ? E[a](e, typeof r == "string" ? r.trim() : null, d) : n?.html ? o("", e, a.toLowerCase()) : e;
10037
9945
  } catch (i) {
10038
9946
  return n?.debug && typeof console < "u" && typeof console.error == "function" && console.error("[Helper.string.compose] Modifier error", {
10039
9947
  name: t,
@@ -10097,10 +10005,10 @@ var M = class {
10097
10005
  }
10098
10006
  return r();
10099
10007
  }
10100
- let j = e.replace(f.PLACEHOLDERS, (e, t) => typeof d[t] == "string" || typeof d[t] == "number" ? String(d[t]) : t ?? t);
10101
- return j = n.method === "loop" ? k(j) : A(j), j;
10008
+ let M = e.replace(f.PLACEHOLDERS, (e, t) => typeof d[t] == "string" || typeof d[t] == "number" ? String(d[t]) : t ?? t);
10009
+ return M = n.method === "loop" ? k(M) : A(M), M;
10102
10010
  }
10103
- }, ne = class {
10011
+ }, N = class {
10104
10012
  constructor() {
10105
10013
  this.playing = !1;
10106
10014
  }
@@ -10119,264 +10027,84 @@ var M = class {
10119
10027
  throw Error(`Error playing sound: ${e}`);
10120
10028
  }
10121
10029
  }
10122
- }, re = class {
10030
+ }, ee = class {
10123
10031
  apply(e, t, n) {
10124
10032
  return e.apply(t, n);
10125
10033
  }
10126
10034
  call(e, t, ...n) {
10127
10035
  return e.call(t, ...n);
10128
10036
  }
10129
- }, ie = class {
10130
- constructor(e, t, n = [], r = !1, i) {
10131
- this.badges = [], this.isSubscriber = !1, this.id = e, this.name = t, this.login = t.toLocaleLowerCase(), this.badges = n, this.isSubscriber = r, this.tier = i;
10037
+ }, te = /* @__PURE__ */ t({
10038
+ fakeUserPools: () => z,
10039
+ usedButtons: () => R,
10040
+ usedClients: () => P,
10041
+ usedCommands: () => L,
10042
+ usedComms: () => I,
10043
+ usedStorages: () => F
10044
+ }), P = [], F = [], I = [], L = [], R = [], z = [], ne = class e {
10045
+ delay(e, t) {
10046
+ return new Promise((n) => setTimeout(() => {
10047
+ n(t ? t() ?? null : null);
10048
+ }, e));
10132
10049
  }
10133
- }, ae = {
10134
- broadcaster: [
10135
- "moderator",
10136
- "vip",
10137
- "artist-badge"
10138
- ],
10139
- moderator: ["lead_moderator"],
10140
- no_video: ["no_audio"],
10141
- "60-seconds_1": ["60-seconds_2", "60-seconds_3"],
10142
- duelyst_1: [
10143
- "duelyst_2",
10144
- "duelyst_3",
10145
- "duelyst_4",
10146
- "duelyst_5",
10147
- "duelyst_6",
10148
- "duelyst_7"
10149
- ]
10150
- }, N = [], P = class t extends e {
10151
- static fixUser(e) {
10152
- return typeof e == "string" ? e.trim().replace(/^@+/, "").toLocaleLowerCase() : t.fixUser(e.name);
10050
+ typedEntries(e) {
10051
+ return Object.entries(e);
10153
10052
  }
10154
- static getRandomSubTier() {
10155
- return new F().probability({
10156
- prime: .4,
10157
- 1e3: .3,
10158
- 2e3: .2,
10159
- 3e3: .1
10160
- }) ?? "prime";
10053
+ typedValues(e) {
10054
+ return Object.values(e);
10161
10055
  }
10162
- constructor(e) {
10163
- super(), this.users = [], this.byId = /* @__PURE__ */ new Map(), this.byName = /* @__PURE__ */ new Map(), this.byBadge = /* @__PURE__ */ new Map(), this.id = e?.id || `fake_user_pool_${Math.random().toString(36).slice(2, 10)}`, this.users = this.start(e?.names || w.names, e?.badges, e), this.byId = new Map(this.users.map((e) => [e.id, e])), this.byName = new Map(this.users.map((e) => [e.login, e])), this.byBadge = new Map(this.users.reduce((e, t) => {
10164
- for (let n of t.badges) {
10165
- let r = e.get(n) ?? [];
10166
- e.set(n, [...r, t]);
10167
- }
10168
- return e;
10169
- }, /* @__PURE__ */ new Map())), N.push(this);
10056
+ typedKeys(e) {
10057
+ return Object.keys(e);
10170
10058
  }
10171
- start(e, n = w.badges.map((e) => e.set_id), r) {
10172
- let i = e.map((e) => e && t.fixUser(e)).filter((e) => e && e.length).filter((e, t, n) => n.indexOf(e) === t), a = n.filter((e, t, n) => n.indexOf(e) === t);
10173
- if (!a.length || !i.length) return [];
10174
- let o = [], s = typeof r?.minimumBadgesPerUser == "number" && r.minimumBadgesPerUser >= 0 ? Math.floor(r.minimumBadgesPerUser) : 1, c = Math.min(s, 3), l = r?.limits ?? {}, u = r?.fixed ?? {}, d = new Set(a), f = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), g = 0, _ = (e) => {
10175
- let t = l[e];
10176
- return typeof t == "number" && t > 0 ? t : Infinity;
10177
- }, v = (e) => {
10178
- let t = f.get(e) ?? 0;
10179
- f.set(e, t + 1);
10180
- }, y = (e) => {
10181
- let t = m.get(e) ?? 0;
10182
- if (t <= 1) {
10183
- m.delete(e);
10184
- return;
10185
- }
10186
- m.set(e, t - 1);
10187
- }, b = (e) => e ? typeof e == "string" ? [t.fixUser(e)].filter((e) => !!e) : Array.isArray(e) ? e.map(t.fixUser).filter((e) => !!e) : [] : [], x = (e) => e ? Array.isArray(e) ? e : [e] : [], S = (e, t) => {
10188
- let n = /* @__PURE__ */ new Map();
10189
- for (let r of [e, t]) for (let [e, t] of Object.entries(r ?? {})) {
10190
- let r = n.get(e) ?? [], i = x(t);
10191
- n.set(e, [...new Set([...r, ...i])]);
10192
- }
10193
- return n;
10194
- }, C = (e, t) => {
10195
- if (e === t) return;
10196
- let n = h.get(e) ?? /* @__PURE__ */ new Set();
10197
- n.add(t), h.set(e, n);
10198
- let r = h.get(t) ?? /* @__PURE__ */ new Set();
10199
- r.add(e), h.set(t, r);
10200
- }, T = (e, t) => t.includes(e) ? !1 : t.every((t) => !h.get(t)?.has(e)), E = (e, t) => {
10201
- if (!T(e, t)) return !1;
10202
- let n = _(e), r = f.get(e) ?? 0, i = m.get(e) ?? 0;
10203
- return r < n && r + i < n;
10204
- }, D = (e, t) => {
10205
- if (!T(e, t)) return !1;
10206
- let n = _(e);
10207
- return (f.get(e) ?? 0) < n;
10208
- }, O = (e) => {
10209
- for (let t = 0; t < a.length; t++) {
10210
- let n = a[(g + t) % a.length];
10211
- if (E(n, e)) return g = (g + t + 1) % a.length, n;
10212
- }
10213
- return null;
10059
+ compareDates(e, t) {
10060
+ let n = e instanceof Date ? new Date(e.getTime()) : new Date(e), r = t instanceof Date ? new Date(t.getTime()) : new Date(t);
10061
+ if (Number.isNaN(n.getTime()) || Number.isNaN(r.getTime())) throw Error("Invalid date provided to compareDates");
10062
+ let i = r.getTime() - n.getTime(), a = Math.abs(i), o = i / 1e3, s = i / (1e3 * 60), c = i / (1e3 * 60 * 60), l = i / (1e3 * 60 * 60 * 24), u = l / 30.436875, d = l / 365.2425, f = n <= r ? n : r, p = n <= r ? r : n, m = (p.getFullYear() - f.getFullYear()) * 12 + (p.getMonth() - f.getMonth()), h = new Date(f);
10063
+ h.setMonth(h.getMonth() + m), h > p && --m;
10064
+ let g = i < 0 ? -1 : 1, _ = m * g, v = m / 12 * g;
10065
+ return {
10066
+ milliseconds: i,
10067
+ seconds: o,
10068
+ minutes: s,
10069
+ hours: c,
10070
+ days: l,
10071
+ months: u,
10072
+ years: d,
10073
+ absolute: {
10074
+ milliseconds: a,
10075
+ seconds: a / 1e3,
10076
+ minutes: a / (1e3 * 60),
10077
+ hours: a / (1e3 * 60 * 60),
10078
+ days: a / (1e3 * 60 * 60 * 24),
10079
+ months: a / (1e3 * 60 * 60 * 24 * 30.436875),
10080
+ years: a / (1e3 * 60 * 60 * 24 * 365.2425)
10081
+ },
10082
+ calendar: {
10083
+ months: _,
10084
+ years: v
10085
+ },
10086
+ isFuture: i > 0,
10087
+ isPast: i < 0,
10088
+ isSameMoment: i === 0
10214
10089
  };
10215
- for (let [e, t] of S(ae, r?.incompatible)) if (d.has(e)) for (let n of x(t)) d.has(n) && C(e, n);
10216
- for (let e of a) {
10217
- let t = b(u[e]);
10218
- for (let n of t) {
10219
- let t = p.get(n) ?? [];
10220
- t.includes(e) || p.set(n, [...t, e]);
10090
+ }
10091
+ probability(t) {
10092
+ let n = Object.values(t).reduce((e, t) => e + t, 0), r = new e().typedEntries(t).sort((e, t) => t[1] - e[1]), i = Math.random() * n, a = 0;
10093
+ for (let [e, t] of r) if (a += t, i < a) return e;
10094
+ }
10095
+ async findSubscriptionTier({ userId: e, name: t, broadcasterId: n }, r, i = !1) {
10096
+ let a = (e) => e === "prime" || e === "1000" || e === 1e3 || e === 1 || e === "1" ? 1 : e === "2000" || e === 2e3 || e === 2 || e === "2" ? 2 : e === "3000" || e === 3e3 || e === 3 || e === "3" ? 3 : 1;
10097
+ if (e?.includes("fake_user_")) {
10098
+ let t = z.find((t) => e.endsWith(`+${t.id}`));
10099
+ if (t) {
10100
+ let n = t.getById(e);
10101
+ if (n) return a(n.tier);
10221
10102
  }
10222
10103
  }
10223
- for (let [e, t] of Object.entries(u)) d.has(e) || b(t).length && this.emit("warn", /* @__PURE__ */ Error(`Fixed badge "${e}" is not available in the current badge pool`));
10224
- let k = /* @__PURE__ */ new Map();
10225
- s > 3 && this.emit("warn", /* @__PURE__ */ Error("minimumBadgesPerUser exceeds the maximum of 3 and was clamped"));
10226
- for (let e of i) {
10227
- let t = p.get(e) ?? [], n = [];
10228
- for (let r of t) {
10229
- if (n.length >= 3) {
10230
- this.emit("warn", /* @__PURE__ */ Error(`User "${e}" has more than 3 fixed badges; extra badges were ignored`));
10231
- break;
10232
- }
10233
- if (!T(r, n)) {
10234
- this.emit("warn", /* @__PURE__ */ Error(`Fixed badge "${r}" for user "${e}" conflicts with another fixed badge and was ignored`));
10235
- continue;
10236
- }
10237
- n.push(r);
10238
- }
10239
- k.set(e, n);
10240
- for (let e of n) m.set(e, (m.get(e) ?? 0) + 1);
10241
- }
10242
- for (let e of i) {
10243
- let n = [], r = k.get(e) ?? [];
10244
- for (let t of r) {
10245
- if (y(t), !D(t, n)) {
10246
- this.emit("warn", /* @__PURE__ */ Error(`Fixed badge "${t}" for user "${e}" could not be assigned because its limit was reached`));
10247
- continue;
10248
- }
10249
- n.push(t), v(t);
10250
- }
10251
- for (; n.length < c;) {
10252
- let e = O(n);
10253
- if (!e) break;
10254
- n.push(e), v(e);
10255
- }
10256
- if (!n.length) {
10257
- this.emit("warn", /* @__PURE__ */ Error("Not enough badges to assign to users"));
10258
- continue;
10259
- }
10260
- n.length < c && this.emit("warn", /* @__PURE__ */ Error(`User "${e}" could only receive ${n.length} badge(s), below the configured minimum of ${c}`));
10261
- let i = o.length + 1, a = n.some((e) => ["subscriber"].includes(String(e).toLocaleLowerCase())), s = new ie(`fake_user_${i.toString().padStart(2, "0")}_${Math.random().toString(36).slice(2, 8)}+${this.id}`, e, n, a, a ? t.getRandomSubTier() : void 0);
10262
- o.push(s);
10263
- }
10264
- 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;
10265
- }
10266
- pick() {
10267
- return this.users.length ? new T().array(this.users)[0] : null;
10268
- }
10269
- getByName(e) {
10270
- let n = t.fixUser(e);
10271
- return this.byName.get(n) ?? null;
10272
- }
10273
- getById(e) {
10274
- return this.byId.get(e) ?? null;
10275
- }
10276
- getByBadge(e) {
10277
- return this.byBadge.get(e) ?? [];
10278
- }
10279
- getToReply(e, t) {
10280
- let n = null;
10281
- return e?.id && (n = this.getById(e.id)), !n && e?.name && (n = this.getByName(e.name)), n ? {
10282
- msgId: `fake_msg_${Math.random().toString(36).slice(2, 10)}`,
10283
- userId: n.id,
10284
- userLogin: n.login,
10285
- displayName: n.name,
10286
- msgBody: `This is a fake reply from ${n.name}`,
10287
- ...t
10288
- } : null;
10289
- }
10290
- buildTwitchMessage(e = w.twitch_messages) {
10291
- let t = this.pick();
10292
- if (!t) {
10293
- this.emit("warn", /* @__PURE__ */ Error("No users available to build a Twitch message"));
10294
- return;
10295
- }
10296
- return {
10297
- userId: t.id,
10298
- name: t.name,
10299
- badges: t.badges,
10300
- message: new T().array(e)[0]
10301
- };
10302
- }
10303
- buildYouTubeMessage(e = w.youtube_messages) {
10304
- let t = this.pick();
10305
- if (!t) {
10306
- this.emit("warn", /* @__PURE__ */ Error("No users available to build a YouTube message"));
10307
- return;
10308
- }
10309
- return {
10310
- userId: t.id,
10311
- name: t.name,
10312
- badges: t.badges,
10313
- message: new T().array(e)[0]
10314
- };
10315
- }
10316
- }, F = class e {
10317
- delay(e, t) {
10318
- return new Promise((n) => setTimeout(() => {
10319
- n(t ? t() ?? null : null);
10320
- }, e));
10321
- }
10322
- typedEntries(e) {
10323
- return Object.entries(e);
10324
- }
10325
- typedValues(e) {
10326
- return Object.values(e);
10327
- }
10328
- typedKeys(e) {
10329
- return Object.keys(e);
10330
- }
10331
- compareDates(e, t) {
10332
- let n = e instanceof Date ? new Date(e.getTime()) : new Date(e), r = t instanceof Date ? new Date(t.getTime()) : new Date(t);
10333
- if (Number.isNaN(n.getTime()) || Number.isNaN(r.getTime())) throw Error("Invalid date provided to compareDates");
10334
- let i = r.getTime() - n.getTime(), a = Math.abs(i), o = i / 1e3, s = i / (1e3 * 60), c = i / (1e3 * 60 * 60), l = i / (1e3 * 60 * 60 * 24), u = l / 30.436875, d = l / 365.2425, f = n <= r ? n : r, p = n <= r ? r : n, m = (p.getFullYear() - f.getFullYear()) * 12 + (p.getMonth() - f.getMonth()), h = new Date(f);
10335
- h.setMonth(h.getMonth() + m), h > p && --m;
10336
- let g = i < 0 ? -1 : 1, _ = m * g, v = m / 12 * g;
10337
- return {
10338
- milliseconds: i,
10339
- seconds: o,
10340
- minutes: s,
10341
- hours: c,
10342
- days: l,
10343
- months: u,
10344
- years: d,
10345
- absolute: {
10346
- milliseconds: a,
10347
- seconds: a / 1e3,
10348
- minutes: a / (1e3 * 60),
10349
- hours: a / (1e3 * 60 * 60),
10350
- days: a / (1e3 * 60 * 60 * 24),
10351
- months: a / (1e3 * 60 * 60 * 24 * 30.436875),
10352
- years: a / (1e3 * 60 * 60 * 24 * 365.2425)
10353
- },
10354
- calendar: {
10355
- months: _,
10356
- years: v
10357
- },
10358
- isFuture: i > 0,
10359
- isPast: i < 0,
10360
- isSameMoment: i === 0
10361
- };
10362
- }
10363
- probability(t) {
10364
- let n = Object.values(t).reduce((e, t) => e + t, 0), r = new e().typedEntries(t).sort((e, t) => t[1] - e[1]), i = Math.random() * n, a = 0;
10365
- for (let [e, t] of r) if (a += t, i < a) return e;
10366
- }
10367
- async findSubscriptionTier({ userId: e, name: t, broadcasterId: n }, r, i = !1) {
10368
- let a = (e) => e === "prime" || e === "1000" || e === 1e3 || e === 1 || e === "1" ? 1 : e === "2000" || e === 2e3 || e === 2 || e === "2" ? 2 : e === "3000" || e === 3e3 || e === 3 || e === "3" ? 3 : 1;
10369
- if (e?.includes("fake_user_")) {
10370
- let t = N.find((t) => e.endsWith(`+${t.id}`));
10371
- if (t) {
10372
- let n = t.getById(e);
10373
- if (n) return a(n.tier);
10374
- }
10375
- }
10376
- let o = r["subscriber-recent"];
10377
- if (o) {
10378
- let e = o.find((e) => e.name === t);
10379
- if (e) return a(e.tier);
10104
+ let o = r["subscriber-recent"];
10105
+ if (o) {
10106
+ let e = o.find((e) => e.name === t);
10107
+ if (e) return a(e.tier);
10380
10108
  }
10381
10109
  let s = r["subscriber-latest"];
10382
10110
  if (s.name === t) return a(s.tier);
@@ -10480,7 +10208,7 @@ var M = class {
10480
10208
  let r = /<img[^>]*class="emote"[^>]*>/gi;
10481
10209
  switch (e) {
10482
10210
  case "twitch": {
10483
- let e = t.event, i = new E().replaceEmotesWithHTML(t.event.data.text, t.event.data.emotes), a = i.replaceAll(r, "").trim() === "", o = (i.match(r) || []).length;
10211
+ let e = t.event, i = new w().replaceEmotesWithHTML(t.event.data.text, t.event.data.emotes), a = i.replaceAll(r, "").trim() === "", o = (i.match(r) || []).length;
10484
10212
  i = i.replace(r, (e) => {
10485
10213
  let t = e.match(/src="([^"]*)"/), r = e.match(/alt="([^"]*)"/), i = t ? t[1] : "", a = r ? r[1] : "";
10486
10214
  return n?.mapEmote ? n.mapEmote({
@@ -10509,7 +10237,7 @@ var M = class {
10509
10237
  }
10510
10238
  }
10511
10239
  }
10512
- }, oe = class {
10240
+ }, re = class {
10513
10241
  lerp(e, t, n) {
10514
10242
  let r = Math.max(0, Math.min(1, n));
10515
10243
  return e + (t - e) * r;
@@ -10605,30 +10333,32 @@ var M = class {
10605
10333
  y: r
10606
10334
  };
10607
10335
  }
10608
- }, I;
10336
+ }, B;
10609
10337
  (function(e) {
10610
- e.animate = new oe(), e.number = new i(), e.element = new a(), e.object = new o(), e.message = new E(), e.event = new D(), e.string = new te(), e.sound = new ne(), e.color = new M(), e.random = new T(), e.fn = new re(), e.utils = new F();
10611
- })(I ||= {});
10338
+ e.animate = new re(), e.number = new n(), e.element = new r(), e.object = new i(), e.message = new w(), e.event = new T(), e.string = new M(), e.sound = new N(), e.color = new j(), e.random = new C(), e.fn = new ee(), e.utils = new ne();
10339
+ })(B ||= {});
10612
10340
  //#endregion
10613
10341
  //#region src/actions/button.ts
10614
- var L = [], R = class e {
10342
+ var ie = class e {
10615
10343
  constructor(e) {
10616
- this.field = "button", this.template = "button", this.name = "Button", this.value = "", this.field = e.field ?? this.field, this.template = e.template ?? (typeof this.field == "string" ? this.field : this.template), this.name = e.name ?? this.name, this.value = e.value ?? this.value, this.run = e.run, L.push(this), window?.client instanceof r && (window?.client?.actions.buttons.push(this), window?.client?.emit("action", this, "created"));
10344
+ this.field = "button", this.template = "button", this.name = "Button", this.value = "", this.field = e.field ?? this.field, this.template = e.template ?? (typeof this.field == "string" ? this.field : this.template), this.name = e.name ?? this.name, this.value = e.value ?? this.value, this.run = e.run, R.push(this), P.length && P.forEach((e) => {
10345
+ e.actions.buttons.push(this), e.emit("action", this, "created");
10346
+ });
10617
10347
  }
10618
10348
  generate(e) {
10619
- return I.utils.typedValues(e).reduce((e, t, n) => {
10620
- let r = I.string.compose(this.template, {
10349
+ return B.utils.typedValues(e).reduce((e, t, n) => {
10350
+ let r = B.string.compose(this.template, {
10621
10351
  index: n,
10622
10352
  ...t
10623
10353
  }, { html: !1 });
10624
10354
  e[r] = {
10625
10355
  type: "button",
10626
- label: I.string.compose(this.name, {
10356
+ label: B.string.compose(this.name, {
10627
10357
  index: n,
10628
10358
  ...t
10629
10359
  }, { html: !1 })
10630
10360
  };
10631
- let i = I.string.compose(String(this.value), {
10361
+ let i = B.string.compose(String(this.value), {
10632
10362
  index: n,
10633
10363
  ...t
10634
10364
  }, { html: !1 });
@@ -10638,25 +10368,27 @@ var L = [], R = class e {
10638
10368
  parse(e, t) {
10639
10369
  var n = e.replace(typeof this.field == "string" ? this.field : this.template.replace(/\{[^}]*\}/g, "") ?? "", "").trim();
10640
10370
  try {
10641
- this.run.apply(window?.client || void 0, [n.length ? n : e ?? e, t]);
10371
+ this.run.apply(P[0] || void 0, [n.length ? n : e ?? e, t]);
10642
10372
  } catch (e) {
10643
10373
  throw Error(`Error running button "${this.field}": ${e instanceof Error ? e.message : e}`);
10644
10374
  }
10645
10375
  return this;
10646
10376
  }
10647
10377
  remove() {
10648
- let e = L.indexOf(this);
10649
- if (e > -1 && L.splice(e, 1), !(window?.client instanceof r)) return;
10650
- let t = window?.client.actions.buttons.indexOf(this);
10651
- t > -1 && (window?.client?.actions.buttons.splice(t, 1), window?.client?.emit("action", this, "removed"));
10378
+ let e = R.indexOf(this);
10379
+ if (e > -1 && R.splice(e, 1), !P.length) return;
10380
+ let t = P[0]?.actions.buttons.indexOf(this);
10381
+ t > -1 && (P[0]?.actions.buttons.splice(t, 1), P[0]?.emit("action", this, "removed"));
10652
10382
  }
10653
10383
  static execute(t, n) {
10654
10384
  try {
10655
- if (L.length) {
10656
- let r = L.filter((e) => typeof e.field == "string" ? e.field === t : typeof e.field == "function" ? e.field(t, n) : !1);
10385
+ if (R.length) {
10386
+ let r = R.filter((e) => typeof e.field == "string" ? e.field === t : typeof e.field == "function" ? e.field(t, n) : !1);
10657
10387
  if (r.length && r.every((t) => t instanceof e)) return r.forEach((e) => {
10658
10388
  try {
10659
- e.parse(t, n), window?.client?.emit("action", e, "executed"), Q.received(`Button executed: ${t}${n ? ` with value: ${n}` : ""}`);
10389
+ e.parse(t, n), P.forEach((t) => {
10390
+ t.emit("action", e, "executed");
10391
+ }), Q.received(`Button executed: ${t}${n ? ` with value: ${n}` : ""}`);
10660
10392
  } catch (e) {
10661
10393
  Q.error(`Error executing button "${t}": ${e instanceof Error ? e.message : e}`);
10662
10394
  }
@@ -10668,9 +10400,11 @@ var L = [], R = class e {
10668
10400
  return !1;
10669
10401
  }
10670
10402
  }
10671
- }, z = [], B = class e {
10403
+ }, V = class e {
10672
10404
  constructor(e) {
10673
- this.prefix = "!", this.arguments = !1, this.test = `${this.prefix}${this.name} arg1 arg2`, this.aliases = [], this.permissions = void 0, this.admins = [], this.prefix = e.prefix ?? this.prefix, this.name = e.name, this.description = e.description ?? this.description, this.arguments = e.arguments ?? this.arguments, this.run = e.run, this.test = e.test ?? this.test, this.aliases = e.aliases ?? this.aliases, this.permissions = e.permissions ?? this.permissions, this.admins = e.admins ?? this.admins, z.push(this), window?.client instanceof r && (window?.client?.actions.commands.push(this), window?.client?.emit("action", this, "created"));
10405
+ this.prefix = "!", this.arguments = !1, this.test = `${this.prefix}${this.name} arg1 arg2`, this.aliases = [], this.permissions = void 0, this.admins = [], this.prefix = e.prefix ?? this.prefix, this.name = e.name, this.description = e.description ?? this.description, this.arguments = e.arguments ?? this.arguments, this.run = e.run, this.test = e.test ?? this.test, this.aliases = e.aliases ?? this.aliases, this.permissions = e.permissions ?? this.permissions, this.admins = e.admins ?? this.admins, L.push(this), P.length && P.forEach((e) => {
10406
+ e.actions.commands.push(this), e.emit("action", this, "created");
10407
+ });
10674
10408
  }
10675
10409
  run(e, t) {}
10676
10410
  verify(e, t, n) {
@@ -10702,24 +10436,26 @@ var L = [], R = class e {
10702
10436
  case "kick": return !1;
10703
10437
  }
10704
10438
  let o = this.verify(r, i, n);
10705
- return o === !0 && this.run.apply(window?.client || void 0, [n, t]), o;
10439
+ return o === !0 && this.run.apply(P[0] || void 0, [n, t]), o;
10706
10440
  }
10707
10441
  remove() {
10708
- let e = z.indexOf(this);
10709
- if (e > -1 && z.splice(e, 1), !(window?.client instanceof r)) return;
10710
- let t = window?.client?.actions.commands.indexOf(this);
10711
- t > -1 && (window?.client?.actions.commands.splice(t, 1), window?.client?.emit("action", this, "removed"));
10442
+ let e = L.indexOf(this);
10443
+ if (e > -1 && L.splice(e, 1), !P.length) return;
10444
+ let t = P[0]?.actions.commands.indexOf(this);
10445
+ t > -1 && (P[0]?.actions.commands.splice(t, 1), P[0]?.emit("action", this, "removed"));
10712
10446
  }
10713
10447
  static execute(t) {
10714
10448
  let n = t.data;
10715
10449
  try {
10716
- if (z.length && z.some((e) => n.event.data.text.startsWith(e.prefix))) {
10717
- let r = z.filter((e) => {
10450
+ if (L.length && L.some((e) => n.event.data.text.startsWith(e.prefix))) {
10451
+ let r = L.filter((e) => {
10718
10452
  var t = [e.name, ...e.aliases ?? []], r = n.event.data.text.replace(e.prefix, "").split(" ")[0];
10719
10453
  return t.includes(r);
10720
10454
  });
10721
10455
  if (r.length && r.every((t) => t instanceof e)) return r.forEach((e) => {
10722
- e.parse(n.event.data.text, t), window?.client?.emit("action", e, "executed"), Q.received(`Command executed: ${n.event.data.text} by ${n.event.data.nick || n.event.data.displayName}`, n);
10456
+ e.parse(n.event.data.text, t), P.forEach((t) => {
10457
+ t.emit("action", e, "executed");
10458
+ }), Q.received(`Command executed: ${n.event.data.text} by ${n.event.data.nick || n.event.data.displayName}`, n);
10723
10459
  }), !0;
10724
10460
  }
10725
10461
  } catch {
@@ -10728,42 +10464,10 @@ var L = [], R = class e {
10728
10464
  return !1;
10729
10465
  }
10730
10466
  }
10731
- }, V = [], se = class extends e {
10732
- constructor(e = {}) {
10733
- 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, V.push(this), Z?.then(async (e) => {
10734
- this.loaded = !0, this.SE_API = e, Promise.all([async () => {
10735
- let t = await e.store.get(this.id);
10736
- t && (this.history = t.slice(-10));
10737
- }, async () => {
10738
- let t = await e.store.get(this.id + "_detected");
10739
- t && (this.detected = new Set(t));
10740
- }]);
10741
- });
10742
- }
10743
- async send(e, t) {
10744
- if (this.SE_API) {
10745
- let n = {
10746
- nonce: Math.random().toString(36).substring(2),
10747
- key: e,
10748
- value: t,
10749
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
10750
- };
10751
- this.history.push(n), this.SE_API.store.set(this.id, this.history), this.SE_API.store.set(this.id + "_detected", Array.from(this.detected));
10752
- }
10753
- }
10754
- update(e) {
10755
- e.length && (this.history = e, e.filter((e) => !this.detected.has(e.nonce)).forEach((e) => {
10756
- this.detected.add(e.nonce), this.emit("message", e.key, e.value);
10757
- }));
10758
- }
10759
- on(e, t) {
10760
- return e === "load" && this.loaded ? (t.apply(this), this) : (super.on(e, t), this);
10761
- }
10762
10467
  };
10763
10468
  window.addEventListener("onWidgetLoad", async (e) => {
10764
10469
  let { detail: t } = e;
10765
- if (window.client instanceof r && client instanceof r && client) {
10766
- let n = window.client;
10470
+ P.length && P.forEach(async (n) => {
10767
10471
  if (n.fields = t.fieldData, n.session = t.session.data, n.details = {
10768
10472
  ...n.details,
10769
10473
  user: t.channel,
@@ -10802,19 +10506,18 @@ window.addEventListener("onWidgetLoad", async (e) => {
10802
10506
  expire: Date.now() + n.cache.avatar * 60 * 1e3
10803
10507
  });
10804
10508
  });
10805
- }
10509
+ });
10806
10510
  }), window.addEventListener("onSessionUpdate", (e) => {
10807
10511
  let { detail: t } = e;
10808
- if (window.client instanceof r && client instanceof r && client) {
10809
- let e = window.client;
10512
+ P.length && P.forEach((e) => {
10810
10513
  e.session = t.session, e.emit("session", t.session), e.debug && Q.debug("[Client]", "Session updated", t.session);
10811
- }
10514
+ });
10812
10515
  }), window.addEventListener("onEventReceived", ({ detail: e }) => {
10813
- if (window.client instanceof r && client instanceof r && client) {
10814
- let r = I.event.parseProvider(e);
10815
- switch (r.provider) {
10516
+ P.length && P.forEach((t) => {
10517
+ let n = B.event.parseProvider(e);
10518
+ switch (n.provider) {
10816
10519
  case "streamelements": {
10817
- let e = r.data;
10520
+ let e = n.data;
10818
10521
  switch (e.listener) {
10819
10522
  case "tip-latest":
10820
10523
  e.event;
@@ -10826,7 +10529,7 @@ window.addEventListener("onWidgetLoad", async (e) => {
10826
10529
  switch (e.event.listener) {
10827
10530
  case "widget-button": {
10828
10531
  let t = e.event;
10829
- R.execute(t.field, t.value);
10532
+ ie.execute(t.field, t.value);
10830
10533
  break;
10831
10534
  }
10832
10535
  case "subscriber-latest":
@@ -10835,14 +10538,14 @@ window.addEventListener("onWidgetLoad", async (e) => {
10835
10538
  }
10836
10539
  break;
10837
10540
  case "kvstore:update": {
10838
- let r = e.event;
10839
- if (t.length) {
10840
- var n = t.find((e) => e.id === r.data.key.replace("customWidget.", "") || e.id === r.data.key);
10841
- n && n.update(r.data.value);
10541
+ let t = e.event;
10542
+ if (F.length) {
10543
+ var r = F.find((e) => e.id === t.data.key.replace("customWidget.", "") || e.id === t.data.key);
10544
+ r && r.update(t.data.value);
10842
10545
  }
10843
- if (V.length) {
10844
- let e = V.find((e) => e.id === r.data.key.replace("customWidget.", "") || e.id === r.data.key);
10845
- e && e.update(r.data.value);
10546
+ if (I.length) {
10547
+ let e = I.find((e) => e.id === t.data.key.replace("customWidget.", "") || e.id === t.data.key);
10548
+ e && e.update(t.data.value);
10846
10549
  }
10847
10550
  break;
10848
10551
  }
@@ -10850,16 +10553,16 @@ window.addEventListener("onWidgetLoad", async (e) => {
10850
10553
  e.event;
10851
10554
  break;
10852
10555
  case "alertService:toggleSound": {
10853
- let t = e.event;
10854
- client.details.overlay.muted = !!t.muted;
10556
+ let n = e.event;
10557
+ t.details.overlay.muted = !!n.muted;
10855
10558
  break;
10856
10559
  }
10857
10560
  }
10858
- window.client.emit("event", "streamelements", r.data);
10561
+ t.emit("event", "streamelements", n.data);
10859
10562
  break;
10860
10563
  }
10861
10564
  case "twitch": {
10862
- let e = r.data;
10565
+ let e = n.data;
10863
10566
  switch (e.listener) {
10864
10567
  case "delete-message":
10865
10568
  e.event;
@@ -10868,7 +10571,7 @@ window.addEventListener("onWidgetLoad", async (e) => {
10868
10571
  e.event;
10869
10572
  break;
10870
10573
  case "message":
10871
- e.event, B.execute({
10574
+ e.event, V.execute({
10872
10575
  provider: "twitch",
10873
10576
  data: e
10874
10577
  });
@@ -10886,14 +10589,14 @@ window.addEventListener("onWidgetLoad", async (e) => {
10886
10589
  e.event;
10887
10590
  break;
10888
10591
  }
10889
- window.client.emit("event", "twitch", r.data);
10592
+ t.emit("event", "twitch", n.data);
10890
10593
  break;
10891
10594
  }
10892
10595
  case "youtube": {
10893
- let e = r.data;
10596
+ let e = n.data;
10894
10597
  switch (e.listener) {
10895
10598
  case "message":
10896
- e.event, B.execute({
10599
+ e.event, V.execute({
10897
10600
  provider: "youtube",
10898
10601
  data: e
10899
10602
  });
@@ -10908,29 +10611,131 @@ window.addEventListener("onWidgetLoad", async (e) => {
10908
10611
  e.event;
10909
10612
  break;
10910
10613
  }
10911
- window.client.emit("event", "youtube", r.data);
10614
+ t.emit("event", "youtube", n.data);
10912
10615
  break;
10913
10616
  }
10914
10617
  case "kick":
10915
- r.data, window.client.emit("event", "kick", r.data);
10618
+ n.data, t.emit("event", "kick", n.data);
10916
10619
  break;
10917
10620
  case "facebook":
10918
- r.data, window.client.emit("event", "facebook", r.data);
10621
+ n.data, t.emit("event", "facebook", n.data);
10919
10622
  break;
10920
10623
  }
10921
- client.debug && ![
10624
+ t.debug && ![
10922
10625
  "bot:counter",
10923
10626
  "alertService:toggleSound",
10924
10627
  "event",
10925
10628
  "event:skip",
10926
10629
  "event:test",
10927
10630
  "kvstore:update"
10928
- ].some((e) => e === r.data.listener) && Q.received("[Client]", `Event ${r.data.listener} received from ${r.provider}`, r.data.event);
10929
- }
10631
+ ].some((e) => e === n.data.listener) && Q.received("[Client]", `Event ${n.data.listener} received from ${n.provider}`, n.data.event);
10632
+ });
10930
10633
  });
10931
10634
  //#endregion
10635
+ //#region src/modules/EventProvider.ts
10636
+ var H = class {
10637
+ constructor() {
10638
+ this.registeredEvents = {};
10639
+ }
10640
+ emit(e, ...t) {
10641
+ return (this.registeredEvents[e] || []).map((e) => e.apply(this, t));
10642
+ }
10643
+ on(e, t) {
10644
+ if (typeof t != "function") throw TypeError("Callback must be a function");
10645
+ return this.registeredEvents[e] || (this.registeredEvents[e] = []), this.registeredEvents[e].push(t), this;
10646
+ }
10647
+ off(e, t) {
10648
+ let n = this.registeredEvents[e] || [];
10649
+ return t ? (this.registeredEvents[e] = n.filter((e) => e !== t), this) : (this.registeredEvents[e] = [], this);
10650
+ }
10651
+ once(e, t) {
10652
+ let n = (...r) => {
10653
+ this.off(e, n), t.apply(this, r);
10654
+ };
10655
+ return this.on(e, n), this;
10656
+ }
10657
+ removeAllListeners(e) {
10658
+ return this.registeredEvents[e] = [], this;
10659
+ }
10660
+ }, U = class e extends H {
10661
+ constructor(e) {
10662
+ super(), this.SE_API = null, this.id = "default", this.loaded = !1, this.id = e.id || this.id, this.data = e.data ?? {}, F.push(this), Z?.then((e) => {
10663
+ this.SE_API = e, e.store.get(this.id).then((e) => {
10664
+ 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);
10665
+ }).catch(() => {
10666
+ this.loaded = !0, this.emit("load", this.data);
10667
+ });
10668
+ });
10669
+ }
10670
+ save(e = this.data) {
10671
+ this.loaded && this.SE_API && JSON.stringify(this.data) !== JSON.stringify(e) && (this.data = e, this.SE_API.store.set(this.id, this.data), this.emit("update", this.data));
10672
+ }
10673
+ update(e = this.data) {
10674
+ if (this.loaded && JSON.stringify(this.data) !== JSON.stringify(e)) {
10675
+ let t = {
10676
+ ...this.data,
10677
+ ...e
10678
+ };
10679
+ this.save(t);
10680
+ }
10681
+ }
10682
+ add(t, n) {
10683
+ this.loaded && (e.setByPath(this.data, t, n), this.save(this.data));
10684
+ }
10685
+ clear() {
10686
+ this.loaded && (this.data = {}, this.save(this.data));
10687
+ }
10688
+ static setByPath(e, t, n) {
10689
+ let r = t.split("."), i = e;
10690
+ 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]];
10691
+ return i[r[r.length - 1]] = n, i;
10692
+ }
10693
+ on(e, t) {
10694
+ return e === "load" && this.loaded ? (t.apply(this, [this.data]), this) : (super.on(e, t), this);
10695
+ }
10696
+ }, ae = class extends H {
10697
+ constructor(e) {
10698
+ super(), this.id = "default", this.debug = !1, this.fields = {}, this.loaded = !1, this.actions = {
10699
+ commands: [],
10700
+ buttons: []
10701
+ }, this.cache = {
10702
+ avatar: 30,
10703
+ pronoun: 60,
10704
+ emote: 120
10705
+ }, this.id = e.id || this.id, this.storage = new U({
10706
+ id: this.id,
10707
+ data: {
10708
+ user: {},
10709
+ avatar: {},
10710
+ pronoun: {},
10711
+ emote: {}
10712
+ }
10713
+ }), this.on("load", () => {
10714
+ this.debug = !!(typeof e.debug == "function" ? e.debug() : e.debug);
10715
+ }), P.push(this);
10716
+ }
10717
+ on(e, t) {
10718
+ return e === "load" && this.loaded ? (t.apply(this, [{
10719
+ channel: this.details.user,
10720
+ currency: this.details.currency,
10721
+ fieldData: this.fields,
10722
+ recents: [],
10723
+ session: {
10724
+ data: this.session,
10725
+ settings: {
10726
+ autoReset: !1,
10727
+ calendar: !1,
10728
+ resetOnStart: !1
10729
+ }
10730
+ },
10731
+ overlay: this.details.overlay,
10732
+ emulated: !1
10733
+ }]), this) : (super.on(e, t), this);
10734
+ }
10735
+ };
10736
+ //#endregion
10932
10737
  //#region src/local/generator.ts
10933
- async function ce(e, t, n = "USD") {
10738
+ async function oe(e, t, n = "USD") {
10934
10739
  let r = {
10935
10740
  BRL: {
10936
10741
  code: "BRL",
@@ -10974,8 +10779,8 @@ async function ce(e, t, n = "USD") {
10974
10779
  emulated: !0
10975
10780
  };
10976
10781
  }
10977
- async function le(e, t) {
10978
- if (e ??= await U.session.get(), t) {
10782
+ async function se(e, t) {
10783
+ if (e ??= await G.session.get(), t) {
10979
10784
  let n = (e, t) => new Date(t.createdAt).getTime() - new Date(e.createdAt).getTime();
10980
10785
  switch (t.provider) {
10981
10786
  case "twitch": {
@@ -11073,7 +10878,7 @@ async function le(e, t) {
11073
10878
  name: t.toLowerCase(),
11074
10879
  displayName: t,
11075
10880
  amount: r,
11076
- _id: I.random.uuid(),
10881
+ _id: new C().uuid(),
11077
10882
  sessionTop: !1,
11078
10883
  type: "superchat",
11079
10884
  originalEventName: "superchat-latest",
@@ -11094,7 +10899,7 @@ async function le(e, t) {
11094
10899
  name: t.toLowerCase(),
11095
10900
  displayName: t,
11096
10901
  amount: r,
11097
- _id: I.random.uuid(),
10902
+ _id: new C().uuid(),
11098
10903
  sessionTop: !1,
11099
10904
  type: "superchat",
11100
10905
  originalEventName: "superchat-latest",
@@ -11143,7 +10948,7 @@ async function le(e, t) {
11143
10948
  emulated: !0
11144
10949
  };
11145
10950
  }
11146
- async function H(e = "random", t = "random", n = {}) {
10951
+ async function W(e = "random", t = "random", n = {}) {
11147
10952
  let r = {
11148
10953
  twitch: [
11149
10954
  "message",
@@ -11165,16 +10970,16 @@ async function H(e = "random", t = "random", n = {}) {
11165
10970
  switch (e) {
11166
10971
  default:
11167
10972
  case "random":
11168
- var i = I.random.array(Object.keys(r).filter((e) => r[e].length))[0], a = I.random.array(r[i])[0];
11169
- return H(i, a);
10973
+ var i = new C().array(Object.keys(r).filter((e) => r[e].length))[0], a = new C().array(r[i])[0];
10974
+ return W(i, a);
11170
10975
  case "twitch": switch (t) {
11171
10976
  default:
11172
10977
  case "random":
11173
- var a = I.random.array(r[e])[0];
11174
- return H(e, a);
10978
+ var a = new C().array(r[e])[0];
10979
+ return W(e, a);
11175
10980
  case "message": {
11176
10981
  let t = n;
11177
- var o = t?.name ?? I.random.array(w.names.filter((e) => e.length))[0], s = t?.message ?? I.random.array([...w.twitch_messages, ...w.normal_messages].filter((e) => e.length))[0], c = await I.message.generateBadges(t?.badges ?? [], e), l = I.message.findEmotesInText(s), u = I.message.replaceEmotesWithHTML(s, l), d = t?.color ?? I.random.color("hex"), f = t?.userId ?? I.random.string(16), p = t?.msgId ?? I.random.string(16), m = t?.time ?? Date.now(), h = t?.channel ?? window?.client?.details?.user?.username ?? "local", g = t?.reply ? {
10982
+ 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 ? {
11178
10983
  "reply-parent-display-name": t.reply.name,
11179
10984
  "reply-parent-msg-body": t.reply.text,
11180
10985
  "reply-parent-msg-id": t.reply.msgId,
@@ -11196,17 +11001,17 @@ async function H(e = "random", t = "random", n = {}) {
11196
11001
  data: {
11197
11002
  time: m,
11198
11003
  tags: {
11199
- "badge-info": `${c.keys.map((e) => `${e}/${c.amount[e] ?? I.random.number(1, 5)}`).join(",")}`,
11004
+ "badge-info": `${c.keys.map((e) => `${e}/${c.amount[e] ?? new C().number(1, 5)}`).join(",")}`,
11200
11005
  badges: c.keys.map((e) => `${e}/1`).join(","),
11201
11006
  ...v,
11202
11007
  "tmi-sent-ts": m.toString(),
11203
- "room-id": I.random.string(9, "numbers"),
11008
+ "room-id": new C().string(9, "numbers"),
11204
11009
  "user-id": f,
11205
11010
  "user-type": "",
11206
11011
  color: d,
11207
11012
  "display-name": o,
11208
11013
  emotes: "",
11209
- "client-nonce": I.random.string(16),
11014
+ "client-nonce": new C().string(16),
11210
11015
  flags: "",
11211
11016
  id: p,
11212
11017
  "first-msg": t?.firstMsg ? "1" : "0",
@@ -11232,7 +11037,7 @@ async function H(e = "random", t = "random", n = {}) {
11232
11037
  }
11233
11038
  case "cheer":
11234
11039
  case "cheer-latest":
11235
- var y = n?.amount ?? I.random.number(100, 1e4), b = n?.avatar ?? I.random.array(w.avatars)[0], o = n?.name ?? I.random.array(w.names.filter((e) => e.length))[0], s = n?.message ?? I.random.array(w.normal_messages.filter((e) => e.length))[0];
11040
+ var y = n?.amount ?? new C().number(100, 1e4), b = n?.avatar ?? new C().array(S.avatars)[0], o = n?.name ?? new C().array(S.names.filter((e) => e.length))[0], s = n?.message ?? new C().array(S.normal_messages.filter((e) => e.length))[0];
11236
11041
  return {
11237
11042
  listener: "cheer-latest",
11238
11043
  event: {
@@ -11242,7 +11047,7 @@ async function H(e = "random", t = "random", n = {}) {
11242
11047
  displayName: o,
11243
11048
  message: s,
11244
11049
  providerId: "",
11245
- _id: I.random.uuid(),
11050
+ _id: new C().uuid(),
11246
11051
  sessionTop: !1,
11247
11052
  type: "cheer",
11248
11053
  originalEventName: "cheer-latest",
@@ -11252,7 +11057,7 @@ async function H(e = "random", t = "random", n = {}) {
11252
11057
  };
11253
11058
  case "follower":
11254
11059
  case "follower-latest":
11255
- var b = n?.avatar ?? I.random.array(w.avatars)[0], o = n?.name ?? I.random.array(w.names.filter((e) => e.length))[0];
11060
+ var b = n?.avatar ?? new C().array(S.avatars)[0], o = n?.name ?? new C().array(S.names.filter((e) => e.length))[0];
11256
11061
  return {
11257
11062
  listener: "follower-latest",
11258
11063
  event: {
@@ -11260,7 +11065,7 @@ async function H(e = "random", t = "random", n = {}) {
11260
11065
  name: o.toLowerCase(),
11261
11066
  displayName: o,
11262
11067
  providerId: "",
11263
- _id: I.random.uuid(),
11068
+ _id: new C().uuid(),
11264
11069
  sessionTop: !1,
11265
11070
  type: "follower",
11266
11071
  originalEventName: "follower-latest",
@@ -11270,7 +11075,7 @@ async function H(e = "random", t = "random", n = {}) {
11270
11075
  };
11271
11076
  case "raid":
11272
11077
  case "raid-latest":
11273
- var y = n?.amount ?? I.random.number(1, 100), b = n?.avatar ?? I.random.array(w.avatars)[0], o = n?.name ?? I.random.array(w.names.filter((e) => e.length))[0];
11078
+ var y = n?.amount ?? new C().number(1, 100), b = n?.avatar ?? new C().array(S.avatars)[0], o = n?.name ?? new C().array(S.names.filter((e) => e.length))[0];
11274
11079
  return {
11275
11080
  listener: "raid-latest",
11276
11081
  event: {
@@ -11279,7 +11084,7 @@ async function H(e = "random", t = "random", n = {}) {
11279
11084
  name: o.toLowerCase(),
11280
11085
  displayName: o,
11281
11086
  providerId: "",
11282
- _id: I.random.uuid(),
11087
+ _id: new C().uuid(),
11283
11088
  sessionTop: !1,
11284
11089
  type: "raid",
11285
11090
  originalEventName: "raid-latest",
@@ -11289,37 +11094,37 @@ async function H(e = "random", t = "random", n = {}) {
11289
11094
  };
11290
11095
  case "subscriber":
11291
11096
  case "subscriber-latest":
11292
- var x = n?.tier ?? I.random.array([
11097
+ var x = n?.tier ?? new C().array([
11293
11098
  "1000",
11294
11099
  "2000",
11295
11100
  "3000",
11296
11101
  "prime"
11297
- ])[0], y = n?.amount ?? I.random.number(1, 24), b = n?.avatar ?? I.random.array(w.avatars)[0], o = n?.name ?? I.random.array(w.names.filter((e) => e.length))[0], S = n?.sender ?? I.random.array(w.names.filter((e) => e.length && e !== o))[0], s = n?.message ?? I.random.array(w.normal_messages.filter((e) => e.length))[0], C = {
11102
+ ])[0], y = n?.amount ?? new C().number(1, 24), b = n?.avatar ?? new C().array(S.avatars)[0], o = n?.name ?? new C().array(S.names.filter((e) => e.length))[0], T = n?.sender ?? new C().array(S.names.filter((e) => e.length && e !== o))[0], s = n?.message ?? new C().array(S.normal_messages.filter((e) => e.length))[0], E = {
11298
11103
  default: {
11299
11104
  avatar: b,
11300
11105
  playedAsCommunityGift: !1
11301
11106
  },
11302
11107
  gift: {
11303
- sender: S,
11108
+ sender: T,
11304
11109
  gifted: !0
11305
11110
  },
11306
11111
  community: {
11307
11112
  message: s,
11308
- sender: S,
11113
+ sender: T,
11309
11114
  bulkGifted: !0
11310
11115
  },
11311
11116
  spam: {
11312
- sender: S,
11117
+ sender: T,
11313
11118
  gifted: !0,
11314
11119
  isCommunityGift: !0
11315
11120
  }
11316
- }, T = [
11121
+ }, D = [
11317
11122
  "default",
11318
11123
  "gift",
11319
11124
  "community",
11320
11125
  "spam"
11321
- ], E = n?.subType ?? I.random.array(T)[0];
11322
- return E = T.includes(E) ? E : "default", {
11126
+ ], O = n?.subType ?? new C().array(D)[0];
11127
+ return O = D.includes(O) ? O : "default", {
11323
11128
  listener: "subscriber-latest",
11324
11129
  event: {
11325
11130
  amount: y,
@@ -11327,9 +11132,9 @@ async function H(e = "random", t = "random", n = {}) {
11327
11132
  displayName: o,
11328
11133
  providerId: "",
11329
11134
  tier: x,
11330
- ...C.default,
11331
- ...C[E],
11332
- _id: I.random.uuid(),
11135
+ ...E.default,
11136
+ ...E[O],
11137
+ _id: new C().uuid(),
11333
11138
  sessionTop: !1,
11334
11139
  type: "subscriber",
11335
11140
  originalEventName: "subscriber-latest",
@@ -11340,7 +11145,7 @@ async function H(e = "random", t = "random", n = {}) {
11340
11145
  case "delete-message": return {
11341
11146
  listener: "delete-message",
11342
11147
  event: {
11343
- msgId: n?.id ?? I.random.uuid(),
11148
+ msgId: n?.id ?? new C().uuid(),
11344
11149
  provider: e
11345
11150
  },
11346
11151
  emulated: !0
@@ -11348,7 +11153,7 @@ async function H(e = "random", t = "random", n = {}) {
11348
11153
  case "delete-messages": return {
11349
11154
  listener: "delete-messages",
11350
11155
  event: {
11351
- userId: n?.id ?? I.random.number(1e7, 99999999).toString(),
11156
+ userId: n?.id ?? new C().number(1e7, 99999999).toString(),
11352
11157
  provider: e
11353
11158
  },
11354
11159
  emulated: !0
@@ -11356,34 +11161,34 @@ async function H(e = "random", t = "random", n = {}) {
11356
11161
  case "event":
11357
11162
  switch (n?.type) {
11358
11163
  case "channelPointsRedemption":
11359
- var y = n?.amount ?? I.random.number(1, 100), b = n?.avatar ?? I.random.array(w.avatars)[0], o = n?.name ?? I.random.array(w.names.filter((e) => e.length))[0], s = n?.message ?? I.random.array(w.normal_messages.filter((e) => e.length))[0], D = n?.redemption ?? I.random.array([
11164
+ var y = n?.amount ?? new C().number(1, 100), b = n?.avatar ?? new C().array(S.avatars)[0], o = n?.name ?? new C().array(S.names.filter((e) => e.length))[0], s = n?.message ?? new C().array(S.normal_messages.filter((e) => e.length))[0], k = n?.redemption ?? new C().array([
11360
11165
  "Highlight Message",
11361
11166
  "Send a Shoutout",
11362
11167
  "Drink Water"
11363
- ])[0], O = n?.quantity ?? 1, k = n?.providerId ?? I.random.uuid(), A = n?.id ?? I.random.uuid(), h = n?.channel ?? n?.broadcaster ?? n?.streamer ?? window?.client?.details?.user?.username ?? "local", j = n?.activityId ?? I.random.uuid(), m = n?.time ?? Date.now();
11168
+ ])[0], A = n?.quantity ?? 1, j = n?.providerId ?? new C().uuid(), M = n?.id ?? new C().uuid(), h = n?.channel ?? n?.broadcaster ?? n?.streamer ?? P?.[0]?.details?.user?.username ?? "local", N = n?.activityId ?? new C().uuid(), m = n?.time ?? Date.now();
11364
11169
  return {
11365
11170
  listener: "event",
11366
11171
  event: {
11367
11172
  type: "channelPointsRedemption",
11368
- _id: A,
11173
+ _id: M,
11369
11174
  provider: "twitch",
11370
11175
  flagged: !1,
11371
11176
  channel: h,
11372
11177
  createdAt: new Date(m).toISOString(),
11373
11178
  expiresAt: new Date(m + 36e5).toISOString(),
11374
11179
  updatedAt: new Date(m).toISOString(),
11375
- activityId: j,
11180
+ activityId: N,
11376
11181
  sessionEventsCount: 1,
11377
11182
  isMock: !0,
11378
11183
  data: {
11379
11184
  amount: y,
11380
11185
  username: o.toLowerCase(),
11381
11186
  displayName: o,
11382
- providerId: k,
11187
+ providerId: j,
11383
11188
  avatar: b,
11384
11189
  message: s,
11385
- quantity: O,
11386
- redemption: D
11190
+ quantity: A,
11191
+ redemption: k
11387
11192
  }
11388
11193
  }
11389
11194
  };
@@ -11396,11 +11201,11 @@ async function H(e = "random", t = "random", n = {}) {
11396
11201
  case "streamelements": switch (t) {
11397
11202
  default:
11398
11203
  case "random":
11399
- var a = I.random.array(r[e])[0];
11400
- return H(e, a);
11204
+ var a = new C().array(r[e])[0];
11205
+ return W(e, a);
11401
11206
  case "tip":
11402
11207
  case "tip-latest":
11403
- var y = n?.amount ?? I.random.number(100, 4e3), b = n?.avatar ?? I.random.array(w.avatars)[0], o = n?.name ?? I.random.array(w.names.filter((e) => e.length))[0];
11208
+ 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];
11404
11209
  return {
11405
11210
  listener: "tip-latest",
11406
11211
  event: {
@@ -11409,7 +11214,7 @@ async function H(e = "random", t = "random", n = {}) {
11409
11214
  name: o.toLowerCase(),
11410
11215
  displayName: o,
11411
11216
  providerId: "",
11412
- _id: I.random.uuid(),
11217
+ _id: new C().uuid(),
11413
11218
  sessionTop: !1,
11414
11219
  type: "tip",
11415
11220
  originalEventName: "tip-latest",
@@ -11432,7 +11237,7 @@ async function H(e = "random", t = "random", n = {}) {
11432
11237
  listener: "bot:counter",
11433
11238
  event: {
11434
11239
  counter: n?.counter ?? "sampleCounter",
11435
- value: n?.value ?? I.random.number(0, 100),
11240
+ value: n?.value ?? new C().number(0, 100),
11436
11241
  provider: e
11437
11242
  },
11438
11243
  emulated: !0
@@ -11442,7 +11247,7 @@ async function H(e = "random", t = "random", n = {}) {
11442
11247
  case "alertService:toggleSound": return {
11443
11248
  listener: "alertService:toggleSound",
11444
11249
  event: {
11445
- muted: n?.muted ?? window?.client?.details?.overlay?.muted ?? !1,
11250
+ muted: n?.muted ?? P?.[0]?.details?.overlay?.muted ?? !1,
11446
11251
  provider: e
11447
11252
  },
11448
11253
  emulated: !0
@@ -11457,12 +11262,12 @@ async function H(e = "random", t = "random", n = {}) {
11457
11262
  case "youtube": switch (t) {
11458
11263
  default:
11459
11264
  case "random":
11460
- var a = I.random.array(r[e])[0];
11461
- return H(e, a);
11265
+ var a = new C().array(r[e])[0];
11266
+ return W(e, a);
11462
11267
  case "message": {
11463
- var o = n?.name ?? I.random.array(w.names.filter((e) => e.length))[0], s = n?.message ?? I.random.array([...w.youtube_messages, ...w.normal_messages].filter((e) => e.length))[0];
11464
- let t = await I.message.generateBadges(n?.badges ?? [], e);
11465
- var l = I.message.findEmotesInText(s), u = I.message.replaceEmotesWithHTML(s, l), d = n?.color ?? I.random.color("hex"), f = n?.userId ?? I.random.number(1e7, 99999999).toString(), p = n?.msgId ?? I.random.uuid(), m = n?.time ?? Date.now(), b = n?.avatar ?? I.random.array(w.avatars)[0], h = n?.channel ?? window?.client?.details?.user?.username ?? "local";
11268
+ 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];
11269
+ let t = await new w().generateBadges(n?.badges ?? [], e);
11270
+ var l = new w().findEmotesInText(s), u = new w().replaceEmotesWithHTML(s, l), d = n?.color ?? new C().color("hex"), f = n?.userId ?? new C().number(1e7, 99999999).toString(), p = n?.msgId ?? new C().uuid(), m = n?.time ?? Date.now(), b = n?.avatar ?? new C().array(S.avatars)[0], h = n?.channel ?? P?.[0]?.details?.user?.username ?? "local";
11466
11271
  return {
11467
11272
  listener: "message",
11468
11273
  event: {
@@ -11508,7 +11313,7 @@ async function H(e = "random", t = "random", n = {}) {
11508
11313
  }
11509
11314
  case "subscriber":
11510
11315
  case "subscriber-latest":
11511
- var b = n?.avatar ?? I.random.array(w.avatars)[0], o = n?.name ?? I.random.array(w.names.filter((e) => e.length))[0];
11316
+ var b = n?.avatar ?? new C().array(S.avatars)[0], o = n?.name ?? new C().array(S.names.filter((e) => e.length))[0];
11512
11317
  return {
11513
11318
  listener: "subscriber-latest",
11514
11319
  event: {
@@ -11516,7 +11321,7 @@ async function H(e = "random", t = "random", n = {}) {
11516
11321
  displayName: o,
11517
11322
  name: o.toLowerCase(),
11518
11323
  providerId: "",
11519
- _id: I.random.uuid(),
11324
+ _id: new C().uuid(),
11520
11325
  sessionTop: !1,
11521
11326
  type: "subscriber",
11522
11327
  originalEventName: "subscriber-latest",
@@ -11526,7 +11331,7 @@ async function H(e = "random", t = "random", n = {}) {
11526
11331
  };
11527
11332
  case "superchat":
11528
11333
  case "superchat-latest":
11529
- var y = n?.amount ?? I.random.number(100, 4e3), b = n?.avatar ?? I.random.array(w.avatars)[0], o = n?.name ?? I.random.array(w.names.filter((e) => e.length))[0];
11334
+ 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];
11530
11335
  return {
11531
11336
  listener: "superchat-latest",
11532
11337
  event: {
@@ -11535,7 +11340,7 @@ async function H(e = "random", t = "random", n = {}) {
11535
11340
  name: o.toLowerCase(),
11536
11341
  displayName: o,
11537
11342
  providerId: "",
11538
- _id: I.random.uuid(),
11343
+ _id: new C().uuid(),
11539
11344
  sessionTop: !1,
11540
11345
  type: "superchat",
11541
11346
  originalEventName: "superchat-latest",
@@ -11545,45 +11350,45 @@ async function H(e = "random", t = "random", n = {}) {
11545
11350
  };
11546
11351
  case "sponsor":
11547
11352
  case "sponsor-latest":
11548
- var x = n?.tier ?? I.random.array([
11353
+ var x = n?.tier ?? new C().array([
11549
11354
  "1000",
11550
11355
  "2000",
11551
11356
  "3000"
11552
- ])[0], y = n?.amount ?? I.random.number(1, 24), b = n?.avatar ?? I.random.array(w.avatars)[0], o = n?.name ?? I.random.array(w.names.filter((e) => e.length))[0], S = n?.sender ?? I.random.array(w.names.filter((e) => e.length && e !== o))[0], s = n?.message ?? I.random.array(w.normal_messages.filter((e) => e.length))[0], C = {
11357
+ ])[0], y = n?.amount ?? new C().number(1, 24), b = n?.avatar ?? new C().array(S.avatars)[0], o = n?.name ?? new C().array(S.names.filter((e) => e.length))[0], T = n?.sender ?? new C().array(S.names.filter((e) => e.length && e !== o))[0], s = n?.message ?? new C().array(S.normal_messages.filter((e) => e.length))[0], E = {
11553
11358
  default: {
11554
11359
  avatar: b,
11555
11360
  playedAsCommunityGift: !1
11556
11361
  },
11557
11362
  gift: {
11558
- sender: S,
11363
+ sender: T,
11559
11364
  gifted: !0
11560
11365
  },
11561
11366
  community: {
11562
11367
  message: s,
11563
- sender: S,
11368
+ sender: T,
11564
11369
  bulkGifted: !0
11565
11370
  },
11566
11371
  spam: {
11567
- sender: S,
11372
+ sender: T,
11568
11373
  gifted: !0,
11569
11374
  isCommunityGift: !0
11570
11375
  }
11571
- }, T = [
11376
+ }, D = [
11572
11377
  "default",
11573
11378
  "gift",
11574
11379
  "community",
11575
11380
  "spam"
11576
- ], E = n?.subType ?? I.random.array(T)[0];
11577
- return E = T.includes(E) ? E : "default", {
11381
+ ], O = n?.subType ?? new C().array(D)[0];
11382
+ return O = D.includes(O) ? O : "default", {
11578
11383
  listener: "sponsor-latest",
11579
11384
  event: {
11580
11385
  amount: y,
11581
11386
  name: o.toLowerCase(),
11582
11387
  displayName: o,
11583
11388
  providerId: "",
11584
- ...C.default,
11585
- ...C[E],
11586
- _id: I.random.uuid(),
11389
+ ...E.default,
11390
+ ...E[O],
11391
+ _id: new C().uuid(),
11587
11392
  sessionTop: !1,
11588
11393
  type: "sponsor",
11589
11394
  originalEventName: "sponsor-latest",
@@ -11594,33 +11399,33 @@ async function H(e = "random", t = "random", n = {}) {
11594
11399
  }
11595
11400
  }
11596
11401
  }
11597
- var U = new class {
11402
+ var G = new class {
11598
11403
  constructor() {
11599
11404
  this.event = {
11600
- onWidgetLoad: ce,
11601
- onSessionUpdate: le,
11602
- onEventReceived: H
11405
+ onWidgetLoad: oe,
11406
+ onSessionUpdate: se,
11407
+ onEventReceived: W
11603
11408
  }, this.session = {
11604
11409
  types: {
11605
11410
  name: {
11606
11411
  type: "string",
11607
- options: w.names.filter((e) => e.length)
11412
+ options: S.names.filter((e) => e.length)
11608
11413
  },
11609
11414
  tier: {
11610
11415
  type: "string",
11611
- options: w.tiers.filter((e) => e.length)
11416
+ options: S.tiers.filter((e) => e.length)
11612
11417
  },
11613
11418
  message: {
11614
11419
  type: "string",
11615
- options: w.normal_messages.filter((e) => e.length)
11420
+ options: S.normal_messages.filter((e) => e.length)
11616
11421
  },
11617
11422
  item: {
11618
11423
  type: "array",
11619
- options: w.items
11424
+ options: S.items
11620
11425
  },
11621
11426
  avatar: {
11622
11427
  type: "string",
11623
- options: w.avatars.filter((e) => e.length)
11428
+ options: S.avatars.filter((e) => e.length)
11624
11429
  }
11625
11430
  },
11626
11431
  available() {
@@ -12504,10 +12309,10 @@ var U = new class {
12504
12309
  return typeof e != "object" || !e ? e : "type" in e && typeof e.type == "string" ? ((e) => {
12505
12310
  if (!e) return e;
12506
12311
  switch (e.type) {
12507
- case "int": return I.random.number(e.min, e.max);
12508
- case "string": return I.random.array(e.options)[0];
12509
- case "date": return I.random.daysOffset(e.range);
12510
- case "array": return I.random.array(e.options)[0];
12312
+ case "int": return new C().number(e.min, e.max);
12313
+ case "string": return new C().array(e.options)[0];
12314
+ case "date": return new C().daysOffset(e.range);
12315
+ case "array": return new C().array(e.options)[0];
12511
12316
  case "recent": return t(e);
12512
12317
  default: return e;
12513
12318
  }
@@ -12524,18 +12329,26 @@ var U = new class {
12524
12329
  }
12525
12330
  };
12526
12331
  }
12527
- }(), W = class extends e {
12332
+ }(), ce = () => {
12333
+ try {
12334
+ return P;
12335
+ } catch {
12336
+ return [];
12337
+ }
12338
+ }, K = class extends H {
12528
12339
  constructor(e) {
12529
12340
  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.");
12530
12341
  this.processor = e.processor, e.duration !== "client" && (this.duration = e.duration ?? 0), this.waitForClientAndBindLoad(e.duration);
12531
12342
  }
12532
12343
  waitForClientAndBindLoad(e = this.duration, t) {
12533
- if (!(window?.client instanceof r)) {
12344
+ let n = ce();
12345
+ if (!n.length) {
12534
12346
  setTimeout(() => this.waitForClientAndBindLoad(e, t), this.clientWaitRetryDelay);
12535
12347
  return;
12536
12348
  }
12537
- window.client.on("load", () => {
12538
- e === "client" && (this.duration = window?.client?.fields?.widgetDuration ?? 0), this.emit("load"), this.loaded = !0, t && t();
12349
+ let r = n[0];
12350
+ r.on("load", () => {
12351
+ e === "client" && (this.duration = r.fields?.widgetDuration ?? 0), this.emit("load"), this.loaded = !0, t && t();
12539
12352
  });
12540
12353
  }
12541
12354
  enqueue(e, t = {}) {
@@ -12584,7 +12397,7 @@ var U = new class {
12584
12397
  return this.running && this.cancel(), this.hasItems() && this.run(), this;
12585
12398
  }
12586
12399
  update(e) {
12587
- return this.queue = e.queue ?? this.queue, this.priorityQueue = e.priorityQueue ?? this.priorityQueue, this.history = e.history ?? this.history, this.hasItems() && this.running === !1 && window.client?.on("load", () => this.run()), this;
12400
+ return this.queue = e.queue ?? this.queue, this.priorityQueue = e.priorityQueue ?? this.priorityQueue, this.history = e.history ?? this.history, this.hasItems() && this.running === !1 && ce()[0]?.on("load", () => this.run()), this;
12588
12401
  }
12589
12402
  cancel() {
12590
12403
  this.running && (this.timeouts.forEach((e) => clearTimeout(e)), this.timeouts = [], this.running = !1, this.emit("cancel"));
@@ -12595,20 +12408,20 @@ var U = new class {
12595
12408
  on(e, t) {
12596
12409
  return e === "load" && this.loaded ? (t.apply(this), this) : (super.on(e, t), this);
12597
12410
  }
12598
- }, G = new W({
12411
+ }, q = new K({
12599
12412
  duration: "client",
12600
12413
  processor: async function(e) {
12601
12414
  if (window.dispatchEvent(new CustomEvent(e.listener, { detail: e.data })), e.listener === "onEventReceived" && e.session) {
12602
- let t = await U.event.onSessionUpdate(window?.client && window?.client instanceof r ? window.client.session : void 0, I.event.parseProvider(e.data));
12415
+ let t = await G.event.onSessionUpdate(P?.[0] ? P[0].session : void 0, B.event.parseProvider(e.data));
12603
12416
  window.dispatchEvent(new CustomEvent("onSessionUpdate", { detail: t }));
12604
12417
  }
12605
12418
  }
12606
- }), K = new class {
12419
+ }), J = new class {
12607
12420
  constructor() {
12608
12421
  this.twitch = {
12609
12422
  message(e = {}) {
12610
- U.event.onEventReceived("twitch", "message", e).then((e) => {
12611
- e && K.send("onEventReceived", e);
12423
+ G.event.onEventReceived("twitch", "message", e).then((e) => {
12424
+ e && J.send("onEventReceived", e);
12612
12425
  });
12613
12426
  },
12614
12427
  deleteMessage(e) {
@@ -12617,7 +12430,7 @@ var U = new class {
12617
12430
  listener: "delete-message",
12618
12431
  event: { msgId: e }
12619
12432
  };
12620
- K.send("onEventReceived", t);
12433
+ J.send("onEventReceived", t);
12621
12434
  },
12622
12435
  deleteMessages(e) {
12623
12436
  if (!e || typeof e != "string") return;
@@ -12625,85 +12438,85 @@ var U = new class {
12625
12438
  listener: "delete-messages",
12626
12439
  event: { userId: e }
12627
12440
  };
12628
- K.send("onEventReceived", t);
12441
+ J.send("onEventReceived", t);
12629
12442
  },
12630
12443
  follower(e = {}) {
12631
- U.event.onEventReceived("twitch", "follower-latest", e).then((e) => {
12632
- e && K.send("onEventReceived", e);
12444
+ G.event.onEventReceived("twitch", "follower-latest", e).then((e) => {
12445
+ e && J.send("onEventReceived", e);
12633
12446
  });
12634
12447
  },
12635
12448
  raid(e = {}) {
12636
- U.event.onEventReceived("twitch", "raid-latest", e).then((e) => {
12637
- e && K.send("onEventReceived", e);
12449
+ G.event.onEventReceived("twitch", "raid-latest", e).then((e) => {
12450
+ e && J.send("onEventReceived", e);
12638
12451
  });
12639
12452
  },
12640
12453
  cheer(e = {}) {
12641
- U.event.onEventReceived("twitch", "cheer-latest", e).then((e) => {
12642
- e && K.send("onEventReceived", e);
12454
+ G.event.onEventReceived("twitch", "cheer-latest", e).then((e) => {
12455
+ e && J.send("onEventReceived", e);
12643
12456
  });
12644
12457
  },
12645
12458
  subscriber(e = {}) {
12646
- U.event.onEventReceived("twitch", "subscriber-latest", e).then((e) => {
12647
- e && K.send("onEventReceived", e);
12459
+ G.event.onEventReceived("twitch", "subscriber-latest", e).then((e) => {
12460
+ e && J.send("onEventReceived", e);
12648
12461
  });
12649
12462
  }
12650
12463
  }, this.streamelements = { tip(e = {}) {
12651
- U.event.onEventReceived("streamelements", "tip-latest", e).then((e) => {
12652
- e && K.send("onEventReceived", e);
12464
+ G.event.onEventReceived("streamelements", "tip-latest", e).then((e) => {
12465
+ e && J.send("onEventReceived", e);
12653
12466
  });
12654
12467
  } }, this.youtube = {
12655
12468
  message(e = {}) {
12656
- U.event.onEventReceived("youtube", "message", e).then((e) => {
12657
- e && K.send("onEventReceived", e);
12469
+ G.event.onEventReceived("youtube", "message", e).then((e) => {
12470
+ e && J.send("onEventReceived", e);
12658
12471
  });
12659
12472
  },
12660
12473
  subscriber(e = {}) {
12661
- U.event.onEventReceived("youtube", "subscriber-latest", e).then((e) => {
12662
- e && K.send("onEventReceived", e);
12474
+ G.event.onEventReceived("youtube", "subscriber-latest", e).then((e) => {
12475
+ e && J.send("onEventReceived", e);
12663
12476
  });
12664
12477
  },
12665
12478
  superchat(e = {}) {
12666
- U.event.onEventReceived("youtube", "superchat-latest", e).then((e) => {
12667
- e && K.send("onEventReceived", e);
12479
+ G.event.onEventReceived("youtube", "superchat-latest", e).then((e) => {
12480
+ e && J.send("onEventReceived", e);
12668
12481
  });
12669
12482
  },
12670
12483
  sponsor(e = {}) {
12671
- U.event.onEventReceived("youtube", "sponsor-latest", e).then((e) => {
12672
- e && K.send("onEventReceived", e);
12484
+ G.event.onEventReceived("youtube", "sponsor-latest", e).then((e) => {
12485
+ e && J.send("onEventReceived", e);
12673
12486
  });
12674
12487
  }
12675
12488
  }, this.kick = {}, this.facebook = {};
12676
12489
  }
12677
12490
  send(e, t) {
12678
- if (!G) {
12491
+ if (!q) {
12679
12492
  Q.warn("Local queue is not initialized."), window.dispatchEvent(new CustomEvent(e, { detail: t }));
12680
12493
  return;
12681
12494
  }
12682
12495
  switch (e) {
12683
12496
  case "onEventReceived":
12684
- G.enqueue({
12497
+ q.enqueue({
12685
12498
  listener: e,
12686
12499
  data: t,
12687
12500
  session: e === "onEventReceived" ? !0 : void 0
12688
12501
  });
12689
12502
  break;
12690
12503
  case "onSessionUpdate":
12691
- G.enqueue({
12504
+ q.enqueue({
12692
12505
  listener: e,
12693
12506
  data: t
12694
12507
  });
12695
12508
  break;
12696
12509
  case "onWidgetLoad":
12697
- G.enqueue({
12510
+ q.enqueue({
12698
12511
  listener: e,
12699
12512
  data: t
12700
12513
  });
12701
12514
  break;
12702
12515
  }
12703
12516
  }
12704
- }(), q;
12517
+ }(), Y;
12705
12518
  (function(e) {
12706
- e.queue = G, e.generate = U, e.emulate = K;
12519
+ e.queue = q, e.generate = G, e.emulate = J;
12707
12520
  async function t(e = [
12708
12521
  "fields.json",
12709
12522
  "cf.json",
@@ -12732,15 +12545,233 @@ var U = new class {
12732
12545
  })
12733
12546
  }, i = await fetch("./" + (r.data ?? "data.json"), { cache: "no-store" }).then((e) => e.json()).catch(() => ({}));
12734
12547
  await fetch("./" + (r.fields ?? "fields.json"), { cache: "no-store" }).then((e) => e.json()).then(async (e) => {
12735
- 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 q.generate.event.onWidgetLoad(t, await q.generate.session.get(n));
12548
+ 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 Y.generate.event.onWidgetLoad(t, await Y.generate.session.get(n));
12736
12549
  window.dispatchEvent(new CustomEvent("onWidgetLoad", { detail: r }));
12737
12550
  });
12738
12551
  }
12739
12552
  e.start = t;
12740
- })(q ||= {});
12553
+ })(Y ||= {});
12741
12554
  //#endregion
12742
- //#region src/modules/useLogger.ts
12743
- var J = class {
12555
+ //#region src/modules/fakeUser.ts
12556
+ var le = class {
12557
+ constructor(e, t, n = [], r = !1, i) {
12558
+ this.badges = [], this.isSubscriber = !1, this.id = e, this.name = t, this.login = t.toLocaleLowerCase(), this.badges = n, this.isSubscriber = r, this.tier = i;
12559
+ }
12560
+ }, ue = {
12561
+ broadcaster: [
12562
+ "moderator",
12563
+ "vip",
12564
+ "artist-badge"
12565
+ ],
12566
+ moderator: ["lead_moderator"],
12567
+ no_video: ["no_audio"],
12568
+ "60-seconds_1": ["60-seconds_2", "60-seconds_3"],
12569
+ duelyst_1: [
12570
+ "duelyst_2",
12571
+ "duelyst_3",
12572
+ "duelyst_4",
12573
+ "duelyst_5",
12574
+ "duelyst_6",
12575
+ "duelyst_7"
12576
+ ]
12577
+ }, de = class e extends H {
12578
+ static fixUser(t) {
12579
+ return typeof t == "string" ? t.trim().replace(/^@+/, "").toLocaleLowerCase() : e.fixUser(t.name);
12580
+ }
12581
+ static getRandomSubTier() {
12582
+ return new ne().probability({
12583
+ prime: .4,
12584
+ 1e3: .3,
12585
+ 2e3: .2,
12586
+ 3e3: .1
12587
+ }) ?? "prime";
12588
+ }
12589
+ constructor(e) {
12590
+ super(), this.users = [], this.byId = /* @__PURE__ */ new Map(), this.byName = /* @__PURE__ */ new Map(), this.byBadge = /* @__PURE__ */ new Map(), this.id = e?.id || `fake_user_pool_${Math.random().toString(36).slice(2, 10)}`, this.users = this.start(e?.names || S.names, e?.badges, e), this.byId = new Map(this.users.map((e) => [e.id, e])), this.byName = new Map(this.users.map((e) => [e.login, e])), this.byBadge = new Map(this.users.reduce((e, t) => {
12591
+ for (let n of t.badges) {
12592
+ let r = e.get(n) ?? [];
12593
+ e.set(n, [...r, t]);
12594
+ }
12595
+ return e;
12596
+ }, /* @__PURE__ */ new Map())), z.push(this);
12597
+ }
12598
+ start(t, n = S.badges.map((e) => e.set_id), r) {
12599
+ let i = t.map((t) => t && e.fixUser(t)).filter((e) => e && e.length).filter((e, t, n) => n.indexOf(e) === t), a = n.filter((e, t, n) => n.indexOf(e) === t);
12600
+ if (!a.length || !i.length) return [];
12601
+ let o = [], s = typeof r?.minimumBadgesPerUser == "number" && r.minimumBadgesPerUser >= 0 ? Math.floor(r.minimumBadgesPerUser) : 1, c = Math.min(s, 3), l = r?.limits ?? {}, u = r?.fixed ?? {}, d = new Set(a), f = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), g = 0, _ = (e) => {
12602
+ let t = l[e];
12603
+ return typeof t == "number" && t > 0 ? t : Infinity;
12604
+ }, v = (e) => {
12605
+ let t = f.get(e) ?? 0;
12606
+ f.set(e, t + 1);
12607
+ }, y = (e) => {
12608
+ let t = m.get(e) ?? 0;
12609
+ if (t <= 1) {
12610
+ m.delete(e);
12611
+ return;
12612
+ }
12613
+ m.set(e, t - 1);
12614
+ }, b = (t) => t ? typeof t == "string" ? [e.fixUser(t)].filter((e) => !!e) : Array.isArray(t) ? t.map(e.fixUser).filter((e) => !!e) : [] : [], x = (e) => e ? Array.isArray(e) ? e : [e] : [], C = (e, t) => {
12615
+ let n = /* @__PURE__ */ new Map();
12616
+ for (let r of [e, t]) for (let [e, t] of Object.entries(r ?? {})) {
12617
+ let r = n.get(e) ?? [], i = x(t);
12618
+ n.set(e, [...new Set([...r, ...i])]);
12619
+ }
12620
+ return n;
12621
+ }, w = (e, t) => {
12622
+ if (e === t) return;
12623
+ let n = h.get(e) ?? /* @__PURE__ */ new Set();
12624
+ n.add(t), h.set(e, n);
12625
+ let r = h.get(t) ?? /* @__PURE__ */ new Set();
12626
+ r.add(e), h.set(t, r);
12627
+ }, T = (e, t) => t.includes(e) ? !1 : t.every((t) => !h.get(t)?.has(e)), E = (e, t) => {
12628
+ if (!T(e, t)) return !1;
12629
+ let n = _(e), r = f.get(e) ?? 0, i = m.get(e) ?? 0;
12630
+ return r < n && r + i < n;
12631
+ }, D = (e, t) => {
12632
+ if (!T(e, t)) return !1;
12633
+ let n = _(e);
12634
+ return (f.get(e) ?? 0) < n;
12635
+ }, O = (e) => {
12636
+ for (let t = 0; t < a.length; t++) {
12637
+ let n = a[(g + t) % a.length];
12638
+ if (E(n, e)) return g = (g + t + 1) % a.length, n;
12639
+ }
12640
+ return null;
12641
+ };
12642
+ for (let [e, t] of C(ue, r?.incompatible)) if (d.has(e)) for (let n of x(t)) d.has(n) && w(e, n);
12643
+ for (let e of a) {
12644
+ let t = b(u[e]);
12645
+ for (let n of t) {
12646
+ let t = p.get(n) ?? [];
12647
+ t.includes(e) || p.set(n, [...t, e]);
12648
+ }
12649
+ }
12650
+ for (let [e, t] of Object.entries(u)) d.has(e) || b(t).length && this.emit("warn", /* @__PURE__ */ Error(`Fixed badge "${e}" is not available in the current badge pool`));
12651
+ let k = /* @__PURE__ */ new Map();
12652
+ s > 3 && this.emit("warn", /* @__PURE__ */ Error("minimumBadgesPerUser exceeds the maximum of 3 and was clamped"));
12653
+ for (let e of i) {
12654
+ let t = p.get(e) ?? [], n = [];
12655
+ for (let r of t) {
12656
+ if (n.length >= 3) {
12657
+ this.emit("warn", /* @__PURE__ */ Error(`User "${e}" has more than 3 fixed badges; extra badges were ignored`));
12658
+ break;
12659
+ }
12660
+ if (!T(r, n)) {
12661
+ this.emit("warn", /* @__PURE__ */ Error(`Fixed badge "${r}" for user "${e}" conflicts with another fixed badge and was ignored`));
12662
+ continue;
12663
+ }
12664
+ n.push(r);
12665
+ }
12666
+ k.set(e, n);
12667
+ for (let e of n) m.set(e, (m.get(e) ?? 0) + 1);
12668
+ }
12669
+ for (let t of i) {
12670
+ let n = [], r = k.get(t) ?? [];
12671
+ for (let e of r) {
12672
+ if (y(e), !D(e, n)) {
12673
+ this.emit("warn", /* @__PURE__ */ Error(`Fixed badge "${e}" for user "${t}" could not be assigned because its limit was reached`));
12674
+ continue;
12675
+ }
12676
+ n.push(e), v(e);
12677
+ }
12678
+ for (; n.length < c;) {
12679
+ let e = O(n);
12680
+ if (!e) break;
12681
+ n.push(e), v(e);
12682
+ }
12683
+ if (!n.length) {
12684
+ this.emit("warn", /* @__PURE__ */ Error("Not enough badges to assign to users"));
12685
+ continue;
12686
+ }
12687
+ n.length < c && this.emit("warn", /* @__PURE__ */ Error(`User "${t}" could only receive ${n.length} badge(s), below the configured minimum of ${c}`));
12688
+ let i = o.length + 1, a = n.some((e) => ["subscriber"].includes(String(e).toLocaleLowerCase())), s = new le(`fake_user_${i.toString().padStart(2, "0")}_${Math.random().toString(36).slice(2, 8)}+${this.id}`, t, n, a, a ? e.getRandomSubTier() : void 0);
12689
+ o.push(s);
12690
+ }
12691
+ 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;
12692
+ }
12693
+ pick() {
12694
+ return this.users.length ? new C().array(this.users)[0] : null;
12695
+ }
12696
+ getByName(t) {
12697
+ let n = e.fixUser(t);
12698
+ return this.byName.get(n) ?? null;
12699
+ }
12700
+ getById(e) {
12701
+ return this.byId.get(e) ?? null;
12702
+ }
12703
+ getByBadge(e) {
12704
+ return this.byBadge.get(e) ?? [];
12705
+ }
12706
+ getToReply(e, t) {
12707
+ let n = null;
12708
+ return e?.id && (n = this.getById(e.id)), !n && e?.name && (n = this.getByName(e.name)), n ? {
12709
+ msgId: `fake_msg_${Math.random().toString(36).slice(2, 10)}`,
12710
+ userId: n.id,
12711
+ userLogin: n.login,
12712
+ displayName: n.name,
12713
+ msgBody: `This is a fake reply from ${n.name}`,
12714
+ ...t
12715
+ } : null;
12716
+ }
12717
+ buildTwitchMessage(e = S.twitch_messages) {
12718
+ let t = this.pick();
12719
+ if (!t) {
12720
+ this.emit("warn", /* @__PURE__ */ Error("No users available to build a Twitch message"));
12721
+ return;
12722
+ }
12723
+ return {
12724
+ userId: t.id,
12725
+ name: t.name,
12726
+ badges: t.badges,
12727
+ message: new C().array(e)[0]
12728
+ };
12729
+ }
12730
+ buildYouTubeMessage(e = S.youtube_messages) {
12731
+ let t = this.pick();
12732
+ if (!t) {
12733
+ this.emit("warn", /* @__PURE__ */ Error("No users available to build a YouTube message"));
12734
+ return;
12735
+ }
12736
+ return {
12737
+ userId: t.id,
12738
+ name: t.name,
12739
+ badges: t.badges,
12740
+ message: new C().array(e)[0]
12741
+ };
12742
+ }
12743
+ }, fe = class extends H {
12744
+ constructor(e = {}) {
12745
+ 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), Z?.then(async (e) => {
12746
+ this.loaded = !0, this.SE_API = e, Promise.all([async () => {
12747
+ let t = await e.store.get(this.id);
12748
+ t && (this.history = t.slice(-10));
12749
+ }, async () => {
12750
+ let t = await e.store.get(this.id + "_detected");
12751
+ t && (this.detected = new Set(t));
12752
+ }]);
12753
+ });
12754
+ }
12755
+ async send(e, t) {
12756
+ if (this.SE_API) {
12757
+ let n = {
12758
+ nonce: Math.random().toString(36).substring(2),
12759
+ key: e,
12760
+ value: t,
12761
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
12762
+ };
12763
+ this.history.push(n), this.SE_API.store.set(this.id, this.history), this.SE_API.store.set(this.id + "_detected", Array.from(this.detected));
12764
+ }
12765
+ }
12766
+ update(e) {
12767
+ e.length && (this.history = e, e.filter((e) => !this.detected.has(e.nonce)).forEach((e) => {
12768
+ this.detected.add(e.nonce), this.emit("message", e.key, e.value);
12769
+ }));
12770
+ }
12771
+ on(e, t) {
12772
+ return e === "load" && this.loaded ? (t.apply(this), this) : (super.on(e, t), this);
12773
+ }
12774
+ }, pe = class {
12744
12775
  constructor(e = {}) {
12745
12776
  this.error = this.apply({
12746
12777
  color: "#721c24",
@@ -12838,7 +12869,7 @@ var J = class {
12838
12869
  timeEnd(e) {
12839
12870
  !this.enabled || !console.timeEnd || console.timeEnd(e);
12840
12871
  }
12841
- }, ue = class extends e {
12872
+ }, me = class extends H {
12842
12873
  constructor(e, t) {
12843
12874
  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) => {
12844
12875
  this.instance = e, this.emit("load", e), this.connect();
@@ -12848,16 +12879,16 @@ var J = class {
12848
12879
  }
12849
12880
  load() {
12850
12881
  return window.ComfyJS === void 0 || !window.ComfyJS ? new Promise((e, t) => {
12851
- if (this.emulate && !client) return t(/* @__PURE__ */ Error("useComfyJs: Cannot emulate chat messages without a Client instance."));
12882
+ if (this.emulate && !P.length) return t(/* @__PURE__ */ Error("useComfyJs: Cannot emulate chat messages without a Client instance."));
12852
12883
  let n = document.createElement("script");
12853
12884
  n.src = "https://cdn.jsdelivr.net/npm/comfy.js@1.1.29/dist/comfy.min.js", n.type = "text/javascript", n.async = !0, n.onload = () => e(window.ComfyJS), n.onerror = (e) => t(e), document.head.appendChild(n);
12854
12885
  }) : Promise.resolve(window.ComfyJS);
12855
12886
  }
12856
12887
  connect() {
12857
12888
  this.instance.onError = (e) => {
12858
- this.emit("error", e), client?.debug && Q.error("[Client]", "ComfyJS Error:", e);
12889
+ this.emit("error", e), P.some((e) => e.debug) && Q.error("[Client]", "ComfyJS Error:", e);
12859
12890
  }, this.instance.onCommand = (e, t, n, r, i) => {
12860
- if (this.emit("command", e, t, n, r, i), client?.debug && Q.debug("[Client]", `ComfyJS Command: !${t} ${n} (User: ${e})`), this.emulate) {
12891
+ if (this.emit("command", e, t, n, r, i), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Command: !${t} ${n} (User: ${e})`), this.emulate) {
12861
12892
  let a = {
12862
12893
  ...r,
12863
12894
  broadcaster: r.broadcaster,
@@ -12875,10 +12906,10 @@ var J = class {
12875
12906
  msgId: i.id,
12876
12907
  channel: i.channel
12877
12908
  };
12878
- q.emulate.twitch.message(o);
12909
+ Y.emulate.twitch.message(o);
12879
12910
  }
12880
12911
  }, this.instance.onChat = (e, t, n, r, i) => {
12881
- if (this.emit("chat", e, t, n, r, i), client?.debug && Q.debug("[Client]", `ComfyJS Chat: ${t} (User: ${e})`), this.emulate) {
12912
+ if (this.emit("chat", e, t, n, r, i), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Chat: ${t} (User: ${e})`), this.emulate) {
12882
12913
  let r = {
12883
12914
  ...n,
12884
12915
  ...i.userBadges,
@@ -12888,7 +12919,7 @@ var J = class {
12888
12919
  subscriber: n.subscriber,
12889
12920
  founder: n.founder
12890
12921
  };
12891
- q.emulate.twitch.message({
12922
+ Y.emulate.twitch.message({
12892
12923
  name: e,
12893
12924
  message: t,
12894
12925
  badges: Object.entries(r).map(([e, t]) => t ? e : null).filter(Boolean),
@@ -12900,24 +12931,24 @@ var J = class {
12900
12931
  });
12901
12932
  }
12902
12933
  }, this.instance.onWhisper = (e, t, n, r, i) => {
12903
- this.emit("whisper", e, t, n, r, i), client?.debug && Q.debug("[Client]", `ComfyJS Whisper: ${t} (User: ${e})`);
12934
+ this.emit("whisper", e, t, n, r, i), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Whisper: ${t} (User: ${e})`);
12904
12935
  }, this.instance.onMessageDeleted = (e, t) => {
12905
- this.emit("messageDeleted", e, t), client?.debug && Q.debug("[Client]", `ComfyJS Message Deleted: ${e}`), this.emulate && q.emulate.twitch.deleteMessage(e);
12936
+ this.emit("messageDeleted", e, t), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Message Deleted: ${e}`), this.emulate && Y.emulate.twitch.deleteMessage(e);
12906
12937
  }, this.instance.onJoin = (e, t, n) => {
12907
- this.emit("join", e, t, n), client?.debug && Q.debug("[Client]", `ComfyJS Join: ${e}`);
12938
+ this.emit("join", e, t, n), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Join: ${e}`);
12908
12939
  }, this.instance.onPart = (e, t, n) => {
12909
- this.emit("part", e, t, n), client?.debug && Q.debug("[Client]", `ComfyJS Part: ${e}`);
12940
+ this.emit("part", e, t, n), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Part: ${e}`);
12910
12941
  }, this.instance.onHosted = (e, t, n, r) => {
12911
- this.emit("hosted", e, t, n, r), client?.debug && Q.debug("[Client]", `ComfyJS Hosted: ${e} (${t} viewers)`);
12942
+ this.emit("hosted", e, t, n, r), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Hosted: ${e} (${t} viewers)`);
12912
12943
  }, this.instance.onRaid = (e, t, n) => {
12913
- this.emit("raid", e, t, n), client?.debug && Q.debug("[Client]", `ComfyJS Raid: ${e} (${t} viewers)`), this.emulate && q.emulate.twitch.raid({
12944
+ this.emit("raid", e, t, n), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Raid: ${e} (${t} viewers)`), this.emulate && Y.emulate.twitch.raid({
12914
12945
  name: e,
12915
12946
  amount: t
12916
12947
  });
12917
12948
  }, this.instance.onSub = (e, t, n, r) => {
12918
- if (this.emit("sub", e, t, n, r), client?.debug && Q.debug("[Client]", `ComfyJS Sub: ${e} (${n.plan})`), this.emulate) {
12949
+ if (this.emit("sub", e, t, n, r), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Sub: ${e} (${n.plan})`), this.emulate) {
12919
12950
  let r = n.plan === "Prime" ? "prime" : n.plan;
12920
- q.emulate.twitch.subscriber({
12951
+ Y.emulate.twitch.subscriber({
12921
12952
  name: e,
12922
12953
  message: t,
12923
12954
  tier: r,
@@ -12925,9 +12956,9 @@ var J = class {
12925
12956
  });
12926
12957
  }
12927
12958
  }, this.instance.onResub = (e, t, n, r, i, a) => {
12928
- if (this.emit("resub", e, t, n, r, i, a), client?.debug && Q.debug("[Client]", `ComfyJS Resub: ${e} (${r} months)`), this.emulate) {
12959
+ 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) {
12929
12960
  let n = i.plan === "Prime" ? "prime" : i.plan;
12930
- q.emulate.twitch.subscriber({
12961
+ Y.emulate.twitch.subscriber({
12931
12962
  name: e,
12932
12963
  message: t,
12933
12964
  tier: n,
@@ -12936,9 +12967,9 @@ var J = class {
12936
12967
  });
12937
12968
  }
12938
12969
  }, this.instance.onSubGift = (e, t, n, r, i, a) => {
12939
- if (this.emit("subGift", e, t, n, r, i, a), client?.debug && Q.debug("[Client]", `ComfyJS Sub Gift: ${e} gifted ${r} subs`), this.emulate) {
12970
+ 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) {
12940
12971
  let t = i.plan === "Prime" ? "prime" : i.plan;
12941
- q.emulate.twitch.subscriber({
12972
+ Y.emulate.twitch.subscriber({
12942
12973
  name: n,
12943
12974
  message: "",
12944
12975
  sender: e,
@@ -12948,9 +12979,9 @@ var J = class {
12948
12979
  });
12949
12980
  }
12950
12981
  }, this.instance.onSubMysteryGift = (e, t, n, r, i) => {
12951
- if (this.emit("subMysteryGift", e, t, n, r, i), client?.debug && Q.debug("[Client]", `ComfyJS Sub Mystery Gift: ${e} gifted ${t} subs`), this.emulate) {
12982
+ 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) {
12952
12983
  let n = r.plan === "Prime" ? "prime" : r.plan;
12953
- q.emulate.twitch.subscriber({
12984
+ Y.emulate.twitch.subscriber({
12954
12985
  name: e,
12955
12986
  message: "",
12956
12987
  amount: t,
@@ -12959,7 +12990,7 @@ var J = class {
12959
12990
  });
12960
12991
  }
12961
12992
  }, this.instance.onGiftSubContinue = (e, t, n) => {
12962
- this.emit("giftSubContinue", e, t, n), client?.debug && Q.debug("[Client]", `ComfyJS Gift Sub Continue: ${e} continued their gifted sub from ${t}`), this.emulate && q.emulate.twitch.subscriber({
12993
+ 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 && Y.emulate.twitch.subscriber({
12963
12994
  name: e,
12964
12995
  message: "",
12965
12996
  sender: t,
@@ -12967,22 +12998,22 @@ var J = class {
12967
12998
  subType: "gift"
12968
12999
  });
12969
13000
  }, this.instance.onCheer = (e, t, n, r, i) => {
12970
- this.emit("cheer", e, t, n, r, i), client?.debug && Q.debug("[Client]", `ComfyJS Cheer: ${e} cheered ${n} bits - ${t}`), this.emulate && q.emulate.twitch.cheer({
13001
+ 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 && Y.emulate.twitch.cheer({
12971
13002
  name: e,
12972
13003
  message: t,
12973
13004
  amount: n
12974
13005
  });
12975
13006
  }, this.instance.onChatMode = (e, t) => {
12976
- this.emit("chatMode", e, t), client?.debug && Q.debug("[Client]", `ComfyJS Chat Mode Changed on ${t}`);
13007
+ this.emit("chatMode", e, t), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Chat Mode Changed on ${t}`);
12977
13008
  }, this.instance.onReward = (e, t, n, r, i) => {
12978
- this.emit("reward", e, t, n, r, i), client?.debug && Q.debug("[Client]", `ComfyJS Reward: ${e} redeemed ${t} for ${n} - ${r}`);
13009
+ this.emit("reward", e, t, n, r, i), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Reward: ${e} redeemed ${t} for ${n} - ${r}`);
12979
13010
  }, this.instance.onConnected = (e, t, n) => {
12980
- this.emit("connected", e, t, n), client?.debug && Q.debug("[Client]", `ComfyJS Connected: ${e}:${t} (First Connect: ${n})`);
13011
+ this.emit("connected", e, t, n), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Connected: ${e}:${t} (First Connect: ${n})`);
12981
13012
  }, this.instance.onReconnect = (e) => {
12982
- this.emit("reconnect", e), client?.debug && Q.debug("[Client]", `ComfyJS Reconnect: Attempt #${e}`);
13013
+ this.emit("reconnect", e), P.some((e) => e.debug) && Q.debug("[Client]", `ComfyJS Reconnect: Attempt #${e}`);
12983
13014
  }, this.init && this.instance.Init(this.username, this.password, this.channels, this.isDebug);
12984
13015
  }
12985
- }, Y = {
13016
+ }, X = {
12986
13017
  responses: {},
12987
13018
  sendMessage(e, t = {}) {
12988
13019
  return new Promise((n, r) => {
@@ -12998,7 +13029,7 @@ var J = class {
12998
13029
  } },
12999
13030
  store: {
13000
13031
  set: function(e, t) {
13001
- this.list[e] = t, localStorage.setItem("SE_API-STORE", JSON.stringify(Y.store.list));
13032
+ this.list[e] = t, localStorage.setItem("SE_API-STORE", JSON.stringify(X.store.list));
13002
13033
  },
13003
13034
  get: async function(e) {
13004
13035
  return this.list[e] ? this.list[e] : null;
@@ -13007,7 +13038,7 @@ var J = class {
13007
13038
  },
13008
13039
  resumeQueue: () => {
13009
13040
  try {
13010
- G instanceof W && G?.resume();
13041
+ q instanceof K && q?.resume();
13011
13042
  } catch (e) {
13012
13043
  return {
13013
13044
  ok: !1,
@@ -13036,8 +13067,8 @@ var J = class {
13036
13067
  } });
13037
13068
  return this.history.push({
13038
13069
  ...n,
13039
- origin: client?.id
13040
- }), window.dispatchEvent(n) ? { ok: !0 } : { ok: !1 };
13070
+ origin: P?.[0]?.id
13071
+ }), localStorage.setItem("SE_API-EVENTS", JSON.stringify(this.history)), window.dispatchEvent(n) ? { ok: !0 } : { ok: !1 };
13041
13072
  },
13042
13073
  broadcast(e, t) {
13043
13074
  let n = new CustomEvent("onEventReceived", { detail: {
@@ -13047,21 +13078,21 @@ var J = class {
13047
13078
  } });
13048
13079
  return this.history.push({
13049
13080
  ...n,
13050
- origin: client?.id
13051
- }), window.dispatchEvent(n) ? { ok: !0 } : { ok: !1 };
13081
+ origin: P?.[0]?.id
13082
+ }), localStorage.setItem("SE_API-EVENTS", JSON.stringify(this.history)), window.dispatchEvent(n) ? { ok: !0 } : { ok: !1 };
13052
13083
  },
13053
13084
  history: []
13054
13085
  }
13055
13086
  };
13056
- async function de() {
13087
+ async function he() {
13057
13088
  let e = localStorage.getItem("SE_API-STORE") ?? "{}", t = e ? JSON.parse(e) : {};
13058
- Y.store.list = t;
13089
+ X.store.list = t;
13059
13090
  let n = localStorage.getItem("SE_API-EVENTS") ?? "[]", r = n ? JSON.parse(n) : [];
13060
- return Y.events.history = r, Y;
13091
+ return X.events.history = r, X;
13061
13092
  }
13062
13093
  //#endregion
13063
13094
  //#region src/utils/alejo.ts
13064
- var X;
13095
+ var ge;
13065
13096
  (function(e) {
13066
13097
  let t;
13067
13098
  (function(e) {
@@ -13085,7 +13116,7 @@ var X;
13085
13116
  e.list = n;
13086
13117
  async function r(e) {
13087
13118
  if (!e) throw Error("Username is required to fetch Alejo data.");
13088
- if (e = e.toLowerCase(), !window?.client) {
13119
+ if (e = e.toLowerCase(), !P.length) {
13089
13120
  try {
13090
13121
  let t = await fetch(`https://pronouns.alejo.io/api/users/${e}`).then((e) => e.json()).then(([e]) => e);
13091
13122
  if (t) return t.pronoun_id;
@@ -13094,56 +13125,51 @@ var X;
13094
13125
  }
13095
13126
  return;
13096
13127
  }
13097
- if (e in window?.client?.storage.data.pronoun && window?.client?.storage.data.pronoun[e].expire > Date.now()) return window?.client?.storage.data.pronoun[e].value;
13128
+ let t = P?.[0];
13129
+ if (e in t.storage.data.pronoun && t.storage.data.pronoun[e].expire > Date.now()) return t.storage.data.pronoun[e].value;
13098
13130
  try {
13099
- let t = await fetch(`https://pronouns.alejo.io/api/users/${e}`).then((e) => e.json()).then(([e]) => e);
13100
- if (t) return window?.client?.storage.add(`pronoun.${e}`, {
13101
- value: t.pronoun_id,
13131
+ let n = await fetch(`https://pronouns.alejo.io/api/users/${e}`).then((e) => e.json()).then(([e]) => e);
13132
+ if (n) return t.storage.add(`pronoun.${e}`, {
13133
+ value: n.pronoun_id,
13102
13134
  timestamp: Date.now(),
13103
- expire: Date.now() + window?.client?.cache.pronoun * 60 * 1e3
13104
- }), window?.client?.storage.data.pronoun[e].value ?? t.pronoun_id;
13135
+ expire: Date.now() + t.cache.pronoun * 60 * 1e3
13136
+ }), t.storage.data.pronoun[e].value ?? n.pronoun_id;
13105
13137
  } catch (t) {
13106
13138
  throw Error(`Failed to fetch pronoun data for user "${e}": ${t instanceof Error ? t.message : t}`);
13107
13139
  }
13108
13140
  }
13109
13141
  e.get = r;
13110
- })(X ||= {});
13142
+ })(ge ||= {});
13111
13143
  //#endregion
13112
13144
  //#region src/main.ts
13113
- var Z = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(de()), Q = new J(), $ = {
13145
+ var Z = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(he()), Q = new pe(), $ = {
13114
13146
  SeAPI: Z,
13115
- Client: r,
13116
- Helper: I,
13117
- Local: q,
13118
- Data: w,
13147
+ Client: ae,
13148
+ Helper: B,
13149
+ Local: Y,
13150
+ Data: S,
13119
13151
  logger: Q,
13120
13152
  modules: {
13121
- EventProvider: e,
13122
- useStorage: n,
13123
- useQueue: W,
13124
- useLogger: J,
13125
- useComms: se,
13126
- FakeUserPool: P
13153
+ EventProvider: H,
13154
+ useStorage: U,
13155
+ useQueue: K,
13156
+ useLogger: pe,
13157
+ useComms: fe,
13158
+ FakeUserPool: de
13127
13159
  },
13128
13160
  actions: {
13129
- Button: R,
13130
- Command: B
13131
- },
13132
- multistream: { useComfyJs: ue },
13133
- internal: {
13134
- usedStorages: t,
13135
- usedComms: V,
13136
- usedCommands: z,
13137
- usedButtons: L,
13138
- fakeUserPools: N
13139
- },
13140
- pronouns: { Alejo: X }
13161
+ Button: ie,
13162
+ Command: V
13163
+ },
13164
+ multistream: { useComfyJs: me },
13165
+ internal: te,
13166
+ pronouns: { Alejo: ge }
13141
13167
  };
13142
13168
  typeof window < "u" ? window.Tixyel = $ : globalThis.Tixyel = $;
13143
13169
  //#endregion
13144
13170
  //#region src/index.ts
13145
- var fe = $;
13171
+ var _e = $;
13146
13172
  //#endregion
13147
- export { fe as default };
13173
+ export { _e as default };
13148
13174
 
13149
13175
  //# sourceMappingURL=index.es.js.map