From 53480ebcbde27d2de86317f9de94413b73a91513 Mon Sep 17 00:00:00 2001 From: Stanescu Eduard-Dan Date: Tue, 27 Jun 2023 11:53:33 +0300 Subject: [PATCH] Support for cause and inspector --- dist/elmahio.js | 292 +++++++++++++++++++++++----- dist/elmahio.js.map | 2 +- dist/elmahio.min.js | 4 +- dist/elmahio.min.js.map | 2 +- elmah.io.javascript.nuspec | 2 +- package.json | 2 +- src/elmahio.js | 379 +++++++++++++++++++++++++++++-------- 7 files changed, 546 insertions(+), 137 deletions(-) diff --git a/dist/elmahio.js b/dist/elmahio.js index e5bb847..43fbffa 100644 --- a/dist/elmahio.js +++ b/dist/elmahio.js @@ -1,5 +1,5 @@ /*! - * elmah.io Javascript Logger - version 3.7.1 + * elmah.io Javascript Logger - version 4.0.0 * (c) 2018 elmah.io, Apache 2.0 License, https://elmah.io */ (function(root, factory) { @@ -126,42 +126,44 @@ return StackFrame; })(); var ErrorStackParser = (function() { - "use strict"; - var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+\:\d+/; - var CHROME_IE_STACK_REGEXP = /^\s*at .*(\S+\:\d+|\(native\))/m; - var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code\])?$/; + 'use strict'; + var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/; + var CHROME_IE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m; + var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code])?$/; return { parse: function ErrorStackParser$$parse(error) { - if (typeof error.stacktrace !== "undefined" || typeof error["opera#sourceloc"] !== "undefined") { + if (typeof error.stacktrace !== 'undefined' || typeof error['opera#sourceloc'] !== 'undefined') { return this.parseOpera(error); } else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) { return this.parseV8OrIE(error); } else if (error.stack) { return this.parseFFOrSafari(error); } else { - throw new Error("Cannot parse given Error object"); + throw new Error('Cannot parse given Error object'); } }, extractLocation: function ErrorStackParser$$extractLocation(urlLike) { - if (urlLike.indexOf(":") === -1) { + if (urlLike.indexOf(':') === -1) { return [urlLike]; } - var regExp = /(.+?)(?:\:(\d+))?(?:\:(\d+))?$/; - var parts = regExp.exec(urlLike.replace(/[\(\)]/g, "")); + var regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/; + var parts = regExp.exec(urlLike.replace(/[()]/g, '')); return [parts[1], parts[2] || undefined, parts[3] || undefined]; }, parseV8OrIE: function ErrorStackParser$$parseV8OrIE(error) { - var filtered = error.stack.split("\n").filter(function(line) { + var filtered = error.stack.split('\n').filter(function(line) { return !!line.match(CHROME_IE_STACK_REGEXP); }, this); return filtered.map(function(line) { - if (line.indexOf("(eval ") > -1) { - line = line.replace(/eval code/g, "eval").replace(/(\(eval at [^\()]*)|(\)\,.*$)/g, ""); + if (line.indexOf('(eval ') > -1) { + line = line.replace(/eval code/g, 'eval').replace(/(\(eval at [^()]*)|(,.*$)/g, ''); } - var tokens = line.replace(/^\s+/, "").replace(/\(eval code/g, "(").split(/\s+/).slice(1); - var locationParts = this.extractLocation(tokens.pop()); - var functionName = tokens.join(" ") || undefined; - var fileName = ["eval", ""].indexOf(locationParts[0]) > -1 ? undefined : locationParts[0]; + var sanitizedLine = line.replace(/^\s+/, '').replace(/\(eval code/g, '(').replace(/^.*?\s+/, ''); + var location = sanitizedLine.match(/ (\(.+\)$)/); + sanitizedLine = location ? sanitizedLine.replace(location[0], '') : sanitizedLine; + var locationParts = this.extractLocation(location ? location[1] : sanitizedLine); + var functionName = location && sanitizedLine || undefined; + var fileName = ['eval', ''].indexOf(locationParts[0]) > -1 ? undefined : locationParts[0]; return new StackFrame({ functionName: functionName, fileName: fileName, @@ -172,14 +174,14 @@ }, this); }, parseFFOrSafari: function ErrorStackParser$$parseFFOrSafari(error) { - var filtered = error.stack.split("\n").filter(function(line) { + var filtered = error.stack.split('\n').filter(function(line) { return !line.match(SAFARI_NATIVE_CODE_REGEXP); }, this); return filtered.map(function(line) { - if (line.indexOf(" > eval") > -1) { - line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g, ":$1"); + if (line.indexOf(' > eval') > -1) { + line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ':$1'); } - if (line.indexOf("@") === -1 && line.indexOf(":") === -1) { + if (line.indexOf('@') === -1 && line.indexOf(':') === -1) { return new StackFrame({ functionName: line }); @@ -187,7 +189,7 @@ var functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/; var matches = line.match(functionNameRegex); var functionName = matches && matches[1] ? matches[1] : undefined; - var locationParts = this.extractLocation(line.replace(functionNameRegex, "")); + var locationParts = this.extractLocation(line.replace(functionNameRegex, '')); return new StackFrame({ functionName: functionName, fileName: locationParts[0], @@ -199,7 +201,7 @@ }, this); }, parseOpera: function ErrorStackParser$$parseOpera(e) { - if (!e.stacktrace || e.message.indexOf("\n") > -1 && e.message.split("\n").length > e.stacktrace.split("\n").length) { + if (!e.stacktrace || (e.message.indexOf('\n') > -1 && e.message.split('\n').length > e.stacktrace.split('\n').length)) { return this.parseOpera9(e); } else if (!e.stack) { return this.parseOpera10(e); @@ -209,7 +211,7 @@ }, parseOpera9: function ErrorStackParser$$parseOpera9(e) { var lineRE = /Line (\d+).*script (?:in )?(\S+)/i; - var lines = e.message.split("\n"); + var lines = e.message.split('\n'); var result = []; for (var i = 2, len = lines.length; i < len; i += 2) { var match = lineRE.exec(lines[i]); @@ -225,7 +227,7 @@ }, parseOpera10: function ErrorStackParser$$parseOpera10(e) { var lineRE = /Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i; - var lines = e.stacktrace.split("\n"); + var lines = e.stacktrace.split('\n'); var result = []; for (var i = 0, len = lines.length; i < len; i += 2) { var match = lineRE.exec(lines[i]); @@ -241,19 +243,19 @@ return result; }, parseOpera11: function ErrorStackParser$$parseOpera11(error) { - var filtered = error.stack.split("\n").filter(function(line) { + var filtered = error.stack.split('\n').filter(function(line) { return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) && !line.match(/^Error created at/); }, this); return filtered.map(function(line) { - var tokens = line.split("@"); + var tokens = line.split('@'); var locationParts = this.extractLocation(tokens.pop()); - var functionCall = tokens.shift() || ""; - var functionName = functionCall.replace(//, "$2").replace(/\([^\)]*\)/g, "") || undefined; + var functionCall = (tokens.shift() || ''); + var functionName = functionCall.replace(//, '$2').replace(/\([^)]*\)/g, '') || undefined; var argsRaw; - if (functionCall.match(/\(([^\)]*)\)/)) { - argsRaw = functionCall.replace(/^[^\(]+\(([^\)]*)\)$/, "$1"); + if (functionCall.match(/\(([^)]*)\)/)) { + argsRaw = functionCall.replace(/^[^(]+\(([^)]*)\)$/, '$1'); } - var args = argsRaw === undefined || argsRaw === "[arguments not available]" ? undefined : argsRaw.split(","); + var args = (argsRaw === undefined || argsRaw === '[arguments not available]') ? undefined : argsRaw.split(','); return new StackFrame({ functionName: functionName, args: args, @@ -1263,11 +1265,74 @@ } } - function stackGPS(error, xhr, jsonData) { - var errorStack = error.toString().split("\n")[0]; + function generateErrorObject(error) { + return { + error: error, + type: error.name, + message: error.message, + inner: error.cause && typeof error.cause === "object" && error.cause instanceof Error ? generateErrorObject(error.cause) : [] + } + } + + function getErrorTypeSource(error) { + var object = generateErrorObject(error); + var type = null; + var source = null; + + function iterateObj(obj) { + Object.keys(obj).forEach(function(key) { + if (key === "error") { + if (objectLength(obj[key].stack) !== 0) { + var stack = obj[key] ? ErrorStackParser.parse(obj[key]) : null; + source = stack && stack.length > 0 ? stack[0].fileName : null; + } + } + if (key === "type") { + type = obj[key]; + } + if (key === "inner" && obj[key].length !== 0) { + iterateObj(obj[key]); + } + }); + } + iterateObj(object); + return { + type: type, + source: source + }; + } + + function GenerateNewFrames(errorMessage, newFrames, cause, fileName) { + var lastInnerFileName = null; + newFrames.forEach(function(stackFrame, i) { + if (stackFrame.functionName) { + var fn = stackFrame.functionName + ' '; + } else { + var fn = ''; + } + var stackString = ' at ' + fn + '(' + stackFrame.fileName + ':' + stackFrame.lineNumber + ':' + stackFrame.columnNumber + ')'; + newFrames[i] = stackString; + if (i === 0) { + lastInnerFileName = stackFrame.fileName || null; + } + }); + if (!cause) { + newFrames.unshift(errorMessage); + } else { + newFrames.unshift("\nCaused by: " + errorMessage); + } + if (fileName) { + return { + newFrames: newFrames, + fileName: lastInnerFileName + } + } + return newFrames; + } + + function GPSPromise(stackframes) { var gps = new StackTraceGPS(); - var promise = new Promise(function(resolve) { - var stackframes = ErrorStackParser.parse(error); + return new Promise(function(resolve) { resolve(Promise.all(stackframes.map(function(sf) { return new Promise(function(resolve) { function resolveOriginal() { @@ -1277,18 +1342,36 @@ }); }))); }); - promise.then(function(newFrames) { - newFrames.forEach(function(stackFrame, i) { - if (stackFrame.functionName) { - var fn = stackFrame.functionName + ' '; + } + + function stackGPS(error, xhr, jsonData) { + var object = generateErrorObject(error); + var messagesArr = []; + var promiseArr = []; + + function iterateObj(obj) { + Object.keys(obj).forEach(function(key) { + if (key === "error") { + if (objectLength(obj[key].stack) !== 0) { + messagesArr.push(obj[key].toString().split("\n")[0]); + promiseArr.push(GPSPromise(ErrorStackParser.parse(obj[key]))); + } + } + if (key === "inner" && obj[key].length !== 0) { + iterateObj(obj[key]); + } + }); + } + iterateObj(object); + Promise.all(promiseArr).then((values) => { + values.forEach(function(stackframe, index) { + if (index === 0) { + jsonData.detail = GenerateNewFrames(messagesArr[index], stackframe, false).join("\n"); } else { - var fn = ''; + jsonData.detail += GenerateNewFrames(messagesArr[index], stackframe, true).join("\n"); } - var stackString = ' at ' + fn + '(' + stackFrame.fileName + ':' + stackFrame.lineNumber + ':' + stackFrame.columnNumber + ')'; - newFrames[i] = stackString; }); - newFrames.unshift(errorStack); - jsonData.detail = newFrames.join("\n"); + }).then(function() { xhr.send(JSON.stringify(jsonData)); }); } @@ -1311,6 +1394,66 @@ } return stack.join('\n'); } + + function guid() { + var s4 = function() { + return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1).toUpperCase(); + } + return s4() + s4(); + } + + function inspectorObj(error, fullError) { + var obj = {}; + obj.Id = guid(); + if (typeof error === "object") { + var stack = error && objectLength(error.stack) !== 0 && typeof error === "object" ? ErrorStackParser.parse(error) : ''; + obj.Type = error.name; + obj.Message = error.message; + obj.StackTrace = objectLength(error.stack) !== 0 ? ErrorStackParser.parse(error) : null; + obj.Source = stack && stack.length > 0 ? stack[0].fileName : null; + obj.Inners = error.cause && typeof error.cause === "object" && error.cause instanceof Error ? [inspectorObj(error.cause)] : []; + } else { + obj.Type = typeof fullError.error; + obj.Message = fullError.message; + obj.StackTrace = stackString(fullError); + obj.Source = fullError.source; + obj.Inners = []; + } + return obj; + } + + function inspectorGPS(error) { + var inspectorObject = inspectorObj(error); + var promiseArr = []; + + function iterateObj(obj, final) { + Object.keys(obj).forEach(function(key) { + if (key === "StackTrace") { + if (!final) { + obj[key] = GPSPromise(obj[key]); + promiseArr.push(obj[key]); + } else { + obj[key].then(result => { + var generateNewFrames = GenerateNewFrames(obj.Type + ': ' + obj.Message, result, false, true); + obj[key] = generateNewFrames.newFrames.join("\n"); + obj['Source'] = generateNewFrames.fileName || null; + }); + } + } + if (key === "Inners" && obj[key].length !== 0) { + iterateObj(obj[key][0], final); + } + }); + } + iterateObj(inspectorObject, false); + return new Promise(function(resolve, reject) { + Promise.all(promiseArr).then(function(values) { + iterateObj(inspectorObject, true); + }).then(function() { + resolve(inspectorObject); + }); + }); + } var recordBreadcrumb = function(obj) { var crumb = merge_objects({ 'dateTime': new Date().toISOString() @@ -1473,6 +1616,11 @@ jsonData.source = errorLog.source; jsonData.title = "Uncaught " + typeOFCapitalized + ": " + errorLog.error; } + if (error.error && error.error.cause && typeof error.error.cause === "object" && error.error.cause instanceof Error) { + var typeAndSource = getErrorTypeSource(error.error); + jsonData.type = typeAndSource.type; + jsonData.source = typeAndSource.source; + } jsonData = merge_objects(jsonData, getPayload()); if (breadcrumbs.length > 0) { jsonData.breadcrumbs = breadcrumbs; @@ -1486,8 +1634,18 @@ if (send === 1) { publicAPIs.emit('message', jsonData); if (error.error && typeof error.error === "object" && objectLength(error.error.stack) !== 0 && typeof Promise !== "undefined" && Promise.toString().indexOf("[native code]") !== -1) { - stackGPS(error.error, xhr, jsonData); + inspectorGPS(error.error).then((result) => { + jsonData.data.push({ + "key": "X-ELMAHIO-EXCEPTIONINSPECTOR", + "value": JSON.stringify(result) + }); + stackGPS(error.error, xhr, jsonData); + }); } else { + jsonData.data.push({ + "key": "X-ELMAHIO-EXCEPTIONINSPECTOR", + "value": JSON.stringify(inspectorObj(error.error, errorLog)) + }); xhr.send(JSON.stringify(jsonData)); } } @@ -1527,7 +1685,7 @@ publicAPIs.emit('error', xhr.status, xhr.statusText); } if (type !== "Log") { - var stack = error && error instanceof Error ? ErrorStackParser.parse(error) : null; + var stack = error && error instanceof Error && objectLength(error.stack) !== 0 ? ErrorStackParser.parse(error) : null; var jsonData = { "title": message, "source": stack && stack.length > 0 ? stack[0].fileName : null, @@ -1536,6 +1694,11 @@ "type": error ? error.name : null, "queryString": JSON.parse(JSON.stringify(queryParams)) }; + if (error && error.cause && typeof error.cause === "object" && error.cause instanceof Error) { + var typeAndSource = getErrorTypeSource(error); + jsonData.type = typeAndSource.type; + jsonData.source = typeAndSource.source; + } jsonData = merge_objects(jsonData, getPayload()); } else { var jsonData = error; @@ -1560,12 +1723,24 @@ } publicAPIs.emit('message', jsonData); if (error && error instanceof Error && type !== "Log" && typeof Promise !== "undefined" && Promise.toString().indexOf("[native code]") !== -1) { - stackGPS(error, xhr, jsonData); + inspectorGPS(error).then((result) => { + jsonData.data.push({ + "key": "X-ELMAHIO-EXCEPTIONINSPECTOR", + "value": JSON.stringify(result) + }); + stackGPS(error, xhr, jsonData); + }); } else { if (jsonData.errorObject && jsonData.errorObject instanceof Error) { error = jsonData.errorObject; delete jsonData.errorObject; - stackGPS(error, xhr, jsonData); + inspectorGPS(error).then((result) => { + jsonData.data.push({ + "key": "X-ELMAHIO-EXCEPTIONINSPECTOR", + "value": JSON.stringify(result) + }); + stackGPS(error, xhr, jsonData); + }); } else { delete jsonData.errorObject; xhr.send(JSON.stringify(jsonData)); @@ -1689,7 +1864,7 @@ var sendPrefilledLogMessage = function(errorLog) { if (!errorLog) return getPayload(); var error = errorLog; - var stack = error ? ErrorStackParser.parse(error) : null; + var stack = error && objectLength(error.stack) !== 0 ? ErrorStackParser.parse(error) : null; var jsonData = { "title": error.message, "source": stack && stack.length > 0 ? stack[0].fileName : null, @@ -1698,6 +1873,11 @@ "type": error ? error.name : null, "errorObject": error }; + if (error && error.cause && typeof error.cause === "object" && error.cause instanceof Error) { + var typeAndSource = getErrorTypeSource(error); + jsonData.type = typeAndSource.type; + jsonData.source = typeAndSource.source; + } jsonData = merge_objects(jsonData, getPayload()); return jsonData; }; @@ -1813,7 +1993,17 @@ 'lineno': lineno, 'colno': colno, 'error': error - } + }; + setTimeout(function() { + sendPayload(settings.apiKey, settings.logId, confirmResponse, errorLog); + }, settings.breadcrumbs ? breadcrumbsDelay : 0); + return false; + } + window.onunhandledrejection = function(event) { + var errorLog = { + 'message': event.reason.message, + 'error': event.reason.message && event.reason.stack ? event.reason : undefined + }; setTimeout(function() { sendPayload(settings.apiKey, settings.logId, confirmResponse, errorLog); }, settings.breadcrumbs ? breadcrumbsDelay : 0); diff --git a/dist/elmahio.js.map b/dist/elmahio.js.map index f798753..2e07954 100644 --- a/dist/elmahio.js.map +++ b/dist/elmahio.js.map @@ -1 +1 @@ -{"version":3,"names":[],"mappings":"","sources":["elmahio.js"],"sourcesContent":["/*!\n * elmah.io Javascript Logger - version 3.7.1\n * (c) 2018 elmah.io, Apache 2.0 License, https://elmah.io\n */\n\n(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define([], function () {\n return factory(root);\n });\n } else if (typeof exports === 'object') {\n module.exports = factory(root);\n } else {\n root.Elmahio = factory(root);\n }\n})(typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : this, function (window) {\n\n 'use strict';\n\n //\n // ==== STACKFRAME ====\n //\n\n var StackFrame = (function () {\n \"use strict\";\n function _isNumber(n) {\n return !isNaN(parseFloat(n)) && isFinite(n);\n }\n function _capitalize(str) {\n return str.charAt(0).toUpperCase() + str.substring(1);\n }\n function _getter(p) {\n return function () {\n return this[p];\n };\n }\n var booleanProps = [\"isConstructor\", \"isEval\", \"isNative\", \"isToplevel\"];\n var numericProps = [\"columnNumber\", \"lineNumber\"];\n var stringProps = [\"fileName\", \"functionName\", \"source\"];\n var arrayProps = [\"args\"];\n var props = booleanProps.concat(numericProps, stringProps, arrayProps);\n function StackFrame(obj) {\n if (obj instanceof Object) {\n for (var i = 0; i < props.length; i++) {\n if (obj.hasOwnProperty(props[i]) && obj[props[i]] !== undefined) {\n this[\"set\" + _capitalize(props[i])](obj[props[i]]);\n }\n }\n }\n }\n StackFrame.prototype = {\n getArgs: function () {\n return this.args;\n },\n setArgs: function (v) {\n if (Object.prototype.toString.call(v) !== \"[object Array]\") {\n throw new TypeError(\"Args must be an Array\");\n }\n this.args = v;\n },\n getEvalOrigin: function () {\n return this.evalOrigin;\n },\n setEvalOrigin: function (v) {\n if (v instanceof StackFrame) {\n this.evalOrigin = v;\n } else if (v instanceof Object) {\n this.evalOrigin = new StackFrame(v);\n } else {\n throw new TypeError(\"Eval Origin must be an Object or StackFrame\");\n }\n },\n toString: function () {\n var functionName = this.getFunctionName() || \"{anonymous}\";\n var args = \"(\" + (this.getArgs() || []).join(\",\") + \")\";\n var fileName = this.getFileName() ? \"@\" + this.getFileName() : \"\";\n var lineNumber = _isNumber(this.getLineNumber()) ? \":\" + this.getLineNumber() : \"\";\n var columnNumber = _isNumber(this.getColumnNumber()) ? \":\" + this.getColumnNumber() : \"\";\n return functionName + args + fileName + lineNumber + columnNumber;\n }\n };\n StackFrame.fromString = function StackFrame$$fromString(str) {\n var argsStartIndex = str.indexOf(\"(\");\n var argsEndIndex = str.lastIndexOf(\")\");\n var functionName = str.substring(0, argsStartIndex);\n var args = str.substring(argsStartIndex + 1, argsEndIndex).split(\",\");\n var locationString = str.substring(argsEndIndex + 1);\n if (locationString.indexOf(\"@\") === 0) {\n var parts = /@(.+?)(?::(\\d+))?(?::(\\d+))?$/.exec(locationString, \"\");\n var fileName = parts[1];\n var lineNumber = parts[2];\n var columnNumber = parts[3];\n }\n return new StackFrame({\n functionName: functionName,\n args: args || undefined,\n fileName: fileName,\n lineNumber: lineNumber || undefined,\n columnNumber: columnNumber || undefined\n });\n };\n for (var i = 0; i < booleanProps.length; i++) {\n StackFrame.prototype[\"get\" + _capitalize(booleanProps[i])] = _getter(booleanProps[i]);\n StackFrame.prototype[\"set\" + _capitalize(booleanProps[i])] = function (p) {\n return function (v) {\n this[p] = Boolean(v);\n };\n }(booleanProps[i]);\n }\n for (var j = 0; j < numericProps.length; j++) {\n StackFrame.prototype[\"get\" + _capitalize(numericProps[j])] = _getter(numericProps[j]);\n StackFrame.prototype[\"set\" + _capitalize(numericProps[j])] = function (p) {\n return function (v) {\n if (!_isNumber(v)) {\n throw new TypeError(p + \" must be a Number\");\n }\n this[p] = Number(v);\n };\n }(numericProps[j]);\n }\n for (var k = 0; k < stringProps.length; k++) {\n StackFrame.prototype[\"get\" + _capitalize(stringProps[k])] = _getter(stringProps[k]);\n StackFrame.prototype[\"set\" + _capitalize(stringProps[k])] = function (p) {\n return function (v) {\n this[p] = String(v);\n };\n }(stringProps[k]);\n }\n return StackFrame;\n })();\n\n //\n // ==== ERROR STACK PARSER ====\n //\n\n var ErrorStackParser = (function () {\n \"use strict\";\n var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\\S+\\:\\d+/;\n var CHROME_IE_STACK_REGEXP = /^\\s*at .*(\\S+\\:\\d+|\\(native\\))/m;\n var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\\[native code\\])?$/;\n return {\n /**\n * Given an Error object, extract the most information from it.\n *\n * @param {Error} error object\n * @return {Array} of StackFrames\n */\n parse: function ErrorStackParser$$parse(error) {\n if (typeof error.stacktrace !== \"undefined\" || typeof error[\"opera#sourceloc\"] !== \"undefined\") {\n return this.parseOpera(error);\n } else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {\n return this.parseV8OrIE(error);\n } else if (error.stack) {\n return this.parseFFOrSafari(error);\n } else {\n throw new Error(\"Cannot parse given Error object\");\n }\n },\n // Separate line and column numbers from a string of the form: (URI:Line:Column)\n extractLocation: function ErrorStackParser$$extractLocation(urlLike) {\n // Fail-fast but return locations like \"(native)\"\n if (urlLike.indexOf(\":\") === -1) {\n return [urlLike];\n }\n var regExp = /(.+?)(?:\\:(\\d+))?(?:\\:(\\d+))?$/;\n var parts = regExp.exec(urlLike.replace(/[\\(\\)]/g, \"\"));\n return [parts[1], parts[2] || undefined, parts[3] || undefined];\n },\n parseV8OrIE: function ErrorStackParser$$parseV8OrIE(error) {\n var filtered = error.stack.split(\"\\n\").filter(function (line) {\n return !!line.match(CHROME_IE_STACK_REGEXP);\n }, this);\n return filtered.map(function (line) {\n if (line.indexOf(\"(eval \") > -1) {\n // Throw away eval information until we implement stacktrace.js/stackframe#8\n line = line.replace(/eval code/g, \"eval\").replace(/(\\(eval at [^\\()]*)|(\\)\\,.*$)/g, \"\");\n }\n var tokens = line.replace(/^\\s+/, \"\").replace(/\\(eval code/g, \"(\").split(/\\s+/).slice(1);\n var locationParts = this.extractLocation(tokens.pop());\n var functionName = tokens.join(\" \") || undefined;\n var fileName = [\"eval\", \"\"].indexOf(locationParts[0]) > -1 ? undefined : locationParts[0];\n return new StackFrame({\n functionName: functionName,\n fileName: fileName,\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n source: line\n });\n }, this);\n },\n parseFFOrSafari: function ErrorStackParser$$parseFFOrSafari(error) {\n var filtered = error.stack.split(\"\\n\").filter(function (line) {\n return !line.match(SAFARI_NATIVE_CODE_REGEXP);\n }, this);\n return filtered.map(function (line) {\n // Throw away eval information until we implement stacktrace.js/stackframe#8\n if (line.indexOf(\" > eval\") > -1) {\n line = line.replace(/ line (\\d+)(?: > eval line \\d+)* > eval\\:\\d+\\:\\d+/g, \":$1\");\n }\n if (line.indexOf(\"@\") === -1 && line.indexOf(\":\") === -1) {\n // Safari eval frames only have function names and nothing else\n return new StackFrame({\n functionName: line\n });\n } else {\n var functionNameRegex = /((.*\".+\"[^@]*)?[^@]*)(?:@)/;\n var matches = line.match(functionNameRegex);\n var functionName = matches && matches[1] ? matches[1] : undefined;\n var locationParts = this.extractLocation(line.replace(functionNameRegex, \"\"));\n return new StackFrame({\n functionName: functionName,\n fileName: locationParts[0],\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n source: line\n });\n }\n }, this);\n },\n parseOpera: function ErrorStackParser$$parseOpera(e) {\n if (!e.stacktrace || e.message.indexOf(\"\\n\") > -1 && e.message.split(\"\\n\").length > e.stacktrace.split(\"\\n\").length) {\n return this.parseOpera9(e);\n } else if (!e.stack) {\n return this.parseOpera10(e);\n } else {\n return this.parseOpera11(e);\n }\n },\n parseOpera9: function ErrorStackParser$$parseOpera9(e) {\n var lineRE = /Line (\\d+).*script (?:in )?(\\S+)/i;\n var lines = e.message.split(\"\\n\");\n var result = [];\n for (var i = 2, len = lines.length; i < len; i += 2) {\n var match = lineRE.exec(lines[i]);\n if (match) {\n result.push(new StackFrame({\n fileName: match[2],\n lineNumber: match[1],\n source: lines[i]\n }));\n }\n }\n return result;\n },\n parseOpera10: function ErrorStackParser$$parseOpera10(e) {\n var lineRE = /Line (\\d+).*script (?:in )?(\\S+)(?:: In function (\\S+))?$/i;\n var lines = e.stacktrace.split(\"\\n\");\n var result = [];\n for (var i = 0, len = lines.length; i < len; i += 2) {\n var match = lineRE.exec(lines[i]);\n if (match) {\n result.push(new StackFrame({\n functionName: match[3] || undefined,\n fileName: match[2],\n lineNumber: match[1],\n source: lines[i]\n }));\n }\n }\n return result;\n },\n // Opera 10.65+ Error.stack very similar to FF/Safari\n parseOpera11: function ErrorStackParser$$parseOpera11(error) {\n var filtered = error.stack.split(\"\\n\").filter(function (line) {\n return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) && !line.match(/^Error created at/);\n }, this);\n return filtered.map(function (line) {\n var tokens = line.split(\"@\");\n var locationParts = this.extractLocation(tokens.pop());\n var functionCall = tokens.shift() || \"\";\n var functionName = functionCall.replace(//, \"$2\").replace(/\\([^\\)]*\\)/g, \"\") || undefined;\n var argsRaw;\n if (functionCall.match(/\\(([^\\)]*)\\)/)) {\n argsRaw = functionCall.replace(/^[^\\(]+\\(([^\\)]*)\\)$/, \"$1\");\n }\n var args = argsRaw === undefined || argsRaw === \"[arguments not available]\" ? undefined : argsRaw.split(\",\");\n return new StackFrame({\n functionName: functionName,\n args: args,\n fileName: locationParts[0],\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n source: line\n });\n }, this);\n }\n };\n })();\n\n //\n // ==== STACKTRACE-GPS ====\n //\n\n var SourceMap = function(e){var n={};function r(t){if(n[t])return n[t].exports;var o=n[t]={exports:{},id:t,loaded:!1};return e[t].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}return r.m=e,r.c=n,r.p=\"\",r(0)}([function(e,n,r){var t=r(1),o=r(2),i=r(3).ArraySet,a=r(4),s=r(6).quickSort;function u(e){var n=e;return\"string\"==typeof e&&(n=JSON.parse(e.replace(/^\\)\\]\\}'/,\"\"))),null!=n.sections?new c(n):new l(n)}function l(e){var n=e;\"string\"==typeof e&&(n=JSON.parse(e.replace(/^\\)\\]\\}'/,\"\")));var r=t.getArg(n,\"version\"),o=t.getArg(n,\"sources\"),a=t.getArg(n,\"names\",[]),s=t.getArg(n,\"sourceRoot\",null),u=t.getArg(n,\"sourcesContent\",null),l=t.getArg(n,\"mappings\"),g=t.getArg(n,\"file\",null);if(r!=this._version)throw new Error(\"Unsupported version: \"+r);o=o.map(String).map(t.normalize).map(function(e){return s&&t.isAbsolute(s)&&t.isAbsolute(e)?t.relative(s,e):e}),this._names=i.fromArray(a.map(String),!0),this._sources=i.fromArray(o,!0),this.sourceRoot=s,this.sourcesContent=u,this._mappings=l,this.file=g}function g(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}function c(e){var n=e;\"string\"==typeof e&&(n=JSON.parse(e.replace(/^\\)\\]\\}'/,\"\")));var r=t.getArg(n,\"version\"),o=t.getArg(n,\"sections\");if(r!=this._version)throw new Error(\"Unsupported version: \"+r);this._sources=new i,this._names=new i;var a={line:-1,column:0};this._sections=o.map(function(e){if(e.url)throw new Error(\"Support for url field in sections not implemented.\");var n=t.getArg(e,\"offset\"),r=t.getArg(n,\"line\"),o=t.getArg(n,\"column\");if(r=0){var s=this._originalMappings[a];if(void 0===e.column)for(var u=s.originalLine;s&&s.originalLine===u;)i.push({line:t.getArg(s,\"generatedLine\",null),column:t.getArg(s,\"generatedColumn\",null),lastColumn:t.getArg(s,\"lastGeneratedColumn\",null)}),s=this._originalMappings[++a];else for(var l=s.originalColumn;s&&s.originalLine===n&&s.originalColumn==l;)i.push({line:t.getArg(s,\"generatedLine\",null),column:t.getArg(s,\"generatedColumn\",null),lastColumn:t.getArg(s,\"lastGeneratedColumn\",null)}),s=this._originalMappings[++a]}return i},n.SourceMapConsumer=u,l.prototype=Object.create(u.prototype),l.prototype.consumer=u,l.fromSourceMap=function(e){var n=Object.create(l.prototype),r=n._names=i.fromArray(e._names.toArray(),!0),o=n._sources=i.fromArray(e._sources.toArray(),!0);n.sourceRoot=e._sourceRoot,n.sourcesContent=e._generateSourcesContent(n._sources.toArray(),n.sourceRoot),n.file=e._file;for(var a=e._mappings.toArray().slice(),u=n.__generatedMappings=[],c=n.__originalMappings=[],p=0,h=a.length;p1&&(r.source=d+i[1],d+=i[1],r.originalLine=h+i[2],h=r.originalLine,r.originalLine+=1,r.originalColumn=f+i[3],f=r.originalColumn,i.length>4&&(r.name=m+i[4],m+=i[4])),L.push(r),\"number\"==typeof r.originalLine&&y.push(r)}s(L,t.compareByGeneratedPositionsDeflated),this.__generatedMappings=L,s(y,t.compareByOriginalPositions),this.__originalMappings=y},l.prototype._findMapping=function(e,n,r,t,i,a){if(e[r]<=0)throw new TypeError(\"Line must be greater than or equal to 1, got \"+e[r]);if(e[t]<0)throw new TypeError(\"Column must be greater than or equal to 0, got \"+e[t]);return o.search(e,n,i,a)},l.prototype.computeColumnSpans=function(){for(var e=0;e=0){var o=this._generatedMappings[r];if(o.generatedLine===n.generatedLine){var i=t.getArg(o,\"source\",null);null!==i&&(i=this._sources.at(i),null!=this.sourceRoot&&(i=t.join(this.sourceRoot,i)));var a=t.getArg(o,\"name\",null);return null!==a&&(a=this._names.at(a)),{source:i,line:t.getArg(o,\"originalLine\",null),column:t.getArg(o,\"originalColumn\",null),name:a}}}return{source:null,line:null,column:null,name:null}},l.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&(this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return null==e}))},l.prototype.sourceContentFor=function(e,n){if(!this.sourcesContent)return null;if(null!=this.sourceRoot&&(e=t.relative(this.sourceRoot,e)),this._sources.has(e))return this.sourcesContent[this._sources.indexOf(e)];var r;if(null!=this.sourceRoot&&(r=t.urlParse(this.sourceRoot))){var o=e.replace(/^file:\\/\\//,\"\");if(\"file\"==r.scheme&&this._sources.has(o))return this.sourcesContent[this._sources.indexOf(o)];if((!r.path||\"/\"==r.path)&&this._sources.has(\"/\"+e))return this.sourcesContent[this._sources.indexOf(\"/\"+e)]}if(n)return null;throw new Error('\"'+e+'\" is not in the SourceMap.')},l.prototype.generatedPositionFor=function(e){var n=t.getArg(e,\"source\");if(null!=this.sourceRoot&&(n=t.relative(this.sourceRoot,n)),!this._sources.has(n))return{line:null,column:null,lastColumn:null};var r={source:n=this._sources.indexOf(n),originalLine:t.getArg(e,\"line\"),originalColumn:t.getArg(e,\"column\")},o=this._findMapping(r,this._originalMappings,\"originalLine\",\"originalColumn\",t.compareByOriginalPositions,t.getArg(e,\"bias\",u.GREATEST_LOWER_BOUND));if(o>=0){var i=this._originalMappings[o];if(i.source===r.source)return{line:t.getArg(i,\"generatedLine\",null),column:t.getArg(i,\"generatedColumn\",null),lastColumn:t.getArg(i,\"lastGeneratedColumn\",null)}}return{line:null,column:null,lastColumn:null}},n.BasicSourceMapConsumer=l,c.prototype=Object.create(u.prototype),c.prototype.constructor=u,c.prototype._version=3,Object.defineProperty(c.prototype,\"sources\",{get:function(){for(var e=[],n=0;n=0;g--)\".\"===(a=u[g])?u.splice(g,1):\"..\"===a?l++:l>0&&(\"\"===a?(u.splice(g+1,l),l=0):(u.splice(g,2),l--));return\"\"===(r=u.join(\"/\"))&&(r=s?\"/\":\".\"),t?(t.path=r,i(t)):r}n.urlParse=o,n.urlGenerate=i,n.normalize=a,n.join=function(e,n){\"\"===e&&(e=\".\"),\"\"===n&&(n=\".\");var r=o(n),s=o(e);if(s&&(e=s.path||\"/\"),r&&!r.scheme)return s&&(r.scheme=s.scheme),i(r);if(r||n.match(t))return n;if(s&&!s.host&&!s.path)return s.host=n,i(s);var u=\"/\"===n.charAt(0)?n:a(e.replace(/\\/+$/,\"\")+\"/\"+n);return s?(s.path=u,i(s)):u},n.isAbsolute=function(e){return\"/\"===e.charAt(0)||!!e.match(r)},n.relative=function(e,n){\"\"===e&&(e=\".\"),e=e.replace(/\\/$/,\"\");for(var r=0;0!==n.indexOf(e+\"/\");){var t=e.lastIndexOf(\"/\");if(t<0)return n;if((e=e.slice(0,t)).match(/^([^\\/]+:\\/)?\\/*$/))return n;++r}return Array(r+1).join(\"../\")+n.substr(e.length+1)};var s=!(\"__proto__\"in Object.create(null));function u(e){return e}function l(e){if(!e)return!1;var n=e.length;if(n<9)return!1;if(95!==e.charCodeAt(n-1)||95!==e.charCodeAt(n-2)||111!==e.charCodeAt(n-3)||116!==e.charCodeAt(n-4)||111!==e.charCodeAt(n-5)||114!==e.charCodeAt(n-6)||112!==e.charCodeAt(n-7)||95!==e.charCodeAt(n-8)||95!==e.charCodeAt(n-9))return!1;for(var r=n-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function g(e,n){return e===n?0:e>n?1:-1}n.toSetString=s?u:function(e){return l(e)?\"$\"+e:e},n.fromSetString=s?u:function(e){return l(e)?e.slice(1):e},n.compareByOriginalPositions=function(e,n,r){var t=e.source-n.source;return 0!==t?t:0!=(t=e.originalLine-n.originalLine)?t:0!=(t=e.originalColumn-n.originalColumn)||r?t:0!=(t=e.generatedColumn-n.generatedColumn)?t:0!=(t=e.generatedLine-n.generatedLine)?t:e.name-n.name},n.compareByGeneratedPositionsDeflated=function(e,n,r){var t=e.generatedLine-n.generatedLine;return 0!==t?t:0!=(t=e.generatedColumn-n.generatedColumn)||r?t:0!=(t=e.source-n.source)?t:0!=(t=e.originalLine-n.originalLine)?t:0!=(t=e.originalColumn-n.originalColumn)?t:e.name-n.name},n.compareByGeneratedPositionsInflated=function(e,n){var r=e.generatedLine-n.generatedLine;return 0!==r?r:0!=(r=e.generatedColumn-n.generatedColumn)?r:0!==(r=g(e.source,n.source))?r:0!=(r=e.originalLine-n.originalLine)?r:0!=(r=e.originalColumn-n.originalColumn)?r:g(e.name,n.name)}},function(e,n){n.GREATEST_LOWER_BOUND=1,n.LEAST_UPPER_BOUND=2,n.search=function(e,r,t,o){if(0===r.length)return-1;var i=function e(r,t,o,i,a,s){var u=Math.floor((t-r)/2)+r,l=a(o,i[u],!0);return 0===l?u:l>0?t-u>1?e(u,t,o,i,a,s):s==n.LEAST_UPPER_BOUND?t1?e(r,u,o,i,a,s):s==n.LEAST_UPPER_BOUND?u:r<0?-1:r}(-1,r.length,e,r,t,o||n.GREATEST_LOWER_BOUND);if(i<0)return-1;for(;i-1>=0&&0===t(r[i],r[i-1],!0);)--i;return i}},function(e,n,r){var t=r(1),o=Object.prototype.hasOwnProperty;function i(){this._array=[],this._set=Object.create(null)}i.fromArray=function(e,n){for(var r=new i,t=0,o=e.length;t=0&&e>>=5)>0&&(n|=32),o+=t.encode(n)}while(i>0);return o},n.decode=function(e,n,r){var o,i,a,s,u=e.length,l=0,g=0;do{if(n>=u)throw new Error(\"Expected more digits in base 64 VLQ value.\");if(-1===(i=t.decode(e.charCodeAt(n++))))throw new Error(\"Invalid base64 digit: \"+e.charAt(n-1));o=!!(32&i),l+=(i&=31)<>1,1==(1&a)?-s:s),r.rest=n}},function(e,n){var r=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\".split(\"\");n.encode=function(e){if(0<=e&&e= 200 && req.status < 300 || url.substr(0, 7) === \"file://\" && req.responseText) {\n resolve(req.responseText);\n } else {\n reject(new Error(\"HTTP status: \" + req.status + \" retrieving \" + url));\n }\n }\n };\n req.send();\n });\n }\n /**\n * Convert a Base64-encoded string into its original representation.\n * Used for inline sourcemaps.\n *\n * @param {String} b64str Base-64 encoded string\n * @returns {String} original representation of the base64-encoded string.\n */\n function _atob(b64str) {\n if (typeof window !== \"undefined\" && window.atob) {\n return window.atob(b64str);\n } else {\n throw new Error(\"You must supply a polyfill for window.atob in this environment\");\n }\n }\n function _parseJson(string) {\n if (typeof JSON !== \"undefined\" && JSON.parse) {\n return JSON.parse(string);\n } else {\n throw new Error(\"You must supply a polyfill for JSON.parse in this environment\");\n }\n }\n function _findFunctionName(source, lineNumber) {\n var syntaxes = [ // {name} = function ({args}) TODO args capture\n /['\"]?([$_A-Za-z][$_A-Za-z0-9]*)['\"]?\\s*[:=]\\s*function\\b/, // function {name}({args}) m[1]=name m[2]=args\n /function\\s+([^('\"`]*?)\\s*\\(([^)]*)\\)/, // {name} = eval()\n /['\"]?([$_A-Za-z][$_A-Za-z0-9]*)['\"]?\\s*[:=]\\s*(?:eval|new Function)\\b/, // fn_name() {\n /\\b(?!(?:if|for|switch|while|with|catch)\\b)(?:(?:static)\\s+)?(\\S+)\\s*\\(.*?\\)\\s*\\{/, // {name} = () => {\n /['\"]?([$_A-Za-z][$_A-Za-z0-9]*)['\"]?\\s*[:=]\\s*\\(.*?\\)\\s*=>/];\n var lines = source.split(\"\\n\");\n // Walk backwards in the source lines until we find the line which matches one of the patterns above\n var code = \"\";\n var maxLines = Math.min(lineNumber, 20);\n for (var i = 0; i < maxLines; ++i) {\n // lineNo is 1-based, source[] is 0-based\n var line = lines[lineNumber - i - 1];\n var commentPos = line.indexOf(\"//\");\n if (commentPos >= 0) {\n line = line.substr(0, commentPos);\n }\n if (line) {\n code = line + code;\n var len = syntaxes.length;\n for (var index = 0; index < len; index++) {\n var m = syntaxes[index].exec(code);\n if (m && m[1]) {\n return m[1];\n }\n }\n }\n }\n return undefined;\n }\n function _ensureSupportedEnvironment() {\n if (typeof Object.defineProperty !== \"function\" || typeof Object.create !== \"function\") {\n throw new Error(\"Unable to consume source maps in older browsers\");\n }\n }\n function _ensureStackFrameIsLegit(stackframe) {\n if (typeof stackframe !== \"object\") {\n throw new TypeError(\"Given StackFrame is not an object\");\n } else if (typeof stackframe.fileName !== \"string\") {\n throw new TypeError(\"Given file name is not a String\");\n } else if (typeof stackframe.lineNumber !== \"number\" || stackframe.lineNumber % 1 !== 0 || stackframe.lineNumber < 1) {\n throw new TypeError(\"Given line number must be a positive integer\");\n } else if (typeof stackframe.columnNumber !== \"number\" || stackframe.columnNumber % 1 !== 0 || stackframe.columnNumber < 0) {\n throw new TypeError(\"Given column number must be a non-negative integer\");\n }\n return true;\n }\n function _findSourceMappingURL(source) {\n var sourceMappingUrlRegExp = /\\/\\/[#@] ?sourceMappingURL=([^\\s'\"]+)\\s*$/gm;\n var lastSourceMappingUrl;\n var matchSourceMappingUrl;\n while (matchSourceMappingUrl = sourceMappingUrlRegExp.exec(source)) {\n // jshint ignore:line\n lastSourceMappingUrl = matchSourceMappingUrl[1];\n }\n if (lastSourceMappingUrl) {\n return lastSourceMappingUrl;\n } else {\n throw new Error(\"sourceMappingURL not found\");\n }\n }\n function _extractLocationInfoFromSourceMapSource(stackframe, sourceMapConsumer, sourceCache) {\n return new Promise(function (resolve, reject) {\n var loc = sourceMapConsumer.originalPositionFor({\n line: stackframe.lineNumber,\n column: stackframe.columnNumber\n });\n if (loc.source) {\n // cache mapped sources\n var mappedSource = sourceMapConsumer.sourceContentFor(loc.source);\n if (mappedSource) {\n sourceCache[loc.source] = mappedSource;\n }\n resolve(// given stackframe and source location, update stackframe\n new StackFrame({\n functionName: loc.name || stackframe.functionName,\n args: stackframe.args,\n fileName: loc.source,\n lineNumber: loc.line,\n columnNumber: loc.column\n }));\n } else {\n reject(new Error(\"Could not get original source for given stackframe and source map\"));\n }\n });\n }\n /**\n * @constructor\n * @param {Object} opts\n * opts.sourceCache = {url: \"Source String\"} => preload source cache\n * opts.sourceMapConsumerCache = {/path/file.js.map: SourceMapConsumer}\n * opts.offline = True to prevent network requests.\n * Best effort without sources or source maps.\n * opts.ajax = Promise returning function to make X-Domain requests\n */\n return function StackTraceGPS(opts) {\n if (!(this instanceof StackTraceGPS)) {\n return new StackTraceGPS(opts);\n }\n opts = opts || {};\n this.sourceCache = opts.sourceCache || {};\n this.sourceMapConsumerCache = opts.sourceMapConsumerCache || {};\n this.ajax = opts.ajax || _xdr;\n this._atob = opts.atob || _atob;\n\n this._get = function _get(location) {\n return new Promise(function (resolve, reject) {\n var isDataUrl = location.substr(0, 5) === \"data:\";\n if (this.sourceCache[location]) {\n resolve(this.sourceCache[location]);\n } else if (opts.offline && !isDataUrl) {\n reject(new Error(\"Cannot make network requests in offline mode\"));\n } else {\n if (isDataUrl) {\n // data URLs can have parameters.\n // see http://tools.ietf.org/html/rfc2397\n var supportedEncodingRegexp = /^data:application\\/json;([\\w=:\"-]+;)*base64,/;\n var match = location.match(supportedEncodingRegexp);\n if (match) {\n var sourceMapStart = match[0].length;\n var encodedSource = location.substr(sourceMapStart);\n var source = this._atob(encodedSource);\n this.sourceCache[location] = source;\n resolve(source);\n } else {\n reject(new Error(\"The encoding of the inline sourcemap is not supported\"));\n }\n } else {\n var xhrPromise = this.ajax(location, {\n method: \"get\"\n });\n // Cache the Promise to prevent duplicate in-flight requests\n this.sourceCache[location] = xhrPromise;\n xhrPromise.then(resolve, reject);\n }\n }\n }.bind(this));\n };\n /**\n * Creating SourceMapConsumers is expensive, so this wraps the creation of a\n * SourceMapConsumer in a per-instance cache.\n *\n * @param {String} sourceMappingURL = URL to fetch source map from\n * @param {String} defaultSourceRoot = Default source root for source map if undefined\n * @returns {Promise} that resolves a SourceMapConsumer\n */\n this._getSourceMapConsumer = function _getSourceMapConsumer(sourceMappingURL, defaultSourceRoot) {\n return new Promise(function (resolve, reject) {\n if (this.sourceMapConsumerCache[sourceMappingURL]) {\n resolve(this.sourceMapConsumerCache[sourceMappingURL]);\n } else {\n var sourceMapConsumerPromise = new Promise(function (resolve, reject) {\n return this._get(sourceMappingURL).then(function (sourceMapSource) {\n if (typeof sourceMapSource === \"string\") {\n sourceMapSource = _parseJson(sourceMapSource.replace(/^\\)\\]\\}'/, \"\"));\n }\n if (typeof sourceMapSource.sourceRoot === \"undefined\") {\n sourceMapSource.sourceRoot = defaultSourceRoot;\n }\n resolve(new SourceMap.SourceMapConsumer(sourceMapSource));\n }, reject);\n }.bind(this));\n this.sourceMapConsumerCache[sourceMappingURL] = sourceMapConsumerPromise;\n resolve(sourceMapConsumerPromise);\n }\n }.bind(this));\n };\n /**\n * Given a StackFrame, enhance function name and use source maps for a\n * better StackFrame.\n *\n * @param {StackFrame} stackframe object\n * @returns {Promise} that resolves with with source-mapped StackFrame\n */\n this.pinpoint = function StackTraceGPS$$pinpoint(stackframe) {\n return new Promise(function (resolve, reject) {\n this.getMappedLocation(stackframe).then(function (mappedStackFrame) {\n function resolveMappedStackFrame() {\n resolve(mappedStackFrame);\n }\n this.findFunctionName(mappedStackFrame).then(resolve, resolveMappedStackFrame)[\"catch\"](resolveMappedStackFrame);\n }.bind(this), reject);\n }.bind(this));\n };\n /**\n * Given a StackFrame, guess function name from location information.\n *\n * @param {StackFrame} stackframe\n * @returns {Promise} that resolves with enhanced StackFrame.\n */\n this.findFunctionName = function StackTraceGPS$$findFunctionName(stackframe) {\n return new Promise(function (resolve, reject) {\n _ensureStackFrameIsLegit(stackframe);\n this._get(stackframe.fileName).then(function getSourceCallback(source) {\n var lineNumber = stackframe.lineNumber;\n var columnNumber = stackframe.columnNumber;\n var guessedFunctionName = _findFunctionName(source, lineNumber, columnNumber);\n // Only replace functionName if we found something\n if (guessedFunctionName) {\n resolve(new StackFrame({\n functionName: guessedFunctionName,\n args: stackframe.args,\n fileName: stackframe.fileName,\n lineNumber: lineNumber,\n columnNumber: columnNumber\n }));\n } else {\n resolve(stackframe);\n }\n }, reject)[\"catch\"](reject);\n }.bind(this));\n };\n /**\n * Given a StackFrame, seek source-mapped location and return new enhanced StackFrame.\n *\n * @param {StackFrame} stackframe\n * @returns {Promise} that resolves with enhanced StackFrame.\n */\n this.getMappedLocation = function StackTraceGPS$$getMappedLocation(stackframe) {\n return new Promise(function (resolve, reject) {\n _ensureSupportedEnvironment();\n _ensureStackFrameIsLegit(stackframe);\n var sourceCache = this.sourceCache;\n var fileName = stackframe.fileName;\n this._get(fileName).then(function (source) {\n var sourceMappingURL = _findSourceMappingURL(source);\n var isDataUrl = sourceMappingURL.substr(0, 5) === \"data:\";\n var defaultSourceRoot = fileName.substring(0, fileName.lastIndexOf(\"/\") + 1);\n if (sourceMappingURL[0] !== \"/\" && !isDataUrl && !/^https?:\\/\\/|^\\/\\//i.test(sourceMappingURL)) {\n sourceMappingURL = defaultSourceRoot + sourceMappingURL;\n }\n return this._getSourceMapConsumer(sourceMappingURL, defaultSourceRoot).then(function (sourceMapConsumer) {\n return _extractLocationInfoFromSourceMapSource(stackframe, sourceMapConsumer, sourceCache).then(resolve)[\"catch\"](function () {\n resolve(stackframe);\n });\n });\n }.bind(this), reject)[\"catch\"](reject);\n }.bind(this));\n };\n };\n })(SourceMap, StackFrame);\n\n //\n // Shared Variables\n //\n\n var myScript = null;\n var scriptFile = document.getElementsByTagName('script');\n \n for (var i = 0; i < scriptFile.length; ++i) {\n if(isMe(scriptFile[i])) {\n myScript = scriptFile[i];\n }\n }\n\n var queryString = myScript != null ? myScript.src.replace(/^[^\\?]+\\??/, '') : null;\n var params = parseQuery(queryString);\n var paramsLength = objectLength(params);\n\n var debugSettings = {\n label: ' elmah.io debugger : On ',\n labelCSS: 'background: #06a89c; color: #ffffff; display: inline-block; font-size: 14px;',\n successCSS: 'background: #d4edda; color: #155724; display: inline-block; font-size: 13px;',\n errorCSS: 'background: #f8d7da; color: #721c24; display: inline-block; font-size: 13px;',\n warningCSS: 'background: #fff3cd; color: #856404; display: inline-block; font-size: 13px;',\n lightCSS: 'background: #e2e3e5; color: #383d41; display: inline-block; font-size: 13px;'\n };\n\n var defaults = {\n apiKey: null,\n logId: null,\n debug: false,\n application: null,\n filter: null,\n captureConsoleMinimumLevel: 'none',\n breadcrumbs: false,\n breadcrumbsNumber: 10\n };\n\n var breadcrumbsDelay = 100;\n\n //\n // Shared Methods\n //\n\n var extend = function () {\n\n // Variables\n var extended = {};\n var deep = false;\n var i = 0;\n\n // Check if a deep merge\n if (Object.prototype.toString.call(arguments[0]) === '[object Boolean]') {\n deep = arguments[0];\n i++;\n }\n\n // Merge the object into the extended object\n var merge = function (obj) {\n for (var prop in obj) {\n if (obj.hasOwnProperty(prop)) {\n // If property is an object, merge properties\n if (deep && Object.prototype.toString.call(obj[prop]) === '[object Object]') {\n extended[prop] = extend(extended[prop], obj[prop]);\n } else {\n extended[prop] = obj[prop];\n }\n }\n }\n };\n\n // Loop through each object and conduct a merge\n for (; i < arguments.length; i++) {\n var obj = arguments[i];\n merge(obj);\n }\n\n return extended;\n\n };\n\n //\n // Helpers\n //\n\n function isMe(scriptElem){\n if(scriptElem.getAttribute('src') != null) {\n return scriptElem.getAttribute('src').indexOf('elmahio') != -1 && scriptElem.getAttribute('src').indexOf('apiKey') != -1 && scriptElem.getAttribute('src').indexOf('logId') != -1;\n }\n }\n\n function isInt(n){\n return Number(n) === n && n % 1 === 0;\n }\n\n function isFloat(n){\n return Number(n) === n && n % 1 !== 0;\n }\n\n function parseQuery(query) {\n var Params = new Object();\n if (!query) return Params; // return empty object\n var Pairs = query.split(/[;&]/);\n for (var i = 0; i < Pairs.length; i++) {\n var KeyVal = Pairs[i].split('=');\n if (!KeyVal || KeyVal.length !== 2) continue;\n var key = unescape(KeyVal[0]);\n var val = unescape(KeyVal[1]);\n val = val.replace(/\\+/g, ' ');\n Params[key] = val;\n }\n return Params;\n }\n\n function objectLength(obj) {\n var size = 0, key;\n for (key in obj) {\n if (obj.hasOwnProperty(key)) size++;\n }\n return size;\n };\n\n function getSearchParameters() {\n var prmstr = window.location.search.substr(1);\n return prmstr !== null && prmstr !== \"\" ? transformToAssocArray(prmstr) : {};\n }\n\n function transformToAssocArray(prmstr) {\n var params = [];\n var prmarr = prmstr.split(\"&\");\n for (var i = 0; i < prmarr.length; i++) {\n var tmparr = prmarr[i].split(\"=\");\n params.push({\n 'key': tmparr[0],\n 'value': tmparr[1]\n });\n }\n return params;\n }\n\n function merge_objects(obj1, obj2) {\n var obj3 = {};\n for (var attrname1 in obj1) {\n obj3[attrname1] = obj1[attrname1];\n }\n for (var attrname2 in obj2) {\n obj3[attrname2] = obj2[attrname2];\n }\n\n return obj3;\n }\n\n function isString(what) {\n return Object.prototype.toString.call(what) === '[object String]';\n }\n\n function cssSelectorString(elem) {\n var MAX_TRAVERSE_HEIGHT = 5,\n MAX_OUTPUT_LEN = 80,\n out = [],\n height = 0,\n len = 0,\n separator = ' > ',\n sepLength = separator.length,\n nextStr;\n while (elem && height++ < MAX_TRAVERSE_HEIGHT) {\n nextStr = htmlElementAsString(elem);\n if (nextStr === 'html' || (height > 1 && len + out.length * sepLength + nextStr.length >= MAX_OUTPUT_LEN)) {\n break;\n }\n out.push(nextStr);\n len += nextStr.length;\n elem = elem.parentNode;\n }\n return out.reverse().join(separator);\n }\n \n function htmlElementAsString(elem) {\n var out = [], className, classes, key, attr, i;\n if (!elem || !elem.tagName) {\n return '';\n }\n out.push(elem.tagName.toLowerCase());\n if (elem.id) {\n out.push('#' + elem.id);\n }\n className = elem.className;\n if (className && isString(className)) {\n classes = className.split(/\\s+/);\n for (i = 0; i < classes.length; i++) {\n out.push('.' + classes[i]);\n }\n }\n var attrWhitelist = ['type', 'name', 'title', 'alt'];\n for (i = 0; i < attrWhitelist.length; i++) {\n key = attrWhitelist[i];\n attr = elem.getAttribute(key);\n if (attr) {\n out.push('[' + key + '=\"' + attr + '\"]');\n }\n }\n return out.join('');\n }\n\n var parseHash = function(url) {\n return url.split('#')[1] || '';\n };\n\n //\n // Constructor\n //\n\n var Constructor = function (options) {\n\n //\n // Variables\n //\n\n var publicAPIs = {};\n var settings;\n var breadcrumbs = [];\n var lastHref = window.location && window.location.href;\n\n function getPayload() {\n var payload = {\n \"url\": document.location.pathname || '/',\n \"application\": settings.application\n };\n\n var payload_data = [];\n\n if (document.documentMode) payload_data.push({ \"key\": \"Document-Mode\", \"value\": document.documentMode });\n if (window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth) payload_data.push({ \"key\": \"Browser-Width\", \"value\": window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth });\n if (window.innerHeight || document.documentElement.clientHeight || document.getElementsByTagName('body')[0].clientHeight) payload_data.push({ \"key\": \"Browser-Height\", \"value\": window.innerHeight || document.documentElement.clientHeight || document.getElementsByTagName('body')[0].clientHeight });\n if ((screen.msOrientation || (screen.orientation || screen.mozOrientation || {}).type) !== undefined) payload_data.push({ \"key\": \"Screen-Orientation\", \"value\": ((screen.msOrientation || (screen.orientation || screen.mozOrientation || {}).type).split(\"-\"))[0] });\n if (screen.width) payload_data.push({ \"key\": \"Screen-Width\", \"value\": screen.width });\n if (screen.height) payload_data.push({ \"key\": \"Screen-Height\", \"value\": screen.height });\n if (screen.colorDepth) payload_data.push({ \"key\": \"Color-Depth\", \"value\": screen.colorDepth });\n payload_data.push({ \"key\": \"X-ELMAHIO-SEARCH-isClientside\", \"value\": \"true\" });\n\n payload.data = payload_data;\n\n var payload_serverVariables = [];\n if (navigator.language) payload_serverVariables.push({ \"key\": \"User-Language\", \"value\": navigator.language });\n if (navigator.userAgent) payload_serverVariables.push({ \"key\": \"User-Agent\", \"value\": navigator.userAgent });\n if (document.referrer) payload_serverVariables.push({ \"key\": \"Referer\", \"value\": document.referrer });\n if (document.location.protocol === \"https:\") payload_serverVariables.push({ \"key\": \"HTTPS\", \"value\": 'on' });\n if (document.location.hostname) payload_serverVariables.push({ \"key\": \"Host\", \"value\": document.location.hostname });\n\n payload.serverVariables = payload_serverVariables;\n\n return payload;\n }\n\n function confirmResponse(status, response) {\n if (settings.debug) {\n if (status === 'error') {\n console.log('%c \\u2BC8 Error log: ' + '%c \\u2715 Not created ', debugSettings.lightCSS, debugSettings.errorCSS);\n } else if (status === 'success') {\n console.log('%c \\u2BC8 Error log: ' + '%c \\u2714 ' + response + ' at ' + new Date().toLocaleString() + ' ', debugSettings.lightCSS, debugSettings.successCSS);\n } else {\n console.log('%c \\u2BC8 Error log: ' + '%c \\u2715 Not created. Title should not be undefined, null or empty ! ', debugSettings.lightCSS, debugSettings.errorCSS);\n }\n }\n }\n\n function stackGPS(error, xhr, jsonData) {\n \tvar errorStack = error.toString().split(\"\\n\")[0];\n \tvar gps = new StackTraceGPS();\n var promise = new Promise(function(resolve) {\n\t var stackframes = ErrorStackParser.parse(error);\n\t resolve(Promise.all(stackframes.map(function(sf) {\n\t return new Promise(function(resolve) {\n\t function resolveOriginal() {\n\t resolve(sf);\n\t }\n\t gps.pinpoint(sf).then(resolve, resolveOriginal)['catch'](resolveOriginal);\n\t });\n\t })));\t\n });\n\n promise.then(function(newFrames){\n \tnewFrames.forEach(function(stackFrame, i){\n\t\t\t\t\tif(stackFrame.functionName) {\n \t\t\tvar fn = stackFrame.functionName + ' ';\n \t\t} else {\n \t\t\tvar fn = '';\n \t\t}\n \t\tvar stackString = ' at ' + fn + '(' + stackFrame.fileName + ':' + stackFrame.lineNumber + ':' + stackFrame.columnNumber + ')';\n \t\tnewFrames[i] = stackString;\n \t});\n \tnewFrames.unshift(errorStack);\n \tjsonData.detail = newFrames.join(\"\\n\");\n \txhr.send(JSON.stringify(jsonData));\n });\n }\n\n function stackString(error) {\n \tvar typeOF = typeof error.error;\n \tvar typeOFCapitalized = typeOF.charAt(0).toUpperCase() + typeOF.slice(1);\n\n \treturn typeOFCapitalized + ': ' + error.error + '\\n' + ' at ' + '(' + error.source + ':' + error.lineno + ':' + error.colno + ')';\n }\n\n function manipulateStack (errorStack, severity, message) {\n var stack = [];\n for (var i = 0; i < errorStack.length; i++) {\n if(errorStack[i] === \"Error\") {\n stack.push(severity + \": \" + message);\n }\n if(!errorStack[i].match(/elmahio.js|elmahio.min.js/g) && errorStack[i] !== \"Error\") {\n stack.push(errorStack[i]);\n }\n }\n return stack.join('\\n');\n }\n\n // Private methods\n\n var recordBreadcrumb = function(obj) {\n var crumb = merge_objects({'dateTime': new Date().toISOString()}, obj),\n breadcrumbs_number = 10;\n \n breadcrumbs.push(crumb);\n \n if(options.breadcrumbsNumber >= 0 && typeof options.breadcrumbsNumber === \"number\" ) {\n if(options.breadcrumbsNumber > 25) {\n breadcrumbs_number = 25;\n } else if(options.breadcrumbsNumber <= 25) {\n breadcrumbs_number = options.breadcrumbsNumber;\n }\n }\n \n if (breadcrumbs.length > breadcrumbs_number) {\n breadcrumbs.shift();\n }\n }\n\n var breadcrumbClickEventHandler = function(evt) {\n var target;\n try {\n target = cssSelectorString(evt.target);\n } catch (e) {\n target = \"\";\n }\n\n recordBreadcrumb({\n \"severity\": \"Information\",\n \"action\": \"Click\",\n \"message\": target\n });\n }\n\n var breadcrumbFormSubmitEventHandler = function(evt) {\n var target;\n try {\n target = cssSelectorString(evt.target);\n } catch (e) {\n target = \"\";\n }\n\n recordBreadcrumb({\n \"severity\": \"Information\",\n \"action\": \"Form submit\",\n \"message\": target\n });\n }\n\n var breadcrumbWindowEventHandler = function(evt) {\n var type = evt.type,\n message = null;\n\n switch (type) {\n case \"load\":\n message = \"Page loaded\"; break;\n case \"DOMContentLoaded\":\n message = \"DOMContentLoaded\"; break;\n case \"pageshow\":\n message = \"Page shown\"; break;\n case \"pagehide\":\n message = \"Page hidden\"; break;\n case \"popstate\":\n message = \"Navigated from: \" + lastHref + \" to: \" + window.location.href; break;\n }\n\n recordBreadcrumb({\n \"severity\": \"Information\",\n \"action\": \"Navigation\",\n \"message\": message\n });\n }\n\n var breadcrumbHashChangeEventHandler = function(evt) {\n var oldURL = evt.oldURL,\n newURL = evt.newURL,\n from = null,\n to = null,\n message = null;\n\n if (oldURL && newURL) {\n from = parseHash(oldURL);\n to = parseHash(newURL);\n message = \"from: '\" + from + \"' to: '\" + to + \"'\";\n } else {\n to = location.hash;\n message = \"to: '\" + to + \"'\";\n }\n\n recordBreadcrumb({\n \"severity\": \"Information\",\n \"action\": \"Navigation\",\n \"message\": \"Hash changed \" + message\n });\n }\n\n var breadcrumbXHRHandler = function(evt, method, url) {\n var status = evt && evt.target ? evt.target.status : 0,\n severity = null,\n method = method.toUpperCase(),\n url = url,\n regex = /https:\\/\\/api.elmah.io/g;\n\n if(url.match(regex) == null) { \n if (status > 0 && status < 400) {\n severity = \"Information\";\n } else if (status > 399 && status < 500) {\n severity = \"Warning\";\n } else if (status >= 500) {\n severity = \"Error\";\n }\n\n var statusCode = status > 0 ? \" (\" + status + \")\" : \"\";\n\n recordBreadcrumb({\n \"severity\": severity,\n \"action\": \"Request\",\n \"message\": \"[\" + method + \"] \" + url + statusCode\n });\n }\n }\n\n var sendPayload = function (apiKey, logId, callback, errorLog) {\n var api_key = apiKey,\n log_id = logId,\n error = errorLog,\n send = 1,\n queryParams = getSearchParameters(),\n stack = error.error && objectLength(error.error.stack) !== 0 && typeof error.error === \"object\" ? ErrorStackParser.parse(error.error) : '';\n\n // Ignoring error from an external script\n if (error && error.colno === 0 && error.lineno === 0 && (!stack || stack === '') && error.message && (error.message === \"Script error.\" || error.message === \"Script error\")) {\n\t\t\t if (settings.debug) {\n\t\t\t console.log('%c \\u2BC8 Error log: ' + '%c \\uD83D\\uDEC8 Ignoring error from external script ', debugSettings.lightCSS, debugSettings.warningCSS);\n\t\t\t }\n\t\t\t return;\n\t\t\t}\n\n if ((api_key !== null && log_id !== null) || (paramsLength === 2)) {\n\n // Priority for parameters\n if (params.hasOwnProperty('apiKey') && params.hasOwnProperty('logId')) {\n api_key = params['apiKey'];\n log_id = params['logId'];\n }\n\n // get new XHR object\n var xhr = new XMLHttpRequest();\n xhr.open(\"POST\", \"https://api.elmah.io/v3/messages/\" + log_id + \"?api_key=\" + api_key, true);\n\n xhr.setRequestHeader('Content-type', 'application/json');\n\n xhr.onload = function (e) {\n if (xhr.readyState === 4) {\n if (xhr.status === 201) {\n callback('success', xhr.statusText);\n }\n\n if(xhr.status >= 400 && xhr.status <= 499) {\n callback('error', xhr.statusText);\n\n // on error event\n publicAPIs.emit('error', xhr.status, xhr.statusText);\n }\n }\n };\n\n xhr.onerror = function (e) {\n callback('error', xhr.statusText);\n\n // on error event\n publicAPIs.emit('error', xhr.status, xhr.statusText);\n }\n\n var jsonData = {\n \"detail\": error.error ? error.error.stack : null,\n \"title\": error.message || 'Unspecified error',\n \"source\": stack && stack.length > 0 ? stack[0].fileName : null,\n \"severity\": \"Error\",\n \"type\": error.error ? error.error.name : null,\n \"queryString\": JSON.parse(JSON.stringify(queryParams))\n };\n\n // Check if error sent is a string and not an object\n // Then create the articifial stacktrace and pass source & type of the error\n if(error.error && (objectLength(error.error.stack) === 0) && typeof jsonData.detail === \"undefined\") {\n \tvar typeOF = typeof errorLog.error;\n \t\t\tvar typeOFCapitalized = typeOF.charAt(0).toUpperCase() + typeOF.slice(1);\n\n \tjsonData.detail = stackString(errorLog);\n \tjsonData.source = errorLog.source;\n jsonData.title = \"Uncaught \" + typeOFCapitalized + \": \" + errorLog.error;\n }\n\n // Add payload to jsonData\n jsonData = merge_objects(jsonData, getPayload());\n\n // Add breadcrumbs to jsonData\n if(breadcrumbs.length > 0) {\n jsonData.breadcrumbs = breadcrumbs;\n breadcrumbs = [];\n }\n\n // filter callback\n if (settings.filter !== null) {\n if (settings.filter(jsonData)) {\n send = 0;\n }\n }\n\n if (send === 1) {\n // on message event\n publicAPIs.emit('message', jsonData);\n\n if (error.error && typeof error.error === \"object\" && objectLength(error.error.stack) !== 0 && typeof Promise !== \"undefined\" && Promise.toString().indexOf(\"[native code]\") !== -1) {\n \t// send message trying to pinpoint stackframes\n \tstackGPS(error.error, xhr, jsonData);\n\t } else {\n\t \t// send message\n \txhr.send(JSON.stringify(jsonData));\n\t }\n }\n\n } else {\n return console.log('Login api error');\n }\n };\n\n var sendManualPayload = function (apiKey, logId, callback, logType, messageLog, errorLog) {\n var api_key = apiKey,\n log_id = logId,\n type = logType,\n error = errorLog,\n message = messageLog,\n send = 1,\n queryParams = getSearchParameters();\n\n if ((api_key !== null && log_id !== null) || (paramsLength === 2)) {\n\n // Priority for parameters\n if (params.hasOwnProperty('apiKey') && params.hasOwnProperty('logId')) {\n api_key = params['apiKey'];\n log_id = params['logId'];\n }\n\n // get new XHR object\n var xhr = new XMLHttpRequest();\n xhr.open(\"POST\", \"https://api.elmah.io/v3/messages/\" + log_id + \"?api_key=\" + api_key, true);\n xhr.setRequestHeader('Content-type', 'application/json');\n\n xhr.onload = function (e) {\n if (xhr.readyState === 4) {\n if (xhr.status === 201) {\n callback('success', xhr.statusText);\n }\n\n if(xhr.status >= 400 && xhr.status <= 499) {\n callback('error', xhr.statusText);\n\n // on error event\n publicAPIs.emit('error', xhr.status, xhr.statusText);\n }\n }\n };\n\n xhr.onerror = function (e) {\n callback('error', xhr.statusText);\n\n // on error event\n publicAPIs.emit('error', xhr.status, xhr.statusText);\n }\n\n if (type !== \"Log\") {\n\n var stack = error && error instanceof Error ? ErrorStackParser.parse(error) : null;\n\n var jsonData = {\n \"title\": message,\n \"source\": stack && stack.length > 0 ? stack[0].fileName : null,\n \"detail\": error ? error.stack : null,\n \"severity\": type,\n \"type\": error ? error.name : null,\n \"queryString\": JSON.parse(JSON.stringify(queryParams))\n };\n\n // Add payload to jsonData\n jsonData = merge_objects(jsonData, getPayload());\n\n } else {\n\n var jsonData = error;\n \n }\n\n // filter callback\n if (settings.filter !== null) {\n if (settings.filter(jsonData)) {\n send = 0;\n }\n }\n\n if (send === 1) {\n if (jsonData.title) {\n\n // Add breadcrumbs to jsonData\n if(breadcrumbs.length > 0) {\n // If message contains breadcrumbs\n if(jsonData.breadcrumbs && jsonData.breadcrumbs.length > 0) {\n breadcrumbs = breadcrumbs.reverse();\n for (var i = 0; i < breadcrumbs.length; i++) {\n // Add breadcrumbs to jsonData object\n jsonData.breadcrumbs.unshift(breadcrumbs[i]);\n }\n } else {\n jsonData.breadcrumbs = breadcrumbs;\n }\n \n // Reset breadcrumbs\n breadcrumbs = [];\n }\n\n // on message event\n publicAPIs.emit('message', jsonData);\n\n if (error && error instanceof Error && type !== \"Log\" && typeof Promise !== \"undefined\" && Promise.toString().indexOf(\"[native code]\") !== -1) {\n // send message trying to pinpoint stackframes\n stackGPS(error, xhr, jsonData);\n } else {\n // send message\n if(jsonData.errorObject && jsonData.errorObject instanceof Error) {\n error = jsonData.errorObject;\n delete jsonData.errorObject;\n stackGPS(error, xhr, jsonData);\n } else {\n delete jsonData.errorObject;\n xhr.send(JSON.stringify(jsonData));\n }\n }\n\n } else {\n callback('missing-title', xhr.statusText);\n }\n }\n\n } else {\n return console.log('Login api error');\n }\n };\n\n var sendPayloadFromConsole = function (apiKey, logId, callback, logType, errorLog) {\n var api_key = apiKey,\n log_id = logId,\n message = errorLog.message,\n messageTemplate = errorLog.message,\n type = logType,\n args = Object.values(errorLog.arguments),\n send = 1,\n queryParams = getSearchParameters();\n\n function format(f, args) {\n var formatRegExp = /%[sdif]/g;\n var str = f;\n\n if(args.length > 1) {\n // If message has placeholders (%s, %d, %i, %f), check for arguments and replace them\n if(String(f).match(/%[sdif]/g)) {\n var i = 0;\n str = String(f).replace(formatRegExp, function(x) {\n switch (x) {\n case '%s': i++; return args[i] ? String(args[i]) : '%s';\n case '%d': i++; return args[i] ? (isInt(args[i]) || isFloat(args[i])) ? parseInt(args[i]) : 'NaN' : '%d';\n case '%i': i++; return args[i] ? (isInt(args[i]) || isFloat(args[i])) ? parseInt(args[i]) : 'NaN' : '%i';\n case '%f': i++; return args[i] ? (isInt(args[i]) || isFloat(args[i])) ? parseFloat(args[i]) : 'NaN' : '%f';\n default: return x;\n }\n });\n\n for (var len = args.length, x = args[++i]; i < len; x = args[++i]) {\n if (x === null || typeof x !== 'object') {\n str += ' ' + x;\n } else {\n str += ' ' + String(Object.prototype.toString.call(x));\n }\n }\n } else {\n str = args.join(' ');\n }\n }\n\n return str;\n }\n\n message = format(message, args);\n\n if(typeof message !== \"string\" && message !== undefined){\n message = message.toString();\n }\n\n if(typeof messageTemplate !== \"string\" && messageTemplate !== undefined) {\n messageTemplate = messageTemplate.toString();\n }\n\n if ((api_key !== null && log_id !== null) || (paramsLength === 2)) {\n\n // Priority for parameters\n if (params.hasOwnProperty('apiKey') && params.hasOwnProperty('logId')) {\n api_key = params['apiKey'];\n log_id = params['logId'];\n }\n\n // get new XHR object\n var xhr = new XMLHttpRequest();\n xhr.open(\"POST\", \"https://api.elmah.io/v3/messages/\" + log_id + \"?api_key=\" + api_key, true);\n xhr.setRequestHeader('Content-type', 'application/json');\n\n xhr.onload = function (e) {\n if (xhr.readyState === 4) {\n if (xhr.status === 201) {\n callback('success', xhr.statusText);\n }\n\n if(xhr.status >= 400 && xhr.status <= 499) {\n callback('error', xhr.statusText);\n\n // on error event\n publicAPIs.emit('error', xhr.status, xhr.statusText);\n }\n }\n };\n\n xhr.onerror = function (e) {\n callback('error', xhr.statusText);\n // on error event\n publicAPIs.emit('error', xhr.status, xhr.statusText);\n }\n\n var jsonData = {\n \"title\": message,\n \"titleTemplate\": messageTemplate,\n \"detail\": manipulateStack(new Error().stack.split('\\n'), type, message),\n \"severity\": type,\n \"type\": null,\n \"queryString\": JSON.parse(JSON.stringify(queryParams))\n };\n\n // Add payload to jsonData\n jsonData = merge_objects(jsonData, getPayload());\n\n // Add breadcrumbs to jsonData\n if(breadcrumbs.length > 0) {\n jsonData.breadcrumbs = breadcrumbs;\n breadcrumbs = [];\n }\n\n // filter callback\n if (settings.filter !== null) {\n if (settings.filter(jsonData)) {\n send = 0;\n }\n }\n\n if (send === 1) {\n if (jsonData.title) {\n // on message event\n publicAPIs.emit('message', jsonData);\n // send message\n xhr.send(JSON.stringify(jsonData));\n } else {\n callback('missing-title', xhr.statusText);\n }\n }\n\n } else {\n return console.log('Login api error');\n }\n };\n\n var sendPrefilledLogMessage = function(errorLog) {\n // without error object\n if(!errorLog) return getPayload();\n\n // with error object\n var error = errorLog;\n var stack = error ? ErrorStackParser.parse(error) : null;\n var jsonData = {\n \"title\": error.message,\n \"source\": stack && stack.length > 0 ? stack[0].fileName : null,\n \"detail\": error ? error.stack : null,\n \"severity\": \"Error\",\n \"type\": error ? error.name : null,\n \"errorObject\": error\n };\n\n jsonData = merge_objects(jsonData, getPayload());\n \n return jsonData;\n };\n\n // Some public methods\n\n publicAPIs.error = function (msg, error) {\n setTimeout(function() { sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Error', msg, error); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n };\n publicAPIs.verbose = function (msg, error) {\n setTimeout(function() { sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Verbose', msg, error); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n };\n publicAPIs.debug = function (msg, error) {\n setTimeout(function() { sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Debug', msg, error); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n };\n publicAPIs.information = function (msg, error) {\n setTimeout(function() { sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Information', msg, error); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n };\n publicAPIs.warning = function (msg, error) {\n setTimeout(function() { sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Warning', msg, error); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n };\n publicAPIs.fatal = function (msg, error) {\n setTimeout(function() { sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Fatal', msg, error); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n };\n publicAPIs.log = function (obj) {\n setTimeout(function() { sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Log', null, obj); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n };\n publicAPIs.message = function(error) {\n return sendPrefilledLogMessage(error);\n };\n publicAPIs.addBreadcrumb = function(msg, severity, evt) {\n recordBreadcrumb({\n \"severity\": (severity != undefined && isString(severity)) ? severity : \"Information\",\n \"action\": (evt != undefined && isString(evt)) ? evt : \"Log\",\n \"message\": (msg != undefined && isString(msg)) ? msg : \"This is just a test message.\"\n });\n };\n\n publicAPIs.on = function (name, callback, ctx) {\n var e = this.e || (this.e = {});\n\n (e[name] || (e[name] = [])).push({\n fn: callback,\n ctx: ctx\n });\n\n return this;\n };\n\n publicAPIs.emit = function (name) {\n var data = [].slice.call(arguments, 1);\n var evtArr = ((this.e || (this.e = {}))[name] || []).slice();\n var i = 0;\n var len = evtArr.length;\n\n for (i; i < len; i++) {\n evtArr[i].fn.apply(evtArr[i].ctx, data);\n }\n\n return this;\n };\n\n publicAPIs.init = function (options) {\n\n // -- Merge options into defaults\n settings = extend(defaults, options || {});\n\n // -- Breadcrumbs\n if (settings.breadcrumbs) {\n // Breadcrumbs - Click & Submit form\n if (document.addEventListener) {\n document.addEventListener('click', breadcrumbClickEventHandler, false);\n document.addEventListener('submit', breadcrumbFormSubmitEventHandler, false);\n } else if (document.attachEvent) {\n document.attachEvent('click', breadcrumbClickEventHandler, false);\n document.attachEvent('submit', breadcrumbFormSubmitEventHandler, false);\n }\n\n // Breadcrumbs - Navigation\n if (window.addEventListener) {\n window.addEventListener('load', breadcrumbWindowEventHandler, false);\n window.addEventListener('DOMContentLoaded', breadcrumbWindowEventHandler, false);\n window.addEventListener('pageshow', breadcrumbWindowEventHandler, false);\n window.addEventListener('pagehide', breadcrumbWindowEventHandler, false);\n window.addEventListener('hashchange', breadcrumbHashChangeEventHandler, false);\n } else if (window.attachEvent) {\n window.attachEvent('load', breadcrumbWindowEventHandler, false);\n window.attachEvent('DOMContentLoaded', breadcrumbWindowEventHandler, false);\n window.attachEvent('pageshow', breadcrumbWindowEventHandler, false);\n window.attachEvent('pagehide', breadcrumbWindowEventHandler, false);\n window.attachEvent('hashchange', breadcrumbHashChangeEventHandler, false);\n }\n\n if(window.history && window.history.pushState && window.history.replaceState) {\n var old_onpopstate = window.onpopstate;\n window.onpopstate = function(evt) {\n breadcrumbWindowEventHandler(evt);\n if (old_onpopstate) {\n return old_onpopstate.apply(this, arguments);\n }\n };\n }\n\n // Breadcrumbs - XHR\n if(window.XMLHttpRequest && window.XMLHttpRequest.prototype) {\n // Store a reference to the native method\n var open = XMLHttpRequest.prototype.open;\n \n // Overwrite the native method\n XMLHttpRequest.prototype.open = function(method, url) {\n // Assign an event listener\n this.addEventListener(\"loadend\", function(event) { breadcrumbXHRHandler(event, method, url); }, false);\n // Call the stored reference to the native method\n open.apply(this, arguments);\n };\n }\n }\n\n // -- Log on window error\n window.onerror = function (message, source, lineno, colno, error) {\n var errorLog = {\n 'message': message,\n 'source': source,\n 'lineno': lineno,\n 'colno': colno,\n 'error': error\n }\n \n setTimeout(function() { sendPayload(settings.apiKey, settings.logId, confirmResponse, errorLog); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n\n return false;\n }\n\n // -- Overriding console methods\n // -- Then log messages into the app.elmah.io\n if(options && options.captureConsoleMinimumLevel !== \"none\") {\n\n // If captureConsoleMinimumLevel: info or debug is set (error, warn)\n if(options.captureConsoleMinimumLevel === \"info\" || options.captureConsoleMinimumLevel === \"warn\" || options.captureConsoleMinimumLevel === \"error\" || options.captureConsoleMinimumLevel === \"debug\") {\n // Log console errors\n var _error = console.error;\n console.error = function(errMessage){\n var errorLog = {\n \t\t'message': errMessage,\n \t\t'arguments': arguments\n \t}\n setTimeout(function() { sendPayloadFromConsole(settings.apiKey, settings.logId, confirmResponse, 'Error', errorLog); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n _error.apply(console, arguments);\n };\n if(options.captureConsoleMinimumLevel !== \"error\") {\n // Log console warnings\n var _warning = console.warn;\n console.warn = function(warnMessage){\n var errorLog = {\n 'message': warnMessage,\n 'arguments': arguments\n }\n setTimeout(function() { sendPayloadFromConsole(settings.apiKey, settings.logId, confirmResponse, 'Warning', errorLog); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n _warning.apply(console, arguments);\n };\n }\n }\n if(options.captureConsoleMinimumLevel === \"info\" || options.captureConsoleMinimumLevel === \"debug\") {\n // Log console info\n var _info = console.info;\n console.info = function(infoMessage){\n var errorLog = {\n \t\t'message': infoMessage,\n \t\t'arguments': arguments\n \t}\n setTimeout(function() { sendPayloadFromConsole(settings.apiKey, settings.logId, confirmResponse, 'Information', errorLog); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n _info.apply(console, arguments);\n };\n }\n if(options.captureConsoleMinimumLevel === \"debug\") {\n // Log console debug\n var _debug = console.debug;\n console.debug = function(debugMessage){\n var errorLog = {\n \t\t'message': debugMessage,\n \t\t'arguments': arguments\n \t}\n setTimeout(function() { sendPayloadFromConsole(settings.apiKey, settings.logId, confirmResponse, 'Debug', errorLog); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n _debug.apply(console, arguments);\n };\n }\n }\n };\n\n // Initialize the plugin\n publicAPIs.init(options);\n\n if (settings.debug) {\n console.log('%c' + debugSettings.label, debugSettings.labelCSS);\n }\n\n // Return the public APIs\n return publicAPIs;\n\n };\n\n\n //\n // Return the constructor\n //\n\n if (paramsLength && params.hasOwnProperty('apiKey') && params.hasOwnProperty('logId')) {\n // Immediately-Invoked Function Expression (IIFE)\n return new Constructor;\n } else {\n // UMD Constructor\n return Constructor;\n }\n\n});"],"file":"elmahio.js"} \ No newline at end of file +{"version":3,"names":[],"mappings":"","sources":["elmahio.js"],"sourcesContent":["/*!\n * elmah.io Javascript Logger - version 4.0.0\n * (c) 2018 elmah.io, Apache 2.0 License, https://elmah.io\n */\n\n(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define([], function () {\n return factory(root);\n });\n } else if (typeof exports === 'object') {\n module.exports = factory(root);\n } else {\n root.Elmahio = factory(root);\n }\n})(typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : this, function (window) {\n\n 'use strict';\n\n //\n // ==== STACKFRAME ====\n //\n\n var StackFrame = (function () {\n \"use strict\";\n function _isNumber(n) {\n return !isNaN(parseFloat(n)) && isFinite(n);\n }\n function _capitalize(str) {\n return str.charAt(0).toUpperCase() + str.substring(1);\n }\n function _getter(p) {\n return function () {\n return this[p];\n };\n }\n var booleanProps = [\"isConstructor\", \"isEval\", \"isNative\", \"isToplevel\"];\n var numericProps = [\"columnNumber\", \"lineNumber\"];\n var stringProps = [\"fileName\", \"functionName\", \"source\"];\n var arrayProps = [\"args\"];\n var props = booleanProps.concat(numericProps, stringProps, arrayProps);\n function StackFrame(obj) {\n if (obj instanceof Object) {\n for (var i = 0; i < props.length; i++) {\n if (obj.hasOwnProperty(props[i]) && obj[props[i]] !== undefined) {\n this[\"set\" + _capitalize(props[i])](obj[props[i]]);\n }\n }\n }\n }\n StackFrame.prototype = {\n getArgs: function () {\n return this.args;\n },\n setArgs: function (v) {\n if (Object.prototype.toString.call(v) !== \"[object Array]\") {\n throw new TypeError(\"Args must be an Array\");\n }\n this.args = v;\n },\n getEvalOrigin: function () {\n return this.evalOrigin;\n },\n setEvalOrigin: function (v) {\n if (v instanceof StackFrame) {\n this.evalOrigin = v;\n } else if (v instanceof Object) {\n this.evalOrigin = new StackFrame(v);\n } else {\n throw new TypeError(\"Eval Origin must be an Object or StackFrame\");\n }\n },\n toString: function () {\n var functionName = this.getFunctionName() || \"{anonymous}\";\n var args = \"(\" + (this.getArgs() || []).join(\",\") + \")\";\n var fileName = this.getFileName() ? \"@\" + this.getFileName() : \"\";\n var lineNumber = _isNumber(this.getLineNumber()) ? \":\" + this.getLineNumber() : \"\";\n var columnNumber = _isNumber(this.getColumnNumber()) ? \":\" + this.getColumnNumber() : \"\";\n return functionName + args + fileName + lineNumber + columnNumber;\n }\n };\n StackFrame.fromString = function StackFrame$$fromString(str) {\n var argsStartIndex = str.indexOf(\"(\");\n var argsEndIndex = str.lastIndexOf(\")\");\n var functionName = str.substring(0, argsStartIndex);\n var args = str.substring(argsStartIndex + 1, argsEndIndex).split(\",\");\n var locationString = str.substring(argsEndIndex + 1);\n if (locationString.indexOf(\"@\") === 0) {\n var parts = /@(.+?)(?::(\\d+))?(?::(\\d+))?$/.exec(locationString, \"\");\n var fileName = parts[1];\n var lineNumber = parts[2];\n var columnNumber = parts[3];\n }\n return new StackFrame({\n functionName: functionName,\n args: args || undefined,\n fileName: fileName,\n lineNumber: lineNumber || undefined,\n columnNumber: columnNumber || undefined\n });\n };\n for (var i = 0; i < booleanProps.length; i++) {\n StackFrame.prototype[\"get\" + _capitalize(booleanProps[i])] = _getter(booleanProps[i]);\n StackFrame.prototype[\"set\" + _capitalize(booleanProps[i])] = function (p) {\n return function (v) {\n this[p] = Boolean(v);\n };\n }(booleanProps[i]);\n }\n for (var j = 0; j < numericProps.length; j++) {\n StackFrame.prototype[\"get\" + _capitalize(numericProps[j])] = _getter(numericProps[j]);\n StackFrame.prototype[\"set\" + _capitalize(numericProps[j])] = function (p) {\n return function (v) {\n if (!_isNumber(v)) {\n throw new TypeError(p + \" must be a Number\");\n }\n this[p] = Number(v);\n };\n }(numericProps[j]);\n }\n for (var k = 0; k < stringProps.length; k++) {\n StackFrame.prototype[\"get\" + _capitalize(stringProps[k])] = _getter(stringProps[k]);\n StackFrame.prototype[\"set\" + _capitalize(stringProps[k])] = function (p) {\n return function (v) {\n this[p] = String(v);\n };\n }(stringProps[k]);\n }\n return StackFrame;\n })();\n\n //\n // ==== ERROR STACK PARSER ====\n //\n\n var ErrorStackParser = (function () {\n 'use strict';\n var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\\S+:\\d+/;\n var CHROME_IE_STACK_REGEXP = /^\\s*at .*(\\S+:\\d+|\\(native\\))/m;\n var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\\[native code])?$/;\n\n return {\n /**\n * Given an Error object, extract the most information from it.\n *\n * @param {Error} error object\n * @return {Array} of StackFrames\n */\n parse: function ErrorStackParser$$parse(error) {\n if (typeof error.stacktrace !== 'undefined' || typeof error['opera#sourceloc'] !== 'undefined') {\n return this.parseOpera(error);\n } else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {\n return this.parseV8OrIE(error);\n } else if (error.stack) {\n return this.parseFFOrSafari(error);\n } else {\n throw new Error('Cannot parse given Error object');\n }\n },\n // Separate line and column numbers from a string of the form: (URI:Line:Column)\n extractLocation: function ErrorStackParser$$extractLocation(urlLike) {\n // Fail-fast but return locations like \"(native)\"\n if (urlLike.indexOf(':') === -1) {\n return [urlLike];\n }\n var regExp = /(.+?)(?::(\\d+))?(?::(\\d+))?$/;\n var parts = regExp.exec(urlLike.replace(/[()]/g, ''));\n return [parts[1], parts[2] || undefined, parts[3] || undefined];\n },\n parseV8OrIE: function ErrorStackParser$$parseV8OrIE(error) {\n var filtered = error.stack.split('\\n').filter(function(line) {\n return !!line.match(CHROME_IE_STACK_REGEXP);\n }, this);\n return filtered.map(function(line) {\n if (line.indexOf('(eval ') > -1) {\n // Throw away eval information until we implement stacktrace.js/stackframe#8\n line = line.replace(/eval code/g, 'eval').replace(/(\\(eval at [^()]*)|(,.*$)/g, '');\n }\n var sanitizedLine = line.replace(/^\\s+/, '').replace(/\\(eval code/g, '(').replace(/^.*?\\s+/, '');\n // capture and preseve the parenthesized location \"(/foo/my bar.js:12:87)\" in\n // case it has spaces in it, as the string is split on \\s+ later on\n var location = sanitizedLine.match(/ (\\(.+\\)$)/);\n // remove the parenthesized location from the line, if it was matched\n sanitizedLine = location ? sanitizedLine.replace(location[0], '') : sanitizedLine;\n // if a location was matched, pass it to extractLocation() otherwise pass all sanitizedLine\n // because this line doesn't have function name\n var locationParts = this.extractLocation(location ? location[1] : sanitizedLine);\n var functionName = location && sanitizedLine || undefined;\n var fileName = ['eval', ''].indexOf(locationParts[0]) > -1 ? undefined : locationParts[0];\n return new StackFrame({\n functionName: functionName,\n fileName: fileName,\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n source: line\n });\n }, this);\n },\n parseFFOrSafari: function ErrorStackParser$$parseFFOrSafari(error) {\n var filtered = error.stack.split('\\n').filter(function(line) {\n return !line.match(SAFARI_NATIVE_CODE_REGEXP);\n }, this);\n return filtered.map(function(line) {\n // Throw away eval information until we implement stacktrace.js/stackframe#8\n if (line.indexOf(' > eval') > -1) {\n line = line.replace(/ line (\\d+)(?: > eval line \\d+)* > eval:\\d+:\\d+/g, ':$1');\n }\n if (line.indexOf('@') === -1 && line.indexOf(':') === -1) {\n // Safari eval frames only have function names and nothing else\n return new StackFrame({\n functionName: line\n });\n } else {\n var functionNameRegex = /((.*\".+\"[^@]*)?[^@]*)(?:@)/;\n var matches = line.match(functionNameRegex);\n var functionName = matches && matches[1] ? matches[1] : undefined;\n var locationParts = this.extractLocation(line.replace(functionNameRegex, ''));\n return new StackFrame({\n functionName: functionName,\n fileName: locationParts[0],\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n source: line\n });\n }\n }, this);\n },\n parseOpera: function ErrorStackParser$$parseOpera(e) {\n if (!e.stacktrace || (e.message.indexOf('\\n') > -1 &&\n e.message.split('\\n').length > e.stacktrace.split('\\n').length)) {\n return this.parseOpera9(e);\n } else if (!e.stack) {\n return this.parseOpera10(e);\n } else {\n return this.parseOpera11(e);\n }\n },\n parseOpera9: function ErrorStackParser$$parseOpera9(e) {\n var lineRE = /Line (\\d+).*script (?:in )?(\\S+)/i;\n var lines = e.message.split('\\n');\n var result = [];\n for (var i = 2, len = lines.length; i < len; i += 2) {\n var match = lineRE.exec(lines[i]);\n if (match) {\n result.push(new StackFrame({\n fileName: match[2],\n lineNumber: match[1],\n source: lines[i]\n }));\n }\n }\n return result;\n },\n parseOpera10: function ErrorStackParser$$parseOpera10(e) {\n var lineRE = /Line (\\d+).*script (?:in )?(\\S+)(?:: In function (\\S+))?$/i;\n var lines = e.stacktrace.split('\\n');\n var result = [];\n for (var i = 0, len = lines.length; i < len; i += 2) {\n var match = lineRE.exec(lines[i]);\n if (match) {\n result.push(\n new StackFrame({\n functionName: match[3] || undefined,\n fileName: match[2],\n lineNumber: match[1],\n source: lines[i]\n })\n );\n }\n }\n return result;\n },\n // Opera 10.65+ Error.stack very similar to FF/Safari\n parseOpera11: function ErrorStackParser$$parseOpera11(error) {\n var filtered = error.stack.split('\\n').filter(function(line) {\n return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) && !line.match(/^Error created at/);\n }, this);\n return filtered.map(function(line) {\n var tokens = line.split('@');\n var locationParts = this.extractLocation(tokens.pop());\n var functionCall = (tokens.shift() || '');\n var functionName = functionCall\n .replace(//, '$2')\n .replace(/\\([^)]*\\)/g, '') || undefined;\n var argsRaw;\n if (functionCall.match(/\\(([^)]*)\\)/)) {\n argsRaw = functionCall.replace(/^[^(]+\\(([^)]*)\\)$/, '$1');\n }\n var args = (argsRaw === undefined || argsRaw === '[arguments not available]') ?\n undefined : argsRaw.split(',');\n\n return new StackFrame({\n functionName: functionName,\n args: args,\n fileName: locationParts[0],\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n source: line\n });\n }, this);\n }\n };\n })();\n\n //\n // ==== STACKTRACE-GPS ====\n //\n\n var SourceMap = function(e){var n={};function r(t){if(n[t])return n[t].exports;var o=n[t]={exports:{},id:t,loaded:!1};return e[t].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}return r.m=e,r.c=n,r.p=\"\",r(0)}([function(e,n,r){var t=r(1),o=r(2),i=r(3).ArraySet,a=r(4),s=r(6).quickSort;function u(e){var n=e;return\"string\"==typeof e&&(n=JSON.parse(e.replace(/^\\)\\]\\}'/,\"\"))),null!=n.sections?new c(n):new l(n)}function l(e){var n=e;\"string\"==typeof e&&(n=JSON.parse(e.replace(/^\\)\\]\\}'/,\"\")));var r=t.getArg(n,\"version\"),o=t.getArg(n,\"sources\"),a=t.getArg(n,\"names\",[]),s=t.getArg(n,\"sourceRoot\",null),u=t.getArg(n,\"sourcesContent\",null),l=t.getArg(n,\"mappings\"),g=t.getArg(n,\"file\",null);if(r!=this._version)throw new Error(\"Unsupported version: \"+r);o=o.map(String).map(t.normalize).map(function(e){return s&&t.isAbsolute(s)&&t.isAbsolute(e)?t.relative(s,e):e}),this._names=i.fromArray(a.map(String),!0),this._sources=i.fromArray(o,!0),this.sourceRoot=s,this.sourcesContent=u,this._mappings=l,this.file=g}function g(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}function c(e){var n=e;\"string\"==typeof e&&(n=JSON.parse(e.replace(/^\\)\\]\\}'/,\"\")));var r=t.getArg(n,\"version\"),o=t.getArg(n,\"sections\");if(r!=this._version)throw new Error(\"Unsupported version: \"+r);this._sources=new i,this._names=new i;var a={line:-1,column:0};this._sections=o.map(function(e){if(e.url)throw new Error(\"Support for url field in sections not implemented.\");var n=t.getArg(e,\"offset\"),r=t.getArg(n,\"line\"),o=t.getArg(n,\"column\");if(r=0){var s=this._originalMappings[a];if(void 0===e.column)for(var u=s.originalLine;s&&s.originalLine===u;)i.push({line:t.getArg(s,\"generatedLine\",null),column:t.getArg(s,\"generatedColumn\",null),lastColumn:t.getArg(s,\"lastGeneratedColumn\",null)}),s=this._originalMappings[++a];else for(var l=s.originalColumn;s&&s.originalLine===n&&s.originalColumn==l;)i.push({line:t.getArg(s,\"generatedLine\",null),column:t.getArg(s,\"generatedColumn\",null),lastColumn:t.getArg(s,\"lastGeneratedColumn\",null)}),s=this._originalMappings[++a]}return i},n.SourceMapConsumer=u,l.prototype=Object.create(u.prototype),l.prototype.consumer=u,l.fromSourceMap=function(e){var n=Object.create(l.prototype),r=n._names=i.fromArray(e._names.toArray(),!0),o=n._sources=i.fromArray(e._sources.toArray(),!0);n.sourceRoot=e._sourceRoot,n.sourcesContent=e._generateSourcesContent(n._sources.toArray(),n.sourceRoot),n.file=e._file;for(var a=e._mappings.toArray().slice(),u=n.__generatedMappings=[],c=n.__originalMappings=[],p=0,h=a.length;p1&&(r.source=d+i[1],d+=i[1],r.originalLine=h+i[2],h=r.originalLine,r.originalLine+=1,r.originalColumn=f+i[3],f=r.originalColumn,i.length>4&&(r.name=m+i[4],m+=i[4])),L.push(r),\"number\"==typeof r.originalLine&&y.push(r)}s(L,t.compareByGeneratedPositionsDeflated),this.__generatedMappings=L,s(y,t.compareByOriginalPositions),this.__originalMappings=y},l.prototype._findMapping=function(e,n,r,t,i,a){if(e[r]<=0)throw new TypeError(\"Line must be greater than or equal to 1, got \"+e[r]);if(e[t]<0)throw new TypeError(\"Column must be greater than or equal to 0, got \"+e[t]);return o.search(e,n,i,a)},l.prototype.computeColumnSpans=function(){for(var e=0;e=0){var o=this._generatedMappings[r];if(o.generatedLine===n.generatedLine){var i=t.getArg(o,\"source\",null);null!==i&&(i=this._sources.at(i),null!=this.sourceRoot&&(i=t.join(this.sourceRoot,i)));var a=t.getArg(o,\"name\",null);return null!==a&&(a=this._names.at(a)),{source:i,line:t.getArg(o,\"originalLine\",null),column:t.getArg(o,\"originalColumn\",null),name:a}}}return{source:null,line:null,column:null,name:null}},l.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&(this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return null==e}))},l.prototype.sourceContentFor=function(e,n){if(!this.sourcesContent)return null;if(null!=this.sourceRoot&&(e=t.relative(this.sourceRoot,e)),this._sources.has(e))return this.sourcesContent[this._sources.indexOf(e)];var r;if(null!=this.sourceRoot&&(r=t.urlParse(this.sourceRoot))){var o=e.replace(/^file:\\/\\//,\"\");if(\"file\"==r.scheme&&this._sources.has(o))return this.sourcesContent[this._sources.indexOf(o)];if((!r.path||\"/\"==r.path)&&this._sources.has(\"/\"+e))return this.sourcesContent[this._sources.indexOf(\"/\"+e)]}if(n)return null;throw new Error('\"'+e+'\" is not in the SourceMap.')},l.prototype.generatedPositionFor=function(e){var n=t.getArg(e,\"source\");if(null!=this.sourceRoot&&(n=t.relative(this.sourceRoot,n)),!this._sources.has(n))return{line:null,column:null,lastColumn:null};var r={source:n=this._sources.indexOf(n),originalLine:t.getArg(e,\"line\"),originalColumn:t.getArg(e,\"column\")},o=this._findMapping(r,this._originalMappings,\"originalLine\",\"originalColumn\",t.compareByOriginalPositions,t.getArg(e,\"bias\",u.GREATEST_LOWER_BOUND));if(o>=0){var i=this._originalMappings[o];if(i.source===r.source)return{line:t.getArg(i,\"generatedLine\",null),column:t.getArg(i,\"generatedColumn\",null),lastColumn:t.getArg(i,\"lastGeneratedColumn\",null)}}return{line:null,column:null,lastColumn:null}},n.BasicSourceMapConsumer=l,c.prototype=Object.create(u.prototype),c.prototype.constructor=u,c.prototype._version=3,Object.defineProperty(c.prototype,\"sources\",{get:function(){for(var e=[],n=0;n=0;g--)\".\"===(a=u[g])?u.splice(g,1):\"..\"===a?l++:l>0&&(\"\"===a?(u.splice(g+1,l),l=0):(u.splice(g,2),l--));return\"\"===(r=u.join(\"/\"))&&(r=s?\"/\":\".\"),t?(t.path=r,i(t)):r}n.urlParse=o,n.urlGenerate=i,n.normalize=a,n.join=function(e,n){\"\"===e&&(e=\".\"),\"\"===n&&(n=\".\");var r=o(n),s=o(e);if(s&&(e=s.path||\"/\"),r&&!r.scheme)return s&&(r.scheme=s.scheme),i(r);if(r||n.match(t))return n;if(s&&!s.host&&!s.path)return s.host=n,i(s);var u=\"/\"===n.charAt(0)?n:a(e.replace(/\\/+$/,\"\")+\"/\"+n);return s?(s.path=u,i(s)):u},n.isAbsolute=function(e){return\"/\"===e.charAt(0)||!!e.match(r)},n.relative=function(e,n){\"\"===e&&(e=\".\"),e=e.replace(/\\/$/,\"\");for(var r=0;0!==n.indexOf(e+\"/\");){var t=e.lastIndexOf(\"/\");if(t<0)return n;if((e=e.slice(0,t)).match(/^([^\\/]+:\\/)?\\/*$/))return n;++r}return Array(r+1).join(\"../\")+n.substr(e.length+1)};var s=!(\"__proto__\"in Object.create(null));function u(e){return e}function l(e){if(!e)return!1;var n=e.length;if(n<9)return!1;if(95!==e.charCodeAt(n-1)||95!==e.charCodeAt(n-2)||111!==e.charCodeAt(n-3)||116!==e.charCodeAt(n-4)||111!==e.charCodeAt(n-5)||114!==e.charCodeAt(n-6)||112!==e.charCodeAt(n-7)||95!==e.charCodeAt(n-8)||95!==e.charCodeAt(n-9))return!1;for(var r=n-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function g(e,n){return e===n?0:e>n?1:-1}n.toSetString=s?u:function(e){return l(e)?\"$\"+e:e},n.fromSetString=s?u:function(e){return l(e)?e.slice(1):e},n.compareByOriginalPositions=function(e,n,r){var t=e.source-n.source;return 0!==t?t:0!=(t=e.originalLine-n.originalLine)?t:0!=(t=e.originalColumn-n.originalColumn)||r?t:0!=(t=e.generatedColumn-n.generatedColumn)?t:0!=(t=e.generatedLine-n.generatedLine)?t:e.name-n.name},n.compareByGeneratedPositionsDeflated=function(e,n,r){var t=e.generatedLine-n.generatedLine;return 0!==t?t:0!=(t=e.generatedColumn-n.generatedColumn)||r?t:0!=(t=e.source-n.source)?t:0!=(t=e.originalLine-n.originalLine)?t:0!=(t=e.originalColumn-n.originalColumn)?t:e.name-n.name},n.compareByGeneratedPositionsInflated=function(e,n){var r=e.generatedLine-n.generatedLine;return 0!==r?r:0!=(r=e.generatedColumn-n.generatedColumn)?r:0!==(r=g(e.source,n.source))?r:0!=(r=e.originalLine-n.originalLine)?r:0!=(r=e.originalColumn-n.originalColumn)?r:g(e.name,n.name)}},function(e,n){n.GREATEST_LOWER_BOUND=1,n.LEAST_UPPER_BOUND=2,n.search=function(e,r,t,o){if(0===r.length)return-1;var i=function e(r,t,o,i,a,s){var u=Math.floor((t-r)/2)+r,l=a(o,i[u],!0);return 0===l?u:l>0?t-u>1?e(u,t,o,i,a,s):s==n.LEAST_UPPER_BOUND?t1?e(r,u,o,i,a,s):s==n.LEAST_UPPER_BOUND?u:r<0?-1:r}(-1,r.length,e,r,t,o||n.GREATEST_LOWER_BOUND);if(i<0)return-1;for(;i-1>=0&&0===t(r[i],r[i-1],!0);)--i;return i}},function(e,n,r){var t=r(1),o=Object.prototype.hasOwnProperty;function i(){this._array=[],this._set=Object.create(null)}i.fromArray=function(e,n){for(var r=new i,t=0,o=e.length;t=0&&e>>=5)>0&&(n|=32),o+=t.encode(n)}while(i>0);return o},n.decode=function(e,n,r){var o,i,a,s,u=e.length,l=0,g=0;do{if(n>=u)throw new Error(\"Expected more digits in base 64 VLQ value.\");if(-1===(i=t.decode(e.charCodeAt(n++))))throw new Error(\"Invalid base64 digit: \"+e.charAt(n-1));o=!!(32&i),l+=(i&=31)<>1,1==(1&a)?-s:s),r.rest=n}},function(e,n){var r=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\".split(\"\");n.encode=function(e){if(0<=e&&e= 200 && req.status < 300 || url.substr(0, 7) === \"file://\" && req.responseText) {\n resolve(req.responseText);\n } else {\n reject(new Error(\"HTTP status: \" + req.status + \" retrieving \" + url));\n }\n }\n };\n req.send();\n });\n }\n /**\n * Convert a Base64-encoded string into its original representation.\n * Used for inline sourcemaps.\n *\n * @param {String} b64str Base-64 encoded string\n * @returns {String} original representation of the base64-encoded string.\n */\n function _atob(b64str) {\n if (typeof window !== \"undefined\" && window.atob) {\n return window.atob(b64str);\n } else {\n throw new Error(\"You must supply a polyfill for window.atob in this environment\");\n }\n }\n function _parseJson(string) {\n if (typeof JSON !== \"undefined\" && JSON.parse) {\n return JSON.parse(string);\n } else {\n throw new Error(\"You must supply a polyfill for JSON.parse in this environment\");\n }\n }\n function _findFunctionName(source, lineNumber) {\n var syntaxes = [ // {name} = function ({args}) TODO args capture\n /['\"]?([$_A-Za-z][$_A-Za-z0-9]*)['\"]?\\s*[:=]\\s*function\\b/, // function {name}({args}) m[1]=name m[2]=args\n /function\\s+([^('\"`]*?)\\s*\\(([^)]*)\\)/, // {name} = eval()\n /['\"]?([$_A-Za-z][$_A-Za-z0-9]*)['\"]?\\s*[:=]\\s*(?:eval|new Function)\\b/, // fn_name() {\n /\\b(?!(?:if|for|switch|while|with|catch)\\b)(?:(?:static)\\s+)?(\\S+)\\s*\\(.*?\\)\\s*\\{/, // {name} = () => {\n /['\"]?([$_A-Za-z][$_A-Za-z0-9]*)['\"]?\\s*[:=]\\s*\\(.*?\\)\\s*=>/];\n var lines = source.split(\"\\n\");\n // Walk backwards in the source lines until we find the line which matches one of the patterns above\n var code = \"\";\n var maxLines = Math.min(lineNumber, 20);\n for (var i = 0; i < maxLines; ++i) {\n // lineNo is 1-based, source[] is 0-based\n var line = lines[lineNumber - i - 1];\n var commentPos = line.indexOf(\"//\");\n if (commentPos >= 0) {\n line = line.substr(0, commentPos);\n }\n if (line) {\n code = line + code;\n var len = syntaxes.length;\n for (var index = 0; index < len; index++) {\n var m = syntaxes[index].exec(code);\n if (m && m[1]) {\n return m[1];\n }\n }\n }\n }\n return undefined;\n }\n function _ensureSupportedEnvironment() {\n if (typeof Object.defineProperty !== \"function\" || typeof Object.create !== \"function\") {\n throw new Error(\"Unable to consume source maps in older browsers\");\n }\n }\n function _ensureStackFrameIsLegit(stackframe) {\n if (typeof stackframe !== \"object\") {\n throw new TypeError(\"Given StackFrame is not an object\");\n } else if (typeof stackframe.fileName !== \"string\") {\n throw new TypeError(\"Given file name is not a String\");\n } else if (typeof stackframe.lineNumber !== \"number\" || stackframe.lineNumber % 1 !== 0 || stackframe.lineNumber < 1) {\n throw new TypeError(\"Given line number must be a positive integer\");\n } else if (typeof stackframe.columnNumber !== \"number\" || stackframe.columnNumber % 1 !== 0 || stackframe.columnNumber < 0) {\n throw new TypeError(\"Given column number must be a non-negative integer\");\n }\n return true;\n }\n function _findSourceMappingURL(source) {\n var sourceMappingUrlRegExp = /\\/\\/[#@] ?sourceMappingURL=([^\\s'\"]+)\\s*$/gm;\n var lastSourceMappingUrl;\n var matchSourceMappingUrl;\n while (matchSourceMappingUrl = sourceMappingUrlRegExp.exec(source)) {\n // jshint ignore:line\n lastSourceMappingUrl = matchSourceMappingUrl[1];\n }\n if (lastSourceMappingUrl) {\n return lastSourceMappingUrl;\n } else {\n throw new Error(\"sourceMappingURL not found\");\n }\n }\n function _extractLocationInfoFromSourceMapSource(stackframe, sourceMapConsumer, sourceCache) {\n return new Promise(function (resolve, reject) {\n var loc = sourceMapConsumer.originalPositionFor({\n line: stackframe.lineNumber,\n column: stackframe.columnNumber\n });\n if (loc.source) {\n // cache mapped sources\n var mappedSource = sourceMapConsumer.sourceContentFor(loc.source);\n if (mappedSource) {\n sourceCache[loc.source] = mappedSource;\n }\n resolve(// given stackframe and source location, update stackframe\n new StackFrame({\n functionName: loc.name || stackframe.functionName,\n args: stackframe.args,\n fileName: loc.source,\n lineNumber: loc.line,\n columnNumber: loc.column\n }));\n } else {\n reject(new Error(\"Could not get original source for given stackframe and source map\"));\n }\n });\n }\n /**\n * @constructor\n * @param {Object} opts\n * opts.sourceCache = {url: \"Source String\"} => preload source cache\n * opts.sourceMapConsumerCache = {/path/file.js.map: SourceMapConsumer}\n * opts.offline = True to prevent network requests.\n * Best effort without sources or source maps.\n * opts.ajax = Promise returning function to make X-Domain requests\n */\n return function StackTraceGPS(opts) {\n if (!(this instanceof StackTraceGPS)) {\n return new StackTraceGPS(opts);\n }\n opts = opts || {};\n this.sourceCache = opts.sourceCache || {};\n this.sourceMapConsumerCache = opts.sourceMapConsumerCache || {};\n this.ajax = opts.ajax || _xdr;\n this._atob = opts.atob || _atob;\n\n this._get = function _get(location) {\n return new Promise(function (resolve, reject) {\n var isDataUrl = location.substr(0, 5) === \"data:\";\n if (this.sourceCache[location]) {\n resolve(this.sourceCache[location]);\n } else if (opts.offline && !isDataUrl) {\n reject(new Error(\"Cannot make network requests in offline mode\"));\n } else {\n if (isDataUrl) {\n // data URLs can have parameters.\n // see http://tools.ietf.org/html/rfc2397\n var supportedEncodingRegexp = /^data:application\\/json;([\\w=:\"-]+;)*base64,/;\n var match = location.match(supportedEncodingRegexp);\n if (match) {\n var sourceMapStart = match[0].length;\n var encodedSource = location.substr(sourceMapStart);\n var source = this._atob(encodedSource);\n this.sourceCache[location] = source;\n resolve(source);\n } else {\n reject(new Error(\"The encoding of the inline sourcemap is not supported\"));\n }\n } else {\n var xhrPromise = this.ajax(location, {\n method: \"get\"\n });\n // Cache the Promise to prevent duplicate in-flight requests\n this.sourceCache[location] = xhrPromise;\n xhrPromise.then(resolve, reject);\n }\n }\n }.bind(this));\n };\n /**\n * Creating SourceMapConsumers is expensive, so this wraps the creation of a\n * SourceMapConsumer in a per-instance cache.\n *\n * @param {String} sourceMappingURL = URL to fetch source map from\n * @param {String} defaultSourceRoot = Default source root for source map if undefined\n * @returns {Promise} that resolves a SourceMapConsumer\n */\n this._getSourceMapConsumer = function _getSourceMapConsumer(sourceMappingURL, defaultSourceRoot) {\n return new Promise(function (resolve, reject) {\n if (this.sourceMapConsumerCache[sourceMappingURL]) {\n resolve(this.sourceMapConsumerCache[sourceMappingURL]);\n } else {\n var sourceMapConsumerPromise = new Promise(function (resolve, reject) {\n return this._get(sourceMappingURL).then(function (sourceMapSource) {\n if (typeof sourceMapSource === \"string\") {\n sourceMapSource = _parseJson(sourceMapSource.replace(/^\\)\\]\\}'/, \"\"));\n }\n if (typeof sourceMapSource.sourceRoot === \"undefined\") {\n sourceMapSource.sourceRoot = defaultSourceRoot;\n }\n resolve(new SourceMap.SourceMapConsumer(sourceMapSource));\n }, reject);\n }.bind(this));\n this.sourceMapConsumerCache[sourceMappingURL] = sourceMapConsumerPromise;\n resolve(sourceMapConsumerPromise);\n }\n }.bind(this));\n };\n /**\n * Given a StackFrame, enhance function name and use source maps for a\n * better StackFrame.\n *\n * @param {StackFrame} stackframe object\n * @returns {Promise} that resolves with with source-mapped StackFrame\n */\n this.pinpoint = function StackTraceGPS$$pinpoint(stackframe) {\n return new Promise(function (resolve, reject) {\n this.getMappedLocation(stackframe).then(function (mappedStackFrame) {\n function resolveMappedStackFrame() {\n resolve(mappedStackFrame);\n }\n this.findFunctionName(mappedStackFrame).then(resolve, resolveMappedStackFrame)[\"catch\"](resolveMappedStackFrame);\n }.bind(this), reject);\n }.bind(this));\n };\n /**\n * Given a StackFrame, guess function name from location information.\n *\n * @param {StackFrame} stackframe\n * @returns {Promise} that resolves with enhanced StackFrame.\n */\n this.findFunctionName = function StackTraceGPS$$findFunctionName(stackframe) {\n return new Promise(function (resolve, reject) {\n _ensureStackFrameIsLegit(stackframe);\n this._get(stackframe.fileName).then(function getSourceCallback(source) {\n var lineNumber = stackframe.lineNumber;\n var columnNumber = stackframe.columnNumber;\n var guessedFunctionName = _findFunctionName(source, lineNumber, columnNumber);\n // Only replace functionName if we found something\n if (guessedFunctionName) {\n resolve(new StackFrame({\n functionName: guessedFunctionName,\n args: stackframe.args,\n fileName: stackframe.fileName,\n lineNumber: lineNumber,\n columnNumber: columnNumber\n }));\n } else {\n resolve(stackframe);\n }\n }, reject)[\"catch\"](reject);\n }.bind(this));\n };\n /**\n * Given a StackFrame, seek source-mapped location and return new enhanced StackFrame.\n *\n * @param {StackFrame} stackframe\n * @returns {Promise} that resolves with enhanced StackFrame.\n */\n this.getMappedLocation = function StackTraceGPS$$getMappedLocation(stackframe) {\n return new Promise(function (resolve, reject) {\n _ensureSupportedEnvironment();\n _ensureStackFrameIsLegit(stackframe);\n var sourceCache = this.sourceCache;\n var fileName = stackframe.fileName;\n this._get(fileName).then(function (source) {\n var sourceMappingURL = _findSourceMappingURL(source);\n var isDataUrl = sourceMappingURL.substr(0, 5) === \"data:\";\n var defaultSourceRoot = fileName.substring(0, fileName.lastIndexOf(\"/\") + 1);\n if (sourceMappingURL[0] !== \"/\" && !isDataUrl && !/^https?:\\/\\/|^\\/\\//i.test(sourceMappingURL)) {\n sourceMappingURL = defaultSourceRoot + sourceMappingURL;\n }\n return this._getSourceMapConsumer(sourceMappingURL, defaultSourceRoot).then(function (sourceMapConsumer) {\n return _extractLocationInfoFromSourceMapSource(stackframe, sourceMapConsumer, sourceCache).then(resolve)[\"catch\"](function () {\n resolve(stackframe);\n });\n });\n }.bind(this), reject)[\"catch\"](reject);\n }.bind(this));\n };\n };\n })(SourceMap, StackFrame);\n\n //\n // Shared Variables\n //\n\n var myScript = null;\n var scriptFile = document.getElementsByTagName('script');\n \n for (var i = 0; i < scriptFile.length; ++i) {\n if(isMe(scriptFile[i])) {\n myScript = scriptFile[i];\n }\n }\n\n var queryString = myScript != null ? myScript.src.replace(/^[^\\?]+\\??/, '') : null;\n var params = parseQuery(queryString);\n var paramsLength = objectLength(params);\n\n var debugSettings = {\n label: ' elmah.io debugger : On ',\n labelCSS: 'background: #06a89c; color: #ffffff; display: inline-block; font-size: 14px;',\n successCSS: 'background: #d4edda; color: #155724; display: inline-block; font-size: 13px;',\n errorCSS: 'background: #f8d7da; color: #721c24; display: inline-block; font-size: 13px;',\n warningCSS: 'background: #fff3cd; color: #856404; display: inline-block; font-size: 13px;',\n lightCSS: 'background: #e2e3e5; color: #383d41; display: inline-block; font-size: 13px;'\n };\n\n var defaults = {\n apiKey: null,\n logId: null,\n debug: false,\n application: null,\n filter: null,\n captureConsoleMinimumLevel: 'none',\n breadcrumbs: false,\n breadcrumbsNumber: 10\n };\n\n var breadcrumbsDelay = 100;\n\n //\n // Shared Methods\n //\n\n var extend = function () {\n\n // Variables\n var extended = {};\n var deep = false;\n var i = 0;\n\n // Check if a deep merge\n if (Object.prototype.toString.call(arguments[0]) === '[object Boolean]') {\n deep = arguments[0];\n i++;\n }\n\n // Merge the object into the extended object\n var merge = function (obj) {\n for (var prop in obj) {\n if (obj.hasOwnProperty(prop)) {\n // If property is an object, merge properties\n if (deep && Object.prototype.toString.call(obj[prop]) === '[object Object]') {\n extended[prop] = extend(extended[prop], obj[prop]);\n } else {\n extended[prop] = obj[prop];\n }\n }\n }\n };\n\n // Loop through each object and conduct a merge\n for (; i < arguments.length; i++) {\n var obj = arguments[i];\n merge(obj);\n }\n\n return extended;\n\n };\n\n //\n // Helpers\n //\n\n function isMe(scriptElem){\n if(scriptElem.getAttribute('src') != null) {\n return scriptElem.getAttribute('src').indexOf('elmahio') != -1 && scriptElem.getAttribute('src').indexOf('apiKey') != -1 && scriptElem.getAttribute('src').indexOf('logId') != -1;\n }\n }\n\n function isInt(n){\n return Number(n) === n && n % 1 === 0;\n }\n\n function isFloat(n){\n return Number(n) === n && n % 1 !== 0;\n }\n\n function parseQuery(query) {\n var Params = new Object();\n if (!query) return Params; // return empty object\n var Pairs = query.split(/[;&]/);\n for (var i = 0; i < Pairs.length; i++) {\n var KeyVal = Pairs[i].split('=');\n if (!KeyVal || KeyVal.length !== 2) continue;\n var key = unescape(KeyVal[0]);\n var val = unescape(KeyVal[1]);\n val = val.replace(/\\+/g, ' ');\n Params[key] = val;\n }\n return Params;\n }\n\n function objectLength(obj) {\n var size = 0, key;\n for (key in obj) {\n if (obj.hasOwnProperty(key)) size++;\n }\n return size;\n };\n\n function getSearchParameters() {\n var prmstr = window.location.search.substr(1);\n return prmstr !== null && prmstr !== \"\" ? transformToAssocArray(prmstr) : {};\n }\n\n function transformToAssocArray(prmstr) {\n var params = [];\n var prmarr = prmstr.split(\"&\");\n for (var i = 0; i < prmarr.length; i++) {\n var tmparr = prmarr[i].split(\"=\");\n params.push({\n 'key': tmparr[0],\n 'value': tmparr[1]\n });\n }\n return params;\n }\n\n function merge_objects(obj1, obj2) {\n var obj3 = {};\n for (var attrname1 in obj1) {\n obj3[attrname1] = obj1[attrname1];\n }\n for (var attrname2 in obj2) {\n obj3[attrname2] = obj2[attrname2];\n }\n\n return obj3;\n }\n\n function isString(what) {\n return Object.prototype.toString.call(what) === '[object String]';\n }\n\n function cssSelectorString(elem) {\n var MAX_TRAVERSE_HEIGHT = 5,\n MAX_OUTPUT_LEN = 80,\n out = [],\n height = 0,\n len = 0,\n separator = ' > ',\n sepLength = separator.length,\n nextStr;\n while (elem && height++ < MAX_TRAVERSE_HEIGHT) {\n nextStr = htmlElementAsString(elem);\n if (nextStr === 'html' || (height > 1 && len + out.length * sepLength + nextStr.length >= MAX_OUTPUT_LEN)) {\n break;\n }\n out.push(nextStr);\n len += nextStr.length;\n elem = elem.parentNode;\n }\n return out.reverse().join(separator);\n }\n \n function htmlElementAsString(elem) {\n var out = [], className, classes, key, attr, i;\n if (!elem || !elem.tagName) {\n return '';\n }\n out.push(elem.tagName.toLowerCase());\n if (elem.id) {\n out.push('#' + elem.id);\n }\n className = elem.className;\n if (className && isString(className)) {\n classes = className.split(/\\s+/);\n for (i = 0; i < classes.length; i++) {\n out.push('.' + classes[i]);\n }\n }\n var attrWhitelist = ['type', 'name', 'title', 'alt'];\n for (i = 0; i < attrWhitelist.length; i++) {\n key = attrWhitelist[i];\n attr = elem.getAttribute(key);\n if (attr) {\n out.push('[' + key + '=\"' + attr + '\"]');\n }\n }\n return out.join('');\n }\n\n var parseHash = function(url) {\n return url.split('#')[1] || '';\n };\n\n //\n // Constructor\n //\n\n var Constructor = function (options) {\n\n //\n // Variables\n //\n\n var publicAPIs = {};\n var settings;\n var breadcrumbs = [];\n var lastHref = window.location && window.location.href;\n\n function getPayload() {\n var payload = {\n \"url\": document.location.pathname || '/',\n \"application\": settings.application\n };\n\n var payload_data = [];\n\n if (document.documentMode) payload_data.push({ \"key\": \"Document-Mode\", \"value\": document.documentMode });\n if (window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth) payload_data.push({ \"key\": \"Browser-Width\", \"value\": window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth });\n if (window.innerHeight || document.documentElement.clientHeight || document.getElementsByTagName('body')[0].clientHeight) payload_data.push({ \"key\": \"Browser-Height\", \"value\": window.innerHeight || document.documentElement.clientHeight || document.getElementsByTagName('body')[0].clientHeight });\n if ((screen.msOrientation || (screen.orientation || screen.mozOrientation || {}).type) !== undefined) payload_data.push({ \"key\": \"Screen-Orientation\", \"value\": ((screen.msOrientation || (screen.orientation || screen.mozOrientation || {}).type).split(\"-\"))[0] });\n if (screen.width) payload_data.push({ \"key\": \"Screen-Width\", \"value\": screen.width });\n if (screen.height) payload_data.push({ \"key\": \"Screen-Height\", \"value\": screen.height });\n if (screen.colorDepth) payload_data.push({ \"key\": \"Color-Depth\", \"value\": screen.colorDepth });\n payload_data.push({ \"key\": \"X-ELMAHIO-SEARCH-isClientside\", \"value\": \"true\" });\n\n payload.data = payload_data;\n\n var payload_serverVariables = [];\n if (navigator.language) payload_serverVariables.push({ \"key\": \"User-Language\", \"value\": navigator.language });\n if (navigator.userAgent) payload_serverVariables.push({ \"key\": \"User-Agent\", \"value\": navigator.userAgent });\n if (document.referrer) payload_serverVariables.push({ \"key\": \"Referer\", \"value\": document.referrer });\n if (document.location.protocol === \"https:\") payload_serverVariables.push({ \"key\": \"HTTPS\", \"value\": 'on' });\n if (document.location.hostname) payload_serverVariables.push({ \"key\": \"Host\", \"value\": document.location.hostname });\n\n payload.serverVariables = payload_serverVariables;\n\n return payload;\n }\n\n function confirmResponse(status, response) {\n if (settings.debug) {\n if (status === 'error') {\n console.log('%c \\u2BC8 Error log: ' + '%c \\u2715 Not created ', debugSettings.lightCSS, debugSettings.errorCSS);\n } else if (status === 'success') {\n console.log('%c \\u2BC8 Error log: ' + '%c \\u2714 ' + response + ' at ' + new Date().toLocaleString() + ' ', debugSettings.lightCSS, debugSettings.successCSS);\n } else {\n console.log('%c \\u2BC8 Error log: ' + '%c \\u2715 Not created. Title should not be undefined, null or empty ! ', debugSettings.lightCSS, debugSettings.errorCSS);\n }\n }\n }\n\n function generateErrorObject(error) {\n return {\n error: error,\n type: error.name,\n message: error.message,\n inner: error.cause && typeof error.cause === \"object\" && error.cause instanceof Error ? generateErrorObject(error.cause) : []\n }\n }\n\n function getErrorTypeSource(error) {\n var object = generateErrorObject(error);\n var type = null;\n var source = null;\n\n function iterateObj(obj) {\n Object.keys(obj).forEach(function(key){\n if (key === \"error\") {\n if (objectLength(obj[key].stack) !== 0) {\n var stack = obj[key] ? ErrorStackParser.parse(obj[key]) : null;\n source = stack && stack.length > 0 ? stack[0].fileName : null;\n }\n }\n if (key === \"type\") {\n type = obj[key];\n }\n if (key === \"inner\" && obj[key].length !== 0) {\n iterateObj(obj[key]);\n }\n });\n }\n\n iterateObj(object);\n\n return { type: type, source: source };\n }\n\n function GenerateNewFrames(errorMessage, newFrames, cause, fileName) {\n var lastInnerFileName = null;\n\n newFrames.forEach(function(stackFrame, i) {\n if (stackFrame.functionName) {\n var fn = stackFrame.functionName + ' ';\n } else {\n var fn = '';\n }\n var stackString = ' at ' + fn + '(' + stackFrame.fileName + ':' + stackFrame.lineNumber + ':' + stackFrame.columnNumber + ')';\n newFrames[i] = stackString;\n if (i === 0) {\n lastInnerFileName = stackFrame.fileName || null;\n }\n });\n \n if (!cause) {\n newFrames.unshift(errorMessage);\n } else {\n newFrames.unshift(\"\\nCaused by: \" + errorMessage);\n }\n\n if (fileName) {\n return {\n newFrames: newFrames,\n fileName: lastInnerFileName\n }\n }\n \n return newFrames;\n }\n\n function GPSPromise(stackframes) {\n var gps = new StackTraceGPS();\n\n return new Promise(function(resolve) {\n resolve(Promise.all(stackframes.map(function(sf) {\n return new Promise(function(resolve) {\n function resolveOriginal() {\n resolve(sf);\n }\n gps.pinpoint(sf).then(resolve, resolveOriginal)['catch'](resolveOriginal);\n });\n })));\n });\n }\n\n function stackGPS(error, xhr, jsonData) {\n var object = generateErrorObject(error);\n var messagesArr = [];\n var promiseArr = [];\n\n function iterateObj(obj) {\n Object.keys(obj).forEach(function(key){\n if (key === \"error\") {\n if (objectLength(obj[key].stack) !== 0) {\n messagesArr.push(obj[key].toString().split(\"\\n\")[0]);\n promiseArr.push(GPSPromise(ErrorStackParser.parse(obj[key])));\n }\n }\n if (key === \"inner\" && obj[key].length !== 0) {\n iterateObj(obj[key]);\n }\n });\n }\n\n iterateObj(object);\n\n Promise.all(promiseArr).then((values) => {\n values.forEach(function(stackframe, index) {\n if (index === 0) {\n jsonData.detail = GenerateNewFrames(messagesArr[index], stackframe, false).join(\"\\n\");\n } else {\n jsonData.detail += GenerateNewFrames(messagesArr[index], stackframe, true).join(\"\\n\");\n }\n });\n }).then(function() {\n xhr.send(JSON.stringify(jsonData));\n });\n }\n\n function stackString(error) {\n \tvar typeOF = typeof error.error;\n \tvar typeOFCapitalized = typeOF.charAt(0).toUpperCase() + typeOF.slice(1);\n\n \treturn typeOFCapitalized + ': ' + error.error + '\\n' + ' at ' + '(' + error.source + ':' + error.lineno + ':' + error.colno + ')';\n }\n\n function manipulateStack (errorStack, severity, message) {\n var stack = [];\n for (var i = 0; i < errorStack.length; i++) {\n if(errorStack[i] === \"Error\") {\n stack.push(severity + \": \" + message);\n }\n if(!errorStack[i].match(/elmahio.js|elmahio.min.js/g) && errorStack[i] !== \"Error\") {\n stack.push(errorStack[i]);\n }\n }\n return stack.join('\\n');\n }\n\n function guid() {\n var s4 = function() {\n return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1).toUpperCase();\n }\n return s4() + s4();\n }\n\n function inspectorObj (error, fullError) {\n var obj = {};\n obj.Id = guid();\n\n if (typeof error === \"object\") {\n var stack = error && objectLength(error.stack) !== 0 && typeof error === \"object\" ? ErrorStackParser.parse(error) : '';\n obj.Type = error.name;\n obj.Message = error.message;\n obj.StackTrace = objectLength(error.stack) !== 0 ? ErrorStackParser.parse(error) : null;\n obj.Source = stack && stack.length > 0 ? stack[0].fileName : null;\n obj.Inners = error.cause && typeof error.cause === \"object\" && error.cause instanceof Error ? [inspectorObj(error.cause)] : [];\n } else {\n obj.Type = typeof fullError.error;\n obj.Message = fullError.message;\n obj.StackTrace = stackString(fullError);\n obj.Source = fullError.source;\n obj.Inners = [];\n }\n\n return obj;\n }\n\n function inspectorGPS (error) {\n var inspectorObject = inspectorObj(error);\n var promiseArr = [];\n\n function iterateObj(obj, final) {\n Object.keys(obj).forEach(function(key){\n if (key === \"StackTrace\") {\n if (!final) {\n obj[key] = GPSPromise(obj[key]);\n promiseArr.push(obj[key]);\n } else {\n obj[key].then(result => {\n var generateNewFrames = GenerateNewFrames(obj.Type + ': ' + obj.Message, result, false, true);\n obj[key] = generateNewFrames.newFrames.join(\"\\n\");\n obj['Source'] = generateNewFrames.fileName || null;\n });\n }\n }\n if (key === \"Inners\" && obj[key].length !== 0) {\n iterateObj(obj[key][0], final);\n }\n });\n }\n\n iterateObj(inspectorObject, false);\n\n return new Promise(function(resolve, reject) {\n Promise.all(promiseArr).then(function(values) {\n iterateObj(inspectorObject, true);\n }).then(function() {\n resolve(inspectorObject);\n });\n });\n }\n\n // Private methods\n\n var recordBreadcrumb = function(obj) {\n var crumb = merge_objects({'dateTime': new Date().toISOString()}, obj),\n breadcrumbs_number = 10;\n \n breadcrumbs.push(crumb);\n \n if(options.breadcrumbsNumber >= 0 && typeof options.breadcrumbsNumber === \"number\" ) {\n if(options.breadcrumbsNumber > 25) {\n breadcrumbs_number = 25;\n } else if(options.breadcrumbsNumber <= 25) {\n breadcrumbs_number = options.breadcrumbsNumber;\n }\n }\n \n if (breadcrumbs.length > breadcrumbs_number) {\n breadcrumbs.shift();\n }\n }\n\n var breadcrumbClickEventHandler = function(evt) {\n var target;\n try {\n target = cssSelectorString(evt.target);\n } catch (e) {\n target = \"\";\n }\n\n recordBreadcrumb({\n \"severity\": \"Information\",\n \"action\": \"Click\",\n \"message\": target\n });\n }\n\n var breadcrumbFormSubmitEventHandler = function(evt) {\n var target;\n try {\n target = cssSelectorString(evt.target);\n } catch (e) {\n target = \"\";\n }\n\n recordBreadcrumb({\n \"severity\": \"Information\",\n \"action\": \"Form submit\",\n \"message\": target\n });\n }\n\n var breadcrumbWindowEventHandler = function(evt) {\n var type = evt.type,\n message = null;\n\n switch (type) {\n case \"load\":\n message = \"Page loaded\"; break;\n case \"DOMContentLoaded\":\n message = \"DOMContentLoaded\"; break;\n case \"pageshow\":\n message = \"Page shown\"; break;\n case \"pagehide\":\n message = \"Page hidden\"; break;\n case \"popstate\":\n message = \"Navigated from: \" + lastHref + \" to: \" + window.location.href; break;\n }\n\n recordBreadcrumb({\n \"severity\": \"Information\",\n \"action\": \"Navigation\",\n \"message\": message\n });\n }\n\n var breadcrumbHashChangeEventHandler = function(evt) {\n var oldURL = evt.oldURL,\n newURL = evt.newURL,\n from = null,\n to = null,\n message = null;\n\n if (oldURL && newURL) {\n from = parseHash(oldURL);\n to = parseHash(newURL);\n message = \"from: '\" + from + \"' to: '\" + to + \"'\";\n } else {\n to = location.hash;\n message = \"to: '\" + to + \"'\";\n }\n\n recordBreadcrumb({\n \"severity\": \"Information\",\n \"action\": \"Navigation\",\n \"message\": \"Hash changed \" + message\n });\n }\n\n var breadcrumbXHRHandler = function(evt, method, url) {\n var status = evt && evt.target ? evt.target.status : 0,\n severity = null,\n method = method.toUpperCase(),\n url = url,\n regex = /https:\\/\\/api.elmah.io/g;\n\n if(url.match(regex) == null) { \n if (status > 0 && status < 400) {\n severity = \"Information\";\n } else if (status > 399 && status < 500) {\n severity = \"Warning\";\n } else if (status >= 500) {\n severity = \"Error\";\n }\n\n var statusCode = status > 0 ? \" (\" + status + \")\" : \"\";\n\n recordBreadcrumb({\n \"severity\": severity,\n \"action\": \"Request\",\n \"message\": \"[\" + method + \"] \" + url + statusCode\n });\n }\n }\n\n var sendPayload = function (apiKey, logId, callback, errorLog) {\n var api_key = apiKey,\n log_id = logId,\n error = errorLog,\n send = 1,\n queryParams = getSearchParameters(),\n stack = error.error && objectLength(error.error.stack) !== 0 && typeof error.error === \"object\" ? ErrorStackParser.parse(error.error) : '';\n\n // Ignoring error from an external script\n if (error && error.colno === 0 && error.lineno === 0 && (!stack || stack === '') && error.message && (error.message === \"Script error.\" || error.message === \"Script error\")) {\n\t\t\t if (settings.debug) {\n\t\t\t console.log('%c \\u2BC8 Error log: ' + '%c \\uD83D\\uDEC8 Ignoring error from external script ', debugSettings.lightCSS, debugSettings.warningCSS);\n\t\t\t }\n\t\t\t return;\n\t\t\t}\n\n if ((api_key !== null && log_id !== null) || (paramsLength === 2)) {\n\n // Priority for parameters\n if (params.hasOwnProperty('apiKey') && params.hasOwnProperty('logId')) {\n api_key = params['apiKey'];\n log_id = params['logId'];\n }\n\n // get new XHR object\n var xhr = new XMLHttpRequest();\n xhr.open(\"POST\", \"https://api.elmah.io/v3/messages/\" + log_id + \"?api_key=\" + api_key, true);\n\n xhr.setRequestHeader('Content-type', 'application/json');\n\n xhr.onload = function (e) {\n if (xhr.readyState === 4) {\n if (xhr.status === 201) {\n callback('success', xhr.statusText);\n }\n\n if(xhr.status >= 400 && xhr.status <= 499) {\n callback('error', xhr.statusText);\n\n // on error event\n publicAPIs.emit('error', xhr.status, xhr.statusText);\n }\n }\n };\n\n xhr.onerror = function (e) {\n callback('error', xhr.statusText);\n\n // on error event\n publicAPIs.emit('error', xhr.status, xhr.statusText);\n }\n\n var jsonData = {\n \"detail\": error.error ? error.error.stack : null,\n \"title\": error.message || 'Unspecified error',\n \"source\": stack && stack.length > 0 ? stack[0].fileName : null,\n \"severity\": \"Error\",\n \"type\": error.error ? error.error.name : null,\n \"queryString\": JSON.parse(JSON.stringify(queryParams))\n };\n\n // Check if error sent is a string and not an object\n // Then create the articifial stacktrace and pass source & type of the error\n if(error.error && (objectLength(error.error.stack) === 0) && typeof jsonData.detail === \"undefined\") {\n \tvar typeOF = typeof errorLog.error;\n \t\t\tvar typeOFCapitalized = typeOF.charAt(0).toUpperCase() + typeOF.slice(1);\n\n \tjsonData.detail = stackString(errorLog);\n \tjsonData.source = errorLog.source;\n jsonData.title = \"Uncaught \" + typeOFCapitalized + \": \" + errorLog.error;\n }\n\n // Check if the error sent has a cause\n // Then change the type and source with the most inner error type\n if(error.error && error.error.cause && typeof error.error.cause === \"object\" && error.error.cause instanceof Error) {\n var typeAndSource = getErrorTypeSource(error.error);\n jsonData.type = typeAndSource.type;\n jsonData.source = typeAndSource.source;\n }\n\n // Add payload to jsonData\n jsonData = merge_objects(jsonData, getPayload());\n\n // Add breadcrumbs to jsonData\n if(breadcrumbs.length > 0) {\n jsonData.breadcrumbs = breadcrumbs;\n breadcrumbs = [];\n }\n\n // filter callback\n if (settings.filter !== null) {\n if (settings.filter(jsonData)) {\n send = 0;\n }\n }\n\n if (send === 1) {\n // on message event\n publicAPIs.emit('message', jsonData);\n\n if (error.error && typeof error.error === \"object\" && objectLength(error.error.stack) !== 0 && typeof Promise !== \"undefined\" && Promise.toString().indexOf(\"[native code]\") !== -1) {\n // try to pinpoint stackframes from error object\n inspectorGPS(error.error).then((result) => {\n // Add inspector to jsonData\n jsonData.data.push({ \"key\": \"X-ELMAHIO-EXCEPTIONINSPECTOR\", \"value\": JSON.stringify(result) });\n // send message trying to pinpoint stackframes\n stackGPS(error.error, xhr, jsonData);\n });\n\t } else {\n // Add inspector to jsonData\n jsonData.data.push({ \"key\": \"X-ELMAHIO-EXCEPTIONINSPECTOR\", \"value\": JSON.stringify(inspectorObj(error.error, errorLog)) });\n\t \t// send message\n \txhr.send(JSON.stringify(jsonData));\n\t }\n }\n\n } else {\n return console.log('Login api error');\n }\n };\n\n var sendManualPayload = function (apiKey, logId, callback, logType, messageLog, errorLog) {\n var api_key = apiKey,\n log_id = logId,\n type = logType,\n error = errorLog,\n message = messageLog,\n send = 1,\n queryParams = getSearchParameters();\n\n if ((api_key !== null && log_id !== null) || (paramsLength === 2)) {\n\n // Priority for parameters\n if (params.hasOwnProperty('apiKey') && params.hasOwnProperty('logId')) {\n api_key = params['apiKey'];\n log_id = params['logId'];\n }\n\n // get new XHR object\n var xhr = new XMLHttpRequest();\n xhr.open(\"POST\", \"https://api.elmah.io/v3/messages/\" + log_id + \"?api_key=\" + api_key, true);\n xhr.setRequestHeader('Content-type', 'application/json');\n\n xhr.onload = function (e) {\n if (xhr.readyState === 4) {\n if (xhr.status === 201) {\n callback('success', xhr.statusText);\n }\n\n if(xhr.status >= 400 && xhr.status <= 499) {\n callback('error', xhr.statusText);\n\n // on error event\n publicAPIs.emit('error', xhr.status, xhr.statusText);\n }\n }\n };\n\n xhr.onerror = function (e) {\n callback('error', xhr.statusText);\n\n // on error event\n publicAPIs.emit('error', xhr.status, xhr.statusText);\n }\n\n if (type !== \"Log\") {\n\n var stack = error && error instanceof Error && objectLength(error.stack) !== 0 ? ErrorStackParser.parse(error) : null;\n\n var jsonData = {\n \"title\": message,\n \"source\": stack && stack.length > 0 ? stack[0].fileName : null,\n \"detail\": error ? error.stack : null,\n \"severity\": type,\n \"type\": error ? error.name : null,\n \"queryString\": JSON.parse(JSON.stringify(queryParams))\n };\n\n // Check if the error sent has a cause\n // Then change the type and source with the most inner error type\n if(error && error.cause && typeof error.cause === \"object\" && error.cause instanceof Error) {\n var typeAndSource = getErrorTypeSource(error);\n jsonData.type = typeAndSource.type;\n jsonData.source = typeAndSource.source;\n }\n\n // Add payload to jsonData\n jsonData = merge_objects(jsonData, getPayload());\n\n } else {\n\n var jsonData = error;\n \n }\n\n // filter callback\n if (settings.filter !== null) {\n if (settings.filter(jsonData)) {\n send = 0;\n }\n }\n\n if (send === 1) {\n if (jsonData.title) {\n\n // Add breadcrumbs to jsonData\n if(breadcrumbs.length > 0) {\n // If message contains breadcrumbs\n if(jsonData.breadcrumbs && jsonData.breadcrumbs.length > 0) {\n breadcrumbs = breadcrumbs.reverse();\n for (var i = 0; i < breadcrumbs.length; i++) {\n // Add breadcrumbs to jsonData object\n jsonData.breadcrumbs.unshift(breadcrumbs[i]);\n }\n } else {\n jsonData.breadcrumbs = breadcrumbs;\n }\n \n // Reset breadcrumbs\n breadcrumbs = [];\n }\n\n // on message event\n publicAPIs.emit('message', jsonData);\n\n if (error && error instanceof Error && type !== \"Log\" && typeof Promise !== \"undefined\" && Promise.toString().indexOf(\"[native code]\") !== -1) {\n // try to pinpoint stackframes from error object\n inspectorGPS(error).then((result) => {\n // Add inspector to jsonData\n jsonData.data.push({ \"key\": \"X-ELMAHIO-EXCEPTIONINSPECTOR\", \"value\": JSON.stringify(result) });\n // send message trying to pinpoint stackframes\n stackGPS(error, xhr, jsonData);\n });\n } else {\n // send message\n if(jsonData.errorObject && jsonData.errorObject instanceof Error) {\n error = jsonData.errorObject;\n delete jsonData.errorObject;\n // try to pinpoint stackframes from error object\n inspectorGPS(error).then((result) => {\n // Add inspector to jsonData\n jsonData.data.push({ \"key\": \"X-ELMAHIO-EXCEPTIONINSPECTOR\", \"value\": JSON.stringify(result) });\n // send message trying to pinpoint stackframes\n stackGPS(error, xhr, jsonData);\n });\n } else {\n delete jsonData.errorObject;\n xhr.send(JSON.stringify(jsonData));\n }\n }\n\n } else {\n callback('missing-title', xhr.statusText);\n }\n }\n\n } else {\n return console.log('Login api error');\n }\n };\n\n var sendPayloadFromConsole = function (apiKey, logId, callback, logType, errorLog) {\n var api_key = apiKey,\n log_id = logId,\n message = errorLog.message,\n messageTemplate = errorLog.message,\n type = logType,\n args = Object.values(errorLog.arguments),\n send = 1,\n queryParams = getSearchParameters();\n\n function format(f, args) {\n var formatRegExp = /%[sdif]/g;\n var str = f;\n\n if(args.length > 1) {\n // If message has placeholders (%s, %d, %i, %f), check for arguments and replace them\n if(String(f).match(/%[sdif]/g)) {\n var i = 0;\n str = String(f).replace(formatRegExp, function(x) {\n switch (x) {\n case '%s': i++; return args[i] ? String(args[i]) : '%s';\n case '%d': i++; return args[i] ? (isInt(args[i]) || isFloat(args[i])) ? parseInt(args[i]) : 'NaN' : '%d';\n case '%i': i++; return args[i] ? (isInt(args[i]) || isFloat(args[i])) ? parseInt(args[i]) : 'NaN' : '%i';\n case '%f': i++; return args[i] ? (isInt(args[i]) || isFloat(args[i])) ? parseFloat(args[i]) : 'NaN' : '%f';\n default: return x;\n }\n });\n\n for (var len = args.length, x = args[++i]; i < len; x = args[++i]) {\n if (x === null || typeof x !== 'object') {\n str += ' ' + x;\n } else {\n str += ' ' + String(Object.prototype.toString.call(x));\n }\n }\n } else {\n str = args.join(' ');\n }\n }\n\n return str;\n }\n\n message = format(message, args);\n\n if(typeof message !== \"string\" && message !== undefined){\n message = message.toString();\n }\n\n if(typeof messageTemplate !== \"string\" && messageTemplate !== undefined) {\n messageTemplate = messageTemplate.toString();\n }\n\n if ((api_key !== null && log_id !== null) || (paramsLength === 2)) {\n\n // Priority for parameters\n if (params.hasOwnProperty('apiKey') && params.hasOwnProperty('logId')) {\n api_key = params['apiKey'];\n log_id = params['logId'];\n }\n\n // get new XHR object\n var xhr = new XMLHttpRequest();\n xhr.open(\"POST\", \"https://api.elmah.io/v3/messages/\" + log_id + \"?api_key=\" + api_key, true);\n xhr.setRequestHeader('Content-type', 'application/json');\n\n xhr.onload = function (e) {\n if (xhr.readyState === 4) {\n if (xhr.status === 201) {\n callback('success', xhr.statusText);\n }\n\n if(xhr.status >= 400 && xhr.status <= 499) {\n callback('error', xhr.statusText);\n\n // on error event\n publicAPIs.emit('error', xhr.status, xhr.statusText);\n }\n }\n };\n\n xhr.onerror = function (e) {\n callback('error', xhr.statusText);\n // on error event\n publicAPIs.emit('error', xhr.status, xhr.statusText);\n }\n\n var jsonData = {\n \"title\": message,\n \"titleTemplate\": messageTemplate,\n \"detail\": manipulateStack(new Error().stack.split('\\n'), type, message),\n \"severity\": type,\n \"type\": null,\n \"queryString\": JSON.parse(JSON.stringify(queryParams))\n };\n\n // Add payload to jsonData\n jsonData = merge_objects(jsonData, getPayload());\n\n // Add breadcrumbs to jsonData\n if(breadcrumbs.length > 0) {\n jsonData.breadcrumbs = breadcrumbs;\n breadcrumbs = [];\n }\n\n // filter callback\n if (settings.filter !== null) {\n if (settings.filter(jsonData)) {\n send = 0;\n }\n }\n\n if (send === 1) {\n if (jsonData.title) {\n // on message event\n publicAPIs.emit('message', jsonData);\n // send message\n xhr.send(JSON.stringify(jsonData));\n } else {\n callback('missing-title', xhr.statusText);\n }\n }\n\n } else {\n return console.log('Login api error');\n }\n };\n\n var sendPrefilledLogMessage = function(errorLog) {\n // without error object\n if(!errorLog) return getPayload();\n\n // with error object\n var error = errorLog;\n var stack = error && objectLength(error.stack) !== 0 ? ErrorStackParser.parse(error) : null;\n var jsonData = {\n \"title\": error.message,\n \"source\": stack && stack.length > 0 ? stack[0].fileName : null,\n \"detail\": error ? error.stack : null,\n \"severity\": \"Error\",\n \"type\": error ? error.name : null,\n \"errorObject\": error\n };\n\n // Check if the error sent has a cause\n // Then change the type and source with the most inner error type\n if(error && error.cause && typeof error.cause === \"object\" && error.cause instanceof Error) {\n var typeAndSource = getErrorTypeSource(error);\n jsonData.type = typeAndSource.type;\n jsonData.source = typeAndSource.source;\n }\n\n jsonData = merge_objects(jsonData, getPayload());\n \n return jsonData;\n };\n\n // Some public methods\n\n publicAPIs.error = function (msg, error) {\n setTimeout(function() { sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Error', msg, error); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n };\n publicAPIs.verbose = function (msg, error) {\n setTimeout(function() { sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Verbose', msg, error); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n };\n publicAPIs.debug = function (msg, error) {\n setTimeout(function() { sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Debug', msg, error); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n };\n publicAPIs.information = function (msg, error) {\n setTimeout(function() { sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Information', msg, error); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n };\n publicAPIs.warning = function (msg, error) {\n setTimeout(function() { sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Warning', msg, error); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n };\n publicAPIs.fatal = function (msg, error) {\n setTimeout(function() { sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Fatal', msg, error); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n };\n publicAPIs.log = function (obj) {\n setTimeout(function() { sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Log', null, obj); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n };\n publicAPIs.message = function(error) {\n return sendPrefilledLogMessage(error);\n };\n publicAPIs.addBreadcrumb = function(msg, severity, evt) {\n recordBreadcrumb({\n \"severity\": (severity != undefined && isString(severity)) ? severity : \"Information\",\n \"action\": (evt != undefined && isString(evt)) ? evt : \"Log\",\n \"message\": (msg != undefined && isString(msg)) ? msg : \"This is just a test message.\"\n });\n };\n\n publicAPIs.on = function (name, callback, ctx) {\n var e = this.e || (this.e = {});\n\n (e[name] || (e[name] = [])).push({\n fn: callback,\n ctx: ctx\n });\n\n return this;\n };\n\n publicAPIs.emit = function (name) {\n var data = [].slice.call(arguments, 1);\n var evtArr = ((this.e || (this.e = {}))[name] || []).slice();\n var i = 0;\n var len = evtArr.length;\n\n for (i; i < len; i++) {\n evtArr[i].fn.apply(evtArr[i].ctx, data);\n }\n\n return this;\n };\n\n publicAPIs.init = function (options) {\n\n // -- Merge options into defaults\n settings = extend(defaults, options || {});\n\n // -- Breadcrumbs\n if (settings.breadcrumbs) {\n // Breadcrumbs - Click & Submit form\n if (document.addEventListener) {\n document.addEventListener('click', breadcrumbClickEventHandler, false);\n document.addEventListener('submit', breadcrumbFormSubmitEventHandler, false);\n } else if (document.attachEvent) {\n document.attachEvent('click', breadcrumbClickEventHandler, false);\n document.attachEvent('submit', breadcrumbFormSubmitEventHandler, false);\n }\n\n // Breadcrumbs - Navigation\n if (window.addEventListener) {\n window.addEventListener('load', breadcrumbWindowEventHandler, false);\n window.addEventListener('DOMContentLoaded', breadcrumbWindowEventHandler, false);\n window.addEventListener('pageshow', breadcrumbWindowEventHandler, false);\n window.addEventListener('pagehide', breadcrumbWindowEventHandler, false);\n window.addEventListener('hashchange', breadcrumbHashChangeEventHandler, false);\n } else if (window.attachEvent) {\n window.attachEvent('load', breadcrumbWindowEventHandler, false);\n window.attachEvent('DOMContentLoaded', breadcrumbWindowEventHandler, false);\n window.attachEvent('pageshow', breadcrumbWindowEventHandler, false);\n window.attachEvent('pagehide', breadcrumbWindowEventHandler, false);\n window.attachEvent('hashchange', breadcrumbHashChangeEventHandler, false);\n }\n\n if(window.history && window.history.pushState && window.history.replaceState) {\n var old_onpopstate = window.onpopstate;\n window.onpopstate = function(evt) {\n breadcrumbWindowEventHandler(evt);\n if (old_onpopstate) {\n return old_onpopstate.apply(this, arguments);\n }\n };\n }\n\n // Breadcrumbs - XHR\n if(window.XMLHttpRequest && window.XMLHttpRequest.prototype) {\n // Store a reference to the native method\n var open = XMLHttpRequest.prototype.open;\n \n // Overwrite the native method\n XMLHttpRequest.prototype.open = function(method, url) {\n // Assign an event listener\n this.addEventListener(\"loadend\", function(event) { breadcrumbXHRHandler(event, method, url); }, false);\n // Call the stored reference to the native method\n open.apply(this, arguments);\n };\n }\n }\n\n // -- Log on window error\n window.onerror = function (message, source, lineno, colno, error) {\n var errorLog = {\n 'message': message,\n 'source': source,\n 'lineno': lineno,\n 'colno': colno,\n 'error': error\n };\n \n setTimeout(function() { sendPayload(settings.apiKey, settings.logId, confirmResponse, errorLog); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n\n return false;\n }\n\n // -- Log on window unhandled rejection\n window.onunhandledrejection = function (event) {\n var errorLog = {\n 'message': event.reason.message,\n 'error': event.reason.message && event.reason.stack ? event.reason : undefined\n };\n\n setTimeout(function() { sendPayload(settings.apiKey, settings.logId, confirmResponse, errorLog); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n\n return false;\n }\n\n // -- Overriding console methods\n // -- Then log messages into the app.elmah.io\n if(options && options.captureConsoleMinimumLevel !== \"none\") {\n\n // If captureConsoleMinimumLevel: info or debug is set (error, warn)\n if(options.captureConsoleMinimumLevel === \"info\" || options.captureConsoleMinimumLevel === \"warn\" || options.captureConsoleMinimumLevel === \"error\" || options.captureConsoleMinimumLevel === \"debug\") {\n // Log console errors\n var _error = console.error;\n console.error = function(errMessage){\n var errorLog = {\n \t\t'message': errMessage,\n \t\t'arguments': arguments\n \t}\n setTimeout(function() { sendPayloadFromConsole(settings.apiKey, settings.logId, confirmResponse, 'Error', errorLog); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n _error.apply(console, arguments);\n };\n if(options.captureConsoleMinimumLevel !== \"error\") {\n // Log console warnings\n var _warning = console.warn;\n console.warn = function(warnMessage){\n var errorLog = {\n 'message': warnMessage,\n 'arguments': arguments\n }\n setTimeout(function() { sendPayloadFromConsole(settings.apiKey, settings.logId, confirmResponse, 'Warning', errorLog); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n _warning.apply(console, arguments);\n };\n }\n }\n if(options.captureConsoleMinimumLevel === \"info\" || options.captureConsoleMinimumLevel === \"debug\") {\n // Log console info\n var _info = console.info;\n console.info = function(infoMessage){\n var errorLog = {\n \t\t'message': infoMessage,\n \t\t'arguments': arguments\n \t}\n setTimeout(function() { sendPayloadFromConsole(settings.apiKey, settings.logId, confirmResponse, 'Information', errorLog); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n _info.apply(console, arguments);\n };\n }\n if(options.captureConsoleMinimumLevel === \"debug\") {\n // Log console debug\n var _debug = console.debug;\n console.debug = function(debugMessage){\n var errorLog = {\n \t\t'message': debugMessage,\n \t\t'arguments': arguments\n \t}\n setTimeout(function() { sendPayloadFromConsole(settings.apiKey, settings.logId, confirmResponse, 'Debug', errorLog); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n _debug.apply(console, arguments);\n };\n }\n }\n };\n\n // Initialize the plugin\n publicAPIs.init(options);\n\n if (settings.debug) {\n console.log('%c' + debugSettings.label, debugSettings.labelCSS);\n }\n\n // Return the public APIs\n return publicAPIs;\n\n };\n\n\n //\n // Return the constructor\n //\n\n if (paramsLength && params.hasOwnProperty('apiKey') && params.hasOwnProperty('logId')) {\n // Immediately-Invoked Function Expression (IIFE)\n return new Constructor;\n } else {\n // UMD Constructor\n return Constructor;\n }\n\n});"],"file":"elmahio.js"} \ No newline at end of file diff --git a/dist/elmahio.min.js b/dist/elmahio.min.js index 5e90f7c..fa1f228 100644 --- a/dist/elmahio.min.js +++ b/dist/elmahio.min.js @@ -1,6 +1,6 @@ /*! - * elmah.io Javascript Logger - version 3.7.1 + * elmah.io Javascript Logger - version 4.0.0 * (c) 2018 elmah.io, Apache 2.0 License, https://elmah.io */ -!function(e,t){"function"==typeof define&&define.amd?define([],function(){return t(e)}):"object"==typeof exports?module.exports=t(e):e.Elmahio=t(e)}("undefined"!=typeof global?global:"undefined"!=typeof window?window:this,function(e){"use strict";for(var t,n,r,o=function(){function e(e){return!isNaN(parseFloat(e))&&isFinite(e)}function t(e){return e.charAt(0).toUpperCase()+e.substring(1)}function n(e){return function(){return this[e]}}var r=["isConstructor","isEval","isNative","isToplevel"],o=["columnNumber","lineNumber"],i=["fileName","functionName","source"],a=r.concat(o,i,["args"]);function s(e){if(e instanceof Object)for(var n=0;n-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^\()]*)|(\)\,.*$)/g,""));var t=e.replace(/^\s+/,"").replace(/\(eval code/g,"(").split(/\s+/).slice(1),n=this.extractLocation(t.pop()),r=t.join(" ")||void 0,i=["eval",""].indexOf(n[0])>-1?void 0:n[0];return new o({functionName:r,fileName:i,lineNumber:n[1],columnNumber:n[2],source:e})},this)},parseFFOrSafari:function(e){return e.stack.split("\n").filter(function(e){return!e.match(r)},this).map(function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new o({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),r=n&&n[1]?n[1]:void 0,i=this.extractLocation(e.replace(t,""));return new o({functionName:r,fileName:i[0],lineNumber:i[1],columnNumber:i[2],source:e})},this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){for(var t=/Line (\d+).*script (?:in )?(\S+)/i,n=e.message.split("\n"),r=[],i=2,a=n.length;i/,"$2").replace(/\([^\)]*\)/g,"")||void 0;i.match(/\(([^\)]*)\)/)&&(t=i.replace(/^[^\(]+\(([^\)]*)\)$/,"$1"));var s=void 0===t||"[arguments not available]"===t?void 0:t.split(",");return new o({functionName:a,args:s,fileName:r[0],lineNumber:r[1],columnNumber:r[2],source:e})},this)}}),a=function(t,n){function r(e){return new Promise(function(t,n){var r=new XMLHttpRequest;r.open("get",e),r.onerror=n,r.onreadystatechange=function(){4===r.readyState&&(r.status>=200&&r.status<300||"file://"===e.substr(0,7)&&r.responseText?t(r.responseText):n(new Error("HTTP status: "+r.status+" retrieving "+e)))},r.send()})}function o(t){if(void 0!==e&&e.atob)return e.atob(t);throw new Error("You must supply a polyfill for window.atob in this environment")}function i(e){if("object"!=typeof e)throw new TypeError("Given StackFrame is not an object");if("string"!=typeof e.fileName)throw new TypeError("Given file name is not a String");if("number"!=typeof e.lineNumber||e.lineNumber%1!=0||e.lineNumber<1)throw new TypeError("Given line number must be a positive integer");if("number"!=typeof e.columnNumber||e.columnNumber%1!=0||e.columnNumber<0)throw new TypeError("Given column number must be a non-negative integer");return!0}return function e(a){if(!(this instanceof e))return new e(a);a=a||{},this.sourceCache=a.sourceCache||{},this.sourceMapConsumerCache=a.sourceMapConsumerCache||{},this.ajax=a.ajax||r,this._atob=a.atob||o,this._get=function(e){return new Promise(function(t,n){var r="data:"===e.substr(0,5);if(this.sourceCache[e])t(this.sourceCache[e]);else if(a.offline&&!r)n(new Error("Cannot make network requests in offline mode"));else if(r){var o=e.match(/^data:application\/json;([\w=:"-]+;)*base64,/);if(o){var i=o[0].length,s=e.substr(i),u=this._atob(s);this.sourceCache[e]=u,t(u)}else n(new Error("The encoding of the inline sourcemap is not supported"))}else{var l=this.ajax(e,{method:"get"});this.sourceCache[e]=l,l.then(t,n)}}.bind(this))},this._getSourceMapConsumer=function(e,n){return new Promise(function(r,o){if(this.sourceMapConsumerCache[e])r(this.sourceMapConsumerCache[e]);else{var i=new Promise(function(r,o){return this._get(e).then(function(e){"string"==typeof e&&(e=function(e){if("undefined"!=typeof JSON&&JSON.parse)return JSON.parse(e);throw new Error("You must supply a polyfill for JSON.parse in this environment")}(e.replace(/^\)\]\}'/,""))),void 0===e.sourceRoot&&(e.sourceRoot=n),r(new t.SourceMapConsumer(e))},o)}.bind(this));this.sourceMapConsumerCache[e]=i,r(i)}}.bind(this))},this.pinpoint=function(e){return new Promise(function(t,n){this.getMappedLocation(e).then(function(e){function n(){t(e)}this.findFunctionName(e).then(t,n).catch(n)}.bind(this),n)}.bind(this))},this.findFunctionName=function(e){return new Promise(function(t,r){i(e),this._get(e.fileName).then(function(r){var o=e.lineNumber,i=e.columnNumber,a=function(e,t){for(var n=[/['"]?([$_A-Za-z][$_A-Za-z0-9]*)['"]?\s*[:=]\s*function\b/,/function\s+([^('"`]*?)\s*\(([^)]*)\)/,/['"]?([$_A-Za-z][$_A-Za-z0-9]*)['"]?\s*[:=]\s*(?:eval|new Function)\b/,/\b(?!(?:if|for|switch|while|with|catch)\b)(?:(?:static)\s+)?(\S+)\s*\(.*?\)\s*\{/,/['"]?([$_A-Za-z][$_A-Za-z0-9]*)['"]?\s*[:=]\s*\(.*?\)\s*=>/],r=e.split("\n"),o="",i=Math.min(t,20),a=0;a=0&&(s=s.substr(0,u)),s){o=s+o;for(var l=n.length,c=0;c=0){var s=this._originalMappings[a];if(void 0===e.column)for(var u=s.originalLine;s&&s.originalLine===u;)i.push({line:r.getArg(s,"generatedLine",null),column:r.getArg(s,"generatedColumn",null),lastColumn:r.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++a];else for(var l=s.originalColumn;s&&s.originalLine===t&&s.originalColumn==l;)i.push({line:r.getArg(s,"generatedLine",null),column:r.getArg(s,"generatedColumn",null),lastColumn:r.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++a]}return i},t.SourceMapConsumer=u,l.prototype=Object.create(u.prototype),l.prototype.consumer=u,l.fromSourceMap=function(e){var t=Object.create(l.prototype),n=t._names=i.fromArray(e._names.toArray(),!0),o=t._sources=i.fromArray(e._sources.toArray(),!0);t.sourceRoot=e._sourceRoot,t.sourcesContent=e._generateSourcesContent(t._sources.toArray(),t.sourceRoot),t.file=e._file;for(var a=e._mappings.toArray().slice(),u=t.__generatedMappings=[],g=t.__originalMappings=[],p=0,f=a.length;p1&&(n.source=m+i[1],m+=i[1],n.originalLine=f+i[2],f=n.originalLine,n.originalLine+=1,n.originalColumn=h+i[3],h=n.originalColumn,i.length>4&&(n.name=d+i[4],d+=i[4])),C.push(n),"number"==typeof n.originalLine&&O.push(n)}s(C,r.compareByGeneratedPositionsDeflated),this.__generatedMappings=C,s(O,r.compareByOriginalPositions),this.__originalMappings=O},l.prototype._findMapping=function(e,t,n,r,i,a){if(e[n]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[n]);if(e[r]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[r]);return o.search(e,t,i,a)},l.prototype.computeColumnSpans=function(){for(var e=0;e=0){var o=this._generatedMappings[n];if(o.generatedLine===t.generatedLine){var i=r.getArg(o,"source",null);null!==i&&(i=this._sources.at(i),null!=this.sourceRoot&&(i=r.join(this.sourceRoot,i)));var a=r.getArg(o,"name",null);return null!==a&&(a=this._names.at(a)),{source:i,line:r.getArg(o,"originalLine",null),column:r.getArg(o,"originalColumn",null),name:a}}}return{source:null,line:null,column:null,name:null}},l.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return null==e})},l.prototype.sourceContentFor=function(e,t){if(!this.sourcesContent)return null;if(null!=this.sourceRoot&&(e=r.relative(this.sourceRoot,e)),this._sources.has(e))return this.sourcesContent[this._sources.indexOf(e)];var n;if(null!=this.sourceRoot&&(n=r.urlParse(this.sourceRoot))){var o=e.replace(/^file:\/\//,"");if("file"==n.scheme&&this._sources.has(o))return this.sourcesContent[this._sources.indexOf(o)];if((!n.path||"/"==n.path)&&this._sources.has("/"+e))return this.sourcesContent[this._sources.indexOf("/"+e)]}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')},l.prototype.generatedPositionFor=function(e){var t=r.getArg(e,"source");if(null!=this.sourceRoot&&(t=r.relative(this.sourceRoot,t)),!this._sources.has(t))return{line:null,column:null,lastColumn:null};var n={source:t=this._sources.indexOf(t),originalLine:r.getArg(e,"line"),originalColumn:r.getArg(e,"column")},o=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",r.compareByOriginalPositions,r.getArg(e,"bias",u.GREATEST_LOWER_BOUND));if(o>=0){var i=this._originalMappings[o];if(i.source===n.source)return{line:r.getArg(i,"generatedLine",null),column:r.getArg(i,"generatedColumn",null),lastColumn:r.getArg(i,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},t.BasicSourceMapConsumer=l,g.prototype=Object.create(u.prototype),g.prototype.constructor=u,g.prototype._version=3,Object.defineProperty(g.prototype,"sources",{get:function(){for(var e=[],t=0;t=0;c--)"."===(a=u[c])?u.splice(c,1):".."===a?l++:l>0&&(""===a?(u.splice(c+1,l),l=0):(u.splice(c,2),l--));return""===(n=u.join("/"))&&(n=s?"/":"."),r?(r.path=n,i(r)):n}t.urlParse=o,t.urlGenerate=i,t.normalize=a,t.join=function(e,t){""===e&&(e="."),""===t&&(t=".");var n=o(t),s=o(e);if(s&&(e=s.path||"/"),n&&!n.scheme)return s&&(n.scheme=s.scheme),i(n);if(n||t.match(r))return t;if(s&&!s.host&&!s.path)return s.host=t,i(s);var u="/"===t.charAt(0)?t:a(e.replace(/\/+$/,"")+"/"+t);return s?(s.path=u,i(s)):u},t.isAbsolute=function(e){return"/"===e.charAt(0)||!!e.match(n)},t.relative=function(e,t){""===e&&(e="."),e=e.replace(/\/$/,"");for(var n=0;0!==t.indexOf(e+"/");){var r=e.lastIndexOf("/");if(r<0)return t;if((e=e.slice(0,r)).match(/^([^\/]+:\/)?\/*$/))return t;++n}return Array(n+1).join("../")+t.substr(e.length+1)};var s=!("__proto__"in Object.create(null));function u(e){return e}function l(e){if(!e)return!1;var t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(var n=t-10;n>=0;n--)if(36!==e.charCodeAt(n))return!1;return!0}function c(e,t){return e===t?0:e>t?1:-1}t.toSetString=s?u:function(e){return l(e)?"$"+e:e},t.fromSetString=s?u:function(e){return l(e)?e.slice(1):e},t.compareByOriginalPositions=function(e,t,n){var r=e.source-t.source;return 0!==r?r:0!=(r=e.originalLine-t.originalLine)?r:0!=(r=e.originalColumn-t.originalColumn)||n?r:0!=(r=e.generatedColumn-t.generatedColumn)?r:0!=(r=e.generatedLine-t.generatedLine)?r:e.name-t.name},t.compareByGeneratedPositionsDeflated=function(e,t,n){var r=e.generatedLine-t.generatedLine;return 0!==r?r:0!=(r=e.generatedColumn-t.generatedColumn)||n?r:0!=(r=e.source-t.source)?r:0!=(r=e.originalLine-t.originalLine)?r:0!=(r=e.originalColumn-t.originalColumn)?r:e.name-t.name},t.compareByGeneratedPositionsInflated=function(e,t){var n=e.generatedLine-t.generatedLine;return 0!==n?n:0!=(n=e.generatedColumn-t.generatedColumn)?n:0!==(n=c(e.source,t.source))?n:0!=(n=e.originalLine-t.originalLine)?n:0!=(n=e.originalColumn-t.originalColumn)?n:c(e.name,t.name)}},function(e,t){t.GREATEST_LOWER_BOUND=1,t.LEAST_UPPER_BOUND=2,t.search=function(e,n,r,o){if(0===n.length)return-1;var i=function e(n,r,o,i,a,s){var u=Math.floor((r-n)/2)+n,l=a(o,i[u],!0);return 0===l?u:l>0?r-u>1?e(u,r,o,i,a,s):s==t.LEAST_UPPER_BOUND?r1?e(n,u,o,i,a,s):s==t.LEAST_UPPER_BOUND?u:n<0?-1:n}(-1,n.length,e,n,r,o||t.GREATEST_LOWER_BOUND);if(i<0)return-1;for(;i-1>=0&&0===r(n[i],n[i-1],!0);)--i;return i}},function(e,t,n){var r=n(1),o=Object.prototype.hasOwnProperty;function i(){this._array=[],this._set=Object.create(null)}i.fromArray=function(e,t){for(var n=new i,r=0,o=e.length;r=0&&e>>=5)>0&&(t|=32),o+=r.encode(t)}while(i>0);return o},t.decode=function(e,t,n){var o,i,a,s,u=e.length,l=0,c=0;do{if(t>=u)throw new Error("Expected more digits in base 64 VLQ value.");if(-1===(i=r.decode(e.charCodeAt(t++))))throw new Error("Invalid base64 digit: "+e.charAt(t-1));o=!!(32&i),l+=(i&=31)<>1,1==(1&a)?-s:s),n.rest=t}},function(e,t){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");t.encode=function(e){if(0<=e&&e ".length;e&&r++<5&&!("html"===(t=w(e))||r>1&&o+n.length*i+t.length>=80);)n.push(t),o+=t.length,e=e.parentNode;return n.reverse().join(" > ")}function w(e){var t,n,r,o,i,a=[];if(!e||!e.tagName)return"";if(a.push(e.tagName.toLowerCase()),e.id&&a.push("#"+e.id),(t=e.className)&&O(t))for(n=t.split(/\s+/),i=0;i=0&&"number"==typeof t.breadcrumbsNumber&&(t.breadcrumbsNumber>25?r=25:t.breadcrumbsNumber<=25&&(r=t.breadcrumbsNumber)),o.length>r&&o.shift()},L=function(e){var t;try{t=C(e.target)}catch(e){t=""}w({severity:"Information",action:"Click",message:t})},N=function(e){var t;try{t=C(e.target)}catch(e){t=""}w({severity:"Information",action:"Form submit",message:t})},E=function(t){var n=null;switch(t.type){case"load":n="Page loaded";break;case"DOMContentLoaded":n="DOMContentLoaded";break;case"pageshow":n="Page shown";break;case"pagehide":n="Page hidden";break;case"popstate":n="Navigated from: "+s+" to: "+e.location.href}w({severity:"Information",action:"Navigation",message:n})},A=function(e){var t=e.oldURL,n=e.newURL,r=null;r=t&&n?"from: '"+S(t)+"' to: '"+S(n)+"'":"to: '"+location.hash+"'",w({severity:"Information",action:"Navigation",message:"Hash changed "+r})},M=function(e,t,a,s,l,p){var f=e,h=t,d=s,v=p,b=l,O=1,C=y();if((null===f||null===h)&&2!==g)return console.log("Login api error");c.hasOwnProperty("apiKey")&&c.hasOwnProperty("logId")&&(f=c.apiKey,h=c.logId);var w=new XMLHttpRequest;if(w.open("POST","https://api.elmah.io/v3/messages/"+h+"?api_key="+f,!0),w.setRequestHeader("Content-type","application/json"),w.onload=function(e){4===w.readyState&&(201===w.status&&a("success",w.statusText),w.status>=400&&w.status<=499&&(a("error",w.statusText),r.emit("error",w.status,w.statusText)))},w.onerror=function(e){a("error",w.statusText),r.emit("error",w.status,w.statusText)},"Log"!==d){var S=v&&v instanceof Error?i.parse(v):null;L=_(L={title:b,source:S&&S.length>0?S[0].fileName:null,detail:v?v.stack:null,severity:d,type:v?v.name:null,queryString:JSON.parse(JSON.stringify(C))},u())}else var L=v;if(null!==n.filter&&n.filter(L)&&(O=0),1===O)if(L.title){if(o.length>0){if(L.breadcrumbs&&L.breadcrumbs.length>0){o=o.reverse();for(var N=0;N1)if(String(e).match(/%[sdif]/g)){var r=0;n=String(e).replace(/%[sdif]/g,function(e){switch(e){case"%s":return t[++r]?String(t[r]):"%s";case"%d":return t[++r]?d(t[r])||v(t[r])?parseInt(t[r]):"NaN":"%d";case"%i":return t[++r]?d(t[r])||v(t[r])?parseInt(t[r]):"NaN":"%i";case"%f":return t[++r]?d(t[r])||v(t[r])?parseFloat(t[r]):"NaN":"%f";default:return e}});for(var o=t.length,i=t[++r];r=400&&w.status<=499&&(i("error",w.statusText),r.emit("error",w.status,w.statusText)))},w.onerror=function(e){i("error",w.statusText),r.emit("error",w.status,w.statusText)};var S={title:f,titleTemplate:h,detail:function(e,t,n){for(var r=[],o=0;o0&&(S.breadcrumbs=o,o=[]),null!==n.filter&&n.filter(S)&&(O=0),1===O&&(S.title?(r.emit("message",S),w.send(JSON.stringify(S))):i("missing-title",w.statusText))};return r.error=function(e,t){setTimeout(function(){M(n.apiKey,n.logId,l,"Error",e,t)},n.breadcrumbs?100:0)},r.verbose=function(e,t){setTimeout(function(){M(n.apiKey,n.logId,l,"Verbose",e,t)},n.breadcrumbs?100:0)},r.debug=function(e,t){setTimeout(function(){M(n.apiKey,n.logId,l,"Debug",e,t)},n.breadcrumbs?100:0)},r.information=function(e,t){setTimeout(function(){M(n.apiKey,n.logId,l,"Information",e,t)},n.breadcrumbs?100:0)},r.warning=function(e,t){setTimeout(function(){M(n.apiKey,n.logId,l,"Warning",e,t)},n.breadcrumbs?100:0)},r.fatal=function(e,t){setTimeout(function(){M(n.apiKey,n.logId,l,"Fatal",e,t)},n.breadcrumbs?100:0)},r.log=function(e){setTimeout(function(){M(n.apiKey,n.logId,l,"Log",null,e)},n.breadcrumbs?100:0)},r.message=function(e){return function(e){if(!e)return u();var t=e,n=t?i.parse(t):null,r={title:t.message,source:n&&n.length>0?n[0].fileName:null,detail:t?t.stack:null,severity:"Error",type:t?t.name:null,errorObject:t};return r=_(r,u())}(e)},r.addBreadcrumb=function(e,t,n){w({severity:null!=t&&O(t)?t:"Information",action:null!=n&&O(n)?n:"Log",message:null!=e&&O(e)?e:"This is just a test message."})},r.on=function(e,t,n){var r=this.e||(this.e={});return(r[e]||(r[e]=[])).push({fn:t,ctx:n}),this},r.emit=function(e){for(var t=[].slice.call(arguments,1),n=((this.e||(this.e={}))[e]||[]).slice(),r=0,o=n.length;r0&&r<400?o="Information":r>399&&r<500?o="Warning":r>=500&&(o="Error"),w({severity:o,action:"Request",message:"["+t+"] "+n+(r>0?" ("+r+")":"")}))}(n,e,t)},!1),s.apply(this,arguments)}}}if(e.onerror=function(e,t,a,s,f){var h={message:e,source:t,lineno:a,colno:s,error:f};return setTimeout(function(){!function(e,t,a,s){var l=e,f=t,h=s,d=1,v=y(),O=h.error&&0!==b(h.error.stack)&&"object"==typeof h.error?i.parse(h.error):"";if(!h||0!==h.colno||0!==h.lineno||O&&""!==O||!h.message||"Script error."!==h.message&&"Script error"!==h.message){if((null===l||null===f)&&2!==g)return console.log("Login api error");c.hasOwnProperty("apiKey")&&c.hasOwnProperty("logId")&&(l=c.apiKey,f=c.logId);var C=new XMLHttpRequest;C.open("POST","https://api.elmah.io/v3/messages/"+f+"?api_key="+l,!0),C.setRequestHeader("Content-type","application/json"),C.onload=function(e){4===C.readyState&&(201===C.status&&a("success",C.statusText),C.status>=400&&C.status<=499&&(a("error",C.statusText),r.emit("error",C.status,C.statusText)))},C.onerror=function(e){a("error",C.statusText),r.emit("error",C.status,C.statusText)};var w={detail:h.error?h.error.stack:null,title:h.message||"Unspecified error",source:O&&O.length>0?O[0].fileName:null,severity:"Error",type:h.error?h.error.name:null,queryString:JSON.parse(JSON.stringify(v))};if(h.error&&0===b(h.error.stack)&&void 0===w.detail){var S=typeof s.error,L=S.charAt(0).toUpperCase()+S.slice(1);w.detail=function(e){var t=typeof e.error;return t.charAt(0).toUpperCase()+t.slice(1)+": "+e.error+"\n at ("+e.source+":"+e.lineno+":"+e.colno+")"}(s),w.source=s.source,w.title="Uncaught "+L+": "+s.error}w=_(w,u()),o.length>0&&(w.breadcrumbs=o,o=[]),null!==n.filter&&n.filter(w)&&(d=0),1===d&&(r.emit("message",w),h.error&&"object"==typeof h.error&&0!==b(h.error.stack)&&"undefined"!=typeof Promise&&-1!==Promise.toString().indexOf("[native code]")?m(h.error,C,w):C.send(JSON.stringify(w)))}else n.debug&&console.log("%c ⯈ Error log: %c 🛈 Ignoring error from external script ",p.lightCSS,p.warningCSS)}(n.apiKey,n.logId,l,h)},n.breadcrumbs?100:0),!1},t&&"none"!==t.captureConsoleMinimumLevel){if("info"===t.captureConsoleMinimumLevel||"warn"===t.captureConsoleMinimumLevel||"error"===t.captureConsoleMinimumLevel||"debug"===t.captureConsoleMinimumLevel){var d=console.error;if(console.error=function(e){var t={message:e,arguments:arguments};setTimeout(function(){x(n.apiKey,n.logId,l,"Error",t)},n.breadcrumbs?100:0),d.apply(console,arguments)},"error"!==t.captureConsoleMinimumLevel){var v=console.warn;console.warn=function(e){var t={message:e,arguments:arguments};setTimeout(function(){x(n.apiKey,n.logId,l,"Warning",t)},n.breadcrumbs?100:0),v.apply(console,arguments)}}}if("info"===t.captureConsoleMinimumLevel||"debug"===t.captureConsoleMinimumLevel){var O=console.info;console.info=function(e){var t={message:e,arguments:arguments};setTimeout(function(){x(n.apiKey,n.logId,l,"Information",t)},n.breadcrumbs?100:0),O.apply(console,arguments)}}if("debug"===t.captureConsoleMinimumLevel){var C=console.debug;console.debug=function(e){var t={message:e,arguments:arguments};setTimeout(function(){x(n.apiKey,n.logId,l,"Debug",t)},n.breadcrumbs?100:0),C.apply(console,arguments)}}}},r.init(t),n.debug&&console.log("%c"+p.label,p.labelCSS),r};return g&&c.hasOwnProperty("apiKey")&&c.hasOwnProperty("logId")?new L:L}); +!function(e,n){"function"==typeof define&&define.amd?define([],function(){return n(e)}):"object"==typeof exports?module.exports=n(e):e.Elmahio=n(e)}("undefined"!=typeof global?global:"undefined"!=typeof window?window:this,function(e){"use strict";for(var n,t,r,o=function(){function e(e){return!isNaN(parseFloat(e))&&isFinite(e)}function n(e){return e.charAt(0).toUpperCase()+e.substring(1)}function t(e){return function(){return this[e]}}var r=["isConstructor","isEval","isNative","isToplevel"],o=["columnNumber","lineNumber"],i=["fileName","functionName","source"],a=r.concat(o,i,["args"]);function s(e){if(e instanceof Object)for(var t=0;t-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));var n=e.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),t=n.match(/ (\(.+\)$)/);n=t?n.replace(t[0],""):n;var r=this.extractLocation(t?t[1]:n),i=t&&n||void 0,a=["eval",""].indexOf(r[0])>-1?void 0:r[0];return new o({functionName:i,fileName:a,lineNumber:r[1],columnNumber:r[2],source:e})},this)},parseFFOrSafari:function(e){return e.stack.split("\n").filter(function(e){return!e.match(r)},this).map(function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new o({functionName:e});var n=/((.*".+"[^@]*)?[^@]*)(?:@)/,t=e.match(n),r=t&&t[1]?t[1]:void 0,i=this.extractLocation(e.replace(n,""));return new o({functionName:r,fileName:i[0],lineNumber:i[1],columnNumber:i[2],source:e})},this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){for(var n=/Line (\d+).*script (?:in )?(\S+)/i,t=e.message.split("\n"),r=[],i=2,a=t.length;i/,"$2").replace(/\([^)]*\)/g,"")||void 0;i.match(/\(([^)]*)\)/)&&(n=i.replace(/^[^(]+\(([^)]*)\)$/,"$1"));var s=void 0===n||"[arguments not available]"===n?void 0:n.split(",");return new o({functionName:a,args:s,fileName:r[0],lineNumber:r[1],columnNumber:r[2],source:e})},this)}}),a=function(n,t){function r(e){return new Promise(function(n,t){var r=new XMLHttpRequest;r.open("get",e),r.onerror=t,r.onreadystatechange=function(){4===r.readyState&&(r.status>=200&&r.status<300||"file://"===e.substr(0,7)&&r.responseText?n(r.responseText):t(new Error("HTTP status: "+r.status+" retrieving "+e)))},r.send()})}function o(n){if(void 0!==e&&e.atob)return e.atob(n);throw new Error("You must supply a polyfill for window.atob in this environment")}function i(e){if("object"!=typeof e)throw new TypeError("Given StackFrame is not an object");if("string"!=typeof e.fileName)throw new TypeError("Given file name is not a String");if("number"!=typeof e.lineNumber||e.lineNumber%1!=0||e.lineNumber<1)throw new TypeError("Given line number must be a positive integer");if("number"!=typeof e.columnNumber||e.columnNumber%1!=0||e.columnNumber<0)throw new TypeError("Given column number must be a non-negative integer");return!0}return function e(a){if(!(this instanceof e))return new e(a);a=a||{},this.sourceCache=a.sourceCache||{},this.sourceMapConsumerCache=a.sourceMapConsumerCache||{},this.ajax=a.ajax||r,this._atob=a.atob||o,this._get=function(e){return new Promise(function(n,t){var r="data:"===e.substr(0,5);if(this.sourceCache[e])n(this.sourceCache[e]);else if(a.offline&&!r)t(new Error("Cannot make network requests in offline mode"));else if(r){var o=e.match(/^data:application\/json;([\w=:"-]+;)*base64,/);if(o){var i=o[0].length,s=e.substr(i),u=this._atob(s);this.sourceCache[e]=u,n(u)}else t(new Error("The encoding of the inline sourcemap is not supported"))}else{var c=this.ajax(e,{method:"get"});this.sourceCache[e]=c,c.then(n,t)}}.bind(this))},this._getSourceMapConsumer=function(e,t){return new Promise(function(r,o){if(this.sourceMapConsumerCache[e])r(this.sourceMapConsumerCache[e]);else{var i=new Promise(function(r,o){return this._get(e).then(function(e){"string"==typeof e&&(e=function(e){if("undefined"!=typeof JSON&&JSON.parse)return JSON.parse(e);throw new Error("You must supply a polyfill for JSON.parse in this environment")}(e.replace(/^\)\]\}'/,""))),void 0===e.sourceRoot&&(e.sourceRoot=t),r(new n.SourceMapConsumer(e))},o)}.bind(this));this.sourceMapConsumerCache[e]=i,r(i)}}.bind(this))},this.pinpoint=function(e){return new Promise(function(n,t){this.getMappedLocation(e).then(function(e){function t(){n(e)}this.findFunctionName(e).then(n,t).catch(t)}.bind(this),t)}.bind(this))},this.findFunctionName=function(e){return new Promise(function(n,r){i(e),this._get(e.fileName).then(function(r){var o=e.lineNumber,i=e.columnNumber,a=function(e,n){for(var t=[/['"]?([$_A-Za-z][$_A-Za-z0-9]*)['"]?\s*[:=]\s*function\b/,/function\s+([^('"`]*?)\s*\(([^)]*)\)/,/['"]?([$_A-Za-z][$_A-Za-z0-9]*)['"]?\s*[:=]\s*(?:eval|new Function)\b/,/\b(?!(?:if|for|switch|while|with|catch)\b)(?:(?:static)\s+)?(\S+)\s*\(.*?\)\s*\{/,/['"]?([$_A-Za-z][$_A-Za-z0-9]*)['"]?\s*[:=]\s*\(.*?\)\s*=>/],r=e.split("\n"),o="",i=Math.min(n,20),a=0;a=0&&(s=s.substr(0,u)),s){o=s+o;for(var c=t.length,l=0;l=0){var s=this._originalMappings[a];if(void 0===e.column)for(var u=s.originalLine;s&&s.originalLine===u;)i.push({line:r.getArg(s,"generatedLine",null),column:r.getArg(s,"generatedColumn",null),lastColumn:r.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++a];else for(var c=s.originalColumn;s&&s.originalLine===n&&s.originalColumn==c;)i.push({line:r.getArg(s,"generatedLine",null),column:r.getArg(s,"generatedColumn",null),lastColumn:r.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++a]}return i},n.SourceMapConsumer=u,c.prototype=Object.create(u.prototype),c.prototype.consumer=u,c.fromSourceMap=function(e){var n=Object.create(c.prototype),t=n._names=i.fromArray(e._names.toArray(),!0),o=n._sources=i.fromArray(e._sources.toArray(),!0);n.sourceRoot=e._sourceRoot,n.sourcesContent=e._generateSourcesContent(n._sources.toArray(),n.sourceRoot),n.file=e._file;for(var a=e._mappings.toArray().slice(),u=n.__generatedMappings=[],g=n.__originalMappings=[],p=0,f=a.length;p1&&(t.source=m+i[1],m+=i[1],t.originalLine=f+i[2],f=t.originalLine,t.originalLine+=1,t.originalColumn=h+i[3],h=t.originalColumn,i.length>4&&(t.name=d+i[4],d+=i[4])),C.push(t),"number"==typeof t.originalLine&&_.push(t)}s(C,r.compareByGeneratedPositionsDeflated),this.__generatedMappings=C,s(_,r.compareByOriginalPositions),this.__originalMappings=_},c.prototype._findMapping=function(e,n,t,r,i,a){if(e[t]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[t]);if(e[r]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[r]);return o.search(e,n,i,a)},c.prototype.computeColumnSpans=function(){for(var e=0;e=0){var o=this._generatedMappings[t];if(o.generatedLine===n.generatedLine){var i=r.getArg(o,"source",null);null!==i&&(i=this._sources.at(i),null!=this.sourceRoot&&(i=r.join(this.sourceRoot,i)));var a=r.getArg(o,"name",null);return null!==a&&(a=this._names.at(a)),{source:i,line:r.getArg(o,"originalLine",null),column:r.getArg(o,"originalColumn",null),name:a}}}return{source:null,line:null,column:null,name:null}},c.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return null==e})},c.prototype.sourceContentFor=function(e,n){if(!this.sourcesContent)return null;if(null!=this.sourceRoot&&(e=r.relative(this.sourceRoot,e)),this._sources.has(e))return this.sourcesContent[this._sources.indexOf(e)];var t;if(null!=this.sourceRoot&&(t=r.urlParse(this.sourceRoot))){var o=e.replace(/^file:\/\//,"");if("file"==t.scheme&&this._sources.has(o))return this.sourcesContent[this._sources.indexOf(o)];if((!t.path||"/"==t.path)&&this._sources.has("/"+e))return this.sourcesContent[this._sources.indexOf("/"+e)]}if(n)return null;throw new Error('"'+e+'" is not in the SourceMap.')},c.prototype.generatedPositionFor=function(e){var n=r.getArg(e,"source");if(null!=this.sourceRoot&&(n=r.relative(this.sourceRoot,n)),!this._sources.has(n))return{line:null,column:null,lastColumn:null};var t={source:n=this._sources.indexOf(n),originalLine:r.getArg(e,"line"),originalColumn:r.getArg(e,"column")},o=this._findMapping(t,this._originalMappings,"originalLine","originalColumn",r.compareByOriginalPositions,r.getArg(e,"bias",u.GREATEST_LOWER_BOUND));if(o>=0){var i=this._originalMappings[o];if(i.source===t.source)return{line:r.getArg(i,"generatedLine",null),column:r.getArg(i,"generatedColumn",null),lastColumn:r.getArg(i,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},n.BasicSourceMapConsumer=c,g.prototype=Object.create(u.prototype),g.prototype.constructor=u,g.prototype._version=3,Object.defineProperty(g.prototype,"sources",{get:function(){for(var e=[],n=0;n=0;l--)"."===(a=u[l])?u.splice(l,1):".."===a?c++:c>0&&(""===a?(u.splice(l+1,c),c=0):(u.splice(l,2),c--));return""===(t=u.join("/"))&&(t=s?"/":"."),r?(r.path=t,i(r)):t}n.urlParse=o,n.urlGenerate=i,n.normalize=a,n.join=function(e,n){""===e&&(e="."),""===n&&(n=".");var t=o(n),s=o(e);if(s&&(e=s.path||"/"),t&&!t.scheme)return s&&(t.scheme=s.scheme),i(t);if(t||n.match(r))return n;if(s&&!s.host&&!s.path)return s.host=n,i(s);var u="/"===n.charAt(0)?n:a(e.replace(/\/+$/,"")+"/"+n);return s?(s.path=u,i(s)):u},n.isAbsolute=function(e){return"/"===e.charAt(0)||!!e.match(t)},n.relative=function(e,n){""===e&&(e="."),e=e.replace(/\/$/,"");for(var t=0;0!==n.indexOf(e+"/");){var r=e.lastIndexOf("/");if(r<0)return n;if((e=e.slice(0,r)).match(/^([^\/]+:\/)?\/*$/))return n;++t}return Array(t+1).join("../")+n.substr(e.length+1)};var s=!("__proto__"in Object.create(null));function u(e){return e}function c(e){if(!e)return!1;var n=e.length;if(n<9)return!1;if(95!==e.charCodeAt(n-1)||95!==e.charCodeAt(n-2)||111!==e.charCodeAt(n-3)||116!==e.charCodeAt(n-4)||111!==e.charCodeAt(n-5)||114!==e.charCodeAt(n-6)||112!==e.charCodeAt(n-7)||95!==e.charCodeAt(n-8)||95!==e.charCodeAt(n-9))return!1;for(var t=n-10;t>=0;t--)if(36!==e.charCodeAt(t))return!1;return!0}function l(e,n){return e===n?0:e>n?1:-1}n.toSetString=s?u:function(e){return c(e)?"$"+e:e},n.fromSetString=s?u:function(e){return c(e)?e.slice(1):e},n.compareByOriginalPositions=function(e,n,t){var r=e.source-n.source;return 0!==r?r:0!=(r=e.originalLine-n.originalLine)?r:0!=(r=e.originalColumn-n.originalColumn)||t?r:0!=(r=e.generatedColumn-n.generatedColumn)?r:0!=(r=e.generatedLine-n.generatedLine)?r:e.name-n.name},n.compareByGeneratedPositionsDeflated=function(e,n,t){var r=e.generatedLine-n.generatedLine;return 0!==r?r:0!=(r=e.generatedColumn-n.generatedColumn)||t?r:0!=(r=e.source-n.source)?r:0!=(r=e.originalLine-n.originalLine)?r:0!=(r=e.originalColumn-n.originalColumn)?r:e.name-n.name},n.compareByGeneratedPositionsInflated=function(e,n){var t=e.generatedLine-n.generatedLine;return 0!==t?t:0!=(t=e.generatedColumn-n.generatedColumn)?t:0!==(t=l(e.source,n.source))?t:0!=(t=e.originalLine-n.originalLine)?t:0!=(t=e.originalColumn-n.originalColumn)?t:l(e.name,n.name)}},function(e,n){n.GREATEST_LOWER_BOUND=1,n.LEAST_UPPER_BOUND=2,n.search=function(e,t,r,o){if(0===t.length)return-1;var i=function e(t,r,o,i,a,s){var u=Math.floor((r-t)/2)+t,c=a(o,i[u],!0);return 0===c?u:c>0?r-u>1?e(u,r,o,i,a,s):s==n.LEAST_UPPER_BOUND?r1?e(t,u,o,i,a,s):s==n.LEAST_UPPER_BOUND?u:t<0?-1:t}(-1,t.length,e,t,r,o||n.GREATEST_LOWER_BOUND);if(i<0)return-1;for(;i-1>=0&&0===r(t[i],t[i-1],!0);)--i;return i}},function(e,n,t){var r=t(1),o=Object.prototype.hasOwnProperty;function i(){this._array=[],this._set=Object.create(null)}i.fromArray=function(e,n){for(var t=new i,r=0,o=e.length;r=0&&e>>=5)>0&&(n|=32),o+=r.encode(n)}while(i>0);return o},n.decode=function(e,n,t){var o,i,a,s,u=e.length,c=0,l=0;do{if(n>=u)throw new Error("Expected more digits in base 64 VLQ value.");if(-1===(i=r.decode(e.charCodeAt(n++))))throw new Error("Invalid base64 digit: "+e.charAt(n-1));o=!!(32&i),c+=(i&=31)<>1,1==(1&a)?-s:s),t.rest=n}},function(e,n){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");n.encode=function(e){if(0<=e&&e ".length;e&&r++<5&&!("html"===(n=w(e))||r>1&&o+t.length*i+n.length>=80);)t.push(n),o+=n.length,e=e.parentNode;return t.reverse().join(" > ")}function w(e){var n,t,r,o,i,a=[];if(!e||!e.tagName)return"";if(a.push(e.tagName.toLowerCase()),e.id&&a.push("#"+e.id),(n=e.className)&&_(n))for(t=n.split(/\s+/),i=0;i0?a[0].fileName:null}"type"===o&&(t=n[o]),"inner"===o&&0!==n[o].length&&e(n[o])})}(n),{type:t,source:r}}function E(e,n,t,r){var o=null;return n.forEach(function(e,t){if(e.functionName)var r=e.functionName+" ";else r="";var i=" at "+r+"("+e.fileName+":"+e.lineNumber+":"+e.columnNumber+")";n[t]=i,0===t&&(o=e.fileName||null)}),t?n.unshift("\nCaused by: "+e):n.unshift(e),r?{newFrames:n,fileName:o}:n}function N(e){var n=new a;return new Promise(function(t){t(Promise.all(e.map(function(e){return new Promise(function(t){function r(){t(e)}n.pinpoint(e).then(t,r).catch(r)})})))})}function L(e,n,t){var r=m(e),o=[],a=[];!function e(n){Object.keys(n).forEach(function(t){"error"===t&&0!==y(n[t].stack)&&(o.push(n[t].toString().split("\n")[0]),a.push(N(i.parse(n[t])))),"inner"===t&&0!==n[t].length&&e(n[t])})}(r),Promise.all(a).then(e=>{e.forEach(function(e,n){0===n?t.detail=E(o[n],e,!1).join("\n"):t.detail+=E(o[n],e,!0).join("\n")})}).then(function(){n.send(JSON.stringify(t))})}function A(e){var n=typeof e.error;return n.charAt(0).toUpperCase()+n.slice(1)+": "+e.error+"\n at ("+e.source+":"+e.lineno+":"+e.colno+")"}function M(e,n){var t,r={};if(r.Id=(t=function(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1).toUpperCase()})()+t(),"object"==typeof e){var o=e&&0!==y(e.stack)&&"object"==typeof e?i.parse(e):"";r.Type=e.name,r.Message=e.message,r.StackTrace=0!==y(e.stack)?i.parse(e):null,r.Source=o&&o.length>0?o[0].fileName:null,r.Inners=e.cause&&"object"==typeof e.cause&&e.cause instanceof Error?[M(e.cause)]:[]}else r.Type=typeof n.error,r.Message=n.message,r.StackTrace=A(n),r.Source=n.source,r.Inners=[];return r}function T(e){var n=M(e),t=[];function r(e,n){Object.keys(e).forEach(function(o){"StackTrace"===o&&(n?e[o].then(n=>{var t=E(e.Type+": "+e.Message,n,!1,!0);e[o]=t.newFrames.join("\n"),e.Source=t.fileName||null}):(e[o]=N(e[o]),t.push(e[o]))),"Inners"===o&&0!==e[o].length&&r(e[o][0],n)})}return r(n,!1),new Promise(function(e,o){Promise.all(t).then(function(e){r(n,!0)}).then(function(){e(n)})})}var P=function(e){var t=O({dateTime:(new Date).toISOString()},e),r=10;o.push(t),n.breadcrumbsNumber>=0&&"number"==typeof n.breadcrumbsNumber&&(n.breadcrumbsNumber>25?r=25:n.breadcrumbsNumber<=25&&(r=n.breadcrumbsNumber)),o.length>r&&o.shift()},k=function(e){var n;try{n=C(e.target)}catch(e){n=""}P({severity:"Information",action:"Click",message:n})},x=function(e){var n;try{n=C(e.target)}catch(e){n=""}P({severity:"Information",action:"Form submit",message:n})},j=function(n){var t=null;switch(n.type){case"load":t="Page loaded";break;case"DOMContentLoaded":t="DOMContentLoaded";break;case"pageshow":t="Page shown";break;case"pagehide":t="Page hidden";break;case"popstate":t="Navigated from: "+s+" to: "+e.location.href}P({severity:"Information",action:"Navigation",message:t})},R=function(e){var n=e.oldURL,t=e.newURL,r=null;r=n&&t?"from: '"+S(n)+"' to: '"+S(t)+"'":"to: '"+location.hash+"'",P({severity:"Information",action:"Navigation",message:"Hash changed "+r})},I=function(e,n,a,s){var c=e,f=n,h=s,m=1,d=b(),v=h.error&&0!==y(h.error.stack)&&"object"==typeof h.error?i.parse(h.error):"";if(!h||0!==h.colno||0!==h.lineno||v&&""!==v||!h.message||"Script error."!==h.message&&"Script error"!==h.message){if((null===c||null===f)&&2!==g)return console.log("Login api error");l.hasOwnProperty("apiKey")&&l.hasOwnProperty("logId")&&(c=l.apiKey,f=l.logId);var _=new XMLHttpRequest;_.open("POST","https://api.elmah.io/v3/messages/"+f+"?api_key="+c,!0),_.setRequestHeader("Content-type","application/json"),_.onload=function(e){4===_.readyState&&(201===_.status&&a("success",_.statusText),_.status>=400&&_.status<=499&&(a("error",_.statusText),r.emit("error",_.status,_.statusText)))},_.onerror=function(e){a("error",_.statusText),r.emit("error",_.status,_.statusText)};var C={detail:h.error?h.error.stack:null,title:h.message||"Unspecified error",source:v&&v.length>0?v[0].fileName:null,severity:"Error",type:h.error?h.error.name:null,queryString:JSON.parse(JSON.stringify(d))};if(h.error&&0===y(h.error.stack)&&void 0===C.detail){var S=typeof s.error,E=S.charAt(0).toUpperCase()+S.slice(1);C.detail=A(s),C.source=s.source,C.title="Uncaught "+E+": "+s.error}if(h.error&&h.error.cause&&"object"==typeof h.error.cause&&h.error.cause instanceof Error){var N=w(h.error);C.type=N.type,C.source=N.source}C=O(C,u()),o.length>0&&(C.breadcrumbs=o,o=[]),null!==t.filter&&t.filter(C)&&(m=0),1===m&&(r.emit("message",C),h.error&&"object"==typeof h.error&&0!==y(h.error.stack)&&"undefined"!=typeof Promise&&-1!==Promise.toString().indexOf("[native code]")?T(h.error).then(e=>{C.data.push({key:"X-ELMAHIO-EXCEPTIONINSPECTOR",value:JSON.stringify(e)}),L(h.error,_,C)}):(C.data.push({key:"X-ELMAHIO-EXCEPTIONINSPECTOR",value:JSON.stringify(M(h.error,s))}),_.send(JSON.stringify(C))))}else t.debug&&console.log("%c ⯈ Error log: %c 🛈 Ignoring error from external script ",p.lightCSS,p.warningCSS)},D=function(e,n,a,s,c,p){var f=e,h=n,m=s,d=p,v=c,_=1,C=b();if((null===f||null===h)&&2!==g)return console.log("Login api error");l.hasOwnProperty("apiKey")&&l.hasOwnProperty("logId")&&(f=l.apiKey,h=l.logId);var S=new XMLHttpRequest;if(S.open("POST","https://api.elmah.io/v3/messages/"+h+"?api_key="+f,!0),S.setRequestHeader("Content-type","application/json"),S.onload=function(e){4===S.readyState&&(201===S.status&&a("success",S.statusText),S.status>=400&&S.status<=499&&(a("error",S.statusText),r.emit("error",S.status,S.statusText)))},S.onerror=function(e){a("error",S.statusText),r.emit("error",S.status,S.statusText)},"Log"!==m){var E=d&&d instanceof Error&&0!==y(d.stack)?i.parse(d):null,N={title:v,source:E&&E.length>0?E[0].fileName:null,detail:d?d.stack:null,severity:m,type:d?d.name:null,queryString:JSON.parse(JSON.stringify(C))};if(d&&d.cause&&"object"==typeof d.cause&&d.cause instanceof Error){var A=w(d);N.type=A.type,N.source=A.source}N=O(N,u())}else N=d;if(null!==t.filter&&t.filter(N)&&(_=0),1===_)if(N.title){if(o.length>0){if(N.breadcrumbs&&N.breadcrumbs.length>0){o=o.reverse();for(var M=0;M{N.data.push({key:"X-ELMAHIO-EXCEPTIONINSPECTOR",value:JSON.stringify(e)}),L(d,S,N)}):N.errorObject&&N.errorObject instanceof Error?(d=N.errorObject,delete N.errorObject,T(d).then(e=>{N.data.push({key:"X-ELMAHIO-EXCEPTIONINSPECTOR",value:JSON.stringify(e)}),L(d,S,N)})):(delete N.errorObject,S.send(JSON.stringify(N)))}else a("missing-title",S.statusText)},F=function(e,n,i,a,s){var c=e,p=n,f=s.message,h=s.message,m=a,y=Object.values(s.arguments),_=1,C=b();if("string"!=typeof(f=function(e,n){var t=e;if(n.length>1)if(String(e).match(/%[sdif]/g)){var r=0;t=String(e).replace(/%[sdif]/g,function(e){switch(e){case"%s":return n[++r]?String(n[r]):"%s";case"%d":return n[++r]?d(n[r])||v(n[r])?parseInt(n[r]):"NaN":"%d";case"%i":return n[++r]?d(n[r])||v(n[r])?parseInt(n[r]):"NaN":"%i";case"%f":return n[++r]?d(n[r])||v(n[r])?parseFloat(n[r]):"NaN":"%f";default:return e}});for(var o=n.length,i=n[++r];r=400&&w.status<=499&&(i("error",w.statusText),r.emit("error",w.status,w.statusText)))},w.onerror=function(e){i("error",w.statusText),r.emit("error",w.status,w.statusText)};var S={title:f,titleTemplate:h,detail:function(e,n,t){for(var r=[],o=0;o0&&(S.breadcrumbs=o,o=[]),null!==t.filter&&t.filter(S)&&(_=0),1===_&&(S.title?(r.emit("message",S),w.send(JSON.stringify(S))):i("missing-title",w.statusText))};return r.error=function(e,n){setTimeout(function(){D(t.apiKey,t.logId,c,"Error",e,n)},t.breadcrumbs?100:0)},r.verbose=function(e,n){setTimeout(function(){D(t.apiKey,t.logId,c,"Verbose",e,n)},t.breadcrumbs?100:0)},r.debug=function(e,n){setTimeout(function(){D(t.apiKey,t.logId,c,"Debug",e,n)},t.breadcrumbs?100:0)},r.information=function(e,n){setTimeout(function(){D(t.apiKey,t.logId,c,"Information",e,n)},t.breadcrumbs?100:0)},r.warning=function(e,n){setTimeout(function(){D(t.apiKey,t.logId,c,"Warning",e,n)},t.breadcrumbs?100:0)},r.fatal=function(e,n){setTimeout(function(){D(t.apiKey,t.logId,c,"Fatal",e,n)},t.breadcrumbs?100:0)},r.log=function(e){setTimeout(function(){D(t.apiKey,t.logId,c,"Log",null,e)},t.breadcrumbs?100:0)},r.message=function(e){return function(e){if(!e)return u();var n=e,t=n&&0!==y(n.stack)?i.parse(n):null,r={title:n.message,source:t&&t.length>0?t[0].fileName:null,detail:n?n.stack:null,severity:"Error",type:n?n.name:null,errorObject:n};if(n&&n.cause&&"object"==typeof n.cause&&n.cause instanceof Error){var o=w(n);r.type=o.type,r.source=o.source}return r=O(r,u())}(e)},r.addBreadcrumb=function(e,n,t){P({severity:null!=n&&_(n)?n:"Information",action:null!=t&&_(t)?t:"Log",message:null!=e&&_(e)?e:"This is just a test message."})},r.on=function(e,n,t){var r=this.e||(this.e={});return(r[e]||(r[e]=[])).push({fn:n,ctx:t}),this},r.emit=function(e){for(var n=[].slice.call(arguments,1),t=((this.e||(this.e={}))[e]||[]).slice(),r=0,o=t.length;r0&&r<400?o="Information":r>399&&r<500?o="Warning":r>=500&&(o="Error"),P({severity:o,action:"Request",message:"["+n+"] "+t+(r>0?" ("+r+")":"")}))}(t,e,n)},!1),o.apply(this,arguments)}}}if(e.onerror=function(e,n,r,o,i){var a={message:e,source:n,lineno:r,colno:o,error:i};return setTimeout(function(){I(t.apiKey,t.logId,c,a)},t.breadcrumbs?100:0),!1},e.onunhandledrejection=function(e){var n={message:e.reason.message,error:e.reason.message&&e.reason.stack?e.reason:void 0};return setTimeout(function(){I(t.apiKey,t.logId,c,n)},t.breadcrumbs?100:0),!1},n&&"none"!==n.captureConsoleMinimumLevel){if("info"===n.captureConsoleMinimumLevel||"warn"===n.captureConsoleMinimumLevel||"error"===n.captureConsoleMinimumLevel||"debug"===n.captureConsoleMinimumLevel){var i=console.error;if(console.error=function(e){var n={message:e,arguments:arguments};setTimeout(function(){F(t.apiKey,t.logId,c,"Error",n)},t.breadcrumbs?100:0),i.apply(console,arguments)},"error"!==n.captureConsoleMinimumLevel){var a=console.warn;console.warn=function(e){var n={message:e,arguments:arguments};setTimeout(function(){F(t.apiKey,t.logId,c,"Warning",n)},t.breadcrumbs?100:0),a.apply(console,arguments)}}}if("info"===n.captureConsoleMinimumLevel||"debug"===n.captureConsoleMinimumLevel){var s=console.info;console.info=function(e){var n={message:e,arguments:arguments};setTimeout(function(){F(t.apiKey,t.logId,c,"Information",n)},t.breadcrumbs?100:0),s.apply(console,arguments)}}if("debug"===n.captureConsoleMinimumLevel){var u=console.debug;console.debug=function(e){var n={message:e,arguments:arguments};setTimeout(function(){F(t.apiKey,t.logId,c,"Debug",n)},t.breadcrumbs?100:0),u.apply(console,arguments)}}}},r.init(n),t.debug&&console.log("%c"+p.label,p.labelCSS),r};return g&&l.hasOwnProperty("apiKey")&&l.hasOwnProperty("logId")?new E:E}); //# sourceMappingURL=elmahio.min.js.map diff --git a/dist/elmahio.min.js.map b/dist/elmahio.min.js.map index 7f8f34d..5c1659e 100644 --- a/dist/elmahio.min.js.map +++ b/dist/elmahio.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["elmahio.js"],"names":["root","factory","define","amd","exports","module","Elmahio","global","window","this","FIREFOX_SAFARI_STACK_REGEXP","CHROME_IE_STACK_REGEXP","SAFARI_NATIVE_CODE_REGEXP","StackFrame","_isNumber","n","isNaN","parseFloat","isFinite","_capitalize","str","charAt","toUpperCase","substring","_getter","p","booleanProps","numericProps","stringProps","props","concat","obj","Object","i","length","hasOwnProperty","undefined","prototype","getArgs","args","setArgs","v","toString","call","TypeError","getEvalOrigin","evalOrigin","setEvalOrigin","getFunctionName","join","getFileName","getLineNumber","getColumnNumber","fromString","argsStartIndex","indexOf","argsEndIndex","lastIndexOf","functionName","split","locationString","parts","exec","fileName","lineNumber","columnNumber","Boolean","j","Number","k","String","ErrorStackParser","parse","error","stacktrace","parseOpera","stack","match","parseV8OrIE","parseFFOrSafari","Error","extractLocation","urlLike","replace","filter","line","map","tokens","slice","locationParts","pop","source","functionNameRegex","matches","e","message","parseOpera9","parseOpera11","parseOpera10","lineRE","lines","result","len","push","argsRaw","functionCall","shift","StackTraceGPS","SourceMap","_xdr","url","Promise","resolve","reject","req","XMLHttpRequest","open","onerror","onreadystatechange","readyState","status","substr","responseText","send","_atob","b64str","atob","_ensureStackFrameIsLegit","stackframe","opts","sourceCache","sourceMapConsumerCache","ajax","_get","location","isDataUrl","offline","sourceMapStart","encodedSource","xhrPromise","method","then","bind","_getSourceMapConsumer","sourceMappingURL","defaultSourceRoot","sourceMapConsumerPromise","sourceMapSource","string","JSON","_parseJson","sourceRoot","SourceMapConsumer","pinpoint","getMappedLocation","mappedStackFrame","resolveMappedStackFrame","findFunctionName","guessedFunctionName","syntaxes","code","maxLines","Math","min","commentPos","index","m","_findFunctionName","defineProperty","create","_ensureSupportedEnvironment","lastSourceMappingUrl","matchSourceMappingUrl","sourceMappingUrlRegExp","_findSourceMappingURL","test","sourceMapConsumer","loc","originalPositionFor","column","mappedSource","sourceContentFor","name","_extractLocationInfoFromSourceMapSource","r","t","o","id","loaded","c","ArraySet","a","s","quickSort","u","sections","l","getArg","g","_version","normalize","isAbsolute","relative","_names","fromArray","_sources","sourcesContent","_mappings","file","generatedLine","generatedColumn","originalLine","originalColumn","_sections","generatedOffset","consumer","fromSourceMap","__generatedMappings","get","_parseMappings","__originalMappings","_charIsMappingSeparator","GENERATED_ORDER","ORIGINAL_ORDER","GREATEST_LOWER_BOUND","LEAST_UPPER_BOUND","eachMapping","_generatedMappings","_originalMappings","at","forEach","allGeneratedPositionsFor","has","_findMapping","compareByOriginalPositions","lastColumn","toArray","_sourceRoot","_generateSourcesContent","_file","h","f","d","_","C","A","y","L","decode","value","rest","compareByGeneratedPositionsDeflated","search","computeColumnSpans","lastGeneratedColumn","hasContentsOfAllSources","size","some","urlParse","scheme","path","generatedPositionFor","BasicSourceMapConsumer","constructor","sources","bias","every","add","IndexedSourceMapConsumer","arguments","auth","host","port","splice","urlGenerate","Array","charCodeAt","toSetString","fromSetString","compareByGeneratedPositionsInflated","floor","_array","_set","getOwnPropertyNames","encode","round","random","myScript","scriptFile","document","getElementsByTagName","isMe","params","query","Params","Pairs","KeyVal","key","unescape","val","parseQuery","src","paramsLength","objectLength","debugSettings","label","labelCSS","successCSS","errorCSS","warningCSS","lightCSS","defaults","apiKey","logId","debug","application","captureConsoleMinimumLevel","breadcrumbs","breadcrumbsNumber","extend","extended","deep","merge","prop","scriptElem","getAttribute","isInt","isFloat","getSearchParameters","prmstr","prmarr","tmparr","transformToAssocArray","merge_objects","obj1","obj2","obj3","attrname1","attrname2","isString","what","cssSelectorString","elem","nextStr","out","height","sepLength","htmlElementAsString","parentNode","reverse","className","classes","attr","tagName","toLowerCase","attrWhitelist","parseHash","Constructor","options","settings","publicAPIs","lastHref","href","getPayload","payload","pathname","payload_data","documentMode","innerWidth","documentElement","clientWidth","innerHeight","clientHeight","screen","msOrientation","orientation","mozOrientation","type","width","colorDepth","data","payload_serverVariables","navigator","language","userAgent","referrer","protocol","hostname","serverVariables","confirmResponse","response","console","log","Date","toLocaleString","stackGPS","xhr","jsonData","errorStack","gps","stackframes","all","sf","resolveOriginal","newFrames","stackFrame","fn","stackString","unshift","detail","stringify","recordBreadcrumb","crumb","dateTime","toISOString","breadcrumbs_number","breadcrumbClickEventHandler","evt","target","severity","action","breadcrumbFormSubmitEventHandler","breadcrumbWindowEventHandler","breadcrumbHashChangeEventHandler","oldURL","newURL","hash","sendManualPayload","callback","logType","messageLog","errorLog","api_key","log_id","queryParams","setRequestHeader","onload","statusText","emit","title","queryString","errorObject","sendPayloadFromConsole","messageTemplate","values","x","parseInt","format","titleTemplate","manipulateStack","msg","setTimeout","verbose","information","warning","fatal","sendPrefilledLogMessage","addBreadcrumb","on","ctx","evtArr","apply","init","addEventListener","attachEvent","history","pushState","replaceState","old_onpopstate","onpopstate","event","breadcrumbXHRHandler","lineno","colno","typeOF","typeOFCapitalized","sendPayload","_error","errMessage","_warning","warn","warnMessage","_info","info","infoMessage","_debug","debugMessage"],"mappings":";;;;CAIA,SAAUA,EAAMC,GACQ,mBAAXC,QAAyBA,OAAOC,IACzCD,OAAO,GAAI,WACT,OAAOD,EAAQD,KAEW,iBAAZI,QAChBC,OAAOD,QAAUH,EAAQD,GAEzBA,EAAKM,QAAUL,EAAQD,GAR3B,CAUqB,oBAAXO,OAAyBA,OAA2B,oBAAXC,OAAyBA,OAASC,KAAM,SAASD,GAClG,aAi+BA,IAh+BA,IAiHME,EACAC,EACAC,EAnHFC,EAAa,WAGf,SAASC,EAAUC,GACjB,OAAQC,MAAMC,WAAWF,KAAOG,SAASH,GAG3C,SAASI,EAAYC,GACnB,OAAOA,EAAIC,OAAO,GAAGC,cAAgBF,EAAIG,UAAU,GAGrD,SAASC,EAAQC,GACf,OAAO,WACL,OAAOhB,KAAKgB,IAGhB,IAAIC,EAAe,CAAC,gBAAiB,SAAU,WAAY,cACvDC,EAAe,CAAC,eAAgB,cAChCC,EAAc,CAAC,WAAY,eAAgB,UAE3CC,EAAQH,EAAaI,OAAOH,EAAcC,EAD7B,CAAC,SAGlB,SAASf,EAAWkB,GAClB,GAAIA,aAAeC,OACjB,IAAK,IAAIC,EAAI,EAAGA,EAAIJ,EAAMK,OAAQD,IAC5BF,EAAII,eAAeN,EAAMI,UAAyBG,IAAlBL,EAAIF,EAAMI,KAC5CxB,KAAK,MAAQU,EAAYU,EAAMI,KAAKF,EAAIF,EAAMI,KAKtDpB,EAAWwB,UAAY,CACrBC,QAAS,WACP,OAAO7B,KAAK8B,MAEdC,QAAS,SAASC,GAChB,GAA0C,mBAAtCT,OAAOK,UAAUK,SAASC,KAAKF,GACjC,MAAM,IAAIG,UAAU,yBAEtBnC,KAAK8B,KAAOE,GAEdI,cAAe,WACb,OAAOpC,KAAKqC,YAEdC,cAAe,SAASN,GACtB,GAAIA,aAAa5B,EACfJ,KAAKqC,WAAaL,MACb,CAAA,KAAIA,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ASC,GACtB,IAAIrD,EAAW,CACbhV,QAAWqY,EACXvN,UAAaA,WAEfsL,WAAW,WACTT,EAAuBnF,EAAS/C,OAAQ+C,EAAS9C,MAAO4E,EAAiB,cAAe0C,IACvFxE,EAAS1C,YAvzBC,IAuzBgC,GAC7CqK,EAAMrB,MAAMtE,QAAS1H,YAGzB,GAA2C,UAAvCyF,EAAQ1C,2BAAwC,CAClD,IAAIyK,EAAS9F,QAAQ7E,MACrB6E,QAAQ7E,MAAQ,SAAS4K,GACvB,IAAIvD,EAAW,CACbhV,QAAWuY,EACXzN,UAAaA,WAEfsL,WAAW,WACTT,EAAuBnF,EAAS/C,OAAQ+C,EAAS9C,MAAO4E,EAAiB,QAAS0C,IACjFxE,EAAS1C,YAp0BC,IAo0BgC,GAC7CwK,EAAOxB,MAAMtE,QAAS1H,eAK9B2F,EAAWsG,KAAKxG,GACZC,EAAS7C,OACX6E,QAAQC,IAAI,KAAOxF,EAAcC,MAAOD,EAAcE,UAEjDsD,GAET,OAAI1D,GAAgBV,EAAOjQ,eAAe,WAAaiQ,EAAOjQ,eAAe,SACpE,IAAIkU,EAEJA","sourcesContent":["/*!\n * elmah.io Javascript Logger - version 3.7.1\n * (c) 2018 elmah.io, Apache 2.0 License, https://elmah.io\n */\n\n(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define([], function () {\n return factory(root);\n });\n } else if (typeof exports === 'object') {\n module.exports = factory(root);\n } else {\n root.Elmahio = factory(root);\n }\n})(typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : this, function (window) {\n\n 'use strict';\n\n //\n // ==== STACKFRAME ====\n //\n\n var StackFrame = (function () {\n \"use strict\";\n function _isNumber(n) {\n return !isNaN(parseFloat(n)) && isFinite(n);\n }\n function _capitalize(str) {\n return str.charAt(0).toUpperCase() + str.substring(1);\n }\n function _getter(p) {\n return function () {\n return this[p];\n };\n }\n var booleanProps = [\"isConstructor\", \"isEval\", \"isNative\", \"isToplevel\"];\n var numericProps = [\"columnNumber\", \"lineNumber\"];\n var stringProps = [\"fileName\", \"functionName\", \"source\"];\n var arrayProps = [\"args\"];\n var props = booleanProps.concat(numericProps, stringProps, arrayProps);\n function StackFrame(obj) {\n if (obj instanceof Object) {\n for (var i = 0; i < props.length; i++) {\n if (obj.hasOwnProperty(props[i]) && obj[props[i]] !== undefined) {\n this[\"set\" + _capitalize(props[i])](obj[props[i]]);\n }\n }\n }\n }\n StackFrame.prototype = {\n getArgs: function () {\n return this.args;\n },\n setArgs: function (v) {\n if (Object.prototype.toString.call(v) !== \"[object Array]\") {\n throw new TypeError(\"Args must be an Array\");\n }\n this.args = v;\n },\n getEvalOrigin: function () {\n return this.evalOrigin;\n },\n setEvalOrigin: function (v) {\n if (v instanceof StackFrame) {\n this.evalOrigin = v;\n } else if (v instanceof Object) {\n this.evalOrigin = new StackFrame(v);\n } else {\n throw new TypeError(\"Eval Origin must be an Object or StackFrame\");\n }\n },\n toString: function () {\n var functionName = this.getFunctionName() || \"{anonymous}\";\n var args = \"(\" + (this.getArgs() || []).join(\",\") + \")\";\n var fileName = this.getFileName() ? \"@\" + this.getFileName() : \"\";\n var lineNumber = _isNumber(this.getLineNumber()) ? \":\" + this.getLineNumber() : \"\";\n var columnNumber = _isNumber(this.getColumnNumber()) ? \":\" + this.getColumnNumber() : \"\";\n return functionName + args + fileName + lineNumber + columnNumber;\n }\n };\n StackFrame.fromString = function StackFrame$$fromString(str) {\n var argsStartIndex = str.indexOf(\"(\");\n var argsEndIndex = str.lastIndexOf(\")\");\n var functionName = str.substring(0, argsStartIndex);\n var args = str.substring(argsStartIndex + 1, argsEndIndex).split(\",\");\n var locationString = str.substring(argsEndIndex + 1);\n if (locationString.indexOf(\"@\") === 0) {\n var parts = /@(.+?)(?::(\\d+))?(?::(\\d+))?$/.exec(locationString, \"\");\n var fileName = parts[1];\n var lineNumber = parts[2];\n var columnNumber = parts[3];\n }\n return new StackFrame({\n functionName: functionName,\n args: args || undefined,\n fileName: fileName,\n lineNumber: lineNumber || undefined,\n columnNumber: columnNumber || undefined\n });\n };\n for (var i = 0; i < booleanProps.length; i++) {\n StackFrame.prototype[\"get\" + _capitalize(booleanProps[i])] = _getter(booleanProps[i]);\n StackFrame.prototype[\"set\" + _capitalize(booleanProps[i])] = function (p) {\n return function (v) {\n this[p] = Boolean(v);\n };\n }(booleanProps[i]);\n }\n for (var j = 0; j < numericProps.length; j++) {\n StackFrame.prototype[\"get\" + _capitalize(numericProps[j])] = _getter(numericProps[j]);\n StackFrame.prototype[\"set\" + _capitalize(numericProps[j])] = function (p) {\n return function (v) {\n if (!_isNumber(v)) {\n throw new TypeError(p + \" must be a Number\");\n }\n this[p] = Number(v);\n };\n }(numericProps[j]);\n }\n for (var k = 0; k < stringProps.length; k++) {\n StackFrame.prototype[\"get\" + _capitalize(stringProps[k])] = _getter(stringProps[k]);\n StackFrame.prototype[\"set\" + _capitalize(stringProps[k])] = function (p) {\n return function (v) {\n this[p] = String(v);\n };\n }(stringProps[k]);\n }\n return StackFrame;\n })();\n\n //\n // ==== ERROR STACK PARSER ====\n //\n\n var ErrorStackParser = (function () {\n \"use strict\";\n var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\\S+\\:\\d+/;\n var CHROME_IE_STACK_REGEXP = /^\\s*at .*(\\S+\\:\\d+|\\(native\\))/m;\n var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\\[native code\\])?$/;\n return {\n /**\n * Given an Error object, extract the most information from it.\n *\n * @param {Error} error object\n * @return {Array} of StackFrames\n */\n parse: function ErrorStackParser$$parse(error) {\n if (typeof error.stacktrace !== \"undefined\" || typeof error[\"opera#sourceloc\"] !== \"undefined\") {\n return this.parseOpera(error);\n } else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {\n return this.parseV8OrIE(error);\n } else if (error.stack) {\n return this.parseFFOrSafari(error);\n } else {\n throw new Error(\"Cannot parse given Error object\");\n }\n },\n // Separate line and column numbers from a string of the form: (URI:Line:Column)\n extractLocation: function ErrorStackParser$$extractLocation(urlLike) {\n // Fail-fast but return locations like \"(native)\"\n if (urlLike.indexOf(\":\") === -1) {\n return [urlLike];\n }\n var regExp = /(.+?)(?:\\:(\\d+))?(?:\\:(\\d+))?$/;\n var parts = regExp.exec(urlLike.replace(/[\\(\\)]/g, \"\"));\n return [parts[1], parts[2] || undefined, parts[3] || undefined];\n },\n parseV8OrIE: function ErrorStackParser$$parseV8OrIE(error) {\n var filtered = error.stack.split(\"\\n\").filter(function (line) {\n return !!line.match(CHROME_IE_STACK_REGEXP);\n }, this);\n return filtered.map(function (line) {\n if (line.indexOf(\"(eval \") > -1) {\n // Throw away eval information until we implement stacktrace.js/stackframe#8\n line = line.replace(/eval code/g, \"eval\").replace(/(\\(eval at [^\\()]*)|(\\)\\,.*$)/g, \"\");\n }\n var tokens = line.replace(/^\\s+/, \"\").replace(/\\(eval code/g, \"(\").split(/\\s+/).slice(1);\n var locationParts = this.extractLocation(tokens.pop());\n var functionName = tokens.join(\" \") || undefined;\n var fileName = [\"eval\", \"\"].indexOf(locationParts[0]) > -1 ? undefined : locationParts[0];\n return new StackFrame({\n functionName: functionName,\n fileName: fileName,\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n source: line\n });\n }, this);\n },\n parseFFOrSafari: function ErrorStackParser$$parseFFOrSafari(error) {\n var filtered = error.stack.split(\"\\n\").filter(function (line) {\n return !line.match(SAFARI_NATIVE_CODE_REGEXP);\n }, this);\n return filtered.map(function (line) {\n // Throw away eval information until we implement stacktrace.js/stackframe#8\n if (line.indexOf(\" > eval\") > -1) {\n line = line.replace(/ line (\\d+)(?: > eval line \\d+)* > eval\\:\\d+\\:\\d+/g, \":$1\");\n }\n if (line.indexOf(\"@\") === -1 && line.indexOf(\":\") === -1) {\n // Safari eval frames only have function names and nothing else\n return new StackFrame({\n functionName: line\n });\n } else {\n var functionNameRegex = /((.*\".+\"[^@]*)?[^@]*)(?:@)/;\n var matches = line.match(functionNameRegex);\n var functionName = matches && matches[1] ? matches[1] : undefined;\n var locationParts = this.extractLocation(line.replace(functionNameRegex, \"\"));\n return new StackFrame({\n functionName: functionName,\n fileName: locationParts[0],\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n source: line\n });\n }\n }, this);\n },\n parseOpera: function ErrorStackParser$$parseOpera(e) {\n if (!e.stacktrace || e.message.indexOf(\"\\n\") > -1 && e.message.split(\"\\n\").length > e.stacktrace.split(\"\\n\").length) {\n return this.parseOpera9(e);\n } else if (!e.stack) {\n return this.parseOpera10(e);\n } else {\n return this.parseOpera11(e);\n }\n },\n parseOpera9: function ErrorStackParser$$parseOpera9(e) {\n var lineRE = /Line (\\d+).*script (?:in )?(\\S+)/i;\n var lines = e.message.split(\"\\n\");\n var result = [];\n for (var i = 2, len = lines.length; i < len; i += 2) {\n var match = lineRE.exec(lines[i]);\n if (match) {\n result.push(new StackFrame({\n fileName: match[2],\n lineNumber: match[1],\n source: lines[i]\n }));\n }\n }\n return result;\n },\n parseOpera10: function ErrorStackParser$$parseOpera10(e) {\n var lineRE = /Line (\\d+).*script (?:in )?(\\S+)(?:: In function (\\S+))?$/i;\n var lines = e.stacktrace.split(\"\\n\");\n var result = [];\n for (var i = 0, len = lines.length; i < len; i += 2) {\n var match = lineRE.exec(lines[i]);\n if (match) {\n result.push(new StackFrame({\n functionName: match[3] || undefined,\n fileName: match[2],\n lineNumber: match[1],\n source: lines[i]\n }));\n }\n }\n return result;\n },\n // Opera 10.65+ Error.stack very similar to FF/Safari\n parseOpera11: function ErrorStackParser$$parseOpera11(error) {\n var filtered = error.stack.split(\"\\n\").filter(function (line) {\n return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) && !line.match(/^Error created at/);\n }, this);\n return filtered.map(function (line) {\n var tokens = line.split(\"@\");\n var locationParts = this.extractLocation(tokens.pop());\n var functionCall = tokens.shift() || \"\";\n var functionName = functionCall.replace(//, \"$2\").replace(/\\([^\\)]*\\)/g, \"\") || undefined;\n var argsRaw;\n if (functionCall.match(/\\(([^\\)]*)\\)/)) {\n argsRaw = functionCall.replace(/^[^\\(]+\\(([^\\)]*)\\)$/, \"$1\");\n }\n var args = argsRaw === undefined || argsRaw === \"[arguments not available]\" ? undefined : argsRaw.split(\",\");\n return new StackFrame({\n functionName: functionName,\n args: args,\n fileName: locationParts[0],\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n source: line\n });\n }, this);\n }\n };\n })();\n\n //\n // ==== STACKTRACE-GPS ====\n //\n\n var SourceMap = function(e){var n={};function r(t){if(n[t])return n[t].exports;var o=n[t]={exports:{},id:t,loaded:!1};return e[t].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}return r.m=e,r.c=n,r.p=\"\",r(0)}([function(e,n,r){var t=r(1),o=r(2),i=r(3).ArraySet,a=r(4),s=r(6).quickSort;function u(e){var n=e;return\"string\"==typeof e&&(n=JSON.parse(e.replace(/^\\)\\]\\}'/,\"\"))),null!=n.sections?new c(n):new l(n)}function l(e){var n=e;\"string\"==typeof e&&(n=JSON.parse(e.replace(/^\\)\\]\\}'/,\"\")));var r=t.getArg(n,\"version\"),o=t.getArg(n,\"sources\"),a=t.getArg(n,\"names\",[]),s=t.getArg(n,\"sourceRoot\",null),u=t.getArg(n,\"sourcesContent\",null),l=t.getArg(n,\"mappings\"),g=t.getArg(n,\"file\",null);if(r!=this._version)throw new Error(\"Unsupported version: \"+r);o=o.map(String).map(t.normalize).map(function(e){return s&&t.isAbsolute(s)&&t.isAbsolute(e)?t.relative(s,e):e}),this._names=i.fromArray(a.map(String),!0),this._sources=i.fromArray(o,!0),this.sourceRoot=s,this.sourcesContent=u,this._mappings=l,this.file=g}function g(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}function c(e){var n=e;\"string\"==typeof e&&(n=JSON.parse(e.replace(/^\\)\\]\\}'/,\"\")));var r=t.getArg(n,\"version\"),o=t.getArg(n,\"sections\");if(r!=this._version)throw new Error(\"Unsupported version: \"+r);this._sources=new i,this._names=new i;var a={line:-1,column:0};this._sections=o.map(function(e){if(e.url)throw new Error(\"Support for url field in sections not implemented.\");var n=t.getArg(e,\"offset\"),r=t.getArg(n,\"line\"),o=t.getArg(n,\"column\");if(r=0){var s=this._originalMappings[a];if(void 0===e.column)for(var u=s.originalLine;s&&s.originalLine===u;)i.push({line:t.getArg(s,\"generatedLine\",null),column:t.getArg(s,\"generatedColumn\",null),lastColumn:t.getArg(s,\"lastGeneratedColumn\",null)}),s=this._originalMappings[++a];else for(var l=s.originalColumn;s&&s.originalLine===n&&s.originalColumn==l;)i.push({line:t.getArg(s,\"generatedLine\",null),column:t.getArg(s,\"generatedColumn\",null),lastColumn:t.getArg(s,\"lastGeneratedColumn\",null)}),s=this._originalMappings[++a]}return i},n.SourceMapConsumer=u,l.prototype=Object.create(u.prototype),l.prototype.consumer=u,l.fromSourceMap=function(e){var n=Object.create(l.prototype),r=n._names=i.fromArray(e._names.toArray(),!0),o=n._sources=i.fromArray(e._sources.toArray(),!0);n.sourceRoot=e._sourceRoot,n.sourcesContent=e._generateSourcesContent(n._sources.toArray(),n.sourceRoot),n.file=e._file;for(var a=e._mappings.toArray().slice(),u=n.__generatedMappings=[],c=n.__originalMappings=[],p=0,h=a.length;p1&&(r.source=d+i[1],d+=i[1],r.originalLine=h+i[2],h=r.originalLine,r.originalLine+=1,r.originalColumn=f+i[3],f=r.originalColumn,i.length>4&&(r.name=m+i[4],m+=i[4])),L.push(r),\"number\"==typeof r.originalLine&&y.push(r)}s(L,t.compareByGeneratedPositionsDeflated),this.__generatedMappings=L,s(y,t.compareByOriginalPositions),this.__originalMappings=y},l.prototype._findMapping=function(e,n,r,t,i,a){if(e[r]<=0)throw new TypeError(\"Line must be greater than or equal to 1, got \"+e[r]);if(e[t]<0)throw new TypeError(\"Column must be greater than or equal to 0, got \"+e[t]);return o.search(e,n,i,a)},l.prototype.computeColumnSpans=function(){for(var e=0;e=0){var o=this._generatedMappings[r];if(o.generatedLine===n.generatedLine){var i=t.getArg(o,\"source\",null);null!==i&&(i=this._sources.at(i),null!=this.sourceRoot&&(i=t.join(this.sourceRoot,i)));var a=t.getArg(o,\"name\",null);return null!==a&&(a=this._names.at(a)),{source:i,line:t.getArg(o,\"originalLine\",null),column:t.getArg(o,\"originalColumn\",null),name:a}}}return{source:null,line:null,column:null,name:null}},l.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&(this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return null==e}))},l.prototype.sourceContentFor=function(e,n){if(!this.sourcesContent)return null;if(null!=this.sourceRoot&&(e=t.relative(this.sourceRoot,e)),this._sources.has(e))return this.sourcesContent[this._sources.indexOf(e)];var r;if(null!=this.sourceRoot&&(r=t.urlParse(this.sourceRoot))){var o=e.replace(/^file:\\/\\//,\"\");if(\"file\"==r.scheme&&this._sources.has(o))return this.sourcesContent[this._sources.indexOf(o)];if((!r.path||\"/\"==r.path)&&this._sources.has(\"/\"+e))return this.sourcesContent[this._sources.indexOf(\"/\"+e)]}if(n)return null;throw new Error('\"'+e+'\" is not in the SourceMap.')},l.prototype.generatedPositionFor=function(e){var n=t.getArg(e,\"source\");if(null!=this.sourceRoot&&(n=t.relative(this.sourceRoot,n)),!this._sources.has(n))return{line:null,column:null,lastColumn:null};var r={source:n=this._sources.indexOf(n),originalLine:t.getArg(e,\"line\"),originalColumn:t.getArg(e,\"column\")},o=this._findMapping(r,this._originalMappings,\"originalLine\",\"originalColumn\",t.compareByOriginalPositions,t.getArg(e,\"bias\",u.GREATEST_LOWER_BOUND));if(o>=0){var i=this._originalMappings[o];if(i.source===r.source)return{line:t.getArg(i,\"generatedLine\",null),column:t.getArg(i,\"generatedColumn\",null),lastColumn:t.getArg(i,\"lastGeneratedColumn\",null)}}return{line:null,column:null,lastColumn:null}},n.BasicSourceMapConsumer=l,c.prototype=Object.create(u.prototype),c.prototype.constructor=u,c.prototype._version=3,Object.defineProperty(c.prototype,\"sources\",{get:function(){for(var e=[],n=0;n=0;g--)\".\"===(a=u[g])?u.splice(g,1):\"..\"===a?l++:l>0&&(\"\"===a?(u.splice(g+1,l),l=0):(u.splice(g,2),l--));return\"\"===(r=u.join(\"/\"))&&(r=s?\"/\":\".\"),t?(t.path=r,i(t)):r}n.urlParse=o,n.urlGenerate=i,n.normalize=a,n.join=function(e,n){\"\"===e&&(e=\".\"),\"\"===n&&(n=\".\");var r=o(n),s=o(e);if(s&&(e=s.path||\"/\"),r&&!r.scheme)return s&&(r.scheme=s.scheme),i(r);if(r||n.match(t))return n;if(s&&!s.host&&!s.path)return s.host=n,i(s);var u=\"/\"===n.charAt(0)?n:a(e.replace(/\\/+$/,\"\")+\"/\"+n);return s?(s.path=u,i(s)):u},n.isAbsolute=function(e){return\"/\"===e.charAt(0)||!!e.match(r)},n.relative=function(e,n){\"\"===e&&(e=\".\"),e=e.replace(/\\/$/,\"\");for(var r=0;0!==n.indexOf(e+\"/\");){var t=e.lastIndexOf(\"/\");if(t<0)return n;if((e=e.slice(0,t)).match(/^([^\\/]+:\\/)?\\/*$/))return n;++r}return Array(r+1).join(\"../\")+n.substr(e.length+1)};var s=!(\"__proto__\"in Object.create(null));function u(e){return e}function l(e){if(!e)return!1;var n=e.length;if(n<9)return!1;if(95!==e.charCodeAt(n-1)||95!==e.charCodeAt(n-2)||111!==e.charCodeAt(n-3)||116!==e.charCodeAt(n-4)||111!==e.charCodeAt(n-5)||114!==e.charCodeAt(n-6)||112!==e.charCodeAt(n-7)||95!==e.charCodeAt(n-8)||95!==e.charCodeAt(n-9))return!1;for(var r=n-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function g(e,n){return e===n?0:e>n?1:-1}n.toSetString=s?u:function(e){return l(e)?\"$\"+e:e},n.fromSetString=s?u:function(e){return l(e)?e.slice(1):e},n.compareByOriginalPositions=function(e,n,r){var t=e.source-n.source;return 0!==t?t:0!=(t=e.originalLine-n.originalLine)?t:0!=(t=e.originalColumn-n.originalColumn)||r?t:0!=(t=e.generatedColumn-n.generatedColumn)?t:0!=(t=e.generatedLine-n.generatedLine)?t:e.name-n.name},n.compareByGeneratedPositionsDeflated=function(e,n,r){var t=e.generatedLine-n.generatedLine;return 0!==t?t:0!=(t=e.generatedColumn-n.generatedColumn)||r?t:0!=(t=e.source-n.source)?t:0!=(t=e.originalLine-n.originalLine)?t:0!=(t=e.originalColumn-n.originalColumn)?t:e.name-n.name},n.compareByGeneratedPositionsInflated=function(e,n){var r=e.generatedLine-n.generatedLine;return 0!==r?r:0!=(r=e.generatedColumn-n.generatedColumn)?r:0!==(r=g(e.source,n.source))?r:0!=(r=e.originalLine-n.originalLine)?r:0!=(r=e.originalColumn-n.originalColumn)?r:g(e.name,n.name)}},function(e,n){n.GREATEST_LOWER_BOUND=1,n.LEAST_UPPER_BOUND=2,n.search=function(e,r,t,o){if(0===r.length)return-1;var i=function e(r,t,o,i,a,s){var u=Math.floor((t-r)/2)+r,l=a(o,i[u],!0);return 0===l?u:l>0?t-u>1?e(u,t,o,i,a,s):s==n.LEAST_UPPER_BOUND?t1?e(r,u,o,i,a,s):s==n.LEAST_UPPER_BOUND?u:r<0?-1:r}(-1,r.length,e,r,t,o||n.GREATEST_LOWER_BOUND);if(i<0)return-1;for(;i-1>=0&&0===t(r[i],r[i-1],!0);)--i;return i}},function(e,n,r){var t=r(1),o=Object.prototype.hasOwnProperty;function i(){this._array=[],this._set=Object.create(null)}i.fromArray=function(e,n){for(var r=new i,t=0,o=e.length;t=0&&e>>=5)>0&&(n|=32),o+=t.encode(n)}while(i>0);return o},n.decode=function(e,n,r){var o,i,a,s,u=e.length,l=0,g=0;do{if(n>=u)throw new Error(\"Expected more digits in base 64 VLQ value.\");if(-1===(i=t.decode(e.charCodeAt(n++))))throw new Error(\"Invalid base64 digit: \"+e.charAt(n-1));o=!!(32&i),l+=(i&=31)<>1,1==(1&a)?-s:s),r.rest=n}},function(e,n){var r=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\".split(\"\");n.encode=function(e){if(0<=e&&e= 200 && req.status < 300 || url.substr(0, 7) === \"file://\" && req.responseText) {\n resolve(req.responseText);\n } else {\n reject(new Error(\"HTTP status: \" + req.status + \" retrieving \" + url));\n }\n }\n };\n req.send();\n });\n }\n /**\n * Convert a Base64-encoded string into its original representation.\n * Used for inline sourcemaps.\n *\n * @param {String} b64str Base-64 encoded string\n * @returns {String} original representation of the base64-encoded string.\n */\n function _atob(b64str) {\n if (typeof window !== \"undefined\" && window.atob) {\n return window.atob(b64str);\n } else {\n throw new Error(\"You must supply a polyfill for window.atob in this environment\");\n }\n }\n function _parseJson(string) {\n if (typeof JSON !== \"undefined\" && JSON.parse) {\n return JSON.parse(string);\n } else {\n throw new Error(\"You must supply a polyfill for JSON.parse in this environment\");\n }\n }\n function _findFunctionName(source, lineNumber) {\n var syntaxes = [ // {name} = function ({args}) TODO args capture\n /['\"]?([$_A-Za-z][$_A-Za-z0-9]*)['\"]?\\s*[:=]\\s*function\\b/, // function {name}({args}) m[1]=name m[2]=args\n /function\\s+([^('\"`]*?)\\s*\\(([^)]*)\\)/, // {name} = eval()\n /['\"]?([$_A-Za-z][$_A-Za-z0-9]*)['\"]?\\s*[:=]\\s*(?:eval|new Function)\\b/, // fn_name() {\n /\\b(?!(?:if|for|switch|while|with|catch)\\b)(?:(?:static)\\s+)?(\\S+)\\s*\\(.*?\\)\\s*\\{/, // {name} = () => {\n /['\"]?([$_A-Za-z][$_A-Za-z0-9]*)['\"]?\\s*[:=]\\s*\\(.*?\\)\\s*=>/];\n var lines = source.split(\"\\n\");\n // Walk backwards in the source lines until we find the line which matches one of the patterns above\n var code = \"\";\n var maxLines = Math.min(lineNumber, 20);\n for (var i = 0; i < maxLines; ++i) {\n // lineNo is 1-based, source[] is 0-based\n var line = lines[lineNumber - i - 1];\n var commentPos = line.indexOf(\"//\");\n if (commentPos >= 0) {\n line = line.substr(0, commentPos);\n }\n if (line) {\n code = line + code;\n var len = syntaxes.length;\n for (var index = 0; index < len; index++) {\n var m = syntaxes[index].exec(code);\n if (m && m[1]) {\n return m[1];\n }\n }\n }\n }\n return undefined;\n }\n function _ensureSupportedEnvironment() {\n if (typeof Object.defineProperty !== \"function\" || typeof Object.create !== \"function\") {\n throw new Error(\"Unable to consume source maps in older browsers\");\n }\n }\n function _ensureStackFrameIsLegit(stackframe) {\n if (typeof stackframe !== \"object\") {\n throw new TypeError(\"Given StackFrame is not an object\");\n } else if (typeof stackframe.fileName !== \"string\") {\n throw new TypeError(\"Given file name is not a String\");\n } else if (typeof stackframe.lineNumber !== \"number\" || stackframe.lineNumber % 1 !== 0 || stackframe.lineNumber < 1) {\n throw new TypeError(\"Given line number must be a positive integer\");\n } else if (typeof stackframe.columnNumber !== \"number\" || stackframe.columnNumber % 1 !== 0 || stackframe.columnNumber < 0) {\n throw new TypeError(\"Given column number must be a non-negative integer\");\n }\n return true;\n }\n function _findSourceMappingURL(source) {\n var sourceMappingUrlRegExp = /\\/\\/[#@] ?sourceMappingURL=([^\\s'\"]+)\\s*$/gm;\n var lastSourceMappingUrl;\n var matchSourceMappingUrl;\n while (matchSourceMappingUrl = sourceMappingUrlRegExp.exec(source)) {\n // jshint ignore:line\n lastSourceMappingUrl = matchSourceMappingUrl[1];\n }\n if (lastSourceMappingUrl) {\n return lastSourceMappingUrl;\n } else {\n throw new Error(\"sourceMappingURL not found\");\n }\n }\n function _extractLocationInfoFromSourceMapSource(stackframe, sourceMapConsumer, sourceCache) {\n return new Promise(function (resolve, reject) {\n var loc = sourceMapConsumer.originalPositionFor({\n line: stackframe.lineNumber,\n column: stackframe.columnNumber\n });\n if (loc.source) {\n // cache mapped sources\n var mappedSource = sourceMapConsumer.sourceContentFor(loc.source);\n if (mappedSource) {\n sourceCache[loc.source] = mappedSource;\n }\n resolve(// given stackframe and source location, update stackframe\n new StackFrame({\n functionName: loc.name || stackframe.functionName,\n args: stackframe.args,\n fileName: loc.source,\n lineNumber: loc.line,\n columnNumber: loc.column\n }));\n } else {\n reject(new Error(\"Could not get original source for given stackframe and source map\"));\n }\n });\n }\n /**\n * @constructor\n * @param {Object} opts\n * opts.sourceCache = {url: \"Source String\"} => preload source cache\n * opts.sourceMapConsumerCache = {/path/file.js.map: SourceMapConsumer}\n * opts.offline = True to prevent network requests.\n * Best effort without sources or source maps.\n * opts.ajax = Promise returning function to make X-Domain requests\n */\n return function StackTraceGPS(opts) {\n if (!(this instanceof StackTraceGPS)) {\n return new StackTraceGPS(opts);\n }\n opts = opts || {};\n this.sourceCache = opts.sourceCache || {};\n this.sourceMapConsumerCache = opts.sourceMapConsumerCache || {};\n this.ajax = opts.ajax || _xdr;\n this._atob = opts.atob || _atob;\n\n this._get = function _get(location) {\n return new Promise(function (resolve, reject) {\n var isDataUrl = location.substr(0, 5) === \"data:\";\n if (this.sourceCache[location]) {\n resolve(this.sourceCache[location]);\n } else if (opts.offline && !isDataUrl) {\n reject(new Error(\"Cannot make network requests in offline mode\"));\n } else {\n if (isDataUrl) {\n // data URLs can have parameters.\n // see http://tools.ietf.org/html/rfc2397\n var supportedEncodingRegexp = /^data:application\\/json;([\\w=:\"-]+;)*base64,/;\n var match = location.match(supportedEncodingRegexp);\n if (match) {\n var sourceMapStart = match[0].length;\n var encodedSource = location.substr(sourceMapStart);\n var source = this._atob(encodedSource);\n this.sourceCache[location] = source;\n resolve(source);\n } else {\n reject(new Error(\"The encoding of the inline sourcemap is not supported\"));\n }\n } else {\n var xhrPromise = this.ajax(location, {\n method: \"get\"\n });\n // Cache the Promise to prevent duplicate in-flight requests\n this.sourceCache[location] = xhrPromise;\n xhrPromise.then(resolve, reject);\n }\n }\n }.bind(this));\n };\n /**\n * Creating SourceMapConsumers is expensive, so this wraps the creation of a\n * SourceMapConsumer in a per-instance cache.\n *\n * @param {String} sourceMappingURL = URL to fetch source map from\n * @param {String} defaultSourceRoot = Default source root for source map if undefined\n * @returns {Promise} that resolves a SourceMapConsumer\n */\n this._getSourceMapConsumer = function _getSourceMapConsumer(sourceMappingURL, defaultSourceRoot) {\n return new Promise(function (resolve, reject) {\n if (this.sourceMapConsumerCache[sourceMappingURL]) {\n resolve(this.sourceMapConsumerCache[sourceMappingURL]);\n } else {\n var sourceMapConsumerPromise = new Promise(function (resolve, reject) {\n return this._get(sourceMappingURL).then(function (sourceMapSource) {\n if (typeof sourceMapSource === \"string\") {\n sourceMapSource = _parseJson(sourceMapSource.replace(/^\\)\\]\\}'/, \"\"));\n }\n if (typeof sourceMapSource.sourceRoot === \"undefined\") {\n sourceMapSource.sourceRoot = defaultSourceRoot;\n }\n resolve(new SourceMap.SourceMapConsumer(sourceMapSource));\n }, reject);\n }.bind(this));\n this.sourceMapConsumerCache[sourceMappingURL] = sourceMapConsumerPromise;\n resolve(sourceMapConsumerPromise);\n }\n }.bind(this));\n };\n /**\n * Given a StackFrame, enhance function name and use source maps for a\n * better StackFrame.\n *\n * @param {StackFrame} stackframe object\n * @returns {Promise} that resolves with with source-mapped StackFrame\n */\n this.pinpoint = function StackTraceGPS$$pinpoint(stackframe) {\n return new Promise(function (resolve, reject) {\n this.getMappedLocation(stackframe).then(function (mappedStackFrame) {\n function resolveMappedStackFrame() {\n resolve(mappedStackFrame);\n }\n this.findFunctionName(mappedStackFrame).then(resolve, resolveMappedStackFrame)[\"catch\"](resolveMappedStackFrame);\n }.bind(this), reject);\n }.bind(this));\n };\n /**\n * Given a StackFrame, guess function name from location information.\n *\n * @param {StackFrame} stackframe\n * @returns {Promise} that resolves with enhanced StackFrame.\n */\n this.findFunctionName = function StackTraceGPS$$findFunctionName(stackframe) {\n return new Promise(function (resolve, reject) {\n _ensureStackFrameIsLegit(stackframe);\n this._get(stackframe.fileName).then(function getSourceCallback(source) {\n var lineNumber = stackframe.lineNumber;\n var columnNumber = stackframe.columnNumber;\n var guessedFunctionName = _findFunctionName(source, lineNumber, columnNumber);\n // Only replace functionName if we found something\n if (guessedFunctionName) {\n resolve(new StackFrame({\n functionName: guessedFunctionName,\n args: stackframe.args,\n fileName: stackframe.fileName,\n lineNumber: lineNumber,\n columnNumber: columnNumber\n }));\n } else {\n resolve(stackframe);\n }\n }, reject)[\"catch\"](reject);\n }.bind(this));\n };\n /**\n * Given a StackFrame, seek source-mapped location and return new enhanced StackFrame.\n *\n * @param {StackFrame} stackframe\n * @returns {Promise} that resolves with enhanced StackFrame.\n */\n this.getMappedLocation = function StackTraceGPS$$getMappedLocation(stackframe) {\n return new Promise(function (resolve, reject) {\n _ensureSupportedEnvironment();\n _ensureStackFrameIsLegit(stackframe);\n var sourceCache = this.sourceCache;\n var fileName = stackframe.fileName;\n this._get(fileName).then(function (source) {\n var sourceMappingURL = _findSourceMappingURL(source);\n var isDataUrl = sourceMappingURL.substr(0, 5) === \"data:\";\n var defaultSourceRoot = fileName.substring(0, fileName.lastIndexOf(\"/\") + 1);\n if (sourceMappingURL[0] !== \"/\" && !isDataUrl && !/^https?:\\/\\/|^\\/\\//i.test(sourceMappingURL)) {\n sourceMappingURL = defaultSourceRoot + sourceMappingURL;\n }\n return this._getSourceMapConsumer(sourceMappingURL, defaultSourceRoot).then(function (sourceMapConsumer) {\n return _extractLocationInfoFromSourceMapSource(stackframe, sourceMapConsumer, sourceCache).then(resolve)[\"catch\"](function () {\n resolve(stackframe);\n });\n });\n }.bind(this), reject)[\"catch\"](reject);\n }.bind(this));\n };\n };\n })(SourceMap, StackFrame);\n\n //\n // Shared Variables\n //\n\n var myScript = null;\n var scriptFile = document.getElementsByTagName('script');\n \n for (var i = 0; i < scriptFile.length; ++i) {\n if(isMe(scriptFile[i])) {\n myScript = scriptFile[i];\n }\n }\n\n var queryString = myScript != null ? myScript.src.replace(/^[^\\?]+\\??/, '') : null;\n var params = parseQuery(queryString);\n var paramsLength = objectLength(params);\n\n var debugSettings = {\n label: ' elmah.io debugger : On ',\n labelCSS: 'background: #06a89c; color: #ffffff; display: inline-block; font-size: 14px;',\n successCSS: 'background: #d4edda; color: #155724; display: inline-block; font-size: 13px;',\n errorCSS: 'background: #f8d7da; color: #721c24; display: inline-block; font-size: 13px;',\n warningCSS: 'background: #fff3cd; color: #856404; display: inline-block; font-size: 13px;',\n lightCSS: 'background: #e2e3e5; color: #383d41; display: inline-block; font-size: 13px;'\n };\n\n var defaults = {\n apiKey: null,\n logId: null,\n debug: false,\n application: null,\n filter: null,\n captureConsoleMinimumLevel: 'none',\n breadcrumbs: false,\n breadcrumbsNumber: 10\n };\n\n var breadcrumbsDelay = 100;\n\n //\n // Shared Methods\n //\n\n var extend = function () {\n\n // Variables\n var extended = {};\n var deep = false;\n var i = 0;\n\n // Check if a deep merge\n if (Object.prototype.toString.call(arguments[0]) === '[object Boolean]') {\n deep = arguments[0];\n i++;\n }\n\n // Merge the object into the extended object\n var merge = function (obj) {\n for (var prop in obj) {\n if (obj.hasOwnProperty(prop)) {\n // If property is an object, merge properties\n if (deep && Object.prototype.toString.call(obj[prop]) === '[object Object]') {\n extended[prop] = extend(extended[prop], obj[prop]);\n } else {\n extended[prop] = obj[prop];\n }\n }\n }\n };\n\n // Loop through each object and conduct a merge\n for (; i < arguments.length; i++) {\n var obj = arguments[i];\n merge(obj);\n }\n\n return extended;\n\n };\n\n //\n // Helpers\n //\n\n function isMe(scriptElem){\n if(scriptElem.getAttribute('src') != null) {\n return scriptElem.getAttribute('src').indexOf('elmahio') != -1 && scriptElem.getAttribute('src').indexOf('apiKey') != -1 && scriptElem.getAttribute('src').indexOf('logId') != -1;\n }\n }\n\n function isInt(n){\n return Number(n) === n && n % 1 === 0;\n }\n\n function isFloat(n){\n return Number(n) === n && n % 1 !== 0;\n }\n\n function parseQuery(query) {\n var Params = new Object();\n if (!query) return Params; // return empty object\n var Pairs = query.split(/[;&]/);\n for (var i = 0; i < Pairs.length; i++) {\n var KeyVal = Pairs[i].split('=');\n if (!KeyVal || KeyVal.length !== 2) continue;\n var key = unescape(KeyVal[0]);\n var val = unescape(KeyVal[1]);\n val = val.replace(/\\+/g, ' ');\n Params[key] = val;\n }\n return Params;\n }\n\n function objectLength(obj) {\n var size = 0, key;\n for (key in obj) {\n if (obj.hasOwnProperty(key)) size++;\n }\n return size;\n };\n\n function getSearchParameters() {\n var prmstr = window.location.search.substr(1);\n return prmstr !== null && prmstr !== \"\" ? transformToAssocArray(prmstr) : {};\n }\n\n function transformToAssocArray(prmstr) {\n var params = [];\n var prmarr = prmstr.split(\"&\");\n for (var i = 0; i < prmarr.length; i++) {\n var tmparr = prmarr[i].split(\"=\");\n params.push({\n 'key': tmparr[0],\n 'value': tmparr[1]\n });\n }\n return params;\n }\n\n function merge_objects(obj1, obj2) {\n var obj3 = {};\n for (var attrname1 in obj1) {\n obj3[attrname1] = obj1[attrname1];\n }\n for (var attrname2 in obj2) {\n obj3[attrname2] = obj2[attrname2];\n }\n\n return obj3;\n }\n\n function isString(what) {\n return Object.prototype.toString.call(what) === '[object String]';\n }\n\n function cssSelectorString(elem) {\n var MAX_TRAVERSE_HEIGHT = 5,\n MAX_OUTPUT_LEN = 80,\n out = [],\n height = 0,\n len = 0,\n separator = ' > ',\n sepLength = separator.length,\n nextStr;\n while (elem && height++ < MAX_TRAVERSE_HEIGHT) {\n nextStr = htmlElementAsString(elem);\n if (nextStr === 'html' || (height > 1 && len + out.length * sepLength + nextStr.length >= MAX_OUTPUT_LEN)) {\n break;\n }\n out.push(nextStr);\n len += nextStr.length;\n elem = elem.parentNode;\n }\n return out.reverse().join(separator);\n }\n \n function htmlElementAsString(elem) {\n var out = [], className, classes, key, attr, i;\n if (!elem || !elem.tagName) {\n return '';\n }\n out.push(elem.tagName.toLowerCase());\n if (elem.id) {\n out.push('#' + elem.id);\n }\n className = elem.className;\n if (className && isString(className)) {\n classes = className.split(/\\s+/);\n for (i = 0; i < classes.length; i++) {\n out.push('.' + classes[i]);\n }\n }\n var attrWhitelist = ['type', 'name', 'title', 'alt'];\n for (i = 0; i < attrWhitelist.length; i++) {\n key = attrWhitelist[i];\n attr = elem.getAttribute(key);\n if (attr) {\n out.push('[' + key + '=\"' + attr + '\"]');\n }\n }\n return out.join('');\n }\n\n var parseHash = function(url) {\n return url.split('#')[1] || '';\n };\n\n //\n // Constructor\n //\n\n var Constructor = function (options) {\n\n //\n // Variables\n //\n\n var publicAPIs = {};\n var settings;\n var breadcrumbs = [];\n var lastHref = window.location && window.location.href;\n\n function getPayload() {\n var payload = {\n \"url\": document.location.pathname || '/',\n \"application\": settings.application\n };\n\n var payload_data = [];\n\n if (document.documentMode) payload_data.push({ \"key\": \"Document-Mode\", \"value\": document.documentMode });\n if (window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth) payload_data.push({ \"key\": \"Browser-Width\", \"value\": window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth });\n if (window.innerHeight || document.documentElement.clientHeight || document.getElementsByTagName('body')[0].clientHeight) payload_data.push({ \"key\": \"Browser-Height\", \"value\": window.innerHeight || document.documentElement.clientHeight || document.getElementsByTagName('body')[0].clientHeight });\n if ((screen.msOrientation || (screen.orientation || screen.mozOrientation || {}).type) !== undefined) payload_data.push({ \"key\": \"Screen-Orientation\", \"value\": ((screen.msOrientation || (screen.orientation || screen.mozOrientation || {}).type).split(\"-\"))[0] });\n if (screen.width) payload_data.push({ \"key\": \"Screen-Width\", \"value\": screen.width });\n if (screen.height) payload_data.push({ \"key\": \"Screen-Height\", \"value\": screen.height });\n if (screen.colorDepth) payload_data.push({ \"key\": \"Color-Depth\", \"value\": screen.colorDepth });\n payload_data.push({ \"key\": \"X-ELMAHIO-SEARCH-isClientside\", \"value\": \"true\" });\n\n payload.data = payload_data;\n\n var payload_serverVariables = [];\n if (navigator.language) payload_serverVariables.push({ \"key\": \"User-Language\", \"value\": navigator.language });\n if (navigator.userAgent) payload_serverVariables.push({ \"key\": \"User-Agent\", \"value\": navigator.userAgent });\n if (document.referrer) payload_serverVariables.push({ \"key\": \"Referer\", \"value\": document.referrer });\n if (document.location.protocol === \"https:\") payload_serverVariables.push({ \"key\": \"HTTPS\", \"value\": 'on' });\n if (document.location.hostname) payload_serverVariables.push({ \"key\": \"Host\", \"value\": document.location.hostname });\n\n payload.serverVariables = payload_serverVariables;\n\n return payload;\n }\n\n function confirmResponse(status, response) {\n if (settings.debug) {\n if (status === 'error') {\n console.log('%c \\u2BC8 Error log: ' + '%c \\u2715 Not created ', debugSettings.lightCSS, debugSettings.errorCSS);\n } else if (status === 'success') {\n console.log('%c \\u2BC8 Error log: ' + '%c \\u2714 ' + response + ' at ' + new Date().toLocaleString() + ' ', debugSettings.lightCSS, debugSettings.successCSS);\n } else {\n console.log('%c \\u2BC8 Error log: ' + '%c \\u2715 Not created. Title should not be undefined, null or empty ! ', debugSettings.lightCSS, debugSettings.errorCSS);\n }\n }\n }\n\n function stackGPS(error, xhr, jsonData) {\n \tvar errorStack = error.toString().split(\"\\n\")[0];\n \tvar gps = new StackTraceGPS();\n var promise = new Promise(function(resolve) {\n\t var stackframes = ErrorStackParser.parse(error);\n\t resolve(Promise.all(stackframes.map(function(sf) {\n\t return new Promise(function(resolve) {\n\t function resolveOriginal() {\n\t resolve(sf);\n\t }\n\t gps.pinpoint(sf).then(resolve, resolveOriginal)['catch'](resolveOriginal);\n\t });\n\t })));\t\n });\n\n promise.then(function(newFrames){\n \tnewFrames.forEach(function(stackFrame, i){\n\t\t\t\t\tif(stackFrame.functionName) {\n \t\t\tvar fn = stackFrame.functionName + ' ';\n \t\t} else {\n \t\t\tvar fn = '';\n \t\t}\n \t\tvar stackString = ' at ' + fn + '(' + stackFrame.fileName + ':' + stackFrame.lineNumber + ':' + stackFrame.columnNumber + ')';\n \t\tnewFrames[i] = stackString;\n \t});\n \tnewFrames.unshift(errorStack);\n \tjsonData.detail = newFrames.join(\"\\n\");\n \txhr.send(JSON.stringify(jsonData));\n });\n }\n\n function stackString(error) {\n \tvar typeOF = typeof error.error;\n \tvar typeOFCapitalized = typeOF.charAt(0).toUpperCase() + typeOF.slice(1);\n\n \treturn typeOFCapitalized + ': ' + error.error + '\\n' + ' at ' + '(' + error.source + ':' + error.lineno + ':' + error.colno + ')';\n }\n\n function manipulateStack (errorStack, severity, message) {\n var stack = [];\n for (var i = 0; i < errorStack.length; i++) {\n if(errorStack[i] === \"Error\") {\n stack.push(severity + \": \" + message);\n }\n if(!errorStack[i].match(/elmahio.js|elmahio.min.js/g) && errorStack[i] !== \"Error\") {\n stack.push(errorStack[i]);\n }\n }\n return stack.join('\\n');\n }\n\n // Private methods\n\n var recordBreadcrumb = function(obj) {\n var crumb = merge_objects({'dateTime': new Date().toISOString()}, obj),\n breadcrumbs_number = 10;\n \n breadcrumbs.push(crumb);\n \n if(options.breadcrumbsNumber >= 0 && typeof options.breadcrumbsNumber === \"number\" ) {\n if(options.breadcrumbsNumber > 25) {\n breadcrumbs_number = 25;\n } else if(options.breadcrumbsNumber <= 25) {\n breadcrumbs_number = options.breadcrumbsNumber;\n }\n }\n \n if (breadcrumbs.length > breadcrumbs_number) {\n breadcrumbs.shift();\n }\n }\n\n var breadcrumbClickEventHandler = function(evt) {\n var target;\n try {\n target = cssSelectorString(evt.target);\n } catch (e) {\n target = \"\";\n }\n\n recordBreadcrumb({\n \"severity\": \"Information\",\n \"action\": \"Click\",\n \"message\": target\n });\n }\n\n var breadcrumbFormSubmitEventHandler = function(evt) {\n var target;\n try {\n target = cssSelectorString(evt.target);\n } catch (e) {\n target = \"\";\n }\n\n recordBreadcrumb({\n \"severity\": \"Information\",\n \"action\": \"Form submit\",\n \"message\": target\n });\n }\n\n var breadcrumbWindowEventHandler = function(evt) {\n var type = evt.type,\n message = null;\n\n switch (type) {\n case \"load\":\n message = \"Page loaded\"; break;\n case \"DOMContentLoaded\":\n message = \"DOMContentLoaded\"; break;\n case \"pageshow\":\n message = \"Page shown\"; break;\n case \"pagehide\":\n message = \"Page hidden\"; break;\n case \"popstate\":\n message = \"Navigated from: \" + lastHref + \" to: \" + window.location.href; break;\n }\n\n recordBreadcrumb({\n \"severity\": \"Information\",\n \"action\": \"Navigation\",\n \"message\": message\n });\n }\n\n var breadcrumbHashChangeEventHandler = function(evt) {\n var oldURL = evt.oldURL,\n newURL = evt.newURL,\n from = null,\n to = null,\n message = null;\n\n if (oldURL && newURL) {\n from = parseHash(oldURL);\n to = parseHash(newURL);\n message = \"from: '\" + from + \"' to: '\" + to + \"'\";\n } else {\n to = location.hash;\n message = \"to: '\" + to + \"'\";\n }\n\n recordBreadcrumb({\n \"severity\": \"Information\",\n \"action\": \"Navigation\",\n \"message\": \"Hash changed \" + message\n });\n }\n\n var breadcrumbXHRHandler = function(evt, method, url) {\n var status = evt && evt.target ? evt.target.status : 0,\n severity = null,\n method = method.toUpperCase(),\n url = url,\n regex = /https:\\/\\/api.elmah.io/g;\n\n if(url.match(regex) == null) { \n if (status > 0 && status < 400) {\n severity = \"Information\";\n } else if (status > 399 && status < 500) {\n severity = \"Warning\";\n } else if (status >= 500) {\n severity = \"Error\";\n }\n\n var statusCode = status > 0 ? \" (\" + status + \")\" : \"\";\n\n recordBreadcrumb({\n \"severity\": severity,\n \"action\": \"Request\",\n \"message\": \"[\" + method + \"] \" + url + statusCode\n });\n }\n }\n\n var sendPayload = function (apiKey, logId, callback, errorLog) {\n var api_key = apiKey,\n log_id = logId,\n error = errorLog,\n send = 1,\n queryParams = getSearchParameters(),\n stack = error.error && objectLength(error.error.stack) !== 0 && typeof error.error === \"object\" ? ErrorStackParser.parse(error.error) : '';\n\n // Ignoring error from an external script\n if (error && error.colno === 0 && error.lineno === 0 && (!stack || stack === '') && error.message && (error.message === \"Script error.\" || error.message === \"Script error\")) {\n\t\t\t if (settings.debug) {\n\t\t\t console.log('%c \\u2BC8 Error log: ' + '%c \\uD83D\\uDEC8 Ignoring error from external script ', debugSettings.lightCSS, debugSettings.warningCSS);\n\t\t\t }\n\t\t\t return;\n\t\t\t}\n\n if ((api_key !== null && log_id !== null) || (paramsLength === 2)) {\n\n // Priority for parameters\n if (params.hasOwnProperty('apiKey') && params.hasOwnProperty('logId')) {\n api_key = params['apiKey'];\n log_id = params['logId'];\n }\n\n // get new XHR object\n var xhr = new XMLHttpRequest();\n xhr.open(\"POST\", \"https://api.elmah.io/v3/messages/\" + log_id + \"?api_key=\" + api_key, true);\n\n xhr.setRequestHeader('Content-type', 'application/json');\n\n xhr.onload = function (e) {\n if (xhr.readyState === 4) {\n if (xhr.status === 201) {\n callback('success', xhr.statusText);\n }\n\n if(xhr.status >= 400 && xhr.status <= 499) {\n callback('error', xhr.statusText);\n\n // on error event\n publicAPIs.emit('error', xhr.status, xhr.statusText);\n }\n }\n };\n\n xhr.onerror = function (e) {\n callback('error', xhr.statusText);\n\n // on error event\n publicAPIs.emit('error', xhr.status, xhr.statusText);\n }\n\n var jsonData = {\n \"detail\": error.error ? error.error.stack : null,\n \"title\": error.message || 'Unspecified error',\n \"source\": stack && stack.length > 0 ? stack[0].fileName : null,\n \"severity\": \"Error\",\n \"type\": error.error ? error.error.name : null,\n \"queryString\": JSON.parse(JSON.stringify(queryParams))\n };\n\n // Check if error sent is a string and not an object\n // Then create the articifial stacktrace and pass source & type of the error\n if(error.error && (objectLength(error.error.stack) === 0) && typeof jsonData.detail === \"undefined\") {\n \tvar typeOF = typeof errorLog.error;\n \t\t\tvar typeOFCapitalized = typeOF.charAt(0).toUpperCase() + typeOF.slice(1);\n\n \tjsonData.detail = stackString(errorLog);\n \tjsonData.source = errorLog.source;\n jsonData.title = \"Uncaught \" + typeOFCapitalized + \": \" + errorLog.error;\n }\n\n // Add payload to jsonData\n jsonData = merge_objects(jsonData, getPayload());\n\n // Add breadcrumbs to jsonData\n if(breadcrumbs.length > 0) {\n jsonData.breadcrumbs = breadcrumbs;\n breadcrumbs = [];\n }\n\n // filter callback\n if (settings.filter !== null) {\n if (settings.filter(jsonData)) {\n send = 0;\n }\n }\n\n if (send === 1) {\n // on message event\n publicAPIs.emit('message', jsonData);\n\n if (error.error && typeof error.error === \"object\" && objectLength(error.error.stack) !== 0 && typeof Promise !== \"undefined\" && Promise.toString().indexOf(\"[native code]\") !== -1) {\n \t// send message trying to pinpoint stackframes\n \tstackGPS(error.error, xhr, jsonData);\n\t } else {\n\t \t// send message\n \txhr.send(JSON.stringify(jsonData));\n\t }\n }\n\n } else {\n return console.log('Login api error');\n }\n };\n\n var sendManualPayload = function (apiKey, logId, callback, logType, messageLog, errorLog) {\n var api_key = apiKey,\n log_id = logId,\n type = logType,\n error = errorLog,\n message = messageLog,\n send = 1,\n queryParams = getSearchParameters();\n\n if ((api_key !== null && log_id !== null) || (paramsLength === 2)) {\n\n // Priority for parameters\n if (params.hasOwnProperty('apiKey') && params.hasOwnProperty('logId')) {\n api_key = params['apiKey'];\n log_id = params['logId'];\n }\n\n // get new XHR object\n var xhr = new XMLHttpRequest();\n xhr.open(\"POST\", \"https://api.elmah.io/v3/messages/\" + log_id + \"?api_key=\" + api_key, true);\n xhr.setRequestHeader('Content-type', 'application/json');\n\n xhr.onload = function (e) {\n if (xhr.readyState === 4) {\n if (xhr.status === 201) {\n callback('success', xhr.statusText);\n }\n\n if(xhr.status >= 400 && xhr.status <= 499) {\n callback('error', xhr.statusText);\n\n // on error event\n publicAPIs.emit('error', xhr.status, xhr.statusText);\n }\n }\n };\n\n xhr.onerror = function (e) {\n callback('error', xhr.statusText);\n\n // on error event\n publicAPIs.emit('error', xhr.status, xhr.statusText);\n }\n\n if (type !== \"Log\") {\n\n var stack = error && error instanceof Error ? ErrorStackParser.parse(error) : null;\n\n var jsonData = {\n \"title\": message,\n \"source\": stack && stack.length > 0 ? stack[0].fileName : null,\n \"detail\": error ? error.stack : null,\n \"severity\": type,\n \"type\": error ? error.name : null,\n \"queryString\": JSON.parse(JSON.stringify(queryParams))\n };\n\n // Add payload to jsonData\n jsonData = merge_objects(jsonData, getPayload());\n\n } else {\n\n var jsonData = error;\n \n }\n\n // filter callback\n if (settings.filter !== null) {\n if (settings.filter(jsonData)) {\n send = 0;\n }\n }\n\n if (send === 1) {\n if (jsonData.title) {\n\n // Add breadcrumbs to jsonData\n if(breadcrumbs.length > 0) {\n // If message contains breadcrumbs\n if(jsonData.breadcrumbs && jsonData.breadcrumbs.length > 0) {\n breadcrumbs = breadcrumbs.reverse();\n for (var i = 0; i < breadcrumbs.length; i++) {\n // Add breadcrumbs to jsonData object\n jsonData.breadcrumbs.unshift(breadcrumbs[i]);\n }\n } else {\n jsonData.breadcrumbs = breadcrumbs;\n }\n \n // Reset breadcrumbs\n breadcrumbs = [];\n }\n\n // on message event\n publicAPIs.emit('message', jsonData);\n\n if (error && error instanceof Error && type !== \"Log\" && typeof Promise !== \"undefined\" && Promise.toString().indexOf(\"[native code]\") !== -1) {\n // send message trying to pinpoint stackframes\n stackGPS(error, xhr, jsonData);\n } else {\n // send message\n if(jsonData.errorObject && jsonData.errorObject instanceof Error) {\n error = jsonData.errorObject;\n delete jsonData.errorObject;\n stackGPS(error, xhr, jsonData);\n } else {\n delete jsonData.errorObject;\n xhr.send(JSON.stringify(jsonData));\n }\n }\n\n } else {\n callback('missing-title', xhr.statusText);\n }\n }\n\n } else {\n return console.log('Login api error');\n }\n };\n\n var sendPayloadFromConsole = function (apiKey, logId, callback, logType, errorLog) {\n var api_key = apiKey,\n log_id = logId,\n message = errorLog.message,\n messageTemplate = errorLog.message,\n type = logType,\n args = Object.values(errorLog.arguments),\n send = 1,\n queryParams = getSearchParameters();\n\n function format(f, args) {\n var formatRegExp = /%[sdif]/g;\n var str = f;\n\n if(args.length > 1) {\n // If message has placeholders (%s, %d, %i, %f), check for arguments and replace them\n if(String(f).match(/%[sdif]/g)) {\n var i = 0;\n str = String(f).replace(formatRegExp, function(x) {\n switch (x) {\n case '%s': i++; return args[i] ? String(args[i]) : '%s';\n case '%d': i++; return args[i] ? (isInt(args[i]) || isFloat(args[i])) ? parseInt(args[i]) : 'NaN' : '%d';\n case '%i': i++; return args[i] ? (isInt(args[i]) || isFloat(args[i])) ? parseInt(args[i]) : 'NaN' : '%i';\n case '%f': i++; return args[i] ? (isInt(args[i]) || isFloat(args[i])) ? parseFloat(args[i]) : 'NaN' : '%f';\n default: return x;\n }\n });\n\n for (var len = args.length, x = args[++i]; i < len; x = args[++i]) {\n if (x === null || typeof x !== 'object') {\n str += ' ' + x;\n } else {\n str += ' ' + String(Object.prototype.toString.call(x));\n }\n }\n } else {\n str = args.join(' ');\n }\n }\n\n return str;\n }\n\n message = format(message, args);\n\n if(typeof message !== \"string\" && message !== undefined){\n message = message.toString();\n }\n\n if(typeof messageTemplate !== \"string\" && messageTemplate !== undefined) {\n messageTemplate = messageTemplate.toString();\n }\n\n if ((api_key !== null && log_id !== null) || (paramsLength === 2)) {\n\n // Priority for parameters\n if (params.hasOwnProperty('apiKey') && params.hasOwnProperty('logId')) {\n api_key = params['apiKey'];\n log_id = params['logId'];\n }\n\n // get new XHR object\n var xhr = new XMLHttpRequest();\n xhr.open(\"POST\", \"https://api.elmah.io/v3/messages/\" + log_id + \"?api_key=\" + api_key, true);\n xhr.setRequestHeader('Content-type', 'application/json');\n\n xhr.onload = function (e) {\n if (xhr.readyState === 4) {\n if (xhr.status === 201) {\n callback('success', xhr.statusText);\n }\n\n if(xhr.status >= 400 && xhr.status <= 499) {\n callback('error', xhr.statusText);\n\n // on error event\n publicAPIs.emit('error', xhr.status, xhr.statusText);\n }\n }\n };\n\n xhr.onerror = function (e) {\n callback('error', xhr.statusText);\n // on error event\n publicAPIs.emit('error', xhr.status, xhr.statusText);\n }\n\n var jsonData = {\n \"title\": message,\n \"titleTemplate\": messageTemplate,\n \"detail\": manipulateStack(new Error().stack.split('\\n'), type, message),\n \"severity\": type,\n \"type\": null,\n \"queryString\": JSON.parse(JSON.stringify(queryParams))\n };\n\n // Add payload to jsonData\n jsonData = merge_objects(jsonData, getPayload());\n\n // Add breadcrumbs to jsonData\n if(breadcrumbs.length > 0) {\n jsonData.breadcrumbs = breadcrumbs;\n breadcrumbs = [];\n }\n\n // filter callback\n if (settings.filter !== null) {\n if (settings.filter(jsonData)) {\n send = 0;\n }\n }\n\n if (send === 1) {\n if (jsonData.title) {\n // on message event\n publicAPIs.emit('message', jsonData);\n // send message\n xhr.send(JSON.stringify(jsonData));\n } else {\n callback('missing-title', xhr.statusText);\n }\n }\n\n } else {\n return console.log('Login api error');\n }\n };\n\n var sendPrefilledLogMessage = function(errorLog) {\n // without error object\n if(!errorLog) return getPayload();\n\n // with error object\n var error = errorLog;\n var stack = error ? ErrorStackParser.parse(error) : null;\n var jsonData = {\n \"title\": error.message,\n \"source\": stack && stack.length > 0 ? stack[0].fileName : null,\n \"detail\": error ? error.stack : null,\n \"severity\": \"Error\",\n \"type\": error ? error.name : null,\n \"errorObject\": error\n };\n\n jsonData = merge_objects(jsonData, getPayload());\n \n return jsonData;\n };\n\n // Some public methods\n\n publicAPIs.error = function (msg, error) {\n setTimeout(function() { sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Error', msg, error); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n };\n publicAPIs.verbose = function (msg, error) {\n setTimeout(function() { sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Verbose', msg, error); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n };\n publicAPIs.debug = function (msg, error) {\n setTimeout(function() { sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Debug', msg, error); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n };\n publicAPIs.information = function (msg, error) {\n setTimeout(function() { sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Information', msg, error); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n };\n publicAPIs.warning = function (msg, error) {\n setTimeout(function() { sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Warning', msg, error); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n };\n publicAPIs.fatal = function (msg, error) {\n setTimeout(function() { sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Fatal', msg, error); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n };\n publicAPIs.log = function (obj) {\n setTimeout(function() { sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Log', null, obj); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n };\n publicAPIs.message = function(error) {\n return sendPrefilledLogMessage(error);\n };\n publicAPIs.addBreadcrumb = function(msg, severity, evt) {\n recordBreadcrumb({\n \"severity\": (severity != undefined && isString(severity)) ? severity : \"Information\",\n \"action\": (evt != undefined && isString(evt)) ? evt : \"Log\",\n \"message\": (msg != undefined && isString(msg)) ? msg : \"This is just a test message.\"\n });\n };\n\n publicAPIs.on = function (name, callback, ctx) {\n var e = this.e || (this.e = {});\n\n (e[name] || (e[name] = [])).push({\n fn: callback,\n ctx: ctx\n });\n\n return this;\n };\n\n publicAPIs.emit = function (name) {\n var data = [].slice.call(arguments, 1);\n var evtArr = ((this.e || (this.e = {}))[name] || []).slice();\n var i = 0;\n var len = evtArr.length;\n\n for (i; i < len; i++) {\n evtArr[i].fn.apply(evtArr[i].ctx, data);\n }\n\n return this;\n };\n\n publicAPIs.init = function (options) {\n\n // -- Merge options into defaults\n settings = extend(defaults, options || {});\n\n // -- Breadcrumbs\n if (settings.breadcrumbs) {\n // Breadcrumbs - Click & Submit form\n if (document.addEventListener) {\n document.addEventListener('click', breadcrumbClickEventHandler, false);\n document.addEventListener('submit', breadcrumbFormSubmitEventHandler, false);\n } else if (document.attachEvent) {\n document.attachEvent('click', breadcrumbClickEventHandler, false);\n document.attachEvent('submit', breadcrumbFormSubmitEventHandler, false);\n }\n\n // Breadcrumbs - Navigation\n if (window.addEventListener) {\n window.addEventListener('load', breadcrumbWindowEventHandler, false);\n window.addEventListener('DOMContentLoaded', breadcrumbWindowEventHandler, false);\n window.addEventListener('pageshow', breadcrumbWindowEventHandler, false);\n window.addEventListener('pagehide', breadcrumbWindowEventHandler, false);\n window.addEventListener('hashchange', breadcrumbHashChangeEventHandler, false);\n } else if (window.attachEvent) {\n window.attachEvent('load', breadcrumbWindowEventHandler, false);\n window.attachEvent('DOMContentLoaded', breadcrumbWindowEventHandler, false);\n window.attachEvent('pageshow', breadcrumbWindowEventHandler, false);\n window.attachEvent('pagehide', breadcrumbWindowEventHandler, false);\n window.attachEvent('hashchange', breadcrumbHashChangeEventHandler, false);\n }\n\n if(window.history && window.history.pushState && window.history.replaceState) {\n var old_onpopstate = window.onpopstate;\n window.onpopstate = function(evt) {\n breadcrumbWindowEventHandler(evt);\n if (old_onpopstate) {\n return old_onpopstate.apply(this, arguments);\n }\n };\n }\n\n // Breadcrumbs - XHR\n if(window.XMLHttpRequest && window.XMLHttpRequest.prototype) {\n // Store a reference to the native method\n var open = XMLHttpRequest.prototype.open;\n \n // Overwrite the native method\n XMLHttpRequest.prototype.open = function(method, url) {\n // Assign an event listener\n this.addEventListener(\"loadend\", function(event) { breadcrumbXHRHandler(event, method, url); }, false);\n // Call the stored reference to the native method\n open.apply(this, arguments);\n };\n }\n }\n\n // -- Log on window error\n window.onerror = function (message, source, lineno, colno, error) {\n var errorLog = {\n 'message': message,\n 'source': source,\n 'lineno': lineno,\n 'colno': colno,\n 'error': error\n }\n \n setTimeout(function() { sendPayload(settings.apiKey, settings.logId, confirmResponse, errorLog); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n\n return false;\n }\n\n // -- Overriding console methods\n // -- Then log messages into the app.elmah.io\n if(options && options.captureConsoleMinimumLevel !== \"none\") {\n\n // If captureConsoleMinimumLevel: info or debug is set (error, warn)\n if(options.captureConsoleMinimumLevel === \"info\" || options.captureConsoleMinimumLevel === \"warn\" || options.captureConsoleMinimumLevel === \"error\" || options.captureConsoleMinimumLevel === \"debug\") {\n // Log console errors\n var _error = console.error;\n console.error = function(errMessage){\n var errorLog = {\n \t\t'message': errMessage,\n \t\t'arguments': arguments\n \t}\n setTimeout(function() { sendPayloadFromConsole(settings.apiKey, settings.logId, confirmResponse, 'Error', errorLog); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n _error.apply(console, arguments);\n };\n if(options.captureConsoleMinimumLevel !== \"error\") {\n // Log console warnings\n var _warning = console.warn;\n console.warn = function(warnMessage){\n var errorLog = {\n 'message': warnMessage,\n 'arguments': arguments\n }\n setTimeout(function() { sendPayloadFromConsole(settings.apiKey, settings.logId, confirmResponse, 'Warning', errorLog); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n _warning.apply(console, arguments);\n };\n }\n }\n if(options.captureConsoleMinimumLevel === \"info\" || options.captureConsoleMinimumLevel === \"debug\") {\n // Log console info\n var _info = console.info;\n console.info = function(infoMessage){\n var errorLog = {\n \t\t'message': infoMessage,\n \t\t'arguments': arguments\n \t}\n setTimeout(function() { sendPayloadFromConsole(settings.apiKey, settings.logId, confirmResponse, 'Information', errorLog); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n _info.apply(console, arguments);\n };\n }\n if(options.captureConsoleMinimumLevel === \"debug\") {\n // Log console debug\n var _debug = console.debug;\n console.debug = function(debugMessage){\n var errorLog = {\n \t\t'message': debugMessage,\n \t\t'arguments': arguments\n \t}\n setTimeout(function() { sendPayloadFromConsole(settings.apiKey, settings.logId, confirmResponse, 'Debug', errorLog); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n _debug.apply(console, arguments);\n };\n }\n }\n };\n\n // Initialize the plugin\n publicAPIs.init(options);\n\n if (settings.debug) {\n console.log('%c' + debugSettings.label, debugSettings.labelCSS);\n }\n\n // Return the public APIs\n return publicAPIs;\n\n };\n\n\n //\n // Return the constructor\n //\n\n if (paramsLength && params.hasOwnProperty('apiKey') && params.hasOwnProperty('logId')) {\n // Immediately-Invoked Function Expression (IIFE)\n return new Constructor;\n } else {\n // UMD Constructor\n return Constructor;\n }\n\n});"],"file":"elmahio.min.js"} \ No newline at end of file +{"version":3,"sources":["elmahio.js"],"names":["root","factory","define","amd","exports","module","Elmahio","global","window","this","FIREFOX_SAFARI_STACK_REGEXP","CHROME_IE_STACK_REGEXP","SAFARI_NATIVE_CODE_REGEXP","StackFrame","_isNumber","n","isNaN","parseFloat","isFinite","_capitalize","str","charAt","toUpperCase","substring","_getter","p","booleanProps","numericProps","stringProps","props","concat","obj","Object","i","length","hasOwnProperty","undefined","prototype","getArgs","args","setArgs","v","toString","call","TypeError","getEvalOrigin","evalOrigin","setEvalOrigin","getFunctionName","join","getFileName","getLineNumber","getColumnNumber","fromString","argsStartIndex","indexOf","argsEndIndex","lastIndexOf","functionName","split","locationString","parts","exec","fileName","lineNumber","columnNumber","Boolean","j","Number","k","String","ErrorStackParser","parse","error","stacktrace","parseOpera","stack","match","parseV8OrIE","parseFFOrSafari","Error","extractLocation","urlLike","replace","filter","line","map","sanitizedLine","location","locationParts","source","functionNameRegex","matches","e","message","parseOpera9","parseOpera11","parseOpera10","lineRE","lines","result","len","push","argsRaw","tokens","pop","functionCall","shift","StackTraceGPS","SourceMap","_xdr","url","Promise","resolve","reject","req","XMLHttpRequest","open","onerror","onreadystatechange","readyState","status","substr","responseText","send","_atob","b64str","atob","_ensureStackFrameIsLegit","stackframe","opts","sourceCache","sourceMapConsumerCache","ajax","_get","isDataUrl","offline","sourceMapStart","encodedSource","xhrPromise","method","then","bind","_getSourceMapConsumer","sourceMappingURL","defaultSourceRoot","sourceMapConsumerPromise","sourceMapSource","string","JSON","_parseJson","sourceRoot","SourceMapConsumer","pinpoint","getMappedLocation","mappedStackFrame","resolveMappedStackFrame","findFunctionName","guessedFunctionName","syntaxes","code","maxLines","Math","min","commentPos","index","m","_findFunctionName","defineProperty","create","_ensureSupportedEnvironment","lastSourceMappingUrl","matchSourceMappingUrl","sourceMappingUrlRegExp","_findSourceMappingURL","test","sourceMapConsumer","loc","originalPositionFor","column","mappedSource","sourceContentFor","name","_extractLocationInfoFromSourceMapSource","r","t","o","id","loaded","c","ArraySet","a","s","quickSort","u","sections","l","getArg","g","_version","normalize","isAbsolute","relative","_names","fromArray","_sources","sourcesContent","_mappings","file","generatedLine","generatedColumn","originalLine","originalColumn","_sections","generatedOffset","consumer","fromSourceMap","__generatedMappings","get","_parseMappings","__originalMappings","_charIsMappingSeparator","GENERATED_ORDER","ORIGINAL_ORDER","GREATEST_LOWER_BOUND","LEAST_UPPER_BOUND","eachMapping","_generatedMappings","_originalMappings","at","forEach","allGeneratedPositionsFor","has","_findMapping","compareByOriginalPositions","lastColumn","toArray","_sourceRoot","_generateSourcesContent","_file","slice","h","f","d","_","C","A","y","L","decode","value","rest","compareByGeneratedPositionsDeflated","search","computeColumnSpans","lastGeneratedColumn","hasContentsOfAllSources","size","some","urlParse","scheme","path","generatedPositionFor","BasicSourceMapConsumer","constructor","sources","bias","every","add","IndexedSourceMapConsumer","arguments","auth","host","port","splice","urlGenerate","Array","charCodeAt","toSetString","fromSetString","compareByGeneratedPositionsInflated","floor","_array","_set","getOwnPropertyNames","encode","round","random","myScript","scriptFile","document","getElementsByTagName","isMe","params","query","Params","Pairs","KeyVal","key","unescape","val","parseQuery","src","paramsLength","objectLength","debugSettings","label","labelCSS","successCSS","errorCSS","warningCSS","lightCSS","defaults","apiKey","logId","debug","application","captureConsoleMinimumLevel","breadcrumbs","breadcrumbsNumber","extend","extended","deep","merge","prop","scriptElem","getAttribute","isInt","isFloat","getSearchParameters","prmstr","prmarr","tmparr","transformToAssocArray","merge_objects","obj1","obj2","obj3","attrname1","attrname2","isString","what","cssSelectorString","elem","nextStr","out","height","sepLength","htmlElementAsString","parentNode","reverse","className","classes","attr","tagName","toLowerCase","attrWhitelist","parseHash","Constructor","options","settings","publicAPIs","lastHref","href","getPayload","payload","pathname","payload_data","documentMode","innerWidth","documentElement","clientWidth","innerHeight","clientHeight","screen","msOrientation","orientation","mozOrientation","type","width","colorDepth","data","payload_serverVariables","navigator","language","userAgent","referrer","protocol","hostname","serverVariables","confirmResponse","response","console","log","Date","toLocaleString","generateErrorObject","inner","cause","getErrorTypeSource","object","iterateObj","keys","GenerateNewFrames","errorMessage","newFrames","lastInnerFileName","stackFrame","fn","stackString","unshift","GPSPromise","stackframes","gps","all","sf","resolveOriginal","stackGPS","xhr","jsonData","messagesArr","promiseArr","values","detail","stringify","typeOF","lineno","colno","inspectorObj","fullError","s4","Id","Type","Message","StackTrace","Source","Inners","inspectorGPS","inspectorObject","final","generateNewFrames","recordBreadcrumb","crumb","dateTime","toISOString","breadcrumbs_number","breadcrumbClickEventHandler","evt","target","severity","action","breadcrumbFormSubmitEventHandler","breadcrumbWindowEventHandler","breadcrumbHashChangeEventHandler","oldURL","newURL","hash","sendPayload","callback","errorLog","api_key","log_id","queryParams","setRequestHeader","onload","statusText","emit","title","queryString","typeOFCapitalized","typeAndSource","sendManualPayload","logType","messageLog","errorObject","sendPayloadFromConsole","messageTemplate","x","parseInt","format","titleTemplate","errorStack","manipulateStack","msg","setTimeout","verbose","information","warning","fatal","sendPrefilledLogMessage","addBreadcrumb","on","ctx","evtArr","apply","init","addEventListener","attachEvent","history","pushState","replaceState","old_onpopstate","onpopstate","event","breadcrumbXHRHandler","onunhandledrejection","reason","_error","errMessage","_warning","warn","warnMessage","_info","info","infoMessage","_debug","debugMessage"],"mappings":";;;;CAIA,SAAUA,EAAMC,GACQ,mBAAXC,QAAyBA,OAAOC,IACzCD,OAAO,GAAI,WACT,OAAOD,EAAQD,KAEW,iBAAZI,QAChBC,OAAOD,QAAUH,EAAQD,GAEzBA,EAAKM,QAAUL,EAAQD,GAR3B,CAUqB,oBAAXO,OAAyBA,OAA2B,oBAAXC,OAAyBA,OAASC,KAAM,SAASD,GAClG,aAm+BA,IAl+BA,IAiHME,EACAC,EACAC,EAnHFC,EAAa,WAGf,SAASC,EAAUC,GACjB,OAAQC,MAAMC,WAAWF,KAAOG,SAASH,GAG3C,SAASI,EAAYC,GACnB,OAAOA,EAAIC,OAAO,GAAGC,cAAgBF,EAAIG,UAAU,GAGrD,SAASC,EAAQC,GACf,OAAO,WACL,OAAOhB,KAAKgB,IAGhB,IAAIC,EAAe,CAAC,gBAAiB,SAAU,WAAY,cACvDC,EAAe,CAAC,eAAgB,cAChCC,EAAc,CAAC,WAAY,eAAgB,UAE3CC,EAAQH,EAAaI,OAAOH,EAAcC,EAD7B,CAAC,SAGlB,SAASf,EAAWkB,GAClB,GAAIA,aAAeC,OACjB,IAAK,IAAIC,EAAI,EAAGA,EAAIJ,EAAMK,OAAQD,IAC5BF,EAAII,eAAeN,EAAMI,UAAyBG,IAAlBL,EAAIF,EAAMI,KAC5CxB,KAAK,MAAQU,EAAYU,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,OAAQ+C,EAAS9C,MAAO4E,EAAiB,cAAeqE,IACvFnG,EAAS1C,YAn/BC,IAm/BgC,GAC7CkM,EAAMlB,MAAMtG,QAAS1H,YAGzB,GAA2C,UAAvCyF,EAAQ1C,2BAAwC,CAClD,IAAIsM,EAAS3H,QAAQ7E,MACrB6E,QAAQ7E,MAAQ,SAASyM,GACvB,IAAIzD,EAAW,CACb7W,QAAWsa,EACXtP,UAAaA,WAEfsN,WAAW,WACTT,EAAuBnH,EAAS/C,OAAQ+C,EAAS9C,MAAO4E,EAAiB,QAASqE,IACjFnG,EAAS1C,YAhgCC,IAggCgC,GAC7CqM,EAAOrB,MAAMtG,QAAS1H,eAK9B2F,EAAWsI,KAAKxI,GACZC,EAAS7C,OACX6E,QAAQC,IAAI,KAAOxF,EAAcC,MAAOD,EAAcE,UAEjDsD,GAET,OAAI1D,GAAgBV,EAAOlQ,eAAe,WAAakQ,EAAOlQ,eAAe,SACpE,IAAImU,EAEJA","sourcesContent":["/*!\n * elmah.io Javascript Logger - version 4.0.0\n * (c) 2018 elmah.io, Apache 2.0 License, https://elmah.io\n */\n\n(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define([], function () {\n return factory(root);\n });\n } else if (typeof exports === 'object') {\n module.exports = factory(root);\n } else {\n root.Elmahio = factory(root);\n }\n})(typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : this, function (window) {\n\n 'use strict';\n\n //\n // ==== STACKFRAME ====\n //\n\n var StackFrame = (function () {\n \"use strict\";\n function _isNumber(n) {\n return !isNaN(parseFloat(n)) && isFinite(n);\n }\n function _capitalize(str) {\n return str.charAt(0).toUpperCase() + str.substring(1);\n }\n function _getter(p) {\n return function () {\n return this[p];\n };\n }\n var booleanProps = [\"isConstructor\", \"isEval\", \"isNative\", \"isToplevel\"];\n var numericProps = [\"columnNumber\", \"lineNumber\"];\n var stringProps = [\"fileName\", \"functionName\", \"source\"];\n var arrayProps = [\"args\"];\n var props = booleanProps.concat(numericProps, stringProps, arrayProps);\n function StackFrame(obj) {\n if (obj instanceof Object) {\n for (var i = 0; i < props.length; i++) {\n if (obj.hasOwnProperty(props[i]) && obj[props[i]] !== undefined) {\n this[\"set\" + _capitalize(props[i])](obj[props[i]]);\n }\n }\n }\n }\n StackFrame.prototype = {\n getArgs: function () {\n return this.args;\n },\n setArgs: function (v) {\n if (Object.prototype.toString.call(v) !== \"[object Array]\") {\n throw new TypeError(\"Args must be an Array\");\n }\n this.args = v;\n },\n getEvalOrigin: function () {\n return this.evalOrigin;\n },\n setEvalOrigin: function (v) {\n if (v instanceof StackFrame) {\n this.evalOrigin = v;\n } else if (v instanceof Object) {\n this.evalOrigin = new StackFrame(v);\n } else {\n throw new TypeError(\"Eval Origin must be an Object or StackFrame\");\n }\n },\n toString: function () {\n var functionName = this.getFunctionName() || \"{anonymous}\";\n var args = \"(\" + (this.getArgs() || []).join(\",\") + \")\";\n var fileName = this.getFileName() ? \"@\" + this.getFileName() : \"\";\n var lineNumber = _isNumber(this.getLineNumber()) ? \":\" + this.getLineNumber() : \"\";\n var columnNumber = _isNumber(this.getColumnNumber()) ? \":\" + this.getColumnNumber() : \"\";\n return functionName + args + fileName + lineNumber + columnNumber;\n }\n };\n StackFrame.fromString = function StackFrame$$fromString(str) {\n var argsStartIndex = str.indexOf(\"(\");\n var argsEndIndex = str.lastIndexOf(\")\");\n var functionName = str.substring(0, argsStartIndex);\n var args = str.substring(argsStartIndex + 1, argsEndIndex).split(\",\");\n var locationString = str.substring(argsEndIndex + 1);\n if (locationString.indexOf(\"@\") === 0) {\n var parts = /@(.+?)(?::(\\d+))?(?::(\\d+))?$/.exec(locationString, \"\");\n var fileName = parts[1];\n var lineNumber = parts[2];\n var columnNumber = parts[3];\n }\n return new StackFrame({\n functionName: functionName,\n args: args || undefined,\n fileName: fileName,\n lineNumber: lineNumber || undefined,\n columnNumber: columnNumber || undefined\n });\n };\n for (var i = 0; i < booleanProps.length; i++) {\n StackFrame.prototype[\"get\" + _capitalize(booleanProps[i])] = _getter(booleanProps[i]);\n StackFrame.prototype[\"set\" + _capitalize(booleanProps[i])] = function (p) {\n return function (v) {\n this[p] = Boolean(v);\n };\n }(booleanProps[i]);\n }\n for (var j = 0; j < numericProps.length; j++) {\n StackFrame.prototype[\"get\" + _capitalize(numericProps[j])] = _getter(numericProps[j]);\n StackFrame.prototype[\"set\" + _capitalize(numericProps[j])] = function (p) {\n return function (v) {\n if (!_isNumber(v)) {\n throw new TypeError(p + \" must be a Number\");\n }\n this[p] = Number(v);\n };\n }(numericProps[j]);\n }\n for (var k = 0; k < stringProps.length; k++) {\n StackFrame.prototype[\"get\" + _capitalize(stringProps[k])] = _getter(stringProps[k]);\n StackFrame.prototype[\"set\" + _capitalize(stringProps[k])] = function (p) {\n return function (v) {\n this[p] = String(v);\n };\n }(stringProps[k]);\n }\n return StackFrame;\n })();\n\n //\n // ==== ERROR STACK PARSER ====\n //\n\n var ErrorStackParser = (function () {\n 'use strict';\n var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\\S+:\\d+/;\n var CHROME_IE_STACK_REGEXP = /^\\s*at .*(\\S+:\\d+|\\(native\\))/m;\n var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\\[native code])?$/;\n\n return {\n /**\n * Given an Error object, extract the most information from it.\n *\n * @param {Error} error object\n * @return {Array} of StackFrames\n */\n parse: function ErrorStackParser$$parse(error) {\n if (typeof error.stacktrace !== 'undefined' || typeof error['opera#sourceloc'] !== 'undefined') {\n return this.parseOpera(error);\n } else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {\n return this.parseV8OrIE(error);\n } else if (error.stack) {\n return this.parseFFOrSafari(error);\n } else {\n throw new Error('Cannot parse given Error object');\n }\n },\n // Separate line and column numbers from a string of the form: (URI:Line:Column)\n extractLocation: function ErrorStackParser$$extractLocation(urlLike) {\n // Fail-fast but return locations like \"(native)\"\n if (urlLike.indexOf(':') === -1) {\n return [urlLike];\n }\n var regExp = /(.+?)(?::(\\d+))?(?::(\\d+))?$/;\n var parts = regExp.exec(urlLike.replace(/[()]/g, ''));\n return [parts[1], parts[2] || undefined, parts[3] || undefined];\n },\n parseV8OrIE: function ErrorStackParser$$parseV8OrIE(error) {\n var filtered = error.stack.split('\\n').filter(function(line) {\n return !!line.match(CHROME_IE_STACK_REGEXP);\n }, this);\n return filtered.map(function(line) {\n if (line.indexOf('(eval ') > -1) {\n // Throw away eval information until we implement stacktrace.js/stackframe#8\n line = line.replace(/eval code/g, 'eval').replace(/(\\(eval at [^()]*)|(,.*$)/g, '');\n }\n var sanitizedLine = line.replace(/^\\s+/, '').replace(/\\(eval code/g, '(').replace(/^.*?\\s+/, '');\n // capture and preseve the parenthesized location \"(/foo/my bar.js:12:87)\" in\n // case it has spaces in it, as the string is split on \\s+ later on\n var location = sanitizedLine.match(/ (\\(.+\\)$)/);\n // remove the parenthesized location from the line, if it was matched\n sanitizedLine = location ? sanitizedLine.replace(location[0], '') : sanitizedLine;\n // if a location was matched, pass it to extractLocation() otherwise pass all sanitizedLine\n // because this line doesn't have function name\n var locationParts = this.extractLocation(location ? location[1] : sanitizedLine);\n var functionName = location && sanitizedLine || undefined;\n var fileName = ['eval', ''].indexOf(locationParts[0]) > -1 ? undefined : locationParts[0];\n return new StackFrame({\n functionName: functionName,\n fileName: fileName,\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n source: line\n });\n }, this);\n },\n parseFFOrSafari: function ErrorStackParser$$parseFFOrSafari(error) {\n var filtered = error.stack.split('\\n').filter(function(line) {\n return !line.match(SAFARI_NATIVE_CODE_REGEXP);\n }, this);\n return filtered.map(function(line) {\n // Throw away eval information until we implement stacktrace.js/stackframe#8\n if (line.indexOf(' > eval') > -1) {\n line = line.replace(/ line (\\d+)(?: > eval line \\d+)* > eval:\\d+:\\d+/g, ':$1');\n }\n if (line.indexOf('@') === -1 && line.indexOf(':') === -1) {\n // Safari eval frames only have function names and nothing else\n return new StackFrame({\n functionName: line\n });\n } else {\n var functionNameRegex = /((.*\".+\"[^@]*)?[^@]*)(?:@)/;\n var matches = line.match(functionNameRegex);\n var functionName = matches && matches[1] ? matches[1] : undefined;\n var locationParts = this.extractLocation(line.replace(functionNameRegex, ''));\n return new StackFrame({\n functionName: functionName,\n fileName: locationParts[0],\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n source: line\n });\n }\n }, this);\n },\n parseOpera: function ErrorStackParser$$parseOpera(e) {\n if (!e.stacktrace || (e.message.indexOf('\\n') > -1 &&\n e.message.split('\\n').length > e.stacktrace.split('\\n').length)) {\n return this.parseOpera9(e);\n } else if (!e.stack) {\n return this.parseOpera10(e);\n } else {\n return this.parseOpera11(e);\n }\n },\n parseOpera9: function ErrorStackParser$$parseOpera9(e) {\n var lineRE = /Line (\\d+).*script (?:in )?(\\S+)/i;\n var lines = e.message.split('\\n');\n var result = [];\n for (var i = 2, len = lines.length; i < len; i += 2) {\n var match = lineRE.exec(lines[i]);\n if (match) {\n result.push(new StackFrame({\n fileName: match[2],\n lineNumber: match[1],\n source: lines[i]\n }));\n }\n }\n return result;\n },\n parseOpera10: function ErrorStackParser$$parseOpera10(e) {\n var lineRE = /Line (\\d+).*script (?:in )?(\\S+)(?:: In function (\\S+))?$/i;\n var lines = e.stacktrace.split('\\n');\n var result = [];\n for (var i = 0, len = lines.length; i < len; i += 2) {\n var match = lineRE.exec(lines[i]);\n if (match) {\n result.push(\n new StackFrame({\n functionName: match[3] || undefined,\n fileName: match[2],\n lineNumber: match[1],\n source: lines[i]\n })\n );\n }\n }\n return result;\n },\n // Opera 10.65+ Error.stack very similar to FF/Safari\n parseOpera11: function ErrorStackParser$$parseOpera11(error) {\n var filtered = error.stack.split('\\n').filter(function(line) {\n return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) && !line.match(/^Error created at/);\n }, this);\n return filtered.map(function(line) {\n var tokens = line.split('@');\n var locationParts = this.extractLocation(tokens.pop());\n var functionCall = (tokens.shift() || '');\n var functionName = functionCall\n .replace(//, '$2')\n .replace(/\\([^)]*\\)/g, '') || undefined;\n var argsRaw;\n if (functionCall.match(/\\(([^)]*)\\)/)) {\n argsRaw = functionCall.replace(/^[^(]+\\(([^)]*)\\)$/, '$1');\n }\n var args = (argsRaw === undefined || argsRaw === '[arguments not available]') ?\n undefined : argsRaw.split(',');\n\n return new StackFrame({\n functionName: functionName,\n args: args,\n fileName: locationParts[0],\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n source: line\n });\n }, this);\n }\n };\n })();\n\n //\n // ==== STACKTRACE-GPS ====\n //\n\n var SourceMap = function(e){var n={};function r(t){if(n[t])return n[t].exports;var o=n[t]={exports:{},id:t,loaded:!1};return e[t].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}return r.m=e,r.c=n,r.p=\"\",r(0)}([function(e,n,r){var t=r(1),o=r(2),i=r(3).ArraySet,a=r(4),s=r(6).quickSort;function u(e){var n=e;return\"string\"==typeof e&&(n=JSON.parse(e.replace(/^\\)\\]\\}'/,\"\"))),null!=n.sections?new c(n):new l(n)}function l(e){var n=e;\"string\"==typeof e&&(n=JSON.parse(e.replace(/^\\)\\]\\}'/,\"\")));var r=t.getArg(n,\"version\"),o=t.getArg(n,\"sources\"),a=t.getArg(n,\"names\",[]),s=t.getArg(n,\"sourceRoot\",null),u=t.getArg(n,\"sourcesContent\",null),l=t.getArg(n,\"mappings\"),g=t.getArg(n,\"file\",null);if(r!=this._version)throw new Error(\"Unsupported version: \"+r);o=o.map(String).map(t.normalize).map(function(e){return s&&t.isAbsolute(s)&&t.isAbsolute(e)?t.relative(s,e):e}),this._names=i.fromArray(a.map(String),!0),this._sources=i.fromArray(o,!0),this.sourceRoot=s,this.sourcesContent=u,this._mappings=l,this.file=g}function g(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}function c(e){var n=e;\"string\"==typeof e&&(n=JSON.parse(e.replace(/^\\)\\]\\}'/,\"\")));var r=t.getArg(n,\"version\"),o=t.getArg(n,\"sections\");if(r!=this._version)throw new Error(\"Unsupported version: \"+r);this._sources=new i,this._names=new i;var a={line:-1,column:0};this._sections=o.map(function(e){if(e.url)throw new Error(\"Support for url field in sections not implemented.\");var n=t.getArg(e,\"offset\"),r=t.getArg(n,\"line\"),o=t.getArg(n,\"column\");if(r=0){var s=this._originalMappings[a];if(void 0===e.column)for(var u=s.originalLine;s&&s.originalLine===u;)i.push({line:t.getArg(s,\"generatedLine\",null),column:t.getArg(s,\"generatedColumn\",null),lastColumn:t.getArg(s,\"lastGeneratedColumn\",null)}),s=this._originalMappings[++a];else for(var l=s.originalColumn;s&&s.originalLine===n&&s.originalColumn==l;)i.push({line:t.getArg(s,\"generatedLine\",null),column:t.getArg(s,\"generatedColumn\",null),lastColumn:t.getArg(s,\"lastGeneratedColumn\",null)}),s=this._originalMappings[++a]}return i},n.SourceMapConsumer=u,l.prototype=Object.create(u.prototype),l.prototype.consumer=u,l.fromSourceMap=function(e){var n=Object.create(l.prototype),r=n._names=i.fromArray(e._names.toArray(),!0),o=n._sources=i.fromArray(e._sources.toArray(),!0);n.sourceRoot=e._sourceRoot,n.sourcesContent=e._generateSourcesContent(n._sources.toArray(),n.sourceRoot),n.file=e._file;for(var a=e._mappings.toArray().slice(),u=n.__generatedMappings=[],c=n.__originalMappings=[],p=0,h=a.length;p1&&(r.source=d+i[1],d+=i[1],r.originalLine=h+i[2],h=r.originalLine,r.originalLine+=1,r.originalColumn=f+i[3],f=r.originalColumn,i.length>4&&(r.name=m+i[4],m+=i[4])),L.push(r),\"number\"==typeof r.originalLine&&y.push(r)}s(L,t.compareByGeneratedPositionsDeflated),this.__generatedMappings=L,s(y,t.compareByOriginalPositions),this.__originalMappings=y},l.prototype._findMapping=function(e,n,r,t,i,a){if(e[r]<=0)throw new TypeError(\"Line must be greater than or equal to 1, got \"+e[r]);if(e[t]<0)throw new TypeError(\"Column must be greater than or equal to 0, got \"+e[t]);return o.search(e,n,i,a)},l.prototype.computeColumnSpans=function(){for(var e=0;e=0){var o=this._generatedMappings[r];if(o.generatedLine===n.generatedLine){var i=t.getArg(o,\"source\",null);null!==i&&(i=this._sources.at(i),null!=this.sourceRoot&&(i=t.join(this.sourceRoot,i)));var a=t.getArg(o,\"name\",null);return null!==a&&(a=this._names.at(a)),{source:i,line:t.getArg(o,\"originalLine\",null),column:t.getArg(o,\"originalColumn\",null),name:a}}}return{source:null,line:null,column:null,name:null}},l.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&(this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return null==e}))},l.prototype.sourceContentFor=function(e,n){if(!this.sourcesContent)return null;if(null!=this.sourceRoot&&(e=t.relative(this.sourceRoot,e)),this._sources.has(e))return this.sourcesContent[this._sources.indexOf(e)];var r;if(null!=this.sourceRoot&&(r=t.urlParse(this.sourceRoot))){var o=e.replace(/^file:\\/\\//,\"\");if(\"file\"==r.scheme&&this._sources.has(o))return this.sourcesContent[this._sources.indexOf(o)];if((!r.path||\"/\"==r.path)&&this._sources.has(\"/\"+e))return this.sourcesContent[this._sources.indexOf(\"/\"+e)]}if(n)return null;throw new Error('\"'+e+'\" is not in the SourceMap.')},l.prototype.generatedPositionFor=function(e){var n=t.getArg(e,\"source\");if(null!=this.sourceRoot&&(n=t.relative(this.sourceRoot,n)),!this._sources.has(n))return{line:null,column:null,lastColumn:null};var r={source:n=this._sources.indexOf(n),originalLine:t.getArg(e,\"line\"),originalColumn:t.getArg(e,\"column\")},o=this._findMapping(r,this._originalMappings,\"originalLine\",\"originalColumn\",t.compareByOriginalPositions,t.getArg(e,\"bias\",u.GREATEST_LOWER_BOUND));if(o>=0){var i=this._originalMappings[o];if(i.source===r.source)return{line:t.getArg(i,\"generatedLine\",null),column:t.getArg(i,\"generatedColumn\",null),lastColumn:t.getArg(i,\"lastGeneratedColumn\",null)}}return{line:null,column:null,lastColumn:null}},n.BasicSourceMapConsumer=l,c.prototype=Object.create(u.prototype),c.prototype.constructor=u,c.prototype._version=3,Object.defineProperty(c.prototype,\"sources\",{get:function(){for(var e=[],n=0;n=0;g--)\".\"===(a=u[g])?u.splice(g,1):\"..\"===a?l++:l>0&&(\"\"===a?(u.splice(g+1,l),l=0):(u.splice(g,2),l--));return\"\"===(r=u.join(\"/\"))&&(r=s?\"/\":\".\"),t?(t.path=r,i(t)):r}n.urlParse=o,n.urlGenerate=i,n.normalize=a,n.join=function(e,n){\"\"===e&&(e=\".\"),\"\"===n&&(n=\".\");var r=o(n),s=o(e);if(s&&(e=s.path||\"/\"),r&&!r.scheme)return s&&(r.scheme=s.scheme),i(r);if(r||n.match(t))return n;if(s&&!s.host&&!s.path)return s.host=n,i(s);var u=\"/\"===n.charAt(0)?n:a(e.replace(/\\/+$/,\"\")+\"/\"+n);return s?(s.path=u,i(s)):u},n.isAbsolute=function(e){return\"/\"===e.charAt(0)||!!e.match(r)},n.relative=function(e,n){\"\"===e&&(e=\".\"),e=e.replace(/\\/$/,\"\");for(var r=0;0!==n.indexOf(e+\"/\");){var t=e.lastIndexOf(\"/\");if(t<0)return n;if((e=e.slice(0,t)).match(/^([^\\/]+:\\/)?\\/*$/))return n;++r}return Array(r+1).join(\"../\")+n.substr(e.length+1)};var s=!(\"__proto__\"in Object.create(null));function u(e){return e}function l(e){if(!e)return!1;var n=e.length;if(n<9)return!1;if(95!==e.charCodeAt(n-1)||95!==e.charCodeAt(n-2)||111!==e.charCodeAt(n-3)||116!==e.charCodeAt(n-4)||111!==e.charCodeAt(n-5)||114!==e.charCodeAt(n-6)||112!==e.charCodeAt(n-7)||95!==e.charCodeAt(n-8)||95!==e.charCodeAt(n-9))return!1;for(var r=n-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function g(e,n){return e===n?0:e>n?1:-1}n.toSetString=s?u:function(e){return l(e)?\"$\"+e:e},n.fromSetString=s?u:function(e){return l(e)?e.slice(1):e},n.compareByOriginalPositions=function(e,n,r){var t=e.source-n.source;return 0!==t?t:0!=(t=e.originalLine-n.originalLine)?t:0!=(t=e.originalColumn-n.originalColumn)||r?t:0!=(t=e.generatedColumn-n.generatedColumn)?t:0!=(t=e.generatedLine-n.generatedLine)?t:e.name-n.name},n.compareByGeneratedPositionsDeflated=function(e,n,r){var t=e.generatedLine-n.generatedLine;return 0!==t?t:0!=(t=e.generatedColumn-n.generatedColumn)||r?t:0!=(t=e.source-n.source)?t:0!=(t=e.originalLine-n.originalLine)?t:0!=(t=e.originalColumn-n.originalColumn)?t:e.name-n.name},n.compareByGeneratedPositionsInflated=function(e,n){var r=e.generatedLine-n.generatedLine;return 0!==r?r:0!=(r=e.generatedColumn-n.generatedColumn)?r:0!==(r=g(e.source,n.source))?r:0!=(r=e.originalLine-n.originalLine)?r:0!=(r=e.originalColumn-n.originalColumn)?r:g(e.name,n.name)}},function(e,n){n.GREATEST_LOWER_BOUND=1,n.LEAST_UPPER_BOUND=2,n.search=function(e,r,t,o){if(0===r.length)return-1;var i=function e(r,t,o,i,a,s){var u=Math.floor((t-r)/2)+r,l=a(o,i[u],!0);return 0===l?u:l>0?t-u>1?e(u,t,o,i,a,s):s==n.LEAST_UPPER_BOUND?t1?e(r,u,o,i,a,s):s==n.LEAST_UPPER_BOUND?u:r<0?-1:r}(-1,r.length,e,r,t,o||n.GREATEST_LOWER_BOUND);if(i<0)return-1;for(;i-1>=0&&0===t(r[i],r[i-1],!0);)--i;return i}},function(e,n,r){var t=r(1),o=Object.prototype.hasOwnProperty;function i(){this._array=[],this._set=Object.create(null)}i.fromArray=function(e,n){for(var r=new i,t=0,o=e.length;t=0&&e>>=5)>0&&(n|=32),o+=t.encode(n)}while(i>0);return o},n.decode=function(e,n,r){var o,i,a,s,u=e.length,l=0,g=0;do{if(n>=u)throw new Error(\"Expected more digits in base 64 VLQ value.\");if(-1===(i=t.decode(e.charCodeAt(n++))))throw new Error(\"Invalid base64 digit: \"+e.charAt(n-1));o=!!(32&i),l+=(i&=31)<>1,1==(1&a)?-s:s),r.rest=n}},function(e,n){var r=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\".split(\"\");n.encode=function(e){if(0<=e&&e= 200 && req.status < 300 || url.substr(0, 7) === \"file://\" && req.responseText) {\n resolve(req.responseText);\n } else {\n reject(new Error(\"HTTP status: \" + req.status + \" retrieving \" + url));\n }\n }\n };\n req.send();\n });\n }\n /**\n * Convert a Base64-encoded string into its original representation.\n * Used for inline sourcemaps.\n *\n * @param {String} b64str Base-64 encoded string\n * @returns {String} original representation of the base64-encoded string.\n */\n function _atob(b64str) {\n if (typeof window !== \"undefined\" && window.atob) {\n return window.atob(b64str);\n } else {\n throw new Error(\"You must supply a polyfill for window.atob in this environment\");\n }\n }\n function _parseJson(string) {\n if (typeof JSON !== \"undefined\" && JSON.parse) {\n return JSON.parse(string);\n } else {\n throw new Error(\"You must supply a polyfill for JSON.parse in this environment\");\n }\n }\n function _findFunctionName(source, lineNumber) {\n var syntaxes = [ // {name} = function ({args}) TODO args capture\n /['\"]?([$_A-Za-z][$_A-Za-z0-9]*)['\"]?\\s*[:=]\\s*function\\b/, // function {name}({args}) m[1]=name m[2]=args\n /function\\s+([^('\"`]*?)\\s*\\(([^)]*)\\)/, // {name} = eval()\n /['\"]?([$_A-Za-z][$_A-Za-z0-9]*)['\"]?\\s*[:=]\\s*(?:eval|new Function)\\b/, // fn_name() {\n /\\b(?!(?:if|for|switch|while|with|catch)\\b)(?:(?:static)\\s+)?(\\S+)\\s*\\(.*?\\)\\s*\\{/, // {name} = () => {\n /['\"]?([$_A-Za-z][$_A-Za-z0-9]*)['\"]?\\s*[:=]\\s*\\(.*?\\)\\s*=>/];\n var lines = source.split(\"\\n\");\n // Walk backwards in the source lines until we find the line which matches one of the patterns above\n var code = \"\";\n var maxLines = Math.min(lineNumber, 20);\n for (var i = 0; i < maxLines; ++i) {\n // lineNo is 1-based, source[] is 0-based\n var line = lines[lineNumber - i - 1];\n var commentPos = line.indexOf(\"//\");\n if (commentPos >= 0) {\n line = line.substr(0, commentPos);\n }\n if (line) {\n code = line + code;\n var len = syntaxes.length;\n for (var index = 0; index < len; index++) {\n var m = syntaxes[index].exec(code);\n if (m && m[1]) {\n return m[1];\n }\n }\n }\n }\n return undefined;\n }\n function _ensureSupportedEnvironment() {\n if (typeof Object.defineProperty !== \"function\" || typeof Object.create !== \"function\") {\n throw new Error(\"Unable to consume source maps in older browsers\");\n }\n }\n function _ensureStackFrameIsLegit(stackframe) {\n if (typeof stackframe !== \"object\") {\n throw new TypeError(\"Given StackFrame is not an object\");\n } else if (typeof stackframe.fileName !== \"string\") {\n throw new TypeError(\"Given file name is not a String\");\n } else if (typeof stackframe.lineNumber !== \"number\" || stackframe.lineNumber % 1 !== 0 || stackframe.lineNumber < 1) {\n throw new TypeError(\"Given line number must be a positive integer\");\n } else if (typeof stackframe.columnNumber !== \"number\" || stackframe.columnNumber % 1 !== 0 || stackframe.columnNumber < 0) {\n throw new TypeError(\"Given column number must be a non-negative integer\");\n }\n return true;\n }\n function _findSourceMappingURL(source) {\n var sourceMappingUrlRegExp = /\\/\\/[#@] ?sourceMappingURL=([^\\s'\"]+)\\s*$/gm;\n var lastSourceMappingUrl;\n var matchSourceMappingUrl;\n while (matchSourceMappingUrl = sourceMappingUrlRegExp.exec(source)) {\n // jshint ignore:line\n lastSourceMappingUrl = matchSourceMappingUrl[1];\n }\n if (lastSourceMappingUrl) {\n return lastSourceMappingUrl;\n } else {\n throw new Error(\"sourceMappingURL not found\");\n }\n }\n function _extractLocationInfoFromSourceMapSource(stackframe, sourceMapConsumer, sourceCache) {\n return new Promise(function (resolve, reject) {\n var loc = sourceMapConsumer.originalPositionFor({\n line: stackframe.lineNumber,\n column: stackframe.columnNumber\n });\n if (loc.source) {\n // cache mapped sources\n var mappedSource = sourceMapConsumer.sourceContentFor(loc.source);\n if (mappedSource) {\n sourceCache[loc.source] = mappedSource;\n }\n resolve(// given stackframe and source location, update stackframe\n new StackFrame({\n functionName: loc.name || stackframe.functionName,\n args: stackframe.args,\n fileName: loc.source,\n lineNumber: loc.line,\n columnNumber: loc.column\n }));\n } else {\n reject(new Error(\"Could not get original source for given stackframe and source map\"));\n }\n });\n }\n /**\n * @constructor\n * @param {Object} opts\n * opts.sourceCache = {url: \"Source String\"} => preload source cache\n * opts.sourceMapConsumerCache = {/path/file.js.map: SourceMapConsumer}\n * opts.offline = True to prevent network requests.\n * Best effort without sources or source maps.\n * opts.ajax = Promise returning function to make X-Domain requests\n */\n return function StackTraceGPS(opts) {\n if (!(this instanceof StackTraceGPS)) {\n return new StackTraceGPS(opts);\n }\n opts = opts || {};\n this.sourceCache = opts.sourceCache || {};\n this.sourceMapConsumerCache = opts.sourceMapConsumerCache || {};\n this.ajax = opts.ajax || _xdr;\n this._atob = opts.atob || _atob;\n\n this._get = function _get(location) {\n return new Promise(function (resolve, reject) {\n var isDataUrl = location.substr(0, 5) === \"data:\";\n if (this.sourceCache[location]) {\n resolve(this.sourceCache[location]);\n } else if (opts.offline && !isDataUrl) {\n reject(new Error(\"Cannot make network requests in offline mode\"));\n } else {\n if (isDataUrl) {\n // data URLs can have parameters.\n // see http://tools.ietf.org/html/rfc2397\n var supportedEncodingRegexp = /^data:application\\/json;([\\w=:\"-]+;)*base64,/;\n var match = location.match(supportedEncodingRegexp);\n if (match) {\n var sourceMapStart = match[0].length;\n var encodedSource = location.substr(sourceMapStart);\n var source = this._atob(encodedSource);\n this.sourceCache[location] = source;\n resolve(source);\n } else {\n reject(new Error(\"The encoding of the inline sourcemap is not supported\"));\n }\n } else {\n var xhrPromise = this.ajax(location, {\n method: \"get\"\n });\n // Cache the Promise to prevent duplicate in-flight requests\n this.sourceCache[location] = xhrPromise;\n xhrPromise.then(resolve, reject);\n }\n }\n }.bind(this));\n };\n /**\n * Creating SourceMapConsumers is expensive, so this wraps the creation of a\n * SourceMapConsumer in a per-instance cache.\n *\n * @param {String} sourceMappingURL = URL to fetch source map from\n * @param {String} defaultSourceRoot = Default source root for source map if undefined\n * @returns {Promise} that resolves a SourceMapConsumer\n */\n this._getSourceMapConsumer = function _getSourceMapConsumer(sourceMappingURL, defaultSourceRoot) {\n return new Promise(function (resolve, reject) {\n if (this.sourceMapConsumerCache[sourceMappingURL]) {\n resolve(this.sourceMapConsumerCache[sourceMappingURL]);\n } else {\n var sourceMapConsumerPromise = new Promise(function (resolve, reject) {\n return this._get(sourceMappingURL).then(function (sourceMapSource) {\n if (typeof sourceMapSource === \"string\") {\n sourceMapSource = _parseJson(sourceMapSource.replace(/^\\)\\]\\}'/, \"\"));\n }\n if (typeof sourceMapSource.sourceRoot === \"undefined\") {\n sourceMapSource.sourceRoot = defaultSourceRoot;\n }\n resolve(new SourceMap.SourceMapConsumer(sourceMapSource));\n }, reject);\n }.bind(this));\n this.sourceMapConsumerCache[sourceMappingURL] = sourceMapConsumerPromise;\n resolve(sourceMapConsumerPromise);\n }\n }.bind(this));\n };\n /**\n * Given a StackFrame, enhance function name and use source maps for a\n * better StackFrame.\n *\n * @param {StackFrame} stackframe object\n * @returns {Promise} that resolves with with source-mapped StackFrame\n */\n this.pinpoint = function StackTraceGPS$$pinpoint(stackframe) {\n return new Promise(function (resolve, reject) {\n this.getMappedLocation(stackframe).then(function (mappedStackFrame) {\n function resolveMappedStackFrame() {\n resolve(mappedStackFrame);\n }\n this.findFunctionName(mappedStackFrame).then(resolve, resolveMappedStackFrame)[\"catch\"](resolveMappedStackFrame);\n }.bind(this), reject);\n }.bind(this));\n };\n /**\n * Given a StackFrame, guess function name from location information.\n *\n * @param {StackFrame} stackframe\n * @returns {Promise} that resolves with enhanced StackFrame.\n */\n this.findFunctionName = function StackTraceGPS$$findFunctionName(stackframe) {\n return new Promise(function (resolve, reject) {\n _ensureStackFrameIsLegit(stackframe);\n this._get(stackframe.fileName).then(function getSourceCallback(source) {\n var lineNumber = stackframe.lineNumber;\n var columnNumber = stackframe.columnNumber;\n var guessedFunctionName = _findFunctionName(source, lineNumber, columnNumber);\n // Only replace functionName if we found something\n if (guessedFunctionName) {\n resolve(new StackFrame({\n functionName: guessedFunctionName,\n args: stackframe.args,\n fileName: stackframe.fileName,\n lineNumber: lineNumber,\n columnNumber: columnNumber\n }));\n } else {\n resolve(stackframe);\n }\n }, reject)[\"catch\"](reject);\n }.bind(this));\n };\n /**\n * Given a StackFrame, seek source-mapped location and return new enhanced StackFrame.\n *\n * @param {StackFrame} stackframe\n * @returns {Promise} that resolves with enhanced StackFrame.\n */\n this.getMappedLocation = function StackTraceGPS$$getMappedLocation(stackframe) {\n return new Promise(function (resolve, reject) {\n _ensureSupportedEnvironment();\n _ensureStackFrameIsLegit(stackframe);\n var sourceCache = this.sourceCache;\n var fileName = stackframe.fileName;\n this._get(fileName).then(function (source) {\n var sourceMappingURL = _findSourceMappingURL(source);\n var isDataUrl = sourceMappingURL.substr(0, 5) === \"data:\";\n var defaultSourceRoot = fileName.substring(0, fileName.lastIndexOf(\"/\") + 1);\n if (sourceMappingURL[0] !== \"/\" && !isDataUrl && !/^https?:\\/\\/|^\\/\\//i.test(sourceMappingURL)) {\n sourceMappingURL = defaultSourceRoot + sourceMappingURL;\n }\n return this._getSourceMapConsumer(sourceMappingURL, defaultSourceRoot).then(function (sourceMapConsumer) {\n return _extractLocationInfoFromSourceMapSource(stackframe, sourceMapConsumer, sourceCache).then(resolve)[\"catch\"](function () {\n resolve(stackframe);\n });\n });\n }.bind(this), reject)[\"catch\"](reject);\n }.bind(this));\n };\n };\n })(SourceMap, StackFrame);\n\n //\n // Shared Variables\n //\n\n var myScript = null;\n var scriptFile = document.getElementsByTagName('script');\n \n for (var i = 0; i < scriptFile.length; ++i) {\n if(isMe(scriptFile[i])) {\n myScript = scriptFile[i];\n }\n }\n\n var queryString = myScript != null ? myScript.src.replace(/^[^\\?]+\\??/, '') : null;\n var params = parseQuery(queryString);\n var paramsLength = objectLength(params);\n\n var debugSettings = {\n label: ' elmah.io debugger : On ',\n labelCSS: 'background: #06a89c; color: #ffffff; display: inline-block; font-size: 14px;',\n successCSS: 'background: #d4edda; color: #155724; display: inline-block; font-size: 13px;',\n errorCSS: 'background: #f8d7da; color: #721c24; display: inline-block; font-size: 13px;',\n warningCSS: 'background: #fff3cd; color: #856404; display: inline-block; font-size: 13px;',\n lightCSS: 'background: #e2e3e5; color: #383d41; display: inline-block; font-size: 13px;'\n };\n\n var defaults = {\n apiKey: null,\n logId: null,\n debug: false,\n application: null,\n filter: null,\n captureConsoleMinimumLevel: 'none',\n breadcrumbs: false,\n breadcrumbsNumber: 10\n };\n\n var breadcrumbsDelay = 100;\n\n //\n // Shared Methods\n //\n\n var extend = function () {\n\n // Variables\n var extended = {};\n var deep = false;\n var i = 0;\n\n // Check if a deep merge\n if (Object.prototype.toString.call(arguments[0]) === '[object Boolean]') {\n deep = arguments[0];\n i++;\n }\n\n // Merge the object into the extended object\n var merge = function (obj) {\n for (var prop in obj) {\n if (obj.hasOwnProperty(prop)) {\n // If property is an object, merge properties\n if (deep && Object.prototype.toString.call(obj[prop]) === '[object Object]') {\n extended[prop] = extend(extended[prop], obj[prop]);\n } else {\n extended[prop] = obj[prop];\n }\n }\n }\n };\n\n // Loop through each object and conduct a merge\n for (; i < arguments.length; i++) {\n var obj = arguments[i];\n merge(obj);\n }\n\n return extended;\n\n };\n\n //\n // Helpers\n //\n\n function isMe(scriptElem){\n if(scriptElem.getAttribute('src') != null) {\n return scriptElem.getAttribute('src').indexOf('elmahio') != -1 && scriptElem.getAttribute('src').indexOf('apiKey') != -1 && scriptElem.getAttribute('src').indexOf('logId') != -1;\n }\n }\n\n function isInt(n){\n return Number(n) === n && n % 1 === 0;\n }\n\n function isFloat(n){\n return Number(n) === n && n % 1 !== 0;\n }\n\n function parseQuery(query) {\n var Params = new Object();\n if (!query) return Params; // return empty object\n var Pairs = query.split(/[;&]/);\n for (var i = 0; i < Pairs.length; i++) {\n var KeyVal = Pairs[i].split('=');\n if (!KeyVal || KeyVal.length !== 2) continue;\n var key = unescape(KeyVal[0]);\n var val = unescape(KeyVal[1]);\n val = val.replace(/\\+/g, ' ');\n Params[key] = val;\n }\n return Params;\n }\n\n function objectLength(obj) {\n var size = 0, key;\n for (key in obj) {\n if (obj.hasOwnProperty(key)) size++;\n }\n return size;\n };\n\n function getSearchParameters() {\n var prmstr = window.location.search.substr(1);\n return prmstr !== null && prmstr !== \"\" ? transformToAssocArray(prmstr) : {};\n }\n\n function transformToAssocArray(prmstr) {\n var params = [];\n var prmarr = prmstr.split(\"&\");\n for (var i = 0; i < prmarr.length; i++) {\n var tmparr = prmarr[i].split(\"=\");\n params.push({\n 'key': tmparr[0],\n 'value': tmparr[1]\n });\n }\n return params;\n }\n\n function merge_objects(obj1, obj2) {\n var obj3 = {};\n for (var attrname1 in obj1) {\n obj3[attrname1] = obj1[attrname1];\n }\n for (var attrname2 in obj2) {\n obj3[attrname2] = obj2[attrname2];\n }\n\n return obj3;\n }\n\n function isString(what) {\n return Object.prototype.toString.call(what) === '[object String]';\n }\n\n function cssSelectorString(elem) {\n var MAX_TRAVERSE_HEIGHT = 5,\n MAX_OUTPUT_LEN = 80,\n out = [],\n height = 0,\n len = 0,\n separator = ' > ',\n sepLength = separator.length,\n nextStr;\n while (elem && height++ < MAX_TRAVERSE_HEIGHT) {\n nextStr = htmlElementAsString(elem);\n if (nextStr === 'html' || (height > 1 && len + out.length * sepLength + nextStr.length >= MAX_OUTPUT_LEN)) {\n break;\n }\n out.push(nextStr);\n len += nextStr.length;\n elem = elem.parentNode;\n }\n return out.reverse().join(separator);\n }\n \n function htmlElementAsString(elem) {\n var out = [], className, classes, key, attr, i;\n if (!elem || !elem.tagName) {\n return '';\n }\n out.push(elem.tagName.toLowerCase());\n if (elem.id) {\n out.push('#' + elem.id);\n }\n className = elem.className;\n if (className && isString(className)) {\n classes = className.split(/\\s+/);\n for (i = 0; i < classes.length; i++) {\n out.push('.' + classes[i]);\n }\n }\n var attrWhitelist = ['type', 'name', 'title', 'alt'];\n for (i = 0; i < attrWhitelist.length; i++) {\n key = attrWhitelist[i];\n attr = elem.getAttribute(key);\n if (attr) {\n out.push('[' + key + '=\"' + attr + '\"]');\n }\n }\n return out.join('');\n }\n\n var parseHash = function(url) {\n return url.split('#')[1] || '';\n };\n\n //\n // Constructor\n //\n\n var Constructor = function (options) {\n\n //\n // Variables\n //\n\n var publicAPIs = {};\n var settings;\n var breadcrumbs = [];\n var lastHref = window.location && window.location.href;\n\n function getPayload() {\n var payload = {\n \"url\": document.location.pathname || '/',\n \"application\": settings.application\n };\n\n var payload_data = [];\n\n if (document.documentMode) payload_data.push({ \"key\": \"Document-Mode\", \"value\": document.documentMode });\n if (window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth) payload_data.push({ \"key\": \"Browser-Width\", \"value\": window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth });\n if (window.innerHeight || document.documentElement.clientHeight || document.getElementsByTagName('body')[0].clientHeight) payload_data.push({ \"key\": \"Browser-Height\", \"value\": window.innerHeight || document.documentElement.clientHeight || document.getElementsByTagName('body')[0].clientHeight });\n if ((screen.msOrientation || (screen.orientation || screen.mozOrientation || {}).type) !== undefined) payload_data.push({ \"key\": \"Screen-Orientation\", \"value\": ((screen.msOrientation || (screen.orientation || screen.mozOrientation || {}).type).split(\"-\"))[0] });\n if (screen.width) payload_data.push({ \"key\": \"Screen-Width\", \"value\": screen.width });\n if (screen.height) payload_data.push({ \"key\": \"Screen-Height\", \"value\": screen.height });\n if (screen.colorDepth) payload_data.push({ \"key\": \"Color-Depth\", \"value\": screen.colorDepth });\n payload_data.push({ \"key\": \"X-ELMAHIO-SEARCH-isClientside\", \"value\": \"true\" });\n\n payload.data = payload_data;\n\n var payload_serverVariables = [];\n if (navigator.language) payload_serverVariables.push({ \"key\": \"User-Language\", \"value\": navigator.language });\n if (navigator.userAgent) payload_serverVariables.push({ \"key\": \"User-Agent\", \"value\": navigator.userAgent });\n if (document.referrer) payload_serverVariables.push({ \"key\": \"Referer\", \"value\": document.referrer });\n if (document.location.protocol === \"https:\") payload_serverVariables.push({ \"key\": \"HTTPS\", \"value\": 'on' });\n if (document.location.hostname) payload_serverVariables.push({ \"key\": \"Host\", \"value\": document.location.hostname });\n\n payload.serverVariables = payload_serverVariables;\n\n return payload;\n }\n\n function confirmResponse(status, response) {\n if (settings.debug) {\n if (status === 'error') {\n console.log('%c \\u2BC8 Error log: ' + '%c \\u2715 Not created ', debugSettings.lightCSS, debugSettings.errorCSS);\n } else if (status === 'success') {\n console.log('%c \\u2BC8 Error log: ' + '%c \\u2714 ' + response + ' at ' + new Date().toLocaleString() + ' ', debugSettings.lightCSS, debugSettings.successCSS);\n } else {\n console.log('%c \\u2BC8 Error log: ' + '%c \\u2715 Not created. Title should not be undefined, null or empty ! ', debugSettings.lightCSS, debugSettings.errorCSS);\n }\n }\n }\n\n function generateErrorObject(error) {\n return {\n error: error,\n type: error.name,\n message: error.message,\n inner: error.cause && typeof error.cause === \"object\" && error.cause instanceof Error ? generateErrorObject(error.cause) : []\n }\n }\n\n function getErrorTypeSource(error) {\n var object = generateErrorObject(error);\n var type = null;\n var source = null;\n\n function iterateObj(obj) {\n Object.keys(obj).forEach(function(key){\n if (key === \"error\") {\n if (objectLength(obj[key].stack) !== 0) {\n var stack = obj[key] ? ErrorStackParser.parse(obj[key]) : null;\n source = stack && stack.length > 0 ? stack[0].fileName : null;\n }\n }\n if (key === \"type\") {\n type = obj[key];\n }\n if (key === \"inner\" && obj[key].length !== 0) {\n iterateObj(obj[key]);\n }\n });\n }\n\n iterateObj(object);\n\n return { type: type, source: source };\n }\n\n function GenerateNewFrames(errorMessage, newFrames, cause, fileName) {\n var lastInnerFileName = null;\n\n newFrames.forEach(function(stackFrame, i) {\n if (stackFrame.functionName) {\n var fn = stackFrame.functionName + ' ';\n } else {\n var fn = '';\n }\n var stackString = ' at ' + fn + '(' + stackFrame.fileName + ':' + stackFrame.lineNumber + ':' + stackFrame.columnNumber + ')';\n newFrames[i] = stackString;\n if (i === 0) {\n lastInnerFileName = stackFrame.fileName || null;\n }\n });\n \n if (!cause) {\n newFrames.unshift(errorMessage);\n } else {\n newFrames.unshift(\"\\nCaused by: \" + errorMessage);\n }\n\n if (fileName) {\n return {\n newFrames: newFrames,\n fileName: lastInnerFileName\n }\n }\n \n return newFrames;\n }\n\n function GPSPromise(stackframes) {\n var gps = new StackTraceGPS();\n\n return new Promise(function(resolve) {\n resolve(Promise.all(stackframes.map(function(sf) {\n return new Promise(function(resolve) {\n function resolveOriginal() {\n resolve(sf);\n }\n gps.pinpoint(sf).then(resolve, resolveOriginal)['catch'](resolveOriginal);\n });\n })));\n });\n }\n\n function stackGPS(error, xhr, jsonData) {\n var object = generateErrorObject(error);\n var messagesArr = [];\n var promiseArr = [];\n\n function iterateObj(obj) {\n Object.keys(obj).forEach(function(key){\n if (key === \"error\") {\n if (objectLength(obj[key].stack) !== 0) {\n messagesArr.push(obj[key].toString().split(\"\\n\")[0]);\n promiseArr.push(GPSPromise(ErrorStackParser.parse(obj[key])));\n }\n }\n if (key === \"inner\" && obj[key].length !== 0) {\n iterateObj(obj[key]);\n }\n });\n }\n\n iterateObj(object);\n\n Promise.all(promiseArr).then((values) => {\n values.forEach(function(stackframe, index) {\n if (index === 0) {\n jsonData.detail = GenerateNewFrames(messagesArr[index], stackframe, false).join(\"\\n\");\n } else {\n jsonData.detail += GenerateNewFrames(messagesArr[index], stackframe, true).join(\"\\n\");\n }\n });\n }).then(function() {\n xhr.send(JSON.stringify(jsonData));\n });\n }\n\n function stackString(error) {\n \tvar typeOF = typeof error.error;\n \tvar typeOFCapitalized = typeOF.charAt(0).toUpperCase() + typeOF.slice(1);\n\n \treturn typeOFCapitalized + ': ' + error.error + '\\n' + ' at ' + '(' + error.source + ':' + error.lineno + ':' + error.colno + ')';\n }\n\n function manipulateStack (errorStack, severity, message) {\n var stack = [];\n for (var i = 0; i < errorStack.length; i++) {\n if(errorStack[i] === \"Error\") {\n stack.push(severity + \": \" + message);\n }\n if(!errorStack[i].match(/elmahio.js|elmahio.min.js/g) && errorStack[i] !== \"Error\") {\n stack.push(errorStack[i]);\n }\n }\n return stack.join('\\n');\n }\n\n function guid() {\n var s4 = function() {\n return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1).toUpperCase();\n }\n return s4() + s4();\n }\n\n function inspectorObj (error, fullError) {\n var obj = {};\n obj.Id = guid();\n\n if (typeof error === \"object\") {\n var stack = error && objectLength(error.stack) !== 0 && typeof error === \"object\" ? ErrorStackParser.parse(error) : '';\n obj.Type = error.name;\n obj.Message = error.message;\n obj.StackTrace = objectLength(error.stack) !== 0 ? ErrorStackParser.parse(error) : null;\n obj.Source = stack && stack.length > 0 ? stack[0].fileName : null;\n obj.Inners = error.cause && typeof error.cause === \"object\" && error.cause instanceof Error ? [inspectorObj(error.cause)] : [];\n } else {\n obj.Type = typeof fullError.error;\n obj.Message = fullError.message;\n obj.StackTrace = stackString(fullError);\n obj.Source = fullError.source;\n obj.Inners = [];\n }\n\n return obj;\n }\n\n function inspectorGPS (error) {\n var inspectorObject = inspectorObj(error);\n var promiseArr = [];\n\n function iterateObj(obj, final) {\n Object.keys(obj).forEach(function(key){\n if (key === \"StackTrace\") {\n if (!final) {\n obj[key] = GPSPromise(obj[key]);\n promiseArr.push(obj[key]);\n } else {\n obj[key].then(result => {\n var generateNewFrames = GenerateNewFrames(obj.Type + ': ' + obj.Message, result, false, true);\n obj[key] = generateNewFrames.newFrames.join(\"\\n\");\n obj['Source'] = generateNewFrames.fileName || null;\n });\n }\n }\n if (key === \"Inners\" && obj[key].length !== 0) {\n iterateObj(obj[key][0], final);\n }\n });\n }\n\n iterateObj(inspectorObject, false);\n\n return new Promise(function(resolve, reject) {\n Promise.all(promiseArr).then(function(values) {\n iterateObj(inspectorObject, true);\n }).then(function() {\n resolve(inspectorObject);\n });\n });\n }\n\n // Private methods\n\n var recordBreadcrumb = function(obj) {\n var crumb = merge_objects({'dateTime': new Date().toISOString()}, obj),\n breadcrumbs_number = 10;\n \n breadcrumbs.push(crumb);\n \n if(options.breadcrumbsNumber >= 0 && typeof options.breadcrumbsNumber === \"number\" ) {\n if(options.breadcrumbsNumber > 25) {\n breadcrumbs_number = 25;\n } else if(options.breadcrumbsNumber <= 25) {\n breadcrumbs_number = options.breadcrumbsNumber;\n }\n }\n \n if (breadcrumbs.length > breadcrumbs_number) {\n breadcrumbs.shift();\n }\n }\n\n var breadcrumbClickEventHandler = function(evt) {\n var target;\n try {\n target = cssSelectorString(evt.target);\n } catch (e) {\n target = \"\";\n }\n\n recordBreadcrumb({\n \"severity\": \"Information\",\n \"action\": \"Click\",\n \"message\": target\n });\n }\n\n var breadcrumbFormSubmitEventHandler = function(evt) {\n var target;\n try {\n target = cssSelectorString(evt.target);\n } catch (e) {\n target = \"\";\n }\n\n recordBreadcrumb({\n \"severity\": \"Information\",\n \"action\": \"Form submit\",\n \"message\": target\n });\n }\n\n var breadcrumbWindowEventHandler = function(evt) {\n var type = evt.type,\n message = null;\n\n switch (type) {\n case \"load\":\n message = \"Page loaded\"; break;\n case \"DOMContentLoaded\":\n message = \"DOMContentLoaded\"; break;\n case \"pageshow\":\n message = \"Page shown\"; break;\n case \"pagehide\":\n message = \"Page hidden\"; break;\n case \"popstate\":\n message = \"Navigated from: \" + lastHref + \" to: \" + window.location.href; break;\n }\n\n recordBreadcrumb({\n \"severity\": \"Information\",\n \"action\": \"Navigation\",\n \"message\": message\n });\n }\n\n var breadcrumbHashChangeEventHandler = function(evt) {\n var oldURL = evt.oldURL,\n newURL = evt.newURL,\n from = null,\n to = null,\n message = null;\n\n if (oldURL && newURL) {\n from = parseHash(oldURL);\n to = parseHash(newURL);\n message = \"from: '\" + from + \"' to: '\" + to + \"'\";\n } else {\n to = location.hash;\n message = \"to: '\" + to + \"'\";\n }\n\n recordBreadcrumb({\n \"severity\": \"Information\",\n \"action\": \"Navigation\",\n \"message\": \"Hash changed \" + message\n });\n }\n\n var breadcrumbXHRHandler = function(evt, method, url) {\n var status = evt && evt.target ? evt.target.status : 0,\n severity = null,\n method = method.toUpperCase(),\n url = url,\n regex = /https:\\/\\/api.elmah.io/g;\n\n if(url.match(regex) == null) { \n if (status > 0 && status < 400) {\n severity = \"Information\";\n } else if (status > 399 && status < 500) {\n severity = \"Warning\";\n } else if (status >= 500) {\n severity = \"Error\";\n }\n\n var statusCode = status > 0 ? \" (\" + status + \")\" : \"\";\n\n recordBreadcrumb({\n \"severity\": severity,\n \"action\": \"Request\",\n \"message\": \"[\" + method + \"] \" + url + statusCode\n });\n }\n }\n\n var sendPayload = function (apiKey, logId, callback, errorLog) {\n var api_key = apiKey,\n log_id = logId,\n error = errorLog,\n send = 1,\n queryParams = getSearchParameters(),\n stack = error.error && objectLength(error.error.stack) !== 0 && typeof error.error === \"object\" ? ErrorStackParser.parse(error.error) : '';\n\n // Ignoring error from an external script\n if (error && error.colno === 0 && error.lineno === 0 && (!stack || stack === '') && error.message && (error.message === \"Script error.\" || error.message === \"Script error\")) {\n\t\t\t if (settings.debug) {\n\t\t\t console.log('%c \\u2BC8 Error log: ' + '%c \\uD83D\\uDEC8 Ignoring error from external script ', debugSettings.lightCSS, debugSettings.warningCSS);\n\t\t\t }\n\t\t\t return;\n\t\t\t}\n\n if ((api_key !== null && log_id !== null) || (paramsLength === 2)) {\n\n // Priority for parameters\n if (params.hasOwnProperty('apiKey') && params.hasOwnProperty('logId')) {\n api_key = params['apiKey'];\n log_id = params['logId'];\n }\n\n // get new XHR object\n var xhr = new XMLHttpRequest();\n xhr.open(\"POST\", \"https://api.elmah.io/v3/messages/\" + log_id + \"?api_key=\" + api_key, true);\n\n xhr.setRequestHeader('Content-type', 'application/json');\n\n xhr.onload = function (e) {\n if (xhr.readyState === 4) {\n if (xhr.status === 201) {\n callback('success', xhr.statusText);\n }\n\n if(xhr.status >= 400 && xhr.status <= 499) {\n callback('error', xhr.statusText);\n\n // on error event\n publicAPIs.emit('error', xhr.status, xhr.statusText);\n }\n }\n };\n\n xhr.onerror = function (e) {\n callback('error', xhr.statusText);\n\n // on error event\n publicAPIs.emit('error', xhr.status, xhr.statusText);\n }\n\n var jsonData = {\n \"detail\": error.error ? error.error.stack : null,\n \"title\": error.message || 'Unspecified error',\n \"source\": stack && stack.length > 0 ? stack[0].fileName : null,\n \"severity\": \"Error\",\n \"type\": error.error ? error.error.name : null,\n \"queryString\": JSON.parse(JSON.stringify(queryParams))\n };\n\n // Check if error sent is a string and not an object\n // Then create the articifial stacktrace and pass source & type of the error\n if(error.error && (objectLength(error.error.stack) === 0) && typeof jsonData.detail === \"undefined\") {\n \tvar typeOF = typeof errorLog.error;\n \t\t\tvar typeOFCapitalized = typeOF.charAt(0).toUpperCase() + typeOF.slice(1);\n\n \tjsonData.detail = stackString(errorLog);\n \tjsonData.source = errorLog.source;\n jsonData.title = \"Uncaught \" + typeOFCapitalized + \": \" + errorLog.error;\n }\n\n // Check if the error sent has a cause\n // Then change the type and source with the most inner error type\n if(error.error && error.error.cause && typeof error.error.cause === \"object\" && error.error.cause instanceof Error) {\n var typeAndSource = getErrorTypeSource(error.error);\n jsonData.type = typeAndSource.type;\n jsonData.source = typeAndSource.source;\n }\n\n // Add payload to jsonData\n jsonData = merge_objects(jsonData, getPayload());\n\n // Add breadcrumbs to jsonData\n if(breadcrumbs.length > 0) {\n jsonData.breadcrumbs = breadcrumbs;\n breadcrumbs = [];\n }\n\n // filter callback\n if (settings.filter !== null) {\n if (settings.filter(jsonData)) {\n send = 0;\n }\n }\n\n if (send === 1) {\n // on message event\n publicAPIs.emit('message', jsonData);\n\n if (error.error && typeof error.error === \"object\" && objectLength(error.error.stack) !== 0 && typeof Promise !== \"undefined\" && Promise.toString().indexOf(\"[native code]\") !== -1) {\n // try to pinpoint stackframes from error object\n inspectorGPS(error.error).then((result) => {\n // Add inspector to jsonData\n jsonData.data.push({ \"key\": \"X-ELMAHIO-EXCEPTIONINSPECTOR\", \"value\": JSON.stringify(result) });\n // send message trying to pinpoint stackframes\n stackGPS(error.error, xhr, jsonData);\n });\n\t } else {\n // Add inspector to jsonData\n jsonData.data.push({ \"key\": \"X-ELMAHIO-EXCEPTIONINSPECTOR\", \"value\": JSON.stringify(inspectorObj(error.error, errorLog)) });\n\t \t// send message\n \txhr.send(JSON.stringify(jsonData));\n\t }\n }\n\n } else {\n return console.log('Login api error');\n }\n };\n\n var sendManualPayload = function (apiKey, logId, callback, logType, messageLog, errorLog) {\n var api_key = apiKey,\n log_id = logId,\n type = logType,\n error = errorLog,\n message = messageLog,\n send = 1,\n queryParams = getSearchParameters();\n\n if ((api_key !== null && log_id !== null) || (paramsLength === 2)) {\n\n // Priority for parameters\n if (params.hasOwnProperty('apiKey') && params.hasOwnProperty('logId')) {\n api_key = params['apiKey'];\n log_id = params['logId'];\n }\n\n // get new XHR object\n var xhr = new XMLHttpRequest();\n xhr.open(\"POST\", \"https://api.elmah.io/v3/messages/\" + log_id + \"?api_key=\" + api_key, true);\n xhr.setRequestHeader('Content-type', 'application/json');\n\n xhr.onload = function (e) {\n if (xhr.readyState === 4) {\n if (xhr.status === 201) {\n callback('success', xhr.statusText);\n }\n\n if(xhr.status >= 400 && xhr.status <= 499) {\n callback('error', xhr.statusText);\n\n // on error event\n publicAPIs.emit('error', xhr.status, xhr.statusText);\n }\n }\n };\n\n xhr.onerror = function (e) {\n callback('error', xhr.statusText);\n\n // on error event\n publicAPIs.emit('error', xhr.status, xhr.statusText);\n }\n\n if (type !== \"Log\") {\n\n var stack = error && error instanceof Error && objectLength(error.stack) !== 0 ? ErrorStackParser.parse(error) : null;\n\n var jsonData = {\n \"title\": message,\n \"source\": stack && stack.length > 0 ? stack[0].fileName : null,\n \"detail\": error ? error.stack : null,\n \"severity\": type,\n \"type\": error ? error.name : null,\n \"queryString\": JSON.parse(JSON.stringify(queryParams))\n };\n\n // Check if the error sent has a cause\n // Then change the type and source with the most inner error type\n if(error && error.cause && typeof error.cause === \"object\" && error.cause instanceof Error) {\n var typeAndSource = getErrorTypeSource(error);\n jsonData.type = typeAndSource.type;\n jsonData.source = typeAndSource.source;\n }\n\n // Add payload to jsonData\n jsonData = merge_objects(jsonData, getPayload());\n\n } else {\n\n var jsonData = error;\n \n }\n\n // filter callback\n if (settings.filter !== null) {\n if (settings.filter(jsonData)) {\n send = 0;\n }\n }\n\n if (send === 1) {\n if (jsonData.title) {\n\n // Add breadcrumbs to jsonData\n if(breadcrumbs.length > 0) {\n // If message contains breadcrumbs\n if(jsonData.breadcrumbs && jsonData.breadcrumbs.length > 0) {\n breadcrumbs = breadcrumbs.reverse();\n for (var i = 0; i < breadcrumbs.length; i++) {\n // Add breadcrumbs to jsonData object\n jsonData.breadcrumbs.unshift(breadcrumbs[i]);\n }\n } else {\n jsonData.breadcrumbs = breadcrumbs;\n }\n \n // Reset breadcrumbs\n breadcrumbs = [];\n }\n\n // on message event\n publicAPIs.emit('message', jsonData);\n\n if (error && error instanceof Error && type !== \"Log\" && typeof Promise !== \"undefined\" && Promise.toString().indexOf(\"[native code]\") !== -1) {\n // try to pinpoint stackframes from error object\n inspectorGPS(error).then((result) => {\n // Add inspector to jsonData\n jsonData.data.push({ \"key\": \"X-ELMAHIO-EXCEPTIONINSPECTOR\", \"value\": JSON.stringify(result) });\n // send message trying to pinpoint stackframes\n stackGPS(error, xhr, jsonData);\n });\n } else {\n // send message\n if(jsonData.errorObject && jsonData.errorObject instanceof Error) {\n error = jsonData.errorObject;\n delete jsonData.errorObject;\n // try to pinpoint stackframes from error object\n inspectorGPS(error).then((result) => {\n // Add inspector to jsonData\n jsonData.data.push({ \"key\": \"X-ELMAHIO-EXCEPTIONINSPECTOR\", \"value\": JSON.stringify(result) });\n // send message trying to pinpoint stackframes\n stackGPS(error, xhr, jsonData);\n });\n } else {\n delete jsonData.errorObject;\n xhr.send(JSON.stringify(jsonData));\n }\n }\n\n } else {\n callback('missing-title', xhr.statusText);\n }\n }\n\n } else {\n return console.log('Login api error');\n }\n };\n\n var sendPayloadFromConsole = function (apiKey, logId, callback, logType, errorLog) {\n var api_key = apiKey,\n log_id = logId,\n message = errorLog.message,\n messageTemplate = errorLog.message,\n type = logType,\n args = Object.values(errorLog.arguments),\n send = 1,\n queryParams = getSearchParameters();\n\n function format(f, args) {\n var formatRegExp = /%[sdif]/g;\n var str = f;\n\n if(args.length > 1) {\n // If message has placeholders (%s, %d, %i, %f), check for arguments and replace them\n if(String(f).match(/%[sdif]/g)) {\n var i = 0;\n str = String(f).replace(formatRegExp, function(x) {\n switch (x) {\n case '%s': i++; return args[i] ? String(args[i]) : '%s';\n case '%d': i++; return args[i] ? (isInt(args[i]) || isFloat(args[i])) ? parseInt(args[i]) : 'NaN' : '%d';\n case '%i': i++; return args[i] ? (isInt(args[i]) || isFloat(args[i])) ? parseInt(args[i]) : 'NaN' : '%i';\n case '%f': i++; return args[i] ? (isInt(args[i]) || isFloat(args[i])) ? parseFloat(args[i]) : 'NaN' : '%f';\n default: return x;\n }\n });\n\n for (var len = args.length, x = args[++i]; i < len; x = args[++i]) {\n if (x === null || typeof x !== 'object') {\n str += ' ' + x;\n } else {\n str += ' ' + String(Object.prototype.toString.call(x));\n }\n }\n } else {\n str = args.join(' ');\n }\n }\n\n return str;\n }\n\n message = format(message, args);\n\n if(typeof message !== \"string\" && message !== undefined){\n message = message.toString();\n }\n\n if(typeof messageTemplate !== \"string\" && messageTemplate !== undefined) {\n messageTemplate = messageTemplate.toString();\n }\n\n if ((api_key !== null && log_id !== null) || (paramsLength === 2)) {\n\n // Priority for parameters\n if (params.hasOwnProperty('apiKey') && params.hasOwnProperty('logId')) {\n api_key = params['apiKey'];\n log_id = params['logId'];\n }\n\n // get new XHR object\n var xhr = new XMLHttpRequest();\n xhr.open(\"POST\", \"https://api.elmah.io/v3/messages/\" + log_id + \"?api_key=\" + api_key, true);\n xhr.setRequestHeader('Content-type', 'application/json');\n\n xhr.onload = function (e) {\n if (xhr.readyState === 4) {\n if (xhr.status === 201) {\n callback('success', xhr.statusText);\n }\n\n if(xhr.status >= 400 && xhr.status <= 499) {\n callback('error', xhr.statusText);\n\n // on error event\n publicAPIs.emit('error', xhr.status, xhr.statusText);\n }\n }\n };\n\n xhr.onerror = function (e) {\n callback('error', xhr.statusText);\n // on error event\n publicAPIs.emit('error', xhr.status, xhr.statusText);\n }\n\n var jsonData = {\n \"title\": message,\n \"titleTemplate\": messageTemplate,\n \"detail\": manipulateStack(new Error().stack.split('\\n'), type, message),\n \"severity\": type,\n \"type\": null,\n \"queryString\": JSON.parse(JSON.stringify(queryParams))\n };\n\n // Add payload to jsonData\n jsonData = merge_objects(jsonData, getPayload());\n\n // Add breadcrumbs to jsonData\n if(breadcrumbs.length > 0) {\n jsonData.breadcrumbs = breadcrumbs;\n breadcrumbs = [];\n }\n\n // filter callback\n if (settings.filter !== null) {\n if (settings.filter(jsonData)) {\n send = 0;\n }\n }\n\n if (send === 1) {\n if (jsonData.title) {\n // on message event\n publicAPIs.emit('message', jsonData);\n // send message\n xhr.send(JSON.stringify(jsonData));\n } else {\n callback('missing-title', xhr.statusText);\n }\n }\n\n } else {\n return console.log('Login api error');\n }\n };\n\n var sendPrefilledLogMessage = function(errorLog) {\n // without error object\n if(!errorLog) return getPayload();\n\n // with error object\n var error = errorLog;\n var stack = error && objectLength(error.stack) !== 0 ? ErrorStackParser.parse(error) : null;\n var jsonData = {\n \"title\": error.message,\n \"source\": stack && stack.length > 0 ? stack[0].fileName : null,\n \"detail\": error ? error.stack : null,\n \"severity\": \"Error\",\n \"type\": error ? error.name : null,\n \"errorObject\": error\n };\n\n // Check if the error sent has a cause\n // Then change the type and source with the most inner error type\n if(error && error.cause && typeof error.cause === \"object\" && error.cause instanceof Error) {\n var typeAndSource = getErrorTypeSource(error);\n jsonData.type = typeAndSource.type;\n jsonData.source = typeAndSource.source;\n }\n\n jsonData = merge_objects(jsonData, getPayload());\n \n return jsonData;\n };\n\n // Some public methods\n\n publicAPIs.error = function (msg, error) {\n setTimeout(function() { sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Error', msg, error); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n };\n publicAPIs.verbose = function (msg, error) {\n setTimeout(function() { sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Verbose', msg, error); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n };\n publicAPIs.debug = function (msg, error) {\n setTimeout(function() { sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Debug', msg, error); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n };\n publicAPIs.information = function (msg, error) {\n setTimeout(function() { sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Information', msg, error); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n };\n publicAPIs.warning = function (msg, error) {\n setTimeout(function() { sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Warning', msg, error); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n };\n publicAPIs.fatal = function (msg, error) {\n setTimeout(function() { sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Fatal', msg, error); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n };\n publicAPIs.log = function (obj) {\n setTimeout(function() { sendManualPayload(settings.apiKey, settings.logId, confirmResponse, 'Log', null, obj); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n };\n publicAPIs.message = function(error) {\n return sendPrefilledLogMessage(error);\n };\n publicAPIs.addBreadcrumb = function(msg, severity, evt) {\n recordBreadcrumb({\n \"severity\": (severity != undefined && isString(severity)) ? severity : \"Information\",\n \"action\": (evt != undefined && isString(evt)) ? evt : \"Log\",\n \"message\": (msg != undefined && isString(msg)) ? msg : \"This is just a test message.\"\n });\n };\n\n publicAPIs.on = function (name, callback, ctx) {\n var e = this.e || (this.e = {});\n\n (e[name] || (e[name] = [])).push({\n fn: callback,\n ctx: ctx\n });\n\n return this;\n };\n\n publicAPIs.emit = function (name) {\n var data = [].slice.call(arguments, 1);\n var evtArr = ((this.e || (this.e = {}))[name] || []).slice();\n var i = 0;\n var len = evtArr.length;\n\n for (i; i < len; i++) {\n evtArr[i].fn.apply(evtArr[i].ctx, data);\n }\n\n return this;\n };\n\n publicAPIs.init = function (options) {\n\n // -- Merge options into defaults\n settings = extend(defaults, options || {});\n\n // -- Breadcrumbs\n if (settings.breadcrumbs) {\n // Breadcrumbs - Click & Submit form\n if (document.addEventListener) {\n document.addEventListener('click', breadcrumbClickEventHandler, false);\n document.addEventListener('submit', breadcrumbFormSubmitEventHandler, false);\n } else if (document.attachEvent) {\n document.attachEvent('click', breadcrumbClickEventHandler, false);\n document.attachEvent('submit', breadcrumbFormSubmitEventHandler, false);\n }\n\n // Breadcrumbs - Navigation\n if (window.addEventListener) {\n window.addEventListener('load', breadcrumbWindowEventHandler, false);\n window.addEventListener('DOMContentLoaded', breadcrumbWindowEventHandler, false);\n window.addEventListener('pageshow', breadcrumbWindowEventHandler, false);\n window.addEventListener('pagehide', breadcrumbWindowEventHandler, false);\n window.addEventListener('hashchange', breadcrumbHashChangeEventHandler, false);\n } else if (window.attachEvent) {\n window.attachEvent('load', breadcrumbWindowEventHandler, false);\n window.attachEvent('DOMContentLoaded', breadcrumbWindowEventHandler, false);\n window.attachEvent('pageshow', breadcrumbWindowEventHandler, false);\n window.attachEvent('pagehide', breadcrumbWindowEventHandler, false);\n window.attachEvent('hashchange', breadcrumbHashChangeEventHandler, false);\n }\n\n if(window.history && window.history.pushState && window.history.replaceState) {\n var old_onpopstate = window.onpopstate;\n window.onpopstate = function(evt) {\n breadcrumbWindowEventHandler(evt);\n if (old_onpopstate) {\n return old_onpopstate.apply(this, arguments);\n }\n };\n }\n\n // Breadcrumbs - XHR\n if(window.XMLHttpRequest && window.XMLHttpRequest.prototype) {\n // Store a reference to the native method\n var open = XMLHttpRequest.prototype.open;\n \n // Overwrite the native method\n XMLHttpRequest.prototype.open = function(method, url) {\n // Assign an event listener\n this.addEventListener(\"loadend\", function(event) { breadcrumbXHRHandler(event, method, url); }, false);\n // Call the stored reference to the native method\n open.apply(this, arguments);\n };\n }\n }\n\n // -- Log on window error\n window.onerror = function (message, source, lineno, colno, error) {\n var errorLog = {\n 'message': message,\n 'source': source,\n 'lineno': lineno,\n 'colno': colno,\n 'error': error\n };\n \n setTimeout(function() { sendPayload(settings.apiKey, settings.logId, confirmResponse, errorLog); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n\n return false;\n }\n\n // -- Log on window unhandled rejection\n window.onunhandledrejection = function (event) {\n var errorLog = {\n 'message': event.reason.message,\n 'error': event.reason.message && event.reason.stack ? event.reason : undefined\n };\n\n setTimeout(function() { sendPayload(settings.apiKey, settings.logId, confirmResponse, errorLog); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n\n return false;\n }\n\n // -- Overriding console methods\n // -- Then log messages into the app.elmah.io\n if(options && options.captureConsoleMinimumLevel !== \"none\") {\n\n // If captureConsoleMinimumLevel: info or debug is set (error, warn)\n if(options.captureConsoleMinimumLevel === \"info\" || options.captureConsoleMinimumLevel === \"warn\" || options.captureConsoleMinimumLevel === \"error\" || options.captureConsoleMinimumLevel === \"debug\") {\n // Log console errors\n var _error = console.error;\n console.error = function(errMessage){\n var errorLog = {\n \t\t'message': errMessage,\n \t\t'arguments': arguments\n \t}\n setTimeout(function() { sendPayloadFromConsole(settings.apiKey, settings.logId, confirmResponse, 'Error', errorLog); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n _error.apply(console, arguments);\n };\n if(options.captureConsoleMinimumLevel !== \"error\") {\n // Log console warnings\n var _warning = console.warn;\n console.warn = function(warnMessage){\n var errorLog = {\n 'message': warnMessage,\n 'arguments': arguments\n }\n setTimeout(function() { sendPayloadFromConsole(settings.apiKey, settings.logId, confirmResponse, 'Warning', errorLog); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n _warning.apply(console, arguments);\n };\n }\n }\n if(options.captureConsoleMinimumLevel === \"info\" || options.captureConsoleMinimumLevel === \"debug\") {\n // Log console info\n var _info = console.info;\n console.info = function(infoMessage){\n var errorLog = {\n \t\t'message': infoMessage,\n \t\t'arguments': arguments\n \t}\n setTimeout(function() { sendPayloadFromConsole(settings.apiKey, settings.logId, confirmResponse, 'Information', errorLog); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n _info.apply(console, arguments);\n };\n }\n if(options.captureConsoleMinimumLevel === \"debug\") {\n // Log console debug\n var _debug = console.debug;\n console.debug = function(debugMessage){\n var errorLog = {\n \t\t'message': debugMessage,\n \t\t'arguments': arguments\n \t}\n setTimeout(function() { sendPayloadFromConsole(settings.apiKey, settings.logId, confirmResponse, 'Debug', errorLog); }, settings.breadcrumbs ? breadcrumbsDelay : 0);\n _debug.apply(console, arguments);\n };\n }\n }\n };\n\n // Initialize the plugin\n publicAPIs.init(options);\n\n if (settings.debug) {\n console.log('%c' + debugSettings.label, debugSettings.labelCSS);\n }\n\n // Return the public APIs\n return publicAPIs;\n\n };\n\n\n //\n // Return the constructor\n //\n\n if (paramsLength && params.hasOwnProperty('apiKey') && params.hasOwnProperty('logId')) {\n // Immediately-Invoked Function Expression (IIFE)\n return new Constructor;\n } else {\n // UMD Constructor\n return Constructor;\n }\n\n});"],"file":"elmahio.min.js"} \ No newline at end of file diff --git a/elmah.io.javascript.nuspec b/elmah.io.javascript.nuspec index 7330f6e..2d7b915 100644 --- a/elmah.io.javascript.nuspec +++ b/elmah.io.javascript.nuspec @@ -1,7 +1,7 @@  - 3.7.1 + 4.0.0 elmah.io elmah.io elmah.io.javascript diff --git a/package.json b/package.json index 91f52e8..fb163dd 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "elmah.io.javascript", "description": "elmah.io javascript logger.", - "version": "3.7.1", + "version": "4.0.0", "repository": "https://github.com/elmahio/elmah.io.javascript", "license": "Apache-2.0", "main": "dist/elmahio.js", diff --git a/src/elmahio.js b/src/elmahio.js index 46140ef..1c670a2 100644 --- a/src/elmahio.js +++ b/src/elmahio.js @@ -1,5 +1,5 @@ /*! - * elmah.io Javascript Logger - version 3.7.1 + * elmah.io Javascript Logger - version 4.0.0 * (c) 2018 elmah.io, Apache 2.0 License, https://elmah.io */ @@ -134,51 +134,59 @@ // var ErrorStackParser = (function () { - "use strict"; - var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+\:\d+/; - var CHROME_IE_STACK_REGEXP = /^\s*at .*(\S+\:\d+|\(native\))/m; - var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code\])?$/; + 'use strict'; + var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/; + var CHROME_IE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m; + var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code])?$/; + return { /** - * Given an Error object, extract the most information from it. - * - * @param {Error} error object - * @return {Array} of StackFrames - */ + * Given an Error object, extract the most information from it. + * + * @param {Error} error object + * @return {Array} of StackFrames + */ parse: function ErrorStackParser$$parse(error) { - if (typeof error.stacktrace !== "undefined" || typeof error["opera#sourceloc"] !== "undefined") { + if (typeof error.stacktrace !== 'undefined' || typeof error['opera#sourceloc'] !== 'undefined') { return this.parseOpera(error); } else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) { return this.parseV8OrIE(error); } else if (error.stack) { return this.parseFFOrSafari(error); } else { - throw new Error("Cannot parse given Error object"); + throw new Error('Cannot parse given Error object'); } }, // Separate line and column numbers from a string of the form: (URI:Line:Column) extractLocation: function ErrorStackParser$$extractLocation(urlLike) { // Fail-fast but return locations like "(native)" - if (urlLike.indexOf(":") === -1) { + if (urlLike.indexOf(':') === -1) { return [urlLike]; } - var regExp = /(.+?)(?:\:(\d+))?(?:\:(\d+))?$/; - var parts = regExp.exec(urlLike.replace(/[\(\)]/g, "")); + var regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/; + var parts = regExp.exec(urlLike.replace(/[()]/g, '')); return [parts[1], parts[2] || undefined, parts[3] || undefined]; }, parseV8OrIE: function ErrorStackParser$$parseV8OrIE(error) { - var filtered = error.stack.split("\n").filter(function (line) { + var filtered = error.stack.split('\n').filter(function(line) { return !!line.match(CHROME_IE_STACK_REGEXP); }, this); - return filtered.map(function (line) { - if (line.indexOf("(eval ") > -1) { + return filtered.map(function(line) { + if (line.indexOf('(eval ') > -1) { // Throw away eval information until we implement stacktrace.js/stackframe#8 - line = line.replace(/eval code/g, "eval").replace(/(\(eval at [^\()]*)|(\)\,.*$)/g, ""); + line = line.replace(/eval code/g, 'eval').replace(/(\(eval at [^()]*)|(,.*$)/g, ''); } - var tokens = line.replace(/^\s+/, "").replace(/\(eval code/g, "(").split(/\s+/).slice(1); - var locationParts = this.extractLocation(tokens.pop()); - var functionName = tokens.join(" ") || undefined; - var fileName = ["eval", ""].indexOf(locationParts[0]) > -1 ? undefined : locationParts[0]; + var sanitizedLine = line.replace(/^\s+/, '').replace(/\(eval code/g, '(').replace(/^.*?\s+/, ''); + // capture and preseve the parenthesized location "(/foo/my bar.js:12:87)" in + // case it has spaces in it, as the string is split on \s+ later on + var location = sanitizedLine.match(/ (\(.+\)$)/); + // remove the parenthesized location from the line, if it was matched + sanitizedLine = location ? sanitizedLine.replace(location[0], '') : sanitizedLine; + // if a location was matched, pass it to extractLocation() otherwise pass all sanitizedLine + // because this line doesn't have function name + var locationParts = this.extractLocation(location ? location[1] : sanitizedLine); + var functionName = location && sanitizedLine || undefined; + var fileName = ['eval', ''].indexOf(locationParts[0]) > -1 ? undefined : locationParts[0]; return new StackFrame({ functionName: functionName, fileName: fileName, @@ -189,15 +197,15 @@ }, this); }, parseFFOrSafari: function ErrorStackParser$$parseFFOrSafari(error) { - var filtered = error.stack.split("\n").filter(function (line) { + var filtered = error.stack.split('\n').filter(function(line) { return !line.match(SAFARI_NATIVE_CODE_REGEXP); }, this); - return filtered.map(function (line) { + return filtered.map(function(line) { // Throw away eval information until we implement stacktrace.js/stackframe#8 - if (line.indexOf(" > eval") > -1) { - line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g, ":$1"); + if (line.indexOf(' > eval') > -1) { + line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ':$1'); } - if (line.indexOf("@") === -1 && line.indexOf(":") === -1) { + if (line.indexOf('@') === -1 && line.indexOf(':') === -1) { // Safari eval frames only have function names and nothing else return new StackFrame({ functionName: line @@ -206,7 +214,7 @@ var functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/; var matches = line.match(functionNameRegex); var functionName = matches && matches[1] ? matches[1] : undefined; - var locationParts = this.extractLocation(line.replace(functionNameRegex, "")); + var locationParts = this.extractLocation(line.replace(functionNameRegex, '')); return new StackFrame({ functionName: functionName, fileName: locationParts[0], @@ -218,7 +226,8 @@ }, this); }, parseOpera: function ErrorStackParser$$parseOpera(e) { - if (!e.stacktrace || e.message.indexOf("\n") > -1 && e.message.split("\n").length > e.stacktrace.split("\n").length) { + if (!e.stacktrace || (e.message.indexOf('\n') > -1 && + e.message.split('\n').length > e.stacktrace.split('\n').length)) { return this.parseOpera9(e); } else if (!e.stack) { return this.parseOpera10(e); @@ -228,7 +237,7 @@ }, parseOpera9: function ErrorStackParser$$parseOpera9(e) { var lineRE = /Line (\d+).*script (?:in )?(\S+)/i; - var lines = e.message.split("\n"); + var lines = e.message.split('\n'); var result = []; for (var i = 2, len = lines.length; i < len; i += 2) { var match = lineRE.exec(lines[i]); @@ -244,36 +253,42 @@ }, parseOpera10: function ErrorStackParser$$parseOpera10(e) { var lineRE = /Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i; - var lines = e.stacktrace.split("\n"); + var lines = e.stacktrace.split('\n'); var result = []; for (var i = 0, len = lines.length; i < len; i += 2) { var match = lineRE.exec(lines[i]); if (match) { - result.push(new StackFrame({ - functionName: match[3] || undefined, - fileName: match[2], - lineNumber: match[1], - source: lines[i] - })); + result.push( + new StackFrame({ + functionName: match[3] || undefined, + fileName: match[2], + lineNumber: match[1], + source: lines[i] + }) + ); } } return result; }, // Opera 10.65+ Error.stack very similar to FF/Safari parseOpera11: function ErrorStackParser$$parseOpera11(error) { - var filtered = error.stack.split("\n").filter(function (line) { + var filtered = error.stack.split('\n').filter(function(line) { return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) && !line.match(/^Error created at/); }, this); - return filtered.map(function (line) { - var tokens = line.split("@"); + return filtered.map(function(line) { + var tokens = line.split('@'); var locationParts = this.extractLocation(tokens.pop()); - var functionCall = tokens.shift() || ""; - var functionName = functionCall.replace(//, "$2").replace(/\([^\)]*\)/g, "") || undefined; + var functionCall = (tokens.shift() || ''); + var functionName = functionCall + .replace(//, '$2') + .replace(/\([^)]*\)/g, '') || undefined; var argsRaw; - if (functionCall.match(/\(([^\)]*)\)/)) { - argsRaw = functionCall.replace(/^[^\(]+\(([^\)]*)\)$/, "$1"); + if (functionCall.match(/\(([^)]*)\)/)) { + argsRaw = functionCall.replace(/^[^(]+\(([^)]*)\)$/, '$1'); } - var args = argsRaw === undefined || argsRaw === "[arguments not available]" ? undefined : argsRaw.split(","); + var args = (argsRaw === undefined || argsRaw === '[arguments not available]') ? + undefined : argsRaw.split(','); + return new StackFrame({ functionName: functionName, args: args, @@ -848,34 +863,120 @@ } } - function stackGPS(error, xhr, jsonData) { - var errorStack = error.toString().split("\n")[0]; - var gps = new StackTraceGPS(); - var promise = new Promise(function(resolve) { - var stackframes = ErrorStackParser.parse(error); - resolve(Promise.all(stackframes.map(function(sf) { - return new Promise(function(resolve) { - function resolveOriginal() { - resolve(sf); - } - gps.pinpoint(sf).then(resolve, resolveOriginal)['catch'](resolveOriginal); - }); - }))); + function generateErrorObject(error) { + return { + error: error, + type: error.name, + message: error.message, + inner: error.cause && typeof error.cause === "object" && error.cause instanceof Error ? generateErrorObject(error.cause) : [] + } + } + + function getErrorTypeSource(error) { + var object = generateErrorObject(error); + var type = null; + var source = null; + + function iterateObj(obj) { + Object.keys(obj).forEach(function(key){ + if (key === "error") { + if (objectLength(obj[key].stack) !== 0) { + var stack = obj[key] ? ErrorStackParser.parse(obj[key]) : null; + source = stack && stack.length > 0 ? stack[0].fileName : null; + } + } + if (key === "type") { + type = obj[key]; + } + if (key === "inner" && obj[key].length !== 0) { + iterateObj(obj[key]); + } + }); + } + + iterateObj(object); + + return { type: type, source: source }; + } + + function GenerateNewFrames(errorMessage, newFrames, cause, fileName) { + var lastInnerFileName = null; + + newFrames.forEach(function(stackFrame, i) { + if (stackFrame.functionName) { + var fn = stackFrame.functionName + ' '; + } else { + var fn = ''; + } + var stackString = ' at ' + fn + '(' + stackFrame.fileName + ':' + stackFrame.lineNumber + ':' + stackFrame.columnNumber + ')'; + newFrames[i] = stackString; + if (i === 0) { + lastInnerFileName = stackFrame.fileName || null; + } + }); + + if (!cause) { + newFrames.unshift(errorMessage); + } else { + newFrames.unshift("\nCaused by: " + errorMessage); + } + + if (fileName) { + return { + newFrames: newFrames, + fileName: lastInnerFileName + } + } + + return newFrames; + } + + function GPSPromise(stackframes) { + var gps = new StackTraceGPS(); + + return new Promise(function(resolve) { + resolve(Promise.all(stackframes.map(function(sf) { + return new Promise(function(resolve) { + function resolveOriginal() { + resolve(sf); + } + gps.pinpoint(sf).then(resolve, resolveOriginal)['catch'](resolveOriginal); + }); + }))); }); + } + + function stackGPS(error, xhr, jsonData) { + var object = generateErrorObject(error); + var messagesArr = []; + var promiseArr = []; + + function iterateObj(obj) { + Object.keys(obj).forEach(function(key){ + if (key === "error") { + if (objectLength(obj[key].stack) !== 0) { + messagesArr.push(obj[key].toString().split("\n")[0]); + promiseArr.push(GPSPromise(ErrorStackParser.parse(obj[key]))); + } + } + if (key === "inner" && obj[key].length !== 0) { + iterateObj(obj[key]); + } + }); + } + + iterateObj(object); - promise.then(function(newFrames){ - newFrames.forEach(function(stackFrame, i){ - if(stackFrame.functionName) { - var fn = stackFrame.functionName + ' '; - } else { - var fn = ''; - } - var stackString = ' at ' + fn + '(' + stackFrame.fileName + ':' + stackFrame.lineNumber + ':' + stackFrame.columnNumber + ')'; - newFrames[i] = stackString; - }); - newFrames.unshift(errorStack); - jsonData.detail = newFrames.join("\n"); - xhr.send(JSON.stringify(jsonData)); + Promise.all(promiseArr).then((values) => { + values.forEach(function(stackframe, index) { + if (index === 0) { + jsonData.detail = GenerateNewFrames(messagesArr[index], stackframe, false).join("\n"); + } else { + jsonData.detail += GenerateNewFrames(messagesArr[index], stackframe, true).join("\n"); + } + }); + }).then(function() { + xhr.send(JSON.stringify(jsonData)); }); } @@ -899,6 +1000,70 @@ return stack.join('\n'); } + function guid() { + var s4 = function() { + return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1).toUpperCase(); + } + return s4() + s4(); + } + + function inspectorObj (error, fullError) { + var obj = {}; + obj.Id = guid(); + + if (typeof error === "object") { + var stack = error && objectLength(error.stack) !== 0 && typeof error === "object" ? ErrorStackParser.parse(error) : ''; + obj.Type = error.name; + obj.Message = error.message; + obj.StackTrace = objectLength(error.stack) !== 0 ? ErrorStackParser.parse(error) : null; + obj.Source = stack && stack.length > 0 ? stack[0].fileName : null; + obj.Inners = error.cause && typeof error.cause === "object" && error.cause instanceof Error ? [inspectorObj(error.cause)] : []; + } else { + obj.Type = typeof fullError.error; + obj.Message = fullError.message; + obj.StackTrace = stackString(fullError); + obj.Source = fullError.source; + obj.Inners = []; + } + + return obj; + } + + function inspectorGPS (error) { + var inspectorObject = inspectorObj(error); + var promiseArr = []; + + function iterateObj(obj, final) { + Object.keys(obj).forEach(function(key){ + if (key === "StackTrace") { + if (!final) { + obj[key] = GPSPromise(obj[key]); + promiseArr.push(obj[key]); + } else { + obj[key].then(result => { + var generateNewFrames = GenerateNewFrames(obj.Type + ': ' + obj.Message, result, false, true); + obj[key] = generateNewFrames.newFrames.join("\n"); + obj['Source'] = generateNewFrames.fileName || null; + }); + } + } + if (key === "Inners" && obj[key].length !== 0) { + iterateObj(obj[key][0], final); + } + }); + } + + iterateObj(inspectorObject, false); + + return new Promise(function(resolve, reject) { + Promise.all(promiseArr).then(function(values) { + iterateObj(inspectorObject, true); + }).then(function() { + resolve(inspectorObject); + }); + }); + } + // Private methods var recordBreadcrumb = function(obj) { @@ -1095,6 +1260,14 @@ jsonData.title = "Uncaught " + typeOFCapitalized + ": " + errorLog.error; } + // Check if the error sent has a cause + // Then change the type and source with the most inner error type + if(error.error && error.error.cause && typeof error.error.cause === "object" && error.error.cause instanceof Error) { + var typeAndSource = getErrorTypeSource(error.error); + jsonData.type = typeAndSource.type; + jsonData.source = typeAndSource.source; + } + // Add payload to jsonData jsonData = merge_objects(jsonData, getPayload()); @@ -1116,9 +1289,16 @@ publicAPIs.emit('message', jsonData); if (error.error && typeof error.error === "object" && objectLength(error.error.stack) !== 0 && typeof Promise !== "undefined" && Promise.toString().indexOf("[native code]") !== -1) { - // send message trying to pinpoint stackframes - stackGPS(error.error, xhr, jsonData); + // try to pinpoint stackframes from error object + inspectorGPS(error.error).then((result) => { + // Add inspector to jsonData + jsonData.data.push({ "key": "X-ELMAHIO-EXCEPTIONINSPECTOR", "value": JSON.stringify(result) }); + // send message trying to pinpoint stackframes + stackGPS(error.error, xhr, jsonData); + }); } else { + // Add inspector to jsonData + jsonData.data.push({ "key": "X-ELMAHIO-EXCEPTIONINSPECTOR", "value": JSON.stringify(inspectorObj(error.error, errorLog)) }); // send message xhr.send(JSON.stringify(jsonData)); } @@ -1175,7 +1355,7 @@ if (type !== "Log") { - var stack = error && error instanceof Error ? ErrorStackParser.parse(error) : null; + var stack = error && error instanceof Error && objectLength(error.stack) !== 0 ? ErrorStackParser.parse(error) : null; var jsonData = { "title": message, @@ -1186,6 +1366,14 @@ "queryString": JSON.parse(JSON.stringify(queryParams)) }; + // Check if the error sent has a cause + // Then change the type and source with the most inner error type + if(error && error.cause && typeof error.cause === "object" && error.cause instanceof Error) { + var typeAndSource = getErrorTypeSource(error); + jsonData.type = typeAndSource.type; + jsonData.source = typeAndSource.source; + } + // Add payload to jsonData jsonData = merge_objects(jsonData, getPayload()); @@ -1226,14 +1414,25 @@ publicAPIs.emit('message', jsonData); if (error && error instanceof Error && type !== "Log" && typeof Promise !== "undefined" && Promise.toString().indexOf("[native code]") !== -1) { - // send message trying to pinpoint stackframes - stackGPS(error, xhr, jsonData); + // try to pinpoint stackframes from error object + inspectorGPS(error).then((result) => { + // Add inspector to jsonData + jsonData.data.push({ "key": "X-ELMAHIO-EXCEPTIONINSPECTOR", "value": JSON.stringify(result) }); + // send message trying to pinpoint stackframes + stackGPS(error, xhr, jsonData); + }); } else { // send message if(jsonData.errorObject && jsonData.errorObject instanceof Error) { error = jsonData.errorObject; delete jsonData.errorObject; - stackGPS(error, xhr, jsonData); + // try to pinpoint stackframes from error object + inspectorGPS(error).then((result) => { + // Add inspector to jsonData + jsonData.data.push({ "key": "X-ELMAHIO-EXCEPTIONINSPECTOR", "value": JSON.stringify(result) }); + // send message trying to pinpoint stackframes + stackGPS(error, xhr, jsonData); + }); } else { delete jsonData.errorObject; xhr.send(JSON.stringify(jsonData)); @@ -1384,7 +1583,7 @@ // with error object var error = errorLog; - var stack = error ? ErrorStackParser.parse(error) : null; + var stack = error && objectLength(error.stack) !== 0 ? ErrorStackParser.parse(error) : null; var jsonData = { "title": error.message, "source": stack && stack.length > 0 ? stack[0].fileName : null, @@ -1394,6 +1593,14 @@ "errorObject": error }; + // Check if the error sent has a cause + // Then change the type and source with the most inner error type + if(error && error.cause && typeof error.cause === "object" && error.cause instanceof Error) { + var typeAndSource = getErrorTypeSource(error); + jsonData.type = typeAndSource.type; + jsonData.source = typeAndSource.source; + } + jsonData = merge_objects(jsonData, getPayload()); return jsonData; @@ -1521,13 +1728,25 @@ 'lineno': lineno, 'colno': colno, 'error': error - } + }; setTimeout(function() { sendPayload(settings.apiKey, settings.logId, confirmResponse, errorLog); }, settings.breadcrumbs ? breadcrumbsDelay : 0); return false; } + // -- Log on window unhandled rejection + window.onunhandledrejection = function (event) { + var errorLog = { + 'message': event.reason.message, + 'error': event.reason.message && event.reason.stack ? event.reason : undefined + }; + + setTimeout(function() { sendPayload(settings.apiKey, settings.logId, confirmResponse, errorLog); }, settings.breadcrumbs ? breadcrumbsDelay : 0); + + return false; + } + // -- Overriding console methods // -- Then log messages into the app.elmah.io if(options && options.captureConsoleMinimumLevel !== "none") {