import * as s from "react";
import { forwardRef as R } from "react";
import D from "../../../@ant-design/icons/es/icons/CloseCircleFilled.mjs";
import C from "../../../classnames/index.mjs";
import V from "../../../rc-textarea/es/TextArea.mjs";
import "../../../rc-resize-observer/es/index.mjs";
import "../../../rc-util/es/hooks/useLayoutEffect.mjs";
import "../../../rc-util/es/raf.mjs";
import { getStatusClassNames as S, getMergedStatus as k } from "../_util/statusUtils.mjs";
import "../config-provider/index.mjs";
import H from "../config-provider/DisabledContext.mjs";
import M from "../config-provider/hooks/useSize.mjs";
import { FormItemInputContext as W } from "../form/context.mjs";
import { triggerFocus as q } from "./Input.mjs";
import B from "./style/index.mjs";
import G from "../config-provider/hooks/useCSSVarCls.mjs";
import { ConfigContext as J } from "../config-provider/context.mjs";
var K = globalThis && globalThis.__rest || function(r, n) {
  var o = {};
  for (var t in r)
    Object.prototype.hasOwnProperty.call(r, t) && n.indexOf(t) < 0 && (o[t] = r[t]);
  if (r != null && typeof Object.getOwnPropertySymbols == "function")
    for (var a = 0, t = Object.getOwnPropertySymbols(r); a < t.length; a++)
      n.indexOf(t[a]) < 0 && Object.prototype.propertyIsEnumerable.call(r, t[a]) && (o[t[a]] = r[t[a]]);
  return o;
};
const L = /* @__PURE__ */ R((r, n) => {
  var o;
  const {
    prefixCls: t,
    bordered: a = !0,
    size: $,
    disabled: u,
    status: O,
    allowClear: l,
    classNames: m,
    rootClassName: y,
    className: N
  } = r, h = K(r, ["prefixCls", "bordered", "size", "disabled", "status", "allowClear", "classNames", "rootClassName", "className"]), {
    getPrefixCls: z,
    direction: _
  } = s.useContext(J), c = M($), j = s.useContext(H), A = u ?? j, {
    status: I,
    hasFeedback: T,
    feedbackIcon: P
  } = s.useContext(W), v = k(I, O), f = s.useRef(null);
  s.useImperativeHandle(n, () => {
    var p;
    return {
      resizableTextArea: (p = f.current) === null || p === void 0 ? void 0 : p.resizableTextArea,
      focus: (i) => {
        var x, b;
        q((b = (x = f.current) === null || x === void 0 ? void 0 : x.resizableTextArea) === null || b === void 0 ? void 0 : b.textArea, i);
      },
      blur: () => {
        var i;
        return (i = f.current) === null || i === void 0 ? void 0 : i.blur();
      }
    };
  });
  const e = z("input", t);
  let d;
  typeof l == "object" && (l != null && l.clearIcon) ? d = l : l && (d = {
    clearIcon: /* @__PURE__ */ s.createElement(D, null)
  });
  const g = G(e), [E, w, F] = B(e, g);
  return E(/* @__PURE__ */ s.createElement(V, Object.assign({}, h, {
    disabled: A,
    allowClear: d,
    className: C(F, g, N, y),
    classes: {
      affixWrapper: C(`${e}-textarea-affix-wrapper`, {
        [`${e}-affix-wrapper-rtl`]: _ === "rtl",
        [`${e}-affix-wrapper-borderless`]: !a,
        [`${e}-affix-wrapper-sm`]: c === "small",
        [`${e}-affix-wrapper-lg`]: c === "large",
        [`${e}-textarea-show-count`]: r.showCount || ((o = r.count) === null || o === void 0 ? void 0 : o.show)
      }, S(`${e}-affix-wrapper`, v), w)
    },
    classNames: Object.assign(Object.assign({}, m), {
      textarea: C({
        [`${e}-borderless`]: !a,
        [`${e}-sm`]: c === "small",
        [`${e}-lg`]: c === "large"
      }, S(e, v), w, m == null ? void 0 : m.textarea)
    }),
    prefixCls: e,
    suffix: T && /* @__PURE__ */ s.createElement("span", {
      className: `${e}-textarea-suffix`
    }, P),
    ref: f
  })));
}), fe = L;
export {
  fe as default
};
