!function(e,t){function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function r(e){return"undefined"==typeof e}if(e){var i={},o=e.TraceKit,s=[].slice,a="?";i.noConflict=function(){return e.TraceKit=o,i},i.wrap=function(e){function t(){try{return e.apply(this,arguments)}catch(t){throw i.report(t),t}}return t},i.report=function(){function t(e){u(),h.push(e)}function r(e){for(var t=h.length-1;t>=0;--t)h[t]===e&&h.splice(t,1)}function o(e,t){var r=null;if(!t||i.collectWindowErrors){for(var o in h)if(n(h,o))try{h[o].apply(null,[e].concat(s.call(arguments,2)))}catch(a){r=a}if(r)throw r}}function a(e,t,n,r,s){var a=null;if(v)i.computeStackTrace.augmentStackTraceWithInitialElement(v,t,n,e),c();else if(s)a=i.computeStackTrace(s),o(a,!0);else{var u={url:t,line:n,column:r};u.func=i.computeStackTrace.guessFunctionName(u.url,u.line),u.context=i.computeStackTrace.gatherContext(u.url,u.line),a={mode:"onerror",message:e,stack:[u]},o(a,!0)}return!!f&&f.apply(this,arguments)}function u(){p!==!0&&(f=e.onerror,e.onerror=a,p=!0)}function c(){var e=v,t=d;d=null,v=null,g=null,o.apply(null,[e,!1].concat(t))}function l(t){if(v){if(g===t)return;c()}var n=i.computeStackTrace(t);throw v=n,g=t,d=s.call(arguments,1),e.setTimeout(function(){g===t&&c()},n.incomplete?2e3:0),t}var f,p,h=[],d=null,g=null,v=null;return l.subscribe=t,l.unsubscribe=r,l}(),i.computeStackTrace=function(){function t(t){if(!i.remoteFetching)return"";try{var n=function(){try{return new e.XMLHttpRequest}catch(t){return new e.ActiveXObject("Microsoft.XMLHTTP")}},r=n();return r.open("GET",t,!1),r.send(""),r.responseText}catch(o){return""}}function o(r){if("string"!=typeof r)return[];if(!n(_,r)){var i="",o="";try{o=e.document.domain}catch(s){}var a=/(.*)\:\/\/([^:\/]+)([:\d]*)\/{0,1}([\s\S]*)/.exec(r);a&&a[2]===o&&(i=t(r)),_[r]=i?i.split("\n"):[]}return _[r]}function s(e,t){var n,i=/function ([^(]*)\(([^)]*)\)/,s=/['"]?([0-9A-Za-z$_]+)['"]?\s*[:=]\s*(function|eval|new Function)/,u="",c=10,l=o(e);if(!l.length)return a;for(var f=0;f<c;++f)if(u=l[t-f]+u,!r(u)){if(n=s.exec(u))return n[1];if(n=i.exec(u))return n[1]}return a}function u(e,t){var n=o(e);if(!n.length)return null;var s=[],a=Math.floor(i.linesOfContext/2),u=a+i.linesOfContext%2,c=Math.max(0,t-a-1),l=Math.min(n.length,t+u-1);t-=1;for(var f=c;f<l;++f)r(n[f])||s.push(n[f]);return s.length>0?s:null}function c(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#]/g,"\\$&")}function l(e){return c(e).replace("<","(?:<|&lt;)").replace(">","(?:>|&gt;)").replace("&","(?:&|&amp;)").replace('"','(?:"|&quot;)').replace(/\s+/g,"\\s+")}function f(e,t){for(var n,r,i=0,s=t.length;i<s;++i)if((n=o(t[i])).length&&(n=n.join("\n"),r=e.exec(n)))return{url:t[i],line:n.substring(0,r.index).split("\n").length,column:r.index-n.lastIndexOf("\n",r.index)-1};return null}function p(e,t,n){var r,i=o(t),s=new RegExp("\\b"+c(e)+"\\b");return n-=1,i&&i.length>n&&(r=s.exec(i[n]))?r.index:null}function h(t){if(!r(e&&e.document)){for(var n,i,o,s,a=[e.location.href],u=e.document.getElementsByTagName("script"),p=""+t,h=/^function(?:\s+([\w$]+))?\s*\(([\w\s,]*)\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/,d=/^function on([\w$]+)\s*\(event\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/,g=0;g<u.length;++g){var v=u[g];v.src&&a.push(v.src)}if(o=h.exec(p)){var m=o[1]?"\\s+"+o[1]:"",y=o[2].split(",").join("\\s*,\\s*");n=c(o[3]).replace(/;$/,";?"),i=new RegExp("function"+m+"\\s*\\(\\s*"+y+"\\s*\\)\\s*{\\s*"+n+"\\s*}")}else i=new RegExp(c(p).replace(/\s+/g,"\\s+"));if(s=f(i,a))return s;if(o=d.exec(p)){var b=o[1];if(n=l(o[2]),i=new RegExp("on"+b+"=[\\'\"]\\s*"+n+"\\s*[\\'\"]","i"),s=f(i,a[0]))return s;if(i=new RegExp(n),s=f(i,a))return s}return null}}function d(e){if(!e.stack)return null;for(var t,n,i=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|webpack|eval).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,o=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|\[native).*?)(?::(\d+))?(?::(\d+))?\s*$/i,c=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,l=e.stack.split("\n"),f=[],h=/^(.*) is undefined$/.exec(e.message),d=0,g=l.length;d<g;++d){if(t=i.exec(l[d])){var v=t[2]&&t[2].indexOf("native")!==-1;n={url:v?null:t[2],func:t[1]||a,args:v?[t[2]]:[],line:t[3]?+t[3]:null,column:t[4]?+t[4]:null}}else if(t=c.exec(l[d]))n={url:t[2],func:t[1]||a,args:[],line:+t[3],column:t[4]?+t[4]:null};else{if(!(t=o.exec(l[d])))continue;n={url:t[3],func:t[1]||a,args:t[2]?t[2].split(","):[],line:t[4]?+t[4]:null,column:t[5]?+t[5]:null}}!n.func&&n.line&&(n.func=s(n.url,n.line)),n.line&&(n.context=u(n.url,n.line)),f.push(n)}return f.length?(f[0]&&f[0].line&&!f[0].column&&h?f[0].column=p(h[1],f[0].url,f[0].line):f[0].column||r(e.columnNumber)||(f[0].column=e.columnNumber+1),{mode:"stack",name:e.name,message:e.message,stack:f}):null}function g(e){var t=e.stacktrace;if(t){for(var n,r=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,i=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^\)]+))\((.*)\))? in (.*):\s*$/i,o=t.split("\n"),a=[],c=0;c<o.length;c+=2){var l=null;if((n=r.exec(o[c]))?l={url:n[2],line:+n[1],column:null,func:n[3],args:[]}:(n=i.exec(o[c]))&&(l={url:n[6],line:+n[1],column:+n[2],func:n[3]||n[4],args:n[5]?n[5].split(","):[]}),l){if(!l.func&&l.line&&(l.func=s(l.url,l.line)),l.line)try{l.context=u(l.url,l.line)}catch(f){}l.context||(l.context=[o[c+1]]),a.push(l)}}return a.length?{mode:"stacktrace",name:e.name,message:e.message,stack:a}:null}}function v(t){var r=t.message.split("\n");if(r.length<4)return null;var i,a=/^\s*Line (\d+) of linked script ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,c=/^\s*Line (\d+) of inline#(\d+) script in ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,p=/^\s*Line (\d+) of function script\s*$/i,h=[],d=e&&e.document&&e.document.getElementsByTagName("script"),g=[];for(var v in d)n(d,v)&&!d[v].src&&g.push(d[v]);for(var m=2;m<r.length;m+=2){var y=null;if(i=a.exec(r[m]))y={url:i[2],func:i[3],args:[],line:+i[1],column:null};else if(i=c.exec(r[m])){y={url:i[3],func:i[4],args:[],line:+i[1],column:null};var b=+i[1],S=g[i[2]-1];if(S){var x=o(y.url);if(x){x=x.join("\n");var _=x.indexOf(S.innerText);_>=0&&(y.line=b+x.substring(0,_).split("\n").length)}}}else if(i=p.exec(r[m])){var w=e.location.href.replace(/#.*$/,""),E=new RegExp(l(r[m+1])),I=f(E,[w]);y={url:w,func:"",args:[],line:I?I.line:i[1],column:null}}if(y){y.func||(y.func=s(y.url,y.line));var P=u(y.url,y.line),C=P?P[Math.floor(P.length/2)]:null;P&&C.replace(/^\s*/,"")===r[m+1].replace(/^\s*/,"")?y.context=P:y.context=[r[m+1]],h.push(y)}}return h.length?{mode:"multiline",name:t.name,message:r[0],stack:h}:null}function m(e,t,n,r){var i={url:t,line:n};if(i.url&&i.line){e.incomplete=!1,i.func||(i.func=s(i.url,i.line)),i.context||(i.context=u(i.url,i.line));var o=/ '([^']+)' /.exec(r);if(o&&(i.column=p(o[1],i.url,i.line)),e.stack.length>0&&e.stack[0].url===i.url){if(e.stack[0].line===i.line)return!1;if(!e.stack[0].line&&e.stack[0].func===i.func)return e.stack[0].line=i.line,e.stack[0].context=i.context,!1}return e.stack.unshift(i),e.partial=!0,!0}return e.incomplete=!0,!1}function y(e,t){for(var n,r,o,u=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,c=[],l={},f=!1,d=y.caller;d&&!f;d=d.caller)if(d!==b&&d!==i.report){if(r={url:null,func:a,args:[],line:null,column:null},d.name?r.func=d.name:(n=u.exec(d.toString()))&&(r.func=n[1]),"undefined"==typeof r.func)try{r.func=n.input.substring(0,n.input.indexOf("{"))}catch(g){}if(o=h(d)){r.url=o.url,r.line=o.line,r.func===a&&(r.func=s(r.url,r.line));var v=/ '([^']+)' /.exec(e.message||e.description);v&&(r.column=p(v[1],o.url,o.line))}l[""+d]?f=!0:l[""+d]=!0,c.push(r)}t&&c.splice(0,t);var S={mode:"callers",name:e.name,message:e.message,stack:c};return m(S,e.sourceURL||e.fileName,e.line||e.lineNumber,e.message||e.description),S}function b(e,t){var n=null;t=null==t?0:+t;try{if(n=g(e))return n}catch(r){if(x)throw r}try{if(n=d(e))return n}catch(r){if(x)throw r}try{if(n=v(e))return n}catch(r){if(x)throw r}try{if(n=y(e,t+1))return n}catch(r){if(x)throw r}return{mode:"failed"}}function S(e){e=(null==e?0:+e)+1;try{throw new Error}catch(t){return b(t,e+1)}}var x=!1,_={};return b.augmentStackTraceWithInitialElement=m,b.guessFunctionName=s,b.gatherContext=u,b.ofCaller=S,b.getSource=o,b}(),i.extendToAsynchronousCallbacks=function(){var t=function(t){var n=e[t];e[t]=function(){var e=s.call(arguments),t=e[0];return"function"==typeof t&&(e[0]=i.wrap(t)),n.apply?n.apply(this,e):n(e[0],e[1])}};t("setTimeout"),t("setInterval")},i.remoteFetching||(i.remoteFetching=!0),i.collectWindowErrors||(i.collectWindowErrors=!0),(!i.linesOfContext||i.linesOfContext<1)&&(i.linesOfContext=11),"undefined"!=typeof module&&module.exports&&e.module!==module?module.exports=i:"function"==typeof define&&define.amd?define("TraceKit",[],i):e.TraceKit=i}}("undefined"!=typeof window?window:global),function(e,t){var n,r,i;"function"==typeof define&&define.amd?define("exceptionless",["require","exports","module","TraceKit"],t):"object"==typeof r?i.exports=t(n,r,i,n("TraceKit")):e.exceptionless=t(n,r,i,e.TraceKit)}(this,function(e,t,n,r){function i(e,t){var n=/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)/g;if("string"==typeof t){var r=n.exec(t);if(r)return new Date(t)}return t}function o(){if(!document||!document.getElementsByTagName)return null;for(var e=document.getElementsByTagName("script"),t=0;t<e.length;t++)if(e[t].src&&e[t].src.indexOf("/exceptionless")>-1)return S.parseQueryString(e[t].src.split("?").pop());return null}function s(e,t){var n=E["default"].createUnhandledException(new Error(e.message||(t||{}).status||"Script error"),"onerror");n.pluginContextData["@@_TraceKit.StackTrace"]=e,n.submit()}if(e||(e=function(e){return("undefined"!=typeof window?window:global)[e]}),!t)var t={};var a=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},r=e("TraceKit"),u=function(){function e(e,t){this.success=!1,this.badRequest=!1,this.serviceUnavailable=!1,this.paymentRequired=!1,this.unableToAuthenticate=!1,this.notFound=!1,this.requestEntityTooLarge=!1,this.statusCode=e,this.message=t,this.success=e>=200&&e<=299,this.badRequest=400===e,this.serviceUnavailable=503===e,this.paymentRequired=402===e,this.unableToAuthenticate=401===e||403===e,this.notFound=404===e,this.requestEntityTooLarge=413===e}return e}();t.SubmissionResponse=u;var c=function(){function e(){}return e.onChanged=function(e){!!e&&this._handlers.push(e)},e.applySavedServerSettings=function(e){if(e&&e.isValid){var t=this.getSavedServerSettings(e);e.log.info("Applying saved settings: v"+t.version),e.settings=S.merge(e.settings,t.settings),this.changed(e)}},e.getVersion=function(e){if(!e||!e.isValid)return 0;var t=this.getSavedServerSettings(e);return t.version||0},e.checkVersion=function(e,t){var n=this.getVersion(t);e<=n||(t.log.info("Updating settings from v"+n+" to v"+e),this.updateSettings(t,n))},e.updateSettings=function(t,n){var r=this;if(t&&t.enabled){var i="Unable to update settings";if(!t.isValid)return void t.log.error(i+": ApiKey is not set.");(!n||n<0)&&(n=this.getVersion(t)),t.log.info("Checking for updated settings from: v"+n+"."),t.submissionClient.getSettings(t,n,function(n){if(!(t&&n&&n.success&&n.settings))return void t.log.warn(i+": "+n.message);t.settings=S.merge(t.settings,n.settings);var o=e.getSavedServerSettings(t);for(var s in o)n.settings[s]||delete t.settings[s];var a={version:n.settingsVersion,settings:n.settings};t.storage.settings.save(a),t.log.info("Updated settings: v"+a.version),r.changed(t)})}},e.changed=function(e){for(var t=this._handlers,n=0;n<t.length;n++)try{t[n](e)}catch(r){e.log.error("Error calling onChanged handler: "+r)}},e.getSavedServerSettings=function(e){var t=e.storage.settings.get()[0];return t&&t.value&&t.value.version&&t.value.settings?t.value:{version:0,settings:{}}},e._handlers=[],e}();t.SettingsManager=c;var l=function(){function e(){this._lastReferenceId=null}return e.prototype.getLast=function(){return this._lastReferenceId},e.prototype.clearLast=function(){this._lastReferenceId=null},e.prototype.setLast=function(e){this._lastReferenceId=e},e}();t.DefaultLastReferenceIdManager=l;var f=function(){function e(){}return e.prototype.trace=function(e){this.log("trace",e)},e.prototype.info=function(e){this.log("info",e)},e.prototype.warn=function(e){this.log("warn",e)},e.prototype.error=function(e){this.log("error",e)},e.prototype.log=function(e,t){if(console){var n="["+e+"] Exceptionless: "+t;console[e]?console[e](n):console.log&&console.log(n)}},e}();t.ConsoleLog=f;var p=function(){function e(){}return e.prototype.trace=function(e){},e.prototype.info=function(e){},e.prototype.warn=function(e){},e.prototype.error=function(e){},e}();t.NullLog=p;var h=function(){function e(e,t,n){this.client=e,this.event=t,this.contextData=n?n:new w}return Object.defineProperty(e.prototype,"log",{get:function(){return this.client.config.log},enumerable:!0,configurable:!0}),e}();t.EventPluginContext=h;var d=function(){function e(){}return e.run=function(e,t){var n=function(n,r){return function(){try{e.cancelled||n.run(e,r)}catch(i){e.cancelled=!0,e.log.error("Error running plugin '"+n.name+"': "+i.message+". Discarding Event.")}e.cancelled&&t&&t(e)}},r=e.client.config.plugins,i=[];t&&(i[r.length]=n({name:"cb",priority:9007199254740992,run:t},null));for(var o=r.length-1;o>-1;o--)i[o]=n(r[o],t||o<r.length-1?i[o+1]:null);i[0]()},e.addDefaultPlugins=function(e){e.addPlugin(new I),e.addPlugin(new P),e.addPlugin(new U),e.addPlugin(new M),e.addPlugin(new C),e.addPlugin(new T),e.addPlugin(new k),e.addPlugin(new R)},e}();t.EventPluginManager=d;var g=function(){function e(e){void 0===e&&(e=3e4),this.priority=100,this.name="HeartbeatPlugin",this._interval=e}return e.prototype.run=function(e,t){clearInterval(this._intervalId);var n=e.event.data["@user"];n&&n.identity&&(this._intervalId=setInterval(function(){return e.client.submitSessionHeartbeat(n.identity)},this._interval)),t&&t()},e}();t.HeartbeatPlugin=g;var v=function(){function e(){this.priority=20,this.name="ReferenceIdPlugin"}return e.prototype.run=function(e,t){e.event.reference_id&&0!==e.event.reference_id.length||"error"!==e.event.type||(e.event.reference_id=S.guid().replace("-","").substring(0,10)),t&&t()},e}();t.ReferenceIdPlugin=v;var m=function(){function e(e){this._handlers=[],this._processingQueue=!1,this._config=e}return e.prototype.enqueue=function(e){var t="The event will not be queued.",n=this._config,r=n.log;if(!n.enabled)return void r.info("Configuration is disabled. "+t);if(!n.isValid)return void r.info("Invalid Api Key. "+t);if(this.areQueuedItemsDiscarded())return void r.info("Queue items are currently being discarded. "+t);this.ensureQueueTimer();var i=n.storage.queue.save(e),o="type="+e.type+" "+(e.reference_id?"refid="+e.reference_id:"");i?r.info("Enqueuing event: "+i+" "+o):r.error("Could not enqueue event "+o)},e.prototype.process=function(e){var t=this,n="The queue will not be processed.",r=this._config,i=r.log;if(!this._processingQueue){if(i.info("Processing queue..."),!r.enabled)return void i.info("Configuration is disabled. "+n);if(!r.isValid)return void i.info("Invalid Api Key. "+n);this._processingQueue=!0,this.ensureQueueTimer();try{var o=r.storage.queue.get(r.submissionBatchSize);if(!o||0===o.length)return void(this._processingQueue=!1);i.info("Sending "+o.length+" events to "+r.serverUrl+"."),r.submissionClient.postEvents(o.map(function(e){return e.value}),r,function(e){t.processSubmissionResponse(e,o),t.eventsPosted(o.map(function(e){return e.value}),e),i.info("Finished processing queue."),t._processingQueue=!1},e)}catch(s){i.error("Error processing queue: "+s),this.suspendProcessing(),this._processingQueue=!1}}},e.prototype.suspendProcessing=function(e,t,n){var r=this._config;(!e||e<=0)&&(e=5),r.log.info("Suspending processing for "+e+" minutes."),this._suspendProcessingUntil=new Date((new Date).getTime()+6e4*e),t&&(this._discardQueuedItemsUntil=this._suspendProcessingUntil),n&&r.storage.queue.clear()},e.prototype.onEventsPosted=function(e){!!e&&this._handlers.push(e)},e.prototype.eventsPosted=function(e,t){for(var n=this._handlers,r=0;r<n.length;r++)try{n[r](e,t)}catch(i){this._config.log.error("Error calling onEventsPosted handler: "+i)}},e.prototype.areQueuedItemsDiscarded=function(){return this._discardQueuedItemsUntil&&this._discardQueuedItemsUntil>new Date},e.prototype.ensureQueueTimer=function(){var e=this;this._queueTimer||(this._queueTimer=setInterval(function(){return e.onProcessQueue()},1e4))},e.prototype.isQueueProcessingSuspended=function(){return this._suspendProcessingUntil&&this._suspendProcessingUntil>new Date},e.prototype.onProcessQueue=function(){this.isQueueProcessingSuspended()||this._processingQueue||this.process()},e.prototype.processSubmissionResponse=function(e,t){var n="The event will not be submitted.",r=this._config,i=r.log;if(e.success)return i.info("Sent "+t.length+" events."),void this.removeEvents(t);if(e.serviceUnavailable)return i.error("Server returned service unavailable."),void this.suspendProcessing();if(e.paymentRequired)return i.info("Too many events have been submitted, please upgrade your plan."),void this.suspendProcessing(null,!0,!0);if(e.unableToAuthenticate)return i.info("Unable to authenticate, please check your configuration. "+n),this.suspendProcessing(15),void this.removeEvents(t);if(e.notFound||e.badRequest)return i.error("Error while trying to submit data: "+e.message),this.suspendProcessing(240),void this.removeEvents(t);if(e.requestEntityTooLarge){var o="Event submission discarded for being too large.";return void(r.submissionBatchSize>1?(i.error(o+" Retrying with smaller batch size."),r.submissionBatchSize=Math.max(1,Math.round(r.submissionBatchSize/1.5))):(i.error(o+" "+n),this.removeEvents(t)))}e.success||(i.error("Error submitting events: "+(e.message||"Please check the network tab for more info.")),this.suspendProcessing())},e.prototype.removeEvents=function(e){for(var t=0;t<(e||[]).length;t++)this._config.storage.queue.remove(e[t].timestamp)},e}();t.DefaultEventQueue=m;var y=function(){function e(e){void 0===e&&(e=250),this.queue=new A(e),this.settings=new A(1)}return e}();t.InMemoryStorageProvider=y;var b=function(){function e(){this.configurationVersionHeader="x-exceptionless-configversion"}return e.prototype.postEvents=function(e,t,n,r){var i=JSON.stringify(e),o=this.createRequest(t,"POST",t.serverUrl+"/api/v2/events",i),s=this.createSubmissionCallback(t,n);return t.submissionAdapter.sendRequest(o,s,r)},e.prototype.postUserDescription=function(e,t,n,r){var i=n.serverUrl+"/api/v2/events/by-ref/"+encodeURIComponent(e)+"/user-description",o=JSON.stringify(t),s=this.createRequest(n,"POST",i,o),a=this.createSubmissionCallback(n,r);return n.submissionAdapter.sendRequest(s,a)},e.prototype.getSettings=function(e,t,n){var r=this.createRequest(e,"GET",e.serverUrl+"/api/v2/projects/config?v="+t),i=function(t,r,i,o){if(200!==t)return n(new O((!1),null,(-1),null,r));var s;try{s=JSON.parse(i)}catch(a){e.log.error("Unable to parse settings: '"+i+"'")}return!s||isNaN(s.version)?n(new O((!1),null,(-1),null,"Invalid configuration settings.")):void n(new O((!0),s.settings||{},s.version))};return e.submissionAdapter.sendRequest(r,i)},e.prototype.sendHeartbeat=function(e,t,n){var r=this.createRequest(n,"GET",n.heartbeatServerUrl+"/api/v2/events/session/heartbeat?id="+e+"&close="+t);n.submissionAdapter.sendRequest(r)},e.prototype.createRequest=function(e,t,n,r){return void 0===r&&(r=null),{method:t,url:n,data:r,apiKey:e.apiKey,userAgent:e.userAgent}},e.prototype.createSubmissionCallback=function(e,t){var n=this;return function(r,i,o,s){var a=s&&parseInt(s[n.configurationVersionHeader],10);c.checkVersion(a,e),t(new u(r,i))}},e}();t.DefaultSubmissionClient=b;var S=function(){function e(){}return e.addRange=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(e||(e=[]),!t||0===t.length)return e;for(var r=0;r<t.length;r++)t[r]&&e.indexOf(t[r])<0&&e.push(t[r]);return e},e.getHashCode=function(e){if(!e||0===e.length)return 0;for(var t=0,n=0;n<e.length;n++){var r=e.charCodeAt(n);t=(t<<5)-t+r,t|=0}return t},e.getCookies=function(t,n){for(var r={},i=(t||"").split("; "),o=0;o<i.length;o++){var s=i[o].split("=");e.isMatch(s[0],n)||(r[s[0]]=s[1])}return e.isEmpty(r)?null:r},e.guid=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()},e.merge=function(e,t){var n={};for(var r in e||{})e[r]&&(n[r]=e[r]);for(var r in t||{})t[r]&&(n[r]=t[r]);return n},e.parseVersion=function(e){if(!e)return null;var t=/(v?((\d+)\.(\d+)(\.(\d+))?)(?:-([\dA-Za-z\-]+(?:\.[\dA-Za-z\-]+)*))?(?:\+([\dA-Za-z\-]+(?:\.[\dA-Za-z\-]+)*))?)/,n=t.exec(e);return n&&n.length>0?n[0]:null},e.parseQueryString=function(t,n){if(!t||0===t.length)return null;var r=t.split("&");if(0===r.length)return null;for(var i={},o=0;o<r.length;o++){var s=r[o].split("=");e.isMatch(s[0],n)||(i[decodeURIComponent(s[0])]=decodeURIComponent(s[1]))}return e.isEmpty(i)?null:i},e.randomNumber=function(){return Math.floor(9007199254740992*Math.random())},e.isMatch=function(t,n,r){if(void 0===r&&(r=!0),!t||"string"!=typeof t)return!1;var i=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;return t=(r?t.toLowerCase():t).replace(i,""),(n||[]).some(function(n){if("string"!=typeof n)return!1;if(n=(r?n.toLowerCase():n).replace(i,""),n.length<=0)return!1;var o="*"===n[0];o&&(n=n.slice(1));var s="*"===n[n.length-1];return s&&(n=n.substring(0,n.length-1)),o&&s?n.length<=t.length&&t.indexOf(n,0)!==-1:o?e.endsWith(t,n):s?e.startsWith(t,n):t===n})},e.isEmpty=function(e){return null===e||"object"==typeof e&&0===Object.keys(e).length},e.startsWith=function(e,t){return e.substring(0,t.length)===t},e.endsWith=function(e,t){return e.indexOf(t,e.length-t.length)!==-1},e.stringify=function(t,n,r){function i(t,n){var r=[];return JSON.stringify(t,function(t,i){if(!e.isMatch(t,n)){if("object"==typeof i&&i){if(r.indexOf(i)!==-1)return;r.push(i)}return i}})}if("[object Object]"==={}.toString.call(t)){var o={};for(var s in t){var a=t[s];a!==t&&(o[s]=t[s])}return i(o,n)}if("[object Array]"==={}.toString.call(t)){for(var u=[],c=0;c<t.length;c++)u[c]=JSON.parse(i(t[c],n));return JSON.stringify(u)}return i(t,n)},e.toBoolean=function(e,t){if(void 0===t&&(t=!1),"boolean"==typeof e)return e;if(null===e||"number"!=typeof e&&"string"!=typeof e)return t;switch((e+"").toLowerCase().trim()){case"true":case"yes":case"1":return!0;case"false":case"no":case"0":case null:return!1}return t},e}();t.Utils=S;var x=function(){function e(t){function n(e){return"function"==typeof e?e(this):e}this.defaultTags=[],this.defaultData={},this.enabled=!0,this.lastReferenceIdManager=new l,this.settings={},this._serverUrl="https://collector.exceptionless.io",this._heartbeatServerUrl="https://heartbeat.exceptionless.io",this._updateSettingsWhenIdleInterval=12e4,this._dataExclusions=[],this._userAgentBotPatterns=[],this._plugins=[],this._handlers=[],t=S.merge(e.defaults,t),this.log=n(t.log)||new p,this.apiKey=t.apiKey,this.serverUrl=t.serverUrl,this.heartbeatServerUrl=t.heartbeatServerUrl,this.updateSettingsWhenIdleInterval=t.updateSettingsWhenIdleInterval,this.environmentInfoCollector=n(t.environmentInfoCollector),this.errorParser=n(t.errorParser),this.lastReferenceIdManager=n(t.lastReferenceIdManager)||new l,this.moduleCollector=n(t.moduleCollector),this.requestInfoCollector=n(t.requestInfoCollector),this.submissionBatchSize=n(t.submissionBatchSize)||50,this.submissionAdapter=n(t.submissionAdapter),this.submissionClient=n(t.submissionClient)||new b,this.storage=n(t.storage)||new y,this.queue=n(t.queue)||new m(this),c.applySavedServerSettings(this),d.addDefaultPlugins(this)}return Object.defineProperty(e.prototype,"apiKey",{get:function(){return this._apiKey},set:function(e){this._apiKey=e||null,this.log.info("apiKey: "+this._apiKey),this.changed()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isValid",{get:function(){return!!this.apiKey&&this.apiKey.length>=10},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"serverUrl",{get:function(){return this._serverUrl},set:function(e){e&&(this._serverUrl=e,this._heartbeatServerUrl=e,this.log.info("serverUrl: "+e),this.changed())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"heartbeatServerUrl",{get:function(){return this._heartbeatServerUrl},set:function(e){e&&(this._heartbeatServerUrl=e,this.log.info("heartbeatServerUrl: "+e),this.changed())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"updateSettingsWhenIdleInterval",{get:function(){return this._updateSettingsWhenIdleInterval},set:function(e){"number"==typeof e&&(e<=0?e=-1:e>0&&e<15e3&&(e=15e3),this._updateSettingsWhenIdleInterval=e,this.log.info("updateSettingsWhenIdleInterval: "+e),this.changed())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dataExclusions",{get:function(){var e=this.settings["@@DataExclusions"];return this._dataExclusions.concat(e&&e.split(",")||[])},enumerable:!0,configurable:!0}),e.prototype.addDataExclusions=function(){for(var e=[],t=0;t<arguments.length;t++)e[t-0]=arguments[t];this._dataExclusions=S.addRange.apply(S,[this._dataExclusions].concat(e))},Object.defineProperty(e.prototype,"userAgentBotPatterns",{get:function(){var e=this.settings["@@UserAgentBotPatterns"];return this._userAgentBotPatterns.concat(e&&e.split(",")||[])},enumerable:!0,configurable:!0}),e.prototype.addUserAgentBotPatterns=function(){for(var e=[],t=0;t<arguments.length;t++)e[t-0]=arguments[t];this._userAgentBotPatterns=S.addRange.apply(S,[this._userAgentBotPatterns].concat(e))},Object.defineProperty(e.prototype,"plugins",{get:function(){return this._plugins.sort(function(e,t){return e.priority<t.priority?-1:e.priority>t.priority?1:0})},enumerable:!0,configurable:!0}),e.prototype.addPlugin=function(e,t,n){var r=n?{name:e,priority:t,run:n}:e;if(!r||!r.run)return void this.log.error("Add plugin failed: Run method not defined");r.name||(r.name=S.guid()),r.priority||(r.priority=0);for(var i=!1,o=this._plugins,s=0;s<o.length;s++)if(o[s].name===r.name){i=!0;break}i||o.push(r)},e.prototype.removePlugin=function(e){var t="string"==typeof e?e:e.name;if(!t)return void this.log.error("Remove plugin failed: Plugin name not defined");for(var n=this._plugins,r=0;r<n.length;r++)if(n[r].name===t){n.splice(r,1);break}},e.prototype.setVersion=function(e){e&&(this.defaultData["@version"]=e)},e.prototype.setUserIdentity=function(e,t){var n="@user",r="string"!=typeof e?e:{identity:e,name:t},i=!r||!r.identity&&!r.name;i?delete this.defaultData[n]:this.defaultData[n]=r,this.log.info("user identity: "+(i?"null":r.identity))},Object.defineProperty(e.prototype,"userAgent",{get:function(){return"exceptionless-js/1.4.3"},enumerable:!0,configurable:!0}),e.prototype.useSessions=function(e,t){void 0===e&&(e=!0),void 0===t&&(t=3e4),e&&this.addPlugin(new g(t))},e.prototype.useReferenceIds=function(){this.addPlugin(new v)},e.prototype.useLocalStorage=function(){},e.prototype.useDebugLogger=function(){this.log=new f},e.prototype.onChanged=function(e){!!e&&this._handlers.push(e)},e.prototype.changed=function(){for(var e=this._handlers,t=0;t<e.length;t++)try{e[t](this)}catch(n){this.log.error("Error calling onChanged handler: "+n)}},Object.defineProperty(e,"defaults",{get:function(){return null===e._defaultSettings&&(e._defaultSettings={}),e._defaultSettings},enumerable:!0,configurable:!0}),e._defaultSettings=null,e}();t.Configuration=x;var _=function(){function e(e,t,n){this._validIdentifierErrorMessage="must contain between 8 and 100 alphanumeric or '-' characters.",this.target=e,this.client=t,this.pluginContextData=n||new w}return e.prototype.setType=function(e){return e&&(this.target.type=e),this},e.prototype.setSource=function(e){return e&&(this.target.source=e),this},e.prototype.setReferenceId=function(e){if(!this.isValidIdentifier(e))throw new Error("ReferenceId "+this._validIdentifierErrorMessage);return this.target.reference_id=e,this},e.prototype.setEventReference=function(e,t){if(!e)throw new Error("Invalid name");if(!t||!this.isValidIdentifier(t))throw new Error("Id "+this._validIdentifierErrorMessage);return this.setProperty("@ref:"+e,t),this},e.prototype.setMessage=function(e){return e&&(this.target.message=e),this},e.prototype.setGeo=function(e,t){if(e<-90||e>90)throw new Error("Must be a valid latitude value between -90.0 and 90.0.");if(t<-180||t>180)throw new Error("Must be a valid longitude value between -180.0 and 180.0.");return this.target.geo=e+","+t,this},e.prototype.setUserIdentity=function(e,t){var n="string"!=typeof e?e:{identity:e,name:t};return n&&(n.identity||n.name)?(this.setProperty("@user",n),this):this},e.prototype.setUserDescription=function(e,t){return e&&t&&this.setProperty("@user_description",{email_address:e,description:t}),this},e.prototype.setManualStackingInfo=function(e,t){if(e){var n={signature_data:e};t&&(n.title=t),this.setProperty("@stack",n)}return this},e.prototype.setManualStackingKey=function(e,t){if(e){var n={ManualStackingKey:e};this.setManualStackingInfo(n,t)}return this},e.prototype.setValue=function(e){return e&&(this.target.value=e),this},e.prototype.addTags=function(){for(var e=[],t=0;t<arguments.length;t++)e[t-0]=arguments[t];return this.target.tags=S.addRange.apply(S,[this.target.tags].concat(e)),this},e.prototype.setProperty=function(e,t,n,r){if(!e||void 0===t||null==t)return this;this.target.data||(this.target.data={});var i=JSON.parse(S.stringify(t,this.client.config.dataExclusions.concat(r||[]),n));return S.isEmpty(i)||(this.target.data[e]=i),this},e.prototype.markAsCritical=function(e){return e&&this.addTags("Critical"),this},e.prototype.addRequestInfo=function(e){return e&&(this.pluginContextData["@request"]=e),this},e.prototype.submit=function(e){this.client.submitEvent(this.target,this.pluginContextData,e)},e.prototype.isValidIdentifier=function(e){if(!e)return!0;if(e.length<8||e.length>100)return!1;for(var t=0;t<e.length;t++){var n=e.charCodeAt(t),r=n>=48&&n<=57,i=n>=65&&n<=90||n>=97&&n<=122,o=45===n;if(!r&&!i&&!o)return!1}return!0},e}();t.EventBuilder=_;var w=function(){function e(){}return e.prototype.setException=function(e){e&&(this["@@_Exception"]=e)},Object.defineProperty(e.prototype,"hasException",{get:function(){return!!this["@@_Exception"]},enumerable:!0,configurable:!0}),e.prototype.getException=function(){return this["@@_Exception"]||null},e.prototype.markAsUnhandledError=function(){this["@@_IsUnhandledError"]=!0},Object.defineProperty(e.prototype,"isUnhandledError",{get:function(){return!!this["@@_IsUnhandledError"]},enumerable:!0,configurable:!0}),e.prototype.setSubmissionMethod=function(e){e&&(this["@@_SubmissionMethod"]=e)},e.prototype.getSubmissionMethod=function(){return this["@@_SubmissionMethod"]||null},e}();t.ContextData=w;var E=function(){function e(e,t){var n=this;"object"==typeof e?this.config=new x(e):this.config=new x({apiKey:e,serverUrl:t}),this.updateSettingsTimer(5e3),this.config.onChanged(function(e){return n.updateSettingsTimer(n._timeoutId>0?5e3:0)}),this.config.queue.onEventsPosted(function(e,t){return n.updateSettingsTimer()})}return e.prototype.createException=function(e){var t=new w;return t.setException(e),this.createEvent(t).setType("error")},e.prototype.submitException=function(e,t){this.createException(e).submit(t)},e.prototype.createUnhandledException=function(e,t){var n=this.createException(e);return n.pluginContextData.markAsUnhandledError(),n.pluginContextData.setSubmissionMethod(t),n},e.prototype.submitUnhandledException=function(e,t,n){this.createUnhandledException(e,t).submit(n)},e.prototype.createFeatureUsage=function(e){return this.createEvent().setType("usage").setSource(e)},e.prototype.submitFeatureUsage=function(e,t){this.createFeatureUsage(e).submit(t)},
e.prototype.createLog=function(e,t,n){var r=this.createEvent().setType("log");if(t&&n)r=r.setSource(e).setMessage(t).setProperty("@level",n);else if(t)r=r.setSource(e).setMessage(t);else{r=r.setMessage(e);try{var i=this.createLog.caller;r=r.setSource(i&&i.caller&&i.caller.name)}catch(o){this.config.log.trace("Unable to resolve log source: "+o.message)}}return r},e.prototype.submitLog=function(e,t,n,r){this.createLog(e,t,n).submit(r)},e.prototype.createNotFound=function(e){return this.createEvent().setType("404").setSource(e)},e.prototype.submitNotFound=function(e,t){this.createNotFound(e).submit(t)},e.prototype.createSessionStart=function(){return this.createEvent().setType("session")},e.prototype.submitSessionStart=function(e){this.createSessionStart().submit(e)},e.prototype.submitSessionEnd=function(e){e&&(this.config.log.info("Submitting session end: "+e),this.config.submissionClient.sendHeartbeat(e,!0,this.config))},e.prototype.submitSessionHeartbeat=function(e){e&&(this.config.log.info("Submitting session heartbeat: "+e),this.config.submissionClient.sendHeartbeat(e,!1,this.config))},e.prototype.createEvent=function(e){return new _({date:new Date},this,e)},e.prototype.submitEvent=function(e,t,n){function r(e){return e&&(e.cancelled=!0),!!n&&n(e)}var i=new h(this,e,t);return e?this.config.enabled?(e.data||(e.data={}),e.tags&&e.tags.length||(e.tags=[]),void d.run(i,function(e){var t=e.client.config,r=e.event;e.cancelled||(r.type&&0!==r.type.length||(r.type="log"),r.date||(r.date=new Date),t.queue.enqueue(r),r.reference_id&&r.reference_id.length>0&&(e.log.info("Setting last reference id '"+r.reference_id+"'"),t.lastReferenceIdManager.setLast(r.reference_id))),!!n&&n(e)})):(this.config.log.info("Event submission is currently disabled."),r(i)):r(i)},e.prototype.updateUserEmailAndDescription=function(e,t,n,r){var i=this;if(!(e&&t&&n&&this.config.enabled))return!!r&&r(new u(500,"cancelled"));var o={email_address:t,description:n};this.config.submissionClient.postUserDescription(e,o,this.config,function(t){t.success||i.config.log.error("Failed to submit user email and description for event '"+e+"': "+t.statusCode+" "+t.message),!!r&&r(t)})},e.prototype.getLastReferenceId=function(){return this.config.lastReferenceIdManager.getLast()},e.prototype.updateSettingsTimer=function(e){var t=this;this.config.log.info("Updating settings timer with delay: "+e),this._timeoutId=clearTimeout(this._timeoutId),this._timeoutId=clearInterval(this._intervalId);var n=this.config.updateSettingsWhenIdleInterval;if(n>0){var r=function(){return c.updateSettings(t.config)};e>0&&(this._timeoutId=setTimeout(r,e)),this._intervalId=setInterval(r,n)}},Object.defineProperty(e,"default",{get:function(){return null===e._instance&&(e._instance=new e(null)),e._instance},enumerable:!0,configurable:!0}),e._instance=null,e}();t.ExceptionlessClient=E;var I=function(){function e(){this.priority=10,this.name="ConfigurationDefaultsPlugin"}return e.prototype.run=function(e,t){for(var n=e.client.config,r=n.defaultTags||[],i=0;i<r.length;i++){var o=r[i];o&&e.event.tags.indexOf(o)<0&&e.event.tags.push(o)}var s=n.defaultData||{};for(var a in s)if(s[a]){var u=JSON.parse(S.stringify(s[a],n.dataExclusions));S.isEmpty(u)||(e.event.data[a]=u)}t&&t()},e}();t.ConfigurationDefaultsPlugin=I;var P=function(){function e(){this.priority=30,this.name="ErrorPlugin"}return e.prototype.run=function(e,t){var n="@error",r=["arguments","column","columnNumber","description","fileName","message","name","number","line","lineNumber","opera#sourceloc","sourceId","sourceURL","stack","stackArray","stacktrace"],i=e.contextData.getException();if(i&&(e.event.type="error",!e.event.data[n])){var o=e.client.config,s=o.errorParser;if(!s)throw new Error("No error parser was defined.");var a=s.parse(e,i);if(a){var u=JSON.parse(S.stringify(i,o.dataExclusions.concat(r)));S.isEmpty(u)||(a.data||(a.data={}),a.data["@ext"]=u),e.event.data[n]=a}}t&&t()},e}();t.ErrorPlugin=P;var C=function(){function e(){this.priority=50,this.name="ModuleInfoPlugin"}return e.prototype.run=function(e,t){var n="@error",r=e.client.config.moduleCollector;if(e.event.data[n]&&!e.event.data["@error"].modules&&r){var i=r.getModules(e);i&&i.length>0&&(e.event.data[n].modules=i)}t&&t()},e}();t.ModuleInfoPlugin=C;var T=function(){function e(){this.priority=70,this.name="RequestInfoPlugin"}return e.prototype.run=function(e,t){var n="@request",r=e.client.config,i=r.requestInfoCollector;if(!e.event.data[n]&&i){var o=i.getRequestInfo(e);o&&(S.isMatch(o.user_agent,r.userAgentBotPatterns)?(e.log.info("Cancelling event as the request user agent matches a known bot pattern"),e.cancelled=!0):e.event.data[n]=o)}t&&t()},e}();t.RequestInfoPlugin=T;var k=function(){function e(){this.priority=80,this.name="EnvironmentInfoPlugin"}return e.prototype.run=function(e,t){var n="@environment",r=e.client.config.environmentInfoCollector;if(!e.event.data[n]&&r){var i=r.getEnvironmentInfo(e);i&&(e.event.data[n]=i)}t&&t()},e}();t.EnvironmentInfoPlugin=k;var R=function(){function e(){this.priority=100,this.name="SubmissionMethodPlugin"}return e.prototype.run=function(e,t){var n=e.contextData.getSubmissionMethod();n&&(e.event.data["@submission_method"]=n),t&&t()},e}();t.SubmissionMethodPlugin=R;var U=function(){function e(e,t){var n=this;void 0===e&&(e=function(){return Date.now()}),void 0===t&&(t=3e4),this.priority=1010,this.name="DuplicateCheckerPlugin",this._mergedEvents=[],this._processedHashcodes=[],this._getCurrentTime=e,this._interval=t,setInterval(function(){for(;n._mergedEvents.length>0;)n._mergedEvents.shift().resubmit()},t)}return e.prototype.run=function(e,t){function n(e){for(var t=0;e;)e.message&&e.message.length&&(t+=397*t^S.getHashCode(e.message)),e.stack_trace&&e.stack_trace.length&&(t+=397*t^S.getHashCode(JSON.stringify(e.stack_trace))),e=e.inner;return t}var r=this,i=e.event.data["@error"],o=n(i);if(o){var s=e.event.count||1,a=this._getCurrentTime(),u=this._mergedEvents.filter(function(e){return e.hashCode===o})[0];if(u&&(u.incrementCount(s),u.updateDate(e.event.date),e.log.info("Ignoring duplicate event with hash: "+o),e.cancelled=!0),!e.cancelled&&this._processedHashcodes.some(function(e){return e.hash===o&&e.timestamp>=a-r._interval})&&(e.log.trace("Adding event with hash: "+o),this._mergedEvents.push(new q(o,e,s)),e.cancelled=!0),!e.cancelled)for(e.log.trace("Enqueueing event with hash: "+o+"to cache."),this._processedHashcodes.push({hash:o,timestamp:a});this._processedHashcodes.length>50;)this._processedHashcodes.shift()}t&&t()},e}();t.DuplicateCheckerPlugin=U;var q=function(){function e(e,t,n){this.hashCode=e,this._context=t,this._count=n}return e.prototype.incrementCount=function(e){this._count+=e},e.prototype.resubmit=function(){this._context.event.count=this._count,this._context.client.config.queue.enqueue(this._context.event)},e.prototype.updateDate=function(e){e>this._context.event.date&&(this._context.event.date=e)},e}(),M=function(){function e(){this.priority=45,this.name="EventExclusionPlugin"}return e.prototype.run=function(e,t){function n(e){switch((e||"").toLowerCase().trim()){case"trace":case"true":case"1":case"yes":return 0;case"debug":return 1;case"info":return 2;case"warn":return 3;case"error":return 4;case"fatal":return 5;case"off":case"false":case"0":case"no":return 6;default:return-1}}function r(e,t){return void 0===t&&(t="*"),n(i(e,"log",t,"Trace")+"")}function i(e,t,n,r){if(void 0===e&&(e={}),void 0===r&&(r=void 0),!t)return r;var i="log"===t,o="@@"+t+":",s=e[o+n];if(s)return i?s:S.toBoolean(s);for(var a in e)if(S.startsWith(a.toLowerCase(),o.toLowerCase())&&S.isMatch(n,[a.substring(o.length)]))return i?e[a]:S.toBoolean(e[a]);return r}var o=e.event,s=e.log,a=e.client.config.settings;if("log"===o.type){var u=r(a,o.source),c=n(o.data["@level"]);c>=0&&(c>5||c<u)&&(s.info("Cancelling log event due to minimum log level."),e.cancelled=!0)}else if("error"===o.type)for(var l=o.data["@error"];!e.cancelled&&l;)i(a,o.type,l.type,!0)===!1&&(s.info("Cancelling error from excluded exception type: "+l.type),e.cancelled=!0),l=l.inner;else i(a,o.type,o.source,!0)===!1&&(s.info("Cancelling event from excluded type: "+o.type+" and source: "+o.source),e.cancelled=!0);t&&t()},e}();t.EventExclusionPlugin=M;var O=function(){function e(e,t,n,r,i){void 0===n&&(n=-1),void 0===r&&(r=null),void 0===i&&(i=null),this.success=!1,this.settingsVersion=-1,this.success=e,this.settings=t,this.settingsVersion=n,this.exception=r,this.message=i}return e}();t.SettingsResponse=O;var A=function(){function e(e){this.items=[],this.lastTimestamp=0,this.maxItems=e}return e.prototype.save=function(e){if(!e)return null;var t=this.items,n=Math.max(Date.now(),this.lastTimestamp+1),r={timestamp:n,value:e};return t.push(r)>this.maxItems&&t.shift(),this.lastTimestamp=n,r.timestamp},e.prototype.get=function(e){return this.items.slice(0,e)},e.prototype.remove=function(e){for(var t=this.items,n=0;n<t.length;n++)if(t[n].timestamp===e)return void t.splice(n,1)},e.prototype.clear=function(){this.items=[]},e}();t.InMemoryStorage=A;var D=function(){function e(e){this.lastTimestamp=0,this.maxItems=e}return e.prototype.save=function(e,t){if(!e)return null;this.ensureIndex();var n=this.items,r=Math.max(Date.now(),this.lastTimestamp+1),i=this.getKey(r),o=JSON.stringify(e);try{this.write(i,o),this.lastTimestamp=r,n.push(r)>this.maxItems&&this["delete"](this.getKey(n.shift()))}catch(s){return null}return r},e.prototype.get=function(e){var t=this;return this.ensureIndex(),this.items.slice(0,e).map(function(e){var n=t.getKey(e);try{var r=t.read(n),o=JSON.parse(r,i);return{timestamp:e,value:o}}catch(s){return t.safeDelete(n),null}}).filter(function(e){return null!=e})},e.prototype.remove=function(e){this.ensureIndex();var t=this.items,n=t.indexOf(e);if(n>=0){var r=this.getKey(e);this.safeDelete(r),t.splice(n,1)}},e.prototype.clear=function(){var e=this;this.items.forEach(function(t){return e.safeDelete(e.getKey(t))}),this.items=[]},e.prototype.ensureIndex=function(){this.items||(this.items=this.createIndex(),this.lastTimestamp=Math.max.apply(Math,[0].concat(this.items))+1)},e.prototype.safeDelete=function(e){try{this["delete"](e)}catch(t){}},e.prototype.createIndex=function(){var e=this;try{var t=this.readAllKeys();return t.map(function(t){try{var n=e.getTimestamp(t);return n?n:(e.safeDelete(t),null)}catch(r){return e.safeDelete(t),null}}).filter(function(e){return null!=e}).sort(function(e,t){return e-t})}catch(n){return[]}},e}();t.KeyValueStorageBase=D;var K=function(e){function t(t,n,r){void 0===n&&(n="com.exceptionless."),void 0===r&&(r=20),e.call(this,r),this.prefix=n+t+"-"}return a(t,e),t.isAvailable=function(){try{var e=window.localStorage,t="__storage_test__";return e.setItem(t,t),e.removeItem(t),!0}catch(n){return!1}},t.prototype.write=function(e,t){window.localStorage.setItem(e,t)},t.prototype.read=function(e){return window.localStorage.getItem(e)},t.prototype.readAllKeys=function(){var e=this;return Object.keys(window.localStorage).filter(function(t){return 0===t.indexOf(e.prefix)})},t.prototype["delete"]=function(e){window.localStorage.removeItem(e)},t.prototype.getKey=function(e){return this.prefix+e},t.prototype.getTimestamp=function(e){return parseInt(e.substr(this.prefix.length),10)},t}(D);t.BrowserStorage=K;var F=function(){function e(){}return e.prototype.parse=function(e,t){function n(e){for(var t=("string"==typeof e?[e]:e)||[],n=[],r=0;r<t.length;r++)n.push({name:t[r]});return n}function i(e){for(var t="<anonymous>",r=[],i=0;i<e.length;i++){var o=e[i];r.push({name:(o.func||t).replace("?",t),parameters:n(o.args),file_name:o.url,line_number:o.line||0,column:o.column||0})}return r}var o="@@_TraceKit.StackTrace",s=e.contextData[o]?e.contextData[o]:r.computeStackTrace(t,25);if(!s)throw new Error("Unable to parse the exceptions stack trace.");var a="string"==typeof t?t:void 0;return{type:s.name,message:s.message||t.message||a,stack_trace:i(s.stack||[])}},e}();t.DefaultErrorParser=F;var L=function(){function e(){}return e.prototype.getModules=function(e){if(document&&document.getElementsByTagName)return null;var t=[],n=document.getElementsByTagName("script");if(n&&n.length>0)for(var r=0;r<n.length;r++)n[r].src?t.push({module_id:r,name:n[r].src,version:S.parseVersion(n[r].src)}):n[r].innerHTML&&t.push({module_id:r,name:"Script Tag",version:S.getHashCode(n[r].innerHTML).toString()});return t},e}();t.DefaultModuleCollector=L;var N=function(){function e(){}return e.prototype.getRequestInfo=function(e){if(!document||!navigator||!location)return null;var t=e.client.config.dataExclusions,n={user_agent:navigator.userAgent,is_secure:"https:"===location.protocol,host:location.hostname,port:location.port&&""!==location.port?parseInt(location.port,10):80,path:location.pathname,cookies:S.getCookies(document.cookie,t),query_string:S.parseQueryString(location.search.substring(1),t)};return document.referrer&&""!==document.referrer&&(n.referrer=document.referrer),n},e}();t.DefaultRequestInfoCollector=N;var j=function(){function e(){}return e.prototype.sendRequest=function(e,t,n){function r(n,r){function i(e){function t(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}for(var n={},r=(e||"").split("\r\n"),i=0;i<r.length;i++){var o=r[i],s=o.indexOf(": ");s>0&&(n[t(o.substring(0,s).toLowerCase())]=o.substring(s+2))}return n}if(!u){u=!0;var a=r.statusText,c=r.responseText,l=r.status;if(n===o||0===l)a="Unable to connect to server.",l=0;else if(n!==s||l){if(l<200||l>299){var f=r.responseBody;if(f&&f.message)a=f.message;else if(c&&c.indexOf("message")!==-1)try{a=JSON.parse(c).message}catch(p){a=c}}}else l="POST"===e.method?202:200;t&&t(l||500,a||"",c,i(r.getAllResponseHeaders&&r.getAllResponseHeaders()))}}function i(e,t,n){var r=new XMLHttpRequest;return a in r?(r.open(t,n,!0),r.setRequestHeader("X-Exceptionless-Client",e),"POST"===t&&r.setRequestHeader("Content-Type","application/json")):"undefined"!=typeof XDomainRequest?(c=!0,r=new XDomainRequest,r.open(t,"http:"===location.protocol?n.replace("https:","http:"):n)):r=null,r&&(r.timeout=1e4),r}var o="timeout",s="loaded",a="withCredentials",u=!1,c=!1,l=""+e.url+(e.url.indexOf("?")===-1?"?":"&")+"access_token="+encodeURIComponent(e.apiKey),f=i(e.userAgent,e.method||"POST",l);return f?(a in f&&(f.onreadystatechange=function(){4===f.readyState&&r(s,f)}),f.onprogress=function(){},f.ontimeout=function(){return r(o,f)},f.onerror=function(){return r("error",f)},f.onload=function(){return r(s,f)},void(c?setTimeout(function(){return f.send(e.data)},500):f.send(e.data))):t&&t(503,"CORS not supported.")},e}();t.DefaultSubmissionAdapter=j;var B=function(){function e(e,t){void 0===t&&(t=250),this.queue=new K("q",e,t),this.settings=new K("settings",e,1)}return e}();t.BrowserStorageProvider=B,x.prototype.useLocalStorage=function(){K.isAvailable()&&(this.storage=new B,c.applySavedServerSettings(this),this.changed())};var H=x.defaults,Q=o();return Q&&(Q.apiKey||Q.serverUrl)&&(H.apiKey=Q.apiKey,H.serverUrl=Q.serverUrl),H.errorParser=new F,H.moduleCollector=new L,H.requestInfoCollector=new N,H.submissionAdapter=new j,r.report.subscribe(s),r.extendToAsynchronousCallbacks(),Error.stackTraceLimit=1/0,t});
//# sourceMappingURL=exceptionless.min.js.map