@elastic/opentelemetry-browser 0.2.0 → 0.3.0
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/NOTICE.md +805 -603
- package/build/elastic-otel-browser.js +1536 -531
- package/build/elastic-otel-browser.js.map +4 -4
- package/build/elastic-otel-browser.min.js +7 -7
- package/build/elastic-otel-browser.min.js.map +4 -4
- package/lib/sdk.js +4 -0
- package/lib/version.js +1 -1
- package/package.json +15 -14
- package/types/sdk.d.ts +1 -0
- package/types/version.d.ts +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
(()=>{var gt="1.9.1";var Ls=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function qu(e){let t=new Set([e]),r=new Set,n=e.match(Ls);if(!n)return()=>!1;let o={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(o.prerelease!=null)return function(c){return c===e};function i(a){return r.add(a),!1}function s(a){return t.add(a),!0}return function(c){if(t.has(c))return!0;if(r.has(c))return!1;let u=c.match(Ls);if(!u)return i(c);let p={major:+u[1],minor:+u[2],patch:+u[3],prerelease:u[4]};return p.prerelease!=null||o.major!==p.major?i(c):o.major===0?o.minor===p.minor&&o.patch<=p.patch?s(c):i(c):o.minor<=p.minor?s(c):i(c)}}var Ns=qu(gt);var Qu=gt.split(".")[0],Be=Symbol.for(`opentelemetry.js.api.${Qu}`),Ge=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{};function ot(e,t,r,n=!1){var o;let i=Ge[Be]=(o=Ge[Be])!==null&&o!==void 0?o:{version:gt};if(!n&&i[e]){let s=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return r.error(s.stack||s.message),!1}if(i.version!==gt){let s=new Error(`@opentelemetry/api: Registration of version v${i.version} for ${e} does not match previously registered API v${gt}`);return r.error(s.stack||s.message),!1}return i[e]=t,r.debug(`@opentelemetry/api: Registered a global for ${e} v${gt}.`),!0}function j(e){var t,r;let n=(t=Ge[Be])===null||t===void 0?void 0:t.version;if(!(!n||!Ns(n)))return(r=Ge[Be])===null||r===void 0?void 0:r[e]}function it(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${gt}.`);let r=Ge[Be];r&&delete r[e]}var kr=class{constructor(t){this._namespace=t.namespace||"DiagComponentLogger"}debug(...t){return He("debug",this._namespace,t)}error(...t){return He("error",this._namespace,t)}info(...t){return He("info",this._namespace,t)}warn(...t){return He("warn",this._namespace,t)}verbose(...t){return He("verbose",this._namespace,t)}};function He(e,t,r){let n=j("diag");if(n)return n[e](t,...r)}var O;(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"})(O||(O={}));function ys(e,t){e<O.NONE?e=O.NONE:e>O.ALL&&(e=O.ALL),t=t||{};function r(n,o){let i=t[n];return typeof i=="function"&&e>=o?i.bind(t):function(){}}return{error:r("error",O.ERROR),warn:r("warn",O.WARN),info:r("info",O.INFO),debug:r("debug",O.DEBUG),verbose:r("verbose",O.VERBOSE)}}var Ju="diag",y=class e{static instance(){return this._instance||(this._instance=new e),this._instance}constructor(){function t(o){return function(...i){let s=j("diag");if(s)return s[o](...i)}}let r=this,n=(o,i={logLevel:O.INFO})=>{var s,a,c;if(o===r){let _=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((s=_.stack)!==null&&s!==void 0?s:_.message),!1}typeof i=="number"&&(i={logLevel:i});let u=j("diag"),p=ys((a=i.logLevel)!==null&&a!==void 0?a:O.INFO,o);if(u&&!i.suppressOverrideMessage){let _=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";u.warn(`Current logger will be overwritten from ${_}`),p.warn(`Current logger will overwrite one already registered from ${_}`)}return ot("diag",p,r,!0)};r.setLogger=n,r.disable=()=>{it(Ju,r)},r.createComponentLogger=o=>new kr(o),r.verbose=t("verbose"),r.debug=t("debug"),r.info=t("info"),r.warn=t("warn"),r.error=t("error")}};var Fr=class e{constructor(t){this._entries=t?new Map(t):new Map}getEntry(t){let r=this._entries.get(t);if(r)return Object.assign({},r)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(t,r){let n=new e(this._entries);return n._entries.set(t,r),n}removeEntry(t){let r=new e(this._entries);return r._entries.delete(t),r}removeEntries(...t){let r=new e(this._entries);for(let n of t)r._entries.delete(n);return r}clear(){return new e}};var Cs=Symbol("BaggageEntryMetadata");var Zu=y.instance();function Ps(e={}){return new Fr(new Map(Object.entries(e)))}function Yo(e){return typeof e!="string"&&(Zu.error(`Cannot create baggage metadata from unknown type: ${typeof e}`),e=""),{__TYPE__:Cs,toString(){return e}}}function kt(e){return Symbol.for(e)}var qo=class e{constructor(t){let r=this;r._currentContext=t?new Map(t):new Map,r.getValue=n=>r._currentContext.get(n),r.setValue=(n,o)=>{let i=new e(r._currentContext);return i._currentContext.set(n,o),i},r.deleteValue=n=>{let o=new e(r._currentContext);return o._currentContext.delete(n),o}}},B=new qo;var Qo=class{constructor(){}createGauge(t,r){return el}createHistogram(t,r){return rl}createCounter(t,r){return tl}createUpDownCounter(t,r){return nl}createObservableGauge(t,r){return il}createObservableCounter(t,r){return ol}createObservableUpDownCounter(t,r){return sl}addBatchObservableCallback(t,r){}removeBatchObservableCallback(t){}},re=class{},Jo=class extends re{add(t,r){}},Zo=class extends re{add(t,r){}},ti=class extends re{record(t,r){}},ei=class extends re{record(t,r){}},Ve=class{addCallback(t){}removeCallback(t){}},ri=class extends Ve{},ni=class extends Ve{},oi=class extends Ve{},ii=new Qo,tl=new Jo,el=new ti,rl=new ei,nl=new Zo,ol=new ri,il=new ni,sl=new oi;function Ft(){return ii}var K;(function(e){e[e.INT=0]="INT",e[e.DOUBLE=1]="DOUBLE"})(K||(K={}));var Is={get(e,t){if(e!=null)return e[t]},keys(e){return e==null?[]:Object.keys(e)}},Ms={set(e,t,r){e!=null&&(e[t]=r)}};var $r=class{active(){return B}with(t,r,n,...o){return r.call(n,...o)}bind(t,r){return r}enable(){return this}disable(){return this}};var si="context",al=new $r,st=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalContextManager(t){return ot(si,t,y.instance())}active(){return this._getContextManager().active()}with(t,r,n,...o){return this._getContextManager().with(t,r,n,...o)}bind(t,r){return this._getContextManager().bind(t,r)}_getContextManager(){return j(si)||al}disable(){this._getContextManager().disable(),it(si,y.instance())}};var w;(function(e){e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"})(w||(w={}));var zr="0000000000000000",Wr="00000000000000000000000000000000",ke={traceId:Wr,spanId:zr,traceFlags:w.NONE};var at=class{constructor(t=ke){this._spanContext=t}spanContext(){return this._spanContext}setAttribute(t,r){return this}setAttributes(t){return this}addEvent(t,r){return this}addLink(t){return this}addLinks(t){return this}setStatus(t){return this}updateName(t){return this}end(t){}isRecording(){return!1}recordException(t,r){}};var ai=kt("OpenTelemetry Context Key SPAN");function jr(e){return e.getValue(ai)||void 0}function vs(){return jr(st.getInstance().active())}function Fe(e,t){return e.setValue(ai,t)}function Ds(e){return e.deleteValue(ai)}function Us(e,t){return Fe(e,new at(t))}function Kr(e){var t;return(t=jr(e))===null||t===void 0?void 0:t.spanContext()}var Xr=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 Bs(e,t){if(typeof e!="string"||e.length!==t)return!1;let r=0;for(let n=0;n<e.length;n+=4)r+=(Xr[e.charCodeAt(n)]|0)+(Xr[e.charCodeAt(n+1)]|0)+(Xr[e.charCodeAt(n+2)]|0)+(Xr[e.charCodeAt(n+3)]|0);return r===t}function Yr(e){return Bs(e,32)&&e!==Wr}function Gs(e){return Bs(e,16)&&e!==zr}function z(e){return Yr(e.traceId)&&Gs(e.spanId)}function Hs(e){return new at(e)}var ci=st.getInstance(),ne=class{startSpan(t,r,n=ci.active()){if(!!r?.root)return new at;let i=n&&Kr(n);return cl(i)&&z(i)?new at(i):new at}startActiveSpan(t,r,n,o){let i,s,a;if(arguments.length<2)return;arguments.length===2?a=r:arguments.length===3?(i=r,a=n):(i=r,s=n,a=o);let c=s??ci.active(),u=this.startSpan(t,i,c),p=Fe(c,u);return ci.with(p,a,void 0,u)}};function cl(e){return e!==null&&typeof e=="object"&&"spanId"in e&&typeof e.spanId=="string"&&"traceId"in e&&typeof e.traceId=="string"&&"traceFlags"in e&&typeof e.traceFlags=="number"}var ul=new ne,qr=class{constructor(t,r,n,o){this._provider=t,this.name=r,this.version=n,this.options=o}startSpan(t,r,n){return this._getTracer().startSpan(t,r,n)}startActiveSpan(t,r,n,o){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let t=this._provider.getDelegateTracer(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):ul}};var Qr=class{getTracer(t,r,n){return new ne}};var ll=new Qr,$e=class{getTracer(t,r,n){var o;return(o=this.getDelegateTracer(t,r,n))!==null&&o!==void 0?o:new qr(this,t,r,n)}getDelegate(){var t;return(t=this._delegate)!==null&&t!==void 0?t:ll}setDelegate(t){this._delegate=t}getDelegateTracer(t,r,n){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getTracer(t,r,n)}};var oe;(function(e){e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(oe||(oe={}));var Et;(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"})(Et||(Et={}));var X;(function(e){e[e.UNSET=0]="UNSET",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR"})(X||(X={}));var E=st.getInstance();var l=y.instance();var ui=class{getMeter(t,r,n){return ii}},Vs=new ui;var li="metrics",Jr=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalMeterProvider(t){return ot(li,t,y.instance())}getMeterProvider(){return j(li)||Vs}getMeter(t,r,n){return this.getMeterProvider().getMeter(t,r,n)}disable(){it(li,y.instance())}};var $t=Jr.getInstance();var Zr=class{inject(t,r){}extract(t,r){return t}fields(){return[]}};var pi=kt("OpenTelemetry Baggage Key");function mi(e){return e.getValue(pi)||void 0}function ks(){return mi(st.getInstance().active())}function Fs(e,t){return e.setValue(pi,t)}function $s(e){return e.deleteValue(pi)}var _i="propagation",pl=new Zr,tn=class e{constructor(){this.createBaggage=Ps,this.getBaggage=mi,this.getActiveBaggage=ks,this.setBaggage=Fs,this.deleteBaggage=$s}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalPropagator(t){return ot(_i,t,y.instance())}inject(t,r,n=Ms){return this._getGlobalPropagator().inject(t,r,n)}extract(t,r,n=Is){return this._getGlobalPropagator().extract(t,r,n)}fields(){return this._getGlobalPropagator().fields()}disable(){it(_i,y.instance())}_getGlobalPropagator(){return j(_i)||pl}};var D=tn.getInstance();var di="trace",en=class e{constructor(){this._proxyTracerProvider=new $e,this.wrapSpanContext=Hs,this.isSpanContextValid=z,this.deleteSpan=Ds,this.getSpan=jr,this.getActiveSpan=vs,this.getSpanContext=Kr,this.setSpan=Fe,this.setSpanContext=Us}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalTracerProvider(t){let r=ot(di,this._proxyTracerProvider,y.instance());return r&&this._proxyTracerProvider.setDelegate(t),r}getTracerProvider(){return j(di)||this._proxyTracerProvider}getTracer(t,r){return this.getTracerProvider().getTracer(t,r)}disable(){it(di,y.instance()),this._proxyTracerProvider=new $e}};var A=en.getInstance();var Y;(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"})(Y||(Y={}));var ie=class{emit(t){}enabled(){return!1}},ze=new ie;var We=Symbol.for("io.opentelemetry.js.api.logs"),se=globalThis;function zs(e,t,r){return n=>n===e?t:r}var hi=1;var fi=class{getLogger(t,r,n){return new ie}},rn=new fi;var nn=class{constructor(t,r,n,o){this._provider=t,this.name=r,this.version=n,this.options=o}emit(t){this._getLogger().emit(t)}enabled(t){return this._getLogger().enabled(t)}_getLogger(){if(this._delegate)return this._delegate;let t=this._provider._getDelegateLogger(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):ze}};var je=class{getLogger(t,r,n){var o;return(o=this._getDelegateLogger(t,r,n))!==null&&o!==void 0?o:new nn(this,t,r,n)}_getDelegate(){var t;return(t=this._delegate)!==null&&t!==void 0?t:rn}_setDelegate(t){this._delegate=t}_getDelegateLogger(t,r,n){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(t,r,n)}};var on=class e{constructor(){this._proxyLoggerProvider=new je}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(t){return se[We]?this.getLoggerProvider():(se[We]=zs(hi,t,rn),this._proxyLoggerProvider._setDelegate(t),t)}getLoggerProvider(){var t,r;return(r=(t=se[We])===null||t===void 0?void 0:t.call(se,hi))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(t,r,n){return this.getLoggerProvider().getLogger(t,r,n)}disable(){delete se[We],this._proxyLoggerProvider=new je}};var Ct=on.getInstance();var At=class{_delegate;constructor(t){this._delegate=t}export(t,r){this._delegate.export(t,r)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}};var Ke=class extends Error{code;name="OTLPExporterError";data;constructor(t,r,n){super(t),this.data=n,this.code=r}};function ml(e){if(Number.isFinite(e)&&e>0)return e;throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function Ws(e){if(e!=null)return async()=>e}function js(e,t,r){return{timeoutMillis:ml(e.timeoutMillis??t.timeoutMillis??r.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??r.concurrencyLimit,compression:e.compression??t.compression??r.compression}}function Ks(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:"none"}}var Ti=class{_concurrencyLimit;_sendingPromises=[];constructor(t){this._concurrencyLimit=t}pushPromise(t){if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this._sendingPromises.push(t);let r=()=>{let n=this._sendingPromises.indexOf(t);this._sendingPromises.splice(n,1)};t.then(r,r)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}};function Xs(e){return new Ti(e.concurrencyLimit)}var Ys=kt("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function zt(e){return e.setValue(Ys,!0)}function Wt(e){return e.getValue(Ys)===!0}var sn="baggage";function qs(e){return e.reduce((t,r)=>{let n=`${t}${t!==""?",":""}${r}`;return n.length>8192?t:n},"")}function Qs(e){return e.getAllEntries().map(([t,r])=>{let n=`${encodeURIComponent(t)}=${encodeURIComponent(r.value)}`;return r.metadata!==void 0&&(n+=";"+r.metadata.toString()),n})}function Js(e){if(!e)return;let t=e.indexOf(";"),r=t===-1?e:e.substring(0,t),n=r.indexOf("=");if(n<=0)return;let o=r.substring(0,n).trim(),i=r.substring(n+1).trim();if(!o||!i)return;let s,a;try{s=decodeURIComponent(o),a=decodeURIComponent(i)}catch{return}let c;if(t!==-1&&t<e.length-1){let u=e.substring(t+1);c=Yo(u)}return{key:s,value:a,metadata:c}}var Xe=class{inject(t,r,n){let o=D.getBaggage(t);if(!o||Wt(t))return;let i=Qs(o).filter(a=>a.length<=4096).slice(0,180),s=qs(i);s.length>0&&n.set(r,sn,s)}extract(t,r,n){let o=n.get(r,sn),i=Array.isArray(o)?o.join(","):o;if(!i)return t;let s={};return i.length===0||(i.split(",").forEach(c=>{let u=Js(c);if(u){let p={value:u.value};u.metadata&&(p.metadata=u.metadata),s[u.key]=p}}),Object.entries(s).length===0)?t:D.setBaggage(t,D.createBaggage(s))}fields(){return[sn]}};function Pt(e){let t={};if(typeof e!="object"||e==null)return t;for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;if(!fl(r)){l.warn(`Invalid attribute key: ${r}`);continue}let n=e[r];if(!an(n)){l.warn(`Invalid attribute value set for key: ${r}`);continue}Array.isArray(n)?t[r]=n.slice():t[r]=n}return t}function fl(e){return typeof e=="string"&&e!==""}function an(e){return e==null?!0:Array.isArray(e)?Tl(e):Zs(typeof e)}function Tl(e){let t;for(let r of e){if(r==null)continue;let n=typeof r;if(n!==t){if(!t){if(Zs(n)){t=n;continue}return!1}return!1}}return!0}function Zs(e){switch(e){case"number":case"boolean":case"string":return!0}return!1}function ta(){return e=>{l.error(gl(e))}}function gl(e){return typeof e=="string"?e:JSON.stringify(El(e))}function El(e){let t={},r=e;for(;r!==null;)Object.getOwnPropertyNames(r).forEach(n=>{if(t[n])return;let o=r[n];o&&(t[n]=String(o))}),r=Object.getPrototypeOf(r);return t}var Sl=ta();function C(e){try{Sl(e)}catch{}}var ea="2.7.0";var Ye="error.type";var Q="exception.message",jt="exception.stacktrace",et="exception.type";var cn="http.request.method";var un="http.request.method_original";var ln="http.response.status_code";var pn="server.address",mn="server.port",ra="service.name";var qe="telemetry.sdk.language";var na="webjs",Qe="telemetry.sdk.name",Je="telemetry.sdk.version";var It="url.full";var oa="user_agent.original";var ia="process.runtime.name";var Mt={[Qe]:"opentelemetry",[ia]:"browser",[qe]:na,[Je]:ea};var N=performance;var Al=9,Rl=6,xl=Math.pow(10,Rl),_n=Math.pow(10,Al);function P(e){let t=e/1e3,r=Math.trunc(t),n=Math.round(e%1e3*xl);return[r,n]}function I(e){let t=P(N.timeOrigin),r=P(typeof e=="number"?e:N.now());return hn(t,r)}function ct(e){if(Ze(e))return e;if(typeof e=="number")return e<N.timeOrigin?I(e):P(e);if(e instanceof Date)return P(e.getTime());throw TypeError("Invalid input type")}function Ei(e,t){let r=t[0]-e[0],n=t[1]-e[1];return n<0&&(r-=1,n+=_n),[r,n]}function J(e){return e[0]*_n+e[1]}function ae(e){return e[0]*1e6+e[1]/1e3}function Ze(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="number"&&typeof e[1]=="number"}function dn(e){return Ze(e)||typeof e=="number"||e instanceof Date}function hn(e,t){let r=[e[0]+t[0],e[1]+t[1]];return r[1]>=_n&&(r[1]-=_n,r[0]+=1),r}var U;(function(e){e[e.SUCCESS=0]="SUCCESS",e[e.FAILED=1]="FAILED"})(U||(U={}));var tr=class{_propagators;_fields;constructor(t={}){this._propagators=t.propagators??[],this._fields=Array.from(new Set(this._propagators.map(r=>typeof r.fields=="function"?r.fields():[]).reduce((r,n)=>r.concat(n),[])))}inject(t,r,n){for(let o of this._propagators)try{o.inject(t,r,n)}catch(i){l.warn(`Failed to inject with ${o.constructor.name}. Err: ${i.message}`)}}extract(t,r,n){return this._propagators.reduce((o,i)=>{try{return i.extract(o,r,n)}catch(s){l.warn(`Failed to extract with ${i.constructor.name}. Err: ${s.message}`)}return o},t)}fields(){return this._fields.slice()}};var Si="[_0-9a-z-*/]",Ol=`[a-z]${Si}{0,255}`,bl=`[a-z0-9]${Si}{0,240}@[a-z]${Si}{0,13}`,wl=new RegExp(`^(?:${Ol}|${bl})$`),Ll=/^[ -~]{0,255}[!-~]$/,Nl=/,|=/;function sa(e){return wl.test(e)}function aa(e){return Ll.test(e)&&!Nl.test(e)}var ca=32,yl=512,ua=",",la="=",fn=class e{_internalState=new Map;constructor(t){t&&this._parse(t)}set(t,r){let n=this._clone();return n._internalState.has(t)&&n._internalState.delete(t),n._internalState.set(t,r),n}unset(t){let r=this._clone();return r._internalState.delete(t),r}get(t){return this._internalState.get(t)}serialize(){return this._keys().reduce((t,r)=>(t.push(r+la+this.get(r)),t),[]).join(ua)}_parse(t){t.length>yl||(this._internalState=t.split(ua).reverse().reduce((r,n)=>{let o=n.trim(),i=o.indexOf(la);if(i!==-1){let s=o.slice(0,i),a=o.slice(i+1,n.length);sa(s)&&aa(a)&&r.set(s,a)}return r},new Map),this._internalState.size>ca&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,ca))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let t=new e;return t._internalState=new Map(this._internalState),t}};var ce="traceparent",Tn="tracestate",Cl="00",Pl="(?!ff)[\\da-f]{2}",Il="(?![0]{32})[\\da-f]{32}",Ml="(?![0]{16})[\\da-f]{16}",vl="[\\da-f]{2}",Dl=new RegExp(`^\\s?(${Pl})-(${Il})-(${Ml})-(${vl})(-.*)?\\s?$`);function pa(e){let t=Dl.exec(e);return!t||t[1]==="00"&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var er=class{inject(t,r,n){let o=A.getSpanContext(t);if(!o||Wt(t)||!z(o))return;let i=`${Cl}-${o.traceId}-${o.spanId}-0${Number(o.traceFlags||w.NONE).toString(16)}`;n.set(r,ce,i),o.traceState&&n.set(r,Tn,o.traceState.serialize())}extract(t,r,n){let o=n.get(r,ce);if(!o)return t;let i=Array.isArray(o)?o[0]:o;if(typeof i!="string")return t;let s=pa(i);if(!s)return t;s.isRemote=!0;let a=n.get(r,Tn);if(a){let c=Array.isArray(a)?a.join(","):a;s.traceState=new fn(typeof c=="string"?c:void 0)}return A.setSpanContext(t,s)}fields(){return[ce,Tn]}};var Ul="[object Object]",Bl="[object Null]",Gl="[object Undefined]",Hl=Function.prototype,ma=Hl.toString,Vl=ma.call(Object),kl=Object.getPrototypeOf,_a=Object.prototype,da=_a.hasOwnProperty,Kt=Symbol?Symbol.toStringTag:void 0,ha=_a.toString;function Ai(e){if(!Fl(e)||$l(e)!==Ul)return!1;let t=kl(e);if(t===null)return!0;let r=da.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&ma.call(r)===Vl}function Fl(e){return e!=null&&typeof e=="object"}function $l(e){return e==null?e===void 0?Gl:Bl:Kt&&Kt in Object(e)?zl(e):Wl(e)}function zl(e){let t=da.call(e,Kt),r=e[Kt],n=!1;try{e[Kt]=void 0,n=!0}catch{}let o=ha.call(e);return n&&(t?e[Kt]=r:delete e[Kt]),o}function Wl(e){return ha.call(e)}var jl=20;function xi(...e){let t=e.shift(),r=new WeakMap;for(;e.length>0;)t=Ta(t,e.shift(),0,r);return t}function Ri(e){return En(e)?e.slice():e}function Ta(e,t,r=0,n){let o;if(!(r>jl)){if(r++,gn(e)||gn(t)||ga(t))o=Ri(t);else if(En(e)){if(o=e.slice(),En(t))for(let i=0,s=t.length;i<s;i++)o.push(Ri(t[i]));else if(rr(t)){let i=Object.keys(t);for(let s=0,a=i.length;s<a;s++){let c=i[s];c==="__proto__"||c==="constructor"||c==="prototype"||(o[c]=Ri(t[c]))}}}else if(rr(e))if(rr(t)){if(!Kl(e,t))return t;o=Object.assign({},e);let i=Object.keys(t);for(let s=0,a=i.length;s<a;s++){let c=i[s];if(c==="__proto__"||c==="constructor"||c==="prototype")continue;let u=t[c];if(gn(u))typeof u>"u"?delete o[c]:o[c]=u;else{let p=o[c],_=u;if(fa(e,c,n)||fa(t,c,n))delete o[c];else{if(rr(p)&&rr(_)){let f=n.get(p)||[],m=n.get(_)||[];f.push({obj:e,key:c}),m.push({obj:t,key:c}),n.set(p,f),n.set(_,m)}o[c]=Ta(o[c],u,r,n)}}}}else o=t;return o}}function fa(e,t,r){let n=r.get(e[t])||[];for(let o=0,i=n.length;o<i;o++){let s=n[o];if(s.key===t&&s.obj===e)return!0}return!1}function En(e){return Array.isArray(e)}function ga(e){return typeof e=="function"}function rr(e){return!gn(e)&&!En(e)&&!ga(e)&&typeof e=="object"}function gn(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e>"u"||e instanceof Date||e instanceof RegExp||e===null}function Kl(e,t){return!(!Ai(e)||!Ai(t))}var Sn=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function Oi(e,t){let r,n=new Promise(function(i,s){r=setTimeout(function(){s(new Sn("Operation timed out."))},t)});return Promise.race([e,n]).then(o=>(clearTimeout(r),o),o=>{throw clearTimeout(r),o})}function An(e,t){return typeof t=="string"?e===t:!!e.match(t)}function nr(e,t){if(!t)return!1;for(let r of t)if(An(e,r))return!0;return!1}var Rn=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((t,r)=>{this._resolve=t,this._reject=r})}get promise(){return this._promise}resolve(t){this._resolve(t)}reject(t){this._reject(t)}};var Rt=class{_isCalled=!1;_deferred=new Rn;_callback;_that;constructor(t,r){this._callback=t,this._that=r}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...t){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...t)).then(r=>this._deferred.resolve(r),r=>this._deferred.reject(r))}catch(r){this._deferred.reject(r)}}return this._deferred.promise}};function Ea(e,t){return new Promise(r=>{E.with(zt(E.active()),()=>{e.export(t,r)})})}var Sa={_export:Ea};function ql(e){return Object.prototype.hasOwnProperty.call(e,"partialSuccess")}function Aa(){return{handleResponse(e){e==null||!ql(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||l.warn("Received Partial Success response:",JSON.stringify(e.partialSuccess))}}}var bi=class{_diagLogger;_transport;_serializer;_responseHandler;_promiseQueue;_timeout;constructor(t,r,n,o,i){this._transport=t,this._serializer=r,this._responseHandler=n,this._promiseQueue=o,this._timeout=i,this._diagLogger=l.createComponentLogger({namespace:"OTLPExportDelegate"})}export(t,r){if(this._diagLogger.debug("items to be sent",t),this._promiseQueue.hasReachedLimit()){r({code:U.FAILED,error:new Error("Concurrent export limit reached")});return}let n=this._serializer.serializeRequest(t);if(n==null){r({code:U.FAILED,error:new Error("Nothing to send")});return}this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(o=>{if(o.status==="success"){if(o.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(o.data))}catch(i){this._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",i,o.data)}r({code:U.SUCCESS});return}else if(o.status==="failure"&&o.error){r({code:U.FAILED,error:o.error});return}else o.status==="retryable"?r({code:U.FAILED,error:o.error??new Ke("Export failed with retryable status")}):r({code:U.FAILED,error:new Ke("Export failed with unknown error")})},o=>r({code:U.FAILED,error:o})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug("shutdown started"),await this.forceFlush(),this._transport.shutdown()}};function Ra(e,t){return new bi(e.transport,e.serializer,Aa(),e.promiseHandler,t.timeout)}function xa(e,t,r){return Ra({transport:r,serializer:t,promiseHandler:Xs(e)},{timeout:e.timeoutMillis})}var G;(function(e){e[e.DELTA=0]="DELTA",e[e.CUMULATIVE=1]="CUMULATIVE"})(G||(G={}));var T;(function(e){e.COUNTER="COUNTER",e.GAUGE="GAUGE",e.HISTOGRAM="HISTOGRAM",e.UP_DOWN_COUNTER="UP_DOWN_COUNTER",e.OBSERVABLE_COUNTER="OBSERVABLE_COUNTER",e.OBSERVABLE_GAUGE="OBSERVABLE_GAUGE",e.OBSERVABLE_UP_DOWN_COUNTER="OBSERVABLE_UP_DOWN_COUNTER"})(T||(T={}));var H;(function(e){e[e.HISTOGRAM=0]="HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=1]="EXPONENTIAL_HISTOGRAM",e[e.GAUGE=2]="GAUGE",e[e.SUM=3]="SUM"})(H||(H={}));function xn(e){let t=Object.keys(e);return t.length===0?"":(t=t.sort(),JSON.stringify(t.map(r=>[r,e[r]])))}function Oa(e){return`${e.name}:${e.version??""}:${e.schemaUrl??""}`}var or=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function vt(e,t){let r,n=new Promise(function(i,s){r=setTimeout(function(){s(new or("Operation timed out."))},t)});return Promise.race([e,n]).then(o=>(clearTimeout(r),o),o=>{throw clearTimeout(r),o})}function ba(e,t){if(e.size!==t.size)return!1;for(let r of e)if(!t.has(r))return!1;return!0}function wa(e,t){let r=0,n=e.length-1,o=e.length;for(;n>=r;){let i=r+Math.trunc((n-r)/2);e[i]<t?r=i+1:(o=i,n=i-1)}return o}function La(e,t){return e.toLowerCase()===t.toLowerCase()}var Z;(function(e){e[e.DROP=0]="DROP",e[e.SUM=1]="SUM",e[e.LAST_VALUE=2]="LAST_VALUE",e[e.HISTOGRAM=3]="HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=4]="EXPONENTIAL_HISTOGRAM"})(Z||(Z={}));var ir=class{kind=Z.DROP;createAccumulation(){}merge(t,r){}diff(t,r){}toMetricData(t,r,n,o){}};function Ql(e){let t=e.map(()=>0);return t.push(0),{buckets:{boundaries:e,counts:t},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}var ue=class{startTime;_boundaries;_recordMinMax;_current;constructor(t,r,n=!0,o=Ql(r)){this.startTime=t,this._boundaries=r,this._recordMinMax=n,this._current=o}record(t){if(Number.isNaN(t))return;this._current.count+=1,this._current.sum+=t,this._recordMinMax&&(this._current.min=Math.min(t,this._current.min),this._current.max=Math.max(t,this._current.max),this._current.hasMinMax=!0);let r=wa(this._boundaries,t);this._current.buckets.counts[r]+=1}setStartTime(t){this.startTime=t}toPointValue(){return this._current}},le=class{kind=Z.HISTOGRAM;_boundaries;_recordMinMax;constructor(t,r){this._boundaries=t,this._recordMinMax=r}createAccumulation(t){return new ue(t,this._boundaries,this._recordMinMax)}merge(t,r){let n=t.toPointValue(),o=r.toPointValue(),i=n.buckets.counts,s=o.buckets.counts,a=new Array(i.length);for(let p=0;p<i.length;p++)a[p]=i[p]+s[p];let c=1/0,u=-1/0;return this._recordMinMax&&(n.hasMinMax&&o.hasMinMax?(c=Math.min(n.min,o.min),u=Math.max(n.max,o.max)):n.hasMinMax?(c=n.min,u=n.max):o.hasMinMax&&(c=o.min,u=o.max)),new ue(t.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:a},count:n.count+o.count,sum:n.sum+o.sum,hasMinMax:this._recordMinMax&&(n.hasMinMax||o.hasMinMax),min:c,max:u})}diff(t,r){let n=t.toPointValue(),o=r.toPointValue(),i=n.buckets.counts,s=o.buckets.counts,a=new Array(i.length);for(let c=0;c<i.length;c++)a[c]=s[c]-i[c];return new ue(r.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:a},count:o.count-n.count,sum:o.sum-n.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(t,r,n,o){return{descriptor:t,aggregationTemporality:r,dataPointType:H.HISTOGRAM,dataPoints:n.map(([i,s])=>{let a=s.toPointValue(),c=t.type===T.GAUGE||t.type===T.UP_DOWN_COUNTER||t.type===T.OBSERVABLE_GAUGE||t.type===T.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:i,startTime:s.startTime,endTime:o,value:{min:a.hasMinMax?a.min:void 0,max:a.hasMinMax?a.max:void 0,sum:c?void 0:a.sum,buckets:a.buckets,count:a.count}}})}}};var sr=class e{backing;indexBase;indexStart;indexEnd;constructor(t=new wi,r=0,n=0,o=0){this.backing=t,this.indexBase=r,this.indexStart=n,this.indexEnd=o}get offset(){return this.indexStart}get length(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(t,r)=>this.at(r))}at(t){let r=this.indexBase-this.indexStart;return t<r&&(t+=this.backing.length),t-=r,this.backing.countAt(t)}incrementBucket(t,r){this.backing.increment(t,r)}decrementBucket(t,r){this.backing.decrement(t,r)}trim(){for(let t=0;t<this.length;t++)if(this.at(t)!==0){this.indexStart+=t;break}else if(t===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(let t=this.length-1;t>=0;t--)if(this.at(t)!==0){this.indexEnd-=this.length-t-1;break}this._rotate()}downscale(t){this._rotate();let r=1+this.indexEnd-this.indexStart,n=1<<t,o=0,i=0;for(let s=this.indexStart;s<=this.indexEnd;){let a=s%n;a<0&&(a+=n);for(let c=a;c<n&&o<r;c++)this._relocateBucket(i,o),o++,s++;i++}this.indexStart>>=t,this.indexEnd>>=t,this.indexBase=this.indexStart}clone(){return new e(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){let t=this.indexBase-this.indexStart;t!==0&&(t>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,t),this.backing.reverse(t,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+t)),this.indexBase=this.indexStart)}_relocateBucket(t,r){t!==r&&this.incrementBucket(t,this.backing.emptyBucket(r))}},wi=class e{_counts;constructor(t=[0]){this._counts=t}get length(){return this._counts.length}countAt(t){return this._counts[t]}growTo(t,r,n){let o=new Array(t).fill(0);o.splice(n,this._counts.length-r,...this._counts.slice(r)),o.splice(0,r,...this._counts.slice(0,r)),this._counts=o}reverse(t,r){let n=Math.floor((t+r)/2)-t;for(let o=0;o<n;o++){let i=this._counts[t+o];this._counts[t+o]=this._counts[r-o-1],this._counts[r-o-1]=i}}emptyBucket(t){let r=this._counts[t];return this._counts[t]=0,r}increment(t,r){this._counts[t]+=r}decrement(t,r){this._counts[t]>=r?this._counts[t]-=r:this._counts[t]=0}clone(){return new e([...this._counts])}};var ar=Math.pow(2,-1022);function On(e){let t=new DataView(new ArrayBuffer(8));return t.setFloat64(0,e),((t.getUint32(0)&2146435072)>>20)-1023}function bn(e){let t=new DataView(new ArrayBuffer(8));t.setFloat64(0,e);let r=t.getUint32(0),n=t.getUint32(4);return(r&1048575)*Math.pow(2,32)+n}function cr(e,t){return e===0||e===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY||Number.isNaN(e)?e:e*Math.pow(2,t)}function ya(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}var ut=class extends Error{};var wn=class{_shift;constructor(t){this._shift=-t}mapToIndex(t){if(t<ar)return this._minNormalLowerBoundaryIndex();let r=On(t),n=this._rightShift(bn(t)-1,52);return r+n>>this._shift}lowerBoundary(t){let r=this._minNormalLowerBoundaryIndex();if(t<r)throw new ut(`underflow: ${t} is < minimum lower boundary: ${r}`);let n=this._maxNormalLowerBoundaryIndex();if(t>n)throw new ut(`overflow: ${t} is > maximum lower boundary: ${n}`);return cr(1,t<<this._shift)}get scale(){return this._shift===0?0:-this._shift}_minNormalLowerBoundaryIndex(){let t=-1022>>this._shift;return this._shift<2&&t--,t}_maxNormalLowerBoundaryIndex(){return 1023>>this._shift}_rightShift(t,r){return Math.floor(t*Math.pow(2,-r))}};var Ln=class{_scale;_scaleFactor;_inverseFactor;constructor(t){this._scale=t,this._scaleFactor=cr(Math.LOG2E,t),this._inverseFactor=cr(Math.LN2,-t)}mapToIndex(t){if(t<=ar)return this._minNormalLowerBoundaryIndex()-1;if(bn(t)===0)return(On(t)<<this._scale)-1;let r=Math.floor(Math.log(t)*this._scaleFactor),n=this._maxNormalLowerBoundaryIndex();return r>=n?n:r}lowerBoundary(t){let r=this._maxNormalLowerBoundaryIndex();if(t>=r){if(t===r)return 2*Math.exp((t-(1<<this._scale))/this._scaleFactor);throw new ut(`overflow: ${t} is > maximum lower boundary: ${r}`)}let n=this._minNormalLowerBoundaryIndex();if(t<=n){if(t===n)return ar;if(t===n-1)return Math.exp((t+(1<<this._scale))/this._scaleFactor)/2;throw new ut(`overflow: ${t} is < minimum lower boundary: ${n}`)}return Math.exp(t*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return-1022<<this._scale}_maxNormalLowerBoundaryIndex(){return(1024<<this._scale)-1}};var Pa=-10,Ia=20,Zl=Array.from({length:31},(e,t)=>t>10?new Ln(t-10):new wn(t-10));function yi(e){if(e>Ia||e<Pa)throw new ut(`expected scale >= ${Pa} && <= ${Ia}, got: ${e}`);return Zl[e+10]}var pe=class e{static combine(t,r){return new e(Math.min(t.low,r.low),Math.max(t.high,r.high))}low;high;constructor(t,r){this.low=t,this.high=r}},tp=20,ep=160,Ci=2,Nn=class e{startTime;_maxSize;_recordMinMax;_sum;_count;_zeroCount;_min;_max;_positive;_negative;_mapping;constructor(t,r=ep,n=!0,o=0,i=0,s=0,a=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,u=new sr,p=new sr,_=yi(tp)){this.startTime=t,this._maxSize=r,this._recordMinMax=n,this._sum=o,this._count=i,this._zeroCount=s,this._min=a,this._max=c,this._positive=u,this._negative=p,this._mapping=_,this._maxSize<Ci&&(l.warn(`Exponential Histogram Max Size set to ${this._maxSize}, changing to the minimum size of: ${Ci}`),this._maxSize=Ci)}record(t){this.updateByIncrement(t,1)}setStartTime(t){this.startTime=t}toPointValue(){return{hasMinMax:this._recordMinMax,min:this.min,max:this.max,sum:this.sum,positive:{offset:this.positive.offset,bucketCounts:this.positive.counts()},negative:{offset:this.negative.offset,bucketCounts:this.negative.counts()},count:this.count,scale:this.scale,zeroCount:this.zeroCount}}get sum(){return this._sum}get min(){return this._min}get max(){return this._max}get count(){return this._count}get zeroCount(){return this._zeroCount}get scale(){return this._count===this._zeroCount?0:this._mapping.scale}get positive(){return this._positive}get negative(){return this._negative}updateByIncrement(t,r){if(!Number.isNaN(t)){if(t>this._max&&(this._max=t),t<this._min&&(this._min=t),this._count+=r,t===0){this._zeroCount+=r;return}this._sum+=t*r,t>0?this._updateBuckets(this._positive,t,r):this._updateBuckets(this._negative,-t,r)}}merge(t){this._count===0?(this._min=t.min,this._max=t.max):t.count!==0&&(t.min<this.min&&(this._min=t.min),t.max>this.max&&(this._max=t.max)),this.startTime=t.startTime,this._sum+=t.sum,this._count+=t.count,this._zeroCount+=t.zeroCount;let r=this._minScale(t);this._downscale(this.scale-r),this._mergeBuckets(this.positive,t,t.positive,r),this._mergeBuckets(this.negative,t,t.negative,r)}diff(t){this._min=1/0,this._max=-1/0,this._sum-=t.sum,this._count-=t.count,this._zeroCount-=t.zeroCount;let r=this._minScale(t);this._downscale(this.scale-r),this._diffBuckets(this.positive,t,t.positive,r),this._diffBuckets(this.negative,t,t.negative,r)}clone(){return new e(this.startTime,this._maxSize,this._recordMinMax,this._sum,this._count,this._zeroCount,this._min,this._max,this.positive.clone(),this.negative.clone(),this._mapping)}_updateBuckets(t,r,n){let o=this._mapping.mapToIndex(r),i=!1,s=0,a=0;if(t.length===0?(t.indexStart=o,t.indexEnd=t.indexStart,t.indexBase=t.indexStart):o<t.indexStart&&t.indexEnd-o>=this._maxSize?(i=!0,a=o,s=t.indexEnd):o>t.indexEnd&&o-t.indexStart>=this._maxSize&&(i=!0,a=t.indexStart,s=o),i){let c=this._changeScale(s,a);this._downscale(c),o=this._mapping.mapToIndex(r)}this._incrementIndexBy(t,o,n)}_incrementIndexBy(t,r,n){if(n===0)return;if(t.length===0&&(t.indexStart=t.indexEnd=t.indexBase=r),r<t.indexStart){let i=t.indexEnd-r;i>=t.backing.length&&this._grow(t,i+1),t.indexStart=r}else if(r>t.indexEnd){let i=r-t.indexStart;i>=t.backing.length&&this._grow(t,i+1),t.indexEnd=r}let o=r-t.indexBase;o<0&&(o+=t.backing.length),t.incrementBucket(o,n)}_grow(t,r){let n=t.backing.length,o=t.indexBase-t.indexStart,i=n-o,s=ya(r);s>this._maxSize&&(s=this._maxSize);let a=s-o;t.backing.growTo(s,i,a)}_changeScale(t,r){let n=0;for(;t-r>=this._maxSize;)t>>=1,r>>=1,n++;return n}_downscale(t){if(t===0)return;if(t<0)throw new Error(`impossible change of scale: ${this.scale}`);let r=this._mapping.scale-t;this._positive.downscale(t),this._negative.downscale(t),this._mapping=yi(r)}_minScale(t){let r=Math.min(this.scale,t.scale),n=pe.combine(this._highLowAtScale(this.positive,this.scale,r),this._highLowAtScale(t.positive,t.scale,r)),o=pe.combine(this._highLowAtScale(this.negative,this.scale,r),this._highLowAtScale(t.negative,t.scale,r));return Math.min(r-this._changeScale(n.high,n.low),r-this._changeScale(o.high,o.low))}_highLowAtScale(t,r,n){if(t.length===0)return new pe(0,-1);let o=r-n;return new pe(t.indexStart>>o,t.indexEnd>>o)}_mergeBuckets(t,r,n,o){let i=n.offset,s=r.scale-o;for(let a=0;a<n.length;a++)this._incrementIndexBy(t,i+a>>s,n.at(a))}_diffBuckets(t,r,n,o){let i=n.offset,s=r.scale-o;for(let a=0;a<n.length;a++){let u=(i+a>>s)-t.indexBase;u<0&&(u+=t.backing.length),t.decrementBucket(u,n.at(a))}t.trim()}},ur=class{kind=Z.EXPONENTIAL_HISTOGRAM;_maxSize;_recordMinMax;constructor(t,r){this._maxSize=t,this._recordMinMax=r}createAccumulation(t){return new Nn(t,this._maxSize,this._recordMinMax)}merge(t,r){let n=r.clone();return n.merge(t),n}diff(t,r){let n=r.clone();return n.diff(t),n}toMetricData(t,r,n,o){return{descriptor:t,aggregationTemporality:r,dataPointType:H.EXPONENTIAL_HISTOGRAM,dataPoints:n.map(([i,s])=>{let a=s.toPointValue(),c=t.type===T.GAUGE||t.type===T.UP_DOWN_COUNTER||t.type===T.OBSERVABLE_GAUGE||t.type===T.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:i,startTime:s.startTime,endTime:o,value:{min:a.hasMinMax?a.min:void 0,max:a.hasMinMax?a.max:void 0,sum:c?void 0:a.sum,positive:{offset:a.positive.offset,bucketCounts:a.positive.bucketCounts},negative:{offset:a.negative.offset,bucketCounts:a.negative.bucketCounts},count:a.count,scale:a.scale,zeroCount:a.zeroCount}}})}}};var me=class{startTime;_current;sampleTime;constructor(t,r=0,n=[0,0]){this.startTime=t,this._current=r,this.sampleTime=n}record(t){this._current=t,this.sampleTime=P(Date.now())}setStartTime(t){this.startTime=t}toPointValue(){return this._current}},lr=class{kind=Z.LAST_VALUE;createAccumulation(t){return new me(t)}merge(t,r){let n=ae(r.sampleTime)>=ae(t.sampleTime)?r:t;return new me(t.startTime,n.toPointValue(),n.sampleTime)}diff(t,r){let n=ae(r.sampleTime)>=ae(t.sampleTime)?r:t;return new me(r.startTime,n.toPointValue(),n.sampleTime)}toMetricData(t,r,n,o){return{descriptor:t,aggregationTemporality:r,dataPointType:H.GAUGE,dataPoints:n.map(([i,s])=>({attributes:i,startTime:s.startTime,endTime:o,value:s.toPointValue()}))}}};var Dt=class{startTime;monotonic;_current;reset;constructor(t,r,n=0,o=!1){this.startTime=t,this.monotonic=r,this._current=n,this.reset=o}record(t){this.monotonic&&t<0||(this._current+=t)}setStartTime(t){this.startTime=t}toPointValue(){return this._current}},_e=class{kind=Z.SUM;monotonic;constructor(t){this.monotonic=t}createAccumulation(t){return new Dt(t,this.monotonic)}merge(t,r){let n=t.toPointValue(),o=r.toPointValue();return r.reset?new Dt(r.startTime,this.monotonic,o,r.reset):new Dt(t.startTime,this.monotonic,n+o)}diff(t,r){let n=t.toPointValue(),o=r.toPointValue();return this.monotonic&&n>o?new Dt(r.startTime,this.monotonic,o,!0):new Dt(r.startTime,this.monotonic,o-n)}toMetricData(t,r,n,o){return{descriptor:t,aggregationTemporality:r,dataPointType:H.SUM,dataPoints:n.map(([i,s])=>({attributes:i,startTime:s.startTime,endTime:o,value:s.toPointValue()})),isMonotonic:this.monotonic}}};var Pi=class e{static DEFAULT_INSTANCE=new ir;createAggregator(t){return e.DEFAULT_INSTANCE}};var Ii=class e{static MONOTONIC_INSTANCE=new _e(!0);static NON_MONOTONIC_INSTANCE=new _e(!1);createAggregator(t){switch(t.type){case T.COUNTER:case T.OBSERVABLE_COUNTER:case T.HISTOGRAM:return e.MONOTONIC_INSTANCE;default:return e.NON_MONOTONIC_INSTANCE}}};var Mi=class e{static DEFAULT_INSTANCE=new lr;createAggregator(t){return e.DEFAULT_INSTANCE}};var vi=class e{static DEFAULT_INSTANCE=new le([0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],!0);createAggregator(t){return e.DEFAULT_INSTANCE}};var pr=class{_boundaries;_recordMinMax;constructor(t,r=!0){if(t==null)throw new Error("ExplicitBucketHistogramAggregation should be created with explicit boundaries, if a single bucket histogram is required, please pass an empty array");t=t.concat(),t=t.sort((i,s)=>i-s);let n=t.lastIndexOf(-1/0),o=t.indexOf(1/0);o===-1&&(o=void 0),this._boundaries=t.slice(n+1,o),this._recordMinMax=r}createAggregator(t){return new le(this._boundaries,this._recordMinMax)}},mr=class{_maxSize;_recordMinMax;constructor(t=160,r=!0){this._maxSize=t,this._recordMinMax=r}createAggregator(t){return new ur(this._maxSize,this._recordMinMax)}},Di=class{_resolve(t){switch(t.type){case T.COUNTER:case T.UP_DOWN_COUNTER:case T.OBSERVABLE_COUNTER:case T.OBSERVABLE_UP_DOWN_COUNTER:return Bi;case T.GAUGE:case T.OBSERVABLE_GAUGE:return Gi;case T.HISTOGRAM:return t.advice.explicitBucketBoundaries?new pr(t.advice.explicitBucketBoundaries):Hi}return l.warn(`Unable to recognize instrument type: ${t.type}`),Ui}createAggregator(t){return this._resolve(t).createAggregator(t)}},Ui=new Pi,Bi=new Ii,Gi=new Mi,Hi=new vi,CT=new mr,Ma=new Di;var k;(function(e){e[e.DEFAULT=0]="DEFAULT",e[e.DROP=1]="DROP",e[e.SUM=2]="SUM",e[e.LAST_VALUE=3]="LAST_VALUE",e[e.EXPLICIT_BUCKET_HISTOGRAM=4]="EXPLICIT_BUCKET_HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=5]="EXPONENTIAL_HISTOGRAM"})(k||(k={}));function yn(e){switch(e.type){case k.DEFAULT:return Ma;case k.DROP:return Ui;case k.SUM:return Bi;case k.LAST_VALUE:return Gi;case k.EXPONENTIAL_HISTOGRAM:{let t=e;return new mr(t.options?.maxSize,t.options?.recordMinMax)}case k.EXPLICIT_BUCKET_HISTOGRAM:{let t=e;return t.options==null?Hi:new pr(t.options?.boundaries,t.options?.recordMinMax)}default:throw new Error("Unsupported Aggregation")}}var va=e=>({type:k.DEFAULT}),Da=e=>G.CUMULATIVE;var Cn=class{_shutdown=!1;_metricProducers;_sdkMetricProducer;_aggregationTemporalitySelector;_aggregationSelector;_cardinalitySelector;constructor(t){this._aggregationSelector=t?.aggregationSelector??va,this._aggregationTemporalitySelector=t?.aggregationTemporalitySelector??Da,this._metricProducers=t?.metricProducers??[],this._cardinalitySelector=t?.cardinalitySelector}setMetricProducer(t){if(this._sdkMetricProducer)throw new Error("MetricReader can not be bound to a MeterProvider again.");this._sdkMetricProducer=t,this.onInitialized()}selectAggregation(t){return this._aggregationSelector(t)}selectAggregationTemporality(t){return this._aggregationTemporalitySelector(t)}selectCardinalityLimit(t){return this._cardinalitySelector?this._cardinalitySelector(t):2e3}onInitialized(){}async collect(t){if(this._sdkMetricProducer===void 0)throw new Error("MetricReader is not bound to a MetricProducer");if(this._shutdown)throw new Error("MetricReader is shutdown");let[r,...n]=await Promise.all([this._sdkMetricProducer.collect({timeoutMillis:t?.timeoutMillis}),...this._metricProducers.map(a=>a.collect({timeoutMillis:t?.timeoutMillis}))]),o=r.errors.concat(n.flatMap(a=>a.errors)),i=r.resourceMetrics.resource,s=r.resourceMetrics.scopeMetrics.concat(n.flatMap(a=>a.resourceMetrics.scopeMetrics));return{resourceMetrics:{resource:i,scopeMetrics:s},errors:o}}async shutdown(t){if(this._shutdown){l.error("Cannot call shutdown twice.");return}t?.timeoutMillis==null?await this.onShutdown():await vt(this.onShutdown(),t.timeoutMillis),this._shutdown=!0}async forceFlush(t){if(this._shutdown){l.warn("Cannot forceFlush on already shutdown MetricReader.");return}if(t?.timeoutMillis==null){await this.onForceFlush();return}await vt(this.onForceFlush(),t.timeoutMillis)}};var _r=class extends Cn{_interval;_exporter;_exportInterval;_exportTimeout;constructor(t){let{exporter:r,exportIntervalMillis:n=6e4,metricProducers:o,cardinalityLimits:i}=t,{exportTimeoutMillis:s=3e4}=t;if(super({aggregationSelector:r.selectAggregation?.bind(r),aggregationTemporalitySelector:r.selectAggregationTemporality?.bind(r),metricProducers:o,cardinalitySelector:a=>{let c={default:2e3,...i};switch(a){case T.COUNTER:return c.counter??c.default;case T.GAUGE:return c.gauge??c.default;case T.HISTOGRAM:return c.histogram??c.default;case T.OBSERVABLE_COUNTER:return c.observableCounter??c.default;case T.OBSERVABLE_UP_DOWN_COUNTER:return c.observableUpDownCounter??c.default;case T.OBSERVABLE_GAUGE:return c.observableGauge??c.default;case T.UP_DOWN_COUNTER:return c.upDownCounter??c.default;default:return c.default}}}),n<=0)throw Error("exportIntervalMillis must be greater than 0");if(s<=0)throw Error("exportTimeoutMillis must be greater than 0");if(n<s){if("exportIntervalMillis"in t&&"exportTimeoutMillis"in t)throw Error("exportIntervalMillis must be greater than or equal to exportTimeoutMillis");l.info(`Timeout of ${s} exceeds the interval of ${n}. Clamping timeout to interval duration.`),s=n}this._exportInterval=n,this._exportTimeout=s,this._exporter=r}async _runOnce(){try{await vt(this._doRun(),this._exportTimeout)}catch(t){if(t instanceof or){l.error("Export took longer than %s milliseconds and timed out.",this._exportTimeout);return}C(t)}}async _doRun(){let{resourceMetrics:t,errors:r}=await this.collect({timeoutMillis:this._exportTimeout});if(r.length>0&&l.error("PeriodicExportingMetricReader: metrics collection errors",...r),t.resource.asyncAttributesPending)try{await t.resource.waitForAsyncAttributes?.()}catch(o){l.debug("Error while resolving async portion of resource: ",o),C(o)}if(t.scopeMetrics.length===0)return;let n=await Sa._export(this._exporter,t);if(n.code!==U.SUCCESS)throw new Error(`PeriodicExportingMetricReader: metrics export failed (error ${n.error})`)}onInitialized(){this._interval=setInterval(()=>{this._runOnce()},this._exportInterval),typeof this._interval!="number"&&this._interval.unref()}async onForceFlush(){await this._runOnce(),await this._exporter.forceFlush()}async onShutdown(){this._interval&&clearInterval(this._interval),await this.onForceFlush(),await this._exporter.shutdown()}};var Pn;function Ua(){if(Pn===void 0)try{let e=globalThis.process.argv0;Pn=e?`unknown_service:${e}`:"unknown_service"}catch{Pn="unknown_service"}return Pn}var de=e=>e!==null&&typeof e=="object"&&typeof e.then=="function";var Vi=class e{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(t,r){let n=new e({},r);return n._rawAttributes=Ba(t),n._asyncAttributesPending=t.filter(([o,i])=>de(i)).length>0,n}constructor(t,r){let n=t.attributes??{};this._rawAttributes=Object.entries(n).map(([o,i])=>(de(i)&&(this._asyncAttributesPending=!0),[o,i])),this._rawAttributes=Ba(this._rawAttributes),this._schemaUrl=rp(r?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let t=0;t<this._rawAttributes.length;t++){let[r,n]=this._rawAttributes[t];this._rawAttributes[t]=[r,de(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&l.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;let t={};for(let[r,n]of this._rawAttributes){if(de(n)){l.debug(`Unsettled resource attribute ${r} skipped`);continue}n!=null&&(t[r]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=t),t}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let r=np(this,t),n=r?{schemaUrl:r}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],n)}};function In(e,t){return Vi.FromAttributeList(Object.entries(e),t)}function Xt(){return In({[ra]:Ua(),[qe]:Mt[qe],[Qe]:Mt[Qe],[Je]:Mt[Je]})}function Ba(e){return e.map(([t,r])=>de(r)?[t,r.catch(n=>{l.debug("promise rejection for resource attribute: %s - %s",t,n)})]:[t,r])}function rp(e){if(typeof e=="string"||e===void 0)return e;l.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",e)}function np(e,t){let r=e?.schemaUrl,n=t?.schemaUrl,o=r===void 0||r==="",i=n===void 0||n==="";if(o)return n;if(i||r===n)return r;l.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',r,n)}var Mn=class{_registeredViews=[];addView(t){this._registeredViews.push(t)}findViews(t,r){return this._registeredViews.filter(o=>this._matchInstrument(o.instrumentSelector,t)&&this._matchMeter(o.meterSelector,r))}_matchInstrument(t,r){return(t.getType()===void 0||r.type===t.getType())&&t.getNameFilter().match(r.name)&&t.getUnitFilter().match(r.unit)}_matchMeter(t,r){return t.getNameFilter().match(r.name)&&(r.version===void 0||t.getVersionFilter().match(r.version))&&(r.schemaUrl===void 0||t.getSchemaUrlFilter().match(r.schemaUrl))}};function lt(e,t,r){return ip(e)||l.warn(`Invalid metric name: "${e}". The metric name should be a ASCII string with a length no greater than 255 characters.`),{name:e,type:t,description:r?.description??"",unit:r?.unit??"",valueType:r?.valueType??K.DOUBLE,advice:r?.advice??{}}}function Ga(e,t){return{name:e.name??t.name,description:e.description??t.description,type:t.type,unit:t.unit,valueType:t.valueType,advice:t.advice}}function Ha(e,t){return La(e.name,t.name)&&e.unit===t.unit&&e.type===t.type&&e.valueType===t.valueType}var op=/^[a-z][a-z0-9_.\-/]{0,254}$/i;function ip(e){return op.test(e)}var he=class{_writableMetricStorage;_descriptor;constructor(t,r){this._writableMetricStorage=t,this._descriptor=r}_record(t,r={},n=E.active()){if(typeof t!="number"){l.warn(`non-number value provided to metric ${this._descriptor.name}: ${t}`);return}this._descriptor.valueType===K.INT&&!Number.isInteger(t)&&(l.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||this._writableMetricStorage.record(t,r,n,P(Date.now()))}},vn=class extends he{add(t,r,n){this._record(t,r,n)}},Dn=class extends he{add(t,r,n){if(t<0){l.warn(`negative value provided to counter ${this._descriptor.name}: ${t}`);return}this._record(t,r,n)}},Un=class extends he{record(t,r,n){this._record(t,r,n)}},Bn=class extends he{record(t,r,n){if(t<0){l.warn(`negative value provided to histogram ${this._descriptor.name}: ${t}`);return}this._record(t,r,n)}},fe=class{_metricStorages;_descriptor;_observableRegistry;constructor(t,r,n){this._descriptor=t,this._metricStorages=r,this._observableRegistry=n}addCallback(t){this._observableRegistry.addCallback(t,this)}removeCallback(t){this._observableRegistry.removeCallback(t,this)}},Gn=class extends fe{},Hn=class extends fe{},Vn=class extends fe{};function dr(e){return e instanceof fe}var kn=class{_meterSharedState;constructor(t){this._meterSharedState=t}createGauge(t,r){let n=lt(t,T.GAUGE,r),o=this._meterSharedState.registerMetricStorage(n);return new Un(o,n)}createHistogram(t,r){let n=lt(t,T.HISTOGRAM,r),o=this._meterSharedState.registerMetricStorage(n);return new Bn(o,n)}createCounter(t,r){let n=lt(t,T.COUNTER,r),o=this._meterSharedState.registerMetricStorage(n);return new Dn(o,n)}createUpDownCounter(t,r){let n=lt(t,T.UP_DOWN_COUNTER,r),o=this._meterSharedState.registerMetricStorage(n);return new vn(o,n)}createObservableGauge(t,r){let n=lt(t,T.OBSERVABLE_GAUGE,r),o=this._meterSharedState.registerAsyncMetricStorage(n);return new Hn(n,o,this._meterSharedState.observableRegistry)}createObservableCounter(t,r){let n=lt(t,T.OBSERVABLE_COUNTER,r),o=this._meterSharedState.registerAsyncMetricStorage(n);return new Gn(n,o,this._meterSharedState.observableRegistry)}createObservableUpDownCounter(t,r){let n=lt(t,T.OBSERVABLE_UP_DOWN_COUNTER,r),o=this._meterSharedState.registerAsyncMetricStorage(n);return new Vn(n,o,this._meterSharedState.observableRegistry)}addBatchObservableCallback(t,r){this._meterSharedState.observableRegistry.addBatchCallback(t,r)}removeBatchObservableCallback(t,r){this._meterSharedState.observableRegistry.removeBatchCallback(t,r)}};var Te=class{_instrumentDescriptor;constructor(t){this._instrumentDescriptor=t}getInstrumentDescriptor(){return this._instrumentDescriptor}updateDescription(t){this._instrumentDescriptor=lt(this._instrumentDescriptor.name,this._instrumentDescriptor.type,{description:t,valueType:this._instrumentDescriptor.valueType,unit:this._instrumentDescriptor.unit,advice:this._instrumentDescriptor.advice})}};var ki=class{_valueMap=new Map;_keyMap=new Map;_hash;constructor(t){this._hash=t}get(t,r){return r??=this._hash(t),this._valueMap.get(r)}getOrDefault(t,r){let n=this._hash(t);if(this._valueMap.has(n))return this._valueMap.get(n);let o=r();return this._keyMap.has(n)||this._keyMap.set(n,t),this._valueMap.set(n,o),o}set(t,r,n){n??=this._hash(t),this._keyMap.has(n)||this._keyMap.set(n,t),this._valueMap.set(n,r)}has(t,r){return r??=this._hash(t),this._valueMap.has(r)}*keys(){let t=this._keyMap.entries(),r=t.next();for(;r.done!==!0;)yield[r.value[1],r.value[0]],r=t.next()}*entries(){let t=this._valueMap.entries(),r=t.next();for(;r.done!==!0;)yield[this._keyMap.get(r.value[0]),r.value[1],r.value[0]],r=t.next()}get size(){return this._valueMap.size}},q=class extends ki{constructor(){super(xn)}};var ge=class{_activeCollectionStorage=new q;_cumulativeMemoStorage=new q;_cardinalityLimit;_overflowAttributes={"otel.metric.overflow":!0};_overflowHashCode;_aggregator;constructor(t,r){this._aggregator=t,this._cardinalityLimit=(r??2e3)-1,this._overflowHashCode=xn(this._overflowAttributes)}record(t,r,n,o){let i=this._activeCollectionStorage.get(r);if(!i){if(this._activeCollectionStorage.size>=this._cardinalityLimit){this._activeCollectionStorage.getOrDefault(this._overflowAttributes,()=>this._aggregator.createAccumulation(o))?.record(t);return}i=this._aggregator.createAccumulation(o),this._activeCollectionStorage.set(r,i)}i?.record(t)}batchCumulate(t,r){Array.from(t.entries()).forEach(([n,o,i])=>{let s=this._aggregator.createAccumulation(r);s?.record(o);let a=s;if(this._cumulativeMemoStorage.has(n,i)){let c=this._cumulativeMemoStorage.get(n,i);a=this._aggregator.diff(c,s)}else if(this._cumulativeMemoStorage.size>=this._cardinalityLimit&&(n=this._overflowAttributes,i=this._overflowHashCode,this._cumulativeMemoStorage.has(n,i))){let c=this._cumulativeMemoStorage.get(n,i);a=this._aggregator.diff(c,s)}if(this._activeCollectionStorage.has(n,i)){let c=this._activeCollectionStorage.get(n,i);a=this._aggregator.merge(c,a)}this._cumulativeMemoStorage.set(n,s,i),this._activeCollectionStorage.set(n,a,i)})}collect(){let t=this._activeCollectionStorage;return this._activeCollectionStorage=new q,t}};var Ee=class e{_aggregator;_unreportedAccumulations=new Map;_reportHistory=new Map;constructor(t,r){this._aggregator=t,r.forEach(n=>{this._unreportedAccumulations.set(n,[])})}buildMetrics(t,r,n,o){this._stashAccumulations(n);let i=this._getMergedUnreportedAccumulations(t),s=i,a;if(this._reportHistory.has(t)){let u=this._reportHistory.get(t),p=u.collectionTime;a=u.aggregationTemporality,a===G.CUMULATIVE?s=e.merge(u.accumulations,i,this._aggregator):s=e.calibrateStartTime(u.accumulations,i,p)}else a=t.selectAggregationTemporality(r.type);this._reportHistory.set(t,{accumulations:s,collectionTime:o,aggregationTemporality:a});let c=sp(s);if(c.length!==0)return this._aggregator.toMetricData(r,a,c,o)}_stashAccumulations(t){let r=this._unreportedAccumulations.keys();for(let n of r){let o=this._unreportedAccumulations.get(n);o===void 0&&(o=[],this._unreportedAccumulations.set(n,o)),o.push(t)}}_getMergedUnreportedAccumulations(t){let r=new q,n=this._unreportedAccumulations.get(t);if(this._unreportedAccumulations.set(t,[]),n===void 0)return r;for(let o of n)r=e.merge(r,o,this._aggregator);return r}static merge(t,r,n){let o=t,i=r.entries(),s=i.next();for(;s.done!==!0;){let[a,c,u]=s.value;if(t.has(a,u)){let p=t.get(a,u),_=n.merge(p,c);o.set(a,_,u)}else o.set(a,c,u);s=i.next()}return o}static calibrateStartTime(t,r,n){for(let[o,i]of t.keys())r.get(o,i)?.setStartTime(n);return r}};function sp(e){return Array.from(e.entries())}var Fn=class extends Te{_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;_attributesProcessor;constructor(t,r,n,o,i){super(t),this._aggregationCardinalityLimit=i,this._deltaMetricStorage=new ge(r,this._aggregationCardinalityLimit),this._temporalMetricStorage=new Ee(r,o),this._attributesProcessor=n}record(t,r){let n=new q;Array.from(t.entries()).forEach(([o,i])=>{n.set(this._attributesProcessor.process(o),i)}),this._deltaMetricStorage.batchCumulate(n,r)}collect(t,r){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(t,this._instrumentDescriptor,n,r)}};function Fi(e,t){let r="";return e.unit!==t.unit&&(r+=` - Unit '${e.unit}' does not match '${t.unit}'
|
|
1
|
+
(()=>{var At="1.9.1";var sa=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function Fl(e){let t=new Set([e]),r=new Set,n=e.match(sa);if(!n)return()=>!1;let o={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(o.prerelease!=null)return function(c){return c===e};function i(a){return r.add(a),!1}function s(a){return t.add(a),!0}return function(c){if(t.has(c))return!0;if(r.has(c))return!1;let u=c.match(sa);if(!u)return i(c);let p={major:+u[1],minor:+u[2],patch:+u[3],prerelease:u[4]};return p.prerelease!=null||o.major!==p.major?i(c):o.major===0?o.minor===p.minor&&o.patch<=p.patch?s(c):i(c):o.minor<=p.minor?s(c):i(c)}}var aa=Fl(At);var zl=At.split(".")[0],$e=Symbol.for(`opentelemetry.js.api.${zl}`),We=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{};function st(e,t,r,n=!1){var o;let i=We[$e]=(o=We[$e])!==null&&o!==void 0?o:{version:At};if(!n&&i[e]){let s=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return r.error(s.stack||s.message),!1}if(i.version!==At){let s=new Error(`@opentelemetry/api: Registration of version v${i.version} for ${e} does not match previously registered API v${At}`);return r.error(s.stack||s.message),!1}return i[e]=t,r.debug(`@opentelemetry/api: Registered a global for ${e} v${At}.`),!0}function j(e){var t,r;let n=(t=We[$e])===null||t===void 0?void 0:t.version;if(!(!n||!aa(n)))return(r=We[$e])===null||r===void 0?void 0:r[e]}function at(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${At}.`);let r=We[$e];r&&delete r[e]}var on=class{constructor(t){this._namespace=t.namespace||"DiagComponentLogger"}debug(...t){return je("debug",this._namespace,t)}error(...t){return je("error",this._namespace,t)}info(...t){return je("info",this._namespace,t)}warn(...t){return je("warn",this._namespace,t)}verbose(...t){return je("verbose",this._namespace,t)}};function je(e,t,r){let n=j("diag");if(n)return n[e](t,...r)}var O;(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"})(O||(O={}));function ca(e,t){e<O.NONE?e=O.NONE:e>O.ALL&&(e=O.ALL),t=t||{};function r(n,o){let i=t[n];return typeof i=="function"&&e>=o?i.bind(t):function(){}}return{error:r("error",O.ERROR),warn:r("warn",O.WARN),info:r("info",O.INFO),debug:r("debug",O.DEBUG),verbose:r("verbose",O.VERBOSE)}}var $l="diag",y=class e{static instance(){return this._instance||(this._instance=new e),this._instance}constructor(){function t(o){return function(...i){let s=j("diag");if(s)return s[o](...i)}}let r=this,n=(o,i={logLevel:O.INFO})=>{var s,a,c;if(o===r){let m=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((s=m.stack)!==null&&s!==void 0?s:m.message),!1}typeof i=="number"&&(i={logLevel:i});let u=j("diag"),p=ca((a=i.logLevel)!==null&&a!==void 0?a:O.INFO,o);if(u&&!i.suppressOverrideMessage){let m=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";u.warn(`Current logger will be overwritten from ${m}`),p.warn(`Current logger will overwrite one already registered from ${m}`)}return st("diag",p,r,!0)};r.setLogger=n,r.disable=()=>{at($l,r)},r.createComponentLogger=o=>new on(o),r.verbose=t("verbose"),r.debug=t("debug"),r.info=t("info"),r.warn=t("warn"),r.error=t("error")}};var sn=class e{constructor(t){this._entries=t?new Map(t):new Map}getEntry(t){let r=this._entries.get(t);if(r)return Object.assign({},r)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(t,r){let n=new e(this._entries);return n._entries.set(t,r),n}removeEntry(t){let r=new e(this._entries);return r._entries.delete(t),r}removeEntries(...t){let r=new e(this._entries);for(let n of t)r._entries.delete(n);return r}clear(){return new e}};var ua=Symbol("BaggageEntryMetadata");var Wl=y.instance();function la(e={}){return new sn(new Map(Object.entries(e)))}function fi(e){return typeof e!="string"&&(Wl.error(`Cannot create baggage metadata from unknown type: ${typeof e}`),e=""),{__TYPE__:ua,toString(){return e}}}function Wt(e){return Symbol.for(e)}var Ti=class e{constructor(t){let r=this;r._currentContext=t?new Map(t):new Map,r.getValue=n=>r._currentContext.get(n),r.setValue=(n,o)=>{let i=new e(r._currentContext);return i._currentContext.set(n,o),i},r.deleteValue=n=>{let o=new e(r._currentContext);return o._currentContext.delete(n),o}}},B=new Ti;var gi=class{constructor(){}createGauge(t,r){return Kl}createHistogram(t,r){return Xl}createCounter(t,r){return jl}createUpDownCounter(t,r){return Yl}createObservableGauge(t,r){return Ql}createObservableCounter(t,r){return ql}createObservableUpDownCounter(t,r){return Jl}addBatchObservableCallback(t,r){}removeBatchObservableCallback(t){}},oe=class{},Ei=class extends oe{add(t,r){}},Ai=class extends oe{add(t,r){}},Si=class extends oe{record(t,r){}},Ri=class extends oe{record(t,r){}},Ke=class{addCallback(t){}removeCallback(t){}},xi=class extends Ke{},Oi=class extends Ke{},Li=class extends Ke{},bi=new gi,jl=new Ei,Kl=new Si,Xl=new Ri,Yl=new Ai,ql=new xi,Ql=new Oi,Jl=new Li;function St(){return bi}var K;(function(e){e[e.INT=0]="INT",e[e.DOUBLE=1]="DOUBLE"})(K||(K={}));var pa={get(e,t){if(e!=null)return e[t]},keys(e){return e==null?[]:Object.keys(e)}},_a={set(e,t,r){e!=null&&(e[t]=r)}};var an=class{active(){return B}with(t,r,n,...o){return r.call(n,...o)}bind(t,r){return r}enable(){return this}disable(){return this}};var wi="context",Zl=new an,ct=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalContextManager(t){return st(wi,t,y.instance())}active(){return this._getContextManager().active()}with(t,r,n,...o){return this._getContextManager().with(t,r,n,...o)}bind(t,r){return this._getContextManager().bind(t,r)}_getContextManager(){return j(wi)||Zl}disable(){this._getContextManager().disable(),at(wi,y.instance())}};var C;(function(e){e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"})(C||(C={}));var cn="0000000000000000",un="00000000000000000000000000000000",Xe={traceId:un,spanId:cn,traceFlags:C.NONE};var ut=class{constructor(t=Xe){this._spanContext=t}spanContext(){return this._spanContext}setAttribute(t,r){return this}setAttributes(t){return this}addEvent(t,r){return this}addLink(t){return this}addLinks(t){return this}setStatus(t){return this}updateName(t){return this}end(t){}isRecording(){return!1}recordException(t,r){}};var Ni=Wt("OpenTelemetry Context Key SPAN");function ln(e){return e.getValue(Ni)||void 0}function ma(){return ln(ct.getInstance().active())}function Ye(e,t){return e.setValue(Ni,t)}function da(e){return e.deleteValue(Ni)}function ha(e,t){return Ye(e,new ut(t))}function pn(e){var t;return(t=ln(e))===null||t===void 0?void 0:t.spanContext()}var _n=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 fa(e,t){if(typeof e!="string"||e.length!==t)return!1;let r=0;for(let n=0;n<e.length;n+=4)r+=(_n[e.charCodeAt(n)]|0)+(_n[e.charCodeAt(n+1)]|0)+(_n[e.charCodeAt(n+2)]|0)+(_n[e.charCodeAt(n+3)]|0);return r===t}function mn(e){return fa(e,32)&&e!==un}function Ta(e){return fa(e,16)&&e!==cn}function X(e){return mn(e.traceId)&&Ta(e.spanId)}function ga(e){return new ut(e)}var yi=ct.getInstance(),ie=class{startSpan(t,r,n=yi.active()){if(!!r?.root)return new ut;let i=n&&pn(n);return tp(i)&&X(i)?new ut(i):new ut}startActiveSpan(t,r,n,o){let i,s,a;if(arguments.length<2)return;arguments.length===2?a=r:arguments.length===3?(i=r,a=n):(i=r,s=n,a=o);let c=s??yi.active(),u=this.startSpan(t,i,c),p=Ye(c,u);return yi.with(p,a,void 0,u)}};function tp(e){return e!==null&&typeof e=="object"&&"spanId"in e&&typeof e.spanId=="string"&&"traceId"in e&&typeof e.traceId=="string"&&"traceFlags"in e&&typeof e.traceFlags=="number"}var ep=new ie,dn=class{constructor(t,r,n,o){this._provider=t,this.name=r,this.version=n,this.options=o}startSpan(t,r,n){return this._getTracer().startSpan(t,r,n)}startActiveSpan(t,r,n,o){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let t=this._provider.getDelegateTracer(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):ep}};var hn=class{getTracer(t,r,n){return new ie}};var rp=new hn,qe=class{getTracer(t,r,n){var o;return(o=this.getDelegateTracer(t,r,n))!==null&&o!==void 0?o:new dn(this,t,r,n)}getDelegate(){var t;return(t=this._delegate)!==null&&t!==void 0?t:rp}setDelegate(t){this._delegate=t}getDelegateTracer(t,r,n){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getTracer(t,r,n)}};var se;(function(e){e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(se||(se={}));var Rt;(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"})(Rt||(Rt={}));var Y;(function(e){e[e.UNSET=0]="UNSET",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR"})(Y||(Y={}));var E=ct.getInstance();var l=y.instance();var Ci=class{getMeter(t,r,n){return bi}},Ea=new Ci;var Pi="metrics",fn=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalMeterProvider(t){return st(Pi,t,y.instance())}getMeterProvider(){return j(Pi)||Ea}getMeter(t,r,n){return this.getMeterProvider().getMeter(t,r,n)}disable(){at(Pi,y.instance())}};var xt=fn.getInstance();var Tn=class{inject(t,r){}extract(t,r){return t}fields(){return[]}};var Ii=Wt("OpenTelemetry Baggage Key");function Mi(e){return e.getValue(Ii)||void 0}function Aa(){return Mi(ct.getInstance().active())}function Sa(e,t){return e.setValue(Ii,t)}function Ra(e){return e.deleteValue(Ii)}var vi="propagation",np=new Tn,gn=class e{constructor(){this.createBaggage=la,this.getBaggage=Mi,this.getActiveBaggage=Aa,this.setBaggage=Sa,this.deleteBaggage=Ra}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalPropagator(t){return st(vi,t,y.instance())}inject(t,r,n=_a){return this._getGlobalPropagator().inject(t,r,n)}extract(t,r,n=pa){return this._getGlobalPropagator().extract(t,r,n)}fields(){return this._getGlobalPropagator().fields()}disable(){at(vi,y.instance())}_getGlobalPropagator(){return j(vi)||np}};var D=gn.getInstance();var Di="trace",En=class e{constructor(){this._proxyTracerProvider=new qe,this.wrapSpanContext=ga,this.isSpanContextValid=X,this.deleteSpan=da,this.getSpan=ln,this.getActiveSpan=ma,this.getSpanContext=pn,this.setSpan=Ye,this.setSpanContext=ha}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalTracerProvider(t){let r=st(Di,this._proxyTracerProvider,y.instance());return r&&this._proxyTracerProvider.setDelegate(t),r}getTracerProvider(){return j(Di)||this._proxyTracerProvider}getTracer(t,r){return this.getTracerProvider().getTracer(t,r)}disable(){at(Di,y.instance()),this._proxyTracerProvider=new qe}};var S=En.getInstance();var Lt;(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"})(Lt||(Lt={}));var Qe=class{emit(t){}enabled(){return!1}},Ui=new Qe;function Bi(){return Ui}var Je=Symbol.for("io.opentelemetry.js.api.logs"),ae=globalThis;function xa(e,t,r){return n=>n===e?t:r}var Gi=1;var Hi=class{getLogger(t,r,n){return new Qe}},An=new Hi;var Sn=class{constructor(t,r,n,o){this._provider=t,this.name=r,this.version=n,this.options=o}emit(t){this._getLogger().emit(t)}enabled(t){return this._getLogger().enabled(t)}_getLogger(){if(this._delegate)return this._delegate;let t=this._provider._getDelegateLogger(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):Ui}};var Ze=class{getLogger(t,r,n){var o;return(o=this._getDelegateLogger(t,r,n))!==null&&o!==void 0?o:new Sn(this,t,r,n)}_getDelegate(){var t;return(t=this._delegate)!==null&&t!==void 0?t:An}_setDelegate(t){this._delegate=t}_getDelegateLogger(t,r,n){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(t,r,n)}};var Rn=class e{constructor(){this._proxyLoggerProvider=new Ze}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(t){return ae[Je]?this.getLoggerProvider():(ae[Je]=xa(Gi,t,An),this._proxyLoggerProvider._setDelegate(t),t)}getLoggerProvider(){var t,r;return(r=(t=ae[Je])===null||t===void 0?void 0:t.call(ae,Gi))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(t,r,n){return this.getLoggerProvider().getLogger(t,r,n)}disable(){delete ae[Je],this._proxyLoggerProvider=new Ze}};var Dt=Rn.getInstance();var bt=class{_delegate;constructor(t){this._delegate=t}export(t,r){this._delegate.export(t,r)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}};var tr=class extends Error{code;name="OTLPExporterError";data;constructor(t,r,n){super(t),this.data=n,this.code=r}};function op(e){if(Number.isFinite(e)&&e>0)return e;throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function Oa(e){if(e!=null)return async()=>e}function La(e,t,r){return{timeoutMillis:op(e.timeoutMillis??t.timeoutMillis??r.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??r.concurrencyLimit,compression:e.compression??t.compression??r.compression}}function ba(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:"none"}}var Vi=class{_concurrencyLimit;_sendingPromises=[];constructor(t){this._concurrencyLimit=t}pushPromise(t){if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this._sendingPromises.push(t);let r=()=>{let n=this._sendingPromises.indexOf(t);this._sendingPromises.splice(n,1)};t.then(r,r)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}};function wa(e){return new Vi(e.concurrencyLimit)}var Na=Wt("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function jt(e){return e.setValue(Na,!0)}function Kt(e){return e.getValue(Na)===!0}var xn="baggage";function Pa(e){return e.reduce((t,r)=>{let n=`${t}${t!==""?",":""}${r}`;return n.length>8192?t:n},"")}function Ia(e){return e.getAllEntries().map(([t,r])=>{let n=`${encodeURIComponent(t)}=${encodeURIComponent(r.value)}`;return r.metadata!==void 0&&(n+=";"+r.metadata.toString()),n})}function cp(e){if(!e)return;let t=e.indexOf(";"),r=t===-1?e:e.substring(0,t),n=r.indexOf("=");if(n<=0)return;let o=r.substring(0,n).trim(),i=r.substring(n+1).trim();if(!o||!i)return;let s,a;try{s=decodeURIComponent(o),a=decodeURIComponent(i)}catch{return}let c;if(t!==-1&&t<e.length-1){let u=e.substring(t+1);c=fi(u)}return{key:s,value:a,metadata:c}}function ki(e,t,r,n){let o=0;for(;o<e.length&&r<180;){let i=e.indexOf(",",o),s=i===-1?e.length:i,a=s-o;if(a<=4096){let c=cp(e.substring(o,s));if(c){let u=(r===0?0:1)+a;if(n+u>8192)break;t[c.key]=c.metadata?{value:c.value,metadata:c.metadata}:{value:c.value},r++,n+=u}}if(i===-1)break;o=i+1}return[r,n]}var er=class{inject(t,r,n){let o=D.getBaggage(t);if(!o||Kt(t))return;let i=Ia(o).filter(a=>a.length<=4096).slice(0,180),s=Pa(i);s.length>0&&n.set(r,xn,s)}extract(t,r,n){let o=n.get(r,xn);if(!o)return t;let i={},s=0,a=0;if(Array.isArray(o))for(let c=0;c<o.length;c++)[s,a]=ki(o[c],i,s,a);else[s]=ki(o,i,s,a);return s===0?t:D.setBaggage(t,D.createBaggage(i))}fields(){return[xn]}};function Ut(e){let t={};if(typeof e!="object"||e==null)return t;for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;if(!up(r)){l.warn(`Invalid attribute key: ${r}`);continue}let n=e[r];if(!On(n)){l.warn(`Invalid attribute value set for key: ${r}`);continue}Array.isArray(n)?t[r]=n.slice():t[r]=n}return t}function up(e){return typeof e=="string"&&e!==""}function On(e){return e==null?!0:Array.isArray(e)?lp(e):Ma(typeof e)}function lp(e){let t;for(let r of e){if(r==null)continue;let n=typeof r;if(n!==t){if(!t){if(Ma(n)){t=n;continue}return!1}return!1}}return!0}function Ma(e){switch(e){case"number":case"boolean":case"string":return!0}return!1}function va(){return e=>{l.error(pp(e))}}function pp(e){return typeof e=="string"?e:JSON.stringify(_p(e))}function _p(e){let t={},r=e;for(;r!==null;)Object.getOwnPropertyNames(r).forEach(n=>{if(t[n])return;let o=r[n];o&&(t[n]=String(o))}),r=Object.getPrototypeOf(r);return t}var mp=va();function P(e){try{mp(e)}catch{}}var Da="2.8.0";var rr="error.type";var J="exception.message",Xt="exception.stacktrace",nt="exception.type";var Ln="http.request.method";var bn="http.request.method_original";var wn="http.response.status_code";var Nn="server.address",yn="server.port";var Ua="service.name";var nr="telemetry.sdk.language";var Ba="webjs",or="telemetry.sdk.name",ir="telemetry.sdk.version";var ot="url.full";var Ga="user_agent.original";var Ha="process.runtime.name";var Bt={[or]:"opentelemetry",[Ha]:"browser",[nr]:Ba,[ir]:Da};var N=performance;var dp=9,hp=6,fp=Math.pow(10,hp),sr=Math.pow(10,dp);function I(e){let t=e/1e3,r=Math.trunc(t),n=Math.round(e%1e3*fp);return[r,n]}function b(e){let t=I(N.timeOrigin),r=I(typeof e=="number"?e:N.now());return Pn(t,r)}function lt(e){if(cr(e))return e;if(typeof e=="number")return e<N.timeOrigin?b(e):I(e);if(e instanceof Date)return I(e.getTime());throw TypeError("Invalid input type")}function ar(e,t){let r=t[0]-e[0],n=t[1]-e[1];return n<0&&(r-=1,n+=sr),[r,n]}function Z(e){return e[0]*sr+e[1]}function ce(e){return e[0]*1e6+e[1]/1e3}function Fi(e){return e[0]+e[1]/sr}function cr(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="number"&&typeof e[1]=="number"}function Cn(e){return cr(e)||typeof e=="number"||e instanceof Date}function Pn(e,t){let r=[e[0]+t[0],e[1]+t[1]];return r[1]>=sr&&(r[1]-=sr,r[0]+=1),r}var U;(function(e){e[e.SUCCESS=0]="SUCCESS",e[e.FAILED=1]="FAILED"})(U||(U={}));var ur=class{_propagators;_fields;constructor(t={}){this._propagators=t.propagators??[];let r=new Set;for(let n of this._propagators){let o=typeof n.fields=="function"?n.fields():[];for(let i of o)r.add(i)}this._fields=Array.from(r)}inject(t,r,n){for(let o of this._propagators)try{o.inject(t,r,n)}catch(i){l.warn(`Failed to inject with ${o.constructor.name}. Err: ${i.message}`)}}extract(t,r,n){return this._propagators.reduce((o,i)=>{try{return i.extract(o,r,n)}catch(s){l.warn(`Failed to extract with ${i.constructor.name}. Err: ${s.message}`)}return o},t)}fields(){return this._fields.slice()}};var zi="[_0-9a-z-*/]",Tp=`[a-z]${zi}{0,255}`,gp=`[a-z0-9]${zi}{0,240}@[a-z]${zi}{0,13}`,Ep=new RegExp(`^(?:${Tp}|${gp})$`),Ap=/^[ -~]{0,255}[!-~]$/,Sp=/,|=/;function $i(e){return Ep.test(e)}function Wi(e){return Ap.test(e)&&!Sp.test(e)}var Rp=32,Va=512,ka=",",Fa="=",In=class e{_length;_rawTraceState;_internalState;constructor(t){this._rawTraceState=typeof t=="string"?t:"",this._length=this._rawTraceState.length}set(t,r){if(!$i(t)||!Wi(r))return this;let n=this._getState(),o=n.get(t),i=this._length;if(typeof o=="string"?i+=r.length-o.length:i+=t.length+r.length+(n.size>0?2:1),i>Va)return this;let s=new Map(n);return s.delete(t),s.set(t,r),this._fromState(s,i)}unset(t){let r=this._getState(),n=r.get(t);if(typeof n!="string")return this;let o=this._length-(t.length+n.length+1);r.size>1&&(o=o-1);let i=new Map(r);return i.delete(t),this._fromState(i,o)}get(t){return this._getState().get(t)}serialize(){let t="",r=0;for(let n of this._getState())r>0&&(t=ka+t),t=`${n[0]}${Fa}${n[1]}`+t,r++;return t}_getState(){if(this._internalState)return this._internalState;let t=this._rawTraceState.split(ka),r=new Map,n=0;for(let o of t){let i=o.trim(),s=i.indexOf(Fa);if(s===-1)continue;let a=i.slice(0,s),c=i.slice(s+1);if(!$i(a)||!Wi(c))continue;let u=n+i.length+(r.size>0?1:0);if(!(u>Va)&&(r.set(a,c),n=u,r.size>=Rp))break}return this._length=n,this._internalState=new Map(Array.from(r.entries()).reverse()),this._internalState}_fromState(t,r){let n=Object.create(e.prototype);return n._internalState=t,n._length=r,n}};var ue="traceparent",Mn="tracestate",xp="00",Op="(?!ff)[\\da-f]{2}",Lp="(?![0]{32})[\\da-f]{32}",bp="(?![0]{16})[\\da-f]{16}",wp="[\\da-f]{2}",Np=new RegExp(`^\\s?(${Op})-(${Lp})-(${bp})-(${wp})(-.*)?\\s?$`);function za(e){let t=Np.exec(e);return!t||t[1]==="00"&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var lr=class{inject(t,r,n){let o=S.getSpanContext(t);if(!o||Kt(t)||!X(o))return;let i=`${xp}-${o.traceId}-${o.spanId}-0${Number(o.traceFlags||C.NONE).toString(16)}`;n.set(r,ue,i),o.traceState&&n.set(r,Mn,o.traceState.serialize())}extract(t,r,n){let o=n.get(r,ue);if(!o)return t;let i=Array.isArray(o)?o[0]:o;if(typeof i!="string")return t;let s=za(i);if(!s)return t;s.isRemote=!0;let a=n.get(r,Mn);if(a){let c=Array.isArray(a)?a.join(","):a;s.traceState=new In(typeof c=="string"?c:void 0)}return S.setSpanContext(t,s)}fields(){return[ue,Mn]}};var yp="[object Object]",Cp="[object Null]",Pp="[object Undefined]",Ip=Function.prototype,$a=Ip.toString,Mp=$a.call(Object),vp=Object.getPrototypeOf,Wa=Object.prototype,ja=Wa.hasOwnProperty,Yt=Symbol?Symbol.toStringTag:void 0,Ka=Wa.toString;function ji(e){if(!Dp(e)||Up(e)!==yp)return!1;let t=vp(e);if(t===null)return!0;let r=ja.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&$a.call(r)===Mp}function Dp(e){return e!=null&&typeof e=="object"}function Up(e){return e==null?e===void 0?Pp:Cp:Yt&&Yt in Object(e)?Bp(e):Gp(e)}function Bp(e){let t=ja.call(e,Yt),r=e[Yt],n=!1;try{e[Yt]=void 0,n=!0}catch{}let o=Ka.call(e);return n&&(t?e[Yt]=r:delete e[Yt]),o}function Gp(e){return Ka.call(e)}var Hp=20;function Xi(...e){let t=e.shift(),r=new WeakMap;for(;e.length>0;)t=Ya(t,e.shift(),0,r);return t}function Ki(e){return Dn(e)?e.slice():e}function Ya(e,t,r=0,n){let o;if(!(r>Hp)){if(r++,vn(e)||vn(t)||qa(t))o=Ki(t);else if(Dn(e)){if(o=e.slice(),Dn(t))for(let i=0,s=t.length;i<s;i++)o.push(Ki(t[i]));else if(pr(t)){let i=Object.keys(t);for(let s=0,a=i.length;s<a;s++){let c=i[s];c==="__proto__"||c==="constructor"||c==="prototype"||(o[c]=Ki(t[c]))}}}else if(pr(e))if(pr(t)){if(!Vp(e,t))return t;o=Object.assign({},e);let i=Object.keys(t);for(let s=0,a=i.length;s<a;s++){let c=i[s];if(c==="__proto__"||c==="constructor"||c==="prototype")continue;let u=t[c];if(vn(u))typeof u>"u"?delete o[c]:o[c]=u;else{let p=o[c],m=u;if(Xa(e,c,n)||Xa(t,c,n))delete o[c];else{if(pr(p)&&pr(m)){let f=n.get(p)||[],_=n.get(m)||[];f.push({obj:e,key:c}),_.push({obj:t,key:c}),n.set(p,f),n.set(m,_)}o[c]=Ya(o[c],u,r,n)}}}}else o=t;return o}}function Xa(e,t,r){let n=r.get(e[t])||[];for(let o=0,i=n.length;o<i;o++){let s=n[o];if(s.key===t&&s.obj===e)return!0}return!1}function Dn(e){return Array.isArray(e)}function qa(e){return typeof e=="function"}function pr(e){return!vn(e)&&!Dn(e)&&!qa(e)&&typeof e=="object"}function vn(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e>"u"||e instanceof Date||e instanceof RegExp||e===null}function Vp(e,t){return!(!ji(e)||!ji(t))}var Un=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function Yi(e,t){let r,n=new Promise(function(i,s){r=setTimeout(function(){s(new Un("Operation timed out."))},t)});return Promise.race([e,n]).then(o=>(clearTimeout(r),o),o=>{throw clearTimeout(r),o})}function Bn(e,t){return typeof t=="string"?e===t:!!e.match(t)}function _r(e,t){if(!t)return!1;for(let r of t)if(Bn(e,r))return!0;return!1}var Gn=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((t,r)=>{this._resolve=t,this._reject=r})}get promise(){return this._promise}resolve(t){this._resolve(t)}reject(t){this._reject(t)}};var wt=class{_isCalled=!1;_deferred=new Gn;_callback;_that;constructor(t,r){this._callback=t,this._that=r}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...t){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...t)).then(r=>this._deferred.resolve(r),r=>this._deferred.reject(r))}catch(r){this._deferred.reject(r)}}return this._deferred.promise}};function Qa(e,t){return new Promise(r=>{E.with(jt(E.active()),()=>{e.export(t,r)})})}var Ja={_export:Qa};function zp(e){return Object.prototype.hasOwnProperty.call(e,"partialSuccess")}function Za(){return{handleResponse(e){e==null||!zp(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||l.warn("Received Partial Success response:",JSON.stringify(e.partialSuccess))}}}var qi=class{_diagLogger;_transport;_serializer;_responseHandler;_promiseQueue;_timeout;constructor(t,r,n,o,i){this._transport=t,this._serializer=r,this._responseHandler=n,this._promiseQueue=o,this._timeout=i,this._diagLogger=l.createComponentLogger({namespace:"OTLPExportDelegate"})}export(t,r){if(this._diagLogger.debug("items to be sent",t),this._promiseQueue.hasReachedLimit()){r({code:U.FAILED,error:new Error("Concurrent export limit reached")});return}let n=this._serializer.serializeRequest(t);if(n==null){r({code:U.FAILED,error:new Error("Nothing to send")});return}this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(o=>{if(o.status==="success"){if(o.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(o.data))}catch(i){this._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",i,o.data)}r({code:U.SUCCESS});return}else if(o.status==="failure"&&o.error){r({code:U.FAILED,error:o.error});return}else o.status==="retryable"?r({code:U.FAILED,error:o.error??new tr("Export failed with retryable status")}):r({code:U.FAILED,error:new tr("Export failed with unknown error")})},o=>r({code:U.FAILED,error:o})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug("shutdown started"),await this.forceFlush(),this._transport.shutdown()}};function tc(e,t){return new qi(e.transport,e.serializer,Za(),e.promiseHandler,t.timeout)}function ec(e,t,r){return tc({transport:r,serializer:t,promiseHandler:wa(e)},{timeout:e.timeoutMillis})}var G;(function(e){e[e.DELTA=0]="DELTA",e[e.CUMULATIVE=1]="CUMULATIVE"})(G||(G={}));var T;(function(e){e.COUNTER="COUNTER",e.GAUGE="GAUGE",e.HISTOGRAM="HISTOGRAM",e.UP_DOWN_COUNTER="UP_DOWN_COUNTER",e.OBSERVABLE_COUNTER="OBSERVABLE_COUNTER",e.OBSERVABLE_GAUGE="OBSERVABLE_GAUGE",e.OBSERVABLE_UP_DOWN_COUNTER="OBSERVABLE_UP_DOWN_COUNTER"})(T||(T={}));var H;(function(e){e[e.HISTOGRAM=0]="HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=1]="EXPONENTIAL_HISTOGRAM",e[e.GAUGE=2]="GAUGE",e[e.SUM=3]="SUM"})(H||(H={}));function Hn(e){let t=Object.keys(e);return t.length===0?"":(t=t.sort(),JSON.stringify(t.map(r=>[r,e[r]])))}function rc(e){return`${e.name}:${e.version??""}:${e.schemaUrl??""}`}var mr=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function Gt(e,t){let r,n=new Promise(function(i,s){r=setTimeout(function(){s(new mr("Operation timed out."))},t)});return Promise.race([e,n]).then(o=>(clearTimeout(r),o),o=>{throw clearTimeout(r),o})}function nc(e,t){if(e.size!==t.size)return!1;for(let r of e)if(!t.has(r))return!1;return!0}function oc(e,t){let r=0,n=e.length-1,o=e.length;for(;n>=r;){let i=r+Math.trunc((n-r)/2);e[i]<t?r=i+1:(o=i,n=i-1)}return o}function ic(e,t){return e.toLowerCase()===t.toLowerCase()}var tt;(function(e){e[e.DROP=0]="DROP",e[e.SUM=1]="SUM",e[e.LAST_VALUE=2]="LAST_VALUE",e[e.HISTOGRAM=3]="HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=4]="EXPONENTIAL_HISTOGRAM"})(tt||(tt={}));var dr=class{kind=tt.DROP;createAccumulation(){}merge(t,r){}diff(t,r){}toMetricData(t,r,n,o){}};function $p(e){let t=e.map(()=>0);return t.push(0),{buckets:{boundaries:e,counts:t},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}var le=class{startTime;_boundaries;_recordMinMax;_current;constructor(t,r,n=!0,o=$p(r)){this.startTime=t,this._boundaries=r,this._recordMinMax=n,this._current=o}record(t){if(Number.isNaN(t))return;this._current.count+=1,this._current.sum+=t,this._recordMinMax&&(this._current.min=Math.min(t,this._current.min),this._current.max=Math.max(t,this._current.max),this._current.hasMinMax=!0);let r=oc(this._boundaries,t);this._current.buckets.counts[r]+=1}setStartTime(t){this.startTime=t}toPointValue(){return this._current}},pe=class{kind=tt.HISTOGRAM;_boundaries;_recordMinMax;constructor(t,r){this._boundaries=t,this._recordMinMax=r}createAccumulation(t){return new le(t,this._boundaries,this._recordMinMax)}merge(t,r){let n=t.toPointValue(),o=r.toPointValue(),i=n.buckets.counts,s=o.buckets.counts,a=new Array(i.length);for(let p=0;p<i.length;p++)a[p]=i[p]+s[p];let c=1/0,u=-1/0;return this._recordMinMax&&(n.hasMinMax&&o.hasMinMax?(c=Math.min(n.min,o.min),u=Math.max(n.max,o.max)):n.hasMinMax?(c=n.min,u=n.max):o.hasMinMax&&(c=o.min,u=o.max)),new le(t.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:a},count:n.count+o.count,sum:n.sum+o.sum,hasMinMax:this._recordMinMax&&(n.hasMinMax||o.hasMinMax),min:c,max:u})}diff(t,r){let n=t.toPointValue(),o=r.toPointValue(),i=n.buckets.counts,s=o.buckets.counts,a=new Array(i.length);for(let c=0;c<i.length;c++)a[c]=s[c]-i[c];return new le(r.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:a},count:o.count-n.count,sum:o.sum-n.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(t,r,n,o){return{descriptor:t,aggregationTemporality:r,dataPointType:H.HISTOGRAM,dataPoints:n.map(([i,s])=>{let a=s.toPointValue(),c=t.type===T.GAUGE||t.type===T.UP_DOWN_COUNTER||t.type===T.OBSERVABLE_GAUGE||t.type===T.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:i,startTime:s.startTime,endTime:o,value:{min:a.hasMinMax?a.min:void 0,max:a.hasMinMax?a.max:void 0,sum:c?void 0:a.sum,buckets:a.buckets,count:a.count}}})}}};var hr=class e{backing;indexBase;indexStart;indexEnd;constructor(t=new Qi,r=0,n=0,o=0){this.backing=t,this.indexBase=r,this.indexStart=n,this.indexEnd=o}get offset(){return this.indexStart}get length(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(t,r)=>this.at(r))}at(t){let r=this.indexBase-this.indexStart;return t<r&&(t+=this.backing.length),t-=r,this.backing.countAt(t)}incrementBucket(t,r){this.backing.increment(t,r)}decrementBucket(t,r){this.backing.decrement(t,r)}trim(){for(let t=0;t<this.length;t++)if(this.at(t)!==0){this.indexStart+=t;break}else if(t===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(let t=this.length-1;t>=0;t--)if(this.at(t)!==0){this.indexEnd-=this.length-t-1;break}this._rotate()}downscale(t){this._rotate();let r=1+this.indexEnd-this.indexStart,n=1<<t,o=0,i=0;for(let s=this.indexStart;s<=this.indexEnd;){let a=s%n;a<0&&(a+=n);for(let c=a;c<n&&o<r;c++)this._relocateBucket(i,o),o++,s++;i++}this.indexStart>>=t,this.indexEnd>>=t,this.indexBase=this.indexStart}clone(){return new e(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){let t=this.indexBase-this.indexStart;t!==0&&(t>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,t),this.backing.reverse(t,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+t)),this.indexBase=this.indexStart)}_relocateBucket(t,r){t!==r&&this.incrementBucket(t,this.backing.emptyBucket(r))}},Qi=class e{_counts;constructor(t=[0]){this._counts=t}get length(){return this._counts.length}countAt(t){return this._counts[t]}growTo(t,r,n){let o=new Array(t).fill(0);o.splice(n,this._counts.length-r,...this._counts.slice(r)),o.splice(0,r,...this._counts.slice(0,r)),this._counts=o}reverse(t,r){let n=Math.floor((t+r)/2)-t;for(let o=0;o<n;o++){let i=this._counts[t+o];this._counts[t+o]=this._counts[r-o-1],this._counts[r-o-1]=i}}emptyBucket(t){let r=this._counts[t];return this._counts[t]=0,r}increment(t,r){this._counts[t]+=r}decrement(t,r){this._counts[t]>=r?this._counts[t]-=r:this._counts[t]=0}clone(){return new e([...this._counts])}};var fr=Math.pow(2,-1022);function Vn(e){let t=new DataView(new ArrayBuffer(8));return t.setFloat64(0,e),((t.getUint32(0)&2146435072)>>20)-1023}function kn(e){let t=new DataView(new ArrayBuffer(8));t.setFloat64(0,e);let r=t.getUint32(0),n=t.getUint32(4);return(r&1048575)*Math.pow(2,32)+n}function Tr(e,t){return e===0||e===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY||Number.isNaN(e)?e:e*Math.pow(2,t)}function ac(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}var pt=class extends Error{};var Fn=class{_shift;constructor(t){this._shift=-t}mapToIndex(t){if(t<fr)return this._minNormalLowerBoundaryIndex();let r=Vn(t),n=this._rightShift(kn(t)-1,52);return r+n>>this._shift}lowerBoundary(t){let r=this._minNormalLowerBoundaryIndex();if(t<r)throw new pt(`underflow: ${t} is < minimum lower boundary: ${r}`);let n=this._maxNormalLowerBoundaryIndex();if(t>n)throw new pt(`overflow: ${t} is > maximum lower boundary: ${n}`);return Tr(1,t<<this._shift)}get scale(){return this._shift===0?0:-this._shift}_minNormalLowerBoundaryIndex(){let t=-1022>>this._shift;return this._shift<2&&t--,t}_maxNormalLowerBoundaryIndex(){return 1023>>this._shift}_rightShift(t,r){return Math.floor(t*Math.pow(2,-r))}};var zn=class{_scale;_scaleFactor;_inverseFactor;constructor(t){this._scale=t,this._scaleFactor=Tr(Math.LOG2E,t),this._inverseFactor=Tr(Math.LN2,-t)}mapToIndex(t){if(t<=fr)return this._minNormalLowerBoundaryIndex()-1;if(kn(t)===0)return(Vn(t)<<this._scale)-1;let r=Math.floor(Math.log(t)*this._scaleFactor),n=this._maxNormalLowerBoundaryIndex();return r>=n?n:r}lowerBoundary(t){let r=this._maxNormalLowerBoundaryIndex();if(t>=r){if(t===r)return 2*Math.exp((t-(1<<this._scale))/this._scaleFactor);throw new pt(`overflow: ${t} is > maximum lower boundary: ${r}`)}let n=this._minNormalLowerBoundaryIndex();if(t<=n){if(t===n)return fr;if(t===n-1)return Math.exp((t+(1<<this._scale))/this._scaleFactor)/2;throw new pt(`overflow: ${t} is < minimum lower boundary: ${n}`)}return Math.exp(t*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return-1022<<this._scale}_maxNormalLowerBoundaryIndex(){return(1024<<this._scale)-1}};var uc=-10,lc=20,jp=Array.from({length:31},(e,t)=>t>10?new zn(t-10):new Fn(t-10));function ts(e){if(e>lc||e<uc)throw new pt(`expected scale >= ${uc} && <= ${lc}, got: ${e}`);return jp[e+10]}var _e=class e{static combine(t,r){return new e(Math.min(t.low,r.low),Math.max(t.high,r.high))}low;high;constructor(t,r){this.low=t,this.high=r}},Kp=20,Xp=160,es=2,$n=class e{startTime;_maxSize;_recordMinMax;_sum;_count;_zeroCount;_min;_max;_positive;_negative;_mapping;constructor(t,r=Xp,n=!0,o=0,i=0,s=0,a=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,u=new hr,p=new hr,m=ts(Kp)){this.startTime=t,this._maxSize=r,this._recordMinMax=n,this._sum=o,this._count=i,this._zeroCount=s,this._min=a,this._max=c,this._positive=u,this._negative=p,this._mapping=m,this._maxSize<es&&(l.warn(`Exponential Histogram Max Size set to ${this._maxSize}, changing to the minimum size of: ${es}`),this._maxSize=es)}record(t){this.updateByIncrement(t,1)}setStartTime(t){this.startTime=t}toPointValue(){return{hasMinMax:this._recordMinMax,min:this.min,max:this.max,sum:this.sum,positive:{offset:this.positive.offset,bucketCounts:this.positive.counts()},negative:{offset:this.negative.offset,bucketCounts:this.negative.counts()},count:this.count,scale:this.scale,zeroCount:this.zeroCount}}get sum(){return this._sum}get min(){return this._min}get max(){return this._max}get count(){return this._count}get zeroCount(){return this._zeroCount}get scale(){return this._count===this._zeroCount?0:this._mapping.scale}get positive(){return this._positive}get negative(){return this._negative}updateByIncrement(t,r){if(!Number.isNaN(t)){if(t>this._max&&(this._max=t),t<this._min&&(this._min=t),this._count+=r,t===0){this._zeroCount+=r;return}this._sum+=t*r,t>0?this._updateBuckets(this._positive,t,r):this._updateBuckets(this._negative,-t,r)}}merge(t){this._count===0?(this._min=t.min,this._max=t.max):t.count!==0&&(t.min<this.min&&(this._min=t.min),t.max>this.max&&(this._max=t.max)),this.startTime=t.startTime,this._sum+=t.sum,this._count+=t.count,this._zeroCount+=t.zeroCount;let r=this._minScale(t);this._downscale(this.scale-r),this._mergeBuckets(this.positive,t,t.positive,r),this._mergeBuckets(this.negative,t,t.negative,r)}diff(t){this._min=1/0,this._max=-1/0,this._sum-=t.sum,this._count-=t.count,this._zeroCount-=t.zeroCount;let r=this._minScale(t);this._downscale(this.scale-r),this._diffBuckets(this.positive,t,t.positive,r),this._diffBuckets(this.negative,t,t.negative,r)}clone(){return new e(this.startTime,this._maxSize,this._recordMinMax,this._sum,this._count,this._zeroCount,this._min,this._max,this.positive.clone(),this.negative.clone(),this._mapping)}_updateBuckets(t,r,n){let o=this._mapping.mapToIndex(r),i=!1,s=0,a=0;if(t.length===0?(t.indexStart=o,t.indexEnd=t.indexStart,t.indexBase=t.indexStart):o<t.indexStart&&t.indexEnd-o>=this._maxSize?(i=!0,a=o,s=t.indexEnd):o>t.indexEnd&&o-t.indexStart>=this._maxSize&&(i=!0,a=t.indexStart,s=o),i){let c=this._changeScale(s,a);this._downscale(c),o=this._mapping.mapToIndex(r)}this._incrementIndexBy(t,o,n)}_incrementIndexBy(t,r,n){if(n===0)return;if(t.length===0&&(t.indexStart=t.indexEnd=t.indexBase=r),r<t.indexStart){let i=t.indexEnd-r;i>=t.backing.length&&this._grow(t,i+1),t.indexStart=r}else if(r>t.indexEnd){let i=r-t.indexStart;i>=t.backing.length&&this._grow(t,i+1),t.indexEnd=r}let o=r-t.indexBase;o<0&&(o+=t.backing.length),t.incrementBucket(o,n)}_grow(t,r){let n=t.backing.length,o=t.indexBase-t.indexStart,i=n-o,s=ac(r);s>this._maxSize&&(s=this._maxSize);let a=s-o;t.backing.growTo(s,i,a)}_changeScale(t,r){let n=0;for(;t-r>=this._maxSize;)t>>=1,r>>=1,n++;return n}_downscale(t){if(t===0)return;if(t<0)throw new Error(`impossible change of scale: ${this.scale}`);let r=this._mapping.scale-t;this._positive.downscale(t),this._negative.downscale(t),this._mapping=ts(r)}_minScale(t){let r=Math.min(this.scale,t.scale),n=_e.combine(this._highLowAtScale(this.positive,this.scale,r),this._highLowAtScale(t.positive,t.scale,r)),o=_e.combine(this._highLowAtScale(this.negative,this.scale,r),this._highLowAtScale(t.negative,t.scale,r));return Math.min(r-this._changeScale(n.high,n.low),r-this._changeScale(o.high,o.low))}_highLowAtScale(t,r,n){if(t.length===0)return new _e(0,-1);let o=r-n;return new _e(t.indexStart>>o,t.indexEnd>>o)}_mergeBuckets(t,r,n,o){let i=n.offset,s=r.scale-o;for(let a=0;a<n.length;a++)this._incrementIndexBy(t,i+a>>s,n.at(a))}_diffBuckets(t,r,n,o){let i=n.offset,s=r.scale-o;for(let a=0;a<n.length;a++){let u=(i+a>>s)-t.indexBase;u<0&&(u+=t.backing.length),t.decrementBucket(u,n.at(a))}t.trim()}},gr=class{kind=tt.EXPONENTIAL_HISTOGRAM;_maxSize;_recordMinMax;constructor(t,r){this._maxSize=t,this._recordMinMax=r}createAccumulation(t){return new $n(t,this._maxSize,this._recordMinMax)}merge(t,r){let n=r.clone();return n.merge(t),n}diff(t,r){let n=r.clone();return n.diff(t),n}toMetricData(t,r,n,o){return{descriptor:t,aggregationTemporality:r,dataPointType:H.EXPONENTIAL_HISTOGRAM,dataPoints:n.map(([i,s])=>{let a=s.toPointValue(),c=t.type===T.GAUGE||t.type===T.UP_DOWN_COUNTER||t.type===T.OBSERVABLE_GAUGE||t.type===T.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:i,startTime:s.startTime,endTime:o,value:{min:a.hasMinMax?a.min:void 0,max:a.hasMinMax?a.max:void 0,sum:c?void 0:a.sum,positive:{offset:a.positive.offset,bucketCounts:a.positive.bucketCounts},negative:{offset:a.negative.offset,bucketCounts:a.negative.bucketCounts},count:a.count,scale:a.scale,zeroCount:a.zeroCount}}})}}};var me=class{startTime;_current;sampleTime;constructor(t,r=0,n=[0,0]){this.startTime=t,this._current=r,this.sampleTime=n}record(t){this._current=t,this.sampleTime=I(Date.now())}setStartTime(t){this.startTime=t}toPointValue(){return this._current}},Er=class{kind=tt.LAST_VALUE;createAccumulation(t){return new me(t)}merge(t,r){let n=ce(r.sampleTime)>=ce(t.sampleTime)?r:t;return new me(t.startTime,n.toPointValue(),n.sampleTime)}diff(t,r){let n=ce(r.sampleTime)>=ce(t.sampleTime)?r:t;return new me(r.startTime,n.toPointValue(),n.sampleTime)}toMetricData(t,r,n,o){return{descriptor:t,aggregationTemporality:r,dataPointType:H.GAUGE,dataPoints:n.map(([i,s])=>({attributes:i,startTime:s.startTime,endTime:o,value:s.toPointValue()}))}}};var Ht=class{startTime;monotonic;_current;reset;constructor(t,r,n=0,o=!1){this.startTime=t,this.monotonic=r,this._current=n,this.reset=o}record(t){this.monotonic&&t<0||(this._current+=t)}setStartTime(t){this.startTime=t}toPointValue(){return this._current}},de=class{kind=tt.SUM;monotonic;constructor(t){this.monotonic=t}createAccumulation(t){return new Ht(t,this.monotonic)}merge(t,r){let n=t.toPointValue(),o=r.toPointValue();return r.reset?new Ht(r.startTime,this.monotonic,o,r.reset):new Ht(t.startTime,this.monotonic,n+o)}diff(t,r){let n=t.toPointValue(),o=r.toPointValue();return this.monotonic&&n>o?new Ht(r.startTime,this.monotonic,o,!0):new Ht(r.startTime,this.monotonic,o-n)}toMetricData(t,r,n,o){return{descriptor:t,aggregationTemporality:r,dataPointType:H.SUM,dataPoints:n.map(([i,s])=>({attributes:i,startTime:s.startTime,endTime:o,value:s.toPointValue()})),isMonotonic:this.monotonic}}};var rs=class e{static DEFAULT_INSTANCE=new dr;createAggregator(t){return e.DEFAULT_INSTANCE}};var ns=class e{static MONOTONIC_INSTANCE=new de(!0);static NON_MONOTONIC_INSTANCE=new de(!1);createAggregator(t){switch(t.type){case T.COUNTER:case T.OBSERVABLE_COUNTER:case T.HISTOGRAM:return e.MONOTONIC_INSTANCE;default:return e.NON_MONOTONIC_INSTANCE}}};var os=class e{static DEFAULT_INSTANCE=new Er;createAggregator(t){return e.DEFAULT_INSTANCE}};var is=class e{static DEFAULT_INSTANCE=new pe([0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],!0);createAggregator(t){return e.DEFAULT_INSTANCE}};var Ar=class{_boundaries;_recordMinMax;constructor(t,r=!0){if(t==null)throw new Error("ExplicitBucketHistogramAggregation should be created with explicit boundaries, if a single bucket histogram is required, please pass an empty array");t=t.concat(),t=t.sort((i,s)=>i-s);let n=t.lastIndexOf(-1/0),o=t.indexOf(1/0);o===-1&&(o=void 0),this._boundaries=t.slice(n+1,o),this._recordMinMax=r}createAggregator(t){return new pe(this._boundaries,this._recordMinMax)}},Sr=class{_maxSize;_recordMinMax;constructor(t=160,r=!0){this._maxSize=t,this._recordMinMax=r}createAggregator(t){return new gr(this._maxSize,this._recordMinMax)}},ss=class{_resolve(t){switch(t.type){case T.COUNTER:case T.UP_DOWN_COUNTER:case T.OBSERVABLE_COUNTER:case T.OBSERVABLE_UP_DOWN_COUNTER:return cs;case T.GAUGE:case T.OBSERVABLE_GAUGE:return us;case T.HISTOGRAM:return t.advice.explicitBucketBoundaries?new Ar(t.advice.explicitBucketBoundaries):ls}return l.warn(`Unable to recognize instrument type: ${t.type}`),as}createAggregator(t){return this._resolve(t).createAggregator(t)}},as=new rs,cs=new ns,us=new os,ls=new is,Lg=new Sr,pc=new ss;var k;(function(e){e[e.DEFAULT=0]="DEFAULT",e[e.DROP=1]="DROP",e[e.SUM=2]="SUM",e[e.LAST_VALUE=3]="LAST_VALUE",e[e.EXPLICIT_BUCKET_HISTOGRAM=4]="EXPLICIT_BUCKET_HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=5]="EXPONENTIAL_HISTOGRAM"})(k||(k={}));function Wn(e){switch(e.type){case k.DEFAULT:return pc;case k.DROP:return as;case k.SUM:return cs;case k.LAST_VALUE:return us;case k.EXPONENTIAL_HISTOGRAM:{let t=e;return new Sr(t.options?.maxSize,t.options?.recordMinMax)}case k.EXPLICIT_BUCKET_HISTOGRAM:{let t=e;return t.options==null?ls:new Ar(t.options?.boundaries,t.options?.recordMinMax)}default:throw new Error("Unsupported Aggregation")}}var _c=e=>({type:k.DEFAULT}),mc=e=>G.CUMULATIVE;var dc="otel.component.name",hc="otel.component.type",fc="periodic_metric_reader",Tc="otel.sdk.metric_reader.collection.duration",gc="error.type";var Ec=new Map,Rr=class{collectionDuration;standardAttrs;constructor(t,r){let n=Ec.get(t)??0;Ec.set(t,n+1),this.standardAttrs={[hc]:t,[dc]:`${t}/${n}`},this.collectionDuration=r.createHistogram(Tc,{unit:"s",description:"The duration of the collect operation of the metric reader.",advice:{explicitBucketBoundaries:[]}})}recordCollection(t,r){let n=r?{...this.standardAttrs,[gc]:r}:this.standardAttrs;this.collectionDuration.record(t,n)}};var Ac="2.8.0";var he=class{_shutdown=!1;_metricProducers;_sdkMetricProducer;_selfObsMetrics;_aggregationTemporalitySelector;_aggregationSelector;_cardinalitySelector;_otelComponentType;constructor(t){this._aggregationSelector=t?.aggregationSelector??_c,this._aggregationTemporalitySelector=t?.aggregationTemporalitySelector??mc,this._metricProducers=t?.metricProducers??[],this._cardinalitySelector=t?.cardinalitySelector,this._otelComponentType=t?.otelComponentType??this.constructor.name,this._selfObsMetrics=new Rr(this._otelComponentType,St())}setMetricProducer(t){if(this._sdkMetricProducer)throw new Error("MetricReader can not be bound to a MeterProvider again.");this._sdkMetricProducer=t,this.onInitialized()}_setSelfObsMeterProvider(t){let r=t.getMeter("@opentelemetry/sdk-metrics",Ac);this._selfObsMetrics=new Rr(this._otelComponentType,r)}selectAggregation(t){return this._aggregationSelector(t)}selectAggregationTemporality(t){return this._aggregationTemporalitySelector(t)}selectCardinalityLimit(t){return this._cardinalitySelector?this._cardinalitySelector(t):2e3}onInitialized(){}async collect(t){if(this._sdkMetricProducer===void 0)throw new Error("MetricReader is not bound to a MetricProducer");if(this._shutdown)throw new Error("MetricReader is shutdown");let r=b(),[n,...o]=await Promise.all([this._sdkMetricProducer.collect({timeoutMillis:t?.timeoutMillis}),...this._metricProducers.map(p=>p.collect({timeoutMillis:t?.timeoutMillis}))]),i=b(),s=n.errors.concat(o.flatMap(p=>p.errors)),a=Fi(ar(r,i));this._selfObsMetrics.recordCollection(a,s.length>0?s[0].name??"collect_error":void 0);let c=n.resourceMetrics.resource,u=n.resourceMetrics.scopeMetrics.concat(o.flatMap(p=>p.resourceMetrics.scopeMetrics));return{resourceMetrics:{resource:c,scopeMetrics:u},errors:s}}async shutdown(t){if(this._shutdown){l.error("Cannot call shutdown twice.");return}t?.timeoutMillis==null?await this.onShutdown():await Gt(this.onShutdown(),t.timeoutMillis),this._shutdown=!0}async forceFlush(t){if(this._shutdown){l.warn("Cannot forceFlush on already shutdown MetricReader.");return}if(t?.timeoutMillis==null){await this.onForceFlush();return}await Gt(this.onForceFlush(),t.timeoutMillis)}};var xr=class extends he{_interval;_exporter;_exportInterval;_exportTimeout;constructor(t){let{exporter:r,exportIntervalMillis:n=6e4,metricProducers:o,cardinalityLimits:i}=t,{exportTimeoutMillis:s=3e4}=t;if(super({aggregationSelector:r.selectAggregation?.bind(r),aggregationTemporalitySelector:r.selectAggregationTemporality?.bind(r),otelComponentType:fc,metricProducers:o,cardinalitySelector:a=>{let c={default:2e3,...i};switch(a){case T.COUNTER:return c.counter??c.default;case T.GAUGE:return c.gauge??c.default;case T.HISTOGRAM:return c.histogram??c.default;case T.OBSERVABLE_COUNTER:return c.observableCounter??c.default;case T.OBSERVABLE_UP_DOWN_COUNTER:return c.observableUpDownCounter??c.default;case T.OBSERVABLE_GAUGE:return c.observableGauge??c.default;case T.UP_DOWN_COUNTER:return c.upDownCounter??c.default;default:return c.default}}}),n<=0)throw Error("exportIntervalMillis must be greater than 0");if(s<=0)throw Error("exportTimeoutMillis must be greater than 0");if(n<s){if("exportIntervalMillis"in t&&"exportTimeoutMillis"in t)throw Error("exportIntervalMillis must be greater than or equal to exportTimeoutMillis");l.info(`Timeout of ${s} exceeds the interval of ${n}. Clamping timeout to interval duration.`),s=n}this._exportInterval=n,this._exportTimeout=s,this._exporter=r}async _runOnce(){try{await Gt(this._doRun(),this._exportTimeout)}catch(t){if(t instanceof mr){l.error("Export took longer than %s milliseconds and timed out.",this._exportTimeout);return}P(t)}}async _doRun(){let{resourceMetrics:t,errors:r}=await this.collect({timeoutMillis:this._exportTimeout});if(r.length>0&&l.error("PeriodicExportingMetricReader: metrics collection errors",...r),t.resource.asyncAttributesPending)try{await t.resource.waitForAsyncAttributes?.()}catch(o){l.debug("Error while resolving async portion of resource: ",o),P(o)}if(t.scopeMetrics.length===0)return;let n=await Ja._export(this._exporter,t);if(n.code!==U.SUCCESS)throw new Error(`PeriodicExportingMetricReader: metrics export failed (error ${n.error})`)}onInitialized(){this._interval=setInterval(()=>{this._runOnce()},this._exportInterval),typeof this._interval!="number"&&this._interval.unref()}async onForceFlush(){await this._runOnce(),await this._exporter.forceFlush()}async onShutdown(){this._interval&&clearInterval(this._interval),await this.onForceFlush(),await this._exporter.shutdown()}};var jn;function Sc(){if(jn===void 0)try{let e=globalThis.process.argv0;jn=e?`unknown_service:${e}`:"unknown_service"}catch{jn="unknown_service"}return jn}var fe=e=>e!==null&&typeof e=="object"&&typeof e.then=="function";var ps=class e{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(t,r){let n=new e({},r);return n._rawAttributes=Rc(t),n._asyncAttributesPending=t.filter(([o,i])=>fe(i)).length>0,n}constructor(t,r){let n=t.attributes??{};this._rawAttributes=Object.entries(n).map(([o,i])=>(fe(i)&&(this._asyncAttributesPending=!0),[o,i])),this._rawAttributes=Rc(this._rawAttributes),this._schemaUrl=Yp(r?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let t=0;t<this._rawAttributes.length;t++){let[r,n]=this._rawAttributes[t];this._rawAttributes[t]=[r,fe(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&l.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;let t={};for(let[r,n]of this._rawAttributes){if(fe(n)){l.debug(`Unsettled resource attribute ${r} skipped`);continue}n!=null&&(t[r]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=t),t}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let r=qp(this,t),n=r?{schemaUrl:r}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],n)}};function Kn(e,t){return ps.FromAttributeList(Object.entries(e),t)}function qt(){return Kn({[Ua]:Sc(),[nr]:Bt[nr],[or]:Bt[or],[ir]:Bt[ir]})}function Rc(e){return e.map(([t,r])=>fe(r)?[t,r.catch(n=>{l.debug("promise rejection for resource attribute: %s - %s",t,n)})]:[t,r])}function Yp(e){if(typeof e=="string"||e===void 0)return e;l.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",e)}function qp(e,t){let r=e?.schemaUrl,n=t?.schemaUrl,o=r===void 0||r==="",i=n===void 0||n==="";if(o)return n;if(i||r===n)return r;l.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',r,n)}var Xn=class{_registeredViews=[];addView(t){this._registeredViews.push(t)}findViews(t,r){return this._registeredViews.filter(o=>this._matchInstrument(o.instrumentSelector,t)&&this._matchMeter(o.meterSelector,r))}_matchInstrument(t,r){return(t.getType()===void 0||r.type===t.getType())&&t.getNameFilter().match(r.name)&&t.getUnitFilter().match(r.unit)}_matchMeter(t,r){return t.getNameFilter().match(r.name)&&(r.version===void 0||t.getVersionFilter().match(r.version))&&(r.schemaUrl===void 0||t.getSchemaUrlFilter().match(r.schemaUrl))}};function _t(e,t,r){return Jp(e)||l.warn(`Invalid metric name: "${e}". The metric name should be a ASCII string with a length no greater than 255 characters.`),{name:e,type:t,description:r?.description??"",unit:r?.unit??"",valueType:r?.valueType??K.DOUBLE,advice:r?.advice??{}}}function xc(e,t){return{name:e.name??t.name,description:e.description??t.description,type:t.type,unit:t.unit,valueType:t.valueType,advice:t.advice}}function Oc(e,t){return ic(e.name,t.name)&&e.unit===t.unit&&e.type===t.type&&e.valueType===t.valueType}var Qp=/^[a-z][a-z0-9_.\-/]{0,254}$/i;function Jp(e){return Qp.test(e)}var Te=class{_writableMetricStorage;_descriptor;constructor(t,r){this._writableMetricStorage=t,this._descriptor=r}_record(t,r={},n=E.active()){if(typeof t!="number"){l.warn(`non-number value provided to metric ${this._descriptor.name}: ${t}`);return}this._descriptor.valueType===K.INT&&!Number.isInteger(t)&&(l.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||this._writableMetricStorage.record(t,r,n,I(Date.now()))}},Yn=class extends Te{add(t,r,n){this._record(t,r,n)}},qn=class extends Te{add(t,r,n){if(t<0){l.warn(`negative value provided to counter ${this._descriptor.name}: ${t}`);return}this._record(t,r,n)}},Qn=class extends Te{record(t,r,n){this._record(t,r,n)}},Jn=class extends Te{record(t,r,n){if(t<0){l.warn(`negative value provided to histogram ${this._descriptor.name}: ${t}`);return}this._record(t,r,n)}},ge=class{_metricStorages;_descriptor;_observableRegistry;constructor(t,r,n){this._descriptor=t,this._metricStorages=r,this._observableRegistry=n}addCallback(t){this._observableRegistry.addCallback(t,this)}removeCallback(t){this._observableRegistry.removeCallback(t,this)}},Zn=class extends ge{},to=class extends ge{},eo=class extends ge{};function Or(e){return e instanceof ge}var ro=class{_meterSharedState;constructor(t){this._meterSharedState=t}createGauge(t,r){let n=_t(t,T.GAUGE,r),o=this._meterSharedState.registerMetricStorage(n);return new Qn(o,n)}createHistogram(t,r){let n=_t(t,T.HISTOGRAM,r),o=this._meterSharedState.registerMetricStorage(n);return new Jn(o,n)}createCounter(t,r){let n=_t(t,T.COUNTER,r),o=this._meterSharedState.registerMetricStorage(n);return new qn(o,n)}createUpDownCounter(t,r){let n=_t(t,T.UP_DOWN_COUNTER,r),o=this._meterSharedState.registerMetricStorage(n);return new Yn(o,n)}createObservableGauge(t,r){let n=_t(t,T.OBSERVABLE_GAUGE,r),o=this._meterSharedState.registerAsyncMetricStorage(n);return new to(n,o,this._meterSharedState.observableRegistry)}createObservableCounter(t,r){let n=_t(t,T.OBSERVABLE_COUNTER,r),o=this._meterSharedState.registerAsyncMetricStorage(n);return new Zn(n,o,this._meterSharedState.observableRegistry)}createObservableUpDownCounter(t,r){let n=_t(t,T.OBSERVABLE_UP_DOWN_COUNTER,r),o=this._meterSharedState.registerAsyncMetricStorage(n);return new eo(n,o,this._meterSharedState.observableRegistry)}addBatchObservableCallback(t,r){this._meterSharedState.observableRegistry.addBatchCallback(t,r)}removeBatchObservableCallback(t,r){this._meterSharedState.observableRegistry.removeBatchCallback(t,r)}};var Ee=class{_instrumentDescriptor;constructor(t){this._instrumentDescriptor=t}getInstrumentDescriptor(){return this._instrumentDescriptor}updateDescription(t){this._instrumentDescriptor=_t(this._instrumentDescriptor.name,this._instrumentDescriptor.type,{description:t,valueType:this._instrumentDescriptor.valueType,unit:this._instrumentDescriptor.unit,advice:this._instrumentDescriptor.advice})}};var _s=class{_valueMap=new Map;_keyMap=new Map;_hash;constructor(t){this._hash=t}get(t,r){return r??=this._hash(t),this._valueMap.get(r)}getOrDefault(t,r){let n=this._hash(t);if(this._valueMap.has(n))return this._valueMap.get(n);let o=r();return this._keyMap.has(n)||this._keyMap.set(n,t),this._valueMap.set(n,o),o}set(t,r,n){n??=this._hash(t),this._keyMap.has(n)||this._keyMap.set(n,t),this._valueMap.set(n,r)}has(t,r){return r??=this._hash(t),this._valueMap.has(r)}*keys(){let t=this._keyMap.entries(),r=t.next();for(;r.done!==!0;)yield[r.value[1],r.value[0]],r=t.next()}*entries(){let t=this._valueMap.entries(),r=t.next();for(;r.done!==!0;)yield[this._keyMap.get(r.value[0]),r.value[1],r.value[0]],r=t.next()}get size(){return this._valueMap.size}},q=class extends _s{constructor(){super(Hn)}};var Ae=class{_activeCollectionStorage=new q;_cumulativeMemoStorage=new q;_cardinalityLimit;_overflowAttributes={"otel.metric.overflow":!0};_overflowHashCode;_aggregator;constructor(t,r){this._aggregator=t,this._cardinalityLimit=(r??2e3)-1,this._overflowHashCode=Hn(this._overflowAttributes)}record(t,r,n,o){let i=this._activeCollectionStorage.get(r);if(!i){if(this._activeCollectionStorage.size>=this._cardinalityLimit){this._activeCollectionStorage.getOrDefault(this._overflowAttributes,()=>this._aggregator.createAccumulation(o))?.record(t);return}i=this._aggregator.createAccumulation(o),this._activeCollectionStorage.set(r,i)}i?.record(t)}batchCumulate(t,r){for(let[n,o,i]of t.entries()){let s=n,a=i,c=this._aggregator.createAccumulation(r);c?.record(o);let u=c;if(this._cumulativeMemoStorage.has(s,a)){let p=this._cumulativeMemoStorage.get(s,a);u=this._aggregator.diff(p,c)}else if(this._cumulativeMemoStorage.size>=this._cardinalityLimit&&(s=this._overflowAttributes,a=this._overflowHashCode,this._cumulativeMemoStorage.has(s,a))){let p=this._cumulativeMemoStorage.get(s,a);u=this._aggregator.diff(p,c)}if(this._activeCollectionStorage.has(s,a)){let p=this._activeCollectionStorage.get(s,a);u=this._aggregator.merge(p,u)}this._cumulativeMemoStorage.set(s,c,a),this._activeCollectionStorage.set(s,u,a)}}collect(){let t=this._activeCollectionStorage;return this._activeCollectionStorage=new q,t}};var Se=class e{_aggregator;_unreportedAccumulations=new Map;_reportHistory=new Map;constructor(t,r){this._aggregator=t,r.forEach(n=>{this._unreportedAccumulations.set(n,[])})}buildMetrics(t,r,n,o){this._stashAccumulations(n);let i=this._getMergedUnreportedAccumulations(t),s=i,a;if(this._reportHistory.has(t)){let u=this._reportHistory.get(t),p=u.collectionTime;a=u.aggregationTemporality,a===G.CUMULATIVE?s=e.merge(u.accumulations,i,this._aggregator):s=e.calibrateStartTime(u.accumulations,i,p)}else a=t.selectAggregationTemporality(r.type);this._reportHistory.set(t,{accumulations:s,collectionTime:o,aggregationTemporality:a});let c=Zp(s);if(c.length!==0)return this._aggregator.toMetricData(r,a,c,o)}_stashAccumulations(t){let r=this._unreportedAccumulations.keys();for(let n of r){let o=this._unreportedAccumulations.get(n);o===void 0&&(o=[],this._unreportedAccumulations.set(n,o)),o.push(t)}}_getMergedUnreportedAccumulations(t){let r=new q,n=this._unreportedAccumulations.get(t);if(this._unreportedAccumulations.set(t,[]),n===void 0)return r;for(let o of n)r=e.merge(r,o,this._aggregator);return r}static merge(t,r,n){let o=t,i=r.entries(),s=i.next();for(;s.done!==!0;){let[a,c,u]=s.value;if(t.has(a,u)){let p=t.get(a,u),m=n.merge(p,c);o.set(a,m,u)}else o.set(a,c,u);s=i.next()}return o}static calibrateStartTime(t,r,n){for(let[o,i]of t.keys())r.get(o,i)?.setStartTime(n);return r}};function Zp(e){return Array.from(e.entries())}var no=class extends Ee{_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;_attributesProcessor;constructor(t,r,n,o,i){super(t),this._aggregationCardinalityLimit=i,this._deltaMetricStorage=new Ae(r,this._aggregationCardinalityLimit),this._temporalMetricStorage=new Se(r,o),this._attributesProcessor=n}record(t,r){let n=new q;for(let[o,i]of t.entries())n.set(this._attributesProcessor.process(o),i);this._deltaMetricStorage.batchCumulate(n,r)}collect(t,r){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(t,this._instrumentDescriptor,n,r)}};function ms(e,t){let r="";return e.unit!==t.unit&&(r+=` - Unit '${e.unit}' does not match '${t.unit}'
|
|
2
2
|
`),e.type!==t.type&&(r+=` - Type '${e.type}' does not match '${t.type}'
|
|
3
3
|
`),e.valueType!==t.valueType&&(r+=` - Value Type '${e.valueType}' does not match '${t.valueType}'
|
|
4
4
|
`),e.description!==t.description&&(r+=` - Description '${e.description}' does not match '${t.description}'
|
|
5
|
-
`),r}function
|
|
5
|
+
`),r}function t_(e,t){return` - use valueType '${e.valueType}' on instrument creation or use an instrument name other than '${t.name}'`}function e_(e,t){return` - use unit '${e.unit}' on instrument creation or use an instrument name other than '${t.name}'`}function r_(e,t){let r={name:t.name,type:t.type,unit:t.unit},n=JSON.stringify(r);return` - create a new view with a name other than '${e.name}' and InstrumentSelector '${n}'`}function n_(e,t){let r={name:t.name,type:t.type,unit:t.unit},n=JSON.stringify(r);return` - create a new view with a name other than '${e.name}' and InstrumentSelector '${n}'
|
|
6
6
|
- OR - create a new view with the name ${e.name} and description '${e.description}' and InstrumentSelector ${n}
|
|
7
|
-
- OR - create a new view with the name ${t.name} and description '${e.description}' and InstrumentSelector ${n}`}function
|
|
7
|
+
- OR - create a new view with the name ${t.name} and description '${e.description}' and InstrumentSelector ${n}`}function ds(e,t){return e.valueType!==t.valueType?t_(e,t):e.unit!==t.unit?e_(e,t):e.type!==t.type?r_(e,t):e.description!==t.description?n_(e,t):""}var oo=class e{_sharedRegistry=new Map;_perCollectorRegistry=new Map;static create(){return new e}getStorages(t){let r=[];for(let o of this._sharedRegistry.values())r=r.concat(o);let n=this._perCollectorRegistry.get(t);if(n!=null)for(let o of n.values())r=r.concat(o);return r}register(t){this._registerStorage(t,this._sharedRegistry)}registerForCollector(t,r){let n=this._perCollectorRegistry.get(t);n==null&&(n=new Map,this._perCollectorRegistry.set(t,n)),this._registerStorage(r,n)}findOrUpdateCompatibleStorage(t){let r=this._sharedRegistry.get(t.name);return r===void 0?null:this._findOrUpdateCompatibleStorage(t,r)}findOrUpdateCompatibleCollectorStorage(t,r){let n=this._perCollectorRegistry.get(t);if(n===void 0)return null;let o=n.get(r.name);return o===void 0?null:this._findOrUpdateCompatibleStorage(r,o)}_registerStorage(t,r){let n=t.getInstrumentDescriptor(),o=r.get(n.name);if(o===void 0){r.set(n.name,[t]);return}o.push(t)}_findOrUpdateCompatibleStorage(t,r){let n=null;for(let o of r){let i=o.getInstrumentDescriptor();Oc(i,t)?(i.description!==t.description&&(t.description.length>i.description.length&&o.updateDescription(t.description),l.warn("A view or instrument with the name ",t.name,` has already been registered, but has a different description and is incompatible with another registered view.
|
|
8
8
|
`,`Details:
|
|
9
|
-
`,
|
|
10
|
-
To resolve the conflict
|
|
9
|
+
`,ms(i,t),`The longer description will be used.
|
|
10
|
+
To resolve the conflict:`,ds(i,t))),n=o):l.warn("A view or instrument with the name ",t.name,` has already been registered and is incompatible with another registered view.
|
|
11
11
|
`,`Details:
|
|
12
|
-
`,
|
|
13
|
-
`,$i(i,t))}return n}};var zn=class{_backingStorages;constructor(t){this._backingStorages=t}record(t,r,n,o){this._backingStorages.forEach(i=>{i.record(t,r,n,o)})}};var Wn=class{_buffer=new q;_instrumentName;_valueType;constructor(t,r){this._instrumentName=t,this._valueType=r}observe(t,r={}){if(typeof t!="number"){l.warn(`non-number value provided to metric ${this._instrumentName}: ${t}`);return}this._valueType===K.INT&&!Number.isInteger(t)&&(l.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||this._buffer.set(r,t)}},jn=class{_buffer=new Map;observe(t,r,n={}){if(!dr(t))return;let o=this._buffer.get(t);if(o==null&&(o=new q,this._buffer.set(t,o)),typeof r!="number"){l.warn(`non-number value provided to metric ${t._descriptor.name}: ${r}`);return}t._descriptor.valueType===K.INT&&!Number.isInteger(r)&&(l.warn(`INT value type cannot accept a floating-point value for ${t._descriptor.name}, ignoring the fractional digits.`),r=Math.trunc(r),!Number.isInteger(r))||o.set(n,r)}};var Kn=class{_callbacks=[];_batchCallbacks=[];addCallback(t,r){this._findCallback(t,r)>=0||this._callbacks.push({callback:t,instrument:r})}removeCallback(t,r){let n=this._findCallback(t,r);n<0||this._callbacks.splice(n,1)}addBatchCallback(t,r){let n=new Set(r.filter(dr));if(n.size===0){l.error("BatchObservableCallback is not associated with valid instruments",r);return}this._findBatchCallback(t,n)>=0||this._batchCallbacks.push({callback:t,instruments:n})}removeBatchCallback(t,r){let n=new Set(r.filter(dr)),o=this._findBatchCallback(t,n);o<0||this._batchCallbacks.splice(o,1)}async observe(t,r){let n=this._observeCallbacks(t,r),o=this._observeBatchCallbacks(t,r);return(await Promise.allSettled([...n,...o])).filter(a=>a.status==="rejected").map(a=>a.reason)}_observeCallbacks(t,r){return this._callbacks.map(async({callback:n,instrument:o})=>{let i=new Wn(o._descriptor.name,o._descriptor.valueType),s=Promise.resolve(n(i));r!=null&&(s=vt(s,r)),await s,o._metricStorages.forEach(a=>{a.record(i._buffer,t)})})}_observeBatchCallbacks(t,r){return this._batchCallbacks.map(async({callback:n,instruments:o})=>{let i=new jn,s=Promise.resolve(n(i));r!=null&&(s=vt(s,r)),await s,o.forEach(a=>{let c=i._buffer.get(a);c!=null&&a._metricStorages.forEach(u=>{u.record(c,t)})})})}_findCallback(t,r){return this._callbacks.findIndex(n=>n.callback===t&&n.instrument===r)}_findBatchCallback(t,r){return this._batchCallbacks.findIndex(n=>n.callback===t&&ba(n.instruments,r))}};var Xn=class extends Te{_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;_attributesProcessor;constructor(t,r,n,o,i){super(t),this._aggregationCardinalityLimit=i,this._deltaMetricStorage=new ge(r,this._aggregationCardinalityLimit),this._temporalMetricStorage=new Ee(r,o),this._attributesProcessor=n}record(t,r,n,o){r=this._attributesProcessor.process(r,n),this._deltaMetricStorage.record(t,r,n,o)}collect(t,r){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(t,this._instrumentDescriptor,n,r)}};var zi=class{process(t,r){return t}},Wi=class{_processors;constructor(t){this._processors=t}process(t,r){let n=t;for(let o of this._processors)n=o.process(n,r);return n}};function Yn(){return pp}function Va(e){return new Wi(e)}var pp=new zi;var qn=class{metricStorageRegistry=new $n;observableRegistry=new Kn;meter;_meterProviderSharedState;_instrumentationScope;constructor(t,r){this.meter=new kn(this),this._meterProviderSharedState=t,this._instrumentationScope=r}registerMetricStorage(t){let r=this._registerMetricStorage(t,Xn);return r.length===1?r[0]:new zn(r)}registerAsyncMetricStorage(t){return this._registerMetricStorage(t,Fn)}async collect(t,r,n){let o=await this.observableRegistry.observe(r,n?.timeoutMillis),i=this.metricStorageRegistry.getStorages(t);if(i.length===0)return null;let s=[];return i.forEach(a=>{let c=a.collect(t,r);c!=null&&s.push(c)}),s.length===0?{errors:o}:{scopeMetrics:{scope:this._instrumentationScope,metrics:s},errors:o}}_registerMetricStorage(t,r){let o=this._meterProviderSharedState.viewRegistry.findViews(t,this._instrumentationScope).map(i=>{let s=Ga(i,t),a=this.metricStorageRegistry.findOrUpdateCompatibleStorage(s);if(a!=null)return a;let c=i.aggregation.createAggregator(s),u=new r(s,c,i.attributesProcessor,this._meterProviderSharedState.metricCollectors,i.aggregationCardinalityLimit);return this.metricStorageRegistry.register(u),u});if(o.length===0){let s=this._meterProviderSharedState.selectAggregations(t.type).map(([a,c])=>{let u=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(a,t);if(u!=null)return u;let p=c.createAggregator(t),_=a.selectCardinalityLimit(t.type),f=new r(t,p,Yn(),[a],_);return this.metricStorageRegistry.registerForCollector(a,f),f});o=o.concat(s)}return o}};var Qn=class{viewRegistry=new Mn;metricCollectors=[];meterSharedStates=new Map;resource;constructor(t){this.resource=t}getMeterSharedState(t){let r=Oa(t),n=this.meterSharedStates.get(r);return n==null&&(n=new qn(this,t),this.meterSharedStates.set(r,n)),n}selectAggregations(t){let r=[];for(let n of this.metricCollectors)r.push([n,yn(n.selectAggregation(t))]);return r}};var Jn=class{_sharedState;_metricReader;constructor(t,r){this._sharedState=t,this._metricReader=r}async collect(t){let r=P(Date.now()),n=[],o=[],i=Array.from(this._sharedState.meterSharedStates.values()).map(async s=>{let a=await s.collect(this,r,t);a?.scopeMetrics!=null&&n.push(a.scopeMetrics),a?.errors!=null&&o.push(...a.errors)});return await Promise.all(i),{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:n},errors:o}}async forceFlush(t){await this._metricReader.forceFlush(t)}async shutdown(t){await this._metricReader.shutdown(t)}selectAggregationTemporality(t){return this._metricReader.selectAggregationTemporality(t)}selectAggregation(t){return this._metricReader.selectAggregation(t)}selectCardinalityLimit(t){return this._metricReader.selectCardinalityLimit?.(t)??2e3}};var mp=/[\^$\\.+?()[\]{}|]/g,Se=class e{_matchAll;_regexp;constructor(t){t==="*"?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(e.escapePattern(t)))}match(t){return this._matchAll?!0:this._regexp.test(t)}static escapePattern(t){return`^${t.replace(mp,"\\$&").replace("*",".*")}$`}static hasWildcard(t){return t.includes("*")}},Ut=class{_matchAll;_pattern;constructor(t){this._matchAll=t===void 0,this._pattern=t}match(t){return!!(this._matchAll||t===this._pattern)}};var Zn=class{_nameFilter;_type;_unitFilter;constructor(t){this._nameFilter=new Se(t?.name??"*"),this._type=t?.type,this._unitFilter=new Ut(t?.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}};var to=class{_nameFilter;_versionFilter;_schemaUrlFilter;constructor(t){this._nameFilter=new Ut(t?.name),this._versionFilter=new Ut(t?.version),this._schemaUrlFilter=new Ut(t?.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}};function _p(e){return e.instrumentName==null&&e.instrumentType==null&&e.instrumentUnit==null&&e.meterName==null&&e.meterVersion==null&&e.meterSchemaUrl==null}function dp(e){if(_p(e))throw new Error("Cannot create view with no selector arguments supplied");if(e.name!=null&&(e?.instrumentName==null||Se.hasWildcard(e.instrumentName)))throw new Error("Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.")}var eo=class{name;description;aggregation;attributesProcessor;instrumentSelector;meterSelector;aggregationCardinalityLimit;constructor(t){dp(t),t.attributesProcessors!=null?this.attributesProcessor=Va(t.attributesProcessors):this.attributesProcessor=Yn(),this.name=t.name,this.description=t.description,this.aggregation=yn(t.aggregation??{type:k.DEFAULT}),this.instrumentSelector=new Zn({name:t.instrumentName,type:t.instrumentType,unit:t.instrumentUnit}),this.meterSelector=new to({name:t.meterName,version:t.meterVersion,schemaUrl:t.meterSchemaUrl}),this.aggregationCardinalityLimit=t.aggregationCardinalityLimit}};var hr=class{_sharedState;_shutdown=!1;constructor(t){if(this._sharedState=new Qn(t?.resource??Xt()),t?.views!=null&&t.views.length>0)for(let r of t.views)this._sharedState.viewRegistry.addView(new eo(r));if(t?.readers!=null&&t.readers.length>0)for(let r of t.readers){let n=new Jn(this._sharedState,r);r.setMetricProducer(n),this._sharedState.metricCollectors.push(n)}}getMeter(t,r="",n={}){return this._shutdown?(l.warn("A shutdown MeterProvider cannot provide a Meter"),Ft()):this._sharedState.getMeterSharedState({name:t,version:r,schemaUrl:n.schemaUrl}).meter}async shutdown(t){if(this._shutdown){l.warn("shutdown may only be called once per MeterProvider");return}this._shutdown=!0,await Promise.all(this._sharedState.metricCollectors.map(r=>r.shutdown(t)))}async forceFlush(t){if(this._shutdown){l.warn("invalid attempt to force flush after MeterProvider shutdown");return}await Promise.all(this._sharedState.metricCollectors.map(r=>r.forceFlush(t)))}};var fr;(function(e){e[e.AGGREGATION_TEMPORALITY_UNSPECIFIED=0]="AGGREGATION_TEMPORALITY_UNSPECIFIED",e[e.AGGREGATION_TEMPORALITY_DELTA=1]="AGGREGATION_TEMPORALITY_DELTA",e[e.AGGREGATION_TEMPORALITY_CUMULATIVE=2]="AGGREGATION_TEMPORALITY_CUMULATIVE"})(fr||(fr={}));function Ae(e,t){let r={attributes:xt(e.attributes,t),droppedAttributesCount:0},n=e.schemaUrl;return n&&n!==""&&(r.schemaUrl=n),r}function Re(e){return{name:e.name,version:e.version}}function xt(e,t){return Object.keys(e).map(r=>ji(r,e[r],t))}function ji(e,t,r){return{key:e,value:Tr(t,r)}}function Tr(e,t){let r=typeof e;if(r==="string")return{stringValue:e};if(r==="number")return Number.isInteger(e)?{intValue:e}:{doubleValue:e};if(r==="boolean")return{boolValue:e};if(e instanceof Uint8Array)return{bytesValue:t.encodeUint8Array(e)};if(Array.isArray(e)){let n=new Array(e.length);for(let o=0;o<e.length;o++)n[o]=Tr(e[o],t);return{arrayValue:{values:n}}}if(r==="object"&&e!=null){let n=Object.keys(e),o=new Array(n.length);for(let i=0;i<n.length;i++)o[i]={key:n[i],value:Tr(e[n[i]],t)};return{kvlistValue:{values:o}}}return{}}function hp(e,t){let r=Ae(e.resource,t);return{resource:r,schemaUrl:r.schemaUrl,scopeMetrics:fp(e.scopeMetrics,t)}}function fp(e,t){return Array.from(e.map(r=>({scope:Re(r.scope),metrics:r.metrics.map(n=>Tp(n,t)),schemaUrl:r.scope.schemaUrl})))}function Tp(e,t){let r={name:e.descriptor.name,description:e.descriptor.description,unit:e.descriptor.unit},n=Ap(e.aggregationTemporality);switch(e.dataPointType){case H.SUM:r.sum={aggregationTemporality:n,isMonotonic:e.isMonotonic,dataPoints:ka(e,t)};break;case H.GAUGE:r.gauge={dataPoints:ka(e,t)};break;case H.HISTOGRAM:r.histogram={aggregationTemporality:n,dataPoints:Ep(e,t)};break;case H.EXPONENTIAL_HISTOGRAM:r.exponentialHistogram={aggregationTemporality:n,dataPoints:Sp(e,t)};break}return r}function gp(e,t,r){let n={attributes:xt(e.attributes,r),startTimeUnixNano:r.encodeHrTime(e.startTime),timeUnixNano:r.encodeHrTime(e.endTime)};switch(t){case K.INT:n.asInt=e.value;break;case K.DOUBLE:n.asDouble=e.value;break}return n}function ka(e,t){return e.dataPoints.map(r=>gp(r,e.descriptor.valueType,t))}function Ep(e,t){return e.dataPoints.map(r=>{let n=r.value;return{attributes:xt(r.attributes,t),bucketCounts:n.buckets.counts,explicitBounds:n.buckets.boundaries,count:n.count,sum:n.sum,min:n.min,max:n.max,startTimeUnixNano:t.encodeHrTime(r.startTime),timeUnixNano:t.encodeHrTime(r.endTime)}})}function Sp(e,t){return e.dataPoints.map(r=>{let n=r.value;return{attributes:xt(r.attributes,t),count:n.count,min:n.min,max:n.max,sum:n.sum,positive:{offset:n.positive.offset,bucketCounts:n.positive.bucketCounts},negative:{offset:n.negative.offset,bucketCounts:n.negative.bucketCounts},scale:n.scale,zeroCount:n.zeroCount,startTimeUnixNano:t.encodeHrTime(r.startTime),timeUnixNano:t.encodeHrTime(r.endTime)}})}function Ap(e){switch(e){case G.DELTA:return fr.AGGREGATION_TEMPORALITY_DELTA;case G.CUMULATIVE:return fr.AGGREGATION_TEMPORALITY_CUMULATIVE}}function Fa(e,t){return{resourceMetrics:e.map(r=>hp(r,t))}}function Rp(e){let t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function xp(e){return Rp(e).toString()}var Op=typeof BigInt<"u"?xp:J;function $a(e){return e}var xe={encodeHrTime:Op,encodeSpanContext:$a,encodeOptionalSpanContext:$a,encodeUint8Array:e=>{if(typeof Buffer<"u")return Buffer.from(e).toString("base64");let t=new Array(e.length);for(let r=0;r<e.length;r++)t[r]=String.fromCharCode(e[r]);return btoa(t.join(""))}};var bp=256,wp=512;function za(e,t){let r=e&255|bp;return t&&(r|=wp),r}function Lp(e,t){let r=e.spanContext(),n=e.status,o=e.parentSpanContext?.spanId?t.encodeSpanContext(e.parentSpanContext?.spanId):void 0;return{traceId:t.encodeSpanContext(r.traceId),spanId:t.encodeSpanContext(r.spanId),parentSpanId:o,traceState:r.traceState?.serialize(),name:e.name,kind:e.kind==null?0:e.kind+1,startTimeUnixNano:t.encodeHrTime(e.startTime),endTimeUnixNano:t.encodeHrTime(e.endTime),attributes:xt(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(i=>yp(i,t)),droppedEventsCount:e.droppedEventsCount,status:{code:n.code,message:n.message},links:e.links.map(i=>Np(i,t)),droppedLinksCount:e.droppedLinksCount,flags:za(r.traceFlags,e.parentSpanContext?.isRemote)}}function Np(e,t){return{attributes:e.attributes?xt(e.attributes,t):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:e.context.traceState?.serialize(),droppedAttributesCount:e.droppedAttributesCount||0,flags:za(e.context.traceFlags,e.context.isRemote)}}function yp(e,t){return{attributes:e.attributes?xt(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function Wa(e,t){return{resourceSpans:Pp(e,t)}}function Cp(e){let t=new Map;for(let r of e){let n=t.get(r.resource);n||(n=new Map,t.set(r.resource,n));let o=`${r.instrumentationScope.name}@${r.instrumentationScope.version||""}:${r.instrumentationScope.schemaUrl||""}`,i=n.get(o);i||(i=[],n.set(o,i)),i.push(r)}return t}function Pp(e,t){let r=Cp(e),n=[],o=r.entries(),i=o.next();for(;!i.done;){let[s,a]=i.value,c=[],u=a.values(),p=u.next();for(;!p.done;){let m=p.value;if(m.length>0){let d=m.map(h=>Lp(h,t));c.push({scope:Re(m[0].instrumentationScope),spans:d,schemaUrl:m[0].instrumentationScope.schemaUrl})}p=u.next()}let _=Ae(s,t),f={resource:_,scopeSpans:c,schemaUrl:_.schemaUrl};n.push(f),i=o.next()}return n}function ja(e,t){return{resourceLogs:Mp(e,t)}}function Ip(e){let t=new Map;for(let r of e){let{resource:n,instrumentationScope:{name:o,version:i="",schemaUrl:s=""}}=r,a=t.get(n);a||(a=new Map,t.set(n,a));let c=`${o}@${i}:${s}`,u=a.get(c);u||(u=[],a.set(c,u)),u.push(r)}return t}function Mp(e,t){let r=Ip(e);return Array.from(r,([n,o])=>{let i=Ae(n,t);return{resource:i,scopeLogs:Array.from(o,([,s])=>({scope:Re(s[0].instrumentationScope),logRecords:s.map(a=>vp(a,t)),schemaUrl:s[0].instrumentationScope.schemaUrl})),schemaUrl:i.schemaUrl}})}function vp(e,t){return{timeUnixNano:t.encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:e.severityNumber,severityText:e.severityText,body:Tr(e.body,t),eventName:e.eventName,attributes:Dp(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,flags:e.spanContext?.traceFlags,traceId:t.encodeOptionalSpanContext(e.spanContext?.traceId),spanId:t.encodeOptionalSpanContext(e.spanContext?.spanId)}}function Dp(e,t){return Object.keys(e).map(r=>ji(r,e[r],t))}var ro={serializeRequest:e=>{let t=ja(e,xe);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(r){return l.warn(`Failed to parse logs export response: ${r.message}. Returning empty response`),{}}}};var no={serializeRequest:e=>{let t=Fa([e],xe);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(r){return l.warn(`Failed to parse metrics export response: ${r.message}. Returning empty response`),{}}}};var oo={serializeRequest:e=>{let t=Wa(e,xe);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(r){return l.warn(`Failed to parse trace export response: ${r.message}. Returning empty response`),{}}}};var Ki=5,Up=1e3,Bp=5e3,Gp=1.5,Ka=.2;function Hp(){return Math.random()*(2*Ka)-Ka}var Xi=class{_transport;constructor(t){this._transport=t}retry(t,r,n){return new Promise((o,i)=>{setTimeout(()=>{this._transport.send(t,r).then(o,i)},n)})}async send(t,r){let n=Ki,o=Up,i=Date.now()+r,s=await this._transport.send(t,r);for(;s.status==="retryable"&&n>0;){n--;let a=Math.max(Math.min(o*(1+Hp()),Bp),0);o=o*Gp;let c=s.retryInMillis??a,u=i-Date.now();if(c>u)return l.info(`Export retry time ${Math.round(c)}ms exceeds remaining timeout ${Math.round(u)}ms, not retrying further.`),s;l.verbose(`Scheduling export retry in ${Math.round(c)}ms`),s=await this.retry(t,u,c)}return s.status==="success"?l.verbose(`Export succeeded after ${Ki-n} retry attempts.`):s.status==="retryable"?l.info(`Export failed after maximum retry attempts (${Ki}).`):l.info(`Export failed with non-retryable error: ${s.error}`),s}shutdown(){return this._transport.shutdown()}};function Xa(e){return new Xi(e.transport)}function Ya(e){return e===429||e===502||e===503||e===504}function qa(e){if(e==null)return;let t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?t*1e3:-1;let r=new Date(e).getTime()-Date.now();return r>=0?r:0}var Vp=60*1024,kp=9,Yi=0,io=0,qi=class{_parameters;constructor(t){this._parameters=t}async send(t,r){let n=new AbortController,o=setTimeout(()=>n.abort(),r),i=globalThis.fetch;typeof i.__original=="function"&&(i=i.__original);let s=t.byteLength,a=Yi+s>Vp,c=io>=kp,u=!a&&!c;if(u)Yi+=s,io++;else{let p=a?"size limit":"count limit";l.debug(`keepalive disabled: ${(s/1024).toFixed(1)}KB payload, ${io} pending (${p})`)}try{let p=new URL(this._parameters.url),_=await i(p.href,{method:"POST",headers:await this._parameters.headers(),body:t,signal:n.signal,keepalive:u,mode:globalThis.location?globalThis.location.origin===p.origin?"same-origin":"cors":"no-cors"});if(_.status>=200&&_.status<=299)return l.debug(`export response success (status: ${_.status})`),{status:"success"};if(Ya(_.status)){l.warn(`export response retryable (status: ${_.status})`);let f=_.headers.get("Retry-After");return{status:"retryable",retryInMillis:qa(f)}}return l.error(`export response failure (status: ${_.status})`),{status:"failure",error:new Error(`Fetch request failed with non-retryable status ${_.status}`)}}catch(p){return Fp(p)?(l.warn(`export request retryable (network error: ${p})`),{status:"retryable",error:new Error("Fetch request encountered a network error",{cause:p})}):(l.error(`export request failure (error: ${p})`),{status:"failure",error:new Error("Fetch request errored",{cause:p})})}finally{clearTimeout(o),u&&(Yi-=s,io--)}}shutdown(){}};function Qa(e){return new qi(e)}function Fp(e){return e instanceof TypeError&&!e.cause}function Ja(e,t){return xa(e,t,Xa({transport:Qa(e)}))}function Za(e){let t={};return Object.entries(e??{}).forEach(([r,n])=>{typeof n<"u"?t[r]=String(n):l.warn(`Header "${r}" has invalid value (${n}) and will be ignored`)}),t}function $p(e,t,r){return async()=>{let n={...await r()},o={};return t!=null&&Object.assign(o,await t()),e!=null&&Object.assign(o,Za(await e())),Object.assign(o,n)}}function zp(e){if(e!=null)try{let t=globalThis.location?.href;return new URL(e,t).href}catch{throw new Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function tc(e,t,r){return{...js(e,t,r),headers:$p(e.headers,t.headers,r.headers),url:zp(e.url)??t.url??r.url}}function ec(e,t){return{...Ks(),headers:async()=>e,url:"http://localhost:4318/"+t}}function rc(e){return typeof e.headers=="function"?e.headers:Ws(e.headers)}function nc(e,t,r){return tc({url:e.url,timeoutMillis:e.timeoutMillis,headers:rc(e),concurrencyLimit:e.concurrencyLimit},{},ec(r,t))}function Yt(e,t,r,n){let o=nc(e,r,n);return Ja(o,t)}var Oe=class extends At{constructor(t={}){super(Yt(t,ro,"v1/logs",{"Content-Type":"application/json"}))}};var gr;(function(e){e[e.DELTA=0]="DELTA",e[e.CUMULATIVE=1]="CUMULATIVE",e[e.LOWMEMORY=2]="LOWMEMORY"})(gr||(gr={}));var Qi=()=>G.CUMULATIVE,oc=e=>{switch(e){case T.COUNTER:case T.OBSERVABLE_COUNTER:case T.GAUGE:case T.HISTOGRAM:case T.OBSERVABLE_GAUGE:return G.DELTA;case T.UP_DOWN_COUNTER:case T.OBSERVABLE_UP_DOWN_COUNTER:return G.CUMULATIVE}},ic=e=>{switch(e){case T.COUNTER:case T.HISTOGRAM:return G.DELTA;case T.GAUGE:case T.UP_DOWN_COUNTER:case T.OBSERVABLE_UP_DOWN_COUNTER:case T.OBSERVABLE_COUNTER:case T.OBSERVABLE_GAUGE:return G.CUMULATIVE}};function Wp(){let e=(void 0??"cumulative").toLowerCase();return e==="cumulative"?Qi:e==="delta"?oc:e==="lowmemory"?ic:(l.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${e}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`),Qi)}function jp(e){return e!=null?e===gr.DELTA?oc:e===gr.LOWMEMORY?ic:Qi:Wp()}var Kp=Object.freeze({type:k.DEFAULT});function Xp(e){return e?.aggregationPreference??(()=>Kp)}var so=class extends At{_aggregationTemporalitySelector;_aggregationSelector;constructor(t,r){super(t),this._aggregationSelector=Xp(r),this._aggregationTemporalitySelector=jp(r?.temporalityPreference)}selectAggregation(t){return this._aggregationSelector(t)}selectAggregationTemporality(t){return this._aggregationTemporalitySelector(t)}};var be=class extends so{constructor(t){super(Yt(t??{},no,"v1/metrics",{"Content-Type":"application/json"}),t)}};var we=class extends At{constructor(t={}){super(Yt(t,oo,"v1/traces",{"Content-Type":"application/json"}))}};function sc(e){return Ji(e,new WeakSet)}function Ji(e,t){if(e==null||typeof e=="string"||typeof e=="number"||typeof e=="boolean"||e instanceof Uint8Array)return!0;if(typeof e=="object"){if(t.has(e))return!1;if(t.add(e),Array.isArray(e))return e.every(n=>Ji(n,t));let r=e;return r.constructor!==Object&&r.constructor!==void 0?!1:Object.values(r).every(n=>Ji(n,t))}return!1}var ao=class{hrTime;hrTimeObserved;spanContext;resource;instrumentationScope;attributes={};_severityText;_severityNumber;_body;_eventName;_attributesCount=0;_droppedAttributesCount=0;_isReadonly=!1;_logRecordLimits;set severityText(t){this._isLogRecordReadonly()||(this._severityText=t)}get severityText(){return this._severityText}set severityNumber(t){this._isLogRecordReadonly()||(this._severityNumber=t)}get severityNumber(){return this._severityNumber}set body(t){this._isLogRecordReadonly()||(this._body=t)}get body(){return this._body}get eventName(){return this._eventName}set eventName(t){this._isLogRecordReadonly()||(this._eventName=t)}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(t,r,n){let{timestamp:o,observedTimestamp:i,eventName:s,severityNumber:a,severityText:c,body:u,attributes:p={},exception:_,context:f}=n,m=Date.now();if(this.hrTime=ct(o??m),this.hrTimeObserved=ct(i??m),f){let d=A.getSpanContext(f);d&&z(d)&&(this.spanContext=d)}this.severityNumber=a,this.severityText=c,this.body=u,this.resource=t.resource,this.instrumentationScope=r,this._logRecordLimits=t.logRecordLimits,this._eventName=s,this.setAttributes(p),_!=null&&this._setException(_)}setAttribute(t,r){if(this._isLogRecordReadonly())return this;if(t.length===0)return l.warn(`Invalid attribute key: ${t}`),this;if(!sc(r))return l.warn(`Invalid attribute value set for key: ${t}`),this;let n=!Object.prototype.hasOwnProperty.call(this.attributes,t);return n&&this._attributesCount>=this._logRecordLimits.attributeCountLimit?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&l.warn("Dropping extra attributes."),this):(this.attributes[t]=this._truncateToSize(r),n&&this._attributesCount++,this)}setAttributes(t){for(let[r,n]of Object.entries(t))this.setAttribute(r,n);return this}setBody(t){return this.body=t,this}setEventName(t){return this.eventName=t,this}setSeverityNumber(t){return this.severityNumber=t,this}setSeverityText(t){return this.severityText=t,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(t){let r=this._logRecordLimits.attributeValueLengthLimit;if(r<=0)return l.warn(`Attribute value limit must be positive, got ${r}`),t;if(t==null)return t;if(typeof t=="string")return this._truncateToLimitUtil(t,r);if(t instanceof Uint8Array)return t;if(Array.isArray(t))return t.map(n=>this._truncateToSize(n));if(typeof t=="object"){let n={};for(let[o,i]of Object.entries(t))n[o]=this._truncateToSize(i);return n}return t}_setException(t){let r=!1;if(typeof t=="string"||typeof t=="number")Object.hasOwn(this.attributes,Q)||this.setAttribute(Q,String(t)),r=!0;else if(t&&typeof t=="object"){let n=t;n.code?(Object.hasOwn(this.attributes,et)||this.setAttribute(et,n.code.toString()),r=!0):n.name&&(Object.hasOwn(this.attributes,et)||this.setAttribute(et,n.name),r=!0),n.message&&(Object.hasOwn(this.attributes,Q)||this.setAttribute(Q,n.message),r=!0),n.stack&&(Object.hasOwn(this.attributes,jt)||this.setAttribute(jt,n.stack),r=!0)}r||l.warn(`Failed to record an exception ${t}`)}_truncateToLimitUtil(t,r){return t.length<=r?t:t.substring(0,r)}_isLogRecordReadonly(){return this._isReadonly&&l.warn("Can not execute the operation on emitted log record"),this._isReadonly}};var co=class{instrumentationScope;_sharedState;_loggerConfig;constructor(t,r){this.instrumentationScope=t,this._sharedState=r,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(t){let r=this._loggerConfig,n=t.context||E.active(),o=t.severityNumber??Y.UNSPECIFIED;if(o!==Y.UNSPECIFIED&&o<r.minimumSeverity)return;if(r.traceBased){let s=A.getSpanContext(n);if(s&&z(s)&&!((s.traceFlags&w.SAMPLED)===w.SAMPLED))return}let i=new ao(this._sharedState,this.instrumentationScope,{context:n,...t});this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(i,n),i._makeReadonly()}enabled(t){let r=this._loggerConfig;if(r.disabled)return!1;let n=t?.severityNumber;if(typeof n=="number"&&n!==Y.UNSPECIFIED&&n<r.minimumSeverity)return!1;let o=t?.context||E.active();if(r.traceBased){let s=A.getSpanContext(o);if(s&&z(s)&&!((s.traceFlags&w.SAMPLED)===w.SAMPLED))return!1}let i={context:o,instrumentationScope:this.instrumentationScope,severityNumber:t?.severityNumber,eventName:t?.eventName};for(let s of this._sharedState.processors)if(!s.enabled||s.enabled(i))return!0;return!1}};var uo=class{forceFlush(){return Promise.resolve()}onEmit(t,r){}shutdown(){return Promise.resolve()}enabled(t){return!1}};var lo=class{processors;forceFlushTimeoutMillis;constructor(t,r){this.processors=t,this.forceFlushTimeoutMillis=r}async forceFlush(){let t=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(r=>Oi(r.forceFlush(),t)))}onEmit(t,r){this.processors.forEach(n=>n.onEmit(t,r))}async shutdown(){await Promise.all(this.processors.map(t=>t.shutdown()))}enabled(t){for(let r of this.processors)if(!r.enabled||r.enabled(t))return!0;return!1}};function ac(e){return`${e.name}@${e.version||""}:${e.schemaUrl||""}`}var cc="otel.sdk.log.created";var po=class{createdLogs;constructor(t){this.createdLogs=t.createCounter(cc,{unit:"{log_record}",description:"The number of logs submitted to enabled SDK Loggers."})}emitLog(){this.createdLogs.add(1)}};var uc="0.215.0";var Yp={disabled:!1,minimumSeverity:Y.UNSPECIFIED,traceBased:!1},Zi=()=>({...Yp}),mo=class{loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];resource;forceFlushTimeoutMillis;logRecordLimits;processors;loggerMetrics;_loggerConfigurator;_loggerConfigs=new Map;constructor(t,r,n,o,i,s){this.resource=t,this.forceFlushTimeoutMillis=r,this.logRecordLimits=n,this.processors=o,o.length>0?(this.registeredLogRecordProcessors=o,this.activeProcessor=new lo(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new uo,this._loggerConfigurator=i??Zi;let a=s?s.getMeter("@opentelemetry/sdk-logs",uc):Ft();this.loggerMetrics=new po(a)}getLoggerConfig(t){let r=ac(t),n=this._loggerConfigs.get(r);return n||(n=this._loggerConfigurator(t),this._loggerConfigs.set(r,n),n)}};var qp="unknown",Er=class{_shutdownOnce;_sharedState;constructor(t={}){let r={resource:t.resource??Xt(),forceFlushTimeoutMillis:t.forceFlushTimeoutMillis??3e4,logRecordLimits:{attributeCountLimit:t.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:t.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:t.loggerConfigurator??Zi,processors:t.processors??[],meterProvider:t.meterProvider};this._sharedState=new mo(r.resource,r.forceFlushTimeoutMillis,r.logRecordLimits,r.processors,r.loggerConfigurator,r.meterProvider),this._shutdownOnce=new Rt(this._shutdown,this)}getLogger(t,r,n){if(this._shutdownOnce.isCalled)return l.warn("A shutdown LoggerProvider cannot provide a Logger"),ze;t||l.warn("Logger requested without instrumentation scope name.");let o=t||qp,i=`${o}@${r||""}:${n?.schemaUrl||""}`;return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new co({name:o,version:r,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(l.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(l.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}};async function Qp(e){let t=[];for(let r=0,n=e.length;r<n;r++){let o=e[r];o.resource.asyncAttributesPending&&o.resource.waitForAsyncAttributes&&t.push(o.resource.waitForAsyncAttributes())}t!=null&&t.length>0&&await Promise.all(t)}var _o=class{_exportCompleted;_exportScheduledPromise;_exportScheduledResolve;constructor(t,r,n){this._exportScheduledPromise=new Promise(o=>{this._exportScheduledResolve=o}),this._exportCompleted=this._executeExport(t,r,n)}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}async _executeExport(t,r,n){try{await Qp(r),await E.with(zt(E.active()),async()=>this._exportWithTimeout(t,r,n))}catch(o){C(o),this._exportScheduledResolve()}}async _exportWithTimeout(t,r,n){return new Promise((o,i)=>{let s=setTimeout(()=>{i(new Error("Timeout"))},n);t.export(r,a=>{clearTimeout(s),a.code===U.SUCCESS?o():i(a.error??new Error("BatchLogRecordProcessor: log record export failed"))}),this._exportScheduledResolve()})}},ho=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_currentExport=null;_finishedLogRecords=[];_timer;_shutdownOnce;_flushing=!1;constructor(t,r){this._exporter=t,this._maxExportBatchSize=r?.maxExportBatchSize??512,this._maxQueueSize=r?.maxQueueSize??2048,this._scheduledDelayMillis=r?.scheduledDelayMillis??5e3,this._exportTimeoutMillis=r?.exportTimeoutMillis??3e4,this._shutdownOnce=new Rt(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(l.warn("BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}onEmit(t){this._shutdownOnce.isCalled||this._addToBuffer(t)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}_addToBuffer(t){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(t),this._maybeStartTimer())}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}async _flushAll(){if(this._flushing)return;this._flushing=!0;let t=this._finishedLogRecords;for(this._finishedLogRecords=[],this._clearTimer(),this._currentExport!==null&&(await this._exporter.forceFlush(),await this._currentExport.exportCompleted,this._currentExport=null);t.length>0;){let r;t.length<=this._maxExportBatchSize?(r=t,t=[]):r=t.splice(0,this._maxExportBatchSize);let n=new _o(this._exporter,r,this._exportTimeoutMillis);this._currentExport=n;try{await n.exportScheduled,await this._exporter.forceFlush(),await n.exportCompleted}catch(o){C(o)}finally{this._currentExport=null}}this._flushing=!1,this._maybeStartTimer()}_extractBatch(){if(this._finishedLogRecords.length===0)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){let t=this._finishedLogRecords;return this._finishedLogRecords=[],t}else return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();let t=this._extractBatch();if(t===null)return;let r=new _o(this._exporter,t,this._exportTimeoutMillis);this._currentExport=r,r.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(n=>{this._currentExport=null,C(n),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)}};var Le=class extends ho{_visibilityChangeListener;_pageHideListener;constructor(t,r){super(t,r),this._onInit(r)}onShutdown(){typeof document>"u"||(this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener("pagehide",this._pageHideListener))}_onInit(t){t?.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))}};var lc="exception";var fo=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:X.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(t){let r=Date.now();if(this._spanContext=t.spanContext,this._performanceStartTime=N.now(),this._performanceOffset=r-(this._performanceStartTime+N.timeOrigin),this._startTimeProvided=t.startTime!=null,this._spanLimits=t.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=t.spanProcessor,this.name=t.name,this.parentSpanContext=t.parentSpanContext,this.kind=t.kind,t.links)for(let n of t.links)this.addLink(n);this.startTime=this._getTime(t.startTime??r),this.resource=t.resource,this.instrumentationScope=t.scope,this._recordEndMetrics=t.recordEndMetrics,t.attributes!=null&&this.setAttributes(t.attributes),this._spanProcessor.onStart(this,t.context)}spanContext(){return this._spanContext}setAttribute(t,r){if(r==null||this._isSpanEnded())return this;if(t.length===0)return l.warn(`Invalid attribute key: ${t}`),this;if(!an(r))return l.warn(`Invalid attribute value set for key: ${t}`),this;let{attributeCountLimit:n}=this._spanLimits,o=!Object.prototype.hasOwnProperty.call(this.attributes,t);return n!==void 0&&this._attributesCount>=n&&o?(this._droppedAttributesCount++,this):(this.attributes[t]=this._truncateToSize(r),o&&this._attributesCount++,this)}setAttributes(t){for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&this.setAttribute(r,t[r]);return this}addEvent(t,r,n){if(this._isSpanEnded())return this;let{eventCountLimit:o}=this._spanLimits;if(o===0)return l.warn("No events allowed."),this._droppedEventsCount++,this;o!==void 0&&this.events.length>=o&&(this._droppedEventsCount===0&&l.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),dn(r)&&(dn(n)||(n=r),r=void 0);let i=Pt(r),{attributePerEventCountLimit:s}=this._spanLimits,a={},c=0,u=0;for(let p in i){if(!Object.prototype.hasOwnProperty.call(i,p))continue;let _=i[p];if(s!==void 0&&u>=s){c++;continue}a[p]=this._truncateToSize(_),u++}return this.events.push({name:t,attributes:a,time:this._getTime(n),droppedAttributesCount:c}),this}addLink(t){if(this._isSpanEnded())return this;let{linkCountLimit:r}=this._spanLimits;if(r===0)return this._droppedLinksCount++,this;r!==void 0&&this.links.length>=r&&(this._droppedLinksCount===0&&l.debug("Dropping extra links."),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,o=Pt(t.attributes),i={},s=0,a=0;for(let u in o){if(!Object.prototype.hasOwnProperty.call(o,u))continue;let p=o[u];if(n!==void 0&&a>=n){s++;continue}i[u]=this._truncateToSize(p),a++}let c={context:t.context};return a>0&&(c.attributes=i),s>0&&(c.droppedAttributesCount=s),this.links.push(c),this}addLinks(t){for(let r of t)this.addLink(r);return this}setStatus(t){if(this._isSpanEnded())return this;if(t.code===X.UNSET)return this;if(this.status.code===X.OK)return this;let r={code:t.code};return t.code===X.ERROR&&(typeof t.message=="string"?r.message=t.message:t.message!=null&&l.warn(`Dropping invalid status.message of type '${typeof t.message}', expected 'string'`)),this.status=r,this}updateName(t){return this._isSpanEnded()?this:(this.name=t,this)}end(t){if(this._isSpanEnded()){l.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(t),this._duration=Ei(this.startTime,this.endTime),this._duration[0]<0&&(l.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&&l.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&l.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(t){if(typeof t=="number"&&t<=N.now())return I(t+this._performanceOffset);if(typeof t=="number")return P(t);if(t instanceof Date)return P(t.getTime());if(Ze(t))return t;if(this._startTimeProvided)return P(Date.now());let r=N.now()-this._performanceStartTime;return hn(this.startTime,P(r))}isRecording(){return this._ended===!1}recordException(t,r){let n={};typeof t=="string"?n[Q]=t:t&&(t.code?n[et]=t.code.toString():t.name&&(n[et]=t.name),t.message&&(n[Q]=t.message),t.stack&&(n[jt]=t.stack)),n[et]||n[Q]?this.addEvent(lc,n,r):l.warn(`Failed to record an exception ${t}`)}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 t=new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);l.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,t)}return this._ended}_truncateToLimitUtil(t,r){return t.length<=r?t:t.substring(0,r)}_truncateToSize(t){let r=this._attributeValueLengthLimit;return r<=0?(l.warn(`Attribute value limit must be positive, got ${r}`),t):typeof t=="string"?this._truncateToLimitUtil(t,r):Array.isArray(t)?t.map(n=>typeof n=="string"?this._truncateToLimitUtil(n,r):n):t}};var W;(function(e){e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(W||(W={}));var Bt=class{shouldSample(){return{decision:W.NOT_RECORD}}toString(){return"AlwaysOffSampler"}};var pt=class{shouldSample(){return{decision:W.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}};var qt=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(t){this._root=t.root,this._root||(C(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new pt),this._remoteParentSampled=t.remoteParentSampled??new pt,this._remoteParentNotSampled=t.remoteParentNotSampled??new Bt,this._localParentSampled=t.localParentSampled??new pt,this._localParentNotSampled=t.localParentNotSampled??new Bt}shouldSample(t,r,n,o,i,s){let a=A.getSpanContext(t);return!a||!z(a)?this._root.shouldSample(t,r,n,o,i,s):a.isRemote?a.traceFlags&w.SAMPLED?this._remoteParentSampled.shouldSample(t,r,n,o,i,s):this._remoteParentNotSampled.shouldSample(t,r,n,o,i,s):a.traceFlags&w.SAMPLED?this._localParentSampled.shouldSample(t,r,n,o,i,s):this._localParentNotSampled.shouldSample(t,r,n,o,i,s)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}};var Gt=class{_ratio;_upperBound;constructor(t=0){this._ratio=this._normalize(t),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(t,r){return{decision:Yr(r)&&this._accumulate(r)<this._upperBound?W.RECORD_AND_SAMPLED:W.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(t){return typeof t!="number"||isNaN(t)?0:t>=1?1:t<=0?0:t}_accumulate(t){let r=0;for(let n=0;n<t.length/8;n++){let o=n*8,i=parseInt(t.slice(o,o+8),16);r=(r^i)>>>0}return r}};var mt;(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"})(mt||(mt={}));var To=1;function go(){return{sampler:ts(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:void 0??1/0,attributeCountLimit:void 0??128},spanLimits:{attributeValueLengthLimit:void 0??1/0,attributeCountLimit:void 0??128,linkCountLimit:void 0??128,eventCountLimit:void 0??128,attributePerEventCountLimit:void 0??128,attributePerLinkCountLimit:void 0??128}}}function ts(){let e=void 0??mt.ParentBasedAlwaysOn;switch(e){case mt.AlwaysOn:return new pt;case mt.AlwaysOff:return new Bt;case mt.ParentBasedAlwaysOn:return new qt({root:new pt});case mt.ParentBasedAlwaysOff:return new qt({root:new Bt});case mt.TraceIdRatio:return new Gt(pc());case mt.ParentBasedTraceIdRatio:return new qt({root:new Gt(pc())});default:return l.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${mt.ParentBasedAlwaysOn}".`),new qt({root:new pt})}}function pc(){let e=void 0;return e==null?(l.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${To}.`),To):e<0||e>1?(l.error(`OTEL_TRACES_SAMPLER_ARG=${e} was given, but it is out of range ([0..1]), defaulting to ${To}.`),To):e}var Jp=128,Zp=1/0;function mc(e){let t={sampler:ts()},r=go(),n=Object.assign({},r,t,e);return n.generalLimits=Object.assign({},r.generalLimits,e.generalLimits||{}),n.spanLimits=Object.assign({},r.spanLimits,e.spanLimits||{}),n}function _c(e){let t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??void 0??void 0??Jp,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??void 0??void 0??Zp,Object.assign({},e,{spanLimits:t})}var Eo=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(t,r){this._exporter=t,this._maxExportBatchSize=typeof r?.maxExportBatchSize=="number"?r.maxExportBatchSize:void 0??512,this._maxQueueSize=typeof r?.maxQueueSize=="number"?r.maxQueueSize:void 0??2048,this._scheduledDelayMillis=typeof r?.scheduledDelayMillis=="number"?r.scheduledDelayMillis:void 0??5e3,this._exportTimeoutMillis=typeof r?.exportTimeoutMillis=="number"?r.exportTimeoutMillis:void 0??3e4,this._shutdownOnce=new Rt(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(l.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(t,r){}onEnd(t){this._shutdownOnce.isCalled||(t.spanContext().traceFlags&w.SAMPLED)!==0&&this._addToBuffer(t)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(t){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&l.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(l.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(t),this._maybeStartTimer()}_flushAll(){return new Promise((t,r)=>{let n=[],o=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let i=0,s=o;i<s;i++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{t()}).catch(r)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((t,r)=>{let n=setTimeout(()=>{r(new Error("Timeout"))},this._exportTimeoutMillis);E.with(zt(E.active()),()=>{let o;this._finishedSpans.length<=this._maxExportBatchSize?(o=this._finishedSpans,this._finishedSpans=[]):o=this._finishedSpans.splice(0,this._maxExportBatchSize);let i=()=>this._exporter.export(o,a=>{clearTimeout(n),a.code===U.SUCCESS?t():r(a.error??new Error("BatchSpanProcessor: span export failed"))}),s=null;for(let a=0,c=o.length;a<c;a++){let u=o[a];u.resource.asyncAttributesPending&&u.resource.waitForAsyncAttributes&&(s??=[],s.push(u.resource.waitForAsyncAttributes()))}s===null?i():Promise.all(s).then(i,a=>{C(a),r(a)})})})}_maybeStartTimer(){if(this._isExporting)return;let t=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(r=>{this._isExporting=!1,C(r)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return t();this._timer===void 0&&(this._timer=setTimeout(()=>t(),this._scheduledDelayMillis),typeof this._timer!="number"&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}};var Ne=class extends Eo{_visibilityChangeListener;_pageHideListener;constructor(t,r){super(t,r),this.onInit(r)}onInit(t){t?.disableAutoFlushOnDocumentHide!==!0&&typeof document<"u"&&(this._visibilityChangeListener=()=>{document.visibilityState==="hidden"&&this.forceFlush().catch(r=>{C(r)})},this._pageHideListener=()=>{this.forceFlush().catch(r=>{C(r)})},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))}};var dc=new Uint8Array(16),hc=new Uint8Array(8),tm=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function fc(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 Tc(e){let t="";for(let r=0;r<e.length;r++)t+=tm[e[r]];return t}var ye=class{generateTraceId(){return fc(dc),Tc(dc)}generateSpanId(){return fc(hc),Tc(hc)}};var gc="otel.span.parent.origin",es="otel.span.sampling_result",Ec="otel.sdk.span.live",Sc="otel.sdk.span.started";var So=class{startedSpans;liveSpans;constructor(t){this.startedSpans=t.createCounter(Sc,{unit:"{span}",description:"The number of created spans."}),this.liveSpans=t.createUpDownCounter(Ec,{unit:"{span}",description:"The number of currently live spans."})}startSpan(t,r){let n=rm(r);if(this.startedSpans.add(1,{[gc]:em(t),[es]:n}),r===W.NOT_RECORD)return()=>{};let o={[es]:n};return this.liveSpans.add(1,o),()=>{this.liveSpans.add(-1,o)}}};function em(e){return e?e.isRemote?"remote":"local":"none"}function rm(e){switch(e){case W.RECORD_AND_SAMPLED:return"RECORD_AND_SAMPLE";case W.RECORD:return"RECORD_ONLY";case W.NOT_RECORD:return"DROP"}}var Ac="2.7.0";var Ao=class{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(t,r,n,o){let i=mc(r);this._sampler=i.sampler,this._generalLimits=i.generalLimits,this._spanLimits=i.spanLimits,this._idGenerator=r.idGenerator||new ye,this._resource=n,this._spanProcessor=o,this.instrumentationScope=t;let s=i.meterProvider?i.meterProvider.getMeter("@opentelemetry/sdk-trace",Ac):Ft();this._tracerMetrics=new So(s)}startSpan(t,r={},n=E.active()){r.root&&(n=A.deleteSpan(n));let o=A.getSpan(n);if(Wt(n))return l.debug("Instrumentation suppressed, returning Noop Span"),A.wrapSpanContext(ke);let i=o?.spanContext(),s=this._idGenerator.generateSpanId(),a,c,u;!i||!A.isSpanContextValid(i)?c=this._idGenerator.generateTraceId():(c=i.traceId,u=i.traceState,a=i);let p=r.kind??Et.INTERNAL,_=(r.links??[]).map(V=>({context:V.context,attributes:Pt(V.attributes)})),f=Pt(r.attributes),m=this._sampler.shouldSample(n,c,t,p,f,_),d=this._tracerMetrics.startSpan(i,m.decision);u=m.traceState??u;let h=m.decision===oe.RECORD_AND_SAMPLED?w.SAMPLED:w.NONE,g={traceId:c,spanId:s,traceFlags:h,traceState:u};if(m.decision===oe.NOT_RECORD)return l.debug("Recording is off, propagating context in a non-recording span"),A.wrapSpanContext(g);let b=Pt(Object.assign(f,m.attributes));return new fo({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:g,name:t,kind:p,links:_,parentSpanContext:a,attributes:b,startTime:r.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:d})}startActiveSpan(t,r,n,o){let i,s,a;if(arguments.length<2)return;arguments.length===2?a=r:arguments.length===3?(i=r,a=n):(i=r,s=n,a=o);let c=s??E.active(),u=this.startSpan(t,i,c),p=A.setSpan(c,u);return E.with(p,a,void 0,u)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}};var Ro=class{_spanProcessors;constructor(t){this._spanProcessors=t}forceFlush(){let t=[];for(let r of this._spanProcessors)t.push(r.forceFlush());return new Promise(r=>{Promise.all(t).then(()=>{r()}).catch(n=>{C(n||new Error("MultiSpanProcessor: forceFlush failed")),r()})})}onStart(t,r){for(let n of this._spanProcessors)n.onStart(t,r)}onEnding(t){for(let r of this._spanProcessors)r.onEnding&&r.onEnding(t)}onEnd(t){for(let r of this._spanProcessors)r.onEnd(t)}shutdown(){let t=[];for(let r of this._spanProcessors)t.push(r.shutdown());return new Promise((r,n)=>{Promise.all(t).then(()=>{r()},n)})}};var Qt;(function(e){e[e.resolved=0]="resolved",e[e.timeout=1]="timeout",e[e.error=2]="error",e[e.unresolved=3]="unresolved"})(Qt||(Qt={}));var Sr=class{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(t={}){let r=xi({},go(),_c(t));this._resource=r.resource??Xt(),this._config=Object.assign({},r,{resource:this._resource});let n=[];t.spanProcessors?.length&&n.push(...t.spanProcessors),this._activeSpanProcessor=new Ro(n)}getTracer(t,r,n){let o=`${t}@${r||""}:${n?.schemaUrl||""}`;return this._tracers.has(o)||this._tracers.set(o,new Ao({name:t,version:r,schemaUrl:n?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(o)}forceFlush(){let t=this._config.forceFlushTimeoutMillis,r=this._activeSpanProcessor._spanProcessors.map(n=>new Promise(o=>{let i,s=setTimeout(()=>{o(new Error(`Span processor did not completed within timeout period of ${t} ms`)),i=Qt.timeout},t);n.forceFlush().then(()=>{clearTimeout(s),i!==Qt.timeout&&(i=Qt.resolved,o(i))}).catch(a=>{clearTimeout(s),i=Qt.error,o(a)})}));return new Promise((n,o)=>{Promise.all(r).then(i=>{let s=i.filter(a=>a!==Qt.resolved);s.length>0?o(s):n()}).catch(i=>o([i]))})}shutdown(){return this._activeSpanProcessor.shutdown()}};var xo=class{_enabled=!1;_currentContext=B;_bindFunction(t=B,r){let n=this,o=function(...i){return n.with(t,()=>r.apply(this,i))};return Object.defineProperty(o,"length",{enumerable:!1,configurable:!0,writable:!1,value:r.length}),o}active(){return this._currentContext}bind(t,r){return t===void 0&&(t=this.active()),typeof r=="function"?this._bindFunction(t,r):r}disable(){return this._currentContext=B,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=B,this)}with(t,r,n,...o){let i=this._currentContext;this._currentContext=t||B;try{return r.call(n,...o)}finally{this._currentContext=i}}};function nm(e){if(e!==null){if(e===void 0){let t=new xo;t.enable(),E.setGlobalContextManager(t);return}e.enable(),E.setGlobalContextManager(e)}}function om(e){if(e!==null){if(e===void 0){D.setGlobalPropagator(new tr({propagators:[new er,new Xe]}));return}D.setGlobalPropagator(e)}}var Ar=class extends Sr{constructor(t={}){super(t)}register(t={}){A.setGlobalTracerProvider(this),om(t.propagator),nm(t.contextManager)}};var S;(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"})(S||(S={}));var Rc="http.response_content_length",xc="http.response_content_length_uncompressed";var rs;function im(){return rs||(rs=document.createElement("a")),rs}function Ot(e,t){return t in e}function L(e,t,r,n=!0){if(Ot(r,t)&&typeof r[t]=="number"&&!(n&&r[t]===0))return e.addEvent(t,r[t])}function _t(e,t,r=!1,n,o){if(n===void 0&&(n=t[S.START_TIME]!==0),r||(L(e,S.FETCH_START,t,n),L(e,S.DOMAIN_LOOKUP_START,t,n),L(e,S.DOMAIN_LOOKUP_END,t,n),L(e,S.CONNECT_START,t,n),L(e,S.SECURE_CONNECTION_START,t,n),L(e,S.CONNECT_END,t,n),L(e,S.REQUEST_START,t,n),L(e,S.RESPONSE_START,t,n),L(e,S.RESPONSE_END,t,n)),!o){let i=t[S.ENCODED_BODY_SIZE];i!==void 0&&e.setAttribute(Rc,i);let s=t[S.DECODED_BODY_SIZE];s!==void 0&&i!==s&&e.setAttribute(xc,s)}}function Oc(e){return e.slice().sort((t,r)=>{let n=t[S.FETCH_START],o=r[S.FETCH_START];return n>o?1:n<o?-1:0})}function bc(){return typeof location<"u"?location.origin:void 0}function Rr(e,t,r,n,o=new WeakSet,i){let s=tt(e);e=s.toString();let a=am(e,t,r,n,o,i);if(a.length===0)return{mainRequest:void 0};if(a.length===1)return{mainRequest:a[0]};let c=Oc(a);if(s.origin!==bc()&&c.length>1){let u=c[0],p=sm(c,u[S.RESPONSE_END],r),_=u[S.RESPONSE_END];return p[S.FETCH_START]<_&&(p=u,u=void 0),{corsPreFlightRequest:u,mainRequest:p}}else return{mainRequest:a[0]}}function sm(e,t,r){let n=J(r),o=J(ct(t)),i=e[1],s,a=e.length;for(let c=1;c<a;c++){let u=e[c],p=J(ct(u[S.FETCH_START])),_=J(ct(u[S.RESPONSE_END])),f=n-_;p>=o&&(!s||f<s)&&(s=f,i=u)}return i}function am(e,t,r,n,o,i){let s=J(t),a=J(r),c=n.filter(u=>{let p=J(ct(u[S.FETCH_START])),_=J(ct(u[S.RESPONSE_END]));return u.initiatorType.toLowerCase()===(i||"xmlhttprequest")&&u.name===e&&p>=s&&_<=a});return c.length>0&&(c=c.filter(u=>!o.has(u))),c}function tt(e){if(typeof URL=="function")return new URL(e,typeof document<"u"?document.baseURI:typeof location<"u"?location.href:void 0);let t=im();return t.href=e,t}function Oo(e,t){if(e.nodeType===Node.DOCUMENT_NODE)return"/";let r=um(e,t);if(t&&r.indexOf("@id")>0)return r;let n="";return e.parentNode&&(n+=Oo(e.parentNode,t)),n+=r,n}function cm(e){if(!e.parentNode)return 0;let t=[e.nodeType];e.nodeType===Node.CDATA_SECTION_NODE&&t.push(Node.TEXT_NODE);let r=Array.from(e.parentNode.childNodes);return r=r.filter(n=>{let o=n.localName;return t.indexOf(n.nodeType)>=0&&o===e.localName}),r.length>=1?r.indexOf(e)+1:0}function um(e,t){let r=e.nodeType,n=cm(e),o="";if(r===Node.ELEMENT_NODE){let i=e.getAttribute("id");if(t&&i)return`//*[@id="${i}"]`;o=e.localName}else if(r===Node.TEXT_NODE||r===Node.CDATA_SECTION_NODE)o="text()";else if(r===Node.COMMENT_NODE)o="comment()";else return"";return o&&n>1?`/${o}[${n}]`:`/${o}`}function xr(e,t){let r=t||[];return(typeof r=="string"||r instanceof RegExp)&&(r=[r]),tt(e).origin===bc()?!0:r.some(o=>An(e,o))}function wc(e,t,r,n){for(let o=0,i=e.length;o<i;o++){let s=e[o];t&&s.setTracerProvider(t),r&&s.setMeterProvider(r),n&&s.setLoggerProvider&&s.setLoggerProvider(n),s.getConfig().enabled||s.enable()}}function Lc(e){e.forEach(t=>t.disable())}function ns(e){let t=e.tracerProvider||A.getTracerProvider(),r=e.meterProvider||$t.getMeterProvider(),n=e.loggerProvider||Ct.getLoggerProvider(),o=e.instrumentations?.flat()??[];return wc(o,t,r,n),()=>{Lc(o)}}var F=console.error.bind(console);function Or(e,t,r){let n=!!e[t]&&Object.prototype.propertyIsEnumerable.call(e,t);Object.defineProperty(e,t,{configurable:!0,enumerable:n,writable:!0,value:r})}var bo=(e,t,r)=>{if(!e||!e[t]){F("no original function "+String(t)+" to wrap");return}if(!r){F("no wrapper function"),F(new Error().stack);return}let n=e[t];if(typeof n!="function"||typeof r!="function"){F("original object and wrapper must be functions");return}let o=r(n,t);return Or(o,"__original",n),Or(o,"__unwrap",()=>{e[t]===o&&Or(e,t,n)}),Or(o,"__wrapped",!0),Or(e,t,o),o},os=(e,t,r)=>{if(e)Array.isArray(e)||(e=[e]);else{F("must provide one or more modules to patch"),F(new Error().stack);return}if(!(t&&Array.isArray(t))){F("must provide one or more functions to wrap on modules");return}e.forEach(n=>{t.forEach(o=>{bo(n,o,r)})})},wo=(e,t)=>{if(!e||!e[t]){F("no function to unwrap."),F(new Error().stack);return}let r=e[t];if(!r.__unwrap)F("no original to unwrap to -- has "+String(t)+" already been unwrapped?");else{r.__unwrap();return}},is=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{F("must provide one or more modules to patch"),F(new Error().stack);return}if(!(t&&Array.isArray(t))){F("must provide one or more functions to unwrap on modules");return}e.forEach(r=>{t.forEach(n=>{wo(r,n)})})};function br(e){e&&e.logger&&(typeof e.logger!="function"?F("new logger isn't a function, not replacing"):F=e.logger)}br.wrap=bo;br.massWrap=os;br.unwrap=wo;br.massUnwrap=is;var Lo=class{_config={};_tracer;_meter;_logger;_diag;instrumentationName;instrumentationVersion;constructor(t,r,n){this.instrumentationName=t,this.instrumentationVersion=r,this.setConfig(n),this._diag=l.createComponentLogger({namespace:t}),this._tracer=A.getTracer(t,r),this._meter=$t.getMeter(t,r),this._logger=Ct.getLogger(t,r),this._updateMetricInstruments()}_wrap=bo;_unwrap=wo;_massWrap=os;_massUnwrap=is;get meter(){return this._meter}setMeterProvider(t){this._meter=t.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(t){this._logger=t.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let t=this.init()??[];return Array.isArray(t)?t:[t]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(t){this._config={enabled:!0,...t}}setTracerProvider(t){this._tracer=t.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(t,r,n,o){if(t)try{t(n,o)}catch(i){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:r},i)}}};var M=class extends Lo{constructor(t,r,n){super(t,r,n),this._config.enabled&&this.enable()}};function rt(e,t,r){let n,o;try{o=e()}catch(i){n=i}finally{if(t(n,o),n&&!r)throw n;return o}}function No(e){return typeof e=="function"&&typeof e.__original=="function"&&typeof e.__unwrap=="function"&&e.__wrapped===!0}var R;(function(e){e[e.STABLE=1]="STABLE",e[e.OLD=2]="OLD",e[e.DUPLICATE=3]="DUPLICATE"})(R||(R={}));function Jt(e,t){let r=R.OLD,n=t?.split(",").map(o=>o.trim()).filter(o=>o!=="");for(let o of n??[])if(o.toLowerCase()===e+"/dup"){r=R.DUPLICATE;break}else o.toLowerCase()===e&&(r=R.STABLE);return r}var Zt;(function(e){e.DOCUMENT_LOAD="documentLoad",e.DOCUMENT_FETCH="documentFetch",e.RESOURCE_FETCH="resourceFetch"})(Zt||(Zt={}));var Nc="0.60.0",yc="@opentelemetry/instrumentation-document-load";var yo="http.url",Cc="http.user_agent";var wr;(function(e){e.FIRST_PAINT="firstPaint",e.FIRST_CONTENTFUL_PAINT="firstContentfulPaint"})(wr||(wr={}));var Ic=()=>{let e={},t=N.getEntriesByType?.("navigation")[0];if(t)Object.values(S).forEach(n=>{if(Ot(t,n)){let o=t[n];typeof o=="number"&&(e[n]=o)}});else{let n=N.timing;n&&Object.values(S).forEach(i=>{if(Ot(n,i)){let s=n[i];typeof s=="number"&&(e[i]=s)}})}return e},Pc={"first-paint":wr.FIRST_PAINT,"first-contentful-paint":wr.FIRST_CONTENTFUL_PAINT},Mc=e=>{let t=N.getEntriesByType?.("paint");t&&t.forEach(({name:r,startTime:n})=>{Ot(Pc,r)&&e.addEvent(Pc[r],n)})};var Lr=class extends M{component="document-load";version="1";moduleName=this.component;_semconvStability;constructor(t={}){super(yc,Nc,t),this._semconvStability=Jt("http",t?.semconvStabilityOptIn)}init(){}_onDocumentLoaded(){window.setTimeout(()=>{this._collectPerformance()})}_addResourcesSpans(t){let r=N.getEntriesByType?.("resource");r&&r.forEach(n=>{this._initResourceSpan(n,t)})}_collectPerformance(){let t=Array.from(document.getElementsByTagName("meta")).find(o=>o.getAttribute("name")===ce),r=Ic(),n=t&&t.content||"";E.with(D.extract(B,{traceparent:n}),()=>{let o=this._startSpan(Zt.DOCUMENT_LOAD,S.FETCH_START,r);o&&(E.with(A.setSpan(E.active(),o),()=>{let i=this._startSpan(Zt.DOCUMENT_FETCH,S.FETCH_START,r);i&&(this._semconvStability&R.OLD&&i.setAttribute(yo,location.href),this._semconvStability&R.STABLE&&i.setAttribute(It,location.href),E.with(A.setSpan(E.active(),i),()=>{let s=!(this._semconvStability&R.OLD);_t(i,r,this.getConfig().ignoreNetworkEvents,void 0,s),this._addCustomAttributesOnSpan(i,this.getConfig().applyCustomAttributesOnSpan?.documentFetch),this._endSpan(i,S.RESPONSE_END,r)}))}),this._semconvStability&R.OLD&&(o.setAttribute(yo,location.href),o.setAttribute(Cc,navigator.userAgent)),this._semconvStability&R.STABLE&&(o.setAttribute(It,location.href),o.setAttribute(oa,navigator.userAgent)),this._addResourcesSpans(o),this.getConfig().ignoreNetworkEvents||(L(o,S.FETCH_START,r),L(o,S.UNLOAD_EVENT_START,r),L(o,S.UNLOAD_EVENT_END,r),L(o,S.DOM_INTERACTIVE,r),L(o,S.DOM_CONTENT_LOADED_EVENT_START,r),L(o,S.DOM_CONTENT_LOADED_EVENT_END,r),L(o,S.DOM_COMPLETE,r),L(o,S.LOAD_EVENT_START,r),L(o,S.LOAD_EVENT_END,r)),this.getConfig().ignorePerformancePaintEvents||Mc(o),this._addCustomAttributesOnSpan(o,this.getConfig().applyCustomAttributesOnSpan?.documentLoad),this._endSpan(o,S.LOAD_EVENT_END,r))})}_endSpan(t,r,n){t&&(Ot(n,r)?t.end(n[r]):t.end())}_initResourceSpan(t,r){let n=this._startSpan(Zt.RESOURCE_FETCH,S.FETCH_START,t,r);if(n){this._semconvStability&R.OLD&&n.setAttribute(yo,t.name),this._semconvStability&R.STABLE&&n.setAttribute(It,t.name);let o=!(this._semconvStability&R.OLD);_t(n,t,this.getConfig().ignoreNetworkEvents,void 0,o),this._addCustomAttributesOnResourceSpan(n,t,this.getConfig().applyCustomAttributesOnSpan?.resourceFetch),this._endSpan(n,S.RESPONSE_END,t)}}_startSpan(t,r,n,o){if(Ot(n,r)&&typeof n[r]=="number")return this.tracer.startSpan(t,{startTime:n[r]},o?A.setSpan(E.active(),o):void 0)}_waitForPageLoad(){window.document.readyState==="complete"?this._onDocumentLoaded():(this._onDocumentLoaded=this._onDocumentLoaded.bind(this),window.addEventListener("load",this._onDocumentLoaded))}_addCustomAttributesOnSpan(t,r){r&&rt(()=>r(t),n=>{n&&this._diag.error("addCustomAttributesOnSpan",n)},!0)}_addCustomAttributesOnResourceSpan(t,r,n){n&&rt(()=>n(t,r),o=>{o&&this._diag.error("addCustomAttributesOnResourceSpan",o)},!0)}enable(){window.removeEventListener("load",this._onDocumentLoaded),this._waitForPageLoad()}disable(){window.removeEventListener("load",this._onDocumentLoaded)}};var Nr;(function(e){e.COMPONENT="component",e.HTTP_STATUS_TEXT="http.status_text"})(Nr||(Nr={}));var vc="http.host",Dc="http.method",Uc="http.request.body.size",Bc="http.request_content_length_uncompressed";var Gc="http.scheme",Hc="http.status_code",Vc="http.url",kc="http.user_agent";var Fc=l.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-fetch/utils"});function $c(...e){if(e[0]instanceof URL||typeof e[0]=="string"){let t=e[1];if(!t?.body)return Promise.resolve();if(t.body instanceof ReadableStream){let{body:r,length:n}=mm(t.body);return t.body=r,n}else return Promise.resolve(dm(t.body))}else{let t=e[0];return t?.body?t.clone().text().then(r=>ss(r)):Promise.resolve()}}function mm(e){if(!e.pipeThrough)return Fc.warn("Platform has ReadableStream but not pipeThrough!"),{body:e,length:Promise.resolve(void 0)};let t=0,r,n=new Promise(i=>{r=i}),o=new TransformStream({start(){},async transform(i,s){let a=await i;t+=a.byteLength,s.enqueue(i)},flush(){r(t)}});return{body:e.pipeThrough(o),length:n}}function _m(e){return typeof Document<"u"&&e instanceof Document}function dm(e){if(_m(e))return new XMLSerializer().serializeToString(document).length;if(typeof e=="string")return ss(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return fm(e);if(e instanceof URLSearchParams)return ss(e.toString());if(e.byteLength!==void 0)return e.byteLength;Fc.warn("unknown body type")}var hm=new TextEncoder;function ss(e){return hm.encode(e).byteLength}function fm(e){let t=0;for(let[r,n]of e.entries())t+=r.length,n instanceof Blob?t+=n.size:t+=n.length;return t}function zc(e){let t=gm(),r=e.toUpperCase();return r in t?r:"_OTHER"}var Tm={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},yr;function gm(){if(yr===void 0){let e=void 0;e&&e.length>0?(yr={},e.forEach(t=>{yr[t]=!0})):yr=Tm}return yr}var Em={"https:":"443","http:":"80"};function Wc(e){let t=Number(e.port||Em[e.protocol]);if(t&&!isNaN(t))return t}var as="0.215.0";var Sm=300,jc=typeof PerformanceObserver<"u",Cr=class extends M{component="fetch";version=as;moduleName=this.component;_usedResources=new WeakSet;_tasksCount=0;_semconvStability;constructor(t={}){super("@opentelemetry/instrumentation-fetch",as,t),this._semconvStability=Jt("http",t?.semconvStabilityOptIn)}init(){}_addChildSpan(t,r){let n=this.tracer.startSpan("CORS Preflight",{startTime:r[S.FETCH_START]},A.setSpan(E.active(),t)),o=!(this._semconvStability&R.OLD);_t(n,r,this.getConfig().ignoreNetworkEvents,void 0,o),n.end(r[S.RESPONSE_END])}_addFinalSpanAttributes(t,r){let n=tt(r.url);if(this._semconvStability&R.OLD&&(t.setAttribute(Hc,r.status),r.statusText!=null&&t.setAttribute(Nr.HTTP_STATUS_TEXT,r.statusText),t.setAttribute(vc,n.host),t.setAttribute(Gc,n.protocol.replace(":","")),typeof navigator<"u"&&t.setAttribute(kc,navigator.userAgent)),this._semconvStability&R.STABLE){t.setAttribute(ln,r.status),t.setAttribute(pn,n.hostname);let o=Wc(n);o&&t.setAttribute(mn,o)}}_addHeaders(t,r){if(!xr(r,this.getConfig().propagateTraceHeaderCorsUrls)){let n={};D.inject(E.active(),n),Object.keys(n).length>0&&this._diag.debug("headers inject skipped due to CORS policy");return}if(t instanceof Request)D.inject(E.active(),t.headers,{set:(n,o,i)=>n.set(o,typeof i=="string"?i:String(i))});else{let n=new Headers(t.headers);D.inject(E.active(),n,{set:(o,i,s)=>o.set(i,typeof s=="string"?s:String(s))}),t.headers=n}}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(performance.clearResourceTimings(),this._usedResources=new WeakSet)}_createSpan(t,r={}){if(nr(t,this.getConfig().ignoreUrls)){this._diag.debug("ignoring span as url matches ignored url");return}let n="",o={};if(this._semconvStability&R.OLD){let i=(r.method||"GET").toUpperCase();n=`HTTP ${i}`,o[Nr.COMPONENT]=this.moduleName,o[Dc]=i,o[Vc]=t}if(this._semconvStability&R.STABLE){let i=r.method,s=zc(r.method||"GET");n||(n=s),o[cn]=s,s!==i&&(o[un]=i),o[It]=t}return this.tracer.startSpan(n,{kind:Et.CLIENT,attributes:o})}_findResourceAndAddNetworkEvents(t,r,n){let o=r.entries;if(!o.length){if(!performance.getEntriesByType)return;o=performance.getEntriesByType("resource")}let i=Rr(r.spanUrl,r.startTime,n,o,this._usedResources,"fetch");if(i.mainRequest){let s=i.mainRequest;this._markResourceAsUsed(s);let a=i.corsPreFlightRequest;a&&(this._addChildSpan(t,a),this._markResourceAsUsed(a));let c=!(this._semconvStability&R.OLD);_t(t,s,this.getConfig().ignoreNetworkEvents,void 0,c)}}_markResourceAsUsed(t){this._usedResources.add(t)}_endSpan(t,r,n){let o=P(Date.now()),i=I();this._addFinalSpanAttributes(t,n),this._semconvStability&R.STABLE&&n.status>=400&&(t.setStatus({code:X.ERROR}),t.setAttribute(Ye,String(n.status))),setTimeout(()=>{r.observer?.disconnect(),this._findResourceAndAddNetworkEvents(t,r,i),this._tasksCount--,this._clearResources(),t.end(o)},Sm)}_patchConstructor(){return t=>{let r=this;return function(...o){if(!r._isEnabled)return t.apply(this,o);let i=this,s=tt(o[0]instanceof Request?o[0].url:String(o[0])).href,a;o[0]instanceof Request?a=o[1]!=null?new Request(o[0],o[1]):o[0]:a=o[1]||{};let c=r._createSpan(s,a);if(!c)return t.apply(this,o);let u=r._prepareSpanData(s);r.getConfig().measureRequestSize&&$c(...o).then(d=>{d&&(r._semconvStability&R.OLD&&c.setAttribute(Bc,d),r._semconvStability&R.STABLE&&c.setAttribute(Uc,d))}).catch(d=>{r._diag.warn("getFetchBodyLength",d)});function p(d,h){r._applyAttributesAfterFetch(d,a,h),r._endSpan(d,u,{status:h.status||0,statusText:h.message,url:s})}function _(d,h){r._applyAttributesAfterFetch(d,a,h),h.status>=200&&h.status<400?r._endSpan(d,u,h):r._endSpan(d,u,{status:h.status,statusText:h.statusText,url:s})}function f(d,h){try{let b=h.clone().body;if(b){let $=b.getReader(),V=()=>{$.read().then(({done:x})=>{x?_(d,h):V()},x=>{p(d,x)})};V()}else _(d,h)}catch(g){r._diag.error("Failed to read fetch response body",g),r._endSpan(d,u,{status:0,url:s})}return h}function m(d,h){try{p(d,h)}catch(g){r._diag.error("Failed to end span on fetch error",g),r._endSpan(d,u,{status:h.status||0,url:s})}throw h}return E.with(A.setSpan(E.active(),c),()=>(r._callRequestHook(c,a),r._addHeaders(a,s),r._tasksCount++,t.apply(i,a instanceof Request?[a]:[s,a]).then(f.bind(i,c),m.bind(i,c))))}}}_applyAttributesAfterFetch(t,r,n){let o=this.getConfig().applyCustomAttributesOnSpan;o&&rt(()=>o(t,r,n),i=>{i&&this._diag.error("applyCustomAttributesOnSpan",i)},!0)}_callRequestHook(t,r){let n=this.getConfig().requestHook;n&&rt(()=>n(t,r),o=>{o&&this._diag.error("requestHook",o)},!0)}_prepareSpanData(t){let r=I(),n=[];if(typeof PerformanceObserver!="function")return{entries:n,startTime:r,spanUrl:t};let o=new PerformanceObserver(i=>{i.getEntries().forEach(a=>{a.initiatorType==="fetch"&&a.name===t&&n.push(a)})});return o.observe({entryTypes:["resource"]}),{entries:n,observer:o,startTime:r,spanUrl:t}}enable(){if(!jc){this._diag.warn("this instrumentation is intended for web usage only, it does not instrument server-side fetch()");return}if(!this._isEnabled){if(this._isEnabled=!0,this._isFetchPatched){this._diag.debug("fetch constructor already patched");return}this._isFetchPatched=!0,this._wrap(globalThis,"fetch",this._patchConstructor())}}disable(){jc&&this._isEnabled&&(this._isEnabled=!1,this._usedResources=new WeakSet)}};var cs="0.59.0",Kc="@opentelemetry/instrumentation-long-task";var us="longtask",Pr=class extends M{version=cs;_observer;constructor(t={}){super(Kc,cs,t)}init(){}isSupported(){return typeof PerformanceObserver>"u"||!PerformanceObserver.supportedEntryTypes?!1:PerformanceObserver.supportedEntryTypes.includes(us)}_createSpanFromEntry(t){let r=this.tracer.startSpan(us,{startTime:I(t.startTime)}),{observerCallback:n}=this.getConfig();if(n)try{n(r,{longtaskEntry:t})}catch(o){l.error("longtask instrumentation: observer callback failed",o)}r.setAttribute("longtask.name",t.name),r.setAttribute("longtask.entry_type",t.entryType),r.setAttribute("longtask.duration",t.duration),Array.isArray(t.attribution)&&t.attribution.forEach((o,i)=>{let s=t.attribution.length>1?`longtask.attribution[${i}]`:"longtask.attribution";r.setAttribute(`${s}.name`,o.name),r.setAttribute(`${s}.entry_type`,o.entryType),r.setAttribute(`${s}.start_time`,o.startTime),r.setAttribute(`${s}.duration`,o.duration),r.setAttribute(`${s}.container_type`,o.containerType),r.setAttribute(`${s}.container_src`,o.containerSrc),r.setAttribute(`${s}.container_id`,o.containerId),r.setAttribute(`${s}.container_name`,o.containerName)}),r.end(I(t.startTime+t.duration))}enable(){if(!this.isSupported()){this._diag.debug("Environment not supported");return}this._observer||(this._observer=new PerformanceObserver(t=>{t.getEntries().forEach(r=>this._createSpanFromEntry(r))}),this._observer.observe({type:us,buffered:!0}))}disable(){this._observer&&(this._observer.disconnect(),this._observer=void 0)}};var te;(function(e){e.EVENT_TYPE="event_type",e.TARGET_ELEMENT="target_element",e.TARGET_XPATH="target_xpath",e.HTTP_URL="http.url"})(te||(te={}));var ls="0.59.0",Xc="@opentelemetry/instrumentation-user-interaction";var Am="OT_ZONE_CONTEXT",Rm="Navigation:",xm=["click"];function Om(){return!1}var Ir=class extends M{version=ls;moduleName="user-interaction";_spansData=new WeakMap;_wrappedListeners=new WeakMap;_eventsSpanMap=new WeakMap;_eventNames;_shouldPreventSpanCreation;constructor(t={}){super(Xc,ls,t),this._eventNames=new Set(t?.eventNames??xm),this._shouldPreventSpanCreation=typeof t?.shouldPreventSpanCreation=="function"?t.shouldPreventSpanCreation:Om}init(){}_checkForTimeout(t,r){let n=this._spansData.get(r);n&&(t.source==="setTimeout"?n.hrTimeLastTimeout=I():t.source!=="Promise.then"&&t.source!=="setTimeout"&&(n.hrTimeLastTimeout=void 0))}_allowEventName(t){return this._eventNames.has(t)}_createSpan(t,r,n){if(!this._isEnabled||!(t instanceof HTMLElement)||!t.getAttribute||t.hasAttribute("disabled")||!this._allowEventName(r))return;let o=Oo(t,!0);try{let i=this.tracer.startSpan(r,{attributes:{[te.EVENT_TYPE]:r,[te.TARGET_ELEMENT]:t.tagName,[te.TARGET_XPATH]:o,[te.HTTP_URL]:window.location.href}},n?A.setSpan(E.active(),n):void 0);return this._shouldPreventSpanCreation(r,t,i)===!0?void 0:(this._spansData.set(i,{taskCount:0}),i)}catch(i){this._diag.error("failed to start create new user interaction span",i)}}_decrementTask(t){let r=this._spansData.get(t);r&&(r.taskCount--,r.taskCount===0&&this._tryToEndSpan(t,r.hrTimeLastTimeout))}_getCurrentSpan(t){let r=t.get(Am);return r&&A.getSpan(r)}_incrementTask(t){let r=this._spansData.get(t);r&&r.taskCount++}addPatchedListener(t,r,n,o){let i=this._wrappedListeners.get(n);i||(i=new Map,this._wrappedListeners.set(n,i));let s=i.get(r);return s||(s=new Map,i.set(r,s)),s.has(t)?!1:(s.set(t,o),!0)}removePatchedListener(t,r,n){let o=this._wrappedListeners.get(n);if(!o)return;let i=o.get(r);if(!i)return;let s=i.get(t);return s&&(i.delete(t),i.size===0&&(o.delete(r),o.size===0&&this._wrappedListeners.delete(n))),s}_invokeListener(t,r,n){return typeof t=="function"?t.apply(r,n):t.handleEvent(n[0])}_patchAddEventListener(){let t=this;return r=>function(o,i,s){if(!i)return r.call(this,o,i,s);let a=s&&typeof s=="object"&&s.once,c=function(...u){let p,_=u[0],f=_?.target;_&&(p=t._eventsSpanMap.get(_)),a&&t.removePatchedListener(this,o,i);let m=t._createSpan(f,o,p);return m?(_&&t._eventsSpanMap.set(_,m),E.with(A.setSpan(E.active(),m),()=>{let d=t._invokeListener(i,this,u);return m.end(),d})):t._invokeListener(i,this,u)};if(t.addPatchedListener(this,o,i,c))return r.call(this,o,c,s)}}_patchRemoveEventListener(){let t=this;return r=>function(o,i,s){let a=t.removePatchedListener(this,o,i);return a?r.call(this,o,a,s):r.call(this,o,i,s)}}_getPatchableEventTargets(){return window.EventTarget?[EventTarget.prototype]:[Node.prototype,Window.prototype]}_patchHistoryApi(){this._isEnabled&&(this._wrap(history,"replaceState",this._patchHistoryMethod()),this._wrap(history,"pushState",this._patchHistoryMethod()),this._wrap(history,"back",this._patchHistoryMethod()),this._wrap(history,"forward",this._patchHistoryMethod()),this._wrap(history,"go",this._patchHistoryMethod()))}_patchHistoryMethod(){let t=this;return r=>function(...o){if(!t._isEnabled)return r.apply(this,o);let i=`${location.pathname}${location.hash}${location.search}`,s=r.apply(this,o),a=`${location.pathname}${location.hash}${location.search}`;return i!==a&&t._updateInteractionName(a),s}}_updateInteractionName(t){let r=A.getSpan(E.active());r&&typeof r.updateName=="function"&&r.updateName(`${Rm} ${t}`)}_patchZoneCancelTask(){let t=this;return r=>function(o){let i=Zone.current,s=t._getCurrentSpan(i);return s&&t._shouldCountTask(o,i)&&t._decrementTask(s),r.call(this,o)}}_patchZoneScheduleTask(){let t=this;return r=>function(o){let i=Zone.current,s=t._getCurrentSpan(i);return s&&t._shouldCountTask(o,i)&&(t._incrementTask(s),t._checkForTimeout(o,s)),r.call(this,o)}}_patchZoneRunTask(){let t=this;return r=>function(o,i,s){let c=(Array.isArray(s)&&s[0]instanceof Event?s[0]:void 0)?.target,u,p=this;if(c){if(u=t._createSpan(c,o.eventName),u)return t._incrementTask(u),p.run(()=>{try{return E.with(A.setSpan(E.active(),u),()=>{let _=Zone.current;return o._zone=_,r.call(_,o,i,s)})}finally{t._decrementTask(u)}})}else u=t._getCurrentSpan(p);try{return r.call(p,o,i,s)}finally{u&&t._shouldCountTask(o,p)&&t._decrementTask(u)}}}_shouldCountTask(t,r){if(t._zone&&(r=t._zone),!r||!t.data||t.data.isPeriodic)return!1;let n=this._getCurrentSpan(r);return!n||!this._spansData.get(n)?!1:t.type==="macroTask"||t.type==="microTask"}_tryToEndSpan(t,r){t&&this._spansData.get(t)&&(t.end(r),this._spansData.delete(t))}enable(){if(this._isEnabled||(this._isEnabled=!0,typeof this._zonePatched=="boolean"))return;let t=this._getZoneWithPrototype();this._diag.debug("applying patch to",this.moduleName,this.version,"zone:",!!t),t?(this._zonePatched=!0,this._wrap(t.prototype,"runTask",this._patchZoneRunTask()),this._wrap(t.prototype,"scheduleTask",this._patchZoneScheduleTask()),this._wrap(t.prototype,"cancelTask",this._patchZoneCancelTask())):(this._zonePatched=!1,this._getPatchableEventTargets().forEach(n=>{this._wrap(n,"addEventListener",this._patchAddEventListener()),this._wrap(n,"removeEventListener",this._patchRemoveEventListener())})),this._patchHistoryApi()}disable(){this._isEnabled&&(this._isEnabled=!1)}_getZoneWithPrototype(){return window.Zone}};var Yc="http.host",qc="http.method",Qc="http.request.body.size",Jc="http.request_content_length_uncompressed";var Zc="http.scheme",tu="http.status_code",eu="http.url",ru="http.user_agent";var dt;(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"})(dt||(dt={}));var bm=l.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-xml-http-request/utils"});function wm(e){return typeof Document<"u"&&e instanceof Document}function ou(e){if(wm(e))return new XMLSerializer().serializeToString(document).length;if(typeof e=="string")return nu(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return Nm(e);if(e instanceof URLSearchParams)return nu(e.toString());if(e.byteLength!==void 0)return e.byteLength;bm.warn("unknown body type")}var Lm=new TextEncoder;function nu(e){return Lm.encode(e).byteLength}function Nm(e){let t=0;for(let[r,n]of e.entries())t+=r.length,n instanceof Blob?t+=n.size:t+=n.length;return t}function iu(e){let t=Cm(),r=e.toUpperCase();return r in t?r:"_OTHER"}var ym={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},Mr;function Cm(){if(Mr===void 0){let e=void 0;e&&e.length>0?(Mr={},e.forEach(t=>{Mr[t]=!0})):Mr=ym}return Mr}var Pm={"https:":"443","http:":"80"};function su(e){let t=Number(e.port||Pm[e.protocol]);if(t&&!isNaN(t))return t}var ps="0.215.0";var Co;(function(e){e.HTTP_STATUS_TEXT="http.status_text"})(Co||(Co={}));var Im=300,vr=class extends M{component="xml-http-request";version=ps;moduleName=this.component;_tasksCount=0;_xhrMem=new WeakMap;_usedResources=new WeakSet;_semconvStability;constructor(t={}){super("@opentelemetry/instrumentation-xml-http-request",ps,t),this._semconvStability=Jt("http",t?.semconvStabilityOptIn)}init(){}_addHeaders(t,r){let n=tt(r).href;if(!xr(n,this.getConfig().propagateTraceHeaderCorsUrls)){let i={};D.inject(E.active(),i),Object.keys(i).length>0&&this._diag.debug("headers inject skipped due to CORS policy");return}let o={};D.inject(E.active(),o),Object.keys(o).forEach(i=>{t.setRequestHeader(i,String(o[i]))})}_addChildSpan(t,r){E.with(A.setSpan(E.active(),t),()=>{let n=this.tracer.startSpan("CORS Preflight",{startTime:r[S.FETCH_START]}),o=!(this._semconvStability&R.OLD);_t(n,r,this.getConfig().ignoreNetworkEvents,void 0,o),n.end(r[S.RESPONSE_END])})}_addFinalSpanAttributes(t,r,n){if(this._semconvStability&R.OLD){if(r.status!==void 0&&t.setAttribute(tu,r.status),r.statusText!==void 0&&t.setAttribute(Co.HTTP_STATUS_TEXT,r.statusText),typeof n=="string"){let o=tt(n);t.setAttribute(Yc,o.host),t.setAttribute(Zc,o.protocol.replace(":",""))}t.setAttribute(ru,navigator.userAgent)}this._semconvStability&R.STABLE&&r.status&&t.setAttribute(ln,r.status)}_applyAttributesAfterXHR(t,r){let n=this.getConfig().applyCustomAttributesOnSpan;typeof n=="function"&&rt(()=>n(t,r),o=>{o&&this._diag.error("applyCustomAttributesOnSpan",o)},!0)}_addResourceObserver(t,r){let n=this._xhrMem.get(t);!n||typeof PerformanceObserver!="function"||typeof PerformanceResourceTiming!="function"||(n.createdResources={observer:new PerformanceObserver(o=>{let i=o.getEntries(),s=tt(r);i.forEach(a=>{a.initiatorType==="xmlhttprequest"&&a.name===s.href&&n.createdResources&&n.createdResources.entries.push(a)})}),entries:[]},n.createdResources.observer.observe({entryTypes:["resource"]}))}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(N.clearResourceTimings(),this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}_findResourceAndAddNetworkEvents(t,r,n,o,i){if(!n||!o||!i||!t.createdResources)return;let s=t.createdResources.entries;(!s||!s.length)&&(s=N.getEntriesByType("resource"));let a=Rr(tt(n).href,o,i,s,this._usedResources);if(a.mainRequest){let c=a.mainRequest;this._markResourceAsUsed(c);let u=a.corsPreFlightRequest;u&&(this._addChildSpan(r,u),this._markResourceAsUsed(u));let p=!(this._semconvStability&R.OLD);_t(r,c,this.getConfig().ignoreNetworkEvents,void 0,p)}}_cleanPreviousSpanInformation(t){let r=this._xhrMem.get(t);if(r){let n=r.callbackToRemoveEvents;n&&n(),this._xhrMem.delete(t)}}_createSpan(t,r,n){if(nr(r,this.getConfig().ignoreUrls)){this._diag.debug("ignoring span as url matches ignored url");return}let o="",i=tt(r),s={};if(this._semconvStability&R.OLD&&(o=n.toUpperCase(),s[qc]=n,s[eu]=i.toString()),this._semconvStability&R.STABLE){let c=n,u=iu(n);o||(o=u),s[cn]=u,u!==c&&(s[un]=c),s[It]=i.toString(),s[pn]=i.hostname;let p=su(i);p&&(s[mn]=p)}let a=this.tracer.startSpan(o,{kind:Et.CLIENT,attributes:s});return a.addEvent(dt.METHOD_OPEN),this._cleanPreviousSpanInformation(t),this._xhrMem.set(t,{span:a,spanUrl:r}),a}_markResourceAsUsed(t){this._usedResources.add(t)}_patchOpen(){return t=>{let r=this;return function(...o){let i=o[0],s=o[1];return r._createSpan(this,s,i),t.apply(this,o)}}}_patchSend(){let t=this;function r(u,p,_,f){let m=p.callbackToRemoveEvents;typeof m=="function"&&m();let{span:d,spanUrl:h,sendStartTime:g}=p;d&&(t._findResourceAndAddNetworkEvents(p,d,h,g,_),d.addEvent(u,f),t._addFinalSpanAttributes(d,p,h),d.end(f),t._tasksCount--),t._clearResources()}function n(u,p,_,f){let m=t._xhrMem.get(p);if(!m)return;if(m.status=p.status,m.statusText=p.statusText,t._xhrMem.delete(p),m.span){let g=m.span;t._applyAttributesAfterXHR(g,p),t._semconvStability&R.STABLE&&(_?f&&(g.setStatus({code:X.ERROR,message:f}),g.setAttribute(Ye,f)):m.status&&m.status>=400&&(g.setStatus({code:X.ERROR}),g.setAttribute(Ye,String(m.status))))}let d=I(),h=Date.now();setTimeout(()=>{r(u,m,d,h)},Im)}function o(){n(dt.EVENT_ERROR,this,!0,"error")}function i(){n(dt.EVENT_ABORT,this,!1)}function s(){n(dt.EVENT_TIMEOUT,this,!0,"timeout")}function a(){this.status<299?n(dt.EVENT_LOAD,this,!1):n(dt.EVENT_ERROR,this,!1)}function c(u){u.removeEventListener("abort",i),u.removeEventListener("error",o),u.removeEventListener("load",a),u.removeEventListener("timeout",s);let p=t._xhrMem.get(u);p&&(p.callbackToRemoveEvents=void 0)}return u=>function(..._){let f=t._xhrMem.get(this);if(!f)return u.apply(this,_);let m=f.span,d=f.spanUrl;if(m&&d){if(t.getConfig().measureRequestSize&&_?.[0]){let h=_[0],g=ou(h);g!==void 0&&(t._semconvStability&R.OLD&&m.setAttribute(Jc,g),t._semconvStability&R.STABLE&&m.setAttribute(Qc,g))}E.with(A.setSpan(E.active(),m),()=>{t._tasksCount++,f.sendStartTime=I(),m.addEvent(dt.METHOD_SEND),this.addEventListener("abort",i),this.addEventListener("error",o),this.addEventListener("load",a),this.addEventListener("timeout",s),f.callbackToRemoveEvents=()=>{c(this),f.createdResources&&f.createdResources.observer.disconnect()},t._addHeaders(this,d),t._addResourceObserver(this,d)})}return u.apply(this,_)}}enable(){this._diag.debug("applying patch to",this.moduleName,this.version),No(XMLHttpRequest.prototype.open)&&(this._unwrap(XMLHttpRequest.prototype,"open"),this._diag.debug("removing previous patch from method open")),No(XMLHttpRequest.prototype.send)&&(this._unwrap(XMLHttpRequest.prototype,"send"),this._diag.debug("removing previous patch from method send")),this._wrap(XMLHttpRequest.prototype,"open",this._patchOpen()),this._wrap(XMLHttpRequest.prototype,"send",this._patchSend())}disable(){this._diag.debug("removing patch from",this.moduleName,this.version),this._unwrap(XMLHttpRequest.prototype,"open"),this._unwrap(XMLHttpRequest.prototype,"send"),this._tasksCount=0,this._xhrMem=new WeakMap,this._usedResources=new WeakSet}};var au="0.8.0",cu="@opentelemetry/instrumentation-web-exception";var Dr=class extends M{constructor(t={}){super(cu,au,t)}init(){}onError(t){let r="exception",n="reason"in t?t.reason:t.error;if(n===void 0)return;let o=Ct.getLoggerProvider().getLogger(this.instrumentationName,this.instrumentationVersion),i=this.getConfig(),s=i.applyCustomAttributes?i.applyCustomAttributes(n):{},a={};typeof n=="string"?a={[Q]:n}:a={[et]:n.name,[Q]:n.message,[jt]:n.stack};let c={eventName:r,severityNumber:Y.ERROR,attributes:{...a,...s},timestamp:I(),observedTimestamp:I()};o.emit(c)}disable(){this._onErrorHandler&&(window.removeEventListener("error",this._onErrorHandler),window.removeEventListener("unhandledrejection",this._onErrorHandler))}enable(){this._onErrorHandler||(this._onErrorHandler=this.onError.bind(this)),window.addEventListener("error",this._onErrorHandler),window.addEventListener("unhandledrejection",this._onErrorHandler)}};var uu="0.3.0";var lu="browser.web_vital",pu="browser.web_vital.name",mu="browser.web_vital.value",_u="browser.web_vital.rating",du="browser.web_vital.delta",hu="browser.web_vital.id",fu="browser.web_vital.navigation_type";var Io=class{t;o=0;i=[];u(t){if(t.hadRecentInput)return;let r=this.i[0],n=this.i.at(-1);this.o&&r&&n&&t.startTime-n.startTime<1e3&&t.startTime-r.startTime<5e3?(this.o+=t.value,this.i.push(t)):(this.o=t.value,this.i=[t]),this.t?.(t)}},Me=()=>{let e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Mo=e=>{if(document.readyState==="loading")return"loading";let t=Me();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"},Mm=e=>{let t=e.nodeName;return e.nodeType===1?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},gs=e=>{let t="";try{for(;e?.nodeType!==9;){let r=e,n=r.id?"#"+r.id:[Mm(r),...Array.from(r.classList).sort()].join(".");if(t.length+n.length>99)return t||n;if(t=t?n+">"+t:n,r.id)break;e=r.parentNode}}catch{}return t},ms=new WeakMap;function Pe(e,t){return ms.get(e)||ms.set(e,new t),ms.get(e)}var wu=-1,Lu=()=>wu,ve=e=>{addEventListener("pageshow",t=>{t.persisted&&(wu=t.timeStamp,e(t))},!0)},ht=(e,t,r,n)=>{let o,i;return s=>{t.value>=0&&(s||n)&&(i=t.value-(o??0),(i||o===void 0)&&(o=t.value,t.delta=i,t.rating=((a,c)=>a>c[1]?"poor":a>c[0]?"needs-improvement":"good")(t.value,r),e(t)))}},Es=e=>{requestAnimationFrame(()=>requestAnimationFrame(e))},Ur=()=>Me()?.activationStart??0,ft=(e,t=-1)=>{let r=Me(),n="navigate";return Lu()>=0?n="back-forward-cache":r&&(document.prerendering||Ur()>0?n="prerender":document.wasDiscarded?n="restore":r.type&&(n=r.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:n}},Ie=(e,t,r={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){let n=new PerformanceObserver(o=>{queueMicrotask(()=>{t(o.getEntries())})});return n.observe({type:e,buffered:!0,...r}),n}}catch{}},Ss=e=>{let t=!1;return()=>{t||(e(),t=!0)}},Ce=-1,Nu=new Set,Tu=()=>document.visibilityState!=="hidden"||document.prerendering?1/0:0,ds=e=>{if(document.visibilityState==="hidden"){if(e.type==="visibilitychange")for(let t of Nu)t();isFinite(Ce)||(Ce=e.type==="visibilitychange"?e.timeStamp:0,removeEventListener("prerenderingchange",ds,!0))}},Uo=()=>{if(Ce<0){let e=Ur();Ce=(document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(r=>r.name==="hidden"&&r.startTime>=e)?.startTime)??Tu(),addEventListener("visibilitychange",ds,!0),addEventListener("prerenderingchange",ds,!0),ve(()=>{setTimeout(()=>{Ce=Tu()})})}return{get firstHiddenTime(){return Ce},onHidden(e){Nu.add(e)}}},Bo=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},gu=[1800,3e3],yu=(e,t={})=>{Bo(()=>{let r=Uo(),n,o=ft("FCP"),i=Ie("paint",s=>{for(let a of s)a.name==="first-contentful-paint"&&(i.disconnect(),a.startTime<r.firstHiddenTime&&(o.value=Math.max(a.startTime-Ur(),0),o.entries.push(a),n(!0)))});i&&(n=ht(e,o,gu,t.reportAllChanges),ve(s=>{o=ft("FCP"),n=ht(e,o,gu,t.reportAllChanges),Es(()=>{o.value=performance.now()-s.timeStamp,n(!0)})}))})},Eu=[.1,.25],Su=e=>e.find(t=>t.node?.nodeType===1)||e[0],Cu=(e,t={})=>{let r=Pe(t=Object.assign({},t),Io),n=new WeakMap;r.t=o=>{if(o?.sources?.length){let i=Su(o.sources),s=i?.node;if(s){let a=t.generateTarget?.(s)??gs(s);n.set(i,a)}}},((o,i={})=>{let s=Uo();yu(Ss(()=>{let a,c=ft("CLS",0),u=Pe(i,Io),p=f=>{for(let m of f)u.u(m);u.o>c.value&&(c.value=u.o,c.entries=u.i,a())},_=Ie("layout-shift",p);_&&(a=ht(o,c,Eu,i.reportAllChanges),s.onHidden(()=>{p(_.takeRecords()),a(!0)}),ve(()=>{u.o=0,c=ft("CLS",0),a=ht(o,c,Eu,i.reportAllChanges),Es(a)}),setTimeout(a))}))})(o=>{e((i=>{let s={};if(i.entries.length){let a=i.entries.reduce((c,u)=>c.value>u.value?c:u);if(a?.sources?.length){let c=Su(a.sources);c&&(s={largestShiftTarget:n.get(c),largestShiftTime:a.startTime,largestShiftValue:a.value,largestShiftSource:c,largestShiftEntry:a,loadState:Mo(a.startTime)})}}return Object.assign(i,{attribution:s})})(o))},t)},Pu=(e,t={})=>{yu(r=>{e((n=>{let o={timeToFirstByte:0,firstByteToFCP:n.value,loadState:Mo(Lu())};if(n.entries.length){let i=Me(),s=n.entries.at(-1);if(i){let a=i.activationStart||0,c=Math.max(0,i.responseStart-a);o={timeToFirstByte:c,firstByteToFCP:n.value-c,loadState:Mo(n.entries[0].startTime),navigationEntry:i,fcpEntry:s}}}return Object.assign(n,{attribution:o})})(r))},t)},Iu=0,_s=1/0,Po=0,vm=e=>{for(let t of e)t.interactionId&&(_s=Math.min(_s,t.interactionId),Po=Math.max(Po,t.interactionId),Iu=Po?(Po-_s)/7+1:0)},hs,Au=()=>hs?Iu:performance.interactionCount??0,Dm=()=>{"interactionCount"in performance||hs||(hs=Ie("event",vm,{durationThreshold:0}))},Ru=0,vo=class{l=[];h=new Map;m;p;v(){Ru=Au(),this.l.length=0,this.h.clear()}M(){let t=Math.min(this.l.length-1,Math.floor((Au()-Ru)/50));return this.l[t]}u(t){if(this.m?.(t),!t.interactionId&&t.entryType!=="first-input")return;let r=this.l.at(-1),n=this.h.get(t.interactionId);if(n||this.l.length<10||t.duration>r.T){if(n?t.duration>n.T?(n.entries=[t],n.T=t.duration):t.duration===n.T&&t.startTime===n.entries[0].startTime&&n.entries.push(t):(n={id:t.interactionId,entries:[t],T:t.duration},this.h.set(n.id,n),this.l.push(n)),this.l.sort((o,i)=>i.T-o.T),this.l.length>10){let o=this.l.splice(10);for(let i of o)this.h.delete(i.id)}this.p?.(n)}}},fs=e=>{let t=globalThis.requestIdleCallback||setTimeout,r=globalThis.cancelIdleCallback||clearTimeout;if(document.visibilityState==="hidden")e();else{let n=Ss(e),o=-1,i=()=>{r(o),n()};addEventListener("visibilitychange",i,{once:!0,capture:!0}),o=t(()=>{removeEventListener("visibilitychange",i,{capture:!0}),n()})}},xu=[200,500],Mu=(e,t={})=>{let r=Pe(t=Object.assign({},t),vo),n=[],o=[],i=0,s=new WeakMap,a=new WeakMap,c=!1,u=()=>{c||(fs(p),c=!0)},p=()=>{let m=new Set(r.l.map(g=>s.get(g.entries[0]))),d=o.length-10;o=o.filter((g,b)=>b>=d||m.has(g));let h=new Set;for(let g of o){let b=_(g.startTime,g.processingEnd);for(let $ of b)h.add($)}n=n.filter(g=>g.startTime>i||h.has(g)),c=!1};r.m=m=>{let d=m.startTime+m.duration,h;i=Math.max(i,m.processingEnd);for(let g=o.length-1;g>=0;g--){let b=o[g];if(Math.abs(d-b.renderTime)<=8){h=b,h.startTime=Math.min(m.startTime,h.startTime),h.processingStart=Math.min(m.processingStart,h.processingStart),h.processingEnd=Math.max(m.processingEnd,h.processingEnd),t.includeProcessedEventEntries!==!1&&h.entries.push(m);break}}h||(h={startTime:m.startTime,processingStart:m.processingStart,processingEnd:m.processingEnd,renderTime:d,entries:t.includeProcessedEventEntries!==!1?[m]:[]},o.push(h)),(m.interactionId||m.entryType==="first-input")&&s.set(m,h),u()},r.p=m=>{if(!a.get(m)){let d=m.entries[0].target;if(d){let h=t.generateTarget?.(d)??gs(d);a.set(m,h)}}};let _=(m,d)=>{let h=[];for(let g of n)if(!(g.startTime+g.duration<m)){if(g.startTime>d)break;h.push(g)}return h},f=m=>{let d=m.entries[0],h=s.get(d),g=d.processingStart,b=Math.max(d.startTime+d.duration,g),$=Math.min(h.processingEnd,b),V=h.entries.sort((v,yt)=>v.processingStart-yt.processingStart),x=_(d.startTime,$),Lt=r.h.get(d.interactionId),Nt={interactionTarget:a.get(Lt),interactionType:d.name.startsWith("key")?"keyboard":"pointer",interactionTime:d.startTime,nextPaintTime:b,processedEventEntries:V,longAnimationFrameEntries:x,inputDelay:g-d.startTime,processingDuration:$-g,presentationDelay:b-$,loadState:Mo(d.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(v=>{if(!v.longAnimationFrameEntries?.length)return;let yt=v.interactionTime,Fo=v.inputDelay,xs=v.processingDuration,$o,zo,Wo=0,Ue=0,jo=0,Ko=0;for(let Hr of v.longAnimationFrameEntries){Ue=Ue+Hr.startTime+Hr.duration-Hr.styleAndLayoutStart;for(let Tt of Hr.scripts){let bs=Tt.startTime+Tt.duration;if(bs<yt)continue;let Vr=bs-Math.max(yt,Tt.startTime),ws=Tt.duration?Vr/Tt.duration*Tt.forcedStyleAndLayoutDuration:0;Wo+=Vr-ws,Ue+=ws,Vr>Ko&&(zo=Tt.startTime<yt+Fo?"input-delay":Tt.startTime>=yt+Fo+xs?"presentation-delay":"processing-duration",$o=Tt,Ko=Vr)}}let Xo=v.longAnimationFrameEntries.at(-1),Os=Xo?Xo.startTime+Xo.duration:0;Os>=yt+Fo+xs&&(jo=v.nextPaintTime-Os),$o&&zo&&(v.longestScript={entry:$o,subpart:zo,intersectingDuration:Ko}),v.totalScriptDuration=Wo,v.totalStyleAndLayoutDuration=Ue,v.totalPaintDuration=jo,v.totalUnattributedDuration=v.nextPaintTime-yt-Wo-Ue-jo})(Nt),Object.assign(m,{attribution:Nt})};Ie("long-animation-frame",m=>{n=n.concat(m),u()}),((m,d={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;let h=Uo();Bo(()=>{Dm();let g,b=ft("INP"),$=Pe(d,vo),V=Lt=>{fs(()=>{for(let v of Lt)$.u(v);let Nt=$.M();Nt&&Nt.T!==b.value&&(b.value=Nt.T,b.entries=Nt.entries,g())})},x=Ie("event",V,{durationThreshold:d.durationThreshold??40});g=ht(m,b,xu,d.reportAllChanges),x&&(x.observe({type:"first-input",buffered:!0}),h.onHidden(()=>{V(x.takeRecords()),g(!0)}),ve(()=>{$.v(),b=ft("INP"),g=ht(m,b,xu,d.reportAllChanges)}))})})(m=>{e(f(m))},t)},Do=class{m;u(t){this.m?.(t)}},Ou=[2500,4e3],vu=(e,t={})=>{let r=Pe(t=Object.assign({},t),Do),n=new WeakMap;r.m=o=>{let i=o.element;if(i){let s=t.generateTarget?.(i)??gs(i);n.set(o,s)}else o.id&&n.set(o,`#${o.id}`)},((o,i={})=>{Bo(()=>{let s=Uo(),a,c=ft("LCP"),u=Pe(i,Do),p=f=>{i.reportAllChanges||(f=f.slice(-1));for(let m of f)u.u(m),m.startTime<s.firstHiddenTime&&(c.value=Math.max(m.startTime-Ur(),0),c.entries=[m],a())},_=Ie("largest-contentful-paint",p);if(_){a=ht(o,c,Ou,i.reportAllChanges);let f=Ss(()=>{p(_.takeRecords()),_.disconnect(),a(!0)}),m=d=>{d.isTrusted&&(fs(f),removeEventListener(d.type,m,{capture:!0}))};for(let d of["keydown","click","visibilitychange"])addEventListener(d,m,{capture:!0});ve(d=>{c=ft("LCP"),a=ht(o,c,Ou,i.reportAllChanges),Es(()=>{c.value=performance.now()-d.timeStamp,a(!0)})})}})})(o=>{e((i=>{let s={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:i.value};if(i.entries.length){let a=i.entries.at(-1),c=a.url&&performance.getEntriesByType("resource").find(p=>p.name===a.url);s.target=n.get(a),s.lcpEntry=a,a.url&&(s.url=a.url),c&&(s.lcpResourceEntry=c);let u=Me();if(u){let p=u.activationStart||0,_=Math.max(0,u.responseStart-p),f=Math.max(_,c?(c.requestStart||c.startTime)-p:0),m=Math.min(i.value,Math.max(f,c?c.responseEnd-p:0));s={...s,timeToFirstByte:_,resourceLoadDelay:f-_,resourceLoadDuration:m-f,elementRenderDelay:i.value-m,navigationEntry:u}}}return Object.assign(i,{attribution:s})})(o))},t)},bu=[800,1800],Ts=e=>{document.prerendering?Bo(()=>Ts(e)):document.readyState!=="complete"?addEventListener("load",()=>Ts(e),!0):setTimeout(e)},Du=(e,t={})=>{((r,n={})=>{let o=ft("TTFB"),i=ht(r,o,bu,n.reportAllChanges);Ts(()=>{let s=Me();s&&(o.value=Math.max(s.responseStart-Ur(),0),o.entries=[s],i(!0),ve(()=>{o=ft("TTFB",0),i=ht(r,o,bu,n.reportAllChanges),i(!0)}))})})(r=>{e((n=>{let o={waitingDuration:0,cacheDuration:0,dnsDuration:0,connectionDuration:0,requestDuration:0};if(n.entries.length){let i=n.entries[0],s=i.activationStart||0,a=Math.max((i.workerStart||i.fetchStart)-s,0),c=Math.max(i.domainLookupStart-s,0),u=Math.max(i.connectStart-s,0),p=Math.max(i.connectEnd-s,0);o={waitingDuration:a,cacheDuration:c-a,dnsDuration:u-c,connectionDuration:p-u,requestDuration:n.value-p,navigationEntry:i}}return Object.assign(n,{attribution:o})})(r))},t)};var As=class extends M{_applyCustomLogRecordData;_includeRawAttribution;constructor(e={}){super("@opentelemetry/browser-instrumentation/web-vitals",uu,e),this._applyCustomLogRecordData=e.applyCustomLogRecordData,this._includeRawAttribution=e.includeRawAttribution??!1}init(){return[]}enable(){if(typeof PerformanceObserver>"u"){this._diag.debug("PerformanceObserver not supported, web vitals will not be collected");return}if(this._isEnabled=!0,this._listenersRegistered){this._diag.debug("Listeners already registered, resuming emission");return}this._listenersRegistered=!0,this._diag.debug("Registering listeners"),Cu(e=>this._emitWebVital(e)),Mu(e=>this._emitWebVital(e)),vu(e=>this._emitWebVital(e)),Pu(e=>this._emitWebVital(e)),Du(e=>this._emitWebVital(e))}disable(){this._isEnabled=!1,this._diag.debug("Instrumentation disabled, pausing emission")}_getTimestampForMetric(e){if(e.name==="CLS"){let{attribution:t}=e;return t.largestShiftTime!==void 0?t.largestShiftTime:void 0}if(e.name==="INP"){let{attribution:t}=e;return t.interactionTime}return e.value}_emitWebVital(e){if(!this._isEnabled)return;let t={[pu]:e.name.toLowerCase(),[mu]:e.value,[du]:e.delta,[_u]:e.rating,[hu]:e.id,[fu]:e.navigationType},r=this._getTimestampForMetric(e),n={eventName:lu,severityNumber:Y.INFO,attributes:t,...this._includeRawAttribution?{body:JSON.stringify(e.attribution)}:{},...r!==void 0?{timestamp:r}:{}};this._applyCustomLogRecordData&&rt(()=>this._applyCustomLogRecordData?.(n),o=>{o&&this._diag.error("applyCustomLogRecordData hook failed",o)},!0),this.logger.emit(n)}};var Go=O.INFO,Ht={ALL:O.ALL,VERBOSE:O.VERBOSE,DEBUG:O.DEBUG,INFO:O.INFO,WARN:O.WARN,ERROR:O.ERROR,NONE:O.NONE};function Ho(e){return Go=Ht[e.logLevel.toUpperCase()],Go==null&&(console.warn(`Unknown log level "${e.logLevel}", expected one of ${Object.keys(Ht)}, using default`),Go=Ht.INFO),{error:Br(Ht.ERROR,console.error.bind(console)),warn:Br(Ht.WARN,console.error.bind(console)),info:Br(Ht.INFO,console.log.bind(console)),debug:Br(Ht.DEBUG,console.log.bind(console)),verbose:Br(Ht.VERBOSE,console.trace.bind(console))}}function Br(e,t){return function(...n){let o=Go>=e;if(n.length===0)return o;o&&t(...n)}}var ee=Ho({logLevel:"warn"}),De=B,Vo=!1,Bu={active:function(){return De},with:function(e,t,r,...n){let o=De;De=e||B;try{return t.call(r,...n)}finally{De=o}},bind:function(e,t){return typeof t=="function"?bt(t,this,e):t},enable:function(){if(Vo)return this;let e=this;return wt(window,"setTimeout",t=>function(...r){let n=Number(r[1]);return(isNaN(n)||n<=50)&&(r[0]=bt(r[0],e,e.active())),t.apply(this,r)}),wt(window,"setImmediate",t=>function(...r){return r[0]=bt(r[0],e,e.active()),t.apply(this,r)}),Gm(e),window.Promise&&Um(e),De=B,Vo=!0,e},disable:function(){return Vo&&(nt(window,"setTimeout"),nt(window,"setImmediate"),Hm(),window.Promise&&Bm(),De=B,Vo=!1),this}};function bt(e,t,r){if(typeof e!="function")return e;let n=r||t.active();function o(...i){return t.with(n,()=>e.apply(this,i))}return Object.defineProperty(o,"length",{enumerable:!1,configurable:!0,writable:!1,value:e.length}),o}function Um(e){wt(Promise.prototype,"then",t=>function(r,n){return t.call(this,bt(r,e,e.active()),bt(n,e,e.active()))}),wt(Promise.prototype,"catch",t=>function(r){return t.call(this,bt(r,e,e.active()))}),wt(Promise.prototype,"finally",t=>function(r){return t.call(this,bt(r,e,e.active()))})}function Bm(){nt(Promise.prototype,"then"),nt(Promise.prototype,"catch"),nt(Promise.prototype,"finally")}var Gu=["onreadystatechange"],Vt=globalThis.XMLHttpRequest.prototype,Hu=["onabort","onerror","onload","onloadend","onloadstart","onprogress","ontimeout"],ko=globalThis.XMLHttpRequestEventTarget.prototype;function Gm(e){wt(Vt,"addEventListener",function(t){return function(...r){let n=this;if(typeof r[1]=="function"){n.__bound=n.__bound||new Map;let o=r[1],i=n.__bound.get(o);r[1]=i||bt(o,e,e.active()),n.__bound.set(o,r[1])}return t.apply(n,r)}}),wt(Vt,"removeEventListener",function(t){return function(...r){let n=this;if(typeof r[1]=="function"){let o=r[1],i=n.__bound?.get(o);i&&(r[1]=i)}return t.apply(n,r)}});for(let t of Gu){let r=Object.getOwnPropertyDescriptor(Vt,t);r&&(Uu(r,e),Object.defineProperty(Vt,t,r))}for(let t of Hu){let r=Object.getOwnPropertyDescriptor(ko,t);r&&(Uu(r,e),Object.defineProperty(ko,t,r))}}function Hm(){nt(Vt,"addEventListener"),nt(Vt,"removeEventListener");for(let e of Gu){let t=Object.getOwnPropertyDescriptor(Vt,e);t&&(nt(t,"set"),nt(t,"get"),Object.defineProperty(Vt,e,t))}for(let e of Hu){let t=Object.getOwnPropertyDescriptor(ko,e);t&&(nt(t,"set"),nt(t,"get"),Object.defineProperty(ko,e,t))}}function wt(e,t,r){if(!e||!e[t]){ee.warn("no original function "+String(t)+" to wrap");return}if(!r){ee.warn("no wrapper function"),ee.warn(new Error().stack);return}let n=e[t];if(typeof n!="function"||typeof r!="function"){ee.warn("original object and wrapper must be functions");return}let o=r(n,t);return typeof n.toString=="function"&&(o.toString=n.toString.bind(n)),Gr(o,"__original",n),Gr(o,"__unwrap",()=>{e[t]===o&&Gr(e,t,n)}),Gr(o,"__wrapped",!0),Gr(e,t,o),o}function nt(e,t){if(!e||!e[t]){ee.warn("no function to unwrap."),ee.warn(new Error().stack);return}let r=e[t];if(!r.__unwrap)ee.warn(`no original to unwrap to -- has ${String(t)} already been unwrapped?`);else{r.__unwrap();return}}function Uu(e,t){wt(e,"set",function(r){return function(n){if(typeof n=="function"){let o=n;n=bt(o,t,t.active()),n.__original=o}return r.call(this,n)}}),wt(e,"get",function(r){return function(){let n=r.call(this);return typeof n=="function"&&n.__original?n.__original:n}})}function Gr(e,t,r){let n=!!e[t]&&Object.prototype.propertyIsEnumerable.call(e,t);Object.defineProperty(e,t,{configurable:!0,enumerable:n,writable:!0,value:r})}var Vu="browser.brands",ku="browser.language",Fu="browser.mobile",$u="browser.platform";var zu="user_agent.original";var Wu="0.2.0";function ju(e,t,r){typeof t=="string"&&t&&(e["service.name"]=t),typeof r=="string"&&r&&(e["service.version"]=r);let{userAgent:n,userAgentData:o}=navigator,i=km(n),s;return o?(s={name:o.platform,version:""},e[Vu]=o.brands.map(a=>`${a.brand} ${a.version}`)):s=Vm(n),i&&(e["browser.name"]=i.name,i.version&&(e["browser.version"]=i.version)),s&&(e[$u]=s.name),e[Fu]=navigator.userAgent.includes("Mobi"),e[ku]=navigator.language,e[zu]=n,e["telemetry.distro.name"]="elastic",e["telemetry.distro.version"]=Wu,In({...e,...Mt})}function Vm(e){let t=[["Symbian",[/SymbianOS\/([\w\.]+)/i]],["Windows Phone",[/Windows Phone ([\w\.]+)/i]],["Xbox",[/Xbox?/i]],["Windows",[/Windows (\d+)/i]],["Windows RT",[/Windows NT ([\w\.]+).+ARM;/i]],["Windows",[/Windows NT (\d+\.\d+)/i]],["Windows IoT",[/Windows IoT (\d+\.\d+)/i]],["iOS",[/iPhone OS (\d+(_\d+)*)/i,/iPad;.+CPU OS (\d+(_\d+)*)/i]],["macOS",[/Mac OS (\d+(_\d+)*)/i,/Mac OS X ([\w\.]+)/i,/Intel Mac OS X/]],["Ubuntu Touch",[/Ubuntu ([\w\.]+).+Mobile/i]],["Android",[/Android ([\w\.]+)/i,/Android;/i]],["Linux",[/Linux ([\w_]+)/i,/Linux;/]]];for(let r of t){let[n,o]=r;for(let i of o){let s=i.exec(e);if(s){let a;return s[1]&&(a=s[1].replaceAll("_",".")),{name:n,version:a}}}}}function km(e){let t=[["AliPay",[/AliPayClient\/([\w\.]+)/i]],["Baidu",[/bd(?:browser|spark)\/([\w\.]+)/i,/baidu(?:boxapp|hd)\/([\w\.]+)/i,/BIDUBrowser\/([\w\.]+)/i]],["Bing",[/Bing(?:Web|Sapphire)\/([\w\.]+)/i]],["Camino",[/Camino\/([\w\.]+)/i]],["Coc Coc",[/coc_coc_browser\/([\w\.]+)/i]],["Dragon",[/(?:Dragon|Comodo_Dragon)\/([\w\.]+)/i]],["DuckDuckGo",[/(?:Ddg|DuckDuckGo)\/([\w\.]+)/i]],["Electron",[/Electron\/([\w\.]+)/i]],["Facebook",[/;fbav\/([\w\.]+);/i,/(?:fban\/fbios|fb_iab\/fb4a)/i]],["GSA",[/GSA\/([\w\.]+)/i]],["Huawei Browser",[/HuaweiBrowser\/([\w\.]+)/i]],["Iron",[/(?:Iron|Iron Safari)\/([\w\.]+)/i]],["LG Browser",[/LG Browser\/([\w\.]+)/i]],["Lunascape",[/Lunascape\/([\w\.]+)/i]],["Maxthon",[/Maxthon\/([\w\.]+)/i,/Mx(?:Browser|iOS)\/([\w\.]+)/i]],["MIUI Browser",[/MiuiBrowser\/([\w\.]+)/i]],["NokiaBrowser",[/NokiaBrowser\/([\w\.]+)/i]],["Oculus Browser",[/OculusBrowser\/([\w\.]+)/i]],["Pico Browser",[/PicoBrowser\/([\w\.]+)/i]],["Qwant",[/Qwant(?:Mobile|Browser|iOS)\/([\w\.]+)/i]],["Samsung Internet",[/SamsungBrowser\/([\w\.]+)/i]],["Silk",[/Silk\/([\w\.]+)/i]],["Smart Lenovo Browser",[/SLBrowser\/([\w\.]+)/i]],["Snapchat",[/Snapchat\/([\w\.]+)/i]],["Steam",[/Valve Steam/i]],["TikTok",[/musical_ly.+app_version\/([\w\.]+)/i]],["Twitter",[/Twitter/i]],["Vivaldi",[/Vivaldi\/([\w\.]+)/i]],["Yandex",[/Ya(?:SearchBrowser|Browser)\/([\w\.]+)/i]],["WeChat",[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i]],["QQBrowser",[/M?QQbrowser\/([\w\.]+)/i]],["Brave",[/Brave\/([\w\.]+)/i]],["Edge",[/(?:Edg|Edge|EdgA|EdgW|EdgiOS)\/([\w\.]+)/i]],["Opera",[/(?:OPR|OPT|OPiOS|Opera)\/([\w\.]+)/i,/Coast\/([\w\.]+)/i]],["Chromium",[/Chromium\/([\w\.]+)/i]],["Chrome Headless",[/HeadlessChrome\/([\w\.]+)/i,/HeadlessChrome Safari\/([\w\.]+)/i]],["Chrome",[/Chrome\/([\w\.]+)/i,/Cr(?:iOS|Mo)\/([\w\.]+)/i]],["Android Browser",[/Android \d.+Safari\/([\w\.]+)/i]],["Firefox",[/(?:Firefox|FxiOS)\/([\w\.]+)/i]],["Safari",[/Safari\/([\w\.]+)/i]]];for(let r of t){let[n,o]=r;for(let i of o){let s=i.exec(e);if(s){let a;return s[1]&&(a=s[1].replaceAll("_",".")),{name:n,version:a}}}}}var Ku=!1,Xu={logLevel:"info",sampleRate:1,serviceName:"unknown_service:web",resourceAttributes:{},otlpEndpoint:"http://localhost:4318",exportHeaders:{}};function Yu(e={}){if(Ku||e.disabled)return;let t=e.logLevel??Xu.logLevel;l.setLogger(Ho({logLevel:t}),{logLevel:O.ALL}),l.debug("Browser SDK intialization",e);let{serviceName:r,serviceVersion:n}=e,o={...Xu,...e},i;try{i=new URL(o.otlpEndpoint)}catch{l.error(`The value "${o.otlpEndpoint}" for "otlpEndpoint" configuration is not an URL. SDK won't start.`);return}let s=ju(o.resourceAttributes,r,n),a=Rs(i,"v1/traces").href,c=new Ne(new we({url:a,headers:o.exportHeaders})),u=new Ar({resource:s,sampler:new Gt(o.sampleRate),spanProcessors:[c]});u.register({contextManager:Bu});let p=Rs(i,"v1/metrics").href,_=new _r({exporter:new be({url:p,headers:o.exportHeaders})}),f=new hr({resource:s,readers:[_]});$t.setGlobalMeterProvider(f);let m=Rs(i,"v1/logs").href,d=new Le(new Oe({url:m,headers:o.exportHeaders})),h=new Er({resource:s,processors:[d]});Ct.setGlobalLoggerProvider(h);let g={"@opentelemetry/instrumentation-document-load":x=>new Lr(x),"@opentelemetry/instrumentation-fetch":x=>new Cr(x),"@opentelemetry/instrumentation-long-task":x=>new Pr(x),"@opentelemetry/instrumentation-user-interaction":x=>new Ir(x),"@opentelemetry/instrumentation-xml-http-request":x=>new vr(x),"@opentelemetry/instrumentation-web-exception":x=>new Dr(x),"@opentelemetry/instrumentation-web-vitals":x=>new As(x)},b={semconvStabilityOptIn:"http"},$=o.instrumentations||{},V=[];for(let x of Object.keys(g)){let Lt=$[x];(x==="@opentelemetry/instrumentation-fetch"||x==="@opentelemetry/instrumentation-xml-http-request")&&(Lt={...b,...Lt}),Lt?.enabled===!1||V.push(g[x](Lt))}return ns({instrumentations:V}),Ku=!0,{forceFlush(){return Promise.all([u.forceFlush(),f.forceFlush(),h.forceFlush()]).then(()=>{})}}}function Rs(e,t){let r=new URL(e.href);return r.pathname=(r.pathname+t).replace("//","/"),r}globalThis.startBrowserSdk=Yu;})();
|
|
12
|
+
`,ms(i,t),`To resolve the conflict:
|
|
13
|
+
`,ds(i,t))}return n}};var io=class{_backingStorages;constructor(t){this._backingStorages=t}record(t,r,n,o){let i=this._backingStorages;for(let s=0;s<i.length;s++)i[s].record(t,r,n,o)}};var so=class{_buffer=new q;_instrumentName;_valueType;constructor(t,r){this._instrumentName=t,this._valueType=r}observe(t,r={}){if(typeof t!="number"){l.warn(`non-number value provided to metric ${this._instrumentName}: ${t}`);return}this._valueType===K.INT&&!Number.isInteger(t)&&(l.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||this._buffer.set(r,t)}},ao=class{_buffer=new Map;observe(t,r,n={}){if(!Or(t))return;let o=this._buffer.get(t);if(o==null&&(o=new q,this._buffer.set(t,o)),typeof r!="number"){l.warn(`non-number value provided to metric ${t._descriptor.name}: ${r}`);return}t._descriptor.valueType===K.INT&&!Number.isInteger(r)&&(l.warn(`INT value type cannot accept a floating-point value for ${t._descriptor.name}, ignoring the fractional digits.`),r=Math.trunc(r),!Number.isInteger(r))||o.set(n,r)}};var co=class{_callbacks=[];_batchCallbacks=[];addCallback(t,r){this._findCallback(t,r)>=0||this._callbacks.push({callback:t,instrument:r})}removeCallback(t,r){let n=this._findCallback(t,r);n<0||this._callbacks.splice(n,1)}addBatchCallback(t,r){let n=new Set(r.filter(Or));if(n.size===0){l.error("BatchObservableCallback is not associated with valid instruments",r);return}this._findBatchCallback(t,n)>=0||this._batchCallbacks.push({callback:t,instruments:n})}removeBatchCallback(t,r){let n=new Set(r.filter(Or)),o=this._findBatchCallback(t,n);o<0||this._batchCallbacks.splice(o,1)}async observe(t,r){let n=this._observeCallbacks(t,r),o=this._observeBatchCallbacks(t,r);return(await Promise.allSettled([...n,...o])).filter(a=>a.status==="rejected").map(a=>a.reason)}_observeCallbacks(t,r){return this._callbacks.map(async({callback:n,instrument:o})=>{let i=new so(o._descriptor.name,o._descriptor.valueType),s=Promise.resolve(n(i));r!=null&&(s=Gt(s,r)),await s,o._metricStorages.forEach(a=>{a.record(i._buffer,t)})})}_observeBatchCallbacks(t,r){return this._batchCallbacks.map(async({callback:n,instruments:o})=>{let i=new ao,s=Promise.resolve(n(i));r!=null&&(s=Gt(s,r)),await s,o.forEach(a=>{let c=i._buffer.get(a);c!=null&&a._metricStorages.forEach(u=>{u.record(c,t)})})})}_findCallback(t,r){return this._callbacks.findIndex(n=>n.callback===t&&n.instrument===r)}_findBatchCallback(t,r){return this._batchCallbacks.findIndex(n=>n.callback===t&&nc(n.instruments,r))}};var uo=class extends Ee{_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;_attributesProcessor;constructor(t,r,n,o,i){super(t),this._aggregationCardinalityLimit=i,this._deltaMetricStorage=new Ae(r,this._aggregationCardinalityLimit),this._temporalMetricStorage=new Se(r,o),this._attributesProcessor=n}record(t,r,n,o){r=this._attributesProcessor.process(r,n),this._deltaMetricStorage.record(t,r,n,o)}collect(t,r){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(t,this._instrumentDescriptor,n,r)}};var hs=class{process(t,r){return t}},fs=class{_processors;constructor(t){this._processors=t}process(t,r){let n=t;for(let o of this._processors)n=o.process(n,r);return n}};function lo(){return o_}function Lc(e){return new fs(e)}var o_=new hs;var po=class{metricStorageRegistry=new oo;observableRegistry=new co;meter;_meterProviderSharedState;_instrumentationScope;constructor(t,r){this.meter=new ro(this),this._meterProviderSharedState=t,this._instrumentationScope=r}registerMetricStorage(t){let r=this._registerMetricStorage(t,uo);return r.length===1?r[0]:new io(r)}registerAsyncMetricStorage(t){return this._registerMetricStorage(t,no)}async collect(t,r,n){let o=await this.observableRegistry.observe(r,n?.timeoutMillis),i=this.metricStorageRegistry.getStorages(t);if(i.length===0)return null;let s=[];return i.forEach(a=>{let c=a.collect(t,r);c!=null&&s.push(c)}),s.length===0?{errors:o}:{scopeMetrics:{scope:this._instrumentationScope,metrics:s},errors:o}}_registerMetricStorage(t,r){let o=this._meterProviderSharedState.viewRegistry.findViews(t,this._instrumentationScope).map(i=>{let s=xc(i,t),a=this.metricStorageRegistry.findOrUpdateCompatibleStorage(s);if(a!=null)return a;let c=i.aggregation.createAggregator(s),u=new r(s,c,i.attributesProcessor,this._meterProviderSharedState.metricCollectors,i.aggregationCardinalityLimit);return this.metricStorageRegistry.register(u),u});if(o.length===0){let s=this._meterProviderSharedState.selectAggregations(t.type).map(([a,c])=>{let u=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(a,t);if(u!=null)return u;let p=c.createAggregator(t),m=a.selectCardinalityLimit(t.type),f=new r(t,p,lo(),[a],m);return this.metricStorageRegistry.registerForCollector(a,f),f});o=o.concat(s)}return o}};var _o=class{viewRegistry=new Xn;metricCollectors=[];meterSharedStates=new Map;resource;constructor(t){this.resource=t}getMeterSharedState(t){let r=rc(t),n=this.meterSharedStates.get(r);return n==null&&(n=new po(this,t),this.meterSharedStates.set(r,n)),n}selectAggregations(t){let r=[];for(let n of this.metricCollectors)r.push([n,Wn(n.selectAggregation(t))]);return r}};var mo=class{_sharedState;_metricReader;constructor(t,r){this._sharedState=t,this._metricReader=r}async collect(t){let r=I(Date.now()),n=[],o=[],i=Array.from(this._sharedState.meterSharedStates.values()).map(async s=>{let a=await s.collect(this,r,t);a?.scopeMetrics!=null&&n.push(a.scopeMetrics),a?.errors!=null&&o.push(...a.errors)});return await Promise.all(i),{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:n},errors:o}}async forceFlush(t){await this._metricReader.forceFlush(t)}async shutdown(t){await this._metricReader.shutdown(t)}selectAggregationTemporality(t){return this._metricReader.selectAggregationTemporality(t)}selectAggregation(t){return this._metricReader.selectAggregation(t)}selectCardinalityLimit(t){return this._metricReader.selectCardinalityLimit?.(t)??2e3}};var i_=/[\^$\\.+?()[\]{}|]/g,Re=class e{_matchAll;_regexp;constructor(t){t==="*"?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(e.escapePattern(t)))}match(t){return this._matchAll?!0:this._regexp.test(t)}static escapePattern(t){return`^${t.replace(i_,"\\$&").replace("*",".*")}$`}static hasWildcard(t){return t.includes("*")}},Vt=class{_matchAll;_pattern;constructor(t){this._matchAll=t===void 0,this._pattern=t}match(t){return!!(this._matchAll||t===this._pattern)}};var ho=class{_nameFilter;_type;_unitFilter;constructor(t){this._nameFilter=new Re(t?.name??"*"),this._type=t?.type,this._unitFilter=new Vt(t?.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}};var fo=class{_nameFilter;_versionFilter;_schemaUrlFilter;constructor(t){this._nameFilter=new Vt(t?.name),this._versionFilter=new Vt(t?.version),this._schemaUrlFilter=new Vt(t?.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}};function s_(e){return e.instrumentName==null&&e.instrumentType==null&&e.instrumentUnit==null&&e.meterName==null&&e.meterVersion==null&&e.meterSchemaUrl==null}function a_(e){if(s_(e))throw new Error("Cannot create view with no selector arguments supplied");if(e.name!=null&&(e?.instrumentName==null||Re.hasWildcard(e.instrumentName)))throw new Error("Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.")}var To=class{name;description;aggregation;attributesProcessor;instrumentSelector;meterSelector;aggregationCardinalityLimit;constructor(t){a_(t),t.attributesProcessors!=null?this.attributesProcessor=Lc(t.attributesProcessors):this.attributesProcessor=lo(),this.name=t.name,this.description=t.description,this.aggregation=Wn(t.aggregation??{type:k.DEFAULT}),this.instrumentSelector=new ho({name:t.instrumentName,type:t.instrumentType,unit:t.instrumentUnit}),this.meterSelector=new fo({name:t.meterName,version:t.meterVersion,schemaUrl:t.meterSchemaUrl}),this.aggregationCardinalityLimit=t.aggregationCardinalityLimit}};var Lr=class{_sharedState;_shutdown=!1;constructor(t){if(this._sharedState=new _o(t?.resource??qt()),t?.views!=null&&t.views.length>0)for(let r of t.views)this._sharedState.viewRegistry.addView(new To(r));if(t?.readers!=null&&t.readers.length>0)for(let r of t.readers){let n=new mo(this._sharedState,r);r.setMetricProducer(n),this._sharedState.metricCollectors.push(n),t.sdkMetricsEnabled&&r instanceof he&&r._setSelfObsMeterProvider(this)}}getMeter(t,r="",n={}){return this._shutdown?(l.warn("A shutdown MeterProvider cannot provide a Meter"),St()):this._sharedState.getMeterSharedState({name:t,version:r,schemaUrl:n.schemaUrl}).meter}async shutdown(t){if(this._shutdown){l.warn("shutdown may only be called once per MeterProvider");return}this._shutdown=!0,await Promise.all(this._sharedState.metricCollectors.map(r=>r.shutdown(t)))}async forceFlush(t){if(this._shutdown){l.warn("invalid attempt to force flush after MeterProvider shutdown");return}await Promise.all(this._sharedState.metricCollectors.map(r=>r.forceFlush(t)))}};function xe(e,t){let r={attributes:et(e.attributes,t),droppedAttributesCount:0},n=e.schemaUrl;return n&&n!==""&&(r.schemaUrl=n),r}function Oe(e,t){let r={name:e.name,version:e.version};return e.attributes&&Object.keys(e.attributes).length>0&&(r.attributes=et(e.attributes,t),r.droppedAttributesCount=e.droppedAttributesCount??0),r}function et(e,t){return Object.keys(e).map(r=>c_(r,e[r],t))}function c_(e,t,r){return{key:e,value:br(t,r)}}function br(e,t){let r=typeof e;if(r==="string")return{stringValue:e};if(r==="number")return Number.isInteger(e)?{intValue:e}:{doubleValue:e};if(r==="boolean")return{boolValue:e};if(e instanceof Uint8Array)return{bytesValue:t.encodeUint8Array(e)};if(Array.isArray(e)){let n=new Array(e.length);for(let o=0;o<e.length;o++)n[o]=br(e[o],t);return{arrayValue:{values:n}}}if(r==="object"&&e!=null){let n=Object.keys(e),o=new Array(n.length);for(let i=0;i<n.length;i++)o[i]={key:n[i],value:br(e[n[i]],t)};return{kvlistValue:{values:o}}}return{}}function bc(e,t){return{resourceLogs:l_(e,t)}}function u_(e){let t=new Map;for(let r of e){let{resource:n,instrumentationScope:o}=r,i=t.get(n);i||(i=new Map,t.set(n,i));let s=i.get(o);s||(s=[],i.set(o,s)),s.push(r)}return t}function l_(e,t){let r=u_(e);return Array.from(r,([n,o])=>{let i=xe(n,t);return{resource:i,scopeLogs:Array.from(o,([,s])=>({scope:Oe(s[0].instrumentationScope,t),logRecords:s.map(a=>p_(a,t)),schemaUrl:s[0].instrumentationScope.schemaUrl})),schemaUrl:i.schemaUrl}})}function p_(e,t){return{timeUnixNano:t.encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:e.severityNumber,severityText:e.severityText,body:br(e.body,t),eventName:e.eventName,attributes:et(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,flags:e.spanContext?.traceFlags,traceId:t.encodeOptionalSpanContext(e.spanContext?.traceId),spanId:t.encodeOptionalSpanContext(e.spanContext?.spanId)}}function __(e){let t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function m_(e){return __(e).toString()}var d_=typeof BigInt<"u"?m_:Z;function wc(e){return e}var Le={encodeHrTime:d_,encodeSpanContext:wc,encodeOptionalSpanContext:wc,encodeUint8Array:e=>{if(typeof Buffer<"u")return Buffer.from(e).toString("base64");let t=new Array(e.length);for(let r=0;r<e.length;r++)t[r]=String.fromCharCode(e[r]);return btoa(t.join(""))}};var go={serializeRequest:e=>{let t=bc(e,Le);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(r){return l.warn(`Failed to parse logs export response: ${r.message}. Returning empty response`),{}}}};var wr;(function(e){e[e.AGGREGATION_TEMPORALITY_UNSPECIFIED=0]="AGGREGATION_TEMPORALITY_UNSPECIFIED",e[e.AGGREGATION_TEMPORALITY_DELTA=1]="AGGREGATION_TEMPORALITY_DELTA",e[e.AGGREGATION_TEMPORALITY_CUMULATIVE=2]="AGGREGATION_TEMPORALITY_CUMULATIVE"})(wr||(wr={}));function h_(e,t){let r=xe(e.resource,t);return{resource:r,schemaUrl:r.schemaUrl,scopeMetrics:f_(e.scopeMetrics,t)}}function f_(e,t){return Array.from(e.map(r=>({scope:Oe(r.scope,t),metrics:r.metrics.map(n=>T_(n,t)),schemaUrl:r.scope.schemaUrl})))}function T_(e,t){let r={name:e.descriptor.name,description:e.descriptor.description,unit:e.descriptor.unit},n=S_(e.aggregationTemporality);switch(e.dataPointType){case H.SUM:r.sum={aggregationTemporality:n,isMonotonic:e.isMonotonic,dataPoints:Nc(e,t)};break;case H.GAUGE:r.gauge={dataPoints:Nc(e,t)};break;case H.HISTOGRAM:r.histogram={aggregationTemporality:n,dataPoints:E_(e,t)};break;case H.EXPONENTIAL_HISTOGRAM:r.exponentialHistogram={aggregationTemporality:n,dataPoints:A_(e,t)};break}return r}function g_(e,t,r){let n={attributes:et(e.attributes,r),startTimeUnixNano:r.encodeHrTime(e.startTime),timeUnixNano:r.encodeHrTime(e.endTime)};switch(t){case K.INT:n.asInt=e.value;break;case K.DOUBLE:n.asDouble=e.value;break}return n}function Nc(e,t){return e.dataPoints.map(r=>g_(r,e.descriptor.valueType,t))}function E_(e,t){return e.dataPoints.map(r=>{let n=r.value;return{attributes:et(r.attributes,t),bucketCounts:n.buckets.counts,explicitBounds:n.buckets.boundaries,count:n.count,sum:n.sum,min:n.min,max:n.max,startTimeUnixNano:t.encodeHrTime(r.startTime),timeUnixNano:t.encodeHrTime(r.endTime)}})}function A_(e,t){return e.dataPoints.map(r=>{let n=r.value;return{attributes:et(r.attributes,t),count:n.count,min:n.min,max:n.max,sum:n.sum,positive:{offset:n.positive.offset,bucketCounts:n.positive.bucketCounts},negative:{offset:n.negative.offset,bucketCounts:n.negative.bucketCounts},scale:n.scale,zeroCount:n.zeroCount,startTimeUnixNano:t.encodeHrTime(r.startTime),timeUnixNano:t.encodeHrTime(r.endTime)}})}function S_(e){switch(e){case G.DELTA:return wr.AGGREGATION_TEMPORALITY_DELTA;case G.CUMULATIVE:return wr.AGGREGATION_TEMPORALITY_CUMULATIVE}}function yc(e,t){return{resourceMetrics:e.map(r=>h_(r,t))}}var Eo={serializeRequest:e=>{let t=yc([e],Le);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(r){return l.warn(`Failed to parse metrics export response: ${r.message}. Returning empty response`),{}}}};var R_=256,x_=512;function Cc(e,t){let r=e&255|R_;return t&&(r|=x_),r}function O_(e,t){let r=e.spanContext(),n=e.status,o=e.parentSpanContext?.spanId?t.encodeSpanContext(e.parentSpanContext?.spanId):void 0;return{traceId:t.encodeSpanContext(r.traceId),spanId:t.encodeSpanContext(r.spanId),parentSpanId:o,traceState:r.traceState?.serialize(),name:e.name,kind:e.kind==null?0:e.kind+1,startTimeUnixNano:t.encodeHrTime(e.startTime),endTimeUnixNano:t.encodeHrTime(e.endTime),attributes:et(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(i=>b_(i,t)),droppedEventsCount:e.droppedEventsCount,status:{code:n.code,message:n.message},links:e.links.map(i=>L_(i,t)),droppedLinksCount:e.droppedLinksCount,flags:Cc(r.traceFlags,e.parentSpanContext?.isRemote)}}function L_(e,t){return{attributes:e.attributes?et(e.attributes,t):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:e.context.traceState?.serialize(),droppedAttributesCount:e.droppedAttributesCount||0,flags:Cc(e.context.traceFlags,e.context.isRemote)}}function b_(e,t){return{attributes:e.attributes?et(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function Pc(e,t){return{resourceSpans:N_(e,t)}}function w_(e){let t=new Map;for(let r of e){let n=t.get(r.resource);n||(n=new Map,t.set(r.resource,n));let o=`${r.instrumentationScope.name}@${r.instrumentationScope.version||""}:${r.instrumentationScope.schemaUrl||""}`,i=n.get(o);i||(i=[],n.set(o,i)),i.push(r)}return t}function N_(e,t){let r=w_(e),n=[],o=r.entries(),i=o.next();for(;!i.done;){let[s,a]=i.value,c=[],u=a.values(),p=u.next();for(;!p.done;){let _=p.value;if(_.length>0){let d=_.map(h=>O_(h,t));c.push({scope:Oe(_[0].instrumentationScope,t),spans:d,schemaUrl:_[0].instrumentationScope.schemaUrl})}p=u.next()}let m=xe(s,t),f={resource:m,scopeSpans:c,schemaUrl:m.schemaUrl};n.push(f),i=o.next()}return n}var Ao={serializeRequest:e=>{let t=Pc(e,Le);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(r){return l.warn(`Failed to parse trace export response: ${r.message}. Returning empty response`),{}}}};var Ts=5,y_=1e3,C_=5e3,P_=1.5,Ic=.2;function I_(){return Math.random()*(2*Ic)-Ic}var gs=class{_transport;constructor(t){this._transport=t}retry(t,r,n){return new Promise((o,i)=>{setTimeout(()=>{this._transport.send(t,r).then(o,i)},n)})}async send(t,r){let n=Ts,o=y_,i=Date.now()+r,s=await this._transport.send(t,r);for(;s.status==="retryable"&&n>0;){n--;let a=Math.max(Math.min(o*(1+I_()),C_),0);o=o*P_;let c=s.retryInMillis??a,u=i-Date.now();if(c>u)return l.info(`Export retry time ${Math.round(c)}ms exceeds remaining timeout ${Math.round(u)}ms, not retrying further.`),s;l.verbose(`Scheduling export retry in ${Math.round(c)}ms`),s=await this.retry(t,u,c)}return s.status==="success"?l.verbose(`Export succeeded after ${Ts-n} retry attempts.`):s.status==="retryable"?l.info(`Export failed after maximum retry attempts (${Ts}).`):l.info(`Export failed with non-retryable error: ${s.error}`),s}shutdown(){return this._transport.shutdown()}};function Mc(e){return new gs(e.transport)}function vc(e){return e===429||e===502||e===503||e===504}function Dc(e){if(e==null)return;let t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?t*1e3:-1;let r=new Date(e).getTime()-Date.now();return r>=0?r:0}var M_=60*1024,v_=9,Es=0,So=0,As=class{_parameters;constructor(t){this._parameters=t}async send(t,r){let n=new AbortController,o=setTimeout(()=>n.abort(),r),i=globalThis.fetch;typeof i.__original=="function"&&(i=i.__original);let s=t.byteLength,a=Es+s>M_,c=So>=v_,u=!a&&!c;if(u)Es+=s,So++;else{let p=a?"size limit":"count limit";l.debug(`keepalive disabled: ${(s/1024).toFixed(1)}KB payload, ${So} pending (${p})`)}try{let p=new URL(this._parameters.url),m=await i(p.href,{method:"POST",headers:await this._parameters.headers(),body:t,signal:n.signal,keepalive:u,mode:globalThis.location?globalThis.location.origin===p.origin?"same-origin":"cors":"no-cors"});if(m.status>=200&&m.status<=299)return l.debug(`export response success (status: ${m.status})`),{status:"success"};if(vc(m.status)){l.warn(`export response retryable (status: ${m.status})`);let f=m.headers.get("Retry-After");return{status:"retryable",retryInMillis:Dc(f)}}return l.error(`export response failure (status: ${m.status})`),{status:"failure",error:new Error(`Fetch request failed with non-retryable status ${m.status}`)}}catch(p){return D_(p)?(l.warn(`export request retryable (network error: ${p})`),{status:"retryable",error:new Error("Fetch request encountered a network error",{cause:p})}):(l.error(`export request failure (error: ${p})`),{status:"failure",error:new Error("Fetch request errored",{cause:p})})}finally{clearTimeout(o),u&&(Es-=s,So--)}}shutdown(){}};function Uc(e){return new As(e)}function D_(e){return e instanceof TypeError&&!e.cause}function Bc(e,t){return ec(e,t,Mc({transport:Uc(e)}))}function Gc(e){let t={};return Object.entries(e??{}).forEach(([r,n])=>{typeof n<"u"?t[r]=String(n):l.warn(`Header "${r}" has invalid value (${n}) and will be ignored`)}),t}function U_(e,t,r){return async()=>{let n={...await r()},o={};return t!=null&&Object.assign(o,await t()),e!=null&&Object.assign(o,Gc(await e())),Object.assign(o,n)}}function B_(e){if(e!=null)try{let t=globalThis.location?.href;return new URL(e,t).href}catch{throw new Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function Hc(e,t,r){return{...La(e,t,r),headers:U_(e.headers,t.headers,r.headers),url:B_(e.url)??t.url??r.url}}function Vc(e,t){return{...ba(),headers:async()=>e,url:"http://localhost:4318/"+t}}function kc(e){return typeof e.headers=="function"?e.headers:Oa(e.headers)}function Fc(e,t,r){return Hc({url:e.url,timeoutMillis:e.timeoutMillis,headers:kc(e),concurrencyLimit:e.concurrencyLimit},{},Vc(r,t))}function Qt(e,t,r,n){let o=Fc(e,r,n);return Bc(o,t)}var be=class extends bt{constructor(t={}){super(Qt(t,go,"v1/logs",{"Content-Type":"application/json"}))}};var Nr;(function(e){e[e.DELTA=0]="DELTA",e[e.CUMULATIVE=1]="CUMULATIVE",e[e.LOWMEMORY=2]="LOWMEMORY"})(Nr||(Nr={}));var Ss=()=>G.CUMULATIVE,zc=e=>{switch(e){case T.COUNTER:case T.OBSERVABLE_COUNTER:case T.GAUGE:case T.HISTOGRAM:case T.OBSERVABLE_GAUGE:return G.DELTA;case T.UP_DOWN_COUNTER:case T.OBSERVABLE_UP_DOWN_COUNTER:return G.CUMULATIVE}},$c=e=>{switch(e){case T.COUNTER:case T.HISTOGRAM:return G.DELTA;case T.GAUGE:case T.UP_DOWN_COUNTER:case T.OBSERVABLE_UP_DOWN_COUNTER:case T.OBSERVABLE_COUNTER:case T.OBSERVABLE_GAUGE:return G.CUMULATIVE}};function G_(){let e=(void 0??"cumulative").toLowerCase();return e==="cumulative"?Ss:e==="delta"?zc:e==="lowmemory"?$c:(l.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${e}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`),Ss)}function H_(e){return e!=null?e===Nr.DELTA?zc:e===Nr.LOWMEMORY?$c:Ss:G_()}var V_=Object.freeze({type:k.DEFAULT});function k_(e){return e?.aggregationPreference??(()=>V_)}var Ro=class extends bt{_aggregationTemporalitySelector;_aggregationSelector;constructor(t,r){super(t),this._aggregationSelector=k_(r),this._aggregationTemporalitySelector=H_(r?.temporalityPreference)}selectAggregation(t){return this._aggregationSelector(t)}selectAggregationTemporality(t){return this._aggregationTemporalitySelector(t)}};var we=class extends Ro{constructor(t){super(Qt(t??{},Eo,"v1/metrics",{"Content-Type":"application/json"}),t)}};var Ne=class extends bt{constructor(t={}){super(Qt(t,Ao,"v1/traces",{"Content-Type":"application/json"}))}};function F_(e){return Rs(e,new WeakSet)}function Rs(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(!Rs(n,t))return!1;return!0}let r=e;if(r.constructor!==Object&&r.constructor!==void 0)return!1;for(let n in r)if(Object.prototype.hasOwnProperty.call(r,n)&&!Rs(r[n],t))return!1;return!0}return!1}var Q;(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"})(Q||(Q={}));function Os(e,t,r,n,o){if(n.length===0)return l.warn(`Invalid attribute key: ${n}`),Q.DROP_INVALID;if(!F_(o))return l.warn(`Invalid attribute value set for key: ${n}`),Q.DROP_INVALID;let i=!Object.prototype.hasOwnProperty.call(e,n);return i&&r>=t.attributeCountLimit?Q.DROP_LIMIT_REACHED:(e[n]=xs(o,t.attributeValueLengthLimit),i?Q.ADD_NEW:Q.ADD_OVERWRITE_EXISTING)}function xs(e,t){if(t<=0)return l.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(r=>xs(r,t));if(typeof e=="object"){let r={};for(let[n,o]of Object.entries(e))r[n]=xs(o,t);return r}return e}function Wc(e,t){if(t==null)return{};let r={},n=0,o=0;for(let[i,s]of Object.entries(t)){let a=Os(r,e,n,i,s);a===Q.ADD_NEW?n+=1:(a===Q.DROP_INVALID||a===Q.DROP_LIMIT_REACHED)&&(o+=1)}return{attributes:n>0?r:void 0,droppedAttributesCount:o}}var xo=class{hrTime;hrTimeObserved;spanContext;resource;instrumentationScope;attributes={};_severityText;_severityNumber;_body;_eventName;_attributesCount=0;_droppedAttributesCount=0;_isReadonly=!1;_logRecordLimits;set severityText(t){this._isLogRecordReadonly()||(this._severityText=t)}get severityText(){return this._severityText}set severityNumber(t){this._isLogRecordReadonly()||(this._severityNumber=t)}get severityNumber(){return this._severityNumber}set body(t){this._isLogRecordReadonly()||(this._body=t)}get body(){return this._body}get eventName(){return this._eventName}set eventName(t){this._isLogRecordReadonly()||(this._eventName=t)}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(t,r,n){let{timestamp:o,observedTimestamp:i,eventName:s,severityNumber:a,severityText:c,body:u,attributes:p={},exception:m,context:f}=n,_=Date.now();if(this.hrTime=lt(o??_),this.hrTimeObserved=lt(i??_),f){let d=S.getSpanContext(f);d&&X(d)&&(this.spanContext=d)}this.severityNumber=a,this.severityText=c,this.body=u,this.resource=t.resource,this.instrumentationScope=r,this._logRecordLimits=t.logRecordLimits,this._eventName=s,this.setAttributes(p),m!=null&&this._setException(m)}setAttribute(t,r){if(this._isLogRecordReadonly())return this;let n=Os(this.attributes,this._logRecordLimits,this._attributesCount,t,r);return n===Q.DROP_LIMIT_REACHED?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&l.warn("Dropping extra attributes.")):n===Q.ADD_NEW&&this._attributesCount++,this}setAttributes(t){for(let[r,n]of Object.entries(t))this.setAttribute(r,n);return this}setBody(t){return this.body=t,this}setEventName(t){return this.eventName=t,this}setSeverityNumber(t){return this.severityNumber=t,this}setSeverityText(t){return this.severityText=t,this}_makeReadonly(){this._isReadonly=!0}_setException(t){let r=!1;if(typeof t=="string"||typeof t=="number")Object.hasOwn(this.attributes,J)||this.setAttribute(J,String(t)),r=!0;else if(t&&typeof t=="object"){let n=t;n.code?(Object.hasOwn(this.attributes,nt)||this.setAttribute(nt,n.code.toString()),r=!0):n.name&&(Object.hasOwn(this.attributes,nt)||this.setAttribute(nt,n.name),r=!0),n.message&&(Object.hasOwn(this.attributes,J)||this.setAttribute(J,n.message),r=!0),n.stack&&(Object.hasOwn(this.attributes,Xt)||this.setAttribute(Xt,n.stack),r=!0)}r||l.warn(`Failed to record an exception ${t}`)}_isLogRecordReadonly(){return this._isReadonly&&l.warn("Can not execute the operation on emitted log record"),this._isReadonly}};var Oo=class{_instrumentationScope;_sharedState;_loggerConfig;constructor(t,r){this._instrumentationScope=t,this._sharedState=r,this._loggerConfig=this._sharedState.getLoggerConfig(this._instrumentationScope)}emit(t){let r=t.context||E.active();if(!this.enabled(t))return;let n=new xo(this._sharedState,this._instrumentationScope,{context:r,...t});this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(n,r),n._makeReadonly()}enabled(t){let r=this._loggerConfig;if(r.disabled)return!1;let n=t?.severityNumber;if(typeof n=="number"&&n!==Lt.UNSPECIFIED&&n<r.minimumSeverity)return!1;let o=t?.context||E.active();if(r.traceBased){let s=S.getSpanContext(o);if(s&&X(s)&&!((s.traceFlags&C.SAMPLED)===C.SAMPLED))return!1}let i={context:o,instrumentationScope:this._instrumentationScope,severityNumber:t?.severityNumber,eventName:t?.eventName};for(let s of this._sharedState.processors)if(!s.enabled||s.enabled(i))return!0;return!1}};var Lo=class{forceFlush(){return Promise.resolve()}onEmit(t,r){}shutdown(){return Promise.resolve()}enabled(t){return!1}};var bo=class{processors;forceFlushTimeoutMillis;constructor(t,r){this.processors=t,this.forceFlushTimeoutMillis=r}async forceFlush(){let t=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(r=>Yi(r.forceFlush(),t)))}onEmit(t,r){this.processors.forEach(n=>n.onEmit(t,r))}async shutdown(){await Promise.all(this.processors.map(t=>t.shutdown()))}enabled(t){for(let r of this.processors)if(!r.enabled||r.enabled(t))return!0;return!1}};function Ls(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(Ls)]:["map",Object.entries(e).sort(([r],[n])=>r.localeCompare(n)).map(([r,n])=>[r,Ls(n)])]}function wo(e){return JSON.stringify([e.name,e.version||"",e.schemaUrl||"",Ls(e.attributes),e.droppedAttributesCount??0])}var jc="otel.sdk.log.created";var No=class{createdLogs;constructor(t){this.createdLogs=t.createCounter(jc,{unit:"{log_record}",description:"The number of logs submitted to enabled SDK Loggers."})}emitLog(){this.createdLogs.add(1)}};var Kc="0.219.0";var z_={disabled:!1,minimumSeverity:Lt.UNSPECIFIED,traceBased:!1},bs=()=>({...z_}),yo=class{loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];resource;forceFlushTimeoutMillis;logRecordLimits;processors;loggerMetrics;_loggerConfigurator;_loggerConfigs=new Map;constructor(t,r,n,o,i,s){this.resource=t,this.forceFlushTimeoutMillis=r,this.logRecordLimits=n,this.processors=o,o.length>0?(this.registeredLogRecordProcessors=o,this.activeProcessor=new bo(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new Lo,this._loggerConfigurator=i??bs;let a=s?s.getMeter("@opentelemetry/sdk-logs",Kc):St();this.loggerMetrics=new No(a)}getLoggerConfig(t){let r=wo(t),n=this._loggerConfigs.get(r);return n||(n=this._loggerConfigurator(t),this._loggerConfigs.set(r,n),n)}};var $_="unknown",yr=class{_shutdownOnce;_sharedState;constructor(t={}){let r={resource:t.resource??qt(),forceFlushTimeoutMillis:t.forceFlushTimeoutMillis??3e4,logRecordLimits:{attributeCountLimit:t.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:t.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:t.loggerConfigurator??bs,processors:t.processors??[],meterProvider:t.meterProvider};this._sharedState=new yo(r.resource,r.forceFlushTimeoutMillis,r.logRecordLimits,r.processors,r.loggerConfigurator,r.meterProvider),this._shutdownOnce=new wt(this._shutdown,this)}getLogger(t,r,n){if(this._shutdownOnce.isCalled)return l.warn("A shutdown LoggerProvider cannot provide a Logger"),Bi();t||l.warn("Logger requested without instrumentation scope name.");let i={name:t||$_,version:r,schemaUrl:n?.schemaUrl,...Wc(this._sharedState.logRecordLimits,n?.attributes)},s=wo(i);return this._sharedState.loggers.has(s)||this._sharedState.loggers.set(s,new Oo(i,this._sharedState)),this._sharedState.loggers.get(s)}forceFlush(){return this._shutdownOnce.isCalled?(l.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(l.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}};async function W_(e){let t=[];for(let r=0,n=e.length;r<n;r++){let o=e[r];o.resource.asyncAttributesPending&&o.resource.waitForAsyncAttributes&&t.push(o.resource.waitForAsyncAttributes())}t!=null&&t.length>0&&await Promise.all(t)}var Co=class{_exportCompleted;_exportScheduledPromise;_exportScheduledResolve;constructor(t,r,n){this._exportScheduledPromise=new Promise(o=>{this._exportScheduledResolve=o}),this._exportCompleted=this._executeExport(t,r,n)}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}async _executeExport(t,r,n){try{await W_(r),await E.with(jt(E.active()),async()=>this._exportWithTimeout(t,r,n))}catch(o){P(o),this._exportScheduledResolve()}}async _exportWithTimeout(t,r,n){return new Promise((o,i)=>{let s=setTimeout(()=>{i(new Error("Timeout"))},n);t.export(r,a=>{clearTimeout(s),a.code===U.SUCCESS?o():i(a.error??new Error("BatchLogRecordProcessor: log record export failed"))}),this._exportScheduledResolve()})}},Po=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_currentExport=null;_finishedLogRecords=[];_timer;_shutdownOnce;_flushing=!1;constructor(t,r){this._exporter=t,this._maxExportBatchSize=r?.maxExportBatchSize??512,this._maxQueueSize=r?.maxQueueSize??2048,this._scheduledDelayMillis=r?.scheduledDelayMillis??5e3,this._exportTimeoutMillis=r?.exportTimeoutMillis??3e4,this._shutdownOnce=new wt(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(l.warn("BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}onEmit(t){this._shutdownOnce.isCalled||this._addToBuffer(t)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}_addToBuffer(t){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(t),this._maybeStartTimer())}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}async _flushAll(){if(this._flushing)return;this._flushing=!0;let t=this._finishedLogRecords;this._finishedLogRecords=[],this._clearTimer();let r=this._currentExport;for(r!==null&&(await this._exporter.forceFlush(),await r.exportCompleted,this._currentExport=null);t.length>0;){let n;t.length<=this._maxExportBatchSize?(n=t,t=[]):n=t.splice(0,this._maxExportBatchSize);let o=new Co(this._exporter,n,this._exportTimeoutMillis);this._currentExport=o;try{await o.exportScheduled,await this._exporter.forceFlush(),await o.exportCompleted}catch(i){P(i)}finally{this._currentExport=null}}this._flushing=!1,this._maybeStartTimer()}_extractBatch(){if(this._finishedLogRecords.length===0)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){let t=this._finishedLogRecords;return this._finishedLogRecords=[],t}else return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();let t=this._extractBatch();if(t===null)return;let r=new Co(this._exporter,t,this._exportTimeoutMillis);this._currentExport=r,r.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(n=>{this._currentExport=null,P(n),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)}};var ye=class extends Po{_visibilityChangeListener;_pageHideListener;constructor(t,r){super(t,r),this._onInit(r)}onShutdown(){typeof document>"u"||(this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener("pagehide",this._pageHideListener))}_onInit(t){t?.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))}};var Xc="exception";var Ce=Symbol.for("nodejs.util.inspect.custom");function Pe(e){let t={};for(let[r,n]of e.getRawAttributes())typeof n?.then!="function"&&n!=null&&(t[r]??=n);return t}function Ie(e,t,r,n,o){if(typeof r=="number"&&r<0){let s=`[${e}]`;return n?.stylize?n.stylize(s,"special"):s}if(typeof o!="function"||!n)return t;let i={...n,depth:n.depth==null?n.depth:n.depth-1};return`${e} ${o(t,i)}`}var Io=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:Y.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(t){let r=Date.now();if(this._spanContext=t.spanContext,this._performanceStartTime=N.now(),this._performanceOffset=r-(this._performanceStartTime+N.timeOrigin),this._startTimeProvided=t.startTime!=null,this._spanLimits=t.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=t.spanProcessor,this.name=t.name,this.parentSpanContext=t.parentSpanContext,this.kind=t.kind,t.links)for(let n of t.links)this.addLink(n);this.startTime=this._getTime(t.startTime??r),this.resource=t.resource,this.instrumentationScope=t.scope,this._recordEndMetrics=t.recordEndMetrics,t.attributes!=null&&this.setAttributes(t.attributes),this._spanProcessor.onStart(this,t.context)}spanContext(){return this._spanContext}setAttribute(t,r){if(r==null||this._isSpanEnded())return this;if(t.length===0)return l.warn(`Invalid attribute key: ${t}`),this;if(!On(r))return l.warn(`Invalid attribute value set for key: ${t}`),this;let{attributeCountLimit:n}=this._spanLimits,o=!Object.prototype.hasOwnProperty.call(this.attributes,t);return n!==void 0&&this._attributesCount>=n&&o?(this._droppedAttributesCount++,this):(this.attributes[t]=this._truncateToSize(r),o&&this._attributesCount++,this)}setAttributes(t){for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&this.setAttribute(r,t[r]);return this}addEvent(t,r,n){if(this._isSpanEnded())return this;let{eventCountLimit:o}=this._spanLimits;if(o===0)return l.warn("No events allowed."),this._droppedEventsCount++,this;o!==void 0&&this.events.length>=o&&(this._droppedEventsCount===0&&l.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),Cn(r)&&(Cn(n)||(n=r),r=void 0);let i=Ut(r),{attributePerEventCountLimit:s}=this._spanLimits,a={},c=0,u=0;for(let p in i){if(!Object.prototype.hasOwnProperty.call(i,p))continue;let m=i[p];if(s!==void 0&&u>=s){c++;continue}a[p]=this._truncateToSize(m),u++}return this.events.push({name:t,attributes:a,time:this._getTime(n),droppedAttributesCount:c}),this}addLink(t){if(this._isSpanEnded())return this;let{linkCountLimit:r}=this._spanLimits;if(r===0)return this._droppedLinksCount++,this;r!==void 0&&this.links.length>=r&&(this._droppedLinksCount===0&&l.debug("Dropping extra links."),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,o=Ut(t.attributes),i={},s=0,a=0;for(let u in o){if(!Object.prototype.hasOwnProperty.call(o,u))continue;let p=o[u];if(n!==void 0&&a>=n){s++;continue}i[u]=this._truncateToSize(p),a++}let c={context:t.context};return a>0&&(c.attributes=i),s>0&&(c.droppedAttributesCount=s),this.links.push(c),this}addLinks(t){for(let r of t)this.addLink(r);return this}setStatus(t){if(this._isSpanEnded())return this;if(t.code===Y.UNSET)return this;if(this.status.code===Y.OK)return this;let r={code:t.code};return t.code===Y.ERROR&&(typeof t.message=="string"?r.message=t.message:t.message!=null&&l.warn(`Dropping invalid status.message of type '${typeof t.message}', expected 'string'`)),this.status=r,this}updateName(t){return this._isSpanEnded()?this:(this.name=t,this)}end(t){if(this._isSpanEnded()){l.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(t),this._duration=ar(this.startTime,this.endTime),this._duration[0]<0&&(l.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&&l.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&l.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(t){if(typeof t=="number"&&t<=N.now())return b(t+this._performanceOffset);if(typeof t=="number")return I(t);if(t instanceof Date)return I(t.getTime());if(cr(t))return t;if(this._startTimeProvided)return I(Date.now());let r=N.now()-this._performanceStartTime;return Pn(this.startTime,I(r))}isRecording(){return this._ended===!1}recordException(t,r){let n={};typeof t=="string"?n[J]=t:t&&(t.code?n[nt]=t.code.toString():t.name&&(n[nt]=t.name),t.message&&(n[J]=t.message),t.stack&&(n[Xt]=t.stack)),n[nt]||n[J]?this.addEvent(Xc,n,r):l.warn(`Failed to record an exception ${t}`)}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 t=new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);l.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,t)}return this._ended}_truncateToLimitUtil(t,r){return t.length<=r?t:t.substring(0,r)}_truncateToSize(t){let r=this._attributeValueLengthLimit;return r<=0?(l.warn(`Attribute value limit must be positive, got ${r}`),t):typeof t=="string"?this._truncateToLimitUtil(t,r):Array.isArray(t)?t.map(n=>typeof n=="string"?this._truncateToLimitUtil(n,r):n):t}[Ce](t,r,n){let o={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:Pe(this.resource)}};return Ie("SpanImpl",o,t,r,n)}};var W;(function(e){e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(W||(W={}));var kt=class{shouldSample(){return{decision:W.NOT_RECORD}}toString(){return"AlwaysOffSampler"}};var mt=class{shouldSample(){return{decision:W.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}};var Jt=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(t){this._root=t.root,this._root||(P(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new mt),this._remoteParentSampled=t.remoteParentSampled??new mt,this._remoteParentNotSampled=t.remoteParentNotSampled??new kt,this._localParentSampled=t.localParentSampled??new mt,this._localParentNotSampled=t.localParentNotSampled??new kt}shouldSample(t,r,n,o,i,s){let a=S.getSpanContext(t);return!a||!X(a)?this._root.shouldSample(t,r,n,o,i,s):a.isRemote?a.traceFlags&C.SAMPLED?this._remoteParentSampled.shouldSample(t,r,n,o,i,s):this._remoteParentNotSampled.shouldSample(t,r,n,o,i,s):a.traceFlags&C.SAMPLED?this._localParentSampled.shouldSample(t,r,n,o,i,s):this._localParentNotSampled.shouldSample(t,r,n,o,i,s)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}};var Ft=class{_ratio;_upperBound;constructor(t=0){this._ratio=this._normalize(t),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(t,r){return{decision:mn(r)&&this._accumulate(r)<this._upperBound?W.RECORD_AND_SAMPLED:W.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(t){return typeof t!="number"||isNaN(t)?0:t>=1?1:t<=0?0:t}_accumulate(t){let r=0;for(let n=0;n<32;n+=8){let o=0;for(let i=0;i<8;i++){let s=t.charCodeAt(n+i),a=s<58?s-48:s<71?s-55:s-87;o=o<<4|a}r=(r^o)>>>0}return r}};var dt;(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"})(dt||(dt={}));var Mo=1;function vo(){return{sampler:ws(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:void 0??1/0,attributeCountLimit:void 0??128},spanLimits:{attributeValueLengthLimit:void 0??1/0,attributeCountLimit:void 0??128,linkCountLimit:void 0??128,eventCountLimit:void 0??128,attributePerEventCountLimit:void 0??128,attributePerLinkCountLimit:void 0??128}}}function ws(){let e=void 0??dt.ParentBasedAlwaysOn;switch(e){case dt.AlwaysOn:return new mt;case dt.AlwaysOff:return new kt;case dt.ParentBasedAlwaysOn:return new Jt({root:new mt});case dt.ParentBasedAlwaysOff:return new Jt({root:new kt});case dt.TraceIdRatio:return new Ft(Yc());case dt.ParentBasedTraceIdRatio:return new Jt({root:new Ft(Yc())});default:return l.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${dt.ParentBasedAlwaysOn}".`),new Jt({root:new mt})}}function Yc(){let e=void 0;return e==null?(l.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${Mo}.`),Mo):e<0||e>1?(l.error(`OTEL_TRACES_SAMPLER_ARG=${e} was given, but it is out of range ([0..1]), defaulting to ${Mo}.`),Mo):e}var j_=128,K_=1/0;function qc(e){let t={sampler:ws()},r=vo(),n=Object.assign({},r,t,e);return n.generalLimits=Object.assign({},r.generalLimits,e.generalLimits||{}),n.spanLimits=Object.assign({},r.spanLimits,e.spanLimits||{}),n}function Qc(e){let t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??void 0??void 0??j_,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??void 0??void 0??K_,Object.assign({},e,{spanLimits:t})}var Do=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(t,r){this._exporter=t,this._maxExportBatchSize=typeof r?.maxExportBatchSize=="number"?r.maxExportBatchSize:void 0??512,this._maxQueueSize=typeof r?.maxQueueSize=="number"?r.maxQueueSize:void 0??2048,this._scheduledDelayMillis=typeof r?.scheduledDelayMillis=="number"?r.scheduledDelayMillis:void 0??5e3,this._exportTimeoutMillis=typeof r?.exportTimeoutMillis=="number"?r.exportTimeoutMillis:void 0??3e4,this._shutdownOnce=new wt(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(l.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(t,r){}onEnd(t){this._shutdownOnce.isCalled||(t.spanContext().traceFlags&C.SAMPLED)!==0&&this._addToBuffer(t)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(t){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&l.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(l.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(t),this._maybeStartTimer()}_flushAll(){return new Promise((t,r)=>{let n=[],o=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let i=0,s=o;i<s;i++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{t()}).catch(r)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((t,r)=>{let n=setTimeout(()=>{r(new Error("Timeout"))},this._exportTimeoutMillis);E.with(jt(E.active()),()=>{let o;this._finishedSpans.length<=this._maxExportBatchSize?(o=this._finishedSpans,this._finishedSpans=[]):o=this._finishedSpans.splice(0,this._maxExportBatchSize);let i=()=>this._exporter.export(o,a=>{clearTimeout(n),a.code===U.SUCCESS?t():r(a.error??new Error("BatchSpanProcessor: span export failed"))}),s=null;for(let a=0,c=o.length;a<c;a++){let u=o[a];u.resource.asyncAttributesPending&&u.resource.waitForAsyncAttributes&&(s??=[],s.push(u.resource.waitForAsyncAttributes()))}s===null?i():Promise.all(s).then(i,a=>{P(a),r(a)})})})}_maybeStartTimer(){if(this._isExporting)return;let t=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(r=>{this._isExporting=!1,P(r)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return t();this._timer===void 0&&(this._timer=setTimeout(()=>t(),this._scheduledDelayMillis),typeof this._timer!="number"&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}};var Me=class extends Do{_visibilityChangeListener;_pageHideListener;constructor(t,r){super(t,r),this.onInit(r)}onInit(t){t?.disableAutoFlushOnDocumentHide!==!0&&typeof document<"u"&&(this._visibilityChangeListener=()=>{document.visibilityState==="hidden"&&this.forceFlush().catch(r=>{P(r)})},this._pageHideListener=()=>{this.forceFlush().catch(r=>{P(r)})},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))}};var Jc=new Uint8Array(16),Zc=new Uint8Array(8),X_=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function tu(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 eu(e){let t="";for(let r=0;r<e.length;r++)t+=X_[e[r]];return t}var ve=class{generateTraceId(){return tu(Jc),eu(Jc)}generateSpanId(){return tu(Zc),eu(Zc)}};var ru="otel.span.parent.origin",Ns="otel.span.sampling_result",nu="otel.sdk.span.live",ou="otel.sdk.span.started";var Uo=class{startedSpans;liveSpans;constructor(t){this.startedSpans=t.createCounter(ou,{unit:"{span}",description:"The number of created spans."}),this.liveSpans=t.createUpDownCounter(nu,{unit:"{span}",description:"The number of currently live spans."})}startSpan(t,r){let n=q_(r);if(this.startedSpans.add(1,{[ru]:Y_(t),[Ns]:n}),r===W.NOT_RECORD)return()=>{};let o={[Ns]:n};return this.liveSpans.add(1,o),()=>{this.liveSpans.add(-1,o)}}};function Y_(e){return e?e.isRemote?"remote":"local":"none"}function q_(e){switch(e){case W.RECORD_AND_SAMPLED:return"RECORD_AND_SAMPLE";case W.RECORD:return"RECORD_ONLY";case W.NOT_RECORD:return"DROP"}}var iu="2.8.0";var Bo=class{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(t,r,n,o){let i=qc(r);this._sampler=i.sampler,this._generalLimits=i.generalLimits,this._spanLimits=i.spanLimits,this._idGenerator=r.idGenerator||new ve,this._resource=n,this._spanProcessor=o,this.instrumentationScope=t;let s=i.meterProvider?i.meterProvider.getMeter("@opentelemetry/sdk-trace",iu):St();this._tracerMetrics=new Uo(s)}startSpan(t,r={},n=E.active()){r.root&&(n=S.deleteSpan(n));let o=S.getSpan(n);if(Kt(n))return l.debug("Instrumentation suppressed, returning Noop Span"),S.wrapSpanContext(Xe);let i=o?.spanContext(),s=this._idGenerator.generateSpanId(),a,c,u;!i||!S.isSpanContextValid(i)?c=this._idGenerator.generateTraceId():(c=i.traceId,u=i.traceState,a=i);let p=r.kind??Rt.INTERNAL,m=(r.links??[]).map(V=>({context:V.context,attributes:Ut(V.attributes)})),f=Ut(r.attributes),_=this._sampler.shouldSample(n,c,t,p,f,m),d=this._tracerMetrics.startSpan(i,_.decision);u=_.traceState??u;let h=_.decision===se.RECORD_AND_SAMPLED?C.SAMPLED:C.NONE,g={traceId:c,spanId:s,traceFlags:h,traceState:u};if(_.decision===se.NOT_RECORD)return l.debug("Recording is off, propagating context in a non-recording span"),S.wrapSpanContext(g);let L=Ut(Object.assign(f,_.attributes));return new Io({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:g,name:t,kind:p,links:m,parentSpanContext:a,attributes:L,startTime:r.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:d})}startActiveSpan(t,r,n,o){let i,s,a;if(arguments.length<2)return;arguments.length===2?a=r:arguments.length===3?(i=r,a=n):(i=r,s=n,a=o);let c=s??E.active(),u=this.startSpan(t,i,c),p=S.setSpan(c,u);return E.with(p,a,void 0,u)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}[Ce](t,r,n){let o={instrumentationScope:this.instrumentationScope,resource:{attributes:Pe(this._resource)},spanLimits:this._spanLimits,generalLimits:this._generalLimits};return Ie("Tracer",o,t,r,n)}};var Go=class{_spanProcessors;constructor(t){this._spanProcessors=t}forceFlush(){let t=[];for(let r of this._spanProcessors)t.push(r.forceFlush());return new Promise(r=>{Promise.all(t).then(()=>{r()}).catch(n=>{P(n||new Error("MultiSpanProcessor: forceFlush failed")),r()})})}onStart(t,r){for(let n of this._spanProcessors)n.onStart(t,r)}onEnding(t){for(let r of this._spanProcessors)r.onEnding&&r.onEnding(t)}onEnd(t){for(let r of this._spanProcessors)r.onEnd(t)}shutdown(){let t=[];for(let r of this._spanProcessors)t.push(r.shutdown());return new Promise((r,n)=>{Promise.all(t).then(()=>{r()},n)})}};var Zt;(function(e){e[e.resolved=0]="resolved",e[e.timeout=1]="timeout",e[e.error=2]="error",e[e.unresolved=3]="unresolved"})(Zt||(Zt={}));var Cr=class{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(t={}){let r=Xi({},vo(),Qc(t));this._resource=r.resource??qt(),this._config=Object.assign({},r,{resource:this._resource});let n=[];t.spanProcessors?.length&&n.push(...t.spanProcessors),this._activeSpanProcessor=new Go(n)}getTracer(t,r,n){let o=`${t}@${r||""}:${n?.schemaUrl||""}`;return this._tracers.has(o)||this._tracers.set(o,new Bo({name:t,version:r,schemaUrl:n?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(o)}forceFlush(){let t=this._config.forceFlushTimeoutMillis,r=this._activeSpanProcessor._spanProcessors.map(n=>new Promise(o=>{let i,s=setTimeout(()=>{o(new Error(`Span processor did not completed within timeout period of ${t} ms`)),i=Zt.timeout},t);n.forceFlush().then(()=>{clearTimeout(s),i!==Zt.timeout&&(i=Zt.resolved,o(i))}).catch(a=>{clearTimeout(s),i=Zt.error,o(a)})}));return new Promise((n,o)=>{Promise.all(r).then(i=>{let s=i.filter(a=>a!==Zt.resolved);s.length>0?o(s):n()}).catch(i=>o([i]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[Ce](t,r,n){let o=this._activeSpanProcessor._spanProcessors,i={resource:{attributes:Pe(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:o.map(s=>s.constructor?.name??"SpanProcessor")};return Ie("BasicTracerProvider",i,t,r,n)}};var Ho=class{_enabled=!1;_currentContext=B;_bindFunction(t=B,r){let n=this,o=function(...i){return n.with(t,()=>r.apply(this,i))};return Object.defineProperty(o,"length",{enumerable:!1,configurable:!0,writable:!1,value:r.length}),o}active(){return this._currentContext}bind(t,r){return t===void 0&&(t=this.active()),typeof r=="function"?this._bindFunction(t,r):r}disable(){return this._currentContext=B,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=B,this)}with(t,r,n,...o){let i=this._currentContext;this._currentContext=t||B;try{return r.call(n,...o)}finally{this._currentContext=i}}};function Q_(e){if(e!==null){if(e===void 0){let t=new Ho;t.enable(),E.setGlobalContextManager(t);return}e.enable(),E.setGlobalContextManager(e)}}function J_(e){if(e!==null){if(e===void 0){D.setGlobalPropagator(new ur({propagators:[new lr,new er]}));return}D.setGlobalPropagator(e)}}var Pr=class extends Cr{constructor(t={}){super(t)}register(t={}){S.setGlobalTracerProvider(this),J_(t.propagator),Q_(t.contextManager)}};var A;(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"})(A||(A={}));var su="http.response_content_length",au="http.response_content_length_uncompressed";var ys;function Z_(){return ys||(ys=document.createElement("a")),ys}function Nt(e,t){return t in e}function w(e,t,r,n=!0){if(Nt(r,t)&&typeof r[t]=="number"&&!(n&&r[t]===0))return e.addEvent(t,r[t])}function ht(e,t,r=!1,n,o){if(n===void 0&&(n=t[A.START_TIME]!==0),r||(w(e,A.FETCH_START,t,n),w(e,A.DOMAIN_LOOKUP_START,t,n),w(e,A.DOMAIN_LOOKUP_END,t,n),w(e,A.CONNECT_START,t,n),w(e,A.SECURE_CONNECTION_START,t,n),w(e,A.CONNECT_END,t,n),w(e,A.REQUEST_START,t,n),w(e,A.RESPONSE_START,t,n),w(e,A.RESPONSE_END,t,n)),!o){let i=t[A.ENCODED_BODY_SIZE];i!==void 0&&e.setAttribute(su,i);let s=t[A.DECODED_BODY_SIZE];s!==void 0&&i!==s&&e.setAttribute(au,s)}}function cu(e){return e.slice().sort((t,r)=>{let n=t[A.FETCH_START],o=r[A.FETCH_START];return n>o?1:n<o?-1:0})}function uu(){return typeof location<"u"?location.origin:void 0}function Ir(e,t,r,n,o=new WeakSet,i){let s=rt(e);e=s.toString();let a=em(e,t,r,n,o,i);if(a.length===0)return{mainRequest:void 0};if(a.length===1)return{mainRequest:a[0]};let c=cu(a);if(s.origin!==uu()&&c.length>1){let u=c[0],p=tm(c,u[A.RESPONSE_END],r),m=u[A.RESPONSE_END];return p[A.FETCH_START]<m&&(p=u,u=void 0),{corsPreFlightRequest:u,mainRequest:p}}else return{mainRequest:a[0]}}function tm(e,t,r){let n=Z(r),o=Z(lt(t)),i=e[1],s,a=e.length;for(let c=1;c<a;c++){let u=e[c],p=Z(lt(u[A.FETCH_START])),m=Z(lt(u[A.RESPONSE_END])),f=n-m;p>=o&&(!s||f<s)&&(s=f,i=u)}return i}function em(e,t,r,n,o,i){let s=Z(t),a=Z(r),c=n.filter(u=>{let p=Z(lt(u[A.FETCH_START])),m=Z(lt(u[A.RESPONSE_END]));return u.initiatorType.toLowerCase()===(i||"xmlhttprequest")&&u.name===e&&p>=s&&m<=a});return c.length>0&&(c=c.filter(u=>!o.has(u))),c}function rt(e){if(typeof URL=="function")return new URL(e,typeof document<"u"?document.baseURI:typeof location<"u"?location.href:void 0);let t=Z_();return t.href=e,t}function Vo(e,t){if(e.nodeType===Node.DOCUMENT_NODE)return"/";let r=nm(e,t);if(t&&r.indexOf("@id")>0)return r;let n="";return e.parentNode&&(n+=Vo(e.parentNode,t)),n+=r,n}function rm(e){if(!e.parentNode)return 0;let t=[e.nodeType];e.nodeType===Node.CDATA_SECTION_NODE&&t.push(Node.TEXT_NODE);let r=Array.from(e.parentNode.childNodes);return r=r.filter(n=>{let o=n.localName;return t.indexOf(n.nodeType)>=0&&o===e.localName}),r.length>=1?r.indexOf(e)+1:0}function nm(e,t){let r=e.nodeType,n=rm(e),o;if(r===Node.ELEMENT_NODE){let i=e.getAttribute("id");if(t&&i)return`//*[@id="${i}"]`;o=e.localName}else if(r===Node.TEXT_NODE||r===Node.CDATA_SECTION_NODE)o="text()";else if(r===Node.COMMENT_NODE)o="comment()";else return"";return o&&n>1?`/${o}[${n}]`:`/${o}`}function Mr(e,t){let r=t||[];return(typeof r=="string"||r instanceof RegExp)&&(r=[r]),rt(e).origin===uu()?!0:r.some(o=>Bn(e,o))}function lu(e,t,r,n){for(let o=0,i=e.length;o<i;o++){let s=e[o];t&&s.setTracerProvider(t),r&&s.setMeterProvider(r),n&&s.setLoggerProvider&&s.setLoggerProvider(n),s.getConfig().enabled||s.enable()}}function pu(e){e.forEach(t=>t.disable())}function Cs(e){let t=e.tracerProvider||S.getTracerProvider(),r=e.meterProvider||xt.getMeterProvider(),n=e.loggerProvider||Dt.getLoggerProvider(),o=e.instrumentations?.flat()??[];return lu(o,t,r,n),()=>{pu(o)}}var F=console.error.bind(console);function vr(e,t,r){let n=!!e[t]&&Object.prototype.propertyIsEnumerable.call(e,t);Object.defineProperty(e,t,{configurable:!0,enumerable:n,writable:!0,value:r})}var ko=(e,t,r)=>{if(!e||!e[t]){F("no original function "+String(t)+" to wrap");return}if(!r){F("no wrapper function"),F(new Error().stack);return}let n=e[t];if(typeof n!="function"||typeof r!="function"){F("original object and wrapper must be functions");return}let o=r(n,t);return vr(o,"__original",n),vr(o,"__unwrap",()=>{e[t]===o&&vr(e,t,n)}),vr(o,"__wrapped",!0),vr(e,t,o),o},Ps=(e,t,r)=>{if(e)Array.isArray(e)||(e=[e]);else{F("must provide one or more modules to patch"),F(new Error().stack);return}if(!(t&&Array.isArray(t))){F("must provide one or more functions to wrap on modules");return}e.forEach(n=>{t.forEach(o=>{ko(n,o,r)})})},Fo=(e,t)=>{if(!e||!e[t]){F("no function to unwrap."),F(new Error().stack);return}let r=e[t];if(!r.__unwrap)F("no original to unwrap to -- has "+String(t)+" already been unwrapped?");else{r.__unwrap();return}},Is=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{F("must provide one or more modules to patch"),F(new Error().stack);return}if(!(t&&Array.isArray(t))){F("must provide one or more functions to unwrap on modules");return}e.forEach(r=>{t.forEach(n=>{Fo(r,n)})})};function Dr(e){e&&e.logger&&(typeof e.logger!="function"?F("new logger isn't a function, not replacing"):F=e.logger)}Dr.wrap=ko;Dr.massWrap=Ps;Dr.unwrap=Fo;Dr.massUnwrap=Is;var zo=class{_config={};_tracer;_meter;_logger;_diag;instrumentationName;instrumentationVersion;constructor(t,r,n){this.instrumentationName=t,this.instrumentationVersion=r,this.setConfig(n),this._diag=l.createComponentLogger({namespace:t}),this._tracer=S.getTracer(t,r),this._meter=xt.getMeter(t,r),this._logger=Dt.getLogger(t,r),this._updateMetricInstruments()}_wrap=ko;_unwrap=Fo;_massWrap=Ps;_massUnwrap=Is;get meter(){return this._meter}setMeterProvider(t){this._meter=t.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(t){this._logger=t.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let t=this.init()??[];return Array.isArray(t)?t:[t]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(t){this._config={enabled:!0,...t}}setTracerProvider(t){this._tracer=t.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(t,r,n,o){if(t)try{t(n,o)}catch(i){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:r},i)}}};var M=class extends zo{constructor(t,r,n){super(t,r,n),this._config.enabled&&this.enable()}};function yt(e,t,r){let n,o;try{o=e()}catch(i){n=i}finally{if(t(n,o),n&&!r)throw n;return o}}var R;(function(e){e[e.STABLE=1]="STABLE",e[e.OLD=2]="OLD",e[e.DUPLICATE=3]="DUPLICATE"})(R||(R={}));function te(e,t){let r=R.OLD,n=t?.split(",").map(o=>o.trim()).filter(o=>o!=="");for(let o of n??[])if(o.toLowerCase()===e+"/dup"){r=R.DUPLICATE;break}else o.toLowerCase()===e&&(r=R.STABLE);return r}var _u="0.12.0",mu="@opentelemetry/instrumentation-browser-navigation";function Ms(e,t){try{let r=new URL(e,window.location.origin),n=new URL(t,window.location.origin),o=r.origin===n.origin&&r.pathname===n.pathname&&r.search===n.search,i=r.hash!=="",s=n.hash!=="",a=r.hash!==n.hash;return o&&a&&(i&&s||!i&&s)}catch{let r=e.split("#")[0],n=t.split("#")[0],o=e.split("#")[1]||"",i=t.split("#")[1]||"";return r===n&&o!==i&&i!==""}}var du="browser.navigation",hu="browser.navigation.same_document",fu="browser.navigation.hash_change",sm="browser.navigation.type",Ur=class extends M{applyCustomLogRecordData=void 0;_lastUrl=location.href;_hasProcessedInitialLoad=!1;constructor(t){super(mu,_u,t),this.applyCustomLogRecordData=t?.applyCustomLogRecordData,this.sanitizeUrl=t?.sanitizeUrl}init(){}_onHardNavigation(){let t={eventName:du,attributes:{[ot]:this.sanitizeUrl?this.sanitizeUrl(document.documentURI):document.documentURI,[hu]:!1,[fu]:!1}};this._applyCustomLogRecordData(t,this.applyCustomLogRecordData),this.logger.emit(t)}_onSoftNavigation(t,r){let n=this._lastUrl,o=t==="currententrychange"&&r?.target?.currentEntry?.url?r.target.currentEntry.url:location.href;if(n===o)return;let i=this._mapChangeStateToType(t,r),s=this._determineSameDocument(t,r,n,o),a=this._determineHashChange(t,r,n,o),c={eventName:du,attributes:{[ot]:this.sanitizeUrl?this.sanitizeUrl(o):o,[hu]:s,[fu]:a,...i?{[sm]:i}:{}}};this._applyCustomLogRecordData(c,this.applyCustomLogRecordData),this.logger.emit(c),this._lastUrl=o}_waitForPageLoad(){if(document.readyState==="complete"&&!this._hasProcessedInitialLoad){this._hasProcessedInitialLoad=!0,this._onHardNavigation();return}this._onLoadHandler&&document.removeEventListener("DOMContentLoaded",this._onLoadHandler),this._onLoadHandler=()=>{this._hasProcessedInitialLoad||(this._hasProcessedInitialLoad=!0,this._onHardNavigation())},document.addEventListener("DOMContentLoaded",this._onLoadHandler)}enable(){if(this._isEnabled)return;this._isEnabled=!0;let n=!!this.getConfig().useNavigationApiIfAvailable&&window.navigation;!n&&!this._isHistoryPatched&&(this._patchHistoryApi(),this._isHistoryPatched=!0),this._waitForPageLoad(),n?(this._onNavigateHandler&&(n.removeEventListener("currententrychange",this._onNavigateHandler),this._onNavigateHandler=void 0),this._onNavigateHandler=o=>{this._onSoftNavigation("currententrychange",o)},n.addEventListener("currententrychange",this._onNavigateHandler)):(this._onPopStateHandler&&(window.removeEventListener("popstate",this._onPopStateHandler),this._onPopStateHandler=void 0),this._onPopStateHandler=()=>{this._onSoftNavigation("popstate")},window.addEventListener("popstate",this._onPopStateHandler))}disable(){if(this._isEnabled){if(this._isEnabled=!1,this._onLoadHandler&&(document.removeEventListener("DOMContentLoaded",this._onLoadHandler),this._onLoadHandler=void 0),this._onPopStateHandler&&(window.removeEventListener("popstate",this._onPopStateHandler),this._onPopStateHandler=void 0),this._onNavigateHandler){try{window.navigation?.removeEventListener?.("currententrychange",this._onNavigateHandler)}catch{}this._onNavigateHandler=void 0}this._hasProcessedInitialLoad=!1}}_patchHistoryMethod(t){let r=this;return n=>function(...i){if(!r._isEnabled)return n.apply(this,i);let s=n.apply(this,i);return location.href!==r._lastUrl&&r._onSoftNavigation(t),s}}_patchHistoryApi(){this._wrap(history,"replaceState",this._patchHistoryMethod("replaceState")),this._wrap(history,"pushState",this._patchHistoryMethod("pushState"))}_applyCustomLogRecordData(t,r){r&&r(t)}_determineSameDocument(t,r,n,o){if(t==="currententrychange"){if(n&&o)try{let i=new URL(n),s=new URL(o);return i.origin===s.origin}catch{return!0}return!0}if(n&&o)try{let i=new URL(n),s=new URL(o);return i.origin===s.origin}catch{return!0}return!0}_determineHashChange(t,r,n,o){return t==="currententrychange"?n&&o?Ms(n,o):!1:n&&o?Ms(n,o):!1}_mapChangeStateToType(t,r){if(t==="currententrychange"){if(r?.navigationType)switch(r.navigationType){case"traverse":return"traverse";case"replace":return"replace";case"reload":return"reload";case"push":default:return"push"}return"push"}switch(t){case"pushState":return"push";case"replaceState":return"replace";case"popstate":return"traverse";case"hashchange":return"push";case"navigate":return"push";default:return}}};var ee;(function(e){e.DOCUMENT_LOAD="documentLoad",e.DOCUMENT_FETCH="documentFetch",e.RESOURCE_FETCH="resourceFetch"})(ee||(ee={}));var Tu="0.64.0",gu="@opentelemetry/instrumentation-document-load";var $o="http.url",Eu="http.user_agent";var Br;(function(e){e.FIRST_PAINT="firstPaint",e.FIRST_CONTENTFUL_PAINT="firstContentfulPaint"})(Br||(Br={}));var Su=()=>{let e={},t=N.getEntriesByType?.("navigation")[0];if(t)Object.values(A).forEach(n=>{if(Nt(t,n)){let o=t[n];typeof o=="number"&&(e[n]=o)}});else{let n=N.timing;n&&Object.values(A).forEach(i=>{if(Nt(n,i)){let s=n[i];typeof s=="number"&&(e[i]=s)}})}return e},Au={"first-paint":Br.FIRST_PAINT,"first-contentful-paint":Br.FIRST_CONTENTFUL_PAINT},Ru=e=>{let t=N.getEntriesByType?.("paint");t&&t.forEach(({name:r,startTime:n})=>{Nt(Au,r)&&e.addEvent(Au[r],n)})};var Gr=class extends M{component="document-load";version="1";moduleName=this.component;_semconvStability;constructor(t={}){super(gu,Tu,t),this._semconvStability=te("http",t?.semconvStabilityOptIn)}init(){}_onDocumentLoaded(){window.setTimeout(()=>{this._collectPerformance()})}_addResourcesSpans(t){let r=N.getEntriesByType?.("resource");r&&r.forEach(n=>{this._initResourceSpan(n,t)})}_collectPerformance(){let t=Array.from(document.getElementsByTagName("meta")).find(o=>o.getAttribute("name")===ue),r=Su(),n=t&&t.content||"";E.with(D.extract(B,{traceparent:n}),()=>{let o=this._startSpan(ee.DOCUMENT_LOAD,A.FETCH_START,r);o&&(E.with(S.setSpan(E.active(),o),()=>{let i=this._startSpan(ee.DOCUMENT_FETCH,A.FETCH_START,r);i&&(this._semconvStability&R.OLD&&i.setAttribute($o,location.href),this._semconvStability&R.STABLE&&i.setAttribute(ot,location.href),E.with(S.setSpan(E.active(),i),()=>{let s=!(this._semconvStability&R.OLD);ht(i,r,this.getConfig().ignoreNetworkEvents,void 0,s),this._addCustomAttributesOnSpan(i,this.getConfig().applyCustomAttributesOnSpan?.documentFetch),this._endSpan(i,A.RESPONSE_END,r)}))}),this._semconvStability&R.OLD&&(o.setAttribute($o,location.href),o.setAttribute(Eu,navigator.userAgent)),this._semconvStability&R.STABLE&&(o.setAttribute(ot,location.href),o.setAttribute(Ga,navigator.userAgent)),this._addResourcesSpans(o),this.getConfig().ignoreNetworkEvents||(w(o,A.FETCH_START,r),w(o,A.UNLOAD_EVENT_START,r),w(o,A.UNLOAD_EVENT_END,r),w(o,A.DOM_INTERACTIVE,r),w(o,A.DOM_CONTENT_LOADED_EVENT_START,r),w(o,A.DOM_CONTENT_LOADED_EVENT_END,r),w(o,A.DOM_COMPLETE,r),w(o,A.LOAD_EVENT_START,r),w(o,A.LOAD_EVENT_END,r)),this.getConfig().ignorePerformancePaintEvents||Ru(o),this._addCustomAttributesOnSpan(o,this.getConfig().applyCustomAttributesOnSpan?.documentLoad),this._endSpan(o,A.LOAD_EVENT_END,r))})}_endSpan(t,r,n){t&&(Nt(n,r)?t.end(n[r]):t.end())}_initResourceSpan(t,r){let n=this._startSpan(ee.RESOURCE_FETCH,A.FETCH_START,t,r);if(n){this._semconvStability&R.OLD&&n.setAttribute($o,t.name),this._semconvStability&R.STABLE&&n.setAttribute(ot,t.name);let o=!(this._semconvStability&R.OLD);ht(n,t,this.getConfig().ignoreNetworkEvents,void 0,o),this._addCustomAttributesOnResourceSpan(n,t,this.getConfig().applyCustomAttributesOnSpan?.resourceFetch),this._endSpan(n,A.RESPONSE_END,t)}}_startSpan(t,r,n,o){if(Nt(n,r)&&typeof n[r]=="number")return this.tracer.startSpan(t,{startTime:n[r]},o?S.setSpan(E.active(),o):void 0)}_waitForPageLoad(){window.document.readyState==="complete"?this._onDocumentLoaded():(this._onDocumentLoaded=this._onDocumentLoaded.bind(this),window.addEventListener("load",this._onDocumentLoaded))}_addCustomAttributesOnSpan(t,r){r&&yt(()=>r(t),n=>{n&&this._diag.error("addCustomAttributesOnSpan",n)},!0)}_addCustomAttributesOnResourceSpan(t,r,n){n&&yt(()=>n(t,r),o=>{o&&this._diag.error("addCustomAttributesOnResourceSpan",o)},!0)}enable(){window.removeEventListener("load",this._onDocumentLoaded),this._waitForPageLoad()}disable(){window.removeEventListener("load",this._onDocumentLoaded)}};var Hr;(function(e){e.COMPONENT="component",e.HTTP_STATUS_TEXT="http.status_text"})(Hr||(Hr={}));var xu="http.host",Ou="http.method",Lu="http.request.body.size",bu="http.request_content_length_uncompressed";var wu="http.scheme",Nu="http.status_code",yu="http.url",Cu="http.user_agent";var Pu=l.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-fetch/utils"});function Iu(...e){if(e[0]instanceof URL||typeof e[0]=="string"){let t=e[1];if(!t?.body)return Promise.resolve();if(t.body instanceof ReadableStream){let{body:r,length:n}=am(t.body);return t.body=r,n}else return Promise.resolve(um(t.body))}else{let t=e[0];return t?.body?t.clone().text().then(r=>vs(r)):Promise.resolve()}}function am(e){if(!e.pipeThrough)return Pu.warn("Platform has ReadableStream but not pipeThrough!"),{body:e,length:Promise.resolve(void 0)};let t=0,r,n=new Promise(i=>{r=i}),o=new TransformStream({start(){},async transform(i,s){let a=await i;t+=a.byteLength,s.enqueue(i)},flush(){r(t)}});return{body:e.pipeThrough(o),length:n}}function cm(e){return typeof Document<"u"&&e instanceof Document}function um(e){if(cm(e))return new XMLSerializer().serializeToString(document).length;if(typeof e=="string")return vs(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return pm(e);if(e instanceof URLSearchParams)return vs(e.toString());if(e.byteLength!==void 0)return e.byteLength;Pu.warn("unknown body type")}var lm=new TextEncoder;function vs(e){return lm.encode(e).byteLength}function pm(e){let t=0;for(let[r,n]of e.entries())t+=r.length,n instanceof Blob?t+=n.size:t+=n.length;return t}function Mu(e){let t=mm(),r=e.toUpperCase();return r in t?r:"_OTHER"}var _m={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},Vr;function mm(){if(Vr===void 0){let e=void 0;e&&e.length>0?(Vr={},e.forEach(t=>{Vr[t]=!0})):Vr=_m}return Vr}var dm={"https:":"443","http:":"80"};function vu(e){let t=Number(e.port||dm[e.protocol]);if(t&&!isNaN(t))return t}var Ds="0.219.0";var hm=300,Du=typeof PerformanceObserver<"u",kr=class extends M{component="fetch";version=Ds;moduleName=this.component;_usedResources=new WeakSet;_tasksCount=0;_semconvStability;constructor(t={}){super("@opentelemetry/instrumentation-fetch",Ds,t),this._semconvStability=te("http",t?.semconvStabilityOptIn)}init(){}_addChildSpan(t,r){let n=this.tracer.startSpan("CORS Preflight",{startTime:r[A.FETCH_START]},S.setSpan(E.active(),t)),o=!(this._semconvStability&R.OLD);ht(n,r,this.getConfig().ignoreNetworkEvents,void 0,o),n.end(r[A.RESPONSE_END])}_addFinalSpanAttributes(t,r){let n=rt(r.url);if(this._semconvStability&R.OLD&&(t.setAttribute(Nu,r.status),r.statusText!=null&&t.setAttribute(Hr.HTTP_STATUS_TEXT,r.statusText),t.setAttribute(xu,n.host),t.setAttribute(wu,n.protocol.replace(":","")),typeof navigator<"u"&&t.setAttribute(Cu,navigator.userAgent)),this._semconvStability&R.STABLE){t.setAttribute(wn,r.status),t.setAttribute(Nn,n.hostname);let o=vu(n);o&&t.setAttribute(yn,o)}}_addHeaders(t,r){if(!Mr(r,this.getConfig().propagateTraceHeaderCorsUrls)){let n={};D.inject(E.active(),n),Object.keys(n).length>0&&this._diag.debug("headers inject skipped due to CORS policy");return}if(t instanceof Request)D.inject(E.active(),t.headers,{set:(n,o,i)=>n.set(o,typeof i=="string"?i:String(i))});else{let n=new Headers(t.headers);D.inject(E.active(),n,{set:(o,i,s)=>o.set(i,typeof s=="string"?s:String(s))}),t.headers=n}}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(performance.clearResourceTimings(),this._usedResources=new WeakSet)}_createSpan(t,r={}){if(_r(t,this.getConfig().ignoreUrls)){this._diag.debug("ignoring span as url matches ignored url");return}let n="",o={};if(this._semconvStability&R.OLD){let i=(r.method||"GET").toUpperCase();n=`HTTP ${i}`,o[Hr.COMPONENT]=this.moduleName,o[Ou]=i,o[yu]=t}if(this._semconvStability&R.STABLE){let i=r.method,s=Mu(r.method||"GET");n||(n=s),o[Ln]=s,s!==i&&(o[bn]=i),o[ot]=t}return this.tracer.startSpan(n,{kind:Rt.CLIENT,attributes:o})}_findResourceAndAddNetworkEvents(t,r,n){let o=r.entries;if(!o.length){if(!performance.getEntriesByType)return;o=performance.getEntriesByType("resource")}let i=Ir(r.spanUrl,r.startTime,n,o,this._usedResources,"fetch");if(i.mainRequest){let s=i.mainRequest;this._markResourceAsUsed(s);let a=i.corsPreFlightRequest;a&&(this._addChildSpan(t,a),this._markResourceAsUsed(a));let c=!(this._semconvStability&R.OLD);ht(t,s,this.getConfig().ignoreNetworkEvents,void 0,c)}}_markResourceAsUsed(t){this._usedResources.add(t)}_endSpan(t,r,n){let o=I(Date.now()),i=b();this._addFinalSpanAttributes(t,n),this._semconvStability&R.STABLE&&n.status>=400&&(t.setStatus({code:Y.ERROR}),t.setAttribute(rr,String(n.status))),setTimeout(()=>{r.observer?.disconnect(),this._findResourceAndAddNetworkEvents(t,r,i),this._tasksCount--,this._clearResources(),t.end(o)},hm)}_patchConstructor(){return t=>{let r=this;return function(...o){if(!r._isEnabled)return t.apply(this,o);let i=this,s=rt(o[0]instanceof Request?o[0].url:String(o[0])).href,a;o[0]instanceof Request?a=o[1]!=null?new Request(o[0],o[1]):o[0]:a=o[1]||{};let c=r._createSpan(s,a);if(!c)return t.apply(this,o);let u=r._prepareSpanData(s);r.getConfig().measureRequestSize&&Iu(...o).then(d=>{d&&(r._semconvStability&R.OLD&&c.setAttribute(bu,d),r._semconvStability&R.STABLE&&c.setAttribute(Lu,d))}).catch(d=>{r._diag.warn("getFetchBodyLength",d)});function p(d,h){r._applyAttributesAfterFetch(d,a,h),r._endSpan(d,u,{status:h.status||0,statusText:h.message,url:s})}function m(d,h){r._applyAttributesAfterFetch(d,a,h),h.status>=200&&h.status<400?r._endSpan(d,u,h):r._endSpan(d,u,{status:h.status,statusText:h.statusText,url:s})}function f(d,h){try{let L=h.clone().body;if(L){let $=L.getReader(),V=()=>{$.read().then(({done:x})=>{x?m(d,h):V()},x=>{p(d,x)})};V()}else m(d,h)}catch(g){r._diag.error("Failed to read fetch response body",g),r._endSpan(d,u,{status:0,url:s})}return h}function _(d,h){try{p(d,h)}catch(g){r._diag.error("Failed to end span on fetch error",g),r._endSpan(d,u,{status:h.status||0,url:s})}throw h}return E.with(S.setSpan(E.active(),c),()=>(r._callRequestHook(c,a),r._addHeaders(a,s),r._tasksCount++,t.apply(i,a instanceof Request?[a]:[s,a]).then(f.bind(i,c),_.bind(i,c))))}}}_applyAttributesAfterFetch(t,r,n){let o=this.getConfig().applyCustomAttributesOnSpan;o&&yt(()=>o(t,r,n),i=>{i&&this._diag.error("applyCustomAttributesOnSpan",i)},!0)}_callRequestHook(t,r){let n=this.getConfig().requestHook;n&&yt(()=>n(t,r),o=>{o&&this._diag.error("requestHook",o)},!0)}_prepareSpanData(t){let r=b(),n=[];if(typeof PerformanceObserver!="function")return{entries:n,startTime:r,spanUrl:t};let o=new PerformanceObserver(i=>{i.getEntries().forEach(a=>{a.initiatorType==="fetch"&&a.name===t&&n.push(a)})});return o.observe({entryTypes:["resource"]}),{entries:n,observer:o,startTime:r,spanUrl:t}}enable(){if(!Du){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(t){this._diag.warn("Failed to patch globalThis.fetch; instrumentation will not be enabled. Another script may have locked globalThis.fetch via Object.defineProperty.",t)}}}disable(){Du&&this._isEnabled&&(this._isEnabled=!1,this._usedResources=new WeakSet)}};var Us="0.63.0",Uu="@opentelemetry/instrumentation-long-task";var Bs="longtask",Fr=class extends M{version=Us;_observer;constructor(t={}){super(Uu,Us,t)}init(){}isSupported(){return typeof PerformanceObserver>"u"||!PerformanceObserver.supportedEntryTypes?!1:PerformanceObserver.supportedEntryTypes.includes(Bs)}_createSpanFromEntry(t){let r=this.tracer.startSpan(Bs,{startTime:b(t.startTime)}),{observerCallback:n}=this.getConfig();if(n)try{n(r,{longtaskEntry:t})}catch(o){l.error("longtask instrumentation: observer callback failed",o)}r.setAttribute("longtask.name",t.name),r.setAttribute("longtask.entry_type",t.entryType),r.setAttribute("longtask.duration",t.duration),Array.isArray(t.attribution)&&t.attribution.forEach((o,i)=>{let s=t.attribution.length>1?`longtask.attribution[${i}]`:"longtask.attribution";r.setAttribute(`${s}.name`,o.name),r.setAttribute(`${s}.entry_type`,o.entryType),r.setAttribute(`${s}.start_time`,o.startTime),r.setAttribute(`${s}.duration`,o.duration),r.setAttribute(`${s}.container_type`,o.containerType),r.setAttribute(`${s}.container_src`,o.containerSrc),r.setAttribute(`${s}.container_id`,o.containerId),r.setAttribute(`${s}.container_name`,o.containerName)}),r.end(b(t.startTime+t.duration))}enable(){if(!this.isSupported()){this._diag.debug("Environment not supported");return}this._observer||(this._observer=new PerformanceObserver(t=>{t.getEntries().forEach(r=>this._createSpanFromEntry(r))}),this._observer.observe({type:Bs,buffered:!0}))}disable(){this._observer&&(this._observer.disconnect(),this._observer=void 0)}};var re;(function(e){e.EVENT_TYPE="event_type",e.TARGET_ELEMENT="target_element",e.TARGET_XPATH="target_xpath",e.HTTP_URL="http.url"})(re||(re={}));var Gs="0.63.0",Bu="@opentelemetry/instrumentation-user-interaction";var fm="OT_ZONE_CONTEXT",Tm="Navigation:",gm=["click"];function Em(){return!1}var zr=class extends M{version=Gs;moduleName="user-interaction";_spansData=new WeakMap;_wrappedListeners=new WeakMap;_eventsSpanMap=new WeakMap;_eventNames;_shouldPreventSpanCreation;constructor(t={}){super(Bu,Gs,t),this._eventNames=new Set(t?.eventNames??gm),this._shouldPreventSpanCreation=typeof t?.shouldPreventSpanCreation=="function"?t.shouldPreventSpanCreation:Em}init(){}_checkForTimeout(t,r){let n=this._spansData.get(r);n&&(t.source==="setTimeout"?n.hrTimeLastTimeout=b():t.source!=="Promise.then"&&t.source!=="setTimeout"&&(n.hrTimeLastTimeout=void 0))}_allowEventName(t){return this._eventNames.has(t)}_createSpan(t,r,n){if(!this._isEnabled||!(t instanceof HTMLElement)||!t.getAttribute||t.hasAttribute("disabled")||!this._allowEventName(r))return;let o=Vo(t,!0);try{let i=this.tracer.startSpan(r,{attributes:{[re.EVENT_TYPE]:r,[re.TARGET_ELEMENT]:t.tagName,[re.TARGET_XPATH]:o,[re.HTTP_URL]:window.location.href}},n?S.setSpan(E.active(),n):void 0);return this._shouldPreventSpanCreation(r,t,i)===!0?void 0:(this._spansData.set(i,{taskCount:0}),i)}catch(i){this._diag.error("failed to start create new user interaction span",i)}}_decrementTask(t){let r=this._spansData.get(t);r&&(r.taskCount--,r.taskCount===0&&this._tryToEndSpan(t,r.hrTimeLastTimeout))}_getCurrentSpan(t){let r=t.get(fm);return r&&S.getSpan(r)}_incrementTask(t){let r=this._spansData.get(t);r&&r.taskCount++}addPatchedListener(t,r,n,o){let i=this._wrappedListeners.get(n);i||(i=new Map,this._wrappedListeners.set(n,i));let s=i.get(r);return s||(s=new Map,i.set(r,s)),s.has(t)?!1:(s.set(t,o),!0)}removePatchedListener(t,r,n){let o=this._wrappedListeners.get(n);if(!o)return;let i=o.get(r);if(!i)return;let s=i.get(t);return s&&(i.delete(t),i.size===0&&(o.delete(r),o.size===0&&this._wrappedListeners.delete(n))),s}_invokeListener(t,r,n){return typeof t=="function"?t.apply(r,n):t.handleEvent(n[0])}_patchAddEventListener(){let t=this;return r=>function(o,i,s){if(!i)return r.call(this,o,i,s);let a=s&&typeof s=="object"&&s.once,c=function(...u){let p,m=u[0],f=m?.target;m&&(p=t._eventsSpanMap.get(m)),a&&t.removePatchedListener(this,o,i);let _=t._createSpan(f,o,p);return _?(m&&t._eventsSpanMap.set(m,_),E.with(S.setSpan(E.active(),_),()=>{let d=t._invokeListener(i,this,u);return _.end(),d})):t._invokeListener(i,this,u)};if(t.addPatchedListener(this,o,i,c))return r.call(this,o,c,s)}}_patchRemoveEventListener(){let t=this;return r=>function(o,i,s){let a=t.removePatchedListener(this,o,i);return a?r.call(this,o,a,s):r.call(this,o,i,s)}}_getPatchableEventTargets(){return window.EventTarget?[EventTarget.prototype]:[Node.prototype,Window.prototype]}_patchHistoryApi(){this._isEnabled&&(this._wrap(history,"replaceState",this._patchHistoryMethod()),this._wrap(history,"pushState",this._patchHistoryMethod()),this._wrap(history,"back",this._patchHistoryMethod()),this._wrap(history,"forward",this._patchHistoryMethod()),this._wrap(history,"go",this._patchHistoryMethod()))}_patchHistoryMethod(){let t=this;return r=>function(...o){if(!t._isEnabled)return r.apply(this,o);let i=`${location.pathname}${location.hash}${location.search}`,s=r.apply(this,o),a=`${location.pathname}${location.hash}${location.search}`;return i!==a&&t._updateInteractionName(a),s}}_updateInteractionName(t){let r=S.getSpan(E.active());r&&typeof r.updateName=="function"&&r.updateName(`${Tm} ${t}`)}_patchZoneCancelTask(){let t=this;return r=>function(o){let i=Zone.current,s=t._getCurrentSpan(i);return s&&t._shouldCountTask(o,i)&&t._decrementTask(s),r.call(this,o)}}_patchZoneScheduleTask(){let t=this;return r=>function(o){let i=Zone.current,s=t._getCurrentSpan(i);return s&&t._shouldCountTask(o,i)&&(t._incrementTask(s),t._checkForTimeout(o,s)),r.call(this,o)}}_patchZoneRunTask(){let t=this;return r=>function(o,i,s){let c=(Array.isArray(s)&&s[0]instanceof Event?s[0]:void 0)?.target,u,p=this;if(c){if(u=t._createSpan(c,o.eventName),u)return t._incrementTask(u),p.run(()=>{try{return E.with(S.setSpan(E.active(),u),()=>{let m=Zone.current;return o._zone=m,r.call(m,o,i,s)})}finally{t._decrementTask(u)}})}else u=t._getCurrentSpan(p);try{return r.call(p,o,i,s)}finally{u&&t._shouldCountTask(o,p)&&t._decrementTask(u)}}}_shouldCountTask(t,r){if(t._zone&&(r=t._zone),!r||!t.data||t.data.isPeriodic)return!1;let n=this._getCurrentSpan(r);return!n||!this._spansData.get(n)?!1:t.type==="macroTask"||t.type==="microTask"}_tryToEndSpan(t,r){t&&this._spansData.get(t)&&(t.end(r),this._spansData.delete(t))}enable(){if(this._isEnabled||(this._isEnabled=!0,typeof this._zonePatched=="boolean"))return;let t=this._getZoneWithPrototype();this._diag.debug("applying patch to",this.moduleName,this.version,"zone:",!!t),t?(this._zonePatched=!0,this._wrap(t.prototype,"runTask",this._patchZoneRunTask()),this._wrap(t.prototype,"scheduleTask",this._patchZoneScheduleTask()),this._wrap(t.prototype,"cancelTask",this._patchZoneCancelTask())):(this._zonePatched=!1,this._getPatchableEventTargets().forEach(n=>{this._wrap(n,"addEventListener",this._patchAddEventListener()),this._wrap(n,"removeEventListener",this._patchRemoveEventListener())})),this._patchHistoryApi()}disable(){this._isEnabled&&(this._isEnabled=!1)}_getZoneWithPrototype(){return window.Zone}};var Gu="http.host",Hu="http.method",Vu="http.request.body.size",ku="http.request_content_length_uncompressed";var Fu="http.scheme",zu="http.status_code",$u="http.url",Wu="http.user_agent";var ft;(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"})(ft||(ft={}));var Am=l.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-xml-http-request/utils"});function Sm(e){return typeof Document<"u"&&e instanceof Document}function Ku(e){if(Sm(e))return new XMLSerializer().serializeToString(document).length;if(typeof e=="string")return ju(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return xm(e);if(e instanceof URLSearchParams)return ju(e.toString());if(e.byteLength!==void 0)return e.byteLength;Am.warn("unknown body type")}var Rm=new TextEncoder;function ju(e){return Rm.encode(e).byteLength}function xm(e){let t=0;for(let[r,n]of e.entries())t+=r.length,n instanceof Blob?t+=n.size:t+=n.length;return t}function Xu(e){let t=Lm(),r=e.toUpperCase();return r in t?r:"_OTHER"}var Om={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},$r;function Lm(){if($r===void 0){let e=void 0;e&&e.length>0?($r={},e.forEach(t=>{$r[t]=!0})):$r=Om}return $r}var bm={"https:":"443","http:":"80"};function Yu(e){let t=Number(e.port||bm[e.protocol]);if(t&&!isNaN(t))return t}var Hs="0.219.0";var Wo;(function(e){e.HTTP_STATUS_TEXT="http.status_text"})(Wo||(Wo={}));var wm=300,Wr=class extends M{component="xml-http-request";version=Hs;moduleName=this.component;_tasksCount=0;_xhrMem=new WeakMap;_usedResources=new WeakSet;_semconvStability;constructor(t={}){super("@opentelemetry/instrumentation-xml-http-request",Hs,t),this._semconvStability=te("http",t?.semconvStabilityOptIn)}init(){}_addHeaders(t,r){let n=rt(r).href;if(!Mr(n,this.getConfig().propagateTraceHeaderCorsUrls)){let i={};D.inject(E.active(),i),Object.keys(i).length>0&&this._diag.debug("headers inject skipped due to CORS policy");return}let o={};D.inject(E.active(),o),Object.keys(o).forEach(i=>{t.setRequestHeader(i,String(o[i]))})}_addChildSpan(t,r){E.with(S.setSpan(E.active(),t),()=>{let n=this.tracer.startSpan("CORS Preflight",{startTime:r[A.FETCH_START]}),o=!(this._semconvStability&R.OLD);ht(n,r,this.getConfig().ignoreNetworkEvents,void 0,o),n.end(r[A.RESPONSE_END])})}_addFinalSpanAttributes(t,r,n){if(this._semconvStability&R.OLD){if(r.status!==void 0&&t.setAttribute(zu,r.status),r.statusText!==void 0&&t.setAttribute(Wo.HTTP_STATUS_TEXT,r.statusText),typeof n=="string"){let o=rt(n);t.setAttribute(Gu,o.host),t.setAttribute(Fu,o.protocol.replace(":",""))}t.setAttribute(Wu,navigator.userAgent)}this._semconvStability&R.STABLE&&r.status&&t.setAttribute(wn,r.status)}_applyAttributesAfterXHR(t,r){let n=this.getConfig().applyCustomAttributesOnSpan;typeof n=="function"&&yt(()=>n(t,r),o=>{o&&this._diag.error("applyCustomAttributesOnSpan",o)},!0)}_addResourceObserver(t,r){let n=this._xhrMem.get(t);!n||typeof PerformanceObserver!="function"||typeof PerformanceResourceTiming!="function"||(n.createdResources={observer:new PerformanceObserver(o=>{let i=o.getEntries(),s=rt(r);i.forEach(a=>{a.initiatorType==="xmlhttprequest"&&a.name===s.href&&n.createdResources&&n.createdResources.entries.push(a)})}),entries:[]},n.createdResources.observer.observe({entryTypes:["resource"]}))}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(N.clearResourceTimings(),this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}_findResourceAndAddNetworkEvents(t,r,n,o,i){if(!n||!o||!i||!t.createdResources)return;let s=t.createdResources.entries;(!s||!s.length)&&(s=N.getEntriesByType("resource"));let a=Ir(rt(n).href,o,i,s,this._usedResources);if(a.mainRequest){let c=a.mainRequest;this._markResourceAsUsed(c);let u=a.corsPreFlightRequest;u&&(this._addChildSpan(r,u),this._markResourceAsUsed(u));let p=!(this._semconvStability&R.OLD);ht(r,c,this.getConfig().ignoreNetworkEvents,void 0,p)}}_cleanPreviousSpanInformation(t){let r=this._xhrMem.get(t);if(r){let n=r.callbackToRemoveEvents;n&&n(),this._xhrMem.delete(t)}}_createSpan(t,r,n){let o=rt(r);if(_r(o.href,this.getConfig().ignoreUrls)){this._diag.debug("ignoring span as url matches ignored url");return}let i="",s={};if(this._semconvStability&R.OLD&&(i=n.toUpperCase(),s[Hu]=n,s[$u]=o.toString()),this._semconvStability&R.STABLE){let c=n,u=Xu(n);i||(i=u),s[Ln]=u,u!==c&&(s[bn]=c),s[ot]=o.toString(),s[Nn]=o.hostname;let p=Yu(o);p&&(s[yn]=p)}let a=this.tracer.startSpan(i,{kind:Rt.CLIENT,attributes:s});return a.addEvent(ft.METHOD_OPEN),this._cleanPreviousSpanInformation(t),this._xhrMem.set(t,{span:a,spanUrl:r}),a}_markResourceAsUsed(t){this._usedResources.add(t)}_patchOpen(){return t=>{let r=this;return function(...o){if(!r._isEnabled)return t.apply(this,o);let i=o[0],s=o[1];return r._createSpan(this,s,i),t.apply(this,o)}}}_patchSend(){let t=this;function r(u,p,m,f){let _=p.callbackToRemoveEvents;typeof _=="function"&&_();let{span:d,spanUrl:h,sendStartTime:g}=p;d&&(t._findResourceAndAddNetworkEvents(p,d,h,g,m),d.addEvent(u,f),t._addFinalSpanAttributes(d,p,h),d.end(f),t._tasksCount--),t._clearResources()}function n(u,p,m,f){let _=t._xhrMem.get(p);if(!_)return;if(_.status=p.status,_.statusText=p.statusText,t._xhrMem.delete(p),_.span){let g=_.span;t._applyAttributesAfterXHR(g,p),t._semconvStability&R.STABLE&&(m?f&&(g.setStatus({code:Y.ERROR,message:f}),g.setAttribute(rr,f)):_.status&&_.status>=400&&(g.setStatus({code:Y.ERROR}),g.setAttribute(rr,String(_.status))))}let d=b(),h=Date.now();setTimeout(()=>{r(u,_,d,h)},wm)}function o(){n(ft.EVENT_ERROR,this,!0,"error")}function i(){n(ft.EVENT_ABORT,this,!1)}function s(){n(ft.EVENT_TIMEOUT,this,!0,"timeout")}function a(){this.status<299?n(ft.EVENT_LOAD,this,!1):n(ft.EVENT_ERROR,this,!1)}function c(u){u.removeEventListener("abort",i),u.removeEventListener("error",o),u.removeEventListener("load",a),u.removeEventListener("timeout",s);let p=t._xhrMem.get(u);p&&(p.callbackToRemoveEvents=void 0)}return u=>function(...m){if(!t._isEnabled)return u.apply(this,m);let f=t._xhrMem.get(this);if(!f)return u.apply(this,m);let _=f.span,d=f.spanUrl;if(_&&d){if(t.getConfig().measureRequestSize&&m?.[0]){let h=m[0],g=Ku(h);g!==void 0&&(t._semconvStability&R.OLD&&_.setAttribute(ku,g),t._semconvStability&R.STABLE&&_.setAttribute(Vu,g))}E.with(S.setSpan(E.active(),_),()=>{t._tasksCount++,f.sendStartTime=b(),_.addEvent(ft.METHOD_SEND),this.addEventListener("abort",i),this.addEventListener("error",o),this.addEventListener("load",a),this.addEventListener("timeout",s),f.callbackToRemoveEvents=()=>{c(this),f.createdResources&&f.createdResources.observer.disconnect()},t._addHeaders(this,d),t._addResourceObserver(this,d)})}return u.apply(this,m)}}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(t){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.",t)}}}disable(){this._isEnabled&&(this._isEnabled=!1,this._tasksCount=0,this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}};var qu="0.12.0",Qu="@opentelemetry/instrumentation-web-exception";var jr=class extends M{constructor(t={}){super(Qu,qu,t)}init(){}onError(t){let r="exception",n="reason"in t?t.reason:t.error;if(n===void 0)return;let o=Dt.getLoggerProvider().getLogger(this.instrumentationName,this.instrumentationVersion),i=this.getConfig(),s=i.applyCustomAttributes?i.applyCustomAttributes(n):{},a={};typeof n=="string"?a={[J]:n}:a={[nt]:n.name,[J]:n.message,[Xt]:n.stack};let c={eventName:r,severityNumber:Lt.ERROR,attributes:{...a,...s},timestamp:b(),observedTimestamp:b()};o.emit(c)}disable(){this._onErrorHandler&&(window.removeEventListener("error",this._onErrorHandler),window.removeEventListener("unhandledrejection",this._onErrorHandler))}enable(){this._onErrorHandler||(this._onErrorHandler=this.onError.bind(this)),window.addEventListener("error",this._onErrorHandler),window.addEventListener("unhandledrejection",this._onErrorHandler)}};var Ju="0.5.2";var Zu="browser.web_vital",tl="browser.web_vital.name",el="browser.web_vital.value",rl="browser.web_vital.rating",nl="browser.web_vital.delta",ol="browser.web_vital.id",il="browser.web_vital.navigation_type";var Kr;(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"})(Kr||(Kr={}));var Xr=class{emit(t){}enabled(){return!1}},sl=new Xr;var Yr=Symbol.for("io.opentelemetry.js.api.logs"),De=globalThis;function al(e,t,r){return n=>n===e?t:r}var Vs=1;var ks=class{getLogger(t,r,n){return new Xr}},jo=new ks;var Ko=class{constructor(t,r,n,o){this._provider=t,this.name=r,this.version=n,this.options=o}emit(t){this._getLogger().emit(t)}enabled(t){return this._getLogger().enabled(t)}_getLogger(){if(this._delegate)return this._delegate;let t=this._provider._getDelegateLogger(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):sl}};var qr=class{getLogger(t,r,n){var o;return(o=this._getDelegateLogger(t,r,n))!==null&&o!==void 0?o:new Ko(this,t,r,n)}_getDelegate(){var t;return(t=this._delegate)!==null&&t!==void 0?t:jo}_setDelegate(t){this._delegate=t}_getDelegateLogger(t,r,n){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(t,r,n)}};var Xo=class e{constructor(){this._proxyLoggerProvider=new qr}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(t){return De[Yr]?this.getLoggerProvider():(De[Yr]=al(Vs,t,jo),this._proxyLoggerProvider._setDelegate(t),t)}getLoggerProvider(){var t,r;return(r=(t=De[Yr])===null||t===void 0?void 0:t.call(De,Vs))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(t,r,n){return this.getLoggerProvider().getLogger(t,r,n)}disable(){delete De[Yr],this._proxyLoggerProvider=new qr}};var cl=Xo.getInstance();var z=console.error.bind(console);function Qr(e,t,r){let n=!!e[t]&&Object.prototype.propertyIsEnumerable.call(e,t);Object.defineProperty(e,t,{configurable:!0,enumerable:n,writable:!0,value:r})}var Yo=(e,t,r)=>{if(!e||!e[t]){z("no original function "+String(t)+" to wrap");return}if(!r){z("no wrapper function"),z(new Error().stack);return}let n=e[t];if(typeof n!="function"||typeof r!="function"){z("original object and wrapper must be functions");return}let o=r(n,t);return Qr(o,"__original",n),Qr(o,"__unwrap",()=>{e[t]===o&&Qr(e,t,n)}),Qr(o,"__wrapped",!0),Qr(e,t,o),o},Fs=(e,t,r)=>{if(e)Array.isArray(e)||(e=[e]);else{z("must provide one or more modules to patch"),z(new Error().stack);return}if(!(t&&Array.isArray(t))){z("must provide one or more functions to wrap on modules");return}e.forEach(n=>{t.forEach(o=>{Yo(n,o,r)})})},qo=(e,t)=>{if(!e||!e[t]){z("no function to unwrap."),z(new Error().stack);return}let r=e[t];if(!r.__unwrap)z("no original to unwrap to -- has "+String(t)+" already been unwrapped?");else{r.__unwrap();return}},zs=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{z("must provide one or more modules to patch"),z(new Error().stack);return}if(!(t&&Array.isArray(t))){z("must provide one or more functions to unwrap on modules");return}e.forEach(r=>{t.forEach(n=>{qo(r,n)})})};function Jr(e){e&&e.logger&&(typeof e.logger!="function"?z("new logger isn't a function, not replacing"):z=e.logger)}Jr.wrap=Yo;Jr.massWrap=Fs;Jr.unwrap=qo;Jr.massUnwrap=zs;var Qo=class{_config={};_tracer;_meter;_logger;_diag;instrumentationName;instrumentationVersion;constructor(t,r,n){this.instrumentationName=t,this.instrumentationVersion=r,this.setConfig(n),this._diag=l.createComponentLogger({namespace:t}),this._tracer=S.getTracer(t,r),this._meter=xt.getMeter(t,r),this._logger=cl.getLogger(t,r),this._updateMetricInstruments()}_wrap=Yo;_unwrap=qo;_massWrap=Fs;_massUnwrap=zs;get meter(){return this._meter}setMeterProvider(t){this._meter=t.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(t){this._logger=t.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let t=this.init()??[];return Array.isArray(t)?t:[t]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(t){this._config={enabled:!0,...t}}setTracerProvider(t){this._tracer=t.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(t,r,n,o){if(t)try{t(n,o)}catch(i){this._diag.error("Error running span customization hook due to exception in handler",{triggerName:r},i)}}};var Ue=class extends Qo{constructor(t,r,n){super(t,r,n),this._config.enabled&&this.enable()}};function $s(e,t,r){let n,o;try{o=e()}catch(i){n=i}finally{if(t(n,o),n&&!r)throw n;return o}}var Zo=class{t;o=0;i=[];u(t){if(t.hadRecentInput)return;let r=this.i[0],n=this.i.at(-1);this.o&&r&&n&&t.startTime-n.startTime<1e3&&t.startTime-r.startTime<5e3?(this.o+=t.value,this.i.push(t)):(this.o=t.value,this.i=[t]),this.t?.(t)}},Ve=()=>{let e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},ti=e=>{if(document.readyState==="loading")return"loading";let t=Ve();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"},ym=e=>{let t=e.nodeName;return e.nodeType===1?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},Qs=e=>{let t="";try{for(;e?.nodeType!==9;){let r=e,n=r.id?"#"+r.id:[ym(r),...Array.from(r.classList).sort()].join(".");if(t.length+n.length>99)return t||n;if(t=t?n+">"+t:n,r.id)break;e=r.parentNode}}catch{}return t},Ws=new WeakMap;function Ge(e,t){return Ws.get(e)||Ws.set(e,new t),Ws.get(e)}var gl=-1,El=()=>gl,ke=e=>{addEventListener("pageshow",t=>{t.persisted&&(gl=t.timeStamp,e(t))},!0)},Tt=(e,t,r,n)=>{let o,i;return s=>{t.value>=0&&(s||n)&&(i=t.value-(o??0),(i||o===void 0)&&(o=t.value,t.delta=i,t.rating=((a,c)=>a>c[1]?"poor":a>c[0]?"needs-improvement":"good")(t.value,r),e(t)))}},Js=e=>{requestAnimationFrame(()=>requestAnimationFrame(e))},Zr=()=>Ve()?.activationStart??0,gt=(e,t=-1)=>{let r=Ve(),n="navigate";return El()>=0?n="back-forward-cache":r&&(document.prerendering||Zr()>0?n="prerender":document.wasDiscarded?n="restore":r.type&&(n=r.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:n}},He=(e,t,r={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){let n=new PerformanceObserver(o=>{queueMicrotask(()=>{t(o.getEntries())})});return n.observe({type:e,buffered:!0,...r}),n}}catch{}},Zs=e=>{let t=!1;return()=>{t||(e(),t=!0)}},Be=-1,Al=new Set,ul=()=>document.visibilityState!=="hidden"||document.prerendering?1/0:0,Ks=e=>{if(document.visibilityState==="hidden"){if(e.type==="visibilitychange")for(let t of Al)t();isFinite(Be)||(Be=e.type==="visibilitychange"?e.timeStamp:0,removeEventListener("prerenderingchange",Ks,!0))}},ni=()=>{if(Be<0){let e=Zr();Be=(document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(r=>r.name==="hidden"&&r.startTime>=e)?.startTime)??ul(),addEventListener("visibilitychange",Ks,!0),addEventListener("prerenderingchange",Ks,!0),ke(()=>{setTimeout(()=>{Be=ul()})})}return{get firstHiddenTime(){return Be},onHidden(e){Al.add(e)}}},oi=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},ll=[1800,3e3],Sl=(e,t={})=>{oi(()=>{let r=ni(),n,o=gt("FCP"),i=He("paint",s=>{for(let a of s)a.name==="first-contentful-paint"&&(i.disconnect(),a.startTime<r.firstHiddenTime&&(o.value=Math.max(a.startTime-Zr(),0),o.entries.push(a),n(!0)))});i&&(n=Tt(e,o,ll,t.reportAllChanges),ke(s=>{o=gt("FCP"),n=Tt(e,o,ll,t.reportAllChanges),Js(()=>{o.value=performance.now()-s.timeStamp,n(!0)})}))})},pl=[.1,.25],_l=e=>e.find(t=>t.node?.nodeType===1)||e[0],Rl=(e,t={})=>{let r=Ge(t=Object.assign({},t),Zo),n=new WeakMap;r.t=o=>{if(o?.sources?.length){let i=_l(o.sources),s=i?.node;if(s){let a=t.generateTarget?.(s)??Qs(s);n.set(i,a)}}},((o,i={})=>{let s=ni();Sl(Zs(()=>{let a,c=gt("CLS",0),u=Ge(i,Zo),p=f=>{for(let _ of f)u.u(_);u.o>c.value&&(c.value=u.o,c.entries=u.i,a())},m=He("layout-shift",p);m&&(a=Tt(o,c,pl,i.reportAllChanges),s.onHidden(()=>{p(m.takeRecords()),a(!0)}),ke(()=>{u.o=0,c=gt("CLS",0),a=Tt(o,c,pl,i.reportAllChanges),Js(a)}),setTimeout(a))}))})(o=>{e((i=>{let s={};if(i.entries.length){let a=i.entries.reduce((c,u)=>c.value>u.value?c:u);if(a?.sources?.length){let c=_l(a.sources);c&&(s={largestShiftTarget:n.get(c),largestShiftTime:a.startTime,largestShiftValue:a.value,largestShiftSource:c,largestShiftEntry:a,loadState:ti(a.startTime)})}}return Object.assign(i,{attribution:s})})(o))},t)},xl=(e,t={})=>{Sl(r=>{e((n=>{let o={timeToFirstByte:0,firstByteToFCP:n.value,loadState:ti(El())};if(n.entries.length){let i=Ve(),s=n.entries.at(-1);if(i){let a=i.activationStart||0,c=Math.max(0,i.responseStart-a);o={timeToFirstByte:c,firstByteToFCP:n.value-c,loadState:ti(n.entries[0].startTime),navigationEntry:i,fcpEntry:s}}}return Object.assign(n,{attribution:o})})(r))},t)},Ol=0,js=1/0,Jo=0,Cm=e=>{for(let t of e)t.interactionId&&(js=Math.min(js,t.interactionId),Jo=Math.max(Jo,t.interactionId),Ol=Jo?(Jo-js)/7+1:0)},Xs,ml=()=>Xs?Ol:performance.interactionCount??0,Pm=()=>{"interactionCount"in performance||Xs||(Xs=He("event",Cm,{durationThreshold:0}))},dl=0,ei=class{l=[];h=new Map;m;p;v(){dl=ml(),this.l.length=0,this.h.clear()}M(){let t=Math.min(this.l.length-1,Math.floor((ml()-dl)/50));return this.l[t]}u(t){if(this.m?.(t),!t.interactionId&&t.entryType!=="first-input")return;let r=this.l.at(-1),n=this.h.get(t.interactionId);if(n||this.l.length<10||t.duration>r.T){if(n?t.duration>n.T?(n.entries=[t],n.T=t.duration):t.duration===n.T&&t.startTime===n.entries[0].startTime&&n.entries.push(t):(n={id:t.interactionId,entries:[t],T:t.duration},this.h.set(n.id,n),this.l.push(n)),this.l.sort((o,i)=>i.T-o.T),this.l.length>10){let o=this.l.splice(10);for(let i of o)this.h.delete(i.id)}this.p?.(n)}}},Ys=e=>{let t=globalThis.requestIdleCallback||setTimeout,r=globalThis.cancelIdleCallback||clearTimeout;if(document.visibilityState==="hidden")e();else{let n=Zs(e),o=-1,i=()=>{r(o),n()};addEventListener("visibilitychange",i,{once:!0,capture:!0}),o=t(()=>{removeEventListener("visibilitychange",i,{capture:!0}),n()})}},hl=[200,500],Ll=(e,t={})=>{let r=Ge(t=Object.assign({},t),ei),n=[],o=[],i=0,s=new WeakMap,a=new WeakMap,c=!1,u=()=>{c||(Ys(p),c=!0)},p=()=>{let _=new Set(r.l.map(g=>s.get(g.entries[0]))),d=o.length-10;o=o.filter((g,L)=>L>=d||_.has(g));let h=new Set;for(let g of o){let L=m(g.startTime,g.processingEnd);for(let $ of L)h.add($)}n=n.filter(g=>g.startTime>i||h.has(g)),c=!1};r.m=_=>{let d=_.startTime+_.duration,h;i=Math.max(i,_.processingEnd);for(let g=o.length-1;g>=0;g--){let L=o[g];if(Math.abs(d-L.renderTime)<=8){h=L,h.startTime=Math.min(_.startTime,h.startTime),h.processingStart=Math.min(_.processingStart,h.processingStart),h.processingEnd=Math.max(_.processingEnd,h.processingEnd),t.includeProcessedEventEntries!==!1&&h.entries.push(_);break}}h||(h={startTime:_.startTime,processingStart:_.processingStart,processingEnd:_.processingEnd,renderTime:d,entries:t.includeProcessedEventEntries!==!1?[_]:[]},o.push(h)),(_.interactionId||_.entryType==="first-input")&&s.set(_,h),u()},r.p=_=>{if(!a.get(_)){let d=_.entries[0].target;if(d){let h=t.generateTarget?.(d)??Qs(d);a.set(_,h)}}};let m=(_,d)=>{let h=[];for(let g of n)if(!(g.startTime+g.duration<_)){if(g.startTime>d)break;h.push(g)}return h},f=_=>{let d=_.entries[0],h=s.get(d),g=d.processingStart,L=Math.max(d.startTime+d.duration,g),$=Math.min(h.processingEnd,L),V=h.entries.sort((v,vt)=>v.processingStart-vt.processingStart),x=m(d.startTime,$),It=r.h.get(d.interactionId),Mt={interactionTarget:a.get(It),interactionType:d.name.startsWith("key")?"keyboard":"pointer",interactionTime:d.startTime,nextPaintTime:L,processedEventEntries:V,longAnimationFrameEntries:x,inputDelay:g-d.startTime,processingDuration:$-g,presentationDelay:L-$,loadState:ti(d.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(v=>{if(!v.longAnimationFrameEntries?.length)return;let vt=v.interactionTime,ui=v.inputDelay,ra=v.processingDuration,li,pi,_i=0,ze=0,mi=0,di=0;for(let rn of v.longAnimationFrameEntries){ze=ze+rn.startTime+rn.duration-rn.styleAndLayoutStart;for(let Et of rn.scripts){let oa=Et.startTime+Et.duration;if(oa<vt)continue;let nn=oa-Math.max(vt,Et.startTime),ia=Et.duration?nn/Et.duration*Et.forcedStyleAndLayoutDuration:0;_i+=nn-ia,ze+=ia,nn>di&&(pi=Et.startTime<vt+ui?"input-delay":Et.startTime>=vt+ui+ra?"presentation-delay":"processing-duration",li=Et,di=nn)}}let hi=v.longAnimationFrameEntries.at(-1),na=hi?hi.startTime+hi.duration:0;na>=vt+ui+ra&&(mi=v.nextPaintTime-na),li&&pi&&(v.longestScript={entry:li,subpart:pi,intersectingDuration:di}),v.totalScriptDuration=_i,v.totalStyleAndLayoutDuration=ze,v.totalPaintDuration=mi,v.totalUnattributedDuration=v.nextPaintTime-vt-_i-ze-mi})(Mt),Object.assign(_,{attribution:Mt})};He("long-animation-frame",_=>{n=n.concat(_),u()}),((_,d={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;let h=ni();oi(()=>{Pm();let g,L=gt("INP"),$=Ge(d,ei),V=It=>{Ys(()=>{for(let v of It)$.u(v);let Mt=$.M();Mt&&Mt.T!==L.value&&(L.value=Mt.T,L.entries=Mt.entries,g())})},x=He("event",V,{durationThreshold:d.durationThreshold??40});g=Tt(_,L,hl,d.reportAllChanges),x&&(x.observe({type:"first-input",buffered:!0}),h.onHidden(()=>{V(x.takeRecords()),g(!0)}),ke(()=>{$.v(),L=gt("INP"),g=Tt(_,L,hl,d.reportAllChanges)}))})})(_=>{e(f(_))},t)},ri=class{m;u(t){this.m?.(t)}},fl=[2500,4e3],bl=(e,t={})=>{let r=Ge(t=Object.assign({},t),ri),n=new WeakMap;r.m=o=>{let i=o.element;if(i){let s=t.generateTarget?.(i)??Qs(i);n.set(o,s)}else o.id&&n.set(o,`#${o.id}`)},((o,i={})=>{oi(()=>{let s=ni(),a,c=gt("LCP"),u=Ge(i,ri),p=f=>{i.reportAllChanges||(f=f.slice(-1));for(let _ of f)u.u(_),_.startTime<s.firstHiddenTime&&(c.value=Math.max(_.startTime-Zr(),0),c.entries=[_],a())},m=He("largest-contentful-paint",p);if(m){a=Tt(o,c,fl,i.reportAllChanges);let f=Zs(()=>{p(m.takeRecords()),m.disconnect(),a(!0)}),_=d=>{d.isTrusted&&(Ys(f),removeEventListener(d.type,_,{capture:!0}))};for(let d of["keydown","click","visibilitychange"])addEventListener(d,_,{capture:!0});ke(d=>{c=gt("LCP"),a=Tt(o,c,fl,i.reportAllChanges),Js(()=>{c.value=performance.now()-d.timeStamp,a(!0)})})}})})(o=>{e((i=>{let s={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:i.value};if(i.entries.length){let a=i.entries.at(-1),c=a.url&&performance.getEntriesByType("resource").find(p=>p.name===a.url);s.target=n.get(a),s.lcpEntry=a,a.url&&(s.url=a.url),c&&(s.lcpResourceEntry=c);let u=Ve();if(u){let p=u.activationStart||0,m=Math.max(0,u.responseStart-p),f=Math.max(m,c?(c.requestStart||c.startTime)-p:0),_=Math.min(i.value,Math.max(f,c?c.responseEnd-p:0));s={...s,timeToFirstByte:m,resourceLoadDelay:f-m,resourceLoadDuration:_-f,elementRenderDelay:i.value-_,navigationEntry:u}}}return Object.assign(i,{attribution:s})})(o))},t)},Tl=[800,1800],qs=e=>{document.prerendering?oi(()=>qs(e)):document.readyState!=="complete"?addEventListener("load",()=>qs(e),!0):setTimeout(e)},wl=(e,t={})=>{((r,n={})=>{let o=gt("TTFB"),i=Tt(r,o,Tl,n.reportAllChanges);qs(()=>{let s=Ve();s&&(o.value=Math.max(s.responseStart-Zr(),0),o.entries=[s],i(!0),ke(()=>{o=gt("TTFB",0),i=Tt(r,o,Tl,n.reportAllChanges),i(!0)}))})})(r=>{e((n=>{let o={waitingDuration:0,cacheDuration:0,dnsDuration:0,connectionDuration:0,requestDuration:0};if(n.entries.length){let i=n.entries[0],s=i.activationStart||0,a=Math.max((i.workerStart||i.fetchStart)-s,0),c=Math.max(i.domainLookupStart-s,0),u=Math.max(i.connectStart-s,0),p=Math.max(i.connectEnd-s,0);o={waitingDuration:a,cacheDuration:c-a,dnsDuration:u-c,connectionDuration:p-u,requestDuration:n.value-p,navigationEntry:i}}return Object.assign(n,{attribution:o})})(r))},t)};var ta=class extends Ue{_applyCustomLogRecordData;_includeRawAttribution;constructor(e={}){super("@opentelemetry/browser-instrumentation/web-vitals",Ju,e),this._applyCustomLogRecordData=e.applyCustomLogRecordData,this._includeRawAttribution=e.includeRawAttribution??!1}init(){return[]}enable(){if(typeof PerformanceObserver>"u"){this._diag.debug("PerformanceObserver not supported, web vitals will not be collected");return}if(this._isEnabled=!0,this._listenersRegistered){this._diag.debug("Listeners already registered, resuming emission");return}this._listenersRegistered=!0,this._diag.debug("Registering listeners"),Rl(e=>this._emitWebVital(e)),Ll(e=>this._emitWebVital(e)),bl(e=>this._emitWebVital(e)),xl(e=>this._emitWebVital(e)),wl(e=>this._emitWebVital(e))}disable(){this._isEnabled=!1,this._diag.debug("Instrumentation disabled, pausing emission")}_getTimestampForMetric(e){if(e.name==="CLS"){let{attribution:t}=e;return t.largestShiftTime!==void 0?t.largestShiftTime:void 0}if(e.name==="INP"){let{attribution:t}=e;return t.interactionTime}return e.value}_emitWebVital(e){if(!this._isEnabled)return;let t={[tl]:e.name.toLowerCase(),[el]:e.value,[nl]:e.delta,[rl]:e.rating,[ol]:e.id,[il]:e.navigationType},r=this._getTimestampForMetric(e),n={eventName:Zu,severityNumber:Kr.INFO,attributes:t,...this._includeRawAttribution?{body:JSON.stringify(e.attribution)}:{},...r!==void 0?{timestamp:r}:{}};this._applyCustomLogRecordData&&$s(()=>this._applyCustomLogRecordData?.(n),o=>{o&&this._diag.error("applyCustomLogRecordData hook failed",o)},!0),this.logger.emit(n)}};var ii=O.INFO,zt={ALL:O.ALL,VERBOSE:O.VERBOSE,DEBUG:O.DEBUG,INFO:O.INFO,WARN:O.WARN,ERROR:O.ERROR,NONE:O.NONE};function si(e){return ii=zt[e.logLevel.toUpperCase()],ii==null&&(console.warn(`Unknown log level "${e.logLevel}", expected one of ${Object.keys(zt)}, using default`),ii=zt.INFO),{error:tn(zt.ERROR,console.error.bind(console)),warn:tn(zt.WARN,console.error.bind(console)),info:tn(zt.INFO,console.log.bind(console)),debug:tn(zt.DEBUG,console.log.bind(console)),verbose:tn(zt.VERBOSE,console.trace.bind(console))}}function tn(e,t){return function(...n){let o=ii>=e;if(n.length===0)return o;o&&t(...n)}}var ne=si({logLevel:"warn"}),Fe=B,ai=!1,yl={active:function(){return Fe},with:function(e,t,r,...n){let o=Fe;Fe=e||B;try{return t.call(r,...n)}finally{Fe=o}},bind:function(e,t){return typeof t=="function"?Ct(t,this,e):t},enable:function(){if(ai)return this;let e=this;return Pt(window,"setTimeout",t=>function(...r){let n=Number(r[1]);return(isNaN(n)||n<=50)&&(r[0]=Ct(r[0],e,e.active())),t.apply(this,r)}),Pt(window,"setImmediate",t=>function(...r){return r[0]=Ct(r[0],e,e.active()),t.apply(this,r)}),vm(e),window.Promise&&Im(e),Fe=B,ai=!0,e},disable:function(){return ai&&(it(window,"setTimeout"),it(window,"setImmediate"),Dm(),window.Promise&&Mm(),Fe=B,ai=!1),this}};function Ct(e,t,r){if(typeof e!="function")return e;let n=r||t.active();function o(...i){return t.with(n,()=>e.apply(this,i))}return Object.defineProperty(o,"length",{enumerable:!1,configurable:!0,writable:!1,value:e.length}),o}function Im(e){Pt(Promise.prototype,"then",t=>function(r,n){return t.call(this,Ct(r,e,e.active()),Ct(n,e,e.active()))}),Pt(Promise.prototype,"catch",t=>function(r){return t.call(this,Ct(r,e,e.active()))}),Pt(Promise.prototype,"finally",t=>function(r){return t.call(this,Ct(r,e,e.active()))})}function Mm(){it(Promise.prototype,"then"),it(Promise.prototype,"catch"),it(Promise.prototype,"finally")}var Cl=["onreadystatechange"],$t=globalThis.XMLHttpRequest.prototype,Pl=["onabort","onerror","onload","onloadend","onloadstart","onprogress","ontimeout"],ci=globalThis.XMLHttpRequestEventTarget.prototype;function vm(e){Pt($t,"addEventListener",function(t){return function(...r){let n=this;if(typeof r[1]=="function"){n.__bound=n.__bound||new Map;let o=r[1],i=n.__bound.get(o);r[1]=i||Ct(o,e,e.active()),n.__bound.set(o,r[1])}return t.apply(n,r)}}),Pt($t,"removeEventListener",function(t){return function(...r){let n=this;if(typeof r[1]=="function"){let o=r[1],i=n.__bound?.get(o);i&&(r[1]=i)}return t.apply(n,r)}});for(let t of Cl){let r=Object.getOwnPropertyDescriptor($t,t);r&&(Nl(r,e),Object.defineProperty($t,t,r))}for(let t of Pl){let r=Object.getOwnPropertyDescriptor(ci,t);r&&(Nl(r,e),Object.defineProperty(ci,t,r))}}function Dm(){it($t,"addEventListener"),it($t,"removeEventListener");for(let e of Cl){let t=Object.getOwnPropertyDescriptor($t,e);t&&(it(t,"set"),it(t,"get"),Object.defineProperty($t,e,t))}for(let e of Pl){let t=Object.getOwnPropertyDescriptor(ci,e);t&&(it(t,"set"),it(t,"get"),Object.defineProperty(ci,e,t))}}function Pt(e,t,r){if(!e||!e[t]){ne.warn("no original function "+String(t)+" to wrap");return}if(!r){ne.warn("no wrapper function"),ne.warn(new Error().stack);return}let n=e[t];if(typeof n!="function"||typeof r!="function"){ne.warn("original object and wrapper must be functions");return}let o=r(n,t);return typeof n.toString=="function"&&(o.toString=n.toString.bind(n)),en(o,"__original",n),en(o,"__unwrap",()=>{e[t]===o&&en(e,t,n)}),en(o,"__wrapped",!0),en(e,t,o),o}function it(e,t){if(!e||!e[t]){ne.warn("no function to unwrap."),ne.warn(new Error().stack);return}let r=e[t];if(!r.__unwrap)ne.warn(`no original to unwrap to -- has ${String(t)} already been unwrapped?`);else{r.__unwrap();return}}function Nl(e,t){Pt(e,"set",function(r){return function(n){if(typeof n=="function"){let o=n;n=Ct(o,t,t.active()),n.__original=o}return r.call(this,n)}}),Pt(e,"get",function(r){return function(){let n=r.call(this);return typeof n=="function"&&n.__original?n.__original:n}})}function en(e,t,r){let n=!!e[t]&&Object.prototype.propertyIsEnumerable.call(e,t);Object.defineProperty(e,t,{configurable:!0,enumerable:n,writable:!0,value:r})}var Il="browser.brands",Ml="browser.language",vl="browser.mobile",Dl="browser.platform";var Ul="user_agent.original";var Bl="0.3.0";function Gl(e,t,r){typeof t=="string"&&t&&(e["service.name"]=t),typeof r=="string"&&r&&(e["service.version"]=r);let{userAgent:n,userAgentData:o}=navigator,i=Bm(n),s;return o?(s={name:o.platform,version:""},e[Il]=o.brands.map(a=>`${a.brand} ${a.version}`)):s=Um(n),i&&(e["browser.name"]=i.name,i.version&&(e["browser.version"]=i.version)),s&&(e[Dl]=s.name),e[vl]=navigator.userAgent.includes("Mobi"),e[Ml]=navigator.language,e[Ul]=n,e["telemetry.distro.name"]="elastic",e["telemetry.distro.version"]=Bl,Kn({...e,...Bt})}function Um(e){let t=[["Symbian",[/SymbianOS\/([\w\.]+)/i]],["Windows Phone",[/Windows Phone ([\w\.]+)/i]],["Xbox",[/Xbox?/i]],["Windows",[/Windows (\d+)/i]],["Windows RT",[/Windows NT ([\w\.]+).+ARM;/i]],["Windows",[/Windows NT (\d+\.\d+)/i]],["Windows IoT",[/Windows IoT (\d+\.\d+)/i]],["iOS",[/iPhone OS (\d+(_\d+)*)/i,/iPad;.+CPU OS (\d+(_\d+)*)/i]],["macOS",[/Mac OS (\d+(_\d+)*)/i,/Mac OS X ([\w\.]+)/i,/Intel Mac OS X/]],["Ubuntu Touch",[/Ubuntu ([\w\.]+).+Mobile/i]],["Android",[/Android ([\w\.]+)/i,/Android;/i]],["Linux",[/Linux ([\w_]+)/i,/Linux;/]]];for(let r of t){let[n,o]=r;for(let i of o){let s=i.exec(e);if(s){let a;return s[1]&&(a=s[1].replaceAll("_",".")),{name:n,version:a}}}}}function Bm(e){let t=[["AliPay",[/AliPayClient\/([\w\.]+)/i]],["Baidu",[/bd(?:browser|spark)\/([\w\.]+)/i,/baidu(?:boxapp|hd)\/([\w\.]+)/i,/BIDUBrowser\/([\w\.]+)/i]],["Bing",[/Bing(?:Web|Sapphire)\/([\w\.]+)/i]],["Camino",[/Camino\/([\w\.]+)/i]],["Coc Coc",[/coc_coc_browser\/([\w\.]+)/i]],["Dragon",[/(?:Dragon|Comodo_Dragon)\/([\w\.]+)/i]],["DuckDuckGo",[/(?:Ddg|DuckDuckGo)\/([\w\.]+)/i]],["Electron",[/Electron\/([\w\.]+)/i]],["Facebook",[/;fbav\/([\w\.]+);/i,/(?:fban\/fbios|fb_iab\/fb4a)/i]],["GSA",[/GSA\/([\w\.]+)/i]],["Huawei Browser",[/HuaweiBrowser\/([\w\.]+)/i]],["Iron",[/(?:Iron|Iron Safari)\/([\w\.]+)/i]],["LG Browser",[/LG Browser\/([\w\.]+)/i]],["Lunascape",[/Lunascape\/([\w\.]+)/i]],["Maxthon",[/Maxthon\/([\w\.]+)/i,/Mx(?:Browser|iOS)\/([\w\.]+)/i]],["MIUI Browser",[/MiuiBrowser\/([\w\.]+)/i]],["NokiaBrowser",[/NokiaBrowser\/([\w\.]+)/i]],["Oculus Browser",[/OculusBrowser\/([\w\.]+)/i]],["Pico Browser",[/PicoBrowser\/([\w\.]+)/i]],["Qwant",[/Qwant(?:Mobile|Browser|iOS)\/([\w\.]+)/i]],["Samsung Internet",[/SamsungBrowser\/([\w\.]+)/i]],["Silk",[/Silk\/([\w\.]+)/i]],["Smart Lenovo Browser",[/SLBrowser\/([\w\.]+)/i]],["Snapchat",[/Snapchat\/([\w\.]+)/i]],["Steam",[/Valve Steam/i]],["TikTok",[/musical_ly.+app_version\/([\w\.]+)/i]],["Twitter",[/Twitter/i]],["Vivaldi",[/Vivaldi\/([\w\.]+)/i]],["Yandex",[/Ya(?:SearchBrowser|Browser)\/([\w\.]+)/i]],["WeChat",[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i]],["QQBrowser",[/M?QQbrowser\/([\w\.]+)/i]],["Brave",[/Brave\/([\w\.]+)/i]],["Edge",[/(?:Edg|Edge|EdgA|EdgW|EdgiOS)\/([\w\.]+)/i]],["Opera",[/(?:OPR|OPT|OPiOS|Opera)\/([\w\.]+)/i,/Coast\/([\w\.]+)/i]],["Chromium",[/Chromium\/([\w\.]+)/i]],["Chrome Headless",[/HeadlessChrome\/([\w\.]+)/i,/HeadlessChrome Safari\/([\w\.]+)/i]],["Chrome",[/Chrome\/([\w\.]+)/i,/Cr(?:iOS|Mo)\/([\w\.]+)/i]],["Android Browser",[/Android \d.+Safari\/([\w\.]+)/i]],["Firefox",[/(?:Firefox|FxiOS)\/([\w\.]+)/i]],["Safari",[/Safari\/([\w\.]+)/i]]];for(let r of t){let[n,o]=r;for(let i of o){let s=i.exec(e);if(s){let a;return s[1]&&(a=s[1].replaceAll("_",".")),{name:n,version:a}}}}}var Hl=!1,Vl={logLevel:"info",sampleRate:1,serviceName:"unknown_service:web",resourceAttributes:{},otlpEndpoint:"http://localhost:4318",exportHeaders:{}};function kl(e={}){if(Hl||e.disabled)return;let t=e.logLevel??Vl.logLevel;l.setLogger(si({logLevel:t}),{logLevel:O.ALL}),l.debug("Browser SDK intialization",e);let{serviceName:r,serviceVersion:n}=e,o={...Vl,...e},i;try{i=new URL(o.otlpEndpoint)}catch{l.error(`The value "${o.otlpEndpoint}" for "otlpEndpoint" configuration is not an URL. SDK won't start.`);return}let s=Gl(o.resourceAttributes,r,n),a=ea(i,"v1/traces").href,c=new Me(new Ne({url:a,headers:o.exportHeaders})),u=new Pr({resource:s,sampler:new Ft(o.sampleRate),spanProcessors:[c]});u.register({contextManager:yl});let p=ea(i,"v1/metrics").href,m=new xr({exporter:new we({url:p,headers:o.exportHeaders})}),f=new Lr({resource:s,readers:[m]});xt.setGlobalMeterProvider(f);let _=ea(i,"v1/logs").href,d=new ye(new be({url:_,headers:o.exportHeaders})),h=new yr({resource:s,processors:[d]});Dt.setGlobalLoggerProvider(h);let g={"@opentelemetry/instrumentation-browser-navigation":x=>new Ur(x),"@opentelemetry/instrumentation-document-load":x=>new Gr(x),"@opentelemetry/instrumentation-fetch":x=>new kr(x),"@opentelemetry/instrumentation-long-task":x=>new Fr(x),"@opentelemetry/instrumentation-user-interaction":x=>new zr(x),"@opentelemetry/instrumentation-xml-http-request":x=>new Wr(x),"@opentelemetry/instrumentation-web-exception":x=>new jr(x),"@opentelemetry/instrumentation-web-vitals":x=>new ta(x)},L={semconvStabilityOptIn:"http"},$=o.instrumentations||{},V=[];for(let x of Object.keys(g)){let It=$[x];(x==="@opentelemetry/instrumentation-fetch"||x==="@opentelemetry/instrumentation-xml-http-request")&&(It={...L,...It}),It?.enabled===!1||V.push(g[x](It))}return Cs({instrumentations:V}),Hl=!0,{forceFlush(){return Promise.all([u.forceFlush(),f.forceFlush(),h.forceFlush()]).then(()=>{})}}}function ea(e,t){let r=new URL(e.href);return r.pathname=(r.pathname+t).replace("//","/"),r}globalThis.startBrowserSdk=kl;})();
|
|
14
14
|
//# sourceMappingURL=elastic-otel-browser.min.js.map
|