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.17.0 to 2.18.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,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={log:console.log.bind(console),warn:console.warn.bind(console),error:console.error.bind(console)},o=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;function i(e){if(s){if(a===e)return;g()}var t=y(e);throw s=t,a=e,setTimeout(G((function(){a===e&&g()})),t.incomplete?2e3:0),e}var a,s,u,c,f,l=[];function d(e){!function(){if(c)return;u=window.onerror,window.onerror=G(h),c=!0}(),function(){if(f)return;null!==window.onunhandledrejection?window.onunhandledrejection:void 0,window.onunhandledrejection=G(v),f=!0}(),l.push(e)}function p(e,t,n){var r;if(l.forEach((function(o){try{o(e,t,n)}catch(e){r=e}})),r)throw r}function h(e,t,n,r,i){if(s)w(s,t,n),g();else if(i)p(y(i),!0,i);else{var a,c={url:t,column:r,line:n},f=e;if("[object String]"==={}.toString.call(e)){var l=o.exec(f);l&&(a=l[1],f=l[2])}p({name:a,message:"string"==typeof f?f:void 0,stack:[c]},!0,e)}return!!u&&u.apply(this,arguments)}function v(e){var t=e.reason||"Empty reason";p(y(t),!0,t)}function g(){var e=s,t=a;s=void 0,a=void 0,p(e,!1,t)}var m="?";function y(e,t){var n,r=void 0===t?0:+t;try{if(n=function(e){var t=E(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=m),u.context=[i[s+1]],a.push(u))}if(!a.length)return;return{stack:a,message:E(e,"message"),name:E(e,"name")}}(e))return n}catch(e){if(b)throw e}try{if(n=function(e){var t=E(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]||m,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]||m,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]||S(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]||m,line:o[4]?+o[4]:void 0,url:o[3]}}!i.func&&i.line&&(i.func=m),d.push(i)}if(!d.length)return;return{stack:d,message:E(e,"message"),name:E(e,"name")}}(e))return n}catch(e){if(b)throw e}try{if(n=function(e){var t=E(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)k(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=m),d.context=[n[l+1]],s.push(d))}if(!s.length)return;return{stack:s,message:n[0],name:E(e,"name")}}(e))return n}catch(e){if(b)throw e}try{if(n=x(e,r+1))return n}catch(e){if(b)throw e}return{message:E(e,"message"),name:E(e,"name"),stack:[]}}var b=!1;function w(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 x(e,t){for(var n,r,o=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,a=[],s={},u=!1,c=x.caller;c&&!u;c=c.caller)c!==y&&c!==i&&(r={args:[],column:void 0,func:m,line:void 0,url:void 0},n=o.exec(c.toString()),c.name?r.func=c.name:n&&(r.func=n[1]),void 0===r.func&&(r.func=n?n.input.substring(0,n.input.indexOf("{")):void 0),s[c.toString()]?u=!0:s[c.toString()]=!0,a.push(r));t&&a.splice(0,t);var f={stack:a,message:E(e,"message"),name:E(e,"name")};return w(f,E(e,"sourceURL")||E(e,"fileName"),E(e,"line")||E(e,"lineNumber")),f}function E(e,t){if("object"==typeof e&&e&&t in e){var n=e[t];return"string"==typeof n?n:void 0}}function k(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function S(e){return void 0===e}var T,M="agent",O="console",R="logger",_="network",C="source";function L(e){var t=A(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 A(e){return(e.name||"Error")+": "+e.message}function N(){var e,t=new Error;if(!t.stack)try{throw t}catch(e){}return $((function(){var n=y(t);n.stack=n.stack.slice(2),e=L(n)})),e}!function(e){e.HANDLED="handled",e.UNHANDLED="unhandled"}(T||(T={}));var B=/[^\u0000-\u007F]/,I=!1,D=function(){function t(e,t,n){void 0===n&&(n=!1),this.endpointUrl=e,this.bytesLimit=t,this.withBatchTime=n}return t.prototype.send=function(t,n){var o=this.withBatchTime?function(e){return e+(-1===e.indexOf("?")?"?":"&")+"batch_time="+(new Date).getTime()}(this.endpointUrl):this.endpointUrl,i=!!navigator.sendBeacon&&n<this.bytesLimit;if(i)try{if(navigator.sendBeacon(o,t))return}catch(e){!function(e){j||(j=!0,K(e))}(e)}var a=function(t){var a,s,u=null==t?void 0:t.currentTarget;u.status>=200&&u.status<300||(I||(I=!0,a="XHR fallback failed",s={on_line:navigator.onLine,size:n,url:o,try_beacon:i,event:{is_trusted:t.isTrusted,total:t.total,loaded:t.loaded},request:{status:u.status,ready_state:u.readyState,response_text:u.responseText.slice(0,64)}},function(e){U.debugMode&&r.log("[MONITORING MESSAGE]",e)}(a),X(e(e({message:a},s),{status:z.info}))))},s=new XMLHttpRequest;s.addEventListener("loadend",G((function(e){return a(e)}))),s.open("POST",o,!0),s.send(t)},t}();var j=!1;var z,P=function(){function e(e,t,n,r,o,i){void 0===i&&(i=te),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 B.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=ne(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(G((function(){e.flush(),e.flushPeriodically()})),this.flushTimeout)},e.prototype.flushOnVisibilityHidden=function(){var e=this;navigator.sendBeacon&&(ie(window,"beforeunload",this.beforeUnloadCallback),ie(document,"visibilitychange",(function(){"hidden"===document.visibilityState&&e.flush()})),ie(window,"beforeunload",(function(){return e.flush()})))},e}();!function(e){e.info="info",e.error="error"}(z||(z={}));var H,U={maxMessagesPerPage:0,sentMessageCount:0};function q(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 P(new D(t,e.batchBytesLimit),e.maxBatchSize,e.batchBytesLimit,e.maxMessageSize,e.flushTimeout)}function o(e){return ue({date:(new Date).getTime(),view:{referrer:document.referrer,url:window.location.href}},void 0!==H?H():{},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])}))}(U,{batch:t,maxMessagesPerPage:e.maxInternalMonitoringMessagesPerPage,sentMessageCount:0})}return{setExternalContextProvider:function(e){H=e}}}function F(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=U.batch?G(r):r;return n.apply(this,e)}}function G(e){return function(){return $(e,this,arguments)}}function $(e,t,n){try{return e.apply(t,n)}catch(e){V(e);try{K(e)}catch(e){V(e)}}}function K(t){X(e(e({},function(e){if(e instanceof Error){var t=y(e);return{error:{kind:t.name,stack:L(t)},message:t.message}}return{error:{stack:"Not an instance of error"},message:"Uncaught "+ne(e)}}(t)),{status:z.error}))}function X(e){U.batch&&U.sentMessageCount<U.maxMessagesPerPage&&(U.sentMessageCount+=1,U.batch.add(e))}function J(e){U.debugMode=e}function V(e){U.debugMode&&r.error("[INTERNAL ERROR]",e)}var W,Z,Y=1e3,Q=6e4;function ee(e){return e?(parseInt(e,10)^16*Math.random()>>parseInt(e,10)/4).toString(16):"10000000-1000-4000-8000-100000000000".replace(/[018]/g,ee)}function te(){}function ne(e,t,n){if(null==e)return JSON.stringify(e);var r=[!1,void 0];re(e)&&(r=[!0,e.toJSON],delete e.toJSON);var o,i,a=[!1,void 0];"object"==typeof e&&re(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 re(e){return"object"==typeof e&&null!==e&&e.hasOwnProperty("toJSON")}function oe(e,t){return-1!==e.indexOf(t)}function ie(e,t,n,r){return ae(e,[t],n,r)}function ae(e,t,n,r){var o=void 0===r?{}:r,i=o.once,a=o.capture,s=o.passive,u=G(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 se(e,t,n){if(void 0===n&&(n=function(){if("undefined"!=typeof WeakSet){var e=new WeakSet;return{hasAlreadyBeenSeen:function(t){var n=e.has(t);return n||e.add(t),n}}}var t=[];return{hasAlreadyBeenSeen:function(e){var n=t.indexOf(e)>=0;return n||t.push(e),n}}}()),void 0===t)return e;if("object"!=typeof t||null===t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){var r=t.flags||[t.global?"g":"",t.ignoreCase?"i":"",t.multiline?"m":"",t.sticky?"y":"",t.unicode?"u":""].join("");return new RegExp(t.source,r)}if(!n.hasAlreadyBeenSeen(t)){if(Array.isArray(t)){for(var o=Array.isArray(e)?e:[],i=0;i<t.length;++i)o[i]=se(o[i],t[i],n);return o}var a,s="object"==(null===(a=e)?"null":Array.isArray(a)?"array":typeof a)?e:{};for(var u in t)Object.prototype.hasOwnProperty.call(t,u)&&(s[u]=se(s[u],t[u],n));return s}}function ue(){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=se(e,i))}return e}!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"}(W||(W={})),function(e){e.FETCH="fetch",e.XHR="xhr"}(Z||(Z={}));var ce,fe;function le(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 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&&oe(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===Ee.STAGING&&n&&r.push(me[ge]);for(var o=[],i=Object.keys(he[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://"+we(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:xe(o,"logs",r),rumEndpoint:xe(o,"rum",r),sessionReplayEndpoint:xe(o,"sessionReplay",r),traceEndpoint:xe(o,"trace",r)};if(t.internalMonitoringApiKey&&(a.internalMonitoringEndpoint=xe(o,"logs",r,"browser-agent-internal-monitoring")),r.buildMode===Ee.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===Ee.STAGING&&void 0!==t.replica){var s=e(e({},r),{applicationId:t.replica.applicationId,clientToken:t.replica.clientToken,site:me[ge]});a.replica={applicationId:t.replica.applicationId,internalMonitoringEndpoint:xe(o,"logs",s,"browser-agent-internal-monitoring"),logsEndpoint:xe(o,"logs",s),rumEndpoint:xe(o,"rum",s)}}return a}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 xe(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),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 Ee,ke={allowedTracingOrigins:[],maxErrorsByMinute:3e3,maxInternalMonitoringMessagesPerPage:15,resourceSampleRate:100,sampleRate:100,silentMultipleInit:!1,trackInteractions:!1,trackViewsManually:!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_"+ee(),t=window.location.hostname.split("."),n=t.pop();t.length&&!de(e);)n=t.pop()+"."+n,le(e,"test",Y,{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 oe(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),"trackViewsManually"in t&&(o.trackViewsManually=!!t.trackViewsManually),"actionNameAttribute"in t&&(o.actionNameAttribute=t.actionNameAttribute),o}(t,n);return{configuration:r,internalMonitoring:q(r)}}function Me(){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"}(Ee||(Ee={}));var Oe,Re,_e,Ce,Le=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}(),Ae={debug:"debug",error:"error",info:"info",warn:"warn"},Ne=((Oe={})[Ae.debug]=0,Oe[Ae.info]=1,Oe[Ae.warn]=2,Oe[Ae.error]=3,Oe),Be=(Object.keys(Ae),"console"),Ie="http",De=function(){function t(e,t,n,r){void 0===t&&(t=Ie),void 0===n&&(n=Ae.debug),void 0===r&&(r={}),this.sendLog=e,this.handlerType=t,this.level=n,this.contextManager=Me(),this.contextManager.set(r)}return t.prototype.log=function(t,n,o){if(void 0===o&&(o=Ae.info),Ne[o]>=Ne[this.level]){var i=Array.isArray(this.handlerType)?this.handlerType:[this.handlerType];oe(i,Ie)&&this.sendLog(e({message:t,status:o},ue(this.contextManager.get(),n))),oe(i,Be)&&r.log(o+": "+t,ue(this.contextManager.get(),n))}},t.prototype.debug=function(e,t){this.log(e,t,Ae.debug)},t.prototype.info=function(e,t){this.log(e,t,Ae.info)},t.prototype.warn=function(e,t){this.log(e,t,Ae.warn)},t.prototype.error=function(e,t){var n={error:{origin:R}};this.log(e,ue(n,t),Ae.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)}([F],t.prototype,"log",null),t}();function je(){return Date.now()}function ze(){return performance.now()}function Pe(){return{relative:ze(),timeStamp:je()}}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!==Re)return Re;try{var e=new URL("http://test/path");return Re="http://test/path"===e.href}catch(e){Re=!1}return Re}())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 _e||(!function(){if(!window.fetch)return;Ce=window.fetch,window.fetch=function(e,t){var n,r=$(Xe,null,[e,t]);return r?$(Je,null,[n=Ce.call(this,r.input,r.init),r]):n=Ce.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),o={init:t,input:e,method:n,startClocks:Pe(),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,s=function(){var r,o;return t(this,(function(t){switch(t.label){case 0:return n.duration=He(n.startClocks.timeStamp,je()),"stack"in e||e instanceof Error?(n.status=0,n.responseText=L(y(e)),n.isAborted=e instanceof DOMException&&e.code===DOMException.ABORT_ERR,n.error=e,$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=e,n.responseText=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(o,i||[])).next())}));var o,i,a,s};e.then(G(o),G(o))}var Ve,We,Ze,Ye=[],Qe=[];function et(e,t){var n=this;return $((function(){n._datadog_xhr={method:e,url:Ue(t)}})),Ve.apply(this,arguments)}function tt(){var e=this;return $((function(){if(e._datadog_xhr){e._datadog_xhr.startTime=ze(),e._datadog_xhr.startClocks=Pe(),e._datadog_xhr.isAborted=!1;var t=!1,n=e.onreadystatechange,r=function(){this.readyState===XMLHttpRequest.DONE&&o(),n&&n.apply(this,arguments)},o=G((function(){e.removeEventListener("loadend",o),e.onreadystatechange===r&&(e.onreadystatechange=n),t||(t=!0,rt(e))}));e.onreadystatechange=r,e.addEventListener("loadend",o),Ye.forEach((function(t){return t(e._datadog_xhr,e)}))}})),We.apply(this,arguments)}function nt(){var e=this;return $((function(){e._datadog_xhr&&(e._datadog_xhr.isAborted=!0)})),Ze.apply(this,arguments)}function rt(t){t._datadog_xhr.duration=He(t._datadog_xhr.startClocks.timeStamp,je()),t._datadog_xhr.responseText=t.response,t._datadog_xhr.status=t.status,t._datadog_xhr.xhr=t,Qe.forEach((function(n){return n(e({},t._datadog_xhr))}))}var ot,it,at=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 st(t){return ot||(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:ft(n)+" error "+r.method+" "+r.url,resource:{method:r.method,statusCode:r.status,url:r.url},source:_,stack:ct(r.responseText,e)||"Failed to load",startClocks:r.startClocks})}(function(){return Fe||(Ve=XMLHttpRequest.prototype.open,We=XMLHttpRequest.prototype.send,Ze=XMLHttpRequest.prototype.abort,XMLHttpRequest.prototype.open=et,XMLHttpRequest.prototype.send=tt,XMLHttpRequest.prototype.abort=nt,Fe={beforeSend:function(e){Ye.push(e)},onRequestComplete:function(e){Qe.push(e)}}),Fe})().onRequestComplete((function(e){return n(Z.XHR,e)})),Ke().onRequestComplete((function(e){return n(Z.FETCH,e)}))}(t,ot=new at),function(t){it=console.error,console.error=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=N();$((function(){it.apply(console,n),t.notify(e(e({},ut(n,o)),{source:O,startClocks:Pe(),handling:T.HANDLED}))}))}}(ot),function(e){d((function(t,n,r){var o=function(e,t,n,r){return e&&(void 0!==e.message||t instanceof Error)?{message:e.message||"Empty message",stack:L(e),handlingStack:r,type:e.name}:{message:n+" "+ne(t),stack:"No stack, consider using an instance of Error",handlingStack:r,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:C,startClocks:Pe(),originalError:r,handling:T.UNHANDLED})}))}(ot)),ot}function ut(e,t){var r=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 A(y(e));return ne(e,void 0,2)}(e)})).join(" "),stack:r?L(y(r)):void 0,handlingStack:t}}function ct(e,t){return e&&e.length>t.requestErrorResponseLengthLimit?e.substring(0,t.requestErrorResponseLengthLimit)+"...":e}function ft(e){return Z.XHR===e?"XHR":"Fetch"}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 at,i=gt(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}}}(G((function(){var e=gt(r),a=n(e[t]),s=a.trackingType,u=a.isTracked;e[t]=s,u&&!e.id&&(e.id=ee(),e.created=String(Date.now())),mt(e,r),u&&i!==e.id&&(i=e.id,o.notify())})),1e3).throttled;return a(),function(e){var t=ae(window,["click","touchstart","keydown","scroll"],e,{capture:!0,passive:!0}).stop;bt.push(t)}(a),function(e){var t=G((function(){"visible"===document.visibilityState&&e()})),n=ie(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 xt(e,t){if(!t){var n=Et(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:Et(e);return{trackingType:n,isTracked:n===wt.TRACKED}}(e,t)}));return{getId:r.getId,isTracked:function(){return r.getTrackingType()===wt.TRACKED}}}function Et(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.17.0"};function St(e){var t=window.DD_RUM;return t&&t.getInternalContext?t.getInternalContext(e):void 0}var Tt,Mt,Ot,Rt,_t=function(t){var n=!1,o=Me(),i={},a=new Le,s=function(e,t){a.add((function(){return s(e,t)}))},u=function(){},c=new De(d);return f={logger:c,init:G((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.")),s=t(e,c,o.get),u=function(){return se(void 0,e)},a.drain(),n=!0)})),getLoggerGlobalContext:G(o.get),setLoggerGlobalContext:G(o.set),addLoggerGlobalContext:G(o.add),removeLoggerGlobalContext:G(o.remove),createLogger:G((function(t,n){return void 0===n&&(n={}),i[t]=new De(d,n.handler,n.level,e(e({},n.context),{logger:{name:t}})),i[t]})),getLogger:G((function(e){return i[e]})),getInitConfiguration:G((function(){return u()}))},l=e(e({},f),{onReady:function(e){e()}}),Object.defineProperty(l,"_setDebug",{get:function(){return J},enumerable:!1}),l;var f,l;function d(e){s(e,ue({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 ue({session_id:r.getId()},i(),St())}));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}),Q),(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:M,startClocks:Pe()})}finally{r=!1}}return!0}}}(t,n);return function(n,o){if(e.isTracked()){var i=ue({service:t.service,session_id:e.getId()},o,St(),n);if(!(t.beforeSend&&!1===t.beforeSend(i)||i.status===Ae.error&&r.isLimitReached()))return i}}}(r,e,u),s=function(e){var t,n=r(e.logsEndpoint);void 0!==e.replica&&(t=r(e.replica.logsEndpoint));function r(t){return new P(new D(t,e.batchBytesLimit),e.maxBatchSize,e.batchBytesLimit,e.maxMessageSize,e.flushTimeout)}return{add:function(e){n.add(e),t&&t.add(e)}}}(e);function u(e){o.error(e.message,ue({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,St(e.startClocks.relative)))}return t.subscribe(u),function(e,t){var n=a(e,t);n&&s.add(n)}}(i,!1!==e.forwardErrorsToLogs?st(i):new at,a,xt(i,function(e){if(void 0===document.cookie||null===document.cookie)return!1;try{var t="dd_cookie_test_"+ee(),n="test";return le(t,n,Y,e),de(t)===n}catch(e){return r.error(e),!1}}(i.cookieOptions)),t,n)}));Tt=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}(),Ot=_t,Rt=Tt[Mt="DD_LOGS"],Tt[Mt]=Ot,Rt&&Rt.q&&Rt.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,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={log:console.log.bind(console),warn:console.warn.bind(console),error:console.error.bind(console)},o=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;function i(e){if(s){if(a===e)return;y()}var t=w(e);throw s=t,a=e,setTimeout($((function(){a===e&&y()})),t.incomplete?2e3:0),e}var a,s,u,c,f,l,d=[];function p(e){!function(){if(c)return;u=window.onerror,window.onerror=$(g),c=!0}(),function(){if(l)return;f=null!==window.onunhandledrejection?window.onunhandledrejection:void 0,window.onunhandledrejection=$(m),l=!0}(),d.push(e)}function h(e){for(var t=d.length-1;t>=0;t-=1)d[t]===e&&d.splice(t,1);0===d.length&&(c&&(window.onerror=u,c=!1),l&&(window.onunhandledrejection=f,l=!1))}function v(e,t,n){var r;if(d.forEach((function(o){try{o(e,t,n)}catch(e){r=e}})),r)throw r}function g(e,t,n,r,i){if(s)E(s,t,n),y();else if(i)v(w(i),!0,i);else{var a,c={url:t,column:r,line:n},f=e;if("[object String]"==={}.toString.call(e)){var l=o.exec(f);l&&(a=l[1],f=l[2])}v({name:a,message:"string"==typeof f?f:void 0,stack:[c]},!0,e)}return!!u&&u.apply(this,arguments)}function m(e){var t=e.reason||"Empty reason";v(w(t),!0,t)}function y(){var e=s,t=a;s=void 0,a=void 0,v(e,!1,t)}var b="?";function w(e,t){var n,r=void 0===t?0:+t;try{if(n=function(e){var t=S(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=b),u.context=[i[s+1]],a.push(u))}if(!a.length)return;return{stack:a,message:S(e,"message"),name:S(e,"name")}}(e))return n}catch(e){if(x)throw e}try{if(n=function(e){var t=S(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]||b,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]||b,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]||M(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]||b,line:o[4]?+o[4]:void 0,url:o[3]}}!i.func&&i.line&&(i.func=b),d.push(i)}if(!d.length)return;return{stack:d,message:S(e,"message"),name:S(e,"name")}}(e))return n}catch(e){if(x)throw e}try{if(n=function(e){var t=S(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)T(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=b),d.context=[n[l+1]],s.push(d))}if(!s.length)return;return{stack:s,message:n[0],name:S(e,"name")}}(e))return n}catch(e){if(x)throw e}try{if(n=k(e,r+1))return n}catch(e){if(x)throw e}return{message:S(e,"message"),name:S(e,"name"),stack:[]}}var x=!1;function E(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 k(e,t){for(var n,r,o=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,a=[],s={},u=!1,c=k.caller;c&&!u;c=c.caller)c!==w&&c!==i&&(r={args:[],column:void 0,func:b,line:void 0,url:void 0},n=o.exec(c.toString()),c.name?r.func=c.name:n&&(r.func=n[1]),void 0===r.func&&(r.func=n?n.input.substring(0,n.input.indexOf("{")):void 0),s[c.toString()]?u=!0:s[c.toString()]=!0,a.push(r));t&&a.splice(0,t);var f={stack:a,message:S(e,"message"),name:S(e,"name")};return E(f,S(e,"sourceURL")||S(e,"fileName"),S(e,"line")||S(e,"lineNumber")),f}function S(e,t){if("object"==typeof e&&e&&t in e){var n=e[t];return"string"==typeof n?n:void 0}}function T(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function M(e){return void 0===e}var R,O="agent",_="console",C="logger",L="network",A="source";function N(e){var t=B(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 B(e){return(e.name||"Error")+": "+e.message}function I(){var e,t=new Error;if(!t.stack)try{throw t}catch(e){}return K((function(){var n=w(t);n.stack=n.stack.slice(2),e=N(n)})),e}!function(e){e.HANDLED="handled",e.UNHANDLED="unhandled"}(R||(R={}));var D=/[^\u0000-\u007F]/,j=!1,H=function(){function t(e,t,n){void 0===n&&(n=!1),this.endpointUrl=e,this.bytesLimit=t,this.withBatchTime=n}return t.prototype.send=function(t,n){var o=this.withBatchTime?function(e){return e+(-1===e.indexOf("?")?"?":"&")+"batch_time="+(new Date).getTime()}(this.endpointUrl):this.endpointUrl,i=!!navigator.sendBeacon&&n<this.bytesLimit;if(i)try{if(navigator.sendBeacon(o,t))return}catch(e){!function(e){z||(z=!0,J(e))}(e)}var a=function(t){var a,s,u=null==t?void 0:t.currentTarget;u.status>=200&&u.status<300||(j||(j=!0,a="XHR fallback failed",s={on_line:navigator.onLine,size:n,url:o,try_beacon:i,event:{is_trusted:t.isTrusted,total:t.total,loaded:t.loaded},request:{status:u.status,ready_state:u.readyState,response_text:u.responseText.slice(0,64)}},function(e){F.debugMode&&r.log("[MONITORING MESSAGE]",e)}(a),V(e(e({message:a},s),{status:P.info}))))},s=new XMLHttpRequest;s.addEventListener("loadend",$((function(e){return a(e)}))),s.open("POST",o,!0),s.send(t)},t}();var z=!1;var P,U=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 D.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($((function(){e.flush(),e.flushPeriodically()})),this.flushTimeout)},e.prototype.flushOnVisibilityHidden=function(){var e=this;navigator.sendBeacon&&(se(window,"beforeunload",this.beforeUnloadCallback),se(document,"visibilitychange",(function(){"hidden"===document.visibilityState&&e.flush()})),se(window,"beforeunload",(function(){return e.flush()})))},e}();!function(e){e.info="info",e.error="error"}(P||(P={}));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 U(new H(t,e.batchBytesLimit),e.maxBatchSize,e.batchBytesLimit,e.maxMessageSize,e.flushTimeout)}function o(e){return fe({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 X(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?$(r):r;return n.apply(this,e)}}function $(e){return function(){return K(e,this,arguments)}}function K(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=w(e);return{error:{kind:t.name,stack:N(t)},message:t.message}}return{error:{stack:"Not an instance of error"},message:"Uncaught "+oe(e)}}(t)),{status:P.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,a=[!1,void 0];"object"==typeof e&&ie(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 ie(e){return"object"==typeof e&&null!==e&&e.hasOwnProperty("toJSON")}function ae(e,t){return-1!==e.indexOf(t)}function se(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,a=o.capture,s=o.passive,u=$(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 ce(e,t,n){if(void 0===n&&(n=function(){if("undefined"!=typeof WeakSet){var e=new WeakSet;return{hasAlreadyBeenSeen:function(t){var n=e.has(t);return n||e.add(t),n}}}var t=[];return{hasAlreadyBeenSeen:function(e){var n=t.indexOf(e)>=0;return n||t.push(e),n}}}()),void 0===t)return e;if("object"!=typeof t||null===t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){var r=t.flags||[t.global?"g":"",t.ignoreCase?"i":"",t.multiline?"m":"",t.sticky?"y":"",t.unicode?"u":""].join("");return new RegExp(t.source,r)}if(!n.hasAlreadyBeenSeen(t)){if(Array.isArray(t)){for(var o=Array.isArray(e)?e:[],i=0;i<t.length;++i)o[i]=ce(o[i],t[i],n);return o}var a,s="object"==(null===(a=e)?"null":Array.isArray(a)?"array":typeof a)?e:{};for(var u in t)Object.prototype.hasOwnProperty.call(t,u)&&(s[u]=ce(s[u],t[u],n));return s}}function fe(){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=ce(e,i))}return e}!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 le,de;function pe(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 he(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 ve(e,t){pe(e,"",0,t)}function ge(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 me={alternate:{logs:"logs",rum:"rum",sessionReplay:"session-replay",trace:"trace"},classic:{logs:"browser",rum:"rum",sessionReplay:void 0,trace:"public-trace"}},ye="eu",be="us",we=((de={})[ye]="datadoghq.eu",de[be]="datadoghq.com",de),xe=[we[be],we[ye]];function Ee(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||we[t.datacenter||n.datacenter],version:t.version},o=function(e,t){return!t.useAlternateIntakeDomains&&ae(xe,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===Te.STAGING&&n&&r.push(we[be]);for(var o=[],i=Object.keys(me[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://"+ke(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:Se(o,"logs",r),rumEndpoint:Se(o,"rum",r),sessionReplayEndpoint:Se(o,"sessionReplay",r),traceEndpoint:Se(o,"trace",r)};if(t.internalMonitoringApiKey&&(a.internalMonitoringEndpoint=Se(o,"logs",r,"browser-agent-internal-monitoring")),r.buildMode===Te.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===Te.STAGING&&void 0!==t.replica){var s=e(e({},r),{applicationId:t.replica.applicationId,clientToken:t.replica.clientToken,site:we[be]});a.replica={applicationId:t.replica.applicationId,internalMonitoringEndpoint:Se(o,"logs",s,"browser-agent-internal-monitoring"),logsEndpoint:Se(o,"logs",s),rumEndpoint:Se(o,"rum",s)}}return a}function ke(e,t,n){return"classic"===e&&function(e,t){var n=me.classic[e];return n&&n+"-http-intake.logs."+t}(t,n)||function(e,t){var n=me.alternate[e],r=t.split("."),o=r.pop(),i=r.join("-")+"."+o;return n+".browser-intake-"+i}(t,n)}function Se(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=ke(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 Te,Me={allowedTracingOrigins:[],maxErrorsByMinute:3e3,maxInternalMonitoringMessagesPerPage:15,resourceSampleRate:100,sampleRate:100,silentMultipleInit:!1,trackInteractions:!1,trackViewsManually:!1,requestErrorResponseLengthLimit:32768,flushTimeout:3e4,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===le){for(var e="dd_site_test_"+ne(),t=window.location.hostname.split("."),n=t.pop();t.length&&!he(e);)n=t.pop()+"."+n,pe(e,"test",ee,{domain:n});ve(e,{domain:n}),le=n}return le}()),t}function Oe(t,n){var r=function(t,n){var r=Array.isArray(t.enableExperimentalFeatures)?t.enableExperimentalFeatures:[],o=e(e({beforeSend:t.beforeSend&&ge(t.beforeSend,"beforeSend threw an error:"),cookieOptions:Re(t),isEnabled:function(e){return ae(r,e)},service:t.service},Ee(t,n)),Me);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),"trackViewsManually"in t&&(o.trackViewsManually=!!t.trackViewsManually),"actionNameAttribute"in t&&(o.actionNameAttribute=t.actionNameAttribute),o}(t,n);return{configuration:r,internalMonitoring:G(r)}}function _e(){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"}(Te||(Te={}));var Ce,Le,Ae,Ne,Be,Ie,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(){this.buffer.forEach((function(e){return e()})),this.buffer.length=0},e}(),je={debug:"debug",error:"error",info:"info",warn:"warn"},He=((Ce={})[je.debug]=0,Ce[je.info]=1,Ce[je.warn]=2,Ce[je.error]=3,Ce),ze=(Object.keys(je),"console"),Pe="http",Ue=function(){function t(e,t,n,r){void 0===t&&(t=Pe),void 0===n&&(n=je.debug),void 0===r&&(r={}),this.sendLog=e,this.handlerType=t,this.level=n,this.contextManager=_e(),this.contextManager.set(r)}return t.prototype.log=function(t,n,o){if(void 0===o&&(o=je.info),He[o]>=He[this.level]){var i=Array.isArray(this.handlerType)?this.handlerType:[this.handlerType];ae(i,Pe)&&this.sendLog(e({message:t,status:o},fe(this.contextManager.get(),n))),ae(i,ze)&&r.log(o+": "+t,fe(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:C}};this.log(e,fe(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 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)}([X],t.prototype,"log",null),t}(),qe=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 Fe(){return Date.now()}function Ge(){return performance.now()}function Xe(){return{relative:Ge(),timeStamp:Fe()}}function $e(e,t){return t-e}function Ke(e,t){var r=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 B(w(e));return oe(e,void 0,2)}(e)})).join(" "),stack:r?N(w(r)):void 0,handlingStack:t}}function Je(e){return p(Ae=function(t,n,r){var o=function(e,t,n,r){return e&&(void 0!==e.message||t instanceof Error)?{message:e.message||"Empty message",stack:N(e),handlingStack:r,type:e.name}:{message:n+" "+oe(t),stack:"No stack, consider using an instance of Error",handlingStack:r,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:A,startClocks:Xe(),originalError:r,handling:R.UNHANDLED})}),{stop:function(){h(Ae)}}}function Ve(e){return We(e,function(e){if(e.origin)return e.origin;var t=e.host.replace(/(:80|:443)$/,"");return e.protocol+"//"+t}(window.location)).href}function We(e,t){if(function(){if(void 0!==Ne)return Ne;try{var e=new URL("http://test/path");return Ne="http://test/path"===e.href}catch(e){Ne=!1}return Ne}())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 Ze,Ye=[],Qe=[];function et(){return Be||(!function(){if(!window.fetch)return;Ie=window.fetch,window.fetch=function(e,t){var n,r=K(tt,null,[e,t]);return r?K(nt,null,[n=Ie.call(this,r.input,r.init),r]):n=Ie.call(this,e,t),n}}(),Be={beforeSend:function(e){Ye.push(e)},onRequestComplete:function(e){Qe.push(e)}}),Be}function tt(e,t){var n=t&&t.method||"object"==typeof e&&e.method||"GET",r=Ve("object"==typeof e&&e.url||e),o={init:t,input:e,method:n,startClocks:Xe(),url:r};return Ye.forEach((function(e){return e(o)})),o}function nt(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=$e(n.startClocks.timeStamp,Fe()),"stack"in e||e instanceof Error?(n.status=0,n.responseText=N(w(e)),n.isAborted=e instanceof DOMException&&e.code===DOMException.ABORT_ERR,n.error=e,Qe.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=e,n.responseText=r,n.responseType=e.type,n.status=e.status,n.isAborted=!1,Qe.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($(o),$(o))}var rt,ot,it,at=[],st=[];function ut(e,t){var n=this;return K((function(){n._datadog_xhr={method:e,url:Ve(t)}})),rt.apply(this,arguments)}function ct(){var e=this;return K((function(){if(e._datadog_xhr){e._datadog_xhr.startTime=Ge(),e._datadog_xhr.startClocks=Xe(),e._datadog_xhr.isAborted=!1;var t=!1,n=e.onreadystatechange,r=function(){this.readyState===XMLHttpRequest.DONE&&o(),n&&n.apply(this,arguments)},o=$((function(){e.removeEventListener("loadend",o),e.onreadystatechange===r&&(e.onreadystatechange=n),t||(t=!0,lt(e))}));e.onreadystatechange=r,e.addEventListener("loadend",o),at.forEach((function(t){return t(e._datadog_xhr,e)}))}})),ot.apply(this,arguments)}function ft(){var e=this;return K((function(){e._datadog_xhr&&(e._datadog_xhr.isAborted=!0)})),it.apply(this,arguments)}function lt(t){t._datadog_xhr.duration=$e(t._datadog_xhr.startClocks.timeStamp,Fe()),t._datadog_xhr.responseText=t.response,t._datadog_xhr.status=t.status,t._datadog_xhr.xhr=t,st.forEach((function(n){return n(e({},t._datadog_xhr))}))}function dt(e,t,n){function r(r,o){e.isIntakeUrl(o.url)||!n&&o.isAborted||!function(e){return 0===e.status&&"opaque"!==e.responseType}(o)&&!function(e){return e.status>=500}(o)||t.notify({message:ht(r)+" error "+o.method+" "+o.url,resource:{method:o.method,statusCode:o.status,url:o.url},source:L,stack:pt(o.responseText,e)||"Failed to load",startClocks:o.startClocks})}return void 0===n&&(n=!0),(Ze||(rt=XMLHttpRequest.prototype.open,ot=XMLHttpRequest.prototype.send,it=XMLHttpRequest.prototype.abort,XMLHttpRequest.prototype.open=ut,XMLHttpRequest.prototype.send=ct,XMLHttpRequest.prototype.abort=ft,Ze={beforeSend:function(e){at.push(e)},onRequestComplete:function(e){st.push(e)}}),Ze).onRequestComplete((function(e){return r(Q.XHR,e)})),et().onRequestComplete((function(e){return r(Q.FETCH,e)})),{stop:function(){Ze&&(Ze=void 0,at.length=0,st.length=0,XMLHttpRequest.prototype.open=rt,XMLHttpRequest.prototype.send=ot,XMLHttpRequest.prototype.abort=it),Be&&(Be=void 0,Ye.splice(0,Ye.length),Qe.splice(0,Qe.length),window.fetch=Ie)}}}function pt(e,t){return e&&e.length>t.requestErrorResponseLengthLimit?e.substring(0,t.requestErrorResponseLengthLimit)+"...":e}function ht(e){return Q.XHR===e?"XHR":"Fetch"}var vt=9e5,gt=144e5;function mt(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=he(e),i()),r},set:function(n,o){pe(e,n,o,t),r=n,i()}}}("_dd_s",e);!function(e){var t=e.get(),n=he("_dd"),r=he("_dd_r"),o=he("_dd_l");if(!t){var i={};n&&(i.id=n),o&&/^[01]$/.test(o)&&(i.logs=o),r&&/^[012]$/.test(r)&&(i.rum=r),xt(i,e)}}(r);var o=new qe,i=wt(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}}}($((function(){var e=wt(r),a=n(e[t]),s=a.trackingType,u=a.isTracked;e[t]=s,u&&!e.id&&(e.id=ne(),e.created=String(Date.now())),xt(e,r),u&&i!==e.id&&(i=e.id,o.notify())})),1e3).throttled;return a(),function(e){var t=ue(window,["click","touchstart","keydown","scroll"],e,{capture:!0,passive:!0}).stop;kt.push(t)}(a),function(e){var t=$((function(){"visible"===document.visibilityState&&e()})),n=se(document,"visibilitychange",t).stop;kt.push(n);var r=setInterval(t,6e4);kt.push((function(){clearInterval(r)}))}((function(){xt(wt(r),r)})),{getId:function(){return wt(r).id},getTrackingType:function(){return wt(r)[t]},renewObservable:o}}var yt=/^([a-z]+)=([a-z0-9-]+)$/,bt="&";function wt(e){var t=function(e){var t=e.get(),n={};(function(e){return void 0!==e&&(-1!==e.indexOf("&")||yt.test(e))})(t)&&t.split(bt).forEach((function(e){var t=yt.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)<gt)&&(void 0===e.expire||Date.now()<Number(e.expire))}(t)?t:(Et(e),{})}function xt(e,t){if(n=e,0!==Object.keys(n).length){var n;e.expire=String(Date.now()+vt);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(bt);t.set(r,vt)}else Et(t)}function Et(e){e.set("",0)}var kt=[];var St;function Tt(e,t){if(!t){var n=Mt(e)===St.TRACKED;return{getId:function(){},isTracked:function(){return n}}}var r=mt(e.cookieOptions,"logs",(function(t){return function(e,t){var n=function(e){return e===St.NOT_TRACKED||e===St.TRACKED}(t)?t:Mt(e);return{trackingType:n,isTracked:n===St.TRACKED}}(e,t)}));return{getId:r.getId,isTracked:function(){return r.getTrackingType()===St.TRACKED}}}function Mt(e){return 0!==(t=e.sampleRate)&&100*Math.random()<=t?St.TRACKED:St.NOT_TRACKED;var t}!function(e){e.NOT_TRACKED="0",e.TRACKED="1"}(St||(St={}));var Rt={buildMode:"release",datacenter:"us",sdkVersion:"2.18.0"};function Ot(e){var t=window.DD_RUM;return t&&t.getInternalContext?t.getInternalContext(e):void 0}var _t,Ct,Lt,At,Nt=function(t){var n=!1,o=_e(),i={},a=new De,s=function(e,t){a.add((function(){return s(e,t)}))},u=function(){},c=new Ue(d);return f={logger:c,init:$((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.")),s=t(e,c,o.get),u=function(){return ce(void 0,e)},a.drain(),n=!0)})),getLoggerGlobalContext:$(o.get),setLoggerGlobalContext:$(o.set),addLoggerGlobalContext:$(o.add),removeLoggerGlobalContext:$(o.remove),createLogger:$((function(t,n){return void 0===n&&(n={}),i[t]=new Ue(d,n.handler,n.level,e(e({},n.context),{logger:{name:t}})),i[t]})),getLogger:$((function(e){return i[e]})),getInitConfiguration:$((function(){return u()}))},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){s(e,fe({date:Date.now(),view:{referrer:document.referrer,url:window.location.href}},o.get()))}}((function(t,n,o){var i=Oe(t,Rt),a=i.configuration,s=i.internalMonitoring,u=new qe;return!1!==t.forwardErrorsToLogs&&(!function(t){Le=console.error,console.error=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=I();K((function(){Le.apply(console,n),t.notify(e(e({},Ke(n,o)),{source:_,startClocks:Xe(),handling:R.HANDLED}))}))}}(u),Je(u),dt(a,u,a.isEnabled("remove-network-errors"))),function(e,t,n,r,o,i){n.setExternalContextProvider((function(){return fe({session_id:r.getId()},i(),Ot())}));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:O,startClocks:Xe()})}finally{r=!1}}return!0}}}(t,n);return function(n,o){if(e.isTracked()){var i=fe({service:t.service,session_id:e.getId()},o,Ot(),n);if(!(t.beforeSend&&!1===t.beforeSend(i)||i.status===je.error&&r.isLimitReached()))return i}}}(r,e,u),s=function(e){var t,n=r(e.logsEndpoint);void 0!==e.replica&&(t=r(e.replica.logsEndpoint));function r(t){return new U(new H(t,e.batchBytesLimit),e.maxBatchSize,e.batchBytesLimit,e.maxMessageSize,e.flushTimeout)}return{add:function(e){n.add(e),t&&t.add(e)}}}(e);function u(e){o.error(e.message,fe({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,Ot(e.startClocks.relative)))}return t.subscribe(u),function(e,t){var n=a(e,t);n&&s.add(n)}}(a,u,s,Tt(a,function(e){if(void 0===document.cookie||null===document.cookie)return!1;try{var t="dd_cookie_test_"+ne(),n="test";pe(t,n,ee,e);var o=he(t)===n;return ve(t,e),o}catch(e){return r.error(e),!1}}(a.cookieOptions)),n,o)}));_t=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}(),Lt=Nt,At=_t[Ct="DD_LOGS"],_t[Ct]=Lt,At&&At.q&&At.q.forEach((function(e){return ge(e,"onReady callback threw an error:")()}))}();

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

datacenter: 'us',
sdkVersion: '2.17.0',
sdkVersion: '2.18.0',
};
//# sourceMappingURL=buildEnv.js.map

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

import { Configuration, Context, ErrorObservable, InternalMonitoring, RawError, InitConfiguration } from '@datadog/browser-core';
import { Configuration, Context, InternalMonitoring, Observable, RawError, InitConfiguration } from '@datadog/browser-core';
import { Logger, LogsMessage } from '../domain/logger';

@@ -15,3 +15,3 @@ import { LoggerSession } from '../domain/loggerSession';

export declare function startLogs(initConfiguration: LogsInitConfiguration, errorLogger: Logger, getGlobalContext: () => Context): (message: LogsMessage, currentContext: Context) => void;
export declare function doStartLogs(configuration: Configuration, errorObservable: ErrorObservable, internalMonitoring: InternalMonitoring, session: LoggerSession, errorLogger: Logger, getGlobalContext: () => Context): (message: LogsMessage, currentContext: Context) => void;
export declare function doStartLogs(configuration: Configuration, errorObservable: Observable<RawError>, internalMonitoring: InternalMonitoring, session: LoggerSession, errorLogger: Logger, getGlobalContext: () => Context): (message: LogsMessage, currentContext: Context) => void;
export declare function buildAssemble(session: LoggerSession, configuration: Configuration, reportError: (error: RawError) => void): (message: LogsMessage, currentContext: Context) => Context | undefined;

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

var _a = browser_core_1.commonInit(initConfiguration, buildEnv_1.buildEnv), configuration = _a.configuration, internalMonitoring = _a.internalMonitoring;
var errorObservable = initConfiguration.forwardErrorsToLogs !== false
? browser_core_1.startAutomaticErrorCollection(configuration)
: new browser_core_1.Observable();
var errorObservable = new browser_core_1.Observable();
if (initConfiguration.forwardErrorsToLogs !== false) {
browser_core_1.trackConsoleError(errorObservable);
browser_core_1.trackRuntimeError(errorObservable);
browser_core_1.trackNetworkError(configuration, errorObservable, configuration.isEnabled('remove-network-errors'));
}
var session = loggerSession_1.startLoggerSession(configuration, browser_core_1.areCookiesAuthorized(configuration.cookieOptions));

@@ -15,0 +18,0 @@ return doStartLogs(configuration, errorObservable, internalMonitoring, session, errorLogger, getGlobalContext);

export var buildEnv = {
buildMode: 'release',
datacenter: 'us',
sdkVersion: '2.17.0',
sdkVersion: '2.18.0',
};
//# sourceMappingURL=buildEnv.js.map

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

import { Configuration, Context, ErrorObservable, InternalMonitoring, RawError, InitConfiguration } from '@datadog/browser-core';
import { Configuration, Context, InternalMonitoring, Observable, RawError, InitConfiguration } from '@datadog/browser-core';
import { Logger, LogsMessage } from '../domain/logger';

@@ -15,3 +15,3 @@ import { LoggerSession } from '../domain/loggerSession';

export declare function startLogs(initConfiguration: LogsInitConfiguration, errorLogger: Logger, getGlobalContext: () => Context): (message: LogsMessage, currentContext: Context) => void;
export declare function doStartLogs(configuration: Configuration, errorObservable: ErrorObservable, internalMonitoring: InternalMonitoring, session: LoggerSession, errorLogger: Logger, getGlobalContext: () => Context): (message: LogsMessage, currentContext: Context) => void;
export declare function doStartLogs(configuration: Configuration, errorObservable: Observable<RawError>, internalMonitoring: InternalMonitoring, session: LoggerSession, errorLogger: Logger, getGlobalContext: () => Context): (message: LogsMessage, currentContext: Context) => void;
export declare function buildAssemble(session: LoggerSession, configuration: Configuration, reportError: (error: RawError) => void): (message: LogsMessage, currentContext: Context) => Context | undefined;

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

import { areCookiesAuthorized, Batch, combine, commonInit, createErrorFilter, HttpRequest, Observable, startAutomaticErrorCollection, } from '@datadog/browser-core';
import { areCookiesAuthorized, Batch, combine, commonInit, createErrorFilter, HttpRequest, Observable, trackNetworkError, trackRuntimeError, trackConsoleError, } from '@datadog/browser-core';
import { StatusType } from '../domain/logger';

@@ -7,5 +7,8 @@ import { startLoggerSession } from '../domain/loggerSession';

var _a = commonInit(initConfiguration, buildEnv), configuration = _a.configuration, internalMonitoring = _a.internalMonitoring;
var errorObservable = initConfiguration.forwardErrorsToLogs !== false
? startAutomaticErrorCollection(configuration)
: new Observable();
var errorObservable = new Observable();
if (initConfiguration.forwardErrorsToLogs !== false) {
trackConsoleError(errorObservable);
trackRuntimeError(errorObservable);
trackNetworkError(configuration, errorObservable, configuration.isEnabled('remove-network-errors'));
}
var session = startLoggerSession(configuration, areCookiesAuthorized(configuration.cookieOptions));

@@ -12,0 +15,0 @@ return doStartLogs(configuration, errorObservable, internalMonitoring, session, errorLogger, getGlobalContext);

{
"name": "@datadog/browser-logs",
"version": "2.17.0",
"version": "2.18.0",
"license": "Apache-2.0",

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

"dependencies": {
"@datadog/browser-core": "2.17.0",
"@datadog/browser-core": "2.18.0",
"tslib": "^1.10.0"

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

},
"gitHead": "062e559cfe16288cf412ec73d365ee4e9d4c96ec"
"gitHead": "d05764270c7dda8dbf93c31592c48e3a1bc57cef"
}

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

DEFAULT_CONFIGURATION,
ErrorObservable,
ErrorSource,

@@ -59,3 +58,3 @@ noop,

let server: sinon.SinonFakeServer
let errorObservable: ErrorObservable
let errorObservable: Observable<RawError>
const session = {

@@ -62,0 +61,0 @@ getId: () => (sessionIsTracked ? SESSION_ID : undefined),

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

createErrorFilter,
ErrorObservable,
HttpRequest,

@@ -16,4 +15,6 @@ InternalMonitoring,

RelativeTime,
startAutomaticErrorCollection,
InitConfiguration,
trackNetworkError,
trackRuntimeError,
trackConsoleError,
} from '@datadog/browser-core'

@@ -42,6 +43,10 @@ import { Logger, LogsMessage, StatusType } from '../domain/logger'

const { configuration, internalMonitoring } = commonInit(initConfiguration, buildEnv)
const errorObservable =
initConfiguration.forwardErrorsToLogs !== false
? startAutomaticErrorCollection(configuration)
: new Observable<RawError>()
const errorObservable = new Observable<RawError>()
if (initConfiguration.forwardErrorsToLogs !== false) {
trackConsoleError(errorObservable)
trackRuntimeError(errorObservable)
trackNetworkError(configuration, errorObservable, configuration.isEnabled('remove-network-errors'))
}
const session = startLoggerSession(configuration, areCookiesAuthorized(configuration.cookieOptions))

@@ -53,3 +58,3 @@ return doStartLogs(configuration, errorObservable, internalMonitoring, session, errorLogger, getGlobalContext)

configuration: Configuration,
errorObservable: ErrorObservable,
errorObservable: Observable<RawError>,
internalMonitoring: InternalMonitoring,

@@ -56,0 +61,0 @@ session: LoggerSession,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc