'use strict';

var vue = require('vue');
var lodashEs = require('lodash-es');
require('../../../utils/index.cjs');
require('../../../hooks/index.cjs');
var index = require('../../../hooks/create-context/index.cjs');
var _class = require('../../../utils/dom/class.cjs');

const SpaceCompactItemContext = index.createContext(null);
function useCompactItemContext(prefixCls, direction) {
  const compactItemContext = SpaceCompactItemContext.useInject();
  const compactItemClassnames = vue.computed(() => {
    if (!compactItemContext || lodashEs.isEmpty(compactItemContext))
      return "";
    const { compactDirection, isFirstItem, isLastItem } = compactItemContext;
    const separator = compactDirection === "vertical" ? "-vertical-" : "-";
    return _class.classNames({
      [`${prefixCls.value}-compact${separator}item`]: true,
      [`${prefixCls.value}-compact${separator}first-item`]: isFirstItem,
      [`${prefixCls.value}-compact${separator}last-item`]: isLastItem,
      [`${prefixCls.value}-compact${separator}item-rtl`]: direction.value === "rtl"
    });
  });
  return {
    compactSize: vue.computed(() => compactItemContext == null ? void 0 : compactItemContext.compactSize),
    compactDirection: vue.computed(() => compactItemContext == null ? void 0 : compactItemContext.compactDirection),
    compactItemClassnames
  };
}

exports.SpaceCompactItemContext = SpaceCompactItemContext;
exports.useCompactItemContext = useCompactItemContext;
//# sourceMappingURL=context.cjs.map
