@safaricom-mxl/web-sdk 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Data/listenToRouterChanges.cjs +12 -11
- package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Data/listenToRouterChanges.cjs.map +1 -1
- package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Data/listenToRouterChanges.d.cts.map +1 -1
- package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Data/listenToRouterChanges.d.ts.map +1 -1
- package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Data/listenToRouterChanges.js +12 -11
- package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Data/listenToRouterChanges.js.map +1 -1
- package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Declarative/withMXLRouting.cjs +2 -1
- package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Declarative/withMXLRouting.cjs.map +1 -1
- package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Declarative/withMXLRouting.d.cts.map +1 -1
- package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Declarative/withMXLRouting.d.ts.map +1 -1
- package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Declarative/withMXLRouting.js +2 -1
- package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Declarative/withMXLRouting.js.map +1 -1
- package/dist/mxl-web-sdk.js +1 -1
- package/dist/mxl-web-sdk.js.map +1 -1
- package/dist/resources/constants/index.cjs +1 -1
- package/dist/resources/constants/index.cjs.map +1 -1
- package/dist/resources/constants/index.d.cts +1 -1
- package/dist/resources/constants/index.d.ts +1 -1
- package/dist/resources/constants/index.js +1 -1
- package/dist/resources/constants/index.js.map +1 -1
- package/dist/transport/FetchTransport/FetchTransport.cjs +60 -10
- package/dist/transport/FetchTransport/FetchTransport.cjs.map +1 -1
- package/dist/transport/FetchTransport/FetchTransport.d.cts +3 -1
- package/dist/transport/FetchTransport/FetchTransport.d.cts.map +1 -1
- package/dist/transport/FetchTransport/FetchTransport.d.ts +3 -1
- package/dist/transport/FetchTransport/FetchTransport.d.ts.map +1 -1
- package/dist/transport/FetchTransport/FetchTransport.js +60 -11
- package/dist/transport/FetchTransport/FetchTransport.js.map +1 -1
- package/package.json +1 -1
package/dist/mxl-web-sdk.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";window.MXLWebSdk=window.MXLWebSdk||(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{},n=`1.9.0`,r=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function i(e){var t=new Set([e]),n=new Set,i=e.match(r);if(!i)return function(){return!1};var a={major:+i[1],minor:+i[2],patch:+i[3],prerelease:i[4]};if(a.prerelease!=null)return function(t){return t===e};function o(e){return n.add(e),!1}function s(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(n.has(e))return!1;var i=e.match(r);if(!i)return o(e);var c={major:+i[1],minor:+i[2],patch:+i[3],prerelease:i[4]};return c.prerelease!=null||a.major!==c.major?o(e):a.major===0?a.minor===c.minor&&a.patch<=c.patch?s(e):o(e):a.minor<=c.minor?s(e):o(e)}}var a=i(n),o=n.split(`.`)[0],s=Symbol.for(`opentelemetry.js.api.`+o),c=t;function l(e,t,r,i){var a;i===void 0&&(i=!1);var o=c[s]=(a=c[s])==null?{version:n}:a;if(!i&&o[e]){var l=Error(`@opentelemetry/api: Attempted duplicate registration of API: `+e);return r.error(l.stack||l.message),!1}if(o.version!==n){var l=Error(`@opentelemetry/api: Registration of version v`+o.version+` for `+e+` does not match previously registered API v`+n);return r.error(l.stack||l.message),!1}return o[e]=t,r.debug(`@opentelemetry/api: Registered a global for `+e+` v`+n+`.`),!0}function u(e){var t,n,r=(t=c[s])==null?void 0:t.version;if(!(!r||!a(r)))return(n=c[s])==null?void 0:n[e]}function d(e,t){t.debug(`@opentelemetry/api: Unregistering a global for `+e+` v`+n+`.`);var r=c[s];r&&delete r[e]}var f=function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},p=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))},ee=function(){function e(e){this._namespace=e.namespace||`DiagComponentLogger`}return e.prototype.debug=function(){var e=[...arguments];return m(`debug`,this._namespace,e)},e.prototype.error=function(){var e=[...arguments];return m(`error`,this._namespace,e)},e.prototype.info=function(){var e=[...arguments];return m(`info`,this._namespace,e)},e.prototype.warn=function(){var e=[...arguments];return m(`warn`,this._namespace,e)},e.prototype.verbose=function(){var e=[...arguments];return m(`verbose`,this._namespace,e)},e}();function m(e,t,n){var r=u(`diag`);if(r)return n.unshift(t),r[e].apply(r,p([],f(n),!1))}var h;(function(e){e[e.NONE=0]=`NONE`,e[e.ERROR=30]=`ERROR`,e[e.WARN=50]=`WARN`,e[e.INFO=60]=`INFO`,e[e.DEBUG=70]=`DEBUG`,e[e.VERBOSE=80]=`VERBOSE`,e[e.ALL=9999]=`ALL`})(h||(h={}));function te(e,t){e<h.NONE?e=h.NONE:e>h.ALL&&(e=h.ALL),t=t||{};function n(n,r){var i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,h.ERROR),warn:n(`warn`,h.WARN),info:n(`info`,h.INFO),debug:n(`debug`,h.DEBUG),verbose:n(`verbose`,h.VERBOSE)}}var g=function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},ne=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))},re=`diag`,_=function(){function e(){function e(e){return function(){var t=[...arguments],n=u(`diag`);if(n)return n[e].apply(n,ne([],g(t),!1))}}var t=this;t.setLogger=function(e,n){var r,i,a;if(n===void 0&&(n={logLevel:h.INFO}),e===t){var o=Error(`Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation`);return t.error((r=o.stack)==null?o.message:r),!1}typeof n==`number`&&(n={logLevel:n});var s=u(`diag`),c=te((i=n.logLevel)==null?h.INFO:i,e);if(s&&!n.suppressOverrideMessage){var d=(a=Error().stack)==null?`<failed to generate stacktrace>`:a;s.warn(`Current logger will be overwritten from `+d),c.warn(`Current logger will overwrite one already registered from `+d)}return l(`diag`,c,t,!0)},t.disable=function(){d(re,t)},t.createComponentLogger=function(e){return new ee(e)},t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}return e.instance=function(){return this._instance||(this._instance=new e),this._instance},e}(),ie=function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},ae=function(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)},oe=function(){function e(e){this._entries=e?new Map(e):new Map}return e.prototype.getEntry=function(e){var t=this._entries.get(e);if(t)return Object.assign({},t)},e.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(e){var t=ie(e,2);return[t[0],t[1]]})},e.prototype.setEntry=function(t,n){var r=new e(this._entries);return r._entries.set(t,n),r},e.prototype.removeEntry=function(t){var n=new e(this._entries);return n._entries.delete(t),n},e.prototype.removeEntries=function(){for(var t,n,r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var a=new e(this._entries);try{for(var o=ae(r),s=o.next();!s.done;s=o.next()){var c=s.value;a._entries.delete(c)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return a},e.prototype.clear=function(){return new e},e}(),se=Symbol(`BaggageEntryMetadata`),ce=_.instance();function v(e){return e===void 0&&(e={}),new oe(new Map(Object.entries(e)))}function le(e){return typeof e!=`string`&&(ce.error(`Cannot create baggage metadata from unknown type: `+typeof e),e=``),{__TYPE__:se,toString:function(){return e}}}function y(e){return Symbol.for(e)}var b=new(function(){function e(t){var n=this;n._currentContext=t?new Map(t):new Map,n.getValue=function(e){return n._currentContext.get(e)},n.setValue=function(t,r){var i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=function(t){var r=new e(n._currentContext);return r._currentContext.delete(t),r}}return e}()),ue=[{n:`error`,c:`error`},{n:`warn`,c:`warn`},{n:`info`,c:`info`},{n:`debug`,c:`debug`},{n:`verbose`,c:`trace`}],de=function(){function e(){function e(e){return function(){var t=[...arguments];if(console){var n=console[e];if(typeof n!=`function`&&(n=console.log),typeof n==`function`)return n.apply(console,t)}}}for(var t=0;t<ue.length;t++)this[ue[t].n]=e(ue[t].c)}return e}(),x=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),fe=function(){function e(){}return e.prototype.createGauge=function(e,t){return Se},e.prototype.createHistogram=function(e,t){return Ce},e.prototype.createCounter=function(e,t){return xe},e.prototype.createUpDownCounter=function(e,t){return we},e.prototype.createObservableGauge=function(e,t){return Ee},e.prototype.createObservableCounter=function(e,t){return Te},e.prototype.createObservableUpDownCounter=function(e,t){return De},e.prototype.addBatchObservableCallback=function(e,t){},e.prototype.removeBatchObservableCallback=function(e){},e}(),S=function(){function e(){}return e}(),pe=function(e){x(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.add=function(e,t){},t}(S),me=function(e){x(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.add=function(e,t){},t}(S),he=function(e){x(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.record=function(e,t){},t}(S),ge=function(e){x(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.record=function(e,t){},t}(S),_e=function(){function e(){}return e.prototype.addCallback=function(e){},e.prototype.removeCallback=function(e){},e}(),ve=function(e){x(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(_e),ye=function(e){x(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(_e),be=function(e){x(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(_e),C=new fe,xe=new pe,Se=new he,Ce=new ge,we=new me,Te=new ve,Ee=new ye,De=new be;function Oe(){return C}var ke={get:function(e,t){if(e!=null)return e[t]},keys:function(e){return e==null?[]:Object.keys(e)}},Ae={set:function(e,t,n){e!=null&&(e[t]=n)}},je=function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},Me=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))},Ne=function(){function e(){}return e.prototype.active=function(){return b},e.prototype.with=function(e,t,n){var r=[...arguments].slice(3);return t.call.apply(t,Me([n],je(r),!1))},e.prototype.bind=function(e,t){return t},e.prototype.enable=function(){return this},e.prototype.disable=function(){return this},e}(),Pe=function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},Fe=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))},Ie=`context`,Le=new Ne,Re=function(){function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalContextManager=function(e){return l(Ie,e,_.instance())},e.prototype.active=function(){return this._getContextManager().active()},e.prototype.with=function(e,t,n){for(var r,i=[],a=3;a<arguments.length;a++)i[a-3]=arguments[a];return(r=this._getContextManager()).with.apply(r,Fe([e,t,n],Pe(i),!1))},e.prototype.bind=function(e,t){return this._getContextManager().bind(e,t)},e.prototype._getContextManager=function(){return u(Ie)||Le},e.prototype.disable=function(){this._getContextManager().disable(),d(Ie,_.instance())},e}(),w;(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(w||(w={}));var ze=`0000000000000000`,Be=`00000000000000000000000000000000`,Ve={traceId:Be,spanId:ze,traceFlags:w.NONE},He=function(){function e(e){e===void 0&&(e=Ve),this._spanContext=e}return e.prototype.spanContext=function(){return this._spanContext},e.prototype.setAttribute=function(e,t){return this},e.prototype.setAttributes=function(e){return this},e.prototype.addEvent=function(e,t){return this},e.prototype.addLink=function(e){return this},e.prototype.addLinks=function(e){return this},e.prototype.setStatus=function(e){return this},e.prototype.updateName=function(e){return this},e.prototype.end=function(e){},e.prototype.isRecording=function(){return!1},e.prototype.recordException=function(e,t){},e}(),Ue=y(`OpenTelemetry Context Key SPAN`);function We(e){return e.getValue(Ue)||void 0}function Ge(){return We(Re.getInstance().active())}function Ke(e,t){return e.setValue(Ue,t)}function qe(e){return e.deleteValue(Ue)}function Je(e,t){return Ke(e,new He(t))}function Ye(e){var t;return(t=We(e))==null?void 0:t.spanContext()}var Xe=/^([0-9a-f]{32})$/i,Ze=/^[0-9a-f]{16}$/i;function Qe(e){return Xe.test(e)&&e!==Be}function $e(e){return Ze.test(e)&&e!==ze}function et(e){return Qe(e.traceId)&&$e(e.spanId)}function tt(e){return new He(e)}var nt=Re.getInstance(),rt=function(){function e(){}return e.prototype.startSpan=function(e,t,n){if(n===void 0&&(n=nt.active()),t!=null&&t.root)return new He;var r=n&&Ye(n);return it(r)&&et(r)?new He(r):new He},e.prototype.startActiveSpan=function(e,t,n,r){var i,a,o;if(!(arguments.length<2)){arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);var s=a==null?nt.active():a,c=this.startSpan(e,i,s),l=Ke(s,c);return nt.with(l,o,void 0,c)}},e}();function it(e){return typeof e==`object`&&typeof e.spanId==`string`&&typeof e.traceId==`string`&&typeof e.traceFlags==`number`}var at=new rt,ot=function(){function e(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}return e.prototype.startSpan=function(e,t,n){return this._getTracer().startSpan(e,t,n)},e.prototype.startActiveSpan=function(e,t,n,r){var i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)},e.prototype._getTracer=function(){if(this._delegate)return this._delegate;var e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):at},e}(),st=new(function(){function e(){}return e.prototype.getTracer=function(e,t,n){return new rt},e}()),ct=function(){function e(){}return e.prototype.getTracer=function(e,t,n){var r;return(r=this.getDelegateTracer(e,t,n))==null?new ot(this,e,t,n):r},e.prototype.getDelegate=function(){var e;return(e=this._delegate)==null?st:e},e.prototype.setDelegate=function(e){this._delegate=e},e.prototype.getDelegateTracer=function(e,t,n){var r;return(r=this._delegate)==null?void 0:r.getTracer(e,t,n)},e}(),lt;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(lt||(lt={}));var ut;(function(e){e[e.INTERNAL=0]=`INTERNAL`,e[e.SERVER=1]=`SERVER`,e[e.CLIENT=2]=`CLIENT`,e[e.PRODUCER=3]=`PRODUCER`,e[e.CONSUMER=4]=`CONSUMER`})(ut||(ut={}));var dt;(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(dt||(dt={}));var T=Re.getInstance(),E=_.instance(),ft=new(function(){function e(){}return e.prototype.getMeter=function(e,t,n){return C},e}()),pt=`metrics`,mt=function(){function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalMeterProvider=function(e){return l(pt,e,_.instance())},e.prototype.getMeterProvider=function(){return u(pt)||ft},e.prototype.getMeter=function(e,t,n){return this.getMeterProvider().getMeter(e,t,n)},e.prototype.disable=function(){d(pt,_.instance())},e}().getInstance(),ht=function(){function e(){}return e.prototype.inject=function(e,t){},e.prototype.extract=function(e,t){return e},e.prototype.fields=function(){return[]},e}(),gt=y(`OpenTelemetry Baggage Key`);function _t(e){return e.getValue(gt)||void 0}function vt(){return _t(Re.getInstance().active())}function yt(e,t){return e.setValue(gt,t)}function bt(e){return e.deleteValue(gt)}var xt=`propagation`,St=new ht,D=function(){function e(){this.createBaggage=v,this.getBaggage=_t,this.getActiveBaggage=vt,this.setBaggage=yt,this.deleteBaggage=bt}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalPropagator=function(e){return l(xt,e,_.instance())},e.prototype.inject=function(e,t,n){return n===void 0&&(n=Ae),this._getGlobalPropagator().inject(e,t,n)},e.prototype.extract=function(e,t,n){return n===void 0&&(n=ke),this._getGlobalPropagator().extract(e,t,n)},e.prototype.fields=function(){return this._getGlobalPropagator().fields()},e.prototype.disable=function(){d(xt,_.instance())},e.prototype._getGlobalPropagator=function(){return u(xt)||St},e}().getInstance(),Ct=`trace`,O=function(){function e(){this._proxyTracerProvider=new ct,this.wrapSpanContext=tt,this.isSpanContextValid=et,this.deleteSpan=qe,this.getSpan=We,this.getActiveSpan=Ge,this.getSpanContext=Ye,this.setSpan=Ke,this.setSpanContext=Je}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalTracerProvider=function(e){var t=l(Ct,this._proxyTracerProvider,_.instance());return t&&this._proxyTracerProvider.setDelegate(e),t},e.prototype.getTracerProvider=function(){return u(Ct)||this._proxyTracerProvider},e.prototype.getTracer=function(e,t){return this.getTracerProvider().getTracer(e,t)},e.prototype.disable=function(){d(Ct,_.instance()),this._proxyTracerProvider=new ct},e}().getInstance();let wt=({target:e,events:t,callback:n})=>{t.forEach(t=>{e.addEventListener(t,n)})},Tt=({target:e,events:t,callback:n})=>{t.forEach(t=>{e.removeEventListener(t,n)})};function Et(e,t,n,r=new Set){return new Proxy(e,{get(e,i,a){let o=Reflect.get(e,i,a);return typeof o!=`function`||r.has(i)?o:(...r)=>{try{return o.apply(e,r)}catch(e){let a=e instanceof Error?e.message:`Unknown error`;n.error(`${String(i)}: ${a}`);let o=t[i];return typeof o==`function`?o.apply(t,r):void 0}}}})}let Dt=new Uint8Array(16),Ot=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`).toUpperCase()),kt=()=>{crypto.getRandomValues(Dt);let e=``;for(let t=0;t<16;t++)e+=Ot[Dt[t]];return e},At=(e,t,n)=>{try{let n=e.getItem(t),r=n?parseInt(n,10):0;return r++,e.setItem(t,r.toString()),r}catch(e){return n.warn(`Failed to retrieve ${t} from storage: `,e),1}},k=`mxl.type`,jt=`mxl.state`,Mt=`mxl.properties.`,Nt=`mxl.js_file_bundle_ids`,Pt=`app.surface.name`,Ft=`app.surface.id`,It=`app.surface.label`,A=function(e){return e.Session=`ux.session`,e.Network=`perf.network_request`,e.Perf=`perf`,e.SystemLog=`sys.log`,e.SystemException=`sys.exception`,e.WebVital=`ux.web_vital`,e.ResourceFetch=`ux.resource_fetch`,e.DocumentLoad=`ux.document_load`,e.Surface=`ux.surface`,e}({}),Lt=function(e){return e.Foreground=`foreground`,e.Background=`background`,e}({}),Rt=function(e){return e.DeclarativeLegacy=`react_router_declarative_legacy`,e.Declarative=`react_router_declarative`,e.Data=`react_router_data`,e.Manual=`manual`,e}({}),zt=e=>e.visibilityState===`hidden`?Lt.Background:Lt.Foreground,Bt=globalThis,Vt=(e,t)=>!t||t<=0||t>100?!1:t>=Ht(e),Ht=e=>{if(e.length<6)return 0;let t=e.slice(-6),n=Math.pow(16,6)-1;return parseInt(t,16)/n*100},Ut=y(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function Wt(e){return e.setValue(Ut,!0)}function Gt(e){return e.getValue(Ut)===!0}function Kt(e){"@babel/helpers - typeof";return Kt=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Kt(e)}function qt(e,t){if(Kt(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Kt(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Jt(e){var t=qt(e,`string`);return Kt(t)==`symbol`?t:t+``}function j(e,t,n){return(t=Jt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let Yt=`http.method`,Xt=`http.url`,Zt=`http.status_code`,Qt=`error.type`,$t=`exception.message`,en=`exception.stacktrace`,M=`exception.type`,tn=`http.request.method`,nn=`http.request.method_original`,rn=`http.response.status_code`,an=`server.address`,on=`server.port`,sn=`service.name`,cn=`telemetry.sdk.language`,ln=`webjs`,un=`telemetry.sdk.name`,dn=`telemetry.sdk.version`,N=`url.full`,fn=`user_agent.original`,pn=Math.pow(10,6);function mn(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*pn)]}function hn(e){return e[0]*1e3+e[1]/1e6}var gn;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(gn||(gn={}));let _n=`[_0-9a-z-*/]`,vn=`[a-z]${_n}{0,255}`,yn=`[a-z0-9]${_n}{0,240}@[a-z]${_n}{0,13}`,bn=RegExp(`^(?:${vn}|${yn})$`),xn=/^[ -~]{0,255}[!-~]$/,Sn=/,|=/;function Cn(e){return bn.test(e)}function wn(e){return xn.test(e)&&!Sn.test(e)}var Tn=class e{constructor(e){j(this,`_internalState`,new Map),e&&this._parse(e)}set(e,t){let n=this._clone();return n._internalState.has(e)&&n._internalState.delete(e),n._internalState.set(e,t),n}unset(e){let t=this._clone();return t._internalState.delete(e),t}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,t)=>(e.push(t+`=`+this.get(t)),e),[]).join(`,`)}_parse(e){e.length>512||(this._internalState=e.split(`,`).reverse().reduce((e,t)=>{let n=t.trim(),r=n.indexOf(`=`);if(r!==-1){let i=n.slice(0,r),a=n.slice(r+1,t.length);Cn(i)&&wn(a)&&e.set(i,a)}return e},new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let t=new e;return t._internalState=new Map(this._internalState),t}};let En=`traceparent`,Dn=`tracestate`,On=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function kn(e){let t=On.exec(e);return!t||t[1]===`00`&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var An=class{inject(e,t,n){let r=O.getSpanContext(e);if(!r||Gt(e)||!et(r))return;let i=`00-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||w.NONE).toString(16)}`;n.set(t,En,i),r.traceState&&n.set(t,Dn,r.traceState.serialize())}extract(e,t,n){let r=n.get(t,En);if(!r)return e;let i=Array.isArray(r)?r[0]:r;if(typeof i!=`string`)return e;let a=kn(i);if(!a)return e;a.isRemote=!0;let o=n.get(t,Dn);if(o){let e=Array.isArray(o)?o.join(`,`):o;a.traceState=new Tn(typeof e==`string`?e:void 0)}return O.setSpanContext(e,a)}fields(){return[En,Dn]}},jn=class{constructor(){j(this,`_promise`,void 0),j(this,`_resolve`,void 0),j(this,`_reject`,void 0),this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}},Mn=class{constructor(e,t){j(this,`_isCalled`,!1),j(this,`_deferred`,new jn),j(this,`_callback`,void 0),j(this,`_that`,void 0),this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}};function Nn(e,t){return new Promise(n=>{T.with(Wt(T.active()),()=>{e.export(t,n)})})}let Pn={_export:Nn},Fn=e=>typeof e==`object`&&!!e&&typeof e.then==`function`;function In(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function P(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){In(a,r,i,o,s,`next`,e)}function s(e){In(a,r,i,o,s,`throw`,e)}o(void 0)})}}var Ln=class e{static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=Bn(t),r._asyncAttributesPending=t.filter(([e,t])=>Fn(t)).length>0,r}constructor(e,t){var n;j(this,`_rawAttributes`,void 0),j(this,`_asyncAttributesPending`,!1),j(this,`_schemaUrl`,void 0),j(this,`_memoizedAttributes`,void 0);let r=(n=e.attributes)==null?{}:n;this._rawAttributes=Object.entries(r).map(([e,t])=>(Fn(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=Bn(this._rawAttributes),this._schemaUrl=Vn(t==null?void 0:t.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}waitForAsyncAttributes(){var e=this;return P(function*(){if(e.asyncAttributesPending){for(let t=0;t<e._rawAttributes.length;t++){let[n,r]=e._rawAttributes[t];e._rawAttributes[t]=[n,Fn(r)?yield r:r]}e._asyncAttributesPending=!1}})()}get attributes(){if(this.asyncAttributesPending&&E.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(Fn(n)){E.debug(`Unsettled resource attribute ${t} skipped`);continue}n!=null&&(e[t]!=null||(e[t]=n))}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=Hn(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function Rn(e,t){return Ln.FromAttributeList(Object.entries(e),t)}function zn(){return Rn({})}function Bn(e){return e.map(([e,t])=>Fn(t)?[e,t.catch(t=>{E.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function Vn(e){if(typeof e==`string`||e===void 0)return e;E.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function Hn(e,t){let n=e==null?void 0:e.schemaUrl,r=t==null?void 0:t.schemaUrl,i=n===void 0||n===``,a=r===void 0||r===``;if(i)return r;if(a||n===r)return n;E.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}let Un=y(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function Wn(e){return e.setValue(Un,!0)}function Gn(e){return e.getValue(Un)===!0}let Kn=`baggage`;function qn(e){return e.reduce((e,t)=>{let n=`${e}${e===``?``:`,`}${t}`;return n.length>8192?e:n},``)}function Jn(e){return e.getAllEntries().map(([e,t])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(t.value)}`;return t.metadata!==void 0&&(n+=`;`+t.metadata.toString()),n})}function Yn(e){if(!e)return;let t=e.indexOf(`;`),n=t===-1?e:e.substring(0,t),r=n.indexOf(`=`);if(r<=0)return;let i=n.substring(0,r).trim(),a=n.substring(r+1).trim();if(!i||!a)return;let o,s;try{o=decodeURIComponent(i),s=decodeURIComponent(a)}catch(e){return}let c;return t!==-1&&t<e.length-1&&(c=le(e.substring(t+1))),{key:o,value:s,metadata:c}}var Xn=class{inject(e,t,n){let r=D.getBaggage(e);if(!r||Gn(e))return;let i=qn(Jn(r).filter(e=>e.length<=4096).slice(0,180));i.length>0&&n.set(t,Kn,i)}extract(e,t,n){let r=n.get(t,Kn),i=Array.isArray(r)?r.join(`,`):r;if(!i)return e;let a={};return i.length===0||(i.split(`,`).forEach(e=>{let t=Yn(e);if(t){let e={value:t.value};t.metadata&&(e.metadata=t.metadata),a[t.key]=e}}),Object.entries(a).length===0)?e:D.setBaggage(e,D.createBaggage(a))}fields(){return[Kn]}};function Zn(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!Qn(n)){E.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!$n(r)){E.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function Qn(e){return typeof e==`string`&&e!==``}function $n(e){return e==null?!0:Array.isArray(e)?er(e):tr(typeof e)}function er(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(tr(e)){t=e;continue}return!1}return!1}}return!0}function tr(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}function nr(){return e=>{E.error(rr(e))}}function rr(e){return typeof e==`string`?e:JSON.stringify(ir(e))}function ir(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(e=>{if(t[e])return;let r=n[e];r&&(t[e]=String(r))}),n=Object.getPrototypeOf(n);return t}let ar=nr();function or(e){try{ar(e)}catch(e){}}let sr={[un]:`opentelemetry`,"process.runtime.name":`browser`,[cn]:ln,[dn]:`2.6.0`},cr=performance,lr=Math.pow(10,6),ur=Math.pow(10,9);function F(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*lr)]}function dr(e){return gr(F(cr.timeOrigin),F(typeof e==`number`?e:cr.now()))}function fr(e){if(mr(e))return e;if(typeof e==`number`)return e<cr.timeOrigin?dr(e):F(e);if(e instanceof Date)return F(e.getTime());throw TypeError(`Invalid input type`)}function pr(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=ur),[n,r]}function I(e){return e[0]*ur+e[1]}function mr(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function hr(e){return mr(e)||typeof e==`number`||e instanceof Date}function gr(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=ur&&(n[1]-=ur,n[0]+=1),n}var _r;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(_r||(_r={}));var vr=class{constructor(e={}){var t;j(this,`_propagators`,void 0),j(this,`_fields`,void 0),this._propagators=(t=e.propagators)==null?[]:t,this._fields=Array.from(new Set(this._propagators.map(e=>typeof e.fields==`function`?e.fields():[]).reduce((e,t)=>e.concat(t),[])))}inject(e,t,n){for(let r of this._propagators)try{r.inject(e,t,n)}catch(e){E.warn(`Failed to inject with ${r.constructor.name}. Err: ${e.message}`)}}extract(e,t,n){return this._propagators.reduce((e,r)=>{try{return r.extract(e,t,n)}catch(e){E.warn(`Failed to extract with ${r.constructor.name}. Err: ${e.message}`)}return e},e)}fields(){return this._fields.slice()}};let yr=`[_0-9a-z-*/]`,br=`[a-z]${yr}{0,255}`,xr=`[a-z0-9]${yr}{0,240}@[a-z]${yr}{0,13}`,Sr=RegExp(`^(?:${br}|${xr})$`),Cr=/^[ -~]{0,255}[!-~]$/,wr=/,|=/;function Tr(e){return Sr.test(e)}function Er(e){return Cr.test(e)&&!wr.test(e)}var Dr=class e{constructor(e){j(this,`_internalState`,new Map),e&&this._parse(e)}set(e,t){let n=this._clone();return n._internalState.has(e)&&n._internalState.delete(e),n._internalState.set(e,t),n}unset(e){let t=this._clone();return t._internalState.delete(e),t}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,t)=>(e.push(t+`=`+this.get(t)),e),[]).join(`,`)}_parse(e){e.length>512||(this._internalState=e.split(`,`).reverse().reduce((e,t)=>{let n=t.trim(),r=n.indexOf(`=`);if(r!==-1){let i=n.slice(0,r),a=n.slice(r+1,t.length);Tr(i)&&Er(a)&&e.set(i,a)}return e},new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let t=new e;return t._internalState=new Map(this._internalState),t}};let Or=`traceparent`,kr=`tracestate`,Ar=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function jr(e){let t=Ar.exec(e);return!t||t[1]===`00`&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var Mr=class{inject(e,t,n){let r=O.getSpanContext(e);if(!r||Gn(e)||!et(r))return;let i=`00-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||w.NONE).toString(16)}`;n.set(t,Or,i),r.traceState&&n.set(t,kr,r.traceState.serialize())}extract(e,t,n){let r=n.get(t,Or);if(!r)return e;let i=Array.isArray(r)?r[0]:r;if(typeof i!=`string`)return e;let a=jr(i);if(!a)return e;a.isRemote=!0;let o=n.get(t,kr);if(o){let e=Array.isArray(o)?o.join(`,`):o;a.traceState=new Dr(typeof e==`string`?e:void 0)}return O.setSpanContext(e,a)}fields(){return[Or,kr]}};let Nr=Function.prototype.toString,Pr=Nr.call(Object),Fr=Object.getPrototypeOf,Ir=Object.prototype,Lr=Ir.hasOwnProperty,Rr=Symbol?Symbol.toStringTag:void 0,zr=Ir.toString;function Br(e){if(!Vr(e)||Hr(e)!==`[object Object]`)return!1;let t=Fr(e);if(t===null)return!0;let n=Lr.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&Nr.call(n)===Pr}function Vr(e){return typeof e==`object`&&!!e}function Hr(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Rr&&Rr in Object(e)?Ur(e):Wr(e)}function Ur(e){let t=Lr.call(e,Rr),n=e[Rr],r=!1;try{e[Rr]=void 0,r=!0}catch(e){}let i=zr.call(e);return r&&(t?e[Rr]=n:delete e[Rr]),i}function Wr(e){return zr.call(e)}function Gr(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=qr(t,e.shift(),0,n);return t}function Kr(e){return Yr(e)?e.slice():e}function qr(e,t,n=0,r){let i;if(!(n>20)){if(n++,Qr(e)||Qr(t)||Xr(t))i=Kr(t);else if(Yr(e)){if(i=e.slice(),Yr(t))for(let e=0,n=t.length;e<n;e++)i.push(Kr(t[e]));else if(Zr(t)){let e=Object.keys(t);for(let n=0,r=e.length;n<r;n++){let r=e[n];i[r]=Kr(t[r])}}}else if(Zr(e))if(Zr(t)){if(!$r(e,t))return t;i=Object.assign({},e);let a=Object.keys(t);for(let o=0,s=a.length;o<s;o++){let s=a[o],c=t[s];if(Qr(c))c===void 0?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(Jr(e,s,r)||Jr(t,s,r))delete i[s];else{if(Zr(a)&&Zr(o)){let n=r.get(a)||[],i=r.get(o)||[];n.push({obj:e,key:s}),i.push({obj:t,key:s}),r.set(a,n),r.set(o,i)}i[s]=qr(i[s],c,n,r)}}}}else i=t;return i}}function Jr(e,t,n){let r=n.get(e[t])||[];for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i.key===t&&i.obj===e)return!0}return!1}function Yr(e){return Array.isArray(e)}function Xr(e){return typeof e==`function`}function Zr(e){return!Qr(e)&&!Yr(e)&&!Xr(e)&&typeof e==`object`}function Qr(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function $r(e,t){return!(!Br(e)||!Br(t))}function ei(e,t){return typeof t==`string`?e===t:!!e.match(t)}var ti=class{constructor(){j(this,`_promise`,void 0),j(this,`_resolve`,void 0),j(this,`_reject`,void 0),this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}},ni=class{constructor(e,t){j(this,`_isCalled`,!1),j(this,`_deferred`,new ti),j(this,`_callback`,void 0),j(this,`_that`,void 0),this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}};let ri;function ii(){if(ri===void 0)try{let e=globalThis.process.argv0;ri=e?`unknown_service:${e}`:`unknown_service`}catch(e){ri=`unknown_service`}return ri}let ai=e=>typeof e==`object`&&!!e&&typeof e.then==`function`;var oi=class e{static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=li(t),r._asyncAttributesPending=t.filter(([e,t])=>ai(t)).length>0,r}constructor(e,t){var n;j(this,`_rawAttributes`,void 0),j(this,`_asyncAttributesPending`,!1),j(this,`_schemaUrl`,void 0),j(this,`_memoizedAttributes`,void 0);let r=(n=e.attributes)==null?{}:n;this._rawAttributes=Object.entries(r).map(([e,t])=>(ai(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=li(this._rawAttributes),this._schemaUrl=ui(t==null?void 0:t.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}waitForAsyncAttributes(){var e=this;return P(function*(){if(e.asyncAttributesPending){for(let t=0;t<e._rawAttributes.length;t++){let[n,r]=e._rawAttributes[t];e._rawAttributes[t]=[n,ai(r)?yield r:r]}e._asyncAttributesPending=!1}})()}get attributes(){if(this.asyncAttributesPending&&E.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(ai(n)){E.debug(`Unsettled resource attribute ${t} skipped`);continue}n!=null&&(e[t]!=null||(e[t]=n))}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=di(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function si(e,t){return oi.FromAttributeList(Object.entries(e),t)}function ci(){return si({[sn]:ii(),[cn]:sr[cn],[un]:sr[un],[dn]:sr[dn]})}function li(e){return e.map(([e,t])=>ai(t)?[e,t.catch(t=>{E.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function ui(e){if(typeof e==`string`||e===void 0)return e;E.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function di(e,t){let n=e==null?void 0:e.schemaUrl,r=t==null?void 0:t.schemaUrl,i=n===void 0||n===``,a=r===void 0||r===``;if(i)return r;if(a||n===r)return n;E.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}function fi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function L(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?fi(Object(n),!0).forEach(function(t){j(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var pi=class{constructor(e){var t;j(this,`_spanContext`,void 0),j(this,`kind`,void 0),j(this,`parentSpanContext`,void 0),j(this,`attributes`,{}),j(this,`links`,[]),j(this,`events`,[]),j(this,`startTime`,void 0),j(this,`resource`,void 0),j(this,`instrumentationScope`,void 0),j(this,`_droppedAttributesCount`,0),j(this,`_droppedEventsCount`,0),j(this,`_droppedLinksCount`,0),j(this,`_attributesCount`,0),j(this,`name`,void 0),j(this,`status`,{code:dt.UNSET}),j(this,`endTime`,[0,0]),j(this,`_ended`,!1),j(this,`_duration`,[-1,-1]),j(this,`_spanProcessor`,void 0),j(this,`_spanLimits`,void 0),j(this,`_attributeValueLengthLimit`,void 0),j(this,`_recordEndMetrics`,void 0),j(this,`_performanceStartTime`,void 0),j(this,`_performanceOffset`,void 0),j(this,`_startTimeProvided`,void 0);let n=Date.now();this._spanContext=e.spanContext,this._performanceStartTime=cr.now(),this._performanceOffset=n-(this._performanceStartTime+cr.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit||0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,this.links=e.links||[],this.startTime=this._getTime((t=e.startTime)==null?n:t),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(t==null||this._isSpanEnded())return this;if(e.length===0)return E.warn(`Invalid attribute key: ${e}`),this;if(!$n(t))return E.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:n}=this._spanLimits,r=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n!==void 0&&this._attributesCount>=n&&r?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(t),r&&this._attributesCount++,this)}setAttributes(e){for(let[t,n]of Object.entries(e))this.setAttribute(t,n);return this}addEvent(e,t,n){if(this._isSpanEnded())return this;let{eventCountLimit:r}=this._spanLimits;if(r===0)return E.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&E.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),hr(t)&&(hr(n)||(n=t),t=void 0);let i=Zn(t);return this.events.push({name:e,attributes:i,time:this._getTime(n),droppedAttributesCount:0}),this}addLink(e){return this.links.push(e),this}addLinks(e){return this.links.push(...e),this}setStatus(e){return this._isSpanEnded()?this:(this.status=L({},e),this.status.message!=null&&typeof e.message!=`string`&&(E.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`),delete this.status.message),this)}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){var t;if(this._isSpanEnded()){E.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=pr(this.startTime,this.endTime),this._duration[0]<0&&(E.warn(`Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.`,this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&E.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),(t=this._recordEndMetrics)==null||t.call(this),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e==`number`&&e<=cr.now())return dr(e+this._performanceOffset);if(typeof e==`number`)return F(e);if(e instanceof Date)return F(e.getTime());if(mr(e))return e;if(this._startTimeProvided)return F(Date.now());let t=cr.now()-this._performanceStartTime;return gr(this.startTime,F(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[$t]=e:e&&(e.code?n[M]=e.code.toString():e.name&&(n[M]=e.name),e.message&&(n[$t]=e.message),e.stack&&(n[en]=e.stack)),n[M]||n[$t]?this.addEvent(`exception`,n,t):E.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let e=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);E.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(E.warn(`Attribute value limit must be positive, got ${t}`),e):typeof e==`string`?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>typeof e==`string`?this._truncateToLimitUtil(e,t):e):e}},R;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(R||(R={}));var mi=class{shouldSample(){return{decision:R.NOT_RECORD}}toString(){return`AlwaysOffSampler`}},hi=class{shouldSample(){return{decision:R.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}},gi=class{constructor(e){var t,n,r,i;j(this,`_root`,void 0),j(this,`_remoteParentSampled`,void 0),j(this,`_remoteParentNotSampled`,void 0),j(this,`_localParentSampled`,void 0),j(this,`_localParentNotSampled`,void 0),this._root=e.root,this._root||(or(Error(`ParentBasedSampler must have a root sampler configured`)),this._root=new hi),this._remoteParentSampled=(t=e.remoteParentSampled)==null?new hi:t,this._remoteParentNotSampled=(n=e.remoteParentNotSampled)==null?new mi:n,this._localParentSampled=(r=e.localParentSampled)==null?new hi:r,this._localParentNotSampled=(i=e.localParentNotSampled)==null?new mi:i}shouldSample(e,t,n,r,i,a){let o=O.getSpanContext(e);return!o||!et(o)?this._root.shouldSample(e,t,n,r,i,a):o.isRemote?o.traceFlags&w.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,a):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,a):o.traceFlags&w.SAMPLED?this._localParentSampled.shouldSample(e,t,n,r,i,a):this._localParentNotSampled.shouldSample(e,t,n,r,i,a)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}},_i=class{constructor(e=0){j(this,`_ratio`,void 0),j(this,`_upperBound`,void 0),this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:Qe(t)&&this._accumulate(t)<this._upperBound?R.RECORD_AND_SAMPLED:R.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!=`number`||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let t=0;for(let n=0;n<e.length/8;n++){let r=n*8,i=parseInt(e.slice(r,r+8),16);t=(t^i)>>>0}return t}},z;(function(e){e.AlwaysOff=`always_off`,e.AlwaysOn=`always_on`,e.ParentBasedAlwaysOff=`parentbased_always_off`,e.ParentBasedAlwaysOn=`parentbased_always_on`,e.ParentBasedTraceIdRatio=`parentbased_traceidratio`,e.TraceIdRatio=`traceidratio`})(z||(z={}));function vi(){var e,t,n,r,i,a,o,s;return{sampler:yi(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:(e=void 0)==null?1/0:e,attributeCountLimit:(t=void 0)==null?128:t},spanLimits:{attributeValueLengthLimit:(n=void 0)==null?1/0:n,attributeCountLimit:(r=void 0)==null?128:r,linkCountLimit:(i=void 0)==null?128:i,eventCountLimit:(a=void 0)==null?128:a,attributePerEventCountLimit:(o=void 0)==null?128:o,attributePerLinkCountLimit:(s=void 0)==null?128:s}}}function yi(){var e;let t=(e=void 0)==null?z.ParentBasedAlwaysOn:e;switch(t){case z.AlwaysOn:return new hi;case z.AlwaysOff:return new mi;case z.ParentBasedAlwaysOn:return new gi({root:new hi});case z.ParentBasedAlwaysOff:return new gi({root:new mi});case z.TraceIdRatio:return new _i(bi());case z.ParentBasedTraceIdRatio:return new gi({root:new _i(bi())});default:return E.error(`OTEL_TRACES_SAMPLER value "${t}" invalid, defaulting to "${z.ParentBasedAlwaysOn}".`),new gi({root:new hi})}}function bi(){return E.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to 1.`),1}function xi(e){let t={sampler:yi()},n=vi(),r=Object.assign({},n,t,e);return r.generalLimits=Object.assign({},n.generalLimits,e.generalLimits||{}),r.spanLimits=Object.assign({},n.spanLimits,e.spanLimits||{}),r}function Si(e){var t,n,r,i,a,o,s,c,l,u,d,f;let p=Object.assign({},e.spanLimits);return p.attributeCountLimit=(t=(n=(r=(i=(a=e.spanLimits)==null?void 0:a.attributeCountLimit)==null?(o=e.generalLimits)==null?void 0:o.attributeCountLimit:i)==null?void 0:r)==null?void 0:n)==null?128:t,p.attributeValueLengthLimit=(s=(c=(l=(u=(d=e.spanLimits)==null?void 0:d.attributeValueLengthLimit)==null?(f=e.generalLimits)==null?void 0:f.attributeValueLengthLimit:u)==null?void 0:l)==null?void 0:c)==null?1/0:s,Object.assign({},e,{spanLimits:p})}var Ci=class{constructor(e,t){var n,r,i,a;j(this,`_maxExportBatchSize`,void 0),j(this,`_maxQueueSize`,void 0),j(this,`_scheduledDelayMillis`,void 0),j(this,`_exportTimeoutMillis`,void 0),j(this,`_exporter`,void 0),j(this,`_isExporting`,!1),j(this,`_finishedSpans`,[]),j(this,`_timer`,void 0),j(this,`_shutdownOnce`,void 0),j(this,`_droppedSpansCount`,0),this._exporter=e,this._maxExportBatchSize=typeof(t==null?void 0:t.maxExportBatchSize)==`number`?t.maxExportBatchSize:(n=void 0)==null?512:n,this._maxQueueSize=typeof(t==null?void 0:t.maxQueueSize)==`number`?t.maxQueueSize:(r=void 0)==null?2048:r,this._scheduledDelayMillis=typeof(t==null?void 0:t.scheduledDelayMillis)==`number`?t.scheduledDelayMillis:(i=void 0)==null?5e3:i,this._exportTimeoutMillis=typeof(t==null?void 0:t.exportTimeoutMillis)==`number`?t.exportTimeoutMillis:(a=void 0)==null?3e4:a,this._shutdownOnce=new ni(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(E.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&w.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&E.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(E.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,t)=>{let n=[],r=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let e=0,t=r;e<t;e++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,t)=>{let n=setTimeout(()=>{t(Error(`Timeout`))},this._exportTimeoutMillis);T.with(Wn(T.active()),()=>{let r;this._finishedSpans.length<=this._maxExportBatchSize?(r=this._finishedSpans,this._finishedSpans=[]):r=this._finishedSpans.splice(0,this._maxExportBatchSize);let i=()=>this._exporter.export(r,r=>{if(clearTimeout(n),r.code===_r.SUCCESS)e();else{var i;t((i=r.error)==null?Error(`BatchSpanProcessor: span export failed`):i)}}),a=null;for(let e=0,t=r.length;e<t;e++){let t=r[e];t.resource.asyncAttributesPending&&t.resource.waitForAsyncAttributes&&(a!=null||(a=[]),a.push(t.resource.waitForAsyncAttributes()))}a===null?i():Promise.all(a).then(i,e=>{or(e),t(e)})})})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,or(e)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}},wi=class extends Ci{constructor(e,t){super(e,t),j(this,`_visibilityChangeListener`,void 0),j(this,`_pageHideListener`,void 0),this.onInit(t)}onInit(e){(e==null?void 0:e.disableAutoFlushOnDocumentHide)!==!0&&typeof document<`u`&&(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush().catch(e=>{or(e)})},this._pageHideListener=()=>{this.forceFlush().catch(e=>{or(e)})},document.addEventListener(`visibilitychange`,this._visibilityChangeListener),document.addEventListener(`pagehide`,this._pageHideListener))}onShutdown(){typeof document<`u`&&(this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener(`pagehide`,this._pageHideListener))}};let Ti=new Uint8Array(16),Ei=new Uint8Array(8),Di=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function Oi(e){for(let t=0;t<e.length;t++)e[t]=Math.random()*256>>>0;for(let t=0;t<e.length;t++)if(e[t]>0)return;e[e.length-1]=1}function ki(e){let t=``;for(let n=0;n<e.length;n++)t+=Di[e[n]];return t}var Ai=class{generateTraceId(){return Oi(Ti),ki(Ti)}generateSpanId(){return Oi(Ei),ki(Ei)}};let ji=`otel.span.sampling_result`;var Mi=class{constructor(e){j(this,`startedSpans`,void 0),j(this,`liveSpans`,void 0),this.startedSpans=e.createCounter(`otel.sdk.span.started`,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(`otel.sdk.span.live`,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=Pi(t);if(this.startedSpans.add(1,{"otel.span.parent.origin":Ni(e),[ji]:n}),t===R.NOT_RECORD)return()=>{};let r={[ji]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}};function Ni(e){return e?e.isRemote?`remote`:`local`:`none`}function Pi(e){switch(e){case R.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case R.RECORD:return`RECORD_ONLY`;case R.NOT_RECORD:return`DROP`}}var Fi=class{constructor(e,t,n,r){j(this,`_sampler`,void 0),j(this,`_generalLimits`,void 0),j(this,`_spanLimits`,void 0),j(this,`_idGenerator`,void 0),j(this,`instrumentationScope`,void 0),j(this,`_resource`,void 0),j(this,`_spanProcessor`,void 0),j(this,`_tracerMetrics`,void 0);let i=xi(t);this._sampler=i.sampler,this._generalLimits=i.generalLimits,this._spanLimits=i.spanLimits,this._idGenerator=t.idGenerator||new Ai,this._resource=n,this._spanProcessor=r,this.instrumentationScope=e,this._tracerMetrics=new Mi(i.meterProvider?i.meterProvider.getMeter(`@opentelemetry/sdk-trace`,`2.6.0`):Oe())}startSpan(e,t={},n=T.active()){var r,i,a;t.root&&(n=O.deleteSpan(n));let o=O.getSpan(n);if(Gn(n))return E.debug(`Instrumentation suppressed, returning Noop Span`),O.wrapSpanContext(Ve);let s=o==null?void 0:o.spanContext(),c=this._idGenerator.generateSpanId(),l,u,d;!s||!O.isSpanContextValid(s)?u=this._idGenerator.generateTraceId():(u=s.traceId,d=s.traceState,l=s);let f=(r=t.kind)==null?ut.INTERNAL:r,p=((i=t.links)==null?[]:i).map(e=>({context:e.context,attributes:Zn(e.attributes)})),ee=Zn(t.attributes),m=this._sampler.shouldSample(n,u,e,f,ee,p),h=this._tracerMetrics.startSpan(s,m.decision);d=(a=m.traceState)==null?d:a;let te=m.decision===lt.RECORD_AND_SAMPLED?w.SAMPLED:w.NONE,g={traceId:u,spanId:c,traceFlags:te,traceState:d};if(m.decision===lt.NOT_RECORD)return E.debug(`Recording is off, propagating context in a non-recording span`),O.wrapSpanContext(g);let ne=Zn(Object.assign(ee,m.attributes));return new pi({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:g,name:e,kind:f,links:p,parentSpanContext:l,attributes:ne,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:h})}startActiveSpan(e,t,n,r){var i;let a,o,s;if(arguments.length<2)return;arguments.length===2?s=t:arguments.length===3?(a=t,s=n):(a=t,o=n,s=r);let c=(i=o)==null?T.active():i,l=this.startSpan(e,a,c),u=O.setSpan(c,l);return T.with(u,s,void 0,l)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}},Ii=class{constructor(e){j(this,`_spanProcessors`,void 0),this._spanProcessors=e}forceFlush(){let e=[];for(let t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(e=>{or(e||Error(`MultiSpanProcessor: forceFlush failed`)),t()})})}onStart(e,t){for(let n of this._spanProcessors)n.onStart(e,t)}onEnding(e){for(let t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(let t of this._spanProcessors)t.onEnd(e)}shutdown(){let e=[];for(let t of this._spanProcessors)e.push(t.shutdown());return new Promise((t,n)=>{Promise.all(e).then(()=>{t()},n)})}},Li;(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(Li||(Li={}));var Ri=class{constructor(e={}){var t,n;j(this,`_config`,void 0),j(this,`_tracers`,new Map),j(this,`_resource`,void 0),j(this,`_activeSpanProcessor`,void 0);let r=Gr({},vi(),Si(e));this._resource=(t=r.resource)==null?ci():t,this._config=Object.assign({},r,{resource:this._resource});let i=[];(n=e.spanProcessors)!=null&&n.length&&i.push(...e.spanProcessors),this._activeSpanProcessor=new Ii(i)}getTracer(e,t,n){let r=`${e}@${t||``}:${(n==null?void 0:n.schemaUrl)||``}`;return this._tracers.has(r)||this._tracers.set(r,new Fi({name:e,version:t,schemaUrl:n==null?void 0:n.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(r)}forceFlush(){let e=this._config.forceFlushTimeoutMillis,t=this._activeSpanProcessor._spanProcessors.map(t=>new Promise(n=>{let r,i=setTimeout(()=>{n(Error(`Span processor did not completed within timeout period of ${e} ms`)),r=Li.timeout},e);t.forceFlush().then(()=>{clearTimeout(i),r!==Li.timeout&&(r=Li.resolved,n(r))}).catch(e=>{clearTimeout(i),r=Li.error,n(e)})}));return new Promise((e,n)=>{Promise.all(t).then(t=>{let r=t.filter(e=>e!==Li.resolved);r.length>0?n(r):e()}).catch(e=>n([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}},zi=class{constructor(){j(this,`_enabled`,!1),j(this,`_currentContext`,b)}_bindFunction(e=b,t){let n=this,r=function(...r){return n.with(e,()=>t.apply(this,r))};return Object.defineProperty(r,`length`,{enumerable:!1,configurable:!0,writable:!1,value:t.length}),r}active(){return this._currentContext}bind(e,t){return e===void 0&&(e=this.active()),typeof t==`function`?this._bindFunction(e,t):t}disable(){return this._currentContext=b,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=b,this)}with(e,t,n,...r){let i=this._currentContext;this._currentContext=e||b;try{return t.call(n,...r)}finally{this._currentContext=i}}};function Bi(e){if(e!==null){if(e===void 0){let e=new zi;e.enable(),T.setGlobalContextManager(e);return}e.enable(),T.setGlobalContextManager(e)}}function Vi(e){if(e!==null){if(e===void 0){D.setGlobalPropagator(new vr({propagators:[new Mr,new Xn]}));return}D.setGlobalPropagator(e)}}var Hi=class extends Ri{constructor(e={}){super(e)}register(e={}){O.setGlobalTracerProvider(this),Vi(e.propagator),Bi(e.contextManager)}},B;(function(e){e.CONNECT_END=`connectEnd`,e.CONNECT_START=`connectStart`,e.DECODED_BODY_SIZE=`decodedBodySize`,e.DOM_COMPLETE=`domComplete`,e.DOM_CONTENT_LOADED_EVENT_END=`domContentLoadedEventEnd`,e.DOM_CONTENT_LOADED_EVENT_START=`domContentLoadedEventStart`,e.DOM_INTERACTIVE=`domInteractive`,e.DOMAIN_LOOKUP_END=`domainLookupEnd`,e.DOMAIN_LOOKUP_START=`domainLookupStart`,e.ENCODED_BODY_SIZE=`encodedBodySize`,e.FETCH_START=`fetchStart`,e.LOAD_EVENT_END=`loadEventEnd`,e.LOAD_EVENT_START=`loadEventStart`,e.NAVIGATION_START=`navigationStart`,e.REDIRECT_END=`redirectEnd`,e.REDIRECT_START=`redirectStart`,e.REQUEST_START=`requestStart`,e.RESPONSE_END=`responseEnd`,e.RESPONSE_START=`responseStart`,e.SECURE_CONNECTION_START=`secureConnectionStart`,e.START_TIME=`startTime`,e.UNLOAD_EVENT_END=`unloadEventEnd`,e.UNLOAD_EVENT_START=`unloadEventStart`})(B||(B={}));let Ui;function Wi(){return Ui||(Ui=document.createElement(`a`)),Ui}function Gi(e,t){return t in e}function V(e,t,n,r=!0){if(Gi(n,t)&&typeof n[t]==`number`&&!(r&&n[t]===0))return e.addEvent(t,n[t])}function Ki(e,t,n=!1,r,i){if(r===void 0&&(r=t[B.START_TIME]!==0),n||(V(e,B.FETCH_START,t,r),V(e,B.DOMAIN_LOOKUP_START,t,r),V(e,B.DOMAIN_LOOKUP_END,t,r),V(e,B.CONNECT_START,t,r),V(e,B.SECURE_CONNECTION_START,t,r),V(e,B.CONNECT_END,t,r),V(e,B.REQUEST_START,t,r),V(e,B.RESPONSE_START,t,r),V(e,B.RESPONSE_END,t,r)),!i){let n=t[B.ENCODED_BODY_SIZE];n!==void 0&&e.setAttribute(`http.response_content_length`,n);let r=t[B.DECODED_BODY_SIZE];r!==void 0&&n!==r&&e.setAttribute(`http.response_content_length_uncompressed`,r)}}function qi(e){return e.slice().sort((e,t)=>{let n=e[B.FETCH_START],r=t[B.FETCH_START];return n>r?1:n<r?-1:0})}function Ji(){return typeof location<`u`?location.origin:void 0}function Yi(e,t,n,r,i=new WeakSet,a){let o=H(e);e=o.toString();let s=Zi(e,t,n,r,i,a);if(s.length===0)return{mainRequest:void 0};if(s.length===1)return{mainRequest:s[0]};let c=qi(s);if(o.origin!==Ji()&&c.length>1){let e=c[0],t=Xi(c,e[B.RESPONSE_END],n),r=e[B.RESPONSE_END];return t[B.FETCH_START]<r&&(t=e,e=void 0),{corsPreFlightRequest:e,mainRequest:t}}else return{mainRequest:s[0]}}function Xi(e,t,n){let r=I(n),i=I(fr(t)),a=e[1],o,s=e.length;for(let t=1;t<s;t++){let n=e[t],s=I(fr(n[B.FETCH_START])),c=r-I(fr(n[B.RESPONSE_END]));s>=i&&(!o||c<o)&&(o=c,a=n)}return a}function Zi(e,t,n,r,i,a){let o=I(t),s=I(n),c=r.filter(t=>{let n=I(fr(t[B.FETCH_START])),r=I(fr(t[B.RESPONSE_END]));return t.initiatorType.toLowerCase()===(a||`xmlhttprequest`)&&t.name===e&&n>=o&&r<=s});return c.length>0&&(c=c.filter(e=>!i.has(e))),c}function H(e){if(typeof URL==`function`)return new URL(e,typeof document<`u`?document.baseURI:typeof location<`u`?location.href:void 0);let t=Wi();return t.href=e,t}function Qi(e,t){let n=t||[];return(typeof n==`string`||n instanceof RegExp)&&(n=[n]),H(e).origin===Ji()?!0:n.some(t=>ei(e,t))}let $i=`mxl_pending_`;var ea=class{constructor({resource:e=zn(),storage:t=window.localStorage,diag:n=E.createComponentLogger({namespace:`MXLSpanStorage`}),storedSpansExpireTimeoutMS:r=3600*1e3,onExpiredSpansExport:i,spanSessionManager:a}){j(this,`_noExportTracer`,void 0),j(this,`_storage`,void 0),j(this,`_diag`,void 0),j(this,`_onExpiredSpansExport`,void 0),j(this,`_storedSpansExpireTimeoutMS`,void 0),j(this,`_spanSessionManager`,void 0),j(this,`_checkExpiredSpansInterval`,void 0),this._noExportTracer=new Ri({resource:e}).getTracer(`mxl-web-sdk-sessions`),this._storage=t,this._diag=n,this._storedSpansExpireTimeoutMS=r,this._onExpiredSpansExport=i,this._spanSessionManager=a,this.startExpiredSpansCheck()}storePendingSpans(e,t,n){try{if(this.clearStoredSpans(e),this._getPendingSpansKeys().length>=10){this._spanSessionManager.incrSessionCountForKey(`mxl.max_pending_spans_reached`),this._diag.warn(`Not storing pending spans as the max number of items was reached`);return}let r=`${$i}${e}_${Date.now()}`;this._storage.setItem(r,JSON.stringify([t,...n],(e,t)=>e.startsWith(`_`)?void 0:t)),this._diag.debug(`Stored pending span: ${r}`)}catch(e){this._diag.error(`Failed to store spans to storage:`,e)}}clearStoredSpans(e){try{let t=`${$i}${e}_`;this._getPendingSpansKeys().forEach(e=>{e.startsWith(t)&&this._storage.removeItem(e)})}catch(e){this._diag.error(`Failed to clear stored spans from storage:`,e)}}startExpiredSpansCheck(){this._checkExpiredSpansInterval=setInterval(()=>{this.checkAndExportExpiredSpans()},300*1e3)}stopExpiredSpansCheck(){this._checkExpiredSpansInterval&&(clearInterval(this._checkExpiredSpansInterval),this._checkExpiredSpansInterval=void 0)}checkAndExportExpiredSpans(){try{let e=this._getPendingSpansKeys();if(e.length===0)return;let t=Date.now();e.forEach(e=>{let n=e.split(`_`),r=parseInt(n[n.length-1],10);if(Number.isNaN(r)&&(this._diag.error(`Found invalid timestamp in stored span:`,r),this._storage.removeItem(e)),t-r<=this._storedSpansExpireTimeoutMS)return;let i=this._storage.getItem(e);if(i){try{let e=[];for(let t of JSON.parse(i)){let n=this._noExportTracer.startSpan(t.name,{kind:t.kind,attributes:t.attributes,links:t.links,startTime:t.startTime});n.setStatus(t.status),n.end(t.endTime),e.push(n)}this._onExpiredSpansExport&&e.length>0&&this._onExpiredSpansExport(e)}catch(e){this._diag.error(`Failed to process expired spans:`,e)}this._storage.removeItem(e)}})}catch(e){this._diag.error(`Failed to check and export expired spans:`,e)}}_getPendingSpansKeys(){let e=[];for(let t=0;t<this._storage.length;t++){let n=this._storage.key(t);n!=null&&n.startsWith($i)&&e.push(n)}return e}destroy(){this.stopExpiredSpansCheck()}},ta=class{constructor(e,t){j(this,`_keyPrefix`,void 0),j(this,`_storage`,void 0),this._keyPrefix=`${e}_`,this._storage=t}getNamespacedKeys(){let e=[];for(let t=0;t<this._storage.length;t++){let n=this._storage.key(t);n!=null&&n.startsWith(this._keyPrefix)&&e.push(n.substring(this._keyPrefix.length))}return e}get length(){return this.getNamespacedKeys().length}clear(){this.getNamespacedKeys().forEach(e=>{this._storage.removeItem(`${this._keyPrefix}${e}`)})}getItem(e){return this._storage.getItem(`${this._keyPrefix}${e}`)}key(e){return this.getNamespacedKeys()[e]||null}removeItem(e){this._storage.removeItem(`${this._keyPrefix}${e}`)}setItem(e,t){this._storage.setItem(`${this._keyPrefix}${e}`,t)}};let na=({diag:e,featureManager:t,registerGlobally:n,propagator:r,defaultInstrumentationConfig:i})=>{var a;if(!t.isNetworkSpanForwardingEnabled())return!1;let o=[];return n||o.push("Network span forwarding cannot be used when `registerGlobally` is set to false. Turning off network span forwarding."),r&&o.push("Network span forwarding cannot be used alongside a custom `propagator`. Turning off network span forwarding."),!(i==null||(a=i.omit)==null)&&a.has(`@opentelemetry/instrumentation-xml-http-request`)&&i.omit.has(`@opentelemetry/instrumentation-fetch`)&&o.push(`Network span forwarding cannot be used when both '@opentelemetry/instrumentation-xml-http-request' and '@opentelemetry/instrumentation-fetch' are omitted. Turning off network span forwarding.`),o.forEach(t=>{e.warn(t)}),o.length===0};var ra=class{constructor(e=window.performance){j(this,`_clock`,void 0),j(this,`epochMillisFromOriginOffset`,e=>this._clock.timeOrigin+e),j(this,`getNowHRTime`,()=>mn(this.getNowMillis())),j(this,`getNowMillis`,()=>this.epochMillisFromOriginOffset(this._clock.now())),j(this,`millisSinceHRTime`,e=>this.getNowMillis()-hn(e)),this._clock=e}};let ia=(e,t=1e3)=>{let n=!1;return(...r)=>{n||(e(...r),setTimeout(()=>{n=!1},t),n=!0)}};var aa=class{logException(e,t){}message(e,t,n){}};let oa=new aa;var sa=class{constructor(){j(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?oa:e}setDelegate(e){this._delegate=e}logException(e,t){this.getDelegate().logException(e,t)}message(e,t,n){this.getDelegate().message(e,t,n)}};let ca=new aa,la=new Set([`setDelegate`,`getDelegate`]);var ua=class e{static getInstance(){if(!e._instance){let t=new sa,n=Et(t,ca,E.createComponentLogger({namespace:`LogAPI`}),la);e._instance=Object.assign(n,{setGlobalLogManager(e){t.setDelegate(e)},getLogManager(){return t}})}return e._instance}static resetInstance(){e._instance=void 0}};j(ua,`_instance`,void 0);let da=ua.getInstance();var fa=class{setCurrentRoute(e){}getCurrentRoute(){return null}getCurrentPageId(){return``}setPageLabel(e){}getPageLabel(){return null}clearCurrentRoute(){}};let pa=new fa;var ma=class{constructor(){j(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?pa:e}setDelegate(e){this._delegate=e}setCurrentRoute(e){this.getDelegate().setCurrentRoute(e)}getCurrentRoute(){return this.getDelegate().getCurrentRoute()}getCurrentPageId(){return this.getDelegate().getCurrentPageId()}setPageLabel(e){this.getDelegate().setPageLabel(e)}getPageLabel(){return this.getDelegate().getPageLabel()}clearCurrentRoute(){this.getDelegate().clearCurrentRoute()}};let ha=new fa,ga=new Set([`setDelegate`,`getDelegate`]);var _a=class e{static getInstance(){if(!e._instance){let t=new ma,n=Et(t,ha,E.createComponentLogger({namespace:`PageAPI`}),ga);e._instance=Object.assign(n,{setGlobalPageManager(e){t.setDelegate(e)},getPageManager(){return t}})}return e._instance}static resetInstance(){e._instance=void 0}};j(_a,`_instance`,void 0);let U=_a.getInstance();var va=class{constructor(){j(this,`getSessionId`,()=>null),j(this,`getPreviousSessionId`,()=>null)}addBreadcrumb(e){}addProperty(e,t,n){}removeProperty(e){}endSessionSpan(){}endSessionSpanInternal(e){}currentSessionAsReadableSpan(e){return null}getSessionSpan(){return null}getSessionStartTime(){return null}startSessionSpan(){}addSessionStartedListener(e){return()=>{}}addSessionEndedListener(e){return()=>{}}};let ya=new va;var ba=class{constructor(){j(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?ya:e}setDelegate(e){this._delegate=e}addBreadcrumb(e){this.getDelegate().addBreadcrumb(e)}addProperty(e,t,n){this.getDelegate().addProperty(e,t,n)}removeProperty(e){this.getDelegate().removeProperty(e)}endSessionSpan(){this.getDelegate().endSessionSpan()}endSessionSpanInternal(e){this.getDelegate().endSessionSpanInternal(e)}currentSessionAsReadableSpan(e){return this.getDelegate().currentSessionAsReadableSpan(e)}getSessionId(){return this.getDelegate().getSessionId()}getPreviousSessionId(){return this.getDelegate().getPreviousSessionId()}getSessionSpan(){return this.getDelegate().getSessionSpan()}getSessionStartTime(){return this.getDelegate().getSessionStartTime()}startSessionSpan(e){this.getDelegate().startSessionSpan(e)}addSessionStartedListener(e){return this.getDelegate().addSessionStartedListener(e)}addSessionEndedListener(e){return this.getDelegate().addSessionEndedListener(e)}};let xa=new va,Sa=new Set([`setDelegate`,`getDelegate`]);var Ca=class e{static getInstance(){if(!e._instance){let t=new ba,n=Et(t,xa,E.createComponentLogger({namespace:`SessionAPI`}),Sa);e._instance=Object.assign(n,{setGlobalSessionManager(e){t.setDelegate(e)},getSpanSessionManager(){return t}})}return e._instance}static resetInstance(){e._instance=void 0}};j(Ca,`_instance`,void 0);let wa=Ca.getInstance();var Ta=class{constructor(e=Ve){j(this,`_spanContext`,void 0),j(this,`attributes`,{}),this._spanContext=e}fail(e){}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}removeAttribute(e){return this}addEvent(e,t,n){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}},Ea=class{startSpan(e,t){return new Ta}setSpan(e,t){return b}getSpan(e){}};let Da=new Ea;var Oa=class{constructor(){j(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?Da:e}setDelegate(e){this._delegate=e}startSpan(e,t,n){return this.getDelegate().startSpan(e,t,n)}setSpan(e,t){return this.getDelegate().setSpan(e,t)}getSpan(e){return this.getDelegate().getSpan(e)}};let ka=new Ea,Aa=new Set([`setDelegate`,`getDelegate`]);var ja=class e{static getInstance(){if(!e._instance){let t=new Oa,n=Et(t,ka,E.createComponentLogger({namespace:`TraceAPI`}),Aa);e._instance=Object.assign(n,{setGlobalTraceManager(e){t.setDelegate(e)},getTraceManager(){return t}})}return e._instance}static resetInstance(){e._instance=void 0}};j(ja,`_instance`,void 0);let Ma=ja.getInstance(),Na=`enduser.pseudo.id`;var Pa=class{getMXLUserId(){return``}getUserId(){return null}setUserId(){}clearUserId(){}};let Fa=new Pa;var Ia=class{constructor(){j(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?Fa:e}setDelegate(e){this._delegate=e}getMXLUserId(){return this.getDelegate().getMXLUserId()}getUserId(){return this.getDelegate().getUserId()}setUserId(e){this.getDelegate().setUserId(e)}clearUserId(){this.getDelegate().clearUserId()}};let La=new Pa,Ra=new Set([`setDelegate`,`getDelegate`]);var za=class e{static getInstance(){if(!e._instance){let t=new Ia,n=Et(t,La,E.createComponentLogger({namespace:`UserAPI`}),Ra);e._instance=Object.assign(n,{setGlobalUserManager(e){t.setDelegate(e)},getUserManager(){return t}})}return e._instance}static resetInstance(){e._instance=void 0}};j(za,`_instance`,void 0);let Ba=za.getInstance();var W;(function(e){e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.TRACE=1]=`TRACE`,e[e.TRACE2=2]=`TRACE2`,e[e.TRACE3=3]=`TRACE3`,e[e.TRACE4=4]=`TRACE4`,e[e.DEBUG=5]=`DEBUG`,e[e.DEBUG2=6]=`DEBUG2`,e[e.DEBUG3=7]=`DEBUG3`,e[e.DEBUG4=8]=`DEBUG4`,e[e.INFO=9]=`INFO`,e[e.INFO2=10]=`INFO2`,e[e.INFO3=11]=`INFO3`,e[e.INFO4=12]=`INFO4`,e[e.WARN=13]=`WARN`,e[e.WARN2=14]=`WARN2`,e[e.WARN3=15]=`WARN3`,e[e.WARN4=16]=`WARN4`,e[e.ERROR=17]=`ERROR`,e[e.ERROR2=18]=`ERROR2`,e[e.ERROR3=19]=`ERROR3`,e[e.ERROR4=20]=`ERROR4`,e[e.FATAL=21]=`FATAL`,e[e.FATAL2=22]=`FATAL2`,e[e.FATAL3=23]=`FATAL3`,e[e.FATAL4=24]=`FATAL4`})(W||(W={}));var Va=class{emit(e){}};let Ha=new Va,Ua=Symbol.for(`io.opentelemetry.js.api.logs`),Wa=globalThis;function Ga(e,t,n){return r=>r===e?t:n}let Ka=new class{getLogger(e,t,n){return new Va}};var qa=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Ha}},Ja=class{getLogger(e,t,n){var r;return(r=this._getDelegateLogger(e,t,n))==null?new qa(this,e,t,n):r}_getDelegate(){var e;return(e=this._delegate)==null?Ka:e}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){var r;return(r=this._delegate)==null?void 0:r.getLogger(e,t,n)}};let Ya=class e{constructor(){this._proxyLoggerProvider=new Ja}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(e){return Wa[Ua]?this.getLoggerProvider():(Wa[Ua]=Ga(1,e,Ka),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,t;return(t=(e=Wa[Ua])==null?void 0:e.call(Wa,1))==null?this._proxyLoggerProvider:t}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){delete Wa[Ua],this._proxyLoggerProvider=new Ja}}.getInstance();function Xa(e,t,n,r){for(let i=0,a=e.length;i<a;i++){let a=e[i];t&&a.setTracerProvider(t),n&&a.setMeterProvider(n),r&&a.setLoggerProvider&&a.setLoggerProvider(r),a.getConfig().enabled||a.enable()}}function Za(e){e.forEach(e=>e.disable())}function Qa(e){var t,n;let r=e.tracerProvider||O.getTracerProvider(),i=e.meterProvider||mt.getMeterProvider(),a=e.loggerProvider||Ya.getLoggerProvider(),o=(t=(n=e.instrumentations)==null?void 0:n.flat())==null?[]:t;return Xa(o,r,i,a),()=>{Za(o)}}function $a(e,t,n){let r,i;try{i=e()}catch(e){r=e}finally{if(t(r,i),r&&!n)throw r;return i}}function eo(e){return typeof e==`function`&&typeof e.__original==`function`&&typeof e.__unwrap==`function`&&e.__wrapped===!0}let to=`http.request.body.size`,no=`http.response.body.size`,ro=`session.id`,io=`user.id`;var ao=class{constructor(e,t,n){this.instrumentationName=e,this.instrumentationVersion=t,j(this,`_config`,{}),j(this,`_diag`,void 0),j(this,`_tracer`,void 0),j(this,`_meter`,void 0),j(this,`_logger`,void 0),this.setConfig(n),this._diag=E.createComponentLogger({namespace:e}),this._tracer=O.getTracer(e,t),this._meter=mt.getMeter(e,t),this._logger=Ya.getLogger(e,t),this._updateMetricInstruments()}get tracer(){return this._tracer}get meter(){return this._meter}get logger(){return this._logger}getModuleDefinitions(){var e;let t=(e=this.init())==null?[]:e;return Array.isArray(t)?t:[t]}getConfig(){return this._config}setConfig(e){this._config=L({enabled:!0},e)}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}_updateMetricInstruments(){}_runSpanCustomizationHook(e,t,n,r){if(e)try{e(n,r)}catch(e){this._diag.error(`Error running span customization hook due to exception in handler`,{triggerName:t},e)}}},G=class extends ao{constructor({instrumentationName:e,instrumentationVersion:t,config:n,diag:r,perf:i}){super(e,t,n),j(this,`_sessionManager`,void 0),j(this,`_logManager`,void 0),j(this,`_perf`,void 0),r&&(this._diag=r),this._perf=i==null?new ra:i,this._sessionManager=wa.getSpanSessionManager(),this._logManager=da.getLogManager()}get sessionManager(){return this._sessionManager}get logManager(){return this._logManager}get perf(){return this._perf}init(){}setLogManager(e){this._logManager=e}setSessionManager(e){this._sessionManager=e}};let oo=function(e){return e.DOCUMENT_LOAD=`documentLoad`,e.DOCUMENT_FETCH=`documentFetch`,e.RESOURCE_FETCH=`resourceFetch`,e}({}),so=function(e){return e.FIRST_PAINT=`firstPaint`,e.FIRST_CONTENTFUL_PAINT=`firstContentfulPaint`,e}({}),co=()=>{let e={},t=window.performance.getEntriesByType(`navigation`)[0];return Object.values(B).forEach(n=>{if(Gi(t,n)){let r=t[n];typeof r==`number`&&(e[n]=r)}}),e},lo={"first-paint":so.FIRST_PAINT,"first-contentful-paint":so.FIRST_CONTENTFUL_PAINT},uo=e=>{window.performance.getEntriesByType(`paint`).forEach(({name:t,startTime:n})=>{Gi(lo,t)&&e.addEvent(lo[t],n)})};var fo=class extends G{constructor({diag:e,perf:t,enabled:n,applyCustomAttributesOnSpan:r,ignorePerformancePaintEvents:i=!1,ignoreNetworkEvents:a=!1}={}){super({instrumentationName:`DocumentLoadInstrumentation`,instrumentationVersion:`1.0.0`,diag:e,perf:t,config:{enabled:n,applyCustomAttributesOnSpan:r,ignorePerformancePaintEvents:i,ignoreNetworkEvents:a}}),j(this,`_onDocumentLoaded`,void 0),j(this,`_performanceCollected`,!1),this._onDocumentLoaded=()=>{window.setTimeout(()=>{this._collectPerformance()},0)},this._config.enabled&&this.enable()}init(){this._diag.debug(`Initializing document load instrumentation`)}_addResourcesSpans(e){performance.getEntriesByType(`resource`).forEach(t=>{this._initResourceSpan(t,e)})}_collectPerformance(){if(this._performanceCollected)return;this._performanceCollected=!0;let e=Array.from(document.getElementsByTagName(`meta`)).find(e=>e.getAttribute(`name`)===En),t=co(),n=(e==null?void 0:e.content)||``;T.with(D.extract(b,{traceparent:n}),()=>{var e;let n=this._startSpan(oo.DOCUMENT_LOAD,B.FETCH_START,t);n&&(T.with(O.setSpan(T.active(),n),()=>{let e=this._startSpan(oo.DOCUMENT_FETCH,B.FETCH_START,t);e&&(e.setAttribute(N,location.href),T.with(O.setSpan(T.active(),e),()=>{var n;Ki(e,t,this.getConfig().ignoreNetworkEvents),this._addCustomAttributesOnSpan(e,(n=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:n.documentFetch),this._endSpan(e,B.RESPONSE_END,t)}))}),n.setAttribute(k,A.DocumentLoad),n.setAttribute(N,location.href),n.setAttribute(fn,navigator.userAgent),this._addResourcesSpans(n),this.getConfig().ignoreNetworkEvents||(V(n,B.FETCH_START,t),V(n,B.UNLOAD_EVENT_START,t),V(n,B.UNLOAD_EVENT_END,t),V(n,B.DOM_INTERACTIVE,t),V(n,B.DOM_CONTENT_LOADED_EVENT_START,t),V(n,B.DOM_CONTENT_LOADED_EVENT_END,t),V(n,B.DOM_COMPLETE,t),V(n,B.LOAD_EVENT_START,t),V(n,B.LOAD_EVENT_END,t)),this.getConfig().ignorePerformancePaintEvents||uo(n),this._addCustomAttributesOnSpan(n,(e=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:e.documentLoad),this._endSpan(n,B.LOAD_EVENT_END,t))})}_endSpan(e,t,n){e&&(Gi(n,t)&&typeof n[t]==`number`?e.end(n[t]):e.end())}_initResourceSpan(e,t){var n;let r=this._startSpan(oo.RESOURCE_FETCH,B.FETCH_START,e,t);r&&(r.setAttribute(k,A.ResourceFetch),r.setAttribute(N,e.name),Ki(r,e,this.getConfig().ignoreNetworkEvents),e.deliveryType&&r.setAttribute(`http.response.delivery_type`,e.deliveryType),e.initiatorType&&r.setAttribute(`http.request.initiator_type`,e.initiatorType),e.renderBlockingStatus&&r.setAttribute(`http.request.render_blocking_status`,e.renderBlockingStatus),e.responseStatus&&r.setAttribute(rn,e.responseStatus),typeof e.encodedBodySize==`number`&&e.encodedBodySize>=0&&r.setAttribute(no,e.encodedBodySize),typeof e.transferSize==`number`&&e.transferSize>=0&&r.setAttribute(`http.response.size`,e.transferSize),typeof e.decodedBodySize==`number`&&e.decodedBodySize>=0&&r.setAttribute(`http.response.decoded_body_size`,e.decodedBodySize),this._addResourceDiagnosticAttributes(r,e),this._addCustomAttributesOnResourceSpan(r,e,(n=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:n.resourceFetch),this._endSpan(r,B.RESPONSE_END,e))}_startSpan(e,t,n,r){if(Gi(n,t)&&typeof n[t]==`number`)return this.tracer.startSpan(e,{startTime:n[t]},r?O.setSpan(T.active(),r):void 0)}_waitForPageLoad(){window.document.readyState===`complete`?this._onDocumentLoaded():window.addEventListener(`load`,this._onDocumentLoaded)}_addCustomAttributesOnSpan(e,t){t&&$a(()=>{t(e)},e=>{e&&this._diag.error(`addCustomAttributesOnSpan`,e)},!0)}_addCustomAttributesOnResourceSpan(e,t,n){n&&$a(()=>{n(e,t)},e=>{e&&this._diag.error(`addCustomAttributesOnResourceSpan`,e)},!0)}_hasNoSizeData(e){let t=typeof e.transferSize==`number`?e.transferSize:0,n=typeof e.decodedBodySize==`number`?e.decodedBodySize:0,r=typeof e.encodedBodySize==`number`?e.encodedBodySize:0;return t===0&&n===0&&r===0}_hasTimingData(e){let t=typeof e.fetchStart==`number`?e.fetchStart:0,n=typeof e.responseEnd==`number`?e.responseEnd:0;return t>0&&n>0}_isCorsRestricted(e){return this._hasNoSizeData(e)&&this._hasTimingData(e)}_isFetchIncomplete(e){let t=typeof e.fetchStart==`number`?e.fetchStart:0,n=typeof e.responseEnd==`number`?e.responseEnd:0;return this._hasNoSizeData(e)&&t>0&&n===0}_isFetchPrevented(e){let t=typeof e.fetchStart==`number`?e.fetchStart:0;return this._hasNoSizeData(e)&&t===0}_isCacheValidated(e){let t=typeof e.transferSize==`number`?e.transferSize:0,n=typeof e.deliveryType==`string`?e.deliveryType:``;return t===300&&n!==`cache`}_addResourceDiagnosticAttributes(e,t){this._isCorsRestricted(t)?e.setAttribute(`http.response.cors_opaque`,!0):this._isFetchIncomplete(t)?e.setAttribute(`http.request.incomplete`,!0):this._isFetchPrevented(t)&&e.setAttribute(`http.request.prevented`,!0),this._isCacheValidated(t)&&e.setAttribute(`http.response.cache_revalidated`,!0)}enable(){window.removeEventListener(`load`,this._onDocumentLoaded),this._waitForPageLoad()}disable(){window.removeEventListener(`load`,this._onDocumentLoaded)}},po=class extends G{constructor({diag:e,perf:t,rootNode:n,emptyCheckDelayMs:r=500}){super({instrumentationName:`EmptyRootInstrumentation`,instrumentationVersion:`1.0.0`,diag:e,perf:t,config:{}}),j(this,`_observer`,void 0),j(this,`_emptyCheckDelayMs`,void 0),j(this,`_rootNode`,void 0),this._rootNode=n,this._emptyCheckDelayMs=r,this._observer=new MutationObserver((e,t)=>{this._observerCallback(e)}),this._config.enabled&&this._rootNode?this.enable():this._rootNode||this._diag.warn(`supplied root node was null, this instrumentation won't be enabled`)}disable(){this._observer.disconnect()}enable(){this._rootNode&&this._observer.observe(this._rootNode,{childList:!0})}_observerCallback(e){let t=!1,n=!1;for(let r of e)r.target===this._rootNode&&(r.removedNodes.length>0&&(t=!0),r.addedNodes.length>0&&(n=!0));t&&!n&&(this._diag.debug(`root node had child nodes removed without new ones being added, checking if it's empty in ${this._emptyCheckDelayMs}ms`),window.setTimeout(()=>{this._checkForEmptyRootNode()},this._emptyCheckDelayMs))}_checkForEmptyRootNode(){var e;if(((e=this._rootNode)==null?void 0:e.childNodes.length)===0){this._diag.debug(`root node was found to be empty`);let e=this.sessionManager.getSessionSpan();e?e.addEvent(`empty-root-node`,{"mxl.type":`ux.empty_root_node`}):this._diag.debug(`no active session found to emit event on`)}}};let mo=(e,t)=>{let n=e.nodeName.toLowerCase(),r=t.substring(0,30),i=t.length>30?`...`:``;return`<${n}${e.className?` class="${e.className}"`:``}>${r}${i}</${n}>`};var ho=class extends G{constructor({diag:e,perf:t,shouldTrack:n,innerTextForElement:r}={}){super({instrumentationName:`ClicksInstrumentation`,instrumentationVersion:`1.0.0`,diag:e,perf:t,config:{}}),j(this,`_onClickHandler`,void 0),this._onClickHandler=e=>{let t=e.target;if(t instanceof HTMLElement&&!t.hasAttribute(`disabled`)&&!(n&&!n(t)))try{let n=this.sessionManager.getSessionSpan();n&&n.addEvent(`click`,{"mxl.type":`ux.tap`,"view.name":mo(t,r?r(t):t.innerText),"tap.coords":`${e.x.toString()},${e.y.toString()}`},this.perf.epochMillisFromOriginOffset(e.timeStamp))}catch(e){this._diag.error(`failed to create new user interaction span event`,e)}},this._config.enabled&&this.enable()}disable(){document.removeEventListener(`click`,this._onClickHandler)}enable(){document.addEventListener(`click`,this._onClickHandler)}},go=class extends G{constructor({diag:e,perf:t}={}){super({instrumentationName:`GlobalExceptionInstrumentation`,instrumentationVersion:`1.0.0`,diag:e,perf:t,config:{}}),j(this,`_onErrorHandler`,void 0),j(this,`_onUnhandledRejectionHandler`,void 0),this._onErrorHandler=e=>{this.logManager.logException(e.error||e.message,{handled:!1,timestamp:this.perf.epochMillisFromOriginOffset(e.timeStamp),handler:`global_exception`})},this._onUnhandledRejectionHandler=e=>{this.logManager.logException(e.reason,{handled:!1,timestamp:this.perf.epochMillisFromOriginOffset(e.timeStamp),handler:`promise_rejection`})},this._config.enabled&&this.enable()}disable(){window.removeEventListener(`error`,this._onErrorHandler),window.removeEventListener(`unhandledrejection`,this._onUnhandledRejectionHandler)}enable(){window.addEventListener(`error`,this._onErrorHandler),window.addEventListener(`unhandledrejection`,this._onUnhandledRejectionHandler)}};let K=console.error.bind(console);function _o(e,t,n){let r=!!e[t]&&Object.prototype.propertyIsEnumerable.call(e,t);Object.defineProperty(e,t,{configurable:!0,enumerable:r,writable:!0,value:n})}let vo=(e,t,n)=>{if(!e||!e[t]){K(`no original function `+String(t)+` to wrap`);return}if(!n){K(`no wrapper function`),K(Error().stack);return}let r=e[t];if(typeof r!=`function`||typeof n!=`function`){K(`original object and wrapper must be functions`);return}let i=n(r,t);return _o(i,`__original`,r),_o(i,`__unwrap`,()=>{e[t]===i&&_o(e,t,r)}),_o(i,`__wrapped`,!0),_o(e,t,i),i},yo=(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{K(`must provide one or more modules to patch`),K(Error().stack);return}if(!(t&&Array.isArray(t))){K(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{vo(e,t,n)})})},bo=(e,t)=>{if(!e||!e[t]){K(`no function to unwrap.`),K(Error().stack);return}let n=e[t];if(!n.__unwrap)K(`no original to unwrap to -- has `+String(t)+` already been unwrapped?`);else{n.__unwrap();return}},xo=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{K(`must provide one or more modules to patch`),K(Error().stack);return}if(!(t&&Array.isArray(t))){K(`must provide one or more functions to unwrap on modules`);return}e.forEach(e=>{t.forEach(t=>{bo(e,t)})})};function So(e){e&&e.logger&&(typeof e.logger==`function`?K=e.logger:K(`new logger isn't a function, not replacing`))}So.wrap=vo,So.massWrap=yo,So.unwrap=bo,So.massUnwrap=xo;var Co=class{constructor(e,t,n){j(this,`_config`,{}),j(this,`_tracer`,void 0),j(this,`_meter`,void 0),j(this,`_logger`,void 0),j(this,`_diag`,void 0),j(this,`instrumentationName`,void 0),j(this,`instrumentationVersion`,void 0),j(this,`_wrap`,vo),j(this,`_unwrap`,bo),j(this,`_massWrap`,yo),j(this,`_massUnwrap`,xo),this.instrumentationName=e,this.instrumentationVersion=t,this.setConfig(n),this._diag=E.createComponentLogger({namespace:e}),this._tracer=O.getTracer(e,t),this._meter=mt.getMeter(e,t),this._logger=Ya.getLogger(e,t),this._updateMetricInstruments()}get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){var e;let t=(e=this.init())==null?[]:e;return Array.isArray(t)?t:[t]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config=L({enabled:!0},e)}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,t,n,r){if(e)try{e(n,r)}catch(e){this._diag.error(`Error running span customization hook due to exception in handler`,{triggerName:t},e)}}},wo=class extends Co{constructor(e,t,n){super(e,t,n),this._config.enabled&&this.enable()}};function To(e,t,n){let r,i;try{i=e()}catch(e){r=e}finally{if(t(r,i),r&&!n)throw r;return i}}function Eo(e){return typeof e==`function`&&typeof e.__original==`function`&&typeof e.__unwrap==`function`&&e.__wrapped===!0}var q;(function(e){e[e.STABLE=1]=`STABLE`,e[e.OLD=2]=`OLD`,e[e.DUPLICATE=3]=`DUPLICATE`})(q||(q={}));function Do(e,t){let n=q.OLD,r=t==null?void 0:t.split(`,`).map(e=>e.trim()).filter(e=>e!==``);for(let t of r==null?[]:r)if(t.toLowerCase()===e+`/dup`){n=q.DUPLICATE;break}else t.toLowerCase()===e&&(n=q.STABLE);return n}let Oo=performance,ko=Math.pow(10,6),Ao=Math.pow(10,9);function jo(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*ko)]}function Mo(e){return No(jo(Oo.timeOrigin),jo(typeof e==`number`?e:Oo.now()))}function No(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=Ao&&(n[1]-=Ao,n[0]+=1),n}function Po(e,t){return typeof t==`string`?e===t:!!e.match(t)}function Fo(e,t){if(!t)return!1;for(let n of t)if(Po(e,n))return!0;return!1}var Io;(function(e){e.COMPONENT=`component`,e.HTTP_STATUS_TEXT=`http.status_text`})(Io||(Io={}));let Lo=E.createComponentLogger({namespace:`@opentelemetry/opentelemetry-instrumentation-fetch/utils`});function Ro(...e){if(e[0]instanceof URL||typeof e[0]==`string`){let t=e[1];if(!(t!=null&&t.body))return Promise.resolve();if(t.body instanceof ReadableStream){let{body:e,length:n}=zo(t.body);return t.body=e,n}else return Promise.resolve(Vo(t.body))}else{let t=e[0];return t!=null&&t.body?t.clone().text().then(e=>Uo(e)):Promise.resolve()}}function zo(e){if(!e.pipeThrough)return Lo.warn(`Platform has ReadableStream but not pipeThrough!`),{body:e,length:Promise.resolve(void 0)};let t=0,n,r=new Promise(e=>{n=e}),i=new TransformStream({start(){},transform(e,n){return P(function*(){let r=yield e;t+=r.byteLength,n.enqueue(e)})()},flush(){n(t)}});return{body:e.pipeThrough(i),length:r}}function Bo(e){return typeof Document<`u`&&e instanceof Document}function Vo(e){if(Bo(e))return new XMLSerializer().serializeToString(document).length;if(typeof e==`string`)return Uo(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return Wo(e);if(e instanceof URLSearchParams)return Uo(e.toString());if(e.byteLength!==void 0)return e.byteLength;Lo.warn(`unknown body type`)}let Ho=new TextEncoder;function Uo(e){return Ho.encode(e).byteLength}function Wo(e){let t=0;for(let[n,r]of e.entries())t+=n.length,r instanceof Blob?t+=r.size:t+=r.length;return t}function Go(e){let t=Jo(),n=e.toUpperCase();return n in t?n:`_OTHER`}let Ko={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},qo;function Jo(){return qo===void 0&&(qo=Ko),qo}let Yo={"https:":`443`,"http:":`80`};function Xo(e){let t=Number(e.port||Yo[e.protocol]);if(t&&!isNaN(t))return t}let Zo=`0.213.0`,Qo=typeof PerformanceObserver<`u`;var $o=class extends wo{constructor(e={}){super(`@opentelemetry/instrumentation-fetch`,Zo,e),j(this,`component`,`fetch`),j(this,`version`,Zo),j(this,`moduleName`,this.component),j(this,`_usedResources`,new WeakSet),j(this,`_tasksCount`,0),j(this,`_semconvStability`,void 0),this._semconvStability=Do(`http`,e==null?void 0:e.semconvStabilityOptIn)}init(){}_addChildSpan(e,t){let n=this.tracer.startSpan(`CORS Preflight`,{startTime:t[B.FETCH_START]},O.setSpan(T.active(),e)),r=!(this._semconvStability&q.OLD);Ki(n,t,this.getConfig().ignoreNetworkEvents,void 0,r),n.end(t[B.RESPONSE_END])}_addFinalSpanAttributes(e,t){let n=H(t.url);if(this._semconvStability&q.OLD&&(e.setAttribute(`http.status_code`,t.status),t.statusText!=null&&e.setAttribute(Io.HTTP_STATUS_TEXT,t.statusText),e.setAttribute(`http.host`,n.host),e.setAttribute(`http.scheme`,n.protocol.replace(`:`,``)),typeof navigator<`u`&&e.setAttribute(`http.user_agent`,navigator.userAgent)),this._semconvStability&q.STABLE){e.setAttribute(rn,t.status),e.setAttribute(an,n.hostname);let r=Xo(n);r&&e.setAttribute(on,r)}}_addHeaders(e,t){if(!Qi(t,this.getConfig().propagateTraceHeaderCorsUrls)){let e={};D.inject(T.active(),e),Object.keys(e).length>0&&this._diag.debug(`headers inject skipped due to CORS policy`);return}if(e instanceof Request)D.inject(T.active(),e.headers,{set:(e,t,n)=>e.set(t,typeof n==`string`?n:String(n))});else{let t=new Headers(e.headers);D.inject(T.active(),t,{set:(e,t,n)=>e.set(t,typeof n==`string`?n:String(n))}),e.headers=t}}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(performance.clearResourceTimings(),this._usedResources=new WeakSet)}_createSpan(e,t={}){if(Fo(e,this.getConfig().ignoreUrls)){this._diag.debug(`ignoring span as url matches ignored url`);return}let n=``,r={};if(this._semconvStability&q.OLD){let i=(t.method||`GET`).toUpperCase();n=`HTTP ${i}`,r[Io.COMPONENT]=this.moduleName,r[`http.method`]=i,r[`http.url`]=e}if(this._semconvStability&q.STABLE){let i=t.method,a=Go(t.method||`GET`);n||(n=a),r[tn]=a,a!==i&&(r[nn]=i),r[N]=e}return this.tracer.startSpan(n,{kind:ut.CLIENT,attributes:r})}_findResourceAndAddNetworkEvents(e,t,n){let r=t.entries;if(!r.length){if(!performance.getEntriesByType)return;r=performance.getEntriesByType(`resource`)}let i=Yi(t.spanUrl,t.startTime,n,r,this._usedResources,`fetch`);if(i.mainRequest){let t=i.mainRequest;this._markResourceAsUsed(t);let n=i.corsPreFlightRequest;n&&(this._addChildSpan(e,n),this._markResourceAsUsed(n));let r=!(this._semconvStability&q.OLD);Ki(e,t,this.getConfig().ignoreNetworkEvents,void 0,r)}}_markResourceAsUsed(e){this._usedResources.add(e)}_endSpan(e,t,n){let r=jo(Date.now()),i=Mo();this._addFinalSpanAttributes(e,n),this._semconvStability&q.STABLE&&n.status>=400&&(e.setStatus({code:dt.ERROR}),e.setAttribute(Qt,String(n.status))),setTimeout(()=>{var n;(n=t.observer)==null||n.disconnect(),this._findResourceAndAddNetworkEvents(e,t,i),this._tasksCount--,this._clearResources(),e.end(r)},300)}_patchConstructor(){return e=>{let t=this,n=new Set([`url`,`type`,`redirected`]);function r(e,t){return new Proxy(e,{get(e,i,a){if(typeof i==`string`&&n.has(i))return Reflect.get(t,i);if(i===`clone`)return function(){return r(e.clone(),t)};let o=Reflect.get(e,i,e);return typeof o==`function`?o.bind(e):o}})}return function(...n){let i=this,a=H(n[0]instanceof Request?n[0].url:String(n[0])).href,o=n[0]instanceof Request?n[0]:n[1]||{},s=t._createSpan(a,o);if(!s)return e.apply(this,n);let c=t._prepareSpanData(a);t.getConfig().measureRequestSize&&Ro(...n).then(e=>{e&&(t._semconvStability&q.OLD&&s.setAttribute(`http.request_content_length_uncompressed`,e),t._semconvStability&q.STABLE&&s.setAttribute(`http.request.body.size`,e))}).catch(e=>{t._diag.warn(`getFetchBodyLength`,e)});function l(e,n){t._applyAttributesAfterFetch(e,o,n),t._endSpan(e,c,{status:n.status||0,statusText:n.message,url:a})}function u(e,n){t._applyAttributesAfterFetch(e,o,n),n.status>=200&&n.status<400?t._endSpan(e,c,n):t._endSpan(e,c,{status:n.status,statusText:n.statusText,url:a})}function d(e,t){if(!e)return null;let n=e.getReader();return new ReadableStream({pull(e){return P(function*(){try{let{value:t,done:r}=yield n.read();r?(n.releaseLock(),e.close()):e.enqueue(t)}catch(t){e.error(t),n.cancel(t).catch(e=>{});try{n.releaseLock()}catch(e){}}})()},cancel(e){return t.cancel(e).catch(e=>{}),n.cancel(e)}})}function f(e,t,n){let i=null;try{let t=n.clone().body;if(t){let a=t.getReader(),o=n.status===204||n.status===205||n.status===304?null:d(n.body,a);i=r(new Response(o,{status:n.status,statusText:n.statusText,headers:n.headers}),n);let s=()=>{a.read().then(({done:t})=>{t?u(e,n):s()},t=>{l(e,t)})};s()}else u(e,n)}finally{var a;t((a=i)==null?n:a)}}function p(e,t,n){try{l(e,n)}finally{t(n)}}return new Promise((n,r)=>T.with(O.setSpan(T.active(),s),()=>(t._callRequestHook(s,o),t._addHeaders(o,a),t._tasksCount++,e.apply(i,o instanceof Request?[o]:[a,o]).then(f.bind(i,s,n),p.bind(i,s,r)))))}}}_applyAttributesAfterFetch(e,t,n){let r=this.getConfig().applyCustomAttributesOnSpan;r&&To(()=>r(e,t,n),e=>{e&&this._diag.error(`applyCustomAttributesOnSpan`,e)},!0)}_callRequestHook(e,t){let n=this.getConfig().requestHook;n&&To(()=>n(e,t),e=>{e&&this._diag.error(`requestHook`,e)},!0)}_prepareSpanData(e){let t=Mo(),n=[];if(typeof PerformanceObserver!=`function`)return{entries:n,startTime:t,spanUrl:e};let r=new PerformanceObserver(t=>{t.getEntries().forEach(t=>{t.initiatorType===`fetch`&&t.name===e&&n.push(t)})});return r.observe({entryTypes:[`resource`]}),{entries:n,observer:r,startTime:t,spanUrl:e}}enable(){if(!Qo){this._diag.warn(`this instrumentation is intended for web usage only, it does not instrument server-side fetch()`);return}Eo(fetch)&&(this._unwrap(globalThis,`fetch`),this._diag.debug(`removing previous patch for constructor`)),this._wrap(globalThis,`fetch`,this._patchConstructor())}disable(){Qo&&(this._unwrap(globalThis,`fetch`),this._usedResources=new WeakSet)}};function es(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function ts(e,t){if(e==null)return{};var n,r,i=es(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}let ns=[`omitIfAlreadyPatched`];var rs=class extends $o{constructor(e={}){let{omitIfAlreadyPatched:t}=e,n=ts(e,ns);super(L(L({},n),{},{enabled:!1})),j(this,`_omitIfAlreadyPatched`,void 0),this._omitIfAlreadyPatched=t,n.enabled&&this.enable()}enable(){if(this._omitIfAlreadyPatched&&eo(fetch)){this._diag.debug("fetch is already passed and `omitIfAlreadyPatched` is true, skipping enabling this instrumentation");return}super.enable()}};let is=/\([^()]+\)/g;var as=class extends G{constructor({diag:e,shouldCleanupPathOptionsFromRouteName:t=!0}){super({instrumentationName:`NavigationInstrumentation`,instrumentationVersion:`1.0.0`,diag:e,config:{}}),j(this,`_shouldCleanupPathOptionsFromRouteName`,!0),j(this,`_currentRouteSpan`,null),j(this,`_instrumentationType`,Rt.Manual),j(this,`_removeSessionStartedFn`,null),j(this,`_removeSessionEndedFn`,null),j(this,`setInstrumentationType`,e=>{this._instrumentationType=e}),j(this,`setCurrentRoute`,e=>{if(!this._config.enabled)return;let t=U.getCurrentRoute();e.url!==(t==null?void 0:t.url)&&(U.setCurrentRoute(e),this._endRouteSpan(t),this._startRouteSpan(e))}),j(this,`_setupSessionListeners`,()=>{this._removeSessionStartedFn||(this._removeSessionStartedFn=this.sessionManager.addSessionStartedListener(()=>{let e=U.getCurrentRoute();e&&!this._currentRouteSpan&&(this._diag.debug(`Session started, starting route span.`),this._startRouteSpan(e))})),this._removeSessionEndedFn||(this._removeSessionEndedFn=this.sessionManager.addSessionEndedListener(()=>{this._currentRouteSpan&&(this._diag.debug(`Session ended, ending route span.`),this._endRouteSpan(U.getCurrentRoute()))}))}),j(this,`_cleanUpSessionListeners`,()=>{this._removeSessionStartedFn&&(this._removeSessionStartedFn(),this._removeSessionStartedFn=null),this._removeSessionEndedFn&&(this._removeSessionEndedFn(),this._removeSessionEndedFn=null)}),j(this,`_startRouteSpan`,e=>{this._diag.debug(`Starting route span for url: ${e.url}`),this._setupSessionListeners();let t=this._shouldCleanupPathOptionsFromRouteName?e.path.replace(is,``):e.path;return this._currentRouteSpan=this.tracer.startSpan(t,{attributes:{[k]:A.Surface,[Pt]:t,[Ft]:U.getCurrentPageId()||void 0}}),this._currentRouteSpan.setAttribute(`mxl.instrumentation`,this._instrumentationType),this._currentRouteSpan}),j(this,`_endRouteSpan`,e=>{this._currentRouteSpan&&(e&&this._diag.debug(`Ending route span for url: ${e.url}`),this._currentRouteSpan.end(),this._currentRouteSpan=null)}),j(this,`enable`,()=>{this.setConfig({enabled:!0}),this._diag.debug(`NavigationInstrumentation enabled, listening for navigation events.`)}),j(this,`disable`,()=>{this._cleanUpSessionListeners(),this.setConfig({enabled:!1}),this._diag.debug(`NavigationInstrumentation disabled, stopped listening for navigation events.`)}),this._shouldCleanupPathOptionsFromRouteName=t,this._config.enabled&&this.enable()}};let os,ss=(e={})=>(os||(os=new as(e)),os),cs={samplingPct:100,networkSpansForwardingThreshold:0},ls=`mxl_remote_config`,us=(e,{osVersion:t,appVersion:n,deviceId:r},i)=>`${i||`https://mxl-basket.apps.ocpthikadev01.safaricom.net`}/config?appId=${e}&osVersion=${t}&appVersion=${n}&deviceId=${r}`,ds=e=>{let t={samplingPct:e.threshold};return e.network_span_forwarding!==void 0&&(t.networkSpansForwardingThreshold=e.network_span_forwarding.pct_enabled),e.empty_session_avoidance_enabled_pct!==void 0&&(t.emptySessionAvoidanceEnabledPct=e.empty_session_avoidance_enabled_pct),t};var fs=class{constructor({appID:e,appVersion:t,deviceId:n,diag:r=E.createComponentLogger({namespace:`mxl-config-manager`}),storage:i=window.localStorage,defaultConfig:a={},mxlConfigURL:o}={}){j(this,`_remoteConfigURL`,null),j(this,`_diag`,void 0),j(this,`_storage`,void 0),j(this,`_sdkConfig`,void 0),j(this,`_etag`,null),e&&t&&n&&(this._remoteConfigURL=us(e,{appVersion:t,deviceId:n,osVersion:`1`},o)),this._diag=r,this._storage=i;let s=this._getRemoteConfigFromStorage();s&&(this._etag=s.etag),this._sdkConfig=L(L(L({},cs),a),s?ds(s.config):{})}setConfig(e){this._sdkConfig=L(L({},this._sdkConfig),e)}getConfig(){return this._sdkConfig}refreshRemoteConfig(){var e=this;return P(function*(){if(e._remoteConfigURL)try{let t=yield e._fetchRemoteConfig(e._remoteConfigURL);if(!t){e._diag.debug(`No changes in remote config, skipping update`);return}let[n,r]=t;e._storage.setItem(ls,JSON.stringify({config:n,etag:r})),e._sdkConfig=ds(n),e._etag=r}catch(t){e._diag.warn(`Failed to refresh remote config: ${t instanceof Error?t.message:String(t)}`)}})()}_getRemoteConfigFromStorage(){try{let e=this._storage.getItem(ls);return e?JSON.parse(e):null}catch(e){return this._diag.warn(`Failed to parse remote config from storage: ${e instanceof Error?e.message:String(e)}`),null}}_fetchRemoteConfig(e){var t=this;return P(function*(){let n=yield fetch(e,{headers:t._etag?{"If-None-Match":t._etag}:{}}),r=n.headers.get(`etag`);return n.status===304?null:n.ok?[yield n.json(),r]:(t._diag.warn(`Failed to fetch remote config from ${e}: ${n.statusText}`),null)})()}};let ps={maxAllowed:{error_log:500,warning_log:200,info_log:100,exception:500,breadcrumb:100,session_property:100,span:1e3,network_request:1e4},maxLength:{error_log:128,warning_log:128,info_log:128,exception:1024,breadcrumb:256,session_property_key:128,session_property_value:256,log_attribute_key:128,log_attribute_value:256,exception_attribute_key:128,exception_attribute_value:256},maxAttributes:{error_log:50,warning_log:50,info_log:50,exception:50}},ms={info:`info_log`,warning:`warning_log`,error:`error_log`};var hs=class{constructor({diag:e,maxAllowed:t,maxLength:n,maxAttributes:r}){j(this,`_diag`,void 0),j(this,`_diagnosticCounts`,{}),j(this,`_currentCount`,{exception:0,error_log:0,warning_log:0,info_log:0,breadcrumb:0,session_property:0,span:0,network_request:0}),j(this,`_maxAllowed`,void 0),j(this,`_maxLength`,void 0),j(this,`_maxAttributes`,void 0),this._diag=e==null?E.createComponentLogger({namespace:`MXLLimitManager`}):e,this._maxAllowed=t,this._maxLength=n,this._maxAttributes=r}_dropIfMaxReached(e){return this._currentCount[e]>=this._maxAllowed[e]?(this._diag.warn(`disallowing ${e} because the maximum number of ${this._maxAllowed[e].toString()} has already been reached for this session`),this._incrDiagnosticCount(e,`drop`),!0):(this._currentCount[e]=(this._currentCount[e]||0)+1,!1)}truncateString(e,t){return t.length>this._maxLength[e]?(this._diag.warn(`truncating ${e} because it is longer than ${this._maxLength[e].toString()} characters: "${t}"`),this._incrDiagnosticCount(e,`truncate_string`),t.substring(0,this._maxLength[e])):t}_truncateAttributes(e,t,n,r){let i=Object.keys(t);i.length>this._maxAttributes[e]&&(this._diag.warn(`truncating ${e} attributes because there are more than ${this._maxAttributes[e].toString()} set`),this._incrDiagnosticCount(e,`truncate_attributes`));let a={};for(let s=0;s<Math.min(i.length,this._maxAttributes[e]);s++){var o;let e=this.truncateString(n,i[s]);a[e]=this.truncateString(r,((o=t[i[s]])==null?void 0:o.toString())||``)}return a}limitBreadcrumb(e){return this._dropIfMaxReached(`breadcrumb`)?`dropped`:{name:this.truncateString(`breadcrumb`,e)}}limitException(e,t){return this._dropIfMaxReached(`exception`)?`dropped`:{message:this.truncateString(`exception`,e),attributes:this._truncateAttributes(`exception`,t,`exception_attribute_key`,`exception_attribute_value`)}}limitLog(e,t,n){let r=ms[t];return this._dropIfMaxReached(r)?`dropped`:{message:this.truncateString(r,e),attributes:this._truncateAttributes(r,n,`log_attribute_key`,`log_attribute_value`)}}limitSessionProperty(e,t){return this._dropIfMaxReached(`session_property`)?`dropped`:{key:this.truncateString(`session_property_key`,e),value:this.truncateString(`session_property_value`,t)}}dropReadableSpan(e){let t=e.attributes[k]===A.Network?`network_request`:`span`;return this._dropIfMaxReached(t)}reset(){this._diagnosticCounts={},this._currentCount={exception:0,error_log:0,warning_log:0,info_log:0,breadcrumb:0,session_property:0,span:0,network_request:0}}_incrDiagnosticCount(e,t){let n=`mxl.app.applied_limit.${e}.${t}.count`;this._diagnosticCounts[n]=(this._diagnosticCounts[n]||0)+1}getDiagnosticCounts(){return this._diagnosticCounts}};let gs=()=>JSON.stringify(Bt._MXLFileBundleIDs||{});var _s=class e{constructor({diag:e,perf:t,spanSessionManager:n,limitManager:r,loggerProvider:i,visibilityDoc:a=window.document,storage:o=window.localStorage}){j(this,`_diag`,void 0),j(this,`_perf`,void 0),j(this,`_logger`,void 0),j(this,`_spanSessionManager`,void 0),j(this,`_limitManager`,void 0),j(this,`_visibilityDoc`,void 0),j(this,`_storage`,void 0);let s=i==null?Ya:i;this._diag=e==null?E.createComponentLogger({namespace:`MXLLogManager`}):e,this._perf=t==null?new ra:t,this._logger=s.getLogger(`mxl-web-sdk-logs`),this._spanSessionManager=n,this._limitManager=r,this._visibilityDoc=a,this._storage=o}_validateAttributes(e){return Object.prototype.toString.call(e)===`[object Object]`?e:(this._diag.warn(`attributes must be a plain object`,e),{})}static _logSeverityToSeverityNumber(e){switch(e){case`info`:return W.INFO;case`warning`:return W.WARN;default:return W.ERROR}}logException(t,{handled:n=!0,attributes:r={},timestamp:i=this._perf.getNowMillis(),handler:a=`manual`}={}){var o;let s=this._validateAttributes(r);n||this._spanSessionManager.incrSessionCountForKey(`mxl.unhandled_exceptions_count`);let c=(t==null||(o=t.constructor)==null?void 0:o.name)||typeof t,l=``,u=c,d=``,f=``;if(t instanceof Error)l=String(t.message||``).trim(),u=t.name||``,d=t.stack||``,f=t.cause?`present`:``;else if(t&&typeof t==`object`)try{l=JSON.stringify(t)}catch(e){l=String(t).trim()}else l=String(t).trim();let p=this._limitManager.limitException(l,s);p!==`dropped`&&this._logger.emit({timestamp:i,severityNumber:W.ERROR,severityText:`ERROR`,body:p.message,attributes:L(L({},p.attributes),{},{[k]:A.SystemException,"mxl.exception_handling":e._exceptionHandlingType(n,a),"mxl.exception_cause":f,[M]:c,"exception.name":u,[$t]:p.message,[en]:d,[Nt]:gs(),[jt]:zt(this._visibilityDoc),"mxl.exception_number":At(this._storage,`mxl_exception_number`,this._diag)})})}message(e,t,{attributes:n={},includeStacktrace:r=!0,stacktrace:i}={}){if(typeof e!=`string`||!e.trim()){this._diag.warn(`Message must be a non-empty string`);return}if(![`info`,`warning`,`error`].includes(t)){this._diag.warn(`Severity must be info, warning, or error`);return}let a=this._validateAttributes(n);t===`error`&&this._spanSessionManager.incrSessionCountForKey(`mxl.error_log_count`);let o=``;t!==`info`&&(typeof i==`string`?o=i:r&&(o=Error().stack||``)),this._logMessage({message:e.trim(),severity:t,timestamp:this._perf.getNowMillis(),attributes:a,stack:o})}_logMessage({message:t,severity:n,timestamp:r,attributes:i={},stack:a}){let o=this._limitManager.limitLog(t,n,i);o!==`dropped`&&this._logger.emit({timestamp:r,severityNumber:e._logSeverityToSeverityNumber(n),severityText:n.toUpperCase(),body:o.message,attributes:L(L(L({},o.attributes),{},{[k]:A.SystemLog},a?{"mxl.stacktrace.js":a,[Nt]:gs()}:{}),{},{[jt]:zt(this._visibilityDoc)})})}static _exceptionHandlingType(e,t){return e?`handled`:t===`global_exception`?`unhandled_error`:t===`promise_rejection`?`unhandled_rejection`:`unhandled`}},vs=class{constructor({useDocumentTitleAsPageLabel:e=!0,titleDocument:t=window.document}={}){j(this,`_currentRoute`,null),j(this,`_currentPageId`,null),j(this,`_pageLabel`,null),j(this,`_titleDocument`,void 0),j(this,`_useDocumentTitleAsPageLabel`,void 0),j(this,`getCurrentPageId`,()=>this._currentPageId),j(this,`getCurrentRoute`,()=>this._currentRoute),j(this,`setPageLabel`,e=>{this._pageLabel=e}),j(this,`getPageLabel`,()=>this._pageLabel||(!this._useDocumentTitleAsPageLabel||!this._titleDocument?null:this._titleDocument.title)),j(this,`setCurrentRoute`,e=>{(!this._currentRoute||this._currentRoute.url!==e.url)&&(this._currentPageId=kt()),this._currentRoute=e,e.label?this._pageLabel=e.label:this._pageLabel=null}),j(this,`clearCurrentRoute`,()=>{this._currentRoute=null,this._currentPageId=null,this._pageLabel=null}),this._useDocumentTitleAsPageLabel=e,this._titleDocument=t}},ys=class{constructor({dynamicConfigManager:e,deviceId:t,blockNetworkSpanForwarding:n}){j(this,`_dynamicConfigManager`,void 0),j(this,`_deviceId`,void 0),j(this,`_blockNetworkSpanForwarding`,void 0),this._dynamicConfigManager=e,this._deviceId=t,this._blockNetworkSpanForwarding=n}isSDKEnabled(){let e=this._dynamicConfigManager.getConfig();return Vt(this._deviceId,e.samplingPct)}isNetworkSpanForwardingEnabled(){if(this._blockNetworkSpanForwarding)return!1;let e=this._dynamicConfigManager.getConfig();return Vt(this._deviceId,e.networkSpansForwardingThreshold)}isEmptySessionAvoidanceEnabled(){let e=this._dynamicConfigManager.getConfig();return Vt(this._deviceId,e.emptySessionAvoidanceEnabledPct)}};let bs=`0.0.7`,xs=`mxl-web-sdk`,Ss=`mxl_app_instance_id`,Cs=(e,t)=>{let n=null;try{n=e.getItem(Ss)}catch(e){t.warn(`Failed to retrieve app instance ID from session storage`,e)}if(!n){t.debug(`No existing app instance ID found in session storage, creating a new one`),n=kt();try{e.setItem(Ss,n)}catch(e){t.warn(`Failed to persist app instance ID to session storage`,e)}}return n},ws=({diagLogger:e,appVersion:t,pageSessionStorage:n})=>Rn({[sn]:xs,[un]:xs,app_version:t,app_framework:1,sdk_version:bs,[dn]:bs,sdk_simple_version:1,sdk_platform:`web`,[cn]:`webjs`,"mxl.app_instance_id":Cs(n,e),[fn]:window.navigator.userAgent,screen_resolution:`${window.screen.width}x${window.screen.height}`});var Ts=class{constructor(e){j(this,`_span`,void 0),this._span=e}get attributes(){return this._span.attributes}addEvent(e,t,n){return this._span.addEvent(e,t,n),this}addLink(e){return this._span.addLink(e),this}addLinks(e){return this._span.addLinks(e),this}end(e){this._span.end(e)}isRecording(){return this._span.isRecording()}recordException(e,t){this._span.recordException(e,t)}setAttribute(e,t){return this._span.setAttribute(e,t),this}setAttributes(e){return this._span.setAttributes(e),this}removeAttribute(e){let t=this._span.attributes,{[e]:n}=t,r=ts(t,[e].map(Jt));return this._span.attributes=r,this}setStatus(e){return this._span.setStatus(e),this}spanContext(){return this._span.spanContext()}updateName(e){return this._span.updateName(e),this}fail(e={code:`failure`}){e.code&&this._span.setAttribute(`mxl.error_code`,e.code.toUpperCase()),this._span.end(e.endTime)}};let Es=`mxl_tab`,Ds=`mxl_tab_activity`;var Os=class{constructor({diag:e,perf:t,visibilityDoc:n=window.document,storage:r=window.localStorage,sessionStorage:i=window.sessionStorage,limitManager:a,referrer:o=document.referrer}){j(this,`_previousSessionId`,null),j(this,`_activeSessionId`,null),j(this,`_activeSessionStartTime`,null),j(this,`_sessionSpan`,null),j(this,`_activeSessionCounts`,null),j(this,`_nextSessionCounts`,{}),j(this,`_coldStart`,!0),j(this,`_sdkStartupDuration`,0),j(this,`_sessionStartedListeners`,[]),j(this,`_sessionEndedListeners`,[]),j(this,`_tab`,void 0),j(this,`_navigationSource`,void 0),j(this,`_referrerInfo`,void 0),j(this,`_tracer`,void 0),j(this,`_noExportTracer`,void 0),j(this,`_diag`,void 0),j(this,`_perf`,void 0),j(this,`_visibilityDoc`,void 0),j(this,`_storage`,void 0),j(this,`_sessionStorage`,void 0),j(this,`_limitManager`,void 0),j(this,`_referrer`,void 0),this._diag=e==null?E.createComponentLogger({namespace:`MXLSpanSessionManager`}):e,this._perf=t==null?new ra:t,this._visibilityDoc=n,this._storage=r,this._sessionStorage=i,this._limitManager=a,this._referrer=o,this._tracer=O.getTracer(`mxl-web-sdk-sessions`),this._noExportTracer=new Ri().getTracer(`mxl-web-sdk-sessions`),this._referrerInfo=this._processReferrer();let s=this._initTab();this._tab=s.tab,this._navigationSource=s.navigationSource,this._setupNewTabClickListeners()}_getPermanentAttributes(){let e=new Map;try{for(let t=0;t<this._storage.length;t++){let n=this._storage.key(t);if(n!=null&&n.startsWith(Mt)){let t=this._storage.getItem(n);t&&e.set(n,t)}}}catch(e){this._diag.warn(`Error loading permanent session properties`,e)}return Object.fromEntries(e.entries())}addBreadcrumb(e){if(!this._sessionSpan){this._diag.debug(`trying to add breadcrumb to a session, but there is no session in progress. This is a no-op.`);return}let t=this._limitManager.limitBreadcrumb(e);t!==`dropped`&&this._sessionSpan.addEvent(`mxl-breadcrumb`,{message:t.name},this._perf.getNowMillis())}addProperty(e,t,n){if(!this._sessionSpan){this._diag.debug(`trying to add properties to a session, but there is no session in progress. This is a no-op.`);return}let r=this._limitManager.limitSessionProperty(e,t);if(r===`dropped`)return;let i=Mt+r.key;if(this._sessionSpan.setAttribute(i,r.value),(n==null?void 0:n.lifespan)===`permanent`)try{this._storage.setItem(i,t)}catch(e){this._diag.warn(`Failed to set permanent session property`,e)}}removeProperty(e){if(!this._sessionSpan){this._diag.debug(`trying to remove a session property, but there is no session in progress. This is a no-op.`);return}let t=Mt+this._limitManager.truncateString(`session_property_key`,e);this._sessionSpan.removeAttribute(t);try{this._storage.getItem(t)&&this._storage.removeItem(t)}catch(e){this._diag.warn(`Error removing permanent session property`,e)}}endSessionSpan(){this.endSessionSpanInternal(`manual`)}endSessionSpanInternal(e){if(!this._sessionSpan){this._diag.debug(`trying to end a session, but there is no session in progress. This is a no-op.`);return}for(let e of this._sessionEndedListeners)try{e()}catch(e){this._diag.warn(`Error while executing session ended listener`,e)}this._sessionSpan.setAttributes(this._endSessionSpanAttributes(e)),this._sessionSpan.end(),this._sessionSpan=null,this._activeSessionStartTime=null,this._previousSessionId=this._activeSessionId,this._activeSessionId=null,this._activeSessionCounts=null,this._limitManager.reset()}_endSessionSpanAttributes(e){return L(L(L(L({},this._getPermanentAttributes()),{},{"mxl.session_end_type":e},this._activeSessionCounts),this._limitManager.getDiagnosticCounts()),{},{"mxl.sdk_startup_duration":this._sdkStartupDuration})}currentSessionAsReadableSpan(e){if(!this._sessionSpan||!this._activeSessionStartTime)return this._diag.debug(`trying to end a session, but there is no session in progress. This is a no-op.`),null;let t=this._noExportTracer.startSpan(`mxl-session`,{startTime:this._activeSessionStartTime,attributes:L(L(L({},this._sessionSpan.attributes),this._endSessionSpanAttributes(e)),{},{"mxl.from_storage":!0})});return t.end(),t}getSessionId(){return this._activeSessionId}getPreviousSessionId(){return this._previousSessionId}getSessionSpan(){return this._sessionSpan}getSessionStartTime(){return this._activeSessionStartTime}startSessionSpan(e){this._sessionSpan&&this.endSessionSpanInternal(`manual`),this._activeSessionId=kt(),this._activeSessionStartTime=this._perf.getNowHRTime(),this._activeSessionCounts={};let t=this._nextSessionCounts;this._nextSessionCounts={};let n=L(L({},this._getPermanentAttributes()),{},{[k]:A.Session,[jt]:zt(this._visibilityDoc),[ro]:this._activeSessionId,"mxl.cold_start":this._coldStart,"mxl.session_number":At(this._storage,`mxl_session_number`,this._diag),"mxl.experience_id":this._tab.experienceId,"mxl.tab_id":this._tab.tabId,"mxl.navigation_source":this._navigationSource},t);this._referrerInfo.isValid&&this._referrerInfo.scrubbedUrl&&(n[`mxl.referrer_url`]=this._referrerInfo.scrubbedUrl),this._tab.sourceTabId&&(n[`mxl.source_tab_id`]=this._tab.sourceTabId),e!=null&&e.reason&&(n[`mxl.session_start_type`]=e.reason),this._sessionSpan=new Ts(this._tracer.startSpan(`mxl-session`,{attributes:n})),this._coldStart=!1;for(let e of this._sessionStartedListeners)try{e()}catch(e){this._diag.warn(`Error while executing session started listener`,e)}}incrSessionCountForKey(e){if(!this._sessionSpan||!this._activeSessionCounts){this._diag.debug(`trying to increment a count for the active session, but there is no session in progress. This is a no-op.`);return}this._activeSessionCounts[e]=(this._activeSessionCounts[e]||0)+1}incrNextSessionCountForKey(e){this._nextSessionCounts[e]=(this._nextSessionCounts[e]||0)+1}addSessionStartedListener(e){let t=this._sessionStartedListeners.push(e);return()=>{this._sessionStartedListeners.splice(t-1,1)}}addSessionEndedListener(e){let t=this._sessionEndedListeners.push(e);return()=>{this._sessionEndedListeners.splice(t-1,1)}}recordSDKStartupDuration(e){this._sdkStartupDuration=Math.ceil(e)}setTracerProvider(e){this._tracer=e.getTracer(`mxl-web-sdk-sessions`)}_determineNavigationSource(){try{let e=window.performance.getEntriesByType(`navigation`);if(e.length>0&&e[0]){let t=e[0];if(t.type===`reload`)return`reload`;if(t.type===`back_forward`)return`back_forward`}}catch(e){this._diag.warn(`Failed to get navigation type`,e)}return this._referrerInfo.isValid?this._referrerInfo.isSameOrigin?`same_origin`:`external`:`direct`}_processReferrer(){if(!this._referrer)return{isValid:!1,isSameOrigin:!1};try{let e=new URL(this._referrer),t=window.location.origin;return{isValid:!0,isSameOrigin:e.origin===t,scrubbedUrl:e.origin+e.pathname}}catch(e){return{isValid:!1,isSameOrigin:!1}}}_getTabContext(e){let t=Cs(this._sessionStorage,this._diag),n,r;if(e===`same_origin`){let e=this._getTabActivity();e&&Date.now()-e.lastActivityMs<=1e4&&(n=e.tabId,r=e.experienceId)}return r!=null||(r=kt()),{sourceTabId:n,experienceId:r,tabId:t}}_initTab(){let e=this._determineNavigationSource();try{let t=this._sessionStorage.getItem(Es);if(t)return{tab:JSON.parse(t),navigationSource:e}}catch(e){this._diag.warn(`Failed to retrieve tab data`,e)}let t=this._getTabContext(e),n={experienceId:t.experienceId,sourceTabId:t.sourceTabId,tabId:t.tabId};try{this._sessionStorage.setItem(Es,JSON.stringify(n))}catch(e){this._diag.warn(`Failed to store tab data`,e)}return{tab:n,navigationSource:e}}_getTabActivity(){try{let e=this._storage.getItem(Ds);return e?JSON.parse(e):null}catch(e){return this._diag.warn(`Failed to retrieve tab activity`,e),null}}_storeTabActivity(e){try{this._storage.setItem(Ds,JSON.stringify(e))}catch(e){this._diag.warn(`Failed to save tab activity`,e)}}_storeCurrentTabAsSource(){let e={tabId:this._tab.tabId,experienceId:this._tab.experienceId,lastActivityMs:Date.now()};this._storeTabActivity(e)}_setupNewTabClickListeners(){let e=e=>{var t;if(e.button===1||e.ctrlKey||e.metaKey||e.shiftKey){this._storeCurrentTabAsSource();return}(t=e.target)!=null&&t.closest(`a[target="_blank"], form[target="_blank"], a[rel*="noopener"], a[rel*="noreferrer"]`)&&this._storeCurrentTabAsSource()},t={capture:!0,passive:!0};document.addEventListener(`auxclick`,e,t),document.addEventListener(`click`,e,t)}},ks=class{constructor({tracerProvider:e}={}){j(this,`_tracer`,void 0),j(this,`setSpan`,O.setSpan),this._tracer=(e==null?O:e).getTracer(`mxl-web-sdk-traces`)}startSpan(e,t={},n){t.attributes=t.attributes?t.attributes:{},t.attributes[k]=A.Perf;let r=t.parentSpan?O.setSpan(T.active(),t.parentSpan):n;return new Ts(this._tracer.startSpan(e,t,r))}getSpan(e){let t=O.getSpan(e);if(t)return new Ts(t)}};let As=`mxl_user`,js=`mxl_user_id`,Ms=`mxl_external_user_id`,Ns=e=>typeof e[Na]==`string`&&e[Na].length===32,Ps=e=>typeof e==`string`&&e.length===32;var Fs=class{constructor({diag:e,storage:t=window.localStorage}={}){j(this,`_diag`,void 0),j(this,`_storage`,void 0),j(this,`_mxlUserId`,null),this._diag=e==null?E.createComponentLogger({namespace:`MXLUserManager`}):e,this._storage=t,this._migrateOldLocalStorageKey(),this._initialSetup()}getMXLUserId(){return this._mxlUserId||this._generateNewMXLUserId()}setMXLUserId(e){this._mxlUserId=e;try{this._storage.setItem(js,e)}catch(e){this._diag.warn(`Failed to persist user object for storage, keeping it in-memory only`,e)}}clearMXLUserId(){this._mxlUserId=null;try{this._storage.removeItem(js)}catch(e){this._diag.warn(`Failed to remove mxl user in storage`,e)}}_migrateOldLocalStorageKey(){try{let e=this._storage.getItem(As);if(e){let t=JSON.parse(e);Ns(t)?(this._diag.debug(`Migrating old user data from storage`),this._storage.setItem(js,t[Na]),this._storage.removeItem(As)):(this._diag.warn(`Invalid user data found in storage, clearing old user data`),this._storage.removeItem(As))}}catch(e){this._diag.warn(`Failed to get old user data from storage`,e)}}_initialSetup(){try{let e=this._storage.getItem(js);e?Ps(e)?this._mxlUserId=e:(this._diag.warn(`Invalid mxl user id, generating a new one`),this.clearMXLUserId()):this._diag.debug(`No existing user found in storage, creating a new one`)}catch(e){this._diag.warn(`Failed to get mxl user id from storage, defaulting to a new one`,e)}this._mxlUserId||(this._mxlUserId=this._generateNewMXLUserId())}_generateNewMXLUserId(){let e=kt();return this.setMXLUserId(e),e}getUserId(){try{return this._storage.getItem(Ms)}catch(e){return this._diag.warn(`Failed to retrieve user id from storage`,e),null}}setUserId(e){try{this._storage.setItem(Ms,e)}catch(e){this._diag.warn(`Failed to store user id`,e)}}clearUserId(){try{this._storage.removeItem(Ms)}catch(e){this._diag.warn(`Failed to clear user id`,e)}}};let Is=[`keydown`,`mousedown`,`mousemove`,`scroll`];var Ls=class extends G{constructor({diag:e}={}){super({instrumentationName:`SpanSessionBrowserActivityInstrumentation`,instrumentationVersion:`1.0.0`,diag:e,config:{}}),j(this,`_onActivityThrottled`,void 0),j(this,`_activityTimeout`,void 0),j(this,`disable`,()=>{Tt({target:window,events:Is,callback:this._onActivityThrottled}),this._activityTimeout&&clearTimeout(this._activityTimeout),this._activityTimeout=null}),j(this,`enable`,()=>{wt({target:window,events:Is,callback:this._onActivityThrottled})}),j(this,`_onInactivity`,()=>{this._diag.debug(`Inactivity detected`),this._activityTimeout&&clearTimeout(this._activityTimeout),this._activityTimeout=null,this.sessionManager.endSessionSpanInternal(`inactivity`)}),j(this,`_onActivity`,()=>{this._diag.debug(`Activity detected`),this._activityTimeout&&clearTimeout(this._activityTimeout),this.sessionManager.getSessionId()||this.sessionManager.startSessionSpan({reason:`activity`}),this._activityTimeout=setTimeout(this._onInactivity,18e5)}),this._activityTimeout=null,this._onActivityThrottled=ia(this._onActivity,3e4),this._config.enabled&&this.enable()}},Rs=class extends G{constructor({diag:e}={}){super({instrumentationName:`SpanSessionOnLoadInstrumentation`,instrumentationVersion:`1.0.0`,diag:e,config:{}}),this._config.enabled&&this.enable()}disable(){this.sessionManager.endSessionSpanInternal(`unknown`)}enable(){this.sessionManager.startSessionSpan({reason:`init`})}};let zs=14400*1e3;var Bs=class extends G{constructor({diag:e,perf:t}={}){super({instrumentationName:`SpanSessionTimeoutInstrumentation`,instrumentationVersion:`1.0.0`,diag:e,perf:t,config:{}}),j(this,`_sessionTimeout`,void 0),j(this,`disable`,()=>{this._sessionTimeout&&clearTimeout(this._sessionTimeout),this._sessionTimeout=null}),j(this,`enable`,()=>{this._checkTimeout()}),j(this,`_onTimeout`,()=>{this._diag.debug(`Timeout detected`),this._sessionTimeout&&clearTimeout(this._sessionTimeout),this.sessionManager.endSessionSpanInternal(`timer`),this.sessionManager.startSessionSpan({reason:`timer`}),this._sessionTimeout=setTimeout(this._checkTimeout,zs)}),j(this,`_checkTimeout`,()=>{let e=this.sessionManager.getSessionStartTime();if(e){let t=zs-this.perf.millisSinceHRTime(e);if(t<=0){this._onTimeout();return}this._sessionTimeout&&clearTimeout(this._sessionTimeout),this._sessionTimeout=setTimeout(this._checkTimeout,t);return}this._sessionTimeout&&clearTimeout(this._sessionTimeout),this._sessionTimeout=setTimeout(this._checkTimeout,zs)}),this._sessionTimeout=null,this._config.enabled&&this.enable()}};let Vs=[`mousedown`];var Hs=class extends G{constructor({diag:e,perf:t,visibilityWaitTimeMs:n=0,limitedSessionMaxDurationMs:r=5e3,backgroundSessions:i=!1,maxPendingSpanCount:a=5,visibilityDoc:o=window.document}={},s,c){super({instrumentationName:`SpanSessionVisibilityInstrumentation`,instrumentationVersion:`1.0.0`,diag:e,perf:t,config:{}}),j(this,`_currentVisibilityState`,void 0),j(this,`_checkVisibilityTimeout`,void 0),j(this,`_interactionSinceLastVisibilityChange`,void 0),j(this,`_avoidEndingLimitedSessions`,void 0),j(this,`_mxlSpanProcessor`,void 0),j(this,`_checkVisibilityChange`,void 0),j(this,`_onVisibilityChange`,void 0),j(this,`_onInteractionThrottled`,void 0),this._currentVisibilityState=o.visibilityState,this._checkVisibilityTimeout=null,this._interactionSinceLastVisibilityChange=!1,this._avoidEndingLimitedSessions=r>0&&s.isEmptySessionAvoidanceEnabled(),this._mxlSpanProcessor=c,this._checkVisibilityChange=()=>{if(n<=0){this._currentVisibilityState=o.visibilityState,this._onVisibilityChange();return}if(this._checkVisibilityTimeout&&clearTimeout(this._checkVisibilityTimeout),o.visibilityState===`visible`&&this._currentVisibilityState!==o.visibilityState){this._currentVisibilityState=o.visibilityState,this._onVisibilityChange();return}this._diag.debug(`Visibility changed to ${o.visibilityState}. Will wait ${(n/1e3).toString()}s, and check if visibility changed`),this._checkVisibilityTimeout=setTimeout(()=>{this._currentVisibilityState===o.visibilityState?this._diag.debug(`Visibility was not changed after timeout happened: ${o.visibilityState}`):(this._currentVisibilityState=o.visibilityState,this._onVisibilityChange())},n)},this._onVisibilityChange=()=>{this._diag.debug(`Visibility change detected: ${o.visibilityState}`);let e=this.sessionManager.getSessionStartTime();if(this._avoidEndingLimitedSessions&&e!==null&&this.perf.millisSinceHRTime(e)<r&&!this._interactionSinceLastVisibilityChange&&this._mxlSpanProcessor&&this._mxlSpanProcessor.getPendingSpansCount()<a){this._diag.debug(`Not ending the session since it is considered limited`),this.sessionManager.addBreadcrumb(`Tab visibility changed to ${o.visibilityState}`);let e=this.sessionManager.getSessionId();if(e){let t=this.sessionManager.currentSessionAsReadableSpan(`state_changed`);t&&this._mxlSpanProcessor.storePendingSpans(e,t)}}else{let e=this.sessionManager.getSessionId();this._mxlSpanProcessor&&e&&this._mxlSpanProcessor.clearStoredSpans(e),this.sessionManager.endSessionSpanInternal(`state_changed`),o.visibilityState===`hidden`&&i?(this._diag.debug("Starting a session since document visibility switched to hidden and `backgroundSessions` is enabled"),this.sessionManager.startSessionSpan({reason:`hidden`})):o.visibilityState===`visible`&&(this._diag.debug(`Starting a session since document visibility switched to visible`),this.sessionManager.startSessionSpan({reason:`visible`}))}this._interactionSinceLastVisibilityChange=!1},this._onInteractionThrottled=ia(()=>{this._interactionSinceLastVisibilityChange=!0},1e3),this._config.enabled&&this.enable()}disable(){window.removeEventListener(`visibilitychange`,this._checkVisibilityChange),this._avoidEndingLimitedSessions&&Tt({target:window,events:Vs,callback:this._onInteractionThrottled})}enable(){window.addEventListener(`visibilitychange`,this._checkVisibilityChange),this._avoidEndingLimitedSessions&&wt({target:window,events:Vs,callback:this._onInteractionThrottled})}},Us=class{constructor(){j(this,`t`,void 0),j(this,`o`,0),j(this,`i`,[])}u(e){var t;if(e.hadRecentInput)return;let n=this.i[0],r=this.i.at(-1);this.o&&n&&r&&e.startTime-r.startTime<1e3&&e.startTime-n.startTime<5e3?(this.o+=e.value,this.i.push(e)):(this.o=e.value,this.i=[e]),(t=this.t)==null||t.call(this,e)}};let Ws=()=>{let e=performance.getEntriesByType(`navigation`)[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Gs=e=>{if(document.readyState===`loading`)return`loading`;{let t=Ws();if(t){if(e<t.domInteractive)return`loading`;if(t.domContentLoadedEventStart===0||e<t.domContentLoadedEventStart)return`dom-interactive`;if(t.domComplete===0||e<t.domComplete)return`dom-content-loaded`}}return`complete`},Ks=e=>{let t=e.nodeName;return e.nodeType===1?t.toLowerCase():t.toUpperCase().replace(/^#/,``)},qs=e=>{let t=``;try{for(;(e==null?void 0:e.nodeType)!==9;){let n=e,r=n.id?`#`+n.id:[Ks(n),...Array.from(n.classList).sort()].join(`.`);if(t.length+r.length>99)return t||r;if(t=t?r+`>`+t:r,n.id)break;e=n.parentNode}}catch(e){}return t},Js=new WeakMap;function Ys(e,t){return Js.get(e)||Js.set(e,new t),Js.get(e)}let Xs=-1,Zs=()=>Xs,Qs=e=>{addEventListener(`pageshow`,(t=>{t.persisted&&(Xs=t.timeStamp,e(t))}),!0)},J=(e,t,n,r)=>{let i,a;return o=>{var s;t.value>=0&&(o||r)&&(a=t.value-((s=i)==null?0:s),(a||i===void 0)&&(i=t.value,t.delta=a,t.rating=((e,t)=>e>t[1]?`poor`:e>t[0]?`needs-improvement`:`good`)(t.value,n),e(t)))}},$s=e=>{requestAnimationFrame((()=>requestAnimationFrame((()=>e()))))},ec=()=>{var e;let t=Ws();return(e=t==null?void 0:t.activationStart)==null?0:e},Y=(e,t=-1)=>{let n=Ws(),r=`navigate`;return Zs()>=0?r=`back-forward-cache`:n&&(document.prerendering||ec()>0?r=`prerender`:document.wasDiscarded?r=`restore`:n.type&&(r=n.type.replace(/_/g,`-`))),{name:e,value:t,rating:`good`,delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+0xe8d4a51000}`,navigationType:r}},tc=(e,t,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){let r=new PerformanceObserver((e=>{Promise.resolve().then((()=>{t(e.getEntries())}))}));return r.observe(L({type:e,buffered:!0},n)),r}}catch(e){}},nc=e=>{let t=!1;return()=>{t||(e(),t=!0)}},rc=-1,ic=new Set,ac=()=>document.visibilityState!==`hidden`||document.prerendering?1/0:0,oc=e=>{if(document.visibilityState===`hidden`){if(e.type===`visibilitychange`)for(let e of ic)e();isFinite(rc)||(rc=e.type===`visibilitychange`?e.timeStamp:0,removeEventListener(`prerenderingchange`,oc,!0))}},sc=()=>{if(rc<0){var e;let t=ec(),n=document.prerendering||(e=globalThis.performance.getEntriesByType(`visibility-state`).filter((e=>e.name===`hidden`&&e.startTime>t))[0])==null?void 0:e.startTime;rc=n==null?ac():n,addEventListener(`visibilitychange`,oc,!0),addEventListener(`prerenderingchange`,oc,!0),Qs((()=>{setTimeout((()=>{rc=ac()}))}))}return{get firstHiddenTime(){return rc},onHidden(e){ic.add(e)}}},cc=e=>{document.prerendering?addEventListener(`prerenderingchange`,(()=>e()),!0):e()},lc=[1800,3e3],uc=(e,t={})=>{cc((()=>{let n=sc(),r,i=Y(`FCP`),a=tc(`paint`,(e=>{for(let t of e)t.name===`first-contentful-paint`&&(a.disconnect(),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-ec(),0),i.entries.push(t),r(!0)))}));a&&(r=J(e,i,lc,t.reportAllChanges),Qs((n=>{i=Y(`FCP`),r=J(e,i,lc,t.reportAllChanges),$s((()=>{i.value=performance.now()-n.timeStamp,r(!0)}))})))}))},dc=[.1,.25],fc=e=>e.find((e=>{var t;return((t=e.node)==null?void 0:t.nodeType)===1}))||e[0],pc=(e,t={})=>{let n=Ys(t=Object.assign({},t),Us),r=new WeakMap;n.t=e=>{var n;if(!(e==null||(n=e.sources)==null)&&n.length){let n=fc(e.sources),o=n==null?void 0:n.node;if(o){var i,a;let e=(i=(a=t.generateTarget)==null?void 0:a.call(t,o))==null?qs(o):i;r.set(n,e)}}},((e,t={})=>{let n=sc();uc(nc((()=>{let r,i=Y(`CLS`,0),a=Ys(t,Us),o=e=>{for(let t of e)a.u(t);a.o>i.value&&(i.value=a.o,i.entries=a.i,r())},s=tc(`layout-shift`,o);s&&(r=J(e,i,dc,t.reportAllChanges),n.onHidden((()=>{o(s.takeRecords()),r(!0)})),Qs((()=>{a.o=0,i=Y(`CLS`,0),r=J(e,i,dc,t.reportAllChanges),$s((()=>r()))})),setTimeout(r))})))})((t=>{e((e=>{let t={};if(e.entries.length){var n;let i=e.entries.reduce(((e,t)=>e.value>t.value?e:t));if(!(i==null||(n=i.sources)==null)&&n.length){let e=fc(i.sources);e&&(t={largestShiftTarget:r.get(e),largestShiftTime:i.startTime,largestShiftValue:i.value,largestShiftSource:e,largestShiftEntry:i,loadState:Gs(i.startTime)})}}return Object.assign(e,{attribution:t})})(t))}),t)},mc=(e,t={})=>{uc((t=>{e((e=>{let t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:Gs(Zs())};if(e.entries.length){let n=Ws(),r=e.entries.at(-1);if(n){let i=n.activationStart||0,a=Math.max(0,n.responseStart-i);t={timeToFirstByte:a,firstByteToFCP:e.value-a,loadState:Gs(e.entries[0].startTime),navigationEntry:n,fcpEntry:r}}}return Object.assign(e,{attribution:t})})(t))}),t)},hc=0,gc=1/0,_c=0,vc=e=>{for(let t of e)t.interactionId&&(gc=Math.min(gc,t.interactionId),_c=Math.max(_c,t.interactionId),hc=_c?(_c-gc)/7+1:0)},yc,bc=()=>{var e;return yc?hc:(e=performance.interactionCount)==null?0:e},xc=()=>{`interactionCount`in performance||yc||(yc=tc(`event`,vc,{type:`event`,buffered:!0,durationThreshold:0}))},Sc=0;var Cc=class{constructor(){j(this,`l`,[]),j(this,`h`,new Map),j(this,`m`,void 0),j(this,`p`,void 0)}v(){Sc=bc(),this.l.length=0,this.h.clear()}M(){let e=Math.min(this.l.length-1,Math.floor((bc()-Sc)/50));return this.l[e]}u(e){var t;if((t=this.m)==null||t.call(this,e),!e.interactionId&&e.entryType!==`first-input`)return;let n=this.l.at(-1),r=this.h.get(e.interactionId);if(r||this.l.length<10||e.duration>n.T){var i;if(r?e.duration>r.T?(r.entries=[e],r.T=e.duration):e.duration===r.T&&e.startTime===r.entries[0].startTime&&r.entries.push(e):(r={id:e.interactionId,entries:[e],T:e.duration},this.h.set(r.id,r),this.l.push(r)),this.l.sort(((e,t)=>t.T-e.T)),this.l.length>10){let e=this.l.splice(10);for(let t of e)this.h.delete(t.id)}(i=this.p)==null||i.call(this,r)}}};let wc=e=>{let t=globalThis.requestIdleCallback||setTimeout;document.visibilityState===`hidden`?e():(e=nc(e),addEventListener(`visibilitychange`,e,{once:!0,capture:!0}),t((()=>{e(),removeEventListener(`visibilitychange`,e,{capture:!0})})))},Tc=[200,500],Ec=(e,t={})=>{let n=Ys(t=Object.assign({},t),Cc),r=[],i=[],a=0,o=new WeakMap,s=new WeakMap,c=!1,l=()=>{c||(wc(u),c=!0)},u=()=>{let e=n.l.map((e=>o.get(e.entries[0]))),t=i.length-50;i=i.filter(((n,r)=>r>=t||e.includes(n)));let s=new Set;for(let e of i){let t=d(e.startTime,e.processingEnd);for(let e of t)s.add(e)}let l=r.length-1-50;r=r.filter(((e,t)=>e.startTime>a&&t>l||s.has(e))),c=!1};n.m=e=>{let t=e.startTime+e.duration,n;a=Math.max(a,e.processingEnd);for(let r=i.length-1;r>=0;r--){let a=i[r];if(Math.abs(t-a.renderTime)<=8){n=a,n.startTime=Math.min(e.startTime,n.startTime),n.processingStart=Math.min(e.processingStart,n.processingStart),n.processingEnd=Math.max(e.processingEnd,n.processingEnd),n.entries.push(e);break}}n||(n={startTime:e.startTime,processingStart:e.processingStart,processingEnd:e.processingEnd,renderTime:t,entries:[e]},i.push(n)),(e.interactionId||e.entryType===`first-input`)&&o.set(e,n),l()},n.p=e=>{if(!s.get(e)){let i=e.entries[0].target;if(i){var n,r;let a=(n=(r=t.generateTarget)==null?void 0:r.call(t,i))==null?qs(i):n;s.set(e,a)}}};let d=(e,t)=>{let n=[];for(let i of r)if(!(i.startTime+i.duration<e)){if(i.startTime>t)break;n.push(i)}return n},f=e=>{let t=e.entries[0],r=o.get(t),i=t.processingStart,a=Math.max(t.startTime+t.duration,i),c=Math.min(r.processingEnd,a),l=r.entries.sort(((e,t)=>e.processingStart-t.processingStart)),u=d(t.startTime,c),f=n.h.get(t.interactionId),p={interactionTarget:s.get(f),interactionType:t.name.startsWith(`key`)?`keyboard`:`pointer`,interactionTime:t.startTime,nextPaintTime:a,processedEventEntries:l,longAnimationFrameEntries:u,inputDelay:i-t.startTime,processingDuration:c-i,presentationDelay:a-c,loadState:Gs(t.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(e=>{var t;if(!((t=e.longAnimationFrameEntries)!=null&&t.length))return;let n=e.interactionTime,r=e.inputDelay,i=e.processingDuration,a,o,s=0,c=0,l=0,u=0;for(let t of e.longAnimationFrameEntries){c=c+t.startTime+t.duration-t.styleAndLayoutStart;for(let e of t.scripts){let t=e.startTime+e.duration;if(t<n)continue;let l=t-Math.max(n,e.startTime),d=e.duration?l/e.duration*e.forcedStyleAndLayoutDuration:0;s+=l-d,c+=d,l>u&&(o=e.startTime<n+r?`input-delay`:e.startTime>=n+r+i?`presentation-delay`:`processing-duration`,a=e,u=l)}}let d=e.longAnimationFrameEntries.at(-1),f=d?d.startTime+d.duration:0;f>=n+r+i&&(l=e.nextPaintTime-f),a&&o&&(e.longestScript={entry:a,subpart:o,intersectingDuration:u}),e.totalScriptDuration=s,e.totalStyleAndLayoutDuration=c,e.totalPaintDuration=l,e.totalUnattributedDuration=e.nextPaintTime-n-s-c-l})(p),Object.assign(e,{attribution:p})};tc(`long-animation-frame`,(e=>{r=r.concat(e),l()})),((e,t={})=>{if(!globalThis.PerformanceEventTiming||!(`interactionId`in PerformanceEventTiming.prototype))return;let n=sc();cc((()=>{var r;xc();let i,a=Y(`INP`),o=Ys(t,Cc),s=e=>{wc((()=>{for(let t of e)o.u(t);let t=o.M();t&&t.T!==a.value&&(a.value=t.T,a.entries=t.entries,i())}))},c=tc(`event`,s,{durationThreshold:(r=t.durationThreshold)==null?40:r});i=J(e,a,Tc,t.reportAllChanges),c&&(c.observe({type:`first-input`,buffered:!0}),n.onHidden((()=>{s(c.takeRecords()),i(!0)})),Qs((()=>{o.v(),a=Y(`INP`),i=J(e,a,Tc,t.reportAllChanges)})))}))})((t=>{e(f(t))}),t)};var Dc=class{constructor(){j(this,`m`,void 0)}u(e){var t;(t=this.m)==null||t.call(this,e)}};let Oc=[2500,4e3],kc=(e,t={})=>{let n=Ys(t=Object.assign({},t),Dc),r=new WeakMap;n.m=e=>{let n=e.element;if(n){var i,a;let o=(i=(a=t.generateTarget)==null?void 0:a.call(t,n))==null?qs(n):i;r.set(e,o)}},((e,t={})=>{cc((()=>{let n=sc(),r,i=Y(`LCP`),a=Ys(t,Dc),o=e=>{t.reportAllChanges||(e=e.slice(-1));for(let t of e)a.u(t),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-ec(),0),i.entries=[t],r())},s=tc(`largest-contentful-paint`,o);if(s){r=J(e,i,Oc,t.reportAllChanges);let n=nc((()=>{o(s.takeRecords()),s.disconnect(),r(!0)})),a=e=>{e.isTrusted&&(wc(n),removeEventListener(e.type,a,{capture:!0}))};for(let e of[`keydown`,`click`,`visibilitychange`])addEventListener(e,a,{capture:!0});Qs((n=>{i=Y(`LCP`),r=J(e,i,Oc,t.reportAllChanges),$s((()=>{i.value=performance.now()-n.timeStamp,r(!0)}))}))}}))})((t=>{e((e=>{let t={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:e.value};if(e.entries.length){let n=Ws();if(n){let i=n.activationStart||0,a=e.entries.at(-1),o=a.url&&performance.getEntriesByType(`resource`).filter((e=>e.name===a.url))[0],s=Math.max(0,n.responseStart-i),c=Math.max(s,o?(o.requestStart||o.startTime)-i:0),l=Math.min(e.value,Math.max(c,o?o.responseEnd-i:0));t={target:r.get(a),timeToFirstByte:s,resourceLoadDelay:c-s,resourceLoadDuration:l-c,elementRenderDelay:e.value-l,navigationEntry:n,lcpEntry:a},a.url&&(t.url=a.url),o&&(t.lcpResourceEntry=o)}}return Object.assign(e,{attribution:t})})(t))}),t)},Ac=[800,1800],jc=e=>{document.prerendering?cc((()=>jc(e))):document.readyState===`complete`?setTimeout(e):addEventListener(`load`,(()=>jc(e)),!0)},Mc=(e,t={})=>{((e,t={})=>{let n=Y(`TTFB`),r=J(e,n,Ac,t.reportAllChanges);jc((()=>{let i=Ws();i&&(n.value=Math.max(i.responseStart-ec(),0),n.entries=[i],r(!0),Qs((()=>{n=Y(`TTFB`,0),r=J(e,n,Ac,t.reportAllChanges),r(!0)})))}))})((t=>{e((e=>{let t={waitingDuration:0,cacheDuration:0,dnsDuration:0,connectionDuration:0,requestDuration:0};if(e.entries.length){let n=e.entries[0],r=n.activationStart||0,i=Math.max((n.workerStart||n.fetchStart)-r,0),a=Math.max(n.domainLookupStart-r,0),o=Math.max(n.connectStart-r,0),s=Math.max(n.connectEnd-r,0);t={waitingDuration:i,cacheDuration:a-i,dnsDuration:o-a,connectionDuration:s-o,requestDuration:e.value-s,navigationEntry:n}}return Object.assign(e,{attribution:t})})(t))}),t)},Nc=[`CLS`,`INP`,`LCP`,`FCP`,`TTFB`],Pc={CLS:pc,FCP:mc,LCP:kc,INP:Ec,TTFB:Mc,FID:void 0},Fc=(e,t)=>{let n={},r=[];if(e===`CLS`){let e=t.attribution;r.push({key:`largestShiftTarget`,value:e.largestShiftTarget},{key:`largestShiftValue`,value:e.largestShiftValue})}else if(e===`INP`){let e=t.attribution;r.push({key:`interactionTarget`,value:e.interactionTarget},{key:`interactionType`,value:e.interactionType},{key:`nextPaintTime`,value:e.nextPaintTime},{key:`inputDelay`,value:e.inputDelay},{key:`processingDuration`,value:e.processingDuration},{key:`presentationDelay`,value:e.presentationDelay},{key:`totalScriptDuration`,value:e.totalScriptDuration},{key:`totalStyleAndLayoutDuration`,value:e.totalStyleAndLayoutDuration},{key:`totalPaintDuration`,value:e.totalPaintDuration},{key:`totalUnattributedDuration`,value:e.totalUnattributedDuration},{key:`loadState`,value:e.loadState})}else if(e===`LCP`){let e=t.attribution;r.push({key:`target`,value:e.target},{key:`url`,value:e.url},{key:`timeToFirstByte`,value:e.timeToFirstByte},{key:`resourceLoadDelay`,value:e.resourceLoadDelay},{key:`resourceLoadDuration`,value:e.resourceLoadDuration},{key:`elementRenderDelay`,value:e.elementRenderDelay})}return r.forEach(e=>{e.value!==void 0&&(n[`mxl.web_vital.attribution.${e.key}`]=e.value)}),n};var Ic=class extends G{constructor({diag:e,perf:t,listeners:n=Pc,urlDocument:r=window.document,urlAttribution:i=!0,pageManager:a}={}){super({instrumentationName:`WebVitalsInstrumentation`,instrumentationVersion:`1.0.0`,diag:e,perf:t,config:{}}),j(this,`_listeners`,void 0),j(this,`_urlDocument`,void 0),j(this,`_urlAttribution`,void 0),j(this,`_pageManager`,void 0),j(this,`_attributedPage`,{INP:void 0,LCP:void 0,CLS:void 0,FCP:void 0,TTFB:void 0}),j(this,`_largestShiftTargetForCLS`,void 0),j(this,`_listenersRegistered`,!1),j(this,`_isEnabled`,!1),this._listeners=n,this._urlDocument=r,this._urlAttribution=i,this._pageManager=a==null?U.getPageManager():a,this._config.enabled&&this.enable()}disable(){this._isEnabled=!1,this._diag.debug(`WebVitalsInstrumentation disabled, pausing emission`)}enable(){if(this._isEnabled=!0,this._listenersRegistered){this._diag.debug(`WebVitalsInstrumentation listeners already registered, resuming emission`);return}if(this._listenersRegistered=!0,Nc.forEach(e=>{var t,n;(t=(n=this._listeners)[e])==null||t.call(n,t=>{if(!this._isEnabled)return;let n=this.sessionManager.getSessionSpan();if(!n)return;let r=this._getTimeForMetric(t),i=this._getAttributedPageForMetric(t),a=L({[k]:A.WebVital,[N]:i.fullURL,"mxl.web_vital.navigation_type":t.navigationType,"mxl.web_vital.name":t.name,"mxl.web_vital.rating":t.rating,"mxl.web_vital.id":t.id,"mxl.web_vital.delta":t.delta,"mxl.web_vital.value":t.value},Fc(e,t));i.path&&i.pageID&&(a[Pt]=i.path,a[Ft]=i.pageID),i.label&&(a[It]=i.label),n.addEvent(`mxl-web-vitals-report-${e}`,a,r)})}),this._urlAttribution){var e,t,n,r,i,a,o,s,c,l;(e=(t=this._listeners).TTFB)==null||e.call(t,()=>{this._attributedPage.TTFB=this._currentAttributedPage()},{reportAllChanges:!0}),(n=(r=this._listeners).FCP)==null||n.call(r,()=>{this._attributedPage.FCP=this._currentAttributedPage()},{reportAllChanges:!0}),(i=(a=this._listeners).INP)==null||i.call(a,()=>{this._attributedPage.INP=this._currentAttributedPage()},{reportAllChanges:!0}),(o=(s=this._listeners).LCP)==null||o.call(s,()=>{this._attributedPage.LCP=this._currentAttributedPage()},{reportAllChanges:!0}),(c=(l=this._listeners).CLS)==null||c.call(l,e=>{let t=e;this._largestShiftTargetForCLS!==t.attribution.largestShiftTarget&&(this._largestShiftTargetForCLS=t.attribution.largestShiftTarget,this._attributedPage.CLS=this._currentAttributedPage())},{reportAllChanges:!0})}}_getTimeForMetric(e){return e.name===`CLS`&&e.attribution.largestShiftTime?this.perf.epochMillisFromOriginOffset(e.attribution.largestShiftTime):e.name===`INP`&&e.attribution.interactionTime?this.perf.epochMillisFromOriginOffset(e.attribution.interactionTime):this.perf.getNowMillis()}_currentAttributedPage(){let e={fullURL:this._urlDocument.URL},t=this._pageManager.getCurrentRoute(),n=this._pageManager.getCurrentPageId();t&&n&&(e.path=t.path,e.pageID=n);let r=this._pageManager.getPageLabel();return r&&(e.label=r),e}_getAttributedPageForMetric(e){return e.name===`FCP`&&this._attributedPage.FCP?this._attributedPage.FCP:e.name===`TTFB`&&this._attributedPage.TTFB?this._attributedPage.TTFB:e.name===`INP`&&this._attributedPage.INP?this._attributedPage.INP:e.name===`LCP`&&this._attributedPage.LCP?this._attributedPage.LCP:e.name===`CLS`&&this._attributedPage.CLS&&e.attribution.largestShiftTarget===this._largestShiftTargetForCLS?this._attributedPage.CLS:this._currentAttributedPage()}};let X=console.error.bind(console);function Lc(e,t,n){let r=!!e[t]&&Object.prototype.propertyIsEnumerable.call(e,t);Object.defineProperty(e,t,{configurable:!0,enumerable:r,writable:!0,value:n})}let Rc=(e,t,n)=>{if(!e||!e[t]){X(`no original function `+String(t)+` to wrap`);return}if(!n){X(`no wrapper function`),X(Error().stack);return}let r=e[t];if(typeof r!=`function`||typeof n!=`function`){X(`original object and wrapper must be functions`);return}let i=n(r,t);return Lc(i,`__original`,r),Lc(i,`__unwrap`,()=>{e[t]===i&&Lc(e,t,r)}),Lc(i,`__wrapped`,!0),Lc(e,t,i),i},zc=(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{X(`must provide one or more modules to patch`),X(Error().stack);return}if(!(t&&Array.isArray(t))){X(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{Rc(e,t,n)})})},Bc=(e,t)=>{if(!e||!e[t]){X(`no function to unwrap.`),X(Error().stack);return}let n=e[t];if(!n.__unwrap)X(`no original to unwrap to -- has `+String(t)+` already been unwrapped?`);else{n.__unwrap();return}},Vc=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{X(`must provide one or more modules to patch`),X(Error().stack);return}if(!(t&&Array.isArray(t))){X(`must provide one or more functions to unwrap on modules`);return}e.forEach(e=>{t.forEach(t=>{Bc(e,t)})})};function Hc(e){e&&e.logger&&(typeof e.logger==`function`?X=e.logger:X(`new logger isn't a function, not replacing`))}Hc.wrap=Rc,Hc.massWrap=zc,Hc.unwrap=Bc,Hc.massUnwrap=Vc;var Uc=class{constructor(e,t,n){j(this,`_config`,{}),j(this,`_tracer`,void 0),j(this,`_meter`,void 0),j(this,`_logger`,void 0),j(this,`_diag`,void 0),j(this,`instrumentationName`,void 0),j(this,`instrumentationVersion`,void 0),j(this,`_wrap`,Rc),j(this,`_unwrap`,Bc),j(this,`_massWrap`,zc),j(this,`_massUnwrap`,Vc),this.instrumentationName=e,this.instrumentationVersion=t,this.setConfig(n),this._diag=E.createComponentLogger({namespace:e}),this._tracer=O.getTracer(e,t),this._meter=mt.getMeter(e,t),this._logger=Ya.getLogger(e,t),this._updateMetricInstruments()}get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){var e;let t=(e=this.init())==null?[]:e;return Array.isArray(t)?t:[t]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config=L({enabled:!0},e)}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,t,n,r){if(e)try{e(n,r)}catch(e){this._diag.error(`Error running span customization hook due to exception in handler`,{triggerName:t},e)}}},Wc=class extends Uc{constructor(e,t,n){super(e,t,n),this._config.enabled&&this.enable()}};function Gc(e,t,n){let r,i;try{i=e()}catch(e){r=e}finally{if(t(r,i),r&&!n)throw r;return i}}function Kc(e){return typeof e==`function`&&typeof e.__original==`function`&&typeof e.__unwrap==`function`&&e.__wrapped===!0}var Z;(function(e){e[e.STABLE=1]=`STABLE`,e[e.OLD=2]=`OLD`,e[e.DUPLICATE=3]=`DUPLICATE`})(Z||(Z={}));function qc(e,t){let n=Z.OLD,r=t==null?void 0:t.split(`,`).map(e=>e.trim()).filter(e=>e!==``);for(let t of r==null?[]:r)if(t.toLowerCase()===e+`/dup`){n=Z.DUPLICATE;break}else t.toLowerCase()===e&&(n=Z.STABLE);return n}let Jc=performance,Yc=Math.pow(10,6),Xc=Math.pow(10,9);function Zc(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*Yc)]}function Qc(e){return $c(Zc(Jc.timeOrigin),Zc(typeof e==`number`?e:Jc.now()))}function $c(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=Xc&&(n[1]-=Xc,n[0]+=1),n}function el(e,t){return typeof t==`string`?e===t:!!e.match(t)}function tl(e,t){if(!t)return!1;for(let n of t)if(el(e,n))return!0;return!1}var Q;(function(e){e.METHOD_OPEN=`open`,e.METHOD_SEND=`send`,e.EVENT_ABORT=`abort`,e.EVENT_ERROR=`error`,e.EVENT_LOAD=`loaded`,e.EVENT_TIMEOUT=`timeout`})(Q||(Q={}));let nl=E.createComponentLogger({namespace:`@opentelemetry/opentelemetry-instrumentation-xml-http-request/utils`});function rl(e){return typeof Document<`u`&&e instanceof Document}function il(e){if(rl(e))return new XMLSerializer().serializeToString(document).length;if(typeof e==`string`)return ol(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return sl(e);if(e instanceof URLSearchParams)return ol(e.toString());if(e.byteLength!==void 0)return e.byteLength;nl.warn(`unknown body type`)}let al=new TextEncoder;function ol(e){return al.encode(e).byteLength}function sl(e){let t=0;for(let[n,r]of e.entries())t+=n.length,r instanceof Blob?t+=r.size:t+=r.length;return t}function cl(e){let t=dl(),n=e.toUpperCase();return n in t?n:`_OTHER`}let ll={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},ul;function dl(){return ul===void 0&&(ul=ll),ul}let fl={"https:":`443`,"http:":`80`};function pl(e){let t=Number(e.port||fl[e.protocol]);if(t&&!isNaN(t))return t}let ml=`0.213.0`;var hl;(function(e){e.HTTP_STATUS_TEXT=`http.status_text`})(hl||(hl={}));var gl=class extends Wc{constructor(e={}){super(`@opentelemetry/instrumentation-xml-http-request`,ml,e),j(this,`component`,`xml-http-request`),j(this,`version`,ml),j(this,`moduleName`,this.component),j(this,`_tasksCount`,0),j(this,`_xhrMem`,new WeakMap),j(this,`_usedResources`,new WeakSet),j(this,`_semconvStability`,void 0),this._semconvStability=qc(`http`,e==null?void 0:e.semconvStabilityOptIn)}init(){}_addHeaders(e,t){let n=H(t).href;if(!Qi(n,this.getConfig().propagateTraceHeaderCorsUrls)){let e={};D.inject(T.active(),e),Object.keys(e).length>0&&this._diag.debug(`headers inject skipped due to CORS policy`);return}let r={};D.inject(T.active(),r),Object.keys(r).forEach(t=>{e.setRequestHeader(t,String(r[t]))})}_addChildSpan(e,t){T.with(O.setSpan(T.active(),e),()=>{let e=this.tracer.startSpan(`CORS Preflight`,{startTime:t[B.FETCH_START]}),n=!(this._semconvStability&Z.OLD);Ki(e,t,this.getConfig().ignoreNetworkEvents,void 0,n),e.end(t[B.RESPONSE_END])})}_addFinalSpanAttributes(e,t,n){if(this._semconvStability&Z.OLD){if(t.status!==void 0&&e.setAttribute(`http.status_code`,t.status),t.statusText!==void 0&&e.setAttribute(hl.HTTP_STATUS_TEXT,t.statusText),typeof n==`string`){let t=H(n);e.setAttribute(`http.host`,t.host),e.setAttribute(`http.scheme`,t.protocol.replace(`:`,``))}e.setAttribute(`http.user_agent`,navigator.userAgent)}this._semconvStability&Z.STABLE&&t.status&&e.setAttribute(rn,t.status)}_applyAttributesAfterXHR(e,t){let n=this.getConfig().applyCustomAttributesOnSpan;typeof n==`function`&&Gc(()=>n(e,t),e=>{e&&this._diag.error(`applyCustomAttributesOnSpan`,e)},!0)}_addResourceObserver(e,t){let n=this._xhrMem.get(e);!n||typeof PerformanceObserver!=`function`||typeof PerformanceResourceTiming!=`function`||(n.createdResources={observer:new PerformanceObserver(e=>{let r=e.getEntries(),i=H(t);r.forEach(e=>{e.initiatorType===`xmlhttprequest`&&e.name===i.href&&n.createdResources&&n.createdResources.entries.push(e)})}),entries:[]},n.createdResources.observer.observe({entryTypes:[`resource`]}))}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(Jc.clearResourceTimings(),this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}_findResourceAndAddNetworkEvents(e,t,n,r,i){if(!n||!r||!i||!e.createdResources)return;let a=e.createdResources.entries;(!a||!a.length)&&(a=Jc.getEntriesByType(`resource`));let o=Yi(H(n).href,r,i,a,this._usedResources);if(o.mainRequest){let e=o.mainRequest;this._markResourceAsUsed(e);let n=o.corsPreFlightRequest;n&&(this._addChildSpan(t,n),this._markResourceAsUsed(n));let r=!(this._semconvStability&Z.OLD);Ki(t,e,this.getConfig().ignoreNetworkEvents,void 0,r)}}_cleanPreviousSpanInformation(e){let t=this._xhrMem.get(e);if(t){let n=t.callbackToRemoveEvents;n&&n(),this._xhrMem.delete(e)}}_createSpan(e,t,n){if(tl(t,this.getConfig().ignoreUrls)){this._diag.debug(`ignoring span as url matches ignored url`);return}let r=``,i=H(t),a={};if(this._semconvStability&Z.OLD&&(r=n.toUpperCase(),a[`http.method`]=n,a[`http.url`]=i.toString()),this._semconvStability&Z.STABLE){let e=n,t=cl(n);r||(r=t),a[tn]=t,t!==e&&(a[nn]=e),a[N]=i.toString(),a[an]=i.hostname;let o=pl(i);o&&(a[on]=o)}let o=this.tracer.startSpan(r,{kind:ut.CLIENT,attributes:a});return o.addEvent(Q.METHOD_OPEN),this._cleanPreviousSpanInformation(e),this._xhrMem.set(e,{span:o,spanUrl:t}),o}_markResourceAsUsed(e){this._usedResources.add(e)}_patchOpen(){return e=>{let t=this;return function(...n){let r=n[0],i=n[1];return t._createSpan(this,i,r),e.apply(this,n)}}}_patchSend(){let e=this;function t(t,n,r,i){let a=n.callbackToRemoveEvents;typeof a==`function`&&a();let{span:o,spanUrl:s,sendStartTime:c}=n;o&&(e._findResourceAndAddNetworkEvents(n,o,s,c,r),o.addEvent(t,i),e._addFinalSpanAttributes(o,n,s),o.end(i),e._tasksCount--),e._clearResources()}function n(n,r,i,a){let o=e._xhrMem.get(r);if(!o)return;if(o.status=r.status,o.statusText=r.statusText,e._xhrMem.delete(r),o.span){let t=o.span;e._applyAttributesAfterXHR(t,r),e._semconvStability&Z.STABLE&&(i?a&&(t.setStatus({code:dt.ERROR,message:a}),t.setAttribute(Qt,a)):o.status&&o.status>=400&&(t.setStatus({code:dt.ERROR}),t.setAttribute(Qt,String(o.status))))}let s=Qc(),c=Date.now();setTimeout(()=>{t(n,o,s,c)},300)}function r(){n(Q.EVENT_ERROR,this,!0,`error`)}function i(){n(Q.EVENT_ABORT,this,!1)}function a(){n(Q.EVENT_TIMEOUT,this,!0,`timeout`)}function o(){this.status<299?n(Q.EVENT_LOAD,this,!1):n(Q.EVENT_ERROR,this,!1)}function s(t){t.removeEventListener(`abort`,i),t.removeEventListener(`error`,r),t.removeEventListener(`load`,o),t.removeEventListener(`timeout`,a);let n=e._xhrMem.get(t);n&&(n.callbackToRemoveEvents=void 0)}return t=>function(...n){let c=e._xhrMem.get(this);if(!c)return t.apply(this,n);let l=c.span,u=c.spanUrl;if(l&&u){if(e.getConfig().measureRequestSize&&n!=null&&n[0]){let t=n[0],r=il(t);r!==void 0&&(e._semconvStability&Z.OLD&&l.setAttribute(`http.request_content_length_uncompressed`,r),e._semconvStability&Z.STABLE&&l.setAttribute(`http.request.body.size`,r))}T.with(O.setSpan(T.active(),l),()=>{e._tasksCount++,c.sendStartTime=Qc(),l.addEvent(Q.METHOD_SEND),this.addEventListener(`abort`,i),this.addEventListener(`error`,r),this.addEventListener(`load`,o),this.addEventListener(`timeout`,a),c.callbackToRemoveEvents=()=>{s(this),c.createdResources&&c.createdResources.observer.disconnect()},e._addHeaders(this,u),e._addResourceObserver(this,u)})}return t.apply(this,n)}}enable(){this._diag.debug(`applying patch to`,this.moduleName,this.version),Kc(XMLHttpRequest.prototype.open)&&(this._unwrap(XMLHttpRequest.prototype,`open`),this._diag.debug(`removing previous patch from method open`)),Kc(XMLHttpRequest.prototype.send)&&(this._unwrap(XMLHttpRequest.prototype,`send`),this._diag.debug(`removing previous patch from method send`)),this._wrap(XMLHttpRequest.prototype,`open`,this._patchOpen()),this._wrap(XMLHttpRequest.prototype,`send`,this._patchSend())}disable(){this._diag.debug(`removing patch from`,this.moduleName,this.version),this._unwrap(XMLHttpRequest.prototype,`open`),this._unwrap(XMLHttpRequest.prototype,`send`),this._tasksCount=0,this._xhrMem=new WeakMap,this._usedResources=new WeakSet}};let _l=[`omitIfAlreadyPatched`];var vl=class extends gl{constructor(e={}){let{omitIfAlreadyPatched:t}=e,n=ts(e,_l);super(L(L({},n),{},{enabled:!1})),j(this,`_omitIfAlreadyPatched`,void 0),this._omitIfAlreadyPatched=t,n.enabled&&this.enable()}enable(){if(this._omitIfAlreadyPatched&&(eo(XMLHttpRequest.prototype.open)||eo(XMLHttpRequest.prototype.send))){this._diag.debug("XMLHttpRequest is already passed and `omitIfAlreadyPatched` is true, skipping enabling this instrumentation");return}super.enable()}};let yl=y(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function bl(e){return e.setValue(yl,!0)}function xl(){return e=>{E.error(Sl(e))}}function Sl(e){return typeof e==`string`?e:JSON.stringify(Cl(e))}function Cl(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(e=>{if(t[e])return;let r=n[e];r&&(t[e]=String(r))}),n=Object.getPrototypeOf(n);return t}let wl=xl();function Tl(e){try{wl(e)}catch(e){}}let El={[un]:`opentelemetry`,"process.runtime.name":`browser`,[cn]:ln,[dn]:`2.6.0`},Dl=performance,Ol=Math.pow(10,6),kl=Math.pow(10,9);function Al(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*Ol)]}function jl(e){return Pl(Al(Dl.timeOrigin),Al(typeof e==`number`?e:Dl.now()))}function Ml(e){if(Nl(e))return e;if(typeof e==`number`)return e<Dl.timeOrigin?jl(e):Al(e);if(e instanceof Date)return Al(e.getTime());throw TypeError(`Invalid input type`)}function Nl(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function Pl(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=kl&&(n[1]-=kl,n[0]+=1),n}var Fl;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(Fl||(Fl={}));var Il=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function Ll(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new Il(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}var Rl=class{constructor(){j(this,`_promise`,void 0),j(this,`_resolve`,void 0),j(this,`_reject`,void 0),this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}},zl=class{constructor(e,t){j(this,`_isCalled`,!1),j(this,`_deferred`,new Rl),j(this,`_callback`,void 0),j(this,`_that`,void 0),this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}};function Bl(e,t){return new Promise(n=>{T.with(bl(T.active()),()=>{e.export(t,n)})})}let Vl={_export:Bl},Hl;function Ul(){if(Hl===void 0)try{let e=globalThis.process.argv0;Hl=e?`unknown_service:${e}`:`unknown_service`}catch(e){Hl=`unknown_service`}return Hl}let Wl=e=>typeof e==`object`&&!!e&&typeof e.then==`function`;var Gl=class e{static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=Jl(t),r._asyncAttributesPending=t.filter(([e,t])=>Wl(t)).length>0,r}constructor(e,t){var n;j(this,`_rawAttributes`,void 0),j(this,`_asyncAttributesPending`,!1),j(this,`_schemaUrl`,void 0),j(this,`_memoizedAttributes`,void 0);let r=(n=e.attributes)==null?{}:n;this._rawAttributes=Object.entries(r).map(([e,t])=>(Wl(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=Jl(this._rawAttributes),this._schemaUrl=Yl(t==null?void 0:t.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}waitForAsyncAttributes(){var e=this;return P(function*(){if(e.asyncAttributesPending){for(let t=0;t<e._rawAttributes.length;t++){let[n,r]=e._rawAttributes[t];e._rawAttributes[t]=[n,Wl(r)?yield r:r]}e._asyncAttributesPending=!1}})()}get attributes(){if(this.asyncAttributesPending&&E.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(Wl(n)){E.debug(`Unsettled resource attribute ${t} skipped`);continue}n!=null&&(e[t]!=null||(e[t]=n))}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=Xl(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function Kl(e,t){return Gl.FromAttributeList(Object.entries(e),t)}function ql(){return Kl({[sn]:Ul(),[cn]:El[cn],[un]:El[un],[dn]:El[dn]})}function Jl(e){return e.map(([e,t])=>Wl(t)?[e,t.catch(t=>{E.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function Yl(e){if(typeof e==`string`||e===void 0)return e;E.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function Xl(e,t){let n=e==null?void 0:e.schemaUrl,r=t==null?void 0:t.schemaUrl,i=n===void 0||n===``,a=r===void 0||r===``;if(i)return r;if(a||n===r)return n;E.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}function Zl(e){return Ql(e,new WeakSet)}function Ql(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof Uint8Array)return!0;if(typeof e==`object`){if(t.has(e))return!1;if(t.add(e),Array.isArray(e))return e.every(e=>Ql(e,t));let n=e;return n.constructor!==Object&&n.constructor!==void 0?!1:Object.values(n).every(e=>Ql(e,t))}return!1}var $l=class{set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this.totalAttributesCount-Object.keys(this.attributes).length}constructor(e,t,n){j(this,`hrTime`,void 0),j(this,`hrTimeObserved`,void 0),j(this,`spanContext`,void 0),j(this,`resource`,void 0),j(this,`instrumentationScope`,void 0),j(this,`attributes`,{}),j(this,`_severityText`,void 0),j(this,`_severityNumber`,void 0),j(this,`_body`,void 0),j(this,`_eventName`,void 0),j(this,`totalAttributesCount`,0),j(this,`_isReadonly`,!1),j(this,`_logRecordLimits`,void 0);let{timestamp:r,observedTimestamp:i,eventName:a,severityNumber:o,severityText:s,body:c,attributes:l={},exception:u,context:d}=n,f=Date.now();if(this.hrTime=Ml(r==null?f:r),this.hrTimeObserved=Ml(i==null?f:i),d){let e=O.getSpanContext(d);e&&et(e)&&(this.spanContext=e)}this.severityNumber=o,this.severityText=s,this.body=c,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=a,this.setAttributes(l),u!=null&&this._setException(u)}setAttribute(e,t){return this._isLogRecordReadonly()?this:e.length===0?(E.warn(`Invalid attribute key: ${e}`),this):Zl(t)?(this.totalAttributesCount+=1,Object.keys(this.attributes).length>=this._logRecordLimits.attributeCountLimit&&!Object.prototype.hasOwnProperty.call(this.attributes,e)?(this.droppedAttributesCount===1&&E.warn(`Dropping extra attributes.`),this):(this.attributes[e]=this._truncateToSize(t),this)):(E.warn(`Invalid attribute value set for key: ${e}`),this)}setAttributes(e){for(let[t,n]of Object.entries(e))this.setAttribute(t,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let t=this._logRecordLimits.attributeValueLengthLimit;if(t<=0)return E.warn(`Attribute value limit must be positive, got ${t}`),e;if(e==null)return e;if(typeof e==`string`)return this._truncateToLimitUtil(e,t);if(e instanceof Uint8Array)return e;if(Array.isArray(e))return e.map(e=>this._truncateToSize(e));if(typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))t[n]=this._truncateToSize(r);return t}return e}_setException(e){let t=!1;if(typeof e==`string`||typeof e==`number`)Object.hasOwn(this.attributes,$t)||this.setAttribute($t,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,M)||this.setAttribute(M,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,M)||this.setAttribute(M,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,$t)||this.setAttribute($t,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,en)||this.setAttribute(en,n.stack),t=!0)}t||E.warn(`Failed to record an exception ${e}`)}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&E.warn(`Can not execute the operation on emitted log record`),this._isReadonly}},eu=class{constructor(e,t){j(this,`instrumentationScope`,void 0),j(this,`_sharedState`,void 0),j(this,`_loggerConfig`,void 0),this.instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(e){var t;let n=this._loggerConfig,r=e.context||T.active(),i=(t=e.severityNumber)==null?W.UNSPECIFIED:t;if(i!==W.UNSPECIFIED&&i<n.minimumSeverity)return;if(n.traceBased){let e=O.getSpanContext(r);if(e&&et(e)&&(e.traceFlags&w.SAMPLED)!==w.SAMPLED)return}let a=new $l(this._sharedState,this.instrumentationScope,L({context:r},e));this._sharedState.activeProcessor.onEmit(a,r),a._makeReadonly()}},tu=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}},nu=class{constructor(e,t){j(this,`processors`,void 0),j(this,`forceFlushTimeoutMillis`,void 0),this.processors=e,this.forceFlushTimeoutMillis=t}forceFlush(){var e=this;return P(function*(){let t=e.forceFlushTimeoutMillis;yield Promise.all(e.processors.map(e=>Ll(e.forceFlush(),t)))})()}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}shutdown(){var e=this;return P(function*(){yield Promise.all(e.processors.map(e=>e.shutdown()))})()}};function ru(e){return`${e.name}@${e.version||``}:${e.schemaUrl||``}`}let iu={disabled:!1,minimumSeverity:W.UNSPECIFIED,traceBased:!1},au=()=>L({},iu);var ou=class{constructor(e,t,n,r,i){j(this,`loggers`,new Map),j(this,`activeProcessor`,void 0),j(this,`registeredLogRecordProcessors`,[]),j(this,`resource`,void 0),j(this,`forceFlushTimeoutMillis`,void 0),j(this,`logRecordLimits`,void 0),j(this,`processors`,void 0),j(this,`_loggerConfigurator`,void 0),j(this,`_loggerConfigs`,new Map),this.resource=e,this.forceFlushTimeoutMillis=t,this.logRecordLimits=n,this.processors=r,r.length>0?(this.registeredLogRecordProcessors=r,this.activeProcessor=new nu(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new tu,this._loggerConfigurator=i==null?au:i}getLoggerConfig(e){let t=ru(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}},su=class{constructor(e={}){var t,n,r,i,a,o,s,c;j(this,`_shutdownOnce`,void 0),j(this,`_sharedState`,void 0);let l={resource:(t=e.resource)==null?ql():t,forceFlushTimeoutMillis:(n=e.forceFlushTimeoutMillis)==null?3e4:n,logRecordLimits:{attributeCountLimit:(r=(i=e.logRecordLimits)==null?void 0:i.attributeCountLimit)==null?128:r,attributeValueLengthLimit:(a=(o=e.logRecordLimits)==null?void 0:o.attributeValueLengthLimit)==null?1/0:a},loggerConfigurator:(s=e.loggerConfigurator)==null?au:s,processors:(c=e.processors)==null?[]:c};this._sharedState=new ou(l.resource,l.forceFlushTimeoutMillis,l.logRecordLimits,l.processors,l.loggerConfigurator),this._shutdownOnce=new zl(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return E.warn(`A shutdown LoggerProvider cannot provide a Logger`),Ha;e||E.warn(`Logger requested without instrumentation scope name.`);let r=e||`unknown`,i=`${r}@${t||``}:${(n==null?void 0:n.schemaUrl)||``}`;return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new eu({name:r,version:t,schemaUrl:n==null?void 0:n.schemaUrl},this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(E.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(E.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}},cu=class{constructor(e,t){var n,r,i,a;j(this,`_maxExportBatchSize`,void 0),j(this,`_maxQueueSize`,void 0),j(this,`_scheduledDelayMillis`,void 0),j(this,`_exportTimeoutMillis`,void 0),j(this,`_exporter`,void 0),j(this,`_isExporting`,!1),j(this,`_finishedLogRecords`,[]),j(this,`_timer`,void 0),j(this,`_shutdownOnce`,void 0),this._exporter=e,this._maxExportBatchSize=(n=t==null?void 0:t.maxExportBatchSize)==null?512:n,this._maxQueueSize=(r=t==null?void 0:t.maxQueueSize)==null?2048:r,this._scheduledDelayMillis=(i=t==null?void 0:t.scheduledDelayMillis)==null?5e3:i,this._exportTimeoutMillis=(a=t==null?void 0:t.exportTimeoutMillis)==null?3e4:a,this._shutdownOnce=new zl(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(E.warn(`BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}shutdown(){return this._shutdownOnce.call()}_shutdown(){var e=this;return P(function*(){e.onShutdown(),yield e._flushAll(),yield e._exporter.shutdown()})()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}_flushAll(){return new Promise((e,t)=>{let n=[],r=Math.ceil(this._finishedLogRecords.length/this._maxExportBatchSize);for(let e=0;e<r;e++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),this._finishedLogRecords.length===0?Promise.resolve():Ll(this._export(this._finishedLogRecords.splice(0,this._maxExportBatchSize)),this._exportTimeoutMillis)}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().then(()=>{this._isExporting=!1,this._finishedLogRecords.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,Tl(e)})};if(this._finishedLogRecords.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}_export(e){let t=()=>Vl._export(this._exporter,e).then(e=>{if(e.code!==Fl.SUCCESS){var t;Tl((t=e.error)==null?Error(`BatchLogRecordProcessor: log record export failed (status ${e})`):t)}}).catch(Tl),n=[];for(let t=0;t<e.length;t++){let r=e[t].resource;r.asyncAttributesPending&&typeof r.waitForAsyncAttributes==`function`&&n.push(r.waitForAsyncAttributes())}return n.length===0?t():Promise.all(n).then(t,Tl)}},lu=class extends cu{constructor(e,t){super(e,t),j(this,`_visibilityChangeListener`,void 0),j(this,`_pageHideListener`,void 0),this._onInit(t)}onShutdown(){typeof document>`u`||(this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener(`pagehide`,this._pageHideListener))}_onInit(e){(e==null?void 0:e.disableAutoFlushOnDocumentHide)===!0||typeof document>`u`||(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush()},this._pageHideListener=()=>{this.forceFlush()},document.addEventListener(`visibilitychange`,this._visibilityChangeListener),document.addEventListener(`pagehide`,this._pageHideListener))}},uu=class{constructor(e){j(this,`_sessionIdProvider`,void 0),this._sessionIdProvider=e}forceFlush(){return P(function*(){})()}onStart(e,t){var n;let r=(n=this._sessionIdProvider)==null?void 0:n.getSessionId();r&&e.setAttribute(`session.id`,r)}onEnd(e){}shutdown(){return P(function*(){})()}};function du(e){return new uu(e)}let fu={compression:`gzip`,keepalive:!0,concurrencyLimit:5,timeoutMillis:30*1e3},pu=(e,t)=>({"X-MXL-AID":e,"X-MXL-DID":t}),mu=(e,t)=>t||`http://mxl-otelcol.service-availability.apps.ocpthikadev01.safaricom.net`;function hu(e,t){let n={attributes:_u(e.attributes,t),droppedAttributesCount:0},r=e.schemaUrl;return r&&r!==``&&(n.schemaUrl=r),n}function gu(e){return{name:e.name,version:e.version}}function _u(e,t){return Object.keys(e).map(n=>vu(n,e[n],t))}function vu(e,t,n){return{key:e,value:yu(t,n)}}function yu(e,t){let n=typeof e;if(n===`string`)return{stringValue:e};if(n===`number`)return Number.isInteger(e)?{intValue:e}:{doubleValue:e};if(n===`boolean`)return{boolValue:e};if(e instanceof Uint8Array)return{bytesValue:t.encodeUint8Array(e)};if(Array.isArray(e)){let n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=yu(e[r],t);return{arrayValue:{values:n}}}if(n===`object`&&e!=null){let n=Object.keys(e),r=Array(n.length);for(let i=0;i<n.length;i++)r[i]={key:n[i],value:yu(e[n[i]],t)};return{kvlistValue:{values:r}}}return{}}function bu(e,t){return{resourceLogs:Su(e,t)}}function xu(e){let t=new Map;for(let n of e){let{resource:e,instrumentationScope:{name:r,version:i=``,schemaUrl:a=``}}=n,o=t.get(e);o||(o=new Map,t.set(e,o));let s=`${r}@${i}:${a}`,c=o.get(s);c||(c=[],o.set(s,c)),c.push(n)}return t}function Su(e,t){let n=xu(e);return Array.from(n,([e,n])=>{let r=hu(e,t);return{resource:r,scopeLogs:Array.from(n,([,e])=>({scope:gu(e[0].instrumentationScope),logRecords:e.map(e=>Cu(e,t)),schemaUrl:e[0].instrumentationScope.schemaUrl})),schemaUrl:r.schemaUrl}})}function Cu(e,t){var n,r,i;return{timeUnixNano:t.encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:wu(e.severityNumber),severityText:e.severityText,body:yu(e.body,t),eventName:e.eventName,attributes:Tu(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,flags:(n=e.spanContext)==null?void 0:n.traceFlags,traceId:t.encodeOptionalSpanContext((r=e.spanContext)==null?void 0:r.traceId),spanId:t.encodeOptionalSpanContext((i=e.spanContext)==null?void 0:i.spanId)}}function wu(e){return e}function Tu(e,t){return Object.keys(e).map(n=>vu(n,e[n],t))}let Eu=Math.pow(10,9);function Du(e){return e[0]*Eu+e[1]}function Ou(e){let t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function ku(e){return Ou(e).toString()}let Au=typeof BigInt<`u`?ku:Du;function ju(e){return e}let Mu={encodeHrTime:Au,encodeSpanContext:ju,encodeOptionalSpanContext:ju,encodeUint8Array:e=>{if(typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let t=Array(e.length);for(let n=0;n<e.length;n++)t[n]=String.fromCharCode(e[n]);return btoa(t.join(``))}};function Nu(e,t){let n=e&255|256;return t&&(n|=512),n}function Pu(e,t){var n,r,i,a;let o=e.spanContext(),s=e.status,c=(n=e.parentSpanContext)!=null&&n.spanId?t.encodeSpanContext((r=e.parentSpanContext)==null?void 0:r.spanId):void 0;return{traceId:t.encodeSpanContext(o.traceId),spanId:t.encodeSpanContext(o.spanId),parentSpanId:c,traceState:(i=o.traceState)==null?void 0:i.serialize(),name:e.name,kind:e.kind==null?0:e.kind+1,startTimeUnixNano:t.encodeHrTime(e.startTime),endTimeUnixNano:t.encodeHrTime(e.endTime),attributes:_u(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>Iu(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:s.code,message:s.message},links:e.links.map(e=>Fu(e,t)),droppedLinksCount:e.droppedLinksCount,flags:Nu(o.traceFlags,(a=e.parentSpanContext)==null?void 0:a.isRemote)}}function Fu(e,t){var n;return{attributes:e.attributes?_u(e.attributes,t):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:(n=e.context.traceState)==null?void 0:n.serialize(),droppedAttributesCount:e.droppedAttributesCount||0,flags:Nu(e.context.traceFlags,e.context.isRemote)}}function Iu(e,t){return{attributes:e.attributes?_u(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function Lu(e,t){return{resourceSpans:zu(e,t)}}function Ru(e){let t=new Map;for(let n of e){let e=t.get(n.resource);e||(e=new Map,t.set(n.resource,e));let r=`${n.instrumentationScope.name}@${n.instrumentationScope.version||``}:${n.instrumentationScope.schemaUrl||``}`,i=e.get(r);i||(i=[],e.set(r,i)),i.push(n)}return t}function zu(e,t){let n=Ru(e),r=[],i=n.entries(),a=i.next();for(;!a.done;){let[e,n]=a.value,o=[],s=n.values(),c=s.next();for(;!c.done;){let e=c.value;if(e.length>0){let n=e.map(e=>Pu(e,t));o.push({scope:gu(e[0].instrumentationScope),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=s.next()}let l=hu(e,t),u={resource:l,scopeSpans:o,schemaUrl:l.schemaUrl};r.push(u),a=i.next()}return r}let Bu={serializeRequest:e=>{let t=bu(e,Mu);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;return JSON.parse(t.decode(e))}},Vu={serializeRequest:e=>{let t=Lu(e,Mu);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;return JSON.parse(t.decode(e))}};var Hu=class{constructor(e){this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}},Uu=class extends Error{constructor(e,t,n){super(e),j(this,`code`,void 0),j(this,`name`,`OTLPExporterError`),j(this,`data`,void 0),this.data=n,this.code=t}},Wu=class{constructor(e){j(this,`_concurrencyLimit`,void 0),j(this,`_sendingPromises`,[]),this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw Error(`Concurrency Limit reached`);this._sendingPromises.push(e);let t=()=>{let t=this._sendingPromises.indexOf(e);this._sendingPromises.splice(t,1)};e.then(t,t)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}awaitAll(){var e=this;return P(function*(){yield Promise.all(e._sendingPromises)})()}};function Gu(e){return new Wu(e.concurrencyLimit)}var $;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})($||($={}));function Ku(e){return Object.prototype.hasOwnProperty.call(e,`partialSuccess`)}function qu(){return{handleResponse(e){e==null||!Ku(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||E.warn(`Received Partial Success response:`,JSON.stringify(e.partialSuccess))}}}var Ju=class{constructor(e,t,n,r,i){j(this,`_diagLogger`,void 0),j(this,`_transport`,void 0),j(this,`_serializer`,void 0),j(this,`_responseHandler`,void 0),j(this,`_promiseQueue`,void 0),j(this,`_timeout`,void 0),this._transport=e,this._serializer=t,this._responseHandler=n,this._promiseQueue=r,this._timeout=i,this._diagLogger=E.createComponentLogger({namespace:`OTLPExportDelegate`})}export(e,t){if(this._diagLogger.debug(`items to be sent`,e),this._promiseQueue.hasReachedLimit()){t({code:$.FAILED,error:Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);if(n==null){t({code:$.FAILED,error:Error(`Nothing to send`)});return}this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(e=>{if(e.status===`success`){if(e.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(e.data))}catch(t){this._diagLogger.warn(`Export succeeded but could not deserialize response - is the response specification compliant?`,t,e.data)}t({code:$.SUCCESS});return}else if(e.status===`failure`&&e.error){t({code:$.FAILED,error:e.error});return}else if(e.status===`retryable`){var n;t({code:$.FAILED,error:(n=e.error)==null?new Uu(`Export failed with retryable status`):n})}else t({code:$.FAILED,error:new Uu(`Export failed with unknown error`)})},e=>t({code:$.FAILED,error:e})))}forceFlush(){return this._promiseQueue.awaitAll()}shutdown(){var e=this;return P(function*(){e._diagLogger.debug(`shutdown started`),yield e.forceFlush(),e._transport.shutdown()})()}};function Yu(e,t){return new Ju(e.transport,e.serializer,qu(),e.promiseHandler,t.timeout)}function Xu(e,t,n){return Yu({transport:n,serializer:t,promiseHandler:Gu(e)},{timeout:e.timeoutMillis})}var Zu=class e{constructor(e){this._config=e}static _compressRequest(e){return P(function*(){let t=new CompressionStream(`gzip`),n=t.writable.getWriter();n.write(e),n.close();let r=[],i=t.readable.getReader(),a=!1;for(;!a;){let e=yield i.read();e.value&&r.push(e.value),a=e.done}let o=new Uint8Array(r.reduce((e,t)=>e+t.length,0)),s=0;for(let e of r)o.set(e,s),s+=e.length;return o})()}send(e,t){return this._asyncSend(e,t)}shutdown(){}_asyncSend(t,n){var r=this;return P(function*(){let i=t,a=L({"Content-Type":`application/json`},r._config.headers);r._config.compression===`gzip`&&(i=yield e._compressRequest(t),a[`Content-Encoding`]=`gzip`,a[`Content-Length`]=i.length.toString());let o,s;if(`timeout`in AbortSignal)o=AbortSignal.timeout(n);else{let e=new AbortController;o=e.signal,s=setTimeout(()=>{e.abort(new DOMException(`TimeoutError`,`TimeoutError`))},n)}try{let e=yield fetch(r._config.url,{method:`POST`,keepalive:!0,headers:a,body:i,signal:o});return e.ok?{status:`success`}:{status:`failure`,error:Error(`${e.status} Fetch request failed`)}}catch(e){return{status:`failure`,error:e instanceof Error?e:Error(String(e))}}finally{s!==void 0&&clearTimeout(s)}})()}};let Qu=e=>new Zu(e),$u=()=>Math.random()*40-20;var ed=class{constructor(e,t=new ra){this._transport=e,this._perf=t}send(e,t){var n=this;return P(function*(){let r=n._perf.getNowMillis()+t,i=yield n._transport.send(e,t),a=5,o=1e3;for(;i.status===`retryable`&&a>0;){var s;a--;let t=Math.max(Math.min(o,5e3)+$u(),0);o*=1.5;let c=(s=i.retryInMillis)==null?t:s,l=r-n._perf.getNowMillis();if(c>l)return i;i=yield n._retry(e,l,c)}return i})()}shutdown(){this._transport.shutdown()}_retry(e,t,n){return new Promise((r,i)=>{setTimeout(()=>{this._transport.send(e,t).then(r,i)},n)})}};let td=e=>{var t;return new ed(e.transport,(t=e.perf)==null?new ra:t)},nd=(e,t)=>Xu(e,t,td({transport:Qu(e)}));var rd=class extends Hu{constructor(e){super(nd(e,Bu))}};let id=(e,t)=>`${mu(e,t)}/v1/logs`;var ad=class extends rd{constructor({appID:e,userID:t,mxlDataURL:n}){super(L(L({},fu),{},{headers:pu(e,t),url:id(e,n)}))}},od=class extends Hu{constructor(e){super(nd(L(L({},e),{},{compression:`gzip`}),Vu))}};let sd=(e,t)=>`${mu(e,t)}/v1/traces`;var cd=class extends od{constructor({appID:e,userID:t,mxlDataURL:n}){super(L(L({},fu),{},{headers:pu(e,t),url:sd(e,n)}))}},ld=class{constructor({spanSessionManager:e}){j(this,`_spanSessionManager`,void 0),this._spanSessionManager=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){e.setAttributes({"log.record.uid":kt(),[ro]:this._spanSessionManager.getSessionId(),"session.previous_id":this._spanSessionManager.getPreviousSessionId()})}shutdown(){return Promise.resolve(void 0)}},ud=class{constructor({attributeScrubbers:e}){j(this,`_attributeScrubbers`,void 0),this._attributeScrubbers=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){this._attributeScrubbers.forEach(t=>{let n=e.attributes[t.key];n&&typeof n==`string`&&e.setAttribute(t.key,t.scrub(n))})}shutdown(){return Promise.resolve(void 0)}},dd=class{constructor({urlDocument:e=window.document}={}){j(this,`_urlDocument`,void 0),this._urlDocument=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){e.attributes[k]||e.setAttribute(k,A.SystemLog),e.setAttribute(N,this._urlDocument.URL)}shutdown(){return Promise.resolve(void 0)}};let fd=e=>{if((e.attributes[tn]||e.attributes[Yt])&&(typeof e.attributes[rn]==`number`||typeof e.attributes[Zt]==`number`)){var t;let n=(t=e.attributes[N])==null?e.attributes[Xt]:t;return typeof n==`string`&&n.includes(`://`)}return!1};var pd=class{forceFlush(){return Promise.resolve(void 0)}onEnd(e){if(fd(e)){var t,n,r,i,a;e.attributes[k]=A.Network,(t=e.attributes)[N]!=null||(t[N]=e.attributes[Xt]),(n=e.attributes)[rn]!=null||(n[rn]=e.attributes[Zt]),(r=e.attributes)[tn]!=null||(r[tn]=e.attributes[Yt]),(i=e.attributes)[no]!=null||(i[no]=e.attributes[`http.response_content_length`]),(a=e.attributes)[to]!=null||(a[to]=e.attributes[`http.request_content_length`])}}onStart(){}shutdown(){return Promise.resolve(void 0)}};let md=e=>e.attributes[k]===A.Session,hd=(e,t)=>`mxl.${t===`current`?`export_failed`:`previous_export_failed`}.${e}`;var gd=class{constructor({resource:e,exporter:t,limitManager:n,spanSessionManager:r,storage:i=window.localStorage,storedSpansExpireTimeoutMS:a,diag:o=E.createComponentLogger({namespace:`MXLSessionBatchedSpanProcessor`})}){j(this,`_shutdownOnce`,void 0),j(this,`_pendingSpans`,[]),j(this,`_exporter`,void 0),j(this,`_limitManager`,void 0),j(this,`_spanStorage`,void 0),j(this,`_spanSessionManager`,void 0),j(this,`_diag`,void 0),j(this,`_shutdown`,()=>(this._spanStorage.destroy(),this._exporter.shutdown())),this._diag=o,this._exporter=t,this._shutdownOnce=new Mn(this._shutdown,this),this._limitManager=n,this._spanSessionManager=r,this._spanStorage=new ea({resource:e,storage:i,diag:o,onExpiredSpansExport:e=>{this._exportSpans(e)},storedSpansExpireTimeoutMS:a,spanSessionManager:r})}forceFlush(){return this._diag.debug(`forceFlush called for MXLSessionBatchedSpanProcessor. This is a no op`),Promise.resolve(void 0)}onEnd(e){if(this._shutdownOnce.isCalled){this._diag.debug(`span ended after processor shutdown. Ignoring span.`);return}if(md(e))this._diag.debug(`session span ended. Exporting all pending spans.`),this._exportSpans([e,...this._pendingSpans]),this._pendingSpans=[];else{if(this._diag.debug(`non-session span ended. Adding to pending spans queue.`),this._limitManager.dropReadableSpan(e))return;this._pendingSpans.push(e)}}_exportSpans(e){Pn._export(this._exporter,e).then(e=>{if(e.code===gn.FAILED){var t;let n=((t=e.error)==null?void 0:t.message)||`unknown error`,r=`unknown`;n===`Concurrent export limit reached`?r=`concurrent_limit`:n===`Fetch request errored`&&(r=`fetch_error`),this._spanSessionManager.incrSessionCountForKey(hd(r,`current`)),this._spanSessionManager.incrNextSessionCountForKey(hd(r,`previous`)),this._diag.error(`spans failed to export: ${n}`)}}).catch(e=>{let t=`unknown error`;e&&e instanceof Error?t=e.message:typeof e==`string`&&(t=e),this._spanSessionManager.incrSessionCountForKey(hd(`unknown`,`current`)),this._spanSessionManager.incrNextSessionCountForKey(hd(`unknown`,`previous`)),this._diag.error(`spans failed to export: ${t}`)})}onStart(){}getPendingSpansCount(){return this._pendingSpans.length}storePendingSpans(e,t){this._spanStorage.storePendingSpans(e,t,this._pendingSpans)}clearStoredSpans(e){this._spanStorage.clearStoredSpans(e)}shutdown(){return this._shutdownOnce.call()}},_d=class{constructor({pageManager:e}){j(this,`_pageManager`,void 0),this._pageManager=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){if(!e.attributes[Pt]||!e.attributes[Ft]){let t=this._pageManager.getCurrentRoute();t&&(e.setAttribute(Pt,t.path),e.setAttribute(Ft,this._pageManager.getCurrentPageId()))}let t=this._pageManager.getPageLabel();t&&!e.attributes[It]&&e.setAttribute(It,t)}shutdown(){return Promise.resolve(void 0)}},vd=class{constructor({pageManager:e}){j(this,`_pageManager`,void 0),this._pageManager=e}forceFlush(){return Promise.resolve(void 0)}onEnd(e){if(!e.attributes[Pt]||!e.attributes[Ft]){let t=this._pageManager.getCurrentRoute(),n=this._pageManager.getCurrentPageId();t&&n&&(e.attributes[Pt]=t.path,e.attributes[Ft]=n)}let t=this._pageManager.getPageLabel();t&&!e.attributes[It]&&(e.attributes[It]=t)}onStart(){}shutdown(){return Promise.resolve(void 0)}},yd=class{constructor({attributeScrubbers:e}){j(this,`_attributeScrubbers`,void 0),this._attributeScrubbers=e}forceFlush(){return Promise.resolve(void 0)}onEnd(e){this._attributeScrubbers.forEach(t=>{let n=e.attributes[t.key];n&&typeof n==`string`&&(e.attributes[t.key]=t.scrub(n))})}onStart(){}shutdown(){return Promise.resolve(void 0)}},bd=class{constructor({userManager:e}){j(this,`_userManager`,void 0),this._userManager=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){this._userManager.getUserId()&&e.setAttributes({[io]:this._userManager.getUserId()})}shutdown(){return Promise.resolve(void 0)}},xd=class{constructor({userManager:e}){j(this,`_userManager`,void 0),this._userManager=e}forceFlush(){return Promise.resolve(void 0)}onEnd(e){let t=this._userManager.getUserId();t&&(e.attributes[io]=t)}onStart(){}shutdown(){return Promise.resolve(void 0)}},Sd=class extends An{inject(e,t,n){super.inject(e,t,n);let r=O.getSpan(e);if(r){let e=ke.get(t,`traceparent`);e&&r.setAttribute(`mxl.w3c_traceparent`,e)}}};let Cd=/\/\/(.+):(.+)@(.+)\//,wd=[`AWSAccessKeyId`,`Signature`,`sig`,"`X-Goog-Signature",`password`,`auth`,`pw`,`token`],Td=({value:e,queryParamRegex:t,scrubPath:n,scrubQuery:r})=>{let i=e;return n&&(i=i.replace(Cd,`//REDACTED:REDACTED@$3/`)),r&&(i=i.replaceAll(t,`$1$2=REDACTED`)),i},Ed=e=>{let t=[...wd,...e||[]],n=RegExp(`(^|&|\\?)(${t.join(`|`)})=[^&]+`,`g`);return[{key:N,scrub:e=>Td({value:e,queryParamRegex:n,scrubPath:!0,scrubQuery:!0})},{key:Xt,scrub:e=>Td({value:e,queryParamRegex:n,scrubPath:!0,scrubQuery:!0})},{key:`url.path`,scrub:e=>Td({value:e,queryParamRegex:n,scrubPath:!0,scrubQuery:!1})},{key:`url.query`,scrub:e=>Td({value:e,queryParamRegex:n,scrubPath:!1,scrubQuery:!0})}]},Dd=new class{constructor({diagLogger:e=E.createComponentLogger({namespace:`mxl-registry`})}={}){j(this,`_sdk`,null),j(this,`_diag`,void 0),j(this,`register`,e=>{this._sdk!==null&&this._diag.warn(`previously registered sdk will be overwritten`),this._sdk=e}),j(this,`clear`,()=>{this._sdk===null&&this._diag.warn(`sdk already cleared, this is a no-op`),this._sdk=null}),j(this,`registered`,()=>this._sdk),this._diag=e}},Od=(e={},{featureManager:t,logManager:n,spanSessionManager:r,mxlSpanProcessor:i,pageManager:a})=>{var o,s,c,l,u,d;let f=[new Rs(e[`session-on-load`]),new Hs(e[`session-visibility`],t,i),new Ls(e[`session-activity`]),new Bs(e[`session-timeout`])];(o=e.omit)!=null&&o.has(`exception`)||f.push(new go(e.exception)),(s=e.omit)!=null&&s.has(`click`)||f.push(new ho(e.click)),(c=e.omit)!=null&&c.has(`web-vital`)||f.push(new Ic(L(L({},e[`web-vital`]),{},{pageManager:a}))),(l=e.omit)!=null&&l.has(`document-load`)||f.push(new fo(e[`document-load`])),(u=e.omit)!=null&&u.has(`@opentelemetry/instrumentation-fetch`)||f.push(new rs(L(L({},e.network),e[`@opentelemetry/instrumentation-fetch`]))),(d=e.omit)!=null&&d.has(`@opentelemetry/instrumentation-xml-http-request`)||f.push(new vl(L(L({},e.network),e[`@opentelemetry/instrumentation-xml-http-request`]))),e[`empty-root`]&&f.push(new po(L({},e[`empty-root`])));for(let e of f)e instanceof G&&(r&&e.setSessionManager(r),n&&e.setLogManager(n));return f},kd=e=>{if(e!==void 0){if(typeof e!=`string`)throw Error(`appID must be a string, or omitted if not using MXL. Received ${String(e)}`);return e}},Ad=e=>{if(e===void 0){let e=`MXLAppVersionX.X.X`;return e===``?`unspecified`:e}if(typeof e!=`string`)throw Error(`if appVersion is specified, it must be a string. Received ${String(e)}`);let t=e.trim();if(t===``)throw Error(`if appVersion is specified, it cannot be an empty string.`);return t},jd=(e,t)=>{var n,r,i,a;if(!t.size)return e;let o=[...(n=e==null||(r=e.network)==null?void 0:r.ignoreUrls)==null?[]:n,...(i=e==null||(a=e[`@opentelemetry/instrumentation-fetch`])==null?void 0:a.ignoreUrls)==null?[]:i,...Array.from(t)];return o.length?L(L({},e),{},{network:L(L({},e==null?void 0:e.network),{},{ignoreUrls:o}),"@opentelemetry/instrumentation-fetch":(e==null?void 0:e[`@opentelemetry/instrumentation-fetch`])===void 0?void 0:L(L({},e[`@opentelemetry/instrumentation-fetch`]),{},{ignoreUrls:o})}):e},Md=({appID:e,appVersion:t,resource:n=zn(),spanExporters:r=[],logExporters:i=[],spanProcessors:a=[],propagator:o=null,defaultInstrumentationConfig:s,instrumentations:c=[],contextManager:l=null,logProcessors:u=[],attributeScrubbers:d=[],enableDefaultAttributeScrubbing:f=!0,additionalQueryParamsToScrub:p=[],logLevel:ee=h.ERROR,mxlDataURL:m,mxlConfigURL:te,diagLogger:g=E.createComponentLogger({namespace:`mxl-sdk`}),dynamicSDKConfigManager:ne,dynamicSDKConfig:re,registerGlobally:_=!0,blockNetworkSpanForwarding:ie=!1,restrictedProtocols:ae=new Set([`file:`]),useDocumentTitleAsPageLabel:oe=!0}={})=>{try{let h=new ra,ce=h.getNowMillis();if(_){let e=Dd.registered();if(e!==null)return g.warn(`SDK has already been successfully initialized, skipping this invocation of initSDK`),e}E.setLogger(new de,{logLevel:ee});let v=kd(e),le=Ad(t),y=v!==void 0;if(!y&&!i.length&&!r.length)throw Error(`when appID is omitted, at least one logExporter or spanExporter must be set`);if(ae.has(window.location.protocol))throw Error(`not initializing due to restricted protocol: ${window.location.protocol}`);if(y&&typeof CompressionStream>`u`)throw Error(`CompressionStream is not supported in this browser and required for data compression.`);let b=!_&&e,ue=b?new ta(e,window.localStorage):window.localStorage,x=b?new ta(e,window.sessionStorage):window.sessionStorage,fe=n.merge(ws({diagLogger:g,appVersion:le,pageSessionStorage:x})),S=Nd({registerGlobally:_,sdkLocalStorage:ue}),pe=S.getMXLUserId();if(y&&!pe)throw Error(`userID is required when using MXL exporter`);let me=ne==null?new fs({appID:v,appVersion:le,mxlConfigURL:te,defaultConfig:re,deviceId:pe,storage:ue}):ne;me.refreshRemoteConfig();let he=new ys({dynamicConfigManager:me,deviceId:pe,blockNetworkSpanForwarding:ie});if(!he.isSDKEnabled())return g.debug(`SDK is disabled, skipping initialization.`),!1;let ge=new Set;for(let e of[...r,...i])e&&typeof e.url==`string`&&ge.add(e.url);y&&v&&(ge.add(sd(v,m)),ge.add(id(v,m)));let _e=jd(s,ge),ve=na({featureManager:he,diag:g,registerGlobally:_,defaultInstrumentationConfig:_e,propagator:o}),ye=new hs(ps),be=[...f?Ed(p):[],...d],C=Pd({limitManager:ye,registerGlobally:_,sdkLocalStorage:ue,sdkSessionStorage:x}),xe,Se;if(y){var se;xe=new gd({resource:fe,exporter:new cd({appID:v,mxlDataURL:m,userID:pe}),limitManager:ye,storedSpansExpireTimeoutMS:s==null||(se=s[`session-visibility`])==null?void 0:se.storedSpansExpireTimeoutMS,storage:ue,spanSessionManager:C}),Se=new lu(new ad({appID:v,mxlDataURL:m,userID:pe}))}let Ce=Ld({useDocumentTitleAsPageLabel:oe,registerGlobally:_}),{tracerProvider:we,mxlTraceManager:Te}=Fd({resource:fe,spanSessionManager:C,userManager:S,spanExporters:r,spanProcessors:a,propagator:ve?new Sd:o,contextManager:l,attributeScrubbers:be,registerGlobally:_,mxlSpanProcessor:xe,pageManager:Ce});C.setTracerProvider(we);let{loggerProvider:Ee,mxlLogManager:De}=Id({resource:fe,userManager:S,logExporters:i,logProcessors:u,spanSessionManager:C,limitManager:ye,attributeScrubbers:be,registerGlobally:_,mxlLogProcessor:Se,sdkLocalStorage:ue,pageManager:Ce});Qa(_?{instrumentations:[Od(_e,{featureManager:he,mxlSpanProcessor:xe,pageManager:Ce}),...c]}:{tracerProvider:we,loggerProvider:Ee,instrumentations:[Od(_e,{featureManager:he,logManager:De,spanSessionManager:C,mxlSpanProcessor:xe,pageManager:Ce}),...c]}),g.info(`successfully initialized the SDK`);let Oe={setDynamicConfig:e=>{me.setConfig(e)},flush:function(){var e=P(function*(){yield we.forceFlush(),yield Ee.forceFlush()});return function(){return e.apply(this,arguments)}}(),log:De,trace:Te,session:C,user:S,page:Ce};return _&&Dd.register(Oe),C.recordSDKStartupDuration(h.getNowMillis()-ce),Oe}catch(e){let t=e instanceof Error?e.message:`Unknown error.`;return g.error(`failed to initialize the SDK: ${t}`),!1}},Nd=({registerGlobally:e,sdkLocalStorage:t})=>{let n=new Fs({storage:t});return e&&Ba.setGlobalUserManager(n),n},Pd=({limitManager:e,registerGlobally:t,sdkLocalStorage:n,sdkSessionStorage:r})=>{let i=new Os({limitManager:e,storage:n,sessionStorage:r});return t&&wa.setGlobalSessionManager(i),i},Fd=({resource:e,spanSessionManager:t,userManager:n,spanExporters:r,spanProcessors:i=[],propagator:a=null,contextManager:o=null,attributeScrubbers:s,registerGlobally:c,mxlSpanProcessor:l,pageManager:u})=>{let d=[...i,du(t),new pd,new xd({userManager:n}),new vd({pageManager:u}),new yd({attributeScrubbers:s})];r==null||r.forEach(e=>{d.push(new wi(e))}),l&&d.push(l);let f=new Hi({resource:e,spanProcessors:d,spanLimits:{attributeCountLimit:ps.maxAllowed.session_property*2,attributePerEventCountLimit:20,eventCountLimit:ps.maxAllowed.breadcrumb*2,attributeValueLengthLimit:1024}}),p=new ks({tracerProvider:c?void 0:f});return c&&(Ma.setGlobalTraceManager(p),f.register({contextManager:o||new zi,propagator:a})),{tracerProvider:f,mxlTraceManager:p}},Id=({resource:e,userManager:t,logExporters:n,logProcessors:r,spanSessionManager:i,limitManager:a,attributeScrubbers:o,registerGlobally:s,mxlLogProcessor:c,sdkLocalStorage:l,pageManager:u})=>{let d=[...r,new ld({spanSessionManager:i}),new dd,new bd({userManager:t}),new ud({attributeScrubbers:o}),new _d({pageManager:u})];n==null||n.forEach(e=>{d.push(new lu(e))}),c&&d.push(c);let f=new su({resource:e,processors:d}),p=new _s({spanSessionManager:i,limitManager:a,loggerProvider:s?void 0:f,storage:l});return s&&(Ya.setGlobalLoggerProvider(f),da.setGlobalLogManager(p)),{loggerProvider:f,mxlLogManager:p}},Ld=({useDocumentTitleAsPageLabel:e,registerGlobally:t})=>{let n=new vs({useDocumentTitleAsPageLabel:e});return t&&U.setGlobalPageManager(n),n};return Object.defineProperty(e,`DiagLogLevel`,{enumerable:!0,get:function(){return h}}),e.getNavigationInstrumentation=ss,e.initSDK=Md,e.log=da,e.page=U,e.session=wa,e.trace=Ma,e.user=Ba,e})({});
|
|
1
|
+
"use strict";window.MXLWebSdk=window.MXLWebSdk||(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{},n=`1.9.0`,r=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function i(e){var t=new Set([e]),n=new Set,i=e.match(r);if(!i)return function(){return!1};var a={major:+i[1],minor:+i[2],patch:+i[3],prerelease:i[4]};if(a.prerelease!=null)return function(t){return t===e};function o(e){return n.add(e),!1}function s(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(n.has(e))return!1;var i=e.match(r);if(!i)return o(e);var c={major:+i[1],minor:+i[2],patch:+i[3],prerelease:i[4]};return c.prerelease!=null||a.major!==c.major?o(e):a.major===0?a.minor===c.minor&&a.patch<=c.patch?s(e):o(e):a.minor<=c.minor?s(e):o(e)}}var a=i(n),o=n.split(`.`)[0],s=Symbol.for(`opentelemetry.js.api.`+o),c=t;function l(e,t,r,i){var a;i===void 0&&(i=!1);var o=c[s]=(a=c[s])==null?{version:n}:a;if(!i&&o[e]){var l=Error(`@opentelemetry/api: Attempted duplicate registration of API: `+e);return r.error(l.stack||l.message),!1}if(o.version!==n){var l=Error(`@opentelemetry/api: Registration of version v`+o.version+` for `+e+` does not match previously registered API v`+n);return r.error(l.stack||l.message),!1}return o[e]=t,r.debug(`@opentelemetry/api: Registered a global for `+e+` v`+n+`.`),!0}function u(e){var t,n,r=(t=c[s])==null?void 0:t.version;if(!(!r||!a(r)))return(n=c[s])==null?void 0:n[e]}function d(e,t){t.debug(`@opentelemetry/api: Unregistering a global for `+e+` v`+n+`.`);var r=c[s];r&&delete r[e]}var f=function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},p=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))},ee=function(){function e(e){this._namespace=e.namespace||`DiagComponentLogger`}return e.prototype.debug=function(){var e=[...arguments];return m(`debug`,this._namespace,e)},e.prototype.error=function(){var e=[...arguments];return m(`error`,this._namespace,e)},e.prototype.info=function(){var e=[...arguments];return m(`info`,this._namespace,e)},e.prototype.warn=function(){var e=[...arguments];return m(`warn`,this._namespace,e)},e.prototype.verbose=function(){var e=[...arguments];return m(`verbose`,this._namespace,e)},e}();function m(e,t,n){var r=u(`diag`);if(r)return n.unshift(t),r[e].apply(r,p([],f(n),!1))}var h;(function(e){e[e.NONE=0]=`NONE`,e[e.ERROR=30]=`ERROR`,e[e.WARN=50]=`WARN`,e[e.INFO=60]=`INFO`,e[e.DEBUG=70]=`DEBUG`,e[e.VERBOSE=80]=`VERBOSE`,e[e.ALL=9999]=`ALL`})(h||(h={}));function te(e,t){e<h.NONE?e=h.NONE:e>h.ALL&&(e=h.ALL),t=t||{};function n(n,r){var i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,h.ERROR),warn:n(`warn`,h.WARN),info:n(`info`,h.INFO),debug:n(`debug`,h.DEBUG),verbose:n(`verbose`,h.VERBOSE)}}var g=function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},ne=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))},re=`diag`,_=function(){function e(){function e(e){return function(){var t=[...arguments],n=u(`diag`);if(n)return n[e].apply(n,ne([],g(t),!1))}}var t=this;t.setLogger=function(e,n){var r,i,a;if(n===void 0&&(n={logLevel:h.INFO}),e===t){var o=Error(`Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation`);return t.error((r=o.stack)==null?o.message:r),!1}typeof n==`number`&&(n={logLevel:n});var s=u(`diag`),c=te((i=n.logLevel)==null?h.INFO:i,e);if(s&&!n.suppressOverrideMessage){var d=(a=Error().stack)==null?`<failed to generate stacktrace>`:a;s.warn(`Current logger will be overwritten from `+d),c.warn(`Current logger will overwrite one already registered from `+d)}return l(`diag`,c,t,!0)},t.disable=function(){d(re,t)},t.createComponentLogger=function(e){return new ee(e)},t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}return e.instance=function(){return this._instance||(this._instance=new e),this._instance},e}(),ie=function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},ae=function(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)},oe=function(){function e(e){this._entries=e?new Map(e):new Map}return e.prototype.getEntry=function(e){var t=this._entries.get(e);if(t)return Object.assign({},t)},e.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(e){var t=ie(e,2);return[t[0],t[1]]})},e.prototype.setEntry=function(t,n){var r=new e(this._entries);return r._entries.set(t,n),r},e.prototype.removeEntry=function(t){var n=new e(this._entries);return n._entries.delete(t),n},e.prototype.removeEntries=function(){for(var t,n,r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var a=new e(this._entries);try{for(var o=ae(r),s=o.next();!s.done;s=o.next()){var c=s.value;a._entries.delete(c)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return a},e.prototype.clear=function(){return new e},e}(),se=Symbol(`BaggageEntryMetadata`),ce=_.instance();function le(e){return e===void 0&&(e={}),new oe(new Map(Object.entries(e)))}function ue(e){return typeof e!=`string`&&(ce.error(`Cannot create baggage metadata from unknown type: `+typeof e),e=``),{__TYPE__:se,toString:function(){return e}}}function v(e){return Symbol.for(e)}var y=new(function(){function e(t){var n=this;n._currentContext=t?new Map(t):new Map,n.getValue=function(e){return n._currentContext.get(e)},n.setValue=function(t,r){var i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=function(t){var r=new e(n._currentContext);return r._currentContext.delete(t),r}}return e}()),b=[{n:`error`,c:`error`},{n:`warn`,c:`warn`},{n:`info`,c:`info`},{n:`debug`,c:`debug`},{n:`verbose`,c:`trace`}],de=function(){function e(){function e(e){return function(){var t=[...arguments];if(console){var n=console[e];if(typeof n!=`function`&&(n=console.log),typeof n==`function`)return n.apply(console,t)}}}for(var t=0;t<b.length;t++)this[b[t].n]=e(b[t].c)}return e}(),x=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),fe=function(){function e(){}return e.prototype.createGauge=function(e,t){return Se},e.prototype.createHistogram=function(e,t){return Ce},e.prototype.createCounter=function(e,t){return xe},e.prototype.createUpDownCounter=function(e,t){return we},e.prototype.createObservableGauge=function(e,t){return Ee},e.prototype.createObservableCounter=function(e,t){return Te},e.prototype.createObservableUpDownCounter=function(e,t){return De},e.prototype.addBatchObservableCallback=function(e,t){},e.prototype.removeBatchObservableCallback=function(e){},e}(),S=function(){function e(){}return e}(),pe=function(e){x(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.add=function(e,t){},t}(S),me=function(e){x(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.add=function(e,t){},t}(S),he=function(e){x(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.record=function(e,t){},t}(S),ge=function(e){x(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.record=function(e,t){},t}(S),_e=function(){function e(){}return e.prototype.addCallback=function(e){},e.prototype.removeCallback=function(e){},e}(),ve=function(e){x(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(_e),ye=function(e){x(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(_e),be=function(e){x(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(_e),C=new fe,xe=new pe,Se=new he,Ce=new ge,we=new me,Te=new ve,Ee=new ye,De=new be;function Oe(){return C}var ke={get:function(e,t){if(e!=null)return e[t]},keys:function(e){return e==null?[]:Object.keys(e)}},Ae={set:function(e,t,n){e!=null&&(e[t]=n)}},je=function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},Me=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))},Ne=function(){function e(){}return e.prototype.active=function(){return y},e.prototype.with=function(e,t,n){var r=[...arguments].slice(3);return t.call.apply(t,Me([n],je(r),!1))},e.prototype.bind=function(e,t){return t},e.prototype.enable=function(){return this},e.prototype.disable=function(){return this},e}(),Pe=function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},Fe=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))},Ie=`context`,Le=new Ne,Re=function(){function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalContextManager=function(e){return l(Ie,e,_.instance())},e.prototype.active=function(){return this._getContextManager().active()},e.prototype.with=function(e,t,n){for(var r,i=[],a=3;a<arguments.length;a++)i[a-3]=arguments[a];return(r=this._getContextManager()).with.apply(r,Fe([e,t,n],Pe(i),!1))},e.prototype.bind=function(e,t){return this._getContextManager().bind(e,t)},e.prototype._getContextManager=function(){return u(Ie)||Le},e.prototype.disable=function(){this._getContextManager().disable(),d(Ie,_.instance())},e}(),w;(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(w||(w={}));var ze=`0000000000000000`,Be=`00000000000000000000000000000000`,Ve={traceId:Be,spanId:ze,traceFlags:w.NONE},He=function(){function e(e){e===void 0&&(e=Ve),this._spanContext=e}return e.prototype.spanContext=function(){return this._spanContext},e.prototype.setAttribute=function(e,t){return this},e.prototype.setAttributes=function(e){return this},e.prototype.addEvent=function(e,t){return this},e.prototype.addLink=function(e){return this},e.prototype.addLinks=function(e){return this},e.prototype.setStatus=function(e){return this},e.prototype.updateName=function(e){return this},e.prototype.end=function(e){},e.prototype.isRecording=function(){return!1},e.prototype.recordException=function(e,t){},e}(),Ue=v(`OpenTelemetry Context Key SPAN`);function We(e){return e.getValue(Ue)||void 0}function Ge(){return We(Re.getInstance().active())}function Ke(e,t){return e.setValue(Ue,t)}function qe(e){return e.deleteValue(Ue)}function Je(e,t){return Ke(e,new He(t))}function Ye(e){var t;return(t=We(e))==null?void 0:t.spanContext()}var Xe=/^([0-9a-f]{32})$/i,Ze=/^[0-9a-f]{16}$/i;function Qe(e){return Xe.test(e)&&e!==Be}function $e(e){return Ze.test(e)&&e!==ze}function et(e){return Qe(e.traceId)&&$e(e.spanId)}function tt(e){return new He(e)}var nt=Re.getInstance(),rt=function(){function e(){}return e.prototype.startSpan=function(e,t,n){if(n===void 0&&(n=nt.active()),t!=null&&t.root)return new He;var r=n&&Ye(n);return it(r)&&et(r)?new He(r):new He},e.prototype.startActiveSpan=function(e,t,n,r){var i,a,o;if(!(arguments.length<2)){arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);var s=a==null?nt.active():a,c=this.startSpan(e,i,s),l=Ke(s,c);return nt.with(l,o,void 0,c)}},e}();function it(e){return typeof e==`object`&&typeof e.spanId==`string`&&typeof e.traceId==`string`&&typeof e.traceFlags==`number`}var at=new rt,ot=function(){function e(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}return e.prototype.startSpan=function(e,t,n){return this._getTracer().startSpan(e,t,n)},e.prototype.startActiveSpan=function(e,t,n,r){var i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)},e.prototype._getTracer=function(){if(this._delegate)return this._delegate;var e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):at},e}(),st=new(function(){function e(){}return e.prototype.getTracer=function(e,t,n){return new rt},e}()),ct=function(){function e(){}return e.prototype.getTracer=function(e,t,n){var r;return(r=this.getDelegateTracer(e,t,n))==null?new ot(this,e,t,n):r},e.prototype.getDelegate=function(){var e;return(e=this._delegate)==null?st:e},e.prototype.setDelegate=function(e){this._delegate=e},e.prototype.getDelegateTracer=function(e,t,n){var r;return(r=this._delegate)==null?void 0:r.getTracer(e,t,n)},e}(),lt;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(lt||(lt={}));var ut;(function(e){e[e.INTERNAL=0]=`INTERNAL`,e[e.SERVER=1]=`SERVER`,e[e.CLIENT=2]=`CLIENT`,e[e.PRODUCER=3]=`PRODUCER`,e[e.CONSUMER=4]=`CONSUMER`})(ut||(ut={}));var dt;(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(dt||(dt={}));var T=Re.getInstance(),E=_.instance(),ft=new(function(){function e(){}return e.prototype.getMeter=function(e,t,n){return C},e}()),pt=`metrics`,mt=function(){function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalMeterProvider=function(e){return l(pt,e,_.instance())},e.prototype.getMeterProvider=function(){return u(pt)||ft},e.prototype.getMeter=function(e,t,n){return this.getMeterProvider().getMeter(e,t,n)},e.prototype.disable=function(){d(pt,_.instance())},e}().getInstance(),ht=function(){function e(){}return e.prototype.inject=function(e,t){},e.prototype.extract=function(e,t){return e},e.prototype.fields=function(){return[]},e}(),gt=v(`OpenTelemetry Baggage Key`);function _t(e){return e.getValue(gt)||void 0}function vt(){return _t(Re.getInstance().active())}function yt(e,t){return e.setValue(gt,t)}function bt(e){return e.deleteValue(gt)}var xt=`propagation`,St=new ht,D=function(){function e(){this.createBaggage=le,this.getBaggage=_t,this.getActiveBaggage=vt,this.setBaggage=yt,this.deleteBaggage=bt}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalPropagator=function(e){return l(xt,e,_.instance())},e.prototype.inject=function(e,t,n){return n===void 0&&(n=Ae),this._getGlobalPropagator().inject(e,t,n)},e.prototype.extract=function(e,t,n){return n===void 0&&(n=ke),this._getGlobalPropagator().extract(e,t,n)},e.prototype.fields=function(){return this._getGlobalPropagator().fields()},e.prototype.disable=function(){d(xt,_.instance())},e.prototype._getGlobalPropagator=function(){return u(xt)||St},e}().getInstance(),Ct=`trace`,O=function(){function e(){this._proxyTracerProvider=new ct,this.wrapSpanContext=tt,this.isSpanContextValid=et,this.deleteSpan=qe,this.getSpan=We,this.getActiveSpan=Ge,this.getSpanContext=Ye,this.setSpan=Ke,this.setSpanContext=Je}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalTracerProvider=function(e){var t=l(Ct,this._proxyTracerProvider,_.instance());return t&&this._proxyTracerProvider.setDelegate(e),t},e.prototype.getTracerProvider=function(){return u(Ct)||this._proxyTracerProvider},e.prototype.getTracer=function(e,t){return this.getTracerProvider().getTracer(e,t)},e.prototype.disable=function(){d(Ct,_.instance()),this._proxyTracerProvider=new ct},e}().getInstance();let wt=({target:e,events:t,callback:n})=>{t.forEach(t=>{e.addEventListener(t,n)})},Tt=({target:e,events:t,callback:n})=>{t.forEach(t=>{e.removeEventListener(t,n)})};function Et(e,t,n,r=new Set){return new Proxy(e,{get(e,i,a){let o=Reflect.get(e,i,a);return typeof o!=`function`||r.has(i)?o:(...r)=>{try{return o.apply(e,r)}catch(e){let a=e instanceof Error?e.message:`Unknown error`;n.error(`${String(i)}: ${a}`);let o=t[i];return typeof o==`function`?o.apply(t,r):void 0}}}})}let Dt=new Uint8Array(16),Ot=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`).toUpperCase()),kt=()=>{crypto.getRandomValues(Dt);let e=``;for(let t=0;t<16;t++)e+=Ot[Dt[t]];return e},At=(e,t,n)=>{try{let n=e.getItem(t),r=n?parseInt(n,10):0;return r++,e.setItem(t,r.toString()),r}catch(e){return n.warn(`Failed to retrieve ${t} from storage: `,e),1}},k=`mxl.type`,jt=`mxl.state`,Mt=`mxl.properties.`,Nt=`mxl.js_file_bundle_ids`,Pt=`app.surface.name`,Ft=`app.surface.id`,It=`app.surface.label`,A=function(e){return e.Session=`ux.session`,e.Network=`perf.network_request`,e.Perf=`perf`,e.SystemLog=`sys.log`,e.SystemException=`sys.exception`,e.WebVital=`ux.web_vital`,e.ResourceFetch=`ux.resource_fetch`,e.DocumentLoad=`ux.document_load`,e.Surface=`ux.surface`,e}({}),Lt=function(e){return e.Foreground=`foreground`,e.Background=`background`,e}({}),Rt=function(e){return e.DeclarativeLegacy=`react_router_declarative_legacy`,e.Declarative=`react_router_declarative`,e.Data=`react_router_data`,e.Manual=`manual`,e}({}),zt=e=>e.visibilityState===`hidden`?Lt.Background:Lt.Foreground,Bt=globalThis,Vt=(e,t)=>!t||t<=0||t>100?!1:t>=Ht(e),Ht=e=>{if(e.length<6)return 0;let t=e.slice(-6),n=Math.pow(16,6)-1;return parseInt(t,16)/n*100},Ut=v(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function Wt(e){return e.setValue(Ut,!0)}function Gt(e){return e.getValue(Ut)===!0}function Kt(e){"@babel/helpers - typeof";return Kt=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Kt(e)}function qt(e,t){if(Kt(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Kt(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Jt(e){var t=qt(e,`string`);return Kt(t)==`symbol`?t:t+``}function j(e,t,n){return(t=Jt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let Yt=`http.method`,Xt=`http.url`,Zt=`http.status_code`,Qt=`error.type`,$t=`exception.message`,en=`exception.stacktrace`,M=`exception.type`,tn=`http.request.method`,nn=`http.request.method_original`,rn=`http.response.status_code`,an=`server.address`,on=`server.port`,sn=`service.name`,cn=`telemetry.sdk.language`,ln=`webjs`,un=`telemetry.sdk.name`,dn=`telemetry.sdk.version`,N=`url.full`,fn=`user_agent.original`,pn=Math.pow(10,6);function mn(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*pn)]}function hn(e){return e[0]*1e3+e[1]/1e6}var gn;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(gn||(gn={}));let _n=`[_0-9a-z-*/]`,vn=`[a-z]${_n}{0,255}`,yn=`[a-z0-9]${_n}{0,240}@[a-z]${_n}{0,13}`,bn=RegExp(`^(?:${vn}|${yn})$`),xn=/^[ -~]{0,255}[!-~]$/,Sn=/,|=/;function Cn(e){return bn.test(e)}function wn(e){return xn.test(e)&&!Sn.test(e)}var Tn=class e{constructor(e){j(this,`_internalState`,new Map),e&&this._parse(e)}set(e,t){let n=this._clone();return n._internalState.has(e)&&n._internalState.delete(e),n._internalState.set(e,t),n}unset(e){let t=this._clone();return t._internalState.delete(e),t}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,t)=>(e.push(t+`=`+this.get(t)),e),[]).join(`,`)}_parse(e){e.length>512||(this._internalState=e.split(`,`).reverse().reduce((e,t)=>{let n=t.trim(),r=n.indexOf(`=`);if(r!==-1){let i=n.slice(0,r),a=n.slice(r+1,t.length);Cn(i)&&wn(a)&&e.set(i,a)}return e},new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let t=new e;return t._internalState=new Map(this._internalState),t}};let En=`traceparent`,Dn=`tracestate`,On=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function kn(e){let t=On.exec(e);return!t||t[1]===`00`&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var An=class{inject(e,t,n){let r=O.getSpanContext(e);if(!r||Gt(e)||!et(r))return;let i=`00-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||w.NONE).toString(16)}`;n.set(t,En,i),r.traceState&&n.set(t,Dn,r.traceState.serialize())}extract(e,t,n){let r=n.get(t,En);if(!r)return e;let i=Array.isArray(r)?r[0]:r;if(typeof i!=`string`)return e;let a=kn(i);if(!a)return e;a.isRemote=!0;let o=n.get(t,Dn);if(o){let e=Array.isArray(o)?o.join(`,`):o;a.traceState=new Tn(typeof e==`string`?e:void 0)}return O.setSpanContext(e,a)}fields(){return[En,Dn]}},jn=class{constructor(){j(this,`_promise`,void 0),j(this,`_resolve`,void 0),j(this,`_reject`,void 0),this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}},Mn=class{constructor(e,t){j(this,`_isCalled`,!1),j(this,`_deferred`,new jn),j(this,`_callback`,void 0),j(this,`_that`,void 0),this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}};function Nn(e,t){return new Promise(n=>{T.with(Wt(T.active()),()=>{e.export(t,n)})})}let Pn={_export:Nn},Fn=e=>typeof e==`object`&&!!e&&typeof e.then==`function`;function In(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function P(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){In(a,r,i,o,s,`next`,e)}function s(e){In(a,r,i,o,s,`throw`,e)}o(void 0)})}}var Ln=class e{static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=Bn(t),r._asyncAttributesPending=t.filter(([e,t])=>Fn(t)).length>0,r}constructor(e,t){var n;j(this,`_rawAttributes`,void 0),j(this,`_asyncAttributesPending`,!1),j(this,`_schemaUrl`,void 0),j(this,`_memoizedAttributes`,void 0);let r=(n=e.attributes)==null?{}:n;this._rawAttributes=Object.entries(r).map(([e,t])=>(Fn(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=Bn(this._rawAttributes),this._schemaUrl=Vn(t==null?void 0:t.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}waitForAsyncAttributes(){var e=this;return P(function*(){if(e.asyncAttributesPending){for(let t=0;t<e._rawAttributes.length;t++){let[n,r]=e._rawAttributes[t];e._rawAttributes[t]=[n,Fn(r)?yield r:r]}e._asyncAttributesPending=!1}})()}get attributes(){if(this.asyncAttributesPending&&E.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(Fn(n)){E.debug(`Unsettled resource attribute ${t} skipped`);continue}n!=null&&(e[t]!=null||(e[t]=n))}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=Hn(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function Rn(e,t){return Ln.FromAttributeList(Object.entries(e),t)}function zn(){return Rn({})}function Bn(e){return e.map(([e,t])=>Fn(t)?[e,t.catch(t=>{E.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function Vn(e){if(typeof e==`string`||e===void 0)return e;E.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function Hn(e,t){let n=e==null?void 0:e.schemaUrl,r=t==null?void 0:t.schemaUrl,i=n===void 0||n===``,a=r===void 0||r===``;if(i)return r;if(a||n===r)return n;E.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}let Un=v(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function Wn(e){return e.setValue(Un,!0)}function Gn(e){return e.getValue(Un)===!0}let Kn=`baggage`;function qn(e){return e.reduce((e,t)=>{let n=`${e}${e===``?``:`,`}${t}`;return n.length>8192?e:n},``)}function Jn(e){return e.getAllEntries().map(([e,t])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(t.value)}`;return t.metadata!==void 0&&(n+=`;`+t.metadata.toString()),n})}function Yn(e){if(!e)return;let t=e.indexOf(`;`),n=t===-1?e:e.substring(0,t),r=n.indexOf(`=`);if(r<=0)return;let i=n.substring(0,r).trim(),a=n.substring(r+1).trim();if(!i||!a)return;let o,s;try{o=decodeURIComponent(i),s=decodeURIComponent(a)}catch(e){return}let c;return t!==-1&&t<e.length-1&&(c=ue(e.substring(t+1))),{key:o,value:s,metadata:c}}var Xn=class{inject(e,t,n){let r=D.getBaggage(e);if(!r||Gn(e))return;let i=qn(Jn(r).filter(e=>e.length<=4096).slice(0,180));i.length>0&&n.set(t,Kn,i)}extract(e,t,n){let r=n.get(t,Kn),i=Array.isArray(r)?r.join(`,`):r;if(!i)return e;let a={};return i.length===0||(i.split(`,`).forEach(e=>{let t=Yn(e);if(t){let e={value:t.value};t.metadata&&(e.metadata=t.metadata),a[t.key]=e}}),Object.entries(a).length===0)?e:D.setBaggage(e,D.createBaggage(a))}fields(){return[Kn]}};function Zn(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!Qn(n)){E.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!$n(r)){E.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function Qn(e){return typeof e==`string`&&e!==``}function $n(e){return e==null?!0:Array.isArray(e)?er(e):tr(typeof e)}function er(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(tr(e)){t=e;continue}return!1}return!1}}return!0}function tr(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}function nr(){return e=>{E.error(rr(e))}}function rr(e){return typeof e==`string`?e:JSON.stringify(ir(e))}function ir(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(e=>{if(t[e])return;let r=n[e];r&&(t[e]=String(r))}),n=Object.getPrototypeOf(n);return t}let ar=nr();function or(e){try{ar(e)}catch(e){}}let sr={[un]:`opentelemetry`,"process.runtime.name":`browser`,[cn]:ln,[dn]:`2.6.0`},cr=performance,lr=Math.pow(10,6),ur=Math.pow(10,9);function F(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*lr)]}function dr(e){return gr(F(cr.timeOrigin),F(typeof e==`number`?e:cr.now()))}function fr(e){if(mr(e))return e;if(typeof e==`number`)return e<cr.timeOrigin?dr(e):F(e);if(e instanceof Date)return F(e.getTime());throw TypeError(`Invalid input type`)}function pr(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=ur),[n,r]}function I(e){return e[0]*ur+e[1]}function mr(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function hr(e){return mr(e)||typeof e==`number`||e instanceof Date}function gr(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=ur&&(n[1]-=ur,n[0]+=1),n}var _r;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(_r||(_r={}));var vr=class{constructor(e={}){var t;j(this,`_propagators`,void 0),j(this,`_fields`,void 0),this._propagators=(t=e.propagators)==null?[]:t,this._fields=Array.from(new Set(this._propagators.map(e=>typeof e.fields==`function`?e.fields():[]).reduce((e,t)=>e.concat(t),[])))}inject(e,t,n){for(let r of this._propagators)try{r.inject(e,t,n)}catch(e){E.warn(`Failed to inject with ${r.constructor.name}. Err: ${e.message}`)}}extract(e,t,n){return this._propagators.reduce((e,r)=>{try{return r.extract(e,t,n)}catch(e){E.warn(`Failed to extract with ${r.constructor.name}. Err: ${e.message}`)}return e},e)}fields(){return this._fields.slice()}};let yr=`[_0-9a-z-*/]`,br=`[a-z]${yr}{0,255}`,xr=`[a-z0-9]${yr}{0,240}@[a-z]${yr}{0,13}`,Sr=RegExp(`^(?:${br}|${xr})$`),Cr=/^[ -~]{0,255}[!-~]$/,wr=/,|=/;function Tr(e){return Sr.test(e)}function Er(e){return Cr.test(e)&&!wr.test(e)}var Dr=class e{constructor(e){j(this,`_internalState`,new Map),e&&this._parse(e)}set(e,t){let n=this._clone();return n._internalState.has(e)&&n._internalState.delete(e),n._internalState.set(e,t),n}unset(e){let t=this._clone();return t._internalState.delete(e),t}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,t)=>(e.push(t+`=`+this.get(t)),e),[]).join(`,`)}_parse(e){e.length>512||(this._internalState=e.split(`,`).reverse().reduce((e,t)=>{let n=t.trim(),r=n.indexOf(`=`);if(r!==-1){let i=n.slice(0,r),a=n.slice(r+1,t.length);Tr(i)&&Er(a)&&e.set(i,a)}return e},new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let t=new e;return t._internalState=new Map(this._internalState),t}};let Or=`traceparent`,kr=`tracestate`,Ar=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function jr(e){let t=Ar.exec(e);return!t||t[1]===`00`&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var Mr=class{inject(e,t,n){let r=O.getSpanContext(e);if(!r||Gn(e)||!et(r))return;let i=`00-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||w.NONE).toString(16)}`;n.set(t,Or,i),r.traceState&&n.set(t,kr,r.traceState.serialize())}extract(e,t,n){let r=n.get(t,Or);if(!r)return e;let i=Array.isArray(r)?r[0]:r;if(typeof i!=`string`)return e;let a=jr(i);if(!a)return e;a.isRemote=!0;let o=n.get(t,kr);if(o){let e=Array.isArray(o)?o.join(`,`):o;a.traceState=new Dr(typeof e==`string`?e:void 0)}return O.setSpanContext(e,a)}fields(){return[Or,kr]}};let Nr=Function.prototype.toString,Pr=Nr.call(Object),Fr=Object.getPrototypeOf,Ir=Object.prototype,Lr=Ir.hasOwnProperty,Rr=Symbol?Symbol.toStringTag:void 0,zr=Ir.toString;function Br(e){if(!Vr(e)||Hr(e)!==`[object Object]`)return!1;let t=Fr(e);if(t===null)return!0;let n=Lr.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&Nr.call(n)===Pr}function Vr(e){return typeof e==`object`&&!!e}function Hr(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Rr&&Rr in Object(e)?Ur(e):Wr(e)}function Ur(e){let t=Lr.call(e,Rr),n=e[Rr],r=!1;try{e[Rr]=void 0,r=!0}catch(e){}let i=zr.call(e);return r&&(t?e[Rr]=n:delete e[Rr]),i}function Wr(e){return zr.call(e)}function Gr(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=qr(t,e.shift(),0,n);return t}function Kr(e){return Yr(e)?e.slice():e}function qr(e,t,n=0,r){let i;if(!(n>20)){if(n++,Qr(e)||Qr(t)||Xr(t))i=Kr(t);else if(Yr(e)){if(i=e.slice(),Yr(t))for(let e=0,n=t.length;e<n;e++)i.push(Kr(t[e]));else if(Zr(t)){let e=Object.keys(t);for(let n=0,r=e.length;n<r;n++){let r=e[n];i[r]=Kr(t[r])}}}else if(Zr(e))if(Zr(t)){if(!$r(e,t))return t;i=Object.assign({},e);let a=Object.keys(t);for(let o=0,s=a.length;o<s;o++){let s=a[o],c=t[s];if(Qr(c))c===void 0?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(Jr(e,s,r)||Jr(t,s,r))delete i[s];else{if(Zr(a)&&Zr(o)){let n=r.get(a)||[],i=r.get(o)||[];n.push({obj:e,key:s}),i.push({obj:t,key:s}),r.set(a,n),r.set(o,i)}i[s]=qr(i[s],c,n,r)}}}}else i=t;return i}}function Jr(e,t,n){let r=n.get(e[t])||[];for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i.key===t&&i.obj===e)return!0}return!1}function Yr(e){return Array.isArray(e)}function Xr(e){return typeof e==`function`}function Zr(e){return!Qr(e)&&!Yr(e)&&!Xr(e)&&typeof e==`object`}function Qr(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function $r(e,t){return!(!Br(e)||!Br(t))}function ei(e,t){return typeof t==`string`?e===t:!!e.match(t)}var ti=class{constructor(){j(this,`_promise`,void 0),j(this,`_resolve`,void 0),j(this,`_reject`,void 0),this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}},ni=class{constructor(e,t){j(this,`_isCalled`,!1),j(this,`_deferred`,new ti),j(this,`_callback`,void 0),j(this,`_that`,void 0),this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}};let ri;function ii(){if(ri===void 0)try{let e=globalThis.process.argv0;ri=e?`unknown_service:${e}`:`unknown_service`}catch(e){ri=`unknown_service`}return ri}let ai=e=>typeof e==`object`&&!!e&&typeof e.then==`function`;var oi=class e{static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=li(t),r._asyncAttributesPending=t.filter(([e,t])=>ai(t)).length>0,r}constructor(e,t){var n;j(this,`_rawAttributes`,void 0),j(this,`_asyncAttributesPending`,!1),j(this,`_schemaUrl`,void 0),j(this,`_memoizedAttributes`,void 0);let r=(n=e.attributes)==null?{}:n;this._rawAttributes=Object.entries(r).map(([e,t])=>(ai(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=li(this._rawAttributes),this._schemaUrl=ui(t==null?void 0:t.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}waitForAsyncAttributes(){var e=this;return P(function*(){if(e.asyncAttributesPending){for(let t=0;t<e._rawAttributes.length;t++){let[n,r]=e._rawAttributes[t];e._rawAttributes[t]=[n,ai(r)?yield r:r]}e._asyncAttributesPending=!1}})()}get attributes(){if(this.asyncAttributesPending&&E.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(ai(n)){E.debug(`Unsettled resource attribute ${t} skipped`);continue}n!=null&&(e[t]!=null||(e[t]=n))}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=di(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function si(e,t){return oi.FromAttributeList(Object.entries(e),t)}function ci(){return si({[sn]:ii(),[cn]:sr[cn],[un]:sr[un],[dn]:sr[dn]})}function li(e){return e.map(([e,t])=>ai(t)?[e,t.catch(t=>{E.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function ui(e){if(typeof e==`string`||e===void 0)return e;E.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function di(e,t){let n=e==null?void 0:e.schemaUrl,r=t==null?void 0:t.schemaUrl,i=n===void 0||n===``,a=r===void 0||r===``;if(i)return r;if(a||n===r)return n;E.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}function fi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function L(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?fi(Object(n),!0).forEach(function(t){j(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var pi=class{constructor(e){var t;j(this,`_spanContext`,void 0),j(this,`kind`,void 0),j(this,`parentSpanContext`,void 0),j(this,`attributes`,{}),j(this,`links`,[]),j(this,`events`,[]),j(this,`startTime`,void 0),j(this,`resource`,void 0),j(this,`instrumentationScope`,void 0),j(this,`_droppedAttributesCount`,0),j(this,`_droppedEventsCount`,0),j(this,`_droppedLinksCount`,0),j(this,`_attributesCount`,0),j(this,`name`,void 0),j(this,`status`,{code:dt.UNSET}),j(this,`endTime`,[0,0]),j(this,`_ended`,!1),j(this,`_duration`,[-1,-1]),j(this,`_spanProcessor`,void 0),j(this,`_spanLimits`,void 0),j(this,`_attributeValueLengthLimit`,void 0),j(this,`_recordEndMetrics`,void 0),j(this,`_performanceStartTime`,void 0),j(this,`_performanceOffset`,void 0),j(this,`_startTimeProvided`,void 0);let n=Date.now();this._spanContext=e.spanContext,this._performanceStartTime=cr.now(),this._performanceOffset=n-(this._performanceStartTime+cr.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit||0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,this.links=e.links||[],this.startTime=this._getTime((t=e.startTime)==null?n:t),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(t==null||this._isSpanEnded())return this;if(e.length===0)return E.warn(`Invalid attribute key: ${e}`),this;if(!$n(t))return E.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:n}=this._spanLimits,r=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n!==void 0&&this._attributesCount>=n&&r?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(t),r&&this._attributesCount++,this)}setAttributes(e){for(let[t,n]of Object.entries(e))this.setAttribute(t,n);return this}addEvent(e,t,n){if(this._isSpanEnded())return this;let{eventCountLimit:r}=this._spanLimits;if(r===0)return E.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&E.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),hr(t)&&(hr(n)||(n=t),t=void 0);let i=Zn(t);return this.events.push({name:e,attributes:i,time:this._getTime(n),droppedAttributesCount:0}),this}addLink(e){return this.links.push(e),this}addLinks(e){return this.links.push(...e),this}setStatus(e){return this._isSpanEnded()?this:(this.status=L({},e),this.status.message!=null&&typeof e.message!=`string`&&(E.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`),delete this.status.message),this)}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){var t;if(this._isSpanEnded()){E.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=pr(this.startTime,this.endTime),this._duration[0]<0&&(E.warn(`Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.`,this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&E.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),(t=this._recordEndMetrics)==null||t.call(this),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e==`number`&&e<=cr.now())return dr(e+this._performanceOffset);if(typeof e==`number`)return F(e);if(e instanceof Date)return F(e.getTime());if(mr(e))return e;if(this._startTimeProvided)return F(Date.now());let t=cr.now()-this._performanceStartTime;return gr(this.startTime,F(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[$t]=e:e&&(e.code?n[M]=e.code.toString():e.name&&(n[M]=e.name),e.message&&(n[$t]=e.message),e.stack&&(n[en]=e.stack)),n[M]||n[$t]?this.addEvent(`exception`,n,t):E.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let e=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);E.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(E.warn(`Attribute value limit must be positive, got ${t}`),e):typeof e==`string`?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>typeof e==`string`?this._truncateToLimitUtil(e,t):e):e}},R;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(R||(R={}));var mi=class{shouldSample(){return{decision:R.NOT_RECORD}}toString(){return`AlwaysOffSampler`}},hi=class{shouldSample(){return{decision:R.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}},gi=class{constructor(e){var t,n,r,i;j(this,`_root`,void 0),j(this,`_remoteParentSampled`,void 0),j(this,`_remoteParentNotSampled`,void 0),j(this,`_localParentSampled`,void 0),j(this,`_localParentNotSampled`,void 0),this._root=e.root,this._root||(or(Error(`ParentBasedSampler must have a root sampler configured`)),this._root=new hi),this._remoteParentSampled=(t=e.remoteParentSampled)==null?new hi:t,this._remoteParentNotSampled=(n=e.remoteParentNotSampled)==null?new mi:n,this._localParentSampled=(r=e.localParentSampled)==null?new hi:r,this._localParentNotSampled=(i=e.localParentNotSampled)==null?new mi:i}shouldSample(e,t,n,r,i,a){let o=O.getSpanContext(e);return!o||!et(o)?this._root.shouldSample(e,t,n,r,i,a):o.isRemote?o.traceFlags&w.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,a):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,a):o.traceFlags&w.SAMPLED?this._localParentSampled.shouldSample(e,t,n,r,i,a):this._localParentNotSampled.shouldSample(e,t,n,r,i,a)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}},_i=class{constructor(e=0){j(this,`_ratio`,void 0),j(this,`_upperBound`,void 0),this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:Qe(t)&&this._accumulate(t)<this._upperBound?R.RECORD_AND_SAMPLED:R.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!=`number`||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let t=0;for(let n=0;n<e.length/8;n++){let r=n*8,i=parseInt(e.slice(r,r+8),16);t=(t^i)>>>0}return t}},z;(function(e){e.AlwaysOff=`always_off`,e.AlwaysOn=`always_on`,e.ParentBasedAlwaysOff=`parentbased_always_off`,e.ParentBasedAlwaysOn=`parentbased_always_on`,e.ParentBasedTraceIdRatio=`parentbased_traceidratio`,e.TraceIdRatio=`traceidratio`})(z||(z={}));function vi(){var e,t,n,r,i,a,o,s;return{sampler:yi(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:(e=void 0)==null?1/0:e,attributeCountLimit:(t=void 0)==null?128:t},spanLimits:{attributeValueLengthLimit:(n=void 0)==null?1/0:n,attributeCountLimit:(r=void 0)==null?128:r,linkCountLimit:(i=void 0)==null?128:i,eventCountLimit:(a=void 0)==null?128:a,attributePerEventCountLimit:(o=void 0)==null?128:o,attributePerLinkCountLimit:(s=void 0)==null?128:s}}}function yi(){var e;let t=(e=void 0)==null?z.ParentBasedAlwaysOn:e;switch(t){case z.AlwaysOn:return new hi;case z.AlwaysOff:return new mi;case z.ParentBasedAlwaysOn:return new gi({root:new hi});case z.ParentBasedAlwaysOff:return new gi({root:new mi});case z.TraceIdRatio:return new _i(bi());case z.ParentBasedTraceIdRatio:return new gi({root:new _i(bi())});default:return E.error(`OTEL_TRACES_SAMPLER value "${t}" invalid, defaulting to "${z.ParentBasedAlwaysOn}".`),new gi({root:new hi})}}function bi(){return E.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to 1.`),1}function xi(e){let t={sampler:yi()},n=vi(),r=Object.assign({},n,t,e);return r.generalLimits=Object.assign({},n.generalLimits,e.generalLimits||{}),r.spanLimits=Object.assign({},n.spanLimits,e.spanLimits||{}),r}function Si(e){var t,n,r,i,a,o,s,c,l,u,d,f;let p=Object.assign({},e.spanLimits);return p.attributeCountLimit=(t=(n=(r=(i=(a=e.spanLimits)==null?void 0:a.attributeCountLimit)==null?(o=e.generalLimits)==null?void 0:o.attributeCountLimit:i)==null?void 0:r)==null?void 0:n)==null?128:t,p.attributeValueLengthLimit=(s=(c=(l=(u=(d=e.spanLimits)==null?void 0:d.attributeValueLengthLimit)==null?(f=e.generalLimits)==null?void 0:f.attributeValueLengthLimit:u)==null?void 0:l)==null?void 0:c)==null?1/0:s,Object.assign({},e,{spanLimits:p})}var Ci=class{constructor(e,t){var n,r,i,a;j(this,`_maxExportBatchSize`,void 0),j(this,`_maxQueueSize`,void 0),j(this,`_scheduledDelayMillis`,void 0),j(this,`_exportTimeoutMillis`,void 0),j(this,`_exporter`,void 0),j(this,`_isExporting`,!1),j(this,`_finishedSpans`,[]),j(this,`_timer`,void 0),j(this,`_shutdownOnce`,void 0),j(this,`_droppedSpansCount`,0),this._exporter=e,this._maxExportBatchSize=typeof(t==null?void 0:t.maxExportBatchSize)==`number`?t.maxExportBatchSize:(n=void 0)==null?512:n,this._maxQueueSize=typeof(t==null?void 0:t.maxQueueSize)==`number`?t.maxQueueSize:(r=void 0)==null?2048:r,this._scheduledDelayMillis=typeof(t==null?void 0:t.scheduledDelayMillis)==`number`?t.scheduledDelayMillis:(i=void 0)==null?5e3:i,this._exportTimeoutMillis=typeof(t==null?void 0:t.exportTimeoutMillis)==`number`?t.exportTimeoutMillis:(a=void 0)==null?3e4:a,this._shutdownOnce=new ni(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(E.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&w.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&E.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(E.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,t)=>{let n=[],r=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let e=0,t=r;e<t;e++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,t)=>{let n=setTimeout(()=>{t(Error(`Timeout`))},this._exportTimeoutMillis);T.with(Wn(T.active()),()=>{let r;this._finishedSpans.length<=this._maxExportBatchSize?(r=this._finishedSpans,this._finishedSpans=[]):r=this._finishedSpans.splice(0,this._maxExportBatchSize);let i=()=>this._exporter.export(r,r=>{if(clearTimeout(n),r.code===_r.SUCCESS)e();else{var i;t((i=r.error)==null?Error(`BatchSpanProcessor: span export failed`):i)}}),a=null;for(let e=0,t=r.length;e<t;e++){let t=r[e];t.resource.asyncAttributesPending&&t.resource.waitForAsyncAttributes&&(a!=null||(a=[]),a.push(t.resource.waitForAsyncAttributes()))}a===null?i():Promise.all(a).then(i,e=>{or(e),t(e)})})})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,or(e)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}},wi=class extends Ci{constructor(e,t){super(e,t),j(this,`_visibilityChangeListener`,void 0),j(this,`_pageHideListener`,void 0),this.onInit(t)}onInit(e){(e==null?void 0:e.disableAutoFlushOnDocumentHide)!==!0&&typeof document<`u`&&(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush().catch(e=>{or(e)})},this._pageHideListener=()=>{this.forceFlush().catch(e=>{or(e)})},document.addEventListener(`visibilitychange`,this._visibilityChangeListener),document.addEventListener(`pagehide`,this._pageHideListener))}onShutdown(){typeof document<`u`&&(this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener(`pagehide`,this._pageHideListener))}};let Ti=new Uint8Array(16),Ei=new Uint8Array(8),Di=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function Oi(e){for(let t=0;t<e.length;t++)e[t]=Math.random()*256>>>0;for(let t=0;t<e.length;t++)if(e[t]>0)return;e[e.length-1]=1}function ki(e){let t=``;for(let n=0;n<e.length;n++)t+=Di[e[n]];return t}var Ai=class{generateTraceId(){return Oi(Ti),ki(Ti)}generateSpanId(){return Oi(Ei),ki(Ei)}};let ji=`otel.span.sampling_result`;var Mi=class{constructor(e){j(this,`startedSpans`,void 0),j(this,`liveSpans`,void 0),this.startedSpans=e.createCounter(`otel.sdk.span.started`,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(`otel.sdk.span.live`,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=Pi(t);if(this.startedSpans.add(1,{"otel.span.parent.origin":Ni(e),[ji]:n}),t===R.NOT_RECORD)return()=>{};let r={[ji]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}};function Ni(e){return e?e.isRemote?`remote`:`local`:`none`}function Pi(e){switch(e){case R.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case R.RECORD:return`RECORD_ONLY`;case R.NOT_RECORD:return`DROP`}}var Fi=class{constructor(e,t,n,r){j(this,`_sampler`,void 0),j(this,`_generalLimits`,void 0),j(this,`_spanLimits`,void 0),j(this,`_idGenerator`,void 0),j(this,`instrumentationScope`,void 0),j(this,`_resource`,void 0),j(this,`_spanProcessor`,void 0),j(this,`_tracerMetrics`,void 0);let i=xi(t);this._sampler=i.sampler,this._generalLimits=i.generalLimits,this._spanLimits=i.spanLimits,this._idGenerator=t.idGenerator||new Ai,this._resource=n,this._spanProcessor=r,this.instrumentationScope=e,this._tracerMetrics=new Mi(i.meterProvider?i.meterProvider.getMeter(`@opentelemetry/sdk-trace`,`2.6.0`):Oe())}startSpan(e,t={},n=T.active()){var r,i,a;t.root&&(n=O.deleteSpan(n));let o=O.getSpan(n);if(Gn(n))return E.debug(`Instrumentation suppressed, returning Noop Span`),O.wrapSpanContext(Ve);let s=o==null?void 0:o.spanContext(),c=this._idGenerator.generateSpanId(),l,u,d;!s||!O.isSpanContextValid(s)?u=this._idGenerator.generateTraceId():(u=s.traceId,d=s.traceState,l=s);let f=(r=t.kind)==null?ut.INTERNAL:r,p=((i=t.links)==null?[]:i).map(e=>({context:e.context,attributes:Zn(e.attributes)})),ee=Zn(t.attributes),m=this._sampler.shouldSample(n,u,e,f,ee,p),h=this._tracerMetrics.startSpan(s,m.decision);d=(a=m.traceState)==null?d:a;let te=m.decision===lt.RECORD_AND_SAMPLED?w.SAMPLED:w.NONE,g={traceId:u,spanId:c,traceFlags:te,traceState:d};if(m.decision===lt.NOT_RECORD)return E.debug(`Recording is off, propagating context in a non-recording span`),O.wrapSpanContext(g);let ne=Zn(Object.assign(ee,m.attributes));return new pi({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:g,name:e,kind:f,links:p,parentSpanContext:l,attributes:ne,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:h})}startActiveSpan(e,t,n,r){var i;let a,o,s;if(arguments.length<2)return;arguments.length===2?s=t:arguments.length===3?(a=t,s=n):(a=t,o=n,s=r);let c=(i=o)==null?T.active():i,l=this.startSpan(e,a,c),u=O.setSpan(c,l);return T.with(u,s,void 0,l)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}},Ii=class{constructor(e){j(this,`_spanProcessors`,void 0),this._spanProcessors=e}forceFlush(){let e=[];for(let t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(e=>{or(e||Error(`MultiSpanProcessor: forceFlush failed`)),t()})})}onStart(e,t){for(let n of this._spanProcessors)n.onStart(e,t)}onEnding(e){for(let t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(let t of this._spanProcessors)t.onEnd(e)}shutdown(){let e=[];for(let t of this._spanProcessors)e.push(t.shutdown());return new Promise((t,n)=>{Promise.all(e).then(()=>{t()},n)})}},Li;(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(Li||(Li={}));var Ri=class{constructor(e={}){var t,n;j(this,`_config`,void 0),j(this,`_tracers`,new Map),j(this,`_resource`,void 0),j(this,`_activeSpanProcessor`,void 0);let r=Gr({},vi(),Si(e));this._resource=(t=r.resource)==null?ci():t,this._config=Object.assign({},r,{resource:this._resource});let i=[];(n=e.spanProcessors)!=null&&n.length&&i.push(...e.spanProcessors),this._activeSpanProcessor=new Ii(i)}getTracer(e,t,n){let r=`${e}@${t||``}:${(n==null?void 0:n.schemaUrl)||``}`;return this._tracers.has(r)||this._tracers.set(r,new Fi({name:e,version:t,schemaUrl:n==null?void 0:n.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(r)}forceFlush(){let e=this._config.forceFlushTimeoutMillis,t=this._activeSpanProcessor._spanProcessors.map(t=>new Promise(n=>{let r,i=setTimeout(()=>{n(Error(`Span processor did not completed within timeout period of ${e} ms`)),r=Li.timeout},e);t.forceFlush().then(()=>{clearTimeout(i),r!==Li.timeout&&(r=Li.resolved,n(r))}).catch(e=>{clearTimeout(i),r=Li.error,n(e)})}));return new Promise((e,n)=>{Promise.all(t).then(t=>{let r=t.filter(e=>e!==Li.resolved);r.length>0?n(r):e()}).catch(e=>n([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}},zi=class{constructor(){j(this,`_enabled`,!1),j(this,`_currentContext`,y)}_bindFunction(e=y,t){let n=this,r=function(...r){return n.with(e,()=>t.apply(this,r))};return Object.defineProperty(r,`length`,{enumerable:!1,configurable:!0,writable:!1,value:t.length}),r}active(){return this._currentContext}bind(e,t){return e===void 0&&(e=this.active()),typeof t==`function`?this._bindFunction(e,t):t}disable(){return this._currentContext=y,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=y,this)}with(e,t,n,...r){let i=this._currentContext;this._currentContext=e||y;try{return t.call(n,...r)}finally{this._currentContext=i}}};function Bi(e){if(e!==null){if(e===void 0){let e=new zi;e.enable(),T.setGlobalContextManager(e);return}e.enable(),T.setGlobalContextManager(e)}}function Vi(e){if(e!==null){if(e===void 0){D.setGlobalPropagator(new vr({propagators:[new Mr,new Xn]}));return}D.setGlobalPropagator(e)}}var Hi=class extends Ri{constructor(e={}){super(e)}register(e={}){O.setGlobalTracerProvider(this),Vi(e.propagator),Bi(e.contextManager)}},B;(function(e){e.CONNECT_END=`connectEnd`,e.CONNECT_START=`connectStart`,e.DECODED_BODY_SIZE=`decodedBodySize`,e.DOM_COMPLETE=`domComplete`,e.DOM_CONTENT_LOADED_EVENT_END=`domContentLoadedEventEnd`,e.DOM_CONTENT_LOADED_EVENT_START=`domContentLoadedEventStart`,e.DOM_INTERACTIVE=`domInteractive`,e.DOMAIN_LOOKUP_END=`domainLookupEnd`,e.DOMAIN_LOOKUP_START=`domainLookupStart`,e.ENCODED_BODY_SIZE=`encodedBodySize`,e.FETCH_START=`fetchStart`,e.LOAD_EVENT_END=`loadEventEnd`,e.LOAD_EVENT_START=`loadEventStart`,e.NAVIGATION_START=`navigationStart`,e.REDIRECT_END=`redirectEnd`,e.REDIRECT_START=`redirectStart`,e.REQUEST_START=`requestStart`,e.RESPONSE_END=`responseEnd`,e.RESPONSE_START=`responseStart`,e.SECURE_CONNECTION_START=`secureConnectionStart`,e.START_TIME=`startTime`,e.UNLOAD_EVENT_END=`unloadEventEnd`,e.UNLOAD_EVENT_START=`unloadEventStart`})(B||(B={}));let Ui;function Wi(){return Ui||(Ui=document.createElement(`a`)),Ui}function Gi(e,t){return t in e}function V(e,t,n,r=!0){if(Gi(n,t)&&typeof n[t]==`number`&&!(r&&n[t]===0))return e.addEvent(t,n[t])}function Ki(e,t,n=!1,r,i){if(r===void 0&&(r=t[B.START_TIME]!==0),n||(V(e,B.FETCH_START,t,r),V(e,B.DOMAIN_LOOKUP_START,t,r),V(e,B.DOMAIN_LOOKUP_END,t,r),V(e,B.CONNECT_START,t,r),V(e,B.SECURE_CONNECTION_START,t,r),V(e,B.CONNECT_END,t,r),V(e,B.REQUEST_START,t,r),V(e,B.RESPONSE_START,t,r),V(e,B.RESPONSE_END,t,r)),!i){let n=t[B.ENCODED_BODY_SIZE];n!==void 0&&e.setAttribute(`http.response_content_length`,n);let r=t[B.DECODED_BODY_SIZE];r!==void 0&&n!==r&&e.setAttribute(`http.response_content_length_uncompressed`,r)}}function qi(e){return e.slice().sort((e,t)=>{let n=e[B.FETCH_START],r=t[B.FETCH_START];return n>r?1:n<r?-1:0})}function Ji(){return typeof location<`u`?location.origin:void 0}function Yi(e,t,n,r,i=new WeakSet,a){let o=H(e);e=o.toString();let s=Zi(e,t,n,r,i,a);if(s.length===0)return{mainRequest:void 0};if(s.length===1)return{mainRequest:s[0]};let c=qi(s);if(o.origin!==Ji()&&c.length>1){let e=c[0],t=Xi(c,e[B.RESPONSE_END],n),r=e[B.RESPONSE_END];return t[B.FETCH_START]<r&&(t=e,e=void 0),{corsPreFlightRequest:e,mainRequest:t}}else return{mainRequest:s[0]}}function Xi(e,t,n){let r=I(n),i=I(fr(t)),a=e[1],o,s=e.length;for(let t=1;t<s;t++){let n=e[t],s=I(fr(n[B.FETCH_START])),c=r-I(fr(n[B.RESPONSE_END]));s>=i&&(!o||c<o)&&(o=c,a=n)}return a}function Zi(e,t,n,r,i,a){let o=I(t),s=I(n),c=r.filter(t=>{let n=I(fr(t[B.FETCH_START])),r=I(fr(t[B.RESPONSE_END]));return t.initiatorType.toLowerCase()===(a||`xmlhttprequest`)&&t.name===e&&n>=o&&r<=s});return c.length>0&&(c=c.filter(e=>!i.has(e))),c}function H(e){if(typeof URL==`function`)return new URL(e,typeof document<`u`?document.baseURI:typeof location<`u`?location.href:void 0);let t=Wi();return t.href=e,t}function Qi(e,t){let n=t||[];return(typeof n==`string`||n instanceof RegExp)&&(n=[n]),H(e).origin===Ji()?!0:n.some(t=>ei(e,t))}let $i=`mxl_pending_`;var ea=class{constructor({resource:e=zn(),storage:t=window.localStorage,diag:n=E.createComponentLogger({namespace:`MXLSpanStorage`}),storedSpansExpireTimeoutMS:r=3600*1e3,onExpiredSpansExport:i,spanSessionManager:a}){j(this,`_noExportTracer`,void 0),j(this,`_storage`,void 0),j(this,`_diag`,void 0),j(this,`_onExpiredSpansExport`,void 0),j(this,`_storedSpansExpireTimeoutMS`,void 0),j(this,`_spanSessionManager`,void 0),j(this,`_checkExpiredSpansInterval`,void 0),this._noExportTracer=new Ri({resource:e}).getTracer(`mxl-web-sdk-sessions`),this._storage=t,this._diag=n,this._storedSpansExpireTimeoutMS=r,this._onExpiredSpansExport=i,this._spanSessionManager=a,this.startExpiredSpansCheck()}storePendingSpans(e,t,n){try{if(this.clearStoredSpans(e),this._getPendingSpansKeys().length>=10){this._spanSessionManager.incrSessionCountForKey(`mxl.max_pending_spans_reached`),this._diag.warn(`Not storing pending spans as the max number of items was reached`);return}let r=`${$i}${e}_${Date.now()}`;this._storage.setItem(r,JSON.stringify([t,...n],(e,t)=>e.startsWith(`_`)?void 0:t)),this._diag.debug(`Stored pending span: ${r}`)}catch(e){this._diag.error(`Failed to store spans to storage:`,e)}}clearStoredSpans(e){try{let t=`${$i}${e}_`;this._getPendingSpansKeys().forEach(e=>{e.startsWith(t)&&this._storage.removeItem(e)})}catch(e){this._diag.error(`Failed to clear stored spans from storage:`,e)}}startExpiredSpansCheck(){this._checkExpiredSpansInterval=setInterval(()=>{this.checkAndExportExpiredSpans()},300*1e3)}stopExpiredSpansCheck(){this._checkExpiredSpansInterval&&(clearInterval(this._checkExpiredSpansInterval),this._checkExpiredSpansInterval=void 0)}checkAndExportExpiredSpans(){try{let e=this._getPendingSpansKeys();if(e.length===0)return;let t=Date.now();e.forEach(e=>{let n=e.split(`_`),r=parseInt(n[n.length-1],10);if(Number.isNaN(r)&&(this._diag.error(`Found invalid timestamp in stored span:`,r),this._storage.removeItem(e)),t-r<=this._storedSpansExpireTimeoutMS)return;let i=this._storage.getItem(e);if(i){try{let e=[];for(let t of JSON.parse(i)){let n=this._noExportTracer.startSpan(t.name,{kind:t.kind,attributes:t.attributes,links:t.links,startTime:t.startTime});n.setStatus(t.status),n.end(t.endTime),e.push(n)}this._onExpiredSpansExport&&e.length>0&&this._onExpiredSpansExport(e)}catch(e){this._diag.error(`Failed to process expired spans:`,e)}this._storage.removeItem(e)}})}catch(e){this._diag.error(`Failed to check and export expired spans:`,e)}}_getPendingSpansKeys(){let e=[];for(let t=0;t<this._storage.length;t++){let n=this._storage.key(t);n!=null&&n.startsWith($i)&&e.push(n)}return e}destroy(){this.stopExpiredSpansCheck()}},ta=class{constructor(e,t){j(this,`_keyPrefix`,void 0),j(this,`_storage`,void 0),this._keyPrefix=`${e}_`,this._storage=t}getNamespacedKeys(){let e=[];for(let t=0;t<this._storage.length;t++){let n=this._storage.key(t);n!=null&&n.startsWith(this._keyPrefix)&&e.push(n.substring(this._keyPrefix.length))}return e}get length(){return this.getNamespacedKeys().length}clear(){this.getNamespacedKeys().forEach(e=>{this._storage.removeItem(`${this._keyPrefix}${e}`)})}getItem(e){return this._storage.getItem(`${this._keyPrefix}${e}`)}key(e){return this.getNamespacedKeys()[e]||null}removeItem(e){this._storage.removeItem(`${this._keyPrefix}${e}`)}setItem(e,t){this._storage.setItem(`${this._keyPrefix}${e}`,t)}};let na=({diag:e,featureManager:t,registerGlobally:n,propagator:r,defaultInstrumentationConfig:i})=>{var a;if(!t.isNetworkSpanForwardingEnabled())return!1;let o=[];return n||o.push("Network span forwarding cannot be used when `registerGlobally` is set to false. Turning off network span forwarding."),r&&o.push("Network span forwarding cannot be used alongside a custom `propagator`. Turning off network span forwarding."),!(i==null||(a=i.omit)==null)&&a.has(`@opentelemetry/instrumentation-xml-http-request`)&&i.omit.has(`@opentelemetry/instrumentation-fetch`)&&o.push(`Network span forwarding cannot be used when both '@opentelemetry/instrumentation-xml-http-request' and '@opentelemetry/instrumentation-fetch' are omitted. Turning off network span forwarding.`),o.forEach(t=>{e.warn(t)}),o.length===0};var ra=class{constructor(e=window.performance){j(this,`_clock`,void 0),j(this,`epochMillisFromOriginOffset`,e=>this._clock.timeOrigin+e),j(this,`getNowHRTime`,()=>mn(this.getNowMillis())),j(this,`getNowMillis`,()=>this.epochMillisFromOriginOffset(this._clock.now())),j(this,`millisSinceHRTime`,e=>this.getNowMillis()-hn(e)),this._clock=e}};let ia=(e,t=1e3)=>{let n=!1;return(...r)=>{n||(e(...r),setTimeout(()=>{n=!1},t),n=!0)}};var aa=class{logException(e,t){}message(e,t,n){}};let oa=new aa;var sa=class{constructor(){j(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?oa:e}setDelegate(e){this._delegate=e}logException(e,t){this.getDelegate().logException(e,t)}message(e,t,n){this.getDelegate().message(e,t,n)}};let ca=new aa,la=new Set([`setDelegate`,`getDelegate`]);var ua=class e{static getInstance(){if(!e._instance){let t=new sa,n=Et(t,ca,E.createComponentLogger({namespace:`LogAPI`}),la);e._instance=Object.assign(n,{setGlobalLogManager(e){t.setDelegate(e)},getLogManager(){return t}})}return e._instance}static resetInstance(){e._instance=void 0}};j(ua,`_instance`,void 0);let da=ua.getInstance();var fa=class{setCurrentRoute(e){}getCurrentRoute(){return null}getCurrentPageId(){return``}setPageLabel(e){}getPageLabel(){return null}clearCurrentRoute(){}};let pa=new fa;var ma=class{constructor(){j(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?pa:e}setDelegate(e){this._delegate=e}setCurrentRoute(e){this.getDelegate().setCurrentRoute(e)}getCurrentRoute(){return this.getDelegate().getCurrentRoute()}getCurrentPageId(){return this.getDelegate().getCurrentPageId()}setPageLabel(e){this.getDelegate().setPageLabel(e)}getPageLabel(){return this.getDelegate().getPageLabel()}clearCurrentRoute(){this.getDelegate().clearCurrentRoute()}};let ha=new fa,ga=new Set([`setDelegate`,`getDelegate`]);var _a=class e{static getInstance(){if(!e._instance){let t=new ma,n=Et(t,ha,E.createComponentLogger({namespace:`PageAPI`}),ga);e._instance=Object.assign(n,{setGlobalPageManager(e){t.setDelegate(e)},getPageManager(){return t}})}return e._instance}static resetInstance(){e._instance=void 0}};j(_a,`_instance`,void 0);let U=_a.getInstance();var va=class{constructor(){j(this,`getSessionId`,()=>null),j(this,`getPreviousSessionId`,()=>null)}addBreadcrumb(e){}addProperty(e,t,n){}removeProperty(e){}endSessionSpan(){}endSessionSpanInternal(e){}currentSessionAsReadableSpan(e){return null}getSessionSpan(){return null}getSessionStartTime(){return null}startSessionSpan(){}addSessionStartedListener(e){return()=>{}}addSessionEndedListener(e){return()=>{}}};let ya=new va;var ba=class{constructor(){j(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?ya:e}setDelegate(e){this._delegate=e}addBreadcrumb(e){this.getDelegate().addBreadcrumb(e)}addProperty(e,t,n){this.getDelegate().addProperty(e,t,n)}removeProperty(e){this.getDelegate().removeProperty(e)}endSessionSpan(){this.getDelegate().endSessionSpan()}endSessionSpanInternal(e){this.getDelegate().endSessionSpanInternal(e)}currentSessionAsReadableSpan(e){return this.getDelegate().currentSessionAsReadableSpan(e)}getSessionId(){return this.getDelegate().getSessionId()}getPreviousSessionId(){return this.getDelegate().getPreviousSessionId()}getSessionSpan(){return this.getDelegate().getSessionSpan()}getSessionStartTime(){return this.getDelegate().getSessionStartTime()}startSessionSpan(e){this.getDelegate().startSessionSpan(e)}addSessionStartedListener(e){return this.getDelegate().addSessionStartedListener(e)}addSessionEndedListener(e){return this.getDelegate().addSessionEndedListener(e)}};let xa=new va,Sa=new Set([`setDelegate`,`getDelegate`]);var Ca=class e{static getInstance(){if(!e._instance){let t=new ba,n=Et(t,xa,E.createComponentLogger({namespace:`SessionAPI`}),Sa);e._instance=Object.assign(n,{setGlobalSessionManager(e){t.setDelegate(e)},getSpanSessionManager(){return t}})}return e._instance}static resetInstance(){e._instance=void 0}};j(Ca,`_instance`,void 0);let wa=Ca.getInstance();var Ta=class{constructor(e=Ve){j(this,`_spanContext`,void 0),j(this,`attributes`,{}),this._spanContext=e}fail(e){}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}removeAttribute(e){return this}addEvent(e,t,n){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}},Ea=class{startSpan(e,t){return new Ta}setSpan(e,t){return y}getSpan(e){}};let Da=new Ea;var Oa=class{constructor(){j(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?Da:e}setDelegate(e){this._delegate=e}startSpan(e,t,n){return this.getDelegate().startSpan(e,t,n)}setSpan(e,t){return this.getDelegate().setSpan(e,t)}getSpan(e){return this.getDelegate().getSpan(e)}};let ka=new Ea,Aa=new Set([`setDelegate`,`getDelegate`]);var ja=class e{static getInstance(){if(!e._instance){let t=new Oa,n=Et(t,ka,E.createComponentLogger({namespace:`TraceAPI`}),Aa);e._instance=Object.assign(n,{setGlobalTraceManager(e){t.setDelegate(e)},getTraceManager(){return t}})}return e._instance}static resetInstance(){e._instance=void 0}};j(ja,`_instance`,void 0);let Ma=ja.getInstance(),Na=`enduser.pseudo.id`;var Pa=class{getMXLUserId(){return``}getUserId(){return null}setUserId(){}clearUserId(){}};let Fa=new Pa;var Ia=class{constructor(){j(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?Fa:e}setDelegate(e){this._delegate=e}getMXLUserId(){return this.getDelegate().getMXLUserId()}getUserId(){return this.getDelegate().getUserId()}setUserId(e){this.getDelegate().setUserId(e)}clearUserId(){this.getDelegate().clearUserId()}};let La=new Pa,Ra=new Set([`setDelegate`,`getDelegate`]);var za=class e{static getInstance(){if(!e._instance){let t=new Ia,n=Et(t,La,E.createComponentLogger({namespace:`UserAPI`}),Ra);e._instance=Object.assign(n,{setGlobalUserManager(e){t.setDelegate(e)},getUserManager(){return t}})}return e._instance}static resetInstance(){e._instance=void 0}};j(za,`_instance`,void 0);let Ba=za.getInstance();var W;(function(e){e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.TRACE=1]=`TRACE`,e[e.TRACE2=2]=`TRACE2`,e[e.TRACE3=3]=`TRACE3`,e[e.TRACE4=4]=`TRACE4`,e[e.DEBUG=5]=`DEBUG`,e[e.DEBUG2=6]=`DEBUG2`,e[e.DEBUG3=7]=`DEBUG3`,e[e.DEBUG4=8]=`DEBUG4`,e[e.INFO=9]=`INFO`,e[e.INFO2=10]=`INFO2`,e[e.INFO3=11]=`INFO3`,e[e.INFO4=12]=`INFO4`,e[e.WARN=13]=`WARN`,e[e.WARN2=14]=`WARN2`,e[e.WARN3=15]=`WARN3`,e[e.WARN4=16]=`WARN4`,e[e.ERROR=17]=`ERROR`,e[e.ERROR2=18]=`ERROR2`,e[e.ERROR3=19]=`ERROR3`,e[e.ERROR4=20]=`ERROR4`,e[e.FATAL=21]=`FATAL`,e[e.FATAL2=22]=`FATAL2`,e[e.FATAL3=23]=`FATAL3`,e[e.FATAL4=24]=`FATAL4`})(W||(W={}));var Va=class{emit(e){}};let Ha=new Va,Ua=Symbol.for(`io.opentelemetry.js.api.logs`),Wa=globalThis;function Ga(e,t,n){return r=>r===e?t:n}let Ka=new class{getLogger(e,t,n){return new Va}};var qa=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Ha}},Ja=class{getLogger(e,t,n){var r;return(r=this._getDelegateLogger(e,t,n))==null?new qa(this,e,t,n):r}_getDelegate(){var e;return(e=this._delegate)==null?Ka:e}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){var r;return(r=this._delegate)==null?void 0:r.getLogger(e,t,n)}};let Ya=class e{constructor(){this._proxyLoggerProvider=new Ja}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(e){return Wa[Ua]?this.getLoggerProvider():(Wa[Ua]=Ga(1,e,Ka),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,t;return(t=(e=Wa[Ua])==null?void 0:e.call(Wa,1))==null?this._proxyLoggerProvider:t}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){delete Wa[Ua],this._proxyLoggerProvider=new Ja}}.getInstance();function Xa(e,t,n,r){for(let i=0,a=e.length;i<a;i++){let a=e[i];t&&a.setTracerProvider(t),n&&a.setMeterProvider(n),r&&a.setLoggerProvider&&a.setLoggerProvider(r),a.getConfig().enabled||a.enable()}}function Za(e){e.forEach(e=>e.disable())}function Qa(e){var t,n;let r=e.tracerProvider||O.getTracerProvider(),i=e.meterProvider||mt.getMeterProvider(),a=e.loggerProvider||Ya.getLoggerProvider(),o=(t=(n=e.instrumentations)==null?void 0:n.flat())==null?[]:t;return Xa(o,r,i,a),()=>{Za(o)}}function $a(e,t,n){let r,i;try{i=e()}catch(e){r=e}finally{if(t(r,i),r&&!n)throw r;return i}}function eo(e){return typeof e==`function`&&typeof e.__original==`function`&&typeof e.__unwrap==`function`&&e.__wrapped===!0}let to=`http.request.body.size`,no=`http.response.body.size`,ro=`session.id`,io=`user.id`;var ao=class{constructor(e,t,n){this.instrumentationName=e,this.instrumentationVersion=t,j(this,`_config`,{}),j(this,`_diag`,void 0),j(this,`_tracer`,void 0),j(this,`_meter`,void 0),j(this,`_logger`,void 0),this.setConfig(n),this._diag=E.createComponentLogger({namespace:e}),this._tracer=O.getTracer(e,t),this._meter=mt.getMeter(e,t),this._logger=Ya.getLogger(e,t),this._updateMetricInstruments()}get tracer(){return this._tracer}get meter(){return this._meter}get logger(){return this._logger}getModuleDefinitions(){var e;let t=(e=this.init())==null?[]:e;return Array.isArray(t)?t:[t]}getConfig(){return this._config}setConfig(e){this._config=L({enabled:!0},e)}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}_updateMetricInstruments(){}_runSpanCustomizationHook(e,t,n,r){if(e)try{e(n,r)}catch(e){this._diag.error(`Error running span customization hook due to exception in handler`,{triggerName:t},e)}}},G=class extends ao{constructor({instrumentationName:e,instrumentationVersion:t,config:n,diag:r,perf:i}){super(e,t,n),j(this,`_sessionManager`,void 0),j(this,`_logManager`,void 0),j(this,`_perf`,void 0),r&&(this._diag=r),this._perf=i==null?new ra:i,this._sessionManager=wa.getSpanSessionManager(),this._logManager=da.getLogManager()}get sessionManager(){return this._sessionManager}get logManager(){return this._logManager}get perf(){return this._perf}init(){}setLogManager(e){this._logManager=e}setSessionManager(e){this._sessionManager=e}};let oo=function(e){return e.DOCUMENT_LOAD=`documentLoad`,e.DOCUMENT_FETCH=`documentFetch`,e.RESOURCE_FETCH=`resourceFetch`,e}({}),so=function(e){return e.FIRST_PAINT=`firstPaint`,e.FIRST_CONTENTFUL_PAINT=`firstContentfulPaint`,e}({}),co=()=>{let e={},t=window.performance.getEntriesByType(`navigation`)[0];return Object.values(B).forEach(n=>{if(Gi(t,n)){let r=t[n];typeof r==`number`&&(e[n]=r)}}),e},lo={"first-paint":so.FIRST_PAINT,"first-contentful-paint":so.FIRST_CONTENTFUL_PAINT},uo=e=>{window.performance.getEntriesByType(`paint`).forEach(({name:t,startTime:n})=>{Gi(lo,t)&&e.addEvent(lo[t],n)})};var fo=class extends G{constructor({diag:e,perf:t,enabled:n,applyCustomAttributesOnSpan:r,ignorePerformancePaintEvents:i=!1,ignoreNetworkEvents:a=!1}={}){super({instrumentationName:`DocumentLoadInstrumentation`,instrumentationVersion:`1.0.0`,diag:e,perf:t,config:{enabled:n,applyCustomAttributesOnSpan:r,ignorePerformancePaintEvents:i,ignoreNetworkEvents:a}}),j(this,`_onDocumentLoaded`,void 0),j(this,`_performanceCollected`,!1),this._onDocumentLoaded=()=>{window.setTimeout(()=>{this._collectPerformance()},0)},this._config.enabled&&this.enable()}init(){this._diag.debug(`Initializing document load instrumentation`)}_addResourcesSpans(e){performance.getEntriesByType(`resource`).forEach(t=>{this._initResourceSpan(t,e)})}_collectPerformance(){if(this._performanceCollected)return;this._performanceCollected=!0;let e=Array.from(document.getElementsByTagName(`meta`)).find(e=>e.getAttribute(`name`)===En),t=co(),n=(e==null?void 0:e.content)||``;T.with(D.extract(y,{traceparent:n}),()=>{var e;let n=this._startSpan(oo.DOCUMENT_LOAD,B.FETCH_START,t);n&&(T.with(O.setSpan(T.active(),n),()=>{let e=this._startSpan(oo.DOCUMENT_FETCH,B.FETCH_START,t);e&&(e.setAttribute(N,location.href),T.with(O.setSpan(T.active(),e),()=>{var n;Ki(e,t,this.getConfig().ignoreNetworkEvents),this._addCustomAttributesOnSpan(e,(n=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:n.documentFetch),this._endSpan(e,B.RESPONSE_END,t)}))}),n.setAttribute(k,A.DocumentLoad),n.setAttribute(N,location.href),n.setAttribute(fn,navigator.userAgent),this._addResourcesSpans(n),this.getConfig().ignoreNetworkEvents||(V(n,B.FETCH_START,t),V(n,B.UNLOAD_EVENT_START,t),V(n,B.UNLOAD_EVENT_END,t),V(n,B.DOM_INTERACTIVE,t),V(n,B.DOM_CONTENT_LOADED_EVENT_START,t),V(n,B.DOM_CONTENT_LOADED_EVENT_END,t),V(n,B.DOM_COMPLETE,t),V(n,B.LOAD_EVENT_START,t),V(n,B.LOAD_EVENT_END,t)),this.getConfig().ignorePerformancePaintEvents||uo(n),this._addCustomAttributesOnSpan(n,(e=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:e.documentLoad),this._endSpan(n,B.LOAD_EVENT_END,t))})}_endSpan(e,t,n){e&&(Gi(n,t)&&typeof n[t]==`number`?e.end(n[t]):e.end())}_initResourceSpan(e,t){var n;let r=this._startSpan(oo.RESOURCE_FETCH,B.FETCH_START,e,t);r&&(r.setAttribute(k,A.ResourceFetch),r.setAttribute(N,e.name),Ki(r,e,this.getConfig().ignoreNetworkEvents),e.deliveryType&&r.setAttribute(`http.response.delivery_type`,e.deliveryType),e.initiatorType&&r.setAttribute(`http.request.initiator_type`,e.initiatorType),e.renderBlockingStatus&&r.setAttribute(`http.request.render_blocking_status`,e.renderBlockingStatus),e.responseStatus&&r.setAttribute(rn,e.responseStatus),typeof e.encodedBodySize==`number`&&e.encodedBodySize>=0&&r.setAttribute(no,e.encodedBodySize),typeof e.transferSize==`number`&&e.transferSize>=0&&r.setAttribute(`http.response.size`,e.transferSize),typeof e.decodedBodySize==`number`&&e.decodedBodySize>=0&&r.setAttribute(`http.response.decoded_body_size`,e.decodedBodySize),this._addResourceDiagnosticAttributes(r,e),this._addCustomAttributesOnResourceSpan(r,e,(n=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:n.resourceFetch),this._endSpan(r,B.RESPONSE_END,e))}_startSpan(e,t,n,r){if(Gi(n,t)&&typeof n[t]==`number`)return this.tracer.startSpan(e,{startTime:n[t]},r?O.setSpan(T.active(),r):void 0)}_waitForPageLoad(){window.document.readyState===`complete`?this._onDocumentLoaded():window.addEventListener(`load`,this._onDocumentLoaded)}_addCustomAttributesOnSpan(e,t){t&&$a(()=>{t(e)},e=>{e&&this._diag.error(`addCustomAttributesOnSpan`,e)},!0)}_addCustomAttributesOnResourceSpan(e,t,n){n&&$a(()=>{n(e,t)},e=>{e&&this._diag.error(`addCustomAttributesOnResourceSpan`,e)},!0)}_hasNoSizeData(e){let t=typeof e.transferSize==`number`?e.transferSize:0,n=typeof e.decodedBodySize==`number`?e.decodedBodySize:0,r=typeof e.encodedBodySize==`number`?e.encodedBodySize:0;return t===0&&n===0&&r===0}_hasTimingData(e){let t=typeof e.fetchStart==`number`?e.fetchStart:0,n=typeof e.responseEnd==`number`?e.responseEnd:0;return t>0&&n>0}_isCorsRestricted(e){return this._hasNoSizeData(e)&&this._hasTimingData(e)}_isFetchIncomplete(e){let t=typeof e.fetchStart==`number`?e.fetchStart:0,n=typeof e.responseEnd==`number`?e.responseEnd:0;return this._hasNoSizeData(e)&&t>0&&n===0}_isFetchPrevented(e){let t=typeof e.fetchStart==`number`?e.fetchStart:0;return this._hasNoSizeData(e)&&t===0}_isCacheValidated(e){let t=typeof e.transferSize==`number`?e.transferSize:0,n=typeof e.deliveryType==`string`?e.deliveryType:``;return t===300&&n!==`cache`}_addResourceDiagnosticAttributes(e,t){this._isCorsRestricted(t)?e.setAttribute(`http.response.cors_opaque`,!0):this._isFetchIncomplete(t)?e.setAttribute(`http.request.incomplete`,!0):this._isFetchPrevented(t)&&e.setAttribute(`http.request.prevented`,!0),this._isCacheValidated(t)&&e.setAttribute(`http.response.cache_revalidated`,!0)}enable(){window.removeEventListener(`load`,this._onDocumentLoaded),this._waitForPageLoad()}disable(){window.removeEventListener(`load`,this._onDocumentLoaded)}},po=class extends G{constructor({diag:e,perf:t,rootNode:n,emptyCheckDelayMs:r=500}){super({instrumentationName:`EmptyRootInstrumentation`,instrumentationVersion:`1.0.0`,diag:e,perf:t,config:{}}),j(this,`_observer`,void 0),j(this,`_emptyCheckDelayMs`,void 0),j(this,`_rootNode`,void 0),this._rootNode=n,this._emptyCheckDelayMs=r,this._observer=new MutationObserver((e,t)=>{this._observerCallback(e)}),this._config.enabled&&this._rootNode?this.enable():this._rootNode||this._diag.warn(`supplied root node was null, this instrumentation won't be enabled`)}disable(){this._observer.disconnect()}enable(){this._rootNode&&this._observer.observe(this._rootNode,{childList:!0})}_observerCallback(e){let t=!1,n=!1;for(let r of e)r.target===this._rootNode&&(r.removedNodes.length>0&&(t=!0),r.addedNodes.length>0&&(n=!0));t&&!n&&(this._diag.debug(`root node had child nodes removed without new ones being added, checking if it's empty in ${this._emptyCheckDelayMs}ms`),window.setTimeout(()=>{this._checkForEmptyRootNode()},this._emptyCheckDelayMs))}_checkForEmptyRootNode(){var e;if(((e=this._rootNode)==null?void 0:e.childNodes.length)===0){this._diag.debug(`root node was found to be empty`);let e=this.sessionManager.getSessionSpan();e?e.addEvent(`empty-root-node`,{"mxl.type":`ux.empty_root_node`}):this._diag.debug(`no active session found to emit event on`)}}};let mo=(e,t)=>{let n=e.nodeName.toLowerCase(),r=t.substring(0,30),i=t.length>30?`...`:``;return`<${n}${e.className?` class="${e.className}"`:``}>${r}${i}</${n}>`};var ho=class extends G{constructor({diag:e,perf:t,shouldTrack:n,innerTextForElement:r}={}){super({instrumentationName:`ClicksInstrumentation`,instrumentationVersion:`1.0.0`,diag:e,perf:t,config:{}}),j(this,`_onClickHandler`,void 0),this._onClickHandler=e=>{let t=e.target;if(t instanceof HTMLElement&&!t.hasAttribute(`disabled`)&&!(n&&!n(t)))try{let n=this.sessionManager.getSessionSpan();n&&n.addEvent(`click`,{"mxl.type":`ux.tap`,"view.name":mo(t,r?r(t):t.innerText),"tap.coords":`${e.x.toString()},${e.y.toString()}`},this.perf.epochMillisFromOriginOffset(e.timeStamp))}catch(e){this._diag.error(`failed to create new user interaction span event`,e)}},this._config.enabled&&this.enable()}disable(){document.removeEventListener(`click`,this._onClickHandler)}enable(){document.addEventListener(`click`,this._onClickHandler)}},go=class extends G{constructor({diag:e,perf:t}={}){super({instrumentationName:`GlobalExceptionInstrumentation`,instrumentationVersion:`1.0.0`,diag:e,perf:t,config:{}}),j(this,`_onErrorHandler`,void 0),j(this,`_onUnhandledRejectionHandler`,void 0),this._onErrorHandler=e=>{this.logManager.logException(e.error||e.message,{handled:!1,timestamp:this.perf.epochMillisFromOriginOffset(e.timeStamp),handler:`global_exception`})},this._onUnhandledRejectionHandler=e=>{this.logManager.logException(e.reason,{handled:!1,timestamp:this.perf.epochMillisFromOriginOffset(e.timeStamp),handler:`promise_rejection`})},this._config.enabled&&this.enable()}disable(){window.removeEventListener(`error`,this._onErrorHandler),window.removeEventListener(`unhandledrejection`,this._onUnhandledRejectionHandler)}enable(){window.addEventListener(`error`,this._onErrorHandler),window.addEventListener(`unhandledrejection`,this._onUnhandledRejectionHandler)}};let K=console.error.bind(console);function _o(e,t,n){let r=!!e[t]&&Object.prototype.propertyIsEnumerable.call(e,t);Object.defineProperty(e,t,{configurable:!0,enumerable:r,writable:!0,value:n})}let vo=(e,t,n)=>{if(!e||!e[t]){K(`no original function `+String(t)+` to wrap`);return}if(!n){K(`no wrapper function`),K(Error().stack);return}let r=e[t];if(typeof r!=`function`||typeof n!=`function`){K(`original object and wrapper must be functions`);return}let i=n(r,t);return _o(i,`__original`,r),_o(i,`__unwrap`,()=>{e[t]===i&&_o(e,t,r)}),_o(i,`__wrapped`,!0),_o(e,t,i),i},yo=(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{K(`must provide one or more modules to patch`),K(Error().stack);return}if(!(t&&Array.isArray(t))){K(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{vo(e,t,n)})})},bo=(e,t)=>{if(!e||!e[t]){K(`no function to unwrap.`),K(Error().stack);return}let n=e[t];if(!n.__unwrap)K(`no original to unwrap to -- has `+String(t)+` already been unwrapped?`);else{n.__unwrap();return}},xo=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{K(`must provide one or more modules to patch`),K(Error().stack);return}if(!(t&&Array.isArray(t))){K(`must provide one or more functions to unwrap on modules`);return}e.forEach(e=>{t.forEach(t=>{bo(e,t)})})};function So(e){e&&e.logger&&(typeof e.logger==`function`?K=e.logger:K(`new logger isn't a function, not replacing`))}So.wrap=vo,So.massWrap=yo,So.unwrap=bo,So.massUnwrap=xo;var Co=class{constructor(e,t,n){j(this,`_config`,{}),j(this,`_tracer`,void 0),j(this,`_meter`,void 0),j(this,`_logger`,void 0),j(this,`_diag`,void 0),j(this,`instrumentationName`,void 0),j(this,`instrumentationVersion`,void 0),j(this,`_wrap`,vo),j(this,`_unwrap`,bo),j(this,`_massWrap`,yo),j(this,`_massUnwrap`,xo),this.instrumentationName=e,this.instrumentationVersion=t,this.setConfig(n),this._diag=E.createComponentLogger({namespace:e}),this._tracer=O.getTracer(e,t),this._meter=mt.getMeter(e,t),this._logger=Ya.getLogger(e,t),this._updateMetricInstruments()}get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){var e;let t=(e=this.init())==null?[]:e;return Array.isArray(t)?t:[t]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config=L({enabled:!0},e)}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,t,n,r){if(e)try{e(n,r)}catch(e){this._diag.error(`Error running span customization hook due to exception in handler`,{triggerName:t},e)}}},wo=class extends Co{constructor(e,t,n){super(e,t,n),this._config.enabled&&this.enable()}};function To(e,t,n){let r,i;try{i=e()}catch(e){r=e}finally{if(t(r,i),r&&!n)throw r;return i}}function Eo(e){return typeof e==`function`&&typeof e.__original==`function`&&typeof e.__unwrap==`function`&&e.__wrapped===!0}var q;(function(e){e[e.STABLE=1]=`STABLE`,e[e.OLD=2]=`OLD`,e[e.DUPLICATE=3]=`DUPLICATE`})(q||(q={}));function Do(e,t){let n=q.OLD,r=t==null?void 0:t.split(`,`).map(e=>e.trim()).filter(e=>e!==``);for(let t of r==null?[]:r)if(t.toLowerCase()===e+`/dup`){n=q.DUPLICATE;break}else t.toLowerCase()===e&&(n=q.STABLE);return n}let Oo=performance,ko=Math.pow(10,6),Ao=Math.pow(10,9);function jo(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*ko)]}function Mo(e){return No(jo(Oo.timeOrigin),jo(typeof e==`number`?e:Oo.now()))}function No(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=Ao&&(n[1]-=Ao,n[0]+=1),n}function Po(e,t){return typeof t==`string`?e===t:!!e.match(t)}function Fo(e,t){if(!t)return!1;for(let n of t)if(Po(e,n))return!0;return!1}var Io;(function(e){e.COMPONENT=`component`,e.HTTP_STATUS_TEXT=`http.status_text`})(Io||(Io={}));let Lo=E.createComponentLogger({namespace:`@opentelemetry/opentelemetry-instrumentation-fetch/utils`});function Ro(...e){if(e[0]instanceof URL||typeof e[0]==`string`){let t=e[1];if(!(t!=null&&t.body))return Promise.resolve();if(t.body instanceof ReadableStream){let{body:e,length:n}=zo(t.body);return t.body=e,n}else return Promise.resolve(Vo(t.body))}else{let t=e[0];return t!=null&&t.body?t.clone().text().then(e=>Uo(e)):Promise.resolve()}}function zo(e){if(!e.pipeThrough)return Lo.warn(`Platform has ReadableStream but not pipeThrough!`),{body:e,length:Promise.resolve(void 0)};let t=0,n,r=new Promise(e=>{n=e}),i=new TransformStream({start(){},transform(e,n){return P(function*(){let r=yield e;t+=r.byteLength,n.enqueue(e)})()},flush(){n(t)}});return{body:e.pipeThrough(i),length:r}}function Bo(e){return typeof Document<`u`&&e instanceof Document}function Vo(e){if(Bo(e))return new XMLSerializer().serializeToString(document).length;if(typeof e==`string`)return Uo(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return Wo(e);if(e instanceof URLSearchParams)return Uo(e.toString());if(e.byteLength!==void 0)return e.byteLength;Lo.warn(`unknown body type`)}let Ho=new TextEncoder;function Uo(e){return Ho.encode(e).byteLength}function Wo(e){let t=0;for(let[n,r]of e.entries())t+=n.length,r instanceof Blob?t+=r.size:t+=r.length;return t}function Go(e){let t=Jo(),n=e.toUpperCase();return n in t?n:`_OTHER`}let Ko={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},qo;function Jo(){return qo===void 0&&(qo=Ko),qo}let Yo={"https:":`443`,"http:":`80`};function Xo(e){let t=Number(e.port||Yo[e.protocol]);if(t&&!isNaN(t))return t}let Zo=`0.213.0`,Qo=typeof PerformanceObserver<`u`;var $o=class extends wo{constructor(e={}){super(`@opentelemetry/instrumentation-fetch`,Zo,e),j(this,`component`,`fetch`),j(this,`version`,Zo),j(this,`moduleName`,this.component),j(this,`_usedResources`,new WeakSet),j(this,`_tasksCount`,0),j(this,`_semconvStability`,void 0),this._semconvStability=Do(`http`,e==null?void 0:e.semconvStabilityOptIn)}init(){}_addChildSpan(e,t){let n=this.tracer.startSpan(`CORS Preflight`,{startTime:t[B.FETCH_START]},O.setSpan(T.active(),e)),r=!(this._semconvStability&q.OLD);Ki(n,t,this.getConfig().ignoreNetworkEvents,void 0,r),n.end(t[B.RESPONSE_END])}_addFinalSpanAttributes(e,t){let n=H(t.url);if(this._semconvStability&q.OLD&&(e.setAttribute(`http.status_code`,t.status),t.statusText!=null&&e.setAttribute(Io.HTTP_STATUS_TEXT,t.statusText),e.setAttribute(`http.host`,n.host),e.setAttribute(`http.scheme`,n.protocol.replace(`:`,``)),typeof navigator<`u`&&e.setAttribute(`http.user_agent`,navigator.userAgent)),this._semconvStability&q.STABLE){e.setAttribute(rn,t.status),e.setAttribute(an,n.hostname);let r=Xo(n);r&&e.setAttribute(on,r)}}_addHeaders(e,t){if(!Qi(t,this.getConfig().propagateTraceHeaderCorsUrls)){let e={};D.inject(T.active(),e),Object.keys(e).length>0&&this._diag.debug(`headers inject skipped due to CORS policy`);return}if(e instanceof Request)D.inject(T.active(),e.headers,{set:(e,t,n)=>e.set(t,typeof n==`string`?n:String(n))});else{let t=new Headers(e.headers);D.inject(T.active(),t,{set:(e,t,n)=>e.set(t,typeof n==`string`?n:String(n))}),e.headers=t}}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(performance.clearResourceTimings(),this._usedResources=new WeakSet)}_createSpan(e,t={}){if(Fo(e,this.getConfig().ignoreUrls)){this._diag.debug(`ignoring span as url matches ignored url`);return}let n=``,r={};if(this._semconvStability&q.OLD){let i=(t.method||`GET`).toUpperCase();n=`HTTP ${i}`,r[Io.COMPONENT]=this.moduleName,r[`http.method`]=i,r[`http.url`]=e}if(this._semconvStability&q.STABLE){let i=t.method,a=Go(t.method||`GET`);n||(n=a),r[tn]=a,a!==i&&(r[nn]=i),r[N]=e}return this.tracer.startSpan(n,{kind:ut.CLIENT,attributes:r})}_findResourceAndAddNetworkEvents(e,t,n){let r=t.entries;if(!r.length){if(!performance.getEntriesByType)return;r=performance.getEntriesByType(`resource`)}let i=Yi(t.spanUrl,t.startTime,n,r,this._usedResources,`fetch`);if(i.mainRequest){let t=i.mainRequest;this._markResourceAsUsed(t);let n=i.corsPreFlightRequest;n&&(this._addChildSpan(e,n),this._markResourceAsUsed(n));let r=!(this._semconvStability&q.OLD);Ki(e,t,this.getConfig().ignoreNetworkEvents,void 0,r)}}_markResourceAsUsed(e){this._usedResources.add(e)}_endSpan(e,t,n){let r=jo(Date.now()),i=Mo();this._addFinalSpanAttributes(e,n),this._semconvStability&q.STABLE&&n.status>=400&&(e.setStatus({code:dt.ERROR}),e.setAttribute(Qt,String(n.status))),setTimeout(()=>{var n;(n=t.observer)==null||n.disconnect(),this._findResourceAndAddNetworkEvents(e,t,i),this._tasksCount--,this._clearResources(),e.end(r)},300)}_patchConstructor(){return e=>{let t=this,n=new Set([`url`,`type`,`redirected`]);function r(e,t){return new Proxy(e,{get(e,i,a){if(typeof i==`string`&&n.has(i))return Reflect.get(t,i);if(i===`clone`)return function(){return r(e.clone(),t)};let o=Reflect.get(e,i,e);return typeof o==`function`?o.bind(e):o}})}return function(...n){let i=this,a=H(n[0]instanceof Request?n[0].url:String(n[0])).href,o=n[0]instanceof Request?n[0]:n[1]||{},s=t._createSpan(a,o);if(!s)return e.apply(this,n);let c=t._prepareSpanData(a);t.getConfig().measureRequestSize&&Ro(...n).then(e=>{e&&(t._semconvStability&q.OLD&&s.setAttribute(`http.request_content_length_uncompressed`,e),t._semconvStability&q.STABLE&&s.setAttribute(`http.request.body.size`,e))}).catch(e=>{t._diag.warn(`getFetchBodyLength`,e)});function l(e,n){t._applyAttributesAfterFetch(e,o,n),t._endSpan(e,c,{status:n.status||0,statusText:n.message,url:a})}function u(e,n){t._applyAttributesAfterFetch(e,o,n),n.status>=200&&n.status<400?t._endSpan(e,c,n):t._endSpan(e,c,{status:n.status,statusText:n.statusText,url:a})}function d(e,t){if(!e)return null;let n=e.getReader();return new ReadableStream({pull(e){return P(function*(){try{let{value:t,done:r}=yield n.read();r?(n.releaseLock(),e.close()):e.enqueue(t)}catch(t){e.error(t),n.cancel(t).catch(e=>{});try{n.releaseLock()}catch(e){}}})()},cancel(e){return t.cancel(e).catch(e=>{}),n.cancel(e)}})}function f(e,t,n){let i=null;try{let t=n.clone().body;if(t){let a=t.getReader(),o=n.status===204||n.status===205||n.status===304?null:d(n.body,a);i=r(new Response(o,{status:n.status,statusText:n.statusText,headers:n.headers}),n);let s=()=>{a.read().then(({done:t})=>{t?u(e,n):s()},t=>{l(e,t)})};s()}else u(e,n)}finally{var a;t((a=i)==null?n:a)}}function p(e,t,n){try{l(e,n)}finally{t(n)}}return new Promise((n,r)=>T.with(O.setSpan(T.active(),s),()=>(t._callRequestHook(s,o),t._addHeaders(o,a),t._tasksCount++,e.apply(i,o instanceof Request?[o]:[a,o]).then(f.bind(i,s,n),p.bind(i,s,r)))))}}}_applyAttributesAfterFetch(e,t,n){let r=this.getConfig().applyCustomAttributesOnSpan;r&&To(()=>r(e,t,n),e=>{e&&this._diag.error(`applyCustomAttributesOnSpan`,e)},!0)}_callRequestHook(e,t){let n=this.getConfig().requestHook;n&&To(()=>n(e,t),e=>{e&&this._diag.error(`requestHook`,e)},!0)}_prepareSpanData(e){let t=Mo(),n=[];if(typeof PerformanceObserver!=`function`)return{entries:n,startTime:t,spanUrl:e};let r=new PerformanceObserver(t=>{t.getEntries().forEach(t=>{t.initiatorType===`fetch`&&t.name===e&&n.push(t)})});return r.observe({entryTypes:[`resource`]}),{entries:n,observer:r,startTime:t,spanUrl:e}}enable(){if(!Qo){this._diag.warn(`this instrumentation is intended for web usage only, it does not instrument server-side fetch()`);return}Eo(fetch)&&(this._unwrap(globalThis,`fetch`),this._diag.debug(`removing previous patch for constructor`)),this._wrap(globalThis,`fetch`,this._patchConstructor())}disable(){Qo&&(this._unwrap(globalThis,`fetch`),this._usedResources=new WeakSet)}};function es(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function ts(e,t){if(e==null)return{};var n,r,i=es(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}let ns=[`omitIfAlreadyPatched`];var rs=class extends $o{constructor(e={}){let{omitIfAlreadyPatched:t}=e,n=ts(e,ns);super(L(L({},n),{},{enabled:!1})),j(this,`_omitIfAlreadyPatched`,void 0),this._omitIfAlreadyPatched=t,n.enabled&&this.enable()}enable(){if(this._omitIfAlreadyPatched&&eo(fetch)){this._diag.debug("fetch is already passed and `omitIfAlreadyPatched` is true, skipping enabling this instrumentation");return}super.enable()}};let is=/\([^()]+\)/g;var as=class extends G{constructor({diag:e,shouldCleanupPathOptionsFromRouteName:t=!0}){super({instrumentationName:`NavigationInstrumentation`,instrumentationVersion:`1.0.0`,diag:e,config:{}}),j(this,`_shouldCleanupPathOptionsFromRouteName`,!0),j(this,`_currentRouteSpan`,null),j(this,`_instrumentationType`,Rt.Manual),j(this,`_removeSessionStartedFn`,null),j(this,`_removeSessionEndedFn`,null),j(this,`setInstrumentationType`,e=>{this._instrumentationType=e}),j(this,`setCurrentRoute`,e=>{if(!this._config.enabled)return;let t=U.getCurrentRoute();e.url!==(t==null?void 0:t.url)&&(U.setCurrentRoute(e),this._endRouteSpan(t),this._startRouteSpan(e))}),j(this,`_setupSessionListeners`,()=>{this._removeSessionStartedFn||(this._removeSessionStartedFn=this.sessionManager.addSessionStartedListener(()=>{let e=U.getCurrentRoute();e&&!this._currentRouteSpan&&(this._diag.debug(`Session started, starting route span.`),this._startRouteSpan(e))})),this._removeSessionEndedFn||(this._removeSessionEndedFn=this.sessionManager.addSessionEndedListener(()=>{this._currentRouteSpan&&(this._diag.debug(`Session ended, ending route span.`),this._endRouteSpan(U.getCurrentRoute()))}))}),j(this,`_cleanUpSessionListeners`,()=>{this._removeSessionStartedFn&&(this._removeSessionStartedFn(),this._removeSessionStartedFn=null),this._removeSessionEndedFn&&(this._removeSessionEndedFn(),this._removeSessionEndedFn=null)}),j(this,`_startRouteSpan`,e=>{this._diag.debug(`Starting route span for url: ${e.url}`),this._setupSessionListeners();let t=this._shouldCleanupPathOptionsFromRouteName?e.path.replace(is,``):e.path;return this._currentRouteSpan=this.tracer.startSpan(t,{attributes:{[k]:A.Surface,[Pt]:t,[Ft]:U.getCurrentPageId()||void 0}}),this._currentRouteSpan.setAttribute(`mxl.instrumentation`,this._instrumentationType),this._currentRouteSpan}),j(this,`_endRouteSpan`,e=>{this._currentRouteSpan&&(e&&this._diag.debug(`Ending route span for url: ${e.url}`),this._currentRouteSpan.end(),this._currentRouteSpan=null)}),j(this,`enable`,()=>{this.setConfig({enabled:!0}),this._diag.debug(`NavigationInstrumentation enabled, listening for navigation events.`)}),j(this,`disable`,()=>{this._cleanUpSessionListeners(),this.setConfig({enabled:!1}),this._diag.debug(`NavigationInstrumentation disabled, stopped listening for navigation events.`)}),this._shouldCleanupPathOptionsFromRouteName=t,this._config.enabled&&this.enable()}};let os,ss=(e={})=>(os||(os=new as(e)),os),cs={samplingPct:100,networkSpansForwardingThreshold:0},ls=`mxl_remote_config`,us=(e,{osVersion:t,appVersion:n,deviceId:r},i)=>`${i||`https://mxl-basket.apps.ocpthikadev01.safaricom.net`}/config?appId=${e}&osVersion=${t}&appVersion=${n}&deviceId=${r}`,ds=e=>{let t={samplingPct:e.threshold};return e.network_span_forwarding!==void 0&&(t.networkSpansForwardingThreshold=e.network_span_forwarding.pct_enabled),e.empty_session_avoidance_enabled_pct!==void 0&&(t.emptySessionAvoidanceEnabledPct=e.empty_session_avoidance_enabled_pct),t};var fs=class{constructor({appID:e,appVersion:t,deviceId:n,diag:r=E.createComponentLogger({namespace:`mxl-config-manager`}),storage:i=window.localStorage,defaultConfig:a={},mxlConfigURL:o}={}){j(this,`_remoteConfigURL`,null),j(this,`_diag`,void 0),j(this,`_storage`,void 0),j(this,`_sdkConfig`,void 0),j(this,`_etag`,null),e&&t&&n&&(this._remoteConfigURL=us(e,{appVersion:t,deviceId:n,osVersion:`1`},o)),this._diag=r,this._storage=i;let s=this._getRemoteConfigFromStorage();s&&(this._etag=s.etag),this._sdkConfig=L(L(L({},cs),a),s?ds(s.config):{})}setConfig(e){this._sdkConfig=L(L({},this._sdkConfig),e)}getConfig(){return this._sdkConfig}refreshRemoteConfig(){var e=this;return P(function*(){if(e._remoteConfigURL)try{let t=yield e._fetchRemoteConfig(e._remoteConfigURL);if(!t){e._diag.debug(`No changes in remote config, skipping update`);return}let[n,r]=t;e._storage.setItem(ls,JSON.stringify({config:n,etag:r})),e._sdkConfig=ds(n),e._etag=r}catch(t){e._diag.warn(`Failed to refresh remote config: ${t instanceof Error?t.message:String(t)}`)}})()}_getRemoteConfigFromStorage(){try{let e=this._storage.getItem(ls);return e?JSON.parse(e):null}catch(e){return this._diag.warn(`Failed to parse remote config from storage: ${e instanceof Error?e.message:String(e)}`),null}}_fetchRemoteConfig(e){var t=this;return P(function*(){let n=yield fetch(e,{headers:t._etag?{"If-None-Match":t._etag}:{}}),r=n.headers.get(`etag`);return n.status===304?null:n.ok?[yield n.json(),r]:(t._diag.warn(`Failed to fetch remote config from ${e}: ${n.statusText}`),null)})()}};let ps={maxAllowed:{error_log:500,warning_log:200,info_log:100,exception:500,breadcrumb:100,session_property:100,span:1e3,network_request:1e4},maxLength:{error_log:128,warning_log:128,info_log:128,exception:1024,breadcrumb:256,session_property_key:128,session_property_value:256,log_attribute_key:128,log_attribute_value:256,exception_attribute_key:128,exception_attribute_value:256},maxAttributes:{error_log:50,warning_log:50,info_log:50,exception:50}},ms={info:`info_log`,warning:`warning_log`,error:`error_log`};var hs=class{constructor({diag:e,maxAllowed:t,maxLength:n,maxAttributes:r}){j(this,`_diag`,void 0),j(this,`_diagnosticCounts`,{}),j(this,`_currentCount`,{exception:0,error_log:0,warning_log:0,info_log:0,breadcrumb:0,session_property:0,span:0,network_request:0}),j(this,`_maxAllowed`,void 0),j(this,`_maxLength`,void 0),j(this,`_maxAttributes`,void 0),this._diag=e==null?E.createComponentLogger({namespace:`MXLLimitManager`}):e,this._maxAllowed=t,this._maxLength=n,this._maxAttributes=r}_dropIfMaxReached(e){return this._currentCount[e]>=this._maxAllowed[e]?(this._diag.warn(`disallowing ${e} because the maximum number of ${this._maxAllowed[e].toString()} has already been reached for this session`),this._incrDiagnosticCount(e,`drop`),!0):(this._currentCount[e]=(this._currentCount[e]||0)+1,!1)}truncateString(e,t){return t.length>this._maxLength[e]?(this._diag.warn(`truncating ${e} because it is longer than ${this._maxLength[e].toString()} characters: "${t}"`),this._incrDiagnosticCount(e,`truncate_string`),t.substring(0,this._maxLength[e])):t}_truncateAttributes(e,t,n,r){let i=Object.keys(t);i.length>this._maxAttributes[e]&&(this._diag.warn(`truncating ${e} attributes because there are more than ${this._maxAttributes[e].toString()} set`),this._incrDiagnosticCount(e,`truncate_attributes`));let a={};for(let s=0;s<Math.min(i.length,this._maxAttributes[e]);s++){var o;let e=this.truncateString(n,i[s]);a[e]=this.truncateString(r,((o=t[i[s]])==null?void 0:o.toString())||``)}return a}limitBreadcrumb(e){return this._dropIfMaxReached(`breadcrumb`)?`dropped`:{name:this.truncateString(`breadcrumb`,e)}}limitException(e,t){return this._dropIfMaxReached(`exception`)?`dropped`:{message:this.truncateString(`exception`,e),attributes:this._truncateAttributes(`exception`,t,`exception_attribute_key`,`exception_attribute_value`)}}limitLog(e,t,n){let r=ms[t];return this._dropIfMaxReached(r)?`dropped`:{message:this.truncateString(r,e),attributes:this._truncateAttributes(r,n,`log_attribute_key`,`log_attribute_value`)}}limitSessionProperty(e,t){return this._dropIfMaxReached(`session_property`)?`dropped`:{key:this.truncateString(`session_property_key`,e),value:this.truncateString(`session_property_value`,t)}}dropReadableSpan(e){let t=e.attributes[k]===A.Network?`network_request`:`span`;return this._dropIfMaxReached(t)}reset(){this._diagnosticCounts={},this._currentCount={exception:0,error_log:0,warning_log:0,info_log:0,breadcrumb:0,session_property:0,span:0,network_request:0}}_incrDiagnosticCount(e,t){let n=`mxl.app.applied_limit.${e}.${t}.count`;this._diagnosticCounts[n]=(this._diagnosticCounts[n]||0)+1}getDiagnosticCounts(){return this._diagnosticCounts}};let gs=()=>JSON.stringify(Bt._MXLFileBundleIDs||{});var _s=class e{constructor({diag:e,perf:t,spanSessionManager:n,limitManager:r,loggerProvider:i,visibilityDoc:a=window.document,storage:o=window.localStorage}){j(this,`_diag`,void 0),j(this,`_perf`,void 0),j(this,`_logger`,void 0),j(this,`_spanSessionManager`,void 0),j(this,`_limitManager`,void 0),j(this,`_visibilityDoc`,void 0),j(this,`_storage`,void 0);let s=i==null?Ya:i;this._diag=e==null?E.createComponentLogger({namespace:`MXLLogManager`}):e,this._perf=t==null?new ra:t,this._logger=s.getLogger(`mxl-web-sdk-logs`),this._spanSessionManager=n,this._limitManager=r,this._visibilityDoc=a,this._storage=o}_validateAttributes(e){return Object.prototype.toString.call(e)===`[object Object]`?e:(this._diag.warn(`attributes must be a plain object`,e),{})}static _logSeverityToSeverityNumber(e){switch(e){case`info`:return W.INFO;case`warning`:return W.WARN;default:return W.ERROR}}logException(t,{handled:n=!0,attributes:r={},timestamp:i=this._perf.getNowMillis(),handler:a=`manual`}={}){var o;let s=this._validateAttributes(r);n||this._spanSessionManager.incrSessionCountForKey(`mxl.unhandled_exceptions_count`);let c=(t==null||(o=t.constructor)==null?void 0:o.name)||typeof t,l=``,u=c,d=``,f=``;if(t instanceof Error)l=String(t.message||``).trim(),u=t.name||``,d=t.stack||``,f=t.cause?`present`:``;else if(t&&typeof t==`object`)try{l=JSON.stringify(t)}catch(e){l=String(t).trim()}else l=String(t).trim();let p=this._limitManager.limitException(l,s);p!==`dropped`&&this._logger.emit({timestamp:i,severityNumber:W.ERROR,severityText:`ERROR`,body:p.message,attributes:L(L({},p.attributes),{},{[k]:A.SystemException,"mxl.exception_handling":e._exceptionHandlingType(n,a),"mxl.exception_cause":f,[M]:c,"exception.name":u,[$t]:p.message,[en]:d,[Nt]:gs(),[jt]:zt(this._visibilityDoc),"mxl.exception_number":At(this._storage,`mxl_exception_number`,this._diag)})})}message(e,t,{attributes:n={},includeStacktrace:r=!0,stacktrace:i}={}){if(typeof e!=`string`||!e.trim()){this._diag.warn(`Message must be a non-empty string`);return}if(![`info`,`warning`,`error`].includes(t)){this._diag.warn(`Severity must be info, warning, or error`);return}let a=this._validateAttributes(n);t===`error`&&this._spanSessionManager.incrSessionCountForKey(`mxl.error_log_count`);let o=``;t!==`info`&&(typeof i==`string`?o=i:r&&(o=Error().stack||``)),this._logMessage({message:e.trim(),severity:t,timestamp:this._perf.getNowMillis(),attributes:a,stack:o})}_logMessage({message:t,severity:n,timestamp:r,attributes:i={},stack:a}){let o=this._limitManager.limitLog(t,n,i);o!==`dropped`&&this._logger.emit({timestamp:r,severityNumber:e._logSeverityToSeverityNumber(n),severityText:n.toUpperCase(),body:o.message,attributes:L(L(L({},o.attributes),{},{[k]:A.SystemLog},a?{"mxl.stacktrace.js":a,[Nt]:gs()}:{}),{},{[jt]:zt(this._visibilityDoc)})})}static _exceptionHandlingType(e,t){return e?`handled`:t===`global_exception`?`unhandled_error`:t===`promise_rejection`?`unhandled_rejection`:`unhandled`}},vs=class{constructor({useDocumentTitleAsPageLabel:e=!0,titleDocument:t=window.document}={}){j(this,`_currentRoute`,null),j(this,`_currentPageId`,null),j(this,`_pageLabel`,null),j(this,`_titleDocument`,void 0),j(this,`_useDocumentTitleAsPageLabel`,void 0),j(this,`getCurrentPageId`,()=>this._currentPageId),j(this,`getCurrentRoute`,()=>this._currentRoute),j(this,`setPageLabel`,e=>{this._pageLabel=e}),j(this,`getPageLabel`,()=>this._pageLabel||(!this._useDocumentTitleAsPageLabel||!this._titleDocument?null:this._titleDocument.title)),j(this,`setCurrentRoute`,e=>{(!this._currentRoute||this._currentRoute.url!==e.url)&&(this._currentPageId=kt()),this._currentRoute=e,e.label?this._pageLabel=e.label:this._pageLabel=null}),j(this,`clearCurrentRoute`,()=>{this._currentRoute=null,this._currentPageId=null,this._pageLabel=null}),this._useDocumentTitleAsPageLabel=e,this._titleDocument=t}},ys=class{constructor({dynamicConfigManager:e,deviceId:t,blockNetworkSpanForwarding:n}){j(this,`_dynamicConfigManager`,void 0),j(this,`_deviceId`,void 0),j(this,`_blockNetworkSpanForwarding`,void 0),this._dynamicConfigManager=e,this._deviceId=t,this._blockNetworkSpanForwarding=n}isSDKEnabled(){let e=this._dynamicConfigManager.getConfig();return Vt(this._deviceId,e.samplingPct)}isNetworkSpanForwardingEnabled(){if(this._blockNetworkSpanForwarding)return!1;let e=this._dynamicConfigManager.getConfig();return Vt(this._deviceId,e.networkSpansForwardingThreshold)}isEmptySessionAvoidanceEnabled(){let e=this._dynamicConfigManager.getConfig();return Vt(this._deviceId,e.emptySessionAvoidanceEnabledPct)}};let bs=`0.0.8`,xs=`mxl-web-sdk`,Ss=`mxl_app_instance_id`,Cs=(e,t)=>{let n=null;try{n=e.getItem(Ss)}catch(e){t.warn(`Failed to retrieve app instance ID from session storage`,e)}if(!n){t.debug(`No existing app instance ID found in session storage, creating a new one`),n=kt();try{e.setItem(Ss,n)}catch(e){t.warn(`Failed to persist app instance ID to session storage`,e)}}return n},ws=({diagLogger:e,appVersion:t,pageSessionStorage:n})=>Rn({[sn]:xs,[un]:xs,app_version:t,app_framework:1,sdk_version:bs,[dn]:bs,sdk_simple_version:1,sdk_platform:`web`,[cn]:`webjs`,"mxl.app_instance_id":Cs(n,e),[fn]:window.navigator.userAgent,screen_resolution:`${window.screen.width}x${window.screen.height}`});var Ts=class{constructor(e){j(this,`_span`,void 0),this._span=e}get attributes(){return this._span.attributes}addEvent(e,t,n){return this._span.addEvent(e,t,n),this}addLink(e){return this._span.addLink(e),this}addLinks(e){return this._span.addLinks(e),this}end(e){this._span.end(e)}isRecording(){return this._span.isRecording()}recordException(e,t){this._span.recordException(e,t)}setAttribute(e,t){return this._span.setAttribute(e,t),this}setAttributes(e){return this._span.setAttributes(e),this}removeAttribute(e){let t=this._span.attributes,{[e]:n}=t,r=ts(t,[e].map(Jt));return this._span.attributes=r,this}setStatus(e){return this._span.setStatus(e),this}spanContext(){return this._span.spanContext()}updateName(e){return this._span.updateName(e),this}fail(e={code:`failure`}){e.code&&this._span.setAttribute(`mxl.error_code`,e.code.toUpperCase()),this._span.end(e.endTime)}};let Es=`mxl_tab`,Ds=`mxl_tab_activity`;var Os=class{constructor({diag:e,perf:t,visibilityDoc:n=window.document,storage:r=window.localStorage,sessionStorage:i=window.sessionStorage,limitManager:a,referrer:o=document.referrer}){j(this,`_previousSessionId`,null),j(this,`_activeSessionId`,null),j(this,`_activeSessionStartTime`,null),j(this,`_sessionSpan`,null),j(this,`_activeSessionCounts`,null),j(this,`_nextSessionCounts`,{}),j(this,`_coldStart`,!0),j(this,`_sdkStartupDuration`,0),j(this,`_sessionStartedListeners`,[]),j(this,`_sessionEndedListeners`,[]),j(this,`_tab`,void 0),j(this,`_navigationSource`,void 0),j(this,`_referrerInfo`,void 0),j(this,`_tracer`,void 0),j(this,`_noExportTracer`,void 0),j(this,`_diag`,void 0),j(this,`_perf`,void 0),j(this,`_visibilityDoc`,void 0),j(this,`_storage`,void 0),j(this,`_sessionStorage`,void 0),j(this,`_limitManager`,void 0),j(this,`_referrer`,void 0),this._diag=e==null?E.createComponentLogger({namespace:`MXLSpanSessionManager`}):e,this._perf=t==null?new ra:t,this._visibilityDoc=n,this._storage=r,this._sessionStorage=i,this._limitManager=a,this._referrer=o,this._tracer=O.getTracer(`mxl-web-sdk-sessions`),this._noExportTracer=new Ri().getTracer(`mxl-web-sdk-sessions`),this._referrerInfo=this._processReferrer();let s=this._initTab();this._tab=s.tab,this._navigationSource=s.navigationSource,this._setupNewTabClickListeners()}_getPermanentAttributes(){let e=new Map;try{for(let t=0;t<this._storage.length;t++){let n=this._storage.key(t);if(n!=null&&n.startsWith(Mt)){let t=this._storage.getItem(n);t&&e.set(n,t)}}}catch(e){this._diag.warn(`Error loading permanent session properties`,e)}return Object.fromEntries(e.entries())}addBreadcrumb(e){if(!this._sessionSpan){this._diag.debug(`trying to add breadcrumb to a session, but there is no session in progress. This is a no-op.`);return}let t=this._limitManager.limitBreadcrumb(e);t!==`dropped`&&this._sessionSpan.addEvent(`mxl-breadcrumb`,{message:t.name},this._perf.getNowMillis())}addProperty(e,t,n){if(!this._sessionSpan){this._diag.debug(`trying to add properties to a session, but there is no session in progress. This is a no-op.`);return}let r=this._limitManager.limitSessionProperty(e,t);if(r===`dropped`)return;let i=Mt+r.key;if(this._sessionSpan.setAttribute(i,r.value),(n==null?void 0:n.lifespan)===`permanent`)try{this._storage.setItem(i,t)}catch(e){this._diag.warn(`Failed to set permanent session property`,e)}}removeProperty(e){if(!this._sessionSpan){this._diag.debug(`trying to remove a session property, but there is no session in progress. This is a no-op.`);return}let t=Mt+this._limitManager.truncateString(`session_property_key`,e);this._sessionSpan.removeAttribute(t);try{this._storage.getItem(t)&&this._storage.removeItem(t)}catch(e){this._diag.warn(`Error removing permanent session property`,e)}}endSessionSpan(){this.endSessionSpanInternal(`manual`)}endSessionSpanInternal(e){if(!this._sessionSpan){this._diag.debug(`trying to end a session, but there is no session in progress. This is a no-op.`);return}for(let e of this._sessionEndedListeners)try{e()}catch(e){this._diag.warn(`Error while executing session ended listener`,e)}this._sessionSpan.setAttributes(this._endSessionSpanAttributes(e)),this._sessionSpan.end(),this._sessionSpan=null,this._activeSessionStartTime=null,this._previousSessionId=this._activeSessionId,this._activeSessionId=null,this._activeSessionCounts=null,this._limitManager.reset()}_endSessionSpanAttributes(e){return L(L(L(L({},this._getPermanentAttributes()),{},{"mxl.session_end_type":e},this._activeSessionCounts),this._limitManager.getDiagnosticCounts()),{},{"mxl.sdk_startup_duration":this._sdkStartupDuration})}currentSessionAsReadableSpan(e){if(!this._sessionSpan||!this._activeSessionStartTime)return this._diag.debug(`trying to end a session, but there is no session in progress. This is a no-op.`),null;let t=this._noExportTracer.startSpan(`mxl-session`,{startTime:this._activeSessionStartTime,attributes:L(L(L({},this._sessionSpan.attributes),this._endSessionSpanAttributes(e)),{},{"mxl.from_storage":!0})});return t.end(),t}getSessionId(){return this._activeSessionId}getPreviousSessionId(){return this._previousSessionId}getSessionSpan(){return this._sessionSpan}getSessionStartTime(){return this._activeSessionStartTime}startSessionSpan(e){this._sessionSpan&&this.endSessionSpanInternal(`manual`),this._activeSessionId=kt(),this._activeSessionStartTime=this._perf.getNowHRTime(),this._activeSessionCounts={};let t=this._nextSessionCounts;this._nextSessionCounts={};let n=L(L({},this._getPermanentAttributes()),{},{[k]:A.Session,[jt]:zt(this._visibilityDoc),[ro]:this._activeSessionId,"mxl.cold_start":this._coldStart,"mxl.session_number":At(this._storage,`mxl_session_number`,this._diag),"mxl.experience_id":this._tab.experienceId,"mxl.tab_id":this._tab.tabId,"mxl.navigation_source":this._navigationSource},t);this._referrerInfo.isValid&&this._referrerInfo.scrubbedUrl&&(n[`mxl.referrer_url`]=this._referrerInfo.scrubbedUrl),this._tab.sourceTabId&&(n[`mxl.source_tab_id`]=this._tab.sourceTabId),e!=null&&e.reason&&(n[`mxl.session_start_type`]=e.reason),this._sessionSpan=new Ts(this._tracer.startSpan(`mxl-session`,{attributes:n})),this._coldStart=!1;for(let e of this._sessionStartedListeners)try{e()}catch(e){this._diag.warn(`Error while executing session started listener`,e)}}incrSessionCountForKey(e){if(!this._sessionSpan||!this._activeSessionCounts){this._diag.debug(`trying to increment a count for the active session, but there is no session in progress. This is a no-op.`);return}this._activeSessionCounts[e]=(this._activeSessionCounts[e]||0)+1}incrNextSessionCountForKey(e){this._nextSessionCounts[e]=(this._nextSessionCounts[e]||0)+1}addSessionStartedListener(e){let t=this._sessionStartedListeners.push(e);return()=>{this._sessionStartedListeners.splice(t-1,1)}}addSessionEndedListener(e){let t=this._sessionEndedListeners.push(e);return()=>{this._sessionEndedListeners.splice(t-1,1)}}recordSDKStartupDuration(e){this._sdkStartupDuration=Math.ceil(e)}setTracerProvider(e){this._tracer=e.getTracer(`mxl-web-sdk-sessions`)}_determineNavigationSource(){try{let e=window.performance.getEntriesByType(`navigation`);if(e.length>0&&e[0]){let t=e[0];if(t.type===`reload`)return`reload`;if(t.type===`back_forward`)return`back_forward`}}catch(e){this._diag.warn(`Failed to get navigation type`,e)}return this._referrerInfo.isValid?this._referrerInfo.isSameOrigin?`same_origin`:`external`:`direct`}_processReferrer(){if(!this._referrer)return{isValid:!1,isSameOrigin:!1};try{let e=new URL(this._referrer),t=window.location.origin;return{isValid:!0,isSameOrigin:e.origin===t,scrubbedUrl:e.origin+e.pathname}}catch(e){return{isValid:!1,isSameOrigin:!1}}}_getTabContext(e){let t=Cs(this._sessionStorage,this._diag),n,r;if(e===`same_origin`){let e=this._getTabActivity();e&&Date.now()-e.lastActivityMs<=1e4&&(n=e.tabId,r=e.experienceId)}return r!=null||(r=kt()),{sourceTabId:n,experienceId:r,tabId:t}}_initTab(){let e=this._determineNavigationSource();try{let t=this._sessionStorage.getItem(Es);if(t)return{tab:JSON.parse(t),navigationSource:e}}catch(e){this._diag.warn(`Failed to retrieve tab data`,e)}let t=this._getTabContext(e),n={experienceId:t.experienceId,sourceTabId:t.sourceTabId,tabId:t.tabId};try{this._sessionStorage.setItem(Es,JSON.stringify(n))}catch(e){this._diag.warn(`Failed to store tab data`,e)}return{tab:n,navigationSource:e}}_getTabActivity(){try{let e=this._storage.getItem(Ds);return e?JSON.parse(e):null}catch(e){return this._diag.warn(`Failed to retrieve tab activity`,e),null}}_storeTabActivity(e){try{this._storage.setItem(Ds,JSON.stringify(e))}catch(e){this._diag.warn(`Failed to save tab activity`,e)}}_storeCurrentTabAsSource(){let e={tabId:this._tab.tabId,experienceId:this._tab.experienceId,lastActivityMs:Date.now()};this._storeTabActivity(e)}_setupNewTabClickListeners(){let e=e=>{var t;if(e.button===1||e.ctrlKey||e.metaKey||e.shiftKey){this._storeCurrentTabAsSource();return}(t=e.target)!=null&&t.closest(`a[target="_blank"], form[target="_blank"], a[rel*="noopener"], a[rel*="noreferrer"]`)&&this._storeCurrentTabAsSource()},t={capture:!0,passive:!0};document.addEventListener(`auxclick`,e,t),document.addEventListener(`click`,e,t)}},ks=class{constructor({tracerProvider:e}={}){j(this,`_tracer`,void 0),j(this,`setSpan`,O.setSpan),this._tracer=(e==null?O:e).getTracer(`mxl-web-sdk-traces`)}startSpan(e,t={},n){t.attributes=t.attributes?t.attributes:{},t.attributes[k]=A.Perf;let r=t.parentSpan?O.setSpan(T.active(),t.parentSpan):n;return new Ts(this._tracer.startSpan(e,t,r))}getSpan(e){let t=O.getSpan(e);if(t)return new Ts(t)}};let As=`mxl_user`,js=`mxl_user_id`,Ms=`mxl_external_user_id`,Ns=e=>typeof e[Na]==`string`&&e[Na].length===32,Ps=e=>typeof e==`string`&&e.length===32;var Fs=class{constructor({diag:e,storage:t=window.localStorage}={}){j(this,`_diag`,void 0),j(this,`_storage`,void 0),j(this,`_mxlUserId`,null),this._diag=e==null?E.createComponentLogger({namespace:`MXLUserManager`}):e,this._storage=t,this._migrateOldLocalStorageKey(),this._initialSetup()}getMXLUserId(){return this._mxlUserId||this._generateNewMXLUserId()}setMXLUserId(e){this._mxlUserId=e;try{this._storage.setItem(js,e)}catch(e){this._diag.warn(`Failed to persist user object for storage, keeping it in-memory only`,e)}}clearMXLUserId(){this._mxlUserId=null;try{this._storage.removeItem(js)}catch(e){this._diag.warn(`Failed to remove mxl user in storage`,e)}}_migrateOldLocalStorageKey(){try{let e=this._storage.getItem(As);if(e){let t=JSON.parse(e);Ns(t)?(this._diag.debug(`Migrating old user data from storage`),this._storage.setItem(js,t[Na]),this._storage.removeItem(As)):(this._diag.warn(`Invalid user data found in storage, clearing old user data`),this._storage.removeItem(As))}}catch(e){this._diag.warn(`Failed to get old user data from storage`,e)}}_initialSetup(){try{let e=this._storage.getItem(js);e?Ps(e)?this._mxlUserId=e:(this._diag.warn(`Invalid mxl user id, generating a new one`),this.clearMXLUserId()):this._diag.debug(`No existing user found in storage, creating a new one`)}catch(e){this._diag.warn(`Failed to get mxl user id from storage, defaulting to a new one`,e)}this._mxlUserId||(this._mxlUserId=this._generateNewMXLUserId())}_generateNewMXLUserId(){let e=kt();return this.setMXLUserId(e),e}getUserId(){try{return this._storage.getItem(Ms)}catch(e){return this._diag.warn(`Failed to retrieve user id from storage`,e),null}}setUserId(e){try{this._storage.setItem(Ms,e)}catch(e){this._diag.warn(`Failed to store user id`,e)}}clearUserId(){try{this._storage.removeItem(Ms)}catch(e){this._diag.warn(`Failed to clear user id`,e)}}};let Is=[`keydown`,`mousedown`,`mousemove`,`scroll`];var Ls=class extends G{constructor({diag:e}={}){super({instrumentationName:`SpanSessionBrowserActivityInstrumentation`,instrumentationVersion:`1.0.0`,diag:e,config:{}}),j(this,`_onActivityThrottled`,void 0),j(this,`_activityTimeout`,void 0),j(this,`disable`,()=>{Tt({target:window,events:Is,callback:this._onActivityThrottled}),this._activityTimeout&&clearTimeout(this._activityTimeout),this._activityTimeout=null}),j(this,`enable`,()=>{wt({target:window,events:Is,callback:this._onActivityThrottled})}),j(this,`_onInactivity`,()=>{this._diag.debug(`Inactivity detected`),this._activityTimeout&&clearTimeout(this._activityTimeout),this._activityTimeout=null,this.sessionManager.endSessionSpanInternal(`inactivity`)}),j(this,`_onActivity`,()=>{this._diag.debug(`Activity detected`),this._activityTimeout&&clearTimeout(this._activityTimeout),this.sessionManager.getSessionId()||this.sessionManager.startSessionSpan({reason:`activity`}),this._activityTimeout=setTimeout(this._onInactivity,18e5)}),this._activityTimeout=null,this._onActivityThrottled=ia(this._onActivity,3e4),this._config.enabled&&this.enable()}},Rs=class extends G{constructor({diag:e}={}){super({instrumentationName:`SpanSessionOnLoadInstrumentation`,instrumentationVersion:`1.0.0`,diag:e,config:{}}),this._config.enabled&&this.enable()}disable(){this.sessionManager.endSessionSpanInternal(`unknown`)}enable(){this.sessionManager.startSessionSpan({reason:`init`})}};let zs=14400*1e3;var Bs=class extends G{constructor({diag:e,perf:t}={}){super({instrumentationName:`SpanSessionTimeoutInstrumentation`,instrumentationVersion:`1.0.0`,diag:e,perf:t,config:{}}),j(this,`_sessionTimeout`,void 0),j(this,`disable`,()=>{this._sessionTimeout&&clearTimeout(this._sessionTimeout),this._sessionTimeout=null}),j(this,`enable`,()=>{this._checkTimeout()}),j(this,`_onTimeout`,()=>{this._diag.debug(`Timeout detected`),this._sessionTimeout&&clearTimeout(this._sessionTimeout),this.sessionManager.endSessionSpanInternal(`timer`),this.sessionManager.startSessionSpan({reason:`timer`}),this._sessionTimeout=setTimeout(this._checkTimeout,zs)}),j(this,`_checkTimeout`,()=>{let e=this.sessionManager.getSessionStartTime();if(e){let t=zs-this.perf.millisSinceHRTime(e);if(t<=0){this._onTimeout();return}this._sessionTimeout&&clearTimeout(this._sessionTimeout),this._sessionTimeout=setTimeout(this._checkTimeout,t);return}this._sessionTimeout&&clearTimeout(this._sessionTimeout),this._sessionTimeout=setTimeout(this._checkTimeout,zs)}),this._sessionTimeout=null,this._config.enabled&&this.enable()}};let Vs=[`mousedown`];var Hs=class extends G{constructor({diag:e,perf:t,visibilityWaitTimeMs:n=0,limitedSessionMaxDurationMs:r=5e3,backgroundSessions:i=!1,maxPendingSpanCount:a=5,visibilityDoc:o=window.document}={},s,c){super({instrumentationName:`SpanSessionVisibilityInstrumentation`,instrumentationVersion:`1.0.0`,diag:e,perf:t,config:{}}),j(this,`_currentVisibilityState`,void 0),j(this,`_checkVisibilityTimeout`,void 0),j(this,`_interactionSinceLastVisibilityChange`,void 0),j(this,`_avoidEndingLimitedSessions`,void 0),j(this,`_mxlSpanProcessor`,void 0),j(this,`_checkVisibilityChange`,void 0),j(this,`_onVisibilityChange`,void 0),j(this,`_onInteractionThrottled`,void 0),this._currentVisibilityState=o.visibilityState,this._checkVisibilityTimeout=null,this._interactionSinceLastVisibilityChange=!1,this._avoidEndingLimitedSessions=r>0&&s.isEmptySessionAvoidanceEnabled(),this._mxlSpanProcessor=c,this._checkVisibilityChange=()=>{if(n<=0){this._currentVisibilityState=o.visibilityState,this._onVisibilityChange();return}if(this._checkVisibilityTimeout&&clearTimeout(this._checkVisibilityTimeout),o.visibilityState===`visible`&&this._currentVisibilityState!==o.visibilityState){this._currentVisibilityState=o.visibilityState,this._onVisibilityChange();return}this._diag.debug(`Visibility changed to ${o.visibilityState}. Will wait ${(n/1e3).toString()}s, and check if visibility changed`),this._checkVisibilityTimeout=setTimeout(()=>{this._currentVisibilityState===o.visibilityState?this._diag.debug(`Visibility was not changed after timeout happened: ${o.visibilityState}`):(this._currentVisibilityState=o.visibilityState,this._onVisibilityChange())},n)},this._onVisibilityChange=()=>{this._diag.debug(`Visibility change detected: ${o.visibilityState}`);let e=this.sessionManager.getSessionStartTime();if(this._avoidEndingLimitedSessions&&e!==null&&this.perf.millisSinceHRTime(e)<r&&!this._interactionSinceLastVisibilityChange&&this._mxlSpanProcessor&&this._mxlSpanProcessor.getPendingSpansCount()<a){this._diag.debug(`Not ending the session since it is considered limited`),this.sessionManager.addBreadcrumb(`Tab visibility changed to ${o.visibilityState}`);let e=this.sessionManager.getSessionId();if(e){let t=this.sessionManager.currentSessionAsReadableSpan(`state_changed`);t&&this._mxlSpanProcessor.storePendingSpans(e,t)}}else{let e=this.sessionManager.getSessionId();this._mxlSpanProcessor&&e&&this._mxlSpanProcessor.clearStoredSpans(e),this.sessionManager.endSessionSpanInternal(`state_changed`),o.visibilityState===`hidden`&&i?(this._diag.debug("Starting a session since document visibility switched to hidden and `backgroundSessions` is enabled"),this.sessionManager.startSessionSpan({reason:`hidden`})):o.visibilityState===`visible`&&(this._diag.debug(`Starting a session since document visibility switched to visible`),this.sessionManager.startSessionSpan({reason:`visible`}))}this._interactionSinceLastVisibilityChange=!1},this._onInteractionThrottled=ia(()=>{this._interactionSinceLastVisibilityChange=!0},1e3),this._config.enabled&&this.enable()}disable(){window.removeEventListener(`visibilitychange`,this._checkVisibilityChange),this._avoidEndingLimitedSessions&&Tt({target:window,events:Vs,callback:this._onInteractionThrottled})}enable(){window.addEventListener(`visibilitychange`,this._checkVisibilityChange),this._avoidEndingLimitedSessions&&wt({target:window,events:Vs,callback:this._onInteractionThrottled})}},Us=class{constructor(){j(this,`t`,void 0),j(this,`o`,0),j(this,`i`,[])}u(e){var t;if(e.hadRecentInput)return;let n=this.i[0],r=this.i.at(-1);this.o&&n&&r&&e.startTime-r.startTime<1e3&&e.startTime-n.startTime<5e3?(this.o+=e.value,this.i.push(e)):(this.o=e.value,this.i=[e]),(t=this.t)==null||t.call(this,e)}};let Ws=()=>{let e=performance.getEntriesByType(`navigation`)[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Gs=e=>{if(document.readyState===`loading`)return`loading`;{let t=Ws();if(t){if(e<t.domInteractive)return`loading`;if(t.domContentLoadedEventStart===0||e<t.domContentLoadedEventStart)return`dom-interactive`;if(t.domComplete===0||e<t.domComplete)return`dom-content-loaded`}}return`complete`},Ks=e=>{let t=e.nodeName;return e.nodeType===1?t.toLowerCase():t.toUpperCase().replace(/^#/,``)},qs=e=>{let t=``;try{for(;(e==null?void 0:e.nodeType)!==9;){let n=e,r=n.id?`#`+n.id:[Ks(n),...Array.from(n.classList).sort()].join(`.`);if(t.length+r.length>99)return t||r;if(t=t?r+`>`+t:r,n.id)break;e=n.parentNode}}catch(e){}return t},Js=new WeakMap;function Ys(e,t){return Js.get(e)||Js.set(e,new t),Js.get(e)}let Xs=-1,Zs=()=>Xs,Qs=e=>{addEventListener(`pageshow`,(t=>{t.persisted&&(Xs=t.timeStamp,e(t))}),!0)},J=(e,t,n,r)=>{let i,a;return o=>{var s;t.value>=0&&(o||r)&&(a=t.value-((s=i)==null?0:s),(a||i===void 0)&&(i=t.value,t.delta=a,t.rating=((e,t)=>e>t[1]?`poor`:e>t[0]?`needs-improvement`:`good`)(t.value,n),e(t)))}},$s=e=>{requestAnimationFrame((()=>requestAnimationFrame((()=>e()))))},ec=()=>{var e;let t=Ws();return(e=t==null?void 0:t.activationStart)==null?0:e},Y=(e,t=-1)=>{let n=Ws(),r=`navigate`;return Zs()>=0?r=`back-forward-cache`:n&&(document.prerendering||ec()>0?r=`prerender`:document.wasDiscarded?r=`restore`:n.type&&(r=n.type.replace(/_/g,`-`))),{name:e,value:t,rating:`good`,delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+0xe8d4a51000}`,navigationType:r}},tc=(e,t,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){let r=new PerformanceObserver((e=>{Promise.resolve().then((()=>{t(e.getEntries())}))}));return r.observe(L({type:e,buffered:!0},n)),r}}catch(e){}},nc=e=>{let t=!1;return()=>{t||(e(),t=!0)}},rc=-1,ic=new Set,ac=()=>document.visibilityState!==`hidden`||document.prerendering?1/0:0,oc=e=>{if(document.visibilityState===`hidden`){if(e.type===`visibilitychange`)for(let e of ic)e();isFinite(rc)||(rc=e.type===`visibilitychange`?e.timeStamp:0,removeEventListener(`prerenderingchange`,oc,!0))}},sc=()=>{if(rc<0){var e;let t=ec(),n=document.prerendering||(e=globalThis.performance.getEntriesByType(`visibility-state`).filter((e=>e.name===`hidden`&&e.startTime>t))[0])==null?void 0:e.startTime;rc=n==null?ac():n,addEventListener(`visibilitychange`,oc,!0),addEventListener(`prerenderingchange`,oc,!0),Qs((()=>{setTimeout((()=>{rc=ac()}))}))}return{get firstHiddenTime(){return rc},onHidden(e){ic.add(e)}}},cc=e=>{document.prerendering?addEventListener(`prerenderingchange`,(()=>e()),!0):e()},lc=[1800,3e3],uc=(e,t={})=>{cc((()=>{let n=sc(),r,i=Y(`FCP`),a=tc(`paint`,(e=>{for(let t of e)t.name===`first-contentful-paint`&&(a.disconnect(),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-ec(),0),i.entries.push(t),r(!0)))}));a&&(r=J(e,i,lc,t.reportAllChanges),Qs((n=>{i=Y(`FCP`),r=J(e,i,lc,t.reportAllChanges),$s((()=>{i.value=performance.now()-n.timeStamp,r(!0)}))})))}))},dc=[.1,.25],fc=e=>e.find((e=>{var t;return((t=e.node)==null?void 0:t.nodeType)===1}))||e[0],pc=(e,t={})=>{let n=Ys(t=Object.assign({},t),Us),r=new WeakMap;n.t=e=>{var n;if(!(e==null||(n=e.sources)==null)&&n.length){let n=fc(e.sources),o=n==null?void 0:n.node;if(o){var i,a;let e=(i=(a=t.generateTarget)==null?void 0:a.call(t,o))==null?qs(o):i;r.set(n,e)}}},((e,t={})=>{let n=sc();uc(nc((()=>{let r,i=Y(`CLS`,0),a=Ys(t,Us),o=e=>{for(let t of e)a.u(t);a.o>i.value&&(i.value=a.o,i.entries=a.i,r())},s=tc(`layout-shift`,o);s&&(r=J(e,i,dc,t.reportAllChanges),n.onHidden((()=>{o(s.takeRecords()),r(!0)})),Qs((()=>{a.o=0,i=Y(`CLS`,0),r=J(e,i,dc,t.reportAllChanges),$s((()=>r()))})),setTimeout(r))})))})((t=>{e((e=>{let t={};if(e.entries.length){var n;let i=e.entries.reduce(((e,t)=>e.value>t.value?e:t));if(!(i==null||(n=i.sources)==null)&&n.length){let e=fc(i.sources);e&&(t={largestShiftTarget:r.get(e),largestShiftTime:i.startTime,largestShiftValue:i.value,largestShiftSource:e,largestShiftEntry:i,loadState:Gs(i.startTime)})}}return Object.assign(e,{attribution:t})})(t))}),t)},mc=(e,t={})=>{uc((t=>{e((e=>{let t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:Gs(Zs())};if(e.entries.length){let n=Ws(),r=e.entries.at(-1);if(n){let i=n.activationStart||0,a=Math.max(0,n.responseStart-i);t={timeToFirstByte:a,firstByteToFCP:e.value-a,loadState:Gs(e.entries[0].startTime),navigationEntry:n,fcpEntry:r}}}return Object.assign(e,{attribution:t})})(t))}),t)},hc=0,gc=1/0,_c=0,vc=e=>{for(let t of e)t.interactionId&&(gc=Math.min(gc,t.interactionId),_c=Math.max(_c,t.interactionId),hc=_c?(_c-gc)/7+1:0)},yc,bc=()=>{var e;return yc?hc:(e=performance.interactionCount)==null?0:e},xc=()=>{`interactionCount`in performance||yc||(yc=tc(`event`,vc,{type:`event`,buffered:!0,durationThreshold:0}))},Sc=0;var Cc=class{constructor(){j(this,`l`,[]),j(this,`h`,new Map),j(this,`m`,void 0),j(this,`p`,void 0)}v(){Sc=bc(),this.l.length=0,this.h.clear()}M(){let e=Math.min(this.l.length-1,Math.floor((bc()-Sc)/50));return this.l[e]}u(e){var t;if((t=this.m)==null||t.call(this,e),!e.interactionId&&e.entryType!==`first-input`)return;let n=this.l.at(-1),r=this.h.get(e.interactionId);if(r||this.l.length<10||e.duration>n.T){var i;if(r?e.duration>r.T?(r.entries=[e],r.T=e.duration):e.duration===r.T&&e.startTime===r.entries[0].startTime&&r.entries.push(e):(r={id:e.interactionId,entries:[e],T:e.duration},this.h.set(r.id,r),this.l.push(r)),this.l.sort(((e,t)=>t.T-e.T)),this.l.length>10){let e=this.l.splice(10);for(let t of e)this.h.delete(t.id)}(i=this.p)==null||i.call(this,r)}}};let wc=e=>{let t=globalThis.requestIdleCallback||setTimeout;document.visibilityState===`hidden`?e():(e=nc(e),addEventListener(`visibilitychange`,e,{once:!0,capture:!0}),t((()=>{e(),removeEventListener(`visibilitychange`,e,{capture:!0})})))},Tc=[200,500],Ec=(e,t={})=>{let n=Ys(t=Object.assign({},t),Cc),r=[],i=[],a=0,o=new WeakMap,s=new WeakMap,c=!1,l=()=>{c||(wc(u),c=!0)},u=()=>{let e=n.l.map((e=>o.get(e.entries[0]))),t=i.length-50;i=i.filter(((n,r)=>r>=t||e.includes(n)));let s=new Set;for(let e of i){let t=d(e.startTime,e.processingEnd);for(let e of t)s.add(e)}let l=r.length-1-50;r=r.filter(((e,t)=>e.startTime>a&&t>l||s.has(e))),c=!1};n.m=e=>{let t=e.startTime+e.duration,n;a=Math.max(a,e.processingEnd);for(let r=i.length-1;r>=0;r--){let a=i[r];if(Math.abs(t-a.renderTime)<=8){n=a,n.startTime=Math.min(e.startTime,n.startTime),n.processingStart=Math.min(e.processingStart,n.processingStart),n.processingEnd=Math.max(e.processingEnd,n.processingEnd),n.entries.push(e);break}}n||(n={startTime:e.startTime,processingStart:e.processingStart,processingEnd:e.processingEnd,renderTime:t,entries:[e]},i.push(n)),(e.interactionId||e.entryType===`first-input`)&&o.set(e,n),l()},n.p=e=>{if(!s.get(e)){let i=e.entries[0].target;if(i){var n,r;let a=(n=(r=t.generateTarget)==null?void 0:r.call(t,i))==null?qs(i):n;s.set(e,a)}}};let d=(e,t)=>{let n=[];for(let i of r)if(!(i.startTime+i.duration<e)){if(i.startTime>t)break;n.push(i)}return n},f=e=>{let t=e.entries[0],r=o.get(t),i=t.processingStart,a=Math.max(t.startTime+t.duration,i),c=Math.min(r.processingEnd,a),l=r.entries.sort(((e,t)=>e.processingStart-t.processingStart)),u=d(t.startTime,c),f=n.h.get(t.interactionId),p={interactionTarget:s.get(f),interactionType:t.name.startsWith(`key`)?`keyboard`:`pointer`,interactionTime:t.startTime,nextPaintTime:a,processedEventEntries:l,longAnimationFrameEntries:u,inputDelay:i-t.startTime,processingDuration:c-i,presentationDelay:a-c,loadState:Gs(t.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(e=>{var t;if(!((t=e.longAnimationFrameEntries)!=null&&t.length))return;let n=e.interactionTime,r=e.inputDelay,i=e.processingDuration,a,o,s=0,c=0,l=0,u=0;for(let t of e.longAnimationFrameEntries){c=c+t.startTime+t.duration-t.styleAndLayoutStart;for(let e of t.scripts){let t=e.startTime+e.duration;if(t<n)continue;let l=t-Math.max(n,e.startTime),d=e.duration?l/e.duration*e.forcedStyleAndLayoutDuration:0;s+=l-d,c+=d,l>u&&(o=e.startTime<n+r?`input-delay`:e.startTime>=n+r+i?`presentation-delay`:`processing-duration`,a=e,u=l)}}let d=e.longAnimationFrameEntries.at(-1),f=d?d.startTime+d.duration:0;f>=n+r+i&&(l=e.nextPaintTime-f),a&&o&&(e.longestScript={entry:a,subpart:o,intersectingDuration:u}),e.totalScriptDuration=s,e.totalStyleAndLayoutDuration=c,e.totalPaintDuration=l,e.totalUnattributedDuration=e.nextPaintTime-n-s-c-l})(p),Object.assign(e,{attribution:p})};tc(`long-animation-frame`,(e=>{r=r.concat(e),l()})),((e,t={})=>{if(!globalThis.PerformanceEventTiming||!(`interactionId`in PerformanceEventTiming.prototype))return;let n=sc();cc((()=>{var r;xc();let i,a=Y(`INP`),o=Ys(t,Cc),s=e=>{wc((()=>{for(let t of e)o.u(t);let t=o.M();t&&t.T!==a.value&&(a.value=t.T,a.entries=t.entries,i())}))},c=tc(`event`,s,{durationThreshold:(r=t.durationThreshold)==null?40:r});i=J(e,a,Tc,t.reportAllChanges),c&&(c.observe({type:`first-input`,buffered:!0}),n.onHidden((()=>{s(c.takeRecords()),i(!0)})),Qs((()=>{o.v(),a=Y(`INP`),i=J(e,a,Tc,t.reportAllChanges)})))}))})((t=>{e(f(t))}),t)};var Dc=class{constructor(){j(this,`m`,void 0)}u(e){var t;(t=this.m)==null||t.call(this,e)}};let Oc=[2500,4e3],kc=(e,t={})=>{let n=Ys(t=Object.assign({},t),Dc),r=new WeakMap;n.m=e=>{let n=e.element;if(n){var i,a;let o=(i=(a=t.generateTarget)==null?void 0:a.call(t,n))==null?qs(n):i;r.set(e,o)}},((e,t={})=>{cc((()=>{let n=sc(),r,i=Y(`LCP`),a=Ys(t,Dc),o=e=>{t.reportAllChanges||(e=e.slice(-1));for(let t of e)a.u(t),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-ec(),0),i.entries=[t],r())},s=tc(`largest-contentful-paint`,o);if(s){r=J(e,i,Oc,t.reportAllChanges);let n=nc((()=>{o(s.takeRecords()),s.disconnect(),r(!0)})),a=e=>{e.isTrusted&&(wc(n),removeEventListener(e.type,a,{capture:!0}))};for(let e of[`keydown`,`click`,`visibilitychange`])addEventListener(e,a,{capture:!0});Qs((n=>{i=Y(`LCP`),r=J(e,i,Oc,t.reportAllChanges),$s((()=>{i.value=performance.now()-n.timeStamp,r(!0)}))}))}}))})((t=>{e((e=>{let t={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:e.value};if(e.entries.length){let n=Ws();if(n){let i=n.activationStart||0,a=e.entries.at(-1),o=a.url&&performance.getEntriesByType(`resource`).filter((e=>e.name===a.url))[0],s=Math.max(0,n.responseStart-i),c=Math.max(s,o?(o.requestStart||o.startTime)-i:0),l=Math.min(e.value,Math.max(c,o?o.responseEnd-i:0));t={target:r.get(a),timeToFirstByte:s,resourceLoadDelay:c-s,resourceLoadDuration:l-c,elementRenderDelay:e.value-l,navigationEntry:n,lcpEntry:a},a.url&&(t.url=a.url),o&&(t.lcpResourceEntry=o)}}return Object.assign(e,{attribution:t})})(t))}),t)},Ac=[800,1800],jc=e=>{document.prerendering?cc((()=>jc(e))):document.readyState===`complete`?setTimeout(e):addEventListener(`load`,(()=>jc(e)),!0)},Mc=(e,t={})=>{((e,t={})=>{let n=Y(`TTFB`),r=J(e,n,Ac,t.reportAllChanges);jc((()=>{let i=Ws();i&&(n.value=Math.max(i.responseStart-ec(),0),n.entries=[i],r(!0),Qs((()=>{n=Y(`TTFB`,0),r=J(e,n,Ac,t.reportAllChanges),r(!0)})))}))})((t=>{e((e=>{let t={waitingDuration:0,cacheDuration:0,dnsDuration:0,connectionDuration:0,requestDuration:0};if(e.entries.length){let n=e.entries[0],r=n.activationStart||0,i=Math.max((n.workerStart||n.fetchStart)-r,0),a=Math.max(n.domainLookupStart-r,0),o=Math.max(n.connectStart-r,0),s=Math.max(n.connectEnd-r,0);t={waitingDuration:i,cacheDuration:a-i,dnsDuration:o-a,connectionDuration:s-o,requestDuration:e.value-s,navigationEntry:n}}return Object.assign(e,{attribution:t})})(t))}),t)},Nc=[`CLS`,`INP`,`LCP`,`FCP`,`TTFB`],Pc={CLS:pc,FCP:mc,LCP:kc,INP:Ec,TTFB:Mc,FID:void 0},Fc=(e,t)=>{let n={},r=[];if(e===`CLS`){let e=t.attribution;r.push({key:`largestShiftTarget`,value:e.largestShiftTarget},{key:`largestShiftValue`,value:e.largestShiftValue})}else if(e===`INP`){let e=t.attribution;r.push({key:`interactionTarget`,value:e.interactionTarget},{key:`interactionType`,value:e.interactionType},{key:`nextPaintTime`,value:e.nextPaintTime},{key:`inputDelay`,value:e.inputDelay},{key:`processingDuration`,value:e.processingDuration},{key:`presentationDelay`,value:e.presentationDelay},{key:`totalScriptDuration`,value:e.totalScriptDuration},{key:`totalStyleAndLayoutDuration`,value:e.totalStyleAndLayoutDuration},{key:`totalPaintDuration`,value:e.totalPaintDuration},{key:`totalUnattributedDuration`,value:e.totalUnattributedDuration},{key:`loadState`,value:e.loadState})}else if(e===`LCP`){let e=t.attribution;r.push({key:`target`,value:e.target},{key:`url`,value:e.url},{key:`timeToFirstByte`,value:e.timeToFirstByte},{key:`resourceLoadDelay`,value:e.resourceLoadDelay},{key:`resourceLoadDuration`,value:e.resourceLoadDuration},{key:`elementRenderDelay`,value:e.elementRenderDelay})}return r.forEach(e=>{e.value!==void 0&&(n[`mxl.web_vital.attribution.${e.key}`]=e.value)}),n};var Ic=class extends G{constructor({diag:e,perf:t,listeners:n=Pc,urlDocument:r=window.document,urlAttribution:i=!0,pageManager:a}={}){super({instrumentationName:`WebVitalsInstrumentation`,instrumentationVersion:`1.0.0`,diag:e,perf:t,config:{}}),j(this,`_listeners`,void 0),j(this,`_urlDocument`,void 0),j(this,`_urlAttribution`,void 0),j(this,`_pageManager`,void 0),j(this,`_attributedPage`,{INP:void 0,LCP:void 0,CLS:void 0,FCP:void 0,TTFB:void 0}),j(this,`_largestShiftTargetForCLS`,void 0),j(this,`_listenersRegistered`,!1),j(this,`_isEnabled`,!1),this._listeners=n,this._urlDocument=r,this._urlAttribution=i,this._pageManager=a==null?U.getPageManager():a,this._config.enabled&&this.enable()}disable(){this._isEnabled=!1,this._diag.debug(`WebVitalsInstrumentation disabled, pausing emission`)}enable(){if(this._isEnabled=!0,this._listenersRegistered){this._diag.debug(`WebVitalsInstrumentation listeners already registered, resuming emission`);return}if(this._listenersRegistered=!0,Nc.forEach(e=>{var t,n;(t=(n=this._listeners)[e])==null||t.call(n,t=>{if(!this._isEnabled)return;let n=this.sessionManager.getSessionSpan();if(!n)return;let r=this._getTimeForMetric(t),i=this._getAttributedPageForMetric(t),a=L({[k]:A.WebVital,[N]:i.fullURL,"mxl.web_vital.navigation_type":t.navigationType,"mxl.web_vital.name":t.name,"mxl.web_vital.rating":t.rating,"mxl.web_vital.id":t.id,"mxl.web_vital.delta":t.delta,"mxl.web_vital.value":t.value},Fc(e,t));i.path&&i.pageID&&(a[Pt]=i.path,a[Ft]=i.pageID),i.label&&(a[It]=i.label),n.addEvent(`mxl-web-vitals-report-${e}`,a,r)})}),this._urlAttribution){var e,t,n,r,i,a,o,s,c,l;(e=(t=this._listeners).TTFB)==null||e.call(t,()=>{this._attributedPage.TTFB=this._currentAttributedPage()},{reportAllChanges:!0}),(n=(r=this._listeners).FCP)==null||n.call(r,()=>{this._attributedPage.FCP=this._currentAttributedPage()},{reportAllChanges:!0}),(i=(a=this._listeners).INP)==null||i.call(a,()=>{this._attributedPage.INP=this._currentAttributedPage()},{reportAllChanges:!0}),(o=(s=this._listeners).LCP)==null||o.call(s,()=>{this._attributedPage.LCP=this._currentAttributedPage()},{reportAllChanges:!0}),(c=(l=this._listeners).CLS)==null||c.call(l,e=>{let t=e;this._largestShiftTargetForCLS!==t.attribution.largestShiftTarget&&(this._largestShiftTargetForCLS=t.attribution.largestShiftTarget,this._attributedPage.CLS=this._currentAttributedPage())},{reportAllChanges:!0})}}_getTimeForMetric(e){return e.name===`CLS`&&e.attribution.largestShiftTime?this.perf.epochMillisFromOriginOffset(e.attribution.largestShiftTime):e.name===`INP`&&e.attribution.interactionTime?this.perf.epochMillisFromOriginOffset(e.attribution.interactionTime):this.perf.getNowMillis()}_currentAttributedPage(){let e={fullURL:this._urlDocument.URL},t=this._pageManager.getCurrentRoute(),n=this._pageManager.getCurrentPageId();t&&n&&(e.path=t.path,e.pageID=n);let r=this._pageManager.getPageLabel();return r&&(e.label=r),e}_getAttributedPageForMetric(e){return e.name===`FCP`&&this._attributedPage.FCP?this._attributedPage.FCP:e.name===`TTFB`&&this._attributedPage.TTFB?this._attributedPage.TTFB:e.name===`INP`&&this._attributedPage.INP?this._attributedPage.INP:e.name===`LCP`&&this._attributedPage.LCP?this._attributedPage.LCP:e.name===`CLS`&&this._attributedPage.CLS&&e.attribution.largestShiftTarget===this._largestShiftTargetForCLS?this._attributedPage.CLS:this._currentAttributedPage()}};let X=console.error.bind(console);function Lc(e,t,n){let r=!!e[t]&&Object.prototype.propertyIsEnumerable.call(e,t);Object.defineProperty(e,t,{configurable:!0,enumerable:r,writable:!0,value:n})}let Rc=(e,t,n)=>{if(!e||!e[t]){X(`no original function `+String(t)+` to wrap`);return}if(!n){X(`no wrapper function`),X(Error().stack);return}let r=e[t];if(typeof r!=`function`||typeof n!=`function`){X(`original object and wrapper must be functions`);return}let i=n(r,t);return Lc(i,`__original`,r),Lc(i,`__unwrap`,()=>{e[t]===i&&Lc(e,t,r)}),Lc(i,`__wrapped`,!0),Lc(e,t,i),i},zc=(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{X(`must provide one or more modules to patch`),X(Error().stack);return}if(!(t&&Array.isArray(t))){X(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{Rc(e,t,n)})})},Bc=(e,t)=>{if(!e||!e[t]){X(`no function to unwrap.`),X(Error().stack);return}let n=e[t];if(!n.__unwrap)X(`no original to unwrap to -- has `+String(t)+` already been unwrapped?`);else{n.__unwrap();return}},Vc=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{X(`must provide one or more modules to patch`),X(Error().stack);return}if(!(t&&Array.isArray(t))){X(`must provide one or more functions to unwrap on modules`);return}e.forEach(e=>{t.forEach(t=>{Bc(e,t)})})};function Hc(e){e&&e.logger&&(typeof e.logger==`function`?X=e.logger:X(`new logger isn't a function, not replacing`))}Hc.wrap=Rc,Hc.massWrap=zc,Hc.unwrap=Bc,Hc.massUnwrap=Vc;var Uc=class{constructor(e,t,n){j(this,`_config`,{}),j(this,`_tracer`,void 0),j(this,`_meter`,void 0),j(this,`_logger`,void 0),j(this,`_diag`,void 0),j(this,`instrumentationName`,void 0),j(this,`instrumentationVersion`,void 0),j(this,`_wrap`,Rc),j(this,`_unwrap`,Bc),j(this,`_massWrap`,zc),j(this,`_massUnwrap`,Vc),this.instrumentationName=e,this.instrumentationVersion=t,this.setConfig(n),this._diag=E.createComponentLogger({namespace:e}),this._tracer=O.getTracer(e,t),this._meter=mt.getMeter(e,t),this._logger=Ya.getLogger(e,t),this._updateMetricInstruments()}get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){var e;let t=(e=this.init())==null?[]:e;return Array.isArray(t)?t:[t]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config=L({enabled:!0},e)}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,t,n,r){if(e)try{e(n,r)}catch(e){this._diag.error(`Error running span customization hook due to exception in handler`,{triggerName:t},e)}}},Wc=class extends Uc{constructor(e,t,n){super(e,t,n),this._config.enabled&&this.enable()}};function Gc(e,t,n){let r,i;try{i=e()}catch(e){r=e}finally{if(t(r,i),r&&!n)throw r;return i}}function Kc(e){return typeof e==`function`&&typeof e.__original==`function`&&typeof e.__unwrap==`function`&&e.__wrapped===!0}var Z;(function(e){e[e.STABLE=1]=`STABLE`,e[e.OLD=2]=`OLD`,e[e.DUPLICATE=3]=`DUPLICATE`})(Z||(Z={}));function qc(e,t){let n=Z.OLD,r=t==null?void 0:t.split(`,`).map(e=>e.trim()).filter(e=>e!==``);for(let t of r==null?[]:r)if(t.toLowerCase()===e+`/dup`){n=Z.DUPLICATE;break}else t.toLowerCase()===e&&(n=Z.STABLE);return n}let Jc=performance,Yc=Math.pow(10,6),Xc=Math.pow(10,9);function Zc(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*Yc)]}function Qc(e){return $c(Zc(Jc.timeOrigin),Zc(typeof e==`number`?e:Jc.now()))}function $c(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=Xc&&(n[1]-=Xc,n[0]+=1),n}function el(e,t){return typeof t==`string`?e===t:!!e.match(t)}function tl(e,t){if(!t)return!1;for(let n of t)if(el(e,n))return!0;return!1}var Q;(function(e){e.METHOD_OPEN=`open`,e.METHOD_SEND=`send`,e.EVENT_ABORT=`abort`,e.EVENT_ERROR=`error`,e.EVENT_LOAD=`loaded`,e.EVENT_TIMEOUT=`timeout`})(Q||(Q={}));let nl=E.createComponentLogger({namespace:`@opentelemetry/opentelemetry-instrumentation-xml-http-request/utils`});function rl(e){return typeof Document<`u`&&e instanceof Document}function il(e){if(rl(e))return new XMLSerializer().serializeToString(document).length;if(typeof e==`string`)return ol(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return sl(e);if(e instanceof URLSearchParams)return ol(e.toString());if(e.byteLength!==void 0)return e.byteLength;nl.warn(`unknown body type`)}let al=new TextEncoder;function ol(e){return al.encode(e).byteLength}function sl(e){let t=0;for(let[n,r]of e.entries())t+=n.length,r instanceof Blob?t+=r.size:t+=r.length;return t}function cl(e){let t=dl(),n=e.toUpperCase();return n in t?n:`_OTHER`}let ll={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},ul;function dl(){return ul===void 0&&(ul=ll),ul}let fl={"https:":`443`,"http:":`80`};function pl(e){let t=Number(e.port||fl[e.protocol]);if(t&&!isNaN(t))return t}let ml=`0.213.0`;var hl;(function(e){e.HTTP_STATUS_TEXT=`http.status_text`})(hl||(hl={}));var gl=class extends Wc{constructor(e={}){super(`@opentelemetry/instrumentation-xml-http-request`,ml,e),j(this,`component`,`xml-http-request`),j(this,`version`,ml),j(this,`moduleName`,this.component),j(this,`_tasksCount`,0),j(this,`_xhrMem`,new WeakMap),j(this,`_usedResources`,new WeakSet),j(this,`_semconvStability`,void 0),this._semconvStability=qc(`http`,e==null?void 0:e.semconvStabilityOptIn)}init(){}_addHeaders(e,t){let n=H(t).href;if(!Qi(n,this.getConfig().propagateTraceHeaderCorsUrls)){let e={};D.inject(T.active(),e),Object.keys(e).length>0&&this._diag.debug(`headers inject skipped due to CORS policy`);return}let r={};D.inject(T.active(),r),Object.keys(r).forEach(t=>{e.setRequestHeader(t,String(r[t]))})}_addChildSpan(e,t){T.with(O.setSpan(T.active(),e),()=>{let e=this.tracer.startSpan(`CORS Preflight`,{startTime:t[B.FETCH_START]}),n=!(this._semconvStability&Z.OLD);Ki(e,t,this.getConfig().ignoreNetworkEvents,void 0,n),e.end(t[B.RESPONSE_END])})}_addFinalSpanAttributes(e,t,n){if(this._semconvStability&Z.OLD){if(t.status!==void 0&&e.setAttribute(`http.status_code`,t.status),t.statusText!==void 0&&e.setAttribute(hl.HTTP_STATUS_TEXT,t.statusText),typeof n==`string`){let t=H(n);e.setAttribute(`http.host`,t.host),e.setAttribute(`http.scheme`,t.protocol.replace(`:`,``))}e.setAttribute(`http.user_agent`,navigator.userAgent)}this._semconvStability&Z.STABLE&&t.status&&e.setAttribute(rn,t.status)}_applyAttributesAfterXHR(e,t){let n=this.getConfig().applyCustomAttributesOnSpan;typeof n==`function`&&Gc(()=>n(e,t),e=>{e&&this._diag.error(`applyCustomAttributesOnSpan`,e)},!0)}_addResourceObserver(e,t){let n=this._xhrMem.get(e);!n||typeof PerformanceObserver!=`function`||typeof PerformanceResourceTiming!=`function`||(n.createdResources={observer:new PerformanceObserver(e=>{let r=e.getEntries(),i=H(t);r.forEach(e=>{e.initiatorType===`xmlhttprequest`&&e.name===i.href&&n.createdResources&&n.createdResources.entries.push(e)})}),entries:[]},n.createdResources.observer.observe({entryTypes:[`resource`]}))}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(Jc.clearResourceTimings(),this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}_findResourceAndAddNetworkEvents(e,t,n,r,i){if(!n||!r||!i||!e.createdResources)return;let a=e.createdResources.entries;(!a||!a.length)&&(a=Jc.getEntriesByType(`resource`));let o=Yi(H(n).href,r,i,a,this._usedResources);if(o.mainRequest){let e=o.mainRequest;this._markResourceAsUsed(e);let n=o.corsPreFlightRequest;n&&(this._addChildSpan(t,n),this._markResourceAsUsed(n));let r=!(this._semconvStability&Z.OLD);Ki(t,e,this.getConfig().ignoreNetworkEvents,void 0,r)}}_cleanPreviousSpanInformation(e){let t=this._xhrMem.get(e);if(t){let n=t.callbackToRemoveEvents;n&&n(),this._xhrMem.delete(e)}}_createSpan(e,t,n){if(tl(t,this.getConfig().ignoreUrls)){this._diag.debug(`ignoring span as url matches ignored url`);return}let r=``,i=H(t),a={};if(this._semconvStability&Z.OLD&&(r=n.toUpperCase(),a[`http.method`]=n,a[`http.url`]=i.toString()),this._semconvStability&Z.STABLE){let e=n,t=cl(n);r||(r=t),a[tn]=t,t!==e&&(a[nn]=e),a[N]=i.toString(),a[an]=i.hostname;let o=pl(i);o&&(a[on]=o)}let o=this.tracer.startSpan(r,{kind:ut.CLIENT,attributes:a});return o.addEvent(Q.METHOD_OPEN),this._cleanPreviousSpanInformation(e),this._xhrMem.set(e,{span:o,spanUrl:t}),o}_markResourceAsUsed(e){this._usedResources.add(e)}_patchOpen(){return e=>{let t=this;return function(...n){let r=n[0],i=n[1];return t._createSpan(this,i,r),e.apply(this,n)}}}_patchSend(){let e=this;function t(t,n,r,i){let a=n.callbackToRemoveEvents;typeof a==`function`&&a();let{span:o,spanUrl:s,sendStartTime:c}=n;o&&(e._findResourceAndAddNetworkEvents(n,o,s,c,r),o.addEvent(t,i),e._addFinalSpanAttributes(o,n,s),o.end(i),e._tasksCount--),e._clearResources()}function n(n,r,i,a){let o=e._xhrMem.get(r);if(!o)return;if(o.status=r.status,o.statusText=r.statusText,e._xhrMem.delete(r),o.span){let t=o.span;e._applyAttributesAfterXHR(t,r),e._semconvStability&Z.STABLE&&(i?a&&(t.setStatus({code:dt.ERROR,message:a}),t.setAttribute(Qt,a)):o.status&&o.status>=400&&(t.setStatus({code:dt.ERROR}),t.setAttribute(Qt,String(o.status))))}let s=Qc(),c=Date.now();setTimeout(()=>{t(n,o,s,c)},300)}function r(){n(Q.EVENT_ERROR,this,!0,`error`)}function i(){n(Q.EVENT_ABORT,this,!1)}function a(){n(Q.EVENT_TIMEOUT,this,!0,`timeout`)}function o(){this.status<299?n(Q.EVENT_LOAD,this,!1):n(Q.EVENT_ERROR,this,!1)}function s(t){t.removeEventListener(`abort`,i),t.removeEventListener(`error`,r),t.removeEventListener(`load`,o),t.removeEventListener(`timeout`,a);let n=e._xhrMem.get(t);n&&(n.callbackToRemoveEvents=void 0)}return t=>function(...n){let c=e._xhrMem.get(this);if(!c)return t.apply(this,n);let l=c.span,u=c.spanUrl;if(l&&u){if(e.getConfig().measureRequestSize&&n!=null&&n[0]){let t=n[0],r=il(t);r!==void 0&&(e._semconvStability&Z.OLD&&l.setAttribute(`http.request_content_length_uncompressed`,r),e._semconvStability&Z.STABLE&&l.setAttribute(`http.request.body.size`,r))}T.with(O.setSpan(T.active(),l),()=>{e._tasksCount++,c.sendStartTime=Qc(),l.addEvent(Q.METHOD_SEND),this.addEventListener(`abort`,i),this.addEventListener(`error`,r),this.addEventListener(`load`,o),this.addEventListener(`timeout`,a),c.callbackToRemoveEvents=()=>{s(this),c.createdResources&&c.createdResources.observer.disconnect()},e._addHeaders(this,u),e._addResourceObserver(this,u)})}return t.apply(this,n)}}enable(){this._diag.debug(`applying patch to`,this.moduleName,this.version),Kc(XMLHttpRequest.prototype.open)&&(this._unwrap(XMLHttpRequest.prototype,`open`),this._diag.debug(`removing previous patch from method open`)),Kc(XMLHttpRequest.prototype.send)&&(this._unwrap(XMLHttpRequest.prototype,`send`),this._diag.debug(`removing previous patch from method send`)),this._wrap(XMLHttpRequest.prototype,`open`,this._patchOpen()),this._wrap(XMLHttpRequest.prototype,`send`,this._patchSend())}disable(){this._diag.debug(`removing patch from`,this.moduleName,this.version),this._unwrap(XMLHttpRequest.prototype,`open`),this._unwrap(XMLHttpRequest.prototype,`send`),this._tasksCount=0,this._xhrMem=new WeakMap,this._usedResources=new WeakSet}};let _l=[`omitIfAlreadyPatched`];var vl=class extends gl{constructor(e={}){let{omitIfAlreadyPatched:t}=e,n=ts(e,_l);super(L(L({},n),{},{enabled:!1})),j(this,`_omitIfAlreadyPatched`,void 0),this._omitIfAlreadyPatched=t,n.enabled&&this.enable()}enable(){if(this._omitIfAlreadyPatched&&(eo(XMLHttpRequest.prototype.open)||eo(XMLHttpRequest.prototype.send))){this._diag.debug("XMLHttpRequest is already passed and `omitIfAlreadyPatched` is true, skipping enabling this instrumentation");return}super.enable()}};let yl=v(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function bl(e){return e.setValue(yl,!0)}function xl(){return e=>{E.error(Sl(e))}}function Sl(e){return typeof e==`string`?e:JSON.stringify(Cl(e))}function Cl(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(e=>{if(t[e])return;let r=n[e];r&&(t[e]=String(r))}),n=Object.getPrototypeOf(n);return t}let wl=xl();function Tl(e){try{wl(e)}catch(e){}}let El={[un]:`opentelemetry`,"process.runtime.name":`browser`,[cn]:ln,[dn]:`2.6.0`},Dl=performance,Ol=Math.pow(10,6),kl=Math.pow(10,9);function Al(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*Ol)]}function jl(e){return Pl(Al(Dl.timeOrigin),Al(typeof e==`number`?e:Dl.now()))}function Ml(e){if(Nl(e))return e;if(typeof e==`number`)return e<Dl.timeOrigin?jl(e):Al(e);if(e instanceof Date)return Al(e.getTime());throw TypeError(`Invalid input type`)}function Nl(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function Pl(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=kl&&(n[1]-=kl,n[0]+=1),n}var Fl;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(Fl||(Fl={}));var Il=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function Ll(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new Il(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}var Rl=class{constructor(){j(this,`_promise`,void 0),j(this,`_resolve`,void 0),j(this,`_reject`,void 0),this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}},zl=class{constructor(e,t){j(this,`_isCalled`,!1),j(this,`_deferred`,new Rl),j(this,`_callback`,void 0),j(this,`_that`,void 0),this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}};function Bl(e,t){return new Promise(n=>{T.with(bl(T.active()),()=>{e.export(t,n)})})}let Vl={_export:Bl},Hl;function Ul(){if(Hl===void 0)try{let e=globalThis.process.argv0;Hl=e?`unknown_service:${e}`:`unknown_service`}catch(e){Hl=`unknown_service`}return Hl}let Wl=e=>typeof e==`object`&&!!e&&typeof e.then==`function`;var Gl=class e{static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=Jl(t),r._asyncAttributesPending=t.filter(([e,t])=>Wl(t)).length>0,r}constructor(e,t){var n;j(this,`_rawAttributes`,void 0),j(this,`_asyncAttributesPending`,!1),j(this,`_schemaUrl`,void 0),j(this,`_memoizedAttributes`,void 0);let r=(n=e.attributes)==null?{}:n;this._rawAttributes=Object.entries(r).map(([e,t])=>(Wl(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=Jl(this._rawAttributes),this._schemaUrl=Yl(t==null?void 0:t.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}waitForAsyncAttributes(){var e=this;return P(function*(){if(e.asyncAttributesPending){for(let t=0;t<e._rawAttributes.length;t++){let[n,r]=e._rawAttributes[t];e._rawAttributes[t]=[n,Wl(r)?yield r:r]}e._asyncAttributesPending=!1}})()}get attributes(){if(this.asyncAttributesPending&&E.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(Wl(n)){E.debug(`Unsettled resource attribute ${t} skipped`);continue}n!=null&&(e[t]!=null||(e[t]=n))}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=Xl(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function Kl(e,t){return Gl.FromAttributeList(Object.entries(e),t)}function ql(){return Kl({[sn]:Ul(),[cn]:El[cn],[un]:El[un],[dn]:El[dn]})}function Jl(e){return e.map(([e,t])=>Wl(t)?[e,t.catch(t=>{E.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function Yl(e){if(typeof e==`string`||e===void 0)return e;E.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function Xl(e,t){let n=e==null?void 0:e.schemaUrl,r=t==null?void 0:t.schemaUrl,i=n===void 0||n===``,a=r===void 0||r===``;if(i)return r;if(a||n===r)return n;E.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}function Zl(e){return Ql(e,new WeakSet)}function Ql(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof Uint8Array)return!0;if(typeof e==`object`){if(t.has(e))return!1;if(t.add(e),Array.isArray(e))return e.every(e=>Ql(e,t));let n=e;return n.constructor!==Object&&n.constructor!==void 0?!1:Object.values(n).every(e=>Ql(e,t))}return!1}var $l=class{set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this.totalAttributesCount-Object.keys(this.attributes).length}constructor(e,t,n){j(this,`hrTime`,void 0),j(this,`hrTimeObserved`,void 0),j(this,`spanContext`,void 0),j(this,`resource`,void 0),j(this,`instrumentationScope`,void 0),j(this,`attributes`,{}),j(this,`_severityText`,void 0),j(this,`_severityNumber`,void 0),j(this,`_body`,void 0),j(this,`_eventName`,void 0),j(this,`totalAttributesCount`,0),j(this,`_isReadonly`,!1),j(this,`_logRecordLimits`,void 0);let{timestamp:r,observedTimestamp:i,eventName:a,severityNumber:o,severityText:s,body:c,attributes:l={},exception:u,context:d}=n,f=Date.now();if(this.hrTime=Ml(r==null?f:r),this.hrTimeObserved=Ml(i==null?f:i),d){let e=O.getSpanContext(d);e&&et(e)&&(this.spanContext=e)}this.severityNumber=o,this.severityText=s,this.body=c,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=a,this.setAttributes(l),u!=null&&this._setException(u)}setAttribute(e,t){return this._isLogRecordReadonly()?this:e.length===0?(E.warn(`Invalid attribute key: ${e}`),this):Zl(t)?(this.totalAttributesCount+=1,Object.keys(this.attributes).length>=this._logRecordLimits.attributeCountLimit&&!Object.prototype.hasOwnProperty.call(this.attributes,e)?(this.droppedAttributesCount===1&&E.warn(`Dropping extra attributes.`),this):(this.attributes[e]=this._truncateToSize(t),this)):(E.warn(`Invalid attribute value set for key: ${e}`),this)}setAttributes(e){for(let[t,n]of Object.entries(e))this.setAttribute(t,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let t=this._logRecordLimits.attributeValueLengthLimit;if(t<=0)return E.warn(`Attribute value limit must be positive, got ${t}`),e;if(e==null)return e;if(typeof e==`string`)return this._truncateToLimitUtil(e,t);if(e instanceof Uint8Array)return e;if(Array.isArray(e))return e.map(e=>this._truncateToSize(e));if(typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))t[n]=this._truncateToSize(r);return t}return e}_setException(e){let t=!1;if(typeof e==`string`||typeof e==`number`)Object.hasOwn(this.attributes,$t)||this.setAttribute($t,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,M)||this.setAttribute(M,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,M)||this.setAttribute(M,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,$t)||this.setAttribute($t,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,en)||this.setAttribute(en,n.stack),t=!0)}t||E.warn(`Failed to record an exception ${e}`)}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&E.warn(`Can not execute the operation on emitted log record`),this._isReadonly}},eu=class{constructor(e,t){j(this,`instrumentationScope`,void 0),j(this,`_sharedState`,void 0),j(this,`_loggerConfig`,void 0),this.instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(e){var t;let n=this._loggerConfig,r=e.context||T.active(),i=(t=e.severityNumber)==null?W.UNSPECIFIED:t;if(i!==W.UNSPECIFIED&&i<n.minimumSeverity)return;if(n.traceBased){let e=O.getSpanContext(r);if(e&&et(e)&&(e.traceFlags&w.SAMPLED)!==w.SAMPLED)return}let a=new $l(this._sharedState,this.instrumentationScope,L({context:r},e));this._sharedState.activeProcessor.onEmit(a,r),a._makeReadonly()}},tu=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}},nu=class{constructor(e,t){j(this,`processors`,void 0),j(this,`forceFlushTimeoutMillis`,void 0),this.processors=e,this.forceFlushTimeoutMillis=t}forceFlush(){var e=this;return P(function*(){let t=e.forceFlushTimeoutMillis;yield Promise.all(e.processors.map(e=>Ll(e.forceFlush(),t)))})()}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}shutdown(){var e=this;return P(function*(){yield Promise.all(e.processors.map(e=>e.shutdown()))})()}};function ru(e){return`${e.name}@${e.version||``}:${e.schemaUrl||``}`}let iu={disabled:!1,minimumSeverity:W.UNSPECIFIED,traceBased:!1},au=()=>L({},iu);var ou=class{constructor(e,t,n,r,i){j(this,`loggers`,new Map),j(this,`activeProcessor`,void 0),j(this,`registeredLogRecordProcessors`,[]),j(this,`resource`,void 0),j(this,`forceFlushTimeoutMillis`,void 0),j(this,`logRecordLimits`,void 0),j(this,`processors`,void 0),j(this,`_loggerConfigurator`,void 0),j(this,`_loggerConfigs`,new Map),this.resource=e,this.forceFlushTimeoutMillis=t,this.logRecordLimits=n,this.processors=r,r.length>0?(this.registeredLogRecordProcessors=r,this.activeProcessor=new nu(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new tu,this._loggerConfigurator=i==null?au:i}getLoggerConfig(e){let t=ru(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}},su=class{constructor(e={}){var t,n,r,i,a,o,s,c;j(this,`_shutdownOnce`,void 0),j(this,`_sharedState`,void 0);let l={resource:(t=e.resource)==null?ql():t,forceFlushTimeoutMillis:(n=e.forceFlushTimeoutMillis)==null?3e4:n,logRecordLimits:{attributeCountLimit:(r=(i=e.logRecordLimits)==null?void 0:i.attributeCountLimit)==null?128:r,attributeValueLengthLimit:(a=(o=e.logRecordLimits)==null?void 0:o.attributeValueLengthLimit)==null?1/0:a},loggerConfigurator:(s=e.loggerConfigurator)==null?au:s,processors:(c=e.processors)==null?[]:c};this._sharedState=new ou(l.resource,l.forceFlushTimeoutMillis,l.logRecordLimits,l.processors,l.loggerConfigurator),this._shutdownOnce=new zl(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return E.warn(`A shutdown LoggerProvider cannot provide a Logger`),Ha;e||E.warn(`Logger requested without instrumentation scope name.`);let r=e||`unknown`,i=`${r}@${t||``}:${(n==null?void 0:n.schemaUrl)||``}`;return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new eu({name:r,version:t,schemaUrl:n==null?void 0:n.schemaUrl},this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(E.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(E.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}},cu=class{constructor(e,t){var n,r,i,a;j(this,`_maxExportBatchSize`,void 0),j(this,`_maxQueueSize`,void 0),j(this,`_scheduledDelayMillis`,void 0),j(this,`_exportTimeoutMillis`,void 0),j(this,`_exporter`,void 0),j(this,`_isExporting`,!1),j(this,`_finishedLogRecords`,[]),j(this,`_timer`,void 0),j(this,`_shutdownOnce`,void 0),this._exporter=e,this._maxExportBatchSize=(n=t==null?void 0:t.maxExportBatchSize)==null?512:n,this._maxQueueSize=(r=t==null?void 0:t.maxQueueSize)==null?2048:r,this._scheduledDelayMillis=(i=t==null?void 0:t.scheduledDelayMillis)==null?5e3:i,this._exportTimeoutMillis=(a=t==null?void 0:t.exportTimeoutMillis)==null?3e4:a,this._shutdownOnce=new zl(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(E.warn(`BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}shutdown(){return this._shutdownOnce.call()}_shutdown(){var e=this;return P(function*(){e.onShutdown(),yield e._flushAll(),yield e._exporter.shutdown()})()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}_flushAll(){return new Promise((e,t)=>{let n=[],r=Math.ceil(this._finishedLogRecords.length/this._maxExportBatchSize);for(let e=0;e<r;e++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),this._finishedLogRecords.length===0?Promise.resolve():Ll(this._export(this._finishedLogRecords.splice(0,this._maxExportBatchSize)),this._exportTimeoutMillis)}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().then(()=>{this._isExporting=!1,this._finishedLogRecords.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,Tl(e)})};if(this._finishedLogRecords.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}_export(e){let t=()=>Vl._export(this._exporter,e).then(e=>{if(e.code!==Fl.SUCCESS){var t;Tl((t=e.error)==null?Error(`BatchLogRecordProcessor: log record export failed (status ${e})`):t)}}).catch(Tl),n=[];for(let t=0;t<e.length;t++){let r=e[t].resource;r.asyncAttributesPending&&typeof r.waitForAsyncAttributes==`function`&&n.push(r.waitForAsyncAttributes())}return n.length===0?t():Promise.all(n).then(t,Tl)}},lu=class extends cu{constructor(e,t){super(e,t),j(this,`_visibilityChangeListener`,void 0),j(this,`_pageHideListener`,void 0),this._onInit(t)}onShutdown(){typeof document>`u`||(this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener(`pagehide`,this._pageHideListener))}_onInit(e){(e==null?void 0:e.disableAutoFlushOnDocumentHide)===!0||typeof document>`u`||(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush()},this._pageHideListener=()=>{this.forceFlush()},document.addEventListener(`visibilitychange`,this._visibilityChangeListener),document.addEventListener(`pagehide`,this._pageHideListener))}},uu=class{constructor(e){j(this,`_sessionIdProvider`,void 0),this._sessionIdProvider=e}forceFlush(){return P(function*(){})()}onStart(e,t){var n;let r=(n=this._sessionIdProvider)==null?void 0:n.getSessionId();r&&e.setAttribute(`session.id`,r)}onEnd(e){}shutdown(){return P(function*(){})()}};function du(e){return new uu(e)}let fu={compression:`gzip`,keepalive:!0,concurrencyLimit:5,timeoutMillis:30*1e3},pu=(e,t)=>({"X-MXL-AID":e,"X-MXL-DID":t}),mu=(e,t)=>t||`http://mxl-otelcol.service-availability.apps.ocpthikadev01.safaricom.net`;function hu(e,t){let n={attributes:_u(e.attributes,t),droppedAttributesCount:0},r=e.schemaUrl;return r&&r!==``&&(n.schemaUrl=r),n}function gu(e){return{name:e.name,version:e.version}}function _u(e,t){return Object.keys(e).map(n=>vu(n,e[n],t))}function vu(e,t,n){return{key:e,value:yu(t,n)}}function yu(e,t){let n=typeof e;if(n===`string`)return{stringValue:e};if(n===`number`)return Number.isInteger(e)?{intValue:e}:{doubleValue:e};if(n===`boolean`)return{boolValue:e};if(e instanceof Uint8Array)return{bytesValue:t.encodeUint8Array(e)};if(Array.isArray(e)){let n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=yu(e[r],t);return{arrayValue:{values:n}}}if(n===`object`&&e!=null){let n=Object.keys(e),r=Array(n.length);for(let i=0;i<n.length;i++)r[i]={key:n[i],value:yu(e[n[i]],t)};return{kvlistValue:{values:r}}}return{}}function bu(e,t){return{resourceLogs:Su(e,t)}}function xu(e){let t=new Map;for(let n of e){let{resource:e,instrumentationScope:{name:r,version:i=``,schemaUrl:a=``}}=n,o=t.get(e);o||(o=new Map,t.set(e,o));let s=`${r}@${i}:${a}`,c=o.get(s);c||(c=[],o.set(s,c)),c.push(n)}return t}function Su(e,t){let n=xu(e);return Array.from(n,([e,n])=>{let r=hu(e,t);return{resource:r,scopeLogs:Array.from(n,([,e])=>({scope:gu(e[0].instrumentationScope),logRecords:e.map(e=>Cu(e,t)),schemaUrl:e[0].instrumentationScope.schemaUrl})),schemaUrl:r.schemaUrl}})}function Cu(e,t){var n,r,i;return{timeUnixNano:t.encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:wu(e.severityNumber),severityText:e.severityText,body:yu(e.body,t),eventName:e.eventName,attributes:Tu(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,flags:(n=e.spanContext)==null?void 0:n.traceFlags,traceId:t.encodeOptionalSpanContext((r=e.spanContext)==null?void 0:r.traceId),spanId:t.encodeOptionalSpanContext((i=e.spanContext)==null?void 0:i.spanId)}}function wu(e){return e}function Tu(e,t){return Object.keys(e).map(n=>vu(n,e[n],t))}let Eu=Math.pow(10,9);function Du(e){return e[0]*Eu+e[1]}function Ou(e){let t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function ku(e){return Ou(e).toString()}let Au=typeof BigInt<`u`?ku:Du;function ju(e){return e}let Mu={encodeHrTime:Au,encodeSpanContext:ju,encodeOptionalSpanContext:ju,encodeUint8Array:e=>{if(typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let t=Array(e.length);for(let n=0;n<e.length;n++)t[n]=String.fromCharCode(e[n]);return btoa(t.join(``))}};function Nu(e,t){let n=e&255|256;return t&&(n|=512),n}function Pu(e,t){var n,r,i,a;let o=e.spanContext(),s=e.status,c=(n=e.parentSpanContext)!=null&&n.spanId?t.encodeSpanContext((r=e.parentSpanContext)==null?void 0:r.spanId):void 0;return{traceId:t.encodeSpanContext(o.traceId),spanId:t.encodeSpanContext(o.spanId),parentSpanId:c,traceState:(i=o.traceState)==null?void 0:i.serialize(),name:e.name,kind:e.kind==null?0:e.kind+1,startTimeUnixNano:t.encodeHrTime(e.startTime),endTimeUnixNano:t.encodeHrTime(e.endTime),attributes:_u(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>Iu(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:s.code,message:s.message},links:e.links.map(e=>Fu(e,t)),droppedLinksCount:e.droppedLinksCount,flags:Nu(o.traceFlags,(a=e.parentSpanContext)==null?void 0:a.isRemote)}}function Fu(e,t){var n;return{attributes:e.attributes?_u(e.attributes,t):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:(n=e.context.traceState)==null?void 0:n.serialize(),droppedAttributesCount:e.droppedAttributesCount||0,flags:Nu(e.context.traceFlags,e.context.isRemote)}}function Iu(e,t){return{attributes:e.attributes?_u(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function Lu(e,t){return{resourceSpans:zu(e,t)}}function Ru(e){let t=new Map;for(let n of e){let e=t.get(n.resource);e||(e=new Map,t.set(n.resource,e));let r=`${n.instrumentationScope.name}@${n.instrumentationScope.version||``}:${n.instrumentationScope.schemaUrl||``}`,i=e.get(r);i||(i=[],e.set(r,i)),i.push(n)}return t}function zu(e,t){let n=Ru(e),r=[],i=n.entries(),a=i.next();for(;!a.done;){let[e,n]=a.value,o=[],s=n.values(),c=s.next();for(;!c.done;){let e=c.value;if(e.length>0){let n=e.map(e=>Pu(e,t));o.push({scope:gu(e[0].instrumentationScope),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=s.next()}let l=hu(e,t),u={resource:l,scopeSpans:o,schemaUrl:l.schemaUrl};r.push(u),a=i.next()}return r}let Bu={serializeRequest:e=>{let t=bu(e,Mu);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;return JSON.parse(t.decode(e))}},Vu={serializeRequest:e=>{let t=Lu(e,Mu);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;return JSON.parse(t.decode(e))}};var Hu=class{constructor(e){this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}},Uu=class extends Error{constructor(e,t,n){super(e),j(this,`code`,void 0),j(this,`name`,`OTLPExporterError`),j(this,`data`,void 0),this.data=n,this.code=t}},Wu=class{constructor(e){j(this,`_concurrencyLimit`,void 0),j(this,`_sendingPromises`,[]),this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw Error(`Concurrency Limit reached`);this._sendingPromises.push(e);let t=()=>{let t=this._sendingPromises.indexOf(e);this._sendingPromises.splice(t,1)};e.then(t,t)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}awaitAll(){var e=this;return P(function*(){yield Promise.all(e._sendingPromises)})()}};function Gu(e){return new Wu(e.concurrencyLimit)}var $;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})($||($={}));function Ku(e){return Object.prototype.hasOwnProperty.call(e,`partialSuccess`)}function qu(){return{handleResponse(e){e==null||!Ku(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||E.warn(`Received Partial Success response:`,JSON.stringify(e.partialSuccess))}}}var Ju=class{constructor(e,t,n,r,i){j(this,`_diagLogger`,void 0),j(this,`_transport`,void 0),j(this,`_serializer`,void 0),j(this,`_responseHandler`,void 0),j(this,`_promiseQueue`,void 0),j(this,`_timeout`,void 0),this._transport=e,this._serializer=t,this._responseHandler=n,this._promiseQueue=r,this._timeout=i,this._diagLogger=E.createComponentLogger({namespace:`OTLPExportDelegate`})}export(e,t){if(this._diagLogger.debug(`items to be sent`,e),this._promiseQueue.hasReachedLimit()){t({code:$.FAILED,error:Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);if(n==null){t({code:$.FAILED,error:Error(`Nothing to send`)});return}this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(e=>{if(e.status===`success`){if(e.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(e.data))}catch(t){this._diagLogger.warn(`Export succeeded but could not deserialize response - is the response specification compliant?`,t,e.data)}t({code:$.SUCCESS});return}else if(e.status===`failure`&&e.error){t({code:$.FAILED,error:e.error});return}else if(e.status===`retryable`){var n;t({code:$.FAILED,error:(n=e.error)==null?new Uu(`Export failed with retryable status`):n})}else t({code:$.FAILED,error:new Uu(`Export failed with unknown error`)})},e=>t({code:$.FAILED,error:e})))}forceFlush(){return this._promiseQueue.awaitAll()}shutdown(){var e=this;return P(function*(){e._diagLogger.debug(`shutdown started`),yield e.forceFlush(),e._transport.shutdown()})()}};function Yu(e,t){return new Ju(e.transport,e.serializer,qu(),e.promiseHandler,t.timeout)}function Xu(e,t,n){return Yu({transport:n,serializer:t,promiseHandler:Gu(e)},{timeout:e.timeoutMillis})}let Zu=49152,Qu=0,$u=0;var ed=class e{constructor(e){this._config=e}static _compressRequest(e){return P(function*(){let t=new CompressionStream(`gzip`),n=t.writable.getWriter();n.write(e),n.close();let r=[],i=t.readable.getReader(),a=!1;for(;!a;){let e=yield i.read();e.value&&r.push(e.value),a=e.done}let o=new Uint8Array(r.reduce((e,t)=>e+t.length,0)),s=0;for(let e of r)o.set(e,s),s+=e.length;return o})()}send(e,t){return this._asyncSend(e,t)}shutdown(){}_asyncSend(t,n){var r=this;return P(function*(){let i=t,a=L({"Content-Type":`application/json`},r._config.headers),o,s;if(`timeout`in AbortSignal)o=AbortSignal.timeout(n);else{let e=new AbortController;o=e.signal,s=setTimeout(()=>{e.abort(new DOMException(`TimeoutError`,`TimeoutError`))},n)}let c=!1;try{if(r._config.compression===`gzip`){try{i=yield e._compressRequest(t)}catch(e){let t=e instanceof Error?e:Error(String(e));return E.warn(`Fetch transport gzip compression failed: ${t.message}`),{status:`failure`,error:t}}a[`Content-Encoding`]=`gzip`,a[`Content-Length`]=i.length.toString()}let n=Qu+i.byteLength>Zu;if(c=!n&&!($u>=9),c)Qu+=i.byteLength,$u++;else{let e=n?`inflight bytes (${Qu} + ${i.byteLength}) would exceed ${Zu}B budget`:`concurrent count (${$u}) at limit of 9`;E.debug(`Sending without keepalive: ${e}`)}let s=yield fetch(r._config.url,{method:`POST`,keepalive:c,headers:a,body:i,signal:o});if(s.ok)return{status:`success`};let l=Error(`${s.status} Fetch request failed`),u=`Fetch transport received HTTP ${s.status} (keepalive=${c})`;return s.status>=500?(E.debug(u),{status:`retryable`,error:l}):(E.warn(u),{status:`failure`,error:l})}catch(e){let t=e instanceof Error?e:Error(String(e)),n=t instanceof TypeError||t instanceof DOMException&&t.name===`TimeoutError`,r=`Fetch transport failed (keepalive=${c}): ${t.message}`;return n?E.debug(r):E.warn(r),{status:n?`retryable`:`failure`,error:t}}finally{s!==void 0&&clearTimeout(s),c&&(Qu-=i.byteLength,$u--)}})()}};let td=e=>new ed(e),nd=()=>Math.random()*40-20;var rd=class{constructor(e,t=new ra){this._transport=e,this._perf=t}send(e,t){var n=this;return P(function*(){let r=n._perf.getNowMillis()+t,i=yield n._transport.send(e,t),a=5,o=1e3;for(;i.status===`retryable`&&a>0;){var s;a--;let t=Math.max(Math.min(o,5e3)+nd(),0);o*=1.5;let c=(s=i.retryInMillis)==null?t:s,l=r-n._perf.getNowMillis();if(c>l)return i;i=yield n._retry(e,l,c)}return i})()}shutdown(){this._transport.shutdown()}_retry(e,t,n){return new Promise((r,i)=>{setTimeout(()=>{this._transport.send(e,t).then(r,i)},n)})}};let id=e=>{var t;return new rd(e.transport,(t=e.perf)==null?new ra:t)},ad=(e,t)=>Xu(e,t,id({transport:td(e)}));var od=class extends Hu{constructor(e){super(ad(e,Bu))}};let sd=(e,t)=>`${mu(e,t)}/v1/logs`;var cd=class extends od{constructor({appID:e,userID:t,mxlDataURL:n}){super(L(L({},fu),{},{headers:pu(e,t),url:sd(e,n)}))}},ld=class extends Hu{constructor(e){super(ad(L(L({},e),{},{compression:`gzip`}),Vu))}};let ud=(e,t)=>`${mu(e,t)}/v1/traces`;var dd=class extends ld{constructor({appID:e,userID:t,mxlDataURL:n}){super(L(L({},fu),{},{headers:pu(e,t),url:ud(e,n)}))}},fd=class{constructor({spanSessionManager:e}){j(this,`_spanSessionManager`,void 0),this._spanSessionManager=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){e.setAttributes({"log.record.uid":kt(),[ro]:this._spanSessionManager.getSessionId(),"session.previous_id":this._spanSessionManager.getPreviousSessionId()})}shutdown(){return Promise.resolve(void 0)}},pd=class{constructor({attributeScrubbers:e}){j(this,`_attributeScrubbers`,void 0),this._attributeScrubbers=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){this._attributeScrubbers.forEach(t=>{let n=e.attributes[t.key];n&&typeof n==`string`&&e.setAttribute(t.key,t.scrub(n))})}shutdown(){return Promise.resolve(void 0)}},md=class{constructor({urlDocument:e=window.document}={}){j(this,`_urlDocument`,void 0),this._urlDocument=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){e.attributes[k]||e.setAttribute(k,A.SystemLog),e.setAttribute(N,this._urlDocument.URL)}shutdown(){return Promise.resolve(void 0)}};let hd=e=>{if((e.attributes[tn]||e.attributes[Yt])&&(typeof e.attributes[rn]==`number`||typeof e.attributes[Zt]==`number`)){var t;let n=(t=e.attributes[N])==null?e.attributes[Xt]:t;return typeof n==`string`&&n.includes(`://`)}return!1};var gd=class{forceFlush(){return Promise.resolve(void 0)}onEnd(e){if(hd(e)){var t,n,r,i,a;e.attributes[k]=A.Network,(t=e.attributes)[N]!=null||(t[N]=e.attributes[Xt]),(n=e.attributes)[rn]!=null||(n[rn]=e.attributes[Zt]),(r=e.attributes)[tn]!=null||(r[tn]=e.attributes[Yt]),(i=e.attributes)[no]!=null||(i[no]=e.attributes[`http.response_content_length`]),(a=e.attributes)[to]!=null||(a[to]=e.attributes[`http.request_content_length`])}}onStart(){}shutdown(){return Promise.resolve(void 0)}};let _d=e=>e.attributes[k]===A.Session,vd=(e,t)=>`mxl.${t===`current`?`export_failed`:`previous_export_failed`}.${e}`;var yd=class{constructor({resource:e,exporter:t,limitManager:n,spanSessionManager:r,storage:i=window.localStorage,storedSpansExpireTimeoutMS:a,diag:o=E.createComponentLogger({namespace:`MXLSessionBatchedSpanProcessor`})}){j(this,`_shutdownOnce`,void 0),j(this,`_pendingSpans`,[]),j(this,`_exporter`,void 0),j(this,`_limitManager`,void 0),j(this,`_spanStorage`,void 0),j(this,`_spanSessionManager`,void 0),j(this,`_diag`,void 0),j(this,`_shutdown`,()=>(this._spanStorage.destroy(),this._exporter.shutdown())),this._diag=o,this._exporter=t,this._shutdownOnce=new Mn(this._shutdown,this),this._limitManager=n,this._spanSessionManager=r,this._spanStorage=new ea({resource:e,storage:i,diag:o,onExpiredSpansExport:e=>{this._exportSpans(e)},storedSpansExpireTimeoutMS:a,spanSessionManager:r})}forceFlush(){return this._diag.debug(`forceFlush called for MXLSessionBatchedSpanProcessor. This is a no op`),Promise.resolve(void 0)}onEnd(e){if(this._shutdownOnce.isCalled){this._diag.debug(`span ended after processor shutdown. Ignoring span.`);return}if(_d(e))this._diag.debug(`session span ended. Exporting all pending spans.`),this._exportSpans([e,...this._pendingSpans]),this._pendingSpans=[];else{if(this._diag.debug(`non-session span ended. Adding to pending spans queue.`),this._limitManager.dropReadableSpan(e))return;this._pendingSpans.push(e)}}_exportSpans(e){Pn._export(this._exporter,e).then(e=>{if(e.code===gn.FAILED){var t;let n=((t=e.error)==null?void 0:t.message)||`unknown error`,r=`unknown`;n===`Concurrent export limit reached`?r=`concurrent_limit`:n===`Fetch request errored`&&(r=`fetch_error`),this._spanSessionManager.incrSessionCountForKey(vd(r,`current`)),this._spanSessionManager.incrNextSessionCountForKey(vd(r,`previous`)),this._diag.error(`spans failed to export: ${n}`)}}).catch(e=>{let t=`unknown error`;e&&e instanceof Error?t=e.message:typeof e==`string`&&(t=e),this._spanSessionManager.incrSessionCountForKey(vd(`unknown`,`current`)),this._spanSessionManager.incrNextSessionCountForKey(vd(`unknown`,`previous`)),this._diag.error(`spans failed to export: ${t}`)})}onStart(){}getPendingSpansCount(){return this._pendingSpans.length}storePendingSpans(e,t){this._spanStorage.storePendingSpans(e,t,this._pendingSpans)}clearStoredSpans(e){this._spanStorage.clearStoredSpans(e)}shutdown(){return this._shutdownOnce.call()}},bd=class{constructor({pageManager:e}){j(this,`_pageManager`,void 0),this._pageManager=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){if(!e.attributes[Pt]||!e.attributes[Ft]){let t=this._pageManager.getCurrentRoute();t&&(e.setAttribute(Pt,t.path),e.setAttribute(Ft,this._pageManager.getCurrentPageId()))}let t=this._pageManager.getPageLabel();t&&!e.attributes[It]&&e.setAttribute(It,t)}shutdown(){return Promise.resolve(void 0)}},xd=class{constructor({pageManager:e}){j(this,`_pageManager`,void 0),this._pageManager=e}forceFlush(){return Promise.resolve(void 0)}onEnd(e){if(!e.attributes[Pt]||!e.attributes[Ft]){let t=this._pageManager.getCurrentRoute(),n=this._pageManager.getCurrentPageId();t&&n&&(e.attributes[Pt]=t.path,e.attributes[Ft]=n)}let t=this._pageManager.getPageLabel();t&&!e.attributes[It]&&(e.attributes[It]=t)}onStart(){}shutdown(){return Promise.resolve(void 0)}},Sd=class{constructor({attributeScrubbers:e}){j(this,`_attributeScrubbers`,void 0),this._attributeScrubbers=e}forceFlush(){return Promise.resolve(void 0)}onEnd(e){this._attributeScrubbers.forEach(t=>{let n=e.attributes[t.key];n&&typeof n==`string`&&(e.attributes[t.key]=t.scrub(n))})}onStart(){}shutdown(){return Promise.resolve(void 0)}},Cd=class{constructor({userManager:e}){j(this,`_userManager`,void 0),this._userManager=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){this._userManager.getUserId()&&e.setAttributes({[io]:this._userManager.getUserId()})}shutdown(){return Promise.resolve(void 0)}},wd=class{constructor({userManager:e}){j(this,`_userManager`,void 0),this._userManager=e}forceFlush(){return Promise.resolve(void 0)}onEnd(e){let t=this._userManager.getUserId();t&&(e.attributes[io]=t)}onStart(){}shutdown(){return Promise.resolve(void 0)}},Td=class extends An{inject(e,t,n){super.inject(e,t,n);let r=O.getSpan(e);if(r){let e=ke.get(t,`traceparent`);e&&r.setAttribute(`mxl.w3c_traceparent`,e)}}};let Ed=/\/\/(.+):(.+)@(.+)\//,Dd=[`AWSAccessKeyId`,`Signature`,`sig`,"`X-Goog-Signature",`password`,`auth`,`pw`,`token`],Od=({value:e,queryParamRegex:t,scrubPath:n,scrubQuery:r})=>{let i=e;return n&&(i=i.replace(Ed,`//REDACTED:REDACTED@$3/`)),r&&(i=i.replaceAll(t,`$1$2=REDACTED`)),i},kd=e=>{let t=[...Dd,...e||[]],n=RegExp(`(^|&|\\?)(${t.join(`|`)})=[^&]+`,`g`);return[{key:N,scrub:e=>Od({value:e,queryParamRegex:n,scrubPath:!0,scrubQuery:!0})},{key:Xt,scrub:e=>Od({value:e,queryParamRegex:n,scrubPath:!0,scrubQuery:!0})},{key:`url.path`,scrub:e=>Od({value:e,queryParamRegex:n,scrubPath:!0,scrubQuery:!1})},{key:`url.query`,scrub:e=>Od({value:e,queryParamRegex:n,scrubPath:!1,scrubQuery:!0})}]},Ad=new class{constructor({diagLogger:e=E.createComponentLogger({namespace:`mxl-registry`})}={}){j(this,`_sdk`,null),j(this,`_diag`,void 0),j(this,`register`,e=>{this._sdk!==null&&this._diag.warn(`previously registered sdk will be overwritten`),this._sdk=e}),j(this,`clear`,()=>{this._sdk===null&&this._diag.warn(`sdk already cleared, this is a no-op`),this._sdk=null}),j(this,`registered`,()=>this._sdk),this._diag=e}},jd=(e={},{featureManager:t,logManager:n,spanSessionManager:r,mxlSpanProcessor:i,pageManager:a})=>{var o,s,c,l,u,d;let f=[new Rs(e[`session-on-load`]),new Hs(e[`session-visibility`],t,i),new Ls(e[`session-activity`]),new Bs(e[`session-timeout`])];(o=e.omit)!=null&&o.has(`exception`)||f.push(new go(e.exception)),(s=e.omit)!=null&&s.has(`click`)||f.push(new ho(e.click)),(c=e.omit)!=null&&c.has(`web-vital`)||f.push(new Ic(L(L({},e[`web-vital`]),{},{pageManager:a}))),(l=e.omit)!=null&&l.has(`document-load`)||f.push(new fo(e[`document-load`])),(u=e.omit)!=null&&u.has(`@opentelemetry/instrumentation-fetch`)||f.push(new rs(L(L({},e.network),e[`@opentelemetry/instrumentation-fetch`]))),(d=e.omit)!=null&&d.has(`@opentelemetry/instrumentation-xml-http-request`)||f.push(new vl(L(L({},e.network),e[`@opentelemetry/instrumentation-xml-http-request`]))),e[`empty-root`]&&f.push(new po(L({},e[`empty-root`])));for(let e of f)e instanceof G&&(r&&e.setSessionManager(r),n&&e.setLogManager(n));return f},Md=e=>{if(e!==void 0){if(typeof e!=`string`)throw Error(`appID must be a string, or omitted if not using MXL. Received ${String(e)}`);return e}},Nd=e=>{if(e===void 0){let e=`MXLAppVersionX.X.X`;return e===``?`unspecified`:e}if(typeof e!=`string`)throw Error(`if appVersion is specified, it must be a string. Received ${String(e)}`);let t=e.trim();if(t===``)throw Error(`if appVersion is specified, it cannot be an empty string.`);return t},Pd=(e,t)=>{var n,r,i,a;if(!t.size)return e;let o=[...(n=e==null||(r=e.network)==null?void 0:r.ignoreUrls)==null?[]:n,...(i=e==null||(a=e[`@opentelemetry/instrumentation-fetch`])==null?void 0:a.ignoreUrls)==null?[]:i,...Array.from(t)];return o.length?L(L({},e),{},{network:L(L({},e==null?void 0:e.network),{},{ignoreUrls:o}),"@opentelemetry/instrumentation-fetch":(e==null?void 0:e[`@opentelemetry/instrumentation-fetch`])===void 0?void 0:L(L({},e[`@opentelemetry/instrumentation-fetch`]),{},{ignoreUrls:o})}):e},Fd=({appID:e,appVersion:t,resource:n=zn(),spanExporters:r=[],logExporters:i=[],spanProcessors:a=[],propagator:o=null,defaultInstrumentationConfig:s,instrumentations:c=[],contextManager:l=null,logProcessors:u=[],attributeScrubbers:d=[],enableDefaultAttributeScrubbing:f=!0,additionalQueryParamsToScrub:p=[],logLevel:ee=h.ERROR,mxlDataURL:m,mxlConfigURL:te,diagLogger:g=E.createComponentLogger({namespace:`mxl-sdk`}),dynamicSDKConfigManager:ne,dynamicSDKConfig:re,registerGlobally:_=!0,blockNetworkSpanForwarding:ie=!1,restrictedProtocols:ae=new Set([`file:`]),useDocumentTitleAsPageLabel:oe=!0}={})=>{try{let h=new ra,ce=h.getNowMillis();if(_){let e=Ad.registered();if(e!==null)return g.warn(`SDK has already been successfully initialized, skipping this invocation of initSDK`),e}E.setLogger(new de,{logLevel:ee});let le=Md(e),ue=Nd(t),v=le!==void 0;if(!v&&!i.length&&!r.length)throw Error(`when appID is omitted, at least one logExporter or spanExporter must be set`);if(ae.has(window.location.protocol))throw Error(`not initializing due to restricted protocol: ${window.location.protocol}`);if(v&&typeof CompressionStream>`u`)throw Error(`CompressionStream is not supported in this browser and required for data compression.`);let y=!_&&e,b=y?new ta(e,window.localStorage):window.localStorage,x=y?new ta(e,window.sessionStorage):window.sessionStorage,fe=n.merge(ws({diagLogger:g,appVersion:ue,pageSessionStorage:x})),S=Id({registerGlobally:_,sdkLocalStorage:b}),pe=S.getMXLUserId();if(v&&!pe)throw Error(`userID is required when using MXL exporter`);let me=ne==null?new fs({appID:le,appVersion:ue,mxlConfigURL:te,defaultConfig:re,deviceId:pe,storage:b}):ne;me.refreshRemoteConfig();let he=new ys({dynamicConfigManager:me,deviceId:pe,blockNetworkSpanForwarding:ie});if(!he.isSDKEnabled())return g.debug(`SDK is disabled, skipping initialization.`),!1;let ge=new Set;for(let e of[...r,...i])e&&typeof e.url==`string`&&ge.add(e.url);v&&le&&(ge.add(ud(le,m)),ge.add(sd(le,m)));let _e=Pd(s,ge),ve=na({featureManager:he,diag:g,registerGlobally:_,defaultInstrumentationConfig:_e,propagator:o}),ye=new hs(ps),be=[...f?kd(p):[],...d],C=Ld({limitManager:ye,registerGlobally:_,sdkLocalStorage:b,sdkSessionStorage:x}),xe,Se;if(v){var se;xe=new yd({resource:fe,exporter:new dd({appID:le,mxlDataURL:m,userID:pe}),limitManager:ye,storedSpansExpireTimeoutMS:s==null||(se=s[`session-visibility`])==null?void 0:se.storedSpansExpireTimeoutMS,storage:b,spanSessionManager:C}),Se=new lu(new cd({appID:le,mxlDataURL:m,userID:pe}))}let Ce=Bd({useDocumentTitleAsPageLabel:oe,registerGlobally:_}),{tracerProvider:we,mxlTraceManager:Te}=Rd({resource:fe,spanSessionManager:C,userManager:S,spanExporters:r,spanProcessors:a,propagator:ve?new Td:o,contextManager:l,attributeScrubbers:be,registerGlobally:_,mxlSpanProcessor:xe,pageManager:Ce});C.setTracerProvider(we);let{loggerProvider:Ee,mxlLogManager:De}=zd({resource:fe,userManager:S,logExporters:i,logProcessors:u,spanSessionManager:C,limitManager:ye,attributeScrubbers:be,registerGlobally:_,mxlLogProcessor:Se,sdkLocalStorage:b,pageManager:Ce});Qa(_?{instrumentations:[jd(_e,{featureManager:he,mxlSpanProcessor:xe,pageManager:Ce}),...c]}:{tracerProvider:we,loggerProvider:Ee,instrumentations:[jd(_e,{featureManager:he,logManager:De,spanSessionManager:C,mxlSpanProcessor:xe,pageManager:Ce}),...c]}),g.info(`successfully initialized the SDK`);let Oe={setDynamicConfig:e=>{me.setConfig(e)},flush:function(){var e=P(function*(){yield we.forceFlush(),yield Ee.forceFlush()});return function(){return e.apply(this,arguments)}}(),log:De,trace:Te,session:C,user:S,page:Ce};return _&&Ad.register(Oe),C.recordSDKStartupDuration(h.getNowMillis()-ce),Oe}catch(e){let t=e instanceof Error?e.message:`Unknown error.`;return g.error(`failed to initialize the SDK: ${t}`),!1}},Id=({registerGlobally:e,sdkLocalStorage:t})=>{let n=new Fs({storage:t});return e&&Ba.setGlobalUserManager(n),n},Ld=({limitManager:e,registerGlobally:t,sdkLocalStorage:n,sdkSessionStorage:r})=>{let i=new Os({limitManager:e,storage:n,sessionStorage:r});return t&&wa.setGlobalSessionManager(i),i},Rd=({resource:e,spanSessionManager:t,userManager:n,spanExporters:r,spanProcessors:i=[],propagator:a=null,contextManager:o=null,attributeScrubbers:s,registerGlobally:c,mxlSpanProcessor:l,pageManager:u})=>{let d=[...i,du(t),new gd,new wd({userManager:n}),new xd({pageManager:u}),new Sd({attributeScrubbers:s})];r==null||r.forEach(e=>{d.push(new wi(e))}),l&&d.push(l);let f=new Hi({resource:e,spanProcessors:d,spanLimits:{attributeCountLimit:ps.maxAllowed.session_property*2,attributePerEventCountLimit:20,eventCountLimit:ps.maxAllowed.breadcrumb*2,attributeValueLengthLimit:1024}}),p=new ks({tracerProvider:c?void 0:f});return c&&(Ma.setGlobalTraceManager(p),f.register({contextManager:o||new zi,propagator:a})),{tracerProvider:f,mxlTraceManager:p}},zd=({resource:e,userManager:t,logExporters:n,logProcessors:r,spanSessionManager:i,limitManager:a,attributeScrubbers:o,registerGlobally:s,mxlLogProcessor:c,sdkLocalStorage:l,pageManager:u})=>{let d=[...r,new fd({spanSessionManager:i}),new md,new Cd({userManager:t}),new pd({attributeScrubbers:o}),new bd({pageManager:u})];n==null||n.forEach(e=>{d.push(new lu(e))}),c&&d.push(c);let f=new su({resource:e,processors:d}),p=new _s({spanSessionManager:i,limitManager:a,loggerProvider:s?void 0:f,storage:l});return s&&(Ya.setGlobalLoggerProvider(f),da.setGlobalLogManager(p)),{loggerProvider:f,mxlLogManager:p}},Bd=({useDocumentTitleAsPageLabel:e,registerGlobally:t})=>{let n=new vs({useDocumentTitleAsPageLabel:e});return t&&U.setGlobalPageManager(n),n};return Object.defineProperty(e,`DiagLogLevel`,{enumerable:!0,get:function(){return h}}),e.getNavigationInstrumentation=ss,e.initSDK=Fd,e.log=da,e.page=U,e.session=wa,e.trace=Ma,e.user=Ba,e})({});
|
|
2
2
|
//# sourceMappingURL=mxl-web-sdk.js.map
|