UNPKG

@embrace-io/web-sdk

Version:
1 lines 224 kB
"use strict";window.EmbraceWebSdk=window.EmbraceWebSdk||(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let t=`1.9.1`,n=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function r(e){let t=new Set([e]),r=new Set,i=e.match(n);if(!i)return()=>!1;let a={major:+i[1],minor:+i[2],patch:+i[3],prerelease:i[4]};if(a.prerelease!=null)return function(t){return t===e};function o(e){return r.add(e),!1}function s(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(r.has(e))return!1;let i=e.match(n);if(!i)return o(e);let c={major:+i[1],minor:+i[2],patch:+i[3],prerelease:i[4]};return c.prerelease!=null||a.major!==c.major?o(e):a.major===0?a.minor===c.minor&&a.patch<=c.patch?s(e):o(e):a.minor<=c.minor?s(e):o(e)}}let i=r(t),a=t.split(`.`)[0],o=Symbol.for(`opentelemetry.js.api.${a}`),s=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{};function c(e,n,r,i=!1){var a;let c=s[o]=(a=s[o])==null?{version:t}:a;if(!i&&c[e]){let t=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return r.error(t.stack||t.message),!1}if(c.version!==`1.9.1`){let n=Error(`@opentelemetry/api: Registration of version v${c.version} for ${e} does not match previously registered API v${t}`);return r.error(n.stack||n.message),!1}return c[e]=n,r.debug(`@opentelemetry/api: Registered a global for ${e} v${t}.`),!0}function l(e){var t,n;let r=(t=s[o])==null?void 0:t.version;if(!(!r||!i(r)))return(n=s[o])==null?void 0:n[e]}function u(e,n){n.debug(`@opentelemetry/api: Unregistering a global for ${e} v${t}.`);let r=s[o];r&&delete r[e]}var d=class{constructor(e){this._namespace=e.namespace||`DiagComponentLogger`}debug(...e){return f(`debug`,this._namespace,e)}error(...e){return f(`error`,this._namespace,e)}info(...e){return f(`info`,this._namespace,e)}warn(...e){return f(`warn`,this._namespace,e)}verbose(...e){return f(`verbose`,this._namespace,e)}};function f(e,t,n){let r=l(`diag`);if(r)return r[e](t,...n)}var p;(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`})(p||(p={}));function m(e,t){e<p.NONE?e=p.NONE:e>p.ALL&&(e=p.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`,p.ERROR),warn:n(`warn`,p.WARN),info:n(`info`,p.INFO),debug:n(`debug`,p.DEBUG),verbose:n(`verbose`,p.VERBOSE)}}var h=class e{static instance(){return this._instance||(this._instance=new e),this._instance}constructor(){function e(e){return function(...t){let n=l(`diag`);if(n)return n[e](...t)}}let t=this;t.setLogger=(e,n={logLevel:p.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=l(`diag`),s=m((i=n.logLevel)==null?p.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 c(`diag`,s,t,!0)},t.disable=()=>{u(`diag`,t)},t.createComponentLogger=e=>new d(e),t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}},g=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}};let ee=Symbol(`BaggageEntryMetadata`),_=h.instance();function te(e={}){return new g(new Map(Object.entries(e)))}function v(e){return typeof e!=`string`&&(_.error(`Cannot create baggage metadata from unknown type: ${typeof e}`),e=``),{__TYPE__:ee,toString(){return e}}}function y(e){return Symbol.for(e)}let b=new 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}}},ne=[{n:`error`,c:`error`},{n:`warn`,c:`warn`},{n:`info`,c:`info`},{n:`debug`,c:`debug`},{n:`verbose`,c:`trace`}],re={};if(typeof console<`u`)for(let e of[`error`,`warn`,`info`,`debug`,`trace`,`log`])typeof console[e]==`function`&&(re[e]=console[e]);var ie=class{constructor(){function e(e){return function(...t){let n=re[e];if(typeof n!=`function`&&(n=re.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<ne.length;t++)this[ne[t].n]=e(ne[t].c)}},ae=class{constructor(){}createGauge(e,t){return _e}createHistogram(e,t){return ve}createCounter(e,t){return ge}createUpDownCounter(e,t){return ye}createObservableGauge(e,t){return x}createObservableCounter(e,t){return be}createObservableUpDownCounter(e,t){return xe}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}},oe=class{},se=class extends oe{add(e,t){}},ce=class extends oe{add(e,t){}},le=class extends oe{record(e,t){}},ue=class extends oe{record(e,t){}},de=class{addCallback(e){}removeCallback(e){}},fe=class extends de{},pe=class extends de{},me=class extends de{};let he=new ae,ge=new se,_e=new le,ve=new ue,ye=new ce,be=new fe,x=new pe,xe=new me;function Se(){return he}let Ce={get(e,t){if(e!=null)return e[t]},keys(e){return e==null?[]:Object.keys(e)}},we={set(e,t,n){e!=null&&(e[t]=n)}};var Te=class{active(){return b}with(e,t,n,...r){return t.call(n,...r)}bind(e,t){return t}enable(){return this}disable(){return this}};let Ee=`context`,De=new Te;var Oe=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalContextManager(e){return c(Ee,e,h.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 l(Ee)||De}disable(){this._getContextManager().disable(),u(Ee,h.instance())}},S;(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(S||(S={}));let ke={traceId:`00000000000000000000000000000000`,spanId:`0000000000000000`,traceFlags:S.NONE};var Ae=class{constructor(e=ke){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){}};let je=y(`OpenTelemetry Context Key SPAN`);function Me(e){return e.getValue(je)||void 0}function Ne(){return Me(Oe.getInstance().active())}function Pe(e,t){return e.setValue(je,t)}function Fe(e){return e.deleteValue(je)}function Ie(e,t){return Pe(e,new Ae(t))}function Le(e){var t;return(t=Me(e))==null?void 0:t.spanContext()}let Re=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 ze(e,t){if(typeof e!=`string`||e.length!==t)return!1;let n=0;for(let t=0;t<e.length;t+=4)n+=(Re[e.charCodeAt(t)]|0)+(Re[e.charCodeAt(t+1)]|0)+(Re[e.charCodeAt(t+2)]|0)+(Re[e.charCodeAt(t+3)]|0);return n===t}function Be(e){return ze(e,32)&&e!==`00000000000000000000000000000000`}function Ve(e){return ze(e,16)&&e!==`0000000000000000`}function He(e){return Be(e.traceId)&&Ve(e.spanId)}function Ue(e){return new Ae(e)}let We=Oe.getInstance();var Ge=class{startSpan(e,t,n=We.active()){if(t!=null&&t.root)return new Ae;let r=n&&Le(n);return Ke(r)&&He(r)?new Ae(r):new Ae}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?We.active():a,c=this.startSpan(e,i,s),l=Pe(s,c);return We.with(l,o,void 0,c)}};function Ke(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`}let qe=new Ge;var Je=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):qe}};let Ye=new class{getTracer(e,t,n){return new Ge}};var Xe=class{getTracer(e,t,n){var r;return(r=this.getDelegateTracer(e,t,n))==null?new Je(this,e,t,n):r}getDelegate(){var e;return(e=this._delegate)==null?Ye:e}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){var r;return(r=this._delegate)==null?void 0:r.getTracer(e,t,n)}},Ze;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(Ze||(Ze={}));var Qe;(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`})(Qe||(Qe={}));var C;(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(C||(C={}));let w=Oe.getInstance(),T=h.instance(),$e=new class{getMeter(e,t,n){return he}},et=`metrics`,tt=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalMeterProvider(e){return c(et,e,h.instance())}getMeterProvider(){return l(et)||$e}getMeter(e,t,n){return this.getMeterProvider().getMeter(e,t,n)}disable(){u(et,h.instance())}}.getInstance();var nt=class{inject(e,t){}extract(e,t){return e}fields(){return[]}};let rt=y(`OpenTelemetry Baggage Key`);function it(e){return e.getValue(rt)||void 0}function at(){return it(Oe.getInstance().active())}function ot(e,t){return e.setValue(rt,t)}function st(e){return e.deleteValue(rt)}let ct=`propagation`,lt=new nt,E=class e{constructor(){this.createBaggage=te,this.getBaggage=it,this.getActiveBaggage=at,this.setBaggage=ot,this.deleteBaggage=st}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalPropagator(e){return c(ct,e,h.instance())}inject(e,t,n=we){return this._getGlobalPropagator().inject(e,t,n)}extract(e,t,n=Ce){return this._getGlobalPropagator().extract(e,t,n)}fields(){return this._getGlobalPropagator().fields()}disable(){u(ct,h.instance())}_getGlobalPropagator(){return l(ct)||lt}}.getInstance(),ut=`trace`,D=class e{constructor(){this._proxyTracerProvider=new Xe,this.wrapSpanContext=Ue,this.isSpanContextValid=He,this.deleteSpan=Fe,this.getSpan=Me,this.getActiveSpan=Ne,this.getSpanContext=Le,this.setSpan=Pe,this.setSpanContext=Ie}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalTracerProvider(e){let t=c(ut,this._proxyTracerProvider,h.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return l(ut)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){u(ut,h.instance()),this._proxyTracerProvider=new Xe}}.getInstance(),dt=({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);function ft(e,t,n,r=new Set){return new Proxy(e,{get(e,i,a){let o=Reflect.get(e,i,a);return typeof o!=`function`||r.has(i)?o:(...r)=>{try{return o.apply(e,r)}catch(e){let a=e instanceof Error?e.message:`Unknown error`;n.error(`${String(i)}: ${a}`);let o=t[i];return typeof o==`function`?o.apply(t,r):void 0}}}})}let pt=new Uint8Array(16),mt=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`).toUpperCase()),ht=()=>{crypto.getRandomValues(pt);let e=``;for(let t=0;t<16;t++)e+=mt[pt[t]];return e},gt=()=>`embracev2-${Date.now()}-${Math.floor(Math.random()*8999999999999)+0xe8d4a51000}`,_t=(e,t,n)=>{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},vt=e=>{let t=e.nodeName;return e.nodeType===1?t.toLowerCase():t.toUpperCase().replace(/^#/,``)},yt=e=>{let t=``;try{for(;(e==null?void 0:e.nodeType)!==9;){let n=e,r=n.id?`#${n.id}`:[vt(n),...Array.from(n.classList).sort()].join(`.`);if(t.length+r.length>99)return t||r;if(t=t?`${r}>${t}`:r,n.id)break;e=n.parentNode}}catch(e){}return t},O=`emb.type`,bt=`emb.state`,xt=`emb.js_file_bundle_ids`,St=`browser.url.full`,Ct=`app.surface.name`,wt=`app.surface.id`,Tt=`app.surface.label`,Et=`emb.session_part_id`,Dt=`emb.user_session_id`,Ot=`emb.user_session_previous_id`,kt=e=>e.visibilityState===`visible`?`foreground`:`background`,At=globalThis,jt=(e,t)=>!t||t<=0||t>100?!1:t>=Mt(e),Mt=e=>{if(e.length<6)return 0;let t=e.slice(-6),n=Math.pow(16,6)-1;return parseInt(t,16)/n*100};function Nt(e){"@babel/helpers - typeof";return Nt=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},Nt(e)}function Pt(e,t){if(Nt(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Nt(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Ft(e){var t=Pt(e,`string`);return Nt(t)==`symbol`?t:t+``}function k(e,t,n){return(t=Ft(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var It=class{constructor({namespace:e,storage:t,diag:n}){k(this,`_diag`,void 0),k(this,`_keyPrefix`,void 0),k(this,`_storage`,void 0),k(this,`_writeDisabled`,!1),this._diag=n==null?T.createComponentLogger({namespace:`NamespacedStorage`}):n,this._keyPrefix=e?`${e}__`:``,this._storage=t}keys(){let e;try{e=this._storage.length}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}}_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 Lt=({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},Rt;function zt(e){Rt=e}var Bt=class{constructor(e=window.performance){k(this,`_clock`,void 0),k(this,`navigationEntry`,null),k(this,`epochMillisFromOrigin`,e=>this._clock.timeOrigin+e),k(this,`getNowMillis`,()=>this.epochMillisFromOrigin(this._clock.now())),k(this,`getZeroTime`,()=>{var e;return Math.max(this._clock.timeOrigin+this._getNavigationActivationStart(),(e=Rt)==null?0:e)}),k(this,`millisFromZeroTime`,e=>Math.max(0,e-(this.getZeroTime()-this._clock.timeOrigin))),this._clock=e}_getNavigationEntry(){var e,t,n;if(this.navigationEntry)return this.navigationEntry;let[r]=(e=(t=(n=this._clock).getEntriesByType)==null?void 0:t.call(n,`navigation`))==null?[]:e;return r?(this.navigationEntry=r,this.navigationEntry):null}_getNavigationActivationStart(){var e;let t=this._getNavigationEntry();return(e=t==null?void 0:t.activationStart)==null?0:e}};function Vt(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 Ht(e,t){if(e==null)return{};var n,r,i=Vt(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}function Ut(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 A(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Ut(Object(n),!0).forEach(function(t){k(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ut(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}let Wt=[`diag`];function Gt(e){var t,n;return typeof PerformanceObserver<`u`&&(t=(n=PerformanceObserver.supportedEntryTypes)==null?void 0:n.includes(e))!=null&&t}function Kt(e,t,n){let r=n==null?{}:n,{diag:i}=r,a=Ht(r,Wt);if(!Gt(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(A({type:e,buffered:!0},a)),n}catch(e){return null}}let qt=`error.type`,Jt=`exception.message`,Yt=`exception.stacktrace`,Xt=`exception.type`,Zt=`http.request.method`,Qt=`http.request.method_original`,$t=`http.response.status_code`,en=`server.address`,tn=`server.port`,nn=`service.name`,rn=`telemetry.sdk.language`,an=`telemetry.sdk.name`,on=`telemetry.sdk.version`,j=`url.full`,sn=`user_agent.original`,cn=`Soft Navigation`,ln=`emb.soft_navigation.source`,un=`emb.soft_navigation.interaction_id`,dn=`emb.soft_navigation.start_time`,fn=`emb.soft_navigation.duration`,pn={performanceObserver:`performance_observer`,polyfill:`polyfill`},mn=e=>{if(e.attributes[`http.request.method`]&&typeof e.attributes[`http.response.status_code`]==`number`){let t=e.attributes[j];return typeof t==`string`&&t.includes(`://`)}return!1},hn=e=>e.attributes[O]===`ux.session_part`,gn=e=>e.attributes[ln]!==void 0,_n=(e,t=1e3)=>{let n=!1;return(...r)=>{n||(e(...r),setTimeout(()=>{n=!1},t),n=!0)}};var vn=class{logException(e,t){}message(e,t,n){}};let yn=new vn;var bn=class{constructor(){k(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?yn:e}setDelegate(e){this._delegate=e}logException(e,t){this.getDelegate().logException(e,t)}message(e,t,n){this.getDelegate().message(e,t,n)}};let xn=new vn,Sn=new Set([`setDelegate`,`getDelegate`]);var Cn=class e{static getInstance(){if(!e._instance){let t=new bn,n=ft(t,xn,T.createComponentLogger({namespace:`LogAPI`}),Sn);e._instance=Object.assign(n,{setGlobalLogManager(e){t.setDelegate(e)},getLogManager(){return t}})}return e._instance}static resetInstance(){e._instance=void 0}};k(Cn,`_instance`,void 0);let wn=Cn.getInstance();var Tn=class{setCurrentRoute(e){}getCurrentRoute(){return null}getCurrentPageId(){return``}setPageLabel(e){}getPageLabel(){return null}clearCurrentRoute(){}addRouteChangedListener(e){return()=>{}}};let En=new Tn;var Dn=class{constructor(){k(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?En: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()}addRouteChangedListener(e){return this.getDelegate().addRouteChangedListener(e)}};let On=new Tn,kn=new Set([`setDelegate`,`getDelegate`]);var An=class e{static getInstance(){if(!e._instance){let t=new Dn,n=ft(t,On,T.createComponentLogger({namespace:`PageAPI`}),kn);e._instance=Object.assign(n,{setGlobalPageManager(e){t.setDelegate(e)},getPageManager(){return t}})}return e._instance}static resetInstance(){e._instance=void 0}};k(An,`_instance`,void 0);let jn=An.getInstance();var Mn=class{constructor(){k(this,`getSessionId`,()=>null),k(this,`getPreviousSessionId`,()=>null)}addBreadcrumb(e){}addProperty(e,t,n){}removeProperty(e){}endSessionSpan(){}currentSessionAsReadableSpan(){return null}getSessionSpan(){return null}getSessionStartTime(){return null}startSessionSpan(){}addSessionStartedListener(e){return()=>{}}addSessionEndedListener(e){return()=>{}}getUserSessionId(){return null}getPreviousUserSessionId(){return null}getUserSessionStartTime(){return null}getUserSessionAttributes(){return null}getSessionPartProperties(){return{}}endUserSession(){}getSessionPartId(){return null}getSessionPartSpan(){return null}startSessionPartInternal(e){}endSessionPartInternal(e){}rolloverSessionPartInternal(e){}incrSessionPartCountForKey(e){}incrNextSessionPartCountForKey(e){}addSessionPartStartedListener(e){return()=>{}}addSessionPartEndedListener(e){return()=>{}}setTracerProvider(){}};let Nn=new Mn;var Pn=class{constructor(){k(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?Nn:e}setDelegate(e){this._delegate=e}addBreadcrumb(e){this.getDelegate().addBreadcrumb(e)}addProperty(e,t,n){this.getDelegate().addProperty(e,t,n)}removeProperty(e){this.getDelegate().removeProperty(e)}endSessionSpan(){this.getDelegate().endSessionSpan()}currentSessionAsReadableSpan(e){return this.getDelegate().currentSessionAsReadableSpan(e)}getSessionId(){return this.getDelegate().getSessionId()}getPreviousSessionId(){return null}getSessionSpan(){return this.getDelegate().getSessionSpan()}getSessionStartTime(){return this.getDelegate().getSessionStartTime()}startSessionSpan(e){}addSessionStartedListener(e){return()=>{}}addSessionEndedListener(e){return()=>{}}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){this.getDelegate().endSessionPartInternal(e)}rolloverSessionPartInternal(e){this.getDelegate().rolloverSessionPartInternal(e)}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)}};let Fn=new Mn,In=new Set([`setDelegate`,`getDelegate`]);var Ln=class e{static getInstance(){if(!e._instance){let t=new Pn,n=ft(t,Fn,T.createComponentLogger({namespace:`SessionAPI`}),In);e._instance=Object.assign(n,{setGlobalUserSessionManager(e){t.setDelegate(e)},getUserSessionManager(){return t}})}return e._instance}static resetInstance(){e._instance=void 0}};k(Ln,`_instance`,void 0);let Rn=Ln.getInstance();var zn=class{constructor(e=ke){k(this,`_spanContext`,void 0),k(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){}},Bn=class{startSpan(e,t){return new zn}setSpan(e,t){return b}getSpan(e){}};let Vn=new Bn;var Hn=class{constructor(){k(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?Vn:e}setDelegate(e){this._delegate=e}startSpan(e,t,n){return this.getDelegate().startSpan(e,t,n)}setSpan(e,t){return this.getDelegate().setSpan(e,t)}getSpan(e){return this.getDelegate().getSpan(e)}};let Un=new Bn,Wn=new Set([`setDelegate`,`getDelegate`]);var Gn=class e{static getInstance(){if(!e._instance){let t=new Hn,n=ft(t,Un,T.createComponentLogger({namespace:`TraceAPI`}),Wn);e._instance=Object.assign(n,{setGlobalTraceManager(e){t.setDelegate(e)},getTraceManager(){return t}})}return e._instance}static resetInstance(){e._instance=void 0}};k(Gn,`_instance`,void 0);let Kn=Gn.getInstance();var qn=class{getEmbraceUserId(){return``}getUserId(){return null}setUserId(){}clearUserId(){}};let Jn=new qn;var Yn=class{constructor(){k(this,`_delegate`,void 0)}getDelegate(){var e;return(e=this._delegate)==null?Jn:e}setDelegate(e){this._delegate=e}getEmbraceUserId(){return this.getDelegate().getEmbraceUserId()}getUserId(){return this.getDelegate().getUserId()}setUserId(e){this.getDelegate().setUserId(e)}clearUserId(){this.getDelegate().clearUserId()}};let Xn=new qn,Zn=new Set([`setDelegate`,`getDelegate`]);var Qn=class e{static getInstance(){if(!e._instance){let t=new Yn,n=ft(t,Xn,T.createComponentLogger({namespace:`UserAPI`}),Zn);e._instance=Object.assign(n,{setGlobalUserManager(e){t.setDelegate(e)},getUserManager(){return t}})}return e._instance}static resetInstance(){e._instance=void 0}};k(Qn,`_instance`,void 0);let $n=Qn.getInstance(),er={pageLabel:Tt};var M;(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`})(M||(M={}));var tr=class{emit(e){}enabled(){return!1}};let nr=new tr;function rr(){return nr}let ir=Symbol.for(`io.opentelemetry.js.api.logs`),ar=globalThis;function or(e,t,n){return r=>r===e?t:n}let sr=new class{getLogger(e,t,n){return new tr}};var cr=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):nr}},lr=class{getLogger(e,t,n){var r;return(r=this._getDelegateLogger(e,t,n))==null?new cr(this,e,t,n):r}_getDelegate(){var e;return(e=this._delegate)==null?sr:e}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){var r;return(r=this._delegate)==null?void 0:r.getLogger(e,t,n)}};let ur=class e{constructor(){this._proxyLoggerProvider=new lr}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(e){return ar[ir]?this.getLoggerProvider():(ar[ir]=or(1,e,sr),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,t;return(t=(e=ar[ir])==null?void 0:e.call(ar,1))==null?this._proxyLoggerProvider:t}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){delete ar[ir],this._proxyLoggerProvider=new lr}}.getInstance();function dr(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 fr(e){e.forEach(e=>e.disable())}function pr(e){var t,n;let r=e.tracerProvider||D.getTracerProvider(),i=e.meterProvider||tt.getMeterProvider(),a=e.loggerProvider||ur.getLoggerProvider(),o=(t=(n=e.instrumentations)==null?void 0:n.flat())==null?[]:t;return dr(o,r,i,a),()=>{fr(o)}}let N=console.error.bind(console);function mr(e,t,n){let r=!!e[t]&&Object.prototype.propertyIsEnumerable.call(e,t);Object.defineProperty(e,t,{configurable:!0,enumerable:r,writable:!0,value:n})}let hr=(e,t,n)=>{if(!e||!e[t]){N(`no original function `+String(t)+` to wrap`);return}if(!n){N(`no wrapper function`),N(Error().stack);return}let r=e[t];if(typeof r!=`function`||typeof n!=`function`){N(`original object and wrapper must be functions`);return}let i=n(r,t);return mr(i,`__original`,r),mr(i,`__unwrap`,()=>{e[t]===i&&mr(e,t,r)}),mr(i,`__wrapped`,!0),mr(e,t,i),i},gr=(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{N(`must provide one or more modules to patch`),N(Error().stack);return}if(!(t&&Array.isArray(t))){N(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{hr(e,t,n)})})},_r=(e,t)=>{if(!e||!e[t]){N(`no function to unwrap.`),N(Error().stack);return}let n=e[t];if(!n.__unwrap)N(`no original to unwrap to -- has `+String(t)+` already been unwrapped?`);else{n.__unwrap();return}},vr=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{N(`must provide one or more modules to patch`),N(Error().stack);return}if(!(t&&Array.isArray(t))){N(`must provide one or more functions to unwrap on modules`);return}e.forEach(e=>{t.forEach(t=>{_r(e,t)})})};function yr(e){e&&e.logger&&(typeof e.logger==`function`?N=e.logger:N(`new logger isn't a function, not replacing`))}yr.wrap=hr,yr.massWrap=gr,yr.unwrap=_r,yr.massUnwrap=vr;var br=class{constructor(e,t,n){k(this,`_config`,{}),k(this,`_tracer`,void 0),k(this,`_meter`,void 0),k(this,`_logger`,void 0),k(this,`_diag`,void 0),k(this,`instrumentationName`,void 0),k(this,`instrumentationVersion`,void 0),k(this,`_wrap`,hr),k(this,`_unwrap`,_r),k(this,`_massWrap`,gr),k(this,`_massUnwrap`,vr),this.instrumentationName=e,this.instrumentationVersion=t,this.setConfig(n),this._diag=T.createComponentLogger({namespace:e}),this._tracer=D.getTracer(e,t),this._meter=tt.getMeter(e,t),this._logger=ur.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=A({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)}}},xr=class extends br{constructor(e,t,n){super(e,t,n),this._config.enabled&&this.enable()}};function Sr(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function P(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){Sr(a,r,i,o,s,`next`,e)}function s(e){Sr(a,r,i,o,s,`throw`,e)}o(void 0)})}}function Cr(e,t,n){let r,i;try{i=e()}catch(e){r=e}finally{if(t(r,i),r&&!n)throw r;return i}}let wr=y(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function Tr(e){return e.setValue(wr,!0)}function Er(e){return e.getValue(wr)===!0}let Dr=`baggage`;function Or(e){return e.reduce((e,t)=>{let n=`${e}${e===``?``:`,`}${t}`;return n.length>8192?e:n},``)}function kr(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 Ar(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=v(e.substring(t+1))),{key:o,value:s,metadata:c}}function jr(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=Ar(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 Mr=class{inject(e,t,n){let r=E.getBaggage(e);if(!r||Er(e))return;let i=Or(kr(r).filter(e=>e.length<=4096).slice(0,180));i.length>0&&n.set(t,Dr,i)}extract(e,t,n){let r=n.get(t,Dr);if(!r)return e;let i={},a=0,o=0;if(Array.isArray(r))for(let e=0;e<r.length;e++)[a,o]=jr(r[e],i,a,o);else[a]=jr(r,i,a,o);return a===0?e:E.setBaggage(e,E.createBaggage(i))}fields(){return[Dr]}};function Nr(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!Pr(n)){T.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!Fr(r)){T.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function Pr(e){return typeof e==`string`&&e!==``}function Fr(e){return e==null?!0:Array.isArray(e)?Ir(e):Lr(typeof e)}function Ir(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(Lr(e)){t=e;continue}return!1}return!1}}return!0}function Lr(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}function Rr(){return e=>{T.error(zr(e))}}function zr(e){return typeof e==`string`?e:JSON.stringify(Br(e))}function Br(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 Vr=Rr();function F(e){try{Vr(e)}catch(e){}}let Hr={[an]:`opentelemetry`,"process.runtime.name":`browser`,[rn]:`webjs`,[on]:`2.10.0`},I=performance,Ur=Math.pow(10,6),Wr=Math.pow(10,9);function L(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*Ur)]}function R(e){return Xr(L(I.timeOrigin),L(typeof e==`number`?e:I.now()))}function Gr(e){if(Jr(e))return e;if(typeof e==`number`)return e<I.timeOrigin/2?R(e):L(e);if(e instanceof Date)return L(e.getTime());throw TypeError(`Invalid input type`)}function Kr(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=Wr),[n,r]}function z(e){return e[0]*Wr+e[1]}function qr(e){return e[0]*1e3+e[1]/1e6}function Jr(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function Yr(e){return Jr(e)||typeof e==`number`||e instanceof Date}function Xr(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=Wr&&(n[1]-=Wr,n[0]+=1),n}var B;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(B||(B={}));var Zr=class{constructor(e={}){var t;k(this,`_propagators`,void 0),k(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){T.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){T.warn(`Failed to extract with ${r.constructor.name}. Err: ${e.message}`)}return e},e)}fields(){return this._fields.slice()}};let Qr=`[_0-9a-z-*/]`,$r=RegExp(`^(?:${`[a-z]${Qr}{0,255}`}|${`[a-z0-9]${Qr}{0,240}@[a-z]${Qr}{0,13}`})$`),ei=/^[ -~]{0,255}[!-~]$/,ti=/,|=/;function ni(e){return $r.test(e)}function ri(e){return ei.test(e)&&!ti.test(e)}var ii=class e{constructor(e){k(this,`_length`,void 0),k(this,`_rawTraceState`,void 0),k(this,`_internalState`,void 0),this._rawTraceState=typeof e==`string`?e:``,this._length=this._rawTraceState.length}set(e,t){if(!ni(e)||!ri(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>512)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=`,`+e),e=`${n[0]}=${n[1]}`+e,t++;return e}_getState(){if(this._internalState)return this._internalState;let e=this._rawTraceState.split(`,`),t=new Map,n=0;for(let r of e){let e=r.trim(),i=e.indexOf(`=`);if(i===-1)continue;let a=e.slice(0,i),o=e.slice(i+1);if(!ni(a)||!ri(o))continue;let s=n+e.length+ +(t.size>0);if(!(s>512)&&(t.set(a,o),n=s,t.size>=32))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}};let ai=`traceparent`,oi=`tracestate`,si=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function ci(e){let t=si.exec(e);return!t||t[1]===`00`&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var li=class{inject(e,t,n){let r=D.getSpanContext(e);if(!r||Er(e)||!He(r))return;let i=`00-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||S.NONE).toString(16)}`;n.set(t,ai,i),r.traceState&&n.set(t,oi,r.traceState.serialize())}extract(e,t,n){let r=n.get(t,ai);if(!r)return e;let i=Array.isArray(r)?r[0]:r;if(typeof i!=`string`)return e;let a=ci(i);if(!a)return e;a.isRemote=!0;let o=n.get(t,oi);if(o){let e=Array.isArray(o)?o.join(`,`):o;a.traceState=new ii(typeof e==`string`?e:void 0)}return D.setSpanContext(e,a)}fields(){return[ai,oi]}};let ui=Function.prototype.toString,di=ui.call(Object),fi=Object.getPrototypeOf,pi=Object.prototype,mi=pi.hasOwnProperty,hi=Symbol?Symbol.toStringTag:void 0,gi=pi.toString;function _i(e){if(!vi(e)||yi(e)!==`[object Object]`)return!1;let t=fi(e);if(t===null)return!0;let n=mi.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&ui.call(n)===di}function vi(e){return typeof e==`object`&&!!e}function yi(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:hi&&hi in Object(e)?bi(e):xi(e)}function bi(e){let t=mi.call(e,hi),n=e[hi],r=!1;try{e[hi]=void 0,r=!0}catch(e){}let i=gi.call(e);return r&&(t?e[hi]=n:delete e[hi]),i}function xi(e){return gi.call(e)}function Si(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=wi(t,e.shift(),0,n);return t}function Ci(e){return Ei(e)?e.slice():e}function wi(e,t,n=0,r){let i;if(!(n>20)){if(n++,ki(e)||ki(t)||Di(t))i=Ci(t);else if(Ei(e)){if(i=e.slice(),Ei(t))for(let e=0,n=t.length;e<n;e++)i.push(Ci(t[e]));else if(Oi(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]=Ci(t[r]))}}}else if(Oi(e))if(Oi(t)){if(!Ai(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(ki(c))c===void 0?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(Ti(e,s,r)||Ti(t,s,r))delete i[s];else{if(Oi(a)&&Oi(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]=wi(i[s],c,n,r)}}}}else i=t;return i}}function Ti(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 Ei(e){return Array.isArray(e)}function Di(e){return typeof e==`function`}function Oi(e){return!ki(e)&&!Ei(e)&&!Di(e)&&typeof e==`object`}function ki(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function Ai(e,t){return!(!_i(e)||!_i(t))}var ji=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function Mi(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new ji(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}function Ni(e,t){return typeof t==`string`?e===t:!!e.match(t)}function Pi(e,t){if(!t)return!1;for(let n of t)if(Ni(e,n))return!0;return!1}var Fi=class{constructor(){k(this,`_promise`,void 0),k(this,`_resolve`,void 0),k(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)}},Ii=class{constructor(e,t){k(this,`_isCalled`,!1),k(this,`_deferred`,new Fi),k(this,`_callback`,void 0),k(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 Li(e,t){return new Promise(n=>{w.with(Tr(w.active()),()=>{e.export(t,n)})})}let Ri={_export:Li},zi;function Bi(){if(zi===void 0)try{let e=globalThis.process.argv0;zi=e?`unknown_service:${e}`:`unknown_service`}catch(e){zi=`unknown_service`}return zi}let Vi=e=>typeof e==`object`&&!!e&&typeof e.then==`function`;var Hi=class e{static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=Ki(t),r._asyncAttributesPending=t.filter(([e,t])=>Vi(t)).length>0,r}constructor(e,t){var n;k(this,`_rawAttributes`,void 0),k(this,`_asyncAttributesPending`,!1),k(this,`_schemaUrl`,void 0),k(this,`_memoizedAttributes`,void 0);let r=(n=e.attributes)==null?{}:n;this._rawAttributes=Object.entries(r).map(([e,t])=>(Vi(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=Ki(this._rawAttributes),this._schemaUrl=qi(t==null?void 0:t.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}waitForAsyncAttributes(){var e=this;return P(function*(){if(e.asyncAttributesPending){for(let t=0;t<e._rawAttributes.length;t++){let[n,r]=e._rawAttributes[t];e._rawAttributes[t]=[n,Vi(r)?yield r:r]}e._asyncAttributesPending=!1}})()}get attributes(){if(this.asyncAttributesPending&&T.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(Vi(n)){T.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=Ji(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function Ui(e,t){return Hi.FromAttributeList(Object.entries(e),t)}function Wi(){return Ui({})}function Gi(){return Ui({[nn]:Bi(),[rn]:Hr[rn],[an]:Hr[an],[on]:Hr[on]})}function Ki(e){return e.map(([e,t])=>Vi(t)?[e,t.catch(t=>{T.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function qi(e){if(typeof e==`string`||e===void 0)return e;T.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function Ji(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;T.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}function Yi(e){return Xi(e,new WeakSet)}function Xi(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(!Xi(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)&&!Xi(n[e],t))return!1;return!0}return!1}var V;(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`})(V||(V={}));function Zi(e,t,n,r,i){if(r.length===0)return T.warn(`Invalid attribute key: ${r}`),V.DROP_INVALID;if(!Yi(i))return T.warn(`Invalid attribute value set for key: ${r}`),V.DROP_INVALID;let a=!Object.prototype.hasOwnProperty.call(e,r);return a&&n>=t.attributeCountLimit?V.DROP_LIMIT_REACHED:(e[r]=Qi(i,t.attributeValueLengthLimit),a?V.ADD_NEW:V.ADD_OVERWRITE_EXISTING)}function Qi(e,t){if(t<=0)return T.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=>Qi(e,t));if(typeof e==`object`){let n={};for(let[r,i]of Object.entries(e))n[r]=Qi(i,t);return n}return e}function $i(e,t){if(t==null)return{};let n={},r=0,i=0;for(let[a,o]of Object.entries(t)){let t=Zi(n,e,r,a,o);t===V.ADD_NEW?r+=1:(t===V.DROP_INVALID||t===V.DROP_LIMIT_REACHED)&&(i+=1)}return{attributes:r>0?n:void 0,droppedAttributesCount:i}}var ea=class{get hrTime(){return this._hrTime}set hrTime(e){this._isLogRecordReadonly()||(this._hrTime=e)}get hrTimeObserved(){return this._hrTimeObserved}set hrTimeObserved(e){this._isLogRecordReadonly()||(this._hrTimeObserved=e)}get spanContext(){return this._spanContext}set spanContext(e){this._isLogRecordReadonly()||(this._spanContext=e)}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){k(this,`resource`,void 0),k(this,`instrumentationScope`,void 0),k(this,`attributes`,{}),k(this,`_hrTime`,void 0),k(this,`_hrTimeObserved`,void 0),k(this,`_spanContext`,void 0),k(this,`_severityText`,void 0),k(this,`_severityNumber`,void 0),k(this,`_body`,void 0),k(this,`_eventName`,void 0),k(this,`_attributesCount`,0),k(this,`_droppedAttributesCount`,0),k(this,`_isReadonly`,!1),k(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=Gr(r==null?f:r),this._hrTimeObserved=Gr(i==null?f:i),d){let e=D.getSpanContext(d);e&&He(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=Zi(this.attributes,this._logRecordLimits,this._attributesCount,e,t);return n===V.DROP_LIMIT_REACHED?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&T.warn(`Dropping extra attributes.`)):n===V.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(Jt,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(Xt,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(Xt,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(Jt,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,`exception.stacktrace`)||this.setAttribute(Yt,n.stack),t=!0)}t||T.warn(`Failed to record an exception ${e}`)}_isLogRecordReadonly(){return this._isReadonly&&T.warn(`Can not execute the operation on emitted log record`),this._isReadonly}},ta=class{constructor(e,t){k(this,`_instrumentationScope`,void 0),k(this,`_sharedState`,void 0),k(this,`_loggerConfig`,void 0),this._instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this._instrumentationScope)}emit(e){let t=e.context||w.active();if(!this.enabled(e))re