import { defineComponent as p, ref as i, watchEffect as d, unref as v, renderSlot as _ } from "vue";
import { isNumber as g, cloneDeep as h } from "lodash-unified";
import { useInjectForm as y } from "../context.mjs";
import { getModelValue as V } from "../utils/get.mjs";
const D = /* @__PURE__ */ p({
  name: "ApFormDependency",
  __name: "index",
  props: {
    nameList: {}
  },
  setup(a) {
    const c = a, {
      model: f
    } = y(), r = i({});
    function u(e, s, l) {
      let t = s;
      for (let o = 0; o < e.length; o++) {
        const n = e[o];
        if (o === e.length - 1)
          t[n] = l;
        else {
          const m = e[o + 1];
          (typeof t[n] != "object" || t[n] === null) && (t[n] = g(m) ? [] : {}), t = t[n];
        }
      }
    }
    return d(() => {
      const e = h(r.value);
      for (const s of c.nameList) {
        const l = [s].flat(1), t = V(v(f), l);
        u(l, e, t);
      }
      r.value = e;
    }), (e, s) => _(e.$slots, "default", {
      values: r.value
    });
  }
});
export {
  D as default
};
