import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _extends from "@babel/runtime/helpers/esm/extends";
// handle border collapse
function compactItemBorder(token, borderedItemCls, popoverFocusedCls) {
  var childCombinator = borderedItemCls ? '> *' : '';
  return {
    '&-item:not(&-last-item)': {
      marginInlineEnd: -token.lineWidth
    },
    '&-item': _extends(_extends(_defineProperty({}, "&:hover ".concat(childCombinator, ", &:focus ").concat(childCombinator, ", &:active ").concat(childCombinator), {
      zIndex: 2
    }), popoverFocusedCls ? _defineProperty({}, "&".concat(popoverFocusedCls), {
      zIndex: 2
    }) : {}), _defineProperty({}, "&[disabled] ".concat(childCombinator), {
      zIndex: 0
    }))
  };
}
// handle border-radius
function compactItemBorderRadius(prefixCls, borderedElementCls) {
  var _ref2;
  var childCombinator = borderedElementCls ? "> ".concat(borderedElementCls) : '';
  return _ref2 = {}, _defineProperty(_ref2, "&-item:not(&-first-item):not(&-last-item) ".concat(childCombinator), {
    borderRadius: 0
  }), _defineProperty(_ref2, '&-item&-first-item', _defineProperty({}, "& ".concat(childCombinator, ", &").concat(prefixCls, "-sm ").concat(childCombinator, ", &").concat(prefixCls, "-lg ").concat(childCombinator), {
    borderStartEndRadius: 0,
    borderEndEndRadius: 0
  })), _defineProperty(_ref2, '&-item&-last-item', _defineProperty({}, "& ".concat(childCombinator, ", &").concat(prefixCls, "-sm ").concat(childCombinator, ", &").concat(prefixCls, "-lg ").concat(childCombinator), {
    borderStartStartRadius: 0,
    borderEndStartRadius: 0
  })), _ref2;
}
export function genCompactItemStyle(token, prefixCls, /** Some component borders are implemented on child elements like `Select` */
borderedElementCls,
/**
 * Some components have special `focus` className especially with popovers like `Select` and
 * `DatePicker`
 */
popoverFocusedCls) {
  return {
    '&-compact': _extends(_extends({}, compactItemBorder(token, borderedElementCls, popoverFocusedCls)), compactItemBorderRadius(prefixCls, borderedElementCls))
  };
}