@ztimson/utils 0.15.3 → 0.15.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/errors.d.ts +7 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +451 -418
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var i = (n,
|
|
4
|
-
function
|
|
1
|
+
var et = Object.defineProperty;
|
|
2
|
+
var nt = (n, t, e) => t in n ? et(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
3
|
+
var i = (n, t, e) => (nt(n, typeof t != "symbol" ? t + "" : t, e), e);
|
|
4
|
+
function rt(n, t = !1) {
|
|
5
5
|
if (n == null)
|
|
6
6
|
throw new Error("Cannot clean a NULL value");
|
|
7
|
-
return Array.isArray(n) ? n = n.filter((
|
|
8
|
-
(
|
|
7
|
+
return Array.isArray(n) ? n = n.filter((e) => e != null) : Object.entries(n).forEach(([e, r]) => {
|
|
8
|
+
(t && r === void 0 || !t && r == null) && delete n[e];
|
|
9
9
|
}), n;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function mt(n) {
|
|
12
12
|
return JSON.parse(JSON.stringify(n));
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
return
|
|
16
|
-
for (const r in
|
|
17
|
-
|
|
14
|
+
function ot(n, ...t) {
|
|
15
|
+
return t.forEach((e) => {
|
|
16
|
+
for (const r in e)
|
|
17
|
+
e[r] && typeof e[r] == "object" && !Array.isArray(e[r]) ? (n[r] || (n[r] = {}), ot(n[r], e[r])) : n[r] = e[r];
|
|
18
18
|
}), n;
|
|
19
19
|
}
|
|
20
|
-
function S(n,
|
|
21
|
-
if (!(n == null || !
|
|
22
|
-
return
|
|
20
|
+
function S(n, t, e) {
|
|
21
|
+
if (!(n == null || !t))
|
|
22
|
+
return t.split(/[.[\]]/g).filter((r) => r.length).reduce((r, o, s, c) => {
|
|
23
23
|
if ((o[0] == '"' || o[0] == "'") && (o = o.slice(1, -1)), !(r != null && r.hasOwnProperty(o))) {
|
|
24
|
-
if (
|
|
24
|
+
if (e == null)
|
|
25
25
|
return;
|
|
26
26
|
r[o] = {};
|
|
27
27
|
}
|
|
28
|
-
return
|
|
28
|
+
return e !== void 0 && s == c.length - 1 ? r[o] = e : r[o];
|
|
29
29
|
}, n);
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function st(n, t, e = {}) {
|
|
32
32
|
if (typeof n == "object" && !Array.isArray(n)) {
|
|
33
33
|
for (const r of Object.keys(n)) {
|
|
34
|
-
const o =
|
|
35
|
-
typeof n[r] == "object" ?
|
|
34
|
+
const o = t ? t + "." + r : r;
|
|
35
|
+
typeof n[r] == "object" ? st(n[r], o, e) : e[o] = n[r];
|
|
36
36
|
}
|
|
37
|
-
return
|
|
37
|
+
return e;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
function xt(n) {
|
|
41
|
-
const
|
|
42
|
-
return Object.entries(n).forEach(([
|
|
41
|
+
const t = new FormData();
|
|
42
|
+
return Object.entries(n).forEach(([e, r]) => t.append(e, r)), t;
|
|
43
43
|
}
|
|
44
|
-
function U(n,
|
|
44
|
+
function U(n, t, e = !1) {
|
|
45
45
|
if (n == null)
|
|
46
|
-
return
|
|
47
|
-
if (Array.isArray(
|
|
48
|
-
return
|
|
49
|
-
const r = typeof
|
|
50
|
-
return r != typeof n ? !1 : r == "object" ? Object.keys(
|
|
51
|
-
}
|
|
52
|
-
function B(n,
|
|
53
|
-
const
|
|
54
|
-
return
|
|
55
|
-
}
|
|
56
|
-
function At(n,
|
|
57
|
-
|
|
58
|
-
Object.getOwnPropertyNames(
|
|
46
|
+
return e;
|
|
47
|
+
if (Array.isArray(t))
|
|
48
|
+
return t.findIndex((o, s) => !U(n[s], t[s], e)) == -1;
|
|
49
|
+
const r = typeof t;
|
|
50
|
+
return r != typeof n ? !1 : r == "object" ? Object.keys(t).find((o) => !U(n[o], t[o], e)) == null : r == "function" ? n.toString() == t.toString() : n == t;
|
|
51
|
+
}
|
|
52
|
+
function B(n, t) {
|
|
53
|
+
const e = typeof n, r = typeof t;
|
|
54
|
+
return e != "object" || n == null || r != "object" || t == null ? e == "function" && r == "function" ? n.toString() == t.toString() : n === t : Object.keys(n).length != Object.keys(t).length ? !1 : Object.keys(n).every((s) => B(n[s], t[s]));
|
|
55
|
+
}
|
|
56
|
+
function At(n, t) {
|
|
57
|
+
t.forEach((e) => {
|
|
58
|
+
Object.getOwnPropertyNames(e.prototype).forEach((r) => {
|
|
59
59
|
Object.defineProperty(
|
|
60
60
|
n.prototype,
|
|
61
61
|
r,
|
|
62
|
-
Object.getOwnPropertyDescriptor(
|
|
62
|
+
Object.getOwnPropertyDescriptor(e.prototype, r) || /* @__PURE__ */ Object.create(null)
|
|
63
63
|
);
|
|
64
64
|
});
|
|
65
65
|
});
|
|
@@ -71,52 +71,52 @@ function q(n) {
|
|
|
71
71
|
return n;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
function bt(n,
|
|
75
|
-
let
|
|
74
|
+
function bt(n, t) {
|
|
75
|
+
let e = [];
|
|
76
76
|
return JSON.parse(JSON.stringify(n, (r, o) => {
|
|
77
77
|
if (typeof o == "object" && o !== null) {
|
|
78
|
-
if (
|
|
78
|
+
if (e.includes(o))
|
|
79
79
|
return;
|
|
80
|
-
|
|
80
|
+
e.push(o);
|
|
81
81
|
}
|
|
82
82
|
return o;
|
|
83
|
-
},
|
|
83
|
+
}, t));
|
|
84
84
|
}
|
|
85
85
|
function Bt(n) {
|
|
86
86
|
return Object.entries(n).map(
|
|
87
|
-
([
|
|
87
|
+
([t, e]) => encodeURIComponent(t) + "=" + encodeURIComponent(e)
|
|
88
88
|
).join("&");
|
|
89
89
|
}
|
|
90
|
-
function Rt(n,
|
|
91
|
-
return n.indexOf(
|
|
90
|
+
function Rt(n, t) {
|
|
91
|
+
return n.indexOf(t) === -1 && n.push(t), n;
|
|
92
92
|
}
|
|
93
|
-
function Ot(n,
|
|
94
|
-
return
|
|
95
|
-
...n.filter((
|
|
96
|
-
...
|
|
93
|
+
function Ot(n, t) {
|
|
94
|
+
return it([
|
|
95
|
+
...n.filter((e) => !t.includes((r) => B(e, r))),
|
|
96
|
+
...t.filter((e) => !n.includes((r) => B(e, r)))
|
|
97
97
|
]);
|
|
98
98
|
}
|
|
99
99
|
function Lt(n) {
|
|
100
|
-
return function(
|
|
101
|
-
const r = S(
|
|
100
|
+
return function(t, e) {
|
|
101
|
+
const r = S(t, n), o = S(e, n);
|
|
102
102
|
return typeof r != "string" || typeof o != "string" ? 1 : r.toLowerCase().localeCompare(o.toLowerCase());
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
|
-
function
|
|
106
|
-
return n.forEach((
|
|
105
|
+
function ct(n, t = []) {
|
|
106
|
+
return n.forEach((e) => Array.isArray(e) ? ct(e, t) : t.push(e)), t;
|
|
107
107
|
}
|
|
108
|
-
function St(n,
|
|
109
|
-
return function(
|
|
110
|
-
const o = S(
|
|
111
|
-
return typeof o == "number" && typeof s == "number" ? (
|
|
108
|
+
function St(n, t = !1) {
|
|
109
|
+
return function(e, r) {
|
|
110
|
+
const o = S(e, n), s = S(r, n);
|
|
111
|
+
return typeof o == "number" && typeof s == "number" ? (t ? -1 : 1) * (o - s) : o > s ? t ? -1 : 1 : o < s ? t ? 1 : -1 : 0;
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
|
-
function Ct(n,
|
|
115
|
-
return (
|
|
114
|
+
function Ct(n, t) {
|
|
115
|
+
return (e) => B(e[n], t);
|
|
116
116
|
}
|
|
117
|
-
function
|
|
118
|
-
for (let
|
|
119
|
-
n.slice(0,
|
|
117
|
+
function it(n) {
|
|
118
|
+
for (let t = n.length - 1; t >= 0; t--)
|
|
119
|
+
n.slice(0, t).find((e) => B(e, n[t])) && n.splice(t, 1);
|
|
120
120
|
return n;
|
|
121
121
|
}
|
|
122
122
|
function Nt(n) {
|
|
@@ -131,92 +131,92 @@ class b extends Array {
|
|
|
131
131
|
* Array to create set from, duplicate values will be removed
|
|
132
132
|
* @param {T[]} elements Elements which will be added to set
|
|
133
133
|
*/
|
|
134
|
-
constructor(
|
|
135
|
-
super(),
|
|
134
|
+
constructor(t = []) {
|
|
135
|
+
super(), t != null && t.forEach && t.forEach((e) => this.add(e));
|
|
136
136
|
}
|
|
137
137
|
/**
|
|
138
138
|
* Add single element to set if unique
|
|
139
139
|
* @param {T} el Element to add
|
|
140
140
|
*/
|
|
141
|
-
add(
|
|
142
|
-
this.has(
|
|
141
|
+
add(t) {
|
|
142
|
+
this.has(t) || this.push(t);
|
|
143
143
|
}
|
|
144
144
|
/**
|
|
145
145
|
* Delete element from set
|
|
146
146
|
* @param {T} el Element that will be deleted
|
|
147
147
|
*/
|
|
148
|
-
delete(
|
|
149
|
-
const
|
|
150
|
-
|
|
148
|
+
delete(t) {
|
|
149
|
+
const e = this.indexOf(t);
|
|
150
|
+
e != -1 && this.slice(e, 1);
|
|
151
151
|
}
|
|
152
152
|
/**
|
|
153
153
|
* Create list of elements this set has which the comparison set does not
|
|
154
154
|
* @param {ASet<T>} set Set to compare against
|
|
155
155
|
* @return {ASet<T>} Different elements
|
|
156
156
|
*/
|
|
157
|
-
difference(
|
|
158
|
-
return new b(this.filter((
|
|
157
|
+
difference(t) {
|
|
158
|
+
return new b(this.filter((e) => !t.has(e)));
|
|
159
159
|
}
|
|
160
160
|
/**
|
|
161
161
|
* Check if set includes element
|
|
162
162
|
* @param {T} el Element to look for
|
|
163
163
|
* @return {boolean} True if element was found, false otherwise
|
|
164
164
|
*/
|
|
165
|
-
has(
|
|
166
|
-
return this.indexOf(
|
|
165
|
+
has(t) {
|
|
166
|
+
return this.indexOf(t) != -1;
|
|
167
167
|
}
|
|
168
168
|
/**
|
|
169
169
|
* Create list of elements this set has in common with the comparison set
|
|
170
170
|
* @param {ASet<T>} set Set to compare against
|
|
171
171
|
* @return {boolean} Set of common elements
|
|
172
172
|
*/
|
|
173
|
-
intersection(
|
|
174
|
-
return new b(this.filter((
|
|
173
|
+
intersection(t) {
|
|
174
|
+
return new b(this.filter((e) => t.has(e)));
|
|
175
175
|
}
|
|
176
176
|
/**
|
|
177
177
|
* Check if this set has no elements in common with the comparison set
|
|
178
178
|
* @param {ASet<T>} set Set to compare against
|
|
179
179
|
* @return {boolean} True if nothing in common, false otherwise
|
|
180
180
|
*/
|
|
181
|
-
isDisjointFrom(
|
|
182
|
-
return this.intersection(
|
|
181
|
+
isDisjointFrom(t) {
|
|
182
|
+
return this.intersection(t).size == 0;
|
|
183
183
|
}
|
|
184
184
|
/**
|
|
185
185
|
* Check if all elements in this set are included in the comparison set
|
|
186
186
|
* @param {ASet<T>} set Set to compare against
|
|
187
187
|
* @return {boolean} True if all elements are included, false otherwise
|
|
188
188
|
*/
|
|
189
|
-
isSubsetOf(
|
|
190
|
-
return this.findIndex((
|
|
189
|
+
isSubsetOf(t) {
|
|
190
|
+
return this.findIndex((e) => !t.has(e)) == -1;
|
|
191
191
|
}
|
|
192
192
|
/**
|
|
193
193
|
* Check if all elements from comparison set are included in this set
|
|
194
194
|
* @param {ASet<T>} set Set to compare against
|
|
195
195
|
* @return {boolean} True if all elements are included, false otherwise
|
|
196
196
|
*/
|
|
197
|
-
isSuperset(
|
|
198
|
-
return
|
|
197
|
+
isSuperset(t) {
|
|
198
|
+
return t.findIndex((e) => !this.has(e)) == -1;
|
|
199
199
|
}
|
|
200
200
|
/**
|
|
201
201
|
* Create list of elements that are only in one set but not both (XOR)
|
|
202
202
|
* @param {ASet<T>} set Set to compare against
|
|
203
203
|
* @return {ASet<T>} New set of unique elements
|
|
204
204
|
*/
|
|
205
|
-
symmetricDifference(
|
|
206
|
-
return new b([...this.difference(
|
|
205
|
+
symmetricDifference(t) {
|
|
206
|
+
return new b([...this.difference(t), ...t.difference(this)]);
|
|
207
207
|
}
|
|
208
208
|
/**
|
|
209
209
|
* Create joined list of elements included in this & the comparison set
|
|
210
210
|
* @param {ASet<T>} set Set join
|
|
211
211
|
* @return {ASet<T>} New set of both previous sets combined
|
|
212
212
|
*/
|
|
213
|
-
union(
|
|
214
|
-
return new b([...this, ...
|
|
213
|
+
union(t) {
|
|
214
|
+
return new b([...this, ...t]);
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
|
-
class
|
|
218
|
-
constructor(
|
|
219
|
-
super((r, o) =>
|
|
217
|
+
class m extends Promise {
|
|
218
|
+
constructor(e) {
|
|
219
|
+
super((r, o) => e(
|
|
220
220
|
(s) => r(s),
|
|
221
221
|
(s) => o(s),
|
|
222
222
|
(s) => this.progress = s
|
|
@@ -227,298 +227,330 @@ class w extends Promise {
|
|
|
227
227
|
get progress() {
|
|
228
228
|
return this._progress;
|
|
229
229
|
}
|
|
230
|
-
set progress(
|
|
231
|
-
|
|
230
|
+
set progress(e) {
|
|
231
|
+
e != this._progress && (this._progress = e, this.listeners.forEach((r) => r(e)));
|
|
232
232
|
}
|
|
233
|
-
static from(
|
|
234
|
-
return
|
|
233
|
+
static from(e) {
|
|
234
|
+
return e instanceof m ? e : new m((r, o) => e.then((...s) => r(...s)).catch((...s) => o(...s)));
|
|
235
235
|
}
|
|
236
|
-
from(
|
|
237
|
-
const r =
|
|
236
|
+
from(e) {
|
|
237
|
+
const r = m.from(e);
|
|
238
238
|
return this.onProgress((o) => r.progress = o), r;
|
|
239
239
|
}
|
|
240
|
-
onProgress(
|
|
241
|
-
return this.listeners.push(
|
|
240
|
+
onProgress(e) {
|
|
241
|
+
return this.listeners.push(e), this;
|
|
242
242
|
}
|
|
243
|
-
then(
|
|
244
|
-
const o = super.then(
|
|
243
|
+
then(e, r) {
|
|
244
|
+
const o = super.then(e, r);
|
|
245
245
|
return this.from(o);
|
|
246
246
|
}
|
|
247
|
-
catch(
|
|
248
|
-
return this.from(super.catch(
|
|
247
|
+
catch(e) {
|
|
248
|
+
return this.from(super.catch(e));
|
|
249
249
|
}
|
|
250
|
-
finally(
|
|
251
|
-
return this.from(super.finally(
|
|
250
|
+
finally(e) {
|
|
251
|
+
return this.from(super.finally(e));
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
|
-
function
|
|
255
|
-
const
|
|
256
|
-
|
|
254
|
+
function ut(n, t) {
|
|
255
|
+
const e = document.createElement("a");
|
|
256
|
+
e.href = n, e.download = t, document.body.appendChild(e), e.click(), document.body.removeChild(e);
|
|
257
257
|
}
|
|
258
|
-
function Tt(n,
|
|
259
|
-
const
|
|
260
|
-
|
|
258
|
+
function Tt(n, t) {
|
|
259
|
+
const e = URL.createObjectURL(n);
|
|
260
|
+
ut(e, t), URL.revokeObjectURL(e);
|
|
261
261
|
}
|
|
262
262
|
function It(n = {}) {
|
|
263
|
-
return new Promise((
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
}, document.body.appendChild(
|
|
263
|
+
return new Promise((t) => {
|
|
264
|
+
const e = document.createElement("input");
|
|
265
|
+
e.type = "file", e.accept = n.accept || "*", e.style.display = "none", e.multiple = !!n.multiple, e.onblur = e.onchange = async () => {
|
|
266
|
+
t(Array.from(e.files)), e.remove();
|
|
267
|
+
}, document.body.appendChild(e), e.click();
|
|
268
268
|
});
|
|
269
269
|
}
|
|
270
270
|
function $t(n) {
|
|
271
|
-
return new
|
|
271
|
+
return new m((t, e, r) => {
|
|
272
272
|
const o = new XMLHttpRequest(), s = new FormData();
|
|
273
|
-
n.files.forEach((c) => s.append("file", c)), o.withCredentials = !!n.withCredentials, o.upload.addEventListener("progress", (c) => c.lengthComputable ? r(c.loaded / c.total) : null), o.addEventListener("loadend", () =>
|
|
273
|
+
n.files.forEach((c) => s.append("file", c)), o.withCredentials = !!n.withCredentials, o.upload.addEventListener("progress", (c) => c.lengthComputable ? r(c.loaded / c.total) : null), o.addEventListener("loadend", () => t(q(o.responseText))), o.addEventListener("error", () => e(q(o.responseText))), o.addEventListener("timeout", () => e({ error: "Request timed out" })), o.open("POST", n.url), Object.entries(n.headers || {}).forEach(([c, y]) => o.setRequestHeader(c, y)), o.send(s);
|
|
274
274
|
});
|
|
275
275
|
}
|
|
276
276
|
class v {
|
|
277
277
|
constructor() {
|
|
278
278
|
i(this, "listeners", {});
|
|
279
279
|
}
|
|
280
|
-
static emit(
|
|
281
|
-
(this.listeners["*"] || []).forEach((r) => r(
|
|
280
|
+
static emit(t, ...e) {
|
|
281
|
+
(this.listeners["*"] || []).forEach((r) => r(t, ...e)), (this.listeners[t.toString()] || []).forEach((r) => r(...e));
|
|
282
282
|
}
|
|
283
|
-
static off(
|
|
284
|
-
const r =
|
|
285
|
-
this.listeners[r] = (this.listeners[r] || []).filter((o) => o ===
|
|
283
|
+
static off(t, e) {
|
|
284
|
+
const r = t.toString();
|
|
285
|
+
this.listeners[r] = (this.listeners[r] || []).filter((o) => o === e);
|
|
286
286
|
}
|
|
287
|
-
static on(
|
|
287
|
+
static on(t, e) {
|
|
288
288
|
var o;
|
|
289
|
-
const r =
|
|
290
|
-
return this.listeners[r] || (this.listeners[r] = []), (o = this.listeners[r]) == null || o.push(
|
|
289
|
+
const r = t.toString();
|
|
290
|
+
return this.listeners[r] || (this.listeners[r] = []), (o = this.listeners[r]) == null || o.push(e), () => this.off(t, e);
|
|
291
291
|
}
|
|
292
|
-
static once(
|
|
292
|
+
static once(t, e) {
|
|
293
293
|
return new Promise((r) => {
|
|
294
|
-
const o = this.on(
|
|
295
|
-
r(s.length == 1 ? s[0] : s),
|
|
294
|
+
const o = this.on(t, (...s) => {
|
|
295
|
+
r(s.length == 1 ? s[0] : s), e && e(...s), o();
|
|
296
296
|
});
|
|
297
297
|
});
|
|
298
298
|
}
|
|
299
|
-
emit(
|
|
300
|
-
(this.listeners["*"] || []).forEach((r) => r(
|
|
299
|
+
emit(t, ...e) {
|
|
300
|
+
(this.listeners["*"] || []).forEach((r) => r(t, ...e)), (this.listeners[t] || []).forEach((r) => r(...e));
|
|
301
301
|
}
|
|
302
|
-
off(
|
|
303
|
-
this.listeners[
|
|
302
|
+
off(t, e) {
|
|
303
|
+
this.listeners[t] = (this.listeners[t] || []).filter((r) => r === e);
|
|
304
304
|
}
|
|
305
|
-
on(
|
|
305
|
+
on(t, e) {
|
|
306
306
|
var r;
|
|
307
|
-
return this.listeners[
|
|
307
|
+
return this.listeners[t] || (this.listeners[t] = []), (r = this.listeners[t]) == null || r.push(e), () => this.off(t, e);
|
|
308
308
|
}
|
|
309
|
-
once(
|
|
309
|
+
once(t, e) {
|
|
310
310
|
return new Promise((r) => {
|
|
311
|
-
const o = this.on(
|
|
312
|
-
r(s.length == 1 ? s[0] : s),
|
|
311
|
+
const o = this.on(t, (...s) => {
|
|
312
|
+
r(s.length == 1 ? s[0] : s), e && e(...s), o();
|
|
313
313
|
});
|
|
314
314
|
});
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
i(v, "listeners", {});
|
|
318
|
-
class
|
|
319
|
-
constructor(
|
|
320
|
-
super(
|
|
318
|
+
class p extends Error {
|
|
319
|
+
constructor(e, r) {
|
|
320
|
+
super(e);
|
|
321
321
|
i(this, "_code");
|
|
322
322
|
r != null && (this._code = r);
|
|
323
323
|
}
|
|
324
324
|
get code() {
|
|
325
325
|
return this._code || this.constructor.code;
|
|
326
326
|
}
|
|
327
|
-
set code(
|
|
328
|
-
this._code =
|
|
327
|
+
set code(e) {
|
|
328
|
+
this._code = e;
|
|
329
329
|
}
|
|
330
|
-
static from(
|
|
331
|
-
const r = Number(
|
|
330
|
+
static from(e) {
|
|
331
|
+
const r = Number(e.statusCode) ?? Number(e.code), o = new this(e.message || e.toString());
|
|
332
332
|
return Object.assign(o, {
|
|
333
|
-
stack:
|
|
334
|
-
...
|
|
333
|
+
stack: e.stack,
|
|
334
|
+
...e,
|
|
335
335
|
code: r ?? void 0
|
|
336
336
|
});
|
|
337
337
|
}
|
|
338
|
-
static instanceof(
|
|
339
|
-
return
|
|
338
|
+
static instanceof(e) {
|
|
339
|
+
return e.constructor.code != null;
|
|
340
340
|
}
|
|
341
341
|
toString() {
|
|
342
342
|
return this.message || super.toString();
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
|
-
i(
|
|
346
|
-
class
|
|
347
|
-
constructor(
|
|
348
|
-
super(
|
|
345
|
+
i(p, "code", 500);
|
|
346
|
+
class F extends p {
|
|
347
|
+
constructor(t = "Bad Request") {
|
|
348
|
+
super(t);
|
|
349
349
|
}
|
|
350
|
-
static instanceof(
|
|
351
|
-
return
|
|
350
|
+
static instanceof(t) {
|
|
351
|
+
return t.constructor.code == this.code;
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
|
-
i(
|
|
355
|
-
class
|
|
356
|
-
constructor(
|
|
357
|
-
super(
|
|
354
|
+
i(F, "code", 400);
|
|
355
|
+
class H extends p {
|
|
356
|
+
constructor(t = "Unauthorized") {
|
|
357
|
+
super(t);
|
|
358
358
|
}
|
|
359
|
-
static instanceof(
|
|
360
|
-
return
|
|
359
|
+
static instanceof(t) {
|
|
360
|
+
return t.constructor.code == this.code;
|
|
361
361
|
}
|
|
362
362
|
}
|
|
363
|
-
i(
|
|
364
|
-
class
|
|
365
|
-
constructor(
|
|
366
|
-
super(
|
|
363
|
+
i(H, "code", 401);
|
|
364
|
+
class Y extends p {
|
|
365
|
+
constructor(t = "Payment Required") {
|
|
366
|
+
super(t);
|
|
367
367
|
}
|
|
368
|
-
static instanceof(
|
|
369
|
-
return
|
|
368
|
+
static instanceof(t) {
|
|
369
|
+
return t.constructor.code == this.code;
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
|
-
i(
|
|
373
|
-
class
|
|
374
|
-
constructor(
|
|
375
|
-
super(
|
|
372
|
+
i(Y, "code", 402);
|
|
373
|
+
class W extends p {
|
|
374
|
+
constructor(t = "Forbidden") {
|
|
375
|
+
super(t);
|
|
376
376
|
}
|
|
377
|
-
static instanceof(
|
|
378
|
-
return
|
|
377
|
+
static instanceof(t) {
|
|
378
|
+
return t.constructor.code == this.code;
|
|
379
379
|
}
|
|
380
380
|
}
|
|
381
|
-
i(
|
|
382
|
-
class
|
|
383
|
-
constructor(
|
|
384
|
-
super(
|
|
381
|
+
i(W, "code", 403);
|
|
382
|
+
class J extends p {
|
|
383
|
+
constructor(t = "Not Found") {
|
|
384
|
+
super(t);
|
|
385
385
|
}
|
|
386
|
-
static instanceof(
|
|
387
|
-
return
|
|
386
|
+
static instanceof(t) {
|
|
387
|
+
return t.constructor.code == this.code;
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
|
-
i(
|
|
391
|
-
class
|
|
392
|
-
constructor(
|
|
393
|
-
super(
|
|
390
|
+
i(J, "code", 404);
|
|
391
|
+
class z extends p {
|
|
392
|
+
constructor(t = "Method Not Allowed") {
|
|
393
|
+
super(t);
|
|
394
394
|
}
|
|
395
|
-
static instanceof(
|
|
396
|
-
return
|
|
395
|
+
static instanceof(t) {
|
|
396
|
+
return t.constructor.code == this.code;
|
|
397
397
|
}
|
|
398
398
|
}
|
|
399
|
-
i(
|
|
400
|
-
class
|
|
401
|
-
constructor(
|
|
402
|
-
super(
|
|
399
|
+
i(z, "code", 405);
|
|
400
|
+
class K extends p {
|
|
401
|
+
constructor(t = "Not Acceptable") {
|
|
402
|
+
super(t);
|
|
403
403
|
}
|
|
404
|
-
static instanceof(
|
|
405
|
-
return
|
|
404
|
+
static instanceof(t) {
|
|
405
|
+
return t.constructor.code == this.code;
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
|
-
i(
|
|
409
|
-
class
|
|
410
|
-
constructor(
|
|
411
|
-
super(
|
|
408
|
+
i(K, "code", 406);
|
|
409
|
+
class V extends p {
|
|
410
|
+
constructor(t = "Internal Server Error") {
|
|
411
|
+
super(t);
|
|
412
412
|
}
|
|
413
|
-
static instanceof(
|
|
414
|
-
return
|
|
413
|
+
static instanceof(t) {
|
|
414
|
+
return t.constructor.code == this.code;
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
|
-
i(
|
|
418
|
-
class
|
|
419
|
-
constructor(
|
|
420
|
-
super(
|
|
417
|
+
i(V, "code", 500);
|
|
418
|
+
class Z extends p {
|
|
419
|
+
constructor(t = "Not Implemented") {
|
|
420
|
+
super(t);
|
|
421
421
|
}
|
|
422
|
-
static instanceof(
|
|
423
|
-
return
|
|
422
|
+
static instanceof(t) {
|
|
423
|
+
return t.constructor.code == this.code;
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
|
-
i(
|
|
427
|
-
class
|
|
428
|
-
constructor(
|
|
429
|
-
super(
|
|
426
|
+
i(Z, "code", 501);
|
|
427
|
+
class X extends p {
|
|
428
|
+
constructor(t = "Bad Gateway") {
|
|
429
|
+
super(t);
|
|
430
430
|
}
|
|
431
|
-
static instanceof(
|
|
432
|
-
return
|
|
431
|
+
static instanceof(t) {
|
|
432
|
+
return t.constructor.code == this.code;
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
|
-
i(
|
|
436
|
-
class
|
|
437
|
-
constructor(
|
|
438
|
-
super(
|
|
435
|
+
i(X, "code", 502);
|
|
436
|
+
class Q extends p {
|
|
437
|
+
constructor(t = "Service Unavailable") {
|
|
438
|
+
super(t);
|
|
439
439
|
}
|
|
440
|
-
static instanceof(
|
|
441
|
-
return
|
|
440
|
+
static instanceof(t) {
|
|
441
|
+
return t.constructor.code == this.code;
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
|
-
i(
|
|
445
|
-
class
|
|
446
|
-
constructor(
|
|
447
|
-
super(
|
|
448
|
-
}
|
|
449
|
-
static instanceof(e) {
|
|
450
|
-
return e.constructor.code == this.code;
|
|
444
|
+
i(Q, "code", 503);
|
|
445
|
+
class _ extends p {
|
|
446
|
+
constructor(t = "Gateway Timeout") {
|
|
447
|
+
super(t);
|
|
451
448
|
}
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
449
|
+
static instanceof(t) {
|
|
450
|
+
return t.constructor.code == this.code;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
i(_, "code", 504);
|
|
454
|
+
function Dt(n, t) {
|
|
455
|
+
if (n >= 200 && n < 300)
|
|
456
|
+
return null;
|
|
457
|
+
switch (n) {
|
|
458
|
+
case 400:
|
|
459
|
+
return new F(t);
|
|
460
|
+
case 401:
|
|
461
|
+
return new H(t);
|
|
462
|
+
case 402:
|
|
463
|
+
return new Y(t);
|
|
464
|
+
case 403:
|
|
465
|
+
return new W(t);
|
|
466
|
+
case 404:
|
|
467
|
+
return new J(t);
|
|
468
|
+
case 405:
|
|
469
|
+
return new z(t);
|
|
470
|
+
case 406:
|
|
471
|
+
return new K(t);
|
|
472
|
+
case 500:
|
|
473
|
+
return new V(t);
|
|
474
|
+
case 501:
|
|
475
|
+
return new Z(t);
|
|
476
|
+
case 502:
|
|
477
|
+
return new X(t);
|
|
478
|
+
case 503:
|
|
479
|
+
return new Q(t);
|
|
480
|
+
case 504:
|
|
481
|
+
return new _(t);
|
|
482
|
+
default:
|
|
483
|
+
return new p(t, n);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
const w = class w {
|
|
487
|
+
constructor(t = {}) {
|
|
456
488
|
i(this, "interceptors", {});
|
|
457
489
|
i(this, "headers", {});
|
|
458
490
|
i(this, "url");
|
|
459
|
-
this.url =
|
|
491
|
+
this.url = t.url ?? null, this.headers = t.headers || {}, t.interceptors && t.interceptors.forEach((e) => w.addInterceptor(e));
|
|
460
492
|
}
|
|
461
|
-
static addInterceptor(
|
|
462
|
-
const
|
|
463
|
-
return
|
|
464
|
-
|
|
493
|
+
static addInterceptor(t) {
|
|
494
|
+
const e = Object.keys(w.interceptors).length.toString();
|
|
495
|
+
return w.interceptors[e] = t, () => {
|
|
496
|
+
w.interceptors[e] = null;
|
|
465
497
|
};
|
|
466
498
|
}
|
|
467
|
-
addInterceptor(
|
|
468
|
-
const
|
|
469
|
-
return this.interceptors[
|
|
470
|
-
this.interceptors[
|
|
499
|
+
addInterceptor(t) {
|
|
500
|
+
const e = Object.keys(this.interceptors).length.toString();
|
|
501
|
+
return this.interceptors[e] = t, () => {
|
|
502
|
+
this.interceptors[e] = null;
|
|
471
503
|
};
|
|
472
504
|
}
|
|
473
|
-
request(
|
|
505
|
+
request(t = {}) {
|
|
474
506
|
var o;
|
|
475
|
-
if (!this.url && !
|
|
507
|
+
if (!this.url && !t.url)
|
|
476
508
|
throw new Error("URL needs to be set");
|
|
477
|
-
let
|
|
478
|
-
if (
|
|
479
|
-
const s = Array.isArray(
|
|
480
|
-
|
|
509
|
+
let e = ((o = t.url) != null && o.startsWith("http") ? t.url : (this.url || "") + (t.url || "")).replace(/([^:]\/)\/+/g, "$1");
|
|
510
|
+
if (t.fragment && (e.includes("#") ? e.replace(/#.*(\?|\n)/g, (s, c) => `#${t.fragment}${c}`) : e += "#" + t.fragment), t.query) {
|
|
511
|
+
const s = Array.isArray(t.query) ? t.query : Object.keys(t.query).map((c) => ({ key: c, value: t.query[c] }));
|
|
512
|
+
e += (e.includes("?") ? "&" : "?") + s.map((c) => `${c.key}=${c.value}`).join("&");
|
|
481
513
|
}
|
|
482
|
-
const r =
|
|
483
|
-
"Content-Type":
|
|
484
|
-
...
|
|
514
|
+
const r = rt({
|
|
515
|
+
"Content-Type": t.body ? t.body instanceof FormData ? "multipart/form-data" : "application/json" : void 0,
|
|
516
|
+
...w.headers,
|
|
485
517
|
...this.headers,
|
|
486
|
-
...
|
|
518
|
+
...t.headers
|
|
487
519
|
});
|
|
488
|
-
return typeof
|
|
489
|
-
fetch(
|
|
520
|
+
return typeof t.body == "object" && t.body != null && r["Content-Type"] == "application/json" && (t.body = JSON.stringify(t.body)), new m((s, c, y) => {
|
|
521
|
+
fetch(e, {
|
|
490
522
|
headers: r,
|
|
491
|
-
method:
|
|
492
|
-
body:
|
|
493
|
-
}).then(async (
|
|
523
|
+
method: t.method || (t.body ? "POST" : "GET"),
|
|
524
|
+
body: t.body
|
|
525
|
+
}).then(async (u) => {
|
|
494
526
|
var j, G;
|
|
495
|
-
for (let
|
|
496
|
-
await new Promise((O) => u
|
|
497
|
-
const R =
|
|
527
|
+
for (let a of [...Object.values(w.interceptors), ...Object.values(this.interceptors)])
|
|
528
|
+
await new Promise((O) => a(u, () => O()));
|
|
529
|
+
const R = u.headers.get("Content-Length"), N = R ? parseInt(R, 10) : 0;
|
|
498
530
|
let k = 0;
|
|
499
|
-
const T = (j =
|
|
500
|
-
start(
|
|
531
|
+
const T = (j = u.body) == null ? void 0 : j.getReader(), tt = new ReadableStream({
|
|
532
|
+
start(a) {
|
|
501
533
|
function O() {
|
|
502
534
|
T == null || T.read().then((x) => {
|
|
503
535
|
if (x.done)
|
|
504
|
-
return
|
|
505
|
-
k += x.value.byteLength,
|
|
506
|
-
}).catch((x) =>
|
|
536
|
+
return a.close();
|
|
537
|
+
k += x.value.byteLength, y(k / N), a.enqueue(x.value), O();
|
|
538
|
+
}).catch((x) => a.error(x));
|
|
507
539
|
}
|
|
508
540
|
O();
|
|
509
541
|
}
|
|
510
542
|
});
|
|
511
|
-
if (
|
|
512
|
-
const
|
|
513
|
-
|
|
543
|
+
if (u.data = new Response(tt), t.decode == null || t.decode) {
|
|
544
|
+
const a = (G = u.headers.get("Content-Type")) == null ? void 0 : G.toLowerCase();
|
|
545
|
+
a != null && a.includes("form") ? u.data = await u.data.formData() : a != null && a.includes("json") ? u.data = await u.data.json() : a != null && a.includes("text") ? u.data = await u.data.text() : a != null && a.includes("application") && (u.data = await u.data.blob());
|
|
514
546
|
}
|
|
515
|
-
|
|
547
|
+
u.ok ? s(u) : c(u);
|
|
516
548
|
});
|
|
517
549
|
});
|
|
518
550
|
}
|
|
519
551
|
};
|
|
520
|
-
i(
|
|
521
|
-
let M =
|
|
552
|
+
i(w, "interceptors", {}), i(w, "headers", {});
|
|
553
|
+
let M = w;
|
|
522
554
|
const A = {
|
|
523
555
|
CLEAR: "\x1B[0m",
|
|
524
556
|
BRIGHT: "\x1B[1m",
|
|
@@ -544,7 +576,7 @@ const A = {
|
|
|
544
576
|
LIGHT_MAGENTA: "\x1B[95m",
|
|
545
577
|
LIGHT_CYAN: "\x1B[96m",
|
|
546
578
|
WHITE: "\x1B[97m"
|
|
547
|
-
},
|
|
579
|
+
}, kt = {
|
|
548
580
|
BLACK: "\x1B[40m",
|
|
549
581
|
RED: "\x1B[41m",
|
|
550
582
|
GREEN: "\x1B[42m",
|
|
@@ -555,190 +587,190 @@ const A = {
|
|
|
555
587
|
WHITE: "\x1B[47m",
|
|
556
588
|
GREY: "\x1B[100m"
|
|
557
589
|
};
|
|
558
|
-
var
|
|
559
|
-
const
|
|
560
|
-
constructor(
|
|
561
|
-
super(), this.namespace =
|
|
590
|
+
var at = /* @__PURE__ */ ((n) => (n[n.ERROR = 0] = "ERROR", n[n.WARN = 1] = "WARN", n[n.INFO = 2] = "INFO", n[n.LOG = 3] = "LOG", n[n.DEBUG = 4] = "DEBUG", n))(at || {});
|
|
591
|
+
const g = class g extends v {
|
|
592
|
+
constructor(t) {
|
|
593
|
+
super(), this.namespace = t;
|
|
562
594
|
}
|
|
563
|
-
pad(
|
|
564
|
-
const s =
|
|
595
|
+
pad(t, e, r, o = !1) {
|
|
596
|
+
const s = t.toString(), c = e - s.length;
|
|
565
597
|
if (c <= 0)
|
|
566
598
|
return s;
|
|
567
|
-
const
|
|
568
|
-
return o ? s +
|
|
599
|
+
const y = Array(~~(c / r.length)).fill(r).join("");
|
|
600
|
+
return o ? s + y : y + s;
|
|
569
601
|
}
|
|
570
|
-
format(...
|
|
571
|
-
const
|
|
572
|
-
return `${`${
|
|
602
|
+
format(...t) {
|
|
603
|
+
const e = /* @__PURE__ */ new Date();
|
|
604
|
+
return `${`${e.getFullYear()}-${e.getMonth() + 1}-${e.getDate()} ${this.pad(e.getHours().toString(), 2, "0")}:${this.pad(e.getMinutes().toString(), 2, "0")}:${this.pad(e.getSeconds().toString(), 2, "0")}.${this.pad(e.getMilliseconds().toString(), 3, "0", !0)}`}${this.namespace ? ` [${this.namespace}]` : ""} ${t.join(" ")}`;
|
|
573
605
|
}
|
|
574
|
-
debug(...
|
|
575
|
-
if (
|
|
606
|
+
debug(...t) {
|
|
607
|
+
if (g.LOG_LEVEL < 4)
|
|
576
608
|
return;
|
|
577
|
-
const
|
|
578
|
-
|
|
609
|
+
const e = this.format(...t);
|
|
610
|
+
g.emit(4, e), console.debug(L.LIGHT_GREY + e + A.CLEAR);
|
|
579
611
|
}
|
|
580
|
-
log(...
|
|
581
|
-
if (
|
|
612
|
+
log(...t) {
|
|
613
|
+
if (g.LOG_LEVEL < 3)
|
|
582
614
|
return;
|
|
583
|
-
const
|
|
584
|
-
|
|
615
|
+
const e = this.format(...t);
|
|
616
|
+
g.emit(3, e), console.log(A.CLEAR + e);
|
|
585
617
|
}
|
|
586
|
-
info(...
|
|
587
|
-
if (
|
|
618
|
+
info(...t) {
|
|
619
|
+
if (g.LOG_LEVEL < 2)
|
|
588
620
|
return;
|
|
589
|
-
const
|
|
590
|
-
|
|
621
|
+
const e = this.format(...t);
|
|
622
|
+
g.emit(2, e), console.info(L.BLUE + e + A.CLEAR);
|
|
591
623
|
}
|
|
592
|
-
warn(...
|
|
593
|
-
if (
|
|
624
|
+
warn(...t) {
|
|
625
|
+
if (g.LOG_LEVEL < 1)
|
|
594
626
|
return;
|
|
595
|
-
const
|
|
596
|
-
|
|
627
|
+
const e = this.format(...t);
|
|
628
|
+
g.emit(1, e), console.warn(L.YELLOW + e + A.CLEAR);
|
|
597
629
|
}
|
|
598
|
-
error(...
|
|
599
|
-
if (
|
|
630
|
+
error(...t) {
|
|
631
|
+
if (g.LOG_LEVEL < 0)
|
|
600
632
|
return;
|
|
601
|
-
const
|
|
602
|
-
|
|
633
|
+
const e = this.format(...t);
|
|
634
|
+
g.emit(0, e), console.error(L.RED + e + A.CLEAR);
|
|
603
635
|
}
|
|
604
636
|
};
|
|
605
|
-
i(
|
|
606
|
-
let P =
|
|
607
|
-
function
|
|
608
|
-
const
|
|
609
|
-
let r = Math.pow(10,
|
|
610
|
-
const s =
|
|
637
|
+
i(g, "LOG_LEVEL", 4);
|
|
638
|
+
let P = g;
|
|
639
|
+
function jt(n) {
|
|
640
|
+
const t = (y, u) => u < 1e-7 ? y : t(u, ~~(y % u)), e = n.toString().length - 2;
|
|
641
|
+
let r = Math.pow(10, e), o = n * r;
|
|
642
|
+
const s = t(o, r);
|
|
611
643
|
o = ~~(o / s), r = ~~(r / s);
|
|
612
644
|
const c = ~~(o / r);
|
|
613
645
|
return o -= c * r, `${c ? c + " " : ""}${~~o}/${~~r}`;
|
|
614
646
|
}
|
|
615
|
-
function
|
|
616
|
-
let
|
|
617
|
-
const
|
|
618
|
-
return
|
|
647
|
+
function Gt(n) {
|
|
648
|
+
let t = n.split(" ");
|
|
649
|
+
const e = t.length == 2 ? Number(t[0]) : 0;
|
|
650
|
+
return t = t.pop().split("/"), e + Number(t[0]) / Number(t[1]);
|
|
619
651
|
}
|
|
620
|
-
function
|
|
621
|
-
return n.length - n.replaceAll(
|
|
652
|
+
function Ut(n, t) {
|
|
653
|
+
return n.length - n.replaceAll(t, "").length;
|
|
622
654
|
}
|
|
623
|
-
function
|
|
655
|
+
function qt(n) {
|
|
624
656
|
return Array(n).fill(null).map(() => Math.round(Math.random() * 15).toString(16)).join("");
|
|
625
657
|
}
|
|
626
658
|
const I = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", $ = "0123456789", D = "~`!@#$%^&*()_-+={[}]|\\:;\"'<,>.?/", lt = I + $ + D;
|
|
627
|
-
function
|
|
628
|
-
const
|
|
629
|
-
if (!
|
|
659
|
+
function Mt(n) {
|
|
660
|
+
const t = /(\+?1)?.*?(\d{3}).*?(\d{3}).*?(\d{4})/g.exec(n);
|
|
661
|
+
if (!t)
|
|
630
662
|
throw new Error(`Number cannot be parsed: ${n}`);
|
|
631
|
-
return `${
|
|
663
|
+
return `${t[1] ?? ""} (${t[2]}) ${t[3]}-${t[4]}`.trim();
|
|
632
664
|
}
|
|
633
|
-
function
|
|
634
|
-
return `${n.slice(0,
|
|
665
|
+
function Pt(n, t, e) {
|
|
666
|
+
return `${n.slice(0, e)}${t}${n.slice(e + 1)}`;
|
|
635
667
|
}
|
|
636
|
-
function
|
|
637
|
-
const o = n.toString(), s =
|
|
668
|
+
function vt(n, t, e, r = !0) {
|
|
669
|
+
const o = n.toString(), s = t - o.length;
|
|
638
670
|
if (s <= 0)
|
|
639
671
|
return o;
|
|
640
|
-
const c = Array(~~(s /
|
|
672
|
+
const c = Array(~~(s / e.length)).fill(e).join("");
|
|
641
673
|
return r ? c + o : o + c;
|
|
642
674
|
}
|
|
643
|
-
function
|
|
675
|
+
function Ft(n, t = lt) {
|
|
644
676
|
return Array(n).fill(null).map(() => {
|
|
645
|
-
const
|
|
646
|
-
return e
|
|
677
|
+
const e = ~~(Math.random() * t.length);
|
|
678
|
+
return t[e];
|
|
647
679
|
}).join("");
|
|
648
680
|
}
|
|
649
|
-
function Ht(n,
|
|
650
|
-
if (!
|
|
681
|
+
function Ht(n, t = !1, e = !1, r = !1) {
|
|
682
|
+
if (!t && !e && !r)
|
|
651
683
|
throw new Error("Must enable at least one: letters, numbers, symbols");
|
|
652
684
|
return Array(n).fill(null).map(() => {
|
|
653
685
|
let o;
|
|
654
686
|
do {
|
|
655
687
|
const s = ~~(Math.random() * 3);
|
|
656
|
-
|
|
688
|
+
t && s == 0 ? o = I[~~(Math.random() * I.length)] : e && s == 1 ? o = $[~~(Math.random() * $.length)] : r && s == 2 && (o = D[~~(Math.random() * D.length)]);
|
|
657
689
|
} while (!o);
|
|
658
690
|
return o;
|
|
659
691
|
}).join("");
|
|
660
692
|
}
|
|
661
|
-
function Yt(n,
|
|
662
|
-
if (typeof
|
|
693
|
+
function Yt(n, t) {
|
|
694
|
+
if (typeof t == "string" && (t = new RegExp(t, "g")), !t.global)
|
|
663
695
|
throw new TypeError("Regular expression must be global.");
|
|
664
|
-
let
|
|
665
|
-
for (; (r =
|
|
666
|
-
|
|
667
|
-
return
|
|
696
|
+
let e = [], r;
|
|
697
|
+
for (; (r = t.exec(n)) !== null; )
|
|
698
|
+
e.push(r);
|
|
699
|
+
return e;
|
|
668
700
|
}
|
|
669
701
|
function ht(n) {
|
|
670
|
-
var
|
|
671
|
-
return
|
|
702
|
+
var t = ft(pt(yt(dt(n), 8 * n.length)));
|
|
703
|
+
return t.toLowerCase();
|
|
672
704
|
}
|
|
673
705
|
function ft(n) {
|
|
674
|
-
for (var
|
|
675
|
-
|
|
706
|
+
for (var t, e = "0123456789ABCDEF", r = "", o = 0; o < n.length; o++)
|
|
707
|
+
t = n.charCodeAt(o), r += e.charAt(t >>> 4 & 15) + e.charAt(15 & t);
|
|
676
708
|
return r;
|
|
677
709
|
}
|
|
678
710
|
function dt(n) {
|
|
679
|
-
for (var
|
|
680
|
-
e
|
|
681
|
-
for (
|
|
682
|
-
e
|
|
683
|
-
return
|
|
711
|
+
for (var t = Array(n.length >> 2), e = 0; e < t.length; e++)
|
|
712
|
+
t[e] = 0;
|
|
713
|
+
for (e = 0; e < 8 * n.length; e += 8)
|
|
714
|
+
t[e >> 5] |= (255 & n.charCodeAt(e / 8)) << e % 32;
|
|
715
|
+
return t;
|
|
684
716
|
}
|
|
685
717
|
function pt(n) {
|
|
686
|
-
for (var
|
|
687
|
-
|
|
688
|
-
return
|
|
718
|
+
for (var t = "", e = 0; e < 32 * n.length; e += 8)
|
|
719
|
+
t += String.fromCharCode(n[e >> 5] >>> e % 32 & 255);
|
|
720
|
+
return t;
|
|
689
721
|
}
|
|
690
|
-
function yt(n,
|
|
691
|
-
n[
|
|
692
|
-
for (var
|
|
693
|
-
var
|
|
694
|
-
r = d(r = d(r = d(r = d(r = f(r = f(r = f(r = f(r = h(r = h(r = h(r = h(r = l(r = l(r = l(r = l(r, o = l(o, s = l(s,
|
|
722
|
+
function yt(n, t) {
|
|
723
|
+
n[t >> 5] |= 128 << t % 32, n[14 + (t + 64 >>> 9 << 4)] = t;
|
|
724
|
+
for (var e = 1732584193, r = -271733879, o = -1732584194, s = 271733878, c = 0; c < n.length; c += 16) {
|
|
725
|
+
var y = e, u = r, R = o, N = s;
|
|
726
|
+
r = d(r = d(r = d(r = d(r = f(r = f(r = f(r = f(r = h(r = h(r = h(r = h(r = l(r = l(r = l(r = l(r, o = l(o, s = l(s, e = l(e, r, o, s, n[c + 0], 7, -680876936), r, o, n[c + 1], 12, -389564586), e, r, n[c + 2], 17, 606105819), s, e, n[c + 3], 22, -1044525330), o = l(o, s = l(s, e = l(e, r, o, s, n[c + 4], 7, -176418897), r, o, n[c + 5], 12, 1200080426), e, r, n[c + 6], 17, -1473231341), s, e, n[c + 7], 22, -45705983), o = l(o, s = l(s, e = l(e, r, o, s, n[c + 8], 7, 1770035416), r, o, n[c + 9], 12, -1958414417), e, r, n[c + 10], 17, -42063), s, e, n[c + 11], 22, -1990404162), o = l(o, s = l(s, e = l(e, r, o, s, n[c + 12], 7, 1804603682), r, o, n[c + 13], 12, -40341101), e, r, n[c + 14], 17, -1502002290), s, e, n[c + 15], 22, 1236535329), o = h(o, s = h(s, e = h(e, r, o, s, n[c + 1], 5, -165796510), r, o, n[c + 6], 9, -1069501632), e, r, n[c + 11], 14, 643717713), s, e, n[c + 0], 20, -373897302), o = h(o, s = h(s, e = h(e, r, o, s, n[c + 5], 5, -701558691), r, o, n[c + 10], 9, 38016083), e, r, n[c + 15], 14, -660478335), s, e, n[c + 4], 20, -405537848), o = h(o, s = h(s, e = h(e, r, o, s, n[c + 9], 5, 568446438), r, o, n[c + 14], 9, -1019803690), e, r, n[c + 3], 14, -187363961), s, e, n[c + 8], 20, 1163531501), o = h(o, s = h(s, e = h(e, r, o, s, n[c + 13], 5, -1444681467), r, o, n[c + 2], 9, -51403784), e, r, n[c + 7], 14, 1735328473), s, e, n[c + 12], 20, -1926607734), o = f(o, s = f(s, e = f(e, r, o, s, n[c + 5], 4, -378558), r, o, n[c + 8], 11, -2022574463), e, r, n[c + 11], 16, 1839030562), s, e, n[c + 14], 23, -35309556), o = f(o, s = f(s, e = f(e, r, o, s, n[c + 1], 4, -1530992060), r, o, n[c + 4], 11, 1272893353), e, r, n[c + 7], 16, -155497632), s, e, n[c + 10], 23, -1094730640), o = f(o, s = f(s, e = f(e, r, o, s, n[c + 13], 4, 681279174), r, o, n[c + 0], 11, -358537222), e, r, n[c + 3], 16, -722521979), s, e, n[c + 6], 23, 76029189), o = f(o, s = f(s, e = f(e, r, o, s, n[c + 9], 4, -640364487), r, o, n[c + 12], 11, -421815835), e, r, n[c + 15], 16, 530742520), s, e, n[c + 2], 23, -995338651), o = d(o, s = d(s, e = d(e, r, o, s, n[c + 0], 6, -198630844), r, o, n[c + 7], 10, 1126891415), e, r, n[c + 14], 15, -1416354905), s, e, n[c + 5], 21, -57434055), o = d(o, s = d(s, e = d(e, r, o, s, n[c + 12], 6, 1700485571), r, o, n[c + 3], 10, -1894986606), e, r, n[c + 10], 15, -1051523), s, e, n[c + 1], 21, -2054922799), o = d(o, s = d(s, e = d(e, r, o, s, n[c + 8], 6, 1873313359), r, o, n[c + 15], 10, -30611744), e, r, n[c + 6], 15, -1560198380), s, e, n[c + 13], 21, 1309151649), o = d(o, s = d(s, e = d(e, r, o, s, n[c + 4], 6, -145523070), r, o, n[c + 11], 10, -1120210379), e, r, n[c + 2], 15, 718787259), s, e, n[c + 9], 21, -343485551), e = E(e, y), r = E(r, u), o = E(o, R), s = E(s, N);
|
|
695
727
|
}
|
|
696
|
-
return Array(
|
|
728
|
+
return Array(e, r, o, s);
|
|
697
729
|
}
|
|
698
|
-
function C(n,
|
|
699
|
-
return E(gt(E(E(
|
|
730
|
+
function C(n, t, e, r, o, s) {
|
|
731
|
+
return E(gt(E(E(t, n), E(r, s)), o), e);
|
|
700
732
|
}
|
|
701
|
-
function l(n,
|
|
702
|
-
return C(
|
|
733
|
+
function l(n, t, e, r, o, s, c) {
|
|
734
|
+
return C(t & e | ~t & r, n, t, o, s, c);
|
|
703
735
|
}
|
|
704
|
-
function h(n,
|
|
705
|
-
return C(
|
|
736
|
+
function h(n, t, e, r, o, s, c) {
|
|
737
|
+
return C(t & r | e & ~r, n, t, o, s, c);
|
|
706
738
|
}
|
|
707
|
-
function f(n,
|
|
708
|
-
return C(
|
|
739
|
+
function f(n, t, e, r, o, s, c) {
|
|
740
|
+
return C(t ^ e ^ r, n, t, o, s, c);
|
|
709
741
|
}
|
|
710
|
-
function d(n,
|
|
711
|
-
return C(
|
|
742
|
+
function d(n, t, e, r, o, s, c) {
|
|
743
|
+
return C(e ^ (t | ~r), n, t, o, s, c);
|
|
712
744
|
}
|
|
713
|
-
function E(n,
|
|
714
|
-
var
|
|
715
|
-
return (n >> 16) + (
|
|
745
|
+
function E(n, t) {
|
|
746
|
+
var e = (65535 & n) + (65535 & t);
|
|
747
|
+
return (n >> 16) + (t >> 16) + (e >> 16) << 16 | 65535 & e;
|
|
716
748
|
}
|
|
717
|
-
function gt(n,
|
|
718
|
-
return n <<
|
|
749
|
+
function gt(n, t) {
|
|
750
|
+
return n << t | n >>> 32 - t;
|
|
719
751
|
}
|
|
720
|
-
function
|
|
752
|
+
function Wt(n) {
|
|
721
753
|
return /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(n);
|
|
722
754
|
}
|
|
723
|
-
function
|
|
724
|
-
return n ? `https://www.gravatar.com/avatar/${ht(n)}?d=${
|
|
755
|
+
function Jt(n, t = "mp") {
|
|
756
|
+
return n ? `https://www.gravatar.com/avatar/${ht(n)}?d=${t}` : "";
|
|
725
757
|
}
|
|
726
|
-
function
|
|
727
|
-
const
|
|
758
|
+
function zt(n) {
|
|
759
|
+
const t = new RegExp(
|
|
728
760
|
"(?:(?<protocol>[\\w\\d]+)\\:\\/\\/)?(?:(?<user>.+)\\@)?(?<host>(?<domain>[^:\\/\\?#@\\n]+)(?:\\:(?<port>\\d*))?)(?<path>\\/.*?)?(?:\\?(?<query>.*?))?(?:#(?<fragment>.*?))?$",
|
|
729
761
|
"gm"
|
|
730
|
-
).exec(n),
|
|
731
|
-
if (
|
|
732
|
-
const o =
|
|
762
|
+
).exec(n), e = (t == null ? void 0 : t.groups) ?? {}, r = e.domain.split(".");
|
|
763
|
+
if (e.port != null && (e.port = Number(e.port)), r.length > 2 && (e.domain = r.splice(-2, 2).join("."), e.subdomain = r.join(".")), e.query) {
|
|
764
|
+
const o = e.query.split("&"), s = {};
|
|
733
765
|
o.forEach((c) => {
|
|
734
|
-
const [
|
|
735
|
-
s[
|
|
736
|
-
}),
|
|
766
|
+
const [y, u] = c.split("=");
|
|
767
|
+
s[y] = u;
|
|
768
|
+
}), e.query = s;
|
|
737
769
|
}
|
|
738
|
-
return
|
|
770
|
+
return e;
|
|
739
771
|
}
|
|
740
|
-
function
|
|
741
|
-
const
|
|
772
|
+
function Kt(n) {
|
|
773
|
+
const t = n instanceof Date ? n : new Date(n);
|
|
742
774
|
return new Intl.DateTimeFormat("en-us", {
|
|
743
775
|
weekday: "long",
|
|
744
776
|
month: "short",
|
|
@@ -746,82 +778,83 @@ function zt(n) {
|
|
|
746
778
|
hour: "numeric",
|
|
747
779
|
minute: "numeric",
|
|
748
780
|
hour12: !0
|
|
749
|
-
}).format(
|
|
781
|
+
}).format(t);
|
|
750
782
|
}
|
|
751
|
-
function
|
|
752
|
-
return new Promise((
|
|
783
|
+
function wt(n) {
|
|
784
|
+
return new Promise((t) => setTimeout(t, n));
|
|
753
785
|
}
|
|
754
|
-
async function
|
|
786
|
+
async function Vt(n, t = 100) {
|
|
755
787
|
for (; n(); )
|
|
756
|
-
await
|
|
788
|
+
await wt(t);
|
|
757
789
|
}
|
|
758
|
-
function
|
|
790
|
+
function Zt(n) {
|
|
759
791
|
return (n instanceof Date ? n.getTime() : n) - (/* @__PURE__ */ new Date()).getTime();
|
|
760
792
|
}
|
|
761
793
|
export {
|
|
762
794
|
b as ASet,
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
795
|
+
X as BadGatewayError,
|
|
796
|
+
F as BadRequestError,
|
|
797
|
+
kt as CliBackground,
|
|
766
798
|
A as CliEffects,
|
|
767
799
|
L as CliForeground,
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
800
|
+
p as CustomError,
|
|
801
|
+
W as ForbiddenError,
|
|
802
|
+
_ as GatewayTimeoutError,
|
|
771
803
|
M as Http,
|
|
772
|
-
|
|
804
|
+
V as InternalServerError,
|
|
773
805
|
q as JSONAttemptParse,
|
|
774
806
|
bt as JSONSanitized,
|
|
775
|
-
|
|
807
|
+
at as LOG_LEVEL,
|
|
776
808
|
P as Logger,
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
809
|
+
z as MethodNotAllowedError,
|
|
810
|
+
K as NotAcceptableError,
|
|
811
|
+
J as NotFoundError,
|
|
812
|
+
Z as NotImplementedError,
|
|
813
|
+
Y as PaymentRequiredError,
|
|
814
|
+
m as PromiseProgress,
|
|
815
|
+
Q as ServiceUnavailableError,
|
|
784
816
|
v as TypedEmitter,
|
|
785
|
-
|
|
817
|
+
H as UnauthorizedError,
|
|
786
818
|
Rt as addUnique,
|
|
787
819
|
Ot as arrayDiff,
|
|
788
820
|
Lt as caseInsensitiveSort,
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
821
|
+
rt as clean,
|
|
822
|
+
Ut as countChars,
|
|
823
|
+
qt as createHex,
|
|
824
|
+
jt as dec2Frac,
|
|
825
|
+
mt as deepCopy,
|
|
826
|
+
ot as deepMerge,
|
|
795
827
|
S as dotNotation,
|
|
796
|
-
|
|
828
|
+
ut as download,
|
|
797
829
|
Tt as downloadBlob,
|
|
830
|
+
Dt as errorFromCode,
|
|
798
831
|
It as fileBrowser,
|
|
799
832
|
Ct as findByProp,
|
|
800
|
-
|
|
801
|
-
|
|
833
|
+
ct as flattenArr,
|
|
834
|
+
st as flattenObj,
|
|
802
835
|
xt as formData,
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
836
|
+
Kt as formatDate,
|
|
837
|
+
Mt as formatPhoneNumber,
|
|
838
|
+
Gt as fracToDec,
|
|
839
|
+
Jt as gravatar,
|
|
807
840
|
U as includes,
|
|
808
|
-
|
|
841
|
+
Pt as insertAt,
|
|
809
842
|
B as isEqual,
|
|
810
843
|
Nt as makeArray,
|
|
811
|
-
|
|
844
|
+
it as makeUnique,
|
|
812
845
|
Yt as matchAll,
|
|
813
846
|
ht as md5,
|
|
814
847
|
At as mixin,
|
|
815
|
-
|
|
816
|
-
|
|
848
|
+
vt as pad,
|
|
849
|
+
Ft as randomString,
|
|
817
850
|
Ht as randomStringBuilder,
|
|
818
|
-
|
|
819
|
-
|
|
851
|
+
wt as sleep,
|
|
852
|
+
Vt as sleepUntil,
|
|
820
853
|
St as sortByProp,
|
|
821
|
-
|
|
854
|
+
Zt as timeUntil,
|
|
822
855
|
$t as uploadWithProgress,
|
|
823
856
|
Bt as urlEncode,
|
|
824
|
-
|
|
825
|
-
|
|
857
|
+
zt as urlParser,
|
|
858
|
+
Wt as validateEmail
|
|
826
859
|
};
|
|
827
860
|
//# sourceMappingURL=index.mjs.map
|