@sheetxl/studio-mui 0.4.20 → 0.4.22
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/browser/cjs/2d2J6QkipnGWfI99.cjs +6 -0
- package/browser/cjs/BY09bxecVOSMwQA3.cjs +6 -0
- package/browser/cjs/BYJI3FMxQ-z5UGsU.cjs +6 -0
- package/browser/cjs/B_nvuo0kEXu5G0Gf.cjs +7 -0
- package/browser/cjs/BfnxiVEhzO5reOYH.cjs +42 -0
- package/browser/cjs/Bil3fXnJ3lk7aGF5.cjs +6 -0
- package/browser/cjs/{DItuuqkIamMzp7Im.cjs → BzbKSVugPof6dqQI.cjs} +1 -1
- package/browser/cjs/CU0utErelA1oX0n8.cjs +6 -0
- package/browser/cjs/CWp8_mrz0htdOXMM.cjs +20 -0
- package/browser/cjs/D2Cp7gwb6bRupSZY.cjs +6 -0
- package/browser/cjs/DC70SHoaPVkOUEHx.cjs +6 -0
- package/browser/cjs/DRUx3PLS_NrkJ6Yw.cjs +18 -0
- package/browser/cjs/index.cjs +2 -2
- package/browser/esm/-0XEuwqNVFTlDKEX.mjs +25 -0
- package/browser/esm/-AR3L_VjwMbtQVbL.mjs +62 -0
- package/browser/esm/BLhZj1SgWlsmeviw.mjs +4443 -0
- package/browser/esm/{BW3_mz5_8i9VLBYB.mjs → BXNl9EEQzO53Hoh5.mjs} +87 -85
- package/browser/esm/BqnVpwK0Q2fKGA2S.mjs +53 -0
- package/browser/esm/D4rFOqwrrtVMpgbc.mjs +49 -0
- package/browser/esm/DEbllEGmvtLkCug_.mjs +2156 -0
- package/browser/esm/{C60ZnLCvtztDLuoT.mjs → DXRFs7VZM4IShMju.mjs} +100 -98
- package/browser/esm/{C5xUbwpUPDeNua-i.mjs → DeGATuYv4-5bhQcD.mjs} +1 -1
- package/browser/esm/{5u-JEG1IfQBstjq0.mjs → EMqbYi0X_krk5yOL.mjs} +11 -10
- package/browser/esm/fWsCG2WBM3kCpC5p.mjs +46 -0
- package/browser/esm/index.mjs +29 -29
- package/browser/esm/{CxXpPYi4eOFhBNt2.mjs → pARZF2O230qNvxWd.mjs} +27 -26
- package/licenses/dependencies.txt +0 -271
- package/node/esm/{D6A_o47zvz5ITIJK.mjs → 0JTY0jNrXiIiOqWY.mjs} +79 -78
- package/node/esm/{Ds5dinNcyNdC8ta6.mjs → BqQ6JNhQ1K321g9U.mjs} +13 -11
- package/node/esm/{CrDbLKJh9omVo_TF.mjs → Bu58psaOsDy_zPOJ.mjs} +29 -28
- package/node/esm/BzBHqe1ThbCP-l_d.mjs +88 -0
- package/node/esm/CE_I2ijQF8MeexHD.mjs +63 -0
- package/node/esm/{Bv12-Yyv0C86Iquy.mjs → CuomeW-4DDc1ywFW.mjs} +7 -6
- package/node/esm/DRt8kMDuCJn53CIE.mjs +46 -0
- package/node/esm/{CH6p2H0CMCoz4NgJ.mjs → DgHCTCARk1Gv_msN.mjs} +23 -22
- package/node/esm/{Bn5TJPQAEMY-lGpF.mjs → Do7y7aKPA48-93AV.mjs} +4 -3
- package/node/esm/{rlqvGCJlj4a2UcSM.mjs → X11ONmg6R1Y6hfue.mjs} +11 -10
- package/node/esm/index.mjs +2381 -18514
- package/package.json +8 -8
- package/browser/cjs/-Z37a-mzY5SKXy--.cjs +0 -6
- package/browser/cjs/B384kb1_rsiCsdZG.cjs +0 -6
- package/browser/cjs/B8nWvy4zDv1CZsr_.cjs +0 -110
- package/browser/cjs/BBnMJiXp9lru0Rcq.cjs +0 -6
- package/browser/cjs/BFbHTu65n1oE-l0N.cjs +0 -6
- package/browser/cjs/BQMSHnQdWtqeakER.cjs +0 -6
- package/browser/cjs/BvjA0ybox6653eb5.cjs +0 -6
- package/browser/cjs/Cocgl4ghzWE9yVYS.cjs +0 -161
- package/browser/cjs/D21Q1NdM1zQ7uFlH.cjs +0 -6
- package/browser/cjs/D4LmaKqYiwjxp0Hs.cjs +0 -15
- package/browser/cjs/D6egUillMqBwTaEq.cjs +0 -6
- package/browser/cjs/D9lY6pd9tRxPeLKs.cjs +0 -18
- package/browser/cjs/DNqIYSqRYZkUpFxW.cjs +0 -7
- package/browser/cjs/DUImSlPsM-OipgBZ.cjs +0 -6
- package/browser/cjs/DUVLcBcwkTsuLb6q.cjs +0 -6
- package/browser/cjs/Db7IyKXFzo8IocDa.cjs +0 -145
- package/browser/cjs/DsHPj69dMFG09uD_.cjs +0 -16
- package/browser/cjs/DypblOPNMRx5Twgx.cjs +0 -12
- package/browser/cjs/QK7YNBstmN86K-xL.cjs +0 -6
- package/browser/cjs/VNWvn2kP6ZF0Snzw.cjs +0 -11
- package/browser/cjs/dc1YAArM3bSHvRcF.cjs +0 -7
- package/browser/cjs/mInXvB8P6r6q7pRY.cjs +0 -11
- package/browser/cjs/nop6N-Oi_LKy1Bpc.cjs +0 -42
- package/browser/cjs/s45oNHeIvJVeRjn5.cjs +0 -6
- package/browser/esm/1y10o01h14oGJtKG.mjs +0 -43
- package/browser/esm/BFpc8KBa-fb0nLSt.mjs +0 -46
- package/browser/esm/Bmjhrc6YMmfx_1Yi.mjs +0 -1703
- package/browser/esm/BnlJVFlQeWerd3KW.mjs +0 -3803
- package/browser/esm/BpuH_QvBidPOXgAR.mjs +0 -392
- package/browser/esm/CAiWSkkPRgUjk8CN.mjs +0 -424
- package/browser/esm/CW8taieVozHhyBOC.mjs +0 -1467
- package/browser/esm/CzyEerZmfWrW3i3U.mjs +0 -59
- package/browser/esm/D0FBHwm0Oz_wf0tR.mjs +0 -12
- package/browser/esm/DM9GPrZpbCcKOnyU.mjs +0 -1352
- package/browser/esm/DO1doKZhwYiL7vbF.mjs +0 -1672
- package/browser/esm/DS3anstzAV3EJBRw.mjs +0 -84
- package/browser/esm/DuEmdSQsXlkCWZIB.mjs +0 -1366
- package/browser/esm/FvK-pQsicRjtrKoS.mjs +0 -48
- package/browser/esm/KCTJzQeDChqf1yBO.mjs +0 -52
- package/browser/esm/P-3pIbidOtRCNsw3.mjs +0 -23
- package/browser/esm/W3EFMOPLR1aNXWvF.mjs +0 -2250
- package/browser/esm/Z_Sh-N3xHHWLCbEw.mjs +0 -23412
- package/browser/esm/mOmzoYDWAtgYndCA.mjs +0 -13391
- package/browser/esm/tnJECoiQzUzgUQZE.mjs +0 -44
- package/node/esm/54SjtcD6mOreKcCy.mjs +0 -1719
- package/node/esm/B2BlMiDOVpIp1FDQ.mjs +0 -1706
- package/node/esm/BNEvR1srnnwBgnrF.mjs +0 -1479
- package/node/esm/BZ20_F64yjZgn-_G.mjs +0 -1246
- package/node/esm/BfzRLuswtxg9uDsX.mjs +0 -78
- package/node/esm/C0ZBbkFa-24tJTnw.mjs +0 -60
- package/node/esm/CEVO60fX3MAPG0Hg.mjs +0 -1378
- package/node/esm/CdFmhVFplZFgBvTo.mjs +0 -44
- package/node/esm/Cx4mn0YEVkG-M1VL.mjs +0 -553
- package/node/esm/DDWek3aquTe_okr_.mjs +0 -392
- package/node/esm/DSLWcwr4qgHARs36.mjs +0 -13464
- package/node/esm/iXG86MN0JrtJkpqe.mjs +0 -44
- package/node/esm/m2teXjBzZLfLDFPx.mjs +0 -46
- package/node/esm/oykDy4erHC0NNHHq.mjs +0 -3776
- package/node/esm/sVOd1y3oNBREsKJ7.mjs +0 -86
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.4.20
|
|
3
|
-
*
|
|
4
|
-
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
5
|
-
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
|
-
*/
|
|
7
|
-
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
8
|
-
import { memo as a, useMemo as n, useState as l, useCallback as o } from "react";
|
|
9
|
-
import { Box as i } from "@mui/material";
|
|
10
|
-
import { P as r, a as s, NamedInput as d, RangeInput as p } from "./index.mjs";
|
|
11
|
-
const u = ["Ok", "Cancel"], c = a((a2) => {
|
|
12
|
-
const { value: c2 = null, context: m, onOption: g, onValidateOption: x, onDone: f, onUpdate: N, options: y = u, defaultOption: T = y?.[0], cancelOption: O = "Cancel", sx: V, ...h } = a2, v = n(() => m?.getNames().findValidName("Range1"), []), C = n(() => {
|
|
13
|
-
if (!c2) return true;
|
|
14
|
-
}, []), [R, w] = l({ displayText: c2?.getName() ?? v, errorText: null }), [F, D] = l({ displayValue: c2?.getRanges() ?? m?.selection() ?? null, errorText: null }), [I, j] = l(false), B = o(async (e2) => !R.errorText && !F.errorText, [m]), E = r((e2, t2, a3) => {
|
|
15
|
-
if (!t2) {
|
|
16
|
-
let e3 = null;
|
|
17
|
-
C ? e3 = m?.getNames().addReference(R?.displayText, F?.displayValue, false) : ("reference" === c2.getType() && c2.doBatch(() => {
|
|
18
|
-
c2.setName(R?.displayText), c2.setReference(F?.displayValue);
|
|
19
|
-
}, `Edit Named '${R?.displayText}'`), e3 = c2), e3 && (e3.select(), N(e3, C));
|
|
20
|
-
}
|
|
21
|
-
g?.(e2, t2, a3), f?.();
|
|
22
|
-
}, [m, R, F, f, g, T, O, N]), L = r((e2) => {
|
|
23
|
-
let t2 = null;
|
|
24
|
-
try {
|
|
25
|
-
m?.getNames().validateName(e2);
|
|
26
|
-
} catch (e3) {
|
|
27
|
-
t2 = e3.message;
|
|
28
|
-
}
|
|
29
|
-
w({ displayText: e2, errorText: t2 });
|
|
30
|
-
}, []), b = r((e2) => {
|
|
31
|
-
c2 && c2.getName().toLowerCase() === e2.toLowerCase() || m?.getNames().validateName(e2);
|
|
32
|
-
}, [m, c2]), k = o((e2) => {
|
|
33
|
-
D({ displayValue: e2 ?? null, errorText: null });
|
|
34
|
-
}, []);
|
|
35
|
-
return e(s, { title: (C ? "Define" : "Edit") + " Range", options: y, onOption: E, onValidateOption: B, defaultOption: T, cancelOption: O, autoFocusSel: ".autoFocus", sx: { width: "460px", ...V }, ...h, children: t(i, { sx: { paddingTop: (e2) => e2.spacing(1), paddingBottom: (e2) => e2.spacing(0), rowGap: (e2) => e2.spacing(1), range: "flex", flexDirection: "column" }, children: [e(d, { formName: "name", defaultInput: v, value: R.displayText, onChangeInput: L, onValidate: b, onFocus: (e2) => {
|
|
36
|
-
I || e2.target?.select(), j(true);
|
|
37
|
-
} }), e(p, { formName: "range", value: F.displayValue, onChangeInput: k, resolvedAddress: m.getNames().getRanges.bind(m.getNames()), onFocus: (e2) => {
|
|
38
|
-
I || e2.target?.select(), j(true);
|
|
39
|
-
} })] }) });
|
|
40
|
-
});
|
|
41
|
-
export {
|
|
42
|
-
c as NamedReferenceDialog,
|
|
43
|
-
c as default
|
|
44
|
-
};
|
|
@@ -1,553 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.4.20
|
|
3
|
-
*
|
|
4
|
-
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
5
|
-
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
|
-
*/
|
|
7
|
-
import e from "stream";
|
|
8
|
-
function t(e2, t3) {
|
|
9
|
-
for (var i2 = 0; i2 < t3.length; i2++) {
|
|
10
|
-
const r2 = t3[i2];
|
|
11
|
-
if ("string" != typeof r2 && !Array.isArray(r2)) {
|
|
12
|
-
for (const t4 in r2) if ("default" !== t4 && !(t4 in e2)) {
|
|
13
|
-
const i3 = Object.getOwnPropertyDescriptor(r2, t4);
|
|
14
|
-
i3 && Object.defineProperty(e2, t4, i3.get ? i3 : { enumerable: true, get: () => r2[t4] });
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return Object.freeze(Object.defineProperty(e2, Symbol.toStringTag, { value: "Module" }));
|
|
19
|
-
}
|
|
20
|
-
var i, r = { exports: {} };
|
|
21
|
-
const n = t({ __proto__: null }, [(i || (i = 1, r.exports = function t2() {
|
|
22
|
-
var i2 = "undefined" != typeof self ? self : "undefined" != typeof window ? window : void 0 !== i2 ? i2 : {};
|
|
23
|
-
function r2() {
|
|
24
|
-
var e2 = i2.URL || i2.webkitURL || null, r3 = t2.toString();
|
|
25
|
-
return h.BLOB_URL || (h.BLOB_URL = e2.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ", "(", r3, ")();"], { type: "text/javascript" })));
|
|
26
|
-
}
|
|
27
|
-
var n2 = !i2.document && !!i2.postMessage, s = i2.IS_PAPA_WORKER || false, a = {}, o = 0, h = {};
|
|
28
|
-
if (h.parse = f, h.unparse = d, h.RECORD_SEP = String.fromCharCode(30), h.UNIT_SEP = String.fromCharCode(31), h.BYTE_ORDER_MARK = "\uFEFF", h.BAD_DELIMITERS = ["\r", "\n", '"', h.BYTE_ORDER_MARK], h.WORKERS_SUPPORTED = !n2 && !!i2.Worker, h.NODE_STREAM_INPUT = 1, h.LocalChunkSize = 10485760, h.RemoteChunkSize = 5242880, h.DefaultDelimiter = ",", h.Parser = k, h.ParserHandle = y, h.NetworkStreamer = c, h.FileStreamer = p, h.StringStreamer = _, h.ReadableStreamStreamer = g, "undefined" == typeof PAPA_BROWSER_CONTEXT && (h.DuplexStreamStreamer = m), i2.jQuery) {
|
|
29
|
-
var u = i2.jQuery;
|
|
30
|
-
u.fn.parse = function(e2) {
|
|
31
|
-
var t3 = e2.config || {}, r3 = [];
|
|
32
|
-
return this.each(function(e3) {
|
|
33
|
-
if ("INPUT" !== u(this).prop("tagName").toUpperCase() || "file" !== u(this).attr("type").toLowerCase() || !i2.FileReader || !this.files || 0 === this.files.length) return true;
|
|
34
|
-
for (var n4 = 0; n4 < this.files.length; n4++) r3.push({ file: this.files[n4], inputElem: this, instanceConfig: u.extend({}, t3) });
|
|
35
|
-
}), n3(), this;
|
|
36
|
-
function n3() {
|
|
37
|
-
if (0 !== r3.length) {
|
|
38
|
-
var t4 = r3[0];
|
|
39
|
-
if (x(e2.before)) {
|
|
40
|
-
var i3 = e2.before(t4.file, t4.inputElem);
|
|
41
|
-
if ("object" == typeof i3) {
|
|
42
|
-
if ("abort" === i3.action) return void s2("AbortError", t4.file, t4.inputElem, i3.reason);
|
|
43
|
-
if ("skip" === i3.action) return void a2();
|
|
44
|
-
"object" == typeof i3.config && (t4.instanceConfig = u.extend(t4.instanceConfig, i3.config));
|
|
45
|
-
} else if ("skip" === i3) return void a2();
|
|
46
|
-
}
|
|
47
|
-
var n4 = t4.instanceConfig.complete;
|
|
48
|
-
t4.instanceConfig.complete = function(e3) {
|
|
49
|
-
x(n4) && n4(e3, t4.file, t4.inputElem), a2();
|
|
50
|
-
}, h.parse(t4.file, t4.instanceConfig);
|
|
51
|
-
} else x(e2.complete) && e2.complete();
|
|
52
|
-
}
|
|
53
|
-
function s2(t4, i3, r4, n4) {
|
|
54
|
-
x(e2.error) && e2.error({ name: t4 }, i3, r4, n4);
|
|
55
|
-
}
|
|
56
|
-
function a2() {
|
|
57
|
-
r3.splice(0, 1), n3();
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
function f(e2, t3) {
|
|
62
|
-
var r3 = (t3 = t3 || {}).dynamicTyping || false;
|
|
63
|
-
if (x(r3) && (t3.dynamicTypingFunction = r3, r3 = {}), t3.dynamicTyping = r3, t3.transform = !!x(t3.transform) && t3.transform, t3.worker && h.WORKERS_SUPPORTED) {
|
|
64
|
-
var n3 = b();
|
|
65
|
-
return n3.userStep = t3.step, n3.userChunk = t3.chunk, n3.userComplete = t3.complete, n3.userError = t3.error, t3.step = x(t3.step), t3.chunk = x(t3.chunk), t3.complete = x(t3.complete), t3.error = x(t3.error), delete t3.worker, void n3.postMessage({ input: e2, config: t3, workerId: n3.id });
|
|
66
|
-
}
|
|
67
|
-
var s2 = null;
|
|
68
|
-
return e2 === h.NODE_STREAM_INPUT && "undefined" == typeof PAPA_BROWSER_CONTEXT ? (s2 = new m(t3)).getStream() : ("string" == typeof e2 ? (e2 = a2(e2), s2 = t3.download ? new c(t3) : new _(t3)) : true === e2.readable && x(e2.read) && x(e2.on) ? s2 = new g(t3) : (i2.File && e2 instanceof File || e2 instanceof Object) && (s2 = new p(t3)), s2.stream(e2));
|
|
69
|
-
function a2(e3) {
|
|
70
|
-
return 65279 === e3.charCodeAt(0) ? e3.slice(1) : e3;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
function d(e2, t3) {
|
|
74
|
-
var i3 = false, r3 = true, n3 = ",", s2 = "\r\n", a2 = '"', o2 = a2 + a2, u2 = false, f2 = null, d2 = false;
|
|
75
|
-
c2();
|
|
76
|
-
var l2 = new RegExp(v(a2), "g");
|
|
77
|
-
if ("string" == typeof e2 && (e2 = JSON.parse(e2)), Array.isArray(e2)) {
|
|
78
|
-
if (!e2.length || Array.isArray(e2[0])) return p2(null, e2, u2);
|
|
79
|
-
if ("object" == typeof e2[0]) return p2(f2 || Object.keys(e2[0]), e2, u2);
|
|
80
|
-
} else if ("object" == typeof e2) return "string" == typeof e2.data && (e2.data = JSON.parse(e2.data)), Array.isArray(e2.data) && (e2.fields || (e2.fields = e2.meta && e2.meta.fields || f2), e2.fields || (e2.fields = Array.isArray(e2.data[0]) ? e2.fields : "object" == typeof e2.data[0] ? Object.keys(e2.data[0]) : []), Array.isArray(e2.data[0]) || "object" == typeof e2.data[0] || (e2.data = [e2.data])), p2(e2.fields || [], e2.data || [], u2);
|
|
81
|
-
throw new Error("Unable to serialize unrecognized input");
|
|
82
|
-
function c2() {
|
|
83
|
-
if ("object" == typeof t3) {
|
|
84
|
-
if ("string" != typeof t3.delimiter || h.BAD_DELIMITERS.filter(function(e3) {
|
|
85
|
-
return -1 !== t3.delimiter.indexOf(e3);
|
|
86
|
-
}).length || (n3 = t3.delimiter), ("boolean" == typeof t3.quotes || "function" == typeof t3.quotes || Array.isArray(t3.quotes)) && (i3 = t3.quotes), "boolean" != typeof t3.skipEmptyLines && "string" != typeof t3.skipEmptyLines || (u2 = t3.skipEmptyLines), "string" == typeof t3.newline && (s2 = t3.newline), "string" == typeof t3.quoteChar && (a2 = t3.quoteChar), "boolean" == typeof t3.header && (r3 = t3.header), Array.isArray(t3.columns)) {
|
|
87
|
-
if (0 === t3.columns.length) throw new Error("Option columns is empty");
|
|
88
|
-
f2 = t3.columns;
|
|
89
|
-
}
|
|
90
|
-
void 0 !== t3.escapeChar && (o2 = t3.escapeChar + a2), t3.escapeFormulae instanceof RegExp ? d2 = t3.escapeFormulae : "boolean" == typeof t3.escapeFormulae && t3.escapeFormulae && (d2 = /^[=+\-@\t\r].*$/);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
function p2(e3, t4, i4) {
|
|
94
|
-
var a3 = "";
|
|
95
|
-
"string" == typeof e3 && (e3 = JSON.parse(e3)), "string" == typeof t4 && (t4 = JSON.parse(t4));
|
|
96
|
-
var o3 = Array.isArray(e3) && e3.length > 0, h2 = !Array.isArray(t4[0]);
|
|
97
|
-
if (o3 && r3) {
|
|
98
|
-
for (var u3 = 0; u3 < e3.length; u3++) u3 > 0 && (a3 += n3), a3 += _2(e3[u3], u3);
|
|
99
|
-
t4.length > 0 && (a3 += s2);
|
|
100
|
-
}
|
|
101
|
-
for (var f3 = 0; f3 < t4.length; f3++) {
|
|
102
|
-
var d3 = o3 ? e3.length : t4[f3].length, l3 = false, c3 = o3 ? 0 === Object.keys(t4[f3]).length : 0 === t4[f3].length;
|
|
103
|
-
if (i4 && !o3 && (l3 = "greedy" === i4 ? "" === t4[f3].join("").trim() : 1 === t4[f3].length && 0 === t4[f3][0].length), "greedy" === i4 && o3) {
|
|
104
|
-
for (var p3 = [], g3 = 0; g3 < d3; g3++) {
|
|
105
|
-
var m2 = h2 ? e3[g3] : g3;
|
|
106
|
-
p3.push(t4[f3][m2]);
|
|
107
|
-
}
|
|
108
|
-
l3 = "" === p3.join("").trim();
|
|
109
|
-
}
|
|
110
|
-
if (!l3) {
|
|
111
|
-
for (var y2 = 0; y2 < d3; y2++) {
|
|
112
|
-
y2 > 0 && !c3 && (a3 += n3);
|
|
113
|
-
var v2 = o3 && h2 ? e3[y2] : y2;
|
|
114
|
-
a3 += _2(t4[f3][v2], y2);
|
|
115
|
-
}
|
|
116
|
-
f3 < t4.length - 1 && (!i4 || d3 > 0 && !c3) && (a3 += s2);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
return a3;
|
|
120
|
-
}
|
|
121
|
-
function _2(e3, t4) {
|
|
122
|
-
if (null == e3) return "";
|
|
123
|
-
if (e3.constructor === Date) return JSON.stringify(e3).slice(1, 25);
|
|
124
|
-
var r4 = false;
|
|
125
|
-
d2 && "string" == typeof e3 && d2.test(e3) && (e3 = "'" + e3, r4 = true);
|
|
126
|
-
var s3 = e3.toString().replace(l2, o2);
|
|
127
|
-
return (r4 = r4 || true === i3 || "function" == typeof i3 && i3(e3, t4) || Array.isArray(i3) && i3[t4] || g2(s3, h.BAD_DELIMITERS) || s3.indexOf(n3) > -1 || " " === s3.charAt(0) || " " === s3.charAt(s3.length - 1)) ? a2 + s3 + a2 : s3;
|
|
128
|
-
}
|
|
129
|
-
function g2(e3, t4) {
|
|
130
|
-
for (var i4 = 0; i4 < t4.length; i4++) if (e3.indexOf(t4[i4]) > -1) return true;
|
|
131
|
-
return false;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
function l(e2) {
|
|
135
|
-
function t3(e3) {
|
|
136
|
-
var t4 = S(e3);
|
|
137
|
-
t4.chunkSize = parseInt(t4.chunkSize), e3.step || e3.chunk || (t4.chunkSize = null), this._handle = new y(t4), this._handle.streamer = this, this._config = t4;
|
|
138
|
-
}
|
|
139
|
-
this._handle = null, this._finished = false, this._completed = false, this._halted = false, this._input = null, this._baseIndex = 0, this._partialLine = "", this._rowCount = 0, this._start = 0, this._nextChunk = null, this.isFirstChunk = true, this._completeResults = { data: [], errors: [], meta: {} }, t3.call(this, e2), this.parseChunk = function(e3, t4) {
|
|
140
|
-
const r3 = parseInt(this._config.skipFirstNLines) || 0;
|
|
141
|
-
if (this.isFirstChunk && r3 > 0) {
|
|
142
|
-
let t5 = this._config.newline;
|
|
143
|
-
if (!t5) {
|
|
144
|
-
const i4 = this._config.quoteChar || '"';
|
|
145
|
-
t5 = this._handle.guessLineEndings(e3, i4);
|
|
146
|
-
}
|
|
147
|
-
const i3 = e3.split(t5);
|
|
148
|
-
e3 = [...i3.slice(r3)].join(t5);
|
|
149
|
-
}
|
|
150
|
-
if (this.isFirstChunk && x(this._config.beforeFirstChunk)) {
|
|
151
|
-
var n3 = this._config.beforeFirstChunk(e3);
|
|
152
|
-
void 0 !== n3 && (e3 = n3);
|
|
153
|
-
}
|
|
154
|
-
this.isFirstChunk = false, this._halted = false;
|
|
155
|
-
var a2 = this._partialLine + e3;
|
|
156
|
-
this._partialLine = "";
|
|
157
|
-
var o2 = this._handle.parse(a2, this._baseIndex, !this._finished);
|
|
158
|
-
if (!this._handle.paused() && !this._handle.aborted()) {
|
|
159
|
-
var u2 = o2.meta.cursor;
|
|
160
|
-
this._finished || (this._partialLine = a2.substring(u2 - this._baseIndex), this._baseIndex = u2), o2 && o2.data && (this._rowCount += o2.data.length);
|
|
161
|
-
var f2 = this._finished || this._config.preview && this._rowCount >= this._config.preview;
|
|
162
|
-
if (s) i2.postMessage({ results: o2, workerId: h.WORKER_ID, finished: f2 });
|
|
163
|
-
else if (x(this._config.chunk) && !t4) {
|
|
164
|
-
if (this._config.chunk(o2, this._handle), this._handle.paused() || this._handle.aborted()) return void (this._halted = true);
|
|
165
|
-
o2 = void 0, this._completeResults = void 0;
|
|
166
|
-
}
|
|
167
|
-
return this._config.step || this._config.chunk || (this._completeResults.data = this._completeResults.data.concat(o2.data), this._completeResults.errors = this._completeResults.errors.concat(o2.errors), this._completeResults.meta = o2.meta), this._completed || !f2 || !x(this._config.complete) || o2 && o2.meta.aborted || (this._config.complete(this._completeResults, this._input), this._completed = true), f2 || o2 && o2.meta.paused || this._nextChunk(), o2;
|
|
168
|
-
}
|
|
169
|
-
this._halted = true;
|
|
170
|
-
}, this._sendError = function(e3) {
|
|
171
|
-
x(this._config.error) ? this._config.error(e3) : s && this._config.error && i2.postMessage({ workerId: h.WORKER_ID, error: e3, finished: false });
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
function c(e2) {
|
|
175
|
-
var t3;
|
|
176
|
-
function i3(e3) {
|
|
177
|
-
var t4 = e3.getResponseHeader("Content-Range");
|
|
178
|
-
return null === t4 ? -1 : parseInt(t4.substring(t4.lastIndexOf("/") + 1));
|
|
179
|
-
}
|
|
180
|
-
(e2 = e2 || {}).chunkSize || (e2.chunkSize = h.RemoteChunkSize), l.call(this, e2), this._nextChunk = n2 ? function() {
|
|
181
|
-
this._readChunk(), this._chunkLoaded();
|
|
182
|
-
} : function() {
|
|
183
|
-
this._readChunk();
|
|
184
|
-
}, this.stream = function(e3) {
|
|
185
|
-
this._input = e3, this._nextChunk();
|
|
186
|
-
}, this._readChunk = function() {
|
|
187
|
-
if (this._finished) this._chunkLoaded();
|
|
188
|
-
else {
|
|
189
|
-
if (t3 = new XMLHttpRequest(), this._config.withCredentials && (t3.withCredentials = this._config.withCredentials), n2 || (t3.onload = O(this._chunkLoaded, this), t3.onerror = O(this._chunkError, this)), t3.open(this._config.downloadRequestBody ? "POST" : "GET", this._input, !n2), this._config.downloadRequestHeaders) {
|
|
190
|
-
var e3 = this._config.downloadRequestHeaders;
|
|
191
|
-
for (var i4 in e3) t3.setRequestHeader(i4, e3[i4]);
|
|
192
|
-
}
|
|
193
|
-
if (this._config.chunkSize) {
|
|
194
|
-
var r3 = this._start + this._config.chunkSize - 1;
|
|
195
|
-
t3.setRequestHeader("Range", "bytes=" + this._start + "-" + r3);
|
|
196
|
-
}
|
|
197
|
-
try {
|
|
198
|
-
t3.send(this._config.downloadRequestBody);
|
|
199
|
-
} catch (e4) {
|
|
200
|
-
this._chunkError(e4.message);
|
|
201
|
-
}
|
|
202
|
-
n2 && 0 === t3.status && this._chunkError();
|
|
203
|
-
}
|
|
204
|
-
}, this._chunkLoaded = function() {
|
|
205
|
-
4 === t3.readyState && (t3.status < 200 || t3.status >= 400 ? this._chunkError() : (this._start += this._config.chunkSize ? this._config.chunkSize : t3.responseText.length, this._finished = !this._config.chunkSize || this._start >= i3(t3), this.parseChunk(t3.responseText)));
|
|
206
|
-
}, this._chunkError = function(e3) {
|
|
207
|
-
var i4 = t3.statusText || e3;
|
|
208
|
-
this._sendError(new Error(i4));
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
function p(e2) {
|
|
212
|
-
var t3, i3;
|
|
213
|
-
(e2 = e2 || {}).chunkSize || (e2.chunkSize = h.LocalChunkSize), l.call(this, e2);
|
|
214
|
-
var r3 = "undefined" != typeof FileReader;
|
|
215
|
-
this.stream = function(e3) {
|
|
216
|
-
this._input = e3, i3 = e3.slice || e3.webkitSlice || e3.mozSlice, r3 ? ((t3 = new FileReader()).onload = O(this._chunkLoaded, this), t3.onerror = O(this._chunkError, this)) : t3 = new FileReaderSync(), this._nextChunk();
|
|
217
|
-
}, this._nextChunk = function() {
|
|
218
|
-
this._finished || this._config.preview && !(this._rowCount < this._config.preview) || this._readChunk();
|
|
219
|
-
}, this._readChunk = function() {
|
|
220
|
-
var e3 = this._input;
|
|
221
|
-
if (this._config.chunkSize) {
|
|
222
|
-
var n3 = Math.min(this._start + this._config.chunkSize, this._input.size);
|
|
223
|
-
e3 = i3.call(e3, this._start, n3);
|
|
224
|
-
}
|
|
225
|
-
var s2 = t3.readAsText(e3, this._config.encoding);
|
|
226
|
-
r3 || this._chunkLoaded({ target: { result: s2 } });
|
|
227
|
-
}, this._chunkLoaded = function(e3) {
|
|
228
|
-
this._start += this._config.chunkSize, this._finished = !this._config.chunkSize || this._start >= this._input.size, this.parseChunk(e3.target.result);
|
|
229
|
-
}, this._chunkError = function() {
|
|
230
|
-
this._sendError(t3.error);
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
function _(e2) {
|
|
234
|
-
var t3;
|
|
235
|
-
e2 = e2 || {}, l.call(this, e2), this.stream = function(e3) {
|
|
236
|
-
return t3 = e3, this._nextChunk();
|
|
237
|
-
}, this._nextChunk = function() {
|
|
238
|
-
if (!this._finished) {
|
|
239
|
-
var e3, i3 = this._config.chunkSize;
|
|
240
|
-
return i3 ? (e3 = t3.substring(0, i3), t3 = t3.substring(i3)) : (e3 = t3, t3 = ""), this._finished = !t3, this.parseChunk(e3);
|
|
241
|
-
}
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
function g(e2) {
|
|
245
|
-
e2 = e2 || {}, l.call(this, e2);
|
|
246
|
-
var t3 = [], i3 = true, r3 = false;
|
|
247
|
-
this.pause = function() {
|
|
248
|
-
l.prototype.pause.apply(this, arguments), this._input.pause();
|
|
249
|
-
}, this.resume = function() {
|
|
250
|
-
l.prototype.resume.apply(this, arguments), this._input.resume();
|
|
251
|
-
}, this.stream = function(e3) {
|
|
252
|
-
this._input = e3, this._input.on("data", this._streamData), this._input.on("end", this._streamEnd), this._input.on("error", this._streamError);
|
|
253
|
-
}, this._checkIsFinished = function() {
|
|
254
|
-
r3 && 1 === t3.length && (this._finished = true);
|
|
255
|
-
}, this._nextChunk = function() {
|
|
256
|
-
this._checkIsFinished(), t3.length ? this.parseChunk(t3.shift()) : i3 = true;
|
|
257
|
-
}, this._streamData = O(function(e3) {
|
|
258
|
-
try {
|
|
259
|
-
t3.push("string" == typeof e3 ? e3 : e3.toString(this._config.encoding)), i3 && (i3 = false, this._checkIsFinished(), this.parseChunk(t3.shift()));
|
|
260
|
-
} catch (e4) {
|
|
261
|
-
this._streamError(e4);
|
|
262
|
-
}
|
|
263
|
-
}, this), this._streamError = O(function(e3) {
|
|
264
|
-
this._streamCleanUp(), this._sendError(e3);
|
|
265
|
-
}, this), this._streamEnd = O(function() {
|
|
266
|
-
this._streamCleanUp(), r3 = true, this._streamData("");
|
|
267
|
-
}, this), this._streamCleanUp = O(function() {
|
|
268
|
-
this._input.removeListener("data", this._streamData), this._input.removeListener("end", this._streamEnd), this._input.removeListener("error", this._streamError);
|
|
269
|
-
}, this);
|
|
270
|
-
}
|
|
271
|
-
function m(t3) {
|
|
272
|
-
var i3 = e.Duplex, r3 = S(t3), n3 = true, s2 = false, a2 = [], o2 = null;
|
|
273
|
-
this._onCsvData = function(e2) {
|
|
274
|
-
var t4 = e2.data;
|
|
275
|
-
o2.push(t4) || this._handle.paused() || this._handle.pause();
|
|
276
|
-
}, this._onCsvComplete = function() {
|
|
277
|
-
o2.push(null);
|
|
278
|
-
}, r3.step = O(this._onCsvData, this), r3.complete = O(this._onCsvComplete, this), l.call(this, r3), this._nextChunk = function() {
|
|
279
|
-
s2 && 1 === a2.length && (this._finished = true), a2.length ? a2.shift()() : n3 = true;
|
|
280
|
-
}, this._addToParseQueue = function(e2, t4) {
|
|
281
|
-
a2.push(O(function() {
|
|
282
|
-
if (this.parseChunk("string" == typeof e2 ? e2 : e2.toString(r3.encoding)), x(t4)) return t4();
|
|
283
|
-
}, this)), n3 && (n3 = false, this._nextChunk());
|
|
284
|
-
}, this._onRead = function() {
|
|
285
|
-
this._handle.paused() && this._handle.resume();
|
|
286
|
-
}, this._onWrite = function(e2, t4, i4) {
|
|
287
|
-
this._addToParseQueue(e2, i4);
|
|
288
|
-
}, this._onWriteComplete = function() {
|
|
289
|
-
s2 = true, this._addToParseQueue("");
|
|
290
|
-
}, this.getStream = function() {
|
|
291
|
-
return o2;
|
|
292
|
-
}, (o2 = new i3({ readableObjectMode: true, decodeStrings: false, read: O(this._onRead, this), write: O(this._onWrite, this) })).once("finish", O(this._onWriteComplete, this));
|
|
293
|
-
}
|
|
294
|
-
function y(e2) {
|
|
295
|
-
var t3, i3, r3, n3 = Math.pow(2, 53), s2 = -n3, a2 = /^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/, o2 = /^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/, u2 = this, f2 = 0, d2 = 0, l2 = false, c2 = false, p2 = [], _2 = { data: [], errors: [], meta: {} };
|
|
296
|
-
if (x(e2.step)) {
|
|
297
|
-
var g2 = e2.step;
|
|
298
|
-
e2.step = function(t4) {
|
|
299
|
-
if (_2 = t4, E2()) b2();
|
|
300
|
-
else {
|
|
301
|
-
if (b2(), 0 === _2.data.length) return;
|
|
302
|
-
f2 += t4.data.length, e2.preview && f2 > e2.preview ? i3.abort() : (_2.data = _2.data[0], g2(_2, u2));
|
|
303
|
-
}
|
|
304
|
-
};
|
|
305
|
-
}
|
|
306
|
-
function m2(t4) {
|
|
307
|
-
return "greedy" === e2.skipEmptyLines ? "" === t4.join("").trim() : 1 === t4.length && 0 === t4[0].length;
|
|
308
|
-
}
|
|
309
|
-
function y2(e3) {
|
|
310
|
-
if (a2.test(e3)) {
|
|
311
|
-
var t4 = parseFloat(e3);
|
|
312
|
-
if (t4 > s2 && t4 < n3) return true;
|
|
313
|
-
}
|
|
314
|
-
return false;
|
|
315
|
-
}
|
|
316
|
-
function b2() {
|
|
317
|
-
return _2 && r3 && (A("Delimiter", "UndetectableDelimiter", "Unable to auto-detect delimiting character; defaulted to '" + h.DefaultDelimiter + "'"), r3 = false), e2.skipEmptyLines && (_2.data = _2.data.filter(function(e3) {
|
|
318
|
-
return !m2(e3);
|
|
319
|
-
})), E2() && w2(), O2();
|
|
320
|
-
}
|
|
321
|
-
function E2() {
|
|
322
|
-
return e2.header && 0 === p2.length;
|
|
323
|
-
}
|
|
324
|
-
function w2() {
|
|
325
|
-
if (_2) if (Array.isArray(_2.data[0])) {
|
|
326
|
-
for (var t4 = 0; E2() && t4 < _2.data.length; t4++) _2.data[t4].forEach(i4);
|
|
327
|
-
_2.data.splice(0, 1);
|
|
328
|
-
} else _2.data.forEach(i4);
|
|
329
|
-
function i4(t5, i5) {
|
|
330
|
-
x(e2.transformHeader) && (t5 = e2.transformHeader(t5, i5)), p2.push(t5);
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
function C2(t4) {
|
|
334
|
-
return e2.dynamicTypingFunction && void 0 === e2.dynamicTyping[t4] && (e2.dynamicTyping[t4] = e2.dynamicTypingFunction(t4)), true === (e2.dynamicTyping[t4] || e2.dynamicTyping);
|
|
335
|
-
}
|
|
336
|
-
function R2(e3, t4) {
|
|
337
|
-
return C2(e3) ? "true" === t4 || "TRUE" === t4 || "false" !== t4 && "FALSE" !== t4 && (y2(t4) ? parseFloat(t4) : o2.test(t4) ? new Date(t4) : "" === t4 ? null : t4) : t4;
|
|
338
|
-
}
|
|
339
|
-
function O2() {
|
|
340
|
-
if (!_2 || !e2.header && !e2.dynamicTyping && !e2.transform) return _2;
|
|
341
|
-
function t4(t5, i5) {
|
|
342
|
-
var r4, n4 = e2.header ? {} : [];
|
|
343
|
-
for (r4 = 0; r4 < t5.length; r4++) {
|
|
344
|
-
var s3 = r4, a3 = t5[r4];
|
|
345
|
-
e2.header && (s3 = r4 >= p2.length ? "__parsed_extra" : p2[r4]), e2.transform && (a3 = e2.transform(a3, s3)), a3 = R2(s3, a3), "__parsed_extra" === s3 ? (n4[s3] = n4[s3] || [], n4[s3].push(a3)) : n4[s3] = a3;
|
|
346
|
-
}
|
|
347
|
-
return e2.header && (r4 > p2.length ? A("FieldMismatch", "TooManyFields", "Too many fields: expected " + p2.length + " fields but parsed " + r4, d2 + i5) : r4 < p2.length && A("FieldMismatch", "TooFewFields", "Too few fields: expected " + p2.length + " fields but parsed " + r4, d2 + i5)), n4;
|
|
348
|
-
}
|
|
349
|
-
var i4 = 1;
|
|
350
|
-
return !_2.data.length || Array.isArray(_2.data[0]) ? (_2.data = _2.data.map(t4), i4 = _2.data.length) : _2.data = t4(_2.data, 0), e2.header && _2.meta && (_2.meta.fields = p2), d2 += i4, _2;
|
|
351
|
-
}
|
|
352
|
-
function T(t4, i4, r4, n4, s3) {
|
|
353
|
-
var a3, o3, u3, f3;
|
|
354
|
-
s3 = s3 || [",", " ", "|", ";", h.RECORD_SEP, h.UNIT_SEP];
|
|
355
|
-
for (var d3 = 0; d3 < s3.length; d3++) {
|
|
356
|
-
var l3 = s3[d3], c3 = 0, p3 = 0, _3 = 0;
|
|
357
|
-
u3 = void 0;
|
|
358
|
-
for (var g3 = new k({ comments: n4, delimiter: l3, newline: i4, preview: 10 }).parse(t4), y3 = 0; y3 < g3.data.length; y3++) if (r4 && m2(g3.data[y3])) _3++;
|
|
359
|
-
else {
|
|
360
|
-
var v2 = g3.data[y3].length;
|
|
361
|
-
p3 += v2, void 0 !== u3 ? v2 > 0 && (c3 += Math.abs(v2 - u3), u3 = v2) : u3 = v2;
|
|
362
|
-
}
|
|
363
|
-
g3.data.length > 0 && (p3 /= g3.data.length - _3), (void 0 === o3 || c3 <= o3) && (void 0 === f3 || p3 > f3) && p3 > 1.99 && (o3 = c3, a3 = l3, f3 = p3);
|
|
364
|
-
}
|
|
365
|
-
return e2.delimiter = a3, { successful: !!a3, bestDelimiter: a3 };
|
|
366
|
-
}
|
|
367
|
-
function A(e3, t4, i4, r4) {
|
|
368
|
-
var n4 = { type: e3, code: t4, message: i4 };
|
|
369
|
-
void 0 !== r4 && (n4.row = r4), _2.errors.push(n4);
|
|
370
|
-
}
|
|
371
|
-
this.parse = function(n4, s3, a3) {
|
|
372
|
-
var o3 = e2.quoteChar || '"';
|
|
373
|
-
if (e2.newline || (e2.newline = this.guessLineEndings(n4, o3)), r3 = false, e2.delimiter) x(e2.delimiter) && (e2.delimiter = e2.delimiter(n4), _2.meta.delimiter = e2.delimiter);
|
|
374
|
-
else {
|
|
375
|
-
var u3 = T(n4, e2.newline, e2.skipEmptyLines, e2.comments, e2.delimitersToGuess);
|
|
376
|
-
u3.successful ? e2.delimiter = u3.bestDelimiter : (r3 = true, e2.delimiter = h.DefaultDelimiter), _2.meta.delimiter = e2.delimiter;
|
|
377
|
-
}
|
|
378
|
-
var f3 = S(e2);
|
|
379
|
-
return e2.preview && e2.header && f3.preview++, t3 = n4, i3 = new k(f3), _2 = i3.parse(t3, s3, a3), b2(), l2 ? { meta: { paused: true } } : _2 || { meta: { paused: false } };
|
|
380
|
-
}, this.paused = function() {
|
|
381
|
-
return l2;
|
|
382
|
-
}, this.pause = function() {
|
|
383
|
-
l2 = true, i3.abort(), t3 = x(e2.chunk) ? "" : t3.substring(i3.getCharIndex());
|
|
384
|
-
}, this.resume = function() {
|
|
385
|
-
u2.streamer._halted ? (l2 = false, u2.streamer.parseChunk(t3, true)) : setTimeout(u2.resume, 3);
|
|
386
|
-
}, this.aborted = function() {
|
|
387
|
-
return c2;
|
|
388
|
-
}, this.abort = function() {
|
|
389
|
-
c2 = true, i3.abort(), _2.meta.aborted = true, x(e2.complete) && e2.complete(_2), t3 = "";
|
|
390
|
-
}, this.guessLineEndings = function(e3, t4) {
|
|
391
|
-
e3 = e3.substring(0, 1048576);
|
|
392
|
-
var i4 = new RegExp(v(t4) + "([^]*?)" + v(t4), "gm"), r4 = (e3 = e3.replace(i4, "")).split("\r"), n4 = e3.split("\n"), s3 = n4.length > 1 && n4[0].length < r4[0].length;
|
|
393
|
-
if (1 === r4.length || s3) return "\n";
|
|
394
|
-
for (var a3 = 0, o3 = 0; o3 < r4.length; o3++) "\n" === r4[o3][0] && a3++;
|
|
395
|
-
return a3 >= r4.length / 2 ? "\r\n" : "\r";
|
|
396
|
-
};
|
|
397
|
-
}
|
|
398
|
-
function v(e2) {
|
|
399
|
-
return e2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
400
|
-
}
|
|
401
|
-
function k(e2) {
|
|
402
|
-
var t3, i3 = (e2 = e2 || {}).delimiter, r3 = e2.newline, n3 = e2.comments, s2 = e2.step, a2 = e2.preview, o2 = e2.fastMode, u2 = null, f2 = false, d2 = t3 = void 0 === e2.quoteChar || null === e2.quoteChar ? '"' : e2.quoteChar;
|
|
403
|
-
if (void 0 !== e2.escapeChar && (d2 = e2.escapeChar), ("string" != typeof i3 || h.BAD_DELIMITERS.indexOf(i3) > -1) && (i3 = ","), n3 === i3) throw new Error("Comment character same as delimiter");
|
|
404
|
-
true === n3 ? n3 = "#" : ("string" != typeof n3 || h.BAD_DELIMITERS.indexOf(n3) > -1) && (n3 = false), "\n" !== r3 && "\r" !== r3 && "\r\n" !== r3 && (r3 = "\n");
|
|
405
|
-
var l2 = 0, c2 = false;
|
|
406
|
-
this.parse = function(h2, p2, _2) {
|
|
407
|
-
if ("string" != typeof h2) throw new Error("Input must be a string");
|
|
408
|
-
var g2 = h2.length, m2 = i3.length, y2 = r3.length, k2 = n3.length, b2 = x(s2);
|
|
409
|
-
l2 = 0;
|
|
410
|
-
var E2 = [], w2 = [], C2 = [], R2 = 0;
|
|
411
|
-
if (!h2) return U();
|
|
412
|
-
if (o2 || false !== o2 && -1 === h2.indexOf(t3)) {
|
|
413
|
-
for (var S2 = h2.split(r3), O2 = 0; O2 < S2.length; O2++) {
|
|
414
|
-
if (C2 = S2[O2], l2 += C2.length, O2 !== S2.length - 1) l2 += r3.length;
|
|
415
|
-
else if (_2) return U();
|
|
416
|
-
if (!n3 || C2.substring(0, k2) !== n3) {
|
|
417
|
-
if (b2) {
|
|
418
|
-
if (E2 = [], j(C2.split(i3)), q(), c2) return U();
|
|
419
|
-
} else j(C2.split(i3));
|
|
420
|
-
if (a2 && O2 >= a2) return E2 = E2.slice(0, a2), U(true);
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
return U();
|
|
424
|
-
}
|
|
425
|
-
for (var T = h2.indexOf(i3, l2), A = h2.indexOf(r3, l2), D = new RegExp(v(d2) + v(t3), "g"), I = h2.indexOf(t3, l2); ; ) if (h2[l2] !== t3) if (n3 && 0 === C2.length && h2.substring(l2, l2 + k2) === n3) {
|
|
426
|
-
if (-1 === A) return U();
|
|
427
|
-
l2 = A + y2, A = h2.indexOf(r3, l2), T = h2.indexOf(i3, l2);
|
|
428
|
-
} else if (-1 !== T && (T < A || -1 === A)) C2.push(h2.substring(l2, T)), l2 = T + m2, T = h2.indexOf(i3, l2);
|
|
429
|
-
else {
|
|
430
|
-
if (-1 === A) break;
|
|
431
|
-
if (C2.push(h2.substring(l2, A)), M(A + y2), b2 && (q(), c2)) return U();
|
|
432
|
-
if (a2 && E2.length >= a2) return U(true);
|
|
433
|
-
}
|
|
434
|
-
else for (I = l2, l2++; ; ) {
|
|
435
|
-
if (-1 === (I = h2.indexOf(t3, I + 1))) return _2 || w2.push({ type: "Quotes", code: "MissingQuotes", message: "Quoted field unterminated", row: E2.length, index: l2 }), z();
|
|
436
|
-
if (I === g2 - 1) return z(h2.substring(l2, I).replace(D, t3));
|
|
437
|
-
if (t3 !== d2 || h2[I + 1] !== d2) {
|
|
438
|
-
if (t3 === d2 || 0 === I || h2[I - 1] !== d2) {
|
|
439
|
-
-1 !== T && T < I + 1 && (T = h2.indexOf(i3, I + 1)), -1 !== A && A < I + 1 && (A = h2.indexOf(r3, I + 1));
|
|
440
|
-
var L = P(-1 === A ? T : Math.min(T, A));
|
|
441
|
-
if (h2.substr(I + 1 + L, m2) === i3) {
|
|
442
|
-
C2.push(h2.substring(l2, I).replace(D, t3)), l2 = I + 1 + L + m2, h2[I + 1 + L + m2] !== t3 && (I = h2.indexOf(t3, l2)), T = h2.indexOf(i3, l2), A = h2.indexOf(r3, l2);
|
|
443
|
-
break;
|
|
444
|
-
}
|
|
445
|
-
var F = P(A);
|
|
446
|
-
if (h2.substring(I + 1 + F, I + 1 + F + y2) === r3) {
|
|
447
|
-
if (C2.push(h2.substring(l2, I).replace(D, t3)), M(I + 1 + F + y2), T = h2.indexOf(i3, l2), I = h2.indexOf(t3, l2), b2 && (q(), c2)) return U();
|
|
448
|
-
if (a2 && E2.length >= a2) return U(true);
|
|
449
|
-
break;
|
|
450
|
-
}
|
|
451
|
-
w2.push({ type: "Quotes", code: "InvalidQuotes", message: "Trailing quote on quoted field is malformed", row: E2.length, index: l2 }), I++;
|
|
452
|
-
}
|
|
453
|
-
} else I++;
|
|
454
|
-
}
|
|
455
|
-
return z();
|
|
456
|
-
function j(e3) {
|
|
457
|
-
E2.push(e3), R2 = l2;
|
|
458
|
-
}
|
|
459
|
-
function P(e3) {
|
|
460
|
-
var t4 = 0;
|
|
461
|
-
if (-1 !== e3) {
|
|
462
|
-
var i4 = h2.substring(I + 1, e3);
|
|
463
|
-
i4 && "" === i4.trim() && (t4 = i4.length);
|
|
464
|
-
}
|
|
465
|
-
return t4;
|
|
466
|
-
}
|
|
467
|
-
function z(e3) {
|
|
468
|
-
return _2 || (void 0 === e3 && (e3 = h2.substring(l2)), C2.push(e3), l2 = g2, j(C2), b2 && q()), U();
|
|
469
|
-
}
|
|
470
|
-
function M(e3) {
|
|
471
|
-
l2 = e3, j(C2), C2 = [], A = h2.indexOf(r3, l2);
|
|
472
|
-
}
|
|
473
|
-
function U(t4) {
|
|
474
|
-
if (e2.header && !p2 && E2.length && !f2) {
|
|
475
|
-
const t5 = E2[0], i4 = /* @__PURE__ */ Object.create(null), r4 = new Set(t5);
|
|
476
|
-
let n4 = false;
|
|
477
|
-
for (let s3 = 0; s3 < t5.length; s3++) {
|
|
478
|
-
let a3 = t5[s3];
|
|
479
|
-
if (x(e2.transformHeader) && (a3 = e2.transformHeader(a3, s3)), i4[a3]) {
|
|
480
|
-
let e3, o3 = i4[a3];
|
|
481
|
-
do {
|
|
482
|
-
e3 = `${a3}_${o3}`, o3++;
|
|
483
|
-
} while (r4.has(e3));
|
|
484
|
-
r4.add(e3), t5[s3] = e3, i4[a3]++, n4 = true, null === u2 && (u2 = {}), u2[e3] = a3;
|
|
485
|
-
} else i4[a3] = 1, t5[s3] = a3;
|
|
486
|
-
r4.add(a3);
|
|
487
|
-
}
|
|
488
|
-
n4 && console.warn("Duplicate headers found and renamed."), f2 = true;
|
|
489
|
-
}
|
|
490
|
-
return { data: E2, errors: w2, meta: { delimiter: i3, linebreak: r3, aborted: c2, truncated: !!t4, cursor: R2 + (p2 || 0), renamedHeaders: u2 } };
|
|
491
|
-
}
|
|
492
|
-
function q() {
|
|
493
|
-
s2(U()), E2 = [], w2 = [];
|
|
494
|
-
}
|
|
495
|
-
}, this.abort = function() {
|
|
496
|
-
c2 = true;
|
|
497
|
-
}, this.getCharIndex = function() {
|
|
498
|
-
return l2;
|
|
499
|
-
};
|
|
500
|
-
}
|
|
501
|
-
function b() {
|
|
502
|
-
if (!h.WORKERS_SUPPORTED) return false;
|
|
503
|
-
var e2 = r2(), t3 = new i2.Worker(e2);
|
|
504
|
-
return t3.onmessage = E, t3.id = o++, a[t3.id] = t3, t3;
|
|
505
|
-
}
|
|
506
|
-
function E(e2) {
|
|
507
|
-
var t3 = e2.data, i3 = a[t3.workerId], r3 = false;
|
|
508
|
-
if (t3.error) i3.userError(t3.error, t3.file);
|
|
509
|
-
else if (t3.results && t3.results.data) {
|
|
510
|
-
var n3 = { abort: function() {
|
|
511
|
-
r3 = true, w(t3.workerId, { data: [], errors: [], meta: { aborted: true } });
|
|
512
|
-
}, pause: C, resume: C };
|
|
513
|
-
if (x(i3.userStep)) {
|
|
514
|
-
for (var s2 = 0; s2 < t3.results.data.length && (i3.userStep({ data: t3.results.data[s2], errors: t3.results.errors, meta: t3.results.meta }, n3), !r3); s2++) ;
|
|
515
|
-
delete t3.results;
|
|
516
|
-
} else x(i3.userChunk) && (i3.userChunk(t3.results, n3, t3.file), delete t3.results);
|
|
517
|
-
}
|
|
518
|
-
t3.finished && !r3 && w(t3.workerId, t3.results);
|
|
519
|
-
}
|
|
520
|
-
function w(e2, t3) {
|
|
521
|
-
var i3 = a[e2];
|
|
522
|
-
x(i3.userComplete) && i3.userComplete(t3), i3.terminate(), delete a[e2];
|
|
523
|
-
}
|
|
524
|
-
function C() {
|
|
525
|
-
throw new Error("Not implemented.");
|
|
526
|
-
}
|
|
527
|
-
function R(e2) {
|
|
528
|
-
var t3 = e2.data;
|
|
529
|
-
if (void 0 === h.WORKER_ID && t3 && (h.WORKER_ID = t3.workerId), "string" == typeof t3.input) i2.postMessage({ workerId: h.WORKER_ID, results: h.parse(t3.input, t3.config), finished: true });
|
|
530
|
-
else if (i2.File && t3.input instanceof File || t3.input instanceof Object) {
|
|
531
|
-
var r3 = h.parse(t3.input, t3.config);
|
|
532
|
-
r3 && i2.postMessage({ workerId: h.WORKER_ID, results: r3, finished: true });
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
function S(e2) {
|
|
536
|
-
if ("object" != typeof e2 || null === e2) return e2;
|
|
537
|
-
var t3 = Array.isArray(e2) ? [] : {};
|
|
538
|
-
for (var i3 in e2) t3[i3] = S(e2[i3]);
|
|
539
|
-
return t3;
|
|
540
|
-
}
|
|
541
|
-
function O(e2, t3) {
|
|
542
|
-
return function() {
|
|
543
|
-
e2.apply(t3, arguments);
|
|
544
|
-
};
|
|
545
|
-
}
|
|
546
|
-
function x(e2) {
|
|
547
|
-
return "function" == typeof e2;
|
|
548
|
-
}
|
|
549
|
-
return s && (i2.onmessage = R), c.prototype = Object.create(l.prototype), c.prototype.constructor = c, p.prototype = Object.create(l.prototype), p.prototype.constructor = p, _.prototype = Object.create(_.prototype), _.prototype.constructor = _, g.prototype = Object.create(l.prototype), g.prototype.constructor = g, "undefined" == typeof PAPA_BROWSER_CONTEXT && (m.prototype = Object.create(l.prototype), m.prototype.constructor = m), h;
|
|
550
|
-
}()), r.exports)]);
|
|
551
|
-
export {
|
|
552
|
-
n as p
|
|
553
|
-
};
|