import { createApp } from 'vue';
import './second-confirmation.vue.mjs';
import _sfc_main from './second-confirmation.vue2.mjs';

"use strict";
const useSecondConfirmation = (options) => {
  const { title, message, confirmText, cancelText, icon = null } = options;
  return new Promise((resolve, reject) => {
    const confirmInstance = createApp(_sfc_main, {
      open: true,
      title: title || "\u6E29\u99A8\u63D0\u793A",
      message: message || "\u4F60\u6709\u672A\u4FDD\u5B58\u7684\u66F4\u6539\uFF0C\u786E\u5B9A\u5173\u95ED\uFF1F",
      confirmText,
      cancelText,
      icon,
      onConfirm: () => {
        resolve(true);
        unmount();
      },
      onCancel: () => {
        reject(new Error());
        unmount();
      }
    });
    const unmount = () => {
      confirmInstance.unmount();
      document.body.removeChild(parentNode);
    };
    const parentNode = document.createElement("div");
    document.body.appendChild(parentNode);
    confirmInstance.mount(parentNode);
  });
};

export { useSecondConfirmation };
//# sourceMappingURL=use-second-confirmation.mjs.map
