import { defineComponent as y, ref as f, watch as V, onMounted as g, nextTick as x, openBlock as E, createElementBlock as h, toDisplayString as B } from "vue";
import { C as o } from "../Shared/base-PQGakkrl.js";
import * as k from "countup.js";
const U = /* @__PURE__ */ y({
  name: "ClCountup",
  __name: "Index",
  props: {
    value: {},
    decimal: {},
    isThousand: { type: Boolean },
    separator: {},
    animationTime: {}
  },
  setup(d) {
    const n = d, u = f(null), m = f(""), s = {
      lastValue: ""
    }, p = (t) => {
      const { animationTime: e = 0, decimal: i = 0, isThousand: r = !0, separator: l = "," } = n;
      if (e === 0) {
        let a = "";
        o.isEmpty(t) || (a = o.getValueByFormat(t.toString(), i === 0 ? "int" : "float", {
          decimalNum: i,
          isThousands: r
        }), r && l !== "," && (a = a.replace(/,/g, l))), m.value = a;
      } else {
        const a = o.isEmpty(s.lastValue) ? 0 : Number(s.lastValue), C = t && !o.isEmpty(t) ? Number(t) : 0, T = {
          startVal: a,
          duration: e,
          decimalPlaces: i,
          separator: l,
          useGrouping: r
        }, c = new k.CountUp(u.value, C, T);
        c.error || c.start();
      }
    }, _ = () => {
      p(n.value);
    };
    return V(
      () => n.value,
      (t, e) => {
        t !== e && (s.lastValue = e, p(t));
      }
    ), g(() => {
      x(() => {
        _();
      });
    }), (t, e) => (E(), h("span", {
      ref_key: "refElText",
      ref: u
    }, B(m.value), 513));
  }
});
export {
  U as default
};
//# sourceMappingURL=ClCountup.js.map
