module.exports = "(function(o,e,t){var l=t(5894),s=t(7358),i=t(9404),n=t(4438),r=t(1571),g=t(4934);function c(){this.logLevel=null,this.logMatch=null,this.logs=[],this.timebase=i.now()}c.prototype.__isInitialized=function(){return!l.isNull(this.logLevel)},c.prototype.setLogLevel=function(o){var e=this.__resolveLogLevelName(o);__INVARIANT__&&t(2048).isType(\"LogLevel\",e),null===e?console.error(\"Unknown log level: \"+o):this.logLevel!==e&&(this.log(\"Setting log level to \"+e),this.logLevel=e,this.flush())},c.prototype.setLogMatcher=function(o){l.isString(o)?this.logMatcher=o:this.logMatcher=\"\",this.logGroup=0},c.prototype.shouldLog=function(o){return this.__isInitialized()&&this.logLevel>=o},c.prototype.matchesLogMessage=function(o,e){var t=this.logMatcher;if(!this.logMatcher)return!0;if(this.logGroup)return\"GROUPSTART\"===o?this.logGroup++:\"GROUPEND\"===o&&this.logGroup--,!0;var s=l.some(e,(function(o){if(!l.isString(o))try{o=g.stringify(o)}catch(o){}return l.isString(o)&&l.includes(o,t)}));return s&&\"GROUPSTART\"===o&&this.logGroup++,s},c.prototype.storeLog=function(o,e){var t={logLevel:o,logMessage:e};r.dispatch(s.LOG,t)},c.prototype.flush=function(){var o=t(4527).get(\"stores/log\");this.logGroup=0;var e=o.getLogs();l.each(e,l.bind((function(o){this.__logAt(o.logLevel,o.logMessage,!0)}),this))},c.prototype.__logAt=function(o,e,t){var s,i=o;if(console)switch(o){case\"GROUPSTART\":s=console.groupCollapsed,i=n.LogLevel.DEBUG;break;case\"GROUPEND\":s=console.groupEnd,i=n.LogLevel.DEBUG;break;case n.LogLevel.ERROR:s=console.error;break;case n.LogLevel.WARN:s=console.warn;break;case n.LogLevel.DEBUG:s=console.debug;break;default:s=console.log}try{t||!__STORE_LOG__&&this.__isInitialized()&&!this.shouldLog(i)||(l.isArray(e)&&l.isString(e[0])&&(e=this.__augmentArgsWithTimestamp(e)),this.storeLog(o,e)),s&&this.shouldLog(i)&&this.matchesLogMessage(o,e)&&s.apply(console,e)}catch(o){console&&(console.error?console.error(o):console.log(o))}},c.prototype.debug=function(){this.__logAt(n.LogLevel.DEBUG,[].slice.call(arguments))},c.prototype.log=function(){this.__logAt(n.LogLevel.INFO,[].slice.call(arguments))},c.prototype.logAlways=function(){var o=this.__augmentArgsWithTimestamp([].slice.call(arguments));console&&console.log&&console.log.apply&&console.log.apply(console,o),this.storeLog(n.LogLevel.INFO,o)},c.prototype.warn=function(){this.__logAt(n.LogLevel.WARN,[].slice.call(arguments))},c.prototype.error=function(o){var e=[].slice.call(arguments);1===e.length&&o.stack?(this.__logAt(n.LogLevel.ERROR,[this.__getTimestamp(),o]),this.__logAt(n.LogLevel.INFO,[o.stack])):this.__logAt(n.LogLevel.ERROR,e)},c.prototype.groupCollapsed=function(){this.__logAt(\"GROUPSTART\",[].slice.call(arguments))},c.prototype.groupEnd=function(){this.__logAt(\"GROUPEND\",[].slice.call(arguments))},c.prototype.__augmentArgsWithTimestamp=function(o){var e=this.__getTimestamp().toString();return e.length<6&&(e=(\"     \"+e).slice(-6)),[e+\"| Optly / \"+o[0]].concat(o.slice(1))},c.prototype.__getTimestamp=function(){return this.timebase?i.now()-this.timebase:0},c.prototype.__resolveLogLevelName=function(o){return o&&(\"TRUE\"===(o=o.toUpperCase())&&(o=\"INFO\"),\"FALSE\"===o&&(o=\"OFF\"),\"ALL\"===o&&(o=\"DEBUG\"),!l.isUndefined(n.LogLevel[o]))?n.LogLevel[o]:null},o.exports=new c})";