@grafana/faro-web-sdk
Advanced tools
Comparing version 1.2.8 to 1.2.9
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isEvent = exports.isErrorEvent = exports.isErrorDefined = exports.isError = exports.isElementDefined = exports.isElement = exports.isDomException = exports.isDomError = exports.isBoolean = exports.isArray = exports.internalGlobalObjectKey = exports.globalObject = exports.getTransportBody = exports.getInternalFaroFromGlobalObject = exports.getCurrentTimestamp = exports.genShortID = exports.defaultLogLevel = exports.defaultInternalLoggerLevel = exports.defaultGlobalObjectKey = exports.defaultExceptionType = exports.deepEqual = exports.createPromiseBuffer = exports.createInternalLogger = exports.Conventions = exports.BaseTransport = exports.BaseInstrumentation = exports.BaseExtension = exports.allLogLevels = exports.faro = exports.FetchTransport = exports.ConsoleTransport = exports.sdkMeta = exports.pageMeta = exports.defaultViewMeta = exports.defaultMetas = exports.createSession = exports.browserMeta = exports.SessionInstrumentation = exports.WebVitalsInstrumentation = exports.ViewInstrumentation = exports.parseStacktrace = exports.getStackFramesFromError = exports.getDataFromSafariExtensions = exports.ErrorsInstrumentation = exports.ConsoleInstrumentation = exports.buildStackFrame = exports.initializeFaro = exports.defaultEventDomain = exports.makeCoreConfig = exports.getWebInstrumentations = void 0; | ||
exports.VERSION = exports.transportItemTypeToBodyKey = exports.TransportItemType = exports.setInternalFaroOnGlobalObject = exports.noop = exports.LogLevel = exports.InternalLoggerLevel = exports.isUndefined = exports.isTypeof = exports.isToString = exports.isThenable = exports.isSyntheticEvent = exports.isSymbol = exports.isString = exports.isRegExp = exports.isPrimitive = exports.isObject = exports.isNumber = exports.isNull = exports.isMapDefined = exports.isMap = exports.isInternalFaroOnGlobalObject = exports.isInt = exports.isInstanceOf = exports.isFunction = exports.isEventDefined = void 0; | ||
exports.STORAGE_KEY = exports.SESSION_INACTIVITY_TIME = exports.SESSION_EXPIRATION_TIME = exports.MAX_SESSION_PERSISTENCE_TIME_BUFFER = exports.MAX_SESSION_PERSISTENCE_TIME = exports.VolatileSessionsManager = exports.PersistentSessionsManager = exports.VERSION = exports.transportItemTypeToBodyKey = exports.TransportItemType = exports.setInternalFaroOnGlobalObject = exports.noop = exports.LogLevel = exports.InternalLoggerLevel = exports.isUndefined = exports.isTypeof = exports.isToString = exports.isThenable = exports.isSyntheticEvent = exports.isSymbol = exports.isString = exports.isRegExp = exports.isPrimitive = exports.isObject = exports.isNumber = exports.isNull = exports.isMapDefined = exports.isMap = exports.isInternalFaroOnGlobalObject = exports.isInt = exports.isInstanceOf = exports.isFunction = exports.isEventDefined = void 0; | ||
var config_1 = require("./config"); | ||
@@ -88,2 +88,10 @@ Object.defineProperty(exports, "getWebInstrumentations", { enumerable: true, get: function () { return config_1.getWebInstrumentations; } }); | ||
Object.defineProperty(exports, "VERSION", { enumerable: true, get: function () { return faro_core_1.VERSION; } }); | ||
var session_1 = require("./instrumentations/session"); | ||
Object.defineProperty(exports, "PersistentSessionsManager", { enumerable: true, get: function () { return session_1.PersistentSessionsManager; } }); | ||
Object.defineProperty(exports, "VolatileSessionsManager", { enumerable: true, get: function () { return session_1.VolatileSessionsManager; } }); | ||
Object.defineProperty(exports, "MAX_SESSION_PERSISTENCE_TIME", { enumerable: true, get: function () { return session_1.MAX_SESSION_PERSISTENCE_TIME; } }); | ||
Object.defineProperty(exports, "MAX_SESSION_PERSISTENCE_TIME_BUFFER", { enumerable: true, get: function () { return session_1.MAX_SESSION_PERSISTENCE_TIME_BUFFER; } }); | ||
Object.defineProperty(exports, "SESSION_EXPIRATION_TIME", { enumerable: true, get: function () { return session_1.SESSION_EXPIRATION_TIME; } }); | ||
Object.defineProperty(exports, "SESSION_INACTIVITY_TIME", { enumerable: true, get: function () { return session_1.SESSION_INACTIVITY_TIME; } }); | ||
Object.defineProperty(exports, "STORAGE_KEY", { enumerable: true, get: function () { return session_1.STORAGE_KEY; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -1,1 +0,1 @@ | ||
var GrafanaFaroWebSdk=function(e){"use strict";function n(e,n){return typeof e===n}function t(e,n){return Object.prototype.toString.call(e)===`[object ${n}]`}function i(e,n){try{return e instanceof n}catch(e){return!1}}const r=e=>n(e,"undefined"),s=e=>n(e,"null"),o=e=>n(e,"string"),a=e=>n(e,"number")&&!isNaN(e)||n(e,"bigint"),l=e=>!s(e)&&n(e,"object"),u=e=>n(e,"function"),c=e=>t(e,"Array"),d=e=>!l(e)&&!u(e),p=!r(Event),f=e=>p&&i(e,Event),g="undefined"!=typeof Error,b=e=>g&&i(e,Error),v=e=>t(e,"ErrorEvent"),m=e=>t(e,"DOMError"),h=e=>t(e,"DOMException"),w="undefined"!=typeof Element,y="undefined"!=typeof Map;function S(e,t){if(e===t)return!0;if(n(e,"number")&&isNaN(e))return n(t,"number")&&isNaN(t);const i=c(e),r=c(t);if(i!==r)return!1;if(i&&r){const n=e.length;if(n!==t.length)return!1;for(let i=n;0!=i--;)if(!S(e[i],t[i]))return!1;return!0}const s=l(e),o=l(t);if(s!==o)return!1;if(e&&t&&s&&o){const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(let e of n)if(!i.includes(e))return!1;for(let i of n)if(!S(e[i],t[i]))return!1;return!0}return!1}function E(){return(new Date).toISOString()}var T;e.LogLevel=void 0,(T=e.LogLevel||(e.LogLevel={})).TRACE="trace",T.DEBUG="debug",T.INFO="info",T.LOG="log",T.WARN="warn",T.ERROR="error";const x=e.LogLevel.LOG,k=[e.LogLevel.TRACE,e.LogLevel.DEBUG,e.LogLevel.INFO,e.LogLevel.LOG,e.LogLevel.WARN,e.LogLevel.ERROR];function I(){}function L(e){const{size:n,concurrency:t}=e,i=[];let r=0;const s=()=>{if(r<t&&i.length){const{producer:e,resolve:n,reject:t}=i.shift();r++,e().then((e=>{r--,s(),n(e)}),(e=>{r--,s(),t(e)}))}};return{add:e=>{if(i.length+r>=n)throw new Error("Task buffer full");return new Promise(((n,t)=>{i.push({producer:e,resolve:n,reject:t}),s()}))}}}const O="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789";function A(e=10){return Array.from(Array(e)).map((()=>O[Math.floor(Math.random()*O.length)])).join("")}function C(){return Date.now()}var N="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},j={exports:{}},R={exports:{}};R.exports=function(e,n){var t,i,r,s,o,a,l,u;for(t=3&e.length,i=e.length-t,r=n,o=3432918353,a=461845907,u=0;u<i;)l=255&e.charCodeAt(u)|(255&e.charCodeAt(++u))<<8|(255&e.charCodeAt(++u))<<16|(255&e.charCodeAt(++u))<<24,++u,r=27492+(65535&(s=5*(65535&(r=(r^=l=(65535&(l=(l=(65535&l)*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<13|r>>>19))+((5*(r>>>16)&65535)<<16)&4294967295))+((58964+(s>>>16)&65535)<<16);switch(l=0,t){case 3:l^=(255&e.charCodeAt(u+2))<<16;case 2:l^=(255&e.charCodeAt(u+1))<<8;case 1:r^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(u)))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295}return r^=e.length,r=2246822507*(65535&(r^=r>>>16))+((2246822507*(r>>>16)&65535)<<16)&4294967295,r=3266489909*(65535&(r^=r>>>13))+((3266489909*(r>>>16)&65535)<<16)&4294967295,(r^=r>>>16)>>>0};var D=R.exports,U={exports:{}};!function(e){e.exports=function(e,n){for(var t,i=e.length,r=n^i,s=0;i>=4;)t=1540483477*(65535&(t=255&e.charCodeAt(s)|(255&e.charCodeAt(++s))<<8|(255&e.charCodeAt(++s))<<16|(255&e.charCodeAt(++s))<<24))+((1540483477*(t>>>16)&65535)<<16),r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16)^(t=1540483477*(65535&(t^=t>>>24))+((1540483477*(t>>>16)&65535)<<16)),i-=4,++s;switch(i){case 3:r^=(255&e.charCodeAt(s+2))<<16;case 2:r^=(255&e.charCodeAt(s+1))<<8;case 1:r=1540483477*(65535&(r^=255&e.charCodeAt(s)))+((1540483477*(r>>>16)&65535)<<16)}return r=1540483477*(65535&(r^=r>>>13))+((1540483477*(r>>>16)&65535)<<16),(r^=r>>>15)>>>0}}(U);var M=D,P=U.exports;j.exports=M;var _=j.exports.murmur3=M;j.exports.murmur2=P;class B{constructor(e,n){var t,i;this.signalBuffer=[],this.itemLimit=null!==(t=null==n?void 0:n.itemLimit)&&void 0!==t?t:50,this.sendTimeout=null!==(i=null==n?void 0:n.sendTimeout)&&void 0!==i?i:250,this.paused=(null==n?void 0:n.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 n=new Map;return e.forEach((e=>{const t=_(JSON.stringify(e.meta));let i=n.get(t);i=void 0===i?[e]:[...i,e],n.set(t,i)})),Array.from(n.values())}flush(){if(this.paused||0===this.signalBuffer.length)return;this.groupItems(this.signalBuffer).forEach(this.sendFn),this.signalBuffer=[]}}var z;e.TransportItemType=void 0,(z=e.TransportItemType||(e.TransportItemType={})).EXCEPTION="exception",z.LOG="log",z.MEASUREMENT="measurement",z.TRACE="trace",z.EVENT="event";const F={[e.TransportItemType.EXCEPTION]:"exceptions",[e.TransportItemType.LOG]:"logs",[e.TransportItemType.MEASUREMENT]:"measurements",[e.TransportItemType.TRACE]:"traces",[e.TransportItemType.EVENT]:"events"};function $(n){return t=>{if(t.type===e.TransportItemType.EXCEPTION&&t.payload){const e=t.payload,i=`${e.type}: ${e.value}`;if(function(e,n){return e.some((e=>o(e)?n.includes(e):!!n.match(e)))}(n,i))return null}return t}}var V;e.InternalLoggerLevel=void 0,(V=e.InternalLoggerLevel||(e.InternalLoggerLevel={}))[V.OFF=0]="OFF",V[V.ERROR=1]="ERROR",V[V.WARN=2]="WARN",V[V.INFO=3]="INFO",V[V.VERBOSE=4]="VERBOSE";const q={debug:I,error:I,info:I,prefix:"Faro",warn:I},G=e.InternalLoggerLevel.ERROR,W=Object.assign({},console);let K=W;function H(e){var n;return K=null!==(n=e.unpatchedConsole)&&void 0!==n?n:K,K}function J(n=W,t=G){const i=q;return t>e.InternalLoggerLevel.OFF&&(i.error=t>=e.InternalLoggerLevel.ERROR?function(...e){n.error(`${i.prefix}\n`,...e)}:I,i.warn=t>=e.InternalLoggerLevel.WARN?function(...e){n.warn(`${i.prefix}\n`,...e)}:I,i.info=t>=e.InternalLoggerLevel.INFO?function(...e){n.info(`${i.prefix}\n`,...e)}:I,i.debug=t>=e.InternalLoggerLevel.VERBOSE?function(...e){n.debug(`${i.prefix}\n`,...e)}:I),i}let X=q;function Z(e,n){return X=J(e,n.internalLoggerLevel),X}class Q{constructor(){this.unpatchedConsole=W,this.internalLogger=q,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 Y extends Q{isBatched(){return!1}getIgnoreUrls(){return[]}}function ee(e,n){var t,i;if(void 0===n)return e;if(void 0===e)return{resourceSpans:n};const r=null===(t=e.resourceSpans)||void 0===t?void 0:t[0];if(void 0===r)return e;const s=(null==r?void 0:r.scopeSpans)||[],o=(null===(i=null==n?void 0:n[0])||void 0===i?void 0:i.scopeSpans)||[];return Object.assign(Object.assign({},e),{resourceSpans:[Object.assign(Object.assign({},r),{scopeSpans:[...s,...o]})]})}function ne(n){let t={meta:{}};return void 0!==n[0]&&(t.meta=n[0].meta),n.forEach((n=>{switch(n.type){case e.TransportItemType.LOG:case e.TransportItemType.EVENT:case e.TransportItemType.EXCEPTION:case e.TransportItemType.MEASUREMENT:const i=F[n.type],r=t[i];t=Object.assign(Object.assign({},t),{[i]:void 0===r?[n.payload]:[...r,n.payload]});break;case e.TransportItemType.TRACE:t=Object.assign(Object.assign({},t),{traces:ee(t.traces,n.payload.resourceSpans)})}})),t}const te="Error";let ie;function re(n,t,i,r,o){t.debug("Initializing API");const a=function(n,t,i,r,s){let o;return t.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,n)=>{t.debug("Initializing OpenTelemetry"),o={trace:e,context:n}},isOTELInitialized:()=>!!o,pushTraces:n=>{try{const i={type:e.TransportItemType.TRACE,payload:n,meta:r.value};t.debug("Pushing trace\n",i),s.execute(i)}catch(e){t.error("Error pushing trace\n",e)}}}}(0,t,0,r,o);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},a),function(n,t,i,r,o,a){var l;t.debug("Initializing exceptions API");let u=null;ie=null!==(l=i.parseStacktrace)&&void 0!==l?l:ie;const c=e=>{t.debug("Changing stacktrace parser"),ie=null!=e?e:ie};return c(i.parseStacktrace),{changeStacktraceParser:c,getStacktraceParser:()=>ie,pushError:(n,{skipDedupe:l,stackFrames:c,type:d,context:p}={})=>{d=d||n.name||te;const f={meta:r.value,payload:{type:d,value:n.message,timestamp:E(),trace:a.getTraceContext(),context:null!=p?p:{}},type:e.TransportItemType.EXCEPTION};(null==(c=null!=c?c:n.stack?null==ie?void 0:ie(n).frames:void 0)?void 0:c.length)&&(f.payload.stacktrace={frames:c});const g={type:f.payload.type,value:f.payload.value,stackTrace:f.payload.stacktrace,context:f.payload.context};l||!i.dedupe||s(u)||!S(g,u)?(u=g,t.debug("Pushing exception\n",f),o.execute(f)):t.debug("Skipping error push because it is the same as the last one\n",f.payload)}}}(0,t,i,r,o,a)),function(e,n,t,i,r){let s,o,a;n.debug("Initializing meta API");const l=e=>{o&&i.remove(o),o={user:e},i.add(o)},u=e=>{s&&i.remove(s),s={session:e},i.add(s)};return{setUser:l,resetUser:l,setSession:u,resetSession:u,getSession:()=>i.value.session,setView:e=>{a&&i.remove(a),a={view:e},i.add(a)},getView:()=>i.value.view}}(0,t,0,r)),function(n,t,i,r,o,a){t.debug("Initializing logs API");let l=null;return{pushLog:(n,{context:u,level:c,skipDedupe:d}={})=>{try{const p={type:e.TransportItemType.LOG,payload:{message:n.map((e=>{try{return String(e)}catch(e){return""}})).join(" "),level:null!=c?c:x,context:null!=u?u:{},timestamp:E(),trace:a.getTraceContext()},meta:r.value},f={message:p.payload.message,level:p.payload.level,context:p.payload.context};if(!d&&i.dedupe&&!s(l)&&S(f,l))return void t.debug("Skipping log push because it is the same as the last one\n",p.payload);l=f,t.debug("Pushing log\n",p),o.execute(p)}catch(e){t.error("Error pushing log\n",e)}}}}(0,t,i,r,o,a)),function(n,t,i,r,o,a){t.debug("Initializing measurements API");let l=null;return{pushMeasurement:(n,{skipDedupe:u,context:c}={})=>{var d;try{const p={type:e.TransportItemType.MEASUREMENT,payload:Object.assign(Object.assign({},n),{trace:a.getTraceContext(),timestamp:null!==(d=n.timestamp)&&void 0!==d?d:E(),context:null!=c?c:{}}),meta:r.value},f={type:p.payload.type,values:p.payload.values,context:p.payload.context};if(!u&&i.dedupe&&!s(l)&&S(f,l))return void t.debug("Skipping measurement push because it is the same as the last one\n",p.payload);l=f,t.debug("Pushing measurement\n",p),o.execute(p)}catch(e){t.error("Error pushing measurement\n",e)}}}}(0,t,i,r,o,a)),function(n,t,i,r,o,a){let l=null;return{pushEvent:(n,u,c,{skipDedupe:d}={})=>{try{const p={meta:r.value,payload:{name:n,domain:null!=c?c:i.eventDomain,attributes:u,timestamp:E(),trace:a.getTraceContext()},type:e.TransportItemType.EVENT},f={name:p.payload.name,attributes:p.payload.attributes,domain:p.payload.domain};if(!d&&i.dedupe&&!s(l)&&S(f,l))return void t.debug("Skipping event push because it is the same as the last one\n",p.payload);l=f,t.debug("Pushing event\n",p),o.execute(p)}catch(e){t.error("Error pushing event",e)}}}}(0,t,i,r,o,a))}const se="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof self?self:void 0;class oe extends Q{constructor(){super(...arguments),this.api={},this.transports={}}}const ae="1.2.8";const le="_faroInternal";function ue(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(se,le,{configurable:!1,enumerable:!1,writable:!1,value:e}))}function ce(){return le in se}function de(n,t,i,r,s,o,a){return t.debug("Initializing Faro"),e.faro={api:o,config:i,instrumentations:a,internalLogger:t,metas:r,pause:s.pause,transports:s,unpatchedConsole:n,unpause:s.unpause},ue(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 se)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(se,e.config.globalObjectKey,{configurable:!1,writable:!1,value:e})}}(e.faro),e.faro}function pe(e){const n=H(e),t=Z(n,e);if(ce()&&!e.isolate)return void t.error('Faro is already registered. Either add instrumentations, transports etc. to the global faro instance or use the "isolate" property');t.debug("Initializing");const i=function(e,n,t){let i=[],r=[];const s=()=>i.reduce(((e,n)=>Object.assign(e,u(n)?n():n)),{}),o=()=>{if(r.length){const e=s();r.forEach((n=>n(e)))}};return{add:(...e)=>{n.debug("Adding metas\n",e),i.push(...e),o()},remove:(...e)=>{n.debug("Removing metas\n",e),i=i.filter((n=>!e.includes(n))),o()},addListener:e=>{n.debug("Adding metas listener\n",e),r.push(e)},removeListener:e=>{n.debug("Removing metas listener\n",e),r=r.filter((n=>n!==e))},get value(){return s()}}}(0,t),r=function(e,n,t,i){var r;n.debug("Initializing transports");const s=[];let o=t.paused,a=[];const l=e=>{let n=e;for(const e of a){const t=n.map(e).filter(Boolean);if(0===t.length)return[];n=t}return n},u=e=>{const t=l(e);if(0!==t.length)for(const e of s)n.debug(`Transporting item using ${e.name}\n`,t),e.isBatched()&&e.send(t)},c=e=>{var i;const[r]=l([e]);if(void 0!==r)for(const e of s)n.debug(`Transporting item using ${e.name}\n`,r),e.isBatched()?(null===(i=t.batching)||void 0===i?void 0:i.enabled)||e.send([r]):e.send(r)};let d;return(null===(r=t.batching)||void 0===r?void 0:r.enabled)&&(d=new B(u,{sendTimeout:t.batching.sendTimeout,itemLimit:t.batching.itemLimit,paused:o})),{add:(...r)=>{n.debug("Adding transports"),r.forEach((r=>{n.debug(`Adding "${r.name}" transport`),s.some((e=>e===r))?n.warn(`Transport ${r.name} is already added`):(r.unpatchedConsole=e,r.internalLogger=n,r.config=t,r.metas=i,s.push(r))}))},addBeforeSendHooks:(...e)=>{n.debug("Adding beforeSendHooks\n",a),e.forEach((e=>{e&&a.push(e)}))},addIgnoreErrorsPatterns:(...e)=>{n.debug("Adding ignoreErrorsPatterns\n",e),e.forEach((e=>{e&&a.push($(e))}))},getBeforeSendHooks:()=>[...a],execute:e=>{var n;o||((null===(n=t.batching)||void 0===n?void 0:n.enabled)?(null==d||d.addItem(e),c(e)):c(e))},isPaused:()=>o,pause:()=>{n.debug("Pausing transports"),null==d||d.pause(),o=!0},remove:(...e)=>{n.debug("Removing transports"),e.forEach((e=>{n.debug(`Removing "${e.name}" transport`);const t=s.indexOf(e);-1!==t?s.splice(t,1):n.warn(`Transport "${e.name}" is not added`)}))},removeBeforeSendHooks:(...e)=>{a.filter((n=>!e.includes(n)))},get transports(){return[...s]},unpause:()=>{n.debug("Unpausing transports"),null==d||d.start(),o=!1}}}(n,t,e,i),s=re(0,t,e,i,r),o=function(e,n,t,i,r,s){n.debug("Initializing instrumentations");const o=[];return{add:(...a)=>{n.debug("Adding instrumentations"),a.forEach((a=>{n.debug(`Adding "${a.name}" instrumentation`),o.some((e=>e.name===a.name))?n.warn(`Instrumentation ${a.name} is already added`):(a.unpatchedConsole=e,a.internalLogger=n,a.config=t,a.metas=i,a.transports=r,a.api=s,o.push(a),a.initialize())}))},get instrumentations(){return[...o]},remove:(...e)=>{n.debug("Removing instrumentations"),e.forEach((e=>{var t,i;n.debug(`Removing "${e.name}" instrumentation`);const r=o.reduce(((n,t,i)=>null===n&&t.name===e.name?i:null),null);r?(null===(i=(t=o[r]).destroy)||void 0===i||i.call(t),o.splice(r,1)):n.warn(`Instrumentation "${e.name}" is not added`)}))}}}(n,t,e,i,r,s),a=de(n,t,e,i,r,s,o);return function(e){var n,t;const i={sdk:{version:ae}};let r=e.config.session;(null===(n=e.config.sessionTracking)||void 0===n?void 0:n.enabled)&&(r=e.config.sessionTracking.session),r&&e.api.setSession(r),e.config.app&&(i.app=e.config.app),e.config.user&&(i.user=e.config.user),e.config.view&&(i.view=e.config.view),e.metas.add(i,...null!==(t=e.config.metas)&&void 0!==t?t:[])}(a),function(e){e.transports.add(...e.config.transports),e.transports.addBeforeSendHooks(e.config.beforeSend),e.transports.addIgnoreErrorsPatterns(e.config.ignoreErrors)}(a),function(e){e.instrumentations.add(...e.config.instrumentations)}(a),a}e.faro={};const fe="faro",ge={enabled:!0,sendTimeout:250,itemLimit:50},be="session_start";var ve={exports:{}};!function(e,n){!function(t,i){var r="function",s="undefined",o="object",a="string",l="major",u="model",c="name",d="type",p="vendor",f="version",g="architecture",b="console",v="mobile",m="tablet",h="smarttv",w="wearable",y="embedded",S="Amazon",E="Apple",T="ASUS",x="BlackBerry",k="Browser",I="Chrome",L="Firefox",O="Google",A="Huawei",C="LG",N="Microsoft",j="Motorola",R="Opera",D="Samsung",U="Sharp",M="Sony",P="Xiaomi",_="Zebra",B="Facebook",z="Chromium OS",F="Mac OS",$=function(e){for(var n={},t=0;t<e.length;t++)n[e[t].toUpperCase()]=e[t];return n},V=function(e,n){return typeof e===a&&-1!==q(n).indexOf(q(e))},q=function(e){return e.toLowerCase()},G=function(e,n){if(typeof e===a)return e=e.replace(/^\s\s*/,""),typeof n===s?e:e.substring(0,350)},W=function(e,n){for(var t,s,a,l,u,c,d=0;d<n.length&&!u;){var p=n[d],f=n[d+1];for(t=s=0;t<p.length&&!u&&p[t];)if(u=p[t++].exec(e))for(a=0;a<f.length;a++)c=u[++s],typeof(l=f[a])===o&&l.length>0?2===l.length?typeof l[1]==r?this[l[0]]=l[1].call(this,c):this[l[0]]=l[1]:3===l.length?typeof l[1]!==r||l[1].exec&&l[1].test?this[l[0]]=c?c.replace(l[1],l[2]):i:this[l[0]]=c?l[1].call(this,c,l[2]):i:4===l.length&&(this[l[0]]=c?l[3].call(this,c.replace(l[1],l[2])):i):this[l]=c||i;d+=2}},K=function(e,n){for(var t in n)if(typeof n[t]===o&&n[t].length>0){for(var r=0;r<n[t].length;r++)if(V(n[t][r],e))return"?"===t?i:t}else if(V(n[t],e))return"?"===t?i:t;return e},H={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"},J={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[f,[c,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[f,[c,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[c,f],[/opios[\/ ]+([\w\.]+)/i],[f,[c,R+" Mini"]],[/\bopr\/([\w\.]+)/i],[f,[c,R]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[c,f],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[f,[c,"UC"+k]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[f,[c,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[f,[c,"WeChat"]],[/konqueror\/([\w\.]+)/i],[f,[c,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[f,[c,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[f,[c,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[c,/(.+)/,"$1 Secure "+k],f],[/\bfocus\/([\w\.]+)/i],[f,[c,L+" Focus"]],[/\bopt\/([\w\.]+)/i],[f,[c,R+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[f,[c,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[f,[c,"Dolphin"]],[/coast\/([\w\.]+)/i],[f,[c,R+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[f,[c,"MIUI "+k]],[/fxios\/([-\w\.]+)/i],[f,[c,L]],[/\bqihu|(qi?ho?o?|360)browser/i],[[c,"360 "+k]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[c,/(.+)/,"$1 "+k],f],[/(comodo_dragon)\/([\w\.]+)/i],[[c,/_/g," "],f],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[c,f],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[c],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[c,B],f],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[c,f],[/\bgsa\/([\w\.]+) .*safari\//i],[f,[c,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[f,[c,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[f,[c,I+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[c,I+" WebView"],f],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[f,[c,"Android "+k]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[c,f],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[f,[c,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[f,c],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[c,[f,K,{"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,f],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[c,"Netscape"],f],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[f,[c,L+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[c,f],[/(cobalt)\/([\w\.]+)/i],[c,[f,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[g,"amd64"]],[/(ia32(?=;))/i],[[g,q]],[/((?:i[346]|x)86)[;\)]/i],[[g,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[g,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[g,"armhf"]],[/windows (ce|mobile); ppc;/i],[[g,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[g,/ower/,"",q]],[/(sun4\w)[;\)]/i],[[g,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[g,q]]],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,D],[d,m]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[u,[p,D],[d,v]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[u,[p,E],[d,v]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[u,[p,E],[d,m]],[/(macintosh);/i],[u,[p,E]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[u,[p,U],[d,v]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[u,[p,A],[d,m]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[u,[p,A],[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,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[u,/_/g," "],[p,P],[d,v]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[u,/_/g," "],[p,P],[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,"OPPO"],[d,v]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[u,[p,"Vivo"],[d,v]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[u,[p,"Realme"],[d,v]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[u,[p,j],[d,v]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[u,[p,j],[d,m]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[u,[p,C],[d,m]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[u,[p,C],[d,v]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[u,[p,"Lenovo"],[d,m]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[u,/_/g," "],[p,"Nokia"],[d,v]],[/(pixel c)\b/i],[u,[p,O],[d,m]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[u,[p,O],[d,v]],[/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,M],[d,v]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[u,"Xperia Tablet"],[p,M],[d,m]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[u,[p,"OnePlus"],[d,v]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[u,[p,S],[d,m]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[u,/(.+)/g,"Fire Phone $1"],[p,S],[d,v]],[/(playbook);[-\w\),; ]+(rim)/i],[u,p,[d,m]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[u,[p,x],[d,v]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[u,[p,T],[d,m]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[u,[p,T],[d,v]],[/(nexus 9)/i],[u,[p,"HTC"],[d,m]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[p,[u,/_/g," "],[d,v]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[u,[p,"Acer"],[d,m]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[u,[p,"Meizu"],[d,v]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[p,u,[d,v]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/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,m]],[/(surface duo)/i],[u,[p,N],[d,m]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[u,[p,"Fairphone"],[d,v]],[/(u304aa)/i],[u,[p,"AT&T"],[d,v]],[/\bsie-(\w*)/i],[u,[p,"Siemens"],[d,v]],[/\b(rct\w+) b/i],[u,[p,"RCA"],[d,m]],[/\b(venue[\d ]{2,7}) b/i],[u,[p,"Dell"],[d,m]],[/\b(q(?:mv|ta)\w+) b/i],[u,[p,"Verizon"],[d,m]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[u,[p,"Barnes & Noble"],[d,m]],[/\b(tm\d{3}\w+) b/i],[u,[p,"NuVision"],[d,m]],[/\b(k88) b/i],[u,[p,"ZTE"],[d,m]],[/\b(nx\d{3}j) b/i],[u,[p,"ZTE"],[d,v]],[/\b(gen\d{3}) b.+49h/i],[u,[p,"Swiss"],[d,v]],[/\b(zur\d{3}) b/i],[u,[p,"Swiss"],[d,m]],[/\b((zeki)?tb.*\b) b/i],[u,[p,"Zeki"],[d,m]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[p,"Dragon Touch"],u,[d,m]],[/\b(ns-?\w{0,9}) b/i],[u,[p,"Insignia"],[d,m]],[/\b((nxa|next)-?\w{0,9}) b/i],[u,[p,"NextBook"],[d,m]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[p,"Voice"],u,[d,v]],[/\b(lvtel\-)?(v1[12]) b/i],[[p,"LvTel"],u,[d,v]],[/\b(ph-1) /i],[u,[p,"Essential"],[d,v]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[u,[p,"Envizen"],[d,m]],[/\b(trio[-\w\. ]+) b/i],[u,[p,"MachSpeed"],[d,m]],[/\btu_(1491) b/i],[u,[p,"Rotor"],[d,m]],[/(shield[\w ]+) b/i],[u,[p,"Nvidia"],[d,m]],[/(sprint) (\w+)/i],[p,u,[d,v]],[/(kin\.[onetw]{3})/i],[[u,/\./g," "],[p,N],[d,v]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[u,[p,_],[d,m]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[u,[p,_],[d,v]],[/smart-tv.+(samsung)/i],[p,[d,h]],[/hbbtv.+maple;(\d+)/i],[[u,/^/,"SmartTV"],[p,D],[d,h]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[p,C],[d,h]],[/(apple) ?tv/i],[p,[u,E+" TV"],[d,h]],[/crkey/i],[[u,I+"cast"],[p,O],[d,h]],[/droid.+aft(\w+)( bui|\))/i],[u,[p,S],[d,h]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[u,[p,U],[d,h]],[/(bravia[\w ]+)( bui|\))/i],[u,[p,M],[d,h]],[/(mitv-\w{5}) bui/i],[u,[p,P],[d,h]],[/Hbbtv.*(technisat) (.*);/i],[p,u,[d,h]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[p,G],[u,G],[d,h]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[d,h]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[p,u,[d,b]],[/droid.+; (shield) bui/i],[u,[p,"Nvidia"],[d,b]],[/(playstation [345portablevi]+)/i],[u,[p,M],[d,b]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[u,[p,N],[d,b]],[/((pebble))app/i],[p,u,[d,w]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[u,[p,E],[d,w]],[/droid.+; (glass) \d/i],[u,[p,O],[d,w]],[/droid.+; (wt63?0{2,3})\)/i],[u,[p,_],[d,w]],[/(quest( 2| pro)?)/i],[u,[p,B],[d,w]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[p,[d,y]],[/(aeobc)\b/i],[u,[p,S],[d,y]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[u,[d,v]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[u,[d,m]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[d,m]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[d,v]],[/(android[-\w\. ]{0,9});.+buil/i],[u,[p,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[f,[c,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[f,[c,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[c,f],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[f,c]],os:[[/microsoft (windows) (vista|xp)/i],[c,f],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[c,[f,K,H]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[c,"Windows"],[f,K,H]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[f,/_/g,"."],[c,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[c,F],[f,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[f,c],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[c,f],[/\(bb(10);/i],[f,[c,x]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[f,[c,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[f,[c,L+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[f,[c,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[f,[c,"watchOS"]],[/crkey\/([\d\.]+)/i],[f,[c,I+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[c,z],f],[/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) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[c,f],[/(sunos) ?([\w\.\d]*)/i],[[c,"Solaris"],f],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[c,f]]},X=function(e,n){if(typeof e===o&&(n=e,e=i),!(this instanceof X))return new X(e,n).getResult();var b=typeof t!==s&&t.navigator?t.navigator:i,h=e||(b&&b.userAgent?b.userAgent:""),w=b&&b.userAgentData?b.userAgentData:i,y=n?function(e,n){var t={};for(var i in e)n[i]&&n[i].length%2==0?t[i]=n[i].concat(e[i]):t[i]=e[i];return t}(J,n):J,S=b&&b.userAgent==h;return this.getBrowser=function(){var e,n={};return n[c]=i,n[f]=i,W.call(n,h,y.browser),n[l]=typeof(e=n[f])===a?e.replace(/[^\d\.]/g,"").split(".")[0]:i,S&&b&&b.brave&&typeof b.brave.isBrave==r&&(n[c]="Brave"),n},this.getCPU=function(){var e={};return e[g]=i,W.call(e,h,y.cpu),e},this.getDevice=function(){var e={};return e[p]=i,e[u]=i,e[d]=i,W.call(e,h,y.device),S&&!e[d]&&w&&w.mobile&&(e[d]=v),S&&"Macintosh"==e[u]&&b&&typeof b.standalone!==s&&b.maxTouchPoints&&b.maxTouchPoints>2&&(e[u]="iPad",e[d]=m),e},this.getEngine=function(){var e={};return e[c]=i,e[f]=i,W.call(e,h,y.engine),e},this.getOS=function(){var e={};return e[c]=i,e[f]=i,W.call(e,h,y.os),S&&!e[c]&&w&&"Unknown"!=w.platform&&(e[c]=w.platform.replace(/chrome os/i,z).replace(/macos/i,F)),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 h},this.setUA=function(e){return h=typeof e===a&&e.length>350?G(e,350):e,this},this.setUA(h),this};X.VERSION="1.0.36",X.BROWSER=$([c,f,l]),X.CPU=$([g]),X.DEVICE=$([u,p,d,b,v,h,m,w,y]),X.ENGINE=X.OS=$([c,f]),e.exports&&(n=e.exports=X),n.UAParser=X;var Z=typeof t!==s&&(t.jQuery||t.Zepto);if(Z&&!Z.ua){var Q=new X;Z.ua=Q.getResult(),Z.ua.get=function(){return Q.getUA()},Z.ua.set=function(e){Q.setUA(e);var n=Q.getResult();for(var t in n)Z.ua[t]=n[t]}}}("object"==typeof window?window:N)}(ve,ve.exports);var me=ve.exports;const he=()=>{const e=new me.UAParser,{name:n,version:t}=e.getBrowser(),{name:i,version:r}=e.getOS(),s=e.getUA(),o=navigator.language,a=navigator.userAgent.includes("Mobi"),l=function(){if(!n||!t)return;if("userAgentData"in navigator)return navigator.userAgentData.brands;return}(),u="unknown";return{browser:{name:null!=n?n:u,version:null!=t?t:u,os:`${null!=i?i:u} ${null!=r?r:u}`,userAgent:null!=s?s:u,language:null!=o?o:u,mobile:a,brands:null!=l?l:u}}},we=()=>({page:{url:location.href}}),ye=[he,we];function Se(e){return{id:A(),attributes:e}}const Ee={name:"default"},Te="sessionStorage",xe="localStorage";function ke(n){var t;try{let e;e=window[n];const t="__faro_storage_test__";return e.setItem(t,t),e.removeItem(t),!0}catch(i){return null===(t=e.faro.internalLogger)||void 0===t||t.info(`Web storage of type ${n} is not available. Reason: ${i}`),!1}}function Ie(e,n){return Ne(n)?window[n].getItem(e):null}function Le(e,n,t){if(Ne(t))try{window[t].setItem(e,n)}catch(e){}}function Oe(e,n){Ne(n)&&window[n].removeItem(e)}const Ae=ke(xe),Ce=ke(Te);function Ne(e){return e===xe?Ae:e===Te&&Ce}function je(e,n){let t,i=!1;const r=()=>{null!=t?(e(...t),t=null,setTimeout(r,n)):i=!1};return(...s)=>{i?t=s:(e(...s),i=!0,setTimeout(r,n))}}const Re="__FARO_SESSION__",De=144e5,Ue={enabled:!1,persistent:!1,maxSessionPersistenceTime:147e5};function Me(e){const n=C();return{sessionId:null!=e?e:A(),lastActivity:n,started:n}}function Pe(e){if(null==e)return!1;const n=C();if(!(n-e.started<De))return!1;return n-e.lastActivity<9e5}function _e({fetchUserSession:n,storeUserSession:t}){return function(){var i,r,s,o;if(!n||!t)return;const a=n();if(Pe(a))t(Object.assign(Object.assign({},a),{lastActivity:C()}));else{let n=Be(Me(),a);t(n),null===(i=e.faro.api)||void 0===i||i.setSession(n.sessionMeta),null===(s=null===(r=e.faro.config.sessionTracking)||void 0===r?void 0:r.onSessionChange)||void 0===s||s.call(r,null!==(o=null==a?void 0:a.sessionMeta)&&void 0!==o?o:null,n.sessionMeta)}}}function Be(n,t){var i;const r=Object.assign(Object.assign({},n),{sessionMeta:{id:n.sessionId}}),s=null===(i=e.faro.metas.value.session)||void 0===i?void 0:i.attributes;return(s||null!=t)&&(r.sessionMeta.attributes=Object.assign(Object.assign({},null!=s?s:{}),null!=t?{previousSession:t.sessionId}:{})),r}class ze{constructor(e){this.initialSessionId=e,this.updateSession=je((()=>this.updateUserSession()),1e3),this.updateUserSession=_e({fetchUserSession:ze.fetchUserSession,storeUserSession:ze.storeUserSession}),this.init()}static removeUserSession(){Oe(Re,ze.storageTypeLocal)}static storeUserSession(e){Le(Re,JSON.stringify(e),ze.storageTypeLocal)}static fetchUserSession(){const e=Ie(Re,ze.storageTypeLocal);return e?JSON.parse(e):null}init(){ze.storeUserSession(Me(this.initialSessionId)),document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&this.updateSession()})),window.addEventListener("storage",(n=>{var t,i,r;if(n.key!==Re)return;const s=JSON.parse(null!==(t=n.newValue)&&void 0!==t?t:""),o=JSON.parse(null!==(i=n.oldValue)&&void 0!==i?i:"");s.sessionId!==o.sessionId&&(null===(r=e.faro.api)||void 0===r||r.setSession(s.sessionMeta))})),e.faro.metas.addListener((function(n){const t=n.session,i=ze.fetchUserSession();if(t&&t.id!==(null==i?void 0:i.sessionId)){const n=Be(Me(t.id),i);ze.storeUserSession(n),e.faro.api.setSession(n.sessionMeta)}}))}}ze.storageTypeLocal=xe;class Fe{constructor(e){this.initialSessionId=e,this.updateSession=je((()=>this.updateUserSession()),1e3),this.updateUserSession=_e({fetchUserSession:Fe.fetchUserSession,storeUserSession:Fe.storeUserSession}),this.init()}static removeUserSession(){Oe(Re,Fe.storageTypeSession)}static storeUserSession(e){Le(Re,JSON.stringify(e),Fe.storageTypeSession)}static fetchUserSession(){const e=Ie(Re,Fe.storageTypeSession);return e?JSON.parse(e):null}init(){Fe.storeUserSession(Me(this.initialSessionId)),document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&this.updateSession()})),e.faro.metas.addListener((function(n){const t=n.session,i=Fe.fetchUserSession();if(t&&t.id!==(null==i?void 0:i.sessionId)){const n=Be(Me(t.id),i);Fe.storeUserSession(n),e.faro.api.setSession(n.sessionMeta)}}))}}Fe.storageTypeSession=Te;class $e extends oe{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-session",this.version=ae}sendSessionStartEvent(e){var n,t;const i=e.session;if(i&&i.id!==(null===(n=this.notifiedSession)||void 0===n?void 0:n.id)){if(this.notifiedSession&&this.notifiedSession.id===(null===(t=i.attributes)||void 0===t?void 0:t.previousSession))return this.api.pushEvent("session_extend",{},void 0,{skipDedupe:!0}),void(this.notifiedSession=i);this.notifiedSession=i,this.api.pushEvent(be,{},void 0,{skipDedupe:!0})}}getSessionManagerInstanceByConfiguredStrategy(e){var n;return(null===(n=this.config.sessionTracking)||void 0===n?void 0:n.persistent)&&Ae?new ze(e):Ce?new Fe(e):null}createInitialSessionMeta(e){var n,t,i;let r=(e.persistent?ze:Fe).fetchUserSession();if(e.persistent&&e.maxSessionPersistenceTime&&r){const n=C();r.lastActivity<n-e.maxSessionPersistenceTime&&(ze.removeUserSession(),r=null)}let s=null===(n=e.session)||void 0===n?void 0:n.id,o=null===(t=e.session)||void 0===t?void 0:t.attributes;Pe(r)?(s=null==r?void 0:r.sessionId,o=null===(i=null==r?void 0:r.sessionMeta)||void 0===i?void 0:i.attributes,this.api.pushEvent("session_resume",{},void 0,{skipDedupe:!0})):(s=null!=s?s:Se().id,this.api.pushEvent(be,{},void 0,{skipDedupe:!0}));const a={id:s};return o&&(a.attributes=o),this.notifiedSession=a,a}initialize(){var e,n;this.logDebug("init session instrumentation");const t=this.config.sessionTracking;if(null==t?void 0:t.enabled){const i=this.createInitialSessionMeta(t);this.api.setSession(i);const r=this.getSessionManagerInstanceByConfiguredStrategy(null===(e=this.metas.value.session)||void 0===e?void 0:e.id);null!=r&&(null===(n=this.transports)||void 0===n||n.addBeforeSendHooks(...this.transports.getBeforeSendHooks(),(e=>(null==r||r.updateSession(),e))))}else this.sendSessionStartEvent(this.metas.value);this.metas.addListener(this.sendSessionStartEvent.bind(this))}}class Ve extends oe{constructor(e={}){super(),this.options=e,this.name="@grafana/faro-web-sdk:instrumentation-console",this.version=ae}initialize(){this.logDebug("Initializing\n",this.options),k.filter((e=>{var n;return!(null!==(n=this.options.disabledLevels)&&void 0!==n?n:Ve.defaultDisabledLevels).includes(e)})).forEach((e=>{console[e]=(...n)=>{try{this.api.pushLog(n,{level:e})}catch(e){this.logError(e)}finally{this.unpatchedConsole[e](...n)}}}))}}Ve.defaultDisabledLevels=[e.LogLevel.DEBUG,e.LogLevel.TRACE,e.LogLevel.LOG];const qe=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Ge=/^\s*at (?:(.*\).*?|.*?) ?\((?:address at )?)?((?:file|https?|blob|chrome-extension|address|native|eval|webpack|<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,We=/\((\S*)(?::(\d+))(?::(\d+))\)/,Ke="address at ",He=Ke.length,Je=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension|safari-extension|safari-web-extension|capacitor)?:\/.*?|\[native code]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Xe=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ze="safari-extension",Qe="safari-web-extension",Ye=/Minified React error #\d+;/i;function en(e,n,t,i){const r={filename:e||document.location.href,function:n||"?"};return void 0!==t&&(r.lineno=t),void 0!==i&&(r.colno=i),r}function nn(e,n){const t=null==e?void 0:e.includes(Ze),i=!t&&(null==e?void 0:e.includes(Qe));return t||i?[(null==e?void 0:e.includes("@"))?e.split("@")[0]:e,t?`${Ze}:${n}`:`${Qe}:${n}`]:[e,n]}function tn(e){let n=[];e.stacktrace?n=e.stacktrace.split("\n").filter(((e,n)=>n%2==0)):e.stack&&(n=e.stack.split("\n"));const t=n.reduce(((n,t,i)=>{let r,s,o,l,u;if(r=Ge.exec(t)){if(s=r[1],o=r[2],l=r[3],u=r[4],null==o?void 0:o.startsWith("eval")){const e=We.exec(o);e&&(o=e[1],l=e[2],u=e[3])}o=(null==o?void 0:o.startsWith(Ke))?o.substring(He):o,[s,o]=nn(s,o)}else if(r=Je.exec(t)){if(s=r[1],o=r[3],l=r[4],u=r[5],o&&o.includes(" > eval")){const e=Xe.exec(o);e&&(s=s||"eval",o=e[1],l=e[2])}else 0===i&&!u&&a(e.columnNumber)&&(u=String(e.columnNumber+1));[s,o]=nn(s,o)}return(o||s)&&n.push(en(o,s,l?Number(l):void 0,u?Number(u):void 0)),n}),[]);return Ye.test(e.message)?t.slice(1):t}function rn(e){return{frames:tn(e)}}function sn(e){let n,t,i,r,s=[];if(v(e)&&e.error)n=e.error.message,t=e.error.name,s=tn(e.error);else if((i=m(e))||h(e)){const{name:r,message:s}=e;t=null!=r?r:i?"DOMError":"DOMException",n=s?`${t}: ${s}`:t}else b(e)?(n=e.message,s=tn(e)):(l(e)||(r=f(e)))&&(t=r?e.constructor.name:void 0,n=`Non-Error exception captured with keys: ${Object.keys(e)}`);return[n,t,s]}function on(e){const n=window.onerror;window.onerror=(...t)=>{try{const[i,r,s,a,l]=t;let u,c,d=[];const p=o(i),f=en(r,"?",s,a);l||!p?([u,c,d]=sn(null!=l?l:i),0===d.length&&(d=[f])):p&&([u,c]=function(e){var n,t;const i=e.match(qe),r=null!==(n=null==i?void 0:i[1])&&void 0!==n?n:te;return[null!==(t=null==i?void 0:i[2])&&void 0!==t?t:e,r]}(i),d=[f]),u&&e.pushError(new Error(u),{type:c,stackFrames:d})}finally{null==n||n.apply(window,t)}}}class an extends oe{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-errors",this.version=ae}initialize(){var e;this.logDebug("Initializing"),on(this.api),e=this.api,window.addEventListener("unhandledrejection",(n=>{var t,i;let r,s,o=n;o.reason?o=n.reason:(null===(t=n.detail)||void 0===t?void 0:t.reason)&&(o=null===(i=n.detail)||void 0===i?void 0:i.reason);let a=[];d(o)?(r=`Non-Error promise rejection captured with value: ${String(o)}`,s="UnhandledRejection"):[r,s,a]=sn(o),r&&e.pushError(new Error(r),{type:s,stackFrames:a})}))}}class ln extends oe{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-view",this.version=ae}sendViewChangedEvent(e){const n=e.view;n&&n!==this.notifiedView&&(this.notifiedView=n,this.api.pushEvent("view_changed",{},void 0,{skipDedupe:!0}))}initialize(){this.sendViewChangedEvent(this.metas.value),this.metas.addListener(this.sendViewChangedEvent.bind(this))}}var un,cn,dn,pn,fn,gn=-1,bn=function(e){addEventListener("pageshow",(function(n){n.persisted&&(gn=n.timeStamp,e(n))}),!0)},vn=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},mn=function(){var e=vn();return e&&e.activationStart||0},hn=function(e,n){var t=vn(),i="navigate";return gn>=0?i="back-forward-cache":t&&(document.prerendering||mn()>0?i="prerender":document.wasDiscarded?i="restore":t.type&&(i=t.type.replace(/_/g,"-"))),{name:e,value:void 0===n?-1:n,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:i}},wn=function(e,n,t){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var i=new PerformanceObserver((function(e){Promise.resolve().then((function(){n(e.getEntries())}))}));return i.observe(Object.assign({type:e,buffered:!0},t||{})),i}}catch(e){}},yn=function(e,n,t,i){var r,s;return function(o){n.value>=0&&(o||i)&&((s=n.value-(r||0))||void 0===r)&&(r=n.value,n.delta=s,n.rating=function(e,n){return e>n[1]?"poor":e>n[0]?"needs-improvement":"good"}(n.value,t),e(n))}},Sn=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},En=function(e){var n=function(n){"pagehide"!==n.type&&"hidden"!==document.visibilityState||e(n)};addEventListener("visibilitychange",n,!0),addEventListener("pagehide",n,!0)},Tn=function(e){var n=!1;return function(t){n||(e(t),n=!0)}},xn=-1,kn=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},In=function(e){"hidden"===document.visibilityState&&xn>-1&&(xn="visibilitychange"===e.type?e.timeStamp:0,On())},Ln=function(){addEventListener("visibilitychange",In,!0),addEventListener("prerenderingchange",In,!0)},On=function(){removeEventListener("visibilitychange",In,!0),removeEventListener("prerenderingchange",In,!0)},An=function(){return xn<0&&(xn=kn(),Ln(),bn((function(){setTimeout((function(){xn=kn(),Ln()}),0)}))),{get firstHiddenTime(){return xn}}},Cn=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},Nn=[1800,3e3],jn=function(e,n){n=n||{},Cn((function(){var t,i=An(),r=hn("FCP"),s=wn("paint",(function(e){e.forEach((function(e){"first-contentful-paint"===e.name&&(s.disconnect(),e.startTime<i.firstHiddenTime&&(r.value=Math.max(e.startTime-mn(),0),r.entries.push(e),t(!0)))}))}));s&&(t=yn(e,r,Nn,n.reportAllChanges),bn((function(i){r=hn("FCP"),t=yn(e,r,Nn,n.reportAllChanges),Sn((function(){r.value=performance.now()-i.timeStamp,t(!0)}))})))}))},Rn=[.1,.25],Dn={passive:!0,capture:!0},Un=new Date,Mn=function(e,n){un||(un=n,cn=e,dn=new Date,Bn(removeEventListener),Pn())},Pn=function(){if(cn>=0&&cn<dn-Un){var e={entryType:"first-input",name:un.type,target:un.target,cancelable:un.cancelable,startTime:un.timeStamp,processingStart:un.timeStamp+cn};pn.forEach((function(n){n(e)})),pn=[]}},_n=function(e){if(e.cancelable){var n=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,n){var t=function(){Mn(e,n),r()},i=function(){r()},r=function(){removeEventListener("pointerup",t,Dn),removeEventListener("pointercancel",i,Dn)};addEventListener("pointerup",t,Dn),addEventListener("pointercancel",i,Dn)}(n,e):Mn(n,e)}},Bn=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(n){return e(n,_n,Dn)}))},zn=[100,300],Fn=0,$n=1/0,Vn=0,qn=function(e){e.forEach((function(e){e.interactionId&&($n=Math.min($n,e.interactionId),Vn=Math.max(Vn,e.interactionId),Fn=Vn?(Vn-$n)/7+1:0)}))},Gn=function(){return fn?Fn:performance.interactionCount||0},Wn=function(){"interactionCount"in performance||fn||(fn=wn("event",qn,{type:"event",buffered:!0,durationThreshold:0}))},Kn=[200,500],Hn=0,Jn=function(){return Gn()-Hn},Xn=[],Zn={},Qn=function(e){var n=Xn[Xn.length-1],t=Zn[e.interactionId];if(t||Xn.length<10||e.duration>n.latency){if(t)t.entries.push(e),t.latency=Math.max(t.latency,e.duration);else{var i={id:e.interactionId,latency:e.duration,entries:[e]};Zn[i.id]=i,Xn.push(i)}Xn.sort((function(e,n){return n.latency-e.latency})),Xn.splice(10).forEach((function(e){delete Zn[e.id]}))}},Yn=[2500,4e3],et={},nt=[800,1800],tt=function e(n){document.prerendering?Cn((function(){return e(n)})):"complete"!==document.readyState?addEventListener("load",(function(){return e(n)}),!0):setTimeout(n,0)};class it extends oe{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-web-vitals",this.version=ae}initialize(){this.logDebug("Initializing"),Object.entries(it.mapping).forEach((([e,n])=>{n((n=>{this.api.pushMeasurement({type:"web-vitals",values:{[e]:n.value}})}))}))}}function rt(e={}){const n=[new an,new it,new $e,new ln];return!1!==e.captureConsole&&n.push(new Ve({disabledLevels:e.captureConsoleDisabledLevels})),n}it.mapping={cls:function(e,n){n=n||{},jn(Tn((function(){var t,i=hn("CLS",0),r=0,s=[],o=function(e){e.forEach((function(e){if(!e.hadRecentInput){var n=s[0],t=s[s.length-1];r&&e.startTime-t.startTime<1e3&&e.startTime-n.startTime<5e3?(r+=e.value,s.push(e)):(r=e.value,s=[e])}})),r>i.value&&(i.value=r,i.entries=s,t())},a=wn("layout-shift",o);a&&(t=yn(e,i,Rn,n.reportAllChanges),En((function(){o(a.takeRecords()),t(!0)})),bn((function(){r=0,i=hn("CLS",0),t=yn(e,i,Rn,n.reportAllChanges),Sn((function(){return t()}))})),setTimeout(t,0))})))},fcp:jn,fid:function(e,n){n=n||{},Cn((function(){var t,i=An(),r=hn("FID"),s=function(e){e.startTime<i.firstHiddenTime&&(r.value=e.processingStart-e.startTime,r.entries.push(e),t(!0))},o=function(e){e.forEach(s)},a=wn("first-input",o);t=yn(e,r,zn,n.reportAllChanges),a&&En(Tn((function(){o(a.takeRecords()),a.disconnect()}))),a&&bn((function(){var i;r=hn("FID"),t=yn(e,r,zn,n.reportAllChanges),pn=[],cn=-1,un=null,Bn(addEventListener),i=s,pn.push(i),Pn()}))}))},inp:function(e,n){n=n||{},Cn((function(){var t;Wn();var i,r=hn("INP"),s=function(e){e.forEach((function(e){e.interactionId&&Qn(e),"first-input"===e.entryType&&!Xn.some((function(n){return n.entries.some((function(n){return e.duration===n.duration&&e.startTime===n.startTime}))}))&&Qn(e)}));var n,t=(n=Math.min(Xn.length-1,Math.floor(Jn()/50)),Xn[n]);t&&t.latency!==r.value&&(r.value=t.latency,r.entries=t.entries,i())},o=wn("event",s,{durationThreshold:null!==(t=n.durationThreshold)&&void 0!==t?t:40});i=yn(e,r,Kn,n.reportAllChanges),o&&("interactionId"in PerformanceEventTiming.prototype&&o.observe({type:"first-input",buffered:!0}),En((function(){s(o.takeRecords()),r.value<0&&Jn()>0&&(r.value=0,r.entries=[]),i(!0)})),bn((function(){Xn=[],Hn=Gn(),r=hn("INP"),i=yn(e,r,Kn,n.reportAllChanges)})))}))},lcp:function(e,n){n=n||{},Cn((function(){var t,i=An(),r=hn("LCP"),s=function(e){var n=e[e.length-1];n&&n.startTime<i.firstHiddenTime&&(r.value=Math.max(n.startTime-mn(),0),r.entries=[n],t())},o=wn("largest-contentful-paint",s);if(o){t=yn(e,r,Yn,n.reportAllChanges);var a=Tn((function(){et[r.id]||(s(o.takeRecords()),o.disconnect(),et[r.id]=!0,t(!0))}));["keydown","click"].forEach((function(e){addEventListener(e,(function(){return setTimeout(a,0)}),!0)})),En(a),bn((function(i){r=hn("LCP"),t=yn(e,r,Yn,n.reportAllChanges),Sn((function(){r.value=performance.now()-i.timeStamp,et[r.id]=!0,t(!0)}))}))}}))},ttfb:function(e,n){n=n||{};var t=hn("TTFB"),i=yn(e,t,nt,n.reportAllChanges);tt((function(){var r=vn();if(r){var s=r.responseStart;if(s<=0||s>performance.now())return;t.value=Math.max(s-mn(),0),t.entries=[r],i(!0),bn((function(){t=hn("TTFB",0),(i=yn(e,t,nt,n.reportAllChanges))(!0)}))}}))}};const st="browser",ot=()=>({k6:{isK6Browser:!0}});function at(e,n,t,i){return new(t||(t=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var n;e.done?r(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(o,a)}l((i=i.apply(e,n||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class lt extends Y{constructor(e){var n,t,i,r;super(),this.options=e,this.name="@grafana/faro-web-sdk:transport-fetch",this.version=ae,this.disabledUntil=new Date,this.rateLimitBackoffMs=null!==(n=e.defaultRateLimitBackoffMs)&&void 0!==n?n:5e3,this.getNow=null!==(t=e.getNow)&&void 0!==t?t:()=>Date.now(),this.promiseBuffer=L({size:null!==(i=e.bufferSize)&&void 0!==i?i:30,concurrency:null!==(r=e.concurrency)&&void 0!==r?r:5})}send(e){return at(this,void 0,void 0,(function*(){try{if(this.disabledUntil>new Date(this.getNow()))return this.logWarn(`Dropping transport item due to too many requests. Backoff until ${this.disabledUntil}`),Promise.resolve();yield this.promiseBuffer.add((()=>{var n;const t=JSON.stringify(ne(e)),{url:i,requestOptions:r,apiKey:s}=this.options,o=null!=r?r:{},{headers:a}=o,l=function(e,n){var t={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&n.indexOf(i)<0&&(t[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)n.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(t[i[r]]=e[i[r]])}return t}(o,["headers"]),u=null===(n=this.metas.value.session)||void 0===n?void 0:n.id;return fetch(i,Object.assign({method:"POST",headers:Object.assign(Object.assign(Object.assign({"Content-Type":"application/json"},null!=a?a:{}),s?{"x-api-key":s}:{}),u?{"x-faro-session-id":u}:{}),body:t,keepalive:t.length<=6e4},null!=l?l:{})).then((e=>(429===e.status&&(this.disabledUntil=this.getRetryAfterDate(e),this.logWarn(`Too many requests, backing off until ${this.disabledUntil}`)),e.text().catch(I),e))).catch((e=>{this.logError("Failed sending payload to the receiver\n",JSON.parse(t),e)}))}))}catch(e){this.logError(e)}}))}getIgnoreUrls(){return[this.options.url]}isBatched(){return!0}getRetryAfterDate(e){const n=this.getNow(),t=e.headers.get("Retry-After");if(t){const e=Number(t);if(!isNaN(e))return new Date(1e3*e+n);const i=Date.parse(t);if(!isNaN(i))return new Date(i)}return new Date(n+this.rateLimitBackoffMs)}}function ut(e){var n,t,i,r,s,o,a,u,c,d,p;const f=[],g=J(e.unpatchedConsole,e.internalLoggerLevel);e.transports?((e.url||e.apiKey)&&g.error('if "transports" is defined, "url" and "apiKey" should not be defined'),f.push(...e.transports)):e.url?f.push(new lt({url:e.url,apiKey:e.apiKey})):g.error('either "url" or "transports" must be defined');const b={app:e.app,batching:Object.assign(Object.assign({},ge),e.batching),dedupe:null===(n=e.dedupe)||void 0===n||n,globalObjectKey:e.globalObjectKey||fe,instrumentations:null!==(t=e.instrumentations)&&void 0!==t?t:rt(),internalLoggerLevel:null!==(i=e.internalLoggerLevel)&&void 0!==i?i:G,isolate:null!==(r=e.isolate)&&void 0!==r&&r,metas:function(){const n=ye;return e.metas&&n.push(...e.metas),l(window.k6)?[...n,ot]:n}(),parseStacktrace:rn,paused:null!==(s=e.paused)&&void 0!==s&&s,preventGlobalExposure:null!==(o=e.preventGlobalExposure)&&void 0!==o&&o,transports:f,unpatchedConsole:null!==(a=e.unpatchedConsole)&&void 0!==a?a:W,beforeSend:e.beforeSend,eventDomain:null!==(u=e.eventDomain)&&void 0!==u?u:st,ignoreErrors:e.ignoreErrors,sessionTracking:Object.assign(Object.assign({},Ue),e.sessionTracking),session:null!==(c=e.session)&&void 0!==c?c:Se(),user:e.user,view:null!==(d=e.view)&&void 0!==d?d:Ee};return(null===(p=b.sessionTracking)||void 0===p?void 0:p.enabled)&&delete b.session,b}return e.BaseExtension=Q,e.BaseInstrumentation=oe,e.BaseTransport=Y,e.ConsoleInstrumentation=Ve,e.ConsoleTransport=class extends Y{constructor(e={}){super(),this.options=e,this.name="@grafana/faro-web-sdk:transport-console",this.version=ae}send(n){var t;return this.unpatchedConsole[null!==(t=this.options.level)&&void 0!==t?t:e.LogLevel.DEBUG]("New event",ne([n]))}},e.Conventions={EventNames:{CLICK:"click",NAVIGATION:"navigation",SESSION_START:"session_start",VIEW_CHANGED:"view_changed"}},e.ErrorsInstrumentation=an,e.FetchTransport=lt,e.SessionInstrumentation=$e,e.VERSION=ae,e.ViewInstrumentation=ln,e.WebVitalsInstrumentation=it,e.allLogLevels=k,e.browserMeta=he,e.buildStackFrame=en,e.createInternalLogger=J,e.createPromiseBuffer=L,e.createSession=Se,e.deepEqual=S,e.defaultEventDomain=st,e.defaultExceptionType=te,e.defaultGlobalObjectKey=fe,e.defaultInternalLoggerLevel=G,e.defaultLogLevel=x,e.defaultMetas=ye,e.defaultViewMeta=Ee,e.genShortID=A,e.getCurrentTimestamp=E,e.getDataFromSafariExtensions=nn,e.getInternalFaroFromGlobalObject=function(){return se[le]},e.getStackFramesFromError=tn,e.getTransportBody=ne,e.getWebInstrumentations=rt,e.globalObject=se,e.initializeFaro=function(e){const n=ut(e);if(n)return pe(n)},e.internalGlobalObjectKey=le,e.isArray=c,e.isBoolean=e=>n(e,"boolean"),e.isDomError=m,e.isDomException=h,e.isElement=e=>w&&i(e,Element),e.isElementDefined=w,e.isError=b,e.isErrorDefined=g,e.isErrorEvent=v,e.isEvent=f,e.isEventDefined=p,e.isFunction=u,e.isInstanceOf=i,e.isInt=e=>a(e)&&Number.isInteger(e),e.isInternalFaroOnGlobalObject=ce,e.isMap=e=>y&&i(e,Map),e.isMapDefined=y,e.isNull=s,e.isNumber=a,e.isObject=l,e.isPrimitive=d,e.isRegExp=e=>t(e,"RegExp"),e.isString=o,e.isSymbol=e=>n(e,"symbol"),e.isSyntheticEvent=e=>l(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e,e.isThenable=e=>u(null==e?void 0:e.then),e.isToString=t,e.isTypeof=n,e.isUndefined=r,e.makeCoreConfig=ut,e.noop=I,e.pageMeta=we,e.parseStacktrace=rn,e.sdkMeta=()=>({sdk:{name:"@grafana/faro-core",version:ae,integrations:e.faro.config.instrumentations.map((({name:e,version:n})=>({name:e,version:n})))}}),e.setInternalFaroOnGlobalObject=ue,e.transportItemTypeToBodyKey=F,e}({}); | ||
var GrafanaFaroWebSdk=function(e){"use strict";function n(e,n){var t={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&n.indexOf(i)<0&&(t[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(e);s<i.length;s++)n.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(t[i[s]]=e[i[s]])}return t}function t(e,n,t,i){return new(t||(t=Promise))((function(s,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var n;e.done?s(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(o,a)}l((i=i.apply(e,n||[])).next())}))}function i(e,n){return typeof e===n}function s(e,n){return Object.prototype.toString.call(e)===`[object ${n}]`}function r(e,n){try{return e instanceof n}catch(e){return!1}}"function"==typeof SuppressedError&&SuppressedError;const o=e=>i(e,"undefined"),a=e=>i(e,"null"),l=e=>i(e,"string"),u=e=>i(e,"number")&&!isNaN(e)||i(e,"bigint"),c=e=>!a(e)&&i(e,"object"),d=e=>i(e,"function"),p=e=>s(e,"Array"),f=e=>!c(e)&&!d(e),g=!o(Event),b=e=>g&&r(e,Event),m="undefined"!=typeof Error,v=e=>m&&r(e,Error),h=e=>s(e,"ErrorEvent"),w=e=>s(e,"DOMError"),y=e=>s(e,"DOMException"),S="undefined"!=typeof Element,E="undefined"!=typeof Map;function T(e,n){if(e===n)return!0;if(i(e,"number")&&isNaN(e))return i(n,"number")&&isNaN(n);const t=p(e),s=p(n);if(t!==s)return!1;if(t&&s){const t=e.length;if(t!==n.length)return!1;for(let i=t;0!=i--;)if(!T(e[i],n[i]))return!1;return!0}const r=c(e),o=c(n);if(r!==o)return!1;if(e&&n&&r&&o){const t=Object.keys(e),i=Object.keys(n);if(t.length!==i.length)return!1;for(let e of t)if(!i.includes(e))return!1;for(let i of t)if(!T(e[i],n[i]))return!1;return!0}return!1}function x(){return(new Date).toISOString()}var k;e.LogLevel=void 0,(k=e.LogLevel||(e.LogLevel={})).TRACE="trace",k.DEBUG="debug",k.INFO="info",k.LOG="log",k.WARN="warn",k.ERROR="error";const I=e.LogLevel.LOG,O=[e.LogLevel.TRACE,e.LogLevel.DEBUG,e.LogLevel.INFO,e.LogLevel.LOG,e.LogLevel.WARN,e.LogLevel.ERROR];function L(){}function A(e){const{size:n,concurrency:t}=e,i=[];let s=0;const r=()=>{if(s<t&&i.length){const{producer:e,resolve:n,reject:t}=i.shift();s++,e().then((e=>{s--,r(),n(e)}),(e=>{s--,r(),t(e)}))}};return{add:e=>{if(i.length+s>=n)throw new Error("Task buffer full");return new Promise(((n,t)=>{i.push({producer:e,resolve:n,reject:t}),r()}))}}}const C="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789";function N(e=10){return Array.from(Array(e)).map((()=>C[Math.floor(Math.random()*C.length)])).join("")}function j(){return Date.now()}var R="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},M={exports:{}},_={exports:{}};_.exports=function(e,n){var t,i,s,r,o,a,l,u;for(t=3&e.length,i=e.length-t,s=n,o=3432918353,a=461845907,u=0;u<i;)l=255&e.charCodeAt(u)|(255&e.charCodeAt(++u))<<8|(255&e.charCodeAt(++u))<<16|(255&e.charCodeAt(++u))<<24,++u,s=27492+(65535&(r=5*(65535&(s=(s^=l=(65535&(l=(l=(65535&l)*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<13|s>>>19))+((5*(s>>>16)&65535)<<16)&4294967295))+((58964+(r>>>16)&65535)<<16);switch(l=0,t){case 3:l^=(255&e.charCodeAt(u+2))<<16;case 2:l^=(255&e.charCodeAt(u+1))<<8;case 1:s^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(u)))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295}return s^=e.length,s=2246822507*(65535&(s^=s>>>16))+((2246822507*(s>>>16)&65535)<<16)&4294967295,s=3266489909*(65535&(s^=s>>>13))+((3266489909*(s>>>16)&65535)<<16)&4294967295,(s^=s>>>16)>>>0};var D=_.exports,U={exports:{}};!function(e){e.exports=function(e,n){for(var t,i=e.length,s=n^i,r=0;i>=4;)t=1540483477*(65535&(t=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+((1540483477*(t>>>16)&65535)<<16),s=1540483477*(65535&s)+((1540483477*(s>>>16)&65535)<<16)^(t=1540483477*(65535&(t^=t>>>24))+((1540483477*(t>>>16)&65535)<<16)),i-=4,++r;switch(i){case 3:s^=(255&e.charCodeAt(r+2))<<16;case 2:s^=(255&e.charCodeAt(r+1))<<8;case 1:s=1540483477*(65535&(s^=255&e.charCodeAt(r)))+((1540483477*(s>>>16)&65535)<<16)}return s=1540483477*(65535&(s^=s>>>13))+((1540483477*(s>>>16)&65535)<<16),(s^=s>>>15)>>>0}}(U);var P=D,B=U.exports;M.exports=P;var z=M.exports.murmur3=P;M.exports.murmur2=B;class F{constructor(e,n){var t,i;this.signalBuffer=[],this.itemLimit=null!==(t=null==n?void 0:n.itemLimit)&&void 0!==t?t:50,this.sendTimeout=null!==(i=null==n?void 0:n.sendTimeout)&&void 0!==i?i:250,this.paused=(null==n?void 0:n.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 n=new Map;return e.forEach((e=>{const t=z(JSON.stringify(e.meta));let i=n.get(t);i=void 0===i?[e]:[...i,e],n.set(t,i)})),Array.from(n.values())}flush(){if(this.paused||0===this.signalBuffer.length)return;this.groupItems(this.signalBuffer).forEach(this.sendFn),this.signalBuffer=[]}}var $;e.TransportItemType=void 0,($=e.TransportItemType||(e.TransportItemType={})).EXCEPTION="exception",$.LOG="log",$.MEASUREMENT="measurement",$.TRACE="trace",$.EVENT="event";const V={[e.TransportItemType.EXCEPTION]:"exceptions",[e.TransportItemType.LOG]:"logs",[e.TransportItemType.MEASUREMENT]:"measurements",[e.TransportItemType.TRACE]:"traces",[e.TransportItemType.EVENT]:"events"};function q(n){return t=>{if(t.type===e.TransportItemType.EXCEPTION&&t.payload){const e=t.payload,i=`${e.type}: ${e.value}`;if(function(e,n){return e.some((e=>l(e)?n.includes(e):!!n.match(e)))}(n,i))return null}return t}}var G;e.InternalLoggerLevel=void 0,(G=e.InternalLoggerLevel||(e.InternalLoggerLevel={}))[G.OFF=0]="OFF",G[G.ERROR=1]="ERROR",G[G.WARN=2]="WARN",G[G.INFO=3]="INFO",G[G.VERBOSE=4]="VERBOSE";const W={debug:L,error:L,info:L,prefix:"Faro",warn:L},K=e.InternalLoggerLevel.ERROR,H=Object.assign({},console);let X=H;function J(e){var n;return X=null!==(n=e.unpatchedConsole)&&void 0!==n?n:X,X}function Z(n=H,t=K){const i=W;return t>e.InternalLoggerLevel.OFF&&(i.error=t>=e.InternalLoggerLevel.ERROR?function(...e){n.error(`${i.prefix}\n`,...e)}:L,i.warn=t>=e.InternalLoggerLevel.WARN?function(...e){n.warn(`${i.prefix}\n`,...e)}:L,i.info=t>=e.InternalLoggerLevel.INFO?function(...e){n.info(`${i.prefix}\n`,...e)}:L,i.debug=t>=e.InternalLoggerLevel.VERBOSE?function(...e){n.debug(`${i.prefix}\n`,...e)}:L),i}let Y=W;function Q(e,n){return Y=Z(e,n.internalLoggerLevel),Y}class ee{constructor(){this.unpatchedConsole=H,this.internalLogger=W,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 ne extends ee{isBatched(){return!1}getIgnoreUrls(){return[]}}function te(e,n){var t,i;if(void 0===n)return e;if(void 0===e)return{resourceSpans:n};const s=null===(t=e.resourceSpans)||void 0===t?void 0:t[0];if(void 0===s)return e;const r=(null==s?void 0:s.scopeSpans)||[],o=(null===(i=null==n?void 0:n[0])||void 0===i?void 0:i.scopeSpans)||[];return Object.assign(Object.assign({},e),{resourceSpans:[Object.assign(Object.assign({},s),{scopeSpans:[...r,...o]})]})}function ie(n){let t={meta:{}};return void 0!==n[0]&&(t.meta=n[0].meta),n.forEach((n=>{switch(n.type){case e.TransportItemType.LOG:case e.TransportItemType.EVENT:case e.TransportItemType.EXCEPTION:case e.TransportItemType.MEASUREMENT:const i=V[n.type],s=t[i];t=Object.assign(Object.assign({},t),{[i]:void 0===s?[n.payload]:[...s,n.payload]});break;case e.TransportItemType.TRACE:t=Object.assign(Object.assign({},t),{traces:te(t.traces,n.payload.resourceSpans)})}})),t}const se="Error";let re;function oe(n,t,i,s,r){t.debug("Initializing API");const o=function(n,t,i,s,r){let o;return t.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,n)=>{t.debug("Initializing OpenTelemetry"),o={trace:e,context:n}},isOTELInitialized:()=>!!o,pushTraces:n=>{try{const i={type:e.TransportItemType.TRACE,payload:n,meta:s.value};t.debug("Pushing trace\n",i),r.execute(i)}catch(e){t.error("Error pushing trace\n",e)}}}}(0,t,0,s,r);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},o),function(n,t,i,s,r,o){var l;t.debug("Initializing exceptions API");let u=null;re=null!==(l=i.parseStacktrace)&&void 0!==l?l:re;const c=e=>{t.debug("Changing stacktrace parser"),re=null!=e?e:re};return c(i.parseStacktrace),{changeStacktraceParser:c,getStacktraceParser:()=>re,pushError:(n,{skipDedupe:l,stackFrames:c,type:d,context:p}={})=>{d=d||n.name||se;const f={meta:s.value,payload:{type:d,value:n.message,timestamp:x(),trace:o.getTraceContext(),context:null!=p?p:{}},type:e.TransportItemType.EXCEPTION};(null==(c=null!=c?c:n.stack?null==re?void 0:re(n).frames:void 0)?void 0:c.length)&&(f.payload.stacktrace={frames:c});const g={type:f.payload.type,value:f.payload.value,stackTrace:f.payload.stacktrace,context:f.payload.context};l||!i.dedupe||a(u)||!T(g,u)?(u=g,t.debug("Pushing exception\n",f),r.execute(f)):t.debug("Skipping error push because it is the same as the last one\n",f.payload)}}}(0,t,i,s,r,o)),function(e,n,t,i,s){let r,o,a;n.debug("Initializing meta API");const l=e=>{o&&i.remove(o),o={user:e},i.add(o)},u=e=>{r&&i.remove(r),r={session:e},i.add(r)};return{setUser:l,resetUser:l,setSession:u,resetSession:u,getSession:()=>i.value.session,setView:e=>{a&&i.remove(a),a={view:e},i.add(a)},getView:()=>i.value.view}}(0,t,0,s)),function(n,t,i,s,r,o){t.debug("Initializing logs API");let l=null;return{pushLog:(n,{context:u,level:c,skipDedupe:d}={})=>{try{const p={type:e.TransportItemType.LOG,payload:{message:n.map((e=>{try{return String(e)}catch(e){return""}})).join(" "),level:null!=c?c:I,context:null!=u?u:{},timestamp:x(),trace:o.getTraceContext()},meta:s.value},f={message:p.payload.message,level:p.payload.level,context:p.payload.context};if(!d&&i.dedupe&&!a(l)&&T(f,l))return void t.debug("Skipping log push because it is the same as the last one\n",p.payload);l=f,t.debug("Pushing log\n",p),r.execute(p)}catch(e){t.error("Error pushing log\n",e)}}}}(0,t,i,s,r,o)),function(n,t,i,s,r,o){t.debug("Initializing measurements API");let l=null;return{pushMeasurement:(n,{skipDedupe:u,context:c}={})=>{var d;try{const p={type:e.TransportItemType.MEASUREMENT,payload:Object.assign(Object.assign({},n),{trace:o.getTraceContext(),timestamp:null!==(d=n.timestamp)&&void 0!==d?d:x(),context:null!=c?c:{}}),meta:s.value},f={type:p.payload.type,values:p.payload.values,context:p.payload.context};if(!u&&i.dedupe&&!a(l)&&T(f,l))return void t.debug("Skipping measurement push because it is the same as the last one\n",p.payload);l=f,t.debug("Pushing measurement\n",p),r.execute(p)}catch(e){t.error("Error pushing measurement\n",e)}}}}(0,t,i,s,r,o)),function(n,t,i,s,r,o){let l=null;return{pushEvent:(n,u,c,{skipDedupe:d}={})=>{try{const p={meta:s.value,payload:{name:n,domain:null!=c?c:i.eventDomain,attributes:u,timestamp:x(),trace:o.getTraceContext()},type:e.TransportItemType.EVENT},f={name:p.payload.name,attributes:p.payload.attributes,domain:p.payload.domain};if(!d&&i.dedupe&&!a(l)&&T(f,l))return void t.debug("Skipping event push because it is the same as the last one\n",p.payload);l=f,t.debug("Pushing event\n",p),r.execute(p)}catch(e){t.error("Error pushing event",e)}}}}(0,t,i,s,r,o))}const ae="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof self?self:void 0;class le extends ee{constructor(){super(...arguments),this.api={},this.transports={}}}const ue="1.2.9";const ce="_faroInternal";function de(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(ae,ce,{configurable:!1,enumerable:!1,writable:!1,value:e}))}function pe(){return ce in ae}function fe(n,t,i,s,r,o,a){return t.debug("Initializing Faro"),e.faro={api:o,config:i,instrumentations:a,internalLogger:t,metas:s,pause:r.pause,transports:r,unpatchedConsole:n,unpause:r.unpause},de(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 ae)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(ae,e.config.globalObjectKey,{configurable:!1,writable:!1,value:e})}}(e.faro),e.faro}function ge(e){const n=J(e),t=Q(n,e);if(pe()&&!e.isolate)return void t.error('Faro is already registered. Either add instrumentations, transports etc. to the global faro instance or use the "isolate" property');t.debug("Initializing");const i=function(e,n,t){let i=[],s=[];const r=()=>i.reduce(((e,n)=>Object.assign(e,d(n)?n():n)),{}),o=()=>{if(s.length){const e=r();s.forEach((n=>n(e)))}};return{add:(...e)=>{n.debug("Adding metas\n",e),i.push(...e),o()},remove:(...e)=>{n.debug("Removing metas\n",e),i=i.filter((n=>!e.includes(n))),o()},addListener:e=>{n.debug("Adding metas listener\n",e),s.push(e)},removeListener:e=>{n.debug("Removing metas listener\n",e),s=s.filter((n=>n!==e))},get value(){return r()}}}(0,t),s=function(e,n,t,i){var s;n.debug("Initializing transports");const r=[];let o=t.paused,a=[];const l=e=>{let n=e;for(const e of a){const t=n.map(e).filter(Boolean);if(0===t.length)return[];n=t}return n},u=e=>{const t=l(e);if(0!==t.length)for(const e of r)n.debug(`Transporting item using ${e.name}\n`,t),e.isBatched()&&e.send(t)},c=e=>{var i;const[s]=l([e]);if(void 0!==s)for(const e of r)n.debug(`Transporting item using ${e.name}\n`,s),e.isBatched()?(null===(i=t.batching)||void 0===i?void 0:i.enabled)||e.send([s]):e.send(s)};let d;return(null===(s=t.batching)||void 0===s?void 0:s.enabled)&&(d=new F(u,{sendTimeout:t.batching.sendTimeout,itemLimit:t.batching.itemLimit,paused:o})),{add:(...s)=>{n.debug("Adding transports"),s.forEach((s=>{n.debug(`Adding "${s.name}" transport`),r.some((e=>e===s))?n.warn(`Transport ${s.name} is already added`):(s.unpatchedConsole=e,s.internalLogger=n,s.config=t,s.metas=i,r.push(s))}))},addBeforeSendHooks:(...e)=>{n.debug("Adding beforeSendHooks\n",a),e.forEach((e=>{e&&a.push(e)}))},addIgnoreErrorsPatterns:(...e)=>{n.debug("Adding ignoreErrorsPatterns\n",e),e.forEach((e=>{e&&a.push(q(e))}))},getBeforeSendHooks:()=>[...a],execute:e=>{var n;o||((null===(n=t.batching)||void 0===n?void 0:n.enabled)?(null==d||d.addItem(e),c(e)):c(e))},isPaused:()=>o,pause:()=>{n.debug("Pausing transports"),null==d||d.pause(),o=!0},remove:(...e)=>{n.debug("Removing transports"),e.forEach((e=>{n.debug(`Removing "${e.name}" transport`);const t=r.indexOf(e);-1!==t?r.splice(t,1):n.warn(`Transport "${e.name}" is not added`)}))},removeBeforeSendHooks:(...e)=>{a.filter((n=>!e.includes(n)))},get transports(){return[...r]},unpause:()=>{n.debug("Unpausing transports"),null==d||d.start(),o=!1}}}(n,t,e,i),r=oe(0,t,e,i,s),o=function(e,n,t,i,s,r){n.debug("Initializing instrumentations");const o=[];return{add:(...a)=>{n.debug("Adding instrumentations"),a.forEach((a=>{n.debug(`Adding "${a.name}" instrumentation`),o.some((e=>e.name===a.name))?n.warn(`Instrumentation ${a.name} is already added`):(a.unpatchedConsole=e,a.internalLogger=n,a.config=t,a.metas=i,a.transports=s,a.api=r,o.push(a),a.initialize())}))},get instrumentations(){return[...o]},remove:(...e)=>{n.debug("Removing instrumentations"),e.forEach((e=>{var t,i;n.debug(`Removing "${e.name}" instrumentation`);const s=o.reduce(((n,t,i)=>null===n&&t.name===e.name?i:null),null);s?(null===(i=(t=o[s]).destroy)||void 0===i||i.call(t),o.splice(s,1)):n.warn(`Instrumentation "${e.name}" is not added`)}))}}}(n,t,e,i,s,r),a=fe(n,t,e,i,s,r,o);return function(e){var n,t;const i={sdk:{version:ue}};let s=e.config.session;(null===(n=e.config.sessionTracking)||void 0===n?void 0:n.enabled)&&(s=e.config.sessionTracking.session),s&&e.api.setSession(s),e.config.app&&(i.app=e.config.app),e.config.user&&(i.user=e.config.user),e.config.view&&(i.view=e.config.view),e.metas.add(i,...null!==(t=e.config.metas)&&void 0!==t?t:[])}(a),function(e){e.transports.add(...e.config.transports),e.transports.addBeforeSendHooks(e.config.beforeSend),e.transports.addIgnoreErrorsPatterns(e.config.ignoreErrors)}(a),function(e){e.instrumentations.add(...e.config.instrumentations)}(a),a}e.faro={};const be="faro",me={enabled:!0,sendTimeout:250,itemLimit:50},ve="session_start";var he={exports:{}};!function(e,n){!function(t,i){var s="function",r="undefined",o="object",a="string",l="major",u="model",c="name",d="type",p="vendor",f="version",g="architecture",b="console",m="mobile",v="tablet",h="smarttv",w="wearable",y="embedded",S="Amazon",E="Apple",T="ASUS",x="BlackBerry",k="Browser",I="Chrome",O="Firefox",L="Google",A="Huawei",C="LG",N="Microsoft",j="Motorola",R="Opera",M="Samsung",_="Sharp",D="Sony",U="Xiaomi",P="Zebra",B="Facebook",z="Chromium OS",F="Mac OS",$=function(e){for(var n={},t=0;t<e.length;t++)n[e[t].toUpperCase()]=e[t];return n},V=function(e,n){return typeof e===a&&-1!==q(n).indexOf(q(e))},q=function(e){return e.toLowerCase()},G=function(e,n){if(typeof e===a)return e=e.replace(/^\s\s*/,""),typeof n===r?e:e.substring(0,350)},W=function(e,n){for(var t,r,a,l,u,c,d=0;d<n.length&&!u;){var p=n[d],f=n[d+1];for(t=r=0;t<p.length&&!u&&p[t];)if(u=p[t++].exec(e))for(a=0;a<f.length;a++)c=u[++r],typeof(l=f[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]):i:this[l[0]]=c?l[1].call(this,c,l[2]):i:4===l.length&&(this[l[0]]=c?l[3].call(this,c.replace(l[1],l[2])):i):this[l]=c||i;d+=2}},K=function(e,n){for(var t in n)if(typeof n[t]===o&&n[t].length>0){for(var s=0;s<n[t].length;s++)if(V(n[t][s],e))return"?"===t?i:t}else if(V(n[t],e))return"?"===t?i:t;return e},H={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"},X={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[f,[c,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[f,[c,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[c,f],[/opios[\/ ]+([\w\.]+)/i],[f,[c,R+" Mini"]],[/\bopr\/([\w\.]+)/i],[f,[c,R]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[c,f],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[f,[c,"UC"+k]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[f,[c,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[f,[c,"WeChat"]],[/konqueror\/([\w\.]+)/i],[f,[c,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[f,[c,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[f,[c,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[c,/(.+)/,"$1 Secure "+k],f],[/\bfocus\/([\w\.]+)/i],[f,[c,O+" Focus"]],[/\bopt\/([\w\.]+)/i],[f,[c,R+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[f,[c,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[f,[c,"Dolphin"]],[/coast\/([\w\.]+)/i],[f,[c,R+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[f,[c,"MIUI "+k]],[/fxios\/([-\w\.]+)/i],[f,[c,O]],[/\bqihu|(qi?ho?o?|360)browser/i],[[c,"360 "+k]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[c,/(.+)/,"$1 "+k],f],[/(comodo_dragon)\/([\w\.]+)/i],[[c,/_/g," "],f],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[c,f],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[c],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[c,B],f],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[c,f],[/\bgsa\/([\w\.]+) .*safari\//i],[f,[c,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[f,[c,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[f,[c,I+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[c,I+" WebView"],f],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[f,[c,"Android "+k]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[c,f],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[f,[c,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[f,c],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[c,[f,K,{"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,f],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[c,"Netscape"],f],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[f,[c,O+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[c,f],[/(cobalt)\/([\w\.]+)/i],[c,[f,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[g,"amd64"]],[/(ia32(?=;))/i],[[g,q]],[/((?:i[346]|x)86)[;\)]/i],[[g,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[g,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[g,"armhf"]],[/windows (ce|mobile); ppc;/i],[[g,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[g,/ower/,"",q]],[/(sun4\w)[;\)]/i],[[g,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[g,q]]],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,M],[d,v]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[u,[p,M],[d,m]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[u,[p,E],[d,m]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[u,[p,E],[d,v]],[/(macintosh);/i],[u,[p,E]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[u,[p,_],[d,m]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[u,[p,A],[d,v]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[u,[p,A],[d,m]],[/\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,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[u,/_/g," "],[p,U],[d,m]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[u,/_/g," "],[p,U],[d,v]],[/; (\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,"OPPO"],[d,m]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[u,[p,"Vivo"],[d,m]],[/\b(rmx[12]\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[\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,C],[d,v]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[u,[p,C],[d,m]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[u,[p,"Lenovo"],[d,v]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[u,/_/g," "],[p,"Nokia"],[d,m]],[/(pixel c)\b/i],[u,[p,L],[d,v]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[u,[p,L],[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,D],[d,m]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[u,"Xperia Tablet"],[p,D],[d,v]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[u,[p,"OnePlus"],[d,m]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( 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,x],[d,m]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[u,[p,T],[d,v]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[u,[p,T],[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.+; ([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]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[p,u,[d,m]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/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,N],[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]],[/(shield[\w ]+) b/i],[u,[p,"Nvidia"],[d,v]],[/(sprint) (\w+)/i],[p,u,[d,m]],[/(kin\.[onetw]{3})/i],[[u,/\./g," "],[p,N],[d,m]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[u,[p,P],[d,v]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[u,[p,P],[d,m]],[/smart-tv.+(samsung)/i],[p,[d,h]],[/hbbtv.+maple;(\d+)/i],[[u,/^/,"SmartTV"],[p,M],[d,h]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[p,C],[d,h]],[/(apple) ?tv/i],[p,[u,E+" TV"],[d,h]],[/crkey/i],[[u,I+"cast"],[p,L],[d,h]],[/droid.+aft(\w+)( bui|\))/i],[u,[p,S],[d,h]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[u,[p,_],[d,h]],[/(bravia[\w ]+)( bui|\))/i],[u,[p,D],[d,h]],[/(mitv-\w{5}) bui/i],[u,[p,U],[d,h]],[/Hbbtv.*(technisat) (.*);/i],[p,u,[d,h]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[p,G],[u,G],[d,h]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[d,h]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[p,u,[d,b]],[/droid.+; (shield) bui/i],[u,[p,"Nvidia"],[d,b]],[/(playstation [345portablevi]+)/i],[u,[p,D],[d,b]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[u,[p,N],[d,b]],[/((pebble))app/i],[p,u,[d,w]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[u,[p,E],[d,w]],[/droid.+; (glass) \d/i],[u,[p,L],[d,w]],[/droid.+; (wt63?0{2,3})\)/i],[u,[p,P],[d,w]],[/(quest( 2| pro)?)/i],[u,[p,B],[d,w]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[p,[d,y]],[/(aeobc)\b/i],[u,[p,S],[d,y]],[/droid .+?; ([^;]+?)(?: bui|\) 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]],[/(android[-\w\. ]{0,9});.+buil/i],[u,[p,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[f,[c,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[f,[c,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[c,f],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[f,c]],os:[[/microsoft (windows) (vista|xp)/i],[c,f],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[c,[f,K,H]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[c,"Windows"],[f,K,H]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[f,/_/g,"."],[c,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[c,F],[f,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[f,c],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[c,f],[/\(bb(10);/i],[f,[c,x]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[f,[c,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[f,[c,O+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[f,[c,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[f,[c,"watchOS"]],[/crkey\/([\d\.]+)/i],[f,[c,I+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[c,z],f],[/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) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[c,f],[/(sunos) ?([\w\.\d]*)/i],[[c,"Solaris"],f],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[c,f]]},J=function(e,n){if(typeof e===o&&(n=e,e=i),!(this instanceof J))return new J(e,n).getResult();var b=typeof t!==r&&t.navigator?t.navigator:i,h=e||(b&&b.userAgent?b.userAgent:""),w=b&&b.userAgentData?b.userAgentData:i,y=n?function(e,n){var t={};for(var i in e)n[i]&&n[i].length%2==0?t[i]=n[i].concat(e[i]):t[i]=e[i];return t}(X,n):X,S=b&&b.userAgent==h;return this.getBrowser=function(){var e,n={};return n[c]=i,n[f]=i,W.call(n,h,y.browser),n[l]=typeof(e=n[f])===a?e.replace(/[^\d\.]/g,"").split(".")[0]:i,S&&b&&b.brave&&typeof b.brave.isBrave==s&&(n[c]="Brave"),n},this.getCPU=function(){var e={};return e[g]=i,W.call(e,h,y.cpu),e},this.getDevice=function(){var e={};return e[p]=i,e[u]=i,e[d]=i,W.call(e,h,y.device),S&&!e[d]&&w&&w.mobile&&(e[d]=m),S&&"Macintosh"==e[u]&&b&&typeof b.standalone!==r&&b.maxTouchPoints&&b.maxTouchPoints>2&&(e[u]="iPad",e[d]=v),e},this.getEngine=function(){var e={};return e[c]=i,e[f]=i,W.call(e,h,y.engine),e},this.getOS=function(){var e={};return e[c]=i,e[f]=i,W.call(e,h,y.os),S&&!e[c]&&w&&"Unknown"!=w.platform&&(e[c]=w.platform.replace(/chrome os/i,z).replace(/macos/i,F)),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 h},this.setUA=function(e){return h=typeof e===a&&e.length>350?G(e,350):e,this},this.setUA(h),this};J.VERSION="1.0.36",J.BROWSER=$([c,f,l]),J.CPU=$([g]),J.DEVICE=$([u,p,d,b,m,h,v,w,y]),J.ENGINE=J.OS=$([c,f]),e.exports&&(n=e.exports=J),n.UAParser=J;var Z=typeof t!==r&&(t.jQuery||t.Zepto);if(Z&&!Z.ua){var Y=new J;Z.ua=Y.getResult(),Z.ua.get=function(){return Y.getUA()},Z.ua.set=function(e){Y.setUA(e);var n=Y.getResult();for(var t in n)Z.ua[t]=n[t]}}}("object"==typeof window?window:R)}(he,he.exports);var we=he.exports;const ye=()=>{const e=new we.UAParser,{name:n,version:t}=e.getBrowser(),{name:i,version:s}=e.getOS(),r=e.getUA(),o=navigator.language,a=navigator.userAgent.includes("Mobi"),l=function(){if(!n||!t)return;if("userAgentData"in navigator)return navigator.userAgentData.brands;return}(),u="unknown";return{browser:{name:null!=n?n:u,version:null!=t?t:u,os:`${null!=i?i:u} ${null!=s?s:u}`,userAgent:null!=r?r:u,language:null!=o?o:u,mobile:a,brands:null!=l?l:u}}},Se=()=>({page:{url:location.href}}),Ee=[ye,Se];function Te(e){return{id:N(),attributes:e}}const xe={name:"default"},ke="sessionStorage",Ie="localStorage";function Oe(n){var t;try{let e;e=window[n];const t="__faro_storage_test__";return e.setItem(t,t),e.removeItem(t),!0}catch(i){return null===(t=e.faro.internalLogger)||void 0===t||t.info(`Web storage of type ${n} is not available. Reason: ${i}`),!1}}function Le(e,n){return Re(n)?window[n].getItem(e):null}function Ae(e,n,t){if(Re(t))try{window[t].setItem(e,n)}catch(e){}}function Ce(e,n){Re(n)&&window[n].removeItem(e)}const Ne=Oe(Ie),je=Oe(ke);function Re(e){return e===Ie?Ne:e===ke&&je}function Me(e,n){let t,i=!1;const s=()=>{null!=t?(e(...t),t=null,setTimeout(s,n)):i=!1};return(...r)=>{i?t=r:(e(...r),i=!0,setTimeout(s,n))}}function _e(){var n,t,i;const s=e.faro.config.sessionTracking;let r=null!==(i=null!==(t=null===(n=null==s?void 0:s.sampler)||void 0===n?void 0:n.call(s,{metas:e.faro.metas.value}))&&void 0!==t?t:null==s?void 0:s.samplingRate)&&void 0!==i?i:1;if("number"!=typeof r){r=0}return Math.random()<r}const De="__FARO_SESSION__",Ue=144e5,Pe=9e5,Be=96e4,ze={enabled:!1,persistent:!1,maxSessionPersistenceTime:Be};function Fe({sessionId:e=N(),isSampled:n=!0}={}){const t=j();return{sessionId:e,lastActivity:t,started:t,isSampled:n}}function $e(e){if(null==e)return!1;const n=j();if(!(n-e.started<Ue))return!1;return n-e.lastActivity<Pe}function Ve({fetchUserSession:n,storeUserSession:t}){return function(){var i,s,r,o;if(!n||!t)return;const a=n();if($e(a))t(Object.assign(Object.assign({},a),{lastActivity:j()}));else{let n=qe(Fe({isSampled:_e()}),a);t(n),null===(i=e.faro.api)||void 0===i||i.setSession(n.sessionMeta),null===(r=null===(s=e.faro.config.sessionTracking)||void 0===s?void 0:s.onSessionChange)||void 0===r||r.call(s,null!==(o=null==a?void 0:a.sessionMeta)&&void 0!==o?o:null,n.sessionMeta)}}}function qe(n,t){var i,s;return Object.assign(Object.assign({},n),{sessionMeta:{id:n.sessionId,attributes:Object.assign(Object.assign(Object.assign({},null!==(s=null===(i=e.faro.metas.value.session)||void 0===i?void 0:i.attributes)&&void 0!==s?s:{}),null!=t?{previousSession:t.sessionId}:{}),{isSampled:n.isSampled.toString()})}})}class Ge{constructor(){this.updateSession=Me((()=>this.updateUserSession()),1e3),this.updateUserSession=Ve({fetchUserSession:Ge.fetchUserSession,storeUserSession:Ge.storeUserSession}),this.init()}static removeUserSession(){Ce(De,Ge.storageTypeLocal)}static storeUserSession(e){Ae(De,JSON.stringify(e),Ge.storageTypeLocal)}static fetchUserSession(){const e=Le(De,Ge.storageTypeLocal);return e?JSON.parse(e):null}init(){document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&this.updateSession()})),window.addEventListener("storage",(n=>{var t,i,s;if(n.key!==De)return;const r=JSON.parse(null!==(t=n.newValue)&&void 0!==t?t:""),o=JSON.parse(null!==(i=n.oldValue)&&void 0!==i?i:"");r.sessionId!==o.sessionId&&(null===(s=e.faro.api)||void 0===s||s.setSession(r.sessionMeta))})),e.faro.metas.addListener((function(n){const t=n.session,i=Ge.fetchUserSession();if(t&&t.id!==(null==i?void 0:i.sessionId)){const n=qe(Fe({sessionId:t.id,isSampled:_e()}),i);Ge.storeUserSession(n),e.faro.api.setSession(n.sessionMeta)}}))}}Ge.storageTypeLocal=Ie;class We{constructor(){this.updateSession=Me((()=>this.updateUserSession()),1e3),this.updateUserSession=Ve({fetchUserSession:We.fetchUserSession,storeUserSession:We.storeUserSession}),this.init()}static removeUserSession(){Ce(De,We.storageTypeSession)}static storeUserSession(e){Ae(De,JSON.stringify(e),We.storageTypeSession)}static fetchUserSession(){const e=Le(De,We.storageTypeSession);return e?JSON.parse(e):null}init(){document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&this.updateSession()})),e.faro.metas.addListener((function(n){const t=n.session,i=We.fetchUserSession();if(t&&t.id!==(null==i?void 0:i.sessionId)){const n=qe(Fe({sessionId:t.id,isSampled:_e()}),i);We.storeUserSession(n),e.faro.api.setSession(n.sessionMeta)}}))}}We.storageTypeSession=ke;class Ke extends le{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-session",this.version=ue}sendSessionStartEvent(e){var n,t;const i=e.session;if(i&&i.id!==(null===(n=this.notifiedSession)||void 0===n?void 0:n.id)){if(this.notifiedSession&&this.notifiedSession.id===(null===(t=i.attributes)||void 0===t?void 0:t.previousSession))return this.api.pushEvent("session_extend",{},void 0,{skipDedupe:!0}),void(this.notifiedSession=i);this.notifiedSession=i,this.api.pushEvent(ve,{},void 0,{skipDedupe:!0})}}createInitialSessionMeta(e){var n,t,i;let s=(e.persistent?Ge:We).fetchUserSession();if(e.persistent&&e.maxSessionPersistenceTime&&s){const n=j();s.lastActivity<n-e.maxSessionPersistenceTime&&(Ge.removeUserSession(),s=null)}let r=null===(n=e.session)||void 0===n?void 0:n.id,o=null===(t=e.session)||void 0===t?void 0:t.attributes;$e(s)?(r=null==s?void 0:s.sessionId,o=Object.assign(Object.assign({},null===(i=null==s?void 0:s.sessionMeta)||void 0===i?void 0:i.attributes),{isSampled:s.isSampled.toString()}),this.api.pushEvent("session_resume",{},void 0,{skipDedupe:!0})):(r=null!=r?r:Te().id,this.api.pushEvent(ve,{},void 0,{skipDedupe:!0}));return{id:r,attributes:Object.assign({isSampled:_e().toString()},o)}}initialize(){var e,t;this.logDebug("init session instrumentation");const i=this.config.sessionTracking;if(null==i?void 0:i.enabled){const s=(null===(e=this.config.sessionTracking)||void 0===e?void 0:e.persistent)?Ge:We,r=this.createInitialSessionMeta(i);s.storeUserSession(Fe({sessionId:r.id,isSampled:Boolean(r.attributes.isSampled)})),this.notifiedSession=r,this.api.setSession(r);const{updateSession:o}=new s;null===(t=this.transports)||void 0===t||t.addBeforeSendHooks((e=>{var t;o();const i=null===(t=e.meta.session)||void 0===t?void 0:t.attributes;if(i&&Boolean(null==i?void 0:i.isSampled)){const t=n(i,["isSampled"]);return e.meta.session=Object.assign(Object.assign({},e.meta.session),{attributes:t}),e}return null}))}else this.sendSessionStartEvent(this.metas.value);this.metas.addListener(this.sendSessionStartEvent.bind(this))}}class He extends le{constructor(e={}){super(),this.options=e,this.name="@grafana/faro-web-sdk:instrumentation-console",this.version=ue}initialize(){this.logDebug("Initializing\n",this.options),O.filter((e=>{var n;return!(null!==(n=this.options.disabledLevels)&&void 0!==n?n:He.defaultDisabledLevels).includes(e)})).forEach((e=>{console[e]=(...n)=>{try{this.api.pushLog(n,{level:e})}catch(e){this.logError(e)}finally{this.unpatchedConsole[e](...n)}}}))}}He.defaultDisabledLevels=[e.LogLevel.DEBUG,e.LogLevel.TRACE,e.LogLevel.LOG];const Xe=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Je=/^\s*at (?:(.*\).*?|.*?) ?\((?:address at )?)?((?:file|https?|blob|chrome-extension|address|native|eval|webpack|<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Ze=/\((\S*)(?::(\d+))(?::(\d+))\)/,Ye="address at ",Qe=Ye.length,en=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension|safari-extension|safari-web-extension|capacitor)?:\/.*?|\[native code]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,nn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,tn="safari-extension",sn="safari-web-extension",rn=/Minified React error #\d+;/i;function on(e,n,t,i){const s={filename:e||document.location.href,function:n||"?"};return void 0!==t&&(s.lineno=t),void 0!==i&&(s.colno=i),s}function an(e,n){const t=null==e?void 0:e.includes(tn),i=!t&&(null==e?void 0:e.includes(sn));return t||i?[(null==e?void 0:e.includes("@"))?e.split("@")[0]:e,t?`${tn}:${n}`:`${sn}:${n}`]:[e,n]}function ln(e){let n=[];e.stacktrace?n=e.stacktrace.split("\n").filter(((e,n)=>n%2==0)):e.stack&&(n=e.stack.split("\n"));const t=n.reduce(((n,t,i)=>{let s,r,o,a,l;if(s=Je.exec(t)){if(r=s[1],o=s[2],a=s[3],l=s[4],null==o?void 0:o.startsWith("eval")){const e=Ze.exec(o);e&&(o=e[1],a=e[2],l=e[3])}o=(null==o?void 0:o.startsWith(Ye))?o.substring(Qe):o,[r,o]=an(r,o)}else if(s=en.exec(t)){if(r=s[1],o=s[3],a=s[4],l=s[5],o&&o.includes(" > eval")){const e=nn.exec(o);e&&(r=r||"eval",o=e[1],a=e[2])}else 0===i&&!l&&u(e.columnNumber)&&(l=String(e.columnNumber+1));[r,o]=an(r,o)}return(o||r)&&n.push(on(o,r,a?Number(a):void 0,l?Number(l):void 0)),n}),[]);return rn.test(e.message)?t.slice(1):t}function un(e){return{frames:ln(e)}}function cn(e){let n,t,i,s,r=[];if(h(e)&&e.error)n=e.error.message,t=e.error.name,r=ln(e.error);else if((i=w(e))||y(e)){const{name:s,message:r}=e;t=null!=s?s:i?"DOMError":"DOMException",n=r?`${t}: ${r}`:t}else v(e)?(n=e.message,r=ln(e)):(c(e)||(s=b(e)))&&(t=s?e.constructor.name:void 0,n=`Non-Error exception captured with keys: ${Object.keys(e)}`);return[n,t,r]}function dn(e){const n=window.onerror;window.onerror=(...t)=>{try{const[i,s,r,o,a]=t;let u,c,d=[];const p=l(i),f=on(s,"?",r,o);a||!p?([u,c,d]=cn(null!=a?a:i),0===d.length&&(d=[f])):p&&([u,c]=function(e){var n,t;const i=e.match(Xe),s=null!==(n=null==i?void 0:i[1])&&void 0!==n?n:se;return[null!==(t=null==i?void 0:i[2])&&void 0!==t?t:e,s]}(i),d=[f]),u&&e.pushError(new Error(u),{type:c,stackFrames:d})}finally{null==n||n.apply(window,t)}}}class pn extends le{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-errors",this.version=ue}initialize(){var e;this.logDebug("Initializing"),dn(this.api),e=this.api,window.addEventListener("unhandledrejection",(n=>{var t,i;let s,r,o=n;o.reason?o=n.reason:(null===(t=n.detail)||void 0===t?void 0:t.reason)&&(o=null===(i=n.detail)||void 0===i?void 0:i.reason);let a=[];f(o)?(s=`Non-Error promise rejection captured with value: ${String(o)}`,r="UnhandledRejection"):[s,r,a]=cn(o),s&&e.pushError(new Error(s),{type:r,stackFrames:a})}))}}class fn extends le{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-view",this.version=ue}sendViewChangedEvent(e){const n=e.view;n&&n!==this.notifiedView&&(this.notifiedView=n,this.api.pushEvent("view_changed",{},void 0,{skipDedupe:!0}))}initialize(){this.sendViewChangedEvent(this.metas.value),this.metas.addListener(this.sendViewChangedEvent.bind(this))}}var gn,bn,mn,vn,hn,wn=-1,yn=function(e){addEventListener("pageshow",(function(n){n.persisted&&(wn=n.timeStamp,e(n))}),!0)},Sn=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},En=function(){var e=Sn();return e&&e.activationStart||0},Tn=function(e,n){var t=Sn(),i="navigate";return wn>=0?i="back-forward-cache":t&&(document.prerendering||En()>0?i="prerender":document.wasDiscarded?i="restore":t.type&&(i=t.type.replace(/_/g,"-"))),{name:e,value:void 0===n?-1:n,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:i}},xn=function(e,n,t){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var i=new PerformanceObserver((function(e){Promise.resolve().then((function(){n(e.getEntries())}))}));return i.observe(Object.assign({type:e,buffered:!0},t||{})),i}}catch(e){}},kn=function(e,n,t,i){var s,r;return function(o){n.value>=0&&(o||i)&&((r=n.value-(s||0))||void 0===s)&&(s=n.value,n.delta=r,n.rating=function(e,n){return e>n[1]?"poor":e>n[0]?"needs-improvement":"good"}(n.value,t),e(n))}},In=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},On=function(e){var n=function(n){"pagehide"!==n.type&&"hidden"!==document.visibilityState||e(n)};addEventListener("visibilitychange",n,!0),addEventListener("pagehide",n,!0)},Ln=function(e){var n=!1;return function(t){n||(e(t),n=!0)}},An=-1,Cn=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},Nn=function(e){"hidden"===document.visibilityState&&An>-1&&(An="visibilitychange"===e.type?e.timeStamp:0,Rn())},jn=function(){addEventListener("visibilitychange",Nn,!0),addEventListener("prerenderingchange",Nn,!0)},Rn=function(){removeEventListener("visibilitychange",Nn,!0),removeEventListener("prerenderingchange",Nn,!0)},Mn=function(){return An<0&&(An=Cn(),jn(),yn((function(){setTimeout((function(){An=Cn(),jn()}),0)}))),{get firstHiddenTime(){return An}}},_n=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},Dn=[1800,3e3],Un=function(e,n){n=n||{},_n((function(){var t,i=Mn(),s=Tn("FCP"),r=xn("paint",(function(e){e.forEach((function(e){"first-contentful-paint"===e.name&&(r.disconnect(),e.startTime<i.firstHiddenTime&&(s.value=Math.max(e.startTime-En(),0),s.entries.push(e),t(!0)))}))}));r&&(t=kn(e,s,Dn,n.reportAllChanges),yn((function(i){s=Tn("FCP"),t=kn(e,s,Dn,n.reportAllChanges),In((function(){s.value=performance.now()-i.timeStamp,t(!0)}))})))}))},Pn=[.1,.25],Bn={passive:!0,capture:!0},zn=new Date,Fn=function(e,n){gn||(gn=n,bn=e,mn=new Date,qn(removeEventListener),$n())},$n=function(){if(bn>=0&&bn<mn-zn){var e={entryType:"first-input",name:gn.type,target:gn.target,cancelable:gn.cancelable,startTime:gn.timeStamp,processingStart:gn.timeStamp+bn};vn.forEach((function(n){n(e)})),vn=[]}},Vn=function(e){if(e.cancelable){var n=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,n){var t=function(){Fn(e,n),s()},i=function(){s()},s=function(){removeEventListener("pointerup",t,Bn),removeEventListener("pointercancel",i,Bn)};addEventListener("pointerup",t,Bn),addEventListener("pointercancel",i,Bn)}(n,e):Fn(n,e)}},qn=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(n){return e(n,Vn,Bn)}))},Gn=[100,300],Wn=0,Kn=1/0,Hn=0,Xn=function(e){e.forEach((function(e){e.interactionId&&(Kn=Math.min(Kn,e.interactionId),Hn=Math.max(Hn,e.interactionId),Wn=Hn?(Hn-Kn)/7+1:0)}))},Jn=function(){return hn?Wn:performance.interactionCount||0},Zn=function(){"interactionCount"in performance||hn||(hn=xn("event",Xn,{type:"event",buffered:!0,durationThreshold:0}))},Yn=[200,500],Qn=0,et=function(){return Jn()-Qn},nt=[],tt={},it=function(e){var n=nt[nt.length-1],t=tt[e.interactionId];if(t||nt.length<10||e.duration>n.latency){if(t)t.entries.push(e),t.latency=Math.max(t.latency,e.duration);else{var i={id:e.interactionId,latency:e.duration,entries:[e]};tt[i.id]=i,nt.push(i)}nt.sort((function(e,n){return n.latency-e.latency})),nt.splice(10).forEach((function(e){delete tt[e.id]}))}},st=[2500,4e3],rt={},ot=[800,1800],at=function e(n){document.prerendering?_n((function(){return e(n)})):"complete"!==document.readyState?addEventListener("load",(function(){return e(n)}),!0):setTimeout(n,0)};class lt extends le{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-web-vitals",this.version=ue}initialize(){this.logDebug("Initializing"),Object.entries(lt.mapping).forEach((([e,n])=>{n((n=>{this.api.pushMeasurement({type:"web-vitals",values:{[e]:n.value}})}))}))}}function ut(e={}){const n=[new pn,new lt,new Ke,new fn];return!1!==e.captureConsole&&n.push(new He({disabledLevels:e.captureConsoleDisabledLevels})),n}lt.mapping={cls:function(e,n){n=n||{},Un(Ln((function(){var t,i=Tn("CLS",0),s=0,r=[],o=function(e){e.forEach((function(e){if(!e.hadRecentInput){var n=r[0],t=r[r.length-1];s&&e.startTime-t.startTime<1e3&&e.startTime-n.startTime<5e3?(s+=e.value,r.push(e)):(s=e.value,r=[e])}})),s>i.value&&(i.value=s,i.entries=r,t())},a=xn("layout-shift",o);a&&(t=kn(e,i,Pn,n.reportAllChanges),On((function(){o(a.takeRecords()),t(!0)})),yn((function(){s=0,i=Tn("CLS",0),t=kn(e,i,Pn,n.reportAllChanges),In((function(){return t()}))})),setTimeout(t,0))})))},fcp:Un,fid:function(e,n){n=n||{},_n((function(){var t,i=Mn(),s=Tn("FID"),r=function(e){e.startTime<i.firstHiddenTime&&(s.value=e.processingStart-e.startTime,s.entries.push(e),t(!0))},o=function(e){e.forEach(r)},a=xn("first-input",o);t=kn(e,s,Gn,n.reportAllChanges),a&&On(Ln((function(){o(a.takeRecords()),a.disconnect()}))),a&&yn((function(){var i;s=Tn("FID"),t=kn(e,s,Gn,n.reportAllChanges),vn=[],bn=-1,gn=null,qn(addEventListener),i=r,vn.push(i),$n()}))}))},inp:function(e,n){n=n||{},_n((function(){var t;Zn();var i,s=Tn("INP"),r=function(e){e.forEach((function(e){e.interactionId&&it(e),"first-input"===e.entryType&&!nt.some((function(n){return n.entries.some((function(n){return e.duration===n.duration&&e.startTime===n.startTime}))}))&&it(e)}));var n,t=(n=Math.min(nt.length-1,Math.floor(et()/50)),nt[n]);t&&t.latency!==s.value&&(s.value=t.latency,s.entries=t.entries,i())},o=xn("event",r,{durationThreshold:null!==(t=n.durationThreshold)&&void 0!==t?t:40});i=kn(e,s,Yn,n.reportAllChanges),o&&("interactionId"in PerformanceEventTiming.prototype&&o.observe({type:"first-input",buffered:!0}),On((function(){r(o.takeRecords()),s.value<0&&et()>0&&(s.value=0,s.entries=[]),i(!0)})),yn((function(){nt=[],Qn=Jn(),s=Tn("INP"),i=kn(e,s,Yn,n.reportAllChanges)})))}))},lcp:function(e,n){n=n||{},_n((function(){var t,i=Mn(),s=Tn("LCP"),r=function(e){var n=e[e.length-1];n&&n.startTime<i.firstHiddenTime&&(s.value=Math.max(n.startTime-En(),0),s.entries=[n],t())},o=xn("largest-contentful-paint",r);if(o){t=kn(e,s,st,n.reportAllChanges);var a=Ln((function(){rt[s.id]||(r(o.takeRecords()),o.disconnect(),rt[s.id]=!0,t(!0))}));["keydown","click"].forEach((function(e){addEventListener(e,(function(){return setTimeout(a,0)}),!0)})),On(a),yn((function(i){s=Tn("LCP"),t=kn(e,s,st,n.reportAllChanges),In((function(){s.value=performance.now()-i.timeStamp,rt[s.id]=!0,t(!0)}))}))}}))},ttfb:function(e,n){n=n||{};var t=Tn("TTFB"),i=kn(e,t,ot,n.reportAllChanges);at((function(){var s=Sn();if(s){var r=s.responseStart;if(r<=0||r>performance.now())return;t.value=Math.max(r-En(),0),t.entries=[s],i(!0),yn((function(){t=Tn("TTFB",0),(i=kn(e,t,ot,n.reportAllChanges))(!0)}))}}))}};const ct="browser",dt=()=>({k6:{isK6Browser:!0}});class pt extends ne{constructor(e){var n,t,i,s;super(),this.options=e,this.name="@grafana/faro-web-sdk:transport-fetch",this.version=ue,this.disabledUntil=new Date,this.rateLimitBackoffMs=null!==(n=e.defaultRateLimitBackoffMs)&&void 0!==n?n:5e3,this.getNow=null!==(t=e.getNow)&&void 0!==t?t:()=>Date.now(),this.promiseBuffer=A({size:null!==(i=e.bufferSize)&&void 0!==i?i:30,concurrency:null!==(s=e.concurrency)&&void 0!==s?s:5})}send(e){return t(this,void 0,void 0,(function*(){try{if(this.disabledUntil>new Date(this.getNow()))return this.logWarn(`Dropping transport item due to too many requests. Backoff until ${this.disabledUntil}`),Promise.resolve();yield this.promiseBuffer.add((()=>{var t;const i=JSON.stringify(ie(e)),{url:s,requestOptions:r,apiKey:o}=this.options,a=null!=r?r:{},{headers:l}=a,u=n(a,["headers"]),c=null===(t=this.metas.value.session)||void 0===t?void 0:t.id;return fetch(s,Object.assign({method:"POST",headers:Object.assign(Object.assign(Object.assign({"Content-Type":"application/json"},null!=l?l:{}),o?{"x-api-key":o}:{}),c?{"x-faro-session-id":c}:{}),body:i,keepalive:i.length<=6e4},null!=u?u:{})).then((e=>(429===e.status&&(this.disabledUntil=this.getRetryAfterDate(e),this.logWarn(`Too many requests, backing off until ${this.disabledUntil}`)),e.text().catch(L),e))).catch((e=>{this.logError("Failed sending payload to the receiver\n",JSON.parse(i),e)}))}))}catch(e){this.logError(e)}}))}getIgnoreUrls(){return[this.options.url]}isBatched(){return!0}getRetryAfterDate(e){const n=this.getNow(),t=e.headers.get("Retry-After");if(t){const e=Number(t);if(!isNaN(e))return new Date(1e3*e+n);const i=Date.parse(t);if(!isNaN(i))return new Date(i)}return new Date(n+this.rateLimitBackoffMs)}}function ft(e){var n,t,i,s,r,o,a,l,u,d,p;const f=[],g=Z(e.unpatchedConsole,e.internalLoggerLevel);e.transports?((e.url||e.apiKey)&&g.error('if "transports" is defined, "url" and "apiKey" should not be defined'),f.push(...e.transports)):e.url?f.push(new pt({url:e.url,apiKey:e.apiKey})):g.error('either "url" or "transports" must be defined');const b={app:e.app,batching:Object.assign(Object.assign({},me),e.batching),dedupe:null===(n=e.dedupe)||void 0===n||n,globalObjectKey:e.globalObjectKey||be,instrumentations:null!==(t=e.instrumentations)&&void 0!==t?t:ut(),internalLoggerLevel:null!==(i=e.internalLoggerLevel)&&void 0!==i?i:K,isolate:null!==(s=e.isolate)&&void 0!==s&&s,metas:function(){const n=Ee;return e.metas&&n.push(...e.metas),c(window.k6)?[...n,dt]:n}(),parseStacktrace:un,paused:null!==(r=e.paused)&&void 0!==r&&r,preventGlobalExposure:null!==(o=e.preventGlobalExposure)&&void 0!==o&&o,transports:f,unpatchedConsole:null!==(a=e.unpatchedConsole)&&void 0!==a?a:H,beforeSend:e.beforeSend,eventDomain:null!==(l=e.eventDomain)&&void 0!==l?l:ct,ignoreErrors:e.ignoreErrors,sessionTracking:Object.assign(Object.assign({},ze),e.sessionTracking),session:null!==(u=e.session)&&void 0!==u?u:Te(),user:e.user,view:null!==(d=e.view)&&void 0!==d?d:xe};return(null===(p=b.sessionTracking)||void 0===p?void 0:p.enabled)&&delete b.session,b}return e.BaseExtension=ee,e.BaseInstrumentation=le,e.BaseTransport=ne,e.ConsoleInstrumentation=He,e.ConsoleTransport=class extends ne{constructor(e={}){super(),this.options=e,this.name="@grafana/faro-web-sdk:transport-console",this.version=ue}send(n){var t;return this.unpatchedConsole[null!==(t=this.options.level)&&void 0!==t?t:e.LogLevel.DEBUG]("New event",ie([n]))}},e.Conventions={EventNames:{CLICK:"click",NAVIGATION:"navigation",SESSION_START:"session_start",VIEW_CHANGED:"view_changed"}},e.ErrorsInstrumentation=pn,e.FetchTransport=pt,e.MAX_SESSION_PERSISTENCE_TIME=Be,e.MAX_SESSION_PERSISTENCE_TIME_BUFFER=6e4,e.PersistentSessionsManager=Ge,e.SESSION_EXPIRATION_TIME=Ue,e.SESSION_INACTIVITY_TIME=Pe,e.STORAGE_KEY=De,e.SessionInstrumentation=Ke,e.VERSION=ue,e.ViewInstrumentation=fn,e.VolatileSessionsManager=We,e.WebVitalsInstrumentation=lt,e.allLogLevels=O,e.browserMeta=ye,e.buildStackFrame=on,e.createInternalLogger=Z,e.createPromiseBuffer=A,e.createSession=Te,e.deepEqual=T,e.defaultEventDomain=ct,e.defaultExceptionType=se,e.defaultGlobalObjectKey=be,e.defaultInternalLoggerLevel=K,e.defaultLogLevel=I,e.defaultMetas=Ee,e.defaultViewMeta=xe,e.genShortID=N,e.getCurrentTimestamp=x,e.getDataFromSafariExtensions=an,e.getInternalFaroFromGlobalObject=function(){return ae[ce]},e.getStackFramesFromError=ln,e.getTransportBody=ie,e.getWebInstrumentations=ut,e.globalObject=ae,e.initializeFaro=function(e){const n=ft(e);if(n)return ge(n)},e.internalGlobalObjectKey=ce,e.isArray=p,e.isBoolean=e=>i(e,"boolean"),e.isDomError=w,e.isDomException=y,e.isElement=e=>S&&r(e,Element),e.isElementDefined=S,e.isError=v,e.isErrorDefined=m,e.isErrorEvent=h,e.isEvent=b,e.isEventDefined=g,e.isFunction=d,e.isInstanceOf=r,e.isInt=e=>u(e)&&Number.isInteger(e),e.isInternalFaroOnGlobalObject=pe,e.isMap=e=>E&&r(e,Map),e.isMapDefined=E,e.isNull=a,e.isNumber=u,e.isObject=c,e.isPrimitive=f,e.isRegExp=e=>s(e,"RegExp"),e.isString=l,e.isSymbol=e=>i(e,"symbol"),e.isSyntheticEvent=e=>c(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e,e.isThenable=e=>d(null==e?void 0:e.then),e.isToString=s,e.isTypeof=i,e.isUndefined=o,e.makeCoreConfig=ft,e.noop=L,e.pageMeta=Se,e.parseStacktrace=un,e.sdkMeta=()=>({sdk:{name:"@grafana/faro-core",version:ue,integrations:e.faro.config.instrumentations.map((({name:e,version:n})=>({name:e,version:n})))}}),e.setInternalFaroOnGlobalObject=de,e.transportItemTypeToBodyKey=V,e}({}); |
@@ -12,1 +12,2 @@ export { getWebInstrumentations, makeCoreConfig } from './config'; | ||
export type { Faro, API, APIEvent, BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue, BeforeSendHook, BufferItem, Config, EventAttributes, EventEvent, EventsAPI, ExceptionEvent, ExceptionStackFrame, ExceptionsAPI, ExtendedError, Extension, GlobalObject, Instrumentation, Instrumentations, InternalLogger, LogContext, LogEvent, LogsAPI, MeasurementEvent, MeasurementsAPI, Meta, MetaAPI, MetaApp, MetaAttributes, MetaBrowser, MetaGetter, MetaItem, MetaPage, Metas, MetaSDK, MetaSDKIntegration, MetaSession, MetaUser, MetaView, OTELApi, Patterns, PromiseBuffer, PromiseBufferOptions, PromiseProducer, PushErrorOptions, PushLogOptions, PushMeasurementOptions, Stacktrace, StacktraceParser, TraceContext, TraceEvent, TracesAPI, Transport, TransportBody, TransportItem, TransportItemPayload, Transports, UnpatchedConsole, } from '@grafana/faro-core'; | ||
export { PersistentSessionsManager, VolatileSessionsManager, MAX_SESSION_PERSISTENCE_TIME, MAX_SESSION_PERSISTENCE_TIME_BUFFER, SESSION_EXPIRATION_TIME, SESSION_INACTIVITY_TIME, STORAGE_KEY, } from './instrumentations/session'; |
@@ -6,3 +6,3 @@ import { BaseInstrumentation, LogLevel } from '@grafana/faro-core'; | ||
readonly name = "@grafana/faro-web-sdk:instrumentation-console"; | ||
readonly version = "1.2.8"; | ||
readonly version = "1.2.9"; | ||
static defaultDisabledLevels: LogLevel[]; | ||
@@ -9,0 +9,0 @@ constructor(options?: ConsoleInstrumentationOptions); |
import { BaseInstrumentation } from '@grafana/faro-core'; | ||
export declare class ErrorsInstrumentation extends BaseInstrumentation { | ||
readonly name = "@grafana/faro-web-sdk:instrumentation-errors"; | ||
readonly version = "1.2.8"; | ||
readonly version = "1.2.9"; | ||
initialize(): void; | ||
} |
@@ -8,1 +8,2 @@ export { SessionInstrumentation } from './session'; | ||
export { WebVitalsInstrumentation } from './webVitals'; | ||
export { PersistentSessionsManager, VolatileSessionsManager, MAX_SESSION_PERSISTENCE_TIME, MAX_SESSION_PERSISTENCE_TIME_BUFFER, SESSION_EXPIRATION_TIME, SESSION_INACTIVITY_TIME, STORAGE_KEY, } from './session'; |
export { SessionInstrumentation } from './instrumentation'; | ||
export * from './sessionManager'; | ||
export { MAX_SESSION_PERSISTENCE_TIME, MAX_SESSION_PERSISTENCE_TIME_BUFFER, PersistentSessionsManager, SESSION_EXPIRATION_TIME, SESSION_INACTIVITY_TIME, STORAGE_KEY, STORAGE_UPDATE_DELAY, VolatileSessionsManager, defaultSessionTrackingConfig, isSampled, } from './sessionManager'; | ||
export type { FaroUserSession } from './sessionManager'; |
import { BaseInstrumentation } from '@grafana/faro-core'; | ||
export declare class SessionInstrumentation extends BaseInstrumentation { | ||
readonly name = "@grafana/faro-web-sdk:instrumentation-session"; | ||
readonly version = "1.2.8"; | ||
readonly version = "1.2.9"; | ||
private notifiedSession; | ||
private sendSessionStartEvent; | ||
private getSessionManagerInstanceByConfiguredStrategy; | ||
private createInitialSessionMeta; | ||
initialize(): void; | ||
} |
export { PersistentSessionsManager } from './PersistentSessionsManager'; | ||
export { VolatileSessionsManager } from './VolatileSessionManager'; | ||
export * from './sessionConstants'; | ||
export { MAX_SESSION_PERSISTENCE_TIME, MAX_SESSION_PERSISTENCE_TIME_BUFFER, SESSION_EXPIRATION_TIME, SESSION_INACTIVITY_TIME, STORAGE_KEY, STORAGE_UPDATE_DELAY, defaultSessionTrackingConfig, } from './sessionConstants'; | ||
export { isSampled } from './sampling'; | ||
export type { FaroUserSession } from './types'; |
import type { FaroUserSession } from './types'; | ||
export declare class PersistentSessionsManager { | ||
private initialSessionId?; | ||
private static storageTypeLocal; | ||
private updateUserSession; | ||
constructor(initialSessionId?: string | undefined); | ||
constructor(); | ||
static removeUserSession(): void; | ||
@@ -8,0 +7,0 @@ static storeUserSession(session: FaroUserSession): void; |
@@ -0,1 +1,2 @@ | ||
import type { Config } from '@grafana/faro-core'; | ||
export declare const STORAGE_KEY = "__FARO_SESSION__"; | ||
@@ -7,6 +8,2 @@ export declare const SESSION_EXPIRATION_TIME: number; | ||
export declare const MAX_SESSION_PERSISTENCE_TIME: number; | ||
export declare const defaultSessionTrackingConfig: { | ||
readonly enabled: false; | ||
readonly persistent: false; | ||
readonly maxSessionPersistenceTime: number; | ||
}; | ||
export declare const defaultSessionTrackingConfig: Config['sessionTracking']; |
import type { FaroUserSession } from './types'; | ||
export declare function createUserSessionObject(sessionId?: string): FaroUserSession; | ||
type CreateUserSessionObjectParams = { | ||
sessionId?: string; | ||
isSampled?: boolean; | ||
}; | ||
export declare function createUserSessionObject({ sessionId, isSampled, }?: CreateUserSessionObjectParams): FaroUserSession; | ||
export declare function isUserSessionValid(session: FaroUserSession | null): boolean; | ||
@@ -4,0 +8,0 @@ type GetUserSessionUpdaterParams = { |
@@ -6,3 +6,4 @@ import type { MetaSession } from '@grafana/faro-core'; | ||
started: number; | ||
isSampled: boolean; | ||
sessionMeta?: MetaSession; | ||
} |
import type { FaroUserSession } from './types'; | ||
export declare class VolatileSessionsManager { | ||
private initialSessionId?; | ||
private static storageTypeSession; | ||
private updateUserSession; | ||
constructor(initialSessionId?: string | undefined); | ||
constructor(); | ||
static removeUserSession(): void; | ||
@@ -8,0 +7,0 @@ static storeUserSession(session: FaroUserSession): void; |
import { BaseInstrumentation } from '@grafana/faro-core'; | ||
export declare class ViewInstrumentation extends BaseInstrumentation { | ||
readonly name = "@grafana/faro-web-sdk:instrumentation-view"; | ||
readonly version = "1.2.8"; | ||
readonly version = "1.2.9"; | ||
private notifiedView; | ||
@@ -6,0 +6,0 @@ private sendViewChangedEvent; |
import { BaseInstrumentation } from '@grafana/faro-core'; | ||
export declare class WebVitalsInstrumentation extends BaseInstrumentation { | ||
readonly name = "@grafana/faro-web-sdk:instrumentation-web-vitals"; | ||
readonly version = "1.2.8"; | ||
readonly version = "1.2.9"; | ||
static mapping: { | ||
@@ -6,0 +6,0 @@ cls: (onReport: import("web-vitals").CLSReportCallback, opts?: import("web-vitals").ReportOpts | undefined) => void; |
@@ -7,5 +7,5 @@ import { BaseTransport } from '@grafana/faro-core'; | ||
readonly name = "@grafana/faro-web-sdk:transport-console"; | ||
readonly version = "1.2.8"; | ||
readonly version = "1.2.9"; | ||
constructor(options?: ConsoleTransportOptions); | ||
send(item: TransportItem): void; | ||
} |
@@ -7,3 +7,3 @@ import { BaseTransport, PromiseBuffer } from '@grafana/faro-core'; | ||
readonly name = "@grafana/faro-web-sdk:transport-fetch"; | ||
readonly version = "1.2.8"; | ||
readonly version = "1.2.9"; | ||
promiseBuffer: PromiseBuffer<Response | void>; | ||
@@ -10,0 +10,0 @@ private readonly rateLimitBackoffMs; |
@@ -1,2 +0,2 @@ | ||
export * from './webStorage'; | ||
export * from './throttle'; | ||
export { isLocalStorageAvailable, isSessionStorageAvailable, webStorageType, getItem, isWebStorageAvailable, removeItem, setItem, } from './webStorage'; | ||
export { throttle } from './throttle'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isEvent = exports.isErrorEvent = exports.isErrorDefined = exports.isError = exports.isElementDefined = exports.isElement = exports.isDomException = exports.isDomError = exports.isBoolean = exports.isArray = exports.internalGlobalObjectKey = exports.globalObject = exports.getTransportBody = exports.getInternalFaroFromGlobalObject = exports.getCurrentTimestamp = exports.genShortID = exports.defaultLogLevel = exports.defaultInternalLoggerLevel = exports.defaultGlobalObjectKey = exports.defaultExceptionType = exports.deepEqual = exports.createPromiseBuffer = exports.createInternalLogger = exports.Conventions = exports.BaseTransport = exports.BaseInstrumentation = exports.BaseExtension = exports.allLogLevels = exports.faro = exports.FetchTransport = exports.ConsoleTransport = exports.sdkMeta = exports.pageMeta = exports.defaultViewMeta = exports.defaultMetas = exports.createSession = exports.browserMeta = exports.SessionInstrumentation = exports.WebVitalsInstrumentation = exports.ViewInstrumentation = exports.parseStacktrace = exports.getStackFramesFromError = exports.getDataFromSafariExtensions = exports.ErrorsInstrumentation = exports.ConsoleInstrumentation = exports.buildStackFrame = exports.initializeFaro = exports.defaultEventDomain = exports.makeCoreConfig = exports.getWebInstrumentations = void 0; | ||
exports.VERSION = exports.transportItemTypeToBodyKey = exports.TransportItemType = exports.setInternalFaroOnGlobalObject = exports.noop = exports.LogLevel = exports.InternalLoggerLevel = exports.isUndefined = exports.isTypeof = exports.isToString = exports.isThenable = exports.isSyntheticEvent = exports.isSymbol = exports.isString = exports.isRegExp = exports.isPrimitive = exports.isObject = exports.isNumber = exports.isNull = exports.isMapDefined = exports.isMap = exports.isInternalFaroOnGlobalObject = exports.isInt = exports.isInstanceOf = exports.isFunction = exports.isEventDefined = void 0; | ||
exports.STORAGE_KEY = exports.SESSION_INACTIVITY_TIME = exports.SESSION_EXPIRATION_TIME = exports.MAX_SESSION_PERSISTENCE_TIME_BUFFER = exports.MAX_SESSION_PERSISTENCE_TIME = exports.VolatileSessionsManager = exports.PersistentSessionsManager = exports.VERSION = exports.transportItemTypeToBodyKey = exports.TransportItemType = exports.setInternalFaroOnGlobalObject = exports.noop = exports.LogLevel = exports.InternalLoggerLevel = exports.isUndefined = exports.isTypeof = exports.isToString = exports.isThenable = exports.isSyntheticEvent = exports.isSymbol = exports.isString = exports.isRegExp = exports.isPrimitive = exports.isObject = exports.isNumber = exports.isNull = exports.isMapDefined = exports.isMap = exports.isInternalFaroOnGlobalObject = exports.isInt = exports.isInstanceOf = exports.isFunction = exports.isEventDefined = void 0; | ||
var config_1 = require("./config"); | ||
@@ -88,2 +88,10 @@ Object.defineProperty(exports, "getWebInstrumentations", { enumerable: true, get: function () { return config_1.getWebInstrumentations; } }); | ||
Object.defineProperty(exports, "VERSION", { enumerable: true, get: function () { return faro_core_1.VERSION; } }); | ||
var session_1 = require("./instrumentations/session"); | ||
Object.defineProperty(exports, "PersistentSessionsManager", { enumerable: true, get: function () { return session_1.PersistentSessionsManager; } }); | ||
Object.defineProperty(exports, "VolatileSessionsManager", { enumerable: true, get: function () { return session_1.VolatileSessionsManager; } }); | ||
Object.defineProperty(exports, "MAX_SESSION_PERSISTENCE_TIME", { enumerable: true, get: function () { return session_1.MAX_SESSION_PERSISTENCE_TIME; } }); | ||
Object.defineProperty(exports, "MAX_SESSION_PERSISTENCE_TIME_BUFFER", { enumerable: true, get: function () { return session_1.MAX_SESSION_PERSISTENCE_TIME_BUFFER; } }); | ||
Object.defineProperty(exports, "SESSION_EXPIRATION_TIME", { enumerable: true, get: function () { return session_1.SESSION_EXPIRATION_TIME; } }); | ||
Object.defineProperty(exports, "SESSION_INACTIVITY_TIME", { enumerable: true, get: function () { return session_1.SESSION_INACTIVITY_TIME; } }); | ||
Object.defineProperty(exports, "STORAGE_KEY", { enumerable: true, get: function () { return session_1.STORAGE_KEY; } }); | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.WebVitalsInstrumentation = exports.ViewInstrumentation = exports.parseStacktrace = exports.getStackFramesFromError = exports.getDataFromSafariExtensions = exports.ErrorsInstrumentation = exports.buildStackFrame = exports.ConsoleInstrumentation = exports.SessionInstrumentation = void 0; | ||
exports.STORAGE_KEY = exports.SESSION_INACTIVITY_TIME = exports.SESSION_EXPIRATION_TIME = exports.MAX_SESSION_PERSISTENCE_TIME_BUFFER = exports.MAX_SESSION_PERSISTENCE_TIME = exports.VolatileSessionsManager = exports.PersistentSessionsManager = exports.WebVitalsInstrumentation = exports.ViewInstrumentation = exports.parseStacktrace = exports.getStackFramesFromError = exports.getDataFromSafariExtensions = exports.ErrorsInstrumentation = exports.buildStackFrame = exports.ConsoleInstrumentation = exports.SessionInstrumentation = void 0; | ||
var session_1 = require("./session"); | ||
@@ -18,2 +18,10 @@ Object.defineProperty(exports, "SessionInstrumentation", { enumerable: true, get: function () { return session_1.SessionInstrumentation; } }); | ||
Object.defineProperty(exports, "WebVitalsInstrumentation", { enumerable: true, get: function () { return webVitals_1.WebVitalsInstrumentation; } }); | ||
var session_2 = require("./session"); | ||
Object.defineProperty(exports, "PersistentSessionsManager", { enumerable: true, get: function () { return session_2.PersistentSessionsManager; } }); | ||
Object.defineProperty(exports, "VolatileSessionsManager", { enumerable: true, get: function () { return session_2.VolatileSessionsManager; } }); | ||
Object.defineProperty(exports, "MAX_SESSION_PERSISTENCE_TIME", { enumerable: true, get: function () { return session_2.MAX_SESSION_PERSISTENCE_TIME; } }); | ||
Object.defineProperty(exports, "MAX_SESSION_PERSISTENCE_TIME_BUFFER", { enumerable: true, get: function () { return session_2.MAX_SESSION_PERSISTENCE_TIME_BUFFER; } }); | ||
Object.defineProperty(exports, "SESSION_EXPIRATION_TIME", { enumerable: true, get: function () { return session_2.SESSION_EXPIRATION_TIME; } }); | ||
Object.defineProperty(exports, "SESSION_INACTIVITY_TIME", { enumerable: true, get: function () { return session_2.SESSION_INACTIVITY_TIME; } }); | ||
Object.defineProperty(exports, "STORAGE_KEY", { enumerable: true, get: function () { return session_2.STORAGE_KEY; } }); | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SessionInstrumentation = void 0; | ||
exports.isSampled = exports.defaultSessionTrackingConfig = exports.VolatileSessionsManager = exports.STORAGE_UPDATE_DELAY = exports.STORAGE_KEY = exports.SESSION_INACTIVITY_TIME = exports.SESSION_EXPIRATION_TIME = exports.PersistentSessionsManager = exports.MAX_SESSION_PERSISTENCE_TIME_BUFFER = exports.MAX_SESSION_PERSISTENCE_TIME = exports.SessionInstrumentation = void 0; | ||
var instrumentation_1 = require("./instrumentation"); | ||
Object.defineProperty(exports, "SessionInstrumentation", { enumerable: true, get: function () { return instrumentation_1.SessionInstrumentation; } }); | ||
__exportStar(require("./sessionManager"), exports); | ||
var sessionManager_1 = require("./sessionManager"); | ||
Object.defineProperty(exports, "MAX_SESSION_PERSISTENCE_TIME", { enumerable: true, get: function () { return sessionManager_1.MAX_SESSION_PERSISTENCE_TIME; } }); | ||
Object.defineProperty(exports, "MAX_SESSION_PERSISTENCE_TIME_BUFFER", { enumerable: true, get: function () { return sessionManager_1.MAX_SESSION_PERSISTENCE_TIME_BUFFER; } }); | ||
Object.defineProperty(exports, "PersistentSessionsManager", { enumerable: true, get: function () { return sessionManager_1.PersistentSessionsManager; } }); | ||
Object.defineProperty(exports, "SESSION_EXPIRATION_TIME", { enumerable: true, get: function () { return sessionManager_1.SESSION_EXPIRATION_TIME; } }); | ||
Object.defineProperty(exports, "SESSION_INACTIVITY_TIME", { enumerable: true, get: function () { return sessionManager_1.SESSION_INACTIVITY_TIME; } }); | ||
Object.defineProperty(exports, "STORAGE_KEY", { enumerable: true, get: function () { return sessionManager_1.STORAGE_KEY; } }); | ||
Object.defineProperty(exports, "STORAGE_UPDATE_DELAY", { enumerable: true, get: function () { return sessionManager_1.STORAGE_UPDATE_DELAY; } }); | ||
Object.defineProperty(exports, "VolatileSessionsManager", { enumerable: true, get: function () { return sessionManager_1.VolatileSessionsManager; } }); | ||
Object.defineProperty(exports, "defaultSessionTrackingConfig", { enumerable: true, get: function () { return sessionManager_1.defaultSessionTrackingConfig; } }); | ||
Object.defineProperty(exports, "isSampled", { enumerable: true, get: function () { return sessionManager_1.isSampled; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -17,11 +17,24 @@ "use strict"; | ||
})(); | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -31,3 +44,3 @@ exports.SessionInstrumentation = void 0; | ||
var metas_1 = require("../../metas"); | ||
var webStorage_1 = require("../../utils/webStorage"); | ||
var sessionManager_1 = require("./sessionManager"); | ||
var PersistentSessionsManager_1 = require("./sessionManager/PersistentSessionsManager"); | ||
@@ -59,12 +72,2 @@ var sessionManagerUtils_1 = require("./sessionManager/sessionManagerUtils"); | ||
}; | ||
SessionInstrumentation.prototype.getSessionManagerInstanceByConfiguredStrategy = function (initialSessionId) { | ||
var _a; | ||
if (((_a = this.config.sessionTracking) === null || _a === void 0 ? void 0 : _a.persistent) && webStorage_1.isLocalStorageAvailable) { | ||
return new PersistentSessionsManager_1.PersistentSessionsManager(initialSessionId); | ||
} | ||
if (webStorage_1.isSessionStorageAvailable) { | ||
return new VolatileSessionManager_1.VolatileSessionsManager(initialSessionId); | ||
} | ||
return null; | ||
}; | ||
SessionInstrumentation.prototype.createInitialSessionMeta = function (sessionsConfig) { | ||
@@ -86,3 +89,3 @@ var _a, _b, _c; | ||
sessionId = userSession === null || userSession === void 0 ? void 0 : userSession.sessionId; | ||
sessionAttributes = (_c = userSession === null || userSession === void 0 ? void 0 : userSession.sessionMeta) === null || _c === void 0 ? void 0 : _c.attributes; | ||
sessionAttributes = __assign(__assign({}, (_c = userSession === null || userSession === void 0 ? void 0 : userSession.sessionMeta) === null || _c === void 0 ? void 0 : _c.attributes), { isSampled: userSession.isSampled.toString() }); | ||
this.api.pushEvent(faro_core_1.EVENT_SESSION_RESUME, {}, undefined, { skipDedupe: true }); | ||
@@ -96,7 +99,4 @@ } | ||
id: sessionId, | ||
attributes: __assign({ isSampled: (0, sessionManager_1.isSampled)().toString() }, sessionAttributes), | ||
}; | ||
if (sessionAttributes) { | ||
sessionMeta.attributes = sessionAttributes; | ||
} | ||
this.notifiedSession = sessionMeta; | ||
return sessionMeta; | ||
@@ -109,11 +109,24 @@ }; | ||
if (sessionTracking === null || sessionTracking === void 0 ? void 0 : sessionTracking.enabled) { | ||
var SessionManager = ((_a = this.config.sessionTracking) === null || _a === void 0 ? void 0 : _a.persistent) | ||
? PersistentSessionsManager_1.PersistentSessionsManager | ||
: VolatileSessionManager_1.VolatileSessionsManager; | ||
var initialSessionMeta = this.createInitialSessionMeta(sessionTracking); | ||
SessionManager.storeUserSession((0, sessionManagerUtils_1.createUserSessionObject)({ | ||
sessionId: initialSessionMeta.id, | ||
isSampled: Boolean(initialSessionMeta.attributes['isSampled']), | ||
})); | ||
this.notifiedSession = initialSessionMeta; | ||
this.api.setSession(initialSessionMeta); | ||
var sessionManager_1 = this.getSessionManagerInstanceByConfiguredStrategy((_a = this.metas.value.session) === null || _a === void 0 ? void 0 : _a.id); | ||
if (sessionManager_1 != null) { | ||
(_b = this.transports) === null || _b === void 0 ? void 0 : _b.addBeforeSendHooks.apply(_b, __spreadArray(__spreadArray([], this.transports.getBeforeSendHooks(), false), [function (item) { | ||
sessionManager_1 === null || sessionManager_1 === void 0 ? void 0 : sessionManager_1.updateSession(); | ||
return item; | ||
}], false)); | ||
} | ||
var updateSession_1 = new SessionManager().updateSession; | ||
(_b = this.transports) === null || _b === void 0 ? void 0 : _b.addBeforeSendHooks(function (item) { | ||
var _a; | ||
updateSession_1(); | ||
var attributes = (_a = item.meta.session) === null || _a === void 0 ? void 0 : _a.attributes; | ||
if (attributes && Boolean(attributes === null || attributes === void 0 ? void 0 : attributes['isSampled'])) { | ||
var _ = attributes.isSampled, restAttributes = __rest(attributes, ["isSampled"]); | ||
item.meta.session = __assign(__assign({}, item.meta.session), { attributes: restAttributes }); | ||
return item; | ||
} | ||
return null; | ||
}); | ||
} | ||
@@ -120,0 +133,0 @@ else { |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.VolatileSessionsManager = exports.PersistentSessionsManager = void 0; | ||
exports.isSampled = exports.defaultSessionTrackingConfig = exports.STORAGE_UPDATE_DELAY = exports.STORAGE_KEY = exports.SESSION_INACTIVITY_TIME = exports.SESSION_EXPIRATION_TIME = exports.MAX_SESSION_PERSISTENCE_TIME_BUFFER = exports.MAX_SESSION_PERSISTENCE_TIME = exports.VolatileSessionsManager = exports.PersistentSessionsManager = void 0; | ||
var PersistentSessionsManager_1 = require("./PersistentSessionsManager"); | ||
@@ -22,3 +8,12 @@ Object.defineProperty(exports, "PersistentSessionsManager", { enumerable: true, get: function () { return PersistentSessionsManager_1.PersistentSessionsManager; } }); | ||
Object.defineProperty(exports, "VolatileSessionsManager", { enumerable: true, get: function () { return VolatileSessionManager_1.VolatileSessionsManager; } }); | ||
__exportStar(require("./sessionConstants"), exports); | ||
var sessionConstants_1 = require("./sessionConstants"); | ||
Object.defineProperty(exports, "MAX_SESSION_PERSISTENCE_TIME", { enumerable: true, get: function () { return sessionConstants_1.MAX_SESSION_PERSISTENCE_TIME; } }); | ||
Object.defineProperty(exports, "MAX_SESSION_PERSISTENCE_TIME_BUFFER", { enumerable: true, get: function () { return sessionConstants_1.MAX_SESSION_PERSISTENCE_TIME_BUFFER; } }); | ||
Object.defineProperty(exports, "SESSION_EXPIRATION_TIME", { enumerable: true, get: function () { return sessionConstants_1.SESSION_EXPIRATION_TIME; } }); | ||
Object.defineProperty(exports, "SESSION_INACTIVITY_TIME", { enumerable: true, get: function () { return sessionConstants_1.SESSION_INACTIVITY_TIME; } }); | ||
Object.defineProperty(exports, "STORAGE_KEY", { enumerable: true, get: function () { return sessionConstants_1.STORAGE_KEY; } }); | ||
Object.defineProperty(exports, "STORAGE_UPDATE_DELAY", { enumerable: true, get: function () { return sessionConstants_1.STORAGE_UPDATE_DELAY; } }); | ||
Object.defineProperty(exports, "defaultSessionTrackingConfig", { enumerable: true, get: function () { return sessionConstants_1.defaultSessionTrackingConfig; } }); | ||
var sampling_1 = require("./sampling"); | ||
Object.defineProperty(exports, "isSampled", { enumerable: true, get: function () { return sampling_1.isSampled; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -7,8 +7,8 @@ "use strict"; | ||
var webStorage_1 = require("../../../utils/webStorage"); | ||
var sampling_1 = require("./sampling"); | ||
var sessionConstants_1 = require("./sessionConstants"); | ||
var sessionManagerUtils_1 = require("./sessionManagerUtils"); | ||
var PersistentSessionsManager = /** @class */ (function () { | ||
function PersistentSessionsManager(initialSessionId) { | ||
function PersistentSessionsManager() { | ||
var _this = this; | ||
this.initialSessionId = initialSessionId; | ||
this.updateSession = (0, utils_1.throttle)(function () { return _this.updateUserSession(); }, sessionConstants_1.STORAGE_UPDATE_DELAY); | ||
@@ -36,3 +36,2 @@ this.updateUserSession = (0, sessionManagerUtils_1.getUserSessionUpdater)({ | ||
var _this = this; | ||
PersistentSessionsManager.storeUserSession((0, sessionManagerUtils_1.createUserSessionObject)(this.initialSessionId)); | ||
document.addEventListener('visibilitychange', function () { | ||
@@ -59,3 +58,3 @@ if (document.visibilityState === 'visible') { | ||
if (session && session.id !== (sessionFromLocalStorage === null || sessionFromLocalStorage === void 0 ? void 0 : sessionFromLocalStorage.sessionId)) { | ||
var userSession = (0, sessionManagerUtils_1.addSessionMetadataToNextSession)((0, sessionManagerUtils_1.createUserSessionObject)(session.id), sessionFromLocalStorage); | ||
var userSession = (0, sessionManagerUtils_1.addSessionMetadataToNextSession)((0, sessionManagerUtils_1.createUserSessionObject)({ sessionId: session.id, isSampled: (0, sampling_1.isSampled)() }), sessionFromLocalStorage); | ||
PersistentSessionsManager.storeUserSession(userSession); | ||
@@ -62,0 +61,0 @@ faro_core_1.faro.api.setSession(userSession.sessionMeta); |
@@ -8,4 +8,4 @@ "use strict"; | ||
exports.STORAGE_UPDATE_DELAY = 1 * 1000; // seconds | ||
exports.MAX_SESSION_PERSISTENCE_TIME_BUFFER = 5 * 60 * 1000; | ||
exports.MAX_SESSION_PERSISTENCE_TIME = exports.SESSION_EXPIRATION_TIME + exports.MAX_SESSION_PERSISTENCE_TIME_BUFFER; | ||
exports.MAX_SESSION_PERSISTENCE_TIME_BUFFER = 1 * 60 * 1000; | ||
exports.MAX_SESSION_PERSISTENCE_TIME = exports.SESSION_INACTIVITY_TIME + exports.MAX_SESSION_PERSISTENCE_TIME_BUFFER; | ||
exports.defaultSessionTrackingConfig = { | ||
@@ -12,0 +12,0 @@ enabled: false, |
@@ -16,9 +16,12 @@ "use strict"; | ||
var faro_core_1 = require("@grafana/faro-core"); | ||
var sampling_1 = require("./sampling"); | ||
var sessionConstants_1 = require("./sessionConstants"); | ||
function createUserSessionObject(sessionId) { | ||
function createUserSessionObject(_a) { | ||
var _b = _a === void 0 ? {} : _a, _c = _b.sessionId, sessionId = _c === void 0 ? (0, faro_core_1.genShortID)() : _c, _d = _b.isSampled, isSampled = _d === void 0 ? true : _d; | ||
var now = (0, faro_core_1.dateNow)(); | ||
return { | ||
sessionId: sessionId !== null && sessionId !== void 0 ? sessionId : (0, faro_core_1.genShortID)(), | ||
sessionId: sessionId, | ||
lastActivity: now, | ||
started: now, | ||
isSampled: isSampled, | ||
}; | ||
@@ -52,3 +55,3 @@ } | ||
else { | ||
var newSession = addSessionMetadataToNextSession(createUserSessionObject(), sessionFromStorage); | ||
var newSession = addSessionMetadataToNextSession(createUserSessionObject({ isSampled: (0, sampling_1.isSampled)() }), sessionFromStorage); | ||
storeUserSession(newSession); | ||
@@ -62,10 +65,7 @@ (_a = faro_core_1.faro.api) === null || _a === void 0 ? void 0 : _a.setSession(newSession.sessionMeta); | ||
function addSessionMetadataToNextSession(newSession, previousSession) { | ||
var _a; | ||
var _a, _b; | ||
var sessionWithMeta = __assign(__assign({}, newSession), { sessionMeta: { | ||
id: newSession.sessionId, | ||
attributes: __assign(__assign(__assign({}, ((_b = (_a = faro_core_1.faro.metas.value.session) === null || _a === void 0 ? void 0 : _a.attributes) !== null && _b !== void 0 ? _b : {})), (previousSession != null ? { previousSession: previousSession.sessionId } : {})), { isSampled: newSession.isSampled.toString() }), | ||
} }); | ||
var metaAttributes = (_a = faro_core_1.faro.metas.value.session) === null || _a === void 0 ? void 0 : _a.attributes; | ||
if (metaAttributes || previousSession != null) { | ||
sessionWithMeta.sessionMeta.attributes = __assign(__assign({}, (metaAttributes !== null && metaAttributes !== void 0 ? metaAttributes : {})), (previousSession != null ? { previousSession: previousSession.sessionId } : {})); | ||
} | ||
return sessionWithMeta; | ||
@@ -72,0 +72,0 @@ } |
@@ -7,8 +7,8 @@ "use strict"; | ||
var webStorage_1 = require("../../../utils/webStorage"); | ||
var sampling_1 = require("./sampling"); | ||
var sessionConstants_1 = require("./sessionConstants"); | ||
var sessionManagerUtils_1 = require("./sessionManagerUtils"); | ||
var VolatileSessionsManager = /** @class */ (function () { | ||
function VolatileSessionsManager(initialSessionId) { | ||
function VolatileSessionsManager() { | ||
var _this = this; | ||
this.initialSessionId = initialSessionId; | ||
this.updateSession = (0, utils_1.throttle)(function () { return _this.updateUserSession(); }, sessionConstants_1.STORAGE_UPDATE_DELAY); | ||
@@ -36,3 +36,2 @@ this.updateUserSession = (0, sessionManagerUtils_1.getUserSessionUpdater)({ | ||
var _this = this; | ||
VolatileSessionsManager.storeUserSession((0, sessionManagerUtils_1.createUserSessionObject)(this.initialSessionId)); | ||
document.addEventListener('visibilitychange', function () { | ||
@@ -48,3 +47,3 @@ if (document.visibilityState === 'visible') { | ||
if (session && session.id !== (sessionFromSessionStorage === null || sessionFromSessionStorage === void 0 ? void 0 : sessionFromSessionStorage.sessionId)) { | ||
var userSession = (0, sessionManagerUtils_1.addSessionMetadataToNextSession)((0, sessionManagerUtils_1.createUserSessionObject)(session.id), sessionFromSessionStorage); | ||
var userSession = (0, sessionManagerUtils_1.addSessionMetadataToNextSession)((0, sessionManagerUtils_1.createUserSessionObject)({ sessionId: session.id, isSampled: (0, sampling_1.isSampled)() }), sessionFromSessionStorage); | ||
VolatileSessionsManager.storeUserSession(userSession); | ||
@@ -51,0 +50,0 @@ faro_core_1.faro.api.setSession(userSession.sessionMeta); |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./webStorage"), exports); | ||
__exportStar(require("./throttle"), exports); | ||
exports.throttle = exports.setItem = exports.removeItem = exports.isWebStorageAvailable = exports.getItem = exports.webStorageType = exports.isSessionStorageAvailable = exports.isLocalStorageAvailable = void 0; | ||
var webStorage_1 = require("./webStorage"); | ||
Object.defineProperty(exports, "isLocalStorageAvailable", { enumerable: true, get: function () { return webStorage_1.isLocalStorageAvailable; } }); | ||
Object.defineProperty(exports, "isSessionStorageAvailable", { enumerable: true, get: function () { return webStorage_1.isSessionStorageAvailable; } }); | ||
Object.defineProperty(exports, "webStorageType", { enumerable: true, get: function () { return webStorage_1.webStorageType; } }); | ||
Object.defineProperty(exports, "getItem", { enumerable: true, get: function () { return webStorage_1.getItem; } }); | ||
Object.defineProperty(exports, "isWebStorageAvailable", { enumerable: true, get: function () { return webStorage_1.isWebStorageAvailable; } }); | ||
Object.defineProperty(exports, "removeItem", { enumerable: true, get: function () { return webStorage_1.removeItem; } }); | ||
Object.defineProperty(exports, "setItem", { enumerable: true, get: function () { return webStorage_1.setItem; } }); | ||
var throttle_1 = require("./throttle"); | ||
Object.defineProperty(exports, "throttle", { enumerable: true, get: function () { return throttle_1.throttle; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -8,2 +8,3 @@ export { getWebInstrumentations, makeCoreConfig } from './config'; | ||
export { faro, allLogLevels, BaseExtension, BaseInstrumentation, BaseTransport, Conventions, createInternalLogger, createPromiseBuffer, deepEqual, defaultExceptionType, defaultGlobalObjectKey, defaultInternalLoggerLevel, defaultLogLevel, genShortID, getCurrentTimestamp, getInternalFaroFromGlobalObject, getTransportBody, globalObject, internalGlobalObjectKey, isArray, isBoolean, isDomError, isDomException, isElement, isElementDefined, isError, isErrorDefined, isErrorEvent, isEvent, isEventDefined, isFunction, isInstanceOf, isInt, isInternalFaroOnGlobalObject, isMap, isMapDefined, isNull, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isSyntheticEvent, isThenable, isToString, isTypeof, isUndefined, InternalLoggerLevel, LogLevel, noop, setInternalFaroOnGlobalObject, TransportItemType, transportItemTypeToBodyKey, VERSION, } from '@grafana/faro-core'; | ||
export { PersistentSessionsManager, VolatileSessionsManager, MAX_SESSION_PERSISTENCE_TIME, MAX_SESSION_PERSISTENCE_TIME_BUFFER, SESSION_EXPIRATION_TIME, SESSION_INACTIVITY_TIME, STORAGE_KEY, } from './instrumentations/session'; | ||
//# sourceMappingURL=index.js.map |
@@ -6,2 +6,3 @@ export { SessionInstrumentation } from './session'; | ||
export { WebVitalsInstrumentation } from './webVitals'; | ||
export { PersistentSessionsManager, VolatileSessionsManager, MAX_SESSION_PERSISTENCE_TIME, MAX_SESSION_PERSISTENCE_TIME_BUFFER, SESSION_EXPIRATION_TIME, SESSION_INACTIVITY_TIME, STORAGE_KEY, } from './session'; | ||
//# sourceMappingURL=index.js.map |
export { SessionInstrumentation } from './instrumentation'; | ||
export * from './sessionManager'; | ||
export { MAX_SESSION_PERSISTENCE_TIME, MAX_SESSION_PERSISTENCE_TIME_BUFFER, PersistentSessionsManager, SESSION_EXPIRATION_TIME, SESSION_INACTIVITY_TIME, STORAGE_KEY, STORAGE_UPDATE_DELAY, VolatileSessionsManager, defaultSessionTrackingConfig, isSampled, } from './sessionManager'; | ||
//# sourceMappingURL=index.js.map |
@@ -0,6 +1,17 @@ | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
}; | ||
import { BaseInstrumentation, dateNow, EVENT_SESSION_EXTEND, EVENT_SESSION_RESUME, EVENT_SESSION_START, VERSION, } from '@grafana/faro-core'; | ||
import { createSession } from '../../metas'; | ||
import { isLocalStorageAvailable, isSessionStorageAvailable } from '../../utils/webStorage'; | ||
import { isSampled } from './sessionManager'; | ||
import { PersistentSessionsManager } from './sessionManager/PersistentSessionsManager'; | ||
import { isUserSessionValid } from './sessionManager/sessionManagerUtils'; | ||
import { createUserSessionObject, isUserSessionValid } from './sessionManager/sessionManagerUtils'; | ||
import { VolatileSessionsManager } from './sessionManager/VolatileSessionManager'; | ||
@@ -28,12 +39,2 @@ export class SessionInstrumentation extends BaseInstrumentation { | ||
} | ||
getSessionManagerInstanceByConfiguredStrategy(initialSessionId) { | ||
var _a; | ||
if (((_a = this.config.sessionTracking) === null || _a === void 0 ? void 0 : _a.persistent) && isLocalStorageAvailable) { | ||
return new PersistentSessionsManager(initialSessionId); | ||
} | ||
if (isSessionStorageAvailable) { | ||
return new VolatileSessionsManager(initialSessionId); | ||
} | ||
return null; | ||
} | ||
createInitialSessionMeta(sessionsConfig) { | ||
@@ -55,3 +56,3 @@ var _a, _b, _c; | ||
sessionId = userSession === null || userSession === void 0 ? void 0 : userSession.sessionId; | ||
sessionAttributes = (_c = userSession === null || userSession === void 0 ? void 0 : userSession.sessionMeta) === null || _c === void 0 ? void 0 : _c.attributes; | ||
sessionAttributes = Object.assign(Object.assign({}, (_c = userSession === null || userSession === void 0 ? void 0 : userSession.sessionMeta) === null || _c === void 0 ? void 0 : _c.attributes), { isSampled: userSession.isSampled.toString() }); | ||
this.api.pushEvent(EVENT_SESSION_RESUME, {}, undefined, { skipDedupe: true }); | ||
@@ -65,7 +66,4 @@ } | ||
id: sessionId, | ||
attributes: Object.assign({ isSampled: isSampled().toString() }, sessionAttributes), | ||
}; | ||
if (sessionAttributes) { | ||
sessionMeta.attributes = sessionAttributes; | ||
} | ||
this.notifiedSession = sessionMeta; | ||
return sessionMeta; | ||
@@ -78,11 +76,24 @@ } | ||
if (sessionTracking === null || sessionTracking === void 0 ? void 0 : sessionTracking.enabled) { | ||
const SessionManager = ((_a = this.config.sessionTracking) === null || _a === void 0 ? void 0 : _a.persistent) | ||
? PersistentSessionsManager | ||
: VolatileSessionsManager; | ||
const initialSessionMeta = this.createInitialSessionMeta(sessionTracking); | ||
SessionManager.storeUserSession(createUserSessionObject({ | ||
sessionId: initialSessionMeta.id, | ||
isSampled: Boolean(initialSessionMeta.attributes['isSampled']), | ||
})); | ||
this.notifiedSession = initialSessionMeta; | ||
this.api.setSession(initialSessionMeta); | ||
const sessionManager = this.getSessionManagerInstanceByConfiguredStrategy((_a = this.metas.value.session) === null || _a === void 0 ? void 0 : _a.id); | ||
if (sessionManager != null) { | ||
(_b = this.transports) === null || _b === void 0 ? void 0 : _b.addBeforeSendHooks(...this.transports.getBeforeSendHooks(), (item) => { | ||
sessionManager === null || sessionManager === void 0 ? void 0 : sessionManager.updateSession(); | ||
const { updateSession } = new SessionManager(); | ||
(_b = this.transports) === null || _b === void 0 ? void 0 : _b.addBeforeSendHooks((item) => { | ||
var _a; | ||
updateSession(); | ||
const attributes = (_a = item.meta.session) === null || _a === void 0 ? void 0 : _a.attributes; | ||
if (attributes && Boolean(attributes === null || attributes === void 0 ? void 0 : attributes['isSampled'])) { | ||
const { isSampled: _ } = attributes, restAttributes = __rest(attributes, ["isSampled"]); | ||
item.meta.session = Object.assign(Object.assign({}, item.meta.session), { attributes: restAttributes }); | ||
return item; | ||
}); | ||
} | ||
} | ||
return null; | ||
}); | ||
} | ||
@@ -89,0 +100,0 @@ else { |
export { PersistentSessionsManager } from './PersistentSessionsManager'; | ||
export { VolatileSessionsManager } from './VolatileSessionManager'; | ||
export * from './sessionConstants'; | ||
export { MAX_SESSION_PERSISTENCE_TIME, MAX_SESSION_PERSISTENCE_TIME_BUFFER, SESSION_EXPIRATION_TIME, SESSION_INACTIVITY_TIME, STORAGE_KEY, STORAGE_UPDATE_DELAY, defaultSessionTrackingConfig, } from './sessionConstants'; | ||
export { isSampled } from './sampling'; | ||
//# sourceMappingURL=index.js.map |
import { faro } from '@grafana/faro-core'; | ||
import { throttle } from '../../../utils'; | ||
import { getItem, removeItem, setItem, webStorageType } from '../../../utils/webStorage'; | ||
import { isSampled } from './sampling'; | ||
import { STORAGE_KEY, STORAGE_UPDATE_DELAY } from './sessionConstants'; | ||
import { addSessionMetadataToNextSession, createUserSessionObject, getUserSessionUpdater } from './sessionManagerUtils'; | ||
export class PersistentSessionsManager { | ||
constructor(initialSessionId) { | ||
this.initialSessionId = initialSessionId; | ||
constructor() { | ||
this.updateSession = throttle(() => this.updateUserSession(), STORAGE_UPDATE_DELAY); | ||
@@ -30,3 +30,2 @@ this.updateUserSession = getUserSessionUpdater({ | ||
init() { | ||
PersistentSessionsManager.storeUserSession(createUserSessionObject(this.initialSessionId)); | ||
document.addEventListener('visibilitychange', () => { | ||
@@ -53,3 +52,3 @@ if (document.visibilityState === 'visible') { | ||
if (session && session.id !== (sessionFromLocalStorage === null || sessionFromLocalStorage === void 0 ? void 0 : sessionFromLocalStorage.sessionId)) { | ||
const userSession = addSessionMetadataToNextSession(createUserSessionObject(session.id), sessionFromLocalStorage); | ||
const userSession = addSessionMetadataToNextSession(createUserSessionObject({ sessionId: session.id, isSampled: isSampled() }), sessionFromLocalStorage); | ||
PersistentSessionsManager.storeUserSession(userSession); | ||
@@ -56,0 +55,0 @@ faro.api.setSession(userSession.sessionMeta); |
@@ -5,4 +5,4 @@ export const STORAGE_KEY = '__FARO_SESSION__'; | ||
export const STORAGE_UPDATE_DELAY = 1 * 1000; // seconds | ||
export const MAX_SESSION_PERSISTENCE_TIME_BUFFER = 5 * 60 * 1000; | ||
export const MAX_SESSION_PERSISTENCE_TIME = SESSION_EXPIRATION_TIME + MAX_SESSION_PERSISTENCE_TIME_BUFFER; | ||
export const MAX_SESSION_PERSISTENCE_TIME_BUFFER = 1 * 60 * 1000; | ||
export const MAX_SESSION_PERSISTENCE_TIME = SESSION_INACTIVITY_TIME + MAX_SESSION_PERSISTENCE_TIME_BUFFER; | ||
export const defaultSessionTrackingConfig = { | ||
@@ -9,0 +9,0 @@ enabled: false, |
import { dateNow, faro, genShortID } from '@grafana/faro-core'; | ||
import { isSampled } from './sampling'; | ||
import { SESSION_EXPIRATION_TIME, SESSION_INACTIVITY_TIME } from './sessionConstants'; | ||
export function createUserSessionObject(sessionId) { | ||
export function createUserSessionObject({ sessionId = genShortID(), isSampled = true, } = {}) { | ||
const now = dateNow(); | ||
return { | ||
sessionId: sessionId !== null && sessionId !== void 0 ? sessionId : genShortID(), | ||
sessionId, | ||
lastActivity: now, | ||
started: now, | ||
isSampled: isSampled, | ||
}; | ||
@@ -34,3 +36,3 @@ } | ||
else { | ||
let newSession = addSessionMetadataToNextSession(createUserSessionObject(), sessionFromStorage); | ||
let newSession = addSessionMetadataToNextSession(createUserSessionObject({ isSampled: isSampled() }), sessionFromStorage); | ||
storeUserSession(newSession); | ||
@@ -43,12 +45,9 @@ (_a = faro.api) === null || _a === void 0 ? void 0 : _a.setSession(newSession.sessionMeta); | ||
export function addSessionMetadataToNextSession(newSession, previousSession) { | ||
var _a; | ||
var _a, _b; | ||
const sessionWithMeta = Object.assign(Object.assign({}, newSession), { sessionMeta: { | ||
id: newSession.sessionId, | ||
attributes: Object.assign(Object.assign(Object.assign({}, ((_b = (_a = faro.metas.value.session) === null || _a === void 0 ? void 0 : _a.attributes) !== null && _b !== void 0 ? _b : {})), (previousSession != null ? { previousSession: previousSession.sessionId } : {})), { isSampled: newSession.isSampled.toString() }), | ||
} }); | ||
const metaAttributes = (_a = faro.metas.value.session) === null || _a === void 0 ? void 0 : _a.attributes; | ||
if (metaAttributes || previousSession != null) { | ||
sessionWithMeta.sessionMeta.attributes = Object.assign(Object.assign({}, (metaAttributes !== null && metaAttributes !== void 0 ? metaAttributes : {})), (previousSession != null ? { previousSession: previousSession.sessionId } : {})); | ||
} | ||
return sessionWithMeta; | ||
} | ||
//# sourceMappingURL=sessionManagerUtils.js.map |
import { faro } from '@grafana/faro-core'; | ||
import { throttle } from '../../../utils'; | ||
import { getItem, removeItem, setItem, webStorageType } from '../../../utils/webStorage'; | ||
import { isSampled } from './sampling'; | ||
import { STORAGE_KEY, STORAGE_UPDATE_DELAY } from './sessionConstants'; | ||
import { addSessionMetadataToNextSession, createUserSessionObject, getUserSessionUpdater } from './sessionManagerUtils'; | ||
export class VolatileSessionsManager { | ||
constructor(initialSessionId) { | ||
this.initialSessionId = initialSessionId; | ||
constructor() { | ||
this.updateSession = throttle(() => this.updateUserSession(), STORAGE_UPDATE_DELAY); | ||
@@ -30,3 +30,2 @@ this.updateUserSession = getUserSessionUpdater({ | ||
init() { | ||
VolatileSessionsManager.storeUserSession(createUserSessionObject(this.initialSessionId)); | ||
document.addEventListener('visibilitychange', () => { | ||
@@ -42,3 +41,3 @@ if (document.visibilityState === 'visible') { | ||
if (session && session.id !== (sessionFromSessionStorage === null || sessionFromSessionStorage === void 0 ? void 0 : sessionFromSessionStorage.sessionId)) { | ||
const userSession = addSessionMetadataToNextSession(createUserSessionObject(session.id), sessionFromSessionStorage); | ||
const userSession = addSessionMetadataToNextSession(createUserSessionObject({ sessionId: session.id, isSampled: isSampled() }), sessionFromSessionStorage); | ||
VolatileSessionsManager.storeUserSession(userSession); | ||
@@ -45,0 +44,0 @@ faro.api.setSession(userSession.sessionMeta); |
@@ -1,3 +0,3 @@ | ||
export * from './webStorage'; | ||
export * from './throttle'; | ||
export { isLocalStorageAvailable, isSessionStorageAvailable, webStorageType, getItem, isWebStorageAvailable, removeItem, setItem, } from './webStorage'; | ||
export { throttle } from './throttle'; | ||
//# sourceMappingURL=index.js.map |
@@ -12,1 +12,2 @@ export { getWebInstrumentations, makeCoreConfig } from './config'; | ||
export type { Faro, API, APIEvent, BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue, BeforeSendHook, BufferItem, Config, EventAttributes, EventEvent, EventsAPI, ExceptionEvent, ExceptionStackFrame, ExceptionsAPI, ExtendedError, Extension, GlobalObject, Instrumentation, Instrumentations, InternalLogger, LogContext, LogEvent, LogsAPI, MeasurementEvent, MeasurementsAPI, Meta, MetaAPI, MetaApp, MetaAttributes, MetaBrowser, MetaGetter, MetaItem, MetaPage, Metas, MetaSDK, MetaSDKIntegration, MetaSession, MetaUser, MetaView, OTELApi, Patterns, PromiseBuffer, PromiseBufferOptions, PromiseProducer, PushErrorOptions, PushLogOptions, PushMeasurementOptions, Stacktrace, StacktraceParser, TraceContext, TraceEvent, TracesAPI, Transport, TransportBody, TransportItem, TransportItemPayload, Transports, UnpatchedConsole, } from '@grafana/faro-core'; | ||
export { PersistentSessionsManager, VolatileSessionsManager, MAX_SESSION_PERSISTENCE_TIME, MAX_SESSION_PERSISTENCE_TIME_BUFFER, SESSION_EXPIRATION_TIME, SESSION_INACTIVITY_TIME, STORAGE_KEY, } from './instrumentations/session'; |
@@ -6,3 +6,3 @@ import { BaseInstrumentation, LogLevel } from '@grafana/faro-core'; | ||
readonly name = "@grafana/faro-web-sdk:instrumentation-console"; | ||
readonly version = "1.2.8"; | ||
readonly version = "1.2.9"; | ||
static defaultDisabledLevels: LogLevel[]; | ||
@@ -9,0 +9,0 @@ constructor(options?: ConsoleInstrumentationOptions); |
import { BaseInstrumentation } from '@grafana/faro-core'; | ||
export declare class ErrorsInstrumentation extends BaseInstrumentation { | ||
readonly name = "@grafana/faro-web-sdk:instrumentation-errors"; | ||
readonly version = "1.2.8"; | ||
readonly version = "1.2.9"; | ||
initialize(): void; | ||
} |
@@ -8,1 +8,2 @@ export { SessionInstrumentation } from './session'; | ||
export { WebVitalsInstrumentation } from './webVitals'; | ||
export { PersistentSessionsManager, VolatileSessionsManager, MAX_SESSION_PERSISTENCE_TIME, MAX_SESSION_PERSISTENCE_TIME_BUFFER, SESSION_EXPIRATION_TIME, SESSION_INACTIVITY_TIME, STORAGE_KEY, } from './session'; |
export { SessionInstrumentation } from './instrumentation'; | ||
export * from './sessionManager'; | ||
export { MAX_SESSION_PERSISTENCE_TIME, MAX_SESSION_PERSISTENCE_TIME_BUFFER, PersistentSessionsManager, SESSION_EXPIRATION_TIME, SESSION_INACTIVITY_TIME, STORAGE_KEY, STORAGE_UPDATE_DELAY, VolatileSessionsManager, defaultSessionTrackingConfig, isSampled, } from './sessionManager'; | ||
export type { FaroUserSession } from './sessionManager'; |
import { BaseInstrumentation } from '@grafana/faro-core'; | ||
export declare class SessionInstrumentation extends BaseInstrumentation { | ||
readonly name = "@grafana/faro-web-sdk:instrumentation-session"; | ||
readonly version = "1.2.8"; | ||
readonly version = "1.2.9"; | ||
private notifiedSession; | ||
private sendSessionStartEvent; | ||
private getSessionManagerInstanceByConfiguredStrategy; | ||
private createInitialSessionMeta; | ||
initialize(): void; | ||
} |
export { PersistentSessionsManager } from './PersistentSessionsManager'; | ||
export { VolatileSessionsManager } from './VolatileSessionManager'; | ||
export * from './sessionConstants'; | ||
export { MAX_SESSION_PERSISTENCE_TIME, MAX_SESSION_PERSISTENCE_TIME_BUFFER, SESSION_EXPIRATION_TIME, SESSION_INACTIVITY_TIME, STORAGE_KEY, STORAGE_UPDATE_DELAY, defaultSessionTrackingConfig, } from './sessionConstants'; | ||
export { isSampled } from './sampling'; | ||
export type { FaroUserSession } from './types'; |
import type { FaroUserSession } from './types'; | ||
export declare class PersistentSessionsManager { | ||
private initialSessionId?; | ||
private static storageTypeLocal; | ||
private updateUserSession; | ||
constructor(initialSessionId?: string | undefined); | ||
constructor(); | ||
static removeUserSession(): void; | ||
@@ -8,0 +7,0 @@ static storeUserSession(session: FaroUserSession): void; |
@@ -0,1 +1,2 @@ | ||
import type { Config } from '@grafana/faro-core'; | ||
export declare const STORAGE_KEY = "__FARO_SESSION__"; | ||
@@ -7,6 +8,2 @@ export declare const SESSION_EXPIRATION_TIME: number; | ||
export declare const MAX_SESSION_PERSISTENCE_TIME: number; | ||
export declare const defaultSessionTrackingConfig: { | ||
readonly enabled: false; | ||
readonly persistent: false; | ||
readonly maxSessionPersistenceTime: number; | ||
}; | ||
export declare const defaultSessionTrackingConfig: Config['sessionTracking']; |
import type { FaroUserSession } from './types'; | ||
export declare function createUserSessionObject(sessionId?: string): FaroUserSession; | ||
type CreateUserSessionObjectParams = { | ||
sessionId?: string; | ||
isSampled?: boolean; | ||
}; | ||
export declare function createUserSessionObject({ sessionId, isSampled, }?: CreateUserSessionObjectParams): FaroUserSession; | ||
export declare function isUserSessionValid(session: FaroUserSession | null): boolean; | ||
@@ -4,0 +8,0 @@ type GetUserSessionUpdaterParams = { |
@@ -6,3 +6,4 @@ import type { MetaSession } from '@grafana/faro-core'; | ||
started: number; | ||
isSampled: boolean; | ||
sessionMeta?: MetaSession; | ||
} |
import type { FaroUserSession } from './types'; | ||
export declare class VolatileSessionsManager { | ||
private initialSessionId?; | ||
private static storageTypeSession; | ||
private updateUserSession; | ||
constructor(initialSessionId?: string | undefined); | ||
constructor(); | ||
static removeUserSession(): void; | ||
@@ -8,0 +7,0 @@ static storeUserSession(session: FaroUserSession): void; |
import { BaseInstrumentation } from '@grafana/faro-core'; | ||
export declare class ViewInstrumentation extends BaseInstrumentation { | ||
readonly name = "@grafana/faro-web-sdk:instrumentation-view"; | ||
readonly version = "1.2.8"; | ||
readonly version = "1.2.9"; | ||
private notifiedView; | ||
@@ -6,0 +6,0 @@ private sendViewChangedEvent; |
import { BaseInstrumentation } from '@grafana/faro-core'; | ||
export declare class WebVitalsInstrumentation extends BaseInstrumentation { | ||
readonly name = "@grafana/faro-web-sdk:instrumentation-web-vitals"; | ||
readonly version = "1.2.8"; | ||
readonly version = "1.2.9"; | ||
static mapping: { | ||
@@ -6,0 +6,0 @@ cls: (onReport: import("web-vitals").CLSReportCallback, opts?: import("web-vitals").ReportOpts | undefined) => void; |
@@ -7,5 +7,5 @@ import { BaseTransport } from '@grafana/faro-core'; | ||
readonly name = "@grafana/faro-web-sdk:transport-console"; | ||
readonly version = "1.2.8"; | ||
readonly version = "1.2.9"; | ||
constructor(options?: ConsoleTransportOptions); | ||
send(item: TransportItem): void; | ||
} |
@@ -7,3 +7,3 @@ import { BaseTransport, PromiseBuffer } from '@grafana/faro-core'; | ||
readonly name = "@grafana/faro-web-sdk:transport-fetch"; | ||
readonly version = "1.2.8"; | ||
readonly version = "1.2.9"; | ||
promiseBuffer: PromiseBuffer<Response | void>; | ||
@@ -10,0 +10,0 @@ private readonly rateLimitBackoffMs; |
@@ -1,2 +0,2 @@ | ||
export * from './webStorage'; | ||
export * from './throttle'; | ||
export { isLocalStorageAvailable, isSessionStorageAvailable, webStorageType, getItem, isWebStorageAvailable, removeItem, setItem, } from './webStorage'; | ||
export { throttle } from './throttle'; |
{ | ||
"name": "@grafana/faro-web-sdk", | ||
"version": "1.2.8", | ||
"version": "1.2.9", | ||
"description": "Faro instrumentations, metas, transports for web.", | ||
@@ -55,3 +55,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@grafana/faro-core": "^1.2.8", | ||
"@grafana/faro-core": "^1.2.9", | ||
"ua-parser-js": "^1.0.32", | ||
@@ -67,3 +67,3 @@ "web-vitals": "^3.1.1" | ||
}, | ||
"gitHead": "33e2ab5d7dc27464e679170fed9869eae8ca7794" | ||
"gitHead": "d725ed85b06bfe1f8060b6adeb5bc22bf7ec637c" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
466559
379
3663
Updated@grafana/faro-core@^1.2.9