import { c as e, g as t } from "./alasql-f59e855e.js";
var i = { exports: {} };
const r = t(i.exports = function e2() {
  var t2, i2 = "undefined" != typeof self ? self : "undefined" != typeof window ? window : void 0 !== i2 ? i2 : {}, r2 = !i2.document && !!i2.postMessage, n = i2.IS_PAPA_WORKER || false, s = {}, a = 0, o = {};
  function h(e3) {
    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: {} }, (function(e4) {
      var t3 = k(e4);
      t3.chunkSize = parseInt(t3.chunkSize), e4.step || e4.chunk || (t3.chunkSize = null), this._handle = new c(t3), (this._handle.streamer = this)._config = t3;
    }).call(this, e3), this.parseChunk = function(e4, t3) {
      var r3 = parseInt(this._config.skipFirstNLines) || 0;
      if (this.isFirstChunk && 0 < r3) {
        let t4 = this._config.newline;
        t4 || (s2 = this._config.quoteChar || '"', t4 = this._handle.guessLineEndings(e4, s2)), e4 = [...e4.split(t4).slice(r3)].join(t4);
      }
      this.isFirstChunk && b(this._config.beforeFirstChunk) && void 0 !== (s2 = this._config.beforeFirstChunk(e4)) && (e4 = s2), this.isFirstChunk = false, this._halted = false, r3 = this._partialLine + e4;
      var s2 = (this._partialLine = "", this._handle.parse(r3, this._baseIndex, !this._finished));
      if (!this._handle.paused() && !this._handle.aborted()) {
        if (e4 = s2.meta.cursor, this._finished || (this._partialLine = r3.substring(e4 - this._baseIndex), this._baseIndex = e4), s2 && s2.data && (this._rowCount += s2.data.length), r3 = this._finished || this._config.preview && this._rowCount >= this._config.preview, n)
          i2.postMessage({ results: s2, workerId: o.WORKER_ID, finished: r3 });
        else if (b(this._config.chunk) && !t3) {
          if (this._config.chunk(s2, this._handle), this._handle.paused() || this._handle.aborted())
            return void (this._halted = true);
          this._completeResults = s2 = void 0;
        }
        return this._config.step || this._config.chunk || (this._completeResults.data = this._completeResults.data.concat(s2.data), this._completeResults.errors = this._completeResults.errors.concat(s2.errors), this._completeResults.meta = s2.meta), this._completed || !r3 || !b(this._config.complete) || s2 && s2.meta.aborted || (this._config.complete(this._completeResults, this._input), this._completed = true), r3 || s2 && s2.meta.paused || this._nextChunk(), s2;
      }
      this._halted = true;
    }, this._sendError = function(e4) {
      b(this._config.error) ? this._config.error(e4) : n && this._config.error && i2.postMessage({ workerId: o.WORKER_ID, error: e4, finished: false });
    };
  }
  function u(e3) {
    var t3;
    (e3 = e3 || {}).chunkSize || (e3.chunkSize = o.RemoteChunkSize), h.call(this, e3), this._nextChunk = r2 ? function() {
      this._readChunk(), this._chunkLoaded();
    } : function() {
      this._readChunk();
    }, this.stream = function(e4) {
      this._input = e4, this._nextChunk();
    }, this._readChunk = function() {
      if (this._finished)
        this._chunkLoaded();
      else {
        if (t3 = new XMLHttpRequest(), this._config.withCredentials && (t3.withCredentials = this._config.withCredentials), r2 || (t3.onload = v(this._chunkLoaded, this), t3.onerror = v(this._chunkError, this)), t3.open(this._config.downloadRequestBody ? "POST" : "GET", this._input, !r2), this._config.downloadRequestHeaders) {
          var e4, i3 = this._config.downloadRequestHeaders;
          for (e4 in i3)
            t3.setRequestHeader(e4, i3[e4]);
        }
        var n2;
        this._config.chunkSize && (n2 = this._start + this._config.chunkSize - 1, t3.setRequestHeader("Range", "bytes=" + this._start + "-" + n2));
        try {
          t3.send(this._config.downloadRequestBody);
        } catch (e5) {
          this._chunkError(e5.message);
        }
        r2 && 0 === t3.status && this._chunkError();
      }
    }, this._chunkLoaded = function() {
      4 === t3.readyState && (t3.status < 200 || 400 <= t3.status ? this._chunkError() : (this._start += this._config.chunkSize || t3.responseText.length, this._finished = !this._config.chunkSize || this._start >= ((e4) => null !== (e4 = e4.getResponseHeader("Content-Range")) ? parseInt(e4.substring(e4.lastIndexOf("/") + 1)) : -1)(t3), this.parseChunk(t3.responseText)));
    }, this._chunkError = function(e4) {
      e4 = t3.statusText || e4, this._sendError(new Error(e4));
    };
  }
  function d(e3) {
    (e3 = e3 || {}).chunkSize || (e3.chunkSize = o.LocalChunkSize), h.call(this, e3);
    var t3, i3, r3 = "undefined" != typeof FileReader;
    this.stream = function(e4) {
      this._input = e4, i3 = e4.slice || e4.webkitSlice || e4.mozSlice, r3 ? ((t3 = new FileReader()).onload = v(this._chunkLoaded, this), t3.onerror = v(this._chunkError, this)) : t3 = new FileReaderSync(), this._nextChunk();
    }, this._nextChunk = function() {
      this._finished || this._config.preview && !(this._rowCount < this._config.preview) || this._readChunk();
    }, this._readChunk = function() {
      var e4 = this._input, n2 = (this._config.chunkSize && (n2 = Math.min(this._start + this._config.chunkSize, this._input.size), e4 = i3.call(e4, this._start, n2)), t3.readAsText(e4, this._config.encoding));
      r3 || this._chunkLoaded({ target: { result: n2 } });
    }, this._chunkLoaded = function(e4) {
      this._start += this._config.chunkSize, this._finished = !this._config.chunkSize || this._start >= this._input.size, this.parseChunk(e4.target.result);
    }, this._chunkError = function() {
      this._sendError(t3.error);
    };
  }
  function f(e3) {
    var t3;
    h.call(this, e3 = e3 || {}), this.stream = function(e4) {
      return t3 = e4, this._nextChunk();
    }, this._nextChunk = function() {
      var e4, i3;
      if (!this._finished)
        return e4 = this._config.chunkSize, t3 = e4 ? (i3 = t3.substring(0, e4), t3.substring(e4)) : (i3 = t3, ""), this._finished = !t3, this.parseChunk(i3);
    };
  }
  function l(e3) {
    h.call(this, e3 = e3 || {});
    var t3 = [], i3 = true, r3 = false;
    this.pause = function() {
      h.prototype.pause.apply(this, arguments), this._input.pause();
    }, this.resume = function() {
      h.prototype.resume.apply(this, arguments), this._input.resume();
    }, this.stream = function(e4) {
      this._input = e4, this._input.on("data", this._streamData), this._input.on("end", this._streamEnd), this._input.on("error", this._streamError);
    }, this._checkIsFinished = function() {
      r3 && 1 === t3.length && (this._finished = true);
    }, this._nextChunk = function() {
      this._checkIsFinished(), t3.length ? this.parseChunk(t3.shift()) : i3 = true;
    }, this._streamData = v(function(e4) {
      try {
        t3.push("string" == typeof e4 ? e4 : e4.toString(this._config.encoding)), i3 && (i3 = false, this._checkIsFinished(), this.parseChunk(t3.shift()));
      } catch (e5) {
        this._streamError(e5);
      }
    }, this), this._streamError = v(function(e4) {
      this._streamCleanUp(), this._sendError(e4);
    }, this), this._streamEnd = v(function() {
      this._streamCleanUp(), r3 = true, this._streamData("");
    }, this), this._streamCleanUp = v(function() {
      this._input.removeListener("data", this._streamData), this._input.removeListener("end", this._streamEnd), this._input.removeListener("error", this._streamError);
    }, this);
  }
  function c(e3) {
    var t3, i3, r3, n2, s2 = Math.pow(2, 53), a2 = -s2, h2 = /^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/, u2 = /^((\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)))$/, d2 = this, f2 = 0, l2 = 0, c2 = false, _2 = false, m2 = [], y2 = { data: [], errors: [], meta: {} };
    function v2(t4) {
      return "greedy" === e3.skipEmptyLines ? "" === t4.join("").trim() : 1 === t4.length && 0 === t4[0].length;
    }
    function w() {
      if (y2 && r3 && (C("Delimiter", "UndetectableDelimiter", "Unable to auto-detect delimiting character; defaulted to '" + o.DefaultDelimiter + "'"), r3 = false), e3.skipEmptyLines && (y2.data = y2.data.filter(function(e4) {
        return !v2(e4);
      })), E()) {
        let d3 = function(t5, i5) {
          b(e3.transformHeader) && (t5 = e3.transformHeader(t5, i5)), m2.push(t5);
        };
        if (y2)
          if (Array.isArray(y2.data[0])) {
            for (var t4 = 0; E() && t4 < y2.data.length; t4++)
              y2.data[t4].forEach(d3);
            y2.data.splice(0, 1);
          } else
            y2.data.forEach(d3);
      }
      function i4(t5, i5) {
        for (var r4 = e3.header ? {} : [], n4 = 0; n4 < t5.length; n4++) {
          var o2 = n4, d3 = t5[n4];
          d3 = ((t6, i6) => ((t7) => (e3.dynamicTypingFunction && void 0 === e3.dynamicTyping[t7] && (e3.dynamicTyping[t7] = e3.dynamicTypingFunction(t7)), true === (e3.dynamicTyping[t7] || e3.dynamicTyping)))(t6) ? "true" === i6 || "TRUE" === i6 || "false" !== i6 && "FALSE" !== i6 && (((e4) => {
            if (h2.test(e4) && (e4 = parseFloat(e4), a2 < e4 && e4 < s2))
              return 1;
          })(i6) ? parseFloat(i6) : u2.test(i6) ? new Date(i6) : "" === i6 ? null : i6) : i6)(o2 = e3.header ? n4 >= m2.length ? "__parsed_extra" : m2[n4] : o2, d3 = e3.transform ? e3.transform(d3, o2) : d3), "__parsed_extra" === o2 ? (r4[o2] = r4[o2] || [], r4[o2].push(d3)) : r4[o2] = d3;
        }
        return e3.header && (n4 > m2.length ? C("FieldMismatch", "TooManyFields", "Too many fields: expected " + m2.length + " fields but parsed " + n4, l2 + i5) : n4 < m2.length && C("FieldMismatch", "TooFewFields", "Too few fields: expected " + m2.length + " fields but parsed " + n4, l2 + i5)), r4;
      }
      var n3;
      y2 && (e3.header || e3.dynamicTyping || e3.transform) && (n3 = 1, !y2.data.length || Array.isArray(y2.data[0]) ? (y2.data = y2.data.map(i4), n3 = y2.data.length) : y2.data = i4(y2.data, 0), e3.header && y2.meta && (y2.meta.fields = m2), l2 += n3);
    }
    function E() {
      return e3.header && 0 === m2.length;
    }
    function C(e4, t4, i4, r4) {
      e4 = { type: e4, code: t4, message: i4 }, void 0 !== r4 && (e4.row = r4), y2.errors.push(e4);
    }
    b(e3.step) && (n2 = e3.step, e3.step = function(t4) {
      y2 = t4, E() ? w() : (w(), 0 !== y2.data.length && (f2 += t4.data.length, e3.preview && f2 > e3.preview ? i3.abort() : (y2.data = y2.data[0], n2(y2, d2))));
    }), this.parse = function(n3, s3, a3) {
      var h3 = e3.quoteChar || '"';
      return e3.newline || (e3.newline = this.guessLineEndings(n3, h3)), r3 = false, e3.delimiter ? b(e3.delimiter) && (e3.delimiter = e3.delimiter(n3), y2.meta.delimiter = e3.delimiter) : ((h3 = ((t4, i4, r4, n4, s4) => {
        var a4, h4, u3, d3;
        s4 = s4 || [",", "	", "|", ";", o.RECORD_SEP, o.UNIT_SEP];
        for (var f3 = 0; f3 < s4.length; f3++) {
          for (var l3, c3 = s4[f3], p2 = 0, _3 = 0, m3 = 0, y3 = (u3 = void 0, new g({ comments: n4, delimiter: c3, newline: i4, preview: 10 }).parse(t4)), k2 = 0; k2 < y3.data.length; k2++)
            r4 && v2(y3.data[k2]) ? m3++ : (_3 += l3 = y3.data[k2].length, void 0 === u3 ? u3 = l3 : 0 < l3 && (p2 += Math.abs(l3 - u3), u3 = l3));
          0 < y3.data.length && (_3 /= y3.data.length - m3), (void 0 === h4 || p2 <= h4) && (void 0 === d3 || d3 < _3) && 1.99 < _3 && (h4 = p2, a4 = c3, d3 = _3);
        }
        return { successful: !!(e3.delimiter = a4), bestDelimiter: a4 };
      })(n3, e3.newline, e3.skipEmptyLines, e3.comments, e3.delimitersToGuess)).successful ? e3.delimiter = h3.bestDelimiter : (r3 = true, e3.delimiter = o.DefaultDelimiter), y2.meta.delimiter = e3.delimiter), h3 = k(e3), e3.preview && e3.header && h3.preview++, t3 = n3, i3 = new g(h3), y2 = i3.parse(t3, s3, a3), w(), c2 ? { meta: { paused: true } } : y2 || { meta: { paused: false } };
    }, this.paused = function() {
      return c2;
    }, this.pause = function() {
      c2 = true, i3.abort(), t3 = b(e3.chunk) ? "" : t3.substring(i3.getCharIndex());
    }, this.resume = function() {
      d2.streamer._halted ? (c2 = false, d2.streamer.parseChunk(t3, true)) : setTimeout(d2.resume, 3);
    }, this.aborted = function() {
      return _2;
    }, this.abort = function() {
      _2 = true, i3.abort(), y2.meta.aborted = true, b(e3.complete) && e3.complete(y2), t3 = "";
    }, this.guessLineEndings = function(e4, t4) {
      e4 = e4.substring(0, 1048576), t4 = new RegExp(p(t4) + "([^]*?)" + p(t4), "gm");
      var i4 = (e4 = e4.replace(t4, "")).split("\r");
      if (e4 = 1 < (t4 = e4.split("\n")).length && t4[0].length < i4[0].length, 1 === i4.length || e4)
        return "\n";
      for (var r4 = 0, n3 = 0; n3 < i4.length; n3++)
        "\n" === i4[n3][0] && r4++;
      return r4 >= i4.length / 2 ? "\r\n" : "\r";
    };
  }
  function p(e3) {
    return e3.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
  }
  function g(e3) {
    var t3 = (e3 = e3 || {}).delimiter, i3 = e3.newline, r3 = e3.comments, n2 = e3.step, s2 = e3.preview, a2 = e3.fastMode, h2 = null, u2 = false, d2 = null == e3.quoteChar ? '"' : e3.quoteChar, f2 = d2;
    if (void 0 !== e3.escapeChar && (f2 = e3.escapeChar), ("string" != typeof t3 || -1 < o.BAD_DELIMITERS.indexOf(t3)) && (t3 = ","), r3 === t3)
      throw new Error("Comment character same as delimiter");
    true === r3 ? r3 = "#" : ("string" != typeof r3 || -1 < o.BAD_DELIMITERS.indexOf(r3)) && (r3 = false), "\n" !== i3 && "\r" !== i3 && "\r\n" !== i3 && (i3 = "\n");
    var l2 = 0, c2 = false;
    this.parse = function(o2, g2, _2) {
      if ("string" != typeof o2)
        throw new Error("Input must be a string");
      var m2 = o2.length, y2 = t3.length, k2 = i3.length, v2 = r3.length, w = b(n2), E = [], C = [], R = [], S = l2 = 0;
      if (!o2)
        return q();
      if (a2 || false !== a2 && -1 === o2.indexOf(d2)) {
        for (var O = o2.split(i3), x = 0; x < O.length; x++) {
          if (R = O[x], l2 += R.length, x !== O.length - 1)
            l2 += i3.length;
          else if (_2)
            return q();
          if (!r3 || R.substring(0, v2) !== r3) {
            if (w) {
              if (E = [], F(R.split(t3)), P(), c2)
                return q();
            } else
              F(R.split(t3));
            if (s2 && s2 <= x)
              return E = E.slice(0, s2), q(true);
          }
        }
        return q();
      }
      for (var I = o2.indexOf(t3, l2), A = o2.indexOf(i3, l2), T = new RegExp(p(f2) + p(d2), "g"), L = o2.indexOf(d2, l2); ; )
        if (o2[l2] === d2)
          for (L = l2, l2++; ; ) {
            if (-1 === (L = o2.indexOf(d2, L + 1)))
              return _2 || C.push({ type: "Quotes", code: "MissingQuotes", message: "Quoted field unterminated", row: E.length, index: l2 }), z();
            if (L === m2 - 1)
              return z(o2.substring(l2, L).replace(T, d2));
            if (d2 === f2 && o2[L + 1] === f2)
              L++;
            else if (d2 === f2 || 0 === L || o2[L - 1] !== f2) {
              -1 !== I && I < L + 1 && (I = o2.indexOf(t3, L + 1));
              var D = j(-1 === (A = -1 !== A && A < L + 1 ? o2.indexOf(i3, L + 1) : A) ? I : Math.min(I, A));
              if (o2.substr(L + 1 + D, y2) === t3) {
                R.push(o2.substring(l2, L).replace(T, d2)), o2[l2 = L + 1 + D + y2] !== d2 && (L = o2.indexOf(d2, l2)), I = o2.indexOf(t3, l2), A = o2.indexOf(i3, l2);
                break;
              }
              if (D = j(A), o2.substring(L + 1 + D, L + 1 + D + k2) === i3) {
                if (R.push(o2.substring(l2, L).replace(T, d2)), M(L + 1 + D + k2), I = o2.indexOf(t3, l2), L = o2.indexOf(d2, l2), w && (P(), c2))
                  return q();
                if (s2 && E.length >= s2)
                  return q(true);
                break;
              }
              C.push({ type: "Quotes", code: "InvalidQuotes", message: "Trailing quote on quoted field is malformed", row: E.length, index: l2 }), L++;
            }
          }
        else if (r3 && 0 === R.length && o2.substring(l2, l2 + v2) === r3) {
          if (-1 === A)
            return q();
          l2 = A + k2, A = o2.indexOf(i3, l2), I = o2.indexOf(t3, l2);
        } else if (-1 !== I && (I < A || -1 === A))
          R.push(o2.substring(l2, I)), l2 = I + y2, I = o2.indexOf(t3, l2);
        else {
          if (-1 === A)
            break;
          if (R.push(o2.substring(l2, A)), M(A + k2), w && (P(), c2))
            return q();
          if (s2 && E.length >= s2)
            return q(true);
        }
      return z();
      function F(e4) {
        E.push(e4), S = l2;
      }
      function j(e4) {
        var t4 = 0;
        return -1 !== e4 && (e4 = o2.substring(L + 1, e4)) && "" === e4.trim() ? e4.length : t4;
      }
      function z(e4) {
        return _2 || (void 0 === e4 && (e4 = o2.substring(l2)), R.push(e4), l2 = m2, F(R), w && P()), q();
      }
      function M(e4) {
        l2 = e4, F(R), R = [], A = o2.indexOf(i3, l2);
      }
      function q(r4) {
        if (e3.header && !g2 && E.length && !u2) {
          var n3 = E[0], s3 = /* @__PURE__ */ Object.create(null), a3 = new Set(n3);
          for (let t4 = 0; t4 < n3.length; t4++) {
            let i4 = n3[t4];
            if (s3[i4 = b(e3.transformHeader) ? e3.transformHeader(i4, t4) : i4]) {
              let e4, r5 = s3[i4];
              for (; e4 = i4 + "_" + r5, r5++, a3.has(e4); )
                ;
              a3.add(e4), n3[t4] = e4, s3[i4]++, (h2 = null === h2 ? {} : h2)[e4] = i4;
            } else
              s3[i4] = 1, n3[t4] = i4;
            a3.add(i4);
          }
          u2 = true;
        }
        return { data: E, errors: C, meta: { delimiter: t3, linebreak: i3, aborted: c2, truncated: !!r4, cursor: S + (g2 || 0), renamedHeaders: h2 } };
      }
      function P() {
        n2(q()), E = [], C = [];
      }
    }, this.abort = function() {
      c2 = true;
    }, this.getCharIndex = function() {
      return l2;
    };
  }
  function _(e3) {
    var t3 = e3.data, i3 = s[t3.workerId], r3 = false;
    if (t3.error)
      i3.userError(t3.error, t3.file);
    else if (t3.results && t3.results.data) {
      var n2 = { abort: function() {
        r3 = true, m(t3.workerId, { data: [], errors: [], meta: { aborted: true } });
      }, pause: y, resume: y };
      if (b(i3.userStep)) {
        for (var a2 = 0; a2 < t3.results.data.length && (i3.userStep({ data: t3.results.data[a2], errors: t3.results.errors, meta: t3.results.meta }, n2), !r3); a2++)
          ;
        delete t3.results;
      } else
        b(i3.userChunk) && (i3.userChunk(t3.results, n2, t3.file), delete t3.results);
    }
    t3.finished && !r3 && m(t3.workerId, t3.results);
  }
  function m(e3, t3) {
    var i3 = s[e3];
    b(i3.userComplete) && i3.userComplete(t3), i3.terminate(), delete s[e3];
  }
  function y() {
    throw new Error("Not implemented.");
  }
  function k(e3) {
    if ("object" != typeof e3 || null === e3)
      return e3;
    var t3, i3 = Array.isArray(e3) ? [] : {};
    for (t3 in e3)
      i3[t3] = k(e3[t3]);
    return i3;
  }
  function v(e3, t3) {
    return function() {
      e3.apply(t3, arguments);
    };
  }
  function b(e3) {
    return "function" == typeof e3;
  }
  return o.parse = function(t3, r3) {
    var n2 = (r3 = r3 || {}).dynamicTyping || false;
    if (b(n2) && (r3.dynamicTypingFunction = n2, n2 = {}), r3.dynamicTyping = n2, r3.transform = !!b(r3.transform) && r3.transform, !r3.worker || !o.WORKERS_SUPPORTED)
      return n2 = null, "string" == typeof t3 ? (t3 = ((e3) => 65279 !== e3.charCodeAt(0) ? e3 : e3.slice(1))(t3), n2 = new (r3.download ? u : f)(r3)) : true === t3.readable && b(t3.read) && b(t3.on) ? n2 = new l(r3) : (i2.File && t3 instanceof File || t3 instanceof Object) && (n2 = new d(r3)), n2.stream(t3);
    (n2 = (() => {
      var t4;
      return !!o.WORKERS_SUPPORTED && (t4 = (() => {
        var t5 = i2.URL || i2.webkitURL || null, r4 = e2.toString();
        return o.BLOB_URL || (o.BLOB_URL = t5.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; ", "(", r4, ")();"], { type: "text/javascript" })));
      })(), (t4 = new i2.Worker(t4)).onmessage = _, t4.id = a++, s[t4.id] = t4);
    })()).userStep = r3.step, n2.userChunk = r3.chunk, n2.userComplete = r3.complete, n2.userError = r3.error, r3.step = b(r3.step), r3.chunk = b(r3.chunk), r3.complete = b(r3.complete), r3.error = b(r3.error), delete r3.worker, n2.postMessage({ input: t3, config: r3, workerId: n2.id });
  }, o.unparse = function(e3, t3) {
    var i3 = false, r3 = true, n2 = ",", s2 = "\r\n", a2 = '"', h2 = a2 + a2, u2 = false, d2 = null, f2 = false, l2 = ((() => {
      if ("object" == typeof t3) {
        if ("string" != typeof t3.delimiter || o.BAD_DELIMITERS.filter(function(e4) {
          return -1 !== t3.delimiter.indexOf(e4);
        }).length || (n2 = 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)) {
          if (0 === t3.columns.length)
            throw new Error("Option columns is empty");
          d2 = t3.columns;
        }
        void 0 !== t3.escapeChar && (h2 = t3.escapeChar + a2), t3.escapeFormulae instanceof RegExp ? f2 = t3.escapeFormulae : "boolean" == typeof t3.escapeFormulae && t3.escapeFormulae && (f2 = /^[=+\-@\t\r].*$/);
      }
    })(), new RegExp(p(a2), "g"));
    if ("string" == typeof e3 && (e3 = JSON.parse(e3)), Array.isArray(e3)) {
      if (!e3.length || Array.isArray(e3[0]))
        return c2(null, e3, u2);
      if ("object" == typeof e3[0])
        return c2(d2 || Object.keys(e3[0]), e3, u2);
    } else if ("object" == typeof e3)
      return "string" == typeof e3.data && (e3.data = JSON.parse(e3.data)), Array.isArray(e3.data) && (e3.fields || (e3.fields = e3.meta && e3.meta.fields || d2), e3.fields || (e3.fields = Array.isArray(e3.data[0]) ? e3.fields : "object" == typeof e3.data[0] ? Object.keys(e3.data[0]) : []), Array.isArray(e3.data[0]) || "object" == typeof e3.data[0] || (e3.data = [e3.data])), c2(e3.fields || [], e3.data || [], u2);
    throw new Error("Unable to serialize unrecognized input");
    function c2(e4, t4, i4) {
      var a3 = "", o2 = ("string" == typeof e4 && (e4 = JSON.parse(e4)), "string" == typeof t4 && (t4 = JSON.parse(t4)), Array.isArray(e4) && 0 < e4.length), h3 = !Array.isArray(t4[0]);
      if (o2 && r3) {
        for (var u3 = 0; u3 < e4.length; u3++)
          0 < u3 && (a3 += n2), a3 += g2(e4[u3], u3);
        0 < t4.length && (a3 += s2);
      }
      for (var d3 = 0; d3 < t4.length; d3++) {
        var f3 = (o2 ? e4 : t4[d3]).length, l3 = false, c3 = o2 ? 0 === Object.keys(t4[d3]).length : 0 === t4[d3].length;
        if (i4 && !o2 && (l3 = "greedy" === i4 ? "" === t4[d3].join("").trim() : 1 === t4[d3].length && 0 === t4[d3][0].length), "greedy" === i4 && o2) {
          for (var p2 = [], _2 = 0; _2 < f3; _2++) {
            var m2 = h3 ? e4[_2] : _2;
            p2.push(t4[d3][m2]);
          }
          l3 = "" === p2.join("").trim();
        }
        if (!l3) {
          for (var y2 = 0; y2 < f3; y2++) {
            0 < y2 && !c3 && (a3 += n2);
            var k2 = o2 && h3 ? e4[y2] : y2;
            a3 += g2(t4[d3][k2], y2);
          }
          d3 < t4.length - 1 && (!i4 || 0 < f3 && !c3) && (a3 += s2);
        }
      }
      return a3;
    }
    function g2(e4, t4) {
      var r4, s3;
      return null == e4 ? "" : e4.constructor === Date ? JSON.stringify(e4).slice(1, 25) : (s3 = false, f2 && "string" == typeof e4 && f2.test(e4) && (e4 = "'" + e4, s3 = true), r4 = e4.toString().replace(l2, h2), (s3 = s3 || true === i3 || "function" == typeof i3 && i3(e4, t4) || Array.isArray(i3) && i3[t4] || ((e5, t5) => {
        for (var i4 = 0; i4 < t5.length; i4++)
          if (-1 < e5.indexOf(t5[i4]))
            return true;
        return false;
      })(r4, o.BAD_DELIMITERS) || -1 < r4.indexOf(n2) || " " === r4.charAt(0) || " " === r4.charAt(r4.length - 1)) ? a2 + r4 + a2 : r4);
    }
  }, o.RECORD_SEP = String.fromCharCode(30), o.UNIT_SEP = String.fromCharCode(31), o.BYTE_ORDER_MARK = "\uFEFF", o.BAD_DELIMITERS = ["\r", "\n", '"', o.BYTE_ORDER_MARK], o.WORKERS_SUPPORTED = !r2 && !!i2.Worker, o.NODE_STREAM_INPUT = 1, o.LocalChunkSize = 10485760, o.RemoteChunkSize = 5242880, o.DefaultDelimiter = ",", o.Parser = g, o.ParserHandle = c, o.NetworkStreamer = u, o.FileStreamer = d, o.StringStreamer = f, o.ReadableStreamStreamer = l, i2.jQuery && ((t2 = i2.jQuery).fn.parse = function(e3) {
    var r3 = e3.config || {}, n2 = [];
    return this.each(function(e4) {
      if ("INPUT" !== t2(this).prop("tagName").toUpperCase() || "file" !== t2(this).attr("type").toLowerCase() || !i2.FileReader || !this.files || 0 === this.files.length)
        return true;
      for (var s3 = 0; s3 < this.files.length; s3++)
        n2.push({ file: this.files[s3], inputElem: this, instanceConfig: t2.extend({}, r3) });
    }), s2(), this;
    function s2() {
      if (0 === n2.length)
        b(e3.complete) && e3.complete();
      else {
        var i3, r4, s3, h2, u2 = n2[0];
        if (b(e3.before)) {
          var d2 = e3.before(u2.file, u2.inputElem);
          if ("object" == typeof d2) {
            if ("abort" === d2.action)
              return i3 = "AbortError", r4 = u2.file, s3 = u2.inputElem, h2 = d2.reason, void (b(e3.error) && e3.error({ name: i3 }, r4, s3, h2));
            if ("skip" === d2.action)
              return void a2();
            "object" == typeof d2.config && (u2.instanceConfig = t2.extend(u2.instanceConfig, d2.config));
          } else if ("skip" === d2)
            return void a2();
        }
        var f2 = u2.instanceConfig.complete;
        u2.instanceConfig.complete = function(e4) {
          b(f2) && f2(e4, u2.file, u2.inputElem), a2();
        }, o.parse(u2.file, u2.instanceConfig);
      }
    }
    function a2() {
      n2.splice(0, 1), s2();
    }
  }), n && (i2.onmessage = function(e3) {
    e3 = e3.data, void 0 === o.WORKER_ID && e3 && (o.WORKER_ID = e3.workerId), "string" == typeof e3.input ? i2.postMessage({ workerId: o.WORKER_ID, results: o.parse(e3.input, e3.config), finished: true }) : (i2.File && e3.input instanceof File || e3.input instanceof Object) && (e3 = o.parse(e3.input, e3.config)) && i2.postMessage({ workerId: o.WORKER_ID, results: e3, finished: true });
  }), (u.prototype = Object.create(h.prototype)).constructor = u, (d.prototype = Object.create(h.prototype)).constructor = d, (f.prototype = Object.create(f.prototype)).constructor = f, (l.prototype = Object.create(h.prototype)).constructor = l, o;
}());
export {
  r as P
};
