import { flow } from "fp-ts-esm/function";
import { parser } from "../core/parser.js";
import {
  aToAnchor,
  aToLink,
  backgroundStyleToTextHighlight,
  colorStyleToTextColor,
  hToHeading,
  lToList,
  pToParagraph,
  spanToMention,
  spanToSpoiler,
  strongEmUStrikeToDecoration,
  textToText
} from "../core/rules.js";
import { preprocess } from "./preprocess.js";
const noEmptyLineText = [
  (node) => textToText[0](node) && node.value !== "\n",
  textToText[1]
];
const fromRichTextHtml = (s, interceptor = ({ result }) => result) => flow(
  () => preprocess(s),
  parser(
    [
      noEmptyLineText,
      pToParagraph,
      lToList,
      hToHeading,
      aToLink,
      aToAnchor,
      strongEmUStrikeToDecoration,
      colorStyleToTextColor,
      spanToMention,
      spanToSpoiler,
      backgroundStyleToTextHighlight
    ],
    interceptor
  )
)();
export {
  fromRichTextHtml
};
//# sourceMappingURL=parser.js.map
