@honeybadger-io/js
Advanced tools
Comparing version 4.1.1 to 4.1.2
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Honeybadger=t()}(this,(function(){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e){var t=e.default;if("function"==typeof t){var n=function(){return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})})),n}var n={},r={},o={},i={},a="<unknown>";var s=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/|[a-z]:\\|\\\\).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,c=/\((\S*)(?::(\d+))(?::(\d+))\)/;var u=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;var l=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,f=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;var d=/^\s*(?:([^@]*)(?:\((.*?)\))?@)?(\S.*?):(\d+)(?::(\d+))?\s*$/i;var g=/^\s*at (?:((?:\[object object\])?[^\\/]+(?: \[as \S+\])?) )?\(?(.*?):(\d+)(?::(\d+))?\)?\s*$/i;var p=Object.freeze({__proto__:null,parse:function(e){return e.split("\n").reduce((function(e,t){var n=function(e){var t=s.exec(e);if(!t)return null;var n=t[2]&&0===t[2].indexOf("native"),r=t[2]&&0===t[2].indexOf("eval"),o=c.exec(t[2]);r&&null!=o&&(t[2]=o[1],t[3]=o[2],t[4]=o[3]);return{file:n?null:t[2],methodName:t[1]||a,arguments:n?[t[2]]:[],lineNumber:t[3]?+t[3]:null,column:t[4]?+t[4]:null}}(t)||function(e){var t=u.exec(e);if(!t)return null;return{file:t[2],methodName:t[1]||a,arguments:[],lineNumber:+t[3],column:t[4]?+t[4]:null}}(t)||function(e){var t=l.exec(e);if(!t)return null;var n=t[3]&&t[3].indexOf(" > eval")>-1,r=f.exec(t[3]);n&&null!=r&&(t[3]=r[1],t[4]=r[2],t[5]=null);return{file:t[3],methodName:t[1]||a,arguments:t[2]?t[2].split(","):[],lineNumber:t[4]?+t[4]:null,column:t[5]?+t[5]:null}}(t)||function(e){var t=g.exec(e);if(!t)return null;return{file:t[2],methodName:t[1]||a,arguments:[],lineNumber:+t[3],column:t[4]?+t[4]:null}}(t)||function(e){var t=d.exec(e);if(!t)return null;return{file:t[3],methodName:t[1]||a,arguments:[],lineNumber:+t[4],column:t[5]?+t[5]:null}}(t);return n&&e.push(n),e}),[])}}),h=t(p),m=e&&e.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),b=e&&e.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),y=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&m(t,e,n);return b(t,e),t},_=e&&e.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(i,"__esModule",{value:!0}),i.isBrowserConfig=i.clone=i.formatCGIData=i.filterUrl=i.filter=i.generateStackTrace=i.endpoint=i.instrument=i.isErrorObject=i.makeNotice=i.logger=i.sanitize=i.shallowClone=i.runAfterNotifyHandlers=i.runBeforeNotifyHandlers=i.getSourceForBacktrace=i.getCauses=i.makeBacktrace=i.objectIsExtensible=i.objectIsEmpty=i.mergeNotice=i.merge=void 0;const v=y(h);function w(e,t){const n={};for(const t in e)n[t]=e[t];for(const e in t)n[e]=t[e];return n}function E(e,t=0){try{const n=v.parse(e).map((e=>({file:e.file,method:e.methodName,number:e.lineNumber,column:e.column})));return n.splice(0,t),n}catch(e){return[]}}function j(e){if("object"!=typeof e||null===e)return{};const t={};for(const n in e)t[n]=e[n];return t}function O(e){return e instanceof Error||"[object Error]"===Object.prototype.toString.call(e)}function k(e,t){for(let n=0;n<t.length;n++)if(-1!==e.toLowerCase().indexOf(t[n].toLowerCase()))return!0;return!1}function x(e,t){const n=Object.prototype.toString.call(t).slice(8,-1);return null!=t&&n===e}function N(e,t,n=2){if(!e)return null;const r=e.split("\n");r.unshift("");const o=t+n,i={};for(let e=t-n;e<=o;e++){const t=r[e];"string"==typeof t&&(i[e]=t)}return i}i.merge=w,i.mergeNotice=function(e,t){const n=w(e,t);return e.context&&t.context&&(n.context=w(e.context,t.context)),n},i.objectIsEmpty=function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0},i.objectIsExtensible=function(e){return"function"!=typeof Object.isExtensible||Object.isExtensible(e)},i.makeBacktrace=E,i.getCauses=function(e){if(e.cause){const t=[];let n=e;for(;t.length<3&&(n=n.cause);)t.push({class:n.name,message:n.message,backtrace:"string"==typeof n.stack?E(n.stack):null});return t}return[]},i.getSourceForBacktrace=function(e,t){return _(this,void 0,void 0,(function*(){const n=[];if(!t||!e||!e.length)return n;let r=0;for(;e.length;){const o=e.splice(0)[r],i=yield t(o.file);n[r]=N(i,o.number),r++}return n}))},i.runBeforeNotifyHandlers=function(e,t){let n=!0;for(let r=0,o=t.length;r<o;r++){!1===(0,t[r])(e)&&(n=!1)}return n},i.runAfterNotifyHandlers=function(e,t,n){e&&e.afterNotify&&e.afterNotify(n,e);for(let r=0,o=t.length;r<o;r++)t[r](n,e);return!0},i.shallowClone=j,i.sanitize=function(e,t=8){const n=[];function r(e,r=0){if(r>=t)return"[DEPTH]";if(!function(e){const t=typeof e;return/function/.test(t)?"toJSON"===e.name:!/symbol/.test(t)&&null!==e&&("object"!=typeof e||void 0!==e.hasOwnProperty)}(e))return Object.prototype.toString.call(e);if(function(e){if(!e||"object"!=typeof e)return!1;for(let t=0;t<n.length;t++)if(n[t]===e)return!0;return n.push(e),!1}(e))return"[RECURSION]";if(Array.isArray(e))return e.map((e=>o(e,r+1)));if("object"==typeof e){const t={};for(const n in e){const i=e[n];Object.prototype.hasOwnProperty.call(e,n)&&null!=n&&null!=i&&(t[n]=o(i,r+1))}return t}return e}function o(e,t=0){try{return r(e,t)}catch(e){return`[ERROR] ${e}`}}return o(e)},i.logger=function(e){const t=t=>function(...n){if("debug"===t){if(!e.config.debug)return;t="log"}n.unshift("[Honeybadger]"),e.config.logger[t](...n)};return{log:t("log"),info:t("info"),debug:t("debug"),warn:t("warn"),error:t("error")}},i.makeNotice=function(e){let t;if(e)if(O(e)){const n=e;t=w(e,{name:n.name,message:n.message,stack:n.stack,cause:n.cause})}else if("object"==typeof e)t=j(e);else{t={message:String(e)}}else t={};return t},i.isErrorObject=O,i.instrument=function(e,t,n){if(!(e&&t&&n&&t in e))return;let r=e[t];for(;r&&r.__hb_original;)r=r.__hb_original;try{e[t]=n(r),e[t].__hb_original=r}catch(e){}},i.endpoint=function(e,t){return`${e.trim().replace(/\/$/,"")}/${t=t.trim().replace(/(^\/|\/$)/g,"")}`},i.generateStackTrace=function(){try{throw new Error("")}catch(e){if(e.stack)return e.stack}const e=10,t=[];let n=arguments.callee;for(;n&&t.length<e;){/function(?:\s+([\w$]+))+\s*\(/.test(n.toString())?t.push(RegExp.$1||"<anonymous>"):t.push("<anonymous>");try{n=n.caller}catch(e){break}}return t.join("\n")},i.filter=function(e,t){if(!x("Object",e))return;x("Array",t)||(t=[]);const n=[];return function e(r){let o,i;if(x("Object",r)||x("Array",r)){if(-1!==n.indexOf(r))return"[CIRCULAR DATA STRUCTURE]";n.push(r)}if(x("Object",r)){for(o in i={},r)k(o,t)?i[o]="[FILTERED]":i[o]=e(r[o]);return i}return x("Array",r)?r.map((function(t){return e(t)})):x("Function",r)?"[FUNC]":r}(e)},i.filterUrl=function(e,t){if(!t)return e;if("string"!=typeof e)return e;const n=e.split(/\?/,2)[1];if(!n)return e;let r=e;return n.split(/[&]\s?/).forEach((e=>{const[n,o]=e.split("=",2);k(n,t)&&(r=r.replace(`${n}=${o}`,`${n}=[FILTERED]`))})),r},i.formatCGIData=function(e,t=""){const n={};return Object.keys(e).forEach((function(r){const o=t+r.replace(/\W/g,"_").toUpperCase();n[o]=e[r]})),n},i.clone=function(e){return JSON.parse(JSON.stringify(e))},i.isBrowserConfig=function(e){return void 0!==e.async};var S={};Object.defineProperty(S,"__esModule",{value:!0}),S.GlobalStore=void 0;S.GlobalStore=class{constructor(e){this.store=e}getStore(){return this.store}run(e,t,...n){return this.store=e,t(...n)}},Object.defineProperty(o,"__esModule",{value:!0}),o.Client=void 0;const C=i,T=S,P={name:"honeybadger-js",url:"https://github.com/honeybadger-io/honeybadger-js",version:"4.1.1"},R=/,|\s+/,U=/\S/;o.Client=class{constructor(e={},t){this.__pluginsExecuted=!1,this.__store=null,this.__beforeNotifyHandlers=[],this.__afterNotifyHandlers=[],this.config=Object.assign({apiKey:null,endpoint:"https://api.honeybadger.io",environment:null,hostname:null,projectRoot:null,component:null,action:null,revision:null,reportData:null,breadcrumbsEnabled:!0,maxBreadcrumbs:40,maxObjectDepth:8,logger:console,developmentEnvironments:["dev","development","test"],debug:!1,tags:null,enableUncaught:!0,enableUnhandledRejection:!0,afterUncaught:()=>!0,filters:["creditcard","password"],__plugins:[]},e),this.__store=new T.GlobalStore({context:{},breadcrumbs:[]}),this.__transport=t,this.logger=(0,C.logger)(this)}getVersion(){return P.version}configure(e={}){for(const t in e)this.config[t]=e[t];return this.__pluginsExecuted||(this.__pluginsExecuted=!0,this.config.__plugins.forEach((e=>e.load(this)))),this}__setStore(e){this.__store=e}beforeNotify(e){return this.__beforeNotifyHandlers.push(e),this}afterNotify(e){return this.__afterNotifyHandlers.push(e),this}setContext(e){if("object"==typeof e){const t=this.__store.getStore();t.context=(0,C.merge)(t.context,e)}return this}resetContext(e){this.logger.warn("Deprecation warning: `Honeybadger.resetContext()` has been deprecated; please use `Honeybadger.clear()` instead.");const t=this.__store.getStore();return t.context="object"==typeof e&&null!==e?e:{},this}clear(){const e=this.__store.getStore();return e.context={},e.breadcrumbs=[],this}notify(e,t,n){let r=null;const o=this.makeNotice(e,t,n);o||(this.logger.debug("failed to build error report"),r=new Error("failed to build error report")),r||!1!==this.config.reportData||(this.logger.debug("skipping error report: honeybadger.js is disabled",o),r=new Error("honeybadger.js is disabled")),!r&&this.__developmentMode()&&(this.logger.log("honeybadger.js is in development mode; the following error report will be sent in production.",o),r=new Error("honeybadger.js is in development mode")),r||this.config.apiKey||(this.logger.warn("could not send error report: no API key has been configured",o),r=new Error("missing API key"));const i=o&&o.backtrace?o.backtrace.map((e=>(0,C.shallowClone)(e))):null,a=(0,C.runBeforeNotifyHandlers)(o,this.__beforeNotifyHandlers);if(r||a||(this.logger.debug("skipping error report: beforeNotify handlers returned false",o),r=new Error("beforeNotify handlers returned false")),r)return(0,C.runAfterNotifyHandlers)(o,this.__afterNotifyHandlers,r),!1;this.addBreadcrumb("Honeybadger Notice",{category:"notice",metadata:{message:o.message,name:o.name,stack:o.stack}});const s=this.__getStoreContentsOrDefault().breadcrumbs;return o.__breadcrumbs=this.config.breadcrumbsEnabled?s.slice():[],(0,C.getSourceForBacktrace)(i,this.__getSourceFileHandler).then((e=>{e.forEach(((e,t)=>{o.backtrace[t].source=e}));const t=this.__buildPayload(o);this.__transport.send({headers:{"X-API-Key":this.config.apiKey,"Content-Type":"application/json",Accept:"text/json, application/json"},method:"POST",endpoint:(0,C.endpoint)(this.config.endpoint,"/v1/notices/js"),maxObjectDepth:this.config.maxObjectDepth,logger:this.logger,async:(0,C.isBrowserConfig)(this.config)?this.config.async:void 0},t).then((e=>{if(201!==e.statusCode)return(0,C.runAfterNotifyHandlers)(o,this.__afterNotifyHandlers,new Error(`Bad HTTP response: ${e.statusCode}`)),void this.logger.warn(`Error report failed: unknown response from server. code=${e.statusCode}`);const t=JSON.parse(e.body).id;(0,C.runAfterNotifyHandlers)((0,C.merge)(o,{id:t}),this.__afterNotifyHandlers),this.logger.info(`Error report sent ⚡ https://app.honeybadger.io/notice/${t}`)})).catch((e=>{this.logger.error("Error report failed: an unknown error occurred.",`message=${e.message}`),(0,C.runAfterNotifyHandlers)(o,this.__afterNotifyHandlers,e)}))})),!0}notifyAsync(e,t,n){return new Promise(((r,o)=>{let i;i=e.afterNotify?e:t&&t.afterNotify?t:n&&n.afterNotify?n:t&&"object"==typeof t?t:n||(t={}),(e=>{const t=e.afterNotify;e.afterNotify=e=>{if(null==t||t.call(this,e),e)return o(e);r()}})(i),this.notify(e,t,n)}))}makeNotice(e,t,n){let r=(0,C.makeNotice)(e);if(t&&"object"!=typeof t){t={name:String(t)}}if(t&&(r=(0,C.mergeNotice)(r,t)),"object"==typeof n&&null!==n&&(r=(0,C.mergeNotice)(r,n)),(0,C.objectIsEmpty)(r))return null;const o=this.__getStoreContentsOrDefault().context,i=this.__constructTags(r.tags),a=this.__constructTags(o.tags),s=this.__constructTags(this.config.tags),c=i.concat(a).concat(s),u=c.filter(((e,t)=>c.indexOf(e)===t));r=(0,C.merge)(r,{name:r.name||"Error",context:(0,C.merge)(o,r.context),projectRoot:r.projectRoot||this.config.projectRoot,environment:r.environment||this.config.environment,component:r.component||this.config.component,action:r.action||this.config.action,revision:r.revision||this.config.revision,tags:u});let l=0;return"string"==typeof r.stack&&r.stack.trim()||(r.stack=(0,C.generateStackTrace)(),l=2),r.backtrace=(0,C.makeBacktrace)(r.stack,l),r}addBreadcrumb(e,t){if(!this.config.breadcrumbsEnabled)return;t=t||{};const n=(0,C.shallowClone)(t.metadata),r=t.category||"custom",o=(new Date).toISOString(),i=this.__store.getStore();let a=i.breadcrumbs;a.push({category:r,message:e,metadata:n,timestamp:o});const s=this.config.maxBreadcrumbs;return a.length>s&&(a=a.slice(a.length-s)),i.breadcrumbs=a,this}__developmentMode(){return!0!==this.config.reportData&&(this.config.environment&&this.config.developmentEnvironments.includes(this.config.environment))}__buildPayload(e){const t=(0,C.filter)(e.headers,this.config.filters)||{},n=(0,C.filter)(Object.assign(Object.assign({},e.cgiData),(0,C.formatCGIData)(t,"HTTP_")),this.config.filters);return{notifier:P,breadcrumbs:{enabled:!!this.config.breadcrumbsEnabled,trail:e.__breadcrumbs||[]},error:{class:e.name,message:e.message,backtrace:e.backtrace,fingerprint:e.fingerprint,tags:e.tags,causes:(0,C.getCauses)(e)},request:{url:(0,C.filterUrl)(e.url,this.config.filters),component:e.component,action:e.action,context:e.context,cgi_data:n,params:(0,C.filter)(e.params,this.config.filters)||{},session:(0,C.filter)(e.session,this.config.filters)||{}},server:{project_root:e.projectRoot,environment_name:e.environment,revision:e.revision,hostname:this.config.hostname,time:(new Date).toUTCString()},details:e.details||{}}}__constructTags(e){return e?e.toString().split(R).filter((e=>U.test(e))):[]}__getStoreContentsOrDefault(){const e=this.__store.getStore()||{};return Object.assign({context:{},breadcrumbs:[]},e)}};var H={};Object.defineProperty(H,"__esModule",{value:!0}),function(t){var n=e&&e.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),r=e&&e.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)"default"!==o&&Object.prototype.hasOwnProperty.call(e,o)&&n(t,e,o);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Util=t.Types=t.Store=t.Client=void 0;var s=o;Object.defineProperty(t,"Client",{enumerable:!0,get:function(){return s.Client}}),t.Store=a(S),t.Types=a(H),t.Util=a(i)}(r);var $={};function M(e){if(!e||!e.tagName)return"";let t=e.tagName.toLowerCase();if("html"===t)return"";e.id&&(t+=`#${e.id}`);const n=e.getAttribute("class");n&&n.split(/\s+/).forEach((e=>{t+=`.${e}`})),["alt","name","title","type"].forEach((n=>{const r=e.getAttribute(n);r&&(t+=`[${n}="${r}"]`)}));const r=function(e){try{const t=e.parentNode.childNodes,n=[];return Array.prototype.forEach.call(t,(t=>{t.tagName&&t.tagName===e.tagName&&n.push(t)})),n}catch(e){return[]}}(e);return r.length>1&&(t+=`:nth-child(${Array.prototype.indexOf.call(r,e)+1})`),t}function B(e){return-1!==e.toString().indexOf("native")}function A(e){const t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/)||{};return{protocol:t[2],host:t[4],pathname:t[5]}}Object.defineProperty($,"__esModule",{value:!0}),$.preferCatch=$.encodeCookie=$.decodeCookie=$.localURLPathname=$.parseURL=$.nativeFetch=$.stringTextOfElement=$.stringSelectorOfElement=$.stringNameOfElement=void 0,$.stringNameOfElement=M,$.stringSelectorOfElement=function e(t){const n=M(t);if(t.parentNode&&t.parentNode.tagName){const r=e(t.parentNode);if(r.length>0)return`${r} > ${n}`}return n},$.stringTextOfElement=function(e){let t=e.textContent||e.innerText||"";return t||"submit"!==e.type&&"button"!==e.type||(t=e.value),function(e,t){e.length>t&&(e=e.substr(0,t)+"...");return e}(t.trim(),300)},$.nativeFetch=function(){if(!window.fetch)return!1;if(B(window.fetch))return!0;try{const e=document.createElement("iframe");e.style.display="none",document.head.appendChild(e);const t=e.contentWindow.fetch&&B(e.contentWindow.fetch);return document.head.removeChild(e),t}catch(e){console&&console.warn&&console.warn("failed to detect native fetch via iframe: "+e)}return!1},$.parseURL=A,$.localURLPathname=function(e){const t=A(e),n=A(document.URL);return t.host&&t.protocol?t.protocol===n.protocol&&t.host===n.host?t.pathname:`${t.protocol}://${t.host}${t.pathname}`:t.pathname},$.decodeCookie=function(e){const t={};return e.split(/[;,]\s?/).forEach((e=>{const[n,r]=e.split("=",2);t[n]=r})),t},$.encodeCookie=function(e){if("object"!=typeof e)return;const t=[];for(const n in e)t.push(n+"="+e[n]);return t.join(";")},$.preferCatch=function(){let e=!0;if(window.atob||(e=!1),window.ErrorEvent)try{0===new window.ErrorEvent("").colno&&(e=!1)}catch(e){}return e}();var D={};Object.defineProperty(D,"__esModule",{value:!0}),D.onError=D.ignoreNextOnError=void 0;const I=r,{instrument:L,makeNotice:q}=I.Util;let F,W=0;D.ignoreNextOnError=function(){W+=1,clearTimeout(F),F=setTimeout((()=>{W=0}))},D.onError=function(e=window){return{load:t=>{L(e,"onerror",(function(e){const n=function(e,n,r,o,i){if(t.logger.debug("window.onerror callback invoked",arguments),W>0)return t.logger.debug("Ignoring window.onerror (error likely reported earlier)",arguments),void(W-=1);if(0===r&&/Script error\.?/.test(e))return void(t.config.enableUncaught&&t.logger.warn("Ignoring cross-domain script error: enable CORS to track these types of errors",arguments));const a=q(i);a.name||(a.name="window.onerror"),a.message||(a.message=e),a.stack||(a.stack=[a.message,"\n at ? (",n||"unknown",":",r||0,":",o||0,")"].join("")),t.addBreadcrumb("window.onerror"!==a.name&&a.name?`window.onerror: ${a.name}`:"window.onerror",{category:"error",metadata:{name:a.name,message:a.message,stack:a.stack}}),t.config.enableUncaught&&t.notify(a)};return function(t,r,o,i,a){return n(t,r,o,i,a),"function"==typeof e&&e.apply(window,arguments)}}))}}};var G={};Object.defineProperty(G,"__esModule",{value:!0});const X=r,{instrument:K}=X.Util;G.default=function(e=window){return{load:t=>{t.config.enableUnhandledRejection&&K(e,"onunhandledrejection",(function(e){function n(e){var n;if(t.logger.debug("window.onunhandledrejection callback invoked",arguments),!t.config.enableUnhandledRejection)return;const{reason:r}=e;if(r instanceof Error){const e="unknown",n=0,o=`${r.message}\n at ? (${e}:${n})`,i=r.stack||o,a={name:r.name,message:`UnhandledPromiseRejectionWarning: ${r}`,stack:i};return t.addBreadcrumb(`window.onunhandledrejection: ${a.name}`,{category:"error",metadata:a}),void t.notify(a)}const o="string"==typeof r?r:null!==(n=JSON.stringify(r))&&void 0!==n?n:"Unspecified reason";t.notify({name:"window.onunhandledrejection",message:`UnhandledPromiseRejectionWarning: ${o}`})}return function(t){n(t),"function"==typeof e&&e.apply(this,arguments)}}))}}};var z={};Object.defineProperty(z,"__esModule",{value:!0});const J=r,V=$,{sanitize:Q,instrument:Y}=J.Util;z.default=function(e=window){return{load:t=>{function n(e){return!0===t.config.breadcrumbsEnabled||(e?!0===t.config.breadcrumbsEnabled[e]:!1!==t.config.breadcrumbsEnabled)}!function(){function r(e){return Array.isArray(e)?e.map((e=>{try{return String(e)}catch(e){return"[unknown]"}})).join(" "):""}n("console")&&["debug","info","warn","error","log"].forEach((n=>{Y(e.console,n,(function(o){return function(){const i=Array.prototype.slice.call(arguments),a=r(i),s={category:"log",metadata:{level:n,arguments:Q(i,3)}};t.addBreadcrumb(a,s),"function"==typeof o&&Function.prototype.apply.call(o,e.console,arguments)}}))}))}(),n("dom")&&e.addEventListener("click",(e=>{let n,r,o;try{n=(0,V.stringNameOfElement)(e.target),r=(0,V.stringSelectorOfElement)(e.target),o=(0,V.stringTextOfElement)(e.target)}catch(e){n="UI Click",r="[unknown]",o="[unknown]"}0!==n.length&&t.addBreadcrumb(n,{category:"ui.click",metadata:{selector:r,text:o,event:e}})}),!0),n("network")&&(Y(XMLHttpRequest.prototype,"open",(function(e){return function(){const t=this,n=arguments[1],r="string"==typeof arguments[0]?arguments[0].toUpperCase():arguments[0],o=`${r} ${(0,V.localURLPathname)(n)}`;this.__hb_xhr={type:"xhr",method:r,url:n,message:o},"function"==typeof e&&e.apply(t,arguments)}})),Y(XMLHttpRequest.prototype,"send",(function(e){return function(){const n=this;function r(){if(4===n.readyState){let e;n.__hb_xhr&&(n.__hb_xhr.status_code=n.status,e=n.__hb_xhr.message,delete n.__hb_xhr.message),t.addBreadcrumb(e||"XMLHttpRequest",{category:"request",metadata:n.__hb_xhr})}}"onreadystatechange"in n&&"function"==typeof n.onreadystatechange?Y(n,"onreadystatechange",(function(e){return function(){r(),"function"==typeof e&&e.apply(this,arguments)}})):n.onreadystatechange=r,"function"==typeof e&&e.apply(n,arguments)}}))),n("network")&&(0,V.nativeFetch)()&&Y(e,"fetch",(function(n){return function(){const r=arguments[0];let o,i="GET";"string"==typeof r?o=r:"Request"in e&&r instanceof Request?(o=r.url,r.method&&(i=r.method)):o=String(r),arguments[1]&&arguments[1].method&&(i=arguments[1].method),"string"==typeof i&&(i=i.toUpperCase());const a=`${i} ${(0,V.localURLPathname)(o)}`,s={type:"fetch",method:i,url:o};return n.apply(this,arguments).then((function(e){return s.status_code=e.status,t.addBreadcrumb(a,{category:"request",metadata:s}),e})).catch((function(e){throw t.addBreadcrumb("fetch error",{category:"error",metadata:s}),e}))}})),function(){if(!n("navigation"))return;let r=e.location.href;function o(e,n){r=n,t.addBreadcrumb("Page changed",{category:"navigation",metadata:{from:e,to:n}})}function i(e){return function(){const t=arguments.length>2?arguments[2]:void 0;return t&&o(r,String(t)),e.apply(this,arguments)}}Y(e,"onpopstate",(function(t){return function(){if(o(r,e.location.href),t)return t.apply(this,arguments)}})),Y(e.history,"pushState",i),Y(e.history,"replaceState",i)}()}}};var Z={};Object.defineProperty(Z,"__esModule",{value:!0});const ee=r,{instrument:te}=ee.Util;Z.default=function(e=window){return{load:t=>{!function(){function n(e){return function(n){return function(r,o){if("function"==typeof r){const i=Array.prototype.slice.call(arguments,2);return r=t.__wrap(r,e),n((function(){r(...i)}),o)}return n(r,o)}}}te(e,"setTimeout",n({component:"setTimeout"})),te(e,"setInterval",n({component:"setInterval"}))}()}}};var ne={};Object.defineProperty(ne,"__esModule",{value:!0});const re=r,{instrument:oe}=re.Util;ne.default=function(e=window){return{load:t=>{["EventTarget","Window","Node","ApplicationCache","AudioTrackList","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"].forEach((function(n){const r=e[n]&&e[n].prototype;r&&Object.prototype.hasOwnProperty.call(r,"addEventListener")&&(oe(r,"addEventListener",(function(e){const r={component:`${n}.prototype.addEventListener`};return function(n,o,i,a){try{o&&null!=o.handleEvent&&(o.handleEvent=t.__wrap(o.handleEvent,r))}catch(e){t.logger.error(e)}return e.call(this,n,t.__wrap(o,r),i,a)}})),oe(r,"removeEventListener",(function(e){return function(n,r,o,i){return e.call(this,n,r,o,i),e.call(this,n,t.__wrap(r),o,i)}})))}))}}};var ie={};Object.defineProperty(ie,"__esModule",{value:!0}),ie.BrowserTransport=void 0;const ae=r,{sanitize:se}=ae.Util;ie.BrowserTransport=class{send(e,t){return new Promise(((n,r)=>{try{const r=new XMLHttpRequest;if(r.open(e.method,e.endpoint,e.async),Object.keys(e.headers||[]).length)for(const t in e.headers)void 0!==e.headers[t]&&r.setRequestHeader(t,String(e.headers[t]));r.send(t?JSON.stringify(se(t,e.maxObjectDepth)):void 0),r.onload=()=>n({statusCode:r.status,body:r.response})}catch(e){r(e)}}))}};var ce=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0});const ue=r,le=$,fe=D,de=ce(G),ge=ce(z),pe=ce(Z),he=ce(ne),me=ie,{merge:be,filter:ye,objectIsExtensible:_e}=ue.Util;class ve extends ue.Client{constructor(e={}){super(Object.assign({async:!0,maxErrors:null,projectRoot:window.location.protocol+"//"+window.location.host},e),new me.BrowserTransport),this.__errorsSent=0,this.__lastWrapErr=void 0,this.__beforeNotifyHandlers=[e=>this.__exceedsMaxErrors()?(this.logger.debug("Dropping notice: max errors exceeded",e),!1):(e&&!e.url&&(e.url=document.URL),this.__incrementErrorsCount(),!0)]}configure(e={}){return super.configure(e)}resetMaxErrors(){return this.__errorsSent=0}factory(e){return new ve(e)}checkIn(e){throw new Error("Honeybadger.checkIn() is not supported on the browser")}__buildPayload(e){const t={HTTP_USER_AGENT:void 0,HTTP_REFERER:void 0,HTTP_COOKIE:void 0};let n;t.HTTP_USER_AGENT=navigator.userAgent,document.referrer.match(/\S/)&&(t.HTTP_REFERER=document.referrer),n="string"==typeof e.cookies?(0,le.decodeCookie)(e.cookies):e.cookies,n&&(t.HTTP_COOKIE=(0,le.encodeCookie)(ye(n,this.config.filters)));const r=super.__buildPayload(e);return r.request.cgi_data=be(t,r.request.cgi_data),r}__wrap(e,t={}){const n=e;t||(t={});try{if("function"!=typeof n)return n;if(!_e(n))return n;if(!n.___hb){const e=this;n.___hb=function(){if(!le.preferCatch)return n.apply(this,arguments);try{return n.apply(this,arguments)}catch(n){if(e.__lastWrapErr===n)throw n;throw e.__lastWrapErr=n,(0,fe.ignoreNextOnError)(),e.addBreadcrumb(t.component?`${t.component}: ${n.name}`:n.name,{category:"error",metadata:{message:n.message,name:n.name,stack:n.stack}}),e.config.enableUncaught&&e.notify(n),n}}}return n.___hb.___hb=n.___hb,n.___hb}catch(e){return n}}__incrementErrorsCount(){return this.__errorsSent++}__exceedsMaxErrors(){return this.config.maxErrors&&this.__errorsSent>=this.config.maxErrors}}return n.default=new ve({__plugins:[(0,fe.onError)(),(0,de.default)(),(0,pe.default)(),(0,he.default)(),(0,ge.default)()]})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Honeybadger=t()}(this,(function(){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e){var t=e.default;if("function"==typeof t){var n=function(){return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})})),n}var n={},r={},o={},i={},a="<unknown>";var s=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/|[a-z]:\\|\\\\).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,c=/\((\S*)(?::(\d+))(?::(\d+))\)/;var u=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;var l=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,f=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;var d=/^\s*(?:([^@]*)(?:\((.*?)\))?@)?(\S.*?):(\d+)(?::(\d+))?\s*$/i;var g=/^\s*at (?:((?:\[object object\])?[^\\/]+(?: \[as \S+\])?) )?\(?(.*?):(\d+)(?::(\d+))?\)?\s*$/i;var p=Object.freeze({__proto__:null,parse:function(e){return e.split("\n").reduce((function(e,t){var n=function(e){var t=s.exec(e);if(!t)return null;var n=t[2]&&0===t[2].indexOf("native"),r=t[2]&&0===t[2].indexOf("eval"),o=c.exec(t[2]);r&&null!=o&&(t[2]=o[1],t[3]=o[2],t[4]=o[3]);return{file:n?null:t[2],methodName:t[1]||a,arguments:n?[t[2]]:[],lineNumber:t[3]?+t[3]:null,column:t[4]?+t[4]:null}}(t)||function(e){var t=u.exec(e);if(!t)return null;return{file:t[2],methodName:t[1]||a,arguments:[],lineNumber:+t[3],column:t[4]?+t[4]:null}}(t)||function(e){var t=l.exec(e);if(!t)return null;var n=t[3]&&t[3].indexOf(" > eval")>-1,r=f.exec(t[3]);n&&null!=r&&(t[3]=r[1],t[4]=r[2],t[5]=null);return{file:t[3],methodName:t[1]||a,arguments:t[2]?t[2].split(","):[],lineNumber:t[4]?+t[4]:null,column:t[5]?+t[5]:null}}(t)||function(e){var t=g.exec(e);if(!t)return null;return{file:t[2],methodName:t[1]||a,arguments:[],lineNumber:+t[3],column:t[4]?+t[4]:null}}(t)||function(e){var t=d.exec(e);if(!t)return null;return{file:t[3],methodName:t[1]||a,arguments:[],lineNumber:+t[4],column:t[5]?+t[5]:null}}(t);return n&&e.push(n),e}),[])}}),h=t(p),m=e&&e.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),b=e&&e.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),y=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&m(t,e,n);return b(t,e),t},_=e&&e.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(i,"__esModule",{value:!0}),i.isBrowserConfig=i.clone=i.formatCGIData=i.filterUrl=i.filter=i.generateStackTrace=i.endpoint=i.instrument=i.isErrorObject=i.makeNotice=i.logger=i.sanitize=i.shallowClone=i.runAfterNotifyHandlers=i.runBeforeNotifyHandlers=i.getSourceForBacktrace=i.getCauses=i.makeBacktrace=i.objectIsExtensible=i.objectIsEmpty=i.mergeNotice=i.merge=void 0;const v=y(h);function w(e,t){const n={};for(const t in e)n[t]=e[t];for(const e in t)n[e]=t[e];return n}function E(e,t=0){try{const n=v.parse(e).map((e=>({file:e.file,method:e.methodName,number:e.lineNumber,column:e.column})));return n.splice(0,t),n}catch(e){return[]}}function j(e){if("object"!=typeof e||null===e)return{};const t={};for(const n in e)t[n]=e[n];return t}function O(e){return e instanceof Error||"[object Error]"===Object.prototype.toString.call(e)}function k(e,t){for(let n=0;n<t.length;n++)if(-1!==e.toLowerCase().indexOf(t[n].toLowerCase()))return!0;return!1}function x(e,t){const n=Object.prototype.toString.call(t).slice(8,-1);return null!=t&&n===e}function N(e,t,n=2){if(!e)return null;const r=e.split("\n");r.unshift("");const o=t+n,i={};for(let e=t-n;e<=o;e++){const t=r[e];"string"==typeof t&&(i[e]=t)}return i}i.merge=w,i.mergeNotice=function(e,t){const n=w(e,t);return e.context&&t.context&&(n.context=w(e.context,t.context)),n},i.objectIsEmpty=function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0},i.objectIsExtensible=function(e){return"function"!=typeof Object.isExtensible||Object.isExtensible(e)},i.makeBacktrace=E,i.getCauses=function(e){if(e.cause){const t=[];let n=e;for(;t.length<3&&(n=n.cause);)t.push({class:n.name,message:n.message,backtrace:"string"==typeof n.stack?E(n.stack):null});return t}return[]},i.getSourceForBacktrace=function(e,t){return _(this,void 0,void 0,(function*(){const n=[];if(!t||!e||!e.length)return n;let r=0;for(;e.length;){const o=e.splice(0)[r],i=yield t(o.file);n[r]=N(i,o.number),r++}return n}))},i.runBeforeNotifyHandlers=function(e,t){let n=!0;for(let r=0,o=t.length;r<o;r++){!1===(0,t[r])(e)&&(n=!1)}return n},i.runAfterNotifyHandlers=function(e,t,n){e&&e.afterNotify&&e.afterNotify(n,e);for(let r=0,o=t.length;r<o;r++)t[r](n,e);return!0},i.shallowClone=j,i.sanitize=function(e,t=8){const n=[];function r(e,r=0){if(r>=t)return"[DEPTH]";if(!function(e){const t=typeof e;return/function/.test(t)?"toJSON"===e.name:!/symbol/.test(t)&&null!==e&&("object"!=typeof e||void 0!==e.hasOwnProperty)}(e))return Object.prototype.toString.call(e);if(function(e){if(!e||"object"!=typeof e)return!1;for(let t=0;t<n.length;t++)if(n[t]===e)return!0;return n.push(e),!1}(e))return"[RECURSION]";if(Array.isArray(e))return e.map((e=>o(e,r+1)));if("object"==typeof e){const t={};for(const n in e){const i=e[n];Object.prototype.hasOwnProperty.call(e,n)&&null!=n&&null!=i&&(t[n]=o(i,r+1))}return t}return e}function o(e,t=0){try{return r(e,t)}catch(e){return`[ERROR] ${e}`}}return o(e)},i.logger=function(e){const t=t=>function(...n){if("debug"===t){if(!e.config.debug)return;t="log"}n.unshift("[Honeybadger]"),e.config.logger[t](...n)};return{log:t("log"),info:t("info"),debug:t("debug"),warn:t("warn"),error:t("error")}},i.makeNotice=function(e){let t;if(e)if(O(e)){const n=e;t=w(e,{name:n.name,message:n.message,stack:n.stack,cause:n.cause})}else if("object"==typeof e)t=j(e);else{t={message:String(e)}}else t={};return t},i.isErrorObject=O,i.instrument=function(e,t,n){if(!(e&&t&&n&&t in e))return;let r=e[t];for(;r&&r.__hb_original;)r=r.__hb_original;try{e[t]=n(r),e[t].__hb_original=r}catch(e){}},i.endpoint=function(e,t){return`${e.trim().replace(/\/$/,"")}/${t=t.trim().replace(/(^\/|\/$)/g,"")}`},i.generateStackTrace=function(){try{throw new Error("")}catch(e){if(e.stack)return e.stack}const e=10,t=[];let n=arguments.callee;for(;n&&t.length<e;){/function(?:\s+([\w$]+))+\s*\(/.test(n.toString())?t.push(RegExp.$1||"<anonymous>"):t.push("<anonymous>");try{n=n.caller}catch(e){break}}return t.join("\n")},i.filter=function(e,t){if(!x("Object",e))return;x("Array",t)||(t=[]);const n=[];return function e(r){let o,i;if(x("Object",r)||x("Array",r)){if(-1!==n.indexOf(r))return"[CIRCULAR DATA STRUCTURE]";n.push(r)}if(x("Object",r)){for(o in i={},r)k(o,t)?i[o]="[FILTERED]":i[o]=e(r[o]);return i}return x("Array",r)?r.map((function(t){return e(t)})):x("Function",r)?"[FUNC]":r}(e)},i.filterUrl=function(e,t){if(!t)return e;if("string"!=typeof e)return e;const n=e.split(/\?/,2)[1];if(!n)return e;let r=e;return n.split(/[&]\s?/).forEach((e=>{const[n,o]=e.split("=",2);k(n,t)&&(r=r.replace(`${n}=${o}`,`${n}=[FILTERED]`))})),r},i.formatCGIData=function(e,t=""){const n={};return Object.keys(e).forEach((function(r){const o=t+r.replace(/\W/g,"_").toUpperCase();n[o]=e[r]})),n},i.clone=function(e){return JSON.parse(JSON.stringify(e))},i.isBrowserConfig=function(e){return void 0!==e.async};var S={};Object.defineProperty(S,"__esModule",{value:!0}),S.GlobalStore=void 0;S.GlobalStore=class{constructor(e){this.store=e}getStore(){return this.store}run(e,t,...n){return this.store=e,t(...n)}},Object.defineProperty(o,"__esModule",{value:!0}),o.Client=void 0;const C=i,T=S,P={name:"honeybadger-js",url:"https://github.com/honeybadger-io/honeybadger-js",version:"4.1.2"},R=/,|\s+/,U=/\S/;o.Client=class{constructor(e={},t){this.__pluginsExecuted=!1,this.__store=null,this.__beforeNotifyHandlers=[],this.__afterNotifyHandlers=[],this.config=Object.assign({apiKey:null,endpoint:"https://api.honeybadger.io",environment:null,hostname:null,projectRoot:null,component:null,action:null,revision:null,reportData:null,breadcrumbsEnabled:!0,maxBreadcrumbs:40,maxObjectDepth:8,logger:console,developmentEnvironments:["dev","development","test"],debug:!1,tags:null,enableUncaught:!0,enableUnhandledRejection:!0,afterUncaught:()=>!0,filters:["creditcard","password"],__plugins:[]},e),this.__store=new T.GlobalStore({context:{},breadcrumbs:[]}),this.__transport=t,this.logger=(0,C.logger)(this)}getVersion(){return P.version}configure(e={}){for(const t in e)this.config[t]=e[t];return this.__pluginsExecuted||(this.__pluginsExecuted=!0,this.config.__plugins.forEach((e=>e.load(this)))),this}__setStore(e){this.__store=e}beforeNotify(e){return this.__beforeNotifyHandlers.push(e),this}afterNotify(e){return this.__afterNotifyHandlers.push(e),this}setContext(e){if("object"==typeof e){const t=this.__store.getStore();t.context=(0,C.merge)(t.context,e)}return this}resetContext(e){this.logger.warn("Deprecation warning: `Honeybadger.resetContext()` has been deprecated; please use `Honeybadger.clear()` instead.");const t=this.__store.getStore();return t.context="object"==typeof e&&null!==e?e:{},this}clear(){const e=this.__store.getStore();return e.context={},e.breadcrumbs=[],this}notify(e,t,n){let r=null;const o=this.makeNotice(e,t,n);o||(this.logger.debug("failed to build error report"),r=new Error("failed to build error report")),r||!1!==this.config.reportData||(this.logger.debug("skipping error report: honeybadger.js is disabled",o),r=new Error("honeybadger.js is disabled")),!r&&this.__developmentMode()&&(this.logger.log("honeybadger.js is in development mode; the following error report will be sent in production.",o),r=new Error("honeybadger.js is in development mode")),r||this.config.apiKey||(this.logger.warn("could not send error report: no API key has been configured",o),r=new Error("missing API key"));const i=o&&o.backtrace?o.backtrace.map((e=>(0,C.shallowClone)(e))):null,a=(0,C.runBeforeNotifyHandlers)(o,this.__beforeNotifyHandlers);if(r||a||(this.logger.debug("skipping error report: beforeNotify handlers returned false",o),r=new Error("beforeNotify handlers returned false")),r)return(0,C.runAfterNotifyHandlers)(o,this.__afterNotifyHandlers,r),!1;this.addBreadcrumb("Honeybadger Notice",{category:"notice",metadata:{message:o.message,name:o.name,stack:o.stack}});const s=this.__getStoreContentsOrDefault().breadcrumbs;return o.__breadcrumbs=this.config.breadcrumbsEnabled?s.slice():[],(0,C.getSourceForBacktrace)(i,this.__getSourceFileHandler).then((e=>{e.forEach(((e,t)=>{o.backtrace[t].source=e}));const t=this.__buildPayload(o);this.__transport.send({headers:{"X-API-Key":this.config.apiKey,"Content-Type":"application/json",Accept:"text/json, application/json"},method:"POST",endpoint:(0,C.endpoint)(this.config.endpoint,"/v1/notices/js"),maxObjectDepth:this.config.maxObjectDepth,logger:this.logger,async:(0,C.isBrowserConfig)(this.config)?this.config.async:void 0},t).then((e=>{if(201!==e.statusCode)return(0,C.runAfterNotifyHandlers)(o,this.__afterNotifyHandlers,new Error(`Bad HTTP response: ${e.statusCode}`)),void this.logger.warn(`Error report failed: unknown response from server. code=${e.statusCode}`);const t=JSON.parse(e.body).id;(0,C.runAfterNotifyHandlers)((0,C.merge)(o,{id:t}),this.__afterNotifyHandlers),this.logger.info(`Error report sent ⚡ https://app.honeybadger.io/notice/${t}`)})).catch((e=>{this.logger.error("Error report failed: an unknown error occurred.",`message=${e.message}`),(0,C.runAfterNotifyHandlers)(o,this.__afterNotifyHandlers,e)}))})),!0}notifyAsync(e,t,n){return new Promise(((r,o)=>{let i;i=e.afterNotify?e:t&&t.afterNotify?t:n&&n.afterNotify?n:t&&"object"==typeof t?t:n||(t={}),(e=>{const t=e.afterNotify;e.afterNotify=e=>{if(null==t||t.call(this,e),e)return o(e);r()}})(i),this.notify(e,t,n)}))}makeNotice(e,t,n){let r=(0,C.makeNotice)(e);if(t&&"object"!=typeof t){t={name:String(t)}}if(t&&(r=(0,C.mergeNotice)(r,t)),"object"==typeof n&&null!==n&&(r=(0,C.mergeNotice)(r,n)),(0,C.objectIsEmpty)(r))return null;const o=this.__getStoreContentsOrDefault().context,i=this.__constructTags(r.tags),a=this.__constructTags(o.tags),s=this.__constructTags(this.config.tags),c=i.concat(a).concat(s),u=c.filter(((e,t)=>c.indexOf(e)===t));r=(0,C.merge)(r,{name:r.name||"Error",context:(0,C.merge)(o,r.context),projectRoot:r.projectRoot||this.config.projectRoot,environment:r.environment||this.config.environment,component:r.component||this.config.component,action:r.action||this.config.action,revision:r.revision||this.config.revision,tags:u});let l=0;return"string"==typeof r.stack&&r.stack.trim()||(r.stack=(0,C.generateStackTrace)(),l=2),r.backtrace=(0,C.makeBacktrace)(r.stack,l),r}addBreadcrumb(e,t){if(!this.config.breadcrumbsEnabled)return;t=t||{};const n=(0,C.shallowClone)(t.metadata),r=t.category||"custom",o=(new Date).toISOString(),i=this.__store.getStore();let a=i.breadcrumbs;a.push({category:r,message:e,metadata:n,timestamp:o});const s=this.config.maxBreadcrumbs;return a.length>s&&(a=a.slice(a.length-s)),i.breadcrumbs=a,this}__developmentMode(){return!0!==this.config.reportData&&(this.config.environment&&this.config.developmentEnvironments.includes(this.config.environment))}__buildPayload(e){const t=(0,C.filter)(e.headers,this.config.filters)||{},n=(0,C.filter)(Object.assign(Object.assign({},e.cgiData),(0,C.formatCGIData)(t,"HTTP_")),this.config.filters);return{notifier:P,breadcrumbs:{enabled:!!this.config.breadcrumbsEnabled,trail:e.__breadcrumbs||[]},error:{class:e.name,message:e.message,backtrace:e.backtrace,fingerprint:e.fingerprint,tags:e.tags,causes:(0,C.getCauses)(e)},request:{url:(0,C.filterUrl)(e.url,this.config.filters),component:e.component,action:e.action,context:e.context,cgi_data:n,params:(0,C.filter)(e.params,this.config.filters)||{},session:(0,C.filter)(e.session,this.config.filters)||{}},server:{project_root:e.projectRoot,environment_name:e.environment,revision:e.revision,hostname:this.config.hostname,time:(new Date).toUTCString()},details:e.details||{}}}__constructTags(e){return e?e.toString().split(R).filter((e=>U.test(e))):[]}__getStoreContentsOrDefault(){const e=this.__store.getStore()||{};return Object.assign({context:{},breadcrumbs:[]},e)}};var H={};Object.defineProperty(H,"__esModule",{value:!0}),function(t){var n=e&&e.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),r=e&&e.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)"default"!==o&&Object.prototype.hasOwnProperty.call(e,o)&&n(t,e,o);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Util=t.Types=t.Store=t.Client=void 0;var s=o;Object.defineProperty(t,"Client",{enumerable:!0,get:function(){return s.Client}}),t.Store=a(S),t.Types=a(H),t.Util=a(i)}(r);var $={};function M(e){if(!e||!e.tagName)return"";let t=e.tagName.toLowerCase();if("html"===t)return"";e.id&&(t+=`#${e.id}`);const n=e.getAttribute("class");n&&n.split(/\s+/).forEach((e=>{t+=`.${e}`})),["alt","name","title","type"].forEach((n=>{const r=e.getAttribute(n);r&&(t+=`[${n}="${r}"]`)}));const r=function(e){try{const t=e.parentNode.childNodes,n=[];return Array.prototype.forEach.call(t,(t=>{t.tagName&&t.tagName===e.tagName&&n.push(t)})),n}catch(e){return[]}}(e);return r.length>1&&(t+=`:nth-child(${Array.prototype.indexOf.call(r,e)+1})`),t}function B(e){return-1!==e.toString().indexOf("native")}function A(e){const t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/)||{};return{protocol:t[2],host:t[4],pathname:t[5]}}Object.defineProperty($,"__esModule",{value:!0}),$.preferCatch=$.encodeCookie=$.decodeCookie=$.localURLPathname=$.parseURL=$.nativeFetch=$.stringTextOfElement=$.stringSelectorOfElement=$.stringNameOfElement=void 0,$.stringNameOfElement=M,$.stringSelectorOfElement=function e(t){const n=M(t);if(t.parentNode&&t.parentNode.tagName){const r=e(t.parentNode);if(r.length>0)return`${r} > ${n}`}return n},$.stringTextOfElement=function(e){let t=e.textContent||e.innerText||"";return t||"submit"!==e.type&&"button"!==e.type||(t=e.value),function(e,t){e.length>t&&(e=e.substr(0,t)+"...");return e}(t.trim(),300)},$.nativeFetch=function(){if(!window.fetch)return!1;if(B(window.fetch))return!0;try{const e=document.createElement("iframe");e.style.display="none",document.head.appendChild(e);const t=e.contentWindow.fetch&&B(e.contentWindow.fetch);return document.head.removeChild(e),t}catch(e){console&&console.warn&&console.warn("failed to detect native fetch via iframe: "+e)}return!1},$.parseURL=A,$.localURLPathname=function(e){const t=A(e),n=A(document.URL);return t.host&&t.protocol?t.protocol===n.protocol&&t.host===n.host?t.pathname:`${t.protocol}://${t.host}${t.pathname}`:t.pathname},$.decodeCookie=function(e){const t={};return e.split(/[;,]\s?/).forEach((e=>{const[n,r]=e.split("=",2);t[n]=r})),t},$.encodeCookie=function(e){if("object"!=typeof e)return;const t=[];for(const n in e)t.push(n+"="+e[n]);return t.join(";")},$.preferCatch=function(){let e=!0;if(window.atob||(e=!1),window.ErrorEvent)try{0===new window.ErrorEvent("").colno&&(e=!1)}catch(e){}return e}();var D={};Object.defineProperty(D,"__esModule",{value:!0}),D.onError=D.ignoreNextOnError=void 0;const I=r,{instrument:L,makeNotice:q}=I.Util;let F,W=0;D.ignoreNextOnError=function(){W+=1,clearTimeout(F),F=setTimeout((()=>{W=0}))},D.onError=function(e=window){return{load:t=>{L(e,"onerror",(function(e){const n=function(e,n,r,o,i){if(t.logger.debug("window.onerror callback invoked",arguments),W>0)return t.logger.debug("Ignoring window.onerror (error likely reported earlier)",arguments),void(W-=1);if(0===r&&/Script error\.?/.test(e))return void(t.config.enableUncaught&&t.logger.warn("Ignoring cross-domain script error: enable CORS to track these types of errors",arguments));const a=q(i);a.name||(a.name="window.onerror"),a.message||(a.message=e),a.stack||(a.stack=[a.message,"\n at ? (",n||"unknown",":",r||0,":",o||0,")"].join("")),t.addBreadcrumb("window.onerror"!==a.name&&a.name?`window.onerror: ${a.name}`:"window.onerror",{category:"error",metadata:{name:a.name,message:a.message,stack:a.stack}}),t.config.enableUncaught&&t.notify(a)};return function(t,r,o,i,a){return n(t,r,o,i,a),"function"==typeof e&&e.apply(window,arguments)}}))}}};var G={};Object.defineProperty(G,"__esModule",{value:!0});const X=r,{instrument:K}=X.Util;G.default=function(e=window){return{load:t=>{t.config.enableUnhandledRejection&&K(e,"onunhandledrejection",(function(e){function n(e){var n;if(t.logger.debug("window.onunhandledrejection callback invoked",arguments),!t.config.enableUnhandledRejection)return;const{reason:r}=e;if(r instanceof Error){const e="unknown",n=0,o=`${r.message}\n at ? (${e}:${n})`,i=r.stack||o,a={name:r.name,message:`UnhandledPromiseRejectionWarning: ${r}`,stack:i};return t.addBreadcrumb(`window.onunhandledrejection: ${a.name}`,{category:"error",metadata:a}),void t.notify(a)}const o="string"==typeof r?r:null!==(n=JSON.stringify(r))&&void 0!==n?n:"Unspecified reason";t.notify({name:"window.onunhandledrejection",message:`UnhandledPromiseRejectionWarning: ${o}`})}return function(t){n(t),"function"==typeof e&&e.apply(this,arguments)}}))}}};var z={};Object.defineProperty(z,"__esModule",{value:!0});const J=r,V=$,{sanitize:Q,instrument:Y}=J.Util;z.default=function(e=window){return{load:t=>{function n(e){return!0===t.config.breadcrumbsEnabled||(e?!0===t.config.breadcrumbsEnabled[e]:!1!==t.config.breadcrumbsEnabled)}!function(){function r(e){return Array.isArray(e)?e.map((e=>{try{return String(e)}catch(e){return"[unknown]"}})).join(" "):""}n("console")&&["debug","info","warn","error","log"].forEach((n=>{Y(e.console,n,(function(o){return function(){const i=Array.prototype.slice.call(arguments),a=r(i),s={category:"log",metadata:{level:n,arguments:Q(i,3)}};t.addBreadcrumb(a,s),"function"==typeof o&&Function.prototype.apply.call(o,e.console,arguments)}}))}))}(),n("dom")&&e.addEventListener("click",(e=>{let n,r,o;try{n=(0,V.stringNameOfElement)(e.target),r=(0,V.stringSelectorOfElement)(e.target),o=(0,V.stringTextOfElement)(e.target)}catch(e){n="UI Click",r="[unknown]",o="[unknown]"}0!==n.length&&t.addBreadcrumb(n,{category:"ui.click",metadata:{selector:r,text:o,event:e}})}),!0),n("network")&&(Y(XMLHttpRequest.prototype,"open",(function(e){return function(){const t=this,n=arguments[1],r="string"==typeof arguments[0]?arguments[0].toUpperCase():arguments[0],o=`${r} ${(0,V.localURLPathname)(n)}`;this.__hb_xhr={type:"xhr",method:r,url:n,message:o},"function"==typeof e&&e.apply(t,arguments)}})),Y(XMLHttpRequest.prototype,"send",(function(e){return function(){const n=this;function r(){if(4===n.readyState){let e;n.__hb_xhr&&(n.__hb_xhr.status_code=n.status,e=n.__hb_xhr.message,delete n.__hb_xhr.message),t.addBreadcrumb(e||"XMLHttpRequest",{category:"request",metadata:n.__hb_xhr})}}"onreadystatechange"in n&&"function"==typeof n.onreadystatechange?Y(n,"onreadystatechange",(function(e){return function(){r(),"function"==typeof e&&e.apply(this,arguments)}})):n.onreadystatechange=r,"function"==typeof e&&e.apply(n,arguments)}}))),n("network")&&(0,V.nativeFetch)()&&Y(e,"fetch",(function(n){return function(){const r=arguments[0];let o,i="GET";"string"==typeof r?o=r:"Request"in e&&r instanceof Request?(o=r.url,r.method&&(i=r.method)):o=String(r),arguments[1]&&arguments[1].method&&(i=arguments[1].method),"string"==typeof i&&(i=i.toUpperCase());const a=`${i} ${(0,V.localURLPathname)(o)}`,s={type:"fetch",method:i,url:o};return n.apply(this,arguments).then((function(e){return s.status_code=e.status,t.addBreadcrumb(a,{category:"request",metadata:s}),e})).catch((function(e){throw t.addBreadcrumb("fetch error",{category:"error",metadata:s}),e}))}})),function(){if(!n("navigation"))return;let r=e.location.href;function o(e,n){r=n,t.addBreadcrumb("Page changed",{category:"navigation",metadata:{from:e,to:n}})}function i(e){return function(){const t=arguments.length>2?arguments[2]:void 0;return t&&o(r,String(t)),e.apply(this,arguments)}}Y(e,"onpopstate",(function(t){return function(){if(o(r,e.location.href),t)return t.apply(this,arguments)}})),Y(e.history,"pushState",i),Y(e.history,"replaceState",i)}()}}};var Z={};Object.defineProperty(Z,"__esModule",{value:!0});const ee=r,{instrument:te}=ee.Util;Z.default=function(e=window){return{load:t=>{!function(){function n(e){return function(n){return function(r,o){if("function"==typeof r){const i=Array.prototype.slice.call(arguments,2);return r=t.__wrap(r,e),n((function(){r(...i)}),o)}return n(r,o)}}}te(e,"setTimeout",n({component:"setTimeout"})),te(e,"setInterval",n({component:"setInterval"}))}()}}};var ne={};Object.defineProperty(ne,"__esModule",{value:!0});const re=r,{instrument:oe}=re.Util;ne.default=function(e=window){return{load:t=>{["EventTarget","Window","Node","ApplicationCache","AudioTrackList","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"].forEach((function(n){const r=e[n]&&e[n].prototype;r&&Object.prototype.hasOwnProperty.call(r,"addEventListener")&&(oe(r,"addEventListener",(function(e){const r={component:`${n}.prototype.addEventListener`};return function(n,o,i,a){try{o&&null!=o.handleEvent&&(o.handleEvent=t.__wrap(o.handleEvent,r))}catch(e){t.logger.error(e)}return e.call(this,n,t.__wrap(o,r),i,a)}})),oe(r,"removeEventListener",(function(e){return function(n,r,o,i){return e.call(this,n,r,o,i),e.call(this,n,t.__wrap(r),o,i)}})))}))}}};var ie={};Object.defineProperty(ie,"__esModule",{value:!0}),ie.BrowserTransport=void 0;const ae=r,{sanitize:se}=ae.Util;ie.BrowserTransport=class{send(e,t){return new Promise(((n,r)=>{try{const r=new XMLHttpRequest;if(r.open(e.method,e.endpoint,e.async),Object.keys(e.headers||[]).length)for(const t in e.headers)void 0!==e.headers[t]&&r.setRequestHeader(t,String(e.headers[t]));r.send(t?JSON.stringify(se(t,e.maxObjectDepth)):void 0),r.onload=()=>n({statusCode:r.status,body:r.response})}catch(e){r(e)}}))}};var ce=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0});const ue=r,le=$,fe=D,de=ce(G),ge=ce(z),pe=ce(Z),he=ce(ne),me=ie,{merge:be,filter:ye,objectIsExtensible:_e}=ue.Util;class ve extends ue.Client{constructor(e={}){super(Object.assign({async:!0,maxErrors:null,projectRoot:window.location.protocol+"//"+window.location.host},e),new me.BrowserTransport),this.__errorsSent=0,this.__lastWrapErr=void 0,this.__beforeNotifyHandlers=[e=>this.__exceedsMaxErrors()?(this.logger.debug("Dropping notice: max errors exceeded",e),!1):(e&&!e.url&&(e.url=document.URL),this.__incrementErrorsCount(),!0)]}configure(e={}){return super.configure(e)}resetMaxErrors(){return this.__errorsSent=0}factory(e){return new ve(e)}checkIn(e){throw new Error("Honeybadger.checkIn() is not supported on the browser")}__buildPayload(e){const t={HTTP_USER_AGENT:void 0,HTTP_REFERER:void 0,HTTP_COOKIE:void 0};let n;t.HTTP_USER_AGENT=navigator.userAgent,document.referrer.match(/\S/)&&(t.HTTP_REFERER=document.referrer),n="string"==typeof e.cookies?(0,le.decodeCookie)(e.cookies):e.cookies,n&&(t.HTTP_COOKIE=(0,le.encodeCookie)(ye(n,this.config.filters)));const r=super.__buildPayload(e);return r.request.cgi_data=be(t,r.request.cgi_data),r}__wrap(e,t={}){const n=e;t||(t={});try{if("function"!=typeof n)return n;if(!_e(n))return n;if(!n.___hb){const e=this;n.___hb=function(){if(!le.preferCatch)return n.apply(this,arguments);try{return n.apply(this,arguments)}catch(n){if(e.__lastWrapErr===n)throw n;throw e.__lastWrapErr=n,(0,fe.ignoreNextOnError)(),e.addBreadcrumb(t.component?`${t.component}: ${n.name}`:n.name,{category:"error",metadata:{message:n.message,name:n.name,stack:n.stack}}),e.config.enableUncaught&&e.notify(n),n}}}return n.___hb.___hb=n.___hb,n.___hb}catch(e){return n}}__incrementErrorsCount(){return this.__errorsSent++}__exceedsMaxErrors(){return this.config.maxErrors&&this.__errorsSent>=this.config.maxErrors}}return n.default=new ve({__plugins:[(0,fe.onError)(),(0,de.default)(),(0,pe.default)(),(0,he.default)(),(0,ge.default)()]})})); | ||
//# sourceMappingURL=honeybadger.min.js.map |
@@ -675,3 +675,3 @@ 'use strict'; | ||
url: 'https://github.com/honeybadger-io/honeybadger-js', | ||
version: '4.1.1' | ||
version: '4.1.2' | ||
}; | ||
@@ -678,0 +678,0 @@ // Split at commas and spaces |
{ | ||
"name": "@honeybadger-io/js", | ||
"version": "4.1.1", | ||
"version": "4.1.2", | ||
"license": "MIT", | ||
@@ -53,3 +53,4 @@ "homepage": "https://github.com/honeybadger-io/honeybadger-js", | ||
"dependencies": { | ||
"@honeybadger-io/core": "^4.1.1" | ||
"@honeybadger-io/core": "^4.1.1", | ||
"@types/aws-lambda": "^8.10.89" | ||
}, | ||
@@ -60,3 +61,2 @@ "devDependencies": { | ||
"@rollup/plugin-replace": "^4.0.0", | ||
"@types/aws-lambda": "^8.10.89", | ||
"@types/express": "^4.17.13", | ||
@@ -79,3 +79,3 @@ "@types/jest": "^27.0.3", | ||
}, | ||
"gitHead": "bdd1ab0feb21fe6a7343325e5693364e680169a1" | ||
"gitHead": "362837b27ee55eec6dc0a13633b93d2be0cccd44" | ||
} |
Sorry, the diff of this file is too big to display
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
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
16
2
+ Added@types/aws-lambda@^8.10.89
+ Added@types/aws-lambda@8.10.146(transitive)