import { flow } from "fp-ts-esm/function";
import { replace } from "fp-ts-esm/string";
import { serialize } from "parse5";
import { traverseRoot } from "./../../../../converters/html/fromHtml/core/ast-traversal.js";
import { toAst } from "./../../../../converters/html/fromHtml/core/parse5-utils.js";
import { rootTextToP } from "../core/preprocess.js";
const preprocess = flow(
  replace(/\s*\n\s*/g, ""),
  // remove spaces between lines (they count as elements)
  replace('"<', "<"),
  // remove first `"` if exists
  replace('>"', ">"),
  // remove last `"` if exists
  replace(/""/g, '"'),
  // convert `""string""` to `"string"`
  replace(/<\s*br\s*\/?>/g, "\n"),
  // replace br tags with new lines
  toAst,
  traverseRoot(rootTextToP),
  serialize
);
export {
  preprocess
};
//# sourceMappingURL=preprocess.js.map
