'use strict';

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

var vue = require('vue');
var index$2 = require('../_util/props-util/index.js');
var type = require('../_util/type.js');
require('../hooks/index.js');
var index$1 = require('./style/index.js');
var useConfigInject = require('../config-provider/hooks/useConfigInject.js');

const dividerProps = () => ({
  prefixCls: String,
  type: {
    type: String,
    default: "horizontal"
  },
  dashed: {
    type: Boolean,
    default: false
  },
  orientation: {
    type: String,
    default: "center"
  },
  plain: {
    type: Boolean,
    default: false
  },
  orientationMargin: [String, Number]
});
const Divider = /* @__PURE__ */ vue.defineComponent({
  name: "ADivider",
  inheritAttrs: false,
  compatConfig: {
    MODE: 3
  },
  props: dividerProps(),
  setup(props, {
    slots,
    attrs
  }) {
    const {
      prefixCls: prefixClsRef,
      direction
    } = useConfigInject.default("divider", props);
    const [wrapSSR, hashId] = index$1.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 = index$2.flattenChildren((_a = slots.default) == null ? void 0 : _a.call(slots));
      return wrapSSR(vue.createVNode("div", vue.mergeProps(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]));
    };
  }
});
var index = type.withInstall(Divider);

exports.default = index;
exports.dividerProps = dividerProps;
//# sourceMappingURL=index.js.map
