text: !function(e,t){"use strict";function o(){this.sendErrors=!1,this.endpoint="",this.interval=0,this.session="",this.timestamp="",this.hostName="",this.sourceCategory="",this.name="",this.onSuccess=!1,this.onError=!1}function s(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0,o="x"===e?t:3&t|8;return o.toString(16)})}function n(t){e&&e.console&&"function"==typeof e.console.log&&console.log(t)}function i(t,o){if(t.sendErrors=o,t.sendErrors===!0){var s=e.onerror;e.onerror=function(o,n,i,r){o="message: "+o+", url: "+n+", line_num: "+i+", col_num: "+r,t.log({error:"BrowserJsException",exception:o}),s&&"function"==typeof s&&s.apply(e,arguments)}}}var r="sumologic.logger.session",a=r.length+1,u=[];o.prototype={reset:function(){u=[],this.endpoint="",this.interval=0,this.session="",this.timestamp="",this.hostName="",this.sourceCategory="",this.name=""},getCurrentLogs:function(){return u},setSession:function(e){e?(this.session=e,this.setCookie(this.session)):this.session||(this.session=this.getCookie(),this.session||(this.session=s(),this.setCookie(this.session)))},config:function(e){if(!e||"object"!=typeof e)return void n("Sumo Logic Logger requires you to set an endpoint.");if(!e.endpoint||""===e.endpoint)return void n("Sumo Logic Logger requires you to set an endpoint.");if(this.endpoint=e.endpoint,e.interval&&(this.interval=e.interval),this.setSession(e.sessionKey?e.sessionKey:s()),e.sendErrors&&i(this,e.sendErrors),e.sourceName&&(this.name=e.sourceName),e.sourceCategory&&(this.sourceCategory=e.sourceCategory),e.hostName&&(this.hostName=e.hostName),e.onSuccess&&(this.onSuccess=e.onSuccess),e.onError&&(this.onError=e.onError),this.interval>0){var t=this;setInterval(function(){t.sendLogs()},this.interval)}},log:function(t,o){if(""===this.endpoint)return void n("Sumo Logic Logger requires you to set an endpoint before pushing logs.");if(!t)return void n("Sumo Logic Logger requires that you pass a value to log.");o=o||!1;var s=t instanceof Array,i=s?t[0]:t,r=typeof i;if("undefined"===r||"string"===r&&""===i)return void n("Sumo Logic Logger requires that you pass a value to log.");if("object"===r&&0===Object.keys(t).length)return void n("Sumo Logic Logger requires that you pass a non-empty JSON object to log.");s||(t=[t]);var a=new Date;o&&(o.sessionKey&&this.setSession(o.sessionKey),o.timestamp&&(a=o.timestamp)),this.timestamp=a.toUTCString();var c=this,h=t.map(function(t){if("string"==typeof t)return JSON.stringify({msg:t,sessionId:c.session,url:encodeURI(e.location),timestamp:c.timestamp});var o={sessionId:c.session,url:encodeURI(e.location),timestamp:c.timestamp};return Object.keys(t).forEach(function(e){o[e]=t[e]}),JSON.stringify(o)});u=u.concat(h),0===this.interval&&this.sendLogs()},logSent:function(){},sendLogs:function(){if(0!==u.length){var e;try{var t=new XMLHttpRequest;e=u,u=[];var o=this.onError;if(t.addEventListener("error",function(){u=e,o&&o()}),this.onSuccess){var s=this.onSuccess;t.addEventListener("load",function(){s()})}t.open("POST",this.endpoint+"?callback=logSent",!0),t.setRequestHeader("Content-Type","application/json"),""!==this.name&&t.setRequestHeader("X-Sumo-Name",this.name),""!==this.sourceCategory&&t.setRequestHeader("X-Sumo-Category",this.sourceCategory),""!==this.hostName&&t.setRequestHeader("X-Sumo-Host",this.hostName),t.send(e.join("\n"))}catch(n){u=e,this.onError&&this.onError()}}},flushLogs:function(){this.sendLogs()},emptyLogQueue:function(){u=[]},getCookie:function(){var e=t.cookie,o=e.indexOf(r);if(0>o)return!1;var s=e.indexOf(";",o+1);return s=0>s?e.length:s,e.slice(o+a,s)},setCookie:function(e){t.cookie=r+"="+e}};var c=e.SLLogger,h=new o;if(c&&c.length){var g=0,f=c.length;for(g=0;f>g;g++)h.log(c[g])}e.SLLogger=h,e.SumoLogger=o}(window,document);