import p from "./_assignValue.js";
import l from "./_castPath.js";
import x from "./_isIndex.js";
import d from "./isObject.js";
import _ from "./_toKey.js";
function K(r, t, e, a) {
  if (!d(r))
    return r;
  t = l(t, r);
  for (var o = -1, m = t.length, u = m - 1, n = r; n != null && ++o < m; ) {
    var i = _(t[o]), f = e;
    if (i === "__proto__" || i === "constructor" || i === "prototype")
      return r;
    if (o != u) {
      var s = n[i];
      f = void 0, f === void 0 && (f = d(s) ? s : x(t[o + 1]) ? [] : {});
    }
    p(n, i, f), n = n[i];
  }
  return r;
}
export {
  K as default
};
