'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');
require('../../../utils/index.cjs');
var useConfigInject = require('../../config-provider/src/hooks/useConfigInject.cjs');
var index = require('../style/index.cjs');
var props = require('./props.cjs');
var props$1 = require('../../../utils/vue/props.cjs');

var ADivider = /* @__PURE__ */ vue.defineComponent({
  name: "ADivider",
  inheritAttrs: false,
  compatConfig: {
    MODE: 3
  },
  props: props.dividerProps(),
  setup(props, {
    slots,
    attrs
  }) {
    const {
      prefixCls: prefixClsRef,
      direction
    } = useConfigInject.default("divider", props);
    const [wrapSSR, hashId] = index.default(prefixClsRef);
    const hasCustomMarginLeft = vue.computed(() => props.orientation === "left" && props.orientationMargin != null);
    const hasCustomMarginRight = vue.computed(() => props.orientation === "right" && props.orientationMargin != null);
    const classString = vue.computed(() => {
      const {
        type,
        dashed,
        plain
      } = props;
      const prefixCls = prefixClsRef.value;
      return {
        [prefixCls]: true,
        [hashId.value]: !!hashId.value,
        [`${prefixCls}-${type}`]: true,
        [`${prefixCls}-dashed`]: !!dashed,
        [`${prefixCls}-plain`]: !!plain,
        [`${prefixCls}-rtl`]: direction.value === "rtl",
        [`${prefixCls}-no-default-orientation-margin-left`]: hasCustomMarginLeft.value,
        [`${prefixCls}-no-default-orientation-margin-right`]: hasCustomMarginRight.value
      };
    });
    const innerStyle = vue.computed(() => {
      const marginValue = typeof props.orientationMargin === "number" ? `${props.orientationMargin}px` : props.orientationMargin;
      return {
        ...hasCustomMarginLeft.value && {
          marginLeft: marginValue
        },
        ...hasCustomMarginRight.value && {
          marginRight: marginValue
        }
      };
    });
    const orientationPrefix = vue.computed(() => props.orientation.length > 0 ? `-${props.orientation}` : props.orientation);
    return () => {
      var _a;
      const children = props$1.flattenChildren((_a = slots.default) == null ? void 0 : _a.call(slots));
      return wrapSSR(vue.createVNode("div", {
        ...attrs,
        "class": [classString.value, children.length ? `${prefixClsRef.value}-with-text ${prefixClsRef.value}-with-text${orientationPrefix.value}` : "", attrs.class],
        "role": "separator"
      }, [children.length ? vue.createVNode("span", {
        "class": `${prefixClsRef.value}-inner-text`,
        "style": innerStyle.value
      }, [children]) : null]));
    };
  }
});

exports.default = ADivider;
//# sourceMappingURL=Divider.cjs.map
