import { computed, ref } from "vue";
import { getCurrentInstance } from "../../utils/dist/index.mjs";
import { propIsDefined } from "../../utils/define-component.mjs";
function useProxiedModel(props, prop, defaultValue, transformIn = (v) => v, transformOut = (v) => v) {
  const vm = getCurrentInstance("useProxiedModel");
  const propIsDefined$1 = computed(() => {
    return typeof props[prop] !== "undefined" && vm.vnode && propIsDefined(vm.vnode, prop);
  });
  const internal = ref(
    typeof props[prop] === "undefined" ? defaultValue : props[prop]
  );
  return computed({
    get() {
      if (propIsDefined$1.value) {
        return transformIn(props[prop]);
      } else {
        return transformIn(internal.value);
      }
    },
    set(newValue) {
      internal.value = transformOut(newValue);
      vm.emit(`update:${prop}`, internal.value);
    }
  });
}
export {
  useProxiedModel
};
//# sourceMappingURL=index.mjs.map
