import { j as i } from "../../node_modules/react/jsx-runtime.mjs";
import { useRef as k, useState as C } from "react";
import { create as M, useModal as T, antdModalV5 as O } from "../../node_modules/@ebay/nice-modal-react/lib/esm/index.mjs";
import "./index.less.mjs";
import { useTranslation as B } from "../../node_modules/react-i18next/dist/es/useTranslation.mjs";
import R from "../../node_modules/antd/es/modal/index.mjs";
import S from "../../node_modules/@ant-design/icons/es/icons/CloseOutlined.mjs";
function f(n) {
  return !!(n && n.then);
}
const b = (n) => {
  const { onOk: o, onCancel: a, title: u = "提示", modalText: d, ...x } = n, { t: c } = B(), r = k(!1), m = T(), [h, l] = C(!1), p = (e) => {
    f(e) && (l(!0), e.then((...t) => {
      l(!1, !0), s(t), r.current = !1;
    }, (t) => (l(!1, !0), r.current = !1, Promise.reject(t))));
  }, j = (e) => {
    if (r.current)
      return;
    if (r.current = !0, !o) {
      s(e);
      return;
    }
    let t;
    if (t = o == null ? void 0 : o(e), !f(t)) {
      r.current = !1, s(e);
      return;
    }
    p(t);
  }, s = (e) => {
    a == null || a(e), m.hide();
  };
  return i.jsx(R, { ...O(m), className: "bitzConfirmModalBlock", title: u, width: 400, closeIcon: i.jsx(S, {}), onOk: j, confirmLoading: h, onCancel: s, okText: c("System_Deter", "确定"), cancelText: c("System_Cancel", "取消"), ...x, children: i.jsx("div", { className: "textBox", children: d || "您确定要删除吗？" }) });
}, v = M(b);
export {
  v as default
};
