| 504 | return (r.length > 0 && ((e.patches = []), e.callback && e.callback(r)), r); |
| 505 | } |
| 506 | function C(e, t, n, r, i) { |
| 507 | if (t !== e) { |
| 508 | "function" == typeof t.toJSON && (t = t.toJSON()); |
| 509 | for (var o = c(t), a = c(e), s = !1, d = a.length - 1; d >= 0; d--) { |
| 510 | var u = e[(g = a[d])]; |
| 511 | if ( |
| 512 | !l(t, g) || |
| 513 | (void 0 === t[g] && void 0 !== u && !1 === Array.isArray(t)) |
| 514 | ) |
| 515 | Array.isArray(e) === Array.isArray(t) |
| 516 | ? (i && n.push({ op: "test", path: r + "/" + p(g), value: f(u) }), |
| 517 | n.push({ op: "remove", path: r + "/" + p(g) }), |
| 518 | (s = !0)) |
| 519 | : (i && n.push({ op: "test", path: r, value: e }), |
| 520 | n.push({ op: "replace", path: r, value: t })); |
| 521 | else { |
| 522 | var h = t[g]; |
| 523 | "object" == typeof u && |
| 524 | null != u && |
| 525 | "object" == typeof h && |
| 526 | null != h && |
| 527 | Array.isArray(u) === Array.isArray(h) |
| 528 | ? C(u, h, n, r + "/" + p(g), i) |
| 529 | : u !== h && |
| 530 | (i && n.push({ op: "test", path: r + "/" + p(g), value: f(u) }), |
| 531 | n.push({ op: "replace", path: r + "/" + p(g), value: f(h) })); |
| 532 | } |
| 533 | } |
| 534 | if (s || o.length != a.length) |
| 535 | for (d = 0; d < o.length; d++) { |
| 536 | var g; |
| 537 | l(e, (g = o[d])) || |
| 538 | void 0 === t[g] || |
| 539 | n.push({ op: "add", path: r + "/" + p(g), value: f(t[g]) }); |
| 540 | } |
| 541 | } |
| 542 | } |
| 543 | var D = Object.freeze({ |
| 544 | __proto__: null, |
| 545 | compare: function (e, t, n) { |