@dpuse/dpuse-tool-csv-parse 0.0.135
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/LICENSE +21 -0
- package/README.md +14 -0
- package/dist/dpuse-tool-csv-parse.es.js +2692 -0
- package/dist/types/src/index.d.ts +26 -0
- package/dist/types/vite.config.d.ts +5 -0
- package/package.json +71 -0
|
@@ -0,0 +1,2692 @@
|
|
|
1
|
+
//#region node_modules/csv-parse/dist/esm/index.js
|
|
2
|
+
var e = typeof global < "u" ? global : typeof self < "u" ? self : typeof window < "u" ? window : {}, t = [], n = [], r = typeof Uint8Array < "u" ? Uint8Array : Array, i = !1;
|
|
3
|
+
function a() {
|
|
4
|
+
i = !0;
|
|
5
|
+
for (var e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", r = 0, a = e.length; r < a; ++r) t[r] = e[r], n[e.charCodeAt(r)] = r;
|
|
6
|
+
n[45] = 62, n[95] = 63;
|
|
7
|
+
}
|
|
8
|
+
function o(e) {
|
|
9
|
+
i || a();
|
|
10
|
+
var t, o, s, c, l, u, d = e.length;
|
|
11
|
+
if (d % 4 > 0) throw Error("Invalid string. Length must be a multiple of 4");
|
|
12
|
+
l = e[d - 2] === "=" ? 2 : e[d - 1] === "=" ? 1 : 0, u = new r(d * 3 / 4 - l), s = l > 0 ? d - 4 : d;
|
|
13
|
+
var f = 0;
|
|
14
|
+
for (t = 0, o = 0; t < s; t += 4, o += 3) c = n[e.charCodeAt(t)] << 18 | n[e.charCodeAt(t + 1)] << 12 | n[e.charCodeAt(t + 2)] << 6 | n[e.charCodeAt(t + 3)], u[f++] = c >> 16 & 255, u[f++] = c >> 8 & 255, u[f++] = c & 255;
|
|
15
|
+
return l === 2 ? (c = n[e.charCodeAt(t)] << 2 | n[e.charCodeAt(t + 1)] >> 4, u[f++] = c & 255) : l === 1 && (c = n[e.charCodeAt(t)] << 10 | n[e.charCodeAt(t + 1)] << 4 | n[e.charCodeAt(t + 2)] >> 2, u[f++] = c >> 8 & 255, u[f++] = c & 255), u;
|
|
16
|
+
}
|
|
17
|
+
function s(e) {
|
|
18
|
+
return t[e >> 18 & 63] + t[e >> 12 & 63] + t[e >> 6 & 63] + t[e & 63];
|
|
19
|
+
}
|
|
20
|
+
function c(e, t, n) {
|
|
21
|
+
for (var r, i = [], a = t; a < n; a += 3) r = (e[a] << 16) + (e[a + 1] << 8) + e[a + 2], i.push(s(r));
|
|
22
|
+
return i.join("");
|
|
23
|
+
}
|
|
24
|
+
function l(e) {
|
|
25
|
+
i || a();
|
|
26
|
+
for (var n, r = e.length, o = r % 3, s = "", l = [], u = 16383, d = 0, f = r - o; d < f; d += u) l.push(c(e, d, d + u > f ? f : d + u));
|
|
27
|
+
return o === 1 ? (n = e[r - 1], s += t[n >> 2], s += t[n << 4 & 63], s += "==") : o === 2 && (n = (e[r - 2] << 8) + e[r - 1], s += t[n >> 10], s += t[n >> 4 & 63], s += t[n << 2 & 63], s += "="), l.push(s), l.join("");
|
|
28
|
+
}
|
|
29
|
+
function u(e, t, n, r, i) {
|
|
30
|
+
var a, o, s = i * 8 - r - 1, c = (1 << s) - 1, l = c >> 1, u = -7, d = n ? i - 1 : 0, f = n ? -1 : 1, p = e[t + d];
|
|
31
|
+
for (d += f, a = p & (1 << -u) - 1, p >>= -u, u += s; u > 0; a = a * 256 + e[t + d], d += f, u -= 8);
|
|
32
|
+
for (o = a & (1 << -u) - 1, a >>= -u, u += r; u > 0; o = o * 256 + e[t + d], d += f, u -= 8);
|
|
33
|
+
if (a === 0) a = 1 - l;
|
|
34
|
+
else if (a === c) return o ? NaN : (p ? -1 : 1) * Infinity;
|
|
35
|
+
else o += 2 ** r, a -= l;
|
|
36
|
+
return (p ? -1 : 1) * o * 2 ** (a - r);
|
|
37
|
+
}
|
|
38
|
+
function d(e, t, n, r, i, a) {
|
|
39
|
+
var o, s, c, l = a * 8 - i - 1, u = (1 << l) - 1, d = u >> 1, f = i === 23 ? 2 ** -24 - 2 ** -77 : 0, p = r ? 0 : a - 1, m = r ? 1 : -1, h = t < 0 || t === 0 && 1 / t < 0 ? 1 : 0;
|
|
40
|
+
for (t = Math.abs(t), isNaN(t) || t === Infinity ? (s = isNaN(t) ? 1 : 0, o = u) : (o = Math.floor(Math.log(t) / Math.LN2), t * (c = 2 ** -o) < 1 && (o--, c *= 2), o + d >= 1 ? t += f / c : t += f * 2 ** (1 - d), t * c >= 2 && (o++, c /= 2), o + d >= u ? (s = 0, o = u) : o + d >= 1 ? (s = (t * c - 1) * 2 ** i, o += d) : (s = t * 2 ** (d - 1) * 2 ** i, o = 0)); i >= 8; e[n + p] = s & 255, p += m, s /= 256, i -= 8);
|
|
41
|
+
for (o = o << i | s, l += i; l > 0; e[n + p] = o & 255, p += m, o /= 256, l -= 8);
|
|
42
|
+
e[n + p - m] |= h * 128;
|
|
43
|
+
}
|
|
44
|
+
var f = {}.toString, p = Array.isArray || function(e) {
|
|
45
|
+
return f.call(e) == "[object Array]";
|
|
46
|
+
}, m = 50;
|
|
47
|
+
_.TYPED_ARRAY_SUPPORT = e.TYPED_ARRAY_SUPPORT === void 0 ? !0 : e.TYPED_ARRAY_SUPPORT, h();
|
|
48
|
+
function h() {
|
|
49
|
+
return _.TYPED_ARRAY_SUPPORT ? 2147483647 : 1073741823;
|
|
50
|
+
}
|
|
51
|
+
function g(e, t) {
|
|
52
|
+
if (h() < t) throw RangeError("Invalid typed array length");
|
|
53
|
+
return _.TYPED_ARRAY_SUPPORT ? (e = new Uint8Array(t), e.__proto__ = _.prototype) : (e === null && (e = new _(t)), e.length = t), e;
|
|
54
|
+
}
|
|
55
|
+
function _(e, t, n) {
|
|
56
|
+
if (!_.TYPED_ARRAY_SUPPORT && !(this instanceof _)) return new _(e, t, n);
|
|
57
|
+
if (typeof e == "number") {
|
|
58
|
+
if (typeof t == "string") throw Error("If encoding is specified then the first argument must be a string");
|
|
59
|
+
return te(this, e);
|
|
60
|
+
}
|
|
61
|
+
return v(this, e, t, n);
|
|
62
|
+
}
|
|
63
|
+
_.poolSize = 8192, _._augment = function(e) {
|
|
64
|
+
return e.__proto__ = _.prototype, e;
|
|
65
|
+
};
|
|
66
|
+
function v(e, t, n, r) {
|
|
67
|
+
if (typeof t == "number") throw TypeError("\"value\" argument must not be a number");
|
|
68
|
+
return typeof ArrayBuffer < "u" && t instanceof ArrayBuffer ? re(e, t, n, r) : typeof t == "string" ? b(e, t, n) : x(e, t);
|
|
69
|
+
}
|
|
70
|
+
_.from = function(e, t, n) {
|
|
71
|
+
return v(null, e, t, n);
|
|
72
|
+
}, _.TYPED_ARRAY_SUPPORT && (_.prototype.__proto__ = Uint8Array.prototype, _.__proto__ = Uint8Array, typeof Symbol < "u" && Symbol.species && _[Symbol.species]);
|
|
73
|
+
function y(e) {
|
|
74
|
+
if (typeof e != "number") throw TypeError("\"size\" argument must be a number");
|
|
75
|
+
if (e < 0) throw RangeError("\"size\" argument must not be negative");
|
|
76
|
+
}
|
|
77
|
+
function ee(e, t, n, r) {
|
|
78
|
+
return y(t), t <= 0 || n === void 0 ? g(e, t) : typeof r == "string" ? g(e, t).fill(n, r) : g(e, t).fill(n);
|
|
79
|
+
}
|
|
80
|
+
_.alloc = function(e, t, n) {
|
|
81
|
+
return ee(null, e, t, n);
|
|
82
|
+
};
|
|
83
|
+
function te(e, t) {
|
|
84
|
+
if (y(t), e = g(e, t < 0 ? 0 : S(t) | 0), !_.TYPED_ARRAY_SUPPORT) for (var n = 0; n < t; ++n) e[n] = 0;
|
|
85
|
+
return e;
|
|
86
|
+
}
|
|
87
|
+
_.allocUnsafe = function(e) {
|
|
88
|
+
return te(null, e);
|
|
89
|
+
}, _.allocUnsafeSlow = function(e) {
|
|
90
|
+
return te(null, e);
|
|
91
|
+
};
|
|
92
|
+
function b(e, t, n) {
|
|
93
|
+
if ((typeof n != "string" || n === "") && (n = "utf8"), !_.isEncoding(n)) throw TypeError("\"encoding\" must be a valid string encoding");
|
|
94
|
+
var r = ie(t, n) | 0;
|
|
95
|
+
e = g(e, r);
|
|
96
|
+
var i = e.write(t, n);
|
|
97
|
+
return i !== r && (e = e.slice(0, i)), e;
|
|
98
|
+
}
|
|
99
|
+
function ne(e, t) {
|
|
100
|
+
var n = t.length < 0 ? 0 : S(t.length) | 0;
|
|
101
|
+
e = g(e, n);
|
|
102
|
+
for (var r = 0; r < n; r += 1) e[r] = t[r] & 255;
|
|
103
|
+
return e;
|
|
104
|
+
}
|
|
105
|
+
function re(e, t, n, r) {
|
|
106
|
+
if (t.byteLength, n < 0 || t.byteLength < n) throw RangeError("'offset' is out of bounds");
|
|
107
|
+
if (t.byteLength < n + (r || 0)) throw RangeError("'length' is out of bounds");
|
|
108
|
+
return t = n === void 0 && r === void 0 ? new Uint8Array(t) : r === void 0 ? new Uint8Array(t, n) : new Uint8Array(t, n, r), _.TYPED_ARRAY_SUPPORT ? (e = t, e.__proto__ = _.prototype) : e = ne(e, t), e;
|
|
109
|
+
}
|
|
110
|
+
function x(e, t) {
|
|
111
|
+
if (C(t)) {
|
|
112
|
+
var n = S(t.length) | 0;
|
|
113
|
+
return e = g(e, n), e.length === 0 || t.copy(e, 0, 0, n), e;
|
|
114
|
+
}
|
|
115
|
+
if (t) {
|
|
116
|
+
if (typeof ArrayBuffer < "u" && t.buffer instanceof ArrayBuffer || "length" in t) return typeof t.length != "number" || Fe(t.length) ? g(e, 0) : ne(e, t);
|
|
117
|
+
if (t.type === "Buffer" && p(t.data)) return ne(e, t.data);
|
|
118
|
+
}
|
|
119
|
+
throw TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.");
|
|
120
|
+
}
|
|
121
|
+
function S(e) {
|
|
122
|
+
if (e >= h()) throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + h().toString(16) + " bytes");
|
|
123
|
+
return e | 0;
|
|
124
|
+
}
|
|
125
|
+
_.isBuffer = O;
|
|
126
|
+
function C(e) {
|
|
127
|
+
return !!(e != null && e._isBuffer);
|
|
128
|
+
}
|
|
129
|
+
_.compare = function(e, t) {
|
|
130
|
+
if (!C(e) || !C(t)) throw TypeError("Arguments must be Buffers");
|
|
131
|
+
if (e === t) return 0;
|
|
132
|
+
for (var n = e.length, r = t.length, i = 0, a = Math.min(n, r); i < a; ++i) if (e[i] !== t[i]) {
|
|
133
|
+
n = e[i], r = t[i];
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
return n < r ? -1 : r < n ? 1 : 0;
|
|
137
|
+
}, _.isEncoding = function(e) {
|
|
138
|
+
switch (String(e).toLowerCase()) {
|
|
139
|
+
case "hex":
|
|
140
|
+
case "utf8":
|
|
141
|
+
case "utf-8":
|
|
142
|
+
case "ascii":
|
|
143
|
+
case "latin1":
|
|
144
|
+
case "binary":
|
|
145
|
+
case "base64":
|
|
146
|
+
case "ucs2":
|
|
147
|
+
case "ucs-2":
|
|
148
|
+
case "utf16le":
|
|
149
|
+
case "utf-16le": return !0;
|
|
150
|
+
default: return !1;
|
|
151
|
+
}
|
|
152
|
+
}, _.concat = function(e, t) {
|
|
153
|
+
if (!p(e)) throw TypeError("\"list\" argument must be an Array of Buffers");
|
|
154
|
+
if (e.length === 0) return _.alloc(0);
|
|
155
|
+
var n;
|
|
156
|
+
if (t === void 0) for (t = 0, n = 0; n < e.length; ++n) t += e[n].length;
|
|
157
|
+
var r = _.allocUnsafe(t), i = 0;
|
|
158
|
+
for (n = 0; n < e.length; ++n) {
|
|
159
|
+
var a = e[n];
|
|
160
|
+
if (!C(a)) throw TypeError("\"list\" argument must be an Array of Buffers");
|
|
161
|
+
a.copy(r, i), i += a.length;
|
|
162
|
+
}
|
|
163
|
+
return r;
|
|
164
|
+
};
|
|
165
|
+
function ie(e, t) {
|
|
166
|
+
if (C(e)) return e.length;
|
|
167
|
+
if (typeof ArrayBuffer < "u" && typeof ArrayBuffer.isView == "function" && (ArrayBuffer.isView(e) || e instanceof ArrayBuffer)) return e.byteLength;
|
|
168
|
+
typeof e != "string" && (e = "" + e);
|
|
169
|
+
var n = e.length;
|
|
170
|
+
if (n === 0) return 0;
|
|
171
|
+
for (var r = !1;;) switch (t) {
|
|
172
|
+
case "ascii":
|
|
173
|
+
case "latin1":
|
|
174
|
+
case "binary": return n;
|
|
175
|
+
case "utf8":
|
|
176
|
+
case "utf-8":
|
|
177
|
+
case void 0: return Ae(e).length;
|
|
178
|
+
case "ucs2":
|
|
179
|
+
case "ucs-2":
|
|
180
|
+
case "utf16le":
|
|
181
|
+
case "utf-16le": return n * 2;
|
|
182
|
+
case "hex": return n >>> 1;
|
|
183
|
+
case "base64": return Ne(e).length;
|
|
184
|
+
default:
|
|
185
|
+
if (r) return Ae(e).length;
|
|
186
|
+
t = ("" + t).toLowerCase(), r = !0;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
_.byteLength = ie;
|
|
190
|
+
function ae(e, t, n) {
|
|
191
|
+
var r = !1;
|
|
192
|
+
if ((t === void 0 || t < 0) && (t = 0), t > this.length || ((n === void 0 || n > this.length) && (n = this.length), n <= 0) || (n >>>= 0, t >>>= 0, n <= t)) return "";
|
|
193
|
+
for (e ||= "utf8";;) switch (e) {
|
|
194
|
+
case "hex": return be(this, t, n);
|
|
195
|
+
case "utf8":
|
|
196
|
+
case "utf-8": return he(this, t, n);
|
|
197
|
+
case "ascii": return ve(this, t, n);
|
|
198
|
+
case "latin1":
|
|
199
|
+
case "binary": return ye(this, t, n);
|
|
200
|
+
case "base64": return me(this, t, n);
|
|
201
|
+
case "ucs2":
|
|
202
|
+
case "ucs-2":
|
|
203
|
+
case "utf16le":
|
|
204
|
+
case "utf-16le": return xe(this, t, n);
|
|
205
|
+
default:
|
|
206
|
+
if (r) throw TypeError("Unknown encoding: " + e);
|
|
207
|
+
e = (e + "").toLowerCase(), r = !0;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
_.prototype._isBuffer = !0;
|
|
211
|
+
function w(e, t, n) {
|
|
212
|
+
var r = e[t];
|
|
213
|
+
e[t] = e[n], e[n] = r;
|
|
214
|
+
}
|
|
215
|
+
_.prototype.swap16 = function() {
|
|
216
|
+
var e = this.length;
|
|
217
|
+
if (e % 2 != 0) throw RangeError("Buffer size must be a multiple of 16-bits");
|
|
218
|
+
for (var t = 0; t < e; t += 2) w(this, t, t + 1);
|
|
219
|
+
return this;
|
|
220
|
+
}, _.prototype.swap32 = function() {
|
|
221
|
+
var e = this.length;
|
|
222
|
+
if (e % 4 != 0) throw RangeError("Buffer size must be a multiple of 32-bits");
|
|
223
|
+
for (var t = 0; t < e; t += 4) w(this, t, t + 3), w(this, t + 1, t + 2);
|
|
224
|
+
return this;
|
|
225
|
+
}, _.prototype.swap64 = function() {
|
|
226
|
+
var e = this.length;
|
|
227
|
+
if (e % 8 != 0) throw RangeError("Buffer size must be a multiple of 64-bits");
|
|
228
|
+
for (var t = 0; t < e; t += 8) w(this, t, t + 7), w(this, t + 1, t + 6), w(this, t + 2, t + 5), w(this, t + 3, t + 4);
|
|
229
|
+
return this;
|
|
230
|
+
}, _.prototype.toString = function() {
|
|
231
|
+
var e = this.length | 0;
|
|
232
|
+
return e === 0 ? "" : arguments.length === 0 ? he(this, 0, e) : ae.apply(this, arguments);
|
|
233
|
+
}, _.prototype.equals = function(e) {
|
|
234
|
+
if (!C(e)) throw TypeError("Argument must be a Buffer");
|
|
235
|
+
return this === e ? !0 : _.compare(this, e) === 0;
|
|
236
|
+
}, _.prototype.inspect = function() {
|
|
237
|
+
var e = "", t = m;
|
|
238
|
+
return this.length > 0 && (e = this.toString("hex", 0, t).match(/.{2}/g).join(" "), this.length > t && (e += " ... ")), "<Buffer " + e + ">";
|
|
239
|
+
}, _.prototype.compare = function(e, t, n, r, i) {
|
|
240
|
+
if (!C(e)) throw TypeError("Argument must be a Buffer");
|
|
241
|
+
if (t === void 0 && (t = 0), n === void 0 && (n = e ? e.length : 0), r === void 0 && (r = 0), i === void 0 && (i = this.length), t < 0 || n > e.length || r < 0 || i > this.length) throw RangeError("out of range index");
|
|
242
|
+
if (r >= i && t >= n) return 0;
|
|
243
|
+
if (r >= i) return -1;
|
|
244
|
+
if (t >= n) return 1;
|
|
245
|
+
if (t >>>= 0, n >>>= 0, r >>>= 0, i >>>= 0, this === e) return 0;
|
|
246
|
+
for (var a = i - r, o = n - t, s = Math.min(a, o), c = this.slice(r, i), l = e.slice(t, n), u = 0; u < s; ++u) if (c[u] !== l[u]) {
|
|
247
|
+
a = c[u], o = l[u];
|
|
248
|
+
break;
|
|
249
|
+
}
|
|
250
|
+
return a < o ? -1 : o < a ? 1 : 0;
|
|
251
|
+
};
|
|
252
|
+
function oe(e, t, n, r, i) {
|
|
253
|
+
if (e.length === 0) return -1;
|
|
254
|
+
if (typeof n == "string" ? (r = n, n = 0) : n > 2147483647 ? n = 2147483647 : n < -2147483648 && (n = -2147483648), n = +n, isNaN(n) && (n = i ? 0 : e.length - 1), n < 0 && (n = e.length + n), n >= e.length) {
|
|
255
|
+
if (i) return -1;
|
|
256
|
+
n = e.length - 1;
|
|
257
|
+
} else if (n < 0) if (i) n = 0;
|
|
258
|
+
else return -1;
|
|
259
|
+
if (typeof t == "string" && (t = _.from(t, r)), C(t)) return t.length === 0 ? -1 : se(e, t, n, r, i);
|
|
260
|
+
if (typeof t == "number") return t &= 255, _.TYPED_ARRAY_SUPPORT && typeof Uint8Array.prototype.indexOf == "function" ? i ? Uint8Array.prototype.indexOf.call(e, t, n) : Uint8Array.prototype.lastIndexOf.call(e, t, n) : se(e, [t], n, r, i);
|
|
261
|
+
throw TypeError("val must be string, number or Buffer");
|
|
262
|
+
}
|
|
263
|
+
function se(e, t, n, r, i) {
|
|
264
|
+
var a = 1, o = e.length, s = t.length;
|
|
265
|
+
if (r !== void 0 && (r = String(r).toLowerCase(), r === "ucs2" || r === "ucs-2" || r === "utf16le" || r === "utf-16le")) {
|
|
266
|
+
if (e.length < 2 || t.length < 2) return -1;
|
|
267
|
+
a = 2, o /= 2, s /= 2, n /= 2;
|
|
268
|
+
}
|
|
269
|
+
function c(e, t) {
|
|
270
|
+
return a === 1 ? e[t] : e.readUInt16BE(t * a);
|
|
271
|
+
}
|
|
272
|
+
var l;
|
|
273
|
+
if (i) {
|
|
274
|
+
var u = -1;
|
|
275
|
+
for (l = n; l < o; l++) if (c(e, l) === c(t, u === -1 ? 0 : l - u)) {
|
|
276
|
+
if (u === -1 && (u = l), l - u + 1 === s) return u * a;
|
|
277
|
+
} else u !== -1 && (l -= l - u), u = -1;
|
|
278
|
+
} else for (n + s > o && (n = o - s), l = n; l >= 0; l--) {
|
|
279
|
+
for (var d = !0, f = 0; f < s; f++) if (c(e, l + f) !== c(t, f)) {
|
|
280
|
+
d = !1;
|
|
281
|
+
break;
|
|
282
|
+
}
|
|
283
|
+
if (d) return l;
|
|
284
|
+
}
|
|
285
|
+
return -1;
|
|
286
|
+
}
|
|
287
|
+
_.prototype.includes = function(e, t, n) {
|
|
288
|
+
return this.indexOf(e, t, n) !== -1;
|
|
289
|
+
}, _.prototype.indexOf = function(e, t, n) {
|
|
290
|
+
return oe(this, e, t, n, !0);
|
|
291
|
+
}, _.prototype.lastIndexOf = function(e, t, n) {
|
|
292
|
+
return oe(this, e, t, n, !1);
|
|
293
|
+
};
|
|
294
|
+
function ce(e, t, n, r) {
|
|
295
|
+
n = Number(n) || 0;
|
|
296
|
+
var i = e.length - n;
|
|
297
|
+
r ? (r = Number(r), r > i && (r = i)) : r = i;
|
|
298
|
+
var a = t.length;
|
|
299
|
+
if (a % 2 != 0) throw TypeError("Invalid hex string");
|
|
300
|
+
r > a / 2 && (r = a / 2);
|
|
301
|
+
for (var o = 0; o < r; ++o) {
|
|
302
|
+
var s = parseInt(t.substr(o * 2, 2), 16);
|
|
303
|
+
if (isNaN(s)) return o;
|
|
304
|
+
e[n + o] = s;
|
|
305
|
+
}
|
|
306
|
+
return o;
|
|
307
|
+
}
|
|
308
|
+
function le(e, t, n, r) {
|
|
309
|
+
return Pe(Ae(t, e.length - n), e, n, r);
|
|
310
|
+
}
|
|
311
|
+
function ue(e, t, n, r) {
|
|
312
|
+
return Pe(je(t), e, n, r);
|
|
313
|
+
}
|
|
314
|
+
function de(e, t, n, r) {
|
|
315
|
+
return ue(e, t, n, r);
|
|
316
|
+
}
|
|
317
|
+
function fe(e, t, n, r) {
|
|
318
|
+
return Pe(Ne(t), e, n, r);
|
|
319
|
+
}
|
|
320
|
+
function pe(e, t, n, r) {
|
|
321
|
+
return Pe(Me(t, e.length - n), e, n, r);
|
|
322
|
+
}
|
|
323
|
+
_.prototype.write = function(e, t, n, r) {
|
|
324
|
+
if (t === void 0) r = "utf8", n = this.length, t = 0;
|
|
325
|
+
else if (n === void 0 && typeof t == "string") r = t, n = this.length, t = 0;
|
|
326
|
+
else if (isFinite(t)) t |= 0, isFinite(n) ? (n |= 0, r === void 0 && (r = "utf8")) : (r = n, n = void 0);
|
|
327
|
+
else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");
|
|
328
|
+
var i = this.length - t;
|
|
329
|
+
if ((n === void 0 || n > i) && (n = i), e.length > 0 && (n < 0 || t < 0) || t > this.length) throw RangeError("Attempt to write outside buffer bounds");
|
|
330
|
+
r ||= "utf8";
|
|
331
|
+
for (var a = !1;;) switch (r) {
|
|
332
|
+
case "hex": return ce(this, e, t, n);
|
|
333
|
+
case "utf8":
|
|
334
|
+
case "utf-8": return le(this, e, t, n);
|
|
335
|
+
case "ascii": return ue(this, e, t, n);
|
|
336
|
+
case "latin1":
|
|
337
|
+
case "binary": return de(this, e, t, n);
|
|
338
|
+
case "base64": return fe(this, e, t, n);
|
|
339
|
+
case "ucs2":
|
|
340
|
+
case "ucs-2":
|
|
341
|
+
case "utf16le":
|
|
342
|
+
case "utf-16le": return pe(this, e, t, n);
|
|
343
|
+
default:
|
|
344
|
+
if (a) throw TypeError("Unknown encoding: " + r);
|
|
345
|
+
r = ("" + r).toLowerCase(), a = !0;
|
|
346
|
+
}
|
|
347
|
+
}, _.prototype.toJSON = function() {
|
|
348
|
+
return {
|
|
349
|
+
type: "Buffer",
|
|
350
|
+
data: Array.prototype.slice.call(this._arr || this, 0)
|
|
351
|
+
};
|
|
352
|
+
};
|
|
353
|
+
function me(e, t, n) {
|
|
354
|
+
return t === 0 && n === e.length ? l(e) : l(e.slice(t, n));
|
|
355
|
+
}
|
|
356
|
+
function he(e, t, n) {
|
|
357
|
+
n = Math.min(e.length, n);
|
|
358
|
+
for (var r = [], i = t; i < n;) {
|
|
359
|
+
var a = e[i], o = null, s = a > 239 ? 4 : a > 223 ? 3 : a > 191 ? 2 : 1;
|
|
360
|
+
if (i + s <= n) {
|
|
361
|
+
var c, l, u, d;
|
|
362
|
+
switch (s) {
|
|
363
|
+
case 1:
|
|
364
|
+
a < 128 && (o = a);
|
|
365
|
+
break;
|
|
366
|
+
case 2:
|
|
367
|
+
c = e[i + 1], (c & 192) == 128 && (d = (a & 31) << 6 | c & 63, d > 127 && (o = d));
|
|
368
|
+
break;
|
|
369
|
+
case 3:
|
|
370
|
+
c = e[i + 1], l = e[i + 2], (c & 192) == 128 && (l & 192) == 128 && (d = (a & 15) << 12 | (c & 63) << 6 | l & 63, d > 2047 && (d < 55296 || d > 57343) && (o = d));
|
|
371
|
+
break;
|
|
372
|
+
case 4: c = e[i + 1], l = e[i + 2], u = e[i + 3], (c & 192) == 128 && (l & 192) == 128 && (u & 192) == 128 && (d = (a & 15) << 18 | (c & 63) << 12 | (l & 63) << 6 | u & 63, d > 65535 && d < 1114112 && (o = d));
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
o === null ? (o = 65533, s = 1) : o > 65535 && (o -= 65536, r.push(o >>> 10 & 1023 | 55296), o = 56320 | o & 1023), r.push(o), i += s;
|
|
376
|
+
}
|
|
377
|
+
return _e(r);
|
|
378
|
+
}
|
|
379
|
+
var ge = 4096;
|
|
380
|
+
function _e(e) {
|
|
381
|
+
var t = e.length;
|
|
382
|
+
if (t <= ge) return String.fromCharCode.apply(String, e);
|
|
383
|
+
for (var n = "", r = 0; r < t;) n += String.fromCharCode.apply(String, e.slice(r, r += ge));
|
|
384
|
+
return n;
|
|
385
|
+
}
|
|
386
|
+
function ve(e, t, n) {
|
|
387
|
+
var r = "";
|
|
388
|
+
n = Math.min(e.length, n);
|
|
389
|
+
for (var i = t; i < n; ++i) r += String.fromCharCode(e[i] & 127);
|
|
390
|
+
return r;
|
|
391
|
+
}
|
|
392
|
+
function ye(e, t, n) {
|
|
393
|
+
var r = "";
|
|
394
|
+
n = Math.min(e.length, n);
|
|
395
|
+
for (var i = t; i < n; ++i) r += String.fromCharCode(e[i]);
|
|
396
|
+
return r;
|
|
397
|
+
}
|
|
398
|
+
function be(e, t, n) {
|
|
399
|
+
var r = e.length;
|
|
400
|
+
(!t || t < 0) && (t = 0), (!n || n < 0 || n > r) && (n = r);
|
|
401
|
+
for (var i = "", a = t; a < n; ++a) i += ke(e[a]);
|
|
402
|
+
return i;
|
|
403
|
+
}
|
|
404
|
+
function xe(e, t, n) {
|
|
405
|
+
for (var r = e.slice(t, n), i = "", a = 0; a < r.length; a += 2) i += String.fromCharCode(r[a] + r[a + 1] * 256);
|
|
406
|
+
return i;
|
|
407
|
+
}
|
|
408
|
+
_.prototype.slice = function(e, t) {
|
|
409
|
+
var n = this.length;
|
|
410
|
+
e = ~~e, t = t === void 0 ? n : ~~t, e < 0 ? (e += n, e < 0 && (e = 0)) : e > n && (e = n), t < 0 ? (t += n, t < 0 && (t = 0)) : t > n && (t = n), t < e && (t = e);
|
|
411
|
+
var r;
|
|
412
|
+
if (_.TYPED_ARRAY_SUPPORT) r = this.subarray(e, t), r.__proto__ = _.prototype;
|
|
413
|
+
else {
|
|
414
|
+
var i = t - e;
|
|
415
|
+
r = new _(i, void 0);
|
|
416
|
+
for (var a = 0; a < i; ++a) r[a] = this[a + e];
|
|
417
|
+
}
|
|
418
|
+
return r;
|
|
419
|
+
};
|
|
420
|
+
function T(e, t, n) {
|
|
421
|
+
if (e % 1 != 0 || e < 0) throw RangeError("offset is not uint");
|
|
422
|
+
if (e + t > n) throw RangeError("Trying to access beyond buffer length");
|
|
423
|
+
}
|
|
424
|
+
_.prototype.readUIntLE = function(e, t, n) {
|
|
425
|
+
e |= 0, t |= 0, n || T(e, t, this.length);
|
|
426
|
+
for (var r = this[e], i = 1, a = 0; ++a < t && (i *= 256);) r += this[e + a] * i;
|
|
427
|
+
return r;
|
|
428
|
+
}, _.prototype.readUIntBE = function(e, t, n) {
|
|
429
|
+
e |= 0, t |= 0, n || T(e, t, this.length);
|
|
430
|
+
for (var r = this[e + --t], i = 1; t > 0 && (i *= 256);) r += this[e + --t] * i;
|
|
431
|
+
return r;
|
|
432
|
+
}, _.prototype.readUInt8 = function(e, t) {
|
|
433
|
+
return t || T(e, 1, this.length), this[e];
|
|
434
|
+
}, _.prototype.readUInt16LE = function(e, t) {
|
|
435
|
+
return t || T(e, 2, this.length), this[e] | this[e + 1] << 8;
|
|
436
|
+
}, _.prototype.readUInt16BE = function(e, t) {
|
|
437
|
+
return t || T(e, 2, this.length), this[e] << 8 | this[e + 1];
|
|
438
|
+
}, _.prototype.readUInt32LE = function(e, t) {
|
|
439
|
+
return t || T(e, 4, this.length), (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + this[e + 3] * 16777216;
|
|
440
|
+
}, _.prototype.readUInt32BE = function(e, t) {
|
|
441
|
+
return t || T(e, 4, this.length), this[e] * 16777216 + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]);
|
|
442
|
+
}, _.prototype.readIntLE = function(e, t, n) {
|
|
443
|
+
e |= 0, t |= 0, n || T(e, t, this.length);
|
|
444
|
+
for (var r = this[e], i = 1, a = 0; ++a < t && (i *= 256);) r += this[e + a] * i;
|
|
445
|
+
return i *= 128, r >= i && (r -= 2 ** (8 * t)), r;
|
|
446
|
+
}, _.prototype.readIntBE = function(e, t, n) {
|
|
447
|
+
e |= 0, t |= 0, n || T(e, t, this.length);
|
|
448
|
+
for (var r = t, i = 1, a = this[e + --r]; r > 0 && (i *= 256);) a += this[e + --r] * i;
|
|
449
|
+
return i *= 128, a >= i && (a -= 2 ** (8 * t)), a;
|
|
450
|
+
}, _.prototype.readInt8 = function(e, t) {
|
|
451
|
+
return t || T(e, 1, this.length), this[e] & 128 ? (255 - this[e] + 1) * -1 : this[e];
|
|
452
|
+
}, _.prototype.readInt16LE = function(e, t) {
|
|
453
|
+
t || T(e, 2, this.length);
|
|
454
|
+
var n = this[e] | this[e + 1] << 8;
|
|
455
|
+
return n & 32768 ? n | 4294901760 : n;
|
|
456
|
+
}, _.prototype.readInt16BE = function(e, t) {
|
|
457
|
+
t || T(e, 2, this.length);
|
|
458
|
+
var n = this[e + 1] | this[e] << 8;
|
|
459
|
+
return n & 32768 ? n | 4294901760 : n;
|
|
460
|
+
}, _.prototype.readInt32LE = function(e, t) {
|
|
461
|
+
return t || T(e, 4, this.length), this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24;
|
|
462
|
+
}, _.prototype.readInt32BE = function(e, t) {
|
|
463
|
+
return t || T(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3];
|
|
464
|
+
}, _.prototype.readFloatLE = function(e, t) {
|
|
465
|
+
return t || T(e, 4, this.length), u(this, e, !0, 23, 4);
|
|
466
|
+
}, _.prototype.readFloatBE = function(e, t) {
|
|
467
|
+
return t || T(e, 4, this.length), u(this, e, !1, 23, 4);
|
|
468
|
+
}, _.prototype.readDoubleLE = function(e, t) {
|
|
469
|
+
return t || T(e, 8, this.length), u(this, e, !0, 52, 8);
|
|
470
|
+
}, _.prototype.readDoubleBE = function(e, t) {
|
|
471
|
+
return t || T(e, 8, this.length), u(this, e, !1, 52, 8);
|
|
472
|
+
};
|
|
473
|
+
function E(e, t, n, r, i, a) {
|
|
474
|
+
if (!C(e)) throw TypeError("\"buffer\" argument must be a Buffer instance");
|
|
475
|
+
if (t > i || t < a) throw RangeError("\"value\" argument is out of bounds");
|
|
476
|
+
if (n + r > e.length) throw RangeError("Index out of range");
|
|
477
|
+
}
|
|
478
|
+
_.prototype.writeUIntLE = function(e, t, n, r) {
|
|
479
|
+
if (e = +e, t |= 0, n |= 0, !r) {
|
|
480
|
+
var i = 2 ** (8 * n) - 1;
|
|
481
|
+
E(this, e, t, n, i, 0);
|
|
482
|
+
}
|
|
483
|
+
var a = 1, o = 0;
|
|
484
|
+
for (this[t] = e & 255; ++o < n && (a *= 256);) this[t + o] = e / a & 255;
|
|
485
|
+
return t + n;
|
|
486
|
+
}, _.prototype.writeUIntBE = function(e, t, n, r) {
|
|
487
|
+
if (e = +e, t |= 0, n |= 0, !r) {
|
|
488
|
+
var i = 2 ** (8 * n) - 1;
|
|
489
|
+
E(this, e, t, n, i, 0);
|
|
490
|
+
}
|
|
491
|
+
var a = n - 1, o = 1;
|
|
492
|
+
for (this[t + a] = e & 255; --a >= 0 && (o *= 256);) this[t + a] = e / o & 255;
|
|
493
|
+
return t + n;
|
|
494
|
+
}, _.prototype.writeUInt8 = function(e, t, n) {
|
|
495
|
+
return e = +e, t |= 0, n || E(this, e, t, 1, 255, 0), _.TYPED_ARRAY_SUPPORT || (e = Math.floor(e)), this[t] = e & 255, t + 1;
|
|
496
|
+
};
|
|
497
|
+
function Se(e, t, n, r) {
|
|
498
|
+
t < 0 && (t = 65535 + t + 1);
|
|
499
|
+
for (var i = 0, a = Math.min(e.length - n, 2); i < a; ++i) e[n + i] = (t & 255 << 8 * (r ? i : 1 - i)) >>> (r ? i : 1 - i) * 8;
|
|
500
|
+
}
|
|
501
|
+
_.prototype.writeUInt16LE = function(e, t, n) {
|
|
502
|
+
return e = +e, t |= 0, n || E(this, e, t, 2, 65535, 0), _.TYPED_ARRAY_SUPPORT ? (this[t] = e & 255, this[t + 1] = e >>> 8) : Se(this, e, t, !0), t + 2;
|
|
503
|
+
}, _.prototype.writeUInt16BE = function(e, t, n) {
|
|
504
|
+
return e = +e, t |= 0, n || E(this, e, t, 2, 65535, 0), _.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 8, this[t + 1] = e & 255) : Se(this, e, t, !1), t + 2;
|
|
505
|
+
};
|
|
506
|
+
function D(e, t, n, r) {
|
|
507
|
+
t < 0 && (t = 4294967295 + t + 1);
|
|
508
|
+
for (var i = 0, a = Math.min(e.length - n, 4); i < a; ++i) e[n + i] = t >>> (r ? i : 3 - i) * 8 & 255;
|
|
509
|
+
}
|
|
510
|
+
_.prototype.writeUInt32LE = function(e, t, n) {
|
|
511
|
+
return e = +e, t |= 0, n || E(this, e, t, 4, 4294967295, 0), _.TYPED_ARRAY_SUPPORT ? (this[t + 3] = e >>> 24, this[t + 2] = e >>> 16, this[t + 1] = e >>> 8, this[t] = e & 255) : D(this, e, t, !0), t + 4;
|
|
512
|
+
}, _.prototype.writeUInt32BE = function(e, t, n) {
|
|
513
|
+
return e = +e, t |= 0, n || E(this, e, t, 4, 4294967295, 0), _.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = e & 255) : D(this, e, t, !1), t + 4;
|
|
514
|
+
}, _.prototype.writeIntLE = function(e, t, n, r) {
|
|
515
|
+
if (e = +e, t |= 0, !r) {
|
|
516
|
+
var i = 2 ** (8 * n - 1);
|
|
517
|
+
E(this, e, t, n, i - 1, -i);
|
|
518
|
+
}
|
|
519
|
+
var a = 0, o = 1, s = 0;
|
|
520
|
+
for (this[t] = e & 255; ++a < n && (o *= 256);) e < 0 && s === 0 && this[t + a - 1] !== 0 && (s = 1), this[t + a] = (e / o >> 0) - s & 255;
|
|
521
|
+
return t + n;
|
|
522
|
+
}, _.prototype.writeIntBE = function(e, t, n, r) {
|
|
523
|
+
if (e = +e, t |= 0, !r) {
|
|
524
|
+
var i = 2 ** (8 * n - 1);
|
|
525
|
+
E(this, e, t, n, i - 1, -i);
|
|
526
|
+
}
|
|
527
|
+
var a = n - 1, o = 1, s = 0;
|
|
528
|
+
for (this[t + a] = e & 255; --a >= 0 && (o *= 256);) e < 0 && s === 0 && this[t + a + 1] !== 0 && (s = 1), this[t + a] = (e / o >> 0) - s & 255;
|
|
529
|
+
return t + n;
|
|
530
|
+
}, _.prototype.writeInt8 = function(e, t, n) {
|
|
531
|
+
return e = +e, t |= 0, n || E(this, e, t, 1, 127, -128), _.TYPED_ARRAY_SUPPORT || (e = Math.floor(e)), e < 0 && (e = 255 + e + 1), this[t] = e & 255, t + 1;
|
|
532
|
+
}, _.prototype.writeInt16LE = function(e, t, n) {
|
|
533
|
+
return e = +e, t |= 0, n || E(this, e, t, 2, 32767, -32768), _.TYPED_ARRAY_SUPPORT ? (this[t] = e & 255, this[t + 1] = e >>> 8) : Se(this, e, t, !0), t + 2;
|
|
534
|
+
}, _.prototype.writeInt16BE = function(e, t, n) {
|
|
535
|
+
return e = +e, t |= 0, n || E(this, e, t, 2, 32767, -32768), _.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 8, this[t + 1] = e & 255) : Se(this, e, t, !1), t + 2;
|
|
536
|
+
}, _.prototype.writeInt32LE = function(e, t, n) {
|
|
537
|
+
return e = +e, t |= 0, n || E(this, e, t, 4, 2147483647, -2147483648), _.TYPED_ARRAY_SUPPORT ? (this[t] = e & 255, this[t + 1] = e >>> 8, this[t + 2] = e >>> 16, this[t + 3] = e >>> 24) : D(this, e, t, !0), t + 4;
|
|
538
|
+
}, _.prototype.writeInt32BE = function(e, t, n) {
|
|
539
|
+
return e = +e, t |= 0, n || E(this, e, t, 4, 2147483647, -2147483648), e < 0 && (e = 4294967295 + e + 1), _.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = e & 255) : D(this, e, t, !1), t + 4;
|
|
540
|
+
};
|
|
541
|
+
function Ce(e, t, n, r, i, a) {
|
|
542
|
+
if (n + r > e.length || n < 0) throw RangeError("Index out of range");
|
|
543
|
+
}
|
|
544
|
+
function we(e, t, n, r, i) {
|
|
545
|
+
return i || Ce(e, t, n, 4), d(e, t, n, r, 23, 4), n + 4;
|
|
546
|
+
}
|
|
547
|
+
_.prototype.writeFloatLE = function(e, t, n) {
|
|
548
|
+
return we(this, e, t, !0, n);
|
|
549
|
+
}, _.prototype.writeFloatBE = function(e, t, n) {
|
|
550
|
+
return we(this, e, t, !1, n);
|
|
551
|
+
};
|
|
552
|
+
function Te(e, t, n, r, i) {
|
|
553
|
+
return i || Ce(e, t, n, 8), d(e, t, n, r, 52, 8), n + 8;
|
|
554
|
+
}
|
|
555
|
+
_.prototype.writeDoubleLE = function(e, t, n) {
|
|
556
|
+
return Te(this, e, t, !0, n);
|
|
557
|
+
}, _.prototype.writeDoubleBE = function(e, t, n) {
|
|
558
|
+
return Te(this, e, t, !1, n);
|
|
559
|
+
}, _.prototype.copy = function(e, t, n, r) {
|
|
560
|
+
if (n ||= 0, !r && r !== 0 && (r = this.length), t >= e.length && (t = e.length), t ||= 0, r > 0 && r < n && (r = n), r === n || e.length === 0 || this.length === 0) return 0;
|
|
561
|
+
if (t < 0) throw RangeError("targetStart out of bounds");
|
|
562
|
+
if (n < 0 || n >= this.length) throw RangeError("sourceStart out of bounds");
|
|
563
|
+
if (r < 0) throw RangeError("sourceEnd out of bounds");
|
|
564
|
+
r > this.length && (r = this.length), e.length - t < r - n && (r = e.length - t + n);
|
|
565
|
+
var i = r - n, a;
|
|
566
|
+
if (this === e && n < t && t < r) for (a = i - 1; a >= 0; --a) e[a + t] = this[a + n];
|
|
567
|
+
else if (i < 1e3 || !_.TYPED_ARRAY_SUPPORT) for (a = 0; a < i; ++a) e[a + t] = this[a + n];
|
|
568
|
+
else Uint8Array.prototype.set.call(e, this.subarray(n, n + i), t);
|
|
569
|
+
return i;
|
|
570
|
+
}, _.prototype.fill = function(e, t, n, r) {
|
|
571
|
+
if (typeof e == "string") {
|
|
572
|
+
if (typeof t == "string" ? (r = t, t = 0, n = this.length) : typeof n == "string" && (r = n, n = this.length), e.length === 1) {
|
|
573
|
+
var i = e.charCodeAt(0);
|
|
574
|
+
i < 256 && (e = i);
|
|
575
|
+
}
|
|
576
|
+
if (r !== void 0 && typeof r != "string") throw TypeError("encoding must be a string");
|
|
577
|
+
if (typeof r == "string" && !_.isEncoding(r)) throw TypeError("Unknown encoding: " + r);
|
|
578
|
+
} else typeof e == "number" && (e &= 255);
|
|
579
|
+
if (t < 0 || this.length < t || this.length < n) throw RangeError("Out of range index");
|
|
580
|
+
if (n <= t) return this;
|
|
581
|
+
t >>>= 0, n = n === void 0 ? this.length : n >>> 0, e ||= 0;
|
|
582
|
+
var a;
|
|
583
|
+
if (typeof e == "number") for (a = t; a < n; ++a) this[a] = e;
|
|
584
|
+
else {
|
|
585
|
+
var o = C(e) ? e : Ae(new _(e, r).toString()), s = o.length;
|
|
586
|
+
for (a = 0; a < n - t; ++a) this[a + t] = o[a % s];
|
|
587
|
+
}
|
|
588
|
+
return this;
|
|
589
|
+
};
|
|
590
|
+
var Ee = /[^+\/0-9A-Za-z-_]/g;
|
|
591
|
+
function De(e) {
|
|
592
|
+
if (e = Oe(e).replace(Ee, ""), e.length < 2) return "";
|
|
593
|
+
for (; e.length % 4 != 0;) e += "=";
|
|
594
|
+
return e;
|
|
595
|
+
}
|
|
596
|
+
function Oe(e) {
|
|
597
|
+
return e.trim ? e.trim() : e.replace(/^\s+|\s+$/g, "");
|
|
598
|
+
}
|
|
599
|
+
function ke(e) {
|
|
600
|
+
return e < 16 ? "0" + e.toString(16) : e.toString(16);
|
|
601
|
+
}
|
|
602
|
+
function Ae(e, t) {
|
|
603
|
+
t ||= Infinity;
|
|
604
|
+
for (var n, r = e.length, i = null, a = [], o = 0; o < r; ++o) {
|
|
605
|
+
if (n = e.charCodeAt(o), n > 55295 && n < 57344) {
|
|
606
|
+
if (!i) {
|
|
607
|
+
if (n > 56319) {
|
|
608
|
+
(t -= 3) > -1 && a.push(239, 191, 189);
|
|
609
|
+
continue;
|
|
610
|
+
} else if (o + 1 === r) {
|
|
611
|
+
(t -= 3) > -1 && a.push(239, 191, 189);
|
|
612
|
+
continue;
|
|
613
|
+
}
|
|
614
|
+
i = n;
|
|
615
|
+
continue;
|
|
616
|
+
}
|
|
617
|
+
if (n < 56320) {
|
|
618
|
+
(t -= 3) > -1 && a.push(239, 191, 189), i = n;
|
|
619
|
+
continue;
|
|
620
|
+
}
|
|
621
|
+
n = (i - 55296 << 10 | n - 56320) + 65536;
|
|
622
|
+
} else i && (t -= 3) > -1 && a.push(239, 191, 189);
|
|
623
|
+
if (i = null, n < 128) {
|
|
624
|
+
if (--t < 0) break;
|
|
625
|
+
a.push(n);
|
|
626
|
+
} else if (n < 2048) {
|
|
627
|
+
if ((t -= 2) < 0) break;
|
|
628
|
+
a.push(n >> 6 | 192, n & 63 | 128);
|
|
629
|
+
} else if (n < 65536) {
|
|
630
|
+
if ((t -= 3) < 0) break;
|
|
631
|
+
a.push(n >> 12 | 224, n >> 6 & 63 | 128, n & 63 | 128);
|
|
632
|
+
} else if (n < 1114112) {
|
|
633
|
+
if ((t -= 4) < 0) break;
|
|
634
|
+
a.push(n >> 18 | 240, n >> 12 & 63 | 128, n >> 6 & 63 | 128, n & 63 | 128);
|
|
635
|
+
} else throw Error("Invalid code point");
|
|
636
|
+
}
|
|
637
|
+
return a;
|
|
638
|
+
}
|
|
639
|
+
function je(e) {
|
|
640
|
+
for (var t = [], n = 0; n < e.length; ++n) t.push(e.charCodeAt(n) & 255);
|
|
641
|
+
return t;
|
|
642
|
+
}
|
|
643
|
+
function Me(e, t) {
|
|
644
|
+
for (var n, r, i, a = [], o = 0; o < e.length && !((t -= 2) < 0); ++o) n = e.charCodeAt(o), r = n >> 8, i = n % 256, a.push(i), a.push(r);
|
|
645
|
+
return a;
|
|
646
|
+
}
|
|
647
|
+
function Ne(e) {
|
|
648
|
+
return o(De(e));
|
|
649
|
+
}
|
|
650
|
+
function Pe(e, t, n, r) {
|
|
651
|
+
for (var i = 0; i < r && !(i + n >= t.length || i >= e.length); ++i) t[i + n] = e[i];
|
|
652
|
+
return i;
|
|
653
|
+
}
|
|
654
|
+
function Fe(e) {
|
|
655
|
+
return e !== e;
|
|
656
|
+
}
|
|
657
|
+
function O(e) {
|
|
658
|
+
return e != null && (!!e._isBuffer || Ie(e) || Le(e));
|
|
659
|
+
}
|
|
660
|
+
function Ie(e) {
|
|
661
|
+
return !!e.constructor && typeof e.constructor.isBuffer == "function" && e.constructor.isBuffer(e);
|
|
662
|
+
}
|
|
663
|
+
function Le(e) {
|
|
664
|
+
return typeof e.readFloatLE == "function" && typeof e.slice == "function" && Ie(e.slice(0, 0));
|
|
665
|
+
}
|
|
666
|
+
var Re;
|
|
667
|
+
function k() {}
|
|
668
|
+
k.prototype = Object.create(null);
|
|
669
|
+
function A() {
|
|
670
|
+
A.init.call(this);
|
|
671
|
+
}
|
|
672
|
+
A.EventEmitter = A, A.usingDomains = !1, A.prototype.domain = void 0, A.prototype._events = void 0, A.prototype._maxListeners = void 0, A.defaultMaxListeners = 10, A.init = function() {
|
|
673
|
+
this.domain = null, A.usingDomains && Re.active && !(this instanceof Re.Domain) && (this.domain = Re.active), (!this._events || this._events === Object.getPrototypeOf(this)._events) && (this._events = new k(), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
|
|
674
|
+
}, A.prototype.setMaxListeners = function(e) {
|
|
675
|
+
if (typeof e != "number" || e < 0 || isNaN(e)) throw TypeError("\"n\" argument must be a positive number");
|
|
676
|
+
return this._maxListeners = e, this;
|
|
677
|
+
};
|
|
678
|
+
function ze(e) {
|
|
679
|
+
return e._maxListeners === void 0 ? A.defaultMaxListeners : e._maxListeners;
|
|
680
|
+
}
|
|
681
|
+
A.prototype.getMaxListeners = function() {
|
|
682
|
+
return ze(this);
|
|
683
|
+
};
|
|
684
|
+
function Be(e, t, n) {
|
|
685
|
+
if (t) e.call(n);
|
|
686
|
+
else for (var r = e.length, i = j(e, r), a = 0; a < r; ++a) i[a].call(n);
|
|
687
|
+
}
|
|
688
|
+
function Ve(e, t, n, r) {
|
|
689
|
+
if (t) e.call(n, r);
|
|
690
|
+
else for (var i = e.length, a = j(e, i), o = 0; o < i; ++o) a[o].call(n, r);
|
|
691
|
+
}
|
|
692
|
+
function He(e, t, n, r, i) {
|
|
693
|
+
if (t) e.call(n, r, i);
|
|
694
|
+
else for (var a = e.length, o = j(e, a), s = 0; s < a; ++s) o[s].call(n, r, i);
|
|
695
|
+
}
|
|
696
|
+
function Ue(e, t, n, r, i, a) {
|
|
697
|
+
if (t) e.call(n, r, i, a);
|
|
698
|
+
else for (var o = e.length, s = j(e, o), c = 0; c < o; ++c) s[c].call(n, r, i, a);
|
|
699
|
+
}
|
|
700
|
+
function We(e, t, n, r) {
|
|
701
|
+
if (t) e.apply(n, r);
|
|
702
|
+
else for (var i = e.length, a = j(e, i), o = 0; o < i; ++o) a[o].apply(n, r);
|
|
703
|
+
}
|
|
704
|
+
A.prototype.emit = function(e) {
|
|
705
|
+
var t, n, r, i, a, o, s, c = e === "error";
|
|
706
|
+
if (o = this._events, o) c &&= o.error == null;
|
|
707
|
+
else if (!c) return !1;
|
|
708
|
+
if (s = this.domain, c) {
|
|
709
|
+
if (t = arguments[1], s) t ||= /* @__PURE__ */ Error("Uncaught, unspecified \"error\" event"), t.domainEmitter = this, t.domain = s, t.domainThrown = !1, s.emit("error", t);
|
|
710
|
+
else if (t instanceof Error) throw t;
|
|
711
|
+
else {
|
|
712
|
+
var l = /* @__PURE__ */ Error("Uncaught, unspecified \"error\" event. (" + t + ")");
|
|
713
|
+
throw l.context = t, l;
|
|
714
|
+
}
|
|
715
|
+
return !1;
|
|
716
|
+
}
|
|
717
|
+
if (n = o[e], !n) return !1;
|
|
718
|
+
var u = typeof n == "function";
|
|
719
|
+
switch (r = arguments.length, r) {
|
|
720
|
+
case 1:
|
|
721
|
+
Be(n, u, this);
|
|
722
|
+
break;
|
|
723
|
+
case 2:
|
|
724
|
+
Ve(n, u, this, arguments[1]);
|
|
725
|
+
break;
|
|
726
|
+
case 3:
|
|
727
|
+
He(n, u, this, arguments[1], arguments[2]);
|
|
728
|
+
break;
|
|
729
|
+
case 4:
|
|
730
|
+
Ue(n, u, this, arguments[1], arguments[2], arguments[3]);
|
|
731
|
+
break;
|
|
732
|
+
default:
|
|
733
|
+
for (i = Array(r - 1), a = 1; a < r; a++) i[a - 1] = arguments[a];
|
|
734
|
+
We(n, u, this, i);
|
|
735
|
+
}
|
|
736
|
+
return !0;
|
|
737
|
+
};
|
|
738
|
+
function Ge(e, t, n, r) {
|
|
739
|
+
var i, a, o;
|
|
740
|
+
if (typeof n != "function") throw TypeError("\"listener\" argument must be a function");
|
|
741
|
+
if (a = e._events, a ? (a.newListener && (e.emit("newListener", t, n.listener ? n.listener : n), a = e._events), o = a[t]) : (a = e._events = new k(), e._eventsCount = 0), !o) o = a[t] = n, ++e._eventsCount;
|
|
742
|
+
else if (typeof o == "function" ? o = a[t] = r ? [n, o] : [o, n] : r ? o.unshift(n) : o.push(n), !o.warned && (i = ze(e), i && i > 0 && o.length > i)) {
|
|
743
|
+
o.warned = !0;
|
|
744
|
+
var s = /* @__PURE__ */ Error("Possible EventEmitter memory leak detected. " + o.length + " " + t + " listeners added. Use emitter.setMaxListeners() to increase limit");
|
|
745
|
+
s.name = "MaxListenersExceededWarning", s.emitter = e, s.type = t, s.count = o.length, Ke(s);
|
|
746
|
+
}
|
|
747
|
+
return e;
|
|
748
|
+
}
|
|
749
|
+
function Ke(e) {
|
|
750
|
+
typeof console.warn == "function" ? console.warn(e) : console.log(e);
|
|
751
|
+
}
|
|
752
|
+
A.prototype.addListener = function(e, t) {
|
|
753
|
+
return Ge(this, e, t, !1);
|
|
754
|
+
}, A.prototype.on = A.prototype.addListener, A.prototype.prependListener = function(e, t) {
|
|
755
|
+
return Ge(this, e, t, !0);
|
|
756
|
+
};
|
|
757
|
+
function qe(e, t, n) {
|
|
758
|
+
var r = !1;
|
|
759
|
+
function i() {
|
|
760
|
+
e.removeListener(t, i), r || (r = !0, n.apply(e, arguments));
|
|
761
|
+
}
|
|
762
|
+
return i.listener = n, i;
|
|
763
|
+
}
|
|
764
|
+
A.prototype.once = function(e, t) {
|
|
765
|
+
if (typeof t != "function") throw TypeError("\"listener\" argument must be a function");
|
|
766
|
+
return this.on(e, qe(this, e, t)), this;
|
|
767
|
+
}, A.prototype.prependOnceListener = function(e, t) {
|
|
768
|
+
if (typeof t != "function") throw TypeError("\"listener\" argument must be a function");
|
|
769
|
+
return this.prependListener(e, qe(this, e, t)), this;
|
|
770
|
+
}, A.prototype.removeListener = function(e, t) {
|
|
771
|
+
var n, r, i, a, o;
|
|
772
|
+
if (typeof t != "function") throw TypeError("\"listener\" argument must be a function");
|
|
773
|
+
if (r = this._events, !r || (n = r[e], !n)) return this;
|
|
774
|
+
if (n === t || n.listener && n.listener === t) --this._eventsCount === 0 ? this._events = new k() : (delete r[e], r.removeListener && this.emit("removeListener", e, n.listener || t));
|
|
775
|
+
else if (typeof n != "function") {
|
|
776
|
+
for (i = -1, a = n.length; a-- > 0;) if (n[a] === t || n[a].listener && n[a].listener === t) {
|
|
777
|
+
o = n[a].listener, i = a;
|
|
778
|
+
break;
|
|
779
|
+
}
|
|
780
|
+
if (i < 0) return this;
|
|
781
|
+
if (n.length === 1) {
|
|
782
|
+
if (n[0] = void 0, --this._eventsCount === 0) return this._events = new k(), this;
|
|
783
|
+
delete r[e];
|
|
784
|
+
} else Ye(n, i);
|
|
785
|
+
r.removeListener && this.emit("removeListener", e, o || t);
|
|
786
|
+
}
|
|
787
|
+
return this;
|
|
788
|
+
}, A.prototype.removeAllListeners = function(e) {
|
|
789
|
+
var t, n = this._events;
|
|
790
|
+
if (!n) return this;
|
|
791
|
+
if (!n.removeListener) return arguments.length === 0 ? (this._events = new k(), this._eventsCount = 0) : n[e] && (--this._eventsCount === 0 ? this._events = new k() : delete n[e]), this;
|
|
792
|
+
if (arguments.length === 0) {
|
|
793
|
+
for (var r = Object.keys(n), i = 0, a; i < r.length; ++i) a = r[i], a !== "removeListener" && this.removeAllListeners(a);
|
|
794
|
+
return this.removeAllListeners("removeListener"), this._events = new k(), this._eventsCount = 0, this;
|
|
795
|
+
}
|
|
796
|
+
if (t = n[e], typeof t == "function") this.removeListener(e, t);
|
|
797
|
+
else if (t) do
|
|
798
|
+
this.removeListener(e, t[t.length - 1]);
|
|
799
|
+
while (t[0]);
|
|
800
|
+
return this;
|
|
801
|
+
}, A.prototype.listeners = function(e) {
|
|
802
|
+
var t, n, r = this._events;
|
|
803
|
+
return r ? (t = r[e], n = t ? typeof t == "function" ? [t.listener || t] : Xe(t) : []) : n = [], n;
|
|
804
|
+
}, A.listenerCount = function(e, t) {
|
|
805
|
+
return typeof e.listenerCount == "function" ? e.listenerCount(t) : Je.call(e, t);
|
|
806
|
+
}, A.prototype.listenerCount = Je;
|
|
807
|
+
function Je(e) {
|
|
808
|
+
var t = this._events;
|
|
809
|
+
if (t) {
|
|
810
|
+
var n = t[e];
|
|
811
|
+
if (typeof n == "function") return 1;
|
|
812
|
+
if (n) return n.length;
|
|
813
|
+
}
|
|
814
|
+
return 0;
|
|
815
|
+
}
|
|
816
|
+
A.prototype.eventNames = function() {
|
|
817
|
+
return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : [];
|
|
818
|
+
};
|
|
819
|
+
function Ye(e, t) {
|
|
820
|
+
for (var n = t, r = n + 1, i = e.length; r < i; n += 1, r += 1) e[n] = e[r];
|
|
821
|
+
e.pop();
|
|
822
|
+
}
|
|
823
|
+
function j(e, t) {
|
|
824
|
+
for (var n = Array(t); t--;) n[t] = e[t];
|
|
825
|
+
return n;
|
|
826
|
+
}
|
|
827
|
+
function Xe(e) {
|
|
828
|
+
for (var t = Array(e.length), n = 0; n < t.length; ++n) t[n] = e[n].listener || e[n];
|
|
829
|
+
return t;
|
|
830
|
+
}
|
|
831
|
+
function Ze() {
|
|
832
|
+
throw Error("setTimeout has not been defined");
|
|
833
|
+
}
|
|
834
|
+
function Qe() {
|
|
835
|
+
throw Error("clearTimeout has not been defined");
|
|
836
|
+
}
|
|
837
|
+
var M = Ze, N = Qe;
|
|
838
|
+
typeof e.setTimeout == "function" && (M = setTimeout), typeof e.clearTimeout == "function" && (N = clearTimeout);
|
|
839
|
+
function $e(e) {
|
|
840
|
+
if (M === setTimeout) return setTimeout(e, 0);
|
|
841
|
+
if ((M === Ze || !M) && setTimeout) return M = setTimeout, setTimeout(e, 0);
|
|
842
|
+
try {
|
|
843
|
+
return M(e, 0);
|
|
844
|
+
} catch {
|
|
845
|
+
try {
|
|
846
|
+
return M.call(null, e, 0);
|
|
847
|
+
} catch {
|
|
848
|
+
return M.call(this, e, 0);
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
function et(e) {
|
|
853
|
+
if (N === clearTimeout) return clearTimeout(e);
|
|
854
|
+
if ((N === Qe || !N) && clearTimeout) return N = clearTimeout, clearTimeout(e);
|
|
855
|
+
try {
|
|
856
|
+
return N(e);
|
|
857
|
+
} catch {
|
|
858
|
+
try {
|
|
859
|
+
return N.call(null, e);
|
|
860
|
+
} catch {
|
|
861
|
+
return N.call(this, e);
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
var P = [], F = !1, I, tt = -1;
|
|
866
|
+
function nt() {
|
|
867
|
+
!F || !I || (F = !1, I.length ? P = I.concat(P) : tt = -1, P.length && rt());
|
|
868
|
+
}
|
|
869
|
+
function rt() {
|
|
870
|
+
if (!F) {
|
|
871
|
+
var e = $e(nt);
|
|
872
|
+
F = !0;
|
|
873
|
+
for (var t = P.length; t;) {
|
|
874
|
+
for (I = P, P = []; ++tt < t;) I && I[tt].run();
|
|
875
|
+
tt = -1, t = P.length;
|
|
876
|
+
}
|
|
877
|
+
I = null, F = !1, et(e);
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
function L(e) {
|
|
881
|
+
var t = Array(arguments.length - 1);
|
|
882
|
+
if (arguments.length > 1) for (var n = 1; n < arguments.length; n++) t[n - 1] = arguments[n];
|
|
883
|
+
P.push(new it(e, t)), P.length === 1 && !F && $e(rt);
|
|
884
|
+
}
|
|
885
|
+
function it(e, t) {
|
|
886
|
+
this.fun = e, this.array = t;
|
|
887
|
+
}
|
|
888
|
+
it.prototype.run = function() {
|
|
889
|
+
this.fun.apply(null, this.array);
|
|
890
|
+
};
|
|
891
|
+
var at = {}, R = e.performance || {};
|
|
892
|
+
R.now || R.mozNow || R.msNow || R.oNow || R.webkitNow;
|
|
893
|
+
var ot = { env: at }, z = typeof Object.create == "function" ? function(e, t) {
|
|
894
|
+
e.super_ = t, e.prototype = Object.create(t.prototype, { constructor: {
|
|
895
|
+
value: e,
|
|
896
|
+
enumerable: !1,
|
|
897
|
+
writable: !0,
|
|
898
|
+
configurable: !0
|
|
899
|
+
} });
|
|
900
|
+
} : function(e, t) {
|
|
901
|
+
e.super_ = t;
|
|
902
|
+
var n = function() {};
|
|
903
|
+
n.prototype = t.prototype, e.prototype = new n(), e.prototype.constructor = e;
|
|
904
|
+
}, st = /%[sdj%]/g;
|
|
905
|
+
function ct(e) {
|
|
906
|
+
if (!Et(e)) {
|
|
907
|
+
for (var t = [], n = 0; n < arguments.length; n++) t.push(B(arguments[n]));
|
|
908
|
+
return t.join(" ");
|
|
909
|
+
}
|
|
910
|
+
for (var n = 1, r = arguments, i = r.length, a = String(e).replace(st, function(e) {
|
|
911
|
+
if (e === "%%") return "%";
|
|
912
|
+
if (n >= i) return e;
|
|
913
|
+
switch (e) {
|
|
914
|
+
case "%s": return String(r[n++]);
|
|
915
|
+
case "%d": return Number(r[n++]);
|
|
916
|
+
case "%j": try {
|
|
917
|
+
return JSON.stringify(r[n++]);
|
|
918
|
+
} catch {
|
|
919
|
+
return "[Circular]";
|
|
920
|
+
}
|
|
921
|
+
default: return e;
|
|
922
|
+
}
|
|
923
|
+
}), o = r[n]; n < i; o = r[++n]) wt(o) || !H(o) ? a += " " + o : a += " " + B(o);
|
|
924
|
+
return a;
|
|
925
|
+
}
|
|
926
|
+
function lt(t, n) {
|
|
927
|
+
if (V(e.process)) return function() {
|
|
928
|
+
return lt(t, n).apply(this, arguments);
|
|
929
|
+
};
|
|
930
|
+
if (ot.noDeprecation === !0) return t;
|
|
931
|
+
var r = !1;
|
|
932
|
+
function i() {
|
|
933
|
+
if (!r) {
|
|
934
|
+
if (ot.throwDeprecation) throw Error(n);
|
|
935
|
+
ot.traceDeprecation ? console.trace(n) : console.error(n), r = !0;
|
|
936
|
+
}
|
|
937
|
+
return t.apply(this, arguments);
|
|
938
|
+
}
|
|
939
|
+
return i;
|
|
940
|
+
}
|
|
941
|
+
var ut = {}, dt;
|
|
942
|
+
function ft(e) {
|
|
943
|
+
if (V(dt) && (dt = ot.env.NODE_DEBUG || ""), e = e.toUpperCase(), !ut[e]) if (RegExp("\\b" + e + "\\b", "i").test(dt)) {
|
|
944
|
+
var t = 0;
|
|
945
|
+
ut[e] = function() {
|
|
946
|
+
var n = ct.apply(null, arguments);
|
|
947
|
+
console.error("%s %d: %s", e, t, n);
|
|
948
|
+
};
|
|
949
|
+
} else ut[e] = function() {};
|
|
950
|
+
return ut[e];
|
|
951
|
+
}
|
|
952
|
+
function B(e, t) {
|
|
953
|
+
var n = {
|
|
954
|
+
seen: [],
|
|
955
|
+
stylize: mt
|
|
956
|
+
};
|
|
957
|
+
return arguments.length >= 3 && (n.depth = arguments[2]), arguments.length >= 4 && (n.colors = arguments[3]), Ct(t) ? n.showHidden = t : t && Mt(n, t), V(n.showHidden) && (n.showHidden = !1), V(n.depth) && (n.depth = 2), V(n.colors) && (n.colors = !1), V(n.customInspect) && (n.customInspect = !0), n.colors && (n.stylize = pt), gt(n, e, n.depth);
|
|
958
|
+
}
|
|
959
|
+
B.colors = {
|
|
960
|
+
bold: [1, 22],
|
|
961
|
+
italic: [3, 23],
|
|
962
|
+
underline: [4, 24],
|
|
963
|
+
inverse: [7, 27],
|
|
964
|
+
white: [37, 39],
|
|
965
|
+
grey: [90, 39],
|
|
966
|
+
black: [30, 39],
|
|
967
|
+
blue: [34, 39],
|
|
968
|
+
cyan: [36, 39],
|
|
969
|
+
green: [32, 39],
|
|
970
|
+
magenta: [35, 39],
|
|
971
|
+
red: [31, 39],
|
|
972
|
+
yellow: [33, 39]
|
|
973
|
+
}, B.styles = {
|
|
974
|
+
special: "cyan",
|
|
975
|
+
number: "yellow",
|
|
976
|
+
boolean: "yellow",
|
|
977
|
+
undefined: "grey",
|
|
978
|
+
null: "bold",
|
|
979
|
+
string: "green",
|
|
980
|
+
date: "magenta",
|
|
981
|
+
regexp: "red"
|
|
982
|
+
};
|
|
983
|
+
function pt(e, t) {
|
|
984
|
+
var n = B.styles[t];
|
|
985
|
+
return n ? "\x1B[" + B.colors[n][0] + "m" + e + "\x1B[" + B.colors[n][1] + "m" : e;
|
|
986
|
+
}
|
|
987
|
+
function mt(e, t) {
|
|
988
|
+
return e;
|
|
989
|
+
}
|
|
990
|
+
function ht(e) {
|
|
991
|
+
var t = {};
|
|
992
|
+
return e.forEach(function(e, n) {
|
|
993
|
+
t[e] = !0;
|
|
994
|
+
}), t;
|
|
995
|
+
}
|
|
996
|
+
function gt(e, t, n) {
|
|
997
|
+
if (e.customInspect && t && At(t.inspect) && t.inspect !== B && !(t.constructor && t.constructor.prototype === t)) {
|
|
998
|
+
var r = t.inspect(n, e);
|
|
999
|
+
return Et(r) || (r = gt(e, r, n)), r;
|
|
1000
|
+
}
|
|
1001
|
+
var i = _t(e, t);
|
|
1002
|
+
if (i) return i;
|
|
1003
|
+
var a = Object.keys(t), o = ht(a);
|
|
1004
|
+
if (e.showHidden && (a = Object.getOwnPropertyNames(t)), kt(t) && (a.indexOf("message") >= 0 || a.indexOf("description") >= 0)) return vt(t);
|
|
1005
|
+
if (a.length === 0) {
|
|
1006
|
+
if (At(t)) {
|
|
1007
|
+
var s = t.name ? ": " + t.name : "";
|
|
1008
|
+
return e.stylize("[Function" + s + "]", "special");
|
|
1009
|
+
}
|
|
1010
|
+
if (Dt(t)) return e.stylize(RegExp.prototype.toString.call(t), "regexp");
|
|
1011
|
+
if (Ot(t)) return e.stylize(Date.prototype.toString.call(t), "date");
|
|
1012
|
+
if (kt(t)) return vt(t);
|
|
1013
|
+
}
|
|
1014
|
+
var c = "", l = !1, u = ["{", "}"];
|
|
1015
|
+
if (St(t) && (l = !0, u = ["[", "]"]), At(t) && (c = " [Function" + (t.name ? ": " + t.name : "") + "]"), Dt(t) && (c = " " + RegExp.prototype.toString.call(t)), Ot(t) && (c = " " + Date.prototype.toUTCString.call(t)), kt(t) && (c = " " + vt(t)), a.length === 0 && (!l || t.length == 0)) return u[0] + c + u[1];
|
|
1016
|
+
if (n < 0) return Dt(t) ? e.stylize(RegExp.prototype.toString.call(t), "regexp") : e.stylize("[Object]", "special");
|
|
1017
|
+
e.seen.push(t);
|
|
1018
|
+
var d = l ? yt(e, t, n, o, a) : a.map(function(r) {
|
|
1019
|
+
return bt(e, t, n, o, r, l);
|
|
1020
|
+
});
|
|
1021
|
+
return e.seen.pop(), xt(d, c, u);
|
|
1022
|
+
}
|
|
1023
|
+
function _t(e, t) {
|
|
1024
|
+
if (V(t)) return e.stylize("undefined", "undefined");
|
|
1025
|
+
if (Et(t)) {
|
|
1026
|
+
var n = "'" + JSON.stringify(t).replace(/^"|"$/g, "").replace(/'/g, "\\'").replace(/\\"/g, "\"") + "'";
|
|
1027
|
+
return e.stylize(n, "string");
|
|
1028
|
+
}
|
|
1029
|
+
if (Tt(t)) return e.stylize("" + t, "number");
|
|
1030
|
+
if (Ct(t)) return e.stylize("" + t, "boolean");
|
|
1031
|
+
if (wt(t)) return e.stylize("null", "null");
|
|
1032
|
+
}
|
|
1033
|
+
function vt(e) {
|
|
1034
|
+
return "[" + Error.prototype.toString.call(e) + "]";
|
|
1035
|
+
}
|
|
1036
|
+
function yt(e, t, n, r, i) {
|
|
1037
|
+
for (var a = [], o = 0, s = t.length; o < s; ++o) Nt(t, String(o)) ? a.push(bt(e, t, n, r, String(o), !0)) : a.push("");
|
|
1038
|
+
return i.forEach(function(i) {
|
|
1039
|
+
i.match(/^\d+$/) || a.push(bt(e, t, n, r, i, !0));
|
|
1040
|
+
}), a;
|
|
1041
|
+
}
|
|
1042
|
+
function bt(e, t, n, r, i, a) {
|
|
1043
|
+
var o, s, c = Object.getOwnPropertyDescriptor(t, i) || { value: t[i] };
|
|
1044
|
+
if (c.get ? s = c.set ? e.stylize("[Getter/Setter]", "special") : e.stylize("[Getter]", "special") : c.set && (s = e.stylize("[Setter]", "special")), Nt(r, i) || (o = "[" + i + "]"), s || (e.seen.indexOf(c.value) < 0 ? (s = wt(n) ? gt(e, c.value, null) : gt(e, c.value, n - 1), s.indexOf("\n") > -1 && (s = a ? s.split("\n").map(function(e) {
|
|
1045
|
+
return " " + e;
|
|
1046
|
+
}).join("\n").substr(2) : "\n" + s.split("\n").map(function(e) {
|
|
1047
|
+
return " " + e;
|
|
1048
|
+
}).join("\n"))) : s = e.stylize("[Circular]", "special")), V(o)) {
|
|
1049
|
+
if (a && i.match(/^\d+$/)) return s;
|
|
1050
|
+
o = JSON.stringify("" + i), o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/) ? (o = o.substr(1, o.length - 2), o = e.stylize(o, "name")) : (o = o.replace(/'/g, "\\'").replace(/\\"/g, "\"").replace(/(^"|"$)/g, "'"), o = e.stylize(o, "string"));
|
|
1051
|
+
}
|
|
1052
|
+
return o + ": " + s;
|
|
1053
|
+
}
|
|
1054
|
+
function xt(e, t, n) {
|
|
1055
|
+
return e.reduce(function(e, t) {
|
|
1056
|
+
return t.indexOf("\n"), e + t.replace(/\u001b\[\d\d?m/g, "").length + 1;
|
|
1057
|
+
}, 0) > 60 ? n[0] + (t === "" ? "" : t + "\n ") + " " + e.join(",\n ") + " " + n[1] : n[0] + t + " " + e.join(", ") + " " + n[1];
|
|
1058
|
+
}
|
|
1059
|
+
function St(e) {
|
|
1060
|
+
return Array.isArray(e);
|
|
1061
|
+
}
|
|
1062
|
+
function Ct(e) {
|
|
1063
|
+
return typeof e == "boolean";
|
|
1064
|
+
}
|
|
1065
|
+
function wt(e) {
|
|
1066
|
+
return e === null;
|
|
1067
|
+
}
|
|
1068
|
+
function Tt(e) {
|
|
1069
|
+
return typeof e == "number";
|
|
1070
|
+
}
|
|
1071
|
+
function Et(e) {
|
|
1072
|
+
return typeof e == "string";
|
|
1073
|
+
}
|
|
1074
|
+
function V(e) {
|
|
1075
|
+
return e === void 0;
|
|
1076
|
+
}
|
|
1077
|
+
function Dt(e) {
|
|
1078
|
+
return H(e) && jt(e) === "[object RegExp]";
|
|
1079
|
+
}
|
|
1080
|
+
function H(e) {
|
|
1081
|
+
return typeof e == "object" && !!e;
|
|
1082
|
+
}
|
|
1083
|
+
function Ot(e) {
|
|
1084
|
+
return H(e) && jt(e) === "[object Date]";
|
|
1085
|
+
}
|
|
1086
|
+
function kt(e) {
|
|
1087
|
+
return H(e) && (jt(e) === "[object Error]" || e instanceof Error);
|
|
1088
|
+
}
|
|
1089
|
+
function At(e) {
|
|
1090
|
+
return typeof e == "function";
|
|
1091
|
+
}
|
|
1092
|
+
function jt(e) {
|
|
1093
|
+
return Object.prototype.toString.call(e);
|
|
1094
|
+
}
|
|
1095
|
+
function Mt(e, t) {
|
|
1096
|
+
if (!t || !H(t)) return e;
|
|
1097
|
+
for (var n = Object.keys(t), r = n.length; r--;) e[n[r]] = t[n[r]];
|
|
1098
|
+
return e;
|
|
1099
|
+
}
|
|
1100
|
+
function Nt(e, t) {
|
|
1101
|
+
return Object.prototype.hasOwnProperty.call(e, t);
|
|
1102
|
+
}
|
|
1103
|
+
function U() {
|
|
1104
|
+
this.head = null, this.tail = null, this.length = 0;
|
|
1105
|
+
}
|
|
1106
|
+
U.prototype.push = function(e) {
|
|
1107
|
+
var t = {
|
|
1108
|
+
data: e,
|
|
1109
|
+
next: null
|
|
1110
|
+
};
|
|
1111
|
+
this.length > 0 ? this.tail.next = t : this.head = t, this.tail = t, ++this.length;
|
|
1112
|
+
}, U.prototype.unshift = function(e) {
|
|
1113
|
+
var t = {
|
|
1114
|
+
data: e,
|
|
1115
|
+
next: this.head
|
|
1116
|
+
};
|
|
1117
|
+
this.length === 0 && (this.tail = t), this.head = t, ++this.length;
|
|
1118
|
+
}, U.prototype.shift = function() {
|
|
1119
|
+
if (this.length !== 0) {
|
|
1120
|
+
var e = this.head.data;
|
|
1121
|
+
return this.length === 1 ? this.head = this.tail = null : this.head = this.head.next, --this.length, e;
|
|
1122
|
+
}
|
|
1123
|
+
}, U.prototype.clear = function() {
|
|
1124
|
+
this.head = this.tail = null, this.length = 0;
|
|
1125
|
+
}, U.prototype.join = function(e) {
|
|
1126
|
+
if (this.length === 0) return "";
|
|
1127
|
+
for (var t = this.head, n = "" + t.data; t = t.next;) n += e + t.data;
|
|
1128
|
+
return n;
|
|
1129
|
+
}, U.prototype.concat = function(e) {
|
|
1130
|
+
if (this.length === 0) return _.alloc(0);
|
|
1131
|
+
if (this.length === 1) return this.head.data;
|
|
1132
|
+
for (var t = _.allocUnsafe(e >>> 0), n = this.head, r = 0; n;) n.data.copy(t, r), r += n.data.length, n = n.next;
|
|
1133
|
+
return t;
|
|
1134
|
+
};
|
|
1135
|
+
var Pt = _.isEncoding || function(e) {
|
|
1136
|
+
switch (e && e.toLowerCase()) {
|
|
1137
|
+
case "hex":
|
|
1138
|
+
case "utf8":
|
|
1139
|
+
case "utf-8":
|
|
1140
|
+
case "ascii":
|
|
1141
|
+
case "binary":
|
|
1142
|
+
case "base64":
|
|
1143
|
+
case "ucs2":
|
|
1144
|
+
case "ucs-2":
|
|
1145
|
+
case "utf16le":
|
|
1146
|
+
case "utf-16le":
|
|
1147
|
+
case "raw": return !0;
|
|
1148
|
+
default: return !1;
|
|
1149
|
+
}
|
|
1150
|
+
};
|
|
1151
|
+
function Ft(e) {
|
|
1152
|
+
if (e && !Pt(e)) throw Error("Unknown encoding: " + e);
|
|
1153
|
+
}
|
|
1154
|
+
function W(e) {
|
|
1155
|
+
switch (this.encoding = (e || "utf8").toLowerCase().replace(/[-_]/, ""), Ft(e), this.encoding) {
|
|
1156
|
+
case "utf8":
|
|
1157
|
+
this.surrogateSize = 3;
|
|
1158
|
+
break;
|
|
1159
|
+
case "ucs2":
|
|
1160
|
+
case "utf16le":
|
|
1161
|
+
this.surrogateSize = 2, this.detectIncompleteChar = Lt;
|
|
1162
|
+
break;
|
|
1163
|
+
case "base64":
|
|
1164
|
+
this.surrogateSize = 3, this.detectIncompleteChar = Rt;
|
|
1165
|
+
break;
|
|
1166
|
+
default:
|
|
1167
|
+
this.write = It;
|
|
1168
|
+
return;
|
|
1169
|
+
}
|
|
1170
|
+
this.charBuffer = new _(6), this.charReceived = 0, this.charLength = 0;
|
|
1171
|
+
}
|
|
1172
|
+
W.prototype.write = function(e) {
|
|
1173
|
+
for (var t = ""; this.charLength;) {
|
|
1174
|
+
var n = e.length >= this.charLength - this.charReceived ? this.charLength - this.charReceived : e.length;
|
|
1175
|
+
if (e.copy(this.charBuffer, this.charReceived, 0, n), this.charReceived += n, this.charReceived < this.charLength) return "";
|
|
1176
|
+
e = e.slice(n, e.length), t = this.charBuffer.slice(0, this.charLength).toString(this.encoding);
|
|
1177
|
+
var r = t.charCodeAt(t.length - 1);
|
|
1178
|
+
if (r >= 55296 && r <= 56319) {
|
|
1179
|
+
this.charLength += this.surrogateSize, t = "";
|
|
1180
|
+
continue;
|
|
1181
|
+
}
|
|
1182
|
+
if (this.charReceived = this.charLength = 0, e.length === 0) return t;
|
|
1183
|
+
break;
|
|
1184
|
+
}
|
|
1185
|
+
this.detectIncompleteChar(e);
|
|
1186
|
+
var i = e.length;
|
|
1187
|
+
this.charLength && (e.copy(this.charBuffer, 0, e.length - this.charReceived, i), i -= this.charReceived), t += e.toString(this.encoding, 0, i);
|
|
1188
|
+
var i = t.length - 1, r = t.charCodeAt(i);
|
|
1189
|
+
if (r >= 55296 && r <= 56319) {
|
|
1190
|
+
var a = this.surrogateSize;
|
|
1191
|
+
return this.charLength += a, this.charReceived += a, this.charBuffer.copy(this.charBuffer, a, 0, a), e.copy(this.charBuffer, 0, 0, a), t.substring(0, i);
|
|
1192
|
+
}
|
|
1193
|
+
return t;
|
|
1194
|
+
}, W.prototype.detectIncompleteChar = function(e) {
|
|
1195
|
+
for (var t = e.length >= 3 ? 3 : e.length; t > 0; t--) {
|
|
1196
|
+
var n = e[e.length - t];
|
|
1197
|
+
if (t == 1 && n >> 5 == 6) {
|
|
1198
|
+
this.charLength = 2;
|
|
1199
|
+
break;
|
|
1200
|
+
}
|
|
1201
|
+
if (t <= 2 && n >> 4 == 14) {
|
|
1202
|
+
this.charLength = 3;
|
|
1203
|
+
break;
|
|
1204
|
+
}
|
|
1205
|
+
if (t <= 3 && n >> 3 == 30) {
|
|
1206
|
+
this.charLength = 4;
|
|
1207
|
+
break;
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
this.charReceived = t;
|
|
1211
|
+
}, W.prototype.end = function(e) {
|
|
1212
|
+
var t = "";
|
|
1213
|
+
if (e && e.length && (t = this.write(e)), this.charReceived) {
|
|
1214
|
+
var n = this.charReceived, r = this.charBuffer, i = this.encoding;
|
|
1215
|
+
t += r.slice(0, n).toString(i);
|
|
1216
|
+
}
|
|
1217
|
+
return t;
|
|
1218
|
+
};
|
|
1219
|
+
function It(e) {
|
|
1220
|
+
return e.toString(this.encoding);
|
|
1221
|
+
}
|
|
1222
|
+
function Lt(e) {
|
|
1223
|
+
this.charReceived = e.length % 2, this.charLength = this.charReceived ? 2 : 0;
|
|
1224
|
+
}
|
|
1225
|
+
function Rt(e) {
|
|
1226
|
+
this.charReceived = e.length % 3, this.charLength = this.charReceived ? 3 : 0;
|
|
1227
|
+
}
|
|
1228
|
+
K.ReadableState = Vt;
|
|
1229
|
+
var G = ft("stream");
|
|
1230
|
+
z(K, A);
|
|
1231
|
+
function zt(e, t, n) {
|
|
1232
|
+
if (typeof e.prependListener == "function") return e.prependListener(t, n);
|
|
1233
|
+
!e._events || !e._events[t] ? e.on(t, n) : Array.isArray(e._events[t]) ? e._events[t].unshift(n) : e._events[t] = [n, e._events[t]];
|
|
1234
|
+
}
|
|
1235
|
+
function Bt(e, t) {
|
|
1236
|
+
return e.listeners(t).length;
|
|
1237
|
+
}
|
|
1238
|
+
function Vt(e, t) {
|
|
1239
|
+
e ||= {}, this.objectMode = !!e.objectMode, t instanceof J && (this.objectMode = this.objectMode || !!e.readableObjectMode);
|
|
1240
|
+
var n = e.highWaterMark, r = this.objectMode ? 16 : 16 * 1024;
|
|
1241
|
+
this.highWaterMark = n || n === 0 ? n : r, this.highWaterMark = ~~this.highWaterMark, this.buffer = new U(), this.length = 0, this.pipes = null, this.pipesCount = 0, this.flowing = null, this.ended = !1, this.endEmitted = !1, this.reading = !1, this.sync = !0, this.needReadable = !1, this.emittedReadable = !1, this.readableListening = !1, this.resumeScheduled = !1, this.defaultEncoding = e.defaultEncoding || "utf8", this.ranOut = !1, this.awaitDrain = 0, this.readingMore = !1, this.decoder = null, this.encoding = null, e.encoding && (this.decoder = new W(e.encoding), this.encoding = e.encoding);
|
|
1242
|
+
}
|
|
1243
|
+
function K(e) {
|
|
1244
|
+
if (!(this instanceof K)) return new K(e);
|
|
1245
|
+
this._readableState = new Vt(e, this), this.readable = !0, e && typeof e.read == "function" && (this._read = e.read), A.call(this);
|
|
1246
|
+
}
|
|
1247
|
+
K.prototype.push = function(e, t) {
|
|
1248
|
+
var n = this._readableState;
|
|
1249
|
+
return !n.objectMode && typeof e == "string" && (t ||= n.defaultEncoding, t !== n.encoding && (e = _.from(e, t), t = "")), Ht(this, n, e, t, !1);
|
|
1250
|
+
}, K.prototype.unshift = function(e) {
|
|
1251
|
+
var t = this._readableState;
|
|
1252
|
+
return Ht(this, t, e, "", !0);
|
|
1253
|
+
}, K.prototype.isPaused = function() {
|
|
1254
|
+
return this._readableState.flowing === !1;
|
|
1255
|
+
};
|
|
1256
|
+
function Ht(e, t, n, r, i) {
|
|
1257
|
+
var a = qt(t, n);
|
|
1258
|
+
if (a) e.emit("error", a);
|
|
1259
|
+
else if (n === null) t.reading = !1, Jt(e, t);
|
|
1260
|
+
else if (t.objectMode || n && n.length > 0) if (t.ended && !i) {
|
|
1261
|
+
var o = /* @__PURE__ */ Error("stream.push() after EOF");
|
|
1262
|
+
e.emit("error", o);
|
|
1263
|
+
} else if (t.endEmitted && i) {
|
|
1264
|
+
var s = /* @__PURE__ */ Error("stream.unshift() after end event");
|
|
1265
|
+
e.emit("error", s);
|
|
1266
|
+
} else {
|
|
1267
|
+
var c;
|
|
1268
|
+
t.decoder && !i && !r && (n = t.decoder.write(n), c = !t.objectMode && n.length === 0), i || (t.reading = !1), c || (t.flowing && t.length === 0 && !t.sync ? (e.emit("data", n), e.read(0)) : (t.length += t.objectMode ? 1 : n.length, i ? t.buffer.unshift(n) : t.buffer.push(n), t.needReadable && Yt(e))), Zt(e, t);
|
|
1269
|
+
}
|
|
1270
|
+
else i || (t.reading = !1);
|
|
1271
|
+
return Ut(t);
|
|
1272
|
+
}
|
|
1273
|
+
function Ut(e) {
|
|
1274
|
+
return !e.ended && (e.needReadable || e.length < e.highWaterMark || e.length === 0);
|
|
1275
|
+
}
|
|
1276
|
+
K.prototype.setEncoding = function(e) {
|
|
1277
|
+
return this._readableState.decoder = new W(e), this._readableState.encoding = e, this;
|
|
1278
|
+
};
|
|
1279
|
+
var Wt = 8388608;
|
|
1280
|
+
function Gt(e) {
|
|
1281
|
+
return e >= Wt ? e = Wt : (e--, e |= e >>> 1, e |= e >>> 2, e |= e >>> 4, e |= e >>> 8, e |= e >>> 16, e++), e;
|
|
1282
|
+
}
|
|
1283
|
+
function Kt(e, t) {
|
|
1284
|
+
return e <= 0 || t.length === 0 && t.ended ? 0 : t.objectMode ? 1 : e === e ? (e > t.highWaterMark && (t.highWaterMark = Gt(e)), e <= t.length ? e : t.ended ? t.length : (t.needReadable = !0, 0)) : t.flowing && t.length ? t.buffer.head.data.length : t.length;
|
|
1285
|
+
}
|
|
1286
|
+
K.prototype.read = function(e) {
|
|
1287
|
+
G("read", e), e = parseInt(e, 10);
|
|
1288
|
+
var t = this._readableState, n = e;
|
|
1289
|
+
if (e !== 0 && (t.emittedReadable = !1), e === 0 && t.needReadable && (t.length >= t.highWaterMark || t.ended)) return G("read: emitReadable", t.length, t.ended), t.length === 0 && t.ended ? ln(this) : Yt(this), null;
|
|
1290
|
+
if (e = Kt(e, t), e === 0 && t.ended) return t.length === 0 && ln(this), null;
|
|
1291
|
+
var r = t.needReadable;
|
|
1292
|
+
G("need readable", r), (t.length === 0 || t.length - e < t.highWaterMark) && (r = !0, G("length less than watermark", r)), t.ended || t.reading ? (r = !1, G("reading or ended", r)) : r && (G("do read"), t.reading = !0, t.sync = !0, t.length === 0 && (t.needReadable = !0), this._read(t.highWaterMark), t.sync = !1, t.reading || (e = Kt(n, t)));
|
|
1293
|
+
var i = e > 0 ? an(e, t) : null;
|
|
1294
|
+
return i === null ? (t.needReadable = !0, e = 0) : t.length -= e, t.length === 0 && (t.ended || (t.needReadable = !0), n !== e && t.ended && ln(this)), i !== null && this.emit("data", i), i;
|
|
1295
|
+
};
|
|
1296
|
+
function qt(e, t) {
|
|
1297
|
+
var n = null;
|
|
1298
|
+
return !O(t) && typeof t != "string" && t != null && !e.objectMode && (n = /* @__PURE__ */ TypeError("Invalid non-string/buffer chunk")), n;
|
|
1299
|
+
}
|
|
1300
|
+
function Jt(e, t) {
|
|
1301
|
+
if (!t.ended) {
|
|
1302
|
+
if (t.decoder) {
|
|
1303
|
+
var n = t.decoder.end();
|
|
1304
|
+
n && n.length && (t.buffer.push(n), t.length += t.objectMode ? 1 : n.length);
|
|
1305
|
+
}
|
|
1306
|
+
t.ended = !0, Yt(e);
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
function Yt(e) {
|
|
1310
|
+
var t = e._readableState;
|
|
1311
|
+
t.needReadable = !1, t.emittedReadable || (G("emitReadable", t.flowing), t.emittedReadable = !0, t.sync ? L(Xt, e) : Xt(e));
|
|
1312
|
+
}
|
|
1313
|
+
function Xt(e) {
|
|
1314
|
+
G("emit readable"), e.emit("readable"), rn(e);
|
|
1315
|
+
}
|
|
1316
|
+
function Zt(e, t) {
|
|
1317
|
+
t.readingMore || (t.readingMore = !0, L(Qt, e, t));
|
|
1318
|
+
}
|
|
1319
|
+
function Qt(e, t) {
|
|
1320
|
+
for (var n = t.length; !t.reading && !t.flowing && !t.ended && t.length < t.highWaterMark && (G("maybeReadMore read 0"), e.read(0), n !== t.length);) n = t.length;
|
|
1321
|
+
t.readingMore = !1;
|
|
1322
|
+
}
|
|
1323
|
+
K.prototype._read = function(e) {
|
|
1324
|
+
this.emit("error", /* @__PURE__ */ Error("not implemented"));
|
|
1325
|
+
}, K.prototype.pipe = function(e, t) {
|
|
1326
|
+
var n = this, r = this._readableState;
|
|
1327
|
+
switch (r.pipesCount) {
|
|
1328
|
+
case 0:
|
|
1329
|
+
r.pipes = e;
|
|
1330
|
+
break;
|
|
1331
|
+
case 1:
|
|
1332
|
+
r.pipes = [r.pipes, e];
|
|
1333
|
+
break;
|
|
1334
|
+
default:
|
|
1335
|
+
r.pipes.push(e);
|
|
1336
|
+
break;
|
|
1337
|
+
}
|
|
1338
|
+
r.pipesCount += 1, G("pipe count=%d opts=%j", r.pipesCount, t);
|
|
1339
|
+
var i = !t || t.end !== !1 ? o : l;
|
|
1340
|
+
r.endEmitted ? L(i) : n.once("end", i), e.on("unpipe", a);
|
|
1341
|
+
function a(e) {
|
|
1342
|
+
G("onunpipe"), e === n && l();
|
|
1343
|
+
}
|
|
1344
|
+
function o() {
|
|
1345
|
+
G("onend"), e.end();
|
|
1346
|
+
}
|
|
1347
|
+
var s = $t(n);
|
|
1348
|
+
e.on("drain", s);
|
|
1349
|
+
var c = !1;
|
|
1350
|
+
function l() {
|
|
1351
|
+
G("cleanup"), e.removeListener("close", p), e.removeListener("finish", m), e.removeListener("drain", s), e.removeListener("error", f), e.removeListener("unpipe", a), n.removeListener("end", o), n.removeListener("end", l), n.removeListener("data", d), c = !0, r.awaitDrain && (!e._writableState || e._writableState.needDrain) && s();
|
|
1352
|
+
}
|
|
1353
|
+
var u = !1;
|
|
1354
|
+
n.on("data", d);
|
|
1355
|
+
function d(t) {
|
|
1356
|
+
G("ondata"), u = !1, !1 === e.write(t) && !u && ((r.pipesCount === 1 && r.pipes === e || r.pipesCount > 1 && fn(r.pipes, e) !== -1) && !c && (G("false write response, pause", n._readableState.awaitDrain), n._readableState.awaitDrain++, u = !0), n.pause());
|
|
1357
|
+
}
|
|
1358
|
+
function f(t) {
|
|
1359
|
+
G("onerror", t), h(), e.removeListener("error", f), Bt(e, "error") === 0 && e.emit("error", t);
|
|
1360
|
+
}
|
|
1361
|
+
zt(e, "error", f);
|
|
1362
|
+
function p() {
|
|
1363
|
+
e.removeListener("finish", m), h();
|
|
1364
|
+
}
|
|
1365
|
+
e.once("close", p);
|
|
1366
|
+
function m() {
|
|
1367
|
+
G("onfinish"), e.removeListener("close", p), h();
|
|
1368
|
+
}
|
|
1369
|
+
e.once("finish", m);
|
|
1370
|
+
function h() {
|
|
1371
|
+
G("unpipe"), n.unpipe(e);
|
|
1372
|
+
}
|
|
1373
|
+
return e.emit("pipe", n), r.flowing || (G("pipe resume"), n.resume()), e;
|
|
1374
|
+
};
|
|
1375
|
+
function $t(e) {
|
|
1376
|
+
return function() {
|
|
1377
|
+
var t = e._readableState;
|
|
1378
|
+
G("pipeOnDrain", t.awaitDrain), t.awaitDrain && t.awaitDrain--, t.awaitDrain === 0 && e.listeners("data").length && (t.flowing = !0, rn(e));
|
|
1379
|
+
};
|
|
1380
|
+
}
|
|
1381
|
+
K.prototype.unpipe = function(e) {
|
|
1382
|
+
var t = this._readableState;
|
|
1383
|
+
if (t.pipesCount === 0) return this;
|
|
1384
|
+
if (t.pipesCount === 1) return e && e !== t.pipes ? this : (e ||= t.pipes, t.pipes = null, t.pipesCount = 0, t.flowing = !1, e && e.emit("unpipe", this), this);
|
|
1385
|
+
if (!e) {
|
|
1386
|
+
var n = t.pipes, r = t.pipesCount;
|
|
1387
|
+
t.pipes = null, t.pipesCount = 0, t.flowing = !1;
|
|
1388
|
+
for (var i = 0; i < r; i++) n[i].emit("unpipe", this);
|
|
1389
|
+
return this;
|
|
1390
|
+
}
|
|
1391
|
+
var a = fn(t.pipes, e);
|
|
1392
|
+
return a === -1 ? this : (t.pipes.splice(a, 1), --t.pipesCount, t.pipesCount === 1 && (t.pipes = t.pipes[0]), e.emit("unpipe", this), this);
|
|
1393
|
+
}, K.prototype.on = function(e, t) {
|
|
1394
|
+
var n = A.prototype.on.call(this, e, t);
|
|
1395
|
+
if (e === "data") this._readableState.flowing !== !1 && this.resume();
|
|
1396
|
+
else if (e === "readable") {
|
|
1397
|
+
var r = this._readableState;
|
|
1398
|
+
!r.endEmitted && !r.readableListening && (r.readableListening = r.needReadable = !0, r.emittedReadable = !1, r.reading ? r.length && Yt(this) : L(en, this));
|
|
1399
|
+
}
|
|
1400
|
+
return n;
|
|
1401
|
+
}, K.prototype.addListener = K.prototype.on;
|
|
1402
|
+
function en(e) {
|
|
1403
|
+
G("readable nexttick read 0"), e.read(0);
|
|
1404
|
+
}
|
|
1405
|
+
K.prototype.resume = function() {
|
|
1406
|
+
var e = this._readableState;
|
|
1407
|
+
return e.flowing || (G("resume"), e.flowing = !0, tn(this, e)), this;
|
|
1408
|
+
};
|
|
1409
|
+
function tn(e, t) {
|
|
1410
|
+
t.resumeScheduled || (t.resumeScheduled = !0, L(nn, e, t));
|
|
1411
|
+
}
|
|
1412
|
+
function nn(e, t) {
|
|
1413
|
+
t.reading || (G("resume read 0"), e.read(0)), t.resumeScheduled = !1, t.awaitDrain = 0, e.emit("resume"), rn(e), t.flowing && !t.reading && e.read(0);
|
|
1414
|
+
}
|
|
1415
|
+
K.prototype.pause = function() {
|
|
1416
|
+
return G("call pause flowing=%j", this._readableState.flowing), !1 !== this._readableState.flowing && (G("pause"), this._readableState.flowing = !1, this.emit("pause")), this;
|
|
1417
|
+
};
|
|
1418
|
+
function rn(e) {
|
|
1419
|
+
var t = e._readableState;
|
|
1420
|
+
for (G("flow", t.flowing); t.flowing && e.read() !== null;);
|
|
1421
|
+
}
|
|
1422
|
+
K.prototype.wrap = function(e) {
|
|
1423
|
+
var t = this._readableState, n = !1, r = this;
|
|
1424
|
+
for (var i in e.on("end", function() {
|
|
1425
|
+
if (G("wrapped end"), t.decoder && !t.ended) {
|
|
1426
|
+
var e = t.decoder.end();
|
|
1427
|
+
e && e.length && r.push(e);
|
|
1428
|
+
}
|
|
1429
|
+
r.push(null);
|
|
1430
|
+
}), e.on("data", function(i) {
|
|
1431
|
+
G("wrapped data"), t.decoder && (i = t.decoder.write(i)), !(t.objectMode && i == null) && (!t.objectMode && (!i || !i.length) || r.push(i) || (n = !0, e.pause()));
|
|
1432
|
+
}), e) this[i] === void 0 && typeof e[i] == "function" && (this[i] = function(t) {
|
|
1433
|
+
return function() {
|
|
1434
|
+
return e[t].apply(e, arguments);
|
|
1435
|
+
};
|
|
1436
|
+
}(i));
|
|
1437
|
+
return dn([
|
|
1438
|
+
"error",
|
|
1439
|
+
"close",
|
|
1440
|
+
"destroy",
|
|
1441
|
+
"pause",
|
|
1442
|
+
"resume"
|
|
1443
|
+
], function(t) {
|
|
1444
|
+
e.on(t, r.emit.bind(r, t));
|
|
1445
|
+
}), r._read = function(t) {
|
|
1446
|
+
G("wrapped _read", t), n && (n = !1, e.resume());
|
|
1447
|
+
}, r;
|
|
1448
|
+
}, K._fromList = an;
|
|
1449
|
+
function an(e, t) {
|
|
1450
|
+
if (t.length === 0) return null;
|
|
1451
|
+
var n;
|
|
1452
|
+
return t.objectMode ? n = t.buffer.shift() : !e || e >= t.length ? (n = t.decoder ? t.buffer.join("") : t.buffer.length === 1 ? t.buffer.head.data : t.buffer.concat(t.length), t.buffer.clear()) : n = on(e, t.buffer, t.decoder), n;
|
|
1453
|
+
}
|
|
1454
|
+
function on(e, t, n) {
|
|
1455
|
+
var r;
|
|
1456
|
+
return e < t.head.data.length ? (r = t.head.data.slice(0, e), t.head.data = t.head.data.slice(e)) : r = e === t.head.data.length ? t.shift() : n ? sn(e, t) : cn(e, t), r;
|
|
1457
|
+
}
|
|
1458
|
+
function sn(e, t) {
|
|
1459
|
+
var n = t.head, r = 1, i = n.data;
|
|
1460
|
+
for (e -= i.length; n = n.next;) {
|
|
1461
|
+
var a = n.data, o = e > a.length ? a.length : e;
|
|
1462
|
+
if (o === a.length ? i += a : i += a.slice(0, e), e -= o, e === 0) {
|
|
1463
|
+
o === a.length ? (++r, n.next ? t.head = n.next : t.head = t.tail = null) : (t.head = n, n.data = a.slice(o));
|
|
1464
|
+
break;
|
|
1465
|
+
}
|
|
1466
|
+
++r;
|
|
1467
|
+
}
|
|
1468
|
+
return t.length -= r, i;
|
|
1469
|
+
}
|
|
1470
|
+
function cn(e, t) {
|
|
1471
|
+
var n = _.allocUnsafe(e), r = t.head, i = 1;
|
|
1472
|
+
for (r.data.copy(n), e -= r.data.length; r = r.next;) {
|
|
1473
|
+
var a = r.data, o = e > a.length ? a.length : e;
|
|
1474
|
+
if (a.copy(n, n.length - e, 0, o), e -= o, e === 0) {
|
|
1475
|
+
o === a.length ? (++i, r.next ? t.head = r.next : t.head = t.tail = null) : (t.head = r, r.data = a.slice(o));
|
|
1476
|
+
break;
|
|
1477
|
+
}
|
|
1478
|
+
++i;
|
|
1479
|
+
}
|
|
1480
|
+
return t.length -= i, n;
|
|
1481
|
+
}
|
|
1482
|
+
function ln(e) {
|
|
1483
|
+
var t = e._readableState;
|
|
1484
|
+
if (t.length > 0) throw Error("\"endReadable()\" called on non-empty stream");
|
|
1485
|
+
t.endEmitted || (t.ended = !0, L(un, t, e));
|
|
1486
|
+
}
|
|
1487
|
+
function un(e, t) {
|
|
1488
|
+
!e.endEmitted && e.length === 0 && (e.endEmitted = !0, t.readable = !1, t.emit("end"));
|
|
1489
|
+
}
|
|
1490
|
+
function dn(e, t) {
|
|
1491
|
+
for (var n = 0, r = e.length; n < r; n++) t(e[n], n);
|
|
1492
|
+
}
|
|
1493
|
+
function fn(e, t) {
|
|
1494
|
+
for (var n = 0, r = e.length; n < r; n++) if (e[n] === t) return n;
|
|
1495
|
+
return -1;
|
|
1496
|
+
}
|
|
1497
|
+
q.WritableState = hn, z(q, A);
|
|
1498
|
+
function pn() {}
|
|
1499
|
+
function mn(e, t, n) {
|
|
1500
|
+
this.chunk = e, this.encoding = t, this.callback = n, this.next = null;
|
|
1501
|
+
}
|
|
1502
|
+
function hn(e, t) {
|
|
1503
|
+
Object.defineProperty(this, "buffer", { get: lt(function() {
|
|
1504
|
+
return this.getBuffer();
|
|
1505
|
+
}, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.") }), e ||= {}, this.objectMode = !!e.objectMode, t instanceof J && (this.objectMode = this.objectMode || !!e.writableObjectMode);
|
|
1506
|
+
var n = e.highWaterMark, r = this.objectMode ? 16 : 16 * 1024;
|
|
1507
|
+
this.highWaterMark = n || n === 0 ? n : r, this.highWaterMark = ~~this.highWaterMark, this.needDrain = !1, this.ending = !1, this.ended = !1, this.finished = !1, this.decodeStrings = e.decodeStrings !== !1, this.defaultEncoding = e.defaultEncoding || "utf8", this.length = 0, this.writing = !1, this.corked = 0, this.sync = !0, this.bufferProcessing = !1, this.onwrite = function(e) {
|
|
1508
|
+
Cn(t, e);
|
|
1509
|
+
}, this.writecb = null, this.writelen = 0, this.bufferedRequest = null, this.lastBufferedRequest = null, this.pendingcb = 0, this.prefinished = !1, this.errorEmitted = !1, this.bufferedRequestCount = 0, this.corkedRequestsFree = new jn(this);
|
|
1510
|
+
}
|
|
1511
|
+
hn.prototype.getBuffer = function() {
|
|
1512
|
+
for (var e = this.bufferedRequest, t = []; e;) t.push(e), e = e.next;
|
|
1513
|
+
return t;
|
|
1514
|
+
};
|
|
1515
|
+
function q(e) {
|
|
1516
|
+
if (!(this instanceof q) && !(this instanceof J)) return new q(e);
|
|
1517
|
+
this._writableState = new hn(e, this), this.writable = !0, e && (typeof e.write == "function" && (this._write = e.write), typeof e.writev == "function" && (this._writev = e.writev)), A.call(this);
|
|
1518
|
+
}
|
|
1519
|
+
q.prototype.pipe = function() {
|
|
1520
|
+
this.emit("error", /* @__PURE__ */ Error("Cannot pipe, not readable"));
|
|
1521
|
+
};
|
|
1522
|
+
function gn(e, t) {
|
|
1523
|
+
var n = /* @__PURE__ */ Error("write after end");
|
|
1524
|
+
e.emit("error", n), L(t, n);
|
|
1525
|
+
}
|
|
1526
|
+
function _n(e, t, n, r) {
|
|
1527
|
+
var i = !0, a = !1;
|
|
1528
|
+
return n === null ? a = /* @__PURE__ */ TypeError("May not write null values to stream") : !_.isBuffer(n) && typeof n != "string" && n !== void 0 && !t.objectMode && (a = /* @__PURE__ */ TypeError("Invalid non-string/buffer chunk")), a && (e.emit("error", a), L(r, a), i = !1), i;
|
|
1529
|
+
}
|
|
1530
|
+
q.prototype.write = function(e, t, n) {
|
|
1531
|
+
var r = this._writableState, i = !1;
|
|
1532
|
+
return typeof t == "function" && (n = t, t = null), _.isBuffer(e) ? t = "buffer" : t ||= r.defaultEncoding, typeof n != "function" && (n = pn), r.ended ? gn(this, n) : _n(this, r, e, n) && (r.pendingcb++, i = yn(this, r, e, t, n)), i;
|
|
1533
|
+
}, q.prototype.cork = function() {
|
|
1534
|
+
var e = this._writableState;
|
|
1535
|
+
e.corked++;
|
|
1536
|
+
}, q.prototype.uncork = function() {
|
|
1537
|
+
var e = this._writableState;
|
|
1538
|
+
e.corked && (e.corked--, !e.writing && !e.corked && !e.finished && !e.bufferProcessing && e.bufferedRequest && En(this, e));
|
|
1539
|
+
}, q.prototype.setDefaultEncoding = function(e) {
|
|
1540
|
+
if (typeof e == "string" && (e = e.toLowerCase()), !([
|
|
1541
|
+
"hex",
|
|
1542
|
+
"utf8",
|
|
1543
|
+
"utf-8",
|
|
1544
|
+
"ascii",
|
|
1545
|
+
"binary",
|
|
1546
|
+
"base64",
|
|
1547
|
+
"ucs2",
|
|
1548
|
+
"ucs-2",
|
|
1549
|
+
"utf16le",
|
|
1550
|
+
"utf-16le",
|
|
1551
|
+
"raw"
|
|
1552
|
+
].indexOf((e + "").toLowerCase()) > -1)) throw TypeError("Unknown encoding: " + e);
|
|
1553
|
+
return this._writableState.defaultEncoding = e, this;
|
|
1554
|
+
};
|
|
1555
|
+
function vn(e, t, n) {
|
|
1556
|
+
return !e.objectMode && e.decodeStrings !== !1 && typeof t == "string" && (t = _.from(t, n)), t;
|
|
1557
|
+
}
|
|
1558
|
+
function yn(e, t, n, r, i) {
|
|
1559
|
+
n = vn(t, n, r), _.isBuffer(n) && (r = "buffer");
|
|
1560
|
+
var a = t.objectMode ? 1 : n.length;
|
|
1561
|
+
t.length += a;
|
|
1562
|
+
var o = t.length < t.highWaterMark;
|
|
1563
|
+
if (o || (t.needDrain = !0), t.writing || t.corked) {
|
|
1564
|
+
var s = t.lastBufferedRequest;
|
|
1565
|
+
t.lastBufferedRequest = new mn(n, r, i), s ? s.next = t.lastBufferedRequest : t.bufferedRequest = t.lastBufferedRequest, t.bufferedRequestCount += 1;
|
|
1566
|
+
} else bn(e, t, !1, a, n, r, i);
|
|
1567
|
+
return o;
|
|
1568
|
+
}
|
|
1569
|
+
function bn(e, t, n, r, i, a, o) {
|
|
1570
|
+
t.writelen = r, t.writecb = o, t.writing = !0, t.sync = !0, n ? e._writev(i, t.onwrite) : e._write(i, a, t.onwrite), t.sync = !1;
|
|
1571
|
+
}
|
|
1572
|
+
function xn(e, t, n, r, i) {
|
|
1573
|
+
--t.pendingcb, n ? L(i, r) : i(r), e._writableState.errorEmitted = !0, e.emit("error", r);
|
|
1574
|
+
}
|
|
1575
|
+
function Sn(e) {
|
|
1576
|
+
e.writing = !1, e.writecb = null, e.length -= e.writelen, e.writelen = 0;
|
|
1577
|
+
}
|
|
1578
|
+
function Cn(e, t) {
|
|
1579
|
+
var n = e._writableState, r = n.sync, i = n.writecb;
|
|
1580
|
+
if (Sn(n), t) xn(e, n, r, t, i);
|
|
1581
|
+
else {
|
|
1582
|
+
var a = Dn(n);
|
|
1583
|
+
!a && !n.corked && !n.bufferProcessing && n.bufferedRequest && En(e, n), r ? L(wn, e, n, a, i) : wn(e, n, a, i);
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
function wn(e, t, n, r) {
|
|
1587
|
+
n || Tn(e, t), t.pendingcb--, r(), kn(e, t);
|
|
1588
|
+
}
|
|
1589
|
+
function Tn(e, t) {
|
|
1590
|
+
t.length === 0 && t.needDrain && (t.needDrain = !1, e.emit("drain"));
|
|
1591
|
+
}
|
|
1592
|
+
function En(e, t) {
|
|
1593
|
+
t.bufferProcessing = !0;
|
|
1594
|
+
var n = t.bufferedRequest;
|
|
1595
|
+
if (e._writev && n && n.next) {
|
|
1596
|
+
var r = t.bufferedRequestCount, i = Array(r), a = t.corkedRequestsFree;
|
|
1597
|
+
a.entry = n;
|
|
1598
|
+
for (var o = 0; n;) i[o] = n, n = n.next, o += 1;
|
|
1599
|
+
bn(e, t, !0, t.length, i, "", a.finish), t.pendingcb++, t.lastBufferedRequest = null, a.next ? (t.corkedRequestsFree = a.next, a.next = null) : t.corkedRequestsFree = new jn(t);
|
|
1600
|
+
} else {
|
|
1601
|
+
for (; n;) {
|
|
1602
|
+
var s = n.chunk, c = n.encoding, l = n.callback;
|
|
1603
|
+
if (bn(e, t, !1, t.objectMode ? 1 : s.length, s, c, l), n = n.next, t.writing) break;
|
|
1604
|
+
}
|
|
1605
|
+
n === null && (t.lastBufferedRequest = null);
|
|
1606
|
+
}
|
|
1607
|
+
t.bufferedRequestCount = 0, t.bufferedRequest = n, t.bufferProcessing = !1;
|
|
1608
|
+
}
|
|
1609
|
+
q.prototype._write = function(e, t, n) {
|
|
1610
|
+
n(/* @__PURE__ */ Error("not implemented"));
|
|
1611
|
+
}, q.prototype._writev = null, q.prototype.end = function(e, t, n) {
|
|
1612
|
+
var r = this._writableState;
|
|
1613
|
+
typeof e == "function" ? (n = e, e = null, t = null) : typeof t == "function" && (n = t, t = null), e != null && this.write(e, t), r.corked && (r.corked = 1, this.uncork()), !r.ending && !r.finished && An(this, r, n);
|
|
1614
|
+
};
|
|
1615
|
+
function Dn(e) {
|
|
1616
|
+
return e.ending && e.length === 0 && e.bufferedRequest === null && !e.finished && !e.writing;
|
|
1617
|
+
}
|
|
1618
|
+
function On(e, t) {
|
|
1619
|
+
t.prefinished || (t.prefinished = !0, e.emit("prefinish"));
|
|
1620
|
+
}
|
|
1621
|
+
function kn(e, t) {
|
|
1622
|
+
var n = Dn(t);
|
|
1623
|
+
return n && (t.pendingcb === 0 ? (On(e, t), t.finished = !0, e.emit("finish")) : On(e, t)), n;
|
|
1624
|
+
}
|
|
1625
|
+
function An(e, t, n) {
|
|
1626
|
+
t.ending = !0, kn(e, t), n && (t.finished ? L(n) : e.once("finish", n)), t.ended = !0, e.writable = !1;
|
|
1627
|
+
}
|
|
1628
|
+
function jn(e) {
|
|
1629
|
+
var t = this;
|
|
1630
|
+
this.next = null, this.entry = null, this.finish = function(n) {
|
|
1631
|
+
var r = t.entry;
|
|
1632
|
+
for (t.entry = null; r;) {
|
|
1633
|
+
var i = r.callback;
|
|
1634
|
+
e.pendingcb--, i(n), r = r.next;
|
|
1635
|
+
}
|
|
1636
|
+
e.corkedRequestsFree ? e.corkedRequestsFree.next = t : e.corkedRequestsFree = t;
|
|
1637
|
+
};
|
|
1638
|
+
}
|
|
1639
|
+
z(J, K);
|
|
1640
|
+
for (var Mn = Object.keys(q.prototype), Nn = 0; Nn < Mn.length; Nn++) {
|
|
1641
|
+
var Pn = Mn[Nn];
|
|
1642
|
+
J.prototype[Pn] || (J.prototype[Pn] = q.prototype[Pn]);
|
|
1643
|
+
}
|
|
1644
|
+
function J(e) {
|
|
1645
|
+
if (!(this instanceof J)) return new J(e);
|
|
1646
|
+
K.call(this, e), q.call(this, e), e && e.readable === !1 && (this.readable = !1), e && e.writable === !1 && (this.writable = !1), this.allowHalfOpen = !0, e && e.allowHalfOpen === !1 && (this.allowHalfOpen = !1), this.once("end", Fn);
|
|
1647
|
+
}
|
|
1648
|
+
function Fn() {
|
|
1649
|
+
this.allowHalfOpen || this._writableState.ended || L(In, this);
|
|
1650
|
+
}
|
|
1651
|
+
function In(e) {
|
|
1652
|
+
e.end();
|
|
1653
|
+
}
|
|
1654
|
+
z(Y, J);
|
|
1655
|
+
function Ln(e) {
|
|
1656
|
+
this.afterTransform = function(t, n) {
|
|
1657
|
+
return Rn(e, t, n);
|
|
1658
|
+
}, this.needTransform = !1, this.transforming = !1, this.writecb = null, this.writechunk = null, this.writeencoding = null;
|
|
1659
|
+
}
|
|
1660
|
+
function Rn(e, t, n) {
|
|
1661
|
+
var r = e._transformState;
|
|
1662
|
+
r.transforming = !1;
|
|
1663
|
+
var i = r.writecb;
|
|
1664
|
+
if (!i) return e.emit("error", /* @__PURE__ */ Error("no writecb in Transform class"));
|
|
1665
|
+
r.writechunk = null, r.writecb = null, n != null && e.push(n), i(t);
|
|
1666
|
+
var a = e._readableState;
|
|
1667
|
+
a.reading = !1, (a.needReadable || a.length < a.highWaterMark) && e._read(a.highWaterMark);
|
|
1668
|
+
}
|
|
1669
|
+
function Y(e) {
|
|
1670
|
+
if (!(this instanceof Y)) return new Y(e);
|
|
1671
|
+
J.call(this, e), this._transformState = new Ln(this);
|
|
1672
|
+
var t = this;
|
|
1673
|
+
this._readableState.needReadable = !0, this._readableState.sync = !1, e && (typeof e.transform == "function" && (this._transform = e.transform), typeof e.flush == "function" && (this._flush = e.flush)), this.once("prefinish", function() {
|
|
1674
|
+
typeof this._flush == "function" ? this._flush(function(e) {
|
|
1675
|
+
zn(t, e);
|
|
1676
|
+
}) : zn(t);
|
|
1677
|
+
});
|
|
1678
|
+
}
|
|
1679
|
+
Y.prototype.push = function(e, t) {
|
|
1680
|
+
return this._transformState.needTransform = !1, J.prototype.push.call(this, e, t);
|
|
1681
|
+
}, Y.prototype._transform = function(e, t, n) {
|
|
1682
|
+
throw Error("Not implemented");
|
|
1683
|
+
}, Y.prototype._write = function(e, t, n) {
|
|
1684
|
+
var r = this._transformState;
|
|
1685
|
+
if (r.writecb = n, r.writechunk = e, r.writeencoding = t, !r.transforming) {
|
|
1686
|
+
var i = this._readableState;
|
|
1687
|
+
(r.needTransform || i.needReadable || i.length < i.highWaterMark) && this._read(i.highWaterMark);
|
|
1688
|
+
}
|
|
1689
|
+
}, Y.prototype._read = function(e) {
|
|
1690
|
+
var t = this._transformState;
|
|
1691
|
+
t.writechunk !== null && t.writecb && !t.transforming ? (t.transforming = !0, this._transform(t.writechunk, t.writeencoding, t.afterTransform)) : t.needTransform = !0;
|
|
1692
|
+
};
|
|
1693
|
+
function zn(e, t) {
|
|
1694
|
+
if (t) return e.emit("error", t);
|
|
1695
|
+
var n = e._writableState, r = e._transformState;
|
|
1696
|
+
if (n.length) throw Error("Calling transform done when ws.length != 0");
|
|
1697
|
+
if (r.transforming) throw Error("Calling transform done when still transforming");
|
|
1698
|
+
return e.push(null);
|
|
1699
|
+
}
|
|
1700
|
+
z(X, Y);
|
|
1701
|
+
function X(e) {
|
|
1702
|
+
if (!(this instanceof X)) return new X(e);
|
|
1703
|
+
Y.call(this, e);
|
|
1704
|
+
}
|
|
1705
|
+
X.prototype._transform = function(e, t, n) {
|
|
1706
|
+
n(null, e);
|
|
1707
|
+
}, z(Z, A), Z.Readable = K, Z.Writable = q, Z.Duplex = J, Z.Transform = Y, Z.PassThrough = X, Z.Stream = Z;
|
|
1708
|
+
function Z() {
|
|
1709
|
+
A.call(this);
|
|
1710
|
+
}
|
|
1711
|
+
Z.prototype.pipe = function(e, t) {
|
|
1712
|
+
var n = this;
|
|
1713
|
+
function r(t) {
|
|
1714
|
+
e.writable && !1 === e.write(t) && n.pause && n.pause();
|
|
1715
|
+
}
|
|
1716
|
+
n.on("data", r);
|
|
1717
|
+
function i() {
|
|
1718
|
+
n.readable && n.resume && n.resume();
|
|
1719
|
+
}
|
|
1720
|
+
e.on("drain", i), !e._isStdio && (!t || t.end !== !1) && (n.on("end", o), n.on("close", s));
|
|
1721
|
+
var a = !1;
|
|
1722
|
+
function o() {
|
|
1723
|
+
a || (a = !0, e.end());
|
|
1724
|
+
}
|
|
1725
|
+
function s() {
|
|
1726
|
+
a || (a = !0, typeof e.destroy == "function" && e.destroy());
|
|
1727
|
+
}
|
|
1728
|
+
function c(e) {
|
|
1729
|
+
if (l(), A.listenerCount(this, "error") === 0) throw e;
|
|
1730
|
+
}
|
|
1731
|
+
n.on("error", c), e.on("error", c);
|
|
1732
|
+
function l() {
|
|
1733
|
+
n.removeListener("data", r), e.removeListener("drain", i), n.removeListener("end", o), n.removeListener("close", s), n.removeListener("error", c), e.removeListener("error", c), n.removeListener("end", l), n.removeListener("close", l), e.removeListener("close", l);
|
|
1734
|
+
}
|
|
1735
|
+
return n.on("end", l), n.on("close", l), e.on("close", l), e.emit("pipe", n), e;
|
|
1736
|
+
};
|
|
1737
|
+
var Bn = function(e) {
|
|
1738
|
+
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
1739
|
+
}, Q = class e extends Error {
|
|
1740
|
+
constructor(t, n, r, ...i) {
|
|
1741
|
+
Array.isArray(n) && (n = n.join(" ").trim()), super(n), Error.captureStackTrace !== void 0 && Error.captureStackTrace(this, e), this.code = t;
|
|
1742
|
+
for (let e of i) for (let t in e) {
|
|
1743
|
+
let n = e[t];
|
|
1744
|
+
this[t] = O(n) ? n.toString(r.encoding) : n == null ? n : JSON.parse(JSON.stringify(n));
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
}, Vn = function(e) {
|
|
1748
|
+
let t = [];
|
|
1749
|
+
for (let n = 0, r = e.length; n < r; n++) {
|
|
1750
|
+
let r = e[n];
|
|
1751
|
+
if (r == null || r === !1) t[n] = { disabled: !0 };
|
|
1752
|
+
else if (typeof r == "string" || typeof r == "number") t[n] = { name: `${r}` };
|
|
1753
|
+
else if (Bn(r)) {
|
|
1754
|
+
if (typeof r.name != "string") throw new Q("CSV_OPTION_COLUMNS_MISSING_NAME", [
|
|
1755
|
+
"Option columns missing name:",
|
|
1756
|
+
`property "name" is required at position ${n}`,
|
|
1757
|
+
"when column is an object literal"
|
|
1758
|
+
]);
|
|
1759
|
+
t[n] = r;
|
|
1760
|
+
} else throw new Q("CSV_INVALID_COLUMN_DEFINITION", [
|
|
1761
|
+
"Invalid column definition:",
|
|
1762
|
+
"expect a string or a literal object,",
|
|
1763
|
+
`got ${JSON.stringify(r)} at position ${n}`
|
|
1764
|
+
]);
|
|
1765
|
+
}
|
|
1766
|
+
return t;
|
|
1767
|
+
}, Hn = class {
|
|
1768
|
+
constructor(e = 100) {
|
|
1769
|
+
this.size = e, this.length = 0, this.buf = _.allocUnsafe(e);
|
|
1770
|
+
}
|
|
1771
|
+
prepend(e) {
|
|
1772
|
+
if (O(e)) {
|
|
1773
|
+
let t = this.length + e.length;
|
|
1774
|
+
if (t >= this.size && (this.resize(), t >= this.size)) throw Error("INVALID_BUFFER_STATE");
|
|
1775
|
+
let n = this.buf;
|
|
1776
|
+
this.buf = _.allocUnsafe(this.size), e.copy(this.buf, 0), n.copy(this.buf, e.length), this.length += e.length;
|
|
1777
|
+
} else {
|
|
1778
|
+
let t = this.length++;
|
|
1779
|
+
t === this.size && this.resize();
|
|
1780
|
+
let n = this.clone();
|
|
1781
|
+
this.buf[0] = e, n.copy(this.buf, 1, 0, t);
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
append(e) {
|
|
1785
|
+
let t = this.length++;
|
|
1786
|
+
t === this.size && this.resize(), this.buf[t] = e;
|
|
1787
|
+
}
|
|
1788
|
+
clone() {
|
|
1789
|
+
return _.from(this.buf.slice(0, this.length));
|
|
1790
|
+
}
|
|
1791
|
+
resize() {
|
|
1792
|
+
let e = this.length;
|
|
1793
|
+
this.size *= 2;
|
|
1794
|
+
let t = _.allocUnsafe(this.size);
|
|
1795
|
+
this.buf.copy(t, 0, 0, e), this.buf = t;
|
|
1796
|
+
}
|
|
1797
|
+
toString(e) {
|
|
1798
|
+
return e ? this.buf.slice(0, this.length).toString(e) : Uint8Array.prototype.slice.call(this.buf.slice(0, this.length));
|
|
1799
|
+
}
|
|
1800
|
+
toJSON() {
|
|
1801
|
+
return this.toString("utf8");
|
|
1802
|
+
}
|
|
1803
|
+
reset() {
|
|
1804
|
+
this.length = 0;
|
|
1805
|
+
}
|
|
1806
|
+
}, Un = 12, Wn = 13, Gn = 10, Kn = 32, qn = 9, Jn = function(e) {
|
|
1807
|
+
return {
|
|
1808
|
+
bomSkipped: !1,
|
|
1809
|
+
bufBytesStart: 0,
|
|
1810
|
+
castField: e.cast_function,
|
|
1811
|
+
commenting: !1,
|
|
1812
|
+
error: void 0,
|
|
1813
|
+
enabled: e.from_line === 1,
|
|
1814
|
+
escaping: !1,
|
|
1815
|
+
escapeIsQuote: O(e.escape) && O(e.quote) && _.compare(e.escape, e.quote) === 0,
|
|
1816
|
+
expectedRecordLength: Array.isArray(e.columns) ? e.columns.length : void 0,
|
|
1817
|
+
field: new Hn(20),
|
|
1818
|
+
firstLineToHeaders: e.cast_first_line_to_header,
|
|
1819
|
+
needMoreDataSize: Math.max(e.comment === null ? 0 : e.comment.length, ...e.delimiter.map((e) => e.length), e.quote === null ? 0 : e.quote.length),
|
|
1820
|
+
previousBuf: void 0,
|
|
1821
|
+
quoting: !1,
|
|
1822
|
+
stop: !1,
|
|
1823
|
+
rawBuffer: new Hn(100),
|
|
1824
|
+
record: [],
|
|
1825
|
+
recordHasError: !1,
|
|
1826
|
+
record_length: 0,
|
|
1827
|
+
recordDelimiterMaxLength: e.record_delimiter.length === 0 ? 0 : Math.max(...e.record_delimiter.map((e) => e.length)),
|
|
1828
|
+
trimChars: [_.from(" ", e.encoding)[0], _.from(" ", e.encoding)[0]],
|
|
1829
|
+
wasQuoting: !1,
|
|
1830
|
+
wasRowDelimiter: !1,
|
|
1831
|
+
timchars: [
|
|
1832
|
+
_.from(_.from([Wn], "utf8").toString(), e.encoding),
|
|
1833
|
+
_.from(_.from([Gn], "utf8").toString(), e.encoding),
|
|
1834
|
+
_.from(_.from([Un], "utf8").toString(), e.encoding),
|
|
1835
|
+
_.from(_.from([Kn], "utf8").toString(), e.encoding),
|
|
1836
|
+
_.from(_.from([qn], "utf8").toString(), e.encoding)
|
|
1837
|
+
]
|
|
1838
|
+
};
|
|
1839
|
+
}, Yn = function(e) {
|
|
1840
|
+
return e.replace(/([A-Z])/g, function(e, t) {
|
|
1841
|
+
return "_" + t.toLowerCase();
|
|
1842
|
+
});
|
|
1843
|
+
}, Xn = function(e) {
|
|
1844
|
+
let t = {};
|
|
1845
|
+
for (let n in e) t[Yn(n)] = e[n];
|
|
1846
|
+
if (t.encoding === void 0 || t.encoding === !0) t.encoding = "utf8";
|
|
1847
|
+
else if (t.encoding === null || t.encoding === !1) t.encoding = null;
|
|
1848
|
+
else if (typeof t.encoding != "string" && t.encoding !== null) throw new Q("CSV_INVALID_OPTION_ENCODING", [
|
|
1849
|
+
"Invalid option encoding:",
|
|
1850
|
+
"encoding must be a string or null to return a buffer,",
|
|
1851
|
+
`got ${JSON.stringify(t.encoding)}`
|
|
1852
|
+
], t);
|
|
1853
|
+
if (t.bom === void 0 || t.bom === null || t.bom === !1) t.bom = !1;
|
|
1854
|
+
else if (t.bom !== !0) throw new Q("CSV_INVALID_OPTION_BOM", [
|
|
1855
|
+
"Invalid option bom:",
|
|
1856
|
+
"bom must be true,",
|
|
1857
|
+
`got ${JSON.stringify(t.bom)}`
|
|
1858
|
+
], t);
|
|
1859
|
+
if (t.cast_function = null, t.cast === void 0 || t.cast === null || t.cast === !1 || t.cast === "") t.cast = void 0;
|
|
1860
|
+
else if (typeof t.cast == "function") t.cast_function = t.cast, t.cast = !0;
|
|
1861
|
+
else if (t.cast !== !0) throw new Q("CSV_INVALID_OPTION_CAST", [
|
|
1862
|
+
"Invalid option cast:",
|
|
1863
|
+
"cast must be true or a function,",
|
|
1864
|
+
`got ${JSON.stringify(t.cast)}`
|
|
1865
|
+
], t);
|
|
1866
|
+
if (t.cast_date === void 0 || t.cast_date === null || t.cast_date === !1 || t.cast_date === "") t.cast_date = !1;
|
|
1867
|
+
else if (t.cast_date === !0) t.cast_date = function(e) {
|
|
1868
|
+
let t = Date.parse(e);
|
|
1869
|
+
return isNaN(t) ? e : new Date(t);
|
|
1870
|
+
};
|
|
1871
|
+
else if (typeof t.cast_date != "function") throw new Q("CSV_INVALID_OPTION_CAST_DATE", [
|
|
1872
|
+
"Invalid option cast_date:",
|
|
1873
|
+
"cast_date must be true or a function,",
|
|
1874
|
+
`got ${JSON.stringify(t.cast_date)}`
|
|
1875
|
+
], t);
|
|
1876
|
+
if (t.cast_first_line_to_header = void 0, t.columns === !0) t.cast_first_line_to_header = void 0;
|
|
1877
|
+
else if (typeof t.columns == "function") t.cast_first_line_to_header = t.columns, t.columns = !0;
|
|
1878
|
+
else if (Array.isArray(t.columns)) t.columns = Vn(t.columns);
|
|
1879
|
+
else if (t.columns === void 0 || t.columns === null || t.columns === !1) t.columns = !1;
|
|
1880
|
+
else throw new Q("CSV_INVALID_OPTION_COLUMNS", [
|
|
1881
|
+
"Invalid option columns:",
|
|
1882
|
+
"expect an array, a function or true,",
|
|
1883
|
+
`got ${JSON.stringify(t.columns)}`
|
|
1884
|
+
], t);
|
|
1885
|
+
if (t.group_columns_by_name === void 0 || t.group_columns_by_name === null || t.group_columns_by_name === !1) t.group_columns_by_name = !1;
|
|
1886
|
+
else if (t.group_columns_by_name !== !0) throw new Q("CSV_INVALID_OPTION_GROUP_COLUMNS_BY_NAME", [
|
|
1887
|
+
"Invalid option group_columns_by_name:",
|
|
1888
|
+
"expect an boolean,",
|
|
1889
|
+
`got ${JSON.stringify(t.group_columns_by_name)}`
|
|
1890
|
+
], t);
|
|
1891
|
+
else if (t.columns === !1) throw new Q("CSV_INVALID_OPTION_GROUP_COLUMNS_BY_NAME", ["Invalid option group_columns_by_name:", "the `columns` mode must be activated."], t);
|
|
1892
|
+
if (t.comment === void 0 || t.comment === null || t.comment === !1 || t.comment === "") t.comment = null;
|
|
1893
|
+
else if (typeof t.comment == "string" && (t.comment = _.from(t.comment, t.encoding)), !O(t.comment)) throw new Q("CSV_INVALID_OPTION_COMMENT", [
|
|
1894
|
+
"Invalid option comment:",
|
|
1895
|
+
"comment must be a buffer or a string,",
|
|
1896
|
+
`got ${JSON.stringify(t.comment)}`
|
|
1897
|
+
], t);
|
|
1898
|
+
if (t.comment_no_infix === void 0 || t.comment_no_infix === null || t.comment_no_infix === !1) t.comment_no_infix = !1;
|
|
1899
|
+
else if (t.comment_no_infix !== !0) throw new Q("CSV_INVALID_OPTION_COMMENT", [
|
|
1900
|
+
"Invalid option comment_no_infix:",
|
|
1901
|
+
"value must be a boolean,",
|
|
1902
|
+
`got ${JSON.stringify(t.comment_no_infix)}`
|
|
1903
|
+
], t);
|
|
1904
|
+
let n = JSON.stringify(t.delimiter);
|
|
1905
|
+
if (Array.isArray(t.delimiter) || (t.delimiter = [t.delimiter]), t.delimiter.length === 0) throw new Q("CSV_INVALID_OPTION_DELIMITER", [
|
|
1906
|
+
"Invalid option delimiter:",
|
|
1907
|
+
"delimiter must be a non empty string or buffer or array of string|buffer,",
|
|
1908
|
+
`got ${n}`
|
|
1909
|
+
], t);
|
|
1910
|
+
if (t.delimiter = t.delimiter.map(function(e) {
|
|
1911
|
+
if (e == null || e === !1) return _.from(",", t.encoding);
|
|
1912
|
+
if (typeof e == "string" && (e = _.from(e, t.encoding)), !O(e) || e.length === 0) throw new Q("CSV_INVALID_OPTION_DELIMITER", [
|
|
1913
|
+
"Invalid option delimiter:",
|
|
1914
|
+
"delimiter must be a non empty string or buffer or array of string|buffer,",
|
|
1915
|
+
`got ${n}`
|
|
1916
|
+
], t);
|
|
1917
|
+
return e;
|
|
1918
|
+
}), t.escape === void 0 || t.escape === !0 ? t.escape = _.from("\"", t.encoding) : typeof t.escape == "string" ? t.escape = _.from(t.escape, t.encoding) : (t.escape === null || t.escape === !1) && (t.escape = null), t.escape !== null && !O(t.escape)) throw Error(`Invalid Option: escape must be a buffer, a string or a boolean, got ${JSON.stringify(t.escape)}`);
|
|
1919
|
+
if (t.from === void 0 || t.from === null) t.from = 1;
|
|
1920
|
+
else if (typeof t.from == "string" && /\d+/.test(t.from) && (t.from = parseInt(t.from)), Number.isInteger(t.from)) {
|
|
1921
|
+
if (t.from < 0) throw Error(`Invalid Option: from must be a positive integer, got ${JSON.stringify(e.from)}`);
|
|
1922
|
+
} else throw Error(`Invalid Option: from must be an integer, got ${JSON.stringify(t.from)}`);
|
|
1923
|
+
if (t.from_line === void 0 || t.from_line === null) t.from_line = 1;
|
|
1924
|
+
else if (typeof t.from_line == "string" && /\d+/.test(t.from_line) && (t.from_line = parseInt(t.from_line)), Number.isInteger(t.from_line)) {
|
|
1925
|
+
if (t.from_line <= 0) throw Error(`Invalid Option: from_line must be a positive integer greater than 0, got ${JSON.stringify(e.from_line)}`);
|
|
1926
|
+
} else throw Error(`Invalid Option: from_line must be an integer, got ${JSON.stringify(e.from_line)}`);
|
|
1927
|
+
if (t.ignore_last_delimiters === void 0 || t.ignore_last_delimiters === null) t.ignore_last_delimiters = !1;
|
|
1928
|
+
else if (typeof t.ignore_last_delimiters == "number") t.ignore_last_delimiters = Math.floor(t.ignore_last_delimiters), t.ignore_last_delimiters === 0 && (t.ignore_last_delimiters = !1);
|
|
1929
|
+
else if (typeof t.ignore_last_delimiters != "boolean") throw new Q("CSV_INVALID_OPTION_IGNORE_LAST_DELIMITERS", [
|
|
1930
|
+
"Invalid option `ignore_last_delimiters`:",
|
|
1931
|
+
"the value must be a boolean value or an integer,",
|
|
1932
|
+
`got ${JSON.stringify(t.ignore_last_delimiters)}`
|
|
1933
|
+
], t);
|
|
1934
|
+
if (t.ignore_last_delimiters === !0 && t.columns === !1) throw new Q("CSV_IGNORE_LAST_DELIMITERS_REQUIRES_COLUMNS", ["The option `ignore_last_delimiters`", "requires the activation of the `columns` option"], t);
|
|
1935
|
+
if (t.info === void 0 || t.info === null || t.info === !1) t.info = !1;
|
|
1936
|
+
else if (t.info !== !0) throw Error(`Invalid Option: info must be true, got ${JSON.stringify(t.info)}`);
|
|
1937
|
+
if (t.max_record_size === void 0 || t.max_record_size === null || t.max_record_size === !1) t.max_record_size = 0;
|
|
1938
|
+
else if (!(Number.isInteger(t.max_record_size) && t.max_record_size >= 0)) if (typeof t.max_record_size == "string" && /\d+/.test(t.max_record_size)) t.max_record_size = parseInt(t.max_record_size);
|
|
1939
|
+
else throw Error(`Invalid Option: max_record_size must be a positive integer, got ${JSON.stringify(t.max_record_size)}`);
|
|
1940
|
+
if (t.objname === void 0 || t.objname === null || t.objname === !1) t.objname = void 0;
|
|
1941
|
+
else if (O(t.objname)) {
|
|
1942
|
+
if (t.objname.length === 0) throw Error("Invalid Option: objname must be a non empty buffer");
|
|
1943
|
+
t.encoding === null || (t.objname = t.objname.toString(t.encoding));
|
|
1944
|
+
} else if (typeof t.objname == "string") {
|
|
1945
|
+
if (t.objname.length === 0) throw Error("Invalid Option: objname must be a non empty string");
|
|
1946
|
+
} else if (typeof t.objname != "number") throw Error(`Invalid Option: objname must be a string or a buffer, got ${t.objname}`);
|
|
1947
|
+
if (t.objname !== void 0) {
|
|
1948
|
+
if (typeof t.objname == "number") {
|
|
1949
|
+
if (t.columns !== !1) throw Error("Invalid Option: objname index cannot be combined with columns or be defined as a field");
|
|
1950
|
+
} else if (t.columns === !1) throw Error("Invalid Option: objname field must be combined with columns or be defined as an index");
|
|
1951
|
+
}
|
|
1952
|
+
if (t.on_record === void 0 || t.on_record === null) t.on_record = void 0;
|
|
1953
|
+
else if (typeof t.on_record != "function") throw new Q("CSV_INVALID_OPTION_ON_RECORD", [
|
|
1954
|
+
"Invalid option `on_record`:",
|
|
1955
|
+
"expect a function,",
|
|
1956
|
+
`got ${JSON.stringify(t.on_record)}`
|
|
1957
|
+
], t);
|
|
1958
|
+
if (t.on_skip !== void 0 && t.on_skip !== null && typeof t.on_skip != "function") throw Error(`Invalid Option: on_skip must be a function, got ${JSON.stringify(t.on_skip)}`);
|
|
1959
|
+
if (t.quote === null || t.quote === !1 || t.quote === "") t.quote = null;
|
|
1960
|
+
else if (t.quote === void 0 || t.quote === !0 ? t.quote = _.from("\"", t.encoding) : typeof t.quote == "string" && (t.quote = _.from(t.quote, t.encoding)), !O(t.quote)) throw Error(`Invalid Option: quote must be a buffer or a string, got ${JSON.stringify(t.quote)}`);
|
|
1961
|
+
if (t.raw === void 0 || t.raw === null || t.raw === !1) t.raw = !1;
|
|
1962
|
+
else if (t.raw !== !0) throw Error(`Invalid Option: raw must be true, got ${JSON.stringify(t.raw)}`);
|
|
1963
|
+
if (t.record_delimiter === void 0) t.record_delimiter = [];
|
|
1964
|
+
else if (typeof t.record_delimiter == "string" || O(t.record_delimiter)) {
|
|
1965
|
+
if (t.record_delimiter.length === 0) throw new Q("CSV_INVALID_OPTION_RECORD_DELIMITER", [
|
|
1966
|
+
"Invalid option `record_delimiter`:",
|
|
1967
|
+
"value must be a non empty string or buffer,",
|
|
1968
|
+
`got ${JSON.stringify(t.record_delimiter)}`
|
|
1969
|
+
], t);
|
|
1970
|
+
t.record_delimiter = [t.record_delimiter];
|
|
1971
|
+
} else if (!Array.isArray(t.record_delimiter)) throw new Q("CSV_INVALID_OPTION_RECORD_DELIMITER", [
|
|
1972
|
+
"Invalid option `record_delimiter`:",
|
|
1973
|
+
"value must be a string, a buffer or array of string|buffer,",
|
|
1974
|
+
`got ${JSON.stringify(t.record_delimiter)}`
|
|
1975
|
+
], t);
|
|
1976
|
+
if (t.record_delimiter = t.record_delimiter.map(function(e, n) {
|
|
1977
|
+
if (typeof e != "string" && !O(e)) throw new Q("CSV_INVALID_OPTION_RECORD_DELIMITER", [
|
|
1978
|
+
"Invalid option `record_delimiter`:",
|
|
1979
|
+
"value must be a string, a buffer or array of string|buffer",
|
|
1980
|
+
`at index ${n},`,
|
|
1981
|
+
`got ${JSON.stringify(e)}`
|
|
1982
|
+
], t);
|
|
1983
|
+
if (e.length === 0) throw new Q("CSV_INVALID_OPTION_RECORD_DELIMITER", [
|
|
1984
|
+
"Invalid option `record_delimiter`:",
|
|
1985
|
+
"value must be a non empty string or buffer",
|
|
1986
|
+
`at index ${n},`,
|
|
1987
|
+
`got ${JSON.stringify(e)}`
|
|
1988
|
+
], t);
|
|
1989
|
+
return typeof e == "string" && (e = _.from(e, t.encoding)), e;
|
|
1990
|
+
}), typeof t.relax_column_count != "boolean") if (t.relax_column_count === void 0 || t.relax_column_count === null) t.relax_column_count = !1;
|
|
1991
|
+
else throw Error(`Invalid Option: relax_column_count must be a boolean, got ${JSON.stringify(t.relax_column_count)}`);
|
|
1992
|
+
if (typeof t.relax_column_count_less != "boolean") if (t.relax_column_count_less === void 0 || t.relax_column_count_less === null) t.relax_column_count_less = !1;
|
|
1993
|
+
else throw Error(`Invalid Option: relax_column_count_less must be a boolean, got ${JSON.stringify(t.relax_column_count_less)}`);
|
|
1994
|
+
if (typeof t.relax_column_count_more != "boolean") if (t.relax_column_count_more === void 0 || t.relax_column_count_more === null) t.relax_column_count_more = !1;
|
|
1995
|
+
else throw Error(`Invalid Option: relax_column_count_more must be a boolean, got ${JSON.stringify(t.relax_column_count_more)}`);
|
|
1996
|
+
if (typeof t.relax_quotes != "boolean") if (t.relax_quotes === void 0 || t.relax_quotes === null) t.relax_quotes = !1;
|
|
1997
|
+
else throw Error(`Invalid Option: relax_quotes must be a boolean, got ${JSON.stringify(t.relax_quotes)}`);
|
|
1998
|
+
if (typeof t.skip_empty_lines != "boolean") if (t.skip_empty_lines === void 0 || t.skip_empty_lines === null) t.skip_empty_lines = !1;
|
|
1999
|
+
else throw Error(`Invalid Option: skip_empty_lines must be a boolean, got ${JSON.stringify(t.skip_empty_lines)}`);
|
|
2000
|
+
if (typeof t.skip_records_with_empty_values != "boolean") if (t.skip_records_with_empty_values === void 0 || t.skip_records_with_empty_values === null) t.skip_records_with_empty_values = !1;
|
|
2001
|
+
else throw Error(`Invalid Option: skip_records_with_empty_values must be a boolean, got ${JSON.stringify(t.skip_records_with_empty_values)}`);
|
|
2002
|
+
if (typeof t.skip_records_with_error != "boolean") if (t.skip_records_with_error === void 0 || t.skip_records_with_error === null) t.skip_records_with_error = !1;
|
|
2003
|
+
else throw Error(`Invalid Option: skip_records_with_error must be a boolean, got ${JSON.stringify(t.skip_records_with_error)}`);
|
|
2004
|
+
if (t.rtrim === void 0 || t.rtrim === null || t.rtrim === !1) t.rtrim = !1;
|
|
2005
|
+
else if (t.rtrim !== !0) throw Error(`Invalid Option: rtrim must be a boolean, got ${JSON.stringify(t.rtrim)}`);
|
|
2006
|
+
if (t.ltrim === void 0 || t.ltrim === null || t.ltrim === !1) t.ltrim = !1;
|
|
2007
|
+
else if (t.ltrim !== !0) throw Error(`Invalid Option: ltrim must be a boolean, got ${JSON.stringify(t.ltrim)}`);
|
|
2008
|
+
if (t.trim === void 0 || t.trim === null || t.trim === !1) t.trim = !1;
|
|
2009
|
+
else if (t.trim !== !0) throw Error(`Invalid Option: trim must be a boolean, got ${JSON.stringify(t.trim)}`);
|
|
2010
|
+
if (t.trim === !0 && e.ltrim !== !1 ? t.ltrim = !0 : t.ltrim !== !0 && (t.ltrim = !1), t.trim === !0 && e.rtrim !== !1 ? t.rtrim = !0 : t.rtrim !== !0 && (t.rtrim = !1), t.to === void 0 || t.to === null) t.to = -1;
|
|
2011
|
+
else if (t.to !== -1) if (typeof t.to == "string" && /\d+/.test(t.to) && (t.to = parseInt(t.to)), Number.isInteger(t.to)) {
|
|
2012
|
+
if (t.to <= 0) throw Error(`Invalid Option: to must be a positive integer greater than 0, got ${JSON.stringify(e.to)}`);
|
|
2013
|
+
} else throw Error(`Invalid Option: to must be an integer, got ${JSON.stringify(e.to)}`);
|
|
2014
|
+
if (t.to_line === void 0 || t.to_line === null) t.to_line = -1;
|
|
2015
|
+
else if (t.to_line !== -1) if (typeof t.to_line == "string" && /\d+/.test(t.to_line) && (t.to_line = parseInt(t.to_line)), Number.isInteger(t.to_line)) {
|
|
2016
|
+
if (t.to_line <= 0) throw Error(`Invalid Option: to_line must be a positive integer greater than 0, got ${JSON.stringify(e.to_line)}`);
|
|
2017
|
+
} else throw Error(`Invalid Option: to_line must be an integer, got ${JSON.stringify(e.to_line)}`);
|
|
2018
|
+
return t;
|
|
2019
|
+
}, Zn = function(e) {
|
|
2020
|
+
return e.every((e) => e == null || e.toString && e.toString().trim() === "");
|
|
2021
|
+
}, Qn = 13, $n = 10, $ = {
|
|
2022
|
+
utf8: _.from([
|
|
2023
|
+
239,
|
|
2024
|
+
187,
|
|
2025
|
+
191
|
|
2026
|
+
]),
|
|
2027
|
+
utf16le: _.from([255, 254])
|
|
2028
|
+
}, er = function(e = {}) {
|
|
2029
|
+
let t = {
|
|
2030
|
+
bytes: 0,
|
|
2031
|
+
bytes_records: 0,
|
|
2032
|
+
comment_lines: 0,
|
|
2033
|
+
empty_lines: 0,
|
|
2034
|
+
invalid_field_length: 0,
|
|
2035
|
+
lines: 1,
|
|
2036
|
+
records: 0
|
|
2037
|
+
}, n = Xn(e);
|
|
2038
|
+
return {
|
|
2039
|
+
info: t,
|
|
2040
|
+
original_options: e,
|
|
2041
|
+
options: n,
|
|
2042
|
+
state: Jn(n),
|
|
2043
|
+
__needMoreData: function(e, t, n) {
|
|
2044
|
+
if (n) return !1;
|
|
2045
|
+
let { encoding: r, escape: i, quote: a } = this.options, { quoting: o, needMoreDataSize: s, recordDelimiterMaxLength: c } = this.state;
|
|
2046
|
+
return t - e - 1 < Math.max(s, c === 0 ? _.from("\r\n", r).length : c, o ? (i === null ? 0 : i.length) + a.length : 0, o ? a.length + c : 0);
|
|
2047
|
+
},
|
|
2048
|
+
parse: function(e, t, n, r) {
|
|
2049
|
+
let { bom: i, comment_no_infix: a, encoding: o, from_line: s, ltrim: c, max_record_size: l, raw: u, relax_quotes: d, rtrim: f, skip_empty_lines: p, to: m, to_line: h } = this.options, { comment: g, escape: v, quote: y, record_delimiter: ee } = this.options, { bomSkipped: te, previousBuf: b, rawBuffer: ne, escapeIsQuote: re } = this.state, x;
|
|
2050
|
+
if (b === void 0) if (e === void 0) {
|
|
2051
|
+
r();
|
|
2052
|
+
return;
|
|
2053
|
+
} else x = e;
|
|
2054
|
+
else x = b !== void 0 && e === void 0 ? b : _.concat([b, e]);
|
|
2055
|
+
if (te === !1) if (i === !1) this.state.bomSkipped = !0;
|
|
2056
|
+
else if (x.length < 3) {
|
|
2057
|
+
if (t === !1) {
|
|
2058
|
+
this.state.previousBuf = x;
|
|
2059
|
+
return;
|
|
2060
|
+
}
|
|
2061
|
+
} else {
|
|
2062
|
+
for (let e in $) if ($[e].compare(x, 0, $[e].length) === 0) {
|
|
2063
|
+
let t = $[e].length;
|
|
2064
|
+
this.state.bufBytesStart += t, x = x.slice(t);
|
|
2065
|
+
let n = Xn({
|
|
2066
|
+
...this.original_options,
|
|
2067
|
+
encoding: e
|
|
2068
|
+
});
|
|
2069
|
+
for (let e in n) this.options[e] = n[e];
|
|
2070
|
+
({comment: g, escape: v, quote: y} = this.options);
|
|
2071
|
+
break;
|
|
2072
|
+
}
|
|
2073
|
+
this.state.bomSkipped = !0;
|
|
2074
|
+
}
|
|
2075
|
+
let S = x.length, C;
|
|
2076
|
+
for (C = 0; C < S && !this.__needMoreData(C, S, t); C++) {
|
|
2077
|
+
if (this.state.wasRowDelimiter === !0 && (this.info.lines++, this.state.wasRowDelimiter = !1), h !== -1 && this.info.lines > h) {
|
|
2078
|
+
this.state.stop = !0, r();
|
|
2079
|
+
return;
|
|
2080
|
+
}
|
|
2081
|
+
this.state.quoting === !1 && ee.length === 0 && this.__autoDiscoverRecordDelimiter(x, C) && (ee = this.options.record_delimiter);
|
|
2082
|
+
let e = x[C];
|
|
2083
|
+
if (u === !0 && ne.append(e), (e === Qn || e === $n) && this.state.wasRowDelimiter === !1 && (this.state.wasRowDelimiter = !0), this.state.escaping === !0) this.state.escaping = !1;
|
|
2084
|
+
else {
|
|
2085
|
+
if (v !== null && this.state.quoting === !0 && this.__isEscape(x, C, e) && C + v.length < S) if (re) {
|
|
2086
|
+
if (this.__isQuote(x, C + v.length)) {
|
|
2087
|
+
this.state.escaping = !0, C += v.length - 1;
|
|
2088
|
+
continue;
|
|
2089
|
+
}
|
|
2090
|
+
} else {
|
|
2091
|
+
this.state.escaping = !0, C += v.length - 1;
|
|
2092
|
+
continue;
|
|
2093
|
+
}
|
|
2094
|
+
if (this.state.commenting === !1 && this.__isQuote(x, C)) if (this.state.quoting === !0) {
|
|
2095
|
+
let t = x[C + y.length], n = f && this.__isCharTrimable(x, C + y.length), r = g !== null && this.__compareBytes(g, x, C + y.length, t), i = this.__isDelimiter(x, C + y.length, t), a = ee.length === 0 ? this.__autoDiscoverRecordDelimiter(x, C + y.length) : this.__isRecordDelimiter(t, x, C + y.length);
|
|
2096
|
+
if (v !== null && this.__isEscape(x, C, e) && this.__isQuote(x, C + v.length)) C += v.length - 1;
|
|
2097
|
+
else if (!t || i || a || r || n) {
|
|
2098
|
+
this.state.quoting = !1, this.state.wasQuoting = !0, C += y.length - 1;
|
|
2099
|
+
continue;
|
|
2100
|
+
} else if (d === !1) {
|
|
2101
|
+
let e = this.__error(new Q("CSV_INVALID_CLOSING_QUOTE", [
|
|
2102
|
+
"Invalid Closing Quote:",
|
|
2103
|
+
`got "${String.fromCharCode(t)}"`,
|
|
2104
|
+
`at line ${this.info.lines}`,
|
|
2105
|
+
"instead of delimiter, record delimiter, trimable character",
|
|
2106
|
+
"(if activated) or comment"
|
|
2107
|
+
], this.options, this.__infoField()));
|
|
2108
|
+
if (e !== void 0) return e;
|
|
2109
|
+
} else this.state.quoting = !1, this.state.wasQuoting = !0, this.state.field.prepend(y), C += y.length - 1;
|
|
2110
|
+
} else if (this.state.field.length !== 0) {
|
|
2111
|
+
if (d === !1) {
|
|
2112
|
+
let e = this.__infoField(), t = Object.keys($).map((e) => $[e].equals(this.state.field.toString()) ? e : !1).filter(Boolean)[0], n = this.__error(new Q("INVALID_OPENING_QUOTE", [
|
|
2113
|
+
"Invalid Opening Quote:",
|
|
2114
|
+
`a quote is found on field ${JSON.stringify(e.column)} at line ${e.lines}, value is ${JSON.stringify(this.state.field.toString(o))}`,
|
|
2115
|
+
t ? `(${t} bom)` : void 0
|
|
2116
|
+
], this.options, e, { field: this.state.field }));
|
|
2117
|
+
if (n !== void 0) return n;
|
|
2118
|
+
}
|
|
2119
|
+
} else {
|
|
2120
|
+
this.state.quoting = !0, C += y.length - 1;
|
|
2121
|
+
continue;
|
|
2122
|
+
}
|
|
2123
|
+
if (this.state.quoting === !1) {
|
|
2124
|
+
let t = this.__isRecordDelimiter(e, x, C);
|
|
2125
|
+
if (t !== 0) {
|
|
2126
|
+
if (this.state.commenting && this.state.wasQuoting === !1 && this.state.record.length === 0 && this.state.field.length === 0) this.info.comment_lines++;
|
|
2127
|
+
else {
|
|
2128
|
+
if (this.state.enabled === !1 && this.info.lines + (this.state.wasRowDelimiter === !0 ? 1 : 0) >= s) {
|
|
2129
|
+
this.state.enabled = !0, this.__resetField(), this.__resetRecord(), C += t - 1;
|
|
2130
|
+
continue;
|
|
2131
|
+
}
|
|
2132
|
+
if (p === !0 && this.state.wasQuoting === !1 && this.state.record.length === 0 && this.state.field.length === 0) {
|
|
2133
|
+
this.info.empty_lines++, C += t - 1;
|
|
2134
|
+
continue;
|
|
2135
|
+
}
|
|
2136
|
+
this.info.bytes = this.state.bufBytesStart + C;
|
|
2137
|
+
let e = this.__onField();
|
|
2138
|
+
if (e !== void 0) return e;
|
|
2139
|
+
this.info.bytes = this.state.bufBytesStart + C + t;
|
|
2140
|
+
let i = this.__onRecord(n);
|
|
2141
|
+
if (i !== void 0) return i;
|
|
2142
|
+
if (m !== -1 && this.info.records >= m) {
|
|
2143
|
+
this.state.stop = !0, r();
|
|
2144
|
+
return;
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
this.state.commenting = !1, C += t - 1;
|
|
2148
|
+
continue;
|
|
2149
|
+
}
|
|
2150
|
+
if (this.state.commenting) continue;
|
|
2151
|
+
if (g !== null && (a === !1 || this.state.record.length === 0 && this.state.field.length === 0) && this.__compareBytes(g, x, C, e) !== 0) {
|
|
2152
|
+
this.state.commenting = !0;
|
|
2153
|
+
continue;
|
|
2154
|
+
}
|
|
2155
|
+
let i = this.__isDelimiter(x, C, e);
|
|
2156
|
+
if (i !== 0) {
|
|
2157
|
+
this.info.bytes = this.state.bufBytesStart + C;
|
|
2158
|
+
let e = this.__onField();
|
|
2159
|
+
if (e !== void 0) return e;
|
|
2160
|
+
C += i - 1;
|
|
2161
|
+
continue;
|
|
2162
|
+
}
|
|
2163
|
+
}
|
|
2164
|
+
}
|
|
2165
|
+
if (this.state.commenting === !1 && l !== 0 && this.state.record_length + this.state.field.length > l) return this.__error(new Q("CSV_MAX_RECORD_SIZE", [
|
|
2166
|
+
"Max Record Size:",
|
|
2167
|
+
"record exceed the maximum number of tolerated bytes",
|
|
2168
|
+
`of ${l}`,
|
|
2169
|
+
`at line ${this.info.lines}`
|
|
2170
|
+
], this.options, this.__infoField()));
|
|
2171
|
+
let t = c === !1 || this.state.quoting === !0 || this.state.field.length !== 0 || !this.__isCharTrimable(x, C), i = f === !1 || this.state.wasQuoting === !1;
|
|
2172
|
+
if (t === !0 && i === !0) this.state.field.append(e);
|
|
2173
|
+
else if (f === !0 && !this.__isCharTrimable(x, C)) return this.__error(new Q("CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE", [
|
|
2174
|
+
"Invalid Closing Quote:",
|
|
2175
|
+
"found non trimable byte after quote",
|
|
2176
|
+
`at line ${this.info.lines}`
|
|
2177
|
+
], this.options, this.__infoField()));
|
|
2178
|
+
else {
|
|
2179
|
+
t === !1 && (C += this.__isCharTrimable(x, C) - 1);
|
|
2180
|
+
continue;
|
|
2181
|
+
}
|
|
2182
|
+
}
|
|
2183
|
+
if (t === !0) if (this.state.quoting === !0) {
|
|
2184
|
+
let e = this.__error(new Q("CSV_QUOTE_NOT_CLOSED", ["Quote Not Closed:", `the parsing is finished with an opening quote at line ${this.info.lines}`], this.options, this.__infoField()));
|
|
2185
|
+
if (e !== void 0) return e;
|
|
2186
|
+
} else if (this.state.wasQuoting === !0 || this.state.record.length !== 0 || this.state.field.length !== 0) {
|
|
2187
|
+
this.info.bytes = this.state.bufBytesStart + C;
|
|
2188
|
+
let e = this.__onField();
|
|
2189
|
+
if (e !== void 0) return e;
|
|
2190
|
+
let t = this.__onRecord(n);
|
|
2191
|
+
if (t !== void 0) return t;
|
|
2192
|
+
} else this.state.wasRowDelimiter === !0 ? this.info.empty_lines++ : this.state.commenting === !0 && this.info.comment_lines++;
|
|
2193
|
+
else this.state.bufBytesStart += C, this.state.previousBuf = x.slice(C);
|
|
2194
|
+
this.state.wasRowDelimiter === !0 && (this.info.lines++, this.state.wasRowDelimiter = !1);
|
|
2195
|
+
},
|
|
2196
|
+
__onRecord: function(e) {
|
|
2197
|
+
let { columns: t, group_columns_by_name: n, encoding: r, info: i, from: a, relax_column_count: o, relax_column_count_less: s, relax_column_count_more: c, raw: l, skip_records_with_empty_values: u } = this.options, { enabled: d, record: f } = this.state;
|
|
2198
|
+
if (d === !1) return this.__resetRecord();
|
|
2199
|
+
let p = f.length;
|
|
2200
|
+
if (t === !0) {
|
|
2201
|
+
if (u === !0 && Zn(f)) {
|
|
2202
|
+
this.__resetRecord();
|
|
2203
|
+
return;
|
|
2204
|
+
}
|
|
2205
|
+
return this.__firstLineToColumns(f);
|
|
2206
|
+
}
|
|
2207
|
+
if (t === !1 && this.info.records === 0 && (this.state.expectedRecordLength = p), p !== this.state.expectedRecordLength) {
|
|
2208
|
+
let e = t === !1 ? new Q("CSV_RECORD_INCONSISTENT_FIELDS_LENGTH", [
|
|
2209
|
+
"Invalid Record Length:",
|
|
2210
|
+
`expect ${this.state.expectedRecordLength},`,
|
|
2211
|
+
`got ${p} on line ${this.info.lines}`
|
|
2212
|
+
], this.options, this.__infoField(), { record: f }) : new Q("CSV_RECORD_INCONSISTENT_COLUMNS", [
|
|
2213
|
+
"Invalid Record Length:",
|
|
2214
|
+
`columns length is ${t.length},`,
|
|
2215
|
+
`got ${p} on line ${this.info.lines}`
|
|
2216
|
+
], this.options, this.__infoField(), { record: f });
|
|
2217
|
+
if (o === !0 || s === !0 && p < this.state.expectedRecordLength || c === !0 && p > this.state.expectedRecordLength) this.info.invalid_field_length++, this.state.error = e;
|
|
2218
|
+
else {
|
|
2219
|
+
let t = this.__error(e);
|
|
2220
|
+
if (t) return t;
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
if (u === !0 && Zn(f)) {
|
|
2224
|
+
this.__resetRecord();
|
|
2225
|
+
return;
|
|
2226
|
+
}
|
|
2227
|
+
if (this.state.recordHasError === !0) {
|
|
2228
|
+
this.__resetRecord(), this.state.recordHasError = !1;
|
|
2229
|
+
return;
|
|
2230
|
+
}
|
|
2231
|
+
if (this.info.records++, a === 1 || this.info.records >= a) {
|
|
2232
|
+
let { objname: a } = this.options;
|
|
2233
|
+
if (t !== !1) {
|
|
2234
|
+
let o = {};
|
|
2235
|
+
for (let e = 0, r = f.length; e < r; e++) t[e] === void 0 || t[e].disabled || (n === !0 && o[t[e].name] !== void 0 ? Array.isArray(o[t[e].name]) ? o[t[e].name] = o[t[e].name].concat(f[e]) : o[t[e].name] = [o[t[e].name], f[e]] : o[t[e].name] = f[e]);
|
|
2236
|
+
if (l === !0 || i === !0) {
|
|
2237
|
+
let t = Object.assign({ record: o }, l === !0 ? { raw: this.state.rawBuffer.toString(r) } : {}, i === !0 ? { info: this.__infoRecord() } : {}), n = this.__push(a === void 0 ? t : [o[a], t], e);
|
|
2238
|
+
if (n) return n;
|
|
2239
|
+
} else {
|
|
2240
|
+
let t = this.__push(a === void 0 ? o : [o[a], o], e);
|
|
2241
|
+
if (t) return t;
|
|
2242
|
+
}
|
|
2243
|
+
} else if (l === !0 || i === !0) {
|
|
2244
|
+
let t = Object.assign({ record: f }, l === !0 ? { raw: this.state.rawBuffer.toString(r) } : {}, i === !0 ? { info: this.__infoRecord() } : {}), n = this.__push(a === void 0 ? t : [f[a], t], e);
|
|
2245
|
+
if (n) return n;
|
|
2246
|
+
} else {
|
|
2247
|
+
let t = this.__push(a === void 0 ? f : [f[a], f], e);
|
|
2248
|
+
if (t) return t;
|
|
2249
|
+
}
|
|
2250
|
+
}
|
|
2251
|
+
this.__resetRecord();
|
|
2252
|
+
},
|
|
2253
|
+
__firstLineToColumns: function(e) {
|
|
2254
|
+
let { firstLineToHeaders: t } = this.state;
|
|
2255
|
+
try {
|
|
2256
|
+
let n = t === void 0 ? e : t.call(null, e);
|
|
2257
|
+
if (!Array.isArray(n)) return this.__error(new Q("CSV_INVALID_COLUMN_MAPPING", [
|
|
2258
|
+
"Invalid Column Mapping:",
|
|
2259
|
+
"expect an array from column function,",
|
|
2260
|
+
`got ${JSON.stringify(n)}`
|
|
2261
|
+
], this.options, this.__infoField(), { headers: n }));
|
|
2262
|
+
let r = Vn(n);
|
|
2263
|
+
this.state.expectedRecordLength = r.length, this.options.columns = r, this.__resetRecord();
|
|
2264
|
+
return;
|
|
2265
|
+
} catch (e) {
|
|
2266
|
+
return e;
|
|
2267
|
+
}
|
|
2268
|
+
},
|
|
2269
|
+
__resetRecord: function() {
|
|
2270
|
+
this.options.raw === !0 && this.state.rawBuffer.reset(), this.state.error = void 0, this.state.record = [], this.state.record_length = 0;
|
|
2271
|
+
},
|
|
2272
|
+
__onField: function() {
|
|
2273
|
+
let { cast: e, encoding: t, rtrim: n, max_record_size: r } = this.options, { enabled: i, wasQuoting: a } = this.state;
|
|
2274
|
+
if (i === !1) return this.__resetField();
|
|
2275
|
+
let o = this.state.field.toString(t);
|
|
2276
|
+
if (n === !0 && a === !1 && (o = o.trimRight()), e === !0) {
|
|
2277
|
+
let [e, t] = this.__cast(o);
|
|
2278
|
+
if (e !== void 0) return e;
|
|
2279
|
+
o = t;
|
|
2280
|
+
}
|
|
2281
|
+
this.state.record.push(o), r !== 0 && typeof o == "string" && (this.state.record_length += o.length), this.__resetField();
|
|
2282
|
+
},
|
|
2283
|
+
__resetField: function() {
|
|
2284
|
+
this.state.field.reset(), this.state.wasQuoting = !1;
|
|
2285
|
+
},
|
|
2286
|
+
__push: function(e, t) {
|
|
2287
|
+
let { on_record: n } = this.options;
|
|
2288
|
+
if (n !== void 0) {
|
|
2289
|
+
let t = this.__infoRecord();
|
|
2290
|
+
try {
|
|
2291
|
+
e = n.call(null, e, t);
|
|
2292
|
+
} catch (e) {
|
|
2293
|
+
return e;
|
|
2294
|
+
}
|
|
2295
|
+
if (e == null) return;
|
|
2296
|
+
}
|
|
2297
|
+
this.info.bytes_records += this.info.bytes, t(e);
|
|
2298
|
+
},
|
|
2299
|
+
__cast: function(e) {
|
|
2300
|
+
let { columns: t, relax_column_count: n } = this.options;
|
|
2301
|
+
if (Array.isArray(t) === !0 && n && this.options.columns.length <= this.state.record.length) return [void 0, void 0];
|
|
2302
|
+
if (this.state.castField !== null) try {
|
|
2303
|
+
let t = this.__infoField();
|
|
2304
|
+
return [void 0, this.state.castField.call(null, e, t)];
|
|
2305
|
+
} catch (e) {
|
|
2306
|
+
return [e];
|
|
2307
|
+
}
|
|
2308
|
+
if (this.__isFloat(e)) return [void 0, parseFloat(e)];
|
|
2309
|
+
if (this.options.cast_date !== !1) {
|
|
2310
|
+
let t = this.__infoField();
|
|
2311
|
+
return [void 0, this.options.cast_date.call(null, e, t)];
|
|
2312
|
+
}
|
|
2313
|
+
return [void 0, e];
|
|
2314
|
+
},
|
|
2315
|
+
__isCharTrimable: function(e, t) {
|
|
2316
|
+
return ((e, t) => {
|
|
2317
|
+
let { timchars: n } = this.state;
|
|
2318
|
+
loop1: for (let r = 0; r < n.length; r++) {
|
|
2319
|
+
let i = n[r];
|
|
2320
|
+
for (let n = 0; n < i.length; n++) if (i[n] !== e[t + n]) continue loop1;
|
|
2321
|
+
return i.length;
|
|
2322
|
+
}
|
|
2323
|
+
return 0;
|
|
2324
|
+
})(e, t);
|
|
2325
|
+
},
|
|
2326
|
+
__isFloat: function(e) {
|
|
2327
|
+
return e - parseFloat(e) + 1 >= 0;
|
|
2328
|
+
},
|
|
2329
|
+
__compareBytes: function(e, t, n, r) {
|
|
2330
|
+
if (e[0] !== r) return 0;
|
|
2331
|
+
let i = e.length;
|
|
2332
|
+
for (let r = 1; r < i; r++) if (e[r] !== t[n + r]) return 0;
|
|
2333
|
+
return i;
|
|
2334
|
+
},
|
|
2335
|
+
__isDelimiter: function(e, t, n) {
|
|
2336
|
+
let { delimiter: r, ignore_last_delimiters: i } = this.options;
|
|
2337
|
+
if (i === !0 && this.state.record.length === this.options.columns.length - 1 || i !== !1 && typeof i == "number" && this.state.record.length === i - 1) return 0;
|
|
2338
|
+
loop1: for (let i = 0; i < r.length; i++) {
|
|
2339
|
+
let a = r[i];
|
|
2340
|
+
if (a[0] === n) {
|
|
2341
|
+
for (let n = 1; n < a.length; n++) if (a[n] !== e[t + n]) continue loop1;
|
|
2342
|
+
return a.length;
|
|
2343
|
+
}
|
|
2344
|
+
}
|
|
2345
|
+
return 0;
|
|
2346
|
+
},
|
|
2347
|
+
__isRecordDelimiter: function(e, t, n) {
|
|
2348
|
+
let { record_delimiter: r } = this.options, i = r.length;
|
|
2349
|
+
loop1: for (let a = 0; a < i; a++) {
|
|
2350
|
+
let i = r[a], o = i.length;
|
|
2351
|
+
if (i[0] === e) {
|
|
2352
|
+
for (let e = 1; e < o; e++) if (i[e] !== t[n + e]) continue loop1;
|
|
2353
|
+
return i.length;
|
|
2354
|
+
}
|
|
2355
|
+
}
|
|
2356
|
+
return 0;
|
|
2357
|
+
},
|
|
2358
|
+
__isEscape: function(e, t, n) {
|
|
2359
|
+
let { escape: r } = this.options;
|
|
2360
|
+
if (r === null) return !1;
|
|
2361
|
+
let i = r.length;
|
|
2362
|
+
if (r[0] === n) {
|
|
2363
|
+
for (let n = 0; n < i; n++) if (r[n] !== e[t + n]) return !1;
|
|
2364
|
+
return !0;
|
|
2365
|
+
}
|
|
2366
|
+
return !1;
|
|
2367
|
+
},
|
|
2368
|
+
__isQuote: function(e, t) {
|
|
2369
|
+
let { quote: n } = this.options;
|
|
2370
|
+
if (n === null) return !1;
|
|
2371
|
+
let r = n.length;
|
|
2372
|
+
for (let i = 0; i < r; i++) if (n[i] !== e[t + i]) return !1;
|
|
2373
|
+
return !0;
|
|
2374
|
+
},
|
|
2375
|
+
__autoDiscoverRecordDelimiter: function(e, t) {
|
|
2376
|
+
let { encoding: n } = this.options, r = [
|
|
2377
|
+
_.from("\r\n", n),
|
|
2378
|
+
_.from("\n", n),
|
|
2379
|
+
_.from("\r", n)
|
|
2380
|
+
];
|
|
2381
|
+
loop: for (let n = 0; n < r.length; n++) {
|
|
2382
|
+
let i = r[n].length;
|
|
2383
|
+
for (let a = 0; a < i; a++) if (r[n][a] !== e[t + a]) continue loop;
|
|
2384
|
+
return this.options.record_delimiter.push(r[n]), this.state.recordDelimiterMaxLength = r[n].length, r[n].length;
|
|
2385
|
+
}
|
|
2386
|
+
return 0;
|
|
2387
|
+
},
|
|
2388
|
+
__error: function(e) {
|
|
2389
|
+
let { encoding: t, raw: n, skip_records_with_error: r } = this.options, i = typeof e == "string" ? Error(e) : e;
|
|
2390
|
+
if (r) {
|
|
2391
|
+
if (this.state.recordHasError = !0, this.options.on_skip !== void 0) try {
|
|
2392
|
+
this.options.on_skip(i, n ? this.state.rawBuffer.toString(t) : void 0);
|
|
2393
|
+
} catch (e) {
|
|
2394
|
+
return e;
|
|
2395
|
+
}
|
|
2396
|
+
return;
|
|
2397
|
+
} else return i;
|
|
2398
|
+
},
|
|
2399
|
+
__infoDataSet: function() {
|
|
2400
|
+
return {
|
|
2401
|
+
...this.info,
|
|
2402
|
+
columns: this.options.columns
|
|
2403
|
+
};
|
|
2404
|
+
},
|
|
2405
|
+
__infoRecord: function() {
|
|
2406
|
+
let { columns: e, raw: t, encoding: n } = this.options;
|
|
2407
|
+
return {
|
|
2408
|
+
...this.__infoDataSet(),
|
|
2409
|
+
bytes_records: this.info.bytes,
|
|
2410
|
+
error: this.state.error,
|
|
2411
|
+
header: e === !0,
|
|
2412
|
+
index: this.state.record.length,
|
|
2413
|
+
raw: t ? this.state.rawBuffer.toString(n) : void 0
|
|
2414
|
+
};
|
|
2415
|
+
},
|
|
2416
|
+
__infoField: function() {
|
|
2417
|
+
let { columns: e } = this.options, t = Array.isArray(e), n = this.info.bytes_records;
|
|
2418
|
+
return {
|
|
2419
|
+
...this.__infoRecord(),
|
|
2420
|
+
bytes_records: n,
|
|
2421
|
+
column: t === !0 ? e.length > this.state.record.length ? e[this.state.record.length].name : null : this.state.record.length,
|
|
2422
|
+
quoting: this.state.wasQuoting
|
|
2423
|
+
};
|
|
2424
|
+
}
|
|
2425
|
+
};
|
|
2426
|
+
}, tr = class extends Y {
|
|
2427
|
+
constructor(e = {}) {
|
|
2428
|
+
super({
|
|
2429
|
+
readableObjectMode: !0,
|
|
2430
|
+
...e,
|
|
2431
|
+
encoding: null
|
|
2432
|
+
}), this.api = er({
|
|
2433
|
+
on_skip: (e, t) => {
|
|
2434
|
+
this.emit("skip", e, t);
|
|
2435
|
+
},
|
|
2436
|
+
...e
|
|
2437
|
+
}), this.state = this.api.state, this.options = this.api.options, this.info = this.api.info;
|
|
2438
|
+
}
|
|
2439
|
+
_transform(e, t, n) {
|
|
2440
|
+
if (this.state.stop === !0) return;
|
|
2441
|
+
let r = this.api.parse(e, !1, (e) => {
|
|
2442
|
+
this.push(e);
|
|
2443
|
+
}, () => {
|
|
2444
|
+
this.push(null), this.end(), this.on("end", this.destroy);
|
|
2445
|
+
});
|
|
2446
|
+
r !== void 0 && (this.state.stop = !0), n(r);
|
|
2447
|
+
}
|
|
2448
|
+
_flush(e) {
|
|
2449
|
+
this.state.stop !== !0 && e(this.api.parse(void 0, !0, (e) => {
|
|
2450
|
+
this.push(e);
|
|
2451
|
+
}, () => {
|
|
2452
|
+
this.push(null), this.on("end", this.destroy);
|
|
2453
|
+
}));
|
|
2454
|
+
}
|
|
2455
|
+
}, nr = function() {
|
|
2456
|
+
let e, t, n;
|
|
2457
|
+
for (let r in arguments) {
|
|
2458
|
+
let i = arguments[r], a = typeof i;
|
|
2459
|
+
if (e === void 0 && (typeof i == "string" || O(i))) e = i;
|
|
2460
|
+
else if (t === void 0 && Bn(i)) t = i;
|
|
2461
|
+
else if (n === void 0 && a === "function") n = i;
|
|
2462
|
+
else throw new Q("CSV_INVALID_ARGUMENT", ["Invalid argument:", `got ${JSON.stringify(i)} at index ${r}`], t || {});
|
|
2463
|
+
}
|
|
2464
|
+
let r = new tr(t);
|
|
2465
|
+
if (n) {
|
|
2466
|
+
let e = t === void 0 || t.objname === void 0 ? [] : Object.create(null);
|
|
2467
|
+
r.on("readable", function() {
|
|
2468
|
+
let n;
|
|
2469
|
+
for (; (n = this.read()) !== null;) t === void 0 || t.objname === void 0 ? e.push(n) : Object.assign(e, { [n[0]]: n[1] });
|
|
2470
|
+
}), r.on("error", function(e) {
|
|
2471
|
+
n(e, void 0, r.api.__infoDataSet());
|
|
2472
|
+
}), r.on("end", function() {
|
|
2473
|
+
n(void 0, e, r.api.__infoDataSet());
|
|
2474
|
+
});
|
|
2475
|
+
}
|
|
2476
|
+
if (e !== void 0) {
|
|
2477
|
+
let t = function() {
|
|
2478
|
+
r.write(e), r.end();
|
|
2479
|
+
};
|
|
2480
|
+
typeof setImmediate == "function" ? setImmediate(t) : setTimeout(t, 0);
|
|
2481
|
+
}
|
|
2482
|
+
return r;
|
|
2483
|
+
}, rr = 2048, ir = class extends Error {
|
|
2484
|
+
data;
|
|
2485
|
+
locator;
|
|
2486
|
+
constructor(e, t, n, r) {
|
|
2487
|
+
super(e, r), this.name = "DPUseError", this.data = n, this.locator = t;
|
|
2488
|
+
}
|
|
2489
|
+
}, ar = class extends ir {
|
|
2490
|
+
constructor(e, t, n, r) {
|
|
2491
|
+
super(e, t, n, r), this.name = "FetchError";
|
|
2492
|
+
}
|
|
2493
|
+
};
|
|
2494
|
+
async function or(e, t, n) {
|
|
2495
|
+
let r = ` - ${e.statusText}`, i = `${t} Response status '${e.status}${e.statusText ? r : ""}' received.`, a;
|
|
2496
|
+
try {
|
|
2497
|
+
a = await e.text();
|
|
2498
|
+
} catch (e) {
|
|
2499
|
+
a = `<body unavailable: ${cr(e).message}>`;
|
|
2500
|
+
}
|
|
2501
|
+
return new ar(i, n, { body: lr(a) });
|
|
2502
|
+
}
|
|
2503
|
+
function sr(e) {
|
|
2504
|
+
try {
|
|
2505
|
+
e();
|
|
2506
|
+
} catch {}
|
|
2507
|
+
}
|
|
2508
|
+
function cr(e) {
|
|
2509
|
+
if (e instanceof Error) return e;
|
|
2510
|
+
if (typeof e == "string") return Error(e);
|
|
2511
|
+
if (typeof e == "number" || typeof e == "boolean" || typeof e == "bigint") return Error(String(e));
|
|
2512
|
+
if (typeof e == "symbol") return Error(e.description ?? "Unknown error");
|
|
2513
|
+
if (typeof e == "object") try {
|
|
2514
|
+
return Error(JSON.stringify(e));
|
|
2515
|
+
} catch {
|
|
2516
|
+
return /* @__PURE__ */ Error("Unknown error");
|
|
2517
|
+
}
|
|
2518
|
+
return /* @__PURE__ */ Error("Unknown error");
|
|
2519
|
+
}
|
|
2520
|
+
function lr(e) {
|
|
2521
|
+
if (!(e == null || e === "")) return e.length > rr ? `${e.slice(0, rr)}... [truncated]` : e;
|
|
2522
|
+
}
|
|
2523
|
+
//#endregion
|
|
2524
|
+
//#region src/index.ts
|
|
2525
|
+
var ur = {
|
|
2526
|
+
bom: !1,
|
|
2527
|
+
cast: void 0,
|
|
2528
|
+
cast_date: !1,
|
|
2529
|
+
columns: !1,
|
|
2530
|
+
comment: "",
|
|
2531
|
+
comment_no_infix: !1,
|
|
2532
|
+
delimiter: ",",
|
|
2533
|
+
encoding: "utf8",
|
|
2534
|
+
escape: "\"",
|
|
2535
|
+
from: 1,
|
|
2536
|
+
from_line: 1,
|
|
2537
|
+
group_columns_by_name: !1,
|
|
2538
|
+
ignore_last_delimiters: !1,
|
|
2539
|
+
info: !1,
|
|
2540
|
+
ltrim: !1,
|
|
2541
|
+
max_record_size: 0,
|
|
2542
|
+
objname: void 0,
|
|
2543
|
+
on_record: void 0,
|
|
2544
|
+
on_skip: void 0,
|
|
2545
|
+
quote: "\"",
|
|
2546
|
+
raw: !1,
|
|
2547
|
+
record_delimiter: [],
|
|
2548
|
+
relax_column_count: !1,
|
|
2549
|
+
relax_column_count_less: !1,
|
|
2550
|
+
relax_column_count_more: !1,
|
|
2551
|
+
relax_quotes: !1,
|
|
2552
|
+
rtrim: !1,
|
|
2553
|
+
skip_empty_lines: !1,
|
|
2554
|
+
skip_records_with_empty_values: !1,
|
|
2555
|
+
skip_records_with_error: !1,
|
|
2556
|
+
to: void 0,
|
|
2557
|
+
to_line: -1,
|
|
2558
|
+
trim: !1
|
|
2559
|
+
}, dr = 1e4, fr = 4, pr = class {
|
|
2560
|
+
async parseStream(e, t, n, r, i) {
|
|
2561
|
+
return new Promise((a, o) => {
|
|
2562
|
+
let s, c, l, u = !1, d = !1, f = () => {
|
|
2563
|
+
if (d) return;
|
|
2564
|
+
d = !0;
|
|
2565
|
+
let e = s;
|
|
2566
|
+
s = void 0, l = void 0, e != null && (sr(() => e.removeAllListeners()), sr(() => e.end())), sr(() => void c?.cancel()), c = void 0;
|
|
2567
|
+
};
|
|
2568
|
+
r.signal.addEventListener("abort", f, { once: !0 });
|
|
2569
|
+
let p = (e) => {
|
|
2570
|
+
u || (u = !0, f(), r.signal.aborted || r.abort(e), o(e));
|
|
2571
|
+
};
|
|
2572
|
+
(async () => {
|
|
2573
|
+
s = nr({
|
|
2574
|
+
...ur,
|
|
2575
|
+
...t,
|
|
2576
|
+
cast: (e, t) => ({
|
|
2577
|
+
value: e,
|
|
2578
|
+
wasValueQuoted: t.quoting
|
|
2579
|
+
})
|
|
2580
|
+
}), l = mr({
|
|
2581
|
+
chunk: i,
|
|
2582
|
+
chunkSize: e.chunkSize ?? dr
|
|
2583
|
+
}), s.on("readable", () => {
|
|
2584
|
+
try {
|
|
2585
|
+
if (s == null || l == null) return;
|
|
2586
|
+
let e;
|
|
2587
|
+
for (; (e = s.read()) != null;) {
|
|
2588
|
+
if (u) return;
|
|
2589
|
+
r.signal.throwIfAborted(), l.push(e);
|
|
2590
|
+
}
|
|
2591
|
+
} catch (e) {
|
|
2592
|
+
p(e);
|
|
2593
|
+
}
|
|
2594
|
+
}), s.on("error", (e) => p(e)), s.on("end", () => {
|
|
2595
|
+
u || (l?.flush(), a(hr(s)));
|
|
2596
|
+
});
|
|
2597
|
+
let o = await fetch(encodeURI(n), { signal: r.signal });
|
|
2598
|
+
if (!o.ok || o.body == null) throw await or(o, `Failed to fetch '${n}' file.`, "dpuse-connector-file-store-emulator|Connector|retrieve");
|
|
2599
|
+
c = o.body.getReader();
|
|
2600
|
+
let d = new TextDecoder(e.encodingId), f = await c.read();
|
|
2601
|
+
for (; !f.done;) {
|
|
2602
|
+
if (u) return;
|
|
2603
|
+
r.signal.throwIfAborted();
|
|
2604
|
+
let e = d.decode(f.value, { stream: !0 });
|
|
2605
|
+
e.length > 0 && s.write(e), f = await c.read();
|
|
2606
|
+
}
|
|
2607
|
+
if (u) return;
|
|
2608
|
+
let m = d.decode();
|
|
2609
|
+
m.length > 0 && s.write(m), s.end();
|
|
2610
|
+
})().catch((e) => p(e));
|
|
2611
|
+
});
|
|
2612
|
+
}
|
|
2613
|
+
async parseText(e, t) {
|
|
2614
|
+
let n = gr(e), { parsedRecords: r, valueDelimiterId: i } = await _r(e, t);
|
|
2615
|
+
return {
|
|
2616
|
+
parsedRecords: r,
|
|
2617
|
+
recordDelimiterId: n,
|
|
2618
|
+
valueDelimiterId: i
|
|
2619
|
+
};
|
|
2620
|
+
}
|
|
2621
|
+
};
|
|
2622
|
+
function mr(e) {
|
|
2623
|
+
let t = Math.max(1, Math.floor(e.chunkSize)), n = [], r = o(), i = 0, a = () => {
|
|
2624
|
+
if (i === 0) return;
|
|
2625
|
+
let t = r;
|
|
2626
|
+
t.length = i, r = o(), i = 0, e.chunk(t), n.length < fr && n.push(t);
|
|
2627
|
+
};
|
|
2628
|
+
return {
|
|
2629
|
+
flush: a,
|
|
2630
|
+
push: (e) => {
|
|
2631
|
+
r[i++] = e, i >= t && a();
|
|
2632
|
+
}
|
|
2633
|
+
};
|
|
2634
|
+
function o() {
|
|
2635
|
+
let e = n.pop();
|
|
2636
|
+
if (e != null) return e.length = 0, e;
|
|
2637
|
+
let r = Array.from({ length: t });
|
|
2638
|
+
return r.length = 0, r;
|
|
2639
|
+
}
|
|
2640
|
+
}
|
|
2641
|
+
function hr(e) {
|
|
2642
|
+
return {
|
|
2643
|
+
byteCount: e?.info.bytes ?? -1,
|
|
2644
|
+
commentLineCount: e?.info.comment_lines ?? -1,
|
|
2645
|
+
emptyLineCount: e?.info.empty_lines ?? -1,
|
|
2646
|
+
nonUniformRecordCount: e?.info.invalid_field_length ?? -1,
|
|
2647
|
+
lineCount: e?.info.lines ?? -1,
|
|
2648
|
+
recordCount: e?.info.records ?? -1
|
|
2649
|
+
};
|
|
2650
|
+
}
|
|
2651
|
+
function gr(e) {
|
|
2652
|
+
let t = (e.match(/\r\n/g) ?? []).length, n = (e.match(/(?<!\r)\n/g) ?? []).length, r = (e.match(/\r(?!\n)/g) ?? []).length;
|
|
2653
|
+
return t >= n && t >= r ? "\r\n" : n >= t && n >= r ? "\n" : r >= t && r >= n ? "\r" : "\n";
|
|
2654
|
+
}
|
|
2655
|
+
async function _r(e, t) {
|
|
2656
|
+
let n, r, i, a = [];
|
|
2657
|
+
for (let o of t) try {
|
|
2658
|
+
let t = 0, s, c = 0, l = 0, u = nr({
|
|
2659
|
+
...ur,
|
|
2660
|
+
cast: (e, t) => ({
|
|
2661
|
+
value: e,
|
|
2662
|
+
wasValueQuoted: t.quoting
|
|
2663
|
+
}),
|
|
2664
|
+
delimiter: o,
|
|
2665
|
+
relax_column_count: !0
|
|
2666
|
+
});
|
|
2667
|
+
await new Promise((d) => {
|
|
2668
|
+
try {
|
|
2669
|
+
let f = [];
|
|
2670
|
+
u.on("readable", () => {
|
|
2671
|
+
let e;
|
|
2672
|
+
for (; (e = u.read()) != null;) {
|
|
2673
|
+
c++;
|
|
2674
|
+
let n = e.length;
|
|
2675
|
+
s != null && (l += Math.abs(n - s)), s = n, t += n, f.push(e);
|
|
2676
|
+
}
|
|
2677
|
+
}), u.on("error", () => d()), u.on("end", () => {
|
|
2678
|
+
let e = t / c;
|
|
2679
|
+
(!i || l <= i) && (!r || e > r) && (n = o, r = e, i = l, a = [...f]), d();
|
|
2680
|
+
}), u.write(e), u.end();
|
|
2681
|
+
} catch {
|
|
2682
|
+
d();
|
|
2683
|
+
}
|
|
2684
|
+
});
|
|
2685
|
+
} catch {}
|
|
2686
|
+
return {
|
|
2687
|
+
parsedRecords: a,
|
|
2688
|
+
valueDelimiterId: n ?? ","
|
|
2689
|
+
};
|
|
2690
|
+
}
|
|
2691
|
+
//#endregion
|
|
2692
|
+
export { pr as Tool };
|