import React, { useMemo } from 'react';
import { locales } from '@pisell/utils';
import { Alert } from 'antd';
import "../../index.less";
var Warning = function Warning(_ref) {
  var errorMessage = _ref.errorMessage,
    osWarnTips = _ref.osWarnTips;
  /**
   * @title: 错误提示列表
   * @description: 错误提示列表
   * @param {*} useMemo
   * @return {*}
   * @Author: WangHan
   * @Date: 2025-07-23 10:10
   */
  var errorLists = useMemo(function () {
    if (errorMessage) {
      // 如果errorMessage是数组，则返回数组
      if (Array.isArray(errorMessage)) {
        return errorMessage;
      }

      // 如果errorMessage是字符串，则返回字符串
      if (typeof errorMessage === 'string') {
        return [errorMessage];
      }
    }
    if ((osWarnTips === null || osWarnTips === void 0 ? void 0 : osWarnTips.length) > 0) {
      return osWarnTips.map(function (item) {
        return 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(function (item, index) {
    return /*#__PURE__*/React.createElement(Alert, {
      key: index,
      message: item,
      type: "warning",
      showIcon: true,
      className: "pisell-lowcode-product-card-error"
    });
  }));
};
export default Warning;