"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.processListText = void 0;

// this is not exported at the root because it's only used by a single input type
const processListText = text => {
  const cleanedRows = [];
  const saveableRows = [];
  const rows = text.split('\n');

  for (const row of rows) {
    const cleaned = row.replace(/^[\s0-9-_.]*/g, '');
    cleanedRows.push(cleaned);
    const trimmed = cleaned.trim();

    if (trimmed) {
      saveableRows.push(trimmed);
    }
  }

  return {
    saveableRows,
    cleanedText: cleanedRows.join('\n'),
    saveableText: saveableRows.join('\n'),
    totalRowCount: cleanedRows.length,
    saveableItemCount: saveableRows.length
  };
};

exports.processListText = processListText;