import {
  Link
} from "./chunk-OGSDZTHM.js";

// src/utils/toReactNodes.tsx
import { Fragment } from "react";
import { jsx, jsxs } from "@emotion/react/jsx-runtime";
var ToReactNodesTypes = {
  Link: "link"
};
function toReactNodes(toReactNodesArg) {
  const toReactNodesArray = Array.isArray(toReactNodesArg) ? toReactNodesArg : [toReactNodesArg];
  const reactNodes = toReactNodesArray.map((node, i) => {
    if (typeof node === "string") {
      return /* @__PURE__ */ jsx(Fragment, { children: node.split("\n").map((str, j, strArr) => /* @__PURE__ */ jsxs(Fragment, { children: [
        str,
        j < strArr.length - 1 && /* @__PURE__ */ jsx("br", {})
      ] }, `str-${i}-break-${j}`)) }, `str-${i}`);
    } else if (node.type === ToReactNodesTypes.Link) {
      return /* @__PURE__ */ jsx(Link, { to: node.to, children: node.text }, `link-${i}`);
    }
    return null;
  });
  return /* @__PURE__ */ jsx(Fragment, { children: reactNodes });
}

export {
  ToReactNodesTypes,
  toReactNodes
};
