🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@libp2p/logger

Package Overview
Dependencies
Maintainers
6
Versions
854
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@libp2p/logger - npm Package Compare versions

Comparing version
6.2.8
to
6.2.9-08898d7df
+4
-4
dist/index.min.js
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PLogger = factory()}(typeof self !== 'undefined' ? self : this, function () {
"use strict";var Libp2PLogger=(()=>{var N=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var re=Object.getOwnPropertyNames;var te=Object.prototype.hasOwnProperty;var ne=(e,r)=>{for(var t in r)N(e,t,{get:r[t],enumerable:!0})},oe=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of re(r))!te.call(e,o)&&o!==t&&N(e,o,{get:()=>r[o],enumerable:!(n=ee(r,o))||n.enumerable});return e};var se=e=>oe(N({},"__esModule",{value:!0}),e);var Ne={};ne(Ne,{defaultLogger:()=>$e,disable:()=>ke,enable:()=>Me,enabled:()=>Le,logger:()=>L,peerLogger:()=>Ue,prefixLogger:()=>Y});var ze=new Uint8Array(0);function T(e){if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return D(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return D(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));throw new Error("Unknown type, must be binary type")}function ie(e){return e?.buffer instanceof ArrayBuffer}function D(e){return ie(e)?e:e.slice()}function ae(e,r){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var o=0;o<e.length;o++){var u=e.charAt(o),l=u.charCodeAt(0);if(t[l]!==255)throw new TypeError(u+" is ambiguous");t[l]=o}var d=e.length,A=e.charAt(0),E=Math.log(d)/Math.log(256),s=Math.log(256)/Math.log(d);function i(a){if(a instanceof Uint8Array||(ArrayBuffer.isView(a)?a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength):Array.isArray(a)&&(a=Uint8Array.from(a))),!(a instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(a.length===0)return"";for(var b=0,p=0,f=0,h=a.length;f!==h&&a[f]===0;)f++,b++;for(var g=(h-f)*s+1>>>0,x=new Uint8Array(g);f!==h;){for(var C=a[f],v=0,w=g-1;(C!==0||v<p)&&w!==-1;w--,v++)C+=256*x[w]>>>0,x[w]=C%d>>>0,C=C/d>>>0;if(C!==0)throw new Error("Non-zero carry");p=v,f++}for(var F=g-p;F!==g&&x[F]===0;)F++;for(var U=A.repeat(b);F<g;++F)U+=e.charAt(x[F]);return U}function c(a){if(typeof a!="string")throw new TypeError("Expected String");if(a.length===0)return new Uint8Array;var b=0;if(a[b]!==" "){for(var p=0,f=0;a[b]===A;)p++,b++;for(var h=(a.length-b)*E+1>>>0,g=new Uint8Array(h);a[b];){var x=t[a.charCodeAt(b)];if(x===255)return;for(var C=0,v=h-1;(x!==0||C<f)&&v!==-1;v--,C++)x+=d*g[v]>>>0,g[v]=x%256>>>0,x=x/256>>>0;if(x!==0)throw new Error("Non-zero carry");f=C,b++}if(a[b]!==" "){for(var w=h-f;w!==h&&g[w]===0;)w++;for(var F=new Uint8Array(p+(h-w)),U=p;w!==h;)F[U++]=g[w++];return F}}}function S(a){var b=c(a);if(b)return b;throw new Error(`Non-${r} character`)}return{encode:i,decodeUnsafe:c,decode:S}}var fe=ae,ue=fe,J=ue;var O=class{name;prefix;baseEncode;constructor(r,t,n){this.name=r,this.prefix=t,this.baseEncode=n}encode(r){if(r instanceof Uint8Array)return`${this.prefix}${this.baseEncode(r)}`;throw Error("Unknown type, must be binary type")}},z=class{name;prefix;baseDecode;prefixCodePoint;constructor(r,t,n){this.name=r,this.prefix=t;let o=t.codePointAt(0);if(o===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=o,this.baseDecode=n}decode(r){if(typeof r=="string"){if(r.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(r)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(r.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(r){return R(this,r)}},j=class{decoders;constructor(r){this.decoders=r}or(r){return R(this,r)}decode(r){let t=r[0],n=this.decoders[t];if(n!=null)return n.decode(r);throw RangeError(`Unable to decode multibase string ${JSON.stringify(r)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function R(e,r){return new j({...e.decoders??{[e.prefix]:e},...r.decoders??{[r.prefix]:r}})}var I=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(r,t,n,o){this.name=r,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new O(r,t,n),this.decoder=new z(r,t,o)}encode(r){return this.encoder.encode(r)}decode(r){return this.decoder.decode(r)}};function V({name:e,prefix:r,encode:t,decode:n}){return new I(e,r,t,n)}function P({name:e,prefix:r,alphabet:t}){let{encode:n,decode:o}=J(t,e);return V({prefix:r,name:e,encode:n,decode:u=>T(o(u))})}function ce(e,r,t,n){let o=e.length;for(;e[o-1]==="=";)--o;let u=new Uint8Array(o*t/8|0),l=0,d=0,A=0;for(let E=0;E<o;++E){let s=r[e[E]];if(s===void 0)throw new SyntaxError(`Non-${n} character`);d=d<<t|s,l+=t,l>=8&&(l-=8,u[A++]=255&d>>l)}if(l>=t||(255&d<<8-l)!==0)throw new SyntaxError("Unexpected end of data");return u}function le(e,r,t){let n=r[r.length-1]==="=",o=(1<<t)-1,u="",l=0,d=0;for(let A=0;A<e.length;++A)for(d=d<<8|e[A],l+=8;l>t;)l-=t,u+=r[o&d>>l];if(l!==0&&(u+=r[o&d<<t-l]),n)for(;(u.length*t&7)!==0;)u+="=";return u}function de(e){let r={};for(let t=0;t<e.length;++t)r[e[t]]=t;return r}function y({name:e,prefix:r,bitsPerChar:t,alphabet:n}){let o=de(n);return V({prefix:r,name:e,encode(u){return le(u,n,t)},decode(u){return ce(u,o,t,e)}})}var q=y({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Je=y({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Re=y({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Ve=y({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),qe=y({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Ge=y({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Xe=y({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Ze=y({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Ke=y({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var G=P({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),_e=P({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var X=y({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),er=y({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),rr=y({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),tr=y({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});function k(e,r){if(typeof e=="string")return pe(e);if(typeof e=="number")return me(e,r);throw new Error(`Value provided to ms() must be a string or number. value=${JSON.stringify(e)}`)}function pe(e){if(typeof e!="string"||e.length===0||e.length>100)throw new Error(`Value provided to ms.parse() must be a string with length between 1 and 99. value=${JSON.stringify(e)}`);let r=/^(?<value>-?\d*\.?\d+) *(?<unit>milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|months?|mo|years?|yrs?|y)?$/i.exec(e);if(!r?.groups)return NaN;let{value:t,unit:n="ms"}=r.groups,o=parseFloat(t),u=n.toLowerCase();switch(u){case"years":case"year":case"yrs":case"yr":case"y":return o*315576e5;case"months":case"month":case"mo":return o*26298e5;case"weeks":case"week":case"w":return o*6048e5;case"days":case"day":case"d":return o*864e5;case"hours":case"hour":case"hrs":case"hr":case"h":return o*36e5;case"minutes":case"minute":case"mins":case"min":case"m":return o*6e4;case"seconds":case"second":case"secs":case"sec":case"s":return o*1e3;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return o;default:throw new Error(`Unknown unit "${u}" provided to ms.parse(). value=${JSON.stringify(e)}`)}}function he(e){let r=Math.abs(e);return r>=315576e5?`${Math.round(e/315576e5)}y`:r>=26298e5?`${Math.round(e/26298e5)}mo`:r>=6048e5?`${Math.round(e/6048e5)}w`:r>=864e5?`${Math.round(e/864e5)}d`:r>=36e5?`${Math.round(e/36e5)}h`:r>=6e4?`${Math.round(e/6e4)}m`:r>=1e3?`${Math.round(e/1e3)}s`:`${e}ms`}function be(e){let r=Math.abs(e);return r>=315576e5?$(e,r,315576e5,"year"):r>=26298e5?$(e,r,26298e5,"month"):r>=6048e5?$(e,r,6048e5,"week"):r>=864e5?$(e,r,864e5,"day"):r>=36e5?$(e,r,36e5,"hour"):r>=6e4?$(e,r,6e4,"minute"):r>=1e3?$(e,r,1e3,"second"):`${e} ms`}function me(e,r){if(typeof e!="number"||!Number.isFinite(e))throw new Error("Value provided to ms.format() must be of type number.");return r?.long?be(e):he(e)}function $(e,r,t,n){let o=r>=t*1.5;return`${Math.round(e/t)} ${n}${o?"s":""}`}function B(e){t.debug=t,t.default=t,t.coerce=A,t.disable=u,t.enable=o,t.enabled=l,t.humanize=k,t.destroy=E,Object.keys(e).forEach(s=>{t[s]=e[s]}),t.names=[],t.skips=[],t.formatters={};function r(s){let i=0;for(let c=0;c<s.length;c++)i=(i<<5)-i+s.charCodeAt(c),i|=0;return t.colors[Math.abs(i)%t.colors.length]}t.selectColor=r;function t(s,i){let c,S=null,a,b;function p(...f){if(!p.enabled)return;let h=p,g=Number(new Date),x=g-(c||g);h.diff=x,h.prev=c,h.curr=g,c=g,f[0]=t.coerce(f[0]),typeof f[0]!="string"&&f.unshift("%O");let C=0;f[0]=f[0].replace(/%([a-zA-Z%])/g,(w,F)=>{if(w==="%%")return"%";C++;let U=t.formatters[F];if(typeof U=="function"){let H=f[C];w=U.call(h,H),f.splice(C,1),C--}return w}),t.formatArgs.call(h,f),i?.onLog!=null&&i.onLog(...f),(h.log||t.log).apply(h,f)}return p.namespace=s,p.useColors=t.useColors(),p.color=t.selectColor(s),p.extend=n,p.destroy=t.destroy,Object.defineProperty(p,"enabled",{enumerable:!0,configurable:!1,get:()=>S!==null?S:(a!==t.namespaces&&(a=t.namespaces,b=t.enabled(s)),b),set:f=>{S=f}}),typeof t.init=="function"&&t.init(p),p}function n(s,i){let c=t(this.namespace+(typeof i>"u"?":":i)+s);return c.log=this.log,c}function o(s){t.save(s),t.namespaces=s,t.names=[],t.skips=[];let i,c=(typeof s=="string"?s:"").split(/[\s,]+/),S=c.length;for(i=0;i<S;i++)c[i]&&(s=c[i].replace(/\*/g,".*?"),s[0]==="-"?t.skips.push(new RegExp("^"+s.substr(1)+"$")):t.names.push(new RegExp("^"+s+"$")))}function u(){let s=[...t.names.map(d),...t.skips.map(d).map(i=>"-"+i)].join(",");return t.enable(""),s}function l(s){if(s[s.length-1]==="*")return!0;let i,c;for(i=0,c=t.skips.length;i<c;i++)if(t.skips[i].test(s))return!1;for(i=0,c=t.names.length;i<c;i++)if(t.names[i].test(s))return!0;return!1}function d(s){return s.toString().substring(2,s.toString().length-2).replace(/\.\*\?$/,"*")}function A(s){return s instanceof Error?s.stack??s.message:s}function E(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.setupFormatters(t.formatters),t.enable(t.load()),t}var M=Ae(),ge=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Ce(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent?.toLowerCase().match(/(edge|trident)\/(\d+)/)!=null?!1:typeof document<"u"&&document.documentElement?.style?.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent?.toLowerCase().match(/firefox\/(\d+)/)!=null&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent?.toLowerCase().match(/applewebkit\/(\d+)/)}function we(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+k(this.diff),!this.useColors)return;let r="color: "+this.color;e.splice(1,0,r,"color: inherit");let t=0,n=0;e[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(t++,o==="%c"&&(n=t))}),e.splice(n,0,r)}var ye=console.debug??console.log??(()=>{});function xe(e){try{e?M?.setItem("debug",e):M?.removeItem("debug")}catch{}}function Fe(){let e;try{e=M?.getItem("debug")}catch{}return!e&&typeof globalThis.process<"u"&&"env"in globalThis.process&&(e=globalThis.process.env.DEBUG),e}function Ae(){try{return localStorage}catch{}}function ve(e){e.j=function(r){try{return JSON.stringify(r)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}var Z=B({formatArgs:we,save:xe,load:Fe,useColors:Ce,setupFormatters:ve,colors:ge,storage:M,log:ye});var m=Z;function K(e,r={}){let t=r.prefixLength??2,n=r.suffixLength??4,o=e.toString();return`${o.substring(0,t)}\u2026${o.substring(o.length,o.length-n)}`}m.formatters.b=e=>e==null?"undefined":G.baseEncode(e);m.formatters.t=e=>e==null?"undefined":q.baseEncode(e);m.formatters.m=e=>e==null?"undefined":X.baseEncode(e);m.formatters.p=e=>e==null?"undefined":e.toString();m.formatters.c=e=>e==null?"undefined":e.toString();m.formatters.k=e=>e==null?"undefined":e.toString();m.formatters.a=e=>e==null?"undefined":e.toString();function Q(e,r=""){let t=W(e.message),n=W(e.stack);return t!=null&&n!=null?n.includes(t)?`${n.split(`
"use strict";var Libp2PLogger=(()=>{var z=Object.defineProperty;var te=Object.getOwnPropertyDescriptor;var ne=Object.getOwnPropertyNames;var oe=Object.prototype.hasOwnProperty;var se=(e,r)=>{for(var t in r)z(e,t,{get:r[t],enumerable:!0})},ie=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of ne(r))!oe.call(e,o)&&o!==t&&z(e,o,{get:()=>r[o],enumerable:!(n=te(r,o))||n.enumerable});return e};var ae=e=>ie(z({},"__esModule",{value:!0}),e);var Oe={};se(Oe,{defaultLogger:()=>Ie,disable:()=>Le,enable:()=>Me,enabled:()=>Ne,logger:()=>O,peerLogger:()=>ke,prefixLogger:()=>re});var je=new Uint8Array(0);function V(e){if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return J(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return J(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));throw new Error("Unknown type, must be binary type")}function fe(e){return e?.buffer instanceof ArrayBuffer}function J(e){return fe(e)?e:e.slice()}function ue(e,r,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),o=0;o<n.length;o++)n[o]=255;for(var f=0;f<e.length;f++){var u=e.charAt(f),d=u.charCodeAt(0);if(n[d]!==255)throw new TypeError(u+" is ambiguous");if(n[d]=f,t){var v=u.toLowerCase().charCodeAt(0),S=u.toUpperCase().charCodeAt(0);v!==d&&(n[v]=f),S!==d&&(n[S]=f)}}var s=e.length,a=e.charAt(0),l=Math.log(s)/Math.log(256),U=Math.log(256)/Math.log(s);function I(i){if(i instanceof Uint8Array||(ArrayBuffer.isView(i)?i=new Uint8Array(i.buffer,i.byteOffset,i.byteLength):Array.isArray(i)&&(i=Uint8Array.from(i))),!(i instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(i.length===0)return"";for(var c=0,y=0,C=0,m=i.length;C!==m&&i[C]===0;)C++,c++;for(var F=(m-C)*U+1>>>0,h=new Uint8Array(F);C!==m;){for(var x=i[C],A=0,g=F-1;(x!==0||A<y)&&g!==-1;g--,A++)x+=256*h[g]>>>0,h[g]=x%s>>>0,x=x/s>>>0;if(x!==0)throw new Error("Non-zero carry");y=A,C++}for(var E=F-y;E!==F&&h[E]===0;)E++;for(var L=a.repeat(c);E<F;++E)L+=e.charAt(h[E]);return L}function k(i){if(typeof i!="string")throw new TypeError("Expected String");if(i.length===0)return new Uint8Array;var c=0;if(i[c]!==" "){for(var y=0,C=0;i[c]===a;)y++,c++;for(var m=(i.length-c)*l+1>>>0,F=new Uint8Array(m);i[c];){var h=n[i.charCodeAt(c)];if(h===255)return;for(var x=0,A=m-1;(h!==0||x<C)&&A!==-1;A--,x++)h+=s*F[A]>>>0,F[A]=h%256>>>0,h=h/256>>>0;if(h!==0)throw new Error("Non-zero carry");C=x,c++}if(i[c]!==" "){for(var g=m-C;g!==m&&F[g]===0;)g++;for(var E=new Uint8Array(y+(m-g)),L=y;g!==m;)E[L++]=F[g++];return E}}}function w(i){var c=k(i);if(c)return c;throw new Error(`Non-${r} character`)}return{encode:I,decodeUnsafe:k,decode:w}}var ce=ue,le=ce,G=le;var j=class{name;prefix;baseEncode;constructor(r,t,n){this.name=r,this.prefix=t,this.baseEncode=n}encode(r){if(r instanceof Uint8Array)return`${this.prefix}${this.baseEncode(r)}`;throw Error("Unknown type, must be binary type")}},P=class{name;prefix;baseDecode;prefixCodePoint;constructor(r,t,n){this.name=r,this.prefix=t;let o=t.codePointAt(0);if(o===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=o,this.baseDecode=n}decode(r){if(typeof r=="string"){if(r.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(r)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(r.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(r){return q(this,r)}},B=class{decoders;constructor(r){this.decoders=r}or(r){return q(this,r)}decode(r){let t=r[0],n=this.decoders[t];if(n!=null)return n.decode(r);throw RangeError(`Unable to decode multibase string ${JSON.stringify(r)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function q(e,r){return new B({...e.decoders??{[e.prefix]:e},...r.decoders??{[r.prefix]:r}})}var D=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(r,t,n,o){this.name=r,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new j(r,t,n),this.decoder=new P(r,t,o)}encode(r){return this.encoder.encode(r)}decode(r){return this.decoder.decode(r)}};function X({name:e,prefix:r,encode:t,decode:n}){return new D(e,r,t,n)}function R({name:e,prefix:r,alphabet:t,caseInsensitive:n=!1}){let{encode:o,decode:f}=G(t,e,n);return X({prefix:r,name:e,encode:o,decode:u=>V(f(u))})}function de(e,r,t,n){let o=e.length;for(;e[o-1]==="=";)--o;let f=new Uint8Array(o*t/8|0),u=0,d=0,v=0;for(let S=0;S<o;++S){let s=r[e[S]];if(s===void 0)throw new SyntaxError(`Non-${n} character`);d=d<<t|s,u+=t,u>=8&&(u-=8,f[v++]=255&d>>u)}if(u>=t||(255&d<<8-u)!==0)throw new SyntaxError("Unexpected end of data");return f}function pe(e,r,t){let n=r[r.length-1]==="=",o=(1<<t)-1,f="",u=0,d=0;for(let v=0;v<e.length;++v)for(d=d<<8|e[v],u+=8;u>t;)u-=t,f+=r[o&d>>u];if(u!==0&&(f+=r[o&d<<t-u]),n)for(;(f.length*t&7)!==0;)f+="=";return f}function he(e,r){let t={};for(let n=0;n<e.length;++n)if(t[e[n]]=n,r){let o=e[n].toLowerCase(),f=e[n].toUpperCase();o!==e[n]&&(t[o]=n),f!==e[n]&&(t[f]=n)}return t}function b({name:e,prefix:r,bitsPerChar:t,alphabet:n,caseInsensitive:o=!1}){let f=he(n,o);return X({prefix:r,name:e,encode(u){return pe(u,n,t)},decode(u){return de(u,f,t,e)}})}var _=b({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5,caseInsensitive:!0}),Ve=b({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5,caseInsensitive:!0}),Ge=b({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5,caseInsensitive:!0}),qe=b({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5,caseInsensitive:!0}),Xe=b({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5,caseInsensitive:!0}),_e=b({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5,caseInsensitive:!0}),Ze=b({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5,caseInsensitive:!0}),Ke=b({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5,caseInsensitive:!0}),Qe=b({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Z=R({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Ye=R({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var K=b({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),tr=b({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),nr=b({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),or=b({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});function M(e,r){if(typeof e=="string")return me(e);if(typeof e=="number")return ge(e,r);throw new Error(`Value provided to ms() must be a string or number. value=${JSON.stringify(e)}`)}function me(e){if(typeof e!="string"||e.length===0||e.length>100)throw new Error(`Value provided to ms.parse() must be a string with length between 1 and 99. value=${JSON.stringify(e)}`);let r=/^(?<value>-?\d*\.?\d+) *(?<unit>milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|months?|mo|years?|yrs?|y)?$/i.exec(e);if(!r?.groups)return NaN;let{value:t,unit:n="ms"}=r.groups,o=parseFloat(t),f=n.toLowerCase();switch(f){case"years":case"year":case"yrs":case"yr":case"y":return o*315576e5;case"months":case"month":case"mo":return o*26298e5;case"weeks":case"week":case"w":return o*6048e5;case"days":case"day":case"d":return o*864e5;case"hours":case"hour":case"hrs":case"hr":case"h":return o*36e5;case"minutes":case"minute":case"mins":case"min":case"m":return o*6e4;case"seconds":case"second":case"secs":case"sec":case"s":return o*1e3;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return o;default:throw new Error(`Unknown unit "${f}" provided to ms.parse(). value=${JSON.stringify(e)}`)}}function be(e){let r=Math.abs(e);return r>=315576e5?`${Math.round(e/315576e5)}y`:r>=26298e5?`${Math.round(e/26298e5)}mo`:r>=6048e5?`${Math.round(e/6048e5)}w`:r>=864e5?`${Math.round(e/864e5)}d`:r>=36e5?`${Math.round(e/36e5)}h`:r>=6e4?`${Math.round(e/6e4)}m`:r>=1e3?`${Math.round(e/1e3)}s`:`${e}ms`}function Ce(e){let r=Math.abs(e);return r>=315576e5?$(e,r,315576e5,"year"):r>=26298e5?$(e,r,26298e5,"month"):r>=6048e5?$(e,r,6048e5,"week"):r>=864e5?$(e,r,864e5,"day"):r>=36e5?$(e,r,36e5,"hour"):r>=6e4?$(e,r,6e4,"minute"):r>=1e3?$(e,r,1e3,"second"):`${e} ms`}function ge(e,r){if(typeof e!="number"||!Number.isFinite(e))throw new Error("Value provided to ms.format() must be of type number.");return r?.long?Ce(e):be(e)}function $(e,r,t,n){let o=r>=t*1.5;return`${Math.round(e/t)} ${n}${o?"s":""}`}function T(e){t.debug=t,t.default=t,t.coerce=v,t.disable=f,t.enable=o,t.enabled=u,t.humanize=M,t.destroy=S,Object.keys(e).forEach(s=>{t[s]=e[s]}),t.names=[],t.skips=[],t.formatters={};function r(s){let a=0;for(let l=0;l<s.length;l++)a=(a<<5)-a+s.charCodeAt(l),a|=0;return t.colors[Math.abs(a)%t.colors.length]}t.selectColor=r;function t(s,a){let l,U=null,I,k;function w(...i){if(!w.enabled)return;let c=w,y=Number(new Date),C=y-(l||y);c.diff=C,c.prev=l,c.curr=y,l=y,i[0]=t.coerce(i[0]),typeof i[0]!="string"&&i.unshift("%O");let m=0;i[0]=i[0].replace(/%([a-zA-Z%])/g,(h,x)=>{if(h==="%%")return"%";m++;let A=t.formatters[x];if(typeof A=="function"){let g=i[m];h=A.call(c,g),i.splice(m,1),m--}return h}),t.formatArgs.call(c,i),a?.onLog!=null&&a.onLog(...i),(c.log||t.log).apply(c,i)}return w.namespace=s,w.useColors=t.useColors(),w.color=t.selectColor(s),w.extend=n,w.destroy=t.destroy,Object.defineProperty(w,"enabled",{enumerable:!0,configurable:!1,get:()=>U!==null?U:(I!==t.namespaces&&(I=t.namespaces,k=t.enabled(s)),k),set:i=>{U=i}}),typeof t.init=="function"&&t.init(w),w}function n(s,a){let l=t(this.namespace+(typeof a>"u"?":":a)+s);return l.log=this.log,l}function o(s){t.save(s),t.namespaces=s,t.names=[],t.skips=[];let a,l=(typeof s=="string"?s:"").split(/[\s,]+/),U=l.length;for(a=0;a<U;a++)l[a]&&(s=l[a].replace(/\*/g,".*?"),s[0]==="-"?t.skips.push(new RegExp("^"+s.substr(1)+"$")):t.names.push(new RegExp("^"+s+"$")))}function f(){let s=[...t.names.map(d),...t.skips.map(d).map(a=>"-"+a)].join(",");return t.enable(""),s}function u(s){if(s[s.length-1]==="*")return!0;let a,l;for(a=0,l=t.skips.length;a<l;a++)if(t.skips[a].test(s))return!1;for(a=0,l=t.names.length;a<l;a++)if(t.names[a].test(s))return!0;return!1}function d(s){return s.toString().substring(2,s.toString().length-2).replace(/\.\*\?$/,"*")}function v(s){return s instanceof Error?s.stack??s.message:s}function S(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.setupFormatters(t.formatters),t.enable(t.load()),t}var N=Ee(),we=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function ye(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent?.toLowerCase().match(/(edge|trident)\/(\d+)/)!=null?!1:typeof document<"u"&&document.documentElement?.style?.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent?.toLowerCase().match(/firefox\/(\d+)/)!=null&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent?.toLowerCase().match(/applewebkit\/(\d+)/)}function xe(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+M(this.diff),!this.useColors)return;let r="color: "+this.color;e.splice(1,0,r,"color: inherit");let t=0,n=0;e[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(t++,o==="%c"&&(n=t))}),e.splice(n,0,r)}var Fe=console.debug??console.log??(()=>{});function Ae(e){try{e?N?.setItem("debug",e):N?.removeItem("debug")}catch{}}function ve(){let e;try{e=N?.getItem("debug")}catch{}return!e&&typeof globalThis.process<"u"&&"env"in globalThis.process&&(e=globalThis.process.env.DEBUG),e}function Ee(){try{return localStorage}catch{}}function Se(e){e.j=function(r){try{return JSON.stringify(r)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}var Q=T({formatArgs:xe,save:Ae,load:ve,useColors:ye,setupFormatters:Se,colors:we,storage:N,log:Fe});var p=Q;function W(e,r={}){let t=r.prefixLength??2,n=r.suffixLength??4,o=e.toString();return`${o.substring(0,t)}\u2026${o.substring(o.length,o.length-n)}`}p.formatters.b=e=>e==null?"undefined":Z.baseEncode(e);p.formatters.t=e=>e==null?"undefined":_.baseEncode(e);p.formatters.m=e=>e==null?"undefined":K.baseEncode(e);p.formatters.p=e=>e==null?"undefined":e.toString();p.formatters.c=e=>e==null?"undefined":e.toString();p.formatters.k=e=>e==null?"undefined":e.toString();p.formatters.a=e=>e==null?"undefined":e.toString();function H(e,r=""){let t=Y(e.message),n=Y(e.stack);return t!=null&&n!=null?n.includes(t)?`${n.split(`
`).join(`

@@ -9,7 +9,7 @@ ${r}`)}`:`${t}

`).join(`
${r}`)}`:t!=null?`${t}`:`${e.toString()}`}function Ee(e){return e instanceof AggregateError||e?.name==="AggregateError"&&Array.isArray(e.errors)}function _(e,r=""){if(Ee(e)){let t=Q(e,r);return e.errors.length>0?(r=`${r} `,t+=`
${r}${e.errors.map(n=>`${_(n,`${r}`)}`).join(`
${r}`)}`:t!=null?`${t}`:`${e.toString()}`}function Ue(e){return e instanceof AggregateError||e?.name==="AggregateError"&&Array.isArray(e.errors)}function ee(e,r=""){if(Ue(e)){let t=H(e,r);return e.errors.length>0?(r=`${r} `,t+=`
${r}${e.errors.map(n=>`${ee(n,`${r}`)}`).join(`
${r}`)}`):t+=`
${r}[Error list was empty]`,t.trim()}return Q(e,r)}m.formatters.e=e=>e==null?"undefined":_(e);function Se(e){let r=()=>{};return r.enabled=!1,r.color="",r.diff=0,r.log=()=>{},r.namespace=e,r.destroy=()=>!0,r.extend=()=>r,r.useColors=()=>!1,r}function Ue(e,r={}){return Y(K(e,r),r)}function Y(e,r){return{forComponent(t){return L(`${e}:${t}`,r)}}}function $e(e){return{forComponent(r){return L(r,e)}}}function L(e,r){let t=Se(`${e}:trace`);return m.enabled(`${e}:trace`)&&m.names.map(n=>n.toString()).find(n=>n.includes(":trace"))!=null&&(t=m(`${e}:trace`,r)),Object.assign(m(e,r),{error:m(`${e}:error`,r),trace:t,newScope:n=>L(`${e}:${n}`,r)})}function ke(){m.disable()}function Me(e){m.enable(e)}function Le(e){return m.enabled(e)}function W(e){if(e!=null&&(e=e.trim(),e.length!==0))return e}return se(Ne);})();
${r}[Error list was empty]`,t.trim()}return H(e,r)}p.formatters.e=e=>e==null?"undefined":ee(e);function $e(e){let r=()=>{};return r.enabled=!1,r.color="",r.diff=0,r.log=()=>{},r.namespace=e,r.destroy=()=>!0,r.extend=()=>r,r.useColors=()=>!1,r}function ke(e,r={}){return re(W(e,r),r)}function re(e,r){return{forComponent(t){return O(`${e}:${t}`,r)}}}function Ie(e){return{forComponent(r){return O(r,e)}}}function O(e,r){let t=$e(`${e}:trace`);return p.enabled(`${e}:trace`)&&p.names.map(n=>n.toString()).find(n=>n.includes(":trace"))!=null&&(t=p(`${e}:trace`,r)),Object.assign(p(e,r),{error:p(`${e}:error`,r),trace:t,newScope:n=>O(`${e}:${n}`,r)})}function Le(){p.disable()}function Me(e){p.enable(e)}function Ne(e){return p.enabled(e)}function Y(e){if(e!=null&&(e=e.trim(),e.length!==0))return e}return ae(Oe);})();
return Libp2PLogger}));
//# sourceMappingURL=index.min.js.map
{
"name": "@libp2p/logger",
"version": "6.2.8",
"version": "6.2.9-08898d7df",
"description": "A logging component for use in js-libp2p modules",

@@ -51,5 +51,5 @@ "license": "Apache-2.0 OR MIT",

"dependencies": {
"@libp2p/interface": "^3.2.3",
"@libp2p/interface": "3.2.4-08898d7df",
"@multiformats/multiaddr": "^13.0.3",
"interface-datastore": "^9.0.1",
"interface-datastore": "^10.0.1",
"multiformats": "^14.0.0",

@@ -59,4 +59,4 @@ "weald": "^1.1.0"

"devDependencies": {
"@libp2p/peer-id": "^6.0.10",
"aegir": "^48.0.11",
"@libp2p/peer-id": "6.0.11-08898d7df",
"aegir": "^48.1.1",
"sinon": "^21.0.0",

@@ -63,0 +63,0 @@ "uint8arrays": "^6.1.1"

{
"PeerLoggerOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_logger.PeerLoggerOptions.html",
".:PeerLoggerOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_logger.PeerLoggerOptions.html",
"defaultLogger": "https://libp2p.github.io/js-libp2p/functions/_libp2p_logger.defaultLogger.html",
".:defaultLogger": "https://libp2p.github.io/js-libp2p/functions/_libp2p_logger.defaultLogger.html",
"disable": "https://libp2p.github.io/js-libp2p/functions/_libp2p_logger.disable.html",
".:disable": "https://libp2p.github.io/js-libp2p/functions/_libp2p_logger.disable.html",
"enable": "https://libp2p.github.io/js-libp2p/functions/_libp2p_logger.enable.html",
".:enable": "https://libp2p.github.io/js-libp2p/functions/_libp2p_logger.enable.html",
"enabled": "https://libp2p.github.io/js-libp2p/functions/_libp2p_logger.enabled.html",
".:enabled": "https://libp2p.github.io/js-libp2p/functions/_libp2p_logger.enabled.html",
"logger": "https://libp2p.github.io/js-libp2p/functions/_libp2p_logger.logger.html",
".:logger": "https://libp2p.github.io/js-libp2p/functions/_libp2p_logger.logger.html",
"peerLogger": "https://libp2p.github.io/js-libp2p/functions/_libp2p_logger.peerLogger.html",
".:peerLogger": "https://libp2p.github.io/js-libp2p/functions/_libp2p_logger.peerLogger.html",
"prefixLogger": "https://libp2p.github.io/js-libp2p/functions/_libp2p_logger.prefixLogger.html",
".:prefixLogger": "https://libp2p.github.io/js-libp2p/functions/_libp2p_logger.prefixLogger.html"
}

Sorry, the diff of this file is too big to display