@elastic/apm-rum
Advanced tools
Comparing version 5.10.2 to 5.11.0
@@ -1,2 +0,2 @@ | ||
!function(){var t={816:function(t,e,n){var r,i,a;!function(o,s){"use strict";i=[n(170)],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)}()},170:function(t,e){var n,r,i;!function(a,o){"use strict";r=[],void 0===(i="function"==typeof(n=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})?n.apply(e,r):n)||(t.exports=i)}()}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var a=e[r]={exports:{}};return t[r].call(a.exports,a,a.exports,n),a.exports}n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,{a:e}),e},n.d=function(t,e){for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},function(){"use strict";var t=n(816),e=n.n(t);function r(t){var n=t.error,r=t.filename,i=t.lineno,a=t.colno,o=[];if(n)try{o=e().parse(n)}catch(t){}return 0===o.length&&(o=[{fileName:r,lineNumber:i,columnNumber:a}]),o.map((function(t){return t.functionName&&(t.functionName=(e=t.functionName,n=e.split("/"),e=(e=(e=n.length>1?["Object",n[n.length-1]].join("."):n[0]).replace(/.<$/gi,".<anonymous>")).replace(/^Anonymous function$/,"<anonymous>"),e=(n=e.split(".")).length>1?n[n.length-1]:n[0])),t;var e,n})).map((function(t){var e=t.fileName,n=t.lineNumber,r=t.columnNumber,i=t.functionName,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 i=function(t){var e=this.constructor;return this.then((function(n){return e.resolve(t()).then((function(){return n}))}),(function(n){return e.resolve(t()).then((function(){return e.reject(n)}))}))},a=setTimeout;function o(t){return Boolean(t&&void 0!==t.length)}function s(){}function c(t){if(!(this instanceof c))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=[],v(t,this)}function u(t,e){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,c._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 d(e.promise,t)}f(e.promise,r)}else(1===t._state?f:d)(e.promise,t._value)}))):t._deferreds.push(e)}function f(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 c)return t._state=3,t._value=e,void l(t);if("function"==typeof n)return void v((r=n,i=e,function(){r.apply(i,arguments)}),t)}t._state=1,t._value=e,l(t)}catch(e){d(t,e)}var r,i}function d(t,e){t._state=2,t._value=e,l(t)}function l(t){2===t._state&&0===t._deferreds.length&&c._immediateFn((function(){t._handled||c._unhandledRejectionFn(t._value)}));for(var e=0,n=t._deferreds.length;e<n;e++)u(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 v(t,e){var n=!1;try{t((function(t){n||(n=!0,f(e,t))}),(function(t){n||(n=!0,d(e,t))}))}catch(t){if(n)return;n=!0,d(e,t)}}c.prototype.catch=function(t){return this.then(null,t)},c.prototype.then=function(t,e){var n=new this.constructor(s);return u(this,new p(t,e,n)),n},c.prototype.finally=i,c.all=function(t){return new c((function(e,n){if(!o(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 a(t,o){try{if(o&&("object"==typeof o||"function"==typeof o)){var s=o.then;if("function"==typeof s)return void s.call(o,(function(e){a(t,e)}),n)}r[t]=o,0==--i&&e(r)}catch(t){n(t)}}for(var s=0;s<r.length;s++)a(s,r[s])}))},c.resolve=function(t){return t&&"object"==typeof t&&t.constructor===c?t:new c((function(e){e(t)}))},c.reject=function(t){return new c((function(e,n){n(t)}))},c.race=function(t){return new c((function(e,n){if(!o(t))return n(new TypeError("Promise.race accepts an array"));for(var r=0,i=t.length;r<i;r++)c.resolve(t[r]).then(e,n)}))},c._immediateFn="function"==typeof setImmediate&&function(t){setImmediate(t)}||function(t){a(t,0)},c._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};var h=c,g={};S?g=window:"undefined"!=typeof self&&(g=self);var m="Promise"in g?g.Promise:h,y=[].slice,S="undefined"!=typeof window,_=S&&"undefined"!=typeof performance?performance:{};for(var b=[],T=0;T<256;++T)b[T]=(T+256).toString(16).substr(1);var w=new Uint8Array(16);function E(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 x(t,e,n){"function"==typeof t.setRequestHeader?t.setRequestHeader(e,n):t.headers&&"function"==typeof t.headers.append?t.headers.append(e,n):t[e]=n}function k(t,e){var n=!1;return"string"==typeof e?n=t===e:e&&"function"==typeof e.test?n=e.test(t):Array.isArray(e)&&e.forEach((function(e){n||(n=k(t,e))})),n}function L(){return S&&"function"==typeof Set&&"function"==typeof JSON.stringify&&_&&"function"==typeof _.now&&"withCredentials"in new window.XMLHttpRequest}function C(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 N(t){return t&&t.split("?")[0]}function O(t){return null!==t&&"object"==typeof t}function I(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)?[]:{}),I(t[u],[f],!1)):t[u]=f}}return t}function j(){if("undefined"!=typeof document){var t=document.currentScript;return t||function(){if("undefined"!=typeof document)for(var t=document.getElementsByTagName("script"),e=0,n=t.length;e<n;e++){var r=t[e];if(r.src.indexOf("elastic")>0)return r}}()}}function F(t){return I(t,y.call(arguments,1),!1)}function R(t){return I(t,y.call(arguments,1),!0)}function q(t){return void 0===t}function A(){}function P(t){return t.replace(/[.*"]/g,"_")}function M(){return _.now()}function H(t){return"number"==typeof t&&t>=0?t:M()}function z(t,e){return q(e)||q(t)?null:parseInt(e-t)}function D(t){m.resolve().then(t)}function U(){return"function"==typeof _.getEntriesByType}function B(t){return"undefined"!=typeof PerformanceObserver&&PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.indexOf(t)>=0}var $=[["#","hash"],["?","query"],["/","path"],["@","auth",1],[NaN,"host",void 0,1]],V=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,J=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=$.slice();i=i.replace("\\","/"),a||(c[2]=[NaN,"path"]);for(var u=0;u<c.length;u++){var f=c[u],d=f[0],l=f[1];if("string"==typeof d){if(~(e=i.indexOf(d))){var p=f[2];if(p){var v=i.lastIndexOf(d);e=Math.max(e,v),this[l]=i.slice(0,e),i=i.slice(e+p)}else this[l]=i.slice(e),i=i.slice(0,e)}}else this[l]=i,i="";this[l]=this[l]||o&&f[3]&&s[l]||"",f[3]&&(this[l]=this[l].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 S&&(t=window),t.location},e.extractProtocol=function(t){var e=V.exec(t);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!e[2],address:e[3]}},t}();var X="invoke",G=["link","css","script","img","xmlhttprequest","fetch","beacon","iframe"],Z="page-load",Y=[Z,"route-change","user-interaction","http-request","custom","temporary"],W=["tags"];function K(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 Q(t){var e=t.port,n=t.protocol,r=t.hostname,i=function(t,e){return""===t&&(t="http:"===e?"80":"https:"===e?"443":""),t}(e,n),a=91===r.charCodeAt(0)&&93===r.charCodeAt(r.length-1),o=r;return a&&(o=r.slice(1,-1)),{service:{resource:r+":"+i,name:"",type:""},address:o,port:Number(i)}}function tt(){return{page:{referer:document.referrer,url:location.href}}}function et(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 J(n),s=Q(o),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=Q(new J(n));return{http:{url:n,response:K(e)},destination:r}}(e);break;case"hard-navigation":n=function(t){var e=t.url;return{destination:Q(new J(e))}}(e)}t.addContext(n)}}function nt(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,W)),i=tt(),a={};if(t.type===Z&&U()){var o=_.getEntriesByType("navigation");o&&o.length>0&&(a={response:K(o[0])})}t.addContext(i,a,r)}var rt={service:{name:[1024,!0],version:!0,agent:{version:[1024,!0]},environment:!0},labels:{"*":!0}},it={"*":!0,headers:{"*":!0}},at={user:{id:!0,email:!0,username:!0},tags:{"*":!0},http:{response:it},destination:{address:[1024],service:{"*":[1024,!0]}},response:it},ot={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:at},st={name:!0,parent_id:!0,type:[1024,!0],id:[1024,!0],trace_id:[1024,!0],span_count:{started:[1024,!0]},context:at},ct={id:[1024,!0],trace_id:!0,transaction_id:!0,parent_id:!0,culprit:!0,exception:{type:!0},transaction:{type:!0},context:at};function ut(t){return null==t||""===t||void 0===t}function ft(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&&ut(t)&&(t=r),"string"==typeof t?t.substring(0,e):t}(t[e],n[0],n[1]);ut(r)?delete t[e]:t[e]=r}function dt(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 ft(n,t,s)})):ft(n,o,s):dt(s,e,n[o])},o=0;o<r.length;o++)a(o);return e}var lt=["tags"];var pt=["stack","message"];var vt=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}))}(r(t)),n="(inline script)",i=e[e.length-1];i&&i.filename&&(n=i.filename);var a=t.message,o=t.error,s=a,c="",u={};if(o&&"object"==typeof o){s=s||o.message,c=o.name;var f=function(t){var e=!1,n={};if(Object.keys(t).forEach((function(r){if(!(pt.indexOf(r)>=0)){var i=t[r];if(null!=i&&"function"!=typeof i){if("object"==typeof i){if("function"!=typeof i.toISOString)return;i=i.toISOString()}n[r]=i,e=!0}}})),e)return n}(o);f&&(u.custom=f)}c||s&&s.indexOf(":")>-1&&(c=s.split(":")[0]);var d=this._transactionService.getCurrentTransaction(),l=d?d.context:{},p=this._configService.get("context"),v=(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,lt)),h=R({},tt(),l,v,u),g={id:E(),culprit:n,exception:{message:s,stacktrace:e,type:c},context:h};return d&&(g=F(g,{trace_id:d.traceId,parent_id:d.id,transaction_id:d.id,transaction:{type:d.type,sampled:d.sampled}})),dt(ct,g)},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;(null==r&&(r="<no reason specified>"),"string"==typeof r.message)?e={error:r,message:n+(r.name?r.name+": ":"")+r.message}:e={message:n+(r="object"==typeof r?"<object>":"function"==typeof r?"<function>":r)};this.logErrorEvent(e)},e.logError=function(t){var e={};return"string"==typeof t?e.message=t:e.error=t,this.logErrorEvent(e)},t}(),ht=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 gt=function(){function t(){}return t.stringify=function(t){return JSON.stringify(t)+"\n"},t}(),mt={fetchInProgress:!1};function yt(t){return"__apm_symbol__"+t}function St(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=yt(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[yt("OriginalDelegate")]=o}}return i}var _t=yt("xhrIgnore"),bt=yt("xhrSync"),Tt=yt("xhrURL"),wt=yt("xhrMethod"),Et=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||E(16),this.traceId=n.traceId,this.sampled=n.sampled,this.sampleRate=n.sampleRate,this.timestamp=n.timestamp,this._start=H(n.startTime),this._end=void 0,this.ended=!1,this.outcome=void 0,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 C(n,t[n],e.tags)}))},e.addContext=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];0!==e.length&&(this.ensureContext(),R.apply(void 0,[this.context].concat(e)))},e.end=function(t){this.ended||(this.ended=!0,this._end=H(t),this.callOnEnd())},e.callOnEnd=function(){"function"==typeof this.onEnd&&this.onEnd(this)},e.duration=function(){return z(this._start,this._end)},t}();function xt(t,e){return(xt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var kt=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,xt(e,n),r.prototype.end=function(e,n){t.prototype.end.call(this,e),et(this,n)},r}(Et),Lt={bootstrapTime:null,lastHiddenStart:Number.MIN_SAFE_INTEGER},Ct=[["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 Nt(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 Ot(t){var e=t.name,n=t.initiatorType,r=t.startTime,i=t.responseEnd,a="resource";n&&(a+="."+n);var o=N(e),s=new kt(o,a);return s._start=r,s.end(i,{url:e,entry:t}),s}function It(t,e){return null!=e&&t>e}var jt=["fetchStart","domainLookupStart","domainLookupEnd","connectStart","connectEnd","requestStart","responseStart","responseEnd","domLoading","domInteractive","domContentLoadedEventStart","domContentLoadedEventEnd","domComplete","loadEventStart","loadEventEnd"],Ft=["fs","ls","le","cs","ce","qs","rs","re","dl","di","ds","de","dc","es","ee"];function Rt(t){var e=function(t){var e=t.fetchStart,n=t.navigationStart,r=t.responseStart,i=t.responseEnd;if(e>=n&&r>=e&&i>=r){var a={};return jt.forEach((function(n){var r=t[n];r&&r>=e&&(a[n]=parseInt(r-e))})),a}return null}(t);return null==e?null:{navigationTiming:e,agent:{timeToFirstByte:e.responseStart,domInteractive:e.domInteractive,domComplete:e.domComplete}}}function qt(t){if(t.captureTimings){var e=t._end;if(t.type===Z){if(t.marks&&t.marks.custom){var n=t.marks.custom;Object.keys(n).forEach((function(e){n[e]+=t._start}))}t._start=0;var r=_.timing;(function(t,e,n,r){for(var i=[],a=0;a<Ct.length;a++){var o=t[Ct[a][0]],s=t[Ct[a][1]];if(Nt(o,s,n,r,e)){var c=new kt(Ct[a][2],"hard-navigation.browser-timing"),u=null;"requestStart"===Ct[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(Rt(r))}if(U()){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)||It(u,e))||Nt(u,f,n,r)&&i.push(Ot(t[a])))}return i})(_.getEntriesByType("resource"),Lt.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)&&Nt(s,u,e,n)){var f=new kt(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 At(t){return{ts:t.transfer_size,ebs:t.encoded_body_size,dbs:t.decoded_body_size}}function Pt(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=At(a)),e}(r)),i&&(e.r=At(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 Mt(t){if(!t)return null;var e=function(t){if(!t)return null;var e={};return Ft.forEach((function(n,r){var i=jt[r];e[n]=t[i]})),e}(t.navigationTiming);return{nt:e,a:Ht(e,t.agent)}}function Ht(t,e){var n={};if(t&&(n={fb:t.rs,di:t.di,dc:t.dc}),e){var r=e.firstContentfulPaint,i=e.largestContentfulPaint;r&&(n.fp=r),i&&(n.lp=i)}return 0===Object.keys(n).length?null:n}var zt=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 ht((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={payload:e,headers:{"Content-Type":"application/x-ndjson"},beforeSend:this._configService.get("apmRequest")};return function(t,e){void 0===e&&(e="gzip");var n="function"==typeof CompressionStream;return new m((function(r){if(!n)return r(t);var i=t.payload,a=t.headers,o=t.beforeSend,s=new Blob([i]).stream().pipeThrough(new CompressionStream(e));return new Response(s).blob().then((function(t){return a["Content-Encoding"]=e,r({payload:t,headers:a,beforeSend:o})}))}))}(r).catch((function(t){return 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,c=r.beforeSend;return new m((function(n,r){var i=new window.XMLHttpRequest;if(i[_t]=!0,i.open(t,e,!0),i.timeout=a,s)for(var u in s)s.hasOwnProperty(u)&&i.setRequestHeader(u,s[u]);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})};var f=!0;"function"==typeof c&&(f=c({url:e,method:t,headers:s,payload:o,xhr:i})),f?i.send(o):r({url:e,status:0,responseText:"Request rejected by user configuration."})}))},e.fetchConfig=function(t,e){var n=this,r=this._configService.get("serverUrl")+"/config/v1/rum/agents";if(!t)return m.reject("serviceName is required for fetching central config.");r+="?service.name="+t,e&&(r+="&service.environment="+e);var i=this._configService.getLocalConfig();i&&(r+="&ifnonematch="+i.etag);var a=this._configService.get("apmRequest");return this._makeHttpRequest("GET",r,{timeout:5e3,beforeSend:a}).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,!0)),a})).catch((function(t){var e=n._constructError(t);return m.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 dt(rt,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 gt.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:Pt(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 gt.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 gt.stringify({span:t})})).join(""),delete t.spans),t.breakdown&&(o=n.ndjsonMetricsets(t.breakdown),delete t.breakdown)),gt.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:Pt(e.context),o:e.outcome,sr:e.sample_rate};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})),r={id:t.id,tid:t.trace_id,n:t.name,t:t.type,d:t.duration,c:Pt(t.context),k:Mt(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,sr:t.sample_rate,o:t.outcome};if(t.experience){var i=t.experience,a=i.cls,o=i.fid,s=i.tbt,c=i.longtask;r.exp={cls:a,fid:o,tbt:s,lt:c}}if(t.session){var u=t.session,f=u.id,d=u.sequence;r.ses={id:f,seq:d}}return r}(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,l=[],p=this.createMetaData(),v=d?"m":"metadata";l.push(gt.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}}(p):p,n)));var h=(l=l.concat(this.ndjsonErrors(u.errors,d),this.ndjsonTransactions(u.transactions,d))).join(""),g=s.get("serverUrlPrefix")||"/intake/v"+f+"/rum/events",m=s.get("serverUrl")+g;return this._postJson(m,h)}this._loggingService.warn("Dropped payload due to filtering!")}}},t}(),Dt=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}();function Ut(){return(Ut=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}var Bt,$t=function(){function t(){this.config={serviceName:"",serviceVersion:"",environment:"",serverUrl:"http://localhost:8200",serverUrlPrefix:"",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:"",propagateTracestate:!1,transactionSampleRate:1,centralConfig:!1,monitorLongtasks:!0,apiVersion:2,context:{},session:!1,apmRequest:null},this.events=new Dt,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}(j());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=F(this.config.context.user||{},e)},e.setCustomContext=function(t){void 0===t&&(t={}),this.config.context.custom=F(this.config.context.custom||{},t)},e.addLabels=function(t){var e=this;this.config.context.tags||(this.config.context.tags={}),Object.keys(t).forEach((function(n){return C(n,t[n],e.config.context.tags)}))},e.setConfig=function(t){void 0===t&&(t={});var e=t,n=e.transactionSampleRate,r=e.serverUrl;r&&(t.serverUrl=r.replace(/\/+$/,"")),q(n)||(n<1e-4&&n>0&&(n=1e-4),t.transactionSampleRate=Math.round(1e4*n)/1e4),R(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;this.config.session&&(t=localStorage);var e=t.getItem("elastic_apm_config");if(e)return JSON.parse(e)},e.setLocalConfig=function(t,e){if(t){if(e)t=Ut({},this.getLocalConfig(),t);var n=sessionStorage;this.config.session&&(n=localStorage),n.setItem("elastic_apm_config",JSON.stringify(t))}},t}(),Vt=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}(),Jt=((Bt={}).ConfigService=function(){return new $t},Bt.LoggingService=function(){return new Vt({prefix:"[Elastic APM] "})},Bt.ApmServer=function(t){var e=t.getService(["ConfigService","LoggingService"]),n=e[0],r=e[1];return new zt(n,r)},Bt),Xt=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 Jt[t]&&(this.instances[t]=Jt[t](this)),this.instances[t]):Array.isArray(t)?t.map((function(t){return e.getService(t)})):void 0},t}();function Gt(t){var e=XMLHttpRequest.prototype;if(e&&e.addEventListener)var n=St(e,"open",(function(){return function(t,e){return t[_t]||(t[wt]=e[0],t[Tt]=e[1],t[bt]=!1===e[2]),n.apply(t,e)}})),r=St(e,"send",(function(){return function(e,n){if(e[_t])return r.apply(e,n);var a={source:"xmlhttprequest",state:"",type:"macroTask",data:{target:e,method:e[wt],sync:e[bt],url:e[Tt],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!==X&&(e.state=X,e.data.status=n,t(X,e))}}for(var Zt=["click"],Yt={},Wt=0;Wt<Zt.length;Wt++){var Kt=Zt[Wt];Yt[Kt]=yt(Kt)}function Qt(t,e,n){return t instanceof EventTarget&&Zt.indexOf(e)>=0&&"function"==typeof n}var te=new Dt,ee=!1;function ne(){return ee||(ee=!0,Gt((function(t,e){te.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 m((function(t,i){var o;mt.fetchInProgress=!0,n(u);try{o=e.apply(s,[a])}catch(t){return i(t),u.data.error=t,r(u),void(mt.fetchInProgress=!1)}o.then((function(e){t(e),D((function(){u.data.response=e,r(u)}))}),(function(t){i(t),D((function(){u.data.error=t,r(u)}))})),mt.fetchInProgress=!1}))}}function n(e){e.state="schedule",t("schedule",e)}function r(e){e.state=X,t(X,e)}}((function(t,e){te.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(X,a),e.apply(this,arguments)})}}((function(t,e){te.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(!Qt(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(!Qt(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=Yt[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",eventType:n,listenerFn:r,capture:u,wrappingFn:l};function l(){var e,n=arguments[0];d.target=n.target,t("schedule",d);try{e=r.apply(this,arguments)}finally{t(X,d)}return e}return c.push(d),l}function s(t,e,n,r){var o=Yt[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){te.send("eventtarget",[t,e])}))),te}var re=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&&te.observe("history",this.getHistorySub()),t.xmlhttprequest&&te.observe("xmlhttprequest",this.getXHRSub()),t.fetch&&te.observe("fetch",this.getFetchSub()),t.eventtarget&&te.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.tagName.toLowerCase(),a=i;if(r.dataset.transactionName)a=r.dataset.transactionName;else{var o=r.getAttribute("name");o&&(a=i+'["'+o+'"]')}var s=t.startTransaction("Click - "+a,"user-interaction",{managed:!0,canReuse:!0,reuseThreshold:300});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===X&&t.startTransaction(n.data.title,"route-change",{managed:!0,canReuse:!0})}},e.getXHRSub=function(){var t=this;return function(e,n){"xmlhttprequest"!==n.source||mt.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 J(i.url),o=i.method+" "+(a.relative?a.path:N(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 J(window.location.href),d=k(a.origin,f.origin)||k(a.origin,u),l=i.target;if(c&&d&&l)this.injectDtHeader(s,l),n.get("propagateTracestate")&&this.injectTSHeader(s,l);else 0;i.sync&&(s.sync=i.sync),i.span=s}else if(t===X){var p=e.data;if(p&&p.span){var v,h,g=p.span,m=p.response,y=p.target;v=m?m.status:y.status,"abort"!=p.status&&(h=v>=400||0==v?"failure":"success"),g.outcome=h;var S=r.getCurrentTransaction();S&&"http-request"===S.type&&(S.outcome=h),r.endSpan(g,p)}}},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);/^[\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)&&i&&r&&x(e,r,i)},e.injectTSHeader=function(t,e){var n=function(t){var e=t.sampleRate;if(!("number"!=typeof e||String(e).length>256)){return"es=s:"+e}}(t);n&&x(e,"tracestate",n)},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,outcome:n.outcome,sample_rate:n.sampleRate};return dt(ot,r)})),r={id:t.id,trace_id:t.traceId,session:t.session,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,sample_rate:t.sampleRate,experience:t.experience,outcome:t.outcome};return dt(st,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.resetFields();return t}(t);if(this.filterTransaction(e))return this.createTransactionDataModel(t)},t}(),ie=[["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 oe(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 se(t,e){return(se=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var ce=function(t){var e,n;function r(e,n,r){var i;return(i=t.call(this,e,n,r)||this).traceId=E(),i.marks=void 0,i.spans=[],i._activeSpans={},i._activeTasks=new Set,i.blocked=!1,i.captureTimings=!1,i.breakdownTimings=[],i.sampleRate=i.options.transactionSampleRate,i.sampled=Math.random()<=i.sampleRate,i}n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,se(e,n);var i=r.prototype;return i.addMarks=function(t){this.marks=R(this.marks||{},t)},i.mark=function(t){var e=P(t),n=M()-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&&M()-this._start<t},i.redefine=function(t,e,n){t&&(this.name=t),e&&(this.type=e),n&&F(this.options,n)},i.startSpan=function(t,e,n){var r=this;if(!this.ended){var i=F({},n);i.onEnd=function(t){r._onSpanEnd(t)},i.traceId=this.traceId,i.sampled=this.sampled,i.sampleRate=this.sampleRate,i.parentId||(i.parentId=this.id);var a=new kt(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=H(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":ae(1),"transaction.duration.sum.us":ae(r),"transaction.breakdown.count":ae(o?1:0)}}),!o)return n;if(a===Z&&e)for(var c=0;c<ie.length;c++){var u=ie[c],f=z(e[u[0]],e[u[1]]);0!==f&&null!=f&&n.push(oe(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(oe(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-"+E(16)),this._activeTasks.add(t),t},i.removeTask=function(t){this._activeTasks.delete(t)&&this.detectFinish()},i.resetFields=function(){this.spans=[],this.sampleRate=0},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}(Et),ue={fid:0,fcp:0,tbt:{start:1/0,duration:0},cls:{score:0,firstEntryTime:Number.NEGATIVE_INFINITY,prevEntryTime:Number.NEGATIVE_INFINITY,currentSessionScore:0},longtask:{count:0,duration:0,max:0}};function fe(t,e){var n=e.isHardNavigation,r=e.trStart,i=t.getEntriesByType("longtask").filter((function(t){return t.startTime>=r})),a={spans:function(t,e){for(var n=[],r=0;r<t.length;r++){var i=t[r],a=i.name,o=i.startTime,s=i.duration,c=i.attribution,u=o+s,f=new kt("Longtask("+a+")","longtask",{startTime:o});if(e.count++,e.duration+=s,e.max=Math.max(s,e.max),c.length>0){var d=c[0],l=d.name,p=d.containerType,v=d.containerName,h=d.containerId,g={attribution:l,type:p};v&&(g.name=v),h&&(g.id=h),f.addContext({custom:g})}f.end(u),n.push(f)}return n}(i,ue.longtask),marks:{}};if(!n)return a;var o=t.getEntriesByType("largest-contentful-paint"),s=o[o.length-1];if(s){var c=parseInt(s.startTime);ue.lcp=c,a.marks.largestContentfulPaint=c}var u=_.timing,f=u.fetchStart-u.navigationStart,d=t.getEntriesByName("first-contentful-paint")[0];if(d){var l=parseInt(f>=0?d.startTime-f:d.startTime);ue.fcp=l,a.marks.firstContentfulPaint=l}var p=function(t){var e=t[0];if(e){var n=e.startTime,r=e.processingStart,i=new kt("First Input Delay","first-input",{startTime:n});return i.end(r),i}}(t.getEntriesByType("first-input"));return p&&(ue.fid=p.duration(),a.spans.push(p)),function(t){t.forEach((function(t){var e=t.name,n=t.startTime,r=t.duration;if(!(n<ue.fcp||"self"!==e&&-1===e.indexOf("same-origin"))){ue.tbt.start=Math.min(ue.tbt.start,n);var i=r-50;i>0&&(ue.tbt.duration+=i)}}))}(i),function(t){t.forEach((function(t){!t.hadRecentInput&&t.value&&((t.startTime-ue.cls.firstEntryTime>5e3||t.startTime-ue.cls.prevEntryTime>1e3)&&(ue.cls.firstEntryTime=t.startTime,ue.cls.currentSessionScore=0),ue.cls.prevEntryTime=t.startTime,ue.cls.currentSessionScore+=t.value,ue.cls.score=Math.max(ue.cls.score,ue.cls.currentSessionScore))}))}(t.getEntriesByType("layout-shift")),a}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{this.po.observe({type:t,buffered:!0})}catch(t){}},e.stop=function(){this.po.disconnect()},t}(),le=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=e.type===Z,a=fe(t,{isHardNavigation:i,trStart:i?0:e._start}),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 ce(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=F({transactionSampleRate:e.transactionSampleRate},t);return n.managed&&(n=F({pageLoadTraceId:e.pageLoadTraceId,pageLoadSampled:e.pageLoadSampled,pageLoadSpanId:e.pageLoadSpanId,pageLoadTransactionName:e.pageLoadTransactionName},n)),n},e.startManagedTransaction=function(t,e,n){var r=this.getCurrentTransaction(),i=!1;if(r)if(r.canReuse()&&n.canReuse){var a=r.type,o=Y.indexOf(r.type),s=Y.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===Z&&(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 ce(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 m.resolve().then((function(){var r=t.name,i=t.type;if(!(Lt.lastHiddenStart>=t._start||e.shouldIgnoreTransaction(r)||"temporary"===i)){if(i===Z){var a=e._config.get("pageLoadTransactionName");if("Unknown"===r&&a&&(t.name=a),t.captureTimings){var o=ue.cls,s=ue.fid,c=ue.tbt,u=ue.longtask;c.duration>0&&t.spans.push((d=(f=c).start,l=f.duration,(p=new kt("Total Blocking Time","longtask",{startTime:d})).end(d+l),p)),t.experience={},B("longtask")&&(t.experience.tbt=c.duration),B("layout-shift")&&(t.experience.cls=o.score),s>0&&(t.experience.fid=s),u.count>0&&(t.experience.longtask={count:u.count,sum:u.duration,max:u.max})}e.setSession(t)}var f,d,l,p;"Unknown"===t.name&&(t.name=function(t,e){void 0===e&&(e=2);for(var n=new J(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 l=i[d];if(f||d>e-1){l&&u.push("*");break}if((l.match(a)||[]).length>=2)u.push(":id"),f=!0;else{var p=(l.match(o)||[]).length;if(p>3||l.length>3&&p/l.length>=.3)u.push(":id"),f=!0;else{var v=(l.match(c)||[]).length,h=(l.match(s)||[]).length/l.length,g=v/l.length;l.length>5&&(g>.3&&g<.6||h>.3&&h<.6)?(u.push(":id"),f=!0):l&&u.push(l)}}}return"/"+(u.length>=2?u.join("/"):u.join(""))+(r?"?{query}":"")}(n)),qt(t),e.adjustTransactionTime(t),e._config.get("breakdownMetrics")&&t.captureBreakdown();var v=e._config.get("context");nt(t,v),e._config.events.send("transaction:end",[t])}}),(function(t){0}))},e.setSession=function(t){var e=this._config.get("session");if(e){"boolean"==typeof e||e.timestamp&&Date.now()-e.timestamp>18e5?t.session={id:E(16),sequence:1}:t.session={id:e.id,sequence:e.sequence?e.sequence+1:1};var n={session:{id:t.session.id,sequence:t.session.sequence,timestamp:Date.now()}};this._config.setConfig(n),this._config.setLocalConfig(n,!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 pe(){return Jt.TransactionService=function(t){var e=t.getService(["LoggingService","ConfigService"]),n=e[0],r=e[1];return new le(n,r)},Jt.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 re(n,r,i,a)},Jt.ErrorLogging=function(t){var e=t.getService(["ApmServer","ConfigService","TransactionService"]),n=e[0],r=e[1],i=e[2];return new vt(n,r,i)},new Xt}var ve=!1;function he(){return L()?(ne(),function(){"hidden"===document.visibilityState&&(Lt.lastHiddenStart=0);window.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState&&(Lt.lastHiddenStart=performance.now())}),{capture:!0})}(),Lt.bootstrapTime=M(),ve=!0):S&&console.log("[Elastic APM] platform is not supported!"),ve}var ge=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.10.2"),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[Z]=!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();if(r.get("session")){var s=r.getLocalConfig();s&&s.session&&r.setConfig({session:s.session})}var c=function(){return o[Z]&&e._sendPageLoadMetrics()};r.get("centralConfig")?this.fetchCentralConfig().then(c):c()}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,Z,{managed:!0,canReuse:!0});if(t){t.addTask(Z);var e=function(){setTimeout((function(){return t.removeTask(Z)}))};"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 me=function(){if(S&&window.elasticApm)return window.elasticApm;var t=he(),e=pe(),n=new ge(e,!t);return S&&(window.elasticApm=n),n}();me.init.bind(me)}()}(); | ||
!function(){var t={816:function(t,e,n){var r,i,a;!function(o,s){"use strict";i=[n(170)],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)}()},170:function(t,e){var n,r,i;!function(a,o){"use strict";r=[],void 0===(i="function"==typeof(n=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})?n.apply(e,r):n)||(t.exports=i)}()}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var a=e[r]={exports:{}};return t[r].call(a.exports,a,a.exports,n),a.exports}n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,{a:e}),e},n.d=function(t,e){for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},function(){"use strict";var t=n(816),e=n.n(t);function r(t){var n=t.error,r=t.filename,i=t.lineno,a=t.colno,o=[];if(n)try{o=e().parse(n)}catch(t){}return 0===o.length&&(o=[{fileName:r,lineNumber:i,columnNumber:a}]),o.map((function(t){return t.functionName&&(t.functionName=(e=t.functionName,n=e.split("/"),e=(e=(e=n.length>1?["Object",n[n.length-1]].join("."):n[0]).replace(/.<$/gi,".<anonymous>")).replace(/^Anonymous function$/,"<anonymous>"),e=(n=e.split(".")).length>1?n[n.length-1]:n[0])),t;var e,n})).map((function(t){var e=t.fileName,n=t.lineNumber,r=t.columnNumber,i=t.functionName,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 i=function(t){var e=this.constructor;return this.then((function(n){return e.resolve(t()).then((function(){return n}))}),(function(n){return e.resolve(t()).then((function(){return e.reject(n)}))}))},a=setTimeout;function o(t){return Boolean(t&&void 0!==t.length)}function s(){}function c(t){if(!(this instanceof c))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=[],v(t,this)}function u(t,e){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,c._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 d(e.promise,t)}f(e.promise,r)}else(1===t._state?f:d)(e.promise,t._value)}))):t._deferreds.push(e)}function f(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 c)return t._state=3,t._value=e,void p(t);if("function"==typeof n)return void v((r=n,i=e,function(){r.apply(i,arguments)}),t)}t._state=1,t._value=e,p(t)}catch(e){d(t,e)}var r,i}function d(t,e){t._state=2,t._value=e,p(t)}function p(t){2===t._state&&0===t._deferreds.length&&c._immediateFn((function(){t._handled||c._unhandledRejectionFn(t._value)}));for(var e=0,n=t._deferreds.length;e<n;e++)u(t,t._deferreds[e]);t._deferreds=null}function l(t,e,n){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=n}function v(t,e){var n=!1;try{t((function(t){n||(n=!0,f(e,t))}),(function(t){n||(n=!0,d(e,t))}))}catch(t){if(n)return;n=!0,d(e,t)}}c.prototype.catch=function(t){return this.then(null,t)},c.prototype.then=function(t,e){var n=new this.constructor(s);return u(this,new l(t,e,n)),n},c.prototype.finally=i,c.all=function(t){return new c((function(e,n){if(!o(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 a(t,o){try{if(o&&("object"==typeof o||"function"==typeof o)){var s=o.then;if("function"==typeof s)return void s.call(o,(function(e){a(t,e)}),n)}r[t]=o,0==--i&&e(r)}catch(t){n(t)}}for(var s=0;s<r.length;s++)a(s,r[s])}))},c.resolve=function(t){return t&&"object"==typeof t&&t.constructor===c?t:new c((function(e){e(t)}))},c.reject=function(t){return new c((function(e,n){n(t)}))},c.race=function(t){return new c((function(e,n){if(!o(t))return n(new TypeError("Promise.race accepts an array"));for(var r=0,i=t.length;r<i;r++)c.resolve(t[r]).then(e,n)}))},c._immediateFn="function"==typeof setImmediate&&function(t){setImmediate(t)}||function(t){a(t,0)},c._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};var h=c,g={};S?g=window:"undefined"!=typeof self&&(g=self);var m="Promise"in g?g.Promise:h,y=[].slice,S="undefined"!=typeof window,_=S&&"undefined"!=typeof performance?performance:{};for(var b=[],T=0;T<256;++T)b[T]=(T+256).toString(16).substr(1);var w=new Uint8Array(16);function E(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 x(t,e,n){"function"==typeof t.setRequestHeader?t.setRequestHeader(e,n):t.headers&&"function"==typeof t.headers.append?t.headers.append(e,n):t[e]=n}function k(t,e){var n=!1;return"string"==typeof e?n=t===e:e&&"function"==typeof e.test?n=e.test(t):Array.isArray(e)&&e.forEach((function(e){n||(n=k(t,e))})),n}function L(){return S&&"function"==typeof Set&&"function"==typeof JSON.stringify&&_&&"function"==typeof _.now&&"withCredentials"in new window.XMLHttpRequest}function C(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 O(t){return t&&t.split("?")[0]}function N(t){return null!==t&&"object"==typeof t}function I(t,e,n){for(var r=0,i=e.length;r<i;++r){var a=e[r];if(N(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&&N(f)?(N(t[u])||(t[u]=Array.isArray(f)?[]:{}),I(t[u],[f],!1)):t[u]=f}}return t}function j(){if("undefined"!=typeof document){var t=document.currentScript;return t||function(){if("undefined"!=typeof document)for(var t=document.getElementsByTagName("script"),e=0,n=t.length;e<n;e++){var r=t[e];if(r.src.indexOf("elastic")>0)return r}}()}}function F(t){return I(t,y.call(arguments,1),!1)}function R(t){return I(t,y.call(arguments,1),!0)}function q(t){return void 0===t}function A(){}function P(t){return t.replace(/[.*"]/g,"_")}function M(t,e){for(var n=null,r=0;r<t.length;r++){var i=t[r];e&&e(i.type)&&(!n||n._end<i._end)&&(n=i)}return n}function H(){return _.now()}function z(t){return"number"==typeof t&&t>=0?t:H()}function D(t,e){return q(e)||q(t)?null:parseInt(e-t)}function U(t){m.resolve().then(t)}function B(){return"function"==typeof _.getEntriesByType}function V(t){return"undefined"!=typeof PerformanceObserver&&PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.indexOf(t)>=0}var $=[["#","hash"],["?","query"],["/","path"],["@","auth",1],[NaN,"host",void 0,1]],J=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,X=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=$.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 S&&(t=window),t.location},e.extractProtocol=function(t){var e=J.exec(t);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!e[2],address:e[3]}},t}();var G="invoke",Z=["link","css","script","img","xmlhttprequest","fetch","beacon","iframe"],Y="page-load",Q=[Y,"route-change","user-interaction","http-request","custom","temporary"],W=["tags"];function K(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 tt(t){var e=t.port,n=t.protocol,r=t.hostname,i=function(t,e){return""===t&&(t="http:"===e?"80":"https:"===e?"443":""),t}(e,n),a=91===r.charCodeAt(0)&&93===r.charCodeAt(r.length-1),o=r;return a&&(o=r.slice(1,-1)),{service:{resource:r+":"+i,name:"",type:""},address:o,port:Number(i)}}function et(){return{page:{referer:document.referrer,url:location.href}}}function nt(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 X(n),s=tt(o),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=tt(new X(n));return{http:{url:n,response:K(e)},destination:r}}(e);break;case"hard-navigation":n=function(t){var e=t.url;return{destination:tt(new X(e))}}(e)}t.addContext(n)}}function rt(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,W)),i=et(),a={};if(t.type===Y&&B()){var o=_.getEntriesByType("navigation");o&&o.length>0&&(a={response:K(o[0])})}t.addContext(i,a,r)}var it={service:{name:[1024,!0],version:!0,agent:{version:[1024,!0]},environment:!0},labels:{"*":!0}},at={"*":!0,headers:{"*":!0}},ot={user:{id:!0,email:!0,username:!0},tags:{"*":!0},http:{response:at},destination:{address:[1024],service:{"*":[1024,!0]}},response:at},st={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},ut={id:[1024,!0],trace_id:!0,transaction_id:!0,parent_id:!0,culprit:!0,exception:{type:!0},transaction:{type:!0},context:ot};function ft(t){return null==t||""===t||void 0===t}function dt(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&&ft(t)&&(t=r),"string"==typeof t?t.substring(0,e):t}(t[e],n[0],n[1]);ft(r)?delete t[e]:t[e]=r}function pt(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 dt(n,t,s)})):dt(n,o,s):pt(s,e,n[o])},o=0;o<r.length;o++)a(o);return e}var lt=["tags"];var vt=["stack","message"];var ht=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}))}(r(t)),n="(inline script)",i=e[e.length-1];i&&i.filename&&(n=i.filename);var a=t.message,o=t.error,s=a,c="",u={};if(o&&"object"==typeof o){s=s||o.message,c=o.name;var f=function(t){var e=!1,n={};if(Object.keys(t).forEach((function(r){if(!(vt.indexOf(r)>=0)){var i=t[r];if(null!=i&&"function"!=typeof i){if("object"==typeof i){if("function"!=typeof i.toISOString)return;i=i.toISOString()}n[r]=i,e=!0}}})),e)return n}(o);f&&(u.custom=f)}c||s&&s.indexOf(":")>-1&&(c=s.split(":")[0]);var d=this._transactionService.getCurrentTransaction(),p=d?d.context:{},l=this._configService.get("context"),v=(l.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}(l,lt)),h=R({},et(),p,v,u),g={id:E(),culprit:n,exception:{message:s,stacktrace:e,type:c},context:h};return d&&(g=F(g,{trace_id:d.traceId,parent_id:d.id,transaction_id:d.id,transaction:{type:d.type,sampled:d.sampled}})),pt(ut,g)},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;(null==r&&(r="<no reason specified>"),"string"==typeof r.message)?e={error:r,message:n+(r.name?r.name+": ":"")+r.message}:e={message:n+(r="object"==typeof r?"<object>":"function"==typeof r?"<function>":r)};this.logErrorEvent(e)},e.logError=function(t){var e={};return"string"==typeof t?e.message=t:e.error=t,this.logErrorEvent(e)},t}(),gt=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}(),yt=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||E(16),this.traceId=n.traceId,this.sampled=n.sampled,this.sampleRate=n.sampleRate,this.timestamp=n.timestamp,this._start=z(n.startTime),this._end=void 0,this.ended=!1,this.outcome=void 0,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 C(n,t[n],e.tags)}))},e.addContext=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];0!==e.length&&(this.ensureContext(),R.apply(void 0,[this.context].concat(e)))},e.end=function(t){this.ended||(this.ended=!0,this._end=z(t),this.callOnEnd())},e.callOnEnd=function(){"function"==typeof this.onEnd&&this.onEnd(this)},e.duration=function(){return D(this._start,this._end)},t}();function St(t,e){return(St=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var _t=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,St(e,n),r.prototype.end=function(e,n){t.prototype.end.call(this,e),nt(this,n)},r}(yt),bt={bootstrapTime:null,lastHiddenStart:Number.MIN_SAFE_INTEGER},Tt=[["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 wt(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 Et(t){var e=t.name,n=t.initiatorType,r=t.startTime,i=t.responseEnd,a="resource";n&&(a+="."+n);var o=O(e),s=new _t(o,a);return s._start=r,s.end(i,{url:e,entry:t}),s}function xt(t,e){return null!=e&&t>e}var kt=["fetchStart","domainLookupStart","domainLookupEnd","connectStart","connectEnd","requestStart","responseStart","responseEnd","domLoading","domInteractive","domContentLoadedEventStart","domContentLoadedEventEnd","domComplete","loadEventStart","loadEventEnd"],Lt=["fs","ls","le","cs","ce","qs","rs","re","dl","di","ds","de","dc","es","ee"];function Ct(t){var e=function(t){var e=t.fetchStart,n=t.navigationStart,r=t.responseStart,i=t.responseEnd;if(e>=n&&r>=e&&i>=r){var a={};return kt.forEach((function(n){var r=t[n];r&&r>=e&&(a[n]=parseInt(r-e))})),a}return null}(t);return null==e?null:{navigationTiming:e,agent:{timeToFirstByte:e.responseStart,domInteractive:e.domInteractive,domComplete:e.domComplete}}}function Ot(t){if(t.captureTimings){var e=t._end;if(t.type===Y){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<Tt.length;a++){var o=t[Tt[a][0]],s=t[Tt[a][1]];if(wt(o,s,n,r,e)){var c=new _t(Tt[a][2],"hard-navigation.browser-timing"),u=null;"requestStart"===Tt[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(Ct(r))}if(B()){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!==Z.indexOf(s)&&null!=c&&(("xmlhttprequest"===s||"fetch"===s)&&(/intake\/v\d+\/rum\/events/.test(c)||xt(u,e))||wt(u,f,n,r)&&i.push(Et(t[a])))}return i})(_.getEntriesByType("resource"),bt.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)&&wt(s,u,e,n)){var f=new _t(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 Nt(t){return{ts:t.transfer_size,ebs:t.encoded_body_size,dbs:t.decoded_body_size}}function It(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=Nt(a)),e}(r)),i&&(e.r=Nt(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 jt(t){if(!t)return null;var e=function(t){if(!t)return null;var e={};return Lt.forEach((function(n,r){var i=kt[r];e[n]=t[i]})),e}(t.navigationTiming);return{nt:e,a:Ft(e,t.agent)}}function Ft(t,e){var n={};if(t&&(n={fb:t.rs,di:t.di,dc:t.dc}),e){var r=e.firstContentfulPaint,i=e.largestContentfulPaint;r&&(n.fp=r),i&&(n.lp=i)}return 0===Object.keys(n).length?null:n}function Rt(t){return!(0===t||t>399&&t<600)}function qt(){return(qt=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function At(t,e){if(!Pt())return!1;if(!("keepalive"in new Request("")))return!1;var n=function(t){if(!t)return 0;if(t instanceof Blob)return t.size;return new Blob([t]).size}(e);return"POST"===t&&n<6e4}function Pt(){return"function"==typeof window.fetch&&"function"==typeof window.Request}var Mt={fetchInProgress:!1};function Ht(t){return"__apm_symbol__"+t}function zt(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=Ht(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[Ht("OriginalDelegate")]=o}}return i}var Dt=Ht("xhrIgnore"),Ut=Ht("xhrSync"),Bt=Ht("xhrURL"),Vt=Ht("xhrMethod");function $t(t,e,n){var r=n.timeout,i=void 0===r?HTTP_REQUEST_TIMEOUT:r,a=n.payload,o=n.headers,s=n.beforeSend;return new m((function(n,r){var c=new window.XMLHttpRequest;if(c[Dt]=!0,c.open(t,e,!0),c.timeout=i,o)for(var u in o)o.hasOwnProperty(u)&&c.setRequestHeader(u,o[u]);c.onreadystatechange=function(){if(4===c.readyState){var t=c.status,i=c.responseText;Rt(t)?n(c):r({url:e,status:t,responseText:i})}},c.onerror=function(){var t=c.status,n=c.responseText;r({url:e,status:t,responseText:n})};var f=!0;"function"==typeof s&&(f=s({url:e,method:t,headers:o,payload:a,xhr:c})),f?c.send(a):r({url:e,status:0,responseText:"Request rejected by user configuration."})}))}var Jt=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 gt((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}),this._configService.observeEvent("queue:flush",(function(){t.queue.flush()}))},e._postJson=function(t,e){var n=this,r={payload:e,headers:{"Content-Type":"application/x-ndjson"},beforeSend:this._configService.get("apmRequest")};return function(t,e){void 0===e&&(e="gzip");var n="function"==typeof CompressionStream;return new m((function(r){if(!n)return r(t);var i=t.payload,a=t.headers,o=t.beforeSend,s=new Blob([i]).stream().pipeThrough(new CompressionStream(e));return new Response(s).blob().then((function(t){return a["Content-Encoding"]=e,r({payload:t,headers:a,beforeSend:o})}))}))}(r).catch((function(t){return 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,c=r.beforeSend;return!c&&At(t,o)?function(t,e,n){var r,i=n.keepalive,a=void 0!==i&&i,o=n.timeout,s=void 0===o?1e4:o,c=n.payload,u=n.headers,f={};if("function"==typeof AbortController){var d=new AbortController;f.signal=d.signal,setTimeout((function(){return d.abort()}),s)}return window.fetch(e,qt({body:c,headers:u,method:t,keepalive:a,credentials:"omit"},f)).then((function(t){return(r=t).text()})).then((function(t){var n={url:e,status:r.status,responseText:t};if(!Rt(r.status))throw n;return n}))}(t,e,{keepalive:!0,timeout:a,payload:o,headers:s}).catch((function(n){if(n instanceof TypeError)return $t(t,e,{timeout:a,payload:o,headers:s,beforeSend:c});throw n})):$t(t,e,{timeout:a,payload:o,headers:s,beforeSend:c})},e.fetchConfig=function(t,e){var n=this,r=this.getEndpoints().configEndpoint;if(!t)return m.reject("serviceName is required for fetching central config.");r+="?service.name="+t,e&&(r+="&service.environment="+e);var i=this._configService.getLocalConfig();i&&(r+="&ifnonematch="+i.etag);var a=this._configService.get("apmRequest");return this._makeHttpRequest("GET",r,{timeout:5e3,beforeSend:a}).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,!0)),a})).catch((function(t){var e=n._constructError(t);return m.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 pt(it,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:It(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:It(e.context),o:e.outcome,sr:e.sample_rate};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})),r={id:t.id,tid:t.trace_id,n:t.name,t:t.type,d:t.duration,c:It(t.context),k:jt(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,sr:t.sample_rate,o:t.outcome};if(t.experience){var i=t.experience,a=i.cls,o=i.fid,s=i.tbt,c=i.longtask;r.exp={cls:a,fid:o,tbt:s,lt:c}}if(t.session){var u=t.session,f=u.id,d=u.sequence;r.ses={id:f,seq:d}}return r}(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")>2,d=[],p=this.createMetaData(),l=f?"m":"metadata";d.push(mt.stringify(((n={})[l]=f?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}}(p):p,n)));var v=(d=d.concat(this.ndjsonErrors(u.errors,f),this.ndjsonTransactions(u.transactions,f))).join(""),h=this.getEndpoints().intakeEndpoint;return this._postJson(h,v)}this._loggingService.warn("Dropped payload due to filtering!")}}},e.getEndpoints=function(){var t=this._configService.get("serverUrl"),e=this._configService.get("apiVersion");return{intakeEndpoint:t+(this._configService.get("serverUrlPrefix")||"/intake/v"+e+"/rum/events"),configEndpoint:t+"/config/v1/rum/agents"}},t}(),Xt=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}();function Gt(){return(Gt=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}var Zt,Yt=function(){function t(){this.config={serviceName:"",serviceVersion:"",environment:"",serverUrl:"http://localhost:8200",serverUrlPrefix:"",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:"",propagateTracestate:!1,transactionSampleRate:1,centralConfig:!1,monitorLongtasks:!0,apiVersion:2,context:{},session:!1,apmRequest:null},this.events=new Xt,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}(j());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=F(this.config.context.user||{},e)},e.setCustomContext=function(t){void 0===t&&(t={}),this.config.context.custom=F(this.config.context.custom||{},t)},e.addLabels=function(t){var e=this;this.config.context.tags||(this.config.context.tags={}),Object.keys(t).forEach((function(n){return C(n,t[n],e.config.context.tags)}))},e.setConfig=function(t){void 0===t&&(t={});var e=t,n=e.transactionSampleRate,r=e.serverUrl;r&&(t.serverUrl=r.replace(/\/+$/,"")),q(n)||(n<1e-4&&n>0&&(n=1e-4),t.transactionSampleRate=Math.round(1e4*n)/1e4),R(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;this.config.session&&(t=localStorage);var e=t.getItem("elastic_apm_config");if(e)return JSON.parse(e)},e.setLocalConfig=function(t,e){if(t){if(e)t=Gt({},this.getLocalConfig(),t);var n=sessionStorage;this.config.session&&(n=localStorage),n.setItem("elastic_apm_config",JSON.stringify(t))}},e.dispatchEvent=function(t,e){this.events.send(t,e)},e.observeEvent=function(t,e){return this.events.observe(t,e)},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}(),Wt=((Zt={}).ConfigService=function(){return new Yt},Zt.LoggingService=function(){return new Qt({prefix:"[Elastic APM] "})},Zt.ApmServer=function(t){var e=t.getService(["ConfigService","LoggingService"]),n=e[0],r=e[1];return new Jt(n,r)},Zt),Kt=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 Wt[t]&&(this.instances[t]=Wt[t](this)),this.instances[t]):Array.isArray(t)?t.map((function(t){return e.getService(t)})):void 0},t}();function te(t){var e=XMLHttpRequest.prototype;if(e&&e.addEventListener)var n=zt(e,"open",(function(){return function(t,e){return t[Dt]||(t[Vt]=e[0],t[Bt]=e[1],t[Ut]=!1===e[2]),n.apply(t,e)}})),r=zt(e,"send",(function(){return function(e,n){if(e[Dt])return r.apply(e,n);var a={source:"xmlhttprequest",state:"",type:"macroTask",data:{target:e,method:e[Vt],sync:e[Ut],url:e[Bt],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 ee=["click"],ne={},re=0;re<ee.length;re++){var ie=ee[re];ne[ie]=Ht(ie)}function ae(t,e,n){return t instanceof EventTarget&&ee.indexOf(e)>=0&&"function"==typeof n}var oe=new Xt,se=!1;function ce(){return se||(se=!0,te((function(t,e){oe.send("xmlhttprequest",[t,e])})),function(t){if(Pt()){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 m((function(t,i){var o;Mt.fetchInProgress=!0,n(u);try{o=e.apply(s,[a])}catch(t){return i(t),u.data.error=t,r(u),void(Mt.fetchInProgress=!1)}o.then((function(e){t(e),U((function(){u.data.response=e,r(u)}))}),(function(t){i(t),U((function(){u.data.error=t,r(u)}))})),Mt.fetchInProgress=!1}))}}function n(e){e.state="schedule",t("schedule",e)}function r(e){e.state=G,t(G,e)}}((function(t,e){oe.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){oe.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(!ae(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(!ae(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=ne[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",eventType:n,listenerFn:r,capture:u,wrappingFn:p};function p(){var e,n=arguments[0];d.target=n.target,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=ne[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){oe.send("eventtarget",[t,e])}))),oe}var ue=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),e._configService.dispatchEvent("queue:add_transaction"))})),t.history&&oe.observe("history",this.getHistorySub()),t.xmlhttprequest&&oe.observe("xmlhttprequest",this.getXHRSub()),t.fetch&&oe.observe("fetch",this.getFetchSub()),t.eventtarget&&oe.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.tagName.toLowerCase(),a=i;if(r.dataset.transactionName)a=r.dataset.transactionName;else{var o=r.getAttribute("name");o&&(a=i+'["'+o+'"]')}var s=t.startTransaction("Click - "+a,"user-interaction",{managed:!0,canReuse:!0,reuseThreshold:300});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||Mt.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(e.data&&e.data.url){var i=this._apmServer.getEndpoints();if(Object.keys(i).some((function(t){return-1!==e.data.url.indexOf(i[t])})))return}if("schedule"===t&&e.data){var a=e.data,o=new X(a.url),s=a.method+" "+(o.relative?o.path:O(o.href));r.getCurrentTransaction()||r.startTransaction(s,"http-request",{managed:!0});var c=r.startSpan(s,"external.http",{blocking:!0});if(!c)return;var u=n.get("distributedTracing"),f=n.get("distributedTracingOrigins"),d=new X(window.location.href),p=k(o.origin,d.origin)||k(o.origin,f),l=a.target;if(u&&p&&l)this.injectDtHeader(c,l),n.get("propagateTracestate")&&this.injectTSHeader(c,l);else 0;a.sync&&(c.sync=a.sync),a.span=c}else if(t===G){var v=e.data;if(v&&v.span){var h,g,m=v.span,y=v.response,S=v.target;h=y?y.status:S.status,"abort"!=v.status&&(g=h>=400||0==h?"failure":"success"),m.outcome=g;var _=r.getCurrentTransaction();_&&"http-request"===_.type&&(_.outcome=g),r.endSpan(m,v)}}},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);/^[\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)&&i&&r&&x(e,r,i)},e.injectTSHeader=function(t,e){var n=function(t){var e=t.sampleRate;if(!("number"!=typeof e||String(e).length>256)){return"es=s:"+e}}(t);n&&x(e,"tracestate",n)},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,outcome:n.outcome,sample_rate:n.sampleRate};return pt(st,r)})),r={id:t.id,trace_id:t.traceId,session:t.session,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,sample_rate:t.sampleRate,experience:t.experience,outcome:t.outcome};return pt(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.resetFields();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 de(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":de(i),"span.self_time.sum.us":de(a)}}}function le(t,e){return(le=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var ve=function(t){var e,n;function r(e,n,r){var i;return(i=t.call(this,e,n,r)||this).traceId=E(),i.marks=void 0,i.spans=[],i._activeSpans={},i._activeTasks=new Set,i.blocked=!1,i.captureTimings=!1,i.breakdownTimings=[],i.sampleRate=i.options.transactionSampleRate,i.sampled=Math.random()<=i.sampleRate,i}n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,le(e,n);var i=r.prototype;return i.addMarks=function(t){this.marks=R(this.marks||{},t)},i.mark=function(t){var e=P(t),n=H()-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&&H()-this._start<t},i.redefine=function(t,e,n){t&&(this.name=t),e&&(this.type=e),n&&(this.options.reuseThreshold=n.reuseThreshold,F(this.options,n))},i.startSpan=function(t,e,n){var r=this;if(!this.ended){var i=F({},n);i.onEnd=function(t){r._onSpanEnd(t)},i.traceId=this.traceId,i.sampled=this.sampled,i.sampleRate=this.sampleRate,i.parentId||(i.parentId=this.id);var a=new _t(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=z(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":de(1),"transaction.duration.sum.us":de(r),"transaction.breakdown.count":de(o?1:0)}}),!o)return n;if(a===Y&&e)for(var c=0;c<fe.length;c++){var u=fe[c],f=D(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(".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(pe(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-"+E(16)),this._activeTasks.add(t),t},i.removeTask=function(t){this._activeTasks.delete(t)&&this.detectFinish()},i.resetFields=function(){this.spans=[],this.sampleRate=0},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}(yt),he={fid:0,fcp:0,tbt:{start:1/0,duration:0},cls:{score:0,firstEntryTime:Number.NEGATIVE_INFINITY,prevEntryTime:Number.NEGATIVE_INFINITY,currentSessionScore:0},longtask:{count:0,duration:0,max:0}};function ge(t,e){var n=e.isHardNavigation,r=e.trStart,i=t.getEntriesByType("longtask").filter((function(t){return t.startTime>=r})),a={spans:function(t,e){for(var n=[],r=0;r<t.length;r++){var i=t[r],a=i.name,o=i.startTime,s=i.duration,c=i.attribution,u=o+s,f=new _t("Longtask("+a+")","longtask",{startTime:o});if(e.count++,e.duration+=s,e.max=Math.max(s,e.max),c.length>0){var d=c[0],p=d.name,l=d.containerType,v=d.containerName,h=d.containerId,g={attribution:p,type:l};v&&(g.name=v),h&&(g.id=h),f.addContext({custom:g})}f.end(u),n.push(f)}return n}(i,he.longtask),marks:{}};if(!n)return a;var o=t.getEntriesByType("largest-contentful-paint"),s=o[o.length-1];if(s){var c=parseInt(s.startTime);he.lcp=c,a.marks.largestContentfulPaint=c}var u=_.timing,f=u.fetchStart-u.navigationStart,d=t.getEntriesByName("first-contentful-paint")[0];if(d){var p=parseInt(f>=0?d.startTime-f:d.startTime);he.fcp=p,a.marks.firstContentfulPaint=p}var l=function(t){var e=t[0];if(e){var n=e.startTime,r=e.processingStart,i=new _t("First Input Delay","first-input",{startTime:n});return i.end(r),i}}(t.getEntriesByType("first-input"));return l&&(he.fid=l.duration(),a.spans.push(l)),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-50;i>0&&(he.tbt.duration+=i)}}))}(i),function(t){t.forEach((function(t){!t.hadRecentInput&&t.value&&((t.startTime-he.cls.firstEntryTime>5e3||t.startTime-he.cls.prevEntryTime>1e3)&&(he.cls.firstEntryTime=t.startTime,he.cls.currentSessionScore=0),he.cls.prevEntryTime=t.startTime,he.cls.currentSessionScore+=t.value,he.cls.score=Math.max(he.cls.score,he.cls.currentSessionScore))}))}(t.getEntriesByType("layout-shift")),a}var me=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{this.po.observe({type:t,buffered:!0})}catch(t){}},e.stop=function(){this.po.disconnect()},t}(),ye=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 me((function(t){var e=n.getCurrentTransaction();if(e&&e.captureTimings){var r,i=e.type===Y,a=ge(t,{isHardNavigation:i,trStart:i?0:e._start}),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 ve(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=F({transactionSampleRate:e.transactionSampleRate},t);return n.managed&&(n=F({pageLoadTraceId:e.pageLoadTraceId,pageLoadSampled:e.pageLoadSampled,pageLoadSpanId:e.pageLoadSpanId,pageLoadTransactionName:e.pageLoadTransactionName},n)),n},e.startManagedTransaction=function(t,e,n){var r=this.getCurrentTransaction(),i=!1;if(r)if(r.canReuse()&&n.canReuse){var 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===Y&&(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 ve(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 m.resolve().then((function(){var r=t.name,i=t.type;if(!(bt.lastHiddenStart>=t._start||e.shouldIgnoreTransaction(r)||"temporary"===i)){if(i===Y){var a=e._config.get("pageLoadTransactionName");if("Unknown"===r&&a&&(t.name=a),t.captureTimings){var o=he.cls,s=he.fid,c=he.tbt,u=he.longtask;c.duration>0&&t.spans.push((d=(f=c).start,p=f.duration,(l=new _t("Total Blocking Time","longtask",{startTime:d})).end(d+p),l)),t.experience={},V("longtask")&&(t.experience.tbt=c.duration),V("layout-shift")&&(t.experience.cls=o.score),s>0&&(t.experience.fid=s),u.count>0&&(t.experience.longtask={count:u.count,sum:u.duration,max:u.max})}e.setSession(t)}var f,d,p,l;"Unknown"===t.name&&(t.name=function(t,e){void 0===e&&(e=2);for(var n=new X(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)),Ot(t),e.adjustTransactionTime(t),e._config.get("breakdownMetrics")&&t.captureBreakdown();var v=e._config.get("context");rt(t,v),e._config.events.send("transaction:end",[t])}}),(function(t){0}))},e.setSession=function(t){var e=this._config.get("session");if(e){"boolean"==typeof e||e.timestamp&&Date.now()-e.timestamp>18e5?t.session={id:E(16),sequence:1}:t.session={id:e.id,sequence:e.sequence?e.sequence+1:1};var n={session:{id:t.session.id,sequence:t.session.sequence,timestamp:Date.now()}};this._config.setConfig(n),this._config.setLocalConfig(n,!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){return M(t,(function(t){return-1===String(t).indexOf("external")}))}(e)||{})._end||0;if(t.type===Y){var i=t._end-1e3,a=he.lcp||0,o=(function(t){return M(t,(function(t){return-1!==String(t).indexOf("external")}))}(e)||{})._end||0;t._end=Math.max(r,o,a,i)}else r>t._end&&(t._end=r);this.truncateSpans(e,t._end)},e.truncateSpans=function(t,e){for(var n=0;n<t.length;n++){var r=t[n];r._end>e&&(r._end=e,r.type+=".truncated"),r._start>e&&(r._start=e)}},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 Se(){return Wt.TransactionService=function(t){var e=t.getService(["LoggingService","ConfigService"]),n=e[0],r=e[1];return new ye(n,r)},Wt.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 ue(n,r,i,a)},Wt.ErrorLogging=function(t){var e=t.getService(["ApmServer","ConfigService","TransactionService"]),n=e[0],r=e[1],i=e[2];return new ht(n,r,i)},new Kt}var _e=!1;function be(){return L()?(ce(),bt.bootstrapTime=H(),_e=!0):S&&console.log("[Elastic APM] platform is not supported!"),_e}function Te(t,e){var n=e.getCurrentTransaction();if(n){var r=t.observeEvent("queue:add_transaction",(function(){t.dispatchEvent("queue:flush"),bt.lastHiddenStart=H(),r()}));n.end()}else t.dispatchEvent("queue:flush"),bt.lastHiddenStart=H()}var we=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","TransactionService"]),r=n[0],i=n[1],a=n[2];r.setVersion("5.11.0"),this.config(t);var o=r.get("logLevel");if(i.setLevel(o),r.get("active")){this.serviceFactory.init();var s=function(t,e){var n,r=((n={}).xmlhttprequest=!1,n.fetch=!1,n.history=!1,n[Y]=!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(s),s.error)this.serviceFactory.getService("ErrorLogging").registerListeners();if(r.get("session")){var c=r.getLocalConfig();c&&c.session&&r.setConfig({session:c.session})}var u=function(){return s[Y]&&e._sendPageLoadMetrics()};r.get("centralConfig")?this.fetchCentralConfig().then(u):u(),function(t,e){"hidden"===document.visibilityState&&(bt.lastHiddenStart=0);var n=function(){"hidden"===document.visibilityState&&Te(t,e)},r=function(){return Te(t,e)};window.addEventListener("visibilitychange",n,!0),window.addEventListener("pagehide",r,!0)}(r,a)}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,Y,{managed:!0,canReuse:!0});if(t){t.addTask(Y);var e=function(){setTimeout((function(){return t.removeTask(Y)}),1e3)};"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 Ee=function(){if(S&&window.elasticApm)return window.elasticApm;var t=be(),e=Se(),n=new we(e,!t);return S&&(window.elasticApm=n),n}();Ee.init.bind(Ee)}()}(); | ||
//# sourceMappingURL=elastic-apm-rum.umd.min.js.map |
@@ -1,2 +0,2 @@ | ||
import { getInstrumentationFlags, PAGE_LOAD, ERROR, CONFIG_SERVICE, LOGGING_SERVICE, APM_SERVER } from '@elastic/apm-rum-core'; | ||
import { getInstrumentationFlags, PAGE_LOAD_DELAY, PAGE_LOAD, ERROR, CONFIG_SERVICE, LOGGING_SERVICE, TRANSACTION_SERVICE, APM_SERVER, observePageVisibility } from '@elastic/apm-rum-core'; | ||
@@ -27,7 +27,8 @@ var ApmBase = function () { | ||
var _this$serviceFactory$ = this.serviceFactory.getService([CONFIG_SERVICE, LOGGING_SERVICE]), | ||
var _this$serviceFactory$ = this.serviceFactory.getService([CONFIG_SERVICE, LOGGING_SERVICE, TRANSACTION_SERVICE]), | ||
configService = _this$serviceFactory$[0], | ||
loggingService = _this$serviceFactory$[1]; | ||
loggingService = _this$serviceFactory$[1], | ||
transactionService = _this$serviceFactory$[2]; | ||
configService.setVersion('5.10.2'); | ||
configService.setVersion('5.11.0'); | ||
this.config(config); | ||
@@ -68,2 +69,4 @@ var logLevel = configService.get('logLevel'); | ||
} | ||
observePageVisibility(configService, transactionService); | ||
} else { | ||
@@ -128,3 +131,3 @@ this._disable = true; | ||
return tr.removeTask(PAGE_LOAD); | ||
}); | ||
}, PAGE_LOAD_DELAY); | ||
}; | ||
@@ -203,3 +206,3 @@ | ||
if (this.isEnabled()) { | ||
var transactionService = this.serviceFactory.getService('TransactionService'); | ||
var transactionService = this.serviceFactory.getService(TRANSACTION_SERVICE); | ||
return transactionService.startTransaction(name, type, options); | ||
@@ -211,3 +214,3 @@ } | ||
if (this.isEnabled()) { | ||
var transactionService = this.serviceFactory.getService('TransactionService'); | ||
var transactionService = this.serviceFactory.getService(TRANSACTION_SERVICE); | ||
return transactionService.startSpan(name, type, options); | ||
@@ -219,3 +222,3 @@ } | ||
if (this.isEnabled()) { | ||
var transactionService = this.serviceFactory.getService('TransactionService'); | ||
var transactionService = this.serviceFactory.getService(TRANSACTION_SERVICE); | ||
return transactionService.getCurrentTransaction(); | ||
@@ -222,0 +225,0 @@ } |
@@ -32,7 +32,8 @@ "use strict"; | ||
var _this$serviceFactory$ = this.serviceFactory.getService([_apmRumCore.CONFIG_SERVICE, _apmRumCore.LOGGING_SERVICE]), | ||
var _this$serviceFactory$ = this.serviceFactory.getService([_apmRumCore.CONFIG_SERVICE, _apmRumCore.LOGGING_SERVICE, _apmRumCore.TRANSACTION_SERVICE]), | ||
configService = _this$serviceFactory$[0], | ||
loggingService = _this$serviceFactory$[1]; | ||
loggingService = _this$serviceFactory$[1], | ||
transactionService = _this$serviceFactory$[2]; | ||
configService.setVersion('5.10.2'); | ||
configService.setVersion('5.11.0'); | ||
this.config(config); | ||
@@ -73,2 +74,4 @@ var logLevel = configService.get('logLevel'); | ||
} | ||
(0, _apmRumCore.observePageVisibility)(configService, transactionService); | ||
} else { | ||
@@ -133,3 +136,3 @@ this._disable = true; | ||
return tr.removeTask(_apmRumCore.PAGE_LOAD); | ||
}); | ||
}, _apmRumCore.PAGE_LOAD_DELAY); | ||
}; | ||
@@ -208,3 +211,3 @@ | ||
if (this.isEnabled()) { | ||
var transactionService = this.serviceFactory.getService('TransactionService'); | ||
var transactionService = this.serviceFactory.getService(_apmRumCore.TRANSACTION_SERVICE); | ||
return transactionService.startTransaction(name, type, options); | ||
@@ -216,3 +219,3 @@ } | ||
if (this.isEnabled()) { | ||
var transactionService = this.serviceFactory.getService('TransactionService'); | ||
var transactionService = this.serviceFactory.getService(_apmRumCore.TRANSACTION_SERVICE); | ||
return transactionService.startSpan(name, type, options); | ||
@@ -224,3 +227,3 @@ } | ||
if (this.isEnabled()) { | ||
var transactionService = this.serviceFactory.getService('TransactionService'); | ||
var transactionService = this.serviceFactory.getService(_apmRumCore.TRANSACTION_SERVICE); | ||
return transactionService.getCurrentTransaction(); | ||
@@ -227,0 +230,0 @@ } |
{ | ||
"name": "@elastic/apm-rum", | ||
"version": "5.10.2", | ||
"version": "5.11.0", | ||
"description": "Elastic APM JavaScript agent", | ||
@@ -35,3 +35,3 @@ "main": "dist/lib/index.js", | ||
"test:e2e:failsafe": "npm run script runE2eTests packages/rum/wdio-failsafe.conf.js", | ||
"test:sauce": "npm run script runSauceTests packages/rum true test:unit test:e2e:supported test:e2e:failsafe", | ||
"test:sauce": "npm run script runSauceTests packages/rum true build:e2e test:unit test:e2e:supported test:e2e:failsafe", | ||
"test": "run-s build:e2e test:types test:node test:bundle test:integration test:sauce", | ||
@@ -50,3 +50,3 @@ "bench": "npm run build:umd && node test/benchmarks/run.js" | ||
"dependencies": { | ||
"@elastic/apm-rum-core": "^5.14.1" | ||
"@elastic/apm-rum-core": "^5.15.0" | ||
}, | ||
@@ -56,7 +56,7 @@ "bundlesize": [ | ||
"path": "./dist/bundles/elastic-apm-rum*.min.js", | ||
"maxSize": "19 kB" | ||
"maxSize": "19.6 kB" | ||
}, | ||
{ | ||
"path": "./dist/bundles/elastic-apm-opentracing*.min.js", | ||
"maxSize": "20.5 kB" | ||
"maxSize": "21 kB" | ||
} | ||
@@ -67,3 +67,3 @@ ], | ||
], | ||
"gitHead": "c3d06219ea689b0c126faa0eaf4717eced0244d5" | ||
"gitHead": "6b4088750c5e03db52135b267cc5b7ffab1ccd61" | ||
} |
@@ -28,2 +28,3 @@ /** | ||
getInstrumentationFlags, | ||
PAGE_LOAD_DELAY, | ||
PAGE_LOAD, | ||
@@ -33,3 +34,5 @@ ERROR, | ||
LOGGING_SERVICE, | ||
APM_SERVER | ||
TRANSACTION_SERVICE, | ||
APM_SERVER, | ||
observePageVisibility | ||
} from '@elastic/apm-rum-core' | ||
@@ -56,5 +59,10 @@ | ||
this._initialized = true | ||
const [configService, loggingService] = this.serviceFactory.getService([ | ||
const [ | ||
configService, | ||
loggingService, | ||
transactionService | ||
] = this.serviceFactory.getService([ | ||
CONFIG_SERVICE, | ||
LOGGING_SERVICE | ||
LOGGING_SERVICE, | ||
TRANSACTION_SERVICE | ||
]) | ||
@@ -64,3 +72,3 @@ /** | ||
*/ | ||
configService.setVersion('5.10.2') | ||
configService.setVersion('5.11.0') | ||
this.config(config) | ||
@@ -114,2 +122,4 @@ /** | ||
} | ||
observePageVisibility(configService, transactionService) | ||
} else { | ||
@@ -182,4 +192,9 @@ this._disable = true | ||
const sendPageLoadMetrics = () => { | ||
// to make sure PerformanceTiming.loadEventEnd has a value | ||
setTimeout(() => tr.removeTask(PAGE_LOAD)) | ||
// The reasons of this timeout are: | ||
// 1. to make sure PerformanceTiming.loadEventEnd has a value. | ||
// 2. to make sure the agent intercepts all the LCP entries triggered by the browser (adding a delay in the timeout). | ||
// The browser might need more time after the pageload event to render other elements (e.g. images). | ||
// That's important because a LCP is only triggered when the related element is completely rendered. | ||
// https://w3c.github.io/largest-contentful-paint/#sec-add-lcp-entry | ||
setTimeout(() => tr.removeTask(PAGE_LOAD), PAGE_LOAD_DELAY) | ||
} | ||
@@ -266,3 +281,3 @@ | ||
var transactionService = this.serviceFactory.getService( | ||
'TransactionService' | ||
TRANSACTION_SERVICE | ||
) | ||
@@ -276,3 +291,3 @@ return transactionService.startTransaction(name, type, options) | ||
var transactionService = this.serviceFactory.getService( | ||
'TransactionService' | ||
TRANSACTION_SERVICE | ||
) | ||
@@ -286,3 +301,3 @@ return transactionService.startSpan(name, type, options) | ||
var transactionService = this.serviceFactory.getService( | ||
'TransactionService' | ||
TRANSACTION_SERVICE | ||
) | ||
@@ -289,0 +304,0 @@ return transactionService.getCurrentTransaction() |
@@ -35,3 +35,3 @@ /** | ||
* Use a single instance of ApmBase across all instance of the agent | ||
* including the instanes used in framework specific integrations | ||
* including the instances used in framework specific integrations | ||
*/ | ||
@@ -38,0 +38,0 @@ function getApmBase() { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1902624
14186