"use strict";
const vue = require("vue");
const useColorVariantClasses = require("./useColorVariantClasses-BjkZZDqD.js");
const useDefaults = require("./useDefaults-YXpmugKp.js");
const keys = require("./keys-D70E9HED.js");
const index = require("./index-JJEBhaXq.js");
const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
  __name: "BProgressBar",
  props: {
    animated: { type: Boolean, default: false },
    label: { default: void 0 },
    max: { default: void 0 },
    precision: { default: 0 },
    showProgress: { type: Boolean, default: false },
    showValue: { type: Boolean, default: false },
    striped: { type: Boolean, default: false },
    value: { default: 0 },
    variant: { default: null },
    bgVariant: { default: null },
    textVariant: { default: null }
  },
  setup(__props) {
    const _props = __props;
    const props = useDefaults.useDefaults(_props, "BProgressBar");
    const parentData = vue.inject(keys.progressInjectionKey, null);
    const colorClasses = useColorVariantClasses.useColorVariantClasses(props);
    const computedClasses = vue.computed(() => [
      colorClasses.value,
      {
        "progress-bar-animated": props.animated || parentData?.animated.value,
        "progress-bar-striped": props.striped || parentData?.striped.value || props.animated || parentData?.animated.value
      }
    ]);
    const numberPrecision = index.useToNumber(() => props.precision);
    const numberValue = index.useToNumber(() => props.value);
    const numberMax = index.useToNumber(() => props.max ?? Number.NaN);
    const parentMaxNumber = index.useToNumber(() => parentData?.max.value ?? Number.NaN);
    const computedLabel = vue.computed(
      () => props.showValue || parentData?.showValue.value ? numberValue.value.toFixed(numberPrecision.value) : props.showProgress || parentData?.showProgress.value ? (numberValue.value * 100 / (numberMax.value || 100)).toFixed(numberPrecision.value) : props.label !== void 0 ? props.label : ""
    );
    const computedWidth = vue.computed(
      () => parentMaxNumber.value ? `${numberValue.value * 100 / parentMaxNumber.value}%` : numberMax.value ? `${numberValue.value * 100 / numberMax.value}%` : typeof props.value === "string" ? props.value : `${props.value}%`
    );
    return (_ctx, _cache) => {
      return vue.openBlock(), vue.createElementBlock("div", {
        class: vue.normalizeClass(["progress-bar", computedClasses.value]),
        style: vue.normalizeStyle({ width: computedWidth.value })
      }, [
        vue.renderSlot(_ctx.$slots, "default", {}, () => [
          vue.createTextVNode(vue.toDisplayString(computedLabel.value), 1)
        ])
      ], 6);
    };
  }
});
const _hoisted_1 = ["aria-valuenow", "aria-valuemax"];
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
  __name: "BProgress",
  props: {
    height: { default: void 0 },
    animated: { type: Boolean, default: void 0 },
    max: { default: 100 },
    precision: { default: void 0 },
    showProgress: { type: Boolean, default: void 0 },
    showValue: { type: Boolean, default: void 0 },
    striped: { type: Boolean, default: void 0 },
    value: { default: void 0 },
    variant: { default: void 0 },
    bgVariant: { default: void 0 },
    textVariant: { default: void 0 }
  },
  setup(__props) {
    const _props = __props;
    const props = useDefaults.useDefaults(_props, "BProgress");
    vue.provide(keys.progressInjectionKey, {
      animated: vue.toRef(() => props.animated),
      max: vue.toRef(() => props.max),
      showProgress: vue.toRef(() => props.showProgress),
      showValue: vue.toRef(() => props.showValue),
      striped: vue.toRef(() => props.striped)
    });
    return (_ctx, _cache) => {
      return vue.openBlock(), vue.createElementBlock("div", {
        class: "progress",
        role: "progressbar",
        style: vue.normalizeStyle({ height: vue.unref(props).height }),
        "aria-valuenow": vue.unref(props).value,
        "aria-valuemin": "0",
        "aria-valuemax": vue.unref(props).max
      }, [
        vue.renderSlot(_ctx.$slots, "default", {}, () => [
          vue.createVNode(_sfc_main$1, {
            animated: vue.unref(props).animated,
            max: vue.unref(props).max,
            precision: vue.unref(props).precision,
            "show-progress": vue.unref(props).showProgress,
            "show-value": vue.unref(props).showValue,
            striped: vue.unref(props).striped,
            value: vue.unref(props).value,
            variant: vue.unref(props).variant,
            "text-variant": vue.unref(props).textVariant,
            "bg-variant": vue.unref(props).bgVariant
          }, null, 8, ["animated", "max", "precision", "show-progress", "show-value", "striped", "value", "variant", "text-variant", "bg-variant"])
        ])
      ], 12, _hoisted_1);
    };
  }
});
exports._sfc_main = _sfc_main;
exports._sfc_main$1 = _sfc_main$1;
//# sourceMappingURL=BProgress.vue_vue_type_script_setup_true_lang-By-yrDYc.js.map
