Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
require("../../chunk-BN4qSVkS.cjs");
const require_utils_toReactNodes_stringToNodes = require("./stringToNodes.cjs");
const require_components_typography_renderTypography = require("../../components/typography/renderTypography.cjs");
const require_router = require("../../router.cjs");
const require_utils_toReactNodes_nodes = require("./nodes.cjs");
const require_components_Icon_Icon = require("../../components/Icon/Icon.cjs");
const require_components_CurrencyAmount = require("../../components/CurrencyAmount.cjs");
const require_utils_NextLink = require("../NextLink.cjs");
const require_components_ClipboardTextField = require("../../components/ClipboardTextField.cjs");
let react = require("react");
let _emotion_react_jsx_runtime = require("@emotion/react/jsx-runtime");
let _lightsparkdev_core = require("@lightsparkdev/core");
//#region src/utils/toReactNodes/toReactNodes.tsx
function toReactNodes(toReactNodesArg) {
	return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(react.Fragment, { children: (0, _lightsparkdev_core.ensureArray)(toReactNodesArg).map((node, i) => {
		if (!node) return null;
		else if (typeof node === "string" || require_utils_toReactNodes_nodes.isTextNode(node)) {
			const text = typeof node === "string" ? node : node.text;
			let content = text;
			if (require_utils_toReactNodes_nodes.isTextNode(node) && node.typography) {
				const { type: typographyType, ...typographyProps } = node.typography;
				content = require_components_typography_renderTypography.renderTypography(typographyType, {
					...typographyProps,
					children: text
				});
			} else content = require_utils_toReactNodes_stringToNodes.stringToNodes(text);
			return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(react.Fragment, { children: content }, `text-${i}-${text.substr(0, 20)}`);
		} else if (require_utils_toReactNodes_nodes.isLinkNode(node)) return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_router.Link, { ...node.link }, `link-${i}-${node.link.id}`);
		else if (require_utils_toReactNodes_nodes.isNextLinkNode(node)) return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_utils_NextLink.NextLink, { ...node.nextLink }, `next-link-${i}-${node.nextLink.id}`);
		else if (require_utils_toReactNodes_nodes.isIconNode(node)) return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_components_Icon_Icon.Icon, {
			...node.icon,
			width: node.icon.width || 12
		}, `icon-${i}-${node.icon.id}`);
		else if (require_utils_toReactNodes_nodes.isCurrencyAmountNode(node)) return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_components_CurrencyAmount.CurrencyAmount, { ...node.currencyAmount }, `currency-amount-${i}-${node.currencyAmount.id}`);
		else if (require_utils_toReactNodes_nodes.isClipboardTextFieldNode(node)) return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_components_ClipboardTextField.ClipboardTextField, { ...node.clipboardTextField }, `clipboard-text-field-${i}-${node.clipboardTextField.id}`);
		return null;
	}) });
}
//#endregion
exports.toReactNodes = toReactNodes;
