import r from "./index-extends.js";
import * as i from "react";
function f(t) {
  if (typeof t != "object" || t === null)
    return !1;
  const n = Object.getPrototypeOf(t);
  return (n === null || n === Object.prototype || Object.getPrototypeOf(n) === null) && !(Symbol.toStringTag in t) && !(Symbol.iterator in t);
}
function p(t) {
  if (/* @__PURE__ */ i.isValidElement(t) || !f(t))
    return t;
  const n = {};
  return Object.keys(t).forEach((o) => {
    n[o] = p(t[o]);
  }), n;
}
function b(t, n, o = {
  clone: !0
}) {
  const e = o.clone ? r({}, t) : t;
  return f(t) && f(n) && Object.keys(n).forEach((l) => {
    /* @__PURE__ */ i.isValidElement(n[l]) ? e[l] = n[l] : f(n[l]) && // Avoid prototype pollution
    Object.prototype.hasOwnProperty.call(t, l) && f(t[l]) ? e[l] = b(t[l], n[l], o) : o.clone ? e[l] = f(n[l]) ? p(n[l]) : n[l] : e[l] = n[l];
  }), e;
}
export {
  b as default,
  f as isPlainObject
};
