const t={Date:!0,RegExp:!0,String:!0,Number:!0};function e(r,a,s={cyclesFix:!0},c=[]){let o=[];const n=Array.isArray(r);for(const p in r){const i=r[p],y=n?+p:p;if(!(p in a)){o.push({type:"REMOVE",path:[y],oldValue:r[p]});continue}const u=a[p],l="object"==typeof i&&"object"==typeof u&&Array.isArray(i)===Array.isArray(u);!(i&&u&&l)||t[Object.getPrototypeOf(i)?.constructor?.name]||s.cyclesFix&&c.includes(i)?i===u||Number.isNaN(i)&&Number.isNaN(u)||l&&(isNaN(i)?i+""==u+"":+i===+u)||o.push({path:[y],type:"CHANGE",value:u,oldValue:i}):o.push.apply(o,e(i,u,s,s.cyclesFix?c.concat([i]):[]).map(t=>(t.path.unshift(y),t)))}const i=Array.isArray(a);for(const t in a)t in r||o.push({type:"CREATE",path:[i?+t:t],value:a[t]});return o}export{e as d};
