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