'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 color = require('../../../utils/color.cjs');

var ABadgeRibbon = /* @__PURE__ */ vue.defineComponent({
  compatConfig: {
    MODE: 3
  },
  name: "ABadgeRibbon",
  inheritAttrs: false,
  props: props.ribbonProps(),
  slots: Object,
  setup(props, {
    attrs,
    slots
  }) {
    const {
      prefixCls,
      direction
    } = useConfigInject.default("ribbon", props);
    const [wrapSSR, hashId] = index.default(prefixCls);
    const colorInPreset = vue.computed(() => color.isPresetColor(props.color, false));
    const ribbonCls = vue.computed(() => [prefixCls.value, `${prefixCls.value}-placement-${props.placement}`, {
      [`${prefixCls.value}-rtl`]: direction.value === "rtl",
      [`${prefixCls.value}-color-${props.color}`]: colorInPreset.value
    }]);
    return () => {
      var _a, _b;
      const {
        class: className,
        style,
        ...restAttrs
      } = attrs;
      const colorStyle = {};
      const cornerColorStyle = {};
      if (props.color && !colorInPreset.value) {
        colorStyle.background = props.color;
        cornerColorStyle.color = props.color;
      }
      return wrapSSR(vue.createVNode("div", {
        "class": `${prefixCls.value}-wrapper ${hashId.value}`,
        ...restAttrs
      }, [(_a = slots.default) == null ? void 0 : _a.call(slots), vue.createVNode("div", {
        "class": [ribbonCls.value, className, hashId.value],
        "style": {
          ...colorStyle,
          ...style
        }
      }, [vue.createVNode("span", {
        "class": `${prefixCls.value}-text`
      }, [props.text || ((_b = slots.text) == null ? void 0 : _b.call(slots))]), vue.createVNode("div", {
        "class": `${prefixCls.value}-corner`,
        "style": cornerColorStyle
      }, null)])]));
    };
  }
});

exports.default = ABadgeRibbon;
//# sourceMappingURL=Ribbon.cjs.map
