Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@byloth/core

Package Overview
Dependencies
Maintainers
0
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@byloth/core - npm Package Compare versions

Comparing version 2.0.0-rc.3 to 2.0.0-rc.4

1561

dist/core.js

@@ -1,159 +0,148 @@

var P = Object.defineProperty;
var j = (i, e, t) => e in i ? P(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
var u = (i, e, t) => j(i, typeof e != "symbol" ? e + "" : e, t);
const S = typeof window < "u" && typeof window.document < "u";
var b;
const $ = typeof process < "u" && ((b = process.versions) == null ? void 0 : b.node);
var k;
const A = typeof self == "object" && ((k = self.constructor) == null ? void 0 : k.name) === "DedicatedWorkerGlobalScope";
class f extends Error {
var Ie = Object.defineProperty;
var Ae = (i, t, e) => t in i ? Ie(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
var a = (i, t, e) => Ae(i, typeof t != "symbol" ? t + "" : t, e);
const Me = typeof window < "u" && typeof window.document < "u";
var F;
const Je = typeof process < "u" && ((F = process.versions) == null ? void 0 : F.node);
var P;
const Ve = typeof self == "object" && ((P = self.constructor) == null ? void 0 : P.name) === "DedicatedWorkerGlobalScope";
var j, I;
class c extends (I = Error, j = Symbol.toStringTag, I) {
constructor(e, n, r = "Exception") {
super(e);
a(this, j, "Exception");
this.cause = n, this.name = r, n && (n instanceof Error ? this.stack += `
Caused by ${n.stack}` : this.stack += `
Caused by ${n}`);
}
static FromUnknown(e) {
if (e instanceof f)
if (e instanceof c)
return e;
if (e instanceof Error) {
const t = new f(e.message);
return t.stack = e.stack, t.name = e.name, t;
const n = new c(e.message);
return n.stack = e.stack, n.name = e.name, n;
}
return new f(`${e}`);
return new c(`${e}`);
}
constructor(e, t, n = "Exception") {
super(e), this.cause = t, this.name = n, t && (t instanceof Error ? this.stack += `
Caused by ${t.stack}` : this.stack += `
Caused by ${t}`);
}
get [Symbol.toStringTag]() {
return "Exception";
}
}
class _ extends f {
constructor(e, t, n = "FatalErrorException") {
e === void 0 && (e = "The program has encountered an unrecoverable error and cannot continue as expected. Please, try again later. If the problem persists, contact the support team."), super(e, t, n);
var A, C;
class x extends (C = c, A = Symbol.toStringTag, C) {
constructor(e, n, r = "FatalErrorException") {
e === void 0 && (e = "The program has encountered an unrecoverable error and cannot continue as expected. Please, try again later. If the problem persists, contact the support team.");
super(e, n, r);
a(this, A, "FatalErrorException");
}
get [Symbol.toStringTag]() {
return "FatalErrorException";
}
}
class J extends _ {
constructor(e, t, n = "NotImplementedException") {
e === void 0 && (e = "This feature is not implemented yet. Please, try again later."), super(e, t, n);
var D, O;
class We extends (O = x, D = Symbol.toStringTag, O) {
constructor(e, n, r = "NotImplementedException") {
e === void 0 && (e = "This feature is not implemented yet. Please, try again later.");
super(e, n, r);
a(this, D, "NotImplementedException");
}
get [Symbol.toStringTag]() {
return "NotImplementedException";
}
}
class E extends f {
constructor(e, t, n = "FileException") {
super(e, t, n);
var q, N;
class Re extends (N = c, q = Symbol.toStringTag, N) {
constructor(e, n, r = "FileException") {
super(e, n, r);
a(this, q, "FileException");
}
get [Symbol.toStringTag]() {
return "FileException";
}
}
class V extends E {
constructor(e, t, n = "FileExistsException") {
super(e, t, n);
var $, J;
class Ye extends (J = Re, $ = Symbol.toStringTag, J) {
constructor(e, n, r = "FileExistsException") {
super(e, n, r);
a(this, $, "FileExistsException");
}
get [Symbol.toStringTag]() {
return "FileExistsException";
}
}
class W extends E {
constructor(e, t, n = "FileNotFoundException") {
super(e, t, n);
var V, W;
class ze extends (W = Re, V = Symbol.toStringTag, W) {
constructor(e, n, r = "FileNotFoundException") {
super(e, n, r);
a(this, V, "FileNotFoundException");
}
get [Symbol.toStringTag]() {
return "FileNotFoundException";
}
}
class Y extends f {
constructor(e, t, n = "KeyException") {
super(e, t, n);
var Y, z;
class Be extends (z = c, Y = Symbol.toStringTag, z) {
constructor(e, n, r = "KeyException") {
super(e, n, r);
a(this, Y, "KeyException");
}
get [Symbol.toStringTag]() {
return "KeyException";
}
}
class z extends f {
constructor(e, t, n = "NetworkException") {
super(e, t, n);
var B, G;
class Ge extends (G = c, B = Symbol.toStringTag, G) {
constructor(e, n, r = "NetworkException") {
super(e, n, r);
a(this, B, "NetworkException");
}
get [Symbol.toStringTag]() {
return "NetworkException";
}
}
class B extends f {
constructor(e, t, n = "PermissionException") {
super(e, t, n);
var K, H;
class Ke extends (H = c, K = Symbol.toStringTag, H) {
constructor(e, n, r = "PermissionException") {
super(e, n, r);
a(this, K, "PermissionException");
}
get [Symbol.toStringTag]() {
return "PermissionException";
}
}
class D extends f {
constructor(e, t, n = "ReferenceException") {
super(e, t, n);
var L, Q;
class Ce extends (Q = c, L = Symbol.toStringTag, Q) {
constructor(e, n, r = "ReferenceException") {
super(e, n, r);
a(this, L, "ReferenceException");
}
get [Symbol.toStringTag]() {
return "ReferenceException";
}
}
class y extends f {
constructor(e, t, n = "RuntimeException") {
super(e, t, n);
var X, Z;
class p extends (Z = c, X = Symbol.toStringTag, Z) {
constructor(e, n, r = "RuntimeException") {
super(e, n, r);
a(this, X, "RuntimeException");
}
get [Symbol.toStringTag]() {
return "RuntimeException";
}
}
class C extends y {
constructor(e, t, n = "EnvironmentException") {
super(e, t, n);
var U, ee;
class De extends (ee = p, U = Symbol.toStringTag, ee) {
constructor(e, n, r = "EnvironmentException") {
super(e, n, r);
a(this, U, "EnvironmentException");
}
get [Symbol.toStringTag]() {
return "EnvironmentException";
}
}
class O extends f {
constructor(e, t, n = "TimeoutException") {
super(e, t, n);
var te, ne;
class Oe extends (ne = c, te = Symbol.toStringTag, ne) {
constructor(e, n, r = "TimeoutException") {
super(e, n, r);
a(this, te, "TimeoutException");
}
get [Symbol.toStringTag]() {
return "TimeoutException";
}
}
class K extends f {
constructor(e, t, n = "TypeException") {
super(e, t, n);
var re, se;
class He extends (se = c, re = Symbol.toStringTag, se) {
constructor(e, n, r = "TypeException") {
super(e, n, r);
a(this, re, "TypeException");
}
get [Symbol.toStringTag]() {
return "TypeException";
}
}
class m extends f {
constructor(e, t, n = "ValueException") {
super(e, t, n);
var ie, oe;
class d extends (oe = c, ie = Symbol.toStringTag, oe) {
constructor(e, n, r = "ValueException") {
super(e, n, r);
a(this, ie, "ValueException");
}
get [Symbol.toStringTag]() {
return "ValueException";
}
}
class T extends m {
constructor(e, t, n = "RangeException") {
super(e, t, n);
var ae, ue;
class Fe extends (ue = d, ae = Symbol.toStringTag, ue) {
constructor(e, n, r = "RangeException") {
super(e, n, r);
a(this, ae, "RangeException");
}
get [Symbol.toStringTag]() {
return "RangeException";
}
}
var le;
class l {
constructor(e) {
u(this, "_iterator");
u(this, "return");
u(this, "throw");
e instanceof Function ? this._iterator = e() : Symbol.iterator in e ? this._iterator = e[Symbol.iterator]() : this._iterator = e, this._iterator.return && (this.return = (t) => this._iterator.return(t)), this._iterator.throw && (this.throw = (t) => this._iterator.throw(t));
constructor(t) {
a(this, "_iterator");
a(this, "return");
a(this, "throw");
a(this, le, "SmartIterator");
t instanceof Function ? this._iterator = t() : Symbol.iterator in t ? this._iterator = t[Symbol.iterator]() : this._iterator = t, this._iterator.return && (this.return = (e) => this._iterator.return(e)), this._iterator.throw && (this.throw = (e) => this._iterator.throw(e));
}
every(e) {
let t = 0;
every(t) {
let e = 0;
for (; ; ) {

@@ -163,9 +152,9 @@ const n = this._iterator.next();

return !0;
if (!e(n.value, t))
if (!t(n.value, e))
return !1;
t += 1;
e += 1;
}
}
some(e) {
let t = 0;
some(t) {
let e = 0;
for (; ; ) {

@@ -175,37 +164,37 @@ const n = this._iterator.next();

return !1;
if (e(n.value, t))
if (t(n.value, e))
return !0;
t += 1;
e += 1;
}
}
filter(e) {
const t = this._iterator;
filter(t) {
const e = this._iterator;
return new l(function* () {
let n = 0;
for (; ; ) {
const r = t.next();
const r = e.next();
if (r.done)
return r.value;
e(r.value, n) && (yield r.value), n += 1;
t(r.value, n) && (yield r.value), n += 1;
}
});
}
map(e) {
const t = this._iterator;
map(t) {
const e = this._iterator;
return new l(function* () {
let n = 0;
for (; ; ) {
const r = t.next();
const r = e.next();
if (r.done)
return r.value;
yield e(r.value, n), n += 1;
yield t(r.value, n), n += 1;
}
});
}
reduce(e, t) {
let n = 0, r = t;
reduce(t, e) {
let n = 0, r = e;
if (r === void 0) {
const s = this._iterator.next();
if (s.done)
throw new m("Cannot reduce an empty iterator without an initial value.");
throw new d("Cannot reduce an empty iterator without an initial value.");
r = s.value, n += 1;

@@ -217,14 +206,14 @@ }

return r;
r = e(r, s.value, n), n += 1;
r = t(r, s.value, n), n += 1;
}
}
flatMap(e) {
const t = this._iterator;
flatMap(t) {
const e = this._iterator;
return new l(function* () {
let n = 0;
for (; ; ) {
const r = t.next();
const r = e.next();
if (r.done)
return r.value;
const s = e(r.value, n);
const s = t(r.value, n);
for (const o of s)

@@ -236,8 +225,8 @@ yield o;

}
drop(e) {
const t = this._iterator;
drop(t) {
const e = this._iterator;
return new l(function* () {
let n = 0;
for (; n < e; ) {
if (t.next().done)
for (; n < t; ) {
if (e.next().done)
return;

@@ -247,3 +236,3 @@ n += 1;

for (; ; ) {
const r = t.next();
const r = e.next();
if (r.done)

@@ -255,8 +244,8 @@ return r.value;

}
take(e) {
const t = this._iterator;
take(t) {
const e = this._iterator;
return new l(function* () {
let n = 0;
for (; n < e; ) {
const r = t.next();
for (; n < t; ) {
const r = e.next();
if (r.done)

@@ -268,4 +257,4 @@ return r.value;

}
find(e) {
let t = 0;
find(t) {
let e = 0;
for (; ; ) {

@@ -275,19 +264,19 @@ const n = this._iterator.next();

return;
if (e(n.value, t))
if (t(n.value, e))
return n.value;
t += 1;
e += 1;
}
}
enumerate() {
return this.map((e, t) => [t, e]);
return this.map((t, e) => [e, t]);
}
unique() {
const e = this._iterator;
const t = this._iterator;
return new l(function* () {
const t = /* @__PURE__ */ new Set();
const e = /* @__PURE__ */ new Set();
for (; ; ) {
const n = e.next();
const n = t.next();
if (n.done)
return n.value;
t.has(n.value) || (t.add(n.value), yield n.value);
e.has(n.value) || (e.add(n.value), yield n.value);
}

@@ -297,11 +286,11 @@ });

count() {
let e = 0;
let t = 0;
for (; ; ) {
if (this._iterator.next().done)
return e;
e += 1;
return t;
t += 1;
}
}
forEach(e) {
let t = 0;
forEach(t) {
let e = 0;
for (; ; ) {

@@ -311,10 +300,10 @@ const n = this._iterator.next();

return;
e(n.value, t), t += 1;
t(n.value, e), e += 1;
}
}
next(...e) {
return this._iterator.next(...e);
next(...t) {
return this._iterator.next(...t);
}
groupBy(e) {
return new d(this.map((t, n) => [e(t, n), t]));
groupBy(t) {
return new g(this.map((e, n) => [t(e, n), e]));
}

@@ -324,72 +313,72 @@ toArray() {

}
get [Symbol.toStringTag]() {
return "SmartIterator";
}
[Symbol.iterator]() {
[(le = Symbol.toStringTag, Symbol.iterator)]() {
return this;
}
}
class c {
constructor(e) {
u(this, "_elements");
this._elements = new l(e);
var ce;
ce = Symbol.toStringTag;
const y = class y {
constructor(t) {
a(this, "_elements");
a(this, ce, "ReducedIterator");
this._elements = new l(t);
}
every(e) {
for (const [t, [n, r]] of this._elements.enumerate())
if (!e(n, r, t))
every(t) {
for (const [e, [n, r]] of this._elements.enumerate())
if (!t(n, r, e))
return !1;
return !0;
}
some(e) {
for (const [t, [n, r]] of this._elements.enumerate())
if (e(n, r, t))
some(t) {
for (const [e, [n, r]] of this._elements.enumerate())
if (t(n, r, e))
return !0;
return !1;
}
filter(e) {
const t = this._elements.enumerate();
return new c(function* () {
for (const [n, [r, s]] of t)
e(r, s, n) && (yield [r, s]);
filter(t) {
const e = this._elements.enumerate();
return new y(function* () {
for (const [n, [r, s]] of e)
t(r, s, n) && (yield [r, s]);
});
}
map(e) {
const t = this._elements.enumerate();
return new c(function* () {
for (const [n, [r, s]] of t)
yield [r, e(r, s, n)];
map(t) {
const e = this._elements.enumerate();
return new y(function* () {
for (const [n, [r, s]] of e)
yield [r, t(r, s, n)];
});
}
reduce(e, t) {
let n = 0, r = t;
reduce(t, e) {
let n = 0, r = e;
if (r === void 0) {
const s = this._elements.next();
if (s.done)
throw new m("Cannot reduce an empty iterator without an initial value.");
throw new d("Cannot reduce an empty iterator without an initial value.");
r = s.value[1], n += 1;
}
for (const [s, o] of this._elements)
r = e(s, r, o, n), n += 1;
r = t(s, r, o, n), n += 1;
return r;
}
flatMap(e) {
const t = this._elements.enumerate();
return new d(function* () {
for (const [n, [r, s]] of t)
for (const o of e(r, s, n))
flatMap(t) {
const e = this._elements.enumerate();
return new g(function* () {
for (const [n, [r, s]] of e)
for (const o of t(r, s, n))
yield [r, o];
});
}
drop(e) {
const t = this._elements.enumerate();
return new c(function* () {
for (const [n, [r, s]] of t)
n >= e && (yield [r, s]);
drop(t) {
const e = this._elements.enumerate();
return new y(function* () {
for (const [n, [r, s]] of e)
n >= t && (yield [r, s]);
});
}
take(e) {
const t = this._elements.enumerate();
return new c(function* () {
for (const [n, [r, s]] of t) {
if (n >= e)
take(t) {
const e = this._elements.enumerate();
return new y(function* () {
for (const [n, [r, s]] of e) {
if (n >= t)
break;

@@ -401,27 +390,27 @@ yield [r, s];

enumerate() {
return this.map((e, t, n) => [n, t]);
return this.map((t, e, n) => [n, e]);
}
unique() {
const e = this._elements;
return new c(function* () {
const t = /* @__PURE__ */ new Set();
for (const [n, r] of e)
t.has(r) || (t.add(r), yield [n, r]);
const t = this._elements;
return new y(function* () {
const e = /* @__PURE__ */ new Set();
for (const [n, r] of t)
e.has(r) || (e.add(r), yield [n, r]);
});
}
count() {
let e = 0;
for (const t of this._elements)
e += 1;
return e;
let t = 0;
for (const e of this._elements)
t += 1;
return t;
}
forEach(e) {
for (const [t, [n, r]] of this._elements.enumerate())
e(n, r, t);
forEach(t) {
for (const [e, [n, r]] of this._elements.enumerate())
t(n, r, e);
}
keys() {
const e = this._elements;
const t = this._elements;
return new l(function* () {
for (const [t] of e)
yield t;
for (const [e] of t)
yield e;
});

@@ -433,5 +422,5 @@ }

values() {
const e = this._elements;
const t = this._elements;
return new l(function* () {
for (const [t, n] of e)
for (const [e, n] of t)
yield n;

@@ -449,61 +438,62 @@ });

}
get [Symbol.toStringTag]() {
return "ReducedIterator";
};
let f = y;
var fe;
fe = Symbol.toStringTag;
const m = class m {
constructor(t) {
a(this, "_elements");
a(this, fe, "AggregatedAsyncIterator");
this._elements = new h(t);
}
}
class w {
constructor(e) {
u(this, "_elements");
this._elements = new h(e);
}
async every(e) {
const t = /* @__PURE__ */ new Map();
async every(t) {
const e = /* @__PURE__ */ new Map();
for await (const [n, r] of this._elements) {
const [s, o] = t.get(n) ?? [0, !0];
o && t.set(n, [s + 1, await e(n, r, s)]);
const [s, o] = e.get(n) ?? [0, !0];
o && e.set(n, [s + 1, await t(n, r, s)]);
}
return new c(function* () {
for (const [n, [r, s]] of t)
return new f(function* () {
for (const [n, [r, s]] of e)
yield [n, s];
});
}
async some(e) {
const t = /* @__PURE__ */ new Map();
async some(t) {
const e = /* @__PURE__ */ new Map();
for await (const [n, r] of this._elements) {
const [s, o] = t.get(n) ?? [0, !1];
o || t.set(n, [s + 1, await e(n, r, s)]);
const [s, o] = e.get(n) ?? [0, !1];
o || e.set(n, [s + 1, await t(n, r, s)]);
}
return new c(function* () {
for (const [n, [r, s]] of t)
return new f(function* () {
for (const [n, [r, s]] of e)
yield [n, s];
});
}
filter(e) {
const t = this._elements;
return new w(async function* () {
filter(t) {
const e = this._elements;
return new m(async function* () {
const n = /* @__PURE__ */ new Map();
for await (const [r, s] of t) {
for await (const [r, s] of e) {
const o = n.get(r) ?? 0;
await e(r, s, o) && (yield [r, s]), n.set(r, o + 1);
await t(r, s, o) && (yield [r, s]), n.set(r, o + 1);
}
});
}
map(e) {
const t = this._elements;
return new w(async function* () {
map(t) {
const e = this._elements;
return new m(async function* () {
const n = /* @__PURE__ */ new Map();
for await (const [r, s] of t) {
for await (const [r, s] of e) {
const o = n.get(r) ?? 0;
yield [r, await e(r, s, o)], n.set(r, o + 1);
yield [r, await t(r, s, o)], n.set(r, o + 1);
}
});
}
async reduce(e, t) {
async reduce(t, e) {
const n = /* @__PURE__ */ new Map();
for await (const [r, s] of this._elements) {
let o, a;
let o, u;
if (n.has(r))
[o, a] = n.get(r);
else if (t !== void 0)
o = 0, a = await t(r);
[o, u] = n.get(r);
else if (e !== void 0)
o = 0, u = await e(r);
else {

@@ -513,5 +503,5 @@ n.set(r, [0, s]);

}
n.set(r, [o + 1, await e(r, a, s, o)]);
n.set(r, [o + 1, await t(r, u, s, o)]);
}
return new c(function* () {
return new f(function* () {
for (const [r, [s, o]] of n)

@@ -521,10 +511,10 @@ yield [r, o];

}
flatMap(e) {
const t = this._elements;
return new w(async function* () {
flatMap(t) {
const e = this._elements;
return new m(async function* () {
const n = /* @__PURE__ */ new Map();
for await (const [r, s] of t) {
const o = n.get(r) ?? 0, a = await e(r, s, o);
for await (const p of a)
yield [r, p];
for await (const [r, s] of e) {
const o = n.get(r) ?? 0, u = await t(r, s, o);
for await (const _ of u)
yield [r, _];
n.set(r, o + 1);

@@ -534,9 +524,9 @@ }

}
drop(e) {
const t = this._elements;
return new w(async function* () {
drop(t) {
const e = this._elements;
return new m(async function* () {
const n = /* @__PURE__ */ new Map();
for await (const [r, s] of t) {
for await (const [r, s] of e) {
const o = n.get(r) ?? 0;
if (o < e) {
if (o < t) {
n.set(r, o + 1);

@@ -549,10 +539,10 @@ continue;

}
take(e) {
const t = this._elements;
return new w(async function* () {
take(t) {
const e = this._elements;
return new m(async function* () {
const n = /* @__PURE__ */ new Map();
for await (const [r, s] of t) {
for await (const [r, s] of e) {
const o = n.get(r) ?? 0;
if (o >= e) {
if (n.values().every((a) => a >= e))
if (o >= t) {
if (n.values().every((u) => u >= t))
break;

@@ -565,10 +555,10 @@ continue;

}
async find(e) {
const t = /* @__PURE__ */ new Map();
async find(t) {
const e = /* @__PURE__ */ new Map();
for await (const [n, r] of this._elements) {
let [s, o] = t.get(n) ?? [0, void 0];
o === void 0 && (await e(n, r, s) && (o = r), t.set(n, [s + 1, o]));
let [s, o] = e.get(n) ?? [0, void 0];
o === void 0 && (await t(n, r, s) && (o = r), e.set(n, [s + 1, o]));
}
return new c(function* () {
for (const [n, [r, s]] of t)
return new f(function* () {
for (const [n, [r, s]] of e)
yield [n, s];

@@ -578,8 +568,8 @@ });

unique() {
const e = this._elements;
return new w(async function* () {
const t = /* @__PURE__ */ new Map();
for await (const [n, r] of e) {
const s = t.get(n) ?? /* @__PURE__ */ new Set();
s.has(r) || (s.add(r), t.set(n, s), yield [n, r]);
const t = this._elements;
return new m(async function* () {
const e = /* @__PURE__ */ new Map();
for await (const [n, r] of t) {
const s = e.get(n) ?? /* @__PURE__ */ new Set();
s.has(r) || (s.add(r), e.set(n, s), yield [n, r]);
}

@@ -589,25 +579,25 @@ });

async count() {
const e = /* @__PURE__ */ new Map();
for await (const [t] of this._elements) {
const n = e.get(t) ?? 0;
e.set(t, n + 1);
const t = /* @__PURE__ */ new Map();
for await (const [e] of this._elements) {
const n = t.get(e) ?? 0;
t.set(e, n + 1);
}
return new c(function* () {
for (const [t, n] of e)
yield [t, n];
return new f(function* () {
for (const [e, n] of t)
yield [e, n];
});
}
async forEach(e) {
const t = /* @__PURE__ */ new Map();
async forEach(t) {
const e = /* @__PURE__ */ new Map();
for await (const [n, r] of this._elements) {
const s = t.get(n) ?? 0;
e(n, r, s), t.set(n, s + 1);
const s = e.get(n) ?? 0;
t(n, r, s), e.set(n, s + 1);
}
}
keys() {
const e = this._elements;
const t = this._elements;
return new h(async function* () {
const t = /* @__PURE__ */ new Set();
for await (const [n] of e)
t.has(n) || (t.add(n), yield n);
const e = /* @__PURE__ */ new Set();
for await (const [n] of t)
e.has(n) || (e.add(n), yield n);
});

@@ -619,5 +609,5 @@ }

values() {
const e = this._elements;
const t = this._elements;
return new h(async function* () {
for await (const [t, n] of e)
for await (const [e, n] of t)
yield n;

@@ -627,36 +617,36 @@ });

async toArray() {
const e = await this.toMap();
return Array.from(e.values());
const t = await this.toMap();
return Array.from(t.values());
}
async toMap() {
const e = /* @__PURE__ */ new Map();
for await (const [t, n] of this._elements) {
const r = e.get(t) ?? [];
r.push(n), e.set(t, r);
const t = /* @__PURE__ */ new Map();
for await (const [e, n] of this._elements) {
const r = t.get(e) ?? [];
r.push(n), t.set(e, r);
}
return e;
return t;
}
async toObject() {
const e = {};
for await (const [t, n] of this._elements) {
const r = e[t] ?? [];
r.push(n), e[t] = r;
const t = {};
for await (const [e, n] of this._elements) {
const r = t[e] ?? [];
r.push(n), t[e] = r;
}
return e;
return t;
}
get [Symbol.toStringTag]() {
return "AggregatedAsyncIterator";
}
}
};
let S = m;
var he;
class h {
constructor(e) {
u(this, "_iterator");
u(this, "return");
u(this, "throw");
if (e instanceof Function) {
const t = e();
Symbol.asyncIterator in t ? this._iterator = t : this._iterator = async function* () {
constructor(t) {
a(this, "_iterator");
a(this, "return");
a(this, "throw");
a(this, he, "SmartAsyncIterator");
if (t instanceof Function) {
const e = t();
Symbol.asyncIterator in e ? this._iterator = e : this._iterator = async function* () {
let n = [];
for (; ; ) {
const r = t.next(...n);
const r = e.next(...n);
if (r.done)

@@ -667,9 +657,9 @@ return r.value;

}();
} else if (Symbol.asyncIterator in e)
this._iterator = e[Symbol.asyncIterator]();
else if (Symbol.iterator in e) {
const t = e[Symbol.iterator]();
} else if (Symbol.asyncIterator in t)
this._iterator = t[Symbol.asyncIterator]();
else if (Symbol.iterator in t) {
const e = t[Symbol.iterator]();
this._iterator = async function* () {
for (; ; ) {
const n = t.next();
const n = e.next();
if (n.done)

@@ -682,14 +672,14 @@ return n.value;

this._iterator = async function* () {
let t = [];
let e = [];
for (; ; ) {
const n = await e.next(...t);
const n = await t.next(...e);
if (n.done)
return n.value;
t = [yield n.value];
e = [yield n.value];
}
}();
this._iterator.return && (this.return = (t) => this._iterator.return(t)), this._iterator.throw && (this.throw = (t) => this._iterator.throw(t));
this._iterator.return && (this.return = (e) => this._iterator.return(e)), this._iterator.throw && (this.throw = (e) => this._iterator.throw(e));
}
async every(e) {
let t = 0;
async every(t) {
let e = 0;
for (; ; ) {

@@ -699,9 +689,9 @@ const n = await this._iterator.next();

return !0;
if (!await e(n.value, t))
if (!await t(n.value, e))
return !1;
t += 1;
e += 1;
}
}
async some(e) {
let t = 0;
async some(t) {
let e = 0;
for (; ; ) {

@@ -711,37 +701,37 @@ const n = await this._iterator.next();

return !1;
if (await e(n.value, t))
if (await t(n.value, e))
return !0;
t += 1;
e += 1;
}
}
filter(e) {
const t = this._iterator;
filter(t) {
const e = this._iterator;
return new h(async function* () {
let n = 0;
for (; ; ) {
const r = await t.next();
const r = await e.next();
if (r.done)
return r.value;
await e(r.value, n) && (yield r.value), n += 1;
await t(r.value, n) && (yield r.value), n += 1;
}
});
}
map(e) {
const t = this._iterator;
map(t) {
const e = this._iterator;
return new h(async function* () {
let n = 0;
for (; ; ) {
const r = await t.next();
const r = await e.next();
if (r.done)
return r.value;
yield await e(r.value, n), n += 1;
yield await t(r.value, n), n += 1;
}
});
}
async reduce(e, t) {
let n = 0, r = t;
async reduce(t, e) {
let n = 0, r = e;
if (r === void 0) {
const s = await this._iterator.next();
if (s.done)
throw new m("Cannot reduce an empty iterator without an initial value.");
throw new d("Cannot reduce an empty iterator without an initial value.");
r = s.value, n += 1;

@@ -753,14 +743,14 @@ }

return r;
r = await e(r, s.value, n), n += 1;
r = await t(r, s.value, n), n += 1;
}
}
flatMap(e) {
const t = this._iterator;
flatMap(t) {
const e = this._iterator;
return new h(async function* () {
let n = 0;
for (; ; ) {
const r = await t.next();
const r = await e.next();
if (r.done)
return r.value;
const s = await e(r.value, n);
const s = await t(r.value, n);
for await (const o of s)

@@ -772,8 +762,8 @@ yield o;

}
drop(e) {
const t = this._iterator;
drop(t) {
const e = this._iterator;
return new h(async function* () {
let n = 0;
for (; n < e; ) {
if ((await t.next()).done)
for (; n < t; ) {
if ((await e.next()).done)
return;

@@ -783,3 +773,3 @@ n += 1;

for (; ; ) {
const r = await t.next();
const r = await e.next();
if (r.done)

@@ -791,8 +781,8 @@ return r.value;

}
take(e) {
const t = this._iterator;
take(t) {
const e = this._iterator;
return new h(async function* () {
let n = 0;
for (; n < e; ) {
const r = await t.next();
for (; n < t; ) {
const r = await e.next();
if (r.done)

@@ -804,4 +794,4 @@ return r.value;

}
async find(e) {
let t = 0;
async find(t) {
let e = 0;
for (; ; ) {

@@ -811,19 +801,19 @@ const n = await this._iterator.next();

return;
if (await e(n.value, t))
if (await t(n.value, e))
return n.value;
t += 1;
e += 1;
}
}
enumerate() {
return this.map((e, t) => [t, e]);
return this.map((t, e) => [e, t]);
}
unique() {
const e = this._iterator;
const t = this._iterator;
return new h(async function* () {
const t = /* @__PURE__ */ new Set();
const e = /* @__PURE__ */ new Set();
for (; ; ) {
const n = await e.next();
const n = await t.next();
if (n.done)
return n.value;
t.has(n.value) || (t.add(n.value), yield n.value);
e.has(n.value) || (e.add(n.value), yield n.value);
}

@@ -833,11 +823,11 @@ });

async count() {
let e = 0;
let t = 0;
for (; ; ) {
if ((await this._iterator.next()).done)
return e;
e += 1;
return t;
t += 1;
}
}
async forEach(e) {
let t = 0;
async forEach(t) {
let e = 0;
for (; ; ) {

@@ -847,10 +837,10 @@ const n = await this._iterator.next();

return;
await e(n.value, t), t += 1;
await t(n.value, e), e += 1;
}
}
next(...e) {
return this._iterator.next(...e);
next(...t) {
return this._iterator.next(...t);
}
groupBy(e) {
return new w(this.map(async (t, n) => [await e(t, n), t]));
groupBy(t) {
return new S(this.map(async (e, n) => [await t(e, n), e]));
}

@@ -860,64 +850,64 @@ toArray() {

}
get [Symbol.toStringTag]() {
return "SmartAsyncIterator";
}
[Symbol.asyncIterator]() {
[(he = Symbol.toStringTag, Symbol.asyncIterator)]() {
return this;
}
}
class d {
constructor(e) {
u(this, "_elements");
this._elements = new l(e);
var de;
de = Symbol.toStringTag;
const w = class w {
constructor(t) {
a(this, "_elements");
a(this, de, "AggregatedIterator");
this._elements = new l(t);
}
every(e) {
const t = /* @__PURE__ */ new Map();
every(t) {
const e = /* @__PURE__ */ new Map();
for (const [n, r] of this._elements) {
const [s, o] = t.get(n) ?? [0, !0];
o && t.set(n, [s + 1, e(n, r, s)]);
const [s, o] = e.get(n) ?? [0, !0];
o && e.set(n, [s + 1, t(n, r, s)]);
}
return new c(function* () {
for (const [n, [r, s]] of t)
return new f(function* () {
for (const [n, [r, s]] of e)
yield [n, s];
});
}
some(e) {
const t = /* @__PURE__ */ new Map();
some(t) {
const e = /* @__PURE__ */ new Map();
for (const [n, r] of this._elements) {
const [s, o] = t.get(n) ?? [0, !1];
o || t.set(n, [s + 1, e(n, r, s)]);
const [s, o] = e.get(n) ?? [0, !1];
o || e.set(n, [s + 1, t(n, r, s)]);
}
return new c(function* () {
for (const [n, [r, s]] of t)
return new f(function* () {
for (const [n, [r, s]] of e)
yield [n, s];
});
}
filter(e) {
const t = this._elements;
return new d(function* () {
filter(t) {
const e = this._elements;
return new w(function* () {
const n = /* @__PURE__ */ new Map();
for (const [r, s] of t) {
for (const [r, s] of e) {
const o = n.get(r) ?? 0;
e(r, s, o) && (yield [r, s]), n.set(r, o + 1);
t(r, s, o) && (yield [r, s]), n.set(r, o + 1);
}
});
}
map(e) {
const t = this._elements;
return new d(function* () {
map(t) {
const e = this._elements;
return new w(function* () {
const n = /* @__PURE__ */ new Map();
for (const [r, s] of t) {
for (const [r, s] of e) {
const o = n.get(r) ?? 0;
yield [r, e(r, s, o)], n.set(r, o + 1);
yield [r, t(r, s, o)], n.set(r, o + 1);
}
});
}
reduce(e, t) {
reduce(t, e) {
const n = /* @__PURE__ */ new Map();
for (const [r, s] of this._elements) {
let o, a;
let o, u;
if (n.has(r))
[o, a] = n.get(r);
else if (t !== void 0)
o = 0, a = t(r);
[o, u] = n.get(r);
else if (e !== void 0)
o = 0, u = e(r);
else {

@@ -927,5 +917,5 @@ n.set(r, [0, s]);

}
n.set(r, [o + 1, e(r, a, s, o)]);
n.set(r, [o + 1, t(r, u, s, o)]);
}
return new c(function* () {
return new f(function* () {
for (const [r, [s, o]] of n)

@@ -935,10 +925,10 @@ yield [r, o];

}
flatMap(e) {
const t = this._elements;
return new d(function* () {
flatMap(t) {
const e = this._elements;
return new w(function* () {
const n = /* @__PURE__ */ new Map();
for (const [r, s] of t) {
const o = n.get(r) ?? 0, a = e(r, s, o);
for (const p of a)
yield [r, p];
for (const [r, s] of e) {
const o = n.get(r) ?? 0, u = t(r, s, o);
for (const _ of u)
yield [r, _];
n.set(r, o + 1);

@@ -948,9 +938,9 @@ }

}
drop(e) {
const t = this._elements;
return new d(function* () {
drop(t) {
const e = this._elements;
return new w(function* () {
const n = /* @__PURE__ */ new Map();
for (const [r, s] of t) {
for (const [r, s] of e) {
const o = n.get(r) ?? 0;
if (o < e) {
if (o < t) {
n.set(r, o + 1);

@@ -963,10 +953,10 @@ continue;

}
take(e) {
const t = this._elements;
return new d(function* () {
take(t) {
const e = this._elements;
return new w(function* () {
const n = /* @__PURE__ */ new Map();
for (const [r, s] of t) {
for (const [r, s] of e) {
const o = n.get(r) ?? 0;
if (o >= e) {
if (n.values().every((a) => a >= e))
if (o >= t) {
if (n.values().every((u) => u >= t))
break;

@@ -979,10 +969,10 @@ continue;

}
find(e) {
const t = /* @__PURE__ */ new Map();
find(t) {
const e = /* @__PURE__ */ new Map();
for (const [n, r] of this._elements) {
let [s, o] = t.get(n) ?? [0, void 0];
o === void 0 && (e(n, r, s) && (o = r), t.set(n, [s + 1, o]));
let [s, o] = e.get(n) ?? [0, void 0];
o === void 0 && (t(n, r, s) && (o = r), e.set(n, [s + 1, o]));
}
return new c(function* () {
for (const [n, [r, s]] of t)
return new f(function* () {
for (const [n, [r, s]] of e)
yield [n, s];

@@ -992,11 +982,11 @@ });

enumerate() {
return this.map((e, t, n) => [n, t]);
return this.map((t, e, n) => [n, e]);
}
unique() {
const e = this._elements;
return new d(function* () {
const t = /* @__PURE__ */ new Map();
for (const [n, r] of e) {
const s = t.get(n) ?? /* @__PURE__ */ new Set();
s.has(r) || (s.add(r), t.set(n, s), yield [n, r]);
const t = this._elements;
return new w(function* () {
const e = /* @__PURE__ */ new Map();
for (const [n, r] of t) {
const s = e.get(n) ?? /* @__PURE__ */ new Set();
s.has(r) || (s.add(r), e.set(n, s), yield [n, r]);
}

@@ -1006,25 +996,25 @@ });

count() {
const e = /* @__PURE__ */ new Map();
for (const [t] of this._elements) {
const n = e.get(t) ?? 0;
e.set(t, n + 1);
const t = /* @__PURE__ */ new Map();
for (const [e] of this._elements) {
const n = t.get(e) ?? 0;
t.set(e, n + 1);
}
return new c(function* () {
for (const [t, n] of e)
yield [t, n];
return new f(function* () {
for (const [e, n] of t)
yield [e, n];
});
}
forEach(e) {
const t = /* @__PURE__ */ new Map();
forEach(t) {
const e = /* @__PURE__ */ new Map();
for (const [n, r] of this._elements) {
const s = t.get(n) ?? 0;
e(n, r, s), t.set(n, s + 1);
const s = e.get(n) ?? 0;
t(n, r, s), e.set(n, s + 1);
}
}
keys() {
const e = this._elements;
const t = this._elements;
return new l(function* () {
const t = /* @__PURE__ */ new Set();
for (const [n] of e)
t.has(n) || (t.add(n), yield n);
const e = /* @__PURE__ */ new Set();
for (const [n] of t)
e.has(n) || (e.add(n), yield n);
});

@@ -1036,5 +1026,5 @@ }

values() {
const e = this._elements;
const t = this._elements;
return new l(function* () {
for (const [t, n] of e)
for (const [e, n] of t)
yield n;

@@ -1044,54 +1034,55 @@ });

toArray() {
const e = this.toMap();
return Array.from(e.values());
const t = this.toMap();
return Array.from(t.values());
}
toMap() {
const e = /* @__PURE__ */ new Map();
for (const [t, n] of this._elements) {
const r = e.get(t) ?? [];
r.push(n), e.set(t, r);
const t = /* @__PURE__ */ new Map();
for (const [e, n] of this._elements) {
const r = t.get(e) ?? [];
r.push(n), t.set(e, r);
}
return e;
return t;
}
toObject() {
const e = {};
for (const [t, n] of this._elements) {
const r = e[t] ?? [];
r.push(n), e[t] = r;
const t = {};
for (const [e, n] of this._elements) {
const r = t[e] ?? [];
r.push(n), t[e] = r;
}
return e;
return t;
}
get [Symbol.toStringTag]() {
return "AggregatedIterator";
}
};
let g = w;
var b = /* @__PURE__ */ ((i) => (i[i.Millisecond = 1] = "Millisecond", i[i.Second = 1e3] = "Second", i[i.Minute = 6e4] = "Minute", i[i.Hour = 36e5] = "Hour", i[i.Day = 864e5] = "Day", i[i.Week = 6048e5] = "Week", i[i.Month = 2592e6] = "Month", i[i.Year = 31536e6] = "Year", i))(b || {});
function Le(i, t, e = 864e5) {
return i = new Date(i), t = new Date(t), Math.floor((t.getTime() - i.getTime()) / e);
}
var x = /* @__PURE__ */ ((i) => (i[i.Millisecond = 1] = "Millisecond", i[i.Second = 1e3] = "Second", i[i.Minute = 6e4] = "Minute", i[i.Hour = 36e5] = "Hour", i[i.Day = 864e5] = "Day", i[i.Week = 6048e5] = "Week", i[i.Month = 2592e6] = "Month", i[i.Year = 31536e6] = "Year", i))(x || {});
function G(i, e, t = 864e5) {
return i = new Date(i), e = new Date(e), Math.floor((e.getTime() - i.getTime()) / t);
}
function H(i, e, t = 864e5) {
return i = new Date(i), e = new Date(e), new l(function* () {
const n = e.getTime();
function Qe(i, t, e = 864e5) {
return i = new Date(i), t = new Date(t), new l(function* () {
const n = t.getTime();
let r = i.getTime();
for (; r < n; )
yield new Date(r), r += t;
yield new Date(r), r += e;
});
}
function L(i, e = 864e5) {
return i = new Date(i), new Date(Math.floor(i.getTime() / e) * e);
function Xe(i, t = 864e5) {
return i = new Date(i), new Date(Math.floor(i.getTime() / t) * t);
}
class M {
constructor(e, t = 30) {
u(this, "_handle");
u(this, "_startTime");
u(this, "_isRunning");
u(this, "_start");
u(this, "_stop");
this._startTime = 0, this._isRunning = !1, S ? (this._start = () => {
e(this.elapsedTime), this._handle = window.requestAnimationFrame(this._start);
var me;
me = Symbol.toStringTag;
class Pe {
constructor(t, e = 30) {
a(this, "_handle");
a(this, "_startTime");
a(this, "_isRunning");
a(this, "_start");
a(this, "_stop");
a(this, me, "GameLoop");
this._startTime = 0, this._isRunning = !1, Me ? (this._start = () => {
t(this.elapsedTime), this._handle = window.requestAnimationFrame(this._start);
}, this._stop = () => window.cancelAnimationFrame(this._handle)) : (console.warn(
`Not a browser environment detected. Using setInterval@${t}fps instead of requestAnimationFrame...`
`Not a browser environment detected. Using setInterval@${e}fps instead of requestAnimationFrame...`
), this._start = () => {
const n = x.Second / t;
this._handle = setInterval(() => e(this.elapsedTime), n);
const n = b.Second / e;
this._handle = setInterval(() => t(this.elapsedTime), n);
}, this._stop = () => clearInterval(this._handle));

@@ -1108,22 +1099,25 @@ }

}
start(e = 0) {
start(t = 0) {
if (this._isRunning)
throw new y("The game loop has already been started.");
this._startTime = performance.now() - e, this._start(), this._isRunning = !0;
throw new p("The game loop has already been started.");
this._startTime = performance.now() - t, this._start(), this._isRunning = !0;
}
stop() {
if (!this._isRunning)
throw new y("The game loop hadn't yet started.");
throw new p("The game loop hadn't yet started.");
if (!this._handle)
throw new _();
throw new x();
this._stop(), this._handle = void 0, this._isRunning = !1;
}
}
class Q {
constructor(e = !0) {
u(this, "_preferPersistence");
u(this, "_volatile");
u(this, "_persistent");
if (this._preferPersistence = e, !S)
throw new C(
var we;
we = Symbol.toStringTag;
class Ze {
constructor(t = !0) {
a(this, "_preferPersistence");
a(this, "_volatile");
a(this, "_persistent");
a(this, we, "JSONStorage");
if (this._preferPersistence = t, !Me)
throw new De(
"The `JSONStorage` class can only be instantiated within a browser environment."

@@ -1133,4 +1127,4 @@ );

}
_get(e, t, n) {
const r = e.getItem(t);
_get(t, e, n) {
const r = t.getItem(e);
if (r)

@@ -1141,23 +1135,23 @@ try {

console.warn(
`The "${r}" value for "${t}" property cannot be parsed. Clearing the storage...`
), e.removeItem(t);
`The "${r}" value for "${e}" property cannot be parsed. Clearing the storage...`
), t.removeItem(e);
}
return n;
}
_set(e, t, n) {
_set(t, e, n) {
const r = JSON.stringify(n);
r ? e.setItem(t, r) : e.removeItem(t);
r ? t.setItem(e, r) : t.removeItem(e);
}
get(e, t, n = this._preferPersistence) {
get(t, e, n = this._preferPersistence) {
const r = n ? this._persistent : this._volatile;
return this._get(r, e, t);
return this._get(r, t, e);
}
recall(e, t) {
return this._get(this._volatile, e, t);
recall(t, e) {
return this._get(this._volatile, t, e);
}
retrieve(e, t) {
return this.recall(e) ?? this.read(e, t);
retrieve(t, e) {
return this.recall(t) ?? this.read(t, e);
}
read(e, t) {
return this._get(this._persistent, e, t);
read(t, e) {
return this._get(this._persistent, t, e);
}

@@ -1172,4 +1166,4 @@ /**

*/
has(e, t) {
return (t ? this._persistent : this._volatile).getItem(e) !== null;
has(t, e) {
return (e ? this._persistent : this._volatile).getItem(t) !== null;
}

@@ -1183,4 +1177,4 @@ /**

*/
knows(e) {
return this._volatile.getItem(e) !== null;
knows(t) {
return this._volatile.getItem(t) !== null;
}

@@ -1195,4 +1189,4 @@ /**

*/
find(e) {
return this.knows(e) ?? this.exists(e);
find(t) {
return this.knows(t) ?? this.exists(t);
}

@@ -1206,4 +1200,4 @@ /**

*/
exists(e) {
return this._persistent.getItem(e) !== null;
exists(t) {
return this._persistent.getItem(t) !== null;
}

@@ -1218,5 +1212,5 @@ /**

*/
set(e, t, n = this._preferPersistence) {
set(t, e, n = this._preferPersistence) {
const r = n ? this._persistent : this._volatile;
this._set(r, e, t);
this._set(r, t, e);
}

@@ -1230,4 +1224,4 @@ /**

*/
remember(e, t) {
this._set(this._volatile, e, t);
remember(t, e) {
this._set(this._volatile, t, e);
}

@@ -1241,4 +1235,4 @@ /**

*/
write(e, t) {
this._set(this._persistent, e, t);
write(t, e) {
this._set(this._persistent, t, e);
}

@@ -1250,4 +1244,4 @@ /**

*/
forget(e) {
this._volatile.removeItem(e);
forget(t) {
this._volatile.removeItem(t);
}

@@ -1259,4 +1253,4 @@ /**

*/
erase(e) {
this._persistent.removeItem(e);
erase(t) {
this._persistent.removeItem(t);
}

@@ -1268,23 +1262,23 @@ /**

*/
clear(e) {
this._volatile.removeItem(e), this._persistent.removeItem(e);
clear(t) {
this._volatile.removeItem(t), this._persistent.removeItem(t);
}
get [Symbol.toStringTag]() {
return "JSONStorage";
}
}
class v {
constructor(e) {
u(this, "_isPending");
u(this, "_isFulfilled");
u(this, "_isRejected");
u(this, "_promise");
var ye;
ye = Symbol.toStringTag;
const E = class E {
constructor(t) {
a(this, "_isPending");
a(this, "_isFulfilled");
a(this, "_isRejected");
a(this, "_promise");
a(this, ye, "SmartPromise");
this._isPending = !0, this._isFulfilled = !1, this._isRejected = !1;
const t = (r) => (this._isPending = !1, this._isFulfilled = !0, r), n = (r) => {
const e = (r) => (this._isPending = !1, this._isFulfilled = !0, r), n = (r) => {
throw this._isPending = !1, this._isRejected = !0, r;
};
this._promise = new Promise(e).then(t, n);
this._promise = new Promise(t).then(e, n);
}
static FromPromise(e) {
return new v((t, n) => e.then(t, n));
static FromPromise(t) {
return new E((e, n) => t.then(e, n));
}

@@ -1300,24 +1294,24 @@ get isPending() {

}
then(e, t) {
return this._promise.then(e, t);
then(t, e) {
return this._promise.then(t, e);
}
catch(e) {
return this._promise.catch(e);
catch(t) {
return this._promise.catch(t);
}
finally(e) {
return this._promise.finally(e);
finally(t) {
return this._promise.finally(t);
}
get [Symbol.toStringTag]() {
return "SmartPromise";
}
}
class q extends v {
constructor(t, n) {
};
let v = E;
var pe, _e;
class qe extends (_e = v, pe = Symbol.toStringTag, _e) {
constructor(e, n) {
let r, s;
super((o, a) => {
r = o, s = a;
super((o, u) => {
r = o, s = u;
});
u(this, "_resolve");
u(this, "_reject");
this._promise.then(t, n), this._resolve = r, this._reject = s;
a(this, "_resolve");
a(this, "_reject");
a(this, pe, "DeferredPromise");
this._promise.then(e, n), this._resolve = r, this._reject = s;
}

@@ -1330,73 +1324,72 @@ get resolve() {

}
watch(t) {
return t.then(this.resolve, this.reject), this;
watch(e) {
return e.then(this.resolve, this.reject), this;
}
get [Symbol.toStringTag]() {
return "DeferredPromise";
}
}
class X extends v {
constructor(e, t) {
super((n, r) => {
const s = (g) => {
clearTimeout(p), n(g);
}, o = (g) => {
clearTimeout(p), r(g);
}, p = setTimeout(() => o(new O("The operation has timed out.")), t);
e(s, o);
var xe, ge;
class Ue extends (ge = v, xe = Symbol.toStringTag, ge) {
constructor(e, n) {
super((r, s) => {
const o = (k) => {
clearTimeout(M), r(k);
}, u = (k) => {
clearTimeout(M), s(k);
}, M = setTimeout(() => u(new Oe("The operation has timed out.")), n);
e(o, u);
});
a(this, xe, "TimedPromise");
}
get [Symbol.toStringTag]() {
return "TimedPromise";
}
}
class F {
var ve;
ve = Symbol.toStringTag;
class je {
constructor() {
u(this, "_subscribers");
a(this, "_subscribers");
a(this, ve, "Publisher");
this._subscribers = [];
}
subscribe(e) {
return this._subscribers.push(e), () => {
const t = this._subscribers.indexOf(e);
if (t < 0)
throw new D("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed.");
this._subscribers.splice(t, 1);
subscribe(t) {
return this._subscribers.push(t), () => {
const e = this._subscribers.indexOf(t);
if (e < 0)
throw new Ce("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed.");
this._subscribers.splice(e, 1);
};
}
publish(...e) {
return this._subscribers.slice().map((t) => t(...e));
publish(...t) {
return this._subscribers.slice().map((e) => e(...t));
}
get [Symbol.toStringTag]() {
return "Publisher";
}
}
class Z extends M {
constructor(t = x.Second) {
super((n) => this._publisher.publish(n), t);
u(this, "_publisher");
this._publisher = new F();
var be, ke;
class et extends (ke = Pe, be = Symbol.toStringTag, ke) {
constructor(e = b.Second) {
super((n) => this._publisher.publish(n), e);
a(this, "_publisher");
a(this, be, "Clock");
this._publisher = new je();
}
start(t = 0) {
start(e = 0) {
if (this._isRunning)
throw new y("The clock has already been started.");
super.start(t);
throw new p("The clock has already been started.");
super.start(e);
}
stop() {
if (!this._isRunning)
throw new y("The clock hadn't yet started.");
throw new p("The clock hadn't yet started.");
super.stop();
}
onTick(t, n = 0) {
onTick(e, n = 0) {
if (n < 0)
throw new T("The tick step must be a non-negative number.");
throw new Fe("The tick step must be a non-negative number.");
if (n === 0)
return this._publisher.subscribe(t);
return this._publisher.subscribe(e);
let r = 0;
return this._publisher.subscribe((s) => {
s - r < n || (t(s), r = s);
s - r < n || (e(s), r = s);
});
}
}
class U extends M {
constructor(t, n = x.Second) {
var Se, Ee;
class tt extends (Ee = Pe, Se = Symbol.toStringTag, Ee) {
constructor(e, n = b.Second) {
super(() => {

@@ -1406,6 +1399,7 @@ const s = this.remainingTime;

}, n);
u(this, "_deferrer");
u(this, "_publisher");
u(this, "_duration");
this._publisher = new F(), this._duration = t;
a(this, "_deferrer");
a(this, "_publisher");
a(this, "_duration");
a(this, Se, "Countdown");
this._publisher = new je(), this._duration = e;
}

@@ -1418,110 +1412,113 @@ get duration() {

}
start(t = this.duration) {
start(e = this.duration) {
if (this._isRunning)
throw new y("The countdown has already been started.");
throw new p("The countdown has already been started.");
if (this._deferrer)
throw new _();
return this._deferrer = new q(), super.start(this.duration - t), this._deferrer;
throw new x();
return this._deferrer = new qe(), super.start(this.duration - e), this._deferrer;
}
stop(t) {
stop(e) {
if (!this._isRunning)
throw new y("The countdown hadn't yet started.");
throw new p("The countdown hadn't yet started.");
if (!this._deferrer)
throw new _();
super.stop(), t !== void 0 ? this._deferrer.reject(t) : this._deferrer.resolve(), this._deferrer = void 0;
throw new x();
super.stop(), e !== void 0 ? this._deferrer.reject(e) : this._deferrer.resolve(), this._deferrer = void 0;
}
onTick(t, n = 0) {
onTick(e, n = 0) {
if (n < 0)
throw new T("The tick step must be a non-negative number.");
throw new Fe("The tick step must be a non-negative number.");
if (n === 0)
return this._publisher.subscribe(t);
return this._publisher.subscribe(e);
let r = 0;
return this._publisher.subscribe((s) => {
r - s < n || (t(s), r = s);
r - s < n || (e(s), r = s);
});
}
}
class R {
static Boolean(e = 0.5) {
return Math.random() < e;
var Te;
Te = Symbol.toStringTag;
const T = class T {
constructor() {
a(this, Te, "Random");
}
static Integer(e, t) {
return Math.floor(t === void 0 ? Math.random() * e : Math.random() * (t - e) + e);
static Boolean(t = 0.5) {
return Math.random() < t;
}
static Decimal(e, t) {
return e === void 0 ? Math.random() : t === void 0 ? Math.random() * e : Math.random() * (t - e) + e;
static Integer(t, e) {
return Math.floor(e === void 0 ? Math.random() * t : Math.random() * (e - t) + t);
}
static Index(e) {
if (e.length === 0)
throw new m("You must provide at least one element.");
return this.Integer(e.length);
static Decimal(t, e) {
return t === void 0 ? Math.random() : e === void 0 ? Math.random() * t : Math.random() * (e - t) + t;
}
static Choice(e) {
return e[R.Index(e)];
static Index(t) {
if (t.length === 0)
throw new d("You must provide at least one element.");
return this.Integer(t.length);
}
// eslint-disable-next-line no-useless-constructor
constructor() {
static Choice(t) {
return t[T.Index(t)];
}
};
let R = T;
function nt(i) {
return new Promise((t) => setTimeout(t, i));
}
function ee(i) {
return new Promise((e) => setTimeout(e, i));
}
function te() {
function rt() {
return new Promise((i) => requestAnimationFrame(() => i()));
}
function ne(i, e = "text/javascript") {
return new Promise((t, n) => {
function st(i, t = "text/javascript") {
return new Promise((e, n) => {
const r = document.createElement("script");
r.async = !0, r.defer = !0, r.src = i, r.type = e, r.onload = () => t(), r.onerror = () => n(), document.body.appendChild(r);
r.async = !0, r.defer = !0, r.src = i, r.type = t, r.onload = () => e(), r.onerror = () => n(), document.body.appendChild(r);
});
}
function re(...i) {
function it(...i) {
return new l(function* () {
for (const e of i)
for (const t of e)
yield t;
for (const t of i)
for (const e of t)
yield e;
});
}
function se(i) {
function ot(i) {
if (Array.isArray(i))
return i.length;
let e = 0;
for (const t of i)
e += 1;
return e;
let t = 0;
for (const e of i)
t += 1;
return t;
}
function ie(i) {
function at(i) {
return new l(function* () {
let e = 0;
for (const t of i)
yield [e, t], e += 1;
let t = 0;
for (const e of i)
yield [t, e], t += 1;
});
}
function oe(i, e, t = 1) {
function ut(i, t, e = 1) {
return new l(function* () {
e === void 0 && (e = i, i = 0), i > e && (t = t ?? -1);
for (let n = i; n < e; n += t)
t === void 0 && (t = i, i = 0), i > t && (e = e ?? -1);
for (let n = i; n < t; n += e)
yield n;
});
}
function ue(i) {
const e = Array.from(i);
for (let t = e.length - 1; t > 0; t -= 1) {
const n = Math.floor(Math.random() * (t + 1));
[e[t], e[n]] = [e[n], e[t]];
function lt(i) {
const t = Array.from(i);
for (let e = t.length - 1; e > 0; e -= 1) {
const n = Math.floor(Math.random() * (e + 1));
[t[e], t[n]] = [t[n], t[e]];
}
return e;
return t;
}
function ae(i) {
function ct(i) {
return new l(function* () {
const e = /* @__PURE__ */ new Set();
for (const t of i)
e.has(t) || (e.add(t), yield t);
const t = /* @__PURE__ */ new Set();
for (const e of i)
t.has(e) || (t.add(e), yield e);
});
}
function I(i, e) {
function Ne(i, t) {
return new l(function* () {
const t = i[Symbol.iterator](), n = e[Symbol.iterator]();
const e = i[Symbol.iterator](), n = t[Symbol.iterator]();
for (; ; ) {
const r = t.next(), s = n.next();
const r = e.next(), s = n.next();
if (r.done || s.done)

@@ -1533,94 +1530,94 @@ break;

}
function le(i, e) {
if (e === void 0) {
function ft(i, t) {
if (t === void 0) {
let s = 0, o = 0;
for (const a of i)
s += a, o += 1;
for (const u of i)
s += u, o += 1;
if (o === 0)
throw new m("You must provide at least one value.");
throw new d("You must provide at least one value.");
return s / o;
}
let t = 0, n = 0, r = 0;
for (const [s, o] of I(i, e)) {
let e = 0, n = 0, r = 0;
for (const [s, o] of Ne(i, t)) {
if (o <= 0)
throw new m(`The weight for the value #${r} must be greater than zero.`);
t += s * o, n += o, r += 1;
throw new d(`The weight for the value #${r} must be greater than zero.`);
e += s * o, n += o, r += 1;
}
if (r === 0)
throw new m("You must provide at least one value and weight.");
throw new d("You must provide at least one value and weight.");
if (n > 0)
throw new m("The sum of weights must be greater than zero.");
return t / n;
throw new d("The sum of weights must be greater than zero.");
return e / n;
}
function ce(i) {
let e = 0;
for (let t = 0; t < i.length; t += 1) {
const n = i.charCodeAt(t);
e = (e << 5) - e + n, e |= 0;
function ht(i) {
let t = 0;
for (let e = 0; e < i.length; e += 1) {
const n = i.charCodeAt(e);
t = (t << 5) - t + n, t |= 0;
}
return e;
return t;
}
function fe(i) {
let e = 0;
for (const t of i)
e += t;
return e;
function dt(i) {
let t = 0;
for (const e of i)
t += e;
return t;
}
function he(i) {
function mt(i) {
return `${i.charAt(0).toUpperCase()}${i.slice(1)}`;
}
const de = "2.0.0-rc.3";
const wt = "2.0.0-rc.4";
export {
w as AggregatedAsyncIterator,
d as AggregatedIterator,
Z as Clock,
U as Countdown,
q as DeferredPromise,
f as Exception,
_ as FatalErrorException,
E as FileException,
V as FileExistsException,
W as FileNotFoundException,
M as GameLoop,
Q as JSONStorage,
Y as KeyException,
z as NetworkException,
J as NotImplementedException,
B as PermissionException,
F as Publisher,
S as AggregatedAsyncIterator,
g as AggregatedIterator,
et as Clock,
tt as Countdown,
qe as DeferredPromise,
c as Exception,
x as FatalErrorException,
Re as FileException,
Ye as FileExistsException,
ze as FileNotFoundException,
Pe as GameLoop,
Ze as JSONStorage,
Be as KeyException,
Ge as NetworkException,
We as NotImplementedException,
Ke as PermissionException,
je as Publisher,
R as Random,
T as RangeException,
c as ReducedIterator,
D as ReferenceException,
y as RuntimeException,
Fe as RangeException,
f as ReducedIterator,
Ce as ReferenceException,
p as RuntimeException,
h as SmartAsyncIterator,
l as SmartIterator,
v as SmartPromise,
x as TimeUnit,
X as TimedPromise,
O as TimeoutException,
K as TypeException,
de as VERSION,
m as ValueException,
le as average,
he as capitalize,
re as chain,
se as count,
G as dateDifference,
H as dateRange,
L as dateRound,
ee as delay,
ie as enumerate,
ce as hash,
S as isBrowser,
$ as isNode,
A as isWebWorker,
ne as loadScript,
te as nextAnimationFrame,
oe as range,
ue as shuffle,
fe as sum,
ae as unique,
I as zip
b as TimeUnit,
Ue as TimedPromise,
Oe as TimeoutException,
He as TypeException,
wt as VERSION,
d as ValueException,
ft as average,
mt as capitalize,
it as chain,
ot as count,
Le as dateDifference,
Qe as dateRange,
Xe as dateRound,
nt as delay,
at as enumerate,
ht as hash,
Me as isBrowser,
Je as isNode,
Ve as isWebWorker,
st as loadScript,
rt as nextAnimationFrame,
ut as range,
lt as shuffle,
dt as sum,
ct as unique,
Ne as zip
};
//# sourceMappingURL=core.js.map
{
"name": "@byloth/core",
"version": "2.0.0-rc.3",
"version": "2.0.0-rc.4",
"description": "An unopinionated collection of useful functions and classes that I use widely in all my projects. 🔧",

@@ -50,10 +50,7 @@ "keywords": [

"devDependencies": {
"@byloth/eslint-config-typescript": "^2.8.3",
"@types/node": "^20.16.5",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"eslint": "^8.57.1",
"@byloth/eslint-config-typescript": "^3.0.0",
"@types/node": "^20.16.11",
"husky": "^9.1.6",
"typescript": "^5.6.2",
"vite": "^5.4.7"
"typescript": "^5.6.3",
"vite": "^5.4.8"
},

@@ -65,3 +62,3 @@ "scripts": {

"typecheck": "tsc",
"lint": "eslint --ext .cjs,.js,.json,.ts --ignore-path .gitignore .",
"lint": "eslint .",
"test": "vitest",

@@ -68,0 +65,0 @@ "ci": "pnpm install --frozen-lockfile"

@@ -0,3 +1,10 @@

/* eslint-disable @typescript-eslint/ban-ts-comment */
// @ts-ignore
export const isBrowser = ((typeof window !== "undefined") && (typeof window.document !== "undefined"));
// @ts-ignore
export const isNode = ((typeof process !== "undefined") && (process.versions?.node));
// @ts-ignore
export const isWebWorker = ((typeof self === "object") && (self.constructor?.name === "DedicatedWorkerGlobalScope"));

@@ -1,2 +0,2 @@

export const VERSION = "2.0.0-rc.3";
export const VERSION = "2.0.0-rc.4";

@@ -3,0 +3,0 @@ export type { Constructor, Interval, Timeout } from "./core/types.js";

@@ -207,7 +207,7 @@ import { SmartAsyncIterator } from "../iterators/index.js";

public async find(predicate: MaybeAsyncKeyedIteratee<K, T, boolean>): Promise<ReducedIterator<K, T | void>>;
public async find(predicate: MaybeAsyncKeyedIteratee<K, T, boolean>): Promise<ReducedIterator<K, T | undefined>>;
public async find<S extends T>(predicate: MaybeAsyncKeyedTypeGuardIteratee<K, T, S>)
: Promise<ReducedIterator<K, S | void>>;
: Promise<ReducedIterator<K, S | undefined>>;
public async find(predicate: MaybeAsyncKeyedIteratee<K, T, boolean>): Promise<ReducedIterator<K, T | void>>
public async find(predicate: MaybeAsyncKeyedIteratee<K, T, boolean>): Promise<ReducedIterator<K, T | undefined>>
{

@@ -351,3 +351,3 @@ const values = new Map<K, [number, T | undefined]>();

public get [Symbol.toStringTag]() { return "AggregatedAsyncIterator"; }
public readonly [Symbol.toStringTag]: string = "AggregatedAsyncIterator";
}

@@ -195,5 +195,5 @@ import { SmartIterator } from "../iterators/index.js";

public find(predicate: KeyedIteratee<K, T, boolean>): ReducedIterator<K, T | void>;
public find<S extends T>(predicate: KeyedTypeGuardIteratee<K, T, S>): ReducedIterator<K, S | void>;
public find(predicate: KeyedIteratee<K, T, boolean>): ReducedIterator<K, T | void>
public find(predicate: KeyedIteratee<K, T, boolean>): ReducedIterator<K, T | undefined>;
public find<S extends T>(predicate: KeyedTypeGuardIteratee<K, T, S>): ReducedIterator<K, S | undefined>;
public find(predicate: KeyedIteratee<K, T, boolean>): ReducedIterator<K, T | undefined>
{

@@ -341,3 +341,3 @@ const values = new Map<K, [number, T | undefined]>();

public get [Symbol.toStringTag]() { return "AggregatedIterator"; }
public readonly [Symbol.toStringTag]: string = "AggregatedIterator";
}

@@ -212,3 +212,3 @@ import { ValueException } from "../exceptions/index.js";

public get [Symbol.toStringTag]() { return "ReducedIterator"; }
public readonly [Symbol.toStringTag]: string = "ReducedIterator";
}

@@ -42,3 +42,3 @@ export default class Exception extends Error

public get [Symbol.toStringTag]() { return "Exception"; }
public readonly [Symbol.toStringTag]: string = "Exception";
}

@@ -59,3 +59,3 @@

public get [Symbol.toStringTag]() { return "FatalErrorException"; }
public readonly [Symbol.toStringTag]: string = "FatalErrorException";
}

@@ -74,3 +74,3 @@ export class NotImplementedException extends FatalErrorException

public get [Symbol.toStringTag]() { return "NotImplementedException"; }
public readonly [Symbol.toStringTag]: string = "NotImplementedException";
}

@@ -10,3 +10,3 @@ import Exception from "./core.js";

public get [Symbol.toStringTag]() { return "FileException"; }
public readonly [Symbol.toStringTag]: string = "FileException";
}

@@ -20,3 +20,3 @@ export class FileExistsException extends FileException

public get [Symbol.toStringTag]() { return "FileExistsException"; }
public readonly [Symbol.toStringTag]: string = "FileExistsException";
}

@@ -30,3 +30,3 @@ export class FileNotFoundException extends FileException

public get [Symbol.toStringTag]() { return "FileNotFoundException"; }
public readonly [Symbol.toStringTag]: string = "FileNotFoundException";
}

@@ -41,3 +41,3 @@

public get [Symbol.toStringTag]() { return "KeyException"; }
public readonly [Symbol.toStringTag]: string = "KeyException";
}

@@ -51,3 +51,3 @@ export class NetworkException extends Exception

public get [Symbol.toStringTag]() { return "NetworkException"; }
public readonly [Symbol.toStringTag]: string = "NetworkException";
}

@@ -61,3 +61,3 @@ export class PermissionException extends Exception

public get [Symbol.toStringTag]() { return "PermissionException"; }
public readonly [Symbol.toStringTag]: string = "PermissionException";
}

@@ -71,3 +71,3 @@ export class ReferenceException extends Exception

public get [Symbol.toStringTag]() { return "ReferenceException"; }
public readonly [Symbol.toStringTag]: string = "ReferenceException";
}

@@ -82,3 +82,3 @@

public get [Symbol.toStringTag]() { return "RuntimeException"; }
public readonly [Symbol.toStringTag]: string = "RuntimeException";
}

@@ -92,3 +92,3 @@ export class EnvironmentException extends RuntimeException

public get [Symbol.toStringTag]() { return "EnvironmentException"; }
public readonly [Symbol.toStringTag]: string = "EnvironmentException";
}

@@ -103,3 +103,3 @@

public get [Symbol.toStringTag]() { return "TimeoutException"; }
public readonly [Symbol.toStringTag]: string = "TimeoutException";
}

@@ -113,3 +113,3 @@ export class TypeException extends Exception

public get [Symbol.toStringTag]() { return "TypeException"; }
public readonly [Symbol.toStringTag]: string = "TypeException";
}

@@ -124,3 +124,3 @@

public get [Symbol.toStringTag]() { return "ValueException"; }
public readonly [Symbol.toStringTag]: string = "ValueException";
}

@@ -134,3 +134,3 @@ export class RangeException extends ValueException

public get [Symbol.toStringTag]() { return "RangeException"; }
public readonly [Symbol.toStringTag]: string = "RangeException";
}

@@ -137,0 +137,0 @@

@@ -83,2 +83,4 @@ import { isBrowser } from "../helpers.js";

}
public readonly [Symbol.toStringTag]: string = "GameLoop";
}

@@ -100,3 +100,2 @@ import AggregatedAsyncIterator from "../aggregators/aggregated-async-iterator.js";

// eslint-disable-next-line no-constant-condition
while (true)

@@ -116,3 +115,2 @@ {

// eslint-disable-next-line no-constant-condition
while (true)

@@ -184,3 +182,2 @@ {

// eslint-disable-next-line no-constant-condition
while (true)

@@ -222,7 +219,7 @@ {

public drop(count: number): SmartAsyncIterator<T, R | void>
public drop(count: number): SmartAsyncIterator<T, R | undefined>
{
const iterator = this._iterator;
return new SmartAsyncIterator<T, R | void>(async function* ()
return new SmartAsyncIterator<T, R | undefined>(async function* ()
{

@@ -248,7 +245,7 @@ let index = 0;

}
public take(limit: number): SmartAsyncIterator<T, R | void>
public take(limit: number): SmartAsyncIterator<T, R | undefined>
{
const iterator = this._iterator;
return new SmartAsyncIterator<T, R | void>(async function* ()
return new SmartAsyncIterator<T, R | undefined>(async function* ()
{

@@ -271,7 +268,6 @@ let index = 0;

public async find(predicate: MaybeAsyncIteratee<T, boolean>): Promise<T | void>
public async find(predicate: MaybeAsyncIteratee<T, boolean>): Promise<T | undefined>
{
let index = 0;
// eslint-disable-next-line no-constant-condition
while (true)

@@ -318,3 +314,2 @@ {

// eslint-disable-next-line no-constant-condition
while (true)

@@ -332,3 +327,2 @@ {

// eslint-disable-next-line no-constant-condition
while (true)

@@ -365,5 +359,5 @@ {

public get [Symbol.toStringTag]() { return "SmartAsyncIterator"; }
public readonly [Symbol.toStringTag]: string = "SmartAsyncIterator";
public [Symbol.asyncIterator](): SmartAsyncIterator<T, R, N> { return this; }
}

@@ -40,3 +40,2 @@ import AggregatedIterator from "../aggregators/aggregated-iterator.js";

// eslint-disable-next-line no-constant-condition
while (true)

@@ -56,3 +55,2 @@ {

// eslint-disable-next-line no-constant-condition
while (true)

@@ -124,3 +122,2 @@ {

// eslint-disable-next-line no-constant-condition
while (true)

@@ -161,7 +158,7 @@ {

public drop(count: number): SmartIterator<T, R | void>
public drop(count: number): SmartIterator<T, R | undefined>
{
const iterator = this._iterator;
return new SmartIterator<T, R | void>(function* ()
return new SmartIterator<T, R | undefined>(function* ()
{

@@ -186,7 +183,7 @@ let index = 0;

}
public take(limit: number): SmartIterator<T, R | void>
public take(limit: number): SmartIterator<T, R | undefined>
{
const iterator = this._iterator;
return new SmartIterator<T, R | void>(function* ()
return new SmartIterator<T, R | undefined>(function* ()
{

@@ -208,9 +205,8 @@ let index = 0;

public find(predicate: Iteratee<T, boolean>): T | void;
public find<S extends T>(predicate: TypeGuardIteratee<T, S>): S | void;
public find(predicate: Iteratee<T, boolean>): T | void
public find(predicate: Iteratee<T, boolean>): T | undefined;
public find<S extends T>(predicate: TypeGuardIteratee<T, S>): S | undefined;
public find(predicate: Iteratee<T, boolean>): T | undefined
{
let index = 0;
// eslint-disable-next-line no-constant-condition
while (true)

@@ -257,3 +253,2 @@ {

// eslint-disable-next-line no-constant-condition
while (true)

@@ -272,3 +267,2 @@ {

// eslint-disable-next-line no-constant-condition
while (true)

@@ -305,5 +299,5 @@ {

public get [Symbol.toStringTag]() { return "SmartIterator"; }
public readonly [Symbol.toStringTag]: string = "SmartIterator";
public [Symbol.iterator](): SmartIterator<T, R, N> { return this; }
}

@@ -1,2 +0,1 @@

/* eslint-disable max-len */

@@ -3,0 +2,0 @@ import type { MaybePromise } from "../promises/types.js";

@@ -1,2 +0,1 @@

/* eslint-disable no-trailing-spaces */

@@ -48,3 +47,3 @@ import { isBrowser } from "../../helpers.js";

}
catch (error)
catch
{

@@ -256,3 +255,3 @@ // eslint-disable-next-line no-console

public get [Symbol.toStringTag]() { return "JSONStorage"; }
public readonly [Symbol.toStringTag]: string = "JSONStorage";
}
export type JSONArray = JSONValue[];
export type JSONObject = { [key: string]: JSONValue };
// @ts-expect-error - This is a circular reference to itself.
export type JSONObject = Record<string, JSONValue>;
// @ts-expect-error - This is a circular reference to itself.
export type JSONValue = boolean | number | string | null | JSONObject | JSONArray;

@@ -40,3 +40,3 @@ import type { PromiseResolver, PromiseRejecter, FulfilledHandler, RejectedHandler } from "./types.js";

public get [Symbol.toStringTag]() { return "DeferredPromise"; }
public readonly [Symbol.toStringTag]: string = "DeferredPromise";
}

@@ -67,3 +67,3 @@ import type { FulfilledHandler, PromiseExecutor, RejectedHandler } from "./types.js";

public get [Symbol.toStringTag]() { return "SmartPromise"; }
public readonly [Symbol.toStringTag]: string = "SmartPromise";
}

@@ -30,3 +30,3 @@ import { TimeoutException } from "../exceptions/index.js";

public get [Symbol.toStringTag]() { return "TimedPromise"; }
public readonly [Symbol.toStringTag]: string = "TimedPromise";
}

@@ -38,3 +38,3 @@ import { ReferenceException } from "./exceptions/index.js";

public get [Symbol.toStringTag]() { return "Publisher"; }
public readonly [Symbol.toStringTag]: string = "Publisher";
}

@@ -47,2 +47,4 @@ import { TimeUnit } from "../../utils/date.js";

}
public readonly [Symbol.toStringTag]: string = "Clock";
}

@@ -79,2 +79,4 @@ import { TimeUnit } from "../../utils/date.js";

}
public readonly [Symbol.toStringTag]: string = "Countdown";
}

@@ -0,1 +1,2 @@

import { SmartIterator } from "../models/index.js";

@@ -5,2 +6,4 @@

{
/* eslint-disable @typescript-eslint/prefer-literal-enum-member */
Millisecond = 1,

@@ -7,0 +10,0 @@ Second = 1000,

@@ -5,3 +5,3 @@ import { ValueException } from "../models/index.js";

{
public static Boolean(ratio: number = 0.5): boolean
public static Boolean(ratio = 0.5): boolean
{

@@ -42,4 +42,5 @@ return (Math.random() < ratio);

// eslint-disable-next-line no-useless-constructor
private constructor() { }
private constructor() { /* ... */ }
public readonly [Symbol.toStringTag]: string = "Random";
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc