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.11.1 to 2.12.0

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

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

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

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

"dependencies": {
"@datadog/browser-core": "2.11.1",
"@datadog/browser-core": "2.12.0",
"tslib": "^1.10.0"

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

},
"gitHead": "6e95f9755e7926c30395bd29f484848da80bb37d"
"gitHead": "82f28c6f1e46f914dfaedaf0e73191ca0a4f4e64"
}
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