"use strict";var C=Object.create;var a=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var o=(r,t)=>a(r,"name",{value:t,configurable:!0});var B=(r,t)=>{for(var e in t)a(r,e,{get:t[e],enumerable:!0})},p=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of E(t))!D.call(r,s)&&s!==e&&a(r,s,{get:()=>t[s],enumerable:!(n=x(t,s))||n.enumerable});return r};var y=(r,t,e)=>(e=r!=null?C(S(r)):{},p(t||!r||!r.__esModule?a(e,"default",{value:r,enumerable:!0}):e,r)),P=r=>p(a({},"__esModule",{value:!0}),r);var _={};B(_,{default:()=>u,errToJson:()=>f,jsonStringify:()=>b,stringifyClone:()=>h,stringifyReplacer:()=>m});module.exports=P(_);var d=y(require("debug")),i=y(require("lodash"));var g,u=class{static{o(this,"Debug")}debugers=new Map;filter;name="debug";async install(t){let{ultra:e}=t;return i.default.isNil(g)&&(g=t.Buffer),e.emitter.on("error",n=>{let s=f(n);e.emitter.emit("debug","error",b(s)),console.error(s)}),e.emitter.on("debug",(n,s,...c)=>{if(!(this.filter?.(n,s,...c)??!0))return;let l=this.debugers.get(n)??(0,d.default)(`ultra:${n}`);this.debugers.has(n)||this.debugers.set(n,l),l(s,...c)}),this}};((globalThis??{}).ChameleonUltraJS??{}).Debug=u;var T=["address","args","code","data","dest","errno","info","message","name","path","port","positions","reason","response.data","response.headers","response.status","source","stack","status","statusCode","statusMessage","syscall"];function f(r){return{...i.default.pick(r,T),...i.default.isNil(r.originalError)?{}:{originalError:f(r.originalError)}}}o(f,"errToJson");function h(r){let t=new Set;return i.default.cloneDeepWith(r,e=>{if(i.default.isObject(e)&&!i.default.isEmpty(e)){if(t.has(e))return"[Circular]";t.add(e)}if(g?.isBuffer(e))return{type:"Buffer",hex:e.toString("hex")};if(typeof e=="bigint")return e.toString();if(e instanceof Error)return f(e);if(e instanceof Map)return i.default.fromPairs([...e.entries()]);if(e instanceof Set)return[...e.values()];if(e instanceof Date)return e.toISOString()})}o(h,"stringifyClone");function m(r,t){if(r.length>1&&r[0]==="_")return;let e=this?._censored??[];for(let n of e)i.default.hasIn(this,n)&&i.default.set(this,n,"[Censored]");return delete this?._censored,this[r]}o(m,"stringifyReplacer");function b(r,t){return JSON.stringify(h(r),m,t)}o(b,"jsonStringify");0&&(module.exports={errToJson,jsonStringify,stringifyClone,stringifyReplacer});
//# sourceMappingURL=Debug.js.map