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