'use strict';

var vue = require('vue');
var constants = require('../constants.js');

const useWatchModelChange = (modelValue, options) => {
  const queryParams = vue.inject(constants.queryParamsKey);
  if (queryParams && !options.noDefaultSync) {
    modelValue.value = queryParams.value[options.prop];
  }
  vue.watch(modelValue, (newValue) => {
    if (queryParams) {
      queryParams.value[options.prop] = newValue;
    }
  });
  vue.watch(
    () => queryParams?.value?.[options.prop],
    (newValue) => {
      modelValue.value = newValue;
    }
  );
};

exports.useWatchModelChange = useWatchModelChange;
//# sourceMappingURL=useWatchModelChange.js.map
