@datapos/datapos-tool-csv-parse 0.0.71 → 0.0.72

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.
@@ -31,10 +31,10 @@ 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, c = -7, h = r ? i - 1 : 0, p = r ? -1 : 1, g = t[e + h];
35
- for (h += p, o = g & (1 << -c) - 1, g >>= -c, c += f; c > 0; o = o * 256 + t[e + h], h += p, c -= 8)
34
+ var o, s, f = i * 8 - n - 1, a = (1 << f) - 1, l = a >> 1, h = -7, c = r ? i - 1 : 0, p = r ? -1 : 1, g = t[e + c];
35
+ for (c += p, o = g & (1 << -h) - 1, g >>= -h, h += f; h > 0; o = o * 256 + t[e + c], c += p, h -= 8)
36
36
  ;
37
- for (s = o & (1 << -c) - 1, o >>= -c, c += n; c > 0; s = s * 256 + t[e + h], h += p, c -= 8)
37
+ for (s = o & (1 << -h) - 1, o >>= -h, h += n; h > 0; s = s * 256 + t[e + c], c += p, h -= 8)
38
38
  ;
39
39
  if (o === 0)
40
40
  o = 1 - l;
@@ -46,12 +46,12 @@ function ve(t, e, r, n, i) {
46
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, c = (1 << l) - 1, h = c >> 1, p = i === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, g = n ? 0 : o - 1, O = n ? 1 : -1, E = 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 = c) : (s = Math.floor(Math.log(e) / Math.LN2), e * (a = Math.pow(2, -s)) < 1 && (s--, a *= 2), s + h >= 1 ? e += p / a : e += p * Math.pow(2, 1 - h), e * a >= 2 && (s++, a /= 2), s + h >= c ? (f = 0, s = c) : s + h >= 1 ? (f = (e * a - 1) * Math.pow(2, i), s = s + h) : (f = e * Math.pow(2, h - 1) * Math.pow(2, i), s = 0)); i >= 8; t[r + g] = f & 255, g += O, f /= 256, i -= 8)
49
+ var s, f, a, l = o * 8 - i - 1, h = (1 << l) - 1, c = h >> 1, p = i === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, g = n ? 0 : o - 1, x = n ? 1 : -1, y = 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 += p / a : e += p * 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 + g] = s & 255, g += O, s /= 256, l -= 8)
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 + g - O] |= E * 128;
54
+ t[r + g - x] |= y * 128;
55
55
  }
56
56
  var er = {}.toString, dt = Array.isArray || function(t) {
57
57
  return er.call(t) == "[object Array]";
@@ -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), c = e.slice(r, n), h = 0; h < a; ++h)
324
- if (l[h] !== c[h]) {
325
- s = l[h], f = c[h];
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(g, O) {
352
- return o === 1 ? g[O] : g.readUInt16BE(O * o);
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 c = -1;
356
+ var h = -1;
357
357
  for (l = r; l < s; l++)
358
- if (a(t, l) === a(e, c === -1 ? 0 : l - c)) {
359
- if (c === -1 && (c = l), l - c + 1 === f) return c * o;
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
- c !== -1 && (l -= l - c), c = -1;
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 h = !0, p = 0; p < f; p++)
364
+ for (var c = !0, p = 0; p < f; p++)
365
365
  if (a(t, l + p) !== a(e, p)) {
366
- h = !1;
366
+ c = !1;
367
367
  break;
368
368
  }
369
- if (h) return l;
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, c, h;
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 && (h = (o & 31) << 6 | a & 63, h > 127 && (s = h));
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 && (h = (o & 15) << 12 | (a & 63) << 6 | l & 63, h > 2047 && (h < 55296 || h > 57343) && (s = h));
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], c = t[i + 3], (a & 192) === 128 && (l & 192) === 128 && (c & 192) === 128 && (h = (o & 15) << 18 | (a & 63) << 12 | (l & 63) << 6 | c & 63, h > 65535 && h < 1114112 && (s = h));
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;
@@ -929,33 +929,33 @@ m.prototype.emit = function(e) {
929
929
  else {
930
930
  if (r instanceof Error)
931
931
  throw r;
932
- var c = new Error('Uncaught, unspecified "error" event. (' + r + ")");
933
- throw c.context = r, c;
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 h = typeof n == "function";
939
+ var c = typeof n == "function";
940
940
  switch (i = arguments.length, i) {
941
941
  // fast cases
942
942
  case 1:
943
- Ir(n, h, this);
943
+ Ir(n, c, this);
944
944
  break;
945
945
  case 2:
946
- Cr(n, h, this, arguments[1]);
946
+ Cr(n, c, this, arguments[1]);
947
947
  break;
948
948
  case 3:
949
- Or(n, h, this, arguments[1], arguments[2]);
949
+ Or(n, c, this, arguments[1], arguments[2]);
950
950
  break;
951
951
  case 4:
952
- Ar(n, h, this, arguments[1], arguments[2], arguments[3]);
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
- Lr(n, h, this, o);
958
+ Lr(n, c, this, o);
959
959
  }
960
960
  return !0;
961
961
  };
@@ -1306,20 +1306,20 @@ function ye(t, e, r) {
1306
1306
  if (Te(e))
1307
1307
  return Ae(e);
1308
1308
  }
1309
- var a = "", l = !1, c = ["{", "}"];
1310
- if (Yr(e) && (l = !0, c = ["[", "]"]), De(e)) {
1311
- var h = e.name ? ": " + e.name : "";
1312
- a = " [Function" + h + "]";
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
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 c[0] + a + c[1];
1315
+ return h[0] + a + h[1];
1316
1316
  if (r < 0)
1317
1317
  return Le(e) ? t.stylize(RegExp.prototype.toString.call(e), "regexp") : t.stylize("[Object]", "special");
1318
1318
  t.seen.push(e);
1319
1319
  var p;
1320
1320
  return l ? p = Vr(t, e, r, s, o) : p = o.map(function(g) {
1321
1321
  return Pe(t, e, r, s, g, l);
1322
- }), t.seen.pop(), Jr(p, a, c);
1322
+ }), t.seen.pop(), Jr(p, a, h);
1323
1323
  }
1324
1324
  function zr(t, e) {
1325
1325
  if (Q(e))
@@ -1565,9 +1565,9 @@ function Xr(t) {
1565
1565
  function Kr(t) {
1566
1566
  this.charReceived = t.length % 3, this.charLength = this.charReceived ? 3 : 0;
1567
1567
  }
1568
- I.ReadableState = Ut;
1569
- var b = Pr("stream");
1570
- oe(I, m);
1568
+ C.ReadableState = Ut;
1569
+ var E = Pr("stream");
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);
@@ -1581,19 +1581,19 @@ function Ut(t, e) {
1581
1581
  var r = t.highWaterMark, n = this.objectMode ? 16 : 16 * 1024;
1582
1582
  this.highWaterMark = r || r === 0 ? r : n, this.highWaterMark = ~~this.highWaterMark, this.buffer = new te(), 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 = t.defaultEncoding || "utf8", this.ranOut = !1, this.awaitDrain = 0, this.readingMore = !1, this.decoder = null, this.encoding = null, t.encoding && (this.decoder = new le(t.encoding), this.encoding = t.encoding);
1583
1583
  }
1584
- function I(t) {
1585
- if (!(this instanceof I)) return new I(t);
1584
+ function C(t) {
1585
+ if (!(this instanceof C)) return new C(t);
1586
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
- I.prototype.push = function(t, e) {
1588
+ C.prototype.push = function(t, e) {
1589
1589
  var r = this._readableState;
1590
1590
  return !r.objectMode && typeof t == "string" && (e = e || r.defaultEncoding, e !== r.encoding && (t = u.from(t, e), e = "")), kt(this, r, t, e, !1);
1591
1591
  };
1592
- I.prototype.unshift = function(t) {
1592
+ C.prototype.unshift = function(t) {
1593
1593
  var e = this._readableState;
1594
1594
  return kt(this, e, t, "", !0);
1595
1595
  };
1596
- I.prototype.isPaused = function() {
1596
+ C.prototype.isPaused = function() {
1597
1597
  return this._readableState.flowing === !1;
1598
1598
  };
1599
1599
  function kt(t, e, r, n, i) {
@@ -1619,7 +1619,7 @@ function kt(t, e, r, n, i) {
1619
1619
  function rn(t) {
1620
1620
  return !t.ended && (t.needReadable || t.length < t.highWaterMark || t.length === 0);
1621
1621
  }
1622
- I.prototype.setEncoding = function(t) {
1622
+ C.prototype.setEncoding = function(t) {
1623
1623
  return this._readableState.decoder = new le(t), this._readableState.encoding = t, this;
1624
1624
  };
1625
1625
  var tt = 8388608;
@@ -1629,15 +1629,15 @@ function nn(t) {
1629
1629
  function rt(t, e) {
1630
1630
  return t <= 0 || e.length === 0 && e.ended ? 0 : e.objectMode ? 1 : t !== t ? e.flowing && e.length ? e.buffer.head.data.length : e.length : (t > e.highWaterMark && (e.highWaterMark = nn(t)), t <= e.length ? t : e.ended ? e.length : (e.needReadable = !0, 0));
1631
1631
  }
1632
- I.prototype.read = function(t) {
1633
- b("read", t), t = parseInt(t, 10);
1632
+ C.prototype.read = function(t) {
1633
+ E("read", t), t = parseInt(t, 10);
1634
1634
  var e = this._readableState, r = t;
1635
1635
  if (t !== 0 && (e.emittedReadable = !1), t === 0 && e.needReadable && (e.length >= e.highWaterMark || e.ended))
1636
- return b("read: emitReadable", e.length, e.ended), e.length === 0 && e.ended ? Ne(this) : Se(this), null;
1636
+ return E("read: emitReadable", e.length, e.ended), e.length === 0 && e.ended ? Ne(this) : Se(this), null;
1637
1637
  if (t = rt(t, e), t === 0 && e.ended)
1638
1638
  return e.length === 0 && Ne(this), null;
1639
1639
  var n = e.needReadable;
1640
- b("need readable", n), (e.length === 0 || e.length - t < e.highWaterMark) && (n = !0, b("length less than watermark", n)), e.ended || e.reading ? (n = !1, b("reading or ended", n)) : n && (b("do read"), e.reading = !0, e.sync = !0, e.length === 0 && (e.needReadable = !0), this._read(e.highWaterMark), e.sync = !1, e.reading || (t = rt(r, e)));
1640
+ E("need readable", n), (e.length === 0 || e.length - t < e.highWaterMark) && (n = !0, E("length less than watermark", n)), e.ended || e.reading ? (n = !1, E("reading or ended", n)) : n && (E("do read"), e.reading = !0, e.sync = !0, e.length === 0 && (e.needReadable = !0), this._read(e.highWaterMark), e.sync = !1, e.reading || (t = rt(r, e)));
1641
1641
  var i;
1642
1642
  return t > 0 ? i = Pt(t, e) : i = null, i === null ? (e.needReadable = !0, t = 0) : e.length -= t, e.length === 0 && (e.ended || (e.needReadable = !0), r !== t && e.ended && Ne(this)), i !== null && this.emit("data", i), i;
1643
1643
  };
@@ -1656,23 +1656,23 @@ function sn(t, e) {
1656
1656
  }
1657
1657
  function Se(t) {
1658
1658
  var e = t._readableState;
1659
- e.needReadable = !1, e.emittedReadable || (b("emitReadable", e.flowing), e.emittedReadable = !0, e.sync ? B(nt, t) : nt(t));
1659
+ e.needReadable = !1, e.emittedReadable || (E("emitReadable", e.flowing), e.emittedReadable = !0, e.sync ? B(nt, t) : nt(t));
1660
1660
  }
1661
1661
  function nt(t) {
1662
- b("emit readable"), t.emit("readable"), Qe(t);
1662
+ E("emit readable"), t.emit("readable"), Qe(t);
1663
1663
  }
1664
1664
  function fn(t, e) {
1665
1665
  e.readingMore || (e.readingMore = !0, B(an, t, e));
1666
1666
  }
1667
1667
  function an(t, e) {
1668
- for (var r = e.length; !e.reading && !e.flowing && !e.ended && e.length < e.highWaterMark && (b("maybeReadMore read 0"), t.read(0), r !== e.length); )
1668
+ for (var r = e.length; !e.reading && !e.flowing && !e.ended && e.length < e.highWaterMark && (E("maybeReadMore read 0"), t.read(0), r !== e.length); )
1669
1669
  r = e.length;
1670
1670
  e.readingMore = !1;
1671
1671
  }
1672
- I.prototype._read = function(t) {
1672
+ C.prototype._read = function(t) {
1673
1673
  this.emit("error", new Error("not implemented"));
1674
1674
  };
1675
- I.prototype.pipe = function(t, e) {
1675
+ C.prototype.pipe = function(t, e) {
1676
1676
  var r = this, n = this._readableState;
1677
1677
  switch (n.pipesCount) {
1678
1678
  case 0:
@@ -1685,52 +1685,52 @@ I.prototype.pipe = function(t, e) {
1685
1685
  n.pipes.push(t);
1686
1686
  break;
1687
1687
  }
1688
- n.pipesCount += 1, b("pipe count=%d opts=%j", n.pipesCount, e);
1689
- var i = !e || e.end !== !1, o = i ? f : c;
1688
+ n.pipesCount += 1, E("pipe count=%d opts=%j", n.pipesCount, e);
1689
+ var i = !e || e.end !== !1, o = i ? f : h;
1690
1690
  n.endEmitted ? B(o) : r.once("end", o), t.on("unpipe", s);
1691
- function s(S) {
1692
- b("onunpipe"), S === r && c();
1691
+ function s(R) {
1692
+ E("onunpipe"), R === r && h();
1693
1693
  }
1694
1694
  function f() {
1695
- b("onend"), t.end();
1695
+ E("onend"), t.end();
1696
1696
  }
1697
1697
  var a = un(r);
1698
1698
  t.on("drain", a);
1699
1699
  var l = !1;
1700
- function c() {
1701
- b("cleanup"), t.removeListener("close", O), t.removeListener("finish", E), t.removeListener("drain", a), t.removeListener("error", g), t.removeListener("unpipe", s), r.removeListener("end", f), r.removeListener("end", c), r.removeListener("data", p), l = !0, n.awaitDrain && (!t._writableState || t._writableState.needDrain) && a();
1700
+ function h() {
1701
+ E("cleanup"), t.removeListener("close", x), t.removeListener("finish", y), t.removeListener("drain", a), t.removeListener("error", g), t.removeListener("unpipe", s), r.removeListener("end", f), r.removeListener("end", h), r.removeListener("data", p), l = !0, n.awaitDrain && (!t._writableState || t._writableState.needDrain) && a();
1702
1702
  }
1703
- var h = !1;
1703
+ var c = !1;
1704
1704
  r.on("data", p);
1705
- function p(S) {
1706
- b("ondata"), h = !1;
1707
- var y = t.write(S);
1708
- y === !1 && !h && ((n.pipesCount === 1 && n.pipes === t || n.pipesCount > 1 && $t(n.pipes, t) !== -1) && !l && (b("false write response, pause", r._readableState.awaitDrain), r._readableState.awaitDrain++, h = !0), r.pause());
1705
+ function p(R) {
1706
+ E("ondata"), c = !1;
1707
+ var v = t.write(R);
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 g(S) {
1711
- b("onerror", S), x(), t.removeListener("error", g), tn(t, "error") === 0 && t.emit("error", S);
1710
+ function g(R) {
1711
+ E("onerror", R), S(), t.removeListener("error", g), tn(t, "error") === 0 && t.emit("error", R);
1712
1712
  }
1713
1713
  en(t, "error", g);
1714
- function O() {
1715
- t.removeListener("finish", E), x();
1714
+ function x() {
1715
+ t.removeListener("finish", y), S();
1716
1716
  }
1717
- t.once("close", O);
1718
- function E() {
1719
- b("onfinish"), t.removeListener("close", O), x();
1717
+ t.once("close", x);
1718
+ function y() {
1719
+ E("onfinish"), t.removeListener("close", x), S();
1720
1720
  }
1721
- t.once("finish", E);
1722
- function x() {
1723
- b("unpipe"), r.unpipe(t);
1721
+ t.once("finish", y);
1722
+ function S() {
1723
+ E("unpipe"), r.unpipe(t);
1724
1724
  }
1725
- return t.emit("pipe", r), n.flowing || (b("pipe resume"), r.resume()), t;
1725
+ return t.emit("pipe", r), n.flowing || (E("pipe resume"), r.resume()), t;
1726
1726
  };
1727
1727
  function un(t) {
1728
1728
  return function() {
1729
1729
  var e = t._readableState;
1730
- b("pipeOnDrain", e.awaitDrain), e.awaitDrain && e.awaitDrain--, e.awaitDrain === 0 && t.listeners("data").length && (e.flowing = !0, Qe(t));
1730
+ E("pipeOnDrain", e.awaitDrain), e.awaitDrain && e.awaitDrain--, e.awaitDrain === 0 && t.listeners("data").length && (e.flowing = !0, Qe(t));
1731
1731
  };
1732
1732
  }
1733
- I.prototype.unpipe = function(t) {
1733
+ C.prototype.unpipe = function(t) {
1734
1734
  var e = this._readableState;
1735
1735
  if (e.pipesCount === 0) return this;
1736
1736
  if (e.pipesCount === 1)
@@ -1745,7 +1745,7 @@ I.prototype.unpipe = function(t) {
1745
1745
  var o = $t(e.pipes, 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
- I.prototype.on = function(t, e) {
1748
+ C.prototype.on = function(t, e) {
1749
1749
  var r = m.prototype.on.call(this, t, e);
1750
1750
  if (t === "data")
1751
1751
  this._readableState.flowing !== !1 && this.resume();
@@ -1755,38 +1755,38 @@ I.prototype.on = function(t, e) {
1755
1755
  }
1756
1756
  return r;
1757
1757
  };
1758
- I.prototype.addListener = I.prototype.on;
1758
+ C.prototype.addListener = C.prototype.on;
1759
1759
  function ln(t) {
1760
- b("readable nexttick read 0"), t.read(0);
1760
+ E("readable nexttick read 0"), t.read(0);
1761
1761
  }
1762
- I.prototype.resume = function() {
1762
+ C.prototype.resume = function() {
1763
1763
  var t = this._readableState;
1764
- return t.flowing || (b("resume"), t.flowing = !0, cn(this, t)), this;
1764
+ return t.flowing || (E("resume"), t.flowing = !0, cn(this, t)), this;
1765
1765
  };
1766
1766
  function cn(t, e) {
1767
1767
  e.resumeScheduled || (e.resumeScheduled = !0, B(hn, t, e));
1768
1768
  }
1769
1769
  function hn(t, e) {
1770
- e.reading || (b("resume read 0"), t.read(0)), e.resumeScheduled = !1, e.awaitDrain = 0, t.emit("resume"), Qe(t), e.flowing && !e.reading && t.read(0);
1770
+ e.reading || (E("resume read 0"), t.read(0)), e.resumeScheduled = !1, e.awaitDrain = 0, t.emit("resume"), Qe(t), e.flowing && !e.reading && t.read(0);
1771
1771
  }
1772
- I.prototype.pause = function() {
1773
- return b("call pause flowing=%j", this._readableState.flowing), this._readableState.flowing !== !1 && (b("pause"), this._readableState.flowing = !1, this.emit("pause")), this;
1772
+ C.prototype.pause = function() {
1773
+ return E("call pause flowing=%j", this._readableState.flowing), this._readableState.flowing !== !1 && (E("pause"), this._readableState.flowing = !1, this.emit("pause")), this;
1774
1774
  };
1775
1775
  function Qe(t) {
1776
1776
  var e = t._readableState;
1777
- for (b("flow", e.flowing); e.flowing && t.read() !== null; )
1777
+ for (E("flow", e.flowing); e.flowing && t.read() !== null; )
1778
1778
  ;
1779
1779
  }
1780
- I.prototype.wrap = function(t) {
1780
+ C.prototype.wrap = function(t) {
1781
1781
  var e = this._readableState, r = !1, n = this;
1782
1782
  t.on("end", function() {
1783
- if (b("wrapped end"), e.decoder && !e.ended) {
1783
+ if (E("wrapped end"), e.decoder && !e.ended) {
1784
1784
  var s = e.decoder.end();
1785
1785
  s && s.length && n.push(s);
1786
1786
  }
1787
1787
  n.push(null);
1788
1788
  }), t.on("data", function(s) {
1789
- if (b("wrapped data"), e.decoder && (s = e.decoder.write(s)), !(e.objectMode && s == null) && !(!e.objectMode && (!s || !s.length))) {
1789
+ if (E("wrapped data"), e.decoder && (s = e.decoder.write(s)), !(e.objectMode && s == null) && !(!e.objectMode && (!s || !s.length))) {
1790
1790
  var f = n.push(s);
1791
1791
  f || (r = !0, t.pause());
1792
1792
  }
@@ -1801,10 +1801,10 @@ I.prototype.wrap = function(t) {
1801
1801
  return _n(o, function(s) {
1802
1802
  t.on(s, n.emit.bind(n, s));
1803
1803
  }), n._read = function(s) {
1804
- b("wrapped _read", s), r && (r = !1, t.resume());
1804
+ E("wrapped _read", s), r && (r = !1, t.resume());
1805
1805
  }, n;
1806
1806
  };
1807
- I._fromList = Pt;
1807
+ C._fromList = Pt;
1808
1808
  function Pt(t, e) {
1809
1809
  if (e.length === 0) return null;
1810
1810
  var r;
@@ -1960,8 +1960,8 @@ 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 Vt(e);
1961
1961
  } else {
1962
1962
  for (; r; ) {
1963
- var f = r.chunk, a = r.encoding, l = r.callback, c = e.objectMode ? 1 : f.length;
1964
- if ($e(t, e, !1, c, f, a, l), r = r.next, e.writing)
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);
@@ -2000,7 +2000,7 @@ function Vt(t) {
2000
2000
  t.corkedRequestsFree ? t.corkedRequestsFree.next = e : t.corkedRequestsFree = e;
2001
2001
  };
2002
2002
  }
2003
- oe(M, I);
2003
+ oe(M, C);
2004
2004
  var st = Object.keys(T.prototype);
2005
2005
  for (var Fe = 0; Fe < st.length; Fe++) {
2006
2006
  var Me = st[Fe];
@@ -2008,7 +2008,7 @@ for (var Fe = 0; Fe < st.length; Fe++) {
2008
2008
  }
2009
2009
  function M(t) {
2010
2010
  if (!(this instanceof M)) return new M(t);
2011
- I.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);
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
2014
  this.allowHalfOpen || this._writableState.ended || B(Ln, this);
@@ -2074,7 +2074,7 @@ fe.prototype._transform = function(t, e, r) {
2074
2074
  r(null, t);
2075
2075
  };
2076
2076
  oe(V, m);
2077
- V.Readable = I;
2077
+ V.Readable = C;
2078
2078
  V.Writable = T;
2079
2079
  V.Duplex = M;
2080
2080
  V.Transform = k;
@@ -2085,8 +2085,8 @@ function V() {
2085
2085
  }
2086
2086
  V.prototype.pipe = function(t, e) {
2087
2087
  var r = this;
2088
- function n(c) {
2089
- t.writable && t.write(c) === !1 && r.pause && r.pause();
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 @@ V.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(c) {
2103
+ function a(h) {
2104
2104
  if (l(), m.listenerCount(this, "error") === 0)
2105
- throw c;
2105
+ throw h;
2106
2106
  }
2107
2107
  r.on("error", a), t.on("error", a);
2108
2108
  function l() {
@@ -2665,20 +2665,20 @@ 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: c, recordDelimiterMaxLength: h } = this.state, p = i - n - 1, g = Math.max(
2669
- c,
2668
+ const { encoding: s, escape: f, quote: a } = this.options, { quoting: l, needMoreDataSize: h, recordDelimiterMaxLength: c } = this.state, p = 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
- h === 0 ? u.from(`\r
2677
- `, s).length : h,
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 + h : 0
2681
+ l ? a.length + c : 0
2682
2682
  );
2683
2683
  return p < g;
2684
2684
  },
@@ -2688,88 +2688,88 @@ 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: c,
2692
- ltrim: h,
2691
+ from_line: h,
2692
+ ltrim: c,
2693
2693
  max_record_size: p,
2694
2694
  raw: g,
2695
- relax_quotes: O,
2696
- rtrim: E,
2697
- skip_empty_lines: x,
2698
- to: S,
2699
- to_line: y
2695
+ relax_quotes: x,
2696
+ rtrim: y,
2697
+ skip_empty_lines: S,
2698
+ to: R,
2699
+ to_line: v
2700
2700
  } = this.options;
2701
- let { comment: _, escape: R, quote: U, record_delimiter: Re } = this.options;
2701
+ let { comment: _, escape: I, quote: U, record_delimiter: Re } = this.options;
2702
2702
  const { bomSkipped: Wt, previousBuf: ce, rawBuffer: Qt, escapeIsQuote: Ht } = this.state;
2703
- let v;
2703
+ let b;
2704
2704
  if (ce === void 0)
2705
2705
  if (n === void 0) {
2706
2706
  s();
2707
2707
  return;
2708
2708
  } else
2709
- v = n;
2710
- else ce !== void 0 && n === void 0 ? v = ce : v = u.concat([ce, n]);
2709
+ b = n;
2710
+ else ce !== void 0 && n === void 0 ? b = ce : b = u.concat([ce, n]);
2711
2711
  if (Wt === !1)
2712
2712
  if (f === !1)
2713
2713
  this.state.bomSkipped = !0;
2714
- else if (v.length < 3) {
2714
+ else if (b.length < 3) {
2715
2715
  if (i === !1) {
2716
- this.state.previousBuf = v;
2716
+ this.state.previousBuf = b;
2717
2717
  return;
2718
2718
  }
2719
2719
  } else {
2720
- for (const C in re)
2721
- if (re[C].compare(v, 0, re[C].length) === 0) {
2722
- const J = re[C].length;
2723
- this.state.bufBytesStart += J, v = v.slice(J);
2720
+ for (const O in re)
2721
+ if (re[O].compare(b, 0, re[O].length) === 0) {
2722
+ const J = re[O].length;
2723
+ this.state.bufBytesStart += J, b = b.slice(J);
2724
2724
  const he = ut({
2725
2725
  ...this.original_options,
2726
- encoding: C
2726
+ encoding: O
2727
2727
  });
2728
2728
  for (const A in he)
2729
2729
  this.options[A] = he[A];
2730
- ({ comment: _, escape: R, quote: U } = this.options);
2730
+ ({ comment: _, escape: I, quote: U } = this.options);
2731
2731
  break;
2732
2732
  }
2733
2733
  this.state.bomSkipped = !0;
2734
2734
  }
2735
- const Ie = v.length;
2735
+ const Ie = b.length;
2736
2736
  let d;
2737
2737
  for (d = 0; d < Ie && !this.__needMoreData(d, Ie, i); d++) {
2738
- if (this.state.wasRowDelimiter === !0 && (this.info.lines++, this.state.wasRowDelimiter = !1), y !== -1 && this.info.lines > y) {
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
- v,
2743
+ b,
2744
2744
  d
2745
2745
  ) && (Re = this.options.record_delimiter);
2746
- const C = v[d];
2747
- if (g === !0 && Qt.append(C), (C === $n || C === jn) && this.state.wasRowDelimiter === !1 && (this.state.wasRowDelimiter = !0), this.state.escaping === !0)
2746
+ const O = b[d];
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(v, d, C) && d + R.length < Ie)
2750
+ if (I !== null && this.state.quoting === !0 && this.__isEscape(b, d, O) && d + I.length < Ie)
2751
2751
  if (Ht) {
2752
- if (this.__isQuote(v, d + R.length)) {
2753
- this.state.escaping = !0, d += R.length - 1;
2752
+ if (this.__isQuote(b, d + I.length)) {
2753
+ this.state.escaping = !0, d += I.length - 1;
2754
2754
  continue;
2755
2755
  }
2756
2756
  } else {
2757
- this.state.escaping = !0, d += R.length - 1;
2757
+ this.state.escaping = !0, d += I.length - 1;
2758
2758
  continue;
2759
2759
  }
2760
- if (this.state.commenting === !1 && this.__isQuote(v, d))
2760
+ if (this.state.commenting === !1 && this.__isQuote(b, d))
2761
2761
  if (this.state.quoting === !0) {
2762
- const A = v[d + U.length], Z = E && this.__isCharTrimable(v, d + U.length), j = _ !== null && this.__compareBytes(_, v, d + U.length, A), X = this.__isDelimiter(
2763
- v,
2762
+ const A = b[d + U.length], Z = y && this.__isCharTrimable(b, d + U.length), j = _ !== null && this.__compareBytes(_, b, d + U.length, A), X = this.__isDelimiter(
2763
+ b,
2764
2764
  d + U.length,
2765
2765
  A
2766
- ), de = Re.length === 0 ? this.__autoDiscoverRecordDelimiter(v, d + U.length) : this.__isRecordDelimiter(A, v, d + U.length);
2767
- if (R !== null && this.__isEscape(v, d, C) && this.__isQuote(v, d + R.length))
2768
- d += R.length - 1;
2766
+ ), de = Re.length === 0 ? this.__autoDiscoverRecordDelimiter(b, d + U.length) : this.__isRecordDelimiter(A, b, d + U.length);
2767
+ if (I !== null && this.__isEscape(b, d, O) && this.__isQuote(b, d + I.length))
2768
+ d += I.length - 1;
2769
2769
  else if (!A || X || de || j || Z) {
2770
2770
  this.state.quoting = !1, this.state.wasQuoting = !0, d += U.length - 1;
2771
2771
  continue;
2772
- } else if (O === !1) {
2772
+ } else if (x === !1) {
2773
2773
  const Ge = this.__error(
2774
2774
  new w(
2775
2775
  "CSV_INVALID_CLOSING_QUOTE",
@@ -2788,7 +2788,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
2788
2788
  } else
2789
2789
  this.state.quoting = !1, this.state.wasQuoting = !0, this.state.field.prepend(U), d += U.length - 1;
2790
2790
  } else if (this.state.field.length !== 0) {
2791
- if (O === !1) {
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(
@@ -2814,19 +2814,19 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
2814
2814
  }
2815
2815
  if (this.state.quoting === !1) {
2816
2816
  const A = this.__isRecordDelimiter(
2817
- C,
2818
- v,
2817
+ O,
2818
+ b,
2819
2819
  d
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) >= c) {
2825
+ if (this.state.enabled === !1 && this.info.lines + (this.state.wasRowDelimiter === !0 ? 1 : 0) >= h) {
2826
2826
  this.state.enabled = !0, this.__resetField(), this.__resetRecord(), d += A - 1;
2827
2827
  continue;
2828
2828
  }
2829
- if (x === !0 && this.state.wasQuoting === !1 && this.state.record.length === 0 && this.state.field.length === 0) {
2829
+ if (S === !0 && this.state.wasQuoting === !1 && this.state.record.length === 0 && this.state.field.length === 0) {
2830
2830
  this.info.empty_lines++, d += A - 1;
2831
2831
  continue;
2832
2832
  }
@@ -2836,7 +2836,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
2836
2836
  this.info.bytes = this.state.bufBytesStart + d + A;
2837
2837
  const de = this.__onRecord(o);
2838
2838
  if (de !== void 0) return de;
2839
- if (S !== -1 && this.info.records >= S) {
2839
+ if (R !== -1 && this.info.records >= R) {
2840
2840
  this.state.stop = !0, s();
2841
2841
  return;
2842
2842
  }
@@ -2846,11 +2846,11 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
2846
2846
  }
2847
2847
  if (this.state.commenting)
2848
2848
  continue;
2849
- if (_ !== null && (a === !1 || this.state.record.length === 0 && this.state.field.length === 0) && this.__compareBytes(_, v, d, C) !== 0) {
2849
+ if (_ !== null && (a === !1 || this.state.record.length === 0 && this.state.field.length === 0) && this.__compareBytes(_, b, d, O) !== 0) {
2850
2850
  this.state.commenting = !0;
2851
2851
  continue;
2852
2852
  }
2853
- const Z = this.__isDelimiter(v, d, C);
2853
+ const Z = this.__isDelimiter(b, d, O);
2854
2854
  if (Z !== 0) {
2855
2855
  this.info.bytes = this.state.bufBytesStart + d;
2856
2856
  const j = this.__onField();
@@ -2874,11 +2874,11 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
2874
2874
  this.__infoField()
2875
2875
  )
2876
2876
  );
2877
- const J = h === !1 || this.state.quoting === !0 || this.state.field.length !== 0 || !this.__isCharTrimable(v, d), he = E === !1 || this.state.wasQuoting === !1;
2877
+ const J = c === !1 || this.state.quoting === !0 || this.state.field.length !== 0 || !this.__isCharTrimable(b, d), he = y === !1 || this.state.wasQuoting === !1;
2878
2878
  if (J === !0 && he === !0)
2879
- this.state.field.append(C);
2879
+ this.state.field.append(O);
2880
2880
  else {
2881
- if (E === !0 && !this.__isCharTrimable(v, d))
2881
+ if (y === !0 && !this.__isCharTrimable(b, d))
2882
2882
  return this.__error(
2883
2883
  new w(
2884
2884
  "CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE",
@@ -2891,13 +2891,13 @@ 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 && (d += this.__isCharTrimable(v, d) - 1);
2894
+ J === !1 && (d += this.__isCharTrimable(b, d) - 1);
2895
2895
  continue;
2896
2896
  }
2897
2897
  }
2898
2898
  if (i === !0)
2899
2899
  if (this.state.quoting === !0) {
2900
- const C = this.__error(
2900
+ const O = this.__error(
2901
2901
  new w(
2902
2902
  "CSV_QUOTE_NOT_CLOSED",
2903
2903
  [
@@ -2908,16 +2908,16 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
2908
2908
  this.__infoField()
2909
2909
  )
2910
2910
  );
2911
- if (C !== void 0) return C;
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
2913
  this.info.bytes = this.state.bufBytesStart + d;
2914
- const C = this.__onField();
2915
- if (C !== void 0) return C;
2914
+ const O = this.__onField();
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 += d, this.state.previousBuf = v.slice(d);
2920
+ this.state.bufBytesStart += d, this.state.previousBuf = b.slice(d);
2921
2921
  this.state.wasRowDelimiter === !0 && (this.info.lines++, this.state.wasRowDelimiter = !1);
2922
2922
  },
2923
2923
  __onRecord: function(n) {
@@ -2928,33 +2928,33 @@ 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: c,
2932
- relax_column_count_more: h,
2931
+ relax_column_count_less: h,
2932
+ relax_column_count_more: c,
2933
2933
  raw: p,
2934
2934
  skip_records_with_empty_values: g
2935
- } = this.options, { enabled: O, record: E } = this.state;
2936
- if (O === !1)
2935
+ } = this.options, { enabled: x, record: y } = this.state;
2936
+ if (x === !1)
2937
2937
  return this.__resetRecord();
2938
- const x = E.length;
2938
+ const S = y.length;
2939
2939
  if (i === !0) {
2940
- if (g === !0 && lt(E)) {
2940
+ if (g === !0 && lt(y)) {
2941
2941
  this.__resetRecord();
2942
2942
  return;
2943
2943
  }
2944
- return this.__firstLineToColumns(E);
2944
+ return this.__firstLineToColumns(y);
2945
2945
  }
2946
- if (i === !1 && this.info.records === 0 && (this.state.expectedRecordLength = x), x !== this.state.expectedRecordLength) {
2947
- const S = i === !1 ? new w(
2946
+ if (i === !1 && this.info.records === 0 && (this.state.expectedRecordLength = S), S !== this.state.expectedRecordLength) {
2947
+ const R = i === !1 ? new w(
2948
2948
  "CSV_RECORD_INCONSISTENT_FIELDS_LENGTH",
2949
2949
  [
2950
2950
  "Invalid Record Length:",
2951
2951
  `expect ${this.state.expectedRecordLength},`,
2952
- `got ${x} on line ${this.info.lines}`
2952
+ `got ${S} on line ${this.info.lines}`
2953
2953
  ],
2954
2954
  this.options,
2955
2955
  this.__infoField(),
2956
2956
  {
2957
- record: E
2957
+ record: y
2958
2958
  }
2959
2959
  ) : new w(
2960
2960
  "CSV_RECORD_INCONSISTENT_COLUMNS",
@@ -2962,22 +2962,22 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
2962
2962
  "Invalid Record Length:",
2963
2963
  `columns length is ${i.length},`,
2964
2964
  // rename columns
2965
- `got ${x} on line ${this.info.lines}`
2965
+ `got ${S} on line ${this.info.lines}`
2966
2966
  ],
2967
2967
  this.options,
2968
2968
  this.__infoField(),
2969
2969
  {
2970
- record: E
2970
+ record: y
2971
2971
  }
2972
2972
  );
2973
- if (l === !0 || c === !0 && x < this.state.expectedRecordLength || h === !0 && x > this.state.expectedRecordLength)
2974
- this.info.invalid_field_length++, this.state.error = S;
2973
+ if (l === !0 || h === !0 && S < this.state.expectedRecordLength || c === !0 && S > this.state.expectedRecordLength)
2974
+ this.info.invalid_field_length++, this.state.error = R;
2975
2975
  else {
2976
- const y = this.__error(S);
2977
- if (y) return y;
2976
+ const v = this.__error(R);
2977
+ if (v) return v;
2978
2978
  }
2979
2979
  }
2980
- if (g === !0 && lt(E)) {
2980
+ if (g === !0 && lt(y)) {
2981
2981
  this.__resetRecord();
2982
2982
  return;
2983
2983
  }
@@ -2986,48 +2986,48 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
2986
2986
  return;
2987
2987
  }
2988
2988
  if (this.info.records++, a === 1 || this.info.records >= a) {
2989
- const { objname: S } = this.options;
2989
+ const { objname: R } = this.options;
2990
2990
  if (i !== !1) {
2991
- const y = {};
2992
- for (let _ = 0, R = E.length; _ < R; _++)
2993
- i[_] === void 0 || i[_].disabled || (o === !0 && y[i[_].name] !== void 0 ? Array.isArray(y[i[_].name]) ? y[i[_].name] = y[i[_].name].concat(E[_]) : y[i[_].name] = [y[i[_].name], E[_]] : y[i[_].name] = E[_]);
2991
+ const v = {};
2992
+ for (let _ = 0, I = y.length; _ < I; _++)
2993
+ i[_] === void 0 || i[_].disabled || (o === !0 && v[i[_].name] !== void 0 ? Array.isArray(v[i[_].name]) ? v[i[_].name] = v[i[_].name].concat(y[_]) : v[i[_].name] = [v[i[_].name], y[_]] : v[i[_].name] = y[_]);
2994
2994
  if (p === !0 || f === !0) {
2995
2995
  const _ = Object.assign(
2996
- { record: y },
2996
+ { record: v },
2997
2997
  p === !0 ? { raw: this.state.rawBuffer.toString(s) } : {},
2998
2998
  f === !0 ? { info: this.__infoRecord() } : {}
2999
- ), R = this.__push(
3000
- S === void 0 ? _ : [y[S], _],
2999
+ ), I = this.__push(
3000
+ R === void 0 ? _ : [v[R], _],
3001
3001
  n
3002
3002
  );
3003
- if (R)
3004
- return R;
3003
+ if (I)
3004
+ return I;
3005
3005
  } else {
3006
3006
  const _ = this.__push(
3007
- S === void 0 ? y : [y[S], y],
3007
+ R === void 0 ? v : [v[R], v],
3008
3008
  n
3009
3009
  );
3010
3010
  if (_)
3011
3011
  return _;
3012
3012
  }
3013
3013
  } else if (p === !0 || f === !0) {
3014
- const y = Object.assign(
3015
- { record: E },
3014
+ const v = Object.assign(
3015
+ { record: y },
3016
3016
  p === !0 ? { raw: this.state.rawBuffer.toString(s) } : {},
3017
3017
  f === !0 ? { info: this.__infoRecord() } : {}
3018
3018
  ), _ = this.__push(
3019
- S === void 0 ? y : [E[S], y],
3019
+ R === void 0 ? v : [y[R], v],
3020
3020
  n
3021
3021
  );
3022
3022
  if (_)
3023
3023
  return _;
3024
3024
  } else {
3025
- const y = this.__push(
3026
- S === void 0 ? E : [E[S], E],
3025
+ const v = this.__push(
3026
+ R === void 0 ? y : [y[R], y],
3027
3027
  n
3028
3028
  );
3029
- if (y)
3030
- return y;
3029
+ if (v)
3030
+ return v;
3031
3031
  }
3032
3032
  }
3033
3033
  this.__resetRecord();
@@ -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 [c, h] = this.__cast(l);
3072
- if (c !== void 0) return c;
3073
- l = h;
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 c = a[l];
3120
- for (let h = 0; h < c.length; h++)
3121
- if (c[h] !== s[f + h]) continue e;
3122
- return c.length;
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 c = 1; c < l.length; c++)
3153
- if (l[c] !== n[i + c]) continue e;
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], c = l.length;
3162
+ const l = s[a], h = l.length;
3163
3163
  if (l[0] === n) {
3164
- for (let h = 1; h < c; h++)
3165
- if (l[h] !== i[o + h])
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
  }
@@ -3389,10 +3389,11 @@ class ri {
3389
3389
  * Determine schema configuration.
3390
3390
  */
3391
3391
  async determineSchemaConfig(e, r) {
3392
- const n = Xn(e), i = await Kn(e);
3392
+ const n = Xn(e), { rows: i, valueDelimiterId: o } = await Kn(e, r);
3393
3393
  return {
3394
3394
  recordDelimiterId: n,
3395
- valueDelimiterId: i
3395
+ rows: i,
3396
+ valueDelimiterId: o
3396
3397
  };
3397
3398
  }
3398
3399
  /**
@@ -3400,50 +3401,50 @@ class ri {
3400
3401
  */
3401
3402
  async parseStream(e, r, n, i, o) {
3402
3403
  return new Promise((s, f) => {
3403
- let a, l, c, h = !1, p = !1;
3404
+ let a, l, h, c = !1, p = !1;
3404
3405
  const g = () => {
3405
3406
  if (p) return;
3406
3407
  p = !0;
3407
- const x = a;
3408
- a = void 0, c = void 0, x != null && (Be(() => x.removeAllListeners()), Be(() => x.end())), Be(() => {
3408
+ const S = a;
3409
+ a = void 0, h = void 0, S != null && (Be(() => S.removeAllListeners()), Be(() => S.end())), Be(() => {
3409
3410
  l?.cancel();
3410
3411
  }), l = void 0;
3411
3412
  };
3412
3413
  i.signal.addEventListener("abort", g, { once: !0 });
3413
- const O = (x) => {
3414
- h || (h = !0, g(), i.signal.aborted || i.abort(x), f(x));
3414
+ const x = (S) => {
3415
+ c || (c = !0, g(), i.signal.aborted || i.abort(S), f(S));
3415
3416
  };
3416
3417
  (async () => {
3417
- a = je(r), c = ei({ chunk: o, chunkSize: e.chunkSize ?? Gn }), a.on("readable", () => {
3418
+ a = je(r), h = ei({ chunk: o, chunkSize: e.chunkSize ?? Gn }), a.on("readable", () => {
3418
3419
  try {
3419
- if (a == null || c == null) return;
3420
- let R;
3421
- for (; (R = a.read()) != null; ) {
3422
- if (h) return;
3423
- i.signal.throwIfAborted(), c.push(R);
3420
+ if (a == null || h == null) return;
3421
+ let I;
3422
+ for (; (I = a.read()) != null; ) {
3423
+ if (c) return;
3424
+ i.signal.throwIfAborted(), h.push(I);
3424
3425
  }
3425
- } catch (R) {
3426
- O(R);
3426
+ } catch (I) {
3427
+ x(I);
3427
3428
  }
3428
- }), a.on("error", (R) => O(R)), a.on("end", () => {
3429
- h || (c?.flush(), s(ti(a)));
3429
+ }), a.on("error", (I) => x(I)), a.on("end", () => {
3430
+ c || (h?.flush(), s(ti(a)));
3430
3431
  });
3431
- const x = await fetch(encodeURI(n), { signal: i.signal });
3432
- if (!x.ok || x.body == null)
3433
- throw await Wn(x, `Failed to fetch '${n}' file.`, "datapos-connector-file-store-emulator|Connector|retrieve");
3434
- l = x.body.getReader();
3435
- const S = new TextDecoder(e.encodingId);
3436
- let y = await l.read();
3437
- for (; !y.done; ) {
3438
- if (h) return;
3432
+ const S = await fetch(encodeURI(n), { signal: i.signal });
3433
+ if (!S.ok || S.body == null)
3434
+ throw await Wn(S, `Failed to fetch '${n}' file.`, "datapos-connector-file-store-emulator|Connector|retrieve");
3435
+ l = S.body.getReader();
3436
+ const R = new TextDecoder(e.encodingId);
3437
+ let v = await l.read();
3438
+ for (; !v.done; ) {
3439
+ if (c) return;
3439
3440
  i.signal.throwIfAborted();
3440
- const R = S.decode(y.value, { stream: !0 });
3441
- R.length > 0 && a.write(R), y = await l.read();
3441
+ const I = R.decode(v.value, { stream: !0 });
3442
+ I.length > 0 && a.write(I), v = await l.read();
3442
3443
  }
3443
- if (h) return;
3444
- const _ = S.decode();
3444
+ if (c) return;
3445
+ const _ = R.decode();
3445
3446
  _.length > 0 && a.write(_), a.end();
3446
- })().catch((x) => O(x));
3447
+ })().catch((S) => x(S));
3447
3448
  });
3448
3449
  }
3449
3450
  }
@@ -3454,33 +3455,35 @@ function Xn(t) {
3454
3455
  ` : n >= e && n >= r ? "\r" : `
3455
3456
  `;
3456
3457
  }
3457
- async function Kn(t) {
3458
- const e = [":", ",", "!", "0x1E", ";", " ", " ", "_", "0x1F", "|"];
3459
- let r, n, i;
3460
- for (const o of e)
3458
+ async function Kn(t, e) {
3459
+ let r, n, i, o = [];
3460
+ for (const s of e)
3461
3461
  try {
3462
- let s = 0, f, a = 0, l = 0;
3463
- const c = je({ delimiter: o, relax_column_count: !0 });
3464
- await new Promise((h) => {
3462
+ let f = 0, a, l = 0, h = 0;
3463
+ const c = je({ delimiter: s, relax_column_count: !0 });
3464
+ await new Promise((p) => {
3465
3465
  try {
3466
+ const g = [];
3466
3467
  c.on("readable", () => {
3467
- let p;
3468
- for (; (p = c.read()) != null; ) {
3469
- console.log("ROW", p), a++;
3470
- const g = p.length;
3471
- f != null && (l += Math.abs(g - f)), f = g, s += g;
3468
+ let x;
3469
+ for (; (x = c.read()) != null; ) {
3470
+ l++;
3471
+ const y = x.length;
3472
+ a != null && (h += Math.abs(y - a)), a = y, f += y, g.push(x);
3472
3473
  }
3473
- }), c.on("error", () => h()), c.on("end", () => {
3474
- const p = s / a;
3475
- (!i || l <= i) && (!n || p > n) && (r = o, n = p, i = l), h();
3474
+ }), c.on("error", (x) => {
3475
+ console.log(7777, x), p();
3476
+ }), c.on("end", () => {
3477
+ const x = f / l;
3478
+ (!i || h <= i) && (!n || x > n) && (r = s, n = x, i = h, o = [...g]), p();
3476
3479
  }), c.write(t), c.end();
3477
3480
  } catch {
3478
- h();
3481
+ p();
3479
3482
  }
3480
3483
  });
3481
3484
  } catch {
3482
3485
  }
3483
- return r ?? ",";
3486
+ return { rows: o, valueDelimiterId: r ?? "," };
3484
3487
  }
3485
3488
  function ei(t) {
3486
3489
  const e = Math.max(1, Math.floor(t.chunkSize)), r = [];
@@ -2,10 +2,15 @@ import { Options as ParseOptions, Parser } from 'csv-parse/browser/esm';
2
2
  import { RecordDelimiterId, ValueDelimiterId } from '@datapos/datapos-shared';
3
3
  import { RetrieveRecordsOptions, RetrieveRecordsSummary } from '@datapos/datapos-shared/component/connector';
4
4
  /**
5
- * Schema.
5
+ * Row and row buffer.
6
+ */
7
+ type Row = string[];
8
+ /**
9
+ * Schema configuration.
6
10
  */
7
11
  interface SchemaConfig {
8
12
  recordDelimiterId: RecordDelimiterId;
13
+ rows: Row[];
9
14
  valueDelimiterId: ValueDelimiterId;
10
15
  }
11
16
  /** Tool. */
@@ -15,11 +20,11 @@ declare class Tool {
15
20
  /**
16
21
  * Determine schema configuration.
17
22
  */
18
- determineSchemaConfig(text: string, delimiters: string[]): Promise<SchemaConfig>;
23
+ determineSchemaConfig(text: string, delimiters: ValueDelimiterId[]): Promise<SchemaConfig>;
19
24
  /**
20
25
  * Parse stream.
21
26
  */
22
27
  parseStream(retrieveRecordsOptions: RetrieveRecordsOptions, parseOptions: ParseOptions, url: string, abortController: AbortController, chunk: (records: (string[] | Record<string, unknown>)[]) => void): Promise<RetrieveRecordsSummary>;
23
28
  }
24
29
  export type { Options as ParseOptions, Parser } from 'csv-parse/browser/esm';
25
- export { type SchemaConfig, Tool };
30
+ export { type Row, type SchemaConfig, Tool };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datapos/datapos-tool-csv-parse",
3
- "version": "0.0.71",
3
+ "version": "0.0.72",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "private": false,