@coboot/headless 0.2.2-rc.6 → 0.2.2-rc.7

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/launcher.mjs CHANGED
@@ -1,4 +1,22 @@
1
1
  #!/usr/bin/env node
2
- import{spawnSync as u}from"child_process";import l from"fs";import o from"path";import e from"process";import{fileURLToPath as p}from"url";var i=18,f=20,d="node@22",m=p(import.meta.url);function h(r){return Number.parseInt(String(r).split(".")[0],10)}function g(r={}){let t=r.nodeVersion||e.versions.node,n=h(t);if(!Number.isInteger(n)||n<i)throw new Error(`Node.js >=${i} is required to launch Headless; current version is ${t}`);let s=r.cliFile||o.join(o.dirname(m),"cli.mjs"),a=r.args||e.argv.slice(2);return n>=f?{command:r.execPath||e.execPath,args:[s,...a],bootstrapped:!1}:{command:(r.platform||e.platform)==="win32"?"npx.cmd":"npx",args:["-y","-p",d,"node",s,...a],bootstrapped:!0}}function v(r={}){let t=g(r);t.bootstrapped&&e.stderr.write(`[Headless] Node.js ${r.nodeVersion||e.versions.node} detected; using isolated ${d}.
3
- `);let n=(r.spawnSync||u)(t.command,t.args,{stdio:"inherit",env:r.env||e.env});if(n.error)throw n.error;return Number.isInteger(n.status)?n.status:1}function c(r){try{return l.realpathSync(r)}catch{return o.resolve(r)}}if(e.argv[1]&&c(e.argv[1])===c(m))try{e.exitCode=v()}catch(r){e.stderr.write(`headless launcher: ${r instanceof Error?r.message:String(r)}
4
- `),e.exitCode=1}export{g as resolveHeadlessLaunchCommand,v as runHeadlessLauncher};
2
+ import { createRequire as __runtimeCreateRequire } from "node:module"; const require = __runtimeCreateRequire(import.meta.url);
3
+ var pr=Object.defineProperty;var es=Object.getOwnPropertyDescriptor;var rs=Object.getOwnPropertyNames;var ns=Object.prototype.hasOwnProperty;var m=(e,t)=>()=>(e&&(t=e(e=0)),t);var os=(e,t)=>{for(var r in t)pr(e,r,{get:t[r],enumerable:!0})},is=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of rs(t))!ns.call(e,i)&&i!==r&&pr(e,i,{get:()=>t[i],enumerable:!(n=es(t,i))||n.enumerable});return e};var as=e=>is(pr({},"__esModule",{value:!0}),e);var fs,At,dr=m(()=>{"use strict";fs=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),At=(function(e){fs(t,e);function t(r,n,i){var o=e.call(this,r)||this;return o.name="OTLPExporterError",o.data=i,o.code=n,o}return t})(Error)});var V,mr=m(()=>{"use strict";V="1.9.1"});function ms(e){let t=new Set([e]),r=new Set,n=e.match(Mn);if(!n)return()=>!1;let i={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(i.prerelease!=null)return function(l){return l===e};function o(u){return r.add(u),!1}function s(u){return t.add(u),!0}return function(l){if(t.has(l))return!0;if(r.has(l))return!1;let a=l.match(Mn);if(!a)return o(l);let c={major:+a[1],minor:+a[2],patch:+a[3],prerelease:a[4]};return c.prerelease!=null||i.major!==c.major?o(l):i.major===0?i.minor===c.minor&&i.patch<=c.patch?s(l):o(l):i.minor<=c.minor?s(l):o(l)}}var Mn,wn,In=m(()=>{"use strict";mr();Mn=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;wn=ms(V)});function at(e,t,r,n=!1){var i;let o=xt[Rt]=(i=xt[Rt])!==null&&i!==void 0?i:{version:V};if(!n&&o[e]){let s=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return r.error(s.stack||s.message),!1}if(o.version!==V){let s=new Error(`@opentelemetry/api: Registration of version v${o.version} for ${e} does not match previously registered API v${V}`);return r.error(s.stack||s.message),!1}return o[e]=t,r.debug(`@opentelemetry/api: Registered a global for ${e} v${V}.`),!0}function B(e){var t,r;let n=(t=xt[Rt])===null||t===void 0?void 0:t.version;if(!(!n||!wn(n)))return(r=xt[Rt])===null||r===void 0?void 0:r[e]}function st(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${V}.`);let r=xt[Rt];r&&delete r[e]}var Es,Rt,xt,Lt=m(()=>{"use strict";mr();In();Es=V.split(".")[0],Rt=Symbol.for(`opentelemetry.js.api.${Es}`),xt=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{}});function Pt(e,t,r){let n=B("diag");if(n)return n[e](t,...r)}var ue,Nn=m(()=>{"use strict";Lt();ue=class{constructor(t){this._namespace=t.namespace||"DiagComponentLogger"}debug(...t){return Pt("debug",this._namespace,t)}error(...t){return Pt("error",this._namespace,t)}info(...t){return Pt("info",this._namespace,t)}warn(...t){return Pt("warn",this._namespace,t)}verbose(...t){return Pt("verbose",this._namespace,t)}}});var v,ce=m(()=>{"use strict";(function(e){e[e.NONE=0]="NONE",e[e.ERROR=30]="ERROR",e[e.WARN=50]="WARN",e[e.INFO=60]="INFO",e[e.DEBUG=70]="DEBUG",e[e.VERBOSE=80]="VERBOSE",e[e.ALL=9999]="ALL"})(v||(v={}))});function Cn(e,t){e<v.NONE?e=v.NONE:e>v.ALL&&(e=v.ALL),t=t||{};function r(n,i){let o=t[n];return typeof o=="function"&&e>=i?o.bind(t):function(){}}return{error:r("error",v.ERROR),warn:r("warn",v.WARN),info:r("info",v.INFO),debug:r("debug",v.DEBUG),verbose:r("verbose",v.VERBOSE)}}var Un=m(()=>{"use strict";ce()});var vs,x,bt=m(()=>{"use strict";Nn();Un();ce();Lt();vs="diag",x=class e{static instance(){return this._instance||(this._instance=new e),this._instance}constructor(){function t(i){return function(...o){let s=B("diag");if(s)return s[i](...o)}}let r=this,n=(i,o={logLevel:v.INFO})=>{var s,u,l;if(i===r){let f=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((s=f.stack)!==null&&s!==void 0?s:f.message),!1}typeof o=="number"&&(o={logLevel:o});let a=B("diag"),c=Cn((u=o.logLevel)!==null&&u!==void 0?u:v.INFO,i);if(a&&!o.suppressOverrideMessage){let f=(l=new Error().stack)!==null&&l!==void 0?l:"<failed to generate stacktrace>";a.warn(`Current logger will be overwritten from ${f}`),c.warn(`Current logger will overwrite one already registered from ${f}`)}return at("diag",c,r,!0)};r.setLogger=n,r.disable=()=>{st(vs,r)},r.createComponentLogger=i=>new ue(i),r.verbose=t("verbose"),r.debug=t("debug"),r.info=t("info"),r.warn=t("warn"),r.error=t("error")}}});var Dn,Gn=m(()=>{"use strict";Dn=Symbol("BaggageEntryMetadata")});function Er(e){return typeof e!="string"&&(gs.error(`Cannot create baggage metadata from unknown type: ${typeof e}`),e=""),{__TYPE__:Dn,toString(){return e}}}var gs,Vn=m(()=>{"use strict";bt();Gn();gs=x.instance()});function Mt(e){return Symbol.for(e)}var vr,gr,le=m(()=>{"use strict";vr=class e{constructor(t){let r=this;r._currentContext=t?new Map(t):new Map,r.getValue=n=>r._currentContext.get(n),r.setValue=(n,i)=>{let o=new e(r._currentContext);return o._currentContext.set(n,i),o},r.deleteValue=n=>{let i=new e(r._currentContext);return i._currentContext.delete(n),i}}},gr=new vr});function Pr(){return Ts}var Tr,ut,Sr,yr,Ar,Or,wt,Rr,xr,Lr,Ts,Ss,ys,As,Os,Rs,xs,Ls,Bn=m(()=>{"use strict";Tr=class{constructor(){}createGauge(t,r){return ys}createHistogram(t,r){return As}createCounter(t,r){return Ss}createUpDownCounter(t,r){return Os}createObservableGauge(t,r){return xs}createObservableCounter(t,r){return Rs}createObservableUpDownCounter(t,r){return Ls}addBatchObservableCallback(t,r){}removeBatchObservableCallback(t){}},ut=class{},Sr=class extends ut{add(t,r){}},yr=class extends ut{add(t,r){}},Ar=class extends ut{record(t,r){}},Or=class extends ut{record(t,r){}},wt=class{addCallback(t){}removeCallback(t){}},Rr=class extends wt{},xr=class extends wt{},Lr=class extends wt{},Ts=new Tr,Ss=new Sr,ys=new Ar,As=new Or,Os=new yr,Rs=new Rr,xs=new xr,Ls=new Lr});var y,Hn=m(()=>{"use strict";(function(e){e[e.INT=0]="INT",e[e.DOUBLE=1]="DOUBLE"})(y||(y={}))});var fe,Fn=m(()=>{"use strict";le();fe=class{active(){return gr}with(t,r,n,...i){return r.call(n,...i)}bind(t,r){return r}enable(){return this}disable(){return this}}});var br,Ps,F,pe=m(()=>{"use strict";Fn();Lt();bt();br="context",Ps=new fe,F=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalContextManager(t){return at(br,t,x.instance())}active(){return this._getContextManager().active()}with(t,r,n,...i){return this._getContextManager().with(t,r,n,...i)}bind(t,r){return this._getContextManager().bind(t,r)}_getContextManager(){return B(br)||Ps}disable(){this._getContextManager().disable(),st(br,x.instance())}}});var z,Mr=m(()=>{"use strict";(function(e){e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"})(z||(z={}))});var wr,Ir,kn,Nr=m(()=>{"use strict";Mr();wr="0000000000000000",Ir="00000000000000000000000000000000",kn={traceId:Ir,spanId:wr,traceFlags:z.NONE}});var U,_e=m(()=>{"use strict";Nr();U=class{constructor(t=kn){this._spanContext=t}spanContext(){return this._spanContext}setAttribute(t,r){return this}setAttributes(t){return this}addEvent(t,r){return this}addLink(t){return this}addLinks(t){return this}setStatus(t){return this}updateName(t){return this}end(t){}isRecording(){return!1}recordException(t,r){}}});function he(e){return e.getValue(Cr)||void 0}function jn(){return he(F.getInstance().active())}function It(e,t){return e.setValue(Cr,t)}function Kn(e){return e.deleteValue(Cr)}function Xn(e,t){return It(e,new U(t))}function de(e){var t;return(t=he(e))===null||t===void 0?void 0:t.spanContext()}var Cr,Ur=m(()=>{"use strict";le();_e();pe();Cr=Mt("OpenTelemetry Context Key SPAN")});function Yn(e,t){if(typeof e!="string"||e.length!==t)return!1;let r=0;for(let n=0;n<e.length;n+=4)r+=(me[e.charCodeAt(n)]|0)+(me[e.charCodeAt(n+1)]|0)+(me[e.charCodeAt(n+2)]|0)+(me[e.charCodeAt(n+3)]|0);return r===t}function Wn(e){return Yn(e,32)&&e!==Ir}function zn(e){return Yn(e,16)&&e!==wr}function J(e){return Wn(e.traceId)&&zn(e.spanId)}function Jn(e){return new U(e)}var me,Ee=m(()=>{"use strict";Nr();_e();me=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1])});function bs(e){return e!==null&&typeof e=="object"&&"spanId"in e&&typeof e.spanId=="string"&&"traceId"in e&&typeof e.traceId=="string"&&"traceFlags"in e&&typeof e.traceFlags=="number"}var Dr,ct,Gr=m(()=>{"use strict";pe();Ur();_e();Ee();Dr=F.getInstance(),ct=class{startSpan(t,r,n=Dr.active()){if(!!r?.root)return new U;let o=n&&de(n);return bs(o)&&J(o)?new U(o):new U}startActiveSpan(t,r,n,i){let o,s,u;if(arguments.length<2)return;arguments.length===2?u=r:arguments.length===3?(o=r,u=n):(o=r,s=n,u=i);let l=s??Dr.active(),a=this.startSpan(t,o,l),c=It(l,a);return Dr.with(c,u,void 0,a)}}});var Ms,ve,$n=m(()=>{"use strict";Gr();Ms=new ct,ve=class{constructor(t,r,n,i){this._provider=t,this.name=r,this.version=n,this.options=i}startSpan(t,r,n){return this._getTracer().startSpan(t,r,n)}startActiveSpan(t,r,n,i){let o=this._getTracer();return Reflect.apply(o.startActiveSpan,o,arguments)}_getTracer(){if(this._delegate)return this._delegate;let t=this._provider.getDelegateTracer(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):Ms}}});var ge,Zn=m(()=>{"use strict";Gr();ge=class{getTracer(t,r,n){return new ct}}});var ws,Nt,qn=m(()=>{"use strict";$n();Zn();ws=new ge,Nt=class{getTracer(t,r,n){var i;return(i=this.getDelegateTracer(t,r,n))!==null&&i!==void 0?i:new ve(this,t,r,n)}getDelegate(){var t;return(t=this._delegate)!==null&&t!==void 0?t:ws}setDelegate(t){this._delegate=t}getDelegateTracer(t,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getTracer(t,r,n)}}});var L,Qn=m(()=>{"use strict";pe();L=F.getInstance()});var p,to=m(()=>{"use strict";bt();p=x.instance()});var Vr,Te,eo=m(()=>{"use strict";Lt();qn();Ee();Ur();bt();Vr="trace",Te=class e{constructor(){this._proxyTracerProvider=new Nt,this.wrapSpanContext=Jn,this.isSpanContextValid=J,this.deleteSpan=Kn,this.getSpan=he,this.getActiveSpan=jn,this.getSpanContext=de,this.setSpan=It,this.setSpanContext=Xn}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalTracerProvider(t){let r=at(Vr,this._proxyTracerProvider,x.instance());return r&&this._proxyTracerProvider.setDelegate(t),r}getTracerProvider(){return B(Vr)||this._proxyTracerProvider}getTracer(t,r){return this.getTracerProvider().getTracer(t,r)}disable(){st(Vr,x.instance()),this._proxyTracerProvider=new Nt}}});var $,ro=m(()=>{"use strict";eo();$=Te.getInstance()});var d=m(()=>{"use strict";Vn();le();ce();Bn();Hn();Mr();Ee();Qn();to();ro()});function Qi(e){var t=[429,502,503,504];return t.includes(e)}function ta(e){if(e!=null){var t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?t*1e3:-1;var r=new Date(e).getTime()-Date.now();return r>=0?r:0}}var ea=m(()=>{"use strict"});var oa={};os(oa,{compressAndSend:()=>na,createHttpAgent:()=>Xc,sendWithHttp:()=>jc});import*as ir from"http";import*as ar from"https";import*as ra from"zlib";import{Readable as kc}from"stream";function jc(e,t,r,n,i){var o=new URL(e.url),s=Number(process.versions.node.split(".")[0]),u={hostname:o.hostname,port:o.port,path:o.pathname,method:"POST",headers:dn({},e.headers()),agent:t},l=o.protocol==="http:"?ir.request:ar.request,a=l(u,function(f){var h=[];f.on("data",function(E){return h.push(E)}),f.on("end",function(){if(f.statusCode&&f.statusCode<299)n({status:"success",data:Buffer.concat(h)});else if(f.statusCode&&Qi(f.statusCode))n({status:"retryable",retryInMillis:ta(f.headers["retry-after"])});else{var E=new At(f.statusMessage,f.statusCode,Buffer.concat(h).toString());n({status:"failure",error:E})}})});a.setTimeout(i,function(){a.destroy(),n({status:"failure",error:new Error("Request Timeout")})}),a.on("error",function(f){n({status:"failure",error:f})});var c=s>=14?"close":"abort";a.on(c,function(){n({status:"failure",error:new Error("Request timed out")})}),na(a,e.compression,r,function(f){n({status:"failure",error:f})})}function na(e,t,r,n){var i=Kc(r);t==="gzip"&&(e.setHeader("Content-Encoding","gzip"),i=i.on("error",n).pipe(ra.createGzip()).on("error",n)),i.pipe(e).on("error",n)}function Kc(e){var t=new kc;return t.push(e),t.push(null),t}function Xc(e,t){var r=new URL(e),n=r.protocol==="http:"?ir.Agent:ar.Agent;return new n(t)}var dn,ia=m(()=>{"use strict";ea();dr();dn=function(){return dn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},dn.apply(this,arguments)}});import Hl from"fs";import Xa from"os";import Fl from"path";import{StringDecoder as kl}from"string_decoder";var ss=/\b(authorization|proxy-authorization|cookie|set-cookie)\s*:\s*[^\r\n]*/gi,us=/\b(bearer|basic)\s+[A-Z0-9._~+/=-]+/gi,cs=/\b(authorization|proxy[-_]authorization|cookie|set[-_]cookie|credential[-_]grant|taihu[-_]auth[-_]grant|app[-_]publish[-_]grant|access[-_]token|refresh[-_]token|id[-_]token|token|api[-_]?key|password|secret)\b["']?\s*[:=]\s*(?:"[^"]*"|'[^']*'|[^\s,;&]+)/gi;function ne(e){return(e instanceof Error?`${e.name}: ${e.message}`:String(e??"")).replace(ss,"$1: [redacted]").replace(us,"$1 [redacted]").replace(cs,"$1=[redacted]").replace(/\s+/g," ").trim().slice(0,2e3)}function An(e,t,r,n){let i=ne(r),o=Object.fromEntries(Object.entries(n).map(([s,u])=>[s,ne(u)]));if(Object.keys(o).length===0){e[t](i);return}e[t](i,o)}var gt;(function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TRACE=1]="TRACE",e[e.TRACE2=2]="TRACE2",e[e.TRACE3=3]="TRACE3",e[e.TRACE4=4]="TRACE4",e[e.DEBUG=5]="DEBUG",e[e.DEBUG2=6]="DEBUG2",e[e.DEBUG3=7]="DEBUG3",e[e.DEBUG4=8]="DEBUG4",e[e.INFO=9]="INFO",e[e.INFO2=10]="INFO2",e[e.INFO3=11]="INFO3",e[e.INFO4=12]="INFO4",e[e.WARN=13]="WARN",e[e.WARN2=14]="WARN2",e[e.WARN3=15]="WARN3",e[e.WARN4=16]="WARN4",e[e.ERROR=17]="ERROR",e[e.ERROR2=18]="ERROR2",e[e.ERROR3=19]="ERROR3",e[e.ERROR4=20]="ERROR4",e[e.FATAL=21]="FATAL",e[e.FATAL2=22]="FATAL2",e[e.FATAL3=23]="FATAL3",e[e.FATAL4=24]="FATAL4"})(gt||(gt={}));var oe=(function(){function e(){}return e.prototype.emit=function(t){},e})();var Tt=new oe;var ls=(function(){function e(){}return e.prototype.getLogger=function(t,r,n){return new oe},e})();var ie=new ls;var On=(function(){function e(t,r,n,i){this._provider=t,this.name=r,this.version=n,this.options=i}return e.prototype.emit=function(t){this._getLogger().emit(t)},e.prototype._getLogger=function(){if(this._delegate)return this._delegate;var t=this._provider.getDelegateLogger(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):Tt},e})();var _r=(function(){function e(){}return e.prototype.getLogger=function(t,r,n){var i;return(i=this.getDelegateLogger(t,r,n))!==null&&i!==void 0?i:new On(this,t,r,n)},e.prototype.getDelegate=function(){var t;return(t=this._delegate)!==null&&t!==void 0?t:ie},e.prototype.setDelegate=function(t){this._delegate=t},e.prototype.getDelegateLogger=function(t,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getLogger(t,r,n)},e})();var ae=typeof globalThis=="object"?globalThis:global;var St=Symbol.for("io.opentelemetry.js.api.logs"),it=ae;function Rn(e,t,r){return function(n){return n===e?t:r}}var hr=1;var xn=(function(){function e(){this._proxyLoggerProvider=new _r}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalLoggerProvider=function(t){return it[St]?this.getLoggerProvider():(it[St]=Rn(hr,t,ie),this._proxyLoggerProvider.setDelegate(t),t)},e.prototype.getLoggerProvider=function(){var t,r;return(r=(t=it[St])===null||t===void 0?void 0:t.call(it,hr))!==null&&r!==void 0?r:this._proxyLoggerProvider},e.prototype.getLogger=function(t,r,n){return this.getLoggerProvider().getLogger(t,r,n)},e.prototype.disable=function(){delete it[St],this._proxyLoggerProvider=new _r},e})();var xf=xn.getInstance();var yt=(function(){function e(t){this._delegate=t}return e.prototype.export=function(t,r){this._delegate.export(t,r)},e.prototype.forceFlush=function(){return this._delegate.forceFlush()},e.prototype.shutdown=function(){return this._delegate.shutdown()},e})();function ps(e){if(!Number.isNaN(e)&&Number.isFinite(e)&&e>0)return e;throw new Error("Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '"+e+"')")}function se(e){if(e!=null)return function(){return e}}function Ln(e,t,r){var n,i,o,s,u,l;return{timeoutMillis:ps((i=(n=e.timeoutMillis)!==null&&n!==void 0?n:t.timeoutMillis)!==null&&i!==void 0?i:r.timeoutMillis),concurrencyLimit:(s=(o=e.concurrencyLimit)!==null&&o!==void 0?o:t.concurrencyLimit)!==null&&s!==void 0?s:r.concurrencyLimit,compression:(l=(u=e.compression)!==null&&u!==void 0?u:t.compression)!==null&&l!==void 0?l:r.compression}}function Pn(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:"none"}}var Ot;(function(e){e.NONE="none",e.GZIP="gzip"})(Ot||(Ot={}));var _s=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function u(c){try{a(n.next(c))}catch(f){s(f)}}function l(c){try{a(n.throw(c))}catch(f){s(f)}}function a(c){c.done?o(c.value):i(c.value).then(u,l)}a((n=n.apply(e,t||[])).next())})},hs=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(c){return l([a,c])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(c){a=[6,c],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},ds=(function(){function e(t){this._sendingPromises=[],this._concurrencyLimit=t}return e.prototype.pushPromise=function(t){var r=this;if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this._sendingPromises.push(t);var n=function(){var i=r._sendingPromises.indexOf(t);r._sendingPromises.splice(i,1)};t.then(n,n)},e.prototype.hasReachedLimit=function(){return this._sendingPromises.length>=this._concurrencyLimit},e.prototype.awaitAll=function(){return _s(this,void 0,void 0,function(){return hs(this,function(t){switch(t.label){case 0:return[4,Promise.all(this._sendingPromises)];case 1:return t.sent(),[2]}})})},e})();function bn(e){return new ds(e.concurrencyLimit)}d();var Is=Mt("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function no(e){return e.setValue(Is,!0)}var oo="=",Se=";",Br=",";var io=8192;d();var Ns=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o};function ao(e){return e.reduce(function(t,r){var n=""+t+(t!==""?Br:"")+r;return n.length>io?t:n},"")}function so(e){return e.getAllEntries().map(function(t){var r=Ns(t,2),n=r[0],i=r[1],o=encodeURIComponent(n)+"="+encodeURIComponent(i.value);return i.metadata!==void 0&&(o+=Se+i.metadata.toString()),o})}function Hr(e){var t=e.split(Se);if(!(t.length<=0)){var r=t.shift();if(r){var n=r.indexOf(oo);if(!(n<=0)){var i=decodeURIComponent(r.substring(0,n).trim()),o=decodeURIComponent(r.substring(n+1).trim()),s;return t.length>0&&(s=Er(t.join(Se))),{key:i,value:o,metadata:s}}}}}function uo(e){return typeof e!="string"||e.length===0?{}:e.split(Br).map(function(t){return Hr(t)}).filter(function(t){return t!==void 0&&t.value.length>0}).reduce(function(t,r){return t[r.key]=r.value,t},{})}var Cs=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function ye(e){return e==null?!0:Array.isArray(e)?Us(e):co(e)}function Us(e){var t,r,n;try{for(var i=Cs(e),o=i.next();!o.done;o=i.next()){var s=o.value;if(s!=null){if(!n){if(co(s)){n=typeof s;continue}return!1}if(typeof s!==n)return!1}}}catch(u){t={error:u}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return!0}function co(e){switch(typeof e){case"number":case"boolean":case"string":return!0}return!1}d();function lo(){return function(e){p.error(Ds(e))}}function Ds(e){return typeof e=="string"?e:JSON.stringify(Gs(e))}function Gs(e){for(var t={},r=e;r!==null;)Object.getOwnPropertyNames(r).forEach(function(n){if(!t[n]){var i=r[n];i&&(t[n]=String(i))}}),r=Object.getPrototypeOf(r);return t}var Vs=lo();function H(e){try{Vs(e)}catch{}}d();var Ae;(function(e){e.AlwaysOff="always_off",e.AlwaysOn="always_on",e.ParentBasedAlwaysOff="parentbased_always_off",e.ParentBasedAlwaysOn="parentbased_always_on",e.ParentBasedTraceIdRatio="parentbased_traceidratio",e.TraceIdRatio="traceidratio"})(Ae||(Ae={}));var Bs=",",Hs=["OTEL_SDK_DISABLED"];function Fs(e){return Hs.indexOf(e)>-1}var ks=["OTEL_BSP_EXPORT_TIMEOUT","OTEL_BSP_MAX_EXPORT_BATCH_SIZE","OTEL_BSP_MAX_QUEUE_SIZE","OTEL_BSP_SCHEDULE_DELAY","OTEL_BLRP_EXPORT_TIMEOUT","OTEL_BLRP_MAX_EXPORT_BATCH_SIZE","OTEL_BLRP_MAX_QUEUE_SIZE","OTEL_BLRP_SCHEDULE_DELAY","OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT","OTEL_ATTRIBUTE_COUNT_LIMIT","OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT","OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT","OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT","OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT","OTEL_SPAN_EVENT_COUNT_LIMIT","OTEL_SPAN_LINK_COUNT_LIMIT","OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT","OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT","OTEL_EXPORTER_OTLP_TIMEOUT","OTEL_EXPORTER_OTLP_TRACES_TIMEOUT","OTEL_EXPORTER_OTLP_METRICS_TIMEOUT","OTEL_EXPORTER_OTLP_LOGS_TIMEOUT","OTEL_EXPORTER_JAEGER_AGENT_PORT"];function js(e){return ks.indexOf(e)>-1}var Ks=["OTEL_NO_PATCH_MODULES","OTEL_PROPAGATORS","OTEL_SEMCONV_STABILITY_OPT_IN"];function Xs(e){return Ks.indexOf(e)>-1}var lt=1/0,ft=128,fo=128,po=128,Oe={OTEL_SDK_DISABLED:!1,CONTAINER_NAME:"",ECS_CONTAINER_METADATA_URI_V4:"",ECS_CONTAINER_METADATA_URI:"",HOSTNAME:"",KUBERNETES_SERVICE_HOST:"",NAMESPACE:"",OTEL_BSP_EXPORT_TIMEOUT:3e4,OTEL_BSP_MAX_EXPORT_BATCH_SIZE:512,OTEL_BSP_MAX_QUEUE_SIZE:2048,OTEL_BSP_SCHEDULE_DELAY:5e3,OTEL_BLRP_EXPORT_TIMEOUT:3e4,OTEL_BLRP_MAX_EXPORT_BATCH_SIZE:512,OTEL_BLRP_MAX_QUEUE_SIZE:2048,OTEL_BLRP_SCHEDULE_DELAY:5e3,OTEL_EXPORTER_JAEGER_AGENT_HOST:"",OTEL_EXPORTER_JAEGER_AGENT_PORT:6832,OTEL_EXPORTER_JAEGER_ENDPOINT:"",OTEL_EXPORTER_JAEGER_PASSWORD:"",OTEL_EXPORTER_JAEGER_USER:"",OTEL_EXPORTER_OTLP_ENDPOINT:"",OTEL_EXPORTER_OTLP_TRACES_ENDPOINT:"",OTEL_EXPORTER_OTLP_METRICS_ENDPOINT:"",OTEL_EXPORTER_OTLP_LOGS_ENDPOINT:"",OTEL_EXPORTER_OTLP_HEADERS:"",OTEL_EXPORTER_OTLP_TRACES_HEADERS:"",OTEL_EXPORTER_OTLP_METRICS_HEADERS:"",OTEL_EXPORTER_OTLP_LOGS_HEADERS:"",OTEL_EXPORTER_OTLP_TIMEOUT:1e4,OTEL_EXPORTER_OTLP_TRACES_TIMEOUT:1e4,OTEL_EXPORTER_OTLP_METRICS_TIMEOUT:1e4,OTEL_EXPORTER_OTLP_LOGS_TIMEOUT:1e4,OTEL_EXPORTER_ZIPKIN_ENDPOINT:"http://localhost:9411/api/v2/spans",OTEL_LOG_LEVEL:v.INFO,OTEL_NO_PATCH_MODULES:[],OTEL_PROPAGATORS:["tracecontext","baggage"],OTEL_RESOURCE_ATTRIBUTES:"",OTEL_SERVICE_NAME:"",OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT:lt,OTEL_ATTRIBUTE_COUNT_LIMIT:ft,OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT:lt,OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT:ft,OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT:lt,OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT:ft,OTEL_SPAN_EVENT_COUNT_LIMIT:128,OTEL_SPAN_LINK_COUNT_LIMIT:128,OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT:fo,OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT:po,OTEL_TRACES_EXPORTER:"",OTEL_TRACES_SAMPLER:Ae.ParentBasedAlwaysOn,OTEL_TRACES_SAMPLER_ARG:"",OTEL_LOGS_EXPORTER:"",OTEL_EXPORTER_OTLP_INSECURE:"",OTEL_EXPORTER_OTLP_TRACES_INSECURE:"",OTEL_EXPORTER_OTLP_METRICS_INSECURE:"",OTEL_EXPORTER_OTLP_LOGS_INSECURE:"",OTEL_EXPORTER_OTLP_CERTIFICATE:"",OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE:"",OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE:"",OTEL_EXPORTER_OTLP_LOGS_CERTIFICATE:"",OTEL_EXPORTER_OTLP_COMPRESSION:"",OTEL_EXPORTER_OTLP_TRACES_COMPRESSION:"",OTEL_EXPORTER_OTLP_METRICS_COMPRESSION:"",OTEL_EXPORTER_OTLP_LOGS_COMPRESSION:"",OTEL_EXPORTER_OTLP_CLIENT_KEY:"",OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY:"",OTEL_EXPORTER_OTLP_METRICS_CLIENT_KEY:"",OTEL_EXPORTER_OTLP_LOGS_CLIENT_KEY:"",OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE:"",OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE:"",OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE:"",OTEL_EXPORTER_OTLP_LOGS_CLIENT_CERTIFICATE:"",OTEL_EXPORTER_OTLP_PROTOCOL:"http/protobuf",OTEL_EXPORTER_OTLP_TRACES_PROTOCOL:"http/protobuf",OTEL_EXPORTER_OTLP_METRICS_PROTOCOL:"http/protobuf",OTEL_EXPORTER_OTLP_LOGS_PROTOCOL:"http/protobuf",OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE:"cumulative",OTEL_SEMCONV_STABILITY_OPT_IN:[]};function Ys(e,t,r){if(!(typeof r[e]>"u")){var n=String(r[e]);t[e]=n.toLowerCase()==="true"}}function Ws(e,t,r,n,i){if(n===void 0&&(n=-1/0),i===void 0&&(i=1/0),typeof r[e]<"u"){var o=Number(r[e]);isNaN(o)||(o<n?t[e]=n:o>i?t[e]=i:t[e]=o)}}function zs(e,t,r,n){n===void 0&&(n=Bs);var i=r[e];typeof i=="string"&&(t[e]=i.split(n).map(function(o){return o.trim()}))}var Js={ALL:v.ALL,VERBOSE:v.VERBOSE,DEBUG:v.DEBUG,INFO:v.INFO,WARN:v.WARN,ERROR:v.ERROR,NONE:v.NONE};function $s(e,t,r){var n=r[e];if(typeof n=="string"){var i=Js[n.toUpperCase()];i!=null&&(t[e]=i)}}function Re(e){var t={};for(var r in Oe){var n=r;switch(n){case"OTEL_LOG_LEVEL":$s(n,t,e);break;default:if(Fs(n))Ys(n,t,e);else if(js(n))Ws(n,t,e);else if(Xs(n))zs(n,t,e);else{var i=e[n];typeof i<"u"&&i!==null&&(t[n]=String(i))}}}return t}function D(){var e=Re(process.env);return Object.assign({},Oe,e)}function Ut(){return Re(process.env)}function _o(e){return e>=48&&e<=57?e-48:e>=97&&e<=102?e-87:e-55}function Dt(e){for(var t=new Uint8Array(e.length/2),r=0,n=0;n<e.length;n+=2){var i=_o(e.charCodeAt(n)),o=_o(e.charCodeAt(n+1));t[r++]=i<<4|o}return t}import{performance as Zs}from"perf_hooks";var Z=Zs;var ho="1.30.1";var qs="process.runtime.name";var Qs="service.name";var tu="telemetry.sdk.name",eu="telemetry.sdk.language",ru="telemetry.sdk.version";var mo=qs;var Eo=Qs;var Gt=tu,Vt=eu,Bt=ru;var nu="nodejs";var vo=nu;var pt,q=(pt={},pt[Gt]="opentelemetry",pt[mo]="node",pt[Vt]=vo,pt[Bt]=ho,pt);function Q(e){e.unref()}var su=9,uu=6,cu=Math.pow(10,uu),Fr=Math.pow(10,su);function w(e){var t=e/1e3,r=Math.trunc(t),n=Math.round(e%1e3*cu);return[r,n]}function kr(){var e=Z.timeOrigin;if(typeof e!="number"){var t=Z;e=t.timing&&t.timing.fetchStart}return e}function go(e){var t=w(kr()),r=w(typeof e=="number"?e:Z.now());return So(t,r)}function xe(e){if(To(e))return e;if(typeof e=="number")return e<kr()?go(e):w(e);if(e instanceof Date)return w(e.getTime());throw TypeError("Invalid input type")}function jr(e){return e[0]*Fr+e[1]}function k(e){return e[0]*1e6+e[1]/1e3}function To(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="number"&&typeof e[1]=="number"}function So(e,t){var r=[e[0]+t[0],e[1]+t[1]];return r[1]>=Fr&&(r[1]-=Fr,r[0]+=1),r}var S;(function(e){e[e.SUCCESS=0]="SUCCESS",e[e.FAILED=1]="FAILED"})(S||(S={}));var lu="[object Object]",fu="[object Null]",pu="[object Undefined]",_u=Function.prototype,yo=_u.toString,hu=yo.call(Object),du=mu(Object.getPrototypeOf,Object),Ao=Object.prototype,Oo=Ao.hasOwnProperty,tt=Symbol?Symbol.toStringTag:void 0,Ro=Ao.toString;function mu(e,t){return function(r){return e(t(r))}}function Kr(e){if(!Eu(e)||vu(e)!==lu)return!1;var t=du(e);if(t===null)return!0;var r=Oo.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&yo.call(r)===hu}function Eu(e){return e!=null&&typeof e=="object"}function vu(e){return e==null?e===void 0?pu:fu:tt&&tt in Object(e)?gu(e):Tu(e)}function gu(e){var t=Oo.call(e,tt),r=e[tt],n=!1;try{e[tt]=void 0,n=!0}catch{}var i=Ro.call(e);return n&&(t?e[tt]=r:delete e[tt]),i}function Tu(e){return Ro.call(e)}var Su=20;function Yr(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r=e.shift(),n=new WeakMap;e.length>0;)r=Lo(r,e.shift(),0,n);return r}function Xr(e){return Pe(e)?e.slice():e}function Lo(e,t,r,n){r===void 0&&(r=0);var i;if(!(r>Su)){if(r++,Le(e)||Le(t)||Po(t))i=Xr(t);else if(Pe(e)){if(i=e.slice(),Pe(t))for(var o=0,s=t.length;o<s;o++)i.push(Xr(t[o]));else if(Ht(t))for(var u=Object.keys(t),o=0,s=u.length;o<s;o++){var l=u[o];i[l]=Xr(t[l])}}else if(Ht(e))if(Ht(t)){if(!yu(e,t))return t;i=Object.assign({},e);for(var u=Object.keys(t),o=0,s=u.length;o<s;o++){var l=u[o],a=t[l];if(Le(a))typeof a>"u"?delete i[l]:i[l]=a;else{var c=i[l],f=a;if(xo(e,l,n)||xo(t,l,n))delete i[l];else{if(Ht(c)&&Ht(f)){var h=n.get(c)||[],E=n.get(f)||[];h.push({obj:e,key:l}),E.push({obj:t,key:l}),n.set(c,h),n.set(f,E)}i[l]=Lo(i[l],a,r,n)}}}}else i=t;return i}}function xo(e,t,r){for(var n=r.get(e[t])||[],i=0,o=n.length;i<o;i++){var s=n[i];if(s.key===t&&s.obj===e)return!0}return!1}function Pe(e){return Array.isArray(e)}function Po(e){return typeof e=="function"}function Ht(e){return!Le(e)&&!Pe(e)&&!Po(e)&&typeof e=="object"}function Le(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e>"u"||e instanceof Date||e instanceof RegExp||e===null}function yu(e,t){return!(!Kr(e)||!Kr(t))}var Au=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),bo=(function(e){Au(t,e);function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return t})(Error);function Ft(e,t){var r,n=new Promise(function(o,s){r=setTimeout(function(){s(new bo("Operation timed out."))},t)});return Promise.race([e,n]).then(function(i){return clearTimeout(r),i},function(i){throw clearTimeout(r),i})}var Mo=(function(){function e(){var t=this;this._promise=new Promise(function(r,n){t._resolve=r,t._reject=n})}return Object.defineProperty(e.prototype,"promise",{get:function(){return this._promise},enumerable:!1,configurable:!0}),e.prototype.resolve=function(t){this._resolve(t)},e.prototype.reject=function(t){this._reject(t)},e})();var Ou=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},Ru=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},kt=(function(){function e(t,r){this._callback=t,this._that=r,this._isCalled=!1,this._deferred=new Mo}return Object.defineProperty(e.prototype,"isCalled",{get:function(){return this._isCalled},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"promise",{get:function(){return this._deferred.promise},enumerable:!1,configurable:!0}),e.prototype.call=function(){for(var t,r=this,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(!this._isCalled){this._isCalled=!0;try{Promise.resolve((t=this._callback).call.apply(t,Ru([this._that],Ou(n),!1))).then(function(o){return r._deferred.resolve(o)},function(o){return r._deferred.reject(o)})}catch(o){this._deferred.reject(o)}}return this._deferred.promise},e})();d();function wo(e,t){return new Promise(function(r){L.with(no(L.active()),function(){e.export(t,function(n){r(n)})})})}var jt={getKeyPairs:so,serializeKeyPairs:ao,parseKeyPairsIntoRecord:uo,parsePairKeyValue:Hr},be={_export:wo};dr();d();function xu(e){return Object.prototype.hasOwnProperty.call(e,"partialSuccess")}function Io(){return{handleResponse:function(e){e==null||!xu(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||p.warn("Received Partial Success response:",JSON.stringify(e.partialSuccess))}}}d();var Lu=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function u(c){try{a(n.next(c))}catch(f){s(f)}}function l(c){try{a(n.throw(c))}catch(f){s(f)}}function a(c){c.done?o(c.value):i(c.value).then(u,l)}a((n=n.apply(e,t||[])).next())})},Pu=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(c){return l([a,c])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(c){a=[6,c],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},bu=(function(){function e(t,r,n,i,o){this._transport=t,this._serializer=r,this._responseHandler=n,this._promiseQueue=i,this._timeout=o,this._diagLogger=p.createComponentLogger({namespace:"OTLPExportDelegate"})}return e.prototype.export=function(t,r){var n=this;if(this._diagLogger.debug("items to be sent",t),this._promiseQueue.hasReachedLimit()){r({code:S.FAILED,error:new Error("Concurrent export limit reached")});return}var i=this._serializer.serializeRequest(t);if(i==null){r({code:S.FAILED,error:new Error("Nothing to send")});return}this._promiseQueue.pushPromise(this._transport.send(i,this._timeout).then(function(o){if(o.status==="success"){if(o.data!=null)try{n._responseHandler.handleResponse(n._serializer.deserializeResponse(o.data))}catch(s){n._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",s,o.data)}r({code:S.SUCCESS});return}else if(o.status==="failure"&&o.error){r({code:S.FAILED,error:o.error});return}else o.status==="retryable"?r({code:S.FAILED,error:new At("Export failed with retryable status")}):r({code:S.FAILED,error:new At("Export failed with unknown error")})},function(o){return r({code:S.FAILED,error:o})}))},e.prototype.forceFlush=function(){return this._promiseQueue.awaitAll()},e.prototype.shutdown=function(){return Lu(this,void 0,void 0,function(){return Pu(this,function(t){switch(t.label){case 0:return this._diagLogger.debug("shutdown started"),[4,this.forceFlush()];case 1:return t.sent(),this._transport.shutdown(),[2]}})})},e})();function No(e,t){return new bu(e.transport,e.serializer,Io(),e.promiseHandler,t.timeout)}function Uo(e){var t=BigInt(1e9);return BigInt(e[0])*t+BigInt(e[1])}function Mu(e){var t=Number(BigInt.asUintN(32,e)),r=Number(BigInt.asUintN(32,e>>BigInt(32)));return{low:t,high:r}}function Do(e){var t=Uo(e);return Mu(t)}function wu(e){var t=Uo(e);return t.toString()}var Iu=typeof BigInt<"u"?wu:jr;function Co(e){return e}function Go(e){if(e!==void 0)return Dt(e)}var Nu={encodeHrTime:Do,encodeSpanContext:Dt,encodeOptionalSpanContext:Go};function Me(e){var t,r;if(e===void 0)return Nu;var n=(t=e.useLongBits)!==null&&t!==void 0?t:!0,i=(r=e.useHex)!==null&&r!==void 0?r:!1;return{encodeHrTime:n?Do:Iu,encodeSpanContext:i?Co:Dt,encodeOptionalSpanContext:i?Co:Go}}var Cu=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o};function we(e){return{attributes:Kt(e.attributes),droppedAttributesCount:0}}function Ie(e){return{name:e.name,version:e.version}}function Kt(e){return Object.keys(e).map(function(t){return Ne(t,e[t])})}function Ne(e,t){return{key:e,value:Ce(t)}}function Ce(e){var t=typeof e;return t==="string"?{stringValue:e}:t==="number"?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:t==="boolean"?{boolValue:e}:e instanceof Uint8Array?{bytesValue:e}:Array.isArray(e)?{arrayValue:{values:e.map(Ce)}}:t==="object"&&e!=null?{kvlistValue:{values:Object.entries(e).map(function(r){var n=Cu(r,2),i=n[0],o=n[1];return Ne(i,o)})}}:{}}var Uu=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Vo=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o};function Bo(e,t){var r=Me(t);return{resourceLogs:Gu(e,r)}}function Du(e){var t,r,n=new Map;try{for(var i=Uu(e),o=i.next();!o.done;o=i.next()){var s=o.value,u=s.resource,l=s.instrumentationScope,a=l.name,c=l.version,f=c===void 0?"":c,h=l.schemaUrl,E=h===void 0?"":h,M=n.get(u);M||(M=new Map,n.set(u,M));var W=a+"@"+f+":"+E,ot=M.get(W);ot||(ot=[],M.set(W,ot)),ot.push(s)}}catch(re){t={error:re}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return n}function Gu(e,t){var r=Du(e);return Array.from(r,function(n){var i=Vo(n,2),o=i[0],s=i[1];return{resource:we(o),scopeLogs:Array.from(s,function(u){var l=Vo(u,2),a=l[1];return{scope:Ie(a[0].instrumentationScope),logRecords:a.map(function(c){return Vu(c,t)}),schemaUrl:a[0].instrumentationScope.schemaUrl}}),schemaUrl:void 0}})}function Vu(e,t){var r,n,i;return{timeUnixNano:t.encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:e.severityNumber,severityText:e.severityText,body:Ce(e.body),attributes:Bu(e.attributes),droppedAttributesCount:e.droppedAttributesCount,flags:(r=e.spanContext)===null||r===void 0?void 0:r.traceFlags,traceId:t.encodeOptionalSpanContext((n=e.spanContext)===null||n===void 0?void 0:n.traceId),spanId:t.encodeOptionalSpanContext((i=e.spanContext)===null||i===void 0?void 0:i.spanId)}}function Bu(e){return Object.keys(e).map(function(t){return Ne(t,e[t])})}d();var T;(function(e){e[e.DELTA=0]="DELTA",e[e.CUMULATIVE=1]="CUMULATIVE"})(T||(T={}));var A;(function(e){e[e.HISTOGRAM=0]="HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=1]="EXPONENTIAL_HISTOGRAM",e[e.GAUGE=2]="GAUGE",e[e.SUM=3]="SUM"})(A||(A={}));d();var Hu=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),Ho=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function u(c){try{a(n.next(c))}catch(f){s(f)}}function l(c){try{a(n.throw(c))}catch(f){s(f)}}function a(c){c.done?o(c.value):i(c.value).then(u,l)}a((n=n.apply(e,t||[])).next())})},Fo=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(c){return l([a,c])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(c){a=[6,c],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},Fu=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},ku=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},ju=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function ko(e){return e!=null}function Ue(e){var t=Object.keys(e);return t.length===0?"":(t=t.sort(),JSON.stringify(t.map(function(r){return[r,e[r]]})))}function jo(e){var t,r;return e.name+":"+((t=e.version)!==null&&t!==void 0?t:"")+":"+((r=e.schemaUrl)!==null&&r!==void 0?r:"")}var Wr=(function(e){Hu(t,e);function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return t})(Error);function j(e,t){var r,n=new Promise(function(o,s){r=setTimeout(function(){s(new Wr("Operation timed out."))},t)});return Promise.race([e,n]).then(function(i){return clearTimeout(r),i},function(i){throw clearTimeout(r),i})}function Ko(e){return Ho(this,void 0,void 0,function(){var t=this;return Fo(this,function(r){return[2,Promise.all(e.map(function(n){return Ho(t,void 0,void 0,function(){var i,o;return Fo(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,n];case 1:return i=s.sent(),[2,{status:"fulfilled",value:i}];case 2:return o=s.sent(),[2,{status:"rejected",reason:o}];case 3:return[2]}})})}))]})})}function Xo(e){return e.status==="rejected"}function zr(e,t){var r=[];return e.forEach(function(n){r.push.apply(r,ku([],Fu(t(n)),!1))}),r}function Yo(e,t){var r,n;if(e.size!==t.size)return!1;try{for(var i=ju(e),o=i.next();!o.done;o=i.next()){var s=o.value;if(!t.has(s))return!1}}catch(u){r={error:u}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!0}function Wo(e,t){for(var r=0,n=e.length-1,i=e.length;n>=r;){var o=r+Math.trunc((n-r)/2);e[o]<t?r=o+1:(i=o,n=o-1)}return i}function zo(e,t){return e.toLowerCase()===t.toLowerCase()}d();var P;(function(e){e[e.DROP=0]="DROP",e[e.SUM=1]="SUM",e[e.LAST_VALUE=2]="LAST_VALUE",e[e.HISTOGRAM=3]="HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=4]="EXPONENTIAL_HISTOGRAM"})(P||(P={}));var Jr=(function(){function e(){this.kind=P.DROP}return e.prototype.createAccumulation=function(){},e.prototype.merge=function(t,r){},e.prototype.diff=function(t,r){},e.prototype.toMetricData=function(t,r,n,i){},e})();d();var _;(function(e){e.COUNTER="COUNTER",e.GAUGE="GAUGE",e.HISTOGRAM="HISTOGRAM",e.UP_DOWN_COUNTER="UP_DOWN_COUNTER",e.OBSERVABLE_COUNTER="OBSERVABLE_COUNTER",e.OBSERVABLE_GAUGE="OBSERVABLE_GAUGE",e.OBSERVABLE_UP_DOWN_COUNTER="OBSERVABLE_UP_DOWN_COUNTER"})(_||(_={}));function G(e,t,r){var n,i,o,s;return Xu(e)||p.warn('Invalid metric name: "'+e+'". The metric name should be a ASCII string with a length no greater than 255 characters.'),{name:e,type:t,description:(n=r?.description)!==null&&n!==void 0?n:"",unit:(i=r?.unit)!==null&&i!==void 0?i:"",valueType:(o=r?.valueType)!==null&&o!==void 0?o:y.DOUBLE,advice:(s=r?.advice)!==null&&s!==void 0?s:{}}}function Jo(e,t){var r,n;return{name:(r=e.name)!==null&&r!==void 0?r:t.name,description:(n=e.description)!==null&&n!==void 0?n:t.description,type:t.type,unit:t.unit,valueType:t.valueType,advice:t.advice}}function $o(e,t){return zo(e.name,t.name)&&e.unit===t.unit&&e.type===t.type&&e.valueType===t.valueType}var Ku=/^[a-z][a-z0-9_.\-/]{0,254}$/i;function Xu(e){return e.match(Ku)!=null}var Yu=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o};function Wu(e){var t=e.map(function(){return 0});return t.push(0),{buckets:{boundaries:e,counts:t},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}var De=(function(){function e(t,r,n,i){n===void 0&&(n=!0),i===void 0&&(i=Wu(r)),this.startTime=t,this._boundaries=r,this._recordMinMax=n,this._current=i}return e.prototype.record=function(t){if(!Number.isNaN(t)){this._current.count+=1,this._current.sum+=t,this._recordMinMax&&(this._current.min=Math.min(t,this._current.min),this._current.max=Math.max(t,this._current.max),this._current.hasMinMax=!0);var r=Wo(this._boundaries,t);this._current.buckets.counts[r]+=1}},e.prototype.setStartTime=function(t){this.startTime=t},e.prototype.toPointValue=function(){return this._current},e})();var Ge=(function(){function e(t,r){this._boundaries=t,this._recordMinMax=r,this.kind=P.HISTOGRAM}return e.prototype.createAccumulation=function(t){return new De(t,this._boundaries,this._recordMinMax)},e.prototype.merge=function(t,r){for(var n=t.toPointValue(),i=r.toPointValue(),o=n.buckets.counts,s=i.buckets.counts,u=new Array(o.length),l=0;l<o.length;l++)u[l]=o[l]+s[l];var a=1/0,c=-1/0;return this._recordMinMax&&(n.hasMinMax&&i.hasMinMax?(a=Math.min(n.min,i.min),c=Math.max(n.max,i.max)):n.hasMinMax?(a=n.min,c=n.max):i.hasMinMax&&(a=i.min,c=i.max)),new De(t.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:u},count:n.count+i.count,sum:n.sum+i.sum,hasMinMax:this._recordMinMax&&(n.hasMinMax||i.hasMinMax),min:a,max:c})},e.prototype.diff=function(t,r){for(var n=t.toPointValue(),i=r.toPointValue(),o=n.buckets.counts,s=i.buckets.counts,u=new Array(o.length),l=0;l<o.length;l++)u[l]=s[l]-o[l];return new De(r.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:u},count:i.count-n.count,sum:i.sum-n.sum,hasMinMax:!1,min:1/0,max:-1/0})},e.prototype.toMetricData=function(t,r,n,i){return{descriptor:t,aggregationTemporality:r,dataPointType:A.HISTOGRAM,dataPoints:n.map(function(o){var s=Yu(o,2),u=s[0],l=s[1],a=l.toPointValue(),c=t.type===_.GAUGE||t.type===_.UP_DOWN_COUNTER||t.type===_.OBSERVABLE_GAUGE||t.type===_.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:u,startTime:l.startTime,endTime:i,value:{min:a.hasMinMax?a.min:void 0,max:a.hasMinMax?a.max:void 0,sum:c?void 0:a.sum,buckets:a.buckets,count:a.count}}})}},e})();d();var $r=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},Zr=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},qr=(function(){function e(t,r,n,i){t===void 0&&(t=new zu),r===void 0&&(r=0),n===void 0&&(n=0),i===void 0&&(i=0),this.backing=t,this.indexBase=r,this.indexStart=n,this.indexEnd=i}return Object.defineProperty(e.prototype,"offset",{get:function(){return this.indexStart},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1},enumerable:!1,configurable:!0}),e.prototype.counts=function(){var t=this;return Array.from({length:this.length},function(r,n){return t.at(n)})},e.prototype.at=function(t){var r=this.indexBase-this.indexStart;return t<r&&(t+=this.backing.length),t-=r,this.backing.countAt(t)},e.prototype.incrementBucket=function(t,r){this.backing.increment(t,r)},e.prototype.decrementBucket=function(t,r){this.backing.decrement(t,r)},e.prototype.trim=function(){for(var t=0;t<this.length;t++)if(this.at(t)!==0){this.indexStart+=t;break}else if(t===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(var t=this.length-1;t>=0;t--)if(this.at(t)!==0){this.indexEnd-=this.length-t-1;break}this._rotate()},e.prototype.downscale=function(t){this._rotate();for(var r=1+this.indexEnd-this.indexStart,n=1<<t,i=0,o=0,s=this.indexStart;s<=this.indexEnd;){var u=s%n;u<0&&(u+=n);for(var l=u;l<n&&i<r;l++)this._relocateBucket(o,i),i++,s++;o++}this.indexStart>>=t,this.indexEnd>>=t,this.indexBase=this.indexStart},e.prototype.clone=function(){return new e(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)},e.prototype._rotate=function(){var t=this.indexBase-this.indexStart;t!==0&&(t>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,t),this.backing.reverse(t,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+t)),this.indexBase=this.indexStart)},e.prototype._relocateBucket=function(t,r){t!==r&&this.incrementBucket(t,this.backing.emptyBucket(r))},e})();var zu=(function(){function e(t){t===void 0&&(t=[0]),this._counts=t}return Object.defineProperty(e.prototype,"length",{get:function(){return this._counts.length},enumerable:!1,configurable:!0}),e.prototype.countAt=function(t){return this._counts[t]},e.prototype.growTo=function(t,r,n){var i=new Array(t).fill(0);i.splice.apply(i,Zr([n,this._counts.length-r],$r(this._counts.slice(r)),!1)),i.splice.apply(i,Zr([0,r],$r(this._counts.slice(0,r)),!1)),this._counts=i},e.prototype.reverse=function(t,r){for(var n=Math.floor((t+r)/2)-t,i=0;i<n;i++){var o=this._counts[t+i];this._counts[t+i]=this._counts[r-i-1],this._counts[r-i-1]=o}},e.prototype.emptyBucket=function(t){var r=this._counts[t];return this._counts[t]=0,r},e.prototype.increment=function(t,r){this._counts[t]+=r},e.prototype.decrement=function(t,r){this._counts[t]>=r?this._counts[t]-=r:this._counts[t]=0},e.prototype.clone=function(){return new e(Zr([],$r(this._counts),!1))},e})();var Zo=52,Ju=2146435072,$u=1048575,Qr=1023,Ve=-Qr+1,Be=Qr,Xt=Math.pow(2,-1022);function He(e){var t=new DataView(new ArrayBuffer(8));t.setFloat64(0,e);var r=t.getUint32(0),n=(r&Ju)>>20;return n-Qr}function Fe(e){var t=new DataView(new ArrayBuffer(8));t.setFloat64(0,e);var r=t.getUint32(0),n=t.getUint32(4),i=(r&$u)*Math.pow(2,32);return i+n}function Yt(e,t){return e===0||e===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY||Number.isNaN(e)?e:e*Math.pow(2,t)}function Qo(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}var Zu=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),K=(function(e){Zu(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t})(Error);var ei=(function(){function e(t){this._shift=-t}return e.prototype.mapToIndex=function(t){if(t<Xt)return this._minNormalLowerBoundaryIndex();var r=He(t),n=this._rightShift(Fe(t)-1,Zo);return r+n>>this._shift},e.prototype.lowerBoundary=function(t){var r=this._minNormalLowerBoundaryIndex();if(t<r)throw new K("underflow: "+t+" is < minimum lower boundary: "+r);var n=this._maxNormalLowerBoundaryIndex();if(t>n)throw new K("overflow: "+t+" is > maximum lower boundary: "+n);return Yt(1,t<<this._shift)},Object.defineProperty(e.prototype,"scale",{get:function(){return this._shift===0?0:-this._shift},enumerable:!1,configurable:!0}),e.prototype._minNormalLowerBoundaryIndex=function(){var t=Ve>>this._shift;return this._shift<2&&t--,t},e.prototype._maxNormalLowerBoundaryIndex=function(){return Be>>this._shift},e.prototype._rightShift=function(t,r){return Math.floor(t*Math.pow(2,-r))},e})();var ri=(function(){function e(t){this._scale=t,this._scaleFactor=Yt(Math.LOG2E,t),this._inverseFactor=Yt(Math.LN2,-t)}return e.prototype.mapToIndex=function(t){if(t<=Xt)return this._minNormalLowerBoundaryIndex()-1;if(Fe(t)===0){var r=He(t);return(r<<this._scale)-1}var n=Math.floor(Math.log(t)*this._scaleFactor),i=this._maxNormalLowerBoundaryIndex();return n>=i?i:n},e.prototype.lowerBoundary=function(t){var r=this._maxNormalLowerBoundaryIndex();if(t>=r){if(t===r)return 2*Math.exp((t-(1<<this._scale))/this._scaleFactor);throw new K("overflow: "+t+" is > maximum lower boundary: "+r)}var n=this._minNormalLowerBoundaryIndex();if(t<=n){if(t===n)return Xt;if(t===n-1)return Math.exp((t+(1<<this._scale))/this._scaleFactor)/2;throw new K("overflow: "+t+" is < minimum lower boundary: "+n)}return Math.exp(t*this._inverseFactor)},Object.defineProperty(e.prototype,"scale",{get:function(){return this._scale},enumerable:!1,configurable:!0}),e.prototype._minNormalLowerBoundaryIndex=function(){return Ve<<this._scale},e.prototype._maxNormalLowerBoundaryIndex=function(){return(Be+1<<this._scale)-1},e})();var ni=-10,oi=20,qu=Array.from({length:31},function(e,t){return t>10?new ri(t-10):new ei(t-10)});function tn(e){if(e>oi||e<ni)throw new K("expected scale >= "+ni+" && <= "+oi+", got: "+e);return qu[e+10]}var Qu=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},ke=(function(){function e(t,r){this.low=t,this.high=r}return e.combine=function(t,r){return new e(Math.min(t.low,r.low),Math.max(t.high,r.high))},e})(),tc=20,ec=160,en=2,ii=(function(){function e(t,r,n,i,o,s,u,l,a,c,f){t===void 0&&(t=t),r===void 0&&(r=ec),n===void 0&&(n=!0),i===void 0&&(i=0),o===void 0&&(o=0),s===void 0&&(s=0),u===void 0&&(u=Number.POSITIVE_INFINITY),l===void 0&&(l=Number.NEGATIVE_INFINITY),a===void 0&&(a=new qr),c===void 0&&(c=new qr),f===void 0&&(f=tn(tc)),this.startTime=t,this._maxSize=r,this._recordMinMax=n,this._sum=i,this._count=o,this._zeroCount=s,this._min=u,this._max=l,this._positive=a,this._negative=c,this._mapping=f,this._maxSize<en&&(p.warn("Exponential Histogram Max Size set to "+this._maxSize+", changing to the minimum size of: "+en),this._maxSize=en)}return e.prototype.record=function(t){this.updateByIncrement(t,1)},e.prototype.setStartTime=function(t){this.startTime=t},e.prototype.toPointValue=function(){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}},Object.defineProperty(e.prototype,"sum",{get:function(){return this._sum},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"min",{get:function(){return this._min},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"max",{get:function(){return this._max},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"zeroCount",{get:function(){return this._zeroCount},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scale",{get:function(){return this._count===this._zeroCount?0:this._mapping.scale},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"positive",{get:function(){return this._positive},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"negative",{get:function(){return this._negative},enumerable:!1,configurable:!0}),e.prototype.updateByIncrement=function(t,r){if(!Number.isNaN(t)){if(t>this._max&&(this._max=t),t<this._min&&(this._min=t),this._count+=r,t===0){this._zeroCount+=r;return}this._sum+=t*r,t>0?this._updateBuckets(this._positive,t,r):this._updateBuckets(this._negative,-t,r)}},e.prototype.merge=function(t){this._count===0?(this._min=t.min,this._max=t.max):t.count!==0&&(t.min<this.min&&(this._min=t.min),t.max>this.max&&(this._max=t.max)),this.startTime=t.startTime,this._sum+=t.sum,this._count+=t.count,this._zeroCount+=t.zeroCount;var r=this._minScale(t);this._downscale(this.scale-r),this._mergeBuckets(this.positive,t,t.positive,r),this._mergeBuckets(this.negative,t,t.negative,r)},e.prototype.diff=function(t){this._min=1/0,this._max=-1/0,this._sum-=t.sum,this._count-=t.count,this._zeroCount-=t.zeroCount;var r=this._minScale(t);this._downscale(this.scale-r),this._diffBuckets(this.positive,t,t.positive,r),this._diffBuckets(this.negative,t,t.negative,r)},e.prototype.clone=function(){return new e(this.startTime,this._maxSize,this._recordMinMax,this._sum,this._count,this._zeroCount,this._min,this._max,this.positive.clone(),this.negative.clone(),this._mapping)},e.prototype._updateBuckets=function(t,r,n){var i=this._mapping.mapToIndex(r),o=!1,s=0,u=0;if(t.length===0?(t.indexStart=i,t.indexEnd=t.indexStart,t.indexBase=t.indexStart):i<t.indexStart&&t.indexEnd-i>=this._maxSize?(o=!0,u=i,s=t.indexEnd):i>t.indexEnd&&i-t.indexStart>=this._maxSize&&(o=!0,u=t.indexStart,s=i),o){var l=this._changeScale(s,u);this._downscale(l),i=this._mapping.mapToIndex(r)}this._incrementIndexBy(t,i,n)},e.prototype._incrementIndexBy=function(t,r,n){if(n!==0){if(t.length===0&&(t.indexStart=t.indexEnd=t.indexBase=r),r<t.indexStart){var i=t.indexEnd-r;i>=t.backing.length&&this._grow(t,i+1),t.indexStart=r}else if(r>t.indexEnd){var i=r-t.indexStart;i>=t.backing.length&&this._grow(t,i+1),t.indexEnd=r}var o=r-t.indexBase;o<0&&(o+=t.backing.length),t.incrementBucket(o,n)}},e.prototype._grow=function(t,r){var n=t.backing.length,i=t.indexBase-t.indexStart,o=n-i,s=Qo(r);s>this._maxSize&&(s=this._maxSize);var u=s-i;t.backing.growTo(s,o,u)},e.prototype._changeScale=function(t,r){for(var n=0;t-r>=this._maxSize;)t>>=1,r>>=1,n++;return n},e.prototype._downscale=function(t){if(t!==0){if(t<0)throw new Error("impossible change of scale: "+this.scale);var r=this._mapping.scale-t;this._positive.downscale(t),this._negative.downscale(t),this._mapping=tn(r)}},e.prototype._minScale=function(t){var r=Math.min(this.scale,t.scale),n=ke.combine(this._highLowAtScale(this.positive,this.scale,r),this._highLowAtScale(t.positive,t.scale,r)),i=ke.combine(this._highLowAtScale(this.negative,this.scale,r),this._highLowAtScale(t.negative,t.scale,r));return Math.min(r-this._changeScale(n.high,n.low),r-this._changeScale(i.high,i.low))},e.prototype._highLowAtScale=function(t,r,n){if(t.length===0)return new ke(0,-1);var i=r-n;return new ke(t.indexStart>>i,t.indexEnd>>i)},e.prototype._mergeBuckets=function(t,r,n,i){for(var o=n.offset,s=r.scale-i,u=0;u<n.length;u++)this._incrementIndexBy(t,o+u>>s,n.at(u))},e.prototype._diffBuckets=function(t,r,n,i){for(var o=n.offset,s=r.scale-i,u=0;u<n.length;u++){var l=o+u>>s,a=l-t.indexBase;a<0&&(a+=t.backing.length),t.decrementBucket(a,n.at(u))}t.trim()},e})();var rn=(function(){function e(t,r){this._maxSize=t,this._recordMinMax=r,this.kind=P.EXPONENTIAL_HISTOGRAM}return e.prototype.createAccumulation=function(t){return new ii(t,this._maxSize,this._recordMinMax)},e.prototype.merge=function(t,r){var n=r.clone();return n.merge(t),n},e.prototype.diff=function(t,r){var n=r.clone();return n.diff(t),n},e.prototype.toMetricData=function(t,r,n,i){return{descriptor:t,aggregationTemporality:r,dataPointType:A.EXPONENTIAL_HISTOGRAM,dataPoints:n.map(function(o){var s=Qu(o,2),u=s[0],l=s[1],a=l.toPointValue(),c=t.type===_.GAUGE||t.type===_.UP_DOWN_COUNTER||t.type===_.OBSERVABLE_GAUGE||t.type===_.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:u,startTime:l.startTime,endTime:i,value:{min:a.hasMinMax?a.min:void 0,max:a.hasMinMax?a.max:void 0,sum:c?void 0:a.sum,positive:{offset:a.positive.offset,bucketCounts:a.positive.bucketCounts},negative:{offset:a.negative.offset,bucketCounts:a.negative.bucketCounts},count:a.count,scale:a.scale,zeroCount:a.zeroCount}}})}},e})();var rc=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},je=(function(){function e(t,r,n){r===void 0&&(r=0),n===void 0&&(n=[0,0]),this.startTime=t,this._current=r,this.sampleTime=n}return e.prototype.record=function(t){this._current=t,this.sampleTime=w(Date.now())},e.prototype.setStartTime=function(t){this.startTime=t},e.prototype.toPointValue=function(){return this._current},e})();var nn=(function(){function e(){this.kind=P.LAST_VALUE}return e.prototype.createAccumulation=function(t){return new je(t)},e.prototype.merge=function(t,r){var n=k(r.sampleTime)>=k(t.sampleTime)?r:t;return new je(t.startTime,n.toPointValue(),n.sampleTime)},e.prototype.diff=function(t,r){var n=k(r.sampleTime)>=k(t.sampleTime)?r:t;return new je(r.startTime,n.toPointValue(),n.sampleTime)},e.prototype.toMetricData=function(t,r,n,i){return{descriptor:t,aggregationTemporality:r,dataPointType:A.GAUGE,dataPoints:n.map(function(o){var s=rc(o,2),u=s[0],l=s[1];return{attributes:u,startTime:l.startTime,endTime:i,value:l.toPointValue()}})}},e})();var nc=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},_t=(function(){function e(t,r,n,i){n===void 0&&(n=0),i===void 0&&(i=!1),this.startTime=t,this.monotonic=r,this._current=n,this.reset=i}return e.prototype.record=function(t){this.monotonic&&t<0||(this._current+=t)},e.prototype.setStartTime=function(t){this.startTime=t},e.prototype.toPointValue=function(){return this._current},e})();var Ke=(function(){function e(t){this.monotonic=t,this.kind=P.SUM}return e.prototype.createAccumulation=function(t){return new _t(t,this.monotonic)},e.prototype.merge=function(t,r){var n=t.toPointValue(),i=r.toPointValue();return r.reset?new _t(r.startTime,this.monotonic,i,r.reset):new _t(t.startTime,this.monotonic,n+i)},e.prototype.diff=function(t,r){var n=t.toPointValue(),i=r.toPointValue();return this.monotonic&&n>i?new _t(r.startTime,this.monotonic,i,!0):new _t(r.startTime,this.monotonic,i-n)},e.prototype.toMetricData=function(t,r,n,i){return{descriptor:t,aggregationTemporality:r,dataPointType:A.SUM,dataPoints:n.map(function(o){var s=nc(o,2),u=s[0],l=s[1];return{attributes:u,startTime:l.startTime,endTime:i,value:l.toPointValue()}}),isMonotonic:this.monotonic}},e})();var et=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),O=(function(){function e(){}return e.Drop=function(){return pi},e.Sum=function(){return _i},e.LastValue=function(){return hi},e.Histogram=function(){return di},e.ExponentialHistogram=function(){return oc},e.Default=function(){return ic},e})();var ai=(function(e){et(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.createAggregator=function(r){return t.DEFAULT_INSTANCE},t.DEFAULT_INSTANCE=new Jr,t})(O);var Wt=(function(e){et(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.createAggregator=function(r){switch(r.type){case _.COUNTER:case _.OBSERVABLE_COUNTER:case _.HISTOGRAM:return t.MONOTONIC_INSTANCE;default:return t.NON_MONOTONIC_INSTANCE}},t.MONOTONIC_INSTANCE=new Ke(!0),t.NON_MONOTONIC_INSTANCE=new Ke(!1),t})(O);var si=(function(e){et(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.createAggregator=function(r){return t.DEFAULT_INSTANCE},t.DEFAULT_INSTANCE=new nn,t})(O);var ui=(function(e){et(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.createAggregator=function(r){return t.DEFAULT_INSTANCE},t.DEFAULT_INSTANCE=new Ge([0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],!0),t})(O);var ci=(function(e){et(t,e);function t(r,n){n===void 0&&(n=!0);var i=e.call(this)||this;if(i._recordMinMax=n,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(function(u,l){return u-l});var o=r.lastIndexOf(-1/0),s=r.indexOf(1/0);return s===-1&&(s=void 0),i._boundaries=r.slice(o+1,s),i}return t.prototype.createAggregator=function(r){return new Ge(this._boundaries,this._recordMinMax)},t})(O);var li=(function(e){et(t,e);function t(r,n){r===void 0&&(r=160),n===void 0&&(n=!0);var i=e.call(this)||this;return i._maxSize=r,i._recordMinMax=n,i}return t.prototype.createAggregator=function(r){return new rn(this._maxSize,this._recordMinMax)},t})(O);var fi=(function(e){et(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype._resolve=function(r){switch(r.type){case _.COUNTER:case _.UP_DOWN_COUNTER:case _.OBSERVABLE_COUNTER:case _.OBSERVABLE_UP_DOWN_COUNTER:return _i;case _.GAUGE:case _.OBSERVABLE_GAUGE:return hi;case _.HISTOGRAM:return r.advice.explicitBucketBoundaries?new ci(r.advice.explicitBucketBoundaries):di}return p.warn("Unable to recognize instrument type: "+r.type),pi},t.prototype.createAggregator=function(r){return this._resolve(r).createAggregator(r)},t})(O);var pi=new ai,_i=new Wt,hi=new si,di=new ui,oc=new li,ic=new fi;var mi=function(e){return O.Default()},Ei=function(e){return T.CUMULATIVE};var on=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function u(c){try{a(n.next(c))}catch(f){s(f)}}function l(c){try{a(n.throw(c))}catch(f){s(f)}}function a(c){c.done?o(c.value):i(c.value).then(u,l)}a((n=n.apply(e,t||[])).next())})},an=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(c){return l([a,c])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(c){a=[6,c],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},vi=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},ac=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},gi=(function(){function e(t){var r,n,i;this._shutdown=!1,this._aggregationSelector=(r=t?.aggregationSelector)!==null&&r!==void 0?r:mi,this._aggregationTemporalitySelector=(n=t?.aggregationTemporalitySelector)!==null&&n!==void 0?n:Ei,this._metricProducers=(i=t?.metricProducers)!==null&&i!==void 0?i:[],this._cardinalitySelector=t?.cardinalitySelector}return e.prototype.setMetricProducer=function(t){if(this._sdkMetricProducer)throw new Error("MetricReader can not be bound to a MeterProvider again.");this._sdkMetricProducer=t,this.onInitialized()},e.prototype.selectAggregation=function(t){return this._aggregationSelector(t)},e.prototype.selectAggregationTemporality=function(t){return this._aggregationTemporalitySelector(t)},e.prototype.selectCardinalityLimit=function(t){return this._cardinalitySelector?this._cardinalitySelector(t):2e3},e.prototype.onInitialized=function(){},e.prototype.collect=function(t){return on(this,void 0,void 0,function(){var r,n,i,o,s,u;return an(this,function(l){switch(l.label){case 0:if(this._sdkMetricProducer===void 0)throw new Error("MetricReader is not bound to a MetricProducer");if(this._shutdown)throw new Error("MetricReader is shutdown");return[4,Promise.all(ac([this._sdkMetricProducer.collect({timeoutMillis:t?.timeoutMillis})],vi(this._metricProducers.map(function(a){return a.collect({timeoutMillis:t?.timeoutMillis})})),!1))];case 1:return r=vi.apply(void 0,[l.sent()]),n=r[0],i=r.slice(1),o=n.errors.concat(zr(i,function(a){return a.errors})),s=n.resourceMetrics.resource,u=n.resourceMetrics.scopeMetrics.concat(zr(i,function(a){return a.resourceMetrics.scopeMetrics})),[2,{resourceMetrics:{resource:s,scopeMetrics:u},errors:o}]}})})},e.prototype.shutdown=function(t){return on(this,void 0,void 0,function(){return an(this,function(r){switch(r.label){case 0:return this._shutdown?(p.error("Cannot call shutdown twice."),[2]):t?.timeoutMillis!=null?[3,2]:[4,this.onShutdown()];case 1:return r.sent(),[3,4];case 2:return[4,j(this.onShutdown(),t.timeoutMillis)];case 3:r.sent(),r.label=4;case 4:return this._shutdown=!0,[2]}})})},e.prototype.forceFlush=function(t){return on(this,void 0,void 0,function(){return an(this,function(r){switch(r.label){case 0:return this._shutdown?(p.warn("Cannot forceFlush on already shutdown MetricReader."),[2]):t?.timeoutMillis!=null?[3,2]:[4,this.onForceFlush()];case 1:return r.sent(),[2];case 2:return[4,j(this.onForceFlush(),t.timeoutMillis)];case 3:return r.sent(),[2]}})})},e})();d();var sc=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),Xe=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function u(c){try{a(n.next(c))}catch(f){s(f)}}function l(c){try{a(n.throw(c))}catch(f){s(f)}}function a(c){c.done?o(c.value):i(c.value).then(u,l)}a((n=n.apply(e,t||[])).next())})},Ye=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(c){return l([a,c])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(c){a=[6,c],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},uc=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},cc=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},sn=(function(e){sc(t,e);function t(r){var n,i,o,s,u=e.call(this,{aggregationSelector:(n=r.exporter.selectAggregation)===null||n===void 0?void 0:n.bind(r.exporter),aggregationTemporalitySelector:(i=r.exporter.selectAggregationTemporality)===null||i===void 0?void 0:i.bind(r.exporter),metricProducers:r.metricProducers})||this;if(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");return u._exportInterval=(o=r.exportIntervalMillis)!==null&&o!==void 0?o:6e4,u._exportTimeout=(s=r.exportTimeoutMillis)!==null&&s!==void 0?s:3e4,u._exporter=r.exporter,u}return t.prototype._runOnce=function(){return Xe(this,void 0,void 0,function(){var r;return Ye(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,j(this._doRun(),this._exportTimeout)];case 1:return n.sent(),[3,3];case 2:return r=n.sent(),r instanceof Wr?(p.error("Export took longer than %s milliseconds and timed out.",this._exportTimeout),[2]):(H(r),[3,3]);case 3:return[2]}})})},t.prototype._doRun=function(){var r,n;return Xe(this,void 0,void 0,function(){var i,o,s,u,l,a;return Ye(this,function(c){switch(c.label){case 0:return[4,this.collect({timeoutMillis:this._exportTimeout})];case 1:if(i=c.sent(),o=i.resourceMetrics,s=i.errors,s.length>0&&(a=p).error.apply(a,cc(["PeriodicExportingMetricReader: metrics collection errors"],uc(s),!1)),!o.resource.asyncAttributesPending)return[3,5];c.label=2;case 2:return c.trys.push([2,4,,5]),[4,(n=(r=o.resource).waitForAsyncAttributes)===null||n===void 0?void 0:n.call(r)];case 3:return c.sent(),[3,5];case 4:return u=c.sent(),p.debug("Error while resolving async portion of resource: ",u),H(u),[3,5];case 5:return o.scopeMetrics.length===0?[2]:[4,be._export(this._exporter,o)];case 6:if(l=c.sent(),l.code!==S.SUCCESS)throw new Error("PeriodicExportingMetricReader: metrics export failed (error "+l.error+")");return[2]}})})},t.prototype.onInitialized=function(){var r=this;this._interval=setInterval(function(){r._runOnce()},this._exportInterval),Q(this._interval)},t.prototype.onForceFlush=function(){return Xe(this,void 0,void 0,function(){return Ye(this,function(r){switch(r.label){case 0:return[4,this._runOnce()];case 1:return r.sent(),[4,this._exporter.forceFlush()];case 2:return r.sent(),[2]}})})},t.prototype.onShutdown=function(){return Xe(this,void 0,void 0,function(){return Ye(this,function(r){switch(r.label){case 0:return this._interval&&clearInterval(this._interval),[4,this.onForceFlush()];case 1:return r.sent(),[4,this._exporter.shutdown()];case 2:return r.sent(),[2]}})})},t})(gi);d();d();function We(){return"unknown_service:"+process.argv0}var X=function(){return X=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},X.apply(this,arguments)},lc=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function u(c){try{a(n.next(c))}catch(f){s(f)}}function l(c){try{a(n.throw(c))}catch(f){s(f)}}function a(c){c.done?o(c.value):i(c.value).then(u,l)}a((n=n.apply(e,t||[])).next())})},fc=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(c){return l([a,c])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(c){a=[6,c],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},pc=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},I=(function(){function e(t,r){var n=this,i;this._attributes=t,this.asyncAttributesPending=r!=null,this._syncAttributes=(i=this._attributes)!==null&&i!==void 0?i:{},this._asyncAttributesPromise=r?.then(function(o){return n._attributes=Object.assign({},n._attributes,o),n.asyncAttributesPending=!1,o},function(o){return p.debug("a resource's async attributes promise rejected: %s",o),n.asyncAttributesPending=!1,{}})}return e.empty=function(){return e.EMPTY},e.default=function(){var t;return new e((t={},t[Eo]=We(),t[Vt]=q[Vt],t[Gt]=q[Gt],t[Bt]=q[Bt],t))},Object.defineProperty(e.prototype,"attributes",{get:function(){var t;return this.asyncAttributesPending&&p.error("Accessing resource attributes before async attributes settled"),(t=this._attributes)!==null&&t!==void 0?t:{}},enumerable:!1,configurable:!0}),e.prototype.waitForAsyncAttributes=function(){return lc(this,void 0,void 0,function(){return fc(this,function(t){switch(t.label){case 0:return this.asyncAttributesPending?[4,this._asyncAttributesPromise]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},e.prototype.merge=function(t){var r=this,n;if(!t)return this;var i=X(X({},this._syncAttributes),(n=t._syncAttributes)!==null&&n!==void 0?n:t.attributes);if(!this._asyncAttributesPromise&&!t._asyncAttributesPromise)return new e(i);var o=Promise.all([this._asyncAttributesPromise,t._asyncAttributesPromise]).then(function(s){var u,l=pc(s,2),a=l[0],c=l[1];return X(X(X(X({},r._syncAttributes),a),(u=t._syncAttributes)!==null&&u!==void 0?u:t.attributes),c)});return new e(i,o)},e.EMPTY=new e({}),e})();var Ti=(function(){function e(){this._registeredViews=[]}return e.prototype.addView=function(t){this._registeredViews.push(t)},e.prototype.findViews=function(t,r){var n=this,i=this._registeredViews.filter(function(o){return n._matchInstrument(o.instrumentSelector,t)&&n._matchMeter(o.meterSelector,r)});return i},e.prototype._matchInstrument=function(t,r){return(t.getType()===void 0||r.type===t.getType())&&t.getNameFilter().match(r.name)&&t.getUnitFilter().match(r.unit)},e.prototype._matchMeter=function(t,r){return t.getNameFilter().match(r.name)&&(r.version===void 0||t.getVersionFilter().match(r.version))&&(r.schemaUrl===void 0||t.getSchemaUrlFilter().match(r.schemaUrl))},e})();d();var rt=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),ze=(function(){function e(t,r){this._writableMetricStorage=t,this._descriptor=r}return e.prototype._record=function(t,r,n){if(r===void 0&&(r={}),n===void 0&&(n=L.active()),typeof t!="number"){p.warn("non-number value provided to metric "+this._descriptor.name+": "+t);return}this._descriptor.valueType===y.INT&&!Number.isInteger(t)&&(p.warn("INT value type cannot accept a floating-point value for "+this._descriptor.name+", ignoring the fractional digits."),t=Math.trunc(t),!Number.isInteger(t))||this._writableMetricStorage.record(t,r,n,w(Date.now()))},e})();var Si=(function(e){rt(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.add=function(r,n,i){this._record(r,n,i)},t})(ze);var yi=(function(e){rt(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.add=function(r,n,i){if(r<0){p.warn("negative value provided to counter "+this._descriptor.name+": "+r);return}this._record(r,n,i)},t})(ze);var Ai=(function(e){rt(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.record=function(r,n,i){this._record(r,n,i)},t})(ze);var Oi=(function(e){rt(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.record=function(r,n,i){if(r<0){p.warn("negative value provided to histogram "+this._descriptor.name+": "+r);return}this._record(r,n,i)},t})(ze);var Je=(function(){function e(t,r,n){this._observableRegistry=n,this._descriptor=t,this._metricStorages=r}return e.prototype.addCallback=function(t){this._observableRegistry.addCallback(t,this)},e.prototype.removeCallback=function(t){this._observableRegistry.removeCallback(t,this)},e})();var Ri=(function(e){rt(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t})(Je);var xi=(function(e){rt(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t})(Je);var Li=(function(e){rt(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t})(Je);function zt(e){return e instanceof Je}var Pi=(function(){function e(t){this._meterSharedState=t}return e.prototype.createGauge=function(t,r){var n=G(t,_.GAUGE,r),i=this._meterSharedState.registerMetricStorage(n);return new Ai(i,n)},e.prototype.createHistogram=function(t,r){var n=G(t,_.HISTOGRAM,r),i=this._meterSharedState.registerMetricStorage(n);return new Oi(i,n)},e.prototype.createCounter=function(t,r){var n=G(t,_.COUNTER,r),i=this._meterSharedState.registerMetricStorage(n);return new yi(i,n)},e.prototype.createUpDownCounter=function(t,r){var n=G(t,_.UP_DOWN_COUNTER,r),i=this._meterSharedState.registerMetricStorage(n);return new Si(i,n)},e.prototype.createObservableGauge=function(t,r){var n=G(t,_.OBSERVABLE_GAUGE,r),i=this._meterSharedState.registerAsyncMetricStorage(n);return new xi(n,i,this._meterSharedState.observableRegistry)},e.prototype.createObservableCounter=function(t,r){var n=G(t,_.OBSERVABLE_COUNTER,r),i=this._meterSharedState.registerAsyncMetricStorage(n);return new Ri(n,i,this._meterSharedState.observableRegistry)},e.prototype.createObservableUpDownCounter=function(t,r){var n=G(t,_.OBSERVABLE_UP_DOWN_COUNTER,r),i=this._meterSharedState.registerAsyncMetricStorage(n);return new Li(n,i,this._meterSharedState.observableRegistry)},e.prototype.addBatchObservableCallback=function(t,r){this._meterSharedState.observableRegistry.addBatchCallback(t,r)},e.prototype.removeBatchObservableCallback=function(t,r){this._meterSharedState.observableRegistry.removeBatchCallback(t,r)},e})();var $e=(function(){function e(t){this._instrumentDescriptor=t}return e.prototype.getInstrumentDescriptor=function(){return this._instrumentDescriptor},e.prototype.updateDescription=function(t){this._instrumentDescriptor=G(this._instrumentDescriptor.name,this._instrumentDescriptor.type,{description:t,valueType:this._instrumentDescriptor.valueType,unit:this._instrumentDescriptor.unit,advice:this._instrumentDescriptor.advice})},e})();var _c=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),bi=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(c){return l([a,c])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(c){a=[6,c],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},hc=(function(){function e(t){this._hash=t,this._valueMap=new Map,this._keyMap=new Map}return e.prototype.get=function(t,r){return r??(r=this._hash(t)),this._valueMap.get(r)},e.prototype.getOrDefault=function(t,r){var n=this._hash(t);if(this._valueMap.has(n))return this._valueMap.get(n);var i=r();return this._keyMap.has(n)||this._keyMap.set(n,t),this._valueMap.set(n,i),i},e.prototype.set=function(t,r,n){n??(n=this._hash(t)),this._keyMap.has(n)||this._keyMap.set(n,t),this._valueMap.set(n,r)},e.prototype.has=function(t,r){return r??(r=this._hash(t)),this._valueMap.has(r)},e.prototype.keys=function(){var t,r;return bi(this,function(n){switch(n.label){case 0:t=this._keyMap.entries(),r=t.next(),n.label=1;case 1:return r.done===!0?[3,3]:[4,[r.value[1],r.value[0]]];case 2:return n.sent(),r=t.next(),[3,1];case 3:return[2]}})},e.prototype.entries=function(){var t,r;return bi(this,function(n){switch(n.label){case 0:t=this._valueMap.entries(),r=t.next(),n.label=1;case 1:return r.done===!0?[3,3]:[4,[this._keyMap.get(r.value[0]),r.value[1],r.value[0]]];case 2:return n.sent(),r=t.next(),[3,1];case 3:return[2]}})},Object.defineProperty(e.prototype,"size",{get:function(){return this._valueMap.size},enumerable:!1,configurable:!0}),e})();var N=(function(e){_c(t,e);function t(){return e.call(this,Ue)||this}return t})(hc);var dc=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},Ze=(function(){function e(t,r){this._aggregator=t,this._activeCollectionStorage=new N,this._cumulativeMemoStorage=new N,this._overflowAttributes={"otel.metric.overflow":!0},this._cardinalityLimit=(r??2e3)-1,this._overflowHashCode=Ue(this._overflowAttributes)}return e.prototype.record=function(t,r,n,i){var o=this,s=this._activeCollectionStorage.get(r);if(!s){if(this._activeCollectionStorage.size>=this._cardinalityLimit){var u=this._activeCollectionStorage.getOrDefault(this._overflowAttributes,function(){return o._aggregator.createAccumulation(i)});u?.record(t);return}s=this._aggregator.createAccumulation(i),this._activeCollectionStorage.set(r,s)}s?.record(t)},e.prototype.batchCumulate=function(t,r){var n=this;Array.from(t.entries()).forEach(function(i){var o=dc(i,3),s=o[0],u=o[1],l=o[2],a=n._aggregator.createAccumulation(r);a?.record(u);var c=a;if(n._cumulativeMemoStorage.has(s,l)){var f=n._cumulativeMemoStorage.get(s,l);c=n._aggregator.diff(f,a)}else if(n._cumulativeMemoStorage.size>=n._cardinalityLimit&&(s=n._overflowAttributes,l=n._overflowHashCode,n._cumulativeMemoStorage.has(s,l))){var f=n._cumulativeMemoStorage.get(s,l);c=n._aggregator.diff(f,a)}if(n._activeCollectionStorage.has(s,l)){var h=n._activeCollectionStorage.get(s,l);c=n._aggregator.merge(h,c)}n._cumulativeMemoStorage.set(s,a,l),n._activeCollectionStorage.set(s,c,l)})},e.prototype.collect=function(){var t=this._activeCollectionStorage;return this._activeCollectionStorage=new N,t},e})();var un=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Mi=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},qe=(function(){function e(t,r){var n=this;this._aggregator=t,this._unreportedAccumulations=new Map,this._reportHistory=new Map,r.forEach(function(i){n._unreportedAccumulations.set(i,[])})}return e.prototype.buildMetrics=function(t,r,n,i){this._stashAccumulations(n);var o=this._getMergedUnreportedAccumulations(t),s=o,u;if(this._reportHistory.has(t)){var l=this._reportHistory.get(t),a=l.collectionTime;u=l.aggregationTemporality,u===T.CUMULATIVE?s=e.merge(l.accumulations,o,this._aggregator):s=e.calibrateStartTime(l.accumulations,o,a)}else u=t.selectAggregationTemporality(r.type);this._reportHistory.set(t,{accumulations:s,collectionTime:i,aggregationTemporality:u});var c=mc(s);if(c.length!==0)return this._aggregator.toMetricData(r,u,c,i)},e.prototype._stashAccumulations=function(t){var r,n,i=this._unreportedAccumulations.keys();try{for(var o=un(i),s=o.next();!s.done;s=o.next()){var u=s.value,l=this._unreportedAccumulations.get(u);l===void 0&&(l=[],this._unreportedAccumulations.set(u,l)),l.push(t)}}catch(a){r={error:a}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},e.prototype._getMergedUnreportedAccumulations=function(t){var r,n,i=new N,o=this._unreportedAccumulations.get(t);if(this._unreportedAccumulations.set(t,[]),o===void 0)return i;try{for(var s=un(o),u=s.next();!u.done;u=s.next()){var l=u.value;i=e.merge(i,l,this._aggregator)}}catch(a){r={error:a}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return i},e.merge=function(t,r,n){for(var i=t,o=r.entries(),s=o.next();s.done!==!0;){var u=Mi(s.value,3),l=u[0],a=u[1],c=u[2];if(t.has(l,c)){var f=t.get(l,c),h=n.merge(f,a);i.set(l,h,c)}else i.set(l,a,c);s=o.next()}return i},e.calibrateStartTime=function(t,r,n){var i,o;try{for(var s=un(t.keys()),u=s.next();!u.done;u=s.next()){var l=Mi(u.value,2),a=l[0],c=l[1],f=r.get(a,c);f?.setStartTime(n)}}catch(h){i={error:h}}finally{try{u&&!u.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}return r},e})();function mc(e){return Array.from(e.entries())}var Ec=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),vc=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},wi=(function(e){Ec(t,e);function t(r,n,i,o,s){var u=e.call(this,r)||this;return u._attributesProcessor=i,u._aggregationCardinalityLimit=s,u._deltaMetricStorage=new Ze(n,u._aggregationCardinalityLimit),u._temporalMetricStorage=new qe(n,o),u}return t.prototype.record=function(r,n){var i=this,o=new N;Array.from(r.entries()).forEach(function(s){var u=vc(s,2),l=u[0],a=u[1];o.set(i._attributesProcessor.process(l),a)}),this._deltaMetricStorage.batchCumulate(o,n)},t.prototype.collect=function(r,n){var i=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(r,this._instrumentDescriptor,i,n)},t})($e);d();function cn(e,t){var r="";return e.unit!==t.unit&&(r+=" - Unit '"+e.unit+"' does not match '"+t.unit+`'
4
+ `),e.type!==t.type&&(r+=" - Type '"+e.type+"' does not match '"+t.type+`'
5
+ `),e.valueType!==t.valueType&&(r+=" - Value Type '"+e.valueType+"' does not match '"+t.valueType+`'
6
+ `),e.description!==t.description&&(r+=" - Description '"+e.description+"' does not match '"+t.description+`'
7
+ `),r}function gc(e,t){return" - use valueType '"+e.valueType+"' on instrument creation or use an instrument name other than '"+t.name+"'"}function Tc(e,t){return" - use unit '"+e.unit+"' on instrument creation or use an instrument name other than '"+t.name+"'"}function Sc(e,t){var r={name:t.name,type:t.type,unit:t.unit},n=JSON.stringify(r);return" - create a new view with a name other than '"+e.name+"' and InstrumentSelector '"+n+"'"}function yc(e,t){var r={name:t.name,type:t.type,unit:t.unit},n=JSON.stringify(r);return" - create a new view with a name other than '"+e.name+"' and InstrumentSelector '"+n+`'
8
+ - OR - create a new view with the name `+e.name+" and description '"+e.description+"' and InstrumentSelector "+n+`
9
+ - OR - create a new view with the name `+t.name+" and description '"+e.description+"' and InstrumentSelector "+n}function ln(e,t){return e.valueType!==t.valueType?gc(e,t):e.unit!==t.unit?Tc(e,t):e.type!==t.type?Sc(e,t):e.description!==t.description?yc(e,t):""}var fn=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Ii=(function(){function e(){this._sharedRegistry=new Map,this._perCollectorRegistry=new Map}return e.create=function(){return new e},e.prototype.getStorages=function(t){var r,n,i,o,s=[];try{for(var u=fn(this._sharedRegistry.values()),l=u.next();!l.done;l=u.next()){var a=l.value;s=s.concat(a)}}catch(E){r={error:E}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}var c=this._perCollectorRegistry.get(t);if(c!=null)try{for(var f=fn(c.values()),h=f.next();!h.done;h=f.next()){var a=h.value;s=s.concat(a)}}catch(E){i={error:E}}finally{try{h&&!h.done&&(o=f.return)&&o.call(f)}finally{if(i)throw i.error}}return s},e.prototype.register=function(t){this._registerStorage(t,this._sharedRegistry)},e.prototype.registerForCollector=function(t,r){var n=this._perCollectorRegistry.get(t);n==null&&(n=new Map,this._perCollectorRegistry.set(t,n)),this._registerStorage(r,n)},e.prototype.findOrUpdateCompatibleStorage=function(t){var r=this._sharedRegistry.get(t.name);return r===void 0?null:this._findOrUpdateCompatibleStorage(t,r)},e.prototype.findOrUpdateCompatibleCollectorStorage=function(t,r){var n=this._perCollectorRegistry.get(t);if(n===void 0)return null;var i=n.get(r.name);return i===void 0?null:this._findOrUpdateCompatibleStorage(r,i)},e.prototype._registerStorage=function(t,r){var n=t.getInstrumentDescriptor(),i=r.get(n.name);if(i===void 0){r.set(n.name,[t]);return}i.push(t)},e.prototype._findOrUpdateCompatibleStorage=function(t,r){var n,i,o=null;try{for(var s=fn(r),u=s.next();!u.done;u=s.next()){var l=u.value,a=l.getInstrumentDescriptor();$o(a,t)?(a.description!==t.description&&(t.description.length>a.description.length&&l.updateDescription(t.description),p.warn("A view or instrument with the name ",t.name,` has already been registered, but has a different description and is incompatible with another registered view.
10
+ `,`Details:
11
+ `,cn(a,t),`The longer description will be used.
12
+ To resolve the conflict:`,ln(a,t))),o=l):p.warn("A view or instrument with the name ",t.name,` has already been registered and is incompatible with another registered view.
13
+ `,`Details:
14
+ `,cn(a,t),`To resolve the conflict:
15
+ `,ln(a,t))}}catch(c){n={error:c}}finally{try{u&&!u.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}return o},e})();var Ni=(function(){function e(t){this._backingStorages=t}return e.prototype.record=function(t,r,n,i){this._backingStorages.forEach(function(o){o.record(t,r,n,i)})},e})();d();d();var Ci=(function(){function e(t,r){this._instrumentName=t,this._valueType=r,this._buffer=new N}return e.prototype.observe=function(t,r){if(r===void 0&&(r={}),typeof t!="number"){p.warn("non-number value provided to metric "+this._instrumentName+": "+t);return}this._valueType===y.INT&&!Number.isInteger(t)&&(p.warn("INT value type cannot accept a floating-point value for "+this._instrumentName+", ignoring the fractional digits."),t=Math.trunc(t),!Number.isInteger(t))||this._buffer.set(r,t)},e})();var Ui=(function(){function e(){this._buffer=new Map}return e.prototype.observe=function(t,r,n){if(n===void 0&&(n={}),!!zt(t)){var i=this._buffer.get(t);if(i==null&&(i=new N,this._buffer.set(t,i)),typeof r!="number"){p.warn("non-number value provided to metric "+t._descriptor.name+": "+r);return}t._descriptor.valueType===y.INT&&!Number.isInteger(r)&&(p.warn("INT value type cannot accept a floating-point value for "+t._descriptor.name+", ignoring the fractional digits."),r=Math.trunc(r),!Number.isInteger(r))||i.set(n,r)}},e})();var pn=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function u(c){try{a(n.next(c))}catch(f){s(f)}}function l(c){try{a(n.throw(c))}catch(f){s(f)}}function a(c){c.done?o(c.value):i(c.value).then(u,l)}a((n=n.apply(e,t||[])).next())})},_n=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(c){return l([a,c])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(c){a=[6,c],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},Di=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},Gi=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},Vi=(function(){function e(){this._callbacks=[],this._batchCallbacks=[]}return e.prototype.addCallback=function(t,r){var n=this._findCallback(t,r);n>=0||this._callbacks.push({callback:t,instrument:r})},e.prototype.removeCallback=function(t,r){var n=this._findCallback(t,r);n<0||this._callbacks.splice(n,1)},e.prototype.addBatchCallback=function(t,r){var n=new Set(r.filter(zt));if(n.size===0){p.error("BatchObservableCallback is not associated with valid instruments",r);return}var i=this._findBatchCallback(t,n);i>=0||this._batchCallbacks.push({callback:t,instruments:n})},e.prototype.removeBatchCallback=function(t,r){var n=new Set(r.filter(zt)),i=this._findBatchCallback(t,n);i<0||this._batchCallbacks.splice(i,1)},e.prototype.observe=function(t,r){return pn(this,void 0,void 0,function(){var n,i,o,s;return _n(this,function(u){switch(u.label){case 0:return n=this._observeCallbacks(t,r),i=this._observeBatchCallbacks(t,r),[4,Ko(Gi(Gi([],Di(n),!1),Di(i),!1))];case 1:return o=u.sent(),s=o.filter(Xo).map(function(l){return l.reason}),[2,s]}})})},e.prototype._observeCallbacks=function(t,r){var n=this;return this._callbacks.map(function(i){var o=i.callback,s=i.instrument;return pn(n,void 0,void 0,function(){var u,l;return _n(this,function(a){switch(a.label){case 0:return u=new Ci(s._descriptor.name,s._descriptor.valueType),l=Promise.resolve(o(u)),r!=null&&(l=j(l,r)),[4,l];case 1:return a.sent(),s._metricStorages.forEach(function(c){c.record(u._buffer,t)}),[2]}})})})},e.prototype._observeBatchCallbacks=function(t,r){var n=this;return this._batchCallbacks.map(function(i){var o=i.callback,s=i.instruments;return pn(n,void 0,void 0,function(){var u,l;return _n(this,function(a){switch(a.label){case 0:return u=new Ui,l=Promise.resolve(o(u)),r!=null&&(l=j(l,r)),[4,l];case 1:return a.sent(),s.forEach(function(c){var f=u._buffer.get(c);f!=null&&c._metricStorages.forEach(function(h){h.record(f,t)})}),[2]}})})})},e.prototype._findCallback=function(t,r){return this._callbacks.findIndex(function(n){return n.callback===t&&n.instrument===r})},e.prototype._findBatchCallback=function(t,r){return this._batchCallbacks.findIndex(function(n){return n.callback===t&&Yo(n.instruments,r)})},e})();var Ac=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),Bi=(function(e){Ac(t,e);function t(r,n,i,o,s){var u=e.call(this,r)||this;return u._attributesProcessor=i,u._aggregationCardinalityLimit=s,u._deltaMetricStorage=new Ze(n,u._aggregationCardinalityLimit),u._temporalMetricStorage=new qe(n,o),u}return t.prototype.record=function(r,n,i,o){n=this._attributesProcessor.process(n,i),this._deltaMetricStorage.record(r,n,i,o)},t.prototype.collect=function(r,n){var i=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(r,this._instrumentDescriptor,i,n)},t})($e);var Hi=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),ht=(function(){function e(){}return e.Noop=function(){return Rc},e})();var Oc=(function(e){Hi(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.process=function(r,n){return r},t})(ht);var Fi=(function(e){Hi(t,e);function t(r){var n=e.call(this)||this;return n._allowedAttributeNames=r,n}return t.prototype.process=function(r,n){var i=this,o={};return Object.keys(r).filter(function(s){return i._allowedAttributeNames.includes(s)}).forEach(function(s){return o[s]=r[s]}),o},t})(ht);var Rc=new Oc;var xc=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function u(c){try{a(n.next(c))}catch(f){s(f)}}function l(c){try{a(n.throw(c))}catch(f){s(f)}}function a(c){c.done?o(c.value):i(c.value).then(u,l)}a((n=n.apply(e,t||[])).next())})},Lc=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(c){return l([a,c])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(c){a=[6,c],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},Pc=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},ki=(function(){function e(t,r){this._meterProviderSharedState=t,this._instrumentationScope=r,this.metricStorageRegistry=new Ii,this.observableRegistry=new Vi,this.meter=new Pi(this)}return e.prototype.registerMetricStorage=function(t){var r=this._registerMetricStorage(t,Bi);return r.length===1?r[0]:new Ni(r)},e.prototype.registerAsyncMetricStorage=function(t){var r=this._registerMetricStorage(t,wi);return r},e.prototype.collect=function(t,r,n){return xc(this,void 0,void 0,function(){var i,o,s;return Lc(this,function(u){switch(u.label){case 0:return[4,this.observableRegistry.observe(r,n?.timeoutMillis)];case 1:return i=u.sent(),o=this.metricStorageRegistry.getStorages(t),o.length===0?[2,null]:(s=o.map(function(l){return l.collect(t,r)}).filter(ko),s.length===0?[2,{errors:i}]:[2,{scopeMetrics:{scope:this._instrumentationScope,metrics:s},errors:i}])}})})},e.prototype._registerMetricStorage=function(t,r){var n=this,i=this._meterProviderSharedState.viewRegistry.findViews(t,this._instrumentationScope),o=i.map(function(l){var a=Jo(l,t),c=n.metricStorageRegistry.findOrUpdateCompatibleStorage(a);if(c!=null)return c;var f=l.aggregation.createAggregator(a),h=new r(a,f,l.attributesProcessor,n._meterProviderSharedState.metricCollectors,l.aggregationCardinalityLimit);return n.metricStorageRegistry.register(h),h});if(o.length===0){var s=this._meterProviderSharedState.selectAggregations(t.type),u=s.map(function(l){var a=Pc(l,2),c=a[0],f=a[1],h=n.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(c,t);if(h!=null)return h;var E=f.createAggregator(t),M=c.selectCardinalityLimit(t.type),W=new r(t,E,ht.Noop(),[c],M);return n.metricStorageRegistry.registerForCollector(c,W),W});o=o.concat(u)}return o},e})();var bc=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ji=(function(){function e(t){this.resource=t,this.viewRegistry=new Ti,this.metricCollectors=[],this.meterSharedStates=new Map}return e.prototype.getMeterSharedState=function(t){var r=jo(t),n=this.meterSharedStates.get(r);return n==null&&(n=new ki(this,t),this.meterSharedStates.set(r,n)),n},e.prototype.selectAggregations=function(t){var r,n,i=[];try{for(var o=bc(this.metricCollectors),s=o.next();!s.done;s=o.next()){var u=s.value;i.push([u,u.selectAggregation(t)])}}catch(l){r={error:l}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i},e})();var Qe=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function u(c){try{a(n.next(c))}catch(f){s(f)}}function l(c){try{a(n.throw(c))}catch(f){s(f)}}function a(c){c.done?o(c.value):i(c.value).then(u,l)}a((n=n.apply(e,t||[])).next())})},tr=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(c){return l([a,c])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(c){a=[6,c],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},Mc=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},wc=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},Ki=(function(){function e(t,r){this._sharedState=t,this._metricReader=r}return e.prototype.collect=function(t){return Qe(this,void 0,void 0,function(){var r,n,i,o,s=this;return tr(this,function(u){switch(u.label){case 0:return r=w(Date.now()),n=[],i=[],o=Array.from(this._sharedState.meterSharedStates.values()).map(function(l){return Qe(s,void 0,void 0,function(){var a;return tr(this,function(c){switch(c.label){case 0:return[4,l.collect(this,r,t)];case 1:return a=c.sent(),a?.scopeMetrics!=null&&n.push(a.scopeMetrics),a?.errors!=null&&i.push.apply(i,wc([],Mc(a.errors),!1)),[2]}})})}),[4,Promise.all(o)];case 1:return u.sent(),[2,{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:n},errors:i}]}})})},e.prototype.forceFlush=function(t){return Qe(this,void 0,void 0,function(){return tr(this,function(r){switch(r.label){case 0:return[4,this._metricReader.forceFlush(t)];case 1:return r.sent(),[2]}})})},e.prototype.shutdown=function(t){return Qe(this,void 0,void 0,function(){return tr(this,function(r){switch(r.label){case 0:return[4,this._metricReader.shutdown(t)];case 1:return r.sent(),[2]}})})},e.prototype.selectAggregationTemporality=function(t){return this._metricReader.selectAggregationTemporality(t)},e.prototype.selectAggregation=function(t){return this._metricReader.selectAggregation(t)},e.prototype.selectCardinalityLimit=function(t){var r,n,i;return(i=(n=(r=this._metricReader).selectCardinalityLimit)===null||n===void 0?void 0:n.call(r,t))!==null&&i!==void 0?i:2e3},e})();var Xi=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function u(c){try{a(n.next(c))}catch(f){s(f)}}function l(c){try{a(n.throw(c))}catch(f){s(f)}}function a(c){c.done?o(c.value):i(c.value).then(u,l)}a((n=n.apply(e,t||[])).next())})},Yi=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(c){return l([a,c])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(c){a=[6,c],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},Wi=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Ic(e,t){var r=t??I.empty();return e?I.default().merge(r):r}var hn=(function(){function e(t){var r,n,i,o,s;if(this._shutdown=!1,this._sharedState=new ji(Ic((s=t?.mergeResourceWithDefaults)!==null&&s!==void 0?s:!0,t?.resource)),t?.views!=null&&t.views.length>0)try{for(var u=Wi(t.views),l=u.next();!l.done;l=u.next()){var a=l.value;this._sharedState.viewRegistry.addView(a)}}catch(E){r={error:E}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}if(t?.readers!=null&&t.readers.length>0)try{for(var c=Wi(t.readers),f=c.next();!f.done;f=c.next()){var h=f.value;this.addMetricReader(h)}}catch(E){i={error:E}}finally{try{f&&!f.done&&(o=c.return)&&o.call(c)}finally{if(i)throw i.error}}}return e.prototype.getMeter=function(t,r,n){return r===void 0&&(r=""),n===void 0&&(n={}),this._shutdown?(p.warn("A shutdown MeterProvider cannot provide a Meter"),Pr()):this._sharedState.getMeterSharedState({name:t,version:r,schemaUrl:n.schemaUrl}).meter},e.prototype.addMetricReader=function(t){var r=new Ki(this._sharedState,t);t.setMetricProducer(r),this._sharedState.metricCollectors.push(r)},e.prototype.shutdown=function(t){return Xi(this,void 0,void 0,function(){return Yi(this,function(r){switch(r.label){case 0:return this._shutdown?(p.warn("shutdown may only be called once per MeterProvider"),[2]):(this._shutdown=!0,[4,Promise.all(this._sharedState.metricCollectors.map(function(n){return n.shutdown(t)}))]);case 1:return r.sent(),[2]}})})},e.prototype.forceFlush=function(t){return Xi(this,void 0,void 0,function(){return Yi(this,function(r){switch(r.label){case 0:return this._shutdown?(p.warn("invalid attempt to force flush after MeterProvider shutdown"),[2]):[4,Promise.all(this._sharedState.metricCollectors.map(function(n){return n.forceFlush(t)}))];case 1:return r.sent(),[2]}})})},e})();var Nc=/[\^$\\.+?()[\]{}|]/g,er=(function(){function e(t){t==="*"?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(e.escapePattern(t)))}return e.prototype.match=function(t){return this._matchAll?!0:this._regexp.test(t)},e.escapePattern=function(t){return"^"+t.replace(Nc,"\\$&").replace("*",".*")+"$"},e.hasWildcard=function(t){return t.includes("*")},e})();var dt=(function(){function e(t){this._matchAll=t===void 0,this._pattern=t}return e.prototype.match=function(t){return!!(this._matchAll||t===this._pattern)},e})();var zi=(function(){function e(t){var r;this._nameFilter=new er((r=t?.name)!==null&&r!==void 0?r:"*"),this._type=t?.type,this._unitFilter=new dt(t?.unit)}return e.prototype.getType=function(){return this._type},e.prototype.getNameFilter=function(){return this._nameFilter},e.prototype.getUnitFilter=function(){return this._unitFilter},e})();var Ji=(function(){function e(t){this._nameFilter=new dt(t?.name),this._versionFilter=new dt(t?.version),this._schemaUrlFilter=new dt(t?.schemaUrl)}return e.prototype.getNameFilter=function(){return this._nameFilter},e.prototype.getVersionFilter=function(){return this._versionFilter},e.prototype.getSchemaUrlFilter=function(){return this._schemaUrlFilter},e})();function Cc(e){return e.instrumentName==null&&e.instrumentType==null&&e.instrumentUnit==null&&e.meterName==null&&e.meterVersion==null&&e.meterSchemaUrl==null}var rr=(function(){function e(t){var r;if(Cc(t))throw new Error("Cannot create view with no selector arguments supplied");if(t.name!=null&&(t?.instrumentName==null||er.hasWildcard(t.instrumentName)))throw new Error("Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.");t.attributeKeys!=null?this.attributesProcessor=new Fi(t.attributeKeys):this.attributesProcessor=ht.Noop(),this.name=t.name,this.description=t.description,this.aggregation=(r=t.aggregation)!==null&&r!==void 0?r:O.Default(),this.instrumentSelector=new zi({name:t.instrumentName,type:t.instrumentType,unit:t.instrumentUnit}),this.meterSelector=new Ji({name:t.meterName,version:t.meterVersion,schemaUrl:t.meterSchemaUrl}),this.aggregationCardinalityLimit=t.aggregationCardinalityLimit}return e})();function Uc(e,t){var r=Me(t);return{resource:we(e.resource),schemaUrl:void 0,scopeMetrics:Dc(e.scopeMetrics,r)}}function Dc(e,t){return Array.from(e.map(function(r){return{scope:Ie(r.scope),metrics:r.metrics.map(function(n){return Gc(n,t)}),schemaUrl:r.scope.schemaUrl}}))}function Gc(e,t){var r={name:e.descriptor.name,description:e.descriptor.description,unit:e.descriptor.unit},n=Fc(e.aggregationTemporality);switch(e.dataPointType){case A.SUM:r.sum={aggregationTemporality:n,isMonotonic:e.isMonotonic,dataPoints:$i(e,t)};break;case A.GAUGE:r.gauge={dataPoints:$i(e,t)};break;case A.HISTOGRAM:r.histogram={aggregationTemporality:n,dataPoints:Bc(e,t)};break;case A.EXPONENTIAL_HISTOGRAM:r.exponentialHistogram={aggregationTemporality:n,dataPoints:Hc(e,t)};break}return r}function Vc(e,t,r){var n={attributes:Kt(e.attributes),startTimeUnixNano:r.encodeHrTime(e.startTime),timeUnixNano:r.encodeHrTime(e.endTime)};switch(t){case y.INT:n.asInt=e.value;break;case y.DOUBLE:n.asDouble=e.value;break}return n}function $i(e,t){return e.dataPoints.map(function(r){return Vc(r,e.descriptor.valueType,t)})}function Bc(e,t){return e.dataPoints.map(function(r){var n=r.value;return{attributes:Kt(r.attributes),bucketCounts:n.buckets.counts,explicitBounds:n.buckets.boundaries,count:n.count,sum:n.sum,min:n.min,max:n.max,startTimeUnixNano:t.encodeHrTime(r.startTime),timeUnixNano:t.encodeHrTime(r.endTime)}})}function Hc(e,t){return e.dataPoints.map(function(r){var n=r.value;return{attributes:Kt(r.attributes),count:n.count,min:n.min,max:n.max,sum:n.sum,positive:{offset:n.positive.offset,bucketCounts:n.positive.bucketCounts},negative:{offset:n.negative.offset,bucketCounts:n.negative.bucketCounts},scale:n.scale,zeroCount:n.zeroCount,startTimeUnixNano:t.encodeHrTime(r.startTime),timeUnixNano:t.encodeHrTime(r.endTime)}})}function Fc(e){switch(e){case T.DELTA:return 1;case T.CUMULATIVE:return 2}}function Zi(e,t){return{resourceMetrics:e.map(function(r){return Uc(r,t)})}}var nr={serializeRequest:function(e){var t=Bo(e,{useHex:!0,useLongBits:!1}),r=new TextEncoder;return r.encode(JSON.stringify(t))},deserializeResponse:function(e){var t=new TextDecoder;return JSON.parse(t.decode(e))}};var or={serializeRequest:function(e){var t=Zi([e],{useLongBits:!1}),r=new TextEncoder;return r.encode(JSON.stringify(t))},deserializeResponse:function(e){var t=new TextDecoder;return JSON.parse(t.decode(e))}};var qi="0.57.2";var Yc=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function u(c){try{a(n.next(c))}catch(f){s(f)}}function l(c){try{a(n.throw(c))}catch(f){s(f)}}function a(c){c.done?o(c.value):i(c.value).then(u,l)}a((n=n.apply(e,t||[])).next())})},Wc=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(c){return l([a,c])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(c){a=[6,c],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},zc=(function(){function e(t){this._parameters=t,this._send=null,this._agent=null}return e.prototype.send=function(t,r){return Yc(this,void 0,void 0,function(){var n,i,o,s=this;return Wc(this,function(u){return this._send==null&&(n=(ia(),as(oa)),i=n.sendWithHttp,o=n.createHttpAgent,this._agent=o(this._parameters.url,this._parameters.agentOptions),this._send=i),[2,new Promise(function(l){var a;(a=s._send)===null||a===void 0||a.call(s,s._parameters,s._agent,t,function(c){l(c)},r)})]})})},e.prototype.shutdown=function(){},e})();function aa(e){return new zc(e)}var Jc=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function u(c){try{a(n.next(c))}catch(f){s(f)}}function l(c){try{a(n.throw(c))}catch(f){s(f)}}function a(c){c.done?o(c.value):i(c.value).then(u,l)}a((n=n.apply(e,t||[])).next())})},$c=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(c){return l([a,c])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(c){a=[6,c],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},Zc=5,qc=1e3,Qc=5e3,tl=1.5,sa=.2;function el(){return Math.random()*(2*sa)-sa}var rl=(function(){function e(t){this._transport=t}return e.prototype.retry=function(t,r,n){var i=this;return new Promise(function(o,s){setTimeout(function(){i._transport.send(t,r).then(o,s)},n)})},e.prototype.send=function(t,r){var n;return Jc(this,void 0,void 0,function(){var i,o,s,u,l,a,c;return $c(this,function(f){switch(f.label){case 0:return i=Date.now()+r,[4,this._transport.send(t,r)];case 1:o=f.sent(),s=Zc,u=qc,f.label=2;case 2:return o.status==="retryable"&&s>0?(s--,l=Math.max(Math.min(u,Qc)+el(),0),u=u*tl,a=(n=o.retryInMillis)!==null&&n!==void 0?n:l,c=i-Date.now(),a>c?[2,o]:[4,this.retry(t,c,a)]):[3,4];case 3:return o=f.sent(),[3,2];case 4:return[2,o]}})})},e.prototype.shutdown=function(){return this._transport.shutdown()},e})();function ua(e){return new rl(e.transport)}function Jt(e,t){return No({transport:ua({transport:aa(e)}),serializer:t,promiseHandler:bn(e)},{timeout:e.timeoutMillis})}d();function ca(e){var t,r=(t=process.env[e])===null||t===void 0?void 0:t.trim();if(r!=null&&r!==""){var n=Number(r);if(!Number.isNaN(n)&&Number.isFinite(n)&&n>0)return n;p.warn("Configuration: "+e+" is invalid, expected number greater than 0 (actual: "+r+")")}}function nl(e){var t=ca("OTEL_EXPORTER_OTLP_"+e+"_TIMEOUT"),r=ca("OTEL_EXPORTER_OTLP_TIMEOUT");return t??r}function la(e){var t,r=(t=process.env[e])===null||t===void 0?void 0:t.trim();if(r!==""){if(r==null||r==="none"||r==="gzip")return r;p.warn("Configuration: "+e+" is invalid, expected 'none' or 'gzip' (actual: '"+r+"')")}}function ol(e){var t=la("OTEL_EXPORTER_OTLP_"+e+"_COMPRESSION"),r=la("OTEL_EXPORTER_OTLP_COMPRESSION");return t??r}function fa(e){return{timeoutMillis:nl(e),compression:ol(e)}}d();var il=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o};function pa(e){return function(){var t,r={};return Object.entries((t=e?.())!==null&&t!==void 0?t:{}).forEach(function(n){var i=il(n,2),o=i[0],s=i[1];typeof s<"u"?r[o]=String(s):p.warn('Header "'+o+'" has invalid value ('+s+") and will be ignored")}),r}}var nt=function(){return nt=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},nt.apply(this,arguments)};function al(e,t,r){var n=nt({},r()),i={};return function(){return t!=null&&Object.assign(i,t()),e!=null&&Object.assign(i,e()),Object.assign(i,n)}}function sl(e){if(e!=null)try{return new URL(e),e}catch{throw new Error("Configuration: Could not parse user-provided export URL: '"+e+"'")}}function _a(e,t,r){var n,i,o,s;return nt(nt({},Ln(e,t,r)),{headers:al(pa(e.headers),t.headers,r.headers),url:(i=(n=sl(e.url))!==null&&n!==void 0?n:t.url)!==null&&i!==void 0?i:r.url,agentOptions:(s=(o=e.agentOptions)!==null&&o!==void 0?o:t.agentOptions)!==null&&s!==void 0?s:r.agentOptions})}function ha(e,t){return nt(nt({},Pn()),{headers:function(){return e},url:"http://localhost:4318/"+t,agentOptions:{keepAlive:!0}})}d();var sr=function(){return sr=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},sr.apply(this,arguments)};function ul(e){var t,r,n=(t=process.env["OTEL_EXPORTER_OTLP_"+e+"_HEADERS"])===null||t===void 0?void 0:t.trim(),i=(r=process.env.OTEL_EXPORTER_OTLP_HEADERS)===null||r===void 0?void 0:r.trim(),o=jt.parseKeyPairsIntoRecord(n),s=jt.parseKeyPairsIntoRecord(i);if(!(Object.keys(o).length===0&&Object.keys(s).length===0))return Object.assign({},jt.parseKeyPairsIntoRecord(i),jt.parseKeyPairsIntoRecord(n))}function cl(e){try{var t=new URL(e);return t.toString()}catch{p.warn("Configuration: Could not parse environment-provided export URL: '"+e+"', falling back to undefined");return}}function ll(e,t){try{new URL(e)}catch{p.warn("Configuration: Could not parse environment-provided export URL: '"+e+"', falling back to undefined");return}e.endsWith("/")||(e=e+"/"),e+=t;try{new URL(e)}catch{p.warn("Configuration: Provided URL appended with '"+t+"' is not a valid URL, using 'undefined' instead of '"+e+"'");return}return e}function fl(e){var t,r=(t=process.env.OTEL_EXPORTER_OTLP_ENDPOINT)===null||t===void 0?void 0:t.trim();if(!(r==null||r===""))return ll(r,e)}function pl(e){var t,r=(t=process.env["OTEL_EXPORTER_OTLP_"+e+"_ENDPOINT"])===null||t===void 0?void 0:t.trim();if(!(r==null||r===""))return cl(r)}function da(e,t){var r;return sr(sr({},fa(e)),{url:(r=pl(e))!==null&&r!==void 0?r:fl(t),headers:se(ul(e))})}d();function _l(e){return e?.keepAlive!=null&&(e.httpAgentOptions!=null?e.httpAgentOptions.keepAlive==null&&(e.httpAgentOptions.keepAlive=e.keepAlive):e.httpAgentOptions={keepAlive:e.keepAlive}),e.httpAgentOptions}function $t(e,t,r,n){return e.metadata&&p.warn("Metadata cannot be set when using http"),_a({url:e.url,headers:se(e.headers),concurrencyLimit:e.concurrencyLimit,timeoutMillis:e.timeoutMillis,compression:e.compression,agentOptions:_l(e)},da(t,r),ha(n,r))}var hl=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),Zt=(function(e){hl(t,e);function t(r){return r===void 0&&(r={}),e.call(this,Jt($t(r,"LOGS","v1/logs",{"User-Agent":"OTel-OTLP-Exporter-JavaScript/"+qi,"Content-Type":"application/json"}),nr))||this}return t})(yt);d();d();d();d();var dl=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ml=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},ma=(function(){function e(t,r,n){this.attributes={},this.totalAttributesCount=0,this._isReadonly=!1;var i=n.timestamp,o=n.observedTimestamp,s=n.severityNumber,u=n.severityText,l=n.body,a=n.attributes,c=a===void 0?{}:a,f=n.context,h=Date.now();if(this.hrTime=xe(i??h),this.hrTimeObserved=xe(o??h),f){var E=$.getSpanContext(f);E&&J(E)&&(this.spanContext=E)}this.severityNumber=s,this.severityText=u,this.body=l,this.resource=t.resource,this.instrumentationScope=r,this._logRecordLimits=t.logRecordLimits,this.setAttributes(c)}return Object.defineProperty(e.prototype,"severityText",{get:function(){return this._severityText},set:function(t){this._isLogRecordReadonly()||(this._severityText=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"severityNumber",{get:function(){return this._severityNumber},set:function(t){this._isLogRecordReadonly()||(this._severityNumber=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return this._body},set:function(t){this._isLogRecordReadonly()||(this._body=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"droppedAttributesCount",{get:function(){return this.totalAttributesCount-Object.keys(this.attributes).length},enumerable:!1,configurable:!0}),e.prototype.setAttribute=function(t,r){return this._isLogRecordReadonly()?this:r===null?this:t.length===0?(p.warn("Invalid attribute key: "+t),this):!ye(r)&&!(typeof r=="object"&&!Array.isArray(r)&&Object.keys(r).length>0)?(p.warn("Invalid attribute value set for key: "+t),this):(this.totalAttributesCount+=1,Object.keys(this.attributes).length>=this._logRecordLimits.attributeCountLimit&&!Object.prototype.hasOwnProperty.call(this.attributes,t)?(this.droppedAttributesCount===1&&p.warn("Dropping extra attributes."),this):(ye(r)?this.attributes[t]=this._truncateToSize(r):this.attributes[t]=r,this))},e.prototype.setAttributes=function(t){var r,n;try{for(var i=dl(Object.entries(t)),o=i.next();!o.done;o=i.next()){var s=ml(o.value,2),u=s[0],l=s[1];this.setAttribute(u,l)}}catch(a){r={error:a}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return this},e.prototype.setBody=function(t){return this.body=t,this},e.prototype.setSeverityNumber=function(t){return this.severityNumber=t,this},e.prototype.setSeverityText=function(t){return this.severityText=t,this},e.prototype._makeReadonly=function(){this._isReadonly=!0},e.prototype._truncateToSize=function(t){var r=this,n=this._logRecordLimits.attributeValueLengthLimit;return n<=0?(p.warn("Attribute value limit must be positive, got "+n),t):typeof t=="string"?this._truncateToLimitUtil(t,n):Array.isArray(t)?t.map(function(i){return typeof i=="string"?r._truncateToLimitUtil(i,n):i}):t},e.prototype._truncateToLimitUtil=function(t,r){return t.length<=r?t:t.substring(0,r)},e.prototype._isLogRecordReadonly=function(){return this._isReadonly&&p.warn("Can not execute the operation on emitted log record"),this._isReadonly},e})();var mn=function(){return mn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},mn.apply(this,arguments)},Ea=(function(){function e(t,r){this.instrumentationScope=t,this._sharedState=r}return e.prototype.emit=function(t){var r=t.context||L.active(),n=new ma(this._sharedState,this.instrumentationScope,mn({context:r},t));this._sharedState.activeProcessor.onEmit(n,r),n._makeReadonly()},e})();function va(){return{forceFlushTimeoutMillis:3e4,logRecordLimits:{attributeValueLengthLimit:D().OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT,attributeCountLimit:D().OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT},includeTraceContext:!0,mergeResourceWithDefaults:!0}}function ga(e){var t,r,n,i,o,s,u=Ut();return{attributeCountLimit:(n=(r=(t=e.attributeCountLimit)!==null&&t!==void 0?t:u.OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT)!==null&&r!==void 0?r:u.OTEL_ATTRIBUTE_COUNT_LIMIT)!==null&&n!==void 0?n:ft,attributeValueLengthLimit:(s=(o=(i=e.attributeValueLengthLimit)!==null&&i!==void 0?i:u.OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT)!==null&&o!==void 0?o:u.OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT)!==null&&s!==void 0?s:lt}}var Ta=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function u(c){try{a(n.next(c))}catch(f){s(f)}}function l(c){try{a(n.throw(c))}catch(f){s(f)}}function a(c){c.done?o(c.value):i(c.value).then(u,l)}a((n=n.apply(e,t||[])).next())})},Sa=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(c){return l([a,c])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(c){a=[6,c],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},ya=(function(){function e(t,r){this.processors=t,this.forceFlushTimeoutMillis=r}return e.prototype.forceFlush=function(){return Ta(this,void 0,void 0,function(){var t;return Sa(this,function(r){switch(r.label){case 0:return t=this.forceFlushTimeoutMillis,[4,Promise.all(this.processors.map(function(n){return Ft(n.forceFlush(),t)}))];case 1:return r.sent(),[2]}})})},e.prototype.onEmit=function(t,r){this.processors.forEach(function(n){return n.onEmit(t,r)})},e.prototype.shutdown=function(){return Ta(this,void 0,void 0,function(){return Sa(this,function(t){switch(t.label){case 0:return[4,Promise.all(this.processors.map(function(r){return r.shutdown()}))];case 1:return t.sent(),[2]}})})},e})();var Aa=(function(){function e(){}return e.prototype.forceFlush=function(){return Promise.resolve()},e.prototype.onEmit=function(t,r){},e.prototype.shutdown=function(){return Promise.resolve()},e})();var Oa=(function(){function e(t,r,n){this.resource=t,this.forceFlushTimeoutMillis=r,this.logRecordLimits=n,this.loggers=new Map,this.registeredLogRecordProcessors=[],this.activeProcessor=new Aa}return e})();var El="unknown";function vl(e,t){var r=t??I.empty();return e?I.default().merge(r):r}var En=(function(){function e(t){t===void 0&&(t={});var r=Yr({},va(),t),n=vl(r.mergeResourceWithDefaults,t.resource);this._sharedState=new Oa(n,r.forceFlushTimeoutMillis,ga(r.logRecordLimits)),this._shutdownOnce=new kt(this._shutdown,this)}return e.prototype.getLogger=function(t,r,n){if(this._shutdownOnce.isCalled)return p.warn("A shutdown LoggerProvider cannot provide a Logger"),Tt;t||p.warn("Logger requested without instrumentation scope name.");var i=t||El,o=i+"@"+(r||"")+":"+(n?.schemaUrl||"");return this._sharedState.loggers.has(o)||this._sharedState.loggers.set(o,new Ea({name:i,version:r,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(o)},e.prototype.addLogRecordProcessor=function(t){this._sharedState.registeredLogRecordProcessors.length===0&&this._sharedState.activeProcessor.shutdown().catch(function(r){return p.error("Error while trying to shutdown current log record processor",r)}),this._sharedState.registeredLogRecordProcessors.push(t),this._sharedState.activeProcessor=new ya(this._sharedState.registeredLogRecordProcessors,this._sharedState.forceFlushTimeoutMillis)},e.prototype.forceFlush=function(){return this._shutdownOnce.isCalled?(p.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()},e.prototype.shutdown=function(){return this._shutdownOnce.isCalled?(p.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise):this._shutdownOnce.call()},e.prototype._shutdown=function(){return this._sharedState.activeProcessor.shutdown()},e})();var gl=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},vn=(function(){function e(){}return e.prototype.export=function(t,r){this._sendLogRecords(t,r)},e.prototype.shutdown=function(){return Promise.resolve()},e.prototype._exportInfo=function(t){var r,n,i;return{resource:{attributes:t.resource.attributes},instrumentationScope:t.instrumentationScope,timestamp:k(t.hrTime),traceId:(r=t.spanContext)===null||r===void 0?void 0:r.traceId,spanId:(n=t.spanContext)===null||n===void 0?void 0:n.spanId,traceFlags:(i=t.spanContext)===null||i===void 0?void 0:i.traceFlags,severityText:t.severityText,severityNumber:t.severityNumber,body:t.body,attributes:t.attributes}},e.prototype._sendLogRecords=function(t,r){var n,i;try{for(var o=gl(t),s=o.next();!s.done;s=o.next()){var u=s.value;console.dir(this._exportInfo(u),{depth:3})}}catch(l){n={error:l}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}r?.({code:S.SUCCESS})},e})();d();var Tl=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function u(c){try{a(n.next(c))}catch(f){s(f)}}function l(c){try{a(n.throw(c))}catch(f){s(f)}}function a(c){c.done?o(c.value):i(c.value).then(u,l)}a((n=n.apply(e,t||[])).next())})},Sl=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(c){return l([a,c])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(c){a=[6,c],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},Ra=(function(){function e(t,r){var n,i,o,s;this._exporter=t,this._finishedLogRecords=[];var u=D();this._maxExportBatchSize=(n=r?.maxExportBatchSize)!==null&&n!==void 0?n:u.OTEL_BLRP_MAX_EXPORT_BATCH_SIZE,this._maxQueueSize=(i=r?.maxQueueSize)!==null&&i!==void 0?i:u.OTEL_BLRP_MAX_QUEUE_SIZE,this._scheduledDelayMillis=(o=r?.scheduledDelayMillis)!==null&&o!==void 0?o:u.OTEL_BLRP_SCHEDULE_DELAY,this._exportTimeoutMillis=(s=r?.exportTimeoutMillis)!==null&&s!==void 0?s:u.OTEL_BLRP_EXPORT_TIMEOUT,this._shutdownOnce=new kt(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(p.warn("BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}return e.prototype.onEmit=function(t){this._shutdownOnce.isCalled||this._addToBuffer(t)},e.prototype.forceFlush=function(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()},e.prototype.shutdown=function(){return this._shutdownOnce.call()},e.prototype._shutdown=function(){return Tl(this,void 0,void 0,function(){return Sl(this,function(t){switch(t.label){case 0:return this.onShutdown(),[4,this._flushAll()];case 1:return t.sent(),[4,this._exporter.shutdown()];case 2:return t.sent(),[2]}})})},e.prototype._addToBuffer=function(t){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(t),this._maybeStartTimer())},e.prototype._flushAll=function(){var t=this;return new Promise(function(r,n){for(var i=[],o=Math.ceil(t._finishedLogRecords.length/t._maxExportBatchSize),s=0;s<o;s++)i.push(t._flushOneBatch());Promise.all(i).then(function(){r()}).catch(n)})},e.prototype._flushOneBatch=function(){var t=this;return this._clearTimer(),this._finishedLogRecords.length===0?Promise.resolve():new Promise(function(r,n){Ft(t._export(t._finishedLogRecords.splice(0,t._maxExportBatchSize)),t._exportTimeoutMillis).then(function(){return r()}).catch(n)})},e.prototype._maybeStartTimer=function(){var t=this;this._timer===void 0&&(this._timer=setTimeout(function(){t._flushOneBatch().then(function(){t._finishedLogRecords.length>0&&(t._clearTimer(),t._maybeStartTimer())}).catch(function(r){H(r)})},this._scheduledDelayMillis),Q(this._timer))},e.prototype._clearTimer=function(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)},e.prototype._export=function(t){var r=this,n=function(){return be._export(r._exporter,t).then(function(o){var s;o.code!==S.SUCCESS&&H((s=o.error)!==null&&s!==void 0?s:new Error("BatchLogRecordProcessor: log record export failed (status "+o+")"))}).catch(H)},i=t.map(function(o){return o.resource}).filter(function(o){return o.asyncAttributesPending});return i.length===0?n():Promise.all(i.map(function(o){var s;return(s=o.waitForAsyncAttributes)===null||s===void 0?void 0:s.call(o)})).then(n,H)},e})();var yl=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),mt=(function(e){yl(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.onShutdown=function(){},t})(Ra);var qt={TARGET:"target",NAMESPACE:"namespace",ENV_NAME:"envname",HOST_IP:"net.host.ip",HOST_NAME:"net.host.name",HOST_PORT:"net.host.port",CONTAINER_NAME:"container.name",SET_NAME:"set.name",SERVICE_NAME:"service.name",SERVER_OWNER:"server.owner",TENANT_ID:"tps.tenant.id",CMDB_ID:"cmdb.module.id",LANGUAGE:"telemetry.sdk.language",SDK_NAME:"telemetry.sdk.name",SDK_VERSION:"telemetry.sdk.version"};var xa;(function(e){e.ClientStartedTotal="rpc_client_started_total",e.ClientHandledTotal="rpc_client_handled_total",e.ClientHandledSeconds="rpc_client_handled_seconds",e.ServerStartedTotal="rpc_server_started_total",e.ServerHandledTotal="rpc_server_handled_total",e.ServerHandledSeconds="rpc_server_handled_seconds"})(xa||(xa={}));var La;(function(e){e.ProcessCpuUsage="process_cpu_usage",e.ProcessResidentMemoryUsage="process_resident_memory_usage",e.ProcessNetworkInBytes="process_network_in_bytes",e.ProcessNetworkOutBytes="process_network_out_bytes",e.ProcessBlockReadBytes="process_block_read_bytes",e.ProcessBlockWriteBytes="process_block_write_bytes",e.ProcessContainerNum="process_container_num",e.ProcessGpuUsage="process_gpu_usage",e.ProcessVideoMemoryUsage="process_video_memory_usage",e.ProcessDiskUsage="process_disk_usage",e.ProcessTcpNum="process_tcp_num",e.ProcessUdpNum="process_udp_num",e.ProcessMaxFds="process_max_fds",e.ProcessOpenFds="process_open_fds",e.ProcessPidNum="process_pid_num",e.ProcessDiskFree="process_disk_free",e.ProcessDiskUsed="process_disk_used",e.ProcessDiskUsedFraction="process_disk_used_fraction",e.ProcessCpuCores="process_cpu_cores"})(La||(La={}));var g;(function(e){e.CallerService="caller_service",e.CallerMethod="caller_method",e.CallerConSetid="caller_con_setid",e.CallerServer="caller_server",e.CalleeServer="callee_server",e.CalleeService="callee_service",e.CalleeMethod="callee_method",e.CalleeConSetid="callee_con_setid",e.CallerGroup="caller_group",e.CodeType="code_type",e.Code="code",e.UserExt1="user_ext1",e.UserExt2="user_ext2",e.UserExt3="user_ext3",e.CalleeIp="callee_ip",e.CalleeContainer="callee_container",e.CallerIp="caller_ip",e.CallerContainer="caller_container"})(g||(g={}));var Pa;(function(e){e.clientMetrics="client_metrics",e.serverMetrics="server_metrics"})(Pa||(Pa={}));var R;(function(e){e.Target="target",e.EnvName="env_name",e.Namespace="namespace",e.ServiceName="service_name",e.ContainerName="container_name",e.Instance="instance",e.Version="version",e.ConSetid="con_setid"})(R||(R={}));var C;(function(e){e.Development="Development",e.Production="Production"})(C||(C={}));var Y;(function(e){e.Formal="formal",e.Test="test"})(Y||(Y={}));var ur;(function(e){e.Webjs="webjs",e.Nodejs="nodejs"})(ur||(ur={}));var ba="galileo";d();var Al="https://galileotelemetry.tencent.com/v1/metrics";var Ma="https://galileotelemetry.tencent.com/v1/logs";var Ol="https://galileotelemetry.tencent.com/v1/metrics";var Rl="https://sg.tgalileo.com/v1/metrics";var xl="http://galileotelemetry.tencent.com:80/v1/metrics";var Ll=e=>{try{let t=new URL(e).hostname.toLowerCase();if(t==="galileotelemetry.tencent.com")return"mainland-public";if(t==="sg.tgalileo.com"||t.endsWith(".sg.tgalileo.com"))return"singapore-public";if(t==="galileotelemetry.tencent.com"||t==="galileotelemetry.tencent.com"||t==="galileotelemetry.tencent.com"||t==="galileotelemetry.tencent.com")return"singapore-intranet"}catch{}return"mainland-intranet"};var wa=e=>{switch(Ll(e)){case"mainland-public":return Ol;case"singapore-public":return Rl;case"singapore-intranet":return xl;default:return Al}},Et="0.3.12",Ia="NodeStats",Pl=[g.UserExt1,g.UserExt2,g.UserExt3];var bl={[g.CallerService]:"",[g.CallerMethod]:"",[g.CallerConSetid]:"",[g.CallerServer]:"",[g.CallerGroup]:"",[g.CallerIp]:"",[g.CallerContainer]:"",[g.CalleeService]:"",[g.CalleeMethod]:"",[g.CalleeConSetid]:"",[g.CalleeServer]:"",[g.CalleeIp]:"",[g.CalleeContainer]:""};d();var Qt;(function(e){e[e.DELTA=0]="DELTA",e[e.CUMULATIVE=1]="CUMULATIVE",e[e.LOWMEMORY=2]="LOWMEMORY"})(Qt||(Qt={}));d();var Ml=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),gn=function(){return T.CUMULATIVE},Na=function(e){switch(e){case _.COUNTER:case _.OBSERVABLE_COUNTER:case _.GAUGE:case _.HISTOGRAM:case _.OBSERVABLE_GAUGE:return T.DELTA;case _.UP_DOWN_COUNTER:case _.OBSERVABLE_UP_DOWN_COUNTER:return T.CUMULATIVE}},Ca=function(e){switch(e){case _.COUNTER:case _.HISTOGRAM:return T.DELTA;case _.GAUGE:case _.UP_DOWN_COUNTER:case _.OBSERVABLE_UP_DOWN_COUNTER:case _.OBSERVABLE_COUNTER:case _.OBSERVABLE_GAUGE:return T.CUMULATIVE}};function wl(){var e=D(),t=e.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE.trim().toLowerCase();return t==="cumulative"?gn:t==="delta"?Na:t==="lowmemory"?Ca:(p.warn("OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '"+e.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE+"', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead."),gn)}function Il(e){return e!=null?e===Qt.DELTA?Na:e===Qt.LOWMEMORY?Ca:gn:wl()}function Nl(e){return e?.aggregationPreference?e.aggregationPreference:function(t){return O.Default()}}var Ua=(function(e){Ml(t,e);function t(r,n){var i=e.call(this,r)||this;return i._aggregationSelector=Nl(n),i._aggregationTemporalitySelector=Il(n?.temporalityPreference),i}return t.prototype.selectAggregation=function(r){return this._aggregationSelector(r)},t.prototype.selectAggregationTemporality=function(r){return this._aggregationTemporalitySelector(r)},t})(yt);var Da="0.57.2";var Cl=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),cr=function(){return cr=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},cr.apply(this,arguments)},Ul={"User-Agent":"OTel-OTLP-Exporter-JavaScript/"+Da},te=(function(e){Cl(t,e);function t(r){return e.call(this,Jt($t(r??{},"METRICS","v1/metrics",cr(cr({},Ul),{"Content-Type":"application/json"})),or),r)||this}return t})(Ua);var Ga=e=>{let r=[new sn({exporter:new te({temporalityPreference:T.DELTA,url:e.addr,concurrencyLimit:30,compression:Ot.GZIP}),exportIntervalMillis:3e4,exportTimeoutMillis:2e4})],n=[new rr({instrumentName:"node_instrument_start",aggregation:new Wt,instrumentType:_.COUNTER}),new rr({instrumentName:"node_instrument_end",aggregation:new Wt,instrumentType:_.COUNTER})];return new hn({resource:e.resource,views:n,readers:r})};var Ba=(e,t,r)=>Ga({resource:new I({[R.Target]:"PCG-123.galileo.otp",[R.ServiceName]:"galileo.otp",[R.Namespace]:C.Production,[R.EnvName]:e===C.Production?Y.Formal:t,[R.Version]:Et,[R.Instance]:"",[R.ContainerName]:"",[R.ConSetid]:""}),addr:r});var Va=function(){let e=new WeakSet;return function(t,r){if(r instanceof Error)return`Error.message: ${r.message}
16
+ Error.stack: ${r.stack}`;if(typeof r=="object"&&r!==null){if(e.has(r))return`[Circular ${t||"root"}]`;e.add(r)}return r}},Ha=function(e){if(typeof e=="string")return e;try{return e instanceof Error?(JSON.stringify(e,Va())||"undefined").replace(/"/gim,""):JSON.stringify(e,Va())||"undefined"}catch(t){return`error happen when aegis stringify:
17
+ ${t?.message}
18
+ ${t?.stack}`}};var Fa=()=>{var e;let t=$.getSpan(L.active());return((e=t?.spanContext())===null||e===void 0?void 0:e.traceFlags)===z.SAMPLED};var ee;(function(e){e.trace="trace",e.debug="debug",e.info="info",e.warn="warn",e.error="error"})(ee||(ee={}));var vt;(function(e){e[e.trace=1]="trace",e[e.debug=5]="debug",e[e.info=9]="info",e[e.warn=13]="warn",e[e.error=17]="error"})(vt||(vt={}));function Dl(e){if(!e)return ee.trace;if(typeof e=="string"){let t=e.toLowerCase();return Object.values(ee).includes(t)?t:ee.trace}return e}var lr=class{constructor(t){var r;this.getResource=re=>{let{platform:ts,serverName:yn}=this;return new I({[R.Target]:`${ts}.${yn}`,[R.Namespace]:re,[qt.SERVICE_NAME]:`${yn}`,[qt.SDK_NAME]:ba,[qt.LANGUAGE]:ur.Nodejs,[qt.SDK_VERSION]:Et})};let{env:n=Y.Test,namespace:i,app:o,server:s,attributes:u={},platform:l,logCollectorAddr:a=Ma,enableLocalConsole:c=!1,enableConsole:f=!1,level:h,mustLogTraced:E=!1}=t,M=i===C.Production?Y.Formal:n,W=wa(a);this.platform=l,this.serverName=`${o}.${s}`,this.enableLocalConsole=c,this.enableConsole=f,this.mustLogTraced=E;let ot=(r=process.env)===null||r===void 0?void 0:r.GALILEO_LOG_LEVEL;if(this.currentLevel=Dl(h||ot),!this.serverName)throw new Error("app and server are required");this.initLogRecorder(M,u),this.logger=this.initLogger(i,M,a),this.selfMeter=Ba(i,M,W).getMeter(Ia,""),this.selfAttributes={SdkTarget:`${l}.${this.serverName}`,TargetNameSpace:i,ReportType:"log",Protocol:"",Kind:"",Status:""},this.nodeInstrumentStartCounter=this.selfMeter.createCounter("node_instrument_start",{valueType:y.INT}),this.nodeInstrumentEndCounter=this.selfMeter.createCounter("node_instrument_end",{valueType:y.INT});try{this.enableConsole&&this.overrideConsole()}catch{}}initLogRecorder(t,r){this.logRecorder={severityNumber:gt.INFO,severityText:"info",body:"",attributes:{...r,server:this.serverName,env:t},instrumentationScope:{name:"default",version:Et}}}updateLogRecorderAttributes(t){if(!t)throw new Error("attributes is required");this.logRecorder.attributes={...this.logRecorder.attributes,...t}}initLogger(t,r,n){let i=this.getResource(t),o=new En({resource:i}),s={url:n,headers:{"Content-Type":"application/json"},concurrencyLimit:30},u=new Zt(s),l=new mt(u);return o.addLogRecordProcessor(l),this.enableLocalConsole&&t!==C.Production&&r!==Y.Formal&&o.addLogRecordProcessor(new mt(new vn)),o.getLogger("default",Et)}emit(t){this.logger.emit(t)}overrideConsole(){let t=console,r=this;["log","info","error","warn","debug","trace"].forEach(i=>{let o=t[i];console[i]=function(...s){try{let u=new Error().stack,l="";if(u){let a=u.split(`
19
+ `);a.length>2&&(l=a[2].trim())}if(l.includes("trpc-config-env"))return;if(!l.includes("galileo-node-sdk")){let a=s.map(c=>typeof c=="string"?c:Ha(c)).join(" ");i==="log"?r.method("info",`[Console.log] ${a}`):r.method(i,`[Console.${i}] ${a}`)}}catch{}o.apply(t,s)}})}shouldLog(t){return vt[t]>=vt[this.currentLevel]}method(t,r,n){var i,o;this.nodeInstrumentStartCounter.add(1,{...this.selfAttributes});let s=t;if(!(s in vt))throw new Error(`method [${s}] not found`);if(!(this.mustLogTraced&&Fa())&&!this.shouldLog(s))return;let l=n&&!(!((i=Object.values(n))===null||i===void 0)&&i.some(E=>typeof E!="string")),a={},c=$.getSpan(L.active()),f=(o=c?.attributes)===null||o===void 0?void 0:o["http.user_agent"];f&&(a.user_agent=f);let h={...this.logRecorder,attributes:{...this.logRecorder.attributes,...a,...l?n:{}},severityNumber:vt[s],severityText:s,body:r};this.nodeInstrumentEndCounter.add(1,{...this.selfAttributes,Status:"success"}),this.emit(h)}info(t,r){this.method("info",t,r)}error(t,r){this.method("error",t,r)}debug(t,r){this.method("debug",t,r)}trace(t,r){this.method("trace",t,r)}warn(t,r){this.method("warn",t,r)}sampledInfo(t,r){this.method("info",t,r)}};var Gl=!0,Vl={siboot:"",coboot:"https://galileotelemetry.tencent.com"};function ka(e,t,r={platform:e==="coboot"?"ElectronApp":"Electron",app:e,server:"app_main"}){let n=Vl[e];return{...r,namespace:t?C.Production:C.Development,env:t?"formal":"test",metricsCollectorAddr:`${n}/v1/metrics`,traceCollectorAddr:`${n}/v1/traces`,logCollectorAddr:`${n}/v1/logs`,enableRemoteConfig:!1}}function ja(e){return new lr(e)}var Tn=(e,t)=>e[t]?.trim()||void 0;function Bl(e,t=process.env){return{platform:Tn(t,"CU_HEADLESS_GALILEO_PLATFORM")||(e==="coboot"?"ElectronApp":"Electron"),app:Tn(t,"CU_HEADLESS_GALILEO_APP")||e,server:Tn(t,"CU_HEADLESS_GALILEO_SERVER")||"app_main"}}function Ka(e,t,r=process.env){return{...ka(e,t,Bl(e,r)),enableHTTP:!1,enableTRPC:!1,enableFetch:!1,traceConfig:{enable:!1,processor:{sampler:{fraction:0,enableRandomSample:!1,enableParentSample:!1},enableTraceBody:!1}}}}var Ya=16384,jl=15100,Kl=/(?:^|\s)(event|level|run_id|daemon_pid|pid|start_count|retry_ms|duration_ms|stopping|exit_signal|job_id|type|version|from_version|target_version|phase|exit_code)=([^\s]+)/g;function Wa(e){return ne(e.replace(/https?:\/\/[^\s"'<>]+/gi,t=>{try{let r=new URL(t);return r.username="",r.password="",r.search="",r.hash="",r.toString()}catch{return"[redacted-url]"}}).replace(/\b(signature|sign|HEADLESS_DEVICE_TOKEN)\s*[:=]\s*[^\s,;]+/gi,"$1=[redacted]"))}function Xl(e){return/^\S+ \[daemon\] /.test(e)||e.startsWith("[daemon]")?"daemon":/^\S+ \[anydev-update\] /.test(e)?"update":"startup"}function Yl(e){if(!e.SIBOOT_BASE_DIR)return e.APP_VERSION||"unknown";try{return JSON.parse(Hl.readFileSync(Fl.join(e.SIBOOT_BASE_DIR,"current/manifest.json"),"utf8")).version||e.APP_VERSION||"unknown"}catch{return e.APP_VERSION||"unknown"}}function Wl(e,t,r,n){let i={clientType:r.CLIENT_TYPE||"anydev",hostname:r.HOSTNAME||Xa.hostname(),device_id:r.HOSTNAME||Xa.hostname(),uid:r.CLIENT_UID||r.ANY_USERNAME||"",log_source:n,stream:t,version:Yl(r)};for(let s of e.matchAll(Kl))i[s[1]]=s[2];return{level:i.level==="error"||t==="stderr"||i.level!=="info"&&/\b(failed|error|missing|job_failed)\b/i.test(e)?"error":"info",body:Wa(e),attributes:Object.fromEntries(Object.entries(i).map(([s,u])=>[s,Wa(u)]))}}var fr=class{constructor(t){this.env=t;let r=Ka("coboot",!(t.BACKEND_URL||"").includes("testsite"),{});this.logger=ja({...r,enableConsole:!1,enableLocalConsole:!1})}logger;lastRecordAt=0;closing;record(t,r,n=Xl(t)){if(!t.trim()||this.closing)return;let i=Wl(t,r,this.env,n);An(this.logger,i.level,i.body,i.attributes),this.lastRecordAt=Date.now()}close(){let t=this.lastRecordAt?Math.max(0,jl-(Date.now()-this.lastRecordAt)):0;return this.closing??=new Promise(r=>setTimeout(r,t)),this.closing}};function za(e){let t=new kl("utf8"),r="",n=!1,i=o=>{for(let s of o.split(/(?<=\n)/))n||(r+=s,r.length>Ya&&(r=r.slice(0,Ya),n=!0)),s.endsWith(`
20
+ `)&&(e(r.trimEnd()),r="",n=!1)};return{write:o=>i(t.write(o)),end:()=>{i(t.end()),r&&e(r),r=""}}}function Ja(e){if(process.env.ANYDEV_LOG_CAPTURED==="1"||e==="startup"&&process.argv.slice(2).includes("logs"))return()=>Promise.resolve();let t=new fr(process.env),r=["stdout","stderr"].map(o=>{let s=process[o],u=s.write.bind(s),l=za(a=>t.record(a,o,e));return s.write=(a,c,f)=>(l.write(typeof a=="string"?Buffer.from(a,typeof c=="string"?c:void 0):Buffer.from(a)),typeof c=="function"?u(a,c):u(a,c,f)),{lines:l,stream:s,original:u}}),n,i=()=>{if(!n){for(let{lines:o,stream:s,original:u}of r)s.write=u,o.end();n=t.close()}return n};return process.once("beforeExit",()=>{i()}),i}import{spawnSync as zl}from"child_process";import Jl from"fs";import Sn from"path";import b from"process";import{fileURLToPath as $l}from"url";var xT=Ja("startup"),$a=18,Zl=20,qa="node@22",Qa=$l(import.meta.url);function ql(e){return Number.parseInt(String(e).split(".")[0],10)}function Ql(e={}){let t=e.nodeVersion||b.versions.node,r=ql(t);if(!Number.isInteger(r)||r<$a)throw new Error(`Node.js >=${$a} is required to launch Headless; current version is ${t}`);let n=e.cliFile||Sn.join(Sn.dirname(Qa),"cli.mjs"),i=e.args||b.argv.slice(2);return r>=Zl?{command:e.execPath||b.execPath,args:[n,...i],bootstrapped:!1}:{command:(e.platform||b.platform)==="win32"?"npx.cmd":"npx",args:["-y","-p",qa,"node",n,...i],bootstrapped:!0}}function tf(e={}){let t=Ql(e);t.bootstrapped&&b.stderr.write(`[Headless] Node.js ${e.nodeVersion||b.versions.node} detected; using isolated ${qa}.
21
+ `);let r=(e.spawnSync||zl)(t.command,t.args,{stdio:"inherit",env:e.env||b.env});if(r.error)throw r.error;return Number.isInteger(r.status)?r.status:1}function Za(e){try{return Jl.realpathSync(e)}catch{return Sn.resolve(e)}}if(b.argv[1]&&Za(b.argv[1])===Za(Qa))try{b.exitCode=tf()}catch(e){b.stderr.write(`headless launcher: ${e instanceof Error?e.message:String(e)}
22
+ `),b.exitCode=1}export{Ql as resolveHeadlessLaunchCommand,tf as runHeadlessLauncher};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coboot/headless",
3
- "version": "0.2.2-rc.6",
3
+ "version": "0.2.2-rc.7",
4
4
  "type": "module",
5
5
  "description": "Coboot headless daemon client",
6
6
  "license": "MIT",
@@ -17,6 +17,7 @@
17
17
  "cli.mjs",
18
18
  "daemon.mjs",
19
19
  "entry.mjs",
20
+ "updater.mjs",
20
21
  "browser-runtime/",
21
22
  "native/",
22
23
  "THIRD-PARTY-NOTICES.md",
package/updater.mjs ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __runtimeCreateRequire } from "node:module"; const require = __runtimeCreateRequire(import.meta.url);
3
+ import t from"fs";import n from"path";import{spawn as w}from"child_process";var x="@coboot/headless",o=n.resolve(process.argv[2]||"");o||(process.stderr.write(`runtime update state path is required
4
+ `),process.exit(2));var i=S(o);(!i||i.phase!=="requested"&&i.phase!=="running")&&process.exit(0);var A=String(i.package_name||"").trim(),l=String(i.target_version||"").trim();(A!==x||!P(l))&&(c("failed",2,"invalid_update_target"),process.exit(2));var _=n.join(n.dirname(o),"runtime-update.lock"),g=!1,m=C(_);m===void 0&&process.exit(0);try{T({...i,phase:"running",started_at:new Date().toISOString()});let e=n.join(process.env.SIBOOT_BASE_DIR||n.dirname(n.dirname(o)),"logs","update");t.mkdirSync(e,{recursive:!0,mode:448});let r=n.join(e,`${new Date().toISOString().slice(0,10)}.log`),s=t.openSync(r,"a",384),p=process.platform==="win32"?"npx.cmd":"npx",f=process.env.SIBOOT_BASE_DIR||n.dirname(n.dirname(o)),a=n.dirname(f),O=["-y",`${A}@${l}`,"update"];process.env.COBOOT_HEADLESS_WORKING_DIRECTORY&&O.push("--workspace-dir",process.env.COBOOT_HEADLESS_WORKING_DIRECTORY);let y=w(p,O,{cwd:process.env.WORKSPACE||process.cwd(),env:{...process.env,COBOOT_DATA_ROOT:a,SIBOOT_DATA_ROOT:a,HEADLESS_NPM_UPDATE_AGENT:"1"},detached:!1,stdio:["ignore",s,s]});y.once("error",d=>{h(()=>{E(s),c("failed",1,"update_process_error",d.message),process.exitCode=1})}),y.once("exit",(d,R)=>{h(()=>{E(s);let u=b();if(d===0&&u===l){c("completed",0,"","",u);return}let k=u===String(i.from_version||"").trim()?"rolled_back":"failed";c(k,d??1,"update_process_failed",R||"",u)})})}catch(e){try{c("failed",1,"update_agent_error",I(e))}finally{D(m,_)}process.exitCode=1}function h(e){if(!g){g=!0;try{e()}catch(r){try{c("failed",1,"update_agent_callback_error",I(r))}catch{}process.exitCode=1}finally{D(m,_)}}}function E(e){try{t.closeSync(e)}catch{}}function D(e,r){try{e!==void 0&&t.closeSync(e)}catch{}try{t.rmSync(r,{force:!0})}catch{}}function C(e){let r=v(e);if(r===void 0){if(B(N(e)))return;try{t.rmSync(e,{force:!0})}catch{return}r=v(e)}if(r!==void 0){try{t.writeFileSync(r,`${process.pid}
5
+ `)}catch{}return r}}function v(e){try{return t.openSync(e,"wx",384)}catch{return}}function N(e){try{let r=Number.parseInt(t.readFileSync(e,"utf8").trim(),10);return Number.isInteger(r)&&r>0?r:0}catch{return 0}}function B(e){if(!e)return!1;try{return process.kill(e,0),!0}catch{return!1}}function I(e){return e instanceof Error?e.message:String(e)}function S(e){try{return JSON.parse(t.readFileSync(e,"utf8"))}catch{return null}}function T(e){let r=`${o}.${process.pid}.tmp`;t.writeFileSync(r,`${JSON.stringify(e,null,2)}
6
+ `,{mode:384}),t.renameSync(r,o)}function c(e,r,s,p="",f=""){let a=S(o)||i;T({...a,phase:e,exit_code:r,error_code:s,error_message:String(p).slice(0,512),actual_version:f,finished_at:new Date().toISOString()})}function b(){let e=process.env.SIBOOT_BASE_DIR||"",r=S(n.join(e,"current","manifest.json"));return typeof r?.version=="string"?r.version.trim():""}function P(e){return/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/.test(e)}