import S from "./_Stack.js";
import L from "./_arrayEach.js";
import B from "./_assignValue.js";
import I from "./_baseAssign.js";
import O from "./_baseAssignIn.js";
import _ from "./_cloneBuffer.js";
import M from "./_copyArray.js";
import l from "./_copySymbols.js";
import w from "./_copySymbolsIn.js";
import D from "./_getAllKeys.js";
import G from "./_getAllKeysIn.js";
import N from "./_getTag.js";
import U from "./_initCloneArray.js";
import h from "./_initCloneByTag.js";
import x from "./_initCloneObject.js";
import K from "./isArray.js";
import P from "./isBuffer.js";
import R from "./isMap.js";
import W from "./isObject.js";
import Y from "./isSet.js";
import q from "./keys.js";
import H from "./keysIn.js";
var J = 1, Q = 2, V = 4, A = "[object Arguments]", X = "[object Array]", Z = "[object Boolean]", $ = "[object Date]", u = "[object Error]", d = "[object Function]", z = "[object GeneratorFunction]", k = "[object Map]", v = "[object Number]", E = "[object Object]", rr = "[object RegExp]", or = "[object Set]", tr = "[object String]", er = "[object Symbol]", ir = "[object WeakMap]", nr = "[object ArrayBuffer]", fr = "[object DataView]", ar = "[object Float32Array]", mr = "[object Float64Array]", cr = "[object Int8Array]", gr = "[object Int16Array]", pr = "[object Int32Array]", br = "[object Uint8Array]", Tr = "[object Uint8ClampedArray]", jr = "[object Uint16Array]", yr = "[object Uint32Array]", o = {};
o[A] = o[X] = o[nr] = o[fr] = o[Z] = o[$] = o[ar] = o[mr] = o[cr] = o[gr] = o[pr] = o[k] = o[v] = o[E] = o[rr] = o[or] = o[tr] = o[er] = o[br] = o[Tr] = o[jr] = o[yr] = !0;
o[u] = o[d] = o[ir] = !1;
function p(r, f, g, sr, b, i) {
  var t, m = f & J, c = f & Q, F = f & V;
  if (t !== void 0)
    return t;
  if (!W(r))
    return r;
  var T = K(r);
  if (T) {
    if (t = U(r), !m)
      return M(r, t);
  } else {
    var a = N(r), j = a == d || a == z;
    if (P(r))
      return _(r, m);
    if (a == E || a == A || j && !b) {
      if (t = c || j ? {} : x(r), !m)
        return c ? w(r, O(t, r)) : l(r, I(t, r));
    } else {
      if (!o[a])
        return b ? r : {};
      t = h(r, a, m);
    }
  }
  i || (i = new S());
  var y = i.get(r);
  if (y)
    return y;
  i.set(r, t), Y(r) ? r.forEach(function(e) {
    t.add(p(e, f, g, e, r, i));
  }) : R(r) && r.forEach(function(e, n) {
    t.set(n, p(e, f, g, n, r, i));
  });
  var C = F ? c ? G : D : c ? H : q, s = T ? void 0 : C(r);
  return L(s || r, function(e, n) {
    s && (n = e, e = r[n]), B(t, n, p(e, f, g, n, r, i));
  }), t;
}
export {
  p as default
};
