@safaricom-mxl/web-sdk 0.0.23 → 0.0.24
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/README.md +16 -10
- package/dist/api-analytics/manager/types.d.cts +2 -2
- package/dist/api-analytics/manager/types.d.cts.map +1 -1
- package/dist/api-analytics/manager/types.d.ts +2 -2
- package/dist/api-analytics/manager/types.d.ts.map +1 -1
- package/dist/constants/attributes.cjs +6 -0
- package/dist/constants/attributes.cjs.map +1 -1
- package/dist/constants/attributes.d.cts +5 -1
- package/dist/constants/attributes.d.cts.map +1 -1
- package/dist/constants/attributes.d.ts +5 -1
- package/dist/constants/attributes.d.ts.map +1 -1
- package/dist/constants/attributes.js +5 -1
- package/dist/constants/attributes.js.map +1 -1
- package/dist/managers/MXLAnalyticsManager/MXLAnalyticsManager.cjs +6 -3
- package/dist/managers/MXLAnalyticsManager/MXLAnalyticsManager.cjs.map +1 -1
- package/dist/managers/MXLAnalyticsManager/MXLAnalyticsManager.d.cts.map +1 -1
- package/dist/managers/MXLAnalyticsManager/MXLAnalyticsManager.d.ts.map +1 -1
- package/dist/managers/MXLAnalyticsManager/MXLAnalyticsManager.js +7 -4
- package/dist/managers/MXLAnalyticsManager/MXLAnalyticsManager.js.map +1 -1
- package/dist/mxl-web-sdk.js +2 -2
- package/dist/mxl-web-sdk.js.map +1 -1
- package/dist/resources/sdkConstants.cjs +1 -1
- package/dist/resources/sdkConstants.cjs.map +1 -1
- package/dist/resources/sdkConstants.d.cts +1 -1
- package/dist/resources/sdkConstants.d.ts +1 -1
- package/dist/resources/sdkConstants.js +1 -1
- package/dist/resources/sdkConstants.js.map +1 -1
- package/package.json +8 -8
package/dist/mxl-web-sdk.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";window.MXLWebSdk=window.MXLWebSdk||(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Object.defineProperty,n=(e,t)=>()=>(e&&(t=e(e=0)),t),r=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},i,a=n((()=>{i=`1.9.1`}));function o(e){let t=new Set([e]),n=new Set,r=e.match(s);if(!r)return()=>!1;let i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(t){return t===e};function a(e){return n.add(e),!1}function o(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(n.has(e))return!1;let r=e.match(s);if(!r)return a(e);let c={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};return c.prerelease!=null||i.major!==c.major?a(e):i.major===0?i.minor===c.minor&&i.patch<=c.patch?o(e):a(e):i.minor<=c.minor?o(e):a(e)}}var s,c,l=n((()=>{a(),s=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,c=o(i)}));function u(e,t,n,r=!1){var a;let o=h[m]=(a=h[m])==null?{version:i}:a;if(!r&&o[e]){let t=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return n.error(t.stack||t.message),!1}if(o.version!==`1.9.1`){let t=Error(`@opentelemetry/api: Registration of version v${o.version} for ${e} does not match previously registered API v${i}`);return n.error(t.stack||t.message),!1}return o[e]=t,n.debug(`@opentelemetry/api: Registered a global for ${e} v${i}.`),!0}function d(e){var t,n;let r=(t=h[m])==null?void 0:t.version;if(!(!r||!c(r)))return(n=h[m])==null?void 0:n[e]}function f(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${i}.`);let n=h[m];n&&delete n[e]}var p,m,h,g=n((()=>{a(),l(),p=i.split(`.`)[0],m=Symbol.for(`opentelemetry.js.api.${p}`),h=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{}}));function _(e,t,n){let r=d(`diag`);if(r)return r[e](t,...n)}var v,y=n((()=>{g(),v=class{constructor(e){this._namespace=e.namespace||`DiagComponentLogger`}debug(...e){return _(`debug`,this._namespace,e)}error(...e){return _(`error`,this._namespace,e)}info(...e){return _(`info`,this._namespace,e)}warn(...e){return _(`warn`,this._namespace,e)}verbose(...e){return _(`verbose`,this._namespace,e)}}})),b,ee=n((()=>{(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`})(b||(b={}))}));function te(e,t){e<b.NONE?e=b.NONE:e>b.ALL&&(e=b.ALL),t=t||{};function n(n,r){let i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,b.ERROR),warn:n(`warn`,b.WARN),info:n(`info`,b.INFO),debug:n(`debug`,b.DEBUG),verbose:n(`verbose`,b.VERBOSE)}}var x=n((()=>{ee()})),ne,S,re=n((()=>{y(),x(),ee(),g(),ne=`diag`,S=class e{static instance(){return this._instance||(this._instance=new e),this._instance}constructor(){function e(e){return function(...t){let n=d(`diag`);if(n)return n[e](...t)}}let t=this;t.setLogger=(e,n={logLevel:b.INFO})=>{var r,i,a;if(e===t){let e=Error(`Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation`);return t.error((r=e.stack)==null?e.message:r),!1}typeof n==`number`&&(n={logLevel:n});let o=d(`diag`),s=te((i=n.logLevel)==null?b.INFO:i,e);if(o&&!n.suppressOverrideMessage){let e=(a=Error().stack)==null?`<failed to generate stacktrace>`:a;o.warn(`Current logger will be overwritten from ${e}`),s.warn(`Current logger will overwrite one already registered from ${e}`)}return u(`diag`,s,t,!0)},t.disable=()=>{f(ne,t)},t.createComponentLogger=e=>new v(e),t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}}})),ie,ae=n((()=>{ie=class e{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){let t=this._entries.get(e);if(t)return Object.assign({},t)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(t,n){let r=new e(this._entries);return r._entries.set(t,n),r}removeEntry(t){let n=new e(this._entries);return n._entries.delete(t),n}removeEntries(...t){let n=new e(this._entries);for(let e of t)n._entries.delete(e);return n}clear(){return new e}}})),oe,se=n((()=>{oe=Symbol(`BaggageEntryMetadata`)}));function ce(e={}){return new ie(new Map(Object.entries(e)))}function le(e){return typeof e!=`string`&&(ue.error(`Cannot create baggage metadata from unknown type: ${typeof e}`),e=``),{__TYPE__:oe,toString(){return e}}}var ue,de=n((()=>{re(),ae(),se(),ue=S.instance()}));function fe(e){return Symbol.for(e)}var C,w,pe=n((()=>{C=class e{constructor(t){let n=this;n._currentContext=t?new Map(t):new Map,n.getValue=e=>n._currentContext.get(e),n.setValue=(t,r)=>{let i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=t=>{let r=new e(n._currentContext);return r._currentContext.delete(t),r}}},w=new C})),me,he,ge,_e=n((()=>{if(me=[{n:`error`,c:`error`},{n:`warn`,c:`warn`},{n:`info`,c:`info`},{n:`debug`,c:`debug`},{n:`verbose`,c:`trace`}],he={},typeof console<`u`)for(let e of[`error`,`warn`,`info`,`debug`,`trace`,`log`])typeof console[e]==`function`&&(he[e]=console[e]);ge=class{constructor(){function e(e){return function(...t){let n=he[e];if(typeof n!=`function`&&(n=he.log),typeof n!=`function`&&console&&(n=console[e],typeof n!=`function`&&(n=console.log)),typeof n==`function`)return n.apply(console,t)}}for(let t=0;t<me.length;t++)this[me[t].n]=e(me[t].c)}}}));function ve(){return E}var ye,T,be,xe,Se,Ce,we,Te,Ee,De,E,Oe,ke,Ae,je,Me,Ne,Pe,Fe=n((()=>{ye=class{constructor(){}createGauge(e,t){return ke}createHistogram(e,t){return Ae}createCounter(e,t){return Oe}createUpDownCounter(e,t){return je}createObservableGauge(e,t){return Ne}createObservableCounter(e,t){return Me}createObservableUpDownCounter(e,t){return Pe}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}},T=class{},be=class extends T{add(e,t){}},xe=class extends T{add(e,t){}},Se=class extends T{record(e,t){}},Ce=class extends T{record(e,t){}},we=class{addCallback(e){}removeCallback(e){}},Te=class extends we{},Ee=class extends we{},De=class extends we{},E=new ye,Oe=new be,ke=new Se,Ae=new Ce,je=new xe,Me=new Te,Ne=new Ee,Pe=new De})),Ie,Le,Re=n((()=>{Ie={get(e,t){if(e!=null)return e[t]},keys(e){return e==null?[]:Object.keys(e)}},Le={set(e,t,n){e!=null&&(e[t]=n)}}})),ze,Be=n((()=>{pe(),ze=class{active(){return w}with(e,t,n,...r){return t.call(n,...r)}bind(e,t){return t}enable(){return this}disable(){return this}}})),Ve,He,Ue,We=n((()=>{Be(),g(),re(),Ve=`context`,He=new ze,Ue=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalContextManager(e){return u(Ve,e,S.instance())}active(){return this._getContextManager().active()}with(e,t,n,...r){return this._getContextManager().with(e,t,n,...r)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return d(Ve)||He}disable(){this._getContextManager().disable(),f(Ve,S.instance())}}})),D,Ge=n((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(D||(D={}))})),Ke,qe,Je,Ye=n((()=>{Ge(),Ke=`0000000000000000`,qe=`00000000000000000000000000000000`,Je={traceId:qe,spanId:Ke,traceFlags:D.NONE}})),Xe,Ze=n((()=>{Ye(),Xe=class{constructor(e=Je){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){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){}}}));function Qe(e){return e.getValue(it)||void 0}function $e(){return Qe(Ue.getInstance().active())}function et(e,t){return e.setValue(it,t)}function tt(e){return e.deleteValue(it)}function nt(e,t){return et(e,new Xe(t))}function rt(e){var t;return(t=Qe(e))==null?void 0:t.spanContext()}var it,at=n((()=>{pe(),Ze(),We(),it=fe(`OpenTelemetry Context Key SPAN`)}));function ot(e,t){if(typeof e!=`string`||e.length!==t)return!1;let n=0;for(let t=0;t<e.length;t+=4)n+=(dt[e.charCodeAt(t)]|0)+(dt[e.charCodeAt(t+1)]|0)+(dt[e.charCodeAt(t+2)]|0)+(dt[e.charCodeAt(t+3)]|0);return n===t}function st(e){return ot(e,32)&&e!==`00000000000000000000000000000000`}function ct(e){return ot(e,16)&&e!==`0000000000000000`}function lt(e){return st(e.traceId)&&ct(e.spanId)}function ut(e){return new Xe(e)}var dt,ft=n((()=>{Ye(),Ze(),dt=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1])}));function pt(e){return typeof e==`object`&&!!e&&`spanId`in e&&typeof e.spanId==`string`&&`traceId`in e&&typeof e.traceId==`string`&&`traceFlags`in e&&typeof e.traceFlags==`number`}var mt,ht,gt=n((()=>{We(),at(),Ze(),ft(),mt=Ue.getInstance(),ht=class{startSpan(e,t,n=mt.active()){if(t!=null&&t.root)return new Xe;let r=n&&rt(n);return pt(r)&<(r)?new Xe(r):new Xe}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a==null?mt.active():a,c=this.startSpan(e,i,s),l=et(s,c);return mt.with(l,o,void 0,c)}}})),_t,vt,yt=n((()=>{gt(),_t=new ht,vt=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}startSpan(e,t,n){return this._getTracer().startSpan(e,t,n)}startActiveSpan(e,t,n,r){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):_t}}})),bt,xt=n((()=>{gt(),bt=class{getTracer(e,t,n){return new ht}}})),St,Ct,wt=n((()=>{yt(),xt(),St=new bt,Ct=class{getTracer(e,t,n){var r;return(r=this.getDelegateTracer(e,t,n))==null?new vt(this,e,t,n):r}getDelegate(){var e;return(e=this._delegate)==null?St:e}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){var r;return(r=this._delegate)==null?void 0:r.getTracer(e,t,n)}}})),Tt,Et=n((()=>{(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(Tt||(Tt={}))})),Dt,Ot=n((()=>{(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`})(Dt||(Dt={}))})),kt,At=n((()=>{(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(kt||(kt={}))})),O,jt=n((()=>{We(),O=Ue.getInstance()})),k,Mt=n((()=>{re(),k=S.instance()})),Nt,Pt,Ft=n((()=>{Fe(),Nt=class{getMeter(e,t,n){return E}},Pt=new Nt})),It,Lt,Rt=n((()=>{Ft(),g(),re(),It=`metrics`,Lt=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalMeterProvider(e){return u(It,e,S.instance())}getMeterProvider(){return d(It)||Pt}getMeter(e,t,n){return this.getMeterProvider().getMeter(e,t,n)}disable(){f(It,S.instance())}}})),zt,Bt=n((()=>{Rt(),zt=Lt.getInstance()})),Vt,Ht=n((()=>{Vt=class{inject(e,t){}extract(e,t){return e}fields(){return[]}}}));function Ut(e){return e.getValue(qt)||void 0}function Wt(){return Ut(Ue.getInstance().active())}function Gt(e,t){return e.setValue(qt,t)}function Kt(e){return e.deleteValue(qt)}var qt,Jt=n((()=>{We(),pe(),qt=fe(`OpenTelemetry Baggage Key`)})),Yt,Xt,Zt,Qt=n((()=>{g(),Ht(),Re(),Jt(),de(),re(),Yt=`propagation`,Xt=new Vt,Zt=class e{constructor(){this.createBaggage=ce,this.getBaggage=Ut,this.getActiveBaggage=Wt,this.setBaggage=Gt,this.deleteBaggage=Kt}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalPropagator(e){return u(Yt,e,S.instance())}inject(e,t,n=Le){return this._getGlobalPropagator().inject(e,t,n)}extract(e,t,n=Ie){return this._getGlobalPropagator().extract(e,t,n)}fields(){return this._getGlobalPropagator().fields()}disable(){f(Yt,S.instance())}_getGlobalPropagator(){return d(Yt)||Xt}}})),A,$t=n((()=>{Qt(),A=Zt.getInstance()})),en,tn,nn=n((()=>{g(),wt(),ft(),at(),re(),en=`trace`,tn=class e{constructor(){this._proxyTracerProvider=new Ct,this.wrapSpanContext=ut,this.isSpanContextValid=lt,this.deleteSpan=tt,this.getSpan=Qe,this.getActiveSpan=$e,this.getSpanContext=rt,this.setSpan=et,this.setSpanContext=nt}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalTracerProvider(e){let t=u(en,this._proxyTracerProvider,S.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return d(en)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){f(en,S.instance()),this._proxyTracerProvider=new Ct}}})),j,rn=n((()=>{nn(),j=tn.getInstance()})),M=n((()=>{de(),pe(),_e(),ee(),Fe(),Re(),yt(),wt(),Et(),Ot(),At(),Ge(),ft(),Ye(),jt(),Mt(),Bt(),$t(),rn()}));M();function an(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}}}})}var on=class{logException(e,t){}message(e,t,n){}};function sn(e){"@babel/helpers - typeof";return sn=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},sn(e)}var cn=n((()=>{}));function ln(e,t){if(sn(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(sn(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var un=n((()=>{cn()}));function dn(e){var t=ln(e,`string`);return sn(t)==`symbol`?t:t+``}var fn=n((()=>{cn(),un()}));function N(e,t,n){return(t=dn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var P=n((()=>{fn()}));P();let pn=new on;var mn=class{constructor(){N(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?pn:e}setDelegate(e){this._delegate=e}logException(e,t){this.getDelegate().logException(e,t)}message(e,t,n){this.getDelegate().message(e,t,n)}};P();let hn=new on,gn=new Set([`setDelegate`,`getDelegate`]);var _n=class e{static getInstance(){if(!e._instance){let t=new mn,n=an(t,hn,k.createComponentLogger({namespace:`LogAPI`}),gn);e._instance=Object.assign(n,{getLogManager(){return t},setGlobalLogManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};N(_n,`_instance`,void 0);let vn=_n.getInstance();var yn=class{track(){}identify(){}increment(){}decrement(){}clear(){}screenView(){}};P();let bn=new yn;var xn=class{constructor(){N(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?bn:e}setDelegate(e){this._delegate=e}track(e,t){this.getDelegate().track(e,t)}identify(e){this.getDelegate().identify(e)}increment(e){this.getDelegate().increment(e)}decrement(e){this.getDelegate().decrement(e)}clear(){this.getDelegate().clear()}screenView(){this.getDelegate().screenView()}};M(),P();let Sn=new yn,Cn=new Set([`setDelegate`,`getDelegate`]);var wn=class e{static getInstance(){if(!e._instance){let t=new xn,n=an(t,Sn,k.createComponentLogger({namespace:`AnalyticsAPI`}),Cn);e._instance=Object.assign(n,{getAnalyticsManager(){return t},setGlobalAnalyticsManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};N(wn,`_instance`,void 0);let Tn=wn.getInstance();var En=class{setCurrentRoute(e){}getCurrentRoute(){return null}getCurrentPageId(){return``}setPageLabel(e){}getPageLabel(){return null}clearCurrentRoute(){}};P();let Dn=new En;var On=class{constructor(){N(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?Dn: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()}};M(),P();let kn=new En,An=new Set([`setDelegate`,`getDelegate`]);var jn=class e{static getInstance(){if(!e._instance){let t=new On,n=an(t,kn,k.createComponentLogger({namespace:`PageAPI`}),An);e._instance=Object.assign(n,{getPageManager(){return t},setGlobalPageManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};N(jn,`_instance`,void 0);let Mn=jn.getInstance();var Nn=class{addBreadcrumb(e){}addProperty(e,t,n){}removeProperty(e){}getUserSessionId(){return null}getPreviousUserSessionId(){return null}getUserSessionStartTime(){return null}endUserSession(){}getUserSessionAttributes(){return null}getSessionPartProperties(){return{}}getSessionPartId(){return null}getSessionPartSpan(){return null}startSessionPartInternal(e){}endSessionPartInternal(e,t){}incrSessionPartCountForKey(e){}incrNextSessionPartCountForKey(e){}addSessionPartStartedListener(e){return()=>{}}addSessionPartEndedListener(e){return()=>{}}setTracerProvider(){}recordSDKStartupDuration(e){}_clearMaxDurationTimer(){}_shutdown(){}};P();let Pn=new Nn;var Fn=class{constructor(){N(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?Pn:e}setDelegate(e){let t=this._delegate;t&&t!==e&&t._shutdown(),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)}getUserSessionId(){return this.getDelegate().getUserSessionId()}getPreviousUserSessionId(){return this.getDelegate().getPreviousUserSessionId()}getUserSessionStartTime(){return this.getDelegate().getUserSessionStartTime()}endUserSession(){this.getDelegate().endUserSession()}getUserSessionAttributes(){return this.getDelegate().getUserSessionAttributes()}getSessionPartProperties(){return this.getDelegate().getSessionPartProperties()}getSessionPartId(){return this.getDelegate().getSessionPartId()}getSessionPartSpan(){return this.getDelegate().getSessionPartSpan()}startSessionPartInternal(e){this.getDelegate().startSessionPartInternal(e)}endSessionPartInternal(e,t){this.getDelegate().endSessionPartInternal(e,t)}incrSessionPartCountForKey(e){this.getDelegate().incrSessionPartCountForKey(e)}incrNextSessionPartCountForKey(e){this.getDelegate().incrNextSessionPartCountForKey(e)}addSessionPartStartedListener(e){return this.getDelegate().addSessionPartStartedListener(e)}addSessionPartEndedListener(e){return this.getDelegate().addSessionPartEndedListener(e)}setTracerProvider(e){this.getDelegate().setTracerProvider(e)}recordSDKStartupDuration(e){this.getDelegate().recordSDKStartupDuration(e)}_clearMaxDurationTimer(){this.getDelegate()._clearMaxDurationTimer()}_shutdown(){this.getDelegate()._shutdown()}};M(),P();let In=new Nn,Ln=new Set([`setDelegate`,`getDelegate`]);var Rn=class e{static getInstance(){if(!e._instance){let t=new Fn,n=an(t,In,k.createComponentLogger({namespace:`SessionAPI`}),Ln);e._instance=Object.assign(n,{getUserSessionManager(){return t},setGlobalUserSessionManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};N(Rn,`_instance`,void 0);let zn=Rn.getInstance();M(),P();var Bn=class{constructor(e=Je){N(this,`_spanContext`,void 0),N(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){}};M();var Vn=class{startSpan(e,t){return new Bn}setSpan(e,t){return w}getSpan(e){}};P();let Hn=new Vn;var Un=class{constructor(){N(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?Hn: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)}};M(),P();let Wn=new Vn,Gn=new Set([`setDelegate`,`getDelegate`]);var Kn=class e{static getInstance(){if(!e._instance){let t=new Un,n=an(t,Wn,k.createComponentLogger({namespace:`TraceAPI`}),Gn);e._instance=Object.assign(n,{getTraceManager(){return t},setGlobalTraceManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};N(Kn,`_instance`,void 0);let qn=Kn.getInstance();var Jn=class{getMXLUserId(){return``}getUserId(){return null}setUserId(){}clearUserId(){}};P();let Yn=new Jn;var Xn=class{constructor(){N(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?Yn: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()}};M(),P();let Zn=new Jn,Qn=new Set([`setDelegate`,`getDelegate`]);var $n=class e{static getInstance(){if(!e._instance){let t=new Xn,n=an(t,Zn,k.createComponentLogger({namespace:`UserAPI`}),Qn);e._instance=Object.assign(n,{getUserManager(){return t},setGlobalUserManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};N($n,`_instance`,void 0);let er=$n.getInstance(),F=`mxl.type`,tr=`mxl.state`,nr=`react.component_stack`,rr=`mxl.instrumentation`,ir=`mxl.js_file_bundle_ids`,ar=`browser.url.full`,or=`app.surface.name`,sr=`app.surface.id`,cr=`app.surface.label`,lr=`mxl.session_part_id`,ur=`mxl.user_session_id`,dr=`mxl.user_session_previous_id`,fr=`mxl.application.id`,I=`mxl.session_prev.`,pr={pageLabel:cr};function mr(e){return e.setValue(gr,!0)}function hr(e){return e.getValue(gr)===!0}var gr,_r=n((()=>{M(),gr=fe(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`)})),vr,yr,br=n((()=>{vr=`baggage`,yr=4096}));function xr(e){return e.reduce((e,t)=>{let n=`${e}${e===``?``:`,`}${t}`;return n.length>8192?e:n},``)}function Sr(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 Cr(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}}function wr(e,t,n,r){let i=0;for(;i<e.length&&n<180;){let a=e.indexOf(`,`,i),o=a===-1?e.length:a,s=o-i;if(s<=4096){let a=Cr(e.substring(i,o));if(a){let e=(n===0?0:1)+s;if(r+e>8192)break;t[a.key]=a.metadata?{value:a.value,metadata:a.metadata}:{value:a.value},n++,r+=e}}if(a===-1)break;i=a+1}return[n,r]}var Tr=n((()=>{M(),br()})),Er,Dr=n((()=>{M(),_r(),br(),Tr(),Er=class{inject(e,t,n){let r=A.getBaggage(e);if(!r||hr(e))return;let i=xr(Sr(r).filter(e=>e.length<=yr).slice(0,180));i.length>0&&n.set(t,vr,i)}extract(e,t,n){let r=n.get(t,vr);if(!r)return e;let i={},a=0,o=0;if(Array.isArray(r))for(let e=0;e<r.length;e++)[a,o]=wr(r[e],i,a,o);else [a]=wr(r,i,a,o);return a===0?e:A.setBaggage(e,A.createBaggage(i))}fields(){return[vr]}}}));function Or(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!kr(n)){k.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!Ar(r)){k.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function kr(e){return typeof e==`string`&&e!==``}function Ar(e){return e==null?!0:Array.isArray(e)?jr(e):Mr(typeof e)}function jr(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(Mr(e)){t=e;continue}return!1}return!1}}return!0}function Mr(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}var Nr=n((()=>{M()}));function Pr(){return e=>{k.error(Fr(e))}}function Fr(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}var Lr=n((()=>{M()}));function Rr(e){try{zr(e)}catch(e){}}var zr,Br=n((()=>{Lr(),zr=Pr()})),Vr=n((()=>{})),Hr,Ur=n((()=>{Hr=`2.10.0`})),Wr=n((()=>{})),Gr=n((()=>{Wr()})),Kr=n((()=>{})),qr=n((()=>{Kr()})),Jr,Yr,Xr,Zr,Qr,$r,ei,ti,ni,ri,ii,ai,oi,si,ci,li=n((()=>{Jr=`error.type`,Yr=`exception.message`,Xr=`exception.stacktrace`,Zr=`exception.type`,Qr=`http.request.method`,$r=`http.request.method_original`,ei=`http.response.status_code`,ti=`server.address`,ni=`server.port`,ri=`service.name`,ii=`telemetry.sdk.language`,ai=`webjs`,oi=`telemetry.sdk.name`,si=`telemetry.sdk.version`,ci=`url.full`})),ui=n((()=>{})),di=n((()=>{})),L=n((()=>{Gr(),qr(),li(),ui(),di()})),fi,pi=n((()=>{fi=`process.runtime.name`})),mi,hi=n((()=>{Ur(),L(),pi(),mi={[oi]:`opentelemetry`,[fi]:`browser`,[ii]:ai,[si]:Hr}})),R,gi=n((()=>{Vr(),hi(),R=performance}));function _i(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*Di)]}function vi(e){return Ti(_i(R.timeOrigin),_i(typeof e==`number`?e:R.now()))}function yi(e){if(Ci(e))return e;if(typeof e==`number`)return e<R.timeOrigin/2?vi(e):_i(e);if(e instanceof Date)return _i(e.getTime());throw TypeError(`Invalid input type`)}function bi(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=Oi),[n,r]}function xi(e){return e[0]*Oi+e[1]}function Si(e){return e[0]*1e3+e[1]/1e6}function Ci(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function wi(e){return Ci(e)||typeof e==`number`||e instanceof Date}function Ti(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=Oi&&(n[1]-=Oi,n[0]+=1),n}var Ei,Di,Oi,ki=n((()=>{gi(),Ei=9,Di=Math.pow(10,6),Oi=Math.pow(10,Ei)})),z,Ai=n((()=>{(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(z||(z={}))})),ji,Mi=n((()=>{M(),P(),ji=class{constructor(e={}){var t;N(this,`_propagators`,void 0),N(this,`_fields`,void 0),this._propagators=(t=e.propagators)==null?[]:t;let n=new Set;for(let e of this._propagators){let t=typeof e.fields==`function`?e.fields():[];for(let e of t)n.add(e)}this._fields=Array.from(n)}inject(e,t,n){for(let r of this._propagators)try{r.inject(e,t,n)}catch(e){k.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){k.warn(`Failed to extract with ${r.constructor.name}. Err: ${e.message}`)}return e},e)}fields(){return this._fields.slice()}}}));function Ni(e){return Ri.test(e)}function Pi(e){return zi.test(e)&&!Bi.test(e)}var Fi,Ii,Li,Ri,zi,Bi,Vi=n((()=>{Fi=`[_0-9a-z-*/]`,Ii=`[a-z]${Fi}{0,255}`,Li=`[a-z0-9]${Fi}{0,240}@[a-z]${Fi}{0,13}`,Ri=RegExp(`^(?:${Ii}|${Li})$`),zi=/^[ -~]{0,255}[!-~]$/,Bi=/,|=/})),Hi,Ui,Wi,Gi,Ki,qi=n((()=>{Vi(),P(),Hi=32,Ui=512,Wi=`,`,Gi=`=`,Ki=class e{constructor(e){N(this,`_length`,void 0),N(this,`_rawTraceState`,void 0),N(this,`_internalState`,void 0),this._rawTraceState=typeof e==`string`?e:``,this._length=this._rawTraceState.length}set(e,t){if(!Ni(e)||!Pi(t))return this;let n=this._getState(),r=n.get(e),i=this._length;if(typeof r==`string`?i+=t.length-r.length:i+=e.length+t.length+(n.size>0?2:1),i>Ui)return this;let a=new Map(n);return a.delete(e),a.set(e,t),this._fromState(a,i)}unset(e){let t=this._getState(),n=t.get(e);if(typeof n!=`string`)return this;let r=this._length-(e.length+n.length+1);t.size>1&&--r;let i=new Map(t);return i.delete(e),this._fromState(i,r)}get(e){return this._getState().get(e)}serialize(){let e=``,t=0;for(let n of this._getState())t>0&&(e=Wi+e),e=`${n[0]}${Gi}${n[1]}`+e,t++;return e}_getState(){if(this._internalState)return this._internalState;let e=this._rawTraceState.split(Wi),t=new Map,n=0;for(let r of e){let e=r.trim(),i=e.indexOf(Gi);if(i===-1)continue;let a=e.slice(0,i),o=e.slice(i+1);if(!Ni(a)||!Pi(o))continue;let s=n+e.length+ +(t.size>0);if(!(s>Ui)&&(t.set(a,o),n=s,t.size>=Hi))break}return this._length=n,this._internalState=new Map(Array.from(t.entries()).reverse()),this._internalState}_fromState(t,n){let r=Object.create(e.prototype);return r._internalState=t,r._length=n,r}}}));function Ji(e){let t=Qi.exec(e);return!t||t[1]===`00`&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var Yi,Xi,Zi,Qi,$i,ea=n((()=>{M(),_r(),qi(),Yi=`traceparent`,Xi=`tracestate`,Zi=`00`,Qi=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`),$i=class{inject(e,t,n){let r=j.getSpanContext(e);if(!r||hr(e)||!lt(r))return;let i=`${Zi}-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||D.NONE).toString(16)}`;n.set(t,Yi,i),r.traceState&&n.set(t,Xi,r.traceState.serialize())}extract(e,t,n){let r=n.get(t,Yi);if(!r)return e;let i=Array.isArray(r)?r[0]:r;if(typeof i!=`string`)return e;let a=Ji(i);if(!a)return e;a.isRemote=!0;let o=n.get(t,Xi);if(o){let e=Array.isArray(o)?o.join(`,`):o;a.traceState=new Ki(typeof e==`string`?e:void 0)}return j.setSpanContext(e,a)}fields(){return[Yi,Xi]}}}));function ta(e){if(!na(e)||ra(e)!==oa)return!1;let t=da(e);if(t===null)return!0;let n=pa.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&la.call(n)===ua}function na(e){return typeof e==`object`&&!!e}function ra(e){return e==null?e===void 0?ca:sa:ma&&ma in Object(e)?ia(e):aa(e)}function ia(e){let t=pa.call(e,ma),n=e[ma],r=!1;try{e[ma]=void 0,r=!0}catch(e){}let i=ha.call(e);return r&&(t?e[ma]=n:delete e[ma]),i}function aa(e){return ha.call(e)}var oa,sa,ca,la,ua,da,fa,pa,ma,ha,ga=n((()=>{oa=`[object Object]`,sa=`[object Null]`,ca=`[object Undefined]`,la=Function.prototype.toString,ua=la.call(Object),da=Object.getPrototypeOf,fa=Object.prototype,pa=fa.hasOwnProperty,ma=Symbol?Symbol.toStringTag:void 0,ha=fa.toString}));function _a(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=ya(t,e.shift(),0,n);return t}function va(e){return xa(e)?e.slice():e}function ya(e,t,n=0,r){let i;if(!(n>Ea)){if(n++,wa(e)||wa(t)||Sa(t))i=va(t);else if(xa(e)){if(i=e.slice(),xa(t))for(let e=0,n=t.length;e<n;e++)i.push(va(t[e]));else if(Ca(t)){let e=Object.keys(t);for(let n=0,r=e.length;n<r;n++){let r=e[n];r===`__proto__`||r===`constructor`||r===`prototype`||(i[r]=va(t[r]))}}}else if(Ca(e))if(Ca(t)){if(!Ta(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];if(s===`__proto__`||s===`constructor`||s===`prototype`)continue;let c=t[s];if(wa(c))c===void 0?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(ba(e,s,r)||ba(t,s,r))delete i[s];else{if(Ca(a)&&Ca(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]=ya(i[s],c,n,r)}}}}else i=t;return i}}function ba(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 xa(e){return Array.isArray(e)}function Sa(e){return typeof e==`function`}function Ca(e){return!wa(e)&&!xa(e)&&!Sa(e)&&typeof e==`object`}function wa(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function Ta(e,t){return!(!ta(e)||!ta(t))}var Ea,Da=n((()=>{ga(),Ea=20}));function Oa(e,t){return typeof t==`string`?e===t:!!e.match(t)}function ka(e,t){if(!t)return!1;for(let n of t)if(Oa(e,n))return!0;return!1}var Aa=n((()=>{})),ja,Ma=n((()=>{P(),ja=class{constructor(){N(this,`_promise`,void 0),N(this,`_resolve`,void 0),N(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)}}})),Na,Pa=n((()=>{Ma(),P(),Na=class{constructor(e,t){N(this,`_isCalled`,!1),N(this,`_deferred`,new ja),N(this,`_callback`,void 0),N(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 Fa(e,t){return new Promise(n=>{O.with(mr(O.active()),()=>{e.export(t,n)})})}var Ia=n((()=>{M(),_r()})),La,B=n((()=>{Dr(),P(),Nr(),Br(),Lr(),ki(),Ai(),Tr(),gi(),Mi(),ea(),M(),_r(),qi(),Da(),Aa(),Pa(),Ia(),La={_export:Fa}}));B(),P();var Ra=class{constructor(e=window.performance){N(this,`_clock`,void 0),N(this,`epochMillisFromOriginOffset`,e=>this._clock.timeOrigin+e),N(this,`getNowHRTime`,()=>_i(this.getNowMillis())),N(this,`getNowMillis`,()=>this.epochMillisFromOriginOffset(this._clock.now())),N(this,`millisSinceHRTime`,e=>this.getNowMillis()-Si(e)),N(this,`millisFromZeroTime`,e=>e),this._clock=e}},V,za=n((()=>{(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`})(V||(V={}))}));function Ba(){return Ha}var Va,Ha,Ua=n((()=>{Va=class{emit(e){}enabled(){return!1}},Ha=new Va}));function Wa(e,t,n){return r=>r===e?t:n}var Ga,Ka,qa=n((()=>{Ga=Symbol.for(`io.opentelemetry.js.api.logs`),Ka=globalThis})),Ja,Ya,Xa=n((()=>{Ua(),Ja=class{getLogger(e,t,n){return new Va}},Ya=new Ja})),Za,Qa=n((()=>{Ua(),Za=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(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}}})),$a,eo=n((()=>{Xa(),Qa(),$a=class{getLogger(e,t,n){var r;return(r=this._getDelegateLogger(e,t,n))==null?new Za(this,e,t,n):r}_getDelegate(){var e;return(e=this._delegate)==null?Ya:e}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){var r;return(r=this._delegate)==null?void 0:r.getLogger(e,t,n)}}})),to,no=n((()=>{qa(),Xa(),eo(),to=class e{constructor(){this._proxyLoggerProvider=new $a}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(e){return Ka[Ga]?this.getLoggerProvider():(Ka[Ga]=Wa(1,e,Ya),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,t;return(t=(e=Ka[Ga])==null?void 0:e.call(Ka,1))==null?this._proxyLoggerProvider:t}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){delete Ka[Ga],this._proxyLoggerProvider=new $a}}})),ro,H=n((()=>{za(),Ua(),no(),ro=to.getInstance()}));function io(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 U(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?io(Object(n),!0).forEach(function(t){N(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):io(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var W=n((()=>{P()}));M(),H(),P(),W();var ao=class{constructor(e,t,n){this.instrumentationName=e,this.instrumentationVersion=t,N(this,`_config`,{}),N(this,`_diag`,void 0),N(this,`_tracer`,void 0),N(this,`_meter`,void 0),N(this,`_logger`,void 0),this.setConfig(n),this._diag=k.createComponentLogger({namespace:e}),this._tracer=j.getTracer(e,t),this._meter=zt.getMeter(e,t),this._logger=ro.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=U({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)}}};P();var G=class extends ao{constructor({instrumentationName:e,instrumentationVersion:t,config:n,diag:r,perf:i,limitManager:a}){super(e,t,n),N(this,`_userSessionManager`,void 0),N(this,`_logManager`,void 0),N(this,`_limitManager`,void 0),N(this,`_perf`,void 0),r&&(this._diag=r),this._perf=i==null?new Ra:i,this._userSessionManager=zn.getUserSessionManager(),this._logManager=vn.getLogManager(),this._limitManager=a}get limitManager(){return this._limitManager}get userSessionManager(){return this._userSessionManager}get logManager(){return this._logManager}get perf(){return this._perf}init(){}setLimitManager(e){this._limitManager=e}setLogManager(e){this._logManager=e}setUserSessionManager(e){this._userSessionManager=e}};P();let oo=/\([^()]+\)/g;var so=class extends G{constructor({diag:e,shouldCleanupPathOptionsFromRouteName:t=!0}){super({config:{},diag:e,instrumentationName:`NavigationInstrumentation`,instrumentationVersion:`1.0.0`}),N(this,`_shouldCleanupPathOptionsFromRouteName`,!0),N(this,`_currentRouteSpan`,null),N(this,`_instrumentationType`,`manual`),N(this,`_removeSessionStartedFn`,null),N(this,`_removeSessionEndedFn`,null),N(this,`setInstrumentationType`,e=>{this._instrumentationType=e}),N(this,`setCurrentRoute`,e=>{if(!this._config.enabled)return;let t=Mn.getCurrentRoute();e.url!==(t==null?void 0:t.url)&&(Mn.setCurrentRoute(e),this._endRouteSpan(t),this._startRouteSpan(e),Tn.screenView())}),N(this,`_setupSessionListeners`,()=>{this._removeSessionStartedFn||(this._removeSessionStartedFn=this.userSessionManager.addSessionPartStartedListener(()=>{let e=Mn.getCurrentRoute();e&&!this._currentRouteSpan&&(this._diag.debug(`Session started, starting route span.`),this._startRouteSpan(e))})),this._removeSessionEndedFn||(this._removeSessionEndedFn=this.userSessionManager.addSessionPartEndedListener(()=>{this._currentRouteSpan&&(this._diag.debug(`Session ended, ending route span.`),this._endRouteSpan(Mn.getCurrentRoute()))}))}),N(this,`_cleanUpSessionListeners`,()=>{this._removeSessionStartedFn&&(this._removeSessionStartedFn(),this._removeSessionStartedFn=null),this._removeSessionEndedFn&&(this._removeSessionEndedFn(),this._removeSessionEndedFn=null)}),N(this,`_startRouteSpan`,e=>{this._diag.debug(`Starting route span for url: ${e.url}`),this._setupSessionListeners();let t=this._shouldCleanupPathOptionsFromRouteName?e.path.replace(oo,``):e.path;return this._currentRouteSpan=this.tracer.startSpan(t,{attributes:{[F]:`ux.surface`,[or]:t,[sr]:Mn.getCurrentPageId()||void 0}}),this._currentRouteSpan.setAttribute(rr,this._instrumentationType),this._currentRouteSpan}),N(this,`_endRouteSpan`,e=>{this._currentRouteSpan&&(e&&this._diag.debug(`Ending route span for url: ${e.url}`),this._currentRouteSpan.end(),this._currentRouteSpan=null)}),N(this,`enable`,()=>{this.setConfig({enabled:!0}),this._diag.debug(`NavigationInstrumentation enabled, listening for navigation events.`)}),N(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 co,lo=(e={})=>(co||(co=new so(e)),co);function uo(e){let t=(e,t=2)=>String(e).padStart(t,`0`);return`${e.getUTCFullYear()}-${t(e.getUTCMonth()+1)}-${t(e.getUTCDate())} ${t(e.getUTCHours())}:${t(e.getUTCMinutes())}:${t(e.getUTCSeconds())}.${t(e.getUTCMilliseconds(),3)}`}function fo(e){let t=/edg/i.test(e)?`Edge`:/opr|opera/i.test(e)?`Opera`:/chrome|crios/i.test(e)?`Chrome`:/firefox|fxios/i.test(e)?`Firefox`:/safari/i.test(e)?`Safari`:`Unknown`,n=/windows/i.test(e)?`Windows`:/mac os|macintosh/i.test(e)?`macOS`:/android/i.test(e)?`Android`:/iphone|ipad|ios/i.test(e)?`iOS`:/linux/i.test(e)?`Linux`:`Unknown`;return{browserName:t,deviceType:/mobile|iphone|android.*mobile/i.test(e)?`mobile`:/ipad|tablet/i.test(e)?`tablet`:`desktop`,osName:n}}function po(e){try{return JSON.stringify(e).length}catch(e){return 64}}function mo(e,t){try{e(t)}catch(e){}}let ho=[`log`,`info`,`warn`,`error`,`debug`],go=2e3;function _o(e){let t={};for(let n of ho){let r=console[n];t[n]=r,console[n]=(...t)=>{mo(e,{level:n,message:vo(t),type:`console`}),r.apply(console,t)}}return()=>{for(let e of ho){let n=t[e];n&&(console[e]=n)}}}function vo(e){let t=e.map(e=>{if(typeof e==`string`)return e;if(e instanceof Error)return`${e.name}: ${e.message}`;try{return JSON.stringify(e)}catch(t){return String(e)}}).join(` `);return t.length>go?`${t.slice(0,go)}…`:t}M();function yo(){var e;let t=(e=j.getActiveSpan())==null?void 0:e.spanContext().traceId;return t&&t!==`00000000000000000000000000000000`?t:void 0}let bo=4e3;function xo(e){let t=t=>{var n,r;mo(e,{errorStack:So((n=t.error)==null?void 0:n.stack),level:`error`,message:t.message||String((r=t.error)==null?`Error`:r),traceId:yo(),type:`error`})},n=t=>{var n;let r=t.reason,i=typeof r==`string`?r:(n=r==null?void 0:r.message)==null?`Unhandled promise rejection`:n;mo(e,{errorStack:So(typeof r==`object`?r==null?void 0:r.stack:void 0),level:`error`,message:i,traceId:yo(),type:`error`})};return window.addEventListener(`error`,t),window.addEventListener(`unhandledrejection`,n),()=>{window.removeEventListener(`error`,t),window.removeEventListener(`unhandledrejection`,n)}}function So(e){if(e)return e.length>bo?`${e.slice(0,bo)}…`:e}function Co(e,t){let n=n=>{let r=n.target;r instanceof Element&&mo(e,{targetSelector:wo(r),targetText:t?void 0:To(r),type:`click`})},r=t=>{let n=t.target;n instanceof Element&&mo(e,{targetSelector:wo(n),type:`input`})};return document.addEventListener(`click`,n,!0),document.addEventListener(`input`,r,!0),()=>{document.removeEventListener(`click`,n,!0),document.removeEventListener(`input`,r,!0)}}function wo(e){return`${e.tagName.toLowerCase()}${e.id?`#${e.id}`:``}${typeof e.className==`string`&&e.className.trim()?`.${e.className.trim().split(/\s+/)[0]}`:``}`}function To(e){var t;let n=((t=e.textContent)==null?``:t).trim().replace(/\s+/g,` `);if(n)return n.length>120?`${n.slice(0,120)}…`:n}function Eo(e){let t=``,n=()=>{let n=location.href;n!==t&&(t=n,mo(e,{type:`navigation`,url:n}))};n();let r=history.pushState,i=history.replaceState;return history.pushState=function(...e){let t=r.apply(this,e);return n(),t},history.replaceState=function(...e){let t=i.apply(this,e);return n(),t},window.addEventListener(`popstate`,n),window.addEventListener(`hashchange`,n),()=>{history.pushState=r,history.replaceState=i,window.removeEventListener(`popstate`,n),window.removeEventListener(`hashchange`,n)}}function Do(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 K(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){Do(a,r,i,o,s,`next`,e)}function s(e){Do(a,r,i,o,s,`throw`,e)}o(void 0)})}}var q=n((()=>{}));q(),W();function Oo(e,t){let n=typeof window<`u`?window.fetch.bind(window):void 0;n&&(window.fetch=function(){var e=K(function*(e,t){let i=ko(e),a=Ao(e,t),o=yo(),s=performance.now();try{let c=yield n(e,t);return r(i,a,c.status,s,o),c}catch(e){throw r(i,a,0,s,o,String(e)),e}});return function(t,n){return e.apply(this,arguments)}}());let r=(n,r,i,a,o,s)=>{t(n)||mo(e,U({net:{durationMs:Math.round(performance.now()-a),method:r,status:i,url:n},traceId:o,type:`network`},s?{attrs:{error:s}}:{}))},i=typeof window<`u`?window.XMLHttpRequest:void 0,a=i==null?void 0:i.prototype.open,o=i==null?void 0:i.prototype.send;return i&&a&&o&&(i.prototype.open=function(e,t,...n){return this.__mxlMethod=String(e).toUpperCase(),this.__mxlUrl=typeof t==`string`?t:t.href,a.apply(this,[e,t,...n])},i.prototype.send=function(...e){let t=this,n=performance.now(),i=yo();return this.addEventListener(`loadend`,()=>{var e,a;r((e=t.__mxlUrl)==null?``:e,(a=t.__mxlMethod)==null?`GET`:a,this.status,n,i)}),o.apply(this,e)}),()=>{n&&(window.fetch=n),i&&a&&(i.prototype.open=a),i&&o&&(i.prototype.send=o)}}function ko(e){return typeof e==`string`?e:e instanceof URL?e.href:e.url}function Ao(e,t){var n;let r=(n=t==null?void 0:t.method)==null?typeof e==`object`&&`method`in e?e.method:void 0:n;return(r==null?`GET`:r).toUpperCase()}q();function jo({config:e,sessionId:t,transport:n,onActivity:r,flushIntervalMs:i=5e3,flushBytes:a=65536}){let o=[],s=0,c=0,l=!1,u=e=>{l||(o.push({ev:e,seq:c++}),s+=po(e),s>=a&&d())},d=function(){var e=K(function*(e=!1){if(o.length===0||l)return;r==null||r();let i=o;o=[],s=0;let a=i.map(({ev:e,seq:n})=>Mo(t,e,n));yield n.postSessionEvents(a,e)});return function(){return e.apply(this,arguments)}}(),f=[Eo(u),Co(u,e.maskAllText),_o(u),Oo(u,e=>n.shouldIgnoreUrl(e)),xo(u)],p=i>0?setInterval(()=>{d()},i):void 0;return{flush:d,pause:()=>{l=!0},resume:()=>{l=!1},stop:()=>{p&&clearInterval(p);for(let e of f)e()}}}function Mo(e,t,n){var r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b;return{attributes:(r=t.attrs)==null?{}:r,error_stack:(i=t.errorStack)==null?``:i,level:(a=t.level)==null?``:a,message:(o=t.message)==null?``:o,net_duration_ms:(s=(c=t.net)==null?void 0:c.durationMs)==null?0:s,net_method:(l=(u=t.net)==null?void 0:u.method)==null?``:l,net_status:(d=(f=t.net)==null?void 0:f.status)==null?0:d,net_url:(p=(m=t.net)==null?void 0:m.url)==null?``:p,seq:n,session_id:e,target_selector:(h=t.targetSelector)==null?``:h,target_text:(g=t.targetText)==null?``:g,timestamp:uo(new Date((_=t.timestamp)==null?Date.now():_)),trace_id:(v=(y=t.traceId)==null?yo():y)==null?``:v,type:t.type,url:(b=t.url)==null?typeof location<`u`?location.href:``:b}}q();let No=`https://unpkg.com/rrweb@2.0.0-alpha.20/dist/rrweb.umd.cjs`,Po,Fo,Io=No;function Lo(e){Io=e,Po=void 0}function Ro(e){return new Promise((t,n)=>{let r=document.createElement(`script`);r.src=e,r.async=!0,r.onload=()=>t(),r.onerror=n,document.head.appendChild(r)})}function zo(){return Bo.apply(this,arguments)}function Bo(){return Bo=K(function*(){if(typeof window>`u`)throw Error(`no browser`);if(window.rrweb)return window.rrweb;if(yield Ro(Io),!window.rrweb)throw Error(`no rrweb`);return window.rrweb}),Bo.apply(this,arguments)}function Vo(){return Fo?Fo():(Po===void 0&&(Po=zo()),Po)}function Ho(){Po=void 0,Fo=void 0,Io=No}function Uo(e){Fo=e,Po=void 0}q();function Wo(e){return Go.apply(this,arguments)}function Go(){return Go=K(function*(e){let t=new Blob([e]).stream().pipeThrough(new CompressionStream(`gzip`)),n=yield new Response(t).arrayBuffer();return new Uint8Array(n)}),Go.apply(this,arguments)}q(),W();function Ko({config:e,sessionId:t,transport:n,chunkSeqStore:r,rrwebModule:i,onActivity:a,flushIntervalMs:o=5e3,flushBytes:s=102400}){let c=[],l=0,u=!1,d=0,f=!1,p=function(){var e=K(function*(e=!1){if(c.length===0)return;a==null||a();let i=c,o=u,s=r.nextChunkSeq(t),d=i[0].timestamp,f=i[i.length-1].timestamp;c=[],l=0,u=!1;let p=yield Wo(new TextEncoder().encode(JSON.stringify(i)));yield n.postSessionBlob({chunkSeq:s,durationMs:Math.max(0,f-d),eventCount:i.length,isCheckpoint:o,sessionId:t},p,e)});return function(){return e.apply(this,arguments)}}(),{record:m}=i,h=m(U(U({checkoutEveryNms:3e4,emit:(e,t)=>{var n;if(f)return;let r=e;(t===!0||r.type===2)&&(u=!0),r.type===3&&((n=r.data)==null?void 0:n.source)===2&&r.data.type===2&&d++,c.push(r),l+=po(r),l>=s&&p()},maskAllInputs:e.maskAllInputs},e.maskAllText?{maskTextSelector:`*`}:{}),e.rrwebOptions)),g=o>0?setInterval(()=>{p()},o):void 0;return{flush:p,getClickCount:()=>d,pause:()=>{f=!0},resume:()=>{f=!1},stop:()=>{g&&clearInterval(g),h==null||h()}}}let qo=new Set;function Jo(e){!e||e===`00000000000000000000000000000000`||qo.add(e)}function Yo(){return Array.from(qo)}function Xo(){qo.clear()}let Zo=`__MXL_REPLAY_SESSION__`;function Qo(e){globalThis[Zo]={recordTraceId:Jo,sessionId:e}}function $o(){delete globalThis[Zo]}function es(e){let t=e=>`replay.chunkSeq.${e}`;return{nextChunkSeq(n){let r=e.getItem(t(n)),i=r===null?0:Number.parseInt(r,10),a=Number.isFinite(i)?i:0;return e.setItem(t(n),String(a+1)),a}}}function ts(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 ns(e,t){if(e==null)return{};var n,r,i=ts(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 rs=[`debug`,`enabled`,`sampleRate`,`maskAllInputs`,`maskAllText`,`flushIntervalMs`,`omitRedundantInstrumentations`];function is(e,t,n=!0){let r=t==null?{}:t,{debug:i=!1,enabled:a,sampleRate:o,maskAllInputs:s=!0,maskAllText:c=!0,flushIntervalMs:l=5e3,omitRedundantInstrumentations:u}=r,d=ns(r,rs);return{appID:e.appID,appVersion:e.appVersion,debug:i,environment:void 0,flushIntervalMs:l,maskAllInputs:s,maskAllText:c,replayEnabled:a==null?n:a,replaySampleRate:o==null?1:o,rrwebOptions:d,serviceName:e.serviceName,userID:e.userID}}W();function as(e){let t=!1,n=()=>{var n;t||(t=!0,e.recorder.flush(!0),e.events.flush(!0),e.transport.postSessionMeta(os(e.config,e.sessionId,e.startedAt,2,`ended`,e.recorder.getClickCount()),!0),e.recorder.stop(),e.events.stop(),Xo(),(n=e.onFinalize)==null||n.call(e))},r=()=>{document.visibilityState===`hidden`&&n()};return document.addEventListener(`visibilitychange`,r),window.addEventListener(`pagehide`,n),()=>{document.removeEventListener(`visibilitychange`,r),window.removeEventListener(`pagehide`,n)}}function os(e,t,n,r,i,a){var o;let s=fo(navigator.userAgent),c=new Date,l={browser_name:s.browserName,device_type:s.deviceType,os_name:s.osName,resource_attributes:U(U({},e.environment?{"deployment.environment":e.environment,"deployment.environment.name":e.environment}:{}),e.appVersion?{"deployment.commit_sha":e.appVersion}:{}),service_name:(o=e.serviceName)==null?``:o,session_id:t,start_time:uo(n),status:i,url_initial:window.location.href,user_agent:navigator.userAgent,user_id:cs(),version:r};return i===`ended`&&(l.click_count=a==null?0:a,l.duration_ms=Math.max(0,c.getTime()-n.getTime()),l.end_time=uo(c),l.trace_ids=Yo()),l}function ss(e){let t=e.getUserSessionStartTime();return new Date(t==null?Date.now():t)}function cs(){var e;return(e=er.getUserId())==null?``:e}P(),q();var ls=class{constructor({context:e,userSessionManager:t,sessionStorage:n,rrwebOptions:r,recordUserSessions:i=!0,diag:a}){N(this,`_context`,void 0),N(this,`_userSessionManager`,void 0),N(this,`_chunkSeqStore`,void 0),N(this,`_config`,void 0),N(this,`_diag`,void 0),N(this,`_recordUserSessions`,void 0),N(this,`_active`,void 0),N(this,`_paused`,!1),N(this,`_enableRequested`,!1),N(this,`_startInProgress`,!1),N(this,`_stopInProgress`,!1),N(this,`_removeSessionStartedListener`,void 0),this._context=e,this._userSessionManager=t,this._chunkSeqStore=es(n),this._recordUserSessions=i,this._config=is(e,r,i),this._diag=a==null?{debug:()=>void 0,error:()=>void 0,info:()=>void 0,verbose:()=>void 0,warn:()=>void 0}:a}isRecording(){return!!this._active&&!this._paused}enable(e){if(!this._recordUserSessions&&!(e!=null&&e.force)){this._diag.debug(`recordUserSessions disabled, waiting for manual enable`);return}this._enableRequested=!0,this._paused=!1,this._tryStart()}pause(){this._active&&(this._enableRequested=!1,this._paused=!0,this._active.recorder.pause(),this._active.events.pause())}resume(){if(!this._active){this.enable();return}let e=this._paused;this._enableRequested=!0,this._paused=!1,this._active.recorder.resume(),this._active.events.resume(),e&&this._active.rrwebModule.record.takeFullSnapshot()}stop(){var e=this;return K(function*(){var t;if(e._enableRequested=!1,e._paused=!1,(t=e._removeSessionStartedListener)==null||t.call(e),e._removeSessionStartedListener=void 0,!e._active){$o(),Xo();return}if(e._stopInProgress)return;e._stopInProgress=!0;let n=e._active;e._active=void 0;try{var r;(r=n.removeSessionEndListener)==null||r.call(n),n.removeLifecycle(),yield n.recorder.flush(!0),yield n.events.flush(!0),n.recorder.stop(),n.events.stop()}finally{$o(),Xo(),e._stopInProgress=!1}})()}_tryStart(){var e=this;return K(function*(){if(!e._enableRequested||e._active||e._startInProgress||e._stopInProgress)return;if(typeof window>`u`){e._diag.warn(`session replay cannot run in non-browser environments`);return}let t=e._userSessionManager.getUserSessionId();if(t===null){e._removeSessionStartedListener||(e._removeSessionStartedListener=e._userSessionManager.addSessionPartStartedListener(()=>{var t;(t=e._removeSessionStartedListener)==null||t.call(e),e._removeSessionStartedListener=void 0,e._tryStart()}));return}if(e._config.replayEnabled){if(Math.random()>=e._config.replaySampleRate){e._diag.debug(`session replay skipped by sample rate`);return}e._startInProgress=!0;try{let n=yield Vo();if(!e._enableRequested||e._active)return;Qo(t),Xo();let r=ss(e._userSessionManager),i=()=>{},a=Ko({chunkSeqStore:e._chunkSeqStore,config:e._config,flushIntervalMs:e._config.flushIntervalMs,onActivity:i,rrwebModule:n,sessionId:t,transport:e._context.transport}),o=jo({config:e._config,flushIntervalMs:e._config.flushIntervalMs,onActivity:i,sessionId:t,transport:e._context.transport});e._context.transport.postReplay(),e._context.transport.postSessionMeta(os(e._config,t,r,1,`active`,null)),e._active={events:o,recorder:a,removeLifecycle:globalThis.__MXL_TEST_SKIP_REPLAY_LIFECYCLE__===!0?()=>void 0:as({config:e._config,events:o,onFinalize:()=>{e._active=void 0,$o(),Xo()},recorder:a,sessionId:t,startedAt:r,transport:e._context.transport}),removeSessionEndListener:e._userSessionManager.addSessionPartEndedListener(()=>{a.flush(!0),o.flush(!0)}),rrwebModule:n},e._diag.debug(`session recording started`)}catch(t){e._diag.error(`failed to start session recording`,t)}finally{e._startInProgress=!1}}})()}};P(),q();var us=class extends G{constructor(e={}){super({config:{},diag:e.diag,instrumentationName:`ReplayInstrumentation`,instrumentationVersion:`2.0.0`,perf:e.perf}),N(this,`_args`,void 0),N(this,`_sessionRecording`,void 0),N(this,`_wasPaused`,!1),N(this,`_stopPromise`,void 0),this._args=e,(!e.replayContext||!e.sessionStorage)&&this._diag.warn(`replayContext and sessionStorage are required for session recording`),this._config.enabled||this._diag.debug(`disabled, not starting`)}setUserSessionManager(e){super.setUserSessionManager(e),this._ensureSessionRecording(),this._config.enabled&&this._args.recordUserSessions!==!1&&this._args.replayContext&&this._args.sessionStorage&&this.enable()}_ensureSessionRecording(){if(this._sessionRecording)return this._sessionRecording;let{replayContext:e,sessionStorage:t,recordUserSessions:n,rrwebOptions:r}=this._args;if(!(!e||!t))return this._sessionRecording=new ls({context:e,diag:this._diag,recordUserSessions:n,rrwebOptions:r,sessionStorage:t,userSessionManager:this.userSessionManager}),this._sessionRecording}isRecording(){var e,t;return(e=(t=this._sessionRecording)==null?void 0:t.isRecording())==null?!1:e}enable(e){this._wasPaused=!1,this._enableWhenReady(e)}pause(){var e;this._wasPaused=!0,(e=this._sessionRecording)==null||e.pause()}resume(){if(this._wasPaused){this._resumeWhenReady();return}this._enableWhenReady({force:!0})}_enableWhenReady(e){var t=this;return K(function*(){var n;yield t._stopPromise,(n=t._ensureSessionRecording())==null||n.enable(e)})()}_resumeWhenReady(){var e=this;return K(function*(){var t;yield e._stopPromise,(t=e._sessionRecording)==null||t.resume(),e._wasPaused=!1})()}disable(){let e=this._sessionRecording;e&&(this._stopPromise=e.stop().finally(()=>{this._sessionRecording===e&&(this._sessionRecording=void 0),this._stopPromise=void 0}))}waitForDisable(){var e=this;return K(function*(){yield e._stopPromise})()}};function ds(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 fs(e){e.forEach(e=>e.disable())}var ps=n((()=>{}));function ms(e){var t,n;let r=e.tracerProvider||j.getTracerProvider(),i=e.meterProvider||zt.getMeterProvider(),a=e.loggerProvider||ro.getLoggerProvider(),o=(t=(n=e.instrumentations)==null?void 0:n.flat())==null?[]:t;return ds(o,r,i,a),()=>{fs(o)}}var hs=n((()=>{M(),H(),ps()}));function gs(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})}function _s(e){e&&e.logger&&(typeof e.logger==`function`?J=e.logger:J(`new logger isn't a function, not replacing`))}var J,vs,ys,bs,xs,Ss=n((()=>{J=console.error.bind(console),vs=(e,t,n)=>{if(!e||!e[t]){J(`no original function `+String(t)+` to wrap`);return}if(!n){J(`no wrapper function`),J(Error().stack);return}let r=e[t];if(typeof r!=`function`||typeof n!=`function`){J(`original object and wrapper must be functions`);return}let i=n(r,t);return gs(i,`__original`,r),gs(i,`__unwrap`,()=>{e[t]===i&&gs(e,t,r)}),gs(i,`__wrapped`,!0),gs(e,t,i),i},ys=(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{J(`must provide one or more modules to patch`),J(Error().stack);return}if(!(t&&Array.isArray(t))){J(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{vs(e,t,n)})})},bs=(e,t)=>{if(!e||!e[t]){J(`no function to unwrap.`),J(Error().stack);return}let n=e[t];if(!n.__unwrap)J(`no original to unwrap to -- has `+String(t)+` already been unwrapped?`);else{n.__unwrap();return}},xs=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{J(`must provide one or more modules to patch`),J(Error().stack);return}if(!(t&&Array.isArray(t))){J(`must provide one or more functions to unwrap on modules`);return}e.forEach(e=>{t.forEach(t=>{bs(e,t)})})},_s.wrap=vs,_s.massWrap=ys,_s.unwrap=bs,_s.massUnwrap=xs})),Cs,ws=n((()=>{M(),H(),Ss(),P(),W(),Cs=class{constructor(e,t,n){N(this,`_config`,{}),N(this,`_tracer`,void 0),N(this,`_meter`,void 0),N(this,`_logger`,void 0),N(this,`_diag`,void 0),N(this,`instrumentationName`,void 0),N(this,`instrumentationVersion`,void 0),N(this,`_wrap`,vs),N(this,`_unwrap`,bs),N(this,`_massWrap`,ys),N(this,`_massUnwrap`,xs),this.instrumentationName=e,this.instrumentationVersion=t,this.setConfig(n),this._diag=k.createComponentLogger({namespace:e}),this._tracer=j.getTracer(e,t),this._meter=zt.getMeter(e,t),this._logger=ro.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=U({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)}}}})),Ts,Es=n((()=>{ws(),Ts=class extends Cs{constructor(e,t,n){super(e,t,n),this._config.enabled&&this.enable()}}})),Ds=n((()=>{Es(),M()}));function Os(e,t,n){let r,i;try{i=e()}catch(e){r=e}finally{if(t(r,i),r&&!n)throw r;return i}}var ks=n((()=>{})),As=n((()=>{hs(),Ds(),P(),ks()}));function js(){if(Ms===void 0)try{let e=globalThis.process.argv0;Ms=e?`unknown_service:${e}`:`unknown_service`}catch(e){Ms=`unknown_service`}return Ms}var Ms,Ns=n((()=>{})),Ps,Fs=n((()=>{Ps=e=>typeof e==`object`&&!!e&&typeof e.then==`function`}));function Is(e,t){return Hs.FromAttributeList(Object.entries(e),t)}function Ls(){return Is({})}function Rs(){return Is({[ri]:js(),[ii]:mi[ii],[oi]:mi[oi],[si]:mi[si]})}function zs(e){return e.map(([e,t])=>Ps(t)?[e,t.catch(t=>{k.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function Bs(e){if(typeof e==`string`||e===void 0)return e;k.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function Vs(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;k.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}var Hs,Us=n((()=>{M(),B(),L(),Ns(),Fs(),P(),q(),Hs=class e{static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=zs(t),r._asyncAttributesPending=t.filter(([e,t])=>Ps(t)).length>0,r}constructor(e,t){var n;N(this,`_rawAttributes`,void 0),N(this,`_asyncAttributesPending`,!1),N(this,`_schemaUrl`,void 0),N(this,`_memoizedAttributes`,void 0);let r=(n=e.attributes)==null?{}:n;this._rawAttributes=Object.entries(r).map(([e,t])=>(Ps(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=zs(this._rawAttributes),this._schemaUrl=Bs(t==null?void 0:t.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}waitForAsyncAttributes(){var e=this;return K(function*(){if(e.asyncAttributesPending){for(let t=0;t<e._rawAttributes.length;t++){let[n,r]=e._rawAttributes[t];e._rawAttributes[t]=[n,Ps(r)?yield r:r]}e._asyncAttributesPending=!1}})()}get attributes(){if(this.asyncAttributesPending&&k.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(Ps(n)){k.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=Vs(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}}})),Ws=n((()=>{M(),Us(),L(),B(),P(),Ns()}));M();let Gs=fe(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function Ks(e){return e.setValue(Gs,!0)}M();function qs(){return e=>{k.error(Js(e))}}function Js(e){return typeof e==`string`?e:JSON.stringify(Ys(e))}function Ys(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 Xs=qs();function Zs(e){try{Xs(e)}catch(e){}}L();let Qs={[oi]:`opentelemetry`,"process.runtime.name":`browser`,[ii]:ai,[si]:`2.9.0`},$s=performance,ec=Math.pow(10,6),tc=Math.pow(10,9);function nc(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*ec)]}function rc(e){return sc(nc($s.timeOrigin),nc(typeof e==`number`?e:$s.now()))}function ic(e){if(oc(e))return e;if(typeof e==`number`)return e<$s.timeOrigin/2?rc(e):nc(e);if(e instanceof Date)return nc(e.getTime());throw TypeError(`Invalid input type`)}function ac(e){return e[0]*tc+e[1]}function oc(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function sc(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=tc&&(n[1]-=tc,n[0]+=1),n}var cc;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(cc||(cc={}));var lc=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function uc(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new lc(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}P();var dc=class{constructor(){N(this,`_promise`,void 0),N(this,`_resolve`,void 0),N(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)}};P();var fc=class{constructor(e,t){N(this,`_isCalled`,!1),N(this,`_deferred`,new dc),N(this,`_callback`,void 0),N(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 pc;function mc(){if(pc===void 0)try{let e=globalThis.process.argv0;pc=e?`unknown_service:${e}`:`unknown_service`}catch(e){pc=`unknown_service`}return pc}let hc=e=>typeof e==`object`&&!!e&&typeof e.then==`function`;M(),L(),P(),q();var gc=class e{static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=yc(t),r._asyncAttributesPending=t.filter(([e,t])=>hc(t)).length>0,r}constructor(e,t){var n;N(this,`_rawAttributes`,void 0),N(this,`_asyncAttributesPending`,!1),N(this,`_schemaUrl`,void 0),N(this,`_memoizedAttributes`,void 0);let r=(n=e.attributes)==null?{}:n;this._rawAttributes=Object.entries(r).map(([e,t])=>(hc(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=yc(this._rawAttributes),this._schemaUrl=bc(t==null?void 0:t.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}waitForAsyncAttributes(){var e=this;return K(function*(){if(e.asyncAttributesPending){for(let t=0;t<e._rawAttributes.length;t++){let[n,r]=e._rawAttributes[t];e._rawAttributes[t]=[n,hc(r)?yield r:r]}e._asyncAttributesPending=!1}})()}get attributes(){if(this.asyncAttributesPending&&k.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(hc(n)){k.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=xc(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function _c(e,t){return gc.FromAttributeList(Object.entries(e),t)}function vc(){return _c({[ri]:mc(),[ii]:Qs[ii],[oi]:Qs[oi],[si]:Qs[si]})}function yc(e){return e.map(([e,t])=>hc(t)?[e,t.catch(t=>{k.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function bc(e){if(typeof e==`string`||e===void 0)return e;k.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function xc(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;k.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}M();function Sc(e){return Cc(e,new WeakSet)}function Cc(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)){for(let n of e)if(!Cc(n,t))return!1;return!0}let n=e;if(n.constructor!==Object&&n.constructor!==void 0)return!1;for(let e in n)if(Object.prototype.hasOwnProperty.call(n,e)&&!Cc(n[e],t))return!1;return!0}return!1}var Y;(function(e){e[e.DROP_INVALID=0]=`DROP_INVALID`,e[e.DROP_LIMIT_REACHED=1]=`DROP_LIMIT_REACHED`,e[e.ADD_NEW=2]=`ADD_NEW`,e[e.ADD_OVERWRITE_EXISTING=3]=`ADD_OVERWRITE_EXISTING`})(Y||(Y={}));function wc(e,t,n,r,i){if(r.length===0)return k.warn(`Invalid attribute key: ${r}`),Y.DROP_INVALID;if(!Sc(i))return k.warn(`Invalid attribute value set for key: ${r}`),Y.DROP_INVALID;let a=!Object.prototype.hasOwnProperty.call(e,r);return a&&n>=t.attributeCountLimit?Y.DROP_LIMIT_REACHED:(e[r]=Tc(i,t.attributeValueLengthLimit),a?Y.ADD_NEW:Y.ADD_OVERWRITE_EXISTING)}function Tc(e,t){if(t<=0)return k.warn(`Attribute value limit must be positive, got ${t}`),e;if(e==null)return e;if(typeof e==`string`)return e.length<=t?e:e.substring(0,t);if(e instanceof Uint8Array)return e;if(Array.isArray(e))return e.map(e=>Tc(e,t));if(typeof e==`object`){let n={};for(let[r,i]of Object.entries(e))n[r]=Tc(i,t);return n}return e}function Ec(e,t){if(t==null)return{};let n={},r=0,i=0;for(let[a,o]of Object.entries(t)){let t=wc(n,e,r,a,o);t===Y.ADD_NEW?r+=1:(t===Y.DROP_INVALID||t===Y.DROP_LIMIT_REACHED)&&(i+=1)}return{attributes:r>0?n:void 0,droppedAttributesCount:i}}M(),L(),P();var Dc=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._droppedAttributesCount}constructor(e,t,n){N(this,`hrTime`,void 0),N(this,`hrTimeObserved`,void 0),N(this,`spanContext`,void 0),N(this,`resource`,void 0),N(this,`instrumentationScope`,void 0),N(this,`attributes`,{}),N(this,`_severityText`,void 0),N(this,`_severityNumber`,void 0),N(this,`_body`,void 0),N(this,`_eventName`,void 0),N(this,`_attributesCount`,0),N(this,`_droppedAttributesCount`,0),N(this,`_isReadonly`,!1),N(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=ic(r==null?f:r),this.hrTimeObserved=ic(i==null?f:i),d){let e=j.getSpanContext(d);e&<(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){if(this._isLogRecordReadonly())return this;let n=wc(this.attributes,this._logRecordLimits,this._attributesCount,e,t);return n===Y.DROP_LIMIT_REACHED?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&k.warn(`Dropping extra attributes.`)):n===Y.ADD_NEW&&this._attributesCount++,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}_setException(e){let t=!1;if(typeof e==`string`||typeof e==`number`)Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(Yr,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(Zr,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(Zr,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(Yr,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,`exception.stacktrace`)||this.setAttribute(Xr,n.stack),t=!0)}t||k.warn(`Failed to record an exception ${e}`)}_isLogRecordReadonly(){return this._isReadonly&&k.warn(`Can not execute the operation on emitted log record`),this._isReadonly}};H(),M(),P(),W();var Oc=class{constructor(e,t){N(this,`_instrumentationScope`,void 0),N(this,`_sharedState`,void 0),N(this,`_loggerConfig`,void 0),this._instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this._instrumentationScope)}emit(e){let t=e.context||O.active();if(!this.enabled(e))return;let n=new Dc(this._sharedState,this._instrumentationScope,U({context:t},e));this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(n,t),n._makeReadonly()}enabled(e){if(this._sharedState.hasShutdown)return!1;let t=this._loggerConfig;if(t.disabled)return!1;let n=e==null?void 0:e.severityNumber;if(typeof n==`number`&&n!==V.UNSPECIFIED&&n<t.minimumSeverity)return!1;let r=(e==null?void 0:e.context)||O.active();if(t.traceBased){let e=j.getSpanContext(r);if(e&<(e)&&(e.traceFlags&D.SAMPLED)!==D.SAMPLED)return!1}let i={context:r,instrumentationScope:this._instrumentationScope,severityNumber:e==null?void 0:e.severityNumber,eventName:e==null?void 0:e.eventName};for(let e of this._sharedState.processors)if(!e.enabled||e.enabled(i))return!0;return!1}},kc=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}};P(),q();var Ac=class{constructor(e,t){N(this,`processors`,void 0),N(this,`forceFlushTimeoutMillis`,void 0),this.processors=e,this.forceFlushTimeoutMillis=t}forceFlush(){var e=this;return K(function*(){let t=e.forceFlushTimeoutMillis;yield Promise.all(e.processors.map(e=>uc(e.forceFlush(),t)))})()}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}shutdown(){var e=this;return K(function*(){yield Promise.all(e.processors.map(e=>e.shutdown()))})()}enabled(e){for(let t of this.processors)if(!t.enabled||t.enabled(e))return!0;return!1}};function jc(e){if(e===void 0)return[`u`,null];if(e===null)return[`n`,null];let t=typeof e;return t===`string`?[`s`,e]:t===`boolean`?[`b`,e]:t===`number`?Number.isNaN(e)?[`nan`,null]:e===1/0?[`inf`,null]:e===-1/0?[`-inf`,null]:Object.is(e,-0)?[`n0`,null]:[`d`,e]:e instanceof Uint8Array?[`bytes`,Array.from(e)]:Array.isArray(e)?[`arr`,e.map(jc)]:[`map`,Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>[e,jc(t)])]}function Mc(e){var t;return JSON.stringify([e.name,e.version||``,e.schemaUrl||``,jc(e.attributes),(t=e.droppedAttributesCount)==null?0:t])}P();var Nc=class{constructor(e){N(this,`createdLogs`,void 0),this.createdLogs=e.createCounter(`otel.sdk.log.created`,{unit:`{log_record}`,description:`The number of logs submitted to enabled SDK Loggers.`})}emitLog(){this.createdLogs.add(1)}};M(),H(),W(),P();let Pc={disabled:!1,minimumSeverity:V.UNSPECIFIED,traceBased:!1},Fc=()=>U({},Pc);var Ic=class{constructor(e,t,n,r,i,a){N(this,`loggers`,new Map),N(this,`activeProcessor`,void 0),N(this,`registeredLogRecordProcessors`,[]),N(this,`resource`,void 0),N(this,`forceFlushTimeoutMillis`,void 0),N(this,`logRecordLimits`,void 0),N(this,`processors`,void 0),N(this,`loggerMetrics`,void 0),N(this,`hasShutdown`,!1),N(this,`_loggerConfigurator`,void 0),N(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 Ac(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new kc,this._loggerConfigurator=i==null?Fc:i;let o=a?a.getMeter(`@opentelemetry/sdk-logs`,`0.220.0`):ve();this.loggerMetrics=new Nc(o)}getLoggerConfig(e){let t=Mc(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}};M(),H(),P(),W();var Lc=class{constructor(e={}){var t,n,r,i,a,o,s,c;N(this,`_shutdownOnce`,void 0),N(this,`_sharedState`,void 0);let l={resource:(t=e.resource)==null?vc():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?Fc:s,processors:(c=e.processors)==null?[]:c,meterProvider:e.meterProvider};this._sharedState=new Ic(l.resource,l.forceFlushTimeoutMillis,l.logRecordLimits,l.processors,l.loggerConfigurator,l.meterProvider),this._shutdownOnce=new fc(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return k.warn(`A shutdown LoggerProvider cannot provide a Logger`),Ba();e||k.warn(`Logger requested without instrumentation scope name.`);let r=U({name:e||`unknown`,version:t,schemaUrl:n==null?void 0:n.schemaUrl},Ec(this._sharedState.logRecordLimits,n==null?void 0:n.attributes)),i=Mc(r);return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new Oc(r,this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(k.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(k.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.hasShutdown=!0,this._sharedState.activeProcessor.shutdown()}};M(),q(),P();function Rc(e){return zc.apply(this,arguments)}function zc(){return zc=K(function*(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];r.resource.asyncAttributesPending&&r.resource.waitForAsyncAttributes&&t.push(r.resource.waitForAsyncAttributes())}t!=null&&t.length>0&&(yield Promise.all(t))}),zc.apply(this,arguments)}var Bc=class{constructor(e,t,n){N(this,`_exportCompleted`,void 0),N(this,`_exportScheduledPromise`,void 0),N(this,`_exportScheduledResolve`,void 0),this._exportScheduledPromise=new Promise(e=>{this._exportScheduledResolve=e}),this._exportCompleted=this._executeExport(e,t,n)}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}_executeExport(e,t,n){var r=this;return K(function*(){try{yield Rc(t),yield O.with(Ks(O.active()),K(function*(){return r._exportWithTimeout(e,t,n)}))}catch(e){Zs(e),r._exportScheduledResolve()}})()}_exportWithTimeout(e,t,n){var r=this;return K(function*(){return new Promise((i,a)=>{let o=setTimeout(()=>{a(Error(`Timeout`))},n);e.export(t,e=>{if(clearTimeout(o),e.code===cc.SUCCESS)i();else{var t;a((t=e.error)==null?Error(`BatchLogRecordProcessor: log record export failed`):t)}}),r._exportScheduledResolve()})})()}},Vc=class{constructor(e){var t,n,r,i;N(this,`_maxExportBatchSize`,void 0),N(this,`_maxQueueSize`,void 0),N(this,`_scheduledDelayMillis`,void 0),N(this,`_exportTimeoutMillis`,void 0),N(this,`_exporter`,void 0),N(this,`_currentExport`,null),N(this,`_finishedLogRecords`,[]),N(this,`_timer`,void 0),N(this,`_shutdownOnce`,void 0),N(this,`_flushing`,!1),this._exporter=e.exporter,this._maxExportBatchSize=(t=e.maxExportBatchSize)==null?512:t,this._maxQueueSize=(n=e.maxQueueSize)==null?2048:n,this._scheduledDelayMillis=(r=e.scheduledDelayMillis)==null?1e3:r,this._exportTimeoutMillis=(i=e.exportTimeoutMillis)==null?3e4:i,this._shutdownOnce=new fc(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(k.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()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}shutdown(){return this._shutdownOnce.call()}_shutdown(){var e=this;return K(function*(){e.onShutdown(),yield e._flushAll(),yield e._exporter.shutdown()})()}_flushAll(){var e=this;return K(function*(){if(e._flushing)return;e._flushing=!0;let t=e._finishedLogRecords;e._finishedLogRecords=[],e._clearTimer();let n=e._currentExport;for(n!==null&&(yield e._exporter.forceFlush(),yield n.exportCompleted,e._currentExport=null);t.length>0;){let n;t.length<=e._maxExportBatchSize?(n=t,t=[]):n=t.splice(0,e._maxExportBatchSize);let r=new Bc(e._exporter,n,e._exportTimeoutMillis);e._currentExport=r;try{yield r.exportScheduled,yield e._exporter.forceFlush(),yield r.exportCompleted}catch(e){Zs(e)}finally{e._currentExport=null}}e._flushing=!1,e._maybeStartTimer()})()}_extractBatch(){if(this._finishedLogRecords.length===0)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){let e=this._finishedLogRecords;return this._finishedLogRecords=[],e}else return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();let e=this._extractBatch();if(e===null)return;let t=new Bc(this._exporter,e,this._exportTimeoutMillis);this._currentExport=t,t.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(e=>{this._currentExport=null,Zs(e),this._maybeStartTimer()})}_maybeStartTimer(){if(!this._shutdownOnce.isCalled&&!this._flushing&&this._finishedLogRecords.length!==0&&this._currentExport===null){if(this._finishedLogRecords.length>=this._maxExportBatchSize){this._exportOneBatch();return}this._timer===void 0&&(this._timer=setTimeout(()=>{this._timer=void 0,this._exportOneBatch()},this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}};P();var Hc=class extends Vc{constructor(e){super(e),N(this,`_visibilityChangeListener`,void 0),N(this,`_pageHideListener`,void 0),this._onInit(e)}onShutdown(){typeof document>`u`||(this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener(`pagehide`,this._pageHideListener))}_onInit(e){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))}},Uc,Wc=n((()=>{Uc=`exception`}));function Gc(e){let t={};for(let[n,r]of e.getRawAttributes())typeof(r==null?void 0:r.then)!=`function`&&r!=null&&(t[n]!=null||(t[n]=r));return t}function Kc(e,t,n,r,i){if(typeof n==`number`&&n<0){let t=`[${e}]`;return r!=null&&r.stylize?r.stylize(t,`special`):t}return typeof i!=`function`||!r?t:`${e} ${i(t,U(U({},r),{},{depth:r.depth==null?r.depth:r.depth-1}))}`}var qc,Jc=n((()=>{W(),qc=Symbol.for(`nodejs.util.inspect.custom`)})),Yc,Xc=n((()=>{M(),B(),L(),Wc(),Jc(),P(),Yc=class{constructor(e){var t,n;N(this,`_spanContext`,void 0),N(this,`kind`,void 0),N(this,`parentSpanContext`,void 0),N(this,`attributes`,{}),N(this,`links`,[]),N(this,`events`,[]),N(this,`startTime`,void 0),N(this,`resource`,void 0),N(this,`instrumentationScope`,void 0),N(this,`_droppedAttributesCount`,0),N(this,`_droppedEventsCount`,0),N(this,`_droppedLinksCount`,0),N(this,`_attributesCount`,0),N(this,`name`,void 0),N(this,`status`,{code:kt.UNSET}),N(this,`endTime`,[0,0]),N(this,`_ended`,!1),N(this,`_duration`,[-1,-1]),N(this,`_spanProcessor`,void 0),N(this,`_spanLimits`,void 0),N(this,`_attributeValueLengthLimit`,void 0),N(this,`_recordEndMetrics`,void 0),N(this,`_performanceStartTime`,void 0),N(this,`_performanceOffset`,void 0),N(this,`_startTimeProvided`,void 0);let r=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=R.now(),this._performanceOffset=r-(this._performanceStartTime+R.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=(t=this._spanLimits.attributeValueLengthLimit)==null?0:t,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let t of e.links)this.addLink(t);this.startTime=this._getTime((n=e.startTime)==null?r:n),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 k.warn(`Invalid attribute key: ${e}`),this;if(!Ar(t))return k.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 in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,n){if(this._isSpanEnded())return this;let{eventCountLimit:r}=this._spanLimits;if(r===0)return k.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&k.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),wi(t)&&(wi(n)||(n=t),t=void 0);let i=Or(t),{attributePerEventCountLimit:a}=this._spanLimits,o={},s=0,c=0;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e))continue;let t=i[e];if(a!==void 0&&c>=a){s++;continue}o[e]=this._truncateToSize(t),c++}return this.events.push({name:e,attributes:o,time:this._getTime(n),droppedAttributesCount:s}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:t}=this._spanLimits;if(t===0)return this._droppedLinksCount++,this;t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&k.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,r=Or(e.attributes),i={},a=0,o=0;for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e))continue;let t=r[e];if(n!==void 0&&o>=n){a++;continue}i[e]=this._truncateToSize(t),o++}let s={context:e.context};return o>0&&(s.attributes=i),a>0&&(s.droppedAttributesCount=a),this.links.push(s),this}addLinks(e){for(let t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded()||e.code===kt.UNSET||this.status.code===kt.OK)return this;let t={code:e.code};return e.code===kt.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&k.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t,this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){var t;if(this._isSpanEnded()){k.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=bi(this.startTime,this.endTime),this._duration[0]<0&&(k.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&&k.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&k.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit 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<=R.now())return vi(e+this._performanceOffset);if(typeof e==`number`)return _i(e);if(e instanceof Date)return _i(e.getTime());if(Ci(e))return e;if(this._startTimeProvided)return _i(Date.now());let t=R.now()-this._performanceStartTime;return Ti(this.startTime,_i(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[Yr]=e:e&&(e.code?n[Zr]=e.code.toString():e.name&&(n[Zr]=e.name),e.message&&(n[Yr]=e.message),e.stack&&(n[Xr]=e.stack)),n[`exception.type`]||n[`exception.message`]?this.addEvent(Uc,n,t):k.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}}`);k.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?(k.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}[qc](e,t,n){return Kc(`SpanImpl`,{name:this.name,kind:this.kind,spanContext:this._spanContext,parentSpanContext:this.parentSpanContext,status:this.status,startTime:this.startTime,endTime:this.endTime,duration:this._duration,ended:this._ended,attributes:this.attributes,events:this.events,links:this.links,droppedAttributesCount:this._droppedAttributesCount,droppedEventsCount:this._droppedEventsCount,droppedLinksCount:this._droppedLinksCount,instrumentationScope:this.instrumentationScope,resource:{attributes:Gc(this.resource)}},e,t,n)}}})),Zc,Qc=n((()=>{(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(Zc||(Zc={}))})),$c,el,tl,nl,rl,il,al,ol,sl,cl,ll=n((()=>{$c=`otel.component.name`,el=`otel.component.type`,tl=`otel.span.parent.origin`,nl=`otel.span.sampling_result`,rl=`otel.sdk.processor.span.processed`,il=`otel.sdk.processor.span.queue.capacity`,al=`otel.sdk.processor.span.queue.size`,ol=`otel.sdk.span.live`,sl=`otel.sdk.span.started`,cl=`batching_span_processor`}));function ul(e){return e?e.isRemote?`remote`:`local`:`none`}function dl(e){switch(e){case Zc.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case Zc.RECORD:return`RECORD_ONLY`;case Zc.NOT_RECORD:return`DROP`}}var fl,pl=n((()=>{Qc(),ll(),P(),fl=class{constructor(e){N(this,`startedSpans`,void 0),N(this,`liveSpans`,void 0),this.startedSpans=e.createCounter(sl,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(ol,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=dl(t);if(this.startedSpans.add(1,{[tl]:ul(e),[nl]:n}),t===Zc.NOT_RECORD)return()=>{};let r={[nl]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}}})),ml,hl=n((()=>{ml=`2.10.0`})),gl,_l=n((()=>{M(),B(),Xc(),pl(),hl(),Jc(),P(),gl=class{constructor(e,t){N(this,`_sampler`,void 0),N(this,`_spanLimits`,void 0),N(this,`_idGenerator`,void 0),N(this,`instrumentationScope`,void 0),N(this,`_resource`,void 0),N(this,`_spanProcessor`,void 0),N(this,`_tracerMetrics`,void 0),this.instrumentationScope=e,this._sampler=t.sampler,this._spanLimits=t.spanLimits,this._resource=t.resource,this._idGenerator=t.idGenerator,this._spanProcessor=t.spanProcessor;let n=t.meterProvider.getMeter(`@opentelemetry/sdk-trace`,ml);this._tracerMetrics=new fl(n)}startSpan(e,t={},n=O.active()){var r,i,a;t.root&&(n=j.deleteSpan(n));let o=j.getSpan(n);if(hr(n))return k.debug(`Instrumentation suppressed, returning Noop Span`),j.wrapSpanContext(Je);let s=o==null?void 0:o.spanContext(),c=this._idGenerator.generateSpanId(),l,u,d;!s||!j.isSpanContextValid(s)?u=this._idGenerator.generateTraceId():(u=s.traceId,d=s.traceState,l=s);let f=(r=t.kind)==null?Dt.INTERNAL:r,p=((i=t.links)==null?[]:i).map(e=>({context:e.context,attributes:Or(e.attributes)})),m=Or(t.attributes),h=this._sampler.shouldSample(n,u,e,f,m,p),g=this._tracerMetrics.startSpan(s,h.decision);d=(a=h.traceState)==null?d:a;let _=h.decision===Tt.RECORD_AND_SAMPLED?D.SAMPLED:D.NONE,v={traceId:u,spanId:c,traceFlags:_,traceState:d};if(h.decision===Tt.NOT_RECORD)return k.debug(`Recording is off, propagating context in a non-recording span`),j.wrapSpanContext(v);let y=Or(Object.assign(m,h.attributes));return new Yc({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:v,name:e,kind:f,links:p,parentSpanContext:l,attributes:y,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:g})}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?O.active():i,l=this.startSpan(e,a,c),u=j.setSpan(c,l);return O.with(u,s,void 0,l)}[qc](e,t,n){return Kc(`Tracer`,{instrumentationScope:this.instrumentationScope,resource:{attributes:Gc(this._resource)},spanLimits:this._spanLimits},e,t,n)}}})),vl,yl=n((()=>{B(),P(),vl=class{constructor(e){N(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=>{Rr(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)})}}})),bl,xl=n((()=>{Qc(),bl=class{shouldSample(){return{decision:Zc.NOT_RECORD}}toString(){return`AlwaysOffSampler`}}})),Sl,Cl=n((()=>{Qc(),Sl=class{shouldSample(){return{decision:Zc.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}}})),wl,Tl=n((()=>{M(),B(),xl(),Cl(),P(),wl=class{constructor(e){var t,n,r,i;N(this,`_root`,void 0),N(this,`_remoteParentSampled`,void 0),N(this,`_remoteParentNotSampled`,void 0),N(this,`_localParentSampled`,void 0),N(this,`_localParentNotSampled`,void 0),this._root=e.root,this._root||(Rr(Error(`ParentBasedSampler must have a root sampler configured`)),this._root=new Sl),this._remoteParentSampled=(t=e.remoteParentSampled)==null?new Sl:t,this._remoteParentNotSampled=(n=e.remoteParentNotSampled)==null?new bl:n,this._localParentSampled=(r=e.localParentSampled)==null?new Sl:r,this._localParentNotSampled=(i=e.localParentNotSampled)==null?new bl:i}shouldSample(e,t,n,r,i,a){let o=j.getSpanContext(e);return!o||!lt(o)?this._root.shouldSample(e,t,n,r,i,a):o.isRemote?o.traceFlags&D.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,a):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,a):o.traceFlags&D.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()}}`}}})),El,Dl,Ol=n((()=>{L(),ll(),P(),W(),El=new Map,Dl=class{constructor(e,t,n){var r;N(this,`processedSpans`,void 0),N(this,`queueSize`,void 0),N(this,`queueSizeCallback`,void 0),N(this,`standardAttrs`,void 0),N(this,`droppedAttrs`,void 0);let i=(r=El.get(e))==null?0:r;if(El.set(e,i+1),this.standardAttrs={[el]:e,[$c]:`${e}/${i}`},this.droppedAttrs=U(U({},this.standardAttrs),{},{[Jr]:`queue_full`}),this.processedSpans=t.createCounter(rl,{unit:`{span}`,description:`The number of spans for which the processing has finished, either successful or failed.`}),n){let{capacity:e,getQueueSize:r}=n;t.createUpDownCounter(il,{unit:`{span}`,description:`The maximum number of spans the queue of a given instance of an SDK span processor can hold.`}).add(e,this.standardAttrs),this.queueSize=t.createObservableUpDownCounter(al,{unit:`{span}`,description:`The number of spans in the queue of a given instance of an SDK span processor.`}),this.queueSizeCallback=e=>e.observe(r(),this.standardAttrs),this.queueSize.addCallback(this.queueSizeCallback)}}dropSpans(e){this.processedSpans.add(e,this.droppedAttrs)}finishSpans(e,t){if(!t){this.processedSpans.add(e,this.standardAttrs);return}let n=U(U({},this.standardAttrs),{},{[Jr]:t.name});this.processedSpans.add(e,n)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}}})),kl,Al=n((()=>{M(),B(),Ol(),ll(),P(),kl=class{constructor(e){var t,n,r,i;N(this,`_maxExportBatchSize`,void 0),N(this,`_maxQueueSize`,void 0),N(this,`_scheduledDelayMillis`,void 0),N(this,`_exportTimeoutMillis`,void 0),N(this,`_exporter`,void 0),N(this,`_metrics`,void 0),N(this,`_isExporting`,!1),N(this,`_finishedSpans`,[]),N(this,`_timer`,void 0),N(this,`_shutdownOnce`,void 0),N(this,`_droppedSpansCount`,0),this._exporter=e.exporter,this._maxExportBatchSize=(t=e.maxExportBatchSize)==null?512:t,this._maxQueueSize=(n=e.maxQueueSize)==null?2048:n,this._scheduledDelayMillis=(r=e.scheduledDelayMillis)==null?5e3:r,this._exportTimeoutMillis=(i=e.exportTimeoutMillis)==null?3e4:i,this._shutdownOnce=new Na(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(k.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize);let a=e.selfObsMeterProvider?e.selfObsMeterProvider.getMeter(`@opentelemetry/sdk-trace`):ve();this._metrics=new Dl(cl,a,{capacity:this._maxQueueSize,getQueueSize:()=>this._finishedSpans.length})}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&D.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>(this._metrics.shutdown(),this._exporter.shutdown()))}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&k.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++,this._metrics.dropSpans(1);return}this._droppedSpansCount>0&&(k.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);O.with(mr(O.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,i=>{if(clearTimeout(n),this._metrics.finishSpans(r.length,i.error),i.code===z.SUCCESS)e();else{var a;t((a=i.error)==null?Error(`BatchSpanProcessor: span export failed`):a)}}),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=>{Rr(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,Rr(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)}}})),jl,Ml=n((()=>{Al(),B(),P(),jl=class extends kl{constructor(e){super(e),N(this,`_visibilityChangeListener`,void 0),N(this,`_pageHideListener`,void 0),this.onInit(e)}onInit(e){e.disableAutoFlushOnDocumentHide!==!0&&typeof document<`u`&&(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush().catch(e=>{Rr(e)})},this._pageHideListener=()=>{this.forceFlush().catch(e=>{Rr(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))}}}));function Nl(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 Pl(e){let t=``;for(let n=0;n<e.length;n++)t+=zl[e[n]];return t}var Fl,Il,Ll,Rl,zl,Bl,Vl=n((()=>{Fl=16,Il=8,Ll=new Uint8Array(Fl),Rl=new Uint8Array(Il),zl=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`)),Bl=class{generateTraceId(){return Nl(Ll),Pl(Ll)}generateSpanId(){return Nl(Rl),Pl(Rl)}}})),Hl=n((()=>{Ml(),Vl()})),Ul,Wl,Gl=n((()=>{M(),Ws(),_l(),yl(),Tl(),Cl(),Hl(),Jc(),P(),(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(Ul||(Ul={})),Wl=class{constructor(e={}){var t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_;N(this,`_resource`,void 0),N(this,`_activeSpanProcessor`,void 0),N(this,`_forceFlushTimeoutMillis`,void 0),N(this,`_tracerOptions`,void 0),N(this,`_tracers`,new Map),this._forceFlushTimeoutMillis=(t=e.forceFlushTimeoutMillis)==null?3e4:t,this._resource=(n=e.resource)==null?Rs():n;let v=(r=e.spanProcessors)==null?[]:r;this._activeSpanProcessor=new vl(v),this._tracerOptions={resource:this._resource,sampler:(i=e.sampler)==null?new wl({root:new Sl}):i,spanLimits:{attributeCountLimit:(a=(o=e.spanLimits)==null?void 0:o.attributeCountLimit)==null?128:a,attributeValueLengthLimit:(s=(c=e.spanLimits)==null?void 0:c.attributeValueLengthLimit)==null?1/0:s,eventCountLimit:(l=(u=e.spanLimits)==null?void 0:u.eventCountLimit)==null?128:l,linkCountLimit:(d=(f=e.spanLimits)==null?void 0:f.linkCountLimit)==null?128:d,attributePerEventCountLimit:(p=(m=e.spanLimits)==null?void 0:m.attributePerEventCountLimit)==null?128:p,attributePerLinkCountLimit:(h=(g=e.spanLimits)==null?void 0:g.attributePerLinkCountLimit)==null?128:h},idGenerator:e.idGenerator||new Bl,spanProcessor:this._activeSpanProcessor,meterProvider:(_=e.meterProvider)==null?{getMeter(){return ve()}}:_}}getTracer(e,t,n){let r=`${e}@${t||``}:${(n==null?void 0:n.schemaUrl)||``}`;return this._tracers.has(r)||this._tracers.set(r,new gl({name:e,version:t,schemaUrl:n==null?void 0:n.schemaUrl},this._tracerOptions)),this._tracers.get(r)}forceFlush(){let e=this._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=Ul.timeout},e);t.forceFlush().then(()=>{clearTimeout(i),r!==Ul.timeout&&(r=Ul.resolved,n(r))}).catch(e=>{clearTimeout(i),r=Ul.error,n(e)})}));return new Promise((e,n)=>{Promise.all(t).then(t=>{let r=t.filter(e=>e!==Ul.resolved);r.length>0?n(r):e()}).catch(e=>n([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[qc](e,t,n){let r=this._activeSpanProcessor._spanProcessors;return Kc(`TracerProvider`,{resource:{attributes:Gc(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:r.map(e=>{var t,n;return(t=(n=e.constructor)==null?void 0:n.name)==null?`SpanProcessor`:t})},e,t,n)}}})),Kl,ql=n((()=>{M(),Qc(),P(),Kl=class{constructor(e=0){N(this,`_ratio`,void 0),N(this,`_upperBound`,void 0),this._ratio=this._normalize(e),this._upperBound=this._ratio===1?4294967296:Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:st(t)&&this._accumulate(t)<this._upperBound?Zc.RECORD_AND_SAMPLED:Zc.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<32;n+=8){let r=0;for(let t=0;t<8;t++){let i=e.charCodeAt(n+t),a=i<58?i-48:i<71?i-55:i-87;r=r<<4|a}t=(t^r)>>>0}return t}}})),Jl=n((()=>{Gl(),Hl(),B(),P(),M(),Ol(),ll(),q(),xl(),Cl(),Qc(),Tl(),ql()}));function Yl(){var e,t,n,r,i,a,o,s;return{sampler:Xl(),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 Xl(){var e;let t=(e=void 0)==null?Ql.ParentBasedAlwaysOn:e;switch(t){case Ql.AlwaysOn:return new Sl;case Ql.AlwaysOff:return new bl;case Ql.ParentBasedAlwaysOn:return new wl({root:new Sl});case Ql.ParentBasedAlwaysOff:return new wl({root:new bl});case Ql.TraceIdRatio:return new Kl(Zl());case Ql.ParentBasedTraceIdRatio:return new wl({root:new Kl(Zl())});default:return k.error(`OTEL_TRACES_SAMPLER value "${t}" invalid, defaulting to "${Ql.ParentBasedAlwaysOn}".`),new wl({root:new Sl})}}function Zl(){return k.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${$l}.`),$l}var Ql,$l,eu=n((()=>{M(),B(),Jl(),(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`})(Ql||(Ql={})),$l=1}));function tu(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?nu:s,Object.assign({},e,{spanLimits:p})}var nu,ru=n((()=>{B(),nu=1/0})),iu,au=n((()=>{B(),eu(),ru(),Jl(),iu=class extends Wl{constructor(e={}){let t=_a({},Yl(),tu(e));delete t.generalLimits,super(t)}}})),ou,su=n((()=>{B(),Jl(),W(),ou=class extends jl{constructor(e,t){t||(t={});for(let[e,n]of[[`maxExportBatchSize`,`OTEL_BSP_MAX_EXPORT_BATCH_SIZE`],[`maxQueueSize`,`OTEL_BSP_MAX_QUEUE_SIZE`],[`scheduledDelayMillis`,`OTEL_BSP_SCHEDULE_DELAY`],[`exportTimeoutMillis`,`OTEL_BSP_EXPORT_TIMEOUT`]])t[e];super(U({exporter:e},t))}}})),cu=n((()=>{au(),su(),Jl()})),lu,uu=n((()=>{M(),P(),lu=class{constructor(){N(this,`_enabled`,!1),N(this,`_currentContext`,w)}_bindFunction(e=w,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=w,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=w,this)}with(e,t,n,...r){let i=this._currentContext;this._currentContext=e||w;try{return t.call(n,...r)}finally{this._currentContext=i}}}}));function du(e){if(e!==null){if(e===void 0){let e=new lu;e.enable(),O.setGlobalContextManager(e);return}e.enable(),O.setGlobalContextManager(e)}}function fu(e){if(e!==null){if(e===void 0){A.setGlobalPropagator(new ji({propagators:[new $i,new Er]}));return}A.setGlobalPropagator(e)}}var pu,mu=n((()=>{cu(),uu(),M(),B(),pu=class extends iu{constructor(e={}){super(e)}register(e={}){j.setGlobalTracerProvider(this),fu(e.propagator),du(e.contextManager)}}})),X,hu=n((()=>{(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`})(X||(X={}))})),gu,_u,vu=n((()=>{gu=`http.response_content_length`,_u=`http.response_content_length_uncompressed`}));function yu(){return ku||(ku=document.createElement(`a`)),ku}function bu(e,t){return t in e}function Z(e,t,n,r=!0){if(bu(n,t)&&typeof n[t]==`number`&&!(r&&n[t]===0))return e.addEvent(t,n[t])}function xu(e,t,n=!1,r,i){if(r===void 0&&(r=t[X.START_TIME]!==0),n||(Z(e,X.FETCH_START,t,r),Z(e,X.DOMAIN_LOOKUP_START,t,r),Z(e,X.DOMAIN_LOOKUP_END,t,r),Z(e,X.CONNECT_START,t,r),Z(e,X.SECURE_CONNECTION_START,t,r),Z(e,X.CONNECT_END,t,r),Z(e,X.REQUEST_START,t,r),Z(e,X.RESPONSE_START,t,r),Z(e,X.RESPONSE_END,t,r)),!i){let n=t[X.ENCODED_BODY_SIZE];n!==void 0&&e.setAttribute(gu,n);let r=t[X.DECODED_BODY_SIZE];r!==void 0&&n!==r&&e.setAttribute(_u,r)}}function Su(e){return e.slice().sort((e,t)=>{let n=e[X.FETCH_START],r=t[X.FETCH_START];return n>r?1:n<r?-1:0})}function Cu(){return typeof location<`u`?location.origin:void 0}function wu(e,t,n,r,i=new WeakSet,a){let o=Du(e);e=o.toString();let s=Eu(e,t,n,r,i,a);if(s.length===0)return{mainRequest:void 0};if(s.length===1)return{mainRequest:s[0]};let c=Su(s);if(o.origin!==Cu()&&c.length>1){let e=c[0],t=Tu(c,e[X.RESPONSE_END],n),r=e[X.RESPONSE_END];return t[X.FETCH_START]<r&&(t=e,e=void 0),{corsPreFlightRequest:e,mainRequest:t}}else return{mainRequest:s[0]}}function Tu(e,t,n){let r=xi(n),i=xi(yi(t)),a=e[1],o,s=e.length;for(let t=1;t<s;t++){let n=e[t],s=xi(yi(n[X.FETCH_START])),c=r-xi(yi(n[X.RESPONSE_END]));s>=i&&(!o||c<o)&&(o=c,a=n)}return a}function Eu(e,t,n,r,i,a){let o=xi(t),s=xi(n),c=r.filter(t=>{let n=xi(yi(t[X.FETCH_START])),r=xi(yi(t[X.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 Du(e){if(typeof URL==`function`)return new URL(e,typeof document<`u`?document.baseURI:typeof location<`u`?location.href:void 0);let t=yu();return t.href=e,t}function Ou(e,t){let n=t||[];return(typeof n==`string`||n instanceof RegExp)&&(n=[n]),Du(e).origin===Cu()?!0:n.some(t=>Oa(e,t))}var ku,Au=n((()=>{hu(),B(),vu()})),ju=n((()=>{mu(),uu(),hu(),Au(),cu()}));As(),ju();let Mu={compression:`gzip`,concurrencyLimit:5,keepalive:!0,timeoutMillis:30*1e3},Nu=(e,t)=>({"X-MXL-AID":e,"X-MXL-DID":t}),Pu=(e,t)=>t||`http://mxl-otelcol.apps.ocpthikadev01.safaricom.net`;function Fu(e,t){let n={attributes:Lu(e.attributes,t),droppedAttributesCount:0},r=e.schemaUrl;return r&&r!==``&&(n.schemaUrl=r),n}function Iu(e,t){let n={name:e.name,version:e.version};if(e.attributes&&Object.keys(e.attributes).length>0){var r;n.attributes=Lu(e.attributes,t),n.droppedAttributesCount=(r=e.droppedAttributesCount)==null?0:r}return n}function Lu(e,t){return Object.keys(e).map(n=>Ru(n,e[n],t))}function Ru(e,t,n){return{key:e,value:zu(t,n)}}function zu(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]=zu(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:zu(e[n[i]],t)};return{kvlistValue:{values:r}}}return{}}function Bu(e,t){return{resourceLogs:Hu(e,t)}}function Vu(e){let t=new Map;for(let n of e){let{resource:e,instrumentationScope:r}=n,i=t.get(e);i||(i=new Map,t.set(e,i));let a=i.get(r);a||(a=[],i.set(r,a)),a.push(n)}return t}function Hu(e,t){let n=Vu(e);return Array.from(n,([e,n])=>{let r=Fu(e,t);return{resource:r,scopeLogs:Array.from(n,([,e])=>({scope:Iu(e[0].instrumentationScope,t),logRecords:e.map(e=>Uu(e,t)),schemaUrl:e[0].instrumentationScope.schemaUrl})),schemaUrl:r.schemaUrl}})}function Uu(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:zu(e.body,t),eventName:e.eventName,attributes:Lu(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 Gu(e){let t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function Ku(e){return Gu(e).toString()}let qu=typeof BigInt<`u`?Ku:ac;function Ju(e){return e}let Yu={encodeHrTime:qu,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(``))}};M();let Xu={serializeRequest:e=>{let t=Bu(e,Yu);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return k.warn(`Failed to parse logs export response: ${e.message}. Returning empty response`),{}}}};function Zu(e,t){let n=e&255|256;return t&&(n|=512),n}function Qu(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:Lu(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>ed(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:s.code,message:s.message},links:e.links.map(e=>$u(e,t)),droppedLinksCount:e.droppedLinksCount,flags:Zu(o.traceFlags,(a=e.parentSpanContext)==null?void 0:a.isRemote)}}function $u(e,t){var n;return{attributes:e.attributes?Lu(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:Zu(e.context.traceFlags,e.context.isRemote)}}function ed(e,t){return{attributes:e.attributes?Lu(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function td(e,t){return{resourceSpans:rd(e,t)}}function nd(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 rd(e,t){let n=nd(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=>Qu(e,t));o.push({scope:Iu(e[0].instrumentationScope,t),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=s.next()}let l=Fu(e,t),u={resource:l,scopeSpans:o,schemaUrl:l.schemaUrl};r.push(u),a=i.next()}return r}M();let id={serializeRequest:e=>{let t=td(e,Yu);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return k.warn(`Failed to parse trace export response: ${e.message}. Returning empty response`),{}}}};var ad=class{constructor(e){this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}};P();var od=class extends Error{constructor(e,t,n){super(e),N(this,`code`,void 0),N(this,`name`,`OTLPExporterError`),N(this,`data`,void 0),this.data=n,this.code=t}};P(),q();var sd=class{constructor(e){N(this,`_concurrencyLimit`,void 0),N(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 K(function*(){yield Promise.all(e._sendingPromises)})()}};function cd(e){return new sd(e.concurrencyLimit)}M();function ld(e){return Object.prototype.hasOwnProperty.call(e,`partialSuccess`)}function ud(){return{handleResponse(e){e==null||!ld(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||k.warn(`Received Partial Success response:`,JSON.stringify(e.partialSuccess))}}}B(),M(),P(),q();var dd=class{constructor(e,t,n,r,i,a){N(this,`_metrics`,void 0),N(this,`_diagLogger`,void 0),N(this,`_transport`,void 0),N(this,`_serializer`,void 0),N(this,`_responseHandler`,void 0),N(this,`_promiseQueue`,void 0),N(this,`_timeout`,void 0),this._transport=e,this._serializer=t,this._responseHandler=n,this._promiseQueue=r,this._timeout=a,this._diagLogger=k.createComponentLogger({namespace:`OTLPExportDelegate`}),this._metrics=i}export(e,t){if(this._diagLogger.debug(`items to be sent`,e),this._promiseQueue.hasReachedLimit()){t({code:z.FAILED,error:Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);if(n==null){t({code:z.FAILED,error:Error(`Nothing to send`)});return}let r=this._metrics.startExport(e);this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(e=>{if(e.status===`success`){if(r(void 0),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:z.SUCCESS});return}else if(e.status===`failure`&&e.error){r(e.error),t({code:z.FAILED,error:e.error});return}else if(e.status===`retryable`){var n;r(`export_max_retries`),t({code:z.FAILED,error:(n=e.error)==null?new od(`Export failed with retryable status`):n})}else r(`export_failed`),t({code:z.FAILED,error:new od(`Export failed with unknown error`)})},e=>{r(e),t({code:z.FAILED,error:e})}))}forceFlush(){return this._promiseQueue.awaitAll()}setMetrics(e){this._metrics=e}shutdown(){var e=this;return K(function*(){e._diagLogger.debug(`shutdown started`),yield e.forceFlush(),e._transport.shutdown()})()}};function fd(e,t){return new dd(e.transport,e.serializer,ud(),e.promiseHandler,e.metrics,t.timeout)}function pd(e,t,n,r){return fd({transport:r,serializer:t,promiseHandler:cd(e),metrics:n},{timeout:e.timeoutMillis})}M(),q(),W();let md=49152,hd=0,gd=0;var _d=class e{constructor(e){this._config=e}static _compressRequest(e){return K(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),{done:a}=e}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 K(function*(){let i=t,a=U({"Content-Type":`application/json`},r._config.headers),o,s;if(`timeout`in AbortSignal)o=AbortSignal.timeout(n);else{let e=new AbortController;({signal:o}=e),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 k.warn(`Fetch transport gzip compression failed: ${t.message}`),{error:t,status:`failure`}}a[`Content-Encoding`]=`gzip`,a[`Content-Length`]=i.length.toString()}let n=hd+i.byteLength>md;if(c=!n&&!(gd>=9),c)hd+=i.byteLength,gd++;else{let e=n?`inflight bytes (${hd} + ${i.byteLength}) would exceed ${md}B budget`:`concurrent count (${gd}) at limit of 9`;k.debug(`Sending without keepalive: ${e}`)}let s=yield fetch(r._config.url,{body:i,headers:a,keepalive:c,method:`POST`,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?(k.debug(u),{error:l,status:`retryable`}):(k.warn(u),{error:l,status:`failure`})}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?k.debug(r):k.warn(r),{error:t,status:n?`retryable`:`failure`}}finally{s!==void 0&&clearTimeout(s),c&&(hd-=i.byteLength,gd--)}})()}};let vd=e=>new _d(e);q();let yd=()=>Math.random()*40-20;var bd=class{constructor(e,t=new Ra){this._transport=e,this._perf=t}send(e,t){var n=this;return K(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)+yd(),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 xd=e=>{var t;return new bd(e.transport,(t=e.perf)==null?new Ra:t)},Sd=(e,t)=>pd(e,t,xd({transport:vd(e)}));var Cd=class extends ad{constructor(e){super(Sd(e,Xu))}};let wd=(e,t)=>`${Pu(e,t)}/v1/logs`;W();var Td=class extends Cd{constructor({appID:e,userID:t,otelCollectorURL:n}){super(U(U({},Mu),{},{headers:Nu(e,t),url:wd(e,n)}))}};W();var Ed=class extends ad{constructor(e){super(Sd(U(U({},e),{},{compression:`gzip`}),id))}};let Dd=(e,t)=>`${Pu(e,t)}/v1/traces`;W();var Od=class extends Ed{constructor({appID:e,userID:t,otelCollectorURL:n}){super(U(U({},Mu),{},{headers:Nu(e,t),url:Dd(e,n)}))}};function kd(e){return{isRecording:()=>e.isRecording(),setEnabled:t=>{if(t){e.resume();return}e.pause()}}}let Ad=e=>e||`http://mxl-basket.apps.ocpthikadev01.safaricom.net`,jd=e=>e||`http://mxl-otel-collector.apps.ocpthikadev01.safaricom.net`,Md=(e,{osVersion:t,appVersion:n,deviceId:r},i)=>`${Ad(i)}/config?appId=${e}&osVersion=${t}&appVersion=${n}&deviceId=${r}`,Nd=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Pd=(e,t,n)=>{let r=e[t];if(typeof r==`number`)return r;let i=e[n];if(typeof i==`number`)return i},Fd=(e,t,n)=>{let r=e[t];if(typeof r==`boolean`)return r;let i=e[n];if(typeof i==`boolean`)return i},Id=(e,t,n)=>{let r=e[t];if(typeof r==`string`)return r;let i=e[n];if(typeof i==`string`)return i},Ld=e=>{if(!Nd(e))return;let t={},n=Pd(e,`pctEnabled`,`pct_enabled`);n!==void 0&&(t.pctEnabled=n);let r=Pd(e,`sampleRate`,`sample_rate`);r!==void 0&&(t.sampleRate=r);let i=Fd(e,`maskAllInputs`,`mask_all_inputs`);i!==void 0&&(t.maskAllInputs=i);let a=Fd(e,`maskAllText`,`mask_all_text`);a!==void 0&&(t.maskAllText=a);let o=Pd(e,`flushIntervalMs`,`flush_interval_ms`);o!==void 0&&(t.flushIntervalMs=o);let s=Fd(e,`omitRedundantInstrumentations`,`omit_redundant_instrumentations`);s!==void 0&&(t.omitRedundantInstrumentations=s);let c=Fd(e,`debug`,`debug`);return c!==void 0&&(t.debug=c),Object.keys(t).length>0?t:void 0},Rd=e=>{var t,n;if(!Nd(e))throw TypeError(`Remote config must be an object`);let r=e.threshold;if(typeof r!=`number`)throw TypeError(`Remote config threshold must be a number`);let i={threshold:r},a=(t=e.networkSpanForwarding)==null?e.network_span_forwarding:t;if(Nd(a)){let e=Pd(a,`pctEnabled`,`pct_enabled`);e!==void 0&&(i.networkSpanForwarding={pctEnabled:e})}let o=Pd(e,`emptySessionAvoidanceEnabledPct`,`empty_session_avoidance_enabled_pct`);o!==void 0&&(i.emptySessionAvoidanceEnabledPct=o);let s=Id(e,`serviceName`,`service_name`);s!==void 0&&(i.serviceName=s);let c=Ld((n=e.sessionReplay)==null?e.session_replay:n);return c!==void 0&&(i.sessionReplay=c),i};W(),q();let zd=e=>({"mxl-client-id":e}),Bd=0;function Vd(e,t){let n=Date.now();n-Bd<3e4||(Bd=n,console.warn(`[mxl] session replay ${e} failed (dropping; will retry on next chunk):`,t))}function Hd(e){let t=zd(e.appID),n=e.baseUrl.replace(/\/$/,``),r=e.otelCollectorURL.replace(/\/$/,``),i=[`${n}/sessionReplays/`,`${n}/sessionEvents`,`${n}/replay`,`${r}/v1/logs`,`${r}/v1/traces`],a=e=>i.some(t=>e.startsWith(t)),o=function(){var r=K(function*(r=!1){e.apiKey&&(yield fetch(`${n}/replay`,{body:`null`,headers:U(U({},t),{},{"content-type":`application/json`,"mxl-api-key":e.apiKey}),keepalive:r,method:`POST`}).catch(e=>{Vd(`replay POST`,e)}))});return function(){return r.apply(this,arguments)}}(),s=function(){var e=K(function*(e,r=!1){let i=`${JSON.stringify(e)}\n`;yield fetch(`${n}/sessionReplays/meta`,{body:i,headers:U(U({},t),{},{"content-type":`application/x-ndjson`}),keepalive:r,method:`POST`}).catch(e=>{Vd(`metadata POST`,e)})});return function(t){return e.apply(this,arguments)}}(),c=function(){var e=K(function*(e,r=!1){if(e.length===0)return;let i=`${e.map(e=>JSON.stringify(e)).join(`
|
|
2
|
-
`)}\n`;yield fetch(`${n}/sessionEvents`,{body:i,headers:U(U({},t),{},{"content-type":`application/x-ndjson`}),keepalive:r,method:`POST`}).catch(e=>{Vd(`events POST`,e)})});return function(t){return e.apply(this,arguments)}}();return{postReplay:o,postSessionBlob:function(){var e=K(function*(e,r,i=!1){yield fetch(`${n}/sessionReplays/blob`,{body:r,headers:U(U({},t),{},{"content-type":`application/octet-stream`,"x-mxl-chunk-seq":String(e.chunkSeq),"x-mxl-duration-ms":String(e.durationMs),"x-mxl-event-count":String(e.eventCount),"x-mxl-is-checkpoint":e.isCheckpoint?`1`:`0`,"x-mxl-session-id":e.sessionId}),keepalive:i,method:`POST`}).catch(e=>{Vd(`blob POST`,e)})});return function(t,n){return e.apply(this,arguments)}}(),postSessionEvents:c,postSessionMeta:s,shouldIgnoreUrl:a}}function Ud(e){return Hd({apiKey:e.apiKey,appID:e.appID,baseUrl:Ad(e.apiURL),otelCollectorURL:jd(e.otelCollectorURL)})}let Wd=`http.url`,Gd=`http.response.status_code`,Kd=`url.full`,qd=`user_agent.original`,Jd=`http.response.body.size`,Yd=`session.id`,Xd=`session.previous_id`,Zd=`user.id`,Qd=new Uint8Array(16),$d=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`).toUpperCase()),ef=()=>{crypto.getRandomValues(Qd);let e=``;for(let t=0;t<16;t++)e+=$d[Qd[t]];return e},tf=`0.0.23`,nf=`mxl_app_instance_id`,rf=(e,t)=>{let n=null;try{n=e.getItem(nf)}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=ef();try{e.setItem(nf,n)}catch(e){t.warn(`Failed to persist app instance ID to session storage`,e)}}return n};Ws(),W();let af=`unknown_service`,of=({serviceName:e})=>Is({"service.name":e}),sf=({diagLogger:e,appVersion:t,pageSessionStorage:n,applicationId:r,enduserPseudoId:i})=>Is(U(U({"telemetry.sdk.name":`mxl-web-sdk`,app_version:t,app_framework:1,sdk_version:tf,"telemetry.sdk.version":tf,sdk_simple_version:1,sdk_platform:`web`,"telemetry.sdk.language":`webjs`,"mxl.app_instance_id":rf(n,e),[qd]:window.navigator.userAgent,screen_resolution:`${window.screen.width}x${window.screen.height}`},i?{"enduser.pseudo.id":i}:{}),r?{[fr]:r}:{})),cf={networkSpansForwardingThreshold:0,samplingPct:100},lf=`mxl_remote_config`;M(),W(),P(),q();let uf=e=>{let t={samplingPct:e.threshold};return e.networkSpanForwarding!==void 0&&(t.networkSpansForwardingThreshold=e.networkSpanForwarding.pctEnabled),e.serviceName!==void 0&&e.serviceName!==``&&(t.serviceName=e.serviceName),e.emptySessionAvoidanceEnabledPct!==void 0&&(t.emptySessionAvoidanceEnabledPct=e.emptySessionAvoidanceEnabledPct),e.sessionReplay!==void 0&&(t.replay=U({},e.sessionReplay)),t};var df=class{constructor({appID:e,appVersion:t,deviceId:n,diag:r=k.createComponentLogger({namespace:`mxl-config-manager`}),storage:i=window.localStorage,defaultConfig:a={},apiURL:o}={}){N(this,`_remoteConfigURL`,null),N(this,`_diag`,void 0),N(this,`_storage`,void 0),N(this,`_baseConfig`,void 0),N(this,`_sdkConfig`,void 0),N(this,`_etag`,null),N(this,`_remoteSourceServiceName`,void 0),e&&t&&n&&(this._remoteConfigURL=Md(e,{appVersion:t,deviceId:n,osVersion:`1`},o)),this._diag=r,this._storage=i;let s=this._getRemoteConfigFromStorage();s&&(this._etag=s.etag,this._captureRemoteServiceName(s.config)),this._baseConfig=U(U({},cf),a),this._sdkConfig=U(U({},this._baseConfig),s?uf(s.config):{})}setConfig(e){this._sdkConfig=U(U({},this._sdkConfig),e)}getConfig(){return this._sdkConfig}resolveApplicationServiceName(e){var t,n;return((t=this._remoteSourceServiceName)==null?void 0:t.trim())||(e==null?void 0:e.trim())||((n=this._baseConfig.serviceName)==null?void 0:n.trim())||af}_captureRemoteServiceName(e){if(e.serviceName===void 0)return;let t=e.serviceName.trim();this._remoteSourceServiceName=t.length>0?t:void 0}refreshRemoteConfig(){var e=this;return K(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._captureRemoteServiceName(n),e._storage.setItem(lf,JSON.stringify({config:n,etag:r})),e._sdkConfig=U(U({},e._baseConfig),uf(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(lf);if(e){let t=JSON.parse(e);return{config:Rd(t.config),etag:t.etag}}return 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 K(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?[Rd(yield n.json()),r]:(t._diag.warn(`Failed to fetch remote config from ${e}: ${n.statusText}`),null)})()}};W();function ff({recordUserSessions:e,replay:t,dynamicConfig:n,isSessionReplayEnabled:r}){if(!r)return{recordUserSessions:!1,replay:t};let i=n.replay;if(!i)return{recordUserSessions:e,replay:t};let a=U({},t);return i.sampleRate!==void 0&&(a.sampleRate=i.sampleRate),i.maskAllInputs!==void 0&&(a.maskAllInputs=i.maskAllInputs),i.maskAllText!==void 0&&(a.maskAllText=i.maskAllText),i.flushIntervalMs!==void 0&&(a.flushIntervalMs=i.flushIntervalMs),i.omitRedundantInstrumentations!==void 0&&(a.omitRedundantInstrumentations=i.omitRedundantInstrumentations),i.debug!==void 0&&(a.debug=i.debug),{recordUserSessions:e,replay:a}}let pf={maxAllowed:{breadcrumb:100,element_timing:500,error_log:500,exception:500,info_log:100,network_request:1e4,server_timing:500,session_property:100,span:1e3,user_timing_mark:500,user_timing_measure:500,warning_log:200},maxAttributes:{error_log:50,exception:50,info_log:50,warning_log:50},maxLength:{breadcrumb:256,error_log:128,exception:1024,exception_attribute_key:128,exception_attribute_value:256,info_log:128,log_attribute_key:128,log_attribute_value:256,session_property_key:128,session_property_value:256,warning_log:128}};M(),P();let mf={error:`error_log`,info:`info_log`,warning:`warning_log`};var hf=class{constructor({diag:e,maxAllowed:t,maxLength:n,maxAttributes:r}){N(this,`_diag`,void 0),N(this,`_diagnosticCounts`,{}),N(this,`_currentCount`,{breadcrumb:0,element_timing:0,error_log:0,exception:0,info_log:0,network_request:0,server_timing:0,session_property:0,span:0,user_timing_mark:0,user_timing_measure:0,warning_log:0}),N(this,`_maxAllowed`,void 0),N(this,`_maxLength`,void 0),N(this,`_maxAttributes`,void 0),this._diag=e==null?k.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`:{attributes:this._truncateAttributes(`exception`,t,`exception_attribute_key`,`exception_attribute_value`),message:this.truncateString(`exception`,e)}}limitLog(e,t,n){let r=mf[t];return this._dropIfMaxReached(r)?`dropped`:{attributes:this._truncateAttributes(r,n,`log_attribute_key`,`log_attribute_value`),message:this.truncateString(r,e)}}limitSessionProperty(e,t){return this._dropIfMaxReached(`session_property`)?`dropped`:{key:this.truncateString(`session_property_key`,e),value:this.truncateString(`session_property_value`,t)}}limitElementTimingEntry(){return this._dropIfMaxReached(`element_timing`)}limitServerTimingEntry(){return this._dropIfMaxReached(`server_timing`)}limitUserTimingEntry(e){return this._dropIfMaxReached(e===`mark`?`user_timing_mark`:`user_timing_measure`)}dropReadableSpan(e){let t=e.attributes[`mxl.type`]===`perf.network_request`?`network_request`:`span`;return this._dropIfMaxReached(t)}reset(){this._diagnosticCounts={},this._currentCount={breadcrumb:0,element_timing:0,error_log:0,exception:0,info_log:0,network_request:0,server_timing:0,session_property:0,span:0,user_timing_mark:0,user_timing_measure:0,warning_log: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 gf=`mxl_user`,_f=`mxl_user_id`,vf=`mxl_external_user_id`,yf=`mxl_profile_snapshot`,bf=`mxl_session_analytics_prev`;W();let xf=()=>({avatar:``,email:``,firstName:``,lastName:``,profileId:``,properties:{}});function Sf(e){try{let t=e.getItem(yf);if(!t)return null;let n=JSON.parse(t);if(typeof n==`object`&&n&&typeof n.profileId==`string`)return n}catch(e){}return null}function Cf(e,t){try{return e.setItem(yf,JSON.stringify(t)),!0}catch(e){return!1}}function wf(e){try{e.removeItem(yf)}catch(e){}}function Tf(e,t){var n;let r=e==null?xf():e,i=U(U({},r.properties),(n=t.properties)==null?{}:n);return{avatar:t.avatar===void 0?r.avatar:t.avatar,email:t.email===void 0?r.email:t.email,firstName:t.firstName===void 0?r.firstName:t.firstName,lastName:t.lastName===void 0?r.lastName:t.lastName,profileId:t.profileId,properties:i}}function Ef(e){let t=U({},e.properties);return e.firstName&&(t.first_name=e.firstName),e.lastName&&(t.last_name=e.lastName),e.email&&(t.email=e.email),e.avatar&&(t.avatar=e.avatar),t}P(),W();var Df=class{constructor(){N(this,`_screenViewCount`,0),N(this,`_eventCount`,0),N(this,`_entry`,null),N(this,`_exit`,null),N(this,`_referrer`,``),N(this,`_utm`,{utmCampaign:``,utmContent:``,utmMedium:``,utmSource:``,utmTerm:``})}recordScreenView(e){this._screenViewCount+=1,this._eventCount+=1,this._entry||(this._entry=U({},e),this._referrer=e.referrer,this._utm={utmCampaign:e.utmCampaign,utmContent:e.utmContent,utmMedium:e.utmMedium,utmSource:e.utmSource,utmTerm:e.utmTerm}),this._exit=U({},e)}recordTrackEvent(){this._eventCount+=1}buildSpanAttributes(e,t){var n,r,i,a,o,s,c,l;let u={"mxl.session.screen_view_count":this._screenViewCount,"mxl.session.event_count":this._eventCount,"mxl.session.profile_id":e,"mxl.session.entry_origin":(n=(r=this._entry)==null?void 0:r.origin)==null?``:n,"mxl.session.entry_path":(i=(a=this._entry)==null?void 0:a.path)==null?``:i,"mxl.session.exit_origin":(o=(s=this._exit)==null?void 0:s.origin)==null?``:o,"mxl.session.exit_path":(c=(l=this._exit)==null?void 0:l.path)==null?``:c,"mxl.session.referrer":this._referrer,"mxl.session.utm_medium":this._utm.utmMedium,"mxl.session.utm_source":this._utm.utmSource,"mxl.session.utm_campaign":this._utm.utmCampaign,"mxl.session.utm_content":this._utm.utmContent,"mxl.session.utm_term":this._utm.utmTerm};return t&&(u[`${I}profile_id`]=t.profileId,u[`${I}screen_view_count`]=t.screenViewCount,u[`${I}event_count`]=t.eventCount,u[`${I}entry_origin`]=t.entryOrigin,u[`${I}entry_path`]=t.entryPath,u[`${I}exit_origin`]=t.exitOrigin,u[`${I}exit_path`]=t.exitPath,u[`${I}referrer`]=t.referrer,u[`${I}utm_medium`]=t.utmMedium,u[`${I}utm_source`]=t.utmSource,u[`${I}utm_campaign`]=t.utmCampaign,u[`${I}utm_content`]=t.utmContent,u[`${I}utm_term`]=t.utmTerm),u}toRowSnapshot(e,t,n){var r,i,a,o,s,c,l,u;return{applicationId:e,deviceId:n,entryOrigin:(r=(i=this._entry)==null?void 0:i.origin)==null?``:r,entryPath:(a=(o=this._entry)==null?void 0:o.path)==null?``:a,eventCount:this._eventCount,exitOrigin:(s=(c=this._exit)==null?void 0:c.origin)==null?``:s,exitPath:(l=(u=this._exit)==null?void 0:u.path)==null?``:l,profileId:t,referrer:this._referrer,screenViewCount:this._screenViewCount,utmCampaign:this._utm.utmCampaign,utmContent:this._utm.utmContent,utmMedium:this._utm.utmMedium,utmSource:this._utm.utmSource,utmTerm:this._utm.utmTerm}}reset(){this._screenViewCount=0,this._eventCount=0,this._entry=null,this._exit=null,this._referrer=``,this._utm={utmCampaign:``,utmContent:``,utmMedium:``,utmSource:``,utmTerm:``}}};function Of(e){try{let t=e.getItem(bf);return t?JSON.parse(t):null}catch(e){return null}}function kf(e,t){try{e.setItem(bf,JSON.stringify(t))}catch(e){}}function Af(e){try{e.removeItem(bf)}catch(e){}}function jf(e,t=document.referrer){let n=``,r=e,i=``,a=``,o=``,s=``,c=``;try{var l,u,d,f,p;let t=new URL(e,window.location.origin);n=t.origin,r=`${t.pathname}${t.search}${t.hash}`,i=(l=t.searchParams.get(`utm_medium`))==null?``:l,a=(u=t.searchParams.get(`utm_source`))==null?``:u,o=(d=t.searchParams.get(`utm_campaign`))==null?``:d,s=(f=t.searchParams.get(`utm_content`))==null?``:f,c=(p=t.searchParams.get(`utm_term`))==null?``:p}catch(e){}return{origin:n,path:r,referrer:t,utmCampaign:o,utmContent:s,utmMedium:i,utmSource:a,utmTerm:c}}M(),H(),P(),W();var Mf=class{constructor({applicationId:e,diag:t,loggerProvider:n,pageManager:r,storage:i=window.localStorage,userManager:a,userSessionManager:o}){N(this,`_diag`,void 0),N(this,`_logger`,void 0),N(this,`_applicationId`,void 0),N(this,`_userManager`,void 0),N(this,`_userSessionManager`,void 0),N(this,`_pageManager`,void 0),N(this,`_storage`,void 0),N(this,`_sessionAnalytics`,new Df),N(this,`_lastScreenViewPath`,null),N(this,`_screenViewTimer`,null);let s=n==null?ro:n;this._diag=t==null?k.createComponentLogger({namespace:`MXLAnalyticsManager`}):t,this._applicationId=e,this._userManager=a,this._userSessionManager=o,this._pageManager=r,this._storage=i,this._logger=s.getLogger(`mxl-web-sdk-analytics`)}getSessionAnalyticsState(){return this._sessionAnalytics}track(e,t={}){if(typeof e!=`string`||!e.trim()){this._diag.warn(`track name must be a non-empty string`);return}this._sessionAnalytics.recordTrackEvent(),this._emitAnalyticsLog(`track`,e.trim(),t.properties)}identify(e){var t,n,r,i,a,o;if(!((t=e.profileId)!=null&&t.trim())){this._diag.warn(`identify requires profileId`);return}let s=Tf(Sf(this._storage),{avatar:(n=e.avatar)==null?``:n,email:(r=e.email)==null?``:r,firstName:(i=e.firstName)==null?``:i,lastName:(a=e.lastName)==null?``:a,profileId:e.profileId.trim(),properties:(o=e.properties)==null?{}:o});Cf(this._storage,s)||this._diag.warn(`Failed to persist profile snapshot`),this._userManager.setUserId(s.profileId);let c=Ef(s);this._emitAnalyticsLog(`identify`,`identify`,c,s.profileId)}increment({property:e,value:t=1}){var n,r;let i=this._resolveProfileId();if(!i){this._diag.warn(`increment requires an identified profile`);return}let a=Sf(this._storage),o=Number.parseFloat((n=a==null?void 0:a.properties[e])==null?`0`:n),s=Number.isFinite(o)?o+t:t,c=Tf(a,{profileId:i,properties:U(U({},(r=a==null?void 0:a.properties)==null?{}:r),{},{[e]:String(s),counter_name:e,counter_value:String(s)})});Cf(this._storage,c),this._emitAnalyticsLog(`increment`,e,{counter_name:e,counter_value:String(s)},i)}decrement({property:e,value:t=1}){var n,r;let i=this._resolveProfileId();if(!i){this._diag.warn(`decrement requires an identified profile`);return}let a=Sf(this._storage),o=Number.parseFloat((n=a==null?void 0:a.properties[e])==null?`0`:n),s=Number.isFinite(o)?o-Math.abs(t):-Math.abs(t),c=Tf(a,{profileId:i,properties:U(U({},(r=a==null?void 0:a.properties)==null?{}:r),{},{[e]:String(s),counter_name:e,counter_value:String(s)})});Cf(this._storage,c),this._emitAnalyticsLog(`decrement`,e,{counter_name:e,counter_value:String(s)},i)}clear(){wf(this._storage),this._userManager.clearUserId()}screenView(){this._screenViewTimer&&clearTimeout(this._screenViewTimer),this._screenViewTimer=setTimeout(()=>{this._screenViewTimer=null,this._emitScreenView()},50)}buildSessionPartAnalyticsAttributes(){var e;let t=Of(this._storage),n=this._userManager.getMXLUserId(),r=(e=this._resolveProfileId())==null?n:e;return this._sessionAnalytics.buildSpanAttributes(r,t)}finalizeSessionPartAnalytics(){var e;let t=this._userManager.getMXLUserId(),n=(e=this._resolveProfileId())==null?t:e,r=this._sessionAnalytics.toRowSnapshot(this._applicationId,n,t);kf(this._storage,r)}resetSessionAnalyticsForNewUserSession(){this._sessionAnalytics.reset(),Af(this._storage),this._lastScreenViewPath=null}_emitScreenView(){var e,t;let n=this._pageManager.getCurrentRoute(),r=(e=n==null?void 0:n.url)==null?window.location.href:e,i=(t=n==null?void 0:n.path)==null?window.location.pathname:t;if(this._lastScreenViewPath===i)return;this._lastScreenViewPath=i;let a=jf(r);this._sessionAnalytics.recordScreenView(a),this._emitAnalyticsLog(`screen_view`,`screen_view`)}_emitAnalyticsLog(e,t,n={},r){var i,a,o,s,c,l;let u=this._pageManager.getCurrentRoute(),d=(i=u==null?void 0:u.url)==null?window.location.href:i,f=(a=u==null?void 0:u.path)==null?window.location.pathname:a,p=(o=(s=this._pageManager.getPageLabel())==null?document.title:s)==null?``:o,m=``;try{m=new URL(d,window.location.origin).origin}catch(e){m=window.location.origin}let h=this._userManager.getMXLUserId(),g=(c=r==null?this._resolveProfileId():r)==null?h:c,_=(l=this._userSessionManager.getUserSessionId())==null?``:l,v={"mxl.analytics.kind":e,"mxl.analytics.name":t,[fr]:this._applicationId,"mxl.device.id":h,"mxl.profile.id":g,"mxl.session.id":_,[or]:f,"mxl.page.url":d,"mxl.page.origin":m,"mxl.page.title":p,"mxl.page.referrer":document.referrer};for(let[e,t]of Object.entries(n))t!=null&&(v[`mxl.event.property.${e}`]=String(t));this._logger.emit({attributes:v,body:t,severityNumber:V.INFO,severityText:`INFO`})}_resolveProfileId(){let e=this._userManager.getUserId();if(e)return e;let t=Sf(this._storage);return(t==null?void 0:t.profileId)||null}};let Nf=(e,t,n)=>{try{let r=e.getItem(t),i=r?parseInt(r,10):0;return Number.isNaN(i)&&(n.warn(`Non-numeric value stored at ${t} (${String(r)}); resetting counter.`),i=0),i++,e.setItem(t,i.toString()),i}catch(e){return n.warn(`Failed to retrieve ${t} from storage: `,e),1}},Pf=e=>e.visibilityState===`hidden`?`background`:`foreground`,Ff=globalThis;M(),H(),P(),fn(),W();let If=()=>JSON.stringify(Ff._MXLFileBundleIDs||{});var Lf=class e{constructor({diag:e,perf:t,userSessionManager:n,limitManager:r,loggerProvider:i,visibilityDoc:a=window.document,storage:o=window.localStorage}){N(this,`_diag`,void 0),N(this,`_perf`,void 0),N(this,`_logger`,void 0),N(this,`_userSessionManager`,void 0),N(this,`_limitManager`,void 0),N(this,`_visibilityDoc`,void 0),N(this,`_storage`,void 0);let s=i==null?ro:i;this._diag=e==null?k.createComponentLogger({namespace:`MXLLogManager`}):e,this._perf=t==null?new Ra:t,this._logger=s.getLogger(`mxl-web-sdk-logs`),this._userSessionManager=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 V.INFO;case`warning`:return V.WARN;default:return V.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._userSessionManager.incrSessionPartCountForKey(`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{[nr]:p}=s,m=ns(s,[nr].map(dn)),h=this._limitManager.limitException(l,m);h!==`dropped`&&this._logger.emit({attributes:U(U(U({},h.attributes),p===void 0?{}:{[nr]:String(p)}),{},{[F]:`sys.exception`,"mxl.exception_handling":e._exceptionHandlingType(n,a),"mxl.exception_cause":f,"exception.type":c,"exception.name":u,"exception.message":h.message,"exception.stacktrace":d,[ir]:If(),[tr]:Pf(this._visibilityDoc),"mxl.exception_number":Nf(this._storage,`mxl_exception_number`,this._diag)}),body:h.message,severityNumber:V.ERROR,severityText:`ERROR`,timestamp:i})}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._userSessionManager.incrSessionPartCountForKey(`mxl.error_log_count`);let o=``;t!==`info`&&(typeof i==`string`?o=i:r&&(o=Error().stack||``)),this._logMessage({attributes:a,message:e.trim(),severity:t,stack:o,timestamp:this._perf.getNowMillis()})}_logMessage({message:t,severity:n,timestamp:r,attributes:i={},stack:a}){let o=this._limitManager.limitLog(t,n,i);o!==`dropped`&&this._logger.emit({attributes:U(U(U({},o.attributes),{},{[F]:`sys.log`},a?{"mxl.stacktrace.js":a,[ir]:If()}:{}),{},{[tr]:Pf(this._visibilityDoc)}),body:o.message,severityNumber:e._logSeverityToSeverityNumber(n),severityText:n.toUpperCase(),timestamp:r})}static _exceptionHandlingType(e,t){return e?`handled`:t===`global_exception`?`unhandled_error`:t===`promise_rejection`?`unhandled_rejection`:`unhandled`}};P();var Rf=class{constructor({useDocumentTitleAsPageLabel:e=!0,titleDocument:t=window.document}={}){N(this,`_currentRoute`,null),N(this,`_currentPageId`,null),N(this,`_pageLabel`,null),N(this,`_titleDocument`,void 0),N(this,`_useDocumentTitleAsPageLabel`,void 0),N(this,`getCurrentPageId`,()=>this._currentPageId),N(this,`getCurrentRoute`,()=>this._currentRoute),N(this,`setPageLabel`,e=>{this._pageLabel=e}),N(this,`getPageLabel`,()=>this._pageLabel||(!this._useDocumentTitleAsPageLabel||!this._titleDocument?null:this._titleDocument.title)),N(this,`setCurrentRoute`,e=>{(!this._currentRoute||this._currentRoute.url!==e.url)&&(this._currentPageId=ef()),this._currentRoute=e,e.label?this._pageLabel=e.label:this._pageLabel=null}),N(this,`clearCurrentRoute`,()=>{this._currentRoute=null,this._currentPageId=null,this._pageLabel=null}),this._useDocumentTitleAsPageLabel=e,this._titleDocument=t}};let zf=(e,t)=>!t||t<=0||t>100?!1:t>=Bf(e),Bf=e=>{if(e.length<6)return 0;let t=e.slice(-6),n=Math.pow(16,6)-1;return parseInt(t,16)/n*100};P();var Vf=class{constructor({dynamicConfigManager:e,deviceId:t,blockNetworkSpanForwarding:n}){N(this,`_dynamicConfigManager`,void 0),N(this,`_deviceId`,void 0),N(this,`_blockNetworkSpanForwarding`,void 0),this._dynamicConfigManager=e,this._deviceId=t,this._blockNetworkSpanForwarding=n}isSDKEnabled(){let e=this._dynamicConfigManager.getConfig();return zf(this._deviceId,e.samplingPct)}isNetworkSpanForwardingEnabled(){if(this._blockNetworkSpanForwarding)return!1;let e=this._dynamicConfigManager.getConfig();return zf(this._deviceId,e.networkSpansForwardingThreshold)}isSessionReplayEnabled(){var e,t;let n=(e=(t=this._dynamicConfigManager.getConfig().replay)==null?void 0:t.pctEnabled)==null?100:e;return zf(this._deviceId,n)}isEmptySessionAvoidanceEnabled(){let e=this._dynamicConfigManager.getConfig();return zf(this._deviceId,e.emptySessionAvoidanceEnabledPct)}};P(),fn();var Hf=class{constructor(e){N(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=ns(t,[e].map(dn));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)}};M(),P();var Uf=class{constructor({tracerProvider:e}={}){N(this,`_tracer`,void 0),N(this,`setSpan`,j.setSpan);let t=e==null?j:e;this._tracer=t.getTracer(`mxl-web-sdk-traces`)}startSpan(e,t={},n){t.attributes=t.attributes?t.attributes:{},t.attributes[F]=`perf`;let r=t.parentSpan?j.setSpan(O.active(),t.parentSpan):n;return new Hf(this._tracer.startSpan(e,t,r))}getSpan(e){let t=j.getSpan(e);if(t)return new Hf(t)}};let Wf=e=>typeof e[`enduser.pseudo.id`]==`string`&&e[`enduser.pseudo.id`].length===32,Gf=e=>typeof e==`string`&&e.length===32;M(),P();var Kf=class{constructor({diag:e,storage:t=window.localStorage}={}){N(this,`_diag`,void 0),N(this,`_storage`,void 0),N(this,`_mxlUserId`,null),this._diag=e==null?k.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(_f,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(_f)}catch(e){this._diag.warn(`Failed to remove mxl user in storage`,e)}}_migrateOldLocalStorageKey(){try{let e=this._storage.getItem(gf);if(e){let t=JSON.parse(e);Wf(t)?(this._diag.debug(`Migrating old user data from storage`),this._storage.setItem(_f,t[`enduser.pseudo.id`]),this._storage.removeItem(gf)):(this._diag.warn(`Invalid user data found in storage, clearing old user data`),this._storage.removeItem(gf))}}catch(e){this._diag.warn(`Failed to get old user data from storage`,e)}}_initialSetup(){try{let e=this._storage.getItem(_f);e?Gf(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=ef();return this.setMXLUserId(e),e}getUserId(){try{return this._storage.getItem(vf)}catch(e){return this._diag.warn(`Failed to retrieve user id from storage`,e),null}}setUserId(e){try{this._storage.setItem(vf,e)}catch(e){this._diag.warn(`Failed to store user id`,e)}}clearUserId(){try{this._storage.removeItem(vf)}catch(e){this._diag.warn(`Failed to clear user id`,e)}}};let qf=`mxl_user_session_state`,Jf=`mxl_permanent_properties`,Yf=`mxl_last_end_user_session_ts`,Xf=`mxl_tab`,Zf=`mxl_tab_activity`,Qf=720*60,$f=1800,ep=[`keydown`,`mousedown`,`mousemove`,`scroll`],tp=({diag:e,value:t,defaultValue:n,min:r,max:i})=>t===void 0?n:Number.isFinite(t)?t<r||t>i?(e==null||e.warn(`value (${t.toString()}) is outside the allowed range [${r.toString()}, ${i.toString()}]; falling back to default (${n.toString()}).`),n):t:(e==null||e.warn(`value is not a finite number; falling back to default (${n.toString()}).`),n),np=(e,t=1e3)=>{let n=!1,r=null,i=((...i)=>{n||(e(...i),n=!0,r=setTimeout(()=>{n=!1,r=null},t))});return i.cancel=()=>{r!==null&&(clearTimeout(r),r=null),n=!1},i},rp=e=>e.visibilityState===`visible`&&e.hasFocus(),ip=({target:e,visibilityDoc:t,activityEvents:n,onActivity:r,onVisibilityChange:i,onFocus:a,onBlur:o,onPageShow:s,onPageHide:c})=>{var l;for(let t of n)e.addEventListener(t,r);(l=t.addEventListener)==null||l.call(t,`visibilitychange`,i),e.addEventListener(`focus`,a),e.addEventListener(`blur`,o),e.addEventListener(`pageshow`,s),e.addEventListener(`pagehide`,c)},ap=({target:e,visibilityDoc:t,activityEvents:n,onActivity:r,onVisibilityChange:i,onFocus:a,onBlur:o,onPageShow:s,onPageHide:c})=>{var l;for(let t of n)e.removeEventListener(t,r);(l=t.removeEventListener)==null||l.call(t,`visibilitychange`,i),e.removeEventListener(`focus`,a),e.removeEventListener(`blur`,o),e.removeEventListener(`pageshow`,s),e.removeEventListener(`pagehide`,c)},op=(e,t)=>t<e.userSessionStartTs||t>=e.userSessionMaxEndTs||e.inactivityDeadlineTs!==null&&t>=e.inactivityDeadlineTs,sp=({now:e,previousUserSessionId:t,maxUserSessionDurationSeconds:n,inactivityTimeoutSeconds:r,userSessionNumber:i})=>({inactivityDeadlineTs:null,inactivityTimeoutSeconds:r,maxUserSessionDurationSeconds:n,previousUserSessionId:t,schemaVersion:1,userSessionId:ef(),userSessionMaxEndTs:e+n*1e3,userSessionNumber:i,userSessionPartIndex:0,userSessionProperties:{},userSessionStartTs:e}),cp=e=>typeof e==`object`&&!!e&&e.schemaVersion===1,lp=(e,t)=>{let n=e.getItem(qf);if(!n)return null;try{let e=JSON.parse(n);if(!cp(e))throw Error(`stored user session state failed structural validation`);return e}catch(n){return t.error(`User session state in storage is corrupt; discarding it`,n),e.removeItem(qf),null}},up=(e,t)=>{let n=e.getItem(Jf);if(!n)return{};try{let e=JSON.parse(n);if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`permanent properties blob is not a plain object`);let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&(t[n]=r);return t}catch(n){return t.error(`Permanent properties in storage are corrupt; discarding`,n),e.removeItem(Jf),{}}},dp=(e,t)=>Object.keys(t).length===0?e.removeItem(Jf):e.setItem(Jf,JSON.stringify(t)),fp=e=>{if(!e)return{isSameOrigin:!1,isValid:!1};try{let t=new URL(e),n=window.location.origin;return{isSameOrigin:t.origin===n,isValid:!0,scrubbedUrl:t.origin+t.pathname}}catch(e){return{isSameOrigin:!1,isValid:!1}}},pp=(e,t,n)=>{try{let e=t.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){n.warn(`Failed to get navigation type`,e)}return e.isValid?e.isSameOrigin?`same_origin`:`external`:`direct`},mp=(e,t)=>{try{let t=e.getItem(Zf);return t?JSON.parse(t):null}catch(e){return t.warn(`Failed to retrieve tab activity`,e),null}},hp=(e,t,n,r)=>{let i=rf(t,r),a,o;if(e===`same_origin`){let e=mp(n,r);e&&Date.now()-e.lastActivityMs<=1e4&&(a=e.tabId,{experienceId:o}=e)}return o===void 0&&(o=ef()),{navigationSource:e,tab:{experienceId:o,sourceTabId:a,tabId:i}}},gp=({sessionStorage:e,localStorage:t,referrer:n,navigationPerformance:r,diag:i})=>{let a=fp(n),o=pp(a,r,i);try{let t=e.getItem(Xf);if(t)return{navigationSource:o,referrerScrubbedUrl:a.isValid&&a.scrubbedUrl?a.scrubbedUrl:void 0,tab:JSON.parse(t)}}catch(e){i.warn(`Failed to retrieve tab data`,e)}let s=hp(o,e,t,i);try{e.setItem(Xf,JSON.stringify(s.tab))}catch(e){i.warn(`Failed to store tab data`,e)}return{navigationSource:s.navigationSource,referrerScrubbedUrl:a.isValid&&a.scrubbedUrl?a.scrubbedUrl:void 0,tab:s.tab}},_p=(e,t,n)=>{let r={experienceId:t.experienceId,lastActivityMs:Date.now(),tabId:t.tabId};try{e.setItem(Zf,JSON.stringify(r))}catch(e){n.warn(`Failed to save tab activity`,e)}},vp=(e,t,n)=>{let r=r=>{var i;if(r.button===1||r.ctrlKey||r.metaKey||r.shiftKey){_p(t,e,n);return}(i=r.target)!=null&&i.closest(`a[target="_blank"], form[target="_blank"], a[rel*="noopener"], a[rel*="noreferrer"]`)&&_p(t,e,n)},i={capture:!0,passive:!0};document.addEventListener(`auxclick`,r,i),document.addEventListener(`click`,r,i)};M(),P(),W();var yp=class e{static shutdownAllTestInstances(){for(let t of e._testInstances)t._shutdown();e._testInstances.clear()}constructor({config:t,diag:n,perf:r,visibilityDoc:i,storage:a,limitManager:o,target:s=window,activityThrottleMs:c=3e4,activityEvents:l=ep,tabStorage:u,referrer:d=typeof document<`u`?document.referrer:``,navigationPerformance:f=typeof window<`u`?window.performance:{getEntriesByType:()=>[]}}){N(this,`_state`,null),N(this,`_previousUserSessionId`,null),N(this,`_maxUserSessionDurationSeconds`,void 0),N(this,`_inactivityTimeoutSeconds`,void 0),N(this,`_maxDurationTimeout`,null),N(this,`_isShutdown`,!1),N(this,`_permanentProperties`,{}),N(this,`_hasStoredState`,!1),N(this,`_activeSessionPartId`,null),N(this,`_currentSessionPartNumber`,null),N(this,`_sessionPartSpan`,null),N(this,`_activeSessionPartCounts`,null),N(this,`_coldStart`,!0),N(this,`_nextSessionPartCounts`,{}),N(this,`_sdkStartupDuration`,0),N(this,`_sessionPartStartedListeners`,[]),N(this,`_sessionPartEndedListeners`,[]),N(this,`_tracer`,void 0),N(this,`_diag`,void 0),N(this,`_perf`,void 0),N(this,`_storage`,void 0),N(this,`_visibilityDoc`,void 0),N(this,`_limitManager`,void 0),N(this,`_target`,void 0),N(this,`_activityEvents`,void 0),N(this,`_onActivityThrottled`,void 0),N(this,`_sessionPartInactivityTimer`,null),N(this,`_tab`,void 0),N(this,`_navigationSource`,void 0),N(this,`_referrerScrubbedUrl`,void 0),N(this,`_analyticsManager`,null),N(this,`_onActivity`,()=>{try{if(!rp(this._visibilityDoc))return;if(this._activeSessionPartId===null){this.startSessionPartInternal(`web_activity`);return}this._startSessionPartInactivityTimer()}catch(e){this._diag.warn(`Error handling activity event`,e)}}),N(this,`_onVisibilityChange`,()=>{this._handleEngagementTransition(`visibilitychange`)}),N(this,`_onFocus`,()=>{this._handleEngagementTransition(`focus`)}),N(this,`_onBlur`,()=>{this._handleEngagementTransition(`blur`)}),N(this,`_onPageShow`,e=>{this._handleEngagementTransition(e.persisted?`pageshow-bfcache`:`pageshow-initial`)}),N(this,`_onPageHide`,e=>{try{if(this._activeSessionPartId===null)return;let t=e.persisted?`web_background`:`web_hard_navigation`;this._diag.debug(`page hiding (persisted=${e.persisted}); ending current part as ${t}`),this.endSessionPartInternal(t)}catch(t){this._diag.error(`Error ending session part on pagehide (persisted=${e.persisted})`,t)}}),N(this,`_onSessionPartInactivity`,()=>{this._sessionPartInactivityTimer=null;try{if(this._activeSessionPartId===null)return;this._diag.debug(`inactivity timer fired; ending current part and user session`),this.endSessionPartInternal(`inactivity`,`inactivity`)}catch(e){this._diag.warn(`Error handling inactivity timer`,e)}}),this._diag=n==null?k.createComponentLogger({namespace:`MXLUserSessionManager`}):n,this._perf=r,this._visibilityDoc=i,this._storage=a,this._limitManager=o,this._permanentProperties=up(this._storage,this._diag),this._tracer=j.getTracer(`mxl-web-sdk-session-parts`),this._target=s,this._activityEvents=l,this._onActivityThrottled=np(this._onActivity,c);let p=tp({defaultValue:Qf,diag:this._diag,max:86400,min:3600,value:t==null?void 0:t.maxUserSessionDurationSeconds}),m=tp({defaultValue:$f,diag:this._diag,max:86400,min:30,value:t==null?void 0:t.inactivityTimeoutSeconds});this._maxUserSessionDurationSeconds=p,m<=p?this._inactivityTimeoutSeconds=m:(this._diag.warn(`inactivityTimeoutSeconds (${m.toString()}s) exceeds maxUserSessionDurationSeconds (${p.toString()}s); falling back to default inactivity timeout (1800s).`),this._inactivityTimeoutSeconds=$f);let h=gp({diag:this._diag,localStorage:a,navigationPerformance:f,referrer:d,sessionStorage:u});this._tab=h.tab,this._navigationSource=h.navigationSource,this._referrerScrubbedUrl=h.referrerScrubbedUrl,vp(this._tab,a,this._diag),e._testInstances.add(this)}setTracerProvider(e){this._tracer=e.getTracer(`mxl-web-sdk-session-parts`),ip({activityEvents:this._activityEvents,onActivity:this._onActivityThrottled,onBlur:this._onBlur,onFocus:this._onFocus,onPageHide:this._onPageHide,onPageShow:this._onPageShow,onVisibilityChange:this._onVisibilityChange,target:this._target,visibilityDoc:this._visibilityDoc});let{state:t,created:n}=this._loadOrCreateUserSessionState(this._perf.getNowMillis());this._state=t,n&&this._storeState()}recordSDKStartupDuration(e){this._sdkStartupDuration=Math.ceil(e)}setAnalyticsManager(e){this._analyticsManager=e}getUserSessionId(){var e,t;return(e=(t=this._state)==null?void 0:t.userSessionId)==null?null:e}getPreviousUserSessionId(){var e,t;return(e=(t=this._state)==null?void 0:t.previousUserSessionId)==null?this._previousUserSessionId:e}getUserSessionStartTime(){var e,t;return(e=(t=this._state)==null?void 0:t.userSessionStartTs)==null?null:e}getUserSessionAttributes(){var e,t;if(!this._state)return null;let n=(e=this.getPreviousUserSessionId())==null?``:e;return{[ur]:this._state.userSessionId,[Yd]:this._state.userSessionId,[dr]:n,[Xd]:n,"mxl.user_session_number":this._state.userSessionNumber,"mxl.user_session_part_index":this._state.userSessionPartIndex,"mxl.session_part_number":(t=this._currentSessionPartNumber)==null?0:t,"mxl.user_session_start_ts":this._state.userSessionStartTs,"mxl.user_session_max_duration_seconds":this._state.maxUserSessionDurationSeconds,"mxl.user_session_inactivity_timeout_seconds":this._state.inactivityTimeoutSeconds}}endUserSession(){if(!this._state){this._diag.debug(`Trying to end user session, but there is no active session. This is a no-op.`);return}let e=this._perf.getNowMillis(),t=this._storage.getItem(Yf),n=t===null?NaN:Number(t);if(Number.isFinite(n)&&e-n<5e3){this._diag.warn(`endUserSession called within cooldown period, ignoring.`);return}this._rolloverUserSession(`manual`),this._storage.setItem(Yf,String(e))}getSessionPartId(){return this._activeSessionPartId}getSessionPartSpan(){return this._sessionPartSpan}startSessionPartInternal(e){if(this._sessionPartSpan){this._diag.warn(`startSessionPartInternal called while a part is active (reason: ${e}); ignoring`);return}if(Pf(this._visibilityDoc)===`background`||!this._visibilityDoc.hasFocus()){this._diag.debug(`skipping session part start (reason: ${e}) because the tab is not engaged`);return}let t=ef(),n=this._nextSessionPartCounts;this._beginUserSessionForPartStart();let r=U(U({},this.getUserSessionAttributes()),{},{[F]:`ux.session_part`,[tr]:`foreground`,[lr]:t,"mxl.session_part_start_reason":e,"mxl.cold_start":this._coldStart,"mxl.experience_id":this._tab.experienceId,"mxl.tab_id":this._tab.tabId,"mxl.navigation_source":this._navigationSource},n);this._referrerScrubbedUrl&&(r[`mxl.referrer_url`]=this._referrerScrubbedUrl),this._tab.sourceTabId&&(r[`mxl.source_tab_id`]=this._tab.sourceTabId),this._activeSessionPartId=t;let i;try{i=new Hf(this._tracer.startSpan(`mxl-session-part`,{attributes:r}))}catch(e){this._activeSessionPartId=null,this._diag.error(`Error starting session part span`,e);return}this._activeSessionPartCounts={},this._nextSessionPartCounts={},this._sessionPartSpan=i,this._coldStart=!1,this._startSessionPartInactivityTimer(),this._fireListeners(this._sessionPartStartedListeners,`started`)}endSessionPartInternal(e,t){if(!this._sessionPartSpan){this._diag.debug(`trying to end a session part, but there is no session part in progress. This is a no-op.`);return}this._clearSessionPartInactivityTimer();let n=e===`user_session_ended`||e===`inactivity`,r=this._perf.getNowMillis(),i=this._sessionPartSpan;try{let r=U(U(U({"mxl.session_part_end_reason":e},this._activeSessionPartCounts),this._limitManager.getDiagnosticCounts()),{},{"mxl.sdk_startup_duration":this._sdkStartupDuration});n&&(r[`mxl.is_final_session_part`]=1,t&&(r[`mxl.user_session_termination_reason`]=t)),this._analyticsManager&&(Object.assign(r,this._analyticsManager.buildSessionPartAnalyticsAttributes()),this._analyticsManager.finalizeSessionPartAnalytics());let a={};for(let[e,t]of Object.entries(this.getSessionPartProperties()))a[`mxl.properties.`+e]=t;try{i.setAttributes(U(U({},a),r))}catch(e){this._diag.warn(`Error setting end attributes on session part span; ending span without them`,e)}}finally{this._fireListeners(this._sessionPartEndedListeners,`ended`);try{i.end(r)}catch(e){this._diag.warn(`Error ending session part span`,e)}this._sessionPartSpan=null,this._activeSessionPartId=null,this._activeSessionPartCounts=null,this._currentSessionPartNumber=null,this._limitManager.reset()}if(n){var a,o;this._previousUserSessionId=(a=(o=this._state)==null?void 0:o.userSessionId)==null?null:a,this._state=null,this._storage.removeItem(qf),this._clearMaxDurationTimer()}else this._continueUserSessionAfterPartEnd(r)}addBreadcrumb(e){if(!this._sessionPartSpan){this._diag.debug(`trying to add breadcrumb, but there is no session part in progress. This is a no-op.`);return}let t=this._limitManager.limitBreadcrumb(e);t!==`dropped`&&this._sessionPartSpan.addEvent(`mxl-breadcrumb`,{message:t.name},this._perf.getNowMillis())}addProperty(e,t,n){let r=this._limitManager.limitSessionProperty(e,t);if(r===`dropped`)return;let i=r.key,a=r.value;if((n==null?void 0:n.lifespan)===`permanent`){let e=U(U({},this._permanentProperties),{},{[i]:a});if(!dp(this._storage,e)){this._diag.warn(`Storage unavailable; rejecting permanent property write.`);return}this._permanentProperties=e,this._removeFromUserSessionProperties(i);return}let{state:o}=this._loadOrCreateUserSessionState(this._perf.getNowMillis());this._state=U(U({},o),{},{userSessionProperties:U(U({},o.userSessionProperties),{},{[i]:a})}),this._storeState()||(this._state=o,this._diag.warn(`Storage unavailable; rejecting user-session property write.`))}removeProperty(e){let t=this._limitManager.truncateString(`session_property_key`,e);this._removeFromPermanentProperties(t),this._removeFromUserSessionProperties(t)}getSessionPartProperties(){var e;return U(U({},this._permanentProperties),(e=this._state)==null?void 0:e.userSessionProperties)}incrSessionPartCountForKey(e){if(!this._sessionPartSpan||!this._activeSessionPartCounts){this._diag.debug(`trying to increment a count for the active session part, but there is no session part in progress. This is a no-op.`);return}this._activeSessionPartCounts[e]=(this._activeSessionPartCounts[e]||0)+1}incrNextSessionPartCountForKey(e){this._nextSessionPartCounts[e]=(this._nextSessionPartCounts[e]||0)+1}addSessionPartStartedListener(e){return this._addListener(this._sessionPartStartedListeners,e)}addSessionPartEndedListener(e){return this._addListener(this._sessionPartEndedListeners,e)}_loadOrCreateUserSessionState(e){let t=lp(this._storage,this._diag),n=!1;if(!t||op(t,e)){var r;t&&(this._previousUserSessionId=t.userSessionId);let i=Nf(this._storage,`mxl_user_session_number`,this._diag);t=sp({inactivityTimeoutSeconds:this._inactivityTimeoutSeconds,maxUserSessionDurationSeconds:this._maxUserSessionDurationSeconds,now:e,previousUserSessionId:this._previousUserSessionId,userSessionNumber:i}),n=!0,(r=this._analyticsManager)==null||r.resetSessionAnalyticsForNewUserSession()}return(n||this._maxDurationTimeout===null)&&this._setupMaxDurationTimer(t,e),{created:n,state:t}}_beginUserSessionForPartStart(){let e=this._perf.getNowMillis(),{state:t}=this._loadOrCreateUserSessionState(e);this._currentSessionPartNumber=Nf(this._storage,`mxl_session_part_number`,this._diag),this._state=U(U({},t),{},{userSessionPartIndex:t.userSessionPartIndex+1,inactivityDeadlineTs:null}),this._storeState()}_continueUserSessionAfterPartEnd(e){if(!this._state){this._clearMaxDurationTimer();return}if(this._hasStoredState&&this._storage.getItem(`mxl_user_session_state`)===null){this._previousUserSessionId=this._state.userSessionId,this._state=null,this._clearMaxDurationTimer();return}this._state=U(U({},this._state),{},{inactivityDeadlineTs:e+this._state.inactivityTimeoutSeconds*1e3}),this._storeState()}_rolloverUserSession(e){var t,n;if(this._sessionPartSpan){this.endSessionPartInternal(`user_session_ended`,e),this.startSessionPartInternal(`user_session_rollover`);return}this._previousUserSessionId=(t=(n=this._state)==null?void 0:n.userSessionId)==null?null:t,this._state=null,this._storage.removeItem(qf),this._clearMaxDurationTimer()}_setupMaxDurationTimer(e,t){this._clearMaxDurationTimer();let n=e.userSessionMaxEndTs-t;n<=0||(this._maxDurationTimeout=setTimeout(()=>{this._maxDurationTimeout=null,this._rolloverUserSession(`max_duration_reached`)},n))}_clearMaxDurationTimer(){this._maxDurationTimeout!==null&&(clearTimeout(this._maxDurationTimeout),this._maxDurationTimeout=null)}_shutdown(){this._isShutdown||(this._isShutdown=!0,e._testInstances.delete(this),this._onActivityThrottled.cancel(),ap({activityEvents:this._activityEvents,onActivity:this._onActivityThrottled,onBlur:this._onBlur,onFocus:this._onFocus,onPageHide:this._onPageHide,onPageShow:this._onPageShow,onVisibilityChange:this._onVisibilityChange,target:this._target,visibilityDoc:this._visibilityDoc}),this._clearSessionPartInactivityTimer(),this._clearMaxDurationTimer())}_handleEngagementTransition(e){try{let t=rp(this._visibilityDoc),n=this._activeSessionPartId!==null;if(!t&&n){this._diag.debug(`tab disengaged via ${e}; ending current part`),this.endSessionPartInternal(`web_background`);return}if(t&&!n){this._diag.debug(`tab engaged via ${e}; starting new part`),this.startSessionPartInternal(`web_foreground`);return}t&&n&&this._startSessionPartInactivityTimer()}catch(e){this._diag.warn(`Error handling engagement change`,e)}}_startSessionPartInactivityTimer(){this._clearSessionPartInactivityTimer(),this._sessionPartInactivityTimer=setTimeout(this._onSessionPartInactivity,this._inactivityTimeoutSeconds*1e3)}_clearSessionPartInactivityTimer(){this._sessionPartInactivityTimer!==null&&(clearTimeout(this._sessionPartInactivityTimer),this._sessionPartInactivityTimer=null)}_addListener(e,t){return e.push(t),()=>{let n=e.indexOf(t);n!==-1&&e.splice(n,1)}}_fireListeners(e,t){for(let n of e)try{n()}catch(e){this._diag.warn(`Error while executing session part ${t} listener`,e)}}_storeState(){if(!this._state)return!1;let e=this._storage.setItem(qf,JSON.stringify(this._state));return e&&(this._hasStoredState=!0),e}_removeFromPermanentProperties(e){if(!(e in this._permanentProperties))return;let t=U({},this._permanentProperties);delete t[e],this._permanentProperties=t,dp(this._storage,t)}_removeFromUserSessionProperties(e){if(!this._state||!(e in this._state.userSessionProperties))return;let t=U({},this._state.userSessionProperties);delete t[e],this._state=U(U({},this._state),{},{userSessionProperties:t}),this._storeState()}};N(yp,`_testInstances`,new Set),P();var bp=class{constructor({urlDocument:e=window.document}={}){N(this,`_urlDocument`,void 0),this._urlDocument=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){e.attributes[`browser.url.full`]||e.setAttribute(ar,this._urlDocument.URL)}shutdown(){return Promise.resolve(void 0)}};P();var xp=class{constructor({urlDocument:e=window.document}={}){N(this,`_urlDocument`,void 0),this._urlDocument=e}forceFlush(){return Promise.resolve(void 0)}onEnd(e){e.attributes[`browser.url.full`]||(e.attributes[ar]=this._urlDocument.URL)}onStart(){}shutdown(){return Promise.resolve(void 0)}};P();var Sp=class{constructor({attributeScrubbers:e}){N(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)}};P();var Cp=class{constructor({urlDocument:e=window.document}={}){N(this,`_urlDocument`,void 0),this._urlDocument=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){e.attributes[`mxl.type`]||e.setAttribute(F,`sys.log`),e.setAttribute(Kd,this._urlDocument.URL)}shutdown(){return Promise.resolve(void 0)}};let wp=e=>{if((e.attributes[`http.request.method`]||e.attributes[`http.method`])&&(typeof e.attributes[`http.response.status_code`]==`number`||typeof e.attributes[`http.status_code`]==`number`)){var t;let n=(t=e.attributes[`url.full`])==null?e.attributes[Wd]:t;return typeof n==`string`&&n.includes(`://`)}return!1};var Tp=class{forceFlush(){return Promise.resolve(void 0)}onEnd(e){Jo(e.spanContext().traceId),wp(e)&&(e.attributes[F]=`perf.network_request`,e.attributes[`url.full`]===void 0&&(e.attributes[Kd]=e.attributes[Wd]),e.attributes[`http.response.status_code`]===void 0&&(e.attributes[Gd]=e.attributes[`http.status_code`]),e.attributes[`http.request.method`]===void 0&&(e.attributes[`http.request.method`]=e.attributes[`http.method`]),e.attributes[`http.response.body.size`]===void 0&&(e.attributes[Jd]=e.attributes[`http.response_content_length`]),e.attributes[`http.request.body.size`]===void 0&&(e.attributes[`http.request.body.size`]=e.attributes[`http.request_content_length`]))}onStart(){}shutdown(){return Promise.resolve(void 0)}};M(),B(),P();let Ep=e=>e.attributes[F]===`ux.session_part`,Dp=(e,t)=>`mxl.${t===`current`?`export_failed`:`previous_export_failed`}.${e}`;var Op=class{constructor({exporter:e,limitManager:t,userSessionManager:n,emptySessionAvoidanceEnabled:r=!1,diag:i=k.createComponentLogger({namespace:`MXLSessionPartBatchedSpanProcessor`})}){N(this,`_shutdownOnce`,void 0),N(this,`_pendingSpans`,[]),N(this,`_exporter`,void 0),N(this,`_limitManager`,void 0),N(this,`_userSessionManager`,void 0),N(this,`_emptySessionAvoidanceEnabled`,void 0),N(this,`_diag`,void 0),N(this,`_shutdown`,()=>this._exporter.shutdown()),this._diag=i,this._exporter=e,this._shutdownOnce=new Na(this._shutdown,this),this._limitManager=t,this._userSessionManager=n,this._emptySessionAvoidanceEnabled=r}forceFlush(){return this._diag.debug(`forceFlush called for MXLSessionPartBatchedSpanProcessor. 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(Ep(e))this._diag.debug(`session part span ended. Exporting all pending spans.`),this._exportSpans([e,...this._pendingSpans]),this._pendingSpans=[];else{if(this._diag.debug(`non-session-part span ended. Adding to pending spans queue.`),this._limitManager.dropReadableSpan(e))return;this._pendingSpans.push(e)}}_isEmptySessionExport(e){return e.length===1&&Ep(e[0])}_exportSpans(e){if(this._emptySessionAvoidanceEnabled&&this._isEmptySessionExport(e)){this._diag.debug(`Skipping export of empty session part`);return}La._export(this._exporter,e).then(e=>{if(e.code===z.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._userSessionManager.incrSessionPartCountForKey(Dp(r,`current`)),this._userSessionManager.incrNextSessionPartCountForKey(Dp(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._userSessionManager.incrSessionPartCountForKey(Dp(`unknown`,`current`)),this._userSessionManager.incrNextSessionPartCountForKey(Dp(`unknown`,`previous`)),this._diag.error(`spans failed to export: ${t}`)})}onStart(){}getPendingSpansCount(){return this._pendingSpans.length}shutdown(){return this._shutdownOnce.call()}};P();var kp=class{constructor({pageManager:e}){N(this,`_pageManager`,void 0),this._pageManager=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){if(!e.attributes[`app.surface.name`]||!e.attributes[`app.surface.id`]){let t=this._pageManager.getCurrentRoute();t&&(e.setAttribute(or,t.path),e.setAttribute(sr,this._pageManager.getCurrentPageId()))}let t=this._pageManager.getPageLabel();t&&!e.attributes[`app.surface.label`]&&e.setAttribute(cr,t)}shutdown(){return Promise.resolve(void 0)}};P();var Ap=class{constructor({pageManager:e}){N(this,`_pageManager`,void 0),this._pageManager=e}forceFlush(){return Promise.resolve(void 0)}onEnd(e){if(!e.attributes[`app.surface.name`]||!e.attributes[`app.surface.id`]){let t=this._pageManager.getCurrentRoute(),n=this._pageManager.getCurrentPageId();t&&n&&(e.attributes[or]=t.path,e.attributes[sr]=n)}let t=this._pageManager.getPageLabel();t&&!e.attributes[`app.surface.label`]&&(e.attributes[cr]=t)}onStart(){}shutdown(){return Promise.resolve(void 0)}};P();var jp=class{constructor({attributeScrubbers:e}){N(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)}};P();var Mp=class{constructor({userManager:e}){N(this,`_userManager`,void 0),this._userManager=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){this._userManager.getUserId()&&e.setAttributes({[Zd]:this._userManager.getUserId()})}shutdown(){return Promise.resolve(void 0)}};P();var Np=class{constructor({userSessionManager:e}){N(this,`_userSessionManager`,void 0),this._userSessionManager=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){var t,n,r;let i=(t=this._userSessionManager.getUserSessionId())==null?``:t,a=(n=this._userSessionManager.getPreviousUserSessionId())==null?``:n;e.setAttributes({"log.record.uid":ef(),[Yd]:i,[Xd]:a,[ur]:i,[dr]:a,[lr]:(r=this._userSessionManager.getSessionPartId())==null?``:r})}shutdown(){return Promise.resolve(void 0)}};P();var Pp=class{constructor({userManager:e}){N(this,`_userManager`,void 0),this._userManager=e}forceFlush(){return Promise.resolve(void 0)}onEnd(e){let t=this._userManager.getUserId();t&&(e.attributes[Zd]=t)}onStart(){}shutdown(){return Promise.resolve(void 0)}};M(),B();var Fp=class extends $i{inject(e,t,n){super.inject(e,t,n);let r=j.getSpan(e);if(r){let e=t instanceof Headers?t.get(`traceparent`):Ie.get(t,`traceparent`);e&&r.setAttribute(`mxl.w3c_traceparent`,e)}}};M(),P();var Ip=class{constructor({namespace:e,storage:t,diag:n}){N(this,`_diag`,void 0),N(this,`_keyPrefix`,void 0),N(this,`_storage`,void 0),N(this,`_writeDisabled`,!1),this._diag=n==null?k.createComponentLogger({namespace:`NamespacedStorage`}):n,this._keyPrefix=e?`${e}__`:``,this._storage=t}keys(){let e;try{({length:e}=this._storage)}catch(e){return this._diag.warn(`failed to read storage length`,String(e)),[]}let t=[];for(let n=0;n<e;n++)try{let e=this._storage.key(n);if(e===null)continue;this._keyPrefix?e.startsWith(this._keyPrefix)&&t.push(e.substring(this._keyPrefix.length)):t.push(e)}catch(e){this._diag.warn(`failed to read storage key at index ${n.toString()}`,String(e))}return t}get length(){return this.keys().length}clear(){let e=!0;for(let t of this.keys())this._safeRemove(this._keyName(t))||(e=!1);return e}getItem(e){try{return this._storage.getItem(this._keyName(e))}catch(t){return this._diag.warn(`failed to read ${e}`,String(t)),null}}key(e){var t;return(t=this.keys()[e])==null?null:t}removeItem(e){return this._safeRemove(this._keyName(e))}setItem(e,t){if(this._writeDisabled)return!1;try{return this._storage.setItem(this._keyName(e),t),!0}catch(e){return this._disableWrites(e),!1}}getStorageEventKey(e){return this._keyName(e)}_keyName(e){return`${this._keyPrefix}${e}`}_safeRemove(e){try{return this._storage.removeItem(e),!0}catch(t){return this._diag.warn(`failed to remove ${e}`,String(t)),!1}}_disableWrites(e){if(this._writeDisabled)return;this._writeDisabled=!0;let t=e instanceof Error?e.name:`UnknownError`;this._diag.error(`writes disabled after failure; continuing in-memory only`,t)}};let Lp=({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},Rp=/\/\/(.+):(.+)@(.+)\//,zp=[`AWSAccessKeyId`,`Signature`,`sig`,"`X-Goog-Signature",`password`,`auth`,`pw`,`token`],Bp=({value:e,queryParamRegex:t,scrubPath:n,scrubQuery:r})=>{let i=e;return n&&(i=i.replace(Rp,`//REDACTED:REDACTED@$3/`)),r&&(i=i.replaceAll(t,`$1$2=REDACTED`)),i},Vp=e=>{let t=[...zp,...e||[]],n=RegExp(`(^|&|\\?)(${t.join(`|`)})=[^&]+`,`g`);return[{key:Kd,scrub:e=>Bp({queryParamRegex:n,scrubPath:!0,scrubQuery:!0,value:e})},{key:Wd,scrub:e=>Bp({queryParamRegex:n,scrubPath:!0,scrubQuery:!0,value:e})},{key:`url.path`,scrub:e=>Bp({queryParamRegex:n,scrubPath:!0,scrubQuery:!1,value:e})},{key:`url.query`,scrub:e=>Bp({queryParamRegex:n,scrubPath:!1,scrubQuery:!0,value:e})}]};var Hp,Up=n((()=>{Hp=`http.request.body.size`}));function Wp(...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}=Gp(t.body);return t.body=e,n}else return Promise.resolve(qp(t.body))}else{let t=e[0];return t!=null&&t.body?t.clone().text().then(e=>Jp(e)):Promise.resolve()}}function Gp(e){if(!e.pipeThrough)return $p.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 K(function*(){let r=yield e;t+=r.byteLength,n.enqueue(e)})()},flush(){n(t)}});return{body:e.pipeThrough(i),length:r}}function Kp(e){return typeof Document<`u`&&e instanceof Document}function qp(e){if(Kp(e))return new XMLSerializer().serializeToString(document).length;if(typeof e==`string`)return Jp(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return Yp(e);if(e instanceof URLSearchParams)return Jp(e.toString());if(e.byteLength!==void 0)return e.byteLength;$p.warn(`unknown body type`)}function Jp(e){return em.encode(e).byteLength}function Yp(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 Xp(e){let t=Zp(),n=e.toUpperCase();return n in t?n:`_OTHER`}function Zp(){return nm===void 0&&(nm=tm),nm}function Qp(e){let t=Number(e.port||rm[e.protocol]);if(t&&!isNaN(t))return t}var $p,em,tm,nm,rm,im=n((()=>{M(),B(),q(),$p=k.createComponentLogger({namespace:`@opentelemetry/opentelemetry-instrumentation-fetch/utils`}),em=new TextEncoder,tm={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},rm={"https:":`443`,"http:":`80`}})),am,om=n((()=>{am=`0.221.0`})),sm,cm,lm,um=n((()=>{M(),B(),Up(),L(),im(),om(),P(),sm=300,cm=typeof PerformanceObserver<`u`,lm=class extends Ts{constructor(e={}){super(`@opentelemetry/instrumentation-fetch`,am,e),N(this,`component`,`fetch`),N(this,`version`,am),N(this,`moduleName`,this.component),N(this,`_usedResources`,new WeakSet),N(this,`_tasksCount`,0)}init(){}_addChildSpan(e,t){let n=this.tracer.startSpan(`CORS Preflight`,{startTime:t[X.FETCH_START]},j.setSpan(O.active(),e));xu(n,t,this.getConfig().ignoreNetworkEvents,void 0,!0),n.end(t[X.RESPONSE_END])}_addFinalSpanAttributes(e,t){let n=Du(t.url);e.setAttribute(ei,t.status),e.setAttribute(ti,n.hostname);let r=Qp(n);r&&e.setAttribute(ni,r)}_addHeaders(e,t){if(!Ou(t,this.getConfig().propagateTraceHeaderCorsUrls)){let e={};A.inject(O.active(),e),Object.keys(e).length>0&&this._diag.debug(`headers inject skipped due to CORS policy`);return}if(e instanceof Request)A.inject(O.active(),e.headers,{set:(e,t,n)=>e.set(t,typeof n==`string`?n:String(n))});else{let t=new Headers(e.headers);A.inject(O.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(ka(e,this.getConfig().ignoreUrls)){this._diag.debug(`ignoring span as url matches ignored url`);return}let n={},r=t.method,i=Xp(t.method||`GET`),a=i;return n[Qr]=i,i!==r&&(n[$r]=r),n[ci]=e,this.tracer.startSpan(a,{kind:Dt.CLIENT,attributes:n})}_findResourceAndAddNetworkEvents(e,t,n){let r=t.entries;if(!r.length){if(!performance.getEntriesByType)return;r=performance.getEntriesByType(`resource`)}let i=wu(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)),xu(e,t,this.getConfig().ignoreNetworkEvents,void 0,!0)}}_markResourceAsUsed(e){this._usedResources.add(e)}_endSpan(e,t,n){let r=_i(Date.now()),i=vi();this._addFinalSpanAttributes(e,n),n.status>=400&&(e.setStatus({code:kt.ERROR}),e.setAttribute(Jr,String(n.status))),setTimeout(()=>{var n;(n=t.observer)==null||n.disconnect(),this._findResourceAndAddNetworkEvents(e,t,i),this._tasksCount--,this._clearResources(),e.end(r)},sm)}_patchConstructor(){return e=>{let t=this;return function(...n){if(!t._isEnabled)return e.apply(this,n);let r=this,i=Du(n[0]instanceof Request?n[0].url:String(n[0])).href,a;a=n[0]instanceof Request?n[1]==null?n[0]:new Request(n[0],n[1]):n[1]||{};let o=t._createSpan(i,a);if(!o)return e.apply(this,n);let s=t._prepareSpanData(i);t.getConfig().measureRequestSize&&Wp(...n).then(e=>{e&&o.setAttribute(Hp,e)}).catch(e=>{t._diag.warn(`getFetchBodyLength`,e)});function c(e,n){t._applyAttributesAfterFetch(e,a,n),t._endSpan(e,s,{status:n.status||0,statusText:n.message,url:i})}function l(e,n){t._applyAttributesAfterFetch(e,a,n),n.status>=200&&n.status<400?t._endSpan(e,s,n):t._endSpan(e,s,{status:n.status,statusText:n.statusText,url:i})}function u(e,n){try{let t=n.clone().body;if(t){let r=t.getReader(),i=()=>{r.read().then(({done:t})=>{t?l(e,n):i()},t=>{c(e,t)})};i()}else l(e,n)}catch(n){t._diag.error(`Failed to read fetch response body`,n),t._endSpan(e,s,{status:0,url:i})}return n}function d(e,n){try{c(e,n)}catch(r){t._diag.error(`Failed to end span on fetch error`,r),t._endSpan(e,s,{status:n.status||0,url:i})}throw n}return O.with(j.setSpan(O.active(),o),()=>(t._callRequestHook(o,a),t._addHeaders(a,i),t._tasksCount++,e.apply(r,a instanceof Request?[a]:[i,a]).then(u.bind(r,o),d.bind(r,o))))}}}_applyAttributesAfterFetch(e,t,n){let r=this.getConfig().applyCustomAttributesOnSpan;r&&Os(()=>r(e,t,n),e=>{e&&this._diag.error(`applyCustomAttributesOnSpan`,e)},!0)}_callRequestHook(e,t){let n=this.getConfig().requestHook;n&&Os(()=>n(e,t),e=>{e&&this._diag.error(`requestHook`,e)},!0)}_prepareSpanData(e){let t=vi(),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(!cm){this._diag.warn(`this instrumentation is intended for web usage only, it does not instrument server-side fetch()`);return}if(!this._isEnabled){if(this._isFetchPatched){this._diag.debug(`fetch constructor already patched`),this._isEnabled=!0;return}try{this._wrap(globalThis,`fetch`,this._patchConstructor()),this._isFetchPatched=!0,this._isEnabled=!0}catch(e){this._diag.warn(`Failed to patch globalThis.fetch; instrumentation will not be enabled. Another script may have locked globalThis.fetch via Object.defineProperty.`,e)}}}disable(){cm&&this._isEnabled&&(this._isEnabled=!1,this._usedResources=new WeakSet)}}})),dm=r({FetchInstrumentation:()=>lm}),fm=n((()=>{um()})),pm,mm=n((()=>{pm=`http.request.body.size`})),hm,gm=n((()=>{(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`})(hm||(hm={}))}));function _m(e){return typeof Document<`u`&&e instanceof Document}function vm(e){if(_m(e))return new XMLSerializer().serializeToString(document).length;if(typeof e==`string`)return ym(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return bm(e);if(e instanceof URLSearchParams)return ym(e.toString());if(e.byteLength!==void 0)return e.byteLength;wm.warn(`unknown body type`)}function ym(e){return Tm.encode(e).byteLength}function bm(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 xm(e){let t=Sm(),n=e.toUpperCase();return n in t?n:`_OTHER`}function Sm(){return Dm===void 0&&(Dm=Em),Dm}function Cm(e){let t=Number(e.port||Om[e.protocol]);if(t&&!isNaN(t))return t}var wm,Tm,Em,Dm,Om,km=n((()=>{M(),B(),wm=k.createComponentLogger({namespace:`@opentelemetry/opentelemetry-instrumentation-xml-http-request/utils`}),Tm=new TextEncoder,Em={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},Om={"https:":`443`,"http:":`80`}})),Am,jm=n((()=>{Am=`0.221.0`})),Mm,Nm,Pm=n((()=>{M(),As(),B(),ju(),L(),mm(),gm(),km(),jm(),P(),Mm=300,Nm=class extends Ts{constructor(e={}){super(`@opentelemetry/instrumentation-xml-http-request`,Am,e),N(this,`component`,`xml-http-request`),N(this,`version`,Am),N(this,`moduleName`,this.component),N(this,`_tasksCount`,0),N(this,`_xhrMem`,new WeakMap),N(this,`_usedResources`,new WeakSet)}init(){}_addHeaders(e,t){let n=Du(t).href;if(!Ou(n,this.getConfig().propagateTraceHeaderCorsUrls)){let e={};A.inject(O.active(),e),Object.keys(e).length>0&&this._diag.debug(`headers inject skipped due to CORS policy`);return}let r={};A.inject(O.active(),r),Object.keys(r).forEach(t=>{e.setRequestHeader(t,String(r[t]))})}_addChildSpan(e,t){O.with(j.setSpan(O.active(),e),()=>{let e=this.tracer.startSpan(`CORS Preflight`,{startTime:t[X.FETCH_START]});xu(e,t,this.getConfig().ignoreNetworkEvents,void 0,!0),e.end(t[X.RESPONSE_END])})}_addFinalSpanAttributes(e,t){t.status&&e.setAttribute(ei,t.status)}_applyAttributesAfterXHR(e,t){let n=this.getConfig().applyCustomAttributesOnSpan;typeof n==`function`&&Os(()=>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=Du(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&&(R.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=R.getEntriesByType(`resource`));let o=wu(Du(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)),xu(t,e,this.getConfig().ignoreNetworkEvents,void 0,!0)}}_cleanPreviousSpanInformation(e){let t=this._xhrMem.get(e);if(t){let n=t.callbackToRemoveEvents;n&&n(),this._xhrMem.delete(e)}}_createSpan(e,t,n){let r=Du(t);if(ka(r.href,this.getConfig().ignoreUrls)){this._diag.debug(`ignoring span as url matches ignored url`);return}let i={},a=n,o=xm(n),s=o;i[Qr]=o,o!==a&&(i[$r]=a),i[ci]=r.toString(),i[ti]=r.hostname;let c=Cm(r);c&&(i[ni]=c);let l=this.tracer.startSpan(s,{kind:Dt.CLIENT,attributes:i});return l.addEvent(hm.METHOD_OPEN),this._cleanPreviousSpanInformation(e),this._xhrMem.set(e,{span:l,spanUrl:t}),l}_markResourceAsUsed(e){this._usedResources.add(e)}_patchOpen(){return e=>{let t=this;return function(...n){if(!t._isEnabled)return e.apply(this,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),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),i?a&&(t.setStatus({code:kt.ERROR,message:a}),t.setAttribute(Jr,a)):o.status&&o.status>=400&&(t.setStatus({code:kt.ERROR}),t.setAttribute(Jr,String(o.status)))}let s=vi(),c=Date.now();setTimeout(()=>{t(n,o,s,c)},Mm)}function r(){n(hm.EVENT_ERROR,this,!0,`error`)}function i(){n(hm.EVENT_ABORT,this,!1)}function a(){n(hm.EVENT_TIMEOUT,this,!0,`timeout`)}function o(){this.status<299?n(hm.EVENT_LOAD,this,!1):n(hm.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){if(!e._isEnabled)return t.apply(this,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 e=n[0],t=vm(e);t!==void 0&&l.setAttribute(pm,t)}O.with(j.setSpan(O.active(),l),()=>{e._tasksCount++,c.sendStartTime=vi(),l.addEvent(hm.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(){if(!this._isEnabled){if(this._isXhrPatched){this._diag.debug(`reactivating existing patch on`,this.moduleName,this.version),this._isEnabled=!0;return}try{this._diag.debug(`applying patch to`,this.moduleName,this.version),this._wrap(XMLHttpRequest.prototype,`open`,this._patchOpen()),this._wrap(XMLHttpRequest.prototype,`send`,this._patchSend()),this._isXhrPatched=!0,this._isEnabled=!0}catch(e){this._unwrap(XMLHttpRequest.prototype,`open`),this._unwrap(XMLHttpRequest.prototype,`send`),this._diag.warn(`Failed to patch globalThis.XMLHttpRequest; instrumentation will not be enabled. Another script may have locked globalThis.XMLHttpRequest via Object.defineProperty.`,e)}}}disable(){this._isEnabled&&(this._isEnabled=!1,this._tasksCount=0,this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}}})),Fm=r({XMLHttpRequestInstrumentation:()=>Nm}),Im=n((()=>{Pm()}));W(),q();let Lm=function(){var e=K(function*(e={}){var t,n;let r=[];if(!((t=e.omit)!=null&&t.has(`@opentelemetry/instrumentation-fetch`))){var i,a,o,s;let{FetchInstrumentation:t}=yield Promise.resolve().then(()=>(fm(),dm));r.push(new t(U(U({},e[`@opentelemetry/instrumentation-fetch`]),{},{ignoreUrls:[...(i=(a=e.network)==null?void 0:a.ignoreUrls)==null?[]:i,...(o=(s=e[`@opentelemetry/instrumentation-fetch`])==null?void 0:s.ignoreUrls)==null?[]:o]})))}if(!((n=e.omit)!=null&&n.has(`@opentelemetry/instrumentation-xml-http-request`))){var c,l,u,d;let{XMLHttpRequestInstrumentation:t}=yield Promise.resolve().then(()=>(Im(),Fm));r.push(new t(U(U({},e[`@opentelemetry/instrumentation-xml-http-request`]),{},{ignoreUrls:[...(c=(l=e.network)==null?void 0:l.ignoreUrls)==null?[]:c,...(u=(d=e[`@opentelemetry/instrumentation-xml-http-request`])==null?void 0:d.ignoreUrls)==null?[]:u]})))}return r});return function(){return e.apply(this,arguments)}}(),Rm={isRecording:()=>!1,setEnabled:()=>{}};M(),P();let zm=new class{constructor({diagLogger:e=k.createComponentLogger({namespace:`mxl-registry`})}={}){N(this,`_sdk`,null),N(this,`_diag`,void 0),N(this,`register`,e=>{this._sdk!==null&&this._diag.warn(`previously registered sdk will be overwritten`),this._sdk=e}),N(this,`clear`,()=>{this._sdk===null&&this._diag.warn(`sdk already cleared, this is a no-op`),this._sdk=null}),N(this,`registered`,()=>this._sdk),this._diag=e}},Bm=(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}>`};P();var Vm=class extends G{constructor({diag:e,perf:t,shouldTrack:n,innerTextForElement:r}={}){super({config:{},diag:e,instrumentationName:`ClicksInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),N(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.userSessionManager.getSessionPartSpan();n&&n.addEvent(`click`,{"mxl.type":`ux.tap`,"tap.coords":`${e.x.toString()},${e.y.toString()}`,"view.name":Bm(t,r?r(t):t.textContent)},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)}};ju();let Hm=()=>{let e={},t=window.performance.getEntriesByType(`navigation`)[0];return Object.values(X).forEach(n=>{if(bu(t,n)){let r=t[n];typeof r==`number`&&(e[n]=r)}}),e},Um={"first-contentful-paint":`firstContentfulPaint`,"first-paint":`firstPaint`},Wm=e=>{window.performance.getEntriesByType(`paint`).forEach(({name:t,startTime:n})=>{bu(Um,t)&&e.addEvent(Um[t],n)})};M(),B(),As(),ju(),P();var Gm=class extends G{constructor({diag:e,perf:t,enabled:n,applyCustomAttributesOnSpan:r,ignorePerformancePaintEvents:i=!1,ignoreNetworkEvents:a=!1}={}){super({config:{applyCustomAttributesOnSpan:r,enabled:n,ignoreNetworkEvents:a,ignorePerformancePaintEvents:i},diag:e,instrumentationName:`DocumentLoadInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),N(this,`_onDocumentLoaded`,void 0),N(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=[...document.getElementsByTagName(`meta`)].find(e=>e.getAttribute(`name`)===Yi),t=Hm(),n=(e==null?void 0:e.content)||``;O.with(A.extract(w,{traceparent:n}),()=>{var e;let n=this._startSpan(`documentLoad`,X.FETCH_START,t);n&&(O.with(j.setSpan(O.active(),n),()=>{let e=this._startSpan(`documentFetch`,X.FETCH_START,t);e&&(e.setAttribute(Kd,location.href),O.with(j.setSpan(O.active(),e),()=>{var n;xu(e,t,this.getConfig().ignoreNetworkEvents),this._addCustomAttributesOnSpan(e,(n=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:n.documentFetch),this._endSpan(e,X.RESPONSE_END,t)}))}),n.setAttribute(F,`ux.document_load`),n.setAttribute(Kd,location.href),n.setAttribute(qd,navigator.userAgent),this._addResourcesSpans(n),this.getConfig().ignoreNetworkEvents||(Z(n,X.FETCH_START,t),Z(n,X.UNLOAD_EVENT_START,t),Z(n,X.UNLOAD_EVENT_END,t),Z(n,X.DOM_INTERACTIVE,t),Z(n,X.DOM_CONTENT_LOADED_EVENT_START,t),Z(n,X.DOM_CONTENT_LOADED_EVENT_END,t),Z(n,X.DOM_COMPLETE,t),Z(n,X.LOAD_EVENT_START,t),Z(n,X.LOAD_EVENT_END,t)),this.getConfig().ignorePerformancePaintEvents||Wm(n),this._addCustomAttributesOnSpan(n,(e=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:e.documentLoad),this._endSpan(n,X.LOAD_EVENT_END,t))})}_endSpan(e,t,n){e&&(bu(n,t)&&typeof n[t]==`number`?e.end(n[t]):e.end())}_initResourceSpan(e,t){var n;let r=this._startSpan(`resourceFetch`,X.FETCH_START,e,t);r&&(r.setAttribute(F,`ux.resource_fetch`),r.setAttribute(Kd,e.name),xu(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(Gd,e.responseStatus),typeof e.encodedBodySize==`number`&&e.encodedBodySize>=0&&r.setAttribute(Jd,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,X.RESPONSE_END,e))}_startSpan(e,t,n,r){if(bu(n,t)&&typeof n[t]==`number`)return this.tracer.startSpan(e,{startTime:n[t]},r?j.setSpan(O.active(),r):void 0)}_waitForPageLoad(){window.document.readyState===`complete`?this._onDocumentLoaded():window.addEventListener(`load`,this._onDocumentLoaded)}_addCustomAttributesOnSpan(e,t){t&&Os(()=>{t(e)},e=>{e&&this._diag.error(`addCustomAttributesOnSpan`,e)},!0)}_addCustomAttributesOnResourceSpan(e,t,n){n&&Os(()=>{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)}};W();let Km=[`diag`];function qm(e){var t,n;return typeof PerformanceObserver<`u`&&((t=(n=PerformanceObserver.supportedEntryTypes)==null?void 0:n.includes(e))==null?!1:t)}function Jm(e,t,n){let r=n==null?{}:n,{diag:i}=r,a=ns(r,Km);if(!qm(e))return i==null||i.debug(`${e} not supported, skipping observer`),null;try{let n=new PerformanceObserver(n=>{for(let r of n.getEntries())try{t(r)}catch(t){i==null||i.error(`error processing ${e} entry`,t)}});return n.observe(U({buffered:!0,type:e},a)),n}catch(e){return null}}P();var Ym=class extends G{constructor({diag:e,perf:t,limitManager:n}={}){super({config:{},diag:e,instrumentationName:`ElementTimingInstrumentation`,instrumentationVersion:`1.0.0`,limitManager:n,perf:t}),N(this,`_observer`,null),N(this,`_isEnabled`,!1),this._config.enabled&&this.enable()}enable(){if(!this._isEnabled){if(!qm(`element`)){this._diag.debug(`element not supported, skipping`);return}if(this._isEnabled=!0,this._observer&&this._observer.disconnect(),this._observer=Jm(`element`,e=>this._processEntry(e),{diag:this._diag}),!this._observer){this._isEnabled=!1,this._diag.error(`failed to enable`);return}}}disable(){this._isEnabled=!1,this._observer&&(this._observer.disconnect(),this._observer=null)}_processEntry(e){var t,n;if(!this._isEnabled||(t=this.limitManager)!=null&&t.limitElementTimingEntry())return;let r=this.tracer.startSpan(e.identifier,{attributes:{[F]:`ux.element_timing`,"mxl.element_timing.identifier":e.identifier,"mxl.element_timing.element":(n=e.element)==null||(n=n.tagName)==null?void 0:n.toLowerCase(),"mxl.element_timing.render_time":e.renderTime,"mxl.element_timing.load_time":e.loadTime,"mxl.element_timing.start_time":e.startTime,"mxl.element_timing.url":e.url,"mxl.element_timing.natural_width":e.naturalWidth,"mxl.element_timing.natural_height":e.naturalHeight},startTime:this.perf.epochMillisFromOriginOffset(0)});e.loadTime>0&&r.addEvent(`load`,this.perf.epochMillisFromOriginOffset(e.loadTime)),r.end(this.perf.epochMillisFromOriginOffset(e.startTime))}};P();var Xm=class extends G{constructor({diag:e,perf:t,rootNode:n,emptyCheckDelayMs:r=500}){super({config:{},diag:e,instrumentationName:`EmptyRootInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),N(this,`_observer`,void 0),N(this,`_emptyCheckDelayMs`,void 0),N(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.userSessionManager.getSessionPartSpan();e?e.addEvent(`empty-root-node`,{"mxl.type":`ux.empty_root_node`}):this._diag.debug(`no active session found to emit event on`)}}};P();var Zm=class extends G{constructor({diag:e,perf:t}={}){super({config:{},diag:e,instrumentationName:`GlobalExceptionInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),N(this,`_onErrorHandler`,void 0),N(this,`_onUnhandledRejectionHandler`,void 0),this._onErrorHandler=e=>{this.logManager.logException(e.error||e.message,{handled:!1,handler:`global_exception`,timestamp:this.perf.epochMillisFromOriginOffset(e.timeStamp)})},this._onUnhandledRejectionHandler=e=>{this.logManager.logException(e.reason,{handled:!1,handler:`promise_rejection`,timestamp:this.perf.epochMillisFromOriginOffset(e.timeStamp)})},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 Qm=()=>`mxlv2-${Date.now()}-${Math.floor(Math.random()*8999999999999)+0xe8d4a51000}`;H(),P();var $m=class extends G{constructor({diag:e,perf:t}={}){super({config:{},diag:e,instrumentationName:`LoafInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),N(this,`_observer`,null),N(this,`_isFirstEntry`,!0),N(this,`_removeSessionEndListener`,null),N(this,`_isEnabled`,!1),N(this,`_totalDuration`,0),N(this,`_workDuration`,0),N(this,`_styleLayoutDuration`,0),N(this,`_count`,0),N(this,`_longestDuration`,0),N(this,`_longestDurationExcludingFirst`,0),N(this,`_totalBlockingDuration`,0),N(this,`_scriptSummaries`,new Map),this._config.enabled&&this.enable()}enable(){if(!this._isEnabled){if(!qm(`long-animation-frame`)){this._diag.debug(`long-animation-frame not supported, skipping`);return}if(this._isEnabled=!0,this._observer&&this._observer.disconnect(),this._observer=Jm(`long-animation-frame`,e=>this._processEntry(e),{diag:this._diag}),!this._observer){this._isEnabled=!1,this._diag.error(`failed to enable`);return}this._registerSessionEndListener()}}_registerSessionEndListener(){this._isEnabled&&(this._removeSessionEndListener&&this._removeSessionEndListener(),this._removeSessionEndListener=this.userSessionManager.addSessionPartEndedListener(()=>{try{this._flushReport()}catch(e){this._diag.error(`error flushing report`,e)}}))}setUserSessionManager(e){super.setUserSessionManager(e),this._registerSessionEndListener()}disable(){this._isEnabled=!1,this._resetAccumulators(),this._observer&&(this._observer.disconnect(),this._observer=null),this._removeSessionEndListener&&(this._removeSessionEndListener(),this._removeSessionEndListener=null)}_processEntry(e){if(this._isEnabled){this._count++,this._totalDuration+=e.duration,this._workDuration+=e.renderStart?e.renderStart-e.startTime:e.duration,e.styleAndLayoutStart&&(this._styleLayoutDuration+=Math.max(0,e.startTime+e.duration-e.styleAndLayoutStart)),this._longestDuration=Math.max(this._longestDuration,e.duration),this._isFirstEntry&&this._count===1?this._isFirstEntry=!1:(this._longestDurationExcludingFirst=Math.max(this._longestDurationExcludingFirst,e.duration),e.firstUIEventTimestamp===0&&(this._totalBlockingDuration+=e.blockingDuration));try{for(let t of e.scripts){let e=t.sourceURL||`(inline)`;e.length>2048&&(e=`${e.substring(0,2048)}...`);let n=this._scriptSummaries.get(e);n?(n.totalDuration+=t.duration,n.styleAndLayoutDuration+=t.forcedStyleAndLayoutDuration,n.count++):this._scriptSummaries.set(e,{count:1,styleAndLayoutDuration:t.forcedStyleAndLayoutDuration,totalDuration:t.duration})}}catch(e){this._diag.error(`error processing scripts for entry`,e)}}}_flushReport(){if(this._count===0)return;let e;e=this._totalBlockingDuration<=200?`good`:this._totalBlockingDuration<=600?`needs-improvement`:`poor`;let t={[F]:`ux.web_vital`,"mxl.web_vital.id":Qm(),"mxl.web_vital.name":`TBD`,"mxl.web_vital.value":Math.round(this._totalBlockingDuration),"mxl.web_vital.rating":e,"mxl.tbd.loaf_total_duration":Math.round(this._totalDuration),"mxl.tbd.loaf_work_duration":Math.round(this._workDuration),"mxl.tbd.loaf_style_and_layout_duration":Math.round(this._styleLayoutDuration),"mxl.tbd.loaf_count":this._count,"mxl.tbd.loaf_longest_duration":Math.round(this._longestDuration),"mxl.tbd.loaf_longest_duration_excluding_first":Math.round(this._longestDurationExcludingFirst)};try{this.logger.emit({attributes:t,eventName:`mxl-loaf-report`,severityNumber:V.INFO})}catch(e){this._diag.error(`error emitting loaf report`,e)}try{if(this._scriptSummaries.size>0){let e=[...this._scriptSummaries].sort((e,t)=>t[1].totalDuration-e[1].totalDuration).slice(0,250).map(([e,t])=>[e,{count:t.count,style_and_layout_duration:Math.round(t.styleAndLayoutDuration),total_duration:Math.round(t.totalDuration)}]);this.logger.emit({attributes:{[F]:`ux.loaf_scripts`},body:JSON.stringify(Object.fromEntries(e)),eventName:`mxl-loaf-scripts`,severityNumber:V.INFO})}}catch(e){this._diag.error(`error emitting loaf script summary`,e)}this._resetAccumulators()}_resetAccumulators(){this._totalDuration=0,this._workDuration=0,this._styleLayoutDuration=0,this._count=0,this._longestDuration=0,this._longestDurationExcludingFirst=0,this._totalBlockingDuration=0,this._scriptSummaries=new Map}};H(),P();var eh=class extends G{constructor({diag:e,perf:t,limitManager:n}={}){super({config:{},diag:e,instrumentationName:`ServerTimingInstrumentation`,instrumentationVersion:`1.0.0`,limitManager:n,perf:t}),N(this,`_onLoad`,void 0),N(this,`_performanceCollected`,!1),this._onLoad=()=>{this._readServerTiming()},this._config.enabled&&this.enable()}enable(){if(window.removeEventListener(`load`,this._onLoad),window.document.readyState===`complete`){this._readServerTiming();return}window.addEventListener(`load`,this._onLoad)}disable(){window.removeEventListener(`load`,this._onLoad)}_readServerTiming(){var e;if(this._performanceCollected)return;this._performanceCollected=!0;let t=(e=performance.getEntriesByType(`navigation`)[0])==null?void 0:e.serverTiming;if(t!=null&&t.length)for(let e of t){var n;if((n=this.limitManager)!=null&&n.limitServerTimingEntry())return;this.logger.emit({attributes:{[F]:`ux.server_timing`,"mxl.server_timing.name":e.name,"mxl.server_timing.duration":e.duration,"mxl.server_timing.description":e.description},eventName:`mxl-server-timing`,severityNumber:V.INFO})}}};let th=`mxl.user_timing.start_time`,nh=`mxl.user_timing.duration`,rh=`mxl.user_timing.entry_type`;H(),P(),W();var ih=class extends G{constructor({diag:e,perf:t,limitManager:n,allowedEntries:r}={}){super({config:{},diag:e,instrumentationName:`UserTimingInstrumentation`,instrumentationVersion:`1.0.0`,limitManager:n,perf:t}),N(this,`_markObserver`,null),N(this,`_measureObserver`,null),N(this,`_seenEntries`,new Set),N(this,`_isEnabled`,!1),N(this,`_allowedEntries`,void 0),this._allowedEntries=r,this._config.enabled&&this.enable()}enable(){this._isEnabled||(this._isEnabled=!0,this._seenEntries=new Set,this._markObserver&&this._markObserver.disconnect(),this._measureObserver&&this._measureObserver.disconnect(),this._markObserver=Jm(`mark`,this._processEntry.bind(this),{diag:this._diag}),this._markObserver||this._diag.error(`failed to enable mark observer`),this._measureObserver=Jm(`measure`,e=>this._processEntry(e),{diag:this._diag}),this._measureObserver||this._diag.error(`failed to enable measure observer`),!this._markObserver&&!this._measureObserver&&(this._isEnabled=!1))}disable(){this._isEnabled=!1,this._markObserver&&(this._markObserver.disconnect(),this._markObserver=null),this._measureObserver&&(this._measureObserver.disconnect(),this._measureObserver=null),this._seenEntries=new Set}_processEntry(e){var t;if(!this._isEnabled||this._allowedEntries!==void 0&&!(Array.isArray(this._allowedEntries)?this._allowedEntries.includes(e.name):this._allowedEntries(e)))return;let n=`${location.href}::${e.name}`;if(this._seenEntries.has(n)||(this._seenEntries.add(n),(t=this.limitManager)!=null&&t.limitUserTimingEntry(e.entryType)))return;if(e.entryType===`measure`){let t=e.detail;this.tracer.startSpan(e.name,{attributes:U({[F]:`ux.user_timing`,[rr]:`user_timing`,[rh]:e.entryType,[th]:this.perf.millisFromZeroTime(e.startTime),[nh]:e.duration},t!=null&&{"mxl.user_timing.detail":JSON.stringify(t)}),startTime:this.perf.epochMillisFromOriginOffset(e.startTime)}).end(this.perf.epochMillisFromOriginOffset(e.startTime+e.duration));return}let{detail:r}=e,i=r==null?void 0:JSON.stringify(r);this.logger.emit({attributes:{[F]:`ux.user_timing`,"mxl.user_timing.name":e.name,[th]:this.perf.millisFromZeroTime(e.startTime),[nh]:e.duration,[rh]:e.entryType},body:i,eventName:`mxl-user-timing`,severityNumber:V.INFO,timestamp:this.perf.epochMillisFromOriginOffset(e.startTime)})}};let ah=`mxl.web_vital.attribution.`;P(),W();var oh=class{constructor(){N(this,`t`,void 0),N(this,`o`,0),N(this,`i`,[])}l(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 sh=()=>{let e=performance.getEntriesByType(`navigation`)[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},ch=e=>{if(document.readyState===`loading`)return`loading`;let t=sh();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`},lh=e=>{let t=e.nodeName;return e.nodeType===1?t.toLowerCase():t.toUpperCase().replace(/^#/,``)},uh=e=>{let t=``;try{for(;(e==null?void 0:e.nodeType)!==9;){var n;let r=e,i=r.id?`#`+r.id:[lh(r),...Array.from((n=r.classList)==null?[]:n).sort()].join(`.`);if(t.length+i.length>99)return t||i;if(t=t?i+`>`+t:i,r.id)break;e=r.parentNode}}catch(e){}return t},dh=new WeakMap;function fh(e,t){let n=dh.get(t);return n||(n=new WeakMap,dh.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}let ph=-1,mh=()=>ph,hh=e=>{addEventListener(`pageshow`,t=>{t.persisted&&(ph=t.timeStamp,e(t))},!0)},Q=(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)))}},gh=e=>{requestAnimationFrame(()=>requestAnimationFrame(e))},_h=()=>{var e,t;return(e=(t=sh())==null?void 0:t.activationStart)==null?0:e},vh=-1,yh=new Set,bh=()=>document.visibilityState!==`hidden`||document.prerendering?1/0:0,xh=e=>{if(document.visibilityState===`hidden`){if(e.type===`visibilitychange`)for(let e of yh)e();isFinite(vh)||(vh=e.type===`visibilitychange`?e.timeStamp:0,removeEventListener(`prerenderingchange`,xh,!0))}},Sh=(e=!1)=>{if(e&&(vh=1/0),vh<0){var t;let e=_h(),n=document.prerendering||(t=globalThis.performance.getEntriesByType(`visibility-state`).find(t=>t.name===`hidden`&&t.startTime>=e))==null?void 0:t.startTime;vh=n==null?bh():n,addEventListener(`visibilitychange`,xh,!0),addEventListener(`prerenderingchange`,xh,!0),hh(()=>{setTimeout(()=>{vh=bh()})})}return{get firstHiddenTime(){return vh},onHidden(e){yh.add(e)}}},$=(e,t=-1,n,r=0,i,a,o)=>{let s=sh(),c=(s==null?void 0:s.navigationId)||0,l=`navigate`;return n?l=n:mh()>=0?l=`back-forward-cache`:s&&(document.prerendering||_h()>0?l=`prerender`:document.wasDiscarded?l=`restore`:s.type&&(l=s.type.replace(/_/g,`-`))),{name:e,value:t,rating:`good`,delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+0xe8d4a51000}`,navigationType:l,navigationId:r||c,navigationInteractionId:i,navigationURL:a||(s==null?void 0:s.name),navigationStartTime:o||0}},Ch=(e,t,n={})=>{try{let r=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(r.length>0){let e=new PerformanceObserver(e=>{queueMicrotask(()=>{let n=e.getEntries();r.length>1&&n.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(n)})});for(let t of r)e.observe(U({type:t,buffered:!0},n));return e}}catch(e){}},wh=e=>{var t;return PerformanceObserver.supportedEntryTypes.includes(`soft-navigation`)&&typeof((t=globalThis.PerformanceSoftNavigation)==null||(t=t.prototype)==null?void 0:t.getLargestInteractionContentfulPaint)==`function`&&e&&e.reportSoftNavs},Th=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){let t=e.keys().next().value;t!==void 0&&e.delete(t)}},Eh=e=>{let t=!1;return()=>{t||(e(),t=!0)}};var Dh=class{constructor(){N(this,`u`,void 0)}};let Oh=e=>{document.prerendering?addEventListener(`prerenderingchange`,e,!0):e()},kh=[1800,3e3],Ah=(e,t={})=>{let n=wh(t);Oh(()=>{let r=fh(t,Dh),i=Sh(),a,o=$(`FCP`),s=Ch([`paint`],e=>{for(let t of e)t.name===`first-contentful-paint`&&(s.disconnect(),t.startTime<i.firstHiddenTime&&(o.value=Math.max(t.startTime-_h(),0),o.entries.push(t),o.navigationId=t.navigationId||o.navigationId,a(!0)))});s&&(a=Q(e,o,kh,t.reportAllChanges),hh(n=>{o=$(`FCP`,-1,`back-forward-cache`,o.navigationId,o.navigationInteractionId,o.navigationURL,mh()),a=Q(e,o,kh,t.reportAllChanges),gh(()=>{o.value=performance.now()-n.timeStamp,a(!0)})})),n&&Ch([`soft-navigation`],n=>{n.forEach(n=>{r.u&&n.navigationId&&Th(r.u,n),o=$(`FCP`,Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0),`soft-navigation`,n.navigationId,n.interactionId,n.name,n.startTime),a=Q(e,o,kh,t.reportAllChanges),a(!0)})},t)})},jh=[.1,.25],Mh=e=>e.find(e=>{var t;return((t=e.node)==null?void 0:t.nodeType)===1})||e[0],Nh=(e,t={})=>{let n=fh(t=Object.assign({},t),oh),r=new WeakMap;n.t=e=>{var n;if(!(e==null||(n=e.sources)==null)&&n.length){let n=Mh(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?uh(o):i;r.set(n,e)}}},((e,t={})=>{let n=Sh();Ah(Eh(()=>{let r,i=$(`CLS`,0),a=fh(t,oh),o=(n,o,s,c,l)=>{i=$(`CLS`,0,n,o,s,c,l),a.o=0,r=Q(e,i,jh,t.reportAllChanges)},s=(e=!1)=>{a.o>i.value&&(i.value=a.o,i.entries=a.i),r(e)},c=e=>{s(!0),o(`soft-navigation`,e.navigationId,e.interactionId,e.name,e.startTime)},l=e=>{for(let t of e)t.entryType===`soft-navigation`?c(t):a.l(t);s()},u=[`layout-shift`];wh(t)&&u.push(`soft-navigation`);let d=Ch(u,l);d&&(r=Q(e,i,jh,t.reportAllChanges),n.onHidden(()=>{l(d.takeRecords()),r(!0)}),hh(()=>{o(`back-forward-cache`,i.navigationId,i.navigationInteractionId,i.navigationURL,mh()),gh(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=Mh(i.sources);e&&(t={largestShiftTarget:r.get(e),largestShiftTime:i.startTime,largestShiftValue:i.value,largestShiftSource:e,largestShiftEntry:i,loadState:ch(i.startTime)})}}return Object.assign(e,{attribution:t})})(t))},t)},Ph=(e,t={})=>{let n=fh(t=Object.assign({},t),Dh);wh(t)&&(n.u=new Map),Ah(t=>{e((e=>{let t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:ch(mh())};if(e.navigationType!==`soft-navigation`){if(e.entries.length){let n=sh(),r=e.entries.at(-1);if(n){let i=n.responseStart,a=n.activationStart||0,o=Math.max(0,i-a);t={timeToFirstByte:o,firstByteToFCP:e.value-o,loadState:ch(e.entries[0].startTime),navigationEntry:n,fcpEntry:r}}}}else{var r;let i=(r=n.u)==null?void 0:r.get(e.navigationId);i&&(t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:`complete`,navigationEntry:i})}return Object.assign(e,{attribution:t})})(t))},t)},Fh=0,Ih=1/0,Lh=0,Rh=e=>{for(let t of e)t.interactionId&&(Ih=Math.min(Ih,t.interactionId),Lh=Math.max(Lh,t.interactionId),Fh=Lh?(Lh-Ih)/7+1:0)},zh,Bh=()=>{var e;return zh?Fh:(e=performance.interactionCount)==null?0:e},Vh=()=>{`interactionCount`in performance||zh||(zh=Ch([`event`],Rh,{durationThreshold:0}))},Hh=0;var Uh=class{constructor(){N(this,`h`,[]),N(this,`v`,new Map),N(this,`p`,void 0),N(this,`m`,void 0)}M(){Hh=Bh(),this.h.length=0,this.v.clear()}T(e){let t=Bh()-Hh,n=Math.min(this.h.length-1,Math.floor(t/50));return!t||n!==-1||e!==`soft-navigation`&&e!==`back-forward-cache`?this.h[n]:{D:8,id:-1,entries:[]}}l(e){var t;if((t=this.p)==null||t.call(this,e),!e.interactionId&&e.entryType!==`first-input`)return;let n=this.h.at(-1),r=this.v.get(e.interactionId);if(r||this.h.length<10||e.duration>n.D){var i;if(r?e.duration>r.D?(r.entries=[e],r.D=e.duration):e.duration===r.D&&e.startTime===r.entries[0].startTime&&r.entries.push(e):(r={id:e.interactionId,entries:[e],D:e.duration},this.v.set(r.id,r),this.h.push(r)),this.h.sort((e,t)=>t.D-e.D),this.h.length>10){let e=this.h.splice(10);for(let t of e)this.v.delete(t.id)}(i=this.m)==null||i.call(this,r)}}};let Wh=e=>{let t=`requestIdleCallback`in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,r=globalThis.cancelIdleCallback||clearTimeout;if(document.visibilityState===`hidden`)e();else{let i=Eh(e),a=-1,o=()=>{r(a),i()};addEventListener(`visibilitychange`,o,{once:!0,capture:!0}),a=n(()=>{removeEventListener(`visibilitychange`,o,{capture:!0}),i()},{timeout:t})}},Gh=[200,500],Kh=(e,t={})=>{let n=fh(t=Object.assign({},t),Uh),r=[],i=[],a=0,o=new WeakMap,s=new WeakMap,c=!1,l=()=>{c||(Wh(u),c=!0)},u=()=>{let e=new Set(n.h.map(e=>o.get(e.entries[0]))),t=i.length-10;i=i.filter((n,r)=>r>=t||e.has(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)}r=r.filter(e=>e.startTime>a||s.has(e)),c=!1};n.p=e=>{let n=e.startTime+e.duration,r;a=Math.max(a,e.processingEnd);for(let a=i.length-1;a>=0;a--){let o=i[a];if(Math.abs(n-o.renderTime)<=8){r=o,r.startTime=Math.min(e.startTime,r.startTime),r.processingStart=Math.min(e.processingStart,r.processingStart),r.processingEnd=Math.max(e.processingEnd,r.processingEnd),t.includeProcessedEventEntries&&r.entries.push(e);break}}r||(r={startTime:e.startTime,processingStart:e.processingStart,processingEnd:e.processingEnd,renderTime:n,entries:t.includeProcessedEventEntries?[e]:[]},i.push(r)),(e.interactionId||e.entryType===`first-input`)&&o.set(e,r),l()},n.m=e=>{if(!s.get(e)){var n;let o=(n=e.entries.find(e=>e.target))==null?void 0:n.target;if(o){var r,i;let n=(r=(i=t.generateTarget)==null?void 0:i.call(t,o))==null?uh(o):r;s.set(e,n)}else{var a;let t=(a=e.entries.find(e=>e.targetSelector))==null?void 0:a.targetSelector;t&&s.set(e,t)}}};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=>{if(e.entries.length===0){let t=e.navigationStartTime||0,n={processedEventEntries:[],longAnimationFrameEntries:[],inputDelay:0,processingDuration:0,presentationDelay:e.value,loadState:ch(t)};return Object.assign(e,{attribution:n})}let t=e.entries[0],r=o.get(t),i=r.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.v.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:ch(t.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(e=>{var t;let n=e.interactionTime,r=e.nextPaintTime;if(!((t=e.longAnimationFrameEntries)!=null&&t.length)||!n||!r)return;let i=e.inputDelay,a=e.processingDuration,o,s,c=0,l=0,u=0,d=0;for(let t of e.longAnimationFrameEntries){l=l+t.startTime+t.duration-t.styleAndLayoutStart;for(let e of t.scripts){let t=e.startTime+e.duration;if(t<n)continue;let r=t-Math.max(n,e.startTime),u=e.duration?r/e.duration*e.forcedStyleAndLayoutDuration:0;c+=r-u,l+=u,r>d&&(s=e.startTime<n+i?`input-delay`:e.startTime>=n+i+a?`presentation-delay`:`processing-duration`,o=e,d=r)}}let f=e.longAnimationFrameEntries.at(-1),p=f?f.startTime+f.duration:0;p>=n+i+a&&(u=r-p),o&&s&&(e.longestScript={entry:o,subpart:s,intersectingDuration:d}),e.totalScriptDuration=c,e.totalStyleAndLayoutDuration=l,e.totalPaintDuration=u,e.totalUnattributedDuration=r-n-c-l-u})(p),Object.assign(e,{attribution:p})};Ch([`long-animation-frame`],e=>{r=r.concat(e),l()},t),((e,t={})=>{if(!globalThis.PerformanceEventTiming||!(`interactionId`in PerformanceEventTiming.prototype))return;let n=Sh();Oh(()=>{var r;Vh();let i,a=$(`INP`),o=fh(t,Uh),s=(n,r,s,c,l)=>{o.M(),a=$(`INP`,-1,n,r,s,c,l),i=Q(e,a,Gh,t.reportAllChanges)},c=()=>{let e=o.T(a.navigationType);e&&e.D!==a.value&&(a.value=e.D,a.entries=e.entries,i())},l=e=>{c(),i(!0),s(`soft-navigation`,e.navigationId,e.interactionId,e.name,e.startTime)},u=(e,t=!1)=>{Wh(()=>{for(let t of e)t.entryType===`soft-navigation`?l(t):o.l(t);c(),t&&i(!0)})},d=[`event`,`first-input`];wh(t)&&d.push(`soft-navigation`);let f=Ch(d,u,U(U({},t),{},{durationThreshold:(r=t.durationThreshold)==null?40:r}));i=Q(e,a,Gh,t.reportAllChanges),f&&(n.onHidden(()=>{u(f.takeRecords(),!0)}),hh(()=>{s(`back-forward-cache`,a.navigationId,a.navigationInteractionId,a.navigationURL,mh())}))})})(t=>{e(f(t))},t)};var qh=class{constructor(){N(this,`p`,void 0),N(this,`u`,void 0)}l(e){var t;(t=this.p)==null||t.call(this,e)}};let Jh=[2500,4e3],Yh=(e,t={})=>{let n=fh(t=Object.assign({},t),qh),r=new WeakMap;wh(t)&&(n.u=new Map),n.p=e=>{let n=e.element;if(n){var i,a;let o=(i=(a=t.generateTarget)==null?void 0:a.call(t,n))==null?uh(n):i;r.set(e,o)}else e.id&&r.set(e,`#${e.id}`)},((e,t={})=>{let n=!1,r=wh(t);Oh(()=>{let i,a=Sh(),o=$(`LCP`),s=fh(t,qh),c=(r,s,c,l,u)=>{o=$(`LCP`,-1,r,s,c,l,u),i=Q(e,o,Jh,t.reportAllChanges),n=!1,r===`soft-navigation`&&(a=Sh(!0))},l=e=>{var t;s.u&&e.navigationId&&Th(s.u,e),n||i(!0),c(`soft-navigation`,e.navigationId,e.interactionId,e.name,e.startTime);let r=(t=e.getLargestInteractionContentfulPaint)==null?void 0:t.call(e);r&&u([r])},u=e=>{t.reportAllChanges||r||(e=e.slice(-1));for(let t of e){if(!t)continue;if(t.entryType===`soft-navigation`){l(t);continue}let e=0,r=[],c=t.startTime;if(t.entryType===`largest-contentful-paint`)e=Math.max(t.startTime-_h(),0),s.l(t),r=[t];else if(t.entryType===`interaction-contentful-paint`){var n;let i=t;if(!o.navigationId||`interactionId`in i&&i.interactionId!=o.navigationInteractionId)continue;c=((n=i.largestContentfulPaint)==null?void 0:n.renderTime)||0,e=Math.max(c-t.startTime,0),i.largestContentfulPaint&&(s.l(i.largestContentfulPaint),r=[i.largestContentfulPaint])}c<a.firstHiddenTime&&(o.value=e,o.entries=r,i())}},d=[`largest-contentful-paint`];r&&d.push(`interaction-contentful-paint`,`soft-navigation`);let f=Ch(d,u);if(f){i=Q(e,o,Jh,t.reportAllChanges);let a=[`keydown`,`click`,`visibilitychange`],s=e=>{if(e.isTrusted&&!n){let e=o.id;Wh(()=>{if(!n){if(!r){f.disconnect();for(let e of a)removeEventListener(e,s,{capture:!0})}e===o.id&&(n=!0,i(!0))}})}};for(let e of a)addEventListener(e,s,{capture:!0});hh(r=>{c(`back-forward-cache`,o.navigationId,o.navigationInteractionId,o.navigationURL,mh()),i=Q(e,o,Jh,t.reportAllChanges),gh(()=>{o.value=performance.now()-r.timeStamp,n=!0,i(!0)})})}})})(t=>{e((e=>{let t={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:e.value};if(e.entries.length){var i,a,o;let s=e.entries.at(-1),c=s.url&&performance.getEntriesByType(`resource`).find(e=>e.name===s.url),l;t.target=r.get(s),t.lcpEntry=s,s.url&&(t.url=s.url),c&&(t.lcpResourceEntry=c);let u=0,d=0;if(e.navigationType===`soft-navigation`?(u=e.navigationStartTime||0,l=(o=n.u)==null?void 0:o.get(e.navigationId)):(l=sh(),u=(i=l==null?void 0:l.activationStart)==null?0:i,d=(a=l==null?void 0:l.responseStart)==null?0:a),l){let n=Math.max(0,d-u),r=Math.max(n,c?(c.requestStart||c.startTime)-u:0),i=Math.min(e.value,Math.max(r,c?c.responseEnd-u:0));t=U(U({},t),{},{timeToFirstByte:n,resourceLoadDelay:r-n,resourceLoadDuration:i-r,elementRenderDelay:e.value-i,navigationEntry:l})}}return Object.assign(e,{attribution:t})})(t))},t)},Xh=[800,1800],Zh=e=>{document.prerendering?Oh(()=>Zh(e)):document.readyState===`complete`?setTimeout(e):addEventListener(`load`,()=>Zh(e),!0)},Qh=(e,t={})=>{((e,t={})=>{let n=wh(t),r=$(`TTFB`),i=Q(e,r,Xh,t.reportAllChanges);Zh(()=>{let a=sh();if(a){let o=a.responseStart;r.value=Math.max(o-_h(),0),r.entries=[a],i(!0),hh(()=>{r=$(`TTFB`,0,`back-forward-cache`,r.navigationId,r.navigationInteractionId,r.navigationURL,mh()),i=Q(e,r,Xh,t.reportAllChanges),i(!0)}),n&&Ch([`soft-navigation`],n=>{n.forEach(n=>{n.navigationId&&(r=$(`TTFB`,0,`soft-navigation`,n.navigationId,n.interactionId,n.name,n.startTime),r.entries=[n],i=Q(e,r,Xh,t.reportAllChanges),i(!0))})},t)}})})(t=>{e((e=>{let t=e.entries[0],n={waitingDuration:0,cacheDuration:0,dnsDuration:0,connectionDuration:0,requestDuration:0,navigationEntry:t};if(e.entries.length&&t instanceof PerformanceNavigationTiming){let r=t.activationStart||0,i=Math.max((t.workerStart||t.fetchStart||0)-r,0),a=Math.max(t.domainLookupStart-r,0),o=Math.max(t.connectStart-r,0),s=Math.max(t.connectEnd-r,0);n={waitingDuration:i,cacheDuration:a-i,dnsDuration:o-a,connectionDuration:s-o,requestDuration:e.value-s,navigationEntry:t}}return Object.assign(e,{attribution:n})})(t))},t)},$h=[`CLS`,`INP`,`LCP`,`FCP`,`TTFB`],eg={CLS:Nh,FCP:Ph,LCP:Yh,INP:Kh,TTFB:Qh,FID:void 0};P(),W();let tg=e=>{let t=typeof e;return t===`number`||t===`string`||t===`boolean`},ng=e=>Math.round(Math.max(0,e)),rg=e=>{let t={},{attribution:n}=e;if(!n||typeof n!=`object`)return t;for(let[e,r]of Object.entries(n))tg(r)&&(t[`${ah}${e}`]=r);return t},ig=(e,t)=>{let n={},r=e.attribution;try{if(r.longAnimationFrameEntries.length>0){let e=new Map;for(let t of r.longAnimationFrameEntries)for(let n of t.scripts){let t=n.sourceURL||`(inline)`;t.length>2048&&(t=`${t.substring(0,2048)}...`);let r=e.get(t);r?(r.totalDuration+=n.duration,r.styleAndLayoutDuration+=n.forcedStyleAndLayoutDuration,r.count++):e.set(t,{count:1,styleAndLayoutDuration:n.forcedStyleAndLayoutDuration,totalDuration:n.duration})}e.size>0&&(n[`${ah}loaf_scripts`]=JSON.stringify(Object.fromEntries([...e].sort((e,t)=>t[1].totalDuration-e[1].totalDuration).slice(0,250).map(([e,t])=>[e,{count:t.count,style_and_layout_duration:Math.round(t.styleAndLayoutDuration),total_duration:Math.round(t.totalDuration)}]))))}}catch(e){t.error(`error building loaf scripts for INP`,e)}return n},ag=(e,t)=>{let n={},r=e.attribution.navigationEntry;if(r)try{var i;let e=ng(r.redirectEnd-r.redirectStart),t=ng(r.domainLookupEnd-r.domainLookupStart),a=ng(r.secureConnectionStart>0?r.secureConnectionStart-r.connectStart:r.connectEnd-r.connectStart),o=ng(r.secureConnectionStart>0?r.connectEnd-r.secureConnectionStart:0),s=ng(Math.max((i=r.finalResponseHeadersStart)==null?0:i,r.responseStart)-r.requestStart),c=ng(Math.round(r.responseEnd-r.startTime)-e-t-a-o-s),l=ah;n[`${l}redirect`]=e,n[`${l}domainLookup`]=t,n[`${l}tcpConnection`]=a,n[`${l}tlsNegotiation`]=o,n[`${l}serverResponse`]=s,n[`${l}unattributed`]=c}catch(e){t.error(`error computing TTFB timing breakdown`,e)}else t.debug(`TTFB navigationEntry unavailable, skipping timing breakdown`);return n};var og=class extends G{constructor({diag:e,perf:t,listeners:n=eg,urlDocument:r=window.document,urlAttribution:i=!0,pageManager:a}={}){super({config:{},diag:e,instrumentationName:`WebVitalsInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),N(this,`_listeners`,void 0),N(this,`_urlDocument`,void 0),N(this,`_urlAttribution`,void 0),N(this,`_pageManager`,void 0),N(this,`_attributedPage`,{CLS:void 0,FCP:void 0,INP:void 0,LCP:void 0,TTFB:void 0}),N(this,`_largestShiftTargetForCLS`,void 0),N(this,`_listenersRegistered`,!1),N(this,`_isEnabled`,!1),this._listeners=n,this._urlDocument=r,this._urlAttribution=i,this._pageManager=a==null?Mn.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,$h.forEach(e=>{var t,n;(t=(n=this._listeners)[e])==null||t.call(n,t=>{if(!this._isEnabled)return;let n=this.userSessionManager.getSessionPartSpan();if(!n)return;let r=this._getTimeForMetric(t),i=this._getAttributedPageForMetric(t),a=U(U(U({"mxl.type":`ux.web_vital`,"url.full":i.fullURL,"browser.url.full":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},rg(t)),e===`INP`?ig(t,this._diag):{}),e===`TTFB`?ag(t,this._diag):{});i.path&&i.pageID&&(a[`app.surface.name`]=i.path,a[`app.surface.id`]=i.pageID),i.label&&(a[`app.surface.label`]=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()}};W();let sg=(e={},{logManager:t,userSessionManager:n,pageManager:r,limitManager:i,includeReplay:a=!1,recordUserSessions:o=!0,replayOptions:s,replayContext:c,sessionStorage:l})=>{var u,d,f,p,m,h,g,_,v;let y=[];if((u=e.omit)!=null&&u.has(`exception`)||y.push(new Zm(e.exception)),(d=e.omit)!=null&&d.has(`click`)||y.push(new Vm(e.click)),(f=e.omit)!=null&&f.has(`web-vital`)||y.push(new og(U(U({},e[`web-vital`]),{},{pageManager:r}))),(p=e.omit)!=null&&p.has(`loaf`)||y.push(new $m(U({},e.loaf))),(m=e.omit)!=null&&m.has(`user-timing`)||y.push(new ih(e[`user-timing`])),(h=e.omit)!=null&&h.has(`element-timing`)||y.push(new Ym(U(U({},e[`element-timing`]),{},{limitManager:i}))),(g=e.omit)!=null&&g.has(`document-load`)||y.push(new Gm(e[`document-load`])),(_=e.omit)!=null&&_.has(`server-timing`)||y.push(new eh(U(U({},e[`server-timing`]),{},{limitManager:i}))),e[`empty-root`]&&y.push(new Xm(U({},e[`empty-root`]))),a&&!((v=e.omit)!=null&&v.has(`replay`))){var b;if(!c)throw Error(`replayContext is required when includeReplay is true`);if(!l)throw Error(`sessionStorage is required when includeReplay is true`);y.push(new us(U(U({},e.replay),{},{recordUserSessions:o,replayContext:c,rrwebOptions:s==null?(b=e.replay)==null?void 0:b.rrwebOptions:s,sessionStorage:l})))}for(let e of y)e instanceof G&&(n&&e.setUserSessionManager(n),t&&e.setLogManager(t),i&&e.setLimitManager(i));return y},cg=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}},lg=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},ug=(e,t)=>{if(e!==void 0){if(typeof e!=`string`)throw Error(`applicationId must be a string when specified. Received ${String(e)}`);let t=e.trim();if(t===``)throw Error(`applicationId cannot be an empty string when specified.`);return t}return t==null?``:t};M(),H(),As(),Ws(),ju(),W(),q();let dg=({appID:e,applicationId:t,appVersion:n,resource:r=Ls(),spanExporters:i=[],logExporters:a=[],spanProcessors:o=[],propagator:s=null,defaultInstrumentationConfig:c,instrumentations:l=[],contextManager:u=null,logProcessors:d=[],attributeScrubbers:f=[],enableDefaultAttributeScrubbing:p=!0,additionalQueryParamsToScrub:m=[],logLevel:h=b.ERROR,otelCollectorURL:g,apiURL:_,apiKey:v,diagLogger:y=k.createComponentLogger({namespace:`mxl-sdk`}),dynamicSDKConfigManager:ee,dynamicSDKConfig:te,registerGlobally:x=!0,blockNetworkSpanForwarding:ne=!1,restrictedProtocols:S=new Set([`file:`]),useDocumentTitleAsPageLabel:re=!0,recordUserSessions:ie=!0,replay:ae,serviceName:oe,maxUserSessionDurationSeconds:se=Qf,inactivityTimeoutSeconds:ce=$f}={})=>{try{var le,ue,de;if(x){let e=zm.registered();if(e!==null)return y.warn(`SDK has already been successfully initialized, skipping this invocation of initSDK`),e}if(k.setLogger(new ge,{logLevel:h}),typeof window>`u`)return y.warn(`browser not detected, skipping initialization`),!1;let b=new Ra,fe=b.getNowMillis(),C=cg(e),w=lg(n),pe=ug(t,C),me=C!==void 0;if(!me&&!a.length&&!i.length)throw Error(`when appID is omitted, at least one logExporter or spanExporter must be set`);if(S.has(window.location.protocol))throw Error(`not initializing due to restricted protocol: ${window.location.protocol}`);if(me&&typeof CompressionStream>`u`)throw Error(`CompressionStream is not supported in this browser and required for data compression.`);let he=x?void 0:C,_e=new Ip({diag:y,namespace:he,storage:window.localStorage}),ve=new Ip({diag:y,namespace:he,storage:window.sessionStorage}),ye=fg({registerGlobally:x,sdkLocalStorage:_e}),T=ye.getMXLUserId();if(me&&!T)throw Error(`userID is required when using MXL exporter`);let be=U({},te),xe=ee==null?new df({appID:C,appVersion:w,defaultConfig:be,deviceId:T,apiURL:_,storage:_e}):ee;xe.refreshRemoteConfig();let Se=(le=(ue=xe.resolveApplicationServiceName)==null?void 0:ue.call(xe,oe))==null?(()=>{var e;return(oe==null?void 0:oe.trim())||((e=xe.getConfig().serviceName)==null?void 0:e.trim())||af})():le,Ce=of({serviceName:Se}).merge(r).merge(sf({appVersion:w,applicationId:pe||void 0,diagLogger:y,enduserPseudoId:T,pageSessionStorage:ve})),we=new Vf({blockNetworkSpanForwarding:ne,deviceId:T,dynamicConfigManager:xe});if(!we.isSDKEnabled())return y.debug(`SDK is disabled, skipping initialization.`),!1;let Te=Lp({defaultInstrumentationConfig:c,diag:y,featureManager:we,propagator:s,registerGlobally:x}),Ee=new hf(pf),De=[...p?Vp(m):[],...f],E=pg({limitManager:Ee,perf:b,registerGlobally:x,sdkLocalStorage:_e,sdkSessionStorage:ve,userSessionConfig:{inactivityTimeoutSeconds:ce,maxUserSessionDurationSeconds:se}}),Oe,ke;me&&(Oe=new Op({emptySessionAvoidanceEnabled:we.isEmptySessionAvoidanceEnabled(),exporter:new Od({appID:C,otelCollectorURL:g,userID:T}),limitManager:Ee,userSessionManager:E}),ke=new Hc({exporter:new Td({appID:C,otelCollectorURL:g,userID:T})}));let Ae=gg({registerGlobally:x,useDocumentTitleAsPageLabel:re}),{tracerProvider:je,mxlTraceManager:Me}=mg({attributeScrubbers:De,contextManager:u,mxlSpanProcessor:Oe,pageManager:Ae,propagator:Te?new Fp:s,registerGlobally:x,resource:Ce,spanExporters:i,spanProcessors:o,userManager:ye});E.setTracerProvider(je);let{loggerProvider:Ne,mxlLogManager:Pe}=hg({attributeScrubbers:De,limitManager:Ee,logExporters:a,logProcessors:d,mxlLogProcessor:ke,pageManager:Ae,registerGlobally:x,resource:Ce,sdkLocalStorage:_e,userManager:ye,userSessionManager:E,visibilityDoc:window.document}),Fe=new Mf({applicationId:pe,loggerProvider:Ne,pageManager:Ae,storage:_e,userManager:ye,userSessionManager:E});E.setAnalyticsManager(Fe),x&&Tn.setGlobalAnalyticsManager(Fe),E.startSessionPartInternal(`init`);let Ie=typeof window<`u`&&window.__MXL_DISABLE_SESSION_RECORDER===!0,{recordUserSessions:Le,replay:Re}=ff({dynamicConfig:xe.getConfig(),isSessionReplayEnabled:we.isSessionReplayEnabled(),recordUserSessions:ie,replay:ae}),ze=!!(me&&C&&T&&!Ie&&we.isSessionReplayEnabled()),Be=ze&&Le&&Re!=null&&Re.omitRedundantInstrumentations?[`click`,`exception`,`@opentelemetry/instrumentation-fetch`,`@opentelemetry/instrumentation-xml-http-request`]:void 0,Ve=Be===void 0?c:U(U({},c),{},{omit:new Set([...(de=c==null?void 0:c.omit)==null?[]:de,...Be])}),He=ze&&C&&T?{appID:C,appVersion:w,apiURL:_,serviceName:Se,transport:Ud({apiKey:v,appID:C,apiURL:_,otelCollectorURL:g}),userID:T}:void 0,Ue=()=>sg(Ve,{includeReplay:ze,limitManager:Ee,logManager:Pe,pageManager:Ae,recordUserSessions:Le,replayContext:He,replayOptions:Re,sessionStorage:ve,userSessionManager:E}),We,D,Ge;if(x){let e=sg(Ve,{includeReplay:ze,limitManager:Ee,pageManager:Ae,recordUserSessions:Le,replayContext:He,replayOptions:Re,sessionStorage:ve,userSessionManager:E});We=e.find(e=>e instanceof us),D=ms({instrumentations:[...e,...l]}),Lm(Ve).then(e=>{e.length!==0&&(Ge=ms({instrumentations:e}))})}else{let e=Ue();We=e.find(e=>e instanceof us),D=ms({instrumentations:[...e,...l],loggerProvider:Ne,tracerProvider:je}),Lm(Ve).then(e=>{e.length!==0&&(Ge=ms({instrumentations:e,loggerProvider:Ne,tracerProvider:je}))})}let Ke=!1,qe=!1,Je=()=>{qe||(qe=!0,We==null||We.disable(),D==null||D(),Ge==null||Ge(),E._shutdown())},Ye=We?kd(We):Rm;y.info(`successfully initialized the SDK`);let Xe={analytics:Fe,flush:function(){var e=K(function*(){yield je.forceFlush(),yield Ne.forceFlush()});return function(){return e.apply(this,arguments)}}(),log:Pe,page:Ae,session:E,sessionRecording:Ye,setDynamicConfig:e=>{xe.setConfig(e)},shutdown:function(){var e=K(function*(){Ke||(Ke=!0,Je(),yield je.shutdown(),yield Ne.shutdown())});return function(){return e.apply(this,arguments)}}(),stop:Je,trace:Me,user:ye};return x&&zm.register(Xe),E.recordSDKStartupDuration(b.getNowMillis()-fe),Fe.screenView(),Xe}catch(e){let t=e instanceof Error?e.message:`Unknown error.`;return y.error(`failed to initialize the SDK: ${t}`),!1}},fg=({registerGlobally:e,sdkLocalStorage:t})=>{let n=new Kf({storage:t});return e&&er.setGlobalUserManager(n),n},pg=({limitManager:e,perf:t,registerGlobally:n,sdkLocalStorage:r,sdkSessionStorage:i,userSessionConfig:a})=>{let o=new yp({config:a,limitManager:e,perf:t,storage:r,tabStorage:i,visibilityDoc:window.document});return n&&zn.setGlobalUserSessionManager(o),o},mg=({resource:e,userManager:t,spanExporters:n,spanProcessors:r=[],propagator:i=null,contextManager:a=null,attributeScrubbers:o,registerGlobally:s,mxlSpanProcessor:c,pageManager:l})=>{let u=[...r,new xp,new Tp,new Pp({userManager:t}),new Ap({pageManager:l}),new jp({attributeScrubbers:o})];n==null||n.forEach(e=>{u.push(new ou(e))}),c&&u.push(c);let d=new pu({resource:e,spanLimits:{attributeCountLimit:pf.maxAllowed.session_property*2,eventCountLimit:pf.maxAllowed.breadcrumb*2},spanProcessors:u}),f=new Uf({tracerProvider:s?void 0:d});return s&&(qn.setGlobalTraceManager(f),d.register({contextManager:a||new lu,propagator:i})),{mxlTraceManager:f,tracerProvider:d}},hg=({resource:e,userManager:t,logExporters:n,logProcessors:r,userSessionManager:i,limitManager:a,attributeScrubbers:o,registerGlobally:s,mxlLogProcessor:c,sdkLocalStorage:l,pageManager:u,visibilityDoc:d=window.document})=>{let f=[...r,new Np({userSessionManager:i}),new bp,new Cp,new Mp({userManager:t}),new Sp({attributeScrubbers:o}),new kp({pageManager:u})];n==null||n.forEach(e=>{f.push(new Hc({exporter:e}))}),c&&f.push(c);let p=new Lc({processors:f,resource:e}),m=new Lf({limitManager:a,loggerProvider:s?void 0:p,storage:l,userSessionManager:i,visibilityDoc:d});return s&&(ro.setGlobalLoggerProvider(p),vn.setGlobalLogManager(m)),{loggerProvider:p,mxlLogManager:m}},gg=({useDocumentTitleAsPageLabel:e,registerGlobally:t})=>{let n=new Rf({useDocumentTitleAsPageLabel:e});return t&&Mn.setGlobalPageManager(n),n};return M(),Object.defineProperty(e,`DiagLogLevel`,{enumerable:!0,get:function(){return b}}),e.ReplayInstrumentation=us,e.analytics=Tn,e.attributes=pr,e.getNavigationInstrumentation=lo,e.initSDK=dg,e.loadRrwebModule=Vo,e.log=vn,e.page=Mn,e.resetRrwebModuleCacheForTests=Ho,e.session=zn,e.setRrwebModuleLoaderForTests=Uo,e.setRrwebScriptUrl=Lo,e.trace=qn,e.user=er,e})({});
|
|
1
|
+
"use strict";window.MXLWebSdk=window.MXLWebSdk||(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Object.defineProperty,n=(e,t)=>()=>(e&&(t=e(e=0)),t),r=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},i,a=n((()=>{i=`1.9.1`}));function o(e){let t=new Set([e]),n=new Set,r=e.match(s);if(!r)return()=>!1;let i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(t){return t===e};function a(e){return n.add(e),!1}function o(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(n.has(e))return!1;let r=e.match(s);if(!r)return a(e);let c={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};return c.prerelease!=null||i.major!==c.major?a(e):i.major===0?i.minor===c.minor&&i.patch<=c.patch?o(e):a(e):i.minor<=c.minor?o(e):a(e)}}var s,c,l=n((()=>{a(),s=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,c=o(i)}));function u(e,t,n,r=!1){var a;let o=h[m]=(a=h[m])==null?{version:i}:a;if(!r&&o[e]){let t=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return n.error(t.stack||t.message),!1}if(o.version!==`1.9.1`){let t=Error(`@opentelemetry/api: Registration of version v${o.version} for ${e} does not match previously registered API v${i}`);return n.error(t.stack||t.message),!1}return o[e]=t,n.debug(`@opentelemetry/api: Registered a global for ${e} v${i}.`),!0}function d(e){var t,n;let r=(t=h[m])==null?void 0:t.version;if(!(!r||!c(r)))return(n=h[m])==null?void 0:n[e]}function f(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${i}.`);let n=h[m];n&&delete n[e]}var p,m,h,g=n((()=>{a(),l(),p=i.split(`.`)[0],m=Symbol.for(`opentelemetry.js.api.${p}`),h=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{}}));function _(e,t,n){let r=d(`diag`);if(r)return r[e](t,...n)}var v,y=n((()=>{g(),v=class{constructor(e){this._namespace=e.namespace||`DiagComponentLogger`}debug(...e){return _(`debug`,this._namespace,e)}error(...e){return _(`error`,this._namespace,e)}info(...e){return _(`info`,this._namespace,e)}warn(...e){return _(`warn`,this._namespace,e)}verbose(...e){return _(`verbose`,this._namespace,e)}}})),b,ee=n((()=>{(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`})(b||(b={}))}));function te(e,t){e<b.NONE?e=b.NONE:e>b.ALL&&(e=b.ALL),t=t||{};function n(n,r){let i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,b.ERROR),warn:n(`warn`,b.WARN),info:n(`info`,b.INFO),debug:n(`debug`,b.DEBUG),verbose:n(`verbose`,b.VERBOSE)}}var x=n((()=>{ee()})),ne,S,re=n((()=>{y(),x(),ee(),g(),ne=`diag`,S=class e{static instance(){return this._instance||(this._instance=new e),this._instance}constructor(){function e(e){return function(...t){let n=d(`diag`);if(n)return n[e](...t)}}let t=this;t.setLogger=(e,n={logLevel:b.INFO})=>{var r,i,a;if(e===t){let e=Error(`Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation`);return t.error((r=e.stack)==null?e.message:r),!1}typeof n==`number`&&(n={logLevel:n});let o=d(`diag`),s=te((i=n.logLevel)==null?b.INFO:i,e);if(o&&!n.suppressOverrideMessage){let e=(a=Error().stack)==null?`<failed to generate stacktrace>`:a;o.warn(`Current logger will be overwritten from ${e}`),s.warn(`Current logger will overwrite one already registered from ${e}`)}return u(`diag`,s,t,!0)},t.disable=()=>{f(ne,t)},t.createComponentLogger=e=>new v(e),t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}}})),ie,ae=n((()=>{ie=class e{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){let t=this._entries.get(e);if(t)return Object.assign({},t)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(t,n){let r=new e(this._entries);return r._entries.set(t,n),r}removeEntry(t){let n=new e(this._entries);return n._entries.delete(t),n}removeEntries(...t){let n=new e(this._entries);for(let e of t)n._entries.delete(e);return n}clear(){return new e}}})),oe,se=n((()=>{oe=Symbol(`BaggageEntryMetadata`)}));function ce(e={}){return new ie(new Map(Object.entries(e)))}function le(e){return typeof e!=`string`&&(ue.error(`Cannot create baggage metadata from unknown type: ${typeof e}`),e=``),{__TYPE__:oe,toString(){return e}}}var ue,de=n((()=>{re(),ae(),se(),ue=S.instance()}));function fe(e){return Symbol.for(e)}var C,w,pe=n((()=>{C=class e{constructor(t){let n=this;n._currentContext=t?new Map(t):new Map,n.getValue=e=>n._currentContext.get(e),n.setValue=(t,r)=>{let i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=t=>{let r=new e(n._currentContext);return r._currentContext.delete(t),r}}},w=new C})),me,he,ge,_e=n((()=>{if(me=[{n:`error`,c:`error`},{n:`warn`,c:`warn`},{n:`info`,c:`info`},{n:`debug`,c:`debug`},{n:`verbose`,c:`trace`}],he={},typeof console<`u`)for(let e of[`error`,`warn`,`info`,`debug`,`trace`,`log`])typeof console[e]==`function`&&(he[e]=console[e]);ge=class{constructor(){function e(e){return function(...t){let n=he[e];if(typeof n!=`function`&&(n=he.log),typeof n!=`function`&&console&&(n=console[e],typeof n!=`function`&&(n=console.log)),typeof n==`function`)return n.apply(console,t)}}for(let t=0;t<me.length;t++)this[me[t].n]=e(me[t].c)}}}));function ve(){return E}var ye,T,be,xe,Se,Ce,we,Te,Ee,De,E,Oe,ke,Ae,je,Me,Ne,Pe,Fe=n((()=>{ye=class{constructor(){}createGauge(e,t){return ke}createHistogram(e,t){return Ae}createCounter(e,t){return Oe}createUpDownCounter(e,t){return je}createObservableGauge(e,t){return Ne}createObservableCounter(e,t){return Me}createObservableUpDownCounter(e,t){return Pe}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}},T=class{},be=class extends T{add(e,t){}},xe=class extends T{add(e,t){}},Se=class extends T{record(e,t){}},Ce=class extends T{record(e,t){}},we=class{addCallback(e){}removeCallback(e){}},Te=class extends we{},Ee=class extends we{},De=class extends we{},E=new ye,Oe=new be,ke=new Se,Ae=new Ce,je=new xe,Me=new Te,Ne=new Ee,Pe=new De})),Ie,Le,Re=n((()=>{Ie={get(e,t){if(e!=null)return e[t]},keys(e){return e==null?[]:Object.keys(e)}},Le={set(e,t,n){e!=null&&(e[t]=n)}}})),ze,Be=n((()=>{pe(),ze=class{active(){return w}with(e,t,n,...r){return t.call(n,...r)}bind(e,t){return t}enable(){return this}disable(){return this}}})),Ve,He,Ue,We=n((()=>{Be(),g(),re(),Ve=`context`,He=new ze,Ue=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalContextManager(e){return u(Ve,e,S.instance())}active(){return this._getContextManager().active()}with(e,t,n,...r){return this._getContextManager().with(e,t,n,...r)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return d(Ve)||He}disable(){this._getContextManager().disable(),f(Ve,S.instance())}}})),D,Ge=n((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(D||(D={}))})),Ke,qe,Je,Ye=n((()=>{Ge(),Ke=`0000000000000000`,qe=`00000000000000000000000000000000`,Je={traceId:qe,spanId:Ke,traceFlags:D.NONE}})),Xe,Ze=n((()=>{Ye(),Xe=class{constructor(e=Je){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){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){}}}));function Qe(e){return e.getValue(it)||void 0}function $e(){return Qe(Ue.getInstance().active())}function et(e,t){return e.setValue(it,t)}function tt(e){return e.deleteValue(it)}function nt(e,t){return et(e,new Xe(t))}function rt(e){var t;return(t=Qe(e))==null?void 0:t.spanContext()}var it,at=n((()=>{pe(),Ze(),We(),it=fe(`OpenTelemetry Context Key SPAN`)}));function ot(e,t){if(typeof e!=`string`||e.length!==t)return!1;let n=0;for(let t=0;t<e.length;t+=4)n+=(dt[e.charCodeAt(t)]|0)+(dt[e.charCodeAt(t+1)]|0)+(dt[e.charCodeAt(t+2)]|0)+(dt[e.charCodeAt(t+3)]|0);return n===t}function st(e){return ot(e,32)&&e!==`00000000000000000000000000000000`}function ct(e){return ot(e,16)&&e!==`0000000000000000`}function lt(e){return st(e.traceId)&&ct(e.spanId)}function ut(e){return new Xe(e)}var dt,ft=n((()=>{Ye(),Ze(),dt=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1])}));function pt(e){return typeof e==`object`&&!!e&&`spanId`in e&&typeof e.spanId==`string`&&`traceId`in e&&typeof e.traceId==`string`&&`traceFlags`in e&&typeof e.traceFlags==`number`}var mt,ht,gt=n((()=>{We(),at(),Ze(),ft(),mt=Ue.getInstance(),ht=class{startSpan(e,t,n=mt.active()){if(t!=null&&t.root)return new Xe;let r=n&&rt(n);return pt(r)&<(r)?new Xe(r):new Xe}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a==null?mt.active():a,c=this.startSpan(e,i,s),l=et(s,c);return mt.with(l,o,void 0,c)}}})),_t,vt,yt=n((()=>{gt(),_t=new ht,vt=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}startSpan(e,t,n){return this._getTracer().startSpan(e,t,n)}startActiveSpan(e,t,n,r){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):_t}}})),bt,xt=n((()=>{gt(),bt=class{getTracer(e,t,n){return new ht}}})),St,Ct,wt=n((()=>{yt(),xt(),St=new bt,Ct=class{getTracer(e,t,n){var r;return(r=this.getDelegateTracer(e,t,n))==null?new vt(this,e,t,n):r}getDelegate(){var e;return(e=this._delegate)==null?St:e}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){var r;return(r=this._delegate)==null?void 0:r.getTracer(e,t,n)}}})),Tt,Et=n((()=>{(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(Tt||(Tt={}))})),Dt,Ot=n((()=>{(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`})(Dt||(Dt={}))})),kt,At=n((()=>{(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(kt||(kt={}))})),O,jt=n((()=>{We(),O=Ue.getInstance()})),k,Mt=n((()=>{re(),k=S.instance()})),Nt,Pt,Ft=n((()=>{Fe(),Nt=class{getMeter(e,t,n){return E}},Pt=new Nt})),It,Lt,Rt=n((()=>{Ft(),g(),re(),It=`metrics`,Lt=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalMeterProvider(e){return u(It,e,S.instance())}getMeterProvider(){return d(It)||Pt}getMeter(e,t,n){return this.getMeterProvider().getMeter(e,t,n)}disable(){f(It,S.instance())}}})),zt,Bt=n((()=>{Rt(),zt=Lt.getInstance()})),Vt,Ht=n((()=>{Vt=class{inject(e,t){}extract(e,t){return e}fields(){return[]}}}));function Ut(e){return e.getValue(qt)||void 0}function Wt(){return Ut(Ue.getInstance().active())}function Gt(e,t){return e.setValue(qt,t)}function Kt(e){return e.deleteValue(qt)}var qt,Jt=n((()=>{We(),pe(),qt=fe(`OpenTelemetry Baggage Key`)})),Yt,Xt,Zt,Qt=n((()=>{g(),Ht(),Re(),Jt(),de(),re(),Yt=`propagation`,Xt=new Vt,Zt=class e{constructor(){this.createBaggage=ce,this.getBaggage=Ut,this.getActiveBaggage=Wt,this.setBaggage=Gt,this.deleteBaggage=Kt}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalPropagator(e){return u(Yt,e,S.instance())}inject(e,t,n=Le){return this._getGlobalPropagator().inject(e,t,n)}extract(e,t,n=Ie){return this._getGlobalPropagator().extract(e,t,n)}fields(){return this._getGlobalPropagator().fields()}disable(){f(Yt,S.instance())}_getGlobalPropagator(){return d(Yt)||Xt}}})),A,$t=n((()=>{Qt(),A=Zt.getInstance()})),en,tn,nn=n((()=>{g(),wt(),ft(),at(),re(),en=`trace`,tn=class e{constructor(){this._proxyTracerProvider=new Ct,this.wrapSpanContext=ut,this.isSpanContextValid=lt,this.deleteSpan=tt,this.getSpan=Qe,this.getActiveSpan=$e,this.getSpanContext=rt,this.setSpan=et,this.setSpanContext=nt}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalTracerProvider(e){let t=u(en,this._proxyTracerProvider,S.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return d(en)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){f(en,S.instance()),this._proxyTracerProvider=new Ct}}})),j,rn=n((()=>{nn(),j=tn.getInstance()})),M=n((()=>{de(),pe(),_e(),ee(),Fe(),Re(),yt(),wt(),Et(),Ot(),At(),Ge(),ft(),Ye(),jt(),Mt(),Bt(),$t(),rn()}));M();function an(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}}}})}var on=class{logException(e,t){}message(e,t,n){}};function sn(e){"@babel/helpers - typeof";return sn=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},sn(e)}var cn=n((()=>{}));function ln(e,t){if(sn(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(sn(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var un=n((()=>{cn()}));function dn(e){var t=ln(e,`string`);return sn(t)==`symbol`?t:t+``}var fn=n((()=>{cn(),un()}));function N(e,t,n){return(t=dn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var P=n((()=>{fn()}));P();let pn=new on;var mn=class{constructor(){N(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?pn:e}setDelegate(e){this._delegate=e}logException(e,t){this.getDelegate().logException(e,t)}message(e,t,n){this.getDelegate().message(e,t,n)}};P();let hn=new on,gn=new Set([`setDelegate`,`getDelegate`]);var _n=class e{static getInstance(){if(!e._instance){let t=new mn,n=an(t,hn,k.createComponentLogger({namespace:`LogAPI`}),gn);e._instance=Object.assign(n,{getLogManager(){return t},setGlobalLogManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};N(_n,`_instance`,void 0);let vn=_n.getInstance();var yn=class{track(){}identify(){}increment(){}decrement(){}clear(){}screenView(){}};P();let bn=new yn;var xn=class{constructor(){N(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?bn:e}setDelegate(e){this._delegate=e}track(e,t){this.getDelegate().track(e,t)}identify(e){this.getDelegate().identify(e)}increment(e){this.getDelegate().increment(e)}decrement(e){this.getDelegate().decrement(e)}clear(){this.getDelegate().clear()}screenView(){this.getDelegate().screenView()}};M(),P();let Sn=new yn,Cn=new Set([`setDelegate`,`getDelegate`]);var wn=class e{static getInstance(){if(!e._instance){let t=new xn,n=an(t,Sn,k.createComponentLogger({namespace:`AnalyticsAPI`}),Cn);e._instance=Object.assign(n,{getAnalyticsManager(){return t},setGlobalAnalyticsManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};N(wn,`_instance`,void 0);let Tn=wn.getInstance();var En=class{setCurrentRoute(e){}getCurrentRoute(){return null}getCurrentPageId(){return``}setPageLabel(e){}getPageLabel(){return null}clearCurrentRoute(){}};P();let Dn=new En;var On=class{constructor(){N(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?Dn: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()}};M(),P();let kn=new En,An=new Set([`setDelegate`,`getDelegate`]);var jn=class e{static getInstance(){if(!e._instance){let t=new On,n=an(t,kn,k.createComponentLogger({namespace:`PageAPI`}),An);e._instance=Object.assign(n,{getPageManager(){return t},setGlobalPageManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};N(jn,`_instance`,void 0);let Mn=jn.getInstance();var Nn=class{addBreadcrumb(e){}addProperty(e,t,n){}removeProperty(e){}getUserSessionId(){return null}getPreviousUserSessionId(){return null}getUserSessionStartTime(){return null}endUserSession(){}getUserSessionAttributes(){return null}getSessionPartProperties(){return{}}getSessionPartId(){return null}getSessionPartSpan(){return null}startSessionPartInternal(e){}endSessionPartInternal(e,t){}incrSessionPartCountForKey(e){}incrNextSessionPartCountForKey(e){}addSessionPartStartedListener(e){return()=>{}}addSessionPartEndedListener(e){return()=>{}}setTracerProvider(){}recordSDKStartupDuration(e){}_clearMaxDurationTimer(){}_shutdown(){}};P();let Pn=new Nn;var Fn=class{constructor(){N(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?Pn:e}setDelegate(e){let t=this._delegate;t&&t!==e&&t._shutdown(),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)}getUserSessionId(){return this.getDelegate().getUserSessionId()}getPreviousUserSessionId(){return this.getDelegate().getPreviousUserSessionId()}getUserSessionStartTime(){return this.getDelegate().getUserSessionStartTime()}endUserSession(){this.getDelegate().endUserSession()}getUserSessionAttributes(){return this.getDelegate().getUserSessionAttributes()}getSessionPartProperties(){return this.getDelegate().getSessionPartProperties()}getSessionPartId(){return this.getDelegate().getSessionPartId()}getSessionPartSpan(){return this.getDelegate().getSessionPartSpan()}startSessionPartInternal(e){this.getDelegate().startSessionPartInternal(e)}endSessionPartInternal(e,t){this.getDelegate().endSessionPartInternal(e,t)}incrSessionPartCountForKey(e){this.getDelegate().incrSessionPartCountForKey(e)}incrNextSessionPartCountForKey(e){this.getDelegate().incrNextSessionPartCountForKey(e)}addSessionPartStartedListener(e){return this.getDelegate().addSessionPartStartedListener(e)}addSessionPartEndedListener(e){return this.getDelegate().addSessionPartEndedListener(e)}setTracerProvider(e){this.getDelegate().setTracerProvider(e)}recordSDKStartupDuration(e){this.getDelegate().recordSDKStartupDuration(e)}_clearMaxDurationTimer(){this.getDelegate()._clearMaxDurationTimer()}_shutdown(){this.getDelegate()._shutdown()}};M(),P();let In=new Nn,Ln=new Set([`setDelegate`,`getDelegate`]);var Rn=class e{static getInstance(){if(!e._instance){let t=new Fn,n=an(t,In,k.createComponentLogger({namespace:`SessionAPI`}),Ln);e._instance=Object.assign(n,{getUserSessionManager(){return t},setGlobalUserSessionManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};N(Rn,`_instance`,void 0);let zn=Rn.getInstance();M(),P();var Bn=class{constructor(e=Je){N(this,`_spanContext`,void 0),N(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){}};M();var Vn=class{startSpan(e,t){return new Bn}setSpan(e,t){return w}getSpan(e){}};P();let Hn=new Vn;var Un=class{constructor(){N(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?Hn: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)}};M(),P();let Wn=new Vn,Gn=new Set([`setDelegate`,`getDelegate`]);var Kn=class e{static getInstance(){if(!e._instance){let t=new Un,n=an(t,Wn,k.createComponentLogger({namespace:`TraceAPI`}),Gn);e._instance=Object.assign(n,{getTraceManager(){return t},setGlobalTraceManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};N(Kn,`_instance`,void 0);let qn=Kn.getInstance();var Jn=class{getMXLUserId(){return``}getUserId(){return null}setUserId(){}clearUserId(){}};P();let Yn=new Jn;var Xn=class{constructor(){N(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?Yn: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()}};M(),P();let Zn=new Jn,Qn=new Set([`setDelegate`,`getDelegate`]);var $n=class e{static getInstance(){if(!e._instance){let t=new Xn,n=an(t,Zn,k.createComponentLogger({namespace:`UserAPI`}),Qn);e._instance=Object.assign(n,{getUserManager(){return t},setGlobalUserManager(e){t.setDelegate(e)}})}return e._instance}static resetInstance(){e._instance=void 0}};N($n,`_instance`,void 0);let er=$n.getInstance(),F=`mxl.type`,tr=`mxl.state`,nr=`react.component_stack`,rr=`mxl.instrumentation`,ir=`mxl.js_file_bundle_ids`,ar=`browser.url.full`,or=`app.surface.name`,sr=`app.surface.id`,cr=`app.surface.label`,lr=`mxl.session_part_id`,ur=`mxl.user_session_id`,dr=`mxl.user_session_previous_id`,fr=`mxl.user_session_number`,pr=`mxl.application.id`,I=`mxl.session_prev.`,mr={pageLabel:cr};function hr(e){return e.setValue(_r,!0)}function gr(e){return e.getValue(_r)===!0}var _r,vr=n((()=>{M(),_r=fe(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`)})),yr,br,xr=n((()=>{yr=`baggage`,br=4096}));function Sr(e){return e.reduce((e,t)=>{let n=`${e}${e===``?``:`,`}${t}`;return n.length>8192?e:n},``)}function Cr(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 wr(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}}function Tr(e,t,n,r){let i=0;for(;i<e.length&&n<180;){let a=e.indexOf(`,`,i),o=a===-1?e.length:a,s=o-i;if(s<=4096){let a=wr(e.substring(i,o));if(a){let e=(n===0?0:1)+s;if(r+e>8192)break;t[a.key]=a.metadata?{value:a.value,metadata:a.metadata}:{value:a.value},n++,r+=e}}if(a===-1)break;i=a+1}return[n,r]}var Er=n((()=>{M(),xr()})),Dr,Or=n((()=>{M(),vr(),xr(),Er(),Dr=class{inject(e,t,n){let r=A.getBaggage(e);if(!r||gr(e))return;let i=Sr(Cr(r).filter(e=>e.length<=br).slice(0,180));i.length>0&&n.set(t,yr,i)}extract(e,t,n){let r=n.get(t,yr);if(!r)return e;let i={},a=0,o=0;if(Array.isArray(r))for(let e=0;e<r.length;e++)[a,o]=Tr(r[e],i,a,o);else [a]=Tr(r,i,a,o);return a===0?e:A.setBaggage(e,A.createBaggage(i))}fields(){return[yr]}}}));function kr(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!Ar(n)){k.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!jr(r)){k.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function Ar(e){return typeof e==`string`&&e!==``}function jr(e){return e==null?!0:Array.isArray(e)?Mr(e):Nr(typeof e)}function Mr(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(Nr(e)){t=e;continue}return!1}return!1}}return!0}function Nr(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}var Pr=n((()=>{M()}));function Fr(){return e=>{k.error(Ir(e))}}function Ir(e){return typeof e==`string`?e:JSON.stringify(Lr(e))}function Lr(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}var Rr=n((()=>{M()}));function zr(e){try{Br(e)}catch(e){}}var Br,Vr=n((()=>{Rr(),Br=Fr()})),Hr=n((()=>{})),Ur,Wr=n((()=>{Ur=`2.10.0`})),Gr=n((()=>{})),Kr=n((()=>{Gr()})),qr=n((()=>{})),Jr=n((()=>{qr()})),Yr,Xr,Zr,Qr,$r,ei,ti,ni,ri,ii,ai,oi,si,ci,li,ui=n((()=>{Yr=`error.type`,Xr=`exception.message`,Zr=`exception.stacktrace`,Qr=`exception.type`,$r=`http.request.method`,ei=`http.request.method_original`,ti=`http.response.status_code`,ni=`server.address`,ri=`server.port`,ii=`service.name`,ai=`telemetry.sdk.language`,oi=`webjs`,si=`telemetry.sdk.name`,ci=`telemetry.sdk.version`,li=`url.full`})),di=n((()=>{})),fi=n((()=>{})),L=n((()=>{Kr(),Jr(),ui(),di(),fi()})),pi,mi=n((()=>{pi=`process.runtime.name`})),hi,gi=n((()=>{Wr(),L(),mi(),hi={[si]:`opentelemetry`,[pi]:`browser`,[ai]:oi,[ci]:Ur}})),R,_i=n((()=>{Hr(),gi(),R=performance}));function vi(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*Oi)]}function yi(e){return Ei(vi(R.timeOrigin),vi(typeof e==`number`?e:R.now()))}function bi(e){if(wi(e))return e;if(typeof e==`number`)return e<R.timeOrigin/2?yi(e):vi(e);if(e instanceof Date)return vi(e.getTime());throw TypeError(`Invalid input type`)}function xi(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=ki),[n,r]}function Si(e){return e[0]*ki+e[1]}function Ci(e){return e[0]*1e3+e[1]/1e6}function wi(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function Ti(e){return wi(e)||typeof e==`number`||e instanceof Date}function Ei(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=ki&&(n[1]-=ki,n[0]+=1),n}var Di,Oi,ki,Ai=n((()=>{_i(),Di=9,Oi=Math.pow(10,6),ki=Math.pow(10,Di)})),z,ji=n((()=>{(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(z||(z={}))})),Mi,Ni=n((()=>{M(),P(),Mi=class{constructor(e={}){var t;N(this,`_propagators`,void 0),N(this,`_fields`,void 0),this._propagators=(t=e.propagators)==null?[]:t;let n=new Set;for(let e of this._propagators){let t=typeof e.fields==`function`?e.fields():[];for(let e of t)n.add(e)}this._fields=Array.from(n)}inject(e,t,n){for(let r of this._propagators)try{r.inject(e,t,n)}catch(e){k.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){k.warn(`Failed to extract with ${r.constructor.name}. Err: ${e.message}`)}return e},e)}fields(){return this._fields.slice()}}}));function Pi(e){return zi.test(e)}function Fi(e){return Bi.test(e)&&!Vi.test(e)}var Ii,Li,Ri,zi,Bi,Vi,Hi=n((()=>{Ii=`[_0-9a-z-*/]`,Li=`[a-z]${Ii}{0,255}`,Ri=`[a-z0-9]${Ii}{0,240}@[a-z]${Ii}{0,13}`,zi=RegExp(`^(?:${Li}|${Ri})$`),Bi=/^[ -~]{0,255}[!-~]$/,Vi=/,|=/})),Ui,Wi,Gi,Ki,qi,Ji=n((()=>{Hi(),P(),Ui=32,Wi=512,Gi=`,`,Ki=`=`,qi=class e{constructor(e){N(this,`_length`,void 0),N(this,`_rawTraceState`,void 0),N(this,`_internalState`,void 0),this._rawTraceState=typeof e==`string`?e:``,this._length=this._rawTraceState.length}set(e,t){if(!Pi(e)||!Fi(t))return this;let n=this._getState(),r=n.get(e),i=this._length;if(typeof r==`string`?i+=t.length-r.length:i+=e.length+t.length+(n.size>0?2:1),i>Wi)return this;let a=new Map(n);return a.delete(e),a.set(e,t),this._fromState(a,i)}unset(e){let t=this._getState(),n=t.get(e);if(typeof n!=`string`)return this;let r=this._length-(e.length+n.length+1);t.size>1&&--r;let i=new Map(t);return i.delete(e),this._fromState(i,r)}get(e){return this._getState().get(e)}serialize(){let e=``,t=0;for(let n of this._getState())t>0&&(e=Gi+e),e=`${n[0]}${Ki}${n[1]}`+e,t++;return e}_getState(){if(this._internalState)return this._internalState;let e=this._rawTraceState.split(Gi),t=new Map,n=0;for(let r of e){let e=r.trim(),i=e.indexOf(Ki);if(i===-1)continue;let a=e.slice(0,i),o=e.slice(i+1);if(!Pi(a)||!Fi(o))continue;let s=n+e.length+ +(t.size>0);if(!(s>Wi)&&(t.set(a,o),n=s,t.size>=Ui))break}return this._length=n,this._internalState=new Map(Array.from(t.entries()).reverse()),this._internalState}_fromState(t,n){let r=Object.create(e.prototype);return r._internalState=t,r._length=n,r}}}));function Yi(e){let t=$i.exec(e);return!t||t[1]===`00`&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var Xi,Zi,Qi,$i,ea,ta=n((()=>{M(),vr(),Ji(),Xi=`traceparent`,Zi=`tracestate`,Qi=`00`,$i=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`),ea=class{inject(e,t,n){let r=j.getSpanContext(e);if(!r||gr(e)||!lt(r))return;let i=`${Qi}-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||D.NONE).toString(16)}`;n.set(t,Xi,i),r.traceState&&n.set(t,Zi,r.traceState.serialize())}extract(e,t,n){let r=n.get(t,Xi);if(!r)return e;let i=Array.isArray(r)?r[0]:r;if(typeof i!=`string`)return e;let a=Yi(i);if(!a)return e;a.isRemote=!0;let o=n.get(t,Zi);if(o){let e=Array.isArray(o)?o.join(`,`):o;a.traceState=new qi(typeof e==`string`?e:void 0)}return j.setSpanContext(e,a)}fields(){return[Xi,Zi]}}}));function na(e){if(!ra(e)||ia(e)!==sa)return!1;let t=fa(e);if(t===null)return!0;let n=ma.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&ua.call(n)===da}function ra(e){return typeof e==`object`&&!!e}function ia(e){return e==null?e===void 0?la:ca:ha&&ha in Object(e)?aa(e):oa(e)}function aa(e){let t=ma.call(e,ha),n=e[ha],r=!1;try{e[ha]=void 0,r=!0}catch(e){}let i=ga.call(e);return r&&(t?e[ha]=n:delete e[ha]),i}function oa(e){return ga.call(e)}var sa,ca,la,ua,da,fa,pa,ma,ha,ga,_a=n((()=>{sa=`[object Object]`,ca=`[object Null]`,la=`[object Undefined]`,ua=Function.prototype.toString,da=ua.call(Object),fa=Object.getPrototypeOf,pa=Object.prototype,ma=pa.hasOwnProperty,ha=Symbol?Symbol.toStringTag:void 0,ga=pa.toString}));function va(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=ba(t,e.shift(),0,n);return t}function ya(e){return Sa(e)?e.slice():e}function ba(e,t,n=0,r){let i;if(!(n>Da)){if(n++,Ta(e)||Ta(t)||Ca(t))i=ya(t);else if(Sa(e)){if(i=e.slice(),Sa(t))for(let e=0,n=t.length;e<n;e++)i.push(ya(t[e]));else if(wa(t)){let e=Object.keys(t);for(let n=0,r=e.length;n<r;n++){let r=e[n];r===`__proto__`||r===`constructor`||r===`prototype`||(i[r]=ya(t[r]))}}}else if(wa(e))if(wa(t)){if(!Ea(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];if(s===`__proto__`||s===`constructor`||s===`prototype`)continue;let c=t[s];if(Ta(c))c===void 0?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(xa(e,s,r)||xa(t,s,r))delete i[s];else{if(wa(a)&&wa(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]=ba(i[s],c,n,r)}}}}else i=t;return i}}function xa(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 Sa(e){return Array.isArray(e)}function Ca(e){return typeof e==`function`}function wa(e){return!Ta(e)&&!Sa(e)&&!Ca(e)&&typeof e==`object`}function Ta(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function Ea(e,t){return!(!na(e)||!na(t))}var Da,Oa=n((()=>{_a(),Da=20}));function ka(e,t){return typeof t==`string`?e===t:!!e.match(t)}function Aa(e,t){if(!t)return!1;for(let n of t)if(ka(e,n))return!0;return!1}var ja=n((()=>{})),Ma,Na=n((()=>{P(),Ma=class{constructor(){N(this,`_promise`,void 0),N(this,`_resolve`,void 0),N(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)}}})),Pa,Fa=n((()=>{Na(),P(),Pa=class{constructor(e,t){N(this,`_isCalled`,!1),N(this,`_deferred`,new Ma),N(this,`_callback`,void 0),N(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 Ia(e,t){return new Promise(n=>{O.with(hr(O.active()),()=>{e.export(t,n)})})}var La=n((()=>{M(),vr()})),Ra,B=n((()=>{Or(),P(),Pr(),Vr(),Rr(),Ai(),ji(),Er(),_i(),Ni(),ta(),M(),vr(),Ji(),Oa(),ja(),Fa(),La(),Ra={_export:Ia}}));B(),P();var za=class{constructor(e=window.performance){N(this,`_clock`,void 0),N(this,`epochMillisFromOriginOffset`,e=>this._clock.timeOrigin+e),N(this,`getNowHRTime`,()=>vi(this.getNowMillis())),N(this,`getNowMillis`,()=>this.epochMillisFromOriginOffset(this._clock.now())),N(this,`millisSinceHRTime`,e=>this.getNowMillis()-Ci(e)),N(this,`millisFromZeroTime`,e=>e),this._clock=e}},V,Ba=n((()=>{(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`})(V||(V={}))}));function Va(){return Ua}var Ha,Ua,Wa=n((()=>{Ha=class{emit(e){}enabled(){return!1}},Ua=new Ha}));function Ga(e,t,n){return r=>r===e?t:n}var Ka,qa,Ja=n((()=>{Ka=Symbol.for(`io.opentelemetry.js.api.logs`),qa=globalThis})),Ya,Xa,Za=n((()=>{Wa(),Ya=class{getLogger(e,t,n){return new Ha}},Xa=new Ya})),Qa,$a=n((()=>{Wa(),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)}enabled(e){return this._getLogger().enabled(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):Ua}}})),eo,to=n((()=>{Za(),$a(),eo=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?Xa:e}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){var r;return(r=this._delegate)==null?void 0:r.getLogger(e,t,n)}}})),no,ro=n((()=>{Ja(),Za(),to(),no=class e{constructor(){this._proxyLoggerProvider=new eo}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(e){return qa[Ka]?this.getLoggerProvider():(qa[Ka]=Ga(1,e,Xa),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,t;return(t=(e=qa[Ka])==null?void 0:e.call(qa,1))==null?this._proxyLoggerProvider:t}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){delete qa[Ka],this._proxyLoggerProvider=new eo}}})),io,H=n((()=>{Ba(),Wa(),ro(),io=no.getInstance()}));function ao(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 U(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?ao(Object(n),!0).forEach(function(t){N(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ao(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var W=n((()=>{P()}));M(),H(),P(),W();var oo=class{constructor(e,t,n){this.instrumentationName=e,this.instrumentationVersion=t,N(this,`_config`,{}),N(this,`_diag`,void 0),N(this,`_tracer`,void 0),N(this,`_meter`,void 0),N(this,`_logger`,void 0),this.setConfig(n),this._diag=k.createComponentLogger({namespace:e}),this._tracer=j.getTracer(e,t),this._meter=zt.getMeter(e,t),this._logger=io.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=U({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)}}};P();var G=class extends oo{constructor({instrumentationName:e,instrumentationVersion:t,config:n,diag:r,perf:i,limitManager:a}){super(e,t,n),N(this,`_userSessionManager`,void 0),N(this,`_logManager`,void 0),N(this,`_limitManager`,void 0),N(this,`_perf`,void 0),r&&(this._diag=r),this._perf=i==null?new za:i,this._userSessionManager=zn.getUserSessionManager(),this._logManager=vn.getLogManager(),this._limitManager=a}get limitManager(){return this._limitManager}get userSessionManager(){return this._userSessionManager}get logManager(){return this._logManager}get perf(){return this._perf}init(){}setLimitManager(e){this._limitManager=e}setLogManager(e){this._logManager=e}setUserSessionManager(e){this._userSessionManager=e}};P();let so=/\([^()]+\)/g;var co=class extends G{constructor({diag:e,shouldCleanupPathOptionsFromRouteName:t=!0}){super({config:{},diag:e,instrumentationName:`NavigationInstrumentation`,instrumentationVersion:`1.0.0`}),N(this,`_shouldCleanupPathOptionsFromRouteName`,!0),N(this,`_currentRouteSpan`,null),N(this,`_instrumentationType`,`manual`),N(this,`_removeSessionStartedFn`,null),N(this,`_removeSessionEndedFn`,null),N(this,`setInstrumentationType`,e=>{this._instrumentationType=e}),N(this,`setCurrentRoute`,e=>{if(!this._config.enabled)return;let t=Mn.getCurrentRoute();e.url!==(t==null?void 0:t.url)&&(Mn.setCurrentRoute(e),this._endRouteSpan(t),this._startRouteSpan(e),Tn.screenView())}),N(this,`_setupSessionListeners`,()=>{this._removeSessionStartedFn||(this._removeSessionStartedFn=this.userSessionManager.addSessionPartStartedListener(()=>{let e=Mn.getCurrentRoute();e&&!this._currentRouteSpan&&(this._diag.debug(`Session started, starting route span.`),this._startRouteSpan(e))})),this._removeSessionEndedFn||(this._removeSessionEndedFn=this.userSessionManager.addSessionPartEndedListener(()=>{this._currentRouteSpan&&(this._diag.debug(`Session ended, ending route span.`),this._endRouteSpan(Mn.getCurrentRoute()))}))}),N(this,`_cleanUpSessionListeners`,()=>{this._removeSessionStartedFn&&(this._removeSessionStartedFn(),this._removeSessionStartedFn=null),this._removeSessionEndedFn&&(this._removeSessionEndedFn(),this._removeSessionEndedFn=null)}),N(this,`_startRouteSpan`,e=>{this._diag.debug(`Starting route span for url: ${e.url}`),this._setupSessionListeners();let t=this._shouldCleanupPathOptionsFromRouteName?e.path.replace(so,``):e.path;return this._currentRouteSpan=this.tracer.startSpan(t,{attributes:{[F]:`ux.surface`,[or]:t,[sr]:Mn.getCurrentPageId()||void 0}}),this._currentRouteSpan.setAttribute(rr,this._instrumentationType),this._currentRouteSpan}),N(this,`_endRouteSpan`,e=>{this._currentRouteSpan&&(e&&this._diag.debug(`Ending route span for url: ${e.url}`),this._currentRouteSpan.end(),this._currentRouteSpan=null)}),N(this,`enable`,()=>{this.setConfig({enabled:!0}),this._diag.debug(`NavigationInstrumentation enabled, listening for navigation events.`)}),N(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 lo,uo=(e={})=>(lo||(lo=new co(e)),lo);function fo(e){let t=(e,t=2)=>String(e).padStart(t,`0`);return`${e.getUTCFullYear()}-${t(e.getUTCMonth()+1)}-${t(e.getUTCDate())} ${t(e.getUTCHours())}:${t(e.getUTCMinutes())}:${t(e.getUTCSeconds())}.${t(e.getUTCMilliseconds(),3)}`}function po(e){let t=/edg/i.test(e)?`Edge`:/opr|opera/i.test(e)?`Opera`:/chrome|crios/i.test(e)?`Chrome`:/firefox|fxios/i.test(e)?`Firefox`:/safari/i.test(e)?`Safari`:`Unknown`,n=/windows/i.test(e)?`Windows`:/mac os|macintosh/i.test(e)?`macOS`:/android/i.test(e)?`Android`:/iphone|ipad|ios/i.test(e)?`iOS`:/linux/i.test(e)?`Linux`:`Unknown`;return{browserName:t,deviceType:/mobile|iphone|android.*mobile/i.test(e)?`mobile`:/ipad|tablet/i.test(e)?`tablet`:`desktop`,osName:n}}function mo(e){try{return JSON.stringify(e).length}catch(e){return 64}}function ho(e,t){try{e(t)}catch(e){}}let go=[`log`,`info`,`warn`,`error`,`debug`],_o=2e3;function vo(e){let t={};for(let n of go){let r=console[n];t[n]=r,console[n]=(...t)=>{ho(e,{level:n,message:yo(t),type:`console`}),r.apply(console,t)}}return()=>{for(let e of go){let n=t[e];n&&(console[e]=n)}}}function yo(e){let t=e.map(e=>{if(typeof e==`string`)return e;if(e instanceof Error)return`${e.name}: ${e.message}`;try{return JSON.stringify(e)}catch(t){return String(e)}}).join(` `);return t.length>_o?`${t.slice(0,_o)}…`:t}M();function bo(){var e;let t=(e=j.getActiveSpan())==null?void 0:e.spanContext().traceId;return t&&t!==`00000000000000000000000000000000`?t:void 0}let xo=4e3;function So(e){let t=t=>{var n,r;ho(e,{errorStack:Co((n=t.error)==null?void 0:n.stack),level:`error`,message:t.message||String((r=t.error)==null?`Error`:r),traceId:bo(),type:`error`})},n=t=>{var n;let r=t.reason,i=typeof r==`string`?r:(n=r==null?void 0:r.message)==null?`Unhandled promise rejection`:n;ho(e,{errorStack:Co(typeof r==`object`?r==null?void 0:r.stack:void 0),level:`error`,message:i,traceId:bo(),type:`error`})};return window.addEventListener(`error`,t),window.addEventListener(`unhandledrejection`,n),()=>{window.removeEventListener(`error`,t),window.removeEventListener(`unhandledrejection`,n)}}function Co(e){if(e)return e.length>xo?`${e.slice(0,xo)}…`:e}function wo(e,t){let n=n=>{let r=n.target;r instanceof Element&&ho(e,{targetSelector:To(r),targetText:t?void 0:Eo(r),type:`click`})},r=t=>{let n=t.target;n instanceof Element&&ho(e,{targetSelector:To(n),type:`input`})};return document.addEventListener(`click`,n,!0),document.addEventListener(`input`,r,!0),()=>{document.removeEventListener(`click`,n,!0),document.removeEventListener(`input`,r,!0)}}function To(e){return`${e.tagName.toLowerCase()}${e.id?`#${e.id}`:``}${typeof e.className==`string`&&e.className.trim()?`.${e.className.trim().split(/\s+/)[0]}`:``}`}function Eo(e){var t;let n=((t=e.textContent)==null?``:t).trim().replace(/\s+/g,` `);if(n)return n.length>120?`${n.slice(0,120)}…`:n}function Do(e){let t=``,n=()=>{let n=location.href;n!==t&&(t=n,ho(e,{type:`navigation`,url:n}))};n();let r=history.pushState,i=history.replaceState;return history.pushState=function(...e){let t=r.apply(this,e);return n(),t},history.replaceState=function(...e){let t=i.apply(this,e);return n(),t},window.addEventListener(`popstate`,n),window.addEventListener(`hashchange`,n),()=>{history.pushState=r,history.replaceState=i,window.removeEventListener(`popstate`,n),window.removeEventListener(`hashchange`,n)}}function Oo(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 K(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){Oo(a,r,i,o,s,`next`,e)}function s(e){Oo(a,r,i,o,s,`throw`,e)}o(void 0)})}}var q=n((()=>{}));q(),W();function ko(e,t){let n=typeof window<`u`?window.fetch.bind(window):void 0;n&&(window.fetch=function(){var e=K(function*(e,t){let i=Ao(e),a=jo(e,t),o=bo(),s=performance.now();try{let c=yield n(e,t);return r(i,a,c.status,s,o),c}catch(e){throw r(i,a,0,s,o,String(e)),e}});return function(t,n){return e.apply(this,arguments)}}());let r=(n,r,i,a,o,s)=>{t(n)||ho(e,U({net:{durationMs:Math.round(performance.now()-a),method:r,status:i,url:n},traceId:o,type:`network`},s?{attrs:{error:s}}:{}))},i=typeof window<`u`?window.XMLHttpRequest:void 0,a=i==null?void 0:i.prototype.open,o=i==null?void 0:i.prototype.send;return i&&a&&o&&(i.prototype.open=function(e,t,...n){return this.__mxlMethod=String(e).toUpperCase(),this.__mxlUrl=typeof t==`string`?t:t.href,a.apply(this,[e,t,...n])},i.prototype.send=function(...e){let t=this,n=performance.now(),i=bo();return this.addEventListener(`loadend`,()=>{var e,a;r((e=t.__mxlUrl)==null?``:e,(a=t.__mxlMethod)==null?`GET`:a,this.status,n,i)}),o.apply(this,e)}),()=>{n&&(window.fetch=n),i&&a&&(i.prototype.open=a),i&&o&&(i.prototype.send=o)}}function Ao(e){return typeof e==`string`?e:e instanceof URL?e.href:e.url}function jo(e,t){var n;let r=(n=t==null?void 0:t.method)==null?typeof e==`object`&&`method`in e?e.method:void 0:n;return(r==null?`GET`:r).toUpperCase()}q();function Mo({config:e,sessionId:t,transport:n,onActivity:r,flushIntervalMs:i=5e3,flushBytes:a=65536}){let o=[],s=0,c=0,l=!1,u=e=>{l||(o.push({ev:e,seq:c++}),s+=mo(e),s>=a&&d())},d=function(){var e=K(function*(e=!1){if(o.length===0||l)return;r==null||r();let i=o;o=[],s=0;let a=i.map(({ev:e,seq:n})=>No(t,e,n));yield n.postSessionEvents(a,e)});return function(){return e.apply(this,arguments)}}(),f=[Do(u),wo(u,e.maskAllText),vo(u),ko(u,e=>n.shouldIgnoreUrl(e)),So(u)],p=i>0?setInterval(()=>{d()},i):void 0;return{flush:d,pause:()=>{l=!0},resume:()=>{l=!1},stop:()=>{p&&clearInterval(p);for(let e of f)e()}}}function No(e,t,n){var r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b;return{attributes:(r=t.attrs)==null?{}:r,error_stack:(i=t.errorStack)==null?``:i,level:(a=t.level)==null?``:a,message:(o=t.message)==null?``:o,net_duration_ms:(s=(c=t.net)==null?void 0:c.durationMs)==null?0:s,net_method:(l=(u=t.net)==null?void 0:u.method)==null?``:l,net_status:(d=(f=t.net)==null?void 0:f.status)==null?0:d,net_url:(p=(m=t.net)==null?void 0:m.url)==null?``:p,seq:n,session_id:e,target_selector:(h=t.targetSelector)==null?``:h,target_text:(g=t.targetText)==null?``:g,timestamp:fo(new Date((_=t.timestamp)==null?Date.now():_)),trace_id:(v=(y=t.traceId)==null?bo():y)==null?``:v,type:t.type,url:(b=t.url)==null?typeof location<`u`?location.href:``:b}}q();let Po=`https://unpkg.com/rrweb@2.0.0-alpha.20/dist/rrweb.umd.cjs`,Fo,Io,Lo=Po;function Ro(e){Lo=e,Fo=void 0}function zo(e){return new Promise((t,n)=>{let r=document.createElement(`script`);r.src=e,r.async=!0,r.onload=()=>t(),r.onerror=n,document.head.appendChild(r)})}function Bo(){return Vo.apply(this,arguments)}function Vo(){return Vo=K(function*(){if(typeof window>`u`)throw Error(`no browser`);if(window.rrweb)return window.rrweb;if(yield zo(Lo),!window.rrweb)throw Error(`no rrweb`);return window.rrweb}),Vo.apply(this,arguments)}function Ho(){return Io?Io():(Fo===void 0&&(Fo=Bo()),Fo)}function Uo(){Fo=void 0,Io=void 0,Lo=Po}function Wo(e){Io=e,Fo=void 0}q();function Go(e){return Ko.apply(this,arguments)}function Ko(){return Ko=K(function*(e){let t=new Blob([e]).stream().pipeThrough(new CompressionStream(`gzip`)),n=yield new Response(t).arrayBuffer();return new Uint8Array(n)}),Ko.apply(this,arguments)}q(),W();function qo({config:e,sessionId:t,transport:n,chunkSeqStore:r,rrwebModule:i,onActivity:a,flushIntervalMs:o=5e3,flushBytes:s=102400}){let c=[],l=0,u=!1,d=0,f=!1,p=function(){var e=K(function*(e=!1){if(c.length===0)return;a==null||a();let i=c,o=u,s=r.nextChunkSeq(t),d=i[0].timestamp,f=i[i.length-1].timestamp;c=[],l=0,u=!1;let p=yield Go(new TextEncoder().encode(JSON.stringify(i)));yield n.postSessionBlob({chunkSeq:s,durationMs:Math.max(0,f-d),eventCount:i.length,isCheckpoint:o,sessionId:t},p,e)});return function(){return e.apply(this,arguments)}}(),{record:m}=i,h=m(U(U({checkoutEveryNms:3e4,emit:(e,t)=>{var n;if(f)return;let r=e;(t===!0||r.type===2)&&(u=!0),r.type===3&&((n=r.data)==null?void 0:n.source)===2&&r.data.type===2&&d++,c.push(r),l+=mo(r),l>=s&&p()},maskAllInputs:e.maskAllInputs},e.maskAllText?{maskTextSelector:`*`}:{}),e.rrwebOptions)),g=o>0?setInterval(()=>{p()},o):void 0;return{flush:p,getClickCount:()=>d,pause:()=>{f=!0},resume:()=>{f=!1},stop:()=>{g&&clearInterval(g),h==null||h()}}}let Jo=new Set;function Yo(e){!e||e===`00000000000000000000000000000000`||Jo.add(e)}function Xo(){return Array.from(Jo)}function Zo(){Jo.clear()}let Qo=`__MXL_REPLAY_SESSION__`;function $o(e){globalThis[Qo]={recordTraceId:Yo,sessionId:e}}function es(){delete globalThis[Qo]}function ts(e){let t=e=>`replay.chunkSeq.${e}`;return{nextChunkSeq(n){let r=e.getItem(t(n)),i=r===null?0:Number.parseInt(r,10),a=Number.isFinite(i)?i:0;return e.setItem(t(n),String(a+1)),a}}}function ns(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 rs(e,t){if(e==null)return{};var n,r,i=ns(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 is=[`debug`,`enabled`,`sampleRate`,`maskAllInputs`,`maskAllText`,`flushIntervalMs`,`omitRedundantInstrumentations`];function as(e,t,n=!0){let r=t==null?{}:t,{debug:i=!1,enabled:a,sampleRate:o,maskAllInputs:s=!0,maskAllText:c=!0,flushIntervalMs:l=5e3,omitRedundantInstrumentations:u}=r,d=rs(r,is);return{appID:e.appID,appVersion:e.appVersion,debug:i,environment:void 0,flushIntervalMs:l,maskAllInputs:s,maskAllText:c,replayEnabled:a==null?n:a,replaySampleRate:o==null?1:o,rrwebOptions:d,serviceName:e.serviceName,userID:e.userID}}W();function os(e){let t=!1,n=()=>{var n;t||(t=!0,e.recorder.flush(!0),e.events.flush(!0),e.transport.postSessionMeta(ss(e.config,e.sessionId,e.startedAt,2,`ended`,e.recorder.getClickCount()),!0),e.recorder.stop(),e.events.stop(),Zo(),(n=e.onFinalize)==null||n.call(e))},r=()=>{document.visibilityState===`hidden`&&n()};return document.addEventListener(`visibilitychange`,r),window.addEventListener(`pagehide`,n),()=>{document.removeEventListener(`visibilitychange`,r),window.removeEventListener(`pagehide`,n)}}function ss(e,t,n,r,i,a){var o;let s=po(navigator.userAgent),c=new Date,l={browser_name:s.browserName,device_type:s.deviceType,os_name:s.osName,resource_attributes:U(U({},e.environment?{"deployment.environment":e.environment,"deployment.environment.name":e.environment}:{}),e.appVersion?{"deployment.commit_sha":e.appVersion}:{}),service_name:(o=e.serviceName)==null?``:o,session_id:t,start_time:fo(n),status:i,url_initial:window.location.href,user_agent:navigator.userAgent,user_id:ls(),version:r};return i===`ended`&&(l.click_count=a==null?0:a,l.duration_ms=Math.max(0,c.getTime()-n.getTime()),l.end_time=fo(c),l.trace_ids=Xo()),l}function cs(e){let t=e.getUserSessionStartTime();return new Date(t==null?Date.now():t)}function ls(){var e;return(e=er.getUserId())==null?``:e}P(),q();var us=class{constructor({context:e,userSessionManager:t,sessionStorage:n,rrwebOptions:r,recordUserSessions:i=!0,diag:a}){N(this,`_context`,void 0),N(this,`_userSessionManager`,void 0),N(this,`_chunkSeqStore`,void 0),N(this,`_config`,void 0),N(this,`_diag`,void 0),N(this,`_recordUserSessions`,void 0),N(this,`_active`,void 0),N(this,`_paused`,!1),N(this,`_enableRequested`,!1),N(this,`_startInProgress`,!1),N(this,`_stopInProgress`,!1),N(this,`_removeSessionStartedListener`,void 0),this._context=e,this._userSessionManager=t,this._chunkSeqStore=ts(n),this._recordUserSessions=i,this._config=as(e,r,i),this._diag=a==null?{debug:()=>void 0,error:()=>void 0,info:()=>void 0,verbose:()=>void 0,warn:()=>void 0}:a}isRecording(){return!!this._active&&!this._paused}enable(e){if(!this._recordUserSessions&&!(e!=null&&e.force)){this._diag.debug(`recordUserSessions disabled, waiting for manual enable`);return}this._enableRequested=!0,this._paused=!1,this._tryStart()}pause(){this._active&&(this._enableRequested=!1,this._paused=!0,this._active.recorder.pause(),this._active.events.pause())}resume(){if(!this._active){this.enable();return}let e=this._paused;this._enableRequested=!0,this._paused=!1,this._active.recorder.resume(),this._active.events.resume(),e&&this._active.rrwebModule.record.takeFullSnapshot()}stop(){var e=this;return K(function*(){var t;if(e._enableRequested=!1,e._paused=!1,(t=e._removeSessionStartedListener)==null||t.call(e),e._removeSessionStartedListener=void 0,!e._active){es(),Zo();return}if(e._stopInProgress)return;e._stopInProgress=!0;let n=e._active;e._active=void 0;try{var r;(r=n.removeSessionEndListener)==null||r.call(n),n.removeLifecycle(),yield n.recorder.flush(!0),yield n.events.flush(!0),n.recorder.stop(),n.events.stop()}finally{es(),Zo(),e._stopInProgress=!1}})()}_tryStart(){var e=this;return K(function*(){if(!e._enableRequested||e._active||e._startInProgress||e._stopInProgress)return;if(typeof window>`u`){e._diag.warn(`session replay cannot run in non-browser environments`);return}let t=e._userSessionManager.getUserSessionId();if(t===null){e._removeSessionStartedListener||(e._removeSessionStartedListener=e._userSessionManager.addSessionPartStartedListener(()=>{var t;(t=e._removeSessionStartedListener)==null||t.call(e),e._removeSessionStartedListener=void 0,e._tryStart()}));return}if(e._config.replayEnabled){if(Math.random()>=e._config.replaySampleRate){e._diag.debug(`session replay skipped by sample rate`);return}e._startInProgress=!0;try{let n=yield Ho();if(!e._enableRequested||e._active)return;$o(t),Zo();let r=cs(e._userSessionManager),i=()=>{},a=qo({chunkSeqStore:e._chunkSeqStore,config:e._config,flushIntervalMs:e._config.flushIntervalMs,onActivity:i,rrwebModule:n,sessionId:t,transport:e._context.transport}),o=Mo({config:e._config,flushIntervalMs:e._config.flushIntervalMs,onActivity:i,sessionId:t,transport:e._context.transport});e._context.transport.postReplay(),e._context.transport.postSessionMeta(ss(e._config,t,r,1,`active`,null)),e._active={events:o,recorder:a,removeLifecycle:globalThis.__MXL_TEST_SKIP_REPLAY_LIFECYCLE__===!0?()=>void 0:os({config:e._config,events:o,onFinalize:()=>{e._active=void 0,es(),Zo()},recorder:a,sessionId:t,startedAt:r,transport:e._context.transport}),removeSessionEndListener:e._userSessionManager.addSessionPartEndedListener(()=>{a.flush(!0),o.flush(!0)}),rrwebModule:n},e._diag.debug(`session recording started`)}catch(t){e._diag.error(`failed to start session recording`,t)}finally{e._startInProgress=!1}}})()}};P(),q();var ds=class extends G{constructor(e={}){super({config:{},diag:e.diag,instrumentationName:`ReplayInstrumentation`,instrumentationVersion:`2.0.0`,perf:e.perf}),N(this,`_args`,void 0),N(this,`_sessionRecording`,void 0),N(this,`_wasPaused`,!1),N(this,`_stopPromise`,void 0),this._args=e,(!e.replayContext||!e.sessionStorage)&&this._diag.warn(`replayContext and sessionStorage are required for session recording`),this._config.enabled||this._diag.debug(`disabled, not starting`)}setUserSessionManager(e){super.setUserSessionManager(e),this._ensureSessionRecording(),this._config.enabled&&this._args.recordUserSessions!==!1&&this._args.replayContext&&this._args.sessionStorage&&this.enable()}_ensureSessionRecording(){if(this._sessionRecording)return this._sessionRecording;let{replayContext:e,sessionStorage:t,recordUserSessions:n,rrwebOptions:r}=this._args;if(!(!e||!t))return this._sessionRecording=new us({context:e,diag:this._diag,recordUserSessions:n,rrwebOptions:r,sessionStorage:t,userSessionManager:this.userSessionManager}),this._sessionRecording}isRecording(){var e,t;return(e=(t=this._sessionRecording)==null?void 0:t.isRecording())==null?!1:e}enable(e){this._wasPaused=!1,this._enableWhenReady(e)}pause(){var e;this._wasPaused=!0,(e=this._sessionRecording)==null||e.pause()}resume(){if(this._wasPaused){this._resumeWhenReady();return}this._enableWhenReady({force:!0})}_enableWhenReady(e){var t=this;return K(function*(){var n;yield t._stopPromise,(n=t._ensureSessionRecording())==null||n.enable(e)})()}_resumeWhenReady(){var e=this;return K(function*(){var t;yield e._stopPromise,(t=e._sessionRecording)==null||t.resume(),e._wasPaused=!1})()}disable(){let e=this._sessionRecording;e&&(this._stopPromise=e.stop().finally(()=>{this._sessionRecording===e&&(this._sessionRecording=void 0),this._stopPromise=void 0}))}waitForDisable(){var e=this;return K(function*(){yield e._stopPromise})()}};function fs(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 ps(e){e.forEach(e=>e.disable())}var ms=n((()=>{}));function hs(e){var t,n;let r=e.tracerProvider||j.getTracerProvider(),i=e.meterProvider||zt.getMeterProvider(),a=e.loggerProvider||io.getLoggerProvider(),o=(t=(n=e.instrumentations)==null?void 0:n.flat())==null?[]:t;return fs(o,r,i,a),()=>{ps(o)}}var gs=n((()=>{M(),H(),ms()}));function _s(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})}function vs(e){e&&e.logger&&(typeof e.logger==`function`?J=e.logger:J(`new logger isn't a function, not replacing`))}var J,ys,bs,xs,Ss,Cs=n((()=>{J=console.error.bind(console),ys=(e,t,n)=>{if(!e||!e[t]){J(`no original function `+String(t)+` to wrap`);return}if(!n){J(`no wrapper function`),J(Error().stack);return}let r=e[t];if(typeof r!=`function`||typeof n!=`function`){J(`original object and wrapper must be functions`);return}let i=n(r,t);return _s(i,`__original`,r),_s(i,`__unwrap`,()=>{e[t]===i&&_s(e,t,r)}),_s(i,`__wrapped`,!0),_s(e,t,i),i},bs=(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{J(`must provide one or more modules to patch`),J(Error().stack);return}if(!(t&&Array.isArray(t))){J(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{ys(e,t,n)})})},xs=(e,t)=>{if(!e||!e[t]){J(`no function to unwrap.`),J(Error().stack);return}let n=e[t];if(!n.__unwrap)J(`no original to unwrap to -- has `+String(t)+` already been unwrapped?`);else{n.__unwrap();return}},Ss=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{J(`must provide one or more modules to patch`),J(Error().stack);return}if(!(t&&Array.isArray(t))){J(`must provide one or more functions to unwrap on modules`);return}e.forEach(e=>{t.forEach(t=>{xs(e,t)})})},vs.wrap=ys,vs.massWrap=bs,vs.unwrap=xs,vs.massUnwrap=Ss})),ws,Ts=n((()=>{M(),H(),Cs(),P(),W(),ws=class{constructor(e,t,n){N(this,`_config`,{}),N(this,`_tracer`,void 0),N(this,`_meter`,void 0),N(this,`_logger`,void 0),N(this,`_diag`,void 0),N(this,`instrumentationName`,void 0),N(this,`instrumentationVersion`,void 0),N(this,`_wrap`,ys),N(this,`_unwrap`,xs),N(this,`_massWrap`,bs),N(this,`_massUnwrap`,Ss),this.instrumentationName=e,this.instrumentationVersion=t,this.setConfig(n),this._diag=k.createComponentLogger({namespace:e}),this._tracer=j.getTracer(e,t),this._meter=zt.getMeter(e,t),this._logger=io.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=U({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)}}}})),Es,Ds=n((()=>{Ts(),Es=class extends ws{constructor(e,t,n){super(e,t,n),this._config.enabled&&this.enable()}}})),Os=n((()=>{Ds(),M()}));function ks(e,t,n){let r,i;try{i=e()}catch(e){r=e}finally{if(t(r,i),r&&!n)throw r;return i}}var As=n((()=>{})),js=n((()=>{gs(),Os(),P(),As()}));function Ms(){if(Ns===void 0)try{let e=globalThis.process.argv0;Ns=e?`unknown_service:${e}`:`unknown_service`}catch(e){Ns=`unknown_service`}return Ns}var Ns,Ps=n((()=>{})),Fs,Is=n((()=>{Fs=e=>typeof e==`object`&&!!e&&typeof e.then==`function`}));function Ls(e,t){return Us.FromAttributeList(Object.entries(e),t)}function Rs(){return Ls({})}function zs(){return Ls({[ii]:Ms(),[ai]:hi[ai],[si]:hi[si],[ci]:hi[ci]})}function Bs(e){return e.map(([e,t])=>Fs(t)?[e,t.catch(t=>{k.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function Vs(e){if(typeof e==`string`||e===void 0)return e;k.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function Hs(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;k.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}var Us,Ws=n((()=>{M(),B(),L(),Ps(),Is(),P(),q(),Us=class e{static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=Bs(t),r._asyncAttributesPending=t.filter(([e,t])=>Fs(t)).length>0,r}constructor(e,t){var n;N(this,`_rawAttributes`,void 0),N(this,`_asyncAttributesPending`,!1),N(this,`_schemaUrl`,void 0),N(this,`_memoizedAttributes`,void 0);let r=(n=e.attributes)==null?{}:n;this._rawAttributes=Object.entries(r).map(([e,t])=>(Fs(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=Bs(this._rawAttributes),this._schemaUrl=Vs(t==null?void 0:t.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}waitForAsyncAttributes(){var e=this;return K(function*(){if(e.asyncAttributesPending){for(let t=0;t<e._rawAttributes.length;t++){let[n,r]=e._rawAttributes[t];e._rawAttributes[t]=[n,Fs(r)?yield r:r]}e._asyncAttributesPending=!1}})()}get attributes(){if(this.asyncAttributesPending&&k.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(Fs(n)){k.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=Hs(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}}})),Gs=n((()=>{M(),Ws(),L(),B(),P(),Ps()}));M();let Ks=fe(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function qs(e){return e.setValue(Ks,!0)}M();function Js(){return e=>{k.error(Ys(e))}}function Ys(e){return typeof e==`string`?e:JSON.stringify(Xs(e))}function Xs(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 Zs=Js();function Qs(e){try{Zs(e)}catch(e){}}L();let $s={[si]:`opentelemetry`,"process.runtime.name":`browser`,[ai]:oi,[ci]:`2.9.0`},ec=performance,tc=Math.pow(10,6),nc=Math.pow(10,9);function rc(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*tc)]}function ic(e){return cc(rc(ec.timeOrigin),rc(typeof e==`number`?e:ec.now()))}function ac(e){if(sc(e))return e;if(typeof e==`number`)return e<ec.timeOrigin/2?ic(e):rc(e);if(e instanceof Date)return rc(e.getTime());throw TypeError(`Invalid input type`)}function oc(e){return e[0]*nc+e[1]}function sc(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function cc(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=nc&&(n[1]-=nc,n[0]+=1),n}var lc;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(lc||(lc={}));var uc=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function dc(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new uc(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}P();var fc=class{constructor(){N(this,`_promise`,void 0),N(this,`_resolve`,void 0),N(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)}};P();var pc=class{constructor(e,t){N(this,`_isCalled`,!1),N(this,`_deferred`,new fc),N(this,`_callback`,void 0),N(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 mc;function hc(){if(mc===void 0)try{let e=globalThis.process.argv0;mc=e?`unknown_service:${e}`:`unknown_service`}catch(e){mc=`unknown_service`}return mc}let gc=e=>typeof e==`object`&&!!e&&typeof e.then==`function`;M(),L(),P(),q();var _c=class e{static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=bc(t),r._asyncAttributesPending=t.filter(([e,t])=>gc(t)).length>0,r}constructor(e,t){var n;N(this,`_rawAttributes`,void 0),N(this,`_asyncAttributesPending`,!1),N(this,`_schemaUrl`,void 0),N(this,`_memoizedAttributes`,void 0);let r=(n=e.attributes)==null?{}:n;this._rawAttributes=Object.entries(r).map(([e,t])=>(gc(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=bc(this._rawAttributes),this._schemaUrl=xc(t==null?void 0:t.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}waitForAsyncAttributes(){var e=this;return K(function*(){if(e.asyncAttributesPending){for(let t=0;t<e._rawAttributes.length;t++){let[n,r]=e._rawAttributes[t];e._rawAttributes[t]=[n,gc(r)?yield r:r]}e._asyncAttributesPending=!1}})()}get attributes(){if(this.asyncAttributesPending&&k.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(gc(n)){k.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=Sc(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function vc(e,t){return _c.FromAttributeList(Object.entries(e),t)}function yc(){return vc({[ii]:hc(),[ai]:$s[ai],[si]:$s[si],[ci]:$s[ci]})}function bc(e){return e.map(([e,t])=>gc(t)?[e,t.catch(t=>{k.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function xc(e){if(typeof e==`string`||e===void 0)return e;k.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function Sc(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;k.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}M();function Cc(e){return wc(e,new WeakSet)}function wc(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)){for(let n of e)if(!wc(n,t))return!1;return!0}let n=e;if(n.constructor!==Object&&n.constructor!==void 0)return!1;for(let e in n)if(Object.prototype.hasOwnProperty.call(n,e)&&!wc(n[e],t))return!1;return!0}return!1}var Y;(function(e){e[e.DROP_INVALID=0]=`DROP_INVALID`,e[e.DROP_LIMIT_REACHED=1]=`DROP_LIMIT_REACHED`,e[e.ADD_NEW=2]=`ADD_NEW`,e[e.ADD_OVERWRITE_EXISTING=3]=`ADD_OVERWRITE_EXISTING`})(Y||(Y={}));function Tc(e,t,n,r,i){if(r.length===0)return k.warn(`Invalid attribute key: ${r}`),Y.DROP_INVALID;if(!Cc(i))return k.warn(`Invalid attribute value set for key: ${r}`),Y.DROP_INVALID;let a=!Object.prototype.hasOwnProperty.call(e,r);return a&&n>=t.attributeCountLimit?Y.DROP_LIMIT_REACHED:(e[r]=Ec(i,t.attributeValueLengthLimit),a?Y.ADD_NEW:Y.ADD_OVERWRITE_EXISTING)}function Ec(e,t){if(t<=0)return k.warn(`Attribute value limit must be positive, got ${t}`),e;if(e==null)return e;if(typeof e==`string`)return e.length<=t?e:e.substring(0,t);if(e instanceof Uint8Array)return e;if(Array.isArray(e))return e.map(e=>Ec(e,t));if(typeof e==`object`){let n={};for(let[r,i]of Object.entries(e))n[r]=Ec(i,t);return n}return e}function Dc(e,t){if(t==null)return{};let n={},r=0,i=0;for(let[a,o]of Object.entries(t)){let t=Tc(n,e,r,a,o);t===Y.ADD_NEW?r+=1:(t===Y.DROP_INVALID||t===Y.DROP_LIMIT_REACHED)&&(i+=1)}return{attributes:r>0?n:void 0,droppedAttributesCount:i}}M(),L(),P();var Oc=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._droppedAttributesCount}constructor(e,t,n){N(this,`hrTime`,void 0),N(this,`hrTimeObserved`,void 0),N(this,`spanContext`,void 0),N(this,`resource`,void 0),N(this,`instrumentationScope`,void 0),N(this,`attributes`,{}),N(this,`_severityText`,void 0),N(this,`_severityNumber`,void 0),N(this,`_body`,void 0),N(this,`_eventName`,void 0),N(this,`_attributesCount`,0),N(this,`_droppedAttributesCount`,0),N(this,`_isReadonly`,!1),N(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=ac(r==null?f:r),this.hrTimeObserved=ac(i==null?f:i),d){let e=j.getSpanContext(d);e&<(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){if(this._isLogRecordReadonly())return this;let n=Tc(this.attributes,this._logRecordLimits,this._attributesCount,e,t);return n===Y.DROP_LIMIT_REACHED?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&k.warn(`Dropping extra attributes.`)):n===Y.ADD_NEW&&this._attributesCount++,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}_setException(e){let t=!1;if(typeof e==`string`||typeof e==`number`)Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(Xr,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(Qr,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(Qr,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(Xr,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,`exception.stacktrace`)||this.setAttribute(Zr,n.stack),t=!0)}t||k.warn(`Failed to record an exception ${e}`)}_isLogRecordReadonly(){return this._isReadonly&&k.warn(`Can not execute the operation on emitted log record`),this._isReadonly}};H(),M(),P(),W();var kc=class{constructor(e,t){N(this,`_instrumentationScope`,void 0),N(this,`_sharedState`,void 0),N(this,`_loggerConfig`,void 0),this._instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this._instrumentationScope)}emit(e){let t=e.context||O.active();if(!this.enabled(e))return;let n=new Oc(this._sharedState,this._instrumentationScope,U({context:t},e));this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(n,t),n._makeReadonly()}enabled(e){if(this._sharedState.hasShutdown)return!1;let t=this._loggerConfig;if(t.disabled)return!1;let n=e==null?void 0:e.severityNumber;if(typeof n==`number`&&n!==V.UNSPECIFIED&&n<t.minimumSeverity)return!1;let r=(e==null?void 0:e.context)||O.active();if(t.traceBased){let e=j.getSpanContext(r);if(e&<(e)&&(e.traceFlags&D.SAMPLED)!==D.SAMPLED)return!1}let i={context:r,instrumentationScope:this._instrumentationScope,severityNumber:e==null?void 0:e.severityNumber,eventName:e==null?void 0:e.eventName};for(let e of this._sharedState.processors)if(!e.enabled||e.enabled(i))return!0;return!1}},Ac=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}};P(),q();var jc=class{constructor(e,t){N(this,`processors`,void 0),N(this,`forceFlushTimeoutMillis`,void 0),this.processors=e,this.forceFlushTimeoutMillis=t}forceFlush(){var e=this;return K(function*(){let t=e.forceFlushTimeoutMillis;yield Promise.all(e.processors.map(e=>dc(e.forceFlush(),t)))})()}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}shutdown(){var e=this;return K(function*(){yield Promise.all(e.processors.map(e=>e.shutdown()))})()}enabled(e){for(let t of this.processors)if(!t.enabled||t.enabled(e))return!0;return!1}};function Mc(e){if(e===void 0)return[`u`,null];if(e===null)return[`n`,null];let t=typeof e;return t===`string`?[`s`,e]:t===`boolean`?[`b`,e]:t===`number`?Number.isNaN(e)?[`nan`,null]:e===1/0?[`inf`,null]:e===-1/0?[`-inf`,null]:Object.is(e,-0)?[`n0`,null]:[`d`,e]:e instanceof Uint8Array?[`bytes`,Array.from(e)]:Array.isArray(e)?[`arr`,e.map(Mc)]:[`map`,Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>[e,Mc(t)])]}function Nc(e){var t;return JSON.stringify([e.name,e.version||``,e.schemaUrl||``,Mc(e.attributes),(t=e.droppedAttributesCount)==null?0:t])}P();var Pc=class{constructor(e){N(this,`createdLogs`,void 0),this.createdLogs=e.createCounter(`otel.sdk.log.created`,{unit:`{log_record}`,description:`The number of logs submitted to enabled SDK Loggers.`})}emitLog(){this.createdLogs.add(1)}};M(),H(),W(),P();let Fc={disabled:!1,minimumSeverity:V.UNSPECIFIED,traceBased:!1},Ic=()=>U({},Fc);var Lc=class{constructor(e,t,n,r,i,a){N(this,`loggers`,new Map),N(this,`activeProcessor`,void 0),N(this,`registeredLogRecordProcessors`,[]),N(this,`resource`,void 0),N(this,`forceFlushTimeoutMillis`,void 0),N(this,`logRecordLimits`,void 0),N(this,`processors`,void 0),N(this,`loggerMetrics`,void 0),N(this,`hasShutdown`,!1),N(this,`_loggerConfigurator`,void 0),N(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 jc(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new Ac,this._loggerConfigurator=i==null?Ic:i;let o=a?a.getMeter(`@opentelemetry/sdk-logs`,`0.220.0`):ve();this.loggerMetrics=new Pc(o)}getLoggerConfig(e){let t=Nc(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}};M(),H(),P(),W();var Rc=class{constructor(e={}){var t,n,r,i,a,o,s,c;N(this,`_shutdownOnce`,void 0),N(this,`_sharedState`,void 0);let l={resource:(t=e.resource)==null?yc():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?Ic:s,processors:(c=e.processors)==null?[]:c,meterProvider:e.meterProvider};this._sharedState=new Lc(l.resource,l.forceFlushTimeoutMillis,l.logRecordLimits,l.processors,l.loggerConfigurator,l.meterProvider),this._shutdownOnce=new pc(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return k.warn(`A shutdown LoggerProvider cannot provide a Logger`),Va();e||k.warn(`Logger requested without instrumentation scope name.`);let r=U({name:e||`unknown`,version:t,schemaUrl:n==null?void 0:n.schemaUrl},Dc(this._sharedState.logRecordLimits,n==null?void 0:n.attributes)),i=Nc(r);return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new kc(r,this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(k.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(k.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.hasShutdown=!0,this._sharedState.activeProcessor.shutdown()}};M(),q(),P();function zc(e){return Bc.apply(this,arguments)}function Bc(){return Bc=K(function*(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];r.resource.asyncAttributesPending&&r.resource.waitForAsyncAttributes&&t.push(r.resource.waitForAsyncAttributes())}t!=null&&t.length>0&&(yield Promise.all(t))}),Bc.apply(this,arguments)}var Vc=class{constructor(e,t,n){N(this,`_exportCompleted`,void 0),N(this,`_exportScheduledPromise`,void 0),N(this,`_exportScheduledResolve`,void 0),this._exportScheduledPromise=new Promise(e=>{this._exportScheduledResolve=e}),this._exportCompleted=this._executeExport(e,t,n)}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}_executeExport(e,t,n){var r=this;return K(function*(){try{yield zc(t),yield O.with(qs(O.active()),K(function*(){return r._exportWithTimeout(e,t,n)}))}catch(e){Qs(e),r._exportScheduledResolve()}})()}_exportWithTimeout(e,t,n){var r=this;return K(function*(){return new Promise((i,a)=>{let o=setTimeout(()=>{a(Error(`Timeout`))},n);e.export(t,e=>{if(clearTimeout(o),e.code===lc.SUCCESS)i();else{var t;a((t=e.error)==null?Error(`BatchLogRecordProcessor: log record export failed`):t)}}),r._exportScheduledResolve()})})()}},Hc=class{constructor(e){var t,n,r,i;N(this,`_maxExportBatchSize`,void 0),N(this,`_maxQueueSize`,void 0),N(this,`_scheduledDelayMillis`,void 0),N(this,`_exportTimeoutMillis`,void 0),N(this,`_exporter`,void 0),N(this,`_currentExport`,null),N(this,`_finishedLogRecords`,[]),N(this,`_timer`,void 0),N(this,`_shutdownOnce`,void 0),N(this,`_flushing`,!1),this._exporter=e.exporter,this._maxExportBatchSize=(t=e.maxExportBatchSize)==null?512:t,this._maxQueueSize=(n=e.maxQueueSize)==null?2048:n,this._scheduledDelayMillis=(r=e.scheduledDelayMillis)==null?1e3:r,this._exportTimeoutMillis=(i=e.exportTimeoutMillis)==null?3e4:i,this._shutdownOnce=new pc(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(k.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()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}shutdown(){return this._shutdownOnce.call()}_shutdown(){var e=this;return K(function*(){e.onShutdown(),yield e._flushAll(),yield e._exporter.shutdown()})()}_flushAll(){var e=this;return K(function*(){if(e._flushing)return;e._flushing=!0;let t=e._finishedLogRecords;e._finishedLogRecords=[],e._clearTimer();let n=e._currentExport;for(n!==null&&(yield e._exporter.forceFlush(),yield n.exportCompleted,e._currentExport=null);t.length>0;){let n;t.length<=e._maxExportBatchSize?(n=t,t=[]):n=t.splice(0,e._maxExportBatchSize);let r=new Vc(e._exporter,n,e._exportTimeoutMillis);e._currentExport=r;try{yield r.exportScheduled,yield e._exporter.forceFlush(),yield r.exportCompleted}catch(e){Qs(e)}finally{e._currentExport=null}}e._flushing=!1,e._maybeStartTimer()})()}_extractBatch(){if(this._finishedLogRecords.length===0)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){let e=this._finishedLogRecords;return this._finishedLogRecords=[],e}else return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();let e=this._extractBatch();if(e===null)return;let t=new Vc(this._exporter,e,this._exportTimeoutMillis);this._currentExport=t,t.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(e=>{this._currentExport=null,Qs(e),this._maybeStartTimer()})}_maybeStartTimer(){if(!this._shutdownOnce.isCalled&&!this._flushing&&this._finishedLogRecords.length!==0&&this._currentExport===null){if(this._finishedLogRecords.length>=this._maxExportBatchSize){this._exportOneBatch();return}this._timer===void 0&&(this._timer=setTimeout(()=>{this._timer=void 0,this._exportOneBatch()},this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}};P();var Uc=class extends Hc{constructor(e){super(e),N(this,`_visibilityChangeListener`,void 0),N(this,`_pageHideListener`,void 0),this._onInit(e)}onShutdown(){typeof document>`u`||(this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener(`pagehide`,this._pageHideListener))}_onInit(e){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))}},Wc,Gc=n((()=>{Wc=`exception`}));function Kc(e){let t={};for(let[n,r]of e.getRawAttributes())typeof(r==null?void 0:r.then)!=`function`&&r!=null&&(t[n]!=null||(t[n]=r));return t}function qc(e,t,n,r,i){if(typeof n==`number`&&n<0){let t=`[${e}]`;return r!=null&&r.stylize?r.stylize(t,`special`):t}return typeof i!=`function`||!r?t:`${e} ${i(t,U(U({},r),{},{depth:r.depth==null?r.depth:r.depth-1}))}`}var Jc,Yc=n((()=>{W(),Jc=Symbol.for(`nodejs.util.inspect.custom`)})),Xc,Zc=n((()=>{M(),B(),L(),Gc(),Yc(),P(),Xc=class{constructor(e){var t,n;N(this,`_spanContext`,void 0),N(this,`kind`,void 0),N(this,`parentSpanContext`,void 0),N(this,`attributes`,{}),N(this,`links`,[]),N(this,`events`,[]),N(this,`startTime`,void 0),N(this,`resource`,void 0),N(this,`instrumentationScope`,void 0),N(this,`_droppedAttributesCount`,0),N(this,`_droppedEventsCount`,0),N(this,`_droppedLinksCount`,0),N(this,`_attributesCount`,0),N(this,`name`,void 0),N(this,`status`,{code:kt.UNSET}),N(this,`endTime`,[0,0]),N(this,`_ended`,!1),N(this,`_duration`,[-1,-1]),N(this,`_spanProcessor`,void 0),N(this,`_spanLimits`,void 0),N(this,`_attributeValueLengthLimit`,void 0),N(this,`_recordEndMetrics`,void 0),N(this,`_performanceStartTime`,void 0),N(this,`_performanceOffset`,void 0),N(this,`_startTimeProvided`,void 0);let r=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=R.now(),this._performanceOffset=r-(this._performanceStartTime+R.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=(t=this._spanLimits.attributeValueLengthLimit)==null?0:t,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let t of e.links)this.addLink(t);this.startTime=this._getTime((n=e.startTime)==null?r:n),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 k.warn(`Invalid attribute key: ${e}`),this;if(!jr(t))return k.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 in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,n){if(this._isSpanEnded())return this;let{eventCountLimit:r}=this._spanLimits;if(r===0)return k.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&k.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),Ti(t)&&(Ti(n)||(n=t),t=void 0);let i=kr(t),{attributePerEventCountLimit:a}=this._spanLimits,o={},s=0,c=0;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e))continue;let t=i[e];if(a!==void 0&&c>=a){s++;continue}o[e]=this._truncateToSize(t),c++}return this.events.push({name:e,attributes:o,time:this._getTime(n),droppedAttributesCount:s}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:t}=this._spanLimits;if(t===0)return this._droppedLinksCount++,this;t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&k.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,r=kr(e.attributes),i={},a=0,o=0;for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e))continue;let t=r[e];if(n!==void 0&&o>=n){a++;continue}i[e]=this._truncateToSize(t),o++}let s={context:e.context};return o>0&&(s.attributes=i),a>0&&(s.droppedAttributesCount=a),this.links.push(s),this}addLinks(e){for(let t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded()||e.code===kt.UNSET||this.status.code===kt.OK)return this;let t={code:e.code};return e.code===kt.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&k.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t,this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){var t;if(this._isSpanEnded()){k.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=xi(this.startTime,this.endTime),this._duration[0]<0&&(k.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&&k.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&k.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit 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<=R.now())return yi(e+this._performanceOffset);if(typeof e==`number`)return vi(e);if(e instanceof Date)return vi(e.getTime());if(wi(e))return e;if(this._startTimeProvided)return vi(Date.now());let t=R.now()-this._performanceStartTime;return Ei(this.startTime,vi(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[Xr]=e:e&&(e.code?n[Qr]=e.code.toString():e.name&&(n[Qr]=e.name),e.message&&(n[Xr]=e.message),e.stack&&(n[Zr]=e.stack)),n[`exception.type`]||n[`exception.message`]?this.addEvent(Wc,n,t):k.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}}`);k.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?(k.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}[Jc](e,t,n){return qc(`SpanImpl`,{name:this.name,kind:this.kind,spanContext:this._spanContext,parentSpanContext:this.parentSpanContext,status:this.status,startTime:this.startTime,endTime:this.endTime,duration:this._duration,ended:this._ended,attributes:this.attributes,events:this.events,links:this.links,droppedAttributesCount:this._droppedAttributesCount,droppedEventsCount:this._droppedEventsCount,droppedLinksCount:this._droppedLinksCount,instrumentationScope:this.instrumentationScope,resource:{attributes:Kc(this.resource)}},e,t,n)}}})),Qc,$c=n((()=>{(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(Qc||(Qc={}))})),el,tl,nl,rl,il,al,ol,sl,cl,ll,ul=n((()=>{el=`otel.component.name`,tl=`otel.component.type`,nl=`otel.span.parent.origin`,rl=`otel.span.sampling_result`,il=`otel.sdk.processor.span.processed`,al=`otel.sdk.processor.span.queue.capacity`,ol=`otel.sdk.processor.span.queue.size`,sl=`otel.sdk.span.live`,cl=`otel.sdk.span.started`,ll=`batching_span_processor`}));function dl(e){return e?e.isRemote?`remote`:`local`:`none`}function fl(e){switch(e){case Qc.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case Qc.RECORD:return`RECORD_ONLY`;case Qc.NOT_RECORD:return`DROP`}}var pl,ml=n((()=>{$c(),ul(),P(),pl=class{constructor(e){N(this,`startedSpans`,void 0),N(this,`liveSpans`,void 0),this.startedSpans=e.createCounter(cl,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(sl,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=fl(t);if(this.startedSpans.add(1,{[nl]:dl(e),[rl]:n}),t===Qc.NOT_RECORD)return()=>{};let r={[rl]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}}})),hl,gl=n((()=>{hl=`2.10.0`})),_l,vl=n((()=>{M(),B(),Zc(),ml(),gl(),Yc(),P(),_l=class{constructor(e,t){N(this,`_sampler`,void 0),N(this,`_spanLimits`,void 0),N(this,`_idGenerator`,void 0),N(this,`instrumentationScope`,void 0),N(this,`_resource`,void 0),N(this,`_spanProcessor`,void 0),N(this,`_tracerMetrics`,void 0),this.instrumentationScope=e,this._sampler=t.sampler,this._spanLimits=t.spanLimits,this._resource=t.resource,this._idGenerator=t.idGenerator,this._spanProcessor=t.spanProcessor;let n=t.meterProvider.getMeter(`@opentelemetry/sdk-trace`,hl);this._tracerMetrics=new pl(n)}startSpan(e,t={},n=O.active()){var r,i,a;t.root&&(n=j.deleteSpan(n));let o=j.getSpan(n);if(gr(n))return k.debug(`Instrumentation suppressed, returning Noop Span`),j.wrapSpanContext(Je);let s=o==null?void 0:o.spanContext(),c=this._idGenerator.generateSpanId(),l,u,d;!s||!j.isSpanContextValid(s)?u=this._idGenerator.generateTraceId():(u=s.traceId,d=s.traceState,l=s);let f=(r=t.kind)==null?Dt.INTERNAL:r,p=((i=t.links)==null?[]:i).map(e=>({context:e.context,attributes:kr(e.attributes)})),m=kr(t.attributes),h=this._sampler.shouldSample(n,u,e,f,m,p),g=this._tracerMetrics.startSpan(s,h.decision);d=(a=h.traceState)==null?d:a;let _=h.decision===Tt.RECORD_AND_SAMPLED?D.SAMPLED:D.NONE,v={traceId:u,spanId:c,traceFlags:_,traceState:d};if(h.decision===Tt.NOT_RECORD)return k.debug(`Recording is off, propagating context in a non-recording span`),j.wrapSpanContext(v);let y=kr(Object.assign(m,h.attributes));return new Xc({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:v,name:e,kind:f,links:p,parentSpanContext:l,attributes:y,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:g})}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?O.active():i,l=this.startSpan(e,a,c),u=j.setSpan(c,l);return O.with(u,s,void 0,l)}[Jc](e,t,n){return qc(`Tracer`,{instrumentationScope:this.instrumentationScope,resource:{attributes:Kc(this._resource)},spanLimits:this._spanLimits},e,t,n)}}})),yl,bl=n((()=>{B(),P(),yl=class{constructor(e){N(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=>{zr(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)})}}})),xl,Sl=n((()=>{$c(),xl=class{shouldSample(){return{decision:Qc.NOT_RECORD}}toString(){return`AlwaysOffSampler`}}})),Cl,wl=n((()=>{$c(),Cl=class{shouldSample(){return{decision:Qc.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}}})),Tl,El=n((()=>{M(),B(),Sl(),wl(),P(),Tl=class{constructor(e){var t,n,r,i;N(this,`_root`,void 0),N(this,`_remoteParentSampled`,void 0),N(this,`_remoteParentNotSampled`,void 0),N(this,`_localParentSampled`,void 0),N(this,`_localParentNotSampled`,void 0),this._root=e.root,this._root||(zr(Error(`ParentBasedSampler must have a root sampler configured`)),this._root=new Cl),this._remoteParentSampled=(t=e.remoteParentSampled)==null?new Cl:t,this._remoteParentNotSampled=(n=e.remoteParentNotSampled)==null?new xl:n,this._localParentSampled=(r=e.localParentSampled)==null?new Cl:r,this._localParentNotSampled=(i=e.localParentNotSampled)==null?new xl:i}shouldSample(e,t,n,r,i,a){let o=j.getSpanContext(e);return!o||!lt(o)?this._root.shouldSample(e,t,n,r,i,a):o.isRemote?o.traceFlags&D.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,a):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,a):o.traceFlags&D.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()}}`}}})),Dl,Ol,kl=n((()=>{L(),ul(),P(),W(),Dl=new Map,Ol=class{constructor(e,t,n){var r;N(this,`processedSpans`,void 0),N(this,`queueSize`,void 0),N(this,`queueSizeCallback`,void 0),N(this,`standardAttrs`,void 0),N(this,`droppedAttrs`,void 0);let i=(r=Dl.get(e))==null?0:r;if(Dl.set(e,i+1),this.standardAttrs={[tl]:e,[el]:`${e}/${i}`},this.droppedAttrs=U(U({},this.standardAttrs),{},{[Yr]:`queue_full`}),this.processedSpans=t.createCounter(il,{unit:`{span}`,description:`The number of spans for which the processing has finished, either successful or failed.`}),n){let{capacity:e,getQueueSize:r}=n;t.createUpDownCounter(al,{unit:`{span}`,description:`The maximum number of spans the queue of a given instance of an SDK span processor can hold.`}).add(e,this.standardAttrs),this.queueSize=t.createObservableUpDownCounter(ol,{unit:`{span}`,description:`The number of spans in the queue of a given instance of an SDK span processor.`}),this.queueSizeCallback=e=>e.observe(r(),this.standardAttrs),this.queueSize.addCallback(this.queueSizeCallback)}}dropSpans(e){this.processedSpans.add(e,this.droppedAttrs)}finishSpans(e,t){if(!t){this.processedSpans.add(e,this.standardAttrs);return}let n=U(U({},this.standardAttrs),{},{[Yr]:t.name});this.processedSpans.add(e,n)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}}})),Al,jl=n((()=>{M(),B(),kl(),ul(),P(),Al=class{constructor(e){var t,n,r,i;N(this,`_maxExportBatchSize`,void 0),N(this,`_maxQueueSize`,void 0),N(this,`_scheduledDelayMillis`,void 0),N(this,`_exportTimeoutMillis`,void 0),N(this,`_exporter`,void 0),N(this,`_metrics`,void 0),N(this,`_isExporting`,!1),N(this,`_finishedSpans`,[]),N(this,`_timer`,void 0),N(this,`_shutdownOnce`,void 0),N(this,`_droppedSpansCount`,0),this._exporter=e.exporter,this._maxExportBatchSize=(t=e.maxExportBatchSize)==null?512:t,this._maxQueueSize=(n=e.maxQueueSize)==null?2048:n,this._scheduledDelayMillis=(r=e.scheduledDelayMillis)==null?5e3:r,this._exportTimeoutMillis=(i=e.exportTimeoutMillis)==null?3e4:i,this._shutdownOnce=new Pa(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(k.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize);let a=e.selfObsMeterProvider?e.selfObsMeterProvider.getMeter(`@opentelemetry/sdk-trace`):ve();this._metrics=new Ol(ll,a,{capacity:this._maxQueueSize,getQueueSize:()=>this._finishedSpans.length})}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&D.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>(this._metrics.shutdown(),this._exporter.shutdown()))}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&k.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++,this._metrics.dropSpans(1);return}this._droppedSpansCount>0&&(k.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);O.with(hr(O.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,i=>{if(clearTimeout(n),this._metrics.finishSpans(r.length,i.error),i.code===z.SUCCESS)e();else{var a;t((a=i.error)==null?Error(`BatchSpanProcessor: span export failed`):a)}}),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=>{zr(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,zr(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)}}})),Ml,Nl=n((()=>{jl(),B(),P(),Ml=class extends Al{constructor(e){super(e),N(this,`_visibilityChangeListener`,void 0),N(this,`_pageHideListener`,void 0),this.onInit(e)}onInit(e){e.disableAutoFlushOnDocumentHide!==!0&&typeof document<`u`&&(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush().catch(e=>{zr(e)})},this._pageHideListener=()=>{this.forceFlush().catch(e=>{zr(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))}}}));function Pl(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 Fl(e){let t=``;for(let n=0;n<e.length;n++)t+=Bl[e[n]];return t}var Il,Ll,Rl,zl,Bl,Vl,Hl=n((()=>{Il=16,Ll=8,Rl=new Uint8Array(Il),zl=new Uint8Array(Ll),Bl=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`)),Vl=class{generateTraceId(){return Pl(Rl),Fl(Rl)}generateSpanId(){return Pl(zl),Fl(zl)}}})),Ul=n((()=>{Nl(),Hl()})),Wl,Gl,Kl=n((()=>{M(),Gs(),vl(),bl(),El(),wl(),Ul(),Yc(),P(),(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(Wl||(Wl={})),Gl=class{constructor(e={}){var t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_;N(this,`_resource`,void 0),N(this,`_activeSpanProcessor`,void 0),N(this,`_forceFlushTimeoutMillis`,void 0),N(this,`_tracerOptions`,void 0),N(this,`_tracers`,new Map),this._forceFlushTimeoutMillis=(t=e.forceFlushTimeoutMillis)==null?3e4:t,this._resource=(n=e.resource)==null?zs():n;let v=(r=e.spanProcessors)==null?[]:r;this._activeSpanProcessor=new yl(v),this._tracerOptions={resource:this._resource,sampler:(i=e.sampler)==null?new Tl({root:new Cl}):i,spanLimits:{attributeCountLimit:(a=(o=e.spanLimits)==null?void 0:o.attributeCountLimit)==null?128:a,attributeValueLengthLimit:(s=(c=e.spanLimits)==null?void 0:c.attributeValueLengthLimit)==null?1/0:s,eventCountLimit:(l=(u=e.spanLimits)==null?void 0:u.eventCountLimit)==null?128:l,linkCountLimit:(d=(f=e.spanLimits)==null?void 0:f.linkCountLimit)==null?128:d,attributePerEventCountLimit:(p=(m=e.spanLimits)==null?void 0:m.attributePerEventCountLimit)==null?128:p,attributePerLinkCountLimit:(h=(g=e.spanLimits)==null?void 0:g.attributePerLinkCountLimit)==null?128:h},idGenerator:e.idGenerator||new Vl,spanProcessor:this._activeSpanProcessor,meterProvider:(_=e.meterProvider)==null?{getMeter(){return ve()}}:_}}getTracer(e,t,n){let r=`${e}@${t||``}:${(n==null?void 0:n.schemaUrl)||``}`;return this._tracers.has(r)||this._tracers.set(r,new _l({name:e,version:t,schemaUrl:n==null?void 0:n.schemaUrl},this._tracerOptions)),this._tracers.get(r)}forceFlush(){let e=this._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=Wl.timeout},e);t.forceFlush().then(()=>{clearTimeout(i),r!==Wl.timeout&&(r=Wl.resolved,n(r))}).catch(e=>{clearTimeout(i),r=Wl.error,n(e)})}));return new Promise((e,n)=>{Promise.all(t).then(t=>{let r=t.filter(e=>e!==Wl.resolved);r.length>0?n(r):e()}).catch(e=>n([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[Jc](e,t,n){let r=this._activeSpanProcessor._spanProcessors;return qc(`TracerProvider`,{resource:{attributes:Kc(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:r.map(e=>{var t,n;return(t=(n=e.constructor)==null?void 0:n.name)==null?`SpanProcessor`:t})},e,t,n)}}})),ql,Jl=n((()=>{M(),$c(),P(),ql=class{constructor(e=0){N(this,`_ratio`,void 0),N(this,`_upperBound`,void 0),this._ratio=this._normalize(e),this._upperBound=this._ratio===1?4294967296:Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:st(t)&&this._accumulate(t)<this._upperBound?Qc.RECORD_AND_SAMPLED:Qc.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<32;n+=8){let r=0;for(let t=0;t<8;t++){let i=e.charCodeAt(n+t),a=i<58?i-48:i<71?i-55:i-87;r=r<<4|a}t=(t^r)>>>0}return t}}})),Yl=n((()=>{Kl(),Ul(),B(),P(),M(),kl(),ul(),q(),Sl(),wl(),$c(),El(),Jl()}));function Xl(){var e,t,n,r,i,a,o,s;return{sampler:Zl(),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 Zl(){var e;let t=(e=void 0)==null?$l.ParentBasedAlwaysOn:e;switch(t){case $l.AlwaysOn:return new Cl;case $l.AlwaysOff:return new xl;case $l.ParentBasedAlwaysOn:return new Tl({root:new Cl});case $l.ParentBasedAlwaysOff:return new Tl({root:new xl});case $l.TraceIdRatio:return new ql(Ql());case $l.ParentBasedTraceIdRatio:return new Tl({root:new ql(Ql())});default:return k.error(`OTEL_TRACES_SAMPLER value "${t}" invalid, defaulting to "${$l.ParentBasedAlwaysOn}".`),new Tl({root:new Cl})}}function Ql(){return k.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${eu}.`),eu}var $l,eu,tu=n((()=>{M(),B(),Yl(),(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`})($l||($l={})),eu=1}));function nu(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?ru:s,Object.assign({},e,{spanLimits:p})}var ru,iu=n((()=>{B(),ru=1/0})),au,ou=n((()=>{B(),tu(),iu(),Yl(),au=class extends Gl{constructor(e={}){let t=va({},Xl(),nu(e));delete t.generalLimits,super(t)}}})),su,cu=n((()=>{B(),Yl(),W(),su=class extends Ml{constructor(e,t){t||(t={});for(let[e,n]of[[`maxExportBatchSize`,`OTEL_BSP_MAX_EXPORT_BATCH_SIZE`],[`maxQueueSize`,`OTEL_BSP_MAX_QUEUE_SIZE`],[`scheduledDelayMillis`,`OTEL_BSP_SCHEDULE_DELAY`],[`exportTimeoutMillis`,`OTEL_BSP_EXPORT_TIMEOUT`]])t[e];super(U({exporter:e},t))}}})),lu=n((()=>{ou(),cu(),Yl()})),uu,du=n((()=>{M(),P(),uu=class{constructor(){N(this,`_enabled`,!1),N(this,`_currentContext`,w)}_bindFunction(e=w,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=w,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=w,this)}with(e,t,n,...r){let i=this._currentContext;this._currentContext=e||w;try{return t.call(n,...r)}finally{this._currentContext=i}}}}));function fu(e){if(e!==null){if(e===void 0){let e=new uu;e.enable(),O.setGlobalContextManager(e);return}e.enable(),O.setGlobalContextManager(e)}}function pu(e){if(e!==null){if(e===void 0){A.setGlobalPropagator(new Mi({propagators:[new ea,new Dr]}));return}A.setGlobalPropagator(e)}}var mu,hu=n((()=>{lu(),du(),M(),B(),mu=class extends au{constructor(e={}){super(e)}register(e={}){j.setGlobalTracerProvider(this),pu(e.propagator),fu(e.contextManager)}}})),X,gu=n((()=>{(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`})(X||(X={}))})),_u,vu,yu=n((()=>{_u=`http.response_content_length`,vu=`http.response_content_length_uncompressed`}));function bu(){return Au||(Au=document.createElement(`a`)),Au}function xu(e,t){return t in e}function Z(e,t,n,r=!0){if(xu(n,t)&&typeof n[t]==`number`&&!(r&&n[t]===0))return e.addEvent(t,n[t])}function Su(e,t,n=!1,r,i){if(r===void 0&&(r=t[X.START_TIME]!==0),n||(Z(e,X.FETCH_START,t,r),Z(e,X.DOMAIN_LOOKUP_START,t,r),Z(e,X.DOMAIN_LOOKUP_END,t,r),Z(e,X.CONNECT_START,t,r),Z(e,X.SECURE_CONNECTION_START,t,r),Z(e,X.CONNECT_END,t,r),Z(e,X.REQUEST_START,t,r),Z(e,X.RESPONSE_START,t,r),Z(e,X.RESPONSE_END,t,r)),!i){let n=t[X.ENCODED_BODY_SIZE];n!==void 0&&e.setAttribute(_u,n);let r=t[X.DECODED_BODY_SIZE];r!==void 0&&n!==r&&e.setAttribute(vu,r)}}function Cu(e){return e.slice().sort((e,t)=>{let n=e[X.FETCH_START],r=t[X.FETCH_START];return n>r?1:n<r?-1:0})}function wu(){return typeof location<`u`?location.origin:void 0}function Tu(e,t,n,r,i=new WeakSet,a){let o=Ou(e);e=o.toString();let s=Du(e,t,n,r,i,a);if(s.length===0)return{mainRequest:void 0};if(s.length===1)return{mainRequest:s[0]};let c=Cu(s);if(o.origin!==wu()&&c.length>1){let e=c[0],t=Eu(c,e[X.RESPONSE_END],n),r=e[X.RESPONSE_END];return t[X.FETCH_START]<r&&(t=e,e=void 0),{corsPreFlightRequest:e,mainRequest:t}}else return{mainRequest:s[0]}}function Eu(e,t,n){let r=Si(n),i=Si(bi(t)),a=e[1],o,s=e.length;for(let t=1;t<s;t++){let n=e[t],s=Si(bi(n[X.FETCH_START])),c=r-Si(bi(n[X.RESPONSE_END]));s>=i&&(!o||c<o)&&(o=c,a=n)}return a}function Du(e,t,n,r,i,a){let o=Si(t),s=Si(n),c=r.filter(t=>{let n=Si(bi(t[X.FETCH_START])),r=Si(bi(t[X.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 Ou(e){if(typeof URL==`function`)return new URL(e,typeof document<`u`?document.baseURI:typeof location<`u`?location.href:void 0);let t=bu();return t.href=e,t}function ku(e,t){let n=t||[];return(typeof n==`string`||n instanceof RegExp)&&(n=[n]),Ou(e).origin===wu()?!0:n.some(t=>ka(e,t))}var Au,ju=n((()=>{gu(),B(),yu()})),Mu=n((()=>{hu(),du(),gu(),ju(),lu()}));js(),Mu();let Nu={compression:`gzip`,concurrencyLimit:5,keepalive:!0,timeoutMillis:30*1e3},Pu=(e,t)=>({"X-MXL-AID":e,"X-MXL-DID":t}),Fu=(e,t)=>t||`http://mxl-otelcol.apps.ocpthikadev01.safaricom.net`;function Iu(e,t){let n={attributes:Ru(e.attributes,t),droppedAttributesCount:0},r=e.schemaUrl;return r&&r!==``&&(n.schemaUrl=r),n}function Lu(e,t){let n={name:e.name,version:e.version};if(e.attributes&&Object.keys(e.attributes).length>0){var r;n.attributes=Ru(e.attributes,t),n.droppedAttributesCount=(r=e.droppedAttributesCount)==null?0:r}return n}function Ru(e,t){return Object.keys(e).map(n=>zu(n,e[n],t))}function zu(e,t,n){return{key:e,value:Bu(t,n)}}function Bu(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]=Bu(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:Bu(e[n[i]],t)};return{kvlistValue:{values:r}}}return{}}function Vu(e,t){return{resourceLogs:Uu(e,t)}}function Hu(e){let t=new Map;for(let n of e){let{resource:e,instrumentationScope:r}=n,i=t.get(e);i||(i=new Map,t.set(e,i));let a=i.get(r);a||(a=[],i.set(r,a)),a.push(n)}return t}function Uu(e,t){let n=Hu(e);return Array.from(n,([e,n])=>{let r=Iu(e,t);return{resource:r,scopeLogs:Array.from(n,([,e])=>({scope:Lu(e[0].instrumentationScope,t),logRecords:e.map(e=>Wu(e,t)),schemaUrl:e[0].instrumentationScope.schemaUrl})),schemaUrl:r.schemaUrl}})}function Wu(e,t){var n,r,i;return{timeUnixNano:t.encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:Gu(e.severityNumber),severityText:e.severityText,body:Bu(e.body,t),eventName:e.eventName,attributes:Ru(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 Gu(e){return e}function Ku(e){let t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function qu(e){return Ku(e).toString()}let Ju=typeof BigInt<`u`?qu:oc;function Yu(e){return e}let Xu={encodeHrTime:Ju,encodeSpanContext:Yu,encodeOptionalSpanContext:Yu,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(``))}};M();let Zu={serializeRequest:e=>{let t=Vu(e,Xu);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return k.warn(`Failed to parse logs export response: ${e.message}. Returning empty response`),{}}}};function Qu(e,t){let n=e&255|256;return t&&(n|=512),n}function $u(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:Ru(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>td(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:s.code,message:s.message},links:e.links.map(e=>ed(e,t)),droppedLinksCount:e.droppedLinksCount,flags:Qu(o.traceFlags,(a=e.parentSpanContext)==null?void 0:a.isRemote)}}function ed(e,t){var n;return{attributes:e.attributes?Ru(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:Qu(e.context.traceFlags,e.context.isRemote)}}function td(e,t){return{attributes:e.attributes?Ru(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function nd(e,t){return{resourceSpans:id(e,t)}}function rd(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 id(e,t){let n=rd(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=>$u(e,t));o.push({scope:Lu(e[0].instrumentationScope,t),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=s.next()}let l=Iu(e,t),u={resource:l,scopeSpans:o,schemaUrl:l.schemaUrl};r.push(u),a=i.next()}return r}M();let ad={serializeRequest:e=>{let t=nd(e,Xu);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return k.warn(`Failed to parse trace export response: ${e.message}. Returning empty response`),{}}}};var od=class{constructor(e){this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}};P();var sd=class extends Error{constructor(e,t,n){super(e),N(this,`code`,void 0),N(this,`name`,`OTLPExporterError`),N(this,`data`,void 0),this.data=n,this.code=t}};P(),q();var cd=class{constructor(e){N(this,`_concurrencyLimit`,void 0),N(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 K(function*(){yield Promise.all(e._sendingPromises)})()}};function ld(e){return new cd(e.concurrencyLimit)}M();function ud(e){return Object.prototype.hasOwnProperty.call(e,`partialSuccess`)}function dd(){return{handleResponse(e){e==null||!ud(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||k.warn(`Received Partial Success response:`,JSON.stringify(e.partialSuccess))}}}B(),M(),P(),q();var fd=class{constructor(e,t,n,r,i,a){N(this,`_metrics`,void 0),N(this,`_diagLogger`,void 0),N(this,`_transport`,void 0),N(this,`_serializer`,void 0),N(this,`_responseHandler`,void 0),N(this,`_promiseQueue`,void 0),N(this,`_timeout`,void 0),this._transport=e,this._serializer=t,this._responseHandler=n,this._promiseQueue=r,this._timeout=a,this._diagLogger=k.createComponentLogger({namespace:`OTLPExportDelegate`}),this._metrics=i}export(e,t){if(this._diagLogger.debug(`items to be sent`,e),this._promiseQueue.hasReachedLimit()){t({code:z.FAILED,error:Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);if(n==null){t({code:z.FAILED,error:Error(`Nothing to send`)});return}let r=this._metrics.startExport(e);this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(e=>{if(e.status===`success`){if(r(void 0),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:z.SUCCESS});return}else if(e.status===`failure`&&e.error){r(e.error),t({code:z.FAILED,error:e.error});return}else if(e.status===`retryable`){var n;r(`export_max_retries`),t({code:z.FAILED,error:(n=e.error)==null?new sd(`Export failed with retryable status`):n})}else r(`export_failed`),t({code:z.FAILED,error:new sd(`Export failed with unknown error`)})},e=>{r(e),t({code:z.FAILED,error:e})}))}forceFlush(){return this._promiseQueue.awaitAll()}setMetrics(e){this._metrics=e}shutdown(){var e=this;return K(function*(){e._diagLogger.debug(`shutdown started`),yield e.forceFlush(),e._transport.shutdown()})()}};function pd(e,t){return new fd(e.transport,e.serializer,dd(),e.promiseHandler,e.metrics,t.timeout)}function md(e,t,n,r){return pd({transport:r,serializer:t,promiseHandler:ld(e),metrics:n},{timeout:e.timeoutMillis})}M(),q(),W();let hd=49152,gd=0,_d=0;var vd=class e{constructor(e){this._config=e}static _compressRequest(e){return K(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),{done:a}=e}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 K(function*(){let i=t,a=U({"Content-Type":`application/json`},r._config.headers),o,s;if(`timeout`in AbortSignal)o=AbortSignal.timeout(n);else{let e=new AbortController;({signal:o}=e),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 k.warn(`Fetch transport gzip compression failed: ${t.message}`),{error:t,status:`failure`}}a[`Content-Encoding`]=`gzip`,a[`Content-Length`]=i.length.toString()}let n=gd+i.byteLength>hd;if(c=!n&&!(_d>=9),c)gd+=i.byteLength,_d++;else{let e=n?`inflight bytes (${gd} + ${i.byteLength}) would exceed ${hd}B budget`:`concurrent count (${_d}) at limit of 9`;k.debug(`Sending without keepalive: ${e}`)}let s=yield fetch(r._config.url,{body:i,headers:a,keepalive:c,method:`POST`,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?(k.debug(u),{error:l,status:`retryable`}):(k.warn(u),{error:l,status:`failure`})}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?k.debug(r):k.warn(r),{error:t,status:n?`retryable`:`failure`}}finally{s!==void 0&&clearTimeout(s),c&&(gd-=i.byteLength,_d--)}})()}};let yd=e=>new vd(e);q();let bd=()=>Math.random()*40-20;var xd=class{constructor(e,t=new za){this._transport=e,this._perf=t}send(e,t){var n=this;return K(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)+bd(),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 Sd=e=>{var t;return new xd(e.transport,(t=e.perf)==null?new za:t)},Cd=(e,t)=>md(e,t,Sd({transport:yd(e)}));var wd=class extends od{constructor(e){super(Cd(e,Zu))}};let Td=(e,t)=>`${Fu(e,t)}/v1/logs`;W();var Ed=class extends wd{constructor({appID:e,userID:t,otelCollectorURL:n}){super(U(U({},Nu),{},{headers:Pu(e,t),url:Td(e,n)}))}};W();var Dd=class extends od{constructor(e){super(Cd(U(U({},e),{},{compression:`gzip`}),ad))}};let Od=(e,t)=>`${Fu(e,t)}/v1/traces`;W();var kd=class extends Dd{constructor({appID:e,userID:t,otelCollectorURL:n}){super(U(U({},Nu),{},{headers:Pu(e,t),url:Od(e,n)}))}};function Ad(e){return{isRecording:()=>e.isRecording(),setEnabled:t=>{if(t){e.resume();return}e.pause()}}}let jd=e=>e||`http://mxl-basket.apps.ocpthikadev01.safaricom.net`,Md=e=>e||`http://mxl-otel-collector.apps.ocpthikadev01.safaricom.net`,Nd=(e,{osVersion:t,appVersion:n,deviceId:r},i)=>`${jd(i)}/config?appId=${e}&osVersion=${t}&appVersion=${n}&deviceId=${r}`,Pd=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Fd=(e,t,n)=>{let r=e[t];if(typeof r==`number`)return r;let i=e[n];if(typeof i==`number`)return i},Id=(e,t,n)=>{let r=e[t];if(typeof r==`boolean`)return r;let i=e[n];if(typeof i==`boolean`)return i},Ld=(e,t,n)=>{let r=e[t];if(typeof r==`string`)return r;let i=e[n];if(typeof i==`string`)return i},Rd=e=>{if(!Pd(e))return;let t={},n=Fd(e,`pctEnabled`,`pct_enabled`);n!==void 0&&(t.pctEnabled=n);let r=Fd(e,`sampleRate`,`sample_rate`);r!==void 0&&(t.sampleRate=r);let i=Id(e,`maskAllInputs`,`mask_all_inputs`);i!==void 0&&(t.maskAllInputs=i);let a=Id(e,`maskAllText`,`mask_all_text`);a!==void 0&&(t.maskAllText=a);let o=Fd(e,`flushIntervalMs`,`flush_interval_ms`);o!==void 0&&(t.flushIntervalMs=o);let s=Id(e,`omitRedundantInstrumentations`,`omit_redundant_instrumentations`);s!==void 0&&(t.omitRedundantInstrumentations=s);let c=Id(e,`debug`,`debug`);return c!==void 0&&(t.debug=c),Object.keys(t).length>0?t:void 0},zd=e=>{var t,n;if(!Pd(e))throw TypeError(`Remote config must be an object`);let r=e.threshold;if(typeof r!=`number`)throw TypeError(`Remote config threshold must be a number`);let i={threshold:r},a=(t=e.networkSpanForwarding)==null?e.network_span_forwarding:t;if(Pd(a)){let e=Fd(a,`pctEnabled`,`pct_enabled`);e!==void 0&&(i.networkSpanForwarding={pctEnabled:e})}let o=Fd(e,`emptySessionAvoidanceEnabledPct`,`empty_session_avoidance_enabled_pct`);o!==void 0&&(i.emptySessionAvoidanceEnabledPct=o);let s=Ld(e,`serviceName`,`service_name`);s!==void 0&&(i.serviceName=s);let c=Rd((n=e.sessionReplay)==null?e.session_replay:n);return c!==void 0&&(i.sessionReplay=c),i};W(),q();let Bd=e=>({"mxl-client-id":e}),Vd=0;function Hd(e,t){let n=Date.now();n-Vd<3e4||(Vd=n,console.warn(`[mxl] session replay ${e} failed (dropping; will retry on next chunk):`,t))}function Ud(e){let t=Bd(e.appID),n=e.baseUrl.replace(/\/$/,``),r=e.otelCollectorURL.replace(/\/$/,``),i=[`${n}/sessionReplays/`,`${n}/sessionEvents`,`${n}/replay`,`${r}/v1/logs`,`${r}/v1/traces`],a=e=>i.some(t=>e.startsWith(t)),o=function(){var r=K(function*(r=!1){e.apiKey&&(yield fetch(`${n}/replay`,{body:`null`,headers:U(U({},t),{},{"content-type":`application/json`,"mxl-api-key":e.apiKey}),keepalive:r,method:`POST`}).catch(e=>{Hd(`replay POST`,e)}))});return function(){return r.apply(this,arguments)}}(),s=function(){var e=K(function*(e,r=!1){let i=`${JSON.stringify(e)}\n`;yield fetch(`${n}/sessionReplays/meta`,{body:i,headers:U(U({},t),{},{"content-type":`application/x-ndjson`}),keepalive:r,method:`POST`}).catch(e=>{Hd(`metadata POST`,e)})});return function(t){return e.apply(this,arguments)}}(),c=function(){var e=K(function*(e,r=!1){if(e.length===0)return;let i=`${e.map(e=>JSON.stringify(e)).join(`
|
|
2
|
+
`)}\n`;yield fetch(`${n}/sessionEvents`,{body:i,headers:U(U({},t),{},{"content-type":`application/x-ndjson`}),keepalive:r,method:`POST`}).catch(e=>{Hd(`events POST`,e)})});return function(t){return e.apply(this,arguments)}}();return{postReplay:o,postSessionBlob:function(){var e=K(function*(e,r,i=!1){yield fetch(`${n}/sessionReplays/blob`,{body:r,headers:U(U({},t),{},{"content-type":`application/octet-stream`,"x-mxl-chunk-seq":String(e.chunkSeq),"x-mxl-duration-ms":String(e.durationMs),"x-mxl-event-count":String(e.eventCount),"x-mxl-is-checkpoint":e.isCheckpoint?`1`:`0`,"x-mxl-session-id":e.sessionId}),keepalive:i,method:`POST`}).catch(e=>{Hd(`blob POST`,e)})});return function(t,n){return e.apply(this,arguments)}}(),postSessionEvents:c,postSessionMeta:s,shouldIgnoreUrl:a}}function Wd(e){return Ud({apiKey:e.apiKey,appID:e.appID,baseUrl:jd(e.apiURL),otelCollectorURL:Md(e.otelCollectorURL)})}let Gd=`http.url`,Kd=`http.response.status_code`,qd=`url.full`,Jd=`user_agent.original`,Yd=`http.response.body.size`,Xd=`session.id`,Zd=`session.previous_id`,Qd=`user.id`,$d=new Uint8Array(16),ef=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`).toUpperCase()),tf=()=>{crypto.getRandomValues($d);let e=``;for(let t=0;t<16;t++)e+=ef[$d[t]];return e},nf=`0.0.24`,rf=`mxl_app_instance_id`,af=(e,t)=>{let n=null;try{n=e.getItem(rf)}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=tf();try{e.setItem(rf,n)}catch(e){t.warn(`Failed to persist app instance ID to session storage`,e)}}return n};Gs(),W();let of=`unknown_service`,sf=({serviceName:e})=>Ls({"service.name":e}),cf=({diagLogger:e,appVersion:t,pageSessionStorage:n,applicationId:r,enduserPseudoId:i})=>Ls(U(U({"telemetry.sdk.name":`mxl-web-sdk`,app_version:t,app_framework:1,sdk_version:nf,"telemetry.sdk.version":nf,sdk_simple_version:1,sdk_platform:`web`,"telemetry.sdk.language":`webjs`,"mxl.app_instance_id":af(n,e),[Jd]:window.navigator.userAgent,screen_resolution:`${window.screen.width}x${window.screen.height}`},i?{"enduser.pseudo.id":i}:{}),r?{[pr]:r}:{})),lf={networkSpansForwardingThreshold:0,samplingPct:100},uf=`mxl_remote_config`;M(),W(),P(),q();let df=e=>{let t={samplingPct:e.threshold};return e.networkSpanForwarding!==void 0&&(t.networkSpansForwardingThreshold=e.networkSpanForwarding.pctEnabled),e.serviceName!==void 0&&e.serviceName!==``&&(t.serviceName=e.serviceName),e.emptySessionAvoidanceEnabledPct!==void 0&&(t.emptySessionAvoidanceEnabledPct=e.emptySessionAvoidanceEnabledPct),e.sessionReplay!==void 0&&(t.replay=U({},e.sessionReplay)),t};var ff=class{constructor({appID:e,appVersion:t,deviceId:n,diag:r=k.createComponentLogger({namespace:`mxl-config-manager`}),storage:i=window.localStorage,defaultConfig:a={},apiURL:o}={}){N(this,`_remoteConfigURL`,null),N(this,`_diag`,void 0),N(this,`_storage`,void 0),N(this,`_baseConfig`,void 0),N(this,`_sdkConfig`,void 0),N(this,`_etag`,null),N(this,`_remoteSourceServiceName`,void 0),e&&t&&n&&(this._remoteConfigURL=Nd(e,{appVersion:t,deviceId:n,osVersion:`1`},o)),this._diag=r,this._storage=i;let s=this._getRemoteConfigFromStorage();s&&(this._etag=s.etag,this._captureRemoteServiceName(s.config)),this._baseConfig=U(U({},lf),a),this._sdkConfig=U(U({},this._baseConfig),s?df(s.config):{})}setConfig(e){this._sdkConfig=U(U({},this._sdkConfig),e)}getConfig(){return this._sdkConfig}resolveApplicationServiceName(e){var t,n;return((t=this._remoteSourceServiceName)==null?void 0:t.trim())||(e==null?void 0:e.trim())||((n=this._baseConfig.serviceName)==null?void 0:n.trim())||of}_captureRemoteServiceName(e){if(e.serviceName===void 0)return;let t=e.serviceName.trim();this._remoteSourceServiceName=t.length>0?t:void 0}refreshRemoteConfig(){var e=this;return K(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._captureRemoteServiceName(n),e._storage.setItem(uf,JSON.stringify({config:n,etag:r})),e._sdkConfig=U(U({},e._baseConfig),df(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(uf);if(e){let t=JSON.parse(e);return{config:zd(t.config),etag:t.etag}}return 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 K(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?[zd(yield n.json()),r]:(t._diag.warn(`Failed to fetch remote config from ${e}: ${n.statusText}`),null)})()}};W();function pf({recordUserSessions:e,replay:t,dynamicConfig:n,isSessionReplayEnabled:r}){if(!r)return{recordUserSessions:!1,replay:t};let i=n.replay;if(!i)return{recordUserSessions:e,replay:t};let a=U({},t);return i.sampleRate!==void 0&&(a.sampleRate=i.sampleRate),i.maskAllInputs!==void 0&&(a.maskAllInputs=i.maskAllInputs),i.maskAllText!==void 0&&(a.maskAllText=i.maskAllText),i.flushIntervalMs!==void 0&&(a.flushIntervalMs=i.flushIntervalMs),i.omitRedundantInstrumentations!==void 0&&(a.omitRedundantInstrumentations=i.omitRedundantInstrumentations),i.debug!==void 0&&(a.debug=i.debug),{recordUserSessions:e,replay:a}}let mf={maxAllowed:{breadcrumb:100,element_timing:500,error_log:500,exception:500,info_log:100,network_request:1e4,server_timing:500,session_property:100,span:1e3,user_timing_mark:500,user_timing_measure:500,warning_log:200},maxAttributes:{error_log:50,exception:50,info_log:50,warning_log:50},maxLength:{breadcrumb:256,error_log:128,exception:1024,exception_attribute_key:128,exception_attribute_value:256,info_log:128,log_attribute_key:128,log_attribute_value:256,session_property_key:128,session_property_value:256,warning_log:128}};M(),P();let hf={error:`error_log`,info:`info_log`,warning:`warning_log`};var gf=class{constructor({diag:e,maxAllowed:t,maxLength:n,maxAttributes:r}){N(this,`_diag`,void 0),N(this,`_diagnosticCounts`,{}),N(this,`_currentCount`,{breadcrumb:0,element_timing:0,error_log:0,exception:0,info_log:0,network_request:0,server_timing:0,session_property:0,span:0,user_timing_mark:0,user_timing_measure:0,warning_log:0}),N(this,`_maxAllowed`,void 0),N(this,`_maxLength`,void 0),N(this,`_maxAttributes`,void 0),this._diag=e==null?k.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`:{attributes:this._truncateAttributes(`exception`,t,`exception_attribute_key`,`exception_attribute_value`),message:this.truncateString(`exception`,e)}}limitLog(e,t,n){let r=hf[t];return this._dropIfMaxReached(r)?`dropped`:{attributes:this._truncateAttributes(r,n,`log_attribute_key`,`log_attribute_value`),message:this.truncateString(r,e)}}limitSessionProperty(e,t){return this._dropIfMaxReached(`session_property`)?`dropped`:{key:this.truncateString(`session_property_key`,e),value:this.truncateString(`session_property_value`,t)}}limitElementTimingEntry(){return this._dropIfMaxReached(`element_timing`)}limitServerTimingEntry(){return this._dropIfMaxReached(`server_timing`)}limitUserTimingEntry(e){return this._dropIfMaxReached(e===`mark`?`user_timing_mark`:`user_timing_measure`)}dropReadableSpan(e){let t=e.attributes[`mxl.type`]===`perf.network_request`?`network_request`:`span`;return this._dropIfMaxReached(t)}reset(){this._diagnosticCounts={},this._currentCount={breadcrumb:0,element_timing:0,error_log:0,exception:0,info_log:0,network_request:0,server_timing:0,session_property:0,span:0,user_timing_mark:0,user_timing_measure:0,warning_log: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 _f=`mxl_user`,vf=`mxl_user_id`,yf=`mxl_external_user_id`,bf=`mxl_profile_snapshot`,xf=`mxl_session_analytics_prev`;W();let Sf=()=>({avatar:``,email:``,firstName:``,lastName:``,profileId:``,properties:{}});function Cf(e){try{let t=e.getItem(bf);if(!t)return null;let n=JSON.parse(t);if(typeof n==`object`&&n&&typeof n.profileId==`string`)return n}catch(e){}return null}function wf(e,t){try{return e.setItem(bf,JSON.stringify(t)),!0}catch(e){return!1}}function Tf(e){try{e.removeItem(bf)}catch(e){}}function Ef(e,t){var n;let r=e==null?Sf():e,i=U(U({},r.properties),(n=t.properties)==null?{}:n);return{avatar:t.avatar===void 0?r.avatar:t.avatar,email:t.email===void 0?r.email:t.email,firstName:t.firstName===void 0?r.firstName:t.firstName,lastName:t.lastName===void 0?r.lastName:t.lastName,profileId:t.profileId,properties:i}}function Df(e){let t=U({},e.properties);return e.firstName&&(t.first_name=e.firstName),e.lastName&&(t.last_name=e.lastName),e.email&&(t.email=e.email),e.avatar&&(t.avatar=e.avatar),t}P(),W();var Of=class{constructor(){N(this,`_screenViewCount`,0),N(this,`_eventCount`,0),N(this,`_entry`,null),N(this,`_exit`,null),N(this,`_referrer`,``),N(this,`_utm`,{utmCampaign:``,utmContent:``,utmMedium:``,utmSource:``,utmTerm:``})}recordScreenView(e){this._screenViewCount+=1,this._eventCount+=1,this._entry||(this._entry=U({},e),this._referrer=e.referrer,this._utm={utmCampaign:e.utmCampaign,utmContent:e.utmContent,utmMedium:e.utmMedium,utmSource:e.utmSource,utmTerm:e.utmTerm}),this._exit=U({},e)}recordTrackEvent(){this._eventCount+=1}buildSpanAttributes(e,t){var n,r,i,a,o,s,c,l;let u={"mxl.session.screen_view_count":this._screenViewCount,"mxl.session.event_count":this._eventCount,"mxl.session.profile_id":e,"mxl.session.entry_origin":(n=(r=this._entry)==null?void 0:r.origin)==null?``:n,"mxl.session.entry_path":(i=(a=this._entry)==null?void 0:a.path)==null?``:i,"mxl.session.exit_origin":(o=(s=this._exit)==null?void 0:s.origin)==null?``:o,"mxl.session.exit_path":(c=(l=this._exit)==null?void 0:l.path)==null?``:c,"mxl.session.referrer":this._referrer,"mxl.session.utm_medium":this._utm.utmMedium,"mxl.session.utm_source":this._utm.utmSource,"mxl.session.utm_campaign":this._utm.utmCampaign,"mxl.session.utm_content":this._utm.utmContent,"mxl.session.utm_term":this._utm.utmTerm};return t&&(u[`${I}profile_id`]=t.profileId,u[`${I}screen_view_count`]=t.screenViewCount,u[`${I}event_count`]=t.eventCount,u[`${I}entry_origin`]=t.entryOrigin,u[`${I}entry_path`]=t.entryPath,u[`${I}exit_origin`]=t.exitOrigin,u[`${I}exit_path`]=t.exitPath,u[`${I}referrer`]=t.referrer,u[`${I}utm_medium`]=t.utmMedium,u[`${I}utm_source`]=t.utmSource,u[`${I}utm_campaign`]=t.utmCampaign,u[`${I}utm_content`]=t.utmContent,u[`${I}utm_term`]=t.utmTerm),u}toRowSnapshot(e,t,n){var r,i,a,o,s,c,l,u;return{applicationId:e,deviceId:n,entryOrigin:(r=(i=this._entry)==null?void 0:i.origin)==null?``:r,entryPath:(a=(o=this._entry)==null?void 0:o.path)==null?``:a,eventCount:this._eventCount,exitOrigin:(s=(c=this._exit)==null?void 0:c.origin)==null?``:s,exitPath:(l=(u=this._exit)==null?void 0:u.path)==null?``:l,profileId:t,referrer:this._referrer,screenViewCount:this._screenViewCount,utmCampaign:this._utm.utmCampaign,utmContent:this._utm.utmContent,utmMedium:this._utm.utmMedium,utmSource:this._utm.utmSource,utmTerm:this._utm.utmTerm}}reset(){this._screenViewCount=0,this._eventCount=0,this._entry=null,this._exit=null,this._referrer=``,this._utm={utmCampaign:``,utmContent:``,utmMedium:``,utmSource:``,utmTerm:``}}};function kf(e){try{let t=e.getItem(xf);return t?JSON.parse(t):null}catch(e){return null}}function Af(e,t){try{e.setItem(xf,JSON.stringify(t))}catch(e){}}function jf(e){try{e.removeItem(xf)}catch(e){}}function Mf(e,t=document.referrer){let n=``,r=e,i=``,a=``,o=``,s=``,c=``;try{var l,u,d,f,p;let t=new URL(e,window.location.origin);n=t.origin,r=`${t.pathname}${t.search}${t.hash}`,i=(l=t.searchParams.get(`utm_medium`))==null?``:l,a=(u=t.searchParams.get(`utm_source`))==null?``:u,o=(d=t.searchParams.get(`utm_campaign`))==null?``:d,s=(f=t.searchParams.get(`utm_content`))==null?``:f,c=(p=t.searchParams.get(`utm_term`))==null?``:p}catch(e){}return{origin:n,path:r,referrer:t,utmCampaign:o,utmContent:s,utmMedium:i,utmSource:a,utmTerm:c}}M(),H(),P(),W();var Nf=class{constructor({applicationId:e,diag:t,loggerProvider:n,pageManager:r,storage:i=window.localStorage,userManager:a,userSessionManager:o}){N(this,`_diag`,void 0),N(this,`_logger`,void 0),N(this,`_applicationId`,void 0),N(this,`_userManager`,void 0),N(this,`_userSessionManager`,void 0),N(this,`_pageManager`,void 0),N(this,`_storage`,void 0),N(this,`_sessionAnalytics`,new Of),N(this,`_lastScreenViewPath`,null),N(this,`_screenViewTimer`,null);let s=n==null?io:n;this._diag=t==null?k.createComponentLogger({namespace:`MXLAnalyticsManager`}):t,this._applicationId=e,this._userManager=a,this._userSessionManager=o,this._pageManager=r,this._storage=i,this._logger=s.getLogger(`mxl-web-sdk-analytics`)}getSessionAnalyticsState(){return this._sessionAnalytics}track(e,t={}){if(typeof e!=`string`||!e.trim()){this._diag.warn(`track name must be a non-empty string`);return}this._sessionAnalytics.recordTrackEvent(),this._emitAnalyticsLog(`track`,e.trim(),t.properties)}identify(e){var t,n,r,i,a,o;if(!((t=e.profileId)!=null&&t.trim())){this._diag.warn(`identify requires profileId`);return}let s=Ef(Cf(this._storage),{avatar:(n=e.avatar)==null?``:n,email:(r=e.email)==null?``:r,firstName:(i=e.firstName)==null?``:i,lastName:(a=e.lastName)==null?``:a,profileId:e.profileId.trim(),properties:(o=e.properties)==null?{}:o});wf(this._storage,s)||this._diag.warn(`Failed to persist profile snapshot`),this._userManager.setUserId(s.profileId);let c=Df(s);this._emitAnalyticsLog(`identify`,`identify`,c,s.profileId)}increment({property:e,value:t=1}){var n;let r=this._resolveProfileId();if(!r){this._diag.warn(`increment requires an identified profile`);return}let i=Cf(this._storage),a=Number.parseFloat((n=i==null?void 0:i.properties[e])==null?`0`:n),o=Number.isFinite(a)?a+t:t,s=Ef(i,{profileId:r,properties:U(U({},i==null?void 0:i.properties),{},{[e]:String(o),counter_name:e,counter_value:String(o)})});wf(this._storage,s),this._emitAnalyticsLog(`increment`,e,{counter_name:e,counter_value:String(o)},r)}decrement({property:e,value:t=1}){var n;let r=this._resolveProfileId();if(!r){this._diag.warn(`decrement requires an identified profile`);return}let i=Cf(this._storage),a=Number.parseFloat((n=i==null?void 0:i.properties[e])==null?`0`:n),o=Number.isFinite(a)?a-Math.abs(t):-Math.abs(t),s=Ef(i,{profileId:r,properties:U(U({},i==null?void 0:i.properties),{},{[e]:String(o),counter_name:e,counter_value:String(o)})});wf(this._storage,s),this._emitAnalyticsLog(`decrement`,e,{counter_name:e,counter_value:String(o)},r)}clear(){Tf(this._storage),this._userManager.clearUserId()}screenView(){this._screenViewTimer&&clearTimeout(this._screenViewTimer),this._screenViewTimer=setTimeout(()=>{this._screenViewTimer=null,this._emitScreenView()},50)}buildSessionPartAnalyticsAttributes(){var e,t;let n=kf(this._storage),r=this._userManager.getMXLUserId(),i=(e=this._resolveProfileId())==null?r:e,a=this._sessionAnalytics.buildSpanAttributes(i,n);return a[`mxl.visitor.is_new`]=((t=this._userSessionManager.getUserSessionAttributes())==null?void 0:t[fr])===1,a[`browser.language`]=navigator.language||``,a}finalizeSessionPartAnalytics(){var e;let t=this._userManager.getMXLUserId(),n=(e=this._resolveProfileId())==null?t:e,r=this._sessionAnalytics.toRowSnapshot(this._applicationId,n,t);Af(this._storage,r)}resetSessionAnalyticsForNewUserSession(){this._sessionAnalytics.reset(),jf(this._storage),this._lastScreenViewPath=null}_emitScreenView(){var e,t;let n=this._pageManager.getCurrentRoute(),r=(e=n==null?void 0:n.url)==null?window.location.href:e,i=(t=n==null?void 0:n.path)==null?window.location.pathname:t;if(this._lastScreenViewPath===i)return;this._lastScreenViewPath=i;let a=Mf(r);this._sessionAnalytics.recordScreenView(a),this._emitAnalyticsLog(`screen_view`,`screen_view`)}_emitAnalyticsLog(e,t,n={},r){var i,a,o,s,c,l;let u=this._pageManager.getCurrentRoute(),d=(i=u==null?void 0:u.url)==null?window.location.href:i,f=(a=u==null?void 0:u.path)==null?window.location.pathname:a,p=(o=(s=this._pageManager.getPageLabel())==null?document.title:s)==null?``:o,m=``;try{m=new URL(d,window.location.origin).origin}catch(e){m=window.location.origin}let h=this._userManager.getMXLUserId(),g=(c=r==null?this._resolveProfileId():r)==null?h:c,_=(l=this._userSessionManager.getUserSessionId())==null?``:l,v={"mxl.analytics.kind":e,"mxl.analytics.name":t,[pr]:this._applicationId,"mxl.device.id":h,"mxl.profile.id":g,"mxl.session.id":_,[or]:f,"mxl.page.url":d,"mxl.page.origin":m,"mxl.page.title":p,"mxl.page.referrer":document.referrer};for(let[e,t]of Object.entries(n))t!=null&&(v[`mxl.event.property.${e}`]=String(t));this._logger.emit({attributes:v,body:t,severityNumber:V.INFO,severityText:`INFO`})}_resolveProfileId(){let e=this._userManager.getUserId();if(e)return e;let t=Cf(this._storage);return(t==null?void 0:t.profileId)||null}};let Pf=(e,t,n)=>{try{let r=e.getItem(t),i=r?parseInt(r,10):0;return Number.isNaN(i)&&(n.warn(`Non-numeric value stored at ${t} (${String(r)}); resetting counter.`),i=0),i++,e.setItem(t,i.toString()),i}catch(e){return n.warn(`Failed to retrieve ${t} from storage: `,e),1}},Ff=e=>e.visibilityState===`hidden`?`background`:`foreground`,If=globalThis;M(),H(),P(),fn(),W();let Lf=()=>JSON.stringify(If._MXLFileBundleIDs||{});var Rf=class e{constructor({diag:e,perf:t,userSessionManager:n,limitManager:r,loggerProvider:i,visibilityDoc:a=window.document,storage:o=window.localStorage}){N(this,`_diag`,void 0),N(this,`_perf`,void 0),N(this,`_logger`,void 0),N(this,`_userSessionManager`,void 0),N(this,`_limitManager`,void 0),N(this,`_visibilityDoc`,void 0),N(this,`_storage`,void 0);let s=i==null?io:i;this._diag=e==null?k.createComponentLogger({namespace:`MXLLogManager`}):e,this._perf=t==null?new za:t,this._logger=s.getLogger(`mxl-web-sdk-logs`),this._userSessionManager=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 V.INFO;case`warning`:return V.WARN;default:return V.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._userSessionManager.incrSessionPartCountForKey(`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{[nr]:p}=s,m=rs(s,[nr].map(dn)),h=this._limitManager.limitException(l,m);h!==`dropped`&&this._logger.emit({attributes:U(U(U({},h.attributes),p===void 0?{}:{[nr]:String(p)}),{},{[F]:`sys.exception`,"mxl.exception_handling":e._exceptionHandlingType(n,a),"mxl.exception_cause":f,"exception.type":c,"exception.name":u,"exception.message":h.message,"exception.stacktrace":d,[ir]:Lf(),[tr]:Ff(this._visibilityDoc),"mxl.exception_number":Pf(this._storage,`mxl_exception_number`,this._diag)}),body:h.message,severityNumber:V.ERROR,severityText:`ERROR`,timestamp:i})}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._userSessionManager.incrSessionPartCountForKey(`mxl.error_log_count`);let o=``;t!==`info`&&(typeof i==`string`?o=i:r&&(o=Error().stack||``)),this._logMessage({attributes:a,message:e.trim(),severity:t,stack:o,timestamp:this._perf.getNowMillis()})}_logMessage({message:t,severity:n,timestamp:r,attributes:i={},stack:a}){let o=this._limitManager.limitLog(t,n,i);o!==`dropped`&&this._logger.emit({attributes:U(U(U({},o.attributes),{},{[F]:`sys.log`},a?{"mxl.stacktrace.js":a,[ir]:Lf()}:{}),{},{[tr]:Ff(this._visibilityDoc)}),body:o.message,severityNumber:e._logSeverityToSeverityNumber(n),severityText:n.toUpperCase(),timestamp:r})}static _exceptionHandlingType(e,t){return e?`handled`:t===`global_exception`?`unhandled_error`:t===`promise_rejection`?`unhandled_rejection`:`unhandled`}};P();var zf=class{constructor({useDocumentTitleAsPageLabel:e=!0,titleDocument:t=window.document}={}){N(this,`_currentRoute`,null),N(this,`_currentPageId`,null),N(this,`_pageLabel`,null),N(this,`_titleDocument`,void 0),N(this,`_useDocumentTitleAsPageLabel`,void 0),N(this,`getCurrentPageId`,()=>this._currentPageId),N(this,`getCurrentRoute`,()=>this._currentRoute),N(this,`setPageLabel`,e=>{this._pageLabel=e}),N(this,`getPageLabel`,()=>this._pageLabel||(!this._useDocumentTitleAsPageLabel||!this._titleDocument?null:this._titleDocument.title)),N(this,`setCurrentRoute`,e=>{(!this._currentRoute||this._currentRoute.url!==e.url)&&(this._currentPageId=tf()),this._currentRoute=e,e.label?this._pageLabel=e.label:this._pageLabel=null}),N(this,`clearCurrentRoute`,()=>{this._currentRoute=null,this._currentPageId=null,this._pageLabel=null}),this._useDocumentTitleAsPageLabel=e,this._titleDocument=t}};let Bf=(e,t)=>!t||t<=0||t>100?!1:t>=Vf(e),Vf=e=>{if(e.length<6)return 0;let t=e.slice(-6),n=Math.pow(16,6)-1;return parseInt(t,16)/n*100};P();var Hf=class{constructor({dynamicConfigManager:e,deviceId:t,blockNetworkSpanForwarding:n}){N(this,`_dynamicConfigManager`,void 0),N(this,`_deviceId`,void 0),N(this,`_blockNetworkSpanForwarding`,void 0),this._dynamicConfigManager=e,this._deviceId=t,this._blockNetworkSpanForwarding=n}isSDKEnabled(){let e=this._dynamicConfigManager.getConfig();return Bf(this._deviceId,e.samplingPct)}isNetworkSpanForwardingEnabled(){if(this._blockNetworkSpanForwarding)return!1;let e=this._dynamicConfigManager.getConfig();return Bf(this._deviceId,e.networkSpansForwardingThreshold)}isSessionReplayEnabled(){var e,t;let n=(e=(t=this._dynamicConfigManager.getConfig().replay)==null?void 0:t.pctEnabled)==null?100:e;return Bf(this._deviceId,n)}isEmptySessionAvoidanceEnabled(){let e=this._dynamicConfigManager.getConfig();return Bf(this._deviceId,e.emptySessionAvoidanceEnabledPct)}};P(),fn();var Uf=class{constructor(e){N(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=rs(t,[e].map(dn));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)}};M(),P();var Wf=class{constructor({tracerProvider:e}={}){N(this,`_tracer`,void 0),N(this,`setSpan`,j.setSpan);let t=e==null?j:e;this._tracer=t.getTracer(`mxl-web-sdk-traces`)}startSpan(e,t={},n){t.attributes=t.attributes?t.attributes:{},t.attributes[F]=`perf`;let r=t.parentSpan?j.setSpan(O.active(),t.parentSpan):n;return new Uf(this._tracer.startSpan(e,t,r))}getSpan(e){let t=j.getSpan(e);if(t)return new Uf(t)}};let Gf=e=>typeof e[`enduser.pseudo.id`]==`string`&&e[`enduser.pseudo.id`].length===32,Kf=e=>typeof e==`string`&&e.length===32;M(),P();var qf=class{constructor({diag:e,storage:t=window.localStorage}={}){N(this,`_diag`,void 0),N(this,`_storage`,void 0),N(this,`_mxlUserId`,null),this._diag=e==null?k.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(vf,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(vf)}catch(e){this._diag.warn(`Failed to remove mxl user in storage`,e)}}_migrateOldLocalStorageKey(){try{let e=this._storage.getItem(_f);if(e){let t=JSON.parse(e);Gf(t)?(this._diag.debug(`Migrating old user data from storage`),this._storage.setItem(vf,t[`enduser.pseudo.id`]),this._storage.removeItem(_f)):(this._diag.warn(`Invalid user data found in storage, clearing old user data`),this._storage.removeItem(_f))}}catch(e){this._diag.warn(`Failed to get old user data from storage`,e)}}_initialSetup(){try{let e=this._storage.getItem(vf);e?Kf(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=tf();return this.setMXLUserId(e),e}getUserId(){try{return this._storage.getItem(yf)}catch(e){return this._diag.warn(`Failed to retrieve user id from storage`,e),null}}setUserId(e){try{this._storage.setItem(yf,e)}catch(e){this._diag.warn(`Failed to store user id`,e)}}clearUserId(){try{this._storage.removeItem(yf)}catch(e){this._diag.warn(`Failed to clear user id`,e)}}};let Jf=`mxl_user_session_state`,Yf=`mxl_permanent_properties`,Xf=`mxl_last_end_user_session_ts`,Zf=`mxl_tab`,Qf=`mxl_tab_activity`,$f=720*60,ep=1800,tp=[`keydown`,`mousedown`,`mousemove`,`scroll`],np=({diag:e,value:t,defaultValue:n,min:r,max:i})=>t===void 0?n:Number.isFinite(t)?t<r||t>i?(e==null||e.warn(`value (${t.toString()}) is outside the allowed range [${r.toString()}, ${i.toString()}]; falling back to default (${n.toString()}).`),n):t:(e==null||e.warn(`value is not a finite number; falling back to default (${n.toString()}).`),n),rp=(e,t=1e3)=>{let n=!1,r=null,i=((...i)=>{n||(e(...i),n=!0,r=setTimeout(()=>{n=!1,r=null},t))});return i.cancel=()=>{r!==null&&(clearTimeout(r),r=null),n=!1},i},ip=e=>e.visibilityState===`visible`&&e.hasFocus(),ap=({target:e,visibilityDoc:t,activityEvents:n,onActivity:r,onVisibilityChange:i,onFocus:a,onBlur:o,onPageShow:s,onPageHide:c})=>{var l;for(let t of n)e.addEventListener(t,r);(l=t.addEventListener)==null||l.call(t,`visibilitychange`,i),e.addEventListener(`focus`,a),e.addEventListener(`blur`,o),e.addEventListener(`pageshow`,s),e.addEventListener(`pagehide`,c)},op=({target:e,visibilityDoc:t,activityEvents:n,onActivity:r,onVisibilityChange:i,onFocus:a,onBlur:o,onPageShow:s,onPageHide:c})=>{var l;for(let t of n)e.removeEventListener(t,r);(l=t.removeEventListener)==null||l.call(t,`visibilitychange`,i),e.removeEventListener(`focus`,a),e.removeEventListener(`blur`,o),e.removeEventListener(`pageshow`,s),e.removeEventListener(`pagehide`,c)},sp=(e,t)=>t<e.userSessionStartTs||t>=e.userSessionMaxEndTs||e.inactivityDeadlineTs!==null&&t>=e.inactivityDeadlineTs,cp=({now:e,previousUserSessionId:t,maxUserSessionDurationSeconds:n,inactivityTimeoutSeconds:r,userSessionNumber:i})=>({inactivityDeadlineTs:null,inactivityTimeoutSeconds:r,maxUserSessionDurationSeconds:n,previousUserSessionId:t,schemaVersion:1,userSessionId:tf(),userSessionMaxEndTs:e+n*1e3,userSessionNumber:i,userSessionPartIndex:0,userSessionProperties:{},userSessionStartTs:e}),lp=e=>typeof e==`object`&&!!e&&e.schemaVersion===1,up=(e,t)=>{let n=e.getItem(Jf);if(!n)return null;try{let e=JSON.parse(n);if(!lp(e))throw Error(`stored user session state failed structural validation`);return e}catch(n){return t.error(`User session state in storage is corrupt; discarding it`,n),e.removeItem(Jf),null}},dp=(e,t)=>{let n=e.getItem(Yf);if(!n)return{};try{let e=JSON.parse(n);if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`permanent properties blob is not a plain object`);let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&(t[n]=r);return t}catch(n){return t.error(`Permanent properties in storage are corrupt; discarding`,n),e.removeItem(Yf),{}}},fp=(e,t)=>Object.keys(t).length===0?e.removeItem(Yf):e.setItem(Yf,JSON.stringify(t)),pp=e=>{if(!e)return{isSameOrigin:!1,isValid:!1};try{let t=new URL(e),n=window.location.origin;return{isSameOrigin:t.origin===n,isValid:!0,scrubbedUrl:t.origin+t.pathname}}catch(e){return{isSameOrigin:!1,isValid:!1}}},mp=(e,t,n)=>{try{let e=t.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){n.warn(`Failed to get navigation type`,e)}return e.isValid?e.isSameOrigin?`same_origin`:`external`:`direct`},hp=(e,t)=>{try{let t=e.getItem(Qf);return t?JSON.parse(t):null}catch(e){return t.warn(`Failed to retrieve tab activity`,e),null}},gp=(e,t,n,r)=>{let i=af(t,r),a,o;if(e===`same_origin`){let e=hp(n,r);e&&Date.now()-e.lastActivityMs<=1e4&&(a=e.tabId,{experienceId:o}=e)}return o===void 0&&(o=tf()),{navigationSource:e,tab:{experienceId:o,sourceTabId:a,tabId:i}}},_p=({sessionStorage:e,localStorage:t,referrer:n,navigationPerformance:r,diag:i})=>{let a=pp(n),o=mp(a,r,i);try{let t=e.getItem(Zf);if(t)return{navigationSource:o,referrerScrubbedUrl:a.isValid&&a.scrubbedUrl?a.scrubbedUrl:void 0,tab:JSON.parse(t)}}catch(e){i.warn(`Failed to retrieve tab data`,e)}let s=gp(o,e,t,i);try{e.setItem(Zf,JSON.stringify(s.tab))}catch(e){i.warn(`Failed to store tab data`,e)}return{navigationSource:s.navigationSource,referrerScrubbedUrl:a.isValid&&a.scrubbedUrl?a.scrubbedUrl:void 0,tab:s.tab}},vp=(e,t,n)=>{let r={experienceId:t.experienceId,lastActivityMs:Date.now(),tabId:t.tabId};try{e.setItem(Qf,JSON.stringify(r))}catch(e){n.warn(`Failed to save tab activity`,e)}},yp=(e,t,n)=>{let r=r=>{var i;if(r.button===1||r.ctrlKey||r.metaKey||r.shiftKey){vp(t,e,n);return}(i=r.target)!=null&&i.closest(`a[target="_blank"], form[target="_blank"], a[rel*="noopener"], a[rel*="noreferrer"]`)&&vp(t,e,n)},i={capture:!0,passive:!0};document.addEventListener(`auxclick`,r,i),document.addEventListener(`click`,r,i)};M(),P(),W();var bp=class e{static shutdownAllTestInstances(){for(let t of e._testInstances)t._shutdown();e._testInstances.clear()}constructor({config:t,diag:n,perf:r,visibilityDoc:i,storage:a,limitManager:o,target:s=window,activityThrottleMs:c=3e4,activityEvents:l=tp,tabStorage:u,referrer:d=typeof document<`u`?document.referrer:``,navigationPerformance:f=typeof window<`u`?window.performance:{getEntriesByType:()=>[]}}){N(this,`_state`,null),N(this,`_previousUserSessionId`,null),N(this,`_maxUserSessionDurationSeconds`,void 0),N(this,`_inactivityTimeoutSeconds`,void 0),N(this,`_maxDurationTimeout`,null),N(this,`_isShutdown`,!1),N(this,`_permanentProperties`,{}),N(this,`_hasStoredState`,!1),N(this,`_activeSessionPartId`,null),N(this,`_currentSessionPartNumber`,null),N(this,`_sessionPartSpan`,null),N(this,`_activeSessionPartCounts`,null),N(this,`_coldStart`,!0),N(this,`_nextSessionPartCounts`,{}),N(this,`_sdkStartupDuration`,0),N(this,`_sessionPartStartedListeners`,[]),N(this,`_sessionPartEndedListeners`,[]),N(this,`_tracer`,void 0),N(this,`_diag`,void 0),N(this,`_perf`,void 0),N(this,`_storage`,void 0),N(this,`_visibilityDoc`,void 0),N(this,`_limitManager`,void 0),N(this,`_target`,void 0),N(this,`_activityEvents`,void 0),N(this,`_onActivityThrottled`,void 0),N(this,`_sessionPartInactivityTimer`,null),N(this,`_tab`,void 0),N(this,`_navigationSource`,void 0),N(this,`_referrerScrubbedUrl`,void 0),N(this,`_analyticsManager`,null),N(this,`_onActivity`,()=>{try{if(!ip(this._visibilityDoc))return;if(this._activeSessionPartId===null){this.startSessionPartInternal(`web_activity`);return}this._startSessionPartInactivityTimer()}catch(e){this._diag.warn(`Error handling activity event`,e)}}),N(this,`_onVisibilityChange`,()=>{this._handleEngagementTransition(`visibilitychange`)}),N(this,`_onFocus`,()=>{this._handleEngagementTransition(`focus`)}),N(this,`_onBlur`,()=>{this._handleEngagementTransition(`blur`)}),N(this,`_onPageShow`,e=>{this._handleEngagementTransition(e.persisted?`pageshow-bfcache`:`pageshow-initial`)}),N(this,`_onPageHide`,e=>{try{if(this._activeSessionPartId===null)return;let t=e.persisted?`web_background`:`web_hard_navigation`;this._diag.debug(`page hiding (persisted=${e.persisted}); ending current part as ${t}`),this.endSessionPartInternal(t)}catch(t){this._diag.error(`Error ending session part on pagehide (persisted=${e.persisted})`,t)}}),N(this,`_onSessionPartInactivity`,()=>{this._sessionPartInactivityTimer=null;try{if(this._activeSessionPartId===null)return;this._diag.debug(`inactivity timer fired; ending current part and user session`),this.endSessionPartInternal(`inactivity`,`inactivity`)}catch(e){this._diag.warn(`Error handling inactivity timer`,e)}}),this._diag=n==null?k.createComponentLogger({namespace:`MXLUserSessionManager`}):n,this._perf=r,this._visibilityDoc=i,this._storage=a,this._limitManager=o,this._permanentProperties=dp(this._storage,this._diag),this._tracer=j.getTracer(`mxl-web-sdk-session-parts`),this._target=s,this._activityEvents=l,this._onActivityThrottled=rp(this._onActivity,c);let p=np({defaultValue:$f,diag:this._diag,max:86400,min:3600,value:t==null?void 0:t.maxUserSessionDurationSeconds}),m=np({defaultValue:ep,diag:this._diag,max:86400,min:30,value:t==null?void 0:t.inactivityTimeoutSeconds});this._maxUserSessionDurationSeconds=p,m<=p?this._inactivityTimeoutSeconds=m:(this._diag.warn(`inactivityTimeoutSeconds (${m.toString()}s) exceeds maxUserSessionDurationSeconds (${p.toString()}s); falling back to default inactivity timeout (1800s).`),this._inactivityTimeoutSeconds=ep);let h=_p({diag:this._diag,localStorage:a,navigationPerformance:f,referrer:d,sessionStorage:u});this._tab=h.tab,this._navigationSource=h.navigationSource,this._referrerScrubbedUrl=h.referrerScrubbedUrl,yp(this._tab,a,this._diag),e._testInstances.add(this)}setTracerProvider(e){this._tracer=e.getTracer(`mxl-web-sdk-session-parts`),ap({activityEvents:this._activityEvents,onActivity:this._onActivityThrottled,onBlur:this._onBlur,onFocus:this._onFocus,onPageHide:this._onPageHide,onPageShow:this._onPageShow,onVisibilityChange:this._onVisibilityChange,target:this._target,visibilityDoc:this._visibilityDoc});let{state:t,created:n}=this._loadOrCreateUserSessionState(this._perf.getNowMillis());this._state=t,n&&this._storeState()}recordSDKStartupDuration(e){this._sdkStartupDuration=Math.ceil(e)}setAnalyticsManager(e){this._analyticsManager=e}getUserSessionId(){var e,t;return(e=(t=this._state)==null?void 0:t.userSessionId)==null?null:e}getPreviousUserSessionId(){var e,t;return(e=(t=this._state)==null?void 0:t.previousUserSessionId)==null?this._previousUserSessionId:e}getUserSessionStartTime(){var e,t;return(e=(t=this._state)==null?void 0:t.userSessionStartTs)==null?null:e}getUserSessionAttributes(){var e,t;if(!this._state)return null;let n=(e=this.getPreviousUserSessionId())==null?``:e;return{[ur]:this._state.userSessionId,[Xd]:this._state.userSessionId,[dr]:n,[Zd]:n,[fr]:this._state.userSessionNumber,"mxl.user_session_part_index":this._state.userSessionPartIndex,"mxl.session_part_number":(t=this._currentSessionPartNumber)==null?0:t,"mxl.user_session_start_ts":this._state.userSessionStartTs,"mxl.user_session_max_duration_seconds":this._state.maxUserSessionDurationSeconds,"mxl.user_session_inactivity_timeout_seconds":this._state.inactivityTimeoutSeconds}}endUserSession(){if(!this._state){this._diag.debug(`Trying to end user session, but there is no active session. This is a no-op.`);return}let e=this._perf.getNowMillis(),t=this._storage.getItem(Xf),n=t===null?NaN:Number(t);if(Number.isFinite(n)&&e-n<5e3){this._diag.warn(`endUserSession called within cooldown period, ignoring.`);return}this._rolloverUserSession(`manual`),this._storage.setItem(Xf,String(e))}getSessionPartId(){return this._activeSessionPartId}getSessionPartSpan(){return this._sessionPartSpan}startSessionPartInternal(e){if(this._sessionPartSpan){this._diag.warn(`startSessionPartInternal called while a part is active (reason: ${e}); ignoring`);return}if(Ff(this._visibilityDoc)===`background`||!this._visibilityDoc.hasFocus()){this._diag.debug(`skipping session part start (reason: ${e}) because the tab is not engaged`);return}let t=tf(),n=this._nextSessionPartCounts;this._beginUserSessionForPartStart();let r=U(U({},this.getUserSessionAttributes()),{},{[F]:`ux.session_part`,[tr]:`foreground`,[lr]:t,"mxl.session_part_start_reason":e,"mxl.cold_start":this._coldStart,"mxl.experience_id":this._tab.experienceId,"mxl.tab_id":this._tab.tabId,"mxl.navigation_source":this._navigationSource},n);this._referrerScrubbedUrl&&(r[`mxl.referrer_url`]=this._referrerScrubbedUrl),this._tab.sourceTabId&&(r[`mxl.source_tab_id`]=this._tab.sourceTabId),this._activeSessionPartId=t;let i;try{i=new Uf(this._tracer.startSpan(`mxl-session-part`,{attributes:r}))}catch(e){this._activeSessionPartId=null,this._diag.error(`Error starting session part span`,e);return}this._activeSessionPartCounts={},this._nextSessionPartCounts={},this._sessionPartSpan=i,this._coldStart=!1,this._startSessionPartInactivityTimer(),this._fireListeners(this._sessionPartStartedListeners,`started`)}endSessionPartInternal(e,t){if(!this._sessionPartSpan){this._diag.debug(`trying to end a session part, but there is no session part in progress. This is a no-op.`);return}this._clearSessionPartInactivityTimer();let n=e===`user_session_ended`||e===`inactivity`,r=this._perf.getNowMillis(),i=this._sessionPartSpan;try{let r=U(U(U({"mxl.session_part_end_reason":e},this._activeSessionPartCounts),this._limitManager.getDiagnosticCounts()),{},{"mxl.sdk_startup_duration":this._sdkStartupDuration});n&&(r[`mxl.is_final_session_part`]=1,t&&(r[`mxl.user_session_termination_reason`]=t)),this._analyticsManager&&(Object.assign(r,this._analyticsManager.buildSessionPartAnalyticsAttributes()),this._analyticsManager.finalizeSessionPartAnalytics());let a={};for(let[e,t]of Object.entries(this.getSessionPartProperties()))a[`mxl.properties.`+e]=t;try{i.setAttributes(U(U({},a),r))}catch(e){this._diag.warn(`Error setting end attributes on session part span; ending span without them`,e)}}finally{this._fireListeners(this._sessionPartEndedListeners,`ended`);try{i.end(r)}catch(e){this._diag.warn(`Error ending session part span`,e)}this._sessionPartSpan=null,this._activeSessionPartId=null,this._activeSessionPartCounts=null,this._currentSessionPartNumber=null,this._limitManager.reset()}if(n){var a,o;this._previousUserSessionId=(a=(o=this._state)==null?void 0:o.userSessionId)==null?null:a,this._state=null,this._storage.removeItem(Jf),this._clearMaxDurationTimer()}else this._continueUserSessionAfterPartEnd(r)}addBreadcrumb(e){if(!this._sessionPartSpan){this._diag.debug(`trying to add breadcrumb, but there is no session part in progress. This is a no-op.`);return}let t=this._limitManager.limitBreadcrumb(e);t!==`dropped`&&this._sessionPartSpan.addEvent(`mxl-breadcrumb`,{message:t.name},this._perf.getNowMillis())}addProperty(e,t,n){let r=this._limitManager.limitSessionProperty(e,t);if(r===`dropped`)return;let i=r.key,a=r.value;if((n==null?void 0:n.lifespan)===`permanent`){let e=U(U({},this._permanentProperties),{},{[i]:a});if(!fp(this._storage,e)){this._diag.warn(`Storage unavailable; rejecting permanent property write.`);return}this._permanentProperties=e,this._removeFromUserSessionProperties(i);return}let{state:o}=this._loadOrCreateUserSessionState(this._perf.getNowMillis());this._state=U(U({},o),{},{userSessionProperties:U(U({},o.userSessionProperties),{},{[i]:a})}),this._storeState()||(this._state=o,this._diag.warn(`Storage unavailable; rejecting user-session property write.`))}removeProperty(e){let t=this._limitManager.truncateString(`session_property_key`,e);this._removeFromPermanentProperties(t),this._removeFromUserSessionProperties(t)}getSessionPartProperties(){var e;return U(U({},this._permanentProperties),(e=this._state)==null?void 0:e.userSessionProperties)}incrSessionPartCountForKey(e){if(!this._sessionPartSpan||!this._activeSessionPartCounts){this._diag.debug(`trying to increment a count for the active session part, but there is no session part in progress. This is a no-op.`);return}this._activeSessionPartCounts[e]=(this._activeSessionPartCounts[e]||0)+1}incrNextSessionPartCountForKey(e){this._nextSessionPartCounts[e]=(this._nextSessionPartCounts[e]||0)+1}addSessionPartStartedListener(e){return this._addListener(this._sessionPartStartedListeners,e)}addSessionPartEndedListener(e){return this._addListener(this._sessionPartEndedListeners,e)}_loadOrCreateUserSessionState(e){let t=up(this._storage,this._diag),n=!1;if(!t||sp(t,e)){var r;t&&(this._previousUserSessionId=t.userSessionId);let i=Pf(this._storage,`mxl_user_session_number`,this._diag);t=cp({inactivityTimeoutSeconds:this._inactivityTimeoutSeconds,maxUserSessionDurationSeconds:this._maxUserSessionDurationSeconds,now:e,previousUserSessionId:this._previousUserSessionId,userSessionNumber:i}),n=!0,(r=this._analyticsManager)==null||r.resetSessionAnalyticsForNewUserSession()}return(n||this._maxDurationTimeout===null)&&this._setupMaxDurationTimer(t,e),{created:n,state:t}}_beginUserSessionForPartStart(){let e=this._perf.getNowMillis(),{state:t}=this._loadOrCreateUserSessionState(e);this._currentSessionPartNumber=Pf(this._storage,`mxl_session_part_number`,this._diag),this._state=U(U({},t),{},{userSessionPartIndex:t.userSessionPartIndex+1,inactivityDeadlineTs:null}),this._storeState()}_continueUserSessionAfterPartEnd(e){if(!this._state){this._clearMaxDurationTimer();return}if(this._hasStoredState&&this._storage.getItem(`mxl_user_session_state`)===null){this._previousUserSessionId=this._state.userSessionId,this._state=null,this._clearMaxDurationTimer();return}this._state=U(U({},this._state),{},{inactivityDeadlineTs:e+this._state.inactivityTimeoutSeconds*1e3}),this._storeState()}_rolloverUserSession(e){var t,n;if(this._sessionPartSpan){this.endSessionPartInternal(`user_session_ended`,e),this.startSessionPartInternal(`user_session_rollover`);return}this._previousUserSessionId=(t=(n=this._state)==null?void 0:n.userSessionId)==null?null:t,this._state=null,this._storage.removeItem(Jf),this._clearMaxDurationTimer()}_setupMaxDurationTimer(e,t){this._clearMaxDurationTimer();let n=e.userSessionMaxEndTs-t;n<=0||(this._maxDurationTimeout=setTimeout(()=>{this._maxDurationTimeout=null,this._rolloverUserSession(`max_duration_reached`)},n))}_clearMaxDurationTimer(){this._maxDurationTimeout!==null&&(clearTimeout(this._maxDurationTimeout),this._maxDurationTimeout=null)}_shutdown(){this._isShutdown||(this._isShutdown=!0,e._testInstances.delete(this),this._onActivityThrottled.cancel(),op({activityEvents:this._activityEvents,onActivity:this._onActivityThrottled,onBlur:this._onBlur,onFocus:this._onFocus,onPageHide:this._onPageHide,onPageShow:this._onPageShow,onVisibilityChange:this._onVisibilityChange,target:this._target,visibilityDoc:this._visibilityDoc}),this._clearSessionPartInactivityTimer(),this._clearMaxDurationTimer())}_handleEngagementTransition(e){try{let t=ip(this._visibilityDoc),n=this._activeSessionPartId!==null;if(!t&&n){this._diag.debug(`tab disengaged via ${e}; ending current part`),this.endSessionPartInternal(`web_background`);return}if(t&&!n){this._diag.debug(`tab engaged via ${e}; starting new part`),this.startSessionPartInternal(`web_foreground`);return}t&&n&&this._startSessionPartInactivityTimer()}catch(e){this._diag.warn(`Error handling engagement change`,e)}}_startSessionPartInactivityTimer(){this._clearSessionPartInactivityTimer(),this._sessionPartInactivityTimer=setTimeout(this._onSessionPartInactivity,this._inactivityTimeoutSeconds*1e3)}_clearSessionPartInactivityTimer(){this._sessionPartInactivityTimer!==null&&(clearTimeout(this._sessionPartInactivityTimer),this._sessionPartInactivityTimer=null)}_addListener(e,t){return e.push(t),()=>{let n=e.indexOf(t);n!==-1&&e.splice(n,1)}}_fireListeners(e,t){for(let n of e)try{n()}catch(e){this._diag.warn(`Error while executing session part ${t} listener`,e)}}_storeState(){if(!this._state)return!1;let e=this._storage.setItem(Jf,JSON.stringify(this._state));return e&&(this._hasStoredState=!0),e}_removeFromPermanentProperties(e){if(!(e in this._permanentProperties))return;let t=U({},this._permanentProperties);delete t[e],this._permanentProperties=t,fp(this._storage,t)}_removeFromUserSessionProperties(e){if(!this._state||!(e in this._state.userSessionProperties))return;let t=U({},this._state.userSessionProperties);delete t[e],this._state=U(U({},this._state),{},{userSessionProperties:t}),this._storeState()}};N(bp,`_testInstances`,new Set),P();var xp=class{constructor({urlDocument:e=window.document}={}){N(this,`_urlDocument`,void 0),this._urlDocument=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){e.attributes[`browser.url.full`]||e.setAttribute(ar,this._urlDocument.URL)}shutdown(){return Promise.resolve(void 0)}};P();var Sp=class{constructor({urlDocument:e=window.document}={}){N(this,`_urlDocument`,void 0),this._urlDocument=e}forceFlush(){return Promise.resolve(void 0)}onEnd(e){e.attributes[`browser.url.full`]||(e.attributes[ar]=this._urlDocument.URL)}onStart(){}shutdown(){return Promise.resolve(void 0)}};P();var Cp=class{constructor({attributeScrubbers:e}){N(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)}};P();var wp=class{constructor({urlDocument:e=window.document}={}){N(this,`_urlDocument`,void 0),this._urlDocument=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){e.attributes[`mxl.type`]||e.setAttribute(F,`sys.log`),e.setAttribute(qd,this._urlDocument.URL)}shutdown(){return Promise.resolve(void 0)}};let Tp=e=>{if((e.attributes[`http.request.method`]||e.attributes[`http.method`])&&(typeof e.attributes[`http.response.status_code`]==`number`||typeof e.attributes[`http.status_code`]==`number`)){var t;let n=(t=e.attributes[`url.full`])==null?e.attributes[Gd]:t;return typeof n==`string`&&n.includes(`://`)}return!1};var Ep=class{forceFlush(){return Promise.resolve(void 0)}onEnd(e){Yo(e.spanContext().traceId),Tp(e)&&(e.attributes[F]=`perf.network_request`,e.attributes[`url.full`]===void 0&&(e.attributes[qd]=e.attributes[Gd]),e.attributes[`http.response.status_code`]===void 0&&(e.attributes[Kd]=e.attributes[`http.status_code`]),e.attributes[`http.request.method`]===void 0&&(e.attributes[`http.request.method`]=e.attributes[`http.method`]),e.attributes[`http.response.body.size`]===void 0&&(e.attributes[Yd]=e.attributes[`http.response_content_length`]),e.attributes[`http.request.body.size`]===void 0&&(e.attributes[`http.request.body.size`]=e.attributes[`http.request_content_length`]))}onStart(){}shutdown(){return Promise.resolve(void 0)}};M(),B(),P();let Dp=e=>e.attributes[F]===`ux.session_part`,Op=(e,t)=>`mxl.${t===`current`?`export_failed`:`previous_export_failed`}.${e}`;var kp=class{constructor({exporter:e,limitManager:t,userSessionManager:n,emptySessionAvoidanceEnabled:r=!1,diag:i=k.createComponentLogger({namespace:`MXLSessionPartBatchedSpanProcessor`})}){N(this,`_shutdownOnce`,void 0),N(this,`_pendingSpans`,[]),N(this,`_exporter`,void 0),N(this,`_limitManager`,void 0),N(this,`_userSessionManager`,void 0),N(this,`_emptySessionAvoidanceEnabled`,void 0),N(this,`_diag`,void 0),N(this,`_shutdown`,()=>this._exporter.shutdown()),this._diag=i,this._exporter=e,this._shutdownOnce=new Pa(this._shutdown,this),this._limitManager=t,this._userSessionManager=n,this._emptySessionAvoidanceEnabled=r}forceFlush(){return this._diag.debug(`forceFlush called for MXLSessionPartBatchedSpanProcessor. 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(Dp(e))this._diag.debug(`session part span ended. Exporting all pending spans.`),this._exportSpans([e,...this._pendingSpans]),this._pendingSpans=[];else{if(this._diag.debug(`non-session-part span ended. Adding to pending spans queue.`),this._limitManager.dropReadableSpan(e))return;this._pendingSpans.push(e)}}_isEmptySessionExport(e){return e.length===1&&Dp(e[0])}_exportSpans(e){if(this._emptySessionAvoidanceEnabled&&this._isEmptySessionExport(e)){this._diag.debug(`Skipping export of empty session part`);return}Ra._export(this._exporter,e).then(e=>{if(e.code===z.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._userSessionManager.incrSessionPartCountForKey(Op(r,`current`)),this._userSessionManager.incrNextSessionPartCountForKey(Op(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._userSessionManager.incrSessionPartCountForKey(Op(`unknown`,`current`)),this._userSessionManager.incrNextSessionPartCountForKey(Op(`unknown`,`previous`)),this._diag.error(`spans failed to export: ${t}`)})}onStart(){}getPendingSpansCount(){return this._pendingSpans.length}shutdown(){return this._shutdownOnce.call()}};P();var Ap=class{constructor({pageManager:e}){N(this,`_pageManager`,void 0),this._pageManager=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){if(!e.attributes[`app.surface.name`]||!e.attributes[`app.surface.id`]){let t=this._pageManager.getCurrentRoute();t&&(e.setAttribute(or,t.path),e.setAttribute(sr,this._pageManager.getCurrentPageId()))}let t=this._pageManager.getPageLabel();t&&!e.attributes[`app.surface.label`]&&e.setAttribute(cr,t)}shutdown(){return Promise.resolve(void 0)}};P();var jp=class{constructor({pageManager:e}){N(this,`_pageManager`,void 0),this._pageManager=e}forceFlush(){return Promise.resolve(void 0)}onEnd(e){if(!e.attributes[`app.surface.name`]||!e.attributes[`app.surface.id`]){let t=this._pageManager.getCurrentRoute(),n=this._pageManager.getCurrentPageId();t&&n&&(e.attributes[or]=t.path,e.attributes[sr]=n)}let t=this._pageManager.getPageLabel();t&&!e.attributes[`app.surface.label`]&&(e.attributes[cr]=t)}onStart(){}shutdown(){return Promise.resolve(void 0)}};P();var Mp=class{constructor({attributeScrubbers:e}){N(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)}};P();var Np=class{constructor({userManager:e}){N(this,`_userManager`,void 0),this._userManager=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){this._userManager.getUserId()&&e.setAttributes({[Qd]:this._userManager.getUserId()})}shutdown(){return Promise.resolve(void 0)}};P();var Pp=class{constructor({userSessionManager:e}){N(this,`_userSessionManager`,void 0),this._userSessionManager=e}forceFlush(){return Promise.resolve(void 0)}onEmit(e){var t,n,r;let i=(t=this._userSessionManager.getUserSessionId())==null?``:t,a=(n=this._userSessionManager.getPreviousUserSessionId())==null?``:n;e.setAttributes({"log.record.uid":tf(),[Xd]:i,[Zd]:a,[ur]:i,[dr]:a,[lr]:(r=this._userSessionManager.getSessionPartId())==null?``:r})}shutdown(){return Promise.resolve(void 0)}};P();var Fp=class{constructor({userManager:e}){N(this,`_userManager`,void 0),this._userManager=e}forceFlush(){return Promise.resolve(void 0)}onEnd(e){let t=this._userManager.getUserId();t&&(e.attributes[Qd]=t)}onStart(){}shutdown(){return Promise.resolve(void 0)}};M(),B();var Ip=class extends ea{inject(e,t,n){super.inject(e,t,n);let r=j.getSpan(e);if(r){let e=t instanceof Headers?t.get(`traceparent`):Ie.get(t,`traceparent`);e&&r.setAttribute(`mxl.w3c_traceparent`,e)}}};M(),P();var Lp=class{constructor({namespace:e,storage:t,diag:n}){N(this,`_diag`,void 0),N(this,`_keyPrefix`,void 0),N(this,`_storage`,void 0),N(this,`_writeDisabled`,!1),this._diag=n==null?k.createComponentLogger({namespace:`NamespacedStorage`}):n,this._keyPrefix=e?`${e}__`:``,this._storage=t}keys(){let e;try{({length:e}=this._storage)}catch(e){return this._diag.warn(`failed to read storage length`,String(e)),[]}let t=[];for(let n=0;n<e;n++)try{let e=this._storage.key(n);if(e===null)continue;this._keyPrefix?e.startsWith(this._keyPrefix)&&t.push(e.substring(this._keyPrefix.length)):t.push(e)}catch(e){this._diag.warn(`failed to read storage key at index ${n.toString()}`,String(e))}return t}get length(){return this.keys().length}clear(){let e=!0;for(let t of this.keys())this._safeRemove(this._keyName(t))||(e=!1);return e}getItem(e){try{return this._storage.getItem(this._keyName(e))}catch(t){return this._diag.warn(`failed to read ${e}`,String(t)),null}}key(e){var t;return(t=this.keys()[e])==null?null:t}removeItem(e){return this._safeRemove(this._keyName(e))}setItem(e,t){if(this._writeDisabled)return!1;try{return this._storage.setItem(this._keyName(e),t),!0}catch(e){return this._disableWrites(e),!1}}getStorageEventKey(e){return this._keyName(e)}_keyName(e){return`${this._keyPrefix}${e}`}_safeRemove(e){try{return this._storage.removeItem(e),!0}catch(t){return this._diag.warn(`failed to remove ${e}`,String(t)),!1}}_disableWrites(e){if(this._writeDisabled)return;this._writeDisabled=!0;let t=e instanceof Error?e.name:`UnknownError`;this._diag.error(`writes disabled after failure; continuing in-memory only`,t)}};let Rp=({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},zp=/\/\/(.+):(.+)@(.+)\//,Bp=[`AWSAccessKeyId`,`Signature`,`sig`,"`X-Goog-Signature",`password`,`auth`,`pw`,`token`],Vp=({value:e,queryParamRegex:t,scrubPath:n,scrubQuery:r})=>{let i=e;return n&&(i=i.replace(zp,`//REDACTED:REDACTED@$3/`)),r&&(i=i.replaceAll(t,`$1$2=REDACTED`)),i},Hp=e=>{let t=[...Bp,...e||[]],n=RegExp(`(^|&|\\?)(${t.join(`|`)})=[^&]+`,`g`);return[{key:qd,scrub:e=>Vp({queryParamRegex:n,scrubPath:!0,scrubQuery:!0,value:e})},{key:Gd,scrub:e=>Vp({queryParamRegex:n,scrubPath:!0,scrubQuery:!0,value:e})},{key:`url.path`,scrub:e=>Vp({queryParamRegex:n,scrubPath:!0,scrubQuery:!1,value:e})},{key:`url.query`,scrub:e=>Vp({queryParamRegex:n,scrubPath:!1,scrubQuery:!0,value:e})}]};var Up,Wp=n((()=>{Up=`http.request.body.size`}));function Gp(...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}=Kp(t.body);return t.body=e,n}else return Promise.resolve(Jp(t.body))}else{let t=e[0];return t!=null&&t.body?t.clone().text().then(e=>Yp(e)):Promise.resolve()}}function Kp(e){if(!e.pipeThrough)return em.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 K(function*(){let r=yield e;t+=r.byteLength,n.enqueue(e)})()},flush(){n(t)}});return{body:e.pipeThrough(i),length:r}}function qp(e){return typeof Document<`u`&&e instanceof Document}function Jp(e){if(qp(e))return new XMLSerializer().serializeToString(document).length;if(typeof e==`string`)return Yp(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return Xp(e);if(e instanceof URLSearchParams)return Yp(e.toString());if(e.byteLength!==void 0)return e.byteLength;em.warn(`unknown body type`)}function Yp(e){return tm.encode(e).byteLength}function Xp(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 Zp(e){let t=Qp(),n=e.toUpperCase();return n in t?n:`_OTHER`}function Qp(){return rm===void 0&&(rm=nm),rm}function $p(e){let t=Number(e.port||im[e.protocol]);if(t&&!isNaN(t))return t}var em,tm,nm,rm,im,am=n((()=>{M(),B(),q(),em=k.createComponentLogger({namespace:`@opentelemetry/opentelemetry-instrumentation-fetch/utils`}),tm=new TextEncoder,nm={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},im={"https:":`443`,"http:":`80`}})),om,sm=n((()=>{om=`0.221.0`})),cm,lm,um,dm=n((()=>{M(),B(),Wp(),L(),am(),sm(),P(),cm=300,lm=typeof PerformanceObserver<`u`,um=class extends Es{constructor(e={}){super(`@opentelemetry/instrumentation-fetch`,om,e),N(this,`component`,`fetch`),N(this,`version`,om),N(this,`moduleName`,this.component),N(this,`_usedResources`,new WeakSet),N(this,`_tasksCount`,0)}init(){}_addChildSpan(e,t){let n=this.tracer.startSpan(`CORS Preflight`,{startTime:t[X.FETCH_START]},j.setSpan(O.active(),e));Su(n,t,this.getConfig().ignoreNetworkEvents,void 0,!0),n.end(t[X.RESPONSE_END])}_addFinalSpanAttributes(e,t){let n=Ou(t.url);e.setAttribute(ti,t.status),e.setAttribute(ni,n.hostname);let r=$p(n);r&&e.setAttribute(ri,r)}_addHeaders(e,t){if(!ku(t,this.getConfig().propagateTraceHeaderCorsUrls)){let e={};A.inject(O.active(),e),Object.keys(e).length>0&&this._diag.debug(`headers inject skipped due to CORS policy`);return}if(e instanceof Request)A.inject(O.active(),e.headers,{set:(e,t,n)=>e.set(t,typeof n==`string`?n:String(n))});else{let t=new Headers(e.headers);A.inject(O.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(Aa(e,this.getConfig().ignoreUrls)){this._diag.debug(`ignoring span as url matches ignored url`);return}let n={},r=t.method,i=Zp(t.method||`GET`),a=i;return n[$r]=i,i!==r&&(n[ei]=r),n[li]=e,this.tracer.startSpan(a,{kind:Dt.CLIENT,attributes:n})}_findResourceAndAddNetworkEvents(e,t,n){let r=t.entries;if(!r.length){if(!performance.getEntriesByType)return;r=performance.getEntriesByType(`resource`)}let i=Tu(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)),Su(e,t,this.getConfig().ignoreNetworkEvents,void 0,!0)}}_markResourceAsUsed(e){this._usedResources.add(e)}_endSpan(e,t,n){let r=vi(Date.now()),i=yi();this._addFinalSpanAttributes(e,n),n.status>=400&&(e.setStatus({code:kt.ERROR}),e.setAttribute(Yr,String(n.status))),setTimeout(()=>{var n;(n=t.observer)==null||n.disconnect(),this._findResourceAndAddNetworkEvents(e,t,i),this._tasksCount--,this._clearResources(),e.end(r)},cm)}_patchConstructor(){return e=>{let t=this;return function(...n){if(!t._isEnabled)return e.apply(this,n);let r=this,i=Ou(n[0]instanceof Request?n[0].url:String(n[0])).href,a;a=n[0]instanceof Request?n[1]==null?n[0]:new Request(n[0],n[1]):n[1]||{};let o=t._createSpan(i,a);if(!o)return e.apply(this,n);let s=t._prepareSpanData(i);t.getConfig().measureRequestSize&&Gp(...n).then(e=>{e&&o.setAttribute(Up,e)}).catch(e=>{t._diag.warn(`getFetchBodyLength`,e)});function c(e,n){t._applyAttributesAfterFetch(e,a,n),t._endSpan(e,s,{status:n.status||0,statusText:n.message,url:i})}function l(e,n){t._applyAttributesAfterFetch(e,a,n),n.status>=200&&n.status<400?t._endSpan(e,s,n):t._endSpan(e,s,{status:n.status,statusText:n.statusText,url:i})}function u(e,n){try{let t=n.clone().body;if(t){let r=t.getReader(),i=()=>{r.read().then(({done:t})=>{t?l(e,n):i()},t=>{c(e,t)})};i()}else l(e,n)}catch(n){t._diag.error(`Failed to read fetch response body`,n),t._endSpan(e,s,{status:0,url:i})}return n}function d(e,n){try{c(e,n)}catch(r){t._diag.error(`Failed to end span on fetch error`,r),t._endSpan(e,s,{status:n.status||0,url:i})}throw n}return O.with(j.setSpan(O.active(),o),()=>(t._callRequestHook(o,a),t._addHeaders(a,i),t._tasksCount++,e.apply(r,a instanceof Request?[a]:[i,a]).then(u.bind(r,o),d.bind(r,o))))}}}_applyAttributesAfterFetch(e,t,n){let r=this.getConfig().applyCustomAttributesOnSpan;r&&ks(()=>r(e,t,n),e=>{e&&this._diag.error(`applyCustomAttributesOnSpan`,e)},!0)}_callRequestHook(e,t){let n=this.getConfig().requestHook;n&&ks(()=>n(e,t),e=>{e&&this._diag.error(`requestHook`,e)},!0)}_prepareSpanData(e){let t=yi(),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(!lm){this._diag.warn(`this instrumentation is intended for web usage only, it does not instrument server-side fetch()`);return}if(!this._isEnabled){if(this._isFetchPatched){this._diag.debug(`fetch constructor already patched`),this._isEnabled=!0;return}try{this._wrap(globalThis,`fetch`,this._patchConstructor()),this._isFetchPatched=!0,this._isEnabled=!0}catch(e){this._diag.warn(`Failed to patch globalThis.fetch; instrumentation will not be enabled. Another script may have locked globalThis.fetch via Object.defineProperty.`,e)}}}disable(){lm&&this._isEnabled&&(this._isEnabled=!1,this._usedResources=new WeakSet)}}})),fm=r({FetchInstrumentation:()=>um}),pm=n((()=>{dm()})),mm,hm=n((()=>{mm=`http.request.body.size`})),gm,_m=n((()=>{(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`})(gm||(gm={}))}));function vm(e){return typeof Document<`u`&&e instanceof Document}function ym(e){if(vm(e))return new XMLSerializer().serializeToString(document).length;if(typeof e==`string`)return bm(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return xm(e);if(e instanceof URLSearchParams)return bm(e.toString());if(e.byteLength!==void 0)return e.byteLength;Tm.warn(`unknown body type`)}function bm(e){return Em.encode(e).byteLength}function xm(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 Sm(e){let t=Cm(),n=e.toUpperCase();return n in t?n:`_OTHER`}function Cm(){return Om===void 0&&(Om=Dm),Om}function wm(e){let t=Number(e.port||km[e.protocol]);if(t&&!isNaN(t))return t}var Tm,Em,Dm,Om,km,Am=n((()=>{M(),B(),Tm=k.createComponentLogger({namespace:`@opentelemetry/opentelemetry-instrumentation-xml-http-request/utils`}),Em=new TextEncoder,Dm={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},km={"https:":`443`,"http:":`80`}})),jm,Mm=n((()=>{jm=`0.221.0`})),Nm,Pm,Fm=n((()=>{M(),js(),B(),Mu(),L(),hm(),_m(),Am(),Mm(),P(),Nm=300,Pm=class extends Es{constructor(e={}){super(`@opentelemetry/instrumentation-xml-http-request`,jm,e),N(this,`component`,`xml-http-request`),N(this,`version`,jm),N(this,`moduleName`,this.component),N(this,`_tasksCount`,0),N(this,`_xhrMem`,new WeakMap),N(this,`_usedResources`,new WeakSet)}init(){}_addHeaders(e,t){let n=Ou(t).href;if(!ku(n,this.getConfig().propagateTraceHeaderCorsUrls)){let e={};A.inject(O.active(),e),Object.keys(e).length>0&&this._diag.debug(`headers inject skipped due to CORS policy`);return}let r={};A.inject(O.active(),r),Object.keys(r).forEach(t=>{e.setRequestHeader(t,String(r[t]))})}_addChildSpan(e,t){O.with(j.setSpan(O.active(),e),()=>{let e=this.tracer.startSpan(`CORS Preflight`,{startTime:t[X.FETCH_START]});Su(e,t,this.getConfig().ignoreNetworkEvents,void 0,!0),e.end(t[X.RESPONSE_END])})}_addFinalSpanAttributes(e,t){t.status&&e.setAttribute(ti,t.status)}_applyAttributesAfterXHR(e,t){let n=this.getConfig().applyCustomAttributesOnSpan;typeof n==`function`&&ks(()=>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=Ou(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&&(R.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=R.getEntriesByType(`resource`));let o=Tu(Ou(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)),Su(t,e,this.getConfig().ignoreNetworkEvents,void 0,!0)}}_cleanPreviousSpanInformation(e){let t=this._xhrMem.get(e);if(t){let n=t.callbackToRemoveEvents;n&&n(),this._xhrMem.delete(e)}}_createSpan(e,t,n){let r=Ou(t);if(Aa(r.href,this.getConfig().ignoreUrls)){this._diag.debug(`ignoring span as url matches ignored url`);return}let i={},a=n,o=Sm(n),s=o;i[$r]=o,o!==a&&(i[ei]=a),i[li]=r.toString(),i[ni]=r.hostname;let c=wm(r);c&&(i[ri]=c);let l=this.tracer.startSpan(s,{kind:Dt.CLIENT,attributes:i});return l.addEvent(gm.METHOD_OPEN),this._cleanPreviousSpanInformation(e),this._xhrMem.set(e,{span:l,spanUrl:t}),l}_markResourceAsUsed(e){this._usedResources.add(e)}_patchOpen(){return e=>{let t=this;return function(...n){if(!t._isEnabled)return e.apply(this,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),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),i?a&&(t.setStatus({code:kt.ERROR,message:a}),t.setAttribute(Yr,a)):o.status&&o.status>=400&&(t.setStatus({code:kt.ERROR}),t.setAttribute(Yr,String(o.status)))}let s=yi(),c=Date.now();setTimeout(()=>{t(n,o,s,c)},Nm)}function r(){n(gm.EVENT_ERROR,this,!0,`error`)}function i(){n(gm.EVENT_ABORT,this,!1)}function a(){n(gm.EVENT_TIMEOUT,this,!0,`timeout`)}function o(){this.status<299?n(gm.EVENT_LOAD,this,!1):n(gm.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){if(!e._isEnabled)return t.apply(this,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 e=n[0],t=ym(e);t!==void 0&&l.setAttribute(mm,t)}O.with(j.setSpan(O.active(),l),()=>{e._tasksCount++,c.sendStartTime=yi(),l.addEvent(gm.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(){if(!this._isEnabled){if(this._isXhrPatched){this._diag.debug(`reactivating existing patch on`,this.moduleName,this.version),this._isEnabled=!0;return}try{this._diag.debug(`applying patch to`,this.moduleName,this.version),this._wrap(XMLHttpRequest.prototype,`open`,this._patchOpen()),this._wrap(XMLHttpRequest.prototype,`send`,this._patchSend()),this._isXhrPatched=!0,this._isEnabled=!0}catch(e){this._unwrap(XMLHttpRequest.prototype,`open`),this._unwrap(XMLHttpRequest.prototype,`send`),this._diag.warn(`Failed to patch globalThis.XMLHttpRequest; instrumentation will not be enabled. Another script may have locked globalThis.XMLHttpRequest via Object.defineProperty.`,e)}}}disable(){this._isEnabled&&(this._isEnabled=!1,this._tasksCount=0,this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}}})),Im=r({XMLHttpRequestInstrumentation:()=>Pm}),Lm=n((()=>{Fm()}));W(),q();let Rm=function(){var e=K(function*(e={}){var t,n;let r=[];if(!((t=e.omit)!=null&&t.has(`@opentelemetry/instrumentation-fetch`))){var i,a,o,s;let{FetchInstrumentation:t}=yield Promise.resolve().then(()=>(pm(),fm));r.push(new t(U(U({},e[`@opentelemetry/instrumentation-fetch`]),{},{ignoreUrls:[...(i=(a=e.network)==null?void 0:a.ignoreUrls)==null?[]:i,...(o=(s=e[`@opentelemetry/instrumentation-fetch`])==null?void 0:s.ignoreUrls)==null?[]:o]})))}if(!((n=e.omit)!=null&&n.has(`@opentelemetry/instrumentation-xml-http-request`))){var c,l,u,d;let{XMLHttpRequestInstrumentation:t}=yield Promise.resolve().then(()=>(Lm(),Im));r.push(new t(U(U({},e[`@opentelemetry/instrumentation-xml-http-request`]),{},{ignoreUrls:[...(c=(l=e.network)==null?void 0:l.ignoreUrls)==null?[]:c,...(u=(d=e[`@opentelemetry/instrumentation-xml-http-request`])==null?void 0:d.ignoreUrls)==null?[]:u]})))}return r});return function(){return e.apply(this,arguments)}}(),zm={isRecording:()=>!1,setEnabled:()=>{}};M(),P();let Bm=new class{constructor({diagLogger:e=k.createComponentLogger({namespace:`mxl-registry`})}={}){N(this,`_sdk`,null),N(this,`_diag`,void 0),N(this,`register`,e=>{this._sdk!==null&&this._diag.warn(`previously registered sdk will be overwritten`),this._sdk=e}),N(this,`clear`,()=>{this._sdk===null&&this._diag.warn(`sdk already cleared, this is a no-op`),this._sdk=null}),N(this,`registered`,()=>this._sdk),this._diag=e}},Vm=(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}>`};P();var Hm=class extends G{constructor({diag:e,perf:t,shouldTrack:n,innerTextForElement:r}={}){super({config:{},diag:e,instrumentationName:`ClicksInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),N(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.userSessionManager.getSessionPartSpan();n&&n.addEvent(`click`,{"mxl.type":`ux.tap`,"tap.coords":`${e.x.toString()},${e.y.toString()}`,"view.name":Vm(t,r?r(t):t.textContent)},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)}};Mu();let Um=()=>{let e={},t=window.performance.getEntriesByType(`navigation`)[0];return Object.values(X).forEach(n=>{if(xu(t,n)){let r=t[n];typeof r==`number`&&(e[n]=r)}}),e},Wm={"first-contentful-paint":`firstContentfulPaint`,"first-paint":`firstPaint`},Gm=e=>{window.performance.getEntriesByType(`paint`).forEach(({name:t,startTime:n})=>{xu(Wm,t)&&e.addEvent(Wm[t],n)})};M(),B(),js(),Mu(),P();var Km=class extends G{constructor({diag:e,perf:t,enabled:n,applyCustomAttributesOnSpan:r,ignorePerformancePaintEvents:i=!1,ignoreNetworkEvents:a=!1}={}){super({config:{applyCustomAttributesOnSpan:r,enabled:n,ignoreNetworkEvents:a,ignorePerformancePaintEvents:i},diag:e,instrumentationName:`DocumentLoadInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),N(this,`_onDocumentLoaded`,void 0),N(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=[...document.getElementsByTagName(`meta`)].find(e=>e.getAttribute(`name`)===Xi),t=Um(),n=(e==null?void 0:e.content)||``;O.with(A.extract(w,{traceparent:n}),()=>{var e;let n=this._startSpan(`documentLoad`,X.FETCH_START,t);n&&(O.with(j.setSpan(O.active(),n),()=>{let e=this._startSpan(`documentFetch`,X.FETCH_START,t);e&&(e.setAttribute(qd,location.href),O.with(j.setSpan(O.active(),e),()=>{var n;Su(e,t,this.getConfig().ignoreNetworkEvents),this._addCustomAttributesOnSpan(e,(n=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:n.documentFetch),this._endSpan(e,X.RESPONSE_END,t)}))}),n.setAttribute(F,`ux.document_load`),n.setAttribute(qd,location.href),n.setAttribute(Jd,navigator.userAgent),this._addResourcesSpans(n),this.getConfig().ignoreNetworkEvents||(Z(n,X.FETCH_START,t),Z(n,X.UNLOAD_EVENT_START,t),Z(n,X.UNLOAD_EVENT_END,t),Z(n,X.DOM_INTERACTIVE,t),Z(n,X.DOM_CONTENT_LOADED_EVENT_START,t),Z(n,X.DOM_CONTENT_LOADED_EVENT_END,t),Z(n,X.DOM_COMPLETE,t),Z(n,X.LOAD_EVENT_START,t),Z(n,X.LOAD_EVENT_END,t)),this.getConfig().ignorePerformancePaintEvents||Gm(n),this._addCustomAttributesOnSpan(n,(e=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:e.documentLoad),this._endSpan(n,X.LOAD_EVENT_END,t))})}_endSpan(e,t,n){e&&(xu(n,t)&&typeof n[t]==`number`?e.end(n[t]):e.end())}_initResourceSpan(e,t){var n;let r=this._startSpan(`resourceFetch`,X.FETCH_START,e,t);r&&(r.setAttribute(F,`ux.resource_fetch`),r.setAttribute(qd,e.name),Su(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(Kd,e.responseStatus),typeof e.encodedBodySize==`number`&&e.encodedBodySize>=0&&r.setAttribute(Yd,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,X.RESPONSE_END,e))}_startSpan(e,t,n,r){if(xu(n,t)&&typeof n[t]==`number`)return this.tracer.startSpan(e,{startTime:n[t]},r?j.setSpan(O.active(),r):void 0)}_waitForPageLoad(){window.document.readyState===`complete`?this._onDocumentLoaded():window.addEventListener(`load`,this._onDocumentLoaded)}_addCustomAttributesOnSpan(e,t){t&&ks(()=>{t(e)},e=>{e&&this._diag.error(`addCustomAttributesOnSpan`,e)},!0)}_addCustomAttributesOnResourceSpan(e,t,n){n&&ks(()=>{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)}};W();let qm=[`diag`];function Jm(e){var t,n;return typeof PerformanceObserver<`u`&&((t=(n=PerformanceObserver.supportedEntryTypes)==null?void 0:n.includes(e))==null?!1:t)}function Ym(e,t,n){let r=n==null?{}:n,{diag:i}=r,a=rs(r,qm);if(!Jm(e))return i==null||i.debug(`${e} not supported, skipping observer`),null;try{let n=new PerformanceObserver(n=>{for(let r of n.getEntries())try{t(r)}catch(t){i==null||i.error(`error processing ${e} entry`,t)}});return n.observe(U({buffered:!0,type:e},a)),n}catch(e){return null}}P();var Xm=class extends G{constructor({diag:e,perf:t,limitManager:n}={}){super({config:{},diag:e,instrumentationName:`ElementTimingInstrumentation`,instrumentationVersion:`1.0.0`,limitManager:n,perf:t}),N(this,`_observer`,null),N(this,`_isEnabled`,!1),this._config.enabled&&this.enable()}enable(){if(!this._isEnabled){if(!Jm(`element`)){this._diag.debug(`element not supported, skipping`);return}if(this._isEnabled=!0,this._observer&&this._observer.disconnect(),this._observer=Ym(`element`,e=>this._processEntry(e),{diag:this._diag}),!this._observer){this._isEnabled=!1,this._diag.error(`failed to enable`);return}}}disable(){this._isEnabled=!1,this._observer&&(this._observer.disconnect(),this._observer=null)}_processEntry(e){var t,n;if(!this._isEnabled||(t=this.limitManager)!=null&&t.limitElementTimingEntry())return;let r=this.tracer.startSpan(e.identifier,{attributes:{[F]:`ux.element_timing`,"mxl.element_timing.identifier":e.identifier,"mxl.element_timing.element":(n=e.element)==null||(n=n.tagName)==null?void 0:n.toLowerCase(),"mxl.element_timing.render_time":e.renderTime,"mxl.element_timing.load_time":e.loadTime,"mxl.element_timing.start_time":e.startTime,"mxl.element_timing.url":e.url,"mxl.element_timing.natural_width":e.naturalWidth,"mxl.element_timing.natural_height":e.naturalHeight},startTime:this.perf.epochMillisFromOriginOffset(0)});e.loadTime>0&&r.addEvent(`load`,this.perf.epochMillisFromOriginOffset(e.loadTime)),r.end(this.perf.epochMillisFromOriginOffset(e.startTime))}};P();var Zm=class extends G{constructor({diag:e,perf:t,rootNode:n,emptyCheckDelayMs:r=500}){super({config:{},diag:e,instrumentationName:`EmptyRootInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),N(this,`_observer`,void 0),N(this,`_emptyCheckDelayMs`,void 0),N(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.userSessionManager.getSessionPartSpan();e?e.addEvent(`empty-root-node`,{"mxl.type":`ux.empty_root_node`}):this._diag.debug(`no active session found to emit event on`)}}};P();var Qm=class extends G{constructor({diag:e,perf:t}={}){super({config:{},diag:e,instrumentationName:`GlobalExceptionInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),N(this,`_onErrorHandler`,void 0),N(this,`_onUnhandledRejectionHandler`,void 0),this._onErrorHandler=e=>{this.logManager.logException(e.error||e.message,{handled:!1,handler:`global_exception`,timestamp:this.perf.epochMillisFromOriginOffset(e.timeStamp)})},this._onUnhandledRejectionHandler=e=>{this.logManager.logException(e.reason,{handled:!1,handler:`promise_rejection`,timestamp:this.perf.epochMillisFromOriginOffset(e.timeStamp)})},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 $m=()=>`mxlv2-${Date.now()}-${Math.floor(Math.random()*8999999999999)+0xe8d4a51000}`;H(),P();var eh=class extends G{constructor({diag:e,perf:t}={}){super({config:{},diag:e,instrumentationName:`LoafInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),N(this,`_observer`,null),N(this,`_isFirstEntry`,!0),N(this,`_removeSessionEndListener`,null),N(this,`_isEnabled`,!1),N(this,`_totalDuration`,0),N(this,`_workDuration`,0),N(this,`_styleLayoutDuration`,0),N(this,`_count`,0),N(this,`_longestDuration`,0),N(this,`_longestDurationExcludingFirst`,0),N(this,`_totalBlockingDuration`,0),N(this,`_scriptSummaries`,new Map),this._config.enabled&&this.enable()}enable(){if(!this._isEnabled){if(!Jm(`long-animation-frame`)){this._diag.debug(`long-animation-frame not supported, skipping`);return}if(this._isEnabled=!0,this._observer&&this._observer.disconnect(),this._observer=Ym(`long-animation-frame`,e=>this._processEntry(e),{diag:this._diag}),!this._observer){this._isEnabled=!1,this._diag.error(`failed to enable`);return}this._registerSessionEndListener()}}_registerSessionEndListener(){this._isEnabled&&(this._removeSessionEndListener&&this._removeSessionEndListener(),this._removeSessionEndListener=this.userSessionManager.addSessionPartEndedListener(()=>{try{this._flushReport()}catch(e){this._diag.error(`error flushing report`,e)}}))}setUserSessionManager(e){super.setUserSessionManager(e),this._registerSessionEndListener()}disable(){this._isEnabled=!1,this._resetAccumulators(),this._observer&&(this._observer.disconnect(),this._observer=null),this._removeSessionEndListener&&(this._removeSessionEndListener(),this._removeSessionEndListener=null)}_processEntry(e){if(this._isEnabled){this._count++,this._totalDuration+=e.duration,this._workDuration+=e.renderStart?e.renderStart-e.startTime:e.duration,e.styleAndLayoutStart&&(this._styleLayoutDuration+=Math.max(0,e.startTime+e.duration-e.styleAndLayoutStart)),this._longestDuration=Math.max(this._longestDuration,e.duration),this._isFirstEntry&&this._count===1?this._isFirstEntry=!1:(this._longestDurationExcludingFirst=Math.max(this._longestDurationExcludingFirst,e.duration),e.firstUIEventTimestamp===0&&(this._totalBlockingDuration+=e.blockingDuration));try{for(let t of e.scripts){let e=t.sourceURL||`(inline)`;e.length>2048&&(e=`${e.substring(0,2048)}...`);let n=this._scriptSummaries.get(e);n?(n.totalDuration+=t.duration,n.styleAndLayoutDuration+=t.forcedStyleAndLayoutDuration,n.count++):this._scriptSummaries.set(e,{count:1,styleAndLayoutDuration:t.forcedStyleAndLayoutDuration,totalDuration:t.duration})}}catch(e){this._diag.error(`error processing scripts for entry`,e)}}}_flushReport(){if(this._count===0)return;let e;e=this._totalBlockingDuration<=200?`good`:this._totalBlockingDuration<=600?`needs-improvement`:`poor`;let t={[F]:`ux.web_vital`,"mxl.web_vital.id":$m(),"mxl.web_vital.name":`TBD`,"mxl.web_vital.value":Math.round(this._totalBlockingDuration),"mxl.web_vital.rating":e,"mxl.tbd.loaf_total_duration":Math.round(this._totalDuration),"mxl.tbd.loaf_work_duration":Math.round(this._workDuration),"mxl.tbd.loaf_style_and_layout_duration":Math.round(this._styleLayoutDuration),"mxl.tbd.loaf_count":this._count,"mxl.tbd.loaf_longest_duration":Math.round(this._longestDuration),"mxl.tbd.loaf_longest_duration_excluding_first":Math.round(this._longestDurationExcludingFirst)};try{this.logger.emit({attributes:t,eventName:`mxl-loaf-report`,severityNumber:V.INFO})}catch(e){this._diag.error(`error emitting loaf report`,e)}try{if(this._scriptSummaries.size>0){let e=[...this._scriptSummaries].sort((e,t)=>t[1].totalDuration-e[1].totalDuration).slice(0,250).map(([e,t])=>[e,{count:t.count,style_and_layout_duration:Math.round(t.styleAndLayoutDuration),total_duration:Math.round(t.totalDuration)}]);this.logger.emit({attributes:{[F]:`ux.loaf_scripts`},body:JSON.stringify(Object.fromEntries(e)),eventName:`mxl-loaf-scripts`,severityNumber:V.INFO})}}catch(e){this._diag.error(`error emitting loaf script summary`,e)}this._resetAccumulators()}_resetAccumulators(){this._totalDuration=0,this._workDuration=0,this._styleLayoutDuration=0,this._count=0,this._longestDuration=0,this._longestDurationExcludingFirst=0,this._totalBlockingDuration=0,this._scriptSummaries=new Map}};H(),P();var th=class extends G{constructor({diag:e,perf:t,limitManager:n}={}){super({config:{},diag:e,instrumentationName:`ServerTimingInstrumentation`,instrumentationVersion:`1.0.0`,limitManager:n,perf:t}),N(this,`_onLoad`,void 0),N(this,`_performanceCollected`,!1),this._onLoad=()=>{this._readServerTiming()},this._config.enabled&&this.enable()}enable(){if(window.removeEventListener(`load`,this._onLoad),window.document.readyState===`complete`){this._readServerTiming();return}window.addEventListener(`load`,this._onLoad)}disable(){window.removeEventListener(`load`,this._onLoad)}_readServerTiming(){var e;if(this._performanceCollected)return;this._performanceCollected=!0;let t=(e=performance.getEntriesByType(`navigation`)[0])==null?void 0:e.serverTiming;if(t!=null&&t.length)for(let e of t){var n;if((n=this.limitManager)!=null&&n.limitServerTimingEntry())return;this.logger.emit({attributes:{[F]:`ux.server_timing`,"mxl.server_timing.name":e.name,"mxl.server_timing.duration":e.duration,"mxl.server_timing.description":e.description},eventName:`mxl-server-timing`,severityNumber:V.INFO})}}};let nh=`mxl.user_timing.start_time`,rh=`mxl.user_timing.duration`,ih=`mxl.user_timing.entry_type`;H(),P(),W();var ah=class extends G{constructor({diag:e,perf:t,limitManager:n,allowedEntries:r}={}){super({config:{},diag:e,instrumentationName:`UserTimingInstrumentation`,instrumentationVersion:`1.0.0`,limitManager:n,perf:t}),N(this,`_markObserver`,null),N(this,`_measureObserver`,null),N(this,`_seenEntries`,new Set),N(this,`_isEnabled`,!1),N(this,`_allowedEntries`,void 0),this._allowedEntries=r,this._config.enabled&&this.enable()}enable(){this._isEnabled||(this._isEnabled=!0,this._seenEntries=new Set,this._markObserver&&this._markObserver.disconnect(),this._measureObserver&&this._measureObserver.disconnect(),this._markObserver=Ym(`mark`,this._processEntry.bind(this),{diag:this._diag}),this._markObserver||this._diag.error(`failed to enable mark observer`),this._measureObserver=Ym(`measure`,e=>this._processEntry(e),{diag:this._diag}),this._measureObserver||this._diag.error(`failed to enable measure observer`),!this._markObserver&&!this._measureObserver&&(this._isEnabled=!1))}disable(){this._isEnabled=!1,this._markObserver&&(this._markObserver.disconnect(),this._markObserver=null),this._measureObserver&&(this._measureObserver.disconnect(),this._measureObserver=null),this._seenEntries=new Set}_processEntry(e){var t;if(!this._isEnabled||this._allowedEntries!==void 0&&!(Array.isArray(this._allowedEntries)?this._allowedEntries.includes(e.name):this._allowedEntries(e)))return;let n=`${location.href}::${e.name}`;if(this._seenEntries.has(n)||(this._seenEntries.add(n),(t=this.limitManager)!=null&&t.limitUserTimingEntry(e.entryType)))return;if(e.entryType===`measure`){let t=e.detail;this.tracer.startSpan(e.name,{attributes:U({[F]:`ux.user_timing`,[rr]:`user_timing`,[ih]:e.entryType,[nh]:this.perf.millisFromZeroTime(e.startTime),[rh]:e.duration},t!=null&&{"mxl.user_timing.detail":JSON.stringify(t)}),startTime:this.perf.epochMillisFromOriginOffset(e.startTime)}).end(this.perf.epochMillisFromOriginOffset(e.startTime+e.duration));return}let{detail:r}=e,i=r==null?void 0:JSON.stringify(r);this.logger.emit({attributes:{[F]:`ux.user_timing`,"mxl.user_timing.name":e.name,[nh]:this.perf.millisFromZeroTime(e.startTime),[rh]:e.duration,[ih]:e.entryType},body:i,eventName:`mxl-user-timing`,severityNumber:V.INFO,timestamp:this.perf.epochMillisFromOriginOffset(e.startTime)})}};let oh=`mxl.web_vital.attribution.`;P(),W();var sh=class{constructor(){N(this,`t`,void 0),N(this,`o`,0),N(this,`i`,[])}l(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 ch=()=>{let e=performance.getEntriesByType(`navigation`)[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},lh=e=>{if(document.readyState===`loading`)return`loading`;let t=ch();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`},uh=e=>{let t=e.nodeName;return e.nodeType===1?t.toLowerCase():t.toUpperCase().replace(/^#/,``)},dh=e=>{let t=``;try{for(;(e==null?void 0:e.nodeType)!==9;){var n;let r=e,i=r.id?`#`+r.id:[uh(r),...Array.from((n=r.classList)==null?[]:n).sort()].join(`.`);if(t.length+i.length>99)return t||i;if(t=t?i+`>`+t:i,r.id)break;e=r.parentNode}}catch(e){}return t},fh=new WeakMap;function ph(e,t){let n=fh.get(t);return n||(n=new WeakMap,fh.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}let mh=-1,hh=()=>mh,gh=e=>{addEventListener(`pageshow`,t=>{t.persisted&&(mh=t.timeStamp,e(t))},!0)},Q=(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)))}},_h=e=>{requestAnimationFrame(()=>requestAnimationFrame(e))},vh=()=>{var e,t;return(e=(t=ch())==null?void 0:t.activationStart)==null?0:e},yh=-1,bh=new Set,xh=()=>document.visibilityState!==`hidden`||document.prerendering?1/0:0,Sh=e=>{if(document.visibilityState===`hidden`){if(e.type===`visibilitychange`)for(let e of bh)e();isFinite(yh)||(yh=e.type===`visibilitychange`?e.timeStamp:0,removeEventListener(`prerenderingchange`,Sh,!0))}},Ch=(e=!1)=>{if(e&&(yh=1/0),yh<0){var t;let e=vh(),n=document.prerendering||(t=globalThis.performance.getEntriesByType(`visibility-state`).find(t=>t.name===`hidden`&&t.startTime>=e))==null?void 0:t.startTime;yh=n==null?xh():n,addEventListener(`visibilitychange`,Sh,!0),addEventListener(`prerenderingchange`,Sh,!0),gh(()=>{setTimeout(()=>{yh=xh()})})}return{get firstHiddenTime(){return yh},onHidden(e){bh.add(e)}}},$=(e,t=-1,n,r=0,i,a,o)=>{let s=ch(),c=(s==null?void 0:s.navigationId)||0,l=`navigate`;return n?l=n:hh()>=0?l=`back-forward-cache`:s&&(document.prerendering||vh()>0?l=`prerender`:document.wasDiscarded?l=`restore`:s.type&&(l=s.type.replace(/_/g,`-`))),{name:e,value:t,rating:`good`,delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+0xe8d4a51000}`,navigationType:l,navigationId:r||c,navigationInteractionId:i,navigationURL:a||(s==null?void 0:s.name),navigationStartTime:o||0}},wh=(e,t,n={})=>{try{let r=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(r.length>0){let e=new PerformanceObserver(e=>{queueMicrotask(()=>{let n=e.getEntries();r.length>1&&n.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(n)})});for(let t of r)e.observe(U({type:t,buffered:!0},n));return e}}catch(e){}},Th=e=>{var t;return PerformanceObserver.supportedEntryTypes.includes(`soft-navigation`)&&typeof((t=globalThis.PerformanceSoftNavigation)==null||(t=t.prototype)==null?void 0:t.getLargestInteractionContentfulPaint)==`function`&&e&&e.reportSoftNavs},Eh=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){let t=e.keys().next().value;t!==void 0&&e.delete(t)}},Dh=e=>{let t=!1;return()=>{t||(e(),t=!0)}};var Oh=class{constructor(){N(this,`u`,void 0)}};let kh=e=>{document.prerendering?addEventListener(`prerenderingchange`,e,!0):e()},Ah=[1800,3e3],jh=(e,t={})=>{let n=Th(t);kh(()=>{let r=ph(t,Oh),i=Ch(),a,o=$(`FCP`),s=wh([`paint`],e=>{for(let t of e)t.name===`first-contentful-paint`&&(s.disconnect(),t.startTime<i.firstHiddenTime&&(o.value=Math.max(t.startTime-vh(),0),o.entries.push(t),o.navigationId=t.navigationId||o.navigationId,a(!0)))});s&&(a=Q(e,o,Ah,t.reportAllChanges),gh(n=>{o=$(`FCP`,-1,`back-forward-cache`,o.navigationId,o.navigationInteractionId,o.navigationURL,hh()),a=Q(e,o,Ah,t.reportAllChanges),_h(()=>{o.value=performance.now()-n.timeStamp,a(!0)})})),n&&wh([`soft-navigation`],n=>{n.forEach(n=>{r.u&&n.navigationId&&Eh(r.u,n),o=$(`FCP`,Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0),`soft-navigation`,n.navigationId,n.interactionId,n.name,n.startTime),a=Q(e,o,Ah,t.reportAllChanges),a(!0)})},t)})},Mh=[.1,.25],Nh=e=>e.find(e=>{var t;return((t=e.node)==null?void 0:t.nodeType)===1})||e[0],Ph=(e,t={})=>{let n=ph(t=Object.assign({},t),sh),r=new WeakMap;n.t=e=>{var n;if(!(e==null||(n=e.sources)==null)&&n.length){let n=Nh(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?dh(o):i;r.set(n,e)}}},((e,t={})=>{let n=Ch();jh(Dh(()=>{let r,i=$(`CLS`,0),a=ph(t,sh),o=(n,o,s,c,l)=>{i=$(`CLS`,0,n,o,s,c,l),a.o=0,r=Q(e,i,Mh,t.reportAllChanges)},s=(e=!1)=>{a.o>i.value&&(i.value=a.o,i.entries=a.i),r(e)},c=e=>{s(!0),o(`soft-navigation`,e.navigationId,e.interactionId,e.name,e.startTime)},l=e=>{for(let t of e)t.entryType===`soft-navigation`?c(t):a.l(t);s()},u=[`layout-shift`];Th(t)&&u.push(`soft-navigation`);let d=wh(u,l);d&&(r=Q(e,i,Mh,t.reportAllChanges),n.onHidden(()=>{l(d.takeRecords()),r(!0)}),gh(()=>{o(`back-forward-cache`,i.navigationId,i.navigationInteractionId,i.navigationURL,hh()),_h(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=Nh(i.sources);e&&(t={largestShiftTarget:r.get(e),largestShiftTime:i.startTime,largestShiftValue:i.value,largestShiftSource:e,largestShiftEntry:i,loadState:lh(i.startTime)})}}return Object.assign(e,{attribution:t})})(t))},t)},Fh=(e,t={})=>{let n=ph(t=Object.assign({},t),Oh);Th(t)&&(n.u=new Map),jh(t=>{e((e=>{let t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:lh(hh())};if(e.navigationType!==`soft-navigation`){if(e.entries.length){let n=ch(),r=e.entries.at(-1);if(n){let i=n.responseStart,a=n.activationStart||0,o=Math.max(0,i-a);t={timeToFirstByte:o,firstByteToFCP:e.value-o,loadState:lh(e.entries[0].startTime),navigationEntry:n,fcpEntry:r}}}}else{var r;let i=(r=n.u)==null?void 0:r.get(e.navigationId);i&&(t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:`complete`,navigationEntry:i})}return Object.assign(e,{attribution:t})})(t))},t)},Ih=0,Lh=1/0,Rh=0,zh=e=>{for(let t of e)t.interactionId&&(Lh=Math.min(Lh,t.interactionId),Rh=Math.max(Rh,t.interactionId),Ih=Rh?(Rh-Lh)/7+1:0)},Bh,Vh=()=>{var e;return Bh?Ih:(e=performance.interactionCount)==null?0:e},Hh=()=>{`interactionCount`in performance||Bh||(Bh=wh([`event`],zh,{durationThreshold:0}))},Uh=0;var Wh=class{constructor(){N(this,`h`,[]),N(this,`v`,new Map),N(this,`p`,void 0),N(this,`m`,void 0)}M(){Uh=Vh(),this.h.length=0,this.v.clear()}T(e){let t=Vh()-Uh,n=Math.min(this.h.length-1,Math.floor(t/50));return!t||n!==-1||e!==`soft-navigation`&&e!==`back-forward-cache`?this.h[n]:{D:8,id:-1,entries:[]}}l(e){var t;if((t=this.p)==null||t.call(this,e),!e.interactionId&&e.entryType!==`first-input`)return;let n=this.h.at(-1),r=this.v.get(e.interactionId);if(r||this.h.length<10||e.duration>n.D){var i;if(r?e.duration>r.D?(r.entries=[e],r.D=e.duration):e.duration===r.D&&e.startTime===r.entries[0].startTime&&r.entries.push(e):(r={id:e.interactionId,entries:[e],D:e.duration},this.v.set(r.id,r),this.h.push(r)),this.h.sort((e,t)=>t.D-e.D),this.h.length>10){let e=this.h.splice(10);for(let t of e)this.v.delete(t.id)}(i=this.m)==null||i.call(this,r)}}};let Gh=e=>{let t=`requestIdleCallback`in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,r=globalThis.cancelIdleCallback||clearTimeout;if(document.visibilityState===`hidden`)e();else{let i=Dh(e),a=-1,o=()=>{r(a),i()};addEventListener(`visibilitychange`,o,{once:!0,capture:!0}),a=n(()=>{removeEventListener(`visibilitychange`,o,{capture:!0}),i()},{timeout:t})}},Kh=[200,500],qh=(e,t={})=>{let n=ph(t=Object.assign({},t),Wh),r=[],i=[],a=0,o=new WeakMap,s=new WeakMap,c=!1,l=()=>{c||(Gh(u),c=!0)},u=()=>{let e=new Set(n.h.map(e=>o.get(e.entries[0]))),t=i.length-10;i=i.filter((n,r)=>r>=t||e.has(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)}r=r.filter(e=>e.startTime>a||s.has(e)),c=!1};n.p=e=>{let n=e.startTime+e.duration,r;a=Math.max(a,e.processingEnd);for(let a=i.length-1;a>=0;a--){let o=i[a];if(Math.abs(n-o.renderTime)<=8){r=o,r.startTime=Math.min(e.startTime,r.startTime),r.processingStart=Math.min(e.processingStart,r.processingStart),r.processingEnd=Math.max(e.processingEnd,r.processingEnd),t.includeProcessedEventEntries&&r.entries.push(e);break}}r||(r={startTime:e.startTime,processingStart:e.processingStart,processingEnd:e.processingEnd,renderTime:n,entries:t.includeProcessedEventEntries?[e]:[]},i.push(r)),(e.interactionId||e.entryType===`first-input`)&&o.set(e,r),l()},n.m=e=>{if(!s.get(e)){var n;let o=(n=e.entries.find(e=>e.target))==null?void 0:n.target;if(o){var r,i;let n=(r=(i=t.generateTarget)==null?void 0:i.call(t,o))==null?dh(o):r;s.set(e,n)}else{var a;let t=(a=e.entries.find(e=>e.targetSelector))==null?void 0:a.targetSelector;t&&s.set(e,t)}}};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=>{if(e.entries.length===0){let t=e.navigationStartTime||0,n={processedEventEntries:[],longAnimationFrameEntries:[],inputDelay:0,processingDuration:0,presentationDelay:e.value,loadState:lh(t)};return Object.assign(e,{attribution:n})}let t=e.entries[0],r=o.get(t),i=r.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.v.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:lh(t.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(e=>{var t;let n=e.interactionTime,r=e.nextPaintTime;if(!((t=e.longAnimationFrameEntries)!=null&&t.length)||!n||!r)return;let i=e.inputDelay,a=e.processingDuration,o,s,c=0,l=0,u=0,d=0;for(let t of e.longAnimationFrameEntries){l=l+t.startTime+t.duration-t.styleAndLayoutStart;for(let e of t.scripts){let t=e.startTime+e.duration;if(t<n)continue;let r=t-Math.max(n,e.startTime),u=e.duration?r/e.duration*e.forcedStyleAndLayoutDuration:0;c+=r-u,l+=u,r>d&&(s=e.startTime<n+i?`input-delay`:e.startTime>=n+i+a?`presentation-delay`:`processing-duration`,o=e,d=r)}}let f=e.longAnimationFrameEntries.at(-1),p=f?f.startTime+f.duration:0;p>=n+i+a&&(u=r-p),o&&s&&(e.longestScript={entry:o,subpart:s,intersectingDuration:d}),e.totalScriptDuration=c,e.totalStyleAndLayoutDuration=l,e.totalPaintDuration=u,e.totalUnattributedDuration=r-n-c-l-u})(p),Object.assign(e,{attribution:p})};wh([`long-animation-frame`],e=>{r=r.concat(e),l()},t),((e,t={})=>{if(!globalThis.PerformanceEventTiming||!(`interactionId`in PerformanceEventTiming.prototype))return;let n=Ch();kh(()=>{var r;Hh();let i,a=$(`INP`),o=ph(t,Wh),s=(n,r,s,c,l)=>{o.M(),a=$(`INP`,-1,n,r,s,c,l),i=Q(e,a,Kh,t.reportAllChanges)},c=()=>{let e=o.T(a.navigationType);e&&e.D!==a.value&&(a.value=e.D,a.entries=e.entries,i())},l=e=>{c(),i(!0),s(`soft-navigation`,e.navigationId,e.interactionId,e.name,e.startTime)},u=(e,t=!1)=>{Gh(()=>{for(let t of e)t.entryType===`soft-navigation`?l(t):o.l(t);c(),t&&i(!0)})},d=[`event`,`first-input`];Th(t)&&d.push(`soft-navigation`);let f=wh(d,u,U(U({},t),{},{durationThreshold:(r=t.durationThreshold)==null?40:r}));i=Q(e,a,Kh,t.reportAllChanges),f&&(n.onHidden(()=>{u(f.takeRecords(),!0)}),gh(()=>{s(`back-forward-cache`,a.navigationId,a.navigationInteractionId,a.navigationURL,hh())}))})})(t=>{e(f(t))},t)};var Jh=class{constructor(){N(this,`p`,void 0),N(this,`u`,void 0)}l(e){var t;(t=this.p)==null||t.call(this,e)}};let Yh=[2500,4e3],Xh=(e,t={})=>{let n=ph(t=Object.assign({},t),Jh),r=new WeakMap;Th(t)&&(n.u=new Map),n.p=e=>{let n=e.element;if(n){var i,a;let o=(i=(a=t.generateTarget)==null?void 0:a.call(t,n))==null?dh(n):i;r.set(e,o)}else e.id&&r.set(e,`#${e.id}`)},((e,t={})=>{let n=!1,r=Th(t);kh(()=>{let i,a=Ch(),o=$(`LCP`),s=ph(t,Jh),c=(r,s,c,l,u)=>{o=$(`LCP`,-1,r,s,c,l,u),i=Q(e,o,Yh,t.reportAllChanges),n=!1,r===`soft-navigation`&&(a=Ch(!0))},l=e=>{var t;s.u&&e.navigationId&&Eh(s.u,e),n||i(!0),c(`soft-navigation`,e.navigationId,e.interactionId,e.name,e.startTime);let r=(t=e.getLargestInteractionContentfulPaint)==null?void 0:t.call(e);r&&u([r])},u=e=>{t.reportAllChanges||r||(e=e.slice(-1));for(let t of e){if(!t)continue;if(t.entryType===`soft-navigation`){l(t);continue}let e=0,r=[],c=t.startTime;if(t.entryType===`largest-contentful-paint`)e=Math.max(t.startTime-vh(),0),s.l(t),r=[t];else if(t.entryType===`interaction-contentful-paint`){var n;let i=t;if(!o.navigationId||`interactionId`in i&&i.interactionId!=o.navigationInteractionId)continue;c=((n=i.largestContentfulPaint)==null?void 0:n.renderTime)||0,e=Math.max(c-t.startTime,0),i.largestContentfulPaint&&(s.l(i.largestContentfulPaint),r=[i.largestContentfulPaint])}c<a.firstHiddenTime&&(o.value=e,o.entries=r,i())}},d=[`largest-contentful-paint`];r&&d.push(`interaction-contentful-paint`,`soft-navigation`);let f=wh(d,u);if(f){i=Q(e,o,Yh,t.reportAllChanges);let a=[`keydown`,`click`,`visibilitychange`],s=e=>{if(e.isTrusted&&!n){let e=o.id;Gh(()=>{if(!n){if(!r){f.disconnect();for(let e of a)removeEventListener(e,s,{capture:!0})}e===o.id&&(n=!0,i(!0))}})}};for(let e of a)addEventListener(e,s,{capture:!0});gh(r=>{c(`back-forward-cache`,o.navigationId,o.navigationInteractionId,o.navigationURL,hh()),i=Q(e,o,Yh,t.reportAllChanges),_h(()=>{o.value=performance.now()-r.timeStamp,n=!0,i(!0)})})}})})(t=>{e((e=>{let t={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:e.value};if(e.entries.length){var i,a,o;let s=e.entries.at(-1),c=s.url&&performance.getEntriesByType(`resource`).find(e=>e.name===s.url),l;t.target=r.get(s),t.lcpEntry=s,s.url&&(t.url=s.url),c&&(t.lcpResourceEntry=c);let u=0,d=0;if(e.navigationType===`soft-navigation`?(u=e.navigationStartTime||0,l=(o=n.u)==null?void 0:o.get(e.navigationId)):(l=ch(),u=(i=l==null?void 0:l.activationStart)==null?0:i,d=(a=l==null?void 0:l.responseStart)==null?0:a),l){let n=Math.max(0,d-u),r=Math.max(n,c?(c.requestStart||c.startTime)-u:0),i=Math.min(e.value,Math.max(r,c?c.responseEnd-u:0));t=U(U({},t),{},{timeToFirstByte:n,resourceLoadDelay:r-n,resourceLoadDuration:i-r,elementRenderDelay:e.value-i,navigationEntry:l})}}return Object.assign(e,{attribution:t})})(t))},t)},Zh=[800,1800],Qh=e=>{document.prerendering?kh(()=>Qh(e)):document.readyState===`complete`?setTimeout(e):addEventListener(`load`,()=>Qh(e),!0)},$h=(e,t={})=>{((e,t={})=>{let n=Th(t),r=$(`TTFB`),i=Q(e,r,Zh,t.reportAllChanges);Qh(()=>{let a=ch();if(a){let o=a.responseStart;r.value=Math.max(o-vh(),0),r.entries=[a],i(!0),gh(()=>{r=$(`TTFB`,0,`back-forward-cache`,r.navigationId,r.navigationInteractionId,r.navigationURL,hh()),i=Q(e,r,Zh,t.reportAllChanges),i(!0)}),n&&wh([`soft-navigation`],n=>{n.forEach(n=>{n.navigationId&&(r=$(`TTFB`,0,`soft-navigation`,n.navigationId,n.interactionId,n.name,n.startTime),r.entries=[n],i=Q(e,r,Zh,t.reportAllChanges),i(!0))})},t)}})})(t=>{e((e=>{let t=e.entries[0],n={waitingDuration:0,cacheDuration:0,dnsDuration:0,connectionDuration:0,requestDuration:0,navigationEntry:t};if(e.entries.length&&t instanceof PerformanceNavigationTiming){let r=t.activationStart||0,i=Math.max((t.workerStart||t.fetchStart||0)-r,0),a=Math.max(t.domainLookupStart-r,0),o=Math.max(t.connectStart-r,0),s=Math.max(t.connectEnd-r,0);n={waitingDuration:i,cacheDuration:a-i,dnsDuration:o-a,connectionDuration:s-o,requestDuration:e.value-s,navigationEntry:t}}return Object.assign(e,{attribution:n})})(t))},t)},eg=[`CLS`,`INP`,`LCP`,`FCP`,`TTFB`],tg={CLS:Ph,FCP:Fh,LCP:Xh,INP:qh,TTFB:$h,FID:void 0};P(),W();let ng=e=>{let t=typeof e;return t===`number`||t===`string`||t===`boolean`},rg=e=>Math.round(Math.max(0,e)),ig=e=>{let t={},{attribution:n}=e;if(!n||typeof n!=`object`)return t;for(let[e,r]of Object.entries(n))ng(r)&&(t[`${oh}${e}`]=r);return t},ag=(e,t)=>{let n={},r=e.attribution;try{if(r.longAnimationFrameEntries.length>0){let e=new Map;for(let t of r.longAnimationFrameEntries)for(let n of t.scripts){let t=n.sourceURL||`(inline)`;t.length>2048&&(t=`${t.substring(0,2048)}...`);let r=e.get(t);r?(r.totalDuration+=n.duration,r.styleAndLayoutDuration+=n.forcedStyleAndLayoutDuration,r.count++):e.set(t,{count:1,styleAndLayoutDuration:n.forcedStyleAndLayoutDuration,totalDuration:n.duration})}e.size>0&&(n[`${oh}loaf_scripts`]=JSON.stringify(Object.fromEntries([...e].sort((e,t)=>t[1].totalDuration-e[1].totalDuration).slice(0,250).map(([e,t])=>[e,{count:t.count,style_and_layout_duration:Math.round(t.styleAndLayoutDuration),total_duration:Math.round(t.totalDuration)}]))))}}catch(e){t.error(`error building loaf scripts for INP`,e)}return n},og=(e,t)=>{let n={},r=e.attribution.navigationEntry;if(r)try{var i;let e=rg(r.redirectEnd-r.redirectStart),t=rg(r.domainLookupEnd-r.domainLookupStart),a=rg(r.secureConnectionStart>0?r.secureConnectionStart-r.connectStart:r.connectEnd-r.connectStart),o=rg(r.secureConnectionStart>0?r.connectEnd-r.secureConnectionStart:0),s=rg(Math.max((i=r.finalResponseHeadersStart)==null?0:i,r.responseStart)-r.requestStart),c=rg(Math.round(r.responseEnd-r.startTime)-e-t-a-o-s),l=oh;n[`${l}redirect`]=e,n[`${l}domainLookup`]=t,n[`${l}tcpConnection`]=a,n[`${l}tlsNegotiation`]=o,n[`${l}serverResponse`]=s,n[`${l}unattributed`]=c}catch(e){t.error(`error computing TTFB timing breakdown`,e)}else t.debug(`TTFB navigationEntry unavailable, skipping timing breakdown`);return n};var sg=class extends G{constructor({diag:e,perf:t,listeners:n=tg,urlDocument:r=window.document,urlAttribution:i=!0,pageManager:a}={}){super({config:{},diag:e,instrumentationName:`WebVitalsInstrumentation`,instrumentationVersion:`1.0.0`,perf:t}),N(this,`_listeners`,void 0),N(this,`_urlDocument`,void 0),N(this,`_urlAttribution`,void 0),N(this,`_pageManager`,void 0),N(this,`_attributedPage`,{CLS:void 0,FCP:void 0,INP:void 0,LCP:void 0,TTFB:void 0}),N(this,`_largestShiftTargetForCLS`,void 0),N(this,`_listenersRegistered`,!1),N(this,`_isEnabled`,!1),this._listeners=n,this._urlDocument=r,this._urlAttribution=i,this._pageManager=a==null?Mn.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,eg.forEach(e=>{var t,n;(t=(n=this._listeners)[e])==null||t.call(n,t=>{if(!this._isEnabled)return;let n=this.userSessionManager.getSessionPartSpan();if(!n)return;let r=this._getTimeForMetric(t),i=this._getAttributedPageForMetric(t),a=U(U(U({"mxl.type":`ux.web_vital`,"url.full":i.fullURL,"browser.url.full":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},ig(t)),e===`INP`?ag(t,this._diag):{}),e===`TTFB`?og(t,this._diag):{});i.path&&i.pageID&&(a[`app.surface.name`]=i.path,a[`app.surface.id`]=i.pageID),i.label&&(a[`app.surface.label`]=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()}};W();let cg=(e={},{logManager:t,userSessionManager:n,pageManager:r,limitManager:i,includeReplay:a=!1,recordUserSessions:o=!0,replayOptions:s,replayContext:c,sessionStorage:l})=>{var u,d,f,p,m,h,g,_,v;let y=[];if((u=e.omit)!=null&&u.has(`exception`)||y.push(new Qm(e.exception)),(d=e.omit)!=null&&d.has(`click`)||y.push(new Hm(e.click)),(f=e.omit)!=null&&f.has(`web-vital`)||y.push(new sg(U(U({},e[`web-vital`]),{},{pageManager:r}))),(p=e.omit)!=null&&p.has(`loaf`)||y.push(new eh(U({},e.loaf))),(m=e.omit)!=null&&m.has(`user-timing`)||y.push(new ah(e[`user-timing`])),(h=e.omit)!=null&&h.has(`element-timing`)||y.push(new Xm(U(U({},e[`element-timing`]),{},{limitManager:i}))),(g=e.omit)!=null&&g.has(`document-load`)||y.push(new Km(e[`document-load`])),(_=e.omit)!=null&&_.has(`server-timing`)||y.push(new th(U(U({},e[`server-timing`]),{},{limitManager:i}))),e[`empty-root`]&&y.push(new Zm(U({},e[`empty-root`]))),a&&!((v=e.omit)!=null&&v.has(`replay`))){var b;if(!c)throw Error(`replayContext is required when includeReplay is true`);if(!l)throw Error(`sessionStorage is required when includeReplay is true`);y.push(new ds(U(U({},e.replay),{},{recordUserSessions:o,replayContext:c,rrwebOptions:s==null?(b=e.replay)==null?void 0:b.rrwebOptions:s,sessionStorage:l})))}for(let e of y)e instanceof G&&(n&&e.setUserSessionManager(n),t&&e.setLogManager(t),i&&e.setLimitManager(i));return y},lg=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}},ug=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},dg=(e,t)=>{if(e!==void 0){if(typeof e!=`string`)throw Error(`applicationId must be a string when specified. Received ${String(e)}`);let t=e.trim();if(t===``)throw Error(`applicationId cannot be an empty string when specified.`);return t}return t==null?``:t};M(),H(),js(),Gs(),Mu(),W(),q();let fg=({appID:e,applicationId:t,appVersion:n,resource:r=Rs(),spanExporters:i=[],logExporters:a=[],spanProcessors:o=[],propagator:s=null,defaultInstrumentationConfig:c,instrumentations:l=[],contextManager:u=null,logProcessors:d=[],attributeScrubbers:f=[],enableDefaultAttributeScrubbing:p=!0,additionalQueryParamsToScrub:m=[],logLevel:h=b.ERROR,otelCollectorURL:g,apiURL:_,apiKey:v,diagLogger:y=k.createComponentLogger({namespace:`mxl-sdk`}),dynamicSDKConfigManager:ee,dynamicSDKConfig:te,registerGlobally:x=!0,blockNetworkSpanForwarding:ne=!1,restrictedProtocols:S=new Set([`file:`]),useDocumentTitleAsPageLabel:re=!0,recordUserSessions:ie=!0,replay:ae,serviceName:oe,maxUserSessionDurationSeconds:se=$f,inactivityTimeoutSeconds:ce=ep}={})=>{try{var le,ue,de;if(x){let e=Bm.registered();if(e!==null)return y.warn(`SDK has already been successfully initialized, skipping this invocation of initSDK`),e}if(k.setLogger(new ge,{logLevel:h}),typeof window>`u`)return y.warn(`browser not detected, skipping initialization`),!1;let b=new za,fe=b.getNowMillis(),C=lg(e),w=ug(n),pe=dg(t,C),me=C!==void 0;if(!me&&!a.length&&!i.length)throw Error(`when appID is omitted, at least one logExporter or spanExporter must be set`);if(S.has(window.location.protocol))throw Error(`not initializing due to restricted protocol: ${window.location.protocol}`);if(me&&typeof CompressionStream>`u`)throw Error(`CompressionStream is not supported in this browser and required for data compression.`);let he=x?void 0:C,_e=new Lp({diag:y,namespace:he,storage:window.localStorage}),ve=new Lp({diag:y,namespace:he,storage:window.sessionStorage}),ye=pg({registerGlobally:x,sdkLocalStorage:_e}),T=ye.getMXLUserId();if(me&&!T)throw Error(`userID is required when using MXL exporter`);let be=U({},te),xe=ee==null?new ff({appID:C,appVersion:w,defaultConfig:be,deviceId:T,apiURL:_,storage:_e}):ee;xe.refreshRemoteConfig();let Se=(le=(ue=xe.resolveApplicationServiceName)==null?void 0:ue.call(xe,oe))==null?(()=>{var e;return(oe==null?void 0:oe.trim())||((e=xe.getConfig().serviceName)==null?void 0:e.trim())||of})():le,Ce=sf({serviceName:Se}).merge(r).merge(cf({appVersion:w,applicationId:pe||void 0,diagLogger:y,enduserPseudoId:T,pageSessionStorage:ve})),we=new Hf({blockNetworkSpanForwarding:ne,deviceId:T,dynamicConfigManager:xe});if(!we.isSDKEnabled())return y.debug(`SDK is disabled, skipping initialization.`),!1;let Te=Rp({defaultInstrumentationConfig:c,diag:y,featureManager:we,propagator:s,registerGlobally:x}),Ee=new gf(mf),De=[...p?Hp(m):[],...f],E=mg({limitManager:Ee,perf:b,registerGlobally:x,sdkLocalStorage:_e,sdkSessionStorage:ve,userSessionConfig:{inactivityTimeoutSeconds:ce,maxUserSessionDurationSeconds:se}}),Oe,ke;me&&(Oe=new kp({emptySessionAvoidanceEnabled:we.isEmptySessionAvoidanceEnabled(),exporter:new kd({appID:C,otelCollectorURL:g,userID:T}),limitManager:Ee,userSessionManager:E}),ke=new Uc({exporter:new Ed({appID:C,otelCollectorURL:g,userID:T})}));let Ae=_g({registerGlobally:x,useDocumentTitleAsPageLabel:re}),{tracerProvider:je,mxlTraceManager:Me}=hg({attributeScrubbers:De,contextManager:u,mxlSpanProcessor:Oe,pageManager:Ae,propagator:Te?new Ip:s,registerGlobally:x,resource:Ce,spanExporters:i,spanProcessors:o,userManager:ye});E.setTracerProvider(je);let{loggerProvider:Ne,mxlLogManager:Pe}=gg({attributeScrubbers:De,limitManager:Ee,logExporters:a,logProcessors:d,mxlLogProcessor:ke,pageManager:Ae,registerGlobally:x,resource:Ce,sdkLocalStorage:_e,userManager:ye,userSessionManager:E,visibilityDoc:window.document}),Fe=new Nf({applicationId:pe,loggerProvider:Ne,pageManager:Ae,storage:_e,userManager:ye,userSessionManager:E});E.setAnalyticsManager(Fe),x&&Tn.setGlobalAnalyticsManager(Fe),E.startSessionPartInternal(`init`);let Ie=typeof window<`u`&&window.__MXL_DISABLE_SESSION_RECORDER===!0,{recordUserSessions:Le,replay:Re}=pf({dynamicConfig:xe.getConfig(),isSessionReplayEnabled:we.isSessionReplayEnabled(),recordUserSessions:ie,replay:ae}),ze=!!(me&&C&&T&&!Ie&&we.isSessionReplayEnabled()),Be=ze&&Le&&Re!=null&&Re.omitRedundantInstrumentations?[`click`,`exception`,`@opentelemetry/instrumentation-fetch`,`@opentelemetry/instrumentation-xml-http-request`]:void 0,Ve=Be===void 0?c:U(U({},c),{},{omit:new Set([...(de=c==null?void 0:c.omit)==null?[]:de,...Be])}),He=ze&&C&&T?{appID:C,appVersion:w,apiURL:_,serviceName:Se,transport:Wd({apiKey:v,appID:C,apiURL:_,otelCollectorURL:g}),userID:T}:void 0,Ue=()=>cg(Ve,{includeReplay:ze,limitManager:Ee,logManager:Pe,pageManager:Ae,recordUserSessions:Le,replayContext:He,replayOptions:Re,sessionStorage:ve,userSessionManager:E}),We,D,Ge;if(x){let e=cg(Ve,{includeReplay:ze,limitManager:Ee,pageManager:Ae,recordUserSessions:Le,replayContext:He,replayOptions:Re,sessionStorage:ve,userSessionManager:E});We=e.find(e=>e instanceof ds),D=hs({instrumentations:[...e,...l]}),Rm(Ve).then(e=>{e.length!==0&&(Ge=hs({instrumentations:e}))})}else{let e=Ue();We=e.find(e=>e instanceof ds),D=hs({instrumentations:[...e,...l],loggerProvider:Ne,tracerProvider:je}),Rm(Ve).then(e=>{e.length!==0&&(Ge=hs({instrumentations:e,loggerProvider:Ne,tracerProvider:je}))})}let Ke=!1,qe=!1,Je=()=>{qe||(qe=!0,We==null||We.disable(),D==null||D(),Ge==null||Ge(),E._shutdown())},Ye=We?Ad(We):zm;y.info(`successfully initialized the SDK`);let Xe={analytics:Fe,flush:function(){var e=K(function*(){yield je.forceFlush(),yield Ne.forceFlush()});return function(){return e.apply(this,arguments)}}(),log:Pe,page:Ae,session:E,sessionRecording:Ye,setDynamicConfig:e=>{xe.setConfig(e)},shutdown:function(){var e=K(function*(){Ke||(Ke=!0,Je(),yield je.shutdown(),yield Ne.shutdown())});return function(){return e.apply(this,arguments)}}(),stop:Je,trace:Me,user:ye};return x&&Bm.register(Xe),E.recordSDKStartupDuration(b.getNowMillis()-fe),Fe.screenView(),Xe}catch(e){let t=e instanceof Error?e.message:`Unknown error.`;return y.error(`failed to initialize the SDK: ${t}`),!1}},pg=({registerGlobally:e,sdkLocalStorage:t})=>{let n=new qf({storage:t});return e&&er.setGlobalUserManager(n),n},mg=({limitManager:e,perf:t,registerGlobally:n,sdkLocalStorage:r,sdkSessionStorage:i,userSessionConfig:a})=>{let o=new bp({config:a,limitManager:e,perf:t,storage:r,tabStorage:i,visibilityDoc:window.document});return n&&zn.setGlobalUserSessionManager(o),o},hg=({resource:e,userManager:t,spanExporters:n,spanProcessors:r=[],propagator:i=null,contextManager:a=null,attributeScrubbers:o,registerGlobally:s,mxlSpanProcessor:c,pageManager:l})=>{let u=[...r,new Sp,new Ep,new Fp({userManager:t}),new jp({pageManager:l}),new Mp({attributeScrubbers:o})];n==null||n.forEach(e=>{u.push(new su(e))}),c&&u.push(c);let d=new mu({resource:e,spanLimits:{attributeCountLimit:mf.maxAllowed.session_property*2,eventCountLimit:mf.maxAllowed.breadcrumb*2},spanProcessors:u}),f=new Wf({tracerProvider:s?void 0:d});return s&&(qn.setGlobalTraceManager(f),d.register({contextManager:a||new uu,propagator:i})),{mxlTraceManager:f,tracerProvider:d}},gg=({resource:e,userManager:t,logExporters:n,logProcessors:r,userSessionManager:i,limitManager:a,attributeScrubbers:o,registerGlobally:s,mxlLogProcessor:c,sdkLocalStorage:l,pageManager:u,visibilityDoc:d=window.document})=>{let f=[...r,new Pp({userSessionManager:i}),new xp,new wp,new Np({userManager:t}),new Cp({attributeScrubbers:o}),new Ap({pageManager:u})];n==null||n.forEach(e=>{f.push(new Uc({exporter:e}))}),c&&f.push(c);let p=new Rc({processors:f,resource:e}),m=new Rf({limitManager:a,loggerProvider:s?void 0:p,storage:l,userSessionManager:i,visibilityDoc:d});return s&&(io.setGlobalLoggerProvider(p),vn.setGlobalLogManager(m)),{loggerProvider:p,mxlLogManager:m}},_g=({useDocumentTitleAsPageLabel:e,registerGlobally:t})=>{let n=new zf({useDocumentTitleAsPageLabel:e});return t&&Mn.setGlobalPageManager(n),n};return M(),Object.defineProperty(e,`DiagLogLevel`,{enumerable:!0,get:function(){return b}}),e.ReplayInstrumentation=ds,e.analytics=Tn,e.attributes=mr,e.getNavigationInstrumentation=uo,e.initSDK=fg,e.loadRrwebModule=Ho,e.log=vn,e.page=Mn,e.resetRrwebModuleCacheForTests=Uo,e.session=zn,e.setRrwebModuleLoaderForTests=Wo,e.setRrwebScriptUrl=Ro,e.trace=qn,e.user=er,e})({});
|
|
3
3
|
//# sourceMappingURL=mxl-web-sdk.js.map
|