!function(){'use strict';function t(t,e){var n=e.error,r=e.filename,i=e.lineno,o=e.colno,a=[];if(n)try{a=t.parse(n)}catch(t){}return function(t){return 0!==t.length&&(1!==t.length||'lineNumber'in t[0])}(a)||(a=[{fileName:r,lineNumber:i,columnNumber:o}]),a.map((function(t){return t.functionName&&(t.functionName=(e=t.functionName,n=e.split('/'),e=n.length>1?['Object',n[n.length-1]].join('.'):n[0],e=(n=(e=(e=e.replace(/.<$/gi,'.<anonymous>')).replace(/^Anonymous function$/,'<anonymous>')).split('.')).length>1?n[n.length-1]:n[0])),t;var e,n})).map((function(t){var e=t.fileName,n=t.lineNumber,r=t.columnNumber,i=t.functionName,o=void 0===i?'<anonymous>':i;if(!e&&!n)return{};if(!r&&!n)return{};var a,s,c=function(t){return void 0===t&&(t=''),'<anonymous>'===t&&(t=''),t}(e),u=(a=c,s=window.location.origin||window.location.protocol+'//'+window.location.hostname+(window.location.port?':'+window.location.port:''),a.indexOf(s)>-1&&(a=a.replace(s+'/','')),a);return function(t){return!!t&&0===window.location.href.indexOf(t)}(c)&&(u='(inline script)'),{abs_path:e,filename:u,function:o,lineno:n,colno:r}}))}function e(t,e){this.name='AggregateError',this.errors=t,this.message=e||''}e.prototype=Error.prototype;var n=setTimeout;function r(t){return Boolean(t&&void 0!==t.length)}function i(){}function o(t){if(!(this instanceof o))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=[],d(t,this)}function a(t,e){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,o._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 c(e.promise,t)}s(e.promise,r)}else(1===t._state?s:c)(e.promise,t._value)}))):t._deferreds.push(e)}function s(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 o)return t._state=3,t._value=e,void u(t);if('function'==typeof n)return void d((r=n,i=e,function(){r.apply(i,arguments)}),t)}t._state=1,t._value=e,u(t)}catch(e){c(t,e)}var r,i}function c(t,e){t._state=2,t._value=e,u(t)}function u(t){2===t._state&&0===t._deferreds.length&&o._immediateFn((function(){t._handled||o._unhandledRejectionFn(t._value)}));for(var e=0,n=t._deferreds.length;e<n;e++)a(t,t._deferreds[e]);t._deferreds=null}function f(t,e,n){this.onFulfilled='function'==typeof t?t:null,this.onRejected='function'==typeof e?e:null,this.promise=n}function d(t,e){var n=!1;try{t((function(t){n||(n=!0,s(e,t))}),(function(t){n||(n=!0,c(e,t))}))}catch(t){if(n)return;n=!0,c(e,t)}}o.prototype.catch=function(t){return this.then(null,t)},o.prototype.then=function(t,e){var n=new this.constructor(i);return a(this,new f(t,e,n)),n},o.prototype.finally=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)}))}))},o.all=function(t){return new o((function(e,n){if(!r(t))return n(new TypeError('Promise.all accepts an array'));var i=Array.prototype.slice.call(t);if(0===i.length)return e([]);var o=i.length;function a(t,r){try{if(r&&('object'==typeof r||'function'==typeof r)){var s=r.then;if('function'==typeof s)return void s.call(r,(function(e){a(t,e)}),n)}i[t]=r,0==--o&&e(i)}catch(t){n(t)}}for(var s=0;s<i.length;s++)a(s,i[s])}))},o.any=function(t){var n=this;return new n((function(r,i){if(!t||void 0===t.length)return i(new TypeError('Promise.any accepts an array'));var o=Array.prototype.slice.call(t);if(0===o.length)return i();for(var a=[],s=0;s<o.length;s++)try{n.resolve(o[s]).then(r).catch((function(t){a.push(t),a.length===o.length&&i(new e(a,'All promises were rejected'))}))}catch(t){i(t)}}))},o.allSettled=function(t){return new this((function(e,n){if(!t||void 0===t.length)return n(new TypeError(typeof t+' '+t+' is not iterable(cannot read property Symbol(Symbol.iterator))'));var r=Array.prototype.slice.call(t);if(0===r.length)return e([]);var i=r.length;function o(t,n){if(n&&('object'==typeof n||'function'==typeof n)){var a=n.then;if('function'==typeof a)return void a.call(n,(function(e){o(t,e)}),(function(n){r[t]={status:'rejected',reason:n},0==--i&&e(r)}))}r[t]={status:'fulfilled',value:n},0==--i&&e(r)}for(var a=0;a<r.length;a++)o(a,r[a])}))},o.resolve=function(t){return t&&'object'==typeof t&&t.constructor===o?t:new o((function(e){e(t)}))},o.reject=function(t){return new o((function(e,n){n(t)}))},o.race=function(t){return new o((function(e,n){if(!r(t))return n(new TypeError('Promise.race accepts an array'));for(var i=0,a=t.length;i<a;i++)o.resolve(t[i]).then(e,n)}))},o._immediateFn='function'==typeof setImmediate&&function(t){setImmediate(t)}||function(t){n(t,0)},o._unhandledRejectionFn=function(t){'undefined'!=typeof console&&console&&console.warn('Possible Unhandled Promise Rejection:',t)};var p={};v?p=window:'undefined'!=typeof self&&(p=self);var l='Promise'in p?p.Promise:o,h=[].slice,v='undefined'!=typeof window,g=v&&'undefined'!=typeof performance?performance:{};for(var m=[],y=0;y<256;++y)m[y]=(y+256).toString(16).substr(1);var _=new Uint8Array(16);function b(t){return function(t){for(var e=[],n=0;n<t.length;n++)e.push(m[t[n]]);return e.join('')}('undefined'!=typeof crypto&&'function'==typeof crypto.getRandomValues?crypto.getRandomValues(_):'undefined'!=typeof msCrypto&&'function'==typeof msCrypto.getRandomValues?msCrypto.getRandomValues(_):_).substr(0,t)}function S(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 w(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=w(t,e))})),n}function T(){return v&&'function'==typeof Set&&'function'==typeof JSON.stringify&&g&&'function'==typeof g.now&&'withCredentials'in new window.XMLHttpRequest}function E(t,e,n){if(n&&t){var r=F(t),i=typeof e;return null!=e&&'boolean'!==i&&'number'!==i&&(e=String(e)),n[r]=e,n}}function x(){return g.timing.fetchStart}function O(t){return t&&t.split('?')[0]}function I(t){return null!==t&&'object'==typeof t}function C(t,e,n){for(var r=0,i=e.length;r<i;++r){var o=e[r];if(I(o)||'function'==typeof o)for(var a=Object.keys(o),s=0,c=a.length;s<c;s++){var u=a[s],f=o[u];n&&I(f)?(I(t[u])||(t[u]=Array.isArray(f)?[]:{}),C(t[u],[f],!1)):t[u]=f}}return t}function k(){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 L(t){return C(t,h.call(arguments,1),!1)}function N(t){return C(t,h.call(arguments,1),!0)}function j(t){return void 0===t}function R(){}function F(t){return t.replace(/[.*"]/g,'_')}function P(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 A(){return g.now()}function M(t){return'number'==typeof t&&t>=0?t:A()}function q(t,e){return j(e)||j(t)?null:parseInt(e-t)}function H(t){l.resolve().then(t)}function B(){return'function'==typeof g.getEntriesByType}function z(t){return'undefined'!=typeof PerformanceObserver&&PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.indexOf(t)>=0}function D(){return'interactionCount'in performance}function U(t){return t.redirectStart>0}var V=[['#','hash'],['?','query'],['/','path'],['@','auth',1],[NaN,'host',void 0,1]],$=/^([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,o=n.slashes,a=!r&&!o,s=this.getLocation(),c=V.slice();i=i.replace('\\','/'),o||(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 h=i.lastIndexOf(d);e=Math.max(e,h),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]||a&&f[3]&&s[p]||'',f[3]&&(this[p]=this[p].toLowerCase())}if(a&&'/'!==this.path.charAt(0)&&(this.path='/'+this.path),this.relative=a,this.protocol=r||s.protocol,this.hostname=this.host,this.port='',/:\d+$/.test(this.host)){var v=this.host.split(':'),g=v.pop(),m=v.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='[REDACTED]',n=this.auth.split(':');t+=(n[0]?e:'')+(n[1]?':'+e:'')+'@'}return t+=this.host,t+=this.path,t+=this.query,t+=this.hash},e.getLocation=function(){var t={};return v&&(t=window),t.location},e.extractProtocol=function(t){var e=$.exec(t);return{protocol:e[1]?e[1].toLowerCase():'',slashes:!!e[2],address:e[3]}},t}();var X='schedule',G='invoke',W='addEventListener',Y=['link','css','script','img','xmlhttprequest','fetch','beacon','iframe'],Z=3e5,Q='page-load',K='custom',tt='user-interaction',et='http-request',nt='temporary',rt='Unknown',it='page-exit',ot=[Q,'route-change',tt,et,K,nt],at=60,st='transaction:end',ct='config:change',ut='queue:flush',ft='queue:add_transaction',dt='transaction:ignore',pt='xmlhttprequest',lt='fetch',ht='history',vt='eventtarget',gt='click',mt='error',yt=':after',_t='elastic_apm_config',bt='longtask',St='largest-contentful-paint',wt='first-input',Tt='layout-shift',Et='errors',xt='transactions',Ot='ConfigService',It='LoggingService',Ct='TransactionService',kt='ApmServer',Lt='PerformanceMonitoring',Nt='ErrorLogging',jt='.truncated',Rt=1024,Ft=["tags"];var Pt=91,At=93;function Mt(t){var e={transfer_size:t.transferSize,encoded_body_size:t.encodedBodySize,decoded_body_size:t.decodedBodySize},n=function(t){void 0===t&&(t=[]);for(var e=[],n=0;n<t.length;n++){var r=t[n],i=r.name,o=r.duration,a=r.description,s=i;a&&(s+=";desc="+a),o&&(s+=";dur="+o),e.push(s)}return e.join(', ')}(t.serverTiming);return n&&(e.headers={'server-timing':n}),e}function qt(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),o=r.charCodeAt(0)===Pt&&r.charCodeAt(r.length-1)===At,a=r;return o&&(a=r.slice(1,-1)),{service:{resource:r+':'+i,name:'',type:''},address:a,port:Number(i)}}function Ht(){return{page:{referer:document.referrer,url:location.href}}}function Bt(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,o=t.response,a=new J(n),s=qt(a),c={http:{method:r,url:a.href},destination:s};return i&&void 0!==i.status?e=i.status:o&&(e=o.status),c.http.status_code=e,c}(e);break;case"resource":n=function(t){var e=t.entry,n=t.url,r=qt(new J(n));return{http:{url:n,response:Mt(e)},destination:r}}(e);break;case"hard-navigation":n=function(t){var e=t.url;return{destination:qt(new J(e))}}(e)}t.addContext(n)}}function zt(t,e){var n=void 0===e?{}:e;n.tags;var r=function(t,e){if(null==t)return{};var n,r,i={},o=Object.keys(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||(i[n]=t[n]);return i}(n,Ft),i=Ht(),o={};if(t.type===it)t.ensureContext(),t.context.page&&t.context.page.url&&(i.page.url=t.context.page.url);else if(t.type===Q&&B()){var a=g.getEntriesByType("navigation");a&&a.length>0&&(o={response:Mt(a[0])})}t.addContext(i,o,r)}var Dt={service:{name:[Rt,!0],version:!0,agent:{version:[Rt,!0]},environment:!0},labels:{'*':!0}},Ut={'*':!0,headers:{'*':!0}},Vt={user:{id:!0,email:!0,username:!0},tags:{'*':!0},http:{response:Ut},destination:{address:[Rt],service:{'*':[Rt,!0]}},response:Ut},$t={name:[Rt,!0],type:[Rt,!0],id:[Rt,!0],trace_id:[Rt,!0],parent_id:[Rt,!0],transaction_id:[Rt,!0],subtype:!0,action:!0,context:Vt},Jt={name:!0,parent_id:!0,type:[Rt,!0],id:[Rt,!0],trace_id:[Rt,!0],span_count:{started:[Rt,!0]},context:Vt},Xt={id:[Rt,!0],trace_id:!0,transaction_id:!0,parent_id:!0,culprit:!0,exception:{type:!0},transaction:{type:!0},context:Vt};function Gt(t){return null==t||''===t||void 0===t}function Wt(t,e,n){var r=function(t,e,n,r){return void 0===e&&(e=Rt),void 0===n&&(n=!1),void 0===r&&(r='N/A'),n&&Gt(t)&&(t=r),'string'==typeof t?t.substring(0,e):t}(t[e],n[0],n[1]);Gt(r)?delete t[e]:t[e]=r}function Yt(t,e,n){void 0===t&&(t={}),void 0===n&&(n=e);for(var r=Object.keys(t),i=[],o=function(o){var a=r[o],s=!0===t[a]?i:t[a];Array.isArray(s)?'*'===a?Object.keys(n).forEach((function(t){return Wt(n,t,s)})):Wt(n,a,s):Yt(s,e,n[a])},a=0;a<r.length;a++)o(a);return e}'undefined'!=typeof globalThis?globalThis:'undefined'!=typeof window?window:'undefined'!=typeof global?global:'undefined'!=typeof self&&self;function Zt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,'default')?t.default:t}var Qt,Kt={exports:{}},te={exports:{}};function ee(){return Qt||(Qt=1,te.exports=function(){function t(t){return!isNaN(parseFloat(t))&&isFinite(t)}function e(t,e,n,r,i,o){void 0!==t&&this.setFunctionName(t),void 0!==e&&this.setArgs(e),void 0!==n&&this.setFileName(n),void 0!==r&&this.setLineNumber(r),void 0!==i&&this.setColumnNumber(i),void 0!==o&&this.setSource(o)}return e.prototype={getFunctionName:function(){return this.functionName},setFunctionName:function(t){this.functionName=String(t)},getArgs:function(){return this.args},setArgs:function(t){if('[object Array]'!==Object.prototype.toString.call(t))throw new TypeError('Args must be an Array');this.args=t},getFileName:function(){return this.fileName},setFileName:function(t){this.fileName=String(t)},getLineNumber:function(){return this.lineNumber},setLineNumber:function(e){if(!t(e))throw new TypeError('Line Number must be a Number');this.lineNumber=Number(e)},getColumnNumber:function(){return this.columnNumber},setColumnNumber:function(e){if(!t(e))throw new TypeError('Column Number must be a Number');this.columnNumber=Number(e)},getSource:function(){return this.source},setSource:function(t){this.source=String(t)},toString:function(){return(this.getFunctionName()||'{anonymous}')+'('+(this.getArgs()||[]).join(',')+')'+(this.getFileName()?'@'+this.getFileName():'')+(t(this.getLineNumber())?':'+this.getLineNumber():'')+(t(this.getColumnNumber())?':'+this.getColumnNumber():'')}},e}()),te.exports}Kt.exports=function(t){var e=/(^|@)\S+\:\d+/,n=/^\s*at .*(\S+\:\d+|\(native\))/m,r=/^(eval@)?(\[native code\])?$/;function i(t,e,n){if('function'==typeof Array.prototype.map)return t.map(e,n);for(var r=new Array(t.length),i=0;i<t.length;i++)r[i]=e.call(n,t[i]);return r}function o(t,e,n){if('function'==typeof Array.prototype.filter)return t.filter(e,n);for(var r=[],i=0;i<t.length;i++)e.call(n,t[i])&&r.push(t[i]);return r}function a(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}return{parse:function(t){if(void 0!==t.stacktrace||void 0!==t['opera#sourceloc'])return this.parseOpera(t);if(t.stack&&t.stack.match(n))return this.parseV8OrIE(t);if(t.stack)return this.parseFFOrSafari(t);throw new Error('Cannot parse given Error object')},extractLocation:function(t){if(-1===t.indexOf(':'))return[t];var e=/(.+?)(?:\:(\d+))?(?:\:(\d+))?$/.exec(t.replace(/[\(\)]/g,''));return[e[1],e[2]||void 0,e[3]||void 0]},parseV8OrIE:function(e){return i(o(e.stack.split('\n'),(function(t){return!!t.match(n)}),this),(function(e){e.indexOf('(eval ')>-1&&(e=e.replace(/eval code/g,'eval').replace(/(\(eval at [^\()]*)|(\)\,.*$)/g,''));var n=e.replace(/^\s+/,'').replace(/\(eval code/g,'(').split(/\s+/).slice(1),r=this.extractLocation(n.pop()),i=n.join(' ')||void 0,o=a(['eval','<anonymous>'],r[0])>-1?void 0:r[0];return new t(i,void 0,o,r[1],r[2],e)}),this)},parseFFOrSafari:function(e){return i(o(e.stack.split('\n'),(function(t){return!t.match(r)}),this),(function(e){if(e.indexOf(' > eval')>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g,':$1')),-1===e.indexOf('@')&&-1===e.indexOf(':'))return new t(e);var n=e.split('@'),r=this.extractLocation(n.pop()),i=n.join('@')||void 0;return new t(i,void 0,r[0],r[1],r[2],e)}),this)},parseOpera:function(t){return!t.stacktrace||t.message.indexOf('\n')>-1&&t.message.split('\n').length>t.stacktrace.split('\n').length?this.parseOpera9(t):t.stack?this.parseOpera11(t):this.parseOpera10(t)},parseOpera9:function(e){for(var n=/Line (\d+).*script (?:in )?(\S+)/i,r=e.message.split('\n'),i=[],o=2,a=r.length;o<a;o+=2){var s=n.exec(r[o]);s&&i.push(new t(void 0,void 0,s[2],s[1],void 0,r[o]))}return i},parseOpera10:function(e){for(var n=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=e.stacktrace.split('\n'),i=[],o=0,a=r.length;o<a;o+=2){var s=n.exec(r[o]);s&&i.push(new t(s[3]||void 0,void 0,s[2],s[1],void 0,r[o]))}return i},parseOpera11:function(n){return i(o(n.stack.split('\n'),(function(t){return!!t.match(e)&&!t.match(/^Error created at/)}),this),(function(e){var n,r=e.split('@'),i=this.extractLocation(r.pop()),o=r.shift()||'',a=o.replace(/<anonymous function(: (\w+))?>/,'$2').replace(/\([^\)]*\)/g,'')||void 0;o.match(/\(([^\)]*)\)/)&&(n=o.replace(/^[^\(]+\(([^\)]*)\)$/,'$1'));var s=void 0===n||'[arguments not available]'===n?void 0:n.split(',');return new t(a,s,i[0],i[1],i[2],e)}),this)}}}(ee());var ne=Zt(Kt.exports),re=["tags"];var ie=['stack','message'],oe='Unhandled promise rejection: ';var ae=function(){function e(t,e,n){this._apmServer=t,this._configService=e,this._transactionService=n}var n=e.prototype;return n.createErrorDataModel=function(e){var n=function(t){return t.filter((function(t){var e=t.filename,n=t.lineno;return void 0!==e&&void 0!==n}))}(t(ne,e)),r='(inline script)',i=n[n.length-1];i&&i.filename&&(r=i.filename);var o=e.message,a=e.error,s=o,c='',u={};if(a&&'object'==typeof a){s=s||a.message,c=a.name;var f=function(t){var e=!1,n={};if(Object.keys(t).forEach((function(r){if(!(ie.indexOf(r)>=0)){var i=t[r];if(null!=i&&'function'!=typeof i){if('object'==typeof i){if('function'!=typeof i.toISOString)return;i=i.toISOString()}n[r]=i,e=!0}}})),e)return n}(a);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');l.tags;var h=function(t,e){if(null==t)return{};var n,r,i={},o=Object.keys(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||(i[n]=t[n]);return i}(l,re),v=N({},Ht(),p,h,u),g={id:b(),culprit:r,exception:{message:s,stacktrace:n,type:c},context:v};return d&&(g=L(g,{trace_id:d.traceId,parent_id:d.id,transaction_id:d.id,transaction:{type:d.type,sampled:d.sampled}})),Yt(Xt,g)},n.logErrorEvent=function(t){if(void 0!==t){var e=this.createErrorDataModel(t);void 0!==e.exception.message&&this._apmServer.addError(e)}},n.registerListeners=function(){var t=this;window.addEventListener('error',(function(e){return t.logErrorEvent(e)})),window.addEventListener('unhandledrejection',(function(e){return t.logPromiseEvent(e)}))},n.logPromiseEvent=function(t){var e,n=t.reason;if(null==n&&(n='<no reason specified>'),'string'==typeof n.message){var r=n.name?n.name+': ':'';e={error:n,message:oe+r+n.message}}else e=this._parseRejectReason(n);this.logErrorEvent(e)},n.logError=function(t){var e={};return'string'==typeof t?e.message=t:e.error=t,this.logErrorEvent(e)},n._parseRejectReason=function(t){var e={message:oe};if(Array.isArray(t))e.message+='<object>';else if('object'==typeof t)try{e.message+=JSON.stringify(t),e.error=t}catch(t){e.message+='<object>'}else e.message+='function'==typeof t?'<function>':t;return e},e}(),se=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 ce=function(){function t(){}return t.stringify=function(t){return JSON.stringify(t)+'\n'},t}(),ue=['fetchStart','domainLookupStart','domainLookupEnd','connectStart','connectEnd','requestStart','responseStart','responseEnd','domLoading','domInteractive','domContentLoadedEventStart','domContentLoadedEventEnd','domComplete','loadEventStart','loadEventEnd'],fe=['fs','ls','le','cs','ce','qs','rs','re','dl','di','ds','de','dc','es','ee'];function de(t){var e=function(t){var e=t.redirectStart,n=t.fetchStart,r=t.navigationStart,i=t.responseStart,o=t.responseEnd;if(n>=r&&i>=n&&o>=i){var a={};return ue.forEach((function(r){var i=t[r];i&&i>=n&&(U(t)?a[r]=parseInt(i-e):a[r]=parseInt(i-n))})),a}return null}(t);return null==e?null:{navigationTiming:e,agent:{timeToFirstByte:e.responseStart,domInteractive:e.domInteractive,domComplete:e.domComplete}}}function pe(t){return{ts:t.transfer_size,ebs:t.encoded_body_size,dbs:t.decoded_body_size}}function le(t){if(!t)return null;var e={},n=t.page,r=t.http,i=t.response,o=t.destination,a=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,o=t.response;return e.url=i,n&&(e.mt=n),r&&(e.sc=r),o&&(e.r=pe(o)),e}(r)),i&&(e.r=pe(i)),o){var c=o.service;e.dt={se:{n:c.name,t:c.type,rc:c.resource},ad:o.address,po:o.port}}return a&&(e.u={id:a.id,un:a.username,em:a.email}),s&&(e.cu=s),e}function he(t){if(!t)return null;var e=function(t){if(!t)return null;var e={};return fe.forEach((function(n,r){var i=ue[r];e[n]=t[i]})),e}(t.navigationTiming);return{nt:e,a:ve(e,t.agent)}}function ve(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 ge(t,e){void 0===e&&(e='gzip');var n='function'==typeof CompressionStream;return new l((function(r){if(!n)return r(t);if(function(){var t='_elastic_inspect_beacon_';if(null!=sessionStorage.getItem(t))return!0;if(!window.URL||!window.URLSearchParams)return!1;try{var e=new URL(window.location.href).searchParams.has(t);return e&&sessionStorage.setItem(t,!0),e}catch(t){}return!1}())return r(t);var i=t.payload,o=t.headers,a=t.beforeSend,s=new Blob([i]).stream().pipeThrough(new CompressionStream(e));return new Response(s).blob().then((function(t){return o['Content-Encoding']=e,r({payload:t,headers:o,beforeSend:a})}))}))}var me={bootstrapTime:null,lastHiddenStart:Number.MIN_SAFE_INTEGER};function ye(t){return!(0===t||t>399&&t<600)}function _e(){return _e=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},_e.apply(this,arguments)}function be(t,e){if(!Se())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 Se(){return'function'==typeof window.fetch&&'function'==typeof window.Request}var we={fetchInProgress:!1};function Te(t){return'__apm_symbol__'+t}function Ee(t,e,n){for(var r=t;r&&!r.hasOwnProperty(e);)r=Object.getPrototypeOf(r);!r&&t[e]&&(r=t);var i,o,a,s,c=Te(e);if(r&&!(i=r[c])){i=r[c]=r[e];var u=r&&Object.getOwnPropertyDescriptor(r,e);if(!(s=u)||!1!==s.writable&&('function'!=typeof s.get||void 0!==s.set)){var f=n(i,c,e);r[e]=function(){return f(this,arguments)},o=r[e],a=i,o[Te('OriginalDelegate')]=a}}return i}var xe=Te('xhrIgnore'),Oe=Te('xhrSync'),Ie=Te('xhrURL'),Ce=Te('xhrMethod');function ke(t,e,n){var r=n.timeout,i=void 0===r?HTTP_REQUEST_TIMEOUT:r,o=n.payload,a=n.headers,s=n.beforeSend,c=n.sendCredentials;return new l((function(n,r){var u=new window.XMLHttpRequest;if(u[xe]=!0,u.open(t,e,!0),u.timeout=i,u.withCredentials=c,a)for(var f in a)a.hasOwnProperty(f)&&u.setRequestHeader(f,a[f]);u.onreadystatechange=function(){if(4===u.readyState){var t=u.status,i=u.responseText;ye(t)?n(u):r({url:e,status:t,responseText:i})}},u.onerror=function(){var t=u.status,n=u.responseText;r({url:e,status:t,responseText:n})};var d=!0;'function'==typeof s&&(d=s({url:e,method:t,headers:a,payload:o,xhr:u})),d?u.send(o):r({url:e,status:0,responseText:'Request rejected by user configuration.'})}))}var Le=function(){function t(t,e){this._configService=t,this._loggingService=e,this.queue=void 0,this.throttleEvents=R}var e=t.prototype;return e.init=function(){var t=this,e=this._configService.get('queueLimit'),n=this._configService.get('flushInterval'),r=this._configService.get('eventsLimit');this.queue=new se((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,o=n.limit,a=n.interval,s=0;return function(){return s++,void 0===r&&(r=setTimeout((function(){s=0,r=void 0}),a)),s>o&&'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(ut,(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 ge(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;return t.responseText,void 0===n?t:new Error(e+' HTTP status: '+n)},e._makeHttpRequest=function(t,e,n){var r=void 0===n?{}:n,i=r.timeout,o=void 0===i?1e4:i,a=r.payload,s=r.headers,c=r.beforeSend,u=this._configService.get('sendCredentials');return!c&&be(t,a)?function(t,e,n){var r,i=n.keepalive,o=void 0!==i&&i,a=n.timeout,s=void 0===a?1e4:a,c=n.payload,u=n.headers,f=n.sendCredentials,d={};if('function'==typeof AbortController){var p=new AbortController;d.signal=p.signal,setTimeout((function(){return p.abort()}),s)}return window.fetch(e,_e({body:c,headers:u,method:t,keepalive:o,credentials:f?'include':'omit'},d)).then((function(t){return(r=t).text()})).then((function(t){var n={url:e,status:r.status,responseText:t};if(!ye(r.status))throw n;return n}))}(t,e,{keepalive:!0,timeout:o,payload:a,headers:s,sendCredentials:u}).catch((function(n){if(n instanceof TypeError)return ke(t,e,{timeout:o,payload:a,headers:s,beforeSend:c,sendCredentials:u});throw n})):ke(t,e,{timeout:o,payload:a,headers:s,beforeSend:c,sendCredentials:u})},e.fetchConfig=function(t,e){var n=this,r=this.getEndpoints().configEndpoint;if(!t)return l.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 o=this._configService.get('apmRequest');return this._makeHttpRequest('GET',r,{timeout:5e3,beforeSend:o}).then((function(t){var e=t.status,r=t.responseText;if(304===e)return i;var o=JSON.parse(r),a=t.getResponseHeader('etag');return a&&(o.etag=a.replace(/["]/g,''),n._configService.setLocalConfig(o,!0)),o})).catch((function(t){var e=n._constructError(t);return l.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 Yt(Dt,e)},e.addError=function(t){var e;this.throttleEvents(((e={})[Et]=t,e))},e.addTransaction=function(t){var e;this.throttleEvents(((e={})[xt]=t,e))},e.ndjsonErrors=function(t,e){var n=e?'e':'error';return t.map((function(t){var r;return ce.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:le(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 ce.stringify({metricset:t})})).join('')},e.ndjsonTransactions=function(t,e){var n=this,r=e?'x':'transaction';return t.map((function(t){var i,o='',a='';return e||(t.spans&&(o=t.spans.map((function(t){return ce.stringify({span:t})})).join(''),delete t.spans),t.breakdown&&(a=n.ndjsonMetricsets(t.breakdown),delete t.breakdown)),ce.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:le(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:le(t.context),k:he(t.marks),me:(e=t.breakdown,e.map((function(t){var e=t.span,n=t.samples;return{y:{t:e.type},sa:{ysc:{v:n['span.self_time.count'].value},yss:{v:n['span.self_time.sum.us'].value}}}}))),y:n,yc:{sd:n.length},sm:t.sampled,sr:t.sample_rate,o:t.outcome};if(t.experience){var i=t.experience,o=i.cls,a=i.fid,s=i.tbt,c=i.longtask;r.exp={cls:o,fid:a,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))+o+a}))},e.sendEvents=function(t){var e,n;if(0!==t.length){for(var r=[],i=[],o=0;o<t.length;o++){var a=t[o];a[xt]&&r.push(a[xt]),a[Et]&&i.push(a[Et])}if(0!==r.length||0!==i.length){var s=this._configService,c=((e={})[xt]=r,e[Et]=i,e),u=s.applyFilters(c);if(u){var f=s.get('apiVersion')>2,d=[],p=this.createMetaData(),l=f?'m':'metadata';d.push(ce.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 h=(d=d.concat(this.ndjsonErrors(u[Et],f),this.ndjsonTransactions(u[xt],f))).join(''),v=this.getEndpoints().intakeEndpoint;return this._postJson(v,h)}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}(),Ne=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+yt,e)},t}();function je(){return je=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},je.apply(this,arguments)}var Re,Fe=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,sendCredentials:!1},this.events=new Ne,this.filters=[],this.version=''}var e=t.prototype;return e.init=function(){var t,e=(t=function(t){if(!t)return{};for(var e={},n=/^data-([\w-]+)$/,r=t.attributes,i=0;i<r.length;i++){var o=r[i];n.test(o.nodeName)&&(e[o.nodeName.match(n)[1].split('-').map((function(t,e){return e>0?t.charAt(0).toUpperCase()+t.substring(1):t})).join('')]=o.value||o.nodeValue)}return e}(k()),t);this.setConfig(e)},e.setVersion=function(t){this.version=t},e.addFilter=function(t){if('function'!=typeof t)throw new Error('Argument to must be function');this.filters.push(t)},e.applyFilters=function(t){for(var e=0;e<this.filters.length;e++)if(!(t=this.filters[e](t)))return;return t},e.get=function(t){return t.split('.').reduce((function(t,e){return t&&t[e]}),this.config)},e.setUserContext=function(t){void 0===t&&(t={});var e={},n=t,r=n.id,i=n.username,o=n.email;'number'!=typeof r&&'string'!=typeof r||(e.id=r),'string'==typeof i&&(e.username=i),'string'==typeof o&&(e.email=o),this.config.context.user=L(this.config.context.user||{},e)},e.setCustomContext=function(t){void 0===t&&(t={}),this.config.context.custom=L(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 E(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(/\/+$/,'')),j(n)||(n<1e-4&&n>0&&(n=1e-4),t.transactionSampleRate=Math.round(1e4*n)/1e4),N(this.config,t),this.events.send(ct,[this.config])},e.validate=function(t){void 0===t&&(t={});var e=['serviceName','serverUrl'],n=Object.keys(this.config),r={missing:[],invalid:[],unknown:[]};Object.keys(t).forEach((function(i){-1===e.indexOf(i)||t[i]||r.missing.push(i),-1===n.indexOf(i)&&r.unknown.push(i)})),t.serviceName&&!/^[a-zA-Z0-9 _-]+$/.test(t.serviceName)&&r.invalid.push({key:'serviceName',value:t.serviceName,allowed:'a-z, A-Z, 0-9, _, -, <space>'});var i=t.transactionSampleRate;return void 0!==i&&('number'!=typeof i||isNaN(i)||i<0||i>1)&&r.invalid.push({key:'transactionSampleRate',value:i,allowed:'Number between 0 and 1'}),r},e.getLocalConfig=function(){var t=sessionStorage;this.config.session&&(t=localStorage);var e=t.getItem(_t);if(e)return JSON.parse(e)},e.setLocalConfig=function(t,e){if(t){if(e)t=je({},this.getLocalConfig(),t);var n=sessionStorage;this.config.session&&(n=localStorage),n.setItem(_t,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}(),Pe=function(){function t(t){void 0===t&&(t={}),this.levels=['trace','debug','info','warn','error'],this.level=t.level||'warn',this.prefix=t.prefix||'',this.resetLogMethods()}var e=t.prototype;return e.shouldLog=function(t){return this.levels.indexOf(t)>=this.levels.indexOf(this.level)},e.setLevel=function(t){t!==this.level&&(this.level=t,this.resetLogMethods())},e.resetLogMethods=function(){var t=this;this.levels.forEach((function(e){t[e]=t.shouldLog(e)?function(){var t=e;'trace'!==e&&'debug'!==e||(t='info');var n=arguments;if(n[0]=this.prefix+n[0],console){var r=console[t]||console.log;'function'==typeof r&&r.apply(console,n)}}:R}))},t}(),Ae=((Re={})[Ot]=function(){return new Fe},Re[It]=function(){return new Pe({prefix:'[Elastic APM] '})},Re[kt]=function(t){var e=t.getService([Ot,It]),n=e[0],r=e[1];return new Le(n,r)},Re),Me=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(Ot);t.init();var e=this.getService([It,kt]),n=e[0],r=e[1];t.events.observe(ct,(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 Ae[t]&&(this.instances[t]=Ae[t](this)),this.instances[t]):Array.isArray(t)?t.map((function(t){return e.getService(t)})):void 0},t}();function qe(t){var e=XMLHttpRequest.prototype;if(e&&e[W])var n='readystatechange',r='load',i='error',o=Ee(e,'open',(function(){return function(t,e){return t[xe]||(t[Ce]=e[0],t[Ie]=e[1],t[Oe]=!1===e[2]),o.apply(t,e)}})),a=Ee(e,'send',(function(){return function(e,o){if(e[xe])return a.apply(e,o);var c={source:pt,state:'',type:'macroTask',data:{target:e,method:e[Ce],sync:e[Oe],url:e[Ie],status:''}};try{return function(e){if(e.state!==X){e.state=X,t(X,e);var o=e.data.target;a(n),a(r),a("timeout"),a(i),a("abort")}function a(t){o[W](t,(function(t){var i=t.type;i===n?4===o.readyState&&0!==o.status&&s(e,'success'):s(e,i===r?'success':i)}))}}(c),a.apply(e,o)}catch(t){throw s(c,i),t}}}));function s(e,n){e.state!==G&&(e.state=G,e.data.status=n,t(G,e))}}function He(t){if(Se()){var e=window.fetch;window.fetch=function(i,o){var a,s,c=this,u=arguments,f=i instanceof URL;if('string'==typeof i||f)a=new Request(i,o),s=f?a.url:i;else{if(!i)return e.apply(c,u);s=(a=i).url}var d={source:lt,state:'',type:'macroTask',data:{target:a,method:a.method,url:s,aborted:!1}};return new l((function(i,o){var s;we.fetchInProgress=!0,function(e){e.state=X,t(X,e)}(d);try{s=e.apply(c,[a])}catch(t){return o(t),d.data.error=t,n(d),void(we.fetchInProgress=!1)}s.then((function(t){var e=t.clone?t.clone():{};i(t),H((function(){d.data.response=t;var i=e.body;i?function(t,e){var i=t.getReader();!function t(){i.read().then((function(r){r.done?n(e):t()}),(function(t){r(e,t)}))}()}(i,d):n(d)}))}),(function(t){o(t),H((function(){r(d,t)}))})),we.fetchInProgress=!1}))}}function n(e){e.state=G,t(G,e)}function r(t,e){t.data.aborted=function(t){return t&&'AbortError'===t.name}(e),t.data.error=e,n(t)}}var Be=new Ne,ze=!1;function De(){return ze||(ze=!0,qe((function(t,e){Be.send(pt,[t,e])})),He((function(t,e){Be.send(lt,[t,e])})),function(t){if(window.history){var e=history.pushState;'function'==typeof e&&(history.pushState=function(n,r,i){t(G,{source:ht,data:{state:n,title:r,url:i}}),e.apply(this,arguments)})}}((function(t,e){Be.send(ht,[t,e])}))),Be}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(st+yt,(function(t){var n=e.createTransactionPayload(t);n&&(e._apmServer.addTransaction(n),e._configService.dispatchEvent(ft))})),t[ht]&&Be.observe(ht,this.getHistorySub()),t[pt]&&Be.observe(pt,this.getXHRSub()),t[lt]&&Be.observe(lt,this.getFetchSub())},e.getHistorySub=function(){var t=this._transactionService;return function(e,n){n.source===ht&&e===G&&t.startTransaction(n.data.title,'route-change',{managed:!0,canReuse:!0})}},e.getXHRSub=function(){var t=this;return function(e,n){n.source!==pt||we.fetchInProgress||t.processAPICalls(e,n)}},e.getFetchSub=function(){var t=this;return function(e,n){n.source===lt&&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(t===X&&e.data){var o=e.data,a=new J(o.url),s=o.method+' '+(a.relative?a.path:O(a.href));r.getCurrentTransaction()||r.startTransaction(s,et,{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 J(window.location.href),p=w(a.origin,d.origin)||w(a.origin,f),l=o.target;if(u&&p&&l)this.injectDtHeader(c,l),n.get('propagateTracestate')&&this.injectTSHeader(c,l);o.sync&&(c.sync=o.sync),o.span=c}else if(t===G){var h=e.data;if(h&&h.span){var v,g,m=h.span,y=h.response,_=h.target;v=y?y.status:_.status,g='abort'==h.status||h.aborted?"unknown":v>=400||0==v?"failure":"success",m.outcome=g;var b=r.getCurrentTransaction();b&&b.type===et&&(b.outcome=g),r.endSpan(m,h)}}},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&&S(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&&S(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 Yt($t,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 Yt(Jt,r)},e.createTransactionPayload=function(t){var e=function(t){if(t.sampled){var e=t.spans.filter((function(e){return e.duration()>0&&e._start>=t._start&&e._end<=t._end}));if(t.isManaged()){var n=function(t,e,n){t.sort((function(t,e){return t._start-e._start}));var r=[],i=1;return t.forEach((function(o,a){if(0===r.length)r.push(o);else{var s=r[r.length-1],c=s.type===o.type&&s.subtype===o.subtype&&s.action===o.action&&s.name===o.name&&o.duration()/e<n&&(o._start-s._end)/e<n,u=t.length===a+1;c&&(i++,s._end=o._end),i>1&&(!c||u)&&(s.name=i+'x '+s.name,i=1),c||r.push(o)}})),r}(e,t.duration(),.05);t.spans=n}else t.spans=e}else t.resetFields();return t}(t);if(this.filterTransaction(e))return this.createTransactionDataModel(t);this._configService.dispatchEvent(dt)},t}(),Ve=function(){function t(t,e,n){void 0===n&&(n={}),t||(t=rt),e||(e=K),this.name=t,this.type=e,this.options=n,this.id=n.id||b(16),this.traceId=n.traceId,this.sampled=n.sampled,this.sampleRate=n.sampleRate,this.timestamp=n.timestamp,this._start=M(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 E(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(),N.apply(void 0,[this.context].concat(e)))},e.end=function(t){this.ended||(this.ended=!0,this._end=M(t),this.callOnEnd())},e.callOnEnd=function(){'function'==typeof this.onEnd&&this.onEnd(this)},e.duration=function(){return q(this._start,this._end)},t}();function $e(t,e){return $e=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},$e(t,e)}var Je=function(t){var e,n;function r(e,n,r){var i;if((i=t.call(this,e,n,r)||this).parentId=i.options.parentId,i.subtype=void 0,i.action=void 0,-1!==i.type.indexOf('.')){var o=i.type.split('.',3);i.type=o[0],i.subtype=o[1],i.action=o[2]}return i.sync=i.options.sync,i}return n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,$e(e,n),r.prototype.end=function(e,n){t.prototype.end.call(this,e),Bt(this,n)},r}(Ve),Xe=[['domainLookupStart','domainLookupEnd','DNS'],['connectStart','connectEnd','TCP'],['requestStart','responseStart','Request'],['responseStart','responseEnd','Response'],['domLoading','domComplete','Processing'],['loadEventStart','loadEventEnd','Load']];function Ge(t){return{value:t}}function We(t,e){var n=e.details,r=e.count,i=void 0===r?1:r,o=e.duration;return{transaction:t,span:n,samples:{'span.self_time.count':Ge(i),'span.self_time.sum.us':Ge(1e3*o)}}}function Ye(t,e){void 0===e&&(e=g.timing);var n=[],r=t.name,i=t.type,o=t.sampled,a={name:r,type:i};if(!o)return n;if(i===Q&&e)for(var s=0;s<Xe.length;s++){var c=Xe[s],u=q(e[c[0]],e[c[1]]);0!==u&&null!=u&&n.push(We(a,{details:{type:c[2]},duration:u}))}else{var f=function(t){var e={},n=function(t){var e=t.spans,n=t._start,r=t._end;if(0===e.length)return t.duration();e.sort((function(t,e){return t._start-e._start}));for(var i=e[0],o=i._end,a=i._start,s=o,c=a-n,u=1;u<e.length;u++)a=(i=e[u])._start,o=i._end,a>s?(c+=a-s,s=o):o>s&&(s=o);return s<r&&(c+=r-s),c}(t);e.app={count:1,duration:n};for(var r=t.spans,i=0;i<r.length;i++){var o=r[i],a=o.duration();if(0!==a&&null!=a){var s=o.type,c=o.subtype,u=s.replace(jt,'');c&&(u+='.'+c),e[u]||(e[u]={duration:0,count:0}),e[u].count++,e[u].duration+=a}}return e}(t);Object.keys(f).forEach((function(t){var e=t.split('.'),r=e[0],i=e[1],o=f[t],s=o.duration,c=o.count;n.push(We(a,{details:{type:r,subtype:i},duration:s,count:c}))}))}return n}function Ze(t,e){return Ze=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Ze(t,e)}var Qe=function(t){var e,n;function r(e,n,r){var i;return(i=t.call(this,e,n,r)||this).traceId=b(),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,Ze(e,n);var i=r.prototype;return i.addMarks=function(t){this.marks=N(this.marks||{},t)},i.mark=function(t){var e=F(t),n=A()-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&&A()-this._start<t},i.redefine=function(t,e,n){t&&(this.name=t),e&&(this.type=e),n&&(this.options.reuseThreshold=n.reuseThreshold,L(this.options,n))},i.startSpan=function(t,e,n){var r=this;if(!this.ended){var i=L({},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 o=new Je(t,e,i);return this._activeSpans[o.id]=o,i.blocking&&this.addTask(o.id),o}},i.isFinished=function(){return!this.blocked&&0===this._activeTasks.size},i.detectFinish=function(){this.isFinished()&&this.end()},i.end=function(t){if(!this.ended){for(var e in this.ended=!0,this._end=M(t),this._activeSpans){var n=this._activeSpans[e];n.type=n.type+jt,n.end(t)}this.callOnEnd()}},i.captureBreakdown=function(){this.breakdownTimings=Ye(this)},i.block=function(t){this.blocked=t,this.blocked||this.detectFinish()},i.addTask=function(t){return t||(t='task-'+b(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}(Ve);function Ke(){return Ke=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},Ke.apply(this,arguments)}var tn={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}},en=50;function nn(t,e){var n=e.isHardNavigation,r=e.trStart,i=t.getEntriesByType(bt).filter((function(t){return t.startTime>=r})),o=function(t,e){for(var n=[],r=0;r<t.length;r++){var i=t[r],o=i.name,a=i.startTime,s=i.duration,c=i.attribution,u=a+s,f=new Je("Longtask("+o+")",bt,{startTime:a});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,h=d.containerName,v=d.containerId,g={attribution:p,type:l};h&&(g.name=h),v&&(g.id=v),f.addContext({custom:g})}f.end(u),n.push(f)}return n}(i,tn.longtask),a={spans:o,marks:{}};if(!n)return a;var s=t.getEntriesByType(St),c=s[s.length-1];if(c){var u=parseInt(c.startTime);tn.lcp=u,a.marks.largestContentfulPaint=u}var f=g.timing,d=f.fetchStart-f.navigationStart;U(f)&&(d=0);var p=t.getEntriesByName("first-contentful-paint")[0];if(p){var l=parseInt(d>=0?p.startTime-d:p.startTime);tn.fcp=l,a.marks.firstContentfulPaint=l}var h=function(t){var e=t[0];if(e){var n=e.startTime,r=e.processingStart,i=new Je('First Input Delay',wt,{startTime:n});return i.end(r),i}}(t.getEntriesByType(wt));return h&&(tn.fid=h.duration(),a.spans.push(h)),function(t){t.forEach((function(t){var e=t.name,n=t.startTime,r=t.duration;if(!(n<tn.fcp||'self'!==e&&-1===e.indexOf('same-origin'))){tn.tbt.start=Math.min(tn.tbt.start,n);var i=r-en;i>0&&(tn.tbt.duration+=i)}}))}(i),function(t){t.forEach((function(t){!t.hadRecentInput&&t.value&&((t.startTime-tn.cls.firstEntryTime>5e3||t.startTime-tn.cls.prevEntryTime>1e3)&&(tn.cls.firstEntryTime=t.startTime,tn.cls.currentSessionScore=0),tn.cls.prevEntryTime=t.startTime,tn.cls.currentSessionScore+=t.value,tn.cls.score=Math.max(tn.cls.score,tn.cls.currentSessionScore))}))}(t.getEntriesByType(Tt)),a}var rn=function(){function t(t){this.po={observe:R,disconnect:R},window.PerformanceObserver&&(this.po=new PerformanceObserver(t))}var e=t.prototype;return e.start=function(t,e){void 0===e&&(e={buffered:!0});try{if(!z(t))return;this.po.observe(Ke({type:t},e))}catch(t){}},e.stop=function(){this.po.disconnect()},t}();function on(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<Z&&t-i<Z&&e-i<Z}var an=[['redirectStart','redirectEnd','Redirect'],['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 sn(t){var e=t.name,n=t.initiatorType,r=t.startTime,i=t.responseEnd,o='resource';n&&(o+='.'+n);var a=O(e),s=new Je(a,o);return s._start=r,s.end(i,{url:e,entry:t}),s}function cn(t,e){return null!=e&&t>e}function un(t){if(t.captureTimings){var e=t._end;if(t.type===Q){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=g.timing;(function(t,e,n,r){for(var i=[],o=0;o<an.length;o++){var a=t[an[o][0]],s=t[an[o][1]];if(on(a,s,n,r,e)){var c=new Je(an[o][2],'hard-navigation.browser-timing'),u=null;'requestStart'===an[o][0]&&(c.pageResponse=!0,u={url:location.origin}),c._start=a-e,c.end(s-e,u),i.push(c)}}return i})(r,U(r)?r.redirectStart: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(de(r))}if(B()){var i=t._start;(function(t,e,n,r){for(var i=[],o=0;o<t.length;o++){var a=t[o],s=a.initiatorType,c=a.name,u=a.startTime,f=a.responseEnd;-1!==Y.indexOf(s)&&null!=c&&(('xmlhttprequest'===s||'fetch'===s)&&(/intake\/v\d+\/rum\/events/.test(c)||cn(u,e))||on(u,f,n,r)&&i.push(sn(t[o])))}return i})(g.getEntriesByType("resource"),me.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 o=t[i],a=o.name,s=o.startTime,c=o.duration,u=s+c;if(!(c<=at)&&on(s,u,e,n)){var f=new Je(a,'app');f._start=s,f.end(u),r.push(f)}}return r}(g.getEntriesByType("measure"),i,e).forEach((function(e){return t.spans.push(e)}))}}else t.type===Q&&(t._start=0)}var fn=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 rn((function(t){var e=n.getCurrentTransaction();if(e&&e.captureTimings){var r,i=e.type===Q,o=nn(t,{isHardNavigation:i,trStart:i?0:e._start}),a=o.spans,s=o.marks;(r=e.spans).push.apply(r,a),e.addMarks({agent:s})}}))}var e=t.prototype;return e.createCurrentTransaction=function(t,e,n){var r=new Qe(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=L({transactionSampleRate:e.transactionSampleRate},t);return n.managed&&(n=L({pageLoadTraceId:e.pageLoadTraceId,pageLoadSampled:e.pageLoadSampled,pageLoadSpanId:e.pageLoadSpanId,pageLoadTransactionName:e.pageLoadTransactionName},n)),n},e.startManagedTransaction=function(t,e,n){var r=this.getCurrentTransaction(),i=!1;if(r)if(r.canReuse()&&n.canReuse){var o=r.type,a=ot.indexOf(r.type),s=ot.indexOf(e);a>=0&&s<a&&(o=e),r.redefine(t,o,n),i=!0}else r.end(),r=this.createCurrentTransaction(t,e,n);else r=this.createCurrentTransaction(t,e,n);return r.type===Q&&(i||(this.recorder.start(St),this.recorder.start("paint"),this.recorder.start(wt),this.recorder.start(Tt)),n.pageLoadTraceId&&(r.traceId=n.pageLoadTraceId),n.pageLoadSampled&&(r.sampled=n.pageLoadSampled),r.name===rt&&n.pageLoadTransactionName&&(r.name=n.pageLoadTransactionName)),!i&&this._config.get('monitorLongtasks')&&this.recorder.start(bt),r.sampled&&(r.captureTimings=!0),r},e.startTransaction=function(t,e,n){var r,i=this,o=this.createOptions(n),a=!0;o.managed?this.currentTransaction===(r=this.startManagedTransaction(t,e,o))&&(a=!1):r=new Qe(t,e,o);return r.onEnd=function(){return i.handleTransactionEnd(r)},a&&this._config.events.send("transaction:start",[r]),r},e.handleTransactionEnd=function(t){var e=this;this.recorder.stop();var n=window.location.href;return l.resolve().then((function(){var r=t.name,i=t.type;if(me.lastHiddenStart>=t._start)e._config.dispatchEvent(dt);else if(e.shouldIgnoreTransaction(r)||i===nt)e._config.dispatchEvent(dt);else{if(i===Q){var o=e._config.get('pageLoadTransactionName');if(r===rt&&o&&(t.name=o),t.captureTimings){var a=tn.cls,s=tn.fid,c=tn.tbt,u=tn.longtask;c.duration>0&&t.spans.push((d=(f=c).start,p=f.duration,(l=new Je('Total Blocking Time',bt,{startTime:d})).end(d+p),l)),t.experience={},z(bt)&&(t.experience.tbt=c.duration),z(Tt)&&(t.experience.cls=a.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;t.name===rt&&(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('/'),o=':id',a=/\W|_/g,s=/[0-9]/g,c=/[a-z]/g,u=/[A-Z]/g,f=[],d=!1,p=0;p<i.length;p++){var l=i[p];if(d||p>e-1){l&&f.push("*");break}if((l.match(a)||[]).length>=2)f.push(o),d=!0;else{var h=(l.match(s)||[]).length;if(h>3||l.length>3&&h/l.length>=.3)f.push(o),d=!0;else{var v=(l.match(u)||[]).length,g=(l.match(c)||[]).length/l.length,m=v/l.length;l.length>5&&(m>.3&&m<.6||g>.3&&g<.6)?(f.push(o),d=!0):l&&f.push(l)}}}return'/'+(f.length>=2?f.join('/'):f.join(''))+(r?'?{query}':'')}(n)),un(t),e.adjustTransactionTime(t),e._config.get('breakdownMetrics')&&t.captureBreakdown();var h=e._config.get('context');zt(t,h),e._config.events.send(st,[t])}}),(function(t){}))},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:b(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 P(t,(function(t){return-1===String(t).indexOf('external')}))}(e)||{},i=r._end||0;if(t.type===Q){var o=t._end-1e3,a=tn.lcp||0,s=function(t){return P(t,(function(t){return-1!==String(t).indexOf('external')}))}(e)||{},c=s._end||0;t._end=Math.max(i,c,a,o)}else i>t._end&&(t._end=i);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+=jt),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();return r||(r=this.createCurrentTransaction(void 0,nt,this.createOptions({canReuse:!0,managed:!0}))),r.startSpan(t,e,n)},e.endSpan=function(t,e){t&&t.end(null,e)},t}(),dn=40,pn=10,ln={minInteractionId:1/0,maxInteractionId:0,interactionCount:0,longestInteractions:[]};function hn(t){t.getEntries().forEach((function(t){t.interactionId&&(function(t){if(D())return;ln.minInteractionId=Math.min(ln.minInteractionId,t.interactionId),ln.maxInteractionId=Math.max(ln.maxInteractionId,t.interactionId),ln.interactionCount=(ln.maxInteractionId-ln.minInteractionId)/7+1}(t),t.duration<dn||function(t){var e=ln.longestInteractions[ln.longestInteractions.length-1];if(void 0!==e&&t.duration<=e.duration&&t.interactionId!=e.id)return;var n=ln.longestInteractions.filter((function(e){return e.id===t.interactionId}));if(n.length>0){var r=n[0];r.duration=Math.max(r.duration,t.duration)}else ln.longestInteractions.push({id:t.interactionId,duration:t.duration});ln.longestInteractions.sort((function(t,e){return e.duration-t.duration})),ln.longestInteractions.splice(pn)}(t))}))}function vn(){return performance.interactionCount||ln.interactionCount}function gn(t){var e=function(){if(0===ln.longestInteractions.length)return vn()>0?0:void 0;var t=Math.min(ln.longestInteractions.length-1,Math.floor(vn()/50));return ln.longestInteractions[t].duration}();if(e>=0){var n=A(),r=t.startTransaction(it,it,{startTime:n}),i=performance.getEntriesByType('navigation');if(i.length>0){var o=i[0].name;r.addContext({page:{url:o}})}r.addLabels({inp_value:e});var a=n+e+1;return r.end(a),ln.minInteractionId=1/0,ln.maxInteractionId=0,ln.interactionCount=0,ln.longestInteractions=[],r}}function mn(t,e){if(gn(e))var n=t.observeEvent(ft,(function(){yn(t,e),n()}));else yn(t,e)}function yn(t,e){var n=e.getCurrentTransaction();if(n){var r=t.observeEvent(dt,(function(){me.lastHiddenStart=A(),r(),i()})),i=t.observeEvent(ft,(function(){t.dispatchEvent(ut),me.lastHiddenStart=A(),i(),r()}));n.end()}else t.dispatchEvent(ut),me.lastHiddenStart=A()}var _n='a[data-transaction-name], button[data-transaction-name]';function bn(t){var e=function(e){e.target instanceof Element&&function(t,e){var n=function(t){var e={transactionName:null,context:null};e.transactionName=function(t){var e=function(t){var e='data-transaction-name',n=t.getAttribute(e);if(t.closest){var r=t.closest(_n);return r?r.getAttribute(e):n}return n}(t);if(e)return e;var n=t.tagName.toLowerCase(),r=t.getAttribute('name');if(r)return n+"[\""+r+"\"]";return n}(t);var n=t.getAttribute('class');n&&(e.context={custom:{classes:n}});return e}(e),r=n.transactionName,i=n.context,o=t.startTransaction("Click - "+r,tt,{managed:!0,canReuse:!0,reuseThreshold:300});o&&i&&o.addContext(i)}(t,e.target)},n='click';return window.addEventListener(n,e,true),function(){window.removeEventListener(n,e,true)}}var Sn=!1;function wn(){return T()?(De(),me.bootstrapTime=A(),Sn=!0):v&&console.log('[Elastic APM] platform is not supported!'),Sn}var Tn={},En={},xn={};Object.defineProperty(xn,"__esModule",{value:!0}),xn.FORMAT_BINARY='binary';var On=xn.FORMAT_TEXT_MAP='text_map',In=xn.FORMAT_HTTP_HEADERS='http_headers',Cn=xn.REFERENCE_CHILD_OF='child_of';xn.REFERENCE_FOLLOWS_FROM='follows_from';var kn={},Ln={},Nn={},jn={};Object.defineProperty(jn,"__esModule",{value:!0});var Rn,Fn,Pn,An,Mn,qn=function(){function t(){}return t.prototype.toTraceId=function(){return''},t.prototype.toSpanId=function(){return''},t}();function Hn(){if(Rn)return Nn;Rn=1,Object.defineProperty(Nn,"__esModule",{value:!0});var t=Bn(),e=jn,n=Dn();return Nn.tracer=null,Nn.spanContext=null,Nn.span=null,Nn.initialize=function(){Nn.tracer=new n.default,Nn.span=new t.default,Nn.spanContext=new e.default},Nn}function Bn(){if(Fn)return Ln;Fn=1,Object.defineProperty(Ln,"__esModule",{value:!0});var t=Hn(),e=function(){function e(){}return e.prototype.context=function(){return this._context()},e.prototype.tracer=function(){return this._tracer()},e.prototype.setOperationName=function(t){return this._setOperationName(t),this},e.prototype.setBaggageItem=function(t,e){return this._setBaggageItem(t,e),this},e.prototype.getBaggageItem=function(t){return this._getBaggageItem(t)},e.prototype.setTag=function(t,e){var n;return this._addTags(((n={})[t]=e,n)),this},e.prototype.addTags=function(t){return this._addTags(t),this},e.prototype.log=function(t,e){return this._log(t,e),this},e.prototype.logEvent=function(t,e){return this._log({event:t,payload:e})},e.prototype.finish=function(t){this._finish(t)},e.prototype._context=function(){return t.spanContext},e.prototype._tracer=function(){return t.tracer},e.prototype._setOperationName=function(t){},e.prototype._setBaggageItem=function(t,e){},e.prototype._getBaggageItem=function(t){},e.prototype._addTags=function(t){},e.prototype._log=function(t,e){},e.prototype._finish=function(t){},e}();return Ln.Span=e,Ln.default=e,Ln}function zn(){if(An)return En;An=1,Object.defineProperty(En,"__esModule",{value:!0});var t=xn,e=function(){if(Pn)return kn;Pn=1,Object.defineProperty(kn,"__esModule",{value:!0});var t=Bn(),e=function(){function e(e,n){this._type=e,this._referencedContext=n instanceof t.default?n.context():n}return e.prototype.type=function(){return this._type},e.prototype.referencedContext=function(){return this._referencedContext},e}();return kn.default=e,kn}(),n=Bn();return En.childOf=function(r){return r instanceof n.default&&(r=r.context()),new e.default(t.REFERENCE_CHILD_OF,r)},En.followsFrom=function(r){return r instanceof n.default&&(r=r.context()),new e.default(t.REFERENCE_FOLLOWS_FROM,r)},En}function Dn(){if(Mn)return Tn;Mn=1,Object.defineProperty(Tn,"__esModule",{value:!0});var t=zn(),e=Hn(),n=Bn(),r=function(){function r(){}return r.prototype.startSpan=function(e,n){if(void 0===n&&(n={}),n.childOf){var r=t.childOf(n.childOf);n.references?n.references.push(r):n.references=[r],delete n.childOf}return this._startSpan(e,n)},r.prototype.inject=function(t,e,r){return t instanceof n.default&&(t=t.context()),this._inject(t,e,r)},r.prototype.extract=function(t,e){return this._extract(t,e)},r.prototype._startSpan=function(t,n){return e.span},r.prototype._inject=function(t,e,n){},r.prototype._extract=function(t,n){return e.spanContext},r}();return Tn.Tracer=r,Tn.default=r,Tn}jn.SpanContext=qn,jn.default=qn;var Un=Dn(),Vn=Bn();function $n(t,e){return $n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},$n(t,e)}var Jn=function(t){var e,n;function r(e,n){var r;return(r=t.call(this)||this).__tracer=e,r.span=n,r.isTransaction=n instanceof Qe,r.spanContext={id:n.id,traceId:n.traceId,sampled:n.sampled},r}n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,$n(e,n);var i=r.prototype;return i._context=function(){return this.spanContext},i._tracer=function(){return this.__tracer},i._setOperationName=function(t){this.span.name=t},i._addTags=function(t){var e=L({},t);if(e.type&&(this.span.type=e.type,delete e.type),this.isTransaction){var n=e['user.id'],r=e['user.username'],i=e['user.email'];(n||r||i)&&(this.span.addContext({user:{id:n,username:r,email:i}}),delete e['user.id'],delete e['user.username'],delete e['user.email'])}this.span.addLabels(e)},i._log=function(t,e){'error'===t.event&&(t['error.object']?this.__tracer.errorLogging.logError(t['error.object']):t.message&&this.__tracer.errorLogging.logError(t.message))},i._finish=function(t){this.span.end(),t&&(this.span._end=t-x())},r}(Vn.Span);function Xn(t,e){return Xn=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Xn(t,e)}function Gn(){return Ae[Ct]=function(t){var e=t.getService([It,Ot]),n=e[0],r=e[1];return new fn(n,r)},Ae[Lt]=function(t){var e=t.getService([kt,Ot,It,Ct]),n=e[0],r=e[1],i=e[2],o=e[3];return new Ue(n,r,i,o)},Ae[Nt]=function(t){var e=t.getService([kt,Ot,Ct]),n=e[0],r=e[1],i=e[2];return new ae(n,r,i)},new Me}!function(t){var e,n;function r(e,n,r,i){var o;return(o=t.call(this)||this).performanceMonitoring=e,o.transactionService=n,o.loggingService=r,o.errorLogging=i,o}n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,Xn(e,n);var i=r.prototype;i._startSpan=function(t,e){var n,r={managed:!0};if(e)if(r.timestamp=e.startTime,e.childOf)r.parentId=e.childOf.id;else if(e.references&&e.references.length>0){e.references.length;var i=function(t,e,n){if(null==t)throw new TypeError('array is null or not defined');var r=Object(t),i=r.length>>>0;if('function'!=typeof e)throw new TypeError('predicate must be a function');for(var o=0;o<i;){var a=r[o];if(e.call(n,a,o,r))return a;o++}}(e.references,(function(t){return t.type()===Cn}));i&&(r.parentId=i.referencedContext().id)}if(!(n=this.transactionService.getCurrentTransaction()?this.transactionService.startSpan(t,void 0,r):this.transactionService.startTransaction(t,void 0,r)))return new Vn.Span;r.timestamp&&(n._start=r.timestamp-x());var o=new Jn(this,n);return e&&e.tags&&o.addTags(e.tags),o},i._inject=function(t,e,n){switch(e){case On:case In:this.performanceMonitoring.injectDtHeader(t,n)}},i._extract=function(t,e){var n;switch(t){case On:case In:n=this.performanceMonitoring.extractDtHeader(e)}return n||(n=null),n}}(Un.Tracer);var Wn=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(Ot);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([Ot,It,Ct]),r=n[0],i=n[1],o=n[2];r.setVersion('5.16.1'),this.config(t);var a=r.get('logLevel');if(i.setLevel(a),r.get('active')){this.serviceFactory.init();var s=function(t,e){var n,r=((n={})[pt]=!1,n[lt]=!1,n[ht]=!1,n[Q]=!1,n[mt]=!1,n[vt]=!1,n[gt]=!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(Lt).init(s),s[mt])this.serviceFactory.getService(Nt).registerListeners();if(r.get('session')){var c=r.getLocalConfig();c&&c.session&&r.setConfig({session:c.session})}var u=function(){return s[Q]&&e._sendPageLoadMetrics()};r.get('centralConfig')?this.fetchCentralConfig().then(u):u(),function(t,e){'hidden'===document.visibilityState&&(me.lastHiddenStart=0);var n=function(){'hidden'===document.visibilityState&&mn(t,e)},r=function(){return mn(t,e)},i=!0;window.addEventListener('visibilitychange',n,i),window.addEventListener('pagehide',r,i)}(r,o),s[vt]&&s[gt]&&bn(o),function(t){void 0===t&&(t=new rn(hn));var e=D(),n=e?dn:16;t.start("event",{buffered:!0,durationThreshold:n}),e||t.start(wt)}()}else this._disable=!0,i.warn('RUM agent is inactive')}return this},e.fetchCentralConfig=function(){var t=this.serviceFactory.getService([kt,It,Ot]),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)},o=r.validate(i).invalid;if(0===o.length)r.setConfig(i);else{var a=o[0],s=a.key,c=a.value,u=a.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,Q,{managed:!0,canReuse:!0});if(t){t.addTask(Q);var e=function(){setTimeout((function(){return t.removeTask(Q)}),1e3)};'complete'===document.readyState?e():window.addEventListener('load',e)}},e.observe=function(t,e){this.serviceFactory.getService(Ot).events.observe(t,e)},e.config=function(t){var e=this.serviceFactory.getService([Ot,It]),n=e[0],r=e[1],i=n.validate(t),o=i.missing,a=i.invalid,s=i.unknown;if(s.length>0){var c='Unknown config options are specified for RUM agent: '+s.join(', ');r.warn(c)}if(0===o.length&&0===a.length)n.setConfig(t);else{var u=', ',f="RUM agent isn't correctly configured. ";o.length>0&&(f+=o.join(u)+' is missing',a.length>0&&(f+=u)),a.forEach((function(t,e){var n=t.key,r=t.value,i=t.allowed;f+=n+" \""+r+"\" contains invalid characters! (allowed: "+i+")"+(e!==a.length-1?u:'')})),r.error(f),n.setConfig({active:!1})}},e.setUserContext=function(t){this.serviceFactory.getService(Ot).setUserContext(t)},e.setCustomContext=function(t){this.serviceFactory.getService(Ot).setCustomContext(t)},e.addLabels=function(t){this.serviceFactory.getService(Ot).addLabels(t)},e.setInitialPageLoadName=function(t){this.serviceFactory.getService(Ot).setConfig({pageLoadTransactionName:t})},e.startTransaction=function(t,e,n){if(this.isEnabled())return this.serviceFactory.getService(Ct).startTransaction(t,e,n)},e.startSpan=function(t,e,n){if(this.isEnabled())return this.serviceFactory.getService(Ct).startSpan(t,e,n)},e.getCurrentTransaction=function(){if(this.isEnabled())return this.serviceFactory.getService(Ct).getCurrentTransaction()},e.captureError=function(t){if(this.isEnabled())return this.serviceFactory.getService(Nt).logError(t)},e.addFilter=function(t){this.serviceFactory.getService(Ot).addFilter(t)},t}();var Yn=function(){if(v&&window.elasticApm)return window.elasticApm;var t=wn(),e=Gn(),n=new Wn(e,!t);return v&&(window.elasticApm=n),n}();Yn.init.bind(Yn)}();
