@overlayed/app 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,16 +1,15 @@
1
- var Fe = Object.defineProperty;
2
- var xe = (r, t, e) => t in r ? Fe(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
- var l = (r, t, e) => xe(r, typeof t != "symbol" ? t + "" : t, e);
4
- import p, { resolve as Ke } from "node:path";
5
- import { PipeEventServer as Le, ProcessMonitor as Oe, Process as L }from "./native-interface/main.js";
6
- import { type as D } from "arktype";
7
- import w, { existsSync as $e, mkdirSync as He, readFileSync as ye, writeFileSync as Ne, copyFileSync as je } from "node:fs";
8
- import b from "node:fs/promises";
9
- import me from "jszip";
10
- import { RenderInterface as Ue }from "./render-interface/main.js";
11
- import { createHash as Be } from "node:crypto";
12
- var Ge = Object.defineProperty, Ve = (r, t, e) => t in r ? Ge(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e, R = (r, t, e) => Ve(r, typeof t != "symbol" ? t + "" : t, e);
13
- function ze(r) {
1
+ var ot = Object.defineProperty;
2
+ var it = (r, t, e) => t in r ? ot(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
+ var c = (r, t, e) => it(r, typeof t != "symbol" ? t + "" : t, e);
4
+ import _, { resolve as lt } from "node:path";
5
+ import { createRequire as ue } from "node:module";
6
+ import { type as y, scope as ct } from "arktype";
7
+ import C, { existsSync as dt, mkdirSync as ut, readFileSync as Se, writeFileSync as ht, copyFileSync as gt } from "node:fs";
8
+ import E from "node:fs/promises";
9
+ import Me from "jszip";
10
+ import { createHash as pt } from "node:crypto";
11
+ var ft = Object.defineProperty, yt = (r, t, e) => t in r ? ft(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e, T = (r, t, e) => yt(r, typeof t != "symbol" ? t + "" : t, e);
12
+ function mt(r) {
14
13
  return { all: r = r || /* @__PURE__ */ new Map(), on: function(t, e) {
15
14
  var n = r.get(t);
16
15
  n ? n.push(e) : r.set(t, [e]);
@@ -26,9 +25,9 @@ function ze(r) {
26
25
  });
27
26
  } };
28
27
  }
29
- let We = class {
28
+ let _t = class {
30
29
  constructor() {
31
- R(this, "emitter"), this.emitter = ze();
30
+ T(this, "emitter"), this.emitter = mt();
32
31
  }
33
32
  on(t, e) {
34
33
  this.emitter.on(t, e);
@@ -44,7 +43,7 @@ let We = class {
44
43
  });
45
44
  }
46
45
  };
47
- function qe(r, ...t) {
46
+ function bt(r, ...t) {
48
47
  var e;
49
48
  return e = class extends r {
50
49
  /**
@@ -59,13 +58,14 @@ function qe(r, ...t) {
59
58
  static clearInstance() {
60
59
  this._instance = void 0;
61
60
  }
62
- }, R(e, "_instance"), e;
61
+ }, T(e, "_instance"), e;
63
62
  }
64
- const Xe = p.join(process.env.APPDATA ?? "", "overlayed");
65
- p.join(Xe, "logs");
66
- let Je = class extends We {
63
+ const vt = _.join(process.env.APPDATA ?? "", "overlayed");
64
+ _.join(vt, "logs");
65
+ const Et = ue(import.meta.url), { PipeEventServer: wt, PipeEventClient: Cr, PipeEventBase: Pr, ProcessMonitor: Sr, Process: Mr, InjectionMethod: $r, AccessLevel: Ar } = Et("./build/overlayed_native_interface_x64.node");
66
+ let kt = class extends _t {
67
67
  constructor(t) {
68
- super(), R(this, "server", null), R(this, "_hasConnection", !1), R(this, "pipeId"), this.pipeId = t, this.init();
68
+ super(), T(this, "server", null), T(this, "_hasConnection", !1), T(this, "pipeId"), this.pipeId = t, this.init();
69
69
  }
70
70
  get hasConnection() {
71
71
  return this._hasConnection;
@@ -75,7 +75,7 @@ let Je = class extends We {
75
75
  this.server && (this._hasConnection = !1, (t = this.server) == null || t.removeAllListeners(), this.server = null);
76
76
  }
77
77
  init() {
78
- this.server = new Le(this.pipeId, { clientCount: 1, access: 1 }), this.server.on("event", (t) => {
78
+ this.server = new wt(this.pipeId, { clientCount: 1, access: 1 }), this.server.on("event", (t) => {
79
79
  try {
80
80
  const e = JSON.parse(t);
81
81
  this.emit("data", e);
@@ -89,12 +89,12 @@ let Je = class extends We {
89
89
  });
90
90
  }
91
91
  };
92
- const Qe = qe(Je, "overlayed"), Ye = D({
92
+ const $e = bt(kt, "overlayed"), Ae = y({
93
93
  game: "string",
94
94
  type: "string",
95
95
  creation_time: "number"
96
96
  });
97
- function Ze(r) {
97
+ function It(r) {
98
98
  return { all: r = r || /* @__PURE__ */ new Map(), on: function(t, e) {
99
99
  var n = r.get(t);
100
100
  n ? n.push(e) : r.set(t, [e]);
@@ -110,10 +110,10 @@ function Ze(r) {
110
110
  });
111
111
  } };
112
112
  }
113
- class et {
113
+ class Ct {
114
114
  constructor() {
115
- l(this, "emitter");
116
- this.emitter = Ze();
115
+ c(this, "emitter");
116
+ this.emitter = It();
117
117
  }
118
118
  on(t, e) {
119
119
  this.emitter.on(t, e);
@@ -129,7 +129,7 @@ class et {
129
129
  });
130
130
  }
131
131
  }
132
- function k(r, ...t) {
132
+ function I(r, ...t) {
133
133
  var n;
134
134
  return n = class extends r {
135
135
  /**
@@ -144,27 +144,27 @@ function k(r, ...t) {
144
144
  static clearInstance() {
145
145
  this._instance = void 0;
146
146
  }
147
- }, l(n, "_instance"), n;
147
+ }, c(n, "_instance"), n;
148
148
  }
149
- function tt(r) {
149
+ function Pt(r) {
150
150
  try {
151
151
  return [JSON.parse(r), null];
152
152
  } catch (t) {
153
153
  return [null, t];
154
154
  }
155
155
  }
156
- function X(r, t) {
156
+ function ae(r, t) {
157
157
  const e = {};
158
158
  for (const n in t)
159
- n in r ? typeof r[n] == "object" && r[n] !== null && typeof t[n] == "object" && t[n] !== null ? e[n] = X(r[n], t[n]) : e[n] = r[n] : e[n] = t[n];
159
+ n in r ? typeof r[n] == "object" && r[n] !== null && typeof t[n] == "object" && t[n] !== null ? e[n] = ae(r[n], t[n]) : e[n] = r[n] : e[n] = t[n];
160
160
  for (const n in r)
161
161
  n in e || (e[n] = r[n]);
162
162
  return e;
163
163
  }
164
- class rt {
164
+ class St {
165
165
  constructor(t) {
166
- l(this, "options");
167
- l(this, "_data");
166
+ c(this, "options");
167
+ c(this, "_data");
168
168
  this.options = t, this._data = this.load();
169
169
  }
170
170
  get data() {
@@ -182,7 +182,7 @@ class rt {
182
182
  saveCurrentData() {
183
183
  try {
184
184
  const t = this.onBeforeSave(this._data);
185
- w.writeFileSync(this.options.path, JSON.stringify(t, null, 2));
185
+ C.writeFileSync(this.options.path, JSON.stringify(t, null, 2));
186
186
  } catch {
187
187
  }
188
188
  }
@@ -191,19 +191,19 @@ class rt {
191
191
  return this.setupDefaultData();
192
192
  if (!this.canReadWriteFile(this.options.path))
193
193
  return this.setupDefaultData(!0);
194
- const t = w.readFileSync(this.options.path, "utf8"), [e, n] = tt(t);
194
+ const t = C.readFileSync(this.options.path, "utf8"), [e, n] = Pt(t);
195
195
  return n ? this.setupDefaultData(!0) : this.onAfterLoad(e);
196
196
  }
197
197
  canReadWriteFile(t) {
198
198
  try {
199
- return w.accessSync(t, w.constants.R_OK | w.constants.W_OK), !0;
199
+ return C.accessSync(t, C.constants.R_OK | C.constants.W_OK), !0;
200
200
  } catch {
201
201
  return !1;
202
202
  }
203
203
  }
204
204
  fileExists(t) {
205
205
  try {
206
- return w.accessSync(t, w.constants.F_OK), !0;
206
+ return C.accessSync(t, C.constants.F_OK), !0;
207
207
  } catch {
208
208
  return !1;
209
209
  }
@@ -212,10 +212,10 @@ class rt {
212
212
  return this._data = this.options.default, t || this.saveCurrentData(), this.data;
213
213
  }
214
214
  }
215
- class nt extends rt {
215
+ class Mt extends St {
216
216
  constructor(e) {
217
217
  super(e);
218
- l(this, "options");
218
+ c(this, "options");
219
219
  this.options = e;
220
220
  }
221
221
  get data() {
@@ -234,10 +234,10 @@ class nt extends rt {
234
234
  const n = this.options.schema["~standard"].validate(e);
235
235
  if (n instanceof Promise)
236
236
  throw new Error("StructuredConfigFile does not support async validation");
237
- return n.issues ? X(e, this.options.default) : X(n.value, this.options.default);
237
+ return n.issues ? ae(e, this.options.default) : ae(n.value, this.options.default);
238
238
  }
239
239
  }
240
- const ve = {
240
+ const Re = {
241
241
  scope: (r) => ({
242
242
  log: (...t) => {
243
243
  console.log(r, ...t);
@@ -294,13 +294,13 @@ const ve = {
294
294
  sentryInfo: (...r) => {
295
295
  console.info(name, ...r);
296
296
  }
297
- }, F = p.join(process.env.APPDATA ?? "", "overlayed");
298
- p.join(F, "logs");
299
- class st {
297
+ }, B = _.join(process.env.APPDATA ?? "", "overlayed");
298
+ _.join(B, "logs");
299
+ class Ke {
300
300
  constructor(t) {
301
- l(this, "logger");
302
- l(this, "initialized", !1);
303
- this.logger = ve.scope(t);
301
+ c(this, "logger");
302
+ c(this, "initialized", !1);
303
+ this.logger = Re.scope(t);
304
304
  }
305
305
  init() {
306
306
  this.logger.log("Initializing"), this.initialized = !0;
@@ -309,12 +309,12 @@ class st {
309
309
  this.logger.log("Destroying"), this.initialized = !1;
310
310
  }
311
311
  }
312
- class C extends et {
312
+ class x extends Ct {
313
313
  constructor(e) {
314
314
  super();
315
- l(this, "logger");
316
- l(this, "initialized", !1);
317
- this.logger = ve.scope(e);
315
+ c(this, "logger");
316
+ c(this, "initialized", !1);
317
+ this.logger = Re.scope(e);
318
318
  }
319
319
  init() {
320
320
  this.logger.log("Initializing"), this.initialized = !0;
@@ -323,7 +323,7 @@ class C extends et {
323
323
  this.logger.log("Destroying"), this.initialized = !1, this.removeAllListeners();
324
324
  }
325
325
  }
326
- class it extends C {
326
+ class $t extends x {
327
327
  constructor() {
328
328
  super("ErrorManager");
329
329
  }
@@ -344,150 +344,151 @@ class it extends C {
344
344
  });
345
345
  }
346
346
  }
347
- const be = k(it), ot = {
348
- buildChannel: "dev"
349
- };
350
- function at() {
351
- return p.normalize(F);
347
+ const q = I($t);
348
+ function At() {
349
+ return _.normalize(B);
350
+ }
351
+ function Rt(r = []) {
352
+ return _.normalize(_.join(B, global.OVERLAYED.APP_NAME, ...r));
352
353
  }
353
- var I = "object", Ee = "function", we = "prototype", q = "text", re = "json", le = "abort", J = "paramsSerializer", ue = "addEventListener", O = "status", v = "headers", W = Object, _ = void 0, N = null, Q = W[we], j = W.keys, M = Array.isArray, he = "method", _e = "HEAD", Y = "GET", ke = "OPTIONS", ct = "POST", lt = "PUT", ut = "PATCH", ht = "DELETE";
354
- function dt(r, t) {
354
+ var R = "object", xe = "function", Te = "prototype", re = "text", he = "json", ve = "abort", oe = "paramsSerializer", Ee = "addEventListener", N = "status", k = "headers", ee = Object, P = void 0, W = null, ie = ee[Te], X = ee.keys, D = Array.isArray, we = "method", De = "HEAD", le = "GET", Oe = "OPTIONS", Kt = "POST", xt = "PUT", Tt = "PATCH", Dt = "DELETE";
355
+ function Ot(r, t) {
355
356
  let e = new AbortController();
356
- function n(a) {
357
- e.abort(a), i();
357
+ function n(i) {
358
+ e.abort(i), o();
358
359
  }
359
360
  let s = [];
360
- for (let a of r) {
361
- if ((a == null ? void 0 : a.aborted) === !0) {
362
- n(a.reason);
361
+ for (let i of r) {
362
+ if ((i == null ? void 0 : i.aborted) === !0) {
363
+ n(i.reason);
363
364
  break;
364
365
  }
365
- if (a != null && a[ue]) {
366
- let c = () => {
367
- n(a.reason);
366
+ if (i != null && i[Ee]) {
367
+ let l = () => {
368
+ n(i.reason);
368
369
  };
369
370
  s.push(() => {
370
- var d;
371
- (d = a.removeEventListener) == null || d.call(a, le, c);
372
- }), a[ue](le, c);
371
+ var h;
372
+ (h = i.removeEventListener) == null || h.call(i, ve, l);
373
+ }), i[Ee](ve, l);
373
374
  }
374
375
  }
375
- function i() {
376
- s.forEach((a) => a()), t == null || t();
376
+ function o() {
377
+ s.forEach((i) => i()), t == null || t();
377
378
  }
378
- let o = e.signal;
379
- return o.clear = i, o;
379
+ let a = e.signal;
380
+ return a.clear = o, a;
380
381
  }
381
- var de = W.getPrototypeOf, ge = (r) => {
382
- if (r !== N && typeof r === I) {
383
- if (typeof de === Ee) {
384
- let t = de(r);
385
- return t === Q || t === N;
382
+ var ke = ee.getPrototypeOf, Ie = (r) => {
383
+ if (r !== W && typeof r === R) {
384
+ if (typeof ke === xe) {
385
+ let t = ke(r);
386
+ return t === ie || t === W;
386
387
  }
387
- return Q.toString.call(r) === `[${I} Object]`;
388
+ return ie.toString.call(r) === `[${R} Object]`;
388
389
  }
389
390
  return !1;
390
- }, ne = (...r) => r.reduce((t, e) => {
391
- if (M(e)) throw new TypeError(`Arguments must be ${I}s, not arrays.`);
392
- return j(e).forEach((n) => {
393
- ["__proto__", "constructor", we].includes(n) || (M(t[n]) && M(e[n]) ? t[n] = Array.from(new Set(t[n].concat(e[n]))) : ge(t[n]) && ge(e[n]) ? t[n] = ne(t[n], e[n]) : t[n] = e[n]);
391
+ }, ge = (...r) => r.reduce((t, e) => {
392
+ if (D(e)) throw new TypeError(`Arguments must be ${R}s, not arrays.`);
393
+ return X(e).forEach((n) => {
394
+ ["__proto__", "constructor", Te].includes(n) || (D(t[n]) && D(e[n]) ? t[n] = Array.from(new Set(t[n].concat(e[n]))) : Ie(t[n]) && Ie(e[n]) ? t[n] = ge(t[n], e[n]) : t[n] = e[n]);
394
395
  }), t;
395
396
  }, {});
396
- function se(r, t = !0, e = N, n) {
397
- if (r === _ || r === N) return "";
398
- let s = [], i = t ? encodeURIComponent : (g) => g, o = M(r), { arrayFormat: a, allowDots: c, serializeDate: d } = n || {}, h = (g) => {
399
- if (c && !o) return `.${g}`;
400
- if (o) {
401
- if (a === "brackets") return "[]";
402
- if (a === "repeat") return "";
397
+ function pe(r, t = !0, e = W, n) {
398
+ if (r === P || r === W) return "";
399
+ let s = [], o = t ? encodeURIComponent : (p) => p, a = D(r), { arrayFormat: i, allowDots: l, serializeDate: h } = n || {}, g = (p) => {
400
+ if (l && !a) return `.${p}`;
401
+ if (a) {
402
+ if (i === "brackets") return "[]";
403
+ if (i === "repeat") return "";
403
404
  }
404
- return `[${g}]`;
405
+ return `[${p}]`;
405
406
  };
406
- for (let g in r) if (Q.hasOwnProperty.call(r, g)) {
407
- let u = r[g];
408
- if (u !== _) {
409
- let y = e ? `${e}${h(g)}` : i(g);
410
- if (!isNaN(u) && u instanceof Date && (u = d ? d(u) : u.toISOString()), typeof u === I) {
411
- let f = se(u, t, y, n);
407
+ for (let p in r) if (ie.hasOwnProperty.call(r, p)) {
408
+ let d = r[p];
409
+ if (d !== P) {
410
+ let m = e ? `${e}${g(p)}` : o(p);
411
+ if (!isNaN(d) && d instanceof Date && (d = h ? h(d) : d.toISOString()), typeof d === R) {
412
+ let f = pe(d, t, m, n);
412
413
  f !== "" && s.push(f);
413
- } else s.push(`${i(y)}=${i(u)}`);
414
+ } else s.push(`${o(m)}=${o(d)}`);
414
415
  }
415
416
  }
416
417
  return s.join("&");
417
418
  }
418
- function Z(r) {
419
- return M(r) ? r.map(Z) : (r && typeof r === I && j(r).forEach((t) => {
419
+ function ce(r) {
420
+ return D(r) ? r.map(ce) : (r && typeof r === R && X(r).forEach((t) => {
420
421
  let e = r[t];
421
- e === _ ? delete r[t] : Z(e);
422
+ e === P ? delete r[t] : ce(e);
422
423
  }), r);
423
424
  }
424
- function gt(r) {
425
+ function Lt(r) {
425
426
  return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(r);
426
427
  }
427
- function ft(r, t) {
428
+ function Ft(r, t) {
428
429
  return r ? t ? (r.endsWith("/") ? r : r + "/") + (t[0] === "/" ? t.slice(1) : t) : r : t || "";
429
430
  }
430
- var pt = "XiorError", yt = "XiorTimeoutError", Pe = class extends Error {
431
- constructor(r, t, e) {
432
- super(r), this.name = pt, this.request = t, this.config = t, this.response = e;
431
+ var Bt = "XiorError", Gt = "XiorTimeoutError", Le = class extends Error {
432
+ constructor(t, e, n) {
433
+ super(t), this.name = Bt, this.request = e, this.config = e, this.response = n;
433
434
  }
434
- }, mt = class extends Pe {
435
+ }, Ht = class extends Le {
435
436
  constructor(t, e, n) {
436
- super(t, e, n), this.name = yt;
437
+ super(t, e, n), this.name = Gt;
437
438
  }
438
- }, vt = Object.defineProperty, bt = Object.defineProperties, Et = Object.getOwnPropertyDescriptors, U = Object.getOwnPropertySymbols, Ie = Object.prototype.hasOwnProperty, Ce = Object.prototype.propertyIsEnumerable, fe = (r, t, e) => t in r ? vt(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e, A = (r, t) => {
439
- for (var e in t || (t = {})) Ie.call(t, e) && fe(r, e, t[e]);
440
- if (U) for (var e of U(t)) Ce.call(t, e) && fe(r, e, t[e]);
439
+ }, Nt = Object.defineProperty, jt = Object.defineProperties, Ut = Object.getOwnPropertyDescriptors, Y = Object.getOwnPropertySymbols, Fe = Object.prototype.hasOwnProperty, Be = Object.prototype.propertyIsEnumerable, Ce = (r, t, e) => t in r ? Nt(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e, O = (r, t) => {
440
+ for (var e in t || (t = {})) Fe.call(t, e) && Ce(r, e, t[e]);
441
+ if (Y) for (var e of Y(t)) Be.call(t, e) && Ce(r, e, t[e]);
441
442
  return r;
442
- }, $ = (r, t) => bt(r, Et(t)), wt = (r, t) => {
443
+ }, z = (r, t) => jt(r, Ut(t)), zt = (r, t) => {
443
444
  var e = {};
444
- for (var n in r) Ie.call(r, n) && t.indexOf(n) < 0 && (e[n] = r[n]);
445
- if (r != null && U) for (var n of U(r)) t.indexOf(n) < 0 && Ce.call(r, n) && (e[n] = r[n]);
445
+ for (var n in r) Fe.call(r, n) && t.indexOf(n) < 0 && (e[n] = r[n]);
446
+ if (r != null && Y) for (var n of Y(r)) t.indexOf(n) < 0 && Be.call(r, n) && (e[n] = r[n]);
446
447
  return e;
447
- }, T = (r, t, e) => new Promise((n, s) => {
448
- var i = (c) => {
448
+ }, L = (r, t, e) => new Promise((n, s) => {
449
+ var o = (l) => {
449
450
  try {
450
- a(e.next(c));
451
- } catch (d) {
452
- s(d);
451
+ i(e.next(l));
452
+ } catch (h) {
453
+ s(h);
453
454
  }
454
- }, o = (c) => {
455
+ }, a = (l) => {
455
456
  try {
456
- a(e.throw(c));
457
- } catch (d) {
458
- s(d);
457
+ i(e.throw(l));
458
+ } catch (h) {
459
+ s(h);
459
460
  }
460
- }, a = (c) => c.done ? n(c.value) : Promise.resolve(c.value).then(i, o);
461
- a((e = e.apply(r, t)).next());
462
- }), ie = "application/", Se = `${ie}x-www-form-urlencoded`, Re = RegExp, _t = new Re(`^${Se}`, "i"), kt = `${ie}${re}`, Pt = new Re(`^${ie}.*${re}.*`, "i");
463
- function It(r = Y) {
464
- return [_e, Y, ke].includes(r);
461
+ }, i = (l) => l.done ? n(l.value) : Promise.resolve(l.value).then(o, a);
462
+ i((e = e.apply(r, t)).next());
463
+ }), fe = "application/", Ge = `${fe}x-www-form-urlencoded`, He = RegExp, Vt = new He(`^${Ge}`, "i"), qt = `${fe}${he}`, Wt = new He(`^${fe}.*${he}.*`, "i");
464
+ function Xt(r = le) {
465
+ return [De, le, Oe].includes(r);
465
466
  }
466
- var Ct = typeof URLSearchParams != `${_}`;
467
- function St(r) {
468
- return T(this, null, function* () {
469
- let t = r[J] || se, e = r.encodeURI !== !1, n = r[he] && r[he].toUpperCase(), s = r.url, i = s, o = Ct && r.data instanceof URLSearchParams, a = o ? W.fromEntries(r.data.entries()) : r.data, c = a, d = r != null && r[v] ? A({}, r[v]) : {}, h = r.params, g = It(n);
470
- if (a && typeof a.append !== Ee) {
471
- let u = "", y = "content-type";
472
- if (r != null && r[v]) {
473
- let f = j(r[v]).find((E) => E.toLowerCase() === y);
474
- f && (y = f, u = r[v][f]);
467
+ var Yt = typeof URLSearchParams != `${P}`;
468
+ function Jt(r) {
469
+ return L(this, null, function* () {
470
+ let t = r[oe] || pe, e = r.encodeURI !== !1, n = r[we] && r[we].toUpperCase(), s = r.url, o = s, a = Yt && r.data instanceof URLSearchParams, i = a ? ee.fromEntries(r.data.entries()) : r.data, l = i, h = r != null && r[k] ? O({}, r[k]) : {}, g = r.params, p = Xt(n);
471
+ if (i && typeof i.append !== xe) {
472
+ let d = "", m = "content-type";
473
+ if (r != null && r[k]) {
474
+ let f = X(r[k]).find((w) => w.toLowerCase() === m);
475
+ f && (m = f, d = r[k][f]);
475
476
  }
476
- (!u || o) && (u = g || o ? Se : kt, d[y] = u), typeof a === I && (g && h && (h = ne(a, h)), Pt.test(u) ? c = JSON.stringify(Z(a)) : !g && _t.test(u) && (c = t(a)));
477
+ (!d || a) && (d = p || a ? Ge : qt, h[m] = d), typeof i === R && (p && g && (g = ge(i, g)), Wt.test(d) ? l = JSON.stringify(ce(i)) : !p && Vt.test(d) && (l = t(i)));
477
478
  }
478
- if (h && j(h).length > 0) {
479
- let u = t(h, e);
480
- s += s.includes("?") ? `&${u}` : `?${u}`;
479
+ if (g && X(g).length > 0) {
480
+ let d = t(g, e);
481
+ s += s.includes("?") ? `&${d}` : `?${d}`;
481
482
  }
482
- return $(A({}, r), { _data: c, _url: s, data: a, url: i, method: n, [v]: d, isGet: g });
483
+ return z(O({}, r), { _data: l, _url: s, data: i, url: o, method: n, [k]: h, isGet: p });
483
484
  });
484
485
  }
485
- var Rt = typeof AbortController != `${_}`;
486
- function Mt(r, t) {
487
- return T(this, null, function* () {
486
+ var Qt = typeof AbortController != `${P}`;
487
+ function Zt(r, t) {
488
+ return L(this, null, function* () {
488
489
  let e;
489
- if (!t || !r.ok || [q, re].includes(t)) {
490
- if (e = yield r[q](), e && t !== q) try {
490
+ if (!t || !r.ok || [re, he].includes(t)) {
491
+ if (e = yield r[re](), e && t !== re) try {
491
492
  e = JSON.parse(e);
492
493
  } catch {
493
494
  }
@@ -498,9 +499,9 @@ function Mt(r, t) {
498
499
  return e;
499
500
  });
500
501
  }
501
- var At = (r) => new P(r), P = class {
502
+ var en = (r) => new A(r), A = class {
502
503
  constructor(t) {
503
- this.REQI = [], this.RESI = [], this.P = [], this.config = t, this.defaults = { params: {}, [v]: {} };
504
+ this.REQI = [], this.RESI = [], this.P = [], this.config = t, this.defaults = { params: {}, [k]: {} };
504
505
  }
505
506
  get interceptors() {
506
507
  return { request: { use: (t, e, n) => (this.REQI.push(t), t), eject: (t) => {
@@ -521,196 +522,209 @@ var At = (r) => new P(r), P = class {
521
522
  } };
522
523
  }
523
524
  request(t) {
524
- return T(this, null, function* () {
525
- let e = ne(this.config || {}, this.defaults, typeof t == "string" ? { url: t } : t), n = "credentials";
526
- e.withCredentials && !e[n] && (e[n] = "include"), e[J] || (e[J] = se);
527
- for (let o of this.REQI) e = yield o(e);
525
+ return L(this, null, function* () {
526
+ let e = ge(this.config || {}, this.defaults, typeof t == "string" ? { url: t } : t), n = "credentials";
527
+ e.withCredentials && !e[n] && (e[n] = "include"), e[oe] || (e[oe] = pe);
528
+ for (let a of this.REQI) e = yield a(e);
528
529
  let s = this._.bind(this);
529
- this.P.forEach((o) => {
530
- s = o(s, this);
530
+ this.P.forEach((a) => {
531
+ s = a(s, this);
531
532
  });
532
- let i = s(e);
533
+ let o = s(e);
533
534
  if (!e._did) {
534
- let o = 0, a = [];
535
- for (this.RESI.forEach(function(c) {
536
- a.push(c.fn, c.onRejected);
537
- }); a.length > o; ) i = i.then(a[o++], a[o++]);
535
+ let a = 0, i = [];
536
+ for (this.RESI.forEach(function(l) {
537
+ i.push(l.fn, l.onRejected);
538
+ }); i.length > a; ) o = o.then(i[a++], i[a++]);
538
539
  }
539
- return i;
540
+ return o;
540
541
  });
541
542
  }
542
543
  _(t) {
543
- return T(this, null, function* () {
544
- let e = yield St(t), { url: n, method: s, headers: i, timeout: o, signal: a, data: c, _data: d, _url: h, isGet: g, fetch: u } = e, y = wt(e, ["url", "method", "headers", "timeout", "signal", "data", "_data", "_url", "isGet", "fetch"]);
545
- t._url = h;
546
- let f, E = [], x = _;
547
- if (o && Rt) {
548
- let m = new AbortController();
549
- x = setTimeout(() => {
550
- m.abort(new mt(`timeout of ${o}ms exceeded`, t));
551
- }, o), E.push(m.signal);
544
+ return L(this, null, function* () {
545
+ let e = yield Jt(t), { url: n, method: s, headers: o, timeout: a, signal: i, data: l, _data: h, _url: g, isGet: p, fetch: d } = e, m = zt(e, ["url", "method", "headers", "timeout", "signal", "data", "_data", "_url", "isGet", "fetch"]);
546
+ t._url = g;
547
+ let f, w = [], G = P;
548
+ if (a && Qt) {
549
+ let v = new AbortController();
550
+ G = setTimeout(() => {
551
+ v.abort(new Ht(`timeout of ${a}ms exceeded`, t));
552
+ }, a), w.push(v.signal);
552
553
  }
553
- a && E.push(a), f = E[0], E.length > 1 && (f = dt(E, () => {
554
- clearTimeout(x);
554
+ i && w.push(i), f = w[0], w.length > 1 && (f = Ot(w, () => {
555
+ clearTimeout(G);
555
556
  }));
556
- let K = h || n, ae = "baseURL";
557
- return t[ae] && !gt(K) && (K = ft(t[ae], K)), (u || fetch)(K, $(A({ body: g ? _ : d }, y), { signal: f, method: s, headers: i })).then((m) => T(this, null, function* () {
558
- let { responseType: Te } = t, ce = { data: yield Mt(m, Te), response: m, config: t, request: t, [O]: m[O], statusText: m.statusText, [v]: m[v] };
559
- if (!m.ok) {
560
- let De = new Pe(m[O] ? `Request failed with status code ${m[O]}` : "Network error", t, ce);
561
- return Promise.reject(De);
557
+ let H = g || n, _e = "baseURL";
558
+ return t[_e] && !Lt(H) && (H = Ft(t[_e], H)), (d || fetch)(H, z(O({ body: p ? P : h }, m), { signal: f, method: s, headers: o })).then((v) => L(this, null, function* () {
559
+ let { responseType: st } = t, be = { data: yield Zt(v, st), response: v, config: t, request: t, [N]: v[N], statusText: v.statusText, [k]: v[k] };
560
+ if (!v.ok) {
561
+ let at = new Le(v[N] ? `Request failed with status code ${v[N]}` : "Network error", t, be);
562
+ return Promise.reject(at);
562
563
  }
563
- return ce;
564
+ return be;
564
565
  })).finally(() => {
565
- var m;
566
- x && clearTimeout(x), (m = f == null ? void 0 : f.clear) == null || m.call(f);
566
+ var v;
567
+ G && clearTimeout(G), (v = f == null ? void 0 : f.clear) == null || v.call(f);
567
568
  });
568
569
  });
569
570
  }
570
571
  cG(t) {
571
- return (e, n) => this.request(n ? $(A({}, n), { method: t, url: e }) : { method: t, url: e });
572
+ return (e, n) => this.request(n ? z(O({}, n), { method: t, url: e }) : { method: t, url: e });
572
573
  }
573
574
  cP(t) {
574
- return (e, n, s) => this.request(s ? $(A({}, s), { method: t, url: e, data: n }) : { method: t, url: e, data: n });
575
+ return (e, n, s) => this.request(s ? z(O({}, s), { method: t, url: e, data: n }) : { method: t, url: e, data: n });
575
576
  }
576
577
  get(t, e) {
577
- return this.cG(Y)(t, e);
578
+ return this.cG(le)(t, e);
578
579
  }
579
580
  head(t, e) {
580
- return this.cG(_e)(t, e);
581
+ return this.cG(De)(t, e);
581
582
  }
582
583
  post(t, e, n) {
583
- return this.cP(ct)(t, e, n);
584
+ return this.cP(Kt)(t, e, n);
584
585
  }
585
586
  put(t, e, n) {
586
- return this.cP(lt)(t, e, n);
587
+ return this.cP(xt)(t, e, n);
587
588
  }
588
589
  patch(t, e, n) {
589
- return this.cP(ut)(t, e, n);
590
+ return this.cP(Tt)(t, e, n);
590
591
  }
591
592
  delete(t, e) {
592
- return this.cG(ht)(t, e);
593
+ return this.cG(Dt)(t, e);
593
594
  }
594
595
  options(t, e) {
595
- return this.cG(ke)(t, e);
596
+ return this.cG(Oe)(t, e);
596
597
  }
597
598
  };
598
- P.create = At, P.VERSION = "0.7.7";
599
- var Tt = Object.assign(P.create(), { create: P.create, VERSION: P.VERSION }), Me = Tt;
600
- const Ae = Me.create({
601
- baseURL: "https://updater.overlayed.gg",
599
+ A.create = en, A.VERSION = "0.7.7";
600
+ var tn = Object.assign(A.create(), { create: A.create, VERSION: A.VERSION }), Ne = tn;
601
+ const je = Ne.create({
602
+ baseURL: "https://updater.stats.cc",
602
603
  headers: {
603
604
  Accept: "application/json",
604
605
  "Accept-Encoding": "gzip, deflate, br"
605
606
  }
606
- }), oe = Me.create({
607
- baseURL: "https://api.overlayed.gg",
607
+ }), ye = Ne.create({
608
+ baseURL: "https://api.stats.cc",
608
609
  headers: {
609
610
  Accept: "application/json",
610
611
  "Accept-Encoding": "gzip, deflate, br"
611
612
  }
612
613
  });
613
- function Dt(r, t) {
614
- return Ae.get(`/v1/native/${r}/version.txt`, {
614
+ function nn(r, t) {
615
+ return je.get(`/v1/native/${r}/version.txt`, {
615
616
  params: { channel: t },
616
617
  responseType: "text"
617
618
  });
618
619
  }
619
- function Ft(r, t) {
620
- return Ae.get(`/v1/native/${r}/files`, {
620
+ function rn(r, t) {
621
+ return je.get(`/v1/native/${r}/files`, {
621
622
  params: { channel: t },
622
623
  responseType: "arraybuffer"
623
624
  });
624
625
  }
625
- function xt() {
626
- return oe.get("/v1/raven/config");
626
+ function sn() {
627
+ return ye.get("/v1/raven/config");
627
628
  }
628
- function Kt(r, t) {
629
- return oe.get(`/v1/raven/games/${r}/builds/${t}/check`);
629
+ function an(r, t) {
630
+ return ye.get(`/v1/raven/games/${r}/builds/${t}/check`);
630
631
  }
631
- function Lt(r, t) {
632
+ function on(r, t) {
632
633
  const e = new FormData();
633
- return e.append("file", t), oe.post(`/v1/raven/games/${r}/builds/upload`, e, {});
634
+ return e.append("file", t), ye.post(`/v1/raven/games/${r}/builds/upload`, e, {});
634
635
  }
635
- function Ot(r) {
636
+ function ln(r) {
636
637
  return r instanceof Error && (r.name === "XiorError" || r.name === "XiorTimeoutError");
637
638
  }
638
- function $t(r) {
639
+ function cn(r) {
639
640
  return !!(r && "kind" in r.data && "message" in r.data);
640
641
  }
641
- class Ht extends C {
642
+ const dn = {
643
+ buildChannel: "alpha"
644
+ };
645
+ class un extends x {
642
646
  constructor() {
643
647
  super("NativeDllManager");
644
- l(this, "UPDATE_CHECK_INTERVAL_MS", 1e3 * 60 * 5);
648
+ c(this, "UPDATE_CHECK_INTERVAL_MS", 1e3 * 60 * 5);
645
649
  // 5 minutes
646
- l(this, "targetDir");
647
- l(this, "updateInterval");
648
- this.targetDir = p.join(F, "resources"), this.logger.log("Target directory", this.targetDir);
650
+ c(this, "targetDir");
651
+ c(this, "updateInterval");
652
+ this.targetDir = _.join(B, "resources"), this.logger.log("Target directory", this.targetDir);
649
653
  }
650
654
  async initWithDlls(e) {
651
- super.init(), await b.mkdir(this.targetDir, { recursive: !0 }), await this.checkForUpdates(e), clearInterval(this.updateInterval), this.updateInterval = setInterval(() => this.checkForUpdates(e), this.UPDATE_CHECK_INTERVAL_MS);
655
+ super.init(), await E.mkdir(this.targetDir, { recursive: !0 }), await this.checkForUpdates(e), clearInterval(this.updateInterval), this.updateInterval = setInterval(() => this.checkForUpdates(e), this.UPDATE_CHECK_INTERVAL_MS);
652
656
  }
653
657
  destroy() {
654
658
  this.updateInterval && (clearInterval(this.updateInterval), this.updateInterval = void 0), super.destroy();
655
659
  }
656
660
  async getCurrentVersion(e) {
657
661
  try {
658
- const n = p.join(this.targetDir, e, "version.txt");
659
- return await b.readFile(n, "utf-8");
662
+ const n = _.join(this.targetDir, e, "version.txt");
663
+ return await E.readFile(n, "utf-8");
660
664
  } catch {
661
665
  return null;
662
666
  }
663
667
  }
664
668
  getTargetPath(e) {
665
- return p.join(this.targetDir, e);
669
+ return _.join(this.targetDir, e);
666
670
  }
667
671
  getTargetVersionPath(e, n) {
668
- return p.join(this.getTargetPath(e), n);
672
+ return _.join(this.getTargetPath(e), n);
669
673
  }
670
674
  async checkForUpdates(e) {
671
- const n = ot.buildChannel;
675
+ const n = dn.buildChannel;
672
676
  this.logger.log("Checking for updates");
673
677
  for (const s of e)
674
678
  try {
675
- const { data: i } = await Dt(s, n), o = await this.getCurrentVersion(s);
676
- this.logger.log(`${s} > Update Check. current: ${o}, latest: ${i}`), i !== o ? (this.logger.log(`${s} > Update found: ${o} -> ${i}`), await this.downloadAndExtractDll(s, i, n), this.logger.log(`${s} > Downloaded and extracted`), await this.cleanupOldVersions(s, i), this.logger.log(`${s} > Cleaning up versions older than ${i}`), this.emit("dllUpdated", { identifier: s, version: i })) : this.logger.log(`${s} Up to date`);
677
- } catch (i) {
678
- this.logger.captureSentryException(`${s} > Error checking/updating`, i);
679
+ const { data: o } = await nn(s, n), a = await this.getCurrentVersion(s);
680
+ this.logger.log(`${s} > Update Check. current: ${a}, latest: ${o}`);
681
+ const i = o !== a;
682
+ this.logger.log(`${s} > Update found: ${a} -> ${o}`), await this.downloadAndExtractDll(s, o, n, i), this.logger.log(`${s} > Downloaded and extracted`), i && (this.logger.log(`${s} > Cleaning up versions older than ${o}`), await this.cleanupOldVersions(s, o)), this.emit("dllUpdated", { identifier: s, version: o });
683
+ } catch (o) {
684
+ this.logger.captureSentryException(`${s} > Error checking/updating`, o);
679
685
  }
680
686
  }
681
- async downloadAndExtractDll(e, n, s) {
682
- const { data: i } = await Ft(e, s), o = this.getTargetPath(e), a = this.getTargetVersionPath(e, n);
683
- await b.mkdir(a, { recursive: !0 });
684
- const c = new me();
685
- await c.loadAsync(i);
686
- const d = Object.keys(c.files).map(async (g) => {
687
- const u = c.files[g];
688
- if (u && !u.dir) {
689
- const y = await u.async("nodebuffer"), f = p.join(a, g);
690
- await b.writeFile(f, y);
687
+ async downloadAndExtractDll(e, n, s, o) {
688
+ const { data: a } = await rn(e, s), i = this.getTargetPath(e), l = this.getTargetVersionPath(e, n);
689
+ await E.mkdir(l, { recursive: !0 });
690
+ const h = new Me();
691
+ await h.loadAsync(a);
692
+ const g = Object.keys(h.files).map(async (d) => {
693
+ const m = h.files[d];
694
+ if (m && !m.dir) {
695
+ const f = _.join(l, d);
696
+ if (!o)
697
+ try {
698
+ await E.access(f, E.constants.F_OK);
699
+ return;
700
+ } catch {
701
+ this.logger.warn(`${e} > File missing, re-downloading: ${f}`);
702
+ }
703
+ const w = await m.async("nodebuffer");
704
+ await E.writeFile(f, w);
691
705
  }
692
706
  });
693
- await Promise.all(d);
694
- const h = p.join(o, "version.txt");
695
- this.logger.log("Saving version file", h), await b.writeFile(h, n);
707
+ await Promise.all(g);
708
+ const p = _.join(i, "version.txt");
709
+ this.logger.log("Saving version file", p), await E.writeFile(p, n);
696
710
  }
697
711
  async cleanupOldVersions(e, n) {
698
- const s = p.join(this.targetDir, e), i = await b.readdir(s, { withFileTypes: !0 });
699
- for (const o of i)
700
- o.isDirectory() && o.name !== n && await b.rm(p.join(s, o.name), { recursive: !0, force: !0 });
712
+ const s = _.join(this.targetDir, e), o = await E.readdir(s, { withFileTypes: !0 });
713
+ for (const a of o)
714
+ a.isDirectory() && a.name !== n && await E.rm(_.join(s, a.name), { recursive: !0, force: !0 });
701
715
  }
702
716
  }
703
- const B = k(Ht);
704
- class Nt extends C {
717
+ const J = I(un);
718
+ class hn extends x {
705
719
  constructor() {
706
720
  super("RavenManager");
707
- l(this, "REFETCH_INTERVAL", 1e3 * 60 * 5);
708
- l(this, "FAILED_REFETCH_INTERVAL", 1e3 * 30);
709
- l(this, "_ravenConfig");
710
- l(this, "_executableToGameMap", /* @__PURE__ */ new Map());
711
- l(this, "_executablesArray", []);
712
- l(this, "_refetchIntervalHandler", null);
713
- l(this, "_failedRefetchTimeoutHandler", null);
721
+ c(this, "REFETCH_INTERVAL", 1e3 * 60 * 5);
722
+ c(this, "FAILED_REFETCH_INTERVAL", 1e3 * 30);
723
+ c(this, "_ravenConfig");
724
+ c(this, "_executableToGameMap", /* @__PURE__ */ new Map());
725
+ c(this, "_executablesArray", []);
726
+ c(this, "_refetchIntervalHandler", null);
727
+ c(this, "_failedRefetchTimeoutHandler", null);
714
728
  }
715
729
  init() {
716
730
  super.init(), this.fetchRavenConfig(), this._refetchIntervalHandler = setInterval(() => {
@@ -727,21 +741,21 @@ class Nt extends C {
727
741
  return this._executableToGameMap;
728
742
  }
729
743
  destroy() {
730
- this._refetchIntervalHandler && clearInterval(this._refetchIntervalHandler), this._failedRefetchTimeoutHandler && clearTimeout(this._failedRefetchTimeoutHandler), B.getInstance().destroy(), super.destroy();
744
+ this._refetchIntervalHandler && clearInterval(this._refetchIntervalHandler), this._failedRefetchTimeoutHandler && clearTimeout(this._failedRefetchTimeoutHandler), J.getInstance().destroy(), super.destroy();
731
745
  }
732
746
  async fetchRavenConfig() {
733
747
  try {
734
- const e = await xt();
748
+ const e = await sn();
735
749
  this._ravenConfig = e.data, this.resetState();
736
750
  const n = /* @__PURE__ */ new Set();
737
751
  for (const s of this._ravenConfig.games) {
738
- for (const i of s.executables) {
739
- const o = i.toLowerCase();
740
- this._executableToGameMap.set(o, s), this._executablesArray.push(o);
752
+ for (const o of s.executables) {
753
+ const a = o.toLowerCase();
754
+ this._executableToGameMap.set(a, s), this._executablesArray.push(a);
741
755
  }
742
- s.dlls_to_inject.forEach((i) => n.add(i));
756
+ s.dlls_to_inject.forEach((o) => n.add(o));
743
757
  }
744
- await B.getInstance().initWithDlls(Array.from(n)), this.logger.log("Raven updated", this._ravenConfig), this.emit("executablesUpdated", { executables: this.executables, map: this._executableToGameMap });
758
+ await J.getInstance().initWithDlls(Array.from(n)), this.logger.log("Raven updated", this._ravenConfig), this.emit("executablesUpdated", { executables: this.executables, map: this._executableToGameMap });
745
759
  } catch (e) {
746
760
  this.logger.captureSentryException("Failed to fetch Raven config", e), this._failedRefetchTimeoutHandler = setTimeout(() => this.fetchRavenConfig(), this.FAILED_REFETCH_INTERVAL);
747
761
  }
@@ -750,14 +764,14 @@ class Nt extends C {
750
764
  this._executableToGameMap.clear(), this._executablesArray = [];
751
765
  }
752
766
  }
753
- const G = k(Nt);
754
- class jt extends C {
767
+ const Q = I(hn), gn = ue(import.meta.url), { PipeEventServer: Dr, PipeEventClient: Or, PipeEventBase: Lr, ProcessMonitor: pn, Process: j, InjectionMethod: Fr, AccessLevel: Br } = gn("./build/overlayed_native_interface_x64.node");
768
+ class fn extends x {
755
769
  constructor() {
756
770
  super("ProcessManager");
757
- l(this, "_processMonitor");
758
- l(this, "_processes", /* @__PURE__ */ new Map());
759
- l(this, "boundOnRavenManagerExecutablesUpdated", this.onRavenManagerExecutablesUpdated.bind(this));
760
- this._processMonitor = new Oe();
771
+ c(this, "_processMonitor");
772
+ c(this, "_processes", /* @__PURE__ */ new Map());
773
+ c(this, "boundOnRavenManagerExecutablesUpdated", this.onRavenManagerExecutablesUpdated.bind(this));
774
+ this._processMonitor = new pn();
761
775
  }
762
776
  get hasAnyActiveProcesses() {
763
777
  return this.activeProcesses.length > 0;
@@ -766,14 +780,14 @@ class jt extends C {
766
780
  return Array.from(this._processes.values()).flat().filter((e) => !e.destroyedAt);
767
781
  }
768
782
  init() {
769
- super.init(), G.getInstance().on("executablesUpdated", this.boundOnRavenManagerExecutablesUpdated), this._processMonitor.on("create", (e) => {
783
+ super.init(), Q.getInstance().on("executablesUpdated", this.boundOnRavenManagerExecutablesUpdated), this._processMonitor.on("create", (e) => {
770
784
  this.logger.log("Process created", e), this.addProcess(e), this.logger.log(`Active Process Count: ${this._processes.size}`), this.emit("create", { process: e });
771
785
  }), this._processMonitor.on("destroy", (e) => {
772
786
  this.logger.log("Process destroyed", e), this.deleteProcess(e), this.logger.log(`Active Process Count: ${this._processes.size}`), this.emit("destroy", { process: e });
773
787
  });
774
788
  }
775
789
  destroy() {
776
- G.getInstance().off("executablesUpdated", this.boundOnRavenManagerExecutablesUpdated), this._processes.clear(), this._processMonitor.removeAllListeners(), super.destroy();
790
+ Q.getInstance().off("executablesUpdated", this.boundOnRavenManagerExecutablesUpdated), this._processes.clear(), this._processMonitor.removeAllListeners(), super.destroy();
777
791
  }
778
792
  isProcessRunning(e) {
779
793
  const n = this._processes.get(e);
@@ -797,15 +811,15 @@ class jt extends C {
797
811
  deleteProcess(e) {
798
812
  if (!e.name)
799
813
  return;
800
- const n = this._processes.get(e.name), s = (n == null ? void 0 : n.filter((i) => i.id !== e.id)) ?? [];
814
+ const n = this._processes.get(e.name), s = (n == null ? void 0 : n.filter((o) => o.id !== e.id)) ?? [];
801
815
  s.length === 0 ? this._processes.delete(e.name) : this._processes.set(e.name, s);
802
816
  }
803
817
  }
804
- const S = k(jt);
805
- var Ut = Object.defineProperty, Bt = (r, t, e) => t in r ? Ut(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e, H = (r, t, e) => Bt(r, typeof t != "symbol" ? t + "" : t, e);
806
- class Gt {
818
+ const M = I(fn), yn = ue(import.meta.url), { RenderInterface: mn, renderHookPath: Gr } = yn("./build/overlayed_render_interface_x64.node");
819
+ var _n = Object.defineProperty, bn = (r, t, e) => t in r ? _n(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e, V = (r, t, e) => bn(r, typeof t != "symbol" ? t + "" : t, e);
820
+ let vn = class {
807
821
  constructor(t) {
808
- H(this, "_instance"), H(this, "_resolution"), H(this, "boundOnResolutionChanged", this.onResolutionChanged.bind(this)), this._instance = t, this._resolution = { width: 0, height: 0 }, this._instance.on("resolution", this.boundOnResolutionChanged);
822
+ V(this, "_instance"), V(this, "_resolution"), V(this, "boundOnResolutionChanged", this.onResolutionChanged.bind(this)), this._instance = t, this._resolution = { width: 0, height: 0 }, this._instance.on("resolution", this.boundOnResolutionChanged);
809
823
  }
810
824
  destroy() {
811
825
  this._instance.off("resolution", this.boundOnResolutionChanged);
@@ -819,42 +833,41 @@ class Gt {
819
833
  onResolutionChanged(t, e) {
820
834
  this._resolution = { width: t, height: e };
821
835
  }
822
- }
823
- class Vt {
836
+ }, En = class {
824
837
  constructor() {
825
- H(this, "interfaces", {});
838
+ V(this, "interfaces", {});
826
839
  }
827
840
  createInterface(t) {
828
- return this.interfaces[t] ? this.interfaces[t] : (this.interfaces[t] = new Gt(new Ue(t, { access: 1 })), this.interfaces[t]);
841
+ return this.interfaces[t] ? this.interfaces[t] : (this.interfaces[t] = new vn(new mn(t, { access: 1 })), this.interfaces[t]);
829
842
  }
830
843
  getInterface(t) {
831
844
  return this.interfaces[t] ? this.interfaces[t] : this.createInterface(t);
832
845
  }
833
- }
834
- const ee = k(Vt);
835
- class zt extends C {
846
+ };
847
+ const F = I(En);
848
+ class wn extends x {
836
849
  constructor() {
837
850
  super("GameLaunchManager");
838
- l(this, "RENDER_INTERFACE_PATH", "./native-modules/render-interface/build/statscc_render_hook_x64.dll");
839
- l(this, "boundOnProcessCreate", this.onProcessCreate.bind(this));
840
- l(this, "boundOnProcessDestroy", this.onProcessDestroy.bind(this));
851
+ c(this, "RENDER_INTERFACE_PATH", "node_modules/@overlayed/app/dist/render-interface/build/overlayed_render_hook_x64.dll");
852
+ c(this, "boundOnProcessCreate", this.onProcessCreate.bind(this));
853
+ c(this, "boundOnProcessDestroy", this.onProcessDestroy.bind(this));
841
854
  }
842
855
  init() {
843
- super.init(), ee.getInstance().createInterface("SCC_RAINBOW"), S.getInstance().on("create", this.boundOnProcessCreate), S.getInstance().on("destroy", this.boundOnProcessDestroy);
856
+ super.init(), F.getInstance().createInterface("SCC_RAINBOW"), M.getInstance().on("create", this.boundOnProcessCreate), M.getInstance().on("destroy", this.boundOnProcessDestroy);
844
857
  }
845
858
  destroy() {
846
- S.getInstance().off("create", this.boundOnProcessCreate), S.getInstance().off("destroy", this.boundOnProcessDestroy), super.destroy();
859
+ M.getInstance().off("create", this.boundOnProcessCreate), M.getInstance().off("destroy", this.boundOnProcessDestroy), super.destroy();
847
860
  }
848
861
  async onProcessCreate({ process: e }) {
849
862
  const n = this.getRavenGame(e);
850
863
  if (!n)
851
864
  return;
852
- if (this.logger.log("Game Launched", n), this.logger.log("Process is elevated: ", e.isElevated), this.logger.log("Current process is elevated: ", L.currentProcess.isElevated), e.isElevated && !L.currentProcess.isElevated) {
853
- be.getInstance().error("Game is elevated but the App is not", "ELEVATION_MISMATCH", {
854
- appElevated: L.currentProcess.isElevated,
865
+ if (this.logger.log("Game Launched", n), this.logger.log("Process is elevated: ", e.isElevated), this.logger.log("Current process is elevated: ", j.currentProcess.isElevated), e.isElevated && !j.currentProcess.isElevated) {
866
+ q.getInstance().error("Game is elevated but the App is not", "ELEVATION_MISMATCH", {
867
+ appElevated: j.currentProcess.isElevated,
855
868
  gameElevated: e.isElevated
856
869
  }), this.logger.sentryLog("Game elevated but App is not", {
857
- appElevated: L.currentProcess.isElevated,
870
+ appElevated: j.currentProcess.isElevated,
858
871
  gameElevated: e.isElevated
859
872
  });
860
873
  return;
@@ -863,72 +876,72 @@ class zt extends C {
863
876
  if (s)
864
877
  try {
865
878
  await e.injectDll(s), this.logger.log("Render Interface Injection Successful", s);
866
- } catch (o) {
867
- this.logger.captureSentryException("Render Interface Injection Failed", o), this.logger.sentryError("Render Interface Injection Failed", {
879
+ } catch (a) {
880
+ this.logger.captureSentryException("Render Interface Injection Failed", a), this.logger.sentryError("Render Interface Injection Failed", {
868
881
  renderInterfacePath: s
869
882
  });
870
883
  }
871
- const i = n == null ? void 0 : n.dlls_to_inject.map(async (o) => {
872
- const a = await B.getInstance().getCurrentVersion(o);
873
- if (!a)
874
- return this.logger.sentryError("No version found for DLL", { identifier: o }), Promise.resolve();
875
- const c = B.getInstance().getTargetVersionPath(o, a);
876
- this.logger.log("DLL Path", c);
877
- const d = await this.getDllFiles(c);
878
- return this.logger.log("DLL Files", d), Promise.all(
879
- d.map(async (h) => {
880
- const g = p.basename(h), u = p.join(c, g);
881
- if (!u)
884
+ const o = n == null ? void 0 : n.dlls_to_inject.map(async (a) => {
885
+ const i = await J.getInstance().getCurrentVersion(a);
886
+ if (!i)
887
+ return this.logger.sentryError("No version found for DLL", { identifier: a }), Promise.resolve();
888
+ const l = J.getInstance().getTargetVersionPath(a, i);
889
+ this.logger.log("DLL Path", l);
890
+ const h = await this.getDllFiles(l);
891
+ return this.logger.log("DLL Files", h), Promise.all(
892
+ h.map(async (g) => {
893
+ const p = _.basename(g), d = _.join(l, p);
894
+ if (!d)
882
895
  return Promise.resolve();
883
- this.logger.log("Injecting: ", u);
896
+ this.logger.log("Injecting: ", d);
884
897
  try {
885
- return e.injectDll(u).then(() => {
886
- this.logger.log("Injection Successful", u);
887
- }).catch((y) => {
888
- this.logger.sentryError("Injection Failed [1]", { targetPath: u }, y);
898
+ return e.injectDll(d).then(() => {
899
+ this.logger.log("Injection Successful", d);
900
+ }).catch((m) => {
901
+ this.logger.sentryError("Injection Failed [1]", { targetPath: d }, m);
889
902
  });
890
- } catch (y) {
891
- return this.logger.sentryError("Injection Failed [2]", { targetPath: u }, y), Promise.reject(y);
903
+ } catch (m) {
904
+ return this.logger.sentryError("Injection Failed [2]", { targetPath: d }, m), Promise.reject(m);
892
905
  }
893
906
  })
894
907
  );
895
908
  });
896
- await Promise.allSettled(i), this.emit("gameLaunch", { ravenGame: n, process: e });
909
+ await Promise.allSettled(o), this.emit("gameLaunchInternal", { ravenGame: n, process: e }), this.emit("gameLaunch", { game: n.identifier });
897
910
  }
898
911
  copyDll(e) {
899
- this.logger.log(at());
912
+ this.logger.log(At());
900
913
  const n = e.split("/");
901
914
  if (n.length < 2)
902
915
  return this.logger.sentryError("Path is invalid", { dllPath: e }), !1;
903
916
  const s = n.at(-1);
904
917
  if (!s)
905
918
  return this.logger.sentryError("Dll name is invalid", { dllPath: e }), !1;
906
- const i = Ke(e), o = p.join(F, "resources"), a = p.join(o, s);
907
- this.logger.debug("Copying", i, "to", a);
919
+ const o = lt(e), a = _.join(B, "resources"), i = _.join(a, s);
920
+ this.logger.debug("Copying", o, "to", i);
908
921
  try {
909
- $e(o) || He(o, { recursive: !0 });
910
- const c = ye(i);
911
- Ne(a, c), je(i, a);
912
- } catch (c) {
913
- return c.code === "EBUSY" ? a : (this.logger.captureSentryException("Failed to copy", c), this.logger.sentryError("Failed to copy", { originalPath: i, targetPath: a }), !1);
922
+ dt(a) || ut(a, { recursive: !0 });
923
+ const l = Se(o);
924
+ ht(i, l), gt(o, i);
925
+ } catch (l) {
926
+ return l.code === "EBUSY" ? i : (this.logger.captureSentryException("Failed to copy", l), this.logger.sentryError("Failed to copy", { originalPath: o, targetPath: i }), !1);
914
927
  }
915
- return a;
928
+ return i;
916
929
  }
917
930
  async getDllFiles(e) {
918
931
  try {
919
- return (await b.readdir(e)).filter((s) => s.endsWith(".dll")).map((s) => p.join(e, s));
932
+ return (await E.readdir(e)).filter((s) => s.endsWith(".dll")).map((s) => _.join(e, s));
920
933
  } catch (n) {
921
934
  return this.logger.captureSentryException("Failed to read DLL directory", n), this.logger.sentryError("Failed to read DLL directory", { dllPath: e }), [];
922
935
  }
923
936
  }
924
937
  onProcessDestroy({ process: e }) {
925
938
  const n = this.getRavenGame(e);
926
- n && this.emit("gameClose", { ravenGame: n, process: e });
939
+ n && (this.emit("gameCloseInternal", { ravenGame: n, process: e }), this.emit("gameClose", { game: n.identifier }));
927
940
  }
928
941
  getRavenGame(e) {
929
942
  if (!e.name)
930
943
  return;
931
- const n = G.getInstance().getExecutableData(e.name);
944
+ const n = Q.getInstance().getExecutableData(e.name);
932
945
  if (!n) {
933
946
  this.logger.sentryError("No raven game found for process", { process: e });
934
947
  return;
@@ -936,17 +949,17 @@ class zt extends C {
936
949
  return n;
937
950
  }
938
951
  }
939
- const V = k(zt);
940
- class Wt extends st {
952
+ const Z = I(wn);
953
+ class kn extends Ke {
941
954
  constructor() {
942
955
  super("GameBuildManager");
943
- l(this, "boundOnGameLaunch", this.onGameLaunch.bind(this));
956
+ c(this, "boundOnGameLaunch", this.onGameLaunch.bind(this));
944
957
  }
945
958
  init() {
946
- super.init(), V.getInstance().on("gameLaunch", this.boundOnGameLaunch);
959
+ super.init(), Z.getInstance().on("gameLaunchInternal", this.boundOnGameLaunch);
947
960
  }
948
961
  destroy() {
949
- V.getInstance().off("gameLaunch", this.boundOnGameLaunch), super.destroy();
962
+ Z.getInstance().off("gameLaunchInternal", this.boundOnGameLaunch), super.destroy();
950
963
  }
951
964
  async onGameLaunch(e) {
952
965
  const { ravenGame: n, process: s } = e;
@@ -958,30 +971,30 @@ class Wt extends st {
958
971
  );
959
972
  return;
960
973
  }
961
- const i = ye(s.path), o = Be("sha256").update(i).digest("hex");
962
- this.logger.log("Process Path", s.path), this.logger.log("Process Name", s.name), this.logger.log("Build Hash", o);
963
- let a = !1;
974
+ const o = Se(s.path), a = pt("sha256").update(o).digest("hex");
975
+ this.logger.log("Process Path", s.path), this.logger.log("Process Name", s.name), this.logger.log("Build Hash", a);
976
+ let i = !1;
964
977
  try {
965
- a = (await Kt(n.identifier, o)).data.upload;
966
- } catch (h) {
967
- this.logger.captureSentryException("Error checking game build hash", h);
978
+ i = (await an(n.identifier, a)).data.upload;
979
+ } catch (g) {
980
+ this.logger.captureSentryException("Error checking game build hash", g);
968
981
  return;
969
982
  }
970
- if (!a) {
983
+ if (!i) {
971
984
  this.logger.log("Build hash already exists, skipping upload");
972
985
  return;
973
986
  }
974
- const c = new me();
975
- c.file(s.name, i);
976
- const d = await c.generateAsync({ type: "blob" });
987
+ const l = new Me();
988
+ l.file(s.name, o);
989
+ const h = await l.generateAsync({ type: "blob" });
977
990
  try {
978
- this.logger.log("Uploading build (size: ", d.size, " bytes)"), await Lt(n.identifier, d), this.logger.log("Build uploaded successfully");
979
- } catch (h) {
980
- Ot(h) ? $t(h.response) ? this.logger.captureSentryException("Error uploading build hash, api error", h) : this.logger.captureSentryException("Error uploading build hash, request error", h) : this.logger.captureSentryException("Error uploading build hash, unknown error", h);
991
+ this.logger.log("Uploading build (size: ", h.size, " bytes)"), await on(n.identifier, h), this.logger.log("Build uploaded successfully");
992
+ } catch (g) {
993
+ ln(g) ? cn(g.response) ? this.logger.captureSentryException("Error uploading build hash, api error", g) : this.logger.captureSentryException("Error uploading build hash, request error", g) : this.logger.captureSentryException("Error uploading build hash, unknown error", g);
981
994
  }
982
995
  }
983
996
  }
984
- const qt = k(Wt), te = /* @__PURE__ */ new Map([
997
+ const In = I(kn), de = /* @__PURE__ */ new Map([
985
998
  [1, "LeftButton"],
986
999
  [2, "RightButton"],
987
1000
  [3, "Cancel"],
@@ -1174,35 +1187,37 @@ const qt = k(Wt), te = /* @__PURE__ */ new Map([
1174
1187
  [252, "Noname"],
1175
1188
  [253, "PA1"],
1176
1189
  [254, "OEM_Clear"]
1177
- ]), pe = new Map(te.entries().map(([r, t]) => [t, r])), Xt = D({
1190
+ ]), Pe = new Map(de.entries().map(([r, t]) => [t, r])), Cn = y({
1178
1191
  "[string]": {
1179
1192
  keys: "string[]",
1180
- mode: D("'toggle' | 'hold'").pipe((r) => r ?? "toggle")
1193
+ mode: y("'toggle' | 'hold'").pipe((r) => r ?? "toggle")
1181
1194
  }
1182
1195
  });
1183
- class Jt extends C {
1196
+ class Pn extends x {
1184
1197
  constructor(e) {
1185
1198
  super("KeybindManager");
1186
- l(this, "preferencesKeybindToCallbacks", /* @__PURE__ */ new Map());
1187
- l(this, "pressedKeys", /* @__PURE__ */ new Set());
1188
- l(this, "activeKeybinds", /* @__PURE__ */ new Set());
1189
- l(this, "triggeredToggleKeybinds", /* @__PURE__ */ new Set());
1190
- l(this, "isRecording", !1);
1191
- l(this, "boundHandleKeyboardFocus", this.handleKeyboardFocus.bind(this));
1192
- l(this, "boundHandleKeyDown", this.handleKeyDown.bind(this));
1193
- l(this, "boundHandleKeyUp", this.handleKeyUp.bind(this));
1194
- l(this, "keybidnsFile");
1195
- this.keybidnsFile = new nt({
1196
- path: p.join(F, "keybinds.json"),
1197
- schema: Xt,
1199
+ c(this, "preferencesKeybindToCallbacks", /* @__PURE__ */ new Map());
1200
+ c(this, "pressedKeys", /* @__PURE__ */ new Set());
1201
+ c(this, "activeKeybinds", /* @__PURE__ */ new Set());
1202
+ c(this, "triggeredToggleKeybinds", /* @__PURE__ */ new Set());
1203
+ c(this, "boundHandleKeyboardFocus", this.handleKeyboardFocus.bind(this));
1204
+ c(this, "boundHandleKeyDown", this.handleKeyDown.bind(this));
1205
+ c(this, "boundHandleKeyUp", this.handleKeyUp.bind(this));
1206
+ c(this, "keybindsFile");
1207
+ // TODO try to figure out a better way to handle this
1208
+ c(this, "isRecording", !1);
1209
+ this.keybindsFile = new Mt({
1210
+ path: Rt(["keybinds.json"]),
1211
+ schema: Cn,
1198
1212
  default: e
1199
1213
  });
1200
1214
  }
1201
1215
  init() {
1202
1216
  super.init();
1203
- const e = ee.getInstance().getInterface("SCC_RAINBOW");
1217
+ const e = F.getInstance().getInterface("SCC_RAINBOW");
1204
1218
  e.instance.on("keyboardFocus", this.boundHandleKeyboardFocus), e.instance.on("keyDown", this.boundHandleKeyDown), e.instance.on("keyUp", this.boundHandleKeyUp);
1205
1219
  }
1220
+ // TODO support multiple callbacks
1206
1221
  async onHotkeyToggled(e, n) {
1207
1222
  const s = this.preferencesKeybindToCallbacks.get(e) || {};
1208
1223
  s.toggle = n, this.preferencesKeybindToCallbacks.set(e, s);
@@ -1216,13 +1231,13 @@ class Jt extends C {
1216
1231
  s.up = n, this.preferencesKeybindToCallbacks.set(e, s);
1217
1232
  }
1218
1233
  destroy() {
1219
- const e = ee.getInstance().getInterface("SCC_RAINBOW");
1234
+ const e = F.getInstance().getInterface("SCC_RAINBOW");
1220
1235
  e.instance.off("keyboardFocus", this.boundHandleKeyboardFocus), e.instance.off("keyDown", this.boundHandleKeyDown), e.instance.off("keyUp", this.boundHandleKeyUp), super.destroy();
1221
1236
  }
1222
1237
  handleKeyDown(e) {
1223
1238
  if (this.isRecording)
1224
1239
  return;
1225
- const n = te.get(e.key);
1240
+ const n = de.get(e.key);
1226
1241
  if (!n) {
1227
1242
  this.logger.error("Unknown key down", e);
1228
1243
  return;
@@ -1235,85 +1250,159 @@ class Jt extends C {
1235
1250
  async handleKeyUp(e) {
1236
1251
  if (this.isRecording)
1237
1252
  return;
1238
- const n = te.get(e.key);
1253
+ const n = de.get(e.key);
1239
1254
  if (!n)
1240
1255
  return;
1241
1256
  this.pressedKeys.delete(n);
1242
- const s = this.keybidnsFile.data;
1243
- for (const [i] of this.preferencesKeybindToCallbacks.entries())
1244
- s[i].keys.includes(n) && this.triggeredToggleKeybinds.delete(i);
1257
+ const s = this.keybindsFile.data;
1258
+ for (const [o] of this.preferencesKeybindToCallbacks.entries())
1259
+ s[o].keys.includes(n) && this.triggeredToggleKeybinds.delete(o);
1245
1260
  this.checkHotkeyUps();
1246
1261
  }
1247
1262
  async checkHotkeyUps() {
1248
- const e = this.keybidnsFile.data;
1263
+ const e = this.keybindsFile.data;
1249
1264
  for (const [n, s] of this.preferencesKeybindToCallbacks.entries()) {
1250
1265
  if (!s.up) continue;
1251
- const i = e[n];
1252
- this.activeKeybinds.has(n) && i.keys.some((o) => !this.pressedKeys.has(o)) && (this.activeKeybinds.delete(n), s.up(), this.logger.log("Hotkey up triggered", this.getHotkeyToString(i)));
1266
+ const o = e[n];
1267
+ this.activeKeybinds.has(n) && o.keys.some((a) => !this.pressedKeys.has(a)) && (this.activeKeybinds.delete(n), s.up(), this.logger.log("Hotkey up triggered", this.getHotkeyToString(o)));
1253
1268
  }
1254
1269
  }
1255
1270
  async checkKeybindings() {
1256
- const e = this.keybidnsFile.data;
1271
+ const e = this.keybindsFile.data;
1257
1272
  for (const [n, s] of this.preferencesKeybindToCallbacks.entries()) {
1258
- const i = e[n];
1259
- if (i.keys.length === this.pressedKeys.size && i.keys.every((a) => pe.has(a) ? this.pressedKeys.has(a) : !1)) {
1260
- this.triggerHotkey(i, s, n);
1273
+ const o = e[n];
1274
+ if (o.keys.length === this.pressedKeys.size && o.keys.every((i) => Pe.has(i) ? this.pressedKeys.has(i) : !1)) {
1275
+ this.triggerHotkey(o, s, n);
1261
1276
  return;
1262
1277
  }
1263
1278
  }
1264
1279
  for (const [n, s] of this.preferencesKeybindToCallbacks.entries()) {
1265
- const i = e[n];
1266
- i.keys.every((a) => pe.has(a) ? this.pressedKeys.has(a) : (this.logger.error("Unknown key", a, i), !1)) && this.triggerHotkey(i, s, n);
1280
+ const o = e[n];
1281
+ o.keys.every((i) => Pe.has(i) ? this.pressedKeys.has(i) : (this.logger.error("Unknown key", i, o), !1)) && this.triggerHotkey(o, s, n);
1267
1282
  }
1268
1283
  }
1269
1284
  triggerHotkey(e, n, s) {
1270
- const i = e.mode;
1271
- if (i === "toggle" && n.toggle && !this.triggeredToggleKeybinds.has(s)) {
1272
- const o = n.toggle();
1285
+ const o = e.mode;
1286
+ if (o === "toggle" && n.toggle && !this.triggeredToggleKeybinds.has(s)) {
1287
+ const a = n.toggle();
1273
1288
  this.triggeredToggleKeybinds.add(s), this.logger.log(
1274
- o ? `Hotkey pressed rejected: ${o}` : "Hotkey pressed accepted",
1289
+ a ? `Hotkey pressed rejected: ${a}` : "Hotkey pressed accepted",
1275
1290
  this.getHotkeyToString(e)
1276
1291
  );
1277
1292
  }
1278
- if (i === "hold" && n.down && !this.activeKeybinds.has(s)) {
1279
- const o = n.down();
1280
- o ? this.logger.log(`Hotkey down rejected: ${o}`, this.getHotkeyToString(e)) : (this.activeKeybinds.add(s), this.logger.log("Hotkey down accepted", this.getHotkeyToString(e)));
1293
+ if (o === "hold" && n.down && !this.activeKeybinds.has(s)) {
1294
+ const a = n.down();
1295
+ a ? this.logger.log(`Hotkey down rejected: ${a}`, this.getHotkeyToString(e)) : (this.activeKeybinds.add(s), this.logger.log("Hotkey down accepted", this.getHotkeyToString(e)));
1281
1296
  }
1282
1297
  }
1283
1298
  getHotkeyToString(e) {
1284
1299
  return `(${e.keys.join("+")}${e.mode ? ` ${e.mode}` : ""})`;
1285
1300
  }
1286
1301
  }
1287
- function pr(r) {
1288
- const t = /* @__PURE__ */ new Map(), e = Yt(r.modules, t), n = Zt(), s = tr(r.keybinds);
1289
- return Qt(), er(r, t), {
1290
- ...e,
1291
- ...n,
1292
- keybinds: s
1302
+ class Sn extends Ke {
1303
+ constructor(e) {
1304
+ super("OverridesManager");
1305
+ c(this, "renderInterface");
1306
+ c(this, "globalCursorOverrideCount", /* @__PURE__ */ new Set());
1307
+ c(this, "globalMouseBlockCount", /* @__PURE__ */ new Set());
1308
+ c(this, "globalKeyboardBlockCount", /* @__PURE__ */ new Set());
1309
+ c(this, "keyInputBlocks", {});
1310
+ this.renderInterface = F.getInstance().getInterface(e);
1311
+ }
1312
+ scope(e) {
1313
+ return {
1314
+ setGlobalCursorOverride: (n) => this.setGlobalCursorOverride(e, n),
1315
+ setGlobalMouseBlock: (n) => this.setGlobalMouseBlock(e, n),
1316
+ setGlobalKeyboardBlock: (n) => this.setGlobalKeyboardBlock(e, n),
1317
+ setKeyInputBlock: (n, s) => this.setKeyInputBlock(e, n, s)
1318
+ };
1319
+ }
1320
+ setGlobalCursorOverride(e, n) {
1321
+ n ? this.globalCursorOverrideCount.add(e) : this.globalCursorOverrideCount.delete(e), n && this.globalCursorOverrideCount.size === 1 ? this.renderInterface.instance.setGlobalCursorOverride(!0) : !n && this.globalCursorOverrideCount.size === 0 && this.renderInterface.instance.setGlobalCursorOverride(!1);
1322
+ }
1323
+ setGlobalMouseBlock(e, n) {
1324
+ n ? this.globalMouseBlockCount.add(e) : this.globalMouseBlockCount.delete(e), n && this.globalMouseBlockCount.size === 1 ? this.renderInterface.instance.setGlobalMouseBlock(!0) : !n && this.globalMouseBlockCount.size === 0 && this.renderInterface.instance.setGlobalMouseBlock(!1);
1325
+ }
1326
+ setGlobalKeyboardBlock(e, n) {
1327
+ n ? this.globalKeyboardBlockCount.add(e) : this.globalKeyboardBlockCount.delete(e), n && this.globalKeyboardBlockCount.size === 1 ? this.renderInterface.instance.setGlobalKeyboardBlock(!0) : !n && this.globalKeyboardBlockCount.size === 0 && this.renderInterface.instance.setGlobalKeyboardBlock(!1);
1328
+ }
1329
+ setKeyInputBlock(e, n, s) {
1330
+ this.keyInputBlocks[n] || (this.keyInputBlocks[n] = /* @__PURE__ */ new Set()), s ? this.keyInputBlocks[n].add(e) : this.keyInputBlocks[n].delete(e), s && this.keyInputBlocks[n].size === 1 ? this.renderInterface.instance.setKeyInputBlock(n, !0) : !s && this.keyInputBlocks[n].size === 0 && this.renderInterface.instance.setKeyInputBlock(n, !1);
1331
+ }
1332
+ }
1333
+ const Mn = I(Sn, "SCC_RAINBOW");
1334
+ let se = !1, U = {};
1335
+ function jr(r) {
1336
+ const { init: t = !0 } = r;
1337
+ if ($n(r), se)
1338
+ return U;
1339
+ function e() {
1340
+ const n = /* @__PURE__ */ new Map(), s = Rn(r.modules, n), o = Kn(), a = Tn(r.keybinds), i = Dn(), l = On();
1341
+ An(), xn(r, n), se = !0, U = {
1342
+ ...s,
1343
+ ...o,
1344
+ // TODO add a way for developer to save keybinds that the user settings
1345
+ keybinds: a,
1346
+ windows: i,
1347
+ input: l,
1348
+ hasAnyActiveProcesses: () => M.getInstance().hasAnyActiveProcesses,
1349
+ init: e
1350
+ };
1351
+ }
1352
+ return t ? (e(), U) : new Proxy(
1353
+ {
1354
+ init: e
1355
+ },
1356
+ {
1357
+ get: (n, s) => {
1358
+ if (s !== "init" && !se)
1359
+ throw new Error("overlayed was called before initialized");
1360
+ return s === "init" ? n[s] : U[s];
1361
+ }
1362
+ }
1363
+ );
1364
+ }
1365
+ global.OVERLAYED = new Proxy({}, {
1366
+ get: () => {
1367
+ throw new Error("function overlayed was not called");
1368
+ }
1369
+ });
1370
+ function $n(r) {
1371
+ global.OVERLAYED = {
1372
+ APP_NAME: r.appName
1293
1373
  };
1294
1374
  }
1295
- function Qt() {
1296
- qt.getInstance().init(), V.getInstance().init(), S.getInstance().init(), G.getInstance().init();
1375
+ function An() {
1376
+ In.getInstance().init(), Z.getInstance().init(), M.getInstance().init(), Q.getInstance().init();
1297
1377
  }
1298
- function Yt(r, t) {
1378
+ function Rn(r, t) {
1299
1379
  return r.reduce((e, n) => {
1300
1380
  const s = n.key;
1301
1381
  return e[s] = {
1302
1382
  // prettier-ignore
1303
- on(i, o) {
1304
- const a = z(s, i), c = t.get(a) ?? /* @__PURE__ */ new Set();
1305
- c.add(o), t.set(a, c);
1383
+ on(o, a) {
1384
+ const i = $(s, o), l = t.get(i) ?? /* @__PURE__ */ new Set();
1385
+ l.add(a), t.set(i, l);
1386
+ },
1387
+ onAny(o) {
1388
+ const a = $(s, "*"), i = t.get(a) ?? /* @__PURE__ */ new Set();
1389
+ i.add(o), t.set(a, i);
1390
+ },
1391
+ // prettier-ignore
1392
+ off(o, a) {
1393
+ const i = $(s, o), l = t.get(i) ?? /* @__PURE__ */ new Set();
1394
+ l.delete(a), t.set(i, l);
1306
1395
  },
1307
1396
  // prettier-ignore
1308
- off(i, o) {
1309
- const a = z(s, i), c = t.get(a) ?? /* @__PURE__ */ new Set();
1310
- c.delete(o), t.set(a, c);
1397
+ offAny(o) {
1398
+ const a = $(s, "*"), i = t.get(a) ?? /* @__PURE__ */ new Set();
1399
+ i.delete(o), t.set(a, i);
1311
1400
  }
1312
1401
  }, e;
1313
1402
  }, {});
1314
1403
  }
1315
- function Zt() {
1316
- const r = be.getInstance(), t = V.getInstance();
1404
+ function Kn() {
1405
+ const r = q.getInstance(), t = Z.getInstance();
1317
1406
  return {
1318
1407
  on: (e, n) => {
1319
1408
  switch (e) {
@@ -1332,57 +1421,447 @@ function Zt() {
1332
1421
  default:
1333
1422
  throw new Error("Not implemented", { cause: [e, n] });
1334
1423
  }
1424
+ },
1425
+ off: (e, n) => {
1426
+ switch (e) {
1427
+ case "error":
1428
+ r.off("error", n);
1429
+ break;
1430
+ case "warning":
1431
+ r.off("warning", n);
1432
+ break;
1433
+ case "gameLaunch":
1434
+ t.off("gameLaunch", n);
1435
+ break;
1436
+ case "gameClose":
1437
+ t.off("gameClose", n);
1438
+ break;
1439
+ default:
1440
+ throw new Error("Not implemented", { cause: [e, n] });
1441
+ }
1335
1442
  }
1336
1443
  };
1337
1444
  }
1338
- function z(r, t) {
1445
+ function $(r, t) {
1339
1446
  return `${r}:${t}`;
1340
1447
  }
1341
- function er(r, t) {
1342
- const e = Qe.getInstance();
1448
+ function xn(r, t) {
1449
+ const e = $e.getInstance();
1343
1450
  function n(s) {
1344
- const i = Ye(s);
1345
- if (i instanceof D.errors)
1451
+ const o = Ae(s);
1452
+ if (o instanceof y.errors) {
1453
+ q.getInstance().warn("Invalid event", "INVALID_EVENT", {
1454
+ cause: o.summary
1455
+ });
1346
1456
  return;
1347
- const o = r.modules.find((f) => f.key === i.game), a = o == null ? void 0 : o.events.event;
1348
- if (!a)
1457
+ }
1458
+ const a = r.modules.find((f) => f.key === o.game), i = a == null ? void 0 : a.events.event;
1459
+ if (!i)
1349
1460
  return;
1350
- const c = a(s);
1351
- if (c instanceof D.errors)
1461
+ const l = i(s);
1462
+ if (l instanceof y.errors) {
1463
+ q.getInstance().warn("Invalid event", "INVALID_EVENT", {
1464
+ cause: l
1465
+ });
1352
1466
  return;
1353
- const d = z(o.key, c.type), h = z(o.key, "*"), g = t.get(d), u = t.get(h), y = [...Array.from(g ?? []), ...Array.from(u ?? [])];
1354
- y.length !== 0 && y.forEach((f) => {
1355
- f(c);
1467
+ }
1468
+ const h = $(a.key, l.type), g = $(a.key, "*"), p = t.get(h), d = t.get(g), m = [...Array.from(p ?? []), ...Array.from(d ?? [])];
1469
+ m.length !== 0 && m.forEach((f) => {
1470
+ f(l);
1356
1471
  });
1357
1472
  }
1358
1473
  return e.on("data", (s) => s.forEach(n)), e;
1359
1474
  }
1360
- function tr(r) {
1361
- const t = {}, e = new Jt(r);
1362
- for (const n in r)
1363
- t[n] = {
1364
- on: (s, i) => {
1365
- switch (s) {
1475
+ function Tn(r) {
1476
+ const t = new Pn(r), e = {};
1477
+ for (const s in r)
1478
+ e[s] = {
1479
+ on: (o, a) => {
1480
+ switch (o) {
1366
1481
  case "down":
1367
- e.onHotkeyDown(n, i);
1482
+ t.onHotkeyDown(s, a);
1368
1483
  break;
1369
1484
  case "up":
1370
- e.onHotkeyUp(n, i);
1485
+ t.onHotkeyUp(s, a);
1371
1486
  break;
1372
1487
  case "toggle":
1373
- e.onHotkeyToggled(n, i);
1488
+ t.onHotkeyToggled(s, a);
1374
1489
  break;
1375
1490
  default:
1376
- throw new Error("Not implemented", { cause: [s, i] });
1491
+ throw new Error("Not implemented", { cause: [o, a] });
1377
1492
  }
1378
1493
  }
1379
1494
  };
1380
- return t;
1495
+ return {
1496
+ ...e,
1497
+ toggleRecording: (s) => {
1498
+ s === void 0 ? t.isRecording = !t.isRecording : t.isRecording = s;
1499
+ }
1500
+ };
1501
+ }
1502
+ function Dn() {
1503
+ return {
1504
+ createWindow: b("newWindow"),
1505
+ on: b("on"),
1506
+ off: b("off"),
1507
+ once: b("once"),
1508
+ addListener: b("addListener"),
1509
+ prependListener: b("prependListener"),
1510
+ prependOnceListener: b("prependOnceListener"),
1511
+ removeListener: b("removeListener"),
1512
+ removeAllListeners: b("removeAllListeners"),
1513
+ getActiveGameInfo: () => {
1514
+ const r = Ue(), t = $e.getInstance();
1515
+ return {
1516
+ resolution: r.resolution,
1517
+ isConnected: t.hasConnection
1518
+ };
1519
+ }
1520
+ };
1521
+ }
1522
+ function On() {
1523
+ return {
1524
+ scope: (r) => Mn.getInstance().scope(r),
1525
+ raw: {
1526
+ setGlobalMouseBlock: b("setGlobalMouseBlock"),
1527
+ setGlobalKeyboardBlock: b("setGlobalKeyboardBlock"),
1528
+ setGlobalCursorOverride: b("setGlobalCursorOverride"),
1529
+ setKeyInputBlock: b("setKeyInputBlock"),
1530
+ getGlobalMouseBlock: b("getGlobalMouseBlock"),
1531
+ getGlobalKeyboardBlock: b("getGlobalKeyboardBlock"),
1532
+ getGlobalCursorOverride: b("getGlobalCursorOverride"),
1533
+ getKeyInputBlock: b("getKeyInputBlock")
1534
+ }
1535
+ };
1381
1536
  }
1382
- function yr() {
1383
- return "test";
1537
+ function Ue() {
1538
+ return F.getInstance().getInterface("SCC_RAINBOW");
1539
+ }
1540
+ function b(r) {
1541
+ return (...t) => {
1542
+ const n = Ue().instance[r];
1543
+ return n(...t);
1544
+ };
1545
+ }
1546
+ const ze = "00000000-0000-0000-0000-000000000000", me = y(`string.uuid | '${ze}'`), Ve = ["intro", "planning", "prep", "action", "results", "invalid"], qe = y("===", ...Ve), We = [0, 1], te = y("===", ...We), Xe = ["attacker", "defender", "both", "invalid"], K = y("===", ...Xe), Ye = ["normal", "overhealed", "low_health", "downed", "dead", "respawning"], ne = y("===", ...Ye), Je = [
1547
+ "bullet",
1548
+ "melee",
1549
+ "explosive",
1550
+ "falling",
1551
+ "regeneration",
1552
+ "unknown",
1553
+ "debris",
1554
+ "projectile",
1555
+ "downed",
1556
+ "gas",
1557
+ "thermal_explosion",
1558
+ "melee_gadget",
1559
+ "barbed_wire",
1560
+ "electric",
1561
+ "reinforcement",
1562
+ "frag",
1563
+ "paralyzed",
1564
+ "emp",
1565
+ "break",
1566
+ "cleanup",
1567
+ "interrogation",
1568
+ "melee-finisher",
1569
+ "toxic",
1570
+ "toxic-explosion",
1571
+ "pneumatic",
1572
+ "body-contact",
1573
+ "contact-explosion",
1574
+ "flash",
1575
+ "parasite-spike",
1576
+ "laser",
1577
+ "concussion",
1578
+ "blowtorch",
1579
+ "taser-shield",
1580
+ "reverse-friendly-fire",
1581
+ "self-destroyed",
1582
+ "area-control",
1583
+ "fire",
1584
+ "breach-kick",
1585
+ "break-wall",
1586
+ "blade-mine",
1587
+ "invalid"
1588
+ ], Qe = y("===", ...Je), Ze = ["unknown", "enemy", "friendly", "invalid"], et = y("===", ...Ze), u = Ae.and({
1589
+ game: "'siege'"
1590
+ }), Ln = u.and({
1591
+ type: "'local_player'",
1592
+ content: {
1593
+ profile_id: me
1594
+ }
1595
+ }), S = y({
1596
+ id: "number",
1597
+ value: "string"
1598
+ }), tt = y({
1599
+ kills: "number",
1600
+ deaths: "number",
1601
+ assists: "number",
1602
+ plants: "number",
1603
+ score: "number"
1604
+ }), Fn = y({
1605
+ instigator_player_id: "number",
1606
+ receiver_player_id: "number",
1607
+ damage_amount: "number",
1608
+ remaining_health: "number",
1609
+ pre_damage_health: "number",
1610
+ max_health: "number",
1611
+ damage_type: Qe,
1612
+ damage_team_type: et,
1613
+ damage_item_id: "number | null",
1614
+ damage_time: "number"
1615
+ }), nt = y({
1616
+ index: "number",
1617
+ rounds_until_next_segment: "number",
1618
+ segment_size: "number",
1619
+ segment_index: "number",
1620
+ team_0: {
1621
+ role: K,
1622
+ state: "number"
1623
+ },
1624
+ team_1: {
1625
+ role: K,
1626
+ state: "number"
1627
+ }
1628
+ }), rt = y({
1629
+ id: "number",
1630
+ name: S,
1631
+ time_of_day: S
1632
+ }), Bn = y({
1633
+ player_id: "number",
1634
+ final_health: "number",
1635
+ final_life_state: ne,
1636
+ operator_name: S.or(y.null)
1637
+ }), Gn = y({
1638
+ round_data: nt,
1639
+ damage_events: Fn.array(),
1640
+ players: Bn.array()
1641
+ }), Hn = u.and({
1642
+ type: "'match_started'",
1643
+ content: {
1644
+ game_mode: "string",
1645
+ game_type: S,
1646
+ match_type: "string",
1647
+ match_id: "string",
1648
+ map: rt,
1649
+ is_round_based: "boolean",
1650
+ current_round_index: "number",
1651
+ rounds: nt.array()
1652
+ }
1653
+ }), Nn = u.and({
1654
+ type: "'module_loaded'"
1655
+ }), jn = u.and({
1656
+ type: "'module_unloaded'"
1657
+ }), Un = u.and({
1658
+ type: "'started_queuing'",
1659
+ content: {
1660
+ game_mode: "string",
1661
+ game_type: S,
1662
+ match_type: "string"
1663
+ }
1664
+ }), zn = u.and({
1665
+ type: "'stopped_queuing'"
1666
+ }), Vn = u.and({
1667
+ type: "'unsupported_game_version'",
1668
+ content: {
1669
+ hash: "string | null",
1670
+ version: "string | null"
1671
+ }
1672
+ }), qn = u.and({
1673
+ type: "'match_ended'"
1674
+ }), Wn = u.and({
1675
+ type: "'map_changed'",
1676
+ content: {
1677
+ map: rt
1678
+ }
1679
+ }), Xn = u.and({
1680
+ type: "'operator_banned'",
1681
+ content: {
1682
+ index: "number",
1683
+ team: te,
1684
+ side: K,
1685
+ operator_name: S.or("null")
1686
+ }
1687
+ }), Yn = u.and({
1688
+ type: "'round_ended'",
1689
+ content: Gn
1690
+ }), Jn = u.and({
1691
+ type: "'phase_changed'",
1692
+ content: {
1693
+ phase: qe
1694
+ }
1695
+ }), Qn = u.and({
1696
+ type: "'player_joined'",
1697
+ content: {
1698
+ player_id: "number",
1699
+ profile_id: me,
1700
+ is_bot: "boolean",
1701
+ is_enemy: "boolean",
1702
+ is_squad_member: "boolean",
1703
+ is_local_player: "boolean",
1704
+ username: "string",
1705
+ side: K,
1706
+ team: te,
1707
+ is_privacy_username: "boolean",
1708
+ has_avatar_hidden: "boolean",
1709
+ has_commend_streak: "boolean",
1710
+ ping_id: "number",
1711
+ match_stats: tt,
1712
+ life_state: ne,
1713
+ ping: "number"
1714
+ }
1715
+ }).pipe((r) => ({
1716
+ ...r,
1717
+ content: {
1718
+ ...r.content,
1719
+ starting_side: r.content.side
1720
+ }
1721
+ })), Zn = u.and({
1722
+ type: "'player_left'",
1723
+ content: {
1724
+ player_id: "number"
1725
+ }
1726
+ }), er = u.and({
1727
+ type: "'player_operator_changed'",
1728
+ content: {
1729
+ player_id: "number",
1730
+ operator_name: S.or(y.null)
1731
+ }
1732
+ }), tr = u.and({
1733
+ type: "'player_location_changed'",
1734
+ content: {
1735
+ player_id: "number",
1736
+ location_name: "string"
1737
+ }
1738
+ }), nr = u.and({
1739
+ type: "'player_side_changed'",
1740
+ content: {
1741
+ player_id: "number",
1742
+ side: K
1743
+ }
1744
+ }), rr = u.and({
1745
+ type: "'player_stats_changed'",
1746
+ content: {
1747
+ player_id: "number",
1748
+ match_stats: tt
1749
+ }
1750
+ }), sr = u.and({
1751
+ type: "'player_ping_updated'",
1752
+ content: {
1753
+ player_id: "number",
1754
+ ping: "number"
1755
+ }
1756
+ }), ar = u.and({
1757
+ type: "'defuser_planted'",
1758
+ content: {
1759
+ player_id: "number"
1760
+ }
1761
+ }), or = u.and({
1762
+ type: "'defuser_sabotaged'",
1763
+ content: {
1764
+ player_id: "number"
1765
+ }
1766
+ }), ir = u.and({
1767
+ type: "'defuser_picked_up'",
1768
+ content: {
1769
+ player_id: "number",
1770
+ initial: "boolean"
1771
+ }
1772
+ }), lr = u.and({
1773
+ type: "'defuser_dropped'",
1774
+ content: {
1775
+ player_id: "number"
1776
+ }
1777
+ }), cr = u.and({
1778
+ type: "'player_life_state_changed'",
1779
+ content: {
1780
+ player_id: "number",
1781
+ life_state: ne
1782
+ }
1783
+ }), dr = u.and({
1784
+ type: "'player_died'",
1785
+ content: {
1786
+ player_id: "number",
1787
+ instigator_player_id: "number"
1788
+ }
1789
+ }), ur = u.and({
1790
+ type: "'player_downed'",
1791
+ content: {
1792
+ player_id: "number",
1793
+ instigator_player_id: "number"
1794
+ }
1795
+ }), hr = u.and({
1796
+ type: "'player_ping_id_changed'",
1797
+ content: {
1798
+ player_id: "number",
1799
+ ping_id: "number"
1800
+ }
1801
+ }), gr = u.and({
1802
+ type: "'player_team_changed'",
1803
+ content: {
1804
+ player_id: "number",
1805
+ team: te
1806
+ }
1807
+ }), pr = ct({
1808
+ "#event1": "module_loaded | module_unloaded | unsupported_game_version | local_player | started_queuing | stopped_queuing | match_started | match_ended | map_changed | operator_banned | round_ended | phase_changed | player_joined | player_left | player_operator_changed | player_location_changed | player_side_changed | player_stats_changed",
1809
+ "#event2": "player_life_state_changed | player_died | player_downed | player_ping_id_changed | player_team_changed | defuser_planted | defuser_sabotaged | defuser_picked_up | defuser_dropped | player_ping_updated",
1810
+ event: "event1 | event2",
1811
+ module_loaded: Nn,
1812
+ module_unloaded: jn,
1813
+ unsupported_game_version: Vn,
1814
+ local_player: Ln,
1815
+ started_queuing: Un,
1816
+ stopped_queuing: zn,
1817
+ match_started: Hn,
1818
+ match_ended: qn,
1819
+ map_changed: Wn,
1820
+ operator_banned: Xn,
1821
+ round_ended: Yn,
1822
+ phase_changed: Jn,
1823
+ player_joined: Qn,
1824
+ player_left: Zn,
1825
+ player_operator_changed: er,
1826
+ player_location_changed: tr,
1827
+ player_side_changed: nr,
1828
+ player_stats_changed: rr,
1829
+ defuser_planted: ar,
1830
+ defuser_sabotaged: or,
1831
+ defuser_picked_up: ir,
1832
+ defuser_dropped: lr,
1833
+ player_ping_updated: sr,
1834
+ player_life_state_changed: cr,
1835
+ player_died: dr,
1836
+ player_downed: ur,
1837
+ player_ping_id_changed: hr,
1838
+ player_team_changed: gr
1839
+ }).export();
1840
+ function fr() {
1841
+ return {
1842
+ key: "siege",
1843
+ events: pr
1844
+ };
1384
1845
  }
1846
+ const Ur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1847
+ __proto__: null,
1848
+ BOT_ID: ze,
1849
+ DAMAGE_TEAM_TYPES: Ze,
1850
+ DAMAGE_TYPES: Je,
1851
+ DamageTeamTypeSchema: et,
1852
+ DamageTypeSchema: Qe,
1853
+ GAME_MODE_PHASES: Ve,
1854
+ GameModePhaseSchema: qe,
1855
+ PLAYER_LIFE_STATES: Ye,
1856
+ PlayerLifeStateSchema: ne,
1857
+ ProfileId: me,
1858
+ SIDES: Xe,
1859
+ SideSchema: K,
1860
+ TEAMS: We,
1861
+ TeamSchema: te,
1862
+ module: fr
1863
+ }, Symbol.toStringTag, { value: "Module" }));
1385
1864
  export {
1386
- pr as overlayed,
1387
- yr as test
1865
+ Ur as Siege,
1866
+ jr as overlayed
1388
1867
  };