class ZeroDepError extends Error{category;source;value;constructor(message="An unexpected error has occurred",category="unknown",source="unknown",value=void 0){super(message),this.category=category,this.source=source,this.value=value,this.name=this.constructor.name,Object.setPrototypeOf(this,new.target.prototype)}}let getType=Object.prototype.toString,compare=(a,b)=>{if(Object.is(a,b))return!0;if(null==a||null==b)return!1;var typeA=Array.isArray(a)?"Array":getType.call(a).slice(8,-1);if(typeA!==(Array.isArray(b)?"Array":getType.call(b).slice(8,-1)))return!1;switch(typeA){case"Array":if(a.length!==b.length)return!1;for(var ndx in a)if(!compare(a[ndx],b[ndx]))return!1;return!0;case"ArrayBuffer":var dvA=new DataView(a),dvB=new DataView(b);return compare(dvA,dvB);case"Boolean":return!!a==!!b;case"DataView":if(a.byteLength!==b.byteLength)return!1;for(let i=0;i!compare(a[key],b[key])):!1;case"Map":return a.size!==b.size?!1:(dvB=[...a.keys()],dvA=[...b.keys()],dvB.length===dvA.length&&!!compare(dvB,dvA)&&(dvB=[...a.values()],dvA=[...b.values()],compare(dvB,dvA)));case"Set":dvB=[...a].sort(),dvA=[...b].sort();return compare(dvB,dvA);case"BigInt64Array":case"BigUint64Array":case"Float32Array":case"Float64Array":case"Int16Array":case"Int32Array":case"Int8Array":case"Uint16Array":case"Uint32Array":case"Uint8Array":case"Uint8ClampedArray":return a.byteLength===b.byteLength?a.every((value,ndx)=>value===b[ndx]):!1;case"BigInt":case"Number":case"Promise":case"String":case"Generator":return!1;default:dvB=new ZeroDepError(`Cannot compare ${typeA} values`);throw dvB.value=a,dvB}},isEqual=(val1,val2)=>{try{return compare(val1,val2)}catch(err){if(err instanceof ZeroDepError)throw err;return!1}};exports.isEqual=isEqual;