"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const types = require("../../../utils/types.js");
const style = require("../../../utils/dom/style.js");
const index = require("../../../hooks/use-namespace/index.js");
const badge = require("./badge.js");
const Vue = require("vue");
var badge_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ Vue.defineComponent({
  name: "ElBadge",
  __name: "badge",
  props: badge.badgeProps,
  setup(__props, { expose: __expose }) {
    const props = __props;
    const ns = index.useNamespace("badge");
    const content = Vue.computed(() => {
      if (props.isDot) return "";
      if (types.isNumber(props.value) && types.isNumber(props.max)) return props.max < props.value ? `${props.max}+` : `${props.value}`;
      return `${props.value}`;
    });
    const style$1 = Vue.computed(() => {
      return [{
        backgroundColor: props.color,
        marginRight: style.addUnit(-props.offset[0]),
        marginTop: style.addUnit(props.offset[1])
      }, props.badgeStyle ?? {}];
    });
    __expose({ content });
    return (_ctx, _cache) => {
      return Vue.openBlock(), Vue.createElementBlock("div", { class: Vue.normalizeClass(Vue.unref(ns).b()) }, [Vue.renderSlot(_ctx.$slots, "default"), Vue.createVNode(Vue.Transition, { name: `${Vue.unref(ns).namespace.value}-zoom-in-center` }, {
        default: Vue.withCtx(() => [!__props.hidden && (content.value || __props.isDot || _ctx.$slots.content) ? (Vue.openBlock(), Vue.createElementBlock("sup", {
          key: 0,
          class: Vue.normalizeClass([
            Vue.unref(ns).e("content"),
            Vue.unref(ns).em("content", __props.type),
            Vue.unref(ns).is("fixed", !!_ctx.$slots.default),
            Vue.unref(ns).is("dot", __props.isDot),
            Vue.unref(ns).is("hide-zero", !__props.showZero && __props.value === 0),
            __props.badgeClass
          ]),
          style: Vue.normalizeStyle(style$1.value)
        }, [Vue.renderSlot(_ctx.$slots, "content", { value: content.value }, () => [Vue.createTextVNode(Vue.toDisplayString(content.value), 1)])], 6)) : Vue.createCommentVNode("v-if", true)]),
        _: 3
      }, 8, ["name"])], 2);
    };
  }
});
exports.default = badge_vue_vue_type_script_setup_true_lang_default;
