UNPKG

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 382 kB
/*! For license information please see rollbar.replay.umd.min.js.LICENSE.txt */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.rollbar=t():e.rollbar=t()}(this,function(){return function(){"use strict";var e={d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.d(t,{default:function(){return Tv}});var r={};function n(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return o(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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 a,s=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){u=!0,a=e},f:function(){try{s||null==r.return||r.return()}finally{if(u)throw a}}}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function a(e,t){return t===s(e)}function s(e){var t=i(e);return"object"!==t?t:e?e instanceof Error?"error":{}.toString.call(e).match(/\s([a-zA-Z]+)/)[1].toLowerCase():"null"}function u(e){return a(e,"function")}function l(e){return null!=e&&("object"==i(e)||"function"==typeof e)}function c(e,t){return null!=e&&(Object.hasOwn?Object.hasOwn(e,t):Object.prototype.hasOwnProperty.call(e,t))}function f(e){return Number.isFinite(e)}function h(e){return a(e,"error")||a(e,"exception")}function p(){return"********"}e.r(r),e.d(r,{parse:function(){return vn}});var d={debug:0,info:1,warning:2,error:3,critical:4};function v(e){try{var t=new URL(e);return t.password&&(t.password="********"),t.search&&(t.search="********"),t.toString()}catch(t){return e}}function y(e){var t=function(e){if(!a(e,"string"))return;for(var t=m,r=t.parser[t.strictMode?"strict":"loose"].exec(e),n={},o=0,i=t.key.length;o<i;++o)n[t.key[o]]=r[o]||"";return n[t.q.name]={},n[t.key[12]].replace(t.q.parser,function(e,r,o){r&&(n[t.q.name][r]=o)}),n}(e);return t?(""===t.anchor&&(t.source=t.source.replace("#","")),e=t.source.replace("?"+t.query,"")):"(unknown)"}var m={strictMode:!1,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\d*))?))?((((?:[^?#/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#/]*\.[^?#/.]+(?:[?#]|$)))*\/?)?([^?#/]*))(?:\?([^#]*))?(?:#(.*))?)/}};function g(e,t){if(!(t=t||e.protocol)&&e.port&&(80===e.port?t="http:":443===e.port&&(t="https:")),t=t||"https:",!e.hostname)return null;var r=t+"//"+e.hostname;return e.port&&(r=r+":"+e.port),e.path&&(r+=e.path),r}function b(e,t){var r,n;try{r=JSON.stringify(e)}catch(o){if(t&&u(t))try{r=t(e)}catch(e){n=e}else n=o}return{error:n,value:r}}function w(e){var t,r;try{t=JSON.parse(e)}catch(e){r=e}return{error:r,value:t}}function k(e,t,r,n,o,i,a,s){var u={url:t||"",line:r,column:n};u.func=s.guessFunctionName(u.url,u.line),u.context=s.gatherContext(u.url,u.line);var l="undefined"!=typeof document&&document&&document.location&&document.location.href,c="undefined"!=typeof window&&window&&window.navigator&&window.navigator.userAgent;return{mode:i,message:o?String(o):e||a,url:l,stack:[u],useragent:c}}function S(e,t){return function(r,n){try{t(r,n)}catch(t){e.error(t)}}}function C(e){return function e(t,r){var n,o,i,u={};try{for(o in t)(n=t[o])&&(a(n,"object")||a(n,"array"))?r.includes(n)?u[o]="Removed circular reference: "+s(n):((i=r.slice()).push(n),u[o]=e(n,i)):u[o]=n}catch(e){u="Failed cloning custom data: "+e.message}return u}(e,[e])}function I(e,t,r,n,o){for(var i,a,u,l,c,f,h=[],p=[],d=0,v=e.length;d<v;++d){var y=s(f=e[d]);switch(p.push(y),y){case"undefined":break;case"string":i?h.push(f):i=f;break;case"function":l=S(t,f);break;case"date":h.push(f);break;case"error":case"domexception":case"exception":a?h.push(f):a=f;break;case"object":case"array":if(f instanceof Error||"undefined"!=typeof DOMException&&f instanceof DOMException){a?h.push(f):a=f;break}if(n&&"object"===y&&!c){for(var m=0,g=n.length;m<g;++m)if(void 0!==f[n[m]]){c=f;break}if(c)break}u?h.push(f):u=f;break;default:if(f instanceof Error||"undefined"!=typeof DOMException&&f instanceof DOMException){a?h.push(f):a=f;break}h.push(f)}}u&&(u=C(u)),h.length>0&&(u||(u=C({})),u.extraArgs=C(h));var b,w={message:i,err:a,custom:u,timestamp:T(),callback:l,notifier:r,diagnostic:{},uuid:(b=T(),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=(b+16*Math.random())%16|0;return b=Math.floor(b/16),("x"===e?t:7&t|8).toString(16)}))};return w.data=w.data||{},function(e,t){t&&void 0!==t.level&&(e.level=t.level,delete t.level);t&&void 0!==t.skipFrames&&(e.skipFrames=t.skipFrames,delete t.skipFrames)}(w,u),n&&c&&(w.request=c),o&&(w.lambdaContext=o),w._originalArgs=e,w.diagnostic.original_arg_types=p,w}var O=["log","network","dom","navigation","error","manual"],x=["critical","error","warning","info","debug"];function _(e,t){var r,o=n(e);try{for(o.s();!(r=o.n()).done;){if(r.value===t)return!0}}catch(e){o.e(e)}finally{o.f()}return!1}function E(e,t){e.attributes=e.attributes||[];var r,o=n(t);try{for(o.s();!(r=o.n()).done;){var i=r.value;void 0!==i.value&&e.attributes.push(i)}}catch(e){o.e(e)}finally{o.f()}}function A(e,t){if(e){var r=t.split("."),n=e;try{for(var o=0,i=r.length;o<i;++o)n=n[r[o]]}catch(e){n=void 0}return n}}function R(e,t,r){if(e){Object.setPrototypeOf(e,null);var n=t.split("."),o=n.length;if(!(o<1))if(1!==o)try{for(var i=e[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,e[n[0]]=a}catch(e){return}else e[n[0]]=r}}function T(){return Date.now?Date.now():Number(new Date)}function M(e,t,r,n){var o=P(e,t,r);return o=function(e,t){e.hostWhiteList&&!e.hostSafeList&&(e.hostSafeList=e.hostWhiteList,e.hostWhiteList=void 0,t&&t.log("hostWhiteList is deprecated. Use hostSafeList."));e.hostBlackList&&!e.hostBlockList&&(e.hostBlockList=e.hostBlackList,e.hostBlackList=void 0,t&&t.log("hostBlackList is deprecated. Use hostBlockList."));return e}(o,n),!t||t.overwriteScrubFields||t.scrubFields&&(o.scrubFields=(e.scrubFields||[]).concat(t.scrubFields)),o}function P(){function e(e){if(!e||"[object Object]"!==Object.prototype.toString.call(e))return!1;var t,r=c(e,"constructor"),n=e.constructor&&e.constructor.prototype&&c(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!r&&!n)return!1;for(t in e);return void 0===t||c(e,t)}var t,r,n,o,i,a=Object.create(null),s=null,u=arguments.length;for(t=0;t<u;t++)if(null!=(s=arguments[t]))for(i in s)r=a[i],a!==(n=s[i])&&(n&&e(n)?(o=r&&e(r)?r:{},a[i]=P(o,n)):void 0!==n&&(a[i]=n));return a}function j(e,t,r){var n;if(null==t||!t.sessionId||!r)return!1;var o=null==e||null===(n=e.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 s=null==o?void 0:o.enabledCorsUrls;return!(!Array.isArray(s)||0===s.length)&&s.some(function(e){return a(e,"string")?r===e:!!a(e,"regexp")&&e.test(r)})}function N(e,t){var r,n=e[1],o=null===(r=n)||void 0===r?void 0:r.headers,i=function(e){return"undefined"!=typeof Request&&e instanceof Request}(e[0])&&e[0].headers,a=o||i;if(a||(n||(e[1]=n={}),a=n.headers={}),a instanceof Headers)for(var s=0,u=Object.keys(t);s<u.length;s++){var c=u[s];a.append(c,t[c])}else if(l(a))for(var f=0,h=Object.keys(t);f<h.length;f++){var p=h[f];a[p]=t[p]}}var L=function(e,t,r){var n,o,i,s,u=a(e,"object"),l=a(e,"array"),f=[];if(r=r||{obj:[],mapped:[]},u){if(s=r.obj.indexOf(e),u&&-1!==s)return r.mapped[s]||r.obj[s];r.obj.push(e),s=r.obj.length-1}if(u)for(n in e)c(e,n)&&f.push(n);else if(l)for(i=0;i<e.length;++i)f.push(i);var h=u?{}:[],p=!0;for(i=0;i<f.length;++i)o=e[n=f[i]],h[n]=t(n,o,r),p=p&&h[n]===e[n];return u&&!p&&(r.mapped[s]=h),p?e:h};function D(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,s=[],u=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(e,t)||U(e,t)||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 F(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=U(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},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(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function U(e,t){if(e){if("string"==typeof e)return B(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?B(e,t):void 0}}function B(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function W(e,t){var r=t.split("."),n=r.length-1;try{var o,i=F(r.entries());try{for(i.s();!(o=i.n()).done;){var a=D(o.value,2),s=a[0],u=a[1];s<n?e=e[u]:e[u]=p()}}catch(e){i.e(e)}finally{i.f()}}catch(e){}}var z=function(e,t,r){if(t=t||[],r){var n,o=F(r);try{for(o.s();!(n=o.n()).done;){W(e,n.value)}}catch(e){o.e(e)}finally{o.f()}}var i=function(e){var t,r=[],n=F(e);try{for(n.s();!(t=n.n()).done;){var o="^\\[?(%5[bB])?"+t.value+"\\[?(%5[bB])?\\]?(%5[dD])?$";r.push(new RegExp(o,"i"))}}catch(e){n.e(e)}finally{n.f()}return r}(t),s=function(e){var t,r=[],n=F(e);try{for(n.s();!(t=n.n()).done;){var o="\\[?(%5[bB])?"+t.value+"\\[?(%5[bB])?\\]?(%5[dD])?";r.push(new RegExp("("+o+"=)([^&\\n]+)","igm"))}}catch(e){n.e(e)}finally{n.f()}return r}(t);function u(e,t){return t+"********"}return L(e,function e(t,r,n){var o=function(e,t){var r,n=F(i);try{for(n.s();!(r=n.n()).done;)if(r.value.test(e)){t=p();break}}catch(e){n.e(e)}finally{n.f()}return t}(t,r);return o===r?a(r,"object")||a(r,"array")?L(r,e,n):function(e){if(a(e,"string")){var t,r=F(s);try{for(r.s();!(t=r.n()).done;){var n=t.value;e=e.replace(n,u)}}catch(e){r.e(e)}finally{r.f()}}return e}(o):o})},G=["otelAttributes"];function V(e){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},V(e)}function H(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function q(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?H(Object(r),!0).forEach(function(t){J(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):H(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function J(e,t,r){return(t=Y(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Z(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Y(n.key),n)}}function Y(e){var t=function(e,t){if("object"!=V(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=V(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==V(t)?t:t+""}var X=100;function K(e){return[Math.trunc(e/1e3),Math.round(e%1e3*1e6)]}var $=function(){return e=function e(t,r){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.queue=[],this.options=P(t);var o=this.options.maxTelemetryEvents||X;this.maxQueueSize=Math.max(0,Math.min(o,X)),this.tracing=r,this.telemetrySpan=null===(n=this.tracing)||void 0===n?void 0:n.startSpan("rollbar-telemetry",{})},t=[{key:"configure",value:function(e){var t=this.options;this.options=P(t,e);var r=this.options.maxTelemetryEvents||X,n=Math.max(0,Math.min(r,X)),o=0;this.queue.length>n&&(o=this.queue.length-n),this.maxQueueSize=n,this.queue.splice(0,o)}},{key:"copyEvents",value:function(){var e=Array.prototype.slice.call(this.queue,0);if(u(this.options.filterTelemetry))try{for(var t=e.length;t--;)this.options.filterTelemetry(e[t])&&e.splice(t,1)}catch(e){this.options.filterTelemetry=null}return e=(e=e.filter(function(e){return"connectivity"!==e.type})).map(function(e){e.otelAttributes;var t=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],-1===t.indexOf(r)&&{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,G);return t}),e}},{key:"exportTelemetrySpan",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.telemetrySpan&&(this.telemetrySpan.end(e),this.telemetrySpan=this.tracing.startSpan("rollbar-telemetry",{}))}},{key:"capture",value:function(e,t,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:Q(e,r),type:e,timestamp_ms:o||T(),body:t,source:"client"};n&&(a.uuid=n),i&&(a.otelAttributes=i);try{if(u(this.options.filterTelemetry)&&this.options.filterTelemetry(a))return!1}catch(e){this.options.filterTelemetry=null}return this.push(a),a}},{key:"captureEvent",value:function(e,t,r,n){return this.capture(e,t,r,n)}},{key:"captureError",value:function(e,t,r,n){var o,i=e.message||String(e),a={message:i};e.stack&&(a.stack=e.stack);var s={message:i,level:t,type:"error",uuid:r};return null===(o=this.telemetrySpan)||void 0===o||o.addEvent("rollbar-occurrence-event",s,K(n)),this.capture("error",a,t,r,n,s)}},{key:"captureLog",value:function(e,t,r,n){var o,i=r?"rollbar-occurrence-event":"rollbar-log-event",a=q({message:e,level:t},r?{type:"message",uuid:r}:{});return null===(o=this.telemetrySpan)||void 0===o||o.addEvent(i,a,K(n)),this.capture("log",{message:e},t,r,n,a)}},{key:"captureNetwork",value:function(e,t,r,n){var o,i,a;t=t||"xhr",e.subtype=e.subtype||t,n&&(e.request=n);var s=this.levelFromStatus(e.status_code),u=1e6*(e.end_time_ms||0),l={type:e.subtype,method:e.method,url:e.url,statusCode:e.status_code,"request.headers":JSON.stringify(e.request_headers||{}),"response.headers":JSON.stringify((null===(o=e.response)||void 0===o?void 0:o.headers)||{}),"response.timeUnixNano":u.toString()},c=e.request,f=null===(i=e.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,K(e.start_time_ms)),this.capture("network",e,s,r,e.start_time_ms,l)}},{key:"levelFromStatus",value:function(e){return e>=200&&e<400?"info":0===e||e>=400?"error":"info"}},{key:"captureDom",value:function(e,t,r,n,o){var i={subtype:e,element:t};return void 0!==r&&(i.value=r),void 0!==n&&(i.checked=n),this.capture("dom",i,"info",o)}},{key:"captureInput",value:function(e){var t,r=e.type,n=e.isSynthetic,o=e.element,i=e.value,a=e.timestamp,s="rollbar-input-event",u={type:s,subtype:r,element:o,value:i},l={type:r,isSynthetic:n,element:o,value:i,endTimeUnixNano:K(a)},c=this._getRepeatedEvent(s,l);return c?this._updateRepeatedEvent(c,l,a):(null===(t=this.telemetrySpan)||void 0===t||t.addEvent(s,l,K(a)),this.capture("dom",u,"info",null,a,l))}},{key:"captureClick",value:function(e){var t,r=e.type,n=e.isSynthetic,o=e.element,i=e.timestamp,a="rollbar-click-event",s={type:a,subtype:r,element:o},u={type:r,isSynthetic:n,element:o,endTimeUnixNano:K(i)},l=this._getRepeatedEvent(a,u);return l?this._updateRepeatedEvent(l,u,i):(null===(t=this.telemetrySpan)||void 0===t||t.addEvent(a,u,K(i)),this.capture("dom",s,"info",null,i,u))}},{key:"_getRepeatedEvent",value:function(e,t){var r=this._lastEvent(this.queue);if(r&&r.body.type===e&&r.otelAttributes.target===t.target)return r}},{key:"_updateRepeatedEvent",value:function(e,t,r){var n=Math.max(r-e.timestamp_ms,1);e.body.value=t.value,e.otelAttributes.value=t.value,e.otelAttributes.height=t.height,e.otelAttributes.width=t.width,e.otelAttributes.textZoomRatio=t.textZoomRatio,e.otelAttributes.endTimeUnixNano=K(r),e.otelAttributes.durationUnixNano=K(n),e.otelAttributes.count=(e.otelAttributes.count||1)+1,e.otelAttributes.rate=e.otelAttributes.count/(n/1e3)}},{key:"_lastEvent",value:function(e){return e.length>0?e[e.length-1]:null}},{key:"captureFocus",value:function(e){var t,r=e.type,n=e.isSynthetic,o=e.element,i=e.timestamp,a="rollbar-focus-event",s={type:a,subtype:r,element:o},u={type:r,isSynthetic:n,element:o};return null===(t=this.telemetrySpan)||void 0===t||t.addEvent(a,u,K(i)),this.capture("dom",s,"info",null,i,u)}},{key:"captureResize",value:function(e){var t,r=e.type,n=e.isSynthetic,o=e.width,i=e.height,a=e.textZoomRatio,s=e.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===(t=this.telemetrySpan)||void 0===t||t.addEvent(u,c,K(s)),this.capture("dom",l,"info",null,s,c))}},{key:"captureDragDrop",value:function(e){var t,r=e.type,n=e.isSynthetic,o=e.element,i=e.dropEffect,a=e.effectAllowed,s=e.kinds,u=e.mediaTypes,l=e.timestamp,c="rollbar-dragdrop-event",f={type:c,subtype:r,isSynthetic:n},h={type:r,isSynthetic:n};return"dragstart"===r&&(f=q(q({},f),{},{element:o,dropEffect:i,effectAllowed:a}),h=q(q({},h),{},{element:o,dropEffect:i,effectAllowed:a})),"drop"===r&&(f=q(q({},f),{},{element:o,dropEffect:i,effectAllowed:a,kinds:s,mediaTypes:u}),h=q(q({},h),{},{element:o,dropEffect:i,effectAllowed:a,kinds:s,mediaTypes:u})),null===(t=this.telemetrySpan)||void 0===t||t.addEvent(c,h,K(l)),this.capture("dom",f,"info",null,l,h)}},{key:"captureNavigation",value:function(e,t,r,n){var o;return null===(o=this.telemetrySpan)||void 0===o||o.addEvent("rollbar-navigation-event",{"previous.url.full":e,"url.full":t},K(n)),this.capture("navigation",{from:e,to:t},"info",r,n)}},{key:"captureDomContentLoaded",value:function(e){return this.capture("navigation",{subtype:"DOMContentLoaded"},"info",void 0,e&&e.getTime())}},{key:"captureLoad",value:function(e){return this.capture("navigation",{subtype:"load"},"info",void 0,e&&e.getTime())}},{key:"captureConnectivityChange",value:function(e){var t,r=e.type,n=e.isSynthetic,o=e.timestamp,i="rollbar-connectivity-event",a={type:i,subtype:r},s={type:r,isSynthetic:n};return null===(t=this.telemetrySpan)||void 0===t||t.addEvent(i,s,K(o)),this.capture("connectivity",a,"info",null,o,s)}},{key:"_captureRollbarItem",value:function(e){if(this.options.includeItemsInTelemetry)return e.err?this.captureError(e.err,e.level,e.uuid,e.timestamp):e.message?this.captureLog(e.message,e.level,e.uuid,e.timestamp):e.custom?this.capture("log",e.custom,e.level,e.uuid,e.timestamp):void 0}},{key:"push",value:function(e){this.queue.push(e),this.queue.length>this.maxQueueSize&&this.queue.shift()}}],t&&Z(e.prototype,t),r&&Z(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r}();function Q(e,t){if(t)return t;return{error:"error",manual:"info"}[e]||"info"}var ee=$;function te(e){return te="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},te(e)}function re(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ne(n.key),n)}}function ne(e){var t=function(e,t){if("object"!=te(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=te(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==te(t)?t:t+""}var oe=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._currentContext=t?new Map(t):new Map}return t=e,(r=[{key:"getValue",value:function(e){return this._currentContext.get(e)}},{key:"setValue",value:function(t,r){var n=new e(this._currentContext);return n._currentContext.set(t,r),n}},{key:"deleteValue",value:function(t){var r=new e(self._currentContext);return r._currentContext.delete(t),r}}])&&re(t.prototype,r),n&&re(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r,n}(),ie=new oe;function ae(e){return ae="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ae(e)}function se(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ue(n.key),n)}}function ue(e){var t=function(e,t){if("object"!=ae(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=ae(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==ae(t)?t:t+""}var le=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.currentContext=ie},t=[{key:"active",value:function(){return this.currentContext}},{key:"enterContext",value:function(e){var t=this.currentContext;return this.currentContext=e||ie,t}},{key:"exitContext",value:function(e){return this.currentContext=e,this.currentContext}},{key:"with",value:function(e,t,r){var n=this.enterContext(e);try{for(var o=arguments.length,i=new Array(o>3?o-3:0),a=3;a<o;a++)i[a-3]=arguments[a];return t.call.apply(t,[r].concat(i))}finally{this.exitContext(n)}}}],t&&se(e.prototype,t),r&&se(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r}();function ce(e){return[Math.trunc(e/1e3),Math.round(e%1e3*1e6)]}function fe(e,t){return[e[0]+t[0]+Math.trunc((e[1]+t[1])/1e9),(e[1]+t[1])%1e9]}var he={fromMillis:ce,toMillis:function(e){return 1e3*e[0]+Math.round(e[1]/1e6)},toNanos:function(e){return 1e9*e[0]+e[1]},add:fe,now:function(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]?fe(ce(performance.timeOrigin),ce(performance.now())):ce(Date.now())},isHrTime:function(e){return Array.isArray(e)&&2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}};function pe(e){return pe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pe(e)}function de(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,s=[],u=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(e,t)||ye(e,t)||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 ve(e){return function(e){if(Array.isArray(e))return me(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ye(e)||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 ye(e,t){if(e){if("string"==typeof e)return me(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?me(e,t):void 0}}function me(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function ge(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,be(n.key),n)}}function be(e){var t=function(e,t){if("object"!=pe(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=pe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==pe(t)?t:t+""}var we=function(){return e=function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.api=t,this.options=r},t=[{key:"export",value:function(e,t){ke.push.apply(ke,ve(e))}},{key:"toPayload",value:function(){var e=this,t=ke.slice();if(ke.length=0,!t||!t.length)return{resourceSpans:[]};var r,n=t[0]&&t[0].resource||{},o=new Map,i=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=ye(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},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(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}(t);try{for(i.s();!(r=i.n()).done;){var a=r.value,s=a.instrumentationScope?"".concat(a.instrumentationScope.name,":").concat(a.instrumentationScope.version):"default:1.0.0";o.has(s)||o.set(s,{scope:a.instrumentationScope||{name:"default",version:"1.0.0",attributes:[]},spans:[]}),o.get(s).spans.push(this._transformSpan(a))}}catch(e){i.e(e)}finally{i.f()}return{resourceSpans:[{resource:this._transformResource(n),scopeSpans:Array.from(o.values()).map(function(t){return{scope:e._transformInstrumentationScope(t.scope),spans:t.spans}})}]}}},{key:"post",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.api.postSpans(e,t)}},{key:"_transformSpan",value:function(e){var t,r=this,n=function(e){return Object.entries(e||{}).map(function(e){var t=de(e,2),n=t[0],o=t[1];return{key:n,value:r._transformAnyValue(o)}})};return{traceId:e.spanContext.traceId,spanId:e.spanContext.spanId,parentSpanId:e.parentSpanId||"",name:e.name,kind:e.kind||1,startTimeUnixNano:he.toNanos(e.startTime),endTimeUnixNano:he.toNanos(e.endTime),attributes:n(e.attributes),events:(t=e.events,(t||[]).map(function(e){return{timeUnixNano:he.toNanos(e.time),name:e.name,attributes:n(e.attributes)}}))}}},{key:"_transformResource",value:function(e){var t=this,r=e.attributes||{};return{attributes:Object.entries(r).map(function(e){var r=de(e,2),n=r[0],o=r[1];return{key:n,value:t._transformAnyValue(o)}})}}},{key:"_transformInstrumentationScope",value:function(e){var t=this;return{name:e.name||"",version:e.version||"",attributes:(e.attributes||[]).map(function(e){return{key:e.key,value:t._transformAnyValue(e.value)}})}}},{key:"_transformAnyValue",value:function(e){var t=this;if(null==e)return{stringValue:""};var r=pe(e);return"string"===r?{stringValue:e}:"number"===r?Number.isInteger(e)?{intValue:e.toString()}:{doubleValue:e}:"boolean"===r?{boolValue:e}:Array.isArray(e)?{arrayValue:{values:e.map(function(e){return t._transformAnyValue(e)})}}:"object"===r?{kvlistValue:{values:Object.entries(e).map(function(e){var r=de(e,2),n=r[0],o=r[1];return{key:n,value:t._transformAnyValue(o)}})}}:{stringValue:String(e)}}}],t&&ge(e.prototype,t),r&&ge(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r}(),ke=[];var Se={gen:function(){var e=new Uint8Array(arguments.length>0&&void 0!==arguments[0]?arguments[0]:16);return crypto.getRandomValues(e),Array.from(e,function(e){return e.toString(16).padStart(2,"0")}).join("")}};function Ce(e){return Ce="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ce(e)}function Ie(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Oe(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ie(Object(r),!0).forEach(function(t){_e(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ie(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function xe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Ee(n.key),n)}}function _e(e,t,r){return(t=Ee(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ee(e){var t=function(e,t){if("object"!=Ce(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=Ce(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Ce(t)?t:t+""}var Ae="RollbarSession",Re=function(){return e=function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),_e(this,"_attributes",void 0),this.options=r,this.tracing=t,this.window=t.window,this.session=null,this._attributes={}},t=[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.session||(this.getSession()||this.createSession(),this.initSessionAttributes(e)),this}},{key:"getSession",value:function(){try{var e=this.window.sessionStorage.getItem(Ae);if(!e)return null;this.session=JSON.parse(e)}catch(e){return null}return this}},{key:"createSession",value:function(){return this.session={id:Se.gen(),createdAt:Date.now()},this.setSession(this.session)}},{key:"setSession",value:function(e){var t=JSON.stringify(e);try{this.window.sessionStorage.setItem(Ae,t)}catch(e){return null}return this}},{key:"attributes",get:function(){return this._attributes}},{key:"setAttributes",value:function(e){return this._attributes=Oe(Oe({},this._attributes),e),this}},{key:"setUser",value:function(e){return this.setAttributes({"user.id":null==e?void 0:e.id,"user.email":null==e?void 0:e.email,"user.name":(null==e?void 0:e.name)||(null==e?void 0:e.username)}),this}},{key:"initSessionAttributes",value:function(e){var t,r,n;return this.setAttributes(Oe({"session.id":this.session.id,"browser.brands":null===(t=navigator.userAgentData)||void 0===t?void 0:t.brands,"browser.language":navigator.language,"browser.mobile":null===(r=navigator.userAgentData)||void 0===r?void 0:r.mobile,"browser.platform":null===(n=navigator.userAgentData)||void 0===n?void 0:n.platform,"client.address":"$remote_ip","rollbar.notifier.framework":"browser-js","user_agent.original":navigator.userAgent},e)),this}}],t&&xe(e.prototype,t),r&&xe(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r}(),Te=function(){},Me={debug:0,info:1,warn:2,error:3,disable:4},Pe={error:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Te("error",t)},warn:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Te("warn",t)},info:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Te("info",t)},debug:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Te("debug",t)},log:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Te("info",t)},init:function(e){var t=e.logLevel;Te=function(e,r){Me[e]<Me[t]||(r.unshift("Rollbar:"),console[e].apply(console,r))}}},je=Pe;function Ne(e){return Ne="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ne(e)}function Le(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return De(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?De(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},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(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function De(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Fe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Ue(n.key),n)}}function Ue(e){var t=function(e,t){if("object"!=Ne(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=Ne(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Ne(t)?t:t+""}var Be=function(){return e=function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.exporter=t,this.options=r,this.pendingSpans=new Map,this.transforms=[this.userTransform.bind(this)]},t=[{key:"addTransform",value:function(e){this.transforms.unshift(e)}},{key:"userTransform",value:function(e){this.options.transformSpan&&this.options.transformSpan({span:e})}},{key:"applyTransforms",value:function(e){var t,r=Le(this.transforms);try{for(r.s();!(t=r.n()).done;){var n=t.value;try{n(e)}catch(e){je.error("Error running span transform callback",e)}}}catch(e){r.e(e)}finally{r.f()}}},{key:"onStart",value:function(e,t){this.pendingSpans.set(e.span.spanContext.spanId,e)}},{key:"onEnd",value:function(e){this.applyTransforms(e.span),this.exporter.export([e.export()]),this.pendingSpans.delete(e.span.spanContext.spanId)}}],t&&Fe(e.prototype,t),r&&Fe(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r}();function We(e){return We="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},We(e)}function ze(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,s=[],u=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ge(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ge(e,t):void 0}}(e,t)||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 Ge(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Ve(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,He(n.key),n)}}function He(e){var t=function(e,t){if("object"!=We(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=We(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==We(t)?t:t+""}var qe=function(){return e=function e(t){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.usePerformance=t.usePerformance,this.initReadableSpan(t),this.spanProcessor=t.spanProcessor,this.spanProcessor.onStart(this,t.context),t.attributes&&this.setAttributes(t.attributes),this},t=[{key:"initReadableSpan",value:function(e){var t;this.span={name:e.name,kind:e.kind,spanContext:e.spanContext,parentSpanId:e.parentSpanId,startTime:e.startTime||he.now(e.usePerformance),endTime:[0,0],status:{code:0,message:""},attributes:{"session.id":null===(t=e.session)||void 0===t?void 0:t.id},links:[],events:[],duration:0,ended:!1,resource:e.resource,instrumentationScope:e.scope,droppedAttributesCount:0,droppedEventsCount:0,droppedLinksCount:0}}},{key:"spanContext",value:function(){return this.span.spanContext}},{key:"spanId",get:function(){return this.span.spanContext.spanId}},{key:"traceId",get:function(){return this.span.spanContext.traceId}},{key:"setAttribute",value:function(e,t){return null==t||this.span.ended||0===e.length||(this.span.attributes[e]=t),this}},{key:"setAttributes",value:function(e){for(var t=0,r=Object.entries(e);t<r.length;t++){var n=ze(r[t],2),o=n[0],i=n[1];this.setAttribute(o,i)}return this}},{key:"addEvent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;return this.span.ended||this.span.events.push({name:e,attributes:t,time:r||he.now(),droppedAttributesCount:0}),this}},{key:"isRecording",value:function(){return!1===this.span.ended}},{key:"end",value:function(e,t){e&&this.setAttributes(e),this.span.endTime=t||he.now(this.usePerformance),this.span.ended=!0,this.spanProcessor.onEnd(this)}},{key:"export",value:function(){return this.span}}],t&&Ve(e.prototype,t),r&&Ve(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r}();function Je(e){return Je="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Je(e)}function Ze(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Ye(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ze(Object(r),!0).forEach(function(t){Xe(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ze(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Xe(e,t,r){return(t=$e(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ke(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,$e(n.key),n)}}function $e(e){var t=function(e,t){if("object"!=Je(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=Je(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Je(t)?t:t+""}var Qe=function(){return e=function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.spanProcessor=r,this.tracing=t},t=[{key:"startSpan",value:function(e){var t,r,n,o,i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.tracing.contextManager.active(),u=this.tracing.getSpan(s),l=null==u?void 0:u.spanContext(),c=Se.gen(8),f=null;l?(o=l.traceId,f=l.traceState,i=l.spanId):o=Se.gen(16);var h={traceId:o,spanId:c,traceFlags:0,traceState:f},p={attributes:Ye(Ye({},(null===(t=this.tracing.resource)||void 0===t?void 0:t.attributes)||{}),(null===(r=a.resource)||void 0===r?void 0:r.attributes)||{})};return new qe({resource:p,scope:this.tracing.scope,session:null===(n=this.tracing.session)||void 0===n?void 0:n.session,context:s,spanContext:h,name:e,kind:0,parentSpanId:i,spanProcessor:this.spanProcessor,startTime:a.startTime,usePerformance:a.usePerformance})}}],t&&Ke(e.prototype,t),r&&Ke(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r}();function et(e){return et="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},et(e)}function tt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function rt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?tt(Object(r),!0).forEach(function(t){nt(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tt(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function nt(e,t,r){return(t=it(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ot(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,it(n.key),n)}}function it(e){var t=function(e,t){if("object"!=et(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=et(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==et(t)?t:t+""}var at,st=(at="Rollbar Context Key SPAN",Symbol.for(at)),ut=function(){return e=function e(t,r,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.api=r,this.options=n,this.window=t,this.window.sessionStorage&&(this.session=new Re(this,n)),this.createTracer()},t=[{key:"configure",value:function(e){this.options=e}},{key:"initSession",value:function(){this.session&&this.session.init()}},{key:"sessionId",get:function(){return this.session?this.session.session.id:null}},{key:"resource",get:function(){var e,t;return{attributes:rt(rt({},this.options.resource||{}),{},{"rollbar.environment":null!==(e=null===(t=this.options.payload)||void 0===t?void 0:t.environment)&&void 0!==e?e:this.options.environment})}}},{key:"scope",get:function(){return{name:"rollbar-browser-js",version:this.options.version}}},{key:"idGen",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:16;return Se.gen(e)}},{key:"createTracer",value:function(){this.contextManager=new le,this.exporter=new we(this.api,this.options),this.spanProcessor=new Be(this.exporter,this.options.tracing),this.tracer=new Qe(this,this.spanProcessor)}},{key:"getTracer",value:function(){return this.tracer}},{key:"addSpanTransform",value:function(e){this.spanProcessor.addTransform(e)}},{key:"getSpan",value:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.contextManager.active()).getValue(st)}},{key:"setSpan",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.contextManager.active(),t=arguments.length>1?arguments[1]:void 0;return e.setValue(st,t)}},{key:"startSpan",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.contextManager.active();return this.tracer.startSpan(e,t,r)}},{key:"with",value:function(e,t,r){for(var n,o=arguments.length,i=new Array(o>3?o-3:0),a=3;a<o;a++)i[a-3]=arguments[a];return(n=this.contextManager).with.apply(n,[e,t,r].concat(i))}},{key:"withSpan",value:function(e,t,r,n){var o=this.startSpan(e,t);return this.with(this.setSpan(this.contextManager.active(),o),r,n,o)}}],t&&ot(e.prototype,t),r&&ot(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r}();function lt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,s=[],u=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(e,t)||ft(e,t)||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 ct(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=ft(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},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(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function ft(e,t){if(e){if("string"==typeof e)return ht(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ht(e,t):void 0}}function ht(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function pt(e,t){return[e,b(e,t)]}function dt(e,t){var r=e.length;return r>2*t?e.slice(0,t).concat(e.slice(r-t)):e}function vt(e,t,r){r=void 0===r?30:r;var n,o=e.data.body;if(o.trace_chain){var i,a=ct(o.trace_chain);try{for(a.s();!(i=a.n()).done;){var s=i.value;n=dt(n=s.frames,r),s.frames=n}}catch(e){a.e(e)}finally{a.f()}}else o.trace&&(n=dt(n=o.trace.frames,r),o.trace.frames=n);return[e,b(e,t)]}function yt(e,t){return t&&t.length>e?t.slice(0,e-3).concat("..."):t}function mt(e,t,r){return t=L(t,function t(r,n,o){switch(s(n)){case"string":return yt(e,n);case"object":case"array":return L(n,t,o);default:return n}}),[t,b(t,r)]}function gt(e){return e.exception&&(delete e.exception.description,e.exception.message=yt(255,e.exception.message)),e.frames=dt(e.frames,1),e}function bt(e,t){var r=e.data.body;if(r.trace_chain){var n,o=r.trace_chain,i=ct(o.entries());try{for(i.s();!(n=i.n()).done;){var a=lt(n.value,2),s=a[0],u=a[1];o[s]=gt(u)}}catch(e){i.e(e)}finally{i.f()}}else r.trace&&(r.trace=gt(r.trace));return[e,b(e,t)]}function wt(e,t){return function(e){for(var t=0,r=e.length,n=0;n<r;n++){var o=e.charCodeAt(n);o<128?t+=1:o<2048?t+=2:o<65536&&(t+=3)}return t}(e)>t}var kt={truncate:function(e,t,r){r=void 0===r?524288:r;for(var n,o,i,a=[pt,vt,mt.bind(null,1024),mt.bind(null,512),mt.bind(null,256),bt];n=a.shift();)if(e=(o=n(e,t))[0],(i=o[1]).error||!wt(i.value,r))return i;return i},raw:pt,truncateFrames:vt,truncateStrings:mt,maybeTruncateValue:yt};function St(e){if(!a(e.context,"string")){var t=b(e.context);t.error?e.c