import L from "../../../@babel/runtime/helpers/esm/toConsumableArray.mjs";
import * as t from "react";
import R from "../../../@ant-design/icons/es/icons/CheckCircleFilled.mjs";
import z from "../../../@ant-design/icons/es/icons/CloseCircleFilled.mjs";
import W from "../../../@ant-design/icons/es/icons/ExclamationCircleFilled.mjs";
import U from "../../../@ant-design/icons/es/icons/InfoCircleFilled.mjs";
import T from "../../../classnames/index.mjs";
import { CONTAINER_MAX_OFFSET as X } from "../_util/hooks/useZIndex.mjs";
import { getTransitionName as $ } from "../_util/motion.mjs";
import { devUseWarning as j } from "../_util/warning.mjs";
import Z from "../config-provider/index.mjs";
import q from "../theme/useToken.mjs";
import w from "./components/ConfirmCancelBtn.mjs";
import _ from "./components/ConfirmOkBtn.mjs";
import { ModalContextProvider as G } from "./context.mjs";
import H from "./Modal.mjs";
import J from "./style/confirmCmp.mjs";
import K from "../locale/useLocale.mjs";
var Q = globalThis && globalThis.__rest || function(e, a) {
  var o = {};
  for (var n in e)
    Object.prototype.hasOwnProperty.call(e, n) && a.indexOf(n) < 0 && (o[n] = e[n]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var l = 0, n = Object.getOwnPropertySymbols(e); l < n.length; l++)
      a.indexOf(n[l]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[l]) && (o[n[l]] = e[n[l]]);
  return o;
};
function Y(e) {
  const {
    prefixCls: a,
    icon: o,
    okText: n,
    cancelText: l,
    confirmPrefixCls: i,
    type: C,
    okCancel: d,
    footer: s,
    // Legacy for static function usage
    locale: k
  } = e, g = Q(e, ["prefixCls", "icon", "okText", "cancelText", "confirmPrefixCls", "type", "okCancel", "footer", "locale"]);
  if (process.env.NODE_ENV !== "production") {
    const O = j("Modal");
    process.env.NODE_ENV !== "production" && O(!(typeof o == "string" && o.length > 2), "breaking", `\`icon\` is using ReactNode instead of string naming in v4. Please check \`${o}\` at https://ant.design/components/icon`);
  }
  let m = o;
  if (!o && o !== null)
    switch (C) {
      case "info":
        m = /* @__PURE__ */ t.createElement(U, null);
        break;
      case "success":
        m = /* @__PURE__ */ t.createElement(R, null);
        break;
      case "error":
        m = /* @__PURE__ */ t.createElement(z, null);
        break;
      default:
        m = /* @__PURE__ */ t.createElement(W, null);
    }
  const u = d ?? C === "confirm", x = e.autoFocusButton === null ? !1 : e.autoFocusButton || "ok", [v] = K("Modal"), r = k || v, E = n || (u ? r == null ? void 0 : r.okText : r == null ? void 0 : r.justOkText), N = l || (r == null ? void 0 : r.cancelText), f = Object.assign({
    autoFocusButton: x,
    cancelTextLocale: N,
    okTextLocale: E,
    mergedOkCancel: u
  }, g), p = t.useMemo(() => f, L(Object.values(f))), c = /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement(w, null), /* @__PURE__ */ t.createElement(_, null)), b = e.title !== void 0 && e.title !== null, y = `${i}-body`;
  return /* @__PURE__ */ t.createElement("div", {
    className: `${i}-body-wrapper`
  }, /* @__PURE__ */ t.createElement("div", {
    className: T(y, {
      [`${y}-has-title`]: b
    })
  }, m, /* @__PURE__ */ t.createElement("div", {
    className: `${i}-paragraph`
  }, b && /* @__PURE__ */ t.createElement("span", {
    className: `${i}-title`
  }, e.title), /* @__PURE__ */ t.createElement("div", {
    className: `${i}-content`
  }, e.content))), s === void 0 || typeof s == "function" ? /* @__PURE__ */ t.createElement(G, {
    value: p
  }, /* @__PURE__ */ t.createElement("div", {
    className: `${i}-btns`
  }, typeof s == "function" ? s(c, {
    OkBtn: _,
    CancelBtn: w
  }) : c)) : s, /* @__PURE__ */ t.createElement(J, {
    prefixCls: a
  }));
}
const F = (e) => {
  const {
    close: a,
    zIndex: o,
    afterClose: n,
    open: l,
    keyboard: i,
    centered: C,
    getContainer: d,
    maskStyle: s,
    direction: k,
    prefixCls: g,
    wrapClassName: m,
    rootPrefixCls: u,
    bodyStyle: x,
    closable: v = !1,
    closeIcon: r,
    modalRender: E,
    focusTriggerAfterClose: N,
    onConfirm: f,
    styles: p
  } = e;
  if (process.env.NODE_ENV !== "production") {
    const B = j("Modal");
    [["visible", "open"], ["bodyStyle", "styles.body"], ["maskStyle", "styles.mask"]].forEach((V) => {
      let [P, A] = V;
      B.deprecated(!(P in e), P, A);
    });
  }
  const c = `${g}-confirm`, b = e.width || 416, y = e.style || {}, O = e.mask === void 0 ? !0 : e.mask, D = e.maskClosable === void 0 ? !1 : e.maskClosable, M = T(c, `${c}-${e.type}`, {
    [`${c}-rtl`]: k === "rtl"
  }, e.className), [, h] = q(), S = t.useMemo(() => o !== void 0 ? o : h.zIndexPopupBase + X, [o, h]);
  return /* @__PURE__ */ t.createElement(H, {
    prefixCls: g,
    className: M,
    wrapClassName: T({
      [`${c}-centered`]: !!e.centered
    }, m),
    onCancel: () => {
      a == null || a({
        triggerCancel: !0
      }), f == null || f(!1);
    },
    open: l,
    title: "",
    footer: null,
    transitionName: $(u || "", "zoom", e.transitionName),
    maskTransitionName: $(u || "", "fade", e.maskTransitionName),
    mask: O,
    maskClosable: D,
    style: y,
    styles: Object.assign({
      body: x,
      mask: s
    }, p),
    width: b,
    zIndex: S,
    afterClose: n,
    keyboard: i,
    centered: C,
    getContainer: d,
    closable: v,
    closeIcon: r,
    modalRender: E,
    focusTriggerAfterClose: N
  }, /* @__PURE__ */ t.createElement(Y, Object.assign({}, e, {
    confirmPrefixCls: c
  })));
}, I = (e) => {
  const {
    rootPrefixCls: a,
    iconPrefixCls: o,
    direction: n,
    theme: l
  } = e;
  return /* @__PURE__ */ t.createElement(Z, {
    prefixCls: a,
    iconPrefixCls: o,
    direction: n,
    theme: l
  }, /* @__PURE__ */ t.createElement(F, Object.assign({}, e)));
};
process.env.NODE_ENV !== "production" && (F.displayName = "ConfirmDialog", I.displayName = "ConfirmDialogWrapper");
const ye = I;
export {
  Y as ConfirmContent,
  ye as default
};
