"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.parseCsv = parseCsv;
var _papaparse = _interopRequireDefault(require("papaparse"));
function parseCsv(content) {
  const result = _papaparse.default.parse(content, {
    skipEmptyLines: true
  });
  if (result.errors.length > 0) {
    return {
      message: result.errors[0].message ?? 'Failed to parse CSV content'
    };
  }
  const data = result.data;
  if (!data || data.length === 0) {
    return {
      headers: [],
      rows: []
    };
  }
  const headers = data[0];
  const rows = data.slice(1).filter(row => row.some(cell => String(cell).trim() !== ''));
  return {
    headers,
    rows
  };
}
//# sourceMappingURL=parseCsv.js.map