"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = useDebounce;
var _vueDemi = require("vue-demi");
function useDebounce(value) {
  const cacheValue = (0, _vueDemi.shallowRef)(value.value.slice());
  let timeout = null;
  (0, _vueDemi.watchEffect)(() => {
    clearTimeout(timeout);
    timeout = setTimeout(() => {
      cacheValue.value = value.value;
    }, value.value.length ? 0 : 10);
  });
  return cacheValue;
}