import { ref, computed, watch } from 'vue';

function useMergedType({ defaultType, steps, current, defaultCurrent }) {
  const innerCurrent = ref(defaultCurrent == null ? void 0 : defaultCurrent.value);
  const mergedCurrent = computed(() => current == null ? void 0 : current.value);
  watch(
    mergedCurrent,
    (val) => {
      innerCurrent.value = val != null ? val : defaultCurrent == null ? void 0 : defaultCurrent.value;
    },
    { immediate: true }
  );
  const updateInnerCurrent = (val) => {
    innerCurrent.value = val;
  };
  const innerType = computed(() => {
    var _a, _b;
    return typeof innerCurrent.value === "number" ? steps && ((_b = (_a = steps.value) == null ? void 0 : _a[innerCurrent.value]) == null ? void 0 : _b.type) : defaultType == null ? void 0 : defaultType.value;
  });
  const currentMergedType = computed(() => {
    var _a;
    return (_a = innerType.value) != null ? _a : defaultType == null ? void 0 : defaultType.value;
  });
  return { currentMergedType, updateInnerCurrent };
}

export { useMergedType as default };
//# sourceMappingURL=useMergedType.mjs.map
