@elastic/apm-rum
Advanced tools
Comparing version 4.8.1 to 4.9.0
@@ -6,2 +6,18 @@ # Change Log | ||
# [4.9.0](https://github.com/elastic/apm-agent-rum-js/compare/@elastic/apm-rum@4.8.1...@elastic/apm-rum@4.9.0) (2020-03-03) | ||
### Bug Fixes | ||
* **rum-core:** export browser responsiveness interval correctly ([#658](https://github.com/elastic/apm-agent-rum-js/issues/658)) ([2ecf060](https://github.com/elastic/apm-agent-rum-js/commit/2ecf060a35dd1b64110149edc5bbdd4a4613caa9)) | ||
### Features | ||
* **rum-core:** use global promise when available and fallback ([#629](https://github.com/elastic/apm-agent-rum-js/issues/629)) ([65f08e0](https://github.com/elastic/apm-agent-rum-js/commit/65f08e06d2819a5ba76f476d9a4bc1dfd7fe788b)) | ||
## [4.8.1](https://github.com/elastic/apm-agent-rum-js/compare/@elastic/apm-rum@4.8.0...@elastic/apm-rum@4.8.1) (2020-02-14) | ||
@@ -8,0 +24,0 @@ |
@@ -1,3 +0,2 @@ | ||
/*! For license information please see elastic-apm-rum.umd.min.js.LICENSE */ | ||
!function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=5)}([function(t,e,n){var r;r=function(){"use strict";function t(t){return"function"==typeof t}var e=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},n=0,r=void 0,i=void 0,o=function(t,e){v[n]=t,v[n+1]=e,2===(n+=2)&&(i?i(h):y())},a="undefined"!=typeof window?window:void 0,s=a||{},c=s.MutationObserver||s.WebKitMutationObserver,u="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),f="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function d(){var t=setTimeout;return function(){return t(h,1)}}var v=new Array(1e3);function h(){for(var t=0;t<n;t+=2)(0,v[t])(v[t+1]),v[t]=void 0,v[t+1]=void 0;n=0}var l,p,g,m,y=void 0;function _(t,e){var n=this,r=new this.constructor(T);void 0===r[b]&&R(r);var i=n._state;if(i){var a=arguments[i-1];o((function(){return j(i,r,a,n._result)}))}else N(n,r,t,e);return r}function S(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var e=new this(T);return L(e,t),e}u?y=function(){return process.nextTick(h)}:c?(p=0,g=new c(h),m=document.createTextNode(""),g.observe(m,{characterData:!0}),y=function(){m.data=p=++p%2}):f?((l=new MessageChannel).port1.onmessage=h,y=function(){return l.port2.postMessage(0)}):y=void 0===a?function(){try{var t=Function("return this")().require("vertx");return void 0!==(r=t.runOnLoop||t.runOnContext)?function(){r(h)}:d()}catch(t){return d()}}():d();var b=Math.random().toString(36).substring(2);function T(){}var w=void 0,E=1,C=2;function x(e,n,r){n.constructor===e.constructor&&r===_&&n.constructor.resolve===S?function(t,e){e._state===E?O(t,e._result):e._state===C?I(t,e._result):N(e,void 0,(function(e){return L(t,e)}),(function(e){return I(t,e)}))}(e,n):void 0===r?O(e,n):t(r)?function(t,e,n){o((function(t){var r=!1,i=function(t,e,n,r){try{t.call(e,n,r)}catch(t){return t}}(n,e,(function(n){r||(r=!0,e!==n?L(t,n):O(t,n))}),(function(e){r||(r=!0,I(t,e))}),t._label);!r&&i&&(r=!0,I(t,i))}),t)}(e,n,r):O(e,n)}function L(t,e){if(t===e)I(t,new TypeError("You cannot resolve a promise with itself"));else if(i=typeof(r=e),null===r||"object"!==i&&"function"!==i)O(t,e);else{var n=void 0;try{n=e.then}catch(e){return void I(t,e)}x(t,e,n)}var r,i}function k(t){t._onerror&&t._onerror(t._result),A(t)}function O(t,e){t._state===w&&(t._result=e,t._state=E,0!==t._subscribers.length&&o(A,t))}function I(t,e){t._state===w&&(t._state=C,t._result=e,o(k,t))}function N(t,e,n,r){var i=t._subscribers,a=i.length;t._onerror=null,i[a]=e,i[a+E]=n,i[a+C]=r,0===a&&t._state&&o(A,t)}function A(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r=void 0,i=void 0,o=t._result,a=0;a<e.length;a+=3)r=e[a],i=e[a+n],r?j(n,r,i,o):i(o);t._subscribers.length=0}}function j(e,n,r,i){var o=t(r),a=void 0,s=void 0,c=!0;if(o){try{a=r(i)}catch(t){c=!1,s=t}if(n===a)return void I(n,new TypeError("A promises callback cannot return that same promise."))}else a=i;n._state!==w||(o&&c?L(n,a):!1===c?I(n,s):e===E?O(n,a):e===C&&I(n,a))}var F=0;function R(t){t[b]=F++,t._state=void 0,t._result=void 0,t._subscribers=[]}var M=function(){function t(t,n){this._instanceConstructor=t,this.promise=new t(T),this.promise[b]||R(this.promise),e(n)?(this.length=n.length,this._remaining=n.length,this._result=new Array(this.length),0===this.length?O(this.promise,this._result):(this.length=this.length||0,this._enumerate(n),0===this._remaining&&O(this.promise,this._result))):I(this.promise,new Error("Array Methods must be provided an Array"))}return t.prototype._enumerate=function(t){for(var e=0;this._state===w&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===S){var i=void 0,o=void 0,a=!1;try{i=t.then}catch(t){a=!0,o=t}if(i===_&&t._state!==w)this._settledAt(t._state,e,t._result);else if("function"!=typeof i)this._remaining--,this._result[e]=t;else if(n===P){var s=new n(T);a?I(s,o):x(s,t,i),this._willSettleAt(s,e)}else this._willSettleAt(new n((function(e){return e(t)})),e)}else this._willSettleAt(r(t),e)},t.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===w&&(this._remaining--,t===C?I(r,n):this._result[e]=n),0===this._remaining&&O(r,this._result)},t.prototype._willSettleAt=function(t,e){var n=this;N(t,void 0,(function(t){return n._settledAt(E,e,t)}),(function(t){return n._settledAt(C,e,t)}))},t}(),P=function(){function e(t){this[b]=F++,this._result=this._state=void 0,this._subscribers=[],T!==t&&("function"!=typeof t&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof e?function(t,e){try{e((function(e){L(t,e)}),(function(e){I(t,e)}))}catch(e){I(t,e)}}(this,t):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return e.prototype.catch=function(t){return this.then(null,t)},e.prototype.finally=function(e){var n=this.constructor;return t(e)?this.then((function(t){return n.resolve(e()).then((function(){return t}))}),(function(t){return n.resolve(e()).then((function(){throw t}))})):this.then(e,e)},e}();return P.prototype.then=_,P.all=function(t){return new M(this,t).promise},P.race=function(t){var n=this;return e(t)?new n((function(e,r){for(var i=t.length,o=0;o<i;o++)n.resolve(t[o]).then(e,r)})):new n((function(t,e){return e(new TypeError("You must pass an array to race."))}))},P.resolve=S,P.reject=function(t){var e=new this(T);return I(e,t),e},P._setScheduler=function(t){i=t},P._setAsap=function(t){o=t},P._asap=o,P.polyfill=function(){var t=void 0;if("undefined"!=typeof global)t=global;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var n=null;try{n=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===n&&!e.cast)return}t.Promise=P},P.Promise=P,P},t.exports=r()},function(t,e){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);t.exports=function(){return n(r),r}}else{var i=new Array(16);t.exports=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),i[e]=t>>>((3&e)<<3)&255;return i}}},function(t,e,n){var r,i,o;!function(a,s){"use strict";i=[n(4)],void 0===(o="function"==typeof(r=function(t){var e=/(^|@)\S+\:\d+/,n=/^\s*at .*(\S+\:\d+|\(native\))/m,r=/^(eval@)?(\[native code\])?$/;function i(t,e,n){if("function"==typeof Array.prototype.map)return t.map(e,n);for(var r=new Array(t.length),i=0;i<t.length;i++)r[i]=e.call(n,t[i]);return r}function o(t,e,n){if("function"==typeof Array.prototype.filter)return t.filter(e,n);for(var r=[],i=0;i<t.length;i++)e.call(n,t[i])&&r.push(t[i]);return r}return{parse:function(t){if(void 0!==t.stacktrace||void 0!==t["opera#sourceloc"])return this.parseOpera(t);if(t.stack&&t.stack.match(n))return this.parseV8OrIE(t);if(t.stack)return this.parseFFOrSafari(t);throw new Error("Cannot parse given Error object")},extractLocation:function(t){if(-1===t.indexOf(":"))return[t];var e=/(.+?)(?:\:(\d+))?(?:\:(\d+))?$/.exec(t.replace(/[\(\)]/g,""));return[e[1],e[2]||void 0,e[3]||void 0]},parseV8OrIE:function(e){return i(o(e.stack.split("\n"),(function(t){return!!t.match(n)}),this),(function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^\()]*)|(\)\,.*$)/g,""));var n=e.replace(/^\s+/,"").replace(/\(eval code/g,"(").split(/\s+/).slice(1),r=this.extractLocation(n.pop()),i=n.join(" ")||void 0,o=function(t,e){if("function"==typeof Array.prototype.indexOf)return t.indexOf(e);for(var n=0;n<t.length;n++)if(t[n]===e)return n;return-1}(["eval","<anonymous>"],r[0])>-1?void 0:r[0];return new t(i,void 0,o,r[1],r[2],e)}),this)},parseFFOrSafari:function(e){return i(o(e.stack.split("\n"),(function(t){return!t.match(r)}),this),(function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new t(e);var n=e.split("@"),r=this.extractLocation(n.pop()),i=n.join("@")||void 0;return new t(i,void 0,r[0],r[1],r[2],e)}),this)},parseOpera:function(t){return!t.stacktrace||t.message.indexOf("\n")>-1&&t.message.split("\n").length>t.stacktrace.split("\n").length?this.parseOpera9(t):t.stack?this.parseOpera11(t):this.parseOpera10(t)},parseOpera9:function(e){for(var n=/Line (\d+).*script (?:in )?(\S+)/i,r=e.message.split("\n"),i=[],o=2,a=r.length;o<a;o+=2){var s=n.exec(r[o]);s&&i.push(new t(void 0,void 0,s[2],s[1],void 0,r[o]))}return i},parseOpera10:function(e){for(var n=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=e.stacktrace.split("\n"),i=[],o=0,a=r.length;o<a;o+=2){var s=n.exec(r[o]);s&&i.push(new t(s[3]||void 0,void 0,s[2],s[1],void 0,r[o]))}return i},parseOpera11:function(n){return i(o(n.stack.split("\n"),(function(t){return!!t.match(e)&&!t.match(/^Error created at/)}),this),(function(e){var n,r=e.split("@"),i=this.extractLocation(r.pop()),o=r.shift()||"",a=o.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^\)]*\)/g,"")||void 0;o.match(/\(([^\)]*)\)/)&&(n=o.replace(/^[^\(]+\(([^\)]*)\)$/,"$1"));var s=void 0===n||"[arguments not available]"===n?void 0:n.split(",");return new t(a,s,i[0],i[1],i[2],e)}),this)}}})?r.apply(e,i):r)||(t.exports=o)}()},,function(t,e,n){var r,i,o;!function(n,a){"use strict";i=[],void 0===(o="function"==typeof(r=function(){function t(t){return!isNaN(parseFloat(t))&&isFinite(t)}function e(t,e,n,r,i,o){void 0!==t&&this.setFunctionName(t),void 0!==e&&this.setArgs(e),void 0!==n&&this.setFileName(n),void 0!==r&&this.setLineNumber(r),void 0!==i&&this.setColumnNumber(i),void 0!==o&&this.setSource(o)}return e.prototype={getFunctionName:function(){return this.functionName},setFunctionName:function(t){this.functionName=String(t)},getArgs:function(){return this.args},setArgs:function(t){if("[object Array]"!==Object.prototype.toString.call(t))throw new TypeError("Args must be an Array");this.args=t},getFileName:function(){return this.fileName},setFileName:function(t){this.fileName=String(t)},getLineNumber:function(){return this.lineNumber},setLineNumber:function(e){if(!t(e))throw new TypeError("Line Number must be a Number");this.lineNumber=Number(e)},getColumnNumber:function(){return this.columnNumber},setColumnNumber:function(e){if(!t(e))throw new TypeError("Column Number must be a Number");this.columnNumber=Number(e)},getSource:function(){return this.source},setSource:function(t){this.source=String(t)},toString:function(){return(this.getFunctionName()||"{anonymous}")+("("+(this.getArgs()||[]).join(",")+")")+(this.getFileName()?"@"+this.getFileName():"")+(t(this.getLineNumber())?":"+this.getLineNumber():"")+(t(this.getColumnNumber())?":"+this.getColumnNumber():"")}},e})?r.apply(e,i):r)||(t.exports=o)}()},function(t,e,n){"use strict";n.r(e);var r=n(1),i=n.n(r),o=n(0),a=[].slice,s=window.performance;for(var c=[],u=0;u<256;++u)c[u]=(u+256).toString(16).substr(1);function f(t,e){var n=!1;return"string"==typeof e?n=t===e:Array.isArray(e)&&e.forEach((function(e){n||(n=f(t,e))})),n}function d(t){var e,n,r,o;return(e=i()(),r=n||0,[(o=c)[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]]].join("")).substr(0,t)}function v(){return"undefined"!=typeof window&&"function"==typeof Array.prototype.forEach&&"function"==typeof JSON.stringify&&"function"==typeof Function.bind&&s&&"function"==typeof s.now&&"withCredentials"in new window.XMLHttpRequest}function h(t,e,n){if(n&&t){var r=w(t);return e&&(e=String(e)),n[r]=e,n}}function l(){return{page:{referer:document.referrer,url:window.location.href}}}function p(t){return t&&t.split("?")[0]}function g(t){return null!==t&&"object"==typeof t}function m(t,e,n){for(var r=0,i=e.length;r<i;++r){var o=e[r];if(g(o)||"function"==typeof o)for(var a=Object.keys(o),s=0,c=a.length;s<c;s++){var u=a[s],f=o[u];n&&g(f)?(g(t[u])||(t[u]=Array.isArray(f)?[]:{}),m(t[u],[f],!1)):t[u]=f}}return t}function y(){if("undefined"!=typeof document){var t=document.currentScript;return t||function(){if("undefined"!=typeof document)for(var t=document.getElementsByTagName("script"),e=0,n=t.length;e<n;e++){var r=t[e];if(r.src.indexOf("elastic")>0)return r}}()}}function _(t){return m(t,a.call(arguments,1),!1)}function S(t){return m(t,a.call(arguments,1),!0)}function b(t){return void 0===t}function T(){}function w(t){return t.replace(/[.*"]/g,"_")}function E(){return s.now()}function C(t){return"number"==typeof t&&t>=0?t:E()}function x(t,e){return b(e)||b(t)?null:parseFloat(e-t)}function L(t){o.Promise.resolve().then(t)}function k(){return"function"==typeof s.getEntriesByType}var O={fetchInProgress:!1};function I(t){return"__apm_symbol__"+t}function N(t,e,n){for(var r=t;r&&!r.hasOwnProperty(e);)r=Object.getPrototypeOf(r);!r&&t[e]&&(r=t);var i,o,a,s,c=I(e);if(r&&!(i=r[c])){i=r[c]=r[e];var u=r&&Object.getOwnPropertyDescriptor(r,e);if(!(s=u)||!1!==s.writable&&("function"!=typeof s.get||void 0!==s.set)){var f=n(i,c,e);r[e]=function(){return f(this,arguments)},o=r[e],a=i,o[I("OriginalDelegate")]=a}}return i}var A=I("xhrIgnore"),j=I("xhrSync"),F=I("xhrURL"),R=I("xhrMethod"),M="schedule",P="invoke",q="clear",D="addEventListener",H="removeEventListener",B=["link","css","script","img","xmlhttprequest","fetch","beacon","iframe"],Q=3e5,z="page-load",U="custom",$="Unknown",V=[z,"route-change","user-interaction","http-request",U,"temporary"],X=60,J="xmlhttprequest",Y="fetch",Z="history",G="eventtarget",K="error",W="longtask",tt="paint",et="measure",nt="navigation",rt="resource",it="first-contentful-paint",ot="largest-contentful-paint",at=1024,st=I("xhrTask"),ct=I("xhrListener"),ut=I("xhrScheduled");function ft(t){var e=XMLHttpRequest.prototype,n=e[D],r=e[H];if(!n){var i=window.XMLHttpRequestEventTarget;if(i){var o=i.prototype;n=o[D],r=o[H]}}var a="readystatechange",s="load";function c(e){e.state=P,t(P,e)}function u(e){XMLHttpRequest[ut]=!1,e.state=M,t(M,e);var i=e.data,o=i.aborted,u=i.target;n||(n=u[D],r=u[H]);var f,d=u[ct];d&&(r.call(u,a,d),r.call(u,s,d));var v=u[ct]=function(t){var n=t.type;f?f!=n&&function(t){setTimeout(t,0)}((function(){e.state!==P&&c(e)})):u.readyState===u.DONE&&!o&&XMLHttpRequest[ut]&&e.state===M&&(f=n)};n.call(u,a,v),n.call(u,s,v),u[st]||(u[st]=e)}var f=N(e,"open",(function(){return function(t,e){return t[A]||(t[R]=e[0],t[F]=e[1],t[j]=!1===e[2]),f.apply(t,e)}})),d=N(e,"send",(function(){return function(t,e){if(t[A])return d.apply(t,e);var n={source:J,state:"",type:"macroTask",data:{target:t,method:t[R],sync:t[j],url:t[F],aborted:!1}};u(n);var r=d.apply(t,e);return XMLHttpRequest[ut]=!0,t[j]&&c(n),r}})),v=N(e,"abort",(function(){return function(e,n){if(!e[A]){var r=e[st];if(r&&"string"==typeof r.type){if(r.data&&r.data.aborted)return;!function(e){e.state=q,t(q,e),e.data.aborted=!0}(r)}}return v.apply(e,n)}}))}for(var dt=["click"],vt={},ht=0;ht<dt.length;ht++){var lt=dt[ht];vt[lt]=I(lt)}function pt(t,e,n){return t instanceof Element&&dt.indexOf(e)>=0&&"function"==typeof n}var gt=function(){function t(){this.observers={}}var e=t.prototype;return e.observe=function(t,e){var n=this;if("function"==typeof e)return this.observers[t]||(this.observers[t]=[]),this.observers[t].push(e),function(){var r=n.observers[t].indexOf(e);r>-1&&n.observers[t].splice(r,1)}},e.sendOnly=function(t,e){var n=this.observers[t];n&&n.forEach((function(t){try{t.apply(void 0,e)}catch(t){console.log(t,t.stack)}}))},e.send=function(t,e){this.sendOnly(t+":before",e),this.sendOnly(t,e),this.sendOnly(t+":after",e)},t}(),mt=new gt,yt=!1;function _t(){return yt||(yt=!0,ft((function(t,e){mt.send(J,[t,e])})),function(t){if(window.fetch&&window.Request){var e=window.fetch;window.fetch=function(t,i){var a,s,c=this,u=arguments;if("string"==typeof t)a=new Request(t,i),s=t;else{if(!t)return e.apply(c,u);s=(a=t).url}var f={source:Y,state:"",type:"macroTask",data:{target:a,method:a.method,sync:!1,url:s,aborted:!1}};return new o.Promise((function(t,i){var o;O.fetchInProgress=!0,n(f);try{o=e.apply(c,[a])}catch(t){return i(t),f.data.error=t,r(f),void(O.fetchInProgress=!1)}o.then((function(e){t(e),L((function(){f.data.response=e,r(f)}))}),(function(t){i(t),L((function(){f.data.error=t,r(f)}))})),O.fetchInProgress=!1}))}}function n(e){e.state=M,t(M,e)}function r(e){e.state=P,t(P,e)}}((function(t,e){mt.send(Y,[t,e])})),function(t){if(window.history){var e=history.pushState;"function"==typeof e&&(history.pushState=function(n,r,i){var o={source:Z,data:{state:n,title:r,url:i}};t(P,o),e.apply(this,arguments)})}}((function(t,e){mt.send(Z,[t,e])})),function(t){if(window.EventTarget){var e=window.EventTarget.prototype,n=e[D],r=e[H];e[D]=function(t,e,r){var i=this;if(!pt(i,t,e))return n.apply(i,arguments);var o=a(i,t,e,r),s=Array.prototype.slice.call(arguments);return s[1]=o,n.apply(i,s)},e[H]=function(t,e,n){var i=this;if(!pt(i,t,e))return r.apply(i,arguments);var o=s(i,t,e,n),a=Array.prototype.slice.call(arguments);return a[1]=o,r.apply(i,a)}}function i(t,e,n,r){for(var i=0;i<t.length;i++){var o=t[i];if(o.eventType===e&&o.listenerFn===n&&o.capture===r)return i}return-1}function o(t){return"boolean"==typeof t?t:!!t&&!!t.capture}function a(e,n,r,a){var s=vt[n];if(!s)return r;var c=e[s],u=o(a);if(c){var f=i(c,n,r,u);if(-1!==f)return c[f].wrappingFn}else c=e[s]=[];var d={source:G,target:e,eventType:n,listenerFn:r,capture:u,wrappingFn:v};function v(){var e;t(M,d);try{e=r.apply(this,arguments)}finally{t(P,d)}return e}return c.push(d),v}function s(t,e,n,r){var a=vt[e],s=t[a];if(s){var c=i(s,e,n,o(r));if(-1!==c){var u=s[c];return s.splice(c,1),0===s.length&&(t[a]=void 0),u.wrappingFn}}return n}}((function(t,e){mt.send(G,[t,e])}))),mt}var St=!1,bt=!1;var Tt=n(2),wt=n.n(Tt);function Et(t){var e=t.error,n=t.filename,r=t.lineno,i=t.colno,o=[];if(e)try{o=wt.a.parse(e)}catch(t){}return 0===o.length&&(o=[{fileName:n,lineNumber:r,columnNumber:i}]),o.map((function(t){return t.functionName&&(t.functionName=(e=t.functionName,n=e.split("/"),e=(e=(e=n.length>1?["Object",n[n.length-1]].join("."):n[0]).replace(/.<$/gi,".<anonymous>")).replace(/^Anonymous function$/,"<anonymous>"),e=(n=e.split(".")).length>1?n[n.length-1]:n[0])),t;var e,n})).map((function(t){var e=t.fileName,n=t.lineNumber,r=t.columnNumber,i=t.functionName,o=void 0===i?"<anonymous>":i;if(!e&&!n)return{};if(!r&&!n)return{};var a,s,c=function(t){return void 0===t&&(t=""),"<anonymous>"===t&&(t=""),t}(e),u=(a=c,s=window.location.origin||window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:""),a.indexOf(s)>-1&&(a=a.replace(s+"/","")),a);return function(t){return!!t&&0===window.location.href.indexOf(t)}(c)&&(u="(inline script)"),{abs_path:e,filename:u,function:o,lineno:n,colno:r}}))}var Ct={service:{name:[at,!0],version:!0,agent:{version:[at,!0]},environment:!0}},xt={"*":!0,headers:{"*":!0}},Lt={user:{id:!0,email:!0,username:!0},tags:{"*":!0},http:{response:xt},destination:{address:[at],service:{"*":[at,!0]}},response:xt},kt={name:[at,!0],type:[at,!0],id:[at,!0],trace_id:[at,!0],parent_id:[at,!0],transaction_id:[at,!0],subtype:!0,action:!0,context:Lt},Ot={name:!0,parent_id:!0,type:[at,!0],id:[at,!0],trace_id:[at,!0],span_count:{started:[at,!0]},context:Lt},It={id:[at,!0],trace_id:!0,transaction_id:!0,parent_id:!0,culprit:!0,exception:{type:!0},transaction:{type:!0},context:Lt};function Nt(t){return null==t||""===t||void 0===t}function At(t,e,n){var r=function(t,e,n,r){return void 0===e&&(e=at),void 0===n&&(n=!1),void 0===r&&(r="N/A"),n&&Nt(t)&&(t=r),"string"==typeof t?t.substring(0,e):t}(t[e],n[0],n[1]);Nt(r)?delete t[e]:t[e]=r}function jt(t,e,n){void 0===t&&(t={}),void 0===n&&(n=e);for(var r=Object.keys(t),i=[],o=function(o){var a=r[o],s=!0===t[a]?i:t[a];Array.isArray(s)?"*"===a?Object.keys(n).forEach((function(t){return At(n,t,s)})):At(n,a,s):jt(s,e,n[a])},a=0;a<r.length;a++)o(a);return e}var Ft=["stack","message"];var Rt=function(){function t(t,e,n){this._apmServer=t,this._configService=e,this._transactionService=n}var e=t.prototype;return e.createErrorDataModel=function(t){var e=function(t){return t.filter((function(t){var e=t.filename,n=t.lineno;return void 0!==e&&void 0!==n}))}(Et(t)),n="(inline script)",r=e[e.length-1];r&&r.filename&&(n=r.filename);var i=t.message,o=t.error,a=i,s="",c={};if(o&&"object"==typeof o){a=a||o.message,s=o.name;var u=function(t){var e=!1,n={};if(Object.keys(t).forEach((function(r){if(!(Ft.indexOf(r)>=0)){var i=t[r];if(null!=i&&"function"!=typeof i){if("object"==typeof i){if("function"!=typeof i.toISOString)return;i=i.toISOString()}n[r]=i,e=!0}}})),e)return n}(o);u&&(c.custom=u)}s||a&&a.indexOf(":")>-1&&(s=a.split(":")[0]);var f=this._transactionService.getCurrentTransaction(),v=f?f.context:{},h=this._configService.get("context"),p=S({},l(),v,h,c),g={id:d(),culprit:n,exception:{message:a,stacktrace:e,type:s},context:p};return f&&(g=_(g,{trace_id:f.traceId,parent_id:f.id,transaction_id:f.id,transaction:{type:f.type,sampled:f.sampled}})),jt(It,g)},e.logErrorEvent=function(t,e){if(void 0!==t){var n=this.createErrorDataModel(t);if(void 0!==n.exception.message)return e?this._apmServer.sendErrors([n]):this._apmServer.addError(n)}},e.registerListeners=function(){var t=this;window.addEventListener("error",(function(e){return t.logErrorEvent(e)})),window.addEventListener("unhandledrejection",(function(e){return t.logPromiseEvent(e)}))},e.logPromiseEvent=function(t){var e="Unhandled promise rejection: ",n=t.reason;null==n?this.logError(e+"<no reason specified>"):"string"==typeof n.message?this.logError({message:e+n.message,stack:n.stack?n.stack:null}):"object"!=typeof n&&this.logError(e+n)},e.logError=function(t){var e={};return"string"==typeof t?e.message=t:e.error=t,this.logErrorEvent(e)},t}(),Mt={ErrorLogging:Rt,registerServices:function(t){t.registerServiceCreator("ErrorLogging",(function(){var e=t.getService("ApmServer"),n=t.getService("ConfigService"),r=t.getService("TransactionService");return new Rt(e,n,r)}))}};var Pt=[["#","hash"],["?","query"],["/","path"],["@","auth",1],[NaN,"host",void 0,1]],qt=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,Dt=function(){function t(t){var e,n=this.extractProtocol(t||""),r=n.protocol,i=n.address,o=n.slashes,a=!r&&!o,s=this.getLocation(),c=Pt.slice();i=i.replace("\\","/"),o||(c[2]=[NaN,"path"]);for(var u=0;u<c.length;u++){var f=c[u],d=f[0],v=f[1];if("string"==typeof d){if(~(e=i.indexOf(d))){var h=f[2];if(h){var l=i.lastIndexOf(d);e=Math.max(e,l),this[v]=i.slice(0,e),i=i.slice(e+h)}else this[v]=i.slice(e),i=i.slice(0,e)}}else this[v]=i,i="";this[v]=this[v]||a&&f[3]&&s[v]||"",f[3]&&(this[v]=this[v].toLowerCase())}if(a&&"/"!==this.path.charAt(0)&&(this.path="/"+this.path),this.relative=a,this.protocol=r||s.protocol,this.hostname=this.host,this.port="",/:\d+$/.test(this.host)){var p=this.host.split(":"),g=p.pop(),m=p.join(":");!function(t,e){switch(e){case"http:":return"80"===t;case"https:":return"443"===t}return!0}(g,this.protocol)?this.port=g:this.host=m,this.hostname=m}this.origin=this.protocol&&this.host&&"file:"!==this.protocol?this.protocol+"//"+this.host:"null",this.href=this.toString()}var e=t.prototype;return e.toString=function(){var t=this.protocol;if(t+="//",this.auth){var e=this.auth.split(":");t+=(e[0]?"[REDACTED]":"")+(e[1]?":[REDACTED]":"")+"@"}return t+=this.host,t+=this.path,t+=this.query,t+=this.hash},e.getLocation=function(){var t={};return"undefined"!=typeof window&&(t=window),t.location},e.extractProtocol=function(t){var e=qt.exec(t);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!e[2],address:e[3]}},t}(),Ht=function(){function t(t,e,n,r){this._apmServer=t,this._configService=e,this._logginService=n,this._transactionService=r}var e=t.prototype;return e.init=function(t){var e=this;void 0===t&&(t={}),this._configService.events.observe("transaction:end:after",(function(t){var n=e.createTransactionPayload(t);n&&e._apmServer.addTransaction(n)})),t[Z]&&mt.observe(Z,this.getHistorySub()),t[J]&&mt.observe(J,this.getXHRSub()),t[Y]&&mt.observe(Y,this.getFetchSub()),t[G]&&mt.observe(G,this.getEventTargetSub())},e.getEventTargetSub=function(){var t=this._transactionService;return function(e,n){if(e===M&&n.source===G&&"click"===n.eventType){var r=n.target,i=r.getAttribute("name"),o="";i&&(o='["'+i+'"]');var a=r.tagName.toLowerCase(),s=t.startTransaction("Click >> "+a+o,"user-interaction",{managed:!0,canReuse:!0,reuseThreshold:100});if(s){var c=r.getAttribute("class");c&&s.addContext({custom:{classes:c}})}}}},e.getHistorySub=function(){var t=this._transactionService;return function(e,n){n.source===Z&&e===P&&t.startTransaction(n.data.title,"route-change",{managed:!0,canReuse:!0})}},e.getXHRSub=function(){var t=this;return function(e,n){n.source!==J||O.fetchInProgress||t.processAPICalls(e,n)}},e.getFetchSub=function(){var t=this;return function(e,n){n.source===Y&&t.processAPICalls(e,n)}},e.processAPICalls=function(t,e){var n=this._configService,r=this._transactionService;if(t===M&&e.data){var i=e.data,o=new Dt(i.url),a=i.method+" "+(o.relative?o.path:p(o.href));r.getCurrentTransaction()||r.startTransaction(a,"http-request",{managed:!0});var s=r.startSpan(a,"external.http"),c=r.addTask();if(!s)return;var u=n.get("distributedTracing"),d=n.get("distributedTracingOrigins"),v=new Dt(window.location.href),h=f(o.origin,v.origin)||f(o.origin,d),l=i.target;u&&h&&l&&this.injectDtHeader(s,l),s.sync=i.sync,i.span=s,e.id=c}else t===P&&(e.data&&e.data.span&&e.data.span.end(null,e.data),e.id&&r.removeTask(e.id))},e.injectDtHeader=function(t,e){var n,r=this._configService.get("distributedTracingHeaderName"),i=function(t){if(t&&t.traceId&&t.id&&t.parentId){var e=t.sampled?"01":"00",n=t.sampled?t.id:t.parentId;return"00-"+t.traceId+"-"+n+"-"+e}}(t),o=/^[\da-f]{2}-[\da-f]{32}-[\da-f]{16}-[\da-f]{2}$/.test(n=i)&&"00000000000000000000000000000000"!==n.slice(3,35)&&"0000000000000000"!==n.slice(36,52);r&&i&&o&&("function"==typeof e.setRequestHeader?e.setRequestHeader(r,i):e.headers&&"function"==typeof e.headers.append?e.headers.append(r,i):e[r]=i)},e.extractDtHeader=function(t){var e=this._configService.get("distributedTracingHeaderName");if(t)return function(t){var e=/^([\da-f]{2})-([\da-f]{32})-([\da-f]{16})-([\da-f]{2})$/.exec(t);if(e){var n="00"!==e[4];return{traceId:e[2],id:e[3],sampled:n}}}(t[e])},e.filterTransaction=function(t){var e=this._configService.get("transactionDurationThreshold"),n=t.duration();if(!n)return!1;if(n>e)return!1;if(t.options.managed&&0===t.spans.length)return!1;if((t.sampled||t.resetSpans(),t.options.checkBrowserResponsiveness)&&!this.checkBrowserResponsiveness(t,500,3))return!1;return!0},e.prepareTransaction=function(t){t.spans.sort((function(t,e){return t._start-e._start})),this._configService.get("groupSimilarSpans")&&(t.spans=this.groupSmallContinuouslySimilarSpans(t,.05)),t.spans=t.spans.filter((function(e){return e.duration()>0&&e._start>=t._start&&e._end<=t._end}))},e.createTransactionDataModel=function(t){var e=t._start,n=t.spans.map((function(n){var r={id:n.id,transaction_id:t.id,parent_id:n.parentId||t.id,trace_id:t.traceId,name:n.name,type:n.type,subType:n.subType,action:n.action,sync:n.sync,start:n._start-e,duration:n.duration(),context:n.context};return jt(kt,r)})),r={id:t.id,trace_id:t.traceId,name:t.name,type:t.type,duration:t.duration(),spans:n,context:t.context,marks:t.marks,breakdown:t.breakdownTimings,span_count:{started:n.length},sampled:t.sampled};return jt(Ot,r)},e.createTransactionPayload=function(t){if(this.prepareTransaction(t),this.filterTransaction(t))return this.createTransactionDataModel(t)},e.convertTransactionsToServerModel=function(t){var e=this;return t.map((function(t){return e.createTransactionDataModel(t)}))},e.groupSmallContinuouslySimilarSpans=function(t,e){var n=t.duration(),r=[],i=1;return t.spans.forEach((function(o,a){if(0===r.length)r.push(o);else{var s=r[r.length-1],c=s.type===o.type&&s.subType===o.subType&&s.action===o.action&&s.name===o.name&&o.duration()/n<e&&(o._start-s._end)/n<e,u=t.spans.length===a+1;c&&(i++,s._end=o._end),i>1&&(!c||u)&&(s.name=i+"x "+s.name,i=1),c||r.push(o)}})),r},e.checkBrowserResponsiveness=function(t,e,n){var r=t.browserResponsivenessCounter,i=t.duration();return r+n>=Math.floor(i/e)},t}(),Bt=function(){function t(t,e,n){void 0===n&&(n={}),t||(t=$),e||(e=U),this.name=t,this.type=e,this.options=n,this.id=n.id||d(16),this.traceId=n.traceId,this.sampled=n.sampled,this.timestamp=n.timestamp,this._start=C(n.startTime),this._end=void 0,this.ended=!1,this.onEnd=n.onEnd}var e=t.prototype;return e.ensureContext=function(){this.context||(this.context={})},e.addTags=function(t){console.warn("addTags deprecated, please use addLabels"),this.addLabels(t)},e.addLabels=function(t){this.ensureContext();var e=this.context;e.tags||(e.tags={}),Object.keys(t).forEach((function(n){return h(n,t[n],e.tags)}))},e.addContext=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];0!==e.length&&(this.ensureContext(),S.apply(void 0,[this.context].concat(e)))},e.end=function(t){this.ended||(this.ended=!0,this._end=C(t),this.callOnEnd())},e.callOnEnd=function(){"function"==typeof this.onEnd&&this.onEnd(this)},e.duration=function(){return x(this._start,this._end)},t}(),Qt=91,zt=93,Ut="external",$t="resource";function Vt(t){var e={transfer_size:t.transferSize,encoded_body_size:t.encodedBodySize,decoded_body_size:t.decodedBodySize},n=function(t){void 0===t&&(t=[]);for(var e=[],n=0;n<t.length;n++){var r=t[n],i=r.name,o=r.duration,a=r.description,s=i;a&&(s+=";desc="+a),o&&(s+=";dur="+o),e.push(s)}return e.join(", ")}(t.serverTiming);return n&&(e.headers={"server-timing":n}),e}function Xt(t,e){var n=t.port,r=t.protocol,i=t.hostname,o=t.host,a=function(t,e){return""===t&&(t="http:"===e?"80":"https:"===e?"443":""),t}(n,r),s=i.charCodeAt(0)===Qt&&i.charCodeAt(i.length-1)===zt,c=i;return s&&(c=i.slice(1,-1)),{service:{name:r+"//"+o,resource:i+":"+a,type:e},address:c,port:Number(a)}}function Jt(t,e){if(e){var n;switch(t.type){case Ut:n=function(t){var e,n=t.url,r=t.method,i=t.target,o=t.response,a=new Dt(n),s=Xt(a,Ut),c={http:{method:r,url:a.href},destination:s};return i&&void 0!==i.status?e=i.status:o&&(e=o.status),c.http.status_code=e,c}(e);break;case $t:n=function(t){var e=t.entry,n=t.url,r=Xt(new Dt(n),$t);return{http:{url:n,response:Vt(e)},destination:r}}(e)}t.addContext(n)}}var Yt=function(t){var e,n;function r(e,n,r){var i;if((i=t.call(this,e,n,r)||this).parentId=i.options.parentId,i.subType=void 0,i.action=void 0,-1!==i.type.indexOf(".")){var o=i.type.split(".",3);i.type=o[0],i.subType=o[1],i.action=o[2]}return i.sync=i.options.sync,i}return n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n,r.prototype.end=function(e,n){t.prototype.end.call(this,e),Jt(this,n)},r}(Bt),Zt=[["domainLookupStart","domainLookupEnd","DNS"],["connectStart","connectEnd","TCP"],["requestStart","responseStart","Request"],["responseStart","responseEnd","Response"],["domLoading","domComplete","Processing"],["loadEventStart","loadEventEnd","Load"]];function Gt(t){return{value:t}}function Kt(t,e){var n=e.details,r=e.count,i=void 0===r?1:r,o=e.duration;return{transaction:t,span:n,samples:{"span.self_time.count":Gt(i),"span.self_time.sum.us":Gt(o)}}}var Wt=function(t){var e,n;function r(e,n,r){var i;return(i=t.call(this,e,n,r)||this).traceId=d(),i.marks=void 0,i.spans=[],i._activeSpans={},i.nextAutoTaskId=1,i._scheduledTasks=[],i.captureTimings=!1,i.breakdownTimings=[],i.sampled=Math.random()<=i.options.transactionSampleRate,i.browserResponsivenessCounter=0,i}n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n;var i=r.prototype;return i.addMarks=function(t){this.marks=S(this.marks||{},t)},i.mark=function(t){var e=w(t),n=E()-this._start,r={};r[e]=n,this.addMarks({custom:r})},i.canReuse=function(){var t=this.options.reuseThreshold||5e3;return!!this.options.canReuse&&!this.ended&&E()-this._start<t},i.redefine=function(t,e,n){t&&(this.name=t),e&&(this.type=e),n&&(this.options=_(this.options,n))},i.startSpan=function(t,e,n){var r=this;if(!this.ended){var i=_({},n);i.onEnd=function(t){r._onSpanEnd(t)},i.traceId=this.traceId,i.sampled=this.sampled,i.parentId||(i.parentId=this.id);var o=new Yt(t,e,i);return this._activeSpans[o.id]=o,o}},i.isFinished=function(){return 0===this._scheduledTasks.length},i.detectFinish=function(){this.isFinished()&&this.end()},i.end=function(t){if(!this.ended){for(var e in this.ended=!0,this._end=C(t),this._activeSpans){var n=this._activeSpans[e];n.type=n.type+".truncated",n.end(t)}this.callOnEnd()}},i.captureBreakdown=function(){this.breakdownTimings=function(t,e){void 0===e&&(e=s.timing);var n=[],r=t.duration(),i=t.name,o=t.type,a=t.sampled,c={name:i,type:o};if(n.push({transaction:c,samples:{"transaction.duration.count":Gt(1),"transaction.duration.sum.us":Gt(r),"transaction.breakdown.count":Gt(a?1:0)}}),!a)return n;if(o===z&&e)for(var u=0;u<Zt.length;u++){var f=Zt[u],d=x(e[f[0]],e[f[1]]);0!==d&&null!=d&&n.push(Kt(c,{details:{type:f[2]},duration:d}))}else{var v=function(t){var e={},n=function(t){var e=t.spans,n=t._start,r=t._end;if(0===e.length)return t.duration();e.sort((function(t,e){return t._start-e._start}));for(var i=e[0],o=i._end,a=i._start,s=o,c=a-n,u=1;u<e.length;u++)a=(i=e[u])._start,o=i._end,a>s?(c+=a-s,s=o):o>s&&(s=o);return s<r&&(c+=r-s),c}(t);e.app={count:1,duration:n};for(var r=t.spans,i=0;i<r.length;i++){var o=r[i],a=o.duration();if(0!==a&&null!=a){var s=o.type,c=o.subType,u=s;c&&(u+="."+c),e[u]||(e[u]={duration:0,count:0}),e[u].count++,e[u].duration+=a}}return e}(t);Object.keys(v).forEach((function(t){var e=t.split("."),r=e[0],i=e[1],o=v[t],a=o.duration,s=o.count;n.push(Kt(c,{details:{type:r,subtype:i},duration:a,count:s}))}))}return n}(this)},i.addTask=function(t){if(void 0===t&&(t="task"+this.nextAutoTaskId++),-1==this._scheduledTasks.indexOf(t))return this._scheduledTasks.push(t),t},i.removeTask=function(t){var e=this._scheduledTasks.indexOf(t);e>-1&&this._scheduledTasks.splice(e,1),this.detectFinish()},i.resetSpans=function(){this.spans=[]},i._onSpanEnd=function(t){this.spans.push(t),delete this._activeSpans[t.id]},r}(Bt);function te(t,e){var n=e.capturePaint,r={spans:function(t){for(var e=[],n=0;n<t.length;n++){var r=t[n],i=r.name,o=r.startTime,a=r.duration,s=r.attribution,c=o+a,u=new Yt("Longtask("+i+")",W,{startTime:o});if(s.length>0){var f=s[0],d=f.name,v=f.containerType,h=f.containerName,l=f.containerId,p={attribution:d,type:v};h&&(p.name=h),l&&(p.id=l),u.addContext({custom:p})}u.end(c),e.push(u)}return e}(t.getEntriesByType(W)),marks:{}};if(!n)return r;var i=t.getEntriesByType(ot),o=i[i.length-1];if(!o)return r;var a=o.renderTime||o.loadTime;return r.marks.largestContentfulPaint=a,r}var ee=function(){function t(t){this.po={observe:T,disconnect:T},window.PerformanceObserver&&(this.po=new PerformanceObserver(t))}var e=t.prototype;return e.start=function(t){try{var e=!0;t===W&&(e=!1),this.po.observe({type:t,buffered:e})}catch(t){}},e.stop=function(){this.po.disconnect()},t}(),ne=[["domainLookupStart","domainLookupEnd","Domain lookup"],["connectStart","connectEnd","Making a connection to the server"],["requestStart","responseEnd","Requesting and receiving the document"],["domLoading","domInteractive","Parsing the document, executing sync. scripts"],["domContentLoadedEventStart","domContentLoadedEventEnd",'Fire "DOMContentLoaded" event'],["loadEventStart","loadEventEnd",'Fire "load" event']];function re(t,e,n,r,i){return void 0===i&&(i=0),"number"==typeof t&&"number"==typeof e&&t>=i&&e>t&&t-i>=n&&e-i<=r&&e-t<Q&&t-i<Q&&e-i<Q}function ie(t){var e=t.name,n=t.initiatorType,r=t.startTime,i=t.responseEnd,o="resource";n&&(o+="."+n);var a=p(e),s=new Yt(a,o);return s._start=r,s.end(i,{url:e,entry:t}),s}var oe=["fetchStart","domainLookupStart","domainLookupEnd","connectStart","connectEnd","secureConnectionStart","requestStart","responseStart","responseEnd","domLoading","domInteractive","domContentLoadedEventStart","domContentLoadedEventEnd","domComplete","loadEventStart","loadEventEnd"];function ae(){var t=function(){var t=s.timing,e=t.fetchStart,n={};return oe.forEach((function(r){var i=t[r];i&&i>=e&&(n[r]=i-e)})),n}(),e={timeToFirstByte:t.responseStart,domInteractive:t.domInteractive,domComplete:t.domComplete},n=function(){var t;if(k()){var e=s.getEntriesByType(tt);if(e.length>0){var n=s.timing,r=n.fetchStart-n.navigationStart,i=e.filter((function(t){return t.name===it}))[0].startTime;t=r>=0?i-r:i}}return t}();return n&&(e.firstContentfulPaint=n),{navigationTiming:t,agent:e}}function se(t){if(t.captureTimings){var e=t._end;if(t.type===z){if(t.marks&&t.marks.custom){var n=t.marks.custom;Object.keys(n).forEach((function(e){n[e]+=t._start}))}t._start=0;var r=s.timing;(function(t,e,n,r){for(var i=[],o=0;o<ne.length;o++){var a=t[ne[o][0]],s=t[ne[o][1]];if(re(a,s,n,r,e)){var c=new Yt(ne[o][2],"hard-navigation.browser-timing");"requestStart"===ne[o][0]&&(c.pageResponse=!0),c._start=a-e,c.end(s-e),i.push(c)}}return i})(r,r.fetchStart,0,e).forEach((function(e){e.traceId=t.traceId,e.sampled=t.sampled,e.pageResponse&&t.options.pageLoadSpanId&&(e.id=t.options.pageLoadSpanId),t.spans.push(e)})),t.addMarks(ae())}if(k()){var i=t._start;(function(t,e,n,r){for(var i=[],o=0;o<t.length;o++){var a=t[o],s=a.initiatorType,c=a.name,u=a.startTime,f=a.responseEnd;if("xmlhttprequest"!==s&&"fetch"!==s&&c)if(-1!==B.indexOf(s)){if(!re(u,f,n,r))continue;i.push(ie(t[o]))}else{if(null!=s)continue;for(var d=!1,v=0;v<e.length;v++){var h=c.lastIndexOf(e[v]);if(h>-1&&h===c.length-e[v].length){d=!0;break}}!d&&re(u,f,n,r)&&i.push(ie(t[o]))}}return i})(s.getEntriesByType(rt),function(t){for(var e=t.spans,n=[],r=0;r<e.length;r++){var i=e[r];"external"===i.type&&"http"===i.subType||n.push(i.name.split(" ")[1])}return n}(t),i,e).forEach((function(e){return t.spans.push(e)})),function(t,e,n){for(var r=[],i=0;i<t.length;i++){var o=t[i],a=o.name,s=o.startTime,c=o.duration,u=s+c;if(!(c<=X)&&re(s,u,e,n)){var f=new Yt(a,"app");f._start=s,f.end(u),r.push(f)}}return r}(s.getEntriesByType(et),i,e).forEach((function(e){return t.spans.push(e)}))}}}var ce=function(){function t(t,e){var n=this;this._config=e,this._logger=t,this.currentTransaction=void 0,this.respIntervalId=void 0,this.recorder=new ee((function(t){var e=n.getCurrentTransaction();if(e&&e.captureTimings){var r,i=!1;e.type===z&&(i=!0);var o=te(t,{capturePaint:i}),a=o.spans,s=o.marks;(r=e.spans).push.apply(r,a),e.addMarks({agent:s})}}))}var e=t.prototype;return e.ensureCurrentTransaction=function(t,e,n){var r=this.getCurrentTransaction();return r||(r=new Wt(t,e,n),this.setCurrentTransaction(r),r)},e.getCurrentTransaction=function(){if(this.currentTransaction&&!this.currentTransaction.ended)return this.currentTransaction},e.setCurrentTransaction=function(t){this.currentTransaction=t},e.ensureRespInterval=function(t){var e=this,n=function(){clearInterval(e.respIntervalId),e.respIntervalId=void 0};t?void 0===this.respIntervalId&&(this.respIntervalId=setInterval((function(){var t=e.getCurrentTransaction();t?t.browserResponsivenessCounter++:n()}),500)):void 0!==this.respIntervalId&&n()},e.createOptions=function(t){var e=this._config.config,n=_({transactionSampleRate:e.transactionSampleRate},t);return n.managed&&(n=_({pageLoadTraceId:e.pageLoadTraceId,pageLoadSampled:e.pageLoadSampled,pageLoadSpanId:e.pageLoadSpanId,pageLoadTransactionName:e.pageLoadTransactionName,checkBrowserResponsiveness:e.checkBrowserResponsiveness},n)),n},e.startManagedTransaction=function(t,e,n){var r=this.getCurrentTransaction(),i=!1;if(r)if(r.canReuse()&&n.canReuse){var o;0;var a=V.indexOf(r.type),s=V.indexOf(e);-1!==a&&-1!==s&&s<a&&(o=e),r.redefine(t,o,n),i=!0}else r.end(),r=this.ensureCurrentTransaction(t,e,n);else r=this.ensureCurrentTransaction(t,e,n);return r.type===z&&(i||this.recorder.start(ot),r.options.checkBrowserResponsiveness=!1,n.pageLoadTraceId&&(r.traceId=n.pageLoadTraceId),n.pageLoadSampled&&(r.sampled=n.pageLoadSampled),r.name===$&&n.pageLoadTransactionName&&(r.name=n.pageLoadTransactionName)),!i&&this._config.get("monitorLongtasks")&&this.recorder.start(W),r.sampled&&(r.captureTimings=!0),this.ensureRespInterval(r.options.checkBrowserResponsiveness),r},e.startTransaction=function(t,e,n){var r,i=this,o=this.createOptions(n),a=!0;o.managed?this.currentTransaction===(r=this.startManagedTransaction(t,e,o))&&(a=!1):r=new Wt(t,e,o);return r.onEnd=function(){return i.handleTransactionEnd(r)},a&&this._config.events.send("transaction:start",[r]),r},e.handleTransactionEnd=function(t){var e=this;return this.recorder.stop(),o.Promise.resolve().then((function(){var n=t.name,r=t.type;if(!e.shouldIgnoreTransaction(n)&&"temporary"!==r){if(r===z){var i=e._config.get("pageLoadTransactionName");n===$&&i&&(t.name=i)}se(t),e.adjustTransactionTime(t),e._config.get("breakdownMetrics")&&t.captureBreakdown();var o=e._config.get("context");!function(t,e){var n=l(),r={};if(t.type===z&&k()){var i=s.getEntriesByType(nt);i&&i.length>0&&(r={response:Vt(i[0])})}t.addContext(n,r,e)}(t,o),e._config.events.send("transaction:end",[t])}}),(function(t){0}))},e.adjustTransactionTime=function(t){var e=t.spans,n=function(t){for(var e=t[0],n=1;n<t.length;n++){var r=t[n];e._start>r._start&&(e=r)}return e}(e);n&&n._start<t._start&&(t._start=n._start);var r=function(t){for(var e=null,n=0;n<t.length;n++){var r=t[n];-1===String(r.type).indexOf("external")&&(!e||e._end<r._end)&&(e=r)}return e}(e);r&&r._end>t._end&&(t._end=r._end);for(var i=t._end,o=0;o<e.length;o++){var a=e[o];a._end>i&&(a._end=i,a.type+=".truncated"),a._start>i&&(a._start=i)}},e.shouldIgnoreTransaction=function(t){var e=this._config.get("ignoreTransactions");if(e&&e.length)for(var n=0;n<e.length;n++){var r=e[n];if("function"==typeof r.test){if(r.test(t))return!0}else if(r===t)return!0}return!1},e.startSpan=function(t,e,n){var r=this.ensureCurrentTransaction(void 0,"temporary",this.createOptions({canReuse:!0,managed:!0}));if(r)return r.startSpan(t,e,n)},e.addTask=function(t){var e=this.ensureCurrentTransaction(void 0,"temporary",this.createOptions({canReuse:!0,managed:!0}));if(e){t=e.addTask(t);0}return t},e.removeTask=function(t){var e=this.getCurrentTransaction();e&&e.removeTask(t)},t}(),ue={PerformanceMonitoring:Ht,registerServices:function(t){t.registerServiceCreator("TransactionService",(function(){var e=t.getService("ConfigService"),n=t.getService("LoggingService");return new ce(n,e)})),t.registerServiceCreator("PerformanceMonitoring",(function(){var e=t.getService("ConfigService"),n=t.getService("LoggingService"),r=t.getService("ApmServer"),i=t.getService("TransactionService");return new Ht(r,e,n,i)}))}},fe=function(){function t(t,e){e||(e={}),this.onFlush=t,this.items=[],this.queueLimit=e.queueLimit||-1,this.flushInterval=e.flushInterval||0,this.timeoutId=void 0}var e=t.prototype;return e._setTimer=function(){var t=this;this.timeoutId=setTimeout((function(){t.flush()}),this.flushInterval)},e.flush=function(){this.onFlush(this.items),this._clear()},e._clear=function(){void 0!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=void 0),this.items=[]},e.add=function(t){this.items.push(t),-1!==this.queueLimit&&this.items.length>=this.queueLimit?this.flush():void 0===this.timeoutId&&this._setTimer()},t}();var de=function(t,e,n){var r,i=n.context||this,o=n.limit,a=n.interval,s=n.countFn||function(){},c=0;return function(){var n="function"==typeof s&&s.apply(i,arguments);return"number"!=typeof n&&(n=1),c+=n,void 0===r&&(r=setTimeout((function(){c=0,r=void 0}),a)),c>o?"function"==typeof e?e.apply(i,arguments):void 0:t.apply(i,arguments)}},ve=function(){function t(){}return t.stringify=function(t){return JSON.stringify(t)+"\n"},t}(),he=function(){function t(t,e){this._configService=t,this._loggingService=e,this.errorQueue=void 0,this.transactionQueue=void 0,this.throttleAddError=void 0,this.throttleAddTransaction=void 0,this.initialized=!1}var e=t.prototype;return e.init=function(){this.initialized||(this.initialized=!0,this.initErrorQueue(),this.initTransactionQueue())},e.createMetaData=function(){var t=this._configService,e={service:{name:t.get("serviceName"),version:t.get("serviceVersion"),agent:{name:"js-base",version:t.version},language:{name:"javascript"},environment:t.get("environment")},labels:t.get("context.tags")};return jt(Ct,e)},e._postJson=function(t,e){return this._makeHttpRequest("POST",t,{payload:e,headers:{"Content-Type":"application/x-ndjson"}}).then((function(t){return t.responseText}))},e._constructError=function(t){var e=t.url,n=t.status;t.responseText;if(void 0===n)return t;var r=e+" HTTP status: "+n;return new Error(r)},e._makeHttpRequest=function(t,e,n){var r=void 0===n?{timeout:1e4}:n,i=r.timeout,a=r.payload,s=r.headers;return new o.Promise((function(n,r){var o=new window.XMLHttpRequest;if(o[A]=!0,o.open(t,e,!0),o.timeout=i,s)for(var c in s)s.hasOwnProperty(c)&&o.setRequestHeader(c,s[c]);o.onreadystatechange=function(){if(4===o.readyState){var t=o.status,i=o.responseText;0===t||t>399&&t<600?r({url:e,status:t,responseText:i}):n(o)}},o.onerror=function(){var t=o.status,n=o.responseText;r({url:e,status:t,responseText:n})},o.send(a)}))},e._createQueue=function(t){var e=this._configService.get("queueLimit"),n=this._configService.get("flushInterval");return new fe(t,{queueLimit:e,flushInterval:n})},e.fetchConfig=function(t,e){var n=this,r=this._configService.get("serverUrl")+"/config/v1/rum/agents";if(!t)return o.Promise.reject("serviceName is required for fetching central config.");r+="?service.name="+t,e&&(r+="&service.environment="+e);var i=this._configService.getLocalConfig();return i&&(r+="&ifnonematch="+i.etag),this._makeHttpRequest("GET",r,{timeout:5e3}).then((function(t){var e=t.status,r=t.responseText;if(304===e)return i;var o=JSON.parse(r),a=t.getResponseHeader("etag");return a&&(o.etag=a.replace(/["]/g,""),n._configService.setLocalConfig(o)),o})).catch((function(t){var e=n._constructError(t);return o.Promise.reject(e)}))},e.initErrorQueue=function(){var t=this;this.errorQueue&&this.errorQueue.flush(),this.errorQueue=this._createQueue((function(e){var n=t.sendErrors(e);n&&n.catch((function(e){t._loggingService.warn("Failed sending errors!",t._constructError(e))}))}));var e=this._configService.get("errorThrottleLimit"),n=this._configService.get("errorThrottleInterval");this.throttleAddError=de(this.errorQueue.add.bind(this.errorQueue),(function(){return t._loggingService.warn("Dropped error due to throttling!")}),{limit:e,interval:n})},e.initTransactionQueue=function(){var t=this;this.transactionQueue&&this.transactionQueue.flush(),this.transactionQueue=this._createQueue((function(e){var n=t.sendTransactions(e);n&&n.catch((function(e){t._loggingService.warn("Failed sending transactions!",t._constructError(e))}))}));var e=this._configService.get("transactionThrottleLimit"),n=this._configService.get("transactionThrottleInterval");this.throttleAddTransaction=de(this.transactionQueue.add.bind(this.transactionQueue),(function(){return t._loggingService.warn("Dropped transaction due to throttling!")}),{limit:e,interval:n})},e.addError=function(t){this.errorQueue||this.initErrorQueue(),this.throttleAddError(t)},e.addTransaction=function(t){this.transactionQueue||this.initTransactionQueue(),this.throttleAddTransaction(t)},e.ndjsonErrors=function(t){return t.map((function(t){return ve.stringify({error:t})}))},e.ndjsonMetricsets=function(t){return t.map((function(t){return ve.stringify({metricset:t})})).join("")},e.ndjsonTransactions=function(t){var e=this;return t.map((function(t){var n="";t.spans&&(n=t.spans.map((function(t){return ve.stringify({span:t})})).join(""),delete t.spans);var r="";return t.breakdown&&(r=e.ndjsonMetricsets(t.breakdown),delete t.breakdown),ve.stringify({transaction:t})+n+r}))},e._send=function(t,e){var n;if(void 0===t&&(t=[]),void 0===e&&(e="transactions"),0!==t.length){var r=((n={})[e]=t,n),i=this._configService.applyFilters(r);if(i){var o;if("errors"===e)o=this.ndjsonErrors(i[e]);else{if("transactions"!==e)return void 0;o=this.ndjsonTransactions(i[e])}var a=this.createMetaData();o.unshift(ve.stringify({metadata:a}));var s=o.join(""),c=this._configService.get("serverUrl")+"/intake/v2/rum/events";return this._postJson(c,s)}this._loggingService.warn("Dropped payload due to filtering!")}},e.sendTransactions=function(t){return this._send(t)},e.sendErrors=function(t){return this._send(t,"errors")},t}();var le=function(){function t(){this.config={},this.defaults={serviceName:"",serviceVersion:"",environment:"",serverUrl:"http://localhost:8200",active:!0,instrument:!0,disableInstrumentations:[],debug:!1,logLevel:"warn",breakdownMetrics:!1,checkBrowserResponsiveness:!0,groupSimilarSpans:!0,similarSpanThreshold:.05,ignoreTransactions:[],errorThrottleLimit:20,errorThrottleInterval:3e4,transactionThrottleLimit:20,transactionThrottleInterval:3e4,transactionDurationThreshold:6e4,queueLimit:-1,flushInterval:500,distributedTracing:!0,distributedTracingOrigins:[],distributedTracingHeaderName:"elastic-apm-traceparent",pageLoadTraceId:"",pageLoadSpanId:"",pageLoadSampled:!1,pageLoadTransactionName:"",transactionSampleRate:1,centralConfig:!1,monitorLongtasks:!1,context:{}},this.events=new gt,this.filters=[],this.version=""}var e=t.prototype;return e.init=function(){var t=function(t){if(!t)return{};for(var e={},n=/^data-([\w-]+)$/,r=t.attributes,i=0;i<r.length;i++){var o=r[i];if(n.test(o.nodeName)){var a=o.nodeName.match(n)[1].split("-").map((function(t,e){return e>0?t.charAt(0).toUpperCase()+t.substring(1):t})).join("");e[a]=o.value||o.nodeValue}}return e}(y());this.setConfig(t)},e.isActive=function(){return this.get("active")},e.setVersion=function(t){this.version=t},e.addFilter=function(t){if("function"!=typeof t)throw new Error("Argument to must be function");this.filters.push(t)},e.applyFilters=function(t){for(var e=0;e<this.filters.length;e++)if(!(t=this.filters[e](t)))return;return t},e.get=function(t){return t.split(".").reduce((function(t,e){return t&&t[e]}),this.config)},e.setUserContext=function(t){void 0===t&&(t={});var e={},n=t,r=n.id,i=n.username,o=n.email;"number"!=typeof r&&"string"!=typeof r||(e.id=r),"string"==typeof i&&(e.username=i),"string"==typeof o&&(e.email=o),this.config.context.user=_(this.config.context.user||{},e)},e.setCustomContext=function(t){void 0===t&&(t={}),this.config.context.custom=_(this.config.context.custom||{},t)},e.addLabels=function(t){var e=this;this.config.context.tags||(this.config.context.tags={}),Object.keys(t).forEach((function(n){return h(n,t[n],e.config.context.tags)}))},e.setConfig=function(t){void 0===t&&(t={}),t.serverUrl&&(t.serverUrl=t.serverUrl.replace(/\/+$/,"")),this.config=S({},this.defaults,this.config,t),this.events.send("config:change",[this.config])},e.validate=function(t){void 0===t&&(t={});var e=["serviceName","serverUrl"],n={missing:[],invalid:[]};Object.keys(t).forEach((function(r){-1===e.indexOf(r)||t[r]||n.missing.push(r)})),t.serviceName&&!/^[a-zA-Z0-9 _-]+$/.test(t.serviceName)&&n.invalid.push({key:"serviceName",value:t.serviceName,allowed:"a-z, A-Z, 0-9, _, -, <space>"});var r=t.transactionSampleRate;return void 0!==r&&("number"!=typeof r||isNaN(r)||r<0||r>1)&&n.invalid.push({key:"transactionSampleRate",value:r,allowed:"Number between 0 and 1"}),n},e.getLocalConfig=function(){var t=sessionStorage.getItem("elastic_apm_config");if(t)return JSON.parse(t)},e.setLocalConfig=function(t){t&&sessionStorage.setItem("elastic_apm_config",JSON.stringify(t))},t}(),pe=function(){function t(t){void 0===t&&(t={}),this.levels=["trace","debug","info","warn","error"],this.level=t.level||"info",this.prefix=t.prefix||"",this.resetLogMethods()}var e=t.prototype;return e.shouldLog=function(t){return this.levels.indexOf(t)>=this.levels.indexOf(this.level)},e.setLevel=function(t){this.level=t,this.resetLogMethods()},e.resetLogMethods=function(){var t=this;this.levels.forEach((function(e){t[e]=t.shouldLog(e)?function(){var n,r=t.prefix;switch(e){case"trace":case"debug":n="info";break;default:n=e}var i=arguments;r&&(i[0]=r+i[0]);if(console){var o=console[n]||console.log;"function"==typeof o&&o.apply(console,i)}}:T}))},t}(),ge=function(){function t(){this._serviceCreators={},this._serviceInstances={},this.initialized=!1}var e=t.prototype;return e.registerCoreServices=function(){var t=this;this.registerServiceCreator("ConfigService",(function(){return new le})),this.registerServiceCreator("LoggingService",(function(){return new pe({prefix:"[Elastic APM] "})})),this.registerServiceCreator("ApmServer",(function(){return new he(t.getService("ConfigService"),t.getService("LoggingService"))}))},e.init=function(){if(!this.initialized){this.initialized=!0;var t=this.getService("ConfigService");t.init();var e=this.getService("LoggingService");n(e,t),t.events.observe("config:change",(function(){n(e,t)})),this.getService("ApmServer").init()}function n(t,e){var n=e.get("debug"),r=e.get("logLevel");!0===n&&"trace"!==r?t.setLevel("debug"):t.setLevel(r)}},e.registerServiceCreator=function(t,e){this._serviceCreators[t]=e},e.registerServiceInstance=function(t,e){this._serviceInstances[t]=e},e.getService=function(t){if(!this._serviceInstances[t]){if("function"!=typeof this._serviceCreators[t])throw new Error("Can not get service, No creator for: "+t);this._serviceInstances[t]=this._serviceCreators[t](this)}return this._serviceInstances[t]},t}();var me=function(){function t(t,e){this._disable=e,this.serviceFactory=t,this._initialized=!1}var e=t.prototype;return e.init=function(t){var e=this;if(this.isEnabled()&&!this._initialized){this._initialized=!0;var n=this.serviceFactory.getService("ConfigService");n.setVersion("4.8.1"),this.config(t);var r=this.serviceFactory.getService("LoggingService");if(n.isActive()){this.serviceFactory.init();var i=function(t,e){var n,r=((n={})[J]=!1,n[Y]=!1,n[Z]=!1,n[z]=!1,n[K]=!1,n[G]=!1,n);return t?(Object.keys(r).forEach((function(t){-1===e.indexOf(t)&&(r[t]=!0)})),r):r}(n.get("instrument"),n.get("disableInstrumentations"));if(this.serviceFactory.getService("PerformanceMonitoring").init(i),i[K])this.serviceFactory.getService("ErrorLogging").registerListeners();var o=function(){return i[z]&&e._sendPageLoadMetrics()};n.get("centralConfig")?this.fetchCentralConfig().then(o):o()}else this._disable=!0,r.info("RUM agent is inactive")}return this},e.fetchCentralConfig=function(){var t=this.serviceFactory.getService("ApmServer"),e=this.serviceFactory.getService("LoggingService"),n=this.serviceFactory.getService("ConfigService");return t.fetchConfig(n.get("serviceName"),n.get("environment")).then((function(t){var r=t.transaction_sample_rate;if(r){var i={transactionSampleRate:r=Number(r)},o=n.validate(i).invalid;if(0===o.length)n.setConfig(i);else{var a=o[0],s=a.key,c=a.value,u=a.allowed;e.warn('invalid value "'+c+'" for '+s+". Allowed: "+u+".")}}return t})).catch((function(t){e.warn("failed fetching config:",t)}))},e._sendPageLoadMetrics=function(){var t=this.startTransaction(void 0,z,{managed:!0,canReuse:!0});t&&t.addTask(z);var e=function(){setTimeout((function(){t&&t.removeTask(z)}))};"complete"===document.readyState?e():window.addEventListener("load",e)},e.isEnabled=function(){return!this._disable},e.observe=function(t,e){this.serviceFactory.getService("ConfigService").events.observe(t,e)},e.config=function(t){var e=this.serviceFactory.getService("ConfigService"),n=e.validate(t),r=n.missing,i=n.invalid;if(0===r.length&&0===i.length)e.setConfig(t);else{var o=this.serviceFactory.getService("LoggingService"),a="RUM agent isn't correctly configured. ";r.length>0&&(a+=r.join(", ")+" is missing",i.length>0&&(a+=", ")),i.forEach((function(t,e){var n=t.key,r=t.value,o=t.allowed;a+=n+' "'+r+'" contains invalid characters! (allowed: '+o+")"+(e!==i.length-1?", ":"")})),o.error(a),e.setConfig({active:!1})}},e.setUserContext=function(t){this.serviceFactory.getService("ConfigService").setUserContext(t)},e.setCustomContext=function(t){this.serviceFactory.getService("ConfigService").setCustomContext(t)},e.addTags=function(t){this.serviceFactory.getService("LoggingService").warn("addTags deprecated, please use addLabels"),this.addLabels(t)},e.addLabels=function(t){this.serviceFactory.getService("ConfigService").addLabels(t)},e.setInitialPageLoadName=function(t){this.isEnabled()&&this.serviceFactory.getService("ConfigService").setConfig({pageLoadTransactionName:t})},e.startTransaction=function(t,e,n){if(this.isEnabled())return this.serviceFactory.getService("TransactionService").startTransaction(t,e,n)},e.startSpan=function(t,e){if(this.isEnabled())return this.serviceFactory.getService("TransactionService").startSpan(t,e)},e.getCurrentTransaction=function(){if(this.isEnabled())return this.serviceFactory.getService("TransactionService").getCurrentTransaction()},e.captureError=function(t){if(this.isEnabled())return this.serviceFactory.getService("ErrorLogging").logError(t)},e.addFilter=function(t){this.serviceFactory.getService("ConfigService").addFilter(t)},t}();n.d(e,"init",(function(){return Te})),n.d(e,"apmBase",(function(){return be})),n.d(e,"apm",(function(){return be})),n.d(e,"ApmBase",(function(){return me}));var ye,_e=St?bt:(St=!0,v()?(_t(),bt=!0):"undefined"!=typeof window&&console.log("[Elastic APM] platform is not supported!"),bt),Se=((ye=new ge).registerCoreServices(),Mt.registerServices(ye),ue.registerServices(ye),ye),be=new me(Se,!_e);"undefined"!=typeof window&&(window.elasticApm=be);var Te=be.init.bind(be);e.default=Te}]); | ||
!function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=4)}([function(t,e){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);t.exports=function(){return n(r),r}}else{var i=new Array(16);t.exports=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),i[e]=t>>>((3&e)<<3)&255;return i}}},function(t,e,n){var r,i,o;!function(a,s){"use strict";i=[n(3)],void 0===(o="function"==typeof(r=function(t){var e=/(^|@)\S+\:\d+/,n=/^\s*at .*(\S+\:\d+|\(native\))/m,r=/^(eval@)?(\[native code\])?$/;function i(t,e,n){if("function"==typeof Array.prototype.map)return t.map(e,n);for(var r=new Array(t.length),i=0;i<t.length;i++)r[i]=e.call(n,t[i]);return r}function o(t,e,n){if("function"==typeof Array.prototype.filter)return t.filter(e,n);for(var r=[],i=0;i<t.length;i++)e.call(n,t[i])&&r.push(t[i]);return r}return{parse:function(t){if(void 0!==t.stacktrace||void 0!==t["opera#sourceloc"])return this.parseOpera(t);if(t.stack&&t.stack.match(n))return this.parseV8OrIE(t);if(t.stack)return this.parseFFOrSafari(t);throw new Error("Cannot parse given Error object")},extractLocation:function(t){if(-1===t.indexOf(":"))return[t];var e=/(.+?)(?:\:(\d+))?(?:\:(\d+))?$/.exec(t.replace(/[\(\)]/g,""));return[e[1],e[2]||void 0,e[3]||void 0]},parseV8OrIE:function(e){return i(o(e.stack.split("\n"),(function(t){return!!t.match(n)}),this),(function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^\()]*)|(\)\,.*$)/g,""));var n=e.replace(/^\s+/,"").replace(/\(eval code/g,"(").split(/\s+/).slice(1),r=this.extractLocation(n.pop()),i=n.join(" ")||void 0,o=function(t,e){if("function"==typeof Array.prototype.indexOf)return t.indexOf(e);for(var n=0;n<t.length;n++)if(t[n]===e)return n;return-1}(["eval","<anonymous>"],r[0])>-1?void 0:r[0];return new t(i,void 0,o,r[1],r[2],e)}),this)},parseFFOrSafari:function(e){return i(o(e.stack.split("\n"),(function(t){return!t.match(r)}),this),(function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new t(e);var n=e.split("@"),r=this.extractLocation(n.pop()),i=n.join("@")||void 0;return new t(i,void 0,r[0],r[1],r[2],e)}),this)},parseOpera:function(t){return!t.stacktrace||t.message.indexOf("\n")>-1&&t.message.split("\n").length>t.stacktrace.split("\n").length?this.parseOpera9(t):t.stack?this.parseOpera11(t):this.parseOpera10(t)},parseOpera9:function(e){for(var n=/Line (\d+).*script (?:in )?(\S+)/i,r=e.message.split("\n"),i=[],o=2,a=r.length;o<a;o+=2){var s=n.exec(r[o]);s&&i.push(new t(void 0,void 0,s[2],s[1],void 0,r[o]))}return i},parseOpera10:function(e){for(var n=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=e.stacktrace.split("\n"),i=[],o=0,a=r.length;o<a;o+=2){var s=n.exec(r[o]);s&&i.push(new t(s[3]||void 0,void 0,s[2],s[1],void 0,r[o]))}return i},parseOpera11:function(n){return i(o(n.stack.split("\n"),(function(t){return!!t.match(e)&&!t.match(/^Error created at/)}),this),(function(e){var n,r=e.split("@"),i=this.extractLocation(r.pop()),o=r.shift()||"",a=o.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^\)]*\)/g,"")||void 0;o.match(/\(([^\)]*)\)/)&&(n=o.replace(/^[^\(]+\(([^\)]*)\)$/,"$1"));var s=void 0===n||"[arguments not available]"===n?void 0:n.split(",");return new t(a,s,i[0],i[1],i[2],e)}),this)}}})?r.apply(e,i):r)||(t.exports=o)}()},,function(t,e,n){var r,i,o;!function(n,a){"use strict";i=[],void 0===(o="function"==typeof(r=function(){function t(t){return!isNaN(parseFloat(t))&&isFinite(t)}function e(t,e,n,r,i,o){void 0!==t&&this.setFunctionName(t),void 0!==e&&this.setArgs(e),void 0!==n&&this.setFileName(n),void 0!==r&&this.setLineNumber(r),void 0!==i&&this.setColumnNumber(i),void 0!==o&&this.setSource(o)}return e.prototype={getFunctionName:function(){return this.functionName},setFunctionName:function(t){this.functionName=String(t)},getArgs:function(){return this.args},setArgs:function(t){if("[object Array]"!==Object.prototype.toString.call(t))throw new TypeError("Args must be an Array");this.args=t},getFileName:function(){return this.fileName},setFileName:function(t){this.fileName=String(t)},getLineNumber:function(){return this.lineNumber},setLineNumber:function(e){if(!t(e))throw new TypeError("Line Number must be a Number");this.lineNumber=Number(e)},getColumnNumber:function(){return this.columnNumber},setColumnNumber:function(e){if(!t(e))throw new TypeError("Column Number must be a Number");this.columnNumber=Number(e)},getSource:function(){return this.source},setSource:function(t){this.source=String(t)},toString:function(){return(this.getFunctionName()||"{anonymous}")+("("+(this.getArgs()||[]).join(",")+")")+(this.getFileName()?"@"+this.getFileName():"")+(t(this.getLineNumber())?":"+this.getLineNumber():"")+(t(this.getColumnNumber())?":"+this.getColumnNumber():"")}},e})?r.apply(e,i):r)||(t.exports=o)}()},function(t,e,n){"use strict";n.r(e);var r=n(0),i=n.n(r);var o=function(t){var e=this.constructor;return this.then((function(n){return e.resolve(t()).then((function(){return n}))}),(function(n){return e.resolve(t()).then((function(){return e.reject(n)}))}))},a=setTimeout;function s(t){return Boolean(t&&void 0!==t.length)}function c(){}function u(t){if(!(this instanceof u))throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],l(t,this)}function f(t,e){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,u._immediateFn((function(){var n=1===t._state?e.onFulfilled:e.onRejected;if(null!==n){var r;try{r=n(t._value)}catch(t){return void v(e.promise,t)}d(e.promise,r)}else(1===t._state?d:v)(e.promise,t._value)}))):t._deferreds.push(e)}function d(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var n=e.then;if(e instanceof u)return t._state=3,t._value=e,void h(t);if("function"==typeof n)return void l((r=n,i=e,function(){r.apply(i,arguments)}),t)}t._state=1,t._value=e,h(t)}catch(e){v(t,e)}var r,i}function v(t,e){t._state=2,t._value=e,h(t)}function h(t){2===t._state&&0===t._deferreds.length&&u._immediateFn((function(){t._handled||u._unhandledRejectionFn(t._value)}));for(var e=0,n=t._deferreds.length;e<n;e++)f(t,t._deferreds[e]);t._deferreds=null}function p(t,e,n){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=n}function l(t,e){var n=!1;try{t((function(t){n||(n=!0,d(e,t))}),(function(t){n||(n=!0,v(e,t))}))}catch(t){if(n)return;n=!0,v(e,t)}}u.prototype.catch=function(t){return this.then(null,t)},u.prototype.then=function(t,e){var n=new this.constructor(c);return f(this,new p(t,e,n)),n},u.prototype.finally=o,u.all=function(t){return new u((function(e,n){if(!s(t))return n(new TypeError("Promise.all accepts an array"));var r=Array.prototype.slice.call(t);if(0===r.length)return e([]);var i=r.length;function o(t,a){try{if(a&&("object"==typeof a||"function"==typeof a)){var s=a.then;if("function"==typeof s)return void s.call(a,(function(e){o(t,e)}),n)}r[t]=a,0==--i&&e(r)}catch(t){n(t)}}for(var a=0;a<r.length;a++)o(a,r[a])}))},u.resolve=function(t){return t&&"object"==typeof t&&t.constructor===u?t:new u((function(e){e(t)}))},u.reject=function(t){return new u((function(e,n){n(t)}))},u.race=function(t){return new u((function(e,n){if(!s(t))return n(new TypeError("Promise.race accepts an array"));for(var r=0,i=t.length;r<i;r++)u.resolve(t[r]).then(e,n)}))},u._immediateFn="function"==typeof setImmediate&&function(t){setImmediate(t)}||function(t){a(t,0)},u._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};var g=u,m={};"undefined"!=typeof window?m=window:"undefined"!=typeof self&&(m=self);var y="Promise"in m?m.Promise:g,S=[].slice,_="undefined"!=typeof window?performance:{};for(var b=[],T=0;T<256;++T)b[T]=(T+256).toString(16).substr(1);function w(t,e){var n=!1;return"string"==typeof e?n=t===e:Array.isArray(e)&&e.forEach((function(e){n||(n=w(t,e))})),n}function E(t){var e,n,r,o;return(e=i()(),r=n||0,[(o=b)[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]]].join("")).substr(0,t)}function x(){return"undefined"!=typeof window&&"function"==typeof Array.prototype.forEach&&"function"==typeof JSON.stringify&&"function"==typeof Function.bind&&_&&"function"==typeof _.now&&"withCredentials"in new window.XMLHttpRequest}function C(t,e,n){if(n&&t){var r=M(t);return e&&(e=String(e)),n[r]=e,n}}function L(){return{page:{referer:document.referrer,url:window.location.href}}}function k(t){return t&&t.split("?")[0]}function I(t){return null!==t&&"object"==typeof t}function O(t,e,n){for(var r=0,i=e.length;r<i;++r){var o=e[r];if(I(o)||"function"==typeof o)for(var a=Object.keys(o),s=0,c=a.length;s<c;s++){var u=a[s],f=o[u];n&&I(f)?(I(t[u])||(t[u]=Array.isArray(f)?[]:{}),O(t[u],[f],!1)):t[u]=f}}return t}function N(){if("undefined"!=typeof document){var t=document.currentScript;return t||function(){if("undefined"!=typeof document)for(var t=document.getElementsByTagName("script"),e=0,n=t.length;e<n;e++){var r=t[e];if(r.src.indexOf("elastic")>0)return r}}()}}function F(t){return O(t,S.call(arguments,1),!1)}function j(t){return O(t,S.call(arguments,1),!0)}function A(t){return void 0===t}function R(){}function M(t){return t.replace(/[.*"]/g,"_")}function P(){return _.now()}function q(t){return"number"==typeof t&&t>=0?t:P()}function H(t,e){return A(e)||A(t)?null:parseFloat(e-t)}function Q(t){y.resolve().then(t)}function D(){return"function"==typeof _.getEntriesByType}var z={fetchInProgress:!1};function U(t){return"__apm_symbol__"+t}function B(t,e,n){for(var r=t;r&&!r.hasOwnProperty(e);)r=Object.getPrototypeOf(r);!r&&t[e]&&(r=t);var i,o,a,s,c=U(e);if(r&&!(i=r[c])){i=r[c]=r[e];var u=r&&Object.getOwnPropertyDescriptor(r,e);if(!(s=u)||!1!==s.writable&&("function"!=typeof s.get||void 0!==s.set)){var f=n(i,c,e);r[e]=function(){return f(this,arguments)},o=r[e],a=i,o[U("OriginalDelegate")]=a}}return i}var $=U("xhrIgnore"),V=U("xhrSync"),X=U("xhrURL"),J=U("xhrMethod"),Z="schedule",G="invoke",K="clear",W="addEventListener",Y="removeEventListener",tt=["link","css","script","img","xmlhttprequest","fetch","beacon","iframe"],et=3e5,nt="page-load",rt="custom",it="Unknown",ot=[nt,"route-change","user-interaction","http-request",rt,"temporary"],at=60,st="xmlhttprequest",ct="fetch",ut="history",ft="eventtarget",dt="error",vt="longtask",ht="paint",pt="measure",lt="navigation",gt="resource",mt="first-contentful-paint",yt="largest-contentful-paint",St=1024,_t=U("xhrTask"),bt=U("xhrListener"),Tt=U("xhrScheduled");function wt(t){var e=XMLHttpRequest.prototype,n=e[W],r=e[Y];if(!n){var i=window.XMLHttpRequestEventTarget;if(i){var o=i.prototype;n=o[W],r=o[Y]}}var a="readystatechange",s="load";function c(e){e.state=G,t(G,e)}function u(e){XMLHttpRequest[Tt]=!1,e.state=Z,t(Z,e);var i=e.data,o=i.aborted,u=i.target;n||(n=u[W],r=u[Y]);var f,d=u[bt];d&&(r.call(u,a,d),r.call(u,s,d));var v=u[bt]=function(t){var n=t.type;f?f!=n&&function(t){setTimeout(t,0)}((function(){e.state!==G&&c(e)})):u.readyState===u.DONE&&!o&&XMLHttpRequest[Tt]&&e.state===Z&&(f=n)};n.call(u,a,v),n.call(u,s,v),u[_t]||(u[_t]=e)}var f=B(e,"open",(function(){return function(t,e){return t[$]||(t[J]=e[0],t[X]=e[1],t[V]=!1===e[2]),f.apply(t,e)}})),d=B(e,"send",(function(){return function(t,e){if(t[$])return d.apply(t,e);var n={source:st,state:"",type:"macroTask",data:{target:t,method:t[J],sync:t[V],url:t[X],aborted:!1}};u(n);var r=d.apply(t,e);return XMLHttpRequest[Tt]=!0,t[V]&&c(n),r}})),v=B(e,"abort",(function(){return function(e,n){if(!e[$]){var r=e[_t];if(r&&"string"==typeof r.type){if(r.data&&r.data.aborted)return;!function(e){e.state=K,t(K,e),e.data.aborted=!0}(r)}}return v.apply(e,n)}}))}for(var Et=["click"],xt={},Ct=0;Ct<Et.length;Ct++){var Lt=Et[Ct];xt[Lt]=U(Lt)}function kt(t,e,n){return t instanceof Element&&Et.indexOf(e)>=0&&"function"==typeof n}var It=function(){function t(){this.observers={}}var e=t.prototype;return e.observe=function(t,e){var n=this;if("function"==typeof e)return this.observers[t]||(this.observers[t]=[]),this.observers[t].push(e),function(){var r=n.observers[t].indexOf(e);r>-1&&n.observers[t].splice(r,1)}},e.sendOnly=function(t,e){var n=this.observers[t];n&&n.forEach((function(t){try{t.apply(void 0,e)}catch(t){console.log(t,t.stack)}}))},e.send=function(t,e){this.sendOnly(t+":before",e),this.sendOnly(t,e),this.sendOnly(t+":after",e)},t}(),Ot=new It,Nt=!1;function Ft(){return Nt||(Nt=!0,wt((function(t,e){Ot.send(st,[t,e])})),function(t){if(window.fetch&&window.Request){var e=window.fetch;window.fetch=function(t,i){var o,a,s=this,c=arguments;if("string"==typeof t)o=new Request(t,i),a=t;else{if(!t)return e.apply(s,c);a=(o=t).url}var u={source:ct,state:"",type:"macroTask",data:{target:o,method:o.method,sync:!1,url:a,aborted:!1}};return new y((function(t,i){var a;z.fetchInProgress=!0,n(u);try{a=e.apply(s,[o])}catch(t){return i(t),u.data.error=t,r(u),void(z.fetchInProgress=!1)}a.then((function(e){t(e),Q((function(){u.data.response=e,r(u)}))}),(function(t){i(t),Q((function(){u.data.error=t,r(u)}))})),z.fetchInProgress=!1}))}}function n(e){e.state=Z,t(Z,e)}function r(e){e.state=G,t(G,e)}}((function(t,e){Ot.send(ct,[t,e])})),function(t){if(window.history){var e=history.pushState;"function"==typeof e&&(history.pushState=function(n,r,i){var o={source:ut,data:{state:n,title:r,url:i}};t(G,o),e.apply(this,arguments)})}}((function(t,e){Ot.send(ut,[t,e])})),function(t){if(window.EventTarget){var e=window.EventTarget.prototype,n=e[W],r=e[Y];e[W]=function(t,e,r){var i=this;if(!kt(i,t,e))return n.apply(i,arguments);var o=a(i,t,e,r),s=Array.prototype.slice.call(arguments);return s[1]=o,n.apply(i,s)},e[Y]=function(t,e,n){var i=this;if(!kt(i,t,e))return r.apply(i,arguments);var o=s(i,t,e,n),a=Array.prototype.slice.call(arguments);return a[1]=o,r.apply(i,a)}}function i(t,e,n,r){for(var i=0;i<t.length;i++){var o=t[i];if(o.eventType===e&&o.listenerFn===n&&o.capture===r)return i}return-1}function o(t){return"boolean"==typeof t?t:!!t&&!!t.capture}function a(e,n,r,a){var s=xt[n];if(!s)return r;var c=e[s],u=o(a);if(c){var f=i(c,n,r,u);if(-1!==f)return c[f].wrappingFn}else c=e[s]=[];var d={source:ft,target:e,eventType:n,listenerFn:r,capture:u,wrappingFn:v};function v(){var e;t(Z,d);try{e=r.apply(this,arguments)}finally{t(G,d)}return e}return c.push(d),v}function s(t,e,n,r){var a=xt[e],s=t[a];if(s){var c=i(s,e,n,o(r));if(-1!==c){var u=s[c];return s.splice(c,1),0===s.length&&(t[a]=void 0),u.wrappingFn}}return n}}((function(t,e){Ot.send(ft,[t,e])}))),Ot}var jt=!1,At=!1;var Rt=n(1),Mt=n.n(Rt);function Pt(t){var e=t.error,n=t.filename,r=t.lineno,i=t.colno,o=[];if(e)try{o=Mt.a.parse(e)}catch(t){}return 0===o.length&&(o=[{fileName:n,lineNumber:r,columnNumber:i}]),o.map((function(t){return t.functionName&&(t.functionName=(e=t.functionName,n=e.split("/"),e=(e=(e=n.length>1?["Object",n[n.length-1]].join("."):n[0]).replace(/.<$/gi,".<anonymous>")).replace(/^Anonymous function$/,"<anonymous>"),e=(n=e.split(".")).length>1?n[n.length-1]:n[0])),t;var e,n})).map((function(t){var e=t.fileName,n=t.lineNumber,r=t.columnNumber,i=t.functionName,o=void 0===i?"<anonymous>":i;if(!e&&!n)return{};if(!r&&!n)return{};var a,s,c=function(t){return void 0===t&&(t=""),"<anonymous>"===t&&(t=""),t}(e),u=(a=c,s=window.location.origin||window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:""),a.indexOf(s)>-1&&(a=a.replace(s+"/","")),a);return function(t){return!!t&&0===window.location.href.indexOf(t)}(c)&&(u="(inline script)"),{abs_path:e,filename:u,function:o,lineno:n,colno:r}}))}var qt={service:{name:[St,!0],version:!0,agent:{version:[St,!0]},environment:!0}},Ht={"*":!0,headers:{"*":!0}},Qt={user:{id:!0,email:!0,username:!0},tags:{"*":!0},http:{response:Ht},destination:{address:[St],service:{"*":[St,!0]}},response:Ht},Dt={name:[St,!0],type:[St,!0],id:[St,!0],trace_id:[St,!0],parent_id:[St,!0],transaction_id:[St,!0],subtype:!0,action:!0,context:Qt},zt={name:!0,parent_id:!0,type:[St,!0],id:[St,!0],trace_id:[St,!0],span_count:{started:[St,!0]},context:Qt},Ut={id:[St,!0],trace_id:!0,transaction_id:!0,parent_id:!0,culprit:!0,exception:{type:!0},transaction:{type:!0},context:Qt};function Bt(t){return null==t||""===t||void 0===t}function $t(t,e,n){var r=function(t,e,n,r){return void 0===e&&(e=St),void 0===n&&(n=!1),void 0===r&&(r="N/A"),n&&Bt(t)&&(t=r),"string"==typeof t?t.substring(0,e):t}(t[e],n[0],n[1]);Bt(r)?delete t[e]:t[e]=r}function Vt(t,e,n){void 0===t&&(t={}),void 0===n&&(n=e);for(var r=Object.keys(t),i=[],o=function(o){var a=r[o],s=!0===t[a]?i:t[a];Array.isArray(s)?"*"===a?Object.keys(n).forEach((function(t){return $t(n,t,s)})):$t(n,a,s):Vt(s,e,n[a])},a=0;a<r.length;a++)o(a);return e}var Xt=["stack","message"];var Jt=function(){function t(t,e,n){this._apmServer=t,this._configService=e,this._transactionService=n}var e=t.prototype;return e.createErrorDataModel=function(t){var e=function(t){return t.filter((function(t){var e=t.filename,n=t.lineno;return void 0!==e&&void 0!==n}))}(Pt(t)),n="(inline script)",r=e[e.length-1];r&&r.filename&&(n=r.filename);var i=t.message,o=t.error,a=i,s="",c={};if(o&&"object"==typeof o){a=a||o.message,s=o.name;var u=function(t){var e=!1,n={};if(Object.keys(t).forEach((function(r){if(!(Xt.indexOf(r)>=0)){var i=t[r];if(null!=i&&"function"!=typeof i){if("object"==typeof i){if("function"!=typeof i.toISOString)return;i=i.toISOString()}n[r]=i,e=!0}}})),e)return n}(o);u&&(c.custom=u)}s||a&&a.indexOf(":")>-1&&(s=a.split(":")[0]);var f=this._transactionService.getCurrentTransaction(),d=f?f.context:{},v=this._configService.get("context"),h=j({},L(),d,v,c),p={id:E(),culprit:n,exception:{message:a,stacktrace:e,type:s},context:h};return f&&(p=F(p,{trace_id:f.traceId,parent_id:f.id,transaction_id:f.id,transaction:{type:f.type,sampled:f.sampled}})),Vt(Ut,p)},e.logErrorEvent=function(t,e){if(void 0!==t){var n=this.createErrorDataModel(t);if(void 0!==n.exception.message)return e?this._apmServer.sendErrors([n]):this._apmServer.addError(n)}},e.registerListeners=function(){var t=this;window.addEventListener("error",(function(e){return t.logErrorEvent(e)})),window.addEventListener("unhandledrejection",(function(e){return t.logPromiseEvent(e)}))},e.logPromiseEvent=function(t){var e="Unhandled promise rejection: ",n=t.reason;null==n?this.logError(e+"<no reason specified>"):"string"==typeof n.message?this.logError({message:e+n.message,stack:n.stack?n.stack:null}):"object"!=typeof n&&this.logError(e+n)},e.logError=function(t){var e={};return"string"==typeof t?e.message=t:e.error=t,this.logErrorEvent(e)},t}(),Zt={ErrorLogging:Jt,registerServices:function(t){t.registerServiceCreator("ErrorLogging",(function(){var e=t.getService("ApmServer"),n=t.getService("ConfigService"),r=t.getService("TransactionService");return new Jt(e,n,r)}))}};var Gt=[["#","hash"],["?","query"],["/","path"],["@","auth",1],[NaN,"host",void 0,1]],Kt=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,Wt=function(){function t(t){var e,n=this.extractProtocol(t||""),r=n.protocol,i=n.address,o=n.slashes,a=!r&&!o,s=this.getLocation(),c=Gt.slice();i=i.replace("\\","/"),o||(c[2]=[NaN,"path"]);for(var u=0;u<c.length;u++){var f=c[u],d=f[0],v=f[1];if("string"==typeof d){if(~(e=i.indexOf(d))){var h=f[2];if(h){var p=i.lastIndexOf(d);e=Math.max(e,p),this[v]=i.slice(0,e),i=i.slice(e+h)}else this[v]=i.slice(e),i=i.slice(0,e)}}else this[v]=i,i="";this[v]=this[v]||a&&f[3]&&s[v]||"",f[3]&&(this[v]=this[v].toLowerCase())}if(a&&"/"!==this.path.charAt(0)&&(this.path="/"+this.path),this.relative=a,this.protocol=r||s.protocol,this.hostname=this.host,this.port="",/:\d+$/.test(this.host)){var l=this.host.split(":"),g=l.pop(),m=l.join(":");!function(t,e){switch(e){case"http:":return"80"===t;case"https:":return"443"===t}return!0}(g,this.protocol)?this.port=g:this.host=m,this.hostname=m}this.origin=this.protocol&&this.host&&"file:"!==this.protocol?this.protocol+"//"+this.host:"null",this.href=this.toString()}var e=t.prototype;return e.toString=function(){var t=this.protocol;if(t+="//",this.auth){var e=this.auth.split(":");t+=(e[0]?"[REDACTED]":"")+(e[1]?":[REDACTED]":"")+"@"}return t+=this.host,t+=this.path,t+=this.query,t+=this.hash},e.getLocation=function(){var t={};return"undefined"!=typeof window&&(t=window),t.location},e.extractProtocol=function(t){var e=Kt.exec(t);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!e[2],address:e[3]}},t}(),Yt=.05;var te=function(){function t(t,e,n,r){this._apmServer=t,this._configService=e,this._logginService=n,this._transactionService=r}var e=t.prototype;return e.init=function(t){var e=this;void 0===t&&(t={}),this._configService.events.observe("transaction:end:after",(function(t){var n=e.createTransactionPayload(t);n&&e._apmServer.addTransaction(n)})),t[ut]&&Ot.observe(ut,this.getHistorySub()),t[st]&&Ot.observe(st,this.getXHRSub()),t[ct]&&Ot.observe(ct,this.getFetchSub()),t[ft]&&Ot.observe(ft,this.getEventTargetSub())},e.getEventTargetSub=function(){var t=this._transactionService;return function(e,n){if(e===Z&&n.source===ft&&"click"===n.eventType){var r=n.target,i=r.getAttribute("name"),o="";i&&(o='["'+i+'"]');var a=r.tagName.toLowerCase(),s=t.startTransaction("Click >> "+a+o,"user-interaction",{managed:!0,canReuse:!0,reuseThreshold:100});if(s){var c=r.getAttribute("class");c&&s.addContext({custom:{classes:c}})}}}},e.getHistorySub=function(){var t=this._transactionService;return function(e,n){n.source===ut&&e===G&&t.startTransaction(n.data.title,"route-change",{managed:!0,canReuse:!0})}},e.getXHRSub=function(){var t=this;return function(e,n){n.source!==st||z.fetchInProgress||t.processAPICalls(e,n)}},e.getFetchSub=function(){var t=this;return function(e,n){n.source===ct&&t.processAPICalls(e,n)}},e.processAPICalls=function(t,e){var n=this._configService,r=this._transactionService;if(t===Z&&e.data){var i=e.data,o=new Wt(i.url),a=i.method+" "+(o.relative?o.path:k(o.href));r.getCurrentTransaction()||r.startTransaction(a,"http-request",{managed:!0});var s=r.startSpan(a,"external.http"),c=r.addTask();if(!s)return;var u=n.get("distributedTracing"),f=n.get("distributedTracingOrigins"),d=new Wt(window.location.href),v=w(o.origin,d.origin)||w(o.origin,f),h=i.target;u&&v&&h&&this.injectDtHeader(s,h),s.sync=i.sync,i.span=s,e.id=c}else t===G&&(e.data&&e.data.span&&e.data.span.end(null,e.data),e.id&&r.removeTask(e.id))},e.injectDtHeader=function(t,e){var n,r=this._configService.get("distributedTracingHeaderName"),i=function(t){if(t&&t.traceId&&t.id&&t.parentId){var e=t.sampled?"01":"00",n=t.sampled?t.id:t.parentId;return"00-"+t.traceId+"-"+n+"-"+e}}(t),o=/^[\da-f]{2}-[\da-f]{32}-[\da-f]{16}-[\da-f]{2}$/.test(n=i)&&"00000000000000000000000000000000"!==n.slice(3,35)&&"0000000000000000"!==n.slice(36,52);r&&i&&o&&("function"==typeof e.setRequestHeader?e.setRequestHeader(r,i):e.headers&&"function"==typeof e.headers.append?e.headers.append(r,i):e[r]=i)},e.extractDtHeader=function(t){var e=this._configService.get("distributedTracingHeaderName");if(t)return function(t){var e=/^([\da-f]{2})-([\da-f]{32})-([\da-f]{16})-([\da-f]{2})$/.exec(t);if(e){var n="00"!==e[4];return{traceId:e[2],id:e[3],sampled:n}}}(t[e])},e.filterTransaction=function(t){var e=t.duration();if(!e)return!1;if(t.isManaged()){if(e>6e4)return!1;if(t.sampled&&0===t.spans.length)return!1;if(t.type!==nt)if(!function(t,e,n){var r=t.browserResponsivenessCounter,i=t.duration();return r+n>=Math.floor(i/e)}(t,500,3))return!1}return!0},e.createTransactionDataModel=function(t){var e=t._start,n=t.spans.map((function(n){var r={id:n.id,transaction_id:t.id,parent_id:n.parentId||t.id,trace_id:t.traceId,name:n.name,type:n.type,subType:n.subType,action:n.action,sync:n.sync,start:n._start-e,duration:n.duration(),context:n.context};return Vt(Dt,r)})),r={id:t.id,trace_id:t.traceId,name:t.name,type:t.type,duration:t.duration(),spans:n,context:t.context,marks:t.marks,breakdown:t.breakdownTimings,span_count:{started:n.length},sampled:t.sampled};return Vt(zt,r)},e.createTransactionPayload=function(t){var e=function(t){if(t.sampled){var e=t.spans.filter((function(e){return e.duration()>0&&e._start>=t._start&&e._end<=t._end}));if(t.isManaged()){var n=function(t,e,n){t.sort((function(t,e){return t._start-e._start}));var r=[],i=1;return t.forEach((function(o,a){if(0===r.length)r.push(o);else{var s=r[r.length-1],c=s.type===o.type&&s.subType===o.subType&&s.action===o.action&&s.name===o.name&&o.duration()/e<n&&(o._start-s._end)/e<n,u=t.length===a+1;c&&(i++,s._end=o._end),i>1&&(!c||u)&&(s.name=i+"x "+s.name,i=1),c||r.push(o)}})),r}(e,t.duration(),Yt);t.spans=n}else t.spans=e}else t.resetSpans();return t}(t);if(this.filterTransaction(e))return this.createTransactionDataModel(t)},t}(),ee=function(){function t(t,e,n){void 0===n&&(n={}),t||(t=it),e||(e=rt),this.name=t,this.type=e,this.options=n,this.id=n.id||E(16),this.traceId=n.traceId,this.sampled=n.sampled,this.timestamp=n.timestamp,this._start=q(n.startTime),this._end=void 0,this.ended=!1,this.onEnd=n.onEnd}var e=t.prototype;return e.ensureContext=function(){this.context||(this.context={})},e.addTags=function(t){console.warn("addTags deprecated, please use addLabels"),this.addLabels(t)},e.addLabels=function(t){this.ensureContext();var e=this.context;e.tags||(e.tags={}),Object.keys(t).forEach((function(n){return C(n,t[n],e.tags)}))},e.addContext=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];0!==e.length&&(this.ensureContext(),j.apply(void 0,[this.context].concat(e)))},e.end=function(t){this.ended||(this.ended=!0,this._end=q(t),this.callOnEnd())},e.callOnEnd=function(){"function"==typeof this.onEnd&&this.onEnd(this)},e.duration=function(){return H(this._start,this._end)},t}(),ne=91,re=93,ie="external",oe="resource";function ae(t){var e={transfer_size:t.transferSize,encoded_body_size:t.encodedBodySize,decoded_body_size:t.decodedBodySize},n=function(t){void 0===t&&(t=[]);for(var e=[],n=0;n<t.length;n++){var r=t[n],i=r.name,o=r.duration,a=r.description,s=i;a&&(s+=";desc="+a),o&&(s+=";dur="+o),e.push(s)}return e.join(", ")}(t.serverTiming);return n&&(e.headers={"server-timing":n}),e}function se(t,e){var n=t.port,r=t.protocol,i=t.hostname,o=t.host,a=function(t,e){return""===t&&(t="http:"===e?"80":"https:"===e?"443":""),t}(n,r),s=i.charCodeAt(0)===ne&&i.charCodeAt(i.length-1)===re,c=i;return s&&(c=i.slice(1,-1)),{service:{name:r+"//"+o,resource:i+":"+a,type:e},address:c,port:Number(a)}}function ce(t,e){if(e){var n;switch(t.type){case ie:n=function(t){var e,n=t.url,r=t.method,i=t.target,o=t.response,a=new Wt(n),s=se(a,ie),c={http:{method:r,url:a.href},destination:s};return i&&void 0!==i.status?e=i.status:o&&(e=o.status),c.http.status_code=e,c}(e);break;case oe:n=function(t){var e=t.entry,n=t.url,r=se(new Wt(n),oe);return{http:{url:n,response:ae(e)},destination:r}}(e)}t.addContext(n)}}var ue=function(t){var e,n;function r(e,n,r){var i;if((i=t.call(this,e,n,r)||this).parentId=i.options.parentId,i.subType=void 0,i.action=void 0,-1!==i.type.indexOf(".")){var o=i.type.split(".",3);i.type=o[0],i.subType=o[1],i.action=o[2]}return i.sync=i.options.sync,i}return n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n,r.prototype.end=function(e,n){t.prototype.end.call(this,e),ce(this,n)},r}(ee),fe=[["domainLookupStart","domainLookupEnd","DNS"],["connectStart","connectEnd","TCP"],["requestStart","responseStart","Request"],["responseStart","responseEnd","Response"],["domLoading","domComplete","Processing"],["loadEventStart","loadEventEnd","Load"]];function de(t){return{value:t}}function ve(t,e){var n=e.details,r=e.count,i=void 0===r?1:r,o=e.duration;return{transaction:t,span:n,samples:{"span.self_time.count":de(i),"span.self_time.sum.us":de(o)}}}var he=function(t){var e,n;function r(e,n,r){var i;return(i=t.call(this,e,n,r)||this).traceId=E(),i.marks=void 0,i.spans=[],i._activeSpans={},i.nextAutoTaskId=1,i._scheduledTasks=[],i.captureTimings=!1,i.breakdownTimings=[],i.sampled=Math.random()<=i.options.transactionSampleRate,i.browserResponsivenessCounter=0,i}n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n;var i=r.prototype;return i.addMarks=function(t){this.marks=j(this.marks||{},t)},i.mark=function(t){var e=M(t),n=P()-this._start,r={};r[e]=n,this.addMarks({custom:r})},i.canReuse=function(){var t=this.options.reuseThreshold||5e3;return!!this.options.canReuse&&!this.ended&&P()-this._start<t},i.redefine=function(t,e,n){t&&(this.name=t),e&&(this.type=e),n&&(this.options=F(this.options,n))},i.startSpan=function(t,e,n){var r=this;if(!this.ended){var i=F({},n);i.onEnd=function(t){r._onSpanEnd(t)},i.traceId=this.traceId,i.sampled=this.sampled,i.parentId||(i.parentId=this.id);var o=new ue(t,e,i);return this._activeSpans[o.id]=o,o}},i.isFinished=function(){return 0===this._scheduledTasks.length},i.detectFinish=function(){this.isFinished()&&this.end()},i.end=function(t){if(!this.ended){for(var e in this.ended=!0,this._end=q(t),this._activeSpans){var n=this._activeSpans[e];n.type=n.type+".truncated",n.end(t)}this.callOnEnd()}},i.captureBreakdown=function(){this.breakdownTimings=function(t,e){void 0===e&&(e=_.timing);var n=[],r=t.duration(),i=t.name,o=t.type,a=t.sampled,s={name:i,type:o};if(n.push({transaction:s,samples:{"transaction.duration.count":de(1),"transaction.duration.sum.us":de(r),"transaction.breakdown.count":de(a?1:0)}}),!a)return n;if(o===nt&&e)for(var c=0;c<fe.length;c++){var u=fe[c],f=H(e[u[0]],e[u[1]]);0!==f&&null!=f&&n.push(ve(s,{details:{type:u[2]},duration:f}))}else{var d=function(t){var e={},n=function(t){var e=t.spans,n=t._start,r=t._end;if(0===e.length)return t.duration();e.sort((function(t,e){return t._start-e._start}));for(var i=e[0],o=i._end,a=i._start,s=o,c=a-n,u=1;u<e.length;u++)a=(i=e[u])._start,o=i._end,a>s?(c+=a-s,s=o):o>s&&(s=o);return s<r&&(c+=r-s),c}(t);e.app={count:1,duration:n};for(var r=t.spans,i=0;i<r.length;i++){var o=r[i],a=o.duration();if(0!==a&&null!=a){var s=o.type,c=o.subType,u=s;c&&(u+="."+c),e[u]||(e[u]={duration:0,count:0}),e[u].count++,e[u].duration+=a}}return e}(t);Object.keys(d).forEach((function(t){var e=t.split("."),r=e[0],i=e[1],o=d[t],a=o.duration,c=o.count;n.push(ve(s,{details:{type:r,subtype:i},duration:a,count:c}))}))}return n}(this)},i.addTask=function(t){if(void 0===t&&(t="task"+this.nextAutoTaskId++),-1==this._scheduledTasks.indexOf(t))return this._scheduledTasks.push(t),t},i.removeTask=function(t){var e=this._scheduledTasks.indexOf(t);e>-1&&this._scheduledTasks.splice(e,1),this.detectFinish()},i.resetSpans=function(){this.spans=[]},i._onSpanEnd=function(t){this.spans.push(t),delete this._activeSpans[t.id]},i.isManaged=function(){return!!this.options.managed},r}(ee);function pe(t,e){var n=e.capturePaint,r={spans:function(t){for(var e=[],n=0;n<t.length;n++){var r=t[n],i=r.name,o=r.startTime,a=r.duration,s=r.attribution,c=o+a,u=new ue("Longtask("+i+")",vt,{startTime:o});if(s.length>0){var f=s[0],d=f.name,v=f.containerType,h=f.containerName,p=f.containerId,l={attribution:d,type:v};h&&(l.name=h),p&&(l.id=p),u.addContext({custom:l})}u.end(c),e.push(u)}return e}(t.getEntriesByType(vt)),marks:{}};if(!n)return r;var i=t.getEntriesByType(yt),o=i[i.length-1];if(!o)return r;var a=o.renderTime||o.loadTime;return r.marks.largestContentfulPaint=a,r}var le=function(){function t(t){this.po={observe:R,disconnect:R},window.PerformanceObserver&&(this.po=new PerformanceObserver(t))}var e=t.prototype;return e.start=function(t){try{var e=!0;t===vt&&(e=!1),this.po.observe({type:t,buffered:e})}catch(t){}},e.stop=function(){this.po.disconnect()},t}(),ge=[["domainLookupStart","domainLookupEnd","Domain lookup"],["connectStart","connectEnd","Making a connection to the server"],["requestStart","responseEnd","Requesting and receiving the document"],["domLoading","domInteractive","Parsing the document, executing sync. scripts"],["domContentLoadedEventStart","domContentLoadedEventEnd",'Fire "DOMContentLoaded" event'],["loadEventStart","loadEventEnd",'Fire "load" event']];function me(t,e,n,r,i){return void 0===i&&(i=0),"number"==typeof t&&"number"==typeof e&&t>=i&&e>t&&t-i>=n&&e-i<=r&&e-t<et&&t-i<et&&e-i<et}function ye(t){var e=t.name,n=t.initiatorType,r=t.startTime,i=t.responseEnd,o="resource";n&&(o+="."+n);var a=k(e),s=new ue(a,o);return s._start=r,s.end(i,{url:e,entry:t}),s}var Se=["fetchStart","domainLookupStart","domainLookupEnd","connectStart","connectEnd","secureConnectionStart","requestStart","responseStart","responseEnd","domLoading","domInteractive","domContentLoadedEventStart","domContentLoadedEventEnd","domComplete","loadEventStart","loadEventEnd"];function _e(){var t=function(){var t=_.timing,e=t.fetchStart,n={};return Se.forEach((function(r){var i=t[r];i&&i>=e&&(n[r]=i-e)})),n}(),e={timeToFirstByte:t.responseStart,domInteractive:t.domInteractive,domComplete:t.domComplete},n=function(){var t;if(D()){var e=_.getEntriesByType(ht);if(e.length>0){var n=_.timing,r=n.fetchStart-n.navigationStart,i=e.filter((function(t){return t.name===mt}))[0].startTime;t=r>=0?i-r:i}}return t}();return n&&(e.firstContentfulPaint=n),{navigationTiming:t,agent:e}}function be(t){if(t.captureTimings){var e=t._end;if(t.type===nt){if(t.marks&&t.marks.custom){var n=t.marks.custom;Object.keys(n).forEach((function(e){n[e]+=t._start}))}t._start=0;var r=_.timing;(function(t,e,n,r){for(var i=[],o=0;o<ge.length;o++){var a=t[ge[o][0]],s=t[ge[o][1]];if(me(a,s,n,r,e)){var c=new ue(ge[o][2],"hard-navigation.browser-timing");"requestStart"===ge[o][0]&&(c.pageResponse=!0),c._start=a-e,c.end(s-e),i.push(c)}}return i})(r,r.fetchStart,0,e).forEach((function(e){e.traceId=t.traceId,e.sampled=t.sampled,e.pageResponse&&t.options.pageLoadSpanId&&(e.id=t.options.pageLoadSpanId),t.spans.push(e)})),t.addMarks(_e())}if(D()){var i=t._start;(function(t,e,n,r){for(var i=[],o=0;o<t.length;o++){var a=t[o],s=a.initiatorType,c=a.name,u=a.startTime,f=a.responseEnd;if("xmlhttprequest"!==s&&"fetch"!==s&&c)if(-1!==tt.indexOf(s)){if(!me(u,f,n,r))continue;i.push(ye(t[o]))}else{if(null!=s)continue;for(var d=!1,v=0;v<e.length;v++){var h=c.lastIndexOf(e[v]);if(h>-1&&h===c.length-e[v].length){d=!0;break}}!d&&me(u,f,n,r)&&i.push(ye(t[o]))}}return i})(_.getEntriesByType(gt),function(t){for(var e=t.spans,n=[],r=0;r<e.length;r++){var i=e[r];"external"===i.type&&"http"===i.subType||n.push(i.name.split(" ")[1])}return n}(t),i,e).forEach((function(e){return t.spans.push(e)})),function(t,e,n){for(var r=[],i=0;i<t.length;i++){var o=t[i],a=o.name,s=o.startTime,c=o.duration,u=s+c;if(!(c<=at)&&me(s,u,e,n)){var f=new ue(a,"app");f._start=s,f.end(u),r.push(f)}}return r}(_.getEntriesByType(pt),i,e).forEach((function(e){return t.spans.push(e)}))}}}var Te=function(){function t(t,e){var n=this;this._config=e,this._logger=t,this.currentTransaction=void 0,this.respIntervalId=void 0,this.recorder=new le((function(t){var e=n.getCurrentTransaction();if(e&&e.captureTimings){var r,i=!1;e.type===nt&&(i=!0);var o=pe(t,{capturePaint:i}),a=o.spans,s=o.marks;(r=e.spans).push.apply(r,a),e.addMarks({agent:s})}}))}var e=t.prototype;return e.ensureCurrentTransaction=function(t,e,n){var r=this.getCurrentTransaction();return r||(r=new he(t,e,n),this.setCurrentTransaction(r),r)},e.getCurrentTransaction=function(){if(this.currentTransaction&&!this.currentTransaction.ended)return this.currentTransaction},e.setCurrentTransaction=function(t){this.currentTransaction=t},e.ensureRespInterval=function(t){var e=this,n=function(){clearInterval(e.respIntervalId),e.respIntervalId=void 0};t?void 0===this.respIntervalId&&(this.respIntervalId=setInterval((function(){var t=e.getCurrentTransaction();t?t.browserResponsivenessCounter++:n()}),500)):void 0!==this.respIntervalId&&n()},e.createOptions=function(t){var e=this._config.config,n=F({transactionSampleRate:e.transactionSampleRate},t);return n.managed&&(n=F({pageLoadTraceId:e.pageLoadTraceId,pageLoadSampled:e.pageLoadSampled,pageLoadSpanId:e.pageLoadSpanId,pageLoadTransactionName:e.pageLoadTransactionName},n)),n},e.startManagedTransaction=function(t,e,n){var r=this.getCurrentTransaction(),i=!1;if(r)if(r.canReuse()&&n.canReuse){var o;0;var a=ot.indexOf(r.type),s=ot.indexOf(e);-1!==a&&-1!==s&&s<a&&(o=e),r.redefine(t,o,n),i=!0}else r.end(),r=this.ensureCurrentTransaction(t,e,n);else r=this.ensureCurrentTransaction(t,e,n);var c=!0;return r.type===nt&&(i||this.recorder.start(yt),c=!1,n.pageLoadTraceId&&(r.traceId=n.pageLoadTraceId),n.pageLoadSampled&&(r.sampled=n.pageLoadSampled),r.name===it&&n.pageLoadTransactionName&&(r.name=n.pageLoadTransactionName)),!i&&this._config.get("monitorLongtasks")&&this.recorder.start(vt),r.sampled&&(r.captureTimings=!0),this.ensureRespInterval(c),r},e.startTransaction=function(t,e,n){var r,i=this,o=this.createOptions(n),a=!0;o.managed?this.currentTransaction===(r=this.startManagedTransaction(t,e,o))&&(a=!1):r=new he(t,e,o);return r.onEnd=function(){return i.handleTransactionEnd(r)},a&&this._config.events.send("transaction:start",[r]),r},e.handleTransactionEnd=function(t){var e=this;return this.recorder.stop(),y.resolve().then((function(){var n=t.name,r=t.type;if(!e.shouldIgnoreTransaction(n)&&"temporary"!==r){if(r===nt){var i=e._config.get("pageLoadTransactionName");n===it&&i&&(t.name=i)}be(t),e.adjustTransactionTime(t),e._config.get("breakdownMetrics")&&t.captureBreakdown();var o=e._config.get("context");!function(t,e){var n=L(),r={};if(t.type===nt&&D()){var i=_.getEntriesByType(lt);i&&i.length>0&&(r={response:ae(i[0])})}t.addContext(n,r,e)}(t,o),e._config.events.send("transaction:end",[t])}}),(function(t){0}))},e.adjustTransactionTime=function(t){var e=t.spans,n=function(t){for(var e=t[0],n=1;n<t.length;n++){var r=t[n];e._start>r._start&&(e=r)}return e}(e);n&&n._start<t._start&&(t._start=n._start);var r=function(t){for(var e=null,n=0;n<t.length;n++){var r=t[n];-1===String(r.type).indexOf("external")&&(!e||e._end<r._end)&&(e=r)}return e}(e);r&&r._end>t._end&&(t._end=r._end);for(var i=t._end,o=0;o<e.length;o++){var a=e[o];a._end>i&&(a._end=i,a.type+=".truncated"),a._start>i&&(a._start=i)}},e.shouldIgnoreTransaction=function(t){var e=this._config.get("ignoreTransactions");if(e&&e.length)for(var n=0;n<e.length;n++){var r=e[n];if("function"==typeof r.test){if(r.test(t))return!0}else if(r===t)return!0}return!1},e.startSpan=function(t,e,n){var r=this.ensureCurrentTransaction(void 0,"temporary",this.createOptions({canReuse:!0,managed:!0}));if(r)return r.startSpan(t,e,n)},e.addTask=function(t){var e=this.ensureCurrentTransaction(void 0,"temporary",this.createOptions({canReuse:!0,managed:!0}));if(e){t=e.addTask(t);0}return t},e.removeTask=function(t){var e=this.getCurrentTransaction();e&&e.removeTask(t)},t}(),we={PerformanceMonitoring:te,registerServices:function(t){t.registerServiceCreator("TransactionService",(function(){var e=t.getService("ConfigService"),n=t.getService("LoggingService");return new Te(n,e)})),t.registerServiceCreator("PerformanceMonitoring",(function(){var e=t.getService("ConfigService"),n=t.getService("LoggingService"),r=t.getService("ApmServer"),i=t.getService("TransactionService");return new te(r,e,n,i)}))}},Ee=function(){function t(t,e){e||(e={}),this.onFlush=t,this.items=[],this.queueLimit=e.queueLimit||-1,this.flushInterval=e.flushInterval||0,this.timeoutId=void 0}var e=t.prototype;return e._setTimer=function(){var t=this;this.timeoutId=setTimeout((function(){t.flush()}),this.flushInterval)},e.flush=function(){this.onFlush(this.items),this._clear()},e._clear=function(){void 0!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=void 0),this.items=[]},e.add=function(t){this.items.push(t),-1!==this.queueLimit&&this.items.length>=this.queueLimit?this.flush():void 0===this.timeoutId&&this._setTimer()},t}();var xe=function(t,e,n){var r,i=n.context||this,o=n.limit,a=n.interval,s=n.countFn||function(){},c=0;return function(){var n="function"==typeof s&&s.apply(i,arguments);return"number"!=typeof n&&(n=1),c+=n,void 0===r&&(r=setTimeout((function(){c=0,r=void 0}),a)),c>o?"function"==typeof e?e.apply(i,arguments):void 0:t.apply(i,arguments)}},Ce=function(){function t(){}return t.stringify=function(t){return JSON.stringify(t)+"\n"},t}(),Le=function(){function t(t,e){this._configService=t,this._loggingService=e,this.errorQueue=void 0,this.transactionQueue=void 0,this.throttleAddError=void 0,this.throttleAddTransaction=void 0,this.initialized=!1}var e=t.prototype;return e.init=function(){this.initialized||(this.initialized=!0,this.initErrorQueue(),this.initTransactionQueue())},e.createMetaData=function(){var t=this._configService,e={service:{name:t.get("serviceName"),version:t.get("serviceVersion"),agent:{name:"js-base",version:t.version},language:{name:"javascript"},environment:t.get("environment")},labels:t.get("context.tags")};return Vt(qt,e)},e._postJson=function(t,e){return this._makeHttpRequest("POST",t,{payload:e,headers:{"Content-Type":"application/x-ndjson"}}).then((function(t){return t.responseText}))},e._constructError=function(t){var e=t.url,n=t.status;t.responseText;if(void 0===n)return t;var r=e+" HTTP status: "+n;return new Error(r)},e._makeHttpRequest=function(t,e,n){var r=void 0===n?{timeout:1e4}:n,i=r.timeout,o=r.payload,a=r.headers;return new y((function(n,r){var s=new window.XMLHttpRequest;if(s[$]=!0,s.open(t,e,!0),s.timeout=i,a)for(var c in a)a.hasOwnProperty(c)&&s.setRequestHeader(c,a[c]);s.onreadystatechange=function(){if(4===s.readyState){var t=s.status,i=s.responseText;0===t||t>399&&t<600?r({url:e,status:t,responseText:i}):n(s)}},s.onerror=function(){var t=s.status,n=s.responseText;r({url:e,status:t,responseText:n})},s.send(o)}))},e._createQueue=function(t){var e=this._configService.get("queueLimit"),n=this._configService.get("flushInterval");return new Ee(t,{queueLimit:e,flushInterval:n})},e.fetchConfig=function(t,e){var n=this,r=this._configService.get("serverUrl")+"/config/v1/rum/agents";if(!t)return y.reject("serviceName is required for fetching central config.");r+="?service.name="+t,e&&(r+="&service.environment="+e);var i=this._configService.getLocalConfig();return i&&(r+="&ifnonematch="+i.etag),this._makeHttpRequest("GET",r,{timeout:5e3}).then((function(t){var e=t.status,r=t.responseText;if(304===e)return i;var o=JSON.parse(r),a=t.getResponseHeader("etag");return a&&(o.etag=a.replace(/["]/g,""),n._configService.setLocalConfig(o)),o})).catch((function(t){var e=n._constructError(t);return y.reject(e)}))},e.initErrorQueue=function(){var t=this;this.errorQueue&&this.errorQueue.flush(),this.errorQueue=this._createQueue((function(e){var n=t.sendErrors(e);n&&n.catch((function(e){t._loggingService.warn("Failed sending errors!",t._constructError(e))}))}));var e=this._configService.get("errorThrottleLimit"),n=this._configService.get("errorThrottleInterval");this.throttleAddError=xe(this.errorQueue.add.bind(this.errorQueue),(function(){return t._loggingService.warn("Dropped error due to throttling!")}),{limit:e,interval:n})},e.initTransactionQueue=function(){var t=this;this.transactionQueue&&this.transactionQueue.flush(),this.transactionQueue=this._createQueue((function(e){var n=t.sendTransactions(e);n&&n.catch((function(e){t._loggingService.warn("Failed sending transactions!",t._constructError(e))}))}));var e=this._configService.get("transactionThrottleLimit"),n=this._configService.get("transactionThrottleInterval");this.throttleAddTransaction=xe(this.transactionQueue.add.bind(this.transactionQueue),(function(){return t._loggingService.warn("Dropped transaction due to throttling!")}),{limit:e,interval:n})},e.addError=function(t){this.errorQueue||this.initErrorQueue(),this.throttleAddError(t)},e.addTransaction=function(t){this.transactionQueue||this.initTransactionQueue(),this.throttleAddTransaction(t)},e.ndjsonErrors=function(t){return t.map((function(t){return Ce.stringify({error:t})}))},e.ndjsonMetricsets=function(t){return t.map((function(t){return Ce.stringify({metricset:t})})).join("")},e.ndjsonTransactions=function(t){var e=this;return t.map((function(t){var n="";t.spans&&(n=t.spans.map((function(t){return Ce.stringify({span:t})})).join(""),delete t.spans);var r="";return t.breakdown&&(r=e.ndjsonMetricsets(t.breakdown),delete t.breakdown),Ce.stringify({transaction:t})+n+r}))},e._send=function(t,e){var n;if(void 0===t&&(t=[]),void 0===e&&(e="transactions"),0!==t.length){var r=((n={})[e]=t,n),i=this._configService.applyFilters(r);if(i){var o;if("errors"===e)o=this.ndjsonErrors(i[e]);else{if("transactions"!==e)return void 0;o=this.ndjsonTransactions(i[e])}var a=this.createMetaData();o.unshift(Ce.stringify({metadata:a}));var s=o.join(""),c=this._configService.get("serverUrl")+"/intake/v2/rum/events";return this._postJson(c,s)}this._loggingService.warn("Dropped payload due to filtering!")}},e.sendTransactions=function(t){return this._send(t)},e.sendErrors=function(t){return this._send(t,"errors")},t}();var ke=function(){function t(){this.config={},this.defaults={serviceName:"",serviceVersion:"",environment:"",serverUrl:"http://localhost:8200",active:!0,instrument:!0,disableInstrumentations:[],debug:!1,logLevel:"warn",breakdownMetrics:!1,ignoreTransactions:[],errorThrottleLimit:20,errorThrottleInterval:3e4,transactionThrottleLimit:20,transactionThrottleInterval:3e4,queueLimit:-1,flushInterval:500,distributedTracing:!0,distributedTracingOrigins:[],distributedTracingHeaderName:"elastic-apm-traceparent",pageLoadTraceId:"",pageLoadSpanId:"",pageLoadSampled:!1,pageLoadTransactionName:"",transactionSampleRate:1,centralConfig:!1,monitorLongtasks:!1,context:{}},this.events=new It,this.filters=[],this.version=""}var e=t.prototype;return e.init=function(){var t=function(t){if(!t)return{};for(var e={},n=/^data-([\w-]+)$/,r=t.attributes,i=0;i<r.length;i++){var o=r[i];if(n.test(o.nodeName)){var a=o.nodeName.match(n)[1].split("-").map((function(t,e){return e>0?t.charAt(0).toUpperCase()+t.substring(1):t})).join("");e[a]=o.value||o.nodeValue}}return e}(N());this.setConfig(t)},e.isActive=function(){return this.get("active")},e.setVersion=function(t){this.version=t},e.addFilter=function(t){if("function"!=typeof t)throw new Error("Argument to must be function");this.filters.push(t)},e.applyFilters=function(t){for(var e=0;e<this.filters.length;e++)if(!(t=this.filters[e](t)))return;return t},e.get=function(t){return t.split(".").reduce((function(t,e){return t&&t[e]}),this.config)},e.setUserContext=function(t){void 0===t&&(t={});var e={},n=t,r=n.id,i=n.username,o=n.email;"number"!=typeof r&&"string"!=typeof r||(e.id=r),"string"==typeof i&&(e.username=i),"string"==typeof o&&(e.email=o),this.config.context.user=F(this.config.context.user||{},e)},e.setCustomContext=function(t){void 0===t&&(t={}),this.config.context.custom=F(this.config.context.custom||{},t)},e.addLabels=function(t){var e=this;this.config.context.tags||(this.config.context.tags={}),Object.keys(t).forEach((function(n){return C(n,t[n],e.config.context.tags)}))},e.setConfig=function(t){void 0===t&&(t={}),t.serverUrl&&(t.serverUrl=t.serverUrl.replace(/\/+$/,"")),this.config=j({},this.defaults,this.config,t),this.events.send("config:change",[this.config])},e.validate=function(t){void 0===t&&(t={});var e=["serviceName","serverUrl"],n={missing:[],invalid:[]};Object.keys(t).forEach((function(r){-1===e.indexOf(r)||t[r]||n.missing.push(r)})),t.serviceName&&!/^[a-zA-Z0-9 _-]+$/.test(t.serviceName)&&n.invalid.push({key:"serviceName",value:t.serviceName,allowed:"a-z, A-Z, 0-9, _, -, <space>"});var r=t.transactionSampleRate;return void 0!==r&&("number"!=typeof r||isNaN(r)||r<0||r>1)&&n.invalid.push({key:"transactionSampleRate",value:r,allowed:"Number between 0 and 1"}),n},e.getLocalConfig=function(){var t=sessionStorage.getItem("elastic_apm_config");if(t)return JSON.parse(t)},e.setLocalConfig=function(t){t&&sessionStorage.setItem("elastic_apm_config",JSON.stringify(t))},t}(),Ie=function(){function t(t){void 0===t&&(t={}),this.levels=["trace","debug","info","warn","error"],this.level=t.level||"info",this.prefix=t.prefix||"",this.resetLogMethods()}var e=t.prototype;return e.shouldLog=function(t){return this.levels.indexOf(t)>=this.levels.indexOf(this.level)},e.setLevel=function(t){this.level=t,this.resetLogMethods()},e.resetLogMethods=function(){var t=this;this.levels.forEach((function(e){t[e]=t.shouldLog(e)?function(){var n,r=t.prefix;switch(e){case"trace":case"debug":n="info";break;default:n=e}var i=arguments;r&&(i[0]=r+i[0]);if(console){var o=console[n]||console.log;"function"==typeof o&&o.apply(console,i)}}:R}))},t}(),Oe=function(){function t(){this._serviceCreators={},this._serviceInstances={},this.initialized=!1}var e=t.prototype;return e.registerCoreServices=function(){var t=this;this.registerServiceCreator("ConfigService",(function(){return new ke})),this.registerServiceCreator("LoggingService",(function(){return new Ie({prefix:"[Elastic APM] "})})),this.registerServiceCreator("ApmServer",(function(){return new Le(t.getService("ConfigService"),t.getService("LoggingService"))}))},e.init=function(){if(!this.initialized){this.initialized=!0;var t=this.getService("ConfigService");t.init();var e=this.getService("LoggingService");n(e,t),t.events.observe("config:change",(function(){n(e,t)})),this.getService("ApmServer").init()}function n(t,e){var n=e.get("debug"),r=e.get("logLevel");!0===n&&"trace"!==r?t.setLevel("debug"):t.setLevel(r)}},e.registerServiceCreator=function(t,e){this._serviceCreators[t]=e},e.registerServiceInstance=function(t,e){this._serviceInstances[t]=e},e.getService=function(t){if(!this._serviceInstances[t]){if("function"!=typeof this._serviceCreators[t])throw new Error("Can not get service, No creator for: "+t);this._serviceInstances[t]=this._serviceCreators[t](this)}return this._serviceInstances[t]},t}();var Ne=function(){function t(t,e){this._disable=e,this.serviceFactory=t,this._initialized=!1}var e=t.prototype;return e.init=function(t){var e=this;if(this.isEnabled()&&!this._initialized){this._initialized=!0;var n=this.serviceFactory.getService("ConfigService");n.setVersion("4.9.0"),this.config(t);var r=this.serviceFactory.getService("LoggingService");if(n.isActive()){this.serviceFactory.init();var i=function(t,e){var n,r=((n={})[st]=!1,n[ct]=!1,n[ut]=!1,n[nt]=!1,n[dt]=!1,n[ft]=!1,n);return t?(Object.keys(r).forEach((function(t){-1===e.indexOf(t)&&(r[t]=!0)})),r):r}(n.get("instrument"),n.get("disableInstrumentations"));if(this.serviceFactory.getService("PerformanceMonitoring").init(i),i[dt])this.serviceFactory.getService("ErrorLogging").registerListeners();var o=function(){return i[nt]&&e._sendPageLoadMetrics()};n.get("centralConfig")?this.fetchCentralConfig().then(o):o()}else this._disable=!0,r.info("RUM agent is inactive")}return this},e.fetchCentralConfig=function(){var t=this.serviceFactory.getService("ApmServer"),e=this.serviceFactory.getService("LoggingService"),n=this.serviceFactory.getService("ConfigService");return t.fetchConfig(n.get("serviceName"),n.get("environment")).then((function(t){var r=t.transaction_sample_rate;if(r){var i={transactionSampleRate:r=Number(r)},o=n.validate(i).invalid;if(0===o.length)n.setConfig(i);else{var a=o[0],s=a.key,c=a.value,u=a.allowed;e.warn('invalid value "'+c+'" for '+s+". Allowed: "+u+".")}}return t})).catch((function(t){e.warn("failed fetching config:",t)}))},e._sendPageLoadMetrics=function(){var t=this.startTransaction(void 0,nt,{managed:!0,canReuse:!0});t&&t.addTask(nt);var e=function(){setTimeout((function(){t&&t.removeTask(nt)}))};"complete"===document.readyState?e():window.addEventListener("load",e)},e.isEnabled=function(){return!this._disable},e.observe=function(t,e){this.serviceFactory.getService("ConfigService").events.observe(t,e)},e.config=function(t){var e=this.serviceFactory.getService("ConfigService"),n=e.validate(t),r=n.missing,i=n.invalid;if(0===r.length&&0===i.length)e.setConfig(t);else{var o=this.serviceFactory.getService("LoggingService"),a="RUM agent isn't correctly configured. ";r.length>0&&(a+=r.join(", ")+" is missing",i.length>0&&(a+=", ")),i.forEach((function(t,e){var n=t.key,r=t.value,o=t.allowed;a+=n+' "'+r+'" contains invalid characters! (allowed: '+o+")"+(e!==i.length-1?", ":"")})),o.error(a),e.setConfig({active:!1})}},e.setUserContext=function(t){this.serviceFactory.getService("ConfigService").setUserContext(t)},e.setCustomContext=function(t){this.serviceFactory.getService("ConfigService").setCustomContext(t)},e.addTags=function(t){this.serviceFactory.getService("LoggingService").warn("addTags deprecated, please use addLabels"),this.addLabels(t)},e.addLabels=function(t){this.serviceFactory.getService("ConfigService").addLabels(t)},e.setInitialPageLoadName=function(t){this.isEnabled()&&this.serviceFactory.getService("ConfigService").setConfig({pageLoadTransactionName:t})},e.startTransaction=function(t,e,n){if(this.isEnabled())return this.serviceFactory.getService("TransactionService").startTransaction(t,e,n)},e.startSpan=function(t,e){if(this.isEnabled())return this.serviceFactory.getService("TransactionService").startSpan(t,e)},e.getCurrentTransaction=function(){if(this.isEnabled())return this.serviceFactory.getService("TransactionService").getCurrentTransaction()},e.captureError=function(t){if(this.isEnabled())return this.serviceFactory.getService("ErrorLogging").logError(t)},e.addFilter=function(t){this.serviceFactory.getService("ConfigService").addFilter(t)},t}();n.d(e,"init",(function(){return Me})),n.d(e,"apmBase",(function(){return Re})),n.d(e,"apm",(function(){return Re})),n.d(e,"ApmBase",(function(){return Ne}));var Fe,je=jt?At:(jt=!0,x()?(Ft(),At=!0):"undefined"!=typeof window&&console.log("[Elastic APM] platform is not supported!"),At),Ae=((Fe=new Oe).registerCoreServices(),Zt.registerServices(Fe),we.registerServices(Fe),Fe),Re=new Ne(Ae,!je);"undefined"!=typeof window&&(window.elasticApm=Re);var Me=Re.init.bind(Re);e.default=Me}]); | ||
//# sourceMappingURL=elastic-apm-rum.umd.min.js.map |
@@ -18,3 +18,3 @@ import { getInstrumentationFlags, PAGE_LOAD, ERROR } from '@elastic/apm-rum-core'; | ||
var configService = this.serviceFactory.getService('ConfigService'); | ||
configService.setVersion('4.8.1'); | ||
configService.setVersion('4.9.0'); | ||
this.config(config); | ||
@@ -21,0 +21,0 @@ var loggingService = this.serviceFactory.getService('LoggingService'); |
@@ -23,3 +23,3 @@ "use strict"; | ||
var configService = this.serviceFactory.getService('ConfigService'); | ||
configService.setVersion('4.8.1'); | ||
configService.setVersion('4.9.0'); | ||
this.config(config); | ||
@@ -26,0 +26,0 @@ var loggingService = this.serviceFactory.getService('LoggingService'); |
@@ -68,12 +68,12 @@ | ||
--- | ||
This product relies on es6-promise | ||
This product relies on opentracing | ||
Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors | ||
Copyright (c) 2016 Resonance Labs, Inc | ||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
of the Software, and to permit persons to whom the Software is furnished to do | ||
so, subject to the following conditions: | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
@@ -94,5 +94,6 @@ The above copyright notice and this permission notice shall be included in all | ||
--- | ||
This product relies on opentracing | ||
This product relies on promise-polyfill | ||
Copyright (c) 2016 Resonance Labs, Inc | ||
Copyright (c) 2014 Taylor Hakes | ||
Copyright (c) 2014 Forbes Lindesay | ||
@@ -106,4 +107,4 @@ Permission is hereby granted, free of charge, to any person obtaining a copy | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
@@ -115,7 +116,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
--- | ||
@@ -122,0 +122,0 @@ This product relies on uuid |
{ | ||
"name": "@elastic/apm-rum", | ||
"version": "4.8.1", | ||
"version": "4.9.0", | ||
"description": "Elastic APM JavaScript agent", | ||
@@ -49,3 +49,3 @@ "main": "dist/lib/index.js", | ||
"dependencies": { | ||
"@elastic/apm-rum-core": "^4.9.1" | ||
"@elastic/apm-rum-core": "^4.10.0" | ||
}, | ||
@@ -62,3 +62,3 @@ "bundlesize": [ | ||
], | ||
"gitHead": "2ef506ab1fc3a92d643e96edf0e226ac39b238e4" | ||
"gitHead": "99dd9f195210480728d39c45e18f4ad3c7733ed2" | ||
} |
@@ -46,3 +46,3 @@ /** | ||
*/ | ||
configService.setVersion('4.8.1') | ||
configService.setVersion('4.9.0') | ||
this.config(config) | ||
@@ -49,0 +49,0 @@ const loggingService = this.serviceFactory.getService('LoggingService') |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1705097
24
12384