@vercel/otel 1.10.3 → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,5 +17,5 @@ var of=Object.create;var Fs=Object.defineProperty;var af=Object.getOwnPropertyDe
17
17
  To resolve the conflict:`,(0,ss.getConflictResolutionRecipe)(s,e))),n=i):H_.diag.warn("A view or instrument with the name ",e.name,` has already been registered and is incompatible with another registered view.
18
18
  `,`Details:
19
19
  `,(0,ss.getIncompatibilityDetails)(s,e),`To resolve the conflict:
20
- `,(0,ss.getConflictResolutionRecipe)(s,e))}return n}};os.MetricStorageRegistry=fu});var $_=c(as=>{"use strict";Object.defineProperty(as,"__esModule",{value:!0});as.MultiMetricStorage=void 0;var Eu=class{constructor(e){this._backingStorages=e}record(e,t,n,i){this._backingStorages.forEach(s=>{s.record(e,t,n,i)})}};as.MultiMetricStorage=Eu});var W_=c(er=>{"use strict";Object.defineProperty(er,"__esModule",{value:!0});er.BatchObservableResultImpl=er.ObservableResultImpl=void 0;var Jt=(p(),f(d)),X_=xr(),bS=Zi(),mu=class{constructor(e,t){this._instrumentName=e,this._valueType=t,this._buffer=new X_.AttributeHashMap}observe(e,t={}){if(typeof e!="number"){Jt.diag.warn(`non-number value provided to metric ${this._instrumentName}: ${e}`);return}this._valueType===Jt.ValueType.INT&&!Number.isInteger(e)&&(Jt.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)}};er.ObservableResultImpl=mu;var gu=class{constructor(){this._buffer=new Map}observe(e,t,n={}){if(!(0,bS.isObservableInstrument)(e))return;let i=this._buffer.get(e);if(i==null&&(i=new X_.AttributeHashMap,this._buffer.set(e,i)),typeof t!="number"){Jt.diag.warn(`non-number value provided to metric ${e._descriptor.name}: ${t}`);return}e._descriptor.valueType===Jt.ValueType.INT&&!Number.isInteger(t)&&(Jt.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))||i.set(n,t)}};er.BatchObservableResultImpl=gu});var Y_=c(us=>{"use strict";Object.defineProperty(us,"__esModule",{value:!0});us.ObservableRegistry=void 0;var PS=(p(),f(d)),K_=Zi(),z_=W_(),Dr=me(),Tu=class{constructor(){this._callbacks=[],this._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(K_.isObservableInstrument));if(n.size===0){PS.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(K_.isObservableInstrument)),i=this._findBatchCallback(e,n);i<0||this._batchCallbacks.splice(i,1)}async observe(e,t){let n=this._observeCallbacks(e,t),i=this._observeBatchCallbacks(e,t);return(await(0,Dr.PromiseAllSettled)([...n,...i])).filter(Dr.isPromiseAllSettledRejectionResult).map(a=>a.reason)}_observeCallbacks(e,t){return this._callbacks.map(async({callback:n,instrument:i})=>{let s=new z_.ObservableResultImpl(i._descriptor.name,i._descriptor.valueType),o=Promise.resolve(n(s));t!=null&&(o=(0,Dr.callWithTimeout)(o,t)),await o,i._metricStorages.forEach(a=>{a.record(s._buffer,e)})})}_observeBatchCallbacks(e,t){return this._batchCallbacks.map(async({callback:n,instruments:i})=>{let s=new z_.BatchObservableResultImpl,o=Promise.resolve(n(s));t!=null&&(o=(0,Dr.callWithTimeout)(o,t)),await o,i.forEach(a=>{let u=s._buffer.get(a);u!=null&&a._metricStorages.forEach(l=>{l.record(u,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,Dr.setEquals)(n.instruments,t))}};us.ObservableRegistry=Tu});var Q_=c(cs=>{"use strict";Object.defineProperty(cs,"__esModule",{value:!0});cs.SyncMetricStorage=void 0;var yS=au(),vS=du(),IS=pu(),Su=class extends yS.MetricStorage{constructor(e,t,n,i){super(e),this._attributesProcessor=n,this._deltaMetricStorage=new vS.DeltaMetricProcessor(t),this._temporalMetricStorage=new IS.TemporalMetricProcessor(t,i)}record(e,t,n,i){t=this._attributesProcessor.process(t,n),this._deltaMetricStorage.record(e,t,n,i)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}};cs.SyncMetricStorage=Su});var Ou=c(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.FilteringAttributesProcessor=De.NoopAttributesProcessor=De.AttributesProcessor=void 0;var Ur=class{static Noop(){return LS}};De.AttributesProcessor=Ur;var ls=class extends Ur{process(e,t){return e}};De.NoopAttributesProcessor=ls;var Au=class extends Ur{constructor(e){super(),this._allowedAttributeNames=e}process(e,t){let n={};return Object.keys(e).filter(i=>this._allowedAttributeNames.includes(i)).forEach(i=>n[i]=e[i]),n}};De.FilteringAttributesProcessor=Au;var LS=new ls});var Z_=c(ds=>{"use strict";Object.defineProperty(ds,"__esModule",{value:!0});ds.MeterSharedState=void 0;var MS=Re(),NS=U_(),CS=me(),wS=B_(),xS=k_(),DS=$_(),US=Y_(),BS=Q_(),qS=Ou(),Ru=class{constructor(e,t){this._meterProviderSharedState=e,this._instrumentationScope=t,this.metricStorageRegistry=new xS.MetricStorageRegistry,this.observableRegistry=new US.ObservableRegistry,this.meter=new NS.Meter(this)}registerMetricStorage(e){let t=this._registerMetricStorage(e,BS.SyncMetricStorage);return t.length===1?t[0]:new DS.MultiMetricStorage(t)}registerAsyncMetricStorage(e){return this._registerMetricStorage(e,wS.AsyncMetricStorage)}async collect(e,t,n){let i=await this.observableRegistry.observe(t,n?.timeoutMillis),s=this.metricStorageRegistry.getStorages(e);if(s.length===0)return null;let o=s.map(a=>a.collect(e,t)).filter(CS.isNotNullish);return o.length===0?{errors:i}:{scopeMetrics:{scope:this._instrumentationScope,metrics:o},errors:i}}_registerMetricStorage(e,t){let i=this._meterProviderSharedState.viewRegistry.findViews(e,this._instrumentationScope).map(s=>{let o=(0,MS.createInstrumentDescriptorWithView)(s,e),a=this.metricStorageRegistry.findOrUpdateCompatibleStorage(o);if(a!=null)return a;let u=s.aggregation.createAggregator(o),l=new t(o,u,s.attributesProcessor,this._meterProviderSharedState.metricCollectors);return this.metricStorageRegistry.register(l),l});if(i.length===0){let o=this._meterProviderSharedState.selectAggregations(e.type).map(([a,u])=>{let l=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(a,e);if(l!=null)return l;let _=u.createAggregator(e),E=new t(e,_,qS.AttributesProcessor.Noop(),[a]);return this.metricStorageRegistry.registerForCollector(a,E),E});i=i.concat(o)}return i}};ds.MeterSharedState=Ru});var J_=c(_s=>{"use strict";Object.defineProperty(_s,"__esModule",{value:!0});_s.MeterProviderSharedState=void 0;var GS=me(),VS=D_(),jS=Z_(),bu=class{constructor(e){this.resource=e,this.viewRegistry=new VS.ViewRegistry,this.metricCollectors=[],this.meterSharedStates=new Map}getMeterSharedState(e){let t=(0,GS.instrumentationScopeId)(e),n=this.meterSharedStates.get(t);return n==null&&(n=new jS.MeterSharedState(this,e),this.meterSharedStates.set(t,n)),n}selectAggregations(e){let t=[];for(let n of this.metricCollectors)t.push([n,n.selectAggregation(e)]);return t}};_s.MeterProviderSharedState=bu});var ep=c(ps=>{"use strict";Object.defineProperty(ps,"__esModule",{value:!0});ps.MetricCollector=void 0;var FS=T(),Pu=class{constructor(e,t){this._sharedState=e,this._metricReader=t}async collect(e){let t=(0,FS.millisToHrTime)(Date.now()),n=[],i=[],s=Array.from(this._sharedState.meterSharedStates.values()).map(async o=>{let a=await o.collect(this,t,e);a?.scopeMetrics!=null&&n.push(a.scopeMetrics),a?.errors!=null&&i.push(...a.errors)});return await Promise.all(s),{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:n},errors:i}}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)}};ps.MetricCollector=Pu});var rp=c(fs=>{"use strict";Object.defineProperty(fs,"__esModule",{value:!0});fs.MeterProvider=void 0;var hs=(p(),f(d)),tp=it(),HS=J_(),kS=ep(),yu=class{constructor(e){var t;this._shutdown=!1;let n=tp.Resource.default().merge((t=e?.resource)!==null&&t!==void 0?t:tp.Resource.empty());if(this._sharedState=new HS.MeterProviderSharedState(n),e?.views!=null&&e.views.length>0)for(let i of e.views)this._sharedState.viewRegistry.addView(i)}getMeter(e,t="",n={}){return this._shutdown?(hs.diag.warn("A shutdown MeterProvider cannot provide a Meter"),(0,hs.createNoopMeter)()):this._sharedState.getMeterSharedState({name:e,version:t,schemaUrl:n.schemaUrl}).meter}addMetricReader(e){let t=new kS.MetricCollector(this._sharedState,e);e.setMetricProducer(t),this._sharedState.metricCollectors.push(t)}async shutdown(e){if(this._shutdown){hs.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){hs.diag.warn("invalid attempt to force flush after MeterProvider shutdown");return}await Promise.all(this._sharedState.metricCollectors.map(t=>t.forceFlush(e)))}};fs.MeterProvider=yu});var Es=c(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.ExactPredicate=tr.PatternPredicate=void 0;var $S=/[\^$\\.+?()[\]{}|]/g,vu=class r{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($S,"\\$&").replace("*",".*")}$`}static hasWildcard(e){return e.includes("*")}};tr.PatternPredicate=vu;var Iu=class{constructor(e){this._matchAll=e===void 0,this._pattern=e}match(e){return!!(this._matchAll||e===this._pattern)}};tr.ExactPredicate=Iu});var ip=c(ms=>{"use strict";Object.defineProperty(ms,"__esModule",{value:!0});ms.InstrumentSelector=void 0;var np=Es(),Lu=class{constructor(e){var t;this._nameFilter=new np.PatternPredicate((t=e?.name)!==null&&t!==void 0?t:"*"),this._type=e?.type,this._unitFilter=new np.ExactPredicate(e?.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}};ms.InstrumentSelector=Lu});var sp=c(gs=>{"use strict";Object.defineProperty(gs,"__esModule",{value:!0});gs.MeterSelector=void 0;var Mu=Es(),Nu=class{constructor(e){this._nameFilter=new Mu.ExactPredicate(e?.name),this._versionFilter=new Mu.ExactPredicate(e?.version),this._schemaUrlFilter=new Mu.ExactPredicate(e?.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}};gs.MeterSelector=Nu});var ap=c(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});Ts.View=void 0;var XS=Es(),op=Ou(),WS=ip(),KS=sp(),zS=ki();function YS(r){return r.instrumentName==null&&r.instrumentType==null&&r.instrumentUnit==null&&r.meterName==null&&r.meterVersion==null&&r.meterSchemaUrl==null}var Cu=class{constructor(e){var t;if(YS(e))throw new Error("Cannot create view with no selector arguments supplied");if(e.name!=null&&(e?.instrumentName==null||XS.PatternPredicate.hasWildcard(e.instrumentName)))throw new Error("Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.");e.attributeKeys!=null?this.attributesProcessor=new op.FilteringAttributesProcessor(e.attributeKeys):this.attributesProcessor=op.AttributesProcessor.Noop(),this.name=e.name,this.description=e.description,this.aggregation=(t=e.aggregation)!==null&&t!==void 0?t:zS.Aggregation.Default(),this.instrumentSelector=new WS.InstrumentSelector({name:e.instrumentName,type:e.instrumentType,unit:e.instrumentUnit}),this.meterSelector=new KS.MeterSelector({name:e.meterName,version:e.meterVersion,schemaUrl:e.meterSchemaUrl})}};Ts.View=Cu});var wu=c(m=>{"use strict";Object.defineProperty(m,"__esModule",{value:!0});m.TimeoutError=m.View=m.Aggregation=m.SumAggregation=m.LastValueAggregation=m.HistogramAggregation=m.DropAggregation=m.ExponentialHistogramAggregation=m.ExplicitBucketHistogramAggregation=m.DefaultAggregation=m.MeterProvider=m.InstrumentType=m.ConsoleMetricExporter=m.InMemoryMetricExporter=m.PeriodicExportingMetricReader=m.MetricReader=m.DataPointType=m.AggregationTemporality=void 0;var QS=Mi();Object.defineProperty(m,"AggregationTemporality",{enumerable:!0,get:function(){return QS.AggregationTemporality}});var ZS=Dt();Object.defineProperty(m,"DataPointType",{enumerable:!0,get:function(){return ZS.DataPointType}});var JS=Ka();Object.defineProperty(m,"MetricReader",{enumerable:!0,get:function(){return JS.MetricReader}});var eA=M_();Object.defineProperty(m,"PeriodicExportingMetricReader",{enumerable:!0,get:function(){return eA.PeriodicExportingMetricReader}});var tA=C_();Object.defineProperty(m,"InMemoryMetricExporter",{enumerable:!0,get:function(){return tA.InMemoryMetricExporter}});var rA=x_();Object.defineProperty(m,"ConsoleMetricExporter",{enumerable:!0,get:function(){return rA.ConsoleMetricExporter}});var nA=Re();Object.defineProperty(m,"InstrumentType",{enumerable:!0,get:function(){return nA.InstrumentType}});var iA=rp();Object.defineProperty(m,"MeterProvider",{enumerable:!0,get:function(){return iA.MeterProvider}});var Ue=ki();Object.defineProperty(m,"DefaultAggregation",{enumerable:!0,get:function(){return Ue.DefaultAggregation}});Object.defineProperty(m,"ExplicitBucketHistogramAggregation",{enumerable:!0,get:function(){return Ue.ExplicitBucketHistogramAggregation}});Object.defineProperty(m,"ExponentialHistogramAggregation",{enumerable:!0,get:function(){return Ue.ExponentialHistogramAggregation}});Object.defineProperty(m,"DropAggregation",{enumerable:!0,get:function(){return Ue.DropAggregation}});Object.defineProperty(m,"HistogramAggregation",{enumerable:!0,get:function(){return Ue.HistogramAggregation}});Object.defineProperty(m,"LastValueAggregation",{enumerable:!0,get:function(){return Ue.LastValueAggregation}});Object.defineProperty(m,"SumAggregation",{enumerable:!0,get:function(){return Ue.SumAggregation}});Object.defineProperty(m,"Aggregation",{enumerable:!0,get:function(){return Ue.Aggregation}});var sA=ap();Object.defineProperty(m,"View",{enumerable:!0,get:function(){return sA.View}});var oA=me();Object.defineProperty(m,"TimeoutError",{enumerable:!0,get:function(){return oA.TimeoutError}})});var up=c(Ss=>{"use strict";Object.defineProperty(Ss,"__esModule",{value:!0});Ss.AbstractAsyncHooksContextManager=void 0;var aA=ee("events"),uA=["addListener","on","once","prependListener","prependOnceListener"],xu=class{constructor(){this._kOtListeners=Symbol("OtListeners"),this._wrapped=!1}bind(e,t){return t instanceof aA.EventEmitter?this._bindEventEmitter(e,t):typeof t=="function"?this._bindFunction(e,t):t}_bindFunction(e,t){let n=this,i=function(...s){return n.with(e,()=>t.apply(this,s))};return Object.defineProperty(i,"length",{enumerable:!1,configurable:!0,writable:!1,value:t.length}),i}_bindEventEmitter(e,t){return this._getPatchMap(t)!==void 0||(this._createPatchMap(t),uA.forEach(i=>{t[i]!==void 0&&(t[i]=this._patchAddListener(t,t[i],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(i,s){var o;let a=(o=n._getPatchMap(e))===null||o===void 0?void 0:o[i];if(a===void 0)return t.call(this,i,s);let u=a.get(s);return t.call(this,i,u||s)}}_patchRemoveAllListeners(e,t){let n=this;return function(i){let s=n._getPatchMap(e);return s!==void 0&&(arguments.length===0?n._createPatchMap(e):s[i]!==void 0&&delete s[i]),t.apply(this,arguments)}}_patchAddListener(e,t,n){let i=this;return function(s,o){if(i._wrapped)return t.call(this,s,o);let a=i._getPatchMap(e);a===void 0&&(a=i._createPatchMap(e));let u=a[s];u===void 0&&(u=new WeakMap,a[s]=u);let l=i.bind(n,o);u.set(o,l),i._wrapped=!0;try{return t.call(this,s,l)}finally{i._wrapped=!1}}}_createPatchMap(e){let t=Object.create(null);return e[this._kOtListeners]=t,t}_getPatchMap(e){return e[this._kOtListeners]}};Ss.AbstractAsyncHooksContextManager=xu});var cp=c(As=>{"use strict";Object.defineProperty(As,"__esModule",{value:!0});As.AsyncLocalStorageContextManager=void 0;var cA=(p(),f(d)),lA=ee("async_hooks"),dA=up(),Du=class extends dA.AbstractAsyncHooksContextManager{constructor(){super(),this._asyncLocalStorage=new lA.AsyncLocalStorage}active(){var e;return(e=this._asyncLocalStorage.getStore())!==null&&e!==void 0?e:cA.ROOT_CONTEXT}with(e,t,n,...i){let s=n==null?t:t.bind(n);return this._asyncLocalStorage.run(e,s,...i)}enable(){return this}disable(){return this._asyncLocalStorage.disable(),this}};As.AsyncLocalStorageContextManager=Du});var qr=c(Be=>{"use strict";Object.defineProperty(Be,"__esModule",{value:!0});Be.toAnyValue=Be.toKeyValue=Be.toAttributes=void 0;function mA(r){return Object.keys(r).map(e=>Bu(e,r[e]))}Be.toAttributes=mA;function Bu(r,e){return{key:r,value:qu(e)}}Be.toKeyValue=Bu;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])=>Bu(t,n))}}:{}}Be.toAnyValue=qu});var fp=c(qe=>{"use strict";Object.defineProperty(qe,"__esModule",{value:!0});qe.toOtlpSpanEvent=qe.toOtlpLink=qe.sdkSpanToOtlpSpan=void 0;var Gu=qr();function gA(r,e){var t;let n=r.spanContext(),i=r.status;return{traceId:e.encodeSpanContext(n.traceId),spanId:e.encodeSpanContext(n.spanId),parentSpanId:e.encodeOptionalSpanContext(r.parentSpanId),traceState:(t=n.traceState)===null||t===void 0?void 0:t.serialize(),name:r.name,kind:r.kind==null?0:r.kind+1,startTimeUnixNano:e.encodeHrTime(r.startTime),endTimeUnixNano:e.encodeHrTime(r.endTime),attributes:(0,Gu.toAttributes)(r.attributes),droppedAttributesCount:r.droppedAttributesCount,events:r.events.map(s=>hp(s,e)),droppedEventsCount:r.droppedEventsCount,status:{code:i.code,message:i.message},links:r.links.map(s=>pp(s,e)),droppedLinksCount:r.droppedLinksCount}}qe.sdkSpanToOtlpSpan=gA;function pp(r,e){var t;return{attributes:r.attributes?(0,Gu.toAttributes)(r.attributes):[],spanId:e.encodeSpanContext(r.context.spanId),traceId:e.encodeSpanContext(r.context.traceId),traceState:(t=r.context.traceState)===null||t===void 0?void 0:t.serialize(),droppedAttributesCount:r.droppedAttributesCount||0}}qe.toOtlpLink=pp;function hp(r,e){return{attributes:r.attributes?(0,Gu.toAttributes)(r.attributes):[],name:r.name,timeUnixNano:e.encodeHrTime(r.time),droppedAttributesCount:r.droppedAttributesCount||0}}qe.toOtlpSpanEvent=hp});var Gr=c(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});ae.getOtlpEncoder=ae.encodeAsString=ae.encodeAsLongBits=ae.toLongBits=ae.hrTimeToNanos=void 0;var bs=T(),TA=BigInt(1e9);function Vu(r){return BigInt(r[0])*TA+BigInt(r[1])}ae.hrTimeToNanos=Vu;function mp(r){let e=Number(BigInt.asUintN(32,r)),t=Number(BigInt.asUintN(32,r>>BigInt(32)));return{low:e,high:t}}ae.toLongBits=mp;function ju(r){let e=Vu(r);return mp(e)}ae.encodeAsLongBits=ju;function gp(r){return Vu(r).toString()}ae.encodeAsString=gp;var SA=typeof BigInt<"u"?gp:bs.hrTimeToNanoseconds;function Ep(r){return r}function Tp(r){if(r!==void 0)return(0,bs.hexToBase64)(r)}var AA={encodeHrTime:ju,encodeSpanContext:bs.hexToBase64,encodeOptionalSpanContext:Tp};function OA(r){var e,t;if(r===void 0)return AA;let n=(e=r.useLongBits)!==null&&e!==void 0?e:!0,i=(t=r.useHex)!==null&&t!==void 0?t:!1;return{encodeHrTime:n?ju:SA,encodeSpanContext:i?Ep:bs.hexToBase64,encodeOptionalSpanContext:i?Ep:Tp}}ae.getOtlpEncoder=OA});var ys=c(Ps=>{"use strict";Object.defineProperty(Ps,"__esModule",{value:!0});Ps.createExportTraceServiceRequest=void 0;var RA=qr(),bA=fp(),PA=Gr();function yA(r,e){let t=(0,PA.getOtlpEncoder)(e);return{resourceSpans:IA(r,t)}}Ps.createExportTraceServiceRequest=yA;function vA(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 i=`${t.instrumentationLibrary.name}@${t.instrumentationLibrary.version||""}:${t.instrumentationLibrary.schemaUrl||""}`,s=n.get(i);s||(s=[],n.set(i,s)),s.push(t)}return e}function IA(r,e){let t=vA(r),n=[],i=t.entries(),s=i.next();for(;!s.done;){let[o,a]=s.value,u=[],l=a.values(),_=l.next();for(;!_.done;){let O=_.value;if(O.length>0){let{name:x,version:J,schemaUrl:y}=O[0].instrumentationLibrary,k=O.map(S=>(0,bA.sdkSpanToOtlpSpan)(S,e));u.push({scope:{name:x,version:J},spans:k,schemaUrl:y})}_=l.next()}let E={resource:{attributes:(0,RA.toAttributes)(o.attributes),droppedAttributesCount:0},scopeSpans:u,schemaUrl:void 0};n.push(E),s=i.next()}return n}});var Op=c(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.parseRetryAfterToMills=N.isExportRetryable=N.invalidTimeout=N.configureExporterTimeout=N.appendRootPathToUrlIfNeeded=N.appendResourcePathToUrl=N.parseHeaders=N.DEFAULT_EXPORT_BACKOFF_MULTIPLIER=N.DEFAULT_EXPORT_MAX_BACKOFF=N.DEFAULT_EXPORT_INITIAL_BACKOFF=N.DEFAULT_EXPORT_MAX_ATTEMPTS=void 0;var Fu=(p(),f(d)),Sp=T(),Ap=1e4;N.DEFAULT_EXPORT_MAX_ATTEMPTS=5;N.DEFAULT_EXPORT_INITIAL_BACKOFF=1e3;N.DEFAULT_EXPORT_MAX_BACKOFF=5e3;N.DEFAULT_EXPORT_BACKOFF_MULTIPLIER=1.5;function LA(r={}){let e={};return Object.entries(r).forEach(([t,n])=>{typeof n<"u"?e[t]=String(n):Fu.diag.warn(`Header "${t}" has wrong value and will be ignored`)}),e}N.parseHeaders=LA;function MA(r,e){return r.endsWith("/")||(r=r+"/"),r+e}N.appendResourcePathToUrl=MA;function NA(r){try{let e=new URL(r);return e.pathname===""&&(e.pathname=e.pathname+"/"),e.toString()}catch{return Fu.diag.warn(`Could not parse export URL: '${r}'`),r}}N.appendRootPathToUrlIfNeeded=NA;function CA(r){return typeof r=="number"?r<=0?Hu(r,Ap):r:wA()}N.configureExporterTimeout=CA;function wA(){var r;let e=Number((r=(0,Sp.getEnv)().OTEL_EXPORTER_OTLP_TRACES_TIMEOUT)!==null&&r!==void 0?r:(0,Sp.getEnv)().OTEL_EXPORTER_OTLP_TIMEOUT);return e<=0?Hu(e,Ap):e}function Hu(r,e){return Fu.diag.warn("Timeout must be greater than 0",r),e}N.invalidTimeout=Hu;function xA(r){return[429,502,503,504].includes(r)}N.isExportRetryable=xA;function DA(r){if(r==null)return-1;let e=Number.parseInt(r,10);if(Number.isInteger(e))return e>0?e*1e3:-1;let t=new Date(r).getTime()-Date.now();return t>=0?t:0}N.parseRetryAfterToMills=DA});var bp=c(vs=>{"use strict";Object.defineProperty(vs,"__esModule",{value:!0});vs.OTLPExporterBase=void 0;var Rp=(p(),f(d)),Vr=T(),UA=Op(),ku=class{constructor(e={}){this._sendingPromises=[],this.url=this.getDefaultUrl(e),typeof e.hostname=="string"&&(this.hostname=e.hostname),this.shutdown=this.shutdown.bind(this),this._shutdownOnce=new Vr.BindOnceFuture(this._shutdown,this),this._concurrencyLimit=typeof e.concurrencyLimit=="number"?e.concurrencyLimit:30,this.timeoutMillis=(0,UA.configureExporterTimeout)(e.timeoutMillis),this.onInit(e)}export(e,t){if(this._shutdownOnce.isCalled){t({code:Vr.ExportResultCode.FAILED,error:new Error("Exporter has been shutdown")});return}if(this._sendingPromises.length>=this._concurrencyLimit){t({code:Vr.ExportResultCode.FAILED,error:new Error("Concurrent export limit reached")});return}this._export(e).then(()=>{t({code:Vr.ExportResultCode.SUCCESS})}).catch(n=>{t({code:Vr.ExportResultCode.FAILED,error:n})})}_export(e){return new Promise((t,n)=>{try{Rp.diag.debug("items to be sent",e),this.send(e,t,n)}catch(i){n(i)}})}shutdown(){return this._shutdownOnce.call()}forceFlush(){return Promise.all(this._sendingPromises).then(()=>{})}_shutdown(){return Rp.diag.debug("shutdown started"),this.onShutdown(),this.forceFlush()}};vs.OTLPExporterBase=ku});var Ip=c((Ry,vp)=>{"use strict";vp.exports=GA;function GA(r,e){for(var t=new Array(arguments.length-1),n=0,i=2,s=!0;i<arguments.length;)t[n++]=arguments[i++];return new Promise(function(a,u){t[n]=function(_){if(s)if(s=!1,_)u(_);else{for(var E=new Array(arguments.length-1),O=0;O<E.length;)E[O++]=arguments[O];a.apply(null,E)}};try{r.apply(e||null,t)}catch(l){s&&(s=!1,u(l))}})}});var Cp=c(Np=>{"use strict";var Ls=Np;Ls.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 ir=new Array(64),Mp=new Array(123);for(de=0;de<64;)Mp[ir[de]=de<26?de+65:de<52?de+71:de<62?de-4:de-59|43]=de++;var de;Ls.encode=function(e,t,n){for(var i=null,s=[],o=0,a=0,u;t<n;){var l=e[t++];switch(a){case 0:s[o++]=ir[l>>2],u=(l&3)<<4,a=1;break;case 1:s[o++]=ir[u|l>>4],u=(l&15)<<2,a=2;break;case 2:s[o++]=ir[u|l>>6],s[o++]=ir[l&63],a=0;break}o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=ir[u],s[o++]=61,a===1&&(s[o++]=61)),i?(o&&i.push(String.fromCharCode.apply(String,s.slice(0,o))),i.join("")):String.fromCharCode.apply(String,s.slice(0,o))};var Lp="invalid encoding";Ls.decode=function(e,t,n){for(var i=n,s=0,o,a=0;a<e.length;){var u=e.charCodeAt(a++);if(u===61&&s>1)break;if((u=Mp[u])===void 0)throw Error(Lp);switch(s){case 0:o=u,s=1;break;case 1:t[n++]=o<<2|(u&48)>>4,o=u,s=2;break;case 2:t[n++]=(o&15)<<4|(u&60)>>2,o=u,s=3;break;case 3:t[n++]=(o&3)<<6|u,s=0;break}}if(s===1)throw Error(Lp);return n-i};Ls.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var xp=c((Py,wp)=>{"use strict";wp.exports=Ms;function Ms(){this._listeners={}}Ms.prototype.on=function(e,t,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:n||this}),this};Ms.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],i=0;i<n.length;)n[i].fn===t?n.splice(i,1):++i;return this};Ms.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var n=[],i=1;i<arguments.length;)n.push(arguments[i++]);for(i=0;i<t.length;)t[i].fn.apply(t[i++].ctx,n)}return this}});var jp=c((yy,Vp)=>{"use strict";Vp.exports=Dp(Dp);function Dp(r){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),t=new Uint8Array(e.buffer),n=t[3]===128;function i(u,l,_){e[0]=u,l[_]=t[0],l[_+1]=t[1],l[_+2]=t[2],l[_+3]=t[3]}function s(u,l,_){e[0]=u,l[_]=t[3],l[_+1]=t[2],l[_+2]=t[1],l[_+3]=t[0]}r.writeFloatLE=n?i:s,r.writeFloatBE=n?s:i;function o(u,l){return t[0]=u[l],t[1]=u[l+1],t[2]=u[l+2],t[3]=u[l+3],e[0]}function a(u,l){return t[3]=u[l],t[2]=u[l+1],t[1]=u[l+2],t[0]=u[l+3],e[0]}r.readFloatLE=n?o:a,r.readFloatBE=n?a:o}():function(){function e(n,i,s,o){var a=i<0?1:0;if(a&&(i=-i),i===0)n(1/i>0?0:2147483648,s,o);else if(isNaN(i))n(2143289344,s,o);else if(i>34028234663852886e22)n((a<<31|2139095040)>>>0,s,o);else if(i<11754943508222875e-54)n((a<<31|Math.round(i/1401298464324817e-60))>>>0,s,o);else{var u=Math.floor(Math.log(i)/Math.LN2),l=Math.round(i*Math.pow(2,-u)*8388608)&8388607;n((a<<31|u+127<<23|l)>>>0,s,o)}}r.writeFloatLE=e.bind(null,Up),r.writeFloatBE=e.bind(null,Bp);function t(n,i,s){var o=n(i,s),a=(o>>31)*2+1,u=o>>>23&255,l=o&8388607;return u===255?l?NaN:a*(1/0):u===0?a*1401298464324817e-60*l:a*Math.pow(2,u-150)*(l+8388608)}r.readFloatLE=t.bind(null,qp),r.readFloatBE=t.bind(null,Gp)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),t=new Uint8Array(e.buffer),n=t[7]===128;function i(u,l,_){e[0]=u,l[_]=t[0],l[_+1]=t[1],l[_+2]=t[2],l[_+3]=t[3],l[_+4]=t[4],l[_+5]=t[5],l[_+6]=t[6],l[_+7]=t[7]}function s(u,l,_){e[0]=u,l[_]=t[7],l[_+1]=t[6],l[_+2]=t[5],l[_+3]=t[4],l[_+4]=t[3],l[_+5]=t[2],l[_+6]=t[1],l[_+7]=t[0]}r.writeDoubleLE=n?i:s,r.writeDoubleBE=n?s:i;function o(u,l){return t[0]=u[l],t[1]=u[l+1],t[2]=u[l+2],t[3]=u[l+3],t[4]=u[l+4],t[5]=u[l+5],t[6]=u[l+6],t[7]=u[l+7],e[0]}function a(u,l){return t[7]=u[l],t[6]=u[l+1],t[5]=u[l+2],t[4]=u[l+3],t[3]=u[l+4],t[2]=u[l+5],t[1]=u[l+6],t[0]=u[l+7],e[0]}r.readDoubleLE=n?o:a,r.readDoubleBE=n?a:o}():function(){function e(n,i,s,o,a,u){var l=o<0?1:0;if(l&&(o=-o),o===0)n(0,a,u+i),n(1/o>0?0:2147483648,a,u+s);else if(isNaN(o))n(0,a,u+i),n(2146959360,a,u+s);else if(o>17976931348623157e292)n(0,a,u+i),n((l<<31|2146435072)>>>0,a,u+s);else{var _;if(o<22250738585072014e-324)_=o/5e-324,n(_>>>0,a,u+i),n((l<<31|_/4294967296)>>>0,a,u+s);else{var E=Math.floor(Math.log(o)/Math.LN2);E===1024&&(E=1023),_=o*Math.pow(2,-E),n(_*4503599627370496>>>0,a,u+i),n((l<<31|E+1023<<20|_*1048576&1048575)>>>0,a,u+s)}}}r.writeDoubleLE=e.bind(null,Up,0,4),r.writeDoubleBE=e.bind(null,Bp,4,0);function t(n,i,s,o,a){var u=n(o,a+i),l=n(o,a+s),_=(l>>31)*2+1,E=l>>>20&2047,O=4294967296*(l&1048575)+u;return E===2047?O?NaN:_*(1/0):E===0?_*5e-324*O:_*Math.pow(2,E-1075)*(O+4503599627370496)}r.readDoubleLE=t.bind(null,qp,0,4),r.readDoubleBE=t.bind(null,Gp,4,0)}(),r}function Up(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 Bp(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 qp(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16|r[e+3]<<24)>>>0}function Gp(r,e){return(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}});var Fp=c((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 kp=c(Hp=>{"use strict";var Xu=Hp;Xu.length=function(e){for(var t=0,n=0,i=0;i<e.length;++i)n=e.charCodeAt(i),n<128?t+=1:n<2048?t+=2:(n&64512)===55296&&(e.charCodeAt(i+1)&64512)===56320?(++i,t+=4):t+=3;return t};Xu.read=function(e,t,n){var i=n-t;if(i<1)return"";for(var s=null,o=[],a=0,u;t<n;)u=e[t++],u<128?o[a++]=u:u>191&&u<224?o[a++]=(u&31)<<6|e[t++]&63:u>239&&u<365?(u=((u&7)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63)-65536,o[a++]=55296+(u>>10),o[a++]=56320+(u&1023)):o[a++]=(u&15)<<12|(e[t++]&63)<<6|e[t++]&63,a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),a=0);return s?(a&&s.push(String.fromCharCode.apply(String,o.slice(0,a))),s.join("")):String.fromCharCode.apply(String,o.slice(0,a))};Xu.write=function(e,t,n){for(var i=n,s,o,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&&((o=e.charCodeAt(a+1))&64512)===56320?(s=65536+((s&1023)<<10)+(o&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-i}});var Xp=c((Iy,$p)=>{"use strict";$p.exports=VA;function VA(r,e,t){var n=t||8192,i=n>>>1,s=null,o=n;return function(u){if(u<1||u>i)return r(u);o+u>n&&(s=r(n),o=0);var l=e.call(s,o,o+=u);return o&7&&(o=(o|7)+1),l}}});var Kp=c((Ly,Wp)=>{"use strict";Wp.exports=V;var jr=Ve();function V(r,e){this.lo=r>>>0,this.hi=e>>>0}var dt=V.zero=new V(0,0);dt.toNumber=function(){return 0};dt.zzEncode=dt.zzDecode=function(){return this};dt.length=function(){return 1};var jA=V.zeroHash="\0\0\0\0\0\0\0\0";V.fromNumber=function(e){if(e===0)return dt;var t=e<0;t&&(e=-e);var n=e>>>0,i=(e-n)/4294967296>>>0;return t&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new V(n,i)};V.from=function(e){if(typeof e=="number")return V.fromNumber(e);if(jr.isString(e))if(jr.Long)e=jr.Long.fromString(e);else return V.fromNumber(parseInt(e,10));return e.low||e.high?new V(e.low>>>0,e.high>>>0):dt};V.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};V.prototype.toLong=function(e){return jr.Long?new jr.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var Ge=String.prototype.charCodeAt;V.fromHash=function(e){return e===jA?dt:new V((Ge.call(e,0)|Ge.call(e,1)<<8|Ge.call(e,2)<<16|Ge.call(e,3)<<24)>>>0,(Ge.call(e,4)|Ge.call(e,5)<<8|Ge.call(e,6)<<16|Ge.call(e,7)<<24)>>>0)};V.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)};V.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};V.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};V.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 Ve=c(Wu=>{"use strict";var h=Wu;h.asPromise=Ip();h.base64=Cp();h.EventEmitter=xp();h.float=jp();h.inquire=Fp();h.utf8=kp();h.pool=Xp();h.LongBits=Kp();h.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);h.global=h.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||Wu;h.emptyArray=Object.freeze?Object.freeze([]):[];h.emptyObject=Object.freeze?Object.freeze({}):{};h.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};h.isString=function(e){return typeof e=="string"||e instanceof String};h.isObject=function(e){return e&&typeof e=="object"};h.isset=h.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};h.Buffer=function(){try{var r=h.inquire("buffer").Buffer;return r.prototype.utf8Write?r:null}catch{return null}}();h._Buffer_from=null;h._Buffer_allocUnsafe=null;h.newBuffer=function(e){return typeof e=="number"?h.Buffer?h._Buffer_allocUnsafe(e):new h.Array(e):h.Buffer?h._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};h.Array=typeof Uint8Array<"u"?Uint8Array:Array;h.Long=h.global.dcodeIO&&h.global.dcodeIO.Long||h.global.Long||h.inquire("long");h.key2Re=/^true|false|0|1$/;h.key32Re=/^-?(?:0|[1-9][0-9]*)$/;h.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;h.longToHash=function(e){return e?h.LongBits.from(e).toHash():h.LongBits.zeroHash};h.longFromHash=function(e,t){var n=h.LongBits.fromHash(e);return h.Long?h.Long.fromBits(n.lo,n.hi,t):n.toNumber(!!t)};function zp(r,e,t){for(var n=Object.keys(e),i=0;i<n.length;++i)(r[n[i]]===void 0||!t)&&(r[n[i]]=e[n[i]]);return r}h.merge=zp;h.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)};function Yp(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&&zp(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}h.newError=Yp;h.ProtocolError=Yp("ProtocolError");h.oneOfGetter=function(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=1;return function(){for(var i=Object.keys(this),s=i.length-1;s>-1;--s)if(t[i[s]]===1&&this[i[s]]!==void 0&&this[i[s]]!==null)return i[s]}};h.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}};h.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};h._configure=function(){var r=h.Buffer;if(!r){h._Buffer_from=h._Buffer_allocUnsafe=null;return}h._Buffer_from=r.from!==Uint8Array.from&&r.from||function(t,n){return new r(t,n)},h._Buffer_allocUnsafe=r.allocUnsafe||function(t){return new r(t)}}});var ec=c((Ny,eh)=>{"use strict";eh.exports=A;var ue=Ve(),Ku,Ns=ue.LongBits,Qp=ue.base64,Zp=ue.utf8;function Fr(r,e,t){this.fn=r,this.len=e,this.next=void 0,this.val=t}function Yu(){}function FA(r){this.head=r.head,this.tail=r.tail,this.len=r.len,this.next=r.states}function A(){this.len=0,this.head=new Fr(Yu,0,0),this.tail=this.head,this.states=null}var Jp=function(){return ue.Buffer?function(){return(A.create=function(){return new Ku})()}:function(){return new A}};A.create=Jp();A.alloc=function(e){return new ue.Array(e)};ue.Array!==Array&&(A.alloc=ue.pool(A.alloc,ue.Array.prototype.subarray));A.prototype._push=function(e,t,n){return this.tail=this.tail.next=new Fr(e,t,n),this.len+=t,this};function Qu(r,e,t){e[t]=r&255}function HA(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}function Zu(r,e){this.len=r,this.next=void 0,this.val=e}Zu.prototype=Object.create(Fr.prototype);Zu.prototype.fn=HA;A.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new Zu((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};A.prototype.int32=function(e){return e<0?this._push(Ju,10,Ns.fromNumber(e)):this.uint32(e)};A.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function Ju(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}A.prototype.uint64=function(e){var t=Ns.from(e);return this._push(Ju,t.length(),t)};A.prototype.int64=A.prototype.uint64;A.prototype.sint64=function(e){var t=Ns.from(e).zzEncode();return this._push(Ju,t.length(),t)};A.prototype.bool=function(e){return this._push(Qu,1,e?1:0)};function zu(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}A.prototype.fixed32=function(e){return this._push(zu,4,e>>>0)};A.prototype.sfixed32=A.prototype.fixed32;A.prototype.fixed64=function(e){var t=Ns.from(e);return this._push(zu,4,t.lo)._push(zu,4,t.hi)};A.prototype.sfixed64=A.prototype.fixed64;A.prototype.float=function(e){return this._push(ue.float.writeFloatLE,4,e)};A.prototype.double=function(e){return this._push(ue.float.writeDoubleLE,8,e)};var kA=ue.Array.prototype.set?function(e,t,n){t.set(e,n)}:function(e,t,n){for(var i=0;i<e.length;++i)t[n+i]=e[i]};A.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(Qu,1,0);if(ue.isString(e)){var n=A.alloc(t=Qp.length(e));Qp.decode(e,n,0),e=n}return this.uint32(t)._push(kA,t,e)};A.prototype.string=function(e){var t=Zp.length(e);return t?this.uint32(t)._push(Zp.write,t,e):this._push(Qu,1,0)};A.prototype.fork=function(){return this.states=new FA(this),this.head=this.tail=new Fr(Yu,0,0),this.len=0,this};A.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 Fr(Yu,0,0),this.len=0),this};A.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};A.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};A._configure=function(r){Ku=r,A.create=Jp(),Ku._configure()}});var nh=c((Cy,rh)=>{"use strict";rh.exports=Se;var th=ec();(Se.prototype=Object.create(th.prototype)).constructor=Se;var je=Ve();function Se(){th.call(this)}Se._configure=function(){Se.alloc=je._Buffer_allocUnsafe,Se.writeBytesBuffer=je.Buffer&&je.Buffer.prototype instanceof Uint8Array&&je.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 i=0;i<e.length;)t[n++]=e[i++]}};Se.prototype.bytes=function(e){je.isString(e)&&(e=je._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(Se.writeBytesBuffer,t,e),this};function $A(r,e,t){r.length<40?je.utf8.write(r,e,t):e.utf8Write?e.utf8Write(r,t):e.write(r,t)}Se.prototype.string=function(e){var t=je.Buffer.byteLength(e);return this.uint32(t),t&&this._push($A,t,e),this};Se._configure()});var nc=c((wy,uh)=>{"use strict";uh.exports=w;var _e=Ve(),rc,oh=_e.LongBits,XA=_e.utf8;function pe(r,e){return RangeError("index out of range: "+r.pos+" + "+(e||1)+" > "+r.len)}function w(r){this.buf=r,this.pos=0,this.len=r.length}var ih=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new w(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new w(e);throw Error("illegal buffer")},ah=function(){return _e.Buffer?function(t){return(w.create=function(i){return _e.Buffer.isBuffer(i)?new rc(i):ih(i)})(t)}:ih};w.create=ah();w.prototype._slice=_e.Array.prototype.subarray||_e.Array.prototype.slice;w.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,pe(this,10);return e}}();w.prototype.int32=function(){return this.uint32()|0};w.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function tc(){var r=new oh(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 pe(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 pe(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")}w.prototype.bool=function(){return this.uint32()!==0};function Cs(r,e){return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0}w.prototype.fixed32=function(){if(this.pos+4>this.len)throw pe(this,4);return Cs(this.buf,this.pos+=4)};w.prototype.sfixed32=function(){if(this.pos+4>this.len)throw pe(this,4);return Cs(this.buf,this.pos+=4)|0};function sh(){if(this.pos+8>this.len)throw pe(this,8);return new oh(Cs(this.buf,this.pos+=4),Cs(this.buf,this.pos+=4))}w.prototype.float=function(){if(this.pos+4>this.len)throw pe(this,4);var e=_e.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};w.prototype.double=function(){if(this.pos+8>this.len)throw pe(this,4);var e=_e.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};w.prototype.bytes=function(){var e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw pe(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(t,n);if(t===n){var i=_e.Buffer;return i?i.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,t,n)};w.prototype.string=function(){var e=this.bytes();return XA.read(e,0,e.length)};w.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw pe(this,e);this.pos+=e}else do if(this.pos>=this.len)throw pe(this);while(this.buf[this.pos++]&128);return this};w.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};w._configure=function(r){rc=r,w.create=ah(),rc._configure();var e=_e.Long?"toLong":"toNumber";_e.merge(w.prototype,{int64:function(){return tc.call(this)[e](!1)},uint64:function(){return tc.call(this)[e](!0)},sint64:function(){return tc.call(this).zzDecode()[e](!1)},fixed64:function(){return sh.call(this)[e](!0)},sfixed64:function(){return sh.call(this)[e](!1)}})}});var _h=c((xy,dh)=>{"use strict";dh.exports=_t;var lh=nc();(_t.prototype=Object.create(lh.prototype)).constructor=_t;var ch=Ve();function _t(r){lh.call(this,r)}_t._configure=function(){ch.Buffer&&(_t.prototype._slice=ch.Buffer.prototype.slice)};_t.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))};_t._configure()});var hh=c((Dy,ph)=>{"use strict";ph.exports=Hr;var ic=Ve();(Hr.prototype=Object.create(ic.EventEmitter.prototype)).constructor=Hr;function Hr(r,e,t){if(typeof r!="function")throw TypeError("rpcImpl must be a function");ic.EventEmitter.call(this),this.rpcImpl=r,this.requestDelimited=!!e,this.responseDelimited=!!t}Hr.prototype.rpcCall=function r(e,t,n,i,s){if(!i)throw TypeError("request must be specified");var o=this;if(!s)return ic.asPromise(r,o,e,t,n,i);if(!o.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return o.rpcImpl(e,t[o.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(u,l){if(u)return o.emit("error",u,e),s(u);if(l===null){o.end(!0);return}if(!(l instanceof n))try{l=n[o.responseDelimited?"decodeDelimited":"decode"](l)}catch(_){return o.emit("error",_,e),s(_)}return o.emit("data",l,e),s(null,l)})}catch(a){o.emit("error",a,e),setTimeout(function(){s(a)},0);return}};Hr.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var Eh=c(fh=>{"use strict";var WA=fh;WA.Service=hh()});var gh=c((By,mh)=>{"use strict";mh.exports={}});var Ah=c(Sh=>{"use strict";var Z=Sh;Z.build="minimal";Z.Writer=ec();Z.BufferWriter=nh();Z.Reader=nc();Z.BufferReader=_h();Z.util=Ve();Z.rpc=Eh();Z.roots=gh();Z.configure=Th;function Th(){Z.util._configure(),Z.Writer._configure(Z.BufferWriter),Z.Reader._configure(Z.BufferReader)}Th()});var Rh=c((Gy,Oh)=>{"use strict";Oh.exports=Ah()});var Ch=c(Nh=>{"use strict";Object.defineProperty(Nh,"__esModule",{value:!0})});var xh=c(wh=>{"use strict";Object.defineProperty(wh,"__esModule",{value:!0})});var Uh=c(Dh=>{"use strict";Object.defineProperty(Dh,"__esModule",{value:!0})});var Bh=c($r=>{"use strict";Object.defineProperty($r,"__esModule",{value:!0});$r.ESpanKind=void 0;var lO;(function(r){r[r.SPAN_KIND_UNSPECIFIED=0]="SPAN_KIND_UNSPECIFIED",r[r.SPAN_KIND_INTERNAL=1]="SPAN_KIND_INTERNAL",r[r.SPAN_KIND_SERVER=2]="SPAN_KIND_SERVER",r[r.SPAN_KIND_CLIENT=3]="SPAN_KIND_CLIENT",r[r.SPAN_KIND_PRODUCER=4]="SPAN_KIND_PRODUCER",r[r.SPAN_KIND_CONSUMER=5]="SPAN_KIND_CONSUMER"})(lO=$r.ESpanKind||($r.ESpanKind={}))});var Gh=c(qh=>{"use strict";Object.defineProperty(qh,"__esModule",{value:!0})});var kh=c(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.toMetric=Fe.toScopeMetrics=Fe.toResourceMetrics=void 0;var Vh=(p(),f(d)),ar=wu(),xs=qr(),dO=Gr();function _O(r,e){let t=(0,dO.getOtlpEncoder)(e);return{resource:{attributes:(0,xs.toAttributes)(r.resource.attributes),droppedAttributesCount:0},schemaUrl:void 0,scopeMetrics:Fh(r.scopeMetrics,t)}}Fe.toResourceMetrics=_O;function Fh(r,e){return Array.from(r.map(t=>({scope:{name:t.scope.name,version:t.scope.version},metrics:t.metrics.map(n=>Hh(n,e)),schemaUrl:t.scope.schemaUrl})))}Fe.toScopeMetrics=Fh;function Hh(r,e){let t={name:r.descriptor.name,description:r.descriptor.description,unit:r.descriptor.unit},n=EO(r.aggregationTemporality);switch(r.dataPointType){case ar.DataPointType.SUM:t.sum={aggregationTemporality:n,isMonotonic:r.isMonotonic,dataPoints:jh(r,e)};break;case ar.DataPointType.GAUGE:t.gauge={dataPoints:jh(r,e)};break;case ar.DataPointType.HISTOGRAM:t.histogram={aggregationTemporality:n,dataPoints:hO(r,e)};break;case ar.DataPointType.EXPONENTIAL_HISTOGRAM:t.exponentialHistogram={aggregationTemporality:n,dataPoints:fO(r,e)};break}return t}Fe.toMetric=Hh;function pO(r,e,t){let n={attributes:(0,xs.toAttributes)(r.attributes),startTimeUnixNano:t.encodeHrTime(r.startTime),timeUnixNano:t.encodeHrTime(r.endTime)};switch(e){case Vh.ValueType.INT:n.asInt=r.value;break;case Vh.ValueType.DOUBLE:n.asDouble=r.value;break}return n}function jh(r,e){return r.dataPoints.map(t=>pO(t,r.descriptor.valueType,e))}function hO(r,e){return r.dataPoints.map(t=>{let n=t.value;return{attributes:(0,xs.toAttributes)(t.attributes),bucketCounts:n.buckets.counts,explicitBounds:n.buckets.boundaries,count:n.count,sum:n.sum,min:n.min,max:n.max,startTimeUnixNano:e.encodeHrTime(t.startTime),timeUnixNano:e.encodeHrTime(t.endTime)}})}function fO(r,e){return r.dataPoints.map(t=>{let n=t.value;return{attributes:(0,xs.toAttributes)(t.attributes),count:n.count,min:n.min,max:n.max,sum:n.sum,positive:{offset:n.positive.offset,bucketCounts:n.positive.bucketCounts},negative:{offset:n.negative.offset,bucketCounts:n.negative.bucketCounts},scale:n.scale,zeroCount:n.zeroCount,startTimeUnixNano:e.encodeHrTime(t.startTime),timeUnixNano:e.encodeHrTime(t.endTime)}})}function EO(r){switch(r){case ar.AggregationTemporality.DELTA:return 1;case ar.AggregationTemporality.CUMULATIVE:return 2}}});var $h=c(Ds=>{"use strict";Object.defineProperty(Ds,"__esModule",{value:!0});Ds.createExportMetricsServiceRequest=void 0;var mO=kh();function gO(r,e){return{resourceMetrics:r.map(t=>(0,mO.toResourceMetrics)(t,e))}}Ds.createExportMetricsServiceRequest=gO});var Wh=c(ur=>{"use strict";Object.defineProperty(ur,"__esModule",{value:!0});ur.toLogAttributes=ur.createExportLogsServiceRequest=void 0;var TO=Gr(),cc=qr();function SO(r,e){let t=(0,TO.getOtlpEncoder)(e);return{resourceLogs:OO(r,t)}}ur.createExportLogsServiceRequest=SO;function AO(r){let e=new Map;for(let t of r){let{resource:n,instrumentationScope:{name:i,version:s="",schemaUrl:o=""}}=t,a=e.get(n);a||(a=new Map,e.set(n,a));let u=`${i}@${s}:${o}`,l=a.get(u);l||(l=[],a.set(u,l)),l.push(t)}return e}function OO(r,e){let t=AO(r);return Array.from(t,([n,i])=>({resource:{attributes:(0,cc.toAttributes)(n.attributes),droppedAttributesCount:0},scopeLogs:Array.from(i,([,s])=>{let{instrumentationScope:{name:o,version:a,schemaUrl:u}}=s[0];return{scope:{name:o,version:a},logRecords:s.map(l=>RO(l,e)),schemaUrl:u}}),schemaUrl:void 0}))}function RO(r,e){var t,n,i;return{timeUnixNano:e.encodeHrTime(r.hrTime),observedTimeUnixNano:e.encodeHrTime(r.hrTimeObserved),severityNumber:r.severityNumber,severityText:r.severityText,body:(0,cc.toAnyValue)(r.body),attributes:Xh(r.attributes),droppedAttributesCount:r.droppedAttributesCount,flags:(t=r.spanContext)===null||t===void 0?void 0:t.traceFlags,traceId:e.encodeOptionalSpanContext((n=r.spanContext)===null||n===void 0?void 0:n.traceId),spanId:e.encodeOptionalSpanContext((i=r.spanContext)===null||i===void 0?void 0:i.spanId)}}function Xh(r){return Object.keys(r).map(e=>(0,cc.toKeyValue)(e,r[e]))}ur.toLogAttributes=Xh});var Kh=c(j=>{"use strict";var bO=j&&j.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),cr=j&&j.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&bO(e,r,t)};Object.defineProperty(j,"__esModule",{value:!0});j.createExportLogsServiceRequest=j.createExportMetricsServiceRequest=j.createExportTraceServiceRequest=void 0;cr(Ch(),j);cr(Gr(),j);cr(xh(),j);cr(Uh(),j);cr(Bh(),j);cr(Gh(),j);var PO=ys();Object.defineProperty(j,"createExportTraceServiceRequest",{enumerable:!0,get:function(){return PO.createExportTraceServiceRequest}});var yO=$h();Object.defineProperty(j,"createExportMetricsServiceRequest",{enumerable:!0,get:function(){return yO.createExportMetricsServiceRequest}});var vO=Wh();Object.defineProperty(j,"createExportLogsServiceRequest",{enumerable:!0,get:function(){return vO.createExportLogsServiceRequest}})});var C=q(la(),1);p();fa();var Zh=q(Vd(),1),dr=q(it(),1),Jh=q(r_(),1),ef=q(wu(),1),lc=q(se(),1),Gs=q(Qr(),1),tf=q(cp(),1),He=q(T(),1);p();var _A=Symbol.for("@vercel/request-context");function Te(){return globalThis[_A]?.get()}var Uu=q(se(),1);function Os(r){return Object.fromEntries(Object.entries(r).filter(([e,t])=>t!==void 0))}function lp(r){return r?r.split("::").at(-1):void 0}function dp(r=Te(),e){if(!r)return;let t=e?hA(e,r.headers):void 0;return Os({[Uu.SemanticAttributes.HTTP_HOST]:r.headers.host,[Uu.SemanticAttributes.HTTP_USER_AGENT]:r.headers["user-agent"],"http.referer":r.headers.referer,"vercel.request_id":lp(r.headers["x-vercel-id"]),"vercel.matched_path":r.headers["x-matched-path"],"vercel.edge_region":process.env.VERCEL_REGION,...t})}var pA={keys(r){return[]},get(r,e){return r[e.toLocaleLowerCase()]}};function hA(r,e){if(typeof r=="function")return r(e,pA);let t={};for(let[n,i]of Object.entries(r)){let s=e[i.toLocaleLowerCase()];s!==void 0&&(t[n]=s)}return t}p();function Br(r){return(r&d.TraceFlags.SAMPLED)!==0}var Rs=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=>{d.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:i,traceFlags:s}=e.spanContext(),o=!e.parentSpanId||!this.rootSpanIds.has(n);if(o?this.rootSpanIds.set(n,{rootSpanId:i,open:[]}):this.rootSpanIds.get(n)?.open.push(e),o&&Br(s)){let a=Te(),u=dp(a,this.attributesFromHeaders);u&&e.setAttributes(u),a&&a.waitUntil(async()=>{if(this.rootSpanIds.has(n)){let l=new Promise(E=>{this.waitSpanEnd.set(n,E)}),_;await Promise.race([l,new Promise(E=>{_=setTimeout(()=>{this.waitSpanEnd.delete(n),E(void 0)},50)})]),_&&clearTimeout(_)}return this.forceFlush()})}for(let a of this.processors)a.onStart(e,t)}onEnd(e){let{traceId:t,spanId:n,traceFlags:i}=e.spanContext(),s=Br(i),o=this.rootSpanIds.get(t),a=o?.rootSpanId===n;if(s){let u=EA(e);u&&Object.assign(e.attributes,u)}if(a){if(this.rootSpanIds.delete(t),o.open.length>0){for(let u of o.open)if(!u.ended&&u.spanContext().spanId!==n)try{u.end()}catch(l){d.diag.error("@vercel/otel: onEnd failed:",l)}}}else if(o)for(let u=0;u<o.open.length;u++)o.open[u]?.spanContext().spanId===n&&o.open.splice(u,1);for(let u of this.processors)u.onEnd(e);if(a){let u=this.waitSpanEnd.get(t);u&&(this.waitSpanEnd.delete(t),u())}}},fA={[d.SpanKind.INTERNAL]:"internal",[d.SpanKind.SERVER]:"server",[d.SpanKind.CLIENT]:"client",[d.SpanKind.PRODUCER]:"producer",[d.SpanKind.CONSUMER]:"consumer"};function EA(r){let{kind:e,attributes:t}=r,{"operation.name":n,"resource.name":i,"span.type":s,"next.span_type":o,"http.method":a,"http.route":u}=t;if(n)return;let l=i??(a&&typeof a=="string"&&u&&typeof u=="string"?`${a} ${u}`:u);if(r.kind===d.SpanKind.SERVER&&a&&u&&typeof a=="string"&&typeof u=="string")return{"operation.name":"web.request","resource.name":l};let _=r.instrumentationLibrary.name,E=o??s;if(E&&typeof E=="string"){let O=_p(_,E);return u?{"operation.name":O,"resource.name":l}:{"operation.name":O}}return{"operation.name":_p(_,e===d.SpanKind.INTERNAL?"":fA[e])}}function _p(r,e){if(!r)return e;let t=r.replace(/[ @./]/g,"_");return t.startsWith("_")&&(t=t.slice(1)),e?`${t}.${e}`:t}var yp=q(ys(),1);var Pp=q(bp(),1);p();var rr=class extends Pp.OTLPExporterBase{constructor(e={}){super(e),e.headers&&(this._headers=e.headers)}onShutdown(){d.diag.debug("@vercel/otel/otlp: onShutdown")}onInit(){d.diag.debug("@vercel/otel/otlp: onInit")}send(e,t,n){if(this._shutdownOnce.isCalled){d.diag.debug("@vercel/otel/otlp: Shutdown already started. Cannot send objects");return}let i=this.convert(e),s,o,a;try{({body:s,contentType:o,headers:a}=this.toMessage(i))}catch(l){d.diag.warn("@vercel/otel/otlp: no proto",l);return}let u=fetch(this.url,{method:"POST",body:s,headers:{...this._headers,...a,"Content-Type":o,"User-Agent":"OTel-OTLP-Exporter-JavaScript/0.46.0"},next:{internal:!0}}).then(l=>{d.diag.debug("@vercel/otel/otlp: onSuccess",l.status,l.statusText),t(),l.arrayBuffer().catch(()=>{})}).catch(l=>{d.diag.error("@vercel/otel/otlp: onError",l),n(l)}).finally(()=>{let l=this._sendingPromises.indexOf(u);this._sendingPromises.splice(l,1)});this._sendingPromises.push(u)}getDefaultUrl(e){throw new Error("Method not implemented.")}};var BA="v1/traces",qA=`http://localhost:4318/${BA}`;function Is(r){return typeof r.url=="string"?r.url:qA}var nr=class{constructor(e={}){this.impl=new $u(e)}export(e,t){this.impl.export(e,t)}shutdown(){return this.impl.shutdown()}forceFlush(){return this.impl.forceFlush()}},$u=class extends rr{convert(e){return(0,yp.createExportTraceServiceRequest)(e,{useHex:!0,useLongBits:!1})}toMessage(e){return{body:JSON.stringify(e),contentType:"application/json"}}getDefaultUrl(e){return Is(e)}};var vh=q(ys(),1);var bh=q(Rh(),1);function Ph(r){let e=new bh.Writer;return KA(r,e),e.finish()}function KA(r,e){if(r.resourceSpans!=null&&r.resourceSpans.length)for(let t=0;t<r.resourceSpans.length;++t)zA(r.resourceSpans[t],e.uint32(10).fork()).ldelim();return e}function zA(r,e){if(r.resource!=null&&YA(r.resource,e.uint32(10).fork()).ldelim(),r.scopeSpans!=null&&r.scopeSpans.length)for(let t=0;t<r.scopeSpans.length;++t)QA(r.scopeSpans[t],e.uint32(18).fork()).ldelim();return r.schemaUrl!=null&&e.uint32(26).string(r.schemaUrl),e}function YA(r,e){if(r.attributes!=null&&r.attributes.length)for(let t=0;t<r.attributes.length;++t)sr(r.attributes[t],e.uint32(10).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(16).uint32(r.droppedAttributesCount),e}function QA(r,e){if(r.scope!=null&&eO(r.scope,e.uint32(10).fork()).ldelim(),r.spans!=null&&r.spans.length)for(let t=0;t<r.spans.length;++t)tO(r.spans[t],e.uint32(18).fork()).ldelim();return r.schemaUrl!=null&&e.uint32(26).string(r.schemaUrl),e}function sr(r,e){return r.key!=null&&e.uint32(10).string(r.key),r.value!=null&&yh(r.value,e.uint32(18).fork()).ldelim(),e}function yh(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&&ZA(r.arrayValue,e.uint32(42).fork()).ldelim(),r.kvlistValue!=null&&JA(r.kvlistValue,e.uint32(50).fork()).ldelim(),r.bytesValue!=null&&e.uint32(58).bytes(r.bytesValue),e}function ZA(r,e){if(r.values!=null&&r.values.length)for(let t=0;t<r.values.length;++t)yh(r.values[t],e.uint32(10).fork()).ldelim();return e}function JA(r,e){if(r.values!=null&&r.values.length)for(let t=0;t<r.values.length;++t)sr(r.values[t],e.uint32(10).fork()).ldelim();return e}function eO(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)sr(r.attributes[t],e.uint32(26).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(32).uint32(r.droppedAttributesCount),e}function tO(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)sr(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)nO(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)iO(r.links[t],e.uint32(106).fork()).ldelim();return r.droppedLinksCount!=null&&e.uint32(112).uint32(r.droppedLinksCount),r.status!=null&&rO(r.status,e.uint32(122).fork()).ldelim(),e}function rO(r,e){return r.message!=null&&e.uint32(18).string(r.message),r.code!=null&&e.uint32(24).int32(r.code),e}function nO(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)sr(r.attributes[t],e.uint32(26).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(32).uint32(r.droppedAttributesCount),e}function iO(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)sr(r.attributes[t],e.uint32(34).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(40).uint32(r.droppedAttributesCount),e}var pt=class{constructor(e={}){this.impl=new sc(e)}export(e,t){this.impl.export(e,t)}shutdown(){return this.impl.shutdown()}forceFlush(){return this.impl.forceFlush()}},sc=class extends rr{convert(e){return(0,vh.createExportTraceServiceRequest)(e,void 0)}toMessage(e){return{body:Ph(e),contentType:"application/x-protobuf",headers:{accept:"application/x-protobuf"}}}getDefaultUrl(e){return Is(e)}};p();var Pe=q(se(),1);function Ih(r,e){return r.replace(/\{(?<temp1>[^{}]+)\}/g,(t,n)=>{let i=e[n];return i!==void 0?String(i):t})}var or=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(){}enable(){this.disable();let{tracerProvider:e}=this;if(!e)return;let t=e.getTracer(this.instrumentationName,this.instrumentationVersion),n=this.config.ignoreUrls??[],i=(y,k)=>{if(k?.opentelemetry?.ignore!==void 0)return k.opentelemetry.ignore;if(n.length===0)return!1;let S=y.toString();return n.some(b=>typeof b=="string"?b==="*"?!0:S.startsWith(b):b.test(S))},s=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,a=this.config.propagateContextUrls??[],u=this.config.dontPropagateContextUrls??[],l=this.config.resourceNameTemplate,{attributesFromRequestHeaders:_,attributesFromResponseHeaders:E}=this.config,O=(y,k)=>{if(k?.opentelemetry?.propagateContext)return k.opentelemetry.propagateContext;let S=y.toString();return u.length>0&&u.some(b=>typeof b=="string"?b==="*"?!0:S.startsWith(b):b.test(S))?!1:s&&y.protocol==="https:"&&(y.host===s||y.host===o||y.host===Te()?.headers.host)||!s&&y.protocol==="http:"&&y.hostname==="localhost"?!0:a.some(b=>typeof b=="string"?b==="*"?!0:S.startsWith(b):b.test(S))};process.env.NEXT_OTEL_FETCH_DISABLED="1";let x=globalThis.fetch;this.originalFetch=x;let J=async(y,k)=>{let S=k;if(S?.next?.internal)return x(y,S);let b=new Request(y instanceof Request?y.clone():y,S),ye=new URL(b.url);if(i(ye,S))return x(y,S);let Vs={[Pe.SemanticAttributes.HTTP_METHOD]:b.method,[Pe.SemanticAttributes.HTTP_URL]:b.url,[Pe.SemanticAttributes.HTTP_HOST]:ye.host,[Pe.SemanticAttributes.HTTP_SCHEME]:ye.protocol.replace(":",""),[Pe.SemanticAttributes.NET_PEER_NAME]:ye.hostname,[Pe.SemanticAttributes.NET_PEER_PORT]:ye.port},ht=l?Ih(l,Vs):oO(b.url),nf=S?.opentelemetry?.spanName??`fetch ${b.method} ${b.url}`,dc=d.context.active(),B=t.startSpan(nf,{kind:d.SpanKind.CLIENT,attributes:{...Vs,"operation.name":`fetch.${b.method}`,"resource.name":ht,...S?.opentelemetry?.attributes}},dc);if(!B.isRecording()||!Br(B.spanContext().traceFlags))return B.end(),x(y,S);if(O(ye,S)){let ft=d.trace.setSpan(dc,B);d.propagation.inject(ft,b.headers,sO)}_&&Lh(B,_,b.headers);try{let ft=Date.now();S?.body&&S.body instanceof FormData&&b.headers.delete("content-type");let ve=await x(y,{...S,headers:b.headers}),sf=Date.now()-ft;return B.setAttribute(Pe.SemanticAttributes.HTTP_STATUS_CODE,ve.status),B.setAttribute("http.response_time",sf),E&&Lh(B,E,ve.headers),ve.status>=500&&oc(B,`Status: ${ve.status} (${ve.statusText})`),ve.body?aO(ve).then(js=>{B.isRecording()&&(B.setAttribute(Pe.SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED,js),B.end())},js=>{B.isRecording()&&(oc(B,js),B.end())}):B.end(),ve}catch(ft){throw oc(B,ft),B.end(),ft}};globalThis.fetch=J}disable(){this.originalFetch&&(globalThis.fetch=this.originalFetch)}},sO={set(r,e,t){r.set(e,t)}};function oO(r){let e=r.indexOf("?");return e===-1?r:r.substring(0,e)}function aO(r){let e=0,n=r.clone().body?.getReader();if(!n)return Promise.resolve(0);let i=()=>n.read().then(({done:s,value:o})=>{if(!s)return e+=o.byteLength,i()});return i().then(()=>e)}function oc(r,e){if(e instanceof Error)r.recordException(e),r.setStatus({code:d.SpanStatusCode.ERROR,message:e.message});else{let t=String(e);r.setStatus({code:d.SpanStatusCode.ERROR,message:t})}}function Lh(r,e,t){for(let[n,i]of Object.entries(e)){let s=t.get(i);s!==null&&r.setAttribute(n,s)}}p();var Mh=q(T(),1),uO="00",ac="traceparent",uc="tracestate",kr=class{fields(){return[ac,uc]}inject(e,t,n){let i=d.trace.getSpanContext(e);if(!i||(0,Mh.isTracingSuppressed)(e)||!(0,d.isSpanContextValid)(i))return;let s=`${uO}-${i.traceId}-${i.spanId}-0${Number(i.traceFlags||0).toString(16)}`;n.set(t,ac,s),i.traceState&&n.set(t,uc,i.traceState.serialize())}extract(e,t,n){let i=n.get(t,ac);if(!i)return e;let s=Array.isArray(i)?i[0]:i;if(typeof s!="string")return e;let o=cO(s);if(!o)return e;o.isRemote=!0;let a=n.get(t,uc);if(a){let u=Array.isArray(a)?a.join(","):a;o.traceState=(0,d.createTraceState)(typeof u=="string"?u:void 0)}return d.trace.setSpanContext(e,o)}};function cO(r){let[e,t,n,i,s]=r.split("-");return!e||!t||!n||!i||e.length!==2||t.length!==32||n.length!==16||i.length!==2||e==="00"&&s?null:{traceId:t,spanId:n,traceFlags:parseInt(i,16)}}p();var ws=class{fields(){return[]}inject(){}extract(e){let t=Te();if(!t?.telemetry)return d.diag.warn("@vercel/otel: Vercel telemetry extension not found."),e;let{rootSpanContext:n}=t.telemetry;return n?(d.diag.debug("@vercel/otel: Extracted root SpanContext from Vercel request context.",n),d.trace.setSpanContext(e,{...n,isRemote:!0,traceFlags:n.traceFlags||d.TraceFlags.SAMPLED})):e}};p();var Us=q(T(),1),zh=q(Kh(),1);var Bs=class{export(e,t){let n=Te();if(!n?.telemetry){d.diag.warn("@vercel/otel: no telemetry context found"),t({code:Us.ExportResultCode.SUCCESS,error:void 0});return}try{let i=(0,zh.createExportTraceServiceRequest)(e,{useHex:!0,useLongBits:!1});n.telemetry.reportSpans(i),t({code:Us.ExportResultCode.SUCCESS,error:void 0})}catch(i){t({code:Us.ExportResultCode.FAILED,error:i instanceof Error?i:new Error(String(i))})}}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}};var IO={ALL:d.DiagLogLevel.ALL,VERBOSE:d.DiagLogLevel.VERBOSE,DEBUG:d.DiagLogLevel.DEBUG,INFO:d.DiagLogLevel.INFO,WARN:d.DiagLogLevel.WARN,ERROR:d.DiagLogLevel.ERROR,NONE:d.DiagLogLevel.NONE},qs=class{constructor(e={}){this.configuration=e}start(){let e=LO(),t=this.configuration,n=process.env.NEXT_RUNTIME||"nodejs",i=!!e.OTEL_SDK_DISABLED;if(process.env.OTEL_LOG_LEVEL&&d.diag.setLogger(new d.DiagConsoleLogger,{logLevel:IO[process.env.OTEL_LOG_LEVEL.toUpperCase()]}),i)return;let s=t.idGenerator??new C.RandomIdGenerator,o=t.contextManager??new tf.AsyncLocalStorageContextManager;o.enable(),this.contextManager=o;let a=e.OTEL_SERVICE_NAME||t.serviceName||"app",u=new dr.Resource(Os({[lc.SemanticResourceAttributes.SERVICE_NAME]:a,"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,[lc.SemanticResourceAttributes.SERVICE_VERSION]:process.env.VERCEL_DEPLOYMENT_ID,...t.attributes})),l=t.resourceDetectors??[dr.envDetectorSync];if(t.autoDetectResources??!0){let S={detectors:l};u=u.merge((0,dr.detectResourcesSync)(S))}let E=NO(t.propagators,t,e),O=CO(t.traceSampler,e),x=wO(t.spanProcessors,t,e);x.length===0&&d.diag.warn("@vercel/otel: No span processors configured. No spans will be exported.");let J=t.spanLimits,y=new C.BasicTracerProvider({resource:u,idGenerator:s,sampler:O,spanLimits:J});if(y.addSpanProcessor(new Rs(x,t.attributesFromHeaders)),y.register({contextManager:o,propagator:new He.CompositePropagator({propagators:E})}),this.tracerProvider=y,t.logRecordProcessor){let S=new Jh.LoggerProvider({resource:u});this.loggerProvider=S,S.addLogRecordProcessor(t.logRecordProcessor),at.logs.setGlobalLoggerProvider(S)}if(t.metricReader||t.views){let S=new ef.MeterProvider({resource:u,views:t.views??[]});t.metricReader&&S.addMetricReader(t.metricReader),d.metrics.setGlobalMeterProvider(S),this.meterProvider=S}let k=MO(t.instrumentations,t.instrumentationConfig);this.disableInstrumentations=(0,Zh.registerInstrumentations)({instrumentations:k}),d.diag.info("@vercel/otel: started",a,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()),d.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 LO(){let r=(0,Gs.parseEnvironment)(process.env);return{...Gs.DEFAULT_ENVIRONMENT,...r}}function MO(r,e){return(r??["auto"]).map(t=>t==="auto"?(d.diag.debug("@vercel/otel: Configure instrumentations: fetch",e?.fetch),[new or(e?.fetch)]):t==="fetch"?(d.diag.debug("@vercel/otel: Configure instrumentations: fetch",e?.fetch),new or(e?.fetch)):t).flat()}function NO(r,e,t){let n=t.OTEL_PROPAGATORS&&t.OTEL_PROPAGATORS.length>0?t.OTEL_PROPAGATORS:void 0;return(r??n??["auto"]).map(i=>{if(i==="none")return[];if(i==="auto"){let s=[];return s.push({name:"tracecontext",propagator:new kr}),s.push({name:"baggage",propagator:new He.W3CBaggagePropagator}),e.spanProcessors?.includes("experimental-vercel-trace")&&s.push({name:"vercel-runtime",propagator:new ws}),d.diag.debug(`@vercel/otel: Configure propagators: ${s.map(o=>o.name).join(", ")}`),s.map(o=>o.propagator)}if(i==="tracecontext")return d.diag.debug("@vercel/otel: Configure propagator: tracecontext"),new kr;if(i==="baggage")return d.diag.debug("@vercel/otel: Configure propagator: baggage"),new He.W3CBaggagePropagator;if(typeof i=="string")throw new Error(`Unknown propagator: "${i}"`);return i}).flat()}var Yh="always_on",lr=1;function CO(r,e){if(r&&typeof r!="string")return r;let t=r&&r!=="auto"?r:e.OTEL_TRACES_SAMPLER||Yh;switch(d.diag.debug("@vercel/otel: Configure sampler: ",t),t){case"always_on":return new C.AlwaysOnSampler;case"always_off":return new C.AlwaysOffSampler;case"parentbased_always_on":return new C.ParentBasedSampler({root:new C.AlwaysOnSampler});case"parentbased_always_off":return new C.ParentBasedSampler({root:new C.AlwaysOffSampler});case"traceidratio":return new C.TraceIdRatioBasedSampler(Qh(e));case"parentbased_traceidratio":return new C.ParentBasedSampler({root:new C.TraceIdRatioBasedSampler(Qh(e))});default:return d.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER value "${String(e.OTEL_TRACES_SAMPLER)} invalid, defaulting to ${Yh}".`),new C.AlwaysOnSampler}}function Qh(r){if(r.OTEL_TRACES_SAMPLER_ARG===void 0||r.OTEL_TRACES_SAMPLER_ARG==="")return d.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${lr}.`),lr;d.diag.debug("@vercel/otel: Configure sampler probability: ",r.OTEL_TRACES_SAMPLER_ARG);let e=Number(r.OTEL_TRACES_SAMPLER_ARG);return isNaN(e)?(d.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER_ARG=${r.OTEL_TRACES_SAMPLER_ARG} was given, but it is invalid, defaulting to ${lr}.`),lr):e<0||e>1?(d.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 ${lr}.`),lr):e}function wO(r,e,t){return[...(r??["auto"]).map(n=>{if(n==="auto"){if(process.env.VERCEL_OTEL_ENDPOINTS){let i=process.env.VERCEL_OTEL_ENDPOINTS_PORT||"4318",s=process.env.VERCEL_OTEL_ENDPOINTS_PROTOCOL||"http/protobuf";d.diag.debug("@vercel/otel: Configure vercel otel collector on port: ",i,s);let o={url:`http://localhost:${i}/v1/traces`,headers:{}},a=s==="http/protobuf"?new pt(o):new nr(o);return new C.BatchSpanProcessor(a)}return!e.traceExporter||e.traceExporter==="auto"||t.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT||t.OTEL_EXPORTER_OTLP_ENDPOINT?new C.BatchSpanProcessor(xO(t)):void 0}else if(n==="experimental-vercel-trace")return d.diag.debug("@vercel/otel: Configure vercel-runtime exporter"),new C.BatchSpanProcessor(new Bs);return n}).filter(BO),...e.traceExporter&&e.traceExporter!=="auto"?[new C.BatchSpanProcessor(e.traceExporter)]:[]]}function xO(r){let e=process.env.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL??process.env.OTEL_EXPORTER_OTLP_PROTOCOL??"http/protobuf",t=UO(r),n={...He.baggageUtils.parseKeyPairsIntoRecord(r.OTEL_EXPORTER_OTLP_HEADERS),...He.baggageUtils.parseKeyPairsIntoRecord(r.OTEL_EXPORTER_OTLP_TRACES_HEADERS)};switch(d.diag.debug("@vercel/otel: Configure trace exporter: ",e,t,`headers: ${Object.keys(n).join(",")||"<none>"}`),e){case"http/json":return new nr({url:t,headers:n});case"http/protobuf":return new pt({url:t,headers:n});default:return d.diag.warn(`@vercel/otel: Unsupported OTLP traces protocol: ${e}. Using http/protobuf.`),new pt}}var rf="v1/traces",DO=`http://localhost:4318/${rf}`;function UO(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}/${rf}`:DO}function BO(r){return r!=null}function yv(r){let e;r?typeof r=="string"?e={serviceName:r}:e=r:e={},new qs(e).start()}export{or as FetchInstrumentation,nr as OTLPHttpJsonTraceExporter,pt as OTLPHttpProtoTraceExporter,yv as registerOTel};
20
+ `,(0,ss.getConflictResolutionRecipe)(s,e))}return n}};os.MetricStorageRegistry=fu});var $_=c(as=>{"use strict";Object.defineProperty(as,"__esModule",{value:!0});as.MultiMetricStorage=void 0;var Eu=class{constructor(e){this._backingStorages=e}record(e,t,n,i){this._backingStorages.forEach(s=>{s.record(e,t,n,i)})}};as.MultiMetricStorage=Eu});var W_=c(er=>{"use strict";Object.defineProperty(er,"__esModule",{value:!0});er.BatchObservableResultImpl=er.ObservableResultImpl=void 0;var Jt=(p(),f(d)),X_=xr(),bS=Zi(),mu=class{constructor(e,t){this._instrumentName=e,this._valueType=t,this._buffer=new X_.AttributeHashMap}observe(e,t={}){if(typeof e!="number"){Jt.diag.warn(`non-number value provided to metric ${this._instrumentName}: ${e}`);return}this._valueType===Jt.ValueType.INT&&!Number.isInteger(e)&&(Jt.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)}};er.ObservableResultImpl=mu;var gu=class{constructor(){this._buffer=new Map}observe(e,t,n={}){if(!(0,bS.isObservableInstrument)(e))return;let i=this._buffer.get(e);if(i==null&&(i=new X_.AttributeHashMap,this._buffer.set(e,i)),typeof t!="number"){Jt.diag.warn(`non-number value provided to metric ${e._descriptor.name}: ${t}`);return}e._descriptor.valueType===Jt.ValueType.INT&&!Number.isInteger(t)&&(Jt.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))||i.set(n,t)}};er.BatchObservableResultImpl=gu});var Y_=c(us=>{"use strict";Object.defineProperty(us,"__esModule",{value:!0});us.ObservableRegistry=void 0;var PS=(p(),f(d)),K_=Zi(),z_=W_(),Dr=me(),Tu=class{constructor(){this._callbacks=[],this._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(K_.isObservableInstrument));if(n.size===0){PS.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(K_.isObservableInstrument)),i=this._findBatchCallback(e,n);i<0||this._batchCallbacks.splice(i,1)}async observe(e,t){let n=this._observeCallbacks(e,t),i=this._observeBatchCallbacks(e,t);return(await(0,Dr.PromiseAllSettled)([...n,...i])).filter(Dr.isPromiseAllSettledRejectionResult).map(a=>a.reason)}_observeCallbacks(e,t){return this._callbacks.map(async({callback:n,instrument:i})=>{let s=new z_.ObservableResultImpl(i._descriptor.name,i._descriptor.valueType),o=Promise.resolve(n(s));t!=null&&(o=(0,Dr.callWithTimeout)(o,t)),await o,i._metricStorages.forEach(a=>{a.record(s._buffer,e)})})}_observeBatchCallbacks(e,t){return this._batchCallbacks.map(async({callback:n,instruments:i})=>{let s=new z_.BatchObservableResultImpl,o=Promise.resolve(n(s));t!=null&&(o=(0,Dr.callWithTimeout)(o,t)),await o,i.forEach(a=>{let u=s._buffer.get(a);u!=null&&a._metricStorages.forEach(l=>{l.record(u,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,Dr.setEquals)(n.instruments,t))}};us.ObservableRegistry=Tu});var Q_=c(cs=>{"use strict";Object.defineProperty(cs,"__esModule",{value:!0});cs.SyncMetricStorage=void 0;var yS=au(),vS=du(),IS=pu(),Su=class extends yS.MetricStorage{constructor(e,t,n,i){super(e),this._attributesProcessor=n,this._deltaMetricStorage=new vS.DeltaMetricProcessor(t),this._temporalMetricStorage=new IS.TemporalMetricProcessor(t,i)}record(e,t,n,i){t=this._attributesProcessor.process(t,n),this._deltaMetricStorage.record(e,t,n,i)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}};cs.SyncMetricStorage=Su});var Ou=c(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.FilteringAttributesProcessor=De.NoopAttributesProcessor=De.AttributesProcessor=void 0;var Ur=class{static Noop(){return LS}};De.AttributesProcessor=Ur;var ls=class extends Ur{process(e,t){return e}};De.NoopAttributesProcessor=ls;var Au=class extends Ur{constructor(e){super(),this._allowedAttributeNames=e}process(e,t){let n={};return Object.keys(e).filter(i=>this._allowedAttributeNames.includes(i)).forEach(i=>n[i]=e[i]),n}};De.FilteringAttributesProcessor=Au;var LS=new ls});var Z_=c(ds=>{"use strict";Object.defineProperty(ds,"__esModule",{value:!0});ds.MeterSharedState=void 0;var MS=Re(),NS=U_(),CS=me(),wS=B_(),xS=k_(),DS=$_(),US=Y_(),BS=Q_(),qS=Ou(),Ru=class{constructor(e,t){this._meterProviderSharedState=e,this._instrumentationScope=t,this.metricStorageRegistry=new xS.MetricStorageRegistry,this.observableRegistry=new US.ObservableRegistry,this.meter=new NS.Meter(this)}registerMetricStorage(e){let t=this._registerMetricStorage(e,BS.SyncMetricStorage);return t.length===1?t[0]:new DS.MultiMetricStorage(t)}registerAsyncMetricStorage(e){return this._registerMetricStorage(e,wS.AsyncMetricStorage)}async collect(e,t,n){let i=await this.observableRegistry.observe(t,n?.timeoutMillis),s=this.metricStorageRegistry.getStorages(e);if(s.length===0)return null;let o=s.map(a=>a.collect(e,t)).filter(CS.isNotNullish);return o.length===0?{errors:i}:{scopeMetrics:{scope:this._instrumentationScope,metrics:o},errors:i}}_registerMetricStorage(e,t){let i=this._meterProviderSharedState.viewRegistry.findViews(e,this._instrumentationScope).map(s=>{let o=(0,MS.createInstrumentDescriptorWithView)(s,e),a=this.metricStorageRegistry.findOrUpdateCompatibleStorage(o);if(a!=null)return a;let u=s.aggregation.createAggregator(o),l=new t(o,u,s.attributesProcessor,this._meterProviderSharedState.metricCollectors);return this.metricStorageRegistry.register(l),l});if(i.length===0){let o=this._meterProviderSharedState.selectAggregations(e.type).map(([a,u])=>{let l=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(a,e);if(l!=null)return l;let _=u.createAggregator(e),E=new t(e,_,qS.AttributesProcessor.Noop(),[a]);return this.metricStorageRegistry.registerForCollector(a,E),E});i=i.concat(o)}return i}};ds.MeterSharedState=Ru});var J_=c(_s=>{"use strict";Object.defineProperty(_s,"__esModule",{value:!0});_s.MeterProviderSharedState=void 0;var GS=me(),VS=D_(),jS=Z_(),bu=class{constructor(e){this.resource=e,this.viewRegistry=new VS.ViewRegistry,this.metricCollectors=[],this.meterSharedStates=new Map}getMeterSharedState(e){let t=(0,GS.instrumentationScopeId)(e),n=this.meterSharedStates.get(t);return n==null&&(n=new jS.MeterSharedState(this,e),this.meterSharedStates.set(t,n)),n}selectAggregations(e){let t=[];for(let n of this.metricCollectors)t.push([n,n.selectAggregation(e)]);return t}};_s.MeterProviderSharedState=bu});var ep=c(ps=>{"use strict";Object.defineProperty(ps,"__esModule",{value:!0});ps.MetricCollector=void 0;var FS=T(),Pu=class{constructor(e,t){this._sharedState=e,this._metricReader=t}async collect(e){let t=(0,FS.millisToHrTime)(Date.now()),n=[],i=[],s=Array.from(this._sharedState.meterSharedStates.values()).map(async o=>{let a=await o.collect(this,t,e);a?.scopeMetrics!=null&&n.push(a.scopeMetrics),a?.errors!=null&&i.push(...a.errors)});return await Promise.all(s),{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:n},errors:i}}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)}};ps.MetricCollector=Pu});var rp=c(fs=>{"use strict";Object.defineProperty(fs,"__esModule",{value:!0});fs.MeterProvider=void 0;var hs=(p(),f(d)),tp=it(),HS=J_(),kS=ep(),yu=class{constructor(e){var t;this._shutdown=!1;let n=tp.Resource.default().merge((t=e?.resource)!==null&&t!==void 0?t:tp.Resource.empty());if(this._sharedState=new HS.MeterProviderSharedState(n),e?.views!=null&&e.views.length>0)for(let i of e.views)this._sharedState.viewRegistry.addView(i)}getMeter(e,t="",n={}){return this._shutdown?(hs.diag.warn("A shutdown MeterProvider cannot provide a Meter"),(0,hs.createNoopMeter)()):this._sharedState.getMeterSharedState({name:e,version:t,schemaUrl:n.schemaUrl}).meter}addMetricReader(e){let t=new kS.MetricCollector(this._sharedState,e);e.setMetricProducer(t),this._sharedState.metricCollectors.push(t)}async shutdown(e){if(this._shutdown){hs.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){hs.diag.warn("invalid attempt to force flush after MeterProvider shutdown");return}await Promise.all(this._sharedState.metricCollectors.map(t=>t.forceFlush(e)))}};fs.MeterProvider=yu});var Es=c(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.ExactPredicate=tr.PatternPredicate=void 0;var $S=/[\^$\\.+?()[\]{}|]/g,vu=class r{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($S,"\\$&").replace("*",".*")}$`}static hasWildcard(e){return e.includes("*")}};tr.PatternPredicate=vu;var Iu=class{constructor(e){this._matchAll=e===void 0,this._pattern=e}match(e){return!!(this._matchAll||e===this._pattern)}};tr.ExactPredicate=Iu});var ip=c(ms=>{"use strict";Object.defineProperty(ms,"__esModule",{value:!0});ms.InstrumentSelector=void 0;var np=Es(),Lu=class{constructor(e){var t;this._nameFilter=new np.PatternPredicate((t=e?.name)!==null&&t!==void 0?t:"*"),this._type=e?.type,this._unitFilter=new np.ExactPredicate(e?.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}};ms.InstrumentSelector=Lu});var sp=c(gs=>{"use strict";Object.defineProperty(gs,"__esModule",{value:!0});gs.MeterSelector=void 0;var Mu=Es(),Nu=class{constructor(e){this._nameFilter=new Mu.ExactPredicate(e?.name),this._versionFilter=new Mu.ExactPredicate(e?.version),this._schemaUrlFilter=new Mu.ExactPredicate(e?.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}};gs.MeterSelector=Nu});var ap=c(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});Ts.View=void 0;var XS=Es(),op=Ou(),WS=ip(),KS=sp(),zS=ki();function YS(r){return r.instrumentName==null&&r.instrumentType==null&&r.instrumentUnit==null&&r.meterName==null&&r.meterVersion==null&&r.meterSchemaUrl==null}var Cu=class{constructor(e){var t;if(YS(e))throw new Error("Cannot create view with no selector arguments supplied");if(e.name!=null&&(e?.instrumentName==null||XS.PatternPredicate.hasWildcard(e.instrumentName)))throw new Error("Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.");e.attributeKeys!=null?this.attributesProcessor=new op.FilteringAttributesProcessor(e.attributeKeys):this.attributesProcessor=op.AttributesProcessor.Noop(),this.name=e.name,this.description=e.description,this.aggregation=(t=e.aggregation)!==null&&t!==void 0?t:zS.Aggregation.Default(),this.instrumentSelector=new WS.InstrumentSelector({name:e.instrumentName,type:e.instrumentType,unit:e.instrumentUnit}),this.meterSelector=new KS.MeterSelector({name:e.meterName,version:e.meterVersion,schemaUrl:e.meterSchemaUrl})}};Ts.View=Cu});var wu=c(m=>{"use strict";Object.defineProperty(m,"__esModule",{value:!0});m.TimeoutError=m.View=m.Aggregation=m.SumAggregation=m.LastValueAggregation=m.HistogramAggregation=m.DropAggregation=m.ExponentialHistogramAggregation=m.ExplicitBucketHistogramAggregation=m.DefaultAggregation=m.MeterProvider=m.InstrumentType=m.ConsoleMetricExporter=m.InMemoryMetricExporter=m.PeriodicExportingMetricReader=m.MetricReader=m.DataPointType=m.AggregationTemporality=void 0;var QS=Mi();Object.defineProperty(m,"AggregationTemporality",{enumerable:!0,get:function(){return QS.AggregationTemporality}});var ZS=Dt();Object.defineProperty(m,"DataPointType",{enumerable:!0,get:function(){return ZS.DataPointType}});var JS=Ka();Object.defineProperty(m,"MetricReader",{enumerable:!0,get:function(){return JS.MetricReader}});var eA=M_();Object.defineProperty(m,"PeriodicExportingMetricReader",{enumerable:!0,get:function(){return eA.PeriodicExportingMetricReader}});var tA=C_();Object.defineProperty(m,"InMemoryMetricExporter",{enumerable:!0,get:function(){return tA.InMemoryMetricExporter}});var rA=x_();Object.defineProperty(m,"ConsoleMetricExporter",{enumerable:!0,get:function(){return rA.ConsoleMetricExporter}});var nA=Re();Object.defineProperty(m,"InstrumentType",{enumerable:!0,get:function(){return nA.InstrumentType}});var iA=rp();Object.defineProperty(m,"MeterProvider",{enumerable:!0,get:function(){return iA.MeterProvider}});var Ue=ki();Object.defineProperty(m,"DefaultAggregation",{enumerable:!0,get:function(){return Ue.DefaultAggregation}});Object.defineProperty(m,"ExplicitBucketHistogramAggregation",{enumerable:!0,get:function(){return Ue.ExplicitBucketHistogramAggregation}});Object.defineProperty(m,"ExponentialHistogramAggregation",{enumerable:!0,get:function(){return Ue.ExponentialHistogramAggregation}});Object.defineProperty(m,"DropAggregation",{enumerable:!0,get:function(){return Ue.DropAggregation}});Object.defineProperty(m,"HistogramAggregation",{enumerable:!0,get:function(){return Ue.HistogramAggregation}});Object.defineProperty(m,"LastValueAggregation",{enumerable:!0,get:function(){return Ue.LastValueAggregation}});Object.defineProperty(m,"SumAggregation",{enumerable:!0,get:function(){return Ue.SumAggregation}});Object.defineProperty(m,"Aggregation",{enumerable:!0,get:function(){return Ue.Aggregation}});var sA=ap();Object.defineProperty(m,"View",{enumerable:!0,get:function(){return sA.View}});var oA=me();Object.defineProperty(m,"TimeoutError",{enumerable:!0,get:function(){return oA.TimeoutError}})});var up=c(Ss=>{"use strict";Object.defineProperty(Ss,"__esModule",{value:!0});Ss.AbstractAsyncHooksContextManager=void 0;var aA=ee("events"),uA=["addListener","on","once","prependListener","prependOnceListener"],xu=class{constructor(){this._kOtListeners=Symbol("OtListeners"),this._wrapped=!1}bind(e,t){return t instanceof aA.EventEmitter?this._bindEventEmitter(e,t):typeof t=="function"?this._bindFunction(e,t):t}_bindFunction(e,t){let n=this,i=function(...s){return n.with(e,()=>t.apply(this,s))};return Object.defineProperty(i,"length",{enumerable:!1,configurable:!0,writable:!1,value:t.length}),i}_bindEventEmitter(e,t){return this._getPatchMap(t)!==void 0||(this._createPatchMap(t),uA.forEach(i=>{t[i]!==void 0&&(t[i]=this._patchAddListener(t,t[i],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(i,s){var o;let a=(o=n._getPatchMap(e))===null||o===void 0?void 0:o[i];if(a===void 0)return t.call(this,i,s);let u=a.get(s);return t.call(this,i,u||s)}}_patchRemoveAllListeners(e,t){let n=this;return function(i){let s=n._getPatchMap(e);return s!==void 0&&(arguments.length===0?n._createPatchMap(e):s[i]!==void 0&&delete s[i]),t.apply(this,arguments)}}_patchAddListener(e,t,n){let i=this;return function(s,o){if(i._wrapped)return t.call(this,s,o);let a=i._getPatchMap(e);a===void 0&&(a=i._createPatchMap(e));let u=a[s];u===void 0&&(u=new WeakMap,a[s]=u);let l=i.bind(n,o);u.set(o,l),i._wrapped=!0;try{return t.call(this,s,l)}finally{i._wrapped=!1}}}_createPatchMap(e){let t=Object.create(null);return e[this._kOtListeners]=t,t}_getPatchMap(e){return e[this._kOtListeners]}};Ss.AbstractAsyncHooksContextManager=xu});var cp=c(As=>{"use strict";Object.defineProperty(As,"__esModule",{value:!0});As.AsyncLocalStorageContextManager=void 0;var cA=(p(),f(d)),lA=ee("async_hooks"),dA=up(),Du=class extends dA.AbstractAsyncHooksContextManager{constructor(){super(),this._asyncLocalStorage=new lA.AsyncLocalStorage}active(){var e;return(e=this._asyncLocalStorage.getStore())!==null&&e!==void 0?e:cA.ROOT_CONTEXT}with(e,t,n,...i){let s=n==null?t:t.bind(n);return this._asyncLocalStorage.run(e,s,...i)}enable(){return this}disable(){return this._asyncLocalStorage.disable(),this}};As.AsyncLocalStorageContextManager=Du});var qr=c(Be=>{"use strict";Object.defineProperty(Be,"__esModule",{value:!0});Be.toAnyValue=Be.toKeyValue=Be.toAttributes=void 0;function mA(r){return Object.keys(r).map(e=>Bu(e,r[e]))}Be.toAttributes=mA;function Bu(r,e){return{key:r,value:qu(e)}}Be.toKeyValue=Bu;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])=>Bu(t,n))}}:{}}Be.toAnyValue=qu});var fp=c(qe=>{"use strict";Object.defineProperty(qe,"__esModule",{value:!0});qe.toOtlpSpanEvent=qe.toOtlpLink=qe.sdkSpanToOtlpSpan=void 0;var Gu=qr();function gA(r,e){var t;let n=r.spanContext(),i=r.status;return{traceId:e.encodeSpanContext(n.traceId),spanId:e.encodeSpanContext(n.spanId),parentSpanId:e.encodeOptionalSpanContext(r.parentSpanId),traceState:(t=n.traceState)===null||t===void 0?void 0:t.serialize(),name:r.name,kind:r.kind==null?0:r.kind+1,startTimeUnixNano:e.encodeHrTime(r.startTime),endTimeUnixNano:e.encodeHrTime(r.endTime),attributes:(0,Gu.toAttributes)(r.attributes),droppedAttributesCount:r.droppedAttributesCount,events:r.events.map(s=>hp(s,e)),droppedEventsCount:r.droppedEventsCount,status:{code:i.code,message:i.message},links:r.links.map(s=>pp(s,e)),droppedLinksCount:r.droppedLinksCount}}qe.sdkSpanToOtlpSpan=gA;function pp(r,e){var t;return{attributes:r.attributes?(0,Gu.toAttributes)(r.attributes):[],spanId:e.encodeSpanContext(r.context.spanId),traceId:e.encodeSpanContext(r.context.traceId),traceState:(t=r.context.traceState)===null||t===void 0?void 0:t.serialize(),droppedAttributesCount:r.droppedAttributesCount||0}}qe.toOtlpLink=pp;function hp(r,e){return{attributes:r.attributes?(0,Gu.toAttributes)(r.attributes):[],name:r.name,timeUnixNano:e.encodeHrTime(r.time),droppedAttributesCount:r.droppedAttributesCount||0}}qe.toOtlpSpanEvent=hp});var Gr=c(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});ae.getOtlpEncoder=ae.encodeAsString=ae.encodeAsLongBits=ae.toLongBits=ae.hrTimeToNanos=void 0;var bs=T(),TA=BigInt(1e9);function Vu(r){return BigInt(r[0])*TA+BigInt(r[1])}ae.hrTimeToNanos=Vu;function mp(r){let e=Number(BigInt.asUintN(32,r)),t=Number(BigInt.asUintN(32,r>>BigInt(32)));return{low:e,high:t}}ae.toLongBits=mp;function ju(r){let e=Vu(r);return mp(e)}ae.encodeAsLongBits=ju;function gp(r){return Vu(r).toString()}ae.encodeAsString=gp;var SA=typeof BigInt<"u"?gp:bs.hrTimeToNanoseconds;function Ep(r){return r}function Tp(r){if(r!==void 0)return(0,bs.hexToBase64)(r)}var AA={encodeHrTime:ju,encodeSpanContext:bs.hexToBase64,encodeOptionalSpanContext:Tp};function OA(r){var e,t;if(r===void 0)return AA;let n=(e=r.useLongBits)!==null&&e!==void 0?e:!0,i=(t=r.useHex)!==null&&t!==void 0?t:!1;return{encodeHrTime:n?ju:SA,encodeSpanContext:i?Ep:bs.hexToBase64,encodeOptionalSpanContext:i?Ep:Tp}}ae.getOtlpEncoder=OA});var ys=c(Ps=>{"use strict";Object.defineProperty(Ps,"__esModule",{value:!0});Ps.createExportTraceServiceRequest=void 0;var RA=qr(),bA=fp(),PA=Gr();function yA(r,e){let t=(0,PA.getOtlpEncoder)(e);return{resourceSpans:IA(r,t)}}Ps.createExportTraceServiceRequest=yA;function vA(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 i=`${t.instrumentationLibrary.name}@${t.instrumentationLibrary.version||""}:${t.instrumentationLibrary.schemaUrl||""}`,s=n.get(i);s||(s=[],n.set(i,s)),s.push(t)}return e}function IA(r,e){let t=vA(r),n=[],i=t.entries(),s=i.next();for(;!s.done;){let[o,a]=s.value,u=[],l=a.values(),_=l.next();for(;!_.done;){let O=_.value;if(O.length>0){let{name:x,version:J,schemaUrl:y}=O[0].instrumentationLibrary,k=O.map(S=>(0,bA.sdkSpanToOtlpSpan)(S,e));u.push({scope:{name:x,version:J},spans:k,schemaUrl:y})}_=l.next()}let E={resource:{attributes:(0,RA.toAttributes)(o.attributes),droppedAttributesCount:0},scopeSpans:u,schemaUrl:void 0};n.push(E),s=i.next()}return n}});var Op=c(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.parseRetryAfterToMills=N.isExportRetryable=N.invalidTimeout=N.configureExporterTimeout=N.appendRootPathToUrlIfNeeded=N.appendResourcePathToUrl=N.parseHeaders=N.DEFAULT_EXPORT_BACKOFF_MULTIPLIER=N.DEFAULT_EXPORT_MAX_BACKOFF=N.DEFAULT_EXPORT_INITIAL_BACKOFF=N.DEFAULT_EXPORT_MAX_ATTEMPTS=void 0;var Fu=(p(),f(d)),Sp=T(),Ap=1e4;N.DEFAULT_EXPORT_MAX_ATTEMPTS=5;N.DEFAULT_EXPORT_INITIAL_BACKOFF=1e3;N.DEFAULT_EXPORT_MAX_BACKOFF=5e3;N.DEFAULT_EXPORT_BACKOFF_MULTIPLIER=1.5;function LA(r={}){let e={};return Object.entries(r).forEach(([t,n])=>{typeof n<"u"?e[t]=String(n):Fu.diag.warn(`Header "${t}" has wrong value and will be ignored`)}),e}N.parseHeaders=LA;function MA(r,e){return r.endsWith("/")||(r=r+"/"),r+e}N.appendResourcePathToUrl=MA;function NA(r){try{let e=new URL(r);return e.pathname===""&&(e.pathname=e.pathname+"/"),e.toString()}catch{return Fu.diag.warn(`Could not parse export URL: '${r}'`),r}}N.appendRootPathToUrlIfNeeded=NA;function CA(r){return typeof r=="number"?r<=0?Hu(r,Ap):r:wA()}N.configureExporterTimeout=CA;function wA(){var r;let e=Number((r=(0,Sp.getEnv)().OTEL_EXPORTER_OTLP_TRACES_TIMEOUT)!==null&&r!==void 0?r:(0,Sp.getEnv)().OTEL_EXPORTER_OTLP_TIMEOUT);return e<=0?Hu(e,Ap):e}function Hu(r,e){return Fu.diag.warn("Timeout must be greater than 0",r),e}N.invalidTimeout=Hu;function xA(r){return[429,502,503,504].includes(r)}N.isExportRetryable=xA;function DA(r){if(r==null)return-1;let e=Number.parseInt(r,10);if(Number.isInteger(e))return e>0?e*1e3:-1;let t=new Date(r).getTime()-Date.now();return t>=0?t:0}N.parseRetryAfterToMills=DA});var bp=c(vs=>{"use strict";Object.defineProperty(vs,"__esModule",{value:!0});vs.OTLPExporterBase=void 0;var Rp=(p(),f(d)),Vr=T(),UA=Op(),ku=class{constructor(e={}){this._sendingPromises=[],this.url=this.getDefaultUrl(e),typeof e.hostname=="string"&&(this.hostname=e.hostname),this.shutdown=this.shutdown.bind(this),this._shutdownOnce=new Vr.BindOnceFuture(this._shutdown,this),this._concurrencyLimit=typeof e.concurrencyLimit=="number"?e.concurrencyLimit:30,this.timeoutMillis=(0,UA.configureExporterTimeout)(e.timeoutMillis),this.onInit(e)}export(e,t){if(this._shutdownOnce.isCalled){t({code:Vr.ExportResultCode.FAILED,error:new Error("Exporter has been shutdown")});return}if(this._sendingPromises.length>=this._concurrencyLimit){t({code:Vr.ExportResultCode.FAILED,error:new Error("Concurrent export limit reached")});return}this._export(e).then(()=>{t({code:Vr.ExportResultCode.SUCCESS})}).catch(n=>{t({code:Vr.ExportResultCode.FAILED,error:n})})}_export(e){return new Promise((t,n)=>{try{Rp.diag.debug("items to be sent",e),this.send(e,t,n)}catch(i){n(i)}})}shutdown(){return this._shutdownOnce.call()}forceFlush(){return Promise.all(this._sendingPromises).then(()=>{})}_shutdown(){return Rp.diag.debug("shutdown started"),this.onShutdown(),this.forceFlush()}};vs.OTLPExporterBase=ku});var Ip=c((Ry,vp)=>{"use strict";vp.exports=GA;function GA(r,e){for(var t=new Array(arguments.length-1),n=0,i=2,s=!0;i<arguments.length;)t[n++]=arguments[i++];return new Promise(function(a,u){t[n]=function(_){if(s)if(s=!1,_)u(_);else{for(var E=new Array(arguments.length-1),O=0;O<E.length;)E[O++]=arguments[O];a.apply(null,E)}};try{r.apply(e||null,t)}catch(l){s&&(s=!1,u(l))}})}});var Cp=c(Np=>{"use strict";var Ls=Np;Ls.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 ir=new Array(64),Mp=new Array(123);for(de=0;de<64;)Mp[ir[de]=de<26?de+65:de<52?de+71:de<62?de-4:de-59|43]=de++;var de;Ls.encode=function(e,t,n){for(var i=null,s=[],o=0,a=0,u;t<n;){var l=e[t++];switch(a){case 0:s[o++]=ir[l>>2],u=(l&3)<<4,a=1;break;case 1:s[o++]=ir[u|l>>4],u=(l&15)<<2,a=2;break;case 2:s[o++]=ir[u|l>>6],s[o++]=ir[l&63],a=0;break}o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=ir[u],s[o++]=61,a===1&&(s[o++]=61)),i?(o&&i.push(String.fromCharCode.apply(String,s.slice(0,o))),i.join("")):String.fromCharCode.apply(String,s.slice(0,o))};var Lp="invalid encoding";Ls.decode=function(e,t,n){for(var i=n,s=0,o,a=0;a<e.length;){var u=e.charCodeAt(a++);if(u===61&&s>1)break;if((u=Mp[u])===void 0)throw Error(Lp);switch(s){case 0:o=u,s=1;break;case 1:t[n++]=o<<2|(u&48)>>4,o=u,s=2;break;case 2:t[n++]=(o&15)<<4|(u&60)>>2,o=u,s=3;break;case 3:t[n++]=(o&3)<<6|u,s=0;break}}if(s===1)throw Error(Lp);return n-i};Ls.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var xp=c((Py,wp)=>{"use strict";wp.exports=Ms;function Ms(){this._listeners={}}Ms.prototype.on=function(e,t,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:n||this}),this};Ms.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],i=0;i<n.length;)n[i].fn===t?n.splice(i,1):++i;return this};Ms.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var n=[],i=1;i<arguments.length;)n.push(arguments[i++]);for(i=0;i<t.length;)t[i].fn.apply(t[i++].ctx,n)}return this}});var jp=c((yy,Vp)=>{"use strict";Vp.exports=Dp(Dp);function Dp(r){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),t=new Uint8Array(e.buffer),n=t[3]===128;function i(u,l,_){e[0]=u,l[_]=t[0],l[_+1]=t[1],l[_+2]=t[2],l[_+3]=t[3]}function s(u,l,_){e[0]=u,l[_]=t[3],l[_+1]=t[2],l[_+2]=t[1],l[_+3]=t[0]}r.writeFloatLE=n?i:s,r.writeFloatBE=n?s:i;function o(u,l){return t[0]=u[l],t[1]=u[l+1],t[2]=u[l+2],t[3]=u[l+3],e[0]}function a(u,l){return t[3]=u[l],t[2]=u[l+1],t[1]=u[l+2],t[0]=u[l+3],e[0]}r.readFloatLE=n?o:a,r.readFloatBE=n?a:o}():function(){function e(n,i,s,o){var a=i<0?1:0;if(a&&(i=-i),i===0)n(1/i>0?0:2147483648,s,o);else if(isNaN(i))n(2143289344,s,o);else if(i>34028234663852886e22)n((a<<31|2139095040)>>>0,s,o);else if(i<11754943508222875e-54)n((a<<31|Math.round(i/1401298464324817e-60))>>>0,s,o);else{var u=Math.floor(Math.log(i)/Math.LN2),l=Math.round(i*Math.pow(2,-u)*8388608)&8388607;n((a<<31|u+127<<23|l)>>>0,s,o)}}r.writeFloatLE=e.bind(null,Up),r.writeFloatBE=e.bind(null,Bp);function t(n,i,s){var o=n(i,s),a=(o>>31)*2+1,u=o>>>23&255,l=o&8388607;return u===255?l?NaN:a*(1/0):u===0?a*1401298464324817e-60*l:a*Math.pow(2,u-150)*(l+8388608)}r.readFloatLE=t.bind(null,qp),r.readFloatBE=t.bind(null,Gp)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),t=new Uint8Array(e.buffer),n=t[7]===128;function i(u,l,_){e[0]=u,l[_]=t[0],l[_+1]=t[1],l[_+2]=t[2],l[_+3]=t[3],l[_+4]=t[4],l[_+5]=t[5],l[_+6]=t[6],l[_+7]=t[7]}function s(u,l,_){e[0]=u,l[_]=t[7],l[_+1]=t[6],l[_+2]=t[5],l[_+3]=t[4],l[_+4]=t[3],l[_+5]=t[2],l[_+6]=t[1],l[_+7]=t[0]}r.writeDoubleLE=n?i:s,r.writeDoubleBE=n?s:i;function o(u,l){return t[0]=u[l],t[1]=u[l+1],t[2]=u[l+2],t[3]=u[l+3],t[4]=u[l+4],t[5]=u[l+5],t[6]=u[l+6],t[7]=u[l+7],e[0]}function a(u,l){return t[7]=u[l],t[6]=u[l+1],t[5]=u[l+2],t[4]=u[l+3],t[3]=u[l+4],t[2]=u[l+5],t[1]=u[l+6],t[0]=u[l+7],e[0]}r.readDoubleLE=n?o:a,r.readDoubleBE=n?a:o}():function(){function e(n,i,s,o,a,u){var l=o<0?1:0;if(l&&(o=-o),o===0)n(0,a,u+i),n(1/o>0?0:2147483648,a,u+s);else if(isNaN(o))n(0,a,u+i),n(2146959360,a,u+s);else if(o>17976931348623157e292)n(0,a,u+i),n((l<<31|2146435072)>>>0,a,u+s);else{var _;if(o<22250738585072014e-324)_=o/5e-324,n(_>>>0,a,u+i),n((l<<31|_/4294967296)>>>0,a,u+s);else{var E=Math.floor(Math.log(o)/Math.LN2);E===1024&&(E=1023),_=o*Math.pow(2,-E),n(_*4503599627370496>>>0,a,u+i),n((l<<31|E+1023<<20|_*1048576&1048575)>>>0,a,u+s)}}}r.writeDoubleLE=e.bind(null,Up,0,4),r.writeDoubleBE=e.bind(null,Bp,4,0);function t(n,i,s,o,a){var u=n(o,a+i),l=n(o,a+s),_=(l>>31)*2+1,E=l>>>20&2047,O=4294967296*(l&1048575)+u;return E===2047?O?NaN:_*(1/0):E===0?_*5e-324*O:_*Math.pow(2,E-1075)*(O+4503599627370496)}r.readDoubleLE=t.bind(null,qp,0,4),r.readDoubleBE=t.bind(null,Gp,4,0)}(),r}function Up(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 Bp(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 qp(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16|r[e+3]<<24)>>>0}function Gp(r,e){return(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}});var Fp=c((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 kp=c(Hp=>{"use strict";var Xu=Hp;Xu.length=function(e){for(var t=0,n=0,i=0;i<e.length;++i)n=e.charCodeAt(i),n<128?t+=1:n<2048?t+=2:(n&64512)===55296&&(e.charCodeAt(i+1)&64512)===56320?(++i,t+=4):t+=3;return t};Xu.read=function(e,t,n){var i=n-t;if(i<1)return"";for(var s=null,o=[],a=0,u;t<n;)u=e[t++],u<128?o[a++]=u:u>191&&u<224?o[a++]=(u&31)<<6|e[t++]&63:u>239&&u<365?(u=((u&7)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63)-65536,o[a++]=55296+(u>>10),o[a++]=56320+(u&1023)):o[a++]=(u&15)<<12|(e[t++]&63)<<6|e[t++]&63,a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),a=0);return s?(a&&s.push(String.fromCharCode.apply(String,o.slice(0,a))),s.join("")):String.fromCharCode.apply(String,o.slice(0,a))};Xu.write=function(e,t,n){for(var i=n,s,o,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&&((o=e.charCodeAt(a+1))&64512)===56320?(s=65536+((s&1023)<<10)+(o&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-i}});var Xp=c((Iy,$p)=>{"use strict";$p.exports=VA;function VA(r,e,t){var n=t||8192,i=n>>>1,s=null,o=n;return function(u){if(u<1||u>i)return r(u);o+u>n&&(s=r(n),o=0);var l=e.call(s,o,o+=u);return o&7&&(o=(o|7)+1),l}}});var Kp=c((Ly,Wp)=>{"use strict";Wp.exports=V;var jr=Ve();function V(r,e){this.lo=r>>>0,this.hi=e>>>0}var dt=V.zero=new V(0,0);dt.toNumber=function(){return 0};dt.zzEncode=dt.zzDecode=function(){return this};dt.length=function(){return 1};var jA=V.zeroHash="\0\0\0\0\0\0\0\0";V.fromNumber=function(e){if(e===0)return dt;var t=e<0;t&&(e=-e);var n=e>>>0,i=(e-n)/4294967296>>>0;return t&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new V(n,i)};V.from=function(e){if(typeof e=="number")return V.fromNumber(e);if(jr.isString(e))if(jr.Long)e=jr.Long.fromString(e);else return V.fromNumber(parseInt(e,10));return e.low||e.high?new V(e.low>>>0,e.high>>>0):dt};V.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};V.prototype.toLong=function(e){return jr.Long?new jr.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var Ge=String.prototype.charCodeAt;V.fromHash=function(e){return e===jA?dt:new V((Ge.call(e,0)|Ge.call(e,1)<<8|Ge.call(e,2)<<16|Ge.call(e,3)<<24)>>>0,(Ge.call(e,4)|Ge.call(e,5)<<8|Ge.call(e,6)<<16|Ge.call(e,7)<<24)>>>0)};V.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)};V.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};V.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};V.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 Ve=c(Wu=>{"use strict";var h=Wu;h.asPromise=Ip();h.base64=Cp();h.EventEmitter=xp();h.float=jp();h.inquire=Fp();h.utf8=kp();h.pool=Xp();h.LongBits=Kp();h.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);h.global=h.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||Wu;h.emptyArray=Object.freeze?Object.freeze([]):[];h.emptyObject=Object.freeze?Object.freeze({}):{};h.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};h.isString=function(e){return typeof e=="string"||e instanceof String};h.isObject=function(e){return e&&typeof e=="object"};h.isset=h.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};h.Buffer=function(){try{var r=h.inquire("buffer").Buffer;return r.prototype.utf8Write?r:null}catch{return null}}();h._Buffer_from=null;h._Buffer_allocUnsafe=null;h.newBuffer=function(e){return typeof e=="number"?h.Buffer?h._Buffer_allocUnsafe(e):new h.Array(e):h.Buffer?h._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};h.Array=typeof Uint8Array<"u"?Uint8Array:Array;h.Long=h.global.dcodeIO&&h.global.dcodeIO.Long||h.global.Long||h.inquire("long");h.key2Re=/^true|false|0|1$/;h.key32Re=/^-?(?:0|[1-9][0-9]*)$/;h.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;h.longToHash=function(e){return e?h.LongBits.from(e).toHash():h.LongBits.zeroHash};h.longFromHash=function(e,t){var n=h.LongBits.fromHash(e);return h.Long?h.Long.fromBits(n.lo,n.hi,t):n.toNumber(!!t)};function zp(r,e,t){for(var n=Object.keys(e),i=0;i<n.length;++i)(r[n[i]]===void 0||!t)&&(r[n[i]]=e[n[i]]);return r}h.merge=zp;h.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)};function Yp(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&&zp(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}h.newError=Yp;h.ProtocolError=Yp("ProtocolError");h.oneOfGetter=function(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=1;return function(){for(var i=Object.keys(this),s=i.length-1;s>-1;--s)if(t[i[s]]===1&&this[i[s]]!==void 0&&this[i[s]]!==null)return i[s]}};h.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}};h.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};h._configure=function(){var r=h.Buffer;if(!r){h._Buffer_from=h._Buffer_allocUnsafe=null;return}h._Buffer_from=r.from!==Uint8Array.from&&r.from||function(t,n){return new r(t,n)},h._Buffer_allocUnsafe=r.allocUnsafe||function(t){return new r(t)}}});var ec=c((Ny,eh)=>{"use strict";eh.exports=A;var ue=Ve(),Ku,Ns=ue.LongBits,Qp=ue.base64,Zp=ue.utf8;function Fr(r,e,t){this.fn=r,this.len=e,this.next=void 0,this.val=t}function Yu(){}function FA(r){this.head=r.head,this.tail=r.tail,this.len=r.len,this.next=r.states}function A(){this.len=0,this.head=new Fr(Yu,0,0),this.tail=this.head,this.states=null}var Jp=function(){return ue.Buffer?function(){return(A.create=function(){return new Ku})()}:function(){return new A}};A.create=Jp();A.alloc=function(e){return new ue.Array(e)};ue.Array!==Array&&(A.alloc=ue.pool(A.alloc,ue.Array.prototype.subarray));A.prototype._push=function(e,t,n){return this.tail=this.tail.next=new Fr(e,t,n),this.len+=t,this};function Qu(r,e,t){e[t]=r&255}function HA(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}function Zu(r,e){this.len=r,this.next=void 0,this.val=e}Zu.prototype=Object.create(Fr.prototype);Zu.prototype.fn=HA;A.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new Zu((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};A.prototype.int32=function(e){return e<0?this._push(Ju,10,Ns.fromNumber(e)):this.uint32(e)};A.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function Ju(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}A.prototype.uint64=function(e){var t=Ns.from(e);return this._push(Ju,t.length(),t)};A.prototype.int64=A.prototype.uint64;A.prototype.sint64=function(e){var t=Ns.from(e).zzEncode();return this._push(Ju,t.length(),t)};A.prototype.bool=function(e){return this._push(Qu,1,e?1:0)};function zu(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}A.prototype.fixed32=function(e){return this._push(zu,4,e>>>0)};A.prototype.sfixed32=A.prototype.fixed32;A.prototype.fixed64=function(e){var t=Ns.from(e);return this._push(zu,4,t.lo)._push(zu,4,t.hi)};A.prototype.sfixed64=A.prototype.fixed64;A.prototype.float=function(e){return this._push(ue.float.writeFloatLE,4,e)};A.prototype.double=function(e){return this._push(ue.float.writeDoubleLE,8,e)};var kA=ue.Array.prototype.set?function(e,t,n){t.set(e,n)}:function(e,t,n){for(var i=0;i<e.length;++i)t[n+i]=e[i]};A.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(Qu,1,0);if(ue.isString(e)){var n=A.alloc(t=Qp.length(e));Qp.decode(e,n,0),e=n}return this.uint32(t)._push(kA,t,e)};A.prototype.string=function(e){var t=Zp.length(e);return t?this.uint32(t)._push(Zp.write,t,e):this._push(Qu,1,0)};A.prototype.fork=function(){return this.states=new FA(this),this.head=this.tail=new Fr(Yu,0,0),this.len=0,this};A.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 Fr(Yu,0,0),this.len=0),this};A.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};A.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};A._configure=function(r){Ku=r,A.create=Jp(),Ku._configure()}});var nh=c((Cy,rh)=>{"use strict";rh.exports=Se;var th=ec();(Se.prototype=Object.create(th.prototype)).constructor=Se;var je=Ve();function Se(){th.call(this)}Se._configure=function(){Se.alloc=je._Buffer_allocUnsafe,Se.writeBytesBuffer=je.Buffer&&je.Buffer.prototype instanceof Uint8Array&&je.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 i=0;i<e.length;)t[n++]=e[i++]}};Se.prototype.bytes=function(e){je.isString(e)&&(e=je._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(Se.writeBytesBuffer,t,e),this};function $A(r,e,t){r.length<40?je.utf8.write(r,e,t):e.utf8Write?e.utf8Write(r,t):e.write(r,t)}Se.prototype.string=function(e){var t=je.Buffer.byteLength(e);return this.uint32(t),t&&this._push($A,t,e),this};Se._configure()});var nc=c((wy,uh)=>{"use strict";uh.exports=w;var _e=Ve(),rc,oh=_e.LongBits,XA=_e.utf8;function pe(r,e){return RangeError("index out of range: "+r.pos+" + "+(e||1)+" > "+r.len)}function w(r){this.buf=r,this.pos=0,this.len=r.length}var ih=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new w(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new w(e);throw Error("illegal buffer")},ah=function(){return _e.Buffer?function(t){return(w.create=function(i){return _e.Buffer.isBuffer(i)?new rc(i):ih(i)})(t)}:ih};w.create=ah();w.prototype._slice=_e.Array.prototype.subarray||_e.Array.prototype.slice;w.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,pe(this,10);return e}}();w.prototype.int32=function(){return this.uint32()|0};w.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function tc(){var r=new oh(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 pe(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 pe(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")}w.prototype.bool=function(){return this.uint32()!==0};function Cs(r,e){return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0}w.prototype.fixed32=function(){if(this.pos+4>this.len)throw pe(this,4);return Cs(this.buf,this.pos+=4)};w.prototype.sfixed32=function(){if(this.pos+4>this.len)throw pe(this,4);return Cs(this.buf,this.pos+=4)|0};function sh(){if(this.pos+8>this.len)throw pe(this,8);return new oh(Cs(this.buf,this.pos+=4),Cs(this.buf,this.pos+=4))}w.prototype.float=function(){if(this.pos+4>this.len)throw pe(this,4);var e=_e.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};w.prototype.double=function(){if(this.pos+8>this.len)throw pe(this,4);var e=_e.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};w.prototype.bytes=function(){var e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw pe(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(t,n);if(t===n){var i=_e.Buffer;return i?i.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,t,n)};w.prototype.string=function(){var e=this.bytes();return XA.read(e,0,e.length)};w.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw pe(this,e);this.pos+=e}else do if(this.pos>=this.len)throw pe(this);while(this.buf[this.pos++]&128);return this};w.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};w._configure=function(r){rc=r,w.create=ah(),rc._configure();var e=_e.Long?"toLong":"toNumber";_e.merge(w.prototype,{int64:function(){return tc.call(this)[e](!1)},uint64:function(){return tc.call(this)[e](!0)},sint64:function(){return tc.call(this).zzDecode()[e](!1)},fixed64:function(){return sh.call(this)[e](!0)},sfixed64:function(){return sh.call(this)[e](!1)}})}});var _h=c((xy,dh)=>{"use strict";dh.exports=_t;var lh=nc();(_t.prototype=Object.create(lh.prototype)).constructor=_t;var ch=Ve();function _t(r){lh.call(this,r)}_t._configure=function(){ch.Buffer&&(_t.prototype._slice=ch.Buffer.prototype.slice)};_t.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))};_t._configure()});var hh=c((Dy,ph)=>{"use strict";ph.exports=Hr;var ic=Ve();(Hr.prototype=Object.create(ic.EventEmitter.prototype)).constructor=Hr;function Hr(r,e,t){if(typeof r!="function")throw TypeError("rpcImpl must be a function");ic.EventEmitter.call(this),this.rpcImpl=r,this.requestDelimited=!!e,this.responseDelimited=!!t}Hr.prototype.rpcCall=function r(e,t,n,i,s){if(!i)throw TypeError("request must be specified");var o=this;if(!s)return ic.asPromise(r,o,e,t,n,i);if(!o.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return o.rpcImpl(e,t[o.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(u,l){if(u)return o.emit("error",u,e),s(u);if(l===null){o.end(!0);return}if(!(l instanceof n))try{l=n[o.responseDelimited?"decodeDelimited":"decode"](l)}catch(_){return o.emit("error",_,e),s(_)}return o.emit("data",l,e),s(null,l)})}catch(a){o.emit("error",a,e),setTimeout(function(){s(a)},0);return}};Hr.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var Eh=c(fh=>{"use strict";var WA=fh;WA.Service=hh()});var gh=c((By,mh)=>{"use strict";mh.exports={}});var Ah=c(Sh=>{"use strict";var Z=Sh;Z.build="minimal";Z.Writer=ec();Z.BufferWriter=nh();Z.Reader=nc();Z.BufferReader=_h();Z.util=Ve();Z.rpc=Eh();Z.roots=gh();Z.configure=Th;function Th(){Z.util._configure(),Z.Writer._configure(Z.BufferWriter),Z.Reader._configure(Z.BufferReader)}Th()});var Rh=c((Gy,Oh)=>{"use strict";Oh.exports=Ah()});var Ch=c(Nh=>{"use strict";Object.defineProperty(Nh,"__esModule",{value:!0})});var xh=c(wh=>{"use strict";Object.defineProperty(wh,"__esModule",{value:!0})});var Uh=c(Dh=>{"use strict";Object.defineProperty(Dh,"__esModule",{value:!0})});var Bh=c($r=>{"use strict";Object.defineProperty($r,"__esModule",{value:!0});$r.ESpanKind=void 0;var lO;(function(r){r[r.SPAN_KIND_UNSPECIFIED=0]="SPAN_KIND_UNSPECIFIED",r[r.SPAN_KIND_INTERNAL=1]="SPAN_KIND_INTERNAL",r[r.SPAN_KIND_SERVER=2]="SPAN_KIND_SERVER",r[r.SPAN_KIND_CLIENT=3]="SPAN_KIND_CLIENT",r[r.SPAN_KIND_PRODUCER=4]="SPAN_KIND_PRODUCER",r[r.SPAN_KIND_CONSUMER=5]="SPAN_KIND_CONSUMER"})(lO=$r.ESpanKind||($r.ESpanKind={}))});var Gh=c(qh=>{"use strict";Object.defineProperty(qh,"__esModule",{value:!0})});var kh=c(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.toMetric=Fe.toScopeMetrics=Fe.toResourceMetrics=void 0;var Vh=(p(),f(d)),ar=wu(),xs=qr(),dO=Gr();function _O(r,e){let t=(0,dO.getOtlpEncoder)(e);return{resource:{attributes:(0,xs.toAttributes)(r.resource.attributes),droppedAttributesCount:0},schemaUrl:void 0,scopeMetrics:Fh(r.scopeMetrics,t)}}Fe.toResourceMetrics=_O;function Fh(r,e){return Array.from(r.map(t=>({scope:{name:t.scope.name,version:t.scope.version},metrics:t.metrics.map(n=>Hh(n,e)),schemaUrl:t.scope.schemaUrl})))}Fe.toScopeMetrics=Fh;function Hh(r,e){let t={name:r.descriptor.name,description:r.descriptor.description,unit:r.descriptor.unit},n=EO(r.aggregationTemporality);switch(r.dataPointType){case ar.DataPointType.SUM:t.sum={aggregationTemporality:n,isMonotonic:r.isMonotonic,dataPoints:jh(r,e)};break;case ar.DataPointType.GAUGE:t.gauge={dataPoints:jh(r,e)};break;case ar.DataPointType.HISTOGRAM:t.histogram={aggregationTemporality:n,dataPoints:hO(r,e)};break;case ar.DataPointType.EXPONENTIAL_HISTOGRAM:t.exponentialHistogram={aggregationTemporality:n,dataPoints:fO(r,e)};break}return t}Fe.toMetric=Hh;function pO(r,e,t){let n={attributes:(0,xs.toAttributes)(r.attributes),startTimeUnixNano:t.encodeHrTime(r.startTime),timeUnixNano:t.encodeHrTime(r.endTime)};switch(e){case Vh.ValueType.INT:n.asInt=r.value;break;case Vh.ValueType.DOUBLE:n.asDouble=r.value;break}return n}function jh(r,e){return r.dataPoints.map(t=>pO(t,r.descriptor.valueType,e))}function hO(r,e){return r.dataPoints.map(t=>{let n=t.value;return{attributes:(0,xs.toAttributes)(t.attributes),bucketCounts:n.buckets.counts,explicitBounds:n.buckets.boundaries,count:n.count,sum:n.sum,min:n.min,max:n.max,startTimeUnixNano:e.encodeHrTime(t.startTime),timeUnixNano:e.encodeHrTime(t.endTime)}})}function fO(r,e){return r.dataPoints.map(t=>{let n=t.value;return{attributes:(0,xs.toAttributes)(t.attributes),count:n.count,min:n.min,max:n.max,sum:n.sum,positive:{offset:n.positive.offset,bucketCounts:n.positive.bucketCounts},negative:{offset:n.negative.offset,bucketCounts:n.negative.bucketCounts},scale:n.scale,zeroCount:n.zeroCount,startTimeUnixNano:e.encodeHrTime(t.startTime),timeUnixNano:e.encodeHrTime(t.endTime)}})}function EO(r){switch(r){case ar.AggregationTemporality.DELTA:return 1;case ar.AggregationTemporality.CUMULATIVE:return 2}}});var $h=c(Ds=>{"use strict";Object.defineProperty(Ds,"__esModule",{value:!0});Ds.createExportMetricsServiceRequest=void 0;var mO=kh();function gO(r,e){return{resourceMetrics:r.map(t=>(0,mO.toResourceMetrics)(t,e))}}Ds.createExportMetricsServiceRequest=gO});var Wh=c(ur=>{"use strict";Object.defineProperty(ur,"__esModule",{value:!0});ur.toLogAttributes=ur.createExportLogsServiceRequest=void 0;var TO=Gr(),cc=qr();function SO(r,e){let t=(0,TO.getOtlpEncoder)(e);return{resourceLogs:OO(r,t)}}ur.createExportLogsServiceRequest=SO;function AO(r){let e=new Map;for(let t of r){let{resource:n,instrumentationScope:{name:i,version:s="",schemaUrl:o=""}}=t,a=e.get(n);a||(a=new Map,e.set(n,a));let u=`${i}@${s}:${o}`,l=a.get(u);l||(l=[],a.set(u,l)),l.push(t)}return e}function OO(r,e){let t=AO(r);return Array.from(t,([n,i])=>({resource:{attributes:(0,cc.toAttributes)(n.attributes),droppedAttributesCount:0},scopeLogs:Array.from(i,([,s])=>{let{instrumentationScope:{name:o,version:a,schemaUrl:u}}=s[0];return{scope:{name:o,version:a},logRecords:s.map(l=>RO(l,e)),schemaUrl:u}}),schemaUrl:void 0}))}function RO(r,e){var t,n,i;return{timeUnixNano:e.encodeHrTime(r.hrTime),observedTimeUnixNano:e.encodeHrTime(r.hrTimeObserved),severityNumber:r.severityNumber,severityText:r.severityText,body:(0,cc.toAnyValue)(r.body),attributes:Xh(r.attributes),droppedAttributesCount:r.droppedAttributesCount,flags:(t=r.spanContext)===null||t===void 0?void 0:t.traceFlags,traceId:e.encodeOptionalSpanContext((n=r.spanContext)===null||n===void 0?void 0:n.traceId),spanId:e.encodeOptionalSpanContext((i=r.spanContext)===null||i===void 0?void 0:i.spanId)}}function Xh(r){return Object.keys(r).map(e=>(0,cc.toKeyValue)(e,r[e]))}ur.toLogAttributes=Xh});var Kh=c(j=>{"use strict";var bO=j&&j.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),cr=j&&j.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&bO(e,r,t)};Object.defineProperty(j,"__esModule",{value:!0});j.createExportLogsServiceRequest=j.createExportMetricsServiceRequest=j.createExportTraceServiceRequest=void 0;cr(Ch(),j);cr(Gr(),j);cr(xh(),j);cr(Uh(),j);cr(Bh(),j);cr(Gh(),j);var PO=ys();Object.defineProperty(j,"createExportTraceServiceRequest",{enumerable:!0,get:function(){return PO.createExportTraceServiceRequest}});var yO=$h();Object.defineProperty(j,"createExportMetricsServiceRequest",{enumerable:!0,get:function(){return yO.createExportMetricsServiceRequest}});var vO=Wh();Object.defineProperty(j,"createExportLogsServiceRequest",{enumerable:!0,get:function(){return vO.createExportLogsServiceRequest}})});var C=q(la(),1);p();fa();var Zh=q(Vd(),1),dr=q(it(),1),Jh=q(r_(),1),ef=q(wu(),1),lc=q(se(),1),Gs=q(Qr(),1),tf=q(cp(),1),He=q(T(),1);p();var _A=Symbol.for("@vercel/request-context");function Te(){return globalThis[_A]?.get()}var Uu=q(se(),1);function Os(r){return Object.fromEntries(Object.entries(r).filter(([e,t])=>t!==void 0))}function lp(r){return r?r.split("::").at(-1):void 0}function dp(r=Te(),e){if(!r)return;let t=e?hA(e,r.headers):void 0;return Os({[Uu.SemanticAttributes.HTTP_HOST]:r.headers.host,[Uu.SemanticAttributes.HTTP_USER_AGENT]:r.headers["user-agent"],"http.referer":r.headers.referer,"vercel.request_id":lp(r.headers["x-vercel-id"]),"vercel.matched_path":r.headers["x-matched-path"],"vercel.edge_region":process.env.VERCEL_REGION,...t})}var pA={keys(r){return[]},get(r,e){return r[e.toLocaleLowerCase()]}};function hA(r,e){if(typeof r=="function")return r(e,pA);let t={};for(let[n,i]of Object.entries(r)){let s=e[i.toLocaleLowerCase()];s!==void 0&&(t[n]=s)}return t}p();function Br(r){return(r&d.TraceFlags.SAMPLED)!==0}var Rs=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=>{d.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:i,traceFlags:s}=e.spanContext(),o=!e.parentSpanId||!this.rootSpanIds.has(n);if(o?this.rootSpanIds.set(n,{rootSpanId:i,open:[]}):this.rootSpanIds.get(n)?.open.push(e),o&&Br(s)){let a=Te(),u=dp(a,this.attributesFromHeaders);u&&e.setAttributes(u),a&&a.waitUntil(async()=>{if(this.rootSpanIds.has(n)){let l=new Promise(E=>{this.waitSpanEnd.set(n,E)}),_;await Promise.race([l,new Promise(E=>{_=setTimeout(()=>{this.waitSpanEnd.delete(n),E(void 0)},50)})]),_&&clearTimeout(_)}return this.forceFlush()})}for(let a of this.processors)a.onStart(e,t)}onEnd(e){let{traceId:t,spanId:n,traceFlags:i}=e.spanContext(),s=Br(i),o=this.rootSpanIds.get(t),a=o?.rootSpanId===n;if(s){let u=EA(e);u&&Object.assign(e.attributes,u)}if(a){if(this.rootSpanIds.delete(t),o.open.length>0){for(let u of o.open)if(!u.ended&&u.spanContext().spanId!==n)try{u.end()}catch(l){d.diag.error("@vercel/otel: onEnd failed:",l)}}}else if(o)for(let u=0;u<o.open.length;u++)o.open[u]?.spanContext().spanId===n&&o.open.splice(u,1);for(let u of this.processors)u.onEnd(e);if(a){let u=this.waitSpanEnd.get(t);u&&(this.waitSpanEnd.delete(t),u())}}},fA={[d.SpanKind.INTERNAL]:"internal",[d.SpanKind.SERVER]:"server",[d.SpanKind.CLIENT]:"client",[d.SpanKind.PRODUCER]:"producer",[d.SpanKind.CONSUMER]:"consumer"};function EA(r){let{kind:e,attributes:t}=r,{"operation.name":n,"resource.name":i,"span.type":s,"next.span_type":o,"http.method":a,"http.route":u}=t;if(n)return;let l=i??(a&&typeof a=="string"&&u&&typeof u=="string"?`${a} ${u}`:u);if(r.kind===d.SpanKind.SERVER&&a&&u&&typeof a=="string"&&typeof u=="string")return{"operation.name":"web.request","resource.name":l};let _=r.instrumentationLibrary.name,E=o??s;if(E&&typeof E=="string"){let O=_p(_,E);return u?{"operation.name":O,"resource.name":l}:{"operation.name":O}}return{"operation.name":_p(_,e===d.SpanKind.INTERNAL?"":fA[e])}}function _p(r,e){if(!r)return e;let t=r.replace(/[ @./]/g,"_");return t.startsWith("_")&&(t=t.slice(1)),e?`${t}.${e}`:t}var yp=q(ys(),1);var Pp=q(bp(),1);p();var rr=class extends Pp.OTLPExporterBase{constructor(e={}){super(e),e.headers&&(this._headers=e.headers)}onShutdown(){d.diag.debug("@vercel/otel/otlp: onShutdown")}onInit(){d.diag.debug("@vercel/otel/otlp: onInit")}send(e,t,n){if(this._shutdownOnce.isCalled){d.diag.debug("@vercel/otel/otlp: Shutdown already started. Cannot send objects");return}let i=this.convert(e),s,o,a;try{({body:s,contentType:o,headers:a}=this.toMessage(i))}catch(l){d.diag.warn("@vercel/otel/otlp: no proto",l);return}let u=fetch(this.url,{method:"POST",body:s,headers:{...this._headers,...a,"Content-Type":o,"User-Agent":"OTel-OTLP-Exporter-JavaScript/0.46.0"},next:{internal:!0}}).then(l=>{d.diag.debug("@vercel/otel/otlp: onSuccess",l.status,l.statusText),t(),l.arrayBuffer().catch(()=>{})}).catch(l=>{d.diag.error("@vercel/otel/otlp: onError",l),n(l)}).finally(()=>{let l=this._sendingPromises.indexOf(u);this._sendingPromises.splice(l,1)});this._sendingPromises.push(u)}getDefaultUrl(e){throw new Error("Method not implemented.")}};var BA="v1/traces",qA=`http://localhost:4318/${BA}`;function Is(r){return typeof r.url=="string"?r.url:qA}var nr=class{constructor(e={}){this.impl=new $u(e)}export(e,t){this.impl.export(e,t)}shutdown(){return this.impl.shutdown()}forceFlush(){return this.impl.forceFlush()}},$u=class extends rr{convert(e){return(0,yp.createExportTraceServiceRequest)(e,{useHex:!0,useLongBits:!1})}toMessage(e){return{body:JSON.stringify(e),contentType:"application/json"}}getDefaultUrl(e){return Is(e)}};var vh=q(ys(),1);var bh=q(Rh(),1);function Ph(r){let e=new bh.Writer;return KA(r,e),e.finish()}function KA(r,e){if(r.resourceSpans!=null&&r.resourceSpans.length)for(let t=0;t<r.resourceSpans.length;++t)zA(r.resourceSpans[t],e.uint32(10).fork()).ldelim();return e}function zA(r,e){if(r.resource!=null&&YA(r.resource,e.uint32(10).fork()).ldelim(),r.scopeSpans!=null&&r.scopeSpans.length)for(let t=0;t<r.scopeSpans.length;++t)QA(r.scopeSpans[t],e.uint32(18).fork()).ldelim();return r.schemaUrl!=null&&e.uint32(26).string(r.schemaUrl),e}function YA(r,e){if(r.attributes!=null&&r.attributes.length)for(let t=0;t<r.attributes.length;++t)sr(r.attributes[t],e.uint32(10).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(16).uint32(r.droppedAttributesCount),e}function QA(r,e){if(r.scope!=null&&eO(r.scope,e.uint32(10).fork()).ldelim(),r.spans!=null&&r.spans.length)for(let t=0;t<r.spans.length;++t)tO(r.spans[t],e.uint32(18).fork()).ldelim();return r.schemaUrl!=null&&e.uint32(26).string(r.schemaUrl),e}function sr(r,e){return r.key!=null&&e.uint32(10).string(r.key),r.value!=null&&yh(r.value,e.uint32(18).fork()).ldelim(),e}function yh(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&&ZA(r.arrayValue,e.uint32(42).fork()).ldelim(),r.kvlistValue!=null&&JA(r.kvlistValue,e.uint32(50).fork()).ldelim(),r.bytesValue!=null&&e.uint32(58).bytes(r.bytesValue),e}function ZA(r,e){if(r.values!=null&&r.values.length)for(let t=0;t<r.values.length;++t)yh(r.values[t],e.uint32(10).fork()).ldelim();return e}function JA(r,e){if(r.values!=null&&r.values.length)for(let t=0;t<r.values.length;++t)sr(r.values[t],e.uint32(10).fork()).ldelim();return e}function eO(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)sr(r.attributes[t],e.uint32(26).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(32).uint32(r.droppedAttributesCount),e}function tO(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)sr(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)nO(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)iO(r.links[t],e.uint32(106).fork()).ldelim();return r.droppedLinksCount!=null&&e.uint32(112).uint32(r.droppedLinksCount),r.status!=null&&rO(r.status,e.uint32(122).fork()).ldelim(),e}function rO(r,e){return r.message!=null&&e.uint32(18).string(r.message),r.code!=null&&e.uint32(24).int32(r.code),e}function nO(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)sr(r.attributes[t],e.uint32(26).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(32).uint32(r.droppedAttributesCount),e}function iO(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)sr(r.attributes[t],e.uint32(34).fork()).ldelim();return r.droppedAttributesCount!=null&&e.uint32(40).uint32(r.droppedAttributesCount),e}var pt=class{constructor(e={}){this.impl=new sc(e)}export(e,t){this.impl.export(e,t)}shutdown(){return this.impl.shutdown()}forceFlush(){return this.impl.forceFlush()}},sc=class extends rr{convert(e){return(0,vh.createExportTraceServiceRequest)(e,void 0)}toMessage(e){return{body:Ph(e),contentType:"application/x-protobuf",headers:{accept:"application/x-protobuf"}}}getDefaultUrl(e){return Is(e)}};p();var Pe=q(se(),1);function Ih(r,e){return r.replace(/\{(?<temp1>[^{}]+)\}/g,(t,n)=>{let i=e[n];return i!==void 0?String(i):t})}var or=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(){}enable(){this.disable();let{tracerProvider:e}=this;if(!e)return;let t=e.getTracer(this.instrumentationName,this.instrumentationVersion),n=this.config.ignoreUrls??[],i=(y,k)=>{if(k?.opentelemetry?.ignore!==void 0)return k.opentelemetry.ignore;if(n.length===0)return!1;let S=y.toString();return n.some(b=>typeof b=="string"?b==="*"?!0:S.startsWith(b):b.test(S))},s=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,a=this.config.propagateContextUrls??[],u=this.config.dontPropagateContextUrls??[],l=this.config.resourceNameTemplate,{attributesFromRequestHeaders:_,attributesFromResponseHeaders:E}=this.config,O=(y,k)=>{if(k?.opentelemetry?.propagateContext)return k.opentelemetry.propagateContext;let S=y.toString();return u.length>0&&u.some(b=>typeof b=="string"?b==="*"?!0:S.startsWith(b):b.test(S))?!1:s&&y.protocol==="https:"&&(y.host===s||y.host===o||y.host===Te()?.headers.host)||!s&&y.protocol==="http:"&&y.hostname==="localhost"?!0:a.some(b=>typeof b=="string"?b==="*"?!0:S.startsWith(b):b.test(S))};process.env.NEXT_OTEL_FETCH_DISABLED="1";let x=globalThis.fetch;this.originalFetch=x;let J=async(y,k)=>{let S=k;if(S?.next?.internal)return x(y,S);let b=new Request(y instanceof Request?y.clone():y,S),ye=new URL(b.url);if(i(ye,S))return x(y,S);let Vs={[Pe.SemanticAttributes.HTTP_METHOD]:b.method,[Pe.SemanticAttributes.HTTP_URL]:b.url,[Pe.SemanticAttributes.HTTP_HOST]:ye.host,[Pe.SemanticAttributes.HTTP_SCHEME]:ye.protocol.replace(":",""),[Pe.SemanticAttributes.NET_PEER_NAME]:ye.hostname,[Pe.SemanticAttributes.NET_PEER_PORT]:ye.port},ht=l?Ih(l,Vs):oO(b.url),nf=S?.opentelemetry?.spanName??`fetch ${b.method} ${b.url}`,dc=d.context.active(),B=t.startSpan(nf,{kind:d.SpanKind.CLIENT,attributes:{...Vs,"operation.name":`fetch.${b.method}`,"resource.name":ht,...S?.opentelemetry?.attributes}},dc);if(!B.isRecording()||!Br(B.spanContext().traceFlags))return B.end(),x(y,S);if(O(ye,S)){let ft=d.trace.setSpan(dc,B);d.propagation.inject(ft,b.headers,sO)}_&&Lh(B,_,b.headers);try{let ft=Date.now();S?.body&&S.body instanceof FormData&&b.headers.delete("content-type");let ve=await x(y,{...S,headers:b.headers}),sf=Date.now()-ft;return B.setAttribute(Pe.SemanticAttributes.HTTP_STATUS_CODE,ve.status),B.setAttribute("http.response_time",sf),E&&Lh(B,E,ve.headers),ve.status>=500&&oc(B,`Status: ${ve.status} (${ve.statusText})`),ve.body?aO(ve).then(js=>{B.isRecording()&&(B.setAttribute(Pe.SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED,js),B.end())},js=>{B.isRecording()&&(oc(B,js),B.end())}):B.end(),ve}catch(ft){throw oc(B,ft),B.end(),ft}};globalThis.fetch=J}disable(){this.originalFetch&&(globalThis.fetch=this.originalFetch)}},sO={set(r,e,t){r.set(e,t)}};function oO(r){let e=r.indexOf("?");return e===-1?r:r.substring(0,e)}function aO(r){let e=0,n=r.clone().body?.getReader();if(!n)return Promise.resolve(0);let i=()=>n.read().then(({done:s,value:o})=>{if(!s)return e+=o.byteLength,i()});return i().then(()=>e)}function oc(r,e){if(e instanceof Error)r.recordException(e),r.setStatus({code:d.SpanStatusCode.ERROR,message:e.message});else{let t=String(e);r.setStatus({code:d.SpanStatusCode.ERROR,message:t})}}function Lh(r,e,t){for(let[n,i]of Object.entries(e)){let s=t.get(i);s!==null&&r.setAttribute(n,s)}}p();var Mh=q(T(),1),uO="00",ac="traceparent",uc="tracestate",kr=class{fields(){return[ac,uc]}inject(e,t,n){let i=d.trace.getSpanContext(e);if(!i||(0,Mh.isTracingSuppressed)(e)||!(0,d.isSpanContextValid)(i))return;let s=`${uO}-${i.traceId}-${i.spanId}-0${Number(i.traceFlags||0).toString(16)}`;n.set(t,ac,s),i.traceState&&n.set(t,uc,i.traceState.serialize())}extract(e,t,n){let i=n.get(t,ac);if(!i)return e;let s=Array.isArray(i)?i[0]:i;if(typeof s!="string")return e;let o=cO(s);if(!o)return e;o.isRemote=!0;let a=n.get(t,uc);if(a){let u=Array.isArray(a)?a.join(","):a;o.traceState=(0,d.createTraceState)(typeof u=="string"?u:void 0)}return d.trace.setSpanContext(e,o)}};function cO(r){let[e,t,n,i,s]=r.split("-");return!e||!t||!n||!i||e.length!==2||t.length!==32||n.length!==16||i.length!==2||e==="00"&&s?null:{traceId:t,spanId:n,traceFlags:parseInt(i,16)}}p();var ws=class{fields(){return[]}inject(){}extract(e){let t=Te();if(!t?.telemetry)return d.diag.warn("@vercel/otel: Vercel telemetry extension not found."),e;let{rootSpanContext:n}=t.telemetry;return n?(d.diag.debug("@vercel/otel: Extracted root SpanContext from Vercel request context.",n),d.trace.setSpanContext(e,{...n,isRemote:!0,traceFlags:n.traceFlags||d.TraceFlags.SAMPLED})):e}};p();var Us=q(T(),1),zh=q(Kh(),1);var Bs=class{export(e,t){let n=Te();if(!n?.telemetry){d.diag.warn("@vercel/otel: no telemetry context found"),t({code:Us.ExportResultCode.SUCCESS,error:void 0});return}try{let i=(0,zh.createExportTraceServiceRequest)(e,{useHex:!0,useLongBits:!1});n.telemetry.reportSpans(i),t({code:Us.ExportResultCode.SUCCESS,error:void 0})}catch(i){t({code:Us.ExportResultCode.FAILED,error:i instanceof Error?i:new Error(String(i))})}}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}};var IO={ALL:d.DiagLogLevel.ALL,VERBOSE:d.DiagLogLevel.VERBOSE,DEBUG:d.DiagLogLevel.DEBUG,INFO:d.DiagLogLevel.INFO,WARN:d.DiagLogLevel.WARN,ERROR:d.DiagLogLevel.ERROR,NONE:d.DiagLogLevel.NONE},qs=class{constructor(e={}){this.configuration=e}start(){let e=LO(),t=this.configuration,n=process.env.NEXT_RUNTIME||"nodejs",i=!!e.OTEL_SDK_DISABLED;if(process.env.OTEL_LOG_LEVEL&&d.diag.setLogger(new d.DiagConsoleLogger,{logLevel:IO[process.env.OTEL_LOG_LEVEL.toUpperCase()]}),i)return;let s=t.idGenerator??new C.RandomIdGenerator,o=t.contextManager??new tf.AsyncLocalStorageContextManager;o.enable(),this.contextManager=o;let a=e.OTEL_SERVICE_NAME||t.serviceName||"app",u=new dr.Resource(Os({[lc.SemanticResourceAttributes.SERVICE_NAME]:a,"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,[lc.SemanticResourceAttributes.SERVICE_VERSION]:process.env.VERCEL_DEPLOYMENT_ID,...t.attributes})),l=t.resourceDetectors??[dr.envDetectorSync];if(t.autoDetectResources??!0){let S={detectors:l};u=u.merge((0,dr.detectResourcesSync)(S))}let E=NO(t.propagators,t,e),O=CO(t.traceSampler,e),x=wO(t.spanProcessors,t,e);x.length===0&&d.diag.warn("@vercel/otel: No span processors configured. No spans will be exported.");let J=t.spanLimits,y=new C.BasicTracerProvider({resource:u,idGenerator:s,sampler:O,spanLimits:J});if(y.addSpanProcessor(new Rs(x,t.attributesFromHeaders)),y.register({contextManager:o,propagator:new He.CompositePropagator({propagators:E})}),this.tracerProvider=y,t.logRecordProcessor){let S=new Jh.LoggerProvider({resource:u});this.loggerProvider=S,S.addLogRecordProcessor(t.logRecordProcessor),at.logs.setGlobalLoggerProvider(S)}if(t.metricReader||t.views){let S=new ef.MeterProvider({resource:u,views:t.views??[]});t.metricReader&&S.addMetricReader(t.metricReader),d.metrics.setGlobalMeterProvider(S),this.meterProvider=S}let k=MO(t.instrumentations,t.instrumentationConfig);this.disableInstrumentations=(0,Zh.registerInstrumentations)({instrumentations:k}),d.diag.info("@vercel/otel: started",a,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()),d.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 LO(){let r=(0,Gs.parseEnvironment)(process.env);return{...Gs.DEFAULT_ENVIRONMENT,...r}}function MO(r,e){return(r??["auto"]).map(t=>t==="auto"?(d.diag.debug("@vercel/otel: Configure instrumentations: fetch",e?.fetch),[new or(e?.fetch)]):t==="fetch"?(d.diag.debug("@vercel/otel: Configure instrumentations: fetch",e?.fetch),new or(e?.fetch)):t).flat()}function NO(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(i=>{if(i==="none")return[];if(i==="auto"){let s=[];return s.push({name:"tracecontext",propagator:new kr}),s.push({name:"baggage",propagator:new He.W3CBaggagePropagator}),s.push({name:"vercel-runtime",propagator:new ws}),d.diag.debug(`@vercel/otel: Configure propagators: ${s.map(o=>o.name).join(", ")}`),s.map(o=>o.propagator)}if(i==="tracecontext")return d.diag.debug("@vercel/otel: Configure propagator: tracecontext"),new kr;if(i==="baggage")return d.diag.debug("@vercel/otel: Configure propagator: baggage"),new He.W3CBaggagePropagator;if(typeof i=="string")throw new Error(`Unknown propagator: "${i}"`);return i}).flat()}var Yh="always_on",lr=1;function CO(r,e){if(r&&typeof r!="string")return r;let t=r&&r!=="auto"?r:e.OTEL_TRACES_SAMPLER||Yh;switch(d.diag.debug("@vercel/otel: Configure sampler: ",t),t){case"always_on":return new C.AlwaysOnSampler;case"always_off":return new C.AlwaysOffSampler;case"parentbased_always_on":return new C.ParentBasedSampler({root:new C.AlwaysOnSampler});case"parentbased_always_off":return new C.ParentBasedSampler({root:new C.AlwaysOffSampler});case"traceidratio":return new C.TraceIdRatioBasedSampler(Qh(e));case"parentbased_traceidratio":return new C.ParentBasedSampler({root:new C.TraceIdRatioBasedSampler(Qh(e))});default:return d.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER value "${String(e.OTEL_TRACES_SAMPLER)} invalid, defaulting to ${Yh}".`),new C.AlwaysOnSampler}}function Qh(r){if(r.OTEL_TRACES_SAMPLER_ARG===void 0||r.OTEL_TRACES_SAMPLER_ARG==="")return d.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${lr}.`),lr;d.diag.debug("@vercel/otel: Configure sampler probability: ",r.OTEL_TRACES_SAMPLER_ARG);let e=Number(r.OTEL_TRACES_SAMPLER_ARG);return isNaN(e)?(d.diag.error(`@vercel/otel: OTEL_TRACES_SAMPLER_ARG=${r.OTEL_TRACES_SAMPLER_ARG} was given, but it is invalid, defaulting to ${lr}.`),lr):e<0||e>1?(d.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 ${lr}.`),lr):e}function wO(r,e,t){return[...(r??["auto"]).flatMap(n=>{if(n==="auto"){let i=[new C.BatchSpanProcessor(new Bs)];if(process.env.VERCEL_OTEL_ENDPOINTS){let s=process.env.VERCEL_OTEL_ENDPOINTS_PORT||"4318",o=process.env.VERCEL_OTEL_ENDPOINTS_PROTOCOL||"http/protobuf";d.diag.debug("@vercel/otel: Configure vercel otel collector on port: ",s,o);let a={url:`http://localhost:${s}/v1/traces`,headers:{}},u=o==="http/protobuf"?new pt(a):new nr(a);i.push(new C.BatchSpanProcessor(u))}else if(!e.traceExporter||e.traceExporter==="auto"||t.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT||t.OTEL_EXPORTER_OTLP_ENDPOINT)return new C.BatchSpanProcessor(xO(t));return i}return n}).filter(BO),...e.traceExporter&&e.traceExporter!=="auto"?[new C.BatchSpanProcessor(e.traceExporter)]:[]]}function xO(r){let e=process.env.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL??process.env.OTEL_EXPORTER_OTLP_PROTOCOL??"http/protobuf",t=UO(r),n={...He.baggageUtils.parseKeyPairsIntoRecord(r.OTEL_EXPORTER_OTLP_HEADERS),...He.baggageUtils.parseKeyPairsIntoRecord(r.OTEL_EXPORTER_OTLP_TRACES_HEADERS)};switch(d.diag.debug("@vercel/otel: Configure trace exporter: ",e,t,`headers: ${Object.keys(n).join(",")||"<none>"}`),e){case"http/json":return new nr({url:t,headers:n});case"http/protobuf":return new pt({url:t,headers:n});default:return d.diag.warn(`@vercel/otel: Unsupported OTLP traces protocol: ${e}. Using http/protobuf.`),new pt}}var rf="v1/traces",DO=`http://localhost:4318/${rf}`;function UO(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}/${rf}`:DO}function BO(r){return r!=null}function yv(r){let e;r?typeof r=="string"?e={serviceName:r}:e=r:e={},new qs(e).start()}export{or as FetchInstrumentation,nr as OTLPHttpJsonTraceExporter,pt as OTLPHttpProtoTraceExporter,yv as registerOTel};
21
21
  //# sourceMappingURL=index.js.map