@layerzerolabs/typescript-utils 1.2.30 → 1.2.32

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.
Files changed (88) hide show
  1. package/dist/5XE4VNB2.js +6 -0
  2. package/dist/{Q72HV3FQ.js.map → 5XE4VNB2.js.map} +1 -1
  3. package/dist/BKFXXKCY.js +6 -0
  4. package/dist/{J7MXPYNB.js.map → BKFXXKCY.js.map} +1 -1
  5. package/dist/{5RVE4P63.js → CH77GYWS.js} +3 -3
  6. package/dist/{5RVE4P63.js.map → CH77GYWS.js.map} +1 -1
  7. package/dist/EQ7YQ56H.js +4385 -0
  8. package/dist/EQ7YQ56H.js.map +1 -0
  9. package/dist/FAASPVHW.js +6 -0
  10. package/dist/{DUABMTPD.js.map → FAASPVHW.js.map} +1 -1
  11. package/dist/FWMNDO5V.js +6 -0
  12. package/dist/{JHB76A5P.js.map → FWMNDO5V.js.map} +1 -1
  13. package/dist/G7MBNFA6.js +6 -0
  14. package/dist/{HXPRGH76.js.map → G7MBNFA6.js.map} +1 -1
  15. package/dist/{BZFOTC52.js → GAVBFRZV.js} +3 -3
  16. package/dist/{BZFOTC52.js.map → GAVBFRZV.js.map} +1 -1
  17. package/dist/HB6BB2DC.js +6 -0
  18. package/dist/{GW3WNPWT.js.map → HB6BB2DC.js.map} +1 -1
  19. package/dist/IZIOOEJA.js +6 -0
  20. package/dist/{IHOKVYQX.js.map → IZIOOEJA.js.map} +1 -1
  21. package/dist/JL57NXLA.js +565 -0
  22. package/dist/JL57NXLA.js.map +1 -0
  23. package/dist/KGYH4LIN.js +6 -0
  24. package/dist/{C42KYLF2.js.map → KGYH4LIN.js.map} +1 -1
  25. package/dist/LM4XDTPL.js +6 -0
  26. package/dist/{QQHVKGTR.js.map → LM4XDTPL.js.map} +1 -1
  27. package/dist/M2HC6QJ6.js +6 -0
  28. package/dist/{C5WC33SO.js.map → M2HC6QJ6.js.map} +1 -1
  29. package/dist/NLMLR4CO.js +6 -0
  30. package/dist/{ICYXQ3TH.js.map → NLMLR4CO.js.map} +1 -1
  31. package/dist/OWTRJYEJ.js +6 -0
  32. package/dist/{Q7PHMFZZ.js.map → OWTRJYEJ.js.map} +1 -1
  33. package/dist/{CVKY4PFJ.js → PIZCBDEL.js} +3 -3
  34. package/dist/{CVKY4PFJ.js.map → PIZCBDEL.js.map} +1 -1
  35. package/dist/TGXWOO7P.js +6 -0
  36. package/dist/{LJG7PTOW.js.map → TGXWOO7P.js.map} +1 -1
  37. package/dist/TUA2ADMI.js +6 -0
  38. package/dist/{YIALIAFI.js.map → TUA2ADMI.js.map} +1 -1
  39. package/dist/VO3FVW2D.js +6 -0
  40. package/dist/{DXQJAC2D.js.map → VO3FVW2D.js.map} +1 -1
  41. package/dist/WDFKOQXV.js +6 -0
  42. package/dist/{CK4N7F4R.js.map → WDFKOQXV.js.map} +1 -1
  43. package/dist/{CN32JFM4.js → XI6CPRXW.js} +3 -3
  44. package/dist/{CN32JFM4.js.map → XI6CPRXW.js.map} +1 -1
  45. package/dist/XKPWSVPB.js +6 -0
  46. package/dist/{UIRDLJX2.js.map → XKPWSVPB.js.map} +1 -1
  47. package/dist/advancedRecord.js +2 -2
  48. package/dist/asyncify.js +2 -2
  49. package/dist/branded.js +2 -2
  50. package/dist/constructor.js +2 -2
  51. package/dist/deep.js +2 -2
  52. package/dist/deep.test-d.js +2 -2
  53. package/dist/disallowedAny.js +2 -2
  54. package/dist/functionalUtils.js +2 -2
  55. package/dist/identity.js +2 -2
  56. package/dist/index.js +20 -20
  57. package/dist/lastOf.js +2 -2
  58. package/dist/maybeUndefined.js +2 -2
  59. package/dist/merge.js +2 -2
  60. package/dist/methodOf.js +2 -2
  61. package/dist/promise.js +2 -2
  62. package/dist/removeNever.js +2 -2
  63. package/dist/strings.js +2 -2
  64. package/dist/strings.test-d.js +2 -2
  65. package/dist/tuples.js +2 -2
  66. package/dist/valueOf.js +2 -2
  67. package/dist/viem.js +2 -2
  68. package/dist/withRequired.js +2 -2
  69. package/package.json +5 -4
  70. package/dist/C42KYLF2.js +0 -6
  71. package/dist/C5WC33SO.js +0 -6
  72. package/dist/CK4N7F4R.js +0 -6
  73. package/dist/DUABMTPD.js +0 -6
  74. package/dist/DXQJAC2D.js +0 -6
  75. package/dist/GW3WNPWT.js +0 -6
  76. package/dist/HXPRGH76.js +0 -6
  77. package/dist/ICYXQ3TH.js +0 -6
  78. package/dist/IHOKVYQX.js +0 -6
  79. package/dist/J7MXPYNB.js +0 -6
  80. package/dist/JHB76A5P.js +0 -6
  81. package/dist/LJG7PTOW.js +0 -6
  82. package/dist/Q72HV3FQ.js +0 -6
  83. package/dist/Q7PHMFZZ.js +0 -6
  84. package/dist/QGA2ROSC.js +0 -8508
  85. package/dist/QGA2ROSC.js.map +0 -1
  86. package/dist/QQHVKGTR.js +0 -6
  87. package/dist/UIRDLJX2.js +0 -6
  88. package/dist/YIALIAFI.js +0 -6
@@ -0,0 +1,6 @@
1
+ import { init_esm_shims } from './CH77GYWS.js';
2
+
3
+ // src/maybeUndefined.ts
4
+ init_esm_shims();
5
+ //# sourceMappingURL=FAASPVHW.js.map
6
+ //# sourceMappingURL=FAASPVHW.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/maybeUndefined.ts"],"names":[],"mappings":";;;AAAA,cAAA,EAAA","file":"DUABMTPD.js","sourcesContent":["/**\n * @description Maps the result type `R` to `R | undefined` when the input type `T` includes `undefined`,\n * preserving the undefined-ness of the input in the output type.\n *\n * @example\n * MaybeUndefinedMapped<string | undefined, number>\n * => number | undefined\n *\n * MaybeUndefinedMapped<string, number>\n * => number\n */\nexport type MaybeUndefinedMapped<T, R> = undefined extends T\n ? T extends undefined\n ? undefined\n : R | undefined\n : R;\n"]}
1
+ {"version":3,"sources":["../src/maybeUndefined.ts"],"names":[],"mappings":";;;AAAA,cAAA,EAAA","file":"FAASPVHW.js","sourcesContent":["/**\n * @description Maps the result type `R` to `R | undefined` when the input type `T` includes `undefined`,\n * preserving the undefined-ness of the input in the output type.\n *\n * @example\n * MaybeUndefinedMapped<string | undefined, number>\n * => number | undefined\n *\n * MaybeUndefinedMapped<string, number>\n * => number\n */\nexport type MaybeUndefinedMapped<T, R> = undefined extends T\n ? T extends undefined\n ? undefined\n : R | undefined\n : R;\n"]}
@@ -0,0 +1,6 @@
1
+ import { init_esm_shims } from './CH77GYWS.js';
2
+
3
+ // src/disallowedAny.ts
4
+ init_esm_shims();
5
+ //# sourceMappingURL=FWMNDO5V.js.map
6
+ //# sourceMappingURL=FWMNDO5V.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/disallowedAny.ts"],"names":[],"mappings":";;;AAIA,cAAA,EAAA","file":"JHB76A5P.js","sourcesContent":["type IsAnyInner<T> = T extends never ? true : false;\n\nexport type IsAny<T> =\n IsAnyInner<T> extends true ? false : IsAnyInner<T> extends false ? false : true;\nexport type DisallowedAny<T> = IsAny<T> extends true ? never : T;\n"]}
1
+ {"version":3,"sources":["../src/disallowedAny.ts"],"names":[],"mappings":";;;AAIA,cAAA,EAAA","file":"FWMNDO5V.js","sourcesContent":["type IsAnyInner<T> = T extends never ? true : false;\n\nexport type IsAny<T> =\n IsAnyInner<T> extends true ? false : IsAnyInner<T> extends false ? false : true;\nexport type DisallowedAny<T> = IsAny<T> extends true ? never : T;\n"]}
@@ -0,0 +1,6 @@
1
+ import { init_esm_shims } from './CH77GYWS.js';
2
+
3
+ // src/lastOf.ts
4
+ init_esm_shims();
5
+ //# sourceMappingURL=G7MBNFA6.js.map
6
+ //# sourceMappingURL=G7MBNFA6.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/lastOf.ts"],"names":[],"mappings":";;;AAcA,cAAA,EAAA","file":"HXPRGH76.js","sourcesContent":["export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (\n k: infer I,\n) => void\n ? I\n : never;\n\nexport type LastOf<T> =\n UnionToIntersection<T extends any ? () => T : never> extends () => infer R ? R : never;\n\ntype Prepend<T, U extends any[]> = [T, ...U];\n\nexport type UnionToArray<T, U extends any[] = []> =\n LastOf<T> extends never ? U : UnionToArray<Exclude<T, LastOf<T>>, Prepend<LastOf<T>, U>>;\n\nexport type RestOf<T> = Exclude<T, LastOf<T>>;\n"]}
1
+ {"version":3,"sources":["../src/lastOf.ts"],"names":[],"mappings":";;;AAcA,cAAA,EAAA","file":"G7MBNFA6.js","sourcesContent":["export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (\n k: infer I,\n) => void\n ? I\n : never;\n\nexport type LastOf<T> =\n UnionToIntersection<T extends any ? () => T : never> extends () => infer R ? R : never;\n\ntype Prepend<T, U extends any[]> = [T, ...U];\n\nexport type UnionToArray<T, U extends any[] = []> =\n LastOf<T> extends never ? U : UnionToArray<Exclude<T, LastOf<T>>, Prepend<LastOf<T>, U>>;\n\nexport type RestOf<T> = Exclude<T, LastOf<T>>;\n"]}
@@ -1,9 +1,9 @@
1
- import { init_esm_shims, __name } from './5RVE4P63.js';
1
+ import { init_esm_shims, __name } from './CH77GYWS.js';
2
2
 
3
3
  // src/promise.ts
4
4
  init_esm_shims();
5
5
  var isPromise = /* @__PURE__ */ __name((v) => v !== null && typeof v === "object" && typeof v.then === "function" && typeof v.catch === "function", "isPromise");
6
6
 
7
7
  export { isPromise };
8
- //# sourceMappingURL=BZFOTC52.js.map
9
- //# sourceMappingURL=BZFOTC52.js.map
8
+ //# sourceMappingURL=GAVBFRZV.js.map
9
+ //# sourceMappingURL=GAVBFRZV.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/promise.ts"],"names":["isPromise","v","then","catch"],"mappings":";;;AAAA,cAAA,EAAA;AAAO,IAAMA,SAAAA,mBAAY,MAAA,CAAA,CAACC,CAAAA,KACtBA,CAAAA,KAAM,QACN,OAAOA,CAAAA,KAAM,QAAA,IACb,OAAQA,EAA8BC,IAAAA,KAAS,UAAA,IAC/C,OAAQD,CAAAA,CAA8BE,UAAU,UAAA,EAJ3B,WAAA","file":"BZFOTC52.js","sourcesContent":["export const isPromise = (v: unknown): v is Promise<unknown> =>\n v !== null &&\n typeof v === 'object' &&\n typeof (v as Record<string, unknown>).then === 'function' &&\n typeof (v as Record<string, unknown>).catch === 'function';\n"]}
1
+ {"version":3,"sources":["../src/promise.ts"],"names":["isPromise","v","then","catch"],"mappings":";;;AAAA,cAAA,EAAA;AAAO,IAAMA,SAAAA,mBAAY,MAAA,CAAA,CAACC,CAAAA,KACtBA,CAAAA,KAAM,QACN,OAAOA,CAAAA,KAAM,QAAA,IACb,OAAQA,EAA8BC,IAAAA,KAAS,UAAA,IAC/C,OAAQD,CAAAA,CAA8BE,UAAU,UAAA,EAJ3B,WAAA","file":"GAVBFRZV.js","sourcesContent":["export const isPromise = (v: unknown): v is Promise<unknown> =>\n v !== null &&\n typeof v === 'object' &&\n typeof (v as Record<string, unknown>).then === 'function' &&\n typeof (v as Record<string, unknown>).catch === 'function';\n"]}
@@ -0,0 +1,6 @@
1
+ import { init_esm_shims } from './CH77GYWS.js';
2
+
3
+ // src/removeNever.ts
4
+ init_esm_shims();
5
+ //# sourceMappingURL=HB6BB2DC.js.map
6
+ //# sourceMappingURL=HB6BB2DC.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/removeNever.ts"],"names":[],"mappings":";;;AAAA,cAAA,EAAA","file":"GW3WNPWT.js","sourcesContent":["export type RemoveNever<T> = {\n [K in keyof T as T[K] extends never ? never : K]: T[K];\n};\n"]}
1
+ {"version":3,"sources":["../src/removeNever.ts"],"names":[],"mappings":";;;AAAA,cAAA,EAAA","file":"HB6BB2DC.js","sourcesContent":["export type RemoveNever<T> = {\n [K in keyof T as T[K] extends never ? never : K]: T[K];\n};\n"]}
@@ -0,0 +1,6 @@
1
+ import { init_esm_shims } from './CH77GYWS.js';
2
+
3
+ // src/branded.ts
4
+ init_esm_shims();
5
+ //# sourceMappingURL=IZIOOEJA.js.map
6
+ //# sourceMappingURL=IZIOOEJA.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/branded.ts"],"names":[],"mappings":";;;AAAA,cAAA,EAAA","file":"IHOKVYQX.js","sourcesContent":["const tag = '___tag___';\n/**\n * Creates a branded type of {@link T} with the brand {@link U}.\n *\n * @param T - Type to brand\n * @param U - Label\n * @returns Branded type\n *\n * @example\n * type Result = Branded<string, 'foo'>\n * // ^? type Result = string & { [symbol]: 'foo' }\n */\nexport type Branded<T, U> = T & { [tag]: U };\n/**\n * Represents a percentage as a decimal value. For example, 25% is represented as 0.25\n */\nexport type Percent = number; // Branded<number, 'percent'>\n\nexport type BrandedError<T extends string> = Branded<Error, T>;\n"]}
1
+ {"version":3,"sources":["../src/branded.ts"],"names":[],"mappings":";;;AAAA,cAAA,EAAA","file":"IZIOOEJA.js","sourcesContent":["const tag = '___tag___';\n/**\n * Creates a branded type of {@link T} with the brand {@link U}.\n *\n * @param T - Type to brand\n * @param U - Label\n * @returns Branded type\n *\n * @example\n * type Result = Branded<string, 'foo'>\n * // ^? type Result = string & { [symbol]: 'foo' }\n */\nexport type Branded<T, U> = T & { [tag]: U };\n/**\n * Represents a percentage as a decimal value. For example, 25% is represented as 0.25\n */\nexport type Percent = number; // Branded<number, 'percent'>\n\nexport type BrandedError<T extends string> = Branded<Error, T>;\n"]}
@@ -0,0 +1,565 @@
1
+ import { init_esm_shims, __name } from './CH77GYWS.js';
2
+
3
+ // ../../node_modules/.pnpm/tinybench@2.9.0/node_modules/tinybench/dist/index.js
4
+ init_esm_shims();
5
+ var $ = Object.defineProperty;
6
+ var C = /* @__PURE__ */ __name((s) => {
7
+ throw TypeError(s);
8
+ }, "C");
9
+ var D = /* @__PURE__ */ __name((s, n, t) => n in s ? $(s, n, {
10
+ enumerable: true,
11
+ configurable: true,
12
+ writable: true,
13
+ value: t
14
+ }) : s[n] = t, "D");
15
+ var O = /* @__PURE__ */ __name((s, n, t) => D(s, typeof n != "symbol" ? n + "" : n, t), "O");
16
+ var q = /* @__PURE__ */ __name((s, n, t) => n.has(s) || C("Cannot " + t), "q");
17
+ var d = /* @__PURE__ */ __name((s, n, t) => (q(s, n, "read from private field"), t ? t.call(s) : n.get(s)), "d");
18
+ var k = /* @__PURE__ */ __name((s, n, t) => n.has(s) ? C("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(s) : n.set(s, t), "k");
19
+ var f = /* @__PURE__ */ __name((s, n, t, e) => (q(s, n, "write to private field"), e ? e.call(s, t) : n.set(s, t), t), "f");
20
+ var F = /* @__PURE__ */ __name((s, n, t, e) => ({
21
+ set _(r) {
22
+ f(s, n, r, t);
23
+ },
24
+ get _() {
25
+ return d(s, n, e);
26
+ }
27
+ }), "F");
28
+ var M = class {
29
+ static {
30
+ __name(this, "M");
31
+ }
32
+ constructor(n) {
33
+ O(this, "value");
34
+ O(this, "next");
35
+ this.value = n;
36
+ }
37
+ };
38
+ var m;
39
+ var w;
40
+ var E;
41
+ var g = class {
42
+ static {
43
+ __name(this, "g");
44
+ }
45
+ constructor() {
46
+ k(this, m);
47
+ k(this, w);
48
+ k(this, E);
49
+ this.clear();
50
+ }
51
+ enqueue(n) {
52
+ let t = new M(n);
53
+ d(this, m) ? (d(this, w).next = t, f(this, w, t)) : (f(this, m, t), f(this, w, t)), F(this, E)._++;
54
+ }
55
+ dequeue() {
56
+ let n = d(this, m);
57
+ if (n) return f(this, m, d(this, m).next), F(this, E)._--, n.value;
58
+ }
59
+ clear() {
60
+ f(this, m, void 0), f(this, w, void 0), f(this, E, 0);
61
+ }
62
+ get size() {
63
+ return d(this, E);
64
+ }
65
+ *[Symbol.iterator]() {
66
+ let n = d(this, m);
67
+ for (; n; ) yield n.value, n = n.next;
68
+ }
69
+ };
70
+ m = /* @__PURE__ */ new WeakMap(), w = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap();
71
+ function y(s) {
72
+ if (!((Number.isInteger(s) || s === Number.POSITIVE_INFINITY) && s > 0)) throw new TypeError("Expected `concurrency` to be a number from 1 and up");
73
+ let n = new g(), t = 0, e = /* @__PURE__ */ __name(() => {
74
+ t--, n.size > 0 && n.dequeue()();
75
+ }, "e"), r1 = /* @__PURE__ */ __name(async (h, p, a) => {
76
+ t++;
77
+ let l = (async () => h(...a))();
78
+ p(l);
79
+ try {
80
+ await l;
81
+ } catch (T) {
82
+ }
83
+ e();
84
+ }, "r1"), i = /* @__PURE__ */ __name((h, p, a) => {
85
+ n.enqueue(r1.bind(void 0, h, p, a)), (async () => (await Promise.resolve(), t < s && n.size > 0 && n.dequeue()()))();
86
+ }, "i"), c = /* @__PURE__ */ __name((h, ...p) => new Promise((a) => {
87
+ i(h, a, p);
88
+ }), "c");
89
+ return Object.defineProperties(c, {
90
+ activeCount: {
91
+ get: /* @__PURE__ */ __name(() => t, "get")
92
+ },
93
+ pendingCount: {
94
+ get: /* @__PURE__ */ __name(() => n.size, "get")
95
+ },
96
+ clearQueue: {
97
+ value: /* @__PURE__ */ __name(() => {
98
+ n.clear();
99
+ }, "value")
100
+ }
101
+ }), c;
102
+ }
103
+ __name(y, "y");
104
+ function o(s, n = null) {
105
+ let t = new Event(s);
106
+ return n && Object.defineProperty(t, "task", {
107
+ value: n,
108
+ enumerable: true,
109
+ writable: false,
110
+ configurable: false
111
+ }), t;
112
+ }
113
+ __name(o, "o");
114
+ var G = {
115
+ 1: 12.71,
116
+ 2: 4.303,
117
+ 3: 3.182,
118
+ 4: 2.776,
119
+ 5: 2.571,
120
+ 6: 2.447,
121
+ 7: 2.365,
122
+ 8: 2.306,
123
+ 9: 2.262,
124
+ 10: 2.228,
125
+ 11: 2.201,
126
+ 12: 2.179,
127
+ 13: 2.16,
128
+ 14: 2.145,
129
+ 15: 2.131,
130
+ 16: 2.12,
131
+ 17: 2.11,
132
+ 18: 2.101,
133
+ 19: 2.093,
134
+ 20: 2.086,
135
+ 21: 2.08,
136
+ 22: 2.074,
137
+ 23: 2.069,
138
+ 24: 2.064,
139
+ 25: 2.06,
140
+ 26: 2.056,
141
+ 27: 2.052,
142
+ 28: 2.048,
143
+ 29: 2.045,
144
+ 30: 2.042,
145
+ 31: 2.0399,
146
+ 32: 2.0378,
147
+ 33: 2.0357,
148
+ 34: 2.0336,
149
+ 35: 2.0315,
150
+ 36: 2.0294,
151
+ 37: 2.0273,
152
+ 38: 2.0252,
153
+ 39: 2.0231,
154
+ 40: 2.021,
155
+ 41: 2.0198,
156
+ 42: 2.0186,
157
+ 43: 2.0174,
158
+ 44: 2.0162,
159
+ 45: 2.015,
160
+ 46: 2.0138,
161
+ 47: 2.0126,
162
+ 48: 2.0114,
163
+ 49: 2.0102,
164
+ 50: 2.009,
165
+ 51: 2.0081,
166
+ 52: 2.0072,
167
+ 53: 2.0063,
168
+ 54: 2.0054,
169
+ 55: 2.0045,
170
+ 56: 2.0036,
171
+ 57: 2.0027,
172
+ 58: 2.0018,
173
+ 59: 2.0009,
174
+ 60: 2,
175
+ 61: 1.9995,
176
+ 62: 1.999,
177
+ 63: 1.9985,
178
+ 64: 1.998,
179
+ 65: 1.9975,
180
+ 66: 1.997,
181
+ 67: 1.9965,
182
+ 68: 1.996,
183
+ 69: 1.9955,
184
+ 70: 1.995,
185
+ 71: 1.9945,
186
+ 72: 1.994,
187
+ 73: 1.9935,
188
+ 74: 1.993,
189
+ 75: 1.9925,
190
+ 76: 1.992,
191
+ 77: 1.9915,
192
+ 78: 1.991,
193
+ 79: 1.9905,
194
+ 80: 1.99,
195
+ 81: 1.9897,
196
+ 82: 1.9894,
197
+ 83: 1.9891,
198
+ 84: 1.9888,
199
+ 85: 1.9885,
200
+ 86: 1.9882,
201
+ 87: 1.9879,
202
+ 88: 1.9876,
203
+ 89: 1.9873,
204
+ 90: 1.987,
205
+ 91: 1.9867,
206
+ 92: 1.9864,
207
+ 93: 1.9861,
208
+ 94: 1.9858,
209
+ 95: 1.9855,
210
+ 96: 1.9852,
211
+ 97: 1.9849,
212
+ 98: 1.9846,
213
+ 99: 1.9843,
214
+ 100: 1.984,
215
+ 101: 1.9838,
216
+ 102: 1.9836,
217
+ 103: 1.9834,
218
+ 104: 1.9832,
219
+ 105: 1.983,
220
+ 106: 1.9828,
221
+ 107: 1.9826,
222
+ 108: 1.9824,
223
+ 109: 1.9822,
224
+ 110: 1.982,
225
+ 111: 1.9818,
226
+ 112: 1.9816,
227
+ 113: 1.9814,
228
+ 114: 1.9812,
229
+ 115: 1.9819,
230
+ 116: 1.9808,
231
+ 117: 1.9806,
232
+ 118: 1.9804,
233
+ 119: 1.9802,
234
+ 120: 1.98,
235
+ infinity: 1.96
236
+ };
237
+ var N = G;
238
+ var J = /* @__PURE__ */ __name((s) => s / 1e6, "J");
239
+ var U = /* @__PURE__ */ __name(() => J(Number(process.hrtime.bigint())), "U");
240
+ var B = /* @__PURE__ */ __name(() => performance.now(), "B");
241
+ function W(s) {
242
+ return s !== null && typeof s == "object" && typeof s.then == "function";
243
+ }
244
+ __name(W, "W");
245
+ var S = /* @__PURE__ */ __name((s, n) => s.reduce((e, r1) => e + (r1 - n) ** 2, 0) / (s.length - 1) || 0, "S");
246
+ var X = (async () => {
247
+ }).constructor;
248
+ var Z = /* @__PURE__ */ __name((s) => s.constructor === X, "Z");
249
+ var z = /* @__PURE__ */ __name(async (s) => {
250
+ if (Z(s.fn)) return true;
251
+ try {
252
+ if (s.opts.beforeEach != null) try {
253
+ await s.opts.beforeEach.call(s);
254
+ } catch (e) {
255
+ }
256
+ let n = s.fn(), t = W(n);
257
+ if (t) try {
258
+ await n;
259
+ } catch (e) {
260
+ }
261
+ if (s.opts.afterEach != null) try {
262
+ await s.opts.afterEach.call(s);
263
+ } catch (e) {
264
+ }
265
+ return t;
266
+ } catch (n) {
267
+ return false;
268
+ }
269
+ }, "z");
270
+ var b = class extends EventTarget {
271
+ static {
272
+ __name(this, "b");
273
+ }
274
+ constructor(t, e, r1, i = {}) {
275
+ super();
276
+ this.runs = 0;
277
+ this.bench = t, this.name = e, this.fn = r1, this.opts = i;
278
+ }
279
+ async loop(t, e) {
280
+ var T;
281
+ let r1 = this.bench.concurrency === "task", { threshold: i } = this.bench, c = 0, h = [];
282
+ if (this.opts.beforeAll != null) try {
283
+ await this.opts.beforeAll.call(this);
284
+ } catch (u) {
285
+ return {
286
+ error: u
287
+ };
288
+ }
289
+ let p = await z(this), a = /* @__PURE__ */ __name(async () => {
290
+ this.opts.beforeEach != null && await this.opts.beforeEach.call(this);
291
+ let u = 0;
292
+ if (p) {
293
+ let v = this.bench.now();
294
+ await this.fn.call(this), u = this.bench.now() - v;
295
+ } else {
296
+ let v = this.bench.now();
297
+ this.fn.call(this), u = this.bench.now() - v;
298
+ }
299
+ h.push(u), c += u, this.opts.afterEach != null && await this.opts.afterEach.call(this);
300
+ }, "a"), l = y(i);
301
+ try {
302
+ let u = [];
303
+ for (; (c < t || h.length + l.activeCount + l.pendingCount < e) && !((T = this.bench.signal) != null && T.aborted); ) r1 ? u.push(l(a)) : await a();
304
+ u.length && await Promise.all(u);
305
+ } catch (u) {
306
+ return {
307
+ error: u
308
+ };
309
+ }
310
+ if (this.opts.afterAll != null) try {
311
+ await this.opts.afterAll.call(this);
312
+ } catch (u) {
313
+ return {
314
+ error: u
315
+ };
316
+ }
317
+ return {
318
+ samples: h
319
+ };
320
+ }
321
+ /**
322
+ * run the current task and write the results in `Task.result` object
323
+ */
324
+ async run() {
325
+ var r1, i;
326
+ if ((r1 = this.result) != null && r1.error) return this;
327
+ this.dispatchEvent(o("start", this)), await this.bench.setup(this, "run");
328
+ let { samples: t, error: e } = await this.loop(this.bench.time, this.bench.iterations);
329
+ if (this.bench.teardown(this, "run"), t) {
330
+ let c = t.reduce((L, A) => L + A, 0);
331
+ this.runs = t.length, t.sort((L, A) => L - A);
332
+ let h = c / this.runs, p = 1e3 / h, a = t.length, l = a - 1, T = t[0], u = t[l], v = c / t.length || 0, P = S(t, v), R = Math.sqrt(P), I = R / Math.sqrt(a), _ = N[String(Math.round(l) || 1)] || N.infinity, K = I * _, j = K / v * 100, H = t[Math.ceil(a * 0.75) - 1], V = t[Math.ceil(a * 0.99) - 1], Q = t[Math.ceil(a * 0.995) - 1], Y = t[Math.ceil(a * 0.999) - 1];
333
+ if ((i = this.bench.signal) != null && i.aborted) return this;
334
+ this.setResult({
335
+ totalTime: c,
336
+ min: T,
337
+ max: u,
338
+ hz: p,
339
+ period: h,
340
+ samples: t,
341
+ mean: v,
342
+ variance: P,
343
+ sd: R,
344
+ sem: I,
345
+ df: l,
346
+ critical: _,
347
+ moe: K,
348
+ rme: j,
349
+ p75: H,
350
+ p99: V,
351
+ p995: Q,
352
+ p999: Y
353
+ });
354
+ }
355
+ if (e) {
356
+ if (this.setResult({
357
+ error: e
358
+ }), this.bench.throws) throw e;
359
+ this.dispatchEvent(o("error", this)), this.bench.dispatchEvent(o("error", this));
360
+ }
361
+ return this.dispatchEvent(o("cycle", this)), this.bench.dispatchEvent(o("cycle", this)), this.dispatchEvent(o("complete", this)), this;
362
+ }
363
+ /**
364
+ * warmup the current task
365
+ */
366
+ async warmup() {
367
+ var e;
368
+ if ((e = this.result) != null && e.error) return;
369
+ this.dispatchEvent(o("warmup", this)), await this.bench.setup(this, "warmup");
370
+ let { error: t } = await this.loop(this.bench.warmupTime, this.bench.warmupIterations);
371
+ if (this.bench.teardown(this, "warmup"), t && (this.setResult({
372
+ error: t
373
+ }), this.bench.throws)) throw t;
374
+ }
375
+ addEventListener(t, e, r1) {
376
+ super.addEventListener(t, e, r1);
377
+ }
378
+ removeEventListener(t, e, r1) {
379
+ super.removeEventListener(t, e, r1);
380
+ }
381
+ /**
382
+ * change the result object values
383
+ */
384
+ setResult(t) {
385
+ this.result = {
386
+ ...this.result,
387
+ ...t
388
+ }, Object.freeze(this.result);
389
+ }
390
+ /**
391
+ * reset the task to make the `Task.runs` a zero-value and remove the `Task.result`
392
+ * object
393
+ */
394
+ reset() {
395
+ this.dispatchEvent(o("reset", this)), this.runs = 0, this.result = void 0;
396
+ }
397
+ };
398
+ var x = class extends EventTarget {
399
+ static {
400
+ __name(this, "x");
401
+ }
402
+ constructor(t = {}) {
403
+ var e, r1, i, c, h, p, a, l;
404
+ super();
405
+ this._tasks = /* @__PURE__ */ new Map();
406
+ this._todos = /* @__PURE__ */ new Map();
407
+ this.concurrency = null;
408
+ this.threshold = 1 / 0;
409
+ this.warmupTime = 100;
410
+ this.warmupIterations = 5;
411
+ this.time = 500;
412
+ this.iterations = 10;
413
+ this.now = B;
414
+ this.now = (e = t.now) != null ? e : this.now, this.warmupTime = (r1 = t.warmupTime) != null ? r1 : this.warmupTime, this.warmupIterations = (i = t.warmupIterations) != null ? i : this.warmupIterations, this.time = (c = t.time) != null ? c : this.time, this.iterations = (h = t.iterations) != null ? h : this.iterations, this.signal = t.signal, this.throws = (p = t.throws) != null ? p : false, this.setup = (a = t.setup) != null ? a : () => {
415
+ }, this.teardown = (l = t.teardown) != null ? l : () => {
416
+ }, this.signal && this.signal.addEventListener("abort", () => {
417
+ this.dispatchEvent(o("abort"));
418
+ }, {
419
+ once: true
420
+ });
421
+ }
422
+ runTask(t) {
423
+ var e;
424
+ return (e = this.signal) != null && e.aborted ? t : t.run();
425
+ }
426
+ /**
427
+ * run the added tasks that were registered using the
428
+ * {@link add} method.
429
+ * Note: This method does not do any warmup. Call {@link warmup} for that.
430
+ */
431
+ async run() {
432
+ if (this.concurrency === "bench") return this.runConcurrently(this.threshold, this.concurrency);
433
+ this.dispatchEvent(o("start"));
434
+ let t = [];
435
+ for (let e of [
436
+ ...this._tasks.values()
437
+ ]) t.push(await this.runTask(e));
438
+ return this.dispatchEvent(o("complete")), t;
439
+ }
440
+ /**
441
+ * See Bench.{@link concurrency}
442
+ */
443
+ async runConcurrently(t = 1 / 0, e = "bench") {
444
+ if (this.threshold = t, this.concurrency = e, e === "task") return this.run();
445
+ this.dispatchEvent(o("start"));
446
+ let r1 = y(t), i = [];
447
+ for (let h of [
448
+ ...this._tasks.values()
449
+ ]) i.push(r1(() => this.runTask(h)));
450
+ let c = await Promise.all(i);
451
+ return this.dispatchEvent(o("complete")), c;
452
+ }
453
+ /**
454
+ * warmup the benchmark tasks.
455
+ * This is not run by default by the {@link run} method.
456
+ */
457
+ async warmup() {
458
+ if (this.concurrency === "bench") {
459
+ await this.warmupConcurrently(this.threshold, this.concurrency);
460
+ return;
461
+ }
462
+ this.dispatchEvent(o("warmup"));
463
+ for (let [, t] of this._tasks) await t.warmup();
464
+ }
465
+ /**
466
+ * warmup the benchmark tasks concurrently.
467
+ * This is not run by default by the {@link runConcurrently} method.
468
+ */
469
+ async warmupConcurrently(t = 1 / 0, e = "bench") {
470
+ if (this.threshold = t, this.concurrency = e, e === "task") {
471
+ await this.warmup();
472
+ return;
473
+ }
474
+ this.dispatchEvent(o("warmup"));
475
+ let r1 = y(t), i = [];
476
+ for (let [, c] of this._tasks) i.push(r1(() => c.warmup()));
477
+ await Promise.all(i);
478
+ }
479
+ /**
480
+ * reset each task and remove its result
481
+ */
482
+ reset() {
483
+ this.dispatchEvent(o("reset")), this._tasks.forEach((t) => {
484
+ t.reset();
485
+ });
486
+ }
487
+ /**
488
+ * add a benchmark task to the task map
489
+ */
490
+ add(t, e, r1 = {}) {
491
+ let i = new b(this, t, e, r1);
492
+ return this._tasks.set(t, i), this.dispatchEvent(o("add", i)), this;
493
+ }
494
+ /**
495
+ * add a benchmark todo to the todo map
496
+ */
497
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
498
+ todo(t, e = () => {
499
+ }, r1 = {}) {
500
+ let i = new b(this, t, e, r1);
501
+ return this._todos.set(t, i), this.dispatchEvent(o("todo", i)), this;
502
+ }
503
+ /**
504
+ * remove a benchmark task from the task map
505
+ */
506
+ remove(t) {
507
+ let e = this.getTask(t);
508
+ return e && (this.dispatchEvent(o("remove", e)), this._tasks.delete(t)), this;
509
+ }
510
+ addEventListener(t, e, r1) {
511
+ super.addEventListener(t, e, r1);
512
+ }
513
+ removeEventListener(t, e, r1) {
514
+ super.removeEventListener(t, e, r1);
515
+ }
516
+ /**
517
+ * table of the tasks results
518
+ */
519
+ table(t) {
520
+ return this.tasks.map((e) => {
521
+ if (e.result) {
522
+ if (e.result.error) throw e.result.error;
523
+ return (t == null ? void 0 : t(e)) || {
524
+ "Task Name": e.name,
525
+ "ops/sec": e.result.error ? "NaN" : parseInt(e.result.hz.toString(), 10).toLocaleString(),
526
+ "Average Time (ns)": e.result.error ? "NaN" : e.result.mean * 1e3 * 1e3,
527
+ Margin: e.result.error ? "NaN" : `\xB1${e.result.rme.toFixed(2)}%`,
528
+ Samples: e.result.error ? "NaN" : e.result.samples.length
529
+ };
530
+ }
531
+ return null;
532
+ });
533
+ }
534
+ /**
535
+ * (getter) tasks results as an array
536
+ */
537
+ get results() {
538
+ return [
539
+ ...this._tasks.values()
540
+ ].map((t) => t.result);
541
+ }
542
+ /**
543
+ * (getter) tasks as an array
544
+ */
545
+ get tasks() {
546
+ return [
547
+ ...this._tasks.values()
548
+ ];
549
+ }
550
+ get todos() {
551
+ return [
552
+ ...this._todos.values()
553
+ ];
554
+ }
555
+ /**
556
+ * get a task based on the task name
557
+ */
558
+ getTask(t) {
559
+ return this._tasks.get(t);
560
+ }
561
+ };
562
+
563
+ export { x as Bench, b as Task, U as hrtimeNow, B as now };
564
+ //# sourceMappingURL=JL57NXLA.js.map
565
+ //# sourceMappingURL=JL57NXLA.js.map