"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const types = require("../../../../utils/types.js");
const index = require("../../../../../node_modules/@vueuse/core/index.js");
const vue = require("vue");
const shared_esmBundler = require("../../../../../../@vue/shared/dist/shared.esm-bundler.js");
const useLifecycle = (props, initData, resetSize) => {
  const sliderWrapper = vue.ref();
  vue.onMounted(async () => {
    if (props.range) {
      if (shared_esmBundler.isArray(props.modelValue)) {
        initData.firstValue = Math.max(props.min, props.modelValue[0]);
        initData.secondValue = Math.min(props.max, props.modelValue[1]);
      } else {
        initData.firstValue = props.min;
        initData.secondValue = props.max;
      }
      initData.oldValue = [initData.firstValue, initData.secondValue];
    } else {
      if (!types.isNumber(props.modelValue) || Number.isNaN(props.modelValue)) initData.firstValue = props.min;
      else initData.firstValue = Math.min(props.max, Math.max(props.min, props.modelValue));
      initData.oldValue = initData.firstValue;
    }
    index.useEventListener(window, "resize", resetSize);
    await vue.nextTick();
    resetSize();
  });
  return { sliderWrapper };
};
exports.useLifecycle = useLifecycle;
