import * as r from "react";
import { forwardRef as ue, useContext as z, useImperativeHandle as de } from "react";
import fe from "../../../../@ant-design/icons/es/icons/CalendarOutlined.mjs";
import Ce from "../../../../@ant-design/icons/es/icons/ClockCircleOutlined.mjs";
import ge from "../../../../@ant-design/icons/es/icons/CloseCircleFilled.mjs";
import $ from "../../../../classnames/index.mjs";
import Pe from "../../../../rc-picker/es/Picker.mjs";
import "../../../../rc-util/es/hooks/useLayoutEffect.mjs";
import "../../../../rc-util/es/warning.mjs";
import "../../../../rc-util/es/raf.mjs";
import "../../../../rc-picker/es/panels/DatetimePanel/index.mjs";
import "../../../../rc-util/node_modules/react-is/index.mjs";
import "../../../../@rc-component/trigger/es/index.mjs";
import { getStatusClassNames as be, getMergedStatus as ke } from "../../_util/statusUtils.mjs";
import { devUseWarning as ve } from "../../_util/warning.mjs";
import "../../config-provider/index.mjs";
import xe from "../../config-provider/DisabledContext.mjs";
import Oe from "../../config-provider/hooks/useSize.mjs";
import { FormItemInputContext as Ne } from "../../form/context.mjs";
import { useCompactItemContext as Se } from "../../space/Compact.mjs";
import we from "../locale/en_US.mjs";
import ye from "../style/index.mjs";
import { getTimeProps as _, getPlaceholder as Ie, transPlacement2DropdownAlign as je, mergeAllowClear as he } from "../util.mjs";
import Ee from "./Components.mjs";
import { useZIndex as De } from "../../_util/hooks/useZIndex.mjs";
import ze from "../../config-provider/hooks/useCSSVarCls.mjs";
import { ConfigContext as $e } from "../../config-provider/context.mjs";
import _e from "../../locale/useLocale.mjs";
var Te = globalThis && globalThis.__rest || function(s, n) {
  var l = {};
  for (var e in s)
    Object.prototype.hasOwnProperty.call(s, e) && n.indexOf(e) < 0 && (l[e] = s[e]);
  if (s != null && typeof Object.getOwnPropertySymbols == "function")
    for (var a = 0, e = Object.getOwnPropertySymbols(s); a < e.length; a++)
      n.indexOf(e[a]) < 0 && Object.prototype.propertyIsEnumerable.call(s, e[a]) && (l[e[a]] = s[e[a]]);
  return l;
};
function lt(s) {
  function n(m, p) {
    const R = p === "TimePicker" ? "timePicker" : "datePicker", x = /* @__PURE__ */ ue((i, A) => {
      var f;
      const {
        prefixCls: M,
        getPopupContainer: W,
        style: q,
        className: L,
        rootClassName: O,
        size: C,
        bordered: Q = !0,
        placement: U,
        placeholder: Y,
        popupClassName: G,
        dropdownClassName: N,
        disabled: g,
        status: H,
        clearIcon: Z,
        allowClear: B
      } = i, J = Te(i, ["prefixCls", "getPopupContainer", "style", "className", "rootClassName", "size", "bordered", "placement", "placeholder", "popupClassName", "dropdownClassName", "disabled", "status", "clearIcon", "allowClear"]), {
        getPrefixCls: S,
        direction: P,
        getPopupContainer: K,
        // Consume different styles according to different names
        [R]: c
      } = z($e), o = S("picker", M), {
        compactSize: X,
        compactItemClassnames: ee
      } = Se(o, P), b = r.useRef(null), {
        format: w,
        showTime: y
      } = i, k = ze(o), [te, I, j] = ye(o, k);
      de(A, () => ({
        focus: () => {
          var t;
          return (t = b.current) === null || t === void 0 ? void 0 : t.focus();
        },
        blur: () => {
          var t;
          return (t = b.current) === null || t === void 0 ? void 0 : t.blur();
        }
      }));
      const re = {
        showToday: !0
      };
      let d = {};
      m && (d.picker = m);
      const u = m || i.picker;
      d = Object.assign(Object.assign(Object.assign({}, d), y ? _(Object.assign({
        format: w,
        picker: u
      }, y)) : {}), u === "time" ? _(Object.assign(Object.assign({
        format: w
      }, i), {
        picker: u
      })) : {});
      const oe = S();
      if (process.env.NODE_ENV !== "production") {
        const t = ve(p || "DatePicker");
        process.env.NODE_ENV !== "production" && t(m !== "quarter", "deprecated", `DatePicker.${p} is legacy usage. Please use DatePicker[picker='${m}'] directly.`), t.deprecated(!N, "dropdownClassName", "popupClassName");
      }
      const h = Oe((t) => {
        var v;
        return (v = C ?? X) !== null && v !== void 0 ? v : t;
      }), se = r.useContext(xe), ne = g ?? se, ae = z(Ne), {
        hasFeedback: E,
        status: ie,
        feedbackIcon: ce
      } = ae, le = /* @__PURE__ */ r.createElement(r.Fragment, null, u === "time" ? /* @__PURE__ */ r.createElement(Ce, null) : /* @__PURE__ */ r.createElement(fe, null), E && ce), [me] = _e("DatePicker", we), D = Object.assign(Object.assign({}, me), i.locale), [pe] = De("DatePicker", (f = i.popupStyle) === null || f === void 0 ? void 0 : f.zIndex);
      return te(/* @__PURE__ */ r.createElement(Pe, Object.assign({
        ref: b,
        placeholder: Ie(D, u, Y),
        suffixIcon: le,
        dropdownAlign: je(P, U),
        prevIcon: /* @__PURE__ */ r.createElement("span", {
          className: `${o}-prev-icon`
        }),
        nextIcon: /* @__PURE__ */ r.createElement("span", {
          className: `${o}-next-icon`
        }),
        superPrevIcon: /* @__PURE__ */ r.createElement("span", {
          className: `${o}-super-prev-icon`
        }),
        superNextIcon: /* @__PURE__ */ r.createElement("span", {
          className: `${o}-super-next-icon`
        }),
        transitionName: `${oe}-slide-up`
      }, re, J, d, {
        locale: D.lang,
        className: $({
          [`${o}-${h}`]: h,
          [`${o}-borderless`]: !Q
        }, be(o, ke(ie, H), E), I, ee, c == null ? void 0 : c.className, L, j, k, O),
        style: Object.assign(Object.assign({}, c == null ? void 0 : c.style), q),
        prefixCls: o,
        getPopupContainer: W || K,
        generateConfig: s,
        components: Ee,
        direction: P,
        disabled: ne,
        dropdownClassName: $(I, j, k, O, G || N),
        popupStyle: Object.assign(Object.assign({}, i.popupStyle), {
          zIndex: pe
        }),
        allowClear: he(B, Z, /* @__PURE__ */ r.createElement(ge, null))
      })));
    });
    return p && (x.displayName = p), x;
  }
  const l = n(), e = n("week", "WeekPicker"), a = n("month", "MonthPicker"), T = n("year", "YearPicker"), V = n("time", "TimePicker"), F = n("quarter", "QuarterPicker");
  return {
    DatePicker: l,
    WeekPicker: e,
    MonthPicker: a,
    YearPicker: T,
    TimePicker: V,
    QuarterPicker: F
  };
}
export {
  lt as default
};
