Socket
Socket
Sign inDemoInstall

@datadog/browser-logs

Package Overview
Dependencies
Maintainers
1
Versions
256
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@datadog/browser-logs - npm Package Compare versions

Comparing version 2.7.2 to 2.7.4

2

bundle/datadog-logs.js

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

!function(){"use strict";var e=function(){return(e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function t(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function n(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}var r=function(e){return Array.isArray(e)},i=function(e){return!Array.isArray(e)&&"object"==typeof e&&null!==e};function o(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=0,i=t;r<i.length;r++){var o=i[r];null!=o&&(e=s(e,o,a()))}return e}function a(){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}}}function s(e,t,n){if(void 0===t)return e;if(!i(t)&&!r(t))return t;if(!n.hasAlreadyBeenSeen(t)){if(i(t)&&(void 0===e||i(e))){var o=e||{};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(o[a]=s(o[a],t[a],n));return o}if(r(t)&&(void 0===e||r(e))){(o=e||[]).length=Math.max(o.length,t.length);for(var u=0;u<t.length;u+=1)o[u]=s(o[u],t[u],n);return o}return t}}var u,c="agent",f="console",l="logger",d="network",p="source";function h(e){var t=v(e);return e.stack.forEach((function(e){var n="?"===e.func?"<anonymous>":e.func,r=e.args&&e.args.length>0?"("+e.args.join(", ")+")":"",i=e.line?":"+e.line:"",o=e.line&&e.column?":"+e.column:"";t+="\n at "+n+r+" @ "+e.url+i+o})),t}function v(e){return(e.name||"Error")+": "+e.message}function g(){return performance.now()}function m(e,t){return t-e}function y(e){return Math.floor(b()+e)}function b(){return void 0===u&&(u=performance.timing.navigationStart),u}var w=/[^\u0000-\u007F]/,E=function(){function e(e,t,n){void 0===n&&(n=!1),this.endpointUrl=e,this.bytesLimit=t,this.withBatchTime=n}return e.prototype.send=function(e,t){var n=this.withBatchTime?function(e){return e+(-1===e.indexOf("?")?"?":"&")+"batch_time="+(new Date).getTime()+"&m_time="+y(g())}(this.endpointUrl):this.endpointUrl;if(navigator.sendBeacon&&t<this.bytesLimit&&navigator.sendBeacon(n,e))return;var r=new XMLHttpRequest;r.open("POST",n,!0),r.send(e)},e}();var x=function(){function e(e,t,n,r,i,o){void 0===o&&(o=ae),this.request=e,this.maxSize=t,this.bytesLimit=n,this.maxMessageSize=r,this.flushTimeout=i,this.beforeUnloadCallback=o,this.pushOnlyBuffer=[],this.upsertBuffer={},this.bufferBytesSize=0,this.bufferMessageCount=0,this.flushOnVisibilityHidden(),this.flushPeriodically()}return e.prototype.add=function(e){this.addOrUpdate(e)},e.prototype.upsert=function(e,t){this.addOrUpdate(e,t)},e.prototype.flush=function(){if(0!==this.bufferMessageCount){var e=n(this.pushOnlyBuffer,(t=this.upsertBuffer,r=[],Object.keys(t).forEach((function(e){r.push(t[e])})),r));this.request.send(e.join("\n"),this.bufferBytesSize),this.pushOnlyBuffer=[],this.upsertBuffer={},this.bufferBytesSize=0,this.bufferMessageCount=0}var t,r},e.prototype.sizeInBytes=function(e){return w.test(e)?void 0!==window.TextEncoder?(new TextEncoder).encode(e).length:new Blob([e]).size:e.length},e.prototype.addOrUpdate=function(e,t){var n=this.process(e),r=n.processedMessage,i=n.messageBytesSize;i>=this.maxMessageSize?console.warn("Discarded a message whose size was bigger than the maximum allowed size "+this.maxMessageSize+"KB."):(this.hasMessageFor(t)&&this.remove(t),this.willReachedBytesLimitWith(i)&&this.flush(),this.push(r,i,t),this.isFull()&&this.flush())},e.prototype.process=function(e){var t=se(e);return{processedMessage:t,messageBytesSize:this.sizeInBytes(t)}},e.prototype.push=function(e,t,n){this.bufferMessageCount>0&&(this.bufferBytesSize+=1),void 0!==n?this.upsertBuffer[n]=e:this.pushOnlyBuffer.push(e),this.bufferBytesSize+=t,this.bufferMessageCount+=1},e.prototype.remove=function(e){var t=this.upsertBuffer[e];delete this.upsertBuffer[e];var n=this.sizeInBytes(t);this.bufferBytesSize-=n,this.bufferMessageCount-=1,this.bufferMessageCount>0&&(this.bufferBytesSize-=1)},e.prototype.hasMessageFor=function(e){return void 0!==e&&void 0!==this.upsertBuffer[e]},e.prototype.willReachedBytesLimitWith=function(e){return this.bufferBytesSize+e+1>=this.bytesLimit},e.prototype.isFull=function(){return this.bufferMessageCount===this.maxSize||this.bufferBytesSize>=this.bytesLimit},e.prototype.flushPeriodically=function(){var e=this;setTimeout((function(){e.flush(),e.flushPeriodically()}),this.flushTimeout)},e.prototype.flushOnVisibilityHidden=function(){var e=this;navigator.sendBeacon&&(fe(window,"beforeunload",this.beforeUnloadCallback),fe(document,"visibilitychange",(function(){"hidden"===document.visibilityState&&e.flush()})),fe(window,"beforeunload",(function(){return e.flush()})))},e}(),T=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;function S(e){if(M){if(k===e)return;N()}var t=D(e);throw M=t,k=e,setTimeout((function(){k===e&&N()}),t.incomplete?2e3:0),e}var k,M,O,R,C,I=[];function L(e){!function(){if(R)return;O=window.onerror,window.onerror=V(_),R=!0}(),function(){if(C)return;null!==window.onunhandledrejection?window.onunhandledrejection:void 0,window.onunhandledrejection=V(A),C=!0}(),I.push(e)}function B(e,t,n){var r;if(I.forEach((function(i){try{i(e,t,n)}catch(e){r=e}})),r)throw r}function _(e,t,n,r,i){if(M)H(M,t,n),N();else if(i)B(D(i),!0,i);else{var o,a={url:t,column:r,line:n},s=e;if("[object String]"==={}.toString.call(e)){var u=T.exec(s);u&&(o=u[1],s=u[2])}B({name:o,message:"string"==typeof s?s:void 0,stack:[a]},!0,e)}return!!O&&O.apply(this,arguments)}function A(e){var t=e.reason||"Empty reason";B(D(t),!0,t)}function N(){var e=M,t=k;M=void 0,k=void 0,B(e,!1,t)}var j="?";function D(e,t){var n,r=void 0===t?0:+t;try{if(n=function(e){var t=q(e,"stacktrace");if(!t)return;for(var n,r=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,i=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^\)]+))\((.*)\))? in (.*):\s*$/i,o=t.split("\n"),a=[],s=0;s<o.length;s+=2){var u=void 0;r.exec(o[s])?u={args:[],column:void 0,func:(n=r.exec(o[s]))[3],line:+n[1],url:n[2]}:i.exec(o[s])&&(u={args:(n=i.exec(o[s]))[5]?n[5].split(","):[],column:+n[2],func:n[3]||n[4],line:+n[1],url:n[6]}),u&&(!u.func&&u.line&&(u.func=j),u.context=[o[s+1]],a.push(u))}if(!a.length)return;return{stack:a,message:q(e,"message"),name:q(e,"name")}}(e))return n}catch(e){if(z)throw e}try{if(n=function(e){var t=q(e,"stack");if(!t)return;for(var n,r,i,o,a=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,s=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,u=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,c=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,f=/\((\S*)(?::(\d+))(?::(\d+))\)/,l=t.split("\n"),d=[],p=0,h=l.length;p<h;p+=1){if(a.exec(l[p])){var v=(i=a.exec(l[p]))[2]&&0===i[2].indexOf("native");n=i[2]&&0===i[2].indexOf("eval"),r=f.exec(i[2]),n&&r&&(i[2]=r[1],i[3]=r[2],i[4]=r[3]),o={args:v?[i[2]]:[],column:i[4]?+i[4]:void 0,func:i[1]||j,line:i[3]?+i[3]:void 0,url:v?void 0:i[2]}}else if(u.exec(l[p]))o={args:[],column:(i=u.exec(l[p]))[4]?+i[4]:void 0,func:i[1]||j,line:+i[3],url:i[2]};else{if(!s.exec(l[p]))continue;n=(i=s.exec(l[p]))[3]&&i[3].indexOf(" > eval")>-1,r=c.exec(i[3]),n&&r?(i[3]=r[1],i[4]=r[2],i[5]=void 0):0!==p||i[5]||G(e.columnNumber)||(d[0].column=e.columnNumber+1),o={args:i[2]?i[2].split(","):[],column:i[5]?+i[5]:void 0,func:i[1]||j,line:i[4]?+i[4]:void 0,url:i[3]}}!o.func&&o.line&&(o.func=j),d.push(o)}if(!d.length)return;return{stack:d,message:q(e,"message"),name:q(e,"name")}}(e))return n}catch(e){if(z)throw e}try{if(n=function(e){var t=q(e,"message");if(!t)return;var n=t.split("\n");if(n.length<4)return;var r,i=/^\s*Line (\d+) of linked script ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,o=/^\s*Line (\d+) of inline#(\d+) script in ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,a=/^\s*Line (\d+) of function script\s*$/i,s=[],u=window&&window.document&&window.document.getElementsByTagName("script"),c=[];for(var f in u)F(u,f)&&!u[f].src&&c.push(u[f]);for(var l=2;l<n.length;l+=2){var d=void 0;if(i.exec(n[l]))d={args:[],column:void 0,func:(r=i.exec(n[l]))[3],line:+r[1],url:r[2]};else if(o.exec(n[l]))d={args:[],column:void 0,func:(r=o.exec(n[l]))[4],line:+r[1],url:r[3]};else if(a.exec(n[l])){r=a.exec(n[l]),d={url:window.location.href.replace(/#.*$/,""),args:[],column:void 0,func:"",line:+r[1]}}d&&(d.func||(d.func=j),d.context=[n[l+1]],s.push(d))}if(!s.length)return;return{stack:s,message:n[0],name:q(e,"name")}}(e))return n}catch(e){if(z)throw e}try{if(n=U(e,r+1))return n}catch(e){if(z)throw e}return{message:q(e,"message"),name:q(e,"name"),stack:[]}}var P,z=!1;function H(e,t,n){var r={url:t,line:n?+n:void 0};if(r.url&&r.line){e.incomplete=!1;var i=e.stack;if(i.length>0&&i[0].url===r.url){if(i[0].line===r.line)return!1;if(!i[0].line&&i[0].func===r.func)return i[0].line=r.line,i[0].context=r.context,!1}return i.unshift(r),e.partial=!0,!0}return e.incomplete=!0,!1}function U(e,t){for(var n,r,i=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,o=[],a={},s=!1,u=U.caller;u&&!s;u=u.caller)u!==D&&u!==S&&(r={args:[],column:void 0,func:j,line:void 0,url:void 0},n=i.exec(u.toString()),u.name?r.func=u.name:n&&(r.func=n[1]),void 0===r.func&&(r.func=n?n.input.substring(0,n.input.indexOf("{")):void 0),a[u.toString()]?s=!0:a[u.toString()]=!0,o.push(r));t&&o.splice(0,t);var c={stack:o,message:q(e,"message"),name:q(e,"name")};return H(c,q(e,"sourceURL")||q(e,"fileName"),q(e,"line")||q(e,"lineNumber")),c}function q(e,t){if("object"==typeof e&&e&&t in e){var n=e[t];return"string"==typeof n?n:void 0}}function F(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function G(e){return void 0===e}!function(e){e.info="info",e.error="error"}(P||(P={}));var $,K={maxMessagesPerPage:0,sentMessageCount:0};function X(t){if(t.internalMonitoringEndpoint){var n=function(e){var t,n=r(e.internalMonitoringEndpoint);void 0!==e.replica&&(t=r(e.replica.internalMonitoringEndpoint));function r(t){return new x(new E(t,e.batchBytesLimit),e.maxBatchSize,e.batchBytesLimit,e.maxMessageSize,e.flushTimeout)}function i(e){return o({date:(new Date).getTime(),view:{referrer:document.referrer,url:window.location.href}},void 0!==$?$():{},e)}return{add:function(e){var r=i(e);n.add(r),t&&t.add(r)}}}(t);!function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];t.forEach((function(t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}))}(K,{batch:n,maxMessagesPerPage:t.maxInternalMonitoringMessagesPerPage,sentMessageCount:0}),r=setInterval(V((function(){var t,n,i=Date.now()-y(g());if(Math.abs(i)>ne){clearInterval(r);var o=y(0);t="clock drift detected",n={debug:{navigationStartUTC:new Date(o).toUTCString(),timeSpent:Date.now()-o,drift:i}},function(e){K.debugMode&&console.log("[MONITORING MESSAGE]",e)}(t),Z(e(e({message:t},n),{status:P.info}))}})),re)}var r;return{setExternalContextProvider:function(e){$=e}}}function J(e,t,n){var r=n.value;n.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=K.batch?V(r):r;return n.apply(this,e)}}function V(e){return function(){return W(e,this,arguments)}}function W(t,n,r){try{return t.apply(n,r)}catch(t){Q(t);try{!function(t){Z(e(e({},function(e){if(e instanceof Error){var t=D(e);return{error:{kind:t.name,stack:h(t)},message:t.message}}return{error:{stack:"Not an instance of error"},message:"Uncaught "+se(e)}}(t)),{status:P.error}))}(t)}catch(e){Q(e)}}}function Z(e){K.batch&&K.sentMessageCount<K.maxMessagesPerPage&&(K.sentMessageCount+=1,K.batch.add(e))}function Y(e){K.debugMode=e}function Q(e){K.debugMode&&console.warn("[INTERNAL ERROR]",e)}var ee,te,ne=1e3,re=60*ne,ie=60*re;function oe(e){return e?(parseInt(e,10)^16*Math.random()>>parseInt(e,10)/4).toString(16):"10000000-1000-4000-8000-100000000000".replace(/[018]/g,oe)}function ae(){}function se(e,t,n){if(null==e)return JSON.stringify(e);var r=[!1,void 0];ue(e)&&(r=[!0,e.toJSON],delete e.toJSON);var i,o,a=[!1,void 0];"object"==typeof e&&ue(i=Object.getPrototypeOf(e))&&(a=[!0,i.toJSON],delete i.toJSON);try{o=JSON.stringify(e,t,n)}catch(e){o="<error: unable to serialize object>"}finally{r[0]&&(e.toJSON=r[1]),a[0]&&(i.toJSON=a[1])}return o}function ue(e){return"object"==typeof e&&null!==e&&e.hasOwnProperty("toJSON")}function ce(e,t){return-1!==e.indexOf(t)}function fe(e,t,n,r){return le(e,[t],n,r)}function le(e,t,n,r){var i=void 0===r?{}:r,o=i.once,a=i.capture,s=i.passive,u=V(o?function(e){f(),n(e)}:n),c=s?{capture:a,passive:s}:a;t.forEach((function(t){return e.addEventListener(t,u,c)}));var f=function(){return t.forEach((function(t){return e.removeEventListener(t,u,c)}))};return{stop:f}}!function(e){e.DOCUMENT="document",e.XHR="xhr",e.BEACON="beacon",e.FETCH="fetch",e.CSS="css",e.JS="js",e.IMAGE="image",e.FONT="font",e.MEDIA="media",e.OTHER="other"}(ee||(ee={})),function(e){e.FETCH="fetch",e.XHR="xhr"}(te||(te={}));var de,pe,he=ne;function ve(e,t,n,r){var i=new Date;i.setTime(i.getTime()+n);var o="expires="+i.toUTCString(),a=r&&r.crossSite?"none":"strict",s=r&&r.domain?";domain="+r.domain:"",u=r&&r.secure?";secure":"";document.cookie=e+"="+t+";"+o+";path=/;samesite="+a+s+u}function ge(e){return function(e,t){var n=new RegExp("(?:^|;)\\s*"+t+"\\s*=\\s*([^;]+)").exec(e);return n?n[1]:void 0}(document.cookie,e)}function me(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];try{return e.apply(void 0,n)}catch(e){console.error(t,e)}}}var ye={alternate:{logs:"logs",rum:"rum",sessionReplay:"session-replay",trace:"trace"},classic:{logs:"browser",rum:"rum",sessionReplay:void 0,trace:"public-trace"}},be="eu",we="us",Ee=((pe={})[be]="datadoghq.eu",pe[we]="datadoghq.com",pe),xe=[Ee[we],Ee[be]];function Te(t,n){var r={applicationId:t.applicationId,buildMode:n.buildMode,clientToken:t.clientToken,env:t.env,proxyHost:t.proxyHost,sdkVersion:n.sdkVersion,service:t.service,site:t.site||Ee[t.datacenter||n.datacenter],version:t.version},i=function(e,t){return!t.useAlternateIntakeDomains&&ce(xe,e)?"classic":"alternate"}(r.site,t),o=function(e,t,n){if(t.proxyHost)return["https://"+t.proxyHost+"/v1/input/"];var r=[t.site];t.buildMode===Me.STAGING&&n&&r.push(Ee[we]);for(var i=[],o=Object.keys(ye[e]),a=0,s=r;a<s.length;a++)for(var u=s[a],c=0,f=o;c<f.length;c++){var l=f[c];i.push("https://"+Se(e,l,u)+"/v1/input/")}return i}(i,r,void 0!==t.replica),a={isIntakeUrl:function(e){return o.some((function(t){return 0===e.indexOf(t)}))},logsEndpoint:ke(i,"logs",r),rumEndpoint:ke(i,"rum",r),sessionReplayEndpoint:ke(i,"sessionReplay",r),traceEndpoint:ke(i,"trace",r)};if(t.internalMonitoringApiKey&&(a.internalMonitoringEndpoint=ke(i,"logs",r,"browser-agent-internal-monitoring")),r.buildMode===Me.E2E_TEST&&(a.internalMonitoringEndpoint="<<< E2E INTERNAL MONITORING ENDPOINT >>>",a.logsEndpoint="<<< E2E LOGS ENDPOINT >>>",a.rumEndpoint="<<< E2E RUM ENDPOINT >>>",a.sessionReplayEndpoint="<<< E2E SESSION REPLAY ENDPOINT >>>"),r.buildMode===Me.STAGING&&void 0!==t.replica){var s=e(e({},r),{applicationId:t.replica.applicationId,clientToken:t.replica.clientToken,site:Ee[we]});a.replica={applicationId:t.replica.applicationId,internalMonitoringEndpoint:ke(i,"logs",s,"browser-agent-internal-monitoring"),logsEndpoint:ke(i,"logs",s),rumEndpoint:ke(i,"rum",s)}}return a}function Se(e,t,n){return"classic"===e&&function(e,t){var n=ye.classic[e];return n&&n+"-http-intake.logs."+t}(t,n)||function(e,t){var n=ye.alternate[e],r=t.split("."),i=r.pop(),o=r.join("-")+"."+i;return n+".browser-intake-"+o}(t,n)}function ke(e,t,n,r){var i="sdk_version:"+n.sdkVersion+(n.env?",env:"+n.env:"")+(n.service?",service:"+n.service:"")+(n.version?",version:"+n.version:""),o=Se(e,t,n.site),a=n.proxyHost?n.proxyHost:o,s=n.proxyHost?"ddhost="+o+"&":"",u=""+(n.applicationId?"_dd.application_id="+n.applicationId+"&":"")+s+"ddsource="+(r||"browser")+"&ddtags="+encodeURIComponent(i);return"https://"+a+"/v1/input/"+n.clientToken+"?"+u}var Me,Oe={allowedTracingOrigins:[],maxErrorsByMinute:3e3,maxInternalMonitoringMessagesPerPage:15,resourceSampleRate:100,sampleRate:100,silentMultipleInit:!1,trackInteractions:!1,requestErrorResponseLengthLimit:32768,flushTimeout:30*ne,maxBatchSize:50,maxMessageSize:262144,batchBytesLimit:16384};function Re(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===de){for(var e="dd_site_test_"+oe(),t=window.location.hostname.split("."),n=t.pop();t.length&&!ge(e);)n=t.pop()+"."+n,ve(e,"test",ne,{domain:n});de=n}return de}()),t}function Ce(t,n){var r=function(t,n){var r=Array.isArray(t.enableExperimentalFeatures)?t.enableExperimentalFeatures:[],i=e(e({beforeSend:t.beforeSend&&me(t.beforeSend,"beforeSend threw an error:"),cookieOptions:Re(t),isEnabled:function(e){return ce(r,e)},service:t.service},Te(t,n)),Oe);return"allowedTracingOrigins"in t&&(i.allowedTracingOrigins=t.allowedTracingOrigins),"sampleRate"in t&&(i.sampleRate=t.sampleRate),"resourceSampleRate"in t&&(i.resourceSampleRate=t.resourceSampleRate),"trackInteractions"in t&&(i.trackInteractions=!!t.trackInteractions),i}(t,n);return{configuration:r,internalMonitoring:X(r)}}function Ie(){var e={};return{get:function(){return e},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},set:function(t){e=t}}}!function(e){e.RELEASE="release",e.STAGING="staging",e.E2E_TEST="e2e-test"}(Me||(Me={}));var Le,Be,_e,Ae,Ne=function(){function e(e){void 0===e&&(e=1e4),this.limit=e,this.buffer=[]}return e.prototype.add=function(e){this.buffer.push(e)>this.limit&&this.buffer.splice(0,1)},e.prototype.drain=function(e){this.buffer.forEach((function(t){return e(t)})),this.buffer.length=0},e}(),je={debug:"debug",error:"error",info:"info",warn:"warn"},De=((Le={})[je.debug]=0,Le[je.info]=1,Le[je.warn]=2,Le[je.error]=3,Le),Pe=(Object.keys(je),"console"),ze="http",He=function(){function t(e,t,n,r){void 0===t&&(t=ze),void 0===n&&(n=je.debug),void 0===r&&(r={}),this.sendLog=e,this.handlerType=t,this.level=n,this.contextManager=Ie(),this.contextManager.set(r)}return t.prototype.log=function(t,n,r){if(void 0===r&&(r=je.info),De[r]>=De[this.level])switch(this.handlerType){case ze:this.sendLog(e({message:t,status:r},o(this.contextManager.get(),n)));break;case Pe:console.log(r+": "+t,o(this.contextManager.get(),n))}},t.prototype.debug=function(e,t){this.log(e,t,je.debug)},t.prototype.info=function(e,t){this.log(e,t,je.info)},t.prototype.warn=function(e,t){this.log(e,t,je.warn)},t.prototype.error=function(e,t){var n={error:{origin:l}};this.log(e,o(n,t),je.error)},t.prototype.setContext=function(e){this.contextManager.set(e)},t.prototype.addContext=function(e,t){this.contextManager.add(e,t)},t.prototype.removeContext=function(e){this.contextManager.remove(e)},t.prototype.setHandler=function(e){this.handlerType=e},t.prototype.setLevel=function(e){this.level=e},function(e,t,n,r){var i,o=arguments.length,a=o<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--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);o>3&&a&&Object.defineProperty(t,n,a)}([J],t.prototype,"log",null),t}();function Ue(e){return qe(e,function(e){if(e.origin)return e.origin;var t=e.host.replace(/(:80|:443)$/,"");return e.protocol+"//"+t}(window.location)).href}function qe(e,t){if(function(){if(void 0!==Be)return Be;try{var e=new URL("http://test/path");return Be="http://test/path"===e.href}catch(e){Be=!1}return Be}())return void 0!==t?new URL(e,t):new URL(e);if(void 0===t&&!/:/.test(e))throw new Error("Invalid URL: '"+e+"'");var n=document,r=n.createElement("a");if(void 0!==t){var i=(n=document.implementation.createHTMLDocument("")).createElement("base");i.href=t,n.head.appendChild(i),n.body.appendChild(r)}return r.href=e,r}var Fe,Ge=[],$e=[];function Ke(){return _e||(!function(){if(!window.fetch)return;Ae=window.fetch,window.fetch=function(e,t){var n,r=W(Xe,null,[e,t]);return r?W(Je,null,[n=Ae.call(this,r.input,r.init),r]):n=Ae.call(this,e,t),n}}(),_e={beforeSend:function(e){Ge.push(e)},onRequestComplete:function(e){$e.push(e)}}),_e}function Xe(e,t){var n=t&&t.method||"object"==typeof e&&e.method||"GET",r=Ue("object"==typeof e&&e.url||e),i={init:t,input:e,method:n,startTime:g(),url:r};return Ge.forEach((function(e){return e(i)})),i}function Je(e,n){var r=this,i=function(e){return i=r,o=void 0,s=function(){var r,i;return t(this,(function(t){switch(t.label){case 0:return n.duration=m(n.startTime,g()),"stack"in e||e instanceof Error?(n.status=0,n.response=h(D(e)),n.isAborted=e instanceof DOMException&&e.code===DOMException.ABORT_ERR,$e.forEach((function(e){return e(n)})),[3,6]):[3,1];case 1:if(!("status"in e))return[3,6];r=void 0,t.label=2;case 2:return t.trys.push([2,4,,5]),[4,e.clone().text()];case 3:return r=t.sent(),[3,5];case 4:return i=t.sent(),r="Unable to retrieve response: "+i,[3,5];case 5:n.response=r,n.responseType=e.type,n.status=e.status,n.isAborted=!1,$e.forEach((function(e){return e(n)})),t.label=6;case 6:return[2]}}))},new((a=void 0)||(a=Promise))((function(e,t){function n(e){try{u(s.next(e))}catch(e){t(e)}}function r(e){try{u(s.throw(e))}catch(e){t(e)}}function u(t){t.done?e(t.value):new a((function(e){e(t.value)})).then(n,r)}u((s=s.apply(i,o||[])).next())}));var i,o,a,s};e.then(V(i),V(i))}var Ve,We,Ze,Ye=[],Qe=[];function et(){return Fe||(Ve=XMLHttpRequest.prototype.open,We=XMLHttpRequest.prototype.send,Ze=XMLHttpRequest.prototype.abort,XMLHttpRequest.prototype.open=function(e,t){var n=this;return W((function(){n._datadog_xhr={method:e,startTime:-1,url:Ue(t)}})),Ve.apply(this,arguments)},XMLHttpRequest.prototype.send=function(){var t=this;return W((function(){if(t._datadog_xhr){var n=t._datadog_xhr;n.startTime=g(),n.isAborted=!1;var r=t.onreadystatechange;t.onreadystatechange=function(){this.readyState===XMLHttpRequest.DONE&&W(o),r&&r.apply(this,arguments)};var i=!1,o=function(){if(!i){i=!0;var r=e(e({},n),{duration:m(n.startTime,g()),response:t.response,status:t.status});Qe.forEach((function(e){return e(r)}))}};t.addEventListener("loadend",V(o)),Ye.forEach((function(e){return e(n,t)}))}})),We.apply(this,arguments)},XMLHttpRequest.prototype.abort=function(){var e=this;return W((function(){e._datadog_xhr&&(e._datadog_xhr.isAborted=!0)})),Ze.apply(this,arguments)},Fe={beforeSend:function(e){Ye.push(e)},onRequestComplete:function(e){Qe.push(e)}}),Fe}var tt,nt,rt=function(){function e(){this.observers=[]}return e.prototype.subscribe=function(e){this.observers.push(e)},e.prototype.notify=function(e){this.observers.forEach((function(t){return t(e)}))},e}();function it(t){if(!tt){var n=new rt;!function(e,t){function n(n,r){e.isIntakeUrl(r.url)||e.isEnabled("remove-network-errors")&&r.isAborted||!function(e){return 0===e.status&&"opaque"!==e.responseType}(r)&&!function(e){return e.status>=500}(r)||t.notify({message:st(n)+" error "+r.method+" "+r.url,resource:{method:r.method,statusCode:r.status,url:r.url},source:d,stack:at(r.response,e)||"Failed to load",startTime:r.startTime})}et().onRequestComplete((function(e){return n(te.XHR,e)})),Ke().onRequestComplete((function(e){return n(te.FETCH,e)}))}(t,n),function(t){nt=console.error,console.error=V((function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];nt.apply(console,n),t.notify(e(e({},ot(n)),{source:f,startTime:g()}))}))}(n),function(e){L((function(t,n,r){var i=function(e,t,n){return e&&(void 0!==e.message||t instanceof Error)?{message:e.message||"Empty message",stack:h(e),type:e.name}:{message:n+" "+se(t),stack:"No stack, consider using an instance of Error",type:e&&e.name}}(t,r,"Uncaught"),o=i.stack,a=i.message,s=i.type;e.notify({message:a,stack:o,type:s,source:p,startTime:g()})}))}(n),tt=function(e,t){var n=0,r=new rt;return t.subscribe((function(t){n<e.maxErrorsByMinute?(n+=1,r.notify(t)):n===e.maxErrorsByMinute&&(n+=1,r.notify({message:"Reached max number of errors by minute: "+e.maxErrorsByMinute,source:c,startTime:g()}))})),setInterval((function(){return n=0}),re),r}(t,n)}return tt}function ot(e){var t=function(e,t){for(var n=0;n<e.length;n+=1){var r=e[n];if(t(r,n,e))return r}}(e,(function(e){return e instanceof Error}));return{message:n(["console error:"],e).map((function(e){return function(e){if("string"==typeof e)return e;if(e instanceof Error)return v(D(e));return se(e,void 0,2)}(e)})).join(" "),stack:t?h(D(t)):void 0}}function at(e,t){return e&&e.length>t.requestErrorResponseLengthLimit?e.substring(0,t.requestErrorResponseLengthLimit)+"...":e}function st(e){return te.XHR===e?"XHR":"Fetch"}function ut(e,t,n){var r=s(void 0,e,a()),i=n(r);return t.forEach((function(t){var n=ct(e,t),i=ct(r,t);"string"==typeof n&&"string"==typeof i&&function(e,t,n){for(var r=e,i=t.split("."),o=0;o<i.length;o+=1){var a=i[o];if(!ft(r,a))return;o!==i.length-1?r=r[a]:r[a]=n}}(e,t,i)})),i}function ct(e,t){for(var n=e,r=0,i=t.split(".");r<i.length;r++){var o=i[r];if(!ft(n,o))return;n=n[o]}return n}function ft(e,t){return"object"==typeof e&&null!==e&&t in e}var lt=15*re,dt=4*ie,pt=re;function ht(e,t,n){var r=function(e,t){var n,r,i=!1,o=function(){i=!0,clearTimeout(n),n=setTimeout((function(){i=!1}),he)};return{get:function(){return i||(r=ge(e),o()),r},set:function(n,i){ve(e,n,i,t),r=n,o()}}}("_dd_s",e);!function(e){var t=e.get(),n=ge("_dd"),r=ge("_dd_r"),i=ge("_dd_l");if(!t){var o={};n&&(o.id=n),i&&/^[01]$/.test(i)&&(o.logs=i),r&&/^[012]$/.test(r)&&(o.rum=r),yt(o,e)}}(r);var i=new rt,o=mt(r).id,a=function(e,t,n){var r,i,o=!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:(o?e.apply(void 0,n):r=n,s=!0,i=setTimeout((function(){a&&r&&e.apply(void 0,r),s=!1,r=void 0}),t))},cancel:function(){clearTimeout(i),s=!1,r=void 0}}}(V((function(){var e=mt(r),a=n(e[t]),s=a.trackingType,u=a.isTracked;e[t]=s,u&&!e.id&&(e.id=oe(),e.created=String(Date.now())),yt(e,r),u&&o!==e.id&&(o=e.id,i.notify())})),he).throttled;return a(),function(e){var t=le(window,["click","touchstart","keydown","scroll"],e,{capture:!0,passive:!0}).stop;wt.push(t)}(a),function(e){var t=V((function(){"visible"===document.visibilityState&&e()})),n=fe(document,"visibilitychange",t).stop;wt.push(n);var r=setInterval(t,pt);wt.push((function(){clearInterval(r)}))}((function(){yt(mt(r),r)})),{getId:function(){return mt(r).id},getTrackingType:function(){return mt(r)[t]},renewObservable:i}}var vt=/^([a-z]+)=([a-z0-9-]+)$/,gt="&";function mt(e){var t=function(e){var t=e.get(),n={};(function(e){return void 0!==e&&(-1!==e.indexOf("&")||vt.test(e))})(t)&&t.split(gt).forEach((function(e){var t=vt.exec(e);if(null!==t){var r=t[1],i=t[2];n[r]=i}}));return n}(e);return function(e){return(void 0===e.created||Date.now()-Number(e.created)<dt)&&(void 0===e.expire||Date.now()<Number(e.expire))}(t)?t:(bt(e),{})}function yt(e,t){if(n=e,0!==Object.keys(n).length){var n;e.expire=String(Date.now()+lt);var r=function(e){return Object.keys(e).map((function(t){return[t,e[t]]}))}(e).map((function(e){return e[0]+"="+e[1]})).join(gt);t.set(r,lt)}else bt(t)}function bt(e){e.set("",0)}var wt=[];var Et;function xt(e,t){if(!t){var n=Tt(e)===Et.TRACKED;return{getId:function(){},isTracked:function(){return n}}}var r=ht(e.cookieOptions,"logs",(function(t){return function(e,t){var n=function(e){return e===Et.NOT_TRACKED||e===Et.TRACKED}(t)?t:Tt(e);return{trackingType:n,isTracked:n===Et.TRACKED}}(e,t)}));return{getId:r.getId,isTracked:function(){return r.getTrackingType()===Et.TRACKED}}}function Tt(e){return 0!==(t=e.sampleRate)&&100*Math.random()<=t?Et.TRACKED:Et.NOT_TRACKED;var t}!function(e){e.NOT_TRACKED="0",e.TRACKED="1"}(Et||(Et={}));var St={buildMode:"release",datacenter:"us",sdkVersion:"2.7.2"},kt=["view.url","view.referrer","message","error.stack","http.url"];function Mt(e){var t=window.DD_RUM;return t&&t.getInternalContext?t.getInternalContext(e):void 0}var Ot,Rt,Ct,It,Lt=function(t){var n=!1,r=Ie(),i={},a=new Ne,s=function(e,t){a.add([e,t])},u=new He(l);return c={logger:u,init:V((function(e){(function(e){return n?(e.silentMultipleInit||console.error("DD_LOGS is already initialized."),!1):e&&(e.publicApiKey||e.clientToken)?!!(void 0===e.sampleRate||(t=e.sampleRate,function(e){return"number"==typeof e}(t)&&t>=0&&t<=100))||(console.error("Sample Rate should be a number between 0 and 100"),!1):(console.error("Client Token is not configured, we will not send any data."),!1);var t})(e)&&(e.publicApiKey&&(e.clientToken=e.publicApiKey,console.warn("Public API Key is deprecated. Please use Client Token instead.")),s=t(e,u,r.get),a.drain((function(e){var t=e[0],n=e[1];return s(t,n)})),n=!0)})),getLoggerGlobalContext:V(r.get),setLoggerGlobalContext:V(r.set),addLoggerGlobalContext:V(r.add),removeLoggerGlobalContext:V(r.remove),createLogger:V((function(t,n){return void 0===n&&(n={}),i[t]=new He(l,n.handler,n.level,e(e({},n.context),{logger:{name:t}})),i[t]})),getLogger:V((function(e){return i[e]}))},f=e(e({},c),{onReady:function(e){e()}}),Object.defineProperty(f,"_setDebug",{get:function(){return Y},enumerable:!1}),f;var c,f;function l(e){s(e,o({date:Date.now(),view:{referrer:document.referrer,url:window.location.href}},r.get()))}}((function(e,t,n){var r=Ce(e,St),i=r.configuration,a=r.internalMonitoring;return function(e,t,n,r,i,a){n.setExternalContextProvider((function(){return o({session_id:r.getId()},a(),Mt())}));var s=function(e,t){return function(n,r){if(e.isTracked()){var i=o({service:t.service,session_id:e.getId()},r,Mt(),n);if(t.beforeSend)if(!1===ut(i,kt,t.beforeSend))return;return i}}}(r,e),u=function(e){var t,n=r(e.logsEndpoint);void 0!==e.replica&&(t=r(e.replica.logsEndpoint));function r(t){return new x(new E(t,e.batchBytesLimit),e.maxBatchSize,e.batchBytesLimit,e.maxMessageSize,e.flushTimeout)}return{add:function(e){n.add(e),t&&t.add(e)}}}(e);return t.subscribe((function(e){i.error(e.message,o({date:y(e.startTime),error:{kind:e.type,origin:e.source,stack:e.stack}},e.resource?{http:{method:e.resource.method,status_code:e.resource.statusCode,url:e.resource.url}}:void 0,Mt(e.startTime)))})),function(e,t){var n=s(e,t);n&&u.add(n)}}(i,!1!==e.forwardErrorsToLogs?it(i):new rt,a,xt(i,function(e){if(void 0===document.cookie||null===document.cookie)return!1;try{var t="dd_cookie_test_"+oe(),n="test";return ve(t,n,ne,e),ge(t)===n}catch(e){return console.error(e),!1}}(i.cookieOptions)),t,n)}));Ot=function(){if("object"==typeof globalThis)return globalThis;Object.defineProperty(Object.prototype,"_dd_temp_",{get:function(){return this},configurable:!0});var e=_dd_temp_;return delete Object.prototype._dd_temp_,"object"!=typeof e&&(e="object"==typeof self?self:"object"==typeof window?window:{}),e}(),Ct=Lt,It=Ot[Rt="DD_LOGS"],Ot[Rt]=Ct,It&&It.q&&It.q.forEach((function(e){return me(e,"onReady callback threw an error:")()}))}();
!function(){"use strict";var e=function(){return(e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function t(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function n(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,o++)r[o]=i[a];return r}var r=function(e){return Array.isArray(e)},o=function(e){return!Array.isArray(e)&&"object"==typeof e&&null!==e};function i(){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=s(e,i,a()))}return e}function a(){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}}}function s(e,t,n){if(void 0===t)return e;if(!o(t)&&!r(t))return t;if(!n.hasAlreadyBeenSeen(t)){if(o(t)&&(void 0===e||o(e))){var i=e||{};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(i[a]=s(i[a],t[a],n));return i}if(r(t)&&(void 0===e||r(e))){(i=e||[]).length=Math.max(i.length,t.length);for(var u=0;u<t.length;u+=1)i[u]=s(i[u],t[u],n);return i}return t}}var u,c="agent",f="console",l="logger",d="network",p="source";function h(e){var t=v(e);return e.stack.forEach((function(e){var n="?"===e.func?"<anonymous>":e.func,r=e.args&&e.args.length>0?"("+e.args.join(", ")+")":"",o=e.line?":"+e.line:"",i=e.line&&e.column?":"+e.column:"";t+="\n at "+n+r+" @ "+e.url+o+i})),t}function v(e){return(e.name||"Error")+": "+e.message}function g(){return performance.now()}function m(e,t){return t-e}function y(e){return Math.floor(b()+e)}function b(){return void 0===u&&(u=performance.timing.navigationStart),u}var w=/[^\u0000-\u007F]/,E=function(){function e(e,t,n){void 0===n&&(n=!1),this.endpointUrl=e,this.bytesLimit=t,this.withBatchTime=n}return e.prototype.send=function(e,t){var n=this.withBatchTime?function(e){return e+(-1===e.indexOf("?")?"?":"&")+"batch_time="+(new Date).getTime()+"&m_time="+y(g())}(this.endpointUrl):this.endpointUrl;if(navigator.sendBeacon&&t<this.bytesLimit)try{if(navigator.sendBeacon(n,e))return}catch(e){!function(e){x||(x=!0,Y(e))}(e)}var r=new XMLHttpRequest;r.open("POST",n,!0),r.send(e)},e}();var x=!1;var T=function(){function e(e,t,n,r,o,i){void 0===i&&(i=ue),this.request=e,this.maxSize=t,this.bytesLimit=n,this.maxMessageSize=r,this.flushTimeout=o,this.beforeUnloadCallback=i,this.pushOnlyBuffer=[],this.upsertBuffer={},this.bufferBytesSize=0,this.bufferMessageCount=0,this.flushOnVisibilityHidden(),this.flushPeriodically()}return e.prototype.add=function(e){this.addOrUpdate(e)},e.prototype.upsert=function(e,t){this.addOrUpdate(e,t)},e.prototype.flush=function(){if(0!==this.bufferMessageCount){var e=n(this.pushOnlyBuffer,(t=this.upsertBuffer,r=[],Object.keys(t).forEach((function(e){r.push(t[e])})),r));this.request.send(e.join("\n"),this.bufferBytesSize),this.pushOnlyBuffer=[],this.upsertBuffer={},this.bufferBytesSize=0,this.bufferMessageCount=0}var t,r},e.prototype.sizeInBytes=function(e){return w.test(e)?void 0!==window.TextEncoder?(new TextEncoder).encode(e).length:new Blob([e]).size:e.length},e.prototype.addOrUpdate=function(e,t){var n=this.process(e),r=n.processedMessage,o=n.messageBytesSize;o>=this.maxMessageSize?console.warn("Discarded a message whose size was bigger than the maximum allowed size "+this.maxMessageSize+"KB."):(this.hasMessageFor(t)&&this.remove(t),this.willReachedBytesLimitWith(o)&&this.flush(),this.push(r,o,t),this.isFull()&&this.flush())},e.prototype.process=function(e){var t=ce(e);return{processedMessage:t,messageBytesSize:this.sizeInBytes(t)}},e.prototype.push=function(e,t,n){this.bufferMessageCount>0&&(this.bufferBytesSize+=1),void 0!==n?this.upsertBuffer[n]=e:this.pushOnlyBuffer.push(e),this.bufferBytesSize+=t,this.bufferMessageCount+=1},e.prototype.remove=function(e){var t=this.upsertBuffer[e];delete this.upsertBuffer[e];var n=this.sizeInBytes(t);this.bufferBytesSize-=n,this.bufferMessageCount-=1,this.bufferMessageCount>0&&(this.bufferBytesSize-=1)},e.prototype.hasMessageFor=function(e){return void 0!==e&&void 0!==this.upsertBuffer[e]},e.prototype.willReachedBytesLimitWith=function(e){return this.bufferBytesSize+e+1>=this.bytesLimit},e.prototype.isFull=function(){return this.bufferMessageCount===this.maxSize||this.bufferBytesSize>=this.bytesLimit},e.prototype.flushPeriodically=function(){var e=this;setTimeout(W((function(){e.flush(),e.flushPeriodically()})),this.flushTimeout)},e.prototype.flushOnVisibilityHidden=function(){var e=this;navigator.sendBeacon&&(de(window,"beforeunload",this.beforeUnloadCallback),de(document,"visibilitychange",(function(){"hidden"===document.visibilityState&&e.flush()})),de(window,"beforeunload",(function(){return e.flush()})))},e}(),S=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;function k(e){if(O){if(M===e)return;j()}var t=P(e);throw O=t,M=e,setTimeout(W((function(){M===e&&j()})),t.incomplete?2e3:0),e}var M,O,R,C,L,I=[];function B(e){!function(){if(C)return;R=window.onerror,window.onerror=W(A),C=!0}(),function(){if(L)return;null!==window.onunhandledrejection?window.onunhandledrejection:void 0,window.onunhandledrejection=W(N),L=!0}(),I.push(e)}function _(e,t,n){var r;if(I.forEach((function(o){try{o(e,t,n)}catch(e){r=e}})),r)throw r}function A(e,t,n,r,o){if(O)U(O,t,n),j();else if(o)_(P(o),!0,o);else{var i,a={url:t,column:r,line:n},s=e;if("[object String]"==={}.toString.call(e)){var u=S.exec(s);u&&(i=u[1],s=u[2])}_({name:i,message:"string"==typeof s?s:void 0,stack:[a]},!0,e)}return!!R&&R.apply(this,arguments)}function N(e){var t=e.reason||"Empty reason";_(P(t),!0,t)}function j(){var e=O,t=M;O=void 0,M=void 0,_(e,!1,t)}var D="?";function P(e,t){var n,r=void 0===t?0:+t;try{if(n=function(e){var t=F(e,"stacktrace");if(!t)return;for(var n,r=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,o=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^\)]+))\((.*)\))? in (.*):\s*$/i,i=t.split("\n"),a=[],s=0;s<i.length;s+=2){var u=void 0;r.exec(i[s])?u={args:[],column:void 0,func:(n=r.exec(i[s]))[3],line:+n[1],url:n[2]}:o.exec(i[s])&&(u={args:(n=o.exec(i[s]))[5]?n[5].split(","):[],column:+n[2],func:n[3]||n[4],line:+n[1],url:n[6]}),u&&(!u.func&&u.line&&(u.func=D),u.context=[i[s+1]],a.push(u))}if(!a.length)return;return{stack:a,message:F(e,"message"),name:F(e,"name")}}(e))return n}catch(e){if(H)throw e}try{if(n=function(e){var t=F(e,"stack");if(!t)return;for(var n,r,o,i,a=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,s=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,u=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,c=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,f=/\((\S*)(?::(\d+))(?::(\d+))\)/,l=t.split("\n"),d=[],p=0,h=l.length;p<h;p+=1){if(a.exec(l[p])){var v=(o=a.exec(l[p]))[2]&&0===o[2].indexOf("native");n=o[2]&&0===o[2].indexOf("eval"),r=f.exec(o[2]),n&&r&&(o[2]=r[1],o[3]=r[2],o[4]=r[3]),i={args:v?[o[2]]:[],column:o[4]?+o[4]:void 0,func:o[1]||D,line:o[3]?+o[3]:void 0,url:v?void 0:o[2]}}else if(u.exec(l[p]))i={args:[],column:(o=u.exec(l[p]))[4]?+o[4]:void 0,func:o[1]||D,line:+o[3],url:o[2]};else{if(!s.exec(l[p]))continue;n=(o=s.exec(l[p]))[3]&&o[3].indexOf(" > eval")>-1,r=c.exec(o[3]),n&&r?(o[3]=r[1],o[4]=r[2],o[5]=void 0):0!==p||o[5]||$(e.columnNumber)||(d[0].column=e.columnNumber+1),i={args:o[2]?o[2].split(","):[],column:o[5]?+o[5]:void 0,func:o[1]||D,line:o[4]?+o[4]:void 0,url:o[3]}}!i.func&&i.line&&(i.func=D),d.push(i)}if(!d.length)return;return{stack:d,message:F(e,"message"),name:F(e,"name")}}(e))return n}catch(e){if(H)throw e}try{if(n=function(e){var t=F(e,"message");if(!t)return;var n=t.split("\n");if(n.length<4)return;var r,o=/^\s*Line (\d+) of linked script ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,i=/^\s*Line (\d+) of inline#(\d+) script in ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,a=/^\s*Line (\d+) of function script\s*$/i,s=[],u=window&&window.document&&window.document.getElementsByTagName("script"),c=[];for(var f in u)G(u,f)&&!u[f].src&&c.push(u[f]);for(var l=2;l<n.length;l+=2){var d=void 0;if(o.exec(n[l]))d={args:[],column:void 0,func:(r=o.exec(n[l]))[3],line:+r[1],url:r[2]};else if(i.exec(n[l]))d={args:[],column:void 0,func:(r=i.exec(n[l]))[4],line:+r[1],url:r[3]};else if(a.exec(n[l])){r=a.exec(n[l]),d={url:window.location.href.replace(/#.*$/,""),args:[],column:void 0,func:"",line:+r[1]}}d&&(d.func||(d.func=D),d.context=[n[l+1]],s.push(d))}if(!s.length)return;return{stack:s,message:n[0],name:F(e,"name")}}(e))return n}catch(e){if(H)throw e}try{if(n=q(e,r+1))return n}catch(e){if(H)throw e}return{message:F(e,"message"),name:F(e,"name"),stack:[]}}var z,H=!1;function U(e,t,n){var r={url:t,line:n?+n:void 0};if(r.url&&r.line){e.incomplete=!1;var o=e.stack;if(o.length>0&&o[0].url===r.url){if(o[0].line===r.line)return!1;if(!o[0].line&&o[0].func===r.func)return o[0].line=r.line,o[0].context=r.context,!1}return o.unshift(r),e.partial=!0,!0}return e.incomplete=!0,!1}function q(e,t){for(var n,r,o=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,i=[],a={},s=!1,u=q.caller;u&&!s;u=u.caller)u!==P&&u!==k&&(r={args:[],column:void 0,func:D,line:void 0,url:void 0},n=o.exec(u.toString()),u.name?r.func=u.name:n&&(r.func=n[1]),void 0===r.func&&(r.func=n?n.input.substring(0,n.input.indexOf("{")):void 0),a[u.toString()]?s=!0:a[u.toString()]=!0,i.push(r));t&&i.splice(0,t);var c={stack:i,message:F(e,"message"),name:F(e,"name")};return U(c,F(e,"sourceURL")||F(e,"fileName"),F(e,"line")||F(e,"lineNumber")),c}function F(e,t){if("object"==typeof e&&e&&t in e){var n=e[t];return"string"==typeof n?n:void 0}}function G(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function $(e){return void 0===e}!function(e){e.info="info",e.error="error"}(z||(z={}));var K,X={maxMessagesPerPage:0,sentMessageCount:0};function J(t){if(t.internalMonitoringEndpoint){var n=function(e){var t,n=r(e.internalMonitoringEndpoint);void 0!==e.replica&&(t=r(e.replica.internalMonitoringEndpoint));function r(t){return new T(new E(t,e.batchBytesLimit),e.maxBatchSize,e.batchBytesLimit,e.maxMessageSize,e.flushTimeout)}function o(e){return i({date:(new Date).getTime(),view:{referrer:document.referrer,url:window.location.href}},void 0!==K?K():{},e)}return{add:function(e){var r=o(e);n.add(r),t&&t.add(r)}}}(t);!function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];t.forEach((function(t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}))}(X,{batch:n,maxMessagesPerPage:t.maxInternalMonitoringMessagesPerPage,sentMessageCount:0}),r=setInterval(W((function(){var t,n,o=Date.now()-y(g());if(Math.abs(o)>oe){clearInterval(r);var i=y(0);t="clock drift detected",n={debug:{navigationStartUTC:new Date(i).toUTCString(),timeSpent:Date.now()-i,drift:o}},function(e){X.debugMode&&console.log("[MONITORING MESSAGE]",e)}(t),Q(e(e({message:t},n),{status:z.info}))}})),ie)}var r;return{setExternalContextProvider:function(e){K=e}}}function V(e,t,n){var r=n.value;n.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=X.batch?W(r):r;return n.apply(this,e)}}function W(e){return function(){return Z(e,this,arguments)}}function Z(e,t,n){try{return e.apply(t,n)}catch(e){te(e);try{Y(e)}catch(e){te(e)}}}function Y(t){Q(e(e({},function(e){if(e instanceof Error){var t=P(e);return{error:{kind:t.name,stack:h(t)},message:t.message}}return{error:{stack:"Not an instance of error"},message:"Uncaught "+ce(e)}}(t)),{status:z.error}))}function Q(e){X.batch&&X.sentMessageCount<X.maxMessagesPerPage&&(X.sentMessageCount+=1,X.batch.add(e))}function ee(e){X.debugMode=e}function te(e){X.debugMode&&console.warn("[INTERNAL ERROR]",e)}var ne,re,oe=1e3,ie=60*oe,ae=60*ie;function se(e){return e?(parseInt(e,10)^16*Math.random()>>parseInt(e,10)/4).toString(16):"10000000-1000-4000-8000-100000000000".replace(/[018]/g,se)}function ue(){}function ce(e,t,n){if(null==e)return JSON.stringify(e);var r=[!1,void 0];fe(e)&&(r=[!0,e.toJSON],delete e.toJSON);var o,i,a=[!1,void 0];"object"==typeof e&&fe(o=Object.getPrototypeOf(e))&&(a=[!0,o.toJSON],delete o.toJSON);try{i=JSON.stringify(e,t,n)}catch(e){i="<error: unable to serialize object>"}finally{r[0]&&(e.toJSON=r[1]),a[0]&&(o.toJSON=a[1])}return i}function fe(e){return"object"==typeof e&&null!==e&&e.hasOwnProperty("toJSON")}function le(e,t){return-1!==e.indexOf(t)}function de(e,t,n,r){return pe(e,[t],n,r)}function pe(e,t,n,r){var o=void 0===r?{}:r,i=o.once,a=o.capture,s=o.passive,u=W(i?function(e){f(),n(e)}:n),c=s?{capture:a,passive:s}:a;t.forEach((function(t){return e.addEventListener(t,u,c)}));var f=function(){return t.forEach((function(t){return e.removeEventListener(t,u,c)}))};return{stop:f}}!function(e){e.DOCUMENT="document",e.XHR="xhr",e.BEACON="beacon",e.FETCH="fetch",e.CSS="css",e.JS="js",e.IMAGE="image",e.FONT="font",e.MEDIA="media",e.OTHER="other"}(ne||(ne={})),function(e){e.FETCH="fetch",e.XHR="xhr"}(re||(re={}));var he,ve,ge=oe;function me(e,t,n,r){var o=new Date;o.setTime(o.getTime()+n);var i="expires="+o.toUTCString(),a=r&&r.crossSite?"none":"strict",s=r&&r.domain?";domain="+r.domain:"",u=r&&r.secure?";secure":"";document.cookie=e+"="+t+";"+i+";path=/;samesite="+a+s+u}function ye(e){return function(e,t){var n=new RegExp("(?:^|;)\\s*"+t+"\\s*=\\s*([^;]+)").exec(e);return n?n[1]:void 0}(document.cookie,e)}function be(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];try{return e.apply(void 0,n)}catch(e){console.error(t,e)}}}var we={alternate:{logs:"logs",rum:"rum",sessionReplay:"session-replay",trace:"trace"},classic:{logs:"browser",rum:"rum",sessionReplay:void 0,trace:"public-trace"}},Ee="eu",xe="us",Te=((ve={})[Ee]="datadoghq.eu",ve[xe]="datadoghq.com",ve),Se=[Te[xe],Te[Ee]];function ke(t,n){var r={buildMode:n.buildMode,clientToken:t.clientToken,env:t.env,proxyHost:t.proxyHost,sdkVersion:n.sdkVersion,service:t.service,site:t.site||Te[t.datacenter||n.datacenter],version:t.version},o=function(e,t){return!t.useAlternateIntakeDomains&&le(Se,e)?"classic":"alternate"}(r.site,t),i=function(e,t,n){if(t.proxyHost)return["https://"+t.proxyHost+"/v1/input/"];var r=[t.site];t.buildMode===Re.STAGING&&n&&r.push(Te[xe]);for(var o=[],i=Object.keys(we[e]),a=0,s=r;a<s.length;a++)for(var u=s[a],c=0,f=i;c<f.length;c++){var l=f[c];o.push("https://"+Me(e,l,u)+"/v1/input/")}return o}(o,r,void 0!==t.replica),a={isIntakeUrl:function(e){return i.some((function(t){return 0===e.indexOf(t)}))},logsEndpoint:Oe(o,"logs",r),rumEndpoint:Oe(o,"rum",r),sessionReplayEndpoint:Oe(o,"sessionReplay",r),traceEndpoint:Oe(o,"trace",r)};if(t.internalMonitoringApiKey&&(a.internalMonitoringEndpoint=Oe(o,"logs",r,"browser-agent-internal-monitoring")),r.buildMode===Re.E2E_TEST&&(a.internalMonitoringEndpoint="<<< E2E INTERNAL MONITORING ENDPOINT >>>",a.logsEndpoint="<<< E2E LOGS ENDPOINT >>>",a.rumEndpoint="<<< E2E RUM ENDPOINT >>>",a.sessionReplayEndpoint="<<< E2E SESSION REPLAY ENDPOINT >>>"),r.buildMode===Re.STAGING&&void 0!==t.replica){var s=e(e({},r),{applicationId:t.replica.applicationId,clientToken:t.replica.clientToken,site:Te[xe]});a.replica={applicationId:t.replica.applicationId,internalMonitoringEndpoint:Oe(o,"logs",s,"browser-agent-internal-monitoring"),logsEndpoint:Oe(o,"logs",s),rumEndpoint:Oe(o,"rum",s)}}return a}function Me(e,t,n){return"classic"===e&&function(e,t){var n=we.classic[e];return n&&n+"-http-intake.logs."+t}(t,n)||function(e,t){var n=we.alternate[e],r=t.split("."),o=r.pop(),i=r.join("-")+"."+o;return n+".browser-intake-"+i}(t,n)}function Oe(e,t,n,r){var o="sdk_version:"+n.sdkVersion+(n.env?",env:"+n.env:"")+(n.service?",service:"+n.service:"")+(n.version?",version:"+n.version:""),i=Me(e,t,n.site),a=n.proxyHost?n.proxyHost:i,s=(n.proxyHost?"ddhost="+i+"&":"")+"ddsource="+(r||"browser")+"&ddtags="+encodeURIComponent(o);return"https://"+a+"/v1/input/"+n.clientToken+"?"+s}var Re,Ce={allowedTracingOrigins:[],maxErrorsByMinute:3e3,maxInternalMonitoringMessagesPerPage:15,resourceSampleRate:100,sampleRate:100,silentMultipleInit:!1,trackInteractions:!1,requestErrorResponseLengthLimit:32768,flushTimeout:30*oe,maxBatchSize:50,maxMessageSize:262144,batchBytesLimit:16384};function Le(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===he){for(var e="dd_site_test_"+se(),t=window.location.hostname.split("."),n=t.pop();t.length&&!ye(e);)n=t.pop()+"."+n,me(e,"test",oe,{domain:n});he=n}return he}()),t}function Ie(t,n){var r=function(t,n){var r=Array.isArray(t.enableExperimentalFeatures)?t.enableExperimentalFeatures:[],o=e(e({beforeSend:t.beforeSend&&be(t.beforeSend,"beforeSend threw an error:"),cookieOptions:Le(t),isEnabled:function(e){return le(r,e)},service:t.service},ke(t,n)),Ce);return"allowedTracingOrigins"in t&&(o.allowedTracingOrigins=t.allowedTracingOrigins),"sampleRate"in t&&(o.sampleRate=t.sampleRate),"resourceSampleRate"in t&&(o.resourceSampleRate=t.resourceSampleRate),"trackInteractions"in t&&(o.trackInteractions=!!t.trackInteractions),o}(t,n);return{configuration:r,internalMonitoring:J(r)}}function Be(){var e={};return{get:function(){return e},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},set:function(t){e=t}}}!function(e){e.RELEASE="release",e.STAGING="staging",e.E2E_TEST="e2e-test"}(Re||(Re={}));var _e,Ae,Ne,je,De=function(){function e(e){void 0===e&&(e=1e4),this.limit=e,this.buffer=[]}return e.prototype.add=function(e){this.buffer.push(e)>this.limit&&this.buffer.splice(0,1)},e.prototype.drain=function(e){this.buffer.forEach((function(t){return e(t)})),this.buffer.length=0},e}(),Pe={debug:"debug",error:"error",info:"info",warn:"warn"},ze=((_e={})[Pe.debug]=0,_e[Pe.info]=1,_e[Pe.warn]=2,_e[Pe.error]=3,_e),He=(Object.keys(Pe),"console"),Ue="http",qe=function(){function t(e,t,n,r){void 0===t&&(t=Ue),void 0===n&&(n=Pe.debug),void 0===r&&(r={}),this.sendLog=e,this.handlerType=t,this.level=n,this.contextManager=Be(),this.contextManager.set(r)}return t.prototype.log=function(t,n,r){if(void 0===r&&(r=Pe.info),ze[r]>=ze[this.level])switch(this.handlerType){case Ue:this.sendLog(e({message:t,status:r},i(this.contextManager.get(),n)));break;case He:console.log(r+": "+t,i(this.contextManager.get(),n))}},t.prototype.debug=function(e,t){this.log(e,t,Pe.debug)},t.prototype.info=function(e,t){this.log(e,t,Pe.info)},t.prototype.warn=function(e,t){this.log(e,t,Pe.warn)},t.prototype.error=function(e,t){var n={error:{origin:l}};this.log(e,i(n,t),Pe.error)},t.prototype.setContext=function(e){this.contextManager.set(e)},t.prototype.addContext=function(e,t){this.contextManager.add(e,t)},t.prototype.removeContext=function(e){this.contextManager.remove(e)},t.prototype.setHandler=function(e){this.handlerType=e},t.prototype.setLevel=function(e){this.level=e},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);i>3&&a&&Object.defineProperty(t,n,a)}([V],t.prototype,"log",null),t}();function Fe(e){return Ge(e,function(e){if(e.origin)return e.origin;var t=e.host.replace(/(:80|:443)$/,"");return e.protocol+"//"+t}(window.location)).href}function Ge(e,t){if(function(){if(void 0!==Ae)return Ae;try{var e=new URL("http://test/path");return Ae="http://test/path"===e.href}catch(e){Ae=!1}return Ae}())return void 0!==t?new URL(e,t):new URL(e);if(void 0===t&&!/:/.test(e))throw new Error("Invalid URL: '"+e+"'");var n=document,r=n.createElement("a");if(void 0!==t){var o=(n=document.implementation.createHTMLDocument("")).createElement("base");o.href=t,n.head.appendChild(o),n.body.appendChild(r)}return r.href=e,r}var $e,Ke=[],Xe=[];function Je(){return Ne||(!function(){if(!window.fetch)return;je=window.fetch,window.fetch=function(e,t){var n,r=Z(Ve,null,[e,t]);return r?Z(We,null,[n=je.call(this,r.input,r.init),r]):n=je.call(this,e,t),n}}(),Ne={beforeSend:function(e){Ke.push(e)},onRequestComplete:function(e){Xe.push(e)}}),Ne}function Ve(e,t){var n=t&&t.method||"object"==typeof e&&e.method||"GET",r=Fe("object"==typeof e&&e.url||e),o={init:t,input:e,method:n,startTime:g(),url:r};return Ke.forEach((function(e){return e(o)})),o}function We(e,n){var r=this,o=function(e){return o=r,i=void 0,s=function(){var r,o;return t(this,(function(t){switch(t.label){case 0:return n.duration=m(n.startTime,g()),"stack"in e||e instanceof Error?(n.status=0,n.response=h(P(e)),n.isAborted=e instanceof DOMException&&e.code===DOMException.ABORT_ERR,Xe.forEach((function(e){return e(n)})),[3,6]):[3,1];case 1:if(!("status"in e))return[3,6];r=void 0,t.label=2;case 2:return t.trys.push([2,4,,5]),[4,e.clone().text()];case 3:return r=t.sent(),[3,5];case 4:return o=t.sent(),r="Unable to retrieve response: "+o,[3,5];case 5:n.response=r,n.responseType=e.type,n.status=e.status,n.isAborted=!1,Xe.forEach((function(e){return e(n)})),t.label=6;case 6:return[2]}}))},new((a=void 0)||(a=Promise))((function(e,t){function n(e){try{u(s.next(e))}catch(e){t(e)}}function r(e){try{u(s.throw(e))}catch(e){t(e)}}function u(t){t.done?e(t.value):new a((function(e){e(t.value)})).then(n,r)}u((s=s.apply(o,i||[])).next())}));var o,i,a,s};e.then(W(o),W(o))}var Ze,Ye,Qe,et=[],tt=[];function nt(){return $e||(Ze=XMLHttpRequest.prototype.open,Ye=XMLHttpRequest.prototype.send,Qe=XMLHttpRequest.prototype.abort,XMLHttpRequest.prototype.open=function(e,t){var n=this;return Z((function(){n._datadog_xhr={method:e,startTime:-1,url:Fe(t)}})),Ze.apply(this,arguments)},XMLHttpRequest.prototype.send=function(){var t=this;return Z((function(){if(t._datadog_xhr){var n=t._datadog_xhr;n.startTime=g(),n.isAborted=!1;var r=t.onreadystatechange;t.onreadystatechange=function(){this.readyState===XMLHttpRequest.DONE&&Z(i),r&&r.apply(this,arguments)};var o=!1,i=function(){if(!o){o=!0;var r=e(e({},n),{duration:m(n.startTime,g()),response:t.response,status:t.status});tt.forEach((function(e){return e(r)}))}};t.addEventListener("loadend",W(i)),et.forEach((function(e){return e(n,t)}))}})),Ye.apply(this,arguments)},XMLHttpRequest.prototype.abort=function(){var e=this;return Z((function(){e._datadog_xhr&&(e._datadog_xhr.isAborted=!0)})),Qe.apply(this,arguments)},$e={beforeSend:function(e){et.push(e)},onRequestComplete:function(e){tt.push(e)}}),$e}var rt,ot,it=function(){function e(){this.observers=[]}return e.prototype.subscribe=function(e){this.observers.push(e)},e.prototype.notify=function(e){this.observers.forEach((function(t){return t(e)}))},e}();function at(t){if(!rt){var n=new it;!function(e,t){function n(n,r){e.isIntakeUrl(r.url)||e.isEnabled("remove-network-errors")&&r.isAborted||!function(e){return 0===e.status&&"opaque"!==e.responseType}(r)&&!function(e){return e.status>=500}(r)||t.notify({message:ct(n)+" error "+r.method+" "+r.url,resource:{method:r.method,statusCode:r.status,url:r.url},source:d,stack:ut(r.response,e)||"Failed to load",startTime:r.startTime})}nt().onRequestComplete((function(e){return n(re.XHR,e)})),Je().onRequestComplete((function(e){return n(re.FETCH,e)}))}(t,n),function(t){ot=console.error,console.error=W((function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];ot.apply(console,n),t.notify(e(e({},st(n)),{source:f,startTime:g()}))}))}(n),function(e){B((function(t,n,r){var o=function(e,t,n){return e&&(void 0!==e.message||t instanceof Error)?{message:e.message||"Empty message",stack:h(e),type:e.name}:{message:n+" "+ce(t),stack:"No stack, consider using an instance of Error",type:e&&e.name}}(t,r,"Uncaught"),i=o.stack,a=o.message,s=o.type;e.notify({message:a,stack:i,type:s,source:p,startTime:g()})}))}(n),rt=function(e,t){var n=0,r=new it;return t.subscribe((function(t){n<e.maxErrorsByMinute?(n+=1,r.notify(t)):n===e.maxErrorsByMinute&&(n+=1,r.notify({message:"Reached max number of errors by minute: "+e.maxErrorsByMinute,source:c,startTime:g()}))})),setInterval((function(){return n=0}),ie),r}(t,n)}return rt}function st(e){var t=function(e,t){for(var n=0;n<e.length;n+=1){var r=e[n];if(t(r,n,e))return r}}(e,(function(e){return e instanceof Error}));return{message:n(["console error:"],e).map((function(e){return function(e){if("string"==typeof e)return e;if(e instanceof Error)return v(P(e));return ce(e,void 0,2)}(e)})).join(" "),stack:t?h(P(t)):void 0}}function ut(e,t){return e&&e.length>t.requestErrorResponseLengthLimit?e.substring(0,t.requestErrorResponseLengthLimit)+"...":e}function ct(e){return re.XHR===e?"XHR":"Fetch"}function ft(e,t,n){var r=s(void 0,e,a()),o=n(r);return t.forEach((function(t){var n=lt(e,t),o=lt(r,t);"string"==typeof n&&"string"==typeof o&&function(e,t,n){for(var r=e,o=t.split("."),i=0;i<o.length;i+=1){var a=o[i];if(!dt(r,a))return;i!==o.length-1?r=r[a]:r[a]=n}}(e,t,o)})),o}function lt(e,t){for(var n=e,r=0,o=t.split(".");r<o.length;r++){var i=o[r];if(!dt(n,i))return;n=n[i]}return n}function dt(e,t){return"object"==typeof e&&null!==e&&t in e}var pt=15*ie,ht=4*ae,vt=ie;function gt(e,t,n){var r=function(e,t){var n,r,o=!1,i=function(){o=!0,clearTimeout(n),n=setTimeout((function(){o=!1}),ge)};return{get:function(){return o||(r=ye(e),i()),r},set:function(n,o){me(e,n,o,t),r=n,i()}}}("_dd_s",e);!function(e){var t=e.get(),n=ye("_dd"),r=ye("_dd_r"),o=ye("_dd_l");if(!t){var i={};n&&(i.id=n),o&&/^[01]$/.test(o)&&(i.logs=o),r&&/^[012]$/.test(r)&&(i.rum=r),wt(i,e)}}(r);var o=new it,i=bt(r).id,a=function(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=setTimeout((function(){a&&r&&e.apply(void 0,r),s=!1,r=void 0}),t))},cancel:function(){clearTimeout(o),s=!1,r=void 0}}}(W((function(){var e=bt(r),a=n(e[t]),s=a.trackingType,u=a.isTracked;e[t]=s,u&&!e.id&&(e.id=se(),e.created=String(Date.now())),wt(e,r),u&&i!==e.id&&(i=e.id,o.notify())})),ge).throttled;return a(),function(e){var t=pe(window,["click","touchstart","keydown","scroll"],e,{capture:!0,passive:!0}).stop;xt.push(t)}(a),function(e){var t=W((function(){"visible"===document.visibilityState&&e()})),n=de(document,"visibilitychange",t).stop;xt.push(n);var r=setInterval(t,vt);xt.push((function(){clearInterval(r)}))}((function(){wt(bt(r),r)})),{getId:function(){return bt(r).id},getTrackingType:function(){return bt(r)[t]},renewObservable:o}}var mt=/^([a-z]+)=([a-z0-9-]+)$/,yt="&";function bt(e){var t=function(e){var t=e.get(),n={};(function(e){return void 0!==e&&(-1!==e.indexOf("&")||mt.test(e))})(t)&&t.split(yt).forEach((function(e){var t=mt.exec(e);if(null!==t){var r=t[1],o=t[2];n[r]=o}}));return n}(e);return function(e){return(void 0===e.created||Date.now()-Number(e.created)<ht)&&(void 0===e.expire||Date.now()<Number(e.expire))}(t)?t:(Et(e),{})}function wt(e,t){if(n=e,0!==Object.keys(n).length){var n;e.expire=String(Date.now()+pt);var r=function(e){return Object.keys(e).map((function(t){return[t,e[t]]}))}(e).map((function(e){return e[0]+"="+e[1]})).join(yt);t.set(r,pt)}else Et(t)}function Et(e){e.set("",0)}var xt=[];var Tt;function St(e,t){if(!t){var n=kt(e)===Tt.TRACKED;return{getId:function(){},isTracked:function(){return n}}}var r=gt(e.cookieOptions,"logs",(function(t){return function(e,t){var n=function(e){return e===Tt.NOT_TRACKED||e===Tt.TRACKED}(t)?t:kt(e);return{trackingType:n,isTracked:n===Tt.TRACKED}}(e,t)}));return{getId:r.getId,isTracked:function(){return r.getTrackingType()===Tt.TRACKED}}}function kt(e){return 0!==(t=e.sampleRate)&&100*Math.random()<=t?Tt.TRACKED:Tt.NOT_TRACKED;var t}!function(e){e.NOT_TRACKED="0",e.TRACKED="1"}(Tt||(Tt={}));var Mt={buildMode:"release",datacenter:"us",sdkVersion:"2.7.4"},Ot=["view.url","view.referrer","message","error.stack","http.url"];function Rt(e){var t=window.DD_RUM;return t&&t.getInternalContext?t.getInternalContext(e):void 0}var Ct,Lt,It,Bt,_t=function(t){var n=!1,r=Be(),o={},a=new De,s=function(e,t){a.add([e,t])},u=new qe(l);return c={logger:u,init:W((function(e){(function(e){return n?(e.silentMultipleInit||console.error("DD_LOGS is already initialized."),!1):e&&(e.publicApiKey||e.clientToken)?!!(void 0===e.sampleRate||(t=e.sampleRate,function(e){return"number"==typeof e}(t)&&t>=0&&t<=100))||(console.error("Sample Rate should be a number between 0 and 100"),!1):(console.error("Client Token is not configured, we will not send any data."),!1);var t})(e)&&(e.publicApiKey&&(e.clientToken=e.publicApiKey,console.warn("Public API Key is deprecated. Please use Client Token instead.")),s=t(e,u,r.get),a.drain((function(e){var t=e[0],n=e[1];return s(t,n)})),n=!0)})),getLoggerGlobalContext:W(r.get),setLoggerGlobalContext:W(r.set),addLoggerGlobalContext:W(r.add),removeLoggerGlobalContext:W(r.remove),createLogger:W((function(t,n){return void 0===n&&(n={}),o[t]=new qe(l,n.handler,n.level,e(e({},n.context),{logger:{name:t}})),o[t]})),getLogger:W((function(e){return o[e]}))},f=e(e({},c),{onReady:function(e){e()}}),Object.defineProperty(f,"_setDebug",{get:function(){return ee},enumerable:!1}),f;var c,f;function l(e){s(e,i({date:Date.now(),view:{referrer:document.referrer,url:window.location.href}},r.get()))}}((function(e,t,n){var r=Ie(e,Mt),o=r.configuration,a=r.internalMonitoring;return function(e,t,n,r,o,a){n.setExternalContextProvider((function(){return i({session_id:r.getId()},a(),Rt())}));var s=function(e,t){return function(n,r){if(e.isTracked()){var o=i({service:t.service,session_id:e.getId()},r,Rt(),n);if(t.beforeSend)if(!1===ft(o,Ot,t.beforeSend))return;return o}}}(r,e),u=function(e){var t,n=r(e.logsEndpoint);void 0!==e.replica&&(t=r(e.replica.logsEndpoint));function r(t){return new T(new E(t,e.batchBytesLimit),e.maxBatchSize,e.batchBytesLimit,e.maxMessageSize,e.flushTimeout)}return{add:function(e){n.add(e),t&&t.add(e)}}}(e);return t.subscribe((function(e){o.error(e.message,i({date:y(e.startTime),error:{kind:e.type,origin:e.source,stack:e.stack}},e.resource?{http:{method:e.resource.method,status_code:e.resource.statusCode,url:e.resource.url}}:void 0,Rt(e.startTime)))})),function(e,t){var n=s(e,t);n&&u.add(n)}}(o,!1!==e.forwardErrorsToLogs?at(o):new it,a,St(o,function(e){if(void 0===document.cookie||null===document.cookie)return!1;try{var t="dd_cookie_test_"+se(),n="test";return me(t,n,oe,e),ye(t)===n}catch(e){return console.error(e),!1}}(o.cookieOptions)),t,n)}));Ct=function(){if("object"==typeof globalThis)return globalThis;Object.defineProperty(Object.prototype,"_dd_temp_",{get:function(){return this},configurable:!0});var e=_dd_temp_;return delete Object.prototype._dd_temp_,"object"!=typeof e&&(e="object"==typeof self?self:"object"==typeof window?window:{}),e}(),It=_t,Bt=Ct[Lt="DD_LOGS"],Ct[Lt]=It,Bt&&Bt.q&&Bt.q.forEach((function(e){return be(e,"onReady callback threw an error:")()}))}();

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

datacenter: 'us',
sdkVersion: '2.7.2',
sdkVersion: '2.7.4',
};
//# sourceMappingURL=buildEnv.js.map
export var buildEnv = {
buildMode: 'release',
datacenter: 'us',
sdkVersion: '2.7.2',
sdkVersion: '2.7.4',
};
//# sourceMappingURL=buildEnv.js.map
{
"name": "@datadog/browser-logs",
"version": "2.7.2",
"version": "2.7.4",
"license": "Apache-2.0",

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

"dependencies": {
"@datadog/browser-core": "2.7.2",
"@datadog/browser-core": "2.7.4",
"tslib": "^1.10.0"

@@ -29,3 +29,3 @@ },

},
"gitHead": "8b40b773059b0244b0314ae2fce91ce39985d2c6"
"gitHead": "5127d03aefeb9d9094df3629c5977bd7411363f7"
}
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc