@datapos/datapos-tool-csv-parse 0.0.91 → 0.0.93
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/datapos-tool-csv-parse.es.js +343 -331
- package/package.json +2 -2
|
@@ -31,27 +31,27 @@ function Ze(t) {
|
|
|
31
31
|
return n === 1 ? (e = t[r - 1], i += P[e >> 2], i += P[e << 4 & 63], i += "==") : n === 2 && (e = (t[r - 2] << 8) + t[r - 1], i += P[e >> 10], i += P[e >> 4 & 63], i += P[e << 2 & 63], i += "="), o.push(i), o.join("");
|
|
32
32
|
}
|
|
33
33
|
function ve(t, e, r, n, i) {
|
|
34
|
-
var o, s, f = i * 8 - n - 1, a = (1 << f) - 1, l = a >> 1,
|
|
35
|
-
for (
|
|
34
|
+
var o, s, f = i * 8 - n - 1, a = (1 << f) - 1, l = a >> 1, h = -7, c = r ? i - 1 : 0, d = r ? -1 : 1, g = t[e + c];
|
|
35
|
+
for (c += d, o = g & (1 << -h) - 1, g >>= -h, h += f; h > 0; o = o * 256 + t[e + c], c += d, h -= 8)
|
|
36
36
|
;
|
|
37
|
-
for (s = o & (1 << -
|
|
37
|
+
for (s = o & (1 << -h) - 1, o >>= -h, h += n; h > 0; s = s * 256 + t[e + c], c += d, h -= 8)
|
|
38
38
|
;
|
|
39
39
|
if (o === 0)
|
|
40
40
|
o = 1 - l;
|
|
41
41
|
else {
|
|
42
42
|
if (o === a)
|
|
43
|
-
return s ? NaN : (
|
|
43
|
+
return s ? NaN : (g ? -1 : 1) * (1 / 0);
|
|
44
44
|
s = s + Math.pow(2, n), o = o - l;
|
|
45
45
|
}
|
|
46
|
-
return (
|
|
46
|
+
return (g ? -1 : 1) * s * Math.pow(2, o - n);
|
|
47
47
|
}
|
|
48
48
|
function ht(t, e, r, n, i, o) {
|
|
49
|
-
var s, f, a, l = o * 8 - i - 1,
|
|
50
|
-
for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (f = isNaN(e) ? 1 : 0, s =
|
|
49
|
+
var s, f, a, l = o * 8 - i - 1, h = (1 << l) - 1, c = h >> 1, d = i === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, g = n ? 0 : o - 1, x = n ? 1 : -1, _ = e < 0 || e === 0 && 1 / e < 0 ? 1 : 0;
|
|
50
|
+
for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (f = isNaN(e) ? 1 : 0, s = h) : (s = Math.floor(Math.log(e) / Math.LN2), e * (a = Math.pow(2, -s)) < 1 && (s--, a *= 2), s + c >= 1 ? e += d / a : e += d * Math.pow(2, 1 - c), e * a >= 2 && (s++, a /= 2), s + c >= h ? (f = 0, s = h) : s + c >= 1 ? (f = (e * a - 1) * Math.pow(2, i), s = s + c) : (f = e * Math.pow(2, c - 1) * Math.pow(2, i), s = 0)); i >= 8; t[r + g] = f & 255, g += x, f /= 256, i -= 8)
|
|
51
51
|
;
|
|
52
|
-
for (s = s << i | f, l += i; l > 0; t[r +
|
|
52
|
+
for (s = s << i | f, l += i; l > 0; t[r + g] = s & 255, g += x, s /= 256, l -= 8)
|
|
53
53
|
;
|
|
54
|
-
t[r +
|
|
54
|
+
t[r + g - x] |= _ * 128;
|
|
55
55
|
}
|
|
56
56
|
var er = {}.toString, dt = Array.isArray || function(t) {
|
|
57
57
|
return er.call(t) == "[object Array]";
|
|
@@ -91,20 +91,20 @@ u.from = function(t, e, r) {
|
|
|
91
91
|
return pt(null, t, e, r);
|
|
92
92
|
};
|
|
93
93
|
u.TYPED_ARRAY_SUPPORT && (u.prototype.__proto__ = Uint8Array.prototype, u.__proto__ = Uint8Array, typeof Symbol < "u" && Symbol.species && u[Symbol.species]);
|
|
94
|
-
function
|
|
94
|
+
function gt(t) {
|
|
95
95
|
if (typeof t != "number")
|
|
96
96
|
throw new TypeError('"size" argument must be a number');
|
|
97
97
|
if (t < 0)
|
|
98
98
|
throw new RangeError('"size" argument must not be negative');
|
|
99
99
|
}
|
|
100
100
|
function rr(t, e, r, n) {
|
|
101
|
-
return
|
|
101
|
+
return gt(e), e <= 0 ? q(t, e) : r !== void 0 ? typeof n == "string" ? q(t, e).fill(r, n) : q(t, e).fill(r) : q(t, e);
|
|
102
102
|
}
|
|
103
103
|
u.alloc = function(t, e, r) {
|
|
104
104
|
return rr(null, t, e, r);
|
|
105
105
|
};
|
|
106
106
|
function Ve(t, e) {
|
|
107
|
-
if (
|
|
107
|
+
if (gt(e), t = q(t, e < 0 ? 0 : ze(e) | 0), !u.TYPED_ARRAY_SUPPORT)
|
|
108
108
|
for (var r = 0; r < e; ++r)
|
|
109
109
|
t[r] = 0;
|
|
110
110
|
return t;
|
|
@@ -118,7 +118,7 @@ u.allocUnsafeSlow = function(t) {
|
|
|
118
118
|
function nr(t, e, r) {
|
|
119
119
|
if ((typeof r != "string" || r === "") && (r = "utf8"), !u.isEncoding(r))
|
|
120
120
|
throw new TypeError('"encoding" must be a valid string encoding');
|
|
121
|
-
var n =
|
|
121
|
+
var n = mt(e, r) | 0;
|
|
122
122
|
t = q(t, n);
|
|
123
123
|
var i = t.write(e, r);
|
|
124
124
|
return i !== n && (t = t.slice(0, i)), t;
|
|
@@ -206,7 +206,7 @@ u.concat = function(e, r) {
|
|
|
206
206
|
}
|
|
207
207
|
return i;
|
|
208
208
|
};
|
|
209
|
-
function
|
|
209
|
+
function mt(t, e) {
|
|
210
210
|
if ($(t))
|
|
211
211
|
return t.length;
|
|
212
212
|
if (typeof ArrayBuffer < "u" && typeof ArrayBuffer.isView == "function" && (ArrayBuffer.isView(t) || t instanceof ArrayBuffer))
|
|
@@ -238,7 +238,7 @@ function gt(t, e) {
|
|
|
238
238
|
e = ("" + e).toLowerCase(), n = !0;
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
|
-
u.byteLength =
|
|
241
|
+
u.byteLength = mt;
|
|
242
242
|
function sr(t, e, r) {
|
|
243
243
|
var n = !1;
|
|
244
244
|
if ((e === void 0 || e < 0) && (e = 0), e > this.length || ((r === void 0 || r > this.length) && (r = this.length), r <= 0) || (r >>>= 0, e >>>= 0, r <= e))
|
|
@@ -246,7 +246,7 @@ function sr(t, e, r) {
|
|
|
246
246
|
for (t || (t = "utf8"); ; )
|
|
247
247
|
switch (t) {
|
|
248
248
|
case "hex":
|
|
249
|
-
return
|
|
249
|
+
return mr(this, e, r);
|
|
250
250
|
case "utf8":
|
|
251
251
|
case "utf-8":
|
|
252
252
|
return yt(this, e, r);
|
|
@@ -254,7 +254,7 @@ function sr(t, e, r) {
|
|
|
254
254
|
return pr(this, e, r);
|
|
255
255
|
case "latin1":
|
|
256
256
|
case "binary":
|
|
257
|
-
return
|
|
257
|
+
return gr(this, e, r);
|
|
258
258
|
case "base64":
|
|
259
259
|
return hr(this, e, r);
|
|
260
260
|
case "ucs2":
|
|
@@ -320,9 +320,9 @@ u.prototype.compare = function(e, r, n, i, o) {
|
|
|
320
320
|
if (r >= n)
|
|
321
321
|
return 1;
|
|
322
322
|
if (r >>>= 0, n >>>= 0, i >>>= 0, o >>>= 0, this === e) return 0;
|
|
323
|
-
for (var s = o - i, f = n - r, a = Math.min(s, f), l = this.slice(i, o),
|
|
324
|
-
if (l[
|
|
325
|
-
s = l[
|
|
323
|
+
for (var s = o - i, f = n - r, a = Math.min(s, f), l = this.slice(i, o), h = e.slice(r, n), c = 0; c < a; ++c)
|
|
324
|
+
if (l[c] !== h[c]) {
|
|
325
|
+
s = l[c], f = h[c];
|
|
326
326
|
break;
|
|
327
327
|
}
|
|
328
328
|
return s < f ? -1 : f < s ? 1 : 0;
|
|
@@ -348,25 +348,25 @@ function Xe(t, e, r, n, i) {
|
|
|
348
348
|
return -1;
|
|
349
349
|
o = 2, s /= 2, f /= 2, r /= 2;
|
|
350
350
|
}
|
|
351
|
-
function a(
|
|
352
|
-
return o === 1 ?
|
|
351
|
+
function a(g, x) {
|
|
352
|
+
return o === 1 ? g[x] : g.readUInt16BE(x * o);
|
|
353
353
|
}
|
|
354
354
|
var l;
|
|
355
355
|
if (i) {
|
|
356
|
-
var
|
|
356
|
+
var h = -1;
|
|
357
357
|
for (l = r; l < s; l++)
|
|
358
|
-
if (a(t, l) === a(e,
|
|
359
|
-
if (
|
|
358
|
+
if (a(t, l) === a(e, h === -1 ? 0 : l - h)) {
|
|
359
|
+
if (h === -1 && (h = l), l - h + 1 === f) return h * o;
|
|
360
360
|
} else
|
|
361
|
-
|
|
361
|
+
h !== -1 && (l -= l - h), h = -1;
|
|
362
362
|
} else
|
|
363
363
|
for (r + f > s && (r = s - f), l = r; l >= 0; l--) {
|
|
364
|
-
for (var
|
|
365
|
-
if (a(t, l +
|
|
366
|
-
|
|
364
|
+
for (var c = !0, d = 0; d < f; d++)
|
|
365
|
+
if (a(t, l + d) !== a(e, d)) {
|
|
366
|
+
c = !1;
|
|
367
367
|
break;
|
|
368
368
|
}
|
|
369
|
-
if (
|
|
369
|
+
if (c) return l;
|
|
370
370
|
}
|
|
371
371
|
return -1;
|
|
372
372
|
}
|
|
@@ -461,19 +461,19 @@ function yt(t, e, r) {
|
|
|
461
461
|
for (var n = [], i = e; i < r; ) {
|
|
462
462
|
var o = t[i], s = null, f = o > 239 ? 4 : o > 223 ? 3 : o > 191 ? 2 : 1;
|
|
463
463
|
if (i + f <= r) {
|
|
464
|
-
var a, l,
|
|
464
|
+
var a, l, h, c;
|
|
465
465
|
switch (f) {
|
|
466
466
|
case 1:
|
|
467
467
|
o < 128 && (s = o);
|
|
468
468
|
break;
|
|
469
469
|
case 2:
|
|
470
|
-
a = t[i + 1], (a & 192) === 128 && (
|
|
470
|
+
a = t[i + 1], (a & 192) === 128 && (c = (o & 31) << 6 | a & 63, c > 127 && (s = c));
|
|
471
471
|
break;
|
|
472
472
|
case 3:
|
|
473
|
-
a = t[i + 1], l = t[i + 2], (a & 192) === 128 && (l & 192) === 128 && (
|
|
473
|
+
a = t[i + 1], l = t[i + 2], (a & 192) === 128 && (l & 192) === 128 && (c = (o & 15) << 12 | (a & 63) << 6 | l & 63, c > 2047 && (c < 55296 || c > 57343) && (s = c));
|
|
474
474
|
break;
|
|
475
475
|
case 4:
|
|
476
|
-
a = t[i + 1], l = t[i + 2],
|
|
476
|
+
a = t[i + 1], l = t[i + 2], h = t[i + 3], (a & 192) === 128 && (l & 192) === 128 && (h & 192) === 128 && (c = (o & 15) << 18 | (a & 63) << 12 | (l & 63) << 6 | h & 63, c > 65535 && c < 1114112 && (s = c));
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
479
|
s === null ? (s = 65533, f = 1) : s > 65535 && (s -= 65536, n.push(s >>> 10 & 1023 | 55296), s = 56320 | s & 1023), n.push(s), i += f;
|
|
@@ -499,14 +499,14 @@ function pr(t, e, r) {
|
|
|
499
499
|
n += String.fromCharCode(t[i] & 127);
|
|
500
500
|
return n;
|
|
501
501
|
}
|
|
502
|
-
function
|
|
502
|
+
function gr(t, e, r) {
|
|
503
503
|
var n = "";
|
|
504
504
|
r = Math.min(t.length, r);
|
|
505
505
|
for (var i = e; i < r; ++i)
|
|
506
506
|
n += String.fromCharCode(t[i]);
|
|
507
507
|
return n;
|
|
508
508
|
}
|
|
509
|
-
function
|
|
509
|
+
function mr(t, e, r) {
|
|
510
510
|
var n = t.length;
|
|
511
511
|
(!e || e < 0) && (e = 0), (!r || r < 0 || r > n) && (r = n);
|
|
512
512
|
for (var i = "", o = e; o < r; ++o)
|
|
@@ -532,79 +532,79 @@ u.prototype.slice = function(e, r) {
|
|
|
532
532
|
}
|
|
533
533
|
return i;
|
|
534
534
|
};
|
|
535
|
-
function
|
|
535
|
+
function L(t, e, r) {
|
|
536
536
|
if (t % 1 !== 0 || t < 0) throw new RangeError("offset is not uint");
|
|
537
537
|
if (t + e > r) throw new RangeError("Trying to access beyond buffer length");
|
|
538
538
|
}
|
|
539
539
|
u.prototype.readUIntLE = function(e, r, n) {
|
|
540
|
-
e = e | 0, r = r | 0, n ||
|
|
540
|
+
e = e | 0, r = r | 0, n || L(e, r, this.length);
|
|
541
541
|
for (var i = this[e], o = 1, s = 0; ++s < r && (o *= 256); )
|
|
542
542
|
i += this[e + s] * o;
|
|
543
543
|
return i;
|
|
544
544
|
};
|
|
545
545
|
u.prototype.readUIntBE = function(e, r, n) {
|
|
546
|
-
e = e | 0, r = r | 0, n ||
|
|
546
|
+
e = e | 0, r = r | 0, n || L(e, r, this.length);
|
|
547
547
|
for (var i = this[e + --r], o = 1; r > 0 && (o *= 256); )
|
|
548
548
|
i += this[e + --r] * o;
|
|
549
549
|
return i;
|
|
550
550
|
};
|
|
551
551
|
u.prototype.readUInt8 = function(e, r) {
|
|
552
|
-
return r ||
|
|
552
|
+
return r || L(e, 1, this.length), this[e];
|
|
553
553
|
};
|
|
554
554
|
u.prototype.readUInt16LE = function(e, r) {
|
|
555
|
-
return r ||
|
|
555
|
+
return r || L(e, 2, this.length), this[e] | this[e + 1] << 8;
|
|
556
556
|
};
|
|
557
557
|
u.prototype.readUInt16BE = function(e, r) {
|
|
558
|
-
return r ||
|
|
558
|
+
return r || L(e, 2, this.length), this[e] << 8 | this[e + 1];
|
|
559
559
|
};
|
|
560
560
|
u.prototype.readUInt32LE = function(e, r) {
|
|
561
|
-
return r ||
|
|
561
|
+
return r || L(e, 4, this.length), (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + this[e + 3] * 16777216;
|
|
562
562
|
};
|
|
563
563
|
u.prototype.readUInt32BE = function(e, r) {
|
|
564
|
-
return r ||
|
|
564
|
+
return r || L(e, 4, this.length), this[e] * 16777216 + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]);
|
|
565
565
|
};
|
|
566
566
|
u.prototype.readIntLE = function(e, r, n) {
|
|
567
|
-
e = e | 0, r = r | 0, n ||
|
|
567
|
+
e = e | 0, r = r | 0, n || L(e, r, this.length);
|
|
568
568
|
for (var i = this[e], o = 1, s = 0; ++s < r && (o *= 256); )
|
|
569
569
|
i += this[e + s] * o;
|
|
570
570
|
return o *= 128, i >= o && (i -= Math.pow(2, 8 * r)), i;
|
|
571
571
|
};
|
|
572
572
|
u.prototype.readIntBE = function(e, r, n) {
|
|
573
|
-
e = e | 0, r = r | 0, n ||
|
|
573
|
+
e = e | 0, r = r | 0, n || L(e, r, this.length);
|
|
574
574
|
for (var i = r, o = 1, s = this[e + --i]; i > 0 && (o *= 256); )
|
|
575
575
|
s += this[e + --i] * o;
|
|
576
576
|
return o *= 128, s >= o && (s -= Math.pow(2, 8 * r)), s;
|
|
577
577
|
};
|
|
578
578
|
u.prototype.readInt8 = function(e, r) {
|
|
579
|
-
return r ||
|
|
579
|
+
return r || L(e, 1, this.length), this[e] & 128 ? (255 - this[e] + 1) * -1 : this[e];
|
|
580
580
|
};
|
|
581
581
|
u.prototype.readInt16LE = function(e, r) {
|
|
582
|
-
r ||
|
|
582
|
+
r || L(e, 2, this.length);
|
|
583
583
|
var n = this[e] | this[e + 1] << 8;
|
|
584
584
|
return n & 32768 ? n | 4294901760 : n;
|
|
585
585
|
};
|
|
586
586
|
u.prototype.readInt16BE = function(e, r) {
|
|
587
|
-
r ||
|
|
587
|
+
r || L(e, 2, this.length);
|
|
588
588
|
var n = this[e + 1] | this[e] << 8;
|
|
589
589
|
return n & 32768 ? n | 4294901760 : n;
|
|
590
590
|
};
|
|
591
591
|
u.prototype.readInt32LE = function(e, r) {
|
|
592
|
-
return r ||
|
|
592
|
+
return r || L(e, 4, this.length), this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24;
|
|
593
593
|
};
|
|
594
594
|
u.prototype.readInt32BE = function(e, r) {
|
|
595
|
-
return r ||
|
|
595
|
+
return r || L(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3];
|
|
596
596
|
};
|
|
597
597
|
u.prototype.readFloatLE = function(e, r) {
|
|
598
|
-
return r ||
|
|
598
|
+
return r || L(e, 4, this.length), ve(this, e, !0, 23, 4);
|
|
599
599
|
};
|
|
600
600
|
u.prototype.readFloatBE = function(e, r) {
|
|
601
|
-
return r ||
|
|
601
|
+
return r || L(e, 4, this.length), ve(this, e, !1, 23, 4);
|
|
602
602
|
};
|
|
603
603
|
u.prototype.readDoubleLE = function(e, r) {
|
|
604
|
-
return r ||
|
|
604
|
+
return r || L(e, 8, this.length), ve(this, e, !0, 52, 8);
|
|
605
605
|
};
|
|
606
606
|
u.prototype.readDoubleBE = function(e, r) {
|
|
607
|
-
return r ||
|
|
607
|
+
return r || L(e, 8, this.length), ve(this, e, !1, 52, 8);
|
|
608
608
|
};
|
|
609
609
|
function N(t, e, r, n, i, o) {
|
|
610
610
|
if (!$(t)) throw new TypeError('"buffer" argument must be a Buffer instance');
|
|
@@ -859,27 +859,27 @@ var Ce;
|
|
|
859
859
|
function H() {
|
|
860
860
|
}
|
|
861
861
|
H.prototype = /* @__PURE__ */ Object.create(null);
|
|
862
|
-
function
|
|
863
|
-
|
|
864
|
-
}
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
this.domain = null,
|
|
873
|
-
};
|
|
874
|
-
|
|
862
|
+
function m() {
|
|
863
|
+
m.init.call(this);
|
|
864
|
+
}
|
|
865
|
+
m.EventEmitter = m;
|
|
866
|
+
m.usingDomains = !1;
|
|
867
|
+
m.prototype.domain = void 0;
|
|
868
|
+
m.prototype._events = void 0;
|
|
869
|
+
m.prototype._maxListeners = void 0;
|
|
870
|
+
m.defaultMaxListeners = 10;
|
|
871
|
+
m.init = function() {
|
|
872
|
+
this.domain = null, m.usingDomains && Ce.active && !(this instanceof Ce.Domain) && (this.domain = Ce.active), (!this._events || this._events === Object.getPrototypeOf(this)._events) && (this._events = new H(), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
|
|
873
|
+
};
|
|
874
|
+
m.prototype.setMaxListeners = function(e) {
|
|
875
875
|
if (typeof e != "number" || e < 0 || isNaN(e))
|
|
876
876
|
throw new TypeError('"n" argument must be a positive number');
|
|
877
877
|
return this._maxListeners = e, this;
|
|
878
878
|
};
|
|
879
879
|
function Rt(t) {
|
|
880
|
-
return t._maxListeners === void 0 ?
|
|
880
|
+
return t._maxListeners === void 0 ? m.defaultMaxListeners : t._maxListeners;
|
|
881
881
|
}
|
|
882
|
-
|
|
882
|
+
m.prototype.getMaxListeners = function() {
|
|
883
883
|
return Rt(this);
|
|
884
884
|
};
|
|
885
885
|
function Ir(t, e, r) {
|
|
@@ -910,14 +910,14 @@ function Ar(t, e, r, n, i, o) {
|
|
|
910
910
|
for (var s = t.length, f = ae(t, s), a = 0; a < s; ++a)
|
|
911
911
|
f[a].call(r, n, i, o);
|
|
912
912
|
}
|
|
913
|
-
function
|
|
913
|
+
function Lr(t, e, r, n) {
|
|
914
914
|
if (e)
|
|
915
915
|
t.apply(r, n);
|
|
916
916
|
else
|
|
917
917
|
for (var i = t.length, o = ae(t, i), s = 0; s < i; ++s)
|
|
918
918
|
o[s].apply(r, n);
|
|
919
919
|
}
|
|
920
|
-
|
|
920
|
+
m.prototype.emit = function(e) {
|
|
921
921
|
var r, n, i, o, s, f, a, l = e === "error";
|
|
922
922
|
if (f = this._events, f)
|
|
923
923
|
l = l && f.error == null;
|
|
@@ -929,33 +929,33 @@ g.prototype.emit = function(e) {
|
|
|
929
929
|
else {
|
|
930
930
|
if (r instanceof Error)
|
|
931
931
|
throw r;
|
|
932
|
-
var
|
|
933
|
-
throw
|
|
932
|
+
var h = new Error('Uncaught, unspecified "error" event. (' + r + ")");
|
|
933
|
+
throw h.context = r, h;
|
|
934
934
|
}
|
|
935
935
|
return !1;
|
|
936
936
|
}
|
|
937
937
|
if (n = f[e], !n)
|
|
938
938
|
return !1;
|
|
939
|
-
var
|
|
939
|
+
var c = typeof n == "function";
|
|
940
940
|
switch (i = arguments.length, i) {
|
|
941
941
|
// fast cases
|
|
942
942
|
case 1:
|
|
943
|
-
Ir(n,
|
|
943
|
+
Ir(n, c, this);
|
|
944
944
|
break;
|
|
945
945
|
case 2:
|
|
946
|
-
Cr(n,
|
|
946
|
+
Cr(n, c, this, arguments[1]);
|
|
947
947
|
break;
|
|
948
948
|
case 3:
|
|
949
|
-
Or(n,
|
|
949
|
+
Or(n, c, this, arguments[1], arguments[2]);
|
|
950
950
|
break;
|
|
951
951
|
case 4:
|
|
952
|
-
Ar(n,
|
|
952
|
+
Ar(n, c, this, arguments[1], arguments[2], arguments[3]);
|
|
953
953
|
break;
|
|
954
954
|
// slower
|
|
955
955
|
default:
|
|
956
956
|
for (o = new Array(i - 1), s = 1; s < i; s++)
|
|
957
957
|
o[s - 1] = arguments[s];
|
|
958
|
-
|
|
958
|
+
Lr(n, c, this, o);
|
|
959
959
|
}
|
|
960
960
|
return !0;
|
|
961
961
|
};
|
|
@@ -972,18 +972,18 @@ function It(t, e, r, n) {
|
|
|
972
972
|
else if (typeof s == "function" ? s = o[e] = n ? [r, s] : [s, r] : n ? s.unshift(r) : s.push(r), !s.warned && (i = Rt(t), i && i > 0 && s.length > i)) {
|
|
973
973
|
s.warned = !0;
|
|
974
974
|
var f = new Error("Possible EventEmitter memory leak detected. " + s.length + " " + e + " listeners added. Use emitter.setMaxListeners() to increase limit");
|
|
975
|
-
f.name = "MaxListenersExceededWarning", f.emitter = t, f.type = e, f.count = s.length,
|
|
975
|
+
f.name = "MaxListenersExceededWarning", f.emitter = t, f.type = e, f.count = s.length, Tr(f);
|
|
976
976
|
}
|
|
977
977
|
return t;
|
|
978
978
|
}
|
|
979
|
-
function
|
|
979
|
+
function Tr(t) {
|
|
980
980
|
typeof console.warn == "function" ? console.warn(t) : console.log(t);
|
|
981
981
|
}
|
|
982
|
-
|
|
982
|
+
m.prototype.addListener = function(e, r) {
|
|
983
983
|
return It(this, e, r, !1);
|
|
984
984
|
};
|
|
985
|
-
|
|
986
|
-
|
|
985
|
+
m.prototype.on = m.prototype.addListener;
|
|
986
|
+
m.prototype.prependListener = function(e, r) {
|
|
987
987
|
return It(this, e, r, !0);
|
|
988
988
|
};
|
|
989
989
|
function Ct(t, e, r) {
|
|
@@ -993,17 +993,17 @@ function Ct(t, e, r) {
|
|
|
993
993
|
}
|
|
994
994
|
return i.listener = r, i;
|
|
995
995
|
}
|
|
996
|
-
|
|
996
|
+
m.prototype.once = function(e, r) {
|
|
997
997
|
if (typeof r != "function")
|
|
998
998
|
throw new TypeError('"listener" argument must be a function');
|
|
999
999
|
return this.on(e, Ct(this, e, r)), this;
|
|
1000
1000
|
};
|
|
1001
|
-
|
|
1001
|
+
m.prototype.prependOnceListener = function(e, r) {
|
|
1002
1002
|
if (typeof r != "function")
|
|
1003
1003
|
throw new TypeError('"listener" argument must be a function');
|
|
1004
1004
|
return this.prependListener(e, Ct(this, e, r)), this;
|
|
1005
1005
|
};
|
|
1006
|
-
|
|
1006
|
+
m.prototype.removeListener = function(e, r) {
|
|
1007
1007
|
var n, i, o, s, f;
|
|
1008
1008
|
if (typeof r != "function")
|
|
1009
1009
|
throw new TypeError('"listener" argument must be a function');
|
|
@@ -1031,7 +1031,7 @@ g.prototype.removeListener = function(e, r) {
|
|
|
1031
1031
|
}
|
|
1032
1032
|
return this;
|
|
1033
1033
|
};
|
|
1034
|
-
|
|
1034
|
+
m.prototype.removeAllListeners = function(e) {
|
|
1035
1035
|
var r, n;
|
|
1036
1036
|
if (n = this._events, !n)
|
|
1037
1037
|
return this;
|
|
@@ -1050,14 +1050,14 @@ g.prototype.removeAllListeners = function(e) {
|
|
|
1050
1050
|
while (r[0]);
|
|
1051
1051
|
return this;
|
|
1052
1052
|
};
|
|
1053
|
-
|
|
1053
|
+
m.prototype.listeners = function(e) {
|
|
1054
1054
|
var r, n, i = this._events;
|
|
1055
1055
|
return i ? (r = i[e], r ? typeof r == "function" ? n = [r.listener || r] : n = Nr(r) : n = []) : n = [], n;
|
|
1056
1056
|
};
|
|
1057
|
-
|
|
1057
|
+
m.listenerCount = function(t, e) {
|
|
1058
1058
|
return typeof t.listenerCount == "function" ? t.listenerCount(e) : Ot.call(t, e);
|
|
1059
1059
|
};
|
|
1060
|
-
|
|
1060
|
+
m.prototype.listenerCount = Ot;
|
|
1061
1061
|
function Ot(t) {
|
|
1062
1062
|
var e = this._events;
|
|
1063
1063
|
if (e) {
|
|
@@ -1069,7 +1069,7 @@ function Ot(t) {
|
|
|
1069
1069
|
}
|
|
1070
1070
|
return 0;
|
|
1071
1071
|
}
|
|
1072
|
-
|
|
1072
|
+
m.prototype.eventNames = function() {
|
|
1073
1073
|
return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : [];
|
|
1074
1074
|
};
|
|
1075
1075
|
function Dr(t, e) {
|
|
@@ -1090,13 +1090,13 @@ function Nr(t) {
|
|
|
1090
1090
|
function At() {
|
|
1091
1091
|
throw new Error("setTimeout has not been defined");
|
|
1092
1092
|
}
|
|
1093
|
-
function
|
|
1093
|
+
function Lt() {
|
|
1094
1094
|
throw new Error("clearTimeout has not been defined");
|
|
1095
1095
|
}
|
|
1096
|
-
var Y = At, W =
|
|
1096
|
+
var Y = At, W = Lt;
|
|
1097
1097
|
typeof ie.setTimeout == "function" && (Y = setTimeout);
|
|
1098
1098
|
typeof ie.clearTimeout == "function" && (W = clearTimeout);
|
|
1099
|
-
function
|
|
1099
|
+
function Tt(t) {
|
|
1100
1100
|
if (Y === setTimeout)
|
|
1101
1101
|
return setTimeout(t, 0);
|
|
1102
1102
|
if ((Y === At || !Y) && setTimeout)
|
|
@@ -1114,7 +1114,7 @@ function Lt(t) {
|
|
|
1114
1114
|
function Fr(t) {
|
|
1115
1115
|
if (W === clearTimeout)
|
|
1116
1116
|
return clearTimeout(t);
|
|
1117
|
-
if ((W ===
|
|
1117
|
+
if ((W === Lt || !W) && clearTimeout)
|
|
1118
1118
|
return W = clearTimeout, clearTimeout(t);
|
|
1119
1119
|
try {
|
|
1120
1120
|
return W(t);
|
|
@@ -1126,18 +1126,18 @@ function Fr(t) {
|
|
|
1126
1126
|
}
|
|
1127
1127
|
}
|
|
1128
1128
|
}
|
|
1129
|
-
var V = [], ne = !1, ee,
|
|
1129
|
+
var V = [], ne = !1, ee, ge = -1;
|
|
1130
1130
|
function Mr() {
|
|
1131
|
-
!ne || !ee || (ne = !1, ee.length ? V = ee.concat(V) :
|
|
1131
|
+
!ne || !ee || (ne = !1, ee.length ? V = ee.concat(V) : ge = -1, V.length && Dt());
|
|
1132
1132
|
}
|
|
1133
1133
|
function Dt() {
|
|
1134
1134
|
if (!ne) {
|
|
1135
|
-
var t =
|
|
1135
|
+
var t = Tt(Mr);
|
|
1136
1136
|
ne = !0;
|
|
1137
1137
|
for (var e = V.length; e; ) {
|
|
1138
|
-
for (ee = V, V = []; ++
|
|
1139
|
-
ee && ee[
|
|
1140
|
-
|
|
1138
|
+
for (ee = V, V = []; ++ge < e; )
|
|
1139
|
+
ee && ee[ge].run();
|
|
1140
|
+
ge = -1, e = V.length;
|
|
1141
1141
|
}
|
|
1142
1142
|
ee = null, ne = !1, Fr(t);
|
|
1143
1143
|
}
|
|
@@ -1147,7 +1147,7 @@ function U(t) {
|
|
|
1147
1147
|
if (arguments.length > 1)
|
|
1148
1148
|
for (var r = 1; r < arguments.length; r++)
|
|
1149
1149
|
e[r - 1] = arguments[r];
|
|
1150
|
-
V.push(new Nt(t, e)), V.length === 1 && !ne &&
|
|
1150
|
+
V.push(new Nt(t, e)), V.length === 1 && !ne && Tt(Dt);
|
|
1151
1151
|
}
|
|
1152
1152
|
function Nt(t, e) {
|
|
1153
1153
|
this.fun = t, this.array = e;
|
|
@@ -1157,7 +1157,7 @@ Nt.prototype.run = function() {
|
|
|
1157
1157
|
};
|
|
1158
1158
|
var Br = {}, se = ie.performance || {};
|
|
1159
1159
|
se.now || se.mozNow || se.msNow || se.oNow || se.webkitNow;
|
|
1160
|
-
var
|
|
1160
|
+
var me = {
|
|
1161
1161
|
env: Br
|
|
1162
1162
|
}, ke;
|
|
1163
1163
|
typeof Object.create == "function" ? ke = function(e, r) {
|
|
@@ -1208,14 +1208,14 @@ function Ft(t, e) {
|
|
|
1208
1208
|
return function() {
|
|
1209
1209
|
return Ft(t, e).apply(this, arguments);
|
|
1210
1210
|
};
|
|
1211
|
-
if (
|
|
1211
|
+
if (me.noDeprecation === !0)
|
|
1212
1212
|
return t;
|
|
1213
1213
|
var r = !1;
|
|
1214
1214
|
function n() {
|
|
1215
1215
|
if (!r) {
|
|
1216
|
-
if (
|
|
1216
|
+
if (me.throwDeprecation)
|
|
1217
1217
|
throw new Error(e);
|
|
1218
|
-
|
|
1218
|
+
me.traceDeprecation ? console.trace(e) : console.error(e), r = !0;
|
|
1219
1219
|
}
|
|
1220
1220
|
return t.apply(this, arguments);
|
|
1221
1221
|
}
|
|
@@ -1223,7 +1223,7 @@ function Ft(t, e) {
|
|
|
1223
1223
|
}
|
|
1224
1224
|
var pe = {}, Oe;
|
|
1225
1225
|
function Pr(t) {
|
|
1226
|
-
if (Q(Oe) && (Oe =
|
|
1226
|
+
if (Q(Oe) && (Oe = me.env.NODE_DEBUG || ""), t = t.toUpperCase(), !pe[t])
|
|
1227
1227
|
if (new RegExp("\\b" + t + "\\b", "i").test(Oe)) {
|
|
1228
1228
|
var e = 0;
|
|
1229
1229
|
pe[t] = function() {
|
|
@@ -1292,34 +1292,34 @@ function ye(t, e, r) {
|
|
|
1292
1292
|
if (i)
|
|
1293
1293
|
return i;
|
|
1294
1294
|
var o = Object.keys(e), s = qr(o);
|
|
1295
|
-
if (t.showHidden && (o = Object.getOwnPropertyNames(e)),
|
|
1295
|
+
if (t.showHidden && (o = Object.getOwnPropertyNames(e)), Te(e) && (o.indexOf("message") >= 0 || o.indexOf("description") >= 0))
|
|
1296
1296
|
return Ae(e);
|
|
1297
1297
|
if (o.length === 0) {
|
|
1298
1298
|
if (De(e)) {
|
|
1299
1299
|
var f = e.name ? ": " + e.name : "";
|
|
1300
1300
|
return t.stylize("[Function" + f + "]", "special");
|
|
1301
1301
|
}
|
|
1302
|
-
if (
|
|
1302
|
+
if (Le(e))
|
|
1303
1303
|
return t.stylize(RegExp.prototype.toString.call(e), "regexp");
|
|
1304
1304
|
if (et(e))
|
|
1305
1305
|
return t.stylize(Date.prototype.toString.call(e), "date");
|
|
1306
|
-
if (
|
|
1306
|
+
if (Te(e))
|
|
1307
1307
|
return Ae(e);
|
|
1308
1308
|
}
|
|
1309
|
-
var a = "", l = !1,
|
|
1310
|
-
if (Yr(e) && (l = !0,
|
|
1311
|
-
var
|
|
1312
|
-
a = " [Function" +
|
|
1309
|
+
var a = "", l = !1, h = ["{", "}"];
|
|
1310
|
+
if (Yr(e) && (l = !0, h = ["[", "]"]), De(e)) {
|
|
1311
|
+
var c = e.name ? ": " + e.name : "";
|
|
1312
|
+
a = " [Function" + c + "]";
|
|
1313
1313
|
}
|
|
1314
|
-
if (
|
|
1315
|
-
return
|
|
1314
|
+
if (Le(e) && (a = " " + RegExp.prototype.toString.call(e)), et(e) && (a = " " + Date.prototype.toUTCString.call(e)), Te(e) && (a = " " + Ae(e)), o.length === 0 && (!l || e.length == 0))
|
|
1315
|
+
return h[0] + a + h[1];
|
|
1316
1316
|
if (r < 0)
|
|
1317
|
-
return
|
|
1317
|
+
return Le(e) ? t.stylize(RegExp.prototype.toString.call(e), "regexp") : t.stylize("[Object]", "special");
|
|
1318
1318
|
t.seen.push(e);
|
|
1319
|
-
var
|
|
1320
|
-
return l ?
|
|
1321
|
-
return Pe(t, e, r, s,
|
|
1322
|
-
}), t.seen.pop(), Jr(
|
|
1319
|
+
var d;
|
|
1320
|
+
return l ? d = zr(t, e, r, s, o) : d = o.map(function(g) {
|
|
1321
|
+
return Pe(t, e, r, s, g, l);
|
|
1322
|
+
}), t.seen.pop(), Jr(d, a, h);
|
|
1323
1323
|
}
|
|
1324
1324
|
function Vr(t, e) {
|
|
1325
1325
|
if (Q(e))
|
|
@@ -1405,7 +1405,7 @@ function Ye(t) {
|
|
|
1405
1405
|
function Q(t) {
|
|
1406
1406
|
return t === void 0;
|
|
1407
1407
|
}
|
|
1408
|
-
function
|
|
1408
|
+
function Le(t) {
|
|
1409
1409
|
return ue(t) && We(t) === "[object RegExp]";
|
|
1410
1410
|
}
|
|
1411
1411
|
function ue(t) {
|
|
@@ -1414,7 +1414,7 @@ function ue(t) {
|
|
|
1414
1414
|
function et(t) {
|
|
1415
1415
|
return ue(t) && We(t) === "[object Date]";
|
|
1416
1416
|
}
|
|
1417
|
-
function
|
|
1417
|
+
function Te(t) {
|
|
1418
1418
|
return ue(t) && (We(t) === "[object Error]" || t instanceof Error);
|
|
1419
1419
|
}
|
|
1420
1420
|
function De(t) {
|
|
@@ -1567,7 +1567,7 @@ function Kr(t) {
|
|
|
1567
1567
|
}
|
|
1568
1568
|
C.ReadableState = Ut;
|
|
1569
1569
|
var E = Pr("stream");
|
|
1570
|
-
oe(C,
|
|
1570
|
+
oe(C, m);
|
|
1571
1571
|
function en(t, e, r) {
|
|
1572
1572
|
if (typeof t.prependListener == "function")
|
|
1573
1573
|
return t.prependListener(e, r);
|
|
@@ -1583,7 +1583,7 @@ function Ut(t, e) {
|
|
|
1583
1583
|
}
|
|
1584
1584
|
function C(t) {
|
|
1585
1585
|
if (!(this instanceof C)) return new C(t);
|
|
1586
|
-
this._readableState = new Ut(t, this), this.readable = !0, t && typeof t.read == "function" && (this._read = t.read),
|
|
1586
|
+
this._readableState = new Ut(t, this), this.readable = !0, t && typeof t.read == "function" && (this._read = t.read), m.call(this);
|
|
1587
1587
|
}
|
|
1588
1588
|
C.prototype.push = function(t, e) {
|
|
1589
1589
|
var r = this._readableState;
|
|
@@ -1686,10 +1686,10 @@ C.prototype.pipe = function(t, e) {
|
|
|
1686
1686
|
break;
|
|
1687
1687
|
}
|
|
1688
1688
|
n.pipesCount += 1, E("pipe count=%d opts=%j", n.pipesCount, e);
|
|
1689
|
-
var i = !e || e.end !== !1, o = i ? f :
|
|
1689
|
+
var i = !e || e.end !== !1, o = i ? f : h;
|
|
1690
1690
|
n.endEmitted ? U(o) : r.once("end", o), t.on("unpipe", s);
|
|
1691
1691
|
function s(I) {
|
|
1692
|
-
E("onunpipe"), I === r &&
|
|
1692
|
+
E("onunpipe"), I === r && h();
|
|
1693
1693
|
}
|
|
1694
1694
|
function f() {
|
|
1695
1695
|
E("onend"), t.end();
|
|
@@ -1697,28 +1697,28 @@ C.prototype.pipe = function(t, e) {
|
|
|
1697
1697
|
var a = un(r);
|
|
1698
1698
|
t.on("drain", a);
|
|
1699
1699
|
var l = !1;
|
|
1700
|
-
function
|
|
1701
|
-
E("cleanup"), t.removeListener("close", x), t.removeListener("finish",
|
|
1700
|
+
function h() {
|
|
1701
|
+
E("cleanup"), t.removeListener("close", x), t.removeListener("finish", _), t.removeListener("drain", a), t.removeListener("error", g), t.removeListener("unpipe", s), r.removeListener("end", f), r.removeListener("end", h), r.removeListener("data", d), l = !0, n.awaitDrain && (!t._writableState || t._writableState.needDrain) && a();
|
|
1702
1702
|
}
|
|
1703
|
-
var
|
|
1704
|
-
r.on("data",
|
|
1705
|
-
function
|
|
1706
|
-
E("ondata"),
|
|
1703
|
+
var c = !1;
|
|
1704
|
+
r.on("data", d);
|
|
1705
|
+
function d(I) {
|
|
1706
|
+
E("ondata"), c = !1;
|
|
1707
1707
|
var v = t.write(I);
|
|
1708
|
-
v === !1 && !
|
|
1708
|
+
v === !1 && !c && ((n.pipesCount === 1 && n.pipes === t || n.pipesCount > 1 && $t(n.pipes, t) !== -1) && !l && (E("false write response, pause", r._readableState.awaitDrain), r._readableState.awaitDrain++, c = !0), r.pause());
|
|
1709
1709
|
}
|
|
1710
|
-
function
|
|
1711
|
-
E("onerror", I), S(), t.removeListener("error",
|
|
1710
|
+
function g(I) {
|
|
1711
|
+
E("onerror", I), S(), t.removeListener("error", g), tn(t, "error") === 0 && t.emit("error", I);
|
|
1712
1712
|
}
|
|
1713
|
-
en(t, "error",
|
|
1713
|
+
en(t, "error", g);
|
|
1714
1714
|
function x() {
|
|
1715
|
-
t.removeListener("finish",
|
|
1715
|
+
t.removeListener("finish", _), S();
|
|
1716
1716
|
}
|
|
1717
1717
|
t.once("close", x);
|
|
1718
|
-
function
|
|
1718
|
+
function _() {
|
|
1719
1719
|
E("onfinish"), t.removeListener("close", x), S();
|
|
1720
1720
|
}
|
|
1721
|
-
t.once("finish",
|
|
1721
|
+
t.once("finish", _);
|
|
1722
1722
|
function S() {
|
|
1723
1723
|
E("unpipe"), r.unpipe(t);
|
|
1724
1724
|
}
|
|
@@ -1746,7 +1746,7 @@ C.prototype.unpipe = function(t) {
|
|
|
1746
1746
|
return o === -1 ? this : (e.pipes.splice(o, 1), e.pipesCount -= 1, e.pipesCount === 1 && (e.pipes = e.pipes[0]), t.emit("unpipe", this), this);
|
|
1747
1747
|
};
|
|
1748
1748
|
C.prototype.on = function(t, e) {
|
|
1749
|
-
var r =
|
|
1749
|
+
var r = m.prototype.on.call(this, t, e);
|
|
1750
1750
|
if (t === "data")
|
|
1751
1751
|
this._readableState.flowing !== !1 && this.resume();
|
|
1752
1752
|
else if (t === "readable") {
|
|
@@ -1812,7 +1812,7 @@ function Pt(t, e) {
|
|
|
1812
1812
|
}
|
|
1813
1813
|
function dn(t, e, r) {
|
|
1814
1814
|
var n;
|
|
1815
|
-
return t < e.head.data.length ? (n = e.head.data.slice(0, t), e.head.data = e.head.data.slice(t)) : t === e.head.data.length ? n = e.shift() : n = r ? pn(t, e) :
|
|
1815
|
+
return t < e.head.data.length ? (n = e.head.data.slice(0, t), e.head.data = e.head.data.slice(t)) : t === e.head.data.length ? n = e.shift() : n = r ? pn(t, e) : gn(t, e), n;
|
|
1816
1816
|
}
|
|
1817
1817
|
function pn(t, e) {
|
|
1818
1818
|
var r = e.head, n = 1, i = r.data;
|
|
@@ -1826,7 +1826,7 @@ function pn(t, e) {
|
|
|
1826
1826
|
}
|
|
1827
1827
|
return e.length -= n, i;
|
|
1828
1828
|
}
|
|
1829
|
-
function
|
|
1829
|
+
function gn(t, e) {
|
|
1830
1830
|
var r = u.allocUnsafe(t), n = e.head, i = 1;
|
|
1831
1831
|
for (n.data.copy(r), t -= n.data.length; n = n.next; ) {
|
|
1832
1832
|
var o = n.data, s = t > o.length ? o.length : t;
|
|
@@ -1841,9 +1841,9 @@ function mn(t, e) {
|
|
|
1841
1841
|
function Ne(t) {
|
|
1842
1842
|
var e = t._readableState;
|
|
1843
1843
|
if (e.length > 0) throw new Error('"endReadable()" called on non-empty stream');
|
|
1844
|
-
e.endEmitted || (e.ended = !0, U(
|
|
1844
|
+
e.endEmitted || (e.ended = !0, U(mn, e, t));
|
|
1845
1845
|
}
|
|
1846
|
-
function
|
|
1846
|
+
function mn(t, e) {
|
|
1847
1847
|
!t.endEmitted && t.length === 0 && (t.endEmitted = !0, e.readable = !1, e.emit("end"));
|
|
1848
1848
|
}
|
|
1849
1849
|
function _n(t, e) {
|
|
@@ -1855,8 +1855,8 @@ function $t(t, e) {
|
|
|
1855
1855
|
if (t[r] === e) return r;
|
|
1856
1856
|
return -1;
|
|
1857
1857
|
}
|
|
1858
|
-
|
|
1859
|
-
oe(
|
|
1858
|
+
T.WritableState = He;
|
|
1859
|
+
oe(T, m);
|
|
1860
1860
|
function wn() {
|
|
1861
1861
|
}
|
|
1862
1862
|
function yn(t, e, r) {
|
|
@@ -1880,11 +1880,11 @@ He.prototype.getBuffer = function() {
|
|
|
1880
1880
|
r.push(e), e = e.next;
|
|
1881
1881
|
return r;
|
|
1882
1882
|
};
|
|
1883
|
-
function
|
|
1884
|
-
if (!(this instanceof
|
|
1885
|
-
this._writableState = new He(t, this), this.writable = !0, t && (typeof t.write == "function" && (this._write = t.write), typeof t.writev == "function" && (this._writev = t.writev)),
|
|
1883
|
+
function T(t) {
|
|
1884
|
+
if (!(this instanceof T) && !(this instanceof B)) return new T(t);
|
|
1885
|
+
this._writableState = new He(t, this), this.writable = !0, t && (typeof t.write == "function" && (this._write = t.write), typeof t.writev == "function" && (this._writev = t.writev)), m.call(this);
|
|
1886
1886
|
}
|
|
1887
|
-
|
|
1887
|
+
T.prototype.pipe = function() {
|
|
1888
1888
|
this.emit("error", new Error("Cannot pipe, not readable"));
|
|
1889
1889
|
};
|
|
1890
1890
|
function vn(t, e) {
|
|
@@ -1895,19 +1895,19 @@ function bn(t, e, r, n) {
|
|
|
1895
1895
|
var i = !0, o = !1;
|
|
1896
1896
|
return r === null ? o = new TypeError("May not write null values to stream") : !u.isBuffer(r) && typeof r != "string" && r !== void 0 && !e.objectMode && (o = new TypeError("Invalid non-string/buffer chunk")), o && (t.emit("error", o), U(n, o), i = !1), i;
|
|
1897
1897
|
}
|
|
1898
|
-
|
|
1898
|
+
T.prototype.write = function(t, e, r) {
|
|
1899
1899
|
var n = this._writableState, i = !1;
|
|
1900
1900
|
return typeof e == "function" && (r = e, e = null), u.isBuffer(t) ? e = "buffer" : e || (e = n.defaultEncoding), typeof r != "function" && (r = wn), n.ended ? vn(this, r) : bn(this, n, t, r) && (n.pendingcb++, i = xn(this, n, t, e, r)), i;
|
|
1901
1901
|
};
|
|
1902
|
-
|
|
1902
|
+
T.prototype.cork = function() {
|
|
1903
1903
|
var t = this._writableState;
|
|
1904
1904
|
t.corked++;
|
|
1905
1905
|
};
|
|
1906
|
-
|
|
1906
|
+
T.prototype.uncork = function() {
|
|
1907
1907
|
var t = this._writableState;
|
|
1908
1908
|
t.corked && (t.corked--, !t.writing && !t.corked && !t.finished && !t.bufferProcessing && t.bufferedRequest && jt(this, t));
|
|
1909
1909
|
};
|
|
1910
|
-
|
|
1910
|
+
T.prototype.setDefaultEncoding = function(e) {
|
|
1911
1911
|
if (typeof e == "string" && (e = e.toLowerCase()), !(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((e + "").toLowerCase()) > -1)) throw new TypeError("Unknown encoding: " + e);
|
|
1912
1912
|
return this._writableState.defaultEncoding = e, this;
|
|
1913
1913
|
};
|
|
@@ -1960,19 +1960,19 @@ function jt(t, e) {
|
|
|
1960
1960
|
$e(t, e, !0, e.length, i, "", o.finish), e.pendingcb++, e.lastBufferedRequest = null, o.next ? (e.corkedRequestsFree = o.next, o.next = null) : e.corkedRequestsFree = new zt(e);
|
|
1961
1961
|
} else {
|
|
1962
1962
|
for (; r; ) {
|
|
1963
|
-
var f = r.chunk, a = r.encoding, l = r.callback,
|
|
1964
|
-
if ($e(t, e, !1,
|
|
1963
|
+
var f = r.chunk, a = r.encoding, l = r.callback, h = e.objectMode ? 1 : f.length;
|
|
1964
|
+
if ($e(t, e, !1, h, f, a, l), r = r.next, e.writing)
|
|
1965
1965
|
break;
|
|
1966
1966
|
}
|
|
1967
1967
|
r === null && (e.lastBufferedRequest = null);
|
|
1968
1968
|
}
|
|
1969
1969
|
e.bufferedRequestCount = 0, e.bufferedRequest = r, e.bufferProcessing = !1;
|
|
1970
1970
|
}
|
|
1971
|
-
|
|
1971
|
+
T.prototype._write = function(t, e, r) {
|
|
1972
1972
|
r(new Error("not implemented"));
|
|
1973
1973
|
};
|
|
1974
|
-
|
|
1975
|
-
|
|
1974
|
+
T.prototype._writev = null;
|
|
1975
|
+
T.prototype.end = function(t, e, r) {
|
|
1976
1976
|
var n = this._writableState;
|
|
1977
1977
|
typeof t == "function" ? (r = t, t = null, e = null) : typeof e == "function" && (r = e, e = null), t != null && this.write(t, e), n.corked && (n.corked = 1, this.uncork()), !n.ending && !n.finished && On(this, n, r);
|
|
1978
1978
|
};
|
|
@@ -2001,23 +2001,23 @@ function zt(t) {
|
|
|
2001
2001
|
};
|
|
2002
2002
|
}
|
|
2003
2003
|
oe(B, C);
|
|
2004
|
-
var st = Object.keys(
|
|
2004
|
+
var st = Object.keys(T.prototype);
|
|
2005
2005
|
for (var Fe = 0; Fe < st.length; Fe++) {
|
|
2006
2006
|
var Me = st[Fe];
|
|
2007
|
-
B.prototype[Me] || (B.prototype[Me] =
|
|
2007
|
+
B.prototype[Me] || (B.prototype[Me] = T.prototype[Me]);
|
|
2008
2008
|
}
|
|
2009
2009
|
function B(t) {
|
|
2010
2010
|
if (!(this instanceof B)) return new B(t);
|
|
2011
|
-
C.call(this, t),
|
|
2011
|
+
C.call(this, t), T.call(this, t), t && t.readable === !1 && (this.readable = !1), t && t.writable === !1 && (this.writable = !1), this.allowHalfOpen = !0, t && t.allowHalfOpen === !1 && (this.allowHalfOpen = !1), this.once("end", An);
|
|
2012
2012
|
}
|
|
2013
2013
|
function An() {
|
|
2014
|
-
this.allowHalfOpen || this._writableState.ended || U(
|
|
2014
|
+
this.allowHalfOpen || this._writableState.ended || U(Ln, this);
|
|
2015
2015
|
}
|
|
2016
|
-
function
|
|
2016
|
+
function Ln(t) {
|
|
2017
2017
|
t.end();
|
|
2018
2018
|
}
|
|
2019
2019
|
oe(k, B);
|
|
2020
|
-
function
|
|
2020
|
+
function Tn(t) {
|
|
2021
2021
|
this.afterTransform = function(e, r) {
|
|
2022
2022
|
return Dn(t, e, r);
|
|
2023
2023
|
}, this.needTransform = !1, this.transforming = !1, this.writecb = null, this.writechunk = null, this.writeencoding = null;
|
|
@@ -2033,7 +2033,7 @@ function Dn(t, e, r) {
|
|
|
2033
2033
|
}
|
|
2034
2034
|
function k(t) {
|
|
2035
2035
|
if (!(this instanceof k)) return new k(t);
|
|
2036
|
-
B.call(this, t), this._transformState = new
|
|
2036
|
+
B.call(this, t), this._transformState = new Tn(this);
|
|
2037
2037
|
var e = this;
|
|
2038
2038
|
this._readableState.needReadable = !0, this._readableState.sync = !1, t && (typeof t.transform == "function" && (this._transform = t.transform), typeof t.flush == "function" && (this._flush = t.flush)), this.once("prefinish", function() {
|
|
2039
2039
|
typeof this._flush == "function" ? this._flush(function(r) {
|
|
@@ -2073,20 +2073,20 @@ function fe(t) {
|
|
|
2073
2073
|
fe.prototype._transform = function(t, e, r) {
|
|
2074
2074
|
r(null, t);
|
|
2075
2075
|
};
|
|
2076
|
-
oe(z,
|
|
2076
|
+
oe(z, m);
|
|
2077
2077
|
z.Readable = C;
|
|
2078
|
-
z.Writable =
|
|
2078
|
+
z.Writable = T;
|
|
2079
2079
|
z.Duplex = B;
|
|
2080
2080
|
z.Transform = k;
|
|
2081
2081
|
z.PassThrough = fe;
|
|
2082
2082
|
z.Stream = z;
|
|
2083
2083
|
function z() {
|
|
2084
|
-
|
|
2084
|
+
m.call(this);
|
|
2085
2085
|
}
|
|
2086
2086
|
z.prototype.pipe = function(t, e) {
|
|
2087
2087
|
var r = this;
|
|
2088
|
-
function n(
|
|
2089
|
-
t.writable && t.write(
|
|
2088
|
+
function n(h) {
|
|
2089
|
+
t.writable && t.write(h) === !1 && r.pause && r.pause();
|
|
2090
2090
|
}
|
|
2091
2091
|
r.on("data", n);
|
|
2092
2092
|
function i() {
|
|
@@ -2100,9 +2100,9 @@ z.prototype.pipe = function(t, e) {
|
|
|
2100
2100
|
function f() {
|
|
2101
2101
|
o || (o = !0, typeof t.destroy == "function" && t.destroy());
|
|
2102
2102
|
}
|
|
2103
|
-
function a(
|
|
2104
|
-
if (l(),
|
|
2105
|
-
throw
|
|
2103
|
+
function a(h) {
|
|
2104
|
+
if (l(), m.listenerCount(this, "error") === 0)
|
|
2105
|
+
throw h;
|
|
2106
2106
|
}
|
|
2107
2107
|
r.on("error", a), t.on("error", a);
|
|
2108
2108
|
function l() {
|
|
@@ -2113,9 +2113,9 @@ z.prototype.pipe = function(t, e) {
|
|
|
2113
2113
|
const Jt = function(t) {
|
|
2114
2114
|
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
2115
2115
|
};
|
|
2116
|
-
class
|
|
2116
|
+
class y extends Error {
|
|
2117
2117
|
constructor(e, r, n, ...i) {
|
|
2118
|
-
Array.isArray(r) && (r = r.join(" ").trim()), super(r), Error.captureStackTrace !== void 0 && Error.captureStackTrace(this,
|
|
2118
|
+
Array.isArray(r) && (r = r.join(" ").trim()), super(r), Error.captureStackTrace !== void 0 && Error.captureStackTrace(this, y), this.code = e;
|
|
2119
2119
|
for (const o of i)
|
|
2120
2120
|
for (const s in o) {
|
|
2121
2121
|
const f = o[s];
|
|
@@ -2133,14 +2133,14 @@ const Yt = function(t) {
|
|
|
2133
2133
|
e[r] = { name: i };
|
|
2134
2134
|
else if (Jt(i)) {
|
|
2135
2135
|
if (typeof i.name != "string")
|
|
2136
|
-
throw new
|
|
2136
|
+
throw new y("CSV_OPTION_COLUMNS_MISSING_NAME", [
|
|
2137
2137
|
"Option columns missing name:",
|
|
2138
2138
|
`property "name" is required at position ${r}`,
|
|
2139
2139
|
"when column is an object literal"
|
|
2140
2140
|
]);
|
|
2141
2141
|
e[r] = i;
|
|
2142
2142
|
} else
|
|
2143
|
-
throw new
|
|
2143
|
+
throw new y("CSV_INVALID_COLUMN_DEFINITION", [
|
|
2144
2144
|
"Invalid column definition:",
|
|
2145
2145
|
"expect a string or a literal object,",
|
|
2146
2146
|
`got ${JSON.stringify(i)} at position ${r}`
|
|
@@ -2246,7 +2246,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2246
2246
|
else if (e.encoding === null || e.encoding === !1)
|
|
2247
2247
|
e.encoding = null;
|
|
2248
2248
|
else if (typeof e.encoding != "string" && e.encoding !== null)
|
|
2249
|
-
throw new
|
|
2249
|
+
throw new y(
|
|
2250
2250
|
"CSV_INVALID_OPTION_ENCODING",
|
|
2251
2251
|
[
|
|
2252
2252
|
"Invalid option encoding:",
|
|
@@ -2258,7 +2258,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2258
2258
|
if (e.bom === void 0 || e.bom === null || e.bom === !1)
|
|
2259
2259
|
e.bom = !1;
|
|
2260
2260
|
else if (e.bom !== !0)
|
|
2261
|
-
throw new
|
|
2261
|
+
throw new y(
|
|
2262
2262
|
"CSV_INVALID_OPTION_BOM",
|
|
2263
2263
|
[
|
|
2264
2264
|
"Invalid option bom:",
|
|
@@ -2272,7 +2272,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2272
2272
|
else if (typeof e.cast == "function")
|
|
2273
2273
|
e.cast_function = e.cast, e.cast = !0;
|
|
2274
2274
|
else if (e.cast !== !0)
|
|
2275
|
-
throw new
|
|
2275
|
+
throw new y(
|
|
2276
2276
|
"CSV_INVALID_OPTION_CAST",
|
|
2277
2277
|
[
|
|
2278
2278
|
"Invalid option cast:",
|
|
@@ -2289,7 +2289,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2289
2289
|
return isNaN(i) ? n : new Date(i);
|
|
2290
2290
|
};
|
|
2291
2291
|
else if (typeof e.cast_date != "function")
|
|
2292
|
-
throw new
|
|
2292
|
+
throw new y(
|
|
2293
2293
|
"CSV_INVALID_OPTION_CAST_DATE",
|
|
2294
2294
|
[
|
|
2295
2295
|
"Invalid option cast_date:",
|
|
@@ -2307,7 +2307,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2307
2307
|
else if (e.columns === void 0 || e.columns === null || e.columns === !1)
|
|
2308
2308
|
e.columns = !1;
|
|
2309
2309
|
else
|
|
2310
|
-
throw new
|
|
2310
|
+
throw new y(
|
|
2311
2311
|
"CSV_INVALID_OPTION_COLUMNS",
|
|
2312
2312
|
[
|
|
2313
2313
|
"Invalid option columns:",
|
|
@@ -2320,7 +2320,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2320
2320
|
e.group_columns_by_name = !1;
|
|
2321
2321
|
else {
|
|
2322
2322
|
if (e.group_columns_by_name !== !0)
|
|
2323
|
-
throw new
|
|
2323
|
+
throw new y(
|
|
2324
2324
|
"CSV_INVALID_OPTION_GROUP_COLUMNS_BY_NAME",
|
|
2325
2325
|
[
|
|
2326
2326
|
"Invalid option group_columns_by_name:",
|
|
@@ -2330,7 +2330,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2330
2330
|
e
|
|
2331
2331
|
);
|
|
2332
2332
|
if (e.columns === !1)
|
|
2333
|
-
throw new
|
|
2333
|
+
throw new y(
|
|
2334
2334
|
"CSV_INVALID_OPTION_GROUP_COLUMNS_BY_NAME",
|
|
2335
2335
|
[
|
|
2336
2336
|
"Invalid option group_columns_by_name:",
|
|
@@ -2342,7 +2342,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2342
2342
|
if (e.comment === void 0 || e.comment === null || e.comment === !1 || e.comment === "")
|
|
2343
2343
|
e.comment = null;
|
|
2344
2344
|
else if (typeof e.comment == "string" && (e.comment = u.from(e.comment, e.encoding)), !D(e.comment))
|
|
2345
|
-
throw new
|
|
2345
|
+
throw new y(
|
|
2346
2346
|
"CSV_INVALID_OPTION_COMMENT",
|
|
2347
2347
|
[
|
|
2348
2348
|
"Invalid option comment:",
|
|
@@ -2354,7 +2354,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2354
2354
|
if (e.comment_no_infix === void 0 || e.comment_no_infix === null || e.comment_no_infix === !1)
|
|
2355
2355
|
e.comment_no_infix = !1;
|
|
2356
2356
|
else if (e.comment_no_infix !== !0)
|
|
2357
|
-
throw new
|
|
2357
|
+
throw new y(
|
|
2358
2358
|
"CSV_INVALID_OPTION_COMMENT",
|
|
2359
2359
|
[
|
|
2360
2360
|
"Invalid option comment_no_infix:",
|
|
@@ -2365,7 +2365,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2365
2365
|
);
|
|
2366
2366
|
const r = JSON.stringify(e.delimiter);
|
|
2367
2367
|
if (Array.isArray(e.delimiter) || (e.delimiter = [e.delimiter]), e.delimiter.length === 0)
|
|
2368
|
-
throw new
|
|
2368
|
+
throw new y(
|
|
2369
2369
|
"CSV_INVALID_OPTION_DELIMITER",
|
|
2370
2370
|
[
|
|
2371
2371
|
"Invalid option delimiter:",
|
|
@@ -2378,7 +2378,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2378
2378
|
if (n == null || n === !1)
|
|
2379
2379
|
return u.from(",", e.encoding);
|
|
2380
2380
|
if (typeof n == "string" && (n = u.from(n, e.encoding)), !D(n) || n.length === 0)
|
|
2381
|
-
throw new
|
|
2381
|
+
throw new y(
|
|
2382
2382
|
"CSV_INVALID_OPTION_DELIMITER",
|
|
2383
2383
|
[
|
|
2384
2384
|
"Invalid option delimiter:",
|
|
@@ -2419,7 +2419,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2419
2419
|
else if (typeof e.ignore_last_delimiters == "number")
|
|
2420
2420
|
e.ignore_last_delimiters = Math.floor(e.ignore_last_delimiters), e.ignore_last_delimiters === 0 && (e.ignore_last_delimiters = !1);
|
|
2421
2421
|
else if (typeof e.ignore_last_delimiters != "boolean")
|
|
2422
|
-
throw new
|
|
2422
|
+
throw new y(
|
|
2423
2423
|
"CSV_INVALID_OPTION_IGNORE_LAST_DELIMITERS",
|
|
2424
2424
|
[
|
|
2425
2425
|
"Invalid option `ignore_last_delimiters`:",
|
|
@@ -2429,7 +2429,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2429
2429
|
e
|
|
2430
2430
|
);
|
|
2431
2431
|
if (e.ignore_last_delimiters === !0 && e.columns === !1)
|
|
2432
|
-
throw new
|
|
2432
|
+
throw new y(
|
|
2433
2433
|
"CSV_IGNORE_LAST_DELIMITERS_REQUIRES_COLUMNS",
|
|
2434
2434
|
[
|
|
2435
2435
|
"The option `ignore_last_delimiters`",
|
|
@@ -2477,7 +2477,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2477
2477
|
if (e.on_record === void 0 || e.on_record === null)
|
|
2478
2478
|
e.on_record = void 0;
|
|
2479
2479
|
else if (typeof e.on_record != "function")
|
|
2480
|
-
throw new
|
|
2480
|
+
throw new y(
|
|
2481
2481
|
"CSV_INVALID_OPTION_ON_RECORD",
|
|
2482
2482
|
[
|
|
2483
2483
|
"Invalid option `on_record`:",
|
|
@@ -2506,7 +2506,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2506
2506
|
e.record_delimiter = [];
|
|
2507
2507
|
else if (typeof e.record_delimiter == "string" || D(e.record_delimiter)) {
|
|
2508
2508
|
if (e.record_delimiter.length === 0)
|
|
2509
|
-
throw new
|
|
2509
|
+
throw new y(
|
|
2510
2510
|
"CSV_INVALID_OPTION_RECORD_DELIMITER",
|
|
2511
2511
|
[
|
|
2512
2512
|
"Invalid option `record_delimiter`:",
|
|
@@ -2517,7 +2517,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2517
2517
|
);
|
|
2518
2518
|
e.record_delimiter = [e.record_delimiter];
|
|
2519
2519
|
} else if (!Array.isArray(e.record_delimiter))
|
|
2520
|
-
throw new
|
|
2520
|
+
throw new y(
|
|
2521
2521
|
"CSV_INVALID_OPTION_RECORD_DELIMITER",
|
|
2522
2522
|
[
|
|
2523
2523
|
"Invalid option `record_delimiter`:",
|
|
@@ -2528,7 +2528,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2528
2528
|
);
|
|
2529
2529
|
if (e.record_delimiter = e.record_delimiter.map(function(n, i) {
|
|
2530
2530
|
if (typeof n != "string" && !D(n))
|
|
2531
|
-
throw new
|
|
2531
|
+
throw new y(
|
|
2532
2532
|
"CSV_INVALID_OPTION_RECORD_DELIMITER",
|
|
2533
2533
|
[
|
|
2534
2534
|
"Invalid option `record_delimiter`:",
|
|
@@ -2539,7 +2539,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2539
2539
|
e
|
|
2540
2540
|
);
|
|
2541
2541
|
if (n.length === 0)
|
|
2542
|
-
throw new
|
|
2542
|
+
throw new y(
|
|
2543
2543
|
"CSV_INVALID_OPTION_RECORD_DELIMITER",
|
|
2544
2544
|
[
|
|
2545
2545
|
"Invalid option `record_delimiter`:",
|
|
@@ -2665,22 +2665,22 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2665
2665
|
state: kn(r),
|
|
2666
2666
|
__needMoreData: function(n, i, o) {
|
|
2667
2667
|
if (o) return !1;
|
|
2668
|
-
const { encoding: s, escape: f, quote: a } = this.options, { quoting: l, needMoreDataSize:
|
|
2669
|
-
|
|
2668
|
+
const { encoding: s, escape: f, quote: a } = this.options, { quoting: l, needMoreDataSize: h, recordDelimiterMaxLength: c } = this.state, d = i - n - 1, g = Math.max(
|
|
2669
|
+
h,
|
|
2670
2670
|
// Skip if the remaining buffer smaller than record delimiter
|
|
2671
2671
|
// If "record_delimiter" is yet to be discovered:
|
|
2672
2672
|
// 1. It is equals to `[]` and "recordDelimiterMaxLength" equals `0`
|
|
2673
2673
|
// 2. We set the length to windows line ending in the current encoding
|
|
2674
2674
|
// Note, that encoding is known from user or bom discovery at that point
|
|
2675
2675
|
// recordDelimiterMaxLength,
|
|
2676
|
-
|
|
2677
|
-
`, s).length :
|
|
2676
|
+
c === 0 ? u.from(`\r
|
|
2677
|
+
`, s).length : c,
|
|
2678
2678
|
// Skip if remaining buffer can be an escaped quote
|
|
2679
2679
|
l ? (f === null ? 0 : f.length) + a.length : 0,
|
|
2680
2680
|
// Skip if remaining buffer can be record delimiter following the closing quote
|
|
2681
|
-
l ? a.length +
|
|
2681
|
+
l ? a.length + c : 0
|
|
2682
2682
|
);
|
|
2683
|
-
return
|
|
2683
|
+
return d < g;
|
|
2684
2684
|
},
|
|
2685
2685
|
// Central parser implementation
|
|
2686
2686
|
parse: function(n, i, o, s) {
|
|
@@ -2688,17 +2688,17 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2688
2688
|
bom: f,
|
|
2689
2689
|
comment_no_infix: a,
|
|
2690
2690
|
encoding: l,
|
|
2691
|
-
from_line:
|
|
2692
|
-
ltrim:
|
|
2693
|
-
max_record_size:
|
|
2694
|
-
raw:
|
|
2691
|
+
from_line: h,
|
|
2692
|
+
ltrim: c,
|
|
2693
|
+
max_record_size: d,
|
|
2694
|
+
raw: g,
|
|
2695
2695
|
relax_quotes: x,
|
|
2696
|
-
rtrim:
|
|
2696
|
+
rtrim: _,
|
|
2697
2697
|
skip_empty_lines: S,
|
|
2698
2698
|
to: I,
|
|
2699
2699
|
to_line: v
|
|
2700
2700
|
} = this.options;
|
|
2701
|
-
let { comment:
|
|
2701
|
+
let { comment: w, escape: R, quote: F, record_delimiter: Re } = this.options;
|
|
2702
2702
|
const { bomSkipped: Wt, previousBuf: ce, rawBuffer: Qt, escapeIsQuote: Ht } = this.state;
|
|
2703
2703
|
let b;
|
|
2704
2704
|
if (ce === void 0)
|
|
@@ -2727,51 +2727,51 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2727
2727
|
});
|
|
2728
2728
|
for (const A in he)
|
|
2729
2729
|
this.options[A] = he[A];
|
|
2730
|
-
({ comment:
|
|
2730
|
+
({ comment: w, escape: R, quote: F } = this.options);
|
|
2731
2731
|
break;
|
|
2732
2732
|
}
|
|
2733
2733
|
this.state.bomSkipped = !0;
|
|
2734
2734
|
}
|
|
2735
2735
|
const Ie = b.length;
|
|
2736
|
-
let
|
|
2737
|
-
for (
|
|
2736
|
+
let p;
|
|
2737
|
+
for (p = 0; p < Ie && !this.__needMoreData(p, Ie, i); p++) {
|
|
2738
2738
|
if (this.state.wasRowDelimiter === !0 && (this.info.lines++, this.state.wasRowDelimiter = !1), v !== -1 && this.info.lines > v) {
|
|
2739
2739
|
this.state.stop = !0, s();
|
|
2740
2740
|
return;
|
|
2741
2741
|
}
|
|
2742
2742
|
this.state.quoting === !1 && Re.length === 0 && this.__autoDiscoverRecordDelimiter(
|
|
2743
2743
|
b,
|
|
2744
|
-
|
|
2744
|
+
p
|
|
2745
2745
|
) && (Re = this.options.record_delimiter);
|
|
2746
|
-
const O = b[
|
|
2747
|
-
if (
|
|
2746
|
+
const O = b[p];
|
|
2747
|
+
if (g === !0 && Qt.append(O), (O === $n || O === jn) && this.state.wasRowDelimiter === !1 && (this.state.wasRowDelimiter = !0), this.state.escaping === !0)
|
|
2748
2748
|
this.state.escaping = !1;
|
|
2749
2749
|
else {
|
|
2750
|
-
if (R !== null && this.state.quoting === !0 && this.__isEscape(b,
|
|
2750
|
+
if (R !== null && this.state.quoting === !0 && this.__isEscape(b, p, O) && p + R.length < Ie)
|
|
2751
2751
|
if (Ht) {
|
|
2752
|
-
if (this.__isQuote(b,
|
|
2753
|
-
this.state.escaping = !0,
|
|
2752
|
+
if (this.__isQuote(b, p + R.length)) {
|
|
2753
|
+
this.state.escaping = !0, p += R.length - 1;
|
|
2754
2754
|
continue;
|
|
2755
2755
|
}
|
|
2756
2756
|
} else {
|
|
2757
|
-
this.state.escaping = !0,
|
|
2757
|
+
this.state.escaping = !0, p += R.length - 1;
|
|
2758
2758
|
continue;
|
|
2759
2759
|
}
|
|
2760
|
-
if (this.state.commenting === !1 && this.__isQuote(b,
|
|
2760
|
+
if (this.state.commenting === !1 && this.__isQuote(b, p))
|
|
2761
2761
|
if (this.state.quoting === !0) {
|
|
2762
|
-
const A = b[
|
|
2762
|
+
const A = b[p + F.length], Z = _ && this.__isCharTrimable(b, p + F.length), j = w !== null && this.__compareBytes(w, b, p + F.length, A), X = this.__isDelimiter(
|
|
2763
2763
|
b,
|
|
2764
|
-
|
|
2764
|
+
p + F.length,
|
|
2765
2765
|
A
|
|
2766
|
-
), de = Re.length === 0 ? this.__autoDiscoverRecordDelimiter(b,
|
|
2767
|
-
if (R !== null && this.__isEscape(b,
|
|
2768
|
-
|
|
2766
|
+
), de = Re.length === 0 ? this.__autoDiscoverRecordDelimiter(b, p + F.length) : this.__isRecordDelimiter(A, b, p + F.length);
|
|
2767
|
+
if (R !== null && this.__isEscape(b, p, O) && this.__isQuote(b, p + R.length))
|
|
2768
|
+
p += R.length - 1;
|
|
2769
2769
|
else if (!A || X || de || j || Z) {
|
|
2770
|
-
this.state.quoting = !1, this.state.wasQuoting = !0,
|
|
2770
|
+
this.state.quoting = !1, this.state.wasQuoting = !0, p += F.length - 1;
|
|
2771
2771
|
continue;
|
|
2772
2772
|
} else if (x === !1) {
|
|
2773
2773
|
const Ge = this.__error(
|
|
2774
|
-
new
|
|
2774
|
+
new y(
|
|
2775
2775
|
"CSV_INVALID_CLOSING_QUOTE",
|
|
2776
2776
|
[
|
|
2777
2777
|
"Invalid Closing Quote:",
|
|
@@ -2786,13 +2786,13 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2786
2786
|
);
|
|
2787
2787
|
if (Ge !== void 0) return Ge;
|
|
2788
2788
|
} else
|
|
2789
|
-
this.state.quoting = !1, this.state.wasQuoting = !0, this.state.field.prepend(F),
|
|
2789
|
+
this.state.quoting = !1, this.state.wasQuoting = !0, this.state.field.prepend(F), p += F.length - 1;
|
|
2790
2790
|
} else if (this.state.field.length !== 0) {
|
|
2791
2791
|
if (x === !1) {
|
|
2792
2792
|
const A = this.__infoField(), Z = Object.keys(re).map(
|
|
2793
2793
|
(X) => re[X].equals(this.state.field.toString()) ? X : !1
|
|
2794
2794
|
).filter(Boolean)[0], j = this.__error(
|
|
2795
|
-
new
|
|
2795
|
+
new y(
|
|
2796
2796
|
"INVALID_OPENING_QUOTE",
|
|
2797
2797
|
[
|
|
2798
2798
|
"Invalid Opening Quote:",
|
|
@@ -2809,31 +2809,31 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2809
2809
|
if (j !== void 0) return j;
|
|
2810
2810
|
}
|
|
2811
2811
|
} else {
|
|
2812
|
-
this.state.quoting = !0,
|
|
2812
|
+
this.state.quoting = !0, p += F.length - 1;
|
|
2813
2813
|
continue;
|
|
2814
2814
|
}
|
|
2815
2815
|
if (this.state.quoting === !1) {
|
|
2816
2816
|
const A = this.__isRecordDelimiter(
|
|
2817
2817
|
O,
|
|
2818
2818
|
b,
|
|
2819
|
-
|
|
2819
|
+
p
|
|
2820
2820
|
);
|
|
2821
2821
|
if (A !== 0) {
|
|
2822
2822
|
if (this.state.commenting && this.state.wasQuoting === !1 && this.state.record.length === 0 && this.state.field.length === 0)
|
|
2823
2823
|
this.info.comment_lines++;
|
|
2824
2824
|
else {
|
|
2825
|
-
if (this.state.enabled === !1 && this.info.lines + (this.state.wasRowDelimiter === !0 ? 1 : 0) >=
|
|
2826
|
-
this.state.enabled = !0, this.__resetField(), this.__resetRecord(),
|
|
2825
|
+
if (this.state.enabled === !1 && this.info.lines + (this.state.wasRowDelimiter === !0 ? 1 : 0) >= h) {
|
|
2826
|
+
this.state.enabled = !0, this.__resetField(), this.__resetRecord(), p += A - 1;
|
|
2827
2827
|
continue;
|
|
2828
2828
|
}
|
|
2829
2829
|
if (S === !0 && this.state.wasQuoting === !1 && this.state.record.length === 0 && this.state.field.length === 0) {
|
|
2830
|
-
this.info.empty_lines++,
|
|
2830
|
+
this.info.empty_lines++, p += A - 1;
|
|
2831
2831
|
continue;
|
|
2832
2832
|
}
|
|
2833
|
-
this.info.bytes = this.state.bufBytesStart +
|
|
2833
|
+
this.info.bytes = this.state.bufBytesStart + p;
|
|
2834
2834
|
const X = this.__onField();
|
|
2835
2835
|
if (X !== void 0) return X;
|
|
2836
|
-
this.info.bytes = this.state.bufBytesStart +
|
|
2836
|
+
this.info.bytes = this.state.bufBytesStart + p + A;
|
|
2837
2837
|
const de = this.__onRecord(o);
|
|
2838
2838
|
if (de !== void 0) return de;
|
|
2839
2839
|
if (I !== -1 && this.info.records >= I) {
|
|
@@ -2841,46 +2841,46 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2841
2841
|
return;
|
|
2842
2842
|
}
|
|
2843
2843
|
}
|
|
2844
|
-
this.state.commenting = !1,
|
|
2844
|
+
this.state.commenting = !1, p += A - 1;
|
|
2845
2845
|
continue;
|
|
2846
2846
|
}
|
|
2847
2847
|
if (this.state.commenting)
|
|
2848
2848
|
continue;
|
|
2849
|
-
if (
|
|
2849
|
+
if (w !== null && (a === !1 || this.state.record.length === 0 && this.state.field.length === 0) && this.__compareBytes(w, b, p, O) !== 0) {
|
|
2850
2850
|
this.state.commenting = !0;
|
|
2851
2851
|
continue;
|
|
2852
2852
|
}
|
|
2853
|
-
const Z = this.__isDelimiter(b,
|
|
2853
|
+
const Z = this.__isDelimiter(b, p, O);
|
|
2854
2854
|
if (Z !== 0) {
|
|
2855
|
-
this.info.bytes = this.state.bufBytesStart +
|
|
2855
|
+
this.info.bytes = this.state.bufBytesStart + p;
|
|
2856
2856
|
const j = this.__onField();
|
|
2857
2857
|
if (j !== void 0) return j;
|
|
2858
|
-
|
|
2858
|
+
p += Z - 1;
|
|
2859
2859
|
continue;
|
|
2860
2860
|
}
|
|
2861
2861
|
}
|
|
2862
2862
|
}
|
|
2863
|
-
if (this.state.commenting === !1 &&
|
|
2863
|
+
if (this.state.commenting === !1 && d !== 0 && this.state.record_length + this.state.field.length > d)
|
|
2864
2864
|
return this.__error(
|
|
2865
|
-
new
|
|
2865
|
+
new y(
|
|
2866
2866
|
"CSV_MAX_RECORD_SIZE",
|
|
2867
2867
|
[
|
|
2868
2868
|
"Max Record Size:",
|
|
2869
2869
|
"record exceed the maximum number of tolerated bytes",
|
|
2870
|
-
`of ${
|
|
2870
|
+
`of ${d}`,
|
|
2871
2871
|
`at line ${this.info.lines}`
|
|
2872
2872
|
],
|
|
2873
2873
|
this.options,
|
|
2874
2874
|
this.__infoField()
|
|
2875
2875
|
)
|
|
2876
2876
|
);
|
|
2877
|
-
const J =
|
|
2877
|
+
const J = c === !1 || this.state.quoting === !0 || this.state.field.length !== 0 || !this.__isCharTrimable(b, p), he = _ === !1 || this.state.wasQuoting === !1;
|
|
2878
2878
|
if (J === !0 && he === !0)
|
|
2879
2879
|
this.state.field.append(O);
|
|
2880
2880
|
else {
|
|
2881
|
-
if (
|
|
2881
|
+
if (_ === !0 && !this.__isCharTrimable(b, p))
|
|
2882
2882
|
return this.__error(
|
|
2883
|
-
new
|
|
2883
|
+
new y(
|
|
2884
2884
|
"CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE",
|
|
2885
2885
|
[
|
|
2886
2886
|
"Invalid Closing Quote:",
|
|
@@ -2891,14 +2891,14 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2891
2891
|
this.__infoField()
|
|
2892
2892
|
)
|
|
2893
2893
|
);
|
|
2894
|
-
J === !1 && (
|
|
2894
|
+
J === !1 && (p += this.__isCharTrimable(b, p) - 1);
|
|
2895
2895
|
continue;
|
|
2896
2896
|
}
|
|
2897
2897
|
}
|
|
2898
2898
|
if (i === !0)
|
|
2899
2899
|
if (this.state.quoting === !0) {
|
|
2900
2900
|
const O = this.__error(
|
|
2901
|
-
new
|
|
2901
|
+
new y(
|
|
2902
2902
|
"CSV_QUOTE_NOT_CLOSED",
|
|
2903
2903
|
[
|
|
2904
2904
|
"Quote Not Closed:",
|
|
@@ -2910,14 +2910,14 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2910
2910
|
);
|
|
2911
2911
|
if (O !== void 0) return O;
|
|
2912
2912
|
} else if (this.state.wasQuoting === !0 || this.state.record.length !== 0 || this.state.field.length !== 0) {
|
|
2913
|
-
this.info.bytes = this.state.bufBytesStart +
|
|
2913
|
+
this.info.bytes = this.state.bufBytesStart + p;
|
|
2914
2914
|
const O = this.__onField();
|
|
2915
2915
|
if (O !== void 0) return O;
|
|
2916
2916
|
const J = this.__onRecord(o);
|
|
2917
2917
|
if (J !== void 0) return J;
|
|
2918
2918
|
} else this.state.wasRowDelimiter === !0 ? this.info.empty_lines++ : this.state.commenting === !0 && this.info.comment_lines++;
|
|
2919
2919
|
else
|
|
2920
|
-
this.state.bufBytesStart +=
|
|
2920
|
+
this.state.bufBytesStart += p, this.state.previousBuf = b.slice(p);
|
|
2921
2921
|
this.state.wasRowDelimiter === !0 && (this.info.lines++, this.state.wasRowDelimiter = !1);
|
|
2922
2922
|
},
|
|
2923
2923
|
__onRecord: function(n) {
|
|
@@ -2928,23 +2928,23 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2928
2928
|
info: f,
|
|
2929
2929
|
from: a,
|
|
2930
2930
|
relax_column_count: l,
|
|
2931
|
-
relax_column_count_less:
|
|
2932
|
-
relax_column_count_more:
|
|
2933
|
-
raw:
|
|
2934
|
-
skip_records_with_empty_values:
|
|
2935
|
-
} = this.options, { enabled: x, record:
|
|
2931
|
+
relax_column_count_less: h,
|
|
2932
|
+
relax_column_count_more: c,
|
|
2933
|
+
raw: d,
|
|
2934
|
+
skip_records_with_empty_values: g
|
|
2935
|
+
} = this.options, { enabled: x, record: _ } = this.state;
|
|
2936
2936
|
if (x === !1)
|
|
2937
2937
|
return this.__resetRecord();
|
|
2938
|
-
const S =
|
|
2938
|
+
const S = _.length;
|
|
2939
2939
|
if (i === !0) {
|
|
2940
|
-
if (
|
|
2940
|
+
if (g === !0 && lt(_)) {
|
|
2941
2941
|
this.__resetRecord();
|
|
2942
2942
|
return;
|
|
2943
2943
|
}
|
|
2944
|
-
return this.__firstLineToColumns(
|
|
2944
|
+
return this.__firstLineToColumns(_);
|
|
2945
2945
|
}
|
|
2946
2946
|
if (i === !1 && this.info.records === 0 && (this.state.expectedRecordLength = S), S !== this.state.expectedRecordLength) {
|
|
2947
|
-
const I = i === !1 ? new
|
|
2947
|
+
const I = i === !1 ? new y(
|
|
2948
2948
|
"CSV_RECORD_INCONSISTENT_FIELDS_LENGTH",
|
|
2949
2949
|
[
|
|
2950
2950
|
"Invalid Record Length:",
|
|
@@ -2954,9 +2954,9 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2954
2954
|
this.options,
|
|
2955
2955
|
this.__infoField(),
|
|
2956
2956
|
{
|
|
2957
|
-
record:
|
|
2957
|
+
record: _
|
|
2958
2958
|
}
|
|
2959
|
-
) : new
|
|
2959
|
+
) : new y(
|
|
2960
2960
|
"CSV_RECORD_INCONSISTENT_COLUMNS",
|
|
2961
2961
|
[
|
|
2962
2962
|
"Invalid Record Length:",
|
|
@@ -2967,17 +2967,17 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2967
2967
|
this.options,
|
|
2968
2968
|
this.__infoField(),
|
|
2969
2969
|
{
|
|
2970
|
-
record:
|
|
2970
|
+
record: _
|
|
2971
2971
|
}
|
|
2972
2972
|
);
|
|
2973
|
-
if (l === !0 ||
|
|
2973
|
+
if (l === !0 || h === !0 && S < this.state.expectedRecordLength || c === !0 && S > this.state.expectedRecordLength)
|
|
2974
2974
|
this.info.invalid_field_length++, this.state.error = I;
|
|
2975
2975
|
else {
|
|
2976
2976
|
const v = this.__error(I);
|
|
2977
2977
|
if (v) return v;
|
|
2978
2978
|
}
|
|
2979
2979
|
}
|
|
2980
|
-
if (
|
|
2980
|
+
if (g === !0 && lt(_)) {
|
|
2981
2981
|
this.__resetRecord();
|
|
2982
2982
|
return;
|
|
2983
2983
|
}
|
|
@@ -2989,41 +2989,41 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2989
2989
|
const { objname: I } = this.options;
|
|
2990
2990
|
if (i !== !1) {
|
|
2991
2991
|
const v = {};
|
|
2992
|
-
for (let
|
|
2993
|
-
i[
|
|
2994
|
-
if (
|
|
2995
|
-
const
|
|
2992
|
+
for (let w = 0, R = _.length; w < R; w++)
|
|
2993
|
+
i[w] === void 0 || i[w].disabled || (o === !0 && v[i[w].name] !== void 0 ? Array.isArray(v[i[w].name]) ? v[i[w].name] = v[i[w].name].concat(_[w]) : v[i[w].name] = [v[i[w].name], _[w]] : v[i[w].name] = _[w]);
|
|
2994
|
+
if (d === !0 || f === !0) {
|
|
2995
|
+
const w = Object.assign(
|
|
2996
2996
|
{ record: v },
|
|
2997
|
-
|
|
2997
|
+
d === !0 ? { raw: this.state.rawBuffer.toString(s) } : {},
|
|
2998
2998
|
f === !0 ? { info: this.__infoRecord() } : {}
|
|
2999
2999
|
), R = this.__push(
|
|
3000
|
-
I === void 0 ?
|
|
3000
|
+
I === void 0 ? w : [v[I], w],
|
|
3001
3001
|
n
|
|
3002
3002
|
);
|
|
3003
3003
|
if (R)
|
|
3004
3004
|
return R;
|
|
3005
3005
|
} else {
|
|
3006
|
-
const
|
|
3006
|
+
const w = this.__push(
|
|
3007
3007
|
I === void 0 ? v : [v[I], v],
|
|
3008
3008
|
n
|
|
3009
3009
|
);
|
|
3010
|
-
if (
|
|
3011
|
-
return
|
|
3010
|
+
if (w)
|
|
3011
|
+
return w;
|
|
3012
3012
|
}
|
|
3013
|
-
} else if (
|
|
3013
|
+
} else if (d === !0 || f === !0) {
|
|
3014
3014
|
const v = Object.assign(
|
|
3015
|
-
{ record:
|
|
3016
|
-
|
|
3015
|
+
{ record: _ },
|
|
3016
|
+
d === !0 ? { raw: this.state.rawBuffer.toString(s) } : {},
|
|
3017
3017
|
f === !0 ? { info: this.__infoRecord() } : {}
|
|
3018
|
-
),
|
|
3019
|
-
I === void 0 ? v : [
|
|
3018
|
+
), w = this.__push(
|
|
3019
|
+
I === void 0 ? v : [_[I], v],
|
|
3020
3020
|
n
|
|
3021
3021
|
);
|
|
3022
|
-
if (
|
|
3023
|
-
return
|
|
3022
|
+
if (w)
|
|
3023
|
+
return w;
|
|
3024
3024
|
} else {
|
|
3025
3025
|
const v = this.__push(
|
|
3026
|
-
I === void 0 ?
|
|
3026
|
+
I === void 0 ? _ : [_[I], _],
|
|
3027
3027
|
n
|
|
3028
3028
|
);
|
|
3029
3029
|
if (v)
|
|
@@ -3038,7 +3038,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
3038
3038
|
const o = i === void 0 ? n : i.call(null, n);
|
|
3039
3039
|
if (!Array.isArray(o))
|
|
3040
3040
|
return this.__error(
|
|
3041
|
-
new
|
|
3041
|
+
new y(
|
|
3042
3042
|
"CSV_INVALID_COLUMN_MAPPING",
|
|
3043
3043
|
[
|
|
3044
3044
|
"Invalid Column Mapping:",
|
|
@@ -3068,9 +3068,9 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
3068
3068
|
return this.__resetField();
|
|
3069
3069
|
let l = this.state.field.toString(i);
|
|
3070
3070
|
if (o === !0 && a === !1 && (l = l.trimRight()), n === !0) {
|
|
3071
|
-
const [
|
|
3072
|
-
if (
|
|
3073
|
-
l =
|
|
3071
|
+
const [h, c] = this.__cast(l);
|
|
3072
|
+
if (h !== void 0) return h;
|
|
3073
|
+
l = c;
|
|
3074
3074
|
}
|
|
3075
3075
|
this.state.record.push(l), s !== 0 && typeof l == "string" && (this.state.record_length += l.length), this.__resetField();
|
|
3076
3076
|
},
|
|
@@ -3116,10 +3116,10 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
3116
3116
|
return ((s, f) => {
|
|
3117
3117
|
const { timchars: a } = this.state;
|
|
3118
3118
|
e: for (let l = 0; l < a.length; l++) {
|
|
3119
|
-
const
|
|
3120
|
-
for (let
|
|
3121
|
-
if (c
|
|
3122
|
-
return
|
|
3119
|
+
const h = a[l];
|
|
3120
|
+
for (let c = 0; c < h.length; c++)
|
|
3121
|
+
if (h[c] !== s[f + c]) continue e;
|
|
3122
|
+
return h.length;
|
|
3123
3123
|
}
|
|
3124
3124
|
return 0;
|
|
3125
3125
|
})(n, i);
|
|
@@ -3149,8 +3149,8 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
3149
3149
|
e: for (let a = 0; a < s.length; a++) {
|
|
3150
3150
|
const l = s[a];
|
|
3151
3151
|
if (l[0] === o) {
|
|
3152
|
-
for (let
|
|
3153
|
-
if (l[
|
|
3152
|
+
for (let h = 1; h < l.length; h++)
|
|
3153
|
+
if (l[h] !== n[i + h]) continue e;
|
|
3154
3154
|
return l.length;
|
|
3155
3155
|
}
|
|
3156
3156
|
}
|
|
@@ -3159,10 +3159,10 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
3159
3159
|
__isRecordDelimiter: function(n, i, o) {
|
|
3160
3160
|
const { record_delimiter: s } = this.options, f = s.length;
|
|
3161
3161
|
e: for (let a = 0; a < f; a++) {
|
|
3162
|
-
const l = s[a],
|
|
3162
|
+
const l = s[a], h = l.length;
|
|
3163
3163
|
if (l[0] === n) {
|
|
3164
|
-
for (let
|
|
3165
|
-
if (l[
|
|
3164
|
+
for (let c = 1; c < h; c++)
|
|
3165
|
+
if (l[c] !== i[o + c])
|
|
3166
3166
|
continue e;
|
|
3167
3167
|
return l.length;
|
|
3168
3168
|
}
|
|
@@ -3303,7 +3303,7 @@ const je = function() {
|
|
|
3303
3303
|
else if (r === void 0 && s === "function")
|
|
3304
3304
|
r = o;
|
|
3305
3305
|
else
|
|
3306
|
-
throw new
|
|
3306
|
+
throw new y(
|
|
3307
3307
|
"CSV_INVALID_ARGUMENT",
|
|
3308
3308
|
["Invalid argument:", `got ${JSON.stringify(o)} at index ${i}`],
|
|
3309
3309
|
e || {}
|
|
@@ -3390,47 +3390,59 @@ class ri {
|
|
|
3390
3390
|
*/
|
|
3391
3391
|
async inferSchema(e, r, n) {
|
|
3392
3392
|
const i = Xn(r), { parsingRecords: o, valueDelimiterId: s } = await Kn(r, n), f = [], a = [];
|
|
3393
|
-
for (const
|
|
3394
|
-
const
|
|
3395
|
-
f.push(
|
|
3393
|
+
for (const c of o) {
|
|
3394
|
+
const d = e.inferValues(a, c, !0);
|
|
3395
|
+
f.push(d);
|
|
3396
|
+
}
|
|
3397
|
+
let l = 0;
|
|
3398
|
+
const h = f[0];
|
|
3399
|
+
if (h) {
|
|
3400
|
+
const c = h.length;
|
|
3401
|
+
for (let d = 0; d < c; d++) {
|
|
3402
|
+
const g = h[d]?.inferredValue, x = g == null ? `Column ${d}` : String(g), _ = a[d];
|
|
3403
|
+
_ != null && (_.label = { en: x });
|
|
3404
|
+
}
|
|
3405
|
+
l = 1;
|
|
3396
3406
|
}
|
|
3397
|
-
|
|
3407
|
+
for (let c = l; c < f.length; c++)
|
|
3408
|
+
;
|
|
3409
|
+
return { recordDelimiterId: i, valueDelimiterId: s, parsingRecords: o, inferenceRecords: f, columnConfigs: a };
|
|
3398
3410
|
}
|
|
3399
3411
|
/**
|
|
3400
3412
|
* Parse stream.
|
|
3401
3413
|
*/
|
|
3402
3414
|
async parseStream(e, r, n, i, o) {
|
|
3403
3415
|
return new Promise((s, f) => {
|
|
3404
|
-
let a, l,
|
|
3405
|
-
const
|
|
3406
|
-
if (
|
|
3407
|
-
|
|
3416
|
+
let a, l, h, c = !1, d = !1;
|
|
3417
|
+
const g = () => {
|
|
3418
|
+
if (d) return;
|
|
3419
|
+
d = !0;
|
|
3408
3420
|
const S = a;
|
|
3409
|
-
a = void 0,
|
|
3421
|
+
a = void 0, h = void 0, S != null && (Be(() => S.removeAllListeners()), Be(() => S.end())), Be(() => {
|
|
3410
3422
|
l?.cancel();
|
|
3411
3423
|
}), l = void 0;
|
|
3412
3424
|
};
|
|
3413
|
-
i.signal.addEventListener("abort",
|
|
3425
|
+
i.signal.addEventListener("abort", g, { once: !0 });
|
|
3414
3426
|
const x = (S) => {
|
|
3415
|
-
|
|
3427
|
+
c || (c = !0, g(), i.signal.aborted || i.abort(S), f(S));
|
|
3416
3428
|
};
|
|
3417
3429
|
(async () => {
|
|
3418
3430
|
a = je({
|
|
3419
3431
|
...r,
|
|
3420
3432
|
cast: (R, F) => ({ value: R, wasValueQuoted: F.quoting })
|
|
3421
|
-
}),
|
|
3433
|
+
}), h = ei({ chunk: o, chunkSize: e.chunkSize ?? Gn }), a.on("readable", () => {
|
|
3422
3434
|
try {
|
|
3423
|
-
if (a == null ||
|
|
3435
|
+
if (a == null || h == null) return;
|
|
3424
3436
|
let R;
|
|
3425
3437
|
for (; (R = a.read()) != null; ) {
|
|
3426
|
-
if (
|
|
3427
|
-
i.signal.throwIfAborted(),
|
|
3438
|
+
if (c) return;
|
|
3439
|
+
i.signal.throwIfAborted(), h.push(R);
|
|
3428
3440
|
}
|
|
3429
3441
|
} catch (R) {
|
|
3430
3442
|
x(R);
|
|
3431
3443
|
}
|
|
3432
3444
|
}), a.on("error", (R) => x(R)), a.on("end", () => {
|
|
3433
|
-
|
|
3445
|
+
c || (h?.flush(), s(ti(a)));
|
|
3434
3446
|
});
|
|
3435
3447
|
const S = await fetch(encodeURI(n), { signal: i.signal });
|
|
3436
3448
|
if (!S.ok || S.body == null)
|
|
@@ -3439,14 +3451,14 @@ class ri {
|
|
|
3439
3451
|
const I = new TextDecoder(e.encodingId);
|
|
3440
3452
|
let v = await l.read();
|
|
3441
3453
|
for (; !v.done; ) {
|
|
3442
|
-
if (
|
|
3454
|
+
if (c) return;
|
|
3443
3455
|
i.signal.throwIfAborted();
|
|
3444
3456
|
const R = I.decode(v.value, { stream: !0 });
|
|
3445
3457
|
R.length > 0 && a.write(R), v = await l.read();
|
|
3446
3458
|
}
|
|
3447
|
-
if (
|
|
3448
|
-
const
|
|
3449
|
-
|
|
3459
|
+
if (c) return;
|
|
3460
|
+
const w = I.decode();
|
|
3461
|
+
w.length > 0 && a.write(w), a.end();
|
|
3450
3462
|
})().catch((S) => x(S));
|
|
3451
3463
|
});
|
|
3452
3464
|
}
|
|
@@ -3462,28 +3474,28 @@ async function Kn(t, e) {
|
|
|
3462
3474
|
let r, n, i, o = [];
|
|
3463
3475
|
for (const s of e)
|
|
3464
3476
|
try {
|
|
3465
|
-
let f = 0, a, l = 0,
|
|
3466
|
-
const
|
|
3467
|
-
cast: (
|
|
3477
|
+
let f = 0, a, l = 0, h = 0;
|
|
3478
|
+
const c = je({
|
|
3479
|
+
cast: (d, g) => ({ value: d, wasValueQuoted: g.quoting }),
|
|
3468
3480
|
delimiter: s,
|
|
3469
3481
|
relax_column_count: !0
|
|
3470
3482
|
});
|
|
3471
|
-
await new Promise((
|
|
3483
|
+
await new Promise((d) => {
|
|
3472
3484
|
try {
|
|
3473
|
-
const
|
|
3474
|
-
|
|
3485
|
+
const g = [];
|
|
3486
|
+
c.on("readable", () => {
|
|
3475
3487
|
let x;
|
|
3476
|
-
for (; (x =
|
|
3488
|
+
for (; (x = c.read()) != null; ) {
|
|
3477
3489
|
l++;
|
|
3478
|
-
const
|
|
3479
|
-
a != null && (
|
|
3490
|
+
const _ = x.length;
|
|
3491
|
+
a != null && (h += Math.abs(_ - a)), a = _, f += _, g.push(x);
|
|
3480
3492
|
}
|
|
3481
|
-
}),
|
|
3493
|
+
}), c.on("error", () => d()), c.on("end", () => {
|
|
3482
3494
|
const x = f / l;
|
|
3483
|
-
(!i ||
|
|
3484
|
-
}),
|
|
3495
|
+
(!i || h <= i) && (!n || x > n) && (r = s, n = x, i = h, o = [...g]), d();
|
|
3496
|
+
}), c.write(t), c.end();
|
|
3485
3497
|
} catch {
|
|
3486
|
-
|
|
3498
|
+
d();
|
|
3487
3499
|
}
|
|
3488
3500
|
});
|
|
3489
3501
|
} catch {
|