UNPKG

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