@vercel/otel 2.1.0 → 2.1.1

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.
@@ -20,5 +20,5 @@ import{a as N,b as qe,c as _,d as xP,e as Gi,f as Re,g as R,h as E,i as m}from".
20
20
  To resolve the conflict:`,(0,ii.getConflictResolutionRecipe)(s,e))),n=o):OR.diag.warn("A view or instrument with the name ",e.name,` has already been registered and is incompatible with another registered view.
21
21
  `,`Details:
22
22
  `,(0,ii.getIncompatibilityDetails)(s,e),`To resolve the conflict:
23
- `,(0,ii.getConflictResolutionRecipe)(s,e))}return n}};ai.MetricStorageRegistry=Ou});var MR=_(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});ci.MultiMetricStorage=void 0;var Pu=class{_backingStorages;constructor(e){this._backingStorages=e}record(e,t,n,o){this._backingStorages.forEach(s=>{s.record(e,t,n,o)})}};ci.MultiMetricStorage=Pu});var CR=_(Vr=>{"use strict";Object.defineProperty(Vr,"__esModule",{value:!0});Vr.BatchObservableResultImpl=Vr.ObservableResultImpl=void 0;var wr=(m(),R(E)),NR=bn(),JH=Zs(),Mu=class{_instrumentName;_valueType;_buffer=new NR.AttributeHashMap;constructor(e,t){this._instrumentName=e,this._valueType=t}observe(e,t={}){if(typeof e!="number"){wr.diag.warn(`non-number value provided to metric ${this._instrumentName}: ${e}`);return}this._valueType===wr.ValueType.INT&&!Number.isInteger(e)&&(wr.diag.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._buffer.set(t,e)}};Vr.ObservableResultImpl=Mu;var Nu=class{_buffer=new Map;observe(e,t,n={}){if(!(0,JH.isObservableInstrument)(e))return;let o=this._buffer.get(e);if(o==null&&(o=new NR.AttributeHashMap,this._buffer.set(e,o)),typeof t!="number"){wr.diag.warn(`non-number value provided to metric ${e._descriptor.name}: ${t}`);return}e._descriptor.valueType===wr.ValueType.INT&&!Number.isInteger(t)&&(wr.diag.warn(`INT value type cannot accept a floating-point value for ${e._descriptor.name}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||o.set(n,t)}};Vr.BatchObservableResultImpl=Nu});var bR=_(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.ObservableRegistry=void 0;var ZH=(m(),R(E)),LR=Zs(),IR=CR(),yn=we(),Cu=class{_callbacks=[];_batchCallbacks=[];addCallback(e,t){this._findCallback(e,t)>=0||this._callbacks.push({callback:e,instrument:t})}removeCallback(e,t){let n=this._findCallback(e,t);n<0||this._callbacks.splice(n,1)}addBatchCallback(e,t){let n=new Set(t.filter(LR.isObservableInstrument));if(n.size===0){ZH.diag.error("BatchObservableCallback is not associated with valid instruments",t);return}this._findBatchCallback(e,n)>=0||this._batchCallbacks.push({callback:e,instruments:n})}removeBatchCallback(e,t){let n=new Set(t.filter(LR.isObservableInstrument)),o=this._findBatchCallback(e,n);o<0||this._batchCallbacks.splice(o,1)}async observe(e,t){let n=this._observeCallbacks(e,t),o=this._observeBatchCallbacks(e,t);return(await(0,yn.PromiseAllSettled)([...n,...o])).filter(yn.isPromiseAllSettledRejectionResult).map(a=>a.reason)}_observeCallbacks(e,t){return this._callbacks.map(async({callback:n,instrument:o})=>{let s=new IR.ObservableResultImpl(o._descriptor.name,o._descriptor.valueType),i=Promise.resolve(n(s));t!=null&&(i=(0,yn.callWithTimeout)(i,t)),await i,o._metricStorages.forEach(a=>{a.record(s._buffer,e)})})}_observeBatchCallbacks(e,t){return this._batchCallbacks.map(async({callback:n,instruments:o})=>{let s=new IR.BatchObservableResultImpl,i=Promise.resolve(n(s));t!=null&&(i=(0,yn.callWithTimeout)(i,t)),await i,o.forEach(a=>{let c=s._buffer.get(a);c!=null&&a._metricStorages.forEach(u=>{u.record(c,e)})})})}_findCallback(e,t){return this._callbacks.findIndex(n=>n.callback===e&&n.instrument===t)}_findBatchCallback(e,t){return this._batchCallbacks.findIndex(n=>n.callback===e&&(0,yn.setEquals)(n.instruments,t))}};ui.ObservableRegistry=Cu});var yR=_(_i=>{"use strict";Object.defineProperty(_i,"__esModule",{value:!0});_i.SyncMetricStorage=void 0;var eF=Tu(),tF=hu(),rF=gu(),Lu=class extends eF.MetricStorage{_attributesProcessor;_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;constructor(e,t,n,o,s){super(e),this._attributesProcessor=n,this._aggregationCardinalityLimit=s,this._deltaMetricStorage=new tF.DeltaMetricProcessor(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new rF.TemporalMetricProcessor(t,o)}record(e,t,n,o){t=this._attributesProcessor.process(t,n),this._deltaMetricStorage.record(e,t,n,o)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}};_i.SyncMetricStorage=Lu});var li=_(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.createDenyListAttributesProcessor=Ze.createAllowListAttributesProcessor=Ze.createMultiAttributesProcessor=Ze.createNoopAttributesProcessor=void 0;var Iu=class{process(e,t){return e}},bu=class{_processors;constructor(e){this._processors=e}process(e,t){let n=e;for(let o of this._processors)n=o.process(n,t);return n}},yu=class{_allowedAttributeNames;constructor(e){this._allowedAttributeNames=e}process(e,t){let n={};return Object.keys(e).filter(o=>this._allowedAttributeNames.includes(o)).forEach(o=>n[o]=e[o]),n}},vu=class{_deniedAttributeNames;constructor(e){this._deniedAttributeNames=e}process(e,t){let n={};return Object.keys(e).filter(o=>!this._deniedAttributeNames.includes(o)).forEach(o=>n[o]=e[o]),n}};function nF(){return aF}Ze.createNoopAttributesProcessor=nF;function oF(r){return new bu(r)}Ze.createMultiAttributesProcessor=oF;function sF(r){return new yu(r)}Ze.createAllowListAttributesProcessor=sF;function iF(r){return new vu(r)}Ze.createDenyListAttributesProcessor=iF;var aF=new Iu});var vR=_(Ei=>{"use strict";Object.defineProperty(Ei,"__esModule",{value:!0});Ei.MeterSharedState=void 0;var cF=In(),uF=SR(),_F=we(),lF=fR(),EF=PR(),pF=MR(),dF=bR(),TF=yR(),SF=li(),xu=class{_meterProviderSharedState;_instrumentationScope;metricStorageRegistry=new EF.MetricStorageRegistry;observableRegistry=new dF.ObservableRegistry;meter;constructor(e,t){this._meterProviderSharedState=e,this._instrumentationScope=t,this.meter=new uF.Meter(this)}registerMetricStorage(e){let t=this._registerMetricStorage(e,TF.SyncMetricStorage);return t.length===1?t[0]:new pF.MultiMetricStorage(t)}registerAsyncMetricStorage(e){return this._registerMetricStorage(e,lF.AsyncMetricStorage)}async collect(e,t,n){let o=await this.observableRegistry.observe(t,n?.timeoutMillis),s=this.metricStorageRegistry.getStorages(e);if(s.length===0)return null;let i=s.map(a=>a.collect(e,t)).filter(_F.isNotNullish);return i.length===0?{errors:o}:{scopeMetrics:{scope:this._instrumentationScope,metrics:i},errors:o}}_registerMetricStorage(e,t){let o=this._meterProviderSharedState.viewRegistry.findViews(e,this._instrumentationScope).map(s=>{let i=(0,cF.createInstrumentDescriptorWithView)(s,e),a=this.metricStorageRegistry.findOrUpdateCompatibleStorage(i);if(a!=null)return a;let c=s.aggregation.createAggregator(i),u=new t(i,c,s.attributesProcessor,this._meterProviderSharedState.metricCollectors,s.aggregationCardinalityLimit);return this.metricStorageRegistry.register(u),u});if(o.length===0){let i=this._meterProviderSharedState.selectAggregations(e.type).map(([a,c])=>{let u=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(a,e);if(u!=null)return u;let l=c.createAggregator(e),p=a.selectCardinalityLimit(e.type),T=new t(e,l,(0,SF.createNoopAttributesProcessor)(),[a],p);return this.metricStorageRegistry.registerForCollector(a,T),T});o=o.concat(i)}return o}};Ei.MeterSharedState=xu});var xR=_(pi=>{"use strict";Object.defineProperty(pi,"__esModule",{value:!0});pi.MeterProviderSharedState=void 0;var fF=we(),AF=pR(),hF=vR(),mF=Cn(),Du=class{resource;viewRegistry=new AF.ViewRegistry;metricCollectors=[];meterSharedStates=new Map;constructor(e){this.resource=e}getMeterSharedState(e){let t=(0,fF.instrumentationScopeId)(e),n=this.meterSharedStates.get(t);return n==null&&(n=new hF.MeterSharedState(this,e),this.meterSharedStates.set(t,n)),n}selectAggregations(e){let t=[];for(let n of this.metricCollectors)t.push([n,(0,mF.toAggregation)(n.selectAggregation(e))]);return t}};pi.MeterProviderSharedState=Du});var DR=_(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});di.MetricCollector=void 0;var gF=y(),Uu=class{_sharedState;_metricReader;constructor(e,t){this._sharedState=e,this._metricReader=t}async collect(e){let t=(0,gF.millisToHrTime)(Date.now()),n=[],o=[],s=Array.from(this._sharedState.meterSharedStates.values()).map(async i=>{let a=await i.collect(this,t,e);a?.scopeMetrics!=null&&n.push(a.scopeMetrics),a?.errors!=null&&o.push(...a.errors)});return await Promise.all(s),{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:n},errors:o}}async forceFlush(e){await this._metricReader.forceFlush(e)}async shutdown(e){await this._metricReader.shutdown(e)}selectAggregationTemporality(e){return this._metricReader.selectAggregationTemporality(e)}selectAggregation(e){return this._metricReader.selectAggregation(e)}selectCardinalityLimit(e){return this._metricReader.selectCardinalityLimit?.(e)??2e3}};di.MetricCollector=Uu});var Ti=_(Br=>{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});Br.ExactPredicate=Br.PatternPredicate=void 0;var RF=/[\^$\\.+?()[\]{}|]/g,wu=class r{_matchAll;_regexp;constructor(e){e==="*"?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(r.escapePattern(e)))}match(e){return this._matchAll?!0:this._regexp.test(e)}static escapePattern(e){return`^${e.replace(RF,"\\$&").replace("*",".*")}$`}static hasWildcard(e){return e.includes("*")}};Br.PatternPredicate=wu;var Vu=class{_matchAll;_pattern;constructor(e){this._matchAll=e===void 0,this._pattern=e}match(e){return!!(this._matchAll||e===this._pattern)}};Br.ExactPredicate=Vu});var wR=_(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.InstrumentSelector=void 0;var UR=Ti(),Bu=class{_nameFilter;_type;_unitFilter;constructor(e){this._nameFilter=new UR.PatternPredicate(e?.name??"*"),this._type=e?.type,this._unitFilter=new UR.ExactPredicate(e?.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}};Si.InstrumentSelector=Bu});var VR=_(fi=>{"use strict";Object.defineProperty(fi,"__esModule",{value:!0});fi.MeterSelector=void 0;var Gu=Ti(),Hu=class{_nameFilter;_versionFilter;_schemaUrlFilter;constructor(e){this._nameFilter=new Gu.ExactPredicate(e?.name),this._versionFilter=new Gu.ExactPredicate(e?.version),this._schemaUrlFilter=new Gu.ExactPredicate(e?.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}};fi.MeterSelector=Hu});var HR=_(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});Ai.View=void 0;var OF=Ti(),BR=li(),PF=wR(),MF=VR(),GR=Cn();function NF(r){return r.instrumentName==null&&r.instrumentType==null&&r.instrumentUnit==null&&r.meterName==null&&r.meterVersion==null&&r.meterSchemaUrl==null}function CF(r){if(NF(r))throw new Error("Cannot create view with no selector arguments supplied");if(r.name!=null&&(r?.instrumentName==null||OF.PatternPredicate.hasWildcard(r.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 Fu=class{name;description;aggregation;attributesProcessor;instrumentSelector;meterSelector;aggregationCardinalityLimit;constructor(e){CF(e),e.attributesProcessors!=null?this.attributesProcessor=(0,BR.createMultiAttributesProcessor)(e.attributesProcessors):this.attributesProcessor=(0,BR.createNoopAttributesProcessor)(),this.name=e.name,this.description=e.description,this.aggregation=(0,GR.toAggregation)(e.aggregation??{type:GR.AggregationType.DEFAULT}),this.instrumentSelector=new PF.InstrumentSelector({name:e.instrumentName,type:e.instrumentType,unit:e.instrumentUnit}),this.meterSelector=new MF.MeterSelector({name:e.meterName,version:e.meterVersion,schemaUrl:e.meterSchemaUrl}),this.aggregationCardinalityLimit=e.aggregationCardinalityLimit}};Ai.View=Fu});var FR=_(mi=>{"use strict";Object.defineProperty(mi,"__esModule",{value:!0});mi.MeterProvider=void 0;var hi=(m(),R(E)),LF=sn(),IF=xR(),bF=DR(),yF=HR(),qu=class{_sharedState;_shutdown=!1;constructor(e){if(this._sharedState=new IF.MeterProviderSharedState(e?.resource??(0,LF.defaultResource)()),e?.views!=null&&e.views.length>0)for(let t of e.views)this._sharedState.viewRegistry.addView(new yF.View(t));if(e?.readers!=null&&e.readers.length>0)for(let t of e.readers){let n=new bF.MetricCollector(this._sharedState,t);t.setMetricProducer(n),this._sharedState.metricCollectors.push(n)}}getMeter(e,t="",n={}){return this._shutdown?(hi.diag.warn("A shutdown MeterProvider cannot provide a Meter"),(0,hi.createNoopMeter)()):this._sharedState.getMeterSharedState({name:e,version:t,schemaUrl:n.schemaUrl}).meter}async shutdown(e){if(this._shutdown){hi.diag.warn("shutdown may only be called once per MeterProvider");return}this._shutdown=!0,await Promise.all(this._sharedState.metricCollectors.map(t=>t.shutdown(e)))}async forceFlush(e){if(this._shutdown){hi.diag.warn("invalid attempt to force flush after MeterProvider shutdown");return}await Promise.all(this._sharedState.metricCollectors.map(t=>t.forceFlush(e)))}};mi.MeterProvider=qu});var kR=_(w=>{"use strict";Object.defineProperty(w,"__esModule",{value:!0});w.TimeoutError=w.createDenyListAttributesProcessor=w.createAllowListAttributesProcessor=w.AggregationType=w.MeterProvider=w.ConsoleMetricExporter=w.InMemoryMetricExporter=w.PeriodicExportingMetricReader=w.MetricReader=w.InstrumentType=w.DataPointType=w.AggregationTemporality=void 0;var vF=Is();Object.defineProperty(w,"AggregationTemporality",{enumerable:!0,get:function(){return vF.AggregationTemporality}});var qR=ft();Object.defineProperty(w,"DataPointType",{enumerable:!0,get:function(){return qR.DataPointType}});Object.defineProperty(w,"InstrumentType",{enumerable:!0,get:function(){return qR.InstrumentType}});var xF=eu();Object.defineProperty(w,"MetricReader",{enumerable:!0,get:function(){return xF.MetricReader}});var DF=cR();Object.defineProperty(w,"PeriodicExportingMetricReader",{enumerable:!0,get:function(){return DF.PeriodicExportingMetricReader}});var UF=_R();Object.defineProperty(w,"InMemoryMetricExporter",{enumerable:!0,get:function(){return UF.InMemoryMetricExporter}});var wF=ER();Object.defineProperty(w,"ConsoleMetricExporter",{enumerable:!0,get:function(){return wF.ConsoleMetricExporter}});var VF=FR();Object.defineProperty(w,"MeterProvider",{enumerable:!0,get:function(){return VF.MeterProvider}});var BF=Cn();Object.defineProperty(w,"AggregationType",{enumerable:!0,get:function(){return BF.AggregationType}});var jR=li();Object.defineProperty(w,"createAllowListAttributesProcessor",{enumerable:!0,get:function(){return jR.createAllowListAttributesProcessor}});Object.defineProperty(w,"createDenyListAttributesProcessor",{enumerable:!0,get:function(){return jR.createDenyListAttributesProcessor}});var GF=we();Object.defineProperty(w,"TimeoutError",{enumerable:!0,get:function(){return GF.TimeoutError}})});var ku=_(gi=>{"use strict";Object.defineProperty(gi,"__esModule",{value:!0});gi.AbstractAsyncHooksContextManager=void 0;var HF=N("events"),FF=["addListener","on","once","prependListener","prependOnceListener"],ju=class{bind(e,t){return t instanceof HF.EventEmitter?this._bindEventEmitter(e,t):typeof t=="function"?this._bindFunction(e,t):t}_bindFunction(e,t){let n=this,o=function(...s){return n.with(e,()=>t.apply(this,s))};return Object.defineProperty(o,"length",{enumerable:!1,configurable:!0,writable:!1,value:t.length}),o}_bindEventEmitter(e,t){return this._getPatchMap(t)!==void 0||(this._createPatchMap(t),FF.forEach(o=>{t[o]!==void 0&&(t[o]=this._patchAddListener(t,t[o],e))}),typeof t.removeListener=="function"&&(t.removeListener=this._patchRemoveListener(t,t.removeListener)),typeof t.off=="function"&&(t.off=this._patchRemoveListener(t,t.off)),typeof t.removeAllListeners=="function"&&(t.removeAllListeners=this._patchRemoveAllListeners(t,t.removeAllListeners))),t}_patchRemoveListener(e,t){let n=this;return function(o,s){let i=n._getPatchMap(e)?.[o];if(i===void 0)return t.call(this,o,s);let a=i.get(s);return t.call(this,o,a||s)}}_patchRemoveAllListeners(e,t){let n=this;return function(o){let s=n._getPatchMap(e);return s!==void 0&&(arguments.length===0?n._createPatchMap(e):s[o]!==void 0&&delete s[o]),t.apply(this,arguments)}}_patchAddListener(e,t,n){let o=this;return function(s,i){if(o._wrapped)return t.call(this,s,i);let a=o._getPatchMap(e);a===void 0&&(a=o._createPatchMap(e));let c=a[s];c===void 0&&(c=new WeakMap,a[s]=c);let u=o.bind(n,i);c.set(i,u),o._wrapped=!0;try{return t.call(this,s,u)}finally{o._wrapped=!1}}}_createPatchMap(e){let t=Object.create(null);return e[this._kOtListeners]=t,t}_getPatchMap(e){return e[this._kOtListeners]}_kOtListeners=Symbol("OtListeners");_wrapped=!1};gi.AbstractAsyncHooksContextManager=ju});var YR=_(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});Ri.AsyncHooksContextManager=void 0;var qF=(m(),R(E)),jF=N("async_hooks"),kF=ku(),Yu=class extends kF.AbstractAsyncHooksContextManager{_asyncHook;_contexts=new Map;_stack=[];constructor(){super(),this._asyncHook=jF.createHook({init:this._init.bind(this),before:this._before.bind(this),after:this._after.bind(this),destroy:this._destroy.bind(this),promiseResolve:this._destroy.bind(this)})}active(){return this._stack[this._stack.length-1]??qF.ROOT_CONTEXT}with(e,t,n,...o){this._enterContext(e);try{return t.call(n,...o)}finally{this._exitContext()}}enable(){return this._asyncHook.enable(),this}disable(){return this._asyncHook.disable(),this._contexts.clear(),this._stack=[],this}_init(e,t){if(t==="TIMERWRAP")return;let n=this._stack[this._stack.length-1];n!==void 0&&this._contexts.set(e,n)}_destroy(e){this._contexts.delete(e)}_before(e){let t=this._contexts.get(e);t!==void 0&&this._enterContext(t)}_after(){this._exitContext()}_enterContext(e){this._stack.push(e)}_exitContext(){this._stack.pop()}};Ri.AsyncHooksContextManager=Yu});var $R=_(Oi=>{"use strict";Object.defineProperty(Oi,"__esModule",{value:!0});Oi.AsyncLocalStorageContextManager=void 0;var YF=(m(),R(E)),$F=N("async_hooks"),KF=ku(),$u=class extends KF.AbstractAsyncHooksContextManager{_asyncLocalStorage;constructor(){super(),this._asyncLocalStorage=new $F.AsyncLocalStorage}active(){return this._asyncLocalStorage.getStore()??YF.ROOT_CONTEXT}with(e,t,n,...o){let s=n==null?t:t.bind(n);return this._asyncLocalStorage.run(e,s,...o)}enable(){return this}disable(){return this._asyncLocalStorage.disable(),this}};Oi.AsyncLocalStorageContextManager=$u});var KR=_(Gr=>{"use strict";Object.defineProperty(Gr,"__esModule",{value:!0});Gr.AsyncLocalStorageContextManager=Gr.AsyncHooksContextManager=void 0;var WF=YR();Object.defineProperty(Gr,"AsyncHooksContextManager",{enumerable:!0,get:function(){return WF.AsyncHooksContextManager}});var zF=$R();Object.defineProperty(Gr,"AsyncLocalStorageContextManager",{enumerable:!0,get:function(){return zF.AsyncLocalStorageContextManager}})});var iO=_(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.toAnyValue=be.toKeyValue=be.toAttributes=be.createInstrumentationScope=be.createResource=void 0;function tq(r){let e={attributes:sO(r.attributes),droppedAttributesCount:0},t=r.schemaUrl;return t&&t!==""&&(e.schemaUrl=t),e}be.createResource=tq;function rq(r){return{name:r.name,version:r.version}}be.createInstrumentationScope=rq;function sO(r){return Object.keys(r).map(e=>Xu(e,r[e]))}be.toAttributes=sO;function Xu(r,e){return{key:r,value:Qu(e)}}be.toKeyValue=Xu;function Qu(r){let e=typeof r;return e==="string"?{stringValue:r}:e==="number"?Number.isInteger(r)?{intValue:r}:{doubleValue:r}:e==="boolean"?{boolValue:r}:r instanceof Uint8Array?{bytesValue:r}:Array.isArray(r)?{arrayValue:{values:r.map(Qu)}}:e==="object"&&r!=null?{kvlistValue:{values:Object.entries(r).map(([t,n])=>Xu(t,n))}}:{}}be.toAnyValue=Qu});var cO=_(Ci=>{"use strict";Object.defineProperty(Ci,"__esModule",{value:!0});Ci.hexToBinary=void 0;function aO(r){return r>=48&&r<=57?r-48:r>=97&&r<=102?r-87:r-55}function nq(r){let e=new Uint8Array(r.length/2),t=0;for(let n=0;n<r.length;n+=2){let o=aO(r.charCodeAt(n)),s=aO(r.charCodeAt(n+1));e[t++]=o<<4|s}return e}Ci.hexToBinary=nq});var pO=_(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.getOtlpEncoder=ye.encodeAsString=ye.encodeAsLongBits=ye.toLongBits=ye.hrTimeToNanos=void 0;var oq=y(),Ju=cO();function Zu(r){let e=BigInt(1e9);return BigInt(r[0])*e+BigInt(r[1])}ye.hrTimeToNanos=Zu;function _O(r){let e=Number(BigInt.asUintN(32,r)),t=Number(BigInt.asUintN(32,r>>BigInt(32)));return{low:e,high:t}}ye.toLongBits=_O;function e_(r){let e=Zu(r);return _O(e)}ye.encodeAsLongBits=e_;function lO(r){return Zu(r).toString()}ye.encodeAsString=lO;var sq=typeof BigInt<"u"?lO:oq.hrTimeToNanoseconds;function uO(r){return r}function EO(r){if(r!==void 0)return(0,Ju.hexToBinary)(r)}var iq={encodeHrTime:e_,encodeSpanContext:Ju.hexToBinary,encodeOptionalSpanContext:EO};function aq(r){if(r===void 0)return iq;let e=r.useLongBits??!0,t=r.useHex??!1;return{encodeHrTime:e?e_:sq,encodeSpanContext:t?uO:Ju.hexToBinary,encodeOptionalSpanContext:t?uO:EO}}ye.getOtlpEncoder=aq});var t_=_(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.createExportTraceServiceRequest=et.toOtlpSpanEvent=et.toOtlpLink=et.sdkSpanToOtlpSpan=void 0;var vn=iO(),cq=pO();function dO(r,e){let t=r.spanContext(),n=r.status,o=r.parentSpanContext?.spanId?e.encodeSpanContext(r.parentSpanContext?.spanId):void 0;return{traceId:e.encodeSpanContext(t.traceId),spanId:e.encodeSpanContext(t.spanId),parentSpanId:o,traceState:t.traceState?.serialize(),name:r.name,kind:r.kind==null?0:r.kind+1,startTimeUnixNano:e.encodeHrTime(r.startTime),endTimeUnixNano:e.encodeHrTime(r.endTime),attributes:(0,vn.toAttributes)(r.attributes),droppedAttributesCount:r.droppedAttributesCount,events:r.events.map(s=>SO(s,e)),droppedEventsCount:r.droppedEventsCount,status:{code:n.code,message:n.message},links:r.links.map(s=>TO(s,e)),droppedLinksCount:r.droppedLinksCount}}et.sdkSpanToOtlpSpan=dO;function TO(r,e){return{attributes:r.attributes?(0,vn.toAttributes)(r.attributes):[],spanId:e.encodeSpanContext(r.context.spanId),traceId:e.encodeSpanContext(r.context.traceId),traceState:r.context.traceState?.serialize(),droppedAttributesCount:r.droppedAttributesCount||0}}et.toOtlpLink=TO;function SO(r,e){return{attributes:r.attributes?(0,vn.toAttributes)(r.attributes):[],name:r.name,timeUnixNano:e.encodeHrTime(r.time),droppedAttributesCount:r.droppedAttributesCount||0}}et.toOtlpSpanEvent=SO;function uq(r,e){let t=(0,cq.getOtlpEncoder)(e);return{resourceSpans:lq(r,t)}}et.createExportTraceServiceRequest=uq;function _q(r){let e=new Map;for(let t of r){let n=e.get(t.resource);n||(n=new Map,e.set(t.resource,n));let o=`${t.instrumentationScope.name}@${t.instrumentationScope.version||""}:${t.instrumentationScope.schemaUrl||""}`,s=n.get(o);s||(s=[],n.set(o,s)),s.push(t)}return e}function lq(r,e){let t=_q(r),n=[],o=t.entries(),s=o.next();for(;!s.done;){let[i,a]=s.value,c=[],u=a.values(),l=u.next();for(;!l.done;){let A=l.value;if(A.length>0){let M=A.map(g=>dO(g,e));c.push({scope:(0,vn.createInstrumentationScope)(A[0].instrumentationScope),spans:M,schemaUrl:A[0].instrumentationScope.schemaUrl})}l=u.next()}let p=(0,vn.createResource)(i),T={resource:p,scopeSpans:c,schemaUrl:p.schemaUrl};n.push(T),s=o.next()}return n}});var r_=_(Li=>{"use strict";Object.defineProperty(Li,"__esModule",{value:!0});Li.JsonTraceSerializer=void 0;var Eq=t_();Li.JsonTraceSerializer={serializeRequest:r=>{let e=(0,Eq.createExportTraceServiceRequest)(r,{useHex:!0,useLongBits:!1});return new TextEncoder().encode(JSON.stringify(e))},deserializeResponse:r=>{if(r.length===0)return{};let e=new TextDecoder;return JSON.parse(e.decode(r))}}});var hO=_((E3,AO)=>{"use strict";AO.exports=Tq;function Tq(r,e){for(var t=new Array(arguments.length-1),n=0,o=2,s=!0;o<arguments.length;)t[n++]=arguments[o++];return new Promise(function(a,c){t[n]=function(l){if(s)if(s=!1,l)c(l);else{for(var p=new Array(arguments.length-1),T=0;T<p.length;)p[T++]=arguments[T];a.apply(null,p)}};try{r.apply(e||null,t)}catch(u){s&&(s=!1,c(u))}})}});var OO=_(RO=>{"use strict";var bi=RO;bi.length=function(e){var t=e.length;if(!t)return 0;for(var n=0;--t%4>1&&e.charAt(t)==="=";)++n;return Math.ceil(e.length*3)/4-n};var jr=new Array(64),gO=new Array(123);for(Ve=0;Ve<64;)gO[jr[Ve]=Ve<26?Ve+65:Ve<52?Ve+71:Ve<62?Ve-4:Ve-59|43]=Ve++;var Ve;bi.encode=function(e,t,n){for(var o=null,s=[],i=0,a=0,c;t<n;){var u=e[t++];switch(a){case 0:s[i++]=jr[u>>2],c=(u&3)<<4,a=1;break;case 1:s[i++]=jr[c|u>>4],c=(u&15)<<2,a=2;break;case 2:s[i++]=jr[c|u>>6],s[i++]=jr[u&63],a=0;break}i>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),i=0)}return a&&(s[i++]=jr[c],s[i++]=61,a===1&&(s[i++]=61)),o?(i&&o.push(String.fromCharCode.apply(String,s.slice(0,i))),o.join("")):String.fromCharCode.apply(String,s.slice(0,i))};var mO="invalid encoding";bi.decode=function(e,t,n){for(var o=n,s=0,i,a=0;a<e.length;){var c=e.charCodeAt(a++);if(c===61&&s>1)break;if((c=gO[c])===void 0)throw Error(mO);switch(s){case 0:i=c,s=1;break;case 1:t[n++]=i<<2|(c&48)>>4,i=c,s=2;break;case 2:t[n++]=(i&15)<<4|(c&60)>>2,i=c,s=3;break;case 3:t[n++]=(i&3)<<6|c,s=0;break}}if(s===1)throw Error(mO);return n-o};bi.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var MO=_((d3,PO)=>{"use strict";PO.exports=yi;function yi(){this._listeners={}}yi.prototype.on=function(e,t,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:n||this}),this};yi.prototype.off=function(e,t){if(e===void 0)this._listeners={};else if(t===void 0)this._listeners[e]=[];else for(var n=this._listeners[e],o=0;o<n.length;)n[o].fn===t?n.splice(o,1):++o;return this};yi.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var n=[],o=1;o<arguments.length;)n.push(arguments[o++]);for(o=0;o<t.length;)t[o].fn.apply(t[o++].ctx,n)}return this}});var vO=_((T3,yO)=>{"use strict";yO.exports=NO(NO);function NO(r){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),t=new Uint8Array(e.buffer),n=t[3]===128;function o(c,u,l){e[0]=c,u[l]=t[0],u[l+1]=t[1],u[l+2]=t[2],u[l+3]=t[3]}function s(c,u,l){e[0]=c,u[l]=t[3],u[l+1]=t[2],u[l+2]=t[1],u[l+3]=t[0]}r.writeFloatLE=n?o:s,r.writeFloatBE=n?s:o;function i(c,u){return t[0]=c[u],t[1]=c[u+1],t[2]=c[u+2],t[3]=c[u+3],e[0]}function a(c,u){return t[3]=c[u],t[2]=c[u+1],t[1]=c[u+2],t[0]=c[u+3],e[0]}r.readFloatLE=n?i:a,r.readFloatBE=n?a:i}():function(){function e(n,o,s,i){var a=o<0?1:0;if(a&&(o=-o),o===0)n(1/o>0?0:2147483648,s,i);else if(isNaN(o))n(2143289344,s,i);else if(o>34028234663852886e22)n((a<<31|2139095040)>>>0,s,i);else if(o<11754943508222875e-54)n((a<<31|Math.round(o/1401298464324817e-60))>>>0,s,i);else{var c=Math.floor(Math.log(o)/Math.LN2),u=Math.round(o*Math.pow(2,-c)*8388608)&8388607;n((a<<31|c+127<<23|u)>>>0,s,i)}}r.writeFloatLE=e.bind(null,CO),r.writeFloatBE=e.bind(null,LO);function t(n,o,s){var i=n(o,s),a=(i>>31)*2+1,c=i>>>23&255,u=i&8388607;return c===255?u?NaN:a*(1/0):c===0?a*1401298464324817e-60*u:a*Math.pow(2,c-150)*(u+8388608)}r.readFloatLE=t.bind(null,IO),r.readFloatBE=t.bind(null,bO)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),t=new Uint8Array(e.buffer),n=t[7]===128;function o(c,u,l){e[0]=c,u[l]=t[0],u[l+1]=t[1],u[l+2]=t[2],u[l+3]=t[3],u[l+4]=t[4],u[l+5]=t[5],u[l+6]=t[6],u[l+7]=t[7]}function s(c,u,l){e[0]=c,u[l]=t[7],u[l+1]=t[6],u[l+2]=t[5],u[l+3]=t[4],u[l+4]=t[3],u[l+5]=t[2],u[l+6]=t[1],u[l+7]=t[0]}r.writeDoubleLE=n?o:s,r.writeDoubleBE=n?s:o;function i(c,u){return t[0]=c[u],t[1]=c[u+1],t[2]=c[u+2],t[3]=c[u+3],t[4]=c[u+4],t[5]=c[u+5],t[6]=c[u+6],t[7]=c[u+7],e[0]}function a(c,u){return t[7]=c[u],t[6]=c[u+1],t[5]=c[u+2],t[4]=c[u+3],t[3]=c[u+4],t[2]=c[u+5],t[1]=c[u+6],t[0]=c[u+7],e[0]}r.readDoubleLE=n?i:a,r.readDoubleBE=n?a:i}():function(){function e(n,o,s,i,a,c){var u=i<0?1:0;if(u&&(i=-i),i===0)n(0,a,c+o),n(1/i>0?0:2147483648,a,c+s);else if(isNaN(i))n(0,a,c+o),n(2146959360,a,c+s);else if(i>17976931348623157e292)n(0,a,c+o),n((u<<31|2146435072)>>>0,a,c+s);else{var l;if(i<22250738585072014e-324)l=i/5e-324,n(l>>>0,a,c+o),n((u<<31|l/4294967296)>>>0,a,c+s);else{var p=Math.floor(Math.log(i)/Math.LN2);p===1024&&(p=1023),l=i*Math.pow(2,-p),n(l*4503599627370496>>>0,a,c+o),n((u<<31|p+1023<<20|l*1048576&1048575)>>>0,a,c+s)}}}r.writeDoubleLE=e.bind(null,CO,0,4),r.writeDoubleBE=e.bind(null,LO,4,0);function t(n,o,s,i,a){var c=n(i,a+o),u=n(i,a+s),l=(u>>31)*2+1,p=u>>>20&2047,T=4294967296*(u&1048575)+c;return p===2047?T?NaN:l*(1/0):p===0?l*5e-324*T:l*Math.pow(2,p-1075)*(T+4503599627370496)}r.readDoubleLE=t.bind(null,IO,0,4),r.readDoubleBE=t.bind(null,bO,4,0)}(),r}function CO(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}function LO(r,e,t){e[t]=r>>>24,e[t+1]=r>>>16&255,e[t+2]=r>>>8&255,e[t+3]=r&255}function IO(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16|r[e+3]<<24)>>>0}function bO(r,e){return(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}});var xO=_((exports,module)=>{"use strict";module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(r){}return null}});var UO=_(DO=>{"use strict";var o_=DO;o_.length=function(e){for(var t=0,n=0,o=0;o<e.length;++o)n=e.charCodeAt(o),n<128?t+=1:n<2048?t+=2:(n&64512)===55296&&(e.charCodeAt(o+1)&64512)===56320?(++o,t+=4):t+=3;return t};o_.read=function(e,t,n){var o=n-t;if(o<1)return"";for(var s=null,i=[],a=0,c;t<n;)c=e[t++],c<128?i[a++]=c:c>191&&c<224?i[a++]=(c&31)<<6|e[t++]&63:c>239&&c<365?(c=((c&7)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63)-65536,i[a++]=55296+(c>>10),i[a++]=56320+(c&1023)):i[a++]=(c&15)<<12|(e[t++]&63)<<6|e[t++]&63,a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,i)),a=0);return s?(a&&s.push(String.fromCharCode.apply(String,i.slice(0,a))),s.join("")):String.fromCharCode.apply(String,i.slice(0,a))};o_.write=function(e,t,n){for(var o=n,s,i,a=0;a<e.length;++a)s=e.charCodeAt(a),s<128?t[n++]=s:s<2048?(t[n++]=s>>6|192,t[n++]=s&63|128):(s&64512)===55296&&((i=e.charCodeAt(a+1))&64512)===56320?(s=65536+((s&1023)<<10)+(i&1023),++a,t[n++]=s>>18|240,t[n++]=s>>12&63|128,t[n++]=s>>6&63|128,t[n++]=s&63|128):(t[n++]=s>>12|224,t[n++]=s>>6&63|128,t[n++]=s&63|128);return n-o}});var VO=_((f3,wO)=>{"use strict";wO.exports=Sq;function Sq(r,e,t){var n=t||8192,o=n>>>1,s=null,i=n;return function(c){if(c<1||c>o)return r(c);i+c>n&&(s=r(n),i=0);var u=e.call(s,i,i+=c);return i&7&&(i=(i|7)+1),u}}});var GO=_((A3,BO)=>{"use strict";BO.exports=ne;var xn=mt();function ne(r,e){this.lo=r>>>0,this.hi=e>>>0}var Kt=ne.zero=new ne(0,0);Kt.toNumber=function(){return 0};Kt.zzEncode=Kt.zzDecode=function(){return this};Kt.length=function(){return 1};var fq=ne.zeroHash="\0\0\0\0\0\0\0\0";ne.fromNumber=function(e){if(e===0)return Kt;var t=e<0;t&&(e=-e);var n=e>>>0,o=(e-n)/4294967296>>>0;return t&&(o=~o>>>0,n=~n>>>0,++n>4294967295&&(n=0,++o>4294967295&&(o=0))),new ne(n,o)};ne.from=function(e){if(typeof e=="number")return ne.fromNumber(e);if(xn.isString(e))if(xn.Long)e=xn.Long.fromString(e);else return ne.fromNumber(parseInt(e,10));return e.low||e.high?new ne(e.low>>>0,e.high>>>0):Kt};ne.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=~this.lo+1>>>0,n=~this.hi>>>0;return t||(n=n+1>>>0),-(t+n*4294967296)}return this.lo+this.hi*4294967296};ne.prototype.toLong=function(e){return xn.Long?new xn.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var ht=String.prototype.charCodeAt;ne.fromHash=function(e){return e===fq?Kt:new ne((ht.call(e,0)|ht.call(e,1)<<8|ht.call(e,2)<<16|ht.call(e,3)<<24)>>>0,(ht.call(e,4)|ht.call(e,5)<<8|ht.call(e,6)<<16|ht.call(e,7)<<24)>>>0)};ne.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};ne.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this};ne.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this};ne.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?t===0?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}});var mt=_(s_=>{"use strict";var f=s_;f.asPromise=hO();f.base64=OO();f.EventEmitter=MO();f.float=vO();f.inquire=xO();f.utf8=UO();f.pool=VO();f.LongBits=GO();f.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);f.global=f.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||s_;f.emptyArray=Object.freeze?Object.freeze([]):[];f.emptyObject=Object.freeze?Object.freeze({}):{};f.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};f.isString=function(e){return typeof e=="string"||e instanceof String};f.isObject=function(e){return e&&typeof e=="object"};f.isset=f.isSet=function(e,t){var n=e[t];return n!=null&&e.hasOwnProperty(t)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};f.Buffer=function(){try{var r=f.inquire("buffer").Buffer;return r.prototype.utf8Write?r:null}catch{return null}}();f._Buffer_from=null;f._Buffer_allocUnsafe=null;f.newBuffer=function(e){return typeof e=="number"?f.Buffer?f._Buffer_allocUnsafe(e):new f.Array(e):f.Buffer?f._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};f.Array=typeof Uint8Array<"u"?Uint8Array:Array;f.Long=f.global.dcodeIO&&f.global.dcodeIO.Long||f.global.Long||f.inquire("long");f.key2Re=/^true|false|0|1$/;f.key32Re=/^-?(?:0|[1-9][0-9]*)$/;f.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;f.longToHash=function(e){return e?f.LongBits.from(e).toHash():f.LongBits.zeroHash};f.longFromHash=function(e,t){var n=f.LongBits.fromHash(e);return f.Long?f.Long.fromBits(n.lo,n.hi,t):n.toNumber(!!t)};function HO(r,e,t){for(var n=Object.keys(e),o=0;o<n.length;++o)(r[n[o]]===void 0||!t)&&(r[n[o]]=e[n[o]]);return r}f.merge=HO;f.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)};function FO(r){function e(t,n){if(!(this instanceof e))return new e(t,n);Object.defineProperty(this,"message",{get:function(){return t}}),Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:new Error().stack||""}),n&&HO(this,n)}return e.prototype=Object.create(Error.prototype,{constructor:{value:e,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return r},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),e}f.newError=FO;f.ProtocolError=FO("ProtocolError");f.oneOfGetter=function(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=1;return function(){for(var o=Object.keys(this),s=o.length-1;s>-1;--s)if(t[o[s]]===1&&this[o[s]]!==void 0&&this[o[s]]!==null)return o[s]}};f.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}};f.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};f._configure=function(){var r=f.Buffer;if(!r){f._Buffer_from=f._Buffer_allocUnsafe=null;return}f._Buffer_from=r.from!==Uint8Array.from&&r.from||function(t,n){return new r(t,n)},f._Buffer_allocUnsafe=r.allocUnsafe||function(t){return new r(t)}}});var E_=_((m3,YO)=>{"use strict";YO.exports=b;var ve=mt(),i_,vi=ve.LongBits,qO=ve.base64,jO=ve.utf8;function Dn(r,e,t){this.fn=r,this.len=e,this.next=void 0,this.val=t}function c_(){}function Aq(r){this.head=r.head,this.tail=r.tail,this.len=r.len,this.next=r.states}function b(){this.len=0,this.head=new Dn(c_,0,0),this.tail=this.head,this.states=null}var kO=function(){return ve.Buffer?function(){return(b.create=function(){return new i_})()}:function(){return new b}};b.create=kO();b.alloc=function(e){return new ve.Array(e)};ve.Array!==Array&&(b.alloc=ve.pool(b.alloc,ve.Array.prototype.subarray));b.prototype._push=function(e,t,n){return this.tail=this.tail.next=new Dn(e,t,n),this.len+=t,this};function u_(r,e,t){e[t]=r&255}function hq(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}function __(r,e){this.len=r,this.next=void 0,this.val=e}__.prototype=Object.create(Dn.prototype);__.prototype.fn=hq;b.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new __((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};b.prototype.int32=function(e){return e<0?this._push(l_,10,vi.fromNumber(e)):this.uint32(e)};b.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function l_(r,e,t){for(;r.hi;)e[t++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)e[t++]=r.lo&127|128,r.lo=r.lo>>>7;e[t++]=r.lo}b.prototype.uint64=function(e){var t=vi.from(e);return this._push(l_,t.length(),t)};b.prototype.int64=b.prototype.uint64;b.prototype.sint64=function(e){var t=vi.from(e).zzEncode();return this._push(l_,t.length(),t)};b.prototype.bool=function(e){return this._push(u_,1,e?1:0)};function a_(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}b.prototype.fixed32=function(e){return this._push(a_,4,e>>>0)};b.prototype.sfixed32=b.prototype.fixed32;b.prototype.fixed64=function(e){var t=vi.from(e);return this._push(a_,4,t.lo)._push(a_,4,t.hi)};b.prototype.sfixed64=b.prototype.fixed64;b.prototype.float=function(e){return this._push(ve.float.writeFloatLE,4,e)};b.prototype.double=function(e){return this._push(ve.float.writeDoubleLE,8,e)};var mq=ve.Array.prototype.set?function(e,t,n){t.set(e,n)}:function(e,t,n){for(var o=0;o<e.length;++o)t[n+o]=e[o]};b.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(u_,1,0);if(ve.isString(e)){var n=b.alloc(t=qO.length(e));qO.decode(e,n,0),e=n}return this.uint32(t)._push(mq,t,e)};b.prototype.string=function(e){var t=jO.length(e);return t?this.uint32(t)._push(jO.write,t,e):this._push(u_,1,0)};b.prototype.fork=function(){return this.states=new Aq(this),this.head=this.tail=new Dn(c_,0,0),this.len=0,this};b.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Dn(c_,0,0),this.len=0),this};b.prototype.ldelim=function(){var e=this.head,t=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=t,this.len+=n),this};b.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t};b._configure=function(r){i_=r,b.create=kO(),i_._configure()}});var WO=_((g3,KO)=>{"use strict";KO.exports=tt;var $O=E_();(tt.prototype=Object.create($O.prototype)).constructor=tt;var gt=mt();function tt(){$O.call(this)}tt._configure=function(){tt.alloc=gt._Buffer_allocUnsafe,tt.writeBytesBuffer=gt.Buffer&&gt.Buffer.prototype instanceof Uint8Array&&gt.Buffer.prototype.set.name==="set"?function(e,t,n){t.set(e,n)}:function(e,t,n){if(e.copy)e.copy(t,n,0,e.length);else for(var o=0;o<e.length;)t[n++]=e[o++]}};tt.prototype.bytes=function(e){gt.isString(e)&&(e=gt._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(tt.writeBytesBuffer,t,e),this};function gq(r,e,t){r.length<40?gt.utf8.write(r,e,t):e.utf8Write?e.utf8Write(r,t):e.write(r,t)}tt.prototype.string=function(e){var t=gt.Buffer.byteLength(e);return this.uint32(t),t&&this._push(gq,t,e),this};tt._configure()});var T_=_((R3,ZO)=>{"use strict";ZO.exports=X;var Be=mt(),d_,QO=Be.LongBits,Rq=Be.utf8;function Ge(r,e){return RangeError("index out of range: "+r.pos+" + "+(e||1)+" > "+r.len)}function X(r){this.buf=r,this.pos=0,this.len=r.length}var zO=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new X(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new X(e);throw Error("illegal buffer")},JO=function(){return Be.Buffer?function(t){return(X.create=function(o){return Be.Buffer.isBuffer(o)?new d_(o):zO(o)})(t)}:zO};X.create=JO();X.prototype._slice=Be.Array.prototype.subarray||Be.Array.prototype.slice;X.prototype.uint32=function(){var e=4294967295;return function(){if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,Ge(this,10);return e}}();X.prototype.int32=function(){return this.uint32()|0};X.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function p_(){var r=new QO(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(r.lo=(r.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return r;if(r.lo=(r.lo|(this.buf[this.pos]&127)<<28)>>>0,r.hi=(r.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return r;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw Ge(this);if(r.lo=(r.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return r}return r.lo=(r.lo|(this.buf[this.pos++]&127)<<e*7)>>>0,r}if(this.len-this.pos>4){for(;e<5;++e)if(r.hi=(r.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return r}else for(;e<5;++e){if(this.pos>=this.len)throw Ge(this);if(r.hi=(r.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return r}throw Error("invalid varint encoding")}X.prototype.bool=function(){return this.uint32()!==0};function xi(r,e){return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0}X.prototype.fixed32=function(){if(this.pos+4>this.len)throw Ge(this,4);return xi(this.buf,this.pos+=4)};X.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Ge(this,4);return xi(this.buf,this.pos+=4)|0};function XO(){if(this.pos+8>this.len)throw Ge(this,8);return new QO(xi(this.buf,this.pos+=4),xi(this.buf,this.pos+=4))}X.prototype.float=function(){if(this.pos+4>this.len)throw Ge(this,4);var e=Be.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};X.prototype.double=function(){if(this.pos+8>this.len)throw Ge(this,4);var e=Be.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};X.prototype.bytes=function(){var e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw Ge(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(t,n);if(t===n){var o=Be.Buffer;return o?o.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,t,n)};X.prototype.string=function(){var e=this.bytes();return Rq.read(e,0,e.length)};X.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Ge(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Ge(this);while(this.buf[this.pos++]&128);return this};X.prototype.skipType=function(r){switch(r){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(r=this.uint32()&7)!==4;)this.skipType(r);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+r+" at offset "+this.pos)}return this};X._configure=function(r){d_=r,X.create=JO(),d_._configure();var e=Be.Long?"toLong":"toNumber";Be.merge(X.prototype,{int64:function(){return p_.call(this)[e](!1)},uint64:function(){return p_.call(this)[e](!0)},sint64:function(){return p_.call(this).zzDecode()[e](!1)},fixed64:function(){return XO.call(this)[e](!0)},sfixed64:function(){return XO.call(this)[e](!1)}})}});var nP=_((O3,rP)=>{"use strict";rP.exports=Wt;var tP=T_();(Wt.prototype=Object.create(tP.prototype)).constructor=Wt;var eP=mt();function Wt(r){tP.call(this,r)}Wt._configure=function(){eP.Buffer&&(Wt.prototype._slice=eP.Buffer.prototype.slice)};Wt.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))};Wt._configure()});var sP=_((P3,oP)=>{"use strict";oP.exports=Un;var S_=mt();(Un.prototype=Object.create(S_.EventEmitter.prototype)).constructor=Un;function Un(r,e,t){if(typeof r!="function")throw TypeError("rpcImpl must be a function");S_.EventEmitter.call(this),this.rpcImpl=r,this.requestDelimited=!!e,this.responseDelimited=!!t}Un.prototype.rpcCall=function r(e,t,n,o,s){if(!o)throw TypeError("request must be specified");var i=this;if(!s)return S_.asPromise(r,i,e,t,n,o);if(!i.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return i.rpcImpl(e,t[i.requestDelimited?"encodeDelimited":"encode"](o).finish(),function(c,u){if(c)return i.emit("error",c,e),s(c);if(u===null){i.end(!0);return}if(!(u instanceof n))try{u=n[i.responseDelimited?"decodeDelimited":"decode"](u)}catch(l){return i.emit("error",l,e),s(l)}return i.emit("data",u,e),s(null,u)})}catch(a){i.emit("error",a,e),setTimeout(function(){s(a)},0);return}};Un.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var aP=_(iP=>{"use strict";var Oq=iP;Oq.Service=sP()});var uP=_((N3,cP)=>{"use strict";cP.exports={}});var EP=_(lP=>{"use strict";var ge=lP;ge.build="minimal";ge.Writer=E_();ge.BufferWriter=WO();ge.Reader=T_();ge.BufferReader=nP();ge.util=mt();ge.rpc=aP();ge.roots=uP();ge.configure=_P;function _P(){ge.util._configure(),ge.Writer._configure(ge.BufferWriter),ge.Reader._configure(ge.BufferReader)}_P()});var dP=_((L3,pP)=>{"use strict";pP.exports=EP()});var H=Re(Gh(),1);m();un();var LP=Re(Ag(),1),Kr=Re(sn(),1),IP=Re(wg(),1),bP=Re(kR(),1),yP=Re(KR(),1),Rt=Re(y(),1);var WR="http.method",zR="http.url",Pi="http.host",XR="http.scheme",Ku="http.status_code",QR="http.user_agent",Wu="http.response_content_length_uncompressed",JR="net.peer.port",ZR="net.peer.name";var eO="service.name",tO="service.version";m();var XF=Symbol.for("@vercel/request-context");function Ie(){return globalThis[XF]?.get()}function Mi(r){return Object.fromEntries(Object.entries(r).filter(([e,t])=>t!==void 0))}function rO(r){return r?r.split("::").at(-1):void 0}function nO(r=Ie(),e){if(!r)return;let t=e?JF(e,r.headers):void 0;return Mi({[Pi]:r.headers.host,[QR]:r.headers["user-agent"],"http.referer":r.headers.referer,"vercel.request_id":rO(r.headers["x-vercel-id"]),"vercel.matched_path":r.headers["x-matched-path"],"vercel.edge_region":process.env.VERCEL_REGION,...t})}var QF={keys(r){return[]},get(r,e){return r[e.toLocaleLowerCase()]}};function JF(r,e){if(typeof r=="function")return r(e,QF);let t={};for(let[n,o]of Object.entries(r)){let s=e[o.toLocaleLowerCase()];s!==void 0&&(t[n]=s)}return t}m();function Hr(r){return(r&E.TraceFlags.SAMPLED)!==0}var Ni=class{constructor(e,t){this.processors=e;this.attributesFromHeaders=t;this.rootSpanIds=new Map;this.waitSpanEnd=new Map}forceFlush(){return Promise.all(this.processors.map(e=>e.forceFlush().catch(t=>{E.diag.error("@vercel/otel: forceFlush failed:",t)}))).then(()=>{})}shutdown(){return Promise.all(this.processors.map(e=>e.shutdown().catch(()=>{}))).then(()=>{})}onStart(e,t){let{traceId:n,spanId:o,traceFlags:s}=e.spanContext(),i=!e.parentSpanContext?.spanId||!this.rootSpanIds.has(n);if(i?this.rootSpanIds.set(n,{rootSpanId:o,open:[]}):this.rootSpanIds.get(n)?.open.push(e),i&&Hr(s)){let a=Ie(),c=nO(a,this.attributesFromHeaders);c&&e.setAttributes(c),a&&a.waitUntil(async()=>{if(this.rootSpanIds.has(n)){let u=new Promise(p=>{this.waitSpanEnd.set(n,p)}),l;await Promise.race([u,new Promise(p=>{l=setTimeout(()=>{this.waitSpanEnd.delete(n),p(void 0)},50)})]),l&&clearTimeout(l)}return this.forceFlush()})}for(let a of this.processors)a.onStart(e,t)}onEnd(e){let{traceId:t,spanId:n,traceFlags:o}=e.spanContext(),s=Hr(o),i=this.rootSpanIds.get(t),a=i?.rootSpanId===n;if(s){let c=eq(e);c&&Object.assign(e.attributes,c)}if(a){if(this.rootSpanIds.delete(t),i.open.length>0){for(let c of i.open)if(!c.ended&&c.spanContext().spanId!==n)try{c.end()}catch(u){E.diag.error("@vercel/otel: onEnd failed:",u)}}}else if(i)for(let c=0;c<i.open.length;c++)i.open[c]?.spanContext().spanId===n&&i.open.splice(c,1);for(let c of this.processors)c.onEnd(e);if(a){let c=this.waitSpanEnd.get(t);c&&(this.waitSpanEnd.delete(t),c())}}},ZF={[E.SpanKind.INTERNAL]:"internal",[E.SpanKind.SERVER]:"server",[E.SpanKind.CLIENT]:"client",[E.SpanKind.PRODUCER]:"producer",[E.SpanKind.CONSUMER]:"consumer"};function eq(r){let{kind:e,attributes:t}=r,{"operation.name":n,"resource.name":o,"span.type":s,"next.span_type":i,"http.method":a,"http.route":c}=t;if(n)return;let u=o??(a&&typeof a=="string"&&c&&typeof c=="string"?`${a} ${c}`:c);if(r.kind===E.SpanKind.SERVER&&a&&c&&typeof a=="string"&&typeof c=="string")return{"operation.name":"web.request","resource.name":u};let l=r.instrumentationScope.name,p=i??s;if(p&&typeof p=="string"){let T=oO(l,p);return c?{"operation.name":T,"resource.name":u}:{"operation.name":T}}return{"operation.name":oO(l,e===E.SpanKind.INTERNAL?"":ZF[e])}}function oO(r,e){if(!r)return e;let t=r.replace(/[ @./]/g,"_");return t.startsWith("_")&&(t=t.slice(1)),e?`${t}.${e}`:t}var fO=Re(r_(),1);m();var Fr=class{constructor(e={}){this._shutdownOnce={isCalled:!1};this._sendingPromises=[];this.url=e.url||this.getDefaultUrl(e),e.headers&&(this._headers=e.headers),this.onInit()}onShutdown(){E.diag.debug("@vercel/otel/otlp: onShutdown")}onInit(){E.diag.debug("@vercel/otel/otlp: onInit")}export(e,t){if(this._shutdownOnce.isCalled){E.diag.debug("@vercel/otel/otlp: Shutdown already started. Cannot send objects");return}this.send(e,()=>t({code:0}),n=>t({code:1,error:n}))}async forceFlush(){await Promise.all(this._sendingPromises)}async shutdown(){this._shutdownOnce.isCalled=!0,this.onShutdown(),await this.forceFlush()}send(e,t,n){if(this._shutdownOnce.isCalled){E.diag.debug("@vercel/otel/otlp: Shutdown already started. Cannot send objects");return}let o=this.convert(e),s,i,a;try{({body:s,contentType:i,headers:a}=this.toMessage(o))}catch(u){E.diag.warn("@vercel/otel/otlp: no proto",u);return}let c=fetch(this.url,{method:"POST",body:s,headers:{...this._headers,...a,"Content-Type":i,"User-Agent":"OTel-OTLP-Exporter-JavaScript/0.46.0"},next:{internal:!0}}).then(u=>{E.diag.debug("@vercel/otel/otlp: onSuccess",u.status,u.statusText),t(),u.arrayBuffer().catch(()=>{})}).catch(u=>{E.diag.error("@vercel/otel/otlp: onError",u),n(u)}).finally(()=>{let u=this._sendingPromises.indexOf(c);this._sendingPromises.splice(u,1)});this._sendingPromises.push(c)}};var pq="v1/traces",dq=`http://localhost:4318/${pq}`;function Ii(r){return typeof r.url=="string"?r.url:dq}var qr=class{constructor(e={}){this.impl=new n_(e)}export(e,t){this.impl.export(e,t)}shutdown(){return this.impl.shutdown()}forceFlush(){return this.impl.forceFlush()}},n_=class extends Fr{convert(e){return e}toMessage(e){let t=fO.JsonTraceSerializer.serializeRequest(e);return{body:new TextDecoder().decode(t),contentType:"application/json"}}getDefaultUrl(e){return Ii(e)}};var AP=Re(t_(),1);var TP=Re(dP(),1);function SP(r){let e=new TP.Writer;return Pq(r,e),e.finish()}function Pq(r,e){if(r.resourceSpans!=null&&r.resourceSpans.length)for(let t=0;t<r.resourceSpans.length;++t)Mq(r.resourceSpans[t],e.uint32(10).fork()).ldelim();return e}function Mq(r,e){if(r.resource!=null&&Nq(r.resource,e.uint32(10).fork()).ldelim(),r.scopeSpans!=null&&r.scopeSpans.length)for(let t=0;t<r.scopeSpans.length;++t)Cq(r.scopeSpans[t],e.uint32(18).fork()).ldelim();return r.schemaUrl!=null&&e.uint32(26).string(r.schemaUrl),e}function Nq(r,e){if(r.attributes!=null&&r.attributes.length)for(let t=0;t<r.attributes.length;++t)kr(r.attributes[t],e.uint32(10).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(16).uint32(r.droppedAttributesCount),e}function Cq(r,e){if(r.scope!=null&&bq(r.scope,e.uint32(10).fork()).ldelim(),r.spans!=null&&r.spans.length)for(let t=0;t<r.spans.length;++t)yq(r.spans[t],e.uint32(18).fork()).ldelim();return r.schemaUrl!=null&&e.uint32(26).string(r.schemaUrl),e}function kr(r,e){return r.key!=null&&e.uint32(10).string(r.key),r.value!=null&&fP(r.value,e.uint32(18).fork()).ldelim(),e}function fP(r,e){return r.stringValue!=null&&e.uint32(10).string(r.stringValue),r.boolValue!=null&&e.uint32(16).bool(r.boolValue),r.intValue!=null&&e.uint32(24).int64(r.intValue),r.doubleValue!=null&&e.uint32(33).double(r.doubleValue),r.arrayValue!=null&&Lq(r.arrayValue,e.uint32(42).fork()).ldelim(),r.kvlistValue!=null&&Iq(r.kvlistValue,e.uint32(50).fork()).ldelim(),r.bytesValue!=null&&e.uint32(58).bytes(r.bytesValue),e}function Lq(r,e){if(r.values!=null&&r.values.length)for(let t=0;t<r.values.length;++t)fP(r.values[t],e.uint32(10).fork()).ldelim();return e}function Iq(r,e){if(r.values!=null&&r.values.length)for(let t=0;t<r.values.length;++t)kr(r.values[t],e.uint32(10).fork()).ldelim();return e}function bq(r,e){if(r.name!=null&&e.uint32(10).string(r.name),r.version!=null&&e.uint32(18).string(r.version),r.attributes!=null&&r.attributes.length)for(let t=0;t<r.attributes.length;++t)kr(r.attributes[t],e.uint32(26).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(32).uint32(r.droppedAttributesCount),e}function yq(r,e){if(r.traceId!=null&&e.uint32(10).bytes(r.traceId),r.spanId!=null&&e.uint32(18).bytes(r.spanId),r.traceState!=null&&e.uint32(26).string(r.traceState),r.parentSpanId!=null&&e.uint32(34).bytes(r.parentSpanId),r.name!=null&&e.uint32(42).string(r.name),r.kind!=null&&e.uint32(48).int32(r.kind),r.startTimeUnixNano!=null&&e.uint32(57).fixed64(r.startTimeUnixNano),r.endTimeUnixNano!=null&&e.uint32(65).fixed64(r.endTimeUnixNano),r.attributes!=null&&r.attributes.length)for(let t=0;t<r.attributes.length;++t)kr(r.attributes[t],e.uint32(74).fork()).ldelim();if(r.droppedAttributesCount!=null&&e.uint32(80).uint32(r.droppedAttributesCount),r.events!=null&&r.events.length)for(let t=0;t<r.events.length;++t)xq(r.events[t],e.uint32(90).fork()).ldelim();if(r.droppedEventsCount!=null&&e.uint32(96).uint32(r.droppedEventsCount),r.links!=null&&r.links.length)for(let t=0;t<r.links.length;++t)Dq(r.links[t],e.uint32(106).fork()).ldelim();return r.droppedLinksCount!=null&&e.uint32(112).uint32(r.droppedLinksCount),r.status!=null&&vq(r.status,e.uint32(122).fork()).ldelim(),e}function vq(r,e){return r.message!=null&&e.uint32(18).string(r.message),r.code!=null&&e.uint32(24).int32(r.code),e}function xq(r,e){if(r.timeUnixNano!=null&&e.uint32(9).fixed64(r.timeUnixNano),r.name!=null&&e.uint32(18).string(r.name),r.attributes!=null&&r.attributes.length)for(let t=0;t<r.attributes.length;++t)kr(r.attributes[t],e.uint32(26).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(32).uint32(r.droppedAttributesCount),e}function Dq(r,e){if(r.traceId!=null&&e.uint32(10).bytes(r.traceId),r.spanId!=null&&e.uint32(18).bytes(r.spanId),r.traceState!=null&&e.uint32(26).string(r.traceState),r.attributes!=null&&r.attributes.length)for(let t=0;t<r.attributes.length;++t)kr(r.attributes[t],e.uint32(34).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(40).uint32(r.droppedAttributesCount),e}var zt=class{constructor(e={}){this.impl=new f_(e)}export(e,t){this.impl.export(e,t)}shutdown(){return this.impl.shutdown()}forceFlush(){return this.impl.forceFlush()}},f_=class extends Fr{convert(e){return(0,AP.createExportTraceServiceRequest)(e)}toMessage(e){return{body:SP(e),contentType:"application/x-protobuf",headers:{accept:"application/x-protobuf"}}}getDefaultUrl(e){return Ii(e)}};m();function hP(r,e){return r.replace(/\{(?<temp1>[^{}]+)\}/g,(t,n)=>{let o=e[n];return o!==void 0?String(o):t})}var Yr=class{constructor(e={}){this.instrumentationName="@vercel/otel/fetch";this.instrumentationVersion="1.0.0";this.config=e}getConfig(){return this.config}setConfig(){}setTracerProvider(e){this.tracerProvider=e}setMeterProvider(){}shouldIgnore(e,t){let n=this.config.ignoreUrls??[];if(t?.opentelemetry?.ignore!==void 0)return t.opentelemetry.ignore;if(n.length===0)return!1;let o=e.toString();return n.some(s=>typeof s=="string"?s==="*"?!0:o.startsWith(s):s.test(o))}shouldPropagate(e,t){let n=process.env.VERCEL_URL||process.env.NEXT_PUBLIC_VERCEL_URL||null,o=process.env.VERCEL_BRANCH_URL||process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL||null,s=this.config.propagateContextUrls??[],i=this.config.dontPropagateContextUrls??[];if(t?.opentelemetry?.propagateContext)return t.opentelemetry.propagateContext;let a=e.toString();return i.length>0&&i.some(c=>typeof c=="string"?c==="*"?!0:a.startsWith(c):c.test(a))?!1:n&&e.protocol==="https:"&&(e.host===n||e.host===o||e.host===Ie()?.headers.host)||!n&&e.protocol==="http:"&&e.hostname==="localhost"?!0:s.some(c=>typeof c=="string"?c==="*"?!0:a.startsWith(c):c.test(a))}startSpan({tracer:e,url:t,fetchType:n,method:o="GET",name:s,attributes:i={}}){let a=this.config.resourceNameTemplate,c={[WR]:o,[zR]:t.toString(),[Pi]:t.host,[XR]:t.protocol.replace(":",""),[ZR]:t.hostname,[JR]:t.port},u=a?hP(a,c):Vq(t.toString()),l=s??`${n} ${o} ${t.toString()}`,p=E.context.active();return e.startSpan(l,{kind:E.SpanKind.CLIENT,attributes:{...c,"operation.name":`${n}.${o}`,"http.client.name":n,"resource.name":u,...i}},p)}instrumentHttp(e,t){let{tracerProvider:n}=this;if(!n)return;let o=n.getTracer(this.instrumentationName,this.instrumentationVersion),{attributesFromRequestHeaders:s,attributesFromResponseHeaders:i}=this.config,a=e.request,c=e.get,u=l=>(p,T,A)=>{let M,g={},O;if(typeof p=="string"||p instanceof URL?(M=new URL(p.toString()),typeof T=="function"?O=T:T&&typeof A=="function"?(g=T,O=A):T&&(g=T)):(g=p,typeof T=="function"&&(O=T),M=Gq(g,t)),this.shouldIgnore(M))return l.apply(this,[M,g,O]);let P=this.startSpan({tracer:o,url:M,fetchType:"http",method:g.method||"GET"});if(!P.isRecording()||!Hr(P.spanContext().traceFlags))return P.end(),l.apply(this,[M,g,O]);if(this.shouldPropagate(M)){let F=E.context.active(),$=E.trace.setSpan(F,P);E.propagation.inject($,g.headers||{},wq)}s&&Di(P,s,g.headers||{},gP);try{let F=Date.now(),$=l.apply(this,[M,g,O]);return $.prependListener("response",V=>{let rt=Date.now()-F;P.setAttribute("http.response_time",rt),V.statusCode!==void 0?(P.setAttribute(Ku,V.statusCode),V.statusCode>=500&&Xt(P,`Status: ${V.statusCode}`)):Xt(P,"Response status code is undefined"),i&&Di(P,i,V.headers,gP),$.listenerCount("response")<=1&&V.resume(),V.on("end",()=>{let ee,L=V.statusCode;V.aborted&&!V.complete?ee={code:E.SpanStatusCode.ERROR}:L&&L>=100&&L<500?ee={code:E.SpanStatusCode.UNSET}:ee={code:E.SpanStatusCode.ERROR},P.setStatus(ee),P.isRecording()&&(V.headers["content-length"]&&P.setAttribute(Wu,V.headers["content-length"]),P.end())})}),$.on("error",V=>{P.isRecording()&&(Xt(P,V),P.end())}),$.on("close",()=>{P.isRecording()&&P.end()}),$}catch(F){throw Xt(P,F),P.end(),F}};e.request=u(a),e.get=u(c)}instrumentFetch(){let{tracerProvider:e}=this;if(!e)return;let t=e.getTracer(this.instrumentationName,this.instrumentationVersion),{attributesFromRequestHeaders:n,attributesFromResponseHeaders:o}=this.config;process.env.NEXT_OTEL_FETCH_DISABLED="1";let s=globalThis.fetch;this.originalFetch=s;let i=async(a,c)=>{let u=c;if(u?.next?.internal)return s(a,u);let l=new Request(a instanceof Request?a.clone():a,u),p=new URL(l.url);if(this.shouldIgnore(p,u))return s(a,u);let T=this.startSpan({tracer:t,url:p,fetchType:"fetch",method:l.method,name:u?.opentelemetry?.spanName,attributes:u?.opentelemetry?.attributes});if(!T.isRecording()||!Hr(T.spanContext().traceFlags))return T.end(),s(a,u);if(this.shouldPropagate(p,u)){let A=E.context.active(),M=E.trace.setSpan(A,T);E.propagation.inject(M,l.headers,Uq)}n&&Di(T,n,l.headers,mP);try{let A=Date.now();u?.body&&u.body instanceof FormData&&l.headers.delete("content-type");let M=await s(a,{...u,headers:l.headers}),g=Date.now()-A;return T.setAttribute(Ku,M.status),T.setAttribute("http.response_time",g),o&&Di(T,o,M.headers,mP),M.status>=500&&Xt(T,`Status: ${M.status} (${M.statusText})`),M.body?Bq(M).then(O=>{T.isRecording()&&(T.setAttribute(Wu,O),T.end())},O=>{T.isRecording()&&(Xt(T,O),T.end())}):T.end(),M}catch(A){throw Xt(T,A),T.end(),A}};globalThis.fetch=i}enable(){this.disable(),this.instrumentFetch();try{let e=N("node:http"),t=N("node:https");this.instrumentHttp(e,"http:"),this.instrumentHttp(t,"https:")}catch{}}disable(){this.originalFetch&&(globalThis.fetch=this.originalFetch)}},Uq={set(r,e,t){r.set(e,t)}},mP={get(r,e){let t=r.get(e);if(t!==null)return t.includes(",")?t.split(",").map(n=>n.trimStart()):t},keys(r){let e=[];return r.forEach((t,n)=>{e.push(n)}),e}},wq={set(r,e,t){r[e.toLowerCase()]=t}},gP={get(r,e){return r[e.toLowerCase()]},keys(r){return Object.keys(r)}};function Vq(r){let e=r.indexOf("?");return e===-1?r:r.substring(0,e)}function Bq(r){let e=0,n=r.clone().body?.getReader();if(!n)return Promise.resolve(0);let o=()=>n.read().then(({done:s,value:i})=>{if(!s)return e+=i.byteLength,o()});return o().then(()=>e)}function Xt(r,e){if(e instanceof Error)r.recordException(e),r.setStatus({code:E.SpanStatusCode.ERROR,message:e.message});else{let t=String(e);r.setStatus({code:E.SpanStatusCode.ERROR,message:t})}}function Di(r,e,t,n){for(let[o,s]of Object.entries(e)){let i=n.get(t,s);i!==void 0&&r.setAttribute(o,i)}}function Gq(r,e){if(r.socketPath)throw new Error("Cannot construct a network URL: options.socketPath is specified, indicating a Unix domain socket.");let t=r.protocol??e;t&&!t.endsWith(":")&&(t+=":");let n=r.hostname,o=r.port??r.defaultPort;if(!n&&r.host){let u=r.host.split(":");n=u[0];let l=u[1];if(u.length>1&&l&&o===void 0){let p=parseInt(l,10);isNaN(p)||(o=p)}}n||(n="localhost");let s;if(o!==void 0&&o!==""){let u=parseInt(String(o),10);isNaN(u)?s=t==="https:"?443:80:s=u}else s=t==="https:"?443:80;let i=r.path||"/",a=`${t}//${n}:${s}`,c=new URL(i,a);if(r.auth){let u=r.auth.split(":");c.username=decodeURIComponent(u[0]||""),u.length>1&&(c.password=decodeURIComponent(u[1]||""))}return c}m();var RP=Re(y(),1),Hq="00",A_="traceparent",h_="tracestate",wn=class{fields(){return[A_,h_]}inject(e,t,n){let o=E.trace.getSpanContext(e);if(!o||(0,RP.isTracingSuppressed)(e)||!(0,E.isSpanContextValid)(o))return;let s=`${Hq}-${o.traceId}-${o.spanId}-0${Number(o.traceFlags||0).toString(16)}`;n.set(t,A_,s),o.traceState&&n.set(t,h_,o.traceState.serialize())}extract(e,t,n){let o=n.get(t,A_);if(!o)return e;let s=Array.isArray(o)?o[0]:o;if(typeof s!="string")return e;let i=Fq(s);if(!i)return e;i.isRemote=!0;let a=n.get(t,h_);if(a){let c=Array.isArray(a)?a.join(","):a;i.traceState=(0,E.createTraceState)(typeof c=="string"?c:void 0)}return E.trace.setSpanContext(e,i)}};function Fq(r){let[e,t,n,o,s]=r.split("-");return!e||!t||!n||!o||e.length!==2||t.length!==32||n.length!==16||o.length!==2||e==="00"&&s?null:{traceId:t,spanId:n,traceFlags:parseInt(o,16)}}m();var Ui=class{fields(){return[]}inject(){}extract(e){let t=Ie();if(!t?.telemetry)return E.diag.warn("@vercel/otel: Vercel telemetry extension not found."),e;let{rootSpanContext:n}=t.telemetry;return n?(E.diag.debug("@vercel/otel: Extracted root SpanContext from Vercel request context.",n),E.trace.setSpanContext(e,{...n,isRemote:!0,traceFlags:n.traceFlags||E.TraceFlags.SAMPLED})):e}};m();var wi=Re(y(),1),OP=Re(r_(),1);var Vi=class{export(e,t){let n=Ie();if(!n?.telemetry){E.diag.warn("@vercel/otel: no telemetry context found"),t({code:wi.ExportResultCode.SUCCESS,error:void 0});return}try{let o=OP.JsonTraceSerializer.serializeRequest(e);if(!o)throw new Error("Failed to serialize spans");let s=JSON.parse(new TextDecoder().decode(o));n.telemetry.reportSpans(s),t({code:wi.ExportResultCode.SUCCESS,error:void 0})}catch(o){t({code:wi.ExportResultCode.FAILED,error:o instanceof Error?o:new Error(String(o))})}}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}};function xe(r){let e=process.env[r];if(!(!e||e.trim()===""))return e}function PP(r){return xe(r)?.split(",").map(e=>e.trim()).filter(e=>e!=="")}m();function m_(){return!!Ie()?.telemetry?.traceDrains?.length}var MP=!1,Vn=class{constructor(e){this.processor=e}forceFlush(){return this.processor.forceFlush()}shutdown(){return this.processor.shutdown()}onStart(e,t){if(m_()){MP||(MP=!0,E.diag.debug("@vercel/otel: skipping automatic exporter due to configured trace drains"));return}this.processor.onStart(e,t)}onEnd(e){m_()||this.processor.onEnd(e)}};var qq={ALL:E.DiagLogLevel.ALL,VERBOSE:E.DiagLogLevel.VERBOSE,DEBUG:E.DiagLogLevel.DEBUG,INFO:E.DiagLogLevel.INFO,WARN:E.DiagLogLevel.WARN,ERROR:E.DiagLogLevel.ERROR,NONE:E.DiagLogLevel.NONE},Bi=class{constructor(e={}){this.configuration=e}start(){let e=jq(),t=this.configuration,n=process.env.NEXT_RUNTIME||"nodejs",o=!!e.OTEL_SDK_DISABLED;if(process.env.OTEL_LOG_LEVEL&&E.diag.setLogger(new E.DiagConsoleLogger,{logLevel:qq[process.env.OTEL_LOG_LEVEL.toUpperCase()]}),o)return;let s=t.idGenerator??new H.RandomIdGenerator;this.contextManager=Jq(t.contextManager);let i=e.OTEL_SERVICE_NAME||t.serviceName||"app",a=(0,Kr.resourceFromAttributes)(Mi({[eO]:i,"node.ci":process.env.CI?!0:void 0,"node.env":process.env.NODE_ENV,env:process.env.VERCEL_ENV||process.env.NEXT_PUBLIC_VERCEL_ENV,"vercel.region":process.env.VERCEL_REGION,"vercel.runtime":n,"vercel.sha":process.env.VERCEL_GIT_COMMIT_SHA||process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA,"vercel.host":process.env.VERCEL_URL||process.env.NEXT_PUBLIC_VERCEL_URL||void 0,"vercel.branch_host":process.env.VERCEL_BRANCH_URL||process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL||void 0,"vercel.deployment_id":process.env.VERCEL_DEPLOYMENT_ID||void 0,[tO]:process.env.VERCEL_DEPLOYMENT_ID,"vercel.project_id":process.env.VERCEL_PROJECT_ID||void 0,...t.attributes})),c=t.resourceDetectors??[Kr.envDetector];if(t.autoDetectResources??!0){let P=(0,Kr.detectResources)({detectors:c});a=a.merge(P)}let l=Yq(t.propagators,t,e),p=$q(t.traceSampler,e),T=Kq(t.spanProcessors,t,e);T.length===0&&E.diag.warn("@vercel/otel: No span processors configured. No spans will be exported.");let A=t.spanLimits,M=new H.BasicTracerProvider({resource:a,idGenerator:s,sampler:p,spanLimits:A,spanProcessors:[new Ni(T,t.attributesFromHeaders)]});if(E.trace.setGlobalTracerProvider(M),E.propagation.setGlobalPropagator(new Rt.CompositePropagator({propagators:l})),this.tracerProvider=M,t.logRecordProcessors){let O=new IP.LoggerProvider({resource:a,processors:t.logRecordProcessors});this.loggerProvider=O,at.logs.setGlobalLoggerProvider(O)}if(t.metricReaders||t.views){let O=new bP.MeterProvider({resource:a,views:t.views??[],readers:t.metricReaders??[]});E.metrics.setGlobalMeterProvider(O),this.meterProvider=O}let g=kq(t.instrumentations,t.instrumentationConfig);this.disableInstrumentations=(0,LP.registerInstrumentations)({instrumentations:g}),E.diag.info("@vercel/otel: started",i,n)}async shutdown(){let e=[];this.tracerProvider&&e.push(this.tracerProvider.shutdown()),this.loggerProvider&&e.push(this.loggerProvider.shutdown()),this.meterProvider&&e.push(this.meterProvider.shutdown()),E.diag.info("@vercel/otel: shutting down",e.length,process.env.NEXT_RUNTIME),await Promise.all(e),this.contextManager&&this.contextManager.disable();let{disableInstrumentations:t}=this;t&&t()}};function jq(){return{OTEL_SDK_DISABLED:xe("OTEL_SDK_DISABLED"),OTEL_SERVICE_NAME:xe("OTEL_SERVICE_NAME"),OTEL_PROPAGATORS:PP("OTEL_PROPAGATORS"),OTEL_TRACES_SAMPLER:xe("OTEL_TRACES_SAMPLER"),OTEL_TRACES_SAMPLER_ARG:xe("OTEL_TRACES_SAMPLER_ARG"),OTEL_EXPORTER_OTLP_TRACES_ENDPOINT:xe("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT"),OTEL_EXPORTER_OTLP_TRACES_PROTOCOL:xe("OTEL_EXPORTER_OTLP_TRACES_PROTOCOL"),OTEL_EXPORTER_OTLP_PROTOCOL:xe("OTEL_EXPORTER_OTLP_PROTOCOL"),OTEL_EXPORTER_OTLP_ENDPOINT:xe("OTEL_EXPORTER_OTLP_ENDPOINT"),OTEL_EXPORTER_OTLP_HEADERS:xe("OTEL_EXPORTER_OTLP_HEADERS"),OTEL_EXPORTER_OTLP_TRACES_HEADERS:xe("OTEL_EXPORTER_OTLP_TRACES_HEADERS")}}function kq(r,e){return(r??["auto"]).map(t=>t==="auto"?(E.diag.debug("@vercel/otel: Configure instrumentations: fetch",e?.fetch),[new Yr(e?.fetch)]):t==="fetch"?(E.diag.debug("@vercel/otel: Configure instrumentations: fetch",e?.fetch),new Yr(e?.fetch)):t).flat()}function Yq(r,e,t){let n=process.env.OTEL_PROPAGATORS&&t.OTEL_PROPAGATORS&&t.OTEL_PROPAGATORS.length>0?t.OTEL_PROPAGATORS:void 0;return(r??n??["auto"]).map(o=>{if(o==="none")return[];if(o==="auto"){let s=[];return s.push({name:"tracecontext",propagator:new wn}),s.push({name:"baggage",propagator:new Rt.W3CBaggagePropagator}),s.push({name:"vercel-runtime",propagator:new Ui}),E.diag.debug(`@vercel/otel: Configure propagators: ${s.map(i=>i.name).join(", ")}`),s.map(i=>i.propagator)}if(o==="tracecontext")return E.diag.debug("@vercel/otel: Configure propagator: tracecontext"),new wn;if(o==="baggage")return E.diag.debug("@vercel/otel: Configure propagator: baggage"),new Rt.W3CBaggagePropagator;if(typeof o=="string")throw new Error(`Unknown propagator: "${o}"`);return o}).flat()}var NP="always_on",$r=1;function $q(r,e){if(r&&typeof r!="string")return r;let t=r&&r!=="auto"?r:e.OTEL_TRACES_SAMPLER||NP;switch(E.diag.debug("@vercel/otel: Configure sampler: ",t),t){case"always_on":return new H.AlwaysOnSampler;case"always_off":return new H.AlwaysOffSampler;case"parentbased_always_on":return new H.ParentBasedSampler({root:new H.AlwaysOnSampler});case"parentbased_always_off":return new H.ParentBasedSampler({root:new H.AlwaysOffSampler});case"traceidratio":return new H.TraceIdRatioBasedSampler(CP(e));case"parentbased_traceidratio":return new H.ParentBasedSampler({root:new H.TraceIdRatioBasedSampler(CP(e))});default:return E.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER value "${String(e.OTEL_TRACES_SAMPLER)} invalid, defaulting to ${NP}".`),new H.AlwaysOnSampler}}function CP(r){if(r.OTEL_TRACES_SAMPLER_ARG===void 0||r.OTEL_TRACES_SAMPLER_ARG==="")return E.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${$r}.`),$r;E.diag.debug("@vercel/otel: Configure sampler probability: ",r.OTEL_TRACES_SAMPLER_ARG);let e=Number(r.OTEL_TRACES_SAMPLER_ARG);return isNaN(e)?(E.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER_ARG=${r.OTEL_TRACES_SAMPLER_ARG} was given, but it is invalid, defaulting to ${$r}.`),$r):e<0||e>1?(E.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER_ARG=${r.OTEL_TRACES_SAMPLER_ARG} was given, but it is out of range ([0..1]), defaulting to ${$r}.`),$r):e}function Kq(r,e,t){return[...(r??["auto"]).flatMap(n=>{if(n==="auto"){let o=[new H.BatchSpanProcessor(new Vi)];if(process.env.VERCEL_OTEL_ENDPOINTS){let s=process.env.VERCEL_OTEL_ENDPOINTS_PORT||"4318",i=process.env.VERCEL_OTEL_ENDPOINTS_PROTOCOL||"http/protobuf";E.diag.debug("@vercel/otel: Configure vercel otel collector on port: ",s,i);let a={url:`http://localhost:${s}/v1/traces`,headers:{}},c=i==="http/protobuf"?new zt(a):new qr(a);o.push(new Vn(new H.BatchSpanProcessor(c)))}else(!e.traceExporter||e.traceExporter==="auto"||t.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT||t.OTEL_EXPORTER_OTLP_ENDPOINT)&&o.push(new Vn(new H.BatchSpanProcessor(Wq(t))));return o}return n}).filter(Qq),...e.traceExporter&&e.traceExporter!=="auto"?[new H.BatchSpanProcessor(e.traceExporter)]:[]]}function Wq(r){let e=r.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL??r.OTEL_EXPORTER_OTLP_PROTOCOL??"http/protobuf",t=Xq(r),n={...r.OTEL_EXPORTER_OTLP_HEADERS?(0,Rt.parseKeyPairsIntoRecord)(r.OTEL_EXPORTER_OTLP_HEADERS):{},...r.OTEL_EXPORTER_OTLP_TRACES_HEADERS?(0,Rt.parseKeyPairsIntoRecord)(r.OTEL_EXPORTER_OTLP_TRACES_HEADERS):{}};switch(E.diag.debug("@vercel/otel: Configure trace exporter: ",e,t,`headers: ${Object.keys(n).join(",")||"<none>"}`),e){case"http/json":return new qr({url:t,headers:n});case"http/protobuf":return new zt({url:t,headers:n});default:return E.diag.warn(`@vercel/otel: Unsupported OTLP traces protocol: ${e}. Using http/protobuf.`),new zt}}var vP="v1/traces",zq=`http://localhost:4318/${vP}`;function Xq(r){let e=r.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT;if(e&&typeof e=="string")return e;let t=r.OTEL_EXPORTER_OTLP_ENDPOINT;return t&&typeof t=="string"?`${t}/${vP}`:zq}function Qq(r){return r!=null}function Jq(r){if(r===void 0){E.diag.debug("@vercel/otel: Configure context manager: default");let e=new yP.AsyncLocalStorageContextManager;return e.enable(),E.context.setGlobalContextManager(e),e}return E.diag.debug("@vercel/otel: Configure context manager: from configuration"),r.enable(),E.context.setGlobalContextManager(r),r}function d8(r){let e;r?typeof r=="string"?e={serviceName:r}:e=r:e={},new Bi(e).start()}export{Yr as FetchInstrumentation,qr as OTLPHttpJsonTraceExporter,zt as OTLPHttpProtoTraceExporter,d8 as registerOTel};
23
+ `,(0,ii.getConflictResolutionRecipe)(s,e))}return n}};ai.MetricStorageRegistry=Ou});var MR=_(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});ci.MultiMetricStorage=void 0;var Pu=class{_backingStorages;constructor(e){this._backingStorages=e}record(e,t,n,o){this._backingStorages.forEach(s=>{s.record(e,t,n,o)})}};ci.MultiMetricStorage=Pu});var CR=_(Vr=>{"use strict";Object.defineProperty(Vr,"__esModule",{value:!0});Vr.BatchObservableResultImpl=Vr.ObservableResultImpl=void 0;var wr=(m(),R(E)),NR=bn(),JH=Zs(),Mu=class{_instrumentName;_valueType;_buffer=new NR.AttributeHashMap;constructor(e,t){this._instrumentName=e,this._valueType=t}observe(e,t={}){if(typeof e!="number"){wr.diag.warn(`non-number value provided to metric ${this._instrumentName}: ${e}`);return}this._valueType===wr.ValueType.INT&&!Number.isInteger(e)&&(wr.diag.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._buffer.set(t,e)}};Vr.ObservableResultImpl=Mu;var Nu=class{_buffer=new Map;observe(e,t,n={}){if(!(0,JH.isObservableInstrument)(e))return;let o=this._buffer.get(e);if(o==null&&(o=new NR.AttributeHashMap,this._buffer.set(e,o)),typeof t!="number"){wr.diag.warn(`non-number value provided to metric ${e._descriptor.name}: ${t}`);return}e._descriptor.valueType===wr.ValueType.INT&&!Number.isInteger(t)&&(wr.diag.warn(`INT value type cannot accept a floating-point value for ${e._descriptor.name}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||o.set(n,t)}};Vr.BatchObservableResultImpl=Nu});var bR=_(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.ObservableRegistry=void 0;var ZH=(m(),R(E)),LR=Zs(),IR=CR(),yn=we(),Cu=class{_callbacks=[];_batchCallbacks=[];addCallback(e,t){this._findCallback(e,t)>=0||this._callbacks.push({callback:e,instrument:t})}removeCallback(e,t){let n=this._findCallback(e,t);n<0||this._callbacks.splice(n,1)}addBatchCallback(e,t){let n=new Set(t.filter(LR.isObservableInstrument));if(n.size===0){ZH.diag.error("BatchObservableCallback is not associated with valid instruments",t);return}this._findBatchCallback(e,n)>=0||this._batchCallbacks.push({callback:e,instruments:n})}removeBatchCallback(e,t){let n=new Set(t.filter(LR.isObservableInstrument)),o=this._findBatchCallback(e,n);o<0||this._batchCallbacks.splice(o,1)}async observe(e,t){let n=this._observeCallbacks(e,t),o=this._observeBatchCallbacks(e,t);return(await(0,yn.PromiseAllSettled)([...n,...o])).filter(yn.isPromiseAllSettledRejectionResult).map(a=>a.reason)}_observeCallbacks(e,t){return this._callbacks.map(async({callback:n,instrument:o})=>{let s=new IR.ObservableResultImpl(o._descriptor.name,o._descriptor.valueType),i=Promise.resolve(n(s));t!=null&&(i=(0,yn.callWithTimeout)(i,t)),await i,o._metricStorages.forEach(a=>{a.record(s._buffer,e)})})}_observeBatchCallbacks(e,t){return this._batchCallbacks.map(async({callback:n,instruments:o})=>{let s=new IR.BatchObservableResultImpl,i=Promise.resolve(n(s));t!=null&&(i=(0,yn.callWithTimeout)(i,t)),await i,o.forEach(a=>{let c=s._buffer.get(a);c!=null&&a._metricStorages.forEach(u=>{u.record(c,e)})})})}_findCallback(e,t){return this._callbacks.findIndex(n=>n.callback===e&&n.instrument===t)}_findBatchCallback(e,t){return this._batchCallbacks.findIndex(n=>n.callback===e&&(0,yn.setEquals)(n.instruments,t))}};ui.ObservableRegistry=Cu});var yR=_(_i=>{"use strict";Object.defineProperty(_i,"__esModule",{value:!0});_i.SyncMetricStorage=void 0;var eF=Tu(),tF=hu(),rF=gu(),Lu=class extends eF.MetricStorage{_attributesProcessor;_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;constructor(e,t,n,o,s){super(e),this._attributesProcessor=n,this._aggregationCardinalityLimit=s,this._deltaMetricStorage=new tF.DeltaMetricProcessor(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new rF.TemporalMetricProcessor(t,o)}record(e,t,n,o){t=this._attributesProcessor.process(t,n),this._deltaMetricStorage.record(e,t,n,o)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}};_i.SyncMetricStorage=Lu});var li=_(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.createDenyListAttributesProcessor=Ze.createAllowListAttributesProcessor=Ze.createMultiAttributesProcessor=Ze.createNoopAttributesProcessor=void 0;var Iu=class{process(e,t){return e}},bu=class{_processors;constructor(e){this._processors=e}process(e,t){let n=e;for(let o of this._processors)n=o.process(n,t);return n}},yu=class{_allowedAttributeNames;constructor(e){this._allowedAttributeNames=e}process(e,t){let n={};return Object.keys(e).filter(o=>this._allowedAttributeNames.includes(o)).forEach(o=>n[o]=e[o]),n}},vu=class{_deniedAttributeNames;constructor(e){this._deniedAttributeNames=e}process(e,t){let n={};return Object.keys(e).filter(o=>!this._deniedAttributeNames.includes(o)).forEach(o=>n[o]=e[o]),n}};function nF(){return aF}Ze.createNoopAttributesProcessor=nF;function oF(r){return new bu(r)}Ze.createMultiAttributesProcessor=oF;function sF(r){return new yu(r)}Ze.createAllowListAttributesProcessor=sF;function iF(r){return new vu(r)}Ze.createDenyListAttributesProcessor=iF;var aF=new Iu});var vR=_(Ei=>{"use strict";Object.defineProperty(Ei,"__esModule",{value:!0});Ei.MeterSharedState=void 0;var cF=In(),uF=SR(),_F=we(),lF=fR(),EF=PR(),pF=MR(),dF=bR(),TF=yR(),SF=li(),xu=class{_meterProviderSharedState;_instrumentationScope;metricStorageRegistry=new EF.MetricStorageRegistry;observableRegistry=new dF.ObservableRegistry;meter;constructor(e,t){this._meterProviderSharedState=e,this._instrumentationScope=t,this.meter=new uF.Meter(this)}registerMetricStorage(e){let t=this._registerMetricStorage(e,TF.SyncMetricStorage);return t.length===1?t[0]:new pF.MultiMetricStorage(t)}registerAsyncMetricStorage(e){return this._registerMetricStorage(e,lF.AsyncMetricStorage)}async collect(e,t,n){let o=await this.observableRegistry.observe(t,n?.timeoutMillis),s=this.metricStorageRegistry.getStorages(e);if(s.length===0)return null;let i=s.map(a=>a.collect(e,t)).filter(_F.isNotNullish);return i.length===0?{errors:o}:{scopeMetrics:{scope:this._instrumentationScope,metrics:i},errors:o}}_registerMetricStorage(e,t){let o=this._meterProviderSharedState.viewRegistry.findViews(e,this._instrumentationScope).map(s=>{let i=(0,cF.createInstrumentDescriptorWithView)(s,e),a=this.metricStorageRegistry.findOrUpdateCompatibleStorage(i);if(a!=null)return a;let c=s.aggregation.createAggregator(i),u=new t(i,c,s.attributesProcessor,this._meterProviderSharedState.metricCollectors,s.aggregationCardinalityLimit);return this.metricStorageRegistry.register(u),u});if(o.length===0){let i=this._meterProviderSharedState.selectAggregations(e.type).map(([a,c])=>{let u=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(a,e);if(u!=null)return u;let l=c.createAggregator(e),p=a.selectCardinalityLimit(e.type),T=new t(e,l,(0,SF.createNoopAttributesProcessor)(),[a],p);return this.metricStorageRegistry.registerForCollector(a,T),T});o=o.concat(i)}return o}};Ei.MeterSharedState=xu});var xR=_(pi=>{"use strict";Object.defineProperty(pi,"__esModule",{value:!0});pi.MeterProviderSharedState=void 0;var fF=we(),AF=pR(),hF=vR(),mF=Cn(),Du=class{resource;viewRegistry=new AF.ViewRegistry;metricCollectors=[];meterSharedStates=new Map;constructor(e){this.resource=e}getMeterSharedState(e){let t=(0,fF.instrumentationScopeId)(e),n=this.meterSharedStates.get(t);return n==null&&(n=new hF.MeterSharedState(this,e),this.meterSharedStates.set(t,n)),n}selectAggregations(e){let t=[];for(let n of this.metricCollectors)t.push([n,(0,mF.toAggregation)(n.selectAggregation(e))]);return t}};pi.MeterProviderSharedState=Du});var DR=_(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});di.MetricCollector=void 0;var gF=y(),Uu=class{_sharedState;_metricReader;constructor(e,t){this._sharedState=e,this._metricReader=t}async collect(e){let t=(0,gF.millisToHrTime)(Date.now()),n=[],o=[],s=Array.from(this._sharedState.meterSharedStates.values()).map(async i=>{let a=await i.collect(this,t,e);a?.scopeMetrics!=null&&n.push(a.scopeMetrics),a?.errors!=null&&o.push(...a.errors)});return await Promise.all(s),{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:n},errors:o}}async forceFlush(e){await this._metricReader.forceFlush(e)}async shutdown(e){await this._metricReader.shutdown(e)}selectAggregationTemporality(e){return this._metricReader.selectAggregationTemporality(e)}selectAggregation(e){return this._metricReader.selectAggregation(e)}selectCardinalityLimit(e){return this._metricReader.selectCardinalityLimit?.(e)??2e3}};di.MetricCollector=Uu});var Ti=_(Br=>{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});Br.ExactPredicate=Br.PatternPredicate=void 0;var RF=/[\^$\\.+?()[\]{}|]/g,wu=class r{_matchAll;_regexp;constructor(e){e==="*"?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(r.escapePattern(e)))}match(e){return this._matchAll?!0:this._regexp.test(e)}static escapePattern(e){return`^${e.replace(RF,"\\$&").replace("*",".*")}$`}static hasWildcard(e){return e.includes("*")}};Br.PatternPredicate=wu;var Vu=class{_matchAll;_pattern;constructor(e){this._matchAll=e===void 0,this._pattern=e}match(e){return!!(this._matchAll||e===this._pattern)}};Br.ExactPredicate=Vu});var wR=_(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.InstrumentSelector=void 0;var UR=Ti(),Bu=class{_nameFilter;_type;_unitFilter;constructor(e){this._nameFilter=new UR.PatternPredicate(e?.name??"*"),this._type=e?.type,this._unitFilter=new UR.ExactPredicate(e?.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}};Si.InstrumentSelector=Bu});var VR=_(fi=>{"use strict";Object.defineProperty(fi,"__esModule",{value:!0});fi.MeterSelector=void 0;var Gu=Ti(),Hu=class{_nameFilter;_versionFilter;_schemaUrlFilter;constructor(e){this._nameFilter=new Gu.ExactPredicate(e?.name),this._versionFilter=new Gu.ExactPredicate(e?.version),this._schemaUrlFilter=new Gu.ExactPredicate(e?.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}};fi.MeterSelector=Hu});var HR=_(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});Ai.View=void 0;var OF=Ti(),BR=li(),PF=wR(),MF=VR(),GR=Cn();function NF(r){return r.instrumentName==null&&r.instrumentType==null&&r.instrumentUnit==null&&r.meterName==null&&r.meterVersion==null&&r.meterSchemaUrl==null}function CF(r){if(NF(r))throw new Error("Cannot create view with no selector arguments supplied");if(r.name!=null&&(r?.instrumentName==null||OF.PatternPredicate.hasWildcard(r.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 Fu=class{name;description;aggregation;attributesProcessor;instrumentSelector;meterSelector;aggregationCardinalityLimit;constructor(e){CF(e),e.attributesProcessors!=null?this.attributesProcessor=(0,BR.createMultiAttributesProcessor)(e.attributesProcessors):this.attributesProcessor=(0,BR.createNoopAttributesProcessor)(),this.name=e.name,this.description=e.description,this.aggregation=(0,GR.toAggregation)(e.aggregation??{type:GR.AggregationType.DEFAULT}),this.instrumentSelector=new PF.InstrumentSelector({name:e.instrumentName,type:e.instrumentType,unit:e.instrumentUnit}),this.meterSelector=new MF.MeterSelector({name:e.meterName,version:e.meterVersion,schemaUrl:e.meterSchemaUrl}),this.aggregationCardinalityLimit=e.aggregationCardinalityLimit}};Ai.View=Fu});var FR=_(mi=>{"use strict";Object.defineProperty(mi,"__esModule",{value:!0});mi.MeterProvider=void 0;var hi=(m(),R(E)),LF=sn(),IF=xR(),bF=DR(),yF=HR(),qu=class{_sharedState;_shutdown=!1;constructor(e){if(this._sharedState=new IF.MeterProviderSharedState(e?.resource??(0,LF.defaultResource)()),e?.views!=null&&e.views.length>0)for(let t of e.views)this._sharedState.viewRegistry.addView(new yF.View(t));if(e?.readers!=null&&e.readers.length>0)for(let t of e.readers){let n=new bF.MetricCollector(this._sharedState,t);t.setMetricProducer(n),this._sharedState.metricCollectors.push(n)}}getMeter(e,t="",n={}){return this._shutdown?(hi.diag.warn("A shutdown MeterProvider cannot provide a Meter"),(0,hi.createNoopMeter)()):this._sharedState.getMeterSharedState({name:e,version:t,schemaUrl:n.schemaUrl}).meter}async shutdown(e){if(this._shutdown){hi.diag.warn("shutdown may only be called once per MeterProvider");return}this._shutdown=!0,await Promise.all(this._sharedState.metricCollectors.map(t=>t.shutdown(e)))}async forceFlush(e){if(this._shutdown){hi.diag.warn("invalid attempt to force flush after MeterProvider shutdown");return}await Promise.all(this._sharedState.metricCollectors.map(t=>t.forceFlush(e)))}};mi.MeterProvider=qu});var kR=_(w=>{"use strict";Object.defineProperty(w,"__esModule",{value:!0});w.TimeoutError=w.createDenyListAttributesProcessor=w.createAllowListAttributesProcessor=w.AggregationType=w.MeterProvider=w.ConsoleMetricExporter=w.InMemoryMetricExporter=w.PeriodicExportingMetricReader=w.MetricReader=w.InstrumentType=w.DataPointType=w.AggregationTemporality=void 0;var vF=Is();Object.defineProperty(w,"AggregationTemporality",{enumerable:!0,get:function(){return vF.AggregationTemporality}});var qR=ft();Object.defineProperty(w,"DataPointType",{enumerable:!0,get:function(){return qR.DataPointType}});Object.defineProperty(w,"InstrumentType",{enumerable:!0,get:function(){return qR.InstrumentType}});var xF=eu();Object.defineProperty(w,"MetricReader",{enumerable:!0,get:function(){return xF.MetricReader}});var DF=cR();Object.defineProperty(w,"PeriodicExportingMetricReader",{enumerable:!0,get:function(){return DF.PeriodicExportingMetricReader}});var UF=_R();Object.defineProperty(w,"InMemoryMetricExporter",{enumerable:!0,get:function(){return UF.InMemoryMetricExporter}});var wF=ER();Object.defineProperty(w,"ConsoleMetricExporter",{enumerable:!0,get:function(){return wF.ConsoleMetricExporter}});var VF=FR();Object.defineProperty(w,"MeterProvider",{enumerable:!0,get:function(){return VF.MeterProvider}});var BF=Cn();Object.defineProperty(w,"AggregationType",{enumerable:!0,get:function(){return BF.AggregationType}});var jR=li();Object.defineProperty(w,"createAllowListAttributesProcessor",{enumerable:!0,get:function(){return jR.createAllowListAttributesProcessor}});Object.defineProperty(w,"createDenyListAttributesProcessor",{enumerable:!0,get:function(){return jR.createDenyListAttributesProcessor}});var GF=we();Object.defineProperty(w,"TimeoutError",{enumerable:!0,get:function(){return GF.TimeoutError}})});var ku=_(gi=>{"use strict";Object.defineProperty(gi,"__esModule",{value:!0});gi.AbstractAsyncHooksContextManager=void 0;var HF=N("events"),FF=["addListener","on","once","prependListener","prependOnceListener"],ju=class{bind(e,t){return t instanceof HF.EventEmitter?this._bindEventEmitter(e,t):typeof t=="function"?this._bindFunction(e,t):t}_bindFunction(e,t){let n=this,o=function(...s){return n.with(e,()=>t.apply(this,s))};return Object.defineProperty(o,"length",{enumerable:!1,configurable:!0,writable:!1,value:t.length}),o}_bindEventEmitter(e,t){return this._getPatchMap(t)!==void 0||(this._createPatchMap(t),FF.forEach(o=>{t[o]!==void 0&&(t[o]=this._patchAddListener(t,t[o],e))}),typeof t.removeListener=="function"&&(t.removeListener=this._patchRemoveListener(t,t.removeListener)),typeof t.off=="function"&&(t.off=this._patchRemoveListener(t,t.off)),typeof t.removeAllListeners=="function"&&(t.removeAllListeners=this._patchRemoveAllListeners(t,t.removeAllListeners))),t}_patchRemoveListener(e,t){let n=this;return function(o,s){let i=n._getPatchMap(e)?.[o];if(i===void 0)return t.call(this,o,s);let a=i.get(s);return t.call(this,o,a||s)}}_patchRemoveAllListeners(e,t){let n=this;return function(o){let s=n._getPatchMap(e);return s!==void 0&&(arguments.length===0?n._createPatchMap(e):s[o]!==void 0&&delete s[o]),t.apply(this,arguments)}}_patchAddListener(e,t,n){let o=this;return function(s,i){if(o._wrapped)return t.call(this,s,i);let a=o._getPatchMap(e);a===void 0&&(a=o._createPatchMap(e));let c=a[s];c===void 0&&(c=new WeakMap,a[s]=c);let u=o.bind(n,i);c.set(i,u),o._wrapped=!0;try{return t.call(this,s,u)}finally{o._wrapped=!1}}}_createPatchMap(e){let t=Object.create(null);return e[this._kOtListeners]=t,t}_getPatchMap(e){return e[this._kOtListeners]}_kOtListeners=Symbol("OtListeners");_wrapped=!1};gi.AbstractAsyncHooksContextManager=ju});var YR=_(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});Ri.AsyncHooksContextManager=void 0;var qF=(m(),R(E)),jF=N("async_hooks"),kF=ku(),Yu=class extends kF.AbstractAsyncHooksContextManager{_asyncHook;_contexts=new Map;_stack=[];constructor(){super(),this._asyncHook=jF.createHook({init:this._init.bind(this),before:this._before.bind(this),after:this._after.bind(this),destroy:this._destroy.bind(this),promiseResolve:this._destroy.bind(this)})}active(){return this._stack[this._stack.length-1]??qF.ROOT_CONTEXT}with(e,t,n,...o){this._enterContext(e);try{return t.call(n,...o)}finally{this._exitContext()}}enable(){return this._asyncHook.enable(),this}disable(){return this._asyncHook.disable(),this._contexts.clear(),this._stack=[],this}_init(e,t){if(t==="TIMERWRAP")return;let n=this._stack[this._stack.length-1];n!==void 0&&this._contexts.set(e,n)}_destroy(e){this._contexts.delete(e)}_before(e){let t=this._contexts.get(e);t!==void 0&&this._enterContext(t)}_after(){this._exitContext()}_enterContext(e){this._stack.push(e)}_exitContext(){this._stack.pop()}};Ri.AsyncHooksContextManager=Yu});var $R=_(Oi=>{"use strict";Object.defineProperty(Oi,"__esModule",{value:!0});Oi.AsyncLocalStorageContextManager=void 0;var YF=(m(),R(E)),$F=N("async_hooks"),KF=ku(),$u=class extends KF.AbstractAsyncHooksContextManager{_asyncLocalStorage;constructor(){super(),this._asyncLocalStorage=new $F.AsyncLocalStorage}active(){return this._asyncLocalStorage.getStore()??YF.ROOT_CONTEXT}with(e,t,n,...o){let s=n==null?t:t.bind(n);return this._asyncLocalStorage.run(e,s,...o)}enable(){return this}disable(){return this._asyncLocalStorage.disable(),this}};Oi.AsyncLocalStorageContextManager=$u});var KR=_(Gr=>{"use strict";Object.defineProperty(Gr,"__esModule",{value:!0});Gr.AsyncLocalStorageContextManager=Gr.AsyncHooksContextManager=void 0;var WF=YR();Object.defineProperty(Gr,"AsyncHooksContextManager",{enumerable:!0,get:function(){return WF.AsyncHooksContextManager}});var zF=$R();Object.defineProperty(Gr,"AsyncLocalStorageContextManager",{enumerable:!0,get:function(){return zF.AsyncLocalStorageContextManager}})});var iO=_(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.toAnyValue=be.toKeyValue=be.toAttributes=be.createInstrumentationScope=be.createResource=void 0;function tq(r){let e={attributes:sO(r.attributes),droppedAttributesCount:0},t=r.schemaUrl;return t&&t!==""&&(e.schemaUrl=t),e}be.createResource=tq;function rq(r){return{name:r.name,version:r.version}}be.createInstrumentationScope=rq;function sO(r){return Object.keys(r).map(e=>Xu(e,r[e]))}be.toAttributes=sO;function Xu(r,e){return{key:r,value:Qu(e)}}be.toKeyValue=Xu;function Qu(r){let e=typeof r;return e==="string"?{stringValue:r}:e==="number"?Number.isInteger(r)?{intValue:r}:{doubleValue:r}:e==="boolean"?{boolValue:r}:r instanceof Uint8Array?{bytesValue:r}:Array.isArray(r)?{arrayValue:{values:r.map(Qu)}}:e==="object"&&r!=null?{kvlistValue:{values:Object.entries(r).map(([t,n])=>Xu(t,n))}}:{}}be.toAnyValue=Qu});var cO=_(Ci=>{"use strict";Object.defineProperty(Ci,"__esModule",{value:!0});Ci.hexToBinary=void 0;function aO(r){return r>=48&&r<=57?r-48:r>=97&&r<=102?r-87:r-55}function nq(r){let e=new Uint8Array(r.length/2),t=0;for(let n=0;n<r.length;n+=2){let o=aO(r.charCodeAt(n)),s=aO(r.charCodeAt(n+1));e[t++]=o<<4|s}return e}Ci.hexToBinary=nq});var pO=_(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.getOtlpEncoder=ye.encodeAsString=ye.encodeAsLongBits=ye.toLongBits=ye.hrTimeToNanos=void 0;var oq=y(),Ju=cO();function Zu(r){let e=BigInt(1e9);return BigInt(r[0])*e+BigInt(r[1])}ye.hrTimeToNanos=Zu;function _O(r){let e=Number(BigInt.asUintN(32,r)),t=Number(BigInt.asUintN(32,r>>BigInt(32)));return{low:e,high:t}}ye.toLongBits=_O;function e_(r){let e=Zu(r);return _O(e)}ye.encodeAsLongBits=e_;function lO(r){return Zu(r).toString()}ye.encodeAsString=lO;var sq=typeof BigInt<"u"?lO:oq.hrTimeToNanoseconds;function uO(r){return r}function EO(r){if(r!==void 0)return(0,Ju.hexToBinary)(r)}var iq={encodeHrTime:e_,encodeSpanContext:Ju.hexToBinary,encodeOptionalSpanContext:EO};function aq(r){if(r===void 0)return iq;let e=r.useLongBits??!0,t=r.useHex??!1;return{encodeHrTime:e?e_:sq,encodeSpanContext:t?uO:Ju.hexToBinary,encodeOptionalSpanContext:t?uO:EO}}ye.getOtlpEncoder=aq});var t_=_(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.createExportTraceServiceRequest=et.toOtlpSpanEvent=et.toOtlpLink=et.sdkSpanToOtlpSpan=void 0;var vn=iO(),cq=pO();function dO(r,e){let t=r.spanContext(),n=r.status,o=r.parentSpanContext?.spanId?e.encodeSpanContext(r.parentSpanContext?.spanId):void 0;return{traceId:e.encodeSpanContext(t.traceId),spanId:e.encodeSpanContext(t.spanId),parentSpanId:o,traceState:t.traceState?.serialize(),name:r.name,kind:r.kind==null?0:r.kind+1,startTimeUnixNano:e.encodeHrTime(r.startTime),endTimeUnixNano:e.encodeHrTime(r.endTime),attributes:(0,vn.toAttributes)(r.attributes),droppedAttributesCount:r.droppedAttributesCount,events:r.events.map(s=>SO(s,e)),droppedEventsCount:r.droppedEventsCount,status:{code:n.code,message:n.message},links:r.links.map(s=>TO(s,e)),droppedLinksCount:r.droppedLinksCount}}et.sdkSpanToOtlpSpan=dO;function TO(r,e){return{attributes:r.attributes?(0,vn.toAttributes)(r.attributes):[],spanId:e.encodeSpanContext(r.context.spanId),traceId:e.encodeSpanContext(r.context.traceId),traceState:r.context.traceState?.serialize(),droppedAttributesCount:r.droppedAttributesCount||0}}et.toOtlpLink=TO;function SO(r,e){return{attributes:r.attributes?(0,vn.toAttributes)(r.attributes):[],name:r.name,timeUnixNano:e.encodeHrTime(r.time),droppedAttributesCount:r.droppedAttributesCount||0}}et.toOtlpSpanEvent=SO;function uq(r,e){let t=(0,cq.getOtlpEncoder)(e);return{resourceSpans:lq(r,t)}}et.createExportTraceServiceRequest=uq;function _q(r){let e=new Map;for(let t of r){let n=e.get(t.resource);n||(n=new Map,e.set(t.resource,n));let o=`${t.instrumentationScope.name}@${t.instrumentationScope.version||""}:${t.instrumentationScope.schemaUrl||""}`,s=n.get(o);s||(s=[],n.set(o,s)),s.push(t)}return e}function lq(r,e){let t=_q(r),n=[],o=t.entries(),s=o.next();for(;!s.done;){let[i,a]=s.value,c=[],u=a.values(),l=u.next();for(;!l.done;){let A=l.value;if(A.length>0){let M=A.map(g=>dO(g,e));c.push({scope:(0,vn.createInstrumentationScope)(A[0].instrumentationScope),spans:M,schemaUrl:A[0].instrumentationScope.schemaUrl})}l=u.next()}let p=(0,vn.createResource)(i),T={resource:p,scopeSpans:c,schemaUrl:p.schemaUrl};n.push(T),s=o.next()}return n}});var r_=_(Li=>{"use strict";Object.defineProperty(Li,"__esModule",{value:!0});Li.JsonTraceSerializer=void 0;var Eq=t_();Li.JsonTraceSerializer={serializeRequest:r=>{let e=(0,Eq.createExportTraceServiceRequest)(r,{useHex:!0,useLongBits:!1});return new TextEncoder().encode(JSON.stringify(e))},deserializeResponse:r=>{if(r.length===0)return{};let e=new TextDecoder;return JSON.parse(e.decode(r))}}});var hO=_((E3,AO)=>{"use strict";AO.exports=Tq;function Tq(r,e){for(var t=new Array(arguments.length-1),n=0,o=2,s=!0;o<arguments.length;)t[n++]=arguments[o++];return new Promise(function(a,c){t[n]=function(l){if(s)if(s=!1,l)c(l);else{for(var p=new Array(arguments.length-1),T=0;T<p.length;)p[T++]=arguments[T];a.apply(null,p)}};try{r.apply(e||null,t)}catch(u){s&&(s=!1,c(u))}})}});var OO=_(RO=>{"use strict";var bi=RO;bi.length=function(e){var t=e.length;if(!t)return 0;for(var n=0;--t%4>1&&e.charAt(t)==="=";)++n;return Math.ceil(e.length*3)/4-n};var jr=new Array(64),gO=new Array(123);for(Ve=0;Ve<64;)gO[jr[Ve]=Ve<26?Ve+65:Ve<52?Ve+71:Ve<62?Ve-4:Ve-59|43]=Ve++;var Ve;bi.encode=function(e,t,n){for(var o=null,s=[],i=0,a=0,c;t<n;){var u=e[t++];switch(a){case 0:s[i++]=jr[u>>2],c=(u&3)<<4,a=1;break;case 1:s[i++]=jr[c|u>>4],c=(u&15)<<2,a=2;break;case 2:s[i++]=jr[c|u>>6],s[i++]=jr[u&63],a=0;break}i>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),i=0)}return a&&(s[i++]=jr[c],s[i++]=61,a===1&&(s[i++]=61)),o?(i&&o.push(String.fromCharCode.apply(String,s.slice(0,i))),o.join("")):String.fromCharCode.apply(String,s.slice(0,i))};var mO="invalid encoding";bi.decode=function(e,t,n){for(var o=n,s=0,i,a=0;a<e.length;){var c=e.charCodeAt(a++);if(c===61&&s>1)break;if((c=gO[c])===void 0)throw Error(mO);switch(s){case 0:i=c,s=1;break;case 1:t[n++]=i<<2|(c&48)>>4,i=c,s=2;break;case 2:t[n++]=(i&15)<<4|(c&60)>>2,i=c,s=3;break;case 3:t[n++]=(i&3)<<6|c,s=0;break}}if(s===1)throw Error(mO);return n-o};bi.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var MO=_((d3,PO)=>{"use strict";PO.exports=yi;function yi(){this._listeners={}}yi.prototype.on=function(e,t,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:n||this}),this};yi.prototype.off=function(e,t){if(e===void 0)this._listeners={};else if(t===void 0)this._listeners[e]=[];else for(var n=this._listeners[e],o=0;o<n.length;)n[o].fn===t?n.splice(o,1):++o;return this};yi.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var n=[],o=1;o<arguments.length;)n.push(arguments[o++]);for(o=0;o<t.length;)t[o].fn.apply(t[o++].ctx,n)}return this}});var vO=_((T3,yO)=>{"use strict";yO.exports=NO(NO);function NO(r){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),t=new Uint8Array(e.buffer),n=t[3]===128;function o(c,u,l){e[0]=c,u[l]=t[0],u[l+1]=t[1],u[l+2]=t[2],u[l+3]=t[3]}function s(c,u,l){e[0]=c,u[l]=t[3],u[l+1]=t[2],u[l+2]=t[1],u[l+3]=t[0]}r.writeFloatLE=n?o:s,r.writeFloatBE=n?s:o;function i(c,u){return t[0]=c[u],t[1]=c[u+1],t[2]=c[u+2],t[3]=c[u+3],e[0]}function a(c,u){return t[3]=c[u],t[2]=c[u+1],t[1]=c[u+2],t[0]=c[u+3],e[0]}r.readFloatLE=n?i:a,r.readFloatBE=n?a:i}():function(){function e(n,o,s,i){var a=o<0?1:0;if(a&&(o=-o),o===0)n(1/o>0?0:2147483648,s,i);else if(isNaN(o))n(2143289344,s,i);else if(o>34028234663852886e22)n((a<<31|2139095040)>>>0,s,i);else if(o<11754943508222875e-54)n((a<<31|Math.round(o/1401298464324817e-60))>>>0,s,i);else{var c=Math.floor(Math.log(o)/Math.LN2),u=Math.round(o*Math.pow(2,-c)*8388608)&8388607;n((a<<31|c+127<<23|u)>>>0,s,i)}}r.writeFloatLE=e.bind(null,CO),r.writeFloatBE=e.bind(null,LO);function t(n,o,s){var i=n(o,s),a=(i>>31)*2+1,c=i>>>23&255,u=i&8388607;return c===255?u?NaN:a*(1/0):c===0?a*1401298464324817e-60*u:a*Math.pow(2,c-150)*(u+8388608)}r.readFloatLE=t.bind(null,IO),r.readFloatBE=t.bind(null,bO)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),t=new Uint8Array(e.buffer),n=t[7]===128;function o(c,u,l){e[0]=c,u[l]=t[0],u[l+1]=t[1],u[l+2]=t[2],u[l+3]=t[3],u[l+4]=t[4],u[l+5]=t[5],u[l+6]=t[6],u[l+7]=t[7]}function s(c,u,l){e[0]=c,u[l]=t[7],u[l+1]=t[6],u[l+2]=t[5],u[l+3]=t[4],u[l+4]=t[3],u[l+5]=t[2],u[l+6]=t[1],u[l+7]=t[0]}r.writeDoubleLE=n?o:s,r.writeDoubleBE=n?s:o;function i(c,u){return t[0]=c[u],t[1]=c[u+1],t[2]=c[u+2],t[3]=c[u+3],t[4]=c[u+4],t[5]=c[u+5],t[6]=c[u+6],t[7]=c[u+7],e[0]}function a(c,u){return t[7]=c[u],t[6]=c[u+1],t[5]=c[u+2],t[4]=c[u+3],t[3]=c[u+4],t[2]=c[u+5],t[1]=c[u+6],t[0]=c[u+7],e[0]}r.readDoubleLE=n?i:a,r.readDoubleBE=n?a:i}():function(){function e(n,o,s,i,a,c){var u=i<0?1:0;if(u&&(i=-i),i===0)n(0,a,c+o),n(1/i>0?0:2147483648,a,c+s);else if(isNaN(i))n(0,a,c+o),n(2146959360,a,c+s);else if(i>17976931348623157e292)n(0,a,c+o),n((u<<31|2146435072)>>>0,a,c+s);else{var l;if(i<22250738585072014e-324)l=i/5e-324,n(l>>>0,a,c+o),n((u<<31|l/4294967296)>>>0,a,c+s);else{var p=Math.floor(Math.log(i)/Math.LN2);p===1024&&(p=1023),l=i*Math.pow(2,-p),n(l*4503599627370496>>>0,a,c+o),n((u<<31|p+1023<<20|l*1048576&1048575)>>>0,a,c+s)}}}r.writeDoubleLE=e.bind(null,CO,0,4),r.writeDoubleBE=e.bind(null,LO,4,0);function t(n,o,s,i,a){var c=n(i,a+o),u=n(i,a+s),l=(u>>31)*2+1,p=u>>>20&2047,T=4294967296*(u&1048575)+c;return p===2047?T?NaN:l*(1/0):p===0?l*5e-324*T:l*Math.pow(2,p-1075)*(T+4503599627370496)}r.readDoubleLE=t.bind(null,IO,0,4),r.readDoubleBE=t.bind(null,bO,4,0)}(),r}function CO(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}function LO(r,e,t){e[t]=r>>>24,e[t+1]=r>>>16&255,e[t+2]=r>>>8&255,e[t+3]=r&255}function IO(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16|r[e+3]<<24)>>>0}function bO(r,e){return(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}});var xO=_((exports,module)=>{"use strict";module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(r){}return null}});var UO=_(DO=>{"use strict";var o_=DO;o_.length=function(e){for(var t=0,n=0,o=0;o<e.length;++o)n=e.charCodeAt(o),n<128?t+=1:n<2048?t+=2:(n&64512)===55296&&(e.charCodeAt(o+1)&64512)===56320?(++o,t+=4):t+=3;return t};o_.read=function(e,t,n){var o=n-t;if(o<1)return"";for(var s=null,i=[],a=0,c;t<n;)c=e[t++],c<128?i[a++]=c:c>191&&c<224?i[a++]=(c&31)<<6|e[t++]&63:c>239&&c<365?(c=((c&7)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63)-65536,i[a++]=55296+(c>>10),i[a++]=56320+(c&1023)):i[a++]=(c&15)<<12|(e[t++]&63)<<6|e[t++]&63,a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,i)),a=0);return s?(a&&s.push(String.fromCharCode.apply(String,i.slice(0,a))),s.join("")):String.fromCharCode.apply(String,i.slice(0,a))};o_.write=function(e,t,n){for(var o=n,s,i,a=0;a<e.length;++a)s=e.charCodeAt(a),s<128?t[n++]=s:s<2048?(t[n++]=s>>6|192,t[n++]=s&63|128):(s&64512)===55296&&((i=e.charCodeAt(a+1))&64512)===56320?(s=65536+((s&1023)<<10)+(i&1023),++a,t[n++]=s>>18|240,t[n++]=s>>12&63|128,t[n++]=s>>6&63|128,t[n++]=s&63|128):(t[n++]=s>>12|224,t[n++]=s>>6&63|128,t[n++]=s&63|128);return n-o}});var VO=_((f3,wO)=>{"use strict";wO.exports=Sq;function Sq(r,e,t){var n=t||8192,o=n>>>1,s=null,i=n;return function(c){if(c<1||c>o)return r(c);i+c>n&&(s=r(n),i=0);var u=e.call(s,i,i+=c);return i&7&&(i=(i|7)+1),u}}});var GO=_((A3,BO)=>{"use strict";BO.exports=ne;var xn=mt();function ne(r,e){this.lo=r>>>0,this.hi=e>>>0}var Kt=ne.zero=new ne(0,0);Kt.toNumber=function(){return 0};Kt.zzEncode=Kt.zzDecode=function(){return this};Kt.length=function(){return 1};var fq=ne.zeroHash="\0\0\0\0\0\0\0\0";ne.fromNumber=function(e){if(e===0)return Kt;var t=e<0;t&&(e=-e);var n=e>>>0,o=(e-n)/4294967296>>>0;return t&&(o=~o>>>0,n=~n>>>0,++n>4294967295&&(n=0,++o>4294967295&&(o=0))),new ne(n,o)};ne.from=function(e){if(typeof e=="number")return ne.fromNumber(e);if(xn.isString(e))if(xn.Long)e=xn.Long.fromString(e);else return ne.fromNumber(parseInt(e,10));return e.low||e.high?new ne(e.low>>>0,e.high>>>0):Kt};ne.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=~this.lo+1>>>0,n=~this.hi>>>0;return t||(n=n+1>>>0),-(t+n*4294967296)}return this.lo+this.hi*4294967296};ne.prototype.toLong=function(e){return xn.Long?new xn.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var ht=String.prototype.charCodeAt;ne.fromHash=function(e){return e===fq?Kt:new ne((ht.call(e,0)|ht.call(e,1)<<8|ht.call(e,2)<<16|ht.call(e,3)<<24)>>>0,(ht.call(e,4)|ht.call(e,5)<<8|ht.call(e,6)<<16|ht.call(e,7)<<24)>>>0)};ne.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};ne.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this};ne.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this};ne.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?t===0?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}});var mt=_(s_=>{"use strict";var f=s_;f.asPromise=hO();f.base64=OO();f.EventEmitter=MO();f.float=vO();f.inquire=xO();f.utf8=UO();f.pool=VO();f.LongBits=GO();f.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);f.global=f.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||s_;f.emptyArray=Object.freeze?Object.freeze([]):[];f.emptyObject=Object.freeze?Object.freeze({}):{};f.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};f.isString=function(e){return typeof e=="string"||e instanceof String};f.isObject=function(e){return e&&typeof e=="object"};f.isset=f.isSet=function(e,t){var n=e[t];return n!=null&&e.hasOwnProperty(t)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};f.Buffer=function(){try{var r=f.inquire("buffer").Buffer;return r.prototype.utf8Write?r:null}catch{return null}}();f._Buffer_from=null;f._Buffer_allocUnsafe=null;f.newBuffer=function(e){return typeof e=="number"?f.Buffer?f._Buffer_allocUnsafe(e):new f.Array(e):f.Buffer?f._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};f.Array=typeof Uint8Array<"u"?Uint8Array:Array;f.Long=f.global.dcodeIO&&f.global.dcodeIO.Long||f.global.Long||f.inquire("long");f.key2Re=/^true|false|0|1$/;f.key32Re=/^-?(?:0|[1-9][0-9]*)$/;f.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;f.longToHash=function(e){return e?f.LongBits.from(e).toHash():f.LongBits.zeroHash};f.longFromHash=function(e,t){var n=f.LongBits.fromHash(e);return f.Long?f.Long.fromBits(n.lo,n.hi,t):n.toNumber(!!t)};function HO(r,e,t){for(var n=Object.keys(e),o=0;o<n.length;++o)(r[n[o]]===void 0||!t)&&(r[n[o]]=e[n[o]]);return r}f.merge=HO;f.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)};function FO(r){function e(t,n){if(!(this instanceof e))return new e(t,n);Object.defineProperty(this,"message",{get:function(){return t}}),Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:new Error().stack||""}),n&&HO(this,n)}return e.prototype=Object.create(Error.prototype,{constructor:{value:e,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return r},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),e}f.newError=FO;f.ProtocolError=FO("ProtocolError");f.oneOfGetter=function(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=1;return function(){for(var o=Object.keys(this),s=o.length-1;s>-1;--s)if(t[o[s]]===1&&this[o[s]]!==void 0&&this[o[s]]!==null)return o[s]}};f.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}};f.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};f._configure=function(){var r=f.Buffer;if(!r){f._Buffer_from=f._Buffer_allocUnsafe=null;return}f._Buffer_from=r.from!==Uint8Array.from&&r.from||function(t,n){return new r(t,n)},f._Buffer_allocUnsafe=r.allocUnsafe||function(t){return new r(t)}}});var E_=_((m3,YO)=>{"use strict";YO.exports=b;var ve=mt(),i_,vi=ve.LongBits,qO=ve.base64,jO=ve.utf8;function Dn(r,e,t){this.fn=r,this.len=e,this.next=void 0,this.val=t}function c_(){}function Aq(r){this.head=r.head,this.tail=r.tail,this.len=r.len,this.next=r.states}function b(){this.len=0,this.head=new Dn(c_,0,0),this.tail=this.head,this.states=null}var kO=function(){return ve.Buffer?function(){return(b.create=function(){return new i_})()}:function(){return new b}};b.create=kO();b.alloc=function(e){return new ve.Array(e)};ve.Array!==Array&&(b.alloc=ve.pool(b.alloc,ve.Array.prototype.subarray));b.prototype._push=function(e,t,n){return this.tail=this.tail.next=new Dn(e,t,n),this.len+=t,this};function u_(r,e,t){e[t]=r&255}function hq(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}function __(r,e){this.len=r,this.next=void 0,this.val=e}__.prototype=Object.create(Dn.prototype);__.prototype.fn=hq;b.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new __((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};b.prototype.int32=function(e){return e<0?this._push(l_,10,vi.fromNumber(e)):this.uint32(e)};b.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function l_(r,e,t){for(;r.hi;)e[t++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)e[t++]=r.lo&127|128,r.lo=r.lo>>>7;e[t++]=r.lo}b.prototype.uint64=function(e){var t=vi.from(e);return this._push(l_,t.length(),t)};b.prototype.int64=b.prototype.uint64;b.prototype.sint64=function(e){var t=vi.from(e).zzEncode();return this._push(l_,t.length(),t)};b.prototype.bool=function(e){return this._push(u_,1,e?1:0)};function a_(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}b.prototype.fixed32=function(e){return this._push(a_,4,e>>>0)};b.prototype.sfixed32=b.prototype.fixed32;b.prototype.fixed64=function(e){var t=vi.from(e);return this._push(a_,4,t.lo)._push(a_,4,t.hi)};b.prototype.sfixed64=b.prototype.fixed64;b.prototype.float=function(e){return this._push(ve.float.writeFloatLE,4,e)};b.prototype.double=function(e){return this._push(ve.float.writeDoubleLE,8,e)};var mq=ve.Array.prototype.set?function(e,t,n){t.set(e,n)}:function(e,t,n){for(var o=0;o<e.length;++o)t[n+o]=e[o]};b.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(u_,1,0);if(ve.isString(e)){var n=b.alloc(t=qO.length(e));qO.decode(e,n,0),e=n}return this.uint32(t)._push(mq,t,e)};b.prototype.string=function(e){var t=jO.length(e);return t?this.uint32(t)._push(jO.write,t,e):this._push(u_,1,0)};b.prototype.fork=function(){return this.states=new Aq(this),this.head=this.tail=new Dn(c_,0,0),this.len=0,this};b.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Dn(c_,0,0),this.len=0),this};b.prototype.ldelim=function(){var e=this.head,t=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=t,this.len+=n),this};b.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t};b._configure=function(r){i_=r,b.create=kO(),i_._configure()}});var WO=_((g3,KO)=>{"use strict";KO.exports=tt;var $O=E_();(tt.prototype=Object.create($O.prototype)).constructor=tt;var gt=mt();function tt(){$O.call(this)}tt._configure=function(){tt.alloc=gt._Buffer_allocUnsafe,tt.writeBytesBuffer=gt.Buffer&&gt.Buffer.prototype instanceof Uint8Array&&gt.Buffer.prototype.set.name==="set"?function(e,t,n){t.set(e,n)}:function(e,t,n){if(e.copy)e.copy(t,n,0,e.length);else for(var o=0;o<e.length;)t[n++]=e[o++]}};tt.prototype.bytes=function(e){gt.isString(e)&&(e=gt._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(tt.writeBytesBuffer,t,e),this};function gq(r,e,t){r.length<40?gt.utf8.write(r,e,t):e.utf8Write?e.utf8Write(r,t):e.write(r,t)}tt.prototype.string=function(e){var t=gt.Buffer.byteLength(e);return this.uint32(t),t&&this._push(gq,t,e),this};tt._configure()});var T_=_((R3,ZO)=>{"use strict";ZO.exports=X;var Be=mt(),d_,QO=Be.LongBits,Rq=Be.utf8;function Ge(r,e){return RangeError("index out of range: "+r.pos+" + "+(e||1)+" > "+r.len)}function X(r){this.buf=r,this.pos=0,this.len=r.length}var zO=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new X(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new X(e);throw Error("illegal buffer")},JO=function(){return Be.Buffer?function(t){return(X.create=function(o){return Be.Buffer.isBuffer(o)?new d_(o):zO(o)})(t)}:zO};X.create=JO();X.prototype._slice=Be.Array.prototype.subarray||Be.Array.prototype.slice;X.prototype.uint32=function(){var e=4294967295;return function(){if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,Ge(this,10);return e}}();X.prototype.int32=function(){return this.uint32()|0};X.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function p_(){var r=new QO(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(r.lo=(r.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return r;if(r.lo=(r.lo|(this.buf[this.pos]&127)<<28)>>>0,r.hi=(r.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return r;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw Ge(this);if(r.lo=(r.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return r}return r.lo=(r.lo|(this.buf[this.pos++]&127)<<e*7)>>>0,r}if(this.len-this.pos>4){for(;e<5;++e)if(r.hi=(r.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return r}else for(;e<5;++e){if(this.pos>=this.len)throw Ge(this);if(r.hi=(r.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return r}throw Error("invalid varint encoding")}X.prototype.bool=function(){return this.uint32()!==0};function xi(r,e){return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0}X.prototype.fixed32=function(){if(this.pos+4>this.len)throw Ge(this,4);return xi(this.buf,this.pos+=4)};X.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Ge(this,4);return xi(this.buf,this.pos+=4)|0};function XO(){if(this.pos+8>this.len)throw Ge(this,8);return new QO(xi(this.buf,this.pos+=4),xi(this.buf,this.pos+=4))}X.prototype.float=function(){if(this.pos+4>this.len)throw Ge(this,4);var e=Be.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};X.prototype.double=function(){if(this.pos+8>this.len)throw Ge(this,4);var e=Be.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};X.prototype.bytes=function(){var e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw Ge(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(t,n);if(t===n){var o=Be.Buffer;return o?o.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,t,n)};X.prototype.string=function(){var e=this.bytes();return Rq.read(e,0,e.length)};X.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Ge(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Ge(this);while(this.buf[this.pos++]&128);return this};X.prototype.skipType=function(r){switch(r){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(r=this.uint32()&7)!==4;)this.skipType(r);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+r+" at offset "+this.pos)}return this};X._configure=function(r){d_=r,X.create=JO(),d_._configure();var e=Be.Long?"toLong":"toNumber";Be.merge(X.prototype,{int64:function(){return p_.call(this)[e](!1)},uint64:function(){return p_.call(this)[e](!0)},sint64:function(){return p_.call(this).zzDecode()[e](!1)},fixed64:function(){return XO.call(this)[e](!0)},sfixed64:function(){return XO.call(this)[e](!1)}})}});var nP=_((O3,rP)=>{"use strict";rP.exports=Wt;var tP=T_();(Wt.prototype=Object.create(tP.prototype)).constructor=Wt;var eP=mt();function Wt(r){tP.call(this,r)}Wt._configure=function(){eP.Buffer&&(Wt.prototype._slice=eP.Buffer.prototype.slice)};Wt.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))};Wt._configure()});var sP=_((P3,oP)=>{"use strict";oP.exports=Un;var S_=mt();(Un.prototype=Object.create(S_.EventEmitter.prototype)).constructor=Un;function Un(r,e,t){if(typeof r!="function")throw TypeError("rpcImpl must be a function");S_.EventEmitter.call(this),this.rpcImpl=r,this.requestDelimited=!!e,this.responseDelimited=!!t}Un.prototype.rpcCall=function r(e,t,n,o,s){if(!o)throw TypeError("request must be specified");var i=this;if(!s)return S_.asPromise(r,i,e,t,n,o);if(!i.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return i.rpcImpl(e,t[i.requestDelimited?"encodeDelimited":"encode"](o).finish(),function(c,u){if(c)return i.emit("error",c,e),s(c);if(u===null){i.end(!0);return}if(!(u instanceof n))try{u=n[i.responseDelimited?"decodeDelimited":"decode"](u)}catch(l){return i.emit("error",l,e),s(l)}return i.emit("data",u,e),s(null,u)})}catch(a){i.emit("error",a,e),setTimeout(function(){s(a)},0);return}};Un.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var aP=_(iP=>{"use strict";var Oq=iP;Oq.Service=sP()});var uP=_((N3,cP)=>{"use strict";cP.exports={}});var EP=_(lP=>{"use strict";var ge=lP;ge.build="minimal";ge.Writer=E_();ge.BufferWriter=WO();ge.Reader=T_();ge.BufferReader=nP();ge.util=mt();ge.rpc=aP();ge.roots=uP();ge.configure=_P;function _P(){ge.util._configure(),ge.Writer._configure(ge.BufferWriter),ge.Reader._configure(ge.BufferReader)}_P()});var dP=_((L3,pP)=>{"use strict";pP.exports=EP()});var H=Re(Gh(),1);m();un();var LP=Re(Ag(),1),Kr=Re(sn(),1),IP=Re(wg(),1),bP=Re(kR(),1),yP=Re(KR(),1),Rt=Re(y(),1);var WR="http.method",zR="http.url",Pi="http.host",XR="http.scheme",Ku="http.status_code",QR="http.user_agent",Wu="http.response_content_length_uncompressed",JR="net.peer.port",ZR="net.peer.name";var eO="service.name",tO="service.version";m();var XF=Symbol.for("@vercel/request-context");function Ie(){return globalThis[XF]?.get()}function Mi(r){return Object.fromEntries(Object.entries(r).filter(([e,t])=>t!==void 0))}function rO(r){return r?r.split("::").at(-1):void 0}function nO(r=Ie(),e){if(!r)return;let t=e?JF(e,r.headers):void 0;return Mi({[Pi]:r.headers.host,[QR]:r.headers["user-agent"],"http.referer":r.headers.referer,"vercel.request_id":rO(r.headers["x-vercel-id"]),"vercel.matched_path":r.headers["x-matched-path"],"vercel.edge_region":process.env.VERCEL_REGION,...t})}var QF={keys(r){return[]},get(r,e){return r[e.toLocaleLowerCase()]}};function JF(r,e){if(typeof r=="function")return r(e,QF);let t={};for(let[n,o]of Object.entries(r)){let s=e[o.toLocaleLowerCase()];s!==void 0&&(t[n]=s)}return t}m();function Hr(r){return(r&E.TraceFlags.SAMPLED)!==0}var Ni=class{constructor(e,t){this.processors=e;this.attributesFromHeaders=t;this.rootSpanIds=new Map;this.waitSpanEnd=new Map}forceFlush(){return Promise.all(this.processors.map(e=>e.forceFlush().catch(t=>{E.diag.error("@vercel/otel: forceFlush failed:",t)}))).then(()=>{})}shutdown(){return Promise.all(this.processors.map(e=>e.shutdown().catch(()=>{}))).then(()=>{})}onStart(e,t){let{traceId:n,spanId:o,traceFlags:s}=e.spanContext(),i=!e.parentSpanContext?.spanId||!this.rootSpanIds.has(n);if(i?this.rootSpanIds.set(n,{rootSpanId:o,open:[]}):this.rootSpanIds.get(n)?.open.push(e),i&&Hr(s)){let a=Ie(),c=nO(a,this.attributesFromHeaders);c&&e.setAttributes(c),a&&a.waitUntil(async()=>{if(this.rootSpanIds.has(n)){let u=new Promise(p=>{this.waitSpanEnd.set(n,p)}),l;await Promise.race([u,new Promise(p=>{l=setTimeout(()=>{this.waitSpanEnd.delete(n),p(void 0)},50)})]),l&&clearTimeout(l)}return this.forceFlush()})}for(let a of this.processors)a.onStart(e,t)}onEnd(e){let{traceId:t,spanId:n,traceFlags:o}=e.spanContext(),s=Hr(o),i=this.rootSpanIds.get(t),a=i?.rootSpanId===n;if(s){let c=eq(e);c&&Object.assign(e.attributes,c)}if(a){if(this.rootSpanIds.delete(t),i.open.length>0){for(let c of i.open)if(!c.ended&&c.spanContext().spanId!==n)try{c.end()}catch(u){E.diag.error("@vercel/otel: onEnd failed:",u)}}}else if(i)for(let c=0;c<i.open.length;c++)i.open[c]?.spanContext().spanId===n&&i.open.splice(c,1);for(let c of this.processors)c.onEnd(e);if(a){let c=this.waitSpanEnd.get(t);c&&(this.waitSpanEnd.delete(t),c())}}},ZF={[E.SpanKind.INTERNAL]:"internal",[E.SpanKind.SERVER]:"server",[E.SpanKind.CLIENT]:"client",[E.SpanKind.PRODUCER]:"producer",[E.SpanKind.CONSUMER]:"consumer"};function eq(r){let{kind:e,attributes:t}=r,{"operation.name":n,"resource.name":o,"span.type":s,"next.span_type":i,"http.method":a,"http.route":c}=t;if(n)return;let u=o??(a&&typeof a=="string"&&c&&typeof c=="string"?`${a} ${c}`:c);if(r.kind===E.SpanKind.SERVER&&a&&c&&typeof a=="string"&&typeof c=="string")return{"operation.name":"web.request","resource.name":u};let l=r.instrumentationScope.name,p=i??s;if(p&&typeof p=="string"){let T=oO(l,p);return c?{"operation.name":T,"resource.name":u}:{"operation.name":T}}return{"operation.name":oO(l,e===E.SpanKind.INTERNAL?"":ZF[e])}}function oO(r,e){if(!r)return e;let t=r.replace(/[ @./]/g,"_");return t.startsWith("_")&&(t=t.slice(1)),e?`${t}.${e}`:t}var fO=Re(r_(),1);m();var Fr=class{constructor(e={}){this._shutdownOnce={isCalled:!1};this._sendingPromises=[];this.url=e.url||this.getDefaultUrl(e),e.headers&&(this._headers=e.headers),this.onInit()}onShutdown(){E.diag.debug("@vercel/otel/otlp: onShutdown")}onInit(){E.diag.debug("@vercel/otel/otlp: onInit")}export(e,t){if(this._shutdownOnce.isCalled){E.diag.debug("@vercel/otel/otlp: Shutdown already started. Cannot send objects");return}this.send(e,()=>t({code:0}),n=>t({code:1,error:n}))}async forceFlush(){await Promise.all(this._sendingPromises)}async shutdown(){this._shutdownOnce.isCalled=!0,this.onShutdown(),await this.forceFlush()}send(e,t,n){if(this._shutdownOnce.isCalled){E.diag.debug("@vercel/otel/otlp: Shutdown already started. Cannot send objects");return}let o=this.convert(e),s,i,a;try{({body:s,contentType:i,headers:a}=this.toMessage(o))}catch(u){E.diag.warn("@vercel/otel/otlp: no proto",u);return}let c=fetch(this.url,{method:"POST",body:s,headers:{...this._headers,...a,"Content-Type":i,"User-Agent":"OTel-OTLP-Exporter-JavaScript/0.46.0"},next:{internal:!0}}).then(u=>{E.diag.debug("@vercel/otel/otlp: onSuccess",u.status,u.statusText),t(),u.arrayBuffer().catch(()=>{})}).catch(u=>{E.diag.error("@vercel/otel/otlp: onError",u),n(u)}).finally(()=>{let u=this._sendingPromises.indexOf(c);this._sendingPromises.splice(u,1)});this._sendingPromises.push(c)}};var pq="v1/traces",dq=`http://localhost:4318/${pq}`;function Ii(r){return typeof r.url=="string"?r.url:dq}var qr=class{constructor(e={}){this.impl=new n_(e)}export(e,t){this.impl.export(e,t)}shutdown(){return this.impl.shutdown()}forceFlush(){return this.impl.forceFlush()}},n_=class extends Fr{convert(e){return e}toMessage(e){let t=fO.JsonTraceSerializer.serializeRequest(e);return{body:new TextDecoder().decode(t),contentType:"application/json"}}getDefaultUrl(e){return Ii(e)}};var AP=Re(t_(),1);var TP=Re(dP(),1);function SP(r){let e=new TP.Writer;return Pq(r,e),e.finish()}function Pq(r,e){if(r.resourceSpans!=null&&r.resourceSpans.length)for(let t=0;t<r.resourceSpans.length;++t)Mq(r.resourceSpans[t],e.uint32(10).fork()).ldelim();return e}function Mq(r,e){if(r.resource!=null&&Nq(r.resource,e.uint32(10).fork()).ldelim(),r.scopeSpans!=null&&r.scopeSpans.length)for(let t=0;t<r.scopeSpans.length;++t)Cq(r.scopeSpans[t],e.uint32(18).fork()).ldelim();return r.schemaUrl!=null&&e.uint32(26).string(r.schemaUrl),e}function Nq(r,e){if(r.attributes!=null&&r.attributes.length)for(let t=0;t<r.attributes.length;++t)kr(r.attributes[t],e.uint32(10).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(16).uint32(r.droppedAttributesCount),e}function Cq(r,e){if(r.scope!=null&&bq(r.scope,e.uint32(10).fork()).ldelim(),r.spans!=null&&r.spans.length)for(let t=0;t<r.spans.length;++t)yq(r.spans[t],e.uint32(18).fork()).ldelim();return r.schemaUrl!=null&&e.uint32(26).string(r.schemaUrl),e}function kr(r,e){return r.key!=null&&e.uint32(10).string(r.key),r.value!=null&&fP(r.value,e.uint32(18).fork()).ldelim(),e}function fP(r,e){return r.stringValue!=null&&e.uint32(10).string(r.stringValue),r.boolValue!=null&&e.uint32(16).bool(r.boolValue),r.intValue!=null&&e.uint32(24).int64(r.intValue),r.doubleValue!=null&&e.uint32(33).double(r.doubleValue),r.arrayValue!=null&&Lq(r.arrayValue,e.uint32(42).fork()).ldelim(),r.kvlistValue!=null&&Iq(r.kvlistValue,e.uint32(50).fork()).ldelim(),r.bytesValue!=null&&e.uint32(58).bytes(r.bytesValue),e}function Lq(r,e){if(r.values!=null&&r.values.length)for(let t=0;t<r.values.length;++t)fP(r.values[t],e.uint32(10).fork()).ldelim();return e}function Iq(r,e){if(r.values!=null&&r.values.length)for(let t=0;t<r.values.length;++t)kr(r.values[t],e.uint32(10).fork()).ldelim();return e}function bq(r,e){if(r.name!=null&&e.uint32(10).string(r.name),r.version!=null&&e.uint32(18).string(r.version),r.attributes!=null&&r.attributes.length)for(let t=0;t<r.attributes.length;++t)kr(r.attributes[t],e.uint32(26).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(32).uint32(r.droppedAttributesCount),e}function yq(r,e){if(r.traceId!=null&&e.uint32(10).bytes(r.traceId),r.spanId!=null&&e.uint32(18).bytes(r.spanId),r.traceState!=null&&e.uint32(26).string(r.traceState),r.parentSpanId!=null&&e.uint32(34).bytes(r.parentSpanId),r.name!=null&&e.uint32(42).string(r.name),r.kind!=null&&e.uint32(48).int32(r.kind),r.startTimeUnixNano!=null&&e.uint32(57).fixed64(r.startTimeUnixNano),r.endTimeUnixNano!=null&&e.uint32(65).fixed64(r.endTimeUnixNano),r.attributes!=null&&r.attributes.length)for(let t=0;t<r.attributes.length;++t)kr(r.attributes[t],e.uint32(74).fork()).ldelim();if(r.droppedAttributesCount!=null&&e.uint32(80).uint32(r.droppedAttributesCount),r.events!=null&&r.events.length)for(let t=0;t<r.events.length;++t)xq(r.events[t],e.uint32(90).fork()).ldelim();if(r.droppedEventsCount!=null&&e.uint32(96).uint32(r.droppedEventsCount),r.links!=null&&r.links.length)for(let t=0;t<r.links.length;++t)Dq(r.links[t],e.uint32(106).fork()).ldelim();return r.droppedLinksCount!=null&&e.uint32(112).uint32(r.droppedLinksCount),r.status!=null&&vq(r.status,e.uint32(122).fork()).ldelim(),e}function vq(r,e){return r.message!=null&&e.uint32(18).string(r.message),r.code!=null&&e.uint32(24).int32(r.code),e}function xq(r,e){if(r.timeUnixNano!=null&&e.uint32(9).fixed64(r.timeUnixNano),r.name!=null&&e.uint32(18).string(r.name),r.attributes!=null&&r.attributes.length)for(let t=0;t<r.attributes.length;++t)kr(r.attributes[t],e.uint32(26).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(32).uint32(r.droppedAttributesCount),e}function Dq(r,e){if(r.traceId!=null&&e.uint32(10).bytes(r.traceId),r.spanId!=null&&e.uint32(18).bytes(r.spanId),r.traceState!=null&&e.uint32(26).string(r.traceState),r.attributes!=null&&r.attributes.length)for(let t=0;t<r.attributes.length;++t)kr(r.attributes[t],e.uint32(34).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(40).uint32(r.droppedAttributesCount),e}var zt=class{constructor(e={}){this.impl=new f_(e)}export(e,t){this.impl.export(e,t)}shutdown(){return this.impl.shutdown()}forceFlush(){return this.impl.forceFlush()}},f_=class extends Fr{convert(e){return(0,AP.createExportTraceServiceRequest)(e)}toMessage(e){return{body:SP(e),contentType:"application/x-protobuf",headers:{accept:"application/x-protobuf"}}}getDefaultUrl(e){return Ii(e)}};m();function hP(r,e){return r.replace(/\{(?<temp1>[^{}]+)\}/g,(t,n)=>{let o=e[n];return o!==void 0?String(o):t})}var Yr=class{constructor(e={}){this.instrumentationName="@vercel/otel/fetch";this.instrumentationVersion="1.0.0";this.config=e}getConfig(){return this.config}setConfig(){}setTracerProvider(e){this.tracerProvider=e}setMeterProvider(){}shouldIgnore(e,t){let n=this.config.ignoreUrls??[];if(t?.opentelemetry?.ignore!==void 0)return t.opentelemetry.ignore;if(n.length===0)return!1;let o=e.toString();return n.some(s=>typeof s=="string"?s==="*"?!0:o.startsWith(s):s.test(o))}shouldPropagate(e,t){let n=process.env.VERCEL_URL||null,o=process.env.VERCEL_BRANCH_URL||null,s=this.config.propagateContextUrls??[],i=this.config.dontPropagateContextUrls??[];if(t?.opentelemetry?.propagateContext)return t.opentelemetry.propagateContext;let a=e.toString();return i.length>0&&i.some(c=>typeof c=="string"?c==="*"?!0:a.startsWith(c):c.test(a))?!1:n&&e.protocol==="https:"&&(e.host===n||e.host===o||e.host===Ie()?.headers.host)||!n&&e.protocol==="http:"&&e.hostname==="localhost"?!0:s.some(c=>typeof c=="string"?c==="*"?!0:a.startsWith(c):c.test(a))}startSpan({tracer:e,url:t,fetchType:n,method:o="GET",name:s,attributes:i={}}){let a=this.config.resourceNameTemplate,c={[WR]:o,[zR]:t.toString(),[Pi]:t.host,[XR]:t.protocol.replace(":",""),[ZR]:t.hostname,[JR]:t.port},u=a?hP(a,c):Vq(t.toString()),l=s??`${n} ${o} ${t.toString()}`,p=E.context.active();return e.startSpan(l,{kind:E.SpanKind.CLIENT,attributes:{...c,"operation.name":`${n}.${o}`,"http.client.name":n,"resource.name":u,...i}},p)}instrumentHttp(e,t){let{tracerProvider:n}=this;if(!n)return;let o=n.getTracer(this.instrumentationName,this.instrumentationVersion),{attributesFromRequestHeaders:s,attributesFromResponseHeaders:i}=this.config,a=e.request,c=e.get,u=l=>(p,T,A)=>{let M,g={},O;if(typeof p=="string"||p instanceof URL?(M=new URL(p.toString()),typeof T=="function"?O=T:T&&typeof A=="function"?(g=T,O=A):T&&(g=T)):(g=p,typeof T=="function"&&(O=T),M=Gq(g,t)),this.shouldIgnore(M))return l.apply(this,[M,g,O]);let P=this.startSpan({tracer:o,url:M,fetchType:"http",method:g.method||"GET"});if(!P.isRecording()||!Hr(P.spanContext().traceFlags))return P.end(),l.apply(this,[M,g,O]);if(this.shouldPropagate(M)){let F=E.context.active(),$=E.trace.setSpan(F,P);E.propagation.inject($,g.headers||{},wq)}s&&Di(P,s,g.headers||{},gP);try{let F=Date.now(),$=l.apply(this,[M,g,O]);return $.prependListener("response",V=>{let rt=Date.now()-F;P.setAttribute("http.response_time",rt),V.statusCode!==void 0?(P.setAttribute(Ku,V.statusCode),V.statusCode>=500&&Xt(P,`Status: ${V.statusCode}`)):Xt(P,"Response status code is undefined"),i&&Di(P,i,V.headers,gP),$.listenerCount("response")<=1&&V.resume(),V.on("end",()=>{let ee,L=V.statusCode;V.aborted&&!V.complete?ee={code:E.SpanStatusCode.ERROR}:L&&L>=100&&L<500?ee={code:E.SpanStatusCode.UNSET}:ee={code:E.SpanStatusCode.ERROR},P.setStatus(ee),P.isRecording()&&(V.headers["content-length"]&&P.setAttribute(Wu,V.headers["content-length"]),P.end())})}),$.on("error",V=>{P.isRecording()&&(Xt(P,V),P.end())}),$.on("close",()=>{P.isRecording()&&P.end()}),$}catch(F){throw Xt(P,F),P.end(),F}};e.request=u(a),e.get=u(c)}instrumentFetch(){let{tracerProvider:e}=this;if(!e)return;let t=e.getTracer(this.instrumentationName,this.instrumentationVersion),{attributesFromRequestHeaders:n,attributesFromResponseHeaders:o}=this.config;process.env.NEXT_OTEL_FETCH_DISABLED="1";let s=globalThis.fetch;this.originalFetch=s;let i=async(a,c)=>{let u=c;if(u?.next?.internal)return s(a,u);let l=new Request(a instanceof Request?a.clone():a,u),p=new URL(l.url);if(this.shouldIgnore(p,u))return s(a,u);let T=this.startSpan({tracer:t,url:p,fetchType:"fetch",method:l.method,name:u?.opentelemetry?.spanName,attributes:u?.opentelemetry?.attributes});if(!T.isRecording()||!Hr(T.spanContext().traceFlags))return T.end(),s(a,u);if(this.shouldPropagate(p,u)){let A=E.context.active(),M=E.trace.setSpan(A,T);E.propagation.inject(M,l.headers,Uq)}n&&Di(T,n,l.headers,mP);try{let A=Date.now();u?.body&&u.body instanceof FormData&&l.headers.delete("content-type");let M=await s(a,{...u,headers:l.headers}),g=Date.now()-A;return T.setAttribute(Ku,M.status),T.setAttribute("http.response_time",g),o&&Di(T,o,M.headers,mP),M.status>=500&&Xt(T,`Status: ${M.status} (${M.statusText})`),M.body?Bq(M).then(O=>{T.isRecording()&&(T.setAttribute(Wu,O),T.end())},O=>{T.isRecording()&&(Xt(T,O),T.end())}):T.end(),M}catch(A){throw Xt(T,A),T.end(),A}};globalThis.fetch=i}enable(){this.disable(),this.instrumentFetch();try{let e=N("node:http"),t=N("node:https");this.instrumentHttp(e,"http:"),this.instrumentHttp(t,"https:")}catch{}}disable(){this.originalFetch&&(globalThis.fetch=this.originalFetch)}},Uq={set(r,e,t){r.set(e,t)}},mP={get(r,e){let t=r.get(e);if(t!==null)return t.includes(",")?t.split(",").map(n=>n.trimStart()):t},keys(r){let e=[];return r.forEach((t,n)=>{e.push(n)}),e}},wq={set(r,e,t){r[e.toLowerCase()]=t}},gP={get(r,e){return r[e.toLowerCase()]},keys(r){return Object.keys(r)}};function Vq(r){let e=r.indexOf("?");return e===-1?r:r.substring(0,e)}function Bq(r){let e=0,n=r.clone().body?.getReader();if(!n)return Promise.resolve(0);let o=()=>n.read().then(({done:s,value:i})=>{if(!s)return e+=i.byteLength,o()});return o().then(()=>e)}function Xt(r,e){if(e instanceof Error)r.recordException(e),r.setStatus({code:E.SpanStatusCode.ERROR,message:e.message});else{let t=String(e);r.setStatus({code:E.SpanStatusCode.ERROR,message:t})}}function Di(r,e,t,n){for(let[o,s]of Object.entries(e)){let i=n.get(t,s);i!==void 0&&r.setAttribute(o,i)}}function Gq(r,e){if(r.socketPath)throw new Error("Cannot construct a network URL: options.socketPath is specified, indicating a Unix domain socket.");let t=r.protocol??e;t&&!t.endsWith(":")&&(t+=":");let n=r.hostname,o=r.port??r.defaultPort;if(!n&&r.host){let u=r.host.split(":");n=u[0];let l=u[1];if(u.length>1&&l&&o===void 0){let p=parseInt(l,10);isNaN(p)||(o=p)}}n||(n="localhost");let s;if(o!==void 0&&o!==""){let u=parseInt(String(o),10);isNaN(u)?s=t==="https:"?443:80:s=u}else s=t==="https:"?443:80;let i=r.path||"/",a=`${t}//${n}:${s}`,c=new URL(i,a);if(r.auth){let u=r.auth.split(":");c.username=decodeURIComponent(u[0]||""),u.length>1&&(c.password=decodeURIComponent(u[1]||""))}return c}m();var RP=Re(y(),1),Hq="00",A_="traceparent",h_="tracestate",wn=class{fields(){return[A_,h_]}inject(e,t,n){let o=E.trace.getSpanContext(e);if(!o||(0,RP.isTracingSuppressed)(e)||!(0,E.isSpanContextValid)(o))return;let s=`${Hq}-${o.traceId}-${o.spanId}-0${Number(o.traceFlags||0).toString(16)}`;n.set(t,A_,s),o.traceState&&n.set(t,h_,o.traceState.serialize())}extract(e,t,n){let o=n.get(t,A_);if(!o)return e;let s=Array.isArray(o)?o[0]:o;if(typeof s!="string")return e;let i=Fq(s);if(!i)return e;i.isRemote=!0;let a=n.get(t,h_);if(a){let c=Array.isArray(a)?a.join(","):a;i.traceState=(0,E.createTraceState)(typeof c=="string"?c:void 0)}return E.trace.setSpanContext(e,i)}};function Fq(r){let[e,t,n,o,s]=r.split("-");return!e||!t||!n||!o||e.length!==2||t.length!==32||n.length!==16||o.length!==2||e==="00"&&s?null:{traceId:t,spanId:n,traceFlags:parseInt(o,16)}}m();var Ui=class{fields(){return[]}inject(){}extract(e){let t=Ie();if(!t?.telemetry)return E.diag.warn("@vercel/otel: Vercel telemetry extension not found."),e;let{rootSpanContext:n}=t.telemetry;return n?(E.diag.debug("@vercel/otel: Extracted root SpanContext from Vercel request context.",n),E.trace.setSpanContext(e,{...n,isRemote:!0,traceFlags:n.traceFlags||E.TraceFlags.SAMPLED})):e}};m();var wi=Re(y(),1),OP=Re(r_(),1);var Vi=class{export(e,t){let n=Ie();if(!n?.telemetry){E.diag.warn("@vercel/otel: no telemetry context found"),t({code:wi.ExportResultCode.SUCCESS,error:void 0});return}try{let o=OP.JsonTraceSerializer.serializeRequest(e);if(!o)throw new Error("Failed to serialize spans");let s=JSON.parse(new TextDecoder().decode(o));n.telemetry.reportSpans(s),t({code:wi.ExportResultCode.SUCCESS,error:void 0})}catch(o){t({code:wi.ExportResultCode.FAILED,error:o instanceof Error?o:new Error(String(o))})}}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}};function xe(r){let e=process.env[r];if(!(!e||e.trim()===""))return e}function PP(r){return xe(r)?.split(",").map(e=>e.trim()).filter(e=>e!=="")}m();function m_(){return!!Ie()?.telemetry?.traceDrains?.length}var MP=!1,Vn=class{constructor(e){this.processor=e}forceFlush(){return this.processor.forceFlush()}shutdown(){return this.processor.shutdown()}onStart(e,t){if(m_()){MP||(MP=!0,E.diag.debug("@vercel/otel: skipping automatic exporter due to configured trace drains"));return}this.processor.onStart(e,t)}onEnd(e){m_()||this.processor.onEnd(e)}};var qq={ALL:E.DiagLogLevel.ALL,VERBOSE:E.DiagLogLevel.VERBOSE,DEBUG:E.DiagLogLevel.DEBUG,INFO:E.DiagLogLevel.INFO,WARN:E.DiagLogLevel.WARN,ERROR:E.DiagLogLevel.ERROR,NONE:E.DiagLogLevel.NONE},Bi=class{constructor(e={}){this.configuration=e}start(){let e=jq(),t=this.configuration,n=process.env.NEXT_RUNTIME||"nodejs",o=!!e.OTEL_SDK_DISABLED;if(process.env.OTEL_LOG_LEVEL&&E.diag.setLogger(new E.DiagConsoleLogger,{logLevel:qq[process.env.OTEL_LOG_LEVEL.toUpperCase()]}),o)return;let s=t.idGenerator??new H.RandomIdGenerator;this.contextManager=Jq(t.contextManager);let i=e.OTEL_SERVICE_NAME||t.serviceName||"app",a=(0,Kr.resourceFromAttributes)(Mi({[eO]:i,"node.ci":process.env.CI?!0:void 0,"node.env":process.env.NODE_ENV,env:process.env.VERCEL_ENV,"vercel.region":process.env.VERCEL_REGION,"vercel.runtime":n,"vercel.sha":process.env.VERCEL_GIT_COMMIT_SHA,"vercel.host":process.env.VERCEL_URL||void 0,"vercel.branch_host":process.env.VERCEL_BRANCH_URL||void 0,"vercel.deployment_id":process.env.VERCEL_DEPLOYMENT_ID||void 0,[tO]:process.env.VERCEL_DEPLOYMENT_ID,"vercel.project_id":process.env.VERCEL_PROJECT_ID||void 0,...t.attributes})),c=t.resourceDetectors??[Kr.envDetector];if(t.autoDetectResources??!0){let P=(0,Kr.detectResources)({detectors:c});a=a.merge(P)}let l=Yq(t.propagators,t,e),p=$q(t.traceSampler,e),T=Kq(t.spanProcessors,t,e);T.length===0&&E.diag.warn("@vercel/otel: No span processors configured. No spans will be exported.");let A=t.spanLimits,M=new H.BasicTracerProvider({resource:a,idGenerator:s,sampler:p,spanLimits:A,spanProcessors:[new Ni(T,t.attributesFromHeaders)]});if(E.trace.setGlobalTracerProvider(M),E.propagation.setGlobalPropagator(new Rt.CompositePropagator({propagators:l})),this.tracerProvider=M,t.logRecordProcessors){let O=new IP.LoggerProvider({resource:a,processors:t.logRecordProcessors});this.loggerProvider=O,at.logs.setGlobalLoggerProvider(O)}if(t.metricReaders||t.views){let O=new bP.MeterProvider({resource:a,views:t.views??[],readers:t.metricReaders??[]});E.metrics.setGlobalMeterProvider(O),this.meterProvider=O}let g=kq(t.instrumentations,t.instrumentationConfig);this.disableInstrumentations=(0,LP.registerInstrumentations)({instrumentations:g}),E.diag.info("@vercel/otel: started",i,n)}async shutdown(){let e=[];this.tracerProvider&&e.push(this.tracerProvider.shutdown()),this.loggerProvider&&e.push(this.loggerProvider.shutdown()),this.meterProvider&&e.push(this.meterProvider.shutdown()),E.diag.info("@vercel/otel: shutting down",e.length,process.env.NEXT_RUNTIME),await Promise.all(e),this.contextManager&&this.contextManager.disable();let{disableInstrumentations:t}=this;t&&t()}};function jq(){return{OTEL_SDK_DISABLED:xe("OTEL_SDK_DISABLED"),OTEL_SERVICE_NAME:xe("OTEL_SERVICE_NAME"),OTEL_PROPAGATORS:PP("OTEL_PROPAGATORS"),OTEL_TRACES_SAMPLER:xe("OTEL_TRACES_SAMPLER"),OTEL_TRACES_SAMPLER_ARG:xe("OTEL_TRACES_SAMPLER_ARG"),OTEL_EXPORTER_OTLP_TRACES_ENDPOINT:xe("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT"),OTEL_EXPORTER_OTLP_TRACES_PROTOCOL:xe("OTEL_EXPORTER_OTLP_TRACES_PROTOCOL"),OTEL_EXPORTER_OTLP_PROTOCOL:xe("OTEL_EXPORTER_OTLP_PROTOCOL"),OTEL_EXPORTER_OTLP_ENDPOINT:xe("OTEL_EXPORTER_OTLP_ENDPOINT"),OTEL_EXPORTER_OTLP_HEADERS:xe("OTEL_EXPORTER_OTLP_HEADERS"),OTEL_EXPORTER_OTLP_TRACES_HEADERS:xe("OTEL_EXPORTER_OTLP_TRACES_HEADERS")}}function kq(r,e){return(r??["auto"]).map(t=>t==="auto"?(E.diag.debug("@vercel/otel: Configure instrumentations: fetch",e?.fetch),[new Yr(e?.fetch)]):t==="fetch"?(E.diag.debug("@vercel/otel: Configure instrumentations: fetch",e?.fetch),new Yr(e?.fetch)):t).flat()}function Yq(r,e,t){let n=process.env.OTEL_PROPAGATORS&&t.OTEL_PROPAGATORS&&t.OTEL_PROPAGATORS.length>0?t.OTEL_PROPAGATORS:void 0;return(r??n??["auto"]).map(o=>{if(o==="none")return[];if(o==="auto"){let s=[];return s.push({name:"tracecontext",propagator:new wn}),s.push({name:"baggage",propagator:new Rt.W3CBaggagePropagator}),s.push({name:"vercel-runtime",propagator:new Ui}),E.diag.debug(`@vercel/otel: Configure propagators: ${s.map(i=>i.name).join(", ")}`),s.map(i=>i.propagator)}if(o==="tracecontext")return E.diag.debug("@vercel/otel: Configure propagator: tracecontext"),new wn;if(o==="baggage")return E.diag.debug("@vercel/otel: Configure propagator: baggage"),new Rt.W3CBaggagePropagator;if(typeof o=="string")throw new Error(`Unknown propagator: "${o}"`);return o}).flat()}var NP="always_on",$r=1;function $q(r,e){if(r&&typeof r!="string")return r;let t=r&&r!=="auto"?r:e.OTEL_TRACES_SAMPLER||NP;switch(E.diag.debug("@vercel/otel: Configure sampler: ",t),t){case"always_on":return new H.AlwaysOnSampler;case"always_off":return new H.AlwaysOffSampler;case"parentbased_always_on":return new H.ParentBasedSampler({root:new H.AlwaysOnSampler});case"parentbased_always_off":return new H.ParentBasedSampler({root:new H.AlwaysOffSampler});case"traceidratio":return new H.TraceIdRatioBasedSampler(CP(e));case"parentbased_traceidratio":return new H.ParentBasedSampler({root:new H.TraceIdRatioBasedSampler(CP(e))});default:return E.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER value "${String(e.OTEL_TRACES_SAMPLER)} invalid, defaulting to ${NP}".`),new H.AlwaysOnSampler}}function CP(r){if(r.OTEL_TRACES_SAMPLER_ARG===void 0||r.OTEL_TRACES_SAMPLER_ARG==="")return E.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${$r}.`),$r;E.diag.debug("@vercel/otel: Configure sampler probability: ",r.OTEL_TRACES_SAMPLER_ARG);let e=Number(r.OTEL_TRACES_SAMPLER_ARG);return isNaN(e)?(E.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER_ARG=${r.OTEL_TRACES_SAMPLER_ARG} was given, but it is invalid, defaulting to ${$r}.`),$r):e<0||e>1?(E.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER_ARG=${r.OTEL_TRACES_SAMPLER_ARG} was given, but it is out of range ([0..1]), defaulting to ${$r}.`),$r):e}function Kq(r,e,t){return[...(r??["auto"]).flatMap(n=>{if(n==="auto"){let o=[new H.BatchSpanProcessor(new Vi)];if(process.env.VERCEL_OTEL_ENDPOINTS){let s=process.env.VERCEL_OTEL_ENDPOINTS_PORT||"4318",i=process.env.VERCEL_OTEL_ENDPOINTS_PROTOCOL||"http/protobuf";E.diag.debug("@vercel/otel: Configure vercel otel collector on port: ",s,i);let a={url:`http://localhost:${s}/v1/traces`,headers:{}},c=i==="http/protobuf"?new zt(a):new qr(a);o.push(new Vn(new H.BatchSpanProcessor(c)))}else(!e.traceExporter||e.traceExporter==="auto"||t.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT||t.OTEL_EXPORTER_OTLP_ENDPOINT)&&o.push(new Vn(new H.BatchSpanProcessor(Wq(t))));return o}return n}).filter(Qq),...e.traceExporter&&e.traceExporter!=="auto"?[new H.BatchSpanProcessor(e.traceExporter)]:[]]}function Wq(r){let e=r.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL??r.OTEL_EXPORTER_OTLP_PROTOCOL??"http/protobuf",t=Xq(r),n={...r.OTEL_EXPORTER_OTLP_HEADERS?(0,Rt.parseKeyPairsIntoRecord)(r.OTEL_EXPORTER_OTLP_HEADERS):{},...r.OTEL_EXPORTER_OTLP_TRACES_HEADERS?(0,Rt.parseKeyPairsIntoRecord)(r.OTEL_EXPORTER_OTLP_TRACES_HEADERS):{}};switch(E.diag.debug("@vercel/otel: Configure trace exporter: ",e,t,`headers: ${Object.keys(n).join(",")||"<none>"}`),e){case"http/json":return new qr({url:t,headers:n});case"http/protobuf":return new zt({url:t,headers:n});default:return E.diag.warn(`@vercel/otel: Unsupported OTLP traces protocol: ${e}. Using http/protobuf.`),new zt}}var vP="v1/traces",zq=`http://localhost:4318/${vP}`;function Xq(r){let e=r.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT;if(e&&typeof e=="string")return e;let t=r.OTEL_EXPORTER_OTLP_ENDPOINT;return t&&typeof t=="string"?`${t}/${vP}`:zq}function Qq(r){return r!=null}function Jq(r){if(r===void 0){E.diag.debug("@vercel/otel: Configure context manager: default");let e=new yP.AsyncLocalStorageContextManager;return e.enable(),E.context.setGlobalContextManager(e),e}return E.diag.debug("@vercel/otel: Configure context manager: from configuration"),r.enable(),E.context.setGlobalContextManager(r),r}function d8(r){let e;r?typeof r=="string"?e={serviceName:r}:e=r:e={},new Bi(e).start()}export{Yr as FetchInstrumentation,qr as OTLPHttpJsonTraceExporter,zt as OTLPHttpProtoTraceExporter,d8 as registerOTel};
24
24
  //# sourceMappingURL=index.js.map