import a from "../../../../@gilbarbara_deep-equal@0.3.1/node_modules/@gilbarbara/deep-equal/dist/index.js";
import n from "../../../../is-lite@1.2.1/node_modules/is-lite/dist/index.js";
function P(...e) {
  return e.every((r) => n.string(r) || n.array(r) || n.plainObject(r));
}
function U(e, r, t) {
  return I(e, r) ? [e, r].every(n.array) ? !e.some(C(t)) && r.some(C(t)) : [e, r].every(n.plainObject) ? !Object.entries(e).some(x(t)) && Object.entries(r).some(x(t)) : r === t : !1;
}
function w(e, r, t) {
  const { actual: s, key: i, previous: b, type: l } = t, o = h(e, i), u = h(r, i);
  let y = [o, u].every(n.number) && (l === "increased" ? o < u : o > u);
  return n.undefined(s) || (y = y && u === s), n.undefined(b) || (y = y && o === b), y;
}
function q(e, r, t) {
  const { key: s, type: i, value: b } = t, l = h(e, s), o = h(r, s), u = i === "added" ? l : o, y = i === "added" ? o : l;
  if (!n.nullOrUndefined(b)) {
    if (n.defined(u)) {
      if (n.array(u) || n.plainObject(u))
        return U(u, y, b);
    } else
      return a(y, b);
    return !1;
  }
  return [l, o].every(n.array) ? !y.every(p(u)) : [l, o].every(n.plainObject) ? v(Object.keys(u), Object.keys(y)) : ![l, o].every((c) => n.primitive(c) && n.defined(c)) && (i === "added" ? !n.defined(l) && n.defined(o) : n.defined(l) && !n.defined(o));
}
function T(e, r, { key: t } = {}) {
  let s = h(e, t), i = h(r, t);
  if (!I(s, i))
    throw new TypeError("Inputs have different types");
  if (!P(s, i))
    throw new TypeError("Inputs don't have length");
  return [s, i].every(n.plainObject) && (s = Object.keys(s), i = Object.keys(i)), [s, i];
}
function x(e) {
  return ([r, t]) => n.array(e) ? a(e, t) || e.some((s) => a(s, t) || n.array(t) && p(t)(s)) : n.plainObject(e) && e[r] ? !!e[r] && a(e[r], t) : a(e, t);
}
function v(e, r) {
  return r.some((t) => !e.includes(t));
}
function C(e) {
  return (r) => n.array(e) ? e.some((t) => a(t, r) || n.array(r) && p(r)(t)) : a(e, r);
}
function g(e, r) {
  return n.array(e) ? e.some((t) => a(t, r)) : a(e, r);
}
function p(e) {
  return (r) => e.some((t) => a(t, r));
}
function I(...e) {
  return e.every(n.array) || e.every(n.number) || e.every(n.plainObject) || e.every(n.string);
}
function h(e, r) {
  return n.plainObject(e) || n.array(e) ? n.string(r) ? r.split(".").reduce((s, i) => s && s[i], e) : n.number(r) ? e[r] : e : e;
}
function L(e, r) {
  if ([e, r].some(n.nullOrUndefined))
    throw new Error("Missing required parameters");
  if (![e, r].every((c) => n.plainObject(c) || n.array(c)))
    throw new Error("Expected plain objects or array");
  return { added: (c, f) => {
    try {
      return q(e, r, { key: c, type: "added", value: f });
    } catch {
      return !1;
    }
  }, changed: (c, f, d) => {
    try {
      const m = h(e, c), O = h(r, c), j = n.defined(f), E = n.defined(d);
      if (j || E) {
        const A = E ? g(d, m) : !g(f, m), F = g(f, O);
        return A && F;
      }
      return [m, O].every(n.array) || [m, O].every(n.plainObject) ? !a(m, O) : m !== O;
    } catch {
      return !1;
    }
  }, changedFrom: (c, f, d) => {
    if (!n.defined(c))
      return !1;
    try {
      const m = h(e, c), O = h(r, c), j = n.defined(d);
      return g(f, m) && (j ? g(d, O) : !j);
    } catch {
      return !1;
    }
  }, decreased: (c, f, d) => {
    if (!n.defined(c))
      return !1;
    try {
      return w(e, r, { key: c, actual: f, previous: d, type: "decreased" });
    } catch {
      return !1;
    }
  }, emptied: (c) => {
    try {
      const [f, d] = T(e, r, { key: c });
      return !!f.length && !d.length;
    } catch {
      return !1;
    }
  }, filled: (c) => {
    try {
      const [f, d] = T(e, r, { key: c });
      return !f.length && !!d.length;
    } catch {
      return !1;
    }
  }, increased: (c, f, d) => {
    if (!n.defined(c))
      return !1;
    try {
      return w(e, r, { key: c, actual: f, previous: d, type: "increased" });
    } catch {
      return !1;
    }
  }, removed: (c, f) => {
    try {
      return q(e, r, { key: c, type: "removed", value: f });
    } catch {
      return !1;
    }
  } };
}
export {
  L as default
};
//# sourceMappingURL=index.js.map
