import V from "../../@babel/runtime/helpers/esm/extends.mjs";
import X from "../../@babel/runtime/helpers/esm/defineProperty.mjs";
import f from "../../@babel/runtime/helpers/esm/objectSpread2.mjs";
import D from "../../@babel/runtime/helpers/esm/objectWithoutProperties.mjs";
import O from "../../@rc-component/trigger/es/index.mjs";
import Y from "../../classnames/index.mjs";
import * as t from "react";
var B = ["prefixCls", "disabled", "visible", "children", "popupElement", "animation", "transitionName", "dropdownStyle", "dropdownClassName", "direction", "placement", "builtinPlacements", "dropdownMatchSelectWidth", "dropdownRender", "dropdownAlign", "getPopupContainer", "empty", "getTriggerDOMNode", "onPopupVisibleChange", "onPopupMouseEnter"], I = function(e) {
  var o = e === !0 ? 0 : 1;
  return {
    bottomLeft: {
      points: ["tl", "bl"],
      offset: [0, 4],
      overflow: {
        adjustX: o,
        adjustY: 1
      },
      htmlRegion: "scroll"
    },
    bottomRight: {
      points: ["tr", "br"],
      offset: [0, 4],
      overflow: {
        adjustX: o,
        adjustY: 1
      },
      htmlRegion: "scroll"
    },
    topLeft: {
      points: ["bl", "tl"],
      offset: [0, -4],
      overflow: {
        adjustX: o,
        adjustY: 1
      },
      htmlRegion: "scroll"
    },
    topRight: {
      points: ["br", "tr"],
      offset: [0, -4],
      overflow: {
        adjustX: o,
        adjustY: 1
      },
      htmlRegion: "scroll"
    }
  };
}, L = function(e, o) {
  var b = e.prefixCls;
  e.disabled;
  var P = e.visible, v = e.children, d = e.popupElement, p = e.animation, w = e.transitionName, C = e.dropdownStyle, N = e.dropdownClassName, u = e.direction, R = u === void 0 ? "ltr" : u, M = e.placement, m = e.builtinPlacements, n = e.dropdownMatchSelectWidth, c = e.dropdownRender, S = e.dropdownAlign, y = e.getPopupContainer, j = e.empty, E = e.getTriggerDOMNode, i = e.onPopupVisibleChange, T = e.onPopupMouseEnter, x = D(e, B), r = "".concat(b, "-dropdown"), s = d;
  c && (s = c(d));
  var A = t.useMemo(function() {
    return m || I(n);
  }, [m, n]), W = p ? "".concat(r, "-").concat(p) : w, l = typeof n == "number", _ = t.useMemo(function() {
    return l ? null : n === !1 ? "minWidth" : "width";
  }, [n, l]), a = C;
  l && (a = f(f({}, a), {}, {
    width: n
  }));
  var g = t.useRef(null);
  return t.useImperativeHandle(o, function() {
    return {
      getPopupElement: function() {
        return g.current;
      }
    };
  }), /* @__PURE__ */ t.createElement(O, V({}, x, {
    showAction: i ? ["click"] : [],
    hideAction: i ? ["click"] : [],
    popupPlacement: M || (R === "rtl" ? "bottomRight" : "bottomLeft"),
    builtinPlacements: A,
    prefixCls: r,
    popupTransitionName: W,
    popup: /* @__PURE__ */ t.createElement("div", {
      ref: g,
      onMouseEnter: T
    }, s),
    stretch: _,
    popupAlign: S,
    popupVisible: P,
    getPopupContainer: y,
    popupClassName: Y(N, X({}, "".concat(r, "-empty"), j)),
    popupStyle: a,
    getTriggerDOMNode: E,
    onPopupVisibleChange: i
  }), v);
}, k = /* @__PURE__ */ t.forwardRef(L);
k.displayName = "SelectTrigger";
export {
  k as default
};
