import React, { useMemo } from "react";
import { locales } from "@pisell/utils";
import { Alert } from "antd";
import "../../index.less";
//#region src/components/productCard/components/Warning/index.tsx
const Warning = ({ errorMessage, osWarnTips }) => {
	/**
	* @title: 错误提示列表
	* @description: 错误提示列表
	* @param {*} useMemo
	* @return {*}
	* @Author: WangHan
	* @Date: 2025-07-23 10:10
	*/
	const errorLists = useMemo(() => {
		if (errorMessage) {
			if (Array.isArray(errorMessage)) return errorMessage;
			if (typeof errorMessage === "string") return [errorMessage];
		}
		if ((osWarnTips === null || osWarnTips === void 0 ? void 0 : osWarnTips.length) > 0) return osWarnTips.map((item) => locales.getText(item));
		return [];
	}, [errorMessage, osWarnTips]);
	if ((errorLists === null || errorLists === void 0 ? void 0 : errorLists.length) === 0) return /* @__PURE__ */ React.createElement(React.Fragment, null);
	return /* @__PURE__ */ React.createElement(React.Fragment, null, errorLists.map((item, index) => /* @__PURE__ */ React.createElement(Alert, {
		key: index,
		message: item,
		type: "warning",
		showIcon: true,
		className: "pisell-lowcode-product-card-error"
	})));
};
//#endregion
export { Warning as default };
