@elastic/apm-rum
Advanced tools
Comparing version 5.5.0 to 5.6.0
@@ -6,2 +6,18 @@ # Change Log | ||
# [5.6.0](https://github.com/elastic/apm-agent-rum-js/compare/@elastic/apm-rum@5.5.0...@elastic/apm-rum@5.6.0) (2020-09-17) | ||
### Bug Fixes | ||
* **rum:** do not instrument frameworks when agent is inactive ([#885](https://github.com/elastic/apm-agent-rum-js/issues/885)) ([861a499](https://github.com/elastic/apm-agent-rum-js/commit/861a499b0fa6f524e590a2e8368e8e1a2bbac684)) | ||
### Features | ||
* **rum:** add missing methods to types ([#890](https://github.com/elastic/apm-agent-rum-js/issues/890)) ([541e4aa](https://github.com/elastic/apm-agent-rum-js/commit/541e4aacc15a568673bb0189e9907ec35bd8394b)) | ||
# [5.5.0](https://github.com/elastic/apm-agent-rum-js/compare/@elastic/apm-rum@5.4.0...@elastic/apm-rum@5.5.0) (2020-08-18) | ||
@@ -8,0 +24,0 @@ |
@@ -1,2 +0,2 @@ | ||
!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=10)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FORMAT_BINARY="binary",e.FORMAT_TEXT_MAP="text_map",e.FORMAT_HTTP_HEADERS="http_headers",e.REFERENCE_CHILD_OF="child_of",e.REFERENCE_FOLLOWS_FROM="follows_from"},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(3),i=function(){function t(){}return t.prototype.context=function(){return this._context()},t.prototype.tracer=function(){return this._tracer()},t.prototype.setOperationName=function(t){return this._setOperationName(t),this},t.prototype.setBaggageItem=function(t,e){return this._setBaggageItem(t,e),this},t.prototype.getBaggageItem=function(t){return this._getBaggageItem(t)},t.prototype.setTag=function(t,e){return this._addTags(((n={})[t]=e,n)),this;var n},t.prototype.addTags=function(t){return this._addTags(t),this},t.prototype.log=function(t,e){return this._log(t,e),this},t.prototype.logEvent=function(t,e){return this._log({event:t,payload:e})},t.prototype.finish=function(t){this._finish(t)},t.prototype._context=function(){return r.spanContext},t.prototype._tracer=function(){return r.tracer},t.prototype._setOperationName=function(t){},t.prototype._setBaggageItem=function(t,e){},t.prototype._getBaggageItem=function(t){},t.prototype._addTags=function(t){},t.prototype._log=function(t,e){},t.prototype._finish=function(t){},t}();e.Span=i,e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(7),i=n(3),a=n(1),o=function(){function t(){}return t.prototype.startSpan=function(t,e){if(void 0===e&&(e={}),e.childOf){var n=r.childOf(e.childOf);e.references?e.references.push(n):e.references=[n],delete e.childOf}return this._startSpan(t,e)},t.prototype.inject=function(t,e,n){return t instanceof a.default&&(t=t.context()),this._inject(t,e,n)},t.prototype.extract=function(t,e){return this._extract(t,e)},t.prototype._startSpan=function(t,e){return i.span},t.prototype._inject=function(t,e,n){},t.prototype._extract=function(t,e){return i.spanContext},t}();e.Tracer=o,e.default=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),i=n(9),a=n(2);e.tracer=null,e.spanContext=null,e.span=null,e.initialize=function(){e.tracer=new a.default,e.span=new r.default,e.spanContext=new i.default}},function(t,e,n){var r,i,a;!function(o,s){"use strict";i=[n(6)],void 0===(a="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 a(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(a(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,a=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,a,r[1],r[2],e)}),this)},parseFFOrSafari:function(e){return i(a(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=[],a=2,o=r.length;a<o;a+=2){var s=n.exec(r[a]);s&&i.push(new t(void 0,void 0,s[2],s[1],void 0,r[a]))}return i},parseOpera10:function(e){for(var n=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=e.stacktrace.split("\n"),i=[],a=0,o=r.length;a<o;a+=2){var s=n.exec(r[a]);s&&i.push(new t(s[3]||void 0,void 0,s[2],s[1],void 0,r[a]))}return i},parseOpera11:function(n){return i(a(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()),a=r.shift()||"",o=a.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^\)]*\)/g,"")||void 0;a.match(/\(([^\)]*)\)/)&&(n=a.replace(/^[^\(]+\(([^\)]*)\)$/,"$1"));var s=void 0===n||"[arguments not available]"===n?void 0:n.split(",");return new t(o,s,i[0],i[1],i[2],e)}),this)}}})?r.apply(e,i):r)||(t.exports=a)}()},,function(t,e,n){var r,i,a;!function(n,o){"use strict";i=[],void 0===(a="function"==typeof(r=function(){function t(t){return!isNaN(parseFloat(t))&&isFinite(t)}function e(t,e,n,r,i,a){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!==a&&this.setSource(a)}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=a)}()},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),i=n(8),a=n(1);e.childOf=function(t){return t instanceof a.default&&(t=t.context()),new i.default(r.REFERENCE_CHILD_OF,t)},e.followsFrom=function(t){return t instanceof a.default&&(t=t.context()),new i.default(r.REFERENCE_FOLLOWS_FROM,t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),i=function(){function t(t,e){this._type=t,this._referencedContext=e instanceof r.default?e.context():e}return t.prototype.type=function(){return this._type},t.prototype.referencedContext=function(){return this._referencedContext},t}();e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){};e.SpanContext=r,e.default=r},function(t,e,n){"use strict";n.r(e),n.d(e,"createTracer",(function(){return Qe})),n.d(e,"init",(function(){return Je})),n.d(e,"apm",(function(){return Xe})),n.d(e,"apmBase",(function(){return Xe})),n.d(e,"ApmBase",(function(){return Ve}));var r=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)}))}))},i=setTimeout;function a(t){return Boolean(t&&void 0!==t.length)}function o(){}function s(t){if(!(this instanceof s))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 c(t,e){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,s._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 f(e.promise,t)}u(e.promise,r)}else(1===t._state?u:f)(e.promise,t._value)}))):t._deferreds.push(e)}function u(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 s)return t._state=3,t._value=e,void d(t);if("function"==typeof n)return void l((r=n,i=e,function(){r.apply(i,arguments)}),t)}t._state=1,t._value=e,d(t)}catch(e){f(t,e)}var r,i}function f(t,e){t._state=2,t._value=e,d(t)}function d(t){2===t._state&&0===t._deferreds.length&&s._immediateFn((function(){t._handled||s._unhandledRejectionFn(t._value)}));for(var e=0,n=t._deferreds.length;e<n;e++)c(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,u(e,t))}),(function(t){n||(n=!0,f(e,t))}))}catch(t){if(n)return;n=!0,f(e,t)}}s.prototype.catch=function(t){return this.then(null,t)},s.prototype.then=function(t,e){var n=new this.constructor(o);return c(this,new p(t,e,n)),n},s.prototype.finally=r,s.all=function(t){return new s((function(e,n){if(!a(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 s=0;s<r.length;s++)o(s,r[s])}))},s.resolve=function(t){return t&&"object"==typeof t&&t.constructor===s?t:new s((function(e){e(t)}))},s.reject=function(t){return new s((function(e,n){n(t)}))},s.race=function(t){return new s((function(e,n){if(!a(t))return n(new TypeError("Promise.race accepts an array"));for(var r=0,i=t.length;r<i;r++)s.resolve(t[r]).then(e,n)}))},s._immediateFn="function"==typeof setImmediate&&function(t){setImmediate(t)}||function(t){i(t,0)},s._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};var v=s,h={};y?h=window:"undefined"!=typeof self&&(h=self);var g="Promise"in h?h.Promise:v,m=[].slice,y="undefined"!=typeof window,_=y&&"undefined"!=typeof performance?performance:{};for(var b=[],S=0;S<256;++S)b[S]=(S+256).toString(16).substr(1);var T=new Uint8Array(16);function w(t){return function(t){for(var e=[],n=0;n<t.length;n++)e.push(b[t[n]]);return e.join("")}("undefined"!=typeof crypto&&"function"==typeof crypto.getRandomValues?crypto.getRandomValues(T):"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues?msCrypto.getRandomValues(T):T).substr(0,t)}function E(t,e){var n=!1;return"string"==typeof e?n=t===e:Array.isArray(e)&&e.forEach((function(e){n||(n=E(t,e))})),n}function x(){return y&&"function"==typeof Set&&"function"==typeof JSON.stringify&&_&&"function"==typeof _.now&&"withCredentials"in new window.XMLHttpRequest}function O(t,e,n){if(n&&t){var r=M(t),i=typeof e;return null!=e&&"boolean"!==i&&"number"!==i&&(e=String(e)),n[r]=e,n}}function L(){return _.timing.fetchStart}function k(t){return t&&t.split("?")[0]}function C(t){return null!==t&&"object"==typeof t}function N(t,e,n){for(var r=0,i=e.length;r<i;++r){var a=e[r];if(C(a)||"function"==typeof a)for(var o=Object.keys(a),s=0,c=o.length;s<c;s++){var u=o[s],f=a[u];n&&C(f)?(C(t[u])||(t[u]=Array.isArray(f)?[]:{}),N(t[u],[f],!1)):t[u]=f}}return t}function I(){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 j(t){return N(t,m.call(arguments,1),!1)}function F(t){return N(t,m.call(arguments,1),!0)}function R(t){return void 0===t}function A(){}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 R(e)||R(t)?null:parseInt(e-t)}function B(t){g.resolve().then(t)}function D(){return"function"==typeof _.getEntriesByType}function z(t){return"undefined"!=typeof PerformanceObserver&&PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.indexOf(t)>=0}var U={fetchInProgress:!1};function $(t){return"__apm_symbol__"+t}function V(t,e,n){for(var r=t;r&&!r.hasOwnProperty(e);)r=Object.getPrototypeOf(r);!r&&t[e]&&(r=t);var i,a,o,s,c=$(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)},a=r[e],o=i,a[$("OriginalDelegate")]=o}}return i}var X=$("xhrIgnore"),J=$("xhrSync"),W=$("xhrURL"),Y=$("xhrMethod"),Z="schedule",G="invoke",K="addEventListener",Q="removeEventListener",tt=["link","css","script","img","xmlhttprequest","fetch","beacon","iframe"],et=3e5,nt="page-load",rt="custom",it="Unknown",at=[nt,"route-change","user-interaction","http-request",rt,"temporary"],ot=60,st="xmlhttprequest",ct="fetch",ut="history",ft="eventtarget",dt="error",pt="longtask",lt="measure",vt="navigation",ht="resource",gt="first-contentful-paint",mt="largest-contentful-paint",yt="first-input",_t="layout-shift",bt="ConfigService",St="LoggingService",Tt="ApmServer",wt=".truncated",Et=1024;function xt(t){var e=XMLHttpRequest.prototype;if(e&&e[K])var n="readystatechange",r="load",i="error",a="timeout",o="abort",s=V(e,"open",(function(){return function(t,e){return t[X]||(t[Y]=e[0],t[W]=e[1],t[J]=!1===e[2]),s.apply(t,e)}})),c=V(e,"send",(function(){return function(e,s){if(e[X])return c.apply(e,s);var f={source:st,state:"",type:"macroTask",data:{target:e,method:e[Y],sync:e[J],url:e[W],status:""}};try{return function(e){if(e.state!==Z){e.state=Z,t(Z,e);var s=e.data.target;c(n),c(r),c(a),c(i),c(o)}function c(t){s[K](t,(function(t){var i=t.type;i===n?4===s.readyState&&0!==s.status&&u(e,"success"):u(e,i===r?"success":i)}))}}(f),c.apply(e,s)}catch(t){throw u(f,i),t}}}));function u(e,n){e.state!==G&&(e.state=G,e.data.status=n,t(G,e))}}for(var Ot=["click"],Lt={},kt=0;kt<Ot.length;kt++){var Ct=Ot[kt];Lt[Ct]=$(Ct)}function Nt(t,e,n){return t instanceof Element&&Ot.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}(),jt=new It,Ft=!1;function Rt(){return Ft||(Ft=!0,xt((function(t,e){jt.send(st,[t,e])})),function(t){if(window.fetch&&window.Request){var e=window.fetch;window.fetch=function(t,i){var a,o,s=this,c=arguments;if("string"==typeof t)a=new Request(t,i),o=t;else{if(!t)return e.apply(s,c);o=(a=t).url}var u={source:ct,state:"",type:"macroTask",data:{target:a,method:a.method,url:o,aborted:!1}};return new g((function(t,i){var o;U.fetchInProgress=!0,n(u);try{o=e.apply(s,[a])}catch(t){return i(t),u.data.error=t,r(u),void(U.fetchInProgress=!1)}o.then((function(e){t(e),B((function(){u.data.response=e,r(u)}))}),(function(t){i(t),B((function(){u.data.error=t,r(u)}))})),U.fetchInProgress=!1}))}}function n(e){e.state=Z,t(Z,e)}function r(e){e.state=G,t(G,e)}}((function(t,e){jt.send(ct,[t,e])})),function(t){if(window.history){var e=history.pushState;"function"==typeof e&&(history.pushState=function(n,r,i){var a={source:ut,data:{state:n,title:r,url:i}};t(G,a),e.apply(this,arguments)})}}((function(t,e){jt.send(ut,[t,e])})),function(t){if(window.EventTarget){var e=window.EventTarget.prototype,n=e[K],r=e[Q];e[K]=function(t,e,r){var i=this;if(!Nt(i,t,e))return n.apply(i,arguments);var a=o(i,t,e,r),s=Array.prototype.slice.call(arguments);return s[1]=a,n.apply(i,s)},e[Q]=function(t,e,n){var i=this;if(!Nt(i,t,e))return r.apply(i,arguments);var a=s(i,t,e,n),o=Array.prototype.slice.call(arguments);return o[1]=a,r.apply(i,o)}}function i(t,e,n,r){for(var i=0;i<t.length;i++){var a=t[i];if(a.eventType===e&&a.listenerFn===n&&a.capture===r)return i}return-1}function a(t){return"boolean"==typeof t?t:!!t&&!!t.capture}function o(e,n,r,o){var s=Lt[n];if(!s)return r;var c=e[s],u=a(o);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:p};function p(){var e;t(Z,d);try{e=r.apply(this,arguments)}finally{t(G,d)}return e}return c.push(d),p}function s(t,e,n,r){var o=Lt[e],s=t[o];if(s){var c=i(s,e,n,a(r));if(-1!==c){var u=s[c];return s.splice(c,1),0===s.length&&(t[o]=void 0),u.wrappingFn}}return n}}((function(t,e){jt.send(ft,[t,e])}))),jt}var At={bootstrapTime:null,lastHiddenStart:Number.MIN_SAFE_INTEGER},Mt=!1;function Pt(){return x()?(Rt(),function(){"hidden"===document.visibilityState&&(At.lastHiddenStart=0);window.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState&&(At.lastHiddenStart=performance.now())}),{capture:!0})}(),At.bootstrapTime=P(),Mt=!0):y&&console.log("[Elastic APM] platform is not supported!"),Mt}var qt=n(4),Ht=n.n(qt);function Bt(t){var e=t.error,n=t.filename,r=t.lineno,i=t.colno,a=[];if(e)try{a=Ht.a.parse(e)}catch(t){}return 0===a.length&&(a=[{fileName:n,lineNumber:r,columnNumber:i}]),a.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,a=void 0===i?"<anonymous>":i;if(!e&&!n)return{};if(!r&&!n)return{};var o,s,c=function(t){return void 0===t&&(t=""),"<anonymous>"===t&&(t=""),t}(e),u=(o=c,s=window.location.origin||window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:""),o.indexOf(s)>-1&&(o=o.replace(s+"/","")),o);return function(t){return!!t&&0===window.location.href.indexOf(t)}(c)&&(u="(inline script)"),{abs_path:e,filename:u,function:a,lineno:n,colno:r}}))}var Dt=[["#","hash"],["?","query"],["/","path"],["@","auth",1],[NaN,"host",void 0,1]],zt=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,Ut=function(){function t(t){var e,n=this.extractProtocol(t||""),r=n.protocol,i=n.address,a=n.slashes,o=!r&&!a,s=this.getLocation(),c=Dt.slice();i=i.replace("\\","/"),a||(c[2]=[NaN,"path"]);for(var u=0;u<c.length;u++){var f=c[u],d=f[0],p=f[1];if("string"==typeof d){if(~(e=i.indexOf(d))){var l=f[2];if(l){var v=i.lastIndexOf(d);e=Math.max(e,v),this[p]=i.slice(0,e),i=i.slice(e+l)}else this[p]=i.slice(e),i=i.slice(0,e)}}else this[p]=i,i="";this[p]=this[p]||o&&f[3]&&s[p]||"",f[3]&&(this[p]=this[p].toLowerCase())}if(o&&"/"!==this.path.charAt(0)&&(this.path="/"+this.path),this.relative=o,this.protocol=r||s.protocol,this.hostname=this.host,this.port="",/:\d+$/.test(this.host)){var h=this.host.split(":"),g=h.pop(),m=h.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 y&&(t=window),t.location},e.extractProtocol=function(t){var e=zt.exec(t);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!e[2],address:e[3]}},t}();var $t=91,Vt=93,Xt="external",Jt="resource",Wt="hard-navigation";function Yt(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,a=r.duration,o=r.description,s=i;o&&(s+=";desc="+o),a&&(s+=";dur="+a),e.push(s)}return e.join(", ")}(t.serverTiming);return n&&(e.headers={"server-timing":n}),e}function Zt(t,e){var n=t.port,r=t.protocol,i=t.hostname,a=t.host,o=function(t,e){return""===t&&(t="http:"===e?"80":"https:"===e?"443":""),t}(n,r),s=i.charCodeAt(0)===$t&&i.charCodeAt(i.length-1)===Vt,c=i;return s&&(c=i.slice(1,-1)),{service:{name:r+"//"+a,resource:i+":"+o,type:e},address:c,port:Number(o)}}function Gt(){return{page:{referer:document.referrer,url:location.href}}}function Kt(t,e){if(e){var n;switch(t.type){case Xt:n=function(t){var e,n=t.url,r=t.method,i=t.target,a=t.response,o=new Ut(n),s=Zt(o,Xt),c={http:{method:r,url:o.href},destination:s};return i&&void 0!==i.status?e=i.status:a&&(e=a.status),c.http.status_code=e,c}(e);break;case Jt:n=function(t){var e=t.entry,n=t.url,r=Zt(new Ut(n),Jt);return{http:{url:n,response:Yt(e)},destination:r}}(e);break;case Wt:n=function(t){var e=t.url;return{destination:Zt(new Ut(e),Wt)}}(e)}t.addContext(n)}}function Qt(t,e){var n=void 0===e?{}:e,r=(n.tags,function(t,e){if(null==t)return{};var n,r,i={},a=Object.keys(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)>=0||(i[n]=t[n]);return i}(n,["tags"])),i=Gt(),a={};if(t.type===nt&&D()){var o=_.getEntriesByType(vt);o&&o.length>0&&(a={response:Yt(o[0])})}t.addContext(i,a,r)}var te={service:{name:[Et,!0],version:!0,agent:{version:[Et,!0]},environment:!0},labels:{"*":!0}},ee={"*":!0,headers:{"*":!0}},ne={user:{id:!0,email:!0,username:!0},tags:{"*":!0},http:{response:ee},destination:{address:[Et],service:{"*":[Et,!0]}},response:ee},re={name:[Et,!0],type:[Et,!0],id:[Et,!0],trace_id:[Et,!0],parent_id:[Et,!0],transaction_id:[Et,!0],subtype:!0,action:!0,context:ne},ie={name:!0,parent_id:!0,type:[Et,!0],id:[Et,!0],trace_id:[Et,!0],span_count:{started:[Et,!0]},context:ne},ae={id:[Et,!0],trace_id:!0,transaction_id:!0,parent_id:!0,culprit:!0,exception:{type:!0},transaction:{type:!0},context:ne};function oe(t){return null==t||""===t||void 0===t}function se(t,e,n){var r=function(t,e,n,r){return void 0===e&&(e=Et),void 0===n&&(n=!1),void 0===r&&(r="N/A"),n&&oe(t)&&(t=r),"string"==typeof t?t.substring(0,e):t}(t[e],n[0],n[1]);oe(r)?delete t[e]:t[e]=r}function ce(t,e,n){void 0===t&&(t={}),void 0===n&&(n=e);for(var r=Object.keys(t),i=[],a=function(a){var o=r[a],s=!0===t[o]?i:t[o];Array.isArray(s)?"*"===o?Object.keys(n).forEach((function(t){return se(n,t,s)})):se(n,o,s):ce(s,e,n[o])},o=0;o<r.length;o++)a(o);return e}var ue=["stack","message"];var fe=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}))}(Bt(t)),n="(inline script)",r=e[e.length-1];r&&r.filename&&(n=r.filename);var i=t.message,a=t.error,o=i,s="",c={};if(a&&"object"==typeof a){o=o||a.message,s=a.name;var u=function(t){var e=!1,n={};if(Object.keys(t).forEach((function(r){if(!(ue.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}(a);u&&(c.custom=u)}s||o&&o.indexOf(":")>-1&&(s=o.split(":")[0]);var f=this._transactionService.getCurrentTransaction(),d=f?f.context:{},p=this._configService.get("context"),l=(p.tags,function(t,e){if(null==t)return{};var n,r,i={},a=Object.keys(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)>=0||(i[n]=t[n]);return i}(p,["tags"])),v=F({},Gt(),d,l,c),h={id:w(),culprit:n,exception:{message:o,stacktrace:e,type:s},context:v};return f&&(h=j(h,{trace_id:f.traceId,parent_id:f.id,transaction_id:f.id,transaction:{type:f.type,sampled:f.sampled}})),ce(ae,h)},e.logErrorEvent=function(t){if(void 0!==t){var e=this.createErrorDataModel(t);void 0!==e.exception.message&&this._apmServer.addError(e)}},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,n="Unhandled promise rejection: ",r=t.reason,i=void 0===r?"<no reason specified>":r;"string"==typeof i.message?e={error:i,message:n+(i.name?i.name+": ":"")+i.message}:e={message:n+(i="object"==typeof i?"<object>":"function"==typeof i?"<function>":i)};this.logErrorEvent(e)},e.logError=function(t){var e={};return"string"==typeof t?e.message=t:e.error=t,this.logErrorEvent(e)},t}(),de=function(){function t(t,e){void 0===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(){return t.flush()}),this.flushInterval)},e._clear=function(){void 0!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=void 0),this.items=[]},e.flush=function(){this.onFlush(this.items),this._clear()},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 pe=function(){function t(){}return t.stringify=function(t){return JSON.stringify(t)+"\n"},t}(),le=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||w(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.addLabels=function(t){this.ensureContext();var e=this.context;e.tags||(e.tags={}),Object.keys(t).forEach((function(n){return O(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(),F.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}();var ve=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 a=i.type.split(".",3);i.type=a[0],i.subtype=a[1],i.action=a[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),Kt(this,n)},r}(le),he=[["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 ge(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 me(t){var e=t.name,n=t.initiatorType,r=t.startTime,i=t.responseEnd,a="resource";n&&(a+="."+n);var o=k(e),s=new ve(o,a);return s._start=r,s.end(i,{url:e,entry:t}),s}function ye(t,e){return null!=e&&t>e}var _e=["fetchStart","domainLookupStart","domainLookupEnd","connectStart","connectEnd","requestStart","responseStart","responseEnd","domLoading","domInteractive","domContentLoadedEventStart","domContentLoadedEventEnd","domComplete","loadEventStart","loadEventEnd"],be=["fs","ls","le","cs","ce","qs","rs","re","dl","di","ds","de","dc","es","ee"];function Se(t){var e=function(t){var e=t.fetchStart,n=t.navigationStart;if(n&&e<n)return null;var r={};return _e.forEach((function(n){var i=t[n];i&&i>=e&&(r[n]=parseInt(i-e))})),r}(t);return null==e?null:{navigationTiming:e,agent:{timeToFirstByte:e.responseStart,domInteractive:e.domInteractive,domComplete:e.domComplete}}}function Te(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=[],a=0;a<he.length;a++){var o=t[he[a][0]],s=t[he[a][1]];if(ge(o,s,n,r,e)){var c=new ve(he[a][2],"hard-navigation.browser-timing"),u=null;"requestStart"===he[a][0]&&(c.pageResponse=!0,u={url:location.origin}),c._start=o-e,c.end(s-e,u),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(Se(r))}if(D()){var i=t._start;(function(t,e,n,r){for(var i=[],a=0;a<t.length;a++){var o=t[a],s=o.initiatorType,c=o.name,u=o.startTime,f=o.responseEnd;-1!==tt.indexOf(s)&&null!=c&&(("xmlhttprequest"===s||"fetch"===s)&&(/intake\/v\d+\/rum\/events/.test(c)||ye(u,e))||ge(u,f,n,r)&&i.push(me(t[a])))}return i})(_.getEntriesByType(ht),At.bootstrapTime,i,e).forEach((function(e){return t.spans.push(e)})),function(t,e,n){for(var r=[],i=0;i<t.length;i++){var a=t[i],o=a.name,s=a.startTime,c=a.duration,u=s+c;if(!(c<=ot)&&ge(s,u,e,n)){var f=new ve(o,"app");f._start=s,f.end(u),r.push(f)}}return r}(_.getEntriesByType(lt),i,e).forEach((function(e){return t.spans.push(e)}))}}}function we(t){return{ts:t.transfer_size,ebs:t.encoded_body_size,dbs:t.decoded_body_size}}function Ee(t){if(!t)return null;var e={},n=t.page,r=t.http,i=t.response,a=t.destination,o=t.user,s=t.custom;if(n&&(e.p={rf:n.referer,url:n.url}),r&&(e.h=function(t){var e={},n=t.method,r=t.status_code,i=t.url,a=t.response;return e.url=i,n&&(e.mt=n),r&&(e.sc=r),a&&(e.r=we(a)),e}(r)),i&&(e.r=we(i)),a){var c=a.service;e.dt={se:{n:c.name,t:c.type,rc:c.resource},ad:a.address,po:a.port}}return o&&(e.u={id:o.id,un:o.username,em:o.email}),s&&(e.cu=s),e}function xe(t){if(!t)return null;var e=t.navigationTiming,n=t.agent,r={nt:{}};be.forEach((function(t,n){var i=_e[n];r.nt[t]=e[i]})),r.a={fb:r.nt.rs,di:r.nt.di,dc:r.nt.dc};var i=n.firstContentfulPaint,a=n.largestContentfulPaint;return i&&(r.a.fp=i),a&&(r.a.lp=a),r}var Oe=function(){function t(t,e){this._configService=t,this._loggingService=e,this.queue=void 0,this.throttleEvents=A}var e=t.prototype;return e.init=function(){var t=this,e=this._configService.get("queueLimit"),n=this._configService.get("flushInterval"),r=this._configService.get("eventsLimit");this.queue=new de((function(e){var n=t.sendEvents(e);n&&n.catch((function(e){t._loggingService.warn("Failed sending events!",t._constructError(e))}))}),{queueLimit:e,flushInterval:n}),this.throttleEvents=function(t,e,n){var r,i=this,a=n.limit,o=n.interval,s=0;return function(){return s++,void 0===r&&(r=setTimeout((function(){s=0,r=void 0}),o)),s>a&&"function"==typeof e?e.apply(i,arguments):t.apply(i,arguments)}}(this.queue.add.bind(this.queue),(function(){return t._loggingService.warn("Dropped events due to throttling!")}),{limit:r,interval:6e4})},e._postJson=function(t,e){var n=this,r={"Content-Type":"application/x-ndjson"};return function(t,e,n){void 0===n&&(n="gzip");var r="function"==typeof CompressionStream;return new g((function(i){if(!r)return i({payload:t,headers:e});var a=new Blob([t]).stream().pipeThrough(new CompressionStream(n));return new Response(a).blob().then((function(t){return e["Content-Encoding"]=n,i({payload:t,headers:e})}))}))}(e,r).catch((function(t){return{payload:e,headers:r}})).then((function(e){return n._makeHttpRequest("POST",t,e)})).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,o=r.headers;return new g((function(n,r){var s=new window.XMLHttpRequest;if(s[X]=!0,s.open(t,e,!0),s.timeout=i,o)for(var c in o)o.hasOwnProperty(c)&&s.setRequestHeader(c,o[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(a)}))},e.fetchConfig=function(t,e){var n=this,r=this._configService.get("serverUrl")+"/config/v1/rum/agents";if(!t)return g.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 a=JSON.parse(r),o=t.getResponseHeader("etag");return o&&(a.etag=o.replace(/["]/g,""),n._configService.setLocalConfig(a)),a})).catch((function(t){var e=n._constructError(t);return g.reject(e)}))},e.createMetaData=function(){var t=this._configService,e={service:{name:t.get("serviceName"),version:t.get("serviceVersion"),agent:{name:"rum-js",version:t.version},language:{name:"javascript"},environment:t.get("environment")},labels:t.get("context.tags")};return ce(te,e)},e.addError=function(t){var e;this.throttleEvents(((e={}).errors=t,e))},e.addTransaction=function(t){var e;this.throttleEvents(((e={}).transactions=t,e))},e.ndjsonErrors=function(t,e){var n=e?"e":"error";return t.map((function(t){var r;return pe.stringify(((r={})[n]=e?function(t){var e,n=t.exception,r={id:t.id,cl:t.culprit,ex:{mg:n.message,st:(e=n.stacktrace,e.map((function(t){return{ap:t.abs_path,f:t.filename,fn:t.function,li:t.lineno,co:t.colno}}))),t:t.type},c:Ee(t.context)},i=t.transaction;return i&&(r.tid=t.trace_id,r.pid=t.parent_id,r.xid=t.transaction_id,r.x={t:i.type,sm:i.sampled}),r}(t):t,r))}))},e.ndjsonMetricsets=function(t){return t.map((function(t){return pe.stringify({metricset:t})})).join("")},e.ndjsonTransactions=function(t,e){var n=this,r=e?"x":"transaction";return t.map((function(t){var i,a="",o="";return e||(t.spans&&(a=t.spans.map((function(t){return pe.stringify({span:t})})).join(""),delete t.spans),t.breakdown&&(o=n.ndjsonMetricsets(t.breakdown),delete t.breakdown)),pe.stringify(((i={})[r]=e?function(t){var e,n=t.spans.map((function(e){var n={id:e.id,n:e.name,t:e.type,s:e.start,d:e.duration,c:Ee(e.context)};return e.parent_id!==t.id&&(n.pid=e.parent_id),!0===e.sync&&(n.sy=!0),e.subtype&&(n.su=e.subtype),e.action&&(n.ac=e.action),n}));return{id:t.id,tid:t.trace_id,n:t.name,t:t.type,d:t.duration,c:Ee(t.context),m:xe(t.marks),me:(e=t.breakdown,e.map((function(t){var e=t.span,n=t.samples,r=null!=e;return r?{y:{t:e.type},sa:{ysc:{v:n["span.self_time.count"].value},yss:{v:n["span.self_time.sum.us"].value}}}:{sa:{xdc:{v:n["transaction.duration.count"].value},xds:{v:n["transaction.duration.sum.us"].value},xbc:{v:n["transaction.breakdown.count"].value}}}}))),y:n,yc:{sd:n.length},sm:t.sampled,exp:t.experience}}(t):t,i))+a+o}))},e.sendEvents=function(t){var e,n;if(0!==t.length){for(var r=[],i=[],a=0;a<t.length;a++){var o=t[a];o.transactions&&r.push(o.transactions),o.errors&&i.push(o.errors)}if(0!==r.length||0!==i.length){var s=this._configService,c=((e={}).transactions=r,e.errors=i,e),u=s.applyFilters(c);if(u){var f=s.get("apiVersion"),d=f>2,p=[],l=this.createMetaData(),v=d?"m":"metadata";p.push(pe.stringify(((n={})[v]=d?function(t){var e=t.service,n=t.labels,r=e.agent,i=e.language;return{se:{n:e.name,ve:e.version,a:{n:r.name,ve:r.version},la:{n:i.name},en:e.environment},l:n}}(l):l,n)));var h=(p=p.concat(this.ndjsonErrors(u.errors,d),this.ndjsonTransactions(u.transactions,d))).join(""),g=s.get("serverUrl")+"/intake/v"+f+"/rum/events";return this._postJson(g,h)}this._loggingService.warn("Dropped payload due to filtering!")}}},t}();var Le,ke=function(){function t(){this.config={serviceName:"",serviceVersion:"",environment:"",serverUrl:"http://localhost:8200",active:!0,instrument:!0,disableInstrumentations:[],logLevel:"warn",breakdownMetrics:!1,ignoreTransactions:[],eventsLimit:80,queueLimit:-1,flushInterval:500,distributedTracing:!0,distributedTracingOrigins:[],distributedTracingHeaderName:"traceparent",pageLoadTraceId:"",pageLoadSpanId:"",pageLoadSampled:!1,pageLoadTransactionName:"",transactionSampleRate:1,centralConfig:!1,monitorLongtasks:!0,apiVersion:2,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 a=r[i];if(n.test(a.nodeName)){var o=a.nodeName.match(n)[1].split("-").map((function(t,e){return e>0?t.charAt(0).toUpperCase()+t.substring(1):t})).join("");e[o]=a.value||a.nodeValue}}return e}(I());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,a=n.email;"number"!=typeof r&&"string"!=typeof r||(e.id=r),"string"==typeof i&&(e.username=i),"string"==typeof a&&(e.email=a),this.config.context.user=j(this.config.context.user||{},e)},e.setCustomContext=function(t){void 0===t&&(t={}),this.config.context.custom=j(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 O(n,t[n],e.config.context.tags)}))},e.setConfig=function(t){void 0===t&&(t={}),t.serverUrl&&(t.serverUrl=t.serverUrl.replace(/\/+$/,"")),F(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}(),Ce=function(){function t(t){void 0===t&&(t={}),this.levels=["trace","debug","info","warn","error"],this.level=t.level||"warn",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){t!==this.level&&(this.level=t,this.resetLogMethods())},e.resetLogMethods=function(){var t=this;this.levels.forEach((function(e){t[e]=t.shouldLog(e)?function(){var t=e;"trace"!==e&&"debug"!==e||(t="info");var n=arguments;if(n[0]=this.prefix+n[0],console){var r=console[t]||console.log;"function"==typeof r&&r.apply(console,n)}}:A}))},t}(),Ne=((Le={})[bt]=function(){return new ke},Le[St]=function(){return new Ce({prefix:"[Elastic APM] "})},Le[Tt]=function(t){var e=t.getService([bt,St]),n=e[0],r=e[1];return new Oe(n,r)},Le),Ie=function(){function t(){this.instances={},this.initialized=!1}var e=t.prototype;return e.init=function(){if(!this.initialized){this.initialized=!0;var t=this.getService(bt);t.init();var e=this.getService([St,Tt]),n=e[0],r=e[1];t.events.observe("config:change",(function(){var e=t.get("logLevel");n.setLevel(e)})),r.init()}},e.getService=function(t){var e=this;return"string"==typeof t?(this.instances[t]||"function"==typeof Ne[t]&&(this.instances[t]=Ne[t](this)),this.instances[t]):Array.isArray(t)?t.map((function(t){return e.getService(t)})):void 0},t}();var je=.05;var Fe=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]&&jt.observe(ut,this.getHistorySub()),t[st]&&jt.observe(st,this.getXHRSub()),t[ct]&&jt.observe(ct,this.getFetchSub()),t[ft]&&jt.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"),a="";i&&(a='["'+i+'"]');var o=r.tagName.toLowerCase(),s=t.startTransaction("Click - "+o+a,"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||U.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,a=new Ut(i.url),o=i.method+" "+(a.relative?a.path:k(a.href));r.getCurrentTransaction()||r.startTransaction(o,"http-request",{managed:!0});var s=r.startSpan(o,"external.http",{blocking:!0});if(!s)return;var c=n.get("distributedTracing"),u=n.get("distributedTracingOrigins"),f=new Ut(window.location.href),d=E(a.origin,f.origin)||E(a.origin,u),p=i.target;c&&d&&p&&this.injectDtHeader(s,p),i.sync&&(s.sync=i.sync),i.span=s}else if(t===G){var l=e.data;l&&l.span&&r.endSpan(l.span,l)}},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),a=/^[\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&&a&&("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}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:parseInt(n._start-e),duration:n.duration(),context:n.context};return ce(re,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,experience:t.experience};return ce(ie,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(a,o){if(0===r.length)r.push(a);else{var s=r[r.length-1],c=s.type===a.type&&s.subtype===a.subtype&&s.action===a.action&&s.name===a.name&&a.duration()/e<n&&(a._start-s._end)/e<n,u=t.length===o+1;c&&(i++,s._end=a._end),i>1&&(!c||u)&&(s.name=i+"x "+s.name,i=1),c||r.push(a)}})),r}(e,t.duration(),je);t.spans=n}else t.spans=e}else t.resetSpans();return t}(t);if(this.filterTransaction(e))return this.createTransactionDataModel(t)},t}(),Re=[["domainLookupStart","domainLookupEnd","DNS"],["connectStart","connectEnd","TCP"],["requestStart","responseStart","Request"],["responseStart","responseEnd","Response"],["domLoading","domComplete","Processing"],["loadEventStart","loadEventEnd","Load"]];function Ae(t){return{value:t}}function Me(t,e){var n=e.details,r=e.count,i=void 0===r?1:r,a=e.duration;return{transaction:t,span:n,samples:{"span.self_time.count":Ae(i),"span.self_time.sum.us":Ae(a)}}}function Pe(t,e){void 0===e&&(e=_.timing);var n=[],r=t.duration(),i=t.name,a=t.type,o=t.sampled,s={name:i,type:a};if(n.push({transaction:s,samples:{"transaction.duration.count":Ae(1),"transaction.duration.sum.us":Ae(r),"transaction.breakdown.count":Ae(o?1:0)}}),!o)return n;if(a===nt&&e)for(var c=0;c<Re.length;c++){var u=Re[c],f=H(e[u[0]],e[u[1]]);0!==f&&null!=f&&n.push(Me(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],a=i._end,o=i._start,s=a,c=o-n,u=1;u<e.length;u++)o=(i=e[u])._start,a=i._end,o>s?(c+=o-s,s=a):a>s&&(s=a);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 a=r[i],o=a.duration();if(0!==o&&null!=o){var s=a.type,c=a.subtype,u=s.replace(wt,"");c&&(u+="."+c),e[u]||(e[u]={duration:0,count:0}),e[u].count++,e[u].duration+=o}}return e}(t);Object.keys(d).forEach((function(t){var e=t.split("."),r=e[0],i=e[1],a=d[t],o=a.duration,c=a.count;n.push(Me(s,{details:{type:r,subtype:i},duration:o,count:c}))}))}return n}var qe=function(t){var e,n;function r(e,n,r){var i;return(i=t.call(this,e,n,r)||this).traceId=w(),i.marks=void 0,i.spans=[],i._activeSpans={},i._activeTasks=new Set,i.blocked=!1,i.captureTimings=!1,i.breakdownTimings=[],i.sampled=Math.random()<=i.options.transactionSampleRate,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=F(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&&j(this.options,n)},i.startSpan=function(t,e,n){var r=this;if(!this.ended){var i=j({},n);i.onEnd=function(t){r._onSpanEnd(t)},i.traceId=this.traceId,i.sampled=this.sampled,i.parentId||(i.parentId=this.id);var a=new ve(t,e,i);return this._activeSpans[a.id]=a,i.blocking&&this.addTask(a.id),a}},i.isFinished=function(){return!this.blocked&&0===this._activeTasks.size},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+wt,n.end(t)}this.callOnEnd()}},i.captureBreakdown=function(){this.breakdownTimings=Pe(this)},i.block=function(t){this.blocked=t,this.blocked||this.detectFinish()},i.addTask=function(t){return t||(t="task-"+w(16)),this._activeTasks.add(t),t},i.removeTask=function(t){this._activeTasks.delete(t)&&this.detectFinish()},i.resetSpans=function(){this.spans=[]},i._onSpanEnd=function(t){this.spans.push(t),delete this._activeSpans[t.id],this.removeTask(t.id)},i.isManaged=function(){return!!this.options.managed},r}(le),He={fid:0,fcp:0,tbt:{start:1/0,duration:0},cls:0},Be=50;function De(t,e){var n=e.capturePaint,r=t.getEntriesByType(pt),i={spans:function(t){for(var e=[],n=0;n<t.length;n++){var r=t[n],i=r.name,a=r.startTime,o=r.duration,s=r.attribution,c=a+o,u=new ve("Longtask("+i+")",pt,{startTime:a});if(s.length>0){var f=s[0],d=f.name,p=f.containerType,l=f.containerName,v=f.containerId,h={attribution:d,type:p};l&&(h.name=l),v&&(h.id=v),u.addContext({custom:h})}u.end(c),e.push(u)}return e}(r),marks:{}};if(!n)return i;var a=t.getEntriesByType(mt),o=a[a.length-1];if(o){var s=parseInt(o.startTime);He.lcp=s,i.marks.largestContentfulPaint=s}var c=_.timing,u=c.fetchStart-c.navigationStart,f=t.getEntriesByName(gt)[0];if(f){var d=parseInt(u>=0?f.startTime-u:f.startTime);He.fcp=d,i.marks.firstContentfulPaint=d}var p=function(t){var e=t[0];if(e){var n=e.startTime,r=e.processingStart,i=new ve("First Input Delay",yt,{startTime:n});return i.end(r),i}}(t.getEntriesByType(yt));return p&&(He.fid=p._start,i.spans.push(p)),function(t){t.forEach((function(t){var e=t.name,n=t.startTime,r=t.duration;if(!(n<He.fcp||"self"!==e&&-1===e.indexOf("same-origin"))){He.tbt.start=Math.min(He.tbt.start,n);var i=r-Be;i>0&&(He.tbt.duration+=i)}}))}(r),function(t){t.forEach((function(t){t.hadRecentInput||(He.cls+=t.value)}))}(t.getEntriesByType(_t)),i}var ze=function(){function t(t){this.po={observe:A,disconnect:A},window.PerformanceObserver&&(this.po=new PerformanceObserver(t))}var e=t.prototype;return e.start=function(t){try{var e=!0;t===pt&&(e=!1),this.po.observe({type:t,buffered:e})}catch(t){}},e.stop=function(){this.po.disconnect()},t}(),Ue=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 ze((function(t){var e=n.getCurrentTransaction();if(e&&e.captureTimings){var r,i=!1;e.type===nt&&(i=!0);var a=De(t,{capturePaint:i}),o=a.spans,s=a.marks;(r=e.spans).push.apply(r,o),e.addMarks({agent:s})}}))}var e=t.prototype;return e.ensureCurrentTransaction=function(t,e,n){var r=this.getCurrentTransaction();return r||(r=new qe(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.createOptions=function(t){var e=this._config.config,n=j({transactionSampleRate:e.transactionSampleRate},t);return n.managed&&(n=j({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 a=r.type,o=at.indexOf(r.type),s=at.indexOf(e);o>=0&&s<o&&(a=e),r.redefine(t,a,n),i=!0}else r.end(),r=this.ensureCurrentTransaction(t,e,n);else r=this.ensureCurrentTransaction(t,e,n);return r.type===nt&&(i||(this.recorder.start(mt),this.recorder.start("paint"),this.recorder.start(yt),this.recorder.start(_t)),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(pt),r.sampled&&(r.captureTimings=!0),r},e.startTransaction=function(t,e,n){var r,i=this,a=this.createOptions(n),o=!0;a.managed?this.currentTransaction===(r=this.startManagedTransaction(t,e,a))&&(o=!1):r=new qe(t,e,a);return r.onEnd=function(){return i.handleTransactionEnd(r)},o&&this._config.events.send("transaction:start",[r]),r},e.handleTransactionEnd=function(t){var e=this;this.recorder.stop();var n=window.location.href;return g.resolve().then((function(){var r=t.name,i=t.type;if(!(At.lastHiddenStart>=t._start||e.shouldIgnoreTransaction(r)||"temporary"===i)){if(i===nt){var a=e._config.get("pageLoadTransactionName");if(r===it&&a&&(t.name=a),t.captureTimings){var o=He.cls,s=He.fid,c=He.tbt;c.duration>0&&t.spans.push((f=(u=c).start,d=u.duration,(p=new ve("Total Blocking Time",pt,{startTime:f})).end(f+d),p)),t.experience={},z(pt)&&(t.experience.tbt=c.duration),z(_t)&&(t.experience.cls=o),s>0&&(t.experience.fid=s)}}var u,f,d,p;t.name===it&&(t.name=function(t,e){void 0===e&&(e=2);for(var n=new Ut(t),r=n.query,i=n.path.substring(1).split("/"),a=/\W|_/g,o=/[0-9]/g,s=/[a-z]/g,c=/[A-Z]/g,u=[],f=!1,d=0;d<i.length;d++){var p=i[d];if(f||d>e-1){p&&u.push("*");break}if((p.match(a)||[]).length>=2)u.push(":id"),f=!0;else{var l=(p.match(o)||[]).length;if(l>3||p.length>3&&l/p.length>=.3)u.push(":id"),f=!0;else{var v=(p.match(c)||[]).length,h=(p.match(s)||[]).length/p.length,g=v/p.length;p.length>5&&(g>.3&&g<.6||h>.3&&h<.6)?(u.push(":id"),f=!0):p&&u.push(p)}}}return"/"+(u.length>=2?u.join("/"):u.join(""))+(r?"?{query}":"")}(n)),Te(t),e.adjustTransactionTime(t),e._config.get("breakdownMetrics")&&t.captureBreakdown();var l=e._config.get("context");Qt(t,l),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,a=0;a<e.length;a++){var o=e[a];o._end>i&&(o._end=i,o.type+=wt),o._start>i&&(o._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){var i=r.startSpan(t,e,n);return i}},e.endSpan=function(t,e){t&&t.end(null,e)},t}();function $e(){return Ne.TransactionService=function(t){var e=t.getService([St,bt]),n=e[0],r=e[1];return new Ue(n,r)},Ne.PerformanceMonitoring=function(t){var e=t.getService([Tt,bt,St,"TransactionService"]),n=e[0],r=e[1],i=e[2],a=e[3];return new Fe(n,r,i,a)},Ne.ErrorLogging=function(t){var e=t.getService([Tt,bt,"TransactionService"]),n=e[0],r=e[1],i=e[2];return new fe(n,r,i)},new Ie}var Ve=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([bt,St]),r=n[0],i=n[1];r.setVersion("5.5.0"),this.config(t);var a=r.get("logLevel");if(i.setLevel(a),r.isActive()){this.serviceFactory.init();var o=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}(r.get("instrument"),r.get("disableInstrumentations"));if(this.serviceFactory.getService("PerformanceMonitoring").init(o),o[dt])this.serviceFactory.getService("ErrorLogging").registerListeners();var s=function(){return o[nt]&&e._sendPageLoadMetrics()};r.get("centralConfig")?this.fetchCentralConfig().then(s):s()}else this._disable=!0,i.warn("RUM agent is inactive")}return this},e.fetchCentralConfig=function(){var t=this.serviceFactory.getService([Tt,St,bt]),e=t[0],n=t[1],r=t[2];return e.fetchConfig(r.get("serviceName"),r.get("environment")).then((function(t){var e=t.transaction_sample_rate;if(e){var i={transactionSampleRate:e=Number(e)},a=r.validate(i).invalid;if(0===a.length)r.setConfig(i);else{var o=a[0],s=o.key,c=o.value,u=o.allowed;n.warn('invalid value "'+c+'" for '+s+". Allowed: "+u+".")}}return t})).catch((function(t){n.warn("failed fetching config:",t)}))},e._sendPageLoadMetrics=function(){var t=this.startTransaction(void 0,nt,{managed:!0,canReuse:!0});if(t){t.addTask(nt);var e=function(){setTimeout((function(){return 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(bt).events.observe(t,e)},e.config=function(t){var e=this.serviceFactory.getService(bt),n=e.validate(t),r=n.missing,i=n.invalid;if(0===r.length&&0===i.length)e.setConfig(t);else{var a=this.serviceFactory.getService(St),o="RUM agent isn't correctly configured. ";r.length>0&&(o+=r.join(", ")+" is missing",i.length>0&&(o+=", ")),i.forEach((function(t,e){var n=t.key,r=t.value,a=t.allowed;o+=n+' "'+r+'" contains invalid characters! (allowed: '+a+")"+(e!==i.length-1?", ":"")})),a.error(o),e.setConfig({active:!1})}},e.setUserContext=function(t){this.serviceFactory.getService(bt).setUserContext(t)},e.setCustomContext=function(t){this.serviceFactory.getService(bt).setCustomContext(t)},e.addLabels=function(t){this.serviceFactory.getService(bt).addLabels(t)},e.setInitialPageLoadName=function(t){this.isEnabled()&&this.serviceFactory.getService(bt).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,n){if(this.isEnabled())return this.serviceFactory.getService("TransactionService").startSpan(t,e,n)},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(bt).addFilter(t)},t}();var Xe=function(){if(y&&window.elasticApm)return window.elasticApm;var t=Pt(),e=$e(),n=new Ve(e,!t);return y&&(window.elasticApm=n),n}(),Je=Xe.init.bind(Xe),We=n(2),Ye=n(0),Ze=n(1);var Ge=function(t){var e,n;function r(e,n){var r;return(r=t.call(this)||this).__tracer=e,r.span=n,r.isTransaction=n instanceof qe,r.spanContext={id:n.id,traceId:n.traceId,sampled:n.sampled},r}n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n;var i=r.prototype;return i._context=function(){return this.spanContext},i._tracer=function(){return this.__tracer},i._setOperationName=function(t){this.span.name=t},i._addTags=function(t){var e=j({},t);if(e.type&&(this.span.type=e.type,delete e.type),this.isTransaction){var n=e["user.id"],r=e["user.username"],i=e["user.email"];(n||r||i)&&(this.span.addContext({user:{id:n,username:r,email:i}}),delete e["user.id"],delete e["user.username"],delete e["user.email"])}this.span.addLabels(e)},i._log=function(t,e){"error"===t.event&&(t["error.object"]?this.__tracer.errorLogging.logError(t["error.object"]):t.message&&this.__tracer.errorLogging.logError(t.message))},i._finish=function(t){this.span.end(),t&&(this.span._end=t-L())},r}(Ze.Span);var Ke=function(t){var e,n;function r(e,n,r,i){var a;return(a=t.call(this)||this).performanceMonitoring=e,a.transactionService=n,a.loggingService=r,a.errorLogging=i,a}n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n;var i=r.prototype;return i._startSpan=function(t,e){var n,r={managed:!0};if(e)if(r.timestamp=e.startTime,e.childOf)r.parentId=e.childOf.id;else if(e.references&&e.references.length>0){e.references.length;var i=function(t,e,n){if(null==t)throw new TypeError("array is null or not defined");var r=Object(t),i=r.length>>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var a=0;a<i;){var o=r[a];if(e.call(n,o,a,r))return o;a++}}(e.references,(function(t){return t.type()===Ye.REFERENCE_CHILD_OF}));i&&(r.parentId=i.referencedContext().id)}if(!(n=this.transactionService.getCurrentTransaction()?this.transactionService.startSpan(t,void 0,r):this.transactionService.startTransaction(t,void 0,r)))return new Ze.Span;r.timestamp&&(n._start=r.timestamp-L());var a=new Ge(this,n);return e&&e.tags&&a.addTags(e.tags),a},i._inject=function(t,e,n){switch(e){case Ye.FORMAT_TEXT_MAP:case Ye.FORMAT_HTTP_HEADERS:this.performanceMonitoring.injectDtHeader(t,n);break;case Ye.FORMAT_BINARY:0}},i._extract=function(t,e){var n;switch(t){case Ye.FORMAT_TEXT_MAP:case Ye.FORMAT_HTTP_HEADERS:n=this.performanceMonitoring.extractDtHeader(e);break;case Ye.FORMAT_BINARY:0}return n||(n=null),n},r}(We.Tracer);function Qe(t){return t._disable?new We.Tracer:(e=t.serviceFactory,n=e.getService("PerformanceMonitoring"),r=e.getService("TransactionService"),i=e.getService("ErrorLogging"),a=e.getService("LoggingService"),new Ke(n,r,a,i));var e,n,r,i,a}"undefined"!=typeof window&&window.elasticApm&&(window.elasticApm.createTracer=Qe.bind(window.elasticApm,window.elasticApm));e.default=Qe}]); | ||
!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=10)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FORMAT_BINARY="binary",e.FORMAT_TEXT_MAP="text_map",e.FORMAT_HTTP_HEADERS="http_headers",e.REFERENCE_CHILD_OF="child_of",e.REFERENCE_FOLLOWS_FROM="follows_from"},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(3),i=function(){function t(){}return t.prototype.context=function(){return this._context()},t.prototype.tracer=function(){return this._tracer()},t.prototype.setOperationName=function(t){return this._setOperationName(t),this},t.prototype.setBaggageItem=function(t,e){return this._setBaggageItem(t,e),this},t.prototype.getBaggageItem=function(t){return this._getBaggageItem(t)},t.prototype.setTag=function(t,e){return this._addTags(((n={})[t]=e,n)),this;var n},t.prototype.addTags=function(t){return this._addTags(t),this},t.prototype.log=function(t,e){return this._log(t,e),this},t.prototype.logEvent=function(t,e){return this._log({event:t,payload:e})},t.prototype.finish=function(t){this._finish(t)},t.prototype._context=function(){return r.spanContext},t.prototype._tracer=function(){return r.tracer},t.prototype._setOperationName=function(t){},t.prototype._setBaggageItem=function(t,e){},t.prototype._getBaggageItem=function(t){},t.prototype._addTags=function(t){},t.prototype._log=function(t,e){},t.prototype._finish=function(t){},t}();e.Span=i,e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(7),i=n(3),a=n(1),o=function(){function t(){}return t.prototype.startSpan=function(t,e){if(void 0===e&&(e={}),e.childOf){var n=r.childOf(e.childOf);e.references?e.references.push(n):e.references=[n],delete e.childOf}return this._startSpan(t,e)},t.prototype.inject=function(t,e,n){return t instanceof a.default&&(t=t.context()),this._inject(t,e,n)},t.prototype.extract=function(t,e){return this._extract(t,e)},t.prototype._startSpan=function(t,e){return i.span},t.prototype._inject=function(t,e,n){},t.prototype._extract=function(t,e){return i.spanContext},t}();e.Tracer=o,e.default=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),i=n(9),a=n(2);e.tracer=null,e.spanContext=null,e.span=null,e.initialize=function(){e.tracer=new a.default,e.span=new r.default,e.spanContext=new i.default}},function(t,e,n){var r,i,a;!function(o,s){"use strict";i=[n(6)],void 0===(a="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 a(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(a(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,a=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,a,r[1],r[2],e)}),this)},parseFFOrSafari:function(e){return i(a(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=[],a=2,o=r.length;a<o;a+=2){var s=n.exec(r[a]);s&&i.push(new t(void 0,void 0,s[2],s[1],void 0,r[a]))}return i},parseOpera10:function(e){for(var n=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=e.stacktrace.split("\n"),i=[],a=0,o=r.length;a<o;a+=2){var s=n.exec(r[a]);s&&i.push(new t(s[3]||void 0,void 0,s[2],s[1],void 0,r[a]))}return i},parseOpera11:function(n){return i(a(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()),a=r.shift()||"",o=a.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^\)]*\)/g,"")||void 0;a.match(/\(([^\)]*)\)/)&&(n=a.replace(/^[^\(]+\(([^\)]*)\)$/,"$1"));var s=void 0===n||"[arguments not available]"===n?void 0:n.split(",");return new t(o,s,i[0],i[1],i[2],e)}),this)}}})?r.apply(e,i):r)||(t.exports=a)}()},,function(t,e,n){var r,i,a;!function(n,o){"use strict";i=[],void 0===(a="function"==typeof(r=function(){function t(t){return!isNaN(parseFloat(t))&&isFinite(t)}function e(t,e,n,r,i,a){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!==a&&this.setSource(a)}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=a)}()},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),i=n(8),a=n(1);e.childOf=function(t){return t instanceof a.default&&(t=t.context()),new i.default(r.REFERENCE_CHILD_OF,t)},e.followsFrom=function(t){return t instanceof a.default&&(t=t.context()),new i.default(r.REFERENCE_FOLLOWS_FROM,t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),i=function(){function t(t,e){this._type=t,this._referencedContext=e instanceof r.default?e.context():e}return t.prototype.type=function(){return this._type},t.prototype.referencedContext=function(){return this._referencedContext},t}();e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){};e.SpanContext=r,e.default=r},function(t,e,n){"use strict";n.r(e),n.d(e,"createTracer",(function(){return Se})),n.d(e,"init",(function(){return ve})),n.d(e,"apm",(function(){return le})),n.d(e,"apmBase",(function(){return le})),n.d(e,"ApmBase",(function(){return pe}));var r=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)}))}))},i=setTimeout;function a(t){return Boolean(t&&void 0!==t.length)}function o(){}function s(t){if(!(this instanceof s))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 c(t,e){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,s._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 f(e.promise,t)}u(e.promise,r)}else(1===t._state?u:f)(e.promise,t._value)}))):t._deferreds.push(e)}function u(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 s)return t._state=3,t._value=e,void d(t);if("function"==typeof n)return void l((r=n,i=e,function(){r.apply(i,arguments)}),t)}t._state=1,t._value=e,d(t)}catch(e){f(t,e)}var r,i}function f(t,e){t._state=2,t._value=e,d(t)}function d(t){2===t._state&&0===t._deferreds.length&&s._immediateFn((function(){t._handled||s._unhandledRejectionFn(t._value)}));for(var e=0,n=t._deferreds.length;e<n;e++)c(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,u(e,t))}),(function(t){n||(n=!0,f(e,t))}))}catch(t){if(n)return;n=!0,f(e,t)}}s.prototype.catch=function(t){return this.then(null,t)},s.prototype.then=function(t,e){var n=new this.constructor(o);return c(this,new p(t,e,n)),n},s.prototype.finally=r,s.all=function(t){return new s((function(e,n){if(!a(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 s=0;s<r.length;s++)o(s,r[s])}))},s.resolve=function(t){return t&&"object"==typeof t&&t.constructor===s?t:new s((function(e){e(t)}))},s.reject=function(t){return new s((function(e,n){n(t)}))},s.race=function(t){return new s((function(e,n){if(!a(t))return n(new TypeError("Promise.race accepts an array"));for(var r=0,i=t.length;r<i;r++)s.resolve(t[r]).then(e,n)}))},s._immediateFn="function"==typeof setImmediate&&function(t){setImmediate(t)}||function(t){i(t,0)},s._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};var v=s,h={};y?h=window:"undefined"!=typeof self&&(h=self);var g="Promise"in h?h.Promise:v,m=[].slice,y="undefined"!=typeof window,_=y&&"undefined"!=typeof performance?performance:{};for(var S=[],b=0;b<256;++b)S[b]=(b+256).toString(16).substr(1);var w=new Uint8Array(16);function T(t){return function(t){for(var e=[],n=0;n<t.length;n++)e.push(S[t[n]]);return e.join("")}("undefined"!=typeof crypto&&"function"==typeof crypto.getRandomValues?crypto.getRandomValues(w):"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues?msCrypto.getRandomValues(w):w).substr(0,t)}function E(t,e){var n=!1;return"string"==typeof e?n=t===e:Array.isArray(e)&&e.forEach((function(e){n||(n=E(t,e))})),n}function x(){return y&&"function"==typeof Set&&"function"==typeof JSON.stringify&&_&&"function"==typeof _.now&&"withCredentials"in new window.XMLHttpRequest}function O(t,e,n){if(n&&t){var r=M(t),i=typeof e;return null!=e&&"boolean"!==i&&"number"!==i&&(e=String(e)),n[r]=e,n}}function L(){return _.timing.fetchStart}function C(t){return t&&t.split("?")[0]}function k(t){return null!==t&&"object"==typeof t}function N(t,e,n){for(var r=0,i=e.length;r<i;++r){var a=e[r];if(k(a)||"function"==typeof a)for(var o=Object.keys(a),s=0,c=o.length;s<c;s++){var u=o[s],f=a[u];n&&k(f)?(k(t[u])||(t[u]=Array.isArray(f)?[]:{}),N(t[u],[f],!1)):t[u]=f}}return t}function I(){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 j(t){return N(t,m.call(arguments,1),!1)}function F(t){return N(t,m.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:parseInt(e-t)}function B(t){g.resolve().then(t)}function D(){return"function"==typeof _.getEntriesByType}function z(t){return"undefined"!=typeof PerformanceObserver&&PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.indexOf(t)>=0}var U={fetchInProgress:!1};function $(t){return"__apm_symbol__"+t}function V(t,e,n){for(var r=t;r&&!r.hasOwnProperty(e);)r=Object.getPrototypeOf(r);!r&&t[e]&&(r=t);var i,a,o,s,c=$(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)},a=r[e],o=i,a[$("OriginalDelegate")]=o}}return i}var X=$("xhrIgnore"),J=$("xhrSync"),W=$("xhrURL"),Y=$("xhrMethod"),Z="invoke",G=["link","css","script","img","xmlhttprequest","fetch","beacon","iframe"],K="page-load",Q=[K,"route-change","user-interaction","http-request","custom","temporary"];function tt(t){var e=XMLHttpRequest.prototype;if(e&&e.addEventListener)var n=V(e,"open",(function(){return function(t,e){return t[X]||(t[Y]=e[0],t[W]=e[1],t[J]=!1===e[2]),n.apply(t,e)}})),r=V(e,"send",(function(){return function(e,n){if(e[X])return r.apply(e,n);var a={source:"xmlhttprequest",state:"",type:"macroTask",data:{target:e,method:e[Y],sync:e[J],url:e[W],status:""}};try{return function(e){if("schedule"!==e.state){e.state="schedule",t("schedule",e);var n=e.data.target;r("readystatechange"),r("load"),r("timeout"),r("error"),r("abort")}function r(t){n.addEventListener(t,(function(t){var r=t.type;"readystatechange"===r?4===n.readyState&&0!==n.status&&i(e,"success"):i(e,"load"===r?"success":r)}))}}(a),r.apply(e,n)}catch(t){throw i(a,"error"),t}}}));function i(e,n){e.state!==Z&&(e.state=Z,e.data.status=n,t(Z,e))}}for(var et=["click"],nt={},rt=0;rt<et.length;rt++){var it=et[rt];nt[it]=$(it)}function at(t,e,n){return t instanceof Element&&et.indexOf(e)>=0&&"function"==typeof n}var ot=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}(),st=new ot,ct=!1;function ut(){return ct||(ct=!0,tt((function(t,e){st.send("xmlhttprequest",[t,e])})),function(t){if(window.fetch&&window.Request){var e=window.fetch;window.fetch=function(t,i){var a,o,s=this,c=arguments;if("string"==typeof t)a=new Request(t,i),o=t;else{if(!t)return e.apply(s,c);o=(a=t).url}var u={source:"fetch",state:"",type:"macroTask",data:{target:a,method:a.method,url:o,aborted:!1}};return new g((function(t,i){var o;U.fetchInProgress=!0,n(u);try{o=e.apply(s,[a])}catch(t){return i(t),u.data.error=t,r(u),void(U.fetchInProgress=!1)}o.then((function(e){t(e),B((function(){u.data.response=e,r(u)}))}),(function(t){i(t),B((function(){u.data.error=t,r(u)}))})),U.fetchInProgress=!1}))}}function n(e){e.state="schedule",t("schedule",e)}function r(e){e.state=Z,t(Z,e)}}((function(t,e){st.send("fetch",[t,e])})),function(t){if(window.history){var e=history.pushState;"function"==typeof e&&(history.pushState=function(n,r,i){var a={source:"history",data:{state:n,title:r,url:i}};t(Z,a),e.apply(this,arguments)})}}((function(t,e){st.send("history",[t,e])})),function(t){if(window.EventTarget){var e=window.EventTarget.prototype,n=e.addEventListener,r=e.removeEventListener;e.addEventListener=function(t,e,r){var i=this;if(!at(i,t,e))return n.apply(i,arguments);var a=o(i,t,e,r),s=Array.prototype.slice.call(arguments);return s[1]=a,n.apply(i,s)},e.removeEventListener=function(t,e,n){var i=this;if(!at(i,t,e))return r.apply(i,arguments);var a=s(i,t,e,n),o=Array.prototype.slice.call(arguments);return o[1]=a,r.apply(i,o)}}function i(t,e,n,r){for(var i=0;i<t.length;i++){var a=t[i];if(a.eventType===e&&a.listenerFn===n&&a.capture===r)return i}return-1}function a(t){return"boolean"==typeof t?t:!!t&&!!t.capture}function o(e,n,r,o){var s=nt[n];if(!s)return r;var c=e[s],u=a(o);if(c){var f=i(c,n,r,u);if(-1!==f)return c[f].wrappingFn}else c=e[s]=[];var d={source:"eventtarget",target:e,eventType:n,listenerFn:r,capture:u,wrappingFn:p};function p(){var e;t("schedule",d);try{e=r.apply(this,arguments)}finally{t(Z,d)}return e}return c.push(d),p}function s(t,e,n,r){var o=nt[e],s=t[o];if(s){var c=i(s,e,n,a(r));if(-1!==c){var u=s[c];return s.splice(c,1),0===s.length&&(t[o]=void 0),u.wrappingFn}}return n}}((function(t,e){st.send("eventtarget",[t,e])}))),st}var ft={bootstrapTime:null,lastHiddenStart:Number.MIN_SAFE_INTEGER},dt=!1;function pt(){return x()?(ut(),function(){"hidden"===document.visibilityState&&(ft.lastHiddenStart=0);window.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState&&(ft.lastHiddenStart=performance.now())}),{capture:!0})}(),ft.bootstrapTime=P(),dt=!0):y&&console.log("[Elastic APM] platform is not supported!"),dt}var lt=n(4),vt=n.n(lt);function ht(t){var e=t.error,n=t.filename,r=t.lineno,i=t.colno,a=[];if(e)try{a=vt.a.parse(e)}catch(t){}return 0===a.length&&(a=[{fileName:n,lineNumber:r,columnNumber:i}]),a.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,a=void 0===i?"<anonymous>":i;if(!e&&!n)return{};if(!r&&!n)return{};var o,s,c=function(t){return void 0===t&&(t=""),"<anonymous>"===t&&(t=""),t}(e),u=(o=c,s=window.location.origin||window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:""),o.indexOf(s)>-1&&(o=o.replace(s+"/","")),o);return function(t){return!!t&&0===window.location.href.indexOf(t)}(c)&&(u="(inline script)"),{abs_path:e,filename:u,function:a,lineno:n,colno:r}}))}var gt=[["#","hash"],["?","query"],["/","path"],["@","auth",1],[NaN,"host",void 0,1]],mt=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,yt=function(){function t(t){var e,n=this.extractProtocol(t||""),r=n.protocol,i=n.address,a=n.slashes,o=!r&&!a,s=this.getLocation(),c=gt.slice();i=i.replace("\\","/"),a||(c[2]=[NaN,"path"]);for(var u=0;u<c.length;u++){var f=c[u],d=f[0],p=f[1];if("string"==typeof d){if(~(e=i.indexOf(d))){var l=f[2];if(l){var v=i.lastIndexOf(d);e=Math.max(e,v),this[p]=i.slice(0,e),i=i.slice(e+l)}else this[p]=i.slice(e),i=i.slice(0,e)}}else this[p]=i,i="";this[p]=this[p]||o&&f[3]&&s[p]||"",f[3]&&(this[p]=this[p].toLowerCase())}if(o&&"/"!==this.path.charAt(0)&&(this.path="/"+this.path),this.relative=o,this.protocol=r||s.protocol,this.hostname=this.host,this.port="",/:\d+$/.test(this.host)){var h=this.host.split(":"),g=h.pop(),m=h.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 y&&(t=window),t.location},e.extractProtocol=function(t){var e=mt.exec(t);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!e[2],address:e[3]}},t}();function _t(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,a=r.duration,o=r.description,s=i;o&&(s+=";desc="+o),a&&(s+=";dur="+a),e.push(s)}return e.join(", ")}(t.serverTiming);return n&&(e.headers={"server-timing":n}),e}function St(t,e){var n=t.port,r=t.protocol,i=t.hostname,a=t.host,o=function(t,e){return""===t&&(t="http:"===e?"80":"https:"===e?"443":""),t}(n,r),s=91===i.charCodeAt(0)&&93===i.charCodeAt(i.length-1),c=i;return s&&(c=i.slice(1,-1)),{service:{name:r+"//"+a,resource:i+":"+o,type:e},address:c,port:Number(o)}}function bt(){return{page:{referer:document.referrer,url:location.href}}}function wt(t,e){if(e){var n;switch(t.type){case"external":n=function(t){var e,n=t.url,r=t.method,i=t.target,a=t.response,o=new yt(n),s=St(o,"external"),c={http:{method:r,url:o.href},destination:s};return i&&void 0!==i.status?e=i.status:a&&(e=a.status),c.http.status_code=e,c}(e);break;case"resource":n=function(t){var e=t.entry,n=t.url,r=St(new yt(n),"resource");return{http:{url:n,response:_t(e)},destination:r}}(e);break;case"hard-navigation":n=function(t){var e=t.url;return{destination:St(new yt(e),"hard-navigation")}}(e)}t.addContext(n)}}function Tt(t,e){var n=void 0===e?{}:e,r=(n.tags,function(t,e){if(null==t)return{};var n,r,i={},a=Object.keys(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)>=0||(i[n]=t[n]);return i}(n,["tags"])),i=bt(),a={};if(t.type===K&&D()){var o=_.getEntriesByType("navigation");o&&o.length>0&&(a={response:_t(o[0])})}t.addContext(i,a,r)}var Et={service:{name:[1024,!0],version:!0,agent:{version:[1024,!0]},environment:!0},labels:{"*":!0}},xt={"*":!0,headers:{"*":!0}},Ot={user:{id:!0,email:!0,username:!0},tags:{"*":!0},http:{response:xt},destination:{address:[1024],service:{"*":[1024,!0]}},response:xt},Lt={name:[1024,!0],type:[1024,!0],id:[1024,!0],trace_id:[1024,!0],parent_id:[1024,!0],transaction_id:[1024,!0],subtype:!0,action:!0,context:Ot},Ct={name:!0,parent_id:!0,type:[1024,!0],id:[1024,!0],trace_id:[1024,!0],span_count:{started:[1024,!0]},context:Ot},kt={id:[1024,!0],trace_id:!0,transaction_id:!0,parent_id:!0,culprit:!0,exception:{type:!0},transaction:{type:!0},context:Ot};function Nt(t){return null==t||""===t||void 0===t}function It(t,e,n){var r=function(t,e,n,r){return void 0===e&&(e=1024),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=[],a=function(a){var o=r[a],s=!0===t[o]?i:t[o];Array.isArray(s)?"*"===o?Object.keys(n).forEach((function(t){return It(n,t,s)})):It(n,o,s):jt(s,e,n[o])},o=0;o<r.length;o++)a(o);return e}var Ft=["stack","message"];var At=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}))}(ht(t)),n="(inline script)",r=e[e.length-1];r&&r.filename&&(n=r.filename);var i=t.message,a=t.error,o=i,s="",c={};if(a&&"object"==typeof a){o=o||a.message,s=a.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}(a);u&&(c.custom=u)}s||o&&o.indexOf(":")>-1&&(s=o.split(":")[0]);var f=this._transactionService.getCurrentTransaction(),d=f?f.context:{},p=this._configService.get("context"),l=(p.tags,function(t,e){if(null==t)return{};var n,r,i={},a=Object.keys(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)>=0||(i[n]=t[n]);return i}(p,["tags"])),v=F({},bt(),d,l,c),h={id:T(),culprit:n,exception:{message:o,stacktrace:e,type:s},context:v};return f&&(h=j(h,{trace_id:f.traceId,parent_id:f.id,transaction_id:f.id,transaction:{type:f.type,sampled:f.sampled}})),jt(kt,h)},e.logErrorEvent=function(t){if(void 0!==t){var e=this.createErrorDataModel(t);void 0!==e.exception.message&&this._apmServer.addError(e)}},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,n="Unhandled promise rejection: ",r=t.reason,i=void 0===r?"<no reason specified>":r;"string"==typeof i.message?e={error:i,message:n+(i.name?i.name+": ":"")+i.message}:e={message:n+(i="object"==typeof i?"<object>":"function"==typeof i?"<function>":i)};this.logErrorEvent(e)},e.logError=function(t){var e={};return"string"==typeof t?e.message=t:e.error=t,this.logErrorEvent(e)},t}(),Rt=function(){function t(t,e){void 0===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(){return t.flush()}),this.flushInterval)},e._clear=function(){void 0!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=void 0),this.items=[]},e.flush=function(){this.onFlush(this.items),this._clear()},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 Mt=function(){function t(){}return t.stringify=function(t){return JSON.stringify(t)+"\n"},t}(),Pt=function(){function t(t,e,n){void 0===n&&(n={}),t||(t="Unknown"),e||(e="custom"),this.name=t,this.type=e,this.options=n,this.id=n.id||T(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.addLabels=function(t){this.ensureContext();var e=this.context;e.tags||(e.tags={}),Object.keys(t).forEach((function(n){return O(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(),F.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}();var qt=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 a=i.type.split(".",3);i.type=a[0],i.subtype=a[1],i.action=a[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),wt(this,n)},r}(Pt),Ht=[["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 Bt(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<3e5&&t-i<3e5&&e-i<3e5}function Dt(t){var e=t.name,n=t.initiatorType,r=t.startTime,i=t.responseEnd,a="resource";n&&(a+="."+n);var o=C(e),s=new qt(o,a);return s._start=r,s.end(i,{url:e,entry:t}),s}function zt(t,e){return null!=e&&t>e}var Ut=["fetchStart","domainLookupStart","domainLookupEnd","connectStart","connectEnd","requestStart","responseStart","responseEnd","domLoading","domInteractive","domContentLoadedEventStart","domContentLoadedEventEnd","domComplete","loadEventStart","loadEventEnd"],$t=["fs","ls","le","cs","ce","qs","rs","re","dl","di","ds","de","dc","es","ee"];function Vt(t){var e=function(t){var e=t.fetchStart,n=t.navigationStart;if(n&&e<n)return null;var r={};return Ut.forEach((function(n){var i=t[n];i&&i>=e&&(r[n]=parseInt(i-e))})),r}(t);return null==e?null:{navigationTiming:e,agent:{timeToFirstByte:e.responseStart,domInteractive:e.domInteractive,domComplete:e.domComplete}}}function Xt(t){if(t.captureTimings){var e=t._end;if(t.type===K){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=[],a=0;a<Ht.length;a++){var o=t[Ht[a][0]],s=t[Ht[a][1]];if(Bt(o,s,n,r,e)){var c=new qt(Ht[a][2],"hard-navigation.browser-timing"),u=null;"requestStart"===Ht[a][0]&&(c.pageResponse=!0,u={url:location.origin}),c._start=o-e,c.end(s-e,u),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(Vt(r))}if(D()){var i=t._start;(function(t,e,n,r){for(var i=[],a=0;a<t.length;a++){var o=t[a],s=o.initiatorType,c=o.name,u=o.startTime,f=o.responseEnd;-1!==G.indexOf(s)&&null!=c&&(("xmlhttprequest"===s||"fetch"===s)&&(/intake\/v\d+\/rum\/events/.test(c)||zt(u,e))||Bt(u,f,n,r)&&i.push(Dt(t[a])))}return i})(_.getEntriesByType("resource"),ft.bootstrapTime,i,e).forEach((function(e){return t.spans.push(e)})),function(t,e,n){for(var r=[],i=0;i<t.length;i++){var a=t[i],o=a.name,s=a.startTime,c=a.duration,u=s+c;if(!(c<=60)&&Bt(s,u,e,n)){var f=new qt(o,"app");f._start=s,f.end(u),r.push(f)}}return r}(_.getEntriesByType("measure"),i,e).forEach((function(e){return t.spans.push(e)}))}}}function Jt(t){return{ts:t.transfer_size,ebs:t.encoded_body_size,dbs:t.decoded_body_size}}function Wt(t){if(!t)return null;var e={},n=t.page,r=t.http,i=t.response,a=t.destination,o=t.user,s=t.custom;if(n&&(e.p={rf:n.referer,url:n.url}),r&&(e.h=function(t){var e={},n=t.method,r=t.status_code,i=t.url,a=t.response;return e.url=i,n&&(e.mt=n),r&&(e.sc=r),a&&(e.r=Jt(a)),e}(r)),i&&(e.r=Jt(i)),a){var c=a.service;e.dt={se:{n:c.name,t:c.type,rc:c.resource},ad:a.address,po:a.port}}return o&&(e.u={id:o.id,un:o.username,em:o.email}),s&&(e.cu=s),e}function Yt(t){if(!t)return null;var e=t.navigationTiming,n=t.agent,r={nt:{}};$t.forEach((function(t,n){var i=Ut[n];r.nt[t]=e[i]})),r.a={fb:r.nt.rs,di:r.nt.di,dc:r.nt.dc};var i=n.firstContentfulPaint,a=n.largestContentfulPaint;return i&&(r.a.fp=i),a&&(r.a.lp=a),r}var Zt=function(){function t(t,e){this._configService=t,this._loggingService=e,this.queue=void 0,this.throttleEvents=R}var e=t.prototype;return e.init=function(){var t=this,e=this._configService.get("queueLimit"),n=this._configService.get("flushInterval"),r=this._configService.get("eventsLimit");this.queue=new Rt((function(e){var n=t.sendEvents(e);n&&n.catch((function(e){t._loggingService.warn("Failed sending events!",t._constructError(e))}))}),{queueLimit:e,flushInterval:n}),this.throttleEvents=function(t,e,n){var r,i=this,a=n.limit,o=n.interval,s=0;return function(){return s++,void 0===r&&(r=setTimeout((function(){s=0,r=void 0}),o)),s>a&&"function"==typeof e?e.apply(i,arguments):t.apply(i,arguments)}}(this.queue.add.bind(this.queue),(function(){return t._loggingService.warn("Dropped events due to throttling!")}),{limit:r,interval:6e4})},e._postJson=function(t,e){var n=this,r={"Content-Type":"application/x-ndjson"};return function(t,e,n){void 0===n&&(n="gzip");var r="function"==typeof CompressionStream;return new g((function(i){if(!r)return i({payload:t,headers:e});var a=new Blob([t]).stream().pipeThrough(new CompressionStream(n));return new Response(a).blob().then((function(t){return e["Content-Encoding"]=n,i({payload:t,headers:e})}))}))}(e,r).catch((function(t){return{payload:e,headers:r}})).then((function(e){return n._makeHttpRequest("POST",t,e)})).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?{}:n,i=r.timeout,a=void 0===i?1e4:i,o=r.payload,s=r.headers;return new g((function(n,r){var i=new window.XMLHttpRequest;if(i[X]=!0,i.open(t,e,!0),i.timeout=a,s)for(var c in s)s.hasOwnProperty(c)&&i.setRequestHeader(c,s[c]);i.onreadystatechange=function(){if(4===i.readyState){var t=i.status,a=i.responseText;0===t||t>399&&t<600?r({url:e,status:t,responseText:a}):n(i)}},i.onerror=function(){var t=i.status,n=i.responseText;r({url:e,status:t,responseText:n})},i.send(o)}))},e.fetchConfig=function(t,e){var n=this,r=this._configService.get("serverUrl")+"/config/v1/rum/agents";if(!t)return g.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 a=JSON.parse(r),o=t.getResponseHeader("etag");return o&&(a.etag=o.replace(/["]/g,""),n._configService.setLocalConfig(a)),a})).catch((function(t){var e=n._constructError(t);return g.reject(e)}))},e.createMetaData=function(){var t=this._configService,e={service:{name:t.get("serviceName"),version:t.get("serviceVersion"),agent:{name:"rum-js",version:t.version},language:{name:"javascript"},environment:t.get("environment")},labels:t.get("context.tags")};return jt(Et,e)},e.addError=function(t){var e;this.throttleEvents(((e={}).errors=t,e))},e.addTransaction=function(t){var e;this.throttleEvents(((e={}).transactions=t,e))},e.ndjsonErrors=function(t,e){var n=e?"e":"error";return t.map((function(t){var r;return Mt.stringify(((r={})[n]=e?function(t){var e,n=t.exception,r={id:t.id,cl:t.culprit,ex:{mg:n.message,st:(e=n.stacktrace,e.map((function(t){return{ap:t.abs_path,f:t.filename,fn:t.function,li:t.lineno,co:t.colno}}))),t:t.type},c:Wt(t.context)},i=t.transaction;return i&&(r.tid=t.trace_id,r.pid=t.parent_id,r.xid=t.transaction_id,r.x={t:i.type,sm:i.sampled}),r}(t):t,r))}))},e.ndjsonMetricsets=function(t){return t.map((function(t){return Mt.stringify({metricset:t})})).join("")},e.ndjsonTransactions=function(t,e){var n=this,r=e?"x":"transaction";return t.map((function(t){var i,a="",o="";return e||(t.spans&&(a=t.spans.map((function(t){return Mt.stringify({span:t})})).join(""),delete t.spans),t.breakdown&&(o=n.ndjsonMetricsets(t.breakdown),delete t.breakdown)),Mt.stringify(((i={})[r]=e?function(t){var e,n=t.spans.map((function(e){var n={id:e.id,n:e.name,t:e.type,s:e.start,d:e.duration,c:Wt(e.context)};return e.parent_id!==t.id&&(n.pid=e.parent_id),!0===e.sync&&(n.sy=!0),e.subtype&&(n.su=e.subtype),e.action&&(n.ac=e.action),n}));return{id:t.id,tid:t.trace_id,n:t.name,t:t.type,d:t.duration,c:Wt(t.context),m:Yt(t.marks),me:(e=t.breakdown,e.map((function(t){var e=t.span,n=t.samples,r=null!=e;return r?{y:{t:e.type},sa:{ysc:{v:n["span.self_time.count"].value},yss:{v:n["span.self_time.sum.us"].value}}}:{sa:{xdc:{v:n["transaction.duration.count"].value},xds:{v:n["transaction.duration.sum.us"].value},xbc:{v:n["transaction.breakdown.count"].value}}}}))),y:n,yc:{sd:n.length},sm:t.sampled,exp:t.experience}}(t):t,i))+a+o}))},e.sendEvents=function(t){var e,n;if(0!==t.length){for(var r=[],i=[],a=0;a<t.length;a++){var o=t[a];o.transactions&&r.push(o.transactions),o.errors&&i.push(o.errors)}if(0!==r.length||0!==i.length){var s=this._configService,c=((e={}).transactions=r,e.errors=i,e),u=s.applyFilters(c);if(u){var f=s.get("apiVersion"),d=f>2,p=[],l=this.createMetaData(),v=d?"m":"metadata";p.push(Mt.stringify(((n={})[v]=d?function(t){var e=t.service,n=t.labels,r=e.agent,i=e.language;return{se:{n:e.name,ve:e.version,a:{n:r.name,ve:r.version},la:{n:i.name},en:e.environment},l:n}}(l):l,n)));var h=(p=p.concat(this.ndjsonErrors(u.errors,d),this.ndjsonTransactions(u.transactions,d))).join(""),g=s.get("serverUrl")+"/intake/v"+f+"/rum/events";return this._postJson(g,h)}this._loggingService.warn("Dropped payload due to filtering!")}}},t}();var Gt,Kt=function(){function t(){this.config={serviceName:"",serviceVersion:"",environment:"",serverUrl:"http://localhost:8200",active:!0,instrument:!0,disableInstrumentations:[],logLevel:"warn",breakdownMetrics:!1,ignoreTransactions:[],eventsLimit:80,queueLimit:-1,flushInterval:500,distributedTracing:!0,distributedTracingOrigins:[],distributedTracingHeaderName:"traceparent",pageLoadTraceId:"",pageLoadSpanId:"",pageLoadSampled:!1,pageLoadTransactionName:"",transactionSampleRate:1,centralConfig:!1,monitorLongtasks:!0,apiVersion:2,context:{}},this.events=new ot,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 a=r[i];if(n.test(a.nodeName)){var o=a.nodeName.match(n)[1].split("-").map((function(t,e){return e>0?t.charAt(0).toUpperCase()+t.substring(1):t})).join("");e[o]=a.value||a.nodeValue}}return e}(I());this.setConfig(t)},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,a=n.email;"number"!=typeof r&&"string"!=typeof r||(e.id=r),"string"==typeof i&&(e.username=i),"string"==typeof a&&(e.email=a),this.config.context.user=j(this.config.context.user||{},e)},e.setCustomContext=function(t){void 0===t&&(t={}),this.config.context.custom=j(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 O(n,t[n],e.config.context.tags)}))},e.setConfig=function(t){void 0===t&&(t={}),t.serverUrl&&(t.serverUrl=t.serverUrl.replace(/\/+$/,"")),F(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}(),Qt=function(){function t(t){void 0===t&&(t={}),this.levels=["trace","debug","info","warn","error"],this.level=t.level||"warn",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){t!==this.level&&(this.level=t,this.resetLogMethods())},e.resetLogMethods=function(){var t=this;this.levels.forEach((function(e){t[e]=t.shouldLog(e)?function(){var t=e;"trace"!==e&&"debug"!==e||(t="info");var n=arguments;if(n[0]=this.prefix+n[0],console){var r=console[t]||console.log;"function"==typeof r&&r.apply(console,n)}}:R}))},t}(),te=((Gt={}).ConfigService=function(){return new Kt},Gt.LoggingService=function(){return new Qt({prefix:"[Elastic APM] "})},Gt.ApmServer=function(t){var e=t.getService(["ConfigService","LoggingService"]),n=e[0],r=e[1];return new Zt(n,r)},Gt),ee=function(){function t(){this.instances={},this.initialized=!1}var e=t.prototype;return e.init=function(){if(!this.initialized){this.initialized=!0;var t=this.getService("ConfigService");t.init();var e=this.getService(["LoggingService","ApmServer"]),n=e[0],r=e[1];t.events.observe("config:change",(function(){var e=t.get("logLevel");n.setLevel(e)})),r.init()}},e.getService=function(t){var e=this;return"string"==typeof t?(this.instances[t]||"function"==typeof te[t]&&(this.instances[t]=te[t](this)),this.instances[t]):Array.isArray(t)?t.map((function(t){return e.getService(t)})):void 0},t}();var ne=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.history&&st.observe("history",this.getHistorySub()),t.xmlhttprequest&&st.observe("xmlhttprequest",this.getXHRSub()),t.fetch&&st.observe("fetch",this.getFetchSub()),t.eventtarget&&st.observe("eventtarget",this.getEventTargetSub())},e.getEventTargetSub=function(){var t=this._transactionService;return function(e,n){if("schedule"===e&&"eventtarget"===n.source&&"click"===n.eventType){var r=n.target,i=r.getAttribute("name"),a="";i&&(a='["'+i+'"]');var o=r.tagName.toLowerCase(),s=t.startTransaction("Click - "+o+a,"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){"history"===n.source&&e===Z&&t.startTransaction(n.data.title,"route-change",{managed:!0,canReuse:!0})}},e.getXHRSub=function(){var t=this;return function(e,n){"xmlhttprequest"!==n.source||U.fetchInProgress||t.processAPICalls(e,n)}},e.getFetchSub=function(){var t=this;return function(e,n){"fetch"===n.source&&t.processAPICalls(e,n)}},e.processAPICalls=function(t,e){var n=this._configService,r=this._transactionService;if("schedule"===t&&e.data){var i=e.data,a=new yt(i.url),o=i.method+" "+(a.relative?a.path:C(a.href));r.getCurrentTransaction()||r.startTransaction(o,"http-request",{managed:!0});var s=r.startSpan(o,"external.http",{blocking:!0});if(!s)return;var c=n.get("distributedTracing"),u=n.get("distributedTracingOrigins"),f=new yt(window.location.href),d=E(a.origin,f.origin)||E(a.origin,u),p=i.target;c&&d&&p&&this.injectDtHeader(s,p),i.sync&&(s.sync=i.sync),i.span=s}else if(t===Z){var l=e.data;l&&l.span&&r.endSpan(l.span,l)}},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),a=/^[\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&&a&&("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}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:parseInt(n._start-e),duration:n.duration(),context:n.context};return jt(Lt,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,experience:t.experience};return jt(Ct,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(a,o){if(0===r.length)r.push(a);else{var s=r[r.length-1],c=s.type===a.type&&s.subtype===a.subtype&&s.action===a.action&&s.name===a.name&&a.duration()/e<n&&(a._start-s._end)/e<n,u=t.length===o+1;c&&(i++,s._end=a._end),i>1&&(!c||u)&&(s.name=i+"x "+s.name,i=1),c||r.push(a)}})),r}(e,t.duration(),.05);t.spans=n}else t.spans=e}else t.resetSpans();return t}(t);if(this.filterTransaction(e))return this.createTransactionDataModel(t)},t}(),re=[["domainLookupStart","domainLookupEnd","DNS"],["connectStart","connectEnd","TCP"],["requestStart","responseStart","Request"],["responseStart","responseEnd","Response"],["domLoading","domComplete","Processing"],["loadEventStart","loadEventEnd","Load"]];function ie(t){return{value:t}}function ae(t,e){var n=e.details,r=e.count,i=void 0===r?1:r,a=e.duration;return{transaction:t,span:n,samples:{"span.self_time.count":ie(i),"span.self_time.sum.us":ie(a)}}}var oe=function(t){var e,n;function r(e,n,r){var i;return(i=t.call(this,e,n,r)||this).traceId=T(),i.marks=void 0,i.spans=[],i._activeSpans={},i._activeTasks=new Set,i.blocked=!1,i.captureTimings=!1,i.breakdownTimings=[],i.sampled=Math.random()<=i.options.transactionSampleRate,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=F(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&&j(this.options,n)},i.startSpan=function(t,e,n){var r=this;if(!this.ended){var i=j({},n);i.onEnd=function(t){r._onSpanEnd(t)},i.traceId=this.traceId,i.sampled=this.sampled,i.parentId||(i.parentId=this.id);var a=new qt(t,e,i);return this._activeSpans[a.id]=a,i.blocking&&this.addTask(a.id),a}},i.isFinished=function(){return!this.blocked&&0===this._activeTasks.size},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,a=t.type,o=t.sampled,s={name:i,type:a};if(n.push({transaction:s,samples:{"transaction.duration.count":ie(1),"transaction.duration.sum.us":ie(r),"transaction.breakdown.count":ie(o?1:0)}}),!o)return n;if(a===K&&e)for(var c=0;c<re.length;c++){var u=re[c],f=H(e[u[0]],e[u[1]]);0!==f&&null!=f&&n.push(ae(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],a=i._end,o=i._start,s=a,c=o-n,u=1;u<e.length;u++)o=(i=e[u])._start,a=i._end,o>s?(c+=o-s,s=a):a>s&&(s=a);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 a=r[i],o=a.duration();if(0!==o&&null!=o){var s=a.type,c=a.subtype,u=s.replace(".truncated","");c&&(u+="."+c),e[u]||(e[u]={duration:0,count:0}),e[u].count++,e[u].duration+=o}}return e}(t);Object.keys(d).forEach((function(t){var e=t.split("."),r=e[0],i=e[1],a=d[t],o=a.duration,c=a.count;n.push(ae(s,{details:{type:r,subtype:i},duration:o,count:c}))}))}return n}(this)},i.block=function(t){this.blocked=t,this.blocked||this.detectFinish()},i.addTask=function(t){return t||(t="task-"+T(16)),this._activeTasks.add(t),t},i.removeTask=function(t){this._activeTasks.delete(t)&&this.detectFinish()},i.resetSpans=function(){this.spans=[]},i._onSpanEnd=function(t){this.spans.push(t),delete this._activeSpans[t.id],this.removeTask(t.id)},i.isManaged=function(){return!!this.options.managed},r}(Pt),se={fid:0,fcp:0,tbt:{start:1/0,duration:0},cls:0};function ce(t,e){var n=e.capturePaint,r=t.getEntriesByType("longtask"),i={spans:function(t){for(var e=[],n=0;n<t.length;n++){var r=t[n],i=r.name,a=r.startTime,o=r.duration,s=r.attribution,c=a+o,u=new qt("Longtask("+i+")","longtask",{startTime:a});if(s.length>0){var f=s[0],d=f.name,p=f.containerType,l=f.containerName,v=f.containerId,h={attribution:d,type:p};l&&(h.name=l),v&&(h.id=v),u.addContext({custom:h})}u.end(c),e.push(u)}return e}(r),marks:{}};if(!n)return i;var a=t.getEntriesByType("largest-contentful-paint"),o=a[a.length-1];if(o){var s=parseInt(o.startTime);se.lcp=s,i.marks.largestContentfulPaint=s}var c=_.timing,u=c.fetchStart-c.navigationStart,f=t.getEntriesByName("first-contentful-paint")[0];if(f){var d=parseInt(u>=0?f.startTime-u:f.startTime);se.fcp=d,i.marks.firstContentfulPaint=d}var p=function(t){var e=t[0];if(e){var n=e.startTime,r=e.processingStart,i=new qt("First Input Delay","first-input",{startTime:n});return i.end(r),i}}(t.getEntriesByType("first-input"));return p&&(se.fid=p.duration(),i.spans.push(p)),function(t){t.forEach((function(t){var e=t.name,n=t.startTime,r=t.duration;if(!(n<se.fcp||"self"!==e&&-1===e.indexOf("same-origin"))){se.tbt.start=Math.min(se.tbt.start,n);var i=r-50;i>0&&(se.tbt.duration+=i)}}))}(r),function(t){t.forEach((function(t){t.hadRecentInput||(se.cls+=t.value)}))}(t.getEntriesByType("layout-shift")),i}var ue=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;"longtask"===t&&(e=!1),this.po.observe({type:t,buffered:e})}catch(t){}},e.stop=function(){this.po.disconnect()},t}(),fe=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 ue((function(t){var e=n.getCurrentTransaction();if(e&&e.captureTimings){var r,i=!1;e.type===K&&(i=!0);var a=ce(t,{capturePaint:i}),o=a.spans,s=a.marks;(r=e.spans).push.apply(r,o),e.addMarks({agent:s})}}))}var e=t.prototype;return e.createCurrentTransaction=function(t,e,n){var r=new oe(t,e,n);return this.currentTransaction=r,r},e.getCurrentTransaction=function(){if(this.currentTransaction&&!this.currentTransaction.ended)return this.currentTransaction},e.createOptions=function(t){var e=this._config.config,n=j({transactionSampleRate:e.transactionSampleRate},t);return n.managed&&(n=j({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 a=r.type,o=Q.indexOf(r.type),s=Q.indexOf(e);o>=0&&s<o&&(a=e),r.redefine(t,a,n),i=!0}else r.end(),r=this.createCurrentTransaction(t,e,n);else r=this.createCurrentTransaction(t,e,n);return r.type===K&&(i||(this.recorder.start("largest-contentful-paint"),this.recorder.start("paint"),this.recorder.start("first-input"),this.recorder.start("layout-shift")),n.pageLoadTraceId&&(r.traceId=n.pageLoadTraceId),n.pageLoadSampled&&(r.sampled=n.pageLoadSampled),"Unknown"===r.name&&n.pageLoadTransactionName&&(r.name=n.pageLoadTransactionName)),!i&&this._config.get("monitorLongtasks")&&this.recorder.start("longtask"),r.sampled&&(r.captureTimings=!0),r},e.startTransaction=function(t,e,n){var r,i=this,a=this.createOptions(n),o=!0;a.managed?this.currentTransaction===(r=this.startManagedTransaction(t,e,a))&&(o=!1):r=new oe(t,e,a);return r.onEnd=function(){return i.handleTransactionEnd(r)},o&&this._config.events.send("transaction:start",[r]),r},e.handleTransactionEnd=function(t){var e=this;this.recorder.stop();var n=window.location.href;return g.resolve().then((function(){var r=t.name,i=t.type;if(!(ft.lastHiddenStart>=t._start||e.shouldIgnoreTransaction(r)||"temporary"===i)){if(i===K){var a=e._config.get("pageLoadTransactionName");if("Unknown"===r&&a&&(t.name=a),t.captureTimings){var o=se.cls,s=se.fid,c=se.tbt;c.duration>0&&t.spans.push((f=(u=c).start,d=u.duration,(p=new qt("Total Blocking Time","longtask",{startTime:f})).end(f+d),p)),t.experience={},z("longtask")&&(t.experience.tbt=c.duration),z("layout-shift")&&(t.experience.cls=o),s>0&&(t.experience.fid=s)}}var u,f,d,p;"Unknown"===t.name&&(t.name=function(t,e){void 0===e&&(e=2);for(var n=new yt(t),r=n.query,i=n.path.substring(1).split("/"),a=/\W|_/g,o=/[0-9]/g,s=/[a-z]/g,c=/[A-Z]/g,u=[],f=!1,d=0;d<i.length;d++){var p=i[d];if(f||d>e-1){p&&u.push("*");break}if((p.match(a)||[]).length>=2)u.push(":id"),f=!0;else{var l=(p.match(o)||[]).length;if(l>3||p.length>3&&l/p.length>=.3)u.push(":id"),f=!0;else{var v=(p.match(c)||[]).length,h=(p.match(s)||[]).length/p.length,g=v/p.length;p.length>5&&(g>.3&&g<.6||h>.3&&h<.6)?(u.push(":id"),f=!0):p&&u.push(p)}}}return"/"+(u.length>=2?u.join("/"):u.join(""))+(r?"?{query}":"")}(n)),Xt(t),e.adjustTransactionTime(t),e._config.get("breakdownMetrics")&&t.captureBreakdown();var l=e._config.get("context");Tt(t,l),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,a=0;a<e.length;a++){var o=e[a];o._end>i&&(o._end=i,o.type+=".truncated"),o._start>i&&(o._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.getCurrentTransaction();r||(r=this.createCurrentTransaction(void 0,"temporary",this.createOptions({canReuse:!0,managed:!0})));var i=r.startSpan(t,e,n);return i},e.endSpan=function(t,e){t&&t.end(null,e)},t}();function de(){return te.TransactionService=function(t){var e=t.getService(["LoggingService","ConfigService"]),n=e[0],r=e[1];return new fe(n,r)},te.PerformanceMonitoring=function(t){var e=t.getService(["ApmServer","ConfigService","LoggingService","TransactionService"]),n=e[0],r=e[1],i=e[2],a=e[3];return new ne(n,r,i,a)},te.ErrorLogging=function(t){var e=t.getService(["ApmServer","ConfigService","TransactionService"]),n=e[0],r=e[1],i=e[2];return new At(n,r,i)},new ee}var pe=function(){function t(t,e){this._disable=e,this.serviceFactory=t,this._initialized=!1}var e=t.prototype;return e.isEnabled=function(){return!this._disable},e.isActive=function(){var t=this.serviceFactory.getService("ConfigService");return this.isEnabled()&&this._initialized&&t.get("active")},e.init=function(t){var e=this;if(this.isEnabled()&&!this._initialized){this._initialized=!0;var n=this.serviceFactory.getService(["ConfigService","LoggingService"]),r=n[0],i=n[1];r.setVersion("5.6.0"),this.config(t);var a=r.get("logLevel");if(i.setLevel(a),r.get("active")){this.serviceFactory.init();var o=function(t,e){var n,r=((n={}).xmlhttprequest=!1,n.fetch=!1,n.history=!1,n[K]=!1,n.error=!1,n.eventtarget=!1,n);return t?(Object.keys(r).forEach((function(t){-1===e.indexOf(t)&&(r[t]=!0)})),r):r}(r.get("instrument"),r.get("disableInstrumentations"));if(this.serviceFactory.getService("PerformanceMonitoring").init(o),o.error)this.serviceFactory.getService("ErrorLogging").registerListeners();var s=function(){return o[K]&&e._sendPageLoadMetrics()};r.get("centralConfig")?this.fetchCentralConfig().then(s):s()}else this._disable=!0,i.warn("RUM agent is inactive")}return this},e.fetchCentralConfig=function(){var t=this.serviceFactory.getService(["ApmServer","LoggingService","ConfigService"]),e=t[0],n=t[1],r=t[2];return e.fetchConfig(r.get("serviceName"),r.get("environment")).then((function(t){var e=t.transaction_sample_rate;if(e){var i={transactionSampleRate:e=Number(e)},a=r.validate(i).invalid;if(0===a.length)r.setConfig(i);else{var o=a[0],s=o.key,c=o.value,u=o.allowed;n.warn('invalid value "'+c+'" for '+s+". Allowed: "+u+".")}}return t})).catch((function(t){n.warn("failed fetching config:",t)}))},e._sendPageLoadMetrics=function(){var t=this.startTransaction(void 0,K,{managed:!0,canReuse:!0});if(t){t.addTask(K);var e=function(){setTimeout((function(){return t.removeTask(K)}))};"complete"===document.readyState?e():window.addEventListener("load",e)}},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 a=this.serviceFactory.getService("LoggingService"),o="RUM agent isn't correctly configured. ";r.length>0&&(o+=r.join(", ")+" is missing",i.length>0&&(o+=", ")),i.forEach((function(t,e){var n=t.key,r=t.value,a=t.allowed;o+=n+' "'+r+'" contains invalid characters! (allowed: '+a+")"+(e!==i.length-1?", ":"")})),a.error(o),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.addLabels=function(t){this.serviceFactory.getService("ConfigService").addLabels(t)},e.setInitialPageLoadName=function(t){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,n){if(this.isEnabled())return this.serviceFactory.getService("TransactionService").startSpan(t,e,n)},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}();var le=function(){if(y&&window.elasticApm)return window.elasticApm;var t=pt(),e=de(),n=new pe(e,!t);return y&&(window.elasticApm=n),n}(),ve=le.init.bind(le),he=n(2),ge=n(0),me=n(1);var ye=function(t){var e,n;function r(e,n){var r;return(r=t.call(this)||this).__tracer=e,r.span=n,r.isTransaction=n instanceof oe,r.spanContext={id:n.id,traceId:n.traceId,sampled:n.sampled},r}n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n;var i=r.prototype;return i._context=function(){return this.spanContext},i._tracer=function(){return this.__tracer},i._setOperationName=function(t){this.span.name=t},i._addTags=function(t){var e=j({},t);if(e.type&&(this.span.type=e.type,delete e.type),this.isTransaction){var n=e["user.id"],r=e["user.username"],i=e["user.email"];(n||r||i)&&(this.span.addContext({user:{id:n,username:r,email:i}}),delete e["user.id"],delete e["user.username"],delete e["user.email"])}this.span.addLabels(e)},i._log=function(t,e){"error"===t.event&&(t["error.object"]?this.__tracer.errorLogging.logError(t["error.object"]):t.message&&this.__tracer.errorLogging.logError(t.message))},i._finish=function(t){this.span.end(),t&&(this.span._end=t-L())},r}(me.Span);var _e=function(t){var e,n;function r(e,n,r,i){var a;return(a=t.call(this)||this).performanceMonitoring=e,a.transactionService=n,a.loggingService=r,a.errorLogging=i,a}n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n;var i=r.prototype;return i._startSpan=function(t,e){var n,r={managed:!0};if(e)if(r.timestamp=e.startTime,e.childOf)r.parentId=e.childOf.id;else if(e.references&&e.references.length>0){e.references.length;var i=function(t,e,n){if(null==t)throw new TypeError("array is null or not defined");var r=Object(t),i=r.length>>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var a=0;a<i;){var o=r[a];if(e.call(n,o,a,r))return o;a++}}(e.references,(function(t){return t.type()===ge.REFERENCE_CHILD_OF}));i&&(r.parentId=i.referencedContext().id)}if(!(n=this.transactionService.getCurrentTransaction()?this.transactionService.startSpan(t,void 0,r):this.transactionService.startTransaction(t,void 0,r)))return new me.Span;r.timestamp&&(n._start=r.timestamp-L());var a=new ye(this,n);return e&&e.tags&&a.addTags(e.tags),a},i._inject=function(t,e,n){switch(e){case ge.FORMAT_TEXT_MAP:case ge.FORMAT_HTTP_HEADERS:this.performanceMonitoring.injectDtHeader(t,n);break;case ge.FORMAT_BINARY:0}},i._extract=function(t,e){var n;switch(t){case ge.FORMAT_TEXT_MAP:case ge.FORMAT_HTTP_HEADERS:n=this.performanceMonitoring.extractDtHeader(e);break;case ge.FORMAT_BINARY:0}return n||(n=null),n},r}(he.Tracer);function Se(t){return t._disable?new he.Tracer:(e=t.serviceFactory,n=e.getService("PerformanceMonitoring"),r=e.getService("TransactionService"),i=e.getService("ErrorLogging"),a=e.getService("LoggingService"),new _e(n,r,a,i));var e,n,r,i,a}"undefined"!=typeof window&&window.elasticApm&&(window.elasticApm.createTracer=Se.bind(window.elasticApm,window.elasticApm));e.default=Se}]); | ||
//# sourceMappingURL=elastic-apm-opentracing.umd.min.js.map |
@@ -1,2 +0,2 @@ | ||
!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,n){var r,i,a;!function(o,s){"use strict";i=[n(3)],void 0===(a="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 a(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(a(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,a=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,a,r[1],r[2],e)}),this)},parseFFOrSafari:function(e){return i(a(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=[],a=2,o=r.length;a<o;a+=2){var s=n.exec(r[a]);s&&i.push(new t(void 0,void 0,s[2],s[1],void 0,r[a]))}return i},parseOpera10:function(e){for(var n=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=e.stacktrace.split("\n"),i=[],a=0,o=r.length;a<o;a+=2){var s=n.exec(r[a]);s&&i.push(new t(s[3]||void 0,void 0,s[2],s[1],void 0,r[a]))}return i},parseOpera11:function(n){return i(a(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()),a=r.shift()||"",o=a.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^\)]*\)/g,"")||void 0;a.match(/\(([^\)]*)\)/)&&(n=a.replace(/^[^\(]+\(([^\)]*)\)$/,"$1"));var s=void 0===n||"[arguments not available]"===n?void 0:n.split(",");return new t(o,s,i[0],i[1],i[2],e)}),this)}}})?r.apply(e,i):r)||(t.exports=a)}()},,,function(t,e,n){var r,i,a;!function(n,o){"use strict";i=[],void 0===(a="function"==typeof(r=function(){function t(t){return!isNaN(parseFloat(t))&&isFinite(t)}function e(t,e,n,r,i,a){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!==a&&this.setSource(a)}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=a)}()},function(t,e,n){"use strict";n.r(e),n.d(e,"init",(function(){return Je})),n.d(e,"apmBase",(function(){return Ve})),n.d(e,"ApmBase",(function(){return $e})),n.d(e,"apm",(function(){return Ve}));var r=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)}))}))},i=setTimeout;function a(t){return Boolean(t&&void 0!==t.length)}function o(){}function s(t){if(!(this instanceof s))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 c(t,e){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,s._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 f(e.promise,t)}u(e.promise,r)}else(1===t._state?u:f)(e.promise,t._value)}))):t._deferreds.push(e)}function u(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 s)return t._state=3,t._value=e,void d(t);if("function"==typeof n)return void l((r=n,i=e,function(){r.apply(i,arguments)}),t)}t._state=1,t._value=e,d(t)}catch(e){f(t,e)}var r,i}function f(t,e){t._state=2,t._value=e,d(t)}function d(t){2===t._state&&0===t._deferreds.length&&s._immediateFn((function(){t._handled||s._unhandledRejectionFn(t._value)}));for(var e=0,n=t._deferreds.length;e<n;e++)c(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,u(e,t))}),(function(t){n||(n=!0,f(e,t))}))}catch(t){if(n)return;n=!0,f(e,t)}}s.prototype.catch=function(t){return this.then(null,t)},s.prototype.then=function(t,e){var n=new this.constructor(o);return c(this,new p(t,e,n)),n},s.prototype.finally=r,s.all=function(t){return new s((function(e,n){if(!a(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 s=0;s<r.length;s++)o(s,r[s])}))},s.resolve=function(t){return t&&"object"==typeof t&&t.constructor===s?t:new s((function(e){e(t)}))},s.reject=function(t){return new s((function(e,n){n(t)}))},s.race=function(t){return new s((function(e,n){if(!a(t))return n(new TypeError("Promise.race accepts an array"));for(var r=0,i=t.length;r<i;r++)s.resolve(t[r]).then(e,n)}))},s._immediateFn="function"==typeof setImmediate&&function(t){setImmediate(t)}||function(t){i(t,0)},s._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};var v=s,h={};y?h=window:"undefined"!=typeof self&&(h=self);var g="Promise"in h?h.Promise:v,m=[].slice,y="undefined"!=typeof window,_=y&&"undefined"!=typeof performance?performance:{};for(var b=[],S=0;S<256;++S)b[S]=(S+256).toString(16).substr(1);var w=new Uint8Array(16);function T(t){return function(t){for(var e=[],n=0;n<t.length;n++)e.push(b[t[n]]);return e.join("")}("undefined"!=typeof crypto&&"function"==typeof crypto.getRandomValues?crypto.getRandomValues(w):"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues?msCrypto.getRandomValues(w):w).substr(0,t)}function E(t,e){var n=!1;return"string"==typeof e?n=t===e:Array.isArray(e)&&e.forEach((function(e){n||(n=E(t,e))})),n}function x(){return y&&"function"==typeof Set&&"function"==typeof JSON.stringify&&_&&"function"==typeof _.now&&"withCredentials"in new window.XMLHttpRequest}function k(t,e,n){if(n&&t){var r=P(t),i=typeof e;return null!=e&&"boolean"!==i&&"number"!==i&&(e=String(e)),n[r]=e,n}}function L(t){return t&&t.split("?")[0]}function O(t){return null!==t&&"object"==typeof t}function C(t,e,n){for(var r=0,i=e.length;r<i;++r){var a=e[r];if(O(a)||"function"==typeof a)for(var o=Object.keys(a),s=0,c=o.length;s<c;s++){var u=o[s],f=a[u];n&&O(f)?(O(t[u])||(t[u]=Array.isArray(f)?[]:{}),C(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 I(t){return C(t,m.call(arguments,1),!1)}function j(t){return C(t,m.call(arguments,1),!0)}function F(t){return void 0===t}function A(){}function P(t){return t.replace(/[.*"]/g,"_")}function R(){return _.now()}function M(t){return"number"==typeof t&&t>=0?t:R()}function q(t,e){return F(e)||F(t)?null:parseInt(e-t)}function H(t){g.resolve().then(t)}function z(){return"function"==typeof _.getEntriesByType}function D(t){return"undefined"!=typeof PerformanceObserver&&PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.indexOf(t)>=0}var B={fetchInProgress:!1};function U(t){return"__apm_symbol__"+t}function $(t,e,n){for(var r=t;r&&!r.hasOwnProperty(e);)r=Object.getPrototypeOf(r);!r&&t[e]&&(r=t);var i,a,o,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)},a=r[e],o=i,a[U("OriginalDelegate")]=o}}return i}var V=U("xhrIgnore"),J=U("xhrSync"),X=U("xhrURL"),Z=U("xhrMethod"),G="schedule",W="invoke",K="addEventListener",Q="removeEventListener",Y=["link","css","script","img","xmlhttprequest","fetch","beacon","iframe"],tt=3e5,et="page-load",nt="custom",rt="Unknown",it=[et,"route-change","user-interaction","http-request",nt,"temporary"],at=60,ot="xmlhttprequest",st="fetch",ct="history",ut="eventtarget",ft="error",dt="longtask",pt="measure",lt="navigation",vt="resource",ht="first-contentful-paint",gt="largest-contentful-paint",mt="first-input",yt="layout-shift",_t="ConfigService",bt="LoggingService",St="ApmServer",wt=".truncated",Tt=1024;function Et(t){var e=XMLHttpRequest.prototype;if(e&&e[K])var n="readystatechange",r="load",i="error",a="timeout",o="abort",s=$(e,"open",(function(){return function(t,e){return t[V]||(t[Z]=e[0],t[X]=e[1],t[J]=!1===e[2]),s.apply(t,e)}})),c=$(e,"send",(function(){return function(e,s){if(e[V])return c.apply(e,s);var f={source:ot,state:"",type:"macroTask",data:{target:e,method:e[Z],sync:e[J],url:e[X],status:""}};try{return function(e){if(e.state!==G){e.state=G,t(G,e);var s=e.data.target;c(n),c(r),c(a),c(i),c(o)}function c(t){s[K](t,(function(t){var i=t.type;i===n?4===s.readyState&&0!==s.status&&u(e,"success"):u(e,i===r?"success":i)}))}}(f),c.apply(e,s)}catch(t){throw u(f,i),t}}}));function u(e,n){e.state!==W&&(e.state=W,e.data.status=n,t(W,e))}}for(var xt=["click"],kt={},Lt=0;Lt<xt.length;Lt++){var Ot=xt[Lt];kt[Ot]=U(Ot)}function Ct(t,e,n){return t instanceof Element&&xt.indexOf(e)>=0&&"function"==typeof n}var Nt=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}(),It=new Nt,jt=!1;function Ft(){return jt||(jt=!0,Et((function(t,e){It.send(ot,[t,e])})),function(t){if(window.fetch&&window.Request){var e=window.fetch;window.fetch=function(t,i){var a,o,s=this,c=arguments;if("string"==typeof t)a=new Request(t,i),o=t;else{if(!t)return e.apply(s,c);o=(a=t).url}var u={source:st,state:"",type:"macroTask",data:{target:a,method:a.method,url:o,aborted:!1}};return new g((function(t,i){var o;B.fetchInProgress=!0,n(u);try{o=e.apply(s,[a])}catch(t){return i(t),u.data.error=t,r(u),void(B.fetchInProgress=!1)}o.then((function(e){t(e),H((function(){u.data.response=e,r(u)}))}),(function(t){i(t),H((function(){u.data.error=t,r(u)}))})),B.fetchInProgress=!1}))}}function n(e){e.state=G,t(G,e)}function r(e){e.state=W,t(W,e)}}((function(t,e){It.send(st,[t,e])})),function(t){if(window.history){var e=history.pushState;"function"==typeof e&&(history.pushState=function(n,r,i){var a={source:ct,data:{state:n,title:r,url:i}};t(W,a),e.apply(this,arguments)})}}((function(t,e){It.send(ct,[t,e])})),function(t){if(window.EventTarget){var e=window.EventTarget.prototype,n=e[K],r=e[Q];e[K]=function(t,e,r){var i=this;if(!Ct(i,t,e))return n.apply(i,arguments);var a=o(i,t,e,r),s=Array.prototype.slice.call(arguments);return s[1]=a,n.apply(i,s)},e[Q]=function(t,e,n){var i=this;if(!Ct(i,t,e))return r.apply(i,arguments);var a=s(i,t,e,n),o=Array.prototype.slice.call(arguments);return o[1]=a,r.apply(i,o)}}function i(t,e,n,r){for(var i=0;i<t.length;i++){var a=t[i];if(a.eventType===e&&a.listenerFn===n&&a.capture===r)return i}return-1}function a(t){return"boolean"==typeof t?t:!!t&&!!t.capture}function o(e,n,r,o){var s=kt[n];if(!s)return r;var c=e[s],u=a(o);if(c){var f=i(c,n,r,u);if(-1!==f)return c[f].wrappingFn}else c=e[s]=[];var d={source:ut,target:e,eventType:n,listenerFn:r,capture:u,wrappingFn:p};function p(){var e;t(G,d);try{e=r.apply(this,arguments)}finally{t(W,d)}return e}return c.push(d),p}function s(t,e,n,r){var o=kt[e],s=t[o];if(s){var c=i(s,e,n,a(r));if(-1!==c){var u=s[c];return s.splice(c,1),0===s.length&&(t[o]=void 0),u.wrappingFn}}return n}}((function(t,e){It.send(ut,[t,e])}))),It}var At={bootstrapTime:null,lastHiddenStart:Number.MIN_SAFE_INTEGER},Pt=!1;function Rt(){return x()?(Ft(),function(){"hidden"===document.visibilityState&&(At.lastHiddenStart=0);window.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState&&(At.lastHiddenStart=performance.now())}),{capture:!0})}(),At.bootstrapTime=R(),Pt=!0):y&&console.log("[Elastic APM] platform is not supported!"),Pt}var Mt=n(0),qt=n.n(Mt);function Ht(t){var e=t.error,n=t.filename,r=t.lineno,i=t.colno,a=[];if(e)try{a=qt.a.parse(e)}catch(t){}return 0===a.length&&(a=[{fileName:n,lineNumber:r,columnNumber:i}]),a.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,a=void 0===i?"<anonymous>":i;if(!e&&!n)return{};if(!r&&!n)return{};var o,s,c=function(t){return void 0===t&&(t=""),"<anonymous>"===t&&(t=""),t}(e),u=(o=c,s=window.location.origin||window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:""),o.indexOf(s)>-1&&(o=o.replace(s+"/","")),o);return function(t){return!!t&&0===window.location.href.indexOf(t)}(c)&&(u="(inline script)"),{abs_path:e,filename:u,function:a,lineno:n,colno:r}}))}var zt=[["#","hash"],["?","query"],["/","path"],["@","auth",1],[NaN,"host",void 0,1]],Dt=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,Bt=function(){function t(t){var e,n=this.extractProtocol(t||""),r=n.protocol,i=n.address,a=n.slashes,o=!r&&!a,s=this.getLocation(),c=zt.slice();i=i.replace("\\","/"),a||(c[2]=[NaN,"path"]);for(var u=0;u<c.length;u++){var f=c[u],d=f[0],p=f[1];if("string"==typeof d){if(~(e=i.indexOf(d))){var l=f[2];if(l){var v=i.lastIndexOf(d);e=Math.max(e,v),this[p]=i.slice(0,e),i=i.slice(e+l)}else this[p]=i.slice(e),i=i.slice(0,e)}}else this[p]=i,i="";this[p]=this[p]||o&&f[3]&&s[p]||"",f[3]&&(this[p]=this[p].toLowerCase())}if(o&&"/"!==this.path.charAt(0)&&(this.path="/"+this.path),this.relative=o,this.protocol=r||s.protocol,this.hostname=this.host,this.port="",/:\d+$/.test(this.host)){var h=this.host.split(":"),g=h.pop(),m=h.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 y&&(t=window),t.location},e.extractProtocol=function(t){var e=Dt.exec(t);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!e[2],address:e[3]}},t}();var Ut=91,$t=93,Vt="external",Jt="resource",Xt="hard-navigation";function Zt(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,a=r.duration,o=r.description,s=i;o&&(s+=";desc="+o),a&&(s+=";dur="+a),e.push(s)}return e.join(", ")}(t.serverTiming);return n&&(e.headers={"server-timing":n}),e}function Gt(t,e){var n=t.port,r=t.protocol,i=t.hostname,a=t.host,o=function(t,e){return""===t&&(t="http:"===e?"80":"https:"===e?"443":""),t}(n,r),s=i.charCodeAt(0)===Ut&&i.charCodeAt(i.length-1)===$t,c=i;return s&&(c=i.slice(1,-1)),{service:{name:r+"//"+a,resource:i+":"+o,type:e},address:c,port:Number(o)}}function Wt(){return{page:{referer:document.referrer,url:location.href}}}function Kt(t,e){if(e){var n;switch(t.type){case Vt:n=function(t){var e,n=t.url,r=t.method,i=t.target,a=t.response,o=new Bt(n),s=Gt(o,Vt),c={http:{method:r,url:o.href},destination:s};return i&&void 0!==i.status?e=i.status:a&&(e=a.status),c.http.status_code=e,c}(e);break;case Jt:n=function(t){var e=t.entry,n=t.url,r=Gt(new Bt(n),Jt);return{http:{url:n,response:Zt(e)},destination:r}}(e);break;case Xt:n=function(t){var e=t.url;return{destination:Gt(new Bt(e),Xt)}}(e)}t.addContext(n)}}function Qt(t,e){var n=void 0===e?{}:e,r=(n.tags,function(t,e){if(null==t)return{};var n,r,i={},a=Object.keys(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)>=0||(i[n]=t[n]);return i}(n,["tags"])),i=Wt(),a={};if(t.type===et&&z()){var o=_.getEntriesByType(lt);o&&o.length>0&&(a={response:Zt(o[0])})}t.addContext(i,a,r)}var Yt={service:{name:[Tt,!0],version:!0,agent:{version:[Tt,!0]},environment:!0},labels:{"*":!0}},te={"*":!0,headers:{"*":!0}},ee={user:{id:!0,email:!0,username:!0},tags:{"*":!0},http:{response:te},destination:{address:[Tt],service:{"*":[Tt,!0]}},response:te},ne={name:[Tt,!0],type:[Tt,!0],id:[Tt,!0],trace_id:[Tt,!0],parent_id:[Tt,!0],transaction_id:[Tt,!0],subtype:!0,action:!0,context:ee},re={name:!0,parent_id:!0,type:[Tt,!0],id:[Tt,!0],trace_id:[Tt,!0],span_count:{started:[Tt,!0]},context:ee},ie={id:[Tt,!0],trace_id:!0,transaction_id:!0,parent_id:!0,culprit:!0,exception:{type:!0},transaction:{type:!0},context:ee};function ae(t){return null==t||""===t||void 0===t}function oe(t,e,n){var r=function(t,e,n,r){return void 0===e&&(e=Tt),void 0===n&&(n=!1),void 0===r&&(r="N/A"),n&&ae(t)&&(t=r),"string"==typeof t?t.substring(0,e):t}(t[e],n[0],n[1]);ae(r)?delete t[e]:t[e]=r}function se(t,e,n){void 0===t&&(t={}),void 0===n&&(n=e);for(var r=Object.keys(t),i=[],a=function(a){var o=r[a],s=!0===t[o]?i:t[o];Array.isArray(s)?"*"===o?Object.keys(n).forEach((function(t){return oe(n,t,s)})):oe(n,o,s):se(s,e,n[o])},o=0;o<r.length;o++)a(o);return e}var ce=["stack","message"];var ue=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}))}(Ht(t)),n="(inline script)",r=e[e.length-1];r&&r.filename&&(n=r.filename);var i=t.message,a=t.error,o=i,s="",c={};if(a&&"object"==typeof a){o=o||a.message,s=a.name;var u=function(t){var e=!1,n={};if(Object.keys(t).forEach((function(r){if(!(ce.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}(a);u&&(c.custom=u)}s||o&&o.indexOf(":")>-1&&(s=o.split(":")[0]);var f=this._transactionService.getCurrentTransaction(),d=f?f.context:{},p=this._configService.get("context"),l=(p.tags,function(t,e){if(null==t)return{};var n,r,i={},a=Object.keys(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)>=0||(i[n]=t[n]);return i}(p,["tags"])),v=j({},Wt(),d,l,c),h={id:T(),culprit:n,exception:{message:o,stacktrace:e,type:s},context:v};return f&&(h=I(h,{trace_id:f.traceId,parent_id:f.id,transaction_id:f.id,transaction:{type:f.type,sampled:f.sampled}})),se(ie,h)},e.logErrorEvent=function(t){if(void 0!==t){var e=this.createErrorDataModel(t);void 0!==e.exception.message&&this._apmServer.addError(e)}},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,n="Unhandled promise rejection: ",r=t.reason,i=void 0===r?"<no reason specified>":r;"string"==typeof i.message?e={error:i,message:n+(i.name?i.name+": ":"")+i.message}:e={message:n+(i="object"==typeof i?"<object>":"function"==typeof i?"<function>":i)};this.logErrorEvent(e)},e.logError=function(t){var e={};return"string"==typeof t?e.message=t:e.error=t,this.logErrorEvent(e)},t}(),fe=function(){function t(t,e){void 0===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(){return t.flush()}),this.flushInterval)},e._clear=function(){void 0!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=void 0),this.items=[]},e.flush=function(){this.onFlush(this.items),this._clear()},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(){function t(){}return t.stringify=function(t){return JSON.stringify(t)+"\n"},t}(),pe=function(){function t(t,e,n){void 0===n&&(n={}),t||(t=rt),e||(e=nt),this.name=t,this.type=e,this.options=n,this.id=n.id||T(16),this.traceId=n.traceId,this.sampled=n.sampled,this.timestamp=n.timestamp,this._start=M(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.addLabels=function(t){this.ensureContext();var e=this.context;e.tags||(e.tags={}),Object.keys(t).forEach((function(n){return k(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=M(t),this.callOnEnd())},e.callOnEnd=function(){"function"==typeof this.onEnd&&this.onEnd(this)},e.duration=function(){return q(this._start,this._end)},t}();var le=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 a=i.type.split(".",3);i.type=a[0],i.subtype=a[1],i.action=a[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),Kt(this,n)},r}(pe),ve=[["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 he(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<tt&&t-i<tt&&e-i<tt}function ge(t){var e=t.name,n=t.initiatorType,r=t.startTime,i=t.responseEnd,a="resource";n&&(a+="."+n);var o=L(e),s=new le(o,a);return s._start=r,s.end(i,{url:e,entry:t}),s}function me(t,e){return null!=e&&t>e}var ye=["fetchStart","domainLookupStart","domainLookupEnd","connectStart","connectEnd","requestStart","responseStart","responseEnd","domLoading","domInteractive","domContentLoadedEventStart","domContentLoadedEventEnd","domComplete","loadEventStart","loadEventEnd"],_e=["fs","ls","le","cs","ce","qs","rs","re","dl","di","ds","de","dc","es","ee"];function be(t){var e=function(t){var e=t.fetchStart,n=t.navigationStart;if(n&&e<n)return null;var r={};return ye.forEach((function(n){var i=t[n];i&&i>=e&&(r[n]=parseInt(i-e))})),r}(t);return null==e?null:{navigationTiming:e,agent:{timeToFirstByte:e.responseStart,domInteractive:e.domInteractive,domComplete:e.domComplete}}}function Se(t){if(t.captureTimings){var e=t._end;if(t.type===et){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=[],a=0;a<ve.length;a++){var o=t[ve[a][0]],s=t[ve[a][1]];if(he(o,s,n,r,e)){var c=new le(ve[a][2],"hard-navigation.browser-timing"),u=null;"requestStart"===ve[a][0]&&(c.pageResponse=!0,u={url:location.origin}),c._start=o-e,c.end(s-e,u),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(be(r))}if(z()){var i=t._start;(function(t,e,n,r){for(var i=[],a=0;a<t.length;a++){var o=t[a],s=o.initiatorType,c=o.name,u=o.startTime,f=o.responseEnd;-1!==Y.indexOf(s)&&null!=c&&(("xmlhttprequest"===s||"fetch"===s)&&(/intake\/v\d+\/rum\/events/.test(c)||me(u,e))||he(u,f,n,r)&&i.push(ge(t[a])))}return i})(_.getEntriesByType(vt),At.bootstrapTime,i,e).forEach((function(e){return t.spans.push(e)})),function(t,e,n){for(var r=[],i=0;i<t.length;i++){var a=t[i],o=a.name,s=a.startTime,c=a.duration,u=s+c;if(!(c<=at)&&he(s,u,e,n)){var f=new le(o,"app");f._start=s,f.end(u),r.push(f)}}return r}(_.getEntriesByType(pt),i,e).forEach((function(e){return t.spans.push(e)}))}}}function we(t){return{ts:t.transfer_size,ebs:t.encoded_body_size,dbs:t.decoded_body_size}}function Te(t){if(!t)return null;var e={},n=t.page,r=t.http,i=t.response,a=t.destination,o=t.user,s=t.custom;if(n&&(e.p={rf:n.referer,url:n.url}),r&&(e.h=function(t){var e={},n=t.method,r=t.status_code,i=t.url,a=t.response;return e.url=i,n&&(e.mt=n),r&&(e.sc=r),a&&(e.r=we(a)),e}(r)),i&&(e.r=we(i)),a){var c=a.service;e.dt={se:{n:c.name,t:c.type,rc:c.resource},ad:a.address,po:a.port}}return o&&(e.u={id:o.id,un:o.username,em:o.email}),s&&(e.cu=s),e}function Ee(t){if(!t)return null;var e=t.navigationTiming,n=t.agent,r={nt:{}};_e.forEach((function(t,n){var i=ye[n];r.nt[t]=e[i]})),r.a={fb:r.nt.rs,di:r.nt.di,dc:r.nt.dc};var i=n.firstContentfulPaint,a=n.largestContentfulPaint;return i&&(r.a.fp=i),a&&(r.a.lp=a),r}var xe=function(){function t(t,e){this._configService=t,this._loggingService=e,this.queue=void 0,this.throttleEvents=A}var e=t.prototype;return e.init=function(){var t=this,e=this._configService.get("queueLimit"),n=this._configService.get("flushInterval"),r=this._configService.get("eventsLimit");this.queue=new fe((function(e){var n=t.sendEvents(e);n&&n.catch((function(e){t._loggingService.warn("Failed sending events!",t._constructError(e))}))}),{queueLimit:e,flushInterval:n}),this.throttleEvents=function(t,e,n){var r,i=this,a=n.limit,o=n.interval,s=0;return function(){return s++,void 0===r&&(r=setTimeout((function(){s=0,r=void 0}),o)),s>a&&"function"==typeof e?e.apply(i,arguments):t.apply(i,arguments)}}(this.queue.add.bind(this.queue),(function(){return t._loggingService.warn("Dropped events due to throttling!")}),{limit:r,interval:6e4})},e._postJson=function(t,e){var n=this,r={"Content-Type":"application/x-ndjson"};return function(t,e,n){void 0===n&&(n="gzip");var r="function"==typeof CompressionStream;return new g((function(i){if(!r)return i({payload:t,headers:e});var a=new Blob([t]).stream().pipeThrough(new CompressionStream(n));return new Response(a).blob().then((function(t){return e["Content-Encoding"]=n,i({payload:t,headers:e})}))}))}(e,r).catch((function(t){return{payload:e,headers:r}})).then((function(e){return n._makeHttpRequest("POST",t,e)})).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,o=r.headers;return new g((function(n,r){var s=new window.XMLHttpRequest;if(s[V]=!0,s.open(t,e,!0),s.timeout=i,o)for(var c in o)o.hasOwnProperty(c)&&s.setRequestHeader(c,o[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(a)}))},e.fetchConfig=function(t,e){var n=this,r=this._configService.get("serverUrl")+"/config/v1/rum/agents";if(!t)return g.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 a=JSON.parse(r),o=t.getResponseHeader("etag");return o&&(a.etag=o.replace(/["]/g,""),n._configService.setLocalConfig(a)),a})).catch((function(t){var e=n._constructError(t);return g.reject(e)}))},e.createMetaData=function(){var t=this._configService,e={service:{name:t.get("serviceName"),version:t.get("serviceVersion"),agent:{name:"rum-js",version:t.version},language:{name:"javascript"},environment:t.get("environment")},labels:t.get("context.tags")};return se(Yt,e)},e.addError=function(t){var e;this.throttleEvents(((e={}).errors=t,e))},e.addTransaction=function(t){var e;this.throttleEvents(((e={}).transactions=t,e))},e.ndjsonErrors=function(t,e){var n=e?"e":"error";return t.map((function(t){var r;return de.stringify(((r={})[n]=e?function(t){var e,n=t.exception,r={id:t.id,cl:t.culprit,ex:{mg:n.message,st:(e=n.stacktrace,e.map((function(t){return{ap:t.abs_path,f:t.filename,fn:t.function,li:t.lineno,co:t.colno}}))),t:t.type},c:Te(t.context)},i=t.transaction;return i&&(r.tid=t.trace_id,r.pid=t.parent_id,r.xid=t.transaction_id,r.x={t:i.type,sm:i.sampled}),r}(t):t,r))}))},e.ndjsonMetricsets=function(t){return t.map((function(t){return de.stringify({metricset:t})})).join("")},e.ndjsonTransactions=function(t,e){var n=this,r=e?"x":"transaction";return t.map((function(t){var i,a="",o="";return e||(t.spans&&(a=t.spans.map((function(t){return de.stringify({span:t})})).join(""),delete t.spans),t.breakdown&&(o=n.ndjsonMetricsets(t.breakdown),delete t.breakdown)),de.stringify(((i={})[r]=e?function(t){var e,n=t.spans.map((function(e){var n={id:e.id,n:e.name,t:e.type,s:e.start,d:e.duration,c:Te(e.context)};return e.parent_id!==t.id&&(n.pid=e.parent_id),!0===e.sync&&(n.sy=!0),e.subtype&&(n.su=e.subtype),e.action&&(n.ac=e.action),n}));return{id:t.id,tid:t.trace_id,n:t.name,t:t.type,d:t.duration,c:Te(t.context),m:Ee(t.marks),me:(e=t.breakdown,e.map((function(t){var e=t.span,n=t.samples,r=null!=e;return r?{y:{t:e.type},sa:{ysc:{v:n["span.self_time.count"].value},yss:{v:n["span.self_time.sum.us"].value}}}:{sa:{xdc:{v:n["transaction.duration.count"].value},xds:{v:n["transaction.duration.sum.us"].value},xbc:{v:n["transaction.breakdown.count"].value}}}}))),y:n,yc:{sd:n.length},sm:t.sampled,exp:t.experience}}(t):t,i))+a+o}))},e.sendEvents=function(t){var e,n;if(0!==t.length){for(var r=[],i=[],a=0;a<t.length;a++){var o=t[a];o.transactions&&r.push(o.transactions),o.errors&&i.push(o.errors)}if(0!==r.length||0!==i.length){var s=this._configService,c=((e={}).transactions=r,e.errors=i,e),u=s.applyFilters(c);if(u){var f=s.get("apiVersion"),d=f>2,p=[],l=this.createMetaData(),v=d?"m":"metadata";p.push(de.stringify(((n={})[v]=d?function(t){var e=t.service,n=t.labels,r=e.agent,i=e.language;return{se:{n:e.name,ve:e.version,a:{n:r.name,ve:r.version},la:{n:i.name},en:e.environment},l:n}}(l):l,n)));var h=(p=p.concat(this.ndjsonErrors(u.errors,d),this.ndjsonTransactions(u.transactions,d))).join(""),g=s.get("serverUrl")+"/intake/v"+f+"/rum/events";return this._postJson(g,h)}this._loggingService.warn("Dropped payload due to filtering!")}}},t}();var ke,Le=function(){function t(){this.config={serviceName:"",serviceVersion:"",environment:"",serverUrl:"http://localhost:8200",active:!0,instrument:!0,disableInstrumentations:[],logLevel:"warn",breakdownMetrics:!1,ignoreTransactions:[],eventsLimit:80,queueLimit:-1,flushInterval:500,distributedTracing:!0,distributedTracingOrigins:[],distributedTracingHeaderName:"traceparent",pageLoadTraceId:"",pageLoadSpanId:"",pageLoadSampled:!1,pageLoadTransactionName:"",transactionSampleRate:1,centralConfig:!1,monitorLongtasks:!0,apiVersion:2,context:{}},this.events=new Nt,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 a=r[i];if(n.test(a.nodeName)){var o=a.nodeName.match(n)[1].split("-").map((function(t,e){return e>0?t.charAt(0).toUpperCase()+t.substring(1):t})).join("");e[o]=a.value||a.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,a=n.email;"number"!=typeof r&&"string"!=typeof r||(e.id=r),"string"==typeof i&&(e.username=i),"string"==typeof a&&(e.email=a),this.config.context.user=I(this.config.context.user||{},e)},e.setCustomContext=function(t){void 0===t&&(t={}),this.config.context.custom=I(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 k(n,t[n],e.config.context.tags)}))},e.setConfig=function(t){void 0===t&&(t={}),t.serverUrl&&(t.serverUrl=t.serverUrl.replace(/\/+$/,"")),j(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}(),Oe=function(){function t(t){void 0===t&&(t={}),this.levels=["trace","debug","info","warn","error"],this.level=t.level||"warn",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){t!==this.level&&(this.level=t,this.resetLogMethods())},e.resetLogMethods=function(){var t=this;this.levels.forEach((function(e){t[e]=t.shouldLog(e)?function(){var t=e;"trace"!==e&&"debug"!==e||(t="info");var n=arguments;if(n[0]=this.prefix+n[0],console){var r=console[t]||console.log;"function"==typeof r&&r.apply(console,n)}}:A}))},t}(),Ce=((ke={})[_t]=function(){return new Le},ke[bt]=function(){return new Oe({prefix:"[Elastic APM] "})},ke[St]=function(t){var e=t.getService([_t,bt]),n=e[0],r=e[1];return new xe(n,r)},ke),Ne=function(){function t(){this.instances={},this.initialized=!1}var e=t.prototype;return e.init=function(){if(!this.initialized){this.initialized=!0;var t=this.getService(_t);t.init();var e=this.getService([bt,St]),n=e[0],r=e[1];t.events.observe("config:change",(function(){var e=t.get("logLevel");n.setLevel(e)})),r.init()}},e.getService=function(t){var e=this;return"string"==typeof t?(this.instances[t]||"function"==typeof Ce[t]&&(this.instances[t]=Ce[t](this)),this.instances[t]):Array.isArray(t)?t.map((function(t){return e.getService(t)})):void 0},t}();var Ie=.05;var je=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[ct]&&It.observe(ct,this.getHistorySub()),t[ot]&&It.observe(ot,this.getXHRSub()),t[st]&&It.observe(st,this.getFetchSub()),t[ut]&&It.observe(ut,this.getEventTargetSub())},e.getEventTargetSub=function(){var t=this._transactionService;return function(e,n){if(e===G&&n.source===ut&&"click"===n.eventType){var r=n.target,i=r.getAttribute("name"),a="";i&&(a='["'+i+'"]');var o=r.tagName.toLowerCase(),s=t.startTransaction("Click - "+o+a,"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===ct&&e===W&&t.startTransaction(n.data.title,"route-change",{managed:!0,canReuse:!0})}},e.getXHRSub=function(){var t=this;return function(e,n){n.source!==ot||B.fetchInProgress||t.processAPICalls(e,n)}},e.getFetchSub=function(){var t=this;return function(e,n){n.source===st&&t.processAPICalls(e,n)}},e.processAPICalls=function(t,e){var n=this._configService,r=this._transactionService;if(t===G&&e.data){var i=e.data,a=new Bt(i.url),o=i.method+" "+(a.relative?a.path:L(a.href));r.getCurrentTransaction()||r.startTransaction(o,"http-request",{managed:!0});var s=r.startSpan(o,"external.http",{blocking:!0});if(!s)return;var c=n.get("distributedTracing"),u=n.get("distributedTracingOrigins"),f=new Bt(window.location.href),d=E(a.origin,f.origin)||E(a.origin,u),p=i.target;c&&d&&p&&this.injectDtHeader(s,p),i.sync&&(s.sync=i.sync),i.span=s}else if(t===W){var l=e.data;l&&l.span&&r.endSpan(l.span,l)}},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),a=/^[\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&&a&&("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}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:parseInt(n._start-e),duration:n.duration(),context:n.context};return se(ne,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,experience:t.experience};return se(re,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(a,o){if(0===r.length)r.push(a);else{var s=r[r.length-1],c=s.type===a.type&&s.subtype===a.subtype&&s.action===a.action&&s.name===a.name&&a.duration()/e<n&&(a._start-s._end)/e<n,u=t.length===o+1;c&&(i++,s._end=a._end),i>1&&(!c||u)&&(s.name=i+"x "+s.name,i=1),c||r.push(a)}})),r}(e,t.duration(),Ie);t.spans=n}else t.spans=e}else t.resetSpans();return t}(t);if(this.filterTransaction(e))return this.createTransactionDataModel(t)},t}(),Fe=[["domainLookupStart","domainLookupEnd","DNS"],["connectStart","connectEnd","TCP"],["requestStart","responseStart","Request"],["responseStart","responseEnd","Response"],["domLoading","domComplete","Processing"],["loadEventStart","loadEventEnd","Load"]];function Ae(t){return{value:t}}function Pe(t,e){var n=e.details,r=e.count,i=void 0===r?1:r,a=e.duration;return{transaction:t,span:n,samples:{"span.self_time.count":Ae(i),"span.self_time.sum.us":Ae(a)}}}function Re(t,e){void 0===e&&(e=_.timing);var n=[],r=t.duration(),i=t.name,a=t.type,o=t.sampled,s={name:i,type:a};if(n.push({transaction:s,samples:{"transaction.duration.count":Ae(1),"transaction.duration.sum.us":Ae(r),"transaction.breakdown.count":Ae(o?1:0)}}),!o)return n;if(a===et&&e)for(var c=0;c<Fe.length;c++){var u=Fe[c],f=q(e[u[0]],e[u[1]]);0!==f&&null!=f&&n.push(Pe(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],a=i._end,o=i._start,s=a,c=o-n,u=1;u<e.length;u++)o=(i=e[u])._start,a=i._end,o>s?(c+=o-s,s=a):a>s&&(s=a);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 a=r[i],o=a.duration();if(0!==o&&null!=o){var s=a.type,c=a.subtype,u=s.replace(wt,"");c&&(u+="."+c),e[u]||(e[u]={duration:0,count:0}),e[u].count++,e[u].duration+=o}}return e}(t);Object.keys(d).forEach((function(t){var e=t.split("."),r=e[0],i=e[1],a=d[t],o=a.duration,c=a.count;n.push(Pe(s,{details:{type:r,subtype:i},duration:o,count:c}))}))}return n}var Me=function(t){var e,n;function r(e,n,r){var i;return(i=t.call(this,e,n,r)||this).traceId=T(),i.marks=void 0,i.spans=[],i._activeSpans={},i._activeTasks=new Set,i.blocked=!1,i.captureTimings=!1,i.breakdownTimings=[],i.sampled=Math.random()<=i.options.transactionSampleRate,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=P(t),n=R()-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&&R()-this._start<t},i.redefine=function(t,e,n){t&&(this.name=t),e&&(this.type=e),n&&I(this.options,n)},i.startSpan=function(t,e,n){var r=this;if(!this.ended){var i=I({},n);i.onEnd=function(t){r._onSpanEnd(t)},i.traceId=this.traceId,i.sampled=this.sampled,i.parentId||(i.parentId=this.id);var a=new le(t,e,i);return this._activeSpans[a.id]=a,i.blocking&&this.addTask(a.id),a}},i.isFinished=function(){return!this.blocked&&0===this._activeTasks.size},i.detectFinish=function(){this.isFinished()&&this.end()},i.end=function(t){if(!this.ended){for(var e in this.ended=!0,this._end=M(t),this._activeSpans){var n=this._activeSpans[e];n.type=n.type+wt,n.end(t)}this.callOnEnd()}},i.captureBreakdown=function(){this.breakdownTimings=Re(this)},i.block=function(t){this.blocked=t,this.blocked||this.detectFinish()},i.addTask=function(t){return t||(t="task-"+T(16)),this._activeTasks.add(t),t},i.removeTask=function(t){this._activeTasks.delete(t)&&this.detectFinish()},i.resetSpans=function(){this.spans=[]},i._onSpanEnd=function(t){this.spans.push(t),delete this._activeSpans[t.id],this.removeTask(t.id)},i.isManaged=function(){return!!this.options.managed},r}(pe),qe={fid:0,fcp:0,tbt:{start:1/0,duration:0},cls:0},He=50;function ze(t,e){var n=e.capturePaint,r=t.getEntriesByType(dt),i={spans:function(t){for(var e=[],n=0;n<t.length;n++){var r=t[n],i=r.name,a=r.startTime,o=r.duration,s=r.attribution,c=a+o,u=new le("Longtask("+i+")",dt,{startTime:a});if(s.length>0){var f=s[0],d=f.name,p=f.containerType,l=f.containerName,v=f.containerId,h={attribution:d,type:p};l&&(h.name=l),v&&(h.id=v),u.addContext({custom:h})}u.end(c),e.push(u)}return e}(r),marks:{}};if(!n)return i;var a=t.getEntriesByType(gt),o=a[a.length-1];if(o){var s=parseInt(o.startTime);qe.lcp=s,i.marks.largestContentfulPaint=s}var c=_.timing,u=c.fetchStart-c.navigationStart,f=t.getEntriesByName(ht)[0];if(f){var d=parseInt(u>=0?f.startTime-u:f.startTime);qe.fcp=d,i.marks.firstContentfulPaint=d}var p=function(t){var e=t[0];if(e){var n=e.startTime,r=e.processingStart,i=new le("First Input Delay",mt,{startTime:n});return i.end(r),i}}(t.getEntriesByType(mt));return p&&(qe.fid=p._start,i.spans.push(p)),function(t){t.forEach((function(t){var e=t.name,n=t.startTime,r=t.duration;if(!(n<qe.fcp||"self"!==e&&-1===e.indexOf("same-origin"))){qe.tbt.start=Math.min(qe.tbt.start,n);var i=r-He;i>0&&(qe.tbt.duration+=i)}}))}(r),function(t){t.forEach((function(t){t.hadRecentInput||(qe.cls+=t.value)}))}(t.getEntriesByType(yt)),i}var De=function(){function t(t){this.po={observe:A,disconnect:A},window.PerformanceObserver&&(this.po=new PerformanceObserver(t))}var e=t.prototype;return e.start=function(t){try{var e=!0;t===dt&&(e=!1),this.po.observe({type:t,buffered:e})}catch(t){}},e.stop=function(){this.po.disconnect()},t}(),Be=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 De((function(t){var e=n.getCurrentTransaction();if(e&&e.captureTimings){var r,i=!1;e.type===et&&(i=!0);var a=ze(t,{capturePaint:i}),o=a.spans,s=a.marks;(r=e.spans).push.apply(r,o),e.addMarks({agent:s})}}))}var e=t.prototype;return e.ensureCurrentTransaction=function(t,e,n){var r=this.getCurrentTransaction();return r||(r=new Me(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.createOptions=function(t){var e=this._config.config,n=I({transactionSampleRate:e.transactionSampleRate},t);return n.managed&&(n=I({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 a=r.type,o=it.indexOf(r.type),s=it.indexOf(e);o>=0&&s<o&&(a=e),r.redefine(t,a,n),i=!0}else r.end(),r=this.ensureCurrentTransaction(t,e,n);else r=this.ensureCurrentTransaction(t,e,n);return r.type===et&&(i||(this.recorder.start(gt),this.recorder.start("paint"),this.recorder.start(mt),this.recorder.start(yt)),n.pageLoadTraceId&&(r.traceId=n.pageLoadTraceId),n.pageLoadSampled&&(r.sampled=n.pageLoadSampled),r.name===rt&&n.pageLoadTransactionName&&(r.name=n.pageLoadTransactionName)),!i&&this._config.get("monitorLongtasks")&&this.recorder.start(dt),r.sampled&&(r.captureTimings=!0),r},e.startTransaction=function(t,e,n){var r,i=this,a=this.createOptions(n),o=!0;a.managed?this.currentTransaction===(r=this.startManagedTransaction(t,e,a))&&(o=!1):r=new Me(t,e,a);return r.onEnd=function(){return i.handleTransactionEnd(r)},o&&this._config.events.send("transaction:start",[r]),r},e.handleTransactionEnd=function(t){var e=this;this.recorder.stop();var n=window.location.href;return g.resolve().then((function(){var r=t.name,i=t.type;if(!(At.lastHiddenStart>=t._start||e.shouldIgnoreTransaction(r)||"temporary"===i)){if(i===et){var a=e._config.get("pageLoadTransactionName");if(r===rt&&a&&(t.name=a),t.captureTimings){var o=qe.cls,s=qe.fid,c=qe.tbt;c.duration>0&&t.spans.push((f=(u=c).start,d=u.duration,(p=new le("Total Blocking Time",dt,{startTime:f})).end(f+d),p)),t.experience={},D(dt)&&(t.experience.tbt=c.duration),D(yt)&&(t.experience.cls=o),s>0&&(t.experience.fid=s)}}var u,f,d,p;t.name===rt&&(t.name=function(t,e){void 0===e&&(e=2);for(var n=new Bt(t),r=n.query,i=n.path.substring(1).split("/"),a=/\W|_/g,o=/[0-9]/g,s=/[a-z]/g,c=/[A-Z]/g,u=[],f=!1,d=0;d<i.length;d++){var p=i[d];if(f||d>e-1){p&&u.push("*");break}if((p.match(a)||[]).length>=2)u.push(":id"),f=!0;else{var l=(p.match(o)||[]).length;if(l>3||p.length>3&&l/p.length>=.3)u.push(":id"),f=!0;else{var v=(p.match(c)||[]).length,h=(p.match(s)||[]).length/p.length,g=v/p.length;p.length>5&&(g>.3&&g<.6||h>.3&&h<.6)?(u.push(":id"),f=!0):p&&u.push(p)}}}return"/"+(u.length>=2?u.join("/"):u.join(""))+(r?"?{query}":"")}(n)),Se(t),e.adjustTransactionTime(t),e._config.get("breakdownMetrics")&&t.captureBreakdown();var l=e._config.get("context");Qt(t,l),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,a=0;a<e.length;a++){var o=e[a];o._end>i&&(o._end=i,o.type+=wt),o._start>i&&(o._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){var i=r.startSpan(t,e,n);return i}},e.endSpan=function(t,e){t&&t.end(null,e)},t}();function Ue(){return Ce.TransactionService=function(t){var e=t.getService([bt,_t]),n=e[0],r=e[1];return new Be(n,r)},Ce.PerformanceMonitoring=function(t){var e=t.getService([St,_t,bt,"TransactionService"]),n=e[0],r=e[1],i=e[2],a=e[3];return new je(n,r,i,a)},Ce.ErrorLogging=function(t){var e=t.getService([St,_t,"TransactionService"]),n=e[0],r=e[1],i=e[2];return new ue(n,r,i)},new Ne}var $e=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([_t,bt]),r=n[0],i=n[1];r.setVersion("5.5.0"),this.config(t);var a=r.get("logLevel");if(i.setLevel(a),r.isActive()){this.serviceFactory.init();var o=function(t,e){var n,r=((n={})[ot]=!1,n[st]=!1,n[ct]=!1,n[et]=!1,n[ft]=!1,n[ut]=!1,n);return t?(Object.keys(r).forEach((function(t){-1===e.indexOf(t)&&(r[t]=!0)})),r):r}(r.get("instrument"),r.get("disableInstrumentations"));if(this.serviceFactory.getService("PerformanceMonitoring").init(o),o[ft])this.serviceFactory.getService("ErrorLogging").registerListeners();var s=function(){return o[et]&&e._sendPageLoadMetrics()};r.get("centralConfig")?this.fetchCentralConfig().then(s):s()}else this._disable=!0,i.warn("RUM agent is inactive")}return this},e.fetchCentralConfig=function(){var t=this.serviceFactory.getService([St,bt,_t]),e=t[0],n=t[1],r=t[2];return e.fetchConfig(r.get("serviceName"),r.get("environment")).then((function(t){var e=t.transaction_sample_rate;if(e){var i={transactionSampleRate:e=Number(e)},a=r.validate(i).invalid;if(0===a.length)r.setConfig(i);else{var o=a[0],s=o.key,c=o.value,u=o.allowed;n.warn('invalid value "'+c+'" for '+s+". Allowed: "+u+".")}}return t})).catch((function(t){n.warn("failed fetching config:",t)}))},e._sendPageLoadMetrics=function(){var t=this.startTransaction(void 0,et,{managed:!0,canReuse:!0});if(t){t.addTask(et);var e=function(){setTimeout((function(){return t.removeTask(et)}))};"complete"===document.readyState?e():window.addEventListener("load",e)}},e.isEnabled=function(){return!this._disable},e.observe=function(t,e){this.serviceFactory.getService(_t).events.observe(t,e)},e.config=function(t){var e=this.serviceFactory.getService(_t),n=e.validate(t),r=n.missing,i=n.invalid;if(0===r.length&&0===i.length)e.setConfig(t);else{var a=this.serviceFactory.getService(bt),o="RUM agent isn't correctly configured. ";r.length>0&&(o+=r.join(", ")+" is missing",i.length>0&&(o+=", ")),i.forEach((function(t,e){var n=t.key,r=t.value,a=t.allowed;o+=n+' "'+r+'" contains invalid characters! (allowed: '+a+")"+(e!==i.length-1?", ":"")})),a.error(o),e.setConfig({active:!1})}},e.setUserContext=function(t){this.serviceFactory.getService(_t).setUserContext(t)},e.setCustomContext=function(t){this.serviceFactory.getService(_t).setCustomContext(t)},e.addLabels=function(t){this.serviceFactory.getService(_t).addLabels(t)},e.setInitialPageLoadName=function(t){this.isEnabled()&&this.serviceFactory.getService(_t).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,n){if(this.isEnabled())return this.serviceFactory.getService("TransactionService").startSpan(t,e,n)},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(_t).addFilter(t)},t}();var Ve=function(){if(y&&window.elasticApm)return window.elasticApm;var t=Rt(),e=Ue(),n=new $e(e,!t);return y&&(window.elasticApm=n),n}(),Je=Ve.init.bind(Ve);e.default=Je}]); | ||
!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,n){var r,i,a;!function(o,s){"use strict";i=[n(3)],void 0===(a="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 a(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(a(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,a=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,a,r[1],r[2],e)}),this)},parseFFOrSafari:function(e){return i(a(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=[],a=2,o=r.length;a<o;a+=2){var s=n.exec(r[a]);s&&i.push(new t(void 0,void 0,s[2],s[1],void 0,r[a]))}return i},parseOpera10:function(e){for(var n=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=e.stacktrace.split("\n"),i=[],a=0,o=r.length;a<o;a+=2){var s=n.exec(r[a]);s&&i.push(new t(s[3]||void 0,void 0,s[2],s[1],void 0,r[a]))}return i},parseOpera11:function(n){return i(a(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()),a=r.shift()||"",o=a.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^\)]*\)/g,"")||void 0;a.match(/\(([^\)]*)\)/)&&(n=a.replace(/^[^\(]+\(([^\)]*)\)$/,"$1"));var s=void 0===n||"[arguments not available]"===n?void 0:n.split(",");return new t(o,s,i[0],i[1],i[2],e)}),this)}}})?r.apply(e,i):r)||(t.exports=a)}()},,,function(t,e,n){var r,i,a;!function(n,o){"use strict";i=[],void 0===(a="function"==typeof(r=function(){function t(t){return!isNaN(parseFloat(t))&&isFinite(t)}function e(t,e,n,r,i,a){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!==a&&this.setSource(a)}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=a)}()},function(t,e,n){"use strict";n.r(e),n.d(e,"init",(function(){return le})),n.d(e,"apmBase",(function(){return pe})),n.d(e,"ApmBase",(function(){return de})),n.d(e,"apm",(function(){return pe}));var r=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)}))}))},i=setTimeout;function a(t){return Boolean(t&&void 0!==t.length)}function o(){}function s(t){if(!(this instanceof s))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 c(t,e){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,s._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 f(e.promise,t)}u(e.promise,r)}else(1===t._state?u:f)(e.promise,t._value)}))):t._deferreds.push(e)}function u(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 s)return t._state=3,t._value=e,void d(t);if("function"==typeof n)return void l((r=n,i=e,function(){r.apply(i,arguments)}),t)}t._state=1,t._value=e,d(t)}catch(e){f(t,e)}var r,i}function f(t,e){t._state=2,t._value=e,d(t)}function d(t){2===t._state&&0===t._deferreds.length&&s._immediateFn((function(){t._handled||s._unhandledRejectionFn(t._value)}));for(var e=0,n=t._deferreds.length;e<n;e++)c(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,u(e,t))}),(function(t){n||(n=!0,f(e,t))}))}catch(t){if(n)return;n=!0,f(e,t)}}s.prototype.catch=function(t){return this.then(null,t)},s.prototype.then=function(t,e){var n=new this.constructor(o);return c(this,new p(t,e,n)),n},s.prototype.finally=r,s.all=function(t){return new s((function(e,n){if(!a(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 s=0;s<r.length;s++)o(s,r[s])}))},s.resolve=function(t){return t&&"object"==typeof t&&t.constructor===s?t:new s((function(e){e(t)}))},s.reject=function(t){return new s((function(e,n){n(t)}))},s.race=function(t){return new s((function(e,n){if(!a(t))return n(new TypeError("Promise.race accepts an array"));for(var r=0,i=t.length;r<i;r++)s.resolve(t[r]).then(e,n)}))},s._immediateFn="function"==typeof setImmediate&&function(t){setImmediate(t)}||function(t){i(t,0)},s._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};var v=s,h={};y?h=window:"undefined"!=typeof self&&(h=self);var g="Promise"in h?h.Promise:v,m=[].slice,y="undefined"!=typeof window,_=y&&"undefined"!=typeof performance?performance:{};for(var b=[],S=0;S<256;++S)b[S]=(S+256).toString(16).substr(1);var w=new Uint8Array(16);function T(t){return function(t){for(var e=[],n=0;n<t.length;n++)e.push(b[t[n]]);return e.join("")}("undefined"!=typeof crypto&&"function"==typeof crypto.getRandomValues?crypto.getRandomValues(w):"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues?msCrypto.getRandomValues(w):w).substr(0,t)}function E(t,e){var n=!1;return"string"==typeof e?n=t===e:Array.isArray(e)&&e.forEach((function(e){n||(n=E(t,e))})),n}function x(){return y&&"function"==typeof Set&&"function"==typeof JSON.stringify&&_&&"function"==typeof _.now&&"withCredentials"in new window.XMLHttpRequest}function k(t,e,n){if(n&&t){var r=P(t),i=typeof e;return null!=e&&"boolean"!==i&&"number"!==i&&(e=String(e)),n[r]=e,n}}function L(t){return t&&t.split("?")[0]}function C(t){return null!==t&&"object"==typeof t}function O(t,e,n){for(var r=0,i=e.length;r<i;++r){var a=e[r];if(C(a)||"function"==typeof a)for(var o=Object.keys(a),s=0,c=o.length;s<c;s++){var u=o[s],f=a[u];n&&C(f)?(C(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 I(t){return O(t,m.call(arguments,1),!1)}function j(t){return O(t,m.call(arguments,1),!0)}function F(t){return void 0===t}function A(){}function P(t){return t.replace(/[.*"]/g,"_")}function R(){return _.now()}function q(t){return"number"==typeof t&&t>=0?t:R()}function M(t,e){return F(e)||F(t)?null:parseInt(e-t)}function H(t){g.resolve().then(t)}function z(){return"function"==typeof _.getEntriesByType}function D(t){return"undefined"!=typeof PerformanceObserver&&PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.indexOf(t)>=0}var U={fetchInProgress:!1};function B(t){return"__apm_symbol__"+t}function $(t,e,n){for(var r=t;r&&!r.hasOwnProperty(e);)r=Object.getPrototypeOf(r);!r&&t[e]&&(r=t);var i,a,o,s,c=B(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)},a=r[e],o=i,a[B("OriginalDelegate")]=o}}return i}var V=B("xhrIgnore"),J=B("xhrSync"),X=B("xhrURL"),Z=B("xhrMethod"),G="invoke",W=["link","css","script","img","xmlhttprequest","fetch","beacon","iframe"],K="page-load",Q=[K,"route-change","user-interaction","http-request","custom","temporary"];function Y(t){var e=XMLHttpRequest.prototype;if(e&&e.addEventListener)var n=$(e,"open",(function(){return function(t,e){return t[V]||(t[Z]=e[0],t[X]=e[1],t[J]=!1===e[2]),n.apply(t,e)}})),r=$(e,"send",(function(){return function(e,n){if(e[V])return r.apply(e,n);var a={source:"xmlhttprequest",state:"",type:"macroTask",data:{target:e,method:e[Z],sync:e[J],url:e[X],status:""}};try{return function(e){if("schedule"!==e.state){e.state="schedule",t("schedule",e);var n=e.data.target;r("readystatechange"),r("load"),r("timeout"),r("error"),r("abort")}function r(t){n.addEventListener(t,(function(t){var r=t.type;"readystatechange"===r?4===n.readyState&&0!==n.status&&i(e,"success"):i(e,"load"===r?"success":r)}))}}(a),r.apply(e,n)}catch(t){throw i(a,"error"),t}}}));function i(e,n){e.state!==G&&(e.state=G,e.data.status=n,t(G,e))}}for(var tt=["click"],et={},nt=0;nt<tt.length;nt++){var rt=tt[nt];et[rt]=B(rt)}function it(t,e,n){return t instanceof Element&&tt.indexOf(e)>=0&&"function"==typeof n}var at=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 at,st=!1;function ct(){return st||(st=!0,Y((function(t,e){ot.send("xmlhttprequest",[t,e])})),function(t){if(window.fetch&&window.Request){var e=window.fetch;window.fetch=function(t,i){var a,o,s=this,c=arguments;if("string"==typeof t)a=new Request(t,i),o=t;else{if(!t)return e.apply(s,c);o=(a=t).url}var u={source:"fetch",state:"",type:"macroTask",data:{target:a,method:a.method,url:o,aborted:!1}};return new g((function(t,i){var o;U.fetchInProgress=!0,n(u);try{o=e.apply(s,[a])}catch(t){return i(t),u.data.error=t,r(u),void(U.fetchInProgress=!1)}o.then((function(e){t(e),H((function(){u.data.response=e,r(u)}))}),(function(t){i(t),H((function(){u.data.error=t,r(u)}))})),U.fetchInProgress=!1}))}}function n(e){e.state="schedule",t("schedule",e)}function r(e){e.state=G,t(G,e)}}((function(t,e){ot.send("fetch",[t,e])})),function(t){if(window.history){var e=history.pushState;"function"==typeof e&&(history.pushState=function(n,r,i){var a={source:"history",data:{state:n,title:r,url:i}};t(G,a),e.apply(this,arguments)})}}((function(t,e){ot.send("history",[t,e])})),function(t){if(window.EventTarget){var e=window.EventTarget.prototype,n=e.addEventListener,r=e.removeEventListener;e.addEventListener=function(t,e,r){var i=this;if(!it(i,t,e))return n.apply(i,arguments);var a=o(i,t,e,r),s=Array.prototype.slice.call(arguments);return s[1]=a,n.apply(i,s)},e.removeEventListener=function(t,e,n){var i=this;if(!it(i,t,e))return r.apply(i,arguments);var a=s(i,t,e,n),o=Array.prototype.slice.call(arguments);return o[1]=a,r.apply(i,o)}}function i(t,e,n,r){for(var i=0;i<t.length;i++){var a=t[i];if(a.eventType===e&&a.listenerFn===n&&a.capture===r)return i}return-1}function a(t){return"boolean"==typeof t?t:!!t&&!!t.capture}function o(e,n,r,o){var s=et[n];if(!s)return r;var c=e[s],u=a(o);if(c){var f=i(c,n,r,u);if(-1!==f)return c[f].wrappingFn}else c=e[s]=[];var d={source:"eventtarget",target:e,eventType:n,listenerFn:r,capture:u,wrappingFn:p};function p(){var e;t("schedule",d);try{e=r.apply(this,arguments)}finally{t(G,d)}return e}return c.push(d),p}function s(t,e,n,r){var o=et[e],s=t[o];if(s){var c=i(s,e,n,a(r));if(-1!==c){var u=s[c];return s.splice(c,1),0===s.length&&(t[o]=void 0),u.wrappingFn}}return n}}((function(t,e){ot.send("eventtarget",[t,e])}))),ot}var ut={bootstrapTime:null,lastHiddenStart:Number.MIN_SAFE_INTEGER},ft=!1;function dt(){return x()?(ct(),function(){"hidden"===document.visibilityState&&(ut.lastHiddenStart=0);window.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState&&(ut.lastHiddenStart=performance.now())}),{capture:!0})}(),ut.bootstrapTime=R(),ft=!0):y&&console.log("[Elastic APM] platform is not supported!"),ft}var pt=n(0),lt=n.n(pt);function vt(t){var e=t.error,n=t.filename,r=t.lineno,i=t.colno,a=[];if(e)try{a=lt.a.parse(e)}catch(t){}return 0===a.length&&(a=[{fileName:n,lineNumber:r,columnNumber:i}]),a.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,a=void 0===i?"<anonymous>":i;if(!e&&!n)return{};if(!r&&!n)return{};var o,s,c=function(t){return void 0===t&&(t=""),"<anonymous>"===t&&(t=""),t}(e),u=(o=c,s=window.location.origin||window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:""),o.indexOf(s)>-1&&(o=o.replace(s+"/","")),o);return function(t){return!!t&&0===window.location.href.indexOf(t)}(c)&&(u="(inline script)"),{abs_path:e,filename:u,function:a,lineno:n,colno:r}}))}var ht=[["#","hash"],["?","query"],["/","path"],["@","auth",1],[NaN,"host",void 0,1]],gt=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,mt=function(){function t(t){var e,n=this.extractProtocol(t||""),r=n.protocol,i=n.address,a=n.slashes,o=!r&&!a,s=this.getLocation(),c=ht.slice();i=i.replace("\\","/"),a||(c[2]=[NaN,"path"]);for(var u=0;u<c.length;u++){var f=c[u],d=f[0],p=f[1];if("string"==typeof d){if(~(e=i.indexOf(d))){var l=f[2];if(l){var v=i.lastIndexOf(d);e=Math.max(e,v),this[p]=i.slice(0,e),i=i.slice(e+l)}else this[p]=i.slice(e),i=i.slice(0,e)}}else this[p]=i,i="";this[p]=this[p]||o&&f[3]&&s[p]||"",f[3]&&(this[p]=this[p].toLowerCase())}if(o&&"/"!==this.path.charAt(0)&&(this.path="/"+this.path),this.relative=o,this.protocol=r||s.protocol,this.hostname=this.host,this.port="",/:\d+$/.test(this.host)){var h=this.host.split(":"),g=h.pop(),m=h.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 y&&(t=window),t.location},e.extractProtocol=function(t){var e=gt.exec(t);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!e[2],address:e[3]}},t}();function yt(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,a=r.duration,o=r.description,s=i;o&&(s+=";desc="+o),a&&(s+=";dur="+a),e.push(s)}return e.join(", ")}(t.serverTiming);return n&&(e.headers={"server-timing":n}),e}function _t(t,e){var n=t.port,r=t.protocol,i=t.hostname,a=t.host,o=function(t,e){return""===t&&(t="http:"===e?"80":"https:"===e?"443":""),t}(n,r),s=91===i.charCodeAt(0)&&93===i.charCodeAt(i.length-1),c=i;return s&&(c=i.slice(1,-1)),{service:{name:r+"//"+a,resource:i+":"+o,type:e},address:c,port:Number(o)}}function bt(){return{page:{referer:document.referrer,url:location.href}}}function St(t,e){if(e){var n;switch(t.type){case"external":n=function(t){var e,n=t.url,r=t.method,i=t.target,a=t.response,o=new mt(n),s=_t(o,"external"),c={http:{method:r,url:o.href},destination:s};return i&&void 0!==i.status?e=i.status:a&&(e=a.status),c.http.status_code=e,c}(e);break;case"resource":n=function(t){var e=t.entry,n=t.url,r=_t(new mt(n),"resource");return{http:{url:n,response:yt(e)},destination:r}}(e);break;case"hard-navigation":n=function(t){var e=t.url;return{destination:_t(new mt(e),"hard-navigation")}}(e)}t.addContext(n)}}function wt(t,e){var n=void 0===e?{}:e,r=(n.tags,function(t,e){if(null==t)return{};var n,r,i={},a=Object.keys(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)>=0||(i[n]=t[n]);return i}(n,["tags"])),i=bt(),a={};if(t.type===K&&z()){var o=_.getEntriesByType("navigation");o&&o.length>0&&(a={response:yt(o[0])})}t.addContext(i,a,r)}var Tt={service:{name:[1024,!0],version:!0,agent:{version:[1024,!0]},environment:!0},labels:{"*":!0}},Et={"*":!0,headers:{"*":!0}},xt={user:{id:!0,email:!0,username:!0},tags:{"*":!0},http:{response:Et},destination:{address:[1024],service:{"*":[1024,!0]}},response:Et},kt={name:[1024,!0],type:[1024,!0],id:[1024,!0],trace_id:[1024,!0],parent_id:[1024,!0],transaction_id:[1024,!0],subtype:!0,action:!0,context:xt},Lt={name:!0,parent_id:!0,type:[1024,!0],id:[1024,!0],trace_id:[1024,!0],span_count:{started:[1024,!0]},context:xt},Ct={id:[1024,!0],trace_id:!0,transaction_id:!0,parent_id:!0,culprit:!0,exception:{type:!0},transaction:{type:!0},context:xt};function Ot(t){return null==t||""===t||void 0===t}function Nt(t,e,n){var r=function(t,e,n,r){return void 0===e&&(e=1024),void 0===n&&(n=!1),void 0===r&&(r="N/A"),n&&Ot(t)&&(t=r),"string"==typeof t?t.substring(0,e):t}(t[e],n[0],n[1]);Ot(r)?delete t[e]:t[e]=r}function It(t,e,n){void 0===t&&(t={}),void 0===n&&(n=e);for(var r=Object.keys(t),i=[],a=function(a){var o=r[a],s=!0===t[o]?i:t[o];Array.isArray(s)?"*"===o?Object.keys(n).forEach((function(t){return Nt(n,t,s)})):Nt(n,o,s):It(s,e,n[o])},o=0;o<r.length;o++)a(o);return e}var jt=["stack","message"];var Ft=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}))}(vt(t)),n="(inline script)",r=e[e.length-1];r&&r.filename&&(n=r.filename);var i=t.message,a=t.error,o=i,s="",c={};if(a&&"object"==typeof a){o=o||a.message,s=a.name;var u=function(t){var e=!1,n={};if(Object.keys(t).forEach((function(r){if(!(jt.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}(a);u&&(c.custom=u)}s||o&&o.indexOf(":")>-1&&(s=o.split(":")[0]);var f=this._transactionService.getCurrentTransaction(),d=f?f.context:{},p=this._configService.get("context"),l=(p.tags,function(t,e){if(null==t)return{};var n,r,i={},a=Object.keys(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)>=0||(i[n]=t[n]);return i}(p,["tags"])),v=j({},bt(),d,l,c),h={id:T(),culprit:n,exception:{message:o,stacktrace:e,type:s},context:v};return f&&(h=I(h,{trace_id:f.traceId,parent_id:f.id,transaction_id:f.id,transaction:{type:f.type,sampled:f.sampled}})),It(Ct,h)},e.logErrorEvent=function(t){if(void 0!==t){var e=this.createErrorDataModel(t);void 0!==e.exception.message&&this._apmServer.addError(e)}},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,n="Unhandled promise rejection: ",r=t.reason,i=void 0===r?"<no reason specified>":r;"string"==typeof i.message?e={error:i,message:n+(i.name?i.name+": ":"")+i.message}:e={message:n+(i="object"==typeof i?"<object>":"function"==typeof i?"<function>":i)};this.logErrorEvent(e)},e.logError=function(t){var e={};return"string"==typeof t?e.message=t:e.error=t,this.logErrorEvent(e)},t}(),At=function(){function t(t,e){void 0===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(){return t.flush()}),this.flushInterval)},e._clear=function(){void 0!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=void 0),this.items=[]},e.flush=function(){this.onFlush(this.items),this._clear()},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 Pt=function(){function t(){}return t.stringify=function(t){return JSON.stringify(t)+"\n"},t}(),Rt=function(){function t(t,e,n){void 0===n&&(n={}),t||(t="Unknown"),e||(e="custom"),this.name=t,this.type=e,this.options=n,this.id=n.id||T(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.addLabels=function(t){this.ensureContext();var e=this.context;e.tags||(e.tags={}),Object.keys(t).forEach((function(n){return k(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 M(this._start,this._end)},t}();var qt=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 a=i.type.split(".",3);i.type=a[0],i.subtype=a[1],i.action=a[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),St(this,n)},r}(Rt),Mt=[["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 Ht(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<3e5&&t-i<3e5&&e-i<3e5}function zt(t){var e=t.name,n=t.initiatorType,r=t.startTime,i=t.responseEnd,a="resource";n&&(a+="."+n);var o=L(e),s=new qt(o,a);return s._start=r,s.end(i,{url:e,entry:t}),s}function Dt(t,e){return null!=e&&t>e}var Ut=["fetchStart","domainLookupStart","domainLookupEnd","connectStart","connectEnd","requestStart","responseStart","responseEnd","domLoading","domInteractive","domContentLoadedEventStart","domContentLoadedEventEnd","domComplete","loadEventStart","loadEventEnd"],Bt=["fs","ls","le","cs","ce","qs","rs","re","dl","di","ds","de","dc","es","ee"];function $t(t){var e=function(t){var e=t.fetchStart,n=t.navigationStart;if(n&&e<n)return null;var r={};return Ut.forEach((function(n){var i=t[n];i&&i>=e&&(r[n]=parseInt(i-e))})),r}(t);return null==e?null:{navigationTiming:e,agent:{timeToFirstByte:e.responseStart,domInteractive:e.domInteractive,domComplete:e.domComplete}}}function Vt(t){if(t.captureTimings){var e=t._end;if(t.type===K){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=[],a=0;a<Mt.length;a++){var o=t[Mt[a][0]],s=t[Mt[a][1]];if(Ht(o,s,n,r,e)){var c=new qt(Mt[a][2],"hard-navigation.browser-timing"),u=null;"requestStart"===Mt[a][0]&&(c.pageResponse=!0,u={url:location.origin}),c._start=o-e,c.end(s-e,u),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($t(r))}if(z()){var i=t._start;(function(t,e,n,r){for(var i=[],a=0;a<t.length;a++){var o=t[a],s=o.initiatorType,c=o.name,u=o.startTime,f=o.responseEnd;-1!==W.indexOf(s)&&null!=c&&(("xmlhttprequest"===s||"fetch"===s)&&(/intake\/v\d+\/rum\/events/.test(c)||Dt(u,e))||Ht(u,f,n,r)&&i.push(zt(t[a])))}return i})(_.getEntriesByType("resource"),ut.bootstrapTime,i,e).forEach((function(e){return t.spans.push(e)})),function(t,e,n){for(var r=[],i=0;i<t.length;i++){var a=t[i],o=a.name,s=a.startTime,c=a.duration,u=s+c;if(!(c<=60)&&Ht(s,u,e,n)){var f=new qt(o,"app");f._start=s,f.end(u),r.push(f)}}return r}(_.getEntriesByType("measure"),i,e).forEach((function(e){return t.spans.push(e)}))}}}function Jt(t){return{ts:t.transfer_size,ebs:t.encoded_body_size,dbs:t.decoded_body_size}}function Xt(t){if(!t)return null;var e={},n=t.page,r=t.http,i=t.response,a=t.destination,o=t.user,s=t.custom;if(n&&(e.p={rf:n.referer,url:n.url}),r&&(e.h=function(t){var e={},n=t.method,r=t.status_code,i=t.url,a=t.response;return e.url=i,n&&(e.mt=n),r&&(e.sc=r),a&&(e.r=Jt(a)),e}(r)),i&&(e.r=Jt(i)),a){var c=a.service;e.dt={se:{n:c.name,t:c.type,rc:c.resource},ad:a.address,po:a.port}}return o&&(e.u={id:o.id,un:o.username,em:o.email}),s&&(e.cu=s),e}function Zt(t){if(!t)return null;var e=t.navigationTiming,n=t.agent,r={nt:{}};Bt.forEach((function(t,n){var i=Ut[n];r.nt[t]=e[i]})),r.a={fb:r.nt.rs,di:r.nt.di,dc:r.nt.dc};var i=n.firstContentfulPaint,a=n.largestContentfulPaint;return i&&(r.a.fp=i),a&&(r.a.lp=a),r}var Gt=function(){function t(t,e){this._configService=t,this._loggingService=e,this.queue=void 0,this.throttleEvents=A}var e=t.prototype;return e.init=function(){var t=this,e=this._configService.get("queueLimit"),n=this._configService.get("flushInterval"),r=this._configService.get("eventsLimit");this.queue=new At((function(e){var n=t.sendEvents(e);n&&n.catch((function(e){t._loggingService.warn("Failed sending events!",t._constructError(e))}))}),{queueLimit:e,flushInterval:n}),this.throttleEvents=function(t,e,n){var r,i=this,a=n.limit,o=n.interval,s=0;return function(){return s++,void 0===r&&(r=setTimeout((function(){s=0,r=void 0}),o)),s>a&&"function"==typeof e?e.apply(i,arguments):t.apply(i,arguments)}}(this.queue.add.bind(this.queue),(function(){return t._loggingService.warn("Dropped events due to throttling!")}),{limit:r,interval:6e4})},e._postJson=function(t,e){var n=this,r={"Content-Type":"application/x-ndjson"};return function(t,e,n){void 0===n&&(n="gzip");var r="function"==typeof CompressionStream;return new g((function(i){if(!r)return i({payload:t,headers:e});var a=new Blob([t]).stream().pipeThrough(new CompressionStream(n));return new Response(a).blob().then((function(t){return e["Content-Encoding"]=n,i({payload:t,headers:e})}))}))}(e,r).catch((function(t){return{payload:e,headers:r}})).then((function(e){return n._makeHttpRequest("POST",t,e)})).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?{}:n,i=r.timeout,a=void 0===i?1e4:i,o=r.payload,s=r.headers;return new g((function(n,r){var i=new window.XMLHttpRequest;if(i[V]=!0,i.open(t,e,!0),i.timeout=a,s)for(var c in s)s.hasOwnProperty(c)&&i.setRequestHeader(c,s[c]);i.onreadystatechange=function(){if(4===i.readyState){var t=i.status,a=i.responseText;0===t||t>399&&t<600?r({url:e,status:t,responseText:a}):n(i)}},i.onerror=function(){var t=i.status,n=i.responseText;r({url:e,status:t,responseText:n})},i.send(o)}))},e.fetchConfig=function(t,e){var n=this,r=this._configService.get("serverUrl")+"/config/v1/rum/agents";if(!t)return g.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 a=JSON.parse(r),o=t.getResponseHeader("etag");return o&&(a.etag=o.replace(/["]/g,""),n._configService.setLocalConfig(a)),a})).catch((function(t){var e=n._constructError(t);return g.reject(e)}))},e.createMetaData=function(){var t=this._configService,e={service:{name:t.get("serviceName"),version:t.get("serviceVersion"),agent:{name:"rum-js",version:t.version},language:{name:"javascript"},environment:t.get("environment")},labels:t.get("context.tags")};return It(Tt,e)},e.addError=function(t){var e;this.throttleEvents(((e={}).errors=t,e))},e.addTransaction=function(t){var e;this.throttleEvents(((e={}).transactions=t,e))},e.ndjsonErrors=function(t,e){var n=e?"e":"error";return t.map((function(t){var r;return Pt.stringify(((r={})[n]=e?function(t){var e,n=t.exception,r={id:t.id,cl:t.culprit,ex:{mg:n.message,st:(e=n.stacktrace,e.map((function(t){return{ap:t.abs_path,f:t.filename,fn:t.function,li:t.lineno,co:t.colno}}))),t:t.type},c:Xt(t.context)},i=t.transaction;return i&&(r.tid=t.trace_id,r.pid=t.parent_id,r.xid=t.transaction_id,r.x={t:i.type,sm:i.sampled}),r}(t):t,r))}))},e.ndjsonMetricsets=function(t){return t.map((function(t){return Pt.stringify({metricset:t})})).join("")},e.ndjsonTransactions=function(t,e){var n=this,r=e?"x":"transaction";return t.map((function(t){var i,a="",o="";return e||(t.spans&&(a=t.spans.map((function(t){return Pt.stringify({span:t})})).join(""),delete t.spans),t.breakdown&&(o=n.ndjsonMetricsets(t.breakdown),delete t.breakdown)),Pt.stringify(((i={})[r]=e?function(t){var e,n=t.spans.map((function(e){var n={id:e.id,n:e.name,t:e.type,s:e.start,d:e.duration,c:Xt(e.context)};return e.parent_id!==t.id&&(n.pid=e.parent_id),!0===e.sync&&(n.sy=!0),e.subtype&&(n.su=e.subtype),e.action&&(n.ac=e.action),n}));return{id:t.id,tid:t.trace_id,n:t.name,t:t.type,d:t.duration,c:Xt(t.context),m:Zt(t.marks),me:(e=t.breakdown,e.map((function(t){var e=t.span,n=t.samples,r=null!=e;return r?{y:{t:e.type},sa:{ysc:{v:n["span.self_time.count"].value},yss:{v:n["span.self_time.sum.us"].value}}}:{sa:{xdc:{v:n["transaction.duration.count"].value},xds:{v:n["transaction.duration.sum.us"].value},xbc:{v:n["transaction.breakdown.count"].value}}}}))),y:n,yc:{sd:n.length},sm:t.sampled,exp:t.experience}}(t):t,i))+a+o}))},e.sendEvents=function(t){var e,n;if(0!==t.length){for(var r=[],i=[],a=0;a<t.length;a++){var o=t[a];o.transactions&&r.push(o.transactions),o.errors&&i.push(o.errors)}if(0!==r.length||0!==i.length){var s=this._configService,c=((e={}).transactions=r,e.errors=i,e),u=s.applyFilters(c);if(u){var f=s.get("apiVersion"),d=f>2,p=[],l=this.createMetaData(),v=d?"m":"metadata";p.push(Pt.stringify(((n={})[v]=d?function(t){var e=t.service,n=t.labels,r=e.agent,i=e.language;return{se:{n:e.name,ve:e.version,a:{n:r.name,ve:r.version},la:{n:i.name},en:e.environment},l:n}}(l):l,n)));var h=(p=p.concat(this.ndjsonErrors(u.errors,d),this.ndjsonTransactions(u.transactions,d))).join(""),g=s.get("serverUrl")+"/intake/v"+f+"/rum/events";return this._postJson(g,h)}this._loggingService.warn("Dropped payload due to filtering!")}}},t}();var Wt,Kt=function(){function t(){this.config={serviceName:"",serviceVersion:"",environment:"",serverUrl:"http://localhost:8200",active:!0,instrument:!0,disableInstrumentations:[],logLevel:"warn",breakdownMetrics:!1,ignoreTransactions:[],eventsLimit:80,queueLimit:-1,flushInterval:500,distributedTracing:!0,distributedTracingOrigins:[],distributedTracingHeaderName:"traceparent",pageLoadTraceId:"",pageLoadSpanId:"",pageLoadSampled:!1,pageLoadTransactionName:"",transactionSampleRate:1,centralConfig:!1,monitorLongtasks:!0,apiVersion:2,context:{}},this.events=new at,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 a=r[i];if(n.test(a.nodeName)){var o=a.nodeName.match(n)[1].split("-").map((function(t,e){return e>0?t.charAt(0).toUpperCase()+t.substring(1):t})).join("");e[o]=a.value||a.nodeValue}}return e}(N());this.setConfig(t)},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,a=n.email;"number"!=typeof r&&"string"!=typeof r||(e.id=r),"string"==typeof i&&(e.username=i),"string"==typeof a&&(e.email=a),this.config.context.user=I(this.config.context.user||{},e)},e.setCustomContext=function(t){void 0===t&&(t={}),this.config.context.custom=I(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 k(n,t[n],e.config.context.tags)}))},e.setConfig=function(t){void 0===t&&(t={}),t.serverUrl&&(t.serverUrl=t.serverUrl.replace(/\/+$/,"")),j(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}(),Qt=function(){function t(t){void 0===t&&(t={}),this.levels=["trace","debug","info","warn","error"],this.level=t.level||"warn",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){t!==this.level&&(this.level=t,this.resetLogMethods())},e.resetLogMethods=function(){var t=this;this.levels.forEach((function(e){t[e]=t.shouldLog(e)?function(){var t=e;"trace"!==e&&"debug"!==e||(t="info");var n=arguments;if(n[0]=this.prefix+n[0],console){var r=console[t]||console.log;"function"==typeof r&&r.apply(console,n)}}:A}))},t}(),Yt=((Wt={}).ConfigService=function(){return new Kt},Wt.LoggingService=function(){return new Qt({prefix:"[Elastic APM] "})},Wt.ApmServer=function(t){var e=t.getService(["ConfigService","LoggingService"]),n=e[0],r=e[1];return new Gt(n,r)},Wt),te=function(){function t(){this.instances={},this.initialized=!1}var e=t.prototype;return e.init=function(){if(!this.initialized){this.initialized=!0;var t=this.getService("ConfigService");t.init();var e=this.getService(["LoggingService","ApmServer"]),n=e[0],r=e[1];t.events.observe("config:change",(function(){var e=t.get("logLevel");n.setLevel(e)})),r.init()}},e.getService=function(t){var e=this;return"string"==typeof t?(this.instances[t]||"function"==typeof Yt[t]&&(this.instances[t]=Yt[t](this)),this.instances[t]):Array.isArray(t)?t.map((function(t){return e.getService(t)})):void 0},t}();var ee=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.history&&ot.observe("history",this.getHistorySub()),t.xmlhttprequest&&ot.observe("xmlhttprequest",this.getXHRSub()),t.fetch&&ot.observe("fetch",this.getFetchSub()),t.eventtarget&&ot.observe("eventtarget",this.getEventTargetSub())},e.getEventTargetSub=function(){var t=this._transactionService;return function(e,n){if("schedule"===e&&"eventtarget"===n.source&&"click"===n.eventType){var r=n.target,i=r.getAttribute("name"),a="";i&&(a='["'+i+'"]');var o=r.tagName.toLowerCase(),s=t.startTransaction("Click - "+o+a,"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){"history"===n.source&&e===G&&t.startTransaction(n.data.title,"route-change",{managed:!0,canReuse:!0})}},e.getXHRSub=function(){var t=this;return function(e,n){"xmlhttprequest"!==n.source||U.fetchInProgress||t.processAPICalls(e,n)}},e.getFetchSub=function(){var t=this;return function(e,n){"fetch"===n.source&&t.processAPICalls(e,n)}},e.processAPICalls=function(t,e){var n=this._configService,r=this._transactionService;if("schedule"===t&&e.data){var i=e.data,a=new mt(i.url),o=i.method+" "+(a.relative?a.path:L(a.href));r.getCurrentTransaction()||r.startTransaction(o,"http-request",{managed:!0});var s=r.startSpan(o,"external.http",{blocking:!0});if(!s)return;var c=n.get("distributedTracing"),u=n.get("distributedTracingOrigins"),f=new mt(window.location.href),d=E(a.origin,f.origin)||E(a.origin,u),p=i.target;c&&d&&p&&this.injectDtHeader(s,p),i.sync&&(s.sync=i.sync),i.span=s}else if(t===G){var l=e.data;l&&l.span&&r.endSpan(l.span,l)}},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),a=/^[\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&&a&&("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}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:parseInt(n._start-e),duration:n.duration(),context:n.context};return It(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,experience:t.experience};return It(Lt,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(a,o){if(0===r.length)r.push(a);else{var s=r[r.length-1],c=s.type===a.type&&s.subtype===a.subtype&&s.action===a.action&&s.name===a.name&&a.duration()/e<n&&(a._start-s._end)/e<n,u=t.length===o+1;c&&(i++,s._end=a._end),i>1&&(!c||u)&&(s.name=i+"x "+s.name,i=1),c||r.push(a)}})),r}(e,t.duration(),.05);t.spans=n}else t.spans=e}else t.resetSpans();return t}(t);if(this.filterTransaction(e))return this.createTransactionDataModel(t)},t}(),ne=[["domainLookupStart","domainLookupEnd","DNS"],["connectStart","connectEnd","TCP"],["requestStart","responseStart","Request"],["responseStart","responseEnd","Response"],["domLoading","domComplete","Processing"],["loadEventStart","loadEventEnd","Load"]];function re(t){return{value:t}}function ie(t,e){var n=e.details,r=e.count,i=void 0===r?1:r,a=e.duration;return{transaction:t,span:n,samples:{"span.self_time.count":re(i),"span.self_time.sum.us":re(a)}}}var ae=function(t){var e,n;function r(e,n,r){var i;return(i=t.call(this,e,n,r)||this).traceId=T(),i.marks=void 0,i.spans=[],i._activeSpans={},i._activeTasks=new Set,i.blocked=!1,i.captureTimings=!1,i.breakdownTimings=[],i.sampled=Math.random()<=i.options.transactionSampleRate,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=P(t),n=R()-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&&R()-this._start<t},i.redefine=function(t,e,n){t&&(this.name=t),e&&(this.type=e),n&&I(this.options,n)},i.startSpan=function(t,e,n){var r=this;if(!this.ended){var i=I({},n);i.onEnd=function(t){r._onSpanEnd(t)},i.traceId=this.traceId,i.sampled=this.sampled,i.parentId||(i.parentId=this.id);var a=new qt(t,e,i);return this._activeSpans[a.id]=a,i.blocking&&this.addTask(a.id),a}},i.isFinished=function(){return!this.blocked&&0===this._activeTasks.size},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,a=t.type,o=t.sampled,s={name:i,type:a};if(n.push({transaction:s,samples:{"transaction.duration.count":re(1),"transaction.duration.sum.us":re(r),"transaction.breakdown.count":re(o?1:0)}}),!o)return n;if(a===K&&e)for(var c=0;c<ne.length;c++){var u=ne[c],f=M(e[u[0]],e[u[1]]);0!==f&&null!=f&&n.push(ie(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],a=i._end,o=i._start,s=a,c=o-n,u=1;u<e.length;u++)o=(i=e[u])._start,a=i._end,o>s?(c+=o-s,s=a):a>s&&(s=a);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 a=r[i],o=a.duration();if(0!==o&&null!=o){var s=a.type,c=a.subtype,u=s.replace(".truncated","");c&&(u+="."+c),e[u]||(e[u]={duration:0,count:0}),e[u].count++,e[u].duration+=o}}return e}(t);Object.keys(d).forEach((function(t){var e=t.split("."),r=e[0],i=e[1],a=d[t],o=a.duration,c=a.count;n.push(ie(s,{details:{type:r,subtype:i},duration:o,count:c}))}))}return n}(this)},i.block=function(t){this.blocked=t,this.blocked||this.detectFinish()},i.addTask=function(t){return t||(t="task-"+T(16)),this._activeTasks.add(t),t},i.removeTask=function(t){this._activeTasks.delete(t)&&this.detectFinish()},i.resetSpans=function(){this.spans=[]},i._onSpanEnd=function(t){this.spans.push(t),delete this._activeSpans[t.id],this.removeTask(t.id)},i.isManaged=function(){return!!this.options.managed},r}(Rt),oe={fid:0,fcp:0,tbt:{start:1/0,duration:0},cls:0};function se(t,e){var n=e.capturePaint,r=t.getEntriesByType("longtask"),i={spans:function(t){for(var e=[],n=0;n<t.length;n++){var r=t[n],i=r.name,a=r.startTime,o=r.duration,s=r.attribution,c=a+o,u=new qt("Longtask("+i+")","longtask",{startTime:a});if(s.length>0){var f=s[0],d=f.name,p=f.containerType,l=f.containerName,v=f.containerId,h={attribution:d,type:p};l&&(h.name=l),v&&(h.id=v),u.addContext({custom:h})}u.end(c),e.push(u)}return e}(r),marks:{}};if(!n)return i;var a=t.getEntriesByType("largest-contentful-paint"),o=a[a.length-1];if(o){var s=parseInt(o.startTime);oe.lcp=s,i.marks.largestContentfulPaint=s}var c=_.timing,u=c.fetchStart-c.navigationStart,f=t.getEntriesByName("first-contentful-paint")[0];if(f){var d=parseInt(u>=0?f.startTime-u:f.startTime);oe.fcp=d,i.marks.firstContentfulPaint=d}var p=function(t){var e=t[0];if(e){var n=e.startTime,r=e.processingStart,i=new qt("First Input Delay","first-input",{startTime:n});return i.end(r),i}}(t.getEntriesByType("first-input"));return p&&(oe.fid=p.duration(),i.spans.push(p)),function(t){t.forEach((function(t){var e=t.name,n=t.startTime,r=t.duration;if(!(n<oe.fcp||"self"!==e&&-1===e.indexOf("same-origin"))){oe.tbt.start=Math.min(oe.tbt.start,n);var i=r-50;i>0&&(oe.tbt.duration+=i)}}))}(r),function(t){t.forEach((function(t){t.hadRecentInput||(oe.cls+=t.value)}))}(t.getEntriesByType("layout-shift")),i}var ce=function(){function t(t){this.po={observe:A,disconnect:A},window.PerformanceObserver&&(this.po=new PerformanceObserver(t))}var e=t.prototype;return e.start=function(t){try{var e=!0;"longtask"===t&&(e=!1),this.po.observe({type:t,buffered:e})}catch(t){}},e.stop=function(){this.po.disconnect()},t}(),ue=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 ce((function(t){var e=n.getCurrentTransaction();if(e&&e.captureTimings){var r,i=!1;e.type===K&&(i=!0);var a=se(t,{capturePaint:i}),o=a.spans,s=a.marks;(r=e.spans).push.apply(r,o),e.addMarks({agent:s})}}))}var e=t.prototype;return e.createCurrentTransaction=function(t,e,n){var r=new ae(t,e,n);return this.currentTransaction=r,r},e.getCurrentTransaction=function(){if(this.currentTransaction&&!this.currentTransaction.ended)return this.currentTransaction},e.createOptions=function(t){var e=this._config.config,n=I({transactionSampleRate:e.transactionSampleRate},t);return n.managed&&(n=I({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 a=r.type,o=Q.indexOf(r.type),s=Q.indexOf(e);o>=0&&s<o&&(a=e),r.redefine(t,a,n),i=!0}else r.end(),r=this.createCurrentTransaction(t,e,n);else r=this.createCurrentTransaction(t,e,n);return r.type===K&&(i||(this.recorder.start("largest-contentful-paint"),this.recorder.start("paint"),this.recorder.start("first-input"),this.recorder.start("layout-shift")),n.pageLoadTraceId&&(r.traceId=n.pageLoadTraceId),n.pageLoadSampled&&(r.sampled=n.pageLoadSampled),"Unknown"===r.name&&n.pageLoadTransactionName&&(r.name=n.pageLoadTransactionName)),!i&&this._config.get("monitorLongtasks")&&this.recorder.start("longtask"),r.sampled&&(r.captureTimings=!0),r},e.startTransaction=function(t,e,n){var r,i=this,a=this.createOptions(n),o=!0;a.managed?this.currentTransaction===(r=this.startManagedTransaction(t,e,a))&&(o=!1):r=new ae(t,e,a);return r.onEnd=function(){return i.handleTransactionEnd(r)},o&&this._config.events.send("transaction:start",[r]),r},e.handleTransactionEnd=function(t){var e=this;this.recorder.stop();var n=window.location.href;return g.resolve().then((function(){var r=t.name,i=t.type;if(!(ut.lastHiddenStart>=t._start||e.shouldIgnoreTransaction(r)||"temporary"===i)){if(i===K){var a=e._config.get("pageLoadTransactionName");if("Unknown"===r&&a&&(t.name=a),t.captureTimings){var o=oe.cls,s=oe.fid,c=oe.tbt;c.duration>0&&t.spans.push((f=(u=c).start,d=u.duration,(p=new qt("Total Blocking Time","longtask",{startTime:f})).end(f+d),p)),t.experience={},D("longtask")&&(t.experience.tbt=c.duration),D("layout-shift")&&(t.experience.cls=o),s>0&&(t.experience.fid=s)}}var u,f,d,p;"Unknown"===t.name&&(t.name=function(t,e){void 0===e&&(e=2);for(var n=new mt(t),r=n.query,i=n.path.substring(1).split("/"),a=/\W|_/g,o=/[0-9]/g,s=/[a-z]/g,c=/[A-Z]/g,u=[],f=!1,d=0;d<i.length;d++){var p=i[d];if(f||d>e-1){p&&u.push("*");break}if((p.match(a)||[]).length>=2)u.push(":id"),f=!0;else{var l=(p.match(o)||[]).length;if(l>3||p.length>3&&l/p.length>=.3)u.push(":id"),f=!0;else{var v=(p.match(c)||[]).length,h=(p.match(s)||[]).length/p.length,g=v/p.length;p.length>5&&(g>.3&&g<.6||h>.3&&h<.6)?(u.push(":id"),f=!0):p&&u.push(p)}}}return"/"+(u.length>=2?u.join("/"):u.join(""))+(r?"?{query}":"")}(n)),Vt(t),e.adjustTransactionTime(t),e._config.get("breakdownMetrics")&&t.captureBreakdown();var l=e._config.get("context");wt(t,l),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,a=0;a<e.length;a++){var o=e[a];o._end>i&&(o._end=i,o.type+=".truncated"),o._start>i&&(o._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.getCurrentTransaction();r||(r=this.createCurrentTransaction(void 0,"temporary",this.createOptions({canReuse:!0,managed:!0})));var i=r.startSpan(t,e,n);return i},e.endSpan=function(t,e){t&&t.end(null,e)},t}();function fe(){return Yt.TransactionService=function(t){var e=t.getService(["LoggingService","ConfigService"]),n=e[0],r=e[1];return new ue(n,r)},Yt.PerformanceMonitoring=function(t){var e=t.getService(["ApmServer","ConfigService","LoggingService","TransactionService"]),n=e[0],r=e[1],i=e[2],a=e[3];return new ee(n,r,i,a)},Yt.ErrorLogging=function(t){var e=t.getService(["ApmServer","ConfigService","TransactionService"]),n=e[0],r=e[1],i=e[2];return new Ft(n,r,i)},new te}var de=function(){function t(t,e){this._disable=e,this.serviceFactory=t,this._initialized=!1}var e=t.prototype;return e.isEnabled=function(){return!this._disable},e.isActive=function(){var t=this.serviceFactory.getService("ConfigService");return this.isEnabled()&&this._initialized&&t.get("active")},e.init=function(t){var e=this;if(this.isEnabled()&&!this._initialized){this._initialized=!0;var n=this.serviceFactory.getService(["ConfigService","LoggingService"]),r=n[0],i=n[1];r.setVersion("5.6.0"),this.config(t);var a=r.get("logLevel");if(i.setLevel(a),r.get("active")){this.serviceFactory.init();var o=function(t,e){var n,r=((n={}).xmlhttprequest=!1,n.fetch=!1,n.history=!1,n[K]=!1,n.error=!1,n.eventtarget=!1,n);return t?(Object.keys(r).forEach((function(t){-1===e.indexOf(t)&&(r[t]=!0)})),r):r}(r.get("instrument"),r.get("disableInstrumentations"));if(this.serviceFactory.getService("PerformanceMonitoring").init(o),o.error)this.serviceFactory.getService("ErrorLogging").registerListeners();var s=function(){return o[K]&&e._sendPageLoadMetrics()};r.get("centralConfig")?this.fetchCentralConfig().then(s):s()}else this._disable=!0,i.warn("RUM agent is inactive")}return this},e.fetchCentralConfig=function(){var t=this.serviceFactory.getService(["ApmServer","LoggingService","ConfigService"]),e=t[0],n=t[1],r=t[2];return e.fetchConfig(r.get("serviceName"),r.get("environment")).then((function(t){var e=t.transaction_sample_rate;if(e){var i={transactionSampleRate:e=Number(e)},a=r.validate(i).invalid;if(0===a.length)r.setConfig(i);else{var o=a[0],s=o.key,c=o.value,u=o.allowed;n.warn('invalid value "'+c+'" for '+s+". Allowed: "+u+".")}}return t})).catch((function(t){n.warn("failed fetching config:",t)}))},e._sendPageLoadMetrics=function(){var t=this.startTransaction(void 0,K,{managed:!0,canReuse:!0});if(t){t.addTask(K);var e=function(){setTimeout((function(){return t.removeTask(K)}))};"complete"===document.readyState?e():window.addEventListener("load",e)}},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 a=this.serviceFactory.getService("LoggingService"),o="RUM agent isn't correctly configured. ";r.length>0&&(o+=r.join(", ")+" is missing",i.length>0&&(o+=", ")),i.forEach((function(t,e){var n=t.key,r=t.value,a=t.allowed;o+=n+' "'+r+'" contains invalid characters! (allowed: '+a+")"+(e!==i.length-1?", ":"")})),a.error(o),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.addLabels=function(t){this.serviceFactory.getService("ConfigService").addLabels(t)},e.setInitialPageLoadName=function(t){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,n){if(this.isEnabled())return this.serviceFactory.getService("TransactionService").startSpan(t,e,n)},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}();var pe=function(){if(y&&window.elasticApm)return window.elasticApm;var t=dt(),e=fe(),n=new de(e,!t);return y&&(window.elasticApm=n),n}(),le=pe.init.bind(pe);e.default=le}]); | ||
//# sourceMappingURL=elastic-apm-rum.umd.min.js.map |
@@ -12,2 +12,11 @@ import { getInstrumentationFlags, PAGE_LOAD, ERROR, CONFIG_SERVICE, LOGGING_SERVICE, APM_SERVER } from '@elastic/apm-rum-core'; | ||
_proto.isEnabled = function isEnabled() { | ||
return !this._disable; | ||
}; | ||
_proto.isActive = function isActive() { | ||
var configService = this.serviceFactory.getService(CONFIG_SERVICE); | ||
return this.isEnabled() && this._initialized && configService.get('active'); | ||
}; | ||
_proto.init = function init(config) { | ||
@@ -23,8 +32,9 @@ var _this = this; | ||
configService.setVersion('5.5.0'); | ||
configService.setVersion('5.6.0'); | ||
this.config(config); | ||
var logLevel = configService.get('logLevel'); | ||
loggingService.setLevel(logLevel); | ||
var isConfigActive = configService.get('active'); | ||
if (configService.isActive()) { | ||
if (isConfigActive) { | ||
this.serviceFactory.init(); | ||
@@ -118,6 +128,2 @@ var flags = getInstrumentationFlags(configService.get('instrument'), configService.get('disableInstrumentations')); | ||
_proto.isEnabled = function isEnabled() { | ||
return !this._disable; | ||
}; | ||
_proto.observe = function observe(name, fn) { | ||
@@ -179,8 +185,6 @@ var configService = this.serviceFactory.getService(CONFIG_SERVICE); | ||
_proto.setInitialPageLoadName = function setInitialPageLoadName(name) { | ||
if (this.isEnabled()) { | ||
var configService = this.serviceFactory.getService(CONFIG_SERVICE); | ||
configService.setConfig({ | ||
pageLoadTransactionName: name | ||
}); | ||
} | ||
var configService = this.serviceFactory.getService(CONFIG_SERVICE); | ||
configService.setConfig({ | ||
pageLoadTransactionName: name | ||
}); | ||
}; | ||
@@ -187,0 +191,0 @@ |
@@ -17,2 +17,11 @@ "use strict"; | ||
_proto.isEnabled = function isEnabled() { | ||
return !this._disable; | ||
}; | ||
_proto.isActive = function isActive() { | ||
var configService = this.serviceFactory.getService(_apmRumCore.CONFIG_SERVICE); | ||
return this.isEnabled() && this._initialized && configService.get('active'); | ||
}; | ||
_proto.init = function init(config) { | ||
@@ -28,8 +37,9 @@ var _this = this; | ||
configService.setVersion('5.5.0'); | ||
configService.setVersion('5.6.0'); | ||
this.config(config); | ||
var logLevel = configService.get('logLevel'); | ||
loggingService.setLevel(logLevel); | ||
var isConfigActive = configService.get('active'); | ||
if (configService.isActive()) { | ||
if (isConfigActive) { | ||
this.serviceFactory.init(); | ||
@@ -123,6 +133,2 @@ var flags = (0, _apmRumCore.getInstrumentationFlags)(configService.get('instrument'), configService.get('disableInstrumentations')); | ||
_proto.isEnabled = function isEnabled() { | ||
return !this._disable; | ||
}; | ||
_proto.observe = function observe(name, fn) { | ||
@@ -184,8 +190,6 @@ var configService = this.serviceFactory.getService(_apmRumCore.CONFIG_SERVICE); | ||
_proto.setInitialPageLoadName = function setInitialPageLoadName(name) { | ||
if (this.isEnabled()) { | ||
var configService = this.serviceFactory.getService(_apmRumCore.CONFIG_SERVICE); | ||
configService.setConfig({ | ||
pageLoadTransactionName: name | ||
}); | ||
} | ||
var configService = this.serviceFactory.getService(_apmRumCore.CONFIG_SERVICE); | ||
configService.setConfig({ | ||
pageLoadTransactionName: name | ||
}); | ||
}; | ||
@@ -192,0 +196,0 @@ |
{ | ||
"name": "@elastic/apm-rum", | ||
"version": "5.5.0", | ||
"version": "5.6.0", | ||
"description": "Elastic APM JavaScript agent", | ||
@@ -49,3 +49,3 @@ "main": "dist/lib/index.js", | ||
"dependencies": { | ||
"@elastic/apm-rum-core": "^5.6.0" | ||
"@elastic/apm-rum-core": "^5.6.1" | ||
}, | ||
@@ -62,3 +62,3 @@ "bundlesize": [ | ||
], | ||
"gitHead": "b9658f99fff70fb341155c8ce2b382e6bca919e0" | ||
"gitHead": "f8fbb1e65bc1b67bf40c6dfb9c1e455f3b46c061" | ||
} |
@@ -42,2 +42,11 @@ /** | ||
isEnabled() { | ||
return !this._disable | ||
} | ||
isActive() { | ||
const configService = this.serviceFactory.getService(CONFIG_SERVICE) | ||
return this.isEnabled() && this._initialized && configService.get('active') | ||
} | ||
init(config) { | ||
@@ -53,3 +62,3 @@ if (this.isEnabled() && !this._initialized) { | ||
*/ | ||
configService.setVersion('5.5.0') | ||
configService.setVersion('5.6.0') | ||
this.config(config) | ||
@@ -64,3 +73,4 @@ /** | ||
*/ | ||
if (configService.isActive()) { | ||
const isConfigActive = configService.get('active') | ||
if (isConfigActive) { | ||
this.serviceFactory.init() | ||
@@ -172,6 +182,2 @@ | ||
isEnabled() { | ||
return !this._disable | ||
} | ||
observe(name, fn) { | ||
@@ -240,8 +246,6 @@ const configService = this.serviceFactory.getService(CONFIG_SERVICE) | ||
setInitialPageLoadName(name) { | ||
if (this.isEnabled()) { | ||
var configService = this.serviceFactory.getService(CONFIG_SERVICE) | ||
configService.setConfig({ | ||
pageLoadTransactionName: name | ||
}) | ||
} | ||
const configService = this.serviceFactory.getService(CONFIG_SERVICE) | ||
configService.setConfig({ | ||
pageLoadTransactionName: name | ||
}) | ||
} | ||
@@ -248,0 +252,0 @@ |
@@ -41,3 +41,5 @@ /** | ||
isEnabled(): boolean | ||
isActive(): boolean | ||
observe(name: TransactionEvents, callback: (tr: Transaction) => void): void | ||
config(config: AgentConfigOptions): void | ||
setUserContext(user: UserObject): void | ||
@@ -44,0 +46,0 @@ setCustomContext(custom: object): void |
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
1796193
Updated@elastic/apm-rum-core@^5.6.1