Socket
Socket
Sign inDemoInstall

@datadog/browser-rum

Package Overview
Dependencies
Maintainers
1
Versions
251
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@datadog/browser-rum - npm Package Compare versions

Comparing version 1.24.0 to 1.24.1

cjs/assemblyV2.d.ts

2

bundle/datadog-rum.js

@@ -1,1 +0,1 @@

!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([,function(e,t,n){"use strict";n.r(t),n.d(t,"datadogRum",(function(){return On})),n.d(t,"makeRumGlobal",(function(){return _n}));var r=function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function i(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}}function o(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],a=0,u=o.length;a<u;a++,i++)r[i]=o[a];return r}var a,u,s,c=1e3,f=60*c,d=60*f;function l(e,t,n){var r,i=!n||void 0===n.leading||n.leading,o=!n||void 0===n.trailing||n.trailing,a=!1,u=!1;return{throttled:function(){var n=this;a?u=!0:(i?e.apply(this):u=!0,a=!0,r=window.setTimeout((function(){o&&u&&e.apply(n),a=!1,u=!1}),t))},cancel:function(){window.clearTimeout(r),a=!1,u=!1}}}!function(e){e.BEFORE_UNLOAD="beforeunload",e.CLICK="click",e.KEY_DOWN="keydown",e.LOAD="load",e.POP_STATE="popstate",e.SCROLL="scroll",e.TOUCH_START="touchstart",e.VISIBILITY_CHANGE="visibilitychange",e.DOM_CONTENT_LOADED="DOMContentLoaded"}(a||(a={})),function(e){e.DOCUMENT="document",e.XHR="xhr",e.BEACON="beacon",e.FETCH="fetch",e.CSS="css",e.JS="js",e.IMAGE="image",e.FONT="font",e.MEDIA="media",e.OTHER="other"}(u||(u={})),function(e){e.FETCH="fetch",e.XHR="xhr"}(s||(s={}));var p,m=function(e){return Array.isArray(e)},E=function(e){return!Array.isArray(e)&&"object"==typeof e&&null!==e};function v(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=t.length-1;r>=0;r-=1){var i=t[r];if(void 0!==i){if(void 0===e)if(E(i))e={};else{if(!m(i)){e=i;break}e=[]}if(E(e)&&E(i))for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=v(i[o],e[o]));else{if(!m(e)||!m(i))break;e.length=Math.max(e.length,i.length);for(var a=0;a<i.length;a+=1)e[a]=v(i[a],e[a])}}}return e}function h(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return v.apply(void 0,o([e],t.filter((function(e){return null!==e}))))}function T(e){return v(e)}function g(e){return e?(parseInt(e,10)^16*Math.random()>>parseInt(e,10)/4).toString(16):(1e7+"-1000-4000-8000-100000000000").replace(/[018]/g,g)}function b(e){return 0!==e&&100*Math.random()<=e}function y(e){return"number"!=typeof e?e:+(1e6*e).toFixed(0)}function C(e){var t={};return Object.keys(e).forEach((function(n){var r;t[(r=n,r.replace(/[A-Z]/g,(function(e,t){return(0!==t?"_":"")+e.toLowerCase()})).replace(/-/g,"_"))]=function e(t){if(Array.isArray(t))return t.map((function(t){return e(t)}));if("object"==typeof t&&null!==t)return C(t);return t}(e[n])})),t}function O(){}function _(e,t,n){if(null==e)return JSON.stringify(e);var r=[!1,void 0];R(e)&&(r=[!0,e.toJSON],delete e.toJSON);var i,o,a=[!1,void 0];"object"==typeof e&&R(i=Object.getPrototypeOf(e))&&(a=[!0,i.toJSON],delete i.toJSON);try{o=JSON.stringify(e,void 0,n)}catch(e){o="<error: unable to serialize object>"}finally{r[0]&&(e.toJSON=r[1]),a[0]&&(i.toJSON=a[1])}return o}function R(e){return"object"==typeof e&&null!==e&&e.hasOwnProperty("toJSON")}function S(e,t){return-1!==e.indexOf(t)}function w(e){return I(e)&&e>=0&&e<=100}function I(e){return"number"==typeof e}function A(e){return Math.floor(D()+e)}function D(){return void 0===p&&(p=performance.timing.navigationStart),p}function L(e){return Object.keys(e).map((function(t){return[t,e[t]]}))}function x(e){if(e.origin)return e.origin;var t=e.host.replace(/(:80|:443)$/,"");return e.protocol+"//"+t}function N(e,t){var n=e.match("(?:^|;)\\s*"+t+"\\s*=\\s*([^;]+)");return n?n[1]:void 0}var M,U=c;function k(e,t,n,r){var i=new Date;i.setTime(i.getTime()+n);var o="expires="+i.toUTCString(),a=r&&r.crossSite?"none":"strict",u=r&&r.domain?";domain="+r.domain:"",s=r&&r.secure?";secure":"";document.cookie=e+"="+t+";"+o+";path=/;samesite="+a+u+s}function B(e){return N(document.cookie,e)}function P(e){return W(e,x(window.location)).href}function H(e,t){return j(e)===j(t)}function j(e){return x(W(e))}function F(e){var t=W(e).pathname;return"/"===t[0]?t:"/"+t}function W(e,t){if(function(){if(void 0!==M)return M;try{var e=new URL("http://test/path");return M="http://test/path"===e.href}catch(e){M=!1}return M}())return void 0!==t?new URL(e,t):new URL(e);if(void 0===t&&!/:/.test(e))throw new Error("Invalid URL: '"+e+"'");var n=document,r=n.createElement("a");if(void 0!==t){var i=(n=document.implementation.createHTMLDocument("")).createElement("base");i.href=t,n.head.appendChild(i),n.body.appendChild(r)}return r.href=e,r}var V={allowedTracingOrigins:[],maxErrorsByMinute:3e3,maxInternalMonitoringMessagesPerPage:15,resourceSampleRate:100,sampleRate:100,silentMultipleInit:!1,trackInteractions:!1,requestErrorResponseLengthLimit:32768,flushTimeout:30*c,maxBatchSize:50,maxMessageSize:262144,batchBytesLimit:16384};function q(e){var t={};return t.secure=function(e){return!!e.useSecureSessionCookie||!!e.useCrossSiteSessionCookie}(e),t.crossSite=!!e.useCrossSiteSessionCookie,e.trackSessionAcrossSubdomains&&(t.domain=function(){for(var e=window.location.hostname.split("."),t=e.pop();e.length&&!B("dd_site_test");)t=e.pop()+"."+t,k("dd_site_test","test",c,{domain:t});return t}()),t}function z(e,t,n){var r="sdk_version:"+t.sdkVersion+(t.env?",env:"+t.env:"")+(t.service?",service:"+t.service:"")+(t.version?",version:"+t.version:""),i=e+"-http-intake.logs."+t.site,o=t.proxyHost?t.proxyHost:i,a=t.proxyHost?"ddhost="+i+"&":"",u=""+(t.applicationId?"_dd.application_id="+t.applicationId+"&":"")+a+"ddsource="+(n||"browser")+"&ddtags="+r;return"https://"+o+"/v1/input/"+t.clientToken+"?"+u}function G(e,t){return-1!==F(e).indexOf("/v1/input/")&&(H(e,t.logsEndpoint)||H(e,t.rumEndpoint)||H(e,t.traceEndpoint)||!!t.internalMonitoringEndpoint&&H(e,t.internalMonitoringEndpoint)||!!t.replica&&(H(e,t.replica.logsEndpoint)||H(e,t.replica.rumEndpoint)||H(e,t.replica.internalMonitoringEndpoint)))}var K="?",$=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;function X(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Y=function(){var e,t,n,r,i,o,a=[];function u(e,t,n){var r;for(var i in a)if(X(a,i))try{a[i](e,t,n)}catch(e){r=e}if(r)throw r}function s(e,r,i,o,a){if(t)J.augmentStackTraceWithInitialElement(t,r,i,""+e),f();else if(a)u(J(a),!0,a);else{var s,c={url:r,column:o,line:i},d=e;if("[object String]"==={}.toString.call(e)){var l=d.match($);l&&(s=l[1],d=l[2])}u({name:s,message:d,stack:[c]},!0)}return!!n&&n.apply(this,arguments)}function c(e){var t=e.reason||"Empty reason";u(J(t),!0,t)}function f(){var n=t,r=e;t=void 0,e=void 0,u(n,!1,r)}function d(n){if(t){if(e===n)return;f()}var r=J(n);throw t=r,e=n,setTimeout((function(){e===n&&f()}),r.incomplete?2e3:0),n}return d.subscribe=function(e){!function(){if(r)return;n=window.onerror,window.onerror=ue(s),r=!0}(),function(){if(o)return;i=null!==window.onunhandledrejection?window.onunhandledrejection:void 0,window.onunhandledrejection=ue(c),o=!0}(),a.push(e)},d.unsubscribe=function(e){for(var t=a.length-1;t>=0;t-=1)a[t]===e&&a.splice(t,1);0===a.length&&(r&&(window.onerror=n,r=!1),o&&(window.onunhandledrejection=i,o=!1))},d.traceKitWindowOnError=s,d}(),J=function(){var e=!1;function t(e){if(e.stack){for(var t,n,r,i,o=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,a=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,u=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,s=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,c=/\((\S*)(?::(\d+))(?::(\d+))\)/,f=e.stack.split("\n"),d=[],l=0,p=f.length;l<p;l+=1){if(o.exec(f[l])){var m=(r=o.exec(f[l]))[2]&&0===r[2].indexOf("native");t=r[2]&&0===r[2].indexOf("eval"),n=c.exec(r[2]),t&&n&&(r[2]=n[1],r[3]=n[2],r[4]=n[3]),i={args:m?[r[2]]:[],column:r[4]?+r[4]:void 0,func:r[1]||K,line:r[3]?+r[3]:void 0,url:m?void 0:r[2]}}else if(u.exec(f[l]))i={args:[],column:(r=u.exec(f[l]))[4]?+r[4]:void 0,func:r[1]||K,line:+r[3],url:r[2]};else{if(!a.exec(f[l]))continue;t=(r=a.exec(f[l]))[3]&&r[3].indexOf(" > eval")>-1,n=s.exec(r[3]),t&&n?(r[3]=n[1],r[4]=n[2],r[5]=void 0):0!==l||r[5]||void 0===e.columnNumber||(d[0].column=e.columnNumber+1),i={args:r[2]?r[2].split(","):[],column:r[5]?+r[5]:void 0,func:r[1]||K,line:r[4]?+r[4]:void 0,url:r[3]}}!i.func&&i.line&&(i.func=K),d.push(i)}if(d.length)return{stack:d,message:e.message,name:e.name}}}function n(e,t,n,r){var i={url:t,line:n?+n:void 0};if(i.url&&i.line){e.incomplete=!1;var o=e.stack;if(o.length>0&&o[0].url===i.url){if(o[0].line===i.line)return!1;if(!o[0].line&&o[0].func===i.func)return o[0].line=i.line,o[0].context=i.context,!1}return o.unshift(i),e.partial=!0,!0}return e.incomplete=!0,!1}function r(e,t){for(var i,o,a=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,u=[],s={},c=!1,f=r.caller;f&&!c;f=f.caller)f!==J&&f!==Y&&(o={args:[],column:void 0,func:K,line:void 0,url:void 0},i=a.exec(f.toString()),f.name?o.func=f.name:i&&(o.func=i[1]),void 0===o.func&&(o.func=i?i.input.substring(0,i.input.indexOf("{")):void 0),s[""+f]?c=!0:s[""+f]=!0,u.push(o));t&&u.splice(0,t);var d={stack:u,message:e.message,name:e.name};return n(d,e.sourceURL||e.fileName,e.line||e.lineNumber,e.message||e.description),d}function i(n,i){var o,a=void 0===i?0:+i;try{if(o=function(e){var t=e.stacktrace;if(t){for(var n,r=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,i=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^\)]+))\((.*)\))? in (.*):\s*$/i,o=t.split("\n"),a=[],u=0;u<o.length;u+=2){var s=void 0;r.exec(o[u])?s={args:[],column:void 0,func:(n=r.exec(o[u]))[3],line:+n[1],url:n[2]}:i.exec(o[u])&&(s={args:(n=i.exec(o[u]))[5]?n[5].split(","):[],column:+n[2],func:n[3]||n[4],line:+n[1],url:n[6]}),s&&(!s.func&&s.line&&(s.func=K),s.context=[o[u+1]],a.push(s))}if(a.length)return{stack:a,message:e.message,name:e.name}}}(n))return o}catch(t){if(e)throw t}try{if(o=t(n))return o}catch(t){if(e)throw t}try{if(o=function(e){var t=e.message.split("\n");if(!(t.length<4)){var n,r=/^\s*Line (\d+) of linked script ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,i=/^\s*Line (\d+) of inline#(\d+) script in ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,o=/^\s*Line (\d+) of function script\s*$/i,a=[],u=window&&window.document&&window.document.getElementsByTagName("script"),s=[];for(var c in u)X(u,c)&&!u[c].src&&s.push(u[c]);for(var f=2;f<t.length;f+=2){var d=void 0;if(r.exec(t[f]))d={args:[],column:void 0,func:(n=r.exec(t[f]))[3],line:+n[1],url:n[2]};else if(i.exec(t[f]))d={args:[],column:void 0,func:(n=i.exec(t[f]))[4],line:+n[1],url:n[3]};else if(o.exec(t[f])){n=o.exec(t[f]),d={url:window.location.href.replace(/#.*$/,""),args:[],column:void 0,func:"",line:+n[1]}}d&&(d.func||(d.func=K),d.context=[t[f+1]],a.push(d))}if(a.length)return{stack:a,message:t[0],name:e.name}}}(n))return o}catch(t){if(e)throw t}try{if(o=r(n,a+1))return o}catch(t){if(e)throw t}return{message:n.message,name:n.name,stack:[]}}return i.augmentStackTraceWithInitialElement=n,i.computeStackTraceFromStackProp=t,i.ofCaller=function(e){var t=1+(void 0===e?0:+e);try{throw new Error}catch(e){return J(e,t+1)}},i}();var Q=/[^\u0000-\u007F]/,Z=function(){function e(e,t,n){void 0===n&&(n=!1),this.endpointUrl=e,this.bytesLimit=t,this.withBatchTime=n}return e.prototype.send=function(e,t){var n=this.withBatchTime?function(e){return e+(-1===e.indexOf("?")?"?":"&")+"batch_time="+(new Date).getTime()}(this.endpointUrl):this.endpointUrl;if(navigator.sendBeacon&&t<this.bytesLimit&&navigator.sendBeacon(n,e))return;var r=new XMLHttpRequest;r.open("POST",n,!0),r.send(e)},e}();var ee,te=function(){function e(e,t,n,r,i,o){void 0===o&&(o=O),this.request=e,this.maxSize=t,this.bytesLimit=n,this.maxMessageSize=r,this.flushTimeout=i,this.beforeUnloadCallback=o,this.pushOnlyBuffer=[],this.upsertBuffer={},this.bufferBytesSize=0,this.bufferMessageCount=0,this.flushOnVisibilityHidden(),this.flushPeriodically()}return e.prototype.add=function(e){this.addOrUpdate(e)},e.prototype.upsert=function(e,t){this.addOrUpdate(e,t)},e.prototype.flush=function(){if(0!==this.bufferMessageCount){var e=o(this.pushOnlyBuffer,(t=this.upsertBuffer,n=[],Object.keys(t).forEach((function(e){n.push(t[e])})),n));this.request.send(e.join("\n"),this.bufferBytesSize),this.pushOnlyBuffer=[],this.upsertBuffer={},this.bufferBytesSize=0,this.bufferMessageCount=0}var t,n},e.prototype.sizeInBytes=function(e){return Q.test(e)?void 0!==window.TextEncoder?(new TextEncoder).encode(e).length:new Blob([e]).size:e.length},e.prototype.addOrUpdate=function(e,t){var n=this.process(e),r=n.processedMessage,i=n.messageBytesSize;i>=this.maxMessageSize?console.warn("Discarded a message whose size was bigger than the maximum allowed size "+this.maxMessageSize+"KB."):(this.hasMessageFor(t)&&this.remove(t),this.willReachedBytesLimitWith(i)&&this.flush(),this.push(r,i,t),this.isFull()&&this.flush())},e.prototype.process=function(e){var t=_(e);return{processedMessage:t,messageBytesSize:this.sizeInBytes(t)}},e.prototype.push=function(e,t,n){this.bufferMessageCount>0&&(this.bufferBytesSize+=1),void 0!==n?this.upsertBuffer[n]=e:this.pushOnlyBuffer.push(e),this.bufferBytesSize+=t,this.bufferMessageCount+=1},e.prototype.remove=function(e){var t=this.upsertBuffer[e];delete this.upsertBuffer[e];var n=this.sizeInBytes(t);this.bufferBytesSize-=n,this.bufferMessageCount-=1,this.bufferMessageCount>0&&(this.bufferBytesSize-=1)},e.prototype.hasMessageFor=function(e){return void 0!==e&&void 0!==this.upsertBuffer[e]},e.prototype.willReachedBytesLimitWith=function(e){return this.bufferBytesSize+e+1>=this.bytesLimit},e.prototype.isFull=function(){return this.bufferMessageCount===this.maxSize||this.bufferBytesSize>=this.bytesLimit},e.prototype.flushPeriodically=function(){var e=this;setTimeout((function(){e.flush(),e.flushPeriodically()}),this.flushTimeout)},e.prototype.flushOnVisibilityHidden=function(){var e=this;navigator.sendBeacon&&(window.addEventListener(a.BEFORE_UNLOAD,ue(this.beforeUnloadCallback)),document.addEventListener(a.VISIBILITY_CHANGE,ue((function(){"hidden"===document.visibilityState&&e.flush()}))),window.addEventListener(a.BEFORE_UNLOAD,ue((function(){return e.flush()}))))},e}();!function(e){e.info="info",e.error="error"}(ee||(ee={}));var ne,re,ie,oe={maxMessagesPerPage:0,sentMessageCount:0};function ae(e){if(e.internalMonitoringEndpoint){var t=function(e){var t,n=r(e.internalMonitoringEndpoint);void 0!==e.replica&&(t=r(e.replica.internalMonitoringEndpoint));function r(t){return new te(new Z(t,e.batchBytesLimit),e.maxBatchSize,e.batchBytesLimit,e.maxMessageSize,e.flushTimeout)}return{add:function(e){var r=function(e){return h({date:(new Date).getTime(),view:{referrer:document.referrer,url:window.location.href}},void 0!==ne?ne():{},e)}(e);n.add(r),t&&t.add(r)}}}(e);!function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];t.forEach((function(t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}))}(oe,{batch:t,maxMessagesPerPage:e.maxInternalMonitoringMessagesPerPage,sentMessageCount:0})}return{setExternalContextProvider:function(e){ne=e}}}function ue(e){return function(){try{return e.apply(this,arguments)}catch(e){le(e);try{ce(e)}catch(e){le(e)}}}}function se(e,t){!function(e){oe.debugMode&&console.log("[MONITORING MESSAGE]",e)}(e),fe(r(r({message:e},t),{status:ee.info}))}function ce(e){fe(r(r({},function(e){if(e instanceof Error){var t=J(e);return{error:{kind:t.name,stack:Le(t)},message:t.message}}return{error:{stack:"Not an instance of error"},message:"Uncaught "+_(e)}}(e)),{status:ee.error}))}function fe(e){oe.batch&&oe.sentMessageCount<oe.maxMessagesPerPage&&(oe.sentMessageCount+=1,oe.batch.add(e))}function de(e){oe.debugMode=e}function le(e){oe.debugMode&&console.warn("[INTERNAL ERROR]",e)}var pe=[],me=[];function Ee(){return re||(!function(){if(!window.fetch)return;ie=window.fetch,window.fetch=ue((function(e,t){var n=this,r=t&&t.method||"object"==typeof e&&e.method||"GET",o=P("object"==typeof e&&e.url||e),a={init:t,method:r,startTime:performance.now(),url:o},u=function(e){return t=n,r=void 0,u=function(){var t,n;return i(this,(function(r){switch(r.label){case 0:return a.duration=performance.now()-a.startTime,"stack"in e||e instanceof Error?(a.status=0,a.response=Le(J(e)),me.forEach((function(e){return e(a)})),[3,6]):[3,1];case 1:if(!("status"in e))return[3,6];t=void 0,r.label=2;case 2:return r.trys.push([2,4,,5]),[4,e.clone().text()];case 3:return t=r.sent(),[3,5];case 4:return n=r.sent(),t="Unable to retrieve response: "+n,[3,5];case 5:a.response=t,a.responseType=e.type,a.status=e.status,me.forEach((function(e){return e(a)})),r.label=6;case 6:return[2]}}))},new((o=void 0)||(o=Promise))((function(e,n){function i(e){try{s(u.next(e))}catch(e){n(e)}}function a(e){try{s(u.throw(e))}catch(e){n(e)}}function s(t){t.done?e(t.value):new o((function(e){e(t.value)})).then(i,a)}s((u=u.apply(t,r||[])).next())}));var t,r,o,u};pe.forEach((function(e){return e(a)}));var s=ie.call(this,e,a.init);return s.then(ue(u),ue(u)),s}))}(),re={beforeSend:function(e){pe.push(e)},onRequestComplete:function(e){me.push(e)}}),re}var ve,he,Te,ge,be,ye,Ce,Oe,_e,Re=function(){function e(){this.observers=[]}return e.prototype.subscribe=function(e){this.observers.push(e)},e.prototype.notify=function(e){this.observers.forEach((function(t){return t(e)}))},e}(),Se=[],we=[];function Ie(){return ve||(he=XMLHttpRequest.prototype.open,Te=XMLHttpRequest.prototype.send,XMLHttpRequest.prototype.open=ue((function(e,t){return this._datadog_xhr={method:e,startTime:-1,url:P(t)},he.apply(this,arguments)})),XMLHttpRequest.prototype.send=ue((function(e){var t=this;if(this._datadog_xhr){this._datadog_xhr.startTime=performance.now();var n=this.onreadystatechange;this.onreadystatechange=function(){this.readyState===XMLHttpRequest.DONE&&ue(i)(),n&&n.apply(this,arguments)};var r=!1,i=function(){r||(r=!0,t._datadog_xhr.duration=performance.now()-t._datadog_xhr.startTime,t._datadog_xhr.response=t.response,t._datadog_xhr.status=t.status,we.forEach((function(e){return e(t._datadog_xhr)})))};this.addEventListener("loadend",ue(i)),Se.forEach((function(e){return e(t._datadog_xhr,t)}))}return Te.apply(this,arguments)})),ve={beforeSend:function(e){Se.push(e)},onRequestComplete:function(e){we.push(e)}}),ve}function Ae(e){if(!be){var t=new Re;!function(e,t){function n(n,r){G(r.url,e)||!function(e){return 0===e.status&&"opaque"!==e.responseType}(r)&&!function(e){return e.status>=500}(r)||t.notify({context:{error:{origin:ge.NETWORK,stack:xe(r.response,e)||"Failed to load"},http:{method:r.method,status_code:r.status,url:r.url}},message:Ne(n)+" error "+r.method+" "+r.url,startTime:r.startTime})}Ie().onRequestComplete((function(e){return n(s.XHR,e)})),Ee().onRequestComplete((function(e){return n(s.FETCH,e)}))}(e,t),function(e){ye=console.error,console.error=ue((function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];ye.apply(console,o([t],n)),e.notify({context:{error:{origin:ge.CONSOLE}},message:o(["console error:",t],n).map(De).join(" "),startTime:performance.now()})}))}(t),function(e){Ce=function(t,n,r){e.notify(function(e,t){var n,r;void 0!==e.message||t instanceof Error?(n=e.message||"Empty message",r=Le(e)):(n="Uncaught "+_(t),r="No stack, consider using an instance of Error");return{message:n,context:{error:{stack:r,kind:e.name,origin:ge.SOURCE}},startTime:performance.now()}}(t,r))},Y.subscribe(Ce)}(t),be=function(e,t){var n=0,r=new Re;return t.subscribe((function(t){n<e.maxErrorsByMinute?(n+=1,r.notify(t)):n===e.maxErrorsByMinute&&(n+=1,r.notify({context:{error:{origin:ge.AGENT}},message:"Reached max number of errors by minute: "+e.maxErrorsByMinute,startTime:performance.now()}))})),setInterval((function(){return n=0}),f),r}(e,t)}return be}function De(e){return"string"==typeof e?e:e instanceof Error?Le(J(e)):_(e,0,2)}function Le(e){var t=(e.name||"Error")+": "+e.message;return e.stack.forEach((function(e){var n="?"===e.func?"<anonymous>":e.func,r=e.args&&e.args.length>0?"("+e.args.join(", ")+")":"",i=e.line?":"+e.line:"",o=e.line&&e.column?":"+e.column:"";t+="\n at "+n+r+" @ "+e.url+i+o})),t}function xe(e,t){return e&&e.length>t.requestErrorResponseLengthLimit?e.substring(0,t.requestErrorResponseLengthLimit)+"...":e}function Ne(e){return s.XHR===e?"XHR":"Fetch"}!function(e){e.AGENT="agent",e.CONSOLE="console",e.NETWORK="network",e.SOURCE="source",e.LOGGER="logger"}(ge||(ge={})),function(e){e.US="us",e.EU="eu"}(_e||(_e={}));var Me,Ue=((Oe={})[_e.EU]="datadoghq.eu",Oe[_e.US]="datadoghq.com",Oe);function ke(e,t,n){var i=function(e,t){var n={applicationId:e.applicationId,buildMode:t.buildMode,clientToken:e.clientToken,env:e.env,proxyHost:e.proxyHost,sdkVersion:t.sdkVersion,service:e.service,site:e.site||Ue[e.datacenter||t.datacenter],version:e.version},i=Array.isArray(e.enableExperimentalFeatures)?e.enableExperimentalFeatures:[],o=r({cookieOptions:q(e),isEnabled:function(e){return S(i,e)},logsEndpoint:z("browser",n),proxyHost:e.proxyHost,rumEndpoint:z("rum",n),service:e.service,traceEndpoint:z("public-trace",n)},V);if(e.internalMonitoringApiKey&&(o.internalMonitoringEndpoint=z("browser",n,"browser-agent-internal-monitoring")),"allowedTracingOrigins"in e&&(o.allowedTracingOrigins=e.allowedTracingOrigins),"sampleRate"in e&&(o.sampleRate=e.sampleRate),"resourceSampleRate"in e&&(o.resourceSampleRate=e.resourceSampleRate),"trackInteractions"in e&&(o.trackInteractions=!!e.trackInteractions),n.buildMode===Me.E2E_TEST&&(o.internalMonitoringEndpoint="<<< E2E INTERNAL MONITORING ENDPOINT >>>",o.logsEndpoint="<<< E2E LOGS ENDPOINT >>>",o.rumEndpoint="<<< E2E RUM ENDPOINT >>>"),n.buildMode===Me.STAGING&&void 0!==e.replica){var a=r(r({},n),{applicationId:e.replica.applicationId,clientToken:e.replica.clientToken,site:Ue[_e.US]});o.replica={applicationId:e.replica.applicationId,internalMonitoringEndpoint:z("browser",a,"browser-agent-internal-monitoring"),logsEndpoint:z("browser",a),rumEndpoint:z("rum",a)}}return o}(e,t),o=ae(i);return{configuration:i,errorObservable:n?Ae(i):new Re,internalMonitoring:o}}function Be(e){return!!function(e){if(void 0===document.cookie||null===document.cookie)return!1;try{return k("dd_cookie_test","test",c,e),"test"===B("dd_cookie_test")}catch(e){return console.error(e),!1}}(e)||(console.warn("Cookies are not authorized, we will not send any data."),!1)}function Pe(){return"file:"!==window.location.protocol||(console.error("Execution is not allowed in the current context."),!1)}!function(e){e.RELEASE="release",e.STAGING="staging",e.E2E_TEST="e2e-test"}(Me||(Me={}));var He,je=1e4,Fe=function(){function e(e){void 0===e&&(e=je),this.limit=e,this.buffer=[]}return e.prototype.add=function(e){this.buffer.push(e)>this.limit&&this.buffer.splice(0,1)},e.prototype.drain=function(e){this.buffer.forEach((function(t){return e(t)})),this.buffer.length=0},e}();!function(e){e[e.ERROR_COLLECTED=0]="ERROR_COLLECTED",e[e.PERFORMANCE_ENTRY_COLLECTED=1]="PERFORMANCE_ENTRY_COLLECTED",e[e.CUSTOM_ACTION_COLLECTED=2]="CUSTOM_ACTION_COLLECTED",e[e.AUTO_ACTION_CREATED=3]="AUTO_ACTION_CREATED",e[e.AUTO_ACTION_COMPLETED=4]="AUTO_ACTION_COMPLETED",e[e.AUTO_ACTION_DISCARDED=5]="AUTO_ACTION_DISCARDED",e[e.VIEW_CREATED=6]="VIEW_CREATED",e[e.VIEW_UPDATED=7]="VIEW_UPDATED",e[e.REQUEST_STARTED=8]="REQUEST_STARTED",e[e.REQUEST_COMPLETED=9]="REQUEST_COMPLETED",e[e.SESSION_RENEWED=10]="SESSION_RENEWED",e[e.RESOURCE_ADDED_TO_BATCH=11]="RESOURCE_ADDED_TO_BATCH",e[e.DOM_MUTATED=12]="DOM_MUTATED",e[e.BEFORE_UNLOAD=13]="BEFORE_UNLOAD",e[e.RAW_RUM_EVENT_COLLECTED=14]="RAW_RUM_EVENT_COLLECTED",e[e.RUM_EVENT_COLLECTED=15]="RUM_EVENT_COLLECTED"}(He||(He={}));var We,Ve=function(){function e(){this.callbacks={}}return e.prototype.notify=function(e,t){var n=this.callbacks[e];n&&n.forEach((function(e){return e(t)}))},e.prototype.subscribe=function(e,t){var n=this;return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),{unsubscribe:function(){n.callbacks[e]=n.callbacks[e].filter((function(e){return t!==e}))}}},e}();function qe(e,t,n,r,i,o){n.subscribe(He.RAW_RUM_EVENT_COLLECTED,(function(a){var u,s=a.startTime,c=a.rawRumEvent,f=a.savedGlobalContext,d=a.customerContext,l=i.findView(s);if(r.isTracked()&&l&&l.sessionId){var p=i.findAction(s),m={applicationId:e,date:(new Date).getTime(),service:t.service,session:{type:void 0===window._DATADOG_SYNTHETICS_BROWSER?We.USER:We.SYNTHETICS}},E=(u=c,-1!==[mn.ERROR,mn.RESOURCE,mn.LONG_TASK].indexOf(u.evt.category)?h(m,l,p,c):h(m,l,c)),v=h(f||o(),d,C(E));n.notify(He.RUM_EVENT_COLLECTED,{rumEvent:E,serverRumEvent:v})}}))}function ze(e,t){var n=function(e,t){var n,r=o(e.rumEndpoint,(function(){return t.notify(He.BEFORE_UNLOAD)})),i=e.replica;void 0!==i&&(n=o(i.rumEndpoint));function o(t,n){return new te(new Z(t,e.batchBytesLimit,!0),e.maxBatchSize,e.batchBytesLimit,e.maxMessageSize,e.flushTimeout,n)}function a(e){return h(e,{application_id:i.applicationId})}var u=!1;return{add:function(e){u||(r.add(e),n&&n.add(a(e)))},stop:function(){u=!0},upsert:function(e,t){u||(r.upsert(e,t),n&&n.upsert(a(e),t))}}}(e,t);return t.subscribe(He.RUM_EVENT_COLLECTED,(function(e){var t=e.rumEvent,r=e.serverRumEvent;t.evt.category===mn.VIEW?n.upsert(r,t.view.id):n.add(r)})),{stop:function(){n.stop()}}}!function(e){e.SYNTHETICS="synthetics",e.USER="user"}(We||(We={}));var Ge={buildMode:"release",datacenter:"us",sdkVersion:"1.24.0"};function Ke(e){var t,n=function(){var e,t=window;if(t.Zone){var n=t.Zone.__symbol__("MutationObserver");e=t[n]}return e||(e=t.MutationObserver),e}();return n&&(t=new n(ue((function(){e.notify(He.DOM_MUTATED)})))).observe(document.documentElement,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),{stop:function(){t&&t.disconnect()}}}function $e(e){if(performance&&"getEntriesByName"in performance){var t,n=performance.getEntriesByName(e.url,"resource").filter((function(t){return n=t,r=e.startTime,i=Xe(e),n.startTime>=r&&Xe(n)<=i;var n,r,i}));return 1===n.length?n[0]:2===n.length&&Xe((t=n)[0])<=t[1].startTime?n[1]:void 0}}function Xe(e){return e.startTime+e.duration}var Ye="_dd",Je="_dd_r",Qe="_dd_l",Ze="rum",et="logs";var tt="_dd_s",nt=15*f,rt=4*d,it=f;function ot(e,t,n){var r=function(e,t){var n,r,i=!1,o=function(){i=!0,window.clearTimeout(n),n=window.setTimeout((function(){i=!1}),U)};return{get:function(){return i?r:(r=B(e),o(),r)},set:function(n,i){k(e,n,i,t),r=n,o()}}}(tt,e);!function(e){var t=e.get(),n=B(Ye),r=B(Je),i=B(Qe);if(!t){var o={};n&&(o.id=n),i&&/^[01]$/.test(i)&&(o[et]=i),r&&/^[012]$/.test(r)&&(o[Ze]=r),ct(o,e)}}(r);var i=new Re,o=st(r).id,u=l((function(){var e=st(r),a=n(e[t]),u=a.trackingType,s=a.isTracked;e[t]=u,s&&!e.id&&(e.id=g(),e.created=String(Date.now())),ct(e,r),s&&o!==e.id&&(o=e.id,i.notify())}),U).throttled;return u(),function(e){var t=ue(e),n={capture:!0,passive:!0};[a.CLICK,a.TOUCH_START,a.KEY_DOWN,a.SCROLL].forEach((function(e){document.addEventListener(e,t,n),dt.push((function(){return document.removeEventListener(e,t,n)}))}))}(u),function(e){var t=ue((function(){"visible"===document.visibilityState&&e()})),n=window.setInterval(t,it);document.addEventListener(a.VISIBILITY_CHANGE,t),dt.push((function(){clearInterval(n),document.removeEventListener(a.VISIBILITY_CHANGE,t)}))}((function(){ct(st(r),r)})),{getId:function(){return st(r).id},getTrackingType:function(){return st(r)[t]},renewObservable:i}}var at=/^([a-z]+)=([a-z0-9-]+)$/,ut="&";function st(e){var t=function(e){var t=e.get(),n={};(function(e){return void 0!==e&&(-1!==e.indexOf(ut)||at.test(e))})(t)&&t.split(ut).forEach((function(e){var t=at.exec(e);if(null!==t){var r=t[1],i=t[2];n[r]=i}}));return n}(e);return function(e){return(void 0===e.created||Date.now()-Number(e.created)<rt)&&(void 0===e.expire||Date.now()<Number(e.expire))}(t)?t:(ft(e),{})}function ct(e,t){if(n=e,0!==Object.keys(n).length){var n;e.expire=String(Date.now()+nt);var r=L(e).map((function(e){return e[0]+"="+e[1]})).join(ut);t.set(r,nt)}else ft(t)}function ft(e){e.set("",0)}var dt=[];var lt=rt,pt=5*f,mt=f;var Et=2*f;function vt(e){var t=function(e){var t=e.querySelector("meta[name=dd-trace-id]"),n=e.querySelector("meta[name=dd-trace-time]");return ht(t&&t.content,n&&n.content)}(e)||function(e){var t=function(e){for(var t=0;t<e.childNodes.length;t+=1){if(n=Tt(e.childNodes[t]))return n}if(e.body)for(t=e.body.childNodes.length-1;t>=0;t-=1){var n,r=e.body.childNodes[t];if(n=Tt(r))return n;if(!gt(r))break}}(e);if(!t)return;return ht(N(t,"trace-id"),N(t,"trace-time"))}(e);if(t&&!(t.traceTime<=Date.now()-Et))return t.traceId}function ht(e,t){var n=t&&Number(t);if(e&&n)return{traceId:e,traceTime:n}}function Tt(e){if(e&&function(e){return"#comment"===e.nodeName}(e)){var t=e.data.match(/^\s*DATADOG;(.*?)\s*$/);if(t)return t[1]}}function gt(e){return"#text"===e.nodeName}var bt="initial_document",yt=[[u.DOCUMENT,function(e){return bt===e}],[u.XHR,function(e){return"xmlhttprequest"===e}],[u.FETCH,function(e){return"fetch"===e}],[u.BEACON,function(e){return"beacon"===e}],[u.CSS,function(e,t){return null!==t.match(/\.css$/i)}],[u.JS,function(e,t){return null!==t.match(/\.js$/i)}],[u.IMAGE,function(e,t){return S(["image","img","icon"],e)||null!==t.match(/\.(gif|jpg|jpeg|tiff|png|svg|ico)$/i)}],[u.FONT,function(e,t){return null!==t.match(/\.(woff|eot|woff2|ttf)$/i)}],[u.MEDIA,function(e,t){return S(["audio","video"],e)||null!==t.match(/\.(mp3|mp4)$/i)}]];function Ct(e){var t=e.name;if(!function(e){try{return!!W(e)}catch(e){return!1}}(t))return se('Failed to construct URL for "'+e.name+'"'),u.OTHER;for(var n=F(t),r=0,i=yt;r<i.length;r++){var o=i[r],a=o[0];if((0,o[1])(e.initiatorType,n))return a}return u.OTHER}function Ot(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=1;n<e.length;n+=1)if(e[n-1]>e[n])return!1;return!0}function _t(e){var t=e.duration,n=e.startTime,r=e.responseEnd;return y(0===t&&n<r?r-n:t)}function Rt(e){var t=e.startTime,n=e.fetchStart,r=e.domainLookupStart,i=e.domainLookupEnd,o=e.connectStart,a=e.secureConnectionStart,u=e.connectEnd,s=e.requestStart,c=e.responseStart,f=e.responseEnd,d=e.redirectStart,l=e.redirectEnd;if(Ot(t,n,r,i,o,u,s,c,f)){var p=n!==t;if(!p||(d<t&&(d=t),l<t&&(l=n),Ot(t,d,l,n))){var m={download:St(t,c,f),firstByte:St(t,s,c)};return u!==n&&(m.connect=St(t,o,u),Ot(o,a,u)&&(m.ssl=St(t,a,u))),i!==n&&(m.dns=St(t,r,i)),p&&(m.redirect=St(t,d,l)),m}}}function St(e,t,n){return{duration:y(n-t),start:y(t-e)}}function wt(e){if(e.startTime<e.responseStart)return e.decodedBodySize}function It(e,t){return t&&!G(t,e)}function At(){return void 0!==window.performance&&"getEntries"in performance}function Dt(){return window.PerformanceObserver&&void 0!==PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.includes("navigation")}function Lt(e,t){var n;if(n=function(n){Ut(e,t,n)},xt("interactive",(function(){var e,t={entryType:"resource",initiatorType:bt,traceId:vt(document)};if(Dt()&&performance.getEntriesByType("navigation").length>0){var i=performance.getEntriesByType("navigation")[0];e=r(r({},i.toJSON()),t)}else{var o=Nt();e=r(r(r({},o),{decodedBodySize:0,duration:o.responseEnd,name:window.location.href,startTime:0}),t)}n(e)})),At()&&Mt(e,t,performance.getEntries()),window.PerformanceObserver){var i=new PerformanceObserver(ue((function(n){return Mt(e,t,n.getEntries())}))),o=["resource","navigation","longtask"];"visible"===document.visibilityState&&o.push("paint"),i.observe({entryTypes:o}),At()&&"addEventListener"in performance&&performance.addEventListener("resourcetimingbufferfull",(function(){performance.clearResourceTimings()}))}Dt()||function(e){function t(){e(r(r({},Nt()),{entryType:"navigation"}))}xt("complete",(function(){setTimeout(ue(t))}))}((function(n){Ut(e,t,n)}))}function xt(e,t){if(document.readyState===e||"complete"===document.readyState)t();else{var n="complete"===e?a.LOAD:a.DOM_CONTENT_LOADED,r=ue((function(){window.removeEventListener(n,r),t()}));window.addEventListener(n,r)}}function Nt(){var e={},t=performance.timing;for(var n in t)I(t[n])&&(e[n]=0===t[n]?0:t[n]-D());return e}function Mt(e,t,n){n.forEach((function(n){"resource"!==n.entryType&&"navigation"!==n.entryType&&"paint"!==n.entryType&&"longtask"!==n.entryType||Ut(e,t,n)}))}function Ut(e,t,n){(function(e){return"navigation"===e.entryType&&e.loadEventEnd<=0})(n)||function(e,t){return"resource"===t.entryType&&!It(e,t.name)}(t,n)||e.notify(He.PERFORMANCE_ENTRY_COLLECTED,n)}function kt(e,t,n){if(void 0!==Bt()&&function(e,t){for(var n=j(t),r=0,i=e.allowedTracingOrigins;r<i.length;r++){var o=i[r];if(n===o||o instanceof RegExp&&o.test(n))return!0}return!1}(e,t)){var r=new Pt,i=new Pt;return n(function(e,t){return{"x-datadog-origin":"rum","x-datadog-parent-id":t.toDecimalString(),"x-datadog-sampled":"1","x-datadog-sampling-priority":"1","x-datadog-trace-id":e.toDecimalString()}}(r,i)),{traceId:r,spanId:i}}}function Bt(){return window.crypto||window.msCrypto}var Pt=function(){function e(){this.buffer=new Uint8Array(8),Bt().getRandomValues(this.buffer),this.buffer[0]=127&this.buffer[0]}return e.prototype.toString=function(e){for(var t=this.readInt32(0),n=this.readInt32(4),r="";;){var i=t%e*4294967296+n;if(t=Math.floor(t/e),n=Math.floor(i/e),r=(i%e).toString(e)+r,!t&&!n)break}return r},e.prototype.toDecimalString=function(){return this.toString(10)},e.prototype.readInt32=function(e){return 16777216*this.buffer[e]+(this.buffer[e+1]<<16)+(this.buffer[e+2]<<8)+this.buffer[e+3]},e}(),Ht=1;function jt(e,t){var n=function(e){return{traceFetch:function(t){return kt(e,t.url,(function(e){t.init=r({},t.init);var n=[];t.init.headers instanceof Headers?t.init.headers.forEach((function(e,t){n.push([t,e])})):Array.isArray(t.init.headers)?t.init.headers.forEach((function(e){n.push(e)})):t.init.headers&&Object.keys(t.init.headers).forEach((function(e){n.push([e,t.init.headers[e]])})),t.init.headers=n.concat(L(e))}))},traceXhr:function(t,n){return kt(e,t.url,(function(e){Object.keys(e).forEach((function(t){n.setRequestHeader(t,e[t])}))}))}}}(t);!function(e,t,n){var r=Ie();r.beforeSend((function(r,i){if(It(t,r.url)){var o=n.traceXhr(r,i);o&&(r.traceId=o.traceId,r.spanId=o.spanId),r.requestIndex=Ft(),e.notify(He.REQUEST_STARTED,{requestIndex:r.requestIndex})}})),r.onRequestComplete((function(n){It(t,n.url)&&e.notify(He.REQUEST_COMPLETED,{duration:n.duration,method:n.method,requestIndex:n.requestIndex,response:n.response,spanId:n.spanId,startTime:n.startTime,status:n.status,traceId:n.traceId,type:s.XHR,url:n.url})}))}(e,t,n),function(e,t,n){var r=Ee();r.beforeSend((function(r){if(It(t,r.url)){var i=n.traceFetch(r);i&&(r.traceId=i.traceId,r.spanId=i.spanId),r.requestIndex=Ft(),e.notify(He.REQUEST_STARTED,{requestIndex:r.requestIndex})}})),r.onRequestComplete((function(n){It(t,n.url)&&e.notify(He.REQUEST_COMPLETED,{duration:n.duration,method:n.method,requestIndex:n.requestIndex,response:n.response,responseType:n.responseType,spanId:n.spanId,startTime:n.startTime,status:n.status,traceId:n.traceId,type:s.FETCH,url:n.url})}))}(e,t,n)}function Ft(){var e=Ht;return Ht+=1,e}var Wt,Vt="rum";function qt(e,t){var n=ot(e.cookieOptions,Vt,(function(t){return function(e,t){var n;n=function(e){return e===Wt.NOT_TRACKED||e===Wt.TRACKED_WITH_RESOURCES||e===Wt.TRACKED_WITHOUT_RESOURCES}(t)?t:b(e.sampleRate)?b(e.resourceSampleRate)?Wt.TRACKED_WITH_RESOURCES:Wt.TRACKED_WITHOUT_RESOURCES:Wt.NOT_TRACKED;return{trackingType:n,isTracked:zt(n)}}(e,t)}));return n.renewObservable.subscribe((function(){t.notify(He.SESSION_RENEWED)})),{getId:n.getId,isTracked:function(){return void 0!==n.getId()&&zt(n.getTrackingType())},isTrackedWithResource:function(){return void 0!==n.getId()&&n.getTrackingType()===Wt.TRACKED_WITH_RESOURCES}}}function zt(e){return e===Wt.TRACKED_WITH_RESOURCES||e===Wt.TRACKED_WITHOUT_RESOURCES}function Gt(e){return function(e){var t;if(function(){void 0===Yt&&(Yt="closest"in HTMLElement.prototype);return Yt}())t=e.closest("["+Kt+"]");else for(var n=e;n;){if(n.hasAttribute(Kt)){t=n;break}n=n.parentElement}if(!t)return;return nn(tn(t.getAttribute(Kt).trim()))}(e)||en(e,Jt)||en(e,Qt)||""}!function(e){e.NOT_TRACKED="0",e.TRACKED_WITH_RESOURCES="1",e.TRACKED_WITHOUT_RESOURCES="2"}(Wt||(Wt={}));var Kt="data-dd-action-name";var $t,Xt,Yt,Jt=[function(e){if(function(){void 0===Xt&&(Xt="labels"in HTMLInputElement.prototype);return Xt}()){if("labels"in e&&e.labels&&e.labels.length>0)return rn(e.labels[0])}else if(e.id){var t=e.ownerDocument&&e.ownerDocument.querySelector('label[for="'+e.id.replace('"','\\"')+'"]');return t&&rn(t)}},function(e){if("INPUT"===e.nodeName){var t=e,n=t.getAttribute("type");if("button"===n||"submit"===n||"reset"===n)return t.value}},function(e){if("BUTTON"===e.nodeName||"LABEL"===e.nodeName||"button"===e.getAttribute("role"))return rn(e)},function(e){return e.getAttribute("aria-label")},function(e){var t=e.getAttribute("aria-labelledby");if(t)return t.split(/\s+/).map((function(t){return function(e,t){return e.ownerDocument?e.ownerDocument.getElementById(t):null}(e,t)})).filter((function(e){return Boolean(e)})).map(rn).join(" ")},function(e){return e.getAttribute("alt")},function(e){return e.getAttribute("name")},function(e){return e.getAttribute("title")},function(e){return e.getAttribute("placeholder")},function(e){if("options"in e&&e.options.length>0)return rn(e.options[0])}],Qt=[function(e){return rn(e)}],Zt=10;function en(e,t){for(var n=e,r=0;r<=Zt&&n&&"BODY"!==n.nodeName&&"HTML"!==n.nodeName&&"HEAD"!==n.nodeName;){for(var i=0,o=t;i<o.length;i++){var a=(0,o[i])(n);if("string"==typeof a){var u=a.trim();if(u)return nn(tn(u))}}if("FORM"===n.nodeName)break;n=n.parentElement,r+=1}}function tn(e){return e.replace(/\s+/g," ")}function nn(e){return e.length>100?(n=100,((r=(t=e).charCodeAt(n-1))>=55296&&r<=56319?t.slice(0,n+1):t.slice(0,n))+" [...]"):e;var t,n,r}function rn(e){if(!e.isContentEditable){if("innerText"in e){var t=e.innerText;if(!function(){if(void 0===$t){var e=document.createElement("style");e.textContent="*";var t=document.createElement("div");t.appendChild(e),document.body.appendChild(t),$t=""===t.innerText,document.body.removeChild(t)}return $t}())for(var n=e.querySelectorAll("script, style"),r=0;r<n.length;r+=1){var i=n[r].innerText;i.trim().length>0&&(t=t.replace(i,""))}return t}return e.textContent}}function on(e,t){void 0===t&&(t=O);var n={errorCount:0,longTaskCount:0,resourceCount:0,userActionCount:0},r=[];return r.push(e.subscribe(He.ERROR_COLLECTED,(function(){n.errorCount+=1,t(n)}))),r.push(e.subscribe(He.AUTO_ACTION_COMPLETED,(function(){n.userActionCount+=1,t(n)}))),r.push(e.subscribe(He.CUSTOM_ACTION_COLLECTED,(function(){n.userActionCount+=1,t(n)}))),r.push(e.subscribe(He.PERFORMANCE_ENTRY_COLLECTED,(function(e){"longtask"===e.entryType&&(n.longTaskCount+=1,t(n))}))),r.push(e.subscribe(He.RESOURCE_ADDED_TO_BATCH,(function(){n.resourceCount+=1,t(n)}))),{stop:function(){r.forEach((function(e){return e.unsubscribe()}))},eventCounts:n}}var an,un=100,sn=100,cn=1e4;function fn(e,t){var n=function(e){var t,n=new Re,r=[],i=0;function o(){n.notify({isBusy:i>0})}return r.push(e.subscribe(He.DOM_MUTATED,(function(){return o()}))),r.push(e.subscribe(He.PERFORMANCE_ENTRY_COLLECTED,(function(e){"resource"===e.entryType&&o()}))),r.push(e.subscribe(He.REQUEST_STARTED,(function(e){void 0===t&&(t=e.requestIndex),i+=1,o()}))),r.push(e.subscribe(He.REQUEST_COMPLETED,(function(e){void 0===t||e.requestIndex<t||(i-=1,o())}))),{observable:n,stop:function(){r.forEach((function(e){return e.unsubscribe()}))}}}(e),r=n.observable,i=n.stop,o=function(e,t,n){var r,i=!1,o=setTimeout(ue((function(){return s(!1,0)})),un),a=setTimeout(ue((function(){return s(!0,performance.now())})),cn);function u(){i=!0,clearTimeout(o),clearTimeout(r),clearTimeout(a),t()}function s(e,t){i||(u(),n(e,t))}return e.subscribe((function(e){var t=e.isBusy;clearTimeout(o),clearTimeout(r);var n=performance.now();t||(r=setTimeout(ue((function(){return s(!0,n)})),sn))})),{stop:u}}(r,i,t).stop;return{stop:function(){o(),i()}}}function dn(e){var t=function(e){var t,n;return{create:function(r,i){if(!t){var o=new pn(e,r,i);t=o,n=fn(e,(function(e,n){e?o.complete(n):o.discard(),t=void 0}))}},discardCurrent:function(){t&&(n.stop(),t.discard(),t=void 0)}}}(e);function n(e){if(e.target instanceof Element){var n=Gt(e.target);n&&t.create(an.CLICK,n)}}return e.subscribe(He.VIEW_CREATED,(function(){t.discardCurrent()})),addEventListener(a.CLICK,n,{capture:!0}),{stop:function(){t.discardCurrent(),removeEventListener(a.CLICK,n,{capture:!0})}}}!function(e){e.CLICK="click",e.CUSTOM="custom"}(an||(an={}));var ln,pn=function(){function e(e,t,n){this.lifeCycle=e,this.type=t,this.name=n,this.id=g(),this.startTime=performance.now(),this.eventCountsSubscription=on(e),this.lifeCycle.notify(He.AUTO_ACTION_CREATED,{id:this.id,startTime:this.startTime})}return e.prototype.complete=function(e){var t=this.eventCountsSubscription.eventCounts;this.lifeCycle.notify(He.AUTO_ACTION_COMPLETED,{duration:e-this.startTime,id:this.id,measures:{errorCount:t.errorCount,longTaskCount:t.longTaskCount,resourceCount:t.resourceCount},name:this.name,startTime:this.startTime,type:this.type}),this.eventCountsSubscription.stop()},e.prototype.discard=function(){this.lifeCycle.notify(He.AUTO_ACTION_DISCARDED),this.eventCountsSubscription.stop()},e}();!function(e){e.INITIAL_LOAD="initial_load",e.ROUTE_CHANGE="route_change"}(ln||(ln={}));var mn,En=3e3,vn=5*f;function hn(e,t){var n,i=Tn(t,e,ln.INITIAL_LOAD,document.referrer,0),o=i,u=function(e,t){var n;return{stop:e.subscribe(He.PERFORMANCE_ENTRY_COLLECTED,(function(e){"navigation"===e.entryType?(n=r(r({},n),{domComplete:e.domComplete,domContentLoaded:e.domContentLoadedEventEnd,domInteractive:e.domInteractive,loadEventEnd:e.loadEventEnd}),t(n)):"paint"===e.entryType&&"first-contentful-paint"===e.name&&(n=r(r({},n),{firstContentfulPaint:e.startTime}),t(n))})).unsubscribe}}(t,(function(e){i.updateTimings(e),i.scheduleUpdate()})).stop;function s(){o.isDifferentView(e)?(o.triggerUpdate(),o.end(),o=Tn(t,e,ln.ROUTE_CHANGE,o.url)):(o.updateLocation(e),o.triggerUpdate())}!function(e){var t=history.pushState;history.pushState=ue((function(){t.apply(this,arguments),e()}));var n=history.replaceState;history.replaceState=ue((function(){n.apply(this,arguments),e()})),window.addEventListener(a.POP_STATE,ue(e))}(s),n=s,window.addEventListener("hashchange",ue(n)),t.subscribe(He.SESSION_RENEWED,(function(){o.end(),o=Tn(t,e,ln.ROUTE_CHANGE,o.url)})),t.subscribe(He.BEFORE_UNLOAD,(function(){o.triggerUpdate(),o.end()}));var c=window.setInterval(ue((function(){o.triggerUpdate()})),vn);return{stop:function(){u(),o.end(),clearInterval(c)}}}function Tn(e,t,n,i,o){void 0===o&&(o=performance.now());var a,u,s,c=g(),f={errorCount:0,longTaskCount:0,resourceCount:0,userActionCount:0},d=0,p=r({},t);e.notify(He.VIEW_CREATED,{id:c,startTime:o,location:p,referrer:i});var m=l(ue(O),En,{leading:!1}),E=m.throttled,v=m.cancel,h=on(e,(function(e){f=e,E()})).stop,T=function(e,t){var n=e===ln.INITIAL_LOAD,r=!0,i=[];function o(){!r&&!n&&i.length>0&&t(Math.max.apply(Math,i))}return{setLoadEventEnd:function(e){n&&(n=!1,i.push(e),o())},setActivityLoadingTime:function(e){r&&(r=!1,void 0!==e&&i.push(e),o())}}}(n,(function(e){u=e,E()})),b=T.setActivityLoadingTime,y=T.setLoadEventEnd,C=function(e,t){var n=performance.now();return{stop:fn(e,(function(e,r){t(e?r-n:void 0)})).stop}}(e,b).stop;function O(){d+=1,e.notify(He.VIEW_UPDATED,{documentVersion:d,id:c,loadingTime:u,loadingType:n,location:p,referrer:i,startTime:o,duration:(void 0===s?performance.now():s)-o,measures:r(r({},a),f)})}return(O(),{scheduleUpdate:E,end:function(){s=performance.now(),h(),C()},isDifferentView:function(e){return p.pathname!==e.pathname||(t=e.hash,n=t.substr(1),!document.getElementById(n)&&e.hash!==p.hash);var t,n},triggerUpdate:function(){v(),O()},updateTimings:function(e){a=e,void 0!==e.loadEventEnd&&y(e.loadEventEnd)},updateLocation:function(e){p=r({},e)},get url(){return p.href}})}!function(e){e.USER_ACTION="user_action",e.ERROR="error",e.LONG_TASK="long_task",e.VIEW="view",e.RESOURCE="resource"}(mn||(mn={}));var gn,bn,yn,Cn,On=_n((function(e,t){var n=new Ve,i=ke(e,Ge,!0),o=i.errorObservable,a=i.configuration,c=i.internalMonitoring,f=qt(a,n);c.setExternalContextProvider((function(){return h({application_id:e.applicationId},d.findView(),t())}));var d=function(e,t,n,i,o,a){var c=function(e,t){var n,r,i,o=[],a=[];e.subscribe(He.VIEW_CREATED,(function(e){n&&o.unshift({context:c(),endTime:e.startTime,startTime:n.startTime}),n=e,i=t.getId()})),e.subscribe(He.VIEW_UPDATED,(function(e){n.id===e.id&&(n=e)})),e.subscribe(He.AUTO_ACTION_CREATED,(function(e){r=e})),e.subscribe(He.AUTO_ACTION_COMPLETED,(function(e){r&&a.unshift({context:f(),endTime:r.startTime+e.duration,startTime:r.startTime}),r=void 0})),e.subscribe(He.AUTO_ACTION_DISCARDED,(function(){r=void 0})),e.subscribe(He.SESSION_RENEWED,(function(){o=[],a=[],n=void 0,r=void 0}));var u=window.setInterval(ue((function(){s(o,lt),s(a,pt)})),mt);function s(e,t){for(var n=performance.now()-t;e.length>0&&e[e.length-1].startTime<n;)e.pop()}function c(){return{sessionId:i,view:{id:n.id,referrer:n.referrer,url:n.location.href}}}function f(){return{userAction:{id:r.id}}}function d(e,t,n,r){if(void 0===r)return n?e():void 0;if(n&&r>=n.startTime)return e();for(var i=0,o=t;i<o.length;i++){var a=o[i];if(r>a.endTime)break;if(r>=a.startTime)return a.context}}return{findAction:function(e){return d(f,a,r,e)},findView:function(e){return d(c,o,n,e)},stop:function(){window.clearInterval(u)}}}(n,o),f=ze(i,n);return qe(e,i,n,o,c,a),function(e,t){var n=function(t,n,r,i){return e.notify(He.RAW_RUM_EVENT_COLLECTED,{customerContext:i,rawRumEvent:n,savedGlobalContext:r,startTime:t})};(function(e,t){e.subscribe(He.VIEW_UPDATED,(function(e){t(e.startTime,{date:A(e.startTime),duration:y(e.duration),evt:{category:mn.VIEW},rum:{documentVersion:e.documentVersion},view:{loadingTime:y(e.loadingTime),loadingType:e.loadingType,measures:r(r({},e.measures),{domComplete:y(e.measures.domComplete),domContentLoaded:y(e.measures.domContentLoaded),domInteractive:y(e.measures.domInteractive),firstContentfulPaint:y(e.measures.firstContentfulPaint),loadEventEnd:y(e.measures.loadEventEnd)})}})}))})(e,n),function(e,t){e.subscribe(He.ERROR_COLLECTED,(function(e){var n=e.message,i=e.startTime,o=e.context;t(i,r({message:n,date:A(i),evt:{category:mn.ERROR}},o))}))}(e,n),function(e,t,n){e.subscribe(He.REQUEST_COMPLETED,(function(r){if(t.isTrackedWithResource()){var i=$e(r),o=r.type===s.XHR?u.XHR:u.FETCH,a=i?i.startTime:r.startTime,c=r.traceId&&r.spanId;n(a,{_dd:c?{spanId:r.spanId.toDecimalString(),traceId:r.traceId.toDecimalString()}:void 0,date:A(a),duration:i?_t(i):y(r.duration),evt:{category:mn.RESOURCE},http:{method:r.method,performance:i?Rt(i):void 0,statusCode:r.status,url:r.url},network:{bytesWritten:i?wt(i):void 0},resource:{kind:o,id:c?g():void 0}}),e.notify(He.RESOURCE_ADDED_TO_BATCH)}}))}(e,t,n),function(e,t,n){e.subscribe(He.PERFORMANCE_ENTRY_COLLECTED,(function(r){"resource"===r.entryType&&function(e,t,n,r){if(!t.isTrackedWithResource())return;var i=Ct(r);if(S([u.XHR,u.FETCH],i))return;n(r.startTime,{_dd:r.traceId?{traceId:r.traceId}:void 0,date:A(r.startTime),duration:_t(r),evt:{category:mn.RESOURCE},http:{performance:Rt(r),url:r.name},network:{bytesWritten:wt(r)},resource:{kind:i}}),e.notify(He.RESOURCE_ADDED_TO_BATCH)}(e,t,n,r)}))}(e,t,n),function(e,t){e.subscribe(He.CUSTOM_ACTION_COLLECTED,(function(e){var n=e.action,r=n.name,i=n.type,o=n.context,a=n.startTime,u=e.context;t(a,{date:A(a),evt:{name:r,category:mn.USER_ACTION},userAction:{type:i}},u,o)}))}(e,n),function(e,t){e.subscribe(He.AUTO_ACTION_COMPLETED,(function(e){t(e.startTime,{date:A(e.startTime),duration:y(e.duration),evt:{category:mn.USER_ACTION,name:e.name},userAction:{id:e.id,measures:e.measures,type:e.type}})}))}(e,n)}(n,o),function(e){e.subscribe(He.PERFORMANCE_ENTRY_COLLECTED,(function(t){if("longtask"===t.entryType){var n={date:A(t.startTime),duration:y(t.duration),evt:{category:mn.LONG_TASK}};e.notify(He.RAW_RUM_EVENT_COLLECTED,{rawRumEvent:n,startTime:t.startTime})}}))}(n),hn(t,n),{parentContexts:c,stop:function(){f.stop()}}}(e.applicationId,location,n,a,f,t).parentContexts;return jt(n,a),Lt(n,a),Ke(n),a.trackInteractions&&dn(n),o.subscribe((function(e){return n.notify(He.ERROR_COLLECTED,e)})),{getInternalContext:function(t){return function(e,t,n,r){var i=e.findView(r);if(n.isTracked()&&i&&i.sessionId)return C(h({applicationId:t},i,e.findAction(r)))}(d,e.applicationId,f,t)},addUserAction:function(e,t){n.notify(He.CUSTOM_ACTION_COLLECTED,{action:e,context:t})}}}));function _n(e){var t,n=!1,i=(t={},{get:function(){return t},add:function(e,n){t[e]=n},remove:function(e){delete t[e]},set:function(e){t=e}}),o=function(){},a=new Fe,u=function(e){a.add([e,T(i.get())])};return function(e){var t=r(r({},e),{onReady:function(e){e()}});return Object.defineProperty(t,"_setDebug",{get:function(){return de},enumerable:!1}),t}({init:ue((function(t){var r;Be(q(t))&&Pe()&&function(e){if(n)return e.silentMultipleInit||console.error("DD_RUM is already initialized."),!1;if(!e||!e.clientToken&&!e.publicApiKey)return console.error("Client Token is not configured, we will not send any data."),!1;if(!e.applicationId)return console.error("Application ID is not configured, no RUM data will be collected."),!1;if(void 0!==e.sampleRate&&!w(e.sampleRate))return console.error("Sample Rate should be a number between 0 and 100"),!1;if(void 0!==e.resourceSampleRate&&!w(e.resourceSampleRate))return console.error("Resource Sample Rate should be a number between 0 and 100"),!1;if(Array.isArray(e.allowedTracingOrigins)&&0!==e.allowedTracingOrigins.length&&void 0===e.service)return console.error("Service need to be configured when tracing is enabled"),!1;return!0}(t)&&(t.publicApiKey&&(t.clientToken=t.publicApiKey),r=e(t,i.get),o=r.getInternalContext,u=r.addUserAction,a.drain((function(e){var t=e[0],n=e[1];return u(t,n)})),n=!0)})),addRumGlobalContext:ue(i.add),removeRumGlobalContext:ue(i.remove),setRumGlobalContext:ue(i.set),getInternalContext:ue((function(e){return o(e)})),addUserAction:ue((function(e,t){u({name:e,context:T(t),startTime:performance.now(),type:an.CUSTOM})}))})}gn=function(){if("object"==typeof globalThis)return globalThis;Object.defineProperty(Object.prototype,"_dd_temp_",{get:function(){return this},configurable:!0});var e=_dd_temp_;return delete Object.prototype._dd_temp_,"object"!=typeof e&&(e="object"==typeof self?self:"object"==typeof window?window:{}),e}(),yn=On,Cn=gn[bn="DD_RUM"],gn[bn]=yn,Cn&&Cn.q&&Cn.q.forEach((function(e){return e()}))}]);
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([,function(e,t,n){"use strict";n.r(t),n.d(t,"datadogRum",(function(){return wn})),n.d(t,"makeRumGlobal",(function(){return An}));var r=function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function i(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}}function o(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],a=0,u=o.length;a<u;a++,i++)r[i]=o[a];return r}var a,u,s,c=1e3,f=60*c,d=60*f;function l(e,t,n){var r,i=!n||void 0===n.leading||n.leading,o=!n||void 0===n.trailing||n.trailing,a=!1,u=!1;return{throttled:function(){var n=this;a?u=!0:(i?e.apply(this):u=!0,a=!0,r=window.setTimeout((function(){o&&u&&e.apply(n),a=!1,u=!1}),t))},cancel:function(){window.clearTimeout(r),a=!1,u=!1}}}!function(e){e.BEFORE_UNLOAD="beforeunload",e.CLICK="click",e.KEY_DOWN="keydown",e.LOAD="load",e.POP_STATE="popstate",e.SCROLL="scroll",e.TOUCH_START="touchstart",e.VISIBILITY_CHANGE="visibilitychange",e.DOM_CONTENT_LOADED="DOMContentLoaded"}(a||(a={})),function(e){e.DOCUMENT="document",e.XHR="xhr",e.BEACON="beacon",e.FETCH="fetch",e.CSS="css",e.JS="js",e.IMAGE="image",e.FONT="font",e.MEDIA="media",e.OTHER="other"}(u||(u={})),function(e){e.FETCH="fetch",e.XHR="xhr"}(s||(s={}));var p,E=function(e){return Array.isArray(e)},m=function(e){return!Array.isArray(e)&&"object"==typeof e&&null!==e};function v(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=t.length-1;r>=0;r-=1){var i=t[r];if(void 0!==i){if(void 0===e)if(m(i))e={};else{if(!E(i)){e=i;break}e=[]}if(m(e)&&m(i))for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=v(i[o],e[o]));else{if(!E(e)||!E(i))break;e.length=Math.max(e.length,i.length);for(var a=0;a<i.length;a+=1)e[a]=v(i[a],e[a])}}}return e}function h(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return v.apply(void 0,o([e],t.filter((function(e){return null!==e}))))}function T(e){return v(e)}function g(e){return e?(parseInt(e,10)^16*Math.random()>>parseInt(e,10)/4).toString(16):(1e7+"-1000-4000-8000-100000000000").replace(/[018]/g,g)}function b(e){return 0!==e&&100*Math.random()<=e}function y(e){return"number"!=typeof e?e:+(1e6*e).toFixed(0)}function C(e){var t={};return Object.keys(e).forEach((function(n){var r;t[(r=n,r.replace(/[A-Z]/g,(function(e,t){return(0!==t?"_":"")+e.toLowerCase()})).replace(/-/g,"_"))]=function e(t){if(Array.isArray(t))return t.map((function(t){return e(t)}));if("object"==typeof t&&null!==t)return C(t);return t}(e[n])})),t}function O(){}function _(e,t,n){if(null==e)return JSON.stringify(e);var r=[!1,void 0];R(e)&&(r=[!0,e.toJSON],delete e.toJSON);var i,o,a=[!1,void 0];"object"==typeof e&&R(i=Object.getPrototypeOf(e))&&(a=[!0,i.toJSON],delete i.toJSON);try{o=JSON.stringify(e,void 0,n)}catch(e){o="<error: unable to serialize object>"}finally{r[0]&&(e.toJSON=r[1]),a[0]&&(i.toJSON=a[1])}return o}function R(e){return"object"==typeof e&&null!==e&&e.hasOwnProperty("toJSON")}function S(e,t){return-1!==e.indexOf(t)}function w(e){return A(e)&&e>=0&&e<=100}function A(e){return"number"==typeof e}function I(e){return Math.floor(L()+e)}function L(){return void 0===p&&(p=performance.timing.navigationStart),p}function D(e){return Object.keys(e).map((function(t){return[t,e[t]]}))}function N(e){if(e.origin)return e.origin;var t=e.host.replace(/(:80|:443)$/,"");return e.protocol+"//"+t}function x(e,t){var n=e.match("(?:^|;)\\s*"+t+"\\s*=\\s*([^;]+)");return n?n[1]:void 0}var M,U,k=c;function B(e,t,n,r){var i=new Date;i.setTime(i.getTime()+n);var o="expires="+i.toUTCString(),a=r&&r.crossSite?"none":"strict",u=r&&r.domain?";domain="+r.domain:"",s=r&&r.secure?";secure":"";document.cookie=e+"="+t+";"+o+";path=/;samesite="+a+u+s}function P(e){return x(document.cookie,e)}function H(e){return F(e,N(window.location)).href}function V(e,t){return W(e)===W(t)}function W(e){return N(F(e))}function j(e){var t=F(e).pathname;return"/"===t[0]?t:"/"+t}function F(e,t){if(function(){if(void 0!==U)return U;try{var e=new URL("http://test/path");return U="http://test/path"===e.href}catch(e){U=!1}return U}())return void 0!==t?new URL(e,t):new URL(e);if(void 0===t&&!/:/.test(e))throw new Error("Invalid URL: '"+e+"'");var n=document,r=n.createElement("a");if(void 0!==t){var i=(n=document.implementation.createHTMLDocument("")).createElement("base");i.href=t,n.head.appendChild(i),n.body.appendChild(r)}return r.href=e,r}var q={allowedTracingOrigins:[],maxErrorsByMinute:3e3,maxInternalMonitoringMessagesPerPage:15,resourceSampleRate:100,sampleRate:100,silentMultipleInit:!1,trackInteractions:!1,requestErrorResponseLengthLimit:32768,flushTimeout:30*c,maxBatchSize:50,maxMessageSize:262144,batchBytesLimit:16384};function G(e){var t={};return t.secure=function(e){return!!e.useSecureSessionCookie||!!e.useCrossSiteSessionCookie}(e),t.crossSite=!!e.useCrossSiteSessionCookie,e.trackSessionAcrossSubdomains&&(t.domain=function(){if(void 0===M){for(var e="dd_site_test_"+g(),t=window.location.hostname.split("."),n=t.pop();t.length&&!P(e);)n=t.pop()+"."+n,B(e,"test",c,{domain:n});M=n}return M}()),t}function z(e,t,n){var r="sdk_version:"+t.sdkVersion+(t.env?",env:"+t.env:"")+(t.service?",service:"+t.service:"")+(t.version?",version:"+t.version:""),i=e+"-http-intake.logs."+t.site,o=t.proxyHost?t.proxyHost:i,a=t.proxyHost?"ddhost="+i+"&":"",u=""+(t.applicationId?"_dd.application_id="+t.applicationId+"&":"")+a+"ddsource="+(n||"browser")+"&ddtags="+r;return"https://"+o+"/v1/input/"+t.clientToken+"?"+u}function K(e,t){return-1!==j(e).indexOf("/v1/input/")&&(V(e,t.logsEndpoint)||V(e,t.rumEndpoint)||V(e,t.traceEndpoint)||!!t.internalMonitoringEndpoint&&V(e,t.internalMonitoringEndpoint)||!!t.replica&&(V(e,t.replica.logsEndpoint)||V(e,t.replica.rumEndpoint)||V(e,t.replica.internalMonitoringEndpoint)))}var $="?",Y=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;function X(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var J=function(){var e,t,n,r,i,o,a=[];function u(e,t,n){var r;for(var i in a)if(X(a,i))try{a[i](e,t,n)}catch(e){r=e}if(r)throw r}function s(e,r,i,o,a){if(t)Q.augmentStackTraceWithInitialElement(t,r,i,""+e),f();else if(a)u(Q(a),!0,a);else{var s,c={url:r,column:o,line:i},d=e;if("[object String]"==={}.toString.call(e)){var l=d.match(Y);l&&(s=l[1],d=l[2])}u({name:s,message:d,stack:[c]},!0)}return!!n&&n.apply(this,arguments)}function c(e){var t=e.reason||"Empty reason";u(Q(t),!0,t)}function f(){var n=t,r=e;t=void 0,e=void 0,u(n,!1,r)}function d(n){if(t){if(e===n)return;f()}var r=Q(n);throw t=r,e=n,setTimeout((function(){e===n&&f()}),r.incomplete?2e3:0),n}return d.subscribe=function(e){!function(){if(r)return;n=window.onerror,window.onerror=se(s),r=!0}(),function(){if(o)return;i=null!==window.onunhandledrejection?window.onunhandledrejection:void 0,window.onunhandledrejection=se(c),o=!0}(),a.push(e)},d.unsubscribe=function(e){for(var t=a.length-1;t>=0;t-=1)a[t]===e&&a.splice(t,1);0===a.length&&(r&&(window.onerror=n,r=!1),o&&(window.onunhandledrejection=i,o=!1))},d.traceKitWindowOnError=s,d}(),Q=function(){var e=!1;function t(e){if(e.stack){for(var t,n,r,i,o=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,a=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,u=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,s=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,c=/\((\S*)(?::(\d+))(?::(\d+))\)/,f=e.stack.split("\n"),d=[],l=0,p=f.length;l<p;l+=1){if(o.exec(f[l])){var E=(r=o.exec(f[l]))[2]&&0===r[2].indexOf("native");t=r[2]&&0===r[2].indexOf("eval"),n=c.exec(r[2]),t&&n&&(r[2]=n[1],r[3]=n[2],r[4]=n[3]),i={args:E?[r[2]]:[],column:r[4]?+r[4]:void 0,func:r[1]||$,line:r[3]?+r[3]:void 0,url:E?void 0:r[2]}}else if(u.exec(f[l]))i={args:[],column:(r=u.exec(f[l]))[4]?+r[4]:void 0,func:r[1]||$,line:+r[3],url:r[2]};else{if(!a.exec(f[l]))continue;t=(r=a.exec(f[l]))[3]&&r[3].indexOf(" > eval")>-1,n=s.exec(r[3]),t&&n?(r[3]=n[1],r[4]=n[2],r[5]=void 0):0!==l||r[5]||void 0===e.columnNumber||(d[0].column=e.columnNumber+1),i={args:r[2]?r[2].split(","):[],column:r[5]?+r[5]:void 0,func:r[1]||$,line:r[4]?+r[4]:void 0,url:r[3]}}!i.func&&i.line&&(i.func=$),d.push(i)}if(d.length)return{stack:d,message:e.message,name:e.name}}}function n(e,t,n,r){var i={url:t,line:n?+n:void 0};if(i.url&&i.line){e.incomplete=!1;var o=e.stack;if(o.length>0&&o[0].url===i.url){if(o[0].line===i.line)return!1;if(!o[0].line&&o[0].func===i.func)return o[0].line=i.line,o[0].context=i.context,!1}return o.unshift(i),e.partial=!0,!0}return e.incomplete=!0,!1}function r(e,t){for(var i,o,a=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,u=[],s={},c=!1,f=r.caller;f&&!c;f=f.caller)f!==Q&&f!==J&&(o={args:[],column:void 0,func:$,line:void 0,url:void 0},i=a.exec(f.toString()),f.name?o.func=f.name:i&&(o.func=i[1]),void 0===o.func&&(o.func=i?i.input.substring(0,i.input.indexOf("{")):void 0),s[""+f]?c=!0:s[""+f]=!0,u.push(o));t&&u.splice(0,t);var d={stack:u,message:e.message,name:e.name};return n(d,e.sourceURL||e.fileName,e.line||e.lineNumber,e.message||e.description),d}function i(n,i){var o,a=void 0===i?0:+i;try{if(o=function(e){var t=e.stacktrace;if(t){for(var n,r=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,i=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^\)]+))\((.*)\))? in (.*):\s*$/i,o=t.split("\n"),a=[],u=0;u<o.length;u+=2){var s=void 0;r.exec(o[u])?s={args:[],column:void 0,func:(n=r.exec(o[u]))[3],line:+n[1],url:n[2]}:i.exec(o[u])&&(s={args:(n=i.exec(o[u]))[5]?n[5].split(","):[],column:+n[2],func:n[3]||n[4],line:+n[1],url:n[6]}),s&&(!s.func&&s.line&&(s.func=$),s.context=[o[u+1]],a.push(s))}if(a.length)return{stack:a,message:e.message,name:e.name}}}(n))return o}catch(t){if(e)throw t}try{if(o=t(n))return o}catch(t){if(e)throw t}try{if(o=function(e){var t=e.message.split("\n");if(!(t.length<4)){var n,r=/^\s*Line (\d+) of linked script ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,i=/^\s*Line (\d+) of inline#(\d+) script in ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,o=/^\s*Line (\d+) of function script\s*$/i,a=[],u=window&&window.document&&window.document.getElementsByTagName("script"),s=[];for(var c in u)X(u,c)&&!u[c].src&&s.push(u[c]);for(var f=2;f<t.length;f+=2){var d=void 0;if(r.exec(t[f]))d={args:[],column:void 0,func:(n=r.exec(t[f]))[3],line:+n[1],url:n[2]};else if(i.exec(t[f]))d={args:[],column:void 0,func:(n=i.exec(t[f]))[4],line:+n[1],url:n[3]};else if(o.exec(t[f])){n=o.exec(t[f]),d={url:window.location.href.replace(/#.*$/,""),args:[],column:void 0,func:"",line:+n[1]}}d&&(d.func||(d.func=$),d.context=[t[f+1]],a.push(d))}if(a.length)return{stack:a,message:t[0],name:e.name}}}(n))return o}catch(t){if(e)throw t}try{if(o=r(n,a+1))return o}catch(t){if(e)throw t}return{message:n.message,name:n.name,stack:[]}}return i.augmentStackTraceWithInitialElement=n,i.computeStackTraceFromStackProp=t,i.ofCaller=function(e){var t=1+(void 0===e?0:+e);try{throw new Error}catch(e){return Q(e,t+1)}},i}();var Z=/[^\u0000-\u007F]/,ee=function(){function e(e,t,n){void 0===n&&(n=!1),this.endpointUrl=e,this.bytesLimit=t,this.withBatchTime=n}return e.prototype.send=function(e,t){var n=this.withBatchTime?function(e){return e+(-1===e.indexOf("?")?"?":"&")+"batch_time="+(new Date).getTime()}(this.endpointUrl):this.endpointUrl;if(navigator.sendBeacon&&t<this.bytesLimit&&navigator.sendBeacon(n,e))return;var r=new XMLHttpRequest;r.open("POST",n,!0),r.send(e)},e}();var te,ne=function(){function e(e,t,n,r,i,o){void 0===o&&(o=O),this.request=e,this.maxSize=t,this.bytesLimit=n,this.maxMessageSize=r,this.flushTimeout=i,this.beforeUnloadCallback=o,this.pushOnlyBuffer=[],this.upsertBuffer={},this.bufferBytesSize=0,this.bufferMessageCount=0,this.flushOnVisibilityHidden(),this.flushPeriodically()}return e.prototype.add=function(e){this.addOrUpdate(e)},e.prototype.upsert=function(e,t){this.addOrUpdate(e,t)},e.prototype.flush=function(){if(0!==this.bufferMessageCount){var e=o(this.pushOnlyBuffer,(t=this.upsertBuffer,n=[],Object.keys(t).forEach((function(e){n.push(t[e])})),n));this.request.send(e.join("\n"),this.bufferBytesSize),this.pushOnlyBuffer=[],this.upsertBuffer={},this.bufferBytesSize=0,this.bufferMessageCount=0}var t,n},e.prototype.sizeInBytes=function(e){return Z.test(e)?void 0!==window.TextEncoder?(new TextEncoder).encode(e).length:new Blob([e]).size:e.length},e.prototype.addOrUpdate=function(e,t){var n=this.process(e),r=n.processedMessage,i=n.messageBytesSize;i>=this.maxMessageSize?console.warn("Discarded a message whose size was bigger than the maximum allowed size "+this.maxMessageSize+"KB."):(this.hasMessageFor(t)&&this.remove(t),this.willReachedBytesLimitWith(i)&&this.flush(),this.push(r,i,t),this.isFull()&&this.flush())},e.prototype.process=function(e){var t=_(e);return{processedMessage:t,messageBytesSize:this.sizeInBytes(t)}},e.prototype.push=function(e,t,n){this.bufferMessageCount>0&&(this.bufferBytesSize+=1),void 0!==n?this.upsertBuffer[n]=e:this.pushOnlyBuffer.push(e),this.bufferBytesSize+=t,this.bufferMessageCount+=1},e.prototype.remove=function(e){var t=this.upsertBuffer[e];delete this.upsertBuffer[e];var n=this.sizeInBytes(t);this.bufferBytesSize-=n,this.bufferMessageCount-=1,this.bufferMessageCount>0&&(this.bufferBytesSize-=1)},e.prototype.hasMessageFor=function(e){return void 0!==e&&void 0!==this.upsertBuffer[e]},e.prototype.willReachedBytesLimitWith=function(e){return this.bufferBytesSize+e+1>=this.bytesLimit},e.prototype.isFull=function(){return this.bufferMessageCount===this.maxSize||this.bufferBytesSize>=this.bytesLimit},e.prototype.flushPeriodically=function(){var e=this;setTimeout((function(){e.flush(),e.flushPeriodically()}),this.flushTimeout)},e.prototype.flushOnVisibilityHidden=function(){var e=this;navigator.sendBeacon&&(window.addEventListener(a.BEFORE_UNLOAD,se(this.beforeUnloadCallback)),document.addEventListener(a.VISIBILITY_CHANGE,se((function(){"hidden"===document.visibilityState&&e.flush()}))),window.addEventListener(a.BEFORE_UNLOAD,se((function(){return e.flush()}))))},e}();!function(e){e.info="info",e.error="error"}(te||(te={}));var re,ie,oe,ae={maxMessagesPerPage:0,sentMessageCount:0};function ue(e){if(e.internalMonitoringEndpoint){var t=function(e){var t,n=r(e.internalMonitoringEndpoint);void 0!==e.replica&&(t=r(e.replica.internalMonitoringEndpoint));function r(t){return new ne(new ee(t,e.batchBytesLimit),e.maxBatchSize,e.batchBytesLimit,e.maxMessageSize,e.flushTimeout)}return{add:function(e){var r=function(e){return h({date:(new Date).getTime(),view:{referrer:document.referrer,url:window.location.href}},void 0!==re?re():{},e)}(e);n.add(r),t&&t.add(r)}}}(e);!function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];t.forEach((function(t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}))}(ae,{batch:t,maxMessagesPerPage:e.maxInternalMonitoringMessagesPerPage,sentMessageCount:0})}return{setExternalContextProvider:function(e){re=e}}}function se(e){return function(){try{return e.apply(this,arguments)}catch(e){pe(e);try{fe(e)}catch(e){pe(e)}}}}function ce(e,t){!function(e){ae.debugMode&&console.log("[MONITORING MESSAGE]",e)}(e),de(r(r({message:e},t),{status:te.info}))}function fe(e){de(r(r({},function(e){if(e instanceof Error){var t=Q(e);return{error:{kind:t.name,stack:Ne(t)},message:t.message}}return{error:{stack:"Not an instance of error"},message:"Uncaught "+_(e)}}(e)),{status:te.error}))}function de(e){ae.batch&&ae.sentMessageCount<ae.maxMessagesPerPage&&(ae.sentMessageCount+=1,ae.batch.add(e))}function le(e){ae.debugMode=e}function pe(e){ae.debugMode&&console.warn("[INTERNAL ERROR]",e)}var Ee=[],me=[];function ve(){return ie||(!function(){if(!window.fetch)return;oe=window.fetch,window.fetch=se((function(e,t){var n=this,r=t&&t.method||"object"==typeof e&&e.method||"GET",o=H("object"==typeof e&&e.url||e),a={init:t,method:r,startTime:performance.now(),url:o},u=function(e){return t=n,r=void 0,u=function(){var t,n;return i(this,(function(r){switch(r.label){case 0:return a.duration=performance.now()-a.startTime,"stack"in e||e instanceof Error?(a.status=0,a.response=Ne(Q(e)),me.forEach((function(e){return e(a)})),[3,6]):[3,1];case 1:if(!("status"in e))return[3,6];t=void 0,r.label=2;case 2:return r.trys.push([2,4,,5]),[4,e.clone().text()];case 3:return t=r.sent(),[3,5];case 4:return n=r.sent(),t="Unable to retrieve response: "+n,[3,5];case 5:a.response=t,a.responseType=e.type,a.status=e.status,me.forEach((function(e){return e(a)})),r.label=6;case 6:return[2]}}))},new((o=void 0)||(o=Promise))((function(e,n){function i(e){try{s(u.next(e))}catch(e){n(e)}}function a(e){try{s(u.throw(e))}catch(e){n(e)}}function s(t){t.done?e(t.value):new o((function(e){e(t.value)})).then(i,a)}s((u=u.apply(t,r||[])).next())}));var t,r,o,u};Ee.forEach((function(e){return e(a)}));var s=oe.call(this,e,a.init);return s.then(se(u),se(u)),s}))}(),ie={beforeSend:function(e){Ee.push(e)},onRequestComplete:function(e){me.push(e)}}),ie}var he,Te,ge,be,ye,Ce,Oe,_e,Re,Se=function(){function e(){this.observers=[]}return e.prototype.subscribe=function(e){this.observers.push(e)},e.prototype.notify=function(e){this.observers.forEach((function(t){return t(e)}))},e}(),we=[],Ae=[];function Ie(){return he||(Te=XMLHttpRequest.prototype.open,ge=XMLHttpRequest.prototype.send,XMLHttpRequest.prototype.open=se((function(e,t){return this._datadog_xhr={method:e,startTime:-1,url:H(t)},Te.apply(this,arguments)})),XMLHttpRequest.prototype.send=se((function(e){var t=this;if(this._datadog_xhr){this._datadog_xhr.startTime=performance.now();var n=this.onreadystatechange;this.onreadystatechange=function(){this.readyState===XMLHttpRequest.DONE&&se(i)(),n&&n.apply(this,arguments)};var r=!1,i=function(){r||(r=!0,t._datadog_xhr.duration=performance.now()-t._datadog_xhr.startTime,t._datadog_xhr.response=t.response,t._datadog_xhr.status=t.status,Ae.forEach((function(e){return e(t._datadog_xhr)})))};this.addEventListener("loadend",se(i)),we.forEach((function(e){return e(t._datadog_xhr,t)}))}return ge.apply(this,arguments)})),he={beforeSend:function(e){we.push(e)},onRequestComplete:function(e){Ae.push(e)}}),he}function Le(e){if(!ye){var t=new Se;!function(e,t){function n(n,r){K(r.url,e)||!function(e){return 0===e.status&&"opaque"!==e.responseType}(r)&&!function(e){return e.status>=500}(r)||t.notify({context:{error:{origin:be.NETWORK,stack:xe(r.response,e)||"Failed to load"},http:{method:r.method,status_code:r.status,url:r.url}},message:Me(n)+" error "+r.method+" "+r.url,startTime:r.startTime})}Ie().onRequestComplete((function(e){return n(s.XHR,e)})),ve().onRequestComplete((function(e){return n(s.FETCH,e)}))}(e,t),function(e){Ce=console.error,console.error=se((function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];Ce.apply(console,o([t],n)),e.notify({context:{error:{origin:be.CONSOLE}},message:o(["console error:",t],n).map(De).join(" "),startTime:performance.now()})}))}(t),function(e){Oe=function(t,n,r){e.notify(function(e,t){var n,r;void 0!==e.message||t instanceof Error?(n=e.message||"Empty message",r=Ne(e)):(n="Uncaught "+_(t),r="No stack, consider using an instance of Error");return{message:n,context:{error:{stack:r,kind:e.name,origin:be.SOURCE}},startTime:performance.now()}}(t,r))},J.subscribe(Oe)}(t),ye=function(e,t){var n=0,r=new Se;return t.subscribe((function(t){n<e.maxErrorsByMinute?(n+=1,r.notify(t)):n===e.maxErrorsByMinute&&(n+=1,r.notify({context:{error:{origin:be.AGENT}},message:"Reached max number of errors by minute: "+e.maxErrorsByMinute,startTime:performance.now()}))})),setInterval((function(){return n=0}),f),r}(e,t)}return ye}function De(e){return"string"==typeof e?e:e instanceof Error?Ne(Q(e)):_(e,0,2)}function Ne(e){var t=(e.name||"Error")+": "+e.message;return e.stack.forEach((function(e){var n="?"===e.func?"<anonymous>":e.func,r=e.args&&e.args.length>0?"("+e.args.join(", ")+")":"",i=e.line?":"+e.line:"",o=e.line&&e.column?":"+e.column:"";t+="\n at "+n+r+" @ "+e.url+i+o})),t}function xe(e,t){return e&&e.length>t.requestErrorResponseLengthLimit?e.substring(0,t.requestErrorResponseLengthLimit)+"...":e}function Me(e){return s.XHR===e?"XHR":"Fetch"}!function(e){e.AGENT="agent",e.CONSOLE="console",e.NETWORK="network",e.SOURCE="source",e.LOGGER="logger"}(be||(be={})),function(e){e.US="us",e.EU="eu"}(Re||(Re={}));var Ue,ke=((_e={})[Re.EU]="datadoghq.eu",_e[Re.US]="datadoghq.com",_e);function Be(e,t,n){var i=function(e,t){var n={applicationId:e.applicationId,buildMode:t.buildMode,clientToken:e.clientToken,env:e.env,proxyHost:e.proxyHost,sdkVersion:t.sdkVersion,service:e.service,site:e.site||ke[e.datacenter||t.datacenter],version:e.version},i=Array.isArray(e.enableExperimentalFeatures)?e.enableExperimentalFeatures:[],o=r({cookieOptions:G(e),isEnabled:function(e){return S(i,e)},logsEndpoint:z("browser",n),proxyHost:e.proxyHost,rumEndpoint:z("rum",n),service:e.service,traceEndpoint:z("public-trace",n)},q);if(e.internalMonitoringApiKey&&(o.internalMonitoringEndpoint=z("browser",n,"browser-agent-internal-monitoring")),"allowedTracingOrigins"in e&&(o.allowedTracingOrigins=e.allowedTracingOrigins),"sampleRate"in e&&(o.sampleRate=e.sampleRate),"resourceSampleRate"in e&&(o.resourceSampleRate=e.resourceSampleRate),"trackInteractions"in e&&(o.trackInteractions=!!e.trackInteractions),n.buildMode===Ue.E2E_TEST&&(o.internalMonitoringEndpoint="<<< E2E INTERNAL MONITORING ENDPOINT >>>",o.logsEndpoint="<<< E2E LOGS ENDPOINT >>>",o.rumEndpoint="<<< E2E RUM ENDPOINT >>>"),n.buildMode===Ue.STAGING&&void 0!==e.replica){var a=r(r({},n),{applicationId:e.replica.applicationId,clientToken:e.replica.clientToken,site:ke[Re.US]});o.replica={applicationId:e.replica.applicationId,internalMonitoringEndpoint:z("browser",a,"browser-agent-internal-monitoring"),logsEndpoint:z("browser",a),rumEndpoint:z("rum",a)}}return o}(e,t),o=ue(i);return{configuration:i,errorObservable:n?Le(i):new Se,internalMonitoring:o}}function Pe(e){return!!function(e){if(void 0===document.cookie||null===document.cookie)return!1;try{var t="dd_cookie_test_"+g();return B(t,"test",c,e),"test"===P(t)}catch(e){return console.error(e),!1}}(e)||(console.warn("Cookies are not authorized, we will not send any data."),!1)}function He(){return"file:"!==window.location.protocol||(console.error("Execution is not allowed in the current context."),!1)}!function(e){e.RELEASE="release",e.STAGING="staging",e.E2E_TEST="e2e-test"}(Ue||(Ue={}));var Ve,We=1e4,je=function(){function e(e){void 0===e&&(e=We),this.limit=e,this.buffer=[]}return e.prototype.add=function(e){this.buffer.push(e)>this.limit&&this.buffer.splice(0,1)},e.prototype.drain=function(e){this.buffer.forEach((function(t){return e(t)})),this.buffer.length=0},e}();!function(e){e[e.ERROR_COLLECTED=0]="ERROR_COLLECTED",e[e.PERFORMANCE_ENTRY_COLLECTED=1]="PERFORMANCE_ENTRY_COLLECTED",e[e.CUSTOM_ACTION_COLLECTED=2]="CUSTOM_ACTION_COLLECTED",e[e.AUTO_ACTION_CREATED=3]="AUTO_ACTION_CREATED",e[e.AUTO_ACTION_COMPLETED=4]="AUTO_ACTION_COMPLETED",e[e.AUTO_ACTION_DISCARDED=5]="AUTO_ACTION_DISCARDED",e[e.VIEW_CREATED=6]="VIEW_CREATED",e[e.VIEW_UPDATED=7]="VIEW_UPDATED",e[e.REQUEST_STARTED=8]="REQUEST_STARTED",e[e.REQUEST_COMPLETED=9]="REQUEST_COMPLETED",e[e.SESSION_RENEWED=10]="SESSION_RENEWED",e[e.RESOURCE_ADDED_TO_BATCH=11]="RESOURCE_ADDED_TO_BATCH",e[e.DOM_MUTATED=12]="DOM_MUTATED",e[e.BEFORE_UNLOAD=13]="BEFORE_UNLOAD",e[e.RAW_RUM_EVENT_COLLECTED=14]="RAW_RUM_EVENT_COLLECTED",e[e.RAW_RUM_EVENT_V2_COLLECTED=15]="RAW_RUM_EVENT_V2_COLLECTED",e[e.RUM_EVENT_COLLECTED=16]="RUM_EVENT_COLLECTED",e[e.RUM_EVENT_V2_COLLECTED=17]="RUM_EVENT_V2_COLLECTED"}(Ve||(Ve={}));var Fe,qe,Ge,ze,Ke=function(){function e(){this.callbacks={}}return e.prototype.notify=function(e,t){var n=this.callbacks[e];n&&n.forEach((function(e){return e(t)}))},e.prototype.subscribe=function(e,t){var n=this;return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),{unsubscribe:function(){n.callbacks[e]=n.callbacks[e].filter((function(e){return t!==e}))}}},e}();function $e(e,t,n,r,i,o){n.subscribe(Ve.RAW_RUM_EVENT_COLLECTED,(function(a){var u,s=a.startTime,c=a.rawRumEvent,f=a.savedGlobalContext,d=a.customerContext,l=i.findView(s);if(r.isTracked()&&l&&l.sessionId){var p=i.findAction(s),E={applicationId:e,date:(new Date).getTime(),service:t.service,session:{type:void 0===window._DATADOG_SYNTHETICS_BROWSER?qe.USER:qe.SYNTHETICS}},m=(u=c,-1!==[Fe.ERROR,Fe.RESOURCE,Fe.LONG_TASK].indexOf(u.evt.category)?h(E,l,p,c):h(E,l,c)),v=h(f||o(),d,C(m));n.notify(Ve.RUM_EVENT_COLLECTED,{rumEvent:m,serverRumEvent:v})}}))}function Ye(e,t,n,r,i,o){n.subscribe(Ve.RAW_RUM_EVENT_V2_COLLECTED,(function(a){var u,s=a.startTime,c=a.rawRumEvent,f=a.savedGlobalContext,d=a.customerContext,l=i.findViewV2(s);if(r.isTracked()&&l&&l.session.id){var p=i.findActionV2(s),E={_dd:{formatVersion:2},application:{id:e},date:(new Date).getTime(),service:t.service,session:{type:void 0===window._DATADOG_SYNTHETICS_BROWSER?ze.USER:ze.SYNTHETICS}},m=(u=c,-1!==[Ge.ERROR,Ge.RESOURCE,Ge.LONG_TASK].indexOf(u.type)?h(E,l,p,c):h(E,l,c)),v=h(f||o(),d,C(m));n.notify(Ve.RUM_EVENT_V2_COLLECTED,{rumEvent:m,serverRumEvent:v})}}))}function Xe(e,t){var n=function(e,t){var n,r=o(e.rumEndpoint,(function(){return t.notify(Ve.BEFORE_UNLOAD)})),i=e.replica;void 0!==i&&(n=o(i.rumEndpoint));function o(t,n){return new ne(new ee(t,e.batchBytesLimit,!0),e.maxBatchSize,e.batchBytesLimit,e.maxMessageSize,e.flushTimeout,n)}function a(e){return h(e,{application_id:i.applicationId})}var u=!1;return{add:function(e){u||(r.add(e),n&&n.add(a(e)))},stop:function(){u=!0},upsert:function(e,t){u||(r.upsert(e,t),n&&n.upsert(a(e),t))}}}(e,t);return t.subscribe(Ve.RUM_EVENT_COLLECTED,(function(e){var t=e.rumEvent,r=e.serverRumEvent;t.evt.category===Fe.VIEW?n.upsert(r,t.view.id):n.add(r)})),t.subscribe(Ve.RUM_EVENT_V2_COLLECTED,(function(e){var t=e.rumEvent,r=e.serverRumEvent;t.type===Ge.VIEW?n.upsert(r,t.view.id):n.add(r)})),{stop:function(){n.stop()}}}!function(e){e.USER_ACTION="user_action",e.ERROR="error",e.LONG_TASK="long_task",e.VIEW="view",e.RESOURCE="resource"}(Fe||(Fe={})),function(e){e.SYNTHETICS="synthetics",e.USER="user"}(qe||(qe={})),function(e){e.ACTION="action",e.ERROR="error",e.LONG_TASK="long_task",e.VIEW="view",e.RESOURCE="resource"}(Ge||(Ge={})),function(e){e.SYNTHETICS="synthetics",e.USER="user"}(ze||(ze={}));var Je={buildMode:"release",datacenter:"us",sdkVersion:"1.24.1"};function Qe(e){var t,n=function(){var e,t=window;if(t.Zone){var n=t.Zone.__symbol__("MutationObserver");e=t[n]}return e||(e=t.MutationObserver),e}();return n&&(t=new n(se((function(){e.notify(Ve.DOM_MUTATED)})))).observe(document.documentElement,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),{stop:function(){t&&t.disconnect()}}}function Ze(e){if(performance&&"getEntriesByName"in performance){var t,n=performance.getEntriesByName(e.url,"resource").filter((function(t){return n=t,r=e.startTime,i=et(e),n.startTime>=r&&et(n)<=i;var n,r,i}));return 1===n.length?n[0]:2===n.length&&et((t=n)[0])<=t[1].startTime?n[1]:void 0}}function et(e){return e.startTime+e.duration}var tt="_dd",nt="_dd_r",rt="_dd_l",it="rum",ot="logs";var at="_dd_s",ut=15*f,st=4*d,ct=f;function ft(e,t,n){var r=function(e,t){var n,r,i=!1,o=function(){i=!0,window.clearTimeout(n),n=window.setTimeout((function(){i=!1}),k)};return{get:function(){return i?r:(r=P(e),o(),r)},set:function(n,i){B(e,n,i,t),r=n,o()}}}(at,e);!function(e){var t=e.get(),n=P(tt),r=P(nt),i=P(rt);if(!t){var o={};n&&(o.id=n),i&&/^[01]$/.test(i)&&(o[ot]=i),r&&/^[012]$/.test(r)&&(o[it]=r),Et(o,e)}}(r);var i=new Se,o=pt(r).id,u=l((function(){var e=pt(r),a=n(e[t]),u=a.trackingType,s=a.isTracked;e[t]=u,s&&!e.id&&(e.id=g(),e.created=String(Date.now())),Et(e,r),s&&o!==e.id&&(o=e.id,i.notify())}),k).throttled;return u(),function(e){var t=se(e),n={capture:!0,passive:!0};[a.CLICK,a.TOUCH_START,a.KEY_DOWN,a.SCROLL].forEach((function(e){document.addEventListener(e,t,n),vt.push((function(){return document.removeEventListener(e,t,n)}))}))}(u),function(e){var t=se((function(){"visible"===document.visibilityState&&e()})),n=window.setInterval(t,ct);document.addEventListener(a.VISIBILITY_CHANGE,t),vt.push((function(){clearInterval(n),document.removeEventListener(a.VISIBILITY_CHANGE,t)}))}((function(){Et(pt(r),r)})),{getId:function(){return pt(r).id},getTrackingType:function(){return pt(r)[t]},renewObservable:i}}var dt=/^([a-z]+)=([a-z0-9-]+)$/,lt="&";function pt(e){var t=function(e){var t=e.get(),n={};(function(e){return void 0!==e&&(-1!==e.indexOf(lt)||dt.test(e))})(t)&&t.split(lt).forEach((function(e){var t=dt.exec(e);if(null!==t){var r=t[1],i=t[2];n[r]=i}}));return n}(e);return function(e){return(void 0===e.created||Date.now()-Number(e.created)<st)&&(void 0===e.expire||Date.now()<Number(e.expire))}(t)?t:(mt(e),{})}function Et(e,t){if(n=e,0!==Object.keys(n).length){var n;e.expire=String(Date.now()+ut);var r=D(e).map((function(e){return e[0]+"="+e[1]})).join(lt);t.set(r,ut)}else mt(t)}function mt(e){e.set("",0)}var vt=[];var ht=st,Tt=5*f,gt=f;var bt=2*f;function yt(e){var t=function(e){var t=e.querySelector("meta[name=dd-trace-id]"),n=e.querySelector("meta[name=dd-trace-time]");return Ct(t&&t.content,n&&n.content)}(e)||function(e){var t=function(e){for(var t=0;t<e.childNodes.length;t+=1){if(n=Ot(e.childNodes[t]))return n}if(e.body)for(t=e.body.childNodes.length-1;t>=0;t-=1){var n,r=e.body.childNodes[t];if(n=Ot(r))return n;if(!_t(r))break}}(e);if(!t)return;return Ct(x(t,"trace-id"),x(t,"trace-time"))}(e);if(t&&!(t.traceTime<=Date.now()-bt))return t.traceId}function Ct(e,t){var n=t&&Number(t);if(e&&n)return{traceId:e,traceTime:n}}function Ot(e){if(e&&function(e){return"#comment"===e.nodeName}(e)){var t=e.data.match(/^\s*DATADOG;(.*?)\s*$/);if(t)return t[1]}}function _t(e){return"#text"===e.nodeName}var Rt="initial_document",St=[[u.DOCUMENT,function(e){return Rt===e}],[u.XHR,function(e){return"xmlhttprequest"===e}],[u.FETCH,function(e){return"fetch"===e}],[u.BEACON,function(e){return"beacon"===e}],[u.CSS,function(e,t){return null!==t.match(/\.css$/i)}],[u.JS,function(e,t){return null!==t.match(/\.js$/i)}],[u.IMAGE,function(e,t){return S(["image","img","icon"],e)||null!==t.match(/\.(gif|jpg|jpeg|tiff|png|svg|ico)$/i)}],[u.FONT,function(e,t){return null!==t.match(/\.(woff|eot|woff2|ttf)$/i)}],[u.MEDIA,function(e,t){return S(["audio","video"],e)||null!==t.match(/\.(mp3|mp4)$/i)}]];function wt(e){var t=e.name;if(!function(e){try{return!!F(e)}catch(e){return!1}}(t))return ce('Failed to construct URL for "'+e.name+'"'),u.OTHER;for(var n=j(t),r=0,i=St;r<i.length;r++){var o=i[r],a=o[0];if((0,o[1])(e.initiatorType,n))return a}return u.OTHER}function At(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=1;n<e.length;n+=1)if(e[n-1]>e[n])return!1;return!0}function It(e){var t=e.duration,n=e.startTime,r=e.responseEnd;return y(0===t&&n<r?r-n:t)}function Lt(e){var t=e.startTime,n=e.fetchStart,r=e.domainLookupStart,i=e.domainLookupEnd,o=e.connectStart,a=e.secureConnectionStart,u=e.connectEnd,s=e.requestStart,c=e.responseStart,f=e.responseEnd,d=e.redirectStart,l=e.redirectEnd;if(At(t,n,r,i,o,u,s,c,f)){var p=n!==t;if(!p||(d<t&&(d=t),l<t&&(l=n),At(t,d,l,n))){var E={download:Dt(t,c,f),firstByte:Dt(t,s,c)};return u!==n&&(E.connect=Dt(t,o,u),At(o,a,u)&&(E.ssl=Dt(t,a,u))),i!==n&&(E.dns=Dt(t,r,i)),p&&(E.redirect=Dt(t,d,l)),E}}}function Dt(e,t,n){return{duration:y(n-t),start:y(t-e)}}function Nt(e){if(e.startTime<e.responseStart)return e.decodedBodySize}function xt(e,t){return t&&!K(t,e)}function Mt(){return void 0!==window.performance&&"getEntries"in performance}function Ut(){return window.PerformanceObserver&&void 0!==PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.includes("navigation")}function kt(e,t){var n;if(n=function(n){Vt(e,t,n)},Bt("interactive",(function(){var e,t={entryType:"resource",initiatorType:Rt,traceId:yt(document)};if(Ut()&&performance.getEntriesByType("navigation").length>0){var i=performance.getEntriesByType("navigation")[0];e=r(r({},i.toJSON()),t)}else{var o=Pt();e=r(r(r({},o),{decodedBodySize:0,duration:o.responseEnd,name:window.location.href,startTime:0}),t)}n(e)})),Mt()&&Ht(e,t,performance.getEntries()),window.PerformanceObserver){var i=new PerformanceObserver(se((function(n){return Ht(e,t,n.getEntries())}))),o=["resource","navigation","longtask"];"visible"===document.visibilityState&&o.push("paint"),i.observe({entryTypes:o}),Mt()&&"addEventListener"in performance&&performance.addEventListener("resourcetimingbufferfull",(function(){performance.clearResourceTimings()}))}Ut()||function(e){function t(){e(r(r({},Pt()),{entryType:"navigation"}))}Bt("complete",(function(){setTimeout(se(t))}))}((function(n){Vt(e,t,n)}))}function Bt(e,t){if(document.readyState===e||"complete"===document.readyState)t();else{var n="complete"===e?a.LOAD:a.DOM_CONTENT_LOADED,r=se((function(){window.removeEventListener(n,r),t()}));window.addEventListener(n,r)}}function Pt(){var e={},t=performance.timing;for(var n in t)A(t[n])&&(e[n]=0===t[n]?0:t[n]-L());return e}function Ht(e,t,n){n.forEach((function(n){"resource"!==n.entryType&&"navigation"!==n.entryType&&"paint"!==n.entryType&&"longtask"!==n.entryType||Vt(e,t,n)}))}function Vt(e,t,n){(function(e){return"navigation"===e.entryType&&e.loadEventEnd<=0})(n)||function(e,t){return"resource"===t.entryType&&!xt(e,t.name)}(t,n)||e.notify(Ve.PERFORMANCE_ENTRY_COLLECTED,n)}function Wt(e,t,n){if(void 0!==jt()&&function(e,t){for(var n=W(t),r=0,i=e.allowedTracingOrigins;r<i.length;r++){var o=i[r];if(n===o||o instanceof RegExp&&o.test(n))return!0}return!1}(e,t)){var r=new Ft,i=new Ft;return n(function(e,t){return{"x-datadog-origin":"rum","x-datadog-parent-id":t.toDecimalString(),"x-datadog-sampled":"1","x-datadog-sampling-priority":"1","x-datadog-trace-id":e.toDecimalString()}}(r,i)),{traceId:r,spanId:i}}}function jt(){return window.crypto||window.msCrypto}var Ft=function(){function e(){this.buffer=new Uint8Array(8),jt().getRandomValues(this.buffer),this.buffer[0]=127&this.buffer[0]}return e.prototype.toString=function(e){for(var t=this.readInt32(0),n=this.readInt32(4),r="";;){var i=t%e*4294967296+n;if(t=Math.floor(t/e),n=Math.floor(i/e),r=(i%e).toString(e)+r,!t&&!n)break}return r},e.prototype.toDecimalString=function(){return this.toString(10)},e.prototype.readInt32=function(e){return 16777216*this.buffer[e]+(this.buffer[e+1]<<16)+(this.buffer[e+2]<<8)+this.buffer[e+3]},e}(),qt=1;function Gt(e,t){var n=function(e){return{traceFetch:function(t){return Wt(e,t.url,(function(e){t.init=r({},t.init);var n=[];t.init.headers instanceof Headers?t.init.headers.forEach((function(e,t){n.push([t,e])})):Array.isArray(t.init.headers)?t.init.headers.forEach((function(e){n.push(e)})):t.init.headers&&Object.keys(t.init.headers).forEach((function(e){n.push([e,t.init.headers[e]])})),t.init.headers=n.concat(D(e))}))},traceXhr:function(t,n){return Wt(e,t.url,(function(e){Object.keys(e).forEach((function(t){n.setRequestHeader(t,e[t])}))}))}}}(t);!function(e,t,n){var r=Ie();r.beforeSend((function(r,i){if(xt(t,r.url)){var o=n.traceXhr(r,i);o&&(r.traceId=o.traceId,r.spanId=o.spanId),r.requestIndex=zt(),e.notify(Ve.REQUEST_STARTED,{requestIndex:r.requestIndex})}})),r.onRequestComplete((function(n){xt(t,n.url)&&e.notify(Ve.REQUEST_COMPLETED,{duration:n.duration,method:n.method,requestIndex:n.requestIndex,response:n.response,spanId:n.spanId,startTime:n.startTime,status:n.status,traceId:n.traceId,type:s.XHR,url:n.url})}))}(e,t,n),function(e,t,n){var r=ve();r.beforeSend((function(r){if(xt(t,r.url)){var i=n.traceFetch(r);i&&(r.traceId=i.traceId,r.spanId=i.spanId),r.requestIndex=zt(),e.notify(Ve.REQUEST_STARTED,{requestIndex:r.requestIndex})}})),r.onRequestComplete((function(n){xt(t,n.url)&&e.notify(Ve.REQUEST_COMPLETED,{duration:n.duration,method:n.method,requestIndex:n.requestIndex,response:n.response,responseType:n.responseType,spanId:n.spanId,startTime:n.startTime,status:n.status,traceId:n.traceId,type:s.FETCH,url:n.url})}))}(e,t,n)}function zt(){var e=qt;return qt+=1,e}var Kt,$t="rum";function Yt(e,t){var n=ft(e.cookieOptions,$t,(function(t){return function(e,t){var n;n=function(e){return e===Kt.NOT_TRACKED||e===Kt.TRACKED_WITH_RESOURCES||e===Kt.TRACKED_WITHOUT_RESOURCES}(t)?t:b(e.sampleRate)?b(e.resourceSampleRate)?Kt.TRACKED_WITH_RESOURCES:Kt.TRACKED_WITHOUT_RESOURCES:Kt.NOT_TRACKED;return{trackingType:n,isTracked:Xt(n)}}(e,t)}));return n.renewObservable.subscribe((function(){t.notify(Ve.SESSION_RENEWED)})),{getId:n.getId,isTracked:function(){return void 0!==n.getId()&&Xt(n.getTrackingType())},isTrackedWithResource:function(){return void 0!==n.getId()&&n.getTrackingType()===Kt.TRACKED_WITH_RESOURCES}}}function Xt(e){return e===Kt.TRACKED_WITH_RESOURCES||e===Kt.TRACKED_WITHOUT_RESOURCES}function Jt(e){return function(e){var t;if(function(){void 0===tn&&(tn="closest"in HTMLElement.prototype);return tn}())t=e.closest("["+Qt+"]");else for(var n=e;n;){if(n.hasAttribute(Qt)){t=n;break}n=n.parentElement}if(!t)return;return sn(un(t.getAttribute(Qt).trim()))}(e)||an(e,nn)||an(e,rn)||""}!function(e){e.NOT_TRACKED="0",e.TRACKED_WITH_RESOURCES="1",e.TRACKED_WITHOUT_RESOURCES="2"}(Kt||(Kt={}));var Qt="data-dd-action-name";var Zt,en,tn,nn=[function(e){if(function(){void 0===en&&(en="labels"in HTMLInputElement.prototype);return en}()){if("labels"in e&&e.labels&&e.labels.length>0)return cn(e.labels[0])}else if(e.id){var t=e.ownerDocument&&e.ownerDocument.querySelector('label[for="'+e.id.replace('"','\\"')+'"]');return t&&cn(t)}},function(e){if("INPUT"===e.nodeName){var t=e,n=t.getAttribute("type");if("button"===n||"submit"===n||"reset"===n)return t.value}},function(e){if("BUTTON"===e.nodeName||"LABEL"===e.nodeName||"button"===e.getAttribute("role"))return cn(e)},function(e){return e.getAttribute("aria-label")},function(e){var t=e.getAttribute("aria-labelledby");if(t)return t.split(/\s+/).map((function(t){return function(e,t){return e.ownerDocument?e.ownerDocument.getElementById(t):null}(e,t)})).filter((function(e){return Boolean(e)})).map(cn).join(" ")},function(e){return e.getAttribute("alt")},function(e){return e.getAttribute("name")},function(e){return e.getAttribute("title")},function(e){return e.getAttribute("placeholder")},function(e){if("options"in e&&e.options.length>0)return cn(e.options[0])}],rn=[function(e){return cn(e)}],on=10;function an(e,t){for(var n=e,r=0;r<=on&&n&&"BODY"!==n.nodeName&&"HTML"!==n.nodeName&&"HEAD"!==n.nodeName;){for(var i=0,o=t;i<o.length;i++){var a=(0,o[i])(n);if("string"==typeof a){var u=a.trim();if(u)return sn(un(u))}}if("FORM"===n.nodeName)break;n=n.parentElement,r+=1}}function un(e){return e.replace(/\s+/g," ")}function sn(e){return e.length>100?(n=100,((r=(t=e).charCodeAt(n-1))>=55296&&r<=56319?t.slice(0,n+1):t.slice(0,n))+" [...]"):e;var t,n,r}function cn(e){if(!e.isContentEditable){if("innerText"in e){var t=e.innerText;if(!function(){if(void 0===Zt){var e=document.createElement("style");e.textContent="*";var t=document.createElement("div");t.appendChild(e),document.body.appendChild(t),Zt=""===t.innerText,document.body.removeChild(t)}return Zt}())for(var n=e.querySelectorAll("script, style"),r=0;r<n.length;r+=1){var i=n[r].innerText;i.trim().length>0&&(t=t.replace(i,""))}return t}return e.textContent}}function fn(e,t){void 0===t&&(t=O);var n={errorCount:0,longTaskCount:0,resourceCount:0,userActionCount:0},r=[];return r.push(e.subscribe(Ve.ERROR_COLLECTED,(function(){n.errorCount+=1,t(n)}))),r.push(e.subscribe(Ve.AUTO_ACTION_COMPLETED,(function(){n.userActionCount+=1,t(n)}))),r.push(e.subscribe(Ve.CUSTOM_ACTION_COLLECTED,(function(){n.userActionCount+=1,t(n)}))),r.push(e.subscribe(Ve.PERFORMANCE_ENTRY_COLLECTED,(function(e){"longtask"===e.entryType&&(n.longTaskCount+=1,t(n))}))),r.push(e.subscribe(Ve.RESOURCE_ADDED_TO_BATCH,(function(){n.resourceCount+=1,t(n)}))),{stop:function(){r.forEach((function(e){return e.unsubscribe()}))},eventCounts:n}}var dn,ln=100,pn=100,En=1e4;function mn(e,t){var n=function(e){var t,n=new Se,r=[],i=0;function o(){n.notify({isBusy:i>0})}return r.push(e.subscribe(Ve.DOM_MUTATED,(function(){return o()}))),r.push(e.subscribe(Ve.PERFORMANCE_ENTRY_COLLECTED,(function(e){"resource"===e.entryType&&o()}))),r.push(e.subscribe(Ve.REQUEST_STARTED,(function(e){void 0===t&&(t=e.requestIndex),i+=1,o()}))),r.push(e.subscribe(Ve.REQUEST_COMPLETED,(function(e){void 0===t||e.requestIndex<t||(i-=1,o())}))),{observable:n,stop:function(){r.forEach((function(e){return e.unsubscribe()}))}}}(e),r=n.observable,i=n.stop,o=function(e,t,n){var r,i=!1,o=setTimeout(se((function(){return s(!1,0)})),ln),a=setTimeout(se((function(){return s(!0,performance.now())})),En);function u(){i=!0,clearTimeout(o),clearTimeout(r),clearTimeout(a),t()}function s(e,t){i||(u(),n(e,t))}return e.subscribe((function(e){var t=e.isBusy;clearTimeout(o),clearTimeout(r);var n=performance.now();t||(r=setTimeout(se((function(){return s(!0,n)})),pn))})),{stop:u}}(r,i,t).stop;return{stop:function(){o(),i()}}}function vn(e){var t=function(e){var t,n;return{create:function(r,i){if(!t){var o=new Tn(e,r,i);t=o,n=mn(e,(function(e,n){e?o.complete(n):o.discard(),t=void 0}))}},discardCurrent:function(){t&&(n.stop(),t.discard(),t=void 0)}}}(e);function n(e){if(e.target instanceof Element){var n=Jt(e.target);n&&t.create(dn.CLICK,n)}}return e.subscribe(Ve.VIEW_CREATED,(function(){t.discardCurrent()})),addEventListener(a.CLICK,n,{capture:!0}),{stop:function(){t.discardCurrent(),removeEventListener(a.CLICK,n,{capture:!0})}}}!function(e){e.CLICK="click",e.CUSTOM="custom"}(dn||(dn={}));var hn,Tn=function(){function e(e,t,n){this.lifeCycle=e,this.type=t,this.name=n,this.id=g(),this.startTime=performance.now(),this.eventCountsSubscription=fn(e),this.lifeCycle.notify(Ve.AUTO_ACTION_CREATED,{id:this.id,startTime:this.startTime})}return e.prototype.complete=function(e){var t=this.eventCountsSubscription.eventCounts;this.lifeCycle.notify(Ve.AUTO_ACTION_COMPLETED,{duration:e-this.startTime,id:this.id,measures:{errorCount:t.errorCount,longTaskCount:t.longTaskCount,resourceCount:t.resourceCount},name:this.name,startTime:this.startTime,type:this.type}),this.eventCountsSubscription.stop()},e.prototype.discard=function(){this.lifeCycle.notify(Ve.AUTO_ACTION_DISCARDED),this.eventCountsSubscription.stop()},e}();!function(e){e.INITIAL_LOAD="initial_load",e.ROUTE_CHANGE="route_change"}(hn||(hn={}));var gn=3e3,bn=5*f;function yn(e,t){var n,i=Cn(t,e,hn.INITIAL_LOAD,document.referrer,0),o=i,u=function(e,t){var n;return{stop:e.subscribe(Ve.PERFORMANCE_ENTRY_COLLECTED,(function(e){"navigation"===e.entryType?(n=r(r({},n),{domComplete:e.domComplete,domContentLoaded:e.domContentLoadedEventEnd,domInteractive:e.domInteractive,loadEventEnd:e.loadEventEnd}),t(n)):"paint"===e.entryType&&"first-contentful-paint"===e.name&&(n=r(r({},n),{firstContentfulPaint:e.startTime}),t(n))})).unsubscribe}}(t,(function(e){i.updateTimings(e),i.scheduleUpdate()})).stop;function s(){o.isDifferentView(e)?(o.triggerUpdate(),o.end(),o=Cn(t,e,hn.ROUTE_CHANGE,o.url)):(o.updateLocation(e),o.triggerUpdate())}!function(e){var t=history.pushState;history.pushState=se((function(){t.apply(this,arguments),e()}));var n=history.replaceState;history.replaceState=se((function(){n.apply(this,arguments),e()})),window.addEventListener(a.POP_STATE,se(e))}(s),n=s,window.addEventListener("hashchange",se(n)),t.subscribe(Ve.SESSION_RENEWED,(function(){o.end(),o=Cn(t,e,hn.ROUTE_CHANGE,o.url)})),t.subscribe(Ve.BEFORE_UNLOAD,(function(){o.triggerUpdate(),o.end()}));var c=window.setInterval(se((function(){o.triggerUpdate()})),bn);return{stop:function(){u(),o.end(),clearInterval(c)}}}function Cn(e,t,n,i,o){void 0===o&&(o=performance.now());var a,u,s,c=g(),f={errorCount:0,longTaskCount:0,resourceCount:0,userActionCount:0},d=0,p=r({},t);e.notify(Ve.VIEW_CREATED,{id:c,startTime:o,location:p,referrer:i});var E=l(se(O),gn,{leading:!1}),m=E.throttled,v=E.cancel,h=fn(e,(function(e){f=e,m()})).stop,T=function(e,t){var n=e===hn.INITIAL_LOAD,r=!0,i=[];function o(){!r&&!n&&i.length>0&&t(Math.max.apply(Math,i))}return{setLoadEventEnd:function(e){n&&(n=!1,i.push(e),o())},setActivityLoadingTime:function(e){r&&(r=!1,void 0!==e&&i.push(e),o())}}}(n,(function(e){u=e,m()})),b=T.setActivityLoadingTime,y=T.setLoadEventEnd,C=function(e,t){var n=performance.now();return{stop:mn(e,(function(e,r){t(e?r-n:void 0)})).stop}}(e,b).stop;function O(){d+=1,e.notify(Ve.VIEW_UPDATED,{documentVersion:d,id:c,loadingTime:u,loadingType:n,location:p,referrer:i,startTime:o,duration:(void 0===s?performance.now():s)-o,measures:r(r({},a),f)})}return(O(),{scheduleUpdate:m,end:function(){s=performance.now(),h(),C()},isDifferentView:function(e){return p.pathname!==e.pathname||(t=e.hash,n=t.substr(1),!document.getElementById(n)&&e.hash!==p.hash);var t,n},triggerUpdate:function(){v(),O()},updateTimings:function(e){a=e,void 0!==e.loadEventEnd&&y(e.loadEventEnd)},updateLocation:function(e){p=r({},e)},get url(){return p.href}})}var On,_n,Rn,Sn,wn=An((function(e,t){var n=new Ke,i=Be(e,Je,!0),o=i.errorObservable,a=i.configuration,c=i.internalMonitoring,f=Yt(a,n);c.setExternalContextProvider((function(){return h({application_id:e.applicationId},d.findView(),t())}));var d=function(e,t,n,i,o,a){var c=function(e,t){var n,r,i,o=[],a=[];e.subscribe(Ve.VIEW_CREATED,(function(e){n&&o.unshift({context:c(),endTime:e.startTime,startTime:n.startTime}),n=e,i=t.getId()})),e.subscribe(Ve.VIEW_UPDATED,(function(e){n.id===e.id&&(n=e)})),e.subscribe(Ve.AUTO_ACTION_CREATED,(function(e){r=e})),e.subscribe(Ve.AUTO_ACTION_COMPLETED,(function(e){r&&a.unshift({context:f(),endTime:r.startTime+e.duration,startTime:r.startTime}),r=void 0})),e.subscribe(Ve.AUTO_ACTION_DISCARDED,(function(){r=void 0})),e.subscribe(Ve.SESSION_RENEWED,(function(){o=[],a=[],n=void 0,r=void 0}));var u=window.setInterval(se((function(){s(o,ht),s(a,Tt)})),gt);function s(e,t){for(var n=performance.now()-t;e.length>0&&e[e.length-1].startTime<n;)e.pop()}function c(){return{sessionId:i,view:{id:n.id,referrer:n.referrer,url:n.location.href}}}function f(){return{userAction:{id:r.id}}}function d(e,t,n,r){if(void 0===r)return n?e():void 0;if(n&&r>=n.startTime)return e();for(var i=0,o=t;i<o.length;i++){var a=o[i];if(r>a.endTime)break;if(r>=a.startTime)return a.context}}var l={findAction:function(e){return d(f,a,r,e)},findActionV2:function(e){var t=l.findAction(e);if(t)return{action:{id:t.userAction.id}}},findView:function(e){return d(c,o,n,e)},findViewV2:function(e){var t=l.findView(e);if(t)return{session:{id:t.sessionId},view:t.view}},stop:function(){window.clearInterval(u)}};return l}(n,o),f=Xe(i,n);return $e(e,i,n,o,c,a),Ye(e,i,n,o,c,a),function(e,t){var n=function(t,n,r,i){return e.notify(Ve.RAW_RUM_EVENT_COLLECTED,{customerContext:i,rawRumEvent:n,savedGlobalContext:r,startTime:t})};(function(e,t){e.subscribe(Ve.VIEW_UPDATED,(function(e){t(e.startTime,{date:I(e.startTime),duration:y(e.duration),evt:{category:Fe.VIEW},rum:{documentVersion:e.documentVersion},view:{loadingTime:y(e.loadingTime),loadingType:e.loadingType,measures:r(r({},e.measures),{domComplete:y(e.measures.domComplete),domContentLoaded:y(e.measures.domContentLoaded),domInteractive:y(e.measures.domInteractive),firstContentfulPaint:y(e.measures.firstContentfulPaint),loadEventEnd:y(e.measures.loadEventEnd)})}})}))})(e,n),function(e,t){e.subscribe(Ve.ERROR_COLLECTED,(function(e){var n=e.message,i=e.startTime,o=e.context;t(i,r({message:n,date:I(i),evt:{category:Fe.ERROR}},o))}))}(e,n),function(e,t,n){e.subscribe(Ve.REQUEST_COMPLETED,(function(r){if(t.isTrackedWithResource()){var i=Ze(r),o=r.type===s.XHR?u.XHR:u.FETCH,a=i?i.startTime:r.startTime,c=r.traceId&&r.spanId;n(a,{_dd:c?{spanId:r.spanId.toDecimalString(),traceId:r.traceId.toDecimalString()}:void 0,date:I(a),duration:i?It(i):y(r.duration),evt:{category:Fe.RESOURCE},http:{method:r.method,performance:i?Lt(i):void 0,statusCode:r.status,url:r.url},network:{bytesWritten:i?Nt(i):void 0},resource:{kind:o,id:c?g():void 0}}),e.notify(Ve.RESOURCE_ADDED_TO_BATCH)}}))}(e,t,n),function(e,t,n){e.subscribe(Ve.PERFORMANCE_ENTRY_COLLECTED,(function(r){"resource"===r.entryType&&function(e,t,n,r){if(!t.isTrackedWithResource())return;var i=wt(r);if(S([u.XHR,u.FETCH],i))return;n(r.startTime,{_dd:r.traceId?{traceId:r.traceId}:void 0,date:I(r.startTime),duration:It(r),evt:{category:Fe.RESOURCE},http:{performance:Lt(r),url:r.name},network:{bytesWritten:Nt(r)},resource:{kind:i}}),e.notify(Ve.RESOURCE_ADDED_TO_BATCH)}(e,t,n,r)}))}(e,t,n),function(e,t){e.subscribe(Ve.CUSTOM_ACTION_COLLECTED,(function(e){var n=e.action,r=n.name,i=n.type,o=n.context,a=n.startTime,u=e.context;t(a,{date:I(a),evt:{name:r,category:Fe.USER_ACTION},userAction:{type:i}},u,o)}))}(e,n),function(e,t){e.subscribe(Ve.AUTO_ACTION_COMPLETED,(function(e){t(e.startTime,{date:I(e.startTime),duration:y(e.duration),evt:{category:Fe.USER_ACTION,name:e.name},userAction:{id:e.id,measures:e.measures,type:e.type}})}))}(e,n)}(n,o),function(e,t){e.subscribe(Ve.PERFORMANCE_ENTRY_COLLECTED,(function(n){if("longtask"===n.entryType)if(t.isEnabled("v2_format")){var r={date:I(n.startTime),longTask:{duration:y(n.duration)},type:Ge.LONG_TASK};e.notify(Ve.RAW_RUM_EVENT_V2_COLLECTED,{rawRumEvent:r,startTime:n.startTime})}else{r={date:I(n.startTime),duration:y(n.duration),evt:{category:Fe.LONG_TASK}};e.notify(Ve.RAW_RUM_EVENT_COLLECTED,{rawRumEvent:r,startTime:n.startTime})}}))}(n,i),yn(t,n),{parentContexts:c,stop:function(){f.stop()}}}(e.applicationId,location,n,a,f,t).parentContexts;return Gt(n,a),kt(n,a),Qe(n),a.trackInteractions&&vn(n),o.subscribe((function(e){return n.notify(Ve.ERROR_COLLECTED,e)})),{getInternalContext:function(t){return function(e,t,n,r){var i=e.findView(r);if(n.isTracked()&&i&&i.sessionId)return C(h({applicationId:t},i,e.findAction(r)))}(d,e.applicationId,f,t)},addUserAction:function(e,t){n.notify(Ve.CUSTOM_ACTION_COLLECTED,{action:e,context:t})}}}));function An(e){var t,n=!1,i=(t={},{get:function(){return t},add:function(e,n){t[e]=n},remove:function(e){delete t[e]},set:function(e){t=e}}),o=function(){},a=new je,u=function(e){a.add([e,T(i.get())])};return function(e){var t=r(r({},e),{onReady:function(e){e()}});return Object.defineProperty(t,"_setDebug",{get:function(){return le},enumerable:!1}),t}({init:se((function(t){var r;Pe(G(t))&&He()&&function(e){if(n)return e.silentMultipleInit||console.error("DD_RUM is already initialized."),!1;if(!e||!e.clientToken&&!e.publicApiKey)return console.error("Client Token is not configured, we will not send any data."),!1;if(!e.applicationId)return console.error("Application ID is not configured, no RUM data will be collected."),!1;if(void 0!==e.sampleRate&&!w(e.sampleRate))return console.error("Sample Rate should be a number between 0 and 100"),!1;if(void 0!==e.resourceSampleRate&&!w(e.resourceSampleRate))return console.error("Resource Sample Rate should be a number between 0 and 100"),!1;if(Array.isArray(e.allowedTracingOrigins)&&0!==e.allowedTracingOrigins.length&&void 0===e.service)return console.error("Service need to be configured when tracing is enabled"),!1;return!0}(t)&&(t.publicApiKey&&(t.clientToken=t.publicApiKey),r=e(t,i.get),o=r.getInternalContext,u=r.addUserAction,a.drain((function(e){var t=e[0],n=e[1];return u(t,n)})),n=!0)})),addRumGlobalContext:se(i.add),removeRumGlobalContext:se(i.remove),setRumGlobalContext:se(i.set),getInternalContext:se((function(e){return o(e)})),addUserAction:se((function(e,t){u({name:e,context:T(t),startTime:performance.now(),type:dn.CUSTOM})}))})}On=function(){if("object"==typeof globalThis)return globalThis;Object.defineProperty(Object.prototype,"_dd_temp_",{get:function(){return this},configurable:!0});var e=_dd_temp_;return delete Object.prototype._dd_temp_,"object"!=typeof e&&(e="object"==typeof self?self:"object"==typeof window?window:{}),e}(),Rn=wn,Sn=On[_n="DD_RUM"],On[_n]=Rn,Sn&&Sn.q&&Sn.q.forEach((function(e){return e()}))}]);
import { Configuration, Context } from '@datadog/browser-core';
import { LifeCycle } from './lifeCycle';
import { ActionContext, ParentContexts, ViewContext } from './parentContexts';
import { RumErrorEvent, RumLongTaskEvent, RumResourceEvent, RumUserActionEvent, RumViewEvent } from './rum';
import { ParentContexts } from './parentContexts';
import { RumSession } from './rumSession';
interface RumContext {
applicationId: string;
date: number;
service?: string;
session: {
type: string;
};
}
export declare type RumEvent = RumErrorEvent & ActionContext & ViewContext & RumContext | RumResourceEvent & ActionContext & ViewContext & RumContext | RumViewEvent & ViewContext & RumContext | RumLongTaskEvent & ActionContext & ViewContext & RumContext | RumUserActionEvent & ViewContext & RumContext;
export declare function startRumAssembly(applicationId: string, configuration: Configuration, lifeCycle: LifeCycle, session: RumSession, parentContexts: ParentContexts, getGlobalContext: () => Context): void;
export {};

@@ -5,3 +5,3 @@ "use strict";

var lifeCycle_1 = require("./lifeCycle");
var rum_1 = require("./rum");
var types_1 = require("./types");
var SessionType;

@@ -38,3 +38,3 @@ (function (SessionType) {

function needToAssembleWithAction(event) {
return ([rum_1.RumEventCategory.ERROR, rum_1.RumEventCategory.RESOURCE, rum_1.RumEventCategory.LONG_TASK].indexOf(event.evt.category) !== -1);
return ([types_1.RumEventCategory.ERROR, types_1.RumEventCategory.RESOURCE, types_1.RumEventCategory.LONG_TASK].indexOf(event.evt.category) !== -1);
}

@@ -41,0 +41,0 @@ function getSessionType() {

@@ -5,3 +5,4 @@ "use strict";

var lifeCycle_1 = require("./lifeCycle");
var rum_1 = require("./rum");
var types_1 = require("./types");
var typesV2_1 = require("./typesV2");
function startRumBatch(configuration, lifeCycle) {

@@ -11,3 +12,3 @@ var batch = makeRumBatch(configuration, lifeCycle);

var rumEvent = _a.rumEvent, serverRumEvent = _a.serverRumEvent;
if (rumEvent.evt.category === rum_1.RumEventCategory.VIEW) {
if (rumEvent.evt.category === types_1.RumEventCategory.VIEW) {
batch.upsert(serverRumEvent, rumEvent.view.id);

@@ -19,2 +20,11 @@ }

});
lifeCycle.subscribe(lifeCycle_1.LifeCycleEventType.RUM_EVENT_V2_COLLECTED, function (_a) {
var rumEvent = _a.rumEvent, serverRumEvent = _a.serverRumEvent;
if (rumEvent.type === typesV2_1.RumEventType.VIEW) {
batch.upsert(serverRumEvent, rumEvent.view.id);
}
else {
batch.add(serverRumEvent);
}
});
return {

@@ -21,0 +31,0 @@ stop: function () {

@@ -6,4 +6,4 @@ "use strict";

datacenter: 'us',
sdkVersion: '1.24.0',
sdkVersion: '1.24.1',
};
//# sourceMappingURL=buildEnv.js.map
export { Datacenter } from '@datadog/browser-core';
export { RumUserConfiguration, RumGlobal, datadogRum, InternalContext } from './rum.entry';
export { RumEventCategory, RumResourceEvent, RumViewEvent, RumUserActionEvent } from './rum';
export { RumEvent } from './assembly';
export { RumUserConfiguration, RumGlobal, datadogRum } from './rum.entry';
export { InternalContext, RumEvent, RumEventCategory, RumUserActionEvent, RumViewEvent, RumResourceEvent, } from './types';

@@ -7,4 +7,4 @@ "use strict";

exports.datadogRum = rum_entry_1.datadogRum;
var rum_1 = require("./rum");
exports.RumEventCategory = rum_1.RumEventCategory;
var types_1 = require("./types");
exports.RumEventCategory = types_1.RumEventCategory;
//# sourceMappingURL=index.js.map
import { Context, ErrorMessage } from '@datadog/browser-core';
import { RumEvent } from './assembly';
import { RumPerformanceEntry } from './performanceCollection';
import { RequestCompleteEvent, RequestStartEvent } from './requestCollection';
import { RawRumEvent } from './rum';
import { RawRumEvent, RumEvent } from './types';
import { RawRumEventV2, RumEventV2 } from './typesV2';
import { AutoActionCreatedEvent, AutoUserAction, CustomUserAction } from './userActionCollection';

@@ -24,3 +24,5 @@ import { View, ViewCreatedEvent } from './viewCollection';

RAW_RUM_EVENT_COLLECTED = 14,
RUM_EVENT_COLLECTED = 15
RAW_RUM_EVENT_V2_COLLECTED = 15,
RUM_EVENT_COLLECTED = 16,
RUM_EVENT_V2_COLLECTED = 17
}

@@ -51,2 +53,8 @@ export interface Subscription {

}): void;
notify(eventType: LifeCycleEventType.RAW_RUM_EVENT_V2_COLLECTED, data: {
startTime: number;
rawRumEvent: RawRumEventV2;
savedGlobalContext?: Context;
customerContext?: Context;
}): void;
notify(eventType: LifeCycleEventType.RUM_EVENT_COLLECTED, data: {

@@ -56,2 +64,6 @@ rumEvent: RumEvent;

}): void;
notify(eventType: LifeCycleEventType.RUM_EVENT_V2_COLLECTED, data: {
rumEvent: RumEventV2;
serverRumEvent: Context;
}): void;
subscribe(eventType: LifeCycleEventType.ERROR_COLLECTED, callback: (data: ErrorMessage) => void): Subscription;

@@ -76,2 +88,8 @@ subscribe(eventType: LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, callback: (data: RumPerformanceEntry) => void): Subscription;

}) => void): void;
subscribe(eventType: LifeCycleEventType.RAW_RUM_EVENT_V2_COLLECTED, callback: (data: {
startTime: number;
rawRumEvent: RawRumEventV2;
savedGlobalContext?: Context;
customerContext?: Context;
}) => void): void;
subscribe(eventType: LifeCycleEventType.RUM_EVENT_COLLECTED, callback: (data: {

@@ -81,2 +99,6 @@ rumEvent: RumEvent;

}) => void): void;
subscribe(eventType: LifeCycleEventType.RUM_EVENT_V2_COLLECTED, callback: (data: {
rumEvent: RumEventV2;
serverRumEvent: Context;
}) => void): void;
}

@@ -20,3 +20,5 @@ "use strict";

LifeCycleEventType[LifeCycleEventType["RAW_RUM_EVENT_COLLECTED"] = 14] = "RAW_RUM_EVENT_COLLECTED";
LifeCycleEventType[LifeCycleEventType["RUM_EVENT_COLLECTED"] = 15] = "RUM_EVENT_COLLECTED";
LifeCycleEventType[LifeCycleEventType["RAW_RUM_EVENT_V2_COLLECTED"] = 15] = "RAW_RUM_EVENT_V2_COLLECTED";
LifeCycleEventType[LifeCycleEventType["RUM_EVENT_COLLECTED"] = 16] = "RUM_EVENT_COLLECTED";
LifeCycleEventType[LifeCycleEventType["RUM_EVENT_V2_COLLECTED"] = 17] = "RUM_EVENT_V2_COLLECTED";
})(LifeCycleEventType = exports.LifeCycleEventType || (exports.LifeCycleEventType = {}));

@@ -23,0 +25,0 @@ var LifeCycle = /** @class */ (function () {

@@ -0,2 +1,3 @@

import { Configuration } from '@datadog/browser-core';
import { LifeCycle } from './lifeCycle';
export declare function startLongTaskCollection(lifeCycle: LifeCycle): void;
export declare function startLongTaskCollection(lifeCycle: LifeCycle, configuration: Configuration): void;

@@ -5,4 +5,5 @@ "use strict";

var lifeCycle_1 = require("./lifeCycle");
var rum_1 = require("./rum");
function startLongTaskCollection(lifeCycle) {
var types_1 = require("./types");
var typesV2_1 = require("./typesV2");
function startLongTaskCollection(lifeCycle, configuration) {
lifeCycle.subscribe(lifeCycle_1.LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, function (entry) {

@@ -12,13 +13,28 @@ if (entry.entryType !== 'longtask') {

}
var rawRumEvent = {
date: browser_core_1.getTimestamp(entry.startTime),
duration: browser_core_1.msToNs(entry.duration),
evt: {
category: rum_1.RumEventCategory.LONG_TASK,
},
};
lifeCycle.notify(lifeCycle_1.LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, {
rawRumEvent: rawRumEvent,
startTime: entry.startTime,
});
if (configuration.isEnabled('v2_format')) {
var rawRumEvent = {
date: browser_core_1.getTimestamp(entry.startTime),
longTask: {
duration: browser_core_1.msToNs(entry.duration),
},
type: typesV2_1.RumEventType.LONG_TASK,
};
lifeCycle.notify(lifeCycle_1.LifeCycleEventType.RAW_RUM_EVENT_V2_COLLECTED, {
rawRumEvent: rawRumEvent,
startTime: entry.startTime,
});
}
else {
var rawRumEvent = {
date: browser_core_1.getTimestamp(entry.startTime),
duration: browser_core_1.msToNs(entry.duration),
evt: {
category: types_1.RumEventCategory.LONG_TASK,
},
};
lifeCycle.notify(lifeCycle_1.LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, {
rawRumEvent: rawRumEvent,
startTime: entry.startTime,
});
}
});

@@ -25,0 +41,0 @@ }

@@ -1,25 +0,15 @@

import { Context } from '@datadog/browser-core';
import { LifeCycle } from './lifeCycle';
import { RumSession } from './rumSession';
import { ActionContext, ViewContext } from './types';
import { ActionContextV2, ViewContextV2 } from './typesV2';
export declare const VIEW_CONTEXT_TIME_OUT_DELAY: number;
export declare const ACTION_CONTEXT_TIME_OUT_DELAY: number;
export declare const CLEAR_OLD_CONTEXTS_INTERVAL: number;
export interface ViewContext extends Context {
sessionId: string | undefined;
view: {
id: string;
url: string;
referrer: string;
};
}
export interface ActionContext extends Context {
userAction: {
id: string;
};
}
export interface ParentContexts {
findAction: (startTime?: number) => ActionContext | undefined;
findActionV2: (startTime?: number) => ActionContextV2 | undefined;
findView: (startTime?: number) => ViewContext | undefined;
findViewV2: (startTime?: number) => ViewContextV2 | undefined;
stop: () => void;
}
export declare function startParentContexts(lifeCycle: LifeCycle, session: RumSession): ParentContexts;

@@ -95,9 +95,32 @@ "use strict";

}
return {
var parentContexts = {
findAction: function (startTime) {
return findContext(buildCurrentActionContext, previousActions, currentAction, startTime);
},
findActionV2: function (startTime) {
var actionContext = parentContexts.findAction(startTime);
if (!actionContext) {
return;
}
return {
action: {
id: actionContext.userAction.id,
},
};
},
findView: function (startTime) {
return findContext(buildCurrentViewContext, previousViews, currentView, startTime);
},
findViewV2: function (startTime) {
var viewContext = parentContexts.findView(startTime);
if (!viewContext) {
return;
}
return {
session: {
id: viewContext.sessionId,
},
view: viewContext.view,
};
},
stop: function () {

@@ -107,4 +130,5 @@ window.clearInterval(clearOldContextsInterval);

};
return parentContexts;
}
exports.startParentContexts = startParentContexts;
//# sourceMappingURL=parentContexts.js.map

@@ -1,6 +0,17 @@

import { Configuration, ResourceKind } from '@datadog/browser-core';
import { Configuration, ResourceType } from '@datadog/browser-core';
import { RumPerformanceResourceTiming } from './performanceCollection';
import { PerformanceResourceDetails } from './rum';
export interface PerformanceResourceDetailsElement {
duration: number;
start: number;
}
export interface PerformanceResourceDetails {
redirect?: PerformanceResourceDetailsElement;
dns?: PerformanceResourceDetailsElement;
connect?: PerformanceResourceDetailsElement;
ssl?: PerformanceResourceDetailsElement;
firstByte: PerformanceResourceDetailsElement;
download: PerformanceResourceDetailsElement;
}
export declare const FAKE_INITIAL_DOCUMENT = "initial_document";
export declare function computeResourceKind(timing: RumPerformanceResourceTiming): ResourceKind | ResourceKind.OTHER;
export declare function computeResourceKind(timing: RumPerformanceResourceTiming): ResourceType | ResourceType.OTHER;
export declare function computePerformanceResourceDuration(entry: RumPerformanceResourceTiming): number;

@@ -7,0 +18,0 @@ export declare function computePerformanceResourceDetails(entry: RumPerformanceResourceTiming): PerformanceResourceDetails | undefined;

@@ -6,10 +6,10 @@ "use strict";

var RESOURCE_TYPES = [
[browser_core_1.ResourceKind.DOCUMENT, function (initiatorType) { return exports.FAKE_INITIAL_DOCUMENT === initiatorType; }],
[browser_core_1.ResourceKind.XHR, function (initiatorType) { return 'xmlhttprequest' === initiatorType; }],
[browser_core_1.ResourceKind.FETCH, function (initiatorType) { return 'fetch' === initiatorType; }],
[browser_core_1.ResourceKind.BEACON, function (initiatorType) { return 'beacon' === initiatorType; }],
[browser_core_1.ResourceKind.CSS, function (_, path) { return path.match(/\.css$/i) !== null; }],
[browser_core_1.ResourceKind.JS, function (_, path) { return path.match(/\.js$/i) !== null; }],
[browser_core_1.ResourceType.DOCUMENT, function (initiatorType) { return exports.FAKE_INITIAL_DOCUMENT === initiatorType; }],
[browser_core_1.ResourceType.XHR, function (initiatorType) { return 'xmlhttprequest' === initiatorType; }],
[browser_core_1.ResourceType.FETCH, function (initiatorType) { return 'fetch' === initiatorType; }],
[browser_core_1.ResourceType.BEACON, function (initiatorType) { return 'beacon' === initiatorType; }],
[browser_core_1.ResourceType.CSS, function (_, path) { return path.match(/\.css$/i) !== null; }],
[browser_core_1.ResourceType.JS, function (_, path) { return path.match(/\.js$/i) !== null; }],
[
browser_core_1.ResourceKind.IMAGE,
browser_core_1.ResourceType.IMAGE,
function (initiatorType, path) {

@@ -19,5 +19,5 @@ return browser_core_1.includes(['image', 'img', 'icon'], initiatorType) || path.match(/\.(gif|jpg|jpeg|tiff|png|svg|ico)$/i) !== null;

],
[browser_core_1.ResourceKind.FONT, function (_, path) { return path.match(/\.(woff|eot|woff2|ttf)$/i) !== null; }],
[browser_core_1.ResourceType.FONT, function (_, path) { return path.match(/\.(woff|eot|woff2|ttf)$/i) !== null; }],
[
browser_core_1.ResourceKind.MEDIA,
browser_core_1.ResourceType.MEDIA,
function (initiatorType, path) {

@@ -32,3 +32,3 @@ return browser_core_1.includes(['audio', 'video'], initiatorType) || path.match(/\.(mp3|mp4)$/i) !== null;

browser_core_1.addMonitoringMessage("Failed to construct URL for \"" + timing.name + "\"");
return browser_core_1.ResourceKind.OTHER;
return browser_core_1.ResourceType.OTHER;
}

@@ -42,3 +42,3 @@ var path = browser_core_1.getPathName(url);

}
return browser_core_1.ResourceKind.OTHER;
return browser_core_1.ResourceType.OTHER;
}

@@ -45,0 +45,0 @@ exports.computeResourceKind = computeResourceKind;

@@ -1,97 +0,9 @@

import { Configuration, Context, ErrorContext, HttpContext, ResourceKind } from '@datadog/browser-core';
import { Configuration, Context } from '@datadog/browser-core';
import { LifeCycle } from './lifeCycle';
import { ParentContexts } from './parentContexts';
import { RumPerformanceResourceTiming } from './performanceCollection';
import { InternalContext, RumUserConfiguration } from './rum.entry';
import { RumUserConfiguration } from './rum.entry';
import { RumSession } from './rumSession';
import { CustomUserAction, UserActionMeasures, UserActionType } from './userActionCollection';
import { ViewLoadingType, ViewMeasures } from './viewCollection';
export declare enum RumEventCategory {
USER_ACTION = "user_action",
ERROR = "error",
LONG_TASK = "long_task",
VIEW = "view",
RESOURCE = "resource"
}
interface PerformanceResourceDetailsElement {
duration: number;
start: number;
}
export interface PerformanceResourceDetails {
redirect?: PerformanceResourceDetailsElement;
dns?: PerformanceResourceDetailsElement;
connect?: PerformanceResourceDetailsElement;
ssl?: PerformanceResourceDetailsElement;
firstByte: PerformanceResourceDetailsElement;
download: PerformanceResourceDetailsElement;
}
export interface RumResourceEvent {
date: number;
duration: number;
evt: {
category: RumEventCategory.RESOURCE;
};
http: {
performance?: PerformanceResourceDetails;
method?: string;
statusCode?: number;
url: string;
};
network: {
bytesWritten?: number;
};
resource: {
kind: ResourceKind;
id?: string;
};
_dd?: {
traceId: string;
spanId?: string;
};
}
export interface RumErrorEvent {
date: number;
http?: HttpContext;
error: ErrorContext;
evt: {
category: RumEventCategory.ERROR;
};
message: string;
}
export interface RumViewEvent {
date: number;
duration: number;
evt: {
category: RumEventCategory.VIEW;
};
rum: {
documentVersion: number;
};
view: {
loadingTime?: number;
loadingType: ViewLoadingType;
measures: ViewMeasures;
};
}
export interface RumLongTaskEvent {
date: number;
duration: number;
evt: {
category: RumEventCategory.LONG_TASK;
};
}
export interface RumUserActionEvent {
date?: number;
duration?: number;
evt: {
category: RumEventCategory.USER_ACTION;
name: string;
};
userAction: {
id?: string;
type: UserActionType;
measures?: UserActionMeasures;
};
}
export declare type RawRumEvent = RumErrorEvent | RumResourceEvent | RumViewEvent | RumLongTaskEvent | RumUserActionEvent;
import { InternalContext, RumResourceEvent, RumViewEvent } from './types';
import { CustomUserAction } from './userActionCollection';
export declare function startRum(userConfiguration: RumUserConfiguration, getGlobalContext: () => Context): {

@@ -109,2 +21,1 @@ getInternalContext(startTime?: number | undefined): InternalContext | undefined;

export declare function handleResourceEntry(lifeCycle: LifeCycle, session: RumSession, handler: (startTime: number, event: RumResourceEvent) => void, entry: RumPerformanceResourceTiming): void;
export {};

@@ -6,14 +6,2 @@ import { Context, UserConfiguration } from '@datadog/browser-core';

}
export interface InternalContext {
application_id: string;
session_id: string | undefined;
view?: {
id: string;
url: string;
referrer: string;
};
user_action?: {
id: string;
};
}
export declare type RumGlobal = ReturnType<typeof makeRumGlobal>;

@@ -25,3 +13,3 @@ export declare const datadogRum: {

setRumGlobalContext: (newContext: Context) => void;
getInternalContext: (startTime?: number | undefined) => InternalContext | undefined;
getInternalContext: (startTime?: number | undefined) => import("./types").InternalContext | undefined;
addUserAction: (name: string, context?: Context | undefined) => void;

@@ -37,3 +25,3 @@ } & {

setRumGlobalContext: (newContext: Context) => void;
getInternalContext: (startTime?: number | undefined) => InternalContext | undefined;
getInternalContext: (startTime?: number | undefined) => import("./types").InternalContext | undefined;
addUserAction: (name: string, context?: Context | undefined) => void;

@@ -40,0 +28,0 @@ } & {

@@ -48,3 +48,3 @@ "use strict";

startTime: performance.now(),
type: userActionCollection_1.UserActionType.CUSTOM,
type: userActionCollection_1.ActionType.CUSTOM,
});

@@ -51,0 +51,0 @@ }),

@@ -6,2 +6,3 @@ "use strict";

var assembly_1 = require("./assembly");
var assemblyV2_1 = require("./assemblyV2");
var batch_1 = require("./batch");

@@ -18,12 +19,5 @@ var buildEnv_1 = require("./buildEnv");

var rumSession_1 = require("./rumSession");
var types_1 = require("./types");
var userActionCollection_1 = require("./userActionCollection");
var viewCollection_1 = require("./viewCollection");
var RumEventCategory;
(function (RumEventCategory) {
RumEventCategory["USER_ACTION"] = "user_action";
RumEventCategory["ERROR"] = "error";
RumEventCategory["LONG_TASK"] = "long_task";
RumEventCategory["VIEW"] = "view";
RumEventCategory["RESOURCE"] = "resource";
})(RumEventCategory = exports.RumEventCategory || (exports.RumEventCategory = {}));
function startRum(userConfiguration, getGlobalContext) {

@@ -68,4 +62,5 @@ var lifeCycle = new lifeCycle_1.LifeCycle();

assembly_1.startRumAssembly(applicationId, configuration, lifeCycle, session, parentContexts, getGlobalContext);
assemblyV2_1.startRumAssemblyV2(applicationId, configuration, lifeCycle, session, parentContexts, getGlobalContext);
trackRumEvents(lifeCycle, session);
longTaskCollection_1.startLongTaskCollection(lifeCycle);
longTaskCollection_1.startLongTaskCollection(lifeCycle, configuration);
viewCollection_1.startViewCollection(location, lifeCycle);

@@ -105,3 +100,3 @@ return {

evt: {
category: RumEventCategory.VIEW,
category: types_1.RumEventCategory.VIEW,
},

@@ -124,3 +119,3 @@ rum: {

handler(startTime, tslib_1.__assign({ message: message, date: browser_core_1.getTimestamp(startTime), evt: {
category: RumEventCategory.ERROR,
category: types_1.RumEventCategory.ERROR,
} }, context));

@@ -136,3 +131,3 @@ });

name: name,
category: RumEventCategory.USER_ACTION,
category: types_1.RumEventCategory.USER_ACTION,
},

@@ -151,3 +146,3 @@ userAction: {

evt: {
category: RumEventCategory.USER_ACTION,
category: types_1.RumEventCategory.USER_ACTION,
name: userAction.name,

@@ -169,3 +164,3 @@ },

var timing = matchRequestTiming_1.matchRequestTiming(request);
var kind = request.type === browser_core_1.RequestType.XHR ? browser_core_1.ResourceKind.XHR : browser_core_1.ResourceKind.FETCH;
var kind = request.type === browser_core_1.RequestType.XHR ? browser_core_1.ResourceType.XHR : browser_core_1.ResourceType.FETCH;
var startTime = timing ? timing.startTime : request.startTime;

@@ -183,3 +178,3 @@ var hasBeenTraced = request.traceId && request.spanId;

evt: {
category: RumEventCategory.RESOURCE,
category: types_1.RumEventCategory.RESOURCE,
},

@@ -215,3 +210,3 @@ http: {

var resourceKind = resourceUtils_1.computeResourceKind(entry);
if (browser_core_1.includes([browser_core_1.ResourceKind.XHR, browser_core_1.ResourceKind.FETCH], resourceKind)) {
if (browser_core_1.includes([browser_core_1.ResourceType.XHR, browser_core_1.ResourceType.FETCH], resourceKind)) {
return;

@@ -228,3 +223,3 @@ }

evt: {
category: RumEventCategory.RESOURCE,
category: types_1.RumEventCategory.RESOURCE,
},

@@ -231,0 +226,0 @@ http: {

import { Context } from '@datadog/browser-core';
import { LifeCycle } from './lifeCycle';
export declare enum UserActionType {
export declare enum ActionType {
CLICK = "click",
CUSTOM = "custom"
}
declare type AutoUserActionType = UserActionType.CLICK;
declare type AutoUserActionType = ActionType.CLICK;
export interface UserActionMeasures {

@@ -14,3 +14,3 @@ errorCount: number;

export interface CustomUserAction {
type: UserActionType.CUSTOM;
type: ActionType.CUSTOM;
name: string;

@@ -17,0 +17,0 @@ startTime: number;

@@ -8,7 +8,7 @@ "use strict";

var trackPageActivities_1 = require("./trackPageActivities");
var UserActionType;
(function (UserActionType) {
UserActionType["CLICK"] = "click";
UserActionType["CUSTOM"] = "custom";
})(UserActionType = exports.UserActionType || (exports.UserActionType = {}));
var ActionType;
(function (ActionType) {
ActionType["CLICK"] = "click";
ActionType["CUSTOM"] = "custom";
})(ActionType = exports.ActionType || (exports.ActionType = {}));
function startUserActionCollection(lifeCycle) {

@@ -29,3 +29,3 @@ var userAction = startUserActionManagement(lifeCycle);

}
userAction.create(UserActionType.CLICK, name);
userAction.create(ActionType.CLICK, name);
}

@@ -32,0 +32,0 @@ return {

import { Configuration, Context } from '@datadog/browser-core';
import { LifeCycle } from './lifeCycle';
import { ActionContext, ParentContexts, ViewContext } from './parentContexts';
import { RumErrorEvent, RumLongTaskEvent, RumResourceEvent, RumUserActionEvent, RumViewEvent } from './rum';
import { ParentContexts } from './parentContexts';
import { RumSession } from './rumSession';
interface RumContext {
applicationId: string;
date: number;
service?: string;
session: {
type: string;
};
}
export declare type RumEvent = RumErrorEvent & ActionContext & ViewContext & RumContext | RumResourceEvent & ActionContext & ViewContext & RumContext | RumViewEvent & ViewContext & RumContext | RumLongTaskEvent & ActionContext & ViewContext & RumContext | RumUserActionEvent & ViewContext & RumContext;
export declare function startRumAssembly(applicationId: string, configuration: Configuration, lifeCycle: LifeCycle, session: RumSession, parentContexts: ParentContexts, getGlobalContext: () => Context): void;
export {};
import { combine, withSnakeCaseKeys } from '@datadog/browser-core';
import { LifeCycleEventType } from './lifeCycle';
import { RumEventCategory, } from './rum';
import { RumEventCategory } from './types';
var SessionType;

@@ -5,0 +5,0 @@ (function (SessionType) {

import { Batch, combine, HttpRequest } from '@datadog/browser-core';
import { LifeCycleEventType } from './lifeCycle';
import { RumEventCategory } from './rum';
import { RumEventCategory } from './types';
import { RumEventType } from './typesV2';
export function startRumBatch(configuration, lifeCycle) {

@@ -15,2 +16,11 @@ var batch = makeRumBatch(configuration, lifeCycle);

});
lifeCycle.subscribe(LifeCycleEventType.RUM_EVENT_V2_COLLECTED, function (_a) {
var rumEvent = _a.rumEvent, serverRumEvent = _a.serverRumEvent;
if (rumEvent.type === RumEventType.VIEW) {
batch.upsert(serverRumEvent, rumEvent.view.id);
}
else {
batch.add(serverRumEvent);
}
});
return {

@@ -17,0 +27,0 @@ stop: function () {

export var buildEnv = {
buildMode: 'release',
datacenter: 'us',
sdkVersion: '1.24.0',
sdkVersion: '1.24.1',
};
//# sourceMappingURL=buildEnv.js.map
export { Datacenter } from '@datadog/browser-core';
export { RumUserConfiguration, RumGlobal, datadogRum, InternalContext } from './rum.entry';
export { RumEventCategory, RumResourceEvent, RumViewEvent, RumUserActionEvent } from './rum';
export { RumEvent } from './assembly';
export { RumUserConfiguration, RumGlobal, datadogRum } from './rum.entry';
export { InternalContext, RumEvent, RumEventCategory, RumUserActionEvent, RumViewEvent, RumResourceEvent, } from './types';
export { Datacenter } from '@datadog/browser-core';
export { datadogRum } from './rum.entry';
export { RumEventCategory } from './rum';
export { RumEventCategory, } from './types';
//# sourceMappingURL=index.js.map
import { Context, ErrorMessage } from '@datadog/browser-core';
import { RumEvent } from './assembly';
import { RumPerformanceEntry } from './performanceCollection';
import { RequestCompleteEvent, RequestStartEvent } from './requestCollection';
import { RawRumEvent } from './rum';
import { RawRumEvent, RumEvent } from './types';
import { RawRumEventV2, RumEventV2 } from './typesV2';
import { AutoActionCreatedEvent, AutoUserAction, CustomUserAction } from './userActionCollection';

@@ -24,3 +24,5 @@ import { View, ViewCreatedEvent } from './viewCollection';

RAW_RUM_EVENT_COLLECTED = 14,
RUM_EVENT_COLLECTED = 15
RAW_RUM_EVENT_V2_COLLECTED = 15,
RUM_EVENT_COLLECTED = 16,
RUM_EVENT_V2_COLLECTED = 17
}

@@ -51,2 +53,8 @@ export interface Subscription {

}): void;
notify(eventType: LifeCycleEventType.RAW_RUM_EVENT_V2_COLLECTED, data: {
startTime: number;
rawRumEvent: RawRumEventV2;
savedGlobalContext?: Context;
customerContext?: Context;
}): void;
notify(eventType: LifeCycleEventType.RUM_EVENT_COLLECTED, data: {

@@ -56,2 +64,6 @@ rumEvent: RumEvent;

}): void;
notify(eventType: LifeCycleEventType.RUM_EVENT_V2_COLLECTED, data: {
rumEvent: RumEventV2;
serverRumEvent: Context;
}): void;
subscribe(eventType: LifeCycleEventType.ERROR_COLLECTED, callback: (data: ErrorMessage) => void): Subscription;

@@ -76,2 +88,8 @@ subscribe(eventType: LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, callback: (data: RumPerformanceEntry) => void): Subscription;

}) => void): void;
subscribe(eventType: LifeCycleEventType.RAW_RUM_EVENT_V2_COLLECTED, callback: (data: {
startTime: number;
rawRumEvent: RawRumEventV2;
savedGlobalContext?: Context;
customerContext?: Context;
}) => void): void;
subscribe(eventType: LifeCycleEventType.RUM_EVENT_COLLECTED, callback: (data: {

@@ -81,2 +99,6 @@ rumEvent: RumEvent;

}) => void): void;
subscribe(eventType: LifeCycleEventType.RUM_EVENT_V2_COLLECTED, callback: (data: {
rumEvent: RumEventV2;
serverRumEvent: Context;
}) => void): void;
}

@@ -18,3 +18,5 @@ export var LifeCycleEventType;

LifeCycleEventType[LifeCycleEventType["RAW_RUM_EVENT_COLLECTED"] = 14] = "RAW_RUM_EVENT_COLLECTED";
LifeCycleEventType[LifeCycleEventType["RUM_EVENT_COLLECTED"] = 15] = "RUM_EVENT_COLLECTED";
LifeCycleEventType[LifeCycleEventType["RAW_RUM_EVENT_V2_COLLECTED"] = 15] = "RAW_RUM_EVENT_V2_COLLECTED";
LifeCycleEventType[LifeCycleEventType["RUM_EVENT_COLLECTED"] = 16] = "RUM_EVENT_COLLECTED";
LifeCycleEventType[LifeCycleEventType["RUM_EVENT_V2_COLLECTED"] = 17] = "RUM_EVENT_V2_COLLECTED";
})(LifeCycleEventType || (LifeCycleEventType = {}));

@@ -21,0 +23,0 @@ var LifeCycle = /** @class */ (function () {

@@ -0,2 +1,3 @@

import { Configuration } from '@datadog/browser-core';
import { LifeCycle } from './lifeCycle';
export declare function startLongTaskCollection(lifeCycle: LifeCycle): void;
export declare function startLongTaskCollection(lifeCycle: LifeCycle, configuration: Configuration): void;
import { getTimestamp, msToNs } from '@datadog/browser-core';
import { LifeCycleEventType } from './lifeCycle';
import { RumEventCategory } from './rum';
export function startLongTaskCollection(lifeCycle) {
import { RumEventCategory } from './types';
import { RumEventType } from './typesV2';
export function startLongTaskCollection(lifeCycle, configuration) {
lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, function (entry) {

@@ -9,15 +10,30 @@ if (entry.entryType !== 'longtask') {

}
var rawRumEvent = {
date: getTimestamp(entry.startTime),
duration: msToNs(entry.duration),
evt: {
category: RumEventCategory.LONG_TASK,
},
};
lifeCycle.notify(LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, {
rawRumEvent: rawRumEvent,
startTime: entry.startTime,
});
if (configuration.isEnabled('v2_format')) {
var rawRumEvent = {
date: getTimestamp(entry.startTime),
longTask: {
duration: msToNs(entry.duration),
},
type: RumEventType.LONG_TASK,
};
lifeCycle.notify(LifeCycleEventType.RAW_RUM_EVENT_V2_COLLECTED, {
rawRumEvent: rawRumEvent,
startTime: entry.startTime,
});
}
else {
var rawRumEvent = {
date: getTimestamp(entry.startTime),
duration: msToNs(entry.duration),
evt: {
category: RumEventCategory.LONG_TASK,
},
};
lifeCycle.notify(LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, {
rawRumEvent: rawRumEvent,
startTime: entry.startTime,
});
}
});
}
//# sourceMappingURL=longTaskCollection.js.map

@@ -1,25 +0,15 @@

import { Context } from '@datadog/browser-core';
import { LifeCycle } from './lifeCycle';
import { RumSession } from './rumSession';
import { ActionContext, ViewContext } from './types';
import { ActionContextV2, ViewContextV2 } from './typesV2';
export declare const VIEW_CONTEXT_TIME_OUT_DELAY: number;
export declare const ACTION_CONTEXT_TIME_OUT_DELAY: number;
export declare const CLEAR_OLD_CONTEXTS_INTERVAL: number;
export interface ViewContext extends Context {
sessionId: string | undefined;
view: {
id: string;
url: string;
referrer: string;
};
}
export interface ActionContext extends Context {
userAction: {
id: string;
};
}
export interface ParentContexts {
findAction: (startTime?: number) => ActionContext | undefined;
findActionV2: (startTime?: number) => ActionContextV2 | undefined;
findView: (startTime?: number) => ViewContext | undefined;
findViewV2: (startTime?: number) => ViewContextV2 | undefined;
stop: () => void;
}
export declare function startParentContexts(lifeCycle: LifeCycle, session: RumSession): ParentContexts;

@@ -93,9 +93,32 @@ import { monitor, ONE_MINUTE, SESSION_TIME_OUT_DELAY } from '@datadog/browser-core';

}
return {
var parentContexts = {
findAction: function (startTime) {
return findContext(buildCurrentActionContext, previousActions, currentAction, startTime);
},
findActionV2: function (startTime) {
var actionContext = parentContexts.findAction(startTime);
if (!actionContext) {
return;
}
return {
action: {
id: actionContext.userAction.id,
},
};
},
findView: function (startTime) {
return findContext(buildCurrentViewContext, previousViews, currentView, startTime);
},
findViewV2: function (startTime) {
var viewContext = parentContexts.findView(startTime);
if (!viewContext) {
return;
}
return {
session: {
id: viewContext.sessionId,
},
view: viewContext.view,
};
},
stop: function () {

@@ -105,3 +128,4 @@ window.clearInterval(clearOldContextsInterval);

};
return parentContexts;
}
//# sourceMappingURL=parentContexts.js.map

@@ -1,6 +0,17 @@

import { Configuration, ResourceKind } from '@datadog/browser-core';
import { Configuration, ResourceType } from '@datadog/browser-core';
import { RumPerformanceResourceTiming } from './performanceCollection';
import { PerformanceResourceDetails } from './rum';
export interface PerformanceResourceDetailsElement {
duration: number;
start: number;
}
export interface PerformanceResourceDetails {
redirect?: PerformanceResourceDetailsElement;
dns?: PerformanceResourceDetailsElement;
connect?: PerformanceResourceDetailsElement;
ssl?: PerformanceResourceDetailsElement;
firstByte: PerformanceResourceDetailsElement;
download: PerformanceResourceDetailsElement;
}
export declare const FAKE_INITIAL_DOCUMENT = "initial_document";
export declare function computeResourceKind(timing: RumPerformanceResourceTiming): ResourceKind | ResourceKind.OTHER;
export declare function computeResourceKind(timing: RumPerformanceResourceTiming): ResourceType | ResourceType.OTHER;
export declare function computePerformanceResourceDuration(entry: RumPerformanceResourceTiming): number;

@@ -7,0 +18,0 @@ export declare function computePerformanceResourceDetails(entry: RumPerformanceResourceTiming): PerformanceResourceDetails | undefined;

@@ -1,12 +0,12 @@

import { addMonitoringMessage, getPathName, includes, isIntakeRequest, isValidUrl, msToNs, ResourceKind, } from '@datadog/browser-core';
import { addMonitoringMessage, getPathName, includes, isIntakeRequest, isValidUrl, msToNs, ResourceType, } from '@datadog/browser-core';
export var FAKE_INITIAL_DOCUMENT = 'initial_document';
var RESOURCE_TYPES = [
[ResourceKind.DOCUMENT, function (initiatorType) { return FAKE_INITIAL_DOCUMENT === initiatorType; }],
[ResourceKind.XHR, function (initiatorType) { return 'xmlhttprequest' === initiatorType; }],
[ResourceKind.FETCH, function (initiatorType) { return 'fetch' === initiatorType; }],
[ResourceKind.BEACON, function (initiatorType) { return 'beacon' === initiatorType; }],
[ResourceKind.CSS, function (_, path) { return path.match(/\.css$/i) !== null; }],
[ResourceKind.JS, function (_, path) { return path.match(/\.js$/i) !== null; }],
[ResourceType.DOCUMENT, function (initiatorType) { return FAKE_INITIAL_DOCUMENT === initiatorType; }],
[ResourceType.XHR, function (initiatorType) { return 'xmlhttprequest' === initiatorType; }],
[ResourceType.FETCH, function (initiatorType) { return 'fetch' === initiatorType; }],
[ResourceType.BEACON, function (initiatorType) { return 'beacon' === initiatorType; }],
[ResourceType.CSS, function (_, path) { return path.match(/\.css$/i) !== null; }],
[ResourceType.JS, function (_, path) { return path.match(/\.js$/i) !== null; }],
[
ResourceKind.IMAGE,
ResourceType.IMAGE,
function (initiatorType, path) {

@@ -16,5 +16,5 @@ return includes(['image', 'img', 'icon'], initiatorType) || path.match(/\.(gif|jpg|jpeg|tiff|png|svg|ico)$/i) !== null;

],
[ResourceKind.FONT, function (_, path) { return path.match(/\.(woff|eot|woff2|ttf)$/i) !== null; }],
[ResourceType.FONT, function (_, path) { return path.match(/\.(woff|eot|woff2|ttf)$/i) !== null; }],
[
ResourceKind.MEDIA,
ResourceType.MEDIA,
function (initiatorType, path) {

@@ -29,3 +29,3 @@ return includes(['audio', 'video'], initiatorType) || path.match(/\.(mp3|mp4)$/i) !== null;

addMonitoringMessage("Failed to construct URL for \"" + timing.name + "\"");
return ResourceKind.OTHER;
return ResourceType.OTHER;
}

@@ -39,3 +39,3 @@ var path = getPathName(url);

}
return ResourceKind.OTHER;
return ResourceType.OTHER;
}

@@ -42,0 +42,0 @@ function areInOrder() {

@@ -1,97 +0,9 @@

import { Configuration, Context, ErrorContext, HttpContext, ResourceKind } from '@datadog/browser-core';
import { Configuration, Context } from '@datadog/browser-core';
import { LifeCycle } from './lifeCycle';
import { ParentContexts } from './parentContexts';
import { RumPerformanceResourceTiming } from './performanceCollection';
import { InternalContext, RumUserConfiguration } from './rum.entry';
import { RumUserConfiguration } from './rum.entry';
import { RumSession } from './rumSession';
import { CustomUserAction, UserActionMeasures, UserActionType } from './userActionCollection';
import { ViewLoadingType, ViewMeasures } from './viewCollection';
export declare enum RumEventCategory {
USER_ACTION = "user_action",
ERROR = "error",
LONG_TASK = "long_task",
VIEW = "view",
RESOURCE = "resource"
}
interface PerformanceResourceDetailsElement {
duration: number;
start: number;
}
export interface PerformanceResourceDetails {
redirect?: PerformanceResourceDetailsElement;
dns?: PerformanceResourceDetailsElement;
connect?: PerformanceResourceDetailsElement;
ssl?: PerformanceResourceDetailsElement;
firstByte: PerformanceResourceDetailsElement;
download: PerformanceResourceDetailsElement;
}
export interface RumResourceEvent {
date: number;
duration: number;
evt: {
category: RumEventCategory.RESOURCE;
};
http: {
performance?: PerformanceResourceDetails;
method?: string;
statusCode?: number;
url: string;
};
network: {
bytesWritten?: number;
};
resource: {
kind: ResourceKind;
id?: string;
};
_dd?: {
traceId: string;
spanId?: string;
};
}
export interface RumErrorEvent {
date: number;
http?: HttpContext;
error: ErrorContext;
evt: {
category: RumEventCategory.ERROR;
};
message: string;
}
export interface RumViewEvent {
date: number;
duration: number;
evt: {
category: RumEventCategory.VIEW;
};
rum: {
documentVersion: number;
};
view: {
loadingTime?: number;
loadingType: ViewLoadingType;
measures: ViewMeasures;
};
}
export interface RumLongTaskEvent {
date: number;
duration: number;
evt: {
category: RumEventCategory.LONG_TASK;
};
}
export interface RumUserActionEvent {
date?: number;
duration?: number;
evt: {
category: RumEventCategory.USER_ACTION;
name: string;
};
userAction: {
id?: string;
type: UserActionType;
measures?: UserActionMeasures;
};
}
export declare type RawRumEvent = RumErrorEvent | RumResourceEvent | RumViewEvent | RumLongTaskEvent | RumUserActionEvent;
import { InternalContext, RumResourceEvent, RumViewEvent } from './types';
import { CustomUserAction } from './userActionCollection';
export declare function startRum(userConfiguration: RumUserConfiguration, getGlobalContext: () => Context): {

@@ -109,2 +21,1 @@ getInternalContext(startTime?: number | undefined): InternalContext | undefined;

export declare function handleResourceEntry(lifeCycle: LifeCycle, session: RumSession, handler: (startTime: number, event: RumResourceEvent) => void, entry: RumPerformanceResourceTiming): void;
export {};

@@ -6,14 +6,2 @@ import { Context, UserConfiguration } from '@datadog/browser-core';

}
export interface InternalContext {
application_id: string;
session_id: string | undefined;
view?: {
id: string;
url: string;
referrer: string;
};
user_action?: {
id: string;
};
}
export declare type RumGlobal = ReturnType<typeof makeRumGlobal>;

@@ -25,3 +13,3 @@ export declare const datadogRum: {

setRumGlobalContext: (newContext: Context) => void;
getInternalContext: (startTime?: number | undefined) => InternalContext | undefined;
getInternalContext: (startTime?: number | undefined) => import("./types").InternalContext | undefined;
addUserAction: (name: string, context?: Context | undefined) => void;

@@ -37,3 +25,3 @@ } & {

setRumGlobalContext: (newContext: Context) => void;
getInternalContext: (startTime?: number | undefined) => InternalContext | undefined;
getInternalContext: (startTime?: number | undefined) => import("./types").InternalContext | undefined;
addUserAction: (name: string, context?: Context | undefined) => void;

@@ -40,0 +28,0 @@ } & {

import { BoundedBuffer, buildCookieOptions, checkCookiesAuthorized, checkIsNotLocalFile, createContextManager, deepClone, defineGlobal, getGlobalObject, isPercentage, makeGlobal, monitor, } from '@datadog/browser-core';
import { startRum } from './rum';
import { UserActionType } from './userActionCollection';
import { ActionType } from './userActionCollection';
export var datadogRum = makeRumGlobal(startRum);

@@ -46,3 +46,3 @@ defineGlobal(getGlobalObject(), 'DD_RUM', datadogRum);

startTime: performance.now(),
type: UserActionType.CUSTOM,
type: ActionType.CUSTOM,
});

@@ -49,0 +49,0 @@ }),

import { __assign } from "tslib";
import { combine, commonInit, generateUUID, getTimestamp, includes, msToNs, RequestType, ResourceKind, withSnakeCaseKeys, } from '@datadog/browser-core';
import { combine, commonInit, generateUUID, getTimestamp, includes, msToNs, RequestType, ResourceType, withSnakeCaseKeys, } from '@datadog/browser-core';
import { startRumAssembly } from './assembly';
import { startRumAssemblyV2 } from './assemblyV2';
import { startRumBatch } from './batch';

@@ -15,12 +16,5 @@ import { buildEnv } from './buildEnv';

import { startRumSession } from './rumSession';
import { RumEventCategory, } from './types';
import { startUserActionCollection } from './userActionCollection';
import { startViewCollection } from './viewCollection';
export var RumEventCategory;
(function (RumEventCategory) {
RumEventCategory["USER_ACTION"] = "user_action";
RumEventCategory["ERROR"] = "error";
RumEventCategory["LONG_TASK"] = "long_task";
RumEventCategory["VIEW"] = "view";
RumEventCategory["RESOURCE"] = "resource";
})(RumEventCategory || (RumEventCategory = {}));
export function startRum(userConfiguration, getGlobalContext) {

@@ -63,4 +57,5 @@ var lifeCycle = new LifeCycle();

startRumAssembly(applicationId, configuration, lifeCycle, session, parentContexts, getGlobalContext);
startRumAssemblyV2(applicationId, configuration, lifeCycle, session, parentContexts, getGlobalContext);
trackRumEvents(lifeCycle, session);
startLongTaskCollection(lifeCycle);
startLongTaskCollection(lifeCycle, configuration);
startViewCollection(location, lifeCycle);

@@ -157,3 +152,3 @@ return {

var timing = matchRequestTiming(request);
var kind = request.type === RequestType.XHR ? ResourceKind.XHR : ResourceKind.FETCH;
var kind = request.type === RequestType.XHR ? ResourceType.XHR : ResourceType.FETCH;
var startTime = timing ? timing.startTime : request.startTime;

@@ -202,3 +197,3 @@ var hasBeenTraced = request.traceId && request.spanId;

var resourceKind = computeResourceKind(entry);
if (includes([ResourceKind.XHR, ResourceKind.FETCH], resourceKind)) {
if (includes([ResourceType.XHR, ResourceType.FETCH], resourceKind)) {
return;

@@ -205,0 +200,0 @@ }

import { Context } from '@datadog/browser-core';
import { LifeCycle } from './lifeCycle';
export declare enum UserActionType {
export declare enum ActionType {
CLICK = "click",
CUSTOM = "custom"
}
declare type AutoUserActionType = UserActionType.CLICK;
declare type AutoUserActionType = ActionType.CLICK;
export interface UserActionMeasures {

@@ -14,3 +14,3 @@ errorCount: number;

export interface CustomUserAction {
type: UserActionType.CUSTOM;
type: ActionType.CUSTOM;
name: string;

@@ -17,0 +17,0 @@ startTime: number;

@@ -6,7 +6,7 @@ import { DOM_EVENT, generateUUID } from '@datadog/browser-core';

import { waitIdlePageActivity } from './trackPageActivities';
export var UserActionType;
(function (UserActionType) {
UserActionType["CLICK"] = "click";
UserActionType["CUSTOM"] = "custom";
})(UserActionType || (UserActionType = {}));
export var ActionType;
(function (ActionType) {
ActionType["CLICK"] = "click";
ActionType["CUSTOM"] = "custom";
})(ActionType || (ActionType = {}));
export function startUserActionCollection(lifeCycle) {

@@ -27,3 +27,3 @@ var userAction = startUserActionManagement(lifeCycle);

}
userAction.create(UserActionType.CLICK, name);
userAction.create(ActionType.CLICK, name);
}

@@ -30,0 +30,0 @@ return {

{
"name": "@datadog/browser-rum",
"version": "1.24.0",
"version": "1.24.1",
"license": "Apache-2.0",

@@ -16,3 +16,3 @@ "main": "cjs/index.js",

"dependencies": {
"@datadog/browser-core": "1.24.0",
"@datadog/browser-core": "1.24.1",
"tslib": "^1.10.0"

@@ -22,2 +22,3 @@ },

"@types/sinon": "7.0.13",
"ajv": "6.12.6",
"sinon": "7.3.2"

@@ -30,3 +31,3 @@ },

},
"gitHead": "e161cbd59fa9c6568579036c42d1ec214e938117"
"gitHead": "0eef20c05fe9654815b7c1599b8357cfeaa10ce5"
}
import { combine, Configuration, Context, withSnakeCaseKeys } from '@datadog/browser-core'
import { LifeCycle, LifeCycleEventType } from './lifeCycle'
import { ActionContext, ParentContexts, ViewContext } from './parentContexts'
import {
RawRumEvent,
RumErrorEvent,
RumEventCategory,
RumLongTaskEvent,
RumResourceEvent,
RumUserActionEvent,
RumViewEvent,
} from './rum'
import { ParentContexts } from './parentContexts'
import { RumSession } from './rumSession'
import { RawRumEvent, RumContext, RumErrorEvent, RumEventCategory, RumLongTaskEvent, RumResourceEvent } from './types'

@@ -19,18 +11,2 @@ interface BrowserWindow extends Window {

interface RumContext {
applicationId: string
date: number
service?: string
session: {
type: string
}
}
export type RumEvent =
| RumErrorEvent & ActionContext & ViewContext & RumContext
| RumResourceEvent & ActionContext & ViewContext & RumContext
| RumViewEvent & ViewContext & RumContext
| RumLongTaskEvent & ActionContext & ViewContext & RumContext
| RumUserActionEvent & ViewContext & RumContext
enum SessionType {

@@ -37,0 +13,0 @@ SYNTHETICS = 'synthetics',

import { Batch, combine, Configuration, Context, HttpRequest } from '@datadog/browser-core'
import { RumEvent } from './assembly'
import { LifeCycle, LifeCycleEventType } from './lifeCycle'
import { RumEventCategory } from './rum'
import { RumEvent, RumEventCategory } from './types'
import { RumEventType, RumEventV2 } from './typesV2'

@@ -20,2 +20,13 @@ export function startRumBatch(configuration: Configuration, lifeCycle: LifeCycle) {

lifeCycle.subscribe(
LifeCycleEventType.RUM_EVENT_V2_COLLECTED,
({ rumEvent, serverRumEvent }: { rumEvent: RumEventV2; serverRumEvent: Context }) => {
if (rumEvent.type === RumEventType.VIEW) {
batch.upsert(serverRumEvent, rumEvent.view.id)
} else {
batch.add(serverRumEvent)
}
}
)
return {

@@ -22,0 +33,0 @@ stop() {

export { Datacenter } from '@datadog/browser-core'
export { RumUserConfiguration, RumGlobal, datadogRum, InternalContext } from './rum.entry'
export { RumEventCategory, RumResourceEvent, RumViewEvent, RumUserActionEvent } from './rum'
export { RumEvent } from './assembly'
export { RumUserConfiguration, RumGlobal, datadogRum } from './rum.entry'
export {
InternalContext,
RumEvent,
RumEventCategory,
RumUserActionEvent,
RumViewEvent,
RumResourceEvent,
} from './types'
import { Context, ErrorMessage } from '@datadog/browser-core'
import { RumEvent } from './assembly'
import { RumPerformanceEntry } from './performanceCollection'
import { RequestCompleteEvent, RequestStartEvent } from './requestCollection'
import { RawRumEvent } from './rum'
import { RawRumEvent, RumEvent } from './types'
import { RawRumEventV2, RumEventV2 } from './typesV2'
import { AutoActionCreatedEvent, AutoUserAction, CustomUserAction } from './userActionCollection'

@@ -25,3 +25,5 @@ import { View, ViewCreatedEvent } from './viewCollection'

RAW_RUM_EVENT_COLLECTED,
RAW_RUM_EVENT_V2_COLLECTED,
RUM_EVENT_COLLECTED,
RUM_EVENT_V2_COLLECTED,
}

@@ -65,3 +67,16 @@

): void
notify(
eventType: LifeCycleEventType.RAW_RUM_EVENT_V2_COLLECTED,
data: {
startTime: number
rawRumEvent: RawRumEventV2
savedGlobalContext?: Context
customerContext?: Context
}
): void
notify(eventType: LifeCycleEventType.RUM_EVENT_COLLECTED, data: { rumEvent: RumEvent; serverRumEvent: Context }): void
notify(
eventType: LifeCycleEventType.RUM_EVENT_V2_COLLECTED,
data: { rumEvent: RumEventV2; serverRumEvent: Context }
): void
notify(eventType: LifeCycleEventType, data?: any) {

@@ -114,5 +129,18 @@ const eventCallbacks = this.callbacks[eventType]

subscribe(
eventType: LifeCycleEventType.RAW_RUM_EVENT_V2_COLLECTED,
callback: (data: {
startTime: number
rawRumEvent: RawRumEventV2
savedGlobalContext?: Context
customerContext?: Context
}) => void
): void
subscribe(
eventType: LifeCycleEventType.RUM_EVENT_COLLECTED,
callback: (data: { rumEvent: RumEvent; serverRumEvent: Context }) => void
): void
subscribe(
eventType: LifeCycleEventType.RUM_EVENT_V2_COLLECTED,
callback: (data: { rumEvent: RumEventV2; serverRumEvent: Context }) => void
): void
subscribe(eventType: LifeCycleEventType, callback: (data?: any) => void) {

@@ -119,0 +147,0 @@ if (!this.callbacks[eventType]) {

@@ -1,6 +0,7 @@

import { getTimestamp, msToNs } from '@datadog/browser-core'
import { Configuration, getTimestamp, msToNs } from '@datadog/browser-core'
import { LifeCycle, LifeCycleEventType } from './lifeCycle'
import { RumEventCategory, RumLongTaskEvent } from './rum'
import { RumEventCategory, RumLongTaskEvent } from './types'
import { RumEventType, RumLongTaskEventV2 } from './typesV2'
export function startLongTaskCollection(lifeCycle: LifeCycle) {
export function startLongTaskCollection(lifeCycle: LifeCycle, configuration: Configuration) {
lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, (entry) => {

@@ -10,14 +11,28 @@ if (entry.entryType !== 'longtask') {

}
const rawRumEvent: RumLongTaskEvent = {
date: getTimestamp(entry.startTime),
duration: msToNs(entry.duration),
evt: {
category: RumEventCategory.LONG_TASK,
},
if (configuration.isEnabled('v2_format')) {
const rawRumEvent: RumLongTaskEventV2 = {
date: getTimestamp(entry.startTime),
longTask: {
duration: msToNs(entry.duration),
},
type: RumEventType.LONG_TASK,
}
lifeCycle.notify(LifeCycleEventType.RAW_RUM_EVENT_V2_COLLECTED, {
rawRumEvent,
startTime: entry.startTime,
})
} else {
const rawRumEvent: RumLongTaskEvent = {
date: getTimestamp(entry.startTime),
duration: msToNs(entry.duration),
evt: {
category: RumEventCategory.LONG_TASK,
},
}
lifeCycle.notify(LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, {
rawRumEvent,
startTime: entry.startTime,
})
}
lifeCycle.notify(LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, {
rawRumEvent,
startTime: entry.startTime,
})
})
}

@@ -1,4 +0,6 @@

import { Context, monitor, ONE_MINUTE, SESSION_TIME_OUT_DELAY } from '@datadog/browser-core'
import { monitor, ONE_MINUTE, SESSION_TIME_OUT_DELAY } from '@datadog/browser-core'
import { LifeCycle, LifeCycleEventType } from './lifeCycle'
import { RumSession } from './rumSession'
import { ActionContext, ViewContext } from './types'
import { ActionContextV2, ViewContextV2 } from './typesV2'
import { AutoActionCreatedEvent, AutoUserAction } from './userActionCollection'

@@ -11,17 +13,2 @@ import { ViewCreatedEvent } from './viewCollection'

export interface ViewContext extends Context {
sessionId: string | undefined
view: {
id: string
url: string
referrer: string
}
}
export interface ActionContext extends Context {
userAction: {
id: string
}
}
interface PreviousContext<T> {

@@ -35,3 +22,5 @@ startTime: number

findAction: (startTime?: number) => ActionContext | undefined
findActionV2: (startTime?: number) => ActionContextV2 | undefined
findView: (startTime?: number) => ViewContext | undefined
findViewV2: (startTime?: number) => ViewContextV2 | undefined
stop: () => void

@@ -147,9 +136,32 @@ }

return {
const parentContexts: ParentContexts = {
findAction: (startTime) => {
return findContext(buildCurrentActionContext, previousActions, currentAction, startTime)
},
findActionV2: (startTime) => {
const actionContext = parentContexts.findAction(startTime)
if (!actionContext) {
return
}
return {
action: {
id: actionContext.userAction.id,
},
}
},
findView: (startTime) => {
return findContext(buildCurrentViewContext, previousViews, currentView, startTime)
},
findViewV2: (startTime) => {
const viewContext = parentContexts.findView(startTime)
if (!viewContext) {
return
}
return {
session: {
id: viewContext.sessionId,
},
view: viewContext.view,
}
},
stop: () => {

@@ -159,2 +171,3 @@ window.clearInterval(clearOldContextsInterval)

}
return parentContexts
}

@@ -9,26 +9,38 @@ import {

msToNs,
ResourceKind,
ResourceType,
} from '@datadog/browser-core'
import { RumPerformanceResourceTiming } from './performanceCollection'
import { PerformanceResourceDetails } from './rum'
import { RumSession } from './rumSession'
export interface PerformanceResourceDetailsElement {
duration: number
start: number
}
export interface PerformanceResourceDetails {
redirect?: PerformanceResourceDetailsElement
dns?: PerformanceResourceDetailsElement
connect?: PerformanceResourceDetailsElement
ssl?: PerformanceResourceDetailsElement
firstByte: PerformanceResourceDetailsElement
download: PerformanceResourceDetailsElement
}
export const FAKE_INITIAL_DOCUMENT = 'initial_document'
const RESOURCE_TYPES: Array<[ResourceKind, (initiatorType: string, path: string) => boolean]> = [
[ResourceKind.DOCUMENT, (initiatorType: string) => FAKE_INITIAL_DOCUMENT === initiatorType],
[ResourceKind.XHR, (initiatorType: string) => 'xmlhttprequest' === initiatorType],
[ResourceKind.FETCH, (initiatorType: string) => 'fetch' === initiatorType],
[ResourceKind.BEACON, (initiatorType: string) => 'beacon' === initiatorType],
[ResourceKind.CSS, (_: string, path: string) => path.match(/\.css$/i) !== null],
[ResourceKind.JS, (_: string, path: string) => path.match(/\.js$/i) !== null],
const RESOURCE_TYPES: Array<[ResourceType, (initiatorType: string, path: string) => boolean]> = [
[ResourceType.DOCUMENT, (initiatorType: string) => FAKE_INITIAL_DOCUMENT === initiatorType],
[ResourceType.XHR, (initiatorType: string) => 'xmlhttprequest' === initiatorType],
[ResourceType.FETCH, (initiatorType: string) => 'fetch' === initiatorType],
[ResourceType.BEACON, (initiatorType: string) => 'beacon' === initiatorType],
[ResourceType.CSS, (_: string, path: string) => path.match(/\.css$/i) !== null],
[ResourceType.JS, (_: string, path: string) => path.match(/\.js$/i) !== null],
[
ResourceKind.IMAGE,
ResourceType.IMAGE,
(initiatorType: string, path: string) =>
includes(['image', 'img', 'icon'], initiatorType) || path.match(/\.(gif|jpg|jpeg|tiff|png|svg|ico)$/i) !== null,
],
[ResourceKind.FONT, (_: string, path: string) => path.match(/\.(woff|eot|woff2|ttf)$/i) !== null],
[ResourceType.FONT, (_: string, path: string) => path.match(/\.(woff|eot|woff2|ttf)$/i) !== null],
[
ResourceKind.MEDIA,
ResourceType.MEDIA,
(initiatorType: string, path: string) =>

@@ -43,3 +55,3 @@ includes(['audio', 'video'], initiatorType) || path.match(/\.(mp3|mp4)$/i) !== null,

addMonitoringMessage(`Failed to construct URL for "${timing.name}"`)
return ResourceKind.OTHER
return ResourceType.OTHER
}

@@ -52,3 +64,3 @@ const path = getPathName(url)

}
return ResourceKind.OTHER
return ResourceType.OTHER
}

@@ -55,0 +67,0 @@

@@ -6,3 +6,2 @@ import {

checkIsNotLocalFile,
combine,
Context,

@@ -20,3 +19,3 @@ createContextManager,

import { startRum } from './rum'
import { CustomUserAction, UserActionType } from './userActionCollection'
import { ActionType, CustomUserAction } from './userActionCollection'

@@ -27,15 +26,2 @@ export interface RumUserConfiguration extends UserConfiguration {

export interface InternalContext {
application_id: string
session_id: string | undefined
view?: {
id: string
url: string
referrer: string
}
user_action?: {
id: string
}
}
export type RumGlobal = ReturnType<typeof makeRumGlobal>

@@ -102,3 +88,3 @@

startTime: performance.now(),
type: UserActionType.CUSTOM,
type: ActionType.CUSTOM,
})

@@ -105,0 +91,0 @@ }),

@@ -6,14 +6,13 @@ import {

Context,
ErrorContext,
ErrorMessage,
generateUUID,
getTimestamp,
HttpContext,
includes,
msToNs,
RequestType,
ResourceKind,
ResourceType,
withSnakeCaseKeys,
} from '@datadog/browser-core'
import { startRumAssembly } from './assembly'
import { startRumAssemblyV2 } from './assemblyV2'
import { startRumBatch } from './batch'

@@ -35,104 +34,17 @@

} from './resourceUtils'
import { InternalContext, RumUserConfiguration } from './rum.entry'
import { RumUserConfiguration } from './rum.entry'
import { RumSession, startRumSession } from './rumSession'
import { CustomUserAction, startUserActionCollection, UserActionMeasures, UserActionType } from './userActionCollection'
import { startViewCollection, ViewLoadingType, ViewMeasures } from './viewCollection'
import {
InternalContext,
RawRumEvent,
RumErrorEvent,
RumEventCategory,
RumLongTaskEvent,
RumResourceEvent,
RumUserActionEvent,
RumViewEvent,
} from './types'
import { CustomUserAction, startUserActionCollection } from './userActionCollection'
import { startViewCollection } from './viewCollection'
export enum RumEventCategory {
USER_ACTION = 'user_action',
ERROR = 'error',
LONG_TASK = 'long_task',
VIEW = 'view',
RESOURCE = 'resource',
}
interface PerformanceResourceDetailsElement {
duration: number
start: number
}
export interface PerformanceResourceDetails {
redirect?: PerformanceResourceDetailsElement
dns?: PerformanceResourceDetailsElement
connect?: PerformanceResourceDetailsElement
ssl?: PerformanceResourceDetailsElement
firstByte: PerformanceResourceDetailsElement
download: PerformanceResourceDetailsElement
}
export interface RumResourceEvent {
date: number
duration: number
evt: {
category: RumEventCategory.RESOURCE
}
http: {
performance?: PerformanceResourceDetails
method?: string
statusCode?: number
url: string
}
network: {
bytesWritten?: number
}
resource: {
kind: ResourceKind
id?: string // only for traced requests
}
_dd?: {
traceId: string
spanId?: string // not available for initial document tracing
}
}
export interface RumErrorEvent {
date: number
http?: HttpContext
error: ErrorContext
evt: {
category: RumEventCategory.ERROR
}
message: string
}
export interface RumViewEvent {
date: number
duration: number
evt: {
category: RumEventCategory.VIEW
}
rum: {
documentVersion: number
}
view: {
loadingTime?: number
loadingType: ViewLoadingType
measures: ViewMeasures
}
}
export interface RumLongTaskEvent {
date: number
duration: number
evt: {
category: RumEventCategory.LONG_TASK
}
}
export interface RumUserActionEvent {
date?: number
duration?: number
evt: {
category: RumEventCategory.USER_ACTION
name: string
}
userAction: {
id?: string
type: UserActionType
measures?: UserActionMeasures
}
}
export type RawRumEvent = RumErrorEvent | RumResourceEvent | RumViewEvent | RumLongTaskEvent | RumUserActionEvent
export function startRum(userConfiguration: RumUserConfiguration, getGlobalContext: () => Context) {

@@ -213,4 +125,5 @@ const lifeCycle = new LifeCycle()

startRumAssembly(applicationId, configuration, lifeCycle, session, parentContexts, getGlobalContext)
startRumAssemblyV2(applicationId, configuration, lifeCycle, session, parentContexts, getGlobalContext)
trackRumEvents(lifeCycle, session)
startLongTaskCollection(lifeCycle)
startLongTaskCollection(lifeCycle, configuration)
startViewCollection(location, lifeCycle)

@@ -350,3 +263,3 @@

const timing = matchRequestTiming(request)
const kind = request.type === RequestType.XHR ? ResourceKind.XHR : ResourceKind.FETCH
const kind = request.type === RequestType.XHR ? ResourceType.XHR : ResourceType.FETCH
const startTime = timing ? timing.startTime : request.startTime

@@ -406,3 +319,3 @@ const hasBeenTraced = request.traceId && request.spanId

const resourceKind = computeResourceKind(entry)
if (includes([ResourceKind.XHR, ResourceKind.FETCH], resourceKind)) {
if (includes([ResourceType.XHR, ResourceType.FETCH], resourceKind)) {
return

@@ -409,0 +322,0 @@ }

@@ -7,3 +7,3 @@ import { Context, DOM_EVENT, generateUUID } from '@datadog/browser-core'

export enum UserActionType {
export enum ActionType {
CLICK = 'click',

@@ -13,3 +13,3 @@ CUSTOM = 'custom',

type AutoUserActionType = UserActionType.CLICK
type AutoUserActionType = ActionType.CLICK

@@ -23,3 +23,3 @@ export interface UserActionMeasures {

export interface CustomUserAction {
type: UserActionType.CUSTOM
type: ActionType.CUSTOM
name: string

@@ -62,3 +62,3 @@ startTime: number

userAction.create(UserActionType.CLICK, name)
userAction.create(ActionType.CLICK, name)
}

@@ -65,0 +65,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc