"use strict";
const uni_modules_tdesignUniapp_components_common_src_instantiationDecorator = require("../common/src/instantiationDecorator.js");
const uni_modules_tdesignUniapp_components_common_config = require("../common/config.js");
const uni_modules_tdesignUniapp_components_badge_props = require("./props.js");
const uni_modules_tdesignUniapp_components_common_utils = require("../common/utils.js");
const uni_modules_tdesignUniapp_components_common_utils_wxs = require("../common/utils.wxs.js");
const uni_modules_tdesignUniapp_components_badge_computed = require("./computed.js");
const common_vendor = require("../../../../common/vendor.js");
const name = `${uni_modules_tdesignUniapp_components_common_config.prefix}-badge`;
const getUniqueID = uni_modules_tdesignUniapp_components_common_utils.uniqueFactory("badge");
const _sfc_main = uni_modules_tdesignUniapp_components_common_src_instantiationDecorator.uniComponent({
  name,
  options: {
    styleIsolation: "shared"
  },
  externalClasses: [
    `${uni_modules_tdesignUniapp_components_common_config.prefix}-class`,
    `${uni_modules_tdesignUniapp_components_common_config.prefix}-class-count`,
    `${uni_modules_tdesignUniapp_components_common_config.prefix}-class-content`
  ],
  props: {
    ...uni_modules_tdesignUniapp_components_badge_props.props
  },
  data() {
    return {
      prefix: uni_modules_tdesignUniapp_components_common_config.prefix,
      classPrefix: name,
      value: "",
      labelID: "",
      descriptionID: "",
      tools: uni_modules_tdesignUniapp_components_common_utils_wxs.tools,
      useOuterClass: false
    };
  },
  computed: {
    hasChild() {
      var _a;
      return !!((_a = this.$slots) == null ? void 0 : _a.default);
    }
  },
  mounted() {
    const e = getUniqueID();
    this.labelID = `${e}_label`;
    this.descriptionID = `${e}_description`;
    this.checkForActualContent();
  },
  methods: {
    getBadgeValue: uni_modules_tdesignUniapp_components_badge_computed.getBadgeValue,
    getBadgeStyles: uni_modules_tdesignUniapp_components_badge_computed.getBadgeStyles,
    getBadgeInnerClass: uni_modules_tdesignUniapp_components_badge_computed.getBadgeInnerClass,
    isShowBadge: uni_modules_tdesignUniapp_components_badge_computed.isShowBadge,
    checkForActualContent() {
      const target = ["ribbon", "ribbon-right", "ribbon-left", "triangle-right", "triangle-left"];
      if (this.content || !target.includes(this.shape)) {
        this.useOuterClass = false;
        return;
      }
      return uni_modules_tdesignUniapp_components_common_utils.getRect(this, `.${name}__content`).then((rect) => {
        const hasSlotContent = rect.width > 0 || rect.height > 0;
        this.useOuterClass = !hasSlotContent;
      });
    }
  }
});
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  return common_vendor.e({
    a: !_ctx.content
  }, !_ctx.content ? {} : {
    b: common_vendor.t(_ctx.content),
    c: common_vendor.n(_ctx.classPrefix + "__content-text")
  }, {
    d: _ctx.labelID,
    e: common_vendor.n(_ctx.tools.cls(_ctx.classPrefix + "__content", [["empty", !_ctx.content && !_ctx.hasChild]]) + " " + _ctx.tClassContent),
    f: _ctx.isShowBadge({
      dot: _ctx.dot,
      count: _ctx.count,
      showZero: _ctx.showZero
    }) || _ctx.count === null
  }, _ctx.isShowBadge({
    dot: _ctx.dot,
    count: _ctx.count,
    showZero: _ctx.showZero
  }) || _ctx.count === null ? common_vendor.e({
    g: _ctx.isShowBadge({
      dot: _ctx.dot,
      count: _ctx.count,
      showZero: _ctx.showZero
    })
  }, _ctx.isShowBadge({
    dot: _ctx.dot,
    count: _ctx.count,
    showZero: _ctx.showZero
  }) ? {
    h: common_vendor.t(_ctx.getBadgeValue({
      dot: _ctx.dot,
      count: _ctx.count,
      maxCount: _ctx.maxCount
    }))
  } : {}, {
    i: common_vendor.n(_ctx.classPrefix + "__count"),
    j: _ctx.descriptionID,
    k: _ctx.ariaLabel || _ctx.tools.getBadgeAriaLabel({
      dot: _ctx.dot,
      count: _ctx.count,
      maxCount: _ctx.maxCount
    }),
    l: common_vendor.n(_ctx.getBadgeInnerClass({
      classPrefix: _ctx.classPrefix,
      dot: _ctx.dot,
      size: _ctx.size,
      shape: _ctx.shape,
      count: _ctx.count
    }) + " " + _ctx.prefix + "-has-count "),
    m: common_vendor.n(_ctx.tClassCount),
    n: common_vendor.s(_ctx.tools._style([_ctx.getBadgeStyles({
      color: _ctx.color,
      offset: _ctx.offset
    })]))
  }) : {}, {
    o: common_vendor.s(_ctx.tools._style([_ctx.customStyle])),
    p: common_vendor.n(_ctx.classPrefix + " " + (_ctx.useOuterClass ? _ctx.classPrefix + "__" + _ctx.shape + "-outer" : "") + _ctx.tClass),
    q: _ctx.labelID,
    r: _ctx.descriptionID,
    s: _ctx.ariaRole || "option"
  });
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-3b9e0753"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/tdesign-uniapp/components/badge/badge.js.map
