import { h } from 'vue';
import '../components/index.mjs';
import './index.mjs';
import { message } from 'ant-design-vue';
import { createNamespace } from './create-namespace.mjs';
import { LlIcon } from '../components/icon/index.mjs';

"use strict";
const messageInfo = ["success", "info", "warning", "error"];
const bem = createNamespace("message");
const llMessage = {};
messageInfo.forEach((messageItem) => {
  if (Object.keys(message).includes(messageItem)) {
    llMessage[messageItem] = (config) => {
      if (config.isShowClose) {
        config.duration = 0;
      }
      const handleCloseClick = () => {
        destroyCallback && destroyCallback();
        config.onClose && config.onClose();
      };
      const destroyCallback = message[messageItem]({
        ...config,
        class: `${bem.b()} ${bem.e(messageItem)}  ${config.class ? config.class : ""}`,
        content: h(
          "div",
          { class: `${bem.e("container")} ${bem.e(config.className)}` },
          [
            // 右上角关闭图标
            config.isShowClose ? h(
              "div",
              {
                class: `${bem.e("close")}`,
                onClick: handleCloseClick
              },
              h(LlIcon, {
                iconName: config?.iconProp?.iconName ? "" : "icon-close2",
                ...config.iconProp
              })
            ) : null,
            h("div", { class: `${bem.e("content")}` }, [
              // 头部标题区
              h("div", { class: `${bem.e("title")}` }, config.title),
              // 提示文本区
              h("div", { class: `${bem.e("des")}` }, config.text)
            ]),
            // code显示区
            h("div", { class: `${bem.e("code")}` }, config.code)
          ]
        )
      });
    };
  }
});

export { llMessage };
//# sourceMappingURL=message.mjs.map
