import { isFunction as a } from "lodash-unified";
import { onMounted as o, onBeforeUnmount as m } from "vue";
import { isPromise as l } from "../../utils/is.mjs";
import { useInjectForm as u } from "../context.mjs";
const F = (i) => {
  let t = !1;
  const { internalInstance: n } = u();
  o(() => {
    r();
  }), m(() => {
    t = !0;
  });
  async function r() {
    let e = a(i.initialValue) ? i.initialValue() : i.initialValue;
    l(e) && (e = await e), !t && n?.registerField({
      name: i.name,
      initialValue: e,
      transform: i.transform
    });
  }
};
export {
  F as default
};
