@airbrake/browser
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -9,3 +9,2 @@ 'use strict'; | ||
var fetch$1 = _interopDefault(require('cross-fetch')); | ||
var tdigest = require('tdigest'); | ||
@@ -719,2 +718,3 @@ /*! ***************************************************************************** | ||
var tdigest = require('tdigest'); | ||
var TDigestStat = /** @class */ (function () { | ||
@@ -725,3 +725,3 @@ function TDigestStat() { | ||
this.sumsq = 0; | ||
this._td = new tdigest.TDigest(); | ||
this._td = new tdigest.Digest(); | ||
} | ||
@@ -1063,3 +1063,3 @@ TDigestStat.prototype.add = function (ms) { | ||
name: 'airbrake-js/browser', | ||
version: '1.0.1', | ||
version: '1.0.2', | ||
url: 'https://github.com/airbrake/airbrake-js', | ||
@@ -1066,0 +1066,0 @@ }; |
import ErrorStackParser from 'error-stack-parser'; | ||
import fetch$1 from 'cross-fetch'; | ||
import { TDigest } from 'tdigest'; | ||
@@ -712,2 +711,3 @@ /*! ***************************************************************************** | ||
var tdigest = require('tdigest'); | ||
var TDigestStat = /** @class */ (function () { | ||
@@ -718,3 +718,3 @@ function TDigestStat() { | ||
this.sumsq = 0; | ||
this._td = new TDigest(); | ||
this._td = new tdigest.Digest(); | ||
} | ||
@@ -1056,3 +1056,3 @@ TDigestStat.prototype.add = function (ms) { | ||
name: 'airbrake-js/browser', | ||
version: '1.0.1', | ||
version: '1.0.2', | ||
url: 'https://github.com/airbrake/airbrake-js', | ||
@@ -1059,0 +1059,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
var Airbrake=function(t){"use strict";function e(t){var e=this.constructor;return this.then(function(r){return e.resolve(t()).then(function(){return r})},function(r){return e.resolve(t()).then(function(){return e.reject(r)})})}var r=setTimeout;function n(t){return Boolean(t&&void 0!==t.length)}function i(){}function o(t){if(!(this instanceof o))throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],f(t,this)}function s(t,e){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,o._immediateFn(function(){var r=1===t._state?e.onFulfilled:e.onRejected;if(null!==r){var n;try{n=r(t._value)}catch(t){return void u(e.promise,t)}a(e.promise,n)}else(1===t._state?a:u)(e.promise,t._value)})):t._deferreds.push(e)}function a(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var r=e.then;if(e instanceof o)return t._state=3,t._value=e,void c(t);if("function"==typeof r)return void f((n=r,i=e,function(){n.apply(i,arguments)}),t)}t._state=1,t._value=e,c(t)}catch(e){u(t,e)}var n,i}function u(t,e){t._state=2,t._value=e,c(t)}function c(t){2===t._state&&0===t._deferreds.length&&o._immediateFn(function(){t._handled||o._unhandledRejectionFn(t._value)});for(var e=0,r=t._deferreds.length;e<r;e++)s(t,t._deferreds[e]);t._deferreds=null}function h(t,e,r){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=r}function f(t,e){var r=!1;try{t(function(t){r||(r=!0,a(e,t))},function(t){r||(r=!0,u(e,t))})}catch(t){if(r)return;r=!0,u(e,t)}}o.prototype.catch=function(t){return this.then(null,t)},o.prototype.then=function(t,e){var r=new this.constructor(i);return s(this,new h(t,e,r)),r},o.prototype.finally=e,o.all=function(t){return new o(function(e,r){if(!n(t))return r(new TypeError("Promise.all accepts an array"));var i=Array.prototype.slice.call(t);if(0===i.length)return e([]);var o=i.length;function s(t,n){try{if(n&&("object"==typeof n||"function"==typeof n)){var a=n.then;if("function"==typeof a)return void a.call(n,function(e){s(t,e)},r)}i[t]=n,0==--o&&e(i)}catch(t){r(t)}}for(var a=0;a<i.length;a++)s(a,i[a])})},o.resolve=function(t){return t&&"object"==typeof t&&t.constructor===o?t:new o(function(e){e(t)})},o.reject=function(t){return new o(function(e,r){r(t)})},o.race=function(t){return new o(function(e,r){if(!n(t))return r(new TypeError("Promise.race accepts an array"));for(var i=0,s=t.length;i<s;i++)o.resolve(t[i]).then(e,r)})},o._immediateFn="function"==typeof setImmediate&&function(t){setImmediate(t)}||function(t){r(t,0)},o._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};var p=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")}();"Promise"in p?p.Promise.prototype.finally||(p.Promise.prototype.finally=e):p.Promise=o;var l=function(t,e){return(l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function d(t,e){function r(){this.constructor=t}l(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var m=function(){return(m=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},y=128;function _(t,e){return t>>e||1}var v=function(){function t(t){this.maxStringLength=1024,this.maxObjectLength=y,this.maxArrayLength=y,this.maxDepth=8,this.keys=[],this.keysBlacklist=[],this.seen=[];var e=t.level||0;this.keysBlacklist=t.keysBlacklist||[],this.maxStringLength=_(this.maxStringLength,e),this.maxObjectLength=_(this.maxObjectLength,e),this.maxArrayLength=_(this.maxArrayLength,e),this.maxDepth=_(this.maxDepth,e)}return t.prototype.truncate=function(t,e,r){if(void 0===e&&(e=""),void 0===r&&(r=0),null==t)return t;switch(typeof t){case"boolean":case"number":case"function":return t;case"string":return this.truncateString(t);case"object":break;default:return this.truncateString(String(t))}if(t instanceof String)return this.truncateString(t.toString());if(t instanceof Boolean||t instanceof Number||t instanceof Date||t instanceof RegExp)return t;if(t instanceof Error)return this.truncateString(t.toString());if(this.seen.indexOf(t)>=0)return"[Circular "+this.getPath(t)+"]";var n=function(t){return Object.prototype.toString.apply(t).slice("[object ".length,-1)}(t);if(++r>this.maxDepth)return"[Truncated "+n+"]";switch(this.keys.push(e),this.seen.push(t),n){case"Array":return this.truncateArray(t,r);case"Object":return this.truncateObject(t,r);default:var i=this.maxDepth;this.maxDepth=0;var o=this.truncateObject(t,r);return o.__type=n,this.maxDepth=i,o}},t.prototype.getPath=function(t){for(var e=this.seen.indexOf(t),r=[this.keys[e]],n=e;n>=0;n--){var i=this.seen[n];i&&w(i,r[0])===t&&(t=i,r.unshift(this.keys[n]))}return"~"+r.join(".")},t.prototype.truncateString=function(t){return t.length>this.maxStringLength?t.slice(0,this.maxStringLength)+"...":t},t.prototype.truncateArray=function(t,e){void 0===e&&(e=0);for(var r=0,n=[],i=0;i<t.length;i++){var o=t[i];if(n.push(this.truncate(o,i.toString(),e)),++r>=this.maxArrayLength)break}return n},t.prototype.truncateObject=function(t,e){void 0===e&&(e=0);var r=0,n={};for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i))if(b(i,this.keysBlacklist))n[i]="[Filtered]";else{var o=w(t,i);if(void 0!==o&&"function"!=typeof o&&(n[i]=this.truncate(o,i,e),++r>=this.maxObjectLength))break}return n},t}();function g(t,e){return void 0===e&&(e={}),new v(e).truncate(t)}function w(t,e){try{return t[e]}catch(t){return}}function b(t,e){for(var r=0,n=e;r<n.length;r++){var i=n[r];if(i===t)return!0;if(i instanceof RegExp&&t.match(i))return!0}return!1}var x=function(){function t(t,e,r){this._dur=0,this._level=0,this._metric=t,this.name=e,this.startTime=r||new Date}return t.prototype.end=function(t){this.endTime=t||new Date,this._dur+=this.endTime.getTime()-this.startTime.getTime(),this._metric._incGroup(this.name,this._dur),this._metric=null},t.prototype._pause=function(){if(!this._paused()){var t=new Date;this._dur+=t.getTime()-this.startTime.getTime(),this.startTime=null}},t.prototype._resume=function(){this._paused()&&(this.startTime=new Date)},t.prototype._paused=function(){return null==this.startTime},t}(),O=function(){function t(){this._spans={},this._groups={},this.startTime=new Date}return t.prototype.end=function(t){this.endTime||(this.endTime=t||new Date)},t.prototype.isRecording=function(){return!0},t.prototype.startSpan=function(t,e){var r=this._spans[t];r?r._level++:(r=new x(this,t,e),this._spans[t]=r)},t.prototype.endSpan=function(t,e){var r=this._spans[t];r?r._level>0?r._level--:(r.end(e),delete this._spans[r.name]):console.error("airbrake: span=%s does not exist",t)},t.prototype._incGroup=function(t,e){this._groups[t]=(this._groups[t]||0)+e},t.prototype._duration=function(){return this.endTime||(this.endTime=new Date),this.endTime.getTime()-this.startTime.getTime()},t}(),E=function(){function t(){}return t.prototype.isRecording=function(){return!1},t.prototype.startSpan=function(t,e){},t.prototype.endSpan=function(t,e){},t.prototype._incGroup=function(t,e){},t}(),j=function(){function t(){this._noopMetric=new E,this._context={},this._historyMaxLen=20,this._history=[]}return t.prototype.clone=function(){var e=new t;return e._context=m({},this._context),e._history=this._history.slice(),e},t.prototype.setContext=function(t){this._context=Object.assign(this._context,t)},t.prototype.context=function(){var t=m({},this._context);return this._history.length>0&&(t.history=this._history.slice()),t},t.prototype.pushHistory=function(t){this._isDupState(t)?this._lastRecord.num?this._lastRecord.num++:this._lastRecord.num=2:(t.date||(t.date=new Date),this._history.push(t),this._lastRecord=t,this._history.length>this._historyMaxLen&&(this._history=this._history.slice(-this._historyMaxLen)))},t.prototype._isDupState=function(t){if(!this._lastRecord)return!1;for(var e in t)if(t.hasOwnProperty(e)&&"date"!==e&&t[e]!==this._lastRecord[e])return!1;return!0},t.prototype.routeMetric=function(){return this._routeMetric||this._noopMetric},t.prototype.setRouteMetric=function(t){this._routeMetric=t},t.prototype.queueMetric=function(){return this._queueMetric||this._noopMetric},t.prototype.setQueueMetric=function(t){this._queueMetric=t},t}(),T="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function k(t,e){return t(e={exports:{}},e.exports),e.exports}var S=k(function(t,e){t.exports=function(){function t(t){return t.charAt(0).toUpperCase()+t.substring(1)}function e(t){return function(){return this[t]}}var r=["isConstructor","isEval","isNative","isToplevel"],n=["columnNumber","lineNumber"],i=["fileName","functionName","source"],o=r.concat(n,i,["args"]);function s(e){if(e instanceof Object)for(var r=0;r<o.length;r++)e.hasOwnProperty(o[r])&&void 0!==e[o[r]]&&this["set"+t(o[r])](e[o[r]])}s.prototype={getArgs:function(){return this.args},setArgs:function(t){if("[object Array]"!==Object.prototype.toString.call(t))throw new TypeError("Args must be an Array");this.args=t},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(t){if(t instanceof s)this.evalOrigin=t;else{if(!(t instanceof Object))throw new TypeError("Eval Origin must be an Object or StackFrame");this.evalOrigin=new s(t)}},toString:function(){var t=this.getFileName()||"",e=this.getLineNumber()||"",r=this.getColumnNumber()||"",n=this.getFunctionName()||"";return this.getIsEval()?t?"[eval] ("+t+":"+e+":"+r+")":"[eval]:"+e+":"+r:n?n+" ("+t+":"+e+":"+r+")":t+":"+e+":"+r}},s.fromString=function(t){var e=t.indexOf("("),r=t.lastIndexOf(")"),n=t.substring(0,e),i=t.substring(e+1,r).split(","),o=t.substring(r+1);if(0===o.indexOf("@"))var a=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(o,""),u=a[1],c=a[2],h=a[3];return new s({functionName:n,args:i||void 0,fileName:u,lineNumber:c||void 0,columnNumber:h||void 0})};for(var a=0;a<r.length;a++)s.prototype["get"+t(r[a])]=e(r[a]),s.prototype["set"+t(r[a])]=function(t){return function(e){this[t]=Boolean(e)}}(r[a]);for(var u=0;u<n.length;u++)s.prototype["get"+t(n[u])]=e(n[u]),s.prototype["set"+t(n[u])]=function(t){return function(e){if(r=e,isNaN(parseFloat(r))||!isFinite(r))throw new TypeError(t+" must be a Number");var r;this[t]=Number(e)}}(n[u]);for(var c=0;c<i.length;c++)s.prototype["get"+t(i[c])]=e(i[c]),s.prototype["set"+t(i[c])]=function(t){return function(e){this[t]=String(e)}}(i[c]);return s}()}),N=k(function(t,e){var r,n,i,o;t.exports=(r=S,n=/(^|@)\S+\:\d+/,i=/^\s*at .*(\S+\:\d+|\(native\))/m,o=/^(eval@)?(\[native code\])?$/,{parse:function(t){if(void 0!==t.stacktrace||void 0!==t["opera#sourceloc"])return this.parseOpera(t);if(t.stack&&t.stack.match(i))return this.parseV8OrIE(t);if(t.stack)return this.parseFFOrSafari(t);throw new Error("Cannot parse given Error object")},extractLocation:function(t){if(-1===t.indexOf(":"))return[t];var e=/(.+?)(?:\:(\d+))?(?:\:(\d+))?$/.exec(t.replace(/[\(\)]/g,""));return[e[1],e[2]||void 0,e[3]||void 0]},parseV8OrIE:function(t){var e=t.stack.split("\n").filter(function(t){return!!t.match(i)},this);return e.map(function(t){t.indexOf("(eval ")>-1&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^\()]*)|(\)\,.*$)/g,""));var e=t.replace(/^\s+/,"").replace(/\(eval code/g,"("),n=e.match(/ (\((.+):(\d+):(\d+)\)$)/),i=(e=n?e.replace(n[0],""):e).split(/\s+/).slice(1),o=this.extractLocation(n?n[1]:i.pop()),s=i.join(" ")||void 0,a=["eval","<anonymous>"].indexOf(o[0])>-1?void 0:o[0];return new r({functionName:s,fileName:a,lineNumber:o[1],columnNumber:o[2],source:t})},this)},parseFFOrSafari:function(t){var e=t.stack.split("\n").filter(function(t){return!t.match(o)},this);return e.map(function(t){if(t.indexOf(" > eval")>-1&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g,":$1")),-1===t.indexOf("@")&&-1===t.indexOf(":"))return new r({functionName:t});var e=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=t.match(e),i=n&&n[1]?n[1]:void 0,o=this.extractLocation(t.replace(e,""));return new r({functionName:i,fileName:o[0],lineNumber:o[1],columnNumber:o[2],source:t})},this)},parseOpera:function(t){return!t.stacktrace||t.message.indexOf("\n")>-1&&t.message.split("\n").length>t.stacktrace.split("\n").length?this.parseOpera9(t):t.stack?this.parseOpera11(t):this.parseOpera10(t)},parseOpera9:function(t){for(var e=/Line (\d+).*script (?:in )?(\S+)/i,n=t.message.split("\n"),i=[],o=2,s=n.length;o<s;o+=2){var a=e.exec(n[o]);a&&i.push(new r({fileName:a[2],lineNumber:a[1],source:n[o]}))}return i},parseOpera10:function(t){for(var e=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=t.stacktrace.split("\n"),i=[],o=0,s=n.length;o<s;o+=2){var a=e.exec(n[o]);a&&i.push(new r({functionName:a[3]||void 0,fileName:a[2],lineNumber:a[1],source:n[o]}))}return i},parseOpera11:function(t){var e=t.stack.split("\n").filter(function(t){return!!t.match(n)&&!t.match(/^Error created at/)},this);return e.map(function(t){var e,n=t.split("@"),i=this.extractLocation(n.pop()),o=n.shift()||"",s=o.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^\)]*\)/g,"")||void 0;o.match(/\(([^\)]*)\)/)&&(e=o.replace(/^[^\(]+\(([^\)]*)\)$/,"$1"));var a=void 0===e||"[arguments not available]"===e?void 0:e.split(",");return new r({functionName:s,args:a,fileName:i[0],lineNumber:i[1],columnNumber:i[2],source:t})},this)}})}),A="object"==typeof console&&console.warn;function L(t){try{return N.parse(t)}catch(e){A&&t.stack&&console.warn("ErrorStackParser:",e.toString(),t.stack)}return t.fileName?[t]:[]}function D(t){var e=[];if(t.noStack)e.push({function:t.functionName||"",file:t.fileName||"",line:t.lineNumber||0,column:t.columnNumber||0});else{var r=L(t);if(0===r.length)try{throw new Error("fake")}catch(t){(r=L(t)).shift(),r.shift()}for(var n=0,i=r;n<i.length;n++){var o=i[n];e.push({function:o.functionName||"",file:o.fileName||"",line:o.lineNumber||0,column:o.columnNumber||0})}}return{type:t.name?t.name:"",message:t.message?String(t.message):String(t),backtrace:e}}var R=new RegExp(["^","\\[(\\$.+)\\]","\\s","([\\s\\S]+)","$"].join(""));function P(t){var e=t.errors[0];if(""!==e.type&&"Error"!==e.type)return t;var r=e.message.match(R);return null!==r&&(e.type=r[1],e.message=r[2]),t}var B=["Script error","Script error.","InvalidAccessError"];function q(t){var e=t.errors[0];if(""===e.type&&-1!==B.indexOf(e.message))return null;if(e.backtrace&&e.backtrace.length>0&&"<anonymous>"===e.backtrace[0].file)return null;return t}var C=new RegExp(["^","Uncaught\\s","(.+?)",":\\s","(.+)","$"].join(""));function M(t){var e=t.errors[0];if(""!==e.type&&"Error"!==e.type)return t;var r=e.message.match(C);return null!==r&&(e.type=r[1],e.message=r[2]),t}var F=k(function(t,e){var r=function(t){function e(){this.fetch=!1,this.DOMException=t.DOMException}return e.prototype=t,new e}("undefined"!=typeof self?self:T);!function(t){!function(e){var r={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(r.arrayBuffer)var n=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],i=ArrayBuffer.isView||function(t){return t&&n.indexOf(Object.prototype.toString.call(t))>-1};function o(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function s(t){return"string"!=typeof t&&(t=String(t)),t}function a(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return r.iterable&&(e[Symbol.iterator]=function(){return e}),e}function u(t){this.map={},t instanceof u?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function c(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function h(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function f(t){var e=new FileReader,r=h(e);return e.readAsArrayBuffer(t),r}function p(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function l(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:r.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:r.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():r.arrayBuffer&&r.blob&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=p(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):r.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||i(t))?this._bodyArrayBuffer=p(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r.blob&&(this.blob=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?c(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(f)}),this.text=function(){var t,e,r,n=c(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=h(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r.formData&&(this.formData=function(){return this.text().then(y)}),this.json=function(){return this.text().then(JSON.parse)},this}u.prototype.append=function(t,e){t=o(t),e=s(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},u.prototype.delete=function(t){delete this.map[o(t)]},u.prototype.get=function(t){return t=o(t),this.has(t)?this.map[t]:null},u.prototype.has=function(t){return this.map.hasOwnProperty(o(t))},u.prototype.set=function(t,e){this.map[o(t)]=s(e)},u.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},u.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),a(t)},u.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),a(t)},u.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),a(t)},r.iterable&&(u.prototype[Symbol.iterator]=u.prototype.entries);var d=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function m(t,e){var r,n,i=(e=e||{}).body;if(t instanceof m){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new u(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new u(e.headers)),this.method=(r=e.method||this.method||"GET",n=r.toUpperCase(),d.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function y(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}}),e}function _(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new u(e.headers),this.url=e.url||"",this._initBody(t)}m.prototype.clone=function(){return new m(this,{body:this._bodyInit})},l.call(m.prototype),l.call(_.prototype),_.prototype.clone=function(){return new _(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new u(this.headers),url:this.url})},_.error=function(){var t=new _(null,{status:0,statusText:""});return t.type="error",t};var v=[301,302,303,307,308];_.redirect=function(t,e){if(-1===v.indexOf(e))throw new RangeError("Invalid status code");return new _(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function g(t,n){return new Promise(function(i,o){var s=new m(t,n);if(s.signal&&s.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var t,e,r={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new u,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}}),e)};r.url="responseURL"in a?a.responseURL:r.headers.get("X-Request-URL");var n="response"in a?a.response:a.responseText;i(new _(n,r))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&r.blob&&(a.responseType="blob"),s.headers.forEach(function(t,e){a.setRequestHeader(e,t)}),s.signal&&(s.signal.addEventListener("abort",c),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",c)}),a.send(void 0===s._bodyInit?null:s._bodyInit)})}g.polyfill=!0,t.fetch||(t.fetch=g,t.Headers=u,t.Request=m,t.Response=_),e.Headers=u,e.Request=m,e.Response=_,e.fetch=g}({})}(r),delete r.fetch.polyfill,(e=r.fetch).default=r.fetch,e.fetch=r.fetch,e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response,t.exports=e}),I=(F.fetch,F.Headers,F.Request,F.Response,{unauthorized:new Error("airbrake: unauthorized: project id or key are wrong"),ipRateLimited:new Error("airbrake: IP is rate limited")}),U=0;function H(t){if(Date.now()/1e3<U)return Promise.reject(I.ipRateLimited);var e={method:t.method,body:t.body};return F(t.url,e).then(function(t){if(401===t.status)throw I.unauthorized;if(429===t.status){var e=t.headers.get("X-RateLimit-Delay");if(!e)throw I.ipRateLimited;var r=parseInt(e,10);throw r>0&&(U=Date.now()/1e3+r),I.ipRateLimited}if(204===t.status)return{json:null};if(404===t.status)throw new Error("404 Not Found");return t.status>=200&&t.status<300?t.json().then(function(t){return{json:t}}):t.status>=400&&t.status<500?t.json().then(function(t){throw new Error(t.message)}):t.text().then(function(e){throw new Error("airbrake: fetch: unexpected response: code="+t.status+" body='"+e+"'")})})}function z(t){return function(e){return function(t,e){if(Date.now()/1e3<J)return Promise.reject(I.ipRateLimited);return new Promise(function(r,n){e({url:t.url,method:t.method,body:t.body,headers:{"content-type":"application/json"},timeout:t.timeout},function(t,e,i){if(t)n(t);else{if(!e.statusCode)return t=new Error("airbrake: request: response statusCode is "+e.statusCode),void n(t);if(401!==e.statusCode)if(429!==e.statusCode)if(204!==e.statusCode)if(e.statusCode>=200&&e.statusCode<300){var o=void 0;try{o=JSON.parse(i)}catch(t){return void n(t)}r(o)}else{if(e.statusCode>=400&&e.statusCode<500){var o=void 0;try{o=JSON.parse(i)}catch(t){return void n(t)}return t=new Error(o.message),void n(t)}i=i.trim(),t=new Error("airbrake: node: unexpected response: code="+e.statusCode+" body='"+i+"'"),n(t)}else r({json:null});else{n(I.ipRateLimited);var s=e.headers["x-ratelimit-delay"];if(!s)return;var a=void 0;if("string"==typeof s)a=s;else{if(!(s instanceof Array))return;a=s[0]}var u=parseInt(a,10);u>0&&(J=Date.now()/1e3+u)}else n(I.unauthorized)}})})}(e,t)}}var J=0;function X(t){return t.request?z(t.request):H}function $(){}function G(t){this._tree=t,this._ancestors=[],this._cursor=null}$.prototype.clear=function(){this._root=null,this.size=0},$.prototype.find=function(t){for(var e=this._root;null!==e;){var r=this._comparator(t,e.data);if(0===r)return e.data;e=e.get_child(r>0)}return null},$.prototype.findIter=function(t){for(var e=this._root,r=this.iterator();null!==e;){var n=this._comparator(t,e.data);if(0===n)return r._cursor=e,r;r._ancestors.push(e),e=e.get_child(n>0)}return null},$.prototype.lowerBound=function(t){for(var e=this._root,r=this.iterator(),n=this._comparator;null!==e;){var i=n(t,e.data);if(0===i)return r._cursor=e,r;r._ancestors.push(e),e=e.get_child(i>0)}for(var o=r._ancestors.length-1;o>=0;--o)if(n(t,(e=r._ancestors[o]).data)<0)return r._cursor=e,r._ancestors.length=o,r;return r._ancestors.length=0,r},$.prototype.upperBound=function(t){for(var e=this.lowerBound(t),r=this._comparator;null!==e.data()&&0===r(e.data(),t);)e.next();return e},$.prototype.min=function(){var t=this._root;if(null===t)return null;for(;null!==t.left;)t=t.left;return t.data},$.prototype.max=function(){var t=this._root;if(null===t)return null;for(;null!==t.right;)t=t.right;return t.data},$.prototype.iterator=function(){return new G(this)},$.prototype.each=function(t){for(var e,r=this.iterator();null!==(e=r.next());)t(e)},$.prototype.reach=function(t){for(var e,r=this.iterator();null!==(e=r.prev());)t(e)},G.prototype.data=function(){return null!==this._cursor?this._cursor.data:null},G.prototype.next=function(){if(null===this._cursor){var t=this._tree._root;null!==t&&this._minNode(t)}else{var e;if(null===this._cursor.right)do{if(e=this._cursor,!this._ancestors.length){this._cursor=null;break}this._cursor=this._ancestors.pop()}while(this._cursor.right===e);else this._ancestors.push(this._cursor),this._minNode(this._cursor.right)}return null!==this._cursor?this._cursor.data:null},G.prototype.prev=function(){if(null===this._cursor){var t=this._tree._root;null!==t&&this._maxNode(t)}else{var e;if(null===this._cursor.left)do{if(e=this._cursor,!this._ancestors.length){this._cursor=null;break}this._cursor=this._ancestors.pop()}while(this._cursor.left===e);else this._ancestors.push(this._cursor),this._maxNode(this._cursor.left)}return null!==this._cursor?this._cursor.data:null},G.prototype._minNode=function(t){for(;null!==t.left;)this._ancestors.push(t),t=t.left;this._cursor=t},G.prototype._maxNode=function(t){for(;null!==t.right;)this._ancestors.push(t),t=t.right;this._cursor=t};var K=$;function W(t){this.data=t,this.left=null,this.right=null,this.red=!0}function V(t){this._root=null,this._comparator=t,this.size=0}function Q(t){return null!==t&&t.red}function Y(t,e){var r=t.get_child(!e);return t.set_child(!e,r.get_child(e)),r.set_child(e,t),t.red=!0,r.red=!1,r}function Z(t,e){return t.set_child(!e,Y(t.get_child(!e),!e)),Y(t,e)}W.prototype.get_child=function(t){return t?this.right:this.left},W.prototype.set_child=function(t,e){t?this.right=e:this.left=e},V.prototype=new K,V.prototype.insert=function(t){var e=!1;if(null===this._root)this._root=new W(t),e=!0,this.size++;else{var r=new W(void 0),n=0,i=0,o=null,s=r,a=null,u=this._root;for(s.right=this._root;;){if(null===u?(u=new W(t),a.set_child(n,u),e=!0,this.size++):Q(u.left)&&Q(u.right)&&(u.red=!0,u.left.red=!1,u.right.red=!1),Q(u)&&Q(a)){var c=s.right===o;u===a.get_child(i)?s.set_child(c,Y(o,!i)):s.set_child(c,Z(o,!i))}var h=this._comparator(u.data,t);if(0===h)break;i=n,n=h<0,null!==o&&(s=o),o=a,a=u,u=u.get_child(n)}this._root=r.right}return this._root.red=!1,e},V.prototype.remove=function(t){if(null===this._root)return!1;var e=new W(void 0),r=e;r.right=this._root;for(var n=null,i=null,o=null,s=1;null!==r.get_child(s);){var a=s;i=n,n=r,r=r.get_child(s);var u=this._comparator(t,r.data);if(s=u>0,0===u&&(o=r),!Q(r)&&!Q(r.get_child(s)))if(Q(r.get_child(!s))){var c=Y(r,s);n.set_child(a,c),n=c}else if(!Q(r.get_child(!s))){var h=n.get_child(!a);if(null!==h)if(Q(h.get_child(!a))||Q(h.get_child(a))){var f=i.right===n;Q(h.get_child(a))?i.set_child(f,Z(n,a)):Q(h.get_child(!a))&&i.set_child(f,Y(n,a));var p=i.get_child(f);p.red=!0,r.red=!0,p.left.red=!1,p.right.red=!1}else n.red=!1,h.red=!0,r.red=!0}}return null!==o&&(o.data=r.data,n.set_child(n.right===r,r.get_child(null===r.left)),this.size--),this._root=e.right,null!==this._root&&(this._root.red=!1),null!==o};var tt=V;function et(t){this.data=t,this.left=null,this.right=null}function rt(t){this._root=null,this._comparator=t,this.size=0}et.prototype.get_child=function(t){return t?this.right:this.left},et.prototype.set_child=function(t,e){t?this.right=e:this.left=e},rt.prototype=new K,rt.prototype.insert=function(t){if(null===this._root)return this._root=new et(t),this.size++,!0;for(var e=0,r=null,n=this._root;;){if(null===n)return n=new et(t),r.set_child(e,n),ret=!0,this.size++,!0;if(0===this._comparator(n.data,t))return!1;e=this._comparator(n.data,t)<0,r=n,n=n.get_child(e)}},rt.prototype.remove=function(t){if(null===this._root)return!1;var e=new et(void 0),r=e;r.right=this._root;for(var n=null,i=null,o=1;null!==r.get_child(o);){n=r,r=r.get_child(o);var s=this._comparator(t,r.data);o=s>0,0===s&&(i=r)}return null!==i&&(i.data=r.data,n.set_child(n.right===r,r.get_child(null===r.left)),this._root=e.right,this.size--,!0)};var nt={RBTree:tt,BinTree:rt}.RBTree;function it(t,e,r){this.discrete=!1===t,this.delta=t||.01,this.K=void 0===e?25:e,this.CX=void 0===r?1.1:r,this.centroids=new nt(ot),this.nreset=0,this.reset()}function ot(t,e){return t.mean>e.mean?1:t.mean<e.mean?-1:0}function st(t,e){return t.mean_cumn-e.mean_cumn}function at(t){this.config=t||{},this.mode=this.config.mode||"auto",it.call(this,"cont"===this.mode&&t.delta),this.digest_ratio=this.config.ratio||.9,this.digest_thresh=this.config.thresh||1e3,this.n_unique=0}it.prototype.reset=function(){this.centroids.clear(),this.n=0,this.nreset+=1,this.last_cumulate=0},it.prototype.size=function(){return this.centroids.size},it.prototype.toArray=function(t){var e=[];return t?(this._cumulate(!0),this.centroids.each(function(t){e.push(t)})):this.centroids.each(function(t){e.push({mean:t.mean,n:t.n})}),e},it.prototype.summary=function(){return[(this.discrete?"exact ":"approximating ")+this.n+" samples using "+this.size()+" centroids","min = "+this.percentile(0),"Q1 = "+this.percentile(.25),"Q2 = "+this.percentile(.5),"Q3 = "+this.percentile(.75),"max = "+this.percentile(1)].join("\n")},it.prototype.push=function(t,e){e=e||1,t=Array.isArray(t)?t:[t];for(var r=0;r<t.length;r++)this._digest(t[r],e)},it.prototype.push_centroid=function(t){t=Array.isArray(t)?t:[t];for(var e=0;e<t.length;e++)this._digest(t[e].mean,t[e].n)},it.prototype._cumulate=function(t){if(!(this.n===this.last_cumulate||!t&&this.CX&&this.CX>this.n/this.last_cumulate)){var e=0;this.centroids.each(function(t){t.mean_cumn=e+t.n/2,e=t.cumn=e+t.n}),this.n=this.last_cumulate=e}},it.prototype.find_nearest=function(t){if(0===this.size())return null;var e=this.centroids.lowerBound({mean:t}),r=null===e.data()?e.prev():e.data();if(r.mean===t||this.discrete)return r;var n=e.prev();return n&&Math.abs(n.mean-t)<Math.abs(r.mean-t)?n:r},it.prototype._new_centroid=function(t,e,r){var n={mean:t,n:e,cumn:r};return this.centroids.insert(n),this.n+=e,n},it.prototype._addweight=function(t,e,r){e!==t.mean&&(t.mean+=r*(e-t.mean)/(t.n+r)),t.cumn+=r,t.mean_cumn+=r/2,t.n+=r,this.n+=r},it.prototype._digest=function(t,e){var r=this.centroids.min(),n=this.centroids.max(),i=this.find_nearest(t);if(i&&i.mean===t)this._addweight(i,t,e);else if(i===r)this._new_centroid(t,e,0);else if(i===n)this._new_centroid(t,e,this.n);else if(this.discrete)this._new_centroid(t,e,i.cumn);else{var o=i.mean_cumn/this.n;Math.floor(4*this.n*this.delta*o*(1-o))-i.n>=e?this._addweight(i,t,e):this._new_centroid(t,e,i.cumn)}this._cumulate(!1),!this.discrete&&this.K&&this.size()>this.K/this.delta&&this.compress()},it.prototype.bound_mean=function(t){var e=this.centroids.upperBound({mean:t}),r=e.prev();return[r,r.mean===t?r:e.next()]},it.prototype.p_rank=function(t){var e=(Array.isArray(t)?t:[t]).map(this._p_rank,this);return Array.isArray(t)?e:e[0]},it.prototype._p_rank=function(t){if(0!==this.size()){if(t<this.centroids.min().mean)return 0;if(t>this.centroids.max().mean)return 1;this._cumulate(!0);var e=this.bound_mean(t),r=e[0],n=e[1];if(this.discrete)return r.cumn/this.n;var i=r.mean_cumn;return r!==n&&(i+=(t-r.mean)*(n.mean_cumn-r.mean_cumn)/(n.mean-r.mean)),i/this.n}},it.prototype.bound_mean_cumn=function(t){this.centroids._comparator=st;var e=this.centroids.upperBound({mean_cumn:t});this.centroids._comparator=ot;var r=e.prev();return[r,r&&r.mean_cumn===t?r:e.next()]},it.prototype.percentile=function(t){var e=(Array.isArray(t)?t:[t]).map(this._percentile,this);return Array.isArray(t)?e:e[0]},it.prototype._percentile=function(t){if(0!==this.size()){this._cumulate(!0);this.centroids.min(),this.centroids.max();var e=this.n*t,r=this.bound_mean_cumn(e),n=r[0],i=r[1];return i===n||null===n||null===i?(n||i).mean:this.discrete?e<=n.cumn?n.mean:i.mean:n.mean+(e-n.mean_cumn)*(i.mean-n.mean)/(i.mean_cumn-n.mean_cumn)}},it.prototype.compress=function(){if(!this.compressing){var t,e,r=this.toArray();for(this.reset(),this.compressing=!0;r.length>0;)this.push_centroid((t=r,e=void 0,e=Math.floor(Math.random()*t.length),t.splice(e,1)[0]));this._cumulate(!0),this.compressing=!1}},at.prototype=Object.create(it.prototype),at.prototype.constructor=at,at.prototype.push=function(t){it.prototype.push.call(this,t),this.check_continuous()},at.prototype._new_centroid=function(t,e,r){this.n_unique+=1,it.prototype._new_centroid.call(this,t,e,r)},at.prototype._addweight=function(t,e,r){1===t.n&&(this.n_unique-=1),it.prototype._addweight.call(this,t,e,r)},at.prototype.check_continuous=function(){return!("auto"!==this.mode||this.size()<this.digest_thresh)&&(this.n_unique/this.size()>this.digest_ratio&&(this.mode="cont",this.discrete=!1,this.delta=this.config.delta||.01,this.compress(),!0))};var ut=it,ct=function(){function t(){this.count=0,this.sum=0,this.sumsq=0,this._td=new ut}return t.prototype.add=function(t){0===t&&(t=1e-5),this.count+=1,this.sum+=t,this.sumsq+=t*t,this._td.push(t)},t.prototype.toJSON=function(){return{count:this.count,sum:this.sum,sumsq:this.sumsq,tdigestCentroids:ft(this._td)}},t}(),ht=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.groups={},e}return d(e,t),e.prototype.addGroups=function(t,e){for(var r in this.add(t),e)this.addGroup(r,e[r])},e.prototype.addGroup=function(t,e){var r=this.groups[t];r||(r=new ct,this.groups[t]=r),r.add(e)},e.prototype.toJSON=function(){return{count:this.count,sum:this.sum,sumsq:this.sumsq,tdigestCentroids:ft(this._td),groups:this.groups}},e}(ct);function ft(t){var e=[],r=[];return t.centroids.each(function(t){e.push(t.mean),r.push(t.n)}),{mean:e,count:r}}var pt=function(t){function e(e,r,n,i){void 0===e&&(e=""),void 0===r&&(r=""),void 0===n&&(n=0),void 0===i&&(i="");var o=t.call(this)||this;return o.method=e,o.route=r,o.statusCode=n,o.contentType=i,o.startTime=new Date,o}return d(e,t),e}(O),lt=function(){function t(t){this._m={},this._opt=t,this._url=t.host+"/api/v5/projects/"+t.projectId+"/routes-stats?key="+t.projectKey,this._requester=X(t)}return t.prototype.notify=function(t){var e=this,r=t._duration(),n=new Date(6e4*Math.floor(t.startTime.getTime()/6e4)),i={method:t.method,route:t.route,statusCode:t.statusCode,time:n},o=JSON.stringify(i),s=this._m[o];s||(s=new ct,this._m[o]=s),s.add(r),this._timer||(this._timer=setTimeout(function(){e._flush()},15e3))},t.prototype._flush=function(){var t=[];for(var e in this._m)if(this._m.hasOwnProperty(e)){var r=JSON.parse(e),n=m(m({},r),this._m[e].toJSON());t.push(n)}this._m={},this._timer=null;var i=JSON.stringify({environment:this._opt.environment,routes:t}),o={method:"POST",url:this._url,body:i};this._requester(o).then(function(t){}).catch(function(t){console.error&&console.error("can not report routes stats",t)})},t}(),dt=function(){function t(t){this._m={},this._opt=t,this._url=t.host+"/api/v5/projects/"+t.projectId+"/routes-breakdowns?key="+t.projectKey,this._requester=X(t)}return t.prototype.notify=function(t){var e=this;if(!(t.statusCode<200||t.statusCode>=300&&t.statusCode<400||404===t.statusCode||0===Object.keys(t._groups).length)){var r=t._duration();0===r&&(r=1e-5);var n=new Date(6e4*Math.floor(t.startTime.getTime()/6e4)),i={method:t.method,route:t.route,responseType:this._responseType(t),time:n},o=JSON.stringify(i),s=this._m[o];s||(s=new ht,this._m[o]=s),s.addGroups(r,t._groups),this._timer||(this._timer=setTimeout(function(){e._flush()},15e3))}},t.prototype._flush=function(){var t=[];for(var e in this._m)if(this._m.hasOwnProperty(e)){var r=JSON.parse(e),n=m(m({},r),this._m[e].toJSON());t.push(n)}this._m={},this._timer=null;var i=JSON.stringify({environment:this._opt.environment,routes:t}),o={method:"POST",url:this._url,body:i};this._requester(o).then(function(t){}).catch(function(t){console.error&&console.error("can not report routes breakdowns",t)})},t.prototype._responseType=function(t){return t.statusCode>=500?"5xx":t.statusCode>=400?"4xx":t.contentType?t.contentType.split(";")[0].split("/")[-1]:""},t}(),mt=function(t){function e(e){var r=t.call(this)||this;return r.queue=e,r.startTime=new Date,r}return d(e,t),e}(O),yt=function(){function t(t){this._m={},this._opt=t,this._url=t.host+"/api/v5/projects/"+t.projectId+"/queues-stats?key="+t.projectKey,this._requester=X(t)}return t.prototype.notify=function(t){var e=this,r=t._duration();0===r&&(r=1e-5);var n=new Date(6e4*Math.floor(t.startTime.getTime()/6e4)),i={queue:t.queue,time:n},o=JSON.stringify(i),s=this._m[o];s||(s=new ht,this._m[o]=s),s.addGroups(r,t._groups),this._timer||(this._timer=setTimeout(function(){e._flush()},15e3))},t.prototype._flush=function(){var t=[];for(var e in this._m)if(this._m.hasOwnProperty(e)){var r=JSON.parse(e),n=m(m({},r),this._m[e].toJSON());t.push(n)}this._m={},this._timer=null;var i=JSON.stringify({environment:this._opt.environment,queues:t}),o={method:"POST",url:this._url,body:i};this._requester(o).then(function(t){}).catch(function(t){console.error&&console.error("can not report queues breakdowns",t)})},t}(),_t=function(){function t(t){var e,r,n=this;if(this._filters=[],this._scope=new j,this._onClose=[],!t.projectId||!t.projectKey)throw new Error("airbrake: projectId and projectKey are required");this._opt=t,this._opt.host=this._opt.host||"https://api.airbrake.io",this._opt.timeout=this._opt.timeout||1e4,this._opt.keysBlacklist=this._opt.keysBlacklist||[/password/,/secret/],this._url=this._opt.host+"/api/v3/projects/"+this._opt.projectId+"/notices?key="+this._opt.projectKey,this._processor=this._opt.processor||D,this._requester=X(this._opt),this.addFilter(q),this.addFilter(function(t){var n=JSON.stringify(t.errors);return n===e?null:(r&&clearTimeout(r),e=n,r=setTimeout(function(){e=""},1e3),t)}),this.addFilter(M),this.addFilter(P),this.addFilter(function(t){return t.context.notifier={name:"airbrake-js/browser",version:"1.0.1",url:"https://github.com/airbrake/airbrake-js"},n._opt.environment&&(t.context.environment=n._opt.environment),t}),this.routes=new vt(this),this.queues=new gt(this)}return t.prototype.close=function(){for(var t=0,e=this._onClose;t<e.length;t++){(0,e[t])()}},t.prototype.scope=function(){return this._scope},t.prototype.setActiveScope=function(t){this._scope=t},t.prototype.addFilter=function(t){this._filters.push(t)},t.prototype.notify=function(t){var e={errors:[],context:Object.assign({severity:"error"},this.scope().context(),t.context),params:t.params||{},environment:t.environment||{},session:t.session||{}};if("object"==typeof t&&void 0!==t.error||(t={error:t}),!t.error)return e.error=new Error("airbrake: got err="+JSON.stringify(t.error)+", wanted an Error"),Promise.resolve(e);var r=this._processor(t.error);e.errors.push(r);for(var n=0,i=this._filters;n<i.length;n++){var o=(0,i[n])(e);if(null===o)return e.error=new Error("airbrake: error is filtered"),Promise.resolve(e);e=o}return e.context||(e.context={}),e.context.language="JavaScript",this._sendNotice(e)},t.prototype._sendNotice=function(t){var e=function(t,e){var r=void 0===e?{}:e,n=r.maxLength,i=void 0===n?64e3:n,o=r.keysBlacklist,s=void 0===o?[]:o;if(t.errors)for(var a=0;a<t.errors.length;a++){var u=new v({keysBlacklist:s});t.errors[a]=u.truncate(t.errors[a])}for(var c="",h=["context","params","environment","session"],f=0;f<8;f++){for(var p={level:f,keysBlacklist:s},l=0,d=h;l<d.length;l++)(b=t[w=d[l]])&&(t[w]=g(b,p));if((c=JSON.stringify(t)).length<i)return c}var m={json:c.slice(0,Math.floor(i/2))+"..."};h.push("errors");for(var y=0,_=h;y<_.length;y++){var w,b;(b=t[w=_[y]])&&(c=JSON.stringify(b),m[w]=c.length)}var x=new Error("airbrake: notice exceeds max length and can't be truncated");throw x.params=m,x}(t,{keysBlacklist:this._opt.keysBlacklist});if(this._opt.reporter){if("function"==typeof this._opt.reporter)return this._opt.reporter(t);console.warn("airbrake: options.reporter must be a function")}var r={method:"POST",url:this._url,body:e};return this._requester(r).then(function(e){return t.id=e.json.id,t}).catch(function(e){return t.error=e,t})},t.prototype.wrap=function(t,e){if(void 0===e&&(e=[]),t._airbrake)return t;var r=this,n=function(){var e=Array.prototype.slice.call(arguments),n=r._wrapArguments(e);try{return t.apply(this,n)}catch(t){throw r.notify({error:t,params:{arguments:e}}),this._ignoreNextWindowError(),t}};for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);for(var o=0,s=e;o<s.length;o++){i=s[o];t.hasOwnProperty(i)&&(n[i]=t[i])}return n._airbrake=!0,n.inner=t,n},t.prototype._wrapArguments=function(t){for(var e=0;e<t.length;e++){var r=t[e];"function"==typeof r&&(t[e]=this.wrap(r))}return t},t.prototype._ignoreNextWindowError=function(){},t.prototype.call=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var n=this.wrap(t);return n.apply(this,Array.prototype.slice.call(arguments,1))},t}(),vt=function(){function t(t){this._notifier=t,this._routes=new lt(t._opt),this._breakdowns=new dt(t._opt)}return t.prototype.start=function(t,e,r,n){void 0===t&&(t=""),void 0===e&&(e=""),void 0===r&&(r=0),void 0===n&&(n="");var i=new pt(t,e,r,n),o=this._notifier.scope().clone();return o.setContext({httpMethod:t,route:e}),o.setRouteMetric(i),this._notifier.setActiveScope(o),i},t.prototype.notify=function(t){t.end(),this._routes.notify(t),this._breakdowns.notify(t)},t}(),gt=function(){function t(t){this._notifier=t,this._queues=new yt(t._opt)}return t.prototype.start=function(t){var e=new mt(t),r=this._notifier.scope().clone();return r.setContext({queue:t}),r.setQueueMetric(e),this._notifier.setActiveScope(r),e},t.prototype.notify=function(t){t.end(),this._queues.notify(t)},t}();function wt(t){return window.navigator&&window.navigator.userAgent&&(t.context.userAgent=window.navigator.userAgent),window.location&&(t.context.url=String(window.location),t.context.rootDirectory=window.location.protocol+"//"+window.location.host),t}var bt=["debug","log","info","warn","error"];var xt=["type","name","src"];function Ot(t){var e=function(t){return function(e){var r;try{r=e.target}catch(t){return}if(r){var n={type:e.type};try{n.target=function(t){var e=[],r=t;for(;r;){var n=Et(r);if(""!==n&&(e.push(n),e.length>10))break;r=r.parentNode}if(0===e.length)return String(t);return e.reverse().join(" > ")}(r)}catch(t){n.target="<"+String(t)+">"}t.scope().pushHistory(n)}}}(t);window.addEventListener&&(window.addEventListener("load",e),window.addEventListener("error",function(t){"error"in t||e(t)},!0)),"object"==typeof document&&document.addEventListener&&(document.addEventListener("DOMContentLoaded",e),document.addEventListener("click",e),document.addEventListener("keypress",e))}function Et(t){if(!t)return"";var e=[];if(t.tagName&&e.push(t.tagName.toLowerCase()),t.id&&(e.push("#"),e.push(t.id)),t.classList&&Array.from)e.push("."),e.push(Array.from(t.classList).join("."));else if(t.className){var r=function(t){if(t.split)return t.split(" ").join(".");if(t.baseVal&&t.baseVal.split)return t.baseVal.split(" ").join(".");return console.error("unsupported HTMLElement.className type",typeof t),""}(t.className);""!==r&&(e.push("."),e.push(r))}if(t.getAttribute)for(var n=0,i=xt;n<i.length;n++){var o=i[n],s=t.getAttribute(o);s&&e.push("["+o+'="'+s+'"]')}return e.join("")}var jt="";function Tt(t,e){var r=e.indexOf("://");r>=0?(r=(e=e.slice(r+3)).indexOf("/"),e=r>=0?e.slice(r):"/"):"/"!==e.charAt(0)&&(e="/"+e),t.scope().pushHistory({type:"location",from:jt,to:e}),jt=e}var kt=function(t){function e(e){var r=t.call(this,e)||this;return r.offline=!1,r.todo=[],r._ignoreWindowError=0,r._ignoreNextXHR=0,r.addFilter(wt),window.addEventListener&&(r.onOnline=r.onOnline.bind(r),window.addEventListener("online",r.onOnline),r.onOffline=r.onOffline.bind(r),window.addEventListener("offline",r.onOffline),r.onUnhandledrejection=r.onUnhandledrejection.bind(r),window.addEventListener("unhandledrejection",r.onUnhandledrejection),r._onClose.push(function(){window.removeEventListener("online",r.onOnline),window.removeEventListener("offline",r.onOffline),window.removeEventListener("unhandledrejection",r.onUnhandledrejection)})),r._opt.ignoreWindowError&&(e.instrumentation.onerror=!1),r._instrument(e.instrumentation),r}return d(e,t),e.prototype._instrument=function(t){var e,r,n;if(void 0===t&&(t={}),t.console=!((e=this._opt.environment)&&e.startsWith&&e.startsWith("dev")),St(t.onerror)){var i=this,o=window.onerror;window.onerror=function(){o&&o.apply(this,arguments),i.onerror.apply(i,arguments)}}Ot(this),St(t.fetch)&&"function"==typeof fetch&&(r=this,n=window.fetch,window.fetch=function(t,e){var i={type:"xhr",date:new Date};return i.method=e&&e.method?e.method:"GET","string"==typeof t?i.url=t:(i.method=t.method,i.url=t.url),r._ignoreNextXHR++,setTimeout(function(){return r._ignoreNextXHR--}),n.apply(this,arguments).then(function(t){return i.statusCode=t.status,i.duration=(new Date).getTime()-i.date.getTime(),r.scope().pushHistory(i),t}).catch(function(t){throw i.error=t,i.duration=(new Date).getTime()-i.date.getTime(),r.scope().pushHistory(i),t})}),St(t.history)&&"object"==typeof history&&function(t){jt=document.location.pathname;var e=window.onpopstate;window.onpopstate=function(r){if(Tt(t,document.location.pathname),e)return e.apply(this,arguments)};var r=history.pushState;history.pushState=function(e,n,i){i&&Tt(t,i.toString()),r.apply(this,arguments)}}(this),St(t.console)&&"object"==typeof console&&function(t){for(var e=function(e){if(!(e in console))return"continue";var r=console[e],n=function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];r.apply(console,n),t.scope().pushHistory({type:"log",severity:e,arguments:n})};n.inner=r,console[e]=n},r=0,n=bt;r<n.length;r++)e(n[r])}(this),St(t.xhr)&&"undefined"!=typeof XMLHttpRequest&&function(t){function e(e){var r=e.__state;r.statusCode=e.status,r.duration=(new Date).getTime()-r.date.getTime(),t.scope().pushHistory(r)}var r=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(e,n,i,o,s){0===t._ignoreNextXHR&&(this.__state={type:"xhr",method:e,url:n}),r.apply(this,arguments)};var n=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.send=function(t){var r=this.onreadystatechange;return this.onreadystatechange=function(t){if(4===this.readyState&&this.__state&&e(this),r)return r.apply(this,arguments)},this.__state&&(this.__state.date=new Date),n.apply(this,arguments)}}(this)},e.prototype.notify=function(e){var r=this;return this.offline?new Promise(function(t,n){for(r.todo.push({err:e,resolve:t,reject:n});r.todo.length>100;){var i=r.todo.shift();if(void 0===i)break;i.resolve({error:new Error("airbrake: offline queue is too large")})}}):t.prototype.notify.call(this,e)},e.prototype.onOnline=function(){this.offline=!1;for(var t=function(t){e.notify(t.err).then(function(e){t.resolve(e)})},e=this,r=0,n=this.todo;r<n.length;r++){t(n[r])}this.todo=[]},e.prototype.onOffline=function(){this.offline=!0},e.prototype.onUnhandledrejection=function(t){var e=t.reason||t.detail&&t.detail.reason;if(e){var r=e.message||String(e);r.indexOf&&0===r.indexOf("airbrake: ")||this.notify(e)}},e.prototype.onerror=function(t,e,r,n,i){this._ignoreWindowError>0||(i?this.notify({error:i,context:{windowError:!0}}):e&&r&&this.notify({error:{message:t,fileName:e,lineNumber:r,columnNumber:n,noStack:!0},context:{windowError:!0}}))},e.prototype._ignoreNextWindowError=function(){var t=this;this._ignoreWindowError++,setTimeout(function(){return t._ignoreWindowError--})},e}(_t);function St(t){return void 0===t||!0===t}return t.Notifier=kt,t}({}); | ||
var Airbrake=function(t){"use strict";function e(t){var e=this.constructor;return this.then(function(r){return e.resolve(t()).then(function(){return r})},function(r){return e.resolve(t()).then(function(){return e.reject(r)})})}var r=setTimeout;function n(t){return Boolean(t&&void 0!==t.length)}function o(){}function i(t){if(!(this instanceof i))throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],f(t,this)}function s(t,e){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,i._immediateFn(function(){var r=1===t._state?e.onFulfilled:e.onRejected;if(null!==r){var n;try{n=r(t._value)}catch(t){return void u(e.promise,t)}a(e.promise,n)}else(1===t._state?a:u)(e.promise,t._value)})):t._deferreds.push(e)}function a(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var r=e.then;if(e instanceof i)return t._state=3,t._value=e,void c(t);if("function"==typeof r)return void f((n=r,o=e,function(){n.apply(o,arguments)}),t)}t._state=1,t._value=e,c(t)}catch(e){u(t,e)}var n,o}function u(t,e){t._state=2,t._value=e,c(t)}function c(t){2===t._state&&0===t._deferreds.length&&i._immediateFn(function(){t._handled||i._unhandledRejectionFn(t._value)});for(var e=0,r=t._deferreds.length;e<r;e++)s(t,t._deferreds[e]);t._deferreds=null}function h(t,e,r){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=r}function f(t,e){var r=!1;try{t(function(t){r||(r=!0,a(e,t))},function(t){r||(r=!0,u(e,t))})}catch(t){if(r)return;r=!0,u(e,t)}}i.prototype.catch=function(t){return this.then(null,t)},i.prototype.then=function(t,e){var r=new this.constructor(o);return s(this,new h(t,e,r)),r},i.prototype.finally=e,i.all=function(t){return new i(function(e,r){if(!n(t))return r(new TypeError("Promise.all accepts an array"));var o=Array.prototype.slice.call(t);if(0===o.length)return e([]);var i=o.length;function s(t,n){try{if(n&&("object"==typeof n||"function"==typeof n)){var a=n.then;if("function"==typeof a)return void a.call(n,function(e){s(t,e)},r)}o[t]=n,0==--i&&e(o)}catch(t){r(t)}}for(var a=0;a<o.length;a++)s(a,o[a])})},i.resolve=function(t){return t&&"object"==typeof t&&t.constructor===i?t:new i(function(e){e(t)})},i.reject=function(t){return new i(function(e,r){r(t)})},i.race=function(t){return new i(function(e,r){if(!n(t))return r(new TypeError("Promise.race accepts an array"));for(var o=0,s=t.length;o<s;o++)i.resolve(t[o]).then(e,r)})},i._immediateFn="function"==typeof setImmediate&&function(t){setImmediate(t)}||function(t){r(t,0)},i._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};var p=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")}();"Promise"in p?p.Promise.prototype.finally||(p.Promise.prototype.finally=e):p.Promise=i;var l=function(t,e){return(l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function d(t,e){function r(){this.constructor=t}l(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var y=function(){return(y=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},m=128;function v(t,e){return t>>e||1}var _=function(){function t(t){this.maxStringLength=1024,this.maxObjectLength=m,this.maxArrayLength=m,this.maxDepth=8,this.keys=[],this.keysBlacklist=[],this.seen=[];var e=t.level||0;this.keysBlacklist=t.keysBlacklist||[],this.maxStringLength=v(this.maxStringLength,e),this.maxObjectLength=v(this.maxObjectLength,e),this.maxArrayLength=v(this.maxArrayLength,e),this.maxDepth=v(this.maxDepth,e)}return t.prototype.truncate=function(t,e,r){if(void 0===e&&(e=""),void 0===r&&(r=0),null==t)return t;switch(typeof t){case"boolean":case"number":case"function":return t;case"string":return this.truncateString(t);case"object":break;default:return this.truncateString(String(t))}if(t instanceof String)return this.truncateString(t.toString());if(t instanceof Boolean||t instanceof Number||t instanceof Date||t instanceof RegExp)return t;if(t instanceof Error)return this.truncateString(t.toString());if(this.seen.indexOf(t)>=0)return"[Circular "+this.getPath(t)+"]";var n=function(t){return Object.prototype.toString.apply(t).slice("[object ".length,-1)}(t);if(++r>this.maxDepth)return"[Truncated "+n+"]";switch(this.keys.push(e),this.seen.push(t),n){case"Array":return this.truncateArray(t,r);case"Object":return this.truncateObject(t,r);default:var o=this.maxDepth;this.maxDepth=0;var i=this.truncateObject(t,r);return i.__type=n,this.maxDepth=o,i}},t.prototype.getPath=function(t){for(var e=this.seen.indexOf(t),r=[this.keys[e]],n=e;n>=0;n--){var o=this.seen[n];o&&w(o,r[0])===t&&(t=o,r.unshift(this.keys[n]))}return"~"+r.join(".")},t.prototype.truncateString=function(t){return t.length>this.maxStringLength?t.slice(0,this.maxStringLength)+"...":t},t.prototype.truncateArray=function(t,e){void 0===e&&(e=0);for(var r=0,n=[],o=0;o<t.length;o++){var i=t[o];if(n.push(this.truncate(i,o.toString(),e)),++r>=this.maxArrayLength)break}return n},t.prototype.truncateObject=function(t,e){void 0===e&&(e=0);var r=0,n={};for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o))if(b(o,this.keysBlacklist))n[o]="[Filtered]";else{var i=w(t,o);if(void 0!==i&&"function"!=typeof i&&(n[o]=this.truncate(i,o,e),++r>=this.maxObjectLength))break}return n},t}();function g(t,e){return void 0===e&&(e={}),new _(e).truncate(t)}function w(t,e){try{return t[e]}catch(t){return}}function b(t,e){for(var r=0,n=e;r<n.length;r++){var o=n[r];if(o===t)return!0;if(o instanceof RegExp&&t.match(o))return!0}return!1}var x=function(){function t(t,e,r){this._dur=0,this._level=0,this._metric=t,this.name=e,this.startTime=r||new Date}return t.prototype.end=function(t){this.endTime=t||new Date,this._dur+=this.endTime.getTime()-this.startTime.getTime(),this._metric._incGroup(this.name,this._dur),this._metric=null},t.prototype._pause=function(){if(!this._paused()){var t=new Date;this._dur+=t.getTime()-this.startTime.getTime(),this.startTime=null}},t.prototype._resume=function(){this._paused()&&(this.startTime=new Date)},t.prototype._paused=function(){return null==this.startTime},t}(),O=function(){function t(){this._spans={},this._groups={},this.startTime=new Date}return t.prototype.end=function(t){this.endTime||(this.endTime=t||new Date)},t.prototype.isRecording=function(){return!0},t.prototype.startSpan=function(t,e){var r=this._spans[t];r?r._level++:(r=new x(this,t,e),this._spans[t]=r)},t.prototype.endSpan=function(t,e){var r=this._spans[t];r?r._level>0?r._level--:(r.end(e),delete this._spans[r.name]):console.error("airbrake: span=%s does not exist",t)},t.prototype._incGroup=function(t,e){this._groups[t]=(this._groups[t]||0)+e},t.prototype._duration=function(){return this.endTime||(this.endTime=new Date),this.endTime.getTime()-this.startTime.getTime()},t}(),E=function(){function t(){}return t.prototype.isRecording=function(){return!1},t.prototype.startSpan=function(t,e){},t.prototype.endSpan=function(t,e){},t.prototype._incGroup=function(t,e){},t}(),j=function(){function t(){this._noopMetric=new E,this._context={},this._historyMaxLen=20,this._history=[]}return t.prototype.clone=function(){var e=new t;return e._context=y({},this._context),e._history=this._history.slice(),e},t.prototype.setContext=function(t){this._context=Object.assign(this._context,t)},t.prototype.context=function(){var t=y({},this._context);return this._history.length>0&&(t.history=this._history.slice()),t},t.prototype.pushHistory=function(t){this._isDupState(t)?this._lastRecord.num?this._lastRecord.num++:this._lastRecord.num=2:(t.date||(t.date=new Date),this._history.push(t),this._lastRecord=t,this._history.length>this._historyMaxLen&&(this._history=this._history.slice(-this._historyMaxLen)))},t.prototype._isDupState=function(t){if(!this._lastRecord)return!1;for(var e in t)if(t.hasOwnProperty(e)&&"date"!==e&&t[e]!==this._lastRecord[e])return!1;return!0},t.prototype.routeMetric=function(){return this._routeMetric||this._noopMetric},t.prototype.setRouteMetric=function(t){this._routeMetric=t},t.prototype.queueMetric=function(){return this._queueMetric||this._noopMetric},t.prototype.setQueueMetric=function(t){this._queueMetric=t},t}(),T="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function S(t,e){return t(e={exports:{}},e.exports),e.exports}var k=S(function(t,e){t.exports=function(){function t(t){return t.charAt(0).toUpperCase()+t.substring(1)}function e(t){return function(){return this[t]}}var r=["isConstructor","isEval","isNative","isToplevel"],n=["columnNumber","lineNumber"],o=["fileName","functionName","source"],i=r.concat(n,o,["args"]);function s(e){if(e instanceof Object)for(var r=0;r<i.length;r++)e.hasOwnProperty(i[r])&&void 0!==e[i[r]]&&this["set"+t(i[r])](e[i[r]])}s.prototype={getArgs:function(){return this.args},setArgs:function(t){if("[object Array]"!==Object.prototype.toString.call(t))throw new TypeError("Args must be an Array");this.args=t},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(t){if(t instanceof s)this.evalOrigin=t;else{if(!(t instanceof Object))throw new TypeError("Eval Origin must be an Object or StackFrame");this.evalOrigin=new s(t)}},toString:function(){var t=this.getFileName()||"",e=this.getLineNumber()||"",r=this.getColumnNumber()||"",n=this.getFunctionName()||"";return this.getIsEval()?t?"[eval] ("+t+":"+e+":"+r+")":"[eval]:"+e+":"+r:n?n+" ("+t+":"+e+":"+r+")":t+":"+e+":"+r}},s.fromString=function(t){var e=t.indexOf("("),r=t.lastIndexOf(")"),n=t.substring(0,e),o=t.substring(e+1,r).split(","),i=t.substring(r+1);if(0===i.indexOf("@"))var a=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(i,""),u=a[1],c=a[2],h=a[3];return new s({functionName:n,args:o||void 0,fileName:u,lineNumber:c||void 0,columnNumber:h||void 0})};for(var a=0;a<r.length;a++)s.prototype["get"+t(r[a])]=e(r[a]),s.prototype["set"+t(r[a])]=function(t){return function(e){this[t]=Boolean(e)}}(r[a]);for(var u=0;u<n.length;u++)s.prototype["get"+t(n[u])]=e(n[u]),s.prototype["set"+t(n[u])]=function(t){return function(e){if(r=e,isNaN(parseFloat(r))||!isFinite(r))throw new TypeError(t+" must be a Number");var r;this[t]=Number(e)}}(n[u]);for(var c=0;c<o.length;c++)s.prototype["get"+t(o[c])]=e(o[c]),s.prototype["set"+t(o[c])]=function(t){return function(e){this[t]=String(e)}}(o[c]);return s}()}),N=S(function(t,e){var r,n,o,i;t.exports=(r=k,n=/(^|@)\S+\:\d+/,o=/^\s*at .*(\S+\:\d+|\(native\))/m,i=/^(eval@)?(\[native code\])?$/,{parse:function(t){if(void 0!==t.stacktrace||void 0!==t["opera#sourceloc"])return this.parseOpera(t);if(t.stack&&t.stack.match(o))return this.parseV8OrIE(t);if(t.stack)return this.parseFFOrSafari(t);throw new Error("Cannot parse given Error object")},extractLocation:function(t){if(-1===t.indexOf(":"))return[t];var e=/(.+?)(?:\:(\d+))?(?:\:(\d+))?$/.exec(t.replace(/[\(\)]/g,""));return[e[1],e[2]||void 0,e[3]||void 0]},parseV8OrIE:function(t){var e=t.stack.split("\n").filter(function(t){return!!t.match(o)},this);return e.map(function(t){t.indexOf("(eval ")>-1&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^\()]*)|(\)\,.*$)/g,""));var e=t.replace(/^\s+/,"").replace(/\(eval code/g,"("),n=e.match(/ (\((.+):(\d+):(\d+)\)$)/),o=(e=n?e.replace(n[0],""):e).split(/\s+/).slice(1),i=this.extractLocation(n?n[1]:o.pop()),s=o.join(" ")||void 0,a=["eval","<anonymous>"].indexOf(i[0])>-1?void 0:i[0];return new r({functionName:s,fileName:a,lineNumber:i[1],columnNumber:i[2],source:t})},this)},parseFFOrSafari:function(t){var e=t.stack.split("\n").filter(function(t){return!t.match(i)},this);return e.map(function(t){if(t.indexOf(" > eval")>-1&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g,":$1")),-1===t.indexOf("@")&&-1===t.indexOf(":"))return new r({functionName:t});var e=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=t.match(e),o=n&&n[1]?n[1]:void 0,i=this.extractLocation(t.replace(e,""));return new r({functionName:o,fileName:i[0],lineNumber:i[1],columnNumber:i[2],source:t})},this)},parseOpera:function(t){return!t.stacktrace||t.message.indexOf("\n")>-1&&t.message.split("\n").length>t.stacktrace.split("\n").length?this.parseOpera9(t):t.stack?this.parseOpera11(t):this.parseOpera10(t)},parseOpera9:function(t){for(var e=/Line (\d+).*script (?:in )?(\S+)/i,n=t.message.split("\n"),o=[],i=2,s=n.length;i<s;i+=2){var a=e.exec(n[i]);a&&o.push(new r({fileName:a[2],lineNumber:a[1],source:n[i]}))}return o},parseOpera10:function(t){for(var e=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=t.stacktrace.split("\n"),o=[],i=0,s=n.length;i<s;i+=2){var a=e.exec(n[i]);a&&o.push(new r({functionName:a[3]||void 0,fileName:a[2],lineNumber:a[1],source:n[i]}))}return o},parseOpera11:function(t){var e=t.stack.split("\n").filter(function(t){return!!t.match(n)&&!t.match(/^Error created at/)},this);return e.map(function(t){var e,n=t.split("@"),o=this.extractLocation(n.pop()),i=n.shift()||"",s=i.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^\)]*\)/g,"")||void 0;i.match(/\(([^\)]*)\)/)&&(e=i.replace(/^[^\(]+\(([^\)]*)\)$/,"$1"));var a=void 0===e||"[arguments not available]"===e?void 0:e.split(",");return new r({functionName:s,args:a,fileName:o[0],lineNumber:o[1],columnNumber:o[2],source:t})},this)}})}),A="object"==typeof console&&console.warn;function L(t){try{return N.parse(t)}catch(e){A&&t.stack&&console.warn("ErrorStackParser:",e.toString(),t.stack)}return t.fileName?[t]:[]}function D(t){var e=[];if(t.noStack)e.push({function:t.functionName||"",file:t.fileName||"",line:t.lineNumber||0,column:t.columnNumber||0});else{var r=L(t);if(0===r.length)try{throw new Error("fake")}catch(t){(r=L(t)).shift(),r.shift()}for(var n=0,o=r;n<o.length;n++){var i=o[n];e.push({function:i.functionName||"",file:i.fileName||"",line:i.lineNumber||0,column:i.columnNumber||0})}}return{type:t.name?t.name:"",message:t.message?String(t.message):String(t),backtrace:e}}var P=new RegExp(["^","\\[(\\$.+)\\]","\\s","([\\s\\S]+)","$"].join(""));function R(t){var e=t.errors[0];if(""!==e.type&&"Error"!==e.type)return t;var r=e.message.match(P);return null!==r&&(e.type=r[1],e.message=r[2]),t}var B=["Script error","Script error.","InvalidAccessError"];function q(t){var e=t.errors[0];if(""===e.type&&-1!==B.indexOf(e.message))return null;if(e.backtrace&&e.backtrace.length>0&&"<anonymous>"===e.backtrace[0].file)return null;return t}var C=new RegExp(["^","Uncaught\\s","(.+?)",":\\s","(.+)","$"].join(""));function F(t){var e=t.errors[0];if(""!==e.type&&"Error"!==e.type)return t;var r=e.message.match(C);return null!==r&&(e.type=r[1],e.message=r[2]),t}var M=S(function(t,e){var r=function(t){function e(){this.fetch=!1,this.DOMException=t.DOMException}return e.prototype=t,new e}("undefined"!=typeof self?self:T);!function(t){!function(e){var r={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(r.arrayBuffer)var n=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],o=ArrayBuffer.isView||function(t){return t&&n.indexOf(Object.prototype.toString.call(t))>-1};function i(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function s(t){return"string"!=typeof t&&(t=String(t)),t}function a(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return r.iterable&&(e[Symbol.iterator]=function(){return e}),e}function u(t){this.map={},t instanceof u?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function c(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function h(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function f(t){var e=new FileReader,r=h(e);return e.readAsArrayBuffer(t),r}function p(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function l(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:r.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:r.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():r.arrayBuffer&&r.blob&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=p(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):r.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||o(t))?this._bodyArrayBuffer=p(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r.blob&&(this.blob=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?c(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(f)}),this.text=function(){var t,e,r,n=c(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=h(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r.formData&&(this.formData=function(){return this.text().then(m)}),this.json=function(){return this.text().then(JSON.parse)},this}u.prototype.append=function(t,e){t=i(t),e=s(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},u.prototype.delete=function(t){delete this.map[i(t)]},u.prototype.get=function(t){return t=i(t),this.has(t)?this.map[t]:null},u.prototype.has=function(t){return this.map.hasOwnProperty(i(t))},u.prototype.set=function(t,e){this.map[i(t)]=s(e)},u.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},u.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),a(t)},u.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),a(t)},u.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),a(t)},r.iterable&&(u.prototype[Symbol.iterator]=u.prototype.entries);var d=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function y(t,e){var r,n,o=(e=e||{}).body;if(t instanceof y){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new u(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,o||null==t._bodyInit||(o=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new u(e.headers)),this.method=(r=e.method||this.method||"GET",n=r.toUpperCase(),d.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function m(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}}),e}function v(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new u(e.headers),this.url=e.url||"",this._initBody(t)}y.prototype.clone=function(){return new y(this,{body:this._bodyInit})},l.call(y.prototype),l.call(v.prototype),v.prototype.clone=function(){return new v(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new u(this.headers),url:this.url})},v.error=function(){var t=new v(null,{status:0,statusText:""});return t.type="error",t};var _=[301,302,303,307,308];v.redirect=function(t,e){if(-1===_.indexOf(e))throw new RangeError("Invalid status code");return new v(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function g(t,n){return new Promise(function(o,i){var s=new y(t,n);if(s.signal&&s.signal.aborted)return i(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var t,e,r={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new u,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}}),e)};r.url="responseURL"in a?a.responseURL:r.headers.get("X-Request-URL");var n="response"in a?a.response:a.responseText;o(new v(n,r))},a.onerror=function(){i(new TypeError("Network request failed"))},a.ontimeout=function(){i(new TypeError("Network request failed"))},a.onabort=function(){i(new e.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&r.blob&&(a.responseType="blob"),s.headers.forEach(function(t,e){a.setRequestHeader(e,t)}),s.signal&&(s.signal.addEventListener("abort",c),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",c)}),a.send(void 0===s._bodyInit?null:s._bodyInit)})}g.polyfill=!0,t.fetch||(t.fetch=g,t.Headers=u,t.Request=y,t.Response=v),e.Headers=u,e.Request=y,e.Response=v,e.fetch=g}({})}(r),delete r.fetch.polyfill,(e=r.fetch).default=r.fetch,e.fetch=r.fetch,e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response,t.exports=e}),I=(M.fetch,M.Headers,M.Request,M.Response,{unauthorized:new Error("airbrake: unauthorized: project id or key are wrong"),ipRateLimited:new Error("airbrake: IP is rate limited")}),U=0;function H(t){if(Date.now()/1e3<U)return Promise.reject(I.ipRateLimited);var e={method:t.method,body:t.body};return M(t.url,e).then(function(t){if(401===t.status)throw I.unauthorized;if(429===t.status){var e=t.headers.get("X-RateLimit-Delay");if(!e)throw I.ipRateLimited;var r=parseInt(e,10);throw r>0&&(U=Date.now()/1e3+r),I.ipRateLimited}if(204===t.status)return{json:null};if(404===t.status)throw new Error("404 Not Found");return t.status>=200&&t.status<300?t.json().then(function(t){return{json:t}}):t.status>=400&&t.status<500?t.json().then(function(t){throw new Error(t.message)}):t.text().then(function(e){throw new Error("airbrake: fetch: unexpected response: code="+t.status+" body='"+e+"'")})})}function J(t){return function(e){return function(t,e){if(Date.now()/1e3<$)return Promise.reject(I.ipRateLimited);return new Promise(function(r,n){e({url:t.url,method:t.method,body:t.body,headers:{"content-type":"application/json"},timeout:t.timeout},function(t,e,o){if(t)n(t);else{if(!e.statusCode)return t=new Error("airbrake: request: response statusCode is "+e.statusCode),void n(t);if(401!==e.statusCode)if(429!==e.statusCode)if(204!==e.statusCode)if(e.statusCode>=200&&e.statusCode<300){var i=void 0;try{i=JSON.parse(o)}catch(t){return void n(t)}r(i)}else{if(e.statusCode>=400&&e.statusCode<500){var i=void 0;try{i=JSON.parse(o)}catch(t){return void n(t)}return t=new Error(i.message),void n(t)}o=o.trim(),t=new Error("airbrake: node: unexpected response: code="+e.statusCode+" body='"+o+"'"),n(t)}else r({json:null});else{n(I.ipRateLimited);var s=e.headers["x-ratelimit-delay"];if(!s)return;var a=void 0;if("string"==typeof s)a=s;else{if(!(s instanceof Array))return;a=s[0]}var u=parseInt(a,10);u>0&&($=Date.now()/1e3+u)}else n(I.unauthorized)}})})}(e,t)}}var $=0;function G(t){return t.request?J(t.request):H}var X=require("tdigest"),W=function(){function t(){this.count=0,this.sum=0,this.sumsq=0,this._td=new X.Digest}return t.prototype.add=function(t){0===t&&(t=1e-5),this.count+=1,this.sum+=t,this.sumsq+=t*t,this._td.push(t)},t.prototype.toJSON=function(){return{count:this.count,sum:this.sum,sumsq:this.sumsq,tdigestCentroids:V(this._td)}},t}(),K=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.groups={},e}return d(e,t),e.prototype.addGroups=function(t,e){for(var r in this.add(t),e)this.addGroup(r,e[r])},e.prototype.addGroup=function(t,e){var r=this.groups[t];r||(r=new W,this.groups[t]=r),r.add(e)},e.prototype.toJSON=function(){return{count:this.count,sum:this.sum,sumsq:this.sumsq,tdigestCentroids:V(this._td),groups:this.groups}},e}(W);function V(t){var e=[],r=[];return t.centroids.each(function(t){e.push(t.mean),r.push(t.n)}),{mean:e,count:r}}var z=function(t){function e(e,r,n,o){void 0===e&&(e=""),void 0===r&&(r=""),void 0===n&&(n=0),void 0===o&&(o="");var i=t.call(this)||this;return i.method=e,i.route=r,i.statusCode=n,i.contentType=o,i.startTime=new Date,i}return d(e,t),e}(O),Q=function(){function t(t){this._m={},this._opt=t,this._url=t.host+"/api/v5/projects/"+t.projectId+"/routes-stats?key="+t.projectKey,this._requester=G(t)}return t.prototype.notify=function(t){var e=this,r=t._duration(),n=new Date(6e4*Math.floor(t.startTime.getTime()/6e4)),o={method:t.method,route:t.route,statusCode:t.statusCode,time:n},i=JSON.stringify(o),s=this._m[i];s||(s=new W,this._m[i]=s),s.add(r),this._timer||(this._timer=setTimeout(function(){e._flush()},15e3))},t.prototype._flush=function(){var t=[];for(var e in this._m)if(this._m.hasOwnProperty(e)){var r=JSON.parse(e),n=y(y({},r),this._m[e].toJSON());t.push(n)}this._m={},this._timer=null;var o=JSON.stringify({environment:this._opt.environment,routes:t}),i={method:"POST",url:this._url,body:o};this._requester(i).then(function(t){}).catch(function(t){console.error&&console.error("can not report routes stats",t)})},t}(),Y=function(){function t(t){this._m={},this._opt=t,this._url=t.host+"/api/v5/projects/"+t.projectId+"/routes-breakdowns?key="+t.projectKey,this._requester=G(t)}return t.prototype.notify=function(t){var e=this;if(!(t.statusCode<200||t.statusCode>=300&&t.statusCode<400||404===t.statusCode||0===Object.keys(t._groups).length)){var r=t._duration();0===r&&(r=1e-5);var n=new Date(6e4*Math.floor(t.startTime.getTime()/6e4)),o={method:t.method,route:t.route,responseType:this._responseType(t),time:n},i=JSON.stringify(o),s=this._m[i];s||(s=new K,this._m[i]=s),s.addGroups(r,t._groups),this._timer||(this._timer=setTimeout(function(){e._flush()},15e3))}},t.prototype._flush=function(){var t=[];for(var e in this._m)if(this._m.hasOwnProperty(e)){var r=JSON.parse(e),n=y(y({},r),this._m[e].toJSON());t.push(n)}this._m={},this._timer=null;var o=JSON.stringify({environment:this._opt.environment,routes:t}),i={method:"POST",url:this._url,body:o};this._requester(i).then(function(t){}).catch(function(t){console.error&&console.error("can not report routes breakdowns",t)})},t.prototype._responseType=function(t){return t.statusCode>=500?"5xx":t.statusCode>=400?"4xx":t.contentType?t.contentType.split(";")[0].split("/")[-1]:""},t}(),Z=function(t){function e(e){var r=t.call(this)||this;return r.queue=e,r.startTime=new Date,r}return d(e,t),e}(O),tt=function(){function t(t){this._m={},this._opt=t,this._url=t.host+"/api/v5/projects/"+t.projectId+"/queues-stats?key="+t.projectKey,this._requester=G(t)}return t.prototype.notify=function(t){var e=this,r=t._duration();0===r&&(r=1e-5);var n=new Date(6e4*Math.floor(t.startTime.getTime()/6e4)),o={queue:t.queue,time:n},i=JSON.stringify(o),s=this._m[i];s||(s=new K,this._m[i]=s),s.addGroups(r,t._groups),this._timer||(this._timer=setTimeout(function(){e._flush()},15e3))},t.prototype._flush=function(){var t=[];for(var e in this._m)if(this._m.hasOwnProperty(e)){var r=JSON.parse(e),n=y(y({},r),this._m[e].toJSON());t.push(n)}this._m={},this._timer=null;var o=JSON.stringify({environment:this._opt.environment,queues:t}),i={method:"POST",url:this._url,body:o};this._requester(i).then(function(t){}).catch(function(t){console.error&&console.error("can not report queues breakdowns",t)})},t}(),et=function(){function t(t){var e,r,n=this;if(this._filters=[],this._scope=new j,this._onClose=[],!t.projectId||!t.projectKey)throw new Error("airbrake: projectId and projectKey are required");this._opt=t,this._opt.host=this._opt.host||"https://api.airbrake.io",this._opt.timeout=this._opt.timeout||1e4,this._opt.keysBlacklist=this._opt.keysBlacklist||[/password/,/secret/],this._url=this._opt.host+"/api/v3/projects/"+this._opt.projectId+"/notices?key="+this._opt.projectKey,this._processor=this._opt.processor||D,this._requester=G(this._opt),this.addFilter(q),this.addFilter(function(t){var n=JSON.stringify(t.errors);return n===e?null:(r&&clearTimeout(r),e=n,r=setTimeout(function(){e=""},1e3),t)}),this.addFilter(F),this.addFilter(R),this.addFilter(function(t){return t.context.notifier={name:"airbrake-js/browser",version:"1.0.2",url:"https://github.com/airbrake/airbrake-js"},n._opt.environment&&(t.context.environment=n._opt.environment),t}),this.routes=new rt(this),this.queues=new nt(this)}return t.prototype.close=function(){for(var t=0,e=this._onClose;t<e.length;t++){(0,e[t])()}},t.prototype.scope=function(){return this._scope},t.prototype.setActiveScope=function(t){this._scope=t},t.prototype.addFilter=function(t){this._filters.push(t)},t.prototype.notify=function(t){var e={errors:[],context:Object.assign({severity:"error"},this.scope().context(),t.context),params:t.params||{},environment:t.environment||{},session:t.session||{}};if("object"==typeof t&&void 0!==t.error||(t={error:t}),!t.error)return e.error=new Error("airbrake: got err="+JSON.stringify(t.error)+", wanted an Error"),Promise.resolve(e);var r=this._processor(t.error);e.errors.push(r);for(var n=0,o=this._filters;n<o.length;n++){var i=(0,o[n])(e);if(null===i)return e.error=new Error("airbrake: error is filtered"),Promise.resolve(e);e=i}return e.context||(e.context={}),e.context.language="JavaScript",this._sendNotice(e)},t.prototype._sendNotice=function(t){var e=function(t,e){var r=void 0===e?{}:e,n=r.maxLength,o=void 0===n?64e3:n,i=r.keysBlacklist,s=void 0===i?[]:i;if(t.errors)for(var a=0;a<t.errors.length;a++){var u=new _({keysBlacklist:s});t.errors[a]=u.truncate(t.errors[a])}for(var c="",h=["context","params","environment","session"],f=0;f<8;f++){for(var p={level:f,keysBlacklist:s},l=0,d=h;l<d.length;l++)(b=t[w=d[l]])&&(t[w]=g(b,p));if((c=JSON.stringify(t)).length<o)return c}var y={json:c.slice(0,Math.floor(o/2))+"..."};h.push("errors");for(var m=0,v=h;m<v.length;m++){var w,b;(b=t[w=v[m]])&&(c=JSON.stringify(b),y[w]=c.length)}var x=new Error("airbrake: notice exceeds max length and can't be truncated");throw x.params=y,x}(t,{keysBlacklist:this._opt.keysBlacklist});if(this._opt.reporter){if("function"==typeof this._opt.reporter)return this._opt.reporter(t);console.warn("airbrake: options.reporter must be a function")}var r={method:"POST",url:this._url,body:e};return this._requester(r).then(function(e){return t.id=e.json.id,t}).catch(function(e){return t.error=e,t})},t.prototype.wrap=function(t,e){if(void 0===e&&(e=[]),t._airbrake)return t;var r=this,n=function(){var e=Array.prototype.slice.call(arguments),n=r._wrapArguments(e);try{return t.apply(this,n)}catch(t){throw r.notify({error:t,params:{arguments:e}}),this._ignoreNextWindowError(),t}};for(var o in t)t.hasOwnProperty(o)&&(n[o]=t[o]);for(var i=0,s=e;i<s.length;i++){o=s[i];t.hasOwnProperty(o)&&(n[o]=t[o])}return n._airbrake=!0,n.inner=t,n},t.prototype._wrapArguments=function(t){for(var e=0;e<t.length;e++){var r=t[e];"function"==typeof r&&(t[e]=this.wrap(r))}return t},t.prototype._ignoreNextWindowError=function(){},t.prototype.call=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var n=this.wrap(t);return n.apply(this,Array.prototype.slice.call(arguments,1))},t}(),rt=function(){function t(t){this._notifier=t,this._routes=new Q(t._opt),this._breakdowns=new Y(t._opt)}return t.prototype.start=function(t,e,r,n){void 0===t&&(t=""),void 0===e&&(e=""),void 0===r&&(r=0),void 0===n&&(n="");var o=new z(t,e,r,n),i=this._notifier.scope().clone();return i.setContext({httpMethod:t,route:e}),i.setRouteMetric(o),this._notifier.setActiveScope(i),o},t.prototype.notify=function(t){t.end(),this._routes.notify(t),this._breakdowns.notify(t)},t}(),nt=function(){function t(t){this._notifier=t,this._queues=new tt(t._opt)}return t.prototype.start=function(t){var e=new Z(t),r=this._notifier.scope().clone();return r.setContext({queue:t}),r.setQueueMetric(e),this._notifier.setActiveScope(r),e},t.prototype.notify=function(t){t.end(),this._queues.notify(t)},t}();function ot(t){return window.navigator&&window.navigator.userAgent&&(t.context.userAgent=window.navigator.userAgent),window.location&&(t.context.url=String(window.location),t.context.rootDirectory=window.location.protocol+"//"+window.location.host),t}var it=["debug","log","info","warn","error"];var st=["type","name","src"];function at(t){var e=function(t){return function(e){var r;try{r=e.target}catch(t){return}if(r){var n={type:e.type};try{n.target=function(t){var e=[],r=t;for(;r;){var n=ut(r);if(""!==n&&(e.push(n),e.length>10))break;r=r.parentNode}if(0===e.length)return String(t);return e.reverse().join(" > ")}(r)}catch(t){n.target="<"+String(t)+">"}t.scope().pushHistory(n)}}}(t);window.addEventListener&&(window.addEventListener("load",e),window.addEventListener("error",function(t){"error"in t||e(t)},!0)),"object"==typeof document&&document.addEventListener&&(document.addEventListener("DOMContentLoaded",e),document.addEventListener("click",e),document.addEventListener("keypress",e))}function ut(t){if(!t)return"";var e=[];if(t.tagName&&e.push(t.tagName.toLowerCase()),t.id&&(e.push("#"),e.push(t.id)),t.classList&&Array.from)e.push("."),e.push(Array.from(t.classList).join("."));else if(t.className){var r=function(t){if(t.split)return t.split(" ").join(".");if(t.baseVal&&t.baseVal.split)return t.baseVal.split(" ").join(".");return console.error("unsupported HTMLElement.className type",typeof t),""}(t.className);""!==r&&(e.push("."),e.push(r))}if(t.getAttribute)for(var n=0,o=st;n<o.length;n++){var i=o[n],s=t.getAttribute(i);s&&e.push("["+i+'="'+s+'"]')}return e.join("")}var ct="";function ht(t,e){var r=e.indexOf("://");r>=0?(r=(e=e.slice(r+3)).indexOf("/"),e=r>=0?e.slice(r):"/"):"/"!==e.charAt(0)&&(e="/"+e),t.scope().pushHistory({type:"location",from:ct,to:e}),ct=e}var ft=function(t){function e(e){var r=t.call(this,e)||this;return r.offline=!1,r.todo=[],r._ignoreWindowError=0,r._ignoreNextXHR=0,r.addFilter(ot),window.addEventListener&&(r.onOnline=r.onOnline.bind(r),window.addEventListener("online",r.onOnline),r.onOffline=r.onOffline.bind(r),window.addEventListener("offline",r.onOffline),r.onUnhandledrejection=r.onUnhandledrejection.bind(r),window.addEventListener("unhandledrejection",r.onUnhandledrejection),r._onClose.push(function(){window.removeEventListener("online",r.onOnline),window.removeEventListener("offline",r.onOffline),window.removeEventListener("unhandledrejection",r.onUnhandledrejection)})),r._opt.ignoreWindowError&&(e.instrumentation.onerror=!1),r._instrument(e.instrumentation),r}return d(e,t),e.prototype._instrument=function(t){var e,r,n;if(void 0===t&&(t={}),t.console=!((e=this._opt.environment)&&e.startsWith&&e.startsWith("dev")),pt(t.onerror)){var o=this,i=window.onerror;window.onerror=function(){i&&i.apply(this,arguments),o.onerror.apply(o,arguments)}}at(this),pt(t.fetch)&&"function"==typeof fetch&&(r=this,n=window.fetch,window.fetch=function(t,e){var o={type:"xhr",date:new Date};return o.method=e&&e.method?e.method:"GET","string"==typeof t?o.url=t:(o.method=t.method,o.url=t.url),r._ignoreNextXHR++,setTimeout(function(){return r._ignoreNextXHR--}),n.apply(this,arguments).then(function(t){return o.statusCode=t.status,o.duration=(new Date).getTime()-o.date.getTime(),r.scope().pushHistory(o),t}).catch(function(t){throw o.error=t,o.duration=(new Date).getTime()-o.date.getTime(),r.scope().pushHistory(o),t})}),pt(t.history)&&"object"==typeof history&&function(t){ct=document.location.pathname;var e=window.onpopstate;window.onpopstate=function(r){if(ht(t,document.location.pathname),e)return e.apply(this,arguments)};var r=history.pushState;history.pushState=function(e,n,o){o&&ht(t,o.toString()),r.apply(this,arguments)}}(this),pt(t.console)&&"object"==typeof console&&function(t){for(var e=function(e){if(!(e in console))return"continue";var r=console[e],n=function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];r.apply(console,n),t.scope().pushHistory({type:"log",severity:e,arguments:n})};n.inner=r,console[e]=n},r=0,n=it;r<n.length;r++)e(n[r])}(this),pt(t.xhr)&&"undefined"!=typeof XMLHttpRequest&&function(t){function e(e){var r=e.__state;r.statusCode=e.status,r.duration=(new Date).getTime()-r.date.getTime(),t.scope().pushHistory(r)}var r=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(e,n,o,i,s){0===t._ignoreNextXHR&&(this.__state={type:"xhr",method:e,url:n}),r.apply(this,arguments)};var n=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.send=function(t){var r=this.onreadystatechange;return this.onreadystatechange=function(t){if(4===this.readyState&&this.__state&&e(this),r)return r.apply(this,arguments)},this.__state&&(this.__state.date=new Date),n.apply(this,arguments)}}(this)},e.prototype.notify=function(e){var r=this;return this.offline?new Promise(function(t,n){for(r.todo.push({err:e,resolve:t,reject:n});r.todo.length>100;){var o=r.todo.shift();if(void 0===o)break;o.resolve({error:new Error("airbrake: offline queue is too large")})}}):t.prototype.notify.call(this,e)},e.prototype.onOnline=function(){this.offline=!1;for(var t=function(t){e.notify(t.err).then(function(e){t.resolve(e)})},e=this,r=0,n=this.todo;r<n.length;r++){t(n[r])}this.todo=[]},e.prototype.onOffline=function(){this.offline=!0},e.prototype.onUnhandledrejection=function(t){var e=t.reason||t.detail&&t.detail.reason;if(e){var r=e.message||String(e);r.indexOf&&0===r.indexOf("airbrake: ")||this.notify(e)}},e.prototype.onerror=function(t,e,r,n,o){this._ignoreWindowError>0||(o?this.notify({error:o,context:{windowError:!0}}):e&&r&&this.notify({error:{message:t,fileName:e,lineNumber:r,columnNumber:n,noStack:!0},context:{windowError:!0}}))},e.prototype._ignoreNextWindowError=function(){var t=this;this._ignoreWindowError++,setTimeout(function(){return t._ignoreWindowError--})},e}(et);function pt(t){return void 0===t||!0===t}return t.Notifier=ft,t}({}); | ||
//# sourceMappingURL=airbrake.iife.min.js.map |
{ | ||
"name": "@airbrake/browser", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Notify Airbrake on JavaScript exceptions", | ||
@@ -5,0 +5,0 @@ "author": "Airbrake", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
769837
6099
2