UNPKG

@grafana/faro-web-sdk

Version:

Faro instrumentations, metas, transports for web.

1 lines 93.9 kB
var GrafanaFaroWebSdk=function(e){"use strict";class t{constructor(e,t){var i,n;this.signalBuffer=[],this.itemLimit=null!==(i=null==t?void 0:t.itemLimit)&&void 0!==i?i:50,this.sendTimeout=null!==(n=null==t?void 0:t.sendTimeout)&&void 0!==n?n:250,this.paused=(null==t?void 0:t.paused)||!1,this.sendFn=e,this.flushInterval=-1,this.paused||this.start(),document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&this.flush()})}addItem(e){this.paused||(this.signalBuffer.push(e),this.signalBuffer.length>=this.itemLimit&&this.flush())}start(){this.paused=!1,this.sendTimeout>0&&(this.flushInterval=window.setInterval(()=>this.flush(),this.sendTimeout))}pause(){this.paused=!0,clearInterval(this.flushInterval)}groupItems(e){const t=new Map;return e.forEach(e=>{const i=JSON.stringify(e.meta);let n=t.get(i);n=void 0===n?[e]:[...n,e],t.set(i,n)}),Array.from(t.values())}flush(){if(this.paused||0===this.signalBuffer.length)return;this.groupItems(this.signalBuffer).forEach(this.sendFn),this.signalBuffer=[]}}var i;e.TransportItemType=void 0,(i=e.TransportItemType||(e.TransportItemType={})).EXCEPTION="exception",i.LOG="log",i.MEASUREMENT="measurement",i.TRACE="trace",i.EVENT="event";const n={[e.TransportItemType.EXCEPTION]:"exceptions",[e.TransportItemType.LOG]:"logs",[e.TransportItemType.MEASUREMENT]:"measurements",[e.TransportItemType.TRACE]:"traces",[e.TransportItemType.EVENT]:"events"};function s(e,i,n,s){var o;i.debug("Initializing transports");const a=[];let l=n.paused,u=[];const c=e=>{let t=e;for(const e of u){const i=t.map(e).filter(Boolean);if(0===i.length)return[];t=r(i,n)}return t},d=e=>{const t=c(e);if(0!==t.length)for(const e of a)i.debug(`Transporting item using ${e.name}\n`,t),e.isBatched()&&e.send(t)};let p;(null===(o=n.batching)||void 0===o?void 0:o.enabled)&&(p=new t(d,{sendTimeout:n.batching.sendTimeout,itemLimit:n.batching.itemLimit,paused:l}));return{add:(...t)=>{i.debug("Adding transports"),t.forEach(t=>{i.debug(`Adding "${t.name}" transport`);a.some(e=>e===t)?i.warn(`Transport ${t.name} is already added`):(t.unpatchedConsole=e,t.internalLogger=i,t.config=n,t.metas=s,a.push(t))})},addBeforeSendHooks:(...e)=>{i.debug("Adding beforeSendHooks\n",u),e.forEach(e=>{e&&u.push(e)})},getBeforeSendHooks:()=>[...u],execute:e=>{var t;l||((null===(t=n.batching)||void 0===t?void 0:t.enabled)&&(null==p||p.addItem(e)),(e=>{var t,s;if((null===(t=n.batching)||void 0===t?void 0:t.enabled)&&a.every(e=>e.isBatched()))return;const[r]=c([e]);if(void 0!==r)for(const e of a)i.debug(`Transporting item using ${e.name}\n`,r),e.isBatched()?(null===(s=n.batching)||void 0===s?void 0:s.enabled)||e.send([r]):e.send(r)})(e))},isPaused:()=>l,pause:()=>{i.debug("Pausing transports"),null==p||p.pause(),l=!0},remove:(...e)=>{i.debug("Removing transports"),e.forEach(e=>{i.debug(`Removing "${e.name}" transport`);const t=a.indexOf(e);-1!==t?a.splice(t,1):i.warn(`Transport "${e.name}" is not added`)})},removeBeforeSendHooks:(...e)=>{u.filter(t=>!e.includes(t))},get transports(){return[...a]},unpause:()=>{i.debug("Unpausing transports"),null==p||p.start(),l=!1}}}function r(t,i){if(i.preserveOriginalError)for(const i of t)i.type===e.TransportItemType.EXCEPTION&&delete i.payload.originalError;return t}function o(e,t){return typeof e===t}function a(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}function l(e,t){try{return e instanceof t}catch(e){return!1}}const u=e=>o(e,"null"),c=e=>o(e,"string"),d=e=>o(e,"number")&&!isNaN(e)||o(e,"bigint"),p=e=>o(e,"boolean"),g=e=>!u(e)&&o(e,"object"),h=e=>o(e,"function"),f=e=>a(e,"Array"),m=e=>!g(e)&&!h(e),v="undefined"!=typeof Event,b=e=>v&&l(e,Event),w="undefined"!=typeof Error,y=e=>w&&l(e,Error),S=e=>a(e,"ErrorEvent"),T=e=>a(e,"DOMError"),E=e=>a(e,"DOMException"),k="undefined"!=typeof Element,I="undefined"!=typeof Map;function x(e){return null==e||(f(e)||c(e)?0===e.length:!!g(e)&&0===Object.keys(e).length)}function O(e,t){if(e===t)return!0;if(o(e,"number")&&isNaN(e))return o(t,"number")&&isNaN(t);const i=f(e),n=f(t);if(i!==n)return!1;if(i&&n){const i=e.length;if(i!==t.length)return!1;for(let n=i;0!==n--;)if(!O(e[n],t[n]))return!1;return!0}const s=g(e),r=g(t);if(s!==r)return!1;if(e&&t&&s&&r){const i=Object.keys(e),n=Object.keys(t);if(i.length!==n.length)return!1;for(let e of i)if(!n.includes(e))return!1;for(let n of i)if(!O(e[n],t[n]))return!1;return!0}return!1}function A(){return Date.now()}function L(){return"undefined"!=typeof performance&&"function"==typeof performance.now?performance.now():Date.now()}function _(){return(new Date).toISOString()}function U(e){return new Date(e).toISOString()}var C;e.LogLevel=void 0,(C=e.LogLevel||(e.LogLevel={})).TRACE="trace",C.DEBUG="debug",C.INFO="info",C.LOG="log",C.WARN="warn",C.ERROR="error";const j=e.LogLevel.LOG,M=[e.LogLevel.TRACE,e.LogLevel.DEBUG,e.LogLevel.INFO,e.LogLevel.LOG,e.LogLevel.WARN,e.LogLevel.ERROR];function P(){}function N(e){const{size:t,concurrency:i}=e,n=[];let s=0;const r=()=>{if(s<i&&n.length){const{producer:e,resolve:t,reject:i}=n.shift();s++,e().then(e=>{s--,r(),t(e)},e=>{s--,r(),i(e)})}};return{add:e=>{if(n.length+s>=t)throw new Error("Task buffer full");return new Promise((t,i)=>{n.push({producer:e,resolve:t,reject:i}),r()})}}}const D="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789";function R(e=10){const t=new Uint32Array(e),i="undefined"!=typeof globalThis?globalThis.crypto:void 0;if(null==i?void 0:i.getRandomValues)i.getRandomValues(t);else for(let i=0;i<e;i++)t[i]=Math.floor(4294967296*Math.random());let n="";for(let i=0;i<e;i++)n+=D[t[i]%59];return n}const z="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof self?self:void 0;function B(e){const t=`__faroBundleId_${e}`,i=null==z?void 0:z[t];if("string"==typeof i&&""!==i)return i;const n="undefined"!=typeof window?window[t]:void 0;return"string"==typeof n&&""!==n?n:void 0}function q(e={}){return JSON.stringify(null!=e?e:{},function(){const e=new WeakSet;return function(t,i){if(g(i)&&null!==i){if(e.has(i))return null;e.add(i)}return i}}())}function F(e={}){const t={};for(const[i,n]of Object.entries(e))t[i]=g(n)&&null!==n?q(n):String(n);return t}class V{constructor(){this.subscribers=[]}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>this.unsubscribe(e)}}unsubscribe(e){this.subscribers=this.subscribers.filter(t=>t!==e)}notify(e){this.subscribers.forEach(t=>t(e))}first(){const e=new V,t=t=>{e.notify(t),i.unsubscribe()},i=this.subscribe(t),n=e.unsubscribe.bind(e);return this.withUnsubscribeOverride(e,n,t)}takeWhile(e){const t=new V,i=n=>{e(n)?t.notify(n):t.unsubscribe(i)};this.subscribe(i);const n=t.unsubscribe.bind(t);return this.withUnsubscribeOverride(t,n,i)}filter(e){const t=new V,i=i=>{e(i)&&t.notify(i)};this.subscribe(i);const n=t.unsubscribe.bind(t);return this.withUnsubscribeOverride(t,n,i)}merge(...e){const t=new V,i=[];e.forEach(e=>{const n=e.subscribe(e=>{t.notify(e)});i.push(n)});const n=t.unsubscribeAll.bind(t);return t.unsubscribe=()=>{i.forEach(e=>e.unsubscribe()),n()},t}withUnsubscribeOverride(e,t,i){return e.unsubscribe=e=>{t(e),this.unsubscribe(i)},e}unsubscribeAll(){this.subscribers=[]}}var $;e.InternalLoggerLevel=void 0,($=e.InternalLoggerLevel||(e.InternalLoggerLevel={}))[$.OFF=0]="OFF",$[$.ERROR=1]="ERROR",$[$.WARN=2]="WARN",$[$.INFO=3]="INFO",$[$.VERBOSE=4]="VERBOSE";const H={debug:P,error:P,info:P,prefix:"Faro",warn:P},G=e.InternalLoggerLevel.ERROR,W=Object.assign({},console);let K=W;function X(e){var t;return K=null!==(t=e.unpatchedConsole)&&void 0!==t?t:K,K}function J(t=W,i=G){const n=H;return i>e.InternalLoggerLevel.OFF&&(n.error=i>=e.InternalLoggerLevel.ERROR?function(...e){t.error(`${n.prefix}\n`,...e)}:P,n.warn=i>=e.InternalLoggerLevel.WARN?function(...e){t.warn(`${n.prefix}\n`,...e)}:P,n.info=i>=e.InternalLoggerLevel.INFO?function(...e){t.info(`${n.prefix}\n`,...e)}:P,n.debug=i>=e.InternalLoggerLevel.VERBOSE?function(...e){t.debug(`${n.prefix}\n`,...e)}:P),n}let Z=H;function Y(e,t){return Z=J(e,t.internalLoggerLevel),Z}class Q{constructor(){this.unpatchedConsole=W,this.internalLogger=H,this.config={},this.metas={}}logDebug(...e){this.internalLogger.debug(`${this.name}\n`,...e)}logInfo(...e){this.internalLogger.info(`${this.name}\n`,...e)}logWarn(...e){this.internalLogger.warn(`${this.name}\n`,...e)}logError(...e){this.internalLogger.error(`${this.name}\n`,...e)}}class ee extends Q{isBatched(){return!1}getIgnoreUrls(){return[]}}function te(e,t){var i,n;if(void 0===t)return e;if(void 0===e)return{resourceSpans:t};const s=null===(i=e.resourceSpans)||void 0===i?void 0:i[0];if(void 0===s)return e;const r=(null==s?void 0:s.scopeSpans)||[],o=(null===(n=null==t?void 0:t[0])||void 0===n?void 0:n.scopeSpans)||[];return Object.assign(Object.assign({},e),{resourceSpans:[Object.assign(Object.assign({},s),{scopeSpans:[...r,...o]})]})}function ie(t){let i={meta:{}};return void 0!==t[0]&&(i.meta=t[0].meta),t.forEach(t=>{switch(t.type){case e.TransportItemType.LOG:case e.TransportItemType.EVENT:case e.TransportItemType.EXCEPTION:case e.TransportItemType.MEASUREMENT:{const e=n[t.type],s=i[e];i=Object.assign(Object.assign({},i),{[e]:void 0===s?[t.payload]:[...s,t.payload]});break}case e.TransportItemType.TRACE:i=Object.assign(Object.assign({},i),{traces:te(i.traces,t.payload.resourceSpans)})}}),i}const ne="normal";var se;e.UserActionState=void 0,(se=e.UserActionState||(e.UserActionState={}))[se.Started=0]="Started",se[se.Halted=1]="Halted",se[se.Cancelled=2]="Cancelled",se[se.Ended=3]="Ended";class re{constructor(){this.buffer=[]}addItem(e){this.buffer.push(e)}flushBuffer(e){if(h(e))for(const t of this.buffer)e(t);this.buffer.length=0}size(){return this.buffer.length}}class oe extends V{constructor({name:t,parentId:i,trigger:n,transports:s,attributes:r,trackUserActionsExcludeItem:o,importance:a=ne,pushEvent:l}){super(),this.name=t,this.attributes=r,this.id=R(),this.trigger=n,this.parentId=null!=i?i:this.id,this.trackUserActionsExcludeItem=o,this.importance=a,this._pushEvent=l,this._itemBuffer=new re,this._transports=s,this._state=e.UserActionState.Started,this._start()}addItem(t){return this._state===e.UserActionState.Started&&(this._itemBuffer.addItem(t),!0)}_start(){this._state=e.UserActionState.Started,this._state===e.UserActionState.Started&&(this.startTime=A(),this._startTimeMono=L())}halt(){this._state===e.UserActionState.Started&&(this._state=e.UserActionState.Halted,this.notify(this._state))}cancel(){this._state===e.UserActionState.Started&&this._itemBuffer.flushBuffer(e=>{this._transports.execute(e)}),this._state=e.UserActionState.Cancelled,this.notify(this._state)}end(){if(this._state===e.UserActionState.Cancelled)return;const t=A(),i=L()-this._startTimeMono;this._state=e.UserActionState.Ended,this._itemBuffer.flushBuffer(t=>{if(function(t,i){return(null==i?void 0:i(t))||t.type===e.TransportItemType.MEASUREMENT&&"web-vitals"===t.payload.type}(t,this.trackUserActionsExcludeItem))return void this._transports.execute(t);const i=Object.assign(Object.assign({},t),{payload:Object.assign(Object.assign({},t.payload),{action:{parentId:this.id,name:this.name}})});this._transports.execute(i)}),this._state=e.UserActionState.Ended,this.notify(this._state),this._pushEvent("faro.user.action",Object.assign({userActionName:this.name,userActionStartTime:this.startTime.toString(),userActionEndTime:t.toString(),userActionDuration:i.toString(),userActionTrigger:this.trigger,userActionImportance:this.importance},F(this.attributes)),void 0,{timestampOverwriteMs:this.startTime,customPayloadTransformer:e=>(e.action={id:this.id,name:this.name},e)})}getState(){return this._state}}const ae=new V;function le(t,i){if(!t)return!1;return(null==t?void 0:t.getState())===e.UserActionState.Started&&(t.addItem(i),!0)}const ue="Error",ce=e=>e.map(e=>g(e)?q(e):String(e)).join(" ");let de;function pe({internalLogger:t,config:i,metas:n,transports:s,tracesApi:r,userActionsApi:o}){var a;t.debug("Initializing exceptions API");let l=null;de=null!==(a=i.parseStacktrace)&&void 0!==a?a:de;const d=e=>{t.debug("Changing stacktrace parser"),de=null!=e?e:de},{ignoreErrors:p=[],preserveOriginalError:h}=i;return d(i.parseStacktrace),{changeStacktraceParser:d,getStacktraceParser:()=>de,pushError:(a,{skipDedupe:d,stackFrames:m,type:v,context:b,spanContext:w,timestampOverwriteMs:S,originalError:T,fingerprint:E,fatal:k}={})=>{var I;if(!function(e,t){const{message:i,name:n,stack:s}=t;return r=e,o=i+" "+n+" "+s,r.some(e=>c(e)?o.includes(e):!!o.match(e));var r,o}(p,null!=T?T:a))try{const c=F(Object.assign(Object.assign({},function(e){let t=e.cause;y(t)?t=e.cause.toString():null!==t&&(g(e.cause)||f(e.cause))?t=q(e.cause):null!=t&&(t=e.cause.toString());return null==t?{}:{cause:t}}(null!=T?T:a)),null!=b?b:{})),p={meta:n.value,payload:Object.assign(Object.assign(Object.assign(Object.assign({type:v||a.name||ue,value:a.message,timestamp:S?U(S):_(),trace:w?{trace_id:w.traceId,span_id:w.spanId}:r.getTraceContext()},x(c)?{}:{context:c}),h?{originalError:T}:{}),E?{fingerprint:E}:{}),void 0!==k?{fatal:k}:{}),type:e.TransportItemType.EXCEPTION};(null==(m=null!=m?m:a.stack?null==de?void 0:de(a).frames:void 0)?void 0:m.length)&&(p.payload.stacktrace={frames:m});const A={type:p.payload.type,value:p.payload.value,stacktrace:p.payload.stacktrace,context:p.payload.context,fingerprint:p.payload.fingerprint,fatal:null!==(I=p.payload.fatal)&&void 0!==I&&I};if(!d&&i.dedupe&&!u(l)&&O(A,l))return void t.debug("Skipping error push because it is the same as the last one\n",p.payload);l=A,t.debug("Pushing exception\n",p),le(o.getActiveUserAction(),p)||s.execute(p)}catch(e){t.error("Error pushing event",e)}}}}const ge=e=>e.map(e=>{try{return String(e)}catch(e){return""}}).join(" ");function he(t,i,n,s,r){i.debug("Initializing API");let o=null;const a=function({transports:t,internalLogger:i,config:n,pushEvent:s}){var r;const o=null===(r=n.userActionsInstrumentation)||void 0===r?void 0:r.excludeItem;let a;const l=()=>a,u={startUserAction:(n,r,u)=>{if(void 0===l()){const i=new oe({name:n,transports:t,attributes:r,trigger:(null==u?void 0:u.triggerName)||"faroApiCall",importance:(null==u?void 0:u.importance)||ne,trackUserActionsExcludeItem:o,pushEvent:s});return i.filter(t=>[e.UserActionState.Ended,e.UserActionState.Cancelled].includes(t)).first().subscribe(()=>{a=void 0}),ae.notify({type:"user_action_start",userAction:i}),a=i,a}i.error("Attempted to create a new user action while one is already running. This is not possible.")},getActiveUserAction:l};return u}({transports:r,config:n,internalLogger:i,pushEvent:(e,t,n,s)=>{o?o(e,t,n,s):i.warn("pushEventImpl is not initialized. Event dropped:",{name:e,attributes:t,domain:n,options:s})}}),l=function(t,i,n,s,r){let o;return i.debug("Initializing traces API"),{getOTEL:()=>o,getTraceContext:()=>{const e=null==o?void 0:o.trace.getSpanContext(o.context.active());return e?{trace_id:e.traceId,span_id:e.spanId}:void 0},initOTEL:(e,t)=>{i.debug("Initializing OpenTelemetry"),o={trace:e,context:t}},isOTELInitialized:()=>!!o,pushTraces:t=>{try{const n={type:e.TransportItemType.TRACE,payload:t,meta:s.value};i.debug("Pushing trace\n",n),r.execute(n)}catch(e){i.error("Error pushing trace\n",e)}}}}(0,i,0,s,r),d={internalLogger:i,userActionsApi:a,config:n,metas:s,transports:r,tracesApi:l},p=function({internalLogger:t,config:i,metas:n,transports:s,tracesApi:r,userActionsApi:o}){let a=null;return{pushEvent:(l,c,d,{skipDedupe:p,spanContext:g,timestampOverwriteMs:h,customPayloadTransformer:f=e=>e}={})=>{try{const m=F(c),v={meta:n.value,payload:f({name:l,domain:null!=d?d:i.eventDomain,attributes:x(m)?void 0:m,timestamp:h?U(h):_(),trace:g?{trace_id:g.traceId,span_id:g.spanId}:r.getTraceContext()}),type:e.TransportItemType.EVENT},b={name:v.payload.name,attributes:v.payload.attributes,domain:v.payload.domain};if(!p&&i.dedupe&&!u(a)&&O(b,a))return void t.debug("Skipping event push because it is the same as the last one\n",v.payload);a=b,t.debug("Pushing event\n",v),le(o.getActiveUserAction(),v)||s.execute(v)}catch(e){t.error("Error pushing event",e)}}}}(d);return o=p.pushEvent,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},l),pe(d)),function({internalLogger:e,metas:t}){let i,n,s,r;e.debug("Initializing meta API");const o=e=>{n&&t.remove(n),n={user:e},t.add(n)},a=(e,n)=>{var s;const r=null==n?void 0:n.overrides,o=r?{overrides:Object.assign(Object.assign({},null===(s=null==i?void 0:i.session)||void 0===s?void 0:s.overrides),r)}:{};i&&t.remove(i),i={session:Object.assign(Object.assign({},x(e)?void 0:e),o)},t.add(i)},l=()=>t.value.session,u=()=>t.value.page;return{setUser:o,resetUser:o,setSession:a,resetSession:a,getSession:l,setView:(e,i)=>{var n;if((null==i?void 0:i.overrides)&&a(l(),{overrides:i.overrides}),(null===(n=null==s?void 0:s.view)||void 0===n?void 0:n.name)===(null==e?void 0:e.name))return;const r=s;s={view:e},t.add(s),r&&t.remove(r)},getView:()=>t.value.view,setPage:e=>{var i;const n=c(e)?Object.assign(Object.assign({},null!==(i=null==r?void 0:r.page)&&void 0!==i?i:u()),{id:e}):e;r&&t.remove(r),r={page:n},t.add(r)},getPage:u}}(d)),function({internalLogger:t,config:i,metas:n,transports:s,tracesApi:r,userActionsApi:o}){var a;t.debug("Initializing logs API");let l=null;const c=null!==(a=i.logArgsSerializer)&&void 0!==a?a:ge;return{pushLog:(a,{context:d,level:p,skipDedupe:g,spanContext:h,timestampOverwriteMs:f}={})=>{try{const m=F(d),v={type:e.TransportItemType.LOG,payload:{message:c(a),level:null!=p?p:j,context:x(m)?void 0:m,timestamp:f?U(f):_(),trace:h?{trace_id:h.traceId,span_id:h.spanId}:r.getTraceContext()},meta:n.value},b={message:v.payload.message,level:v.payload.level,context:v.payload.context};if(!g&&i.dedupe&&!u(l)&&O(b,l))return void t.debug("Skipping log push because it is the same as the last one\n",v.payload);l=b,t.debug("Pushing log\n",v),le(o.getActiveUserAction(),v)||s.execute(v)}catch(e){t.error("Error pushing log\n",e)}}}}(d)),function({internalLogger:t,config:i,metas:n,transports:s,tracesApi:r,userActionsApi:o}){t.debug("Initializing measurements API");let a=null;return{pushMeasurement:(l,{skipDedupe:c,context:d,spanContext:p,timestampOverwriteMs:g}={})=>{try{const h=F(d),f={type:e.TransportItemType.MEASUREMENT,payload:Object.assign(Object.assign({},l),{trace:p?{trace_id:p.traceId,span_id:p.spanId}:r.getTraceContext(),timestamp:g?U(g):_(),context:x(h)?void 0:h}),meta:n.value},m={type:f.payload.type,values:f.payload.values,context:f.payload.context};if(!c&&i.dedupe&&!u(a)&&O(m,a))return void t.debug("Skipping measurement push because it is the same as the last one\n",f.payload);a=m,t.debug("Pushing measurement\n",f),le(o.getActiveUserAction(),f)||s.execute(f)}catch(e){t.error("Error pushing measurement\n",e)}}}}(d)),p),a)}class fe extends Q{constructor(){super(...arguments),this.api={},this.transports={}}}const me="2.7.1";function ve(e){var t,i;const n=e.config.app.name,s=n?function(e){return null==z?void 0:z[`__faroGitHash_${e}`]}(n):void 0,r={sdk:{version:me,name:"faro"},app:Object.assign({bundleId:n&&B(n)},void 0!==s?{gitHash:s}:{})},o=null===(t=e.config.sessionTracking)||void 0===t?void 0:t.session;o&&e.api.setSession(o),e.config.app&&(r.app=Object.assign(Object.assign({},e.config.app),r.app)),e.config.user&&(r.user=e.config.user),e.config.view&&(r.view=e.config.view),e.metas.add(r,...null!==(i=e.config.metas)&&void 0!==i?i:[])}const be="_faroInternal";function we(e){e.config.isolate?e.internalLogger.debug("Skipping registering internal Faro instance on global object"):(e.internalLogger.debug("Registering internal Faro instance on global object"),Object.defineProperty(z,be,{configurable:!1,enumerable:!1,writable:!1,value:e}))}function ye(){return be in z}function Se(t,i,n,s,r,o,a){return i.debug("Initializing Faro"),e.faro={api:o,config:n,instrumentations:a,internalLogger:i,metas:s,pause:r.pause,transports:r,unpatchedConsole:t,unpause:r.unpause},we(e.faro),function(e){if(e.config.preventGlobalExposure)e.internalLogger.debug("Skipping registering public Faro instance in the global scope");else{if(e.internalLogger.debug(`Registering public faro reference in the global scope using "${e.config.globalObjectKey}" key`),e.config.globalObjectKey in z)return void e.internalLogger.warn(`Skipping global registration due to key "${e.config.globalObjectKey}" being used already. Please set "globalObjectKey" to something else or set "preventGlobalExposure" to "true"`);Object.defineProperty(z,e.config.globalObjectKey,{configurable:!1,writable:!1,value:e})}}(e.faro),e.faro}function Te(e){const t=X(e),i=Y(t,e);if(ye()&&!e.isolate)return void i.error('Faro is already registered. Either add instrumentations, transports etc. to the global faro instance or use the "isolate" property');i.debug("Initializing");const n=function(e,t){let i=[],n=[];const s=()=>i.reduce((e,t)=>Object.assign(e,h(t)?t():t),{}),r=()=>{if(n.length){const e=s();n.forEach(t=>t(e))}};return{add:(...e)=>{t.debug("Adding metas\n",e),i.push(...e),r()},remove:(...e)=>{t.debug("Removing metas\n",e),i=i.filter(t=>!e.includes(t)),r()},addListener:e=>{t.debug("Adding metas listener\n",e),n.push(e)},removeListener:e=>{t.debug("Removing metas listener\n",e),n=n.filter(t=>t!==e)},get value(){return s()}}}(0,i),r=s(t,i,e,n),o=he(0,i,e,n,r),a=function(e,t,i,n,s,r){t.debug("Initializing instrumentations");const o=[];return{add:(...a)=>{t.debug("Adding instrumentations"),a.forEach(a=>{t.debug(`Adding "${a.name}" instrumentation`),o.some(e=>e.name===a.name)?t.warn(`Instrumentation ${a.name} is already added`):(a.unpatchedConsole=e,a.internalLogger=t,a.config=i,a.metas=n,a.transports=s,a.api=r,o.push(a),a.initialize())})},get instrumentations(){return[...o]},remove:(...e)=>{t.debug("Removing instrumentations"),e.forEach(e=>{var i,n;t.debug(`Removing "${e.name}" instrumentation`);const s=o.reduce((t,i,n)=>null===t&&i.name===e.name?n:null,null);null!==s?(null===(n=(i=o[s]).destroy)||void 0===n||n.call(i),o.splice(s,1)):t.warn(`Instrumentation "${e.name}" is not added`)})}}}(t,i,e,n,r,o),l=Se(t,i,e,n,r,o,a);return ve(l),function(e){e.transports.add(...e.config.transports),e.transports.addBeforeSendHooks(e.config.beforeSend)}(l),function(e){e.instrumentations.add(...e.config.instrumentations)}(l),l}e.faro={api:{pushLog:()=>{},pushError:()=>{},changeStacktraceParser:()=>{},getStacktraceParser:()=>{},pushMeasurement:()=>{},pushTraces:()=>{},getOTEL:()=>{},getTraceContext:()=>{},initOTEL:()=>{},isOTELInitialized:()=>!1,setUser:()=>{},resetUser:()=>{},setSession:()=>{},resetSession:()=>{},getSession:()=>{},setView:()=>{},getView:()=>{},setPage:()=>{},getPage:()=>{},pushEvent:()=>{},startUserAction:()=>{},getActiveUserAction:()=>{}}};const Ee="faro",ke={enabled:!0,sendTimeout:250,itemLimit:50},Ie="view_changed",xe="session_start",Oe="session_resume",Ae="session_extend",Le="service_name_override",_e="unknown";var Ue,Ce={exports:{}},je=Ce.exports;var Me=(Ue||(Ue=1,function(e,t){!function(i,n){var s="function",r="undefined",o="object",a="string",l="major",u="model",c="name",d="type",p="vendor",g="version",h="architecture",f="console",m="mobile",v="tablet",b="smarttv",w="wearable",y="embedded",S="Amazon",T="Apple",E="ASUS",k="BlackBerry",I="Browser",x="Chrome",O="Firefox",A="Google",L="Honor",_="Huawei",U="LG",C="Microsoft",j="Motorola",M="Nvidia",P="OnePlus",N="Opera",D="OPPO",R="Samsung",z="Sharp",B="Sony",q="Xiaomi",F="Zebra",V="Facebook",$="Chromium OS",H="Mac OS",G=" Browser",W=function(e){for(var t={},i=0;i<e.length;i++)t[e[i].toUpperCase()]=e[i];return t},K=function(e,t){return typeof e===a&&-1!==X(t).indexOf(X(e))},X=function(e){return e.toLowerCase()},J=function(e,t){if(typeof e===a)return e=e.replace(/^\s\s*/,""),typeof t===r?e:e.substring(0,500)},Z=function(e,t){for(var i,r,a,l,u,c,d=0;d<t.length&&!u;){var p=t[d],g=t[d+1];for(i=r=0;i<p.length&&!u&&p[i];)if(u=p[i++].exec(e))for(a=0;a<g.length;a++)c=u[++r],typeof(l=g[a])===o&&l.length>0?2===l.length?typeof l[1]==s?this[l[0]]=l[1].call(this,c):this[l[0]]=l[1]:3===l.length?typeof l[1]!==s||l[1].exec&&l[1].test?this[l[0]]=c?c.replace(l[1],l[2]):n:this[l[0]]=c?l[1].call(this,c,l[2]):n:4===l.length&&(this[l[0]]=c?l[3].call(this,c.replace(l[1],l[2])):n):this[l]=c||n;d+=2}},Y=function(e,t){for(var i in t)if(typeof t[i]===o&&t[i].length>0){for(var s=0;s<t[i].length;s++)if(K(t[i][s],e))return"?"===i?n:i}else if(K(t[i],e))return"?"===i?n:i;return t.hasOwnProperty("*")?t["*"]:e},Q={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},ee={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[g,[c,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[g,[c,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[c,g],[/opios[\/ ]+([\w\.]+)/i],[g,[c,N+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[g,[c,N+" GX"]],[/\bopr\/([\w\.]+)/i],[g,[c,N]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[g,[c,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[g,[c,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[c,g],[/quark(?:pc)?\/([-\w\.]+)/i],[g,[c,"Quark"]],[/\bddg\/([\w\.]+)/i],[g,[c,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[g,[c,"UC"+I]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[g,[c,"WeChat"]],[/konqueror\/([\w\.]+)/i],[g,[c,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[g,[c,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[g,[c,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[g,[c,"Smart Lenovo "+I]],[/(avast|avg)\/([\w\.]+)/i],[[c,/(.+)/,"$1 Secure "+I],g],[/\bfocus\/([\w\.]+)/i],[g,[c,O+" Focus"]],[/\bopt\/([\w\.]+)/i],[g,[c,N+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[g,[c,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[g,[c,"Dolphin"]],[/coast\/([\w\.]+)/i],[g,[c,N+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[g,[c,"MIUI"+G]],[/fxios\/([\w\.-]+)/i],[g,[c,O]],[/\bqihoobrowser\/?([\w\.]*)/i],[g,[c,"360"]],[/\b(qq)\/([\w\.]+)/i],[[c,/(.+)/,"$1Browser"],g],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[c,/(.+)/,"$1"+G],g],[/samsungbrowser\/([\w\.]+)/i],[g,[c,R+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[g,[c,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[c,"Sogou Mobile"],g],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[c,g],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[c],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[g,c],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[c,V],g],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[c,g],[/\bgsa\/([\w\.]+) .*safari\//i],[g,[c,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[g,[c,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[g,[c,x+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[c,x+" WebView"],g],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[g,[c,"Android "+I]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[c,g],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[g,[c,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[g,c],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[c,[g,Y,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[c,g],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[c,"Netscape"],g],[/(wolvic|librewolf)\/([\w\.]+)/i],[c,g],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[g,[c,O+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[c,[g,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[c,[g,/master.|lts./,""]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[h,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[h,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[h,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[h,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[h,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[h,/ower/,"",X]],[/ sun4\w[;\)]/i],[[h,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[h,X]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[u,[p,R],[d,v]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[u,[p,R],[d,m]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[u,[p,T],[d,m]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[u,[p,T],[d,v]],[/(macintosh);/i],[u,[p,T]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[u,[p,z],[d,m]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[u,[p,L],[d,v]],[/honor([-\w ]+)[;\)]/i],[u,[p,L],[d,m]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[u,[p,_],[d,v]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[u,[p,_],[d,m]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[u,/_/g," "],[p,q],[d,v]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[u,/_/g," "],[p,q],[d,m]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[u,[p,D],[d,m]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[u,[p,Y,{OnePlus:["304","403","203"],"*":D}],[d,v]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[u,[p,"Vivo"],[d,m]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[u,[p,"Realme"],[d,m]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto(?! 360)[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[u,[p,j],[d,m]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[u,[p,j],[d,v]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[u,[p,U],[d,v]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv|watch)\w+)/i,/\blg-?([\d\w]+) bui/i],[u,[p,U],[d,m]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[u,[p,"Lenovo"],[d,v]],[/(nokia) (t[12][01])/i],[p,u,[d,v]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[u,/_/g," "],[d,m],[p,"Nokia"]],[/(pixel (c|tablet))\b/i],[u,[p,A],[d,v]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[u,[p,A],[d,m]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[u,[p,B],[d,m]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[u,"Xperia Tablet"],[p,B],[d,v]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[u,[p,P],[d,m]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[u,[p,S],[d,v]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[u,/(.+)/g,"Fire Phone $1"],[p,S],[d,m]],[/(playbook);[-\w\),; ]+(rim)/i],[u,p,[d,v]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[u,[p,k],[d,m]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[u,[p,E],[d,v]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[u,[p,E],[d,m]],[/(nexus 9)/i],[u,[p,"HTC"],[d,v]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[p,[u,/_/g," "],[d,m]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[u,[p,"TCL"],[d,v]],[/(itel) ((\w+))/i],[[p,X],u,[d,Y,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[u,[p,"Acer"],[d,v]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[u,[p,"Meizu"],[d,m]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[u,[p,"Ulefone"],[d,m]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[u,[p,"Energizer"],[d,m]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[u,[p,"Cat"],[d,m]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[u,[p,"Smartfren"],[d,m]],[/droid.+; (a(?:015|06[35]|142p?))/i],[u,[p,"Nothing"],[d,m]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[u,[p,"Archos"],[d,v]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[u,[p,"Archos"],[d,m]],[/(imo) (tab \w+)/i,/(infinix) (x1101b?)/i],[p,u,[d,v]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (hmd|imo) ([\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i,/(oppo) ?([\w ]+) bui/i],[p,u,[d,m]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[p,u,[d,v]],[/(surface duo)/i],[u,[p,C],[d,v]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[u,[p,"Fairphone"],[d,m]],[/(u304aa)/i],[u,[p,"AT&T"],[d,m]],[/\bsie-(\w*)/i],[u,[p,"Siemens"],[d,m]],[/\b(rct\w+) b/i],[u,[p,"RCA"],[d,v]],[/\b(venue[\d ]{2,7}) b/i],[u,[p,"Dell"],[d,v]],[/\b(q(?:mv|ta)\w+) b/i],[u,[p,"Verizon"],[d,v]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[u,[p,"Barnes & Noble"],[d,v]],[/\b(tm\d{3}\w+) b/i],[u,[p,"NuVision"],[d,v]],[/\b(k88) b/i],[u,[p,"ZTE"],[d,v]],[/\b(nx\d{3}j) b/i],[u,[p,"ZTE"],[d,m]],[/\b(gen\d{3}) b.+49h/i],[u,[p,"Swiss"],[d,m]],[/\b(zur\d{3}) b/i],[u,[p,"Swiss"],[d,v]],[/\b((zeki)?tb.*\b) b/i],[u,[p,"Zeki"],[d,v]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[p,"Dragon Touch"],u,[d,v]],[/\b(ns-?\w{0,9}) b/i],[u,[p,"Insignia"],[d,v]],[/\b((nxa|next)-?\w{0,9}) b/i],[u,[p,"NextBook"],[d,v]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[p,"Voice"],u,[d,m]],[/\b(lvtel\-)?(v1[12]) b/i],[[p,"LvTel"],u,[d,m]],[/\b(ph-1) /i],[u,[p,"Essential"],[d,m]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[u,[p,"Envizen"],[d,v]],[/\b(trio[-\w\. ]+) b/i],[u,[p,"MachSpeed"],[d,v]],[/\btu_(1491) b/i],[u,[p,"Rotor"],[d,v]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[u,[p,M],[d,v]],[/(sprint) (\w+)/i],[p,u,[d,m]],[/(kin\.[onetw]{3})/i],[[u,/\./g," "],[p,C],[d,m]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[u,[p,F],[d,v]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[u,[p,F],[d,m]],[/smart-tv.+(samsung)/i],[p,[d,b]],[/hbbtv.+maple;(\d+)/i],[[u,/^/,"SmartTV"],[p,R],[d,b]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[p,U],[d,b]],[/(apple) ?tv/i],[p,[u,T+" TV"],[d,b]],[/crkey/i],[[u,x+"cast"],[p,A],[d,b]],[/droid.+aft(\w+)( bui|\))/i],[u,[p,S],[d,b]],[/(shield \w+ tv)/i],[u,[p,M],[d,b]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[u,[p,z],[d,b]],[/(bravia[\w ]+)( bui|\))/i],[u,[p,B],[d,b]],[/(mi(tv|box)-?\w+) bui/i],[u,[p,q],[d,b]],[/Hbbtv.*(technisat) (.*);/i],[p,u,[d,b]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[p,J],[u,J],[d,b]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[u,[d,b]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[d,b]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[p,u,[d,f]],[/droid.+; (shield)( bui|\))/i],[u,[p,M],[d,f]],[/(playstation \w+)/i],[u,[p,B],[d,f]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[u,[p,C],[d,f]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[u,[p,R],[d,w]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[p,u,[d,w]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[u,[p,D],[d,w]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[u,[p,T],[d,w]],[/(opwwe\d{3})/i],[u,[p,P],[d,w]],[/(moto 360)/i],[u,[p,j],[d,w]],[/(smartwatch 3)/i],[u,[p,B],[d,w]],[/(g watch r)/i],[u,[p,U],[d,w]],[/droid.+; (wt63?0{2,3})\)/i],[u,[p,F],[d,w]],[/droid.+; (glass) \d/i],[u,[p,A],[d,w]],[/(pico) (4|neo3(?: link|pro)?)/i],[p,u,[d,w]],[/; (quest( \d| pro)?)/i],[u,[p,V],[d,w]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[p,[d,y]],[/(aeobc)\b/i],[u,[p,S],[d,y]],[/(homepod).+mac os/i],[u,[p,T],[d,y]],[/windows iot/i],[[d,y]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[u,[d,m]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[u,[d,v]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[d,v]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[d,m]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[u,[p,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[g,[c,"EdgeHTML"]],[/(arkweb)\/([\w\.]+)/i],[c,g],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[g,[c,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[c,g],[/ladybird\//i],[[c,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[g,c]],os:[[/microsoft (windows) (vista|xp)/i],[c,g],[/(windows (?:phone(?: os)?|mobile|iot))[\/ ]?([\d\.\w ]*)/i],[c,[g,Y,Q]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[g,Y,Q],[c,"Windows"]],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[g,/_/g,"."],[c,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[c,H],[g,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[g,c],[/(ubuntu) ([\w\.]+) like android/i],[[c,/(.+)/,"$1 Touch"],g],[/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen|webos)\w*[-\/; ]?([\d\.]*)/i],[c,g],[/\(bb(10);/i],[g,[c,k]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[g,[c,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[g,[c,O+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[g,[c,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[g,[c,"watchOS"]],[/crkey\/([\d\.]+)/i],[g,[c,x+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[c,$],g],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux)(?: arm\w*| x86\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[c,g],[/(sunos) ?([\w\.\d]*)/i],[[c,"Solaris"],g],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[c,g]]},te=function(e,t){if(typeof e===o&&(t=e,e=n),!(this instanceof te))return new te(e,t).getResult();var f=typeof i!==r&&i.navigator?i.navigator:n,b=e||(f&&f.userAgent?f.userAgent:""),w=f&&f.userAgentData?f.userAgentData:n,y=t?function(e,t){var i={};for(var n in e)t[n]&&t[n].length%2==0?i[n]=t[n].concat(e[n]):i[n]=e[n];return i}(ee,t):ee,S=f&&f.userAgent==b;return this.getBrowser=function(){var e,t={};return t[c]=n,t[g]=n,Z.call(t,b,y.browser),t[l]=typeof(e=t[g])===a?e.replace(/[^\d\.]/g,"").split(".")[0]:n,S&&f&&f.brave&&typeof f.brave.isBrave==s&&(t[c]="Brave"),t},this.getCPU=function(){var e={};return e[h]=n,Z.call(e,b,y.cpu),e},this.getDevice=function(){var e={};return e[p]=n,e[u]=n,e[d]=n,Z.call(e,b,y.device),S&&!e[d]&&w&&w.mobile&&(e[d]=m),S&&"Macintosh"==e[u]&&f&&typeof f.standalone!==r&&f.maxTouchPoints&&f.maxTouchPoints>2&&(e[u]="iPad",e[d]=v),e},this.getEngine=function(){var e={};return e[c]=n,e[g]=n,Z.call(e,b,y.engine),e},this.getOS=function(){var e={};return e[c]=n,e[g]=n,Z.call(e,b,y.os),S&&!e[c]&&w&&w.platform&&"Unknown"!=w.platform&&(e[c]=w.platform.replace(/chrome os/i,$).replace(/macos/i,H)),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return b},this.setUA=function(e){return b=typeof e===a&&e.length>500?J(e,500):e,this},this.setUA(b),this};te.VERSION="1.0.41",te.BROWSER=W([c,g,l]),te.CPU=W([h]),te.DEVICE=W([u,p,d,f,m,b,v,w,y]),te.ENGINE=te.OS=W([c,g]),e.exports&&(t=e.exports=te),t.UAParser=te;var ie=typeof i!==r&&(i.jQuery||i.Zepto);if(ie&&!ie.ua){var ne=new te;ie.ua=ne.getResult(),ie.ua.get=function(){return ne.getUA()},ie.ua.set=function(e){ne.setUA(e);var t=ne.getResult();for(var i in t)ie.ua[i]=t[i]}}}("object"==typeof window?window:je)}(Ce,Ce.exports)),Ce.exports);let Pe,Ne;function De(){const e="undefined"!=typeof navigator?navigator.userAgent:"";return Pe===e&&Ne||(Ne=new Me.UAParser(e).getResult(),Pe=e),Ne}const Re=()=>{const{browser:e,os:t,ua:i}=De(),{name:n,version:s}=e,{name:r,version:o}=t,a=navigator.language,l=i.includes("Mobi"),u=function(){if(!n||!s)return;if("userAgentData"in navigator&&navigator.userAgentData)return navigator.userAgentData.brands;return}();return{browser:{name:null!=n?n:_e,version:null!=s?s:_e,os:`${null!=r?r:_e} ${null!=o?o:_e}`,userAgent:null!=i?i:_e,language:null!=a?a:_e,mobile:l,brands:null!=u?u:_e,viewportWidth:`${window.innerWidth}`,viewportHeight:`${window.innerHeight}`}}},ze=()=>{const{name:e,version:t}=De().os;if(!e&&!t)return{};const i={};return e&&(i.name=e),t&&(i.version=t),{os:i}};function Be(t){var i,n,s,r;return{id:null!==(r=null===(s=null===(n=null===(i=e.faro.config)||void 0===i?void 0:i.sessionTracking)||void 0===n?void 0:n.generateSessionId)||void 0===s?void 0:s.call(n))&&void 0!==r?r:R(),attributes:t}}const qe=()=>({sdk:{name:"faro-web",version:me}}),Fe="sessionStorage",Ve="localStorage";function $e(t){var i;try{let e;e=window[t];const i="__faro_storage_test__";return e.setItem(i,i),e.removeItem(i),!0}catch(n){return null===(i=e.faro.internalLogger)||void 0===i||i.info(`Web storage of type ${t} is not available. Reason: ${n}`),!1}}function He(e,t){return Je(t)?window[t].getItem(e):null}function Ge(e,t,i){if(Je(i))try{window[i].setItem(e,t)}catch(e){}}function We(e,t){Je(t)&&window[t].removeItem(e)}const Ke=$e(Ve),Xe=$e(Fe);function Je(e){return e===Ve?Ke:e===Fe&&Xe}function Ze(e,t){let i,n=!1;const s=()=>{null!=i?(e(...i),i=null,setTimeout(s,t)):n=!1};return(...r)=>{n?i=r:(e(...r),n=!0,setTimeout(s,t))}}function Ye(){return e.faro.transports.transports.flatMap(e=>e.getIgnoreUrls())}function Qe(e=""){return Ye().some(t=>e&&null!=e.match(t))}function et(e){return c(e)?e:e instanceof URL?e.href:!x(e)&&h(null==e?void 0:e.toString)?e.toString():void 0}const tt="com.grafana.faro.session",it=144e5,nt=9e5,st=nt,rt={enabled:!0,persistent:!1,maxSessionPersistenceTime:st};function ot(){var t,i,n;const s=e.faro.config.sessionTracking,r=null!==(n=null!==(i=null===(t=null==s?void 0:s.sampler)||void 0===t?void 0:t.call(s,{metas:e.faro.metas.value}))&&void 0!==i?i:null==s?void 0:s.samplingRate)&&void 0!==n?n:1,o="number"==typeof r?function(e){return Math.min(1,Math.max(0,e))}(r):0;return Math.random()<o}function at({sessionId:t,started:i,lastActivity:n,isSampled:s=!0}={}){var r,o;const a=A(),l=null===(o=null===(r=e.faro.config)||void 0===r?void 0:r.sessionTracking)||void 0===o?void 0:o.generateSessionId;return null==t&&(t="function"==typeof l?l():R()),{sessionId:t,lastActivity:null!=n?n:a,started:null!=i?i:a,isSampled:s}}function lt(e){if(null==e)return!1;const t=A();if(!(t-e.started<it))return!1;return t-e.lastActivity<nt}function ut({fetchUserSession:t,storeUserSession:i}){return function({forceSessionExtend:n}={forceSessionExtend:!1}){var s,r,o;if(!t||!i)return;const a=e.faro.config.sessionTracking,l=null==a?void 0:a.persistent;if(l&&!Ke||!l&&!Xe)return;const u=t();if(!1===n&&lt(u))i(Object.assign(Object.assign({},u),{lastActivity:A()}));else{let t=ct(at({isSampled:ot()}),u);i(t),null===(s=e.faro.api)||void 0===s||s.setSession(t.sessionMeta),null===(r=null==a?void 0:a.onSessionChange)||void 0===r||r.call(a,null!==(o=null==u?void 0:u.sessionMeta)&&void 0!==o?o:null,t.sessionMeta)}}}function ct(t,i){var n,s,r,o,a,l,u;const c=Object.assign(Object.assign({},t),{sessionMeta:{id:t.sessionId,attributes:pt(Object.assign(Object.assign(Object.assign({},null===(s=null===(n=e.faro.config.sessionTracking)||void 0===n?void 0:n.session)||void 0===s?void 0:s.attributes),null!==(o=null===(r=e.faro.metas.value.session)||void 0===r?void 0:r.attributes)&&void 0!==o?o:{}),{isSampled:t.isSampled.toString()}))}}),d=null!==(l=null===(a=e.faro.metas.value.session)||void 0===a?void 0:a.overrides)&&void 0!==l?l:null===(u=null==i?void 0:i.sessionMeta)||void 0===u?void 0:u.overrides;x(d)||(c.sessionMeta.overrides=d);const p=null==i?void 0:i.sessionId;return null!=p&&(c.sessionMeta.attributes.previousSession=p),c}function dt({fetchUserSession:t,storeUserSession:i}){let n=!1;return function(s){if(n)return;const r=s.session,o=t();let a=null==r?void 0:r.id;const l=null==r?void 0:r.attributes,u=null==r?void 0:r.overrides,c=null==o?void 0:o.sessionMeta,d=null==c?void 0:c.overrides,p=!!u&&!O(u,d),g=!!l&&!O(l,null==c?void 0:c.attributes);if(!!r&&a!==(null==o?void 0:o.sessionId)||g||p){const t=ct(at({sessionId:a,isSampled:ot()}),o);i(t),function(t,i={},n={}){var s,r,o;if(!t)return;const a=i.serviceName,l=null!==(o=null!==(s=n.serviceName)&&void 0!==s?s:null===(r=e.faro.metas.value.app)||void 0===r?void 0:r.name)&&void 0!==o?o:"";a&&a!==l&&e.faro.api.pushEvent(Le,{serviceName:a,previousServiceName:l})}(p,u,d),n=!0;try{e.faro.api.setSession(t.sessionMeta)}finally{n=!1}}}}function pt(e){const t={};for(const i of Object.keys(e)){const n=e[i];void 0!==n&&(t[i]=n)}return t}class gt{constructor(){this.updateSession=Ze(()=>this.updateUserSession(),1e3),this.updateUserSession=ut({fetchUserSession:gt.fetchUserSession,storeUserSession:gt.storeUserSession}),this.init()}static removeUserSession(){We(tt,gt.storageTypeLocal)}static storeUserSession(e){Ge(tt,q(e),gt.storageTypeLocal)}static fetchUserSession(){const e=He(tt,gt.storageTypeLocal);return e?JSON.parse(e):null}init(){document.addEventListener("visibilitychange",()=>{"visible"===document.visibilityState&&this.updateSession()}),e.faro.metas.addListener(dt({fetchUserSession:gt.fetchUserSession,storeUserSession:gt.storeUserSession}))}}gt.storageTypeLocal=Ve;class ht{constructor(){this.updateSession=Ze(()=>this.updateUserSession(),1e3),this.updateUserSession=ut({fetchUserSession:ht.fetchUserSession,storeUserSession:ht.storeUserSession}),this.init()}static removeUserSession(){We(tt,ht.storageTypeSession)}static storeUserSession(e){Ge(tt,q(e),ht.storageTypeSession)}static fetchUserSession(){const e=He(tt,ht.storageTypeSession);return e?JSON.parse(e):null}init(){document.addEventListener("visibilitychange",()=>{"visible"===document.visibilityState&&this.updateSession()}),e.faro.metas.addListener(dt({fetchUserSession:ht.fetchUserSession,storeUserSession:ht.storeUserSession}))}}function ft(e){return(null==e?void 0:e.persistent)?gt:ht}ht.storageTypeSession=Fe;class mt extends fe{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-session",this.version=me}sendSessionStartEvent(e){var t,i;const n=e.session;if(n&&n.id!==(null===(t=this.notifiedSession)||void 0===t?void 0:t.id)){if(this.notifiedSession&&this.notifiedSession.id===(null===(i=n.attributes)||void 0===i?void 0:i.previousSession))return this.api.pushEvent(Ae,{},void 0,{skipDedupe:!0}),void(this.notifiedSession=n);this.notifiedSession=n,this.api.pushEvent(xe,{},void 0,{skipDedupe:!0})}}createInitialSession(e,t){var i,n,s,r,o,a;let l,u,c=e.fetchUserSession();if(t.persistent&&t.maxSessionPersistenceTime&&c){const e=A();c.lastActivity<e-t.maxSessionPersistenceTime&&(gt.removeUserSession(),c=null)}if(lt(c)){const e=null==c?void 0:c.sessionId;u=at({sessionId:e,isSampled:c.isSampled||!1,started:null==c?void 0:c.started});const s=null==c?void 0:c.sessionMeta,r=Object.assign(Object.assign({},null===(i=t.session)||void 0===i?void 0:i.overrides),null==s?void 0:s.overrides);u.sessionMeta=Object.assign(Object.assign({},t.session),{id:e,attributes:Object.assign(Object.assign(Object.assign({},null===(n=t.se