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