rollbar
Version:
Effortlessly track and debug errors in your JavaScript applications with Rollbar. This package includes advanced error tracking features and an intuitive interface to help you identify and fix issues more quickly.
2 lines • 78.9 kB
JavaScript
/*! For license information please see rollbar.min.cjs.LICENSE.txt */
(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};t.d(e,{default:()=>jr});const r=require("os"),n=require("url"),o=require("util"),i=require("json-stringify-safe");function a(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return s(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function u(t){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},u(t)}function l(t,e){return e===c(t)}function c(t){var e=u(t);return"object"!==e?e:t?t instanceof Error?"error":{}.toString.call(t).match(/\s([a-zA-Z]+)/)[1].toLowerCase():"null"}function f(t){return l(t,"function")}function p(t){return null!=t&&("object"==u(t)||"function"==typeof t)}function d(t,e){return null!=t&&(Object.hasOwn?Object.hasOwn(t,e):Object.prototype.hasOwnProperty.call(t,e))}function h(){return"********"}var m={debug:0,info:1,warning:2,error:3,critical:4};function y(t,e){var r,n;try{r=JSON.stringify(t)}catch(o){if(e&&f(e))try{r=e(t)}catch(t){n=t}else n=o}return{error:n,value:r}}function v(t,e){return function(r,n){try{e(r,n)}catch(e){t.error(e)}}}function g(t){return function t(e,r){var n,o,i,a={};try{for(o in e)(n=e[o])&&(l(n,"object")||l(n,"array"))?r.includes(n)?a[o]="Removed circular reference: "+c(n):((i=r.slice()).push(n),a[o]=t(n,i)):a[o]=n}catch(t){a="Failed cloning custom data: "+t.message}return a}(t,[t])}function b(t,e,r,n,o){for(var i,a,s,u,l,f,p=[],d=[],h=0,m=t.length;h<m;++h){var y=c(f=t[h]);switch(d.push(y),y){case"undefined":break;case"string":i?p.push(f):i=f;break;case"function":u=v(e,f);break;case"date":p.push(f);break;case"error":case"domexception":case"exception":a?p.push(f):a=f;break;case"object":case"array":if(f instanceof Error||"undefined"!=typeof DOMException&&f instanceof DOMException){a?p.push(f):a=f;break}if(n&&"object"===y&&!l){for(var b=0,w=n.length;b<w;++b)if(void 0!==f[n[b]]){l=f;break}if(l)break}s?p.push(f):s=f;break;default:if(f instanceof Error||"undefined"!=typeof DOMException&&f instanceof DOMException){a?p.push(f):a=f;break}p.push(f)}}s&&(s=g(s)),p.length>0&&(s||(s=g({})),s.extraArgs=g(p));var k,_={message:i,err:a,custom:s,timestamp:O(),callback:u,notifier:r,diagnostic:{},uuid:(k=O(),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=(k+16*Math.random())%16|0;return k=Math.floor(k/16),("x"===t?e:7&e|8).toString(16)}))};return _.data=_.data||{},function(t,e){e&&void 0!==e.level&&(t.level=e.level,delete e.level);e&&void 0!==e.skipFrames&&(t.skipFrames=e.skipFrames,delete e.skipFrames)}(_,s),n&&l&&(_.request=l),o&&(_.lambdaContext=o),_._originalArgs=t,_.diagnostic.original_arg_types=d,_}var w=["log","network","dom","navigation","error","manual"],k=["critical","error","warning","info","debug"];function _(t,e){var r,n=a(t);try{for(n.s();!(r=n.n()).done;){if(r.value===e)return!0}}catch(t){n.e(t)}finally{n.f()}return!1}function S(t,e){t.attributes=t.attributes||[];var r,n=a(e);try{for(n.s();!(r=n.n()).done;){var o=r.value;void 0!==o.value&&t.attributes.push(o)}}catch(t){n.e(t)}finally{n.f()}}function E(t,e){if(t){var r=e.split("."),n=t;try{for(var o=0,i=r.length;o<i;++o)n=n[r[o]]}catch(t){n=void 0}return n}}function x(t,e,r){if(t){Object.setPrototypeOf(t,null);var n=e.split("."),o=n.length;if(!(o<1))if(1!==o)try{for(var i=t[n[0]]||{},a=i,s=1;s<o-1;++s)i[n[s]]=i[n[s]]||{},i=i[n[s]];i[n[o-1]]=r,t[n[0]]=a}catch(t){return}else t[n[0]]=r}}function O(){return Date.now?Date.now():Number(new Date)}function I(t,e,r,n){var o=T(t,e,r);return o=function(t,e){t.hostWhiteList&&!t.hostSafeList&&(t.hostSafeList=t.hostWhiteList,t.hostWhiteList=void 0,e&&e.log("hostWhiteList is deprecated. Use hostSafeList."));t.hostBlackList&&!t.hostBlockList&&(t.hostBlockList=t.hostBlackList,t.hostBlackList=void 0,e&&e.log("hostBlackList is deprecated. Use hostBlockList."));return t}(o,n),!e||e.overwriteScrubFields||e.scrubFields&&(o.scrubFields=(t.scrubFields||[]).concat(e.scrubFields)),o}function T(){function t(t){if(!t||"[object Object]"!==Object.prototype.toString.call(t))return!1;var e,r=d(t,"constructor"),n=t.constructor&&t.constructor.prototype&&d(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!r&&!n)return!1;for(e in t);return void 0===e||d(t,e)}var e,r,n,o,i,a=Object.create(null),s=null,u=arguments.length;for(e=0;e<u;e++)if(null!=(s=arguments[e]))for(i in s)r=a[i],a!==(n=s[i])&&(n&&t(n)?(o=r&&t(r)?r:{},a[i]=T(o,n)):void 0!==n&&(a[i]=n));return a}function j(t,e,r){var n;if(null==e||!e.sessionId||!r)return!1;var o=null==t||null===(n=t.tracing)||void 0===n?void 0:n.propagation,i=null==o?void 0:o.enabledHeaders;if(!Array.isArray(i)||!i.includes("baggage"))return!1;var a=null==o?void 0:o.enabledCorsUrls;return!(!Array.isArray(a)||0===a.length)&&a.some(function(t){return l(t,"string")?r===t:!!l(t,"regexp")&&t.test(r)})}function P(t,e){var r,n,o=t[1],i=null===(r=o)||void 0===r?void 0:r.headers,a=(n=t[0],"undefined"!=typeof Request&&n instanceof Request&&t[0].headers),s=i||a;if(s||(o||(t[1]=o={}),s=o.headers={}),s instanceof Headers)for(var u=0,l=Object.keys(e);u<l.length;u++){var c=l[u];s.append(c,e[c])}else if(p(s))for(var f=0,d=Object.keys(e);f<d.length;f++){var h=d[f];s[h]=e[h]}}function R(t){var e=t.asyncLocalStorage;if(!e||"function"!=typeof e.getStore)return null;var r=e.getStore();return(null==r?void 0:r.sessionId)||null}function A(t){if(!l(t.context,"string")){var e=y(t.context);e.error?t.context="Error: could not serialize 'context'":t.context=e.value||"",t.context.length>255&&(t.context=t.context.substr(0,255))}return{data:t}}function L(t,e,r){var n=e.hostname,o=e.protocol,i=e.port,a=e.path,s=e.search,u=t.timeout,l=function(t){var e="undefined"!=typeof window&&window||"undefined"!=typeof self&&self,r=t.defaultTransport||"xhr";void 0===e.fetch&&(r="xhr");void 0===e.XMLHttpRequest&&(r="fetch");return r}(t),c=t.proxy;if(t.endpoint){var f=r.parse(t.endpoint);n=f.hostname,o=f.protocol,i=f.port,a=f.pathname,s=f.search}return{timeout:u,hostname:n,protocol:o,port:i,path:a,search:s,proxy:c,transport:l}}function q(t,e){var r=t.protocol||"https:",n=t.port||("http:"===r?80:"https:"===r?443:void 0),o=t.hostname,i=t.path,a=t.timeout,s=t.transport;return t.search&&(i+=t.search),t.proxy&&(i=r+"//"+o+i,o=t.proxy.host||t.proxy.hostname,n=t.proxy.port,r=t.proxy.protocol||r),{timeout:a,protocol:r,hostname:o,path:i,port:n,method:e,transport:s}}function C(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function M(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?C(Object(r),!0).forEach(function(e){U(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):C(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function U(t,e,r){return(e=J(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function D(t){return D="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},D(t)}function N(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var u=n&&n.prototype instanceof s?n:s,l=Object.create(u.prototype);return H(l,"_invoke",function(r,n,o){var i,s,u,l=0,c=o||[],f=!1,p={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,r){return i=e,s=0,u=t,p.n=r,a}};function d(r,n){for(s=r,u=n,e=0;!f&&l&&!o&&e<c.length;e++){var o,i=c[e],d=p.p,h=i[2];r>3?(o=h===n)&&(u=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=t):i[0]<=d&&((o=r<2&&d<i[1])?(s=0,p.v=n,p.n=i[1]):d<h&&(o=r<3||i[0]>n||n>h)&&(i[4]=r,i[5]=n,p.n=h,s=0))}if(o||r>1)return a;throw f=!0,n}return function(o,c,h){if(l>1)throw TypeError("Generator is already running");for(f&&1===c&&d(c,h),s=c,u=h;(e=s<2?t:u)||!f;){i||(s?s<3?(s>1&&(p.n=-1),d(s,u)):p.n=u:p.v=u);try{if(l=2,i){if(s||(o="next"),e=i[o]){if(!(e=e.call(i,u)))throw TypeError("iterator result is not an object");if(!e.done)return e;u=e.value,s<2&&(s=0)}else 1===s&&(e=i.return)&&e.call(i),s<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=t}else if((e=(f=p.n<0)?u:r.call(n,p))!==a)break}catch(e){i=t,s=1,u=e}finally{l=1}}return{value:e,done:f}}}(r,o,i),!0),l}var a={};function s(){}function u(){}function l(){}e=Object.getPrototypeOf;var c=[][n]?e(e([][n]())):(H(e={},n,function(){return this}),e),f=l.prototype=s.prototype=Object.create(c);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,H(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return u.prototype=l,H(f,"constructor",l),H(l,"constructor",u),u.displayName="GeneratorFunction",H(l,o,"GeneratorFunction"),H(f),H(f,o,"Generator"),H(f,n,function(){return this}),H(f,"toString",function(){return"[object Generator]"}),(N=function(){return{w:i,m:p}})()}function H(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}H=function(t,e,r,n){function i(e,r){H(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(i("next",0),i("throw",1),i("return",2))},H(t,e,r,n)}function F(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,o)}function B(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,J(n.key),n)}}function J(t){var e=function(t,e){if("object"!=D(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=D(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==D(e)?e:e+""}var W={hostname:"api.rollbar.com",path:"/api/1/item/",search:null,version:"1",protocol:"https:",port:443},G={hostname:"api.rollbar.com",path:"/api/1/session/",search:null,version:"1",protocol:"https:",port:443},z=function(){return t=function t(e,r,n,o){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.options=e,this.transport=r,this.url=n,this.truncation=o,this.accessToken=e.accessToken,this.transportOptions=$(e,n),this.OTLPTransportOptions=Q(e,n)},e=[{key:"_postPromise",value:function(t){var e=this,r=t.accessToken,n=t.options,o=t.payload,i=t.headers;return new Promise(function(t,a){e.transport.post({accessToken:r,options:n,payload:o,headers:i,callback:function(e,r){return e?a(e):t(r)}})})}},{key:"postItem",value:function(t,e){var r=this,n=q(this.transportOptions,"POST"),o=A(t);setTimeout(function(){r.transport.post({accessToken:r.accessToken,options:n,payload:o,callback:e})},0)}},{key:"postSpans",value:(n=N().m(function t(e){var r,n,o=arguments;return N().w(function(t){for(;;)if(0===t.n)return r=o.length>1&&void 0!==o[1]?o[1]:{},n=q(this.OTLPTransportOptions,"POST"),t.a(2,this._postPromise({accessToken:this.accessToken,options:n,payload:e,headers:r}))},t,this)}),o=function(){var t=this,e=arguments;return new Promise(function(r,o){var i=n.apply(t,e);function a(t){F(i,r,o,a,s,"next",t)}function s(t){F(i,r,o,a,s,"throw",t)}a(void 0)})},function(t){return o.apply(this,arguments)})},{key:"buildJsonPayload",value:function(t,e){var r,n=A(t);return(r=this.truncation?this.truncation.truncate(n):y(n)).error?(e&&e(r.error),null):r.value}},{key:"postJsonPayload",value:function(t,e){var r=q(this.transportOptions,"POST");this.transport.postJsonPayload(this.accessToken,r,t,e)}},{key:"configure",value:function(t){var e=this.options;return this.options=T(e,t),this.transportOptions=$(this.options,this.url),this.OTLPTransportOptions=Q(this.options,this.url),void 0!==this.options.accessToken&&(this.accessToken=this.options.accessToken),this}}],e&&B(t.prototype,e),r&&B(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r,n,o}();function $(t,e){return L(t,W,e)}function Q(t,e){var r;return L(t=M(M({},t),{},{endpoint:null===(r=t.tracing)||void 0===r?void 0:r.endpoint}),G,e)}const Z=z;var V="3.1.0",X="debug";var K=function(){},Y={debug:0,info:1,warn:2,error:3,disable:4},tt={error:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return K("error",e)},warn:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return K("warn",e)},info:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return K("info",e)},debug:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return K("debug",e)},log:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return K("info",e)},init:function(t){var e=t.logLevel;K=function(t,r){Y[t]<Y[e]||(r.unshift("Rollbar:"),console[t].apply(console,r))}}};const et=tt;function rt(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return nt(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?nt(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function nt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function ot(t,e){var r=t.level,n=m[r]||0,o=e.reportLevel;return!(n<(m[o]||0))}function it(t,e,r){if(!t)return!r;var n,o,i=t.frames;if(!i||0===i.length)return!r;for(var a=e.length,s=i.length,u=0;u<s;u++){if(!l(n=i[u].filename,"string"))return!r;for(var c=0;c<a;c++)if(o=e[c],new RegExp(o).test(n))return!0}return!1}function at(t,e,r,n){var o,i,a=!1;"blocklist"===r&&(a=!0);try{if(o=a?e.hostBlockList:e.hostSafeList,i=E(t,"body.trace_chain")||[E(t,"body.trace")],!o||0===o.length)return!a;if(0===i.length||!i[0])return!a;for(var s=i.length,u=0;u<s;u++)if(it(i[u],o,a))return!0}catch(t){a?e.hostBlockList=null:e.hostSafeList=null;var l=a?"hostBlockList":"hostSafeList";return n.error("Error while reading your configuration's "+l+" option. Removing custom "+l+".",t),!a}return!1}function st(t){return function(e,r){var n,o,i,a,s,u;try{if(!(i=r.ignoredMessages)||0===i.length)return!0;if(u=function(t){var e=t.body,r=[];if(e.trace_chain){var n,o=rt(e.trace_chain);try{for(o.s();!(n=o.n()).done;){var i=n.value;r.push(E(i,"exception.message"))}}catch(t){o.e(t)}finally{o.f()}}e.trace&&r.push(E(e,"trace.exception.message"));e.message&&r.push(E(e,"message.body"));return r}(e),0===u.length)return!0;for(a=i.length,n=0;n<a;n++)for(s=new RegExp(i[n],"gi"),o=0;o<u.length;o++)if(s.test(u[o]))return!1}catch(e){r.ignoredMessages=null,t.error("Error while reading your configuration's ignoredMessages option. Removing custom ignoredMessages.")}return!0}}function ut(t){return ut="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ut(t)}function lt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ct(n.key),n)}}function ct(t){var e=function(t,e){if("object"!=ut(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=ut(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ut(e)?e:e+""}var ft=function(){return t=function t(e,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.queue=e,this.options=r,this.transforms=[],this.diagnostic={}},(e=[{key:"configure",value:function(t){var e;null===(e=this.queue)||void 0===e||e.configure(t);var r=this.options;return this.options=T(r,t),this}},{key:"addTransform",value:function(t){return f(t)&&this.transforms.push(t),this}},{key:"log",value:function(t,e){var r=this;if(e=f(e)?e:function(){},!this.options.enabled)return e(new Error("Rollbar is not enabled"),null);this.queue.addPendingItem(t);var n=t.err;this._applyTransforms(t,function(o,i){if(o)return r.queue.removePendingItem(t),e(o,null);r.queue.addItem(i,e,n,t)})}},{key:"_applyTransforms",value:function(t,e){var r=-1,n=this.transforms.length,o=this.transforms,i=this.options,a=function(t,s){t?e(t,null):++r!==n?o[r](s,i,a):e(null,s)};a(null,t)}}])&<(t.prototype,e),r&<(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function pt(t){return pt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pt(t)}function dt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ht(n.key),n)}}function ht(t){var e=function(t,e){if("object"!=pt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=pt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==pt(e)?e:e+""}var mt,yt,vt,gt=function(){function t(e,r,n,o,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.rateLimiter=e,this.api=r,this.logger=n,this.options=o,this.replay=i,this.predicates=[],this.pendingItems=[],this.pendingRequests=[],this.retryQueue=[],this.retryHandle=null,this.waitCallback=null,this.waitIntervalID=null}return e=t,(r=[{key:"configure",value:function(t){var e;null===(e=this.api)||void 0===e||e.configure(t);var r=this.options;return this.options=T(r,t),this}},{key:"addPredicate",value:function(t){return f(t)&&this.predicates.push(t),this}},{key:"addPendingItem",value:function(t){this.pendingItems.push(t)}},{key:"removePendingItem",value:function(t){var e=this.pendingItems.indexOf(t);-1!==e&&this.pendingItems.splice(e,1)}},{key:"addItem",value:function(t,e,r,n){var o=this;e&&f(e)||(e=function(){});var i=t.data,a=this._applyPredicates(i);if(a.stop)return this.removePendingItem(n),void e(a.err);if(this._maybeLog(i,r),this.removePendingItem(n),this.options.transmit){this.replay&&i.body&&(t.replayId=this.replay.capture(null,i.uuid,{type:"occurrence",level:t.level}),t.replayId&&S(t.data,[{key:"replay_id",value:t.replayId}])),this.pendingRequests.push(i);try{this._makeApiRequest(i,function(r,n,a){o._dequeuePendingRequest(i),t.replayId&&o.replay.sendOrDiscardReplay(t.replayId,r,n,a),e(r,n)})}catch(r){var s;this._dequeuePendingRequest(i),t.replayId&&(null===(s=this.replay)||void 0===s||s.discard(t.replayId)),e(r)}}else e(new Error("Transmit disabled"))}},{key:"wait",value:function(t){var e=this;f(t)&&(this.waitCallback=t,this._maybeCallWait()||(this.waitIntervalID&&(this.waitIntervalID=clearInterval(this.waitIntervalID)),this.waitIntervalID=setInterval(function(){e._maybeCallWait()},500)))}},{key:"_applyPredicates",value:function(t){for(var e=null,r=0,n=this.predicates.length;r<n;r++)if(!(e=this.predicates[r](t,this.options))||void 0!==e.err)return{stop:!0,err:e.err};return{stop:!1,err:null}}},{key:"_makeApiRequest",value:function(t,e){var r=this,n=this.rateLimiter.shouldSend(t);n.shouldSend?this.api.postItem(t,function(n,o,i){n?r._maybeRetry(n,t,e):e(n,o,i)}):n.error?e(n.error):this.api.postItem(n.payload,e)}},{key:"_maybeRetry",value:function(e,r,n){var o,i=!1;if(this.options.retryInterval){for(var a=0,s=t.RETRIABLE_ERRORS.length;a<s;a++)if(e.code===t.RETRIABLE_ERRORS[a]){i=!0;break}i&&(o=this.options.maxRetries,Number.isFinite(o))&&(r.retries=r.retries?r.retries+1:1,r.retries>this.options.maxRetries&&(i=!1))}i?this._retryApiRequest(r,n):n(e)}},{key:"_retryApiRequest",value:function(t,e){var r=this;this.retryQueue.push({item:t,callback:e}),this.retryHandle||(this.retryHandle=setInterval(function(){for(;r.retryQueue.length;){var t=r.retryQueue.shift();r._makeApiRequest(t.item,t.callback)}},this.options.retryInterval))}},{key:"_dequeuePendingRequest",value:function(t){var e=this.pendingRequests.indexOf(t);-1!==e&&(this.pendingRequests.splice(e,1),this._maybeCallWait())}},{key:"_maybeLog",value:function(t,e){if(this.logger&&this.options.verbose){var r=e||E(t,"body.trace.exception.message")||E(t,"body.trace_chain.0.exception.message");if(r)return void this.logger.error(r);(r=E(t,"body.message.body"))&&this.logger.log(r)}}},{key:"_maybeCallWait",value:function(){return!(!f(this.waitCallback)||0!==this.pendingItems.length||0!==this.pendingRequests.length||(this.waitIntervalID&&(this.waitIntervalID=clearInterval(this.waitIntervalID)),this.waitCallback(),0))}}])&&dt(e.prototype,r),n&&dt(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,r,n}();mt=gt,vt=["ECONNRESET","ENOTFOUND","ESOCKETTIMEDOUT","ETIMEDOUT","ECONNREFUSED","EHOSTUNREACH","EPIPE","EAI_AGAIN"],(yt=ht(yt="RETRIABLE_ERRORS"))in mt?Object.defineProperty(mt,yt,{value:vt,enumerable:!0,configurable:!0,writable:!0}):mt[yt]=vt;const bt=gt;function wt(t){return wt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wt(t)}function kt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,_t(n.key),n)}}function _t(t){var e=function(t,e){if("object"!=wt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=wt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==wt(e)?e:e+""}var St=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.startTime=Date.now(),this.counter=0,this.perMinCounter=0,this.platform=null,this.platformOptions={},this.configureGlobal(e)}return function(t,e,r){return e&&kt(t.prototype,e),r&&kt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"configureGlobal",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.startTime,n=e.maxItems,o=e.itemsPerMinute;void 0!==r&&(t.globalSettings.startTime=r),void 0!==n&&(t.globalSettings.maxItems=n),void 0!==o&&(t.globalSettings.itemsPerMinute=o)}},{key:"shouldSend",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now(),n=r-this.startTime;(n<0||n>=6e4)&&(this.startTime=r,this.perMinCounter=0);var o=t.globalSettings.maxItems,i=t.globalSettings.itemsPerMinute;if(Et(e,o,this.counter))return xt(this.platform,this.platformOptions,"".concat(o," max items reached"),!1);if(Et(e,i,this.perMinCounter))return xt(this.platform,this.platformOptions,"".concat(i," items per minute reached"),!1);this.counter+=1,this.perMinCounter+=1;var a=!Et(e,o,this.counter),s=a,u=a&&!Et(e,i,this.perMinCounter);return xt(this.platform,this.platformOptions,null,u,o,i,s)}},{key:"setPlatformOptions",value:function(t,e){this.platform=t,this.platformOptions=e}}])}();function Et(t,e,r){return!t.ignoreRateLimit&&e>=1&&r>e}function xt(t,e,r,n,o,i,a){var s=null,u=r?new Error(r):null;return u||n||(s=function(t,e,r,n,o){var i=e.environment||e.payload&&e.payload.environment,a=o?"item per minute limit reached, ignoring errors until timeout":"maxItems has been hit, ignoring errors until reset.",s={body:{message:{body:a,extra:{maxItems:r,itemsPerMinute:n}}},language:"javascript",environment:i,notifier:{version:e.notifier&&e.notifier.version||e.version}};"browser"===t?(s.platform="browser",s.framework="browser-js",s.notifier.name="rollbar-browser-js"):"server"===t?(s.framework=e.framework||"node-js",s.notifier.name=e.notifier.name):"react-native"===t&&(s.framework=e.framework||"react-native",s.notifier.name=e.notifier.name);return s}(t,e,o,i,a)),{error:u,shouldSend:n,payload:s}}!function(t,e,r){(e=_t(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r}(St,"globalSettings",{startTime:Date.now(),maxItems:void 0,itemsPerMinute:void 0});const Ot=St;function It(t,e,r,n,o,i,a){this.options=T(t),this.logger=r,It.rateLimiter.configureGlobal(this.options),It.rateLimiter.setPlatformOptions(a,this.options),this.api=e,this.queue=new bt(It.rateLimiter,e,r,this.options,i),this.tracing=o;var s=this.options.tracer||null;jt(s)?(this.tracer=s,this.options.tracer="opentracing-tracer-enabled",this.options._configuredOptions.tracer="opentracing-tracer-enabled"):this.tracer=null,this.notifier=new ft(this.queue,this.options),this.telemeter=n,Tt(t),this.lastError=null,this.lastErrorHash="none"}function Tt(t){t.stackTraceLimit&&(Error.stackTraceLimit=t.stackTraceLimit)}function jt(t){if(!t)return!1;if(!t.scope||"function"!=typeof t.scope)return!1;var e=t.scope();return!(!e||!e.active||"function"!=typeof e.active)}It.rateLimiter=new Ot({maxItems:0,itemsPerMinute:60}),It.prototype.global=function(t){return It.rateLimiter.configureGlobal(t),this},It.prototype.configure=function(t,e){var r=this.options,n={};e&&(n={payload:e}),this.options=T(r,t,n);var o=this.options.tracer||null;return jt(o)?(this.tracer=o,this.options.tracer="opentracing-tracer-enabled",this.options._configuredOptions.tracer="opentracing-tracer-enabled"):this.tracer=null,this.notifier&&this.notifier.configure(this.options),this.telemeter&&this.telemeter.configure(this.options),Tt(t),this.global(this.options),jt(t.tracer)&&(this.tracer=t.tracer),this},It.prototype.log=function(t){var e=this._defaultLogLevel();return this._log(e,t)},It.prototype.debug=function(t){this._log("debug",t)},It.prototype.info=function(t){this._log("info",t)},It.prototype.warn=function(t){this._log("warning",t)},It.prototype.warning=function(t){this._log("warning",t)},It.prototype.error=function(t){this._log("error",t)},It.prototype.critical=function(t){this._log("critical",t)},It.prototype.wait=function(t){this.queue.wait(t)},It.prototype.captureEvent=function(t,e,r){return this.telemeter&&this.telemeter.captureEvent(t,e,r)},It.prototype.captureDomContentLoaded=function(t){return this.telemeter&&this.telemeter.captureDomContentLoaded(t)},It.prototype.captureLoad=function(t){return this.telemeter&&this.telemeter.captureLoad(t)},It.prototype.buildJsonPayload=function(t){return this.api.buildJsonPayload(t)},It.prototype.sendJsonPayload=function(t){this.api.postJsonPayload(t)},It.prototype._log=function(t,e){var r;if(e.callback&&(r=e.callback,delete e.callback),this.options.ignoreDuplicateErrors&&this._sameAsLastError(e)){if(r){var n=new Error("ignored identical item");n.item=e,r(n)}}else try{e.level=e.level||t,this._addItemAttributes(e),this._addTracingInfo(e);var o=this.telemeter;o&&(o._captureRollbarItem(e),e.telemetryEvents=o.copyEvents()||[]),this.notifier.log(e,r)}catch(t){r&&r(t),this.logger.error(t)}},It.prototype._addItemAttributes=function(t){var e,r,n=null===(e=this.tracing)||void 0===e?void 0:e.getSpan(),o=[{key:"session_id",value:R(this)||(null===(r=this.tracing)||void 0===r?void 0:r.sessionId)},{key:"span_id",value:null==n?void 0:n.spanId},{key:"trace_id",value:null==n?void 0:n.traceId}];t._isUncaught&&o.push({key:"is_uncaught",value:"true"}),S(t.data,o),null==n||n.addEvent("rollbar.occurrence",[{key:"rollbar.occurrence.uuid",value:t.uuid}])},It.prototype._defaultLogLevel=function(){return this.options.logLevel||"debug"},It.prototype._sameAsLastError=function(t){if(!t._isUncaught)return!1;var e=function(t){var e=t.message||"",r=(t.err||{}).stack||String(t.err);return e+"::"+r}(t);return this.lastErrorHash===e||(this.lastError=t.err,this.lastErrorHash=e,!1)},It.prototype._addTracingInfo=function(t){if(this.tracer){var e=this.tracer.scope().active();if(function(t){if(!t||!t.context||"function"!=typeof t.context)return!1;var e=t.context();if(!e||!e.toSpanId||!e.toTraceId||"function"!=typeof e.toSpanId||"function"!=typeof e.toTraceId)return!1;return!0}(e)){e.setTag("rollbar.error_uuid",t.uuid),e.setTag("rollbar.has_error",!0),e.setTag("error",!0),e.setTag("rollbar.item_url","https://rollbar.com/item/uuid/?uuid=".concat(t.uuid)),e.setTag("rollbar.occurrence_url","https://rollbar.com/occurrence/uuid/?uuid=".concat(t.uuid));var r=e.context().toSpanId(),n=e.context().toTraceId();t.custom?(t.custom.opentracing_span_id=r,t.custom.opentracing_trace_id=n):t.custom={opentracing_span_id:r,opentracing_trace_id:n}}}};const Pt=It;var Rt=["otelAttributes"];function At(t){return At="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},At(t)}function Lt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function qt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Lt(Object(r),!0).forEach(function(e){Ct(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Lt(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function Ct(t,e,r){return(e=Ut(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Mt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ut(n.key),n)}}function Ut(t){var e=function(t,e){if("object"!=At(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=At(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==At(e)?e:e+""}var Dt=100;function Nt(t){return[Math.trunc(t/1e3),Math.round(t%1e3*1e6)]}var Ht=function(){return function(t,e,r){return e&&Mt(t.prototype,e),r&&Mt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e,r){var n;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.queue=[],this.options=T(e);var o=this.options.maxTelemetryEvents||Dt;this.maxQueueSize=Math.max(0,Math.min(o,Dt)),this.tracing=r,this.telemetrySpan=null===(n=this.tracing)||void 0===n?void 0:n.startSpan("rollbar-telemetry",{})},[{key:"configure",value:function(t){var e=this.options;this.options=T(e,t);var r=this.options.maxTelemetryEvents||Dt,n=Math.max(0,Math.min(r,Dt)),o=0;this.queue.length>n&&(o=this.queue.length-n),this.maxQueueSize=n,this.queue.splice(0,o)}},{key:"copyEvents",value:function(){var t=Array.prototype.slice.call(this.queue,0);if(f(this.options.filterTelemetry))try{for(var e=t.length;e--;)this.options.filterTelemetry(t[e])&&t.splice(e,1)}catch(t){this.options.filterTelemetry=null}return t=t.filter(function(t){return"connectivity"!==t.type}),t=t.map(function(t){t.otelAttributes;var e=function(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],-1===e.indexOf(r)&&{}.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,Rt);return e}),t}},{key:"exportTelemetrySpan",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.telemetrySpan&&(this.telemetrySpan.end(t),this.telemetrySpan=this.tracing.startSpan("rollbar-telemetry",{}))}},{key:"capture",value:function(t,e,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,a={level:Ft(t,r),type:t,timestamp_ms:o||O(),body:e,source:"client"};n&&(a.uuid=n),i&&(a.otelAttributes=i);try{if(f(this.options.filterTelemetry)&&this.options.filterTelemetry(a))return!1}catch(t){this.options.filterTelemetry=null}return this.push(a),a}},{key:"captureEvent",value:function(t,e,r,n){return this.capture(t,e,r,n)}},{key:"captureError",value:function(t,e,r,n){var o,i=t.message||String(t),a={message:i};t.stack&&(a.stack=t.stack);var s={message:i,level:e,type:"error",uuid:r};return null===(o=this.telemetrySpan)||void 0===o||o.addEvent("rollbar-occurrence-event",s,Nt(n)),this.capture("error",a,e,r,n,s)}},{key:"captureLog",value:function(t,e,r,n){var o,i=r?"rollbar-occurrence-event":"rollbar-log-event",a=qt({message:t,level:e},r?{type:"message",uuid:r}:{});return null===(o=this.telemetrySpan)||void 0===o||o.addEvent(i,a,Nt(n)),this.capture("log",{message:t},e,r,n,a)}},{key:"captureNetwork",value:function(t,e,r,n){var o,i,a;e=e||"xhr",t.subtype=t.subtype||e,n&&(t.request=n);var s=this.levelFromStatus(t.status_code),u=1e6*(t.end_time_ms||0),l={type:t.subtype,method:t.method,url:t.url,statusCode:t.status_code,"request.headers":JSON.stringify(t.request_headers||{}),"response.headers":JSON.stringify((null===(o=t.response)||void 0===o?void 0:o.headers)||{}),"response.timeUnixNano":u.toString()},c=t.request,f=null===(i=t.response)||void 0===i?void 0:i.body;return c&&(l["request.body"]=JSON.stringify(c)),f&&(l["response.body"]=JSON.stringify(f)),null===(a=this.telemetrySpan)||void 0===a||a.addEvent("rollbar-network-event",l,Nt(t.start_time_ms)),this.capture("network",t,s,r,t.start_time_ms,l)}},{key:"levelFromStatus",value:function(t){return t>=200&&t<400?"info":0===t||t>=400?"error":"info"}},{key:"captureDom",value:function(t,e,r,n,o){var i={subtype:t,element:e};return void 0!==r&&(i.value=r),void 0!==n&&(i.checked=n),this.capture("dom",i,"info",o)}},{key:"captureInput",value:function(t){var e,r=t.type,n=t.isSynthetic,o=t.element,i=t.value,a=t.timestamp,s="rollbar-input-event",u={type:s,subtype:r,element:o,value:i},l={type:r,isSynthetic:n,element:o,value:i,endTimeUnixNano:Nt(a)},c=this._getRepeatedEvent(s,l);return c?this._updateRepeatedEvent(c,l,a):(null===(e=this.telemetrySpan)||void 0===e||e.addEvent(s,l,Nt(a)),this.capture("dom",u,"info",null,a,l))}},{key:"captureClick",value:function(t){var e,r=t.type,n=t.isSynthetic,o=t.element,i=t.timestamp,a="rollbar-click-event",s={type:a,subtype:r,element:o},u={type:r,isSynthetic:n,element:o,endTimeUnixNano:Nt(i)},l=this._getRepeatedEvent(a,u);return l?this._updateRepeatedEvent(l,u,i):(null===(e=this.telemetrySpan)||void 0===e||e.addEvent(a,u,Nt(i)),this.capture("dom",s,"info",null,i,u))}},{key:"_getRepeatedEvent",value:function(t,e){var r=this._lastEvent(this.queue);if(r&&r.body.type===t&&r.otelAttributes.target===e.target)return r}},{key:"_updateRepeatedEvent",value:function(t,e,r){var n=Math.max(r-t.timestamp_ms,1);t.body.value=e.value,t.otelAttributes.value=e.value,t.otelAttributes.height=e.height,t.otelAttributes.width=e.width,t.otelAttributes.textZoomRatio=e.textZoomRatio,t.otelAttributes.endTimeUnixNano=Nt(r),t.otelAttributes.durationUnixNano=Nt(n),t.otelAttributes.count=(t.otelAttributes.count||1)+1,t.otelAttributes.rate=t.otelAttributes.count/(n/1e3)}},{key:"_lastEvent",value:function(t){return t.length>0?t[t.length-1]:null}},{key:"captureFocus",value:function(t){var e,r=t.type,n=t.isSynthetic,o=t.element,i=t.timestamp,a="rollbar-focus-event",s={type:a,subtype:r,element:o},u={type:r,isSynthetic:n,element:o};return null===(e=this.telemetrySpan)||void 0===e||e.addEvent(a,u,Nt(i)),this.capture("dom",s,"info",null,i,u)}},{key:"captureResize",value:function(t){var e,r=t.type,n=t.isSynthetic,o=t.width,i=t.height,a=t.textZoomRatio,s=t.timestamp,u="rollbar-resize-event",l={type:u,subtype:r,width:o,height:i,textZoomRatio:a},c={type:r,isSynthetic:n,width:o,height:i,textZoomRatio:a},f=this._getRepeatedEvent(u,c);return f?this._updateRepeatedEvent(f,c,s):(null===(e=this.telemetrySpan)||void 0===e||e.addEvent(u,c,Nt(s)),this.capture("dom",l,"info",null,s,c))}},{key:"captureDragDrop",value:function(t){var e,r=t.type,n=t.isSynthetic,o=t.element,i=t.dropEffect,a=t.effectAllowed,s=t.kinds,u=t.mediaTypes,l=t.timestamp,c="rollbar-dragdrop-event",f={type:c,subtype:r,isSynthetic:n},p={type:r,isSynthetic:n};return"dragstart"===r&&(f=qt(qt({},f),{},{element:o,dropEffect:i,effectAllowed:a}),p=qt(qt({},p),{},{element:o,dropEffect:i,effectAllowed:a})),"drop"===r&&(f=qt(qt({},f),{},{element:o,dropEffect:i,effectAllowed:a,kinds:s,mediaTypes:u}),p=qt(qt({},p),{},{element:o,dropEffect:i,effectAllowed:a,kinds:s,mediaTypes:u})),null===(e=this.telemetrySpan)||void 0===e||e.addEvent(c,p,Nt(l)),this.capture("dom",f,"info",null,l,p)}},{key:"captureNavigation",value:function(t,e,r,n){var o;return null===(o=this.telemetrySpan)||void 0===o||o.addEvent("rollbar-navigation-event",{"previous.url.full":t,"url.full":e},Nt(n)),this.capture("navigation",{from:t,to:e},"info",r,n)}},{key:"captureDomContentLoaded",value:function(t){return this.capture("navigation",{subtype:"DOMContentLoaded"},"info",void 0,t&&t.getTime())}},{key:"captureLoad",value:function(t){return this.capture("navigation",{subtype:"load"},"info",void 0,t&&t.getTime())}},{key:"captureConnectivityChange",value:function(t){var e,r=t.type,n=t.isSynthetic,o=t.timestamp,i="rollbar-connectivity-event",a={type:i,subtype:r},s={type:r,isSynthetic:n};return null===(e=this.telemetrySpan)||void 0===e||e.addEvent(i,s,Nt(o)),this.capture("connectivity",a,"info",null,o,s)}},{key:"_captureRollbarItem",value:function(t){if(this.options.includeItemsInTelemetry)return t.err?this.captureError(t.err,t.level,t.uuid,t.timestamp):t.message?this.captureLog(t.message,t.level,t.uuid,t.timestamp):t.custom?this.capture("log",t.custom,t.level,t.uuid,t.timestamp):void 0}},{key:"push",value:function(t){this.queue.push(t),this.queue.length>this.maxQueueSize&&this.queue.shift()}}])}();function Ft(t,e){if(e)return e;return{error:"error",manual:"info"}[t]||"info"}const Bt=Ht;function Jt(t,e,r){t._isUncaught&&(t.data._isUncaught=!0),t._originalArgs&&(t.data._originalArgs=t._originalArgs),r(null,t)}function Wt(t,e,r){var n=e.payload||{};n.body&&delete n.body,t.data=T(t.data,n),r(null,t)}function Gt(t,e,r){t.telemetryEvents&&x(t,"data.body.telemetry",t.telemetryEvents),r(null,t)}function zt(t,e,r){if(t.message){var n="data.body.trace_chain.0",o=E(t,n);if(o||(o=E(t,n="data.body.trace")),o){if(!o.exception||!o.exception.description)return x(t,n+".exception.description",t.message),void r(null,t);x(t,n+".extra",T(E(t,n+".extra")||{},{message:t.message}))}r(null,t)}else r(null,t)}function $t(t){return function(e,r,n){var o,i=T(e),a=null;try{f(r.transform)&&(a=r.transform(i.data,e))}catch(o){return r.transform=null,t.error("Error while calling custom transform() function. Removing custom transform().",o),void n(null,e)}p(o=a)&&l(o.then,"function")?a.then(function(t){t&&(i.data=t),n(null,i)},function(t){n(t,e)}):n(null,i)}}function Qt(t,e,r){if(!e.sendConfig)return r(null,t);var n=E(t,"data.custom")||{};n._rollbarConfig=e,t.data.custom=n,r(null,t)}function Zt(t,e){f(t[e])&&(t[e]=t[e].toString())}function Vt(t,e,r){var n=e._configuredOptions;Zt(n,"transform"),Zt(n,"checkIgnore"),Zt(n,"onSendCallback"),delete n.accessToken,t.data.notifier.configured_options=n,r(null,t)}function Xt(t,e,r){var n=T(t.notifier.client.notifier.diagnostic,t.diagnostic);if(E(t,"err._isAnonymous")&&(n.is_anonymous=!0),t._isUncaught&&(n.is_uncaught=t._isUncaught),t.err)try{n.raw_error={message:t.err.message,name:t.err.name,constructor_name:t.err.constructor&&t.err.constructor.name,filename:t.err.fileName,line:t.err.lineNumber,column:t.err.columnNumber,stack:t.err.stack}}catch(t){n.raw_error={failed:String(t)}}t.data.notifier.diagnostic=T(t.data.notifier.diagnostic,n),r(null,t)}const Kt=function(t,e,r){var n,o,i,a,s=l(t,"object"),u=l(t,"array"),c=[];if(r=r||{obj:[],mapped:[]},s){if(a=r.obj.indexOf(t),s&&-1!==a)return r.mapped[a]||r.obj[a];r.obj.push(t),a=r.obj.length-1}if(s)for(n in t)d(t,n)&&c.push(n);else if(u)for(i=0;i<t.length;++i)c.push(i);var f=s?{}:[],p=!0;for(i=0;i<c.length;++i)o=t[n=c[i]],f[n]=e(n,o,r),p=p&&f[n]===t[n];return s&&!p&&(r.mapped[a]=f),p?t:f};function Yt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,s=[],u=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==e);u=!0);}catch(t){l=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(t,e)||ee(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function te(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=ee(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function ee(t,e){if(t){if("string"==typeof t)return re(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?re(t,e):void 0}}function re(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function ne(t,e){return[t,y(t,e)]}function oe(t,e){var r=t.length;return r>2*e?t.slice(0,e).concat(t.slice(r-e)):t}function ie(t,e,r){r=void 0===r?30:r;var n,o=t.data.body;if(o.trace_chain){var i,a=te(o.trace_chain);try{for(a.s();!(i=a.n()).done;){var s=i.value;n=oe(n=s.frames,r),s.frames=n}}catch(t){a.e(t)}finally{a.f()}}else o.trace&&(n=oe(n=o.trace.frames,r),o.trace.frames=n);return[t,y(t,e)]}function ae(t,e){return e&&e.length>t?e.slice(0,t-3).concat("..."):e}function se(t,e,r){return e=Kt(e,function e(r,n,o){switch(c(n)){case"string":return ae(t,n);case"object":case"array":return Kt(n,e,o);default:return n}}),[e,y(e,r)]}function ue(t){return t.exception&&(delete t.exception.description,t.exception.message=ae(255,t.exception.message)),t.frames=oe(t.frames,1),t}function le(t,e){var r=t.data.body;if(r.trace_chain){var n,o=r.trace_chain,i=te(o.entries());try{for(i.s();!(n=i.n()).done;){var a=Yt(n.value,2),s=a[0],u=a[1];o[s]=ue(u)}}catch(t){i.e(t)}finally{i.f()}}else r.trace&&(r.trace=ue(r.trace));return[t,y(t,e)]}function ce(t,e){return function(t){for(var e=0,r=t.length,n=0;n<r;n++){var o=t.charCodeAt(n);o<128?e+=1:o<2048?e+=2:o<65536&&(e+=3)}return e}(t)>e}const fe={truncate:function(t,e,r){r=void 0===r?524288:r;for(var n,o,i,a=[ne,ie,se.bind(null,1024),se.bind(null,512),se.bind(null,256),le];n=a.shift();)if(t=(o=n(t,e))[0],(i=o[1]).error||!ce(i.value,r))return i;return i},raw:ne,truncateFrames:ie,truncateStrings:se,maybeTruncateValue:ae};function pe(t){return function(t){if(Array.isArray(t))return de(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return de(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?de(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function de(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var he=["authorization","www-authorization","http_authorization","omniauth.auth","cookie","oauth-access-token","x-access-token","x_csrf_token","http_x_csrf_token","x-csrf-token"],me=[].concat(pe(["pw","pass","passwd","password","secret","confirm_password","confirmPassword","password_confirmation","passwordConfirmation","access_token","accessToken","X-Rollbar-Access-Token","secret_key","secretKey","secretToken"]),pe(["api_key","authenticity_token","oauth_token","token","user_session_secret"]),pe(["request.session.csrf","request.session._csrf","request.params._csrf","request.cookie","request.cookies"]));const ye=require("node:async_hooks");function ve(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return ge(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ge(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function ge(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function be(t){var e=(null==t?void 0:t.client.asyncLocalStorage)||new ye.AsyncLocalStorage;return t&&(t.client.asyncLocalStorage=e),function(t,r,n){var o=function(t){if(!t)return null;var e=Array.isArray(t)?t.join(","):t;if("string"!=typeof e)return null;var r,n=ve(e.split(","));try{for(n.s();!(r=n.n()).done;){var o=r.value.trim();if(o){var i=o.indexOf("=");if(-1!==i&&"rollbar.session.id"===o.slice(0,i).trim()){var a=o.slice(i+1).trim();if(!a)return null;try{return decodeURIComponent(a)}catch(t){return a}}}}}catch(t){n.e(t)}finally{n.f()}return null}(function(t){var e;return t?"function"==typeof t.get?t.get("baggage"):(null===(e=t.headers)||void 0===e?void 0:e.baggage)||null:null}(t));return o?e.run({sessionId:o},function(){return n()}):n()}}const we=require("http"),ke=require("https");const _e=function(t,e,r,n,o){var i=t[e];t[e]=r(i),n&&n[o].push([t,e,i])};function Se(t){var e={protocol:t.protocol,hostname:"string"==typeof t.hostname&&t.hostname.startsWith("[")?t.hostname.slice(1,-1):t.hostname,hash:t.hash,search:t.search,pathname:t.pathname,path:"".concat(t.pathname||"").concat(t.search||""),href:t.href};return""!==t.port&&(e.port=Number(t.port)),(t.username||t.password)&&(e.auth="".concat(t.username,":").concat(t.password)),e}var Ee={network:!0,networkResponseHeaders:!1,networkRequestHeaders:!1,log:!0};function xe(t,e,r){this.options=t;var n=t.autoInstrument;!1===t.enabled||!1===n?this.autoInstrument={}:(l(n,"object")||(n=Ee),this.autoInstrument=T(Ee,n)),this.telemeter=e,this.rollbar=r,this.diagnostic=r.client.notifier.diagnostic,this.replacements={network:[],log:[]}}function Oe(t){var e=this,r=this.telemeter;return function(){for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];var s=function(t,e,r){if("string"==typeof t){var o=t;t=Se(new n.URL(o))}else t&&t instanceof n.URL?t=Se(t):(r=e,e=t,t=null);return"function"==typeof e?(r=e,e=t||{}):e=T(t||{},e),{options:e,cb:r}}(i[0],i[1],i[2]),u=function(t){var e=t.protocol||"http:";return e+="//",t.auth&&(e+="".concat(t.auth,"@")),e+=t.hostname||t.host||"localhost",t.port&&(e+=":".concat(t.port)),e+(t.path||"/")}(s.options),l=R(e.rollbar.client);l&&j(e.options,{sessionId:l},u)&&(s.options.headers||(s.options.headers={}),s.options.headers.baggage="rollbar.session.id=".concat(l));var c={method:s.options.method||"GET",url:u,status_code:null,start_time_ms:O(),end_time_ms:null};e.autoInstrument.networkRequestHeaders&&(c.request_headers=s.options.headers),r.captureNetwork(c,"http");var f=function(t,e,r){return functi