'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');

var useCache = (values) => {
  const cacheRef = vue.shallowRef({
    valueLabels: /* @__PURE__ */ new Map()
  });
  const mergedValues = vue.shallowRef();
  vue.watch(
    values,
    () => {
      mergedValues.value = vue.toRaw(values.value);
    },
    { immediate: true }
  );
  const newFilledValues = vue.computed(() => {
    const { valueLabels } = cacheRef.value;
    const valueLabelsCache = /* @__PURE__ */ new Map();
    const filledValues = mergedValues.value.map((item) => {
      var _a;
      const { value } = item;
      const mergedLabel = (_a = item.label) != null ? _a : valueLabels.get(value);
      valueLabelsCache.set(value, mergedLabel);
      return {
        ...item,
        label: mergedLabel
      };
    });
    cacheRef.value.valueLabels = valueLabelsCache;
    return filledValues;
  });
  return [newFilledValues];
};

exports.default = useCache;
//# sourceMappingURL=useCache.cjs.map
