@sentio/runtime 3.0.0 → 3.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/lib/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import { createRequire as createRequireShim } from 'module'; const require = createRequireShim(import.meta.url);
2
- import{B as E,C as R,D as k,E as G,F as S,a as T,b as m,c as h,d as l,e as f,f as x,g as d,i as N,j as C,p,r as V,s as w,t as O,u as A,v as I,w as M,x as b,y}from"./chunk-KF7FHZ25.js";import{p as u,q as c}from"./chunk-ZTRGPIW7.js";import"./chunk-TW627LH5.js";import"./chunk-AUPVVLD3.js";var r=class e{stateMap=new Map;static INSTANCE=new e;static reset(){e.INSTANCE=new e}},i=class{constructor(){}key(){return this.constructor.name}getOrRegister(){let t=r.INSTANCE.stateMap.get(this.key());return t||(t=this.initValue(),r.INSTANCE.stateMap.set(this.key(),t)),t}unregister(){let t=r.INSTANCE.stateMap.get(this.key());return r.INSTANCE.stateMap.delete(this.key()),t}},a=class extends i{initValue(){return new Map}getValue(t){return this.getOrRegister().get(t)}getValues(){let t=this.getOrRegister();return Array.from(t.values())}getOrSetValue(t,s){let o=this.getOrRegister(),n=o.get(t);return n?(n!==s&&console.warn(t,"has been registered twice, use the previous one"),n):(o.set(t,s),s)}},g=class extends i{initValue(){return[]}getValues(){return this.getOrRegister()}addValue(t){return this.getOrRegister().push(t),t}};import("node:process").then(e=>e.stdout.write(""));import("node:process").then(e=>e.stdout.write(""));import("node:process").then(e=>e.stdout.write(""));export{M as AbstractStoreContext,y as DataBindingContext,E as DummyProvider,N as Endpoints,p as GLOBAL_CONFIG,g as ListStateStorage,a as MapStateStorage,u as Plugin,c as PluginManager,G as ProcessorServiceImpl,k as QueuedStaticJsonRpcProvider,r as State,i as StateStorage,b as StoreContext,l as USER_PROCESSOR,d as compareSemver,C as configureEndpoints,V as dbMetrics,h as errorString,R as getProvider,f as makeEthCallKey,T as mergeProcessResults,m as mergeProcessResultsInPlace,A as metricsStorage,x as parseSemver,O as processMetrics,w as providerMetrics,S as recordRuntimeInfo,I as timeoutError};
2
+ import{B as E,C as R,D as k,E as G,F as S,a as T,b as m,c as h,d as l,e as f,f as x,g as d,i as N,j as C,p,r as V,s as w,t as O,u as A,v as I,w as M,x as b,y}from"./chunk-UJTKZHZU.js";import{p as u,q as c}from"./chunk-ZTRGPIW7.js";import"./chunk-TW627LH5.js";import"./chunk-AUPVVLD3.js";var r=class e{stateMap=new Map;static INSTANCE=new e;static reset(){e.INSTANCE=new e}},i=class{constructor(){}key(){return this.constructor.name}getOrRegister(){let t=r.INSTANCE.stateMap.get(this.key());return t||(t=this.initValue(),r.INSTANCE.stateMap.set(this.key(),t)),t}unregister(){let t=r.INSTANCE.stateMap.get(this.key());return r.INSTANCE.stateMap.delete(this.key()),t}},a=class extends i{initValue(){return new Map}getValue(t){return this.getOrRegister().get(t)}getValues(){let t=this.getOrRegister();return Array.from(t.values())}getOrSetValue(t,s){let o=this.getOrRegister(),n=o.get(t);return n?(n!==s&&console.warn(t,"has been registered twice, use the previous one"),n):(o.set(t,s),s)}},g=class extends i{initValue(){return[]}getValues(){return this.getOrRegister()}addValue(t){return this.getOrRegister().push(t),t}};import("node:process").then(e=>e.stdout.write(""));import("node:process").then(e=>e.stdout.write(""));import("node:process").then(e=>e.stdout.write(""));export{M as AbstractStoreContext,y as DataBindingContext,E as DummyProvider,N as Endpoints,p as GLOBAL_CONFIG,g as ListStateStorage,a as MapStateStorage,u as Plugin,c as PluginManager,G as ProcessorServiceImpl,k as QueuedStaticJsonRpcProvider,r as State,i as StateStorage,b as StoreContext,l as USER_PROCESSOR,d as compareSemver,C as configureEndpoints,V as dbMetrics,h as errorString,R as getProvider,f as makeEthCallKey,T as mergeProcessResults,m as mergeProcessResultsInPlace,A as metricsStorage,x as parseSemver,O as processMetrics,w as providerMetrics,S as recordRuntimeInfo,I as timeoutError};
3
3
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as createRequireShim } from 'module'; const require = createRequireShim(import.meta.url);
3
- import{a as is}from"./chunk-757YRULG.js";import{A as Bn,E as Le,F as os,c as Vn,f as ct,g as Tt,h as Ki,j as qi,k as Ce,l as $i,m as Dl,n as ji,o as Wi,p as Ji,q as zi,t as rs,y as ns,z as wl}from"./chunk-KF7FHZ25.js";import{i as Ll,j as ki,k as Me,m as Gi,n as Bi,o as Hi,q as z,r as Fi,u as Yi}from"./chunk-ZTRGPIW7.js";import{a as H,b as Xi,c as Ie,d as Qi,e as Zi,f as q,g as ts,h as es,i as Jt,j as S,k as kn,l as Ue,m as Gn,n as X,o as O}from"./chunk-TW627LH5.js";import{a as K,b as _,c as x,d as St,e as L,f as v}from"./chunk-AUPVVLD3.js";var R,Be=_(()=>{"use strict";(function(a){a[a.DELTA=0]="DELTA",a[a.CUMULATIVE=1]="CUMULATIVE"})(R||(R={}))});var h,P,et=_(()=>{"use strict";(function(a){a.COUNTER="COUNTER",a.GAUGE="GAUGE",a.HISTOGRAM="HISTOGRAM",a.UP_DOWN_COUNTER="UP_DOWN_COUNTER",a.OBSERVABLE_COUNTER="OBSERVABLE_COUNTER",a.OBSERVABLE_GAUGE="OBSERVABLE_GAUGE",a.OBSERVABLE_UP_DOWN_COUNTER="OBSERVABLE_UP_DOWN_COUNTER"})(h||(h={}));(function(a){a[a.HISTOGRAM=0]="HISTOGRAM",a[a.EXPONENTIAL_HISTOGRAM=1]="EXPONENTIAL_HISTOGRAM",a[a.GAUGE=2]="GAUGE",a[a.SUM=3]="SUM"})(P||(P={}))});function ls(a){return a!=null}function He(a){let r=Object.keys(a);return r.length===0?"":(r=r.sort(),JSON.stringify(r.map(o=>[o,a[o]])))}function ps(a){return`${a.name}:${a.version??""}:${a.schemaUrl??""}`}function rt(a,r){let o,c=new Promise(function(s,e){o=setTimeout(function(){e(new ut("Operation timed out."))},r)});return Promise.race([a,c]).then(i=>(clearTimeout(o),i),i=>{throw clearTimeout(o),i})}async function fs(a){return Promise.all(a.map(async r=>{try{return{status:"fulfilled",value:await r}}catch(o){return{status:"rejected",reason:o}}}))}function ds(a){return a.status==="rejected"}function Yn(a,r){let o=[];return a.forEach(c=>{o.push(...r(c))}),o}function ms(a,r){if(a.size!==r.size)return!1;for(let o of a)if(!r.has(o))return!1;return!0}function _s(a,r){let o=0,c=a.length-1,i=a.length;for(;c>=o;){let s=o+Math.trunc((c-o)/2);a[s]<r?o=s+1:(i=s,c=s-1)}return i}function Es(a,r){return a.toLowerCase()===r.toLowerCase()}var ut,F=_(()=>{"use strict";ut=class a extends Error{constructor(r){super(r),Object.setPrototypeOf(this,a.prototype)}}});var D,ht=_(()=>{"use strict";(function(a){a[a.DROP=0]="DROP",a[a.SUM=1]="SUM",a[a.LAST_VALUE=2]="LAST_VALUE",a[a.HISTOGRAM=3]="HISTOGRAM",a[a.EXPONENTIAL_HISTOGRAM=4]="EXPONENTIAL_HISTOGRAM"})(D||(D={}))});var Xt,Ss=_(()=>{"use strict";ht();Xt=class{kind=D.DROP;createAccumulation(){}merge(r,o){}diff(r,o){}toMetricData(r,o,c,i){}}});function Hl(a){let r=a.map(()=>0);return r.push(0),{buckets:{boundaries:a,counts:r},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}var yt,At,Ts=_(()=>{"use strict";ht();et();F();yt=class{startTime;_boundaries;_recordMinMax;_current;constructor(r,o,c=!0,i=Hl(o)){this.startTime=r,this._boundaries=o,this._recordMinMax=c,this._current=i}record(r){if(Number.isNaN(r))return;this._current.count+=1,this._current.sum+=r,this._recordMinMax&&(this._current.min=Math.min(r,this._current.min),this._current.max=Math.max(r,this._current.max),this._current.hasMinMax=!0);let o=_s(this._boundaries,r);this._current.buckets.counts[o]+=1}setStartTime(r){this.startTime=r}toPointValue(){return this._current}},At=class{_boundaries;_recordMinMax;kind=D.HISTOGRAM;constructor(r,o){this._boundaries=r,this._recordMinMax=o}createAccumulation(r){return new yt(r,this._boundaries,this._recordMinMax)}merge(r,o){let c=r.toPointValue(),i=o.toPointValue(),s=c.buckets.counts,e=i.buckets.counts,t=new Array(s.length);for(let l=0;l<s.length;l++)t[l]=s[l]+e[l];let n=1/0,u=-1/0;return this._recordMinMax&&(c.hasMinMax&&i.hasMinMax?(n=Math.min(c.min,i.min),u=Math.max(c.max,i.max)):c.hasMinMax?(n=c.min,u=c.max):i.hasMinMax&&(n=i.min,u=i.max)),new yt(r.startTime,c.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:c.buckets.boundaries,counts:t},count:c.count+i.count,sum:c.sum+i.sum,hasMinMax:this._recordMinMax&&(c.hasMinMax||i.hasMinMax),min:n,max:u})}diff(r,o){let c=r.toPointValue(),i=o.toPointValue(),s=c.buckets.counts,e=i.buckets.counts,t=new Array(s.length);for(let n=0;n<s.length;n++)t[n]=e[n]-s[n];return new yt(o.startTime,c.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:c.buckets.boundaries,counts:t},count:i.count-c.count,sum:i.sum-c.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(r,o,c,i){return{descriptor:r,aggregationTemporality:o,dataPointType:P.HISTOGRAM,dataPoints:c.map(([s,e])=>{let t=e.toPointValue(),n=r.type===h.GAUGE||r.type===h.UP_DOWN_COUNTER||r.type===h.OBSERVABLE_GAUGE||r.type===h.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:s,startTime:e.startTime,endTime:i,value:{min:t.hasMinMax?t.min:void 0,max:t.hasMinMax?t.max:void 0,sum:n?void 0:t.sum,buckets:t.buckets,count:t.count}}})}}}});var Qt,Kn,hs=_(()=>{"use strict";Qt=class a{backing;indexBase;indexStart;indexEnd;constructor(r=new Kn,o=0,c=0,i=0){this.backing=r,this.indexBase=o,this.indexStart=c,this.indexEnd=i}get offset(){return this.indexStart}get length(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(r,o)=>this.at(o))}at(r){let o=this.indexBase-this.indexStart;return r<o&&(r+=this.backing.length),r-=o,this.backing.countAt(r)}incrementBucket(r,o){this.backing.increment(r,o)}decrementBucket(r,o){this.backing.decrement(r,o)}trim(){for(let r=0;r<this.length;r++)if(this.at(r)!==0){this.indexStart+=r;break}else if(r===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(let r=this.length-1;r>=0;r--)if(this.at(r)!==0){this.indexEnd-=this.length-r-1;break}this._rotate()}downscale(r){this._rotate();let o=1+this.indexEnd-this.indexStart,c=1<<r,i=0,s=0;for(let e=this.indexStart;e<=this.indexEnd;){let t=e%c;t<0&&(t+=c);for(let n=t;n<c&&i<o;n++)this._relocateBucket(s,i),i++,e++;s++}this.indexStart>>=r,this.indexEnd>>=r,this.indexBase=this.indexStart}clone(){return new a(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){let r=this.indexBase-this.indexStart;r!==0&&(r>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,r),this.backing.reverse(r,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+r)),this.indexBase=this.indexStart)}_relocateBucket(r,o){r!==o&&this.incrementBucket(r,this.backing.emptyBucket(o))}},Kn=class a{_counts;constructor(r=[0]){this._counts=r}get length(){return this._counts.length}countAt(r){return this._counts[r]}growTo(r,o,c){let i=new Array(r).fill(0);i.splice(c,this._counts.length-o,...this._counts.slice(o)),i.splice(0,o,...this._counts.slice(0,o)),this._counts=i}reverse(r,o){let c=Math.floor((r+o)/2)-r;for(let i=0;i<c;i++){let s=this._counts[r+i];this._counts[r+i]=this._counts[o-i-1],this._counts[o-i-1]=s}}emptyBucket(r){let o=this._counts[r];return this._counts[r]=0,o}increment(r,o){this._counts[r]+=o}decrement(r,o){this._counts[r]>=o?this._counts[r]-=o:this._counts[r]=0}clone(){return new a([...this._counts])}}});function Fe(a){let r=new DataView(new ArrayBuffer(8));return r.setFloat64(0,a),((r.getUint32(0)&2146435072)>>20)-1023}function Ye(a){let r=new DataView(new ArrayBuffer(8));r.setFloat64(0,a);let o=r.getUint32(0),c=r.getUint32(4);return(o&1048575)*Math.pow(2,32)+c}var Zt,qn=_(()=>{"use strict";Zt=Math.pow(2,-1022)});function te(a,r){return a===0||a===Number.POSITIVE_INFINITY||a===Number.NEGATIVE_INFINITY||Number.isNaN(a)?a:a*Math.pow(2,r)}function As(a){return a--,a|=a>>1,a|=a>>2,a|=a>>4,a|=a>>8,a|=a>>16,a++,a}var Ke=_(()=>{"use strict"});var j,qe=_(()=>{"use strict";j=class extends Error{}});var $e,Ns=_(()=>{"use strict";qn();Ke();qe();$e=class{_shift;constructor(r){this._shift=-r}mapToIndex(r){if(r<Zt)return this._minNormalLowerBoundaryIndex();let o=Fe(r),c=this._rightShift(Ye(r)-1,52);return o+c>>this._shift}lowerBoundary(r){let o=this._minNormalLowerBoundaryIndex();if(r<o)throw new j(`underflow: ${r} is < minimum lower boundary: ${o}`);let c=this._maxNormalLowerBoundaryIndex();if(r>c)throw new j(`overflow: ${r} is > maximum lower boundary: ${c}`);return te(1,r<<this._shift)}get scale(){return this._shift===0?0:-this._shift}_minNormalLowerBoundaryIndex(){let r=-1022>>this._shift;return this._shift<2&&r--,r}_maxNormalLowerBoundaryIndex(){return 1023>>this._shift}_rightShift(r,o){return Math.floor(r*Math.pow(2,-o))}}});var je,xs=_(()=>{"use strict";qn();Ke();qe();je=class{_scale;_scaleFactor;_inverseFactor;constructor(r){this._scale=r,this._scaleFactor=te(Math.LOG2E,r),this._inverseFactor=te(Math.LN2,-r)}mapToIndex(r){if(r<=Zt)return this._minNormalLowerBoundaryIndex()-1;if(Ye(r)===0)return(Fe(r)<<this._scale)-1;let o=Math.floor(Math.log(r)*this._scaleFactor),c=this._maxNormalLowerBoundaryIndex();return o>=c?c:o}lowerBoundary(r){let o=this._maxNormalLowerBoundaryIndex();if(r>=o){if(r===o)return 2*Math.exp((r-(1<<this._scale))/this._scaleFactor);throw new j(`overflow: ${r} is > maximum lower boundary: ${o}`)}let c=this._minNormalLowerBoundaryIndex();if(r<=c){if(r===c)return Zt;if(r===c-1)return Math.exp((r+(1<<this._scale))/this._scaleFactor)/2;throw new j(`overflow: ${r} is < minimum lower boundary: ${c}`)}return Math.exp(r*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return-1022<<this._scale}_maxNormalLowerBoundaryIndex(){return(1024<<this._scale)-1}}});function Wn(a){if(a>Rs||a<gs)throw new j(`expected scale >= ${gs} && <= ${Rs}, got: ${a}`);return Yl[a+10]}var gs,Rs,Yl,Ps=_(()=>{"use strict";Ns();xs();qe();gs=-10,Rs=20,Yl=Array.from({length:31},(a,r)=>r>10?new je(r-10):new $e(r-10))});var Ot,Kl,ql,Jn,We,ee,bs=_(()=>{"use strict";ht();et();O();hs();Ps();Ke();Ot=class a{low;high;static combine(r,o){return new a(Math.min(r.low,o.low),Math.max(r.high,o.high))}constructor(r,o){this.low=r,this.high=o}},Kl=20,ql=160,Jn=2,We=class a{startTime;_maxSize;_recordMinMax;_sum;_count;_zeroCount;_min;_max;_positive;_negative;_mapping;constructor(r,o=ql,c=!0,i=0,s=0,e=0,t=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY,u=new Qt,l=new Qt,d=Wn(Kl)){this.startTime=r,this._maxSize=o,this._recordMinMax=c,this._sum=i,this._count=s,this._zeroCount=e,this._min=t,this._max=n,this._positive=u,this._negative=l,this._mapping=d,this._maxSize<Jn&&(S.warn(`Exponential Histogram Max Size set to ${this._maxSize}, changing to the minimum size of: ${Jn}`),this._maxSize=Jn)}record(r){this.updateByIncrement(r,1)}setStartTime(r){this.startTime=r}toPointValue(){return{hasMinMax:this._recordMinMax,min:this.min,max:this.max,sum:this.sum,positive:{offset:this.positive.offset,bucketCounts:this.positive.counts()},negative:{offset:this.negative.offset,bucketCounts:this.negative.counts()},count:this.count,scale:this.scale,zeroCount:this.zeroCount}}get sum(){return this._sum}get min(){return this._min}get max(){return this._max}get count(){return this._count}get zeroCount(){return this._zeroCount}get scale(){return this._count===this._zeroCount?0:this._mapping.scale}get positive(){return this._positive}get negative(){return this._negative}updateByIncrement(r,o){if(!Number.isNaN(r)){if(r>this._max&&(this._max=r),r<this._min&&(this._min=r),this._count+=o,r===0){this._zeroCount+=o;return}this._sum+=r*o,r>0?this._updateBuckets(this._positive,r,o):this._updateBuckets(this._negative,-r,o)}}merge(r){this._count===0?(this._min=r.min,this._max=r.max):r.count!==0&&(r.min<this.min&&(this._min=r.min),r.max>this.max&&(this._max=r.max)),this.startTime=r.startTime,this._sum+=r.sum,this._count+=r.count,this._zeroCount+=r.zeroCount;let o=this._minScale(r);this._downscale(this.scale-o),this._mergeBuckets(this.positive,r,r.positive,o),this._mergeBuckets(this.negative,r,r.negative,o)}diff(r){this._min=1/0,this._max=-1/0,this._sum-=r.sum,this._count-=r.count,this._zeroCount-=r.zeroCount;let o=this._minScale(r);this._downscale(this.scale-o),this._diffBuckets(this.positive,r,r.positive,o),this._diffBuckets(this.negative,r,r.negative,o)}clone(){return new a(this.startTime,this._maxSize,this._recordMinMax,this._sum,this._count,this._zeroCount,this._min,this._max,this.positive.clone(),this.negative.clone(),this._mapping)}_updateBuckets(r,o,c){let i=this._mapping.mapToIndex(o),s=!1,e=0,t=0;if(r.length===0?(r.indexStart=i,r.indexEnd=r.indexStart,r.indexBase=r.indexStart):i<r.indexStart&&r.indexEnd-i>=this._maxSize?(s=!0,t=i,e=r.indexEnd):i>r.indexEnd&&i-r.indexStart>=this._maxSize&&(s=!0,t=r.indexStart,e=i),s){let n=this._changeScale(e,t);this._downscale(n),i=this._mapping.mapToIndex(o)}this._incrementIndexBy(r,i,c)}_incrementIndexBy(r,o,c){if(c===0)return;if(r.length===0&&(r.indexStart=r.indexEnd=r.indexBase=o),o<r.indexStart){let s=r.indexEnd-o;s>=r.backing.length&&this._grow(r,s+1),r.indexStart=o}else if(o>r.indexEnd){let s=o-r.indexStart;s>=r.backing.length&&this._grow(r,s+1),r.indexEnd=o}let i=o-r.indexBase;i<0&&(i+=r.backing.length),r.incrementBucket(i,c)}_grow(r,o){let c=r.backing.length,i=r.indexBase-r.indexStart,s=c-i,e=As(o);e>this._maxSize&&(e=this._maxSize);let t=e-i;r.backing.growTo(e,s,t)}_changeScale(r,o){let c=0;for(;r-o>=this._maxSize;)r>>=1,o>>=1,c++;return c}_downscale(r){if(r===0)return;if(r<0)throw new Error(`impossible change of scale: ${this.scale}`);let o=this._mapping.scale-r;this._positive.downscale(r),this._negative.downscale(r),this._mapping=Wn(o)}_minScale(r){let o=Math.min(this.scale,r.scale),c=Ot.combine(this._highLowAtScale(this.positive,this.scale,o),this._highLowAtScale(r.positive,r.scale,o)),i=Ot.combine(this._highLowAtScale(this.negative,this.scale,o),this._highLowAtScale(r.negative,r.scale,o));return Math.min(o-this._changeScale(c.high,c.low),o-this._changeScale(i.high,i.low))}_highLowAtScale(r,o,c){if(r.length===0)return new Ot(0,-1);let i=o-c;return new Ot(r.indexStart>>i,r.indexEnd>>i)}_mergeBuckets(r,o,c,i){let s=c.offset,e=o.scale-i;for(let t=0;t<c.length;t++)this._incrementIndexBy(r,s+t>>e,c.at(t))}_diffBuckets(r,o,c,i){let s=c.offset,e=o.scale-i;for(let t=0;t<c.length;t++){let u=(s+t>>e)-r.indexBase;u<0&&(u+=r.backing.length),r.decrementBucket(u,c.at(t))}r.trim()}},ee=class{_maxSize;_recordMinMax;kind=D.EXPONENTIAL_HISTOGRAM;constructor(r,o){this._maxSize=r,this._recordMinMax=o}createAccumulation(r){return new We(r,this._maxSize,this._recordMinMax)}merge(r,o){let c=o.clone();return c.merge(r),c}diff(r,o){let c=o.clone();return c.diff(r),c}toMetricData(r,o,c,i){return{descriptor:r,aggregationTemporality:o,dataPointType:P.EXPONENTIAL_HISTOGRAM,dataPoints:c.map(([s,e])=>{let t=e.toPointValue(),n=r.type===h.GAUGE||r.type===h.UP_DOWN_COUNTER||r.type===h.OBSERVABLE_GAUGE||r.type===h.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:s,startTime:e.startTime,endTime:i,value:{min:t.hasMinMax?t.min:void 0,max:t.hasMinMax?t.max:void 0,sum:n?void 0:t.sum,positive:{offset:t.positive.offset,bucketCounts:t.positive.bucketCounts},negative:{offset:t.negative.offset,bucketCounts:t.negative.bucketCounts},count:t.count,scale:t.scale,zeroCount:t.zeroCount}}})}}}});function Je(a){return a.setValue(zn,!0)}function vs(a){return a.deleteValue(zn)}function Nt(a){return a.getValue(zn)===!0}var zn,re=_(()=>{"use strict";O();zn=Ie("OpenTelemetry SDK Context Key SUPPRESS_TRACING")});var Ms,ze,xt,Xe,Xn=_(()=>{"use strict";Ms="=",ze=";",xt=",",Xe="baggage"});function Cs(a){return a.reduce((r,o)=>{let c=`${r}${r!==""?xt:""}${o}`;return c.length>8192?r:c},"")}function Is(a){return a.getAllEntries().map(([r,o])=>{let c=`${encodeURIComponent(r)}=${encodeURIComponent(o.value)}`;return o.metadata!==void 0&&(c+=ze+o.metadata.toString()),c})}function Qn(a){let r=a.split(ze);if(r.length<=0)return;let o=r.shift();if(!o)return;let c=o.indexOf(Ms);if(c<=0)return;let i=decodeURIComponent(o.substring(0,c).trim()),s=decodeURIComponent(o.substring(c+1).trim()),e;return r.length>0&&(e=Xi(r.join(ze))),{key:i,value:s,metadata:e}}function lt(a){let r={};return typeof a=="string"&&a.length>0&&a.split(xt).forEach(o=>{let c=Qn(o);c!==void 0&&c.value.length>0&&(r[c.key]=c.value)}),r}var Zn=_(()=>{"use strict";O();Xn()});var Qe,Us=_(()=>{"use strict";O();re();Xn();Zn();Qe=class{inject(r,o,c){let i=Ue.getBaggage(r);if(!i||Nt(r))return;let s=Is(i).filter(t=>t.length<=4096).slice(0,180),e=Cs(s);e.length>0&&c.set(o,Xe,e)}extract(r,o,c){let i=c.get(o,Xe),s=Array.isArray(i)?i.join(xt):i;if(!s)return r;let e={};return s.length===0||(s.split(xt).forEach(n=>{let u=Qn(n);if(u){let l={value:u.value};u.metadata&&(l.metadata=u.metadata),e[u.key]=l}}),Object.entries(e).length===0)?r:Ue.setBaggage(r,Ue.createBaggage(e))}fields(){return[Xe]}}});var Ze,Ls=_(()=>{"use strict";Ze=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(r,o){this._monotonicClock=o,this._epochMillis=r.now(),this._performanceMillis=o.now()}now(){let r=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+r}}});function Ds(a){let r={};if(typeof a!="object"||a==null)return r;for(let[o,c]of Object.entries(a)){if(!Jl(o)){S.warn(`Invalid attribute key: ${o}`);continue}if(!to(c)){S.warn(`Invalid attribute value set for key: ${o}`);continue}Array.isArray(c)?r[o]=c.slice():r[o]=c}return r}function Jl(a){return typeof a=="string"&&a.length>0}function to(a){return a==null?!0:Array.isArray(a)?zl(a):ws(a)}function zl(a){let r;for(let o of a)if(o!=null){if(!r){if(ws(o)){r=typeof o;continue}return!1}if(typeof o!==r)return!1}return!0}function ws(a){switch(typeof a){case"number":case"boolean":case"string":return!0}return!1}var Vs=_(()=>{"use strict";O()});function tr(){return a=>{S.error(Xl(a))}}function Xl(a){return typeof a=="string"?a:JSON.stringify(Ql(a))}function Ql(a){let r={},o=a;for(;o!==null;)Object.getOwnPropertyNames(o).forEach(c=>{if(r[c])return;let i=o[c];i&&(r[c]=String(i))}),o=Object.getPrototypeOf(o);return r}var eo=_(()=>{"use strict";O()});function Gs(a){ks=a}function ne(a){try{ks(a)}catch{}}var ks,Bs=_(()=>{"use strict";eo();ks=tr()});import{inspect as Hs}from"util";function er(a){let r=process.env[a];if(r==null||r.trim()==="")return;let o=Number(r);if(isNaN(o)){S.warn(`Unknown value ${Hs(r)} for ${a}, expected a number, using defaults`);return}return o}function w(a){let r=process.env[a];if(!(r==null||r.trim()===""))return r}function rr(a){let r=process.env[a]?.trim().toLowerCase();return r==null||r===""?!1:r==="true"?!0:(r==="false"||S.warn(`Unknown value ${Hs(r)} for ${a}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}function nr(a){return w(a)?.split(",").map(r=>r.trim()).filter(r=>r!=="")}var Fs=_(()=>{"use strict";O()});var or,Ys=_(()=>{"use strict";or=typeof globalThis=="object"?globalThis:global});import{performance as Zl}from"perf_hooks";var nt,Ks=_(()=>{"use strict";nt=Zl});var qs,$s=_(()=>{"use strict";qs="2.1.0"});var js=_(()=>{"use strict"});var Ws=_(()=>{"use strict";js()});var Js=_(()=>{"use strict"});var zs=_(()=>{"use strict";Js()});var Xs,oe,Qs,ie,se,Zs=_(()=>{"use strict";Xs="service.name",oe="telemetry.sdk.language",Qs="nodejs",ie="telemetry.sdk.name",se="telemetry.sdk.version"});var ta=_(()=>{"use strict"});var ea=_(()=>{"use strict"});var ro=_(()=>{"use strict";Ws();zs();Zs();ta();ea()});var ra,na=_(()=>{"use strict";ra="process.runtime.name"});var ot,oa=_(()=>{"use strict";$s();ro();na();ot={[ie]:"opentelemetry",[ra]:"node",[oe]:Qs,[se]:qs}});function gt(a){a.unref()}var ia=_(()=>{"use strict"});var sa=_(()=>{"use strict";Fs();Ys();Ks();oa();ia()});var no=_(()=>{"use strict";sa()});function V(a){let r=a/1e3,o=Math.trunc(r),c=Math.round(a%1e3*ep);return[o,c]}function sr(){let a=nt.timeOrigin;if(typeof a!="number"){let r=nt;a=r.timing&&r.timing.fetchStart}return a}function oo(a){let r=V(sr()),o=V(typeof a=="number"?a:nt.now());return io(r,o)}function ca(a){if(cr(a))return a;if(typeof a=="number")return a<sr()?oo(a):V(a);if(a instanceof Date)return V(a.getTime());throw TypeError("Invalid input type")}function ua(a,r){let o=r[0]-a[0],c=r[1]-a[1];return c<0&&(o-=1,c+=ir),[o,c]}function la(a){let r=aa,o=`${"0".repeat(r)}${a[1]}Z`,c=o.substring(o.length-r-1);return new Date(a[0]*1e3).toISOString().replace("000Z",c)}function ar(a){return a[0]*ir+a[1]}function pa(a){return a[0]*1e3+a[1]/1e6}function pt(a){return a[0]*1e6+a[1]/1e3}function cr(a){return Array.isArray(a)&&a.length===2&&typeof a[0]=="number"&&typeof a[1]=="number"}function fa(a){return cr(a)||typeof a=="number"||a instanceof Date}function io(a,r){let o=[a[0]+r[0],a[1]+r[1]];return o[1]>=ir&&(o[1]-=ir,o[0]+=1),o}var aa,tp,ep,ir,da=_(()=>{"use strict";no();aa=9,tp=6,ep=Math.pow(10,tp),ir=Math.pow(10,aa)});var g,ma=_(()=>{"use strict";(function(a){a[a.SUCCESS=0]="SUCCESS",a[a.FAILED=1]="FAILED"})(g||(g={}))});var ur,_a=_(()=>{"use strict";O();ur=class{_propagators;_fields;constructor(r={}){this._propagators=r.propagators??[],this._fields=Array.from(new Set(this._propagators.map(o=>typeof o.fields=="function"?o.fields():[]).reduce((o,c)=>o.concat(c),[])))}inject(r,o,c){for(let i of this._propagators)try{i.inject(r,o,c)}catch(s){S.warn(`Failed to inject with ${i.constructor.name}. Err: ${s.message}`)}}extract(r,o,c){return this._propagators.reduce((i,s)=>{try{return s.extract(i,o,c)}catch(e){S.warn(`Failed to extract with ${s.constructor.name}. Err: ${e.message}`)}return i},r)}fields(){return this._fields.slice()}}});function Ea(a){return op.test(a)}function Sa(a){return ip.test(a)&&!sp.test(a)}var so,rp,np,op,ip,sp,Ta=_(()=>{"use strict";so="[_0-9a-z-*/]",rp=`[a-z]${so}{0,255}`,np=`[a-z0-9]${so}{0,240}@[a-z]${so}{0,13}`,op=new RegExp(`^(?:${rp}|${np})$`),ip=/^[ -~]{0,255}[!-~]$/,sp=/,|=/});var ha,ap,ya,Aa,Rt,ao=_(()=>{"use strict";Ta();ha=32,ap=512,ya=",",Aa="=",Rt=class a{_internalState=new Map;constructor(r){r&&this._parse(r)}set(r,o){let c=this._clone();return c._internalState.has(r)&&c._internalState.delete(r),c._internalState.set(r,o),c}unset(r){let o=this._clone();return o._internalState.delete(r),o}get(r){return this._internalState.get(r)}serialize(){return this._keys().reduce((r,o)=>(r.push(o+Aa+this.get(o)),r),[]).join(ya)}_parse(r){r.length>ap||(this._internalState=r.split(ya).reverse().reduce((o,c)=>{let i=c.trim(),s=i.indexOf(Aa);if(s!==-1){let e=i.slice(0,s),t=i.slice(s+1,c.length);Ea(e)&&Sa(t)&&o.set(e,t)}return o},new Map),this._internalState.size>ha&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,ha))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let r=new a;return r._internalState=new Map(this._internalState),r}}});function co(a){let r=dp.exec(a);return!r||r[1]==="00"&&r[5]?null:{traceId:r[2],spanId:r[3],traceFlags:parseInt(r[4],16)}}var ae,ce,cp,up,lp,pp,fp,dp,lr,Oa=_(()=>{"use strict";O();re();ao();ae="traceparent",ce="tracestate",cp="00",up="(?!ff)[\\da-f]{2}",lp="(?![0]{32})[\\da-f]{32}",pp="(?![0]{16})[\\da-f]{16}",fp="[\\da-f]{2}",dp=new RegExp(`^\\s?(${up})-(${lp})-(${pp})-(${fp})(-.*)?\\s?$`);lr=class{inject(r,o,c){let i=Gn.getSpanContext(r);if(!i||Nt(r)||!es(i))return;let s=`${cp}-${i.traceId}-${i.spanId}-0${Number(i.traceFlags||ts.NONE).toString(16)}`;c.set(o,ae,s),i.traceState&&c.set(o,ce,i.traceState.serialize())}extract(r,o,c){let i=c.get(o,ae);if(!i)return r;let s=Array.isArray(i)?i[0]:i;if(typeof s!="string")return r;let e=co(s);if(!e)return r;e.isRemote=!0;let t=c.get(o,ce);if(t){let n=Array.isArray(t)?t.join(","):t;e.traceState=new Rt(typeof n=="string"?n:void 0)}return Gn.setSpanContext(r,e)}fields(){return[ae,ce]}}});function Na(a,r){return a.setValue(uo,r)}function xa(a){return a.deleteValue(uo)}function ga(a){return a.getValue(uo)}var uo,pr,Ra=_(()=>{"use strict";O();uo=Ie("OpenTelemetry SDK Context Key RPC_METADATA");(function(a){a.HTTP="http"})(pr||(pr={}))});function lo(a){if(!yp(a)||Ap(a)!==mp)return!1;let r=hp(a);if(r===null)return!0;let o=va.call(r,"constructor")&&r.constructor;return typeof o=="function"&&o instanceof o&&Pa.call(o)===Tp}function yp(a){return a!=null&&typeof a=="object"}function Ap(a){return a==null?a===void 0?Ep:_p:ft&&ft in Object(a)?Op(a):Np(a)}function Op(a){let r=va.call(a,ft),o=a[ft],c=!1;try{a[ft]=void 0,c=!0}catch{}let i=Ma.call(a);return c&&(r?a[ft]=o:delete a[ft]),i}function Np(a){return Ma.call(a)}var mp,_p,Ep,Sp,Pa,Tp,hp,ba,va,ft,Ma,Ca=_(()=>{"use strict";mp="[object Object]",_p="[object Null]",Ep="[object Undefined]",Sp=Function.prototype,Pa=Sp.toString,Tp=Pa.call(Object),hp=Object.getPrototypeOf,ba=Object.prototype,va=ba.hasOwnProperty,ft=Symbol?Symbol.toStringTag:void 0,Ma=ba.toString});function Ua(...a){let r=a.shift(),o=new WeakMap;for(;a.length>0;)r=La(r,a.shift(),0,o);return r}function po(a){return dr(a)?a.slice():a}function La(a,r,o=0,c){let i;if(!(o>xp)){if(o++,fr(a)||fr(r)||Da(r))i=po(r);else if(dr(a)){if(i=a.slice(),dr(r))for(let s=0,e=r.length;s<e;s++)i.push(po(r[s]));else if(ue(r)){let s=Object.keys(r);for(let e=0,t=s.length;e<t;e++){let n=s[e];i[n]=po(r[n])}}}else if(ue(a))if(ue(r)){if(!gp(a,r))return r;i=Object.assign({},a);let s=Object.keys(r);for(let e=0,t=s.length;e<t;e++){let n=s[e],u=r[n];if(fr(u))typeof u>"u"?delete i[n]:i[n]=u;else{let l=i[n],d=u;if(Ia(a,n,c)||Ia(r,n,c))delete i[n];else{if(ue(l)&&ue(d)){let E=c.get(l)||[],A=c.get(d)||[];E.push({obj:a,key:n}),A.push({obj:r,key:n}),c.set(l,E),c.set(d,A)}i[n]=La(i[n],u,o,c)}}}}else i=r;return i}}function Ia(a,r,o){let c=o.get(a[r])||[];for(let i=0,s=c.length;i<s;i++){let e=c[i];if(e.key===r&&e.obj===a)return!0}return!1}function dr(a){return Array.isArray(a)}function Da(a){return typeof a=="function"}function ue(a){return!fr(a)&&!dr(a)&&!Da(a)&&typeof a=="object"}function fr(a){return typeof a=="string"||typeof a=="number"||typeof a=="boolean"||typeof a>"u"||a instanceof Date||a instanceof RegExp||a===null}function gp(a,r){return!(!lo(a)||!lo(r))}var xp,wa=_(()=>{"use strict";Ca();xp=20});function Va(a,r){let o,c=new Promise(function(s,e){o=setTimeout(function(){e(new le("Operation timed out."))},r)});return Promise.race([a,c]).then(i=>(clearTimeout(o),i),i=>{throw clearTimeout(o),i})}var le,ka=_(()=>{"use strict";le=class a extends Error{constructor(r){super(r),Object.setPrototypeOf(this,a.prototype)}}});function fo(a,r){return typeof r=="string"?a===r:!!a.match(r)}function Ga(a,r){if(!r)return!1;for(let o of r)if(fo(a,o))return!0;return!1}var Ba=_(()=>{"use strict"});var mr,Ha=_(()=>{"use strict";mr=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((r,o)=>{this._resolve=r,this._reject=o})}get promise(){return this._promise}resolve(r){this._resolve(r)}reject(r){this._reject(r)}}});var _r,Fa=_(()=>{"use strict";Ha();_r=class{_callback;_that;_isCalled=!1;_deferred=new mr;constructor(r,o){this._callback=r,this._that=o}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...r){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...r)).then(o=>this._deferred.resolve(o),o=>this._deferred.reject(o))}catch(o){this._deferred.reject(o)}}return this._deferred.promise}}});function Ka(a){if(a==null)return;let r=Ya[a.toUpperCase()];return r??(S.warn(`Unknown log level "${a}", expected one of ${Object.keys(Ya)}, using default`),H.INFO)}var Ya,qa=_(()=>{"use strict";O();Ya={ALL:H.ALL,VERBOSE:H.VERBOSE,DEBUG:H.DEBUG,INFO:H.INFO,WARN:H.WARN,ERROR:H.ERROR,NONE:H.NONE}});function $a(a,r){return new Promise(o=>{Jt.with(Je(Jt.active()),()=>{a.export(r,c=>{o(c)})})})}var ja=_(()=>{"use strict";O();re()});var Er={};St(Er,{AnchoredClock:()=>Ze,BindOnceFuture:()=>_r,CompositePropagator:()=>ur,ExportResultCode:()=>g,RPCType:()=>pr,SDK_INFO:()=>ot,TRACE_PARENT_HEADER:()=>ae,TRACE_STATE_HEADER:()=>ce,TimeoutError:()=>le,TraceState:()=>Rt,W3CBaggagePropagator:()=>Qe,W3CTraceContextPropagator:()=>lr,_globalThis:()=>or,addHrTimes:()=>io,callWithTimeout:()=>Va,deleteRPCMetadata:()=>xa,diagLogLevelFromString:()=>Ka,getBooleanFromEnv:()=>rr,getNumberFromEnv:()=>er,getRPCMetadata:()=>ga,getStringFromEnv:()=>w,getStringListFromEnv:()=>nr,getTimeOrigin:()=>sr,globalErrorHandler:()=>ne,hrTime:()=>oo,hrTimeDuration:()=>ua,hrTimeToMicroseconds:()=>pt,hrTimeToMilliseconds:()=>pa,hrTimeToNanoseconds:()=>ar,hrTimeToTimeStamp:()=>la,internal:()=>mo,isAttributeValue:()=>to,isTimeInput:()=>fa,isTimeInputHrTime:()=>cr,isTracingSuppressed:()=>Nt,isUrlIgnored:()=>Ga,loggingErrorHandler:()=>tr,merge:()=>Ua,millisToHrTime:()=>V,otperformance:()=>nt,parseKeyPairsIntoRecord:()=>lt,parseTraceParent:()=>co,sanitizeAttributes:()=>Ds,setGlobalErrorHandler:()=>Gs,setRPCMetadata:()=>Na,suppressTracing:()=>Je,timeInputToHrTime:()=>ca,unrefTimer:()=>gt,unsuppressTracing:()=>vs,urlMatches:()=>fo});var mo,M=_(()=>{"use strict";Us();Ls();Vs();Bs();eo();da();ma();Zn();no();_a();Oa();Ra();re();ao();wa();ka();Ba();Fa();qa();ja();mo={_export:$a}});var Pt,pe,Wa=_(()=>{"use strict";ht();M();et();Pt=class{startTime;_current;sampleTime;constructor(r,o=0,c=[0,0]){this.startTime=r,this._current=o,this.sampleTime=c}record(r){this._current=r,this.sampleTime=V(Date.now())}setStartTime(r){this.startTime=r}toPointValue(){return this._current}},pe=class{kind=D.LAST_VALUE;createAccumulation(r){return new Pt(r)}merge(r,o){let c=pt(o.sampleTime)>=pt(r.sampleTime)?o:r;return new Pt(r.startTime,c.toPointValue(),c.sampleTime)}diff(r,o){let c=pt(o.sampleTime)>=pt(r.sampleTime)?o:r;return new Pt(o.startTime,c.toPointValue(),c.sampleTime)}toMetricData(r,o,c,i){return{descriptor:r,aggregationTemporality:o,dataPointType:P.GAUGE,dataPoints:c.map(([s,e])=>({attributes:s,startTime:e.startTime,endTime:i,value:e.toPointValue()}))}}}});var it,bt,Ja=_(()=>{"use strict";ht();et();it=class{startTime;monotonic;_current;reset;constructor(r,o,c=0,i=!1){this.startTime=r,this.monotonic=o,this._current=c,this.reset=i}record(r){this.monotonic&&r<0||(this._current+=r)}setStartTime(r){this.startTime=r}toPointValue(){return this._current}},bt=class{monotonic;kind=D.SUM;constructor(r){this.monotonic=r}createAccumulation(r){return new it(r,this.monotonic)}merge(r,o){let c=r.toPointValue(),i=o.toPointValue();return o.reset?new it(o.startTime,this.monotonic,i,o.reset):new it(r.startTime,this.monotonic,c+i)}diff(r,o){let c=r.toPointValue(),i=o.toPointValue();return this.monotonic&&c>i?new it(o.startTime,this.monotonic,i,!0):new it(o.startTime,this.monotonic,i-c)}toMetricData(r,o,c,i){return{descriptor:r,aggregationTemporality:o,dataPointType:P.SUM,dataPoints:c.map(([s,e])=>({attributes:s,startTime:e.startTime,endTime:i,value:e.toPointValue()})),isMonotonic:this.monotonic}}}});var za=_(()=>{"use strict";Ss();Ts();bs();Wa();Ja()});var _o,Eo,So,To,fe,de,ho,yo,Ao,Oo,No,nS,Xa,Qa=_(()=>{"use strict";O();za();et();_o=class a{static DEFAULT_INSTANCE=new Xt;createAggregator(r){return a.DEFAULT_INSTANCE}},Eo=class a{static MONOTONIC_INSTANCE=new bt(!0);static NON_MONOTONIC_INSTANCE=new bt(!1);createAggregator(r){switch(r.type){case h.COUNTER:case h.OBSERVABLE_COUNTER:case h.HISTOGRAM:return a.MONOTONIC_INSTANCE;default:return a.NON_MONOTONIC_INSTANCE}}},So=class a{static DEFAULT_INSTANCE=new pe;createAggregator(r){return a.DEFAULT_INSTANCE}},To=class a{static DEFAULT_INSTANCE=new At([0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],!0);createAggregator(r){return a.DEFAULT_INSTANCE}},fe=class{_recordMinMax;_boundaries;constructor(r,o=!0){if(this._recordMinMax=o,r==null)throw new Error("ExplicitBucketHistogramAggregation should be created with explicit boundaries, if a single bucket histogram is required, please pass an empty array");r=r.concat(),r=r.sort((s,e)=>s-e);let c=r.lastIndexOf(-1/0),i=r.indexOf(1/0);i===-1&&(i=void 0),this._boundaries=r.slice(c+1,i)}createAggregator(r){return new At(this._boundaries,this._recordMinMax)}},de=class{_maxSize;_recordMinMax;constructor(r=160,o=!0){this._maxSize=r,this._recordMinMax=o}createAggregator(r){return new ee(this._maxSize,this._recordMinMax)}},ho=class{_resolve(r){switch(r.type){case h.COUNTER:case h.UP_DOWN_COUNTER:case h.OBSERVABLE_COUNTER:case h.OBSERVABLE_UP_DOWN_COUNTER:return Ao;case h.GAUGE:case h.OBSERVABLE_GAUGE:return Oo;case h.HISTOGRAM:return r.advice.explicitBucketBoundaries?new fe(r.advice.explicitBucketBoundaries):No}return S.warn(`Unable to recognize instrument type: ${r.type}`),yo}createAggregator(r){return this._resolve(r).createAggregator(r)}},yo=new _o,Ao=new Eo,Oo=new So,No=new To,nS=new de,Xa=new ho});function Sr(a){switch(a.type){case b.DEFAULT:return Xa;case b.DROP:return yo;case b.SUM:return Ao;case b.LAST_VALUE:return Oo;case b.EXPONENTIAL_HISTOGRAM:{let r=a;return new de(r.options?.maxSize,r.options?.recordMinMax)}case b.EXPLICIT_BUCKET_HISTOGRAM:{let r=a;return r.options==null?No:new fe(r.options?.boundaries,r.options?.recordMinMax)}default:throw new Error("Unsupported Aggregation")}}var b,me=_(()=>{"use strict";Qa();(function(a){a[a.DEFAULT=0]="DEFAULT",a[a.DROP=1]="DROP",a[a.SUM=2]="SUM",a[a.LAST_VALUE=3]="LAST_VALUE",a[a.EXPLICIT_BUCKET_HISTOGRAM=4]="EXPLICIT_BUCKET_HISTOGRAM",a[a.EXPONENTIAL_HISTOGRAM=5]="EXPONENTIAL_HISTOGRAM"})(b||(b={}))});var Za,Tr,xo=_(()=>{"use strict";Be();me();Za=a=>({type:b.DEFAULT}),Tr=a=>R.CUMULATIVE});var vt,go=_(()=>{"use strict";O();F();xo();vt=class{_shutdown=!1;_metricProducers;_sdkMetricProducer;_aggregationTemporalitySelector;_aggregationSelector;_cardinalitySelector;constructor(r){this._aggregationSelector=r?.aggregationSelector??Za,this._aggregationTemporalitySelector=r?.aggregationTemporalitySelector??Tr,this._metricProducers=r?.metricProducers??[],this._cardinalitySelector=r?.cardinalitySelector}setMetricProducer(r){if(this._sdkMetricProducer)throw new Error("MetricReader can not be bound to a MeterProvider again.");this._sdkMetricProducer=r,this.onInitialized()}selectAggregation(r){return this._aggregationSelector(r)}selectAggregationTemporality(r){return this._aggregationTemporalitySelector(r)}selectCardinalityLimit(r){return this._cardinalitySelector?this._cardinalitySelector(r):2e3}onInitialized(){}async collect(r){if(this._sdkMetricProducer===void 0)throw new Error("MetricReader is not bound to a MetricProducer");if(this._shutdown)throw new Error("MetricReader is shutdown");let[o,...c]=await Promise.all([this._sdkMetricProducer.collect({timeoutMillis:r?.timeoutMillis}),...this._metricProducers.map(t=>t.collect({timeoutMillis:r?.timeoutMillis}))]),i=o.errors.concat(Yn(c,t=>t.errors)),s=o.resourceMetrics.resource,e=o.resourceMetrics.scopeMetrics.concat(Yn(c,t=>t.resourceMetrics.scopeMetrics));return{resourceMetrics:{resource:s,scopeMetrics:e},errors:i}}async shutdown(r){if(this._shutdown){S.error("Cannot call shutdown twice.");return}r?.timeoutMillis==null?await this.onShutdown():await rt(this.onShutdown(),r.timeoutMillis),this._shutdown=!0}async forceFlush(r){if(this._shutdown){S.warn("Cannot forceFlush on already shutdown MetricReader.");return}if(r?.timeoutMillis==null){await this.onForceFlush();return}await rt(this.onForceFlush(),r.timeoutMillis)}}});var dt,tc=_(()=>{"use strict";O();M();go();F();dt=class extends vt{_interval;_exporter;_exportInterval;_exportTimeout;constructor(r){if(super({aggregationSelector:r.exporter.selectAggregation?.bind(r.exporter),aggregationTemporalitySelector:r.exporter.selectAggregationTemporality?.bind(r.exporter),metricProducers:r.metricProducers}),r.exportIntervalMillis!==void 0&&r.exportIntervalMillis<=0)throw Error("exportIntervalMillis must be greater than 0");if(r.exportTimeoutMillis!==void 0&&r.exportTimeoutMillis<=0)throw Error("exportTimeoutMillis must be greater than 0");if(r.exportTimeoutMillis!==void 0&&r.exportIntervalMillis!==void 0&&r.exportIntervalMillis<r.exportTimeoutMillis)throw Error("exportIntervalMillis must be greater than or equal to exportTimeoutMillis");this._exportInterval=r.exportIntervalMillis??6e4,this._exportTimeout=r.exportTimeoutMillis??3e4,this._exporter=r.exporter}async _runOnce(){try{await rt(this._doRun(),this._exportTimeout)}catch(r){if(r instanceof ut){S.error("Export took longer than %s milliseconds and timed out.",this._exportTimeout);return}ne(r)}}async _doRun(){let{resourceMetrics:r,errors:o}=await this.collect({timeoutMillis:this._exportTimeout});if(o.length>0&&S.error("PeriodicExportingMetricReader: metrics collection errors",...o),r.resource.asyncAttributesPending)try{await r.resource.waitForAsyncAttributes?.()}catch(i){S.debug("Error while resolving async portion of resource: ",i),ne(i)}if(r.scopeMetrics.length===0)return;let c=await mo._export(this._exporter,r);if(c.code!==g.SUCCESS)throw new Error(`PeriodicExportingMetricReader: metrics export failed (error ${c.error})`)}onInitialized(){this._interval=setInterval(()=>{this._runOnce()},this._exportInterval),gt(this._interval)}async onForceFlush(){await this._runOnce(),await this._exporter.forceFlush()}async onShutdown(){this._interval&&clearInterval(this._interval),await this.onForceFlush(),await this._exporter.shutdown()}}});var hr,ec=_(()=>{"use strict";M();hr=class{_shutdown=!1;_aggregationTemporality;_metrics=[];constructor(r){this._aggregationTemporality=r}export(r,o){if(this._shutdown){setTimeout(()=>o({code:g.FAILED}),0);return}this._metrics.push(r),setTimeout(()=>o({code:g.SUCCESS}),0)}getMetrics(){return this._metrics}forceFlush(){return Promise.resolve()}reset(){this._metrics=[]}selectAggregationTemporality(r){return this._aggregationTemporality}shutdown(){return this._shutdown=!0,Promise.resolve()}}});var yr,rc=_(()=>{"use strict";M();xo();yr=class a{_shutdown=!1;_temporalitySelector;constructor(r){this._temporalitySelector=r?.temporalitySelector??Tr}export(r,o){if(this._shutdown){setImmediate(o,{code:g.FAILED});return}return a._sendMetrics(r,o)}forceFlush(){return Promise.resolve()}selectAggregationTemporality(r){return this._temporalitySelector(r)}shutdown(){return this._shutdown=!0,Promise.resolve()}static _sendMetrics(r,o){for(let c of r.scopeMetrics)for(let i of c.metrics)console.dir({descriptor:i.descriptor,dataPointType:i.dataPointType,dataPoints:i.dataPoints},{depth:null});o({code:g.SUCCESS})}}});function Ar(){return`unknown_service:${process.argv0}`}var nc=_(()=>{"use strict"});var oc=_(()=>{"use strict";nc()});var ic=_(()=>{"use strict";oc()});var Mt,sc=_(()=>{"use strict";Mt=a=>a!==null&&typeof a=="object"&&typeof a.then=="function"});function cc(a,r){return Ro.FromAttributeList(Object.entries(a),r)}function Po(){return cc({[Xs]:Ar(),[oe]:ot[oe],[ie]:ot[ie],[se]:ot[se]})}function ac(a){return a.map(([r,o])=>Mt(o)?[r,o.catch(c=>{S.debug("promise rejection for resource attribute: %s - %s",r,c)})]:[r,o])}function Rp(a){if(typeof a=="string"||a===void 0)return a;S.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",a)}function Pp(a,r){let o=a?.schemaUrl,c=r?.schemaUrl,i=o===void 0||o==="",s=c===void 0||c==="";if(i)return c;if(s||o===c)return o;S.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',o,c)}var Ro,uc=_(()=>{"use strict";O();M();ro();ic();sc();Ro=class a{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(r,o){let c=new a({},o);return c._rawAttributes=ac(r),c._asyncAttributesPending=r.filter(([i,s])=>Mt(s)).length>0,c}constructor(r,o){let c=r.attributes??{};this._rawAttributes=Object.entries(c).map(([i,s])=>(Mt(s)&&(this._asyncAttributesPending=!0),[i,s])),this._rawAttributes=ac(this._rawAttributes),this._schemaUrl=Rp(o?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let r=0;r<this._rawAttributes.length;r++){let[o,c]=this._rawAttributes[r];this._rawAttributes[r]=[o,Mt(c)?await c:c]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&S.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;let r={};for(let[o,c]of this._rawAttributes){if(Mt(c)){S.debug(`Unsettled resource attribute ${o} skipped`);continue}c!=null&&(r[o]??=c)}return this._asyncAttributesPending||(this._memoizedAttributes=r),r}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(r){if(r==null)return this;let o=Pp(this,r),c=o?{schemaUrl:o}:void 0;return a.FromAttributeList([...r.getRawAttributes(),...this.getRawAttributes()],c)}}});var lc=_(()=>{"use strict";uc()});var Or,pc=_(()=>{"use strict";Or=class{_registeredViews=[];addView(r){this._registeredViews.push(r)}findViews(r,o){return this._registeredViews.filter(i=>this._matchInstrument(i.instrumentSelector,r)&&this._matchMeter(i.meterSelector,o))}_matchInstrument(r,o){return(r.getType()===void 0||o.type===r.getType())&&r.getNameFilter().match(o.name)&&r.getUnitFilter().match(o.unit)}_matchMeter(r,o){return r.getNameFilter().match(o.name)&&(o.version===void 0||r.getVersionFilter().match(o.version))&&(o.schemaUrl===void 0||r.getSchemaUrlFilter().match(o.schemaUrl))}}});function W(a,r,o){return vp(a)||S.warn(`Invalid metric name: "${a}". The metric name should be a ASCII string with a length no greater than 255 characters.`),{name:a,type:r,description:o?.description??"",unit:o?.unit??"",valueType:o?.valueType??q.DOUBLE,advice:o?.advice??{}}}function fc(a,r){return{name:a.name??r.name,description:a.description??r.description,type:r.type,unit:r.unit,valueType:r.valueType,advice:r.advice}}function dc(a,r){return Es(a.name,r.name)&&a.unit===r.unit&&a.type===r.type&&a.valueType===r.valueType}function vp(a){return a.match(bp)!=null}var bp,_e=_(()=>{"use strict";O();F();bp=/^[a-z][a-z0-9_.\-/]{0,254}$/i});function Ee(a){return a instanceof It}var Ct,Nr,xr,gr,Rr,It,Pr,br,vr,Mr=_(()=>{"use strict";O();M();Ct=class{_writableMetricStorage;_descriptor;constructor(r,o){this._writableMetricStorage=r,this._descriptor=o}_record(r,o={},c=Jt.active()){if(typeof r!="number"){S.warn(`non-number value provided to metric ${this._descriptor.name}: ${r}`);return}this._descriptor.valueType===q.INT&&!Number.isInteger(r)&&(S.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`),r=Math.trunc(r),!Number.isInteger(r))||this._writableMetricStorage.record(r,o,c,V(Date.now()))}},Nr=class extends Ct{add(r,o,c){this._record(r,o,c)}},xr=class extends Ct{add(r,o,c){if(r<0){S.warn(`negative value provided to counter ${this._descriptor.name}: ${r}`);return}this._record(r,o,c)}},gr=class extends Ct{record(r,o,c){this._record(r,o,c)}},Rr=class extends Ct{record(r,o,c){if(r<0){S.warn(`negative value provided to histogram ${this._descriptor.name}: ${r}`);return}this._record(r,o,c)}},It=class{_observableRegistry;_metricStorages;_descriptor;constructor(r,o,c){this._observableRegistry=c,this._descriptor=r,this._metricStorages=o}addCallback(r){this._observableRegistry.addCallback(r,this)}removeCallback(r){this._observableRegistry.removeCallback(r,this)}},Pr=class extends It{},br=class extends It{},vr=class extends It{}});var Cr,mc=_(()=>{"use strict";_e();Mr();et();Cr=class{_meterSharedState;constructor(r){this._meterSharedState=r}createGauge(r,o){let c=W(r,h.GAUGE,o),i=this._meterSharedState.registerMetricStorage(c);return new gr(i,c)}createHistogram(r,o){let c=W(r,h.HISTOGRAM,o),i=this._meterSharedState.registerMetricStorage(c);return new Rr(i,c)}createCounter(r,o){let c=W(r,h.COUNTER,o),i=this._meterSharedState.registerMetricStorage(c);return new xr(i,c)}createUpDownCounter(r,o){let c=W(r,h.UP_DOWN_COUNTER,o),i=this._meterSharedState.registerMetricStorage(c);return new Nr(i,c)}createObservableGauge(r,o){let c=W(r,h.OBSERVABLE_GAUGE,o),i=this._meterSharedState.registerAsyncMetricStorage(c);return new br(c,i,this._meterSharedState.observableRegistry)}createObservableCounter(r,o){let c=W(r,h.OBSERVABLE_COUNTER,o),i=this._meterSharedState.registerAsyncMetricStorage(c);return new Pr(c,i,this._meterSharedState.observableRegistry)}createObservableUpDownCounter(r,o){let c=W(r,h.OBSERVABLE_UP_DOWN_COUNTER,o),i=this._meterSharedState.registerAsyncMetricStorage(c);return new vr(c,i,this._meterSharedState.observableRegistry)}addBatchObservableCallback(r,o){this._meterSharedState.observableRegistry.addBatchCallback(r,o)}removeBatchObservableCallback(r,o){this._meterSharedState.observableRegistry.removeBatchCallback(r,o)}}});var Ut,bo=_(()=>{"use strict";_e();Ut=class{_instrumentDescriptor;constructor(r){this._instrumentDescriptor=r}getInstrumentDescriptor(){return this._instrumentDescriptor}updateDescription(r){this._instrumentDescriptor=W(this._instrumentDescriptor.name,this._instrumentDescriptor.type,{description:r,valueType:this._instrumentDescriptor.valueType,unit:this._instrumentDescriptor.unit,advice:this._instrumentDescriptor.advice})}}});var vo,I,Se=_(()=>{"use strict";F();vo=class{_hash;_valueMap=new Map;_keyMap=new Map;constructor(r){this._hash=r}get(r,o){return o??=this._hash(r),this._valueMap.get(o)}getOrDefault(r,o){let c=this._hash(r);if(this._valueMap.has(c))return this._valueMap.get(c);let i=o();return this._keyMap.has(c)||this._keyMap.set(c,r),this._valueMap.set(c,i),i}set(r,o,c){c??=this._hash(r),this._keyMap.has(c)||this._keyMap.set(c,r),this._valueMap.set(c,o)}has(r,o){return o??=this._hash(r),this._valueMap.has(o)}*keys(){let r=this._keyMap.entries(),o=r.next();for(;o.done!==!0;)yield[o.value[1],o.value[0]],o=r.next()}*entries(){let r=this._valueMap.entries(),o=r.next();for(;o.done!==!0;)yield[this._keyMap.get(o.value[0]),o.value[1],o.value[0]],o=r.next()}get size(){return this._valueMap.size}},I=class extends vo{constructor(){super(He)}}});var Lt,Mo=_(()=>{"use strict";F();Se();Lt=class{_aggregator;_activeCollectionStorage=new I;_cumulativeMemoStorage=new I;_cardinalityLimit;_overflowAttributes={"otel.metric.overflow":!0};_overflowHashCode;constructor(r,o){this._aggregator=r,this._cardinalityLimit=(o??2e3)-1,this._overflowHashCode=He(this._overflowAttributes)}record(r,o,c,i){let s=this._activeCollectionStorage.get(o);if(!s){if(this._activeCollectionStorage.size>=this._cardinalityLimit){this._activeCollectionStorage.getOrDefault(this._overflowAttributes,()=>this._aggregator.createAccumulation(i))?.record(r);return}s=this._aggregator.createAccumulation(i),this._activeCollectionStorage.set(o,s)}s?.record(r)}batchCumulate(r,o){Array.from(r.entries()).forEach(([c,i,s])=>{let e=this._aggregator.createAccumulation(o);e?.record(i);let t=e;if(this._cumulativeMemoStorage.has(c,s)){let n=this._cumulativeMemoStorage.get(c,s);t=this._aggregator.diff(n,e)}else if(this._cumulativeMemoStorage.size>=this._cardinalityLimit&&(c=this._overflowAttributes,s=this._overflowHashCode,this._cumulativeMemoStorage.has(c,s))){let n=this._cumulativeMemoStorage.get(c,s);t=this._aggregator.diff(n,e)}if(this._activeCollectionStorage.has(c,s)){let n=this._activeCollectionStorage.get(c,s);t=this._aggregator.merge(n,t)}this._cumulativeMemoStorage.set(c,e,s),this._activeCollectionStorage.set(c,t,s)})}collect(){let r=this._activeCollectionStorage;return this._activeCollectionStorage=new I,r}}});function Mp(a){return Array.from(a.entries())}var Dt,Co=_(()=>{"use strict";Be();Se();Dt=class a{_aggregator;_unreportedAccumulations=new Map;_reportHistory=new Map;constructor(r,o){this._aggregator=r,o.forEach(c=>{this._unreportedAccumulations.set(c,[])})}buildMetrics(r,o,c,i){this._stashAccumulations(c);let s=this._getMergedUnreportedAccumulations(r),e=s,t;if(this._reportHistory.has(r)){let u=this._reportHistory.get(r),l=u.collectionTime;t=u.aggregationTemporality,t===R.CUMULATIVE?e=a.merge(u.accumulations,s,this._aggregator):e=a.calibrateStartTime(u.accumulations,s,l)}else t=r.selectAggregationTemporality(o.type);this._reportHistory.set(r,{accumulations:e,collectionTime:i,aggregationTemporality:t});let n=Mp(e);if(n.length!==0)return this._aggregator.toMetricData(o,t,n,i)}_stashAccumulations(r){let o=this._unreportedAccumulations.keys();for(let c of o){let i=this._unreportedAccumulations.get(c);i===void 0&&(i=[],this._unreportedAccumulations.set(c,i)),i.push(r)}}_getMergedUnreportedAccumulations(r){let o=new I,c=this._unreportedAccumulations.get(r);if(this._unreportedAccumulations.set(r,[]),c===void 0)return o;for(let i of c)o=a.merge(o,i,this._aggregator);return o}static merge(r,o,c){let i=r,s=o.entries(),e=s.next();for(;e.done!==!0;){let[t,n,u]=e.value;if(r.has(t,u)){let l=r.get(t,u),d=c.merge(l,n);i.set(t,d,u)}else i.set(t,n,u);e=s.next()}return i}static calibrateStartTime(r,o,c){for(let[i,s]of r.keys())o.get(i,s)?.setStartTime(c);return o}}});var Ir,_c=_(()=>{"use strict";bo();Mo();Co();Se();Ir=class extends Ut{_attributesProcessor;_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;constructor(r,o,c,i,s){super(r),this._attributesProcessor=c,this._aggregationCardinalityLimit=s,this._deltaMetricStorage=new Lt(o,this._aggregationCardinalityLimit),this._temporalMetricStorage=new Dt(o,i)}record(r,o){let c=new I;Array.from(r.entries()).forEach(([i,s])=>{c.set(this._attributesProcessor.process(i),s)}),this._deltaMetricStorage.batchCumulate(c,o)}collect(r,o){let c=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(r,this._instrumentDescriptor,c,o)}}});function Io(a,r){let o="";return a.unit!==r.unit&&(o+=` - Unit '${a.unit}' does not match '${r.unit}'
3
+ import{a as is}from"./chunk-757YRULG.js";import{A as Bn,E as Le,F as os,c as Vn,f as ct,g as Tt,h as Ki,j as qi,k as Ce,l as $i,m as Dl,n as ji,o as Wi,p as Ji,q as zi,t as rs,y as ns,z as wl}from"./chunk-UJTKZHZU.js";import{i as Ll,j as ki,k as Me,m as Gi,n as Bi,o as Hi,q as z,r as Fi,u as Yi}from"./chunk-ZTRGPIW7.js";import{a as H,b as Xi,c as Ie,d as Qi,e as Zi,f as q,g as ts,h as es,i as Jt,j as S,k as kn,l as Ue,m as Gn,n as X,o as O}from"./chunk-TW627LH5.js";import{a as K,b as _,c as x,d as St,e as L,f as v}from"./chunk-AUPVVLD3.js";var R,Be=_(()=>{"use strict";(function(a){a[a.DELTA=0]="DELTA",a[a.CUMULATIVE=1]="CUMULATIVE"})(R||(R={}))});var h,P,et=_(()=>{"use strict";(function(a){a.COUNTER="COUNTER",a.GAUGE="GAUGE",a.HISTOGRAM="HISTOGRAM",a.UP_DOWN_COUNTER="UP_DOWN_COUNTER",a.OBSERVABLE_COUNTER="OBSERVABLE_COUNTER",a.OBSERVABLE_GAUGE="OBSERVABLE_GAUGE",a.OBSERVABLE_UP_DOWN_COUNTER="OBSERVABLE_UP_DOWN_COUNTER"})(h||(h={}));(function(a){a[a.HISTOGRAM=0]="HISTOGRAM",a[a.EXPONENTIAL_HISTOGRAM=1]="EXPONENTIAL_HISTOGRAM",a[a.GAUGE=2]="GAUGE",a[a.SUM=3]="SUM"})(P||(P={}))});function ls(a){return a!=null}function He(a){let r=Object.keys(a);return r.length===0?"":(r=r.sort(),JSON.stringify(r.map(o=>[o,a[o]])))}function ps(a){return`${a.name}:${a.version??""}:${a.schemaUrl??""}`}function rt(a,r){let o,c=new Promise(function(s,e){o=setTimeout(function(){e(new ut("Operation timed out."))},r)});return Promise.race([a,c]).then(i=>(clearTimeout(o),i),i=>{throw clearTimeout(o),i})}async function fs(a){return Promise.all(a.map(async r=>{try{return{status:"fulfilled",value:await r}}catch(o){return{status:"rejected",reason:o}}}))}function ds(a){return a.status==="rejected"}function Yn(a,r){let o=[];return a.forEach(c=>{o.push(...r(c))}),o}function ms(a,r){if(a.size!==r.size)return!1;for(let o of a)if(!r.has(o))return!1;return!0}function _s(a,r){let o=0,c=a.length-1,i=a.length;for(;c>=o;){let s=o+Math.trunc((c-o)/2);a[s]<r?o=s+1:(i=s,c=s-1)}return i}function Es(a,r){return a.toLowerCase()===r.toLowerCase()}var ut,F=_(()=>{"use strict";ut=class a extends Error{constructor(r){super(r),Object.setPrototypeOf(this,a.prototype)}}});var D,ht=_(()=>{"use strict";(function(a){a[a.DROP=0]="DROP",a[a.SUM=1]="SUM",a[a.LAST_VALUE=2]="LAST_VALUE",a[a.HISTOGRAM=3]="HISTOGRAM",a[a.EXPONENTIAL_HISTOGRAM=4]="EXPONENTIAL_HISTOGRAM"})(D||(D={}))});var Xt,Ss=_(()=>{"use strict";ht();Xt=class{kind=D.DROP;createAccumulation(){}merge(r,o){}diff(r,o){}toMetricData(r,o,c,i){}}});function Hl(a){let r=a.map(()=>0);return r.push(0),{buckets:{boundaries:a,counts:r},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}var yt,At,Ts=_(()=>{"use strict";ht();et();F();yt=class{startTime;_boundaries;_recordMinMax;_current;constructor(r,o,c=!0,i=Hl(o)){this.startTime=r,this._boundaries=o,this._recordMinMax=c,this._current=i}record(r){if(Number.isNaN(r))return;this._current.count+=1,this._current.sum+=r,this._recordMinMax&&(this._current.min=Math.min(r,this._current.min),this._current.max=Math.max(r,this._current.max),this._current.hasMinMax=!0);let o=_s(this._boundaries,r);this._current.buckets.counts[o]+=1}setStartTime(r){this.startTime=r}toPointValue(){return this._current}},At=class{_boundaries;_recordMinMax;kind=D.HISTOGRAM;constructor(r,o){this._boundaries=r,this._recordMinMax=o}createAccumulation(r){return new yt(r,this._boundaries,this._recordMinMax)}merge(r,o){let c=r.toPointValue(),i=o.toPointValue(),s=c.buckets.counts,e=i.buckets.counts,t=new Array(s.length);for(let l=0;l<s.length;l++)t[l]=s[l]+e[l];let n=1/0,u=-1/0;return this._recordMinMax&&(c.hasMinMax&&i.hasMinMax?(n=Math.min(c.min,i.min),u=Math.max(c.max,i.max)):c.hasMinMax?(n=c.min,u=c.max):i.hasMinMax&&(n=i.min,u=i.max)),new yt(r.startTime,c.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:c.buckets.boundaries,counts:t},count:c.count+i.count,sum:c.sum+i.sum,hasMinMax:this._recordMinMax&&(c.hasMinMax||i.hasMinMax),min:n,max:u})}diff(r,o){let c=r.toPointValue(),i=o.toPointValue(),s=c.buckets.counts,e=i.buckets.counts,t=new Array(s.length);for(let n=0;n<s.length;n++)t[n]=e[n]-s[n];return new yt(o.startTime,c.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:c.buckets.boundaries,counts:t},count:i.count-c.count,sum:i.sum-c.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(r,o,c,i){return{descriptor:r,aggregationTemporality:o,dataPointType:P.HISTOGRAM,dataPoints:c.map(([s,e])=>{let t=e.toPointValue(),n=r.type===h.GAUGE||r.type===h.UP_DOWN_COUNTER||r.type===h.OBSERVABLE_GAUGE||r.type===h.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:s,startTime:e.startTime,endTime:i,value:{min:t.hasMinMax?t.min:void 0,max:t.hasMinMax?t.max:void 0,sum:n?void 0:t.sum,buckets:t.buckets,count:t.count}}})}}}});var Qt,Kn,hs=_(()=>{"use strict";Qt=class a{backing;indexBase;indexStart;indexEnd;constructor(r=new Kn,o=0,c=0,i=0){this.backing=r,this.indexBase=o,this.indexStart=c,this.indexEnd=i}get offset(){return this.indexStart}get length(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(r,o)=>this.at(o))}at(r){let o=this.indexBase-this.indexStart;return r<o&&(r+=this.backing.length),r-=o,this.backing.countAt(r)}incrementBucket(r,o){this.backing.increment(r,o)}decrementBucket(r,o){this.backing.decrement(r,o)}trim(){for(let r=0;r<this.length;r++)if(this.at(r)!==0){this.indexStart+=r;break}else if(r===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(let r=this.length-1;r>=0;r--)if(this.at(r)!==0){this.indexEnd-=this.length-r-1;break}this._rotate()}downscale(r){this._rotate();let o=1+this.indexEnd-this.indexStart,c=1<<r,i=0,s=0;for(let e=this.indexStart;e<=this.indexEnd;){let t=e%c;t<0&&(t+=c);for(let n=t;n<c&&i<o;n++)this._relocateBucket(s,i),i++,e++;s++}this.indexStart>>=r,this.indexEnd>>=r,this.indexBase=this.indexStart}clone(){return new a(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){let r=this.indexBase-this.indexStart;r!==0&&(r>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,r),this.backing.reverse(r,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+r)),this.indexBase=this.indexStart)}_relocateBucket(r,o){r!==o&&this.incrementBucket(r,this.backing.emptyBucket(o))}},Kn=class a{_counts;constructor(r=[0]){this._counts=r}get length(){return this._counts.length}countAt(r){return this._counts[r]}growTo(r,o,c){let i=new Array(r).fill(0);i.splice(c,this._counts.length-o,...this._counts.slice(o)),i.splice(0,o,...this._counts.slice(0,o)),this._counts=i}reverse(r,o){let c=Math.floor((r+o)/2)-r;for(let i=0;i<c;i++){let s=this._counts[r+i];this._counts[r+i]=this._counts[o-i-1],this._counts[o-i-1]=s}}emptyBucket(r){let o=this._counts[r];return this._counts[r]=0,o}increment(r,o){this._counts[r]+=o}decrement(r,o){this._counts[r]>=o?this._counts[r]-=o:this._counts[r]=0}clone(){return new a([...this._counts])}}});function Fe(a){let r=new DataView(new ArrayBuffer(8));return r.setFloat64(0,a),((r.getUint32(0)&2146435072)>>20)-1023}function Ye(a){let r=new DataView(new ArrayBuffer(8));r.setFloat64(0,a);let o=r.getUint32(0),c=r.getUint32(4);return(o&1048575)*Math.pow(2,32)+c}var Zt,qn=_(()=>{"use strict";Zt=Math.pow(2,-1022)});function te(a,r){return a===0||a===Number.POSITIVE_INFINITY||a===Number.NEGATIVE_INFINITY||Number.isNaN(a)?a:a*Math.pow(2,r)}function As(a){return a--,a|=a>>1,a|=a>>2,a|=a>>4,a|=a>>8,a|=a>>16,a++,a}var Ke=_(()=>{"use strict"});var j,qe=_(()=>{"use strict";j=class extends Error{}});var $e,Ns=_(()=>{"use strict";qn();Ke();qe();$e=class{_shift;constructor(r){this._shift=-r}mapToIndex(r){if(r<Zt)return this._minNormalLowerBoundaryIndex();let o=Fe(r),c=this._rightShift(Ye(r)-1,52);return o+c>>this._shift}lowerBoundary(r){let o=this._minNormalLowerBoundaryIndex();if(r<o)throw new j(`underflow: ${r} is < minimum lower boundary: ${o}`);let c=this._maxNormalLowerBoundaryIndex();if(r>c)throw new j(`overflow: ${r} is > maximum lower boundary: ${c}`);return te(1,r<<this._shift)}get scale(){return this._shift===0?0:-this._shift}_minNormalLowerBoundaryIndex(){let r=-1022>>this._shift;return this._shift<2&&r--,r}_maxNormalLowerBoundaryIndex(){return 1023>>this._shift}_rightShift(r,o){return Math.floor(r*Math.pow(2,-o))}}});var je,xs=_(()=>{"use strict";qn();Ke();qe();je=class{_scale;_scaleFactor;_inverseFactor;constructor(r){this._scale=r,this._scaleFactor=te(Math.LOG2E,r),this._inverseFactor=te(Math.LN2,-r)}mapToIndex(r){if(r<=Zt)return this._minNormalLowerBoundaryIndex()-1;if(Ye(r)===0)return(Fe(r)<<this._scale)-1;let o=Math.floor(Math.log(r)*this._scaleFactor),c=this._maxNormalLowerBoundaryIndex();return o>=c?c:o}lowerBoundary(r){let o=this._maxNormalLowerBoundaryIndex();if(r>=o){if(r===o)return 2*Math.exp((r-(1<<this._scale))/this._scaleFactor);throw new j(`overflow: ${r} is > maximum lower boundary: ${o}`)}let c=this._minNormalLowerBoundaryIndex();if(r<=c){if(r===c)return Zt;if(r===c-1)return Math.exp((r+(1<<this._scale))/this._scaleFactor)/2;throw new j(`overflow: ${r} is < minimum lower boundary: ${c}`)}return Math.exp(r*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return-1022<<this._scale}_maxNormalLowerBoundaryIndex(){return(1024<<this._scale)-1}}});function Wn(a){if(a>Rs||a<gs)throw new j(`expected scale >= ${gs} && <= ${Rs}, got: ${a}`);return Yl[a+10]}var gs,Rs,Yl,Ps=_(()=>{"use strict";Ns();xs();qe();gs=-10,Rs=20,Yl=Array.from({length:31},(a,r)=>r>10?new je(r-10):new $e(r-10))});var Ot,Kl,ql,Jn,We,ee,bs=_(()=>{"use strict";ht();et();O();hs();Ps();Ke();Ot=class a{low;high;static combine(r,o){return new a(Math.min(r.low,o.low),Math.max(r.high,o.high))}constructor(r,o){this.low=r,this.high=o}},Kl=20,ql=160,Jn=2,We=class a{startTime;_maxSize;_recordMinMax;_sum;_count;_zeroCount;_min;_max;_positive;_negative;_mapping;constructor(r,o=ql,c=!0,i=0,s=0,e=0,t=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY,u=new Qt,l=new Qt,d=Wn(Kl)){this.startTime=r,this._maxSize=o,this._recordMinMax=c,this._sum=i,this._count=s,this._zeroCount=e,this._min=t,this._max=n,this._positive=u,this._negative=l,this._mapping=d,this._maxSize<Jn&&(S.warn(`Exponential Histogram Max Size set to ${this._maxSize}, changing to the minimum size of: ${Jn}`),this._maxSize=Jn)}record(r){this.updateByIncrement(r,1)}setStartTime(r){this.startTime=r}toPointValue(){return{hasMinMax:this._recordMinMax,min:this.min,max:this.max,sum:this.sum,positive:{offset:this.positive.offset,bucketCounts:this.positive.counts()},negative:{offset:this.negative.offset,bucketCounts:this.negative.counts()},count:this.count,scale:this.scale,zeroCount:this.zeroCount}}get sum(){return this._sum}get min(){return this._min}get max(){return this._max}get count(){return this._count}get zeroCount(){return this._zeroCount}get scale(){return this._count===this._zeroCount?0:this._mapping.scale}get positive(){return this._positive}get negative(){return this._negative}updateByIncrement(r,o){if(!Number.isNaN(r)){if(r>this._max&&(this._max=r),r<this._min&&(this._min=r),this._count+=o,r===0){this._zeroCount+=o;return}this._sum+=r*o,r>0?this._updateBuckets(this._positive,r,o):this._updateBuckets(this._negative,-r,o)}}merge(r){this._count===0?(this._min=r.min,this._max=r.max):r.count!==0&&(r.min<this.min&&(this._min=r.min),r.max>this.max&&(this._max=r.max)),this.startTime=r.startTime,this._sum+=r.sum,this._count+=r.count,this._zeroCount+=r.zeroCount;let o=this._minScale(r);this._downscale(this.scale-o),this._mergeBuckets(this.positive,r,r.positive,o),this._mergeBuckets(this.negative,r,r.negative,o)}diff(r){this._min=1/0,this._max=-1/0,this._sum-=r.sum,this._count-=r.count,this._zeroCount-=r.zeroCount;let o=this._minScale(r);this._downscale(this.scale-o),this._diffBuckets(this.positive,r,r.positive,o),this._diffBuckets(this.negative,r,r.negative,o)}clone(){return new a(this.startTime,this._maxSize,this._recordMinMax,this._sum,this._count,this._zeroCount,this._min,this._max,this.positive.clone(),this.negative.clone(),this._mapping)}_updateBuckets(r,o,c){let i=this._mapping.mapToIndex(o),s=!1,e=0,t=0;if(r.length===0?(r.indexStart=i,r.indexEnd=r.indexStart,r.indexBase=r.indexStart):i<r.indexStart&&r.indexEnd-i>=this._maxSize?(s=!0,t=i,e=r.indexEnd):i>r.indexEnd&&i-r.indexStart>=this._maxSize&&(s=!0,t=r.indexStart,e=i),s){let n=this._changeScale(e,t);this._downscale(n),i=this._mapping.mapToIndex(o)}this._incrementIndexBy(r,i,c)}_incrementIndexBy(r,o,c){if(c===0)return;if(r.length===0&&(r.indexStart=r.indexEnd=r.indexBase=o),o<r.indexStart){let s=r.indexEnd-o;s>=r.backing.length&&this._grow(r,s+1),r.indexStart=o}else if(o>r.indexEnd){let s=o-r.indexStart;s>=r.backing.length&&this._grow(r,s+1),r.indexEnd=o}let i=o-r.indexBase;i<0&&(i+=r.backing.length),r.incrementBucket(i,c)}_grow(r,o){let c=r.backing.length,i=r.indexBase-r.indexStart,s=c-i,e=As(o);e>this._maxSize&&(e=this._maxSize);let t=e-i;r.backing.growTo(e,s,t)}_changeScale(r,o){let c=0;for(;r-o>=this._maxSize;)r>>=1,o>>=1,c++;return c}_downscale(r){if(r===0)return;if(r<0)throw new Error(`impossible change of scale: ${this.scale}`);let o=this._mapping.scale-r;this._positive.downscale(r),this._negative.downscale(r),this._mapping=Wn(o)}_minScale(r){let o=Math.min(this.scale,r.scale),c=Ot.combine(this._highLowAtScale(this.positive,this.scale,o),this._highLowAtScale(r.positive,r.scale,o)),i=Ot.combine(this._highLowAtScale(this.negative,this.scale,o),this._highLowAtScale(r.negative,r.scale,o));return Math.min(o-this._changeScale(c.high,c.low),o-this._changeScale(i.high,i.low))}_highLowAtScale(r,o,c){if(r.length===0)return new Ot(0,-1);let i=o-c;return new Ot(r.indexStart>>i,r.indexEnd>>i)}_mergeBuckets(r,o,c,i){let s=c.offset,e=o.scale-i;for(let t=0;t<c.length;t++)this._incrementIndexBy(r,s+t>>e,c.at(t))}_diffBuckets(r,o,c,i){let s=c.offset,e=o.scale-i;for(let t=0;t<c.length;t++){let u=(s+t>>e)-r.indexBase;u<0&&(u+=r.backing.length),r.decrementBucket(u,c.at(t))}r.trim()}},ee=class{_maxSize;_recordMinMax;kind=D.EXPONENTIAL_HISTOGRAM;constructor(r,o){this._maxSize=r,this._recordMinMax=o}createAccumulation(r){return new We(r,this._maxSize,this._recordMinMax)}merge(r,o){let c=o.clone();return c.merge(r),c}diff(r,o){let c=o.clone();return c.diff(r),c}toMetricData(r,o,c,i){return{descriptor:r,aggregationTemporality:o,dataPointType:P.EXPONENTIAL_HISTOGRAM,dataPoints:c.map(([s,e])=>{let t=e.toPointValue(),n=r.type===h.GAUGE||r.type===h.UP_DOWN_COUNTER||r.type===h.OBSERVABLE_GAUGE||r.type===h.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:s,startTime:e.startTime,endTime:i,value:{min:t.hasMinMax?t.min:void 0,max:t.hasMinMax?t.max:void 0,sum:n?void 0:t.sum,positive:{offset:t.positive.offset,bucketCounts:t.positive.bucketCounts},negative:{offset:t.negative.offset,bucketCounts:t.negative.bucketCounts},count:t.count,scale:t.scale,zeroCount:t.zeroCount}}})}}}});function Je(a){return a.setValue(zn,!0)}function vs(a){return a.deleteValue(zn)}function Nt(a){return a.getValue(zn)===!0}var zn,re=_(()=>{"use strict";O();zn=Ie("OpenTelemetry SDK Context Key SUPPRESS_TRACING")});var Ms,ze,xt,Xe,Xn=_(()=>{"use strict";Ms="=",ze=";",xt=",",Xe="baggage"});function Cs(a){return a.reduce((r,o)=>{let c=`${r}${r!==""?xt:""}${o}`;return c.length>8192?r:c},"")}function Is(a){return a.getAllEntries().map(([r,o])=>{let c=`${encodeURIComponent(r)}=${encodeURIComponent(o.value)}`;return o.metadata!==void 0&&(c+=ze+o.metadata.toString()),c})}function Qn(a){let r=a.split(ze);if(r.length<=0)return;let o=r.shift();if(!o)return;let c=o.indexOf(Ms);if(c<=0)return;let i=decodeURIComponent(o.substring(0,c).trim()),s=decodeURIComponent(o.substring(c+1).trim()),e;return r.length>0&&(e=Xi(r.join(ze))),{key:i,value:s,metadata:e}}function lt(a){let r={};return typeof a=="string"&&a.length>0&&a.split(xt).forEach(o=>{let c=Qn(o);c!==void 0&&c.value.length>0&&(r[c.key]=c.value)}),r}var Zn=_(()=>{"use strict";O();Xn()});var Qe,Us=_(()=>{"use strict";O();re();Xn();Zn();Qe=class{inject(r,o,c){let i=Ue.getBaggage(r);if(!i||Nt(r))return;let s=Is(i).filter(t=>t.length<=4096).slice(0,180),e=Cs(s);e.length>0&&c.set(o,Xe,e)}extract(r,o,c){let i=c.get(o,Xe),s=Array.isArray(i)?i.join(xt):i;if(!s)return r;let e={};return s.length===0||(s.split(xt).forEach(n=>{let u=Qn(n);if(u){let l={value:u.value};u.metadata&&(l.metadata=u.metadata),e[u.key]=l}}),Object.entries(e).length===0)?r:Ue.setBaggage(r,Ue.createBaggage(e))}fields(){return[Xe]}}});var Ze,Ls=_(()=>{"use strict";Ze=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(r,o){this._monotonicClock=o,this._epochMillis=r.now(),this._performanceMillis=o.now()}now(){let r=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+r}}});function Ds(a){let r={};if(typeof a!="object"||a==null)return r;for(let[o,c]of Object.entries(a)){if(!Jl(o)){S.warn(`Invalid attribute key: ${o}`);continue}if(!to(c)){S.warn(`Invalid attribute value set for key: ${o}`);continue}Array.isArray(c)?r[o]=c.slice():r[o]=c}return r}function Jl(a){return typeof a=="string"&&a.length>0}function to(a){return a==null?!0:Array.isArray(a)?zl(a):ws(a)}function zl(a){let r;for(let o of a)if(o!=null){if(!r){if(ws(o)){r=typeof o;continue}return!1}if(typeof o!==r)return!1}return!0}function ws(a){switch(typeof a){case"number":case"boolean":case"string":return!0}return!1}var Vs=_(()=>{"use strict";O()});function tr(){return a=>{S.error(Xl(a))}}function Xl(a){return typeof a=="string"?a:JSON.stringify(Ql(a))}function Ql(a){let r={},o=a;for(;o!==null;)Object.getOwnPropertyNames(o).forEach(c=>{if(r[c])return;let i=o[c];i&&(r[c]=String(i))}),o=Object.getPrototypeOf(o);return r}var eo=_(()=>{"use strict";O()});function Gs(a){ks=a}function ne(a){try{ks(a)}catch{}}var ks,Bs=_(()=>{"use strict";eo();ks=tr()});import{inspect as Hs}from"util";function er(a){let r=process.env[a];if(r==null||r.trim()==="")return;let o=Number(r);if(isNaN(o)){S.warn(`Unknown value ${Hs(r)} for ${a}, expected a number, using defaults`);return}return o}function w(a){let r=process.env[a];if(!(r==null||r.trim()===""))return r}function rr(a){let r=process.env[a]?.trim().toLowerCase();return r==null||r===""?!1:r==="true"?!0:(r==="false"||S.warn(`Unknown value ${Hs(r)} for ${a}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}function nr(a){return w(a)?.split(",").map(r=>r.trim()).filter(r=>r!=="")}var Fs=_(()=>{"use strict";O()});var or,Ys=_(()=>{"use strict";or=typeof globalThis=="object"?globalThis:global});import{performance as Zl}from"perf_hooks";var nt,Ks=_(()=>{"use strict";nt=Zl});var qs,$s=_(()=>{"use strict";qs="2.1.0"});var js=_(()=>{"use strict"});var Ws=_(()=>{"use strict";js()});var Js=_(()=>{"use strict"});var zs=_(()=>{"use strict";Js()});var Xs,oe,Qs,ie,se,Zs=_(()=>{"use strict";Xs="service.name",oe="telemetry.sdk.language",Qs="nodejs",ie="telemetry.sdk.name",se="telemetry.sdk.version"});var ta=_(()=>{"use strict"});var ea=_(()=>{"use strict"});var ro=_(()=>{"use strict";Ws();zs();Zs();ta();ea()});var ra,na=_(()=>{"use strict";ra="process.runtime.name"});var ot,oa=_(()=>{"use strict";$s();ro();na();ot={[ie]:"opentelemetry",[ra]:"node",[oe]:Qs,[se]:qs}});function gt(a){a.unref()}var ia=_(()=>{"use strict"});var sa=_(()=>{"use strict";Fs();Ys();Ks();oa();ia()});var no=_(()=>{"use strict";sa()});function V(a){let r=a/1e3,o=Math.trunc(r),c=Math.round(a%1e3*ep);return[o,c]}function sr(){let a=nt.timeOrigin;if(typeof a!="number"){let r=nt;a=r.timing&&r.timing.fetchStart}return a}function oo(a){let r=V(sr()),o=V(typeof a=="number"?a:nt.now());return io(r,o)}function ca(a){if(cr(a))return a;if(typeof a=="number")return a<sr()?oo(a):V(a);if(a instanceof Date)return V(a.getTime());throw TypeError("Invalid input type")}function ua(a,r){let o=r[0]-a[0],c=r[1]-a[1];return c<0&&(o-=1,c+=ir),[o,c]}function la(a){let r=aa,o=`${"0".repeat(r)}${a[1]}Z`,c=o.substring(o.length-r-1);return new Date(a[0]*1e3).toISOString().replace("000Z",c)}function ar(a){return a[0]*ir+a[1]}function pa(a){return a[0]*1e3+a[1]/1e6}function pt(a){return a[0]*1e6+a[1]/1e3}function cr(a){return Array.isArray(a)&&a.length===2&&typeof a[0]=="number"&&typeof a[1]=="number"}function fa(a){return cr(a)||typeof a=="number"||a instanceof Date}function io(a,r){let o=[a[0]+r[0],a[1]+r[1]];return o[1]>=ir&&(o[1]-=ir,o[0]+=1),o}var aa,tp,ep,ir,da=_(()=>{"use strict";no();aa=9,tp=6,ep=Math.pow(10,tp),ir=Math.pow(10,aa)});var g,ma=_(()=>{"use strict";(function(a){a[a.SUCCESS=0]="SUCCESS",a[a.FAILED=1]="FAILED"})(g||(g={}))});var ur,_a=_(()=>{"use strict";O();ur=class{_propagators;_fields;constructor(r={}){this._propagators=r.propagators??[],this._fields=Array.from(new Set(this._propagators.map(o=>typeof o.fields=="function"?o.fields():[]).reduce((o,c)=>o.concat(c),[])))}inject(r,o,c){for(let i of this._propagators)try{i.inject(r,o,c)}catch(s){S.warn(`Failed to inject with ${i.constructor.name}. Err: ${s.message}`)}}extract(r,o,c){return this._propagators.reduce((i,s)=>{try{return s.extract(i,o,c)}catch(e){S.warn(`Failed to extract with ${s.constructor.name}. Err: ${e.message}`)}return i},r)}fields(){return this._fields.slice()}}});function Ea(a){return op.test(a)}function Sa(a){return ip.test(a)&&!sp.test(a)}var so,rp,np,op,ip,sp,Ta=_(()=>{"use strict";so="[_0-9a-z-*/]",rp=`[a-z]${so}{0,255}`,np=`[a-z0-9]${so}{0,240}@[a-z]${so}{0,13}`,op=new RegExp(`^(?:${rp}|${np})$`),ip=/^[ -~]{0,255}[!-~]$/,sp=/,|=/});var ha,ap,ya,Aa,Rt,ao=_(()=>{"use strict";Ta();ha=32,ap=512,ya=",",Aa="=",Rt=class a{_internalState=new Map;constructor(r){r&&this._parse(r)}set(r,o){let c=this._clone();return c._internalState.has(r)&&c._internalState.delete(r),c._internalState.set(r,o),c}unset(r){let o=this._clone();return o._internalState.delete(r),o}get(r){return this._internalState.get(r)}serialize(){return this._keys().reduce((r,o)=>(r.push(o+Aa+this.get(o)),r),[]).join(ya)}_parse(r){r.length>ap||(this._internalState=r.split(ya).reverse().reduce((o,c)=>{let i=c.trim(),s=i.indexOf(Aa);if(s!==-1){let e=i.slice(0,s),t=i.slice(s+1,c.length);Ea(e)&&Sa(t)&&o.set(e,t)}return o},new Map),this._internalState.size>ha&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,ha))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let r=new a;return r._internalState=new Map(this._internalState),r}}});function co(a){let r=dp.exec(a);return!r||r[1]==="00"&&r[5]?null:{traceId:r[2],spanId:r[3],traceFlags:parseInt(r[4],16)}}var ae,ce,cp,up,lp,pp,fp,dp,lr,Oa=_(()=>{"use strict";O();re();ao();ae="traceparent",ce="tracestate",cp="00",up="(?!ff)[\\da-f]{2}",lp="(?![0]{32})[\\da-f]{32}",pp="(?![0]{16})[\\da-f]{16}",fp="[\\da-f]{2}",dp=new RegExp(`^\\s?(${up})-(${lp})-(${pp})-(${fp})(-.*)?\\s?$`);lr=class{inject(r,o,c){let i=Gn.getSpanContext(r);if(!i||Nt(r)||!es(i))return;let s=`${cp}-${i.traceId}-${i.spanId}-0${Number(i.traceFlags||ts.NONE).toString(16)}`;c.set(o,ae,s),i.traceState&&c.set(o,ce,i.traceState.serialize())}extract(r,o,c){let i=c.get(o,ae);if(!i)return r;let s=Array.isArray(i)?i[0]:i;if(typeof s!="string")return r;let e=co(s);if(!e)return r;e.isRemote=!0;let t=c.get(o,ce);if(t){let n=Array.isArray(t)?t.join(","):t;e.traceState=new Rt(typeof n=="string"?n:void 0)}return Gn.setSpanContext(r,e)}fields(){return[ae,ce]}}});function Na(a,r){return a.setValue(uo,r)}function xa(a){return a.deleteValue(uo)}function ga(a){return a.getValue(uo)}var uo,pr,Ra=_(()=>{"use strict";O();uo=Ie("OpenTelemetry SDK Context Key RPC_METADATA");(function(a){a.HTTP="http"})(pr||(pr={}))});function lo(a){if(!yp(a)||Ap(a)!==mp)return!1;let r=hp(a);if(r===null)return!0;let o=va.call(r,"constructor")&&r.constructor;return typeof o=="function"&&o instanceof o&&Pa.call(o)===Tp}function yp(a){return a!=null&&typeof a=="object"}function Ap(a){return a==null?a===void 0?Ep:_p:ft&&ft in Object(a)?Op(a):Np(a)}function Op(a){let r=va.call(a,ft),o=a[ft],c=!1;try{a[ft]=void 0,c=!0}catch{}let i=Ma.call(a);return c&&(r?a[ft]=o:delete a[ft]),i}function Np(a){return Ma.call(a)}var mp,_p,Ep,Sp,Pa,Tp,hp,ba,va,ft,Ma,Ca=_(()=>{"use strict";mp="[object Object]",_p="[object Null]",Ep="[object Undefined]",Sp=Function.prototype,Pa=Sp.toString,Tp=Pa.call(Object),hp=Object.getPrototypeOf,ba=Object.prototype,va=ba.hasOwnProperty,ft=Symbol?Symbol.toStringTag:void 0,Ma=ba.toString});function Ua(...a){let r=a.shift(),o=new WeakMap;for(;a.length>0;)r=La(r,a.shift(),0,o);return r}function po(a){return dr(a)?a.slice():a}function La(a,r,o=0,c){let i;if(!(o>xp)){if(o++,fr(a)||fr(r)||Da(r))i=po(r);else if(dr(a)){if(i=a.slice(),dr(r))for(let s=0,e=r.length;s<e;s++)i.push(po(r[s]));else if(ue(r)){let s=Object.keys(r);for(let e=0,t=s.length;e<t;e++){let n=s[e];i[n]=po(r[n])}}}else if(ue(a))if(ue(r)){if(!gp(a,r))return r;i=Object.assign({},a);let s=Object.keys(r);for(let e=0,t=s.length;e<t;e++){let n=s[e],u=r[n];if(fr(u))typeof u>"u"?delete i[n]:i[n]=u;else{let l=i[n],d=u;if(Ia(a,n,c)||Ia(r,n,c))delete i[n];else{if(ue(l)&&ue(d)){let E=c.get(l)||[],A=c.get(d)||[];E.push({obj:a,key:n}),A.push({obj:r,key:n}),c.set(l,E),c.set(d,A)}i[n]=La(i[n],u,o,c)}}}}else i=r;return i}}function Ia(a,r,o){let c=o.get(a[r])||[];for(let i=0,s=c.length;i<s;i++){let e=c[i];if(e.key===r&&e.obj===a)return!0}return!1}function dr(a){return Array.isArray(a)}function Da(a){return typeof a=="function"}function ue(a){return!fr(a)&&!dr(a)&&!Da(a)&&typeof a=="object"}function fr(a){return typeof a=="string"||typeof a=="number"||typeof a=="boolean"||typeof a>"u"||a instanceof Date||a instanceof RegExp||a===null}function gp(a,r){return!(!lo(a)||!lo(r))}var xp,wa=_(()=>{"use strict";Ca();xp=20});function Va(a,r){let o,c=new Promise(function(s,e){o=setTimeout(function(){e(new le("Operation timed out."))},r)});return Promise.race([a,c]).then(i=>(clearTimeout(o),i),i=>{throw clearTimeout(o),i})}var le,ka=_(()=>{"use strict";le=class a extends Error{constructor(r){super(r),Object.setPrototypeOf(this,a.prototype)}}});function fo(a,r){return typeof r=="string"?a===r:!!a.match(r)}function Ga(a,r){if(!r)return!1;for(let o of r)if(fo(a,o))return!0;return!1}var Ba=_(()=>{"use strict"});var mr,Ha=_(()=>{"use strict";mr=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((r,o)=>{this._resolve=r,this._reject=o})}get promise(){return this._promise}resolve(r){this._resolve(r)}reject(r){this._reject(r)}}});var _r,Fa=_(()=>{"use strict";Ha();_r=class{_callback;_that;_isCalled=!1;_deferred=new mr;constructor(r,o){this._callback=r,this._that=o}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...r){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...r)).then(o=>this._deferred.resolve(o),o=>this._deferred.reject(o))}catch(o){this._deferred.reject(o)}}return this._deferred.promise}}});function Ka(a){if(a==null)return;let r=Ya[a.toUpperCase()];return r??(S.warn(`Unknown log level "${a}", expected one of ${Object.keys(Ya)}, using default`),H.INFO)}var Ya,qa=_(()=>{"use strict";O();Ya={ALL:H.ALL,VERBOSE:H.VERBOSE,DEBUG:H.DEBUG,INFO:H.INFO,WARN:H.WARN,ERROR:H.ERROR,NONE:H.NONE}});function $a(a,r){return new Promise(o=>{Jt.with(Je(Jt.active()),()=>{a.export(r,c=>{o(c)})})})}var ja=_(()=>{"use strict";O();re()});var Er={};St(Er,{AnchoredClock:()=>Ze,BindOnceFuture:()=>_r,CompositePropagator:()=>ur,ExportResultCode:()=>g,RPCType:()=>pr,SDK_INFO:()=>ot,TRACE_PARENT_HEADER:()=>ae,TRACE_STATE_HEADER:()=>ce,TimeoutError:()=>le,TraceState:()=>Rt,W3CBaggagePropagator:()=>Qe,W3CTraceContextPropagator:()=>lr,_globalThis:()=>or,addHrTimes:()=>io,callWithTimeout:()=>Va,deleteRPCMetadata:()=>xa,diagLogLevelFromString:()=>Ka,getBooleanFromEnv:()=>rr,getNumberFromEnv:()=>er,getRPCMetadata:()=>ga,getStringFromEnv:()=>w,getStringListFromEnv:()=>nr,getTimeOrigin:()=>sr,globalErrorHandler:()=>ne,hrTime:()=>oo,hrTimeDuration:()=>ua,hrTimeToMicroseconds:()=>pt,hrTimeToMilliseconds:()=>pa,hrTimeToNanoseconds:()=>ar,hrTimeToTimeStamp:()=>la,internal:()=>mo,isAttributeValue:()=>to,isTimeInput:()=>fa,isTimeInputHrTime:()=>cr,isTracingSuppressed:()=>Nt,isUrlIgnored:()=>Ga,loggingErrorHandler:()=>tr,merge:()=>Ua,millisToHrTime:()=>V,otperformance:()=>nt,parseKeyPairsIntoRecord:()=>lt,parseTraceParent:()=>co,sanitizeAttributes:()=>Ds,setGlobalErrorHandler:()=>Gs,setRPCMetadata:()=>Na,suppressTracing:()=>Je,timeInputToHrTime:()=>ca,unrefTimer:()=>gt,unsuppressTracing:()=>vs,urlMatches:()=>fo});var mo,M=_(()=>{"use strict";Us();Ls();Vs();Bs();eo();da();ma();Zn();no();_a();Oa();Ra();re();ao();wa();ka();Ba();Fa();qa();ja();mo={_export:$a}});var Pt,pe,Wa=_(()=>{"use strict";ht();M();et();Pt=class{startTime;_current;sampleTime;constructor(r,o=0,c=[0,0]){this.startTime=r,this._current=o,this.sampleTime=c}record(r){this._current=r,this.sampleTime=V(Date.now())}setStartTime(r){this.startTime=r}toPointValue(){return this._current}},pe=class{kind=D.LAST_VALUE;createAccumulation(r){return new Pt(r)}merge(r,o){let c=pt(o.sampleTime)>=pt(r.sampleTime)?o:r;return new Pt(r.startTime,c.toPointValue(),c.sampleTime)}diff(r,o){let c=pt(o.sampleTime)>=pt(r.sampleTime)?o:r;return new Pt(o.startTime,c.toPointValue(),c.sampleTime)}toMetricData(r,o,c,i){return{descriptor:r,aggregationTemporality:o,dataPointType:P.GAUGE,dataPoints:c.map(([s,e])=>({attributes:s,startTime:e.startTime,endTime:i,value:e.toPointValue()}))}}}});var it,bt,Ja=_(()=>{"use strict";ht();et();it=class{startTime;monotonic;_current;reset;constructor(r,o,c=0,i=!1){this.startTime=r,this.monotonic=o,this._current=c,this.reset=i}record(r){this.monotonic&&r<0||(this._current+=r)}setStartTime(r){this.startTime=r}toPointValue(){return this._current}},bt=class{monotonic;kind=D.SUM;constructor(r){this.monotonic=r}createAccumulation(r){return new it(r,this.monotonic)}merge(r,o){let c=r.toPointValue(),i=o.toPointValue();return o.reset?new it(o.startTime,this.monotonic,i,o.reset):new it(r.startTime,this.monotonic,c+i)}diff(r,o){let c=r.toPointValue(),i=o.toPointValue();return this.monotonic&&c>i?new it(o.startTime,this.monotonic,i,!0):new it(o.startTime,this.monotonic,i-c)}toMetricData(r,o,c,i){return{descriptor:r,aggregationTemporality:o,dataPointType:P.SUM,dataPoints:c.map(([s,e])=>({attributes:s,startTime:e.startTime,endTime:i,value:e.toPointValue()})),isMonotonic:this.monotonic}}}});var za=_(()=>{"use strict";Ss();Ts();bs();Wa();Ja()});var _o,Eo,So,To,fe,de,ho,yo,Ao,Oo,No,nS,Xa,Qa=_(()=>{"use strict";O();za();et();_o=class a{static DEFAULT_INSTANCE=new Xt;createAggregator(r){return a.DEFAULT_INSTANCE}},Eo=class a{static MONOTONIC_INSTANCE=new bt(!0);static NON_MONOTONIC_INSTANCE=new bt(!1);createAggregator(r){switch(r.type){case h.COUNTER:case h.OBSERVABLE_COUNTER:case h.HISTOGRAM:return a.MONOTONIC_INSTANCE;default:return a.NON_MONOTONIC_INSTANCE}}},So=class a{static DEFAULT_INSTANCE=new pe;createAggregator(r){return a.DEFAULT_INSTANCE}},To=class a{static DEFAULT_INSTANCE=new At([0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],!0);createAggregator(r){return a.DEFAULT_INSTANCE}},fe=class{_recordMinMax;_boundaries;constructor(r,o=!0){if(this._recordMinMax=o,r==null)throw new Error("ExplicitBucketHistogramAggregation should be created with explicit boundaries, if a single bucket histogram is required, please pass an empty array");r=r.concat(),r=r.sort((s,e)=>s-e);let c=r.lastIndexOf(-1/0),i=r.indexOf(1/0);i===-1&&(i=void 0),this._boundaries=r.slice(c+1,i)}createAggregator(r){return new At(this._boundaries,this._recordMinMax)}},de=class{_maxSize;_recordMinMax;constructor(r=160,o=!0){this._maxSize=r,this._recordMinMax=o}createAggregator(r){return new ee(this._maxSize,this._recordMinMax)}},ho=class{_resolve(r){switch(r.type){case h.COUNTER:case h.UP_DOWN_COUNTER:case h.OBSERVABLE_COUNTER:case h.OBSERVABLE_UP_DOWN_COUNTER:return Ao;case h.GAUGE:case h.OBSERVABLE_GAUGE:return Oo;case h.HISTOGRAM:return r.advice.explicitBucketBoundaries?new fe(r.advice.explicitBucketBoundaries):No}return S.warn(`Unable to recognize instrument type: ${r.type}`),yo}createAggregator(r){return this._resolve(r).createAggregator(r)}},yo=new _o,Ao=new Eo,Oo=new So,No=new To,nS=new de,Xa=new ho});function Sr(a){switch(a.type){case b.DEFAULT:return Xa;case b.DROP:return yo;case b.SUM:return Ao;case b.LAST_VALUE:return Oo;case b.EXPONENTIAL_HISTOGRAM:{let r=a;return new de(r.options?.maxSize,r.options?.recordMinMax)}case b.EXPLICIT_BUCKET_HISTOGRAM:{let r=a;return r.options==null?No:new fe(r.options?.boundaries,r.options?.recordMinMax)}default:throw new Error("Unsupported Aggregation")}}var b,me=_(()=>{"use strict";Qa();(function(a){a[a.DEFAULT=0]="DEFAULT",a[a.DROP=1]="DROP",a[a.SUM=2]="SUM",a[a.LAST_VALUE=3]="LAST_VALUE",a[a.EXPLICIT_BUCKET_HISTOGRAM=4]="EXPLICIT_BUCKET_HISTOGRAM",a[a.EXPONENTIAL_HISTOGRAM=5]="EXPONENTIAL_HISTOGRAM"})(b||(b={}))});var Za,Tr,xo=_(()=>{"use strict";Be();me();Za=a=>({type:b.DEFAULT}),Tr=a=>R.CUMULATIVE});var vt,go=_(()=>{"use strict";O();F();xo();vt=class{_shutdown=!1;_metricProducers;_sdkMetricProducer;_aggregationTemporalitySelector;_aggregationSelector;_cardinalitySelector;constructor(r){this._aggregationSelector=r?.aggregationSelector??Za,this._aggregationTemporalitySelector=r?.aggregationTemporalitySelector??Tr,this._metricProducers=r?.metricProducers??[],this._cardinalitySelector=r?.cardinalitySelector}setMetricProducer(r){if(this._sdkMetricProducer)throw new Error("MetricReader can not be bound to a MeterProvider again.");this._sdkMetricProducer=r,this.onInitialized()}selectAggregation(r){return this._aggregationSelector(r)}selectAggregationTemporality(r){return this._aggregationTemporalitySelector(r)}selectCardinalityLimit(r){return this._cardinalitySelector?this._cardinalitySelector(r):2e3}onInitialized(){}async collect(r){if(this._sdkMetricProducer===void 0)throw new Error("MetricReader is not bound to a MetricProducer");if(this._shutdown)throw new Error("MetricReader is shutdown");let[o,...c]=await Promise.all([this._sdkMetricProducer.collect({timeoutMillis:r?.timeoutMillis}),...this._metricProducers.map(t=>t.collect({timeoutMillis:r?.timeoutMillis}))]),i=o.errors.concat(Yn(c,t=>t.errors)),s=o.resourceMetrics.resource,e=o.resourceMetrics.scopeMetrics.concat(Yn(c,t=>t.resourceMetrics.scopeMetrics));return{resourceMetrics:{resource:s,scopeMetrics:e},errors:i}}async shutdown(r){if(this._shutdown){S.error("Cannot call shutdown twice.");return}r?.timeoutMillis==null?await this.onShutdown():await rt(this.onShutdown(),r.timeoutMillis),this._shutdown=!0}async forceFlush(r){if(this._shutdown){S.warn("Cannot forceFlush on already shutdown MetricReader.");return}if(r?.timeoutMillis==null){await this.onForceFlush();return}await rt(this.onForceFlush(),r.timeoutMillis)}}});var dt,tc=_(()=>{"use strict";O();M();go();F();dt=class extends vt{_interval;_exporter;_exportInterval;_exportTimeout;constructor(r){if(super({aggregationSelector:r.exporter.selectAggregation?.bind(r.exporter),aggregationTemporalitySelector:r.exporter.selectAggregationTemporality?.bind(r.exporter),metricProducers:r.metricProducers}),r.exportIntervalMillis!==void 0&&r.exportIntervalMillis<=0)throw Error("exportIntervalMillis must be greater than 0");if(r.exportTimeoutMillis!==void 0&&r.exportTimeoutMillis<=0)throw Error("exportTimeoutMillis must be greater than 0");if(r.exportTimeoutMillis!==void 0&&r.exportIntervalMillis!==void 0&&r.exportIntervalMillis<r.exportTimeoutMillis)throw Error("exportIntervalMillis must be greater than or equal to exportTimeoutMillis");this._exportInterval=r.exportIntervalMillis??6e4,this._exportTimeout=r.exportTimeoutMillis??3e4,this._exporter=r.exporter}async _runOnce(){try{await rt(this._doRun(),this._exportTimeout)}catch(r){if(r instanceof ut){S.error("Export took longer than %s milliseconds and timed out.",this._exportTimeout);return}ne(r)}}async _doRun(){let{resourceMetrics:r,errors:o}=await this.collect({timeoutMillis:this._exportTimeout});if(o.length>0&&S.error("PeriodicExportingMetricReader: metrics collection errors",...o),r.resource.asyncAttributesPending)try{await r.resource.waitForAsyncAttributes?.()}catch(i){S.debug("Error while resolving async portion of resource: ",i),ne(i)}if(r.scopeMetrics.length===0)return;let c=await mo._export(this._exporter,r);if(c.code!==g.SUCCESS)throw new Error(`PeriodicExportingMetricReader: metrics export failed (error ${c.error})`)}onInitialized(){this._interval=setInterval(()=>{this._runOnce()},this._exportInterval),gt(this._interval)}async onForceFlush(){await this._runOnce(),await this._exporter.forceFlush()}async onShutdown(){this._interval&&clearInterval(this._interval),await this.onForceFlush(),await this._exporter.shutdown()}}});var hr,ec=_(()=>{"use strict";M();hr=class{_shutdown=!1;_aggregationTemporality;_metrics=[];constructor(r){this._aggregationTemporality=r}export(r,o){if(this._shutdown){setTimeout(()=>o({code:g.FAILED}),0);return}this._metrics.push(r),setTimeout(()=>o({code:g.SUCCESS}),0)}getMetrics(){return this._metrics}forceFlush(){return Promise.resolve()}reset(){this._metrics=[]}selectAggregationTemporality(r){return this._aggregationTemporality}shutdown(){return this._shutdown=!0,Promise.resolve()}}});var yr,rc=_(()=>{"use strict";M();xo();yr=class a{_shutdown=!1;_temporalitySelector;constructor(r){this._temporalitySelector=r?.temporalitySelector??Tr}export(r,o){if(this._shutdown){setImmediate(o,{code:g.FAILED});return}return a._sendMetrics(r,o)}forceFlush(){return Promise.resolve()}selectAggregationTemporality(r){return this._temporalitySelector(r)}shutdown(){return this._shutdown=!0,Promise.resolve()}static _sendMetrics(r,o){for(let c of r.scopeMetrics)for(let i of c.metrics)console.dir({descriptor:i.descriptor,dataPointType:i.dataPointType,dataPoints:i.dataPoints},{depth:null});o({code:g.SUCCESS})}}});function Ar(){return`unknown_service:${process.argv0}`}var nc=_(()=>{"use strict"});var oc=_(()=>{"use strict";nc()});var ic=_(()=>{"use strict";oc()});var Mt,sc=_(()=>{"use strict";Mt=a=>a!==null&&typeof a=="object"&&typeof a.then=="function"});function cc(a,r){return Ro.FromAttributeList(Object.entries(a),r)}function Po(){return cc({[Xs]:Ar(),[oe]:ot[oe],[ie]:ot[ie],[se]:ot[se]})}function ac(a){return a.map(([r,o])=>Mt(o)?[r,o.catch(c=>{S.debug("promise rejection for resource attribute: %s - %s",r,c)})]:[r,o])}function Rp(a){if(typeof a=="string"||a===void 0)return a;S.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",a)}function Pp(a,r){let o=a?.schemaUrl,c=r?.schemaUrl,i=o===void 0||o==="",s=c===void 0||c==="";if(i)return c;if(s||o===c)return o;S.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',o,c)}var Ro,uc=_(()=>{"use strict";O();M();ro();ic();sc();Ro=class a{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(r,o){let c=new a({},o);return c._rawAttributes=ac(r),c._asyncAttributesPending=r.filter(([i,s])=>Mt(s)).length>0,c}constructor(r,o){let c=r.attributes??{};this._rawAttributes=Object.entries(c).map(([i,s])=>(Mt(s)&&(this._asyncAttributesPending=!0),[i,s])),this._rawAttributes=ac(this._rawAttributes),this._schemaUrl=Rp(o?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let r=0;r<this._rawAttributes.length;r++){let[o,c]=this._rawAttributes[r];this._rawAttributes[r]=[o,Mt(c)?await c:c]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&S.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;let r={};for(let[o,c]of this._rawAttributes){if(Mt(c)){S.debug(`Unsettled resource attribute ${o} skipped`);continue}c!=null&&(r[o]??=c)}return this._asyncAttributesPending||(this._memoizedAttributes=r),r}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(r){if(r==null)return this;let o=Pp(this,r),c=o?{schemaUrl:o}:void 0;return a.FromAttributeList([...r.getRawAttributes(),...this.getRawAttributes()],c)}}});var lc=_(()=>{"use strict";uc()});var Or,pc=_(()=>{"use strict";Or=class{_registeredViews=[];addView(r){this._registeredViews.push(r)}findViews(r,o){return this._registeredViews.filter(i=>this._matchInstrument(i.instrumentSelector,r)&&this._matchMeter(i.meterSelector,o))}_matchInstrument(r,o){return(r.getType()===void 0||o.type===r.getType())&&r.getNameFilter().match(o.name)&&r.getUnitFilter().match(o.unit)}_matchMeter(r,o){return r.getNameFilter().match(o.name)&&(o.version===void 0||r.getVersionFilter().match(o.version))&&(o.schemaUrl===void 0||r.getSchemaUrlFilter().match(o.schemaUrl))}}});function W(a,r,o){return vp(a)||S.warn(`Invalid metric name: "${a}". The metric name should be a ASCII string with a length no greater than 255 characters.`),{name:a,type:r,description:o?.description??"",unit:o?.unit??"",valueType:o?.valueType??q.DOUBLE,advice:o?.advice??{}}}function fc(a,r){return{name:a.name??r.name,description:a.description??r.description,type:r.type,unit:r.unit,valueType:r.valueType,advice:r.advice}}function dc(a,r){return Es(a.name,r.name)&&a.unit===r.unit&&a.type===r.type&&a.valueType===r.valueType}function vp(a){return a.match(bp)!=null}var bp,_e=_(()=>{"use strict";O();F();bp=/^[a-z][a-z0-9_.\-/]{0,254}$/i});function Ee(a){return a instanceof It}var Ct,Nr,xr,gr,Rr,It,Pr,br,vr,Mr=_(()=>{"use strict";O();M();Ct=class{_writableMetricStorage;_descriptor;constructor(r,o){this._writableMetricStorage=r,this._descriptor=o}_record(r,o={},c=Jt.active()){if(typeof r!="number"){S.warn(`non-number value provided to metric ${this._descriptor.name}: ${r}`);return}this._descriptor.valueType===q.INT&&!Number.isInteger(r)&&(S.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`),r=Math.trunc(r),!Number.isInteger(r))||this._writableMetricStorage.record(r,o,c,V(Date.now()))}},Nr=class extends Ct{add(r,o,c){this._record(r,o,c)}},xr=class extends Ct{add(r,o,c){if(r<0){S.warn(`negative value provided to counter ${this._descriptor.name}: ${r}`);return}this._record(r,o,c)}},gr=class extends Ct{record(r,o,c){this._record(r,o,c)}},Rr=class extends Ct{record(r,o,c){if(r<0){S.warn(`negative value provided to histogram ${this._descriptor.name}: ${r}`);return}this._record(r,o,c)}},It=class{_observableRegistry;_metricStorages;_descriptor;constructor(r,o,c){this._observableRegistry=c,this._descriptor=r,this._metricStorages=o}addCallback(r){this._observableRegistry.addCallback(r,this)}removeCallback(r){this._observableRegistry.removeCallback(r,this)}},Pr=class extends It{},br=class extends It{},vr=class extends It{}});var Cr,mc=_(()=>{"use strict";_e();Mr();et();Cr=class{_meterSharedState;constructor(r){this._meterSharedState=r}createGauge(r,o){let c=W(r,h.GAUGE,o),i=this._meterSharedState.registerMetricStorage(c);return new gr(i,c)}createHistogram(r,o){let c=W(r,h.HISTOGRAM,o),i=this._meterSharedState.registerMetricStorage(c);return new Rr(i,c)}createCounter(r,o){let c=W(r,h.COUNTER,o),i=this._meterSharedState.registerMetricStorage(c);return new xr(i,c)}createUpDownCounter(r,o){let c=W(r,h.UP_DOWN_COUNTER,o),i=this._meterSharedState.registerMetricStorage(c);return new Nr(i,c)}createObservableGauge(r,o){let c=W(r,h.OBSERVABLE_GAUGE,o),i=this._meterSharedState.registerAsyncMetricStorage(c);return new br(c,i,this._meterSharedState.observableRegistry)}createObservableCounter(r,o){let c=W(r,h.OBSERVABLE_COUNTER,o),i=this._meterSharedState.registerAsyncMetricStorage(c);return new Pr(c,i,this._meterSharedState.observableRegistry)}createObservableUpDownCounter(r,o){let c=W(r,h.OBSERVABLE_UP_DOWN_COUNTER,o),i=this._meterSharedState.registerAsyncMetricStorage(c);return new vr(c,i,this._meterSharedState.observableRegistry)}addBatchObservableCallback(r,o){this._meterSharedState.observableRegistry.addBatchCallback(r,o)}removeBatchObservableCallback(r,o){this._meterSharedState.observableRegistry.removeBatchCallback(r,o)}}});var Ut,bo=_(()=>{"use strict";_e();Ut=class{_instrumentDescriptor;constructor(r){this._instrumentDescriptor=r}getInstrumentDescriptor(){return this._instrumentDescriptor}updateDescription(r){this._instrumentDescriptor=W(this._instrumentDescriptor.name,this._instrumentDescriptor.type,{description:r,valueType:this._instrumentDescriptor.valueType,unit:this._instrumentDescriptor.unit,advice:this._instrumentDescriptor.advice})}}});var vo,I,Se=_(()=>{"use strict";F();vo=class{_hash;_valueMap=new Map;_keyMap=new Map;constructor(r){this._hash=r}get(r,o){return o??=this._hash(r),this._valueMap.get(o)}getOrDefault(r,o){let c=this._hash(r);if(this._valueMap.has(c))return this._valueMap.get(c);let i=o();return this._keyMap.has(c)||this._keyMap.set(c,r),this._valueMap.set(c,i),i}set(r,o,c){c??=this._hash(r),this._keyMap.has(c)||this._keyMap.set(c,r),this._valueMap.set(c,o)}has(r,o){return o??=this._hash(r),this._valueMap.has(o)}*keys(){let r=this._keyMap.entries(),o=r.next();for(;o.done!==!0;)yield[o.value[1],o.value[0]],o=r.next()}*entries(){let r=this._valueMap.entries(),o=r.next();for(;o.done!==!0;)yield[this._keyMap.get(o.value[0]),o.value[1],o.value[0]],o=r.next()}get size(){return this._valueMap.size}},I=class extends vo{constructor(){super(He)}}});var Lt,Mo=_(()=>{"use strict";F();Se();Lt=class{_aggregator;_activeCollectionStorage=new I;_cumulativeMemoStorage=new I;_cardinalityLimit;_overflowAttributes={"otel.metric.overflow":!0};_overflowHashCode;constructor(r,o){this._aggregator=r,this._cardinalityLimit=(o??2e3)-1,this._overflowHashCode=He(this._overflowAttributes)}record(r,o,c,i){let s=this._activeCollectionStorage.get(o);if(!s){if(this._activeCollectionStorage.size>=this._cardinalityLimit){this._activeCollectionStorage.getOrDefault(this._overflowAttributes,()=>this._aggregator.createAccumulation(i))?.record(r);return}s=this._aggregator.createAccumulation(i),this._activeCollectionStorage.set(o,s)}s?.record(r)}batchCumulate(r,o){Array.from(r.entries()).forEach(([c,i,s])=>{let e=this._aggregator.createAccumulation(o);e?.record(i);let t=e;if(this._cumulativeMemoStorage.has(c,s)){let n=this._cumulativeMemoStorage.get(c,s);t=this._aggregator.diff(n,e)}else if(this._cumulativeMemoStorage.size>=this._cardinalityLimit&&(c=this._overflowAttributes,s=this._overflowHashCode,this._cumulativeMemoStorage.has(c,s))){let n=this._cumulativeMemoStorage.get(c,s);t=this._aggregator.diff(n,e)}if(this._activeCollectionStorage.has(c,s)){let n=this._activeCollectionStorage.get(c,s);t=this._aggregator.merge(n,t)}this._cumulativeMemoStorage.set(c,e,s),this._activeCollectionStorage.set(c,t,s)})}collect(){let r=this._activeCollectionStorage;return this._activeCollectionStorage=new I,r}}});function Mp(a){return Array.from(a.entries())}var Dt,Co=_(()=>{"use strict";Be();Se();Dt=class a{_aggregator;_unreportedAccumulations=new Map;_reportHistory=new Map;constructor(r,o){this._aggregator=r,o.forEach(c=>{this._unreportedAccumulations.set(c,[])})}buildMetrics(r,o,c,i){this._stashAccumulations(c);let s=this._getMergedUnreportedAccumulations(r),e=s,t;if(this._reportHistory.has(r)){let u=this._reportHistory.get(r),l=u.collectionTime;t=u.aggregationTemporality,t===R.CUMULATIVE?e=a.merge(u.accumulations,s,this._aggregator):e=a.calibrateStartTime(u.accumulations,s,l)}else t=r.selectAggregationTemporality(o.type);this._reportHistory.set(r,{accumulations:e,collectionTime:i,aggregationTemporality:t});let n=Mp(e);if(n.length!==0)return this._aggregator.toMetricData(o,t,n,i)}_stashAccumulations(r){let o=this._unreportedAccumulations.keys();for(let c of o){let i=this._unreportedAccumulations.get(c);i===void 0&&(i=[],this._unreportedAccumulations.set(c,i)),i.push(r)}}_getMergedUnreportedAccumulations(r){let o=new I,c=this._unreportedAccumulations.get(r);if(this._unreportedAccumulations.set(r,[]),c===void 0)return o;for(let i of c)o=a.merge(o,i,this._aggregator);return o}static merge(r,o,c){let i=r,s=o.entries(),e=s.next();for(;e.done!==!0;){let[t,n,u]=e.value;if(r.has(t,u)){let l=r.get(t,u),d=c.merge(l,n);i.set(t,d,u)}else i.set(t,n,u);e=s.next()}return i}static calibrateStartTime(r,o,c){for(let[i,s]of r.keys())o.get(i,s)?.setStartTime(c);return o}}});var Ir,_c=_(()=>{"use strict";bo();Mo();Co();Se();Ir=class extends Ut{_attributesProcessor;_aggregationCardinalityLimit;_deltaMetricStorage;_temporalMetricStorage;constructor(r,o,c,i,s){super(r),this._attributesProcessor=c,this._aggregationCardinalityLimit=s,this._deltaMetricStorage=new Lt(o,this._aggregationCardinalityLimit),this._temporalMetricStorage=new Dt(o,i)}record(r,o){let c=new I;Array.from(r.entries()).forEach(([i,s])=>{c.set(this._attributesProcessor.process(i),s)}),this._deltaMetricStorage.batchCumulate(c,o)}collect(r,o){let c=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(r,this._instrumentDescriptor,c,o)}}});function Io(a,r){let o="";return a.unit!==r.unit&&(o+=` - Unit '${a.unit}' does not match '${r.unit}'
4
4
  `),a.type!==r.type&&(o+=` - Type '${a.type}' does not match '${r.type}'
5
5
  `),a.valueType!==r.valueType&&(o+=` - Value Type '${a.valueType}' does not match '${r.valueType}'
6
6
  `),a.description!==r.description&&(o+=` - Description '${a.description}' does not match '${r.description}'
@@ -1,4 +1,4 @@
1
1
  import { createRequire as createRequireShim } from 'module'; const require = createRequireShim(import.meta.url);
2
- import{a as k}from"./chunk-757YRULG.js";import{E as I,c as h,j as S,l as x,m as C,q,z as y}from"./chunk-KF7FHZ25.js";import"./chunk-ZTRGPIW7.js";import"./chunk-TW627LH5.js";import{e as E}from"./chunk-AUPVVLD3.js";var s=E(x(),1);var i=E(C(),1);import{threadId as o}from"worker_threads";import{Piscina as L}from"piscina";var D=E(y(),1),b=!1,u;process.on("uncaughtException",e=>{console.error("Uncaught Exception, please checking if await is properly used",e),u=e}).on("unhandledRejection",(e,t)=>{e?.message.startsWith('invalid ENS name (disallowed character: "*"')||(console.error("Unhandled Rejection, please checking if await is properly",e),u=e)}).on("exit",()=>{console.info("Worker thread exiting, threadId:",o)});var d,A=async e=>{if(e.target){let t=await import(e.target);return console.debug("Module loaded, path:",e.target,"module:",t),t}},v={};async function N(e,t){if(b)return{};q();try{d=new I(()=>A(t),t)}catch(a){throw new s.ServerError(s.Status.INVALID_ARGUMENT,"Failed to load processor: "+h(a))}return await d.start(e,v),b=!0,{}}async function F({processId:e,request:t,workerPort:a}){let{startRequest:p,configRequest:w,options:n}=L.workerData;if(!b){let r=process.env.LOG_LEVEL?.toUpperCase();k(n.logFormat==="json",r==="debug"?!0:n.debug,o),S(n),p&&(await N(p,n),console.debug("worker",o," started, template instance:",p.templateInstances?.length)),w&&(await d?.getConfig(w,v),console.debug("worker",o," configured"))}if(u){let r=u;throw u=void 0,console.error("Unhandled exception/rejection in previous request:",r),new i.RichServerError(s.Status.UNAVAILABLE,"Unhandled exception/rejection in previous request: "+h(r),[i.DebugInfo.fromPartial({detail:r.message,stackEntries:r.stack?.split(`
2
+ import{a as k}from"./chunk-757YRULG.js";import{E as I,c as h,j as S,l as x,m as C,q,z as y}from"./chunk-UJTKZHZU.js";import"./chunk-ZTRGPIW7.js";import"./chunk-TW627LH5.js";import{e as E}from"./chunk-AUPVVLD3.js";var s=E(x(),1);var i=E(C(),1);import{threadId as o}from"worker_threads";import{Piscina as L}from"piscina";var D=E(y(),1),b=!1,u;process.on("uncaughtException",e=>{console.error("Uncaught Exception, please checking if await is properly used",e),u=e}).on("unhandledRejection",(e,t)=>{e?.message.startsWith('invalid ENS name (disallowed character: "*"')||(console.error("Unhandled Rejection, please checking if await is properly",e),u=e)}).on("exit",()=>{console.info("Worker thread exiting, threadId:",o)});var d,A=async e=>{if(e.target){let t=await import(e.target);return console.debug("Module loaded, path:",e.target,"module:",t),t}},v={};async function N(e,t){if(b)return{};q();try{d=new I(()=>A(t),t)}catch(a){throw new s.ServerError(s.Status.INVALID_ARGUMENT,"Failed to load processor: "+h(a))}return await d.start(e,v),b=!0,{}}async function F({processId:e,request:t,workerPort:a}){let{startRequest:p,configRequest:w,options:n}=L.workerData;if(!b){let r=process.env.LOG_LEVEL?.toUpperCase();k(n.logFormat==="json",r==="debug"?!0:n.debug,o),S(n),p&&(await N(p,n),console.debug("worker",o," started, template instance:",p.templateInstances?.length)),w&&(await d?.getConfig(w,v),console.debug("worker",o," configured"))}if(u){let r=u;throw u=void 0,console.error("Unhandled exception/rejection in previous request:",r),new i.RichServerError(s.Status.UNAVAILABLE,"Unhandled exception/rejection in previous request: "+h(r),[i.DebugInfo.fromPartial({detail:r.message,stackEntries:r.stack?.split(`
3
3
  `)})])}let l=(n.workerTimeout||0)*1e3,P=n.enablePartition||!1;await new Promise((r,R)=>{let f=new D.Subject,m;f.subscribe(c=>{console.debug("Worker",o,"send response:",c.result?"result":"dbResult"),a.postMessage(c),c.result&&(m&&clearTimeout(m),r(),a.close())}),a.on("message",c=>{let g=c;console.debug("Worker",o,"received request:",g.start?"start":"dbResult"),d?.handleRequest(g,t.binding,f),P&&g.start&&l>0&&(m=setTimeout(async()=>{R(new i.RichServerError(s.Status.DEADLINE_EXCEEDED,"Worker timeout exceeded"))},l))}),console.debug("Worker",o,"handle request: binding"),d?.handleRequest(t,t.binding,f),!P&&l>0&&(m=setTimeout(()=>{R(new i.RichServerError(s.Status.DEADLINE_EXCEEDED,"Worker timeout exceeded"))},l))})}import("node:process").then(e=>e.stdout.write(""));export{F as default};
4
4
  //# sourceMappingURL=service-worker.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentio/runtime",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "exports": {