'use strict';

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

const index = require('./index-305226cb.js');

const bsBadgeCss = ".bs-badge{--badge-bg:var(--bs-red-base);--badge-text:var(--bs-white)}.bs-badge[data-position^=left]::before,.bs-badge:where(:not([data-position^=\"left\"]))::after{align-items:center;background:var(--badge-bg);border-radius:0.5rem;content:\"\";display:inline-flex;font-size:0.8125rem;font-variant-numeric:tabular-nums;font-weight:600;height:6px;justify-content:center;line-height:1;position:relative;vertical-align:top;width:6px}.bs-pill .bs-badge::before,.bs-pill .bs-badge::after{font-size:0.8125em}.bs-badge[data-count]:where([data-position^=\"left\"])::before,.bs-badge[data-count]:where(:not([data-position^=\"left\"]))::after{color:var(--badge-text);content:attr(data-count);min-height:1rem;min-width:1rem;padding:0 4px;top:-0.0625rem;vertical-align:unset;width:auto}.bs-badge[data-count]::before{margin-right:0.25rem}.bs-badge[data-count]::after{margin-left:0.25rem}.bs-badge[data-count=\"0\"]::before,.bs-badge[data-count=\"0\"]::after{display:none}.bs-badge[data-show-zero]:where(:not([data-show-zero=\"false\"]))::before,.bs-badge[data-show-zero]:where(:not([data-show-zero=\"false\"]))::after{display:inline-flex}.bs-badge[data-badge-color^=blue]{--badge-bg:var(--bs-blue-base)}.bs-badge[data-badge-color^=white]{--badge-bg:var(--bs-white);--badge-text:var(--bs-black)}bs-badge{display:inline-block}";

const BsBadge = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.color = undefined;
    this.count = undefined;
    this.countMax = 99;
    this.dot = undefined;
    this.label = 'item';
    this.position = undefined;
    this.showZero = undefined;
  }
  get countFmt() {
    if (this.count === 0)
      return "0";
    if (!this.count || this.dot)
      return null;
    return this.count > this.countMax ?
      this.countMax + "+" :
      this.count.toString();
  }
  get labelFmt() {
    const base = this.hostEl.textContent.trim();
    const ct = this.countFmt ? this.countFmt + ' ' : '';
    if (!ct && !this.dot)
      return base;
    const sfx = this.count !== 1 ? 's' : ''; //pluralize if dot only, 0, or more than 1
    return `${base}, ${ct}${this.label}${sfx}`;
  }
  render() {
    return (index.h(index.Host, { class: (this.dot || this.countFmt) && "bs-badge", "data-badge-color": this.color, "data-count": this.countFmt, "data-position": this.position, "data-show-zero": this.showZero, "aria-label": this.labelFmt }, index.h("slot", null)));
  }
  get hostEl() { return index.getElement(this); }
};
BsBadge.style = bsBadgeCss;

exports.bs_badge = BsBadge;

//# sourceMappingURL=bs-badge.cjs.entry.js.map