import { css } from "@emotion/react";
import { memo } from "react";
import { jsx } from "@emotion/react/jsx-runtime";
import ReactDOM from "react-dom";
import iconInfo from "../../assets/icon/blackInfo.svg.js";
import iconCheck from "../../assets/icon/greenCheck.svg.js";
import iconWarning from "../../assets/icon/redError.svg.js";
import { BottomTabBar } from "../BottomTabBar/index.js";
var MessageTypes = /* @__PURE__ */ ((MessageTypes2) => {
  MessageTypes2["Success"] = "Success";
  MessageTypes2["Info"] = "Info";
  MessageTypes2["Error"] = "Error";
  return MessageTypes2;
})(MessageTypes || {});
const MessageBottomComp = memo(function MessageBottomComp2({
  content,
  actions,
  type
}) {
  return /* @__PURE__ */ jsx(
    BottomTabBar,
    {
      defaultVisible: true,
      modalId: "MessageTip",
      icon: /* @__PURE__ */ jsx(
        "img",
        {
          src: type === "Error" ? iconWarning : type === "Info" ? iconInfo : iconCheck,
          css: css`
            width: 36px;
            height: 36px;
            margin-left: 3px;
          `
        }
      ),
      tips: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
        "div",
        {
          css: css`
              font-family: Poppins-Bold;
              font-weight: 700;
              font-size: 1rem;
              line-height: 1.5rem;
              color: ${type === "Error" ? "#CB2424" : type === "Info" ? " #000000" : "#48A92F"};
            `,
          children: content
        }
      ) }),
      actions
    }
  );
});
const message = (props) => {
  const holder = document.createElement("div");
  holder.setAttribute("id", "dataverseMessageBox");
  document.body.append(holder);
  const destroy = () => {
    holder.remove();
  };
  setTimeout(() => {
    destroy();
  }, props.duration || 3e3);
  holder.addEventListener("click", () => {
    holder.remove();
  });
  ReactDOM.render(/* @__PURE__ */ jsx(MessageBottomComp, { ...props }), holder);
};
export {
  MessageTypes,
  message
};
//# sourceMappingURL=index.js.map
