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