const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
let react = require("react");

//#region ../react-intlayer/dist/esm/reactElement/renderReactElement.mjs
const renderReactElement = (element) => {
	if (typeof element === "string") return element;
	const convertChildrenAsArray = (element$1) => {
		if (element$1?.props && typeof element$1.props.children === "object") {
			const childrenResult = [];
			const { children } = element$1.props;
			Object.keys(children ?? {}).forEach((key) => {
				const childElement = renderReactElement(children?.[key]);
				if (typeof childElement === "object" && childElement !== null && "type" in childElement) childrenResult.push((0, react.createElement)(childElement.type, {
					...childElement.props,
					key
				}, ...Array.isArray(childElement.props?.children) ? childElement.props.children : [childElement.props?.children]));
				else childrenResult.push(childElement);
			});
			return {
				...element$1,
				props: {
					...element$1.props,
					children: childrenResult
				}
			};
		}
		return {
			...element$1,
			props: {
				...element$1.props,
				children: element$1.props?.children ?? []
			}
		};
	};
	const { type, props } = convertChildrenAsArray(element);
	return (0, react.createElement)(type ?? "span", props, ...props.children);
};

//#endregion
exports.renderReactElement = renderReactElement;
//# sourceMappingURL=renderReactElement.cjs.map