import k from "../../../@babel/runtime/helpers/esm/slicedToArray.mjs";
import * as t from "react";
import j from "../../../rc-util/es/pickAttrs.mjs";
import q from "./Input.mjs";
import { getTitle as z } from "../utils/commonUtil.mjs";
var Q = function(e) {
  var v = e.inputElement, a = e.prefixCls, I = e.id, C = e.inputRef, b = e.disabled, x = e.autoFocus, g = e.autoComplete, E = e.activeDescendantId, c = e.mode, d = e.open, S = e.values, y = e.placeholder, D = e.tabIndex, m = e.showSearch, w = e.searchValue, i = e.activeValue, R = e.maxLength, P = e.onInputKeyDown, V = e.onInputMouseDown, F = e.onInputChange, T = e.onInputPaste, p = e.onInputCompositionStart, K = e.onInputCompositionEnd, r = e.title, L = t.useState(!1), s = k(L, 2), M = s[0], f = s[1], n = c === "combobox", N = n || m, o = S[0], l = w || "";
  n && i && !M && (l = i), t.useEffect(function() {
    n && f(!1);
  }, [n, i]);
  var h = c !== "combobox" && !d && !m ? !1 : !!l, _ = r === void 0 ? z(o) : r, A = function() {
    if (o)
      return null;
    var u = h ? {
      visibility: "hidden"
    } : void 0;
    return /* @__PURE__ */ t.createElement("span", {
      className: "".concat(a, "-selection-placeholder"),
      style: u
    }, y);
  };
  return /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement("span", {
    className: "".concat(a, "-selection-search")
  }, /* @__PURE__ */ t.createElement(q, {
    ref: C,
    prefixCls: a,
    id: I,
    open: d,
    inputElement: v,
    disabled: b,
    autoFocus: x,
    autoComplete: g,
    editable: N,
    activeDescendantId: E,
    value: l,
    onKeyDown: P,
    onMouseDown: V,
    onChange: function(u) {
      f(!0), F(u);
    },
    onPaste: T,
    onCompositionStart: p,
    onCompositionEnd: K,
    tabIndex: D,
    attrs: j(e, !0),
    maxLength: n ? R : void 0
  })), !n && o ? /* @__PURE__ */ t.createElement("span", {
    className: "".concat(a, "-selection-item"),
    title: _,
    style: h ? {
      visibility: "hidden"
    } : void 0
  }, o.label) : null, A());
};
export {
  Q as default
};
