Socket
Socket
Sign inDemoInstall

@datadog/browser-logs

Package Overview
Dependencies
1
Maintainers
1
Versions
247
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.39.0 to 4.40.0

2

bundle/datadog-logs.js

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

!function(){"use strict";var e={log:"log",debug:"debug",info:"info",warn:"warn",error:"error"},t=function(n){for(var r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];Object.prototype.hasOwnProperty.call(e,n)||(n=e.log),t[n].apply(t,r)};function n(e,n){return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];try{return e.apply(void 0,r)}catch(e){t.error(n,e)}}}t.debug=console.debug.bind(console),t.log=console.log.bind(console),t.info=console.info.bind(console),t.warn=console.warn.bind(console),t.error=console.error.bind(console);var r,o,i=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},a=!1;function s(e){a=e}function u(e,t,n){var o=n.value;n.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=r?c(o):o;return n.apply(this,e)}}function c(e){return function(){return f(e,this,arguments)}}function f(t,n,o){try{return t.apply(n,o)}catch(t){if(l(e.error,t),r)try{r(t)}catch(t){l(e.error,t)}}}function l(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];a&&t.apply(void 0,i([e,"[MONITOR]"],n,!1))}function d(e,t){return-1!==e.indexOf(t)}function v(e){if(Array.from)return Array.from(e);var t=[];if(e instanceof Set)e.forEach((function(e){return t.push(e)}));else for(var n=0;n<e.length;n++)t.push(e[n]);return t}function p(e){return Object.keys(e).map((function(t){return e[t]}))}function g(e,t){return e.slice(0,t.length)===t}function h(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.forEach((function(t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})),e}function y(){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}!function(e){e.PAGEHIDE="pagehide",e.FEATURE_FLAGS="feature_flags",e.RESOURCE_PAGE_STATES="resource_page_states",e.CLICKMAP="clickmap",e.COLLECT_FLUSH_REASON="collect_flush_reason",e.SANITIZE_INPUTS="sanitize_inputs"}(o||(o={}));var m=new Set;function b(e){return m.has(e)}function w(){return m}var S=/[^\u0000-\u007F]/;function k(e){return S.test(e)?void 0!==window.TextEncoder?(new TextEncoder).encode(e).length:new Blob([e]).size:e.length}function C(e,t){var n,r=y();return r.Zone&&"function"==typeof r.Zone.__symbol__&&(n=e[r.Zone.__symbol__(t)]),n||(n=e[t]),n}function E(e,t){return C(y(),"setTimeout")(c(e),t)}function x(e){C(y(),"clearTimeout")(e)}function _(e,t){return C(window,"setInterval")(c(e),t)}function T(e){C(window,"clearInterval")(e)}function R(e,t,n){var r,o,i=!n||void 0===n.leading||n.leading,a=!n||void 0===n.trailing||n.trailing,s=!1;return{throttled:function(){for(var n=[],u=0;u<arguments.length;u++)n[u]=arguments[u];s?r=n:(i?e.apply(void 0,n):r=n,s=!0,o=E((function(){a&&r&&e.apply(void 0,r),s=!1,r=void 0}),t))},cancel:function(){x(o),s=!1,r=void 0}}}function O(){}function L(e){return null===e?"null":Array.isArray(e)?"array":typeof e}function A(e,t,n){if(void 0===n&&(n=function(){if("undefined"!=typeof WeakSet){var e=new WeakSet;return{hasAlreadyBeenSeen:function(t){var n=e.has(t);return n||e.add(t),n}}}var t=[];return{hasAlreadyBeenSeen:function(e){var n=t.indexOf(e)>=0;return n||t.push(e),n}}}()),void 0===t)return e;if("object"!=typeof t||null===t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){var r=t.flags||[t.global?"g":"",t.ignoreCase?"i":"",t.multiline?"m":"",t.sticky?"y":"",t.unicode?"u":""].join("");return new RegExp(t.source,r)}if(!n.hasAlreadyBeenSeen(t)){if(Array.isArray(t)){for(var o=Array.isArray(e)?e:[],i=0;i<t.length;++i)o[i]=A(o[i],t[i],n);return o}var a="object"===L(e)?e:{};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(a[s]=A(a[s],t[s],n));return a}}function I(e){return A(void 0,e)}function P(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=0,o=t;r<o.length;r++){var i=o[r];null!=i&&(e=A(e,i))}return e}function B(e,t,n){if("object"!=typeof e||null===e)return JSON.stringify(e);var r=N(Object.prototype),o=N(Array.prototype),i=N(Object.getPrototypeOf(e)),a=N(e);try{return JSON.stringify(e,t,n)}catch(e){return"<error: unable to serialize object>"}finally{r(),o(),i(),a()}}function N(e){var t=e,n=t.toJSON;return n?(delete t.toJSON,function(){t.toJSON=n}):O}function U(e,t){var n;void 0===t&&(t=225280);var r=N(Object.prototype),o=N(Array.prototype),i=[],a=new WeakMap,s=q(e,"$",void 0,i,a),u=(null===(n=JSON.stringify(s))||void 0===n?void 0:n.length)||0;if(!(u>t)){for(;i.length>0&&u<t;){var c=i.shift(),f=0;if(Array.isArray(c.source))for(var l=0;l<c.source.length;l++){if(u+=void 0!==(d=q(c.source[l],c.path,l,i,a))?JSON.stringify(d).length:4,u+=f,f=1,u>t){j(t,"truncated",e);break}c.target[l]=d}else for(var l in c.source)if(Object.prototype.hasOwnProperty.call(c.source,l)){var d;if(void 0!==(d=q(c.source[l],c.path,l,i,a))&&(u+=JSON.stringify(d).length+f+l.length+3,f=1),u>t){j(t,"truncated",e);break}c.target[l]=d}}return r(),o(),s}j(t,"discarded",e)}function q(e,t,n,r,o){var i=function(e){var t=e;if(t&&"function"==typeof t.toJSON)try{return t.toJSON()}catch(e){}return e}(e);if(!i||"object"!=typeof i)return function(e){if("bigint"==typeof e)return"[BigInt] ".concat(e.toString());if("function"==typeof e)return"[Function] ".concat(e.name||"unknown");if("symbol"==typeof e)return"[Symbol] ".concat(e.description||e.toString());return e}(i);var a=function(e){try{if(e instanceof Event)return{isTrusted:e.isTrusted};var t=Object.prototype.toString.call(e).match(/\[object (.*)\]/);if(t&&t[1])return"[".concat(t[1],"]")}catch(e){}return"[Unserializable]"}(i);if("[Object]"!==a&&"[Array]"!==a)return a;var s=e;if(o.has(s))return"[Reference seen at ".concat(o.get(s),"]");var u=void 0!==n?"".concat(t,".").concat(n):t,c=Array.isArray(i)?[]:{};return o.set(s,u),r.push({source:i,target:c,path:u}),c}function j(e,n,r){t.warn("The data provided has been ".concat(n," as it is over the limit of ").concat(e," characters:"),r)}function M(e,n){void 0===n&&(n=k);var r,i={},a=!1,s=R((function(o){r=n(B(o)),a||(a=function(e,n){return e>3072&&(t.warn("The ".concat(n," data is over ").concat(3,"KiB. On low connectivity, the SDK has the potential to exhaust the user's upload bandwidth.")),!0)}(r,e))}),200).throttled;return{getBytesCount:function(){return r},get:function(){return i},add:function(e,t){i[e]=t,s(i)},remove:function(e){delete i[e],s(i)},set:function(e){s(i=e)},getContext:function(){return I(i)},setContext:function(e){i=b(o.SANITIZE_INPUTS)?U(e):I(e),s(i)},setContextProperty:function(e,t){i[e]=b(o.SANITIZE_INPUTS)?U(t):I(t),s(i)},removeContextProperty:function(e){delete i[e],s(i)},clearContext:function(){i={},r=0}}}var D,F=function(){function e(){this.buffer=[]}return e.prototype.add=function(e){this.buffer.push(e)>500&&this.buffer.splice(0,1)},e.prototype.drain=function(){this.buffer.forEach((function(e){return e()})),this.buffer.length=0},e}(),H=1e3,G=6e4;function z(){return(new Date).getTime()}function Z(){return z()}function J(){return performance.now()}function V(){return{relative:J(),timeStamp:Z()}}function $(){return void 0===D&&(D=performance.timing.navigationStart),D}function W(){var e=y().DatadogEventBridge;if(e)return{getAllowedWebViewHosts:function(){return JSON.parse(e.getAllowedWebViewHosts())},send:function(t,n){e.send(JSON.stringify({eventType:t,event:n}))}}}function X(e){var t;void 0===e&&(e=null===(t=y().location)||void 0===t?void 0:t.hostname);var n=W();return!!n&&n.getAllowedWebViewHosts().some((function(t){return e===t||(n=e,r=".".concat(t),n.slice(-r.length)===r);var n,r}))}function K(e){var t=h({},e);return["id","name","email"].forEach((function(e){e in t&&(t[e]=String(t[e]))})),t}function Y(e){return e?(parseInt(e,10)^16*Math.random()>>parseInt(e,10)/4).toString(16):"".concat(1e7,"-").concat(1e3,"-").concat(4e3,"-").concat(8e3,"-").concat(1e11).replace(/[018]/g,Y)}function Q(e,t,n){void 0===n&&(n="");var r=e.charCodeAt(t-1),o=r>=55296&&r<=56319?t+1:t;return e.length<=o?e:"".concat(e.slice(0,o)).concat(n)}var ee;function te(e,t,n,r){var o=new Date;o.setTime(o.getTime()+n);var i="expires=".concat(o.toUTCString()),a=r&&r.crossSite?"none":"strict",s=r&&r.domain?";domain=".concat(r.domain):"",u=r&&r.secure?";secure":"";document.cookie="".concat(e,"=").concat(t,";").concat(i,";path=/;samesite=").concat(a).concat(s).concat(u)}function ne(e){return function(e,t){var n=new RegExp("(?:^|;)\\s*".concat(t,"\\s*=\\s*([^;]+)")).exec(e);return n?n[1]:void 0}(document.cookie,e)}function re(e,t){te(e,"",0,t)}function oe(e){return 0!==e&&100*Math.random()<=e}function ie(e){return function(e){return"number"==typeof e}(e)&&e>=0&&e<=100}function ae(e){return 0===Object.keys(e).length}function se(e){return ue(e,le(window.location)).href}function ue(e,t){var n=function(){if(void 0===ce)try{var e=new fe("http://test/path");ce="http://test/path"===e.href}catch(e){ce=!1}return ce?fe:void 0}();if(n)try{return void 0!==t?new n(e,t):new n(e)}catch(n){throw new Error("Failed to construct URL: ".concat(String(n)," ").concat(B({url:e,base:t})))}if(void 0===t&&!/:/.test(e))throw new Error("Invalid URL: '".concat(e,"'"));var r=document,o=r.createElement("a");if(void 0!==t){var i=(r=document.implementation.createHTMLDocument("")).createElement("base");i.href=t,r.head.appendChild(i),r.body.appendChild(o)}return o.href=e,o}var ce,fe=URL;function le(e){if(e.origin)return e.origin;var t=e.host.replace(/(:80|:443)$/,"");return"".concat(e.protocol,"//").concat(t)}var de="datadoghq.com",ve="ap1.datadoghq.com",pe={logs:"logs",rum:"rum",sessionReplay:"session-replay"},ge={logs:"logs",rum:"rum",sessionReplay:"replay"};function he(e,t,n){var r=function(e,t){var n="/api/v2/".concat(ge[t]),r=e.proxy,o=e.proxyUrl;if(r){var i=se(r);return function(e){return"".concat(i,"?ddforward=").concat(encodeURIComponent("".concat(n,"?").concat(e)))}}var a=function(e,t){var n=e.site,r=void 0===n?de:n,o=e.internalAnalyticsSubdomain;if(o&&r===de)return"".concat(o,".").concat(de);var i=r.split("."),a=i.pop(),s=r!==ve?"".concat(pe[t],"."):"";return"".concat(s,"browser-intake-").concat(i.join("-"),".").concat(a)}(e,t);if(void 0===r&&o){var s=se(o);return function(e){return"".concat(s,"?ddforward=").concat(encodeURIComponent("https://".concat(a).concat(n,"?").concat(e)))}}return function(e){return"https://".concat(a).concat(n,"?").concat(e)}}(e,t);return{build:function(i,a,s){var u=function(e,t,n,r,i,a){var s=e.clientToken,u=e.internalAnalyticsSubdomain,c=["sdk_version:".concat("4.39.0"),"api:".concat(r)].concat(n);i&&b(o.COLLECT_FLUSH_REASON)&&c.push("flush_reason:".concat(i));a&&c.push("retry_count:".concat(a.count),"retry_after:".concat(a.lastFailureStatus));var f=["ddsource=browser","ddtags=".concat(encodeURIComponent(c.join(","))),"dd-api-key=".concat(s),"dd-evp-origin-version=".concat(encodeURIComponent("4.39.0")),"dd-evp-origin=browser","dd-request-id=".concat(Y())];"rum"===t&&f.push("batch_time=".concat(Z()));u&&f.reverse();return f.join("&")}(e,t,n,i,a,s);return r(u)},urlPrefix:r(""),endpointType:t}}var ye=/[^a-z0-9_:./-]/;function me(e,n){var r=200-e.length-1;(n.length>r||ye.test(n))&&t.warn("".concat(e," value doesn't meet tag requirements and will be sanitized"));var o=n.replace(/,/g,"_");return"".concat(e,":").concat(o)}function be(e){var t=function(e){var t=e.env,n=e.service,r=e.version,o=e.datacenter,i=[];return t&&i.push(me("env",t)),n&&i.push(me("service",n)),r&&i.push(me("version",r)),o&&i.push(me("datacenter",o)),i}(e),n=function(e,t){return{logsEndpointBuilder:he(e,"logs",t),rumEndpointBuilder:he(e,"rum",t),sessionReplayEndpointBuilder:he(e,"sessionReplay",t)}}(e,t),r=p(n).map((function(e){return e.urlPrefix})),o=function(e,t,n){if(!e.replica)return;var r=h({},e,{site:de,clientToken:e.replica.clientToken}),o={logsEndpointBuilder:he(r,"logs",n),rumEndpointBuilder:he(r,"rum",n)};return t.push.apply(t,p(o).map((function(e){return e.urlPrefix}))),h({applicationId:e.replica.applicationId},o)}(e,r,t);return h({isIntakeUrl:function(e){return r.some((function(t){return 0===e.indexOf(t)}))},replica:o,site:e.site||de},n)}function we(e){var r,i,a;if(e&&e.clientToken){var s=null!==(r=e.sessionSampleRate)&&void 0!==r?r:e.sampleRate;if(void 0===s||ie(s))if(void 0===e.telemetrySampleRate||ie(e.telemetrySampleRate)){if(void 0===e.telemetryConfigurationSampleRate||ie(e.telemetryConfigurationSampleRate))return Array.isArray(e.enableExperimentalFeatures)&&e.enableExperimentalFeatures.filter((function(e){return t=o,n=e,Object.keys(t).some((function(e){return t[e]===n}));var t,n})).forEach((function(e){m.add(e)})),h({beforeSend:e.beforeSend&&n(e.beforeSend,"beforeSend threw an error:"),cookieOptions:Se(e),sessionSampleRate:null!=s?s:100,telemetrySampleRate:null!==(i=e.telemetrySampleRate)&&void 0!==i?i:20,telemetryConfigurationSampleRate:null!==(a=e.telemetryConfigurationSampleRate)&&void 0!==a?a:5,service:e.service,silentMultipleInit:!!e.silentMultipleInit,batchBytesLimit:16384,eventRateLimiterThreshold:3e3,maxTelemetryEventsPerPage:15,flushTimeout:3e4,batchMessagesLimit:50,messageBytesLimit:262144},be(e));t.error("Telemetry Configuration Sample Rate should be a number between 0 and 100")}else t.error("Telemetry Sample Rate should be a number between 0 and 100");else t.error("Session Sample Rate should be a number between 0 and 100")}else t.error("Client Token is not configured, we will not send any data.")}function Se(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===ee){for(var e="dd_site_test_".concat(Y()),t=window.location.hostname.split("."),n=t.pop();t.length&&!ne(e);)n="".concat(t.pop(),".").concat(n),te(e,"test",H,{domain:n});re(e,{domain:n}),ee=n}return ee}()),t}var ke="?";function Ce(e){var t=[],n=Ie(e,"stack"),r=String(e);return n&&g(n,r)&&(n=n.slice(r.length)),n&&n.split("\n").forEach((function(e){var n=function(e){var t=_e.exec(e);if(!t)return;var n=t[2]&&0===t[2].indexOf("native"),r=t[2]&&0===t[2].indexOf("eval"),o=Te.exec(t[2]);r&&o&&(t[2]=o[1],t[3]=o[2],t[4]=o[3]);return{args:n?[t[2]]:[],column:t[4]?+t[4]:void 0,func:t[1]||ke,line:t[3]?+t[3]:void 0,url:n?void 0:t[2]}}(e)||function(e){var t=Re.exec(e);if(!t)return;return{args:[],column:t[3]?+t[3]:void 0,func:ke,line:t[2]?+t[2]:void 0,url:t[1]}}(e)||function(e){var t=Oe.exec(e);if(!t)return;return{args:[],column:t[4]?+t[4]:void 0,func:t[1]||ke,line:+t[3],url:t[2]}}(e)||function(e){var t=Le.exec(e);if(!t)return;var n=t[3]&&t[3].indexOf(" > eval")>-1,r=Ae.exec(t[3]);n&&r&&(t[3]=r[1],t[4]=r[2],t[5]=void 0);return{args:t[2]?t[2].split(","):[],column:t[5]?+t[5]:void 0,func:t[1]||ke,line:t[4]?+t[4]:void 0,url:t[3]}}(e);n&&(!n.func&&n.line&&(n.func=ke),t.push(n))})),{message:Ie(e,"message"),name:Ie(e,"name"),stack:t}}var Ee="((?:file|https?|blob|chrome-extension|native|eval|webpack|snippet|<anonymous>|\\w+\\.|\\/).*?)",xe="(?::(\\d+))",_e=new RegExp("^\\s*at (.*?) ?\\(".concat(Ee).concat(xe,"?").concat(xe,"?\\)?\\s*$"),"i"),Te=new RegExp("\\((\\S*)".concat(xe).concat(xe,"\\)"));var Re=new RegExp("^\\s*at ?".concat(Ee).concat(xe,"?").concat(xe,"??\\s*$"),"i");var Oe=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;var Le=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,Ae=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;function Ie(e,t){if("object"==typeof e&&e&&t in e){var n=e[t];return"string"==typeof n?n:void 0}}var Pe="agent",Be="console",Ne="logger",Ue="network",qe="source",je="report";function Me(e){var t=e.stackTrace,n=e.originalError,r=e.handlingStack,i=e.startClocks,a=e.nonErrorPrefix,s=e.source,u=e.handling;if(!t||void 0===t.message&&!(n instanceof Error)){var c=b(o.SANITIZE_INPUTS)?U(n):n;return{startClocks:i,source:s,handling:u,originalError:c,message:"".concat(a," ").concat(B(c)),stack:"No stack, consider using an instance of Error",handlingStack:r,type:t&&t.name}}return{startClocks:i,source:s,handling:u,originalError:n,message:t.message||"Empty message",stack:De(t),handlingStack:r,type:t.name,causes:Ge(n,s)}}function De(e){var t=Fe(e);return e.stack.forEach((function(e){var n="?"===e.func?"<anonymous>":e.func,r=e.args&&e.args.length>0?"(".concat(e.args.join(", "),")"):"",o=e.line?":".concat(e.line):"",i=e.line&&e.column?":".concat(e.column):"";t+="\n at ".concat(n).concat(r," @ ").concat(e.url).concat(o).concat(i)})),t}function Fe(e){return"".concat(e.name||"Error",": ").concat(e.message)}function He(){var e,t=new Error;if(!t.stack)try{throw t}catch(e){}return f((function(){var n=Ce(t);n.stack=n.stack.slice(2),e=De(n)})),e}function Ge(e,t){for(var n=e,r=[];(null==n?void 0:n.cause)instanceof Error&&r.length<10;){var o=Ce(n.cause);r.push({message:n.cause.message,source:t,type:null==o?void 0:o.name,stack:o&&De(o)}),n=n.cause}return r.length?r:void 0}var ze=function(){function e(e){this.onFirstSubscribe=e,this.observers=[]}return e.prototype.subscribe=function(e){var t=this;return!this.observers.length&&this.onFirstSubscribe&&(this.onLastUnsubscribe=this.onFirstSubscribe()||void 0),this.observers.push(e),{unsubscribe:function(){t.observers=t.observers.filter((function(t){return e!==t})),!t.observers.length&&t.onLastUnsubscribe&&t.onLastUnsubscribe()}}},e.prototype.notify=function(e){this.observers.forEach((function(t){return t(e)}))},e}();function Ze(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=new ze((function(){var t=e.map((function(e){return e.subscribe((function(e){return n.notify(e)}))}));return function(){return t.forEach((function(e){return e.unsubscribe()}))}}));return n}function Je(e,t,n,r){return Ve(e,[t],n,r)}function Ve(e,t,n,r){var o=void 0===r?{}:r,i=o.once,a=o.capture,s=o.passive,u=c(i?function(e){d(),n(e)}:n),f=s?{capture:a,passive:s}:a,l=C(e,"addEventListener");function d(){var n=C(e,"removeEventListener");t.forEach((function(t){return n.call(e,t,u,f)}))}return t.forEach((function(t){return l.call(e,t,u,f)})),{stop:d}}var $e={intervention:"intervention",deprecation:"deprecation",cspViolation:"csp_violation"};function We(e){var t,n=[];d(e,$e.cspViolation)&&n.push(t=new ze((function(){return Je(document,"securitypolicyviolation",(function(e){t.notify(function(e){var t=$e.cspViolation,n="'".concat(e.blockedURI,"' blocked by '").concat(e.effectiveDirective,"' directive");return{type:$e.cspViolation,subtype:e.effectiveDirective,message:"".concat(t,": ").concat(n),stack:Xe(e.effectiveDirective,e.originalPolicy?"".concat(n,' of the policy "').concat(Q(e.originalPolicy,100,"..."),'"'):"no policy",e.sourceFile,e.lineNumber,e.columnNumber)}}(e))})).stop})));var r=e.filter((function(e){return e!==$e.cspViolation}));return r.length&&n.push(function(e){var t=new ze((function(){if(window.ReportingObserver){var n=c((function(e){return e.forEach((function(e){t.notify(function(e){var t=e.type,n=e.body;return{type:t,subtype:n.id,message:"".concat(t,": ").concat(n.message),stack:Xe(n.id,n.message,n.sourceFile,n.lineNumber,n.columnNumber)}}(e))}))})),r=new window.ReportingObserver(n,{types:e,buffered:!0});return r.observe(),function(){r.disconnect()}}}));return t}(r)),Ze.apply(void 0,n)}function Xe(e,t,n,r,o){return n&&De({name:e,message:t,stack:[{func:"?",url:n,line:r,column:o}]})}function Ke(e,n,r){return void 0===e?[]:"all"===e||Array.isArray(e)&&e.every((function(e){return d(n,e)}))?"all"===e?n:(o=e,i=new Set,o.forEach((function(e){return i.add(e)})),v(i)):void t.error("".concat(r,' should be "all" or an array with allowed values "').concat(n.join('", "'),'"'));var o,i}var Ye=function(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Qe={debug:"debug",error:"error",info:"info",warn:"warn"},et="console",tt="http",nt=Object.keys(Qe),rt=function(){function e(e,t,n,r,o){void 0===n&&(n=tt),void 0===r&&(r=Qe.debug),void 0===o&&(o={}),this.handleLogStrategy=e,this.handlerType=n,this.level=r,this.contextManager=M("logger context"),this.contextManager.set(h({},o,t?{logger:{name:t}}:void 0))}return e.prototype.log=function(e,t,n,r){var i;if(void 0===n&&(n=Qe.info),n===Qe.error&&(i={origin:Ne}),null!=r){var a=Me({stackTrace:r instanceof Error?Ce(r):void 0,originalError:r,nonErrorPrefix:"Provided",source:Ne,handling:"handled",startClocks:V()});i={origin:Ne,stack:a.stack,kind:a.type,message:a.message}}var s=b(o.SANITIZE_INPUTS)?U(t):I(t),u=i?P({error:i},s):s;this.handleLogStrategy({message:b(o.SANITIZE_INPUTS)?U(e):e,context:u,status:n},this)},e.prototype.debug=function(e,t,n){this.log(e,t,Qe.debug,n)},e.prototype.info=function(e,t,n){this.log(e,t,Qe.info,n)},e.prototype.warn=function(e,t,n){this.log(e,t,Qe.warn,n)},e.prototype.error=function(e,t,n){this.log(e,t,Qe.error,n)},e.prototype.setContext=function(e){this.contextManager.set(e)},e.prototype.getContext=function(){return this.contextManager.get()},e.prototype.addContext=function(e,t){this.contextManager.add(e,t)},e.prototype.removeContext=function(e){this.contextManager.remove(e)},e.prototype.setHandler=function(e){this.handlerType=e},e.prototype.getHandler=function(){return this.handlerType},e.prototype.setLevel=function(e){this.level=e},e.prototype.getLevel=function(){return this.level},Ye([u],e.prototype,"log",null),e}();function ot(e,t){var n=window.__ddBrowserSdkExtensionCallback;n&&n({type:e,payload:t})}var it={HIDDEN:"visibility_hidden",UNLOADING:"before_unload",PAGEHIDE:"page_hide",FROZEN:"page_frozen"};function at(){return Boolean(window._DATADOG_SYNTHETICS_INJECTS_RUM||ne("datadog-synthetics-injects-rum"))}function st(){var e=window._DATADOG_SYNTHETICS_RESULT_ID||ne("datadog-synthetics-result-id");return"string"==typeof e?e:void 0}var ut,ct="log",ft="configuration",lt=["https://www.datadoghq-browser-agent.com","https://www.datad0g-browser-agent.com","http://localhost","<anonymous>"],dt=["ddog-gov.com"],vt={maxEventsPerPage:0,sentEventCount:0,telemetryEnabled:!1,telemetryConfigurationEnabled:!1};function pt(e,t){var n,o=new ze;return vt.telemetryEnabled=!d(dt,t.site)&&oe(t.telemetrySampleRate),vt.telemetryConfigurationEnabled=vt.telemetryEnabled&&oe(t.telemetryConfigurationSampleRate),ut=function(t){if(vt.telemetryEnabled){var r=function(e,t){return P({type:"telemetry",date:Z(),service:e,version:"4.39.0",source:"browser",_dd:{format_version:2},telemetry:t,experimental_features:v(w())},void 0!==n?n():{})}(e,t);o.notify(r),ot("telemetry",r)}},r=gt,h(vt,{maxEventsPerPage:t.maxTelemetryEventsPerPage,sentEventCount:0}),{setContextProvider:function(e){n=e},observable:o,enabled:vt.telemetryEnabled}}function gt(e){ht(h({type:ct,status:"error"},function(e){if(e instanceof Error){var t=Ce(e);return{error:{kind:t.name,stack:De(yt(t))},message:t.message}}return{error:{stack:"Not an instance of error"},message:"Uncaught ".concat(B(e))}}(e)))}function ht(e){ut&&vt.sentEventCount<vt.maxEventsPerPage&&(vt.sentEventCount+=1,ut(e))}function yt(e){return e.stack=e.stack.filter((function(e){return!e.url||lt.some((function(t){return g(e.url,t)}))})),e}var mt=function(){function e(e,t,n){var r=this;this.request=e,this.flushController=t,this.messageBytesLimit=n,this.pushOnlyBuffer=[],this.upsertBuffer={},this.flushController.flushObservable.subscribe((function(e){return r.flush(e)}))}return e.prototype.add=function(e){this.addOrUpdate(e)},e.prototype.upsert=function(e,t){this.addOrUpdate(e,t)},e.prototype.flush=function(e){var t=this.pushOnlyBuffer.concat(p(this.upsertBuffer));this.pushOnlyBuffer=[],this.upsertBuffer={};var n,r={data:t.join("\n"),bytesCount:e.bytesCount,flushReason:e.reason};n=e.reason,d(p(it),n)?this.request.sendOnExit(r):this.request.send(r)},e.prototype.addOrUpdate=function(e,n){var r=this.process(e),o=r.processedMessage,i=r.messageBytesCount;i>=this.messageBytesLimit?t.warn("Discarded a message whose size was bigger than the maximum allowed size ".concat(this.messageBytesLimit,"KB.")):(this.hasMessageFor(n)&&this.remove(n),this.push(o,i,n))},e.prototype.process=function(e){var t=B(e);return{processedMessage:t,messageBytesCount:k(t)}},e.prototype.push=function(e,t,n){var r=this.flushController.messagesCount>0?1:0;this.flushController.notifyBeforeAddMessage(t+r),void 0!==n?this.upsertBuffer[n]=e:this.pushOnlyBuffer.push(e),this.flushController.notifyAfterAddMessage()},e.prototype.remove=function(e){var t=this.upsertBuffer[e];delete this.upsertBuffer[e];var n=k(t),r=this.flushController.messagesCount>1?1:0;this.flushController.notifyAfterRemoveMessage(n+r)},e.prototype.hasMessageFor=function(e){return void 0!==e&&void 0!==this.upsertBuffer[e]},e}();function bt(e){return e>=500}var wt=3145728;function St(e,t,n,r,o){0===t.transportStatus&&0===t.queuedPayloads.size()&&t.bandwidthMonitor.canHandle(e)?Ct(e,t,n,{onSuccess:function(){return Et(0,t,n,r,o)},onFailure:function(){t.queuedPayloads.enqueue(e),kt(t,n,r,o)}}):t.queuedPayloads.enqueue(e)}function kt(e,t,n,r){2===e.transportStatus&&E((function(){Ct(e.queuedPayloads.first(),e,t,{onSuccess:function(){e.queuedPayloads.dequeue(),e.currentBackoffTime=1e3,Et(1,e,t,n,r)},onFailure:function(){e.currentBackoffTime=Math.min(6e4,2*e.currentBackoffTime),kt(e,t,n,r)}})}),e.currentBackoffTime)}function Ct(e,t,n,r){var o=r.onSuccess,i=r.onFailure;t.bandwidthMonitor.add(e),n(e,(function(n){t.bandwidthMonitor.remove(e),!function(e){return"opaque"!==e.type&&(0===e.status&&!navigator.onLine||408===e.status||429===e.status||bt(e.status))}(n)?(t.transportStatus=0,o()):(t.transportStatus=t.bandwidthMonitor.ongoingRequestCount>0?1:2,e.retry={count:e.retry?e.retry.count+1:1,lastFailureStatus:n.status},i())}))}function Et(e,t,n,r,o){0===e&&t.queuedPayloads.isFull()&&!t.queueFullReported&&(o({message:"Reached max ".concat(r," events size queued for upload: ").concat(3,"MiB"),source:Pe,startClocks:V()}),t.queueFullReported=!0);var i=t.queuedPayloads;for(t.queuedPayloads=xt();i.size()>0;)St(i.dequeue(),t,n,r,o)}function xt(){var e=[];return{bytesCount:0,enqueue:function(t){this.isFull()||(e.push(t),this.bytesCount+=t.bytesCount)},first:function(){return e[0]},dequeue:function(){var t=e.shift();return t&&(this.bytesCount-=t.bytesCount),t},size:function(){return e.length},isFull:function(){return this.bytesCount>=wt}}}function _t(e,t,n){var r={transportStatus:0,currentBackoffTime:1e3,bandwidthMonitor:{ongoingRequestCount:0,ongoingByteCount:0,canHandle:function(e){return 0===this.ongoingRequestCount||this.ongoingByteCount+e.bytesCount<=81920&&this.ongoingRequestCount<32},add:function(e){this.ongoingRequestCount+=1,this.ongoingByteCount+=e.bytesCount},remove:function(e){this.ongoingRequestCount-=1,this.ongoingByteCount-=e.bytesCount}},queuedPayloads:xt(),queueFullReported:!1},o=function(n,r){return function(e,t,n,r){var o=n.data,i=n.bytesCount,a=n.flushReason,s=n.retry;if(function(){try{return window.Request&&"keepalive"in new Request("http://a")}catch(e){return!1}}()&&i<t){var u=e.build("fetch",a,s);fetch(u,{method:"POST",body:o,keepalive:!0,mode:"cors"}).then(c((function(e){return null==r?void 0:r({status:e.status,type:e.type})})),c((function(){Rt(e.build("xhr",a,s),o,r)})))}else{Rt(e.build("xhr",a,s),o,r)}}(e,t,n,r)};return{send:function(t){St(t,r,o,e.endpointType,n)},sendOnExit:function(n){!function(e,t,n){var r=n.data,o=n.bytesCount,i=n.flushReason;if(navigator.sendBeacon&&o<t)try{var a=e.build("beacon",i);if(navigator.sendBeacon(a,r))return}catch(e){!function(e){Tt||(Tt=!0,gt(e))}(e)}Rt(e.build("xhr",i),r)}(e,t,n)}}}var Tt=!1;function Rt(e,t,n){var r=new XMLHttpRequest;r.open("POST",e,!0),Je(r,"loadend",(function(){null==n||n({status:r.status})}),{once:!0}),r.send(t)}function Ot(e){var t=e.messagesLimit,n=e.bytesLimit,r=e.durationLimit,o=e.pageExitObservable,i=new ze;o.subscribe((function(e){return c(e.reason)}));var a,s=0,u=0;function c(e){if(0!==u){var t=u,n=s;u=0,s=0,f(),i.notify({reason:e,messagesCount:t,bytesCount:n})}}function f(){x(a),a=void 0}return{flushObservable:i,get messagesCount(){return u},notifyBeforeAddMessage:function(e){s+e>=n&&c("bytes_limit"),u+=1,s+=e,void 0===a&&(a=E((function(){c("duration_limit")}),r))},notifyAfterAddMessage:function(){u>=t?c("messages_limit"):s>=n&&c("bytes_limit")},notifyAfterRemoveMessage:function(e){s-=e,0===(u-=1)&&f()}}}function Lt(e,t,n,r,o){var i,a=s(t);function s(t){return new mt(_t(t,e.batchBytesLimit,n),Ot({messagesLimit:e.batchMessagesLimit,bytesLimit:e.batchBytesLimit,durationLimit:e.flushTimeout,pageExitObservable:r}),e.messageBytesLimit)}return o&&(i=s(o)),{add:function(e,t){void 0===t&&(t=!0),a.add(e),i&&t&&i.add(e)}}}var At=1/0,It=function(){function e(e){var t=this;this.expireDelay=e,this.entries=[],this.clearOldValuesInterval=_((function(){return t.clearOldValues()}),6e4)}return e.prototype.add=function(e,t){var n=this,r={value:e,startTime:t,endTime:At,remove:function(){var e=n.entries.indexOf(r);e>=0&&n.entries.splice(e,1)},close:function(e){r.endTime=e}};return this.entries.unshift(r),r},e.prototype.find=function(e){void 0===e&&(e=At);for(var t=0,n=this.entries;t<n.length;t++){var r=n[t];if(r.startTime<=e){if(e<=r.endTime)return r.value;break}}},e.prototype.closeActive=function(e){var t=this.entries[0];t&&t.endTime===At&&t.close(e)},e.prototype.findAll=function(e){return void 0===e&&(e=At),this.entries.filter((function(t){return t.startTime<=e&&e<=t.endTime})).map((function(e){return e.value}))},e.prototype.reset=function(){this.entries=[]},e.prototype.stop=function(){T(this.clearOldValuesInterval)},e.prototype.clearOldValues=function(){for(var e=J()-this.expireDelay;this.entries.length>0&&this.entries[this.entries.length-1].endTime<e;)this.entries.pop()},e}();var Pt,Bt=144e5,Nt=9e5,Ut=/^([a-z]+)=([a-z0-9-]+)$/,qt="&",jt="_dd_s",Mt=[];function Dt(e,t){var n;if(void 0===t&&(t=0),Pt||(Pt=e),e===Pt)if(t>=100)Gt();else{var r,o=Jt();if(Ft()){if(o.lock)return void Ht(e,t);if(r=Y(),o.lock=r,Zt(o,e.options),(o=Jt()).lock!==r)return void Ht(e,t)}var i=e.process(o);if(Ft()&&(o=Jt()).lock!==r)Ht(e,t);else{if(i&&zt(i,e.options),Ft()&&(!i||!$t(i))){if((o=Jt()).lock!==r)return void Ht(e,t);delete o.lock,Zt(o,e.options),i=o}null===(n=e.after)||void 0===n||n.call(e,i||o),Gt()}}else Mt.push(e)}function Ft(){return!!window.chrome||/HeadlessChrome/.test(window.navigator.userAgent)}function Ht(e,t){E((function(){Dt(e,t+1)}),10)}function Gt(){Pt=void 0;var e=Mt.shift();e&&Dt(e)}function zt(e,t){$t(e)?Vt(t):(e.expire=String(z()+Nt),Zt(e,t))}function Zt(e,t){te(jt,function(e){return(t=e,Object.keys(t).map((function(e){return[e,t[e]]}))).map((function(e){var t=e[0],n=e[1];return"".concat(t,"=").concat(n)})).join(qt);var t}(e),Nt,t)}function Jt(){var e=ne(jt),t={};return function(e){return void 0!==e&&(-1!==e.indexOf(qt)||Ut.test(e))}(e)&&e.split(qt).forEach((function(e){var n=Ut.exec(e);if(null!==n){var r=n[1],o=n[2];t[r]=o}})),t}function Vt(e){re(jt,e)}function $t(e){return ae(e)}function Wt(e,t,n){var r=new ze,o=new ze,i=_((function(){Dt({options:e,process:function(e){return c(e)?void 0:{}},after:s})}),1e3),a=function(){var e=Jt();if(c(e))return e;return{}}();function s(e){return c(e)||(e={}),u()&&(!function(e){return a.id!==e.id||a[t]!==e[t]}(e)?a=e:(a={},o.notify())),e}function u(){return void 0!==a[t]}function c(e){return(void 0===e.created||z()-Number(e.created)<Bt)&&(void 0===e.expire||z()<Number(e.expire))}return{expandOrRenewSession:R((function(){var o;Dt({options:e,process:function(e){var r=s(e);return o=function(e){var r=n(e[t]),o=r.trackingType,i=r.isTracked;e[t]=o,i&&!e.id&&(e.id=Y(),e.created=String(z()));return i}(r),r},after:function(e){o&&!u()&&function(e){a=e,r.notify()}(e),a=e}})}),1e3).throttled,expandSession:function(){Dt({options:e,process:function(e){return u()?s(e):void 0}})},getSession:function(){return a},renewObservable:r,expireObservable:o,expire:function(){Vt(e),s({})},stop:function(){T(i)}}}var Xt=[];function Kt(e,t,n){!function(e){var t=ne(jt),n=ne("_dd"),r=ne("_dd_r"),o=ne("_dd_l");if(!t){var i={};n&&(i.id=n),o&&/^[01]$/.test(o)&&(i.logs=o),r&&/^[012]$/.test(r)&&(i.rum=r),zt(i,e)}}(e);var r=Wt(e,t,n);Xt.push((function(){return r.stop()}));var o,i=new It(144e5);function a(){return{id:r.getSession().id,trackingType:r.getSession()[t]}}return Xt.push((function(){return i.stop()})),r.renewObservable.subscribe((function(){i.add(a(),J())})),r.expireObservable.subscribe((function(){i.closeActive(J())})),r.expandOrRenewSession(),i.add(a(),[0,$()][0]),o=Ve(window,["click","touchstart","keydown","scroll"],(function(){return r.expandOrRenewSession()}),{capture:!0,passive:!0}).stop,Xt.push(o),function(e){var t=function(){"visible"===document.visibilityState&&e()},n=Je(document,"visibilitychange",t).stop;Xt.push(n);var r=_(t,6e4);Xt.push((function(){T(r)}))}((function(){return r.expandSession()})),{findActiveSession:function(e){return i.find(e)},renewObservable:r.renewObservable,expireObservable:r.expireObservable,expire:r.expire}}var Yt;function Qt(e){var t=Kt(e.cookieOptions,"logs",(function(t){return function(e,t){var n=function(e){return"0"===e||"1"===e}(t)?t:en(e);return{trackingType:n,isTracked:"1"===n}}(e,t)}));return{findTrackedSession:function(e){var n=t.findActiveSession(e);return n&&"1"===n.trackingType?{id:n.id}:void 0}}}function en(e){return oe(e.sessionSampleRate)?"1":"0"}var tn=((Yt={})[Qe.debug]=0,Yt[Qe.info]=1,Yt[Qe.warn]=2,Yt[Qe.error]=3,Yt);function nn(e,t,n){var r=n.getHandler(),o=Array.isArray(r)?r:[r];return tn[e]>=tn[n.getLevel()]&&d(o,t)}function rn(e,t,n,r,o,i){var a=nt.concat(["custom"]),s={};a.forEach((function(e){var n,r,o,a,u;s[e]=(n=e,r=t.eventRateLimiterThreshold,o=i,a=0,u=!1,{isLimitReached:function(){if(0===a&&E((function(){a=0}),G),(a+=1)<=r||u)return u=!1,!1;if(a===r+1){u=!0;try{o({message:"Reached max number of ".concat(n,"s by minute: ").concat(r),source:Pe,startClocks:V()})}finally{u=!1}}return!0}})})),n.subscribe(0,(function(i){var a,u,c,f=i.rawLogsEvent,l=i.messageContext,d=void 0===l?void 0:l,v=i.savedCommonContext,p=void 0===v?void 0:v,g=i.logger,h=void 0===g?o:g,y=f.date-$(),m=e.findTrackedSession(y);if(m){var b=p||r(),w=P({service:t.service,session_id:m.id,usr:ae(b.user)?void 0:b.user,view:b.view},b.context,an(y),f,h.getContext(),d);!nn(f.status,tt,h)||!1===(null===(a=t.beforeSend)||void 0===a?void 0:a.call(t,w))||(null===(u=w.error)||void 0===u?void 0:u.origin)!==Pe&&(null!==(c=s[w.status])&&void 0!==c?c:s.custom).isLimitReached()||n.notify(1,w)}}))}var on=!1;function an(t){var n,r=window;if(at()){var o=i(r.DD_RUM_SYNTHETICS);return o||on||(on=!0,function(t,n){l(e.debug,t,n),ht(h({type:ct,message:t,status:"debug"},n))}("Logs sent before RUM is injected by the synthetics worker",{testId:(n=window._DATADOG_SYNTHETICS_PUBLIC_ID||ne("datadog-synthetics-public-id"),"string"==typeof n?n:void 0),resultId:st()})),o}return i(r.DD_RUM);function i(e){if(e&&e.getInternalContext)return e.getInternalContext(t)}}var sn,un={};function cn(e){var t=e.map((function(e){return un[e]||(un[e]=function(e){var t=new ze((function(){var n=console[e];return console[e]=function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.apply(console,r);var i=He();f((function(){t.notify(fn(r,e,i))}))},function(){console[e]=n}}));return t}(e)),un[e]}));return Ze.apply(void 0,t)}function fn(t,n,r){var i,a=t.map((function(e){return function(e){if("string"==typeof e)return b(o.SANITIZE_INPUTS)?U(e):e;if(e instanceof Error)return Fe(Ce(e));return B(b(o.SANITIZE_INPUTS)?U(e):e,void 0,2)}(e)})).join(" ");if(n===e.error){var s=function(e,t){for(var n=0;n<e.length;n+=1){var r=e[n];if(t(r,n))return r}}(t,(function(e){return e instanceof Error}));i=s?De(Ce(s)):void 0,a="console error: ".concat(a)}return{api:n,message:a,stack:i,handlingStack:r}}var ln,dn=((sn={})[e.log]=Qe.info,sn[e.debug]=Qe.debug,sn[e.info]=Qe.info,sn[e.warn]=Qe.warn,sn[e.error]=Qe.error,sn);var vn,pn=((ln={})[$e.cspViolation]=Qe.error,ln[$e.intervention]=Qe.error,ln[$e.deprecation]=Qe.warn,ln);function gn(e,t,n){var r=e[t],o=n(r),i=function(){if("function"==typeof o)return o.apply(this,arguments)};return e[t]=i,{stop:function(){e[t]===i?e[t]=r:o=r}}}function hn(e,t,n){var r=n.before,o=n.after;return gn(e,t,(function(e){return function(){var t,n=arguments;return r&&f(r,this,n),"function"==typeof e&&(t=e.apply(this,n)),o&&f(o,this,n),t}}))}var yn,mn=new WeakMap;function bn(){var e;return vn||(e=new ze((function(){var t=hn(XMLHttpRequest.prototype,"open",{before:wn}).stop,n=hn(XMLHttpRequest.prototype,"send",{before:function(){Sn.call(this,e)}}).stop,r=hn(XMLHttpRequest.prototype,"abort",{before:kn}).stop;return function(){t(),n(),r()}})),vn=e),vn}function wn(e,t){mn.set(this,{state:"open",method:e,url:se(String(t))})}function Sn(e){var t=this,n=mn.get(this);if(n){var r=n;r.state="start",r.startTime=J(),r.startClocks=V(),r.isAborted=!1,r.xhr=this;var o=!1,i=hn(this,"onreadystatechange",{before:function(){this.readyState===XMLHttpRequest.DONE&&a()}}).stop,a=function(){if(s(),i(),!o){o=!0;var a,u=n;u.state="complete",u.duration=(a=r.startClocks.timeStamp,Z()-a),u.status=t.status,e.notify(h({},u))}},s=Je(this,"loadend",a).stop;e.notify(r)}}function kn(){var e=mn.get(this);e&&(e.isAborted=!0)}function Cn(){var e;return yn||(e=new ze((function(){if(window.fetch)return gn(window,"fetch",(function(t){return function(n,r){var o,i=f(En,null,[e,n,r]);return i?(o=t.call(this,i.input,i.init),f(xn,null,[e,o,i])):o=t.call(this,n,r),o}})).stop})),yn=e),yn}function En(e,t,n){var r=n&&n.method||t instanceof Request&&t.method||"GET",o=t instanceof Request?t.url:se(String(t)),i={state:"start",init:n,input:t,method:r,startClocks:V(),url:o};return e.notify(i),i}function xn(e,t,n){var r=function(t){var r=n;r.state="resolve","stack"in t||t instanceof Error?(r.status=0,r.isAborted=t instanceof DOMException&&t.code===DOMException.ABORT_ERR,r.error=t):"status"in t&&(r.response=t,r.responseType=t.type,r.status=t.status,r.isAborted=!1),e.notify(r)};t.then(c(r),c(r))}function _n(e,t){if(!e.forwardErrorsToLogs)return{stop:O};var n=bn().subscribe((function(e){"complete"===e.state&&o("xhr",e)})),r=Cn().subscribe((function(e){"resolve"===e.state&&o("fetch",e)}));function o(n,r){function o(e){t.notify(0,{rawLogsEvent:{message:"".concat(Rn(n)," error ").concat(r.method," ").concat(r.url),date:r.startClocks.timeStamp,error:{origin:Ue,stack:e||"Failed to load"},http:{method:r.method,status_code:r.status,url:r.url},status:Qe.error,origin:Ue}})}e.isIntakeUrl(r.url)||!function(e){return 0===e.status&&"opaque"!==e.responseType}(r)&&!bt(r.status)||("xhr"in r?function(e,t,n){"string"==typeof e.response?n(Tn(e.response,t)):n(e.response)}(r.xhr,e,o):r.response?function(e,t,n){var r=function(e){try{return e.clone()}catch(e){return}}(e);r&&r.body?window.TextDecoder?function(e,t,n){!function(e,t,n){var r=e.getReader(),o=[],i=0;function a(){var e,a;if(r.cancel().catch(O),n.collectStreamBody){var s;if(1===o.length)s=o[0];else{s=new Uint8Array(i);var u=0;o.forEach((function(e){s.set(e,u),u+=e.length}))}e=s.slice(0,n.bytesLimit),a=s.length>n.bytesLimit}t(void 0,e,a)}!function e(){r.read().then(c((function(t){t.done?a():(n.collectStreamBody&&o.push(t.value),(i+=t.value.length)>n.bytesLimit?a():e())})),c((function(e){return t(e)})))}()}(e,(function(e,t,r){if(e)n(e);else{var o=(new TextDecoder).decode(t);r&&(o+="..."),n(void 0,o)}}),{bytesLimit:t,collectStreamBody:!0})}(r.body,t.requestErrorResponseLengthLimit,(function(e,t){n(e?"Unable to retrieve response: ".concat(e):t)})):r.text().then(c((function(e){return n(Tn(e,t))})),c((function(e){return n("Unable to retrieve response: ".concat(e))}))):n()}(r.response,e,o):r.error&&function(e,t,n){n(Tn(De(Ce(e)),t))}(r.error,e,o))}return{stop:function(){n.unsubscribe(),r.unsubscribe()}}}function Tn(e,t){return e.length>t.requestErrorResponseLengthLimit?"".concat(e.substring(0,t.requestErrorResponseLengthLimit),"..."):e}function Rn(e){return"xhr"===e?"XHR":"Fetch"}var On=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;function Ln(e){var t=function(e){return hn(window,"onerror",{before:function(t,n,r,o,i){var a;if(i)a=Ce(i),e(a,i);else{var s,u={url:n,column:o,line:r},c=t;if("[object String]"==={}.toString.call(t)){var f=On.exec(c);f&&(s=f[1],c=f[2])}e(a={name:s,message:"string"==typeof c?c:void 0,stack:[u]},t)}}})}(e).stop,n=function(e){return hn(window,"onunhandledrejection",{before:function(t){var n=t.reason||"Empty reason",r=Ce(n);e(r,n)}})}(e).stop;return{stop:function(){t(),n()}}}function An(e,t){if(!e.forwardErrorsToLogs)return{stop:O};var n,r=new ze,o=(n=r,Ln((function(e,t){n.notify(Me({stackTrace:e,originalError:t,startClocks:V(),nonErrorPrefix:"Uncaught",source:qe,handling:"unhandled"}))}))).stop,i=r.subscribe((function(e){t.notify(0,{rawLogsEvent:{message:e.message,date:e.startClocks.timeStamp,error:{kind:e.type,origin:qe,stack:e.stack},origin:qe,status:Qe.error}})}));return{stop:function(){o(),i.unsubscribe()}}}var In=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}();var Pn,Bn,Nn,Un,qn=function(n){var r,i,a=!1,u=M("global context"),f=M("user"),l={},v=function(){},g=new F,y=function(e,t,n,r){void 0===n&&(n=I(S())),void 0===r&&(r=Z()),g.add((function(){return y(e,t,n,r)}))},m=function(){},w=new rt((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return y.apply(void 0,e)}));function S(){return{view:{referrer:document.referrer,url:window.location.href},context:u.getContext(),user:f.getContext()}}return r={logger:w,init:c((function(r){var o;if(m=function(){return I(r)},X()&&(r=function(e){return h({},e,{clientToken:"empty"})}(r)),function(e){return!a||(e.silentMultipleInit||t.error("DD_LOGS is already initialized."),!1)}(r)){var i=function(t){var n=we(t),r=Ke(t.forwardConsoleLogs,p(e),"Forward Console Logs"),o=Ke(t.forwardReports,p($e),"Forward Reports");if(n&&r&&o)return t.forwardErrorsToLogs&&!d(r,e.error)&&r.push(e.error),h({forwardErrorsToLogs:!1!==t.forwardErrorsToLogs,forwardConsoleLogs:r,forwardReports:o,requestErrorResponseLengthLimit:32768},n)}(r);i&&(o=n(r,i,S,w),y=o.handleLog,v=o.getInternalContext,g.drain(),a=!0)}})),getLoggerGlobalContext:c(u.get),getGlobalContext:c(u.getContext),setLoggerGlobalContext:c(u.set),setGlobalContext:c(u.setContext),addLoggerGlobalContext:c(u.add),setGlobalContextProperty:c(u.setContextProperty),removeLoggerGlobalContext:c(u.remove),removeGlobalContextProperty:c(u.removeContextProperty),clearGlobalContext:c(u.clearContext),createLogger:c((function(e,t){return void 0===t&&(t={}),l[e]=new rt((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return y.apply(void 0,e)}),b(o.SANITIZE_INPUTS)?U(e):e,t.handler,t.level,b(o.SANITIZE_INPUTS)?U(t.context):t.context),l[e]})),getLogger:c((function(e){return l[e]})),getInitConfiguration:c((function(){return m()})),getInternalContext:c((function(e){return v(e)})),setUser:c((function(e){(function(e){var n="object"===L(e);return n||t.error("Unsupported user:",e),n})(e)&&f.setContext(K(e))})),getUser:c(f.getContext),setUserProperty:c((function(e,t){var n,r=K((n={},n[e]=t,n))[e];f.setContextProperty(e,r)})),removeUserProperty:c(f.removeContextProperty),clearUser:c(f.clearContext)},i=h({version:"4.39.0",onReady:function(e){e()}},r),Object.defineProperty(i,"_setDebug",{get:function(){return s},enumerable:!1}),i}((function(n,r,i,a){var s=new In;s.subscribe(1,(function(e){return ot("logs",e)}));var u,c=function(e){return s.notify(0,{rawLogsEvent:{message:e.message,date:e.startClocks.timeStamp,error:{origin:Pe},origin:Pe,status:Qe.error}})},f=u=new ze((function(){var e=b(o.PAGEHIDE),t=Ve(window,["visibilitychange","freeze","pagehide"],(function(t){"pagehide"===t.type&&e?u.notify({reason:it.PAGEHIDE}):"visibilitychange"===t.type&&"hidden"===document.visibilityState?u.notify({reason:it.HIDDEN}):"freeze"===t.type&&u.notify({reason:it.FROZEN})}),{capture:!0}).stop,n=O;return e||(n=Je(window,"beforeunload",(function(){u.notify({reason:it.UNLOADING})})).stop),function(){t(),n()}})),l=function(e,t,n){var r,o=pt("browser-logs-sdk",e);if(X()){var i=W();o.observable.subscribe((function(e){return i.send("internal_telemetry",e)}))}else{var a=Lt(e,e.rumEndpointBuilder,t,n,null===(r=e.replica)||void 0===r?void 0:r.rumEndpointBuilder);o.observable.subscribe((function(t){return a.add(t,function(e){return"datad0g.com"===e.site}(e))}))}return o}(r,c,f);l.setContextProvider((function(){var e,t,n,r,o,i;return{application:{id:null===(e=an())||void 0===e?void 0:e.application_id},session:{id:null===(t=p.findTrackedSession())||void 0===t?void 0:t.id},view:{id:null===(r=null===(n=an())||void 0===n?void 0:n.view)||void 0===r?void 0:r.id},action:{id:null===(i=null===(o=an())||void 0===o?void 0:o.user_action)||void 0===i?void 0:i.id}}})),_n(r,s),An(r,s),function(t,n){var r=cn(t.forwardConsoleLogs).subscribe((function(t){n.notify(0,{rawLogsEvent:{date:Z(),message:t.message,origin:Be,error:t.api===e.error?{origin:Be,stack:t.stack}:void 0,status:dn[t.api]}})}))}(r,s),function(e,t){var n=We(e.forwardReports).subscribe((function(e){var n,r=e.message,o=pn[e.type];o===Qe.error?n={kind:e.subtype,origin:je,stack:e.stack}:e.stack&&(r+=" Found in ".concat(function(e){var t;return null===(t=/@ (.+)/.exec(e))||void 0===t?void 0:t[1]}(e.stack))),t.notify(0,{rawLogsEvent:{date:Z(),message:r,origin:je,error:n,status:o}})}))}(r,s);var d,v=function(e){return{handleLog:function(n,r,o,i){var a=n.context;nn(n.status,et,r)&&t(n.status,n.message,P(r.getContext(),a)),e.notify(0,{rawLogsEvent:{date:i||Z(),message:n.message,status:n.status,origin:Ne},messageContext:a,savedCommonContext:o,logger:r})}}}(s).handleLog,p=!function(e){if(void 0===document.cookie||null===document.cookie)return!1;try{var n="dd_cookie_test_".concat(Y()),r="test";te(n,r,G,e);var o=ne(n)===r;return re(n,e),o}catch(e){return t.error(e),!1}}(r.cookieOptions)||X()||at()?function(e){var t="1"===en(e)?{}:void 0;return{findTrackedSession:function(){return t}}}(r):Qt(r);return rn(p,r,s,i,a,c),X()?function(e){var t=W();e.subscribe(1,(function(e){t.send("log",e)}))}(s):function(e,t,n,r){var o,i=Lt(e,e.logsEndpointBuilder,n,r,null===(o=e.replica)||void 0===o?void 0:o.logsEndpointBuilder);t.subscribe(1,(function(e){i.add(e)}))}(r,s,c,f),function(e){vt.telemetryConfigurationEnabled&&ht({type:ft,configuration:e})}(function(e){var t=function(e){var t,n,r=null!==(t=e.proxy)&&void 0!==t?t:e.proxyUrl;return{session_sample_rate:null!==(n=e.sessionSampleRate)&&void 0!==n?n:e.sampleRate,telemetry_sample_rate:e.telemetrySampleRate,telemetry_configuration_sample_rate:e.telemetryConfigurationSampleRate,use_before_send:!!e.beforeSend,use_cross_site_session_cookie:e.useCrossSiteSessionCookie,use_secure_session_cookie:e.useSecureSessionCookie,use_proxy:void 0!==r?!!r:void 0,silent_multiple_init:e.silentMultipleInit,track_session_across_subdomains:e.trackSessionAcrossSubdomains,track_resources:e.trackResources,track_long_task:e.trackLongTasks}}(e);return h({forward_errors_to_logs:e.forwardErrorsToLogs,forward_console_logs:e.forwardConsoleLogs,forward_reports:e.forwardReports},t)}(n)),{handleLog:v,getInternalContext:(d=p,{get:function(e){var t=d.findTrackedSession(e);if(t)return{session_id:t.id}}}).get}}));Pn=y(),Nn=qn,Un=Pn[Bn="DD_LOGS"],Pn[Bn]=Nn,Un&&Un.q&&Un.q.forEach((function(e){return n(e,"onReady callback threw an error:")()}))}();
!function(){"use strict";var e={log:"log",debug:"debug",info:"info",warn:"warn",error:"error"},t=function(n){for(var r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];Object.prototype.hasOwnProperty.call(e,n)||(n=e.log),t[n].apply(t,r)};function n(e,n){return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];try{return e.apply(void 0,r)}catch(e){t.error(n,e)}}}t.debug=console.debug.bind(console),t.log=console.log.bind(console),t.info=console.info.bind(console),t.warn=console.warn.bind(console),t.error=console.error.bind(console);var r,o,i=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},a=!1;function s(e){a=e}function u(e,t,n){var o=n.value;n.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=r?c(o):o;return n.apply(this,e)}}function c(e){return function(){return f(e,this,arguments)}}function f(t,n,o){try{return t.apply(n,o)}catch(t){if(l(e.error,t),r)try{r(t)}catch(t){l(e.error,t)}}}function l(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];a&&t.apply(void 0,i([e,"[MONITOR]"],n,!1))}function d(e,t){return-1!==e.indexOf(t)}function v(e){if(Array.from)return Array.from(e);var t=[];if(e instanceof Set)e.forEach((function(e){return t.push(e)}));else for(var n=0;n<e.length;n++)t.push(e[n]);return t}function p(e){return Object.keys(e).map((function(t){return e[t]}))}function g(e,t){return e.slice(0,t.length)===t}function h(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.forEach((function(t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})),e}function y(){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}!function(e){e.PAGEHIDE="pagehide",e.FEATURE_FLAGS="feature_flags",e.RESOURCE_PAGE_STATES="resource_page_states",e.COLLECT_FLUSH_REASON="collect_flush_reason",e.SANITIZE_INPUTS="sanitize_inputs"}(o||(o={}));var m=new Set;function b(e){return m.has(e)}function w(){return m}var S=/[^\u0000-\u007F]/;function x(e){return S.test(e)?void 0!==window.TextEncoder?(new TextEncoder).encode(e).length:new Blob([e]).size:e.length}function E(e,t){var n,r=y();return r.Zone&&"function"==typeof r.Zone.__symbol__&&(n=e[r.Zone.__symbol__(t)]),n||(n=e[t]),n}function k(e,t){return E(y(),"setTimeout")(c(e),t)}function C(e){E(y(),"clearTimeout")(e)}function _(e,t){return E(window,"setInterval")(c(e),t)}function T(e){E(window,"clearInterval")(e)}function R(e,t,n){var r,o,i=!n||void 0===n.leading||n.leading,a=!n||void 0===n.trailing||n.trailing,s=!1;return{throttled:function(){for(var n=[],u=0;u<arguments.length;u++)n[u]=arguments[u];s?r=n:(i?e.apply(void 0,n):r=n,s=!0,o=k((function(){a&&r&&e.apply(void 0,r),s=!1,r=void 0}),t))},cancel:function(){C(o),s=!1,r=void 0}}}function O(){}function L(e){return null===e?"null":Array.isArray(e)?"array":typeof e}function A(e,t,n){if(void 0===n&&(n=function(){if("undefined"!=typeof WeakSet){var e=new WeakSet;return{hasAlreadyBeenSeen:function(t){var n=e.has(t);return n||e.add(t),n}}}var t=[];return{hasAlreadyBeenSeen:function(e){var n=t.indexOf(e)>=0;return n||t.push(e),n}}}()),void 0===t)return e;if("object"!=typeof t||null===t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){var r=t.flags||[t.global?"g":"",t.ignoreCase?"i":"",t.multiline?"m":"",t.sticky?"y":"",t.unicode?"u":""].join("");return new RegExp(t.source,r)}if(!n.hasAlreadyBeenSeen(t)){if(Array.isArray(t)){for(var o=Array.isArray(e)?e:[],i=0;i<t.length;++i)o[i]=A(o[i],t[i],n);return o}var a="object"===L(e)?e:{};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(a[s]=A(a[s],t[s],n));return a}}function I(e){return A(void 0,e)}function P(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=0,o=t;r<o.length;r++){var i=o[r];null!=i&&(e=A(e,i))}return e}function B(e,t,n){if("object"!=typeof e||null===e)return JSON.stringify(e);var r=N(Object.prototype),o=N(Array.prototype),i=N(Object.getPrototypeOf(e)),a=N(e);try{return JSON.stringify(e,t,n)}catch(e){return"<error: unable to serialize object>"}finally{r(),o(),i(),a()}}function N(e){var t=e,n=t.toJSON;return n?(delete t.toJSON,function(){t.toJSON=n}):O}function U(e,t){var n;void 0===t&&(t=225280);var r=N(Object.prototype),o=N(Array.prototype),i=[],a=new WeakMap,s=q(e,"$",void 0,i,a),u=(null===(n=JSON.stringify(s))||void 0===n?void 0:n.length)||0;if(!(u>t)){for(;i.length>0&&u<t;){var c=i.shift(),f=0;if(Array.isArray(c.source))for(var l=0;l<c.source.length;l++){if(u+=void 0!==(d=q(c.source[l],c.path,l,i,a))?JSON.stringify(d).length:4,u+=f,f=1,u>t){j(t,"truncated",e);break}c.target[l]=d}else for(var l in c.source)if(Object.prototype.hasOwnProperty.call(c.source,l)){var d;if(void 0!==(d=q(c.source[l],c.path,l,i,a))&&(u+=JSON.stringify(d).length+f+l.length+3,f=1),u>t){j(t,"truncated",e);break}c.target[l]=d}}return r(),o(),s}j(t,"discarded",e)}function q(e,t,n,r,o){var i=function(e){var t=e;if(t&&"function"==typeof t.toJSON)try{return t.toJSON()}catch(e){}return e}(e);if(!i||"object"!=typeof i)return function(e){if("bigint"==typeof e)return"[BigInt] ".concat(e.toString());if("function"==typeof e)return"[Function] ".concat(e.name||"unknown");if("symbol"==typeof e)return"[Symbol] ".concat(e.description||e.toString());return e}(i);var a=function(e){try{if(e instanceof Event)return{isTrusted:e.isTrusted};var t=Object.prototype.toString.call(e).match(/\[object (.*)\]/);if(t&&t[1])return"[".concat(t[1],"]")}catch(e){}return"[Unserializable]"}(i);if("[Object]"!==a&&"[Array]"!==a)return a;var s=e;if(o.has(s))return"[Reference seen at ".concat(o.get(s),"]");var u=void 0!==n?"".concat(t,".").concat(n):t,c=Array.isArray(i)?[]:{};return o.set(s,u),r.push({source:i,target:c,path:u}),c}function j(e,n,r){t.warn("The data provided has been ".concat(n," as it is over the limit of ").concat(e," characters:"),r)}function D(e,n){void 0===n&&(n=x);var r,i={},a=!1,s=R((function(o){r=n(B(o)),a||(a=function(e,n){return e>3072&&(t.warn("The ".concat(n," data is over ").concat(3,"KiB. On low connectivity, the SDK has the potential to exhaust the user's upload bandwidth.")),!0)}(r,e))}),200).throttled;return{getBytesCount:function(){return r},get:function(){return i},add:function(e,t){i[e]=t,s(i)},remove:function(e){delete i[e],s(i)},set:function(e){s(i=e)},getContext:function(){return I(i)},setContext:function(e){i=b(o.SANITIZE_INPUTS)?U(e):I(e),s(i)},setContextProperty:function(e,t){i[e]=b(o.SANITIZE_INPUTS)?U(t):I(t),s(i)},removeContextProperty:function(e){delete i[e],s(i)},clearContext:function(){i={},r=0}}}var M,F=function(){function e(){this.buffer=[]}return e.prototype.add=function(e){this.buffer.push(e)>500&&this.buffer.splice(0,1)},e.prototype.drain=function(){this.buffer.forEach((function(e){return e()})),this.buffer.length=0},e}(),H=1e3,G=6e4;function z(){return(new Date).getTime()}function Z(){return z()}function J(){return performance.now()}function V(){return{relative:J(),timeStamp:Z()}}function $(){return void 0===M&&(M=performance.timing.navigationStart),M}function W(){var e=y().DatadogEventBridge;if(e)return{getAllowedWebViewHosts:function(){return JSON.parse(e.getAllowedWebViewHosts())},send:function(t,n){e.send(JSON.stringify({eventType:t,event:n}))}}}function X(e){var t;void 0===e&&(e=null===(t=y().location)||void 0===t?void 0:t.hostname);var n=W();return!!n&&n.getAllowedWebViewHosts().some((function(t){return e===t||(n=e,r=".".concat(t),n.slice(-r.length)===r);var n,r}))}function Y(e){var t=h({},e);return["id","name","email"].forEach((function(e){e in t&&(t[e]=String(t[e]))})),t}function K(e){return e?(parseInt(e,10)^16*Math.random()>>parseInt(e,10)/4).toString(16):"".concat(1e7,"-").concat(1e3,"-").concat(4e3,"-").concat(8e3,"-").concat(1e11).replace(/[018]/g,K)}function Q(e,t,n){void 0===n&&(n="");var r=e.charCodeAt(t-1),o=r>=55296&&r<=56319?t+1:t;return e.length<=o?e:"".concat(e.slice(0,o)).concat(n)}var ee;function te(e,t,n,r){var o=new Date;o.setTime(o.getTime()+n);var i="expires=".concat(o.toUTCString()),a=r&&r.crossSite?"none":"strict",s=r&&r.domain?";domain=".concat(r.domain):"",u=r&&r.secure?";secure":"";document.cookie="".concat(e,"=").concat(t,";").concat(i,";path=/;samesite=").concat(a).concat(s).concat(u)}function ne(e){return function(e,t){var n=new RegExp("(?:^|;)\\s*".concat(t,"\\s*=\\s*([^;]+)")).exec(e);return n?n[1]:void 0}(document.cookie,e)}function re(e,t){te(e,"",0,t)}function oe(e){return 0!==e&&100*Math.random()<=e}function ie(e){return function(e){return"number"==typeof e}(e)&&e>=0&&e<=100}function ae(e){return 0===Object.keys(e).length}function se(e){return ue(e,le(window.location)).href}function ue(e,t){var n=function(){if(void 0===ce)try{var e=new fe("http://test/path");ce="http://test/path"===e.href}catch(e){ce=!1}return ce?fe:void 0}();if(n)try{return void 0!==t?new n(e,t):new n(e)}catch(n){throw new Error("Failed to construct URL: ".concat(String(n)," ").concat(B({url:e,base:t})))}if(void 0===t&&!/:/.test(e))throw new Error("Invalid URL: '".concat(e,"'"));var r=document,o=r.createElement("a");if(void 0!==t){var i=(r=document.implementation.createHTMLDocument("")).createElement("base");i.href=t,r.head.appendChild(i),r.body.appendChild(o)}return o.href=e,o}var ce,fe=URL;function le(e){if(e.origin)return e.origin;var t=e.host.replace(/(:80|:443)$/,"");return"".concat(e.protocol,"//").concat(t)}var de="datadoghq.com",ve="ap1.datadoghq.com",pe={logs:"logs",rum:"rum",sessionReplay:"session-replay"},ge={logs:"logs",rum:"rum",sessionReplay:"replay"};function he(e,t,n){var r=function(e,t){var n="/api/v2/".concat(ge[t]),r=e.proxy,o=e.proxyUrl;if(r){var i=se(r);return function(e){return"".concat(i,"?ddforward=").concat(encodeURIComponent("".concat(n,"?").concat(e)))}}var a=function(e,t){var n=e.site,r=void 0===n?de:n,o=e.internalAnalyticsSubdomain;if(o&&r===de)return"".concat(o,".").concat(de);var i=r.split("."),a=i.pop(),s=r!==ve?"".concat(pe[t],"."):"";return"".concat(s,"browser-intake-").concat(i.join("-"),".").concat(a)}(e,t);if(void 0===r&&o){var s=se(o);return function(e){return"".concat(s,"?ddforward=").concat(encodeURIComponent("https://".concat(a).concat(n,"?").concat(e)))}}return function(e){return"https://".concat(a).concat(n,"?").concat(e)}}(e,t);return{build:function(i,a,s){var u=function(e,t,n,r,i,a){var s=e.clientToken,u=e.internalAnalyticsSubdomain,c=["sdk_version:".concat("4.40.0"),"api:".concat(r)].concat(n);i&&b(o.COLLECT_FLUSH_REASON)&&c.push("flush_reason:".concat(i));a&&c.push("retry_count:".concat(a.count),"retry_after:".concat(a.lastFailureStatus));var f=["ddsource=browser","ddtags=".concat(encodeURIComponent(c.join(","))),"dd-api-key=".concat(s),"dd-evp-origin-version=".concat(encodeURIComponent("4.40.0")),"dd-evp-origin=browser","dd-request-id=".concat(K())];"rum"===t&&f.push("batch_time=".concat(Z()));u&&f.reverse();return f.join("&")}(e,t,n,i,a,s);return r(u)},urlPrefix:r(""),endpointType:t}}var ye=/[^a-z0-9_:./-]/;function me(e,n){var r=200-e.length-1;(n.length>r||ye.test(n))&&t.warn("".concat(e," value doesn't meet tag requirements and will be sanitized"));var o=n.replace(/,/g,"_");return"".concat(e,":").concat(o)}function be(e){var t=function(e){var t=e.env,n=e.service,r=e.version,o=e.datacenter,i=[];return t&&i.push(me("env",t)),n&&i.push(me("service",n)),r&&i.push(me("version",r)),o&&i.push(me("datacenter",o)),i}(e),n=function(e,t){return{logsEndpointBuilder:he(e,"logs",t),rumEndpointBuilder:he(e,"rum",t),sessionReplayEndpointBuilder:he(e,"sessionReplay",t)}}(e,t),r=p(n).map((function(e){return e.urlPrefix})),o=function(e,t,n){if(!e.replica)return;var r=h({},e,{site:de,clientToken:e.replica.clientToken}),o={logsEndpointBuilder:he(r,"logs",n),rumEndpointBuilder:he(r,"rum",n)};return t.push.apply(t,p(o).map((function(e){return e.urlPrefix}))),h({applicationId:e.replica.applicationId},o)}(e,r,t);return h({isIntakeUrl:function(e){return r.some((function(t){return 0===e.indexOf(t)}))},replica:o,site:e.site||de},n)}function we(e){var r,i,a;if(e&&e.clientToken){var s=null!==(r=e.sessionSampleRate)&&void 0!==r?r:e.sampleRate;if(void 0===s||ie(s))if(void 0===e.telemetrySampleRate||ie(e.telemetrySampleRate)){if(void 0===e.telemetryConfigurationSampleRate||ie(e.telemetryConfigurationSampleRate))return Array.isArray(e.enableExperimentalFeatures)&&e.enableExperimentalFeatures.filter((function(e){return t=o,n=e,Object.keys(t).some((function(e){return t[e]===n}));var t,n})).forEach((function(e){m.add(e)})),h({beforeSend:e.beforeSend&&n(e.beforeSend,"beforeSend threw an error:"),cookieOptions:Se(e),sessionSampleRate:null!=s?s:100,telemetrySampleRate:null!==(i=e.telemetrySampleRate)&&void 0!==i?i:20,telemetryConfigurationSampleRate:null!==(a=e.telemetryConfigurationSampleRate)&&void 0!==a?a:5,service:e.service,silentMultipleInit:!!e.silentMultipleInit,batchBytesLimit:16384,eventRateLimiterThreshold:3e3,maxTelemetryEventsPerPage:15,flushTimeout:3e4,batchMessagesLimit:50,messageBytesLimit:262144},be(e));t.error("Telemetry Configuration Sample Rate should be a number between 0 and 100")}else t.error("Telemetry Sample Rate should be a number between 0 and 100");else t.error("Session Sample Rate should be a number between 0 and 100")}else t.error("Client Token is not configured, we will not send any data.")}function Se(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===ee){for(var e="dd_site_test_".concat(K()),t=window.location.hostname.split("."),n=t.pop();t.length&&!ne(e);)n="".concat(t.pop(),".").concat(n),te(e,"test",H,{domain:n});re(e,{domain:n}),ee=n}return ee}()),t}var xe="?";function Ee(e){var t=[],n=Ie(e,"stack"),r=String(e);return n&&g(n,r)&&(n=n.slice(r.length)),n&&n.split("\n").forEach((function(e){var n=function(e){var t=_e.exec(e);if(!t)return;var n=t[2]&&0===t[2].indexOf("native"),r=t[2]&&0===t[2].indexOf("eval"),o=Te.exec(t[2]);r&&o&&(t[2]=o[1],t[3]=o[2],t[4]=o[3]);return{args:n?[t[2]]:[],column:t[4]?+t[4]:void 0,func:t[1]||xe,line:t[3]?+t[3]:void 0,url:n?void 0:t[2]}}(e)||function(e){var t=Re.exec(e);if(!t)return;return{args:[],column:t[3]?+t[3]:void 0,func:xe,line:t[2]?+t[2]:void 0,url:t[1]}}(e)||function(e){var t=Oe.exec(e);if(!t)return;return{args:[],column:t[4]?+t[4]:void 0,func:t[1]||xe,line:+t[3],url:t[2]}}(e)||function(e){var t=Le.exec(e);if(!t)return;var n=t[3]&&t[3].indexOf(" > eval")>-1,r=Ae.exec(t[3]);n&&r&&(t[3]=r[1],t[4]=r[2],t[5]=void 0);return{args:t[2]?t[2].split(","):[],column:t[5]?+t[5]:void 0,func:t[1]||xe,line:t[4]?+t[4]:void 0,url:t[3]}}(e);n&&(!n.func&&n.line&&(n.func=xe),t.push(n))})),{message:Ie(e,"message"),name:Ie(e,"name"),stack:t}}var ke="((?:file|https?|blob|chrome-extension|native|eval|webpack|snippet|<anonymous>|\\w+\\.|\\/).*?)",Ce="(?::(\\d+))",_e=new RegExp("^\\s*at (.*?) ?\\(".concat(ke).concat(Ce,"?").concat(Ce,"?\\)?\\s*$"),"i"),Te=new RegExp("\\((\\S*)".concat(Ce).concat(Ce,"\\)"));var Re=new RegExp("^\\s*at ?".concat(ke).concat(Ce,"?").concat(Ce,"??\\s*$"),"i");var Oe=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;var Le=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,Ae=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;function Ie(e,t){if("object"==typeof e&&e&&t in e){var n=e[t];return"string"==typeof n?n:void 0}}var Pe="No stack, consider using an instance of Error";function Be(e){var t=e.stackTrace,n=e.originalError,r=e.handlingStack,i=e.startClocks,a=e.nonErrorPrefix,s=e.source,u=e.handling;if(!t||void 0===t.message&&!(n instanceof Error)){var c=b(o.SANITIZE_INPUTS)?U(n):n;return{startClocks:i,source:s,handling:u,originalError:c,message:"".concat(a," ").concat(B(c)),stack:Pe,handlingStack:r,type:t&&t.name}}return{startClocks:i,source:s,handling:u,originalError:n,message:t.message||"Empty message",stack:Ne(t),handlingStack:r,type:t.name,causes:je(n,s)}}function Ne(e){var t=Ue(e);return e.stack.forEach((function(e){var n="?"===e.func?"<anonymous>":e.func,r=e.args&&e.args.length>0?"(".concat(e.args.join(", "),")"):"",o=e.line?":".concat(e.line):"",i=e.line&&e.column?":".concat(e.column):"";t+="\n at ".concat(n).concat(r," @ ").concat(e.url).concat(o).concat(i)})),t}function Ue(e){return"".concat(e.name||"Error",": ").concat(e.message)}function qe(){var e,t=new Error;if(!t.stack)try{throw t}catch(e){}return f((function(){var n=Ee(t);n.stack=n.stack.slice(2),e=Ne(n)})),e}function je(e,t){for(var n=e,r=[];(null==n?void 0:n.cause)instanceof Error&&r.length<10;){var o=Ee(n.cause);r.push({message:n.cause.message,source:t,type:null==o?void 0:o.name,stack:o&&Ne(o)}),n=n.cause}return r.length?r:void 0}var De=function(){function e(e){this.onFirstSubscribe=e,this.observers=[]}return e.prototype.subscribe=function(e){var t=this;return!this.observers.length&&this.onFirstSubscribe&&(this.onLastUnsubscribe=this.onFirstSubscribe()||void 0),this.observers.push(e),{unsubscribe:function(){t.observers=t.observers.filter((function(t){return e!==t})),!t.observers.length&&t.onLastUnsubscribe&&t.onLastUnsubscribe()}}},e.prototype.notify=function(e){this.observers.forEach((function(t){return t(e)}))},e}();function Me(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=new De((function(){var t=e.map((function(e){return e.subscribe((function(e){return n.notify(e)}))}));return function(){return t.forEach((function(e){return e.unsubscribe()}))}}));return n}function Fe(e,t,n,r){return He(e,[t],n,r)}function He(e,t,n,r){var o=void 0===r?{}:r,i=o.once,a=o.capture,s=o.passive,u=c(i?function(e){d(),n(e)}:n),f=s?{capture:a,passive:s}:a,l=E(e,"addEventListener");function d(){var n=E(e,"removeEventListener");t.forEach((function(t){return n.call(e,t,u,f)}))}return t.forEach((function(t){return l.call(e,t,u,f)})),{stop:d}}var Ge={intervention:"intervention",deprecation:"deprecation",cspViolation:"csp_violation"};function ze(e){var t,n=[];d(e,Ge.cspViolation)&&n.push(t=new De((function(){return Fe(document,"securitypolicyviolation",(function(e){t.notify(function(e){var t=Ge.cspViolation,n="'".concat(e.blockedURI,"' blocked by '").concat(e.effectiveDirective,"' directive");return{type:Ge.cspViolation,subtype:e.effectiveDirective,message:"".concat(t,": ").concat(n),stack:Ze(e.effectiveDirective,e.originalPolicy?"".concat(n,' of the policy "').concat(Q(e.originalPolicy,100,"..."),'"'):"no policy",e.sourceFile,e.lineNumber,e.columnNumber)}}(e))})).stop})));var r=e.filter((function(e){return e!==Ge.cspViolation}));return r.length&&n.push(function(e){var t=new De((function(){if(window.ReportingObserver){var n=c((function(e){return e.forEach((function(e){t.notify(function(e){var t=e.type,n=e.body;return{type:t,subtype:n.id,message:"".concat(t,": ").concat(n.message),stack:Ze(n.id,n.message,n.sourceFile,n.lineNumber,n.columnNumber)}}(e))}))})),r=new window.ReportingObserver(n,{types:e,buffered:!0});return r.observe(),function(){r.disconnect()}}}));return t}(r)),Me.apply(void 0,n)}function Ze(e,t,n,r,o){return n&&Ne({name:e,message:t,stack:[{func:"?",url:n,line:r,column:o}]})}function Je(e,n,r){return void 0===e?[]:"all"===e||Array.isArray(e)&&e.every((function(e){return d(n,e)}))?"all"===e?n:(o=e,i=new Set,o.forEach((function(e){return i.add(e)})),v(i)):void t.error("".concat(r,' should be "all" or an array with allowed values "').concat(n.join('", "'),'"'));var o,i}var Ve="agent",$e="console",We="logger",Xe="network",Ye="source",Ke="report",Qe=function(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},et={debug:"debug",error:"error",info:"info",warn:"warn"},tt="console",nt="http",rt=Object.keys(et),ot=function(){function e(e,t,n,r,o){void 0===n&&(n=nt),void 0===r&&(r=et.debug),void 0===o&&(o={}),this.handleLogStrategy=e,this.handlerType=n,this.level=r,this.contextManager=D("logger context"),this.contextManager.set(h({},o,t?{logger:{name:t}}:void 0))}return e.prototype.log=function(e,t,n,r){var i;if(void 0===n&&(n=et.info),n===et.error&&(i={origin:We}),null!=r){var a=Be({stackTrace:r instanceof Error?Ee(r):void 0,originalError:r,nonErrorPrefix:"Provided",source:We,handling:"handled",startClocks:V()});i={origin:We,stack:a.stack,kind:a.type,message:a.message}}var s=b(o.SANITIZE_INPUTS)?U(t):I(t),u=i?P({error:i},s):s;this.handleLogStrategy({message:b(o.SANITIZE_INPUTS)?U(e):e,context:u,status:n},this)},e.prototype.debug=function(e,t,n){this.log(e,t,et.debug,n)},e.prototype.info=function(e,t,n){this.log(e,t,et.info,n)},e.prototype.warn=function(e,t,n){this.log(e,t,et.warn,n)},e.prototype.error=function(e,t,n){this.log(e,t,et.error,n)},e.prototype.setContext=function(e){this.contextManager.set(e)},e.prototype.getContext=function(){return this.contextManager.get()},e.prototype.addContext=function(e,t){this.contextManager.add(e,t)},e.prototype.removeContext=function(e){this.contextManager.remove(e)},e.prototype.setHandler=function(e){this.handlerType=e},e.prototype.getHandler=function(){return this.handlerType},e.prototype.setLevel=function(e){this.level=e},e.prototype.getLevel=function(){return this.level},Qe([u],e.prototype,"log",null),e}();function it(e,t){var n=window.__ddBrowserSdkExtensionCallback;n&&n({type:e,payload:t})}var at={HIDDEN:"visibility_hidden",UNLOADING:"before_unload",PAGEHIDE:"page_hide",FROZEN:"page_frozen"};function st(){return Boolean(window._DATADOG_SYNTHETICS_INJECTS_RUM||ne("datadog-synthetics-injects-rum"))}function ut(){var e=window._DATADOG_SYNTHETICS_RESULT_ID||ne("datadog-synthetics-result-id");return"string"==typeof e?e:void 0}var ct,ft="log",lt="configuration",dt=["https://www.datadoghq-browser-agent.com","https://www.datad0g-browser-agent.com","http://localhost","<anonymous>"],vt=["ddog-gov.com"],pt={maxEventsPerPage:0,sentEventCount:0,telemetryEnabled:!1,telemetryConfigurationEnabled:!1};function gt(e,t){var n,o=new De;return pt.telemetryEnabled=!d(vt,t.site)&&oe(t.telemetrySampleRate),pt.telemetryConfigurationEnabled=pt.telemetryEnabled&&oe(t.telemetryConfigurationSampleRate),ct=function(t){if(pt.telemetryEnabled){var r=function(e,t){return P({type:"telemetry",date:Z(),service:e,version:"4.40.0",source:"browser",_dd:{format_version:2},telemetry:t,experimental_features:v(w())},void 0!==n?n():{})}(e,t);o.notify(r),it("telemetry",r)}},r=ht,h(pt,{maxEventsPerPage:t.maxTelemetryEventsPerPage,sentEventCount:0}),{setContextProvider:function(e){n=e},observable:o,enabled:pt.telemetryEnabled}}function ht(e){yt(h({type:ft,status:"error"},function(e){if(e instanceof Error){var t=Ee(e);return{error:{kind:t.name,stack:Ne(mt(t))},message:t.message}}return{error:{stack:Pe},message:"".concat("Uncaught"," ").concat(B(e))}}(e)))}function yt(e){ct&&pt.sentEventCount<pt.maxEventsPerPage&&(pt.sentEventCount+=1,ct(e))}function mt(e){return e.stack=e.stack.filter((function(e){return!e.url||dt.some((function(t){return g(e.url,t)}))})),e}var bt=function(){function e(e,t,n){var r=this;this.request=e,this.flushController=t,this.messageBytesLimit=n,this.pushOnlyBuffer=[],this.upsertBuffer={},this.flushController.flushObservable.subscribe((function(e){return r.flush(e)}))}return e.prototype.add=function(e){this.addOrUpdate(e)},e.prototype.upsert=function(e,t){this.addOrUpdate(e,t)},e.prototype.flush=function(e){var t=this.pushOnlyBuffer.concat(p(this.upsertBuffer));this.pushOnlyBuffer=[],this.upsertBuffer={};var n,r={data:t.join("\n"),bytesCount:e.bytesCount,flushReason:e.reason};n=e.reason,d(p(at),n)?this.request.sendOnExit(r):this.request.send(r)},e.prototype.addOrUpdate=function(e,n){var r=this.process(e),o=r.processedMessage,i=r.messageBytesCount;i>=this.messageBytesLimit?t.warn("Discarded a message whose size was bigger than the maximum allowed size ".concat(this.messageBytesLimit,"KB.")):(this.hasMessageFor(n)&&this.remove(n),this.push(o,i,n))},e.prototype.process=function(e){var t=B(e);return{processedMessage:t,messageBytesCount:x(t)}},e.prototype.push=function(e,t,n){var r=this.flushController.messagesCount>0?1:0;this.flushController.notifyBeforeAddMessage(t+r),void 0!==n?this.upsertBuffer[n]=e:this.pushOnlyBuffer.push(e),this.flushController.notifyAfterAddMessage()},e.prototype.remove=function(e){var t=this.upsertBuffer[e];delete this.upsertBuffer[e];var n=x(t),r=this.flushController.messagesCount>1?1:0;this.flushController.notifyAfterRemoveMessage(n+r)},e.prototype.hasMessageFor=function(e){return void 0!==e&&void 0!==this.upsertBuffer[e]},e}();function wt(e){return e>=500}var St=3145728;function xt(e,t,n,r,o){0===t.transportStatus&&0===t.queuedPayloads.size()&&t.bandwidthMonitor.canHandle(e)?kt(e,t,n,{onSuccess:function(){return Ct(0,t,n,r,o)},onFailure:function(){t.queuedPayloads.enqueue(e),Et(t,n,r,o)}}):t.queuedPayloads.enqueue(e)}function Et(e,t,n,r){2===e.transportStatus&&k((function(){kt(e.queuedPayloads.first(),e,t,{onSuccess:function(){e.queuedPayloads.dequeue(),e.currentBackoffTime=1e3,Ct(1,e,t,n,r)},onFailure:function(){e.currentBackoffTime=Math.min(6e4,2*e.currentBackoffTime),Et(e,t,n,r)}})}),e.currentBackoffTime)}function kt(e,t,n,r){var o=r.onSuccess,i=r.onFailure;t.bandwidthMonitor.add(e),n(e,(function(n){t.bandwidthMonitor.remove(e),!function(e){return"opaque"!==e.type&&(0===e.status&&!navigator.onLine||408===e.status||429===e.status||wt(e.status))}(n)?(t.transportStatus=0,o()):(t.transportStatus=t.bandwidthMonitor.ongoingRequestCount>0?1:2,e.retry={count:e.retry?e.retry.count+1:1,lastFailureStatus:n.status},i())}))}function Ct(e,t,n,r,o){0===e&&t.queuedPayloads.isFull()&&!t.queueFullReported&&(o({message:"Reached max ".concat(r," events size queued for upload: ").concat(3,"MiB"),source:Ve,startClocks:V()}),t.queueFullReported=!0);var i=t.queuedPayloads;for(t.queuedPayloads=_t();i.size()>0;)xt(i.dequeue(),t,n,r,o)}function _t(){var e=[];return{bytesCount:0,enqueue:function(t){this.isFull()||(e.push(t),this.bytesCount+=t.bytesCount)},first:function(){return e[0]},dequeue:function(){var t=e.shift();return t&&(this.bytesCount-=t.bytesCount),t},size:function(){return e.length},isFull:function(){return this.bytesCount>=St}}}function Tt(e,t,n){var r={transportStatus:0,currentBackoffTime:1e3,bandwidthMonitor:{ongoingRequestCount:0,ongoingByteCount:0,canHandle:function(e){return 0===this.ongoingRequestCount||this.ongoingByteCount+e.bytesCount<=81920&&this.ongoingRequestCount<32},add:function(e){this.ongoingRequestCount+=1,this.ongoingByteCount+=e.bytesCount},remove:function(e){this.ongoingRequestCount-=1,this.ongoingByteCount-=e.bytesCount}},queuedPayloads:_t(),queueFullReported:!1},o=function(n,r){return function(e,t,n,r){var o=n.data,i=n.bytesCount,a=n.flushReason,s=n.retry;if(function(){try{return window.Request&&"keepalive"in new Request("http://a")}catch(e){return!1}}()&&i<t){var u=e.build("fetch",a,s);fetch(u,{method:"POST",body:o,keepalive:!0,mode:"cors"}).then(c((function(e){return null==r?void 0:r({status:e.status,type:e.type})})),c((function(){Ot(e.build("xhr",a,s),o,r)})))}else{Ot(e.build("xhr",a,s),o,r)}}(e,t,n,r)};return{send:function(t){xt(t,r,o,e.endpointType,n)},sendOnExit:function(n){!function(e,t,n){var r=n.data,o=n.bytesCount,i=n.flushReason;if(navigator.sendBeacon&&o<t)try{var a=e.build("beacon",i);if(navigator.sendBeacon(a,r))return}catch(e){!function(e){Rt||(Rt=!0,ht(e))}(e)}Ot(e.build("xhr",i),r)}(e,t,n)}}}var Rt=!1;function Ot(e,t,n){var r=new XMLHttpRequest;r.open("POST",e,!0),Fe(r,"loadend",(function(){null==n||n({status:r.status})}),{once:!0}),r.send(t)}function Lt(e){var t=e.messagesLimit,n=e.bytesLimit,r=e.durationLimit,o=e.pageExitObservable,i=e.sessionExpireObservable,a=new De;o.subscribe((function(e){return f(e.reason)})),i.subscribe((function(){return f("session_expire")}));var s,u=0,c=0;function f(e){if(0!==c){var t=c,n=u;c=0,u=0,l(),a.notify({reason:e,messagesCount:t,bytesCount:n})}}function l(){C(s),s=void 0}return{flushObservable:a,get messagesCount(){return c},notifyBeforeAddMessage:function(e){u+e>=n&&f("bytes_limit"),c+=1,u+=e,void 0===s&&(s=k((function(){f("duration_limit")}),r))},notifyAfterAddMessage:function(){c>=t?f("messages_limit"):u>=n&&f("bytes_limit")},notifyAfterRemoveMessage:function(e){u-=e,0===(c-=1)&&l()}}}function At(e,t,n,r,o,i){var a,s=u(t);function u(t){return new bt(Tt(t,e.batchBytesLimit,n),Lt({messagesLimit:e.batchMessagesLimit,bytesLimit:e.batchBytesLimit,durationLimit:e.flushTimeout,pageExitObservable:r,sessionExpireObservable:o}),e.messageBytesLimit)}return i&&(a=u(i)),{add:function(e,t){void 0===t&&(t=!0),s.add(e),a&&t&&a.add(e)}}}var It=1/0,Pt=function(){function e(e){var t=this;this.expireDelay=e,this.entries=[],this.clearOldValuesInterval=_((function(){return t.clearOldValues()}),6e4)}return e.prototype.add=function(e,t){var n=this,r={value:e,startTime:t,endTime:It,remove:function(){var e=n.entries.indexOf(r);e>=0&&n.entries.splice(e,1)},close:function(e){r.endTime=e}};return this.entries.unshift(r),r},e.prototype.find=function(e){void 0===e&&(e=It);for(var t=0,n=this.entries;t<n.length;t++){var r=n[t];if(r.startTime<=e){if(e<=r.endTime)return r.value;break}}},e.prototype.closeActive=function(e){var t=this.entries[0];t&&t.endTime===It&&t.close(e)},e.prototype.findAll=function(e){return void 0===e&&(e=It),this.entries.filter((function(t){return t.startTime<=e&&e<=t.endTime})).map((function(e){return e.value}))},e.prototype.reset=function(){this.entries=[]},e.prototype.stop=function(){T(this.clearOldValuesInterval)},e.prototype.clearOldValues=function(){for(var e=J()-this.expireDelay;this.entries.length>0&&this.entries[this.entries.length-1].endTime<e;)this.entries.pop()},e}();var Bt,Nt=144e5,Ut=9e5,qt=/^([a-z]+)=([a-z0-9-]+)$/,jt="&",Dt="_dd_s",Mt=[];function Ft(e,t){var n;if(void 0===t&&(t=0),Bt||(Bt=e),e===Bt)if(t>=100)zt();else{var r,o=Vt();if(Ht()){if(o.lock)return void Gt(e,t);if(r=K(),o.lock=r,Jt(o,e.options),(o=Vt()).lock!==r)return void Gt(e,t)}var i=e.process(o);if(Ht()&&(o=Vt()).lock!==r)Gt(e,t);else{if(i&&Zt(i,e.options),Ht()&&(!i||!Wt(i))){if((o=Vt()).lock!==r)return void Gt(e,t);delete o.lock,Jt(o,e.options),i=o}null===(n=e.after)||void 0===n||n.call(e,i||o),zt()}}else Mt.push(e)}function Ht(){return!!window.chrome||/HeadlessChrome/.test(window.navigator.userAgent)}function Gt(e,t){k((function(){Ft(e,t+1)}),10)}function zt(){Bt=void 0;var e=Mt.shift();e&&Ft(e)}function Zt(e,t){Wt(e)?$t(t):(e.expire=String(z()+Ut),Jt(e,t))}function Jt(e,t){te(Dt,function(e){return(t=e,Object.keys(t).map((function(e){return[e,t[e]]}))).map((function(e){var t=e[0],n=e[1];return"".concat(t,"=").concat(n)})).join(jt);var t}(e),Ut,t)}function Vt(){var e=ne(Dt),t={};return function(e){return void 0!==e&&(-1!==e.indexOf(jt)||qt.test(e))}(e)&&e.split(jt).forEach((function(e){var n=qt.exec(e);if(null!==n){var r=n[1],o=n[2];t[r]=o}})),t}function $t(e){re(Dt,e)}function Wt(e){return ae(e)}function Xt(e,t,n){var r=new De,o=new De,i=_((function(){Ft({options:e,process:function(e){return c(e)?void 0:{}},after:s})}),1e3),a=function(){var e=Vt();if(c(e))return e;return{}}();function s(e){return c(e)||(e={}),u()&&(!function(e){return a.id!==e.id||a[t]!==e[t]}(e)?a=e:(a={},o.notify())),e}function u(){return void 0!==a[t]}function c(e){return(void 0===e.created||z()-Number(e.created)<Nt)&&(void 0===e.expire||z()<Number(e.expire))}return{expandOrRenewSession:R((function(){var o;Ft({options:e,process:function(e){var r=s(e);return o=function(e){var r=n(e[t]),o=r.trackingType,i=r.isTracked;e[t]=o,i&&!e.id&&(e.id=K(),e.created=String(z()));return i}(r),r},after:function(e){o&&!u()&&function(e){a=e,r.notify()}(e),a=e}})}),1e3).throttled,expandSession:function(){Ft({options:e,process:function(e){return u()?s(e):void 0}})},getSession:function(){return a},renewObservable:r,expireObservable:o,expire:function(){$t(e),s({})},stop:function(){T(i)}}}var Yt=[];function Kt(e,t,n){!function(e){var t=ne(Dt),n=ne("_dd"),r=ne("_dd_r"),o=ne("_dd_l");if(!t){var i={};n&&(i.id=n),o&&/^[01]$/.test(o)&&(i.logs=o),r&&/^[012]$/.test(r)&&(i.rum=r),Zt(i,e)}}(e);var r=Xt(e,t,n);Yt.push((function(){return r.stop()}));var o,i=new Pt(144e5);function a(){return{id:r.getSession().id,trackingType:r.getSession()[t]}}return Yt.push((function(){return i.stop()})),r.renewObservable.subscribe((function(){i.add(a(),J())})),r.expireObservable.subscribe((function(){i.closeActive(J())})),r.expandOrRenewSession(),i.add(a(),[0,$()][0]),o=He(window,["click","touchstart","keydown","scroll"],(function(){return r.expandOrRenewSession()}),{capture:!0,passive:!0}).stop,Yt.push(o),function(e){var t=function(){"visible"===document.visibilityState&&e()},n=Fe(document,"visibilitychange",t).stop;Yt.push(n);var r=_(t,6e4);Yt.push((function(){T(r)}))}((function(){return r.expandSession()})),{findActiveSession:function(e){return i.find(e)},renewObservable:r.renewObservable,expireObservable:r.expireObservable,expire:r.expire}}var Qt;function en(e){var t=Kt(e.cookieOptions,"logs",(function(t){return function(e,t){var n=function(e){return"0"===e||"1"===e}(t)?t:tn(e);return{trackingType:n,isTracked:"1"===n}}(e,t)}));return{findTrackedSession:function(e){var n=t.findActiveSession(e);return n&&"1"===n.trackingType?{id:n.id}:void 0},expireObservable:t.expireObservable}}function tn(e){return oe(e.sessionSampleRate)?"1":"0"}var nn=((Qt={})[et.debug]=0,Qt[et.info]=1,Qt[et.warn]=2,Qt[et.error]=3,Qt);function rn(e,t,n){var r=n.getHandler(),o=Array.isArray(r)?r:[r];return nn[e]>=nn[n.getLevel()]&&d(o,t)}function on(e,t,n,r,o,i){var a=rt.concat(["custom"]),s={};a.forEach((function(e){var n,r,o,a,u;s[e]=(n=e,r=t.eventRateLimiterThreshold,o=i,a=0,u=!1,{isLimitReached:function(){if(0===a&&k((function(){a=0}),G),(a+=1)<=r||u)return u=!1,!1;if(a===r+1){u=!0;try{o({message:"Reached max number of ".concat(n,"s by minute: ").concat(r),source:Ve,startClocks:V()})}finally{u=!1}}return!0}})})),n.subscribe(0,(function(i){var a,u,c,f=i.rawLogsEvent,l=i.messageContext,d=void 0===l?void 0:l,v=i.savedCommonContext,p=void 0===v?void 0:v,g=i.logger,h=void 0===g?o:g,y=f.date-$(),m=e.findTrackedSession(y);if(m){var b=p||r(),w=P({service:t.service,session_id:m.id,usr:ae(b.user)?void 0:b.user,view:b.view},b.context,sn(y),f,h.getContext(),d);!rn(f.status,nt,h)||!1===(null===(a=t.beforeSend)||void 0===a?void 0:a.call(t,w))||(null===(u=w.error)||void 0===u?void 0:u.origin)!==Ve&&(null!==(c=s[w.status])&&void 0!==c?c:s.custom).isLimitReached()||n.notify(1,w)}}))}var an=!1;function sn(t){var n,r=window;if(st()){var o=i(r.DD_RUM_SYNTHETICS);return o||an||(an=!0,function(t,n){l(e.debug,t,n),yt(h({type:ft,message:t,status:"debug"},n))}("Logs sent before RUM is injected by the synthetics worker",{testId:(n=window._DATADOG_SYNTHETICS_PUBLIC_ID||ne("datadog-synthetics-public-id"),"string"==typeof n?n:void 0),resultId:ut()})),o}return i(r.DD_RUM);function i(e){if(e&&e.getInternalContext)return e.getInternalContext(t)}}var un,cn={};function fn(e){var t=e.map((function(e){return cn[e]||(cn[e]=function(e){var t=new De((function(){var n=console[e];return console[e]=function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.apply(console,r);var i=qe();f((function(){t.notify(ln(r,e,i))}))},function(){console[e]=n}}));return t}(e)),cn[e]}));return Me.apply(void 0,t)}function ln(t,n,r){var i,a=t.map((function(e){return function(e){if("string"==typeof e)return b(o.SANITIZE_INPUTS)?U(e):e;if(e instanceof Error)return Ue(Ee(e));return B(b(o.SANITIZE_INPUTS)?U(e):e,void 0,2)}(e)})).join(" ");if(n===e.error){var s=function(e,t){for(var n=0;n<e.length;n+=1){var r=e[n];if(t(r,n))return r}}(t,(function(e){return e instanceof Error}));i=s?Ne(Ee(s)):void 0,a="console error: ".concat(a)}return{api:n,message:a,stack:i,handlingStack:r}}var dn,vn=((un={})[e.log]=et.info,un[e.debug]=et.debug,un[e.info]=et.info,un[e.warn]=et.warn,un[e.error]=et.error,un);var pn,gn=((dn={})[Ge.cspViolation]=et.error,dn[Ge.intervention]=et.error,dn[Ge.deprecation]=et.warn,dn);function hn(e,t,n){var r=e[t],o=n(r),i=function(){if("function"==typeof o)return o.apply(this,arguments)};return e[t]=i,{stop:function(){e[t]===i?e[t]=r:o=r}}}function yn(e,t,n){var r=n.before,o=n.after;return hn(e,t,(function(e){return function(){var t,n=arguments;return r&&f(r,this,n),"function"==typeof e&&(t=e.apply(this,n)),o&&f(o,this,n),t}}))}var mn,bn=new WeakMap;function wn(){var e;return pn||(e=new De((function(){var t=yn(XMLHttpRequest.prototype,"open",{before:Sn}).stop,n=yn(XMLHttpRequest.prototype,"send",{before:function(){xn.call(this,e)}}).stop,r=yn(XMLHttpRequest.prototype,"abort",{before:En}).stop;return function(){t(),n(),r()}})),pn=e),pn}function Sn(e,t){bn.set(this,{state:"open",method:e,url:se(String(t))})}function xn(e){var t=this,n=bn.get(this);if(n){var r=n;r.state="start",r.startTime=J(),r.startClocks=V(),r.isAborted=!1,r.xhr=this;var o=!1,i=yn(this,"onreadystatechange",{before:function(){this.readyState===XMLHttpRequest.DONE&&a()}}).stop,a=function(){if(s(),i(),!o){o=!0;var a,u=n;u.state="complete",u.duration=(a=r.startClocks.timeStamp,Z()-a),u.status=t.status,e.notify(h({},u))}},s=Fe(this,"loadend",a).stop;e.notify(r)}}function En(){var e=bn.get(this);e&&(e.isAborted=!0)}function kn(){var e;return mn||(e=new De((function(){if(window.fetch)return hn(window,"fetch",(function(t){return function(n,r){var o,i=f(Cn,null,[e,n,r]);return i?(o=t.call(this,i.input,i.init),f(_n,null,[e,o,i])):o=t.call(this,n,r),o}})).stop})),mn=e),mn}function Cn(e,t,n){var r=n&&n.method||t instanceof Request&&t.method||"GET",o=t instanceof Request?t.url:se(String(t)),i={state:"start",init:n,input:t,method:r,startClocks:V(),url:o};return e.notify(i),i}function _n(e,t,n){var r=function(t){var r=n;r.state="resolve","stack"in t||t instanceof Error?(r.status=0,r.isAborted=t instanceof DOMException&&t.code===DOMException.ABORT_ERR,r.error=t):"status"in t&&(r.response=t,r.responseType=t.type,r.status=t.status,r.isAborted=!1),e.notify(r)};t.then(c(r),c(r))}function Tn(e,t){if(!e.forwardErrorsToLogs)return{stop:O};var n=wn().subscribe((function(e){"complete"===e.state&&o("xhr",e)})),r=kn().subscribe((function(e){"resolve"===e.state&&o("fetch",e)}));function o(n,r){function o(e){t.notify(0,{rawLogsEvent:{message:"".concat(On(n)," error ").concat(r.method," ").concat(r.url),date:r.startClocks.timeStamp,error:{origin:Xe,stack:e||"Failed to load"},http:{method:r.method,status_code:r.status,url:r.url},status:et.error,origin:Xe}})}e.isIntakeUrl(r.url)||!function(e){return 0===e.status&&"opaque"!==e.responseType}(r)&&!wt(r.status)||("xhr"in r?function(e,t,n){"string"==typeof e.response?n(Rn(e.response,t)):n(e.response)}(r.xhr,e,o):r.response?function(e,t,n){var r=function(e){try{return e.clone()}catch(e){return}}(e);r&&r.body?window.TextDecoder?function(e,t,n){!function(e,t,n){var r=e.getReader(),o=[],i=0;function a(){var e,a;if(r.cancel().catch(O),n.collectStreamBody){var s;if(1===o.length)s=o[0];else{s=new Uint8Array(i);var u=0;o.forEach((function(e){s.set(e,u),u+=e.length}))}e=s.slice(0,n.bytesLimit),a=s.length>n.bytesLimit}t(void 0,e,a)}!function e(){r.read().then(c((function(t){t.done?a():(n.collectStreamBody&&o.push(t.value),(i+=t.value.length)>n.bytesLimit?a():e())})),c((function(e){return t(e)})))}()}(e,(function(e,t,r){if(e)n(e);else{var o=(new TextDecoder).decode(t);r&&(o+="..."),n(void 0,o)}}),{bytesLimit:t,collectStreamBody:!0})}(r.body,t.requestErrorResponseLengthLimit,(function(e,t){n(e?"Unable to retrieve response: ".concat(e):t)})):r.text().then(c((function(e){return n(Rn(e,t))})),c((function(e){return n("Unable to retrieve response: ".concat(e))}))):n()}(r.response,e,o):r.error&&function(e,t,n){n(Rn(Ne(Ee(e)),t))}(r.error,e,o))}return{stop:function(){n.unsubscribe(),r.unsubscribe()}}}function Rn(e,t){return e.length>t.requestErrorResponseLengthLimit?"".concat(e.substring(0,t.requestErrorResponseLengthLimit),"..."):e}function On(e){return"xhr"===e?"XHR":"Fetch"}var Ln=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;function An(e){var t=function(e){return yn(window,"onerror",{before:function(t,n,r,o,i){var a;if(i)a=Ee(i),e(a,i);else{var s,u={url:n,column:o,line:r},c=t;if("[object String]"==={}.toString.call(t)){var f=Ln.exec(c);f&&(s=f[1],c=f[2])}e(a={name:s,message:"string"==typeof c?c:void 0,stack:[u]},t)}}})}(e).stop,n=function(e){return yn(window,"onunhandledrejection",{before:function(t){var n=t.reason||"Empty reason",r=Ee(n);e(r,n)}})}(e).stop;return{stop:function(){t(),n()}}}function In(e,t){if(!e.forwardErrorsToLogs)return{stop:O};var n,r=new De,o=(n=r,An((function(e,t){n.notify(Be({stackTrace:e,originalError:t,startClocks:V(),nonErrorPrefix:"Uncaught",source:Ye,handling:"unhandled"}))}))).stop,i=r.subscribe((function(e){t.notify(0,{rawLogsEvent:{message:e.message,date:e.startClocks.timeStamp,error:{kind:e.type,origin:Ye,stack:e.stack},origin:Ye,status:et.error}})}));return{stop:function(){o(),i.unsubscribe()}}}var Pn=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}();var Bn,Nn,Un,qn,jn=function(n){var r,i,a=!1,u=D("global context"),f=D("user"),l={},v=function(){},g=new F,y=function(e,t,n,r){void 0===n&&(n=I(S())),void 0===r&&(r=Z()),g.add((function(){return y(e,t,n,r)}))},m=function(){},w=new ot((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return y.apply(void 0,e)}));function S(){return{view:{referrer:document.referrer,url:window.location.href},context:u.getContext(),user:f.getContext()}}return r={logger:w,init:c((function(r){var o;if(m=function(){return I(r)},X()&&(r=function(e){return h({},e,{clientToken:"empty"})}(r)),function(e){return!a||(e.silentMultipleInit||t.error("DD_LOGS is already initialized."),!1)}(r)){var i=function(t){var n=we(t),r=Je(t.forwardConsoleLogs,p(e),"Forward Console Logs"),o=Je(t.forwardReports,p(Ge),"Forward Reports");if(n&&r&&o)return t.forwardErrorsToLogs&&!d(r,e.error)&&r.push(e.error),h({forwardErrorsToLogs:!1!==t.forwardErrorsToLogs,forwardConsoleLogs:r,forwardReports:o,requestErrorResponseLengthLimit:32768},n)}(r);i&&(o=n(r,i,S,w),y=o.handleLog,v=o.getInternalContext,g.drain(),a=!0)}})),getLoggerGlobalContext:c(u.get),getGlobalContext:c(u.getContext),setLoggerGlobalContext:c(u.set),setGlobalContext:c(u.setContext),addLoggerGlobalContext:c(u.add),setGlobalContextProperty:c(u.setContextProperty),removeLoggerGlobalContext:c(u.remove),removeGlobalContextProperty:c(u.removeContextProperty),clearGlobalContext:c(u.clearContext),createLogger:c((function(e,t){return void 0===t&&(t={}),l[e]=new ot((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return y.apply(void 0,e)}),b(o.SANITIZE_INPUTS)?U(e):e,t.handler,t.level,b(o.SANITIZE_INPUTS)?U(t.context):t.context),l[e]})),getLogger:c((function(e){return l[e]})),getInitConfiguration:c((function(){return m()})),getInternalContext:c((function(e){return v(e)})),setUser:c((function(e){(function(e){var n="object"===L(e);return n||t.error("Unsupported user:",e),n})(e)&&f.setContext(Y(e))})),getUser:c(f.getContext),setUserProperty:c((function(e,t){var n,r=Y((n={},n[e]=t,n))[e];f.setContextProperty(e,r)})),removeUserProperty:c(f.removeContextProperty),clearUser:c(f.clearContext)},i=h({version:"4.40.0",onReady:function(e){e()}},r),Object.defineProperty(i,"_setDebug",{get:function(){return s},enumerable:!1}),i}((function(n,r,i,a){var s=new Pn;s.subscribe(1,(function(e){return it("logs",e)}));var u,c=function(e){return s.notify(0,{rawLogsEvent:{message:e.message,date:e.startClocks.timeStamp,error:{origin:Ve},origin:Ve,status:et.error}})},f=u=new De((function(){var e=b(o.PAGEHIDE),t=He(window,["visibilitychange","freeze","pagehide"],(function(t){"pagehide"===t.type&&e?u.notify({reason:at.PAGEHIDE}):"visibilitychange"===t.type&&"hidden"===document.visibilityState?u.notify({reason:at.HIDDEN}):"freeze"===t.type&&u.notify({reason:at.FROZEN})}),{capture:!0}).stop,n=O;return e||(n=Fe(window,"beforeunload",(function(){u.notify({reason:at.UNLOADING})})).stop),function(){t(),n()}})),l=!function(e){if(void 0===document.cookie||null===document.cookie)return!1;try{var n="dd_cookie_test_".concat(K()),r="test";te(n,r,G,e);var o=ne(n)===r;return re(n,e),o}catch(e){return t.error(e),!1}}(r.cookieOptions)||X()||st()?function(e){var t="1"===tn(e)?{}:void 0;return{findTrackedSession:function(){return t},expireObservable:new De}}(r):en(r),d=function(e,t,n,r){var o,i=gt("browser-logs-sdk",e);if(X()){var a=W();i.observable.subscribe((function(e){return a.send("internal_telemetry",e)}))}else{var s=At(e,e.rumEndpointBuilder,t,n,r,null===(o=e.replica)||void 0===o?void 0:o.rumEndpointBuilder);i.observable.subscribe((function(t){return s.add(t,function(e){return"datad0g.com"===e.site}(e))}))}return i}(r,c,f,l.expireObservable);d.setContextProvider((function(){var e,t,n,r,o,i;return{application:{id:null===(e=sn())||void 0===e?void 0:e.application_id},session:{id:null===(t=l.findTrackedSession())||void 0===t?void 0:t.id},view:{id:null===(r=null===(n=sn())||void 0===n?void 0:n.view)||void 0===r?void 0:r.id},action:{id:null===(i=null===(o=sn())||void 0===o?void 0:o.user_action)||void 0===i?void 0:i.id}}})),Tn(r,s),In(r,s),function(t,n){var r=fn(t.forwardConsoleLogs).subscribe((function(t){n.notify(0,{rawLogsEvent:{date:Z(),message:t.message,origin:$e,error:t.api===e.error?{origin:$e,stack:t.stack}:void 0,status:vn[t.api]}})}))}(r,s),function(e,t){var n=ze(e.forwardReports).subscribe((function(e){var n,r=e.message,o=gn[e.type];o===et.error?n={kind:e.subtype,origin:Ke,stack:e.stack}:e.stack&&(r+=" Found in ".concat(function(e){var t;return null===(t=/@ (.+)/.exec(e))||void 0===t?void 0:t[1]}(e.stack))),t.notify(0,{rawLogsEvent:{date:Z(),message:r,origin:Ke,error:n,status:o}})}))}(r,s);var v,p=function(e){return{handleLog:function(n,r,o,i){var a=n.context;rn(n.status,tt,r)&&t(n.status,n.message,P(r.getContext(),a)),e.notify(0,{rawLogsEvent:{date:i||Z(),message:n.message,status:n.status,origin:We},messageContext:a,savedCommonContext:o,logger:r})}}}(s).handleLog;return on(l,r,s,i,a,c),X()?function(e){var t=W();e.subscribe(1,(function(e){t.send("log",e)}))}(s):function(e,t,n,r,o){var i,a=At(e,e.logsEndpointBuilder,n,r,o,null===(i=e.replica)||void 0===i?void 0:i.logsEndpointBuilder);t.subscribe(1,(function(e){a.add(e)}))}(r,s,c,f,l.expireObservable),function(e){pt.telemetryConfigurationEnabled&&yt({type:lt,configuration:e})}(function(e){var t=function(e){var t,n,r=null!==(t=e.proxy)&&void 0!==t?t:e.proxyUrl;return{session_sample_rate:null!==(n=e.sessionSampleRate)&&void 0!==n?n:e.sampleRate,telemetry_sample_rate:e.telemetrySampleRate,telemetry_configuration_sample_rate:e.telemetryConfigurationSampleRate,use_before_send:!!e.beforeSend,use_cross_site_session_cookie:e.useCrossSiteSessionCookie,use_secure_session_cookie:e.useSecureSessionCookie,use_proxy:void 0!==r?!!r:void 0,silent_multiple_init:e.silentMultipleInit,track_session_across_subdomains:e.trackSessionAcrossSubdomains,track_resources:e.trackResources,track_long_task:e.trackLongTasks}}(e);return h({forward_errors_to_logs:e.forwardErrorsToLogs,forward_console_logs:e.forwardConsoleLogs,forward_reports:e.forwardReports},t)}(n)),{handleLog:p,getInternalContext:(v=l,{get:function(e){var t=v.findTrackedSession(e);if(t)return{session_id:t.id}}}).get}}));Bn=y(),Un=jn,qn=Bn[Nn="DD_LOGS"],Bn[Nn]=Un,qn&&qn.q&&qn.q.forEach((function(e){return n(e,"onReady callback threw an error:")()}))}();

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

var pageExitObservable = (0, browser_core_1.createPageExitObservable)();
var telemetry = startLogsTelemetry(configuration, reportError, pageExitObservable);
var session = (0, browser_core_1.areCookiesAuthorized)(configuration.cookieOptions) && !(0, browser_core_1.canUseEventBridge)() && !(0, browser_core_1.willSyntheticsInjectRum)()
? (0, logsSessionManager_1.startLogsSessionManager)(configuration)
: (0, logsSessionManager_1.startLogsSessionManagerStub)(configuration);
var telemetry = startLogsTelemetry(configuration, reportError, pageExitObservable, session.expireObservable);
telemetry.setContextProvider(function () {

@@ -59,8 +62,5 @@ var _a, _b, _c, _d, _e, _f;

var handleLog = (0, loggerCollection_1.startLoggerCollection)(lifeCycle).handleLog;
var session = (0, browser_core_1.areCookiesAuthorized)(configuration.cookieOptions) && !(0, browser_core_1.canUseEventBridge)() && !(0, browser_core_1.willSyntheticsInjectRum)()
? (0, logsSessionManager_1.startLogsSessionManager)(configuration)
: (0, logsSessionManager_1.startLogsSessionManagerStub)(configuration);
(0, assembly_1.startLogsAssembly)(session, configuration, lifeCycle, buildCommonContext, mainLogger, reportError);
if (!(0, browser_core_1.canUseEventBridge)()) {
(0, startLogsBatch_1.startLogsBatch)(configuration, lifeCycle, reportError, pageExitObservable);
(0, startLogsBatch_1.startLogsBatch)(configuration, lifeCycle, reportError, pageExitObservable, session.expireObservable);
}

@@ -78,3 +78,3 @@ else {

exports.startLogs = startLogs;
function startLogsTelemetry(configuration, reportError, pageExitObservable) {
function startLogsTelemetry(configuration, reportError, pageExitObservable, sessionExpireObservable) {
var _a;

@@ -87,3 +87,3 @@ var telemetry = (0, browser_core_1.startTelemetry)("browser-logs-sdk" /* TelemetryService.LOGS */, configuration);

else {
var telemetryBatch_1 = (0, browser_core_1.startBatchWithReplica)(configuration, configuration.rumEndpointBuilder, reportError, pageExitObservable, (_a = configuration.replica) === null || _a === void 0 ? void 0 : _a.rumEndpointBuilder);
var telemetryBatch_1 = (0, browser_core_1.startBatchWithReplica)(configuration, configuration.rumEndpointBuilder, reportError, pageExitObservable, sessionExpireObservable, (_a = configuration.replica) === null || _a === void 0 ? void 0 : _a.rumEndpointBuilder);
telemetry.observable.subscribe(function (event) { return telemetryBatch_1.add(event, (0, browser_core_1.isTelemetryReplicationAllowed)(configuration)); });

@@ -90,0 +90,0 @@ }

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

import type { Context, Subscription } from '@datadog/browser-core';
import { AbstractLifeCycle } from '@datadog/browser-core';
import type { Context } from '@datadog/browser-core';
import type { LogsEvent } from '../logsEvent.types';

@@ -9,9 +10,10 @@ import type { CommonContext, RawLogsEvent } from '../rawLogsEvent.types';

}
export declare class LifeCycle {
private callbacks;
notify<E extends RawLogsEvent = RawLogsEvent>(eventType: LifeCycleEventType.RAW_LOG_COLLECTED, data: RawLogsEventCollectedData<E>): void;
notify(eventType: LifeCycleEventType.LOG_COLLECTED, data: LogsEvent & Context): void;
subscribe(eventType: LifeCycleEventType.RAW_LOG_COLLECTED, callback: (data: RawLogsEventCollectedData) => void): Subscription;
subscribe(eventType: LifeCycleEventType.LOG_COLLECTED, callback: (data: LogsEvent & Context) => void): Subscription;
interface LifeCycleEventMap {
[LifeCycleEventType.RAW_LOG_COLLECTED]: RawLogsEventCollectedData;
[LifeCycleEventType.LOG_COLLECTED]: LogsEvent & Context;
}
export declare const LifeCycle: {
new (): AbstractLifeCycle<LifeCycleEventMap>;
};
export type LifeCycle = AbstractLifeCycle<LifeCycleEventMap>;
export interface RawLogsEventCollectedData<E extends RawLogsEvent = RawLogsEvent> {

@@ -23,1 +25,2 @@ rawLogsEvent: E;

}
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LifeCycle = void 0;
var LifeCycle = /** @class */ (function () {
function LifeCycle() {
this.callbacks = {};
}
LifeCycle.prototype.notify = function (eventType, data) {
var eventCallbacks = this.callbacks[eventType];
if (eventCallbacks) {
eventCallbacks.forEach(function (callback) { return callback(data); });
}
};
LifeCycle.prototype.subscribe = function (eventType, callback) {
var _this = this;
if (!this.callbacks[eventType]) {
this.callbacks[eventType] = [];
}
this.callbacks[eventType].push(callback);
return {
unsubscribe: function () {
_this.callbacks[eventType] = _this.callbacks[eventType].filter(function (other) { return callback !== other; });
},
};
};
return LifeCycle;
}());
exports.LifeCycle = LifeCycle;
var browser_core_1 = require("@datadog/browser-core");
exports.LifeCycle = (browser_core_1.AbstractLifeCycle);
//# sourceMappingURL=lifeCycle.js.map

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

originalError: error,
nonErrorPrefix: browser_core_1.PROVIDED_ERROR_MESSAGE_PREFIX,
nonErrorPrefix: "Provided" /* NonErrorPrefix.PROVIDED */,
source: browser_core_1.ErrorSource.LOGGER,

@@ -49,0 +49,0 @@ handling: "handled" /* ErrorHandling.HANDLED */,

import type { RelativeTime } from '@datadog/browser-core';
import { Observable } from '@datadog/browser-core';
import type { LogsConfiguration } from './configuration';

@@ -6,2 +7,3 @@ export declare const LOGS_SESSION_KEY = "logs";

findTrackedSession: (startTime?: RelativeTime) => LogsSession | undefined;
expireObservable: Observable<void>;
}

@@ -8,0 +10,0 @@ export type LogsSession = {

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

},
expireObservable: sessionManager.expireObservable,
};

@@ -28,2 +29,3 @@ }

findTrackedSession: function () { return session; },
expireObservable: new browser_core_1.Observable(),
};

@@ -30,0 +32,0 @@ }

import type { Observable, PageExitEvent, RawError } from '@datadog/browser-core';
import type { LogsConfiguration } from '../domain/configuration';
import type { LifeCycle } from '../domain/lifeCycle';
export declare function startLogsBatch(configuration: LogsConfiguration, lifeCycle: LifeCycle, reportError: (error: RawError) => void, pageExitObservable: Observable<PageExitEvent>): void;
export declare function startLogsBatch(configuration: LogsConfiguration, lifeCycle: LifeCycle, reportError: (error: RawError) => void, pageExitObservable: Observable<PageExitEvent>, sessionExpireObservable: Observable<void>): void;

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

var browser_core_1 = require("@datadog/browser-core");
function startLogsBatch(configuration, lifeCycle, reportError, pageExitObservable) {
function startLogsBatch(configuration, lifeCycle, reportError, pageExitObservable, sessionExpireObservable) {
var _a;
var batch = (0, browser_core_1.startBatchWithReplica)(configuration, configuration.logsEndpointBuilder, reportError, pageExitObservable, (_a = configuration.replica) === null || _a === void 0 ? void 0 : _a.logsEndpointBuilder);
var batch = (0, browser_core_1.startBatchWithReplica)(configuration, configuration.logsEndpointBuilder, reportError, pageExitObservable, sessionExpireObservable, (_a = configuration.replica) === null || _a === void 0 ? void 0 : _a.logsEndpointBuilder);
lifeCycle.subscribe(1 /* LifeCycleEventType.LOG_COLLECTED */, function (serverLogsEvent) {

@@ -10,0 +10,0 @@ batch.add(serverLogsEvent);

@@ -32,3 +32,6 @@ import { sendToExtension, createPageExitObservable, willSyntheticsInjectRum, areCookiesAuthorized, canUseEventBridge, getEventBridge, startTelemetry, startBatchWithReplica, isTelemetryReplicationAllowed, ErrorSource, addTelemetryConfiguration, } from '@datadog/browser-core';

var pageExitObservable = createPageExitObservable();
var telemetry = startLogsTelemetry(configuration, reportError, pageExitObservable);
var session = areCookiesAuthorized(configuration.cookieOptions) && !canUseEventBridge() && !willSyntheticsInjectRum()
? startLogsSessionManager(configuration)
: startLogsSessionManagerStub(configuration);
var telemetry = startLogsTelemetry(configuration, reportError, pageExitObservable, session.expireObservable);
telemetry.setContextProvider(function () {

@@ -56,8 +59,5 @@ var _a, _b, _c, _d, _e, _f;

var handleLog = startLoggerCollection(lifeCycle).handleLog;
var session = areCookiesAuthorized(configuration.cookieOptions) && !canUseEventBridge() && !willSyntheticsInjectRum()
? startLogsSessionManager(configuration)
: startLogsSessionManagerStub(configuration);
startLogsAssembly(session, configuration, lifeCycle, buildCommonContext, mainLogger, reportError);
if (!canUseEventBridge()) {
startLogsBatch(configuration, lifeCycle, reportError, pageExitObservable);
startLogsBatch(configuration, lifeCycle, reportError, pageExitObservable, session.expireObservable);
}

@@ -74,3 +74,3 @@ else {

}
function startLogsTelemetry(configuration, reportError, pageExitObservable) {
function startLogsTelemetry(configuration, reportError, pageExitObservable, sessionExpireObservable) {
var _a;

@@ -83,3 +83,3 @@ var telemetry = startTelemetry("browser-logs-sdk" /* TelemetryService.LOGS */, configuration);

else {
var telemetryBatch_1 = startBatchWithReplica(configuration, configuration.rumEndpointBuilder, reportError, pageExitObservable, (_a = configuration.replica) === null || _a === void 0 ? void 0 : _a.rumEndpointBuilder);
var telemetryBatch_1 = startBatchWithReplica(configuration, configuration.rumEndpointBuilder, reportError, pageExitObservable, sessionExpireObservable, (_a = configuration.replica) === null || _a === void 0 ? void 0 : _a.rumEndpointBuilder);
telemetry.observable.subscribe(function (event) { return telemetryBatch_1.add(event, isTelemetryReplicationAllowed(configuration)); });

@@ -86,0 +86,0 @@ }

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

import type { Context, Subscription } from '@datadog/browser-core';
import { AbstractLifeCycle } from '@datadog/browser-core';
import type { Context } from '@datadog/browser-core';
import type { LogsEvent } from '../logsEvent.types';

@@ -9,9 +10,10 @@ import type { CommonContext, RawLogsEvent } from '../rawLogsEvent.types';

}
export declare class LifeCycle {
private callbacks;
notify<E extends RawLogsEvent = RawLogsEvent>(eventType: LifeCycleEventType.RAW_LOG_COLLECTED, data: RawLogsEventCollectedData<E>): void;
notify(eventType: LifeCycleEventType.LOG_COLLECTED, data: LogsEvent & Context): void;
subscribe(eventType: LifeCycleEventType.RAW_LOG_COLLECTED, callback: (data: RawLogsEventCollectedData) => void): Subscription;
subscribe(eventType: LifeCycleEventType.LOG_COLLECTED, callback: (data: LogsEvent & Context) => void): Subscription;
interface LifeCycleEventMap {
[LifeCycleEventType.RAW_LOG_COLLECTED]: RawLogsEventCollectedData;
[LifeCycleEventType.LOG_COLLECTED]: LogsEvent & Context;
}
export declare const LifeCycle: {
new (): AbstractLifeCycle<LifeCycleEventMap>;
};
export type LifeCycle = AbstractLifeCycle<LifeCycleEventMap>;
export interface RawLogsEventCollectedData<E extends RawLogsEvent = RawLogsEvent> {

@@ -23,1 +25,2 @@ rawLogsEvent: E;

}
export {};

@@ -1,26 +0,3 @@

var LifeCycle = /** @class */ (function () {
function LifeCycle() {
this.callbacks = {};
}
LifeCycle.prototype.notify = function (eventType, data) {
var eventCallbacks = this.callbacks[eventType];
if (eventCallbacks) {
eventCallbacks.forEach(function (callback) { return callback(data); });
}
};
LifeCycle.prototype.subscribe = function (eventType, callback) {
var _this = this;
if (!this.callbacks[eventType]) {
this.callbacks[eventType] = [];
}
this.callbacks[eventType].push(callback);
return {
unsubscribe: function () {
_this.callbacks[eventType] = _this.callbacks[eventType].filter(function (other) { return callback !== other; });
},
};
};
return LifeCycle;
}());
export { LifeCycle };
import { AbstractLifeCycle } from '@datadog/browser-core';
export var LifeCycle = (AbstractLifeCycle);
//# sourceMappingURL=lifeCycle.js.map

@@ -7,3 +7,3 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

};
import { ExperimentalFeature, isExperimentalFeatureEnabled, clocksNow, computeRawError, PROVIDED_ERROR_MESSAGE_PREFIX, computeStackTrace, deepClone, assign, combine, createContextManager, ErrorSource, monitored, sanitize, } from '@datadog/browser-core';
import { ExperimentalFeature, isExperimentalFeatureEnabled, clocksNow, computeRawError, computeStackTrace, deepClone, assign, combine, createContextManager, ErrorSource, monitored, sanitize, } from '@datadog/browser-core';
export var StatusType = {

@@ -44,3 +44,3 @@ debug: 'debug',

originalError: error,
nonErrorPrefix: PROVIDED_ERROR_MESSAGE_PREFIX,
nonErrorPrefix: "Provided" /* NonErrorPrefix.PROVIDED */,
source: ErrorSource.LOGGER,

@@ -47,0 +47,0 @@ handling: "handled" /* ErrorHandling.HANDLED */,

import type { RelativeTime } from '@datadog/browser-core';
import { Observable } from '@datadog/browser-core';
import type { LogsConfiguration } from './configuration';

@@ -6,2 +7,3 @@ export declare const LOGS_SESSION_KEY = "logs";

findTrackedSession: (startTime?: RelativeTime) => LogsSession | undefined;
expireObservable: Observable<void>;
}

@@ -8,0 +10,0 @@ export type LogsSession = {

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

import { performDraw, startSessionManager } from '@datadog/browser-core';
import { Observable, performDraw, startSessionManager } from '@datadog/browser-core';
export var LOGS_SESSION_KEY = 'logs';

@@ -16,2 +16,3 @@ export function startLogsSessionManager(configuration) {

},
expireObservable: sessionManager.expireObservable,
};

@@ -24,2 +25,3 @@ }

findTrackedSession: function () { return session; },
expireObservable: new Observable(),
};

@@ -26,0 +28,0 @@ }

import type { Observable, PageExitEvent, RawError } from '@datadog/browser-core';
import type { LogsConfiguration } from '../domain/configuration';
import type { LifeCycle } from '../domain/lifeCycle';
export declare function startLogsBatch(configuration: LogsConfiguration, lifeCycle: LifeCycle, reportError: (error: RawError) => void, pageExitObservable: Observable<PageExitEvent>): void;
export declare function startLogsBatch(configuration: LogsConfiguration, lifeCycle: LifeCycle, reportError: (error: RawError) => void, pageExitObservable: Observable<PageExitEvent>, sessionExpireObservable: Observable<void>): void;
import { startBatchWithReplica } from '@datadog/browser-core';
export function startLogsBatch(configuration, lifeCycle, reportError, pageExitObservable) {
export function startLogsBatch(configuration, lifeCycle, reportError, pageExitObservable, sessionExpireObservable) {
var _a;
var batch = startBatchWithReplica(configuration, configuration.logsEndpointBuilder, reportError, pageExitObservable, (_a = configuration.replica) === null || _a === void 0 ? void 0 : _a.logsEndpointBuilder);
var batch = startBatchWithReplica(configuration, configuration.logsEndpointBuilder, reportError, pageExitObservable, sessionExpireObservable, (_a = configuration.replica) === null || _a === void 0 ? void 0 : _a.logsEndpointBuilder);
lifeCycle.subscribe(1 /* LifeCycleEventType.LOG_COLLECTED */, function (serverLogsEvent) {

@@ -6,0 +6,0 @@ batch.add(serverLogsEvent);

{
"name": "@datadog/browser-logs",
"version": "4.39.0",
"version": "4.40.0",
"license": "Apache-2.0",

@@ -16,6 +16,6 @@ "main": "cjs/entries/main.js",

"dependencies": {
"@datadog/browser-core": "4.39.0"
"@datadog/browser-core": "4.40.0"
},
"peerDependencies": {
"@datadog/browser-rum": "4.39.0"
"@datadog/browser-rum": "4.40.0"
},

@@ -35,3 +35,3 @@ "peerDependenciesMeta": {

},
"gitHead": "128da89b469c77d6cfdabca15eb3d7ac09c3d5ae"
"gitHead": "4a291821c3e07385b7ab76566bb6aa5d4cc5a80f"
}

@@ -26,3 +26,3 @@ import type { Context, TelemetryEvent, RawError, Observable, PageExitEvent } from '@datadog/browser-core'

import { startLoggerCollection } from '../domain/logsCollection/logger/loggerCollection'
import type { CommonContext, RawAgentLogsEvent } from '../rawLogsEvent.types'
import type { CommonContext } from '../rawLogsEvent.types'
import { startLogsBatch } from '../transport/startLogsBatch'

@@ -45,3 +45,3 @@ import { startLogsBridge } from '../transport/startLogsBridge'

const reportError = (error: RawError) =>
lifeCycle.notify<RawAgentLogsEvent>(LifeCycleEventType.RAW_LOG_COLLECTED, {
lifeCycle.notify(LifeCycleEventType.RAW_LOG_COLLECTED, {
rawLogsEvent: {

@@ -58,3 +58,9 @@ message: error.message,

const pageExitObservable = createPageExitObservable()
const telemetry = startLogsTelemetry(configuration, reportError, pageExitObservable)
const session =
areCookiesAuthorized(configuration.cookieOptions) && !canUseEventBridge() && !willSyntheticsInjectRum()
? startLogsSessionManager(configuration)
: startLogsSessionManagerStub(configuration)
const telemetry = startLogsTelemetry(configuration, reportError, pageExitObservable, session.expireObservable)
telemetry.setContextProvider(() => ({

@@ -81,11 +87,6 @@ application: {

const session =
areCookiesAuthorized(configuration.cookieOptions) && !canUseEventBridge() && !willSyntheticsInjectRum()
? startLogsSessionManager(configuration)
: startLogsSessionManagerStub(configuration)
startLogsAssembly(session, configuration, lifeCycle, buildCommonContext, mainLogger, reportError)
if (!canUseEventBridge()) {
startLogsBatch(configuration, lifeCycle, reportError, pageExitObservable)
startLogsBatch(configuration, lifeCycle, reportError, pageExitObservable, session.expireObservable)
} else {

@@ -107,3 +108,4 @@ startLogsBridge(lifeCycle)

reportError: (error: RawError) => void,
pageExitObservable: Observable<PageExitEvent>
pageExitObservable: Observable<PageExitEvent>,
sessionExpireObservable: Observable<void>
) {

@@ -120,2 +122,3 @@ const telemetry = startTelemetry(TelemetryService.LOGS, configuration)

pageExitObservable,
sessionExpireObservable,
configuration.replica?.rumEndpointBuilder

@@ -122,0 +125,0 @@ )

import type { Context, RelativeTime, TelemetryEvent, TimeStamp } from '@datadog/browser-core'
import { TelemetryService, startTelemetry, ErrorSource, ONE_MINUTE, getTimeStamp, noop } from '@datadog/browser-core'
import {
Observable,
TelemetryService,
startTelemetry,
ErrorSource,
ONE_MINUTE,
getTimeStamp,
noop,
} from '@datadog/browser-core'
import type { Clock } from '@datadog/browser-core/test'

@@ -38,2 +46,3 @@ import { mockClock, cleanupSyntheticsWorkerValues, mockSyntheticsWorkerValues } from '@datadog/browser-core/test'

findTrackedSession: () => (sessionIsTracked ? { id: SESSION_ID } : undefined),
expireObservable: new Observable(),
}

@@ -283,2 +292,3 @@

findTrackedSession: () => (sessionIsTracked ? { id: SESSION_ID } : undefined),
expireObservable: new Observable<void>(),
}

@@ -350,4 +360,5 @@

let clock: Clock
const sessionManager = {
const sessionManager: LogsSessionManager = {
findTrackedSession: () => ({ id: SESSION_ID }),
expireObservable: new Observable(),
}

@@ -354,0 +365,0 @@

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

import { Observable } from '@datadog/browser-core'
import { startInternalContext } from './internalContext'

@@ -7,2 +8,3 @@

findTrackedSession: () => undefined,
expireObservable: new Observable<void>(),
}

@@ -18,2 +20,3 @@ expect(startInternalContext(sessionManagerMock).get()).toEqual(undefined)

}),
expireObservable: new Observable<void>(),
}

@@ -20,0 +23,0 @@ expect(startInternalContext(sessionManagerMock).get()).toEqual({

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

import type { Context, Subscription } from '@datadog/browser-core'
import { AbstractLifeCycle } from '@datadog/browser-core'
import type { Context } from '@datadog/browser-core'
import type { LogsEvent } from '../logsEvent.types'

@@ -11,34 +12,10 @@ import type { CommonContext, RawLogsEvent } from '../rawLogsEvent.types'

export class LifeCycle {
private callbacks: { [key in LifeCycleEventType]?: Array<(data: any) => void> } = {}
notify<E extends RawLogsEvent = RawLogsEvent>(
eventType: LifeCycleEventType.RAW_LOG_COLLECTED,
data: RawLogsEventCollectedData<E>
): void
notify(eventType: LifeCycleEventType.LOG_COLLECTED, data: LogsEvent & Context): void
notify(eventType: LifeCycleEventType, data?: any) {
const eventCallbacks = this.callbacks[eventType]
if (eventCallbacks) {
eventCallbacks.forEach((callback) => callback(data))
}
}
subscribe(
eventType: LifeCycleEventType.RAW_LOG_COLLECTED,
callback: (data: RawLogsEventCollectedData) => void
): Subscription
subscribe(eventType: LifeCycleEventType.LOG_COLLECTED, callback: (data: LogsEvent & Context) => void): Subscription
subscribe(eventType: LifeCycleEventType, callback: (data?: any) => void) {
if (!this.callbacks[eventType]) {
this.callbacks[eventType] = []
}
this.callbacks[eventType]!.push(callback)
return {
unsubscribe: () => {
this.callbacks[eventType] = this.callbacks[eventType]!.filter((other) => callback !== other)
},
}
}
interface LifeCycleEventMap {
[LifeCycleEventType.RAW_LOG_COLLECTED]: RawLogsEventCollectedData
[LifeCycleEventType.LOG_COLLECTED]: LogsEvent & Context
}
export const LifeCycle = AbstractLifeCycle<LifeCycleEventMap>
export type LifeCycle = AbstractLifeCycle<LifeCycleEventMap>
export interface RawLogsEventCollectedData<E extends RawLogsEvent = RawLogsEvent> {

@@ -45,0 +22,0 @@ rawLogsEvent: E

@@ -8,3 +8,2 @@ import type { Context } from '@datadog/browser-core'

ErrorHandling,
PROVIDED_ERROR_MESSAGE_PREFIX,
computeStackTrace,

@@ -19,2 +18,3 @@ CustomerDataType,

sanitize,
NonErrorPrefix,
} from '@datadog/browser-core'

@@ -75,3 +75,3 @@

originalError: error,
nonErrorPrefix: PROVIDED_ERROR_MESSAGE_PREFIX,
nonErrorPrefix: NonErrorPrefix.PROVIDED,
source: ErrorSource.LOGGER,

@@ -78,0 +78,0 @@ handling: ErrorHandling.HANDLED,

import type { Context, ClocksState, ConsoleLog } from '@datadog/browser-core'
import { timeStampNow, ConsoleApiName, ErrorSource, initConsoleObservable } from '@datadog/browser-core'
import type { RawConsoleLogsEvent } from '../../../rawLogsEvent.types'
import type { LogsConfiguration } from '../../configuration'

@@ -25,3 +24,3 @@ import type { LifeCycle } from '../../lifeCycle'

const consoleSubscription = initConsoleObservable(configuration.forwardConsoleLogs).subscribe((log: ConsoleLog) => {
lifeCycle.notify<RawConsoleLogsEvent>(LifeCycleEventType.RAW_LOG_COLLECTED, {
lifeCycle.notify(LifeCycleEventType.RAW_LOG_COLLECTED, {
rawLogsEvent: {

@@ -28,0 +27,0 @@ date: timeStampNow(),

import type { TimeStamp } from '@datadog/browser-core'
import { includes, display, combine, ErrorSource, timeStampNow } from '@datadog/browser-core'
import type { CommonContext, RawLoggerLogsEvent } from '../../../rawLogsEvent.types'
import type { CommonContext } from '../../../rawLogsEvent.types'
import type { LifeCycle } from '../../lifeCycle'

@@ -29,3 +29,3 @@ import { LifeCycleEventType } from '../../lifeCycle'

lifeCycle.notify<RawLoggerLogsEvent>(LifeCycleEventType.RAW_LOG_COLLECTED, {
lifeCycle.notify(LifeCycleEventType.RAW_LOG_COLLECTED, {
rawLogsEvent: {

@@ -32,0 +32,0 @@ date: savedDate || timeStampNow(),

@@ -15,3 +15,2 @@ import type { FetchResolveContext, XhrCompleteContext } from '@datadog/browser-core'

} from '@datadog/browser-core'
import type { RawNetworkLogsEvent } from '../../../rawLogsEvent.types'
import type { LogsConfiguration } from '../../configuration'

@@ -50,3 +49,3 @@ import type { LifeCycle } from '../../lifeCycle'

function onResponseDataAvailable(responseData: unknown) {
lifeCycle.notify<RawNetworkLogsEvent>(LifeCycleEventType.RAW_LOG_COLLECTED, {
lifeCycle.notify(LifeCycleEventType.RAW_LOG_COLLECTED, {
rawLogsEvent: {

@@ -53,0 +52,0 @@ message: `${format(type)} error ${request.method} ${request.url}`,

@@ -9,3 +9,2 @@ import type { Context, ClocksState, RawReport } from '@datadog/browser-core'

} from '@datadog/browser-core'
import type { RawReportLogsEvent } from '../../../rawLogsEvent.types'
import type { LogsConfiguration } from '../../configuration'

@@ -44,3 +43,3 @@ import type { LifeCycle } from '../../lifeCycle'

lifeCycle.notify<RawReportLogsEvent>(LifeCycleEventType.RAW_LOG_COLLECTED, {
lifeCycle.notify(LifeCycleEventType.RAW_LOG_COLLECTED, {
rawLogsEvent: {

@@ -47,0 +46,0 @@ date: timeStampNow(),

import type { Context, RawError, ClocksState } from '@datadog/browser-core'
import { noop, ErrorSource, trackRuntimeError, Observable } from '@datadog/browser-core'
import type { RawRuntimeLogsEvent } from '../../../rawLogsEvent.types'
import type { LogsConfiguration } from '../../configuration'

@@ -26,3 +25,3 @@ import type { LifeCycle } from '../../lifeCycle'

const rawErrorSubscription = rawErrorObservable.subscribe((rawError) => {
lifeCycle.notify<RawRuntimeLogsEvent>(LifeCycleEventType.RAW_LOG_COLLECTED, {
lifeCycle.notify(LifeCycleEventType.RAW_LOG_COLLECTED, {
rawLogsEvent: {

@@ -29,0 +28,0 @@ message: rawError.message,

import type { RelativeTime } from '@datadog/browser-core'
import { performDraw, startSessionManager } from '@datadog/browser-core'
import { Observable, performDraw, startSessionManager } from '@datadog/browser-core'
import type { LogsConfiguration } from './configuration'

@@ -9,2 +9,3 @@

findTrackedSession: (startTime?: RelativeTime) => LogsSession | undefined
expireObservable: Observable<void>
}

@@ -34,2 +35,3 @@

},
expireObservable: sessionManager.expireObservable,
}

@@ -43,2 +45,3 @@ }

findTrackedSession: () => session,
expireObservable: new Observable(),
}

@@ -45,0 +48,0 @@ }

@@ -12,3 +12,4 @@ import type { Context, Observable, PageExitEvent, RawError } from '@datadog/browser-core'

reportError: (error: RawError) => void,
pageExitObservable: Observable<PageExitEvent>
pageExitObservable: Observable<PageExitEvent>,
sessionExpireObservable: Observable<void>
) {

@@ -20,2 +21,3 @@ const batch = startBatchWithReplica(

pageExitObservable,
sessionExpireObservable,
configuration.replica?.logsEndpointBuilder

@@ -22,0 +24,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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc