import * as n from "react";
import E from "../../../../@ant-design/icons/es/icons/CheckCircleFilled.mjs";
import N from "../../../../@ant-design/icons/es/icons/CloseCircleFilled.mjs";
import $ from "../../../../@ant-design/icons/es/icons/ExclamationCircleFilled.mjs";
import P from "../../../../@ant-design/icons/es/icons/LoadingOutlined.mjs";
import w from "../../../../classnames/index.mjs";
import { FormContext as M, FormItemInputContext as I } from "../context.mjs";
import { getStatus as y } from "../util.mjs";
const H = {
  success: E,
  warning: $,
  error: N,
  validating: P
};
function z(F) {
  let {
    children: k,
    errors: a,
    warnings: s,
    hasFeedback: t,
    validateStatus: b,
    prefixCls: v,
    meta: C,
    noStyle: i
  } = F;
  const l = `${v}-item`, {
    feedbackIcons: x
  } = n.useContext(M), e = y(a, s, C, null, !!t, b), {
    isFormItemInput: m,
    status: u,
    hasFeedback: S,
    feedbackIcon: g
  } = n.useContext(I), h = n.useMemo(() => {
    var r;
    let d;
    if (t) {
      const c = t !== !0 && t.icons || x, f = e && ((r = c == null ? void 0 : c({
        status: e,
        errors: a,
        warnings: s
      })) === null || r === void 0 ? void 0 : r[e]), p = e && H[e];
      d = f !== !1 && p ? /* @__PURE__ */ n.createElement("span", {
        className: w(`${l}-feedback-icon`, `${l}-feedback-icon-${e}`)
      }, f || /* @__PURE__ */ n.createElement(p, null)) : null;
    }
    const o = {
      status: e || "",
      errors: a,
      warnings: s,
      hasFeedback: !!t,
      feedbackIcon: d,
      isFormItemInput: !0
    };
    return i && (o.status = (e ?? u) || "", o.isFormItemInput = m, o.hasFeedback = !!(t ?? S), o.feedbackIcon = t !== void 0 ? o.feedbackIcon : g), o;
  }, [e, t, i, m, u]);
  return /* @__PURE__ */ n.createElement(I.Provider, {
    value: h
  }, k);
}
export {
  z as default
};
