UNPKG

@wireapp/cryptobox

Version:

High-level API with persistent storage for Proteus.

2 lines (1 loc) 5.24 kB
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.logdown=e():t.logdown=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,r){var n=r(1)(),o=r(3),i=r(5),s=r(8)();n.prefixColors=["#F2777A","#F99157","#FFCC66","#99CC99","#66CCCC","#6699CC","#CC99CC"],n._setPrefixRegExps=function(){try{s.localStorage&&"string"==typeof s.localStorage.getItem("debug")&&(n._prefixRegExps=[],s.localStorage.getItem("debug").split(",").forEach(function(t){var e="enable";"-"===(t=t.trim())[0]&&(t=t.substr(1),e="disable");var r=n._prepareRegExpForPrefixSearch(t);n._prefixRegExps.push({type:e,regExp:r})}))}catch(t){}},n._getNextPrefixColor=function(){var t=0;return function(){return t+=1,n.prefixColors[t%n.prefixColors.length]}}(),n.prototype._getDecoratedPrefix=function(){var t=[];return i()?(t.push("%c"+this.opts.prefix+"%c "),t.push("color:"+this.opts.prefixColor+"; font-weight:bold;","")):t.push("["+this.opts.prefix+"] "),t},n.prototype._prepareOutput=function(t){var e,r=this._getDecoratedPrefix();return"string"==typeof t[0]?this.opts.markdown&&i()?(e=o.parse(t[0]),r[0]=r[0]+e.text,r=r.concat(e.styles)):r[0]=r[0]+t[0]:r.push(t[0]),t.length>1&&(r=r.concat(t.slice(1))),r},n._setPrefixRegExps(),t.exports=n},function(t,e,r){var n=r(2);t.exports=function(){function t(e,r){return this instanceof t?t._isPrefixAlreadyInUse(e)?t._getInstanceByPrefix(e):(this.opts=t._normalizeOpts(e,r),this.state=t._getInitialState(this.opts),t._decorateLoggerMethods(this),t._instances.push(this),this):new t(e,r)}return t.transports=[],t._instances=[],t._prefixRegExps=[],t._prepareRegExpForPrefixSearch=function(t){return new RegExp("^"+t.replace(/\*/g,".*?")+"$")},t._isPrefixAlreadyInUse=function(e){return t._instances.some(function(t){return t.opts.prefix===e})},t._getInstanceByPrefix=function(e){return t._instances.filter(function(t){return t.opts.prefix===e})[0]},t._normalizeOpts=function(e,r){if("string"!=typeof e)throw new TypeError("prefix must be a string");var n=void 0===(r=r||{}).markdown||Boolean(r.markdown),o=r.prefixColor||t._getNextPrefixColor();return{logger:r.logger||console,markdown:n,prefix:e,prefixColor:o}},t._getInitialState=function(e){return{isEnabled:t._getEnableState(e)}},t._getEnableState=function(e){var r=!1;return t._prefixRegExps.forEach(function(t){"enable"===t.type&&t.regExp.test(e.prefix)?r=!0:"disable"===t.type&&t.regExp.test(e.prefix)&&(r=!1)}),r},t._decorateLoggerMethods=function(e){var r=e.opts.logger,o=Object.keys(r).filter(function(t){return"function"==typeof r[t]});0===o.length&&(o=["log","warn","error"]),o.forEach(function(o){e[o]=function(){var e=n(arguments),i=this.opts.prefix;if(t.transports.length){var s="["+i+"] "+e.filter(function(t){return"object"!=typeof t}).join(" ");t.transports.forEach(function(t){t({state:this.state,instance:i,level:o,args:e,msg:s})}.bind(this))}if(this.state.isEnabled){var f=this._prepareOutput(e,o);r[o].apply(r,f)}}})},t}},function(t,e){t.exports=function(t){return Array.prototype.slice.call(t,0)}},function(t,e,r){function n(t){return function(e){return o.push(t),o.push(""),"%c"+e+"%c"}}var o=[],i=new(r(4))({renderer:{"*":n("font-weight:bold;"),_:n("font-style:italic;"),"`":n("background-color:rgba(255,204,102, 0.1);color:#FFCC66;padding:2px 5px;border-radius:2px;")}});t.exports={parse:function(t){var e={text:i.parse(t),styles:[].concat(o)};return o.length=0,e}}},function(t,e){function r(t){this.renderer=t.renderer}function n(t){return i.test(t)}var o=/([_*`\\]|[^_*`\\]+)/g,i=/[_*`]/;r.prototype.parse=function(t){function e(t){for(var e="";r&&r.tag!==t;)e=r.tag+r.text+e,u[r.tag]=!1,r=c.pop();return e}for(var r,i,s,f=t.match(o),p=this.renderer,a="",c=[],u={},l=0;s=f[l];){if(i="",l++,n(s))if(u[s])i=e(s),i=p[r.tag](r.text+i),u[s]=!1,r=c.pop();else{var x="";if("`"===s){var g=f.indexOf(s,l);-1!==g&&(a+=e(),x=f.slice(l,g).join(""),l=g)}r&&c.push(r),u[s]=!0,r={tag:s,text:x}}else if(i=s,"\\"===s){var h=f[l];(n(h)||"\\"===h)&&(i=h,l++)}i&&(r?r.text+=i:a+=i,i="")}return a+=e()},t.exports=r},function(t,e,r){var n=r(6),o=r(7);t.exports=function(){return n()||o()}},function(t,e){t.exports=function(){try{return"WebkitAppearance"in document.documentElement.style&&!/Edge/.test(navigator.userAgent)}catch(t){return!1}}},function(t,e){t.exports=function(){try{return/firefox\/(\d+)/i.test(navigator.userAgent)}catch(t){return!1}}},function(t,e,r){(function(e){function r(t,e){return"object"==typeof t&&t.self===t&&t||"object"==typeof e&&e.global===e&&e||this}t.exports=r.bind(this,self,e),t.exports.getGlobal=r}).call(e,r(9))},function(t,e){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(r=window)}t.exports=r}])});