var u=t=>{throw TypeError(t)};var y=(t,i,s)=>i.has(t)||u("Cannot "+s);var l=(t,i,s)=>(y(t,i,"read from private field"),s?s.call(t):i.get(t)),f=(t,i,s)=>i.has(t)?u("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(t):i.set(t,s);function $(t){return typeof t=="string"?`'${t}'`:new p().serialize(t)}const p=function(){var i;class t{constructor(){f(this,i,new Map)}compare(e,r){const n=typeof e,o=typeof r;return n==="string"&&o==="string"?e.localeCompare(r):n==="number"&&o==="number"?e-r:String.prototype.localeCompare.call(this.serialize(e,!0),this.serialize(r,!0))}serialize(e,r){if(e===null)return"null";switch(typeof e){case"string":return r?e:`'${e}'`;case"bigint":return`${e}n`;case"object":return this.$object(e);case"function":return this.$function(e)}return String(e)}serializeObject(e){const r=Object.prototype.toString.call(e);if(r!=="[object Object]")return this.serializeBuiltInType(r.length<10?`unknown:${r}`:r.slice(8,-1),e);const n=e.constructor,o=n===Object||n===void 0?"":n.name;if(o!==""&&globalThis[o]===n)return this.serializeBuiltInType(o,e);if(typeof e.toJSON=="function"){const a=e.toJSON();return o+(a!==null&&typeof a=="object"?this.$object(a):`(${this.serialize(a)})`)}return this.serializeObjectEntries(o,Object.entries(e))}serializeBuiltInType(e,r){const n=this["$"+e];if(n)return n.call(this,r);if(typeof(r==null?void 0:r.entries)=="function")return this.serializeObjectEntries(e,r.entries());throw new Error(`Cannot serialize ${e}`)}serializeObjectEntries(e,r){const n=Array.from(r).sort((a,c)=>this.compare(a[0],c[0]));let o=`${e}{`;for(let a=0;a<n.length;a++){const[c,h]=n[a];o+=`${this.serialize(c,!0)}:${this.serialize(h)}`,a<n.length-1&&(o+=",")}return o+"}"}$object(e){let r=l(this,i).get(e);return r===void 0&&(l(this,i).set(e,`#${l(this,i).size}`),r=this.serializeObject(e),l(this,i).set(e,r)),r}$function(e){const r=Function.prototype.toString.call(e);return r.slice(-15)==="[native code] }"?`${e.name||""}()[native]`:`${e.name}(${e.length})${r.replace(/\s*\n\s*/g,"")}`}$Array(e){let r="[";for(let n=0;n<e.length;n++)r+=this.serialize(e[n]),n<e.length-1&&(r+=",");return r+"]"}$Date(e){try{return`Date(${e.toISOString()})`}catch{return"Date(null)"}}$ArrayBuffer(e){return`ArrayBuffer[${new Uint8Array(e).join(",")}]`}$Set(e){return`Set${this.$Array(Array.from(e).sort((r,n)=>this.compare(r,n)))}`}$Map(e){return this.serializeObjectEntries("Map",e.entries())}}i=new WeakMap;for(const s of["Error","RegExp","URL"])t.prototype["$"+s]=function(e){return`${s}(${e})`};for(const s of["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array"])t.prototype["$"+s]=function(e){return`${s}[${e.join(",")}]`};for(const s of["BigInt64Array","BigUint64Array"])t.prototype["$"+s]=function(e){return`${s}[${e.join("n,")}${e.length>0?"n":""}]`};return t}();function z(t,i){return t===i||$(t)===$(i)}export{z as i};
